[TS] Update auto-generated bindings to LDK 0.0.118
[ldk-java] / ts / bindings.c
1 #define LDKCVec_C2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32TxOutZZZZ LDKCVec_TransactionOutputsZ
2 #define CVec_C2Tuple_ThirtyTwoBytesCVec_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 LDKBolt11SemanticError LDKBolt11SemanticError_from_js(int32_t ord) {
156         switch (ord) {
157                 case 0: return LDKBolt11SemanticError_NoPaymentHash;
158                 case 1: return LDKBolt11SemanticError_MultiplePaymentHashes;
159                 case 2: return LDKBolt11SemanticError_NoDescription;
160                 case 3: return LDKBolt11SemanticError_MultipleDescriptions;
161                 case 4: return LDKBolt11SemanticError_NoPaymentSecret;
162                 case 5: return LDKBolt11SemanticError_MultiplePaymentSecrets;
163                 case 6: return LDKBolt11SemanticError_InvalidFeatures;
164                 case 7: return LDKBolt11SemanticError_InvalidRecoveryId;
165                 case 8: return LDKBolt11SemanticError_InvalidSignature;
166                 case 9: return LDKBolt11SemanticError_ImpreciseAmount;
167         }
168         abort();
169 }
170 static inline int32_t LDKBolt11SemanticError_to_js(LDKBolt11SemanticError val) {
171         switch (val) {
172                 case LDKBolt11SemanticError_NoPaymentHash: return 0;
173                 case LDKBolt11SemanticError_MultiplePaymentHashes: return 1;
174                 case LDKBolt11SemanticError_NoDescription: return 2;
175                 case LDKBolt11SemanticError_MultipleDescriptions: return 3;
176                 case LDKBolt11SemanticError_NoPaymentSecret: return 4;
177                 case LDKBolt11SemanticError_MultiplePaymentSecrets: return 5;
178                 case LDKBolt11SemanticError_InvalidFeatures: return 6;
179                 case LDKBolt11SemanticError_InvalidRecoveryId: return 7;
180                 case LDKBolt11SemanticError_InvalidSignature: return 8;
181                 case LDKBolt11SemanticError_ImpreciseAmount: return 9;
182                 default: abort();
183         }
184 }
185 static inline LDKBolt12SemanticError LDKBolt12SemanticError_from_js(int32_t ord) {
186         switch (ord) {
187                 case 0: return LDKBolt12SemanticError_AlreadyExpired;
188                 case 1: return LDKBolt12SemanticError_UnsupportedChain;
189                 case 2: return LDKBolt12SemanticError_UnexpectedChain;
190                 case 3: return LDKBolt12SemanticError_MissingAmount;
191                 case 4: return LDKBolt12SemanticError_InvalidAmount;
192                 case 5: return LDKBolt12SemanticError_InsufficientAmount;
193                 case 6: return LDKBolt12SemanticError_UnexpectedAmount;
194                 case 7: return LDKBolt12SemanticError_UnsupportedCurrency;
195                 case 8: return LDKBolt12SemanticError_UnknownRequiredFeatures;
196                 case 9: return LDKBolt12SemanticError_UnexpectedFeatures;
197                 case 10: return LDKBolt12SemanticError_MissingDescription;
198                 case 11: return LDKBolt12SemanticError_MissingSigningPubkey;
199                 case 12: return LDKBolt12SemanticError_InvalidSigningPubkey;
200                 case 13: return LDKBolt12SemanticError_UnexpectedSigningPubkey;
201                 case 14: return LDKBolt12SemanticError_MissingQuantity;
202                 case 15: return LDKBolt12SemanticError_InvalidQuantity;
203                 case 16: return LDKBolt12SemanticError_UnexpectedQuantity;
204                 case 17: return LDKBolt12SemanticError_InvalidMetadata;
205                 case 18: return LDKBolt12SemanticError_UnexpectedMetadata;
206                 case 19: return LDKBolt12SemanticError_MissingPayerMetadata;
207                 case 20: return LDKBolt12SemanticError_MissingPayerId;
208                 case 21: return LDKBolt12SemanticError_DuplicatePaymentId;
209                 case 22: return LDKBolt12SemanticError_MissingPaths;
210                 case 23: return LDKBolt12SemanticError_InvalidPayInfo;
211                 case 24: return LDKBolt12SemanticError_MissingCreationTime;
212                 case 25: return LDKBolt12SemanticError_MissingPaymentHash;
213                 case 26: return LDKBolt12SemanticError_MissingSignature;
214         }
215         abort();
216 }
217 static inline int32_t LDKBolt12SemanticError_to_js(LDKBolt12SemanticError val) {
218         switch (val) {
219                 case LDKBolt12SemanticError_AlreadyExpired: return 0;
220                 case LDKBolt12SemanticError_UnsupportedChain: return 1;
221                 case LDKBolt12SemanticError_UnexpectedChain: return 2;
222                 case LDKBolt12SemanticError_MissingAmount: return 3;
223                 case LDKBolt12SemanticError_InvalidAmount: return 4;
224                 case LDKBolt12SemanticError_InsufficientAmount: return 5;
225                 case LDKBolt12SemanticError_UnexpectedAmount: return 6;
226                 case LDKBolt12SemanticError_UnsupportedCurrency: return 7;
227                 case LDKBolt12SemanticError_UnknownRequiredFeatures: return 8;
228                 case LDKBolt12SemanticError_UnexpectedFeatures: return 9;
229                 case LDKBolt12SemanticError_MissingDescription: return 10;
230                 case LDKBolt12SemanticError_MissingSigningPubkey: return 11;
231                 case LDKBolt12SemanticError_InvalidSigningPubkey: return 12;
232                 case LDKBolt12SemanticError_UnexpectedSigningPubkey: return 13;
233                 case LDKBolt12SemanticError_MissingQuantity: return 14;
234                 case LDKBolt12SemanticError_InvalidQuantity: return 15;
235                 case LDKBolt12SemanticError_UnexpectedQuantity: return 16;
236                 case LDKBolt12SemanticError_InvalidMetadata: return 17;
237                 case LDKBolt12SemanticError_UnexpectedMetadata: return 18;
238                 case LDKBolt12SemanticError_MissingPayerMetadata: return 19;
239                 case LDKBolt12SemanticError_MissingPayerId: return 20;
240                 case LDKBolt12SemanticError_DuplicatePaymentId: return 21;
241                 case LDKBolt12SemanticError_MissingPaths: return 22;
242                 case LDKBolt12SemanticError_InvalidPayInfo: return 23;
243                 case LDKBolt12SemanticError_MissingCreationTime: return 24;
244                 case LDKBolt12SemanticError_MissingPaymentHash: return 25;
245                 case LDKBolt12SemanticError_MissingSignature: return 26;
246                 default: abort();
247         }
248 }
249 static inline LDKCOption_NoneZ LDKCOption_NoneZ_from_js(int32_t ord) {
250         switch (ord) {
251                 case 0: return LDKCOption_NoneZ_Some;
252                 case 1: return LDKCOption_NoneZ_None;
253         }
254         abort();
255 }
256 static inline int32_t LDKCOption_NoneZ_to_js(LDKCOption_NoneZ val) {
257         switch (val) {
258                 case LDKCOption_NoneZ_Some: return 0;
259                 case LDKCOption_NoneZ_None: return 1;
260                 default: abort();
261         }
262 }
263 static inline LDKChannelMonitorUpdateStatus LDKChannelMonitorUpdateStatus_from_js(int32_t ord) {
264         switch (ord) {
265                 case 0: return LDKChannelMonitorUpdateStatus_Completed;
266                 case 1: return LDKChannelMonitorUpdateStatus_InProgress;
267                 case 2: return LDKChannelMonitorUpdateStatus_UnrecoverableError;
268         }
269         abort();
270 }
271 static inline int32_t LDKChannelMonitorUpdateStatus_to_js(LDKChannelMonitorUpdateStatus val) {
272         switch (val) {
273                 case LDKChannelMonitorUpdateStatus_Completed: return 0;
274                 case LDKChannelMonitorUpdateStatus_InProgress: return 1;
275                 case LDKChannelMonitorUpdateStatus_UnrecoverableError: return 2;
276                 default: abort();
277         }
278 }
279 static inline LDKChannelShutdownState LDKChannelShutdownState_from_js(int32_t ord) {
280         switch (ord) {
281                 case 0: return LDKChannelShutdownState_NotShuttingDown;
282                 case 1: return LDKChannelShutdownState_ShutdownInitiated;
283                 case 2: return LDKChannelShutdownState_ResolvingHTLCs;
284                 case 3: return LDKChannelShutdownState_NegotiatingClosingFee;
285                 case 4: return LDKChannelShutdownState_ShutdownComplete;
286         }
287         abort();
288 }
289 static inline int32_t LDKChannelShutdownState_to_js(LDKChannelShutdownState val) {
290         switch (val) {
291                 case LDKChannelShutdownState_NotShuttingDown: return 0;
292                 case LDKChannelShutdownState_ShutdownInitiated: return 1;
293                 case LDKChannelShutdownState_ResolvingHTLCs: return 2;
294                 case LDKChannelShutdownState_NegotiatingClosingFee: return 3;
295                 case LDKChannelShutdownState_ShutdownComplete: return 4;
296                 default: abort();
297         }
298 }
299 static inline LDKConfirmationTarget LDKConfirmationTarget_from_js(int32_t ord) {
300         switch (ord) {
301                 case 0: return LDKConfirmationTarget_OnChainSweep;
302                 case 1: return LDKConfirmationTarget_MaxAllowedNonAnchorChannelRemoteFee;
303                 case 2: return LDKConfirmationTarget_MinAllowedAnchorChannelRemoteFee;
304                 case 3: return LDKConfirmationTarget_MinAllowedNonAnchorChannelRemoteFee;
305                 case 4: return LDKConfirmationTarget_AnchorChannelFee;
306                 case 5: return LDKConfirmationTarget_NonAnchorChannelFee;
307                 case 6: return LDKConfirmationTarget_ChannelCloseMinimum;
308         }
309         abort();
310 }
311 static inline int32_t LDKConfirmationTarget_to_js(LDKConfirmationTarget val) {
312         switch (val) {
313                 case LDKConfirmationTarget_OnChainSweep: return 0;
314                 case LDKConfirmationTarget_MaxAllowedNonAnchorChannelRemoteFee: return 1;
315                 case LDKConfirmationTarget_MinAllowedAnchorChannelRemoteFee: return 2;
316                 case LDKConfirmationTarget_MinAllowedNonAnchorChannelRemoteFee: return 3;
317                 case LDKConfirmationTarget_AnchorChannelFee: return 4;
318                 case LDKConfirmationTarget_NonAnchorChannelFee: return 5;
319                 case LDKConfirmationTarget_ChannelCloseMinimum: return 6;
320                 default: abort();
321         }
322 }
323 static inline LDKCreationError LDKCreationError_from_js(int32_t ord) {
324         switch (ord) {
325                 case 0: return LDKCreationError_DescriptionTooLong;
326                 case 1: return LDKCreationError_RouteTooLong;
327                 case 2: return LDKCreationError_TimestampOutOfBounds;
328                 case 3: return LDKCreationError_InvalidAmount;
329                 case 4: return LDKCreationError_MissingRouteHints;
330                 case 5: return LDKCreationError_MinFinalCltvExpiryDeltaTooShort;
331         }
332         abort();
333 }
334 static inline int32_t LDKCreationError_to_js(LDKCreationError val) {
335         switch (val) {
336                 case LDKCreationError_DescriptionTooLong: return 0;
337                 case LDKCreationError_RouteTooLong: return 1;
338                 case LDKCreationError_TimestampOutOfBounds: return 2;
339                 case LDKCreationError_InvalidAmount: return 3;
340                 case LDKCreationError_MissingRouteHints: return 4;
341                 case LDKCreationError_MinFinalCltvExpiryDeltaTooShort: return 5;
342                 default: abort();
343         }
344 }
345 static inline LDKCurrency LDKCurrency_from_js(int32_t ord) {
346         switch (ord) {
347                 case 0: return LDKCurrency_Bitcoin;
348                 case 1: return LDKCurrency_BitcoinTestnet;
349                 case 2: return LDKCurrency_Regtest;
350                 case 3: return LDKCurrency_Simnet;
351                 case 4: return LDKCurrency_Signet;
352         }
353         abort();
354 }
355 static inline int32_t LDKCurrency_to_js(LDKCurrency val) {
356         switch (val) {
357                 case LDKCurrency_Bitcoin: return 0;
358                 case LDKCurrency_BitcoinTestnet: return 1;
359                 case LDKCurrency_Regtest: return 2;
360                 case LDKCurrency_Simnet: return 3;
361                 case LDKCurrency_Signet: return 4;
362                 default: abort();
363         }
364 }
365 static inline LDKHTLCClaim LDKHTLCClaim_from_js(int32_t ord) {
366         switch (ord) {
367                 case 0: return LDKHTLCClaim_OfferedTimeout;
368                 case 1: return LDKHTLCClaim_OfferedPreimage;
369                 case 2: return LDKHTLCClaim_AcceptedTimeout;
370                 case 3: return LDKHTLCClaim_AcceptedPreimage;
371                 case 4: return LDKHTLCClaim_Revocation;
372         }
373         abort();
374 }
375 static inline int32_t LDKHTLCClaim_to_js(LDKHTLCClaim val) {
376         switch (val) {
377                 case LDKHTLCClaim_OfferedTimeout: return 0;
378                 case LDKHTLCClaim_OfferedPreimage: return 1;
379                 case LDKHTLCClaim_AcceptedTimeout: return 2;
380                 case LDKHTLCClaim_AcceptedPreimage: return 3;
381                 case LDKHTLCClaim_Revocation: return 4;
382                 default: abort();
383         }
384 }
385 static inline LDKIOError LDKIOError_from_js(int32_t ord) {
386         switch (ord) {
387                 case 0: return LDKIOError_NotFound;
388                 case 1: return LDKIOError_PermissionDenied;
389                 case 2: return LDKIOError_ConnectionRefused;
390                 case 3: return LDKIOError_ConnectionReset;
391                 case 4: return LDKIOError_ConnectionAborted;
392                 case 5: return LDKIOError_NotConnected;
393                 case 6: return LDKIOError_AddrInUse;
394                 case 7: return LDKIOError_AddrNotAvailable;
395                 case 8: return LDKIOError_BrokenPipe;
396                 case 9: return LDKIOError_AlreadyExists;
397                 case 10: return LDKIOError_WouldBlock;
398                 case 11: return LDKIOError_InvalidInput;
399                 case 12: return LDKIOError_InvalidData;
400                 case 13: return LDKIOError_TimedOut;
401                 case 14: return LDKIOError_WriteZero;
402                 case 15: return LDKIOError_Interrupted;
403                 case 16: return LDKIOError_Other;
404                 case 17: return LDKIOError_UnexpectedEof;
405         }
406         abort();
407 }
408 static inline int32_t LDKIOError_to_js(LDKIOError val) {
409         switch (val) {
410                 case LDKIOError_NotFound: return 0;
411                 case LDKIOError_PermissionDenied: return 1;
412                 case LDKIOError_ConnectionRefused: return 2;
413                 case LDKIOError_ConnectionReset: return 3;
414                 case LDKIOError_ConnectionAborted: return 4;
415                 case LDKIOError_NotConnected: return 5;
416                 case LDKIOError_AddrInUse: return 6;
417                 case LDKIOError_AddrNotAvailable: return 7;
418                 case LDKIOError_BrokenPipe: return 8;
419                 case LDKIOError_AlreadyExists: return 9;
420                 case LDKIOError_WouldBlock: return 10;
421                 case LDKIOError_InvalidInput: return 11;
422                 case LDKIOError_InvalidData: return 12;
423                 case LDKIOError_TimedOut: return 13;
424                 case LDKIOError_WriteZero: return 14;
425                 case LDKIOError_Interrupted: return 15;
426                 case LDKIOError_Other: return 16;
427                 case LDKIOError_UnexpectedEof: return 17;
428                 default: abort();
429         }
430 }
431 static inline LDKLevel LDKLevel_from_js(int32_t ord) {
432         switch (ord) {
433                 case 0: return LDKLevel_Gossip;
434                 case 1: return LDKLevel_Trace;
435                 case 2: return LDKLevel_Debug;
436                 case 3: return LDKLevel_Info;
437                 case 4: return LDKLevel_Warn;
438                 case 5: return LDKLevel_Error;
439         }
440         abort();
441 }
442 static inline int32_t LDKLevel_to_js(LDKLevel val) {
443         switch (val) {
444                 case LDKLevel_Gossip: return 0;
445                 case LDKLevel_Trace: return 1;
446                 case LDKLevel_Debug: return 2;
447                 case LDKLevel_Info: return 3;
448                 case LDKLevel_Warn: return 4;
449                 case LDKLevel_Error: return 5;
450                 default: abort();
451         }
452 }
453 static inline LDKNetwork LDKNetwork_from_js(int32_t ord) {
454         switch (ord) {
455                 case 0: return LDKNetwork_Bitcoin;
456                 case 1: return LDKNetwork_Testnet;
457                 case 2: return LDKNetwork_Regtest;
458                 case 3: return LDKNetwork_Signet;
459         }
460         abort();
461 }
462 static inline int32_t LDKNetwork_to_js(LDKNetwork val) {
463         switch (val) {
464                 case LDKNetwork_Bitcoin: return 0;
465                 case LDKNetwork_Testnet: return 1;
466                 case LDKNetwork_Regtest: return 2;
467                 case LDKNetwork_Signet: return 3;
468                 default: abort();
469         }
470 }
471 static inline LDKPaymentFailureReason LDKPaymentFailureReason_from_js(int32_t ord) {
472         switch (ord) {
473                 case 0: return LDKPaymentFailureReason_RecipientRejected;
474                 case 1: return LDKPaymentFailureReason_UserAbandoned;
475                 case 2: return LDKPaymentFailureReason_RetriesExhausted;
476                 case 3: return LDKPaymentFailureReason_PaymentExpired;
477                 case 4: return LDKPaymentFailureReason_RouteNotFound;
478                 case 5: return LDKPaymentFailureReason_UnexpectedError;
479         }
480         abort();
481 }
482 static inline int32_t LDKPaymentFailureReason_to_js(LDKPaymentFailureReason val) {
483         switch (val) {
484                 case LDKPaymentFailureReason_RecipientRejected: return 0;
485                 case LDKPaymentFailureReason_UserAbandoned: return 1;
486                 case LDKPaymentFailureReason_RetriesExhausted: return 2;
487                 case LDKPaymentFailureReason_PaymentExpired: return 3;
488                 case LDKPaymentFailureReason_RouteNotFound: return 4;
489                 case LDKPaymentFailureReason_UnexpectedError: return 5;
490                 default: abort();
491         }
492 }
493 static inline LDKRecipient LDKRecipient_from_js(int32_t ord) {
494         switch (ord) {
495                 case 0: return LDKRecipient_Node;
496                 case 1: return LDKRecipient_PhantomNode;
497         }
498         abort();
499 }
500 static inline int32_t LDKRecipient_to_js(LDKRecipient val) {
501         switch (val) {
502                 case LDKRecipient_Node: return 0;
503                 case LDKRecipient_PhantomNode: return 1;
504                 default: abort();
505         }
506 }
507 static inline LDKRetryableSendFailure LDKRetryableSendFailure_from_js(int32_t ord) {
508         switch (ord) {
509                 case 0: return LDKRetryableSendFailure_PaymentExpired;
510                 case 1: return LDKRetryableSendFailure_RouteNotFound;
511                 case 2: return LDKRetryableSendFailure_DuplicatePayment;
512         }
513         abort();
514 }
515 static inline int32_t LDKRetryableSendFailure_to_js(LDKRetryableSendFailure val) {
516         switch (val) {
517                 case LDKRetryableSendFailure_PaymentExpired: return 0;
518                 case LDKRetryableSendFailure_RouteNotFound: return 1;
519                 case LDKRetryableSendFailure_DuplicatePayment: return 2;
520                 default: abort();
521         }
522 }
523 static inline LDKSecp256k1Error LDKSecp256k1Error_from_js(int32_t ord) {
524         switch (ord) {
525                 case 0: return LDKSecp256k1Error_IncorrectSignature;
526                 case 1: return LDKSecp256k1Error_InvalidMessage;
527                 case 2: return LDKSecp256k1Error_InvalidPublicKey;
528                 case 3: return LDKSecp256k1Error_InvalidSignature;
529                 case 4: return LDKSecp256k1Error_InvalidSecretKey;
530                 case 5: return LDKSecp256k1Error_InvalidSharedSecret;
531                 case 6: return LDKSecp256k1Error_InvalidRecoveryId;
532                 case 7: return LDKSecp256k1Error_InvalidTweak;
533                 case 8: return LDKSecp256k1Error_NotEnoughMemory;
534                 case 9: return LDKSecp256k1Error_InvalidPublicKeySum;
535                 case 10: return LDKSecp256k1Error_InvalidParityValue;
536         }
537         abort();
538 }
539 static inline int32_t LDKSecp256k1Error_to_js(LDKSecp256k1Error val) {
540         switch (val) {
541                 case LDKSecp256k1Error_IncorrectSignature: return 0;
542                 case LDKSecp256k1Error_InvalidMessage: return 1;
543                 case LDKSecp256k1Error_InvalidPublicKey: return 2;
544                 case LDKSecp256k1Error_InvalidSignature: return 3;
545                 case LDKSecp256k1Error_InvalidSecretKey: return 4;
546                 case LDKSecp256k1Error_InvalidSharedSecret: return 5;
547                 case LDKSecp256k1Error_InvalidRecoveryId: return 6;
548                 case LDKSecp256k1Error_InvalidTweak: return 7;
549                 case LDKSecp256k1Error_NotEnoughMemory: return 8;
550                 case LDKSecp256k1Error_InvalidPublicKeySum: return 9;
551                 case LDKSecp256k1Error_InvalidParityValue: return 10;
552                 default: abort();
553         }
554 }
555 static inline LDKSiPrefix LDKSiPrefix_from_js(int32_t ord) {
556         switch (ord) {
557                 case 0: return LDKSiPrefix_Milli;
558                 case 1: return LDKSiPrefix_Micro;
559                 case 2: return LDKSiPrefix_Nano;
560                 case 3: return LDKSiPrefix_Pico;
561         }
562         abort();
563 }
564 static inline int32_t LDKSiPrefix_to_js(LDKSiPrefix val) {
565         switch (val) {
566                 case LDKSiPrefix_Milli: return 0;
567                 case LDKSiPrefix_Micro: return 1;
568                 case LDKSiPrefix_Nano: return 2;
569                 case LDKSiPrefix_Pico: return 3;
570                 default: abort();
571         }
572 }
573 static inline LDKSocketAddressParseError LDKSocketAddressParseError_from_js(int32_t ord) {
574         switch (ord) {
575                 case 0: return LDKSocketAddressParseError_SocketAddrParse;
576                 case 1: return LDKSocketAddressParseError_InvalidInput;
577                 case 2: return LDKSocketAddressParseError_InvalidPort;
578                 case 3: return LDKSocketAddressParseError_InvalidOnionV3;
579         }
580         abort();
581 }
582 static inline int32_t LDKSocketAddressParseError_to_js(LDKSocketAddressParseError val) {
583         switch (val) {
584                 case LDKSocketAddressParseError_SocketAddrParse: return 0;
585                 case LDKSocketAddressParseError_InvalidInput: return 1;
586                 case LDKSocketAddressParseError_InvalidPort: return 2;
587                 case LDKSocketAddressParseError_InvalidOnionV3: return 3;
588                 default: abort();
589         }
590 }
591 static inline LDKUtxoLookupError LDKUtxoLookupError_from_js(int32_t ord) {
592         switch (ord) {
593                 case 0: return LDKUtxoLookupError_UnknownChain;
594                 case 1: return LDKUtxoLookupError_UnknownTx;
595         }
596         abort();
597 }
598 static inline int32_t LDKUtxoLookupError_to_js(LDKUtxoLookupError val) {
599         switch (val) {
600                 case LDKUtxoLookupError_UnknownChain: return 0;
601                 case LDKUtxoLookupError_UnknownTx: return 1;
602                 default: abort();
603         }
604 }
605 struct LDKThirtyTwoBytes BigEndianScalar_get_bytes (struct LDKBigEndianScalar* thing) {
606         LDKThirtyTwoBytes ret = { .data = *thing->big_endian_bytes };
607         return ret;
608 }
609 int8_tArray  __attribute__((export_name("TS_BigEndianScalar_get_bytes"))) TS_BigEndianScalar_get_bytes(uint64_t thing) {
610         LDKBigEndianScalar* thing_conv = (LDKBigEndianScalar*)untag_ptr(thing);
611         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
612         memcpy(ret_arr->elems, BigEndianScalar_get_bytes(thing_conv).data, 32);
613         return ret_arr;
614 }
615
616 static void BigEndianScalar_free (struct LDKBigEndianScalar thing) {}
617 void  __attribute__((export_name("TS_BigEndianScalar_free"))) TS_BigEndianScalar_free(uint64_t thing) {
618         if (!ptr_is_owned(thing)) return;
619         void* thing_ptr = untag_ptr(thing);
620         CHECK_ACCESS(thing_ptr);
621         LDKBigEndianScalar thing_conv = *(LDKBigEndianScalar*)(thing_ptr);
622         FREE(untag_ptr(thing));
623         BigEndianScalar_free(thing_conv);
624 }
625
626 uint32_t __attribute__((export_name("TS_LDKBech32Error_ty_from_ptr"))) TS_LDKBech32Error_ty_from_ptr(uint64_t ptr) {
627         LDKBech32Error *obj = (LDKBech32Error*)untag_ptr(ptr);
628         switch(obj->tag) {
629                 case LDKBech32Error_MissingSeparator: return 0;
630                 case LDKBech32Error_InvalidChecksum: return 1;
631                 case LDKBech32Error_InvalidLength: return 2;
632                 case LDKBech32Error_InvalidChar: return 3;
633                 case LDKBech32Error_InvalidData: return 4;
634                 case LDKBech32Error_InvalidPadding: return 5;
635                 case LDKBech32Error_MixedCase: return 6;
636                 default: abort();
637         }
638 }
639 int32_t __attribute__((export_name("TS_LDKBech32Error_InvalidChar_get_invalid_char"))) TS_LDKBech32Error_InvalidChar_get_invalid_char(uint64_t ptr) {
640         LDKBech32Error *obj = (LDKBech32Error*)untag_ptr(ptr);
641         assert(obj->tag == LDKBech32Error_InvalidChar);
642         int32_t invalid_char_conv = obj->invalid_char;
643         return invalid_char_conv;
644 }
645 int8_t __attribute__((export_name("TS_LDKBech32Error_InvalidData_get_invalid_data"))) TS_LDKBech32Error_InvalidData_get_invalid_data(uint64_t ptr) {
646         LDKBech32Error *obj = (LDKBech32Error*)untag_ptr(ptr);
647         assert(obj->tag == LDKBech32Error_InvalidData);
648         int8_t invalid_data_conv = obj->invalid_data;
649         return invalid_data_conv;
650 }
651 static inline LDKCVec_u8Z CVec_u8Z_clone(const LDKCVec_u8Z *orig) {
652         LDKCVec_u8Z ret = { .data = MALLOC(sizeof(int8_t) * orig->datalen, "LDKCVec_u8Z clone bytes"), .datalen = orig->datalen };
653         memcpy(ret.data, orig->data, sizeof(int8_t) * ret.datalen);
654         return ret;
655 }
656 struct LDKWitness TxIn_get_witness (struct LDKTxIn* thing) {    return Witness_clone(&thing->witness);}int8_tArray  __attribute__((export_name("TS_TxIn_get_witness"))) TS_TxIn_get_witness(uint64_t thing) {
657         LDKTxIn* thing_conv = (LDKTxIn*)untag_ptr(thing);
658         LDKWitness ret_var = TxIn_get_witness(thing_conv);
659         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
660         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
661         Witness_free(ret_var);
662         return ret_arr;
663 }
664
665 struct LDKCVec_u8Z TxIn_get_script_sig (struct LDKTxIn* thing) {        return CVec_u8Z_clone(&thing->script_sig);}int8_tArray  __attribute__((export_name("TS_TxIn_get_script_sig"))) TS_TxIn_get_script_sig(uint64_t thing) {
666         LDKTxIn* thing_conv = (LDKTxIn*)untag_ptr(thing);
667         LDKCVec_u8Z ret_var = TxIn_get_script_sig(thing_conv);
668         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
669         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
670         CVec_u8Z_free(ret_var);
671         return ret_arr;
672 }
673
674 LDKThirtyTwoBytes TxIn_get_previous_txid (struct LDKTxIn* thing) {      return thing->previous_txid;}int8_tArray  __attribute__((export_name("TS_TxIn_get_previous_txid"))) TS_TxIn_get_previous_txid(uint64_t thing) {
675         LDKTxIn* thing_conv = (LDKTxIn*)untag_ptr(thing);
676         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
677         memcpy(ret_arr->elems, TxIn_get_previous_txid(thing_conv).data, 32);
678         return ret_arr;
679 }
680
681 uint32_t TxIn_get_previous_vout (struct LDKTxIn* thing) {       return thing->previous_vout;}int32_t  __attribute__((export_name("TS_TxIn_get_previous_vout"))) TS_TxIn_get_previous_vout(uint64_t thing) {
682         LDKTxIn* thing_conv = (LDKTxIn*)untag_ptr(thing);
683         int32_t ret_conv = TxIn_get_previous_vout(thing_conv);
684         return ret_conv;
685 }
686
687 uint32_t TxIn_get_sequence (struct LDKTxIn* thing) {    return thing->sequence;}int32_t  __attribute__((export_name("TS_TxIn_get_sequence"))) TS_TxIn_get_sequence(uint64_t thing) {
688         LDKTxIn* thing_conv = (LDKTxIn*)untag_ptr(thing);
689         int32_t ret_conv = TxIn_get_sequence(thing_conv);
690         return ret_conv;
691 }
692
693 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) {
694         LDKTxOut* thing_conv = (LDKTxOut*)untag_ptr(thing);
695         LDKCVec_u8Z ret_var = TxOut_get_script_pubkey(thing_conv);
696         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
697         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
698         CVec_u8Z_free(ret_var);
699         return ret_arr;
700 }
701
702 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) {
703         LDKTxOut* thing_conv = (LDKTxOut*)untag_ptr(thing);
704         int64_t ret_conv = TxOut_get_value(thing_conv);
705         return ret_conv;
706 }
707
708 uint32_t __attribute__((export_name("TS_LDKCOption_u64Z_ty_from_ptr"))) TS_LDKCOption_u64Z_ty_from_ptr(uint64_t ptr) {
709         LDKCOption_u64Z *obj = (LDKCOption_u64Z*)untag_ptr(ptr);
710         switch(obj->tag) {
711                 case LDKCOption_u64Z_Some: return 0;
712                 case LDKCOption_u64Z_None: return 1;
713                 default: abort();
714         }
715 }
716 int64_t __attribute__((export_name("TS_LDKCOption_u64Z_Some_get_some"))) TS_LDKCOption_u64Z_Some_get_some(uint64_t ptr) {
717         LDKCOption_u64Z *obj = (LDKCOption_u64Z*)untag_ptr(ptr);
718         assert(obj->tag == LDKCOption_u64Z_Some);
719         int64_t some_conv = obj->some;
720         return some_conv;
721 }
722 static inline LDKCVec_BlindedPathZ CVec_BlindedPathZ_clone(const LDKCVec_BlindedPathZ *orig) {
723         LDKCVec_BlindedPathZ ret = { .data = MALLOC(sizeof(LDKBlindedPath) * orig->datalen, "LDKCVec_BlindedPathZ clone bytes"), .datalen = orig->datalen };
724         for (size_t i = 0; i < ret.datalen; i++) {
725                 ret.data[i] = BlindedPath_clone(&orig->data[i]);
726         }
727         return ret;
728 }
729 static inline struct LDKRefund CResult_RefundBolt12ParseErrorZ_get_ok(LDKCResult_RefundBolt12ParseErrorZ *NONNULL_PTR owner){
730         LDKRefund ret = *owner->contents.result;
731         ret.is_owned = false;
732         return ret;
733 }
734 uint64_t  __attribute__((export_name("TS_CResult_RefundBolt12ParseErrorZ_get_ok"))) TS_CResult_RefundBolt12ParseErrorZ_get_ok(uint64_t owner) {
735         LDKCResult_RefundBolt12ParseErrorZ* owner_conv = (LDKCResult_RefundBolt12ParseErrorZ*)untag_ptr(owner);
736         LDKRefund ret_var = CResult_RefundBolt12ParseErrorZ_get_ok(owner_conv);
737         uint64_t ret_ref = 0;
738         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
739         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
740         return ret_ref;
741 }
742
743 static inline struct LDKBolt12ParseError CResult_RefundBolt12ParseErrorZ_get_err(LDKCResult_RefundBolt12ParseErrorZ *NONNULL_PTR owner){
744         LDKBolt12ParseError ret = *owner->contents.err;
745         ret.is_owned = false;
746         return ret;
747 }
748 uint64_t  __attribute__((export_name("TS_CResult_RefundBolt12ParseErrorZ_get_err"))) TS_CResult_RefundBolt12ParseErrorZ_get_err(uint64_t owner) {
749         LDKCResult_RefundBolt12ParseErrorZ* owner_conv = (LDKCResult_RefundBolt12ParseErrorZ*)untag_ptr(owner);
750         LDKBolt12ParseError ret_var = CResult_RefundBolt12ParseErrorZ_get_err(owner_conv);
751         uint64_t ret_ref = 0;
752         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
753         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
754         return ret_ref;
755 }
756
757 uint32_t __attribute__((export_name("TS_LDKRetry_ty_from_ptr"))) TS_LDKRetry_ty_from_ptr(uint64_t ptr) {
758         LDKRetry *obj = (LDKRetry*)untag_ptr(ptr);
759         switch(obj->tag) {
760                 case LDKRetry_Attempts: return 0;
761                 default: abort();
762         }
763 }
764 int32_t __attribute__((export_name("TS_LDKRetry_Attempts_get_attempts"))) TS_LDKRetry_Attempts_get_attempts(uint64_t ptr) {
765         LDKRetry *obj = (LDKRetry*)untag_ptr(ptr);
766         assert(obj->tag == LDKRetry_Attempts);
767         int32_t attempts_conv = obj->attempts;
768         return attempts_conv;
769 }
770 uint32_t __attribute__((export_name("TS_LDKDecodeError_ty_from_ptr"))) TS_LDKDecodeError_ty_from_ptr(uint64_t ptr) {
771         LDKDecodeError *obj = (LDKDecodeError*)untag_ptr(ptr);
772         switch(obj->tag) {
773                 case LDKDecodeError_UnknownVersion: return 0;
774                 case LDKDecodeError_UnknownRequiredFeature: return 1;
775                 case LDKDecodeError_InvalidValue: return 2;
776                 case LDKDecodeError_ShortRead: return 3;
777                 case LDKDecodeError_BadLengthDescriptor: return 4;
778                 case LDKDecodeError_Io: return 5;
779                 case LDKDecodeError_UnsupportedCompression: return 6;
780                 default: abort();
781         }
782 }
783 uint32_t __attribute__((export_name("TS_LDKDecodeError_Io_get_io"))) TS_LDKDecodeError_Io_get_io(uint64_t ptr) {
784         LDKDecodeError *obj = (LDKDecodeError*)untag_ptr(ptr);
785         assert(obj->tag == LDKDecodeError_Io);
786         uint32_t io_conv = LDKIOError_to_js(obj->io);
787         return io_conv;
788 }
789 static inline struct LDKRetry CResult_RetryDecodeErrorZ_get_ok(LDKCResult_RetryDecodeErrorZ *NONNULL_PTR owner){
790 CHECK(owner->result_ok);
791         return Retry_clone(&*owner->contents.result);
792 }
793 uint64_t  __attribute__((export_name("TS_CResult_RetryDecodeErrorZ_get_ok"))) TS_CResult_RetryDecodeErrorZ_get_ok(uint64_t owner) {
794         LDKCResult_RetryDecodeErrorZ* owner_conv = (LDKCResult_RetryDecodeErrorZ*)untag_ptr(owner);
795         LDKRetry *ret_copy = MALLOC(sizeof(LDKRetry), "LDKRetry");
796         *ret_copy = CResult_RetryDecodeErrorZ_get_ok(owner_conv);
797         uint64_t ret_ref = tag_ptr(ret_copy, true);
798         return ret_ref;
799 }
800
801 static inline struct LDKDecodeError CResult_RetryDecodeErrorZ_get_err(LDKCResult_RetryDecodeErrorZ *NONNULL_PTR owner){
802 CHECK(!owner->result_ok);
803         return DecodeError_clone(&*owner->contents.err);
804 }
805 uint64_t  __attribute__((export_name("TS_CResult_RetryDecodeErrorZ_get_err"))) TS_CResult_RetryDecodeErrorZ_get_err(uint64_t owner) {
806         LDKCResult_RetryDecodeErrorZ* owner_conv = (LDKCResult_RetryDecodeErrorZ*)untag_ptr(owner);
807         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
808         *ret_copy = CResult_RetryDecodeErrorZ_get_err(owner_conv);
809         uint64_t ret_ref = tag_ptr(ret_copy, true);
810         return ret_ref;
811 }
812
813 uint32_t __attribute__((export_name("TS_LDKAPIError_ty_from_ptr"))) TS_LDKAPIError_ty_from_ptr(uint64_t ptr) {
814         LDKAPIError *obj = (LDKAPIError*)untag_ptr(ptr);
815         switch(obj->tag) {
816                 case LDKAPIError_APIMisuseError: return 0;
817                 case LDKAPIError_FeeRateTooHigh: return 1;
818                 case LDKAPIError_InvalidRoute: return 2;
819                 case LDKAPIError_ChannelUnavailable: return 3;
820                 case LDKAPIError_MonitorUpdateInProgress: return 4;
821                 case LDKAPIError_IncompatibleShutdownScript: return 5;
822                 default: abort();
823         }
824 }
825 jstring __attribute__((export_name("TS_LDKAPIError_APIMisuseError_get_err"))) TS_LDKAPIError_APIMisuseError_get_err(uint64_t ptr) {
826         LDKAPIError *obj = (LDKAPIError*)untag_ptr(ptr);
827         assert(obj->tag == LDKAPIError_APIMisuseError);
828         LDKStr err_str = obj->api_misuse_error.err;
829                         jstring err_conv = str_ref_to_ts(err_str.chars, err_str.len);
830         return err_conv;
831 }
832 jstring __attribute__((export_name("TS_LDKAPIError_FeeRateTooHigh_get_err"))) TS_LDKAPIError_FeeRateTooHigh_get_err(uint64_t ptr) {
833         LDKAPIError *obj = (LDKAPIError*)untag_ptr(ptr);
834         assert(obj->tag == LDKAPIError_FeeRateTooHigh);
835         LDKStr err_str = obj->fee_rate_too_high.err;
836                         jstring err_conv = str_ref_to_ts(err_str.chars, err_str.len);
837         return err_conv;
838 }
839 int32_t __attribute__((export_name("TS_LDKAPIError_FeeRateTooHigh_get_feerate"))) TS_LDKAPIError_FeeRateTooHigh_get_feerate(uint64_t ptr) {
840         LDKAPIError *obj = (LDKAPIError*)untag_ptr(ptr);
841         assert(obj->tag == LDKAPIError_FeeRateTooHigh);
842         int32_t feerate_conv = obj->fee_rate_too_high.feerate;
843         return feerate_conv;
844 }
845 jstring __attribute__((export_name("TS_LDKAPIError_InvalidRoute_get_err"))) TS_LDKAPIError_InvalidRoute_get_err(uint64_t ptr) {
846         LDKAPIError *obj = (LDKAPIError*)untag_ptr(ptr);
847         assert(obj->tag == LDKAPIError_InvalidRoute);
848         LDKStr err_str = obj->invalid_route.err;
849                         jstring err_conv = str_ref_to_ts(err_str.chars, err_str.len);
850         return err_conv;
851 }
852 jstring __attribute__((export_name("TS_LDKAPIError_ChannelUnavailable_get_err"))) TS_LDKAPIError_ChannelUnavailable_get_err(uint64_t ptr) {
853         LDKAPIError *obj = (LDKAPIError*)untag_ptr(ptr);
854         assert(obj->tag == LDKAPIError_ChannelUnavailable);
855         LDKStr err_str = obj->channel_unavailable.err;
856                         jstring err_conv = str_ref_to_ts(err_str.chars, err_str.len);
857         return err_conv;
858 }
859 uint64_t __attribute__((export_name("TS_LDKAPIError_IncompatibleShutdownScript_get_script"))) TS_LDKAPIError_IncompatibleShutdownScript_get_script(uint64_t ptr) {
860         LDKAPIError *obj = (LDKAPIError*)untag_ptr(ptr);
861         assert(obj->tag == LDKAPIError_IncompatibleShutdownScript);
862         LDKShutdownScript script_var = obj->incompatible_shutdown_script.script;
863                         uint64_t script_ref = 0;
864                         CHECK_INNER_FIELD_ACCESS_OR_NULL(script_var);
865                         script_ref = tag_ptr(script_var.inner, false);
866         return script_ref;
867 }
868 static inline void CResult_NoneAPIErrorZ_get_ok(LDKCResult_NoneAPIErrorZ *NONNULL_PTR owner){
869 CHECK(owner->result_ok);
870         return *owner->contents.result;
871 }
872 void  __attribute__((export_name("TS_CResult_NoneAPIErrorZ_get_ok"))) TS_CResult_NoneAPIErrorZ_get_ok(uint64_t owner) {
873         LDKCResult_NoneAPIErrorZ* owner_conv = (LDKCResult_NoneAPIErrorZ*)untag_ptr(owner);
874         CResult_NoneAPIErrorZ_get_ok(owner_conv);
875 }
876
877 static inline struct LDKAPIError CResult_NoneAPIErrorZ_get_err(LDKCResult_NoneAPIErrorZ *NONNULL_PTR owner){
878 CHECK(!owner->result_ok);
879         return APIError_clone(&*owner->contents.err);
880 }
881 uint64_t  __attribute__((export_name("TS_CResult_NoneAPIErrorZ_get_err"))) TS_CResult_NoneAPIErrorZ_get_err(uint64_t owner) {
882         LDKCResult_NoneAPIErrorZ* owner_conv = (LDKCResult_NoneAPIErrorZ*)untag_ptr(owner);
883         LDKAPIError *ret_copy = MALLOC(sizeof(LDKAPIError), "LDKAPIError");
884         *ret_copy = CResult_NoneAPIErrorZ_get_err(owner_conv);
885         uint64_t ret_ref = tag_ptr(ret_copy, true);
886         return ret_ref;
887 }
888
889 static inline LDKCVec_CResult_NoneAPIErrorZZ CVec_CResult_NoneAPIErrorZZ_clone(const LDKCVec_CResult_NoneAPIErrorZZ *orig) {
890         LDKCVec_CResult_NoneAPIErrorZZ ret = { .data = MALLOC(sizeof(LDKCResult_NoneAPIErrorZ) * orig->datalen, "LDKCVec_CResult_NoneAPIErrorZZ clone bytes"), .datalen = orig->datalen };
891         for (size_t i = 0; i < ret.datalen; i++) {
892                 ret.data[i] = CResult_NoneAPIErrorZ_clone(&orig->data[i]);
893         }
894         return ret;
895 }
896 static inline LDKCVec_APIErrorZ CVec_APIErrorZ_clone(const LDKCVec_APIErrorZ *orig) {
897         LDKCVec_APIErrorZ ret = { .data = MALLOC(sizeof(LDKAPIError) * orig->datalen, "LDKCVec_APIErrorZ clone bytes"), .datalen = orig->datalen };
898         for (size_t i = 0; i < ret.datalen; i++) {
899                 ret.data[i] = APIError_clone(&orig->data[i]);
900         }
901         return ret;
902 }
903 uint32_t __attribute__((export_name("TS_LDKCOption_ThirtyTwoBytesZ_ty_from_ptr"))) TS_LDKCOption_ThirtyTwoBytesZ_ty_from_ptr(uint64_t ptr) {
904         LDKCOption_ThirtyTwoBytesZ *obj = (LDKCOption_ThirtyTwoBytesZ*)untag_ptr(ptr);
905         switch(obj->tag) {
906                 case LDKCOption_ThirtyTwoBytesZ_Some: return 0;
907                 case LDKCOption_ThirtyTwoBytesZ_None: return 1;
908                 default: abort();
909         }
910 }
911 int8_tArray __attribute__((export_name("TS_LDKCOption_ThirtyTwoBytesZ_Some_get_some"))) TS_LDKCOption_ThirtyTwoBytesZ_Some_get_some(uint64_t ptr) {
912         LDKCOption_ThirtyTwoBytesZ *obj = (LDKCOption_ThirtyTwoBytesZ*)untag_ptr(ptr);
913         assert(obj->tag == LDKCOption_ThirtyTwoBytesZ_Some);
914         int8_tArray some_arr = init_int8_tArray(32, __LINE__);
915         memcpy(some_arr->elems, obj->some.data, 32);
916         return some_arr;
917 }
918 uint32_t __attribute__((export_name("TS_LDKCOption_CVec_u8ZZ_ty_from_ptr"))) TS_LDKCOption_CVec_u8ZZ_ty_from_ptr(uint64_t ptr) {
919         LDKCOption_CVec_u8ZZ *obj = (LDKCOption_CVec_u8ZZ*)untag_ptr(ptr);
920         switch(obj->tag) {
921                 case LDKCOption_CVec_u8ZZ_Some: return 0;
922                 case LDKCOption_CVec_u8ZZ_None: return 1;
923                 default: abort();
924         }
925 }
926 int8_tArray __attribute__((export_name("TS_LDKCOption_CVec_u8ZZ_Some_get_some"))) TS_LDKCOption_CVec_u8ZZ_Some_get_some(uint64_t ptr) {
927         LDKCOption_CVec_u8ZZ *obj = (LDKCOption_CVec_u8ZZ*)untag_ptr(ptr);
928         assert(obj->tag == LDKCOption_CVec_u8ZZ_Some);
929         LDKCVec_u8Z some_var = obj->some;
930                         int8_tArray some_arr = init_int8_tArray(some_var.datalen, __LINE__);
931                         memcpy(some_arr->elems, some_var.data, some_var.datalen);
932         return some_arr;
933 }
934 static inline struct LDKRecipientOnionFields CResult_RecipientOnionFieldsDecodeErrorZ_get_ok(LDKCResult_RecipientOnionFieldsDecodeErrorZ *NONNULL_PTR owner){
935         LDKRecipientOnionFields ret = *owner->contents.result;
936         ret.is_owned = false;
937         return ret;
938 }
939 uint64_t  __attribute__((export_name("TS_CResult_RecipientOnionFieldsDecodeErrorZ_get_ok"))) TS_CResult_RecipientOnionFieldsDecodeErrorZ_get_ok(uint64_t owner) {
940         LDKCResult_RecipientOnionFieldsDecodeErrorZ* owner_conv = (LDKCResult_RecipientOnionFieldsDecodeErrorZ*)untag_ptr(owner);
941         LDKRecipientOnionFields ret_var = CResult_RecipientOnionFieldsDecodeErrorZ_get_ok(owner_conv);
942         uint64_t ret_ref = 0;
943         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
944         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
945         return ret_ref;
946 }
947
948 static inline struct LDKDecodeError CResult_RecipientOnionFieldsDecodeErrorZ_get_err(LDKCResult_RecipientOnionFieldsDecodeErrorZ *NONNULL_PTR owner){
949 CHECK(!owner->result_ok);
950         return DecodeError_clone(&*owner->contents.err);
951 }
952 uint64_t  __attribute__((export_name("TS_CResult_RecipientOnionFieldsDecodeErrorZ_get_err"))) TS_CResult_RecipientOnionFieldsDecodeErrorZ_get_err(uint64_t owner) {
953         LDKCResult_RecipientOnionFieldsDecodeErrorZ* owner_conv = (LDKCResult_RecipientOnionFieldsDecodeErrorZ*)untag_ptr(owner);
954         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
955         *ret_copy = CResult_RecipientOnionFieldsDecodeErrorZ_get_err(owner_conv);
956         uint64_t ret_ref = tag_ptr(ret_copy, true);
957         return ret_ref;
958 }
959
960 static inline uint64_t C2Tuple_u64CVec_u8ZZ_get_a(LDKC2Tuple_u64CVec_u8ZZ *NONNULL_PTR owner){
961         return owner->a;
962 }
963 int64_t  __attribute__((export_name("TS_C2Tuple_u64CVec_u8ZZ_get_a"))) TS_C2Tuple_u64CVec_u8ZZ_get_a(uint64_t owner) {
964         LDKC2Tuple_u64CVec_u8ZZ* owner_conv = (LDKC2Tuple_u64CVec_u8ZZ*)untag_ptr(owner);
965         int64_t ret_conv = C2Tuple_u64CVec_u8ZZ_get_a(owner_conv);
966         return ret_conv;
967 }
968
969 static inline struct LDKCVec_u8Z C2Tuple_u64CVec_u8ZZ_get_b(LDKC2Tuple_u64CVec_u8ZZ *NONNULL_PTR owner){
970         return CVec_u8Z_clone(&owner->b);
971 }
972 int8_tArray  __attribute__((export_name("TS_C2Tuple_u64CVec_u8ZZ_get_b"))) TS_C2Tuple_u64CVec_u8ZZ_get_b(uint64_t owner) {
973         LDKC2Tuple_u64CVec_u8ZZ* owner_conv = (LDKC2Tuple_u64CVec_u8ZZ*)untag_ptr(owner);
974         LDKCVec_u8Z ret_var = C2Tuple_u64CVec_u8ZZ_get_b(owner_conv);
975         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
976         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
977         CVec_u8Z_free(ret_var);
978         return ret_arr;
979 }
980
981 static inline LDKCVec_C2Tuple_u64CVec_u8ZZZ CVec_C2Tuple_u64CVec_u8ZZZ_clone(const LDKCVec_C2Tuple_u64CVec_u8ZZZ *orig) {
982         LDKCVec_C2Tuple_u64CVec_u8ZZZ ret = { .data = MALLOC(sizeof(LDKC2Tuple_u64CVec_u8ZZ) * orig->datalen, "LDKCVec_C2Tuple_u64CVec_u8ZZZ clone bytes"), .datalen = orig->datalen };
983         for (size_t i = 0; i < ret.datalen; i++) {
984                 ret.data[i] = C2Tuple_u64CVec_u8ZZ_clone(&orig->data[i]);
985         }
986         return ret;
987 }
988 static inline struct LDKRecipientOnionFields CResult_RecipientOnionFieldsNoneZ_get_ok(LDKCResult_RecipientOnionFieldsNoneZ *NONNULL_PTR owner){
989         LDKRecipientOnionFields ret = *owner->contents.result;
990         ret.is_owned = false;
991         return ret;
992 }
993 uint64_t  __attribute__((export_name("TS_CResult_RecipientOnionFieldsNoneZ_get_ok"))) TS_CResult_RecipientOnionFieldsNoneZ_get_ok(uint64_t owner) {
994         LDKCResult_RecipientOnionFieldsNoneZ* owner_conv = (LDKCResult_RecipientOnionFieldsNoneZ*)untag_ptr(owner);
995         LDKRecipientOnionFields ret_var = CResult_RecipientOnionFieldsNoneZ_get_ok(owner_conv);
996         uint64_t ret_ref = 0;
997         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
998         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
999         return ret_ref;
1000 }
1001
1002 static inline void CResult_RecipientOnionFieldsNoneZ_get_err(LDKCResult_RecipientOnionFieldsNoneZ *NONNULL_PTR owner){
1003 CHECK(!owner->result_ok);
1004         return *owner->contents.err;
1005 }
1006 void  __attribute__((export_name("TS_CResult_RecipientOnionFieldsNoneZ_get_err"))) TS_CResult_RecipientOnionFieldsNoneZ_get_err(uint64_t owner) {
1007         LDKCResult_RecipientOnionFieldsNoneZ* owner_conv = (LDKCResult_RecipientOnionFieldsNoneZ*)untag_ptr(owner);
1008         CResult_RecipientOnionFieldsNoneZ_get_err(owner_conv);
1009 }
1010
1011 static inline LDKCVec_ThirtyTwoBytesZ CVec_ThirtyTwoBytesZ_clone(const LDKCVec_ThirtyTwoBytesZ *orig) {
1012         LDKCVec_ThirtyTwoBytesZ ret = { .data = MALLOC(sizeof(LDKThirtyTwoBytes) * orig->datalen, "LDKCVec_ThirtyTwoBytesZ clone bytes"), .datalen = orig->datalen };
1013         for (size_t i = 0; i < ret.datalen; i++) {
1014                 ret.data[i] = ThirtyTwoBytes_clone(&orig->data[i]);
1015         }
1016         return ret;
1017 }
1018 uint32_t __attribute__((export_name("TS_LDKCOption_CVec_ThirtyTwoBytesZZ_ty_from_ptr"))) TS_LDKCOption_CVec_ThirtyTwoBytesZZ_ty_from_ptr(uint64_t ptr) {
1019         LDKCOption_CVec_ThirtyTwoBytesZZ *obj = (LDKCOption_CVec_ThirtyTwoBytesZZ*)untag_ptr(ptr);
1020         switch(obj->tag) {
1021                 case LDKCOption_CVec_ThirtyTwoBytesZZ_Some: return 0;
1022                 case LDKCOption_CVec_ThirtyTwoBytesZZ_None: return 1;
1023                 default: abort();
1024         }
1025 }
1026 ptrArray __attribute__((export_name("TS_LDKCOption_CVec_ThirtyTwoBytesZZ_Some_get_some"))) TS_LDKCOption_CVec_ThirtyTwoBytesZZ_Some_get_some(uint64_t ptr) {
1027         LDKCOption_CVec_ThirtyTwoBytesZZ *obj = (LDKCOption_CVec_ThirtyTwoBytesZZ*)untag_ptr(ptr);
1028         assert(obj->tag == LDKCOption_CVec_ThirtyTwoBytesZZ_Some);
1029         LDKCVec_ThirtyTwoBytesZ some_var = obj->some;
1030                         ptrArray some_arr = NULL;
1031                         some_arr = init_ptrArray(some_var.datalen, __LINE__);
1032                         int8_tArray *some_arr_ptr = (int8_tArray*)(((uint8_t*)some_arr) + 8);
1033                         for (size_t m = 0; m < some_var.datalen; m++) {
1034                                 int8_tArray some_conv_12_arr = init_int8_tArray(32, __LINE__);
1035                                 memcpy(some_conv_12_arr->elems, some_var.data[m].data, 32);
1036                                 some_arr_ptr[m] = some_conv_12_arr;
1037                         }
1038                         
1039         return some_arr;
1040 }
1041 static inline struct LDKThirtyTwoBytes CResult_ThirtyTwoBytesNoneZ_get_ok(LDKCResult_ThirtyTwoBytesNoneZ *NONNULL_PTR owner){
1042 CHECK(owner->result_ok);
1043         return ThirtyTwoBytes_clone(&*owner->contents.result);
1044 }
1045 int8_tArray  __attribute__((export_name("TS_CResult_ThirtyTwoBytesNoneZ_get_ok"))) TS_CResult_ThirtyTwoBytesNoneZ_get_ok(uint64_t owner) {
1046         LDKCResult_ThirtyTwoBytesNoneZ* owner_conv = (LDKCResult_ThirtyTwoBytesNoneZ*)untag_ptr(owner);
1047         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
1048         memcpy(ret_arr->elems, CResult_ThirtyTwoBytesNoneZ_get_ok(owner_conv).data, 32);
1049         return ret_arr;
1050 }
1051
1052 static inline void CResult_ThirtyTwoBytesNoneZ_get_err(LDKCResult_ThirtyTwoBytesNoneZ *NONNULL_PTR owner){
1053 CHECK(!owner->result_ok);
1054         return *owner->contents.err;
1055 }
1056 void  __attribute__((export_name("TS_CResult_ThirtyTwoBytesNoneZ_get_err"))) TS_CResult_ThirtyTwoBytesNoneZ_get_err(uint64_t owner) {
1057         LDKCResult_ThirtyTwoBytesNoneZ* owner_conv = (LDKCResult_ThirtyTwoBytesNoneZ*)untag_ptr(owner);
1058         CResult_ThirtyTwoBytesNoneZ_get_err(owner_conv);
1059 }
1060
1061 static inline struct LDKBlindedPayInfo CResult_BlindedPayInfoDecodeErrorZ_get_ok(LDKCResult_BlindedPayInfoDecodeErrorZ *NONNULL_PTR owner){
1062         LDKBlindedPayInfo ret = *owner->contents.result;
1063         ret.is_owned = false;
1064         return ret;
1065 }
1066 uint64_t  __attribute__((export_name("TS_CResult_BlindedPayInfoDecodeErrorZ_get_ok"))) TS_CResult_BlindedPayInfoDecodeErrorZ_get_ok(uint64_t owner) {
1067         LDKCResult_BlindedPayInfoDecodeErrorZ* owner_conv = (LDKCResult_BlindedPayInfoDecodeErrorZ*)untag_ptr(owner);
1068         LDKBlindedPayInfo ret_var = CResult_BlindedPayInfoDecodeErrorZ_get_ok(owner_conv);
1069         uint64_t ret_ref = 0;
1070         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
1071         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
1072         return ret_ref;
1073 }
1074
1075 static inline struct LDKDecodeError CResult_BlindedPayInfoDecodeErrorZ_get_err(LDKCResult_BlindedPayInfoDecodeErrorZ *NONNULL_PTR owner){
1076 CHECK(!owner->result_ok);
1077         return DecodeError_clone(&*owner->contents.err);
1078 }
1079 uint64_t  __attribute__((export_name("TS_CResult_BlindedPayInfoDecodeErrorZ_get_err"))) TS_CResult_BlindedPayInfoDecodeErrorZ_get_err(uint64_t owner) {
1080         LDKCResult_BlindedPayInfoDecodeErrorZ* owner_conv = (LDKCResult_BlindedPayInfoDecodeErrorZ*)untag_ptr(owner);
1081         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
1082         *ret_copy = CResult_BlindedPayInfoDecodeErrorZ_get_err(owner_conv);
1083         uint64_t ret_ref = tag_ptr(ret_copy, true);
1084         return ret_ref;
1085 }
1086
1087 static inline struct LDKDelayedPaymentOutputDescriptor CResult_DelayedPaymentOutputDescriptorDecodeErrorZ_get_ok(LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ *NONNULL_PTR owner){
1088         LDKDelayedPaymentOutputDescriptor ret = *owner->contents.result;
1089         ret.is_owned = false;
1090         return ret;
1091 }
1092 uint64_t  __attribute__((export_name("TS_CResult_DelayedPaymentOutputDescriptorDecodeErrorZ_get_ok"))) TS_CResult_DelayedPaymentOutputDescriptorDecodeErrorZ_get_ok(uint64_t owner) {
1093         LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ* owner_conv = (LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ*)untag_ptr(owner);
1094         LDKDelayedPaymentOutputDescriptor ret_var = CResult_DelayedPaymentOutputDescriptorDecodeErrorZ_get_ok(owner_conv);
1095         uint64_t ret_ref = 0;
1096         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
1097         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
1098         return ret_ref;
1099 }
1100
1101 static inline struct LDKDecodeError CResult_DelayedPaymentOutputDescriptorDecodeErrorZ_get_err(LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ *NONNULL_PTR owner){
1102 CHECK(!owner->result_ok);
1103         return DecodeError_clone(&*owner->contents.err);
1104 }
1105 uint64_t  __attribute__((export_name("TS_CResult_DelayedPaymentOutputDescriptorDecodeErrorZ_get_err"))) TS_CResult_DelayedPaymentOutputDescriptorDecodeErrorZ_get_err(uint64_t owner) {
1106         LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ* owner_conv = (LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ*)untag_ptr(owner);
1107         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
1108         *ret_copy = CResult_DelayedPaymentOutputDescriptorDecodeErrorZ_get_err(owner_conv);
1109         uint64_t ret_ref = tag_ptr(ret_copy, true);
1110         return ret_ref;
1111 }
1112
1113 static inline struct LDKStaticPaymentOutputDescriptor CResult_StaticPaymentOutputDescriptorDecodeErrorZ_get_ok(LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ *NONNULL_PTR owner){
1114         LDKStaticPaymentOutputDescriptor ret = *owner->contents.result;
1115         ret.is_owned = false;
1116         return ret;
1117 }
1118 uint64_t  __attribute__((export_name("TS_CResult_StaticPaymentOutputDescriptorDecodeErrorZ_get_ok"))) TS_CResult_StaticPaymentOutputDescriptorDecodeErrorZ_get_ok(uint64_t owner) {
1119         LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ* owner_conv = (LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ*)untag_ptr(owner);
1120         LDKStaticPaymentOutputDescriptor ret_var = CResult_StaticPaymentOutputDescriptorDecodeErrorZ_get_ok(owner_conv);
1121         uint64_t ret_ref = 0;
1122         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
1123         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
1124         return ret_ref;
1125 }
1126
1127 static inline struct LDKDecodeError CResult_StaticPaymentOutputDescriptorDecodeErrorZ_get_err(LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ *NONNULL_PTR owner){
1128 CHECK(!owner->result_ok);
1129         return DecodeError_clone(&*owner->contents.err);
1130 }
1131 uint64_t  __attribute__((export_name("TS_CResult_StaticPaymentOutputDescriptorDecodeErrorZ_get_err"))) TS_CResult_StaticPaymentOutputDescriptorDecodeErrorZ_get_err(uint64_t owner) {
1132         LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ* owner_conv = (LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ*)untag_ptr(owner);
1133         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
1134         *ret_copy = CResult_StaticPaymentOutputDescriptorDecodeErrorZ_get_err(owner_conv);
1135         uint64_t ret_ref = tag_ptr(ret_copy, true);
1136         return ret_ref;
1137 }
1138
1139 uint32_t __attribute__((export_name("TS_LDKSpendableOutputDescriptor_ty_from_ptr"))) TS_LDKSpendableOutputDescriptor_ty_from_ptr(uint64_t ptr) {
1140         LDKSpendableOutputDescriptor *obj = (LDKSpendableOutputDescriptor*)untag_ptr(ptr);
1141         switch(obj->tag) {
1142                 case LDKSpendableOutputDescriptor_StaticOutput: return 0;
1143                 case LDKSpendableOutputDescriptor_DelayedPaymentOutput: return 1;
1144                 case LDKSpendableOutputDescriptor_StaticPaymentOutput: return 2;
1145                 default: abort();
1146         }
1147 }
1148 uint64_t __attribute__((export_name("TS_LDKSpendableOutputDescriptor_StaticOutput_get_outpoint"))) TS_LDKSpendableOutputDescriptor_StaticOutput_get_outpoint(uint64_t ptr) {
1149         LDKSpendableOutputDescriptor *obj = (LDKSpendableOutputDescriptor*)untag_ptr(ptr);
1150         assert(obj->tag == LDKSpendableOutputDescriptor_StaticOutput);
1151         LDKOutPoint outpoint_var = obj->static_output.outpoint;
1152                         uint64_t outpoint_ref = 0;
1153                         CHECK_INNER_FIELD_ACCESS_OR_NULL(outpoint_var);
1154                         outpoint_ref = tag_ptr(outpoint_var.inner, false);
1155         return outpoint_ref;
1156 }
1157 uint64_t __attribute__((export_name("TS_LDKSpendableOutputDescriptor_StaticOutput_get_output"))) TS_LDKSpendableOutputDescriptor_StaticOutput_get_output(uint64_t ptr) {
1158         LDKSpendableOutputDescriptor *obj = (LDKSpendableOutputDescriptor*)untag_ptr(ptr);
1159         assert(obj->tag == LDKSpendableOutputDescriptor_StaticOutput);
1160         LDKTxOut* output_ref = &obj->static_output.output;
1161         return tag_ptr(output_ref, false);
1162 }
1163 uint64_t __attribute__((export_name("TS_LDKSpendableOutputDescriptor_DelayedPaymentOutput_get_delayed_payment_output"))) TS_LDKSpendableOutputDescriptor_DelayedPaymentOutput_get_delayed_payment_output(uint64_t ptr) {
1164         LDKSpendableOutputDescriptor *obj = (LDKSpendableOutputDescriptor*)untag_ptr(ptr);
1165         assert(obj->tag == LDKSpendableOutputDescriptor_DelayedPaymentOutput);
1166         LDKDelayedPaymentOutputDescriptor delayed_payment_output_var = obj->delayed_payment_output;
1167                         uint64_t delayed_payment_output_ref = 0;
1168                         CHECK_INNER_FIELD_ACCESS_OR_NULL(delayed_payment_output_var);
1169                         delayed_payment_output_ref = tag_ptr(delayed_payment_output_var.inner, false);
1170         return delayed_payment_output_ref;
1171 }
1172 uint64_t __attribute__((export_name("TS_LDKSpendableOutputDescriptor_StaticPaymentOutput_get_static_payment_output"))) TS_LDKSpendableOutputDescriptor_StaticPaymentOutput_get_static_payment_output(uint64_t ptr) {
1173         LDKSpendableOutputDescriptor *obj = (LDKSpendableOutputDescriptor*)untag_ptr(ptr);
1174         assert(obj->tag == LDKSpendableOutputDescriptor_StaticPaymentOutput);
1175         LDKStaticPaymentOutputDescriptor static_payment_output_var = obj->static_payment_output;
1176                         uint64_t static_payment_output_ref = 0;
1177                         CHECK_INNER_FIELD_ACCESS_OR_NULL(static_payment_output_var);
1178                         static_payment_output_ref = tag_ptr(static_payment_output_var.inner, false);
1179         return static_payment_output_ref;
1180 }
1181 static inline struct LDKSpendableOutputDescriptor CResult_SpendableOutputDescriptorDecodeErrorZ_get_ok(LDKCResult_SpendableOutputDescriptorDecodeErrorZ *NONNULL_PTR owner){
1182 CHECK(owner->result_ok);
1183         return SpendableOutputDescriptor_clone(&*owner->contents.result);
1184 }
1185 uint64_t  __attribute__((export_name("TS_CResult_SpendableOutputDescriptorDecodeErrorZ_get_ok"))) TS_CResult_SpendableOutputDescriptorDecodeErrorZ_get_ok(uint64_t owner) {
1186         LDKCResult_SpendableOutputDescriptorDecodeErrorZ* owner_conv = (LDKCResult_SpendableOutputDescriptorDecodeErrorZ*)untag_ptr(owner);
1187         LDKSpendableOutputDescriptor *ret_copy = MALLOC(sizeof(LDKSpendableOutputDescriptor), "LDKSpendableOutputDescriptor");
1188         *ret_copy = CResult_SpendableOutputDescriptorDecodeErrorZ_get_ok(owner_conv);
1189         uint64_t ret_ref = tag_ptr(ret_copy, true);
1190         return ret_ref;
1191 }
1192
1193 static inline struct LDKDecodeError CResult_SpendableOutputDescriptorDecodeErrorZ_get_err(LDKCResult_SpendableOutputDescriptorDecodeErrorZ *NONNULL_PTR owner){
1194 CHECK(!owner->result_ok);
1195         return DecodeError_clone(&*owner->contents.err);
1196 }
1197 uint64_t  __attribute__((export_name("TS_CResult_SpendableOutputDescriptorDecodeErrorZ_get_err"))) TS_CResult_SpendableOutputDescriptorDecodeErrorZ_get_err(uint64_t owner) {
1198         LDKCResult_SpendableOutputDescriptorDecodeErrorZ* owner_conv = (LDKCResult_SpendableOutputDescriptorDecodeErrorZ*)untag_ptr(owner);
1199         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
1200         *ret_copy = CResult_SpendableOutputDescriptorDecodeErrorZ_get_err(owner_conv);
1201         uint64_t ret_ref = tag_ptr(ret_copy, true);
1202         return ret_ref;
1203 }
1204
1205 static inline LDKCVec_SpendableOutputDescriptorZ CVec_SpendableOutputDescriptorZ_clone(const LDKCVec_SpendableOutputDescriptorZ *orig) {
1206         LDKCVec_SpendableOutputDescriptorZ ret = { .data = MALLOC(sizeof(LDKSpendableOutputDescriptor) * orig->datalen, "LDKCVec_SpendableOutputDescriptorZ clone bytes"), .datalen = orig->datalen };
1207         for (size_t i = 0; i < ret.datalen; i++) {
1208                 ret.data[i] = SpendableOutputDescriptor_clone(&orig->data[i]);
1209         }
1210         return ret;
1211 }
1212 static inline LDKCVec_TxOutZ CVec_TxOutZ_clone(const LDKCVec_TxOutZ *orig) {
1213         LDKCVec_TxOutZ ret = { .data = MALLOC(sizeof(LDKTxOut) * orig->datalen, "LDKCVec_TxOutZ clone bytes"), .datalen = orig->datalen };
1214         for (size_t i = 0; i < ret.datalen; i++) {
1215                 ret.data[i] = TxOut_clone(&orig->data[i]);
1216         }
1217         return ret;
1218 }
1219 uint32_t __attribute__((export_name("TS_LDKCOption_u32Z_ty_from_ptr"))) TS_LDKCOption_u32Z_ty_from_ptr(uint64_t ptr) {
1220         LDKCOption_u32Z *obj = (LDKCOption_u32Z*)untag_ptr(ptr);
1221         switch(obj->tag) {
1222                 case LDKCOption_u32Z_Some: return 0;
1223                 case LDKCOption_u32Z_None: return 1;
1224                 default: abort();
1225         }
1226 }
1227 int32_t __attribute__((export_name("TS_LDKCOption_u32Z_Some_get_some"))) TS_LDKCOption_u32Z_Some_get_some(uint64_t ptr) {
1228         LDKCOption_u32Z *obj = (LDKCOption_u32Z*)untag_ptr(ptr);
1229         assert(obj->tag == LDKCOption_u32Z_Some);
1230         int32_t some_conv = obj->some;
1231         return some_conv;
1232 }
1233 static inline struct LDKCVec_u8Z C2Tuple_CVec_u8ZusizeZ_get_a(LDKC2Tuple_CVec_u8ZusizeZ *NONNULL_PTR owner){
1234         return CVec_u8Z_clone(&owner->a);
1235 }
1236 int8_tArray  __attribute__((export_name("TS_C2Tuple_CVec_u8ZusizeZ_get_a"))) TS_C2Tuple_CVec_u8ZusizeZ_get_a(uint64_t owner) {
1237         LDKC2Tuple_CVec_u8ZusizeZ* owner_conv = (LDKC2Tuple_CVec_u8ZusizeZ*)untag_ptr(owner);
1238         LDKCVec_u8Z ret_var = C2Tuple_CVec_u8ZusizeZ_get_a(owner_conv);
1239         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
1240         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
1241         CVec_u8Z_free(ret_var);
1242         return ret_arr;
1243 }
1244
1245 static inline uintptr_t C2Tuple_CVec_u8ZusizeZ_get_b(LDKC2Tuple_CVec_u8ZusizeZ *NONNULL_PTR owner){
1246         return owner->b;
1247 }
1248 uint32_t  __attribute__((export_name("TS_C2Tuple_CVec_u8ZusizeZ_get_b"))) TS_C2Tuple_CVec_u8ZusizeZ_get_b(uint64_t owner) {
1249         LDKC2Tuple_CVec_u8ZusizeZ* owner_conv = (LDKC2Tuple_CVec_u8ZusizeZ*)untag_ptr(owner);
1250         uint32_t ret_conv = C2Tuple_CVec_u8ZusizeZ_get_b(owner_conv);
1251         return ret_conv;
1252 }
1253
1254 static inline struct LDKC2Tuple_CVec_u8ZusizeZ CResult_C2Tuple_CVec_u8ZusizeZNoneZ_get_ok(LDKCResult_C2Tuple_CVec_u8ZusizeZNoneZ *NONNULL_PTR owner){
1255 CHECK(owner->result_ok);
1256         return C2Tuple_CVec_u8ZusizeZ_clone(&*owner->contents.result);
1257 }
1258 uint64_t  __attribute__((export_name("TS_CResult_C2Tuple_CVec_u8ZusizeZNoneZ_get_ok"))) TS_CResult_C2Tuple_CVec_u8ZusizeZNoneZ_get_ok(uint64_t owner) {
1259         LDKCResult_C2Tuple_CVec_u8ZusizeZNoneZ* owner_conv = (LDKCResult_C2Tuple_CVec_u8ZusizeZNoneZ*)untag_ptr(owner);
1260         LDKC2Tuple_CVec_u8ZusizeZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_CVec_u8ZusizeZ), "LDKC2Tuple_CVec_u8ZusizeZ");
1261         *ret_conv = CResult_C2Tuple_CVec_u8ZusizeZNoneZ_get_ok(owner_conv);
1262         return tag_ptr(ret_conv, true);
1263 }
1264
1265 static inline void CResult_C2Tuple_CVec_u8ZusizeZNoneZ_get_err(LDKCResult_C2Tuple_CVec_u8ZusizeZNoneZ *NONNULL_PTR owner){
1266 CHECK(!owner->result_ok);
1267         return *owner->contents.err;
1268 }
1269 void  __attribute__((export_name("TS_CResult_C2Tuple_CVec_u8ZusizeZNoneZ_get_err"))) TS_CResult_C2Tuple_CVec_u8ZusizeZNoneZ_get_err(uint64_t owner) {
1270         LDKCResult_C2Tuple_CVec_u8ZusizeZNoneZ* owner_conv = (LDKCResult_C2Tuple_CVec_u8ZusizeZNoneZ*)untag_ptr(owner);
1271         CResult_C2Tuple_CVec_u8ZusizeZNoneZ_get_err(owner_conv);
1272 }
1273
1274 static inline struct LDKChannelDerivationParameters CResult_ChannelDerivationParametersDecodeErrorZ_get_ok(LDKCResult_ChannelDerivationParametersDecodeErrorZ *NONNULL_PTR owner){
1275         LDKChannelDerivationParameters ret = *owner->contents.result;
1276         ret.is_owned = false;
1277         return ret;
1278 }
1279 uint64_t  __attribute__((export_name("TS_CResult_ChannelDerivationParametersDecodeErrorZ_get_ok"))) TS_CResult_ChannelDerivationParametersDecodeErrorZ_get_ok(uint64_t owner) {
1280         LDKCResult_ChannelDerivationParametersDecodeErrorZ* owner_conv = (LDKCResult_ChannelDerivationParametersDecodeErrorZ*)untag_ptr(owner);
1281         LDKChannelDerivationParameters ret_var = CResult_ChannelDerivationParametersDecodeErrorZ_get_ok(owner_conv);
1282         uint64_t ret_ref = 0;
1283         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
1284         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
1285         return ret_ref;
1286 }
1287
1288 static inline struct LDKDecodeError CResult_ChannelDerivationParametersDecodeErrorZ_get_err(LDKCResult_ChannelDerivationParametersDecodeErrorZ *NONNULL_PTR owner){
1289 CHECK(!owner->result_ok);
1290         return DecodeError_clone(&*owner->contents.err);
1291 }
1292 uint64_t  __attribute__((export_name("TS_CResult_ChannelDerivationParametersDecodeErrorZ_get_err"))) TS_CResult_ChannelDerivationParametersDecodeErrorZ_get_err(uint64_t owner) {
1293         LDKCResult_ChannelDerivationParametersDecodeErrorZ* owner_conv = (LDKCResult_ChannelDerivationParametersDecodeErrorZ*)untag_ptr(owner);
1294         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
1295         *ret_copy = CResult_ChannelDerivationParametersDecodeErrorZ_get_err(owner_conv);
1296         uint64_t ret_ref = tag_ptr(ret_copy, true);
1297         return ret_ref;
1298 }
1299
1300 static inline struct LDKHTLCDescriptor CResult_HTLCDescriptorDecodeErrorZ_get_ok(LDKCResult_HTLCDescriptorDecodeErrorZ *NONNULL_PTR owner){
1301         LDKHTLCDescriptor ret = *owner->contents.result;
1302         ret.is_owned = false;
1303         return ret;
1304 }
1305 uint64_t  __attribute__((export_name("TS_CResult_HTLCDescriptorDecodeErrorZ_get_ok"))) TS_CResult_HTLCDescriptorDecodeErrorZ_get_ok(uint64_t owner) {
1306         LDKCResult_HTLCDescriptorDecodeErrorZ* owner_conv = (LDKCResult_HTLCDescriptorDecodeErrorZ*)untag_ptr(owner);
1307         LDKHTLCDescriptor ret_var = CResult_HTLCDescriptorDecodeErrorZ_get_ok(owner_conv);
1308         uint64_t ret_ref = 0;
1309         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
1310         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
1311         return ret_ref;
1312 }
1313
1314 static inline struct LDKDecodeError CResult_HTLCDescriptorDecodeErrorZ_get_err(LDKCResult_HTLCDescriptorDecodeErrorZ *NONNULL_PTR owner){
1315 CHECK(!owner->result_ok);
1316         return DecodeError_clone(&*owner->contents.err);
1317 }
1318 uint64_t  __attribute__((export_name("TS_CResult_HTLCDescriptorDecodeErrorZ_get_err"))) TS_CResult_HTLCDescriptorDecodeErrorZ_get_err(uint64_t owner) {
1319         LDKCResult_HTLCDescriptorDecodeErrorZ* owner_conv = (LDKCResult_HTLCDescriptorDecodeErrorZ*)untag_ptr(owner);
1320         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
1321         *ret_copy = CResult_HTLCDescriptorDecodeErrorZ_get_err(owner_conv);
1322         uint64_t ret_ref = tag_ptr(ret_copy, true);
1323         return ret_ref;
1324 }
1325
1326 static inline void CResult_NoneNoneZ_get_ok(LDKCResult_NoneNoneZ *NONNULL_PTR owner){
1327 CHECK(owner->result_ok);
1328         return *owner->contents.result;
1329 }
1330 void  __attribute__((export_name("TS_CResult_NoneNoneZ_get_ok"))) TS_CResult_NoneNoneZ_get_ok(uint64_t owner) {
1331         LDKCResult_NoneNoneZ* owner_conv = (LDKCResult_NoneNoneZ*)untag_ptr(owner);
1332         CResult_NoneNoneZ_get_ok(owner_conv);
1333 }
1334
1335 static inline void CResult_NoneNoneZ_get_err(LDKCResult_NoneNoneZ *NONNULL_PTR owner){
1336 CHECK(!owner->result_ok);
1337         return *owner->contents.err;
1338 }
1339 void  __attribute__((export_name("TS_CResult_NoneNoneZ_get_err"))) TS_CResult_NoneNoneZ_get_err(uint64_t owner) {
1340         LDKCResult_NoneNoneZ* owner_conv = (LDKCResult_NoneNoneZ*)untag_ptr(owner);
1341         CResult_NoneNoneZ_get_err(owner_conv);
1342 }
1343
1344 static inline struct LDKECDSASignature C2Tuple_ECDSASignatureCVec_ECDSASignatureZZ_get_a(LDKC2Tuple_ECDSASignatureCVec_ECDSASignatureZZ *NONNULL_PTR owner){
1345         return owner->a;
1346 }
1347 int8_tArray  __attribute__((export_name("TS_C2Tuple_ECDSASignatureCVec_ECDSASignatureZZ_get_a"))) TS_C2Tuple_ECDSASignatureCVec_ECDSASignatureZZ_get_a(uint64_t owner) {
1348         LDKC2Tuple_ECDSASignatureCVec_ECDSASignatureZZ* owner_conv = (LDKC2Tuple_ECDSASignatureCVec_ECDSASignatureZZ*)untag_ptr(owner);
1349         int8_tArray ret_arr = init_int8_tArray(64, __LINE__);
1350         memcpy(ret_arr->elems, C2Tuple_ECDSASignatureCVec_ECDSASignatureZZ_get_a(owner_conv).compact_form, 64);
1351         return ret_arr;
1352 }
1353
1354 static inline struct LDKCVec_ECDSASignatureZ C2Tuple_ECDSASignatureCVec_ECDSASignatureZZ_get_b(LDKC2Tuple_ECDSASignatureCVec_ECDSASignatureZZ *NONNULL_PTR owner){
1355         return owner->b;
1356 }
1357 ptrArray  __attribute__((export_name("TS_C2Tuple_ECDSASignatureCVec_ECDSASignatureZZ_get_b"))) TS_C2Tuple_ECDSASignatureCVec_ECDSASignatureZZ_get_b(uint64_t owner) {
1358         LDKC2Tuple_ECDSASignatureCVec_ECDSASignatureZZ* owner_conv = (LDKC2Tuple_ECDSASignatureCVec_ECDSASignatureZZ*)untag_ptr(owner);
1359         LDKCVec_ECDSASignatureZ ret_var = C2Tuple_ECDSASignatureCVec_ECDSASignatureZZ_get_b(owner_conv);
1360         ptrArray ret_arr = NULL;
1361         ret_arr = init_ptrArray(ret_var.datalen, __LINE__);
1362         int8_tArray *ret_arr_ptr = (int8_tArray*)(((uint8_t*)ret_arr) + 8);
1363         for (size_t m = 0; m < ret_var.datalen; m++) {
1364                 int8_tArray ret_conv_12_arr = init_int8_tArray(64, __LINE__);
1365                 memcpy(ret_conv_12_arr->elems, ret_var.data[m].compact_form, 64);
1366                 ret_arr_ptr[m] = ret_conv_12_arr;
1367         }
1368         
1369         return ret_arr;
1370 }
1371
1372 static inline struct LDKC2Tuple_ECDSASignatureCVec_ECDSASignatureZZ CResult_C2Tuple_ECDSASignatureCVec_ECDSASignatureZZNoneZ_get_ok(LDKCResult_C2Tuple_ECDSASignatureCVec_ECDSASignatureZZNoneZ *NONNULL_PTR owner){
1373 CHECK(owner->result_ok);
1374         return C2Tuple_ECDSASignatureCVec_ECDSASignatureZZ_clone(&*owner->contents.result);
1375 }
1376 uint64_t  __attribute__((export_name("TS_CResult_C2Tuple_ECDSASignatureCVec_ECDSASignatureZZNoneZ_get_ok"))) TS_CResult_C2Tuple_ECDSASignatureCVec_ECDSASignatureZZNoneZ_get_ok(uint64_t owner) {
1377         LDKCResult_C2Tuple_ECDSASignatureCVec_ECDSASignatureZZNoneZ* owner_conv = (LDKCResult_C2Tuple_ECDSASignatureCVec_ECDSASignatureZZNoneZ*)untag_ptr(owner);
1378         LDKC2Tuple_ECDSASignatureCVec_ECDSASignatureZZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_ECDSASignatureCVec_ECDSASignatureZZ), "LDKC2Tuple_ECDSASignatureCVec_ECDSASignatureZZ");
1379         *ret_conv = CResult_C2Tuple_ECDSASignatureCVec_ECDSASignatureZZNoneZ_get_ok(owner_conv);
1380         return tag_ptr(ret_conv, true);
1381 }
1382
1383 static inline void CResult_C2Tuple_ECDSASignatureCVec_ECDSASignatureZZNoneZ_get_err(LDKCResult_C2Tuple_ECDSASignatureCVec_ECDSASignatureZZNoneZ *NONNULL_PTR owner){
1384 CHECK(!owner->result_ok);
1385         return *owner->contents.err;
1386 }
1387 void  __attribute__((export_name("TS_CResult_C2Tuple_ECDSASignatureCVec_ECDSASignatureZZNoneZ_get_err"))) TS_CResult_C2Tuple_ECDSASignatureCVec_ECDSASignatureZZNoneZ_get_err(uint64_t owner) {
1388         LDKCResult_C2Tuple_ECDSASignatureCVec_ECDSASignatureZZNoneZ* owner_conv = (LDKCResult_C2Tuple_ECDSASignatureCVec_ECDSASignatureZZNoneZ*)untag_ptr(owner);
1389         CResult_C2Tuple_ECDSASignatureCVec_ECDSASignatureZZNoneZ_get_err(owner_conv);
1390 }
1391
1392 static inline struct LDKECDSASignature CResult_ECDSASignatureNoneZ_get_ok(LDKCResult_ECDSASignatureNoneZ *NONNULL_PTR owner){
1393 CHECK(owner->result_ok);
1394         return *owner->contents.result;
1395 }
1396 int8_tArray  __attribute__((export_name("TS_CResult_ECDSASignatureNoneZ_get_ok"))) TS_CResult_ECDSASignatureNoneZ_get_ok(uint64_t owner) {
1397         LDKCResult_ECDSASignatureNoneZ* owner_conv = (LDKCResult_ECDSASignatureNoneZ*)untag_ptr(owner);
1398         int8_tArray ret_arr = init_int8_tArray(64, __LINE__);
1399         memcpy(ret_arr->elems, CResult_ECDSASignatureNoneZ_get_ok(owner_conv).compact_form, 64);
1400         return ret_arr;
1401 }
1402
1403 static inline void CResult_ECDSASignatureNoneZ_get_err(LDKCResult_ECDSASignatureNoneZ *NONNULL_PTR owner){
1404 CHECK(!owner->result_ok);
1405         return *owner->contents.err;
1406 }
1407 void  __attribute__((export_name("TS_CResult_ECDSASignatureNoneZ_get_err"))) TS_CResult_ECDSASignatureNoneZ_get_err(uint64_t owner) {
1408         LDKCResult_ECDSASignatureNoneZ* owner_conv = (LDKCResult_ECDSASignatureNoneZ*)untag_ptr(owner);
1409         CResult_ECDSASignatureNoneZ_get_err(owner_conv);
1410 }
1411
1412 static inline struct LDKPublicKey CResult_PublicKeyNoneZ_get_ok(LDKCResult_PublicKeyNoneZ *NONNULL_PTR owner){
1413 CHECK(owner->result_ok);
1414         return *owner->contents.result;
1415 }
1416 int8_tArray  __attribute__((export_name("TS_CResult_PublicKeyNoneZ_get_ok"))) TS_CResult_PublicKeyNoneZ_get_ok(uint64_t owner) {
1417         LDKCResult_PublicKeyNoneZ* owner_conv = (LDKCResult_PublicKeyNoneZ*)untag_ptr(owner);
1418         int8_tArray ret_arr = init_int8_tArray(33, __LINE__);
1419         memcpy(ret_arr->elems, CResult_PublicKeyNoneZ_get_ok(owner_conv).compressed_form, 33);
1420         return ret_arr;
1421 }
1422
1423 static inline void CResult_PublicKeyNoneZ_get_err(LDKCResult_PublicKeyNoneZ *NONNULL_PTR owner){
1424 CHECK(!owner->result_ok);
1425         return *owner->contents.err;
1426 }
1427 void  __attribute__((export_name("TS_CResult_PublicKeyNoneZ_get_err"))) TS_CResult_PublicKeyNoneZ_get_err(uint64_t owner) {
1428         LDKCResult_PublicKeyNoneZ* owner_conv = (LDKCResult_PublicKeyNoneZ*)untag_ptr(owner);
1429         CResult_PublicKeyNoneZ_get_err(owner_conv);
1430 }
1431
1432 uint32_t __attribute__((export_name("TS_LDKCOption_BigEndianScalarZ_ty_from_ptr"))) TS_LDKCOption_BigEndianScalarZ_ty_from_ptr(uint64_t ptr) {
1433         LDKCOption_BigEndianScalarZ *obj = (LDKCOption_BigEndianScalarZ*)untag_ptr(ptr);
1434         switch(obj->tag) {
1435                 case LDKCOption_BigEndianScalarZ_Some: return 0;
1436                 case LDKCOption_BigEndianScalarZ_None: return 1;
1437                 default: abort();
1438         }
1439 }
1440 uint64_t __attribute__((export_name("TS_LDKCOption_BigEndianScalarZ_Some_get_some"))) TS_LDKCOption_BigEndianScalarZ_Some_get_some(uint64_t ptr) {
1441         LDKCOption_BigEndianScalarZ *obj = (LDKCOption_BigEndianScalarZ*)untag_ptr(ptr);
1442         assert(obj->tag == LDKCOption_BigEndianScalarZ_Some);
1443         LDKBigEndianScalar* some_ref = &obj->some;
1444         return tag_ptr(some_ref, false);
1445 }
1446 static inline struct LDKRecoverableSignature CResult_RecoverableSignatureNoneZ_get_ok(LDKCResult_RecoverableSignatureNoneZ *NONNULL_PTR owner){
1447 CHECK(owner->result_ok);
1448         return *owner->contents.result;
1449 }
1450 int8_tArray  __attribute__((export_name("TS_CResult_RecoverableSignatureNoneZ_get_ok"))) TS_CResult_RecoverableSignatureNoneZ_get_ok(uint64_t owner) {
1451         LDKCResult_RecoverableSignatureNoneZ* owner_conv = (LDKCResult_RecoverableSignatureNoneZ*)untag_ptr(owner);
1452         int8_tArray ret_arr = init_int8_tArray(68, __LINE__);
1453         memcpy(ret_arr->elems, CResult_RecoverableSignatureNoneZ_get_ok(owner_conv).serialized_form, 68);
1454         return ret_arr;
1455 }
1456
1457 static inline void CResult_RecoverableSignatureNoneZ_get_err(LDKCResult_RecoverableSignatureNoneZ *NONNULL_PTR owner){
1458 CHECK(!owner->result_ok);
1459         return *owner->contents.err;
1460 }
1461 void  __attribute__((export_name("TS_CResult_RecoverableSignatureNoneZ_get_err"))) TS_CResult_RecoverableSignatureNoneZ_get_err(uint64_t owner) {
1462         LDKCResult_RecoverableSignatureNoneZ* owner_conv = (LDKCResult_RecoverableSignatureNoneZ*)untag_ptr(owner);
1463         CResult_RecoverableSignatureNoneZ_get_err(owner_conv);
1464 }
1465
1466 static inline struct LDKSchnorrSignature CResult_SchnorrSignatureNoneZ_get_ok(LDKCResult_SchnorrSignatureNoneZ *NONNULL_PTR owner){
1467 CHECK(owner->result_ok);
1468         return *owner->contents.result;
1469 }
1470 int8_tArray  __attribute__((export_name("TS_CResult_SchnorrSignatureNoneZ_get_ok"))) TS_CResult_SchnorrSignatureNoneZ_get_ok(uint64_t owner) {
1471         LDKCResult_SchnorrSignatureNoneZ* owner_conv = (LDKCResult_SchnorrSignatureNoneZ*)untag_ptr(owner);
1472         int8_tArray ret_arr = init_int8_tArray(64, __LINE__);
1473         memcpy(ret_arr->elems, CResult_SchnorrSignatureNoneZ_get_ok(owner_conv).compact_form, 64);
1474         return ret_arr;
1475 }
1476
1477 static inline void CResult_SchnorrSignatureNoneZ_get_err(LDKCResult_SchnorrSignatureNoneZ *NONNULL_PTR owner){
1478 CHECK(!owner->result_ok);
1479         return *owner->contents.err;
1480 }
1481 void  __attribute__((export_name("TS_CResult_SchnorrSignatureNoneZ_get_err"))) TS_CResult_SchnorrSignatureNoneZ_get_err(uint64_t owner) {
1482         LDKCResult_SchnorrSignatureNoneZ* owner_conv = (LDKCResult_SchnorrSignatureNoneZ*)untag_ptr(owner);
1483         CResult_SchnorrSignatureNoneZ_get_err(owner_conv);
1484 }
1485
1486 typedef struct LDKChannelSigner_JCalls {
1487         atomic_size_t refcnt;
1488         uint32_t instance_ptr;
1489 } LDKChannelSigner_JCalls;
1490 static void LDKChannelSigner_JCalls_free(void* this_arg) {
1491         LDKChannelSigner_JCalls *j_calls = (LDKChannelSigner_JCalls*) this_arg;
1492         if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
1493                 FREE(j_calls);
1494         }
1495 }
1496 LDKPublicKey get_per_commitment_point_LDKChannelSigner_jcall(const void* this_arg, uint64_t idx) {
1497         LDKChannelSigner_JCalls *j_calls = (LDKChannelSigner_JCalls*) this_arg;
1498         int64_t idx_conv = idx;
1499         int8_tArray ret = (int8_tArray)js_invoke_function_buuuuu(j_calls->instance_ptr, 0, idx_conv, 0, 0, 0, 0, 0);
1500         LDKPublicKey ret_ref;
1501         CHECK(ret->arr_len == 33);
1502         memcpy(ret_ref.compressed_form, ret->elems, 33); FREE(ret);
1503         return ret_ref;
1504 }
1505 LDKThirtyTwoBytes release_commitment_secret_LDKChannelSigner_jcall(const void* this_arg, uint64_t idx) {
1506         LDKChannelSigner_JCalls *j_calls = (LDKChannelSigner_JCalls*) this_arg;
1507         int64_t idx_conv = idx;
1508         int8_tArray ret = (int8_tArray)js_invoke_function_buuuuu(j_calls->instance_ptr, 1, idx_conv, 0, 0, 0, 0, 0);
1509         LDKThirtyTwoBytes ret_ref;
1510         CHECK(ret->arr_len == 32);
1511         memcpy(ret_ref.data, ret->elems, 32); FREE(ret);
1512         return ret_ref;
1513 }
1514 LDKCResult_NoneNoneZ validate_holder_commitment_LDKChannelSigner_jcall(const void* this_arg, const LDKHolderCommitmentTransaction * holder_tx, LDKCVec_ThirtyTwoBytesZ preimages) {
1515         LDKChannelSigner_JCalls *j_calls = (LDKChannelSigner_JCalls*) this_arg;
1516         LDKHolderCommitmentTransaction holder_tx_var = *holder_tx;
1517         uint64_t holder_tx_ref = 0;
1518         holder_tx_var = HolderCommitmentTransaction_clone(&holder_tx_var);
1519         CHECK_INNER_FIELD_ACCESS_OR_NULL(holder_tx_var);
1520         holder_tx_ref = tag_ptr(holder_tx_var.inner, holder_tx_var.is_owned);
1521         LDKCVec_ThirtyTwoBytesZ preimages_var = preimages;
1522         ptrArray preimages_arr = NULL;
1523         preimages_arr = init_ptrArray(preimages_var.datalen, __LINE__);
1524         int8_tArray *preimages_arr_ptr = (int8_tArray*)(((uint8_t*)preimages_arr) + 8);
1525         for (size_t m = 0; m < preimages_var.datalen; m++) {
1526                 int8_tArray preimages_conv_12_arr = init_int8_tArray(32, __LINE__);
1527                 memcpy(preimages_conv_12_arr->elems, preimages_var.data[m].data, 32);
1528                 preimages_arr_ptr[m] = preimages_conv_12_arr;
1529         }
1530         
1531         FREE(preimages_var.data);
1532         uint64_t ret = js_invoke_function_buuuuu(j_calls->instance_ptr, 2, holder_tx_ref, (uint32_t)preimages_arr, 0, 0, 0, 0);
1533         void* ret_ptr = untag_ptr(ret);
1534         CHECK_ACCESS(ret_ptr);
1535         LDKCResult_NoneNoneZ ret_conv = *(LDKCResult_NoneNoneZ*)(ret_ptr);
1536         FREE(untag_ptr(ret));
1537         return ret_conv;
1538 }
1539 LDKThirtyTwoBytes channel_keys_id_LDKChannelSigner_jcall(const void* this_arg) {
1540         LDKChannelSigner_JCalls *j_calls = (LDKChannelSigner_JCalls*) this_arg;
1541         int8_tArray ret = (int8_tArray)js_invoke_function_uuuuuu(j_calls->instance_ptr, 3, 0, 0, 0, 0, 0, 0);
1542         LDKThirtyTwoBytes ret_ref;
1543         CHECK(ret->arr_len == 32);
1544         memcpy(ret_ref.data, ret->elems, 32); FREE(ret);
1545         return ret_ref;
1546 }
1547 void provide_channel_parameters_LDKChannelSigner_jcall(void* this_arg, const LDKChannelTransactionParameters * channel_parameters) {
1548         LDKChannelSigner_JCalls *j_calls = (LDKChannelSigner_JCalls*) this_arg;
1549         LDKChannelTransactionParameters channel_parameters_var = *channel_parameters;
1550         uint64_t channel_parameters_ref = 0;
1551         channel_parameters_var = ChannelTransactionParameters_clone(&channel_parameters_var);
1552         CHECK_INNER_FIELD_ACCESS_OR_NULL(channel_parameters_var);
1553         channel_parameters_ref = tag_ptr(channel_parameters_var.inner, channel_parameters_var.is_owned);
1554         js_invoke_function_buuuuu(j_calls->instance_ptr, 4, channel_parameters_ref, 0, 0, 0, 0, 0);
1555 }
1556 static void LDKChannelSigner_JCalls_cloned(LDKChannelSigner* new_obj) {
1557         LDKChannelSigner_JCalls *j_calls = (LDKChannelSigner_JCalls*) new_obj->this_arg;
1558         atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
1559 }
1560 static inline LDKChannelSigner LDKChannelSigner_init (JSValue o, uint64_t pubkeys) {
1561         LDKChannelSigner_JCalls *calls = MALLOC(sizeof(LDKChannelSigner_JCalls), "LDKChannelSigner_JCalls");
1562         atomic_init(&calls->refcnt, 1);
1563         calls->instance_ptr = o;
1564
1565         LDKChannelPublicKeys pubkeys_conv;
1566         pubkeys_conv.inner = untag_ptr(pubkeys);
1567         pubkeys_conv.is_owned = ptr_is_owned(pubkeys);
1568         CHECK_INNER_FIELD_ACCESS_OR_NULL(pubkeys_conv);
1569
1570         LDKChannelSigner ret = {
1571                 .this_arg = (void*) calls,
1572                 .get_per_commitment_point = get_per_commitment_point_LDKChannelSigner_jcall,
1573                 .release_commitment_secret = release_commitment_secret_LDKChannelSigner_jcall,
1574                 .validate_holder_commitment = validate_holder_commitment_LDKChannelSigner_jcall,
1575                 .channel_keys_id = channel_keys_id_LDKChannelSigner_jcall,
1576                 .provide_channel_parameters = provide_channel_parameters_LDKChannelSigner_jcall,
1577                 .free = LDKChannelSigner_JCalls_free,
1578                 .pubkeys = pubkeys_conv,
1579                 .set_pubkeys = NULL,
1580         };
1581         return ret;
1582 }
1583 uint64_t  __attribute__((export_name("TS_LDKChannelSigner_new"))) TS_LDKChannelSigner_new(JSValue o, uint64_t pubkeys) {
1584         LDKChannelSigner *res_ptr = MALLOC(sizeof(LDKChannelSigner), "LDKChannelSigner");
1585         *res_ptr = LDKChannelSigner_init(o, pubkeys);
1586         return tag_ptr(res_ptr, true);
1587 }
1588 int8_tArray  __attribute__((export_name("TS_ChannelSigner_get_per_commitment_point"))) TS_ChannelSigner_get_per_commitment_point(uint64_t this_arg, int64_t idx) {
1589         void* this_arg_ptr = untag_ptr(this_arg);
1590         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
1591         LDKChannelSigner* this_arg_conv = (LDKChannelSigner*)this_arg_ptr;
1592         int8_tArray ret_arr = init_int8_tArray(33, __LINE__);
1593         memcpy(ret_arr->elems, (this_arg_conv->get_per_commitment_point)(this_arg_conv->this_arg, idx).compressed_form, 33);
1594         return ret_arr;
1595 }
1596
1597 int8_tArray  __attribute__((export_name("TS_ChannelSigner_release_commitment_secret"))) TS_ChannelSigner_release_commitment_secret(uint64_t this_arg, int64_t idx) {
1598         void* this_arg_ptr = untag_ptr(this_arg);
1599         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
1600         LDKChannelSigner* this_arg_conv = (LDKChannelSigner*)this_arg_ptr;
1601         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
1602         memcpy(ret_arr->elems, (this_arg_conv->release_commitment_secret)(this_arg_conv->this_arg, idx).data, 32);
1603         return ret_arr;
1604 }
1605
1606 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) {
1607         void* this_arg_ptr = untag_ptr(this_arg);
1608         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
1609         LDKChannelSigner* this_arg_conv = (LDKChannelSigner*)this_arg_ptr;
1610         LDKHolderCommitmentTransaction holder_tx_conv;
1611         holder_tx_conv.inner = untag_ptr(holder_tx);
1612         holder_tx_conv.is_owned = ptr_is_owned(holder_tx);
1613         CHECK_INNER_FIELD_ACCESS_OR_NULL(holder_tx_conv);
1614         holder_tx_conv.is_owned = false;
1615         LDKCVec_ThirtyTwoBytesZ preimages_constr;
1616         preimages_constr.datalen = preimages->arr_len;
1617         if (preimages_constr.datalen > 0)
1618                 preimages_constr.data = MALLOC(preimages_constr.datalen * sizeof(LDKThirtyTwoBytes), "LDKCVec_ThirtyTwoBytesZ Elements");
1619         else
1620                 preimages_constr.data = NULL;
1621         int8_tArray* preimages_vals = (void*) preimages->elems;
1622         for (size_t m = 0; m < preimages_constr.datalen; m++) {
1623                 int8_tArray preimages_conv_12 = preimages_vals[m];
1624                 LDKThirtyTwoBytes preimages_conv_12_ref;
1625                 CHECK(preimages_conv_12->arr_len == 32);
1626                 memcpy(preimages_conv_12_ref.data, preimages_conv_12->elems, 32); FREE(preimages_conv_12);
1627                 preimages_constr.data[m] = preimages_conv_12_ref;
1628         }
1629         FREE(preimages);
1630         LDKCResult_NoneNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneNoneZ), "LDKCResult_NoneNoneZ");
1631         *ret_conv = (this_arg_conv->validate_holder_commitment)(this_arg_conv->this_arg, &holder_tx_conv, preimages_constr);
1632         return tag_ptr(ret_conv, true);
1633 }
1634
1635 int8_tArray  __attribute__((export_name("TS_ChannelSigner_channel_keys_id"))) TS_ChannelSigner_channel_keys_id(uint64_t this_arg) {
1636         void* this_arg_ptr = untag_ptr(this_arg);
1637         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
1638         LDKChannelSigner* this_arg_conv = (LDKChannelSigner*)this_arg_ptr;
1639         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
1640         memcpy(ret_arr->elems, (this_arg_conv->channel_keys_id)(this_arg_conv->this_arg).data, 32);
1641         return ret_arr;
1642 }
1643
1644 void  __attribute__((export_name("TS_ChannelSigner_provide_channel_parameters"))) TS_ChannelSigner_provide_channel_parameters(uint64_t this_arg, uint64_t channel_parameters) {
1645         void* this_arg_ptr = untag_ptr(this_arg);
1646         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
1647         LDKChannelSigner* this_arg_conv = (LDKChannelSigner*)this_arg_ptr;
1648         LDKChannelTransactionParameters channel_parameters_conv;
1649         channel_parameters_conv.inner = untag_ptr(channel_parameters);
1650         channel_parameters_conv.is_owned = ptr_is_owned(channel_parameters);
1651         CHECK_INNER_FIELD_ACCESS_OR_NULL(channel_parameters_conv);
1652         channel_parameters_conv.is_owned = false;
1653         (this_arg_conv->provide_channel_parameters)(this_arg_conv->this_arg, &channel_parameters_conv);
1654 }
1655
1656 LDKChannelPublicKeys LDKChannelSigner_set_get_pubkeys(LDKChannelSigner* this_arg) {
1657         if (this_arg->set_pubkeys != NULL)
1658                 this_arg->set_pubkeys(this_arg);
1659         return this_arg->pubkeys;
1660 }
1661 uint64_t  __attribute__((export_name("TS_ChannelSigner_get_pubkeys"))) TS_ChannelSigner_get_pubkeys(uint64_t this_arg) {
1662         void* this_arg_ptr = untag_ptr(this_arg);
1663         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
1664         LDKChannelSigner* this_arg_conv = (LDKChannelSigner*)this_arg_ptr;
1665         LDKChannelPublicKeys ret_var = LDKChannelSigner_set_get_pubkeys(this_arg_conv);
1666         uint64_t ret_ref = 0;
1667         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
1668         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
1669         return ret_ref;
1670 }
1671
1672 typedef struct LDKEcdsaChannelSigner_JCalls {
1673         atomic_size_t refcnt;
1674         uint32_t instance_ptr;
1675         LDKChannelSigner_JCalls* ChannelSigner;
1676 } LDKEcdsaChannelSigner_JCalls;
1677 static void LDKEcdsaChannelSigner_JCalls_free(void* this_arg) {
1678         LDKEcdsaChannelSigner_JCalls *j_calls = (LDKEcdsaChannelSigner_JCalls*) this_arg;
1679         if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
1680                 FREE(j_calls);
1681         }
1682 }
1683 LDKCResult_C2Tuple_ECDSASignatureCVec_ECDSASignatureZZNoneZ sign_counterparty_commitment_LDKEcdsaChannelSigner_jcall(const void* this_arg, const LDKCommitmentTransaction * commitment_tx, LDKCVec_ThirtyTwoBytesZ preimages) {
1684         LDKEcdsaChannelSigner_JCalls *j_calls = (LDKEcdsaChannelSigner_JCalls*) this_arg;
1685         LDKCommitmentTransaction commitment_tx_var = *commitment_tx;
1686         uint64_t commitment_tx_ref = 0;
1687         commitment_tx_var = CommitmentTransaction_clone(&commitment_tx_var);
1688         CHECK_INNER_FIELD_ACCESS_OR_NULL(commitment_tx_var);
1689         commitment_tx_ref = tag_ptr(commitment_tx_var.inner, commitment_tx_var.is_owned);
1690         LDKCVec_ThirtyTwoBytesZ preimages_var = preimages;
1691         ptrArray preimages_arr = NULL;
1692         preimages_arr = init_ptrArray(preimages_var.datalen, __LINE__);
1693         int8_tArray *preimages_arr_ptr = (int8_tArray*)(((uint8_t*)preimages_arr) + 8);
1694         for (size_t m = 0; m < preimages_var.datalen; m++) {
1695                 int8_tArray preimages_conv_12_arr = init_int8_tArray(32, __LINE__);
1696                 memcpy(preimages_conv_12_arr->elems, preimages_var.data[m].data, 32);
1697                 preimages_arr_ptr[m] = preimages_conv_12_arr;
1698         }
1699         
1700         FREE(preimages_var.data);
1701         uint64_t ret = js_invoke_function_buuuuu(j_calls->instance_ptr, 5, commitment_tx_ref, (uint32_t)preimages_arr, 0, 0, 0, 0);
1702         void* ret_ptr = untag_ptr(ret);
1703         CHECK_ACCESS(ret_ptr);
1704         LDKCResult_C2Tuple_ECDSASignatureCVec_ECDSASignatureZZNoneZ ret_conv = *(LDKCResult_C2Tuple_ECDSASignatureCVec_ECDSASignatureZZNoneZ*)(ret_ptr);
1705         FREE(untag_ptr(ret));
1706         return ret_conv;
1707 }
1708 LDKCResult_NoneNoneZ validate_counterparty_revocation_LDKEcdsaChannelSigner_jcall(const void* this_arg, uint64_t idx, const uint8_t (* secret)[32]) {
1709         LDKEcdsaChannelSigner_JCalls *j_calls = (LDKEcdsaChannelSigner_JCalls*) this_arg;
1710         int64_t idx_conv = idx;
1711         int8_tArray secret_arr = init_int8_tArray(32, __LINE__);
1712         memcpy(secret_arr->elems, *secret, 32);
1713         uint64_t ret = js_invoke_function_buuuuu(j_calls->instance_ptr, 6, idx_conv, (uint32_t)secret_arr, 0, 0, 0, 0);
1714         void* ret_ptr = untag_ptr(ret);
1715         CHECK_ACCESS(ret_ptr);
1716         LDKCResult_NoneNoneZ ret_conv = *(LDKCResult_NoneNoneZ*)(ret_ptr);
1717         FREE(untag_ptr(ret));
1718         return ret_conv;
1719 }
1720 LDKCResult_ECDSASignatureNoneZ sign_holder_commitment_LDKEcdsaChannelSigner_jcall(const void* this_arg, const LDKHolderCommitmentTransaction * commitment_tx) {
1721         LDKEcdsaChannelSigner_JCalls *j_calls = (LDKEcdsaChannelSigner_JCalls*) this_arg;
1722         LDKHolderCommitmentTransaction commitment_tx_var = *commitment_tx;
1723         uint64_t commitment_tx_ref = 0;
1724         commitment_tx_var = HolderCommitmentTransaction_clone(&commitment_tx_var);
1725         CHECK_INNER_FIELD_ACCESS_OR_NULL(commitment_tx_var);
1726         commitment_tx_ref = tag_ptr(commitment_tx_var.inner, commitment_tx_var.is_owned);
1727         uint64_t ret = js_invoke_function_buuuuu(j_calls->instance_ptr, 7, commitment_tx_ref, 0, 0, 0, 0, 0);
1728         void* ret_ptr = untag_ptr(ret);
1729         CHECK_ACCESS(ret_ptr);
1730         LDKCResult_ECDSASignatureNoneZ ret_conv = *(LDKCResult_ECDSASignatureNoneZ*)(ret_ptr);
1731         FREE(untag_ptr(ret));
1732         return ret_conv;
1733 }
1734 LDKCResult_ECDSASignatureNoneZ 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]) {
1735         LDKEcdsaChannelSigner_JCalls *j_calls = (LDKEcdsaChannelSigner_JCalls*) this_arg;
1736         LDKTransaction justice_tx_var = justice_tx;
1737         int8_tArray justice_tx_arr = init_int8_tArray(justice_tx_var.datalen, __LINE__);
1738         memcpy(justice_tx_arr->elems, justice_tx_var.data, justice_tx_var.datalen);
1739         Transaction_free(justice_tx_var);
1740         uint32_t input_conv = input;
1741         int64_t amount_conv = amount;
1742         int8_tArray per_commitment_key_arr = init_int8_tArray(32, __LINE__);
1743         memcpy(per_commitment_key_arr->elems, *per_commitment_key, 32);
1744         uint64_t ret = js_invoke_function_uubuuu(j_calls->instance_ptr, 8, (uint32_t)justice_tx_arr, input_conv, amount_conv, (uint32_t)per_commitment_key_arr, 0, 0);
1745         void* ret_ptr = untag_ptr(ret);
1746         CHECK_ACCESS(ret_ptr);
1747         LDKCResult_ECDSASignatureNoneZ ret_conv = *(LDKCResult_ECDSASignatureNoneZ*)(ret_ptr);
1748         FREE(untag_ptr(ret));
1749         return ret_conv;
1750 }
1751 LDKCResult_ECDSASignatureNoneZ 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) {
1752         LDKEcdsaChannelSigner_JCalls *j_calls = (LDKEcdsaChannelSigner_JCalls*) this_arg;
1753         LDKTransaction justice_tx_var = justice_tx;
1754         int8_tArray justice_tx_arr = init_int8_tArray(justice_tx_var.datalen, __LINE__);
1755         memcpy(justice_tx_arr->elems, justice_tx_var.data, justice_tx_var.datalen);
1756         Transaction_free(justice_tx_var);
1757         uint32_t input_conv = input;
1758         int64_t amount_conv = amount;
1759         int8_tArray per_commitment_key_arr = init_int8_tArray(32, __LINE__);
1760         memcpy(per_commitment_key_arr->elems, *per_commitment_key, 32);
1761         LDKHTLCOutputInCommitment htlc_var = *htlc;
1762         uint64_t htlc_ref = 0;
1763         htlc_var = HTLCOutputInCommitment_clone(&htlc_var);
1764         CHECK_INNER_FIELD_ACCESS_OR_NULL(htlc_var);
1765         htlc_ref = tag_ptr(htlc_var.inner, htlc_var.is_owned);
1766         uint64_t ret = js_invoke_function_uububu(j_calls->instance_ptr, 9, (uint32_t)justice_tx_arr, input_conv, amount_conv, (uint32_t)per_commitment_key_arr, htlc_ref, 0);
1767         void* ret_ptr = untag_ptr(ret);
1768         CHECK_ACCESS(ret_ptr);
1769         LDKCResult_ECDSASignatureNoneZ ret_conv = *(LDKCResult_ECDSASignatureNoneZ*)(ret_ptr);
1770         FREE(untag_ptr(ret));
1771         return ret_conv;
1772 }
1773 LDKCResult_ECDSASignatureNoneZ sign_holder_htlc_transaction_LDKEcdsaChannelSigner_jcall(const void* this_arg, LDKTransaction htlc_tx, uintptr_t input, const LDKHTLCDescriptor * htlc_descriptor) {
1774         LDKEcdsaChannelSigner_JCalls *j_calls = (LDKEcdsaChannelSigner_JCalls*) this_arg;
1775         LDKTransaction htlc_tx_var = htlc_tx;
1776         int8_tArray htlc_tx_arr = init_int8_tArray(htlc_tx_var.datalen, __LINE__);
1777         memcpy(htlc_tx_arr->elems, htlc_tx_var.data, htlc_tx_var.datalen);
1778         Transaction_free(htlc_tx_var);
1779         uint32_t input_conv = input;
1780         LDKHTLCDescriptor htlc_descriptor_var = *htlc_descriptor;
1781         uint64_t htlc_descriptor_ref = 0;
1782         htlc_descriptor_var = HTLCDescriptor_clone(&htlc_descriptor_var);
1783         CHECK_INNER_FIELD_ACCESS_OR_NULL(htlc_descriptor_var);
1784         htlc_descriptor_ref = tag_ptr(htlc_descriptor_var.inner, htlc_descriptor_var.is_owned);
1785         uint64_t ret = js_invoke_function_uubuuu(j_calls->instance_ptr, 10, (uint32_t)htlc_tx_arr, input_conv, htlc_descriptor_ref, 0, 0, 0);
1786         void* ret_ptr = untag_ptr(ret);
1787         CHECK_ACCESS(ret_ptr);
1788         LDKCResult_ECDSASignatureNoneZ ret_conv = *(LDKCResult_ECDSASignatureNoneZ*)(ret_ptr);
1789         FREE(untag_ptr(ret));
1790         return ret_conv;
1791 }
1792 LDKCResult_ECDSASignatureNoneZ 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) {
1793         LDKEcdsaChannelSigner_JCalls *j_calls = (LDKEcdsaChannelSigner_JCalls*) this_arg;
1794         LDKTransaction htlc_tx_var = htlc_tx;
1795         int8_tArray htlc_tx_arr = init_int8_tArray(htlc_tx_var.datalen, __LINE__);
1796         memcpy(htlc_tx_arr->elems, htlc_tx_var.data, htlc_tx_var.datalen);
1797         Transaction_free(htlc_tx_var);
1798         uint32_t input_conv = input;
1799         int64_t amount_conv = amount;
1800         int8_tArray per_commitment_point_arr = init_int8_tArray(33, __LINE__);
1801         memcpy(per_commitment_point_arr->elems, per_commitment_point.compressed_form, 33);
1802         LDKHTLCOutputInCommitment htlc_var = *htlc;
1803         uint64_t htlc_ref = 0;
1804         htlc_var = HTLCOutputInCommitment_clone(&htlc_var);
1805         CHECK_INNER_FIELD_ACCESS_OR_NULL(htlc_var);
1806         htlc_ref = tag_ptr(htlc_var.inner, htlc_var.is_owned);
1807         uint64_t ret = js_invoke_function_uububu(j_calls->instance_ptr, 11, (uint32_t)htlc_tx_arr, input_conv, amount_conv, (uint32_t)per_commitment_point_arr, htlc_ref, 0);
1808         void* ret_ptr = untag_ptr(ret);
1809         CHECK_ACCESS(ret_ptr);
1810         LDKCResult_ECDSASignatureNoneZ ret_conv = *(LDKCResult_ECDSASignatureNoneZ*)(ret_ptr);
1811         FREE(untag_ptr(ret));
1812         return ret_conv;
1813 }
1814 LDKCResult_ECDSASignatureNoneZ sign_closing_transaction_LDKEcdsaChannelSigner_jcall(const void* this_arg, const LDKClosingTransaction * closing_tx) {
1815         LDKEcdsaChannelSigner_JCalls *j_calls = (LDKEcdsaChannelSigner_JCalls*) this_arg;
1816         LDKClosingTransaction closing_tx_var = *closing_tx;
1817         uint64_t closing_tx_ref = 0;
1818         closing_tx_var = ClosingTransaction_clone(&closing_tx_var);
1819         CHECK_INNER_FIELD_ACCESS_OR_NULL(closing_tx_var);
1820         closing_tx_ref = tag_ptr(closing_tx_var.inner, closing_tx_var.is_owned);
1821         uint64_t ret = js_invoke_function_buuuuu(j_calls->instance_ptr, 12, closing_tx_ref, 0, 0, 0, 0, 0);
1822         void* ret_ptr = untag_ptr(ret);
1823         CHECK_ACCESS(ret_ptr);
1824         LDKCResult_ECDSASignatureNoneZ ret_conv = *(LDKCResult_ECDSASignatureNoneZ*)(ret_ptr);
1825         FREE(untag_ptr(ret));
1826         return ret_conv;
1827 }
1828 LDKCResult_ECDSASignatureNoneZ sign_holder_anchor_input_LDKEcdsaChannelSigner_jcall(const void* this_arg, LDKTransaction anchor_tx, uintptr_t input) {
1829         LDKEcdsaChannelSigner_JCalls *j_calls = (LDKEcdsaChannelSigner_JCalls*) this_arg;
1830         LDKTransaction anchor_tx_var = anchor_tx;
1831         int8_tArray anchor_tx_arr = init_int8_tArray(anchor_tx_var.datalen, __LINE__);
1832         memcpy(anchor_tx_arr->elems, anchor_tx_var.data, anchor_tx_var.datalen);
1833         Transaction_free(anchor_tx_var);
1834         uint32_t input_conv = input;
1835         uint64_t ret = js_invoke_function_uuuuuu(j_calls->instance_ptr, 13, (uint32_t)anchor_tx_arr, input_conv, 0, 0, 0, 0);
1836         void* ret_ptr = untag_ptr(ret);
1837         CHECK_ACCESS(ret_ptr);
1838         LDKCResult_ECDSASignatureNoneZ ret_conv = *(LDKCResult_ECDSASignatureNoneZ*)(ret_ptr);
1839         FREE(untag_ptr(ret));
1840         return ret_conv;
1841 }
1842 LDKCResult_ECDSASignatureNoneZ sign_channel_announcement_with_funding_key_LDKEcdsaChannelSigner_jcall(const void* this_arg, const LDKUnsignedChannelAnnouncement * msg) {
1843         LDKEcdsaChannelSigner_JCalls *j_calls = (LDKEcdsaChannelSigner_JCalls*) this_arg;
1844         LDKUnsignedChannelAnnouncement msg_var = *msg;
1845         uint64_t msg_ref = 0;
1846         msg_var = UnsignedChannelAnnouncement_clone(&msg_var);
1847         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
1848         msg_ref = tag_ptr(msg_var.inner, msg_var.is_owned);
1849         uint64_t ret = js_invoke_function_buuuuu(j_calls->instance_ptr, 14, msg_ref, 0, 0, 0, 0, 0);
1850         void* ret_ptr = untag_ptr(ret);
1851         CHECK_ACCESS(ret_ptr);
1852         LDKCResult_ECDSASignatureNoneZ ret_conv = *(LDKCResult_ECDSASignatureNoneZ*)(ret_ptr);
1853         FREE(untag_ptr(ret));
1854         return ret_conv;
1855 }
1856 static void LDKEcdsaChannelSigner_JCalls_cloned(LDKEcdsaChannelSigner* new_obj) {
1857         LDKEcdsaChannelSigner_JCalls *j_calls = (LDKEcdsaChannelSigner_JCalls*) new_obj->this_arg;
1858         atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
1859         atomic_fetch_add_explicit(&j_calls->ChannelSigner->refcnt, 1, memory_order_release);
1860 }
1861 static inline LDKEcdsaChannelSigner LDKEcdsaChannelSigner_init (JSValue o, JSValue ChannelSigner, uint64_t pubkeys) {
1862         LDKEcdsaChannelSigner_JCalls *calls = MALLOC(sizeof(LDKEcdsaChannelSigner_JCalls), "LDKEcdsaChannelSigner_JCalls");
1863         atomic_init(&calls->refcnt, 1);
1864         calls->instance_ptr = o;
1865
1866         LDKChannelPublicKeys pubkeys_conv;
1867         pubkeys_conv.inner = untag_ptr(pubkeys);
1868         pubkeys_conv.is_owned = ptr_is_owned(pubkeys);
1869         CHECK_INNER_FIELD_ACCESS_OR_NULL(pubkeys_conv);
1870
1871         LDKEcdsaChannelSigner ret = {
1872                 .this_arg = (void*) calls,
1873                 .sign_counterparty_commitment = sign_counterparty_commitment_LDKEcdsaChannelSigner_jcall,
1874                 .validate_counterparty_revocation = validate_counterparty_revocation_LDKEcdsaChannelSigner_jcall,
1875                 .sign_holder_commitment = sign_holder_commitment_LDKEcdsaChannelSigner_jcall,
1876                 .sign_justice_revoked_output = sign_justice_revoked_output_LDKEcdsaChannelSigner_jcall,
1877                 .sign_justice_revoked_htlc = sign_justice_revoked_htlc_LDKEcdsaChannelSigner_jcall,
1878                 .sign_holder_htlc_transaction = sign_holder_htlc_transaction_LDKEcdsaChannelSigner_jcall,
1879                 .sign_counterparty_htlc_transaction = sign_counterparty_htlc_transaction_LDKEcdsaChannelSigner_jcall,
1880                 .sign_closing_transaction = sign_closing_transaction_LDKEcdsaChannelSigner_jcall,
1881                 .sign_holder_anchor_input = sign_holder_anchor_input_LDKEcdsaChannelSigner_jcall,
1882                 .sign_channel_announcement_with_funding_key = sign_channel_announcement_with_funding_key_LDKEcdsaChannelSigner_jcall,
1883                 .free = LDKEcdsaChannelSigner_JCalls_free,
1884                 .ChannelSigner = LDKChannelSigner_init(ChannelSigner, pubkeys),
1885         };
1886         calls->ChannelSigner = ret.ChannelSigner.this_arg;
1887         return ret;
1888 }
1889 uint64_t  __attribute__((export_name("TS_LDKEcdsaChannelSigner_new"))) TS_LDKEcdsaChannelSigner_new(JSValue o, JSValue ChannelSigner, uint64_t pubkeys) {
1890         LDKEcdsaChannelSigner *res_ptr = MALLOC(sizeof(LDKEcdsaChannelSigner), "LDKEcdsaChannelSigner");
1891         *res_ptr = LDKEcdsaChannelSigner_init(o, ChannelSigner, pubkeys);
1892         return tag_ptr(res_ptr, true);
1893 }
1894 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) {
1895         void* this_arg_ptr = untag_ptr(this_arg);
1896         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
1897         LDKEcdsaChannelSigner* this_arg_conv = (LDKEcdsaChannelSigner*)this_arg_ptr;
1898         LDKCommitmentTransaction commitment_tx_conv;
1899         commitment_tx_conv.inner = untag_ptr(commitment_tx);
1900         commitment_tx_conv.is_owned = ptr_is_owned(commitment_tx);
1901         CHECK_INNER_FIELD_ACCESS_OR_NULL(commitment_tx_conv);
1902         commitment_tx_conv.is_owned = false;
1903         LDKCVec_ThirtyTwoBytesZ preimages_constr;
1904         preimages_constr.datalen = preimages->arr_len;
1905         if (preimages_constr.datalen > 0)
1906                 preimages_constr.data = MALLOC(preimages_constr.datalen * sizeof(LDKThirtyTwoBytes), "LDKCVec_ThirtyTwoBytesZ Elements");
1907         else
1908                 preimages_constr.data = NULL;
1909         int8_tArray* preimages_vals = (void*) preimages->elems;
1910         for (size_t m = 0; m < preimages_constr.datalen; m++) {
1911                 int8_tArray preimages_conv_12 = preimages_vals[m];
1912                 LDKThirtyTwoBytes preimages_conv_12_ref;
1913                 CHECK(preimages_conv_12->arr_len == 32);
1914                 memcpy(preimages_conv_12_ref.data, preimages_conv_12->elems, 32); FREE(preimages_conv_12);
1915                 preimages_constr.data[m] = preimages_conv_12_ref;
1916         }
1917         FREE(preimages);
1918         LDKCResult_C2Tuple_ECDSASignatureCVec_ECDSASignatureZZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_ECDSASignatureCVec_ECDSASignatureZZNoneZ), "LDKCResult_C2Tuple_ECDSASignatureCVec_ECDSASignatureZZNoneZ");
1919         *ret_conv = (this_arg_conv->sign_counterparty_commitment)(this_arg_conv->this_arg, &commitment_tx_conv, preimages_constr);
1920         return tag_ptr(ret_conv, true);
1921 }
1922
1923 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) {
1924         void* this_arg_ptr = untag_ptr(this_arg);
1925         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
1926         LDKEcdsaChannelSigner* this_arg_conv = (LDKEcdsaChannelSigner*)this_arg_ptr;
1927         uint8_t secret_arr[32];
1928         CHECK(secret->arr_len == 32);
1929         memcpy(secret_arr, secret->elems, 32); FREE(secret);
1930         uint8_t (*secret_ref)[32] = &secret_arr;
1931         LDKCResult_NoneNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneNoneZ), "LDKCResult_NoneNoneZ");
1932         *ret_conv = (this_arg_conv->validate_counterparty_revocation)(this_arg_conv->this_arg, idx, secret_ref);
1933         return tag_ptr(ret_conv, true);
1934 }
1935
1936 uint64_t  __attribute__((export_name("TS_EcdsaChannelSigner_sign_holder_commitment"))) TS_EcdsaChannelSigner_sign_holder_commitment(uint64_t this_arg, uint64_t commitment_tx) {
1937         void* this_arg_ptr = untag_ptr(this_arg);
1938         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
1939         LDKEcdsaChannelSigner* this_arg_conv = (LDKEcdsaChannelSigner*)this_arg_ptr;
1940         LDKHolderCommitmentTransaction commitment_tx_conv;
1941         commitment_tx_conv.inner = untag_ptr(commitment_tx);
1942         commitment_tx_conv.is_owned = ptr_is_owned(commitment_tx);
1943         CHECK_INNER_FIELD_ACCESS_OR_NULL(commitment_tx_conv);
1944         commitment_tx_conv.is_owned = false;
1945         LDKCResult_ECDSASignatureNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_ECDSASignatureNoneZ), "LDKCResult_ECDSASignatureNoneZ");
1946         *ret_conv = (this_arg_conv->sign_holder_commitment)(this_arg_conv->this_arg, &commitment_tx_conv);
1947         return tag_ptr(ret_conv, true);
1948 }
1949
1950 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) {
1951         void* this_arg_ptr = untag_ptr(this_arg);
1952         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
1953         LDKEcdsaChannelSigner* this_arg_conv = (LDKEcdsaChannelSigner*)this_arg_ptr;
1954         LDKTransaction justice_tx_ref;
1955         justice_tx_ref.datalen = justice_tx->arr_len;
1956         justice_tx_ref.data = MALLOC(justice_tx_ref.datalen, "LDKTransaction Bytes");
1957         memcpy(justice_tx_ref.data, justice_tx->elems, justice_tx_ref.datalen); FREE(justice_tx);
1958         justice_tx_ref.data_is_owned = true;
1959         uint8_t per_commitment_key_arr[32];
1960         CHECK(per_commitment_key->arr_len == 32);
1961         memcpy(per_commitment_key_arr, per_commitment_key->elems, 32); FREE(per_commitment_key);
1962         uint8_t (*per_commitment_key_ref)[32] = &per_commitment_key_arr;
1963         LDKCResult_ECDSASignatureNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_ECDSASignatureNoneZ), "LDKCResult_ECDSASignatureNoneZ");
1964         *ret_conv = (this_arg_conv->sign_justice_revoked_output)(this_arg_conv->this_arg, justice_tx_ref, input, amount, per_commitment_key_ref);
1965         return tag_ptr(ret_conv, true);
1966 }
1967
1968 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) {
1969         void* this_arg_ptr = untag_ptr(this_arg);
1970         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
1971         LDKEcdsaChannelSigner* this_arg_conv = (LDKEcdsaChannelSigner*)this_arg_ptr;
1972         LDKTransaction justice_tx_ref;
1973         justice_tx_ref.datalen = justice_tx->arr_len;
1974         justice_tx_ref.data = MALLOC(justice_tx_ref.datalen, "LDKTransaction Bytes");
1975         memcpy(justice_tx_ref.data, justice_tx->elems, justice_tx_ref.datalen); FREE(justice_tx);
1976         justice_tx_ref.data_is_owned = true;
1977         uint8_t per_commitment_key_arr[32];
1978         CHECK(per_commitment_key->arr_len == 32);
1979         memcpy(per_commitment_key_arr, per_commitment_key->elems, 32); FREE(per_commitment_key);
1980         uint8_t (*per_commitment_key_ref)[32] = &per_commitment_key_arr;
1981         LDKHTLCOutputInCommitment htlc_conv;
1982         htlc_conv.inner = untag_ptr(htlc);
1983         htlc_conv.is_owned = ptr_is_owned(htlc);
1984         CHECK_INNER_FIELD_ACCESS_OR_NULL(htlc_conv);
1985         htlc_conv.is_owned = false;
1986         LDKCResult_ECDSASignatureNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_ECDSASignatureNoneZ), "LDKCResult_ECDSASignatureNoneZ");
1987         *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);
1988         return tag_ptr(ret_conv, true);
1989 }
1990
1991 uint64_t  __attribute__((export_name("TS_EcdsaChannelSigner_sign_holder_htlc_transaction"))) TS_EcdsaChannelSigner_sign_holder_htlc_transaction(uint64_t this_arg, int8_tArray htlc_tx, uint32_t input, uint64_t htlc_descriptor) {
1992         void* this_arg_ptr = untag_ptr(this_arg);
1993         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
1994         LDKEcdsaChannelSigner* this_arg_conv = (LDKEcdsaChannelSigner*)this_arg_ptr;
1995         LDKTransaction htlc_tx_ref;
1996         htlc_tx_ref.datalen = htlc_tx->arr_len;
1997         htlc_tx_ref.data = MALLOC(htlc_tx_ref.datalen, "LDKTransaction Bytes");
1998         memcpy(htlc_tx_ref.data, htlc_tx->elems, htlc_tx_ref.datalen); FREE(htlc_tx);
1999         htlc_tx_ref.data_is_owned = true;
2000         LDKHTLCDescriptor htlc_descriptor_conv;
2001         htlc_descriptor_conv.inner = untag_ptr(htlc_descriptor);
2002         htlc_descriptor_conv.is_owned = ptr_is_owned(htlc_descriptor);
2003         CHECK_INNER_FIELD_ACCESS_OR_NULL(htlc_descriptor_conv);
2004         htlc_descriptor_conv.is_owned = false;
2005         LDKCResult_ECDSASignatureNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_ECDSASignatureNoneZ), "LDKCResult_ECDSASignatureNoneZ");
2006         *ret_conv = (this_arg_conv->sign_holder_htlc_transaction)(this_arg_conv->this_arg, htlc_tx_ref, input, &htlc_descriptor_conv);
2007         return tag_ptr(ret_conv, true);
2008 }
2009
2010 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) {
2011         void* this_arg_ptr = untag_ptr(this_arg);
2012         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
2013         LDKEcdsaChannelSigner* this_arg_conv = (LDKEcdsaChannelSigner*)this_arg_ptr;
2014         LDKTransaction htlc_tx_ref;
2015         htlc_tx_ref.datalen = htlc_tx->arr_len;
2016         htlc_tx_ref.data = MALLOC(htlc_tx_ref.datalen, "LDKTransaction Bytes");
2017         memcpy(htlc_tx_ref.data, htlc_tx->elems, htlc_tx_ref.datalen); FREE(htlc_tx);
2018         htlc_tx_ref.data_is_owned = true;
2019         LDKPublicKey per_commitment_point_ref;
2020         CHECK(per_commitment_point->arr_len == 33);
2021         memcpy(per_commitment_point_ref.compressed_form, per_commitment_point->elems, 33); FREE(per_commitment_point);
2022         LDKHTLCOutputInCommitment htlc_conv;
2023         htlc_conv.inner = untag_ptr(htlc);
2024         htlc_conv.is_owned = ptr_is_owned(htlc);
2025         CHECK_INNER_FIELD_ACCESS_OR_NULL(htlc_conv);
2026         htlc_conv.is_owned = false;
2027         LDKCResult_ECDSASignatureNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_ECDSASignatureNoneZ), "LDKCResult_ECDSASignatureNoneZ");
2028         *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);
2029         return tag_ptr(ret_conv, true);
2030 }
2031
2032 uint64_t  __attribute__((export_name("TS_EcdsaChannelSigner_sign_closing_transaction"))) TS_EcdsaChannelSigner_sign_closing_transaction(uint64_t this_arg, uint64_t closing_tx) {
2033         void* this_arg_ptr = untag_ptr(this_arg);
2034         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
2035         LDKEcdsaChannelSigner* this_arg_conv = (LDKEcdsaChannelSigner*)this_arg_ptr;
2036         LDKClosingTransaction closing_tx_conv;
2037         closing_tx_conv.inner = untag_ptr(closing_tx);
2038         closing_tx_conv.is_owned = ptr_is_owned(closing_tx);
2039         CHECK_INNER_FIELD_ACCESS_OR_NULL(closing_tx_conv);
2040         closing_tx_conv.is_owned = false;
2041         LDKCResult_ECDSASignatureNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_ECDSASignatureNoneZ), "LDKCResult_ECDSASignatureNoneZ");
2042         *ret_conv = (this_arg_conv->sign_closing_transaction)(this_arg_conv->this_arg, &closing_tx_conv);
2043         return tag_ptr(ret_conv, true);
2044 }
2045
2046 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) {
2047         void* this_arg_ptr = untag_ptr(this_arg);
2048         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
2049         LDKEcdsaChannelSigner* this_arg_conv = (LDKEcdsaChannelSigner*)this_arg_ptr;
2050         LDKTransaction anchor_tx_ref;
2051         anchor_tx_ref.datalen = anchor_tx->arr_len;
2052         anchor_tx_ref.data = MALLOC(anchor_tx_ref.datalen, "LDKTransaction Bytes");
2053         memcpy(anchor_tx_ref.data, anchor_tx->elems, anchor_tx_ref.datalen); FREE(anchor_tx);
2054         anchor_tx_ref.data_is_owned = true;
2055         LDKCResult_ECDSASignatureNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_ECDSASignatureNoneZ), "LDKCResult_ECDSASignatureNoneZ");
2056         *ret_conv = (this_arg_conv->sign_holder_anchor_input)(this_arg_conv->this_arg, anchor_tx_ref, input);
2057         return tag_ptr(ret_conv, true);
2058 }
2059
2060 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) {
2061         void* this_arg_ptr = untag_ptr(this_arg);
2062         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
2063         LDKEcdsaChannelSigner* this_arg_conv = (LDKEcdsaChannelSigner*)this_arg_ptr;
2064         LDKUnsignedChannelAnnouncement msg_conv;
2065         msg_conv.inner = untag_ptr(msg);
2066         msg_conv.is_owned = ptr_is_owned(msg);
2067         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
2068         msg_conv.is_owned = false;
2069         LDKCResult_ECDSASignatureNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_ECDSASignatureNoneZ), "LDKCResult_ECDSASignatureNoneZ");
2070         *ret_conv = (this_arg_conv->sign_channel_announcement_with_funding_key)(this_arg_conv->this_arg, &msg_conv);
2071         return tag_ptr(ret_conv, true);
2072 }
2073
2074 typedef struct LDKWriteableEcdsaChannelSigner_JCalls {
2075         atomic_size_t refcnt;
2076         uint32_t instance_ptr;
2077         LDKEcdsaChannelSigner_JCalls* EcdsaChannelSigner;
2078         LDKChannelSigner_JCalls* ChannelSigner;
2079 } LDKWriteableEcdsaChannelSigner_JCalls;
2080 static void LDKWriteableEcdsaChannelSigner_JCalls_free(void* this_arg) {
2081         LDKWriteableEcdsaChannelSigner_JCalls *j_calls = (LDKWriteableEcdsaChannelSigner_JCalls*) this_arg;
2082         if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
2083                 FREE(j_calls);
2084         }
2085 }
2086 LDKCVec_u8Z write_LDKWriteableEcdsaChannelSigner_jcall(const void* this_arg) {
2087         LDKWriteableEcdsaChannelSigner_JCalls *j_calls = (LDKWriteableEcdsaChannelSigner_JCalls*) this_arg;
2088         int8_tArray ret = (int8_tArray)js_invoke_function_uuuuuu(j_calls->instance_ptr, 15, 0, 0, 0, 0, 0, 0);
2089         LDKCVec_u8Z ret_ref;
2090         ret_ref.datalen = ret->arr_len;
2091         ret_ref.data = MALLOC(ret_ref.datalen, "LDKCVec_u8Z Bytes");
2092         memcpy(ret_ref.data, ret->elems, ret_ref.datalen); FREE(ret);
2093         return ret_ref;
2094 }
2095 static void LDKWriteableEcdsaChannelSigner_JCalls_cloned(LDKWriteableEcdsaChannelSigner* new_obj) {
2096         LDKWriteableEcdsaChannelSigner_JCalls *j_calls = (LDKWriteableEcdsaChannelSigner_JCalls*) new_obj->this_arg;
2097         atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
2098         atomic_fetch_add_explicit(&j_calls->EcdsaChannelSigner->refcnt, 1, memory_order_release);
2099         atomic_fetch_add_explicit(&j_calls->EcdsaChannelSigner->ChannelSigner->refcnt, 1, memory_order_release);
2100 }
2101 static inline LDKWriteableEcdsaChannelSigner LDKWriteableEcdsaChannelSigner_init (JSValue o, JSValue EcdsaChannelSigner, JSValue ChannelSigner, uint64_t pubkeys) {
2102         LDKWriteableEcdsaChannelSigner_JCalls *calls = MALLOC(sizeof(LDKWriteableEcdsaChannelSigner_JCalls), "LDKWriteableEcdsaChannelSigner_JCalls");
2103         atomic_init(&calls->refcnt, 1);
2104         calls->instance_ptr = o;
2105
2106         LDKChannelPublicKeys pubkeys_conv;
2107         pubkeys_conv.inner = untag_ptr(pubkeys);
2108         pubkeys_conv.is_owned = ptr_is_owned(pubkeys);
2109         CHECK_INNER_FIELD_ACCESS_OR_NULL(pubkeys_conv);
2110
2111         LDKWriteableEcdsaChannelSigner ret = {
2112                 .this_arg = (void*) calls,
2113                 .write = write_LDKWriteableEcdsaChannelSigner_jcall,
2114                 .cloned = LDKWriteableEcdsaChannelSigner_JCalls_cloned,
2115                 .free = LDKWriteableEcdsaChannelSigner_JCalls_free,
2116                 .EcdsaChannelSigner = LDKEcdsaChannelSigner_init(EcdsaChannelSigner, ChannelSigner, pubkeys),
2117         };
2118         calls->EcdsaChannelSigner = ret.EcdsaChannelSigner.this_arg;
2119         calls->ChannelSigner = ret.EcdsaChannelSigner.ChannelSigner.this_arg;
2120         return ret;
2121 }
2122 uint64_t  __attribute__((export_name("TS_LDKWriteableEcdsaChannelSigner_new"))) TS_LDKWriteableEcdsaChannelSigner_new(JSValue o, JSValue EcdsaChannelSigner, JSValue ChannelSigner, uint64_t pubkeys) {
2123         LDKWriteableEcdsaChannelSigner *res_ptr = MALLOC(sizeof(LDKWriteableEcdsaChannelSigner), "LDKWriteableEcdsaChannelSigner");
2124         *res_ptr = LDKWriteableEcdsaChannelSigner_init(o, EcdsaChannelSigner, ChannelSigner, pubkeys);
2125         return tag_ptr(res_ptr, true);
2126 }
2127 int8_tArray  __attribute__((export_name("TS_WriteableEcdsaChannelSigner_write"))) TS_WriteableEcdsaChannelSigner_write(uint64_t this_arg) {
2128         void* this_arg_ptr = untag_ptr(this_arg);
2129         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
2130         LDKWriteableEcdsaChannelSigner* this_arg_conv = (LDKWriteableEcdsaChannelSigner*)this_arg_ptr;
2131         LDKCVec_u8Z ret_var = (this_arg_conv->write)(this_arg_conv->this_arg);
2132         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
2133         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
2134         CVec_u8Z_free(ret_var);
2135         return ret_arr;
2136 }
2137
2138 static inline struct LDKWriteableEcdsaChannelSigner CResult_WriteableEcdsaChannelSignerDecodeErrorZ_get_ok(LDKCResult_WriteableEcdsaChannelSignerDecodeErrorZ *NONNULL_PTR owner){
2139 CHECK(owner->result_ok);
2140         return WriteableEcdsaChannelSigner_clone(&*owner->contents.result);
2141 }
2142 uint64_t  __attribute__((export_name("TS_CResult_WriteableEcdsaChannelSignerDecodeErrorZ_get_ok"))) TS_CResult_WriteableEcdsaChannelSignerDecodeErrorZ_get_ok(uint64_t owner) {
2143         LDKCResult_WriteableEcdsaChannelSignerDecodeErrorZ* owner_conv = (LDKCResult_WriteableEcdsaChannelSignerDecodeErrorZ*)untag_ptr(owner);
2144         LDKWriteableEcdsaChannelSigner* ret_ret = MALLOC(sizeof(LDKWriteableEcdsaChannelSigner), "LDKWriteableEcdsaChannelSigner");
2145         *ret_ret = CResult_WriteableEcdsaChannelSignerDecodeErrorZ_get_ok(owner_conv);
2146         return tag_ptr(ret_ret, true);
2147 }
2148
2149 static inline struct LDKDecodeError CResult_WriteableEcdsaChannelSignerDecodeErrorZ_get_err(LDKCResult_WriteableEcdsaChannelSignerDecodeErrorZ *NONNULL_PTR owner){
2150 CHECK(!owner->result_ok);
2151         return DecodeError_clone(&*owner->contents.err);
2152 }
2153 uint64_t  __attribute__((export_name("TS_CResult_WriteableEcdsaChannelSignerDecodeErrorZ_get_err"))) TS_CResult_WriteableEcdsaChannelSignerDecodeErrorZ_get_err(uint64_t owner) {
2154         LDKCResult_WriteableEcdsaChannelSignerDecodeErrorZ* owner_conv = (LDKCResult_WriteableEcdsaChannelSignerDecodeErrorZ*)untag_ptr(owner);
2155         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
2156         *ret_copy = CResult_WriteableEcdsaChannelSignerDecodeErrorZ_get_err(owner_conv);
2157         uint64_t ret_ref = tag_ptr(ret_copy, true);
2158         return ret_ref;
2159 }
2160
2161 static inline struct LDKCVec_u8Z CResult_CVec_u8ZNoneZ_get_ok(LDKCResult_CVec_u8ZNoneZ *NONNULL_PTR owner){
2162 CHECK(owner->result_ok);
2163         return CVec_u8Z_clone(&*owner->contents.result);
2164 }
2165 int8_tArray  __attribute__((export_name("TS_CResult_CVec_u8ZNoneZ_get_ok"))) TS_CResult_CVec_u8ZNoneZ_get_ok(uint64_t owner) {
2166         LDKCResult_CVec_u8ZNoneZ* owner_conv = (LDKCResult_CVec_u8ZNoneZ*)untag_ptr(owner);
2167         LDKCVec_u8Z ret_var = CResult_CVec_u8ZNoneZ_get_ok(owner_conv);
2168         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
2169         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
2170         CVec_u8Z_free(ret_var);
2171         return ret_arr;
2172 }
2173
2174 static inline void CResult_CVec_u8ZNoneZ_get_err(LDKCResult_CVec_u8ZNoneZ *NONNULL_PTR owner){
2175 CHECK(!owner->result_ok);
2176         return *owner->contents.err;
2177 }
2178 void  __attribute__((export_name("TS_CResult_CVec_u8ZNoneZ_get_err"))) TS_CResult_CVec_u8ZNoneZ_get_err(uint64_t owner) {
2179         LDKCResult_CVec_u8ZNoneZ* owner_conv = (LDKCResult_CVec_u8ZNoneZ*)untag_ptr(owner);
2180         CResult_CVec_u8ZNoneZ_get_err(owner_conv);
2181 }
2182
2183 static inline struct LDKShutdownScript CResult_ShutdownScriptNoneZ_get_ok(LDKCResult_ShutdownScriptNoneZ *NONNULL_PTR owner){
2184         LDKShutdownScript ret = *owner->contents.result;
2185         ret.is_owned = false;
2186         return ret;
2187 }
2188 uint64_t  __attribute__((export_name("TS_CResult_ShutdownScriptNoneZ_get_ok"))) TS_CResult_ShutdownScriptNoneZ_get_ok(uint64_t owner) {
2189         LDKCResult_ShutdownScriptNoneZ* owner_conv = (LDKCResult_ShutdownScriptNoneZ*)untag_ptr(owner);
2190         LDKShutdownScript ret_var = CResult_ShutdownScriptNoneZ_get_ok(owner_conv);
2191         uint64_t ret_ref = 0;
2192         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
2193         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
2194         return ret_ref;
2195 }
2196
2197 static inline void CResult_ShutdownScriptNoneZ_get_err(LDKCResult_ShutdownScriptNoneZ *NONNULL_PTR owner){
2198 CHECK(!owner->result_ok);
2199         return *owner->contents.err;
2200 }
2201 void  __attribute__((export_name("TS_CResult_ShutdownScriptNoneZ_get_err"))) TS_CResult_ShutdownScriptNoneZ_get_err(uint64_t owner) {
2202         LDKCResult_ShutdownScriptNoneZ* owner_conv = (LDKCResult_ShutdownScriptNoneZ*)untag_ptr(owner);
2203         CResult_ShutdownScriptNoneZ_get_err(owner_conv);
2204 }
2205
2206 uint32_t __attribute__((export_name("TS_LDKCOption_u16Z_ty_from_ptr"))) TS_LDKCOption_u16Z_ty_from_ptr(uint64_t ptr) {
2207         LDKCOption_u16Z *obj = (LDKCOption_u16Z*)untag_ptr(ptr);
2208         switch(obj->tag) {
2209                 case LDKCOption_u16Z_Some: return 0;
2210                 case LDKCOption_u16Z_None: return 1;
2211                 default: abort();
2212         }
2213 }
2214 int16_t __attribute__((export_name("TS_LDKCOption_u16Z_Some_get_some"))) TS_LDKCOption_u16Z_Some_get_some(uint64_t ptr) {
2215         LDKCOption_u16Z *obj = (LDKCOption_u16Z*)untag_ptr(ptr);
2216         assert(obj->tag == LDKCOption_u16Z_Some);
2217         int16_t some_conv = obj->some;
2218         return some_conv;
2219 }
2220 uint32_t __attribute__((export_name("TS_LDKCOption_boolZ_ty_from_ptr"))) TS_LDKCOption_boolZ_ty_from_ptr(uint64_t ptr) {
2221         LDKCOption_boolZ *obj = (LDKCOption_boolZ*)untag_ptr(ptr);
2222         switch(obj->tag) {
2223                 case LDKCOption_boolZ_Some: return 0;
2224                 case LDKCOption_boolZ_None: return 1;
2225                 default: abort();
2226         }
2227 }
2228 jboolean __attribute__((export_name("TS_LDKCOption_boolZ_Some_get_some"))) TS_LDKCOption_boolZ_Some_get_some(uint64_t ptr) {
2229         LDKCOption_boolZ *obj = (LDKCOption_boolZ*)untag_ptr(ptr);
2230         assert(obj->tag == LDKCOption_boolZ_Some);
2231         jboolean some_conv = obj->some;
2232         return some_conv;
2233 }
2234 static inline LDKCVec_CVec_u8ZZ CVec_CVec_u8ZZ_clone(const LDKCVec_CVec_u8ZZ *orig) {
2235         LDKCVec_CVec_u8ZZ ret = { .data = MALLOC(sizeof(LDKCVec_u8Z) * orig->datalen, "LDKCVec_CVec_u8ZZ clone bytes"), .datalen = orig->datalen };
2236         for (size_t i = 0; i < ret.datalen; i++) {
2237                 ret.data[i] = CVec_u8Z_clone(&orig->data[i]);
2238         }
2239         return ret;
2240 }
2241 static inline struct LDKCVec_CVec_u8ZZ CResult_CVec_CVec_u8ZZNoneZ_get_ok(LDKCResult_CVec_CVec_u8ZZNoneZ *NONNULL_PTR owner){
2242 CHECK(owner->result_ok);
2243         return CVec_CVec_u8ZZ_clone(&*owner->contents.result);
2244 }
2245 ptrArray  __attribute__((export_name("TS_CResult_CVec_CVec_u8ZZNoneZ_get_ok"))) TS_CResult_CVec_CVec_u8ZZNoneZ_get_ok(uint64_t owner) {
2246         LDKCResult_CVec_CVec_u8ZZNoneZ* owner_conv = (LDKCResult_CVec_CVec_u8ZZNoneZ*)untag_ptr(owner);
2247         LDKCVec_CVec_u8ZZ ret_var = CResult_CVec_CVec_u8ZZNoneZ_get_ok(owner_conv);
2248         ptrArray ret_arr = NULL;
2249         ret_arr = init_ptrArray(ret_var.datalen, __LINE__);
2250         int8_tArray *ret_arr_ptr = (int8_tArray*)(((uint8_t*)ret_arr) + 8);
2251         for (size_t m = 0; m < ret_var.datalen; m++) {
2252                 LDKCVec_u8Z ret_conv_12_var = ret_var.data[m];
2253                 int8_tArray ret_conv_12_arr = init_int8_tArray(ret_conv_12_var.datalen, __LINE__);
2254                 memcpy(ret_conv_12_arr->elems, ret_conv_12_var.data, ret_conv_12_var.datalen);
2255                 CVec_u8Z_free(ret_conv_12_var);
2256                 ret_arr_ptr[m] = ret_conv_12_arr;
2257         }
2258         
2259         FREE(ret_var.data);
2260         return ret_arr;
2261 }
2262
2263 static inline void CResult_CVec_CVec_u8ZZNoneZ_get_err(LDKCResult_CVec_CVec_u8ZZNoneZ *NONNULL_PTR owner){
2264 CHECK(!owner->result_ok);
2265         return *owner->contents.err;
2266 }
2267 void  __attribute__((export_name("TS_CResult_CVec_CVec_u8ZZNoneZ_get_err"))) TS_CResult_CVec_CVec_u8ZZNoneZ_get_err(uint64_t owner) {
2268         LDKCResult_CVec_CVec_u8ZZNoneZ* owner_conv = (LDKCResult_CVec_CVec_u8ZZNoneZ*)untag_ptr(owner);
2269         CResult_CVec_CVec_u8ZZNoneZ_get_err(owner_conv);
2270 }
2271
2272 static inline struct LDKInMemorySigner CResult_InMemorySignerDecodeErrorZ_get_ok(LDKCResult_InMemorySignerDecodeErrorZ *NONNULL_PTR owner){
2273         LDKInMemorySigner ret = *owner->contents.result;
2274         ret.is_owned = false;
2275         return ret;
2276 }
2277 uint64_t  __attribute__((export_name("TS_CResult_InMemorySignerDecodeErrorZ_get_ok"))) TS_CResult_InMemorySignerDecodeErrorZ_get_ok(uint64_t owner) {
2278         LDKCResult_InMemorySignerDecodeErrorZ* owner_conv = (LDKCResult_InMemorySignerDecodeErrorZ*)untag_ptr(owner);
2279         LDKInMemorySigner ret_var = CResult_InMemorySignerDecodeErrorZ_get_ok(owner_conv);
2280         uint64_t ret_ref = 0;
2281         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
2282         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
2283         return ret_ref;
2284 }
2285
2286 static inline struct LDKDecodeError CResult_InMemorySignerDecodeErrorZ_get_err(LDKCResult_InMemorySignerDecodeErrorZ *NONNULL_PTR owner){
2287 CHECK(!owner->result_ok);
2288         return DecodeError_clone(&*owner->contents.err);
2289 }
2290 uint64_t  __attribute__((export_name("TS_CResult_InMemorySignerDecodeErrorZ_get_err"))) TS_CResult_InMemorySignerDecodeErrorZ_get_err(uint64_t owner) {
2291         LDKCResult_InMemorySignerDecodeErrorZ* owner_conv = (LDKCResult_InMemorySignerDecodeErrorZ*)untag_ptr(owner);
2292         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
2293         *ret_copy = CResult_InMemorySignerDecodeErrorZ_get_err(owner_conv);
2294         uint64_t ret_ref = tag_ptr(ret_copy, true);
2295         return ret_ref;
2296 }
2297
2298 static inline struct LDKTransaction CResult_TransactionNoneZ_get_ok(LDKCResult_TransactionNoneZ *NONNULL_PTR owner){
2299 CHECK(owner->result_ok);
2300         return *owner->contents.result;
2301 }
2302 int8_tArray  __attribute__((export_name("TS_CResult_TransactionNoneZ_get_ok"))) TS_CResult_TransactionNoneZ_get_ok(uint64_t owner) {
2303         LDKCResult_TransactionNoneZ* owner_conv = (LDKCResult_TransactionNoneZ*)untag_ptr(owner);
2304         LDKTransaction ret_var = CResult_TransactionNoneZ_get_ok(owner_conv);
2305         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
2306         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
2307         return ret_arr;
2308 }
2309
2310 static inline void CResult_TransactionNoneZ_get_err(LDKCResult_TransactionNoneZ *NONNULL_PTR owner){
2311 CHECK(!owner->result_ok);
2312         return *owner->contents.err;
2313 }
2314 void  __attribute__((export_name("TS_CResult_TransactionNoneZ_get_err"))) TS_CResult_TransactionNoneZ_get_err(uint64_t owner) {
2315         LDKCResult_TransactionNoneZ* owner_conv = (LDKCResult_TransactionNoneZ*)untag_ptr(owner);
2316         CResult_TransactionNoneZ_get_err(owner_conv);
2317 }
2318
2319 static inline LDKCVec_ChannelDetailsZ CVec_ChannelDetailsZ_clone(const LDKCVec_ChannelDetailsZ *orig) {
2320         LDKCVec_ChannelDetailsZ ret = { .data = MALLOC(sizeof(LDKChannelDetails) * orig->datalen, "LDKCVec_ChannelDetailsZ clone bytes"), .datalen = orig->datalen };
2321         for (size_t i = 0; i < ret.datalen; i++) {
2322                 ret.data[i] = ChannelDetails_clone(&orig->data[i]);
2323         }
2324         return ret;
2325 }
2326 static inline struct LDKRoute CResult_RouteLightningErrorZ_get_ok(LDKCResult_RouteLightningErrorZ *NONNULL_PTR owner){
2327         LDKRoute ret = *owner->contents.result;
2328         ret.is_owned = false;
2329         return ret;
2330 }
2331 uint64_t  __attribute__((export_name("TS_CResult_RouteLightningErrorZ_get_ok"))) TS_CResult_RouteLightningErrorZ_get_ok(uint64_t owner) {
2332         LDKCResult_RouteLightningErrorZ* owner_conv = (LDKCResult_RouteLightningErrorZ*)untag_ptr(owner);
2333         LDKRoute ret_var = CResult_RouteLightningErrorZ_get_ok(owner_conv);
2334         uint64_t ret_ref = 0;
2335         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
2336         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
2337         return ret_ref;
2338 }
2339
2340 static inline struct LDKLightningError CResult_RouteLightningErrorZ_get_err(LDKCResult_RouteLightningErrorZ *NONNULL_PTR owner){
2341         LDKLightningError ret = *owner->contents.err;
2342         ret.is_owned = false;
2343         return ret;
2344 }
2345 uint64_t  __attribute__((export_name("TS_CResult_RouteLightningErrorZ_get_err"))) TS_CResult_RouteLightningErrorZ_get_err(uint64_t owner) {
2346         LDKCResult_RouteLightningErrorZ* owner_conv = (LDKCResult_RouteLightningErrorZ*)untag_ptr(owner);
2347         LDKLightningError ret_var = CResult_RouteLightningErrorZ_get_err(owner_conv);
2348         uint64_t ret_ref = 0;
2349         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
2350         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
2351         return ret_ref;
2352 }
2353
2354 static inline struct LDKInFlightHtlcs CResult_InFlightHtlcsDecodeErrorZ_get_ok(LDKCResult_InFlightHtlcsDecodeErrorZ *NONNULL_PTR owner){
2355         LDKInFlightHtlcs ret = *owner->contents.result;
2356         ret.is_owned = false;
2357         return ret;
2358 }
2359 uint64_t  __attribute__((export_name("TS_CResult_InFlightHtlcsDecodeErrorZ_get_ok"))) TS_CResult_InFlightHtlcsDecodeErrorZ_get_ok(uint64_t owner) {
2360         LDKCResult_InFlightHtlcsDecodeErrorZ* owner_conv = (LDKCResult_InFlightHtlcsDecodeErrorZ*)untag_ptr(owner);
2361         LDKInFlightHtlcs ret_var = CResult_InFlightHtlcsDecodeErrorZ_get_ok(owner_conv);
2362         uint64_t ret_ref = 0;
2363         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
2364         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
2365         return ret_ref;
2366 }
2367
2368 static inline struct LDKDecodeError CResult_InFlightHtlcsDecodeErrorZ_get_err(LDKCResult_InFlightHtlcsDecodeErrorZ *NONNULL_PTR owner){
2369 CHECK(!owner->result_ok);
2370         return DecodeError_clone(&*owner->contents.err);
2371 }
2372 uint64_t  __attribute__((export_name("TS_CResult_InFlightHtlcsDecodeErrorZ_get_err"))) TS_CResult_InFlightHtlcsDecodeErrorZ_get_err(uint64_t owner) {
2373         LDKCResult_InFlightHtlcsDecodeErrorZ* owner_conv = (LDKCResult_InFlightHtlcsDecodeErrorZ*)untag_ptr(owner);
2374         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
2375         *ret_copy = CResult_InFlightHtlcsDecodeErrorZ_get_err(owner_conv);
2376         uint64_t ret_ref = tag_ptr(ret_copy, true);
2377         return ret_ref;
2378 }
2379
2380 static inline struct LDKRouteHop CResult_RouteHopDecodeErrorZ_get_ok(LDKCResult_RouteHopDecodeErrorZ *NONNULL_PTR owner){
2381         LDKRouteHop ret = *owner->contents.result;
2382         ret.is_owned = false;
2383         return ret;
2384 }
2385 uint64_t  __attribute__((export_name("TS_CResult_RouteHopDecodeErrorZ_get_ok"))) TS_CResult_RouteHopDecodeErrorZ_get_ok(uint64_t owner) {
2386         LDKCResult_RouteHopDecodeErrorZ* owner_conv = (LDKCResult_RouteHopDecodeErrorZ*)untag_ptr(owner);
2387         LDKRouteHop ret_var = CResult_RouteHopDecodeErrorZ_get_ok(owner_conv);
2388         uint64_t ret_ref = 0;
2389         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
2390         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
2391         return ret_ref;
2392 }
2393
2394 static inline struct LDKDecodeError CResult_RouteHopDecodeErrorZ_get_err(LDKCResult_RouteHopDecodeErrorZ *NONNULL_PTR owner){
2395 CHECK(!owner->result_ok);
2396         return DecodeError_clone(&*owner->contents.err);
2397 }
2398 uint64_t  __attribute__((export_name("TS_CResult_RouteHopDecodeErrorZ_get_err"))) TS_CResult_RouteHopDecodeErrorZ_get_err(uint64_t owner) {
2399         LDKCResult_RouteHopDecodeErrorZ* owner_conv = (LDKCResult_RouteHopDecodeErrorZ*)untag_ptr(owner);
2400         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
2401         *ret_copy = CResult_RouteHopDecodeErrorZ_get_err(owner_conv);
2402         uint64_t ret_ref = tag_ptr(ret_copy, true);
2403         return ret_ref;
2404 }
2405
2406 static inline LDKCVec_BlindedHopZ CVec_BlindedHopZ_clone(const LDKCVec_BlindedHopZ *orig) {
2407         LDKCVec_BlindedHopZ ret = { .data = MALLOC(sizeof(LDKBlindedHop) * orig->datalen, "LDKCVec_BlindedHopZ clone bytes"), .datalen = orig->datalen };
2408         for (size_t i = 0; i < ret.datalen; i++) {
2409                 ret.data[i] = BlindedHop_clone(&orig->data[i]);
2410         }
2411         return ret;
2412 }
2413 static inline struct LDKBlindedTail CResult_BlindedTailDecodeErrorZ_get_ok(LDKCResult_BlindedTailDecodeErrorZ *NONNULL_PTR owner){
2414         LDKBlindedTail ret = *owner->contents.result;
2415         ret.is_owned = false;
2416         return ret;
2417 }
2418 uint64_t  __attribute__((export_name("TS_CResult_BlindedTailDecodeErrorZ_get_ok"))) TS_CResult_BlindedTailDecodeErrorZ_get_ok(uint64_t owner) {
2419         LDKCResult_BlindedTailDecodeErrorZ* owner_conv = (LDKCResult_BlindedTailDecodeErrorZ*)untag_ptr(owner);
2420         LDKBlindedTail ret_var = CResult_BlindedTailDecodeErrorZ_get_ok(owner_conv);
2421         uint64_t ret_ref = 0;
2422         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
2423         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
2424         return ret_ref;
2425 }
2426
2427 static inline struct LDKDecodeError CResult_BlindedTailDecodeErrorZ_get_err(LDKCResult_BlindedTailDecodeErrorZ *NONNULL_PTR owner){
2428 CHECK(!owner->result_ok);
2429         return DecodeError_clone(&*owner->contents.err);
2430 }
2431 uint64_t  __attribute__((export_name("TS_CResult_BlindedTailDecodeErrorZ_get_err"))) TS_CResult_BlindedTailDecodeErrorZ_get_err(uint64_t owner) {
2432         LDKCResult_BlindedTailDecodeErrorZ* owner_conv = (LDKCResult_BlindedTailDecodeErrorZ*)untag_ptr(owner);
2433         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
2434         *ret_copy = CResult_BlindedTailDecodeErrorZ_get_err(owner_conv);
2435         uint64_t ret_ref = tag_ptr(ret_copy, true);
2436         return ret_ref;
2437 }
2438
2439 static inline LDKCVec_RouteHopZ CVec_RouteHopZ_clone(const LDKCVec_RouteHopZ *orig) {
2440         LDKCVec_RouteHopZ ret = { .data = MALLOC(sizeof(LDKRouteHop) * orig->datalen, "LDKCVec_RouteHopZ clone bytes"), .datalen = orig->datalen };
2441         for (size_t i = 0; i < ret.datalen; i++) {
2442                 ret.data[i] = RouteHop_clone(&orig->data[i]);
2443         }
2444         return ret;
2445 }
2446 static inline LDKCVec_PathZ CVec_PathZ_clone(const LDKCVec_PathZ *orig) {
2447         LDKCVec_PathZ ret = { .data = MALLOC(sizeof(LDKPath) * orig->datalen, "LDKCVec_PathZ clone bytes"), .datalen = orig->datalen };
2448         for (size_t i = 0; i < ret.datalen; i++) {
2449                 ret.data[i] = Path_clone(&orig->data[i]);
2450         }
2451         return ret;
2452 }
2453 static inline struct LDKRoute CResult_RouteDecodeErrorZ_get_ok(LDKCResult_RouteDecodeErrorZ *NONNULL_PTR owner){
2454         LDKRoute ret = *owner->contents.result;
2455         ret.is_owned = false;
2456         return ret;
2457 }
2458 uint64_t  __attribute__((export_name("TS_CResult_RouteDecodeErrorZ_get_ok"))) TS_CResult_RouteDecodeErrorZ_get_ok(uint64_t owner) {
2459         LDKCResult_RouteDecodeErrorZ* owner_conv = (LDKCResult_RouteDecodeErrorZ*)untag_ptr(owner);
2460         LDKRoute ret_var = CResult_RouteDecodeErrorZ_get_ok(owner_conv);
2461         uint64_t ret_ref = 0;
2462         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
2463         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
2464         return ret_ref;
2465 }
2466
2467 static inline struct LDKDecodeError CResult_RouteDecodeErrorZ_get_err(LDKCResult_RouteDecodeErrorZ *NONNULL_PTR owner){
2468 CHECK(!owner->result_ok);
2469         return DecodeError_clone(&*owner->contents.err);
2470 }
2471 uint64_t  __attribute__((export_name("TS_CResult_RouteDecodeErrorZ_get_err"))) TS_CResult_RouteDecodeErrorZ_get_err(uint64_t owner) {
2472         LDKCResult_RouteDecodeErrorZ* owner_conv = (LDKCResult_RouteDecodeErrorZ*)untag_ptr(owner);
2473         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
2474         *ret_copy = CResult_RouteDecodeErrorZ_get_err(owner_conv);
2475         uint64_t ret_ref = tag_ptr(ret_copy, true);
2476         return ret_ref;
2477 }
2478
2479 static inline struct LDKRouteParameters CResult_RouteParametersDecodeErrorZ_get_ok(LDKCResult_RouteParametersDecodeErrorZ *NONNULL_PTR owner){
2480         LDKRouteParameters ret = *owner->contents.result;
2481         ret.is_owned = false;
2482         return ret;
2483 }
2484 uint64_t  __attribute__((export_name("TS_CResult_RouteParametersDecodeErrorZ_get_ok"))) TS_CResult_RouteParametersDecodeErrorZ_get_ok(uint64_t owner) {
2485         LDKCResult_RouteParametersDecodeErrorZ* owner_conv = (LDKCResult_RouteParametersDecodeErrorZ*)untag_ptr(owner);
2486         LDKRouteParameters ret_var = CResult_RouteParametersDecodeErrorZ_get_ok(owner_conv);
2487         uint64_t ret_ref = 0;
2488         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
2489         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
2490         return ret_ref;
2491 }
2492
2493 static inline struct LDKDecodeError CResult_RouteParametersDecodeErrorZ_get_err(LDKCResult_RouteParametersDecodeErrorZ *NONNULL_PTR owner){
2494 CHECK(!owner->result_ok);
2495         return DecodeError_clone(&*owner->contents.err);
2496 }
2497 uint64_t  __attribute__((export_name("TS_CResult_RouteParametersDecodeErrorZ_get_err"))) TS_CResult_RouteParametersDecodeErrorZ_get_err(uint64_t owner) {
2498         LDKCResult_RouteParametersDecodeErrorZ* owner_conv = (LDKCResult_RouteParametersDecodeErrorZ*)untag_ptr(owner);
2499         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
2500         *ret_copy = CResult_RouteParametersDecodeErrorZ_get_err(owner_conv);
2501         uint64_t ret_ref = tag_ptr(ret_copy, true);
2502         return ret_ref;
2503 }
2504
2505 static inline LDKCVec_u64Z CVec_u64Z_clone(const LDKCVec_u64Z *orig) {
2506         LDKCVec_u64Z ret = { .data = MALLOC(sizeof(int64_t) * orig->datalen, "LDKCVec_u64Z clone bytes"), .datalen = orig->datalen };
2507         memcpy(ret.data, orig->data, sizeof(int64_t) * ret.datalen);
2508         return ret;
2509 }
2510 static inline struct LDKPaymentParameters CResult_PaymentParametersDecodeErrorZ_get_ok(LDKCResult_PaymentParametersDecodeErrorZ *NONNULL_PTR owner){
2511         LDKPaymentParameters ret = *owner->contents.result;
2512         ret.is_owned = false;
2513         return ret;
2514 }
2515 uint64_t  __attribute__((export_name("TS_CResult_PaymentParametersDecodeErrorZ_get_ok"))) TS_CResult_PaymentParametersDecodeErrorZ_get_ok(uint64_t owner) {
2516         LDKCResult_PaymentParametersDecodeErrorZ* owner_conv = (LDKCResult_PaymentParametersDecodeErrorZ*)untag_ptr(owner);
2517         LDKPaymentParameters ret_var = CResult_PaymentParametersDecodeErrorZ_get_ok(owner_conv);
2518         uint64_t ret_ref = 0;
2519         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
2520         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
2521         return ret_ref;
2522 }
2523
2524 static inline struct LDKDecodeError CResult_PaymentParametersDecodeErrorZ_get_err(LDKCResult_PaymentParametersDecodeErrorZ *NONNULL_PTR owner){
2525 CHECK(!owner->result_ok);
2526         return DecodeError_clone(&*owner->contents.err);
2527 }
2528 uint64_t  __attribute__((export_name("TS_CResult_PaymentParametersDecodeErrorZ_get_err"))) TS_CResult_PaymentParametersDecodeErrorZ_get_err(uint64_t owner) {
2529         LDKCResult_PaymentParametersDecodeErrorZ* owner_conv = (LDKCResult_PaymentParametersDecodeErrorZ*)untag_ptr(owner);
2530         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
2531         *ret_copy = CResult_PaymentParametersDecodeErrorZ_get_err(owner_conv);
2532         uint64_t ret_ref = tag_ptr(ret_copy, true);
2533         return ret_ref;
2534 }
2535
2536 static inline struct LDKBlindedPayInfo C2Tuple_BlindedPayInfoBlindedPathZ_get_a(LDKC2Tuple_BlindedPayInfoBlindedPathZ *NONNULL_PTR owner){
2537         LDKBlindedPayInfo ret = owner->a;
2538         ret.is_owned = false;
2539         return ret;
2540 }
2541 uint64_t  __attribute__((export_name("TS_C2Tuple_BlindedPayInfoBlindedPathZ_get_a"))) TS_C2Tuple_BlindedPayInfoBlindedPathZ_get_a(uint64_t owner) {
2542         LDKC2Tuple_BlindedPayInfoBlindedPathZ* owner_conv = (LDKC2Tuple_BlindedPayInfoBlindedPathZ*)untag_ptr(owner);
2543         LDKBlindedPayInfo ret_var = C2Tuple_BlindedPayInfoBlindedPathZ_get_a(owner_conv);
2544         uint64_t ret_ref = 0;
2545         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
2546         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
2547         return ret_ref;
2548 }
2549
2550 static inline struct LDKBlindedPath C2Tuple_BlindedPayInfoBlindedPathZ_get_b(LDKC2Tuple_BlindedPayInfoBlindedPathZ *NONNULL_PTR owner){
2551         LDKBlindedPath ret = owner->b;
2552         ret.is_owned = false;
2553         return ret;
2554 }
2555 uint64_t  __attribute__((export_name("TS_C2Tuple_BlindedPayInfoBlindedPathZ_get_b"))) TS_C2Tuple_BlindedPayInfoBlindedPathZ_get_b(uint64_t owner) {
2556         LDKC2Tuple_BlindedPayInfoBlindedPathZ* owner_conv = (LDKC2Tuple_BlindedPayInfoBlindedPathZ*)untag_ptr(owner);
2557         LDKBlindedPath ret_var = C2Tuple_BlindedPayInfoBlindedPathZ_get_b(owner_conv);
2558         uint64_t ret_ref = 0;
2559         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
2560         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
2561         return ret_ref;
2562 }
2563
2564 static inline LDKCVec_C2Tuple_BlindedPayInfoBlindedPathZZ CVec_C2Tuple_BlindedPayInfoBlindedPathZZ_clone(const LDKCVec_C2Tuple_BlindedPayInfoBlindedPathZZ *orig) {
2565         LDKCVec_C2Tuple_BlindedPayInfoBlindedPathZZ ret = { .data = MALLOC(sizeof(LDKC2Tuple_BlindedPayInfoBlindedPathZ) * orig->datalen, "LDKCVec_C2Tuple_BlindedPayInfoBlindedPathZZ clone bytes"), .datalen = orig->datalen };
2566         for (size_t i = 0; i < ret.datalen; i++) {
2567                 ret.data[i] = C2Tuple_BlindedPayInfoBlindedPathZ_clone(&orig->data[i]);
2568         }
2569         return ret;
2570 }
2571 static inline LDKCVec_RouteHintZ CVec_RouteHintZ_clone(const LDKCVec_RouteHintZ *orig) {
2572         LDKCVec_RouteHintZ ret = { .data = MALLOC(sizeof(LDKRouteHint) * orig->datalen, "LDKCVec_RouteHintZ clone bytes"), .datalen = orig->datalen };
2573         for (size_t i = 0; i < ret.datalen; i++) {
2574                 ret.data[i] = RouteHint_clone(&orig->data[i]);
2575         }
2576         return ret;
2577 }
2578 static inline LDKCVec_RouteHintHopZ CVec_RouteHintHopZ_clone(const LDKCVec_RouteHintHopZ *orig) {
2579         LDKCVec_RouteHintHopZ ret = { .data = MALLOC(sizeof(LDKRouteHintHop) * orig->datalen, "LDKCVec_RouteHintHopZ clone bytes"), .datalen = orig->datalen };
2580         for (size_t i = 0; i < ret.datalen; i++) {
2581                 ret.data[i] = RouteHintHop_clone(&orig->data[i]);
2582         }
2583         return ret;
2584 }
2585 static inline struct LDKRouteHint CResult_RouteHintDecodeErrorZ_get_ok(LDKCResult_RouteHintDecodeErrorZ *NONNULL_PTR owner){
2586         LDKRouteHint ret = *owner->contents.result;
2587         ret.is_owned = false;
2588         return ret;
2589 }
2590 uint64_t  __attribute__((export_name("TS_CResult_RouteHintDecodeErrorZ_get_ok"))) TS_CResult_RouteHintDecodeErrorZ_get_ok(uint64_t owner) {
2591         LDKCResult_RouteHintDecodeErrorZ* owner_conv = (LDKCResult_RouteHintDecodeErrorZ*)untag_ptr(owner);
2592         LDKRouteHint ret_var = CResult_RouteHintDecodeErrorZ_get_ok(owner_conv);
2593         uint64_t ret_ref = 0;
2594         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
2595         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
2596         return ret_ref;
2597 }
2598
2599 static inline struct LDKDecodeError CResult_RouteHintDecodeErrorZ_get_err(LDKCResult_RouteHintDecodeErrorZ *NONNULL_PTR owner){
2600 CHECK(!owner->result_ok);
2601         return DecodeError_clone(&*owner->contents.err);
2602 }
2603 uint64_t  __attribute__((export_name("TS_CResult_RouteHintDecodeErrorZ_get_err"))) TS_CResult_RouteHintDecodeErrorZ_get_err(uint64_t owner) {
2604         LDKCResult_RouteHintDecodeErrorZ* owner_conv = (LDKCResult_RouteHintDecodeErrorZ*)untag_ptr(owner);
2605         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
2606         *ret_copy = CResult_RouteHintDecodeErrorZ_get_err(owner_conv);
2607         uint64_t ret_ref = tag_ptr(ret_copy, true);
2608         return ret_ref;
2609 }
2610
2611 static inline struct LDKRouteHintHop CResult_RouteHintHopDecodeErrorZ_get_ok(LDKCResult_RouteHintHopDecodeErrorZ *NONNULL_PTR owner){
2612         LDKRouteHintHop ret = *owner->contents.result;
2613         ret.is_owned = false;
2614         return ret;
2615 }
2616 uint64_t  __attribute__((export_name("TS_CResult_RouteHintHopDecodeErrorZ_get_ok"))) TS_CResult_RouteHintHopDecodeErrorZ_get_ok(uint64_t owner) {
2617         LDKCResult_RouteHintHopDecodeErrorZ* owner_conv = (LDKCResult_RouteHintHopDecodeErrorZ*)untag_ptr(owner);
2618         LDKRouteHintHop ret_var = CResult_RouteHintHopDecodeErrorZ_get_ok(owner_conv);
2619         uint64_t ret_ref = 0;
2620         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
2621         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
2622         return ret_ref;
2623 }
2624
2625 static inline struct LDKDecodeError CResult_RouteHintHopDecodeErrorZ_get_err(LDKCResult_RouteHintHopDecodeErrorZ *NONNULL_PTR owner){
2626 CHECK(!owner->result_ok);
2627         return DecodeError_clone(&*owner->contents.err);
2628 }
2629 uint64_t  __attribute__((export_name("TS_CResult_RouteHintHopDecodeErrorZ_get_err"))) TS_CResult_RouteHintHopDecodeErrorZ_get_err(uint64_t owner) {
2630         LDKCResult_RouteHintHopDecodeErrorZ* owner_conv = (LDKCResult_RouteHintHopDecodeErrorZ*)untag_ptr(owner);
2631         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
2632         *ret_copy = CResult_RouteHintHopDecodeErrorZ_get_err(owner_conv);
2633         uint64_t ret_ref = tag_ptr(ret_copy, true);
2634         return ret_ref;
2635 }
2636
2637 static inline struct LDKFixedPenaltyScorer CResult_FixedPenaltyScorerDecodeErrorZ_get_ok(LDKCResult_FixedPenaltyScorerDecodeErrorZ *NONNULL_PTR owner){
2638         LDKFixedPenaltyScorer ret = *owner->contents.result;
2639         ret.is_owned = false;
2640         return ret;
2641 }
2642 uint64_t  __attribute__((export_name("TS_CResult_FixedPenaltyScorerDecodeErrorZ_get_ok"))) TS_CResult_FixedPenaltyScorerDecodeErrorZ_get_ok(uint64_t owner) {
2643         LDKCResult_FixedPenaltyScorerDecodeErrorZ* owner_conv = (LDKCResult_FixedPenaltyScorerDecodeErrorZ*)untag_ptr(owner);
2644         LDKFixedPenaltyScorer ret_var = CResult_FixedPenaltyScorerDecodeErrorZ_get_ok(owner_conv);
2645         uint64_t ret_ref = 0;
2646         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
2647         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
2648         return ret_ref;
2649 }
2650
2651 static inline struct LDKDecodeError CResult_FixedPenaltyScorerDecodeErrorZ_get_err(LDKCResult_FixedPenaltyScorerDecodeErrorZ *NONNULL_PTR owner){
2652 CHECK(!owner->result_ok);
2653         return DecodeError_clone(&*owner->contents.err);
2654 }
2655 uint64_t  __attribute__((export_name("TS_CResult_FixedPenaltyScorerDecodeErrorZ_get_err"))) TS_CResult_FixedPenaltyScorerDecodeErrorZ_get_err(uint64_t owner) {
2656         LDKCResult_FixedPenaltyScorerDecodeErrorZ* owner_conv = (LDKCResult_FixedPenaltyScorerDecodeErrorZ*)untag_ptr(owner);
2657         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
2658         *ret_copy = CResult_FixedPenaltyScorerDecodeErrorZ_get_err(owner_conv);
2659         uint64_t ret_ref = tag_ptr(ret_copy, true);
2660         return ret_ref;
2661 }
2662
2663 static inline LDKCVec_NodeIdZ CVec_NodeIdZ_clone(const LDKCVec_NodeIdZ *orig) {
2664         LDKCVec_NodeIdZ ret = { .data = MALLOC(sizeof(LDKNodeId) * orig->datalen, "LDKCVec_NodeIdZ clone bytes"), .datalen = orig->datalen };
2665         for (size_t i = 0; i < ret.datalen; i++) {
2666                 ret.data[i] = NodeId_clone(&orig->data[i]);
2667         }
2668         return ret;
2669 }
2670 static inline uint64_t C2Tuple_u64u64Z_get_a(LDKC2Tuple_u64u64Z *NONNULL_PTR owner){
2671         return owner->a;
2672 }
2673 int64_t  __attribute__((export_name("TS_C2Tuple_u64u64Z_get_a"))) TS_C2Tuple_u64u64Z_get_a(uint64_t owner) {
2674         LDKC2Tuple_u64u64Z* owner_conv = (LDKC2Tuple_u64u64Z*)untag_ptr(owner);
2675         int64_t ret_conv = C2Tuple_u64u64Z_get_a(owner_conv);
2676         return ret_conv;
2677 }
2678
2679 static inline uint64_t C2Tuple_u64u64Z_get_b(LDKC2Tuple_u64u64Z *NONNULL_PTR owner){
2680         return owner->b;
2681 }
2682 int64_t  __attribute__((export_name("TS_C2Tuple_u64u64Z_get_b"))) TS_C2Tuple_u64u64Z_get_b(uint64_t owner) {
2683         LDKC2Tuple_u64u64Z* owner_conv = (LDKC2Tuple_u64u64Z*)untag_ptr(owner);
2684         int64_t ret_conv = C2Tuple_u64u64Z_get_b(owner_conv);
2685         return ret_conv;
2686 }
2687
2688 uint32_t __attribute__((export_name("TS_LDKCOption_C2Tuple_u64u64ZZ_ty_from_ptr"))) TS_LDKCOption_C2Tuple_u64u64ZZ_ty_from_ptr(uint64_t ptr) {
2689         LDKCOption_C2Tuple_u64u64ZZ *obj = (LDKCOption_C2Tuple_u64u64ZZ*)untag_ptr(ptr);
2690         switch(obj->tag) {
2691                 case LDKCOption_C2Tuple_u64u64ZZ_Some: return 0;
2692                 case LDKCOption_C2Tuple_u64u64ZZ_None: return 1;
2693                 default: abort();
2694         }
2695 }
2696 uint64_t __attribute__((export_name("TS_LDKCOption_C2Tuple_u64u64ZZ_Some_get_some"))) TS_LDKCOption_C2Tuple_u64u64ZZ_Some_get_some(uint64_t ptr) {
2697         LDKCOption_C2Tuple_u64u64ZZ *obj = (LDKCOption_C2Tuple_u64u64ZZ*)untag_ptr(ptr);
2698         assert(obj->tag == LDKCOption_C2Tuple_u64u64ZZ_Some);
2699         LDKC2Tuple_u64u64Z* some_conv = MALLOC(sizeof(LDKC2Tuple_u64u64Z), "LDKC2Tuple_u64u64Z");
2700         *some_conv = obj->some;
2701                         *some_conv = C2Tuple_u64u64Z_clone(some_conv);
2702         return tag_ptr(some_conv, true);
2703 }
2704 static inline struct LDKThirtyTwoU16s C2Tuple_Z_get_a(LDKC2Tuple_Z *NONNULL_PTR owner){
2705         return owner->a;
2706 }
2707 int16_tArray  __attribute__((export_name("TS_C2Tuple_Z_get_a"))) TS_C2Tuple_Z_get_a(uint64_t owner) {
2708         LDKC2Tuple_Z* owner_conv = (LDKC2Tuple_Z*)untag_ptr(owner);
2709         int16_tArray ret_arr = init_int16_tArray(32, __LINE__);
2710         memcpy(ret_arr->elems, C2Tuple_Z_get_a(owner_conv).data, 32 * 2);
2711         return ret_arr;
2712 }
2713
2714 static inline struct LDKThirtyTwoU16s C2Tuple_Z_get_b(LDKC2Tuple_Z *NONNULL_PTR owner){
2715         return owner->b;
2716 }
2717 int16_tArray  __attribute__((export_name("TS_C2Tuple_Z_get_b"))) TS_C2Tuple_Z_get_b(uint64_t owner) {
2718         LDKC2Tuple_Z* owner_conv = (LDKC2Tuple_Z*)untag_ptr(owner);
2719         int16_tArray ret_arr = init_int16_tArray(32, __LINE__);
2720         memcpy(ret_arr->elems, C2Tuple_Z_get_b(owner_conv).data, 32 * 2);
2721         return ret_arr;
2722 }
2723
2724 static inline struct LDKThirtyTwoU16s C2Tuple__u1632_u1632Z_get_a(LDKC2Tuple__u1632_u1632Z *NONNULL_PTR owner){
2725         return owner->a;
2726 }
2727 int16_tArray  __attribute__((export_name("TS_C2Tuple__u1632_u1632Z_get_a"))) TS_C2Tuple__u1632_u1632Z_get_a(uint64_t owner) {
2728         LDKC2Tuple__u1632_u1632Z* owner_conv = (LDKC2Tuple__u1632_u1632Z*)untag_ptr(owner);
2729         int16_tArray ret_arr = init_int16_tArray(32, __LINE__);
2730         memcpy(ret_arr->elems, C2Tuple__u1632_u1632Z_get_a(owner_conv).data, 32 * 2);
2731         return ret_arr;
2732 }
2733
2734 static inline struct LDKThirtyTwoU16s C2Tuple__u1632_u1632Z_get_b(LDKC2Tuple__u1632_u1632Z *NONNULL_PTR owner){
2735         return owner->b;
2736 }
2737 int16_tArray  __attribute__((export_name("TS_C2Tuple__u1632_u1632Z_get_b"))) TS_C2Tuple__u1632_u1632Z_get_b(uint64_t owner) {
2738         LDKC2Tuple__u1632_u1632Z* owner_conv = (LDKC2Tuple__u1632_u1632Z*)untag_ptr(owner);
2739         int16_tArray ret_arr = init_int16_tArray(32, __LINE__);
2740         memcpy(ret_arr->elems, C2Tuple__u1632_u1632Z_get_b(owner_conv).data, 32 * 2);
2741         return ret_arr;
2742 }
2743
2744 uint32_t __attribute__((export_name("TS_LDKCOption_C2Tuple_ThirtyTwoU16sThirtyTwoU16sZZ_ty_from_ptr"))) TS_LDKCOption_C2Tuple_ThirtyTwoU16sThirtyTwoU16sZZ_ty_from_ptr(uint64_t ptr) {
2745         LDKCOption_C2Tuple_ThirtyTwoU16sThirtyTwoU16sZZ *obj = (LDKCOption_C2Tuple_ThirtyTwoU16sThirtyTwoU16sZZ*)untag_ptr(ptr);
2746         switch(obj->tag) {
2747                 case LDKCOption_C2Tuple_ThirtyTwoU16sThirtyTwoU16sZZ_Some: return 0;
2748                 case LDKCOption_C2Tuple_ThirtyTwoU16sThirtyTwoU16sZZ_None: return 1;
2749                 default: abort();
2750         }
2751 }
2752 uint64_t __attribute__((export_name("TS_LDKCOption_C2Tuple_ThirtyTwoU16sThirtyTwoU16sZZ_Some_get_some"))) TS_LDKCOption_C2Tuple_ThirtyTwoU16sThirtyTwoU16sZZ_Some_get_some(uint64_t ptr) {
2753         LDKCOption_C2Tuple_ThirtyTwoU16sThirtyTwoU16sZZ *obj = (LDKCOption_C2Tuple_ThirtyTwoU16sThirtyTwoU16sZZ*)untag_ptr(ptr);
2754         assert(obj->tag == LDKCOption_C2Tuple_ThirtyTwoU16sThirtyTwoU16sZZ_Some);
2755         LDKC2Tuple__u1632_u1632Z* some_conv = &obj->some;
2756                         // WARNING: we really need to clone here, but no clone is available for LDKC2Tuple__u1632_u1632Z
2757         return tag_ptr(some_conv, false);
2758 }
2759 uint32_t __attribute__((export_name("TS_LDKCOption_f64Z_ty_from_ptr"))) TS_LDKCOption_f64Z_ty_from_ptr(uint64_t ptr) {
2760         LDKCOption_f64Z *obj = (LDKCOption_f64Z*)untag_ptr(ptr);
2761         switch(obj->tag) {
2762                 case LDKCOption_f64Z_Some: return 0;
2763                 case LDKCOption_f64Z_None: return 1;
2764                 default: abort();
2765         }
2766 }
2767 double __attribute__((export_name("TS_LDKCOption_f64Z_Some_get_some"))) TS_LDKCOption_f64Z_Some_get_some(uint64_t ptr) {
2768         LDKCOption_f64Z *obj = (LDKCOption_f64Z*)untag_ptr(ptr);
2769         assert(obj->tag == LDKCOption_f64Z_Some);
2770         double some_conv = obj->some;
2771         return some_conv;
2772 }
2773 typedef struct LDKLogger_JCalls {
2774         atomic_size_t refcnt;
2775         uint32_t instance_ptr;
2776 } LDKLogger_JCalls;
2777 static void LDKLogger_JCalls_free(void* this_arg) {
2778         LDKLogger_JCalls *j_calls = (LDKLogger_JCalls*) this_arg;
2779         if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
2780                 FREE(j_calls);
2781         }
2782 }
2783 void log_LDKLogger_jcall(const void* this_arg, const LDKRecord * record) {
2784         LDKLogger_JCalls *j_calls = (LDKLogger_JCalls*) this_arg;
2785         LDKRecord record_var = *record;
2786         uint64_t record_ref = 0;
2787         record_var = Record_clone(&record_var);
2788         CHECK_INNER_FIELD_ACCESS_OR_NULL(record_var);
2789         record_ref = tag_ptr(record_var.inner, record_var.is_owned);
2790         js_invoke_function_buuuuu(j_calls->instance_ptr, 16, record_ref, 0, 0, 0, 0, 0);
2791 }
2792 static void LDKLogger_JCalls_cloned(LDKLogger* new_obj) {
2793         LDKLogger_JCalls *j_calls = (LDKLogger_JCalls*) new_obj->this_arg;
2794         atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
2795 }
2796 static inline LDKLogger LDKLogger_init (JSValue o) {
2797         LDKLogger_JCalls *calls = MALLOC(sizeof(LDKLogger_JCalls), "LDKLogger_JCalls");
2798         atomic_init(&calls->refcnt, 1);
2799         calls->instance_ptr = o;
2800
2801         LDKLogger ret = {
2802                 .this_arg = (void*) calls,
2803                 .log = log_LDKLogger_jcall,
2804                 .free = LDKLogger_JCalls_free,
2805         };
2806         return ret;
2807 }
2808 uint64_t  __attribute__((export_name("TS_LDKLogger_new"))) TS_LDKLogger_new(JSValue o) {
2809         LDKLogger *res_ptr = MALLOC(sizeof(LDKLogger), "LDKLogger");
2810         *res_ptr = LDKLogger_init(o);
2811         return tag_ptr(res_ptr, true);
2812 }
2813 static inline struct LDKProbabilisticScorer CResult_ProbabilisticScorerDecodeErrorZ_get_ok(LDKCResult_ProbabilisticScorerDecodeErrorZ *NONNULL_PTR owner){
2814         LDKProbabilisticScorer ret = *owner->contents.result;
2815         ret.is_owned = false;
2816         return ret;
2817 }
2818 uint64_t  __attribute__((export_name("TS_CResult_ProbabilisticScorerDecodeErrorZ_get_ok"))) TS_CResult_ProbabilisticScorerDecodeErrorZ_get_ok(uint64_t owner) {
2819         LDKCResult_ProbabilisticScorerDecodeErrorZ* owner_conv = (LDKCResult_ProbabilisticScorerDecodeErrorZ*)untag_ptr(owner);
2820         LDKProbabilisticScorer ret_var = CResult_ProbabilisticScorerDecodeErrorZ_get_ok(owner_conv);
2821         uint64_t ret_ref = 0;
2822         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
2823         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
2824         return ret_ref;
2825 }
2826
2827 static inline struct LDKDecodeError CResult_ProbabilisticScorerDecodeErrorZ_get_err(LDKCResult_ProbabilisticScorerDecodeErrorZ *NONNULL_PTR owner){
2828 CHECK(!owner->result_ok);
2829         return DecodeError_clone(&*owner->contents.err);
2830 }
2831 uint64_t  __attribute__((export_name("TS_CResult_ProbabilisticScorerDecodeErrorZ_get_err"))) TS_CResult_ProbabilisticScorerDecodeErrorZ_get_err(uint64_t owner) {
2832         LDKCResult_ProbabilisticScorerDecodeErrorZ* owner_conv = (LDKCResult_ProbabilisticScorerDecodeErrorZ*)untag_ptr(owner);
2833         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
2834         *ret_copy = CResult_ProbabilisticScorerDecodeErrorZ_get_err(owner_conv);
2835         uint64_t ret_ref = tag_ptr(ret_copy, true);
2836         return ret_ref;
2837 }
2838
2839 static inline uintptr_t C2Tuple_usizeTransactionZ_get_a(LDKC2Tuple_usizeTransactionZ *NONNULL_PTR owner){
2840         return owner->a;
2841 }
2842 uint32_t  __attribute__((export_name("TS_C2Tuple_usizeTransactionZ_get_a"))) TS_C2Tuple_usizeTransactionZ_get_a(uint64_t owner) {
2843         LDKC2Tuple_usizeTransactionZ* owner_conv = (LDKC2Tuple_usizeTransactionZ*)untag_ptr(owner);
2844         uint32_t ret_conv = C2Tuple_usizeTransactionZ_get_a(owner_conv);
2845         return ret_conv;
2846 }
2847
2848 static inline struct LDKTransaction C2Tuple_usizeTransactionZ_get_b(LDKC2Tuple_usizeTransactionZ *NONNULL_PTR owner){
2849         return owner->b;
2850 }
2851 int8_tArray  __attribute__((export_name("TS_C2Tuple_usizeTransactionZ_get_b"))) TS_C2Tuple_usizeTransactionZ_get_b(uint64_t owner) {
2852         LDKC2Tuple_usizeTransactionZ* owner_conv = (LDKC2Tuple_usizeTransactionZ*)untag_ptr(owner);
2853         LDKTransaction ret_var = C2Tuple_usizeTransactionZ_get_b(owner_conv);
2854         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
2855         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
2856         return ret_arr;
2857 }
2858
2859 static inline LDKCVec_C2Tuple_usizeTransactionZZ CVec_C2Tuple_usizeTransactionZZ_clone(const LDKCVec_C2Tuple_usizeTransactionZZ *orig) {
2860         LDKCVec_C2Tuple_usizeTransactionZZ ret = { .data = MALLOC(sizeof(LDKC2Tuple_usizeTransactionZ) * orig->datalen, "LDKCVec_C2Tuple_usizeTransactionZZ clone bytes"), .datalen = orig->datalen };
2861         for (size_t i = 0; i < ret.datalen; i++) {
2862                 ret.data[i] = C2Tuple_usizeTransactionZ_clone(&orig->data[i]);
2863         }
2864         return ret;
2865 }
2866 static inline struct LDKThirtyTwoBytes C2Tuple_ThirtyTwoBytesCOption_ThirtyTwoBytesZZ_get_a(LDKC2Tuple_ThirtyTwoBytesCOption_ThirtyTwoBytesZZ *NONNULL_PTR owner){
2867         return ThirtyTwoBytes_clone(&owner->a);
2868 }
2869 int8_tArray  __attribute__((export_name("TS_C2Tuple_ThirtyTwoBytesCOption_ThirtyTwoBytesZZ_get_a"))) TS_C2Tuple_ThirtyTwoBytesCOption_ThirtyTwoBytesZZ_get_a(uint64_t owner) {
2870         LDKC2Tuple_ThirtyTwoBytesCOption_ThirtyTwoBytesZZ* owner_conv = (LDKC2Tuple_ThirtyTwoBytesCOption_ThirtyTwoBytesZZ*)untag_ptr(owner);
2871         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
2872         memcpy(ret_arr->elems, C2Tuple_ThirtyTwoBytesCOption_ThirtyTwoBytesZZ_get_a(owner_conv).data, 32);
2873         return ret_arr;
2874 }
2875
2876 static inline struct LDKCOption_ThirtyTwoBytesZ C2Tuple_ThirtyTwoBytesCOption_ThirtyTwoBytesZZ_get_b(LDKC2Tuple_ThirtyTwoBytesCOption_ThirtyTwoBytesZZ *NONNULL_PTR owner){
2877         return COption_ThirtyTwoBytesZ_clone(&owner->b);
2878 }
2879 uint64_t  __attribute__((export_name("TS_C2Tuple_ThirtyTwoBytesCOption_ThirtyTwoBytesZZ_get_b"))) TS_C2Tuple_ThirtyTwoBytesCOption_ThirtyTwoBytesZZ_get_b(uint64_t owner) {
2880         LDKC2Tuple_ThirtyTwoBytesCOption_ThirtyTwoBytesZZ* owner_conv = (LDKC2Tuple_ThirtyTwoBytesCOption_ThirtyTwoBytesZZ*)untag_ptr(owner);
2881         LDKCOption_ThirtyTwoBytesZ *ret_copy = MALLOC(sizeof(LDKCOption_ThirtyTwoBytesZ), "LDKCOption_ThirtyTwoBytesZ");
2882         *ret_copy = C2Tuple_ThirtyTwoBytesCOption_ThirtyTwoBytesZZ_get_b(owner_conv);
2883         uint64_t ret_ref = tag_ptr(ret_copy, true);
2884         return ret_ref;
2885 }
2886
2887 static inline LDKCVec_C2Tuple_ThirtyTwoBytesCOption_ThirtyTwoBytesZZZ CVec_C2Tuple_ThirtyTwoBytesCOption_ThirtyTwoBytesZZZ_clone(const LDKCVec_C2Tuple_ThirtyTwoBytesCOption_ThirtyTwoBytesZZZ *orig) {
2888         LDKCVec_C2Tuple_ThirtyTwoBytesCOption_ThirtyTwoBytesZZZ ret = { .data = MALLOC(sizeof(LDKC2Tuple_ThirtyTwoBytesCOption_ThirtyTwoBytesZZ) * orig->datalen, "LDKCVec_C2Tuple_ThirtyTwoBytesCOption_ThirtyTwoBytesZZZ clone bytes"), .datalen = orig->datalen };
2889         for (size_t i = 0; i < ret.datalen; i++) {
2890                 ret.data[i] = C2Tuple_ThirtyTwoBytesCOption_ThirtyTwoBytesZZ_clone(&orig->data[i]);
2891         }
2892         return ret;
2893 }
2894 static inline enum LDKChannelMonitorUpdateStatus CResult_ChannelMonitorUpdateStatusNoneZ_get_ok(LDKCResult_ChannelMonitorUpdateStatusNoneZ *NONNULL_PTR owner){
2895 CHECK(owner->result_ok);
2896         return ChannelMonitorUpdateStatus_clone(&*owner->contents.result);
2897 }
2898 uint32_t  __attribute__((export_name("TS_CResult_ChannelMonitorUpdateStatusNoneZ_get_ok"))) TS_CResult_ChannelMonitorUpdateStatusNoneZ_get_ok(uint64_t owner) {
2899         LDKCResult_ChannelMonitorUpdateStatusNoneZ* owner_conv = (LDKCResult_ChannelMonitorUpdateStatusNoneZ*)untag_ptr(owner);
2900         uint32_t ret_conv = LDKChannelMonitorUpdateStatus_to_js(CResult_ChannelMonitorUpdateStatusNoneZ_get_ok(owner_conv));
2901         return ret_conv;
2902 }
2903
2904 static inline void CResult_ChannelMonitorUpdateStatusNoneZ_get_err(LDKCResult_ChannelMonitorUpdateStatusNoneZ *NONNULL_PTR owner){
2905 CHECK(!owner->result_ok);
2906         return *owner->contents.err;
2907 }
2908 void  __attribute__((export_name("TS_CResult_ChannelMonitorUpdateStatusNoneZ_get_err"))) TS_CResult_ChannelMonitorUpdateStatusNoneZ_get_err(uint64_t owner) {
2909         LDKCResult_ChannelMonitorUpdateStatusNoneZ* owner_conv = (LDKCResult_ChannelMonitorUpdateStatusNoneZ*)untag_ptr(owner);
2910         CResult_ChannelMonitorUpdateStatusNoneZ_get_err(owner_conv);
2911 }
2912
2913 uint32_t __attribute__((export_name("TS_LDKMonitorEvent_ty_from_ptr"))) TS_LDKMonitorEvent_ty_from_ptr(uint64_t ptr) {
2914         LDKMonitorEvent *obj = (LDKMonitorEvent*)untag_ptr(ptr);
2915         switch(obj->tag) {
2916                 case LDKMonitorEvent_HTLCEvent: return 0;
2917                 case LDKMonitorEvent_HolderForceClosed: return 1;
2918                 case LDKMonitorEvent_Completed: return 2;
2919                 default: abort();
2920         }
2921 }
2922 uint64_t __attribute__((export_name("TS_LDKMonitorEvent_HTLCEvent_get_htlc_event"))) TS_LDKMonitorEvent_HTLCEvent_get_htlc_event(uint64_t ptr) {
2923         LDKMonitorEvent *obj = (LDKMonitorEvent*)untag_ptr(ptr);
2924         assert(obj->tag == LDKMonitorEvent_HTLCEvent);
2925         LDKHTLCUpdate htlc_event_var = obj->htlc_event;
2926                         uint64_t htlc_event_ref = 0;
2927                         CHECK_INNER_FIELD_ACCESS_OR_NULL(htlc_event_var);
2928                         htlc_event_ref = tag_ptr(htlc_event_var.inner, false);
2929         return htlc_event_ref;
2930 }
2931 uint64_t __attribute__((export_name("TS_LDKMonitorEvent_HolderForceClosed_get_holder_force_closed"))) TS_LDKMonitorEvent_HolderForceClosed_get_holder_force_closed(uint64_t ptr) {
2932         LDKMonitorEvent *obj = (LDKMonitorEvent*)untag_ptr(ptr);
2933         assert(obj->tag == LDKMonitorEvent_HolderForceClosed);
2934         LDKOutPoint holder_force_closed_var = obj->holder_force_closed;
2935                         uint64_t holder_force_closed_ref = 0;
2936                         CHECK_INNER_FIELD_ACCESS_OR_NULL(holder_force_closed_var);
2937                         holder_force_closed_ref = tag_ptr(holder_force_closed_var.inner, false);
2938         return holder_force_closed_ref;
2939 }
2940 uint64_t __attribute__((export_name("TS_LDKMonitorEvent_Completed_get_funding_txo"))) TS_LDKMonitorEvent_Completed_get_funding_txo(uint64_t ptr) {
2941         LDKMonitorEvent *obj = (LDKMonitorEvent*)untag_ptr(ptr);
2942         assert(obj->tag == LDKMonitorEvent_Completed);
2943         LDKOutPoint funding_txo_var = obj->completed.funding_txo;
2944                         uint64_t funding_txo_ref = 0;
2945                         CHECK_INNER_FIELD_ACCESS_OR_NULL(funding_txo_var);
2946                         funding_txo_ref = tag_ptr(funding_txo_var.inner, false);
2947         return funding_txo_ref;
2948 }
2949 int64_t __attribute__((export_name("TS_LDKMonitorEvent_Completed_get_monitor_update_id"))) TS_LDKMonitorEvent_Completed_get_monitor_update_id(uint64_t ptr) {
2950         LDKMonitorEvent *obj = (LDKMonitorEvent*)untag_ptr(ptr);
2951         assert(obj->tag == LDKMonitorEvent_Completed);
2952         int64_t monitor_update_id_conv = obj->completed.monitor_update_id;
2953         return monitor_update_id_conv;
2954 }
2955 static inline LDKCVec_MonitorEventZ CVec_MonitorEventZ_clone(const LDKCVec_MonitorEventZ *orig) {
2956         LDKCVec_MonitorEventZ ret = { .data = MALLOC(sizeof(LDKMonitorEvent) * orig->datalen, "LDKCVec_MonitorEventZ clone bytes"), .datalen = orig->datalen };
2957         for (size_t i = 0; i < ret.datalen; i++) {
2958                 ret.data[i] = MonitorEvent_clone(&orig->data[i]);
2959         }
2960         return ret;
2961 }
2962 static inline struct LDKOutPoint C3Tuple_OutPointCVec_MonitorEventZPublicKeyZ_get_a(LDKC3Tuple_OutPointCVec_MonitorEventZPublicKeyZ *NONNULL_PTR owner){
2963         LDKOutPoint ret = owner->a;
2964         ret.is_owned = false;
2965         return ret;
2966 }
2967 uint64_t  __attribute__((export_name("TS_C3Tuple_OutPointCVec_MonitorEventZPublicKeyZ_get_a"))) TS_C3Tuple_OutPointCVec_MonitorEventZPublicKeyZ_get_a(uint64_t owner) {
2968         LDKC3Tuple_OutPointCVec_MonitorEventZPublicKeyZ* owner_conv = (LDKC3Tuple_OutPointCVec_MonitorEventZPublicKeyZ*)untag_ptr(owner);
2969         LDKOutPoint ret_var = C3Tuple_OutPointCVec_MonitorEventZPublicKeyZ_get_a(owner_conv);
2970         uint64_t ret_ref = 0;
2971         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
2972         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
2973         return ret_ref;
2974 }
2975
2976 static inline struct LDKCVec_MonitorEventZ C3Tuple_OutPointCVec_MonitorEventZPublicKeyZ_get_b(LDKC3Tuple_OutPointCVec_MonitorEventZPublicKeyZ *NONNULL_PTR owner){
2977         return CVec_MonitorEventZ_clone(&owner->b);
2978 }
2979 uint64_tArray  __attribute__((export_name("TS_C3Tuple_OutPointCVec_MonitorEventZPublicKeyZ_get_b"))) TS_C3Tuple_OutPointCVec_MonitorEventZPublicKeyZ_get_b(uint64_t owner) {
2980         LDKC3Tuple_OutPointCVec_MonitorEventZPublicKeyZ* owner_conv = (LDKC3Tuple_OutPointCVec_MonitorEventZPublicKeyZ*)untag_ptr(owner);
2981         LDKCVec_MonitorEventZ ret_var = C3Tuple_OutPointCVec_MonitorEventZPublicKeyZ_get_b(owner_conv);
2982         uint64_tArray ret_arr = NULL;
2983         ret_arr = init_uint64_tArray(ret_var.datalen, __LINE__);
2984         uint64_t *ret_arr_ptr = (uint64_t*)(((uint8_t*)ret_arr) + 8);
2985         for (size_t o = 0; o < ret_var.datalen; o++) {
2986                 LDKMonitorEvent *ret_conv_14_copy = MALLOC(sizeof(LDKMonitorEvent), "LDKMonitorEvent");
2987                 *ret_conv_14_copy = ret_var.data[o];
2988                 uint64_t ret_conv_14_ref = tag_ptr(ret_conv_14_copy, true);
2989                 ret_arr_ptr[o] = ret_conv_14_ref;
2990         }
2991         
2992         FREE(ret_var.data);
2993         return ret_arr;
2994 }
2995
2996 static inline struct LDKPublicKey C3Tuple_OutPointCVec_MonitorEventZPublicKeyZ_get_c(LDKC3Tuple_OutPointCVec_MonitorEventZPublicKeyZ *NONNULL_PTR owner){
2997         return owner->c;
2998 }
2999 int8_tArray  __attribute__((export_name("TS_C3Tuple_OutPointCVec_MonitorEventZPublicKeyZ_get_c"))) TS_C3Tuple_OutPointCVec_MonitorEventZPublicKeyZ_get_c(uint64_t owner) {
3000         LDKC3Tuple_OutPointCVec_MonitorEventZPublicKeyZ* owner_conv = (LDKC3Tuple_OutPointCVec_MonitorEventZPublicKeyZ*)untag_ptr(owner);
3001         int8_tArray ret_arr = init_int8_tArray(33, __LINE__);
3002         memcpy(ret_arr->elems, C3Tuple_OutPointCVec_MonitorEventZPublicKeyZ_get_c(owner_conv).compressed_form, 33);
3003         return ret_arr;
3004 }
3005
3006 static inline LDKCVec_C3Tuple_OutPointCVec_MonitorEventZPublicKeyZZ CVec_C3Tuple_OutPointCVec_MonitorEventZPublicKeyZZ_clone(const LDKCVec_C3Tuple_OutPointCVec_MonitorEventZPublicKeyZZ *orig) {
3007         LDKCVec_C3Tuple_OutPointCVec_MonitorEventZPublicKeyZZ ret = { .data = MALLOC(sizeof(LDKC3Tuple_OutPointCVec_MonitorEventZPublicKeyZ) * orig->datalen, "LDKCVec_C3Tuple_OutPointCVec_MonitorEventZPublicKeyZZ clone bytes"), .datalen = orig->datalen };
3008         for (size_t i = 0; i < ret.datalen; i++) {
3009                 ret.data[i] = C3Tuple_OutPointCVec_MonitorEventZPublicKeyZ_clone(&orig->data[i]);
3010         }
3011         return ret;
3012 }
3013 static inline struct LDKInitFeatures CResult_InitFeaturesDecodeErrorZ_get_ok(LDKCResult_InitFeaturesDecodeErrorZ *NONNULL_PTR owner){
3014         LDKInitFeatures ret = *owner->contents.result;
3015         ret.is_owned = false;
3016         return ret;
3017 }
3018 uint64_t  __attribute__((export_name("TS_CResult_InitFeaturesDecodeErrorZ_get_ok"))) TS_CResult_InitFeaturesDecodeErrorZ_get_ok(uint64_t owner) {
3019         LDKCResult_InitFeaturesDecodeErrorZ* owner_conv = (LDKCResult_InitFeaturesDecodeErrorZ*)untag_ptr(owner);
3020         LDKInitFeatures ret_var = CResult_InitFeaturesDecodeErrorZ_get_ok(owner_conv);
3021         uint64_t ret_ref = 0;
3022         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
3023         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
3024         return ret_ref;
3025 }
3026
3027 static inline struct LDKDecodeError CResult_InitFeaturesDecodeErrorZ_get_err(LDKCResult_InitFeaturesDecodeErrorZ *NONNULL_PTR owner){
3028 CHECK(!owner->result_ok);
3029         return DecodeError_clone(&*owner->contents.err);
3030 }
3031 uint64_t  __attribute__((export_name("TS_CResult_InitFeaturesDecodeErrorZ_get_err"))) TS_CResult_InitFeaturesDecodeErrorZ_get_err(uint64_t owner) {
3032         LDKCResult_InitFeaturesDecodeErrorZ* owner_conv = (LDKCResult_InitFeaturesDecodeErrorZ*)untag_ptr(owner);
3033         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
3034         *ret_copy = CResult_InitFeaturesDecodeErrorZ_get_err(owner_conv);
3035         uint64_t ret_ref = tag_ptr(ret_copy, true);
3036         return ret_ref;
3037 }
3038
3039 static inline struct LDKChannelFeatures CResult_ChannelFeaturesDecodeErrorZ_get_ok(LDKCResult_ChannelFeaturesDecodeErrorZ *NONNULL_PTR owner){
3040         LDKChannelFeatures ret = *owner->contents.result;
3041         ret.is_owned = false;
3042         return ret;
3043 }
3044 uint64_t  __attribute__((export_name("TS_CResult_ChannelFeaturesDecodeErrorZ_get_ok"))) TS_CResult_ChannelFeaturesDecodeErrorZ_get_ok(uint64_t owner) {
3045         LDKCResult_ChannelFeaturesDecodeErrorZ* owner_conv = (LDKCResult_ChannelFeaturesDecodeErrorZ*)untag_ptr(owner);
3046         LDKChannelFeatures ret_var = CResult_ChannelFeaturesDecodeErrorZ_get_ok(owner_conv);
3047         uint64_t ret_ref = 0;
3048         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
3049         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
3050         return ret_ref;
3051 }
3052
3053 static inline struct LDKDecodeError CResult_ChannelFeaturesDecodeErrorZ_get_err(LDKCResult_ChannelFeaturesDecodeErrorZ *NONNULL_PTR owner){
3054 CHECK(!owner->result_ok);
3055         return DecodeError_clone(&*owner->contents.err);
3056 }
3057 uint64_t  __attribute__((export_name("TS_CResult_ChannelFeaturesDecodeErrorZ_get_err"))) TS_CResult_ChannelFeaturesDecodeErrorZ_get_err(uint64_t owner) {
3058         LDKCResult_ChannelFeaturesDecodeErrorZ* owner_conv = (LDKCResult_ChannelFeaturesDecodeErrorZ*)untag_ptr(owner);
3059         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
3060         *ret_copy = CResult_ChannelFeaturesDecodeErrorZ_get_err(owner_conv);
3061         uint64_t ret_ref = tag_ptr(ret_copy, true);
3062         return ret_ref;
3063 }
3064
3065 static inline struct LDKNodeFeatures CResult_NodeFeaturesDecodeErrorZ_get_ok(LDKCResult_NodeFeaturesDecodeErrorZ *NONNULL_PTR owner){
3066         LDKNodeFeatures ret = *owner->contents.result;
3067         ret.is_owned = false;
3068         return ret;
3069 }
3070 uint64_t  __attribute__((export_name("TS_CResult_NodeFeaturesDecodeErrorZ_get_ok"))) TS_CResult_NodeFeaturesDecodeErrorZ_get_ok(uint64_t owner) {
3071         LDKCResult_NodeFeaturesDecodeErrorZ* owner_conv = (LDKCResult_NodeFeaturesDecodeErrorZ*)untag_ptr(owner);
3072         LDKNodeFeatures ret_var = CResult_NodeFeaturesDecodeErrorZ_get_ok(owner_conv);
3073         uint64_t ret_ref = 0;
3074         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
3075         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
3076         return ret_ref;
3077 }
3078
3079 static inline struct LDKDecodeError CResult_NodeFeaturesDecodeErrorZ_get_err(LDKCResult_NodeFeaturesDecodeErrorZ *NONNULL_PTR owner){
3080 CHECK(!owner->result_ok);
3081         return DecodeError_clone(&*owner->contents.err);
3082 }
3083 uint64_t  __attribute__((export_name("TS_CResult_NodeFeaturesDecodeErrorZ_get_err"))) TS_CResult_NodeFeaturesDecodeErrorZ_get_err(uint64_t owner) {
3084         LDKCResult_NodeFeaturesDecodeErrorZ* owner_conv = (LDKCResult_NodeFeaturesDecodeErrorZ*)untag_ptr(owner);
3085         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
3086         *ret_copy = CResult_NodeFeaturesDecodeErrorZ_get_err(owner_conv);
3087         uint64_t ret_ref = tag_ptr(ret_copy, true);
3088         return ret_ref;
3089 }
3090
3091 static inline struct LDKBolt11InvoiceFeatures CResult_Bolt11InvoiceFeaturesDecodeErrorZ_get_ok(LDKCResult_Bolt11InvoiceFeaturesDecodeErrorZ *NONNULL_PTR owner){
3092         LDKBolt11InvoiceFeatures ret = *owner->contents.result;
3093         ret.is_owned = false;
3094         return ret;
3095 }
3096 uint64_t  __attribute__((export_name("TS_CResult_Bolt11InvoiceFeaturesDecodeErrorZ_get_ok"))) TS_CResult_Bolt11InvoiceFeaturesDecodeErrorZ_get_ok(uint64_t owner) {
3097         LDKCResult_Bolt11InvoiceFeaturesDecodeErrorZ* owner_conv = (LDKCResult_Bolt11InvoiceFeaturesDecodeErrorZ*)untag_ptr(owner);
3098         LDKBolt11InvoiceFeatures ret_var = CResult_Bolt11InvoiceFeaturesDecodeErrorZ_get_ok(owner_conv);
3099         uint64_t ret_ref = 0;
3100         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
3101         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
3102         return ret_ref;
3103 }
3104
3105 static inline struct LDKDecodeError CResult_Bolt11InvoiceFeaturesDecodeErrorZ_get_err(LDKCResult_Bolt11InvoiceFeaturesDecodeErrorZ *NONNULL_PTR owner){
3106 CHECK(!owner->result_ok);
3107         return DecodeError_clone(&*owner->contents.err);
3108 }
3109 uint64_t  __attribute__((export_name("TS_CResult_Bolt11InvoiceFeaturesDecodeErrorZ_get_err"))) TS_CResult_Bolt11InvoiceFeaturesDecodeErrorZ_get_err(uint64_t owner) {
3110         LDKCResult_Bolt11InvoiceFeaturesDecodeErrorZ* owner_conv = (LDKCResult_Bolt11InvoiceFeaturesDecodeErrorZ*)untag_ptr(owner);
3111         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
3112         *ret_copy = CResult_Bolt11InvoiceFeaturesDecodeErrorZ_get_err(owner_conv);
3113         uint64_t ret_ref = tag_ptr(ret_copy, true);
3114         return ret_ref;
3115 }
3116
3117 static inline struct LDKBolt12InvoiceFeatures CResult_Bolt12InvoiceFeaturesDecodeErrorZ_get_ok(LDKCResult_Bolt12InvoiceFeaturesDecodeErrorZ *NONNULL_PTR owner){
3118         LDKBolt12InvoiceFeatures ret = *owner->contents.result;
3119         ret.is_owned = false;
3120         return ret;
3121 }
3122 uint64_t  __attribute__((export_name("TS_CResult_Bolt12InvoiceFeaturesDecodeErrorZ_get_ok"))) TS_CResult_Bolt12InvoiceFeaturesDecodeErrorZ_get_ok(uint64_t owner) {
3123         LDKCResult_Bolt12InvoiceFeaturesDecodeErrorZ* owner_conv = (LDKCResult_Bolt12InvoiceFeaturesDecodeErrorZ*)untag_ptr(owner);
3124         LDKBolt12InvoiceFeatures ret_var = CResult_Bolt12InvoiceFeaturesDecodeErrorZ_get_ok(owner_conv);
3125         uint64_t ret_ref = 0;
3126         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
3127         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
3128         return ret_ref;
3129 }
3130
3131 static inline struct LDKDecodeError CResult_Bolt12InvoiceFeaturesDecodeErrorZ_get_err(LDKCResult_Bolt12InvoiceFeaturesDecodeErrorZ *NONNULL_PTR owner){
3132 CHECK(!owner->result_ok);
3133         return DecodeError_clone(&*owner->contents.err);
3134 }
3135 uint64_t  __attribute__((export_name("TS_CResult_Bolt12InvoiceFeaturesDecodeErrorZ_get_err"))) TS_CResult_Bolt12InvoiceFeaturesDecodeErrorZ_get_err(uint64_t owner) {
3136         LDKCResult_Bolt12InvoiceFeaturesDecodeErrorZ* owner_conv = (LDKCResult_Bolt12InvoiceFeaturesDecodeErrorZ*)untag_ptr(owner);
3137         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
3138         *ret_copy = CResult_Bolt12InvoiceFeaturesDecodeErrorZ_get_err(owner_conv);
3139         uint64_t ret_ref = tag_ptr(ret_copy, true);
3140         return ret_ref;
3141 }
3142
3143 static inline struct LDKBlindedHopFeatures CResult_BlindedHopFeaturesDecodeErrorZ_get_ok(LDKCResult_BlindedHopFeaturesDecodeErrorZ *NONNULL_PTR owner){
3144         LDKBlindedHopFeatures ret = *owner->contents.result;
3145         ret.is_owned = false;
3146         return ret;
3147 }
3148 uint64_t  __attribute__((export_name("TS_CResult_BlindedHopFeaturesDecodeErrorZ_get_ok"))) TS_CResult_BlindedHopFeaturesDecodeErrorZ_get_ok(uint64_t owner) {
3149         LDKCResult_BlindedHopFeaturesDecodeErrorZ* owner_conv = (LDKCResult_BlindedHopFeaturesDecodeErrorZ*)untag_ptr(owner);
3150         LDKBlindedHopFeatures ret_var = CResult_BlindedHopFeaturesDecodeErrorZ_get_ok(owner_conv);
3151         uint64_t ret_ref = 0;
3152         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
3153         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
3154         return ret_ref;
3155 }
3156
3157 static inline struct LDKDecodeError CResult_BlindedHopFeaturesDecodeErrorZ_get_err(LDKCResult_BlindedHopFeaturesDecodeErrorZ *NONNULL_PTR owner){
3158 CHECK(!owner->result_ok);
3159         return DecodeError_clone(&*owner->contents.err);
3160 }
3161 uint64_t  __attribute__((export_name("TS_CResult_BlindedHopFeaturesDecodeErrorZ_get_err"))) TS_CResult_BlindedHopFeaturesDecodeErrorZ_get_err(uint64_t owner) {
3162         LDKCResult_BlindedHopFeaturesDecodeErrorZ* owner_conv = (LDKCResult_BlindedHopFeaturesDecodeErrorZ*)untag_ptr(owner);
3163         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
3164         *ret_copy = CResult_BlindedHopFeaturesDecodeErrorZ_get_err(owner_conv);
3165         uint64_t ret_ref = tag_ptr(ret_copy, true);
3166         return ret_ref;
3167 }
3168
3169 static inline struct LDKChannelTypeFeatures CResult_ChannelTypeFeaturesDecodeErrorZ_get_ok(LDKCResult_ChannelTypeFeaturesDecodeErrorZ *NONNULL_PTR owner){
3170         LDKChannelTypeFeatures ret = *owner->contents.result;
3171         ret.is_owned = false;
3172         return ret;
3173 }
3174 uint64_t  __attribute__((export_name("TS_CResult_ChannelTypeFeaturesDecodeErrorZ_get_ok"))) TS_CResult_ChannelTypeFeaturesDecodeErrorZ_get_ok(uint64_t owner) {
3175         LDKCResult_ChannelTypeFeaturesDecodeErrorZ* owner_conv = (LDKCResult_ChannelTypeFeaturesDecodeErrorZ*)untag_ptr(owner);
3176         LDKChannelTypeFeatures ret_var = CResult_ChannelTypeFeaturesDecodeErrorZ_get_ok(owner_conv);
3177         uint64_t ret_ref = 0;
3178         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
3179         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
3180         return ret_ref;
3181 }
3182
3183 static inline struct LDKDecodeError CResult_ChannelTypeFeaturesDecodeErrorZ_get_err(LDKCResult_ChannelTypeFeaturesDecodeErrorZ *NONNULL_PTR owner){
3184 CHECK(!owner->result_ok);
3185         return DecodeError_clone(&*owner->contents.err);
3186 }
3187 uint64_t  __attribute__((export_name("TS_CResult_ChannelTypeFeaturesDecodeErrorZ_get_err"))) TS_CResult_ChannelTypeFeaturesDecodeErrorZ_get_err(uint64_t owner) {
3188         LDKCResult_ChannelTypeFeaturesDecodeErrorZ* owner_conv = (LDKCResult_ChannelTypeFeaturesDecodeErrorZ*)untag_ptr(owner);
3189         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
3190         *ret_copy = CResult_ChannelTypeFeaturesDecodeErrorZ_get_err(owner_conv);
3191         uint64_t ret_ref = tag_ptr(ret_copy, true);
3192         return ret_ref;
3193 }
3194
3195 static inline struct LDKOffer CResult_OfferBolt12ParseErrorZ_get_ok(LDKCResult_OfferBolt12ParseErrorZ *NONNULL_PTR owner){
3196         LDKOffer ret = *owner->contents.result;
3197         ret.is_owned = false;
3198         return ret;
3199 }
3200 uint64_t  __attribute__((export_name("TS_CResult_OfferBolt12ParseErrorZ_get_ok"))) TS_CResult_OfferBolt12ParseErrorZ_get_ok(uint64_t owner) {
3201         LDKCResult_OfferBolt12ParseErrorZ* owner_conv = (LDKCResult_OfferBolt12ParseErrorZ*)untag_ptr(owner);
3202         LDKOffer ret_var = CResult_OfferBolt12ParseErrorZ_get_ok(owner_conv);
3203         uint64_t ret_ref = 0;
3204         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
3205         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
3206         return ret_ref;
3207 }
3208
3209 static inline struct LDKBolt12ParseError CResult_OfferBolt12ParseErrorZ_get_err(LDKCResult_OfferBolt12ParseErrorZ *NONNULL_PTR owner){
3210         LDKBolt12ParseError ret = *owner->contents.err;
3211         ret.is_owned = false;
3212         return ret;
3213 }
3214 uint64_t  __attribute__((export_name("TS_CResult_OfferBolt12ParseErrorZ_get_err"))) TS_CResult_OfferBolt12ParseErrorZ_get_err(uint64_t owner) {
3215         LDKCResult_OfferBolt12ParseErrorZ* owner_conv = (LDKCResult_OfferBolt12ParseErrorZ*)untag_ptr(owner);
3216         LDKBolt12ParseError ret_var = CResult_OfferBolt12ParseErrorZ_get_err(owner_conv);
3217         uint64_t ret_ref = 0;
3218         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
3219         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
3220         return ret_ref;
3221 }
3222
3223 static inline struct LDKPublicKey CResult_PublicKeySecp256k1ErrorZ_get_ok(LDKCResult_PublicKeySecp256k1ErrorZ *NONNULL_PTR owner){
3224 CHECK(owner->result_ok);
3225         return *owner->contents.result;
3226 }
3227 int8_tArray  __attribute__((export_name("TS_CResult_PublicKeySecp256k1ErrorZ_get_ok"))) TS_CResult_PublicKeySecp256k1ErrorZ_get_ok(uint64_t owner) {
3228         LDKCResult_PublicKeySecp256k1ErrorZ* owner_conv = (LDKCResult_PublicKeySecp256k1ErrorZ*)untag_ptr(owner);
3229         int8_tArray ret_arr = init_int8_tArray(33, __LINE__);
3230         memcpy(ret_arr->elems, CResult_PublicKeySecp256k1ErrorZ_get_ok(owner_conv).compressed_form, 33);
3231         return ret_arr;
3232 }
3233
3234 static inline enum LDKSecp256k1Error CResult_PublicKeySecp256k1ErrorZ_get_err(LDKCResult_PublicKeySecp256k1ErrorZ *NONNULL_PTR owner){
3235 CHECK(!owner->result_ok);
3236         return *owner->contents.err;
3237 }
3238 uint32_t  __attribute__((export_name("TS_CResult_PublicKeySecp256k1ErrorZ_get_err"))) TS_CResult_PublicKeySecp256k1ErrorZ_get_err(uint64_t owner) {
3239         LDKCResult_PublicKeySecp256k1ErrorZ* owner_conv = (LDKCResult_PublicKeySecp256k1ErrorZ*)untag_ptr(owner);
3240         uint32_t ret_conv = LDKSecp256k1Error_to_js(CResult_PublicKeySecp256k1ErrorZ_get_err(owner_conv));
3241         return ret_conv;
3242 }
3243
3244 static inline struct LDKNodeId CResult_NodeIdDecodeErrorZ_get_ok(LDKCResult_NodeIdDecodeErrorZ *NONNULL_PTR owner){
3245         LDKNodeId ret = *owner->contents.result;
3246         ret.is_owned = false;
3247         return ret;
3248 }
3249 uint64_t  __attribute__((export_name("TS_CResult_NodeIdDecodeErrorZ_get_ok"))) TS_CResult_NodeIdDecodeErrorZ_get_ok(uint64_t owner) {
3250         LDKCResult_NodeIdDecodeErrorZ* owner_conv = (LDKCResult_NodeIdDecodeErrorZ*)untag_ptr(owner);
3251         LDKNodeId ret_var = CResult_NodeIdDecodeErrorZ_get_ok(owner_conv);
3252         uint64_t ret_ref = 0;
3253         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
3254         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
3255         return ret_ref;
3256 }
3257
3258 static inline struct LDKDecodeError CResult_NodeIdDecodeErrorZ_get_err(LDKCResult_NodeIdDecodeErrorZ *NONNULL_PTR owner){
3259 CHECK(!owner->result_ok);
3260         return DecodeError_clone(&*owner->contents.err);
3261 }
3262 uint64_t  __attribute__((export_name("TS_CResult_NodeIdDecodeErrorZ_get_err"))) TS_CResult_NodeIdDecodeErrorZ_get_err(uint64_t owner) {
3263         LDKCResult_NodeIdDecodeErrorZ* owner_conv = (LDKCResult_NodeIdDecodeErrorZ*)untag_ptr(owner);
3264         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
3265         *ret_copy = CResult_NodeIdDecodeErrorZ_get_err(owner_conv);
3266         uint64_t ret_ref = tag_ptr(ret_copy, true);
3267         return ret_ref;
3268 }
3269
3270 uint32_t __attribute__((export_name("TS_LDKNetworkUpdate_ty_from_ptr"))) TS_LDKNetworkUpdate_ty_from_ptr(uint64_t ptr) {
3271         LDKNetworkUpdate *obj = (LDKNetworkUpdate*)untag_ptr(ptr);
3272         switch(obj->tag) {
3273                 case LDKNetworkUpdate_ChannelUpdateMessage: return 0;
3274                 case LDKNetworkUpdate_ChannelFailure: return 1;
3275                 case LDKNetworkUpdate_NodeFailure: return 2;
3276                 default: abort();
3277         }
3278 }
3279 uint64_t __attribute__((export_name("TS_LDKNetworkUpdate_ChannelUpdateMessage_get_msg"))) TS_LDKNetworkUpdate_ChannelUpdateMessage_get_msg(uint64_t ptr) {
3280         LDKNetworkUpdate *obj = (LDKNetworkUpdate*)untag_ptr(ptr);
3281         assert(obj->tag == LDKNetworkUpdate_ChannelUpdateMessage);
3282         LDKChannelUpdate msg_var = obj->channel_update_message.msg;
3283                         uint64_t msg_ref = 0;
3284                         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
3285                         msg_ref = tag_ptr(msg_var.inner, false);
3286         return msg_ref;
3287 }
3288 int64_t __attribute__((export_name("TS_LDKNetworkUpdate_ChannelFailure_get_short_channel_id"))) TS_LDKNetworkUpdate_ChannelFailure_get_short_channel_id(uint64_t ptr) {
3289         LDKNetworkUpdate *obj = (LDKNetworkUpdate*)untag_ptr(ptr);
3290         assert(obj->tag == LDKNetworkUpdate_ChannelFailure);
3291         int64_t short_channel_id_conv = obj->channel_failure.short_channel_id;
3292         return short_channel_id_conv;
3293 }
3294 jboolean __attribute__((export_name("TS_LDKNetworkUpdate_ChannelFailure_get_is_permanent"))) TS_LDKNetworkUpdate_ChannelFailure_get_is_permanent(uint64_t ptr) {
3295         LDKNetworkUpdate *obj = (LDKNetworkUpdate*)untag_ptr(ptr);
3296         assert(obj->tag == LDKNetworkUpdate_ChannelFailure);
3297         jboolean is_permanent_conv = obj->channel_failure.is_permanent;
3298         return is_permanent_conv;
3299 }
3300 int8_tArray __attribute__((export_name("TS_LDKNetworkUpdate_NodeFailure_get_node_id"))) TS_LDKNetworkUpdate_NodeFailure_get_node_id(uint64_t ptr) {
3301         LDKNetworkUpdate *obj = (LDKNetworkUpdate*)untag_ptr(ptr);
3302         assert(obj->tag == LDKNetworkUpdate_NodeFailure);
3303         int8_tArray node_id_arr = init_int8_tArray(33, __LINE__);
3304         memcpy(node_id_arr->elems, obj->node_failure.node_id.compressed_form, 33);
3305         return node_id_arr;
3306 }
3307 jboolean __attribute__((export_name("TS_LDKNetworkUpdate_NodeFailure_get_is_permanent"))) TS_LDKNetworkUpdate_NodeFailure_get_is_permanent(uint64_t ptr) {
3308         LDKNetworkUpdate *obj = (LDKNetworkUpdate*)untag_ptr(ptr);
3309         assert(obj->tag == LDKNetworkUpdate_NodeFailure);
3310         jboolean is_permanent_conv = obj->node_failure.is_permanent;
3311         return is_permanent_conv;
3312 }
3313 uint32_t __attribute__((export_name("TS_LDKCOption_NetworkUpdateZ_ty_from_ptr"))) TS_LDKCOption_NetworkUpdateZ_ty_from_ptr(uint64_t ptr) {
3314         LDKCOption_NetworkUpdateZ *obj = (LDKCOption_NetworkUpdateZ*)untag_ptr(ptr);
3315         switch(obj->tag) {
3316                 case LDKCOption_NetworkUpdateZ_Some: return 0;
3317                 case LDKCOption_NetworkUpdateZ_None: return 1;
3318                 default: abort();
3319         }
3320 }
3321 uint64_t __attribute__((export_name("TS_LDKCOption_NetworkUpdateZ_Some_get_some"))) TS_LDKCOption_NetworkUpdateZ_Some_get_some(uint64_t ptr) {
3322         LDKCOption_NetworkUpdateZ *obj = (LDKCOption_NetworkUpdateZ*)untag_ptr(ptr);
3323         assert(obj->tag == LDKCOption_NetworkUpdateZ_Some);
3324         uint64_t some_ref = tag_ptr(&obj->some, false);
3325         return some_ref;
3326 }
3327 static inline struct LDKCOption_NetworkUpdateZ CResult_COption_NetworkUpdateZDecodeErrorZ_get_ok(LDKCResult_COption_NetworkUpdateZDecodeErrorZ *NONNULL_PTR owner){
3328 CHECK(owner->result_ok);
3329         return COption_NetworkUpdateZ_clone(&*owner->contents.result);
3330 }
3331 uint64_t  __attribute__((export_name("TS_CResult_COption_NetworkUpdateZDecodeErrorZ_get_ok"))) TS_CResult_COption_NetworkUpdateZDecodeErrorZ_get_ok(uint64_t owner) {
3332         LDKCResult_COption_NetworkUpdateZDecodeErrorZ* owner_conv = (LDKCResult_COption_NetworkUpdateZDecodeErrorZ*)untag_ptr(owner);
3333         LDKCOption_NetworkUpdateZ *ret_copy = MALLOC(sizeof(LDKCOption_NetworkUpdateZ), "LDKCOption_NetworkUpdateZ");
3334         *ret_copy = CResult_COption_NetworkUpdateZDecodeErrorZ_get_ok(owner_conv);
3335         uint64_t ret_ref = tag_ptr(ret_copy, true);
3336         return ret_ref;
3337 }
3338
3339 static inline struct LDKDecodeError CResult_COption_NetworkUpdateZDecodeErrorZ_get_err(LDKCResult_COption_NetworkUpdateZDecodeErrorZ *NONNULL_PTR owner){
3340 CHECK(!owner->result_ok);
3341         return DecodeError_clone(&*owner->contents.err);
3342 }
3343 uint64_t  __attribute__((export_name("TS_CResult_COption_NetworkUpdateZDecodeErrorZ_get_err"))) TS_CResult_COption_NetworkUpdateZDecodeErrorZ_get_err(uint64_t owner) {
3344         LDKCResult_COption_NetworkUpdateZDecodeErrorZ* owner_conv = (LDKCResult_COption_NetworkUpdateZDecodeErrorZ*)untag_ptr(owner);
3345         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
3346         *ret_copy = CResult_COption_NetworkUpdateZDecodeErrorZ_get_err(owner_conv);
3347         uint64_t ret_ref = tag_ptr(ret_copy, true);
3348         return ret_ref;
3349 }
3350
3351 static inline struct LDKTxOut CResult_TxOutUtxoLookupErrorZ_get_ok(LDKCResult_TxOutUtxoLookupErrorZ *NONNULL_PTR owner){
3352 CHECK(owner->result_ok);
3353         return TxOut_clone(&*owner->contents.result);
3354 }
3355 uint64_t  __attribute__((export_name("TS_CResult_TxOutUtxoLookupErrorZ_get_ok"))) TS_CResult_TxOutUtxoLookupErrorZ_get_ok(uint64_t owner) {
3356         LDKCResult_TxOutUtxoLookupErrorZ* owner_conv = (LDKCResult_TxOutUtxoLookupErrorZ*)untag_ptr(owner);
3357         LDKTxOut* ret_ref = MALLOC(sizeof(LDKTxOut), "LDKTxOut");
3358         *ret_ref = CResult_TxOutUtxoLookupErrorZ_get_ok(owner_conv);
3359         return tag_ptr(ret_ref, true);
3360 }
3361
3362 static inline enum LDKUtxoLookupError CResult_TxOutUtxoLookupErrorZ_get_err(LDKCResult_TxOutUtxoLookupErrorZ *NONNULL_PTR owner){
3363 CHECK(!owner->result_ok);
3364         return UtxoLookupError_clone(&*owner->contents.err);
3365 }
3366 uint32_t  __attribute__((export_name("TS_CResult_TxOutUtxoLookupErrorZ_get_err"))) TS_CResult_TxOutUtxoLookupErrorZ_get_err(uint64_t owner) {
3367         LDKCResult_TxOutUtxoLookupErrorZ* owner_conv = (LDKCResult_TxOutUtxoLookupErrorZ*)untag_ptr(owner);
3368         uint32_t ret_conv = LDKUtxoLookupError_to_js(CResult_TxOutUtxoLookupErrorZ_get_err(owner_conv));
3369         return ret_conv;
3370 }
3371
3372 uint32_t __attribute__((export_name("TS_LDKUtxoResult_ty_from_ptr"))) TS_LDKUtxoResult_ty_from_ptr(uint64_t ptr) {
3373         LDKUtxoResult *obj = (LDKUtxoResult*)untag_ptr(ptr);
3374         switch(obj->tag) {
3375                 case LDKUtxoResult_Sync: return 0;
3376                 case LDKUtxoResult_Async: return 1;
3377                 default: abort();
3378         }
3379 }
3380 uint64_t __attribute__((export_name("TS_LDKUtxoResult_Sync_get_sync"))) TS_LDKUtxoResult_Sync_get_sync(uint64_t ptr) {
3381         LDKUtxoResult *obj = (LDKUtxoResult*)untag_ptr(ptr);
3382         assert(obj->tag == LDKUtxoResult_Sync);
3383         LDKCResult_TxOutUtxoLookupErrorZ* sync_conv = MALLOC(sizeof(LDKCResult_TxOutUtxoLookupErrorZ), "LDKCResult_TxOutUtxoLookupErrorZ");
3384         *sync_conv = obj->sync;
3385                         *sync_conv = CResult_TxOutUtxoLookupErrorZ_clone(sync_conv);
3386         return tag_ptr(sync_conv, true);
3387 }
3388 uint64_t __attribute__((export_name("TS_LDKUtxoResult_Async_get_async"))) TS_LDKUtxoResult_Async_get_async(uint64_t ptr) {
3389         LDKUtxoResult *obj = (LDKUtxoResult*)untag_ptr(ptr);
3390         assert(obj->tag == LDKUtxoResult_Async);
3391         LDKUtxoFuture async_var = obj->async;
3392                         uint64_t async_ref = 0;
3393                         CHECK_INNER_FIELD_ACCESS_OR_NULL(async_var);
3394                         async_ref = tag_ptr(async_var.inner, false);
3395         return async_ref;
3396 }
3397 typedef struct LDKUtxoLookup_JCalls {
3398         atomic_size_t refcnt;
3399         uint32_t instance_ptr;
3400 } LDKUtxoLookup_JCalls;
3401 static void LDKUtxoLookup_JCalls_free(void* this_arg) {
3402         LDKUtxoLookup_JCalls *j_calls = (LDKUtxoLookup_JCalls*) this_arg;
3403         if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
3404                 FREE(j_calls);
3405         }
3406 }
3407 LDKUtxoResult get_utxo_LDKUtxoLookup_jcall(const void* this_arg, const uint8_t (* chain_hash)[32], uint64_t short_channel_id) {
3408         LDKUtxoLookup_JCalls *j_calls = (LDKUtxoLookup_JCalls*) this_arg;
3409         int8_tArray chain_hash_arr = init_int8_tArray(32, __LINE__);
3410         memcpy(chain_hash_arr->elems, *chain_hash, 32);
3411         int64_t short_channel_id_conv = short_channel_id;
3412         uint64_t ret = js_invoke_function_ubuuuu(j_calls->instance_ptr, 17, (uint32_t)chain_hash_arr, short_channel_id_conv, 0, 0, 0, 0);
3413         void* ret_ptr = untag_ptr(ret);
3414         CHECK_ACCESS(ret_ptr);
3415         LDKUtxoResult ret_conv = *(LDKUtxoResult*)(ret_ptr);
3416         FREE(untag_ptr(ret));
3417         return ret_conv;
3418 }
3419 static void LDKUtxoLookup_JCalls_cloned(LDKUtxoLookup* new_obj) {
3420         LDKUtxoLookup_JCalls *j_calls = (LDKUtxoLookup_JCalls*) new_obj->this_arg;
3421         atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
3422 }
3423 static inline LDKUtxoLookup LDKUtxoLookup_init (JSValue o) {
3424         LDKUtxoLookup_JCalls *calls = MALLOC(sizeof(LDKUtxoLookup_JCalls), "LDKUtxoLookup_JCalls");
3425         atomic_init(&calls->refcnt, 1);
3426         calls->instance_ptr = o;
3427
3428         LDKUtxoLookup ret = {
3429                 .this_arg = (void*) calls,
3430                 .get_utxo = get_utxo_LDKUtxoLookup_jcall,
3431                 .free = LDKUtxoLookup_JCalls_free,
3432         };
3433         return ret;
3434 }
3435 uint64_t  __attribute__((export_name("TS_LDKUtxoLookup_new"))) TS_LDKUtxoLookup_new(JSValue o) {
3436         LDKUtxoLookup *res_ptr = MALLOC(sizeof(LDKUtxoLookup), "LDKUtxoLookup");
3437         *res_ptr = LDKUtxoLookup_init(o);
3438         return tag_ptr(res_ptr, true);
3439 }
3440 uint64_t  __attribute__((export_name("TS_UtxoLookup_get_utxo"))) TS_UtxoLookup_get_utxo(uint64_t this_arg, int8_tArray chain_hash, int64_t short_channel_id) {
3441         void* this_arg_ptr = untag_ptr(this_arg);
3442         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
3443         LDKUtxoLookup* this_arg_conv = (LDKUtxoLookup*)this_arg_ptr;
3444         uint8_t chain_hash_arr[32];
3445         CHECK(chain_hash->arr_len == 32);
3446         memcpy(chain_hash_arr, chain_hash->elems, 32); FREE(chain_hash);
3447         uint8_t (*chain_hash_ref)[32] = &chain_hash_arr;
3448         LDKUtxoResult *ret_copy = MALLOC(sizeof(LDKUtxoResult), "LDKUtxoResult");
3449         *ret_copy = (this_arg_conv->get_utxo)(this_arg_conv->this_arg, chain_hash_ref, short_channel_id);
3450         uint64_t ret_ref = tag_ptr(ret_copy, true);
3451         return ret_ref;
3452 }
3453
3454 uint32_t __attribute__((export_name("TS_LDKCOption_UtxoLookupZ_ty_from_ptr"))) TS_LDKCOption_UtxoLookupZ_ty_from_ptr(uint64_t ptr) {
3455         LDKCOption_UtxoLookupZ *obj = (LDKCOption_UtxoLookupZ*)untag_ptr(ptr);
3456         switch(obj->tag) {
3457                 case LDKCOption_UtxoLookupZ_Some: return 0;
3458                 case LDKCOption_UtxoLookupZ_None: return 1;
3459                 default: abort();
3460         }
3461 }
3462 uint64_t __attribute__((export_name("TS_LDKCOption_UtxoLookupZ_Some_get_some"))) TS_LDKCOption_UtxoLookupZ_Some_get_some(uint64_t ptr) {
3463         LDKCOption_UtxoLookupZ *obj = (LDKCOption_UtxoLookupZ*)untag_ptr(ptr);
3464         assert(obj->tag == LDKCOption_UtxoLookupZ_Some);
3465         LDKUtxoLookup* some_ret = MALLOC(sizeof(LDKUtxoLookup), "LDKUtxoLookup");
3466         *some_ret = obj->some;
3467                         // WARNING: We likely need to clone here, but no clone is available, so we just do it for Java instances
3468                         if ((*some_ret).free == LDKUtxoLookup_JCalls_free) {
3469                                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
3470                                 LDKUtxoLookup_JCalls_cloned(&(*some_ret));
3471                         }
3472         return tag_ptr(some_ret, true);
3473 }
3474 static inline void CResult_NoneLightningErrorZ_get_ok(LDKCResult_NoneLightningErrorZ *NONNULL_PTR owner){
3475 CHECK(owner->result_ok);
3476         return *owner->contents.result;
3477 }
3478 void  __attribute__((export_name("TS_CResult_NoneLightningErrorZ_get_ok"))) TS_CResult_NoneLightningErrorZ_get_ok(uint64_t owner) {
3479         LDKCResult_NoneLightningErrorZ* owner_conv = (LDKCResult_NoneLightningErrorZ*)untag_ptr(owner);
3480         CResult_NoneLightningErrorZ_get_ok(owner_conv);
3481 }
3482
3483 static inline struct LDKLightningError CResult_NoneLightningErrorZ_get_err(LDKCResult_NoneLightningErrorZ *NONNULL_PTR owner){
3484         LDKLightningError ret = *owner->contents.err;
3485         ret.is_owned = false;
3486         return ret;
3487 }
3488 uint64_t  __attribute__((export_name("TS_CResult_NoneLightningErrorZ_get_err"))) TS_CResult_NoneLightningErrorZ_get_err(uint64_t owner) {
3489         LDKCResult_NoneLightningErrorZ* owner_conv = (LDKCResult_NoneLightningErrorZ*)untag_ptr(owner);
3490         LDKLightningError ret_var = CResult_NoneLightningErrorZ_get_err(owner_conv);
3491         uint64_t ret_ref = 0;
3492         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
3493         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
3494         return ret_ref;
3495 }
3496
3497 static inline bool CResult_boolLightningErrorZ_get_ok(LDKCResult_boolLightningErrorZ *NONNULL_PTR owner){
3498 CHECK(owner->result_ok);
3499         return *owner->contents.result;
3500 }
3501 jboolean  __attribute__((export_name("TS_CResult_boolLightningErrorZ_get_ok"))) TS_CResult_boolLightningErrorZ_get_ok(uint64_t owner) {
3502         LDKCResult_boolLightningErrorZ* owner_conv = (LDKCResult_boolLightningErrorZ*)untag_ptr(owner);
3503         jboolean ret_conv = CResult_boolLightningErrorZ_get_ok(owner_conv);
3504         return ret_conv;
3505 }
3506
3507 static inline struct LDKLightningError CResult_boolLightningErrorZ_get_err(LDKCResult_boolLightningErrorZ *NONNULL_PTR owner){
3508         LDKLightningError ret = *owner->contents.err;
3509         ret.is_owned = false;
3510         return ret;
3511 }
3512 uint64_t  __attribute__((export_name("TS_CResult_boolLightningErrorZ_get_err"))) TS_CResult_boolLightningErrorZ_get_err(uint64_t owner) {
3513         LDKCResult_boolLightningErrorZ* owner_conv = (LDKCResult_boolLightningErrorZ*)untag_ptr(owner);
3514         LDKLightningError ret_var = CResult_boolLightningErrorZ_get_err(owner_conv);
3515         uint64_t ret_ref = 0;
3516         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
3517         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
3518         return ret_ref;
3519 }
3520
3521 static inline struct LDKChannelAnnouncement C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ_get_a(LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ *NONNULL_PTR owner){
3522         LDKChannelAnnouncement ret = owner->a;
3523         ret.is_owned = false;
3524         return ret;
3525 }
3526 uint64_t  __attribute__((export_name("TS_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ_get_a"))) TS_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ_get_a(uint64_t owner) {
3527         LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ* owner_conv = (LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ*)untag_ptr(owner);
3528         LDKChannelAnnouncement ret_var = C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ_get_a(owner_conv);
3529         uint64_t ret_ref = 0;
3530         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
3531         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
3532         return ret_ref;
3533 }
3534
3535 static inline struct LDKChannelUpdate C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ_get_b(LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ *NONNULL_PTR owner){
3536         LDKChannelUpdate ret = owner->b;
3537         ret.is_owned = false;
3538         return ret;
3539 }
3540 uint64_t  __attribute__((export_name("TS_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ_get_b"))) TS_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ_get_b(uint64_t owner) {
3541         LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ* owner_conv = (LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ*)untag_ptr(owner);
3542         LDKChannelUpdate ret_var = C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ_get_b(owner_conv);
3543         uint64_t ret_ref = 0;
3544         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
3545         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
3546         return ret_ref;
3547 }
3548
3549 static inline struct LDKChannelUpdate C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ_get_c(LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ *NONNULL_PTR owner){
3550         LDKChannelUpdate ret = owner->c;
3551         ret.is_owned = false;
3552         return ret;
3553 }
3554 uint64_t  __attribute__((export_name("TS_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ_get_c"))) TS_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ_get_c(uint64_t owner) {
3555         LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ* owner_conv = (LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ*)untag_ptr(owner);
3556         LDKChannelUpdate ret_var = C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ_get_c(owner_conv);
3557         uint64_t ret_ref = 0;
3558         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
3559         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
3560         return ret_ref;
3561 }
3562
3563 uint32_t __attribute__((export_name("TS_LDKCOption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ_ty_from_ptr"))) TS_LDKCOption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ_ty_from_ptr(uint64_t ptr) {
3564         LDKCOption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ *obj = (LDKCOption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ*)untag_ptr(ptr);
3565         switch(obj->tag) {
3566                 case LDKCOption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ_Some: return 0;
3567                 case LDKCOption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ_None: return 1;
3568                 default: abort();
3569         }
3570 }
3571 uint64_t __attribute__((export_name("TS_LDKCOption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ_Some_get_some"))) TS_LDKCOption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ_Some_get_some(uint64_t ptr) {
3572         LDKCOption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ *obj = (LDKCOption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ*)untag_ptr(ptr);
3573         assert(obj->tag == LDKCOption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ_Some);
3574         LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ* some_conv = MALLOC(sizeof(LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ), "LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ");
3575         *some_conv = obj->some;
3576                         *some_conv = C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ_clone(some_conv);
3577         return tag_ptr(some_conv, true);
3578 }
3579 uint32_t __attribute__((export_name("TS_LDKErrorAction_ty_from_ptr"))) TS_LDKErrorAction_ty_from_ptr(uint64_t ptr) {
3580         LDKErrorAction *obj = (LDKErrorAction*)untag_ptr(ptr);
3581         switch(obj->tag) {
3582                 case LDKErrorAction_DisconnectPeer: return 0;
3583                 case LDKErrorAction_DisconnectPeerWithWarning: return 1;
3584                 case LDKErrorAction_IgnoreError: return 2;
3585                 case LDKErrorAction_IgnoreAndLog: return 3;
3586                 case LDKErrorAction_IgnoreDuplicateGossip: return 4;
3587                 case LDKErrorAction_SendErrorMessage: return 5;
3588                 case LDKErrorAction_SendWarningMessage: return 6;
3589                 default: abort();
3590         }
3591 }
3592 uint64_t __attribute__((export_name("TS_LDKErrorAction_DisconnectPeer_get_msg"))) TS_LDKErrorAction_DisconnectPeer_get_msg(uint64_t ptr) {
3593         LDKErrorAction *obj = (LDKErrorAction*)untag_ptr(ptr);
3594         assert(obj->tag == LDKErrorAction_DisconnectPeer);
3595         LDKErrorMessage msg_var = obj->disconnect_peer.msg;
3596                         uint64_t msg_ref = 0;
3597                         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
3598                         msg_ref = tag_ptr(msg_var.inner, false);
3599         return msg_ref;
3600 }
3601 uint64_t __attribute__((export_name("TS_LDKErrorAction_DisconnectPeerWithWarning_get_msg"))) TS_LDKErrorAction_DisconnectPeerWithWarning_get_msg(uint64_t ptr) {
3602         LDKErrorAction *obj = (LDKErrorAction*)untag_ptr(ptr);
3603         assert(obj->tag == LDKErrorAction_DisconnectPeerWithWarning);
3604         LDKWarningMessage msg_var = obj->disconnect_peer_with_warning.msg;
3605                         uint64_t msg_ref = 0;
3606                         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
3607                         msg_ref = tag_ptr(msg_var.inner, false);
3608         return msg_ref;
3609 }
3610 uint32_t __attribute__((export_name("TS_LDKErrorAction_IgnoreAndLog_get_ignore_and_log"))) TS_LDKErrorAction_IgnoreAndLog_get_ignore_and_log(uint64_t ptr) {
3611         LDKErrorAction *obj = (LDKErrorAction*)untag_ptr(ptr);
3612         assert(obj->tag == LDKErrorAction_IgnoreAndLog);
3613         uint32_t ignore_and_log_conv = LDKLevel_to_js(obj->ignore_and_log);
3614         return ignore_and_log_conv;
3615 }
3616 uint64_t __attribute__((export_name("TS_LDKErrorAction_SendErrorMessage_get_msg"))) TS_LDKErrorAction_SendErrorMessage_get_msg(uint64_t ptr) {
3617         LDKErrorAction *obj = (LDKErrorAction*)untag_ptr(ptr);
3618         assert(obj->tag == LDKErrorAction_SendErrorMessage);
3619         LDKErrorMessage msg_var = obj->send_error_message.msg;
3620                         uint64_t msg_ref = 0;
3621                         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
3622                         msg_ref = tag_ptr(msg_var.inner, false);
3623         return msg_ref;
3624 }
3625 uint64_t __attribute__((export_name("TS_LDKErrorAction_SendWarningMessage_get_msg"))) TS_LDKErrorAction_SendWarningMessage_get_msg(uint64_t ptr) {
3626         LDKErrorAction *obj = (LDKErrorAction*)untag_ptr(ptr);
3627         assert(obj->tag == LDKErrorAction_SendWarningMessage);
3628         LDKWarningMessage msg_var = obj->send_warning_message.msg;
3629                         uint64_t msg_ref = 0;
3630                         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
3631                         msg_ref = tag_ptr(msg_var.inner, false);
3632         return msg_ref;
3633 }
3634 uint32_t __attribute__((export_name("TS_LDKErrorAction_SendWarningMessage_get_log_level"))) TS_LDKErrorAction_SendWarningMessage_get_log_level(uint64_t ptr) {
3635         LDKErrorAction *obj = (LDKErrorAction*)untag_ptr(ptr);
3636         assert(obj->tag == LDKErrorAction_SendWarningMessage);
3637         uint32_t log_level_conv = LDKLevel_to_js(obj->send_warning_message.log_level);
3638         return log_level_conv;
3639 }
3640 uint32_t __attribute__((export_name("TS_LDKMessageSendEvent_ty_from_ptr"))) TS_LDKMessageSendEvent_ty_from_ptr(uint64_t ptr) {
3641         LDKMessageSendEvent *obj = (LDKMessageSendEvent*)untag_ptr(ptr);
3642         switch(obj->tag) {
3643                 case LDKMessageSendEvent_SendAcceptChannel: return 0;
3644                 case LDKMessageSendEvent_SendAcceptChannelV2: return 1;
3645                 case LDKMessageSendEvent_SendOpenChannel: return 2;
3646                 case LDKMessageSendEvent_SendOpenChannelV2: return 3;
3647                 case LDKMessageSendEvent_SendFundingCreated: return 4;
3648                 case LDKMessageSendEvent_SendFundingSigned: return 5;
3649                 case LDKMessageSendEvent_SendTxAddInput: return 6;
3650                 case LDKMessageSendEvent_SendTxAddOutput: return 7;
3651                 case LDKMessageSendEvent_SendTxRemoveInput: return 8;
3652                 case LDKMessageSendEvent_SendTxRemoveOutput: return 9;
3653                 case LDKMessageSendEvent_SendTxComplete: return 10;
3654                 case LDKMessageSendEvent_SendTxSignatures: return 11;
3655                 case LDKMessageSendEvent_SendTxInitRbf: return 12;
3656                 case LDKMessageSendEvent_SendTxAckRbf: return 13;
3657                 case LDKMessageSendEvent_SendTxAbort: return 14;
3658                 case LDKMessageSendEvent_SendChannelReady: return 15;
3659                 case LDKMessageSendEvent_SendAnnouncementSignatures: return 16;
3660                 case LDKMessageSendEvent_UpdateHTLCs: return 17;
3661                 case LDKMessageSendEvent_SendRevokeAndACK: return 18;
3662                 case LDKMessageSendEvent_SendClosingSigned: return 19;
3663                 case LDKMessageSendEvent_SendShutdown: return 20;
3664                 case LDKMessageSendEvent_SendChannelReestablish: return 21;
3665                 case LDKMessageSendEvent_SendChannelAnnouncement: return 22;
3666                 case LDKMessageSendEvent_BroadcastChannelAnnouncement: return 23;
3667                 case LDKMessageSendEvent_BroadcastChannelUpdate: return 24;
3668                 case LDKMessageSendEvent_BroadcastNodeAnnouncement: return 25;
3669                 case LDKMessageSendEvent_SendChannelUpdate: return 26;
3670                 case LDKMessageSendEvent_HandleError: return 27;
3671                 case LDKMessageSendEvent_SendChannelRangeQuery: return 28;
3672                 case LDKMessageSendEvent_SendShortIdsQuery: return 29;
3673                 case LDKMessageSendEvent_SendReplyChannelRange: return 30;
3674                 case LDKMessageSendEvent_SendGossipTimestampFilter: return 31;
3675                 default: abort();
3676         }
3677 }
3678 int8_tArray __attribute__((export_name("TS_LDKMessageSendEvent_SendAcceptChannel_get_node_id"))) TS_LDKMessageSendEvent_SendAcceptChannel_get_node_id(uint64_t ptr) {
3679         LDKMessageSendEvent *obj = (LDKMessageSendEvent*)untag_ptr(ptr);
3680         assert(obj->tag == LDKMessageSendEvent_SendAcceptChannel);
3681         int8_tArray node_id_arr = init_int8_tArray(33, __LINE__);
3682         memcpy(node_id_arr->elems, obj->send_accept_channel.node_id.compressed_form, 33);
3683         return node_id_arr;
3684 }
3685 uint64_t __attribute__((export_name("TS_LDKMessageSendEvent_SendAcceptChannel_get_msg"))) TS_LDKMessageSendEvent_SendAcceptChannel_get_msg(uint64_t ptr) {
3686         LDKMessageSendEvent *obj = (LDKMessageSendEvent*)untag_ptr(ptr);
3687         assert(obj->tag == LDKMessageSendEvent_SendAcceptChannel);
3688         LDKAcceptChannel msg_var = obj->send_accept_channel.msg;
3689                         uint64_t msg_ref = 0;
3690                         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
3691                         msg_ref = tag_ptr(msg_var.inner, false);
3692         return msg_ref;
3693 }
3694 int8_tArray __attribute__((export_name("TS_LDKMessageSendEvent_SendAcceptChannelV2_get_node_id"))) TS_LDKMessageSendEvent_SendAcceptChannelV2_get_node_id(uint64_t ptr) {
3695         LDKMessageSendEvent *obj = (LDKMessageSendEvent*)untag_ptr(ptr);
3696         assert(obj->tag == LDKMessageSendEvent_SendAcceptChannelV2);
3697         int8_tArray node_id_arr = init_int8_tArray(33, __LINE__);
3698         memcpy(node_id_arr->elems, obj->send_accept_channel_v2.node_id.compressed_form, 33);
3699         return node_id_arr;
3700 }
3701 uint64_t __attribute__((export_name("TS_LDKMessageSendEvent_SendAcceptChannelV2_get_msg"))) TS_LDKMessageSendEvent_SendAcceptChannelV2_get_msg(uint64_t ptr) {
3702         LDKMessageSendEvent *obj = (LDKMessageSendEvent*)untag_ptr(ptr);
3703         assert(obj->tag == LDKMessageSendEvent_SendAcceptChannelV2);
3704         LDKAcceptChannelV2 msg_var = obj->send_accept_channel_v2.msg;
3705                         uint64_t msg_ref = 0;
3706                         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
3707                         msg_ref = tag_ptr(msg_var.inner, false);
3708         return msg_ref;
3709 }
3710 int8_tArray __attribute__((export_name("TS_LDKMessageSendEvent_SendOpenChannel_get_node_id"))) TS_LDKMessageSendEvent_SendOpenChannel_get_node_id(uint64_t ptr) {
3711         LDKMessageSendEvent *obj = (LDKMessageSendEvent*)untag_ptr(ptr);
3712         assert(obj->tag == LDKMessageSendEvent_SendOpenChannel);
3713         int8_tArray node_id_arr = init_int8_tArray(33, __LINE__);
3714         memcpy(node_id_arr->elems, obj->send_open_channel.node_id.compressed_form, 33);
3715         return node_id_arr;
3716 }
3717 uint64_t __attribute__((export_name("TS_LDKMessageSendEvent_SendOpenChannel_get_msg"))) TS_LDKMessageSendEvent_SendOpenChannel_get_msg(uint64_t ptr) {
3718         LDKMessageSendEvent *obj = (LDKMessageSendEvent*)untag_ptr(ptr);
3719         assert(obj->tag == LDKMessageSendEvent_SendOpenChannel);
3720         LDKOpenChannel msg_var = obj->send_open_channel.msg;
3721                         uint64_t msg_ref = 0;
3722                         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
3723                         msg_ref = tag_ptr(msg_var.inner, false);
3724         return msg_ref;
3725 }
3726 int8_tArray __attribute__((export_name("TS_LDKMessageSendEvent_SendOpenChannelV2_get_node_id"))) TS_LDKMessageSendEvent_SendOpenChannelV2_get_node_id(uint64_t ptr) {
3727         LDKMessageSendEvent *obj = (LDKMessageSendEvent*)untag_ptr(ptr);
3728         assert(obj->tag == LDKMessageSendEvent_SendOpenChannelV2);
3729         int8_tArray node_id_arr = init_int8_tArray(33, __LINE__);
3730         memcpy(node_id_arr->elems, obj->send_open_channel_v2.node_id.compressed_form, 33);
3731         return node_id_arr;
3732 }
3733 uint64_t __attribute__((export_name("TS_LDKMessageSendEvent_SendOpenChannelV2_get_msg"))) TS_LDKMessageSendEvent_SendOpenChannelV2_get_msg(uint64_t ptr) {
3734         LDKMessageSendEvent *obj = (LDKMessageSendEvent*)untag_ptr(ptr);
3735         assert(obj->tag == LDKMessageSendEvent_SendOpenChannelV2);
3736         LDKOpenChannelV2 msg_var = obj->send_open_channel_v2.msg;
3737                         uint64_t msg_ref = 0;
3738                         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
3739                         msg_ref = tag_ptr(msg_var.inner, false);
3740         return msg_ref;
3741 }
3742 int8_tArray __attribute__((export_name("TS_LDKMessageSendEvent_SendFundingCreated_get_node_id"))) TS_LDKMessageSendEvent_SendFundingCreated_get_node_id(uint64_t ptr) {
3743         LDKMessageSendEvent *obj = (LDKMessageSendEvent*)untag_ptr(ptr);
3744         assert(obj->tag == LDKMessageSendEvent_SendFundingCreated);
3745         int8_tArray node_id_arr = init_int8_tArray(33, __LINE__);
3746         memcpy(node_id_arr->elems, obj->send_funding_created.node_id.compressed_form, 33);
3747         return node_id_arr;
3748 }
3749 uint64_t __attribute__((export_name("TS_LDKMessageSendEvent_SendFundingCreated_get_msg"))) TS_LDKMessageSendEvent_SendFundingCreated_get_msg(uint64_t ptr) {
3750         LDKMessageSendEvent *obj = (LDKMessageSendEvent*)untag_ptr(ptr);
3751         assert(obj->tag == LDKMessageSendEvent_SendFundingCreated);
3752         LDKFundingCreated msg_var = obj->send_funding_created.msg;
3753                         uint64_t msg_ref = 0;
3754                         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
3755                         msg_ref = tag_ptr(msg_var.inner, false);
3756         return msg_ref;
3757 }
3758 int8_tArray __attribute__((export_name("TS_LDKMessageSendEvent_SendFundingSigned_get_node_id"))) TS_LDKMessageSendEvent_SendFundingSigned_get_node_id(uint64_t ptr) {
3759         LDKMessageSendEvent *obj = (LDKMessageSendEvent*)untag_ptr(ptr);
3760         assert(obj->tag == LDKMessageSendEvent_SendFundingSigned);
3761         int8_tArray node_id_arr = init_int8_tArray(33, __LINE__);
3762         memcpy(node_id_arr->elems, obj->send_funding_signed.node_id.compressed_form, 33);
3763         return node_id_arr;
3764 }
3765 uint64_t __attribute__((export_name("TS_LDKMessageSendEvent_SendFundingSigned_get_msg"))) TS_LDKMessageSendEvent_SendFundingSigned_get_msg(uint64_t ptr) {
3766         LDKMessageSendEvent *obj = (LDKMessageSendEvent*)untag_ptr(ptr);
3767         assert(obj->tag == LDKMessageSendEvent_SendFundingSigned);
3768         LDKFundingSigned msg_var = obj->send_funding_signed.msg;
3769                         uint64_t msg_ref = 0;
3770                         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
3771                         msg_ref = tag_ptr(msg_var.inner, false);
3772         return msg_ref;
3773 }
3774 int8_tArray __attribute__((export_name("TS_LDKMessageSendEvent_SendTxAddInput_get_node_id"))) TS_LDKMessageSendEvent_SendTxAddInput_get_node_id(uint64_t ptr) {
3775         LDKMessageSendEvent *obj = (LDKMessageSendEvent*)untag_ptr(ptr);
3776         assert(obj->tag == LDKMessageSendEvent_SendTxAddInput);
3777         int8_tArray node_id_arr = init_int8_tArray(33, __LINE__);
3778         memcpy(node_id_arr->elems, obj->send_tx_add_input.node_id.compressed_form, 33);
3779         return node_id_arr;
3780 }
3781 uint64_t __attribute__((export_name("TS_LDKMessageSendEvent_SendTxAddInput_get_msg"))) TS_LDKMessageSendEvent_SendTxAddInput_get_msg(uint64_t ptr) {
3782         LDKMessageSendEvent *obj = (LDKMessageSendEvent*)untag_ptr(ptr);
3783         assert(obj->tag == LDKMessageSendEvent_SendTxAddInput);
3784         LDKTxAddInput msg_var = obj->send_tx_add_input.msg;
3785                         uint64_t msg_ref = 0;
3786                         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
3787                         msg_ref = tag_ptr(msg_var.inner, false);
3788         return msg_ref;
3789 }
3790 int8_tArray __attribute__((export_name("TS_LDKMessageSendEvent_SendTxAddOutput_get_node_id"))) TS_LDKMessageSendEvent_SendTxAddOutput_get_node_id(uint64_t ptr) {
3791         LDKMessageSendEvent *obj = (LDKMessageSendEvent*)untag_ptr(ptr);
3792         assert(obj->tag == LDKMessageSendEvent_SendTxAddOutput);
3793         int8_tArray node_id_arr = init_int8_tArray(33, __LINE__);
3794         memcpy(node_id_arr->elems, obj->send_tx_add_output.node_id.compressed_form, 33);
3795         return node_id_arr;
3796 }
3797 uint64_t __attribute__((export_name("TS_LDKMessageSendEvent_SendTxAddOutput_get_msg"))) TS_LDKMessageSendEvent_SendTxAddOutput_get_msg(uint64_t ptr) {
3798         LDKMessageSendEvent *obj = (LDKMessageSendEvent*)untag_ptr(ptr);
3799         assert(obj->tag == LDKMessageSendEvent_SendTxAddOutput);
3800         LDKTxAddOutput msg_var = obj->send_tx_add_output.msg;
3801                         uint64_t msg_ref = 0;
3802                         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
3803                         msg_ref = tag_ptr(msg_var.inner, false);
3804         return msg_ref;
3805 }
3806 int8_tArray __attribute__((export_name("TS_LDKMessageSendEvent_SendTxRemoveInput_get_node_id"))) TS_LDKMessageSendEvent_SendTxRemoveInput_get_node_id(uint64_t ptr) {
3807         LDKMessageSendEvent *obj = (LDKMessageSendEvent*)untag_ptr(ptr);
3808         assert(obj->tag == LDKMessageSendEvent_SendTxRemoveInput);
3809         int8_tArray node_id_arr = init_int8_tArray(33, __LINE__);
3810         memcpy(node_id_arr->elems, obj->send_tx_remove_input.node_id.compressed_form, 33);
3811         return node_id_arr;
3812 }
3813 uint64_t __attribute__((export_name("TS_LDKMessageSendEvent_SendTxRemoveInput_get_msg"))) TS_LDKMessageSendEvent_SendTxRemoveInput_get_msg(uint64_t ptr) {
3814         LDKMessageSendEvent *obj = (LDKMessageSendEvent*)untag_ptr(ptr);
3815         assert(obj->tag == LDKMessageSendEvent_SendTxRemoveInput);
3816         LDKTxRemoveInput msg_var = obj->send_tx_remove_input.msg;
3817                         uint64_t msg_ref = 0;
3818                         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
3819                         msg_ref = tag_ptr(msg_var.inner, false);
3820         return msg_ref;
3821 }
3822 int8_tArray __attribute__((export_name("TS_LDKMessageSendEvent_SendTxRemoveOutput_get_node_id"))) TS_LDKMessageSendEvent_SendTxRemoveOutput_get_node_id(uint64_t ptr) {
3823         LDKMessageSendEvent *obj = (LDKMessageSendEvent*)untag_ptr(ptr);
3824         assert(obj->tag == LDKMessageSendEvent_SendTxRemoveOutput);
3825         int8_tArray node_id_arr = init_int8_tArray(33, __LINE__);
3826         memcpy(node_id_arr->elems, obj->send_tx_remove_output.node_id.compressed_form, 33);
3827         return node_id_arr;
3828 }
3829 uint64_t __attribute__((export_name("TS_LDKMessageSendEvent_SendTxRemoveOutput_get_msg"))) TS_LDKMessageSendEvent_SendTxRemoveOutput_get_msg(uint64_t ptr) {
3830         LDKMessageSendEvent *obj = (LDKMessageSendEvent*)untag_ptr(ptr);
3831         assert(obj->tag == LDKMessageSendEvent_SendTxRemoveOutput);
3832         LDKTxRemoveOutput msg_var = obj->send_tx_remove_output.msg;
3833                         uint64_t msg_ref = 0;
3834                         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
3835                         msg_ref = tag_ptr(msg_var.inner, false);
3836         return msg_ref;
3837 }
3838 int8_tArray __attribute__((export_name("TS_LDKMessageSendEvent_SendTxComplete_get_node_id"))) TS_LDKMessageSendEvent_SendTxComplete_get_node_id(uint64_t ptr) {
3839         LDKMessageSendEvent *obj = (LDKMessageSendEvent*)untag_ptr(ptr);
3840         assert(obj->tag == LDKMessageSendEvent_SendTxComplete);
3841         int8_tArray node_id_arr = init_int8_tArray(33, __LINE__);
3842         memcpy(node_id_arr->elems, obj->send_tx_complete.node_id.compressed_form, 33);
3843         return node_id_arr;
3844 }
3845 uint64_t __attribute__((export_name("TS_LDKMessageSendEvent_SendTxComplete_get_msg"))) TS_LDKMessageSendEvent_SendTxComplete_get_msg(uint64_t ptr) {
3846         LDKMessageSendEvent *obj = (LDKMessageSendEvent*)untag_ptr(ptr);
3847         assert(obj->tag == LDKMessageSendEvent_SendTxComplete);
3848         LDKTxComplete msg_var = obj->send_tx_complete.msg;
3849                         uint64_t msg_ref = 0;
3850                         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
3851                         msg_ref = tag_ptr(msg_var.inner, false);
3852         return msg_ref;
3853 }
3854 int8_tArray __attribute__((export_name("TS_LDKMessageSendEvent_SendTxSignatures_get_node_id"))) TS_LDKMessageSendEvent_SendTxSignatures_get_node_id(uint64_t ptr) {
3855         LDKMessageSendEvent *obj = (LDKMessageSendEvent*)untag_ptr(ptr);
3856         assert(obj->tag == LDKMessageSendEvent_SendTxSignatures);
3857         int8_tArray node_id_arr = init_int8_tArray(33, __LINE__);
3858         memcpy(node_id_arr->elems, obj->send_tx_signatures.node_id.compressed_form, 33);
3859         return node_id_arr;
3860 }
3861 uint64_t __attribute__((export_name("TS_LDKMessageSendEvent_SendTxSignatures_get_msg"))) TS_LDKMessageSendEvent_SendTxSignatures_get_msg(uint64_t ptr) {
3862         LDKMessageSendEvent *obj = (LDKMessageSendEvent*)untag_ptr(ptr);
3863         assert(obj->tag == LDKMessageSendEvent_SendTxSignatures);
3864         LDKTxSignatures msg_var = obj->send_tx_signatures.msg;
3865                         uint64_t msg_ref = 0;
3866                         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
3867                         msg_ref = tag_ptr(msg_var.inner, false);
3868         return msg_ref;
3869 }
3870 int8_tArray __attribute__((export_name("TS_LDKMessageSendEvent_SendTxInitRbf_get_node_id"))) TS_LDKMessageSendEvent_SendTxInitRbf_get_node_id(uint64_t ptr) {
3871         LDKMessageSendEvent *obj = (LDKMessageSendEvent*)untag_ptr(ptr);
3872         assert(obj->tag == LDKMessageSendEvent_SendTxInitRbf);
3873         int8_tArray node_id_arr = init_int8_tArray(33, __LINE__);
3874         memcpy(node_id_arr->elems, obj->send_tx_init_rbf.node_id.compressed_form, 33);
3875         return node_id_arr;
3876 }
3877 uint64_t __attribute__((export_name("TS_LDKMessageSendEvent_SendTxInitRbf_get_msg"))) TS_LDKMessageSendEvent_SendTxInitRbf_get_msg(uint64_t ptr) {
3878         LDKMessageSendEvent *obj = (LDKMessageSendEvent*)untag_ptr(ptr);
3879         assert(obj->tag == LDKMessageSendEvent_SendTxInitRbf);
3880         LDKTxInitRbf msg_var = obj->send_tx_init_rbf.msg;
3881                         uint64_t msg_ref = 0;
3882                         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
3883                         msg_ref = tag_ptr(msg_var.inner, false);
3884         return msg_ref;
3885 }
3886 int8_tArray __attribute__((export_name("TS_LDKMessageSendEvent_SendTxAckRbf_get_node_id"))) TS_LDKMessageSendEvent_SendTxAckRbf_get_node_id(uint64_t ptr) {
3887         LDKMessageSendEvent *obj = (LDKMessageSendEvent*)untag_ptr(ptr);
3888         assert(obj->tag == LDKMessageSendEvent_SendTxAckRbf);
3889         int8_tArray node_id_arr = init_int8_tArray(33, __LINE__);
3890         memcpy(node_id_arr->elems, obj->send_tx_ack_rbf.node_id.compressed_form, 33);
3891         return node_id_arr;
3892 }
3893 uint64_t __attribute__((export_name("TS_LDKMessageSendEvent_SendTxAckRbf_get_msg"))) TS_LDKMessageSendEvent_SendTxAckRbf_get_msg(uint64_t ptr) {
3894         LDKMessageSendEvent *obj = (LDKMessageSendEvent*)untag_ptr(ptr);
3895         assert(obj->tag == LDKMessageSendEvent_SendTxAckRbf);
3896         LDKTxAckRbf msg_var = obj->send_tx_ack_rbf.msg;
3897                         uint64_t msg_ref = 0;
3898                         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
3899                         msg_ref = tag_ptr(msg_var.inner, false);
3900         return msg_ref;
3901 }
3902 int8_tArray __attribute__((export_name("TS_LDKMessageSendEvent_SendTxAbort_get_node_id"))) TS_LDKMessageSendEvent_SendTxAbort_get_node_id(uint64_t ptr) {
3903         LDKMessageSendEvent *obj = (LDKMessageSendEvent*)untag_ptr(ptr);
3904         assert(obj->tag == LDKMessageSendEvent_SendTxAbort);
3905         int8_tArray node_id_arr = init_int8_tArray(33, __LINE__);
3906         memcpy(node_id_arr->elems, obj->send_tx_abort.node_id.compressed_form, 33);
3907         return node_id_arr;
3908 }
3909 uint64_t __attribute__((export_name("TS_LDKMessageSendEvent_SendTxAbort_get_msg"))) TS_LDKMessageSendEvent_SendTxAbort_get_msg(uint64_t ptr) {
3910         LDKMessageSendEvent *obj = (LDKMessageSendEvent*)untag_ptr(ptr);
3911         assert(obj->tag == LDKMessageSendEvent_SendTxAbort);
3912         LDKTxAbort msg_var = obj->send_tx_abort.msg;
3913                         uint64_t msg_ref = 0;
3914                         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
3915                         msg_ref = tag_ptr(msg_var.inner, false);
3916         return msg_ref;
3917 }
3918 int8_tArray __attribute__((export_name("TS_LDKMessageSendEvent_SendChannelReady_get_node_id"))) TS_LDKMessageSendEvent_SendChannelReady_get_node_id(uint64_t ptr) {
3919         LDKMessageSendEvent *obj = (LDKMessageSendEvent*)untag_ptr(ptr);
3920         assert(obj->tag == LDKMessageSendEvent_SendChannelReady);
3921         int8_tArray node_id_arr = init_int8_tArray(33, __LINE__);
3922         memcpy(node_id_arr->elems, obj->send_channel_ready.node_id.compressed_form, 33);
3923         return node_id_arr;
3924 }
3925 uint64_t __attribute__((export_name("TS_LDKMessageSendEvent_SendChannelReady_get_msg"))) TS_LDKMessageSendEvent_SendChannelReady_get_msg(uint64_t ptr) {
3926         LDKMessageSendEvent *obj = (LDKMessageSendEvent*)untag_ptr(ptr);
3927         assert(obj->tag == LDKMessageSendEvent_SendChannelReady);
3928         LDKChannelReady msg_var = obj->send_channel_ready.msg;
3929                         uint64_t msg_ref = 0;
3930                         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
3931                         msg_ref = tag_ptr(msg_var.inner, false);
3932         return msg_ref;
3933 }
3934 int8_tArray __attribute__((export_name("TS_LDKMessageSendEvent_SendAnnouncementSignatures_get_node_id"))) TS_LDKMessageSendEvent_SendAnnouncementSignatures_get_node_id(uint64_t ptr) {
3935         LDKMessageSendEvent *obj = (LDKMessageSendEvent*)untag_ptr(ptr);
3936         assert(obj->tag == LDKMessageSendEvent_SendAnnouncementSignatures);
3937         int8_tArray node_id_arr = init_int8_tArray(33, __LINE__);
3938         memcpy(node_id_arr->elems, obj->send_announcement_signatures.node_id.compressed_form, 33);
3939         return node_id_arr;
3940 }
3941 uint64_t __attribute__((export_name("TS_LDKMessageSendEvent_SendAnnouncementSignatures_get_msg"))) TS_LDKMessageSendEvent_SendAnnouncementSignatures_get_msg(uint64_t ptr) {
3942         LDKMessageSendEvent *obj = (LDKMessageSendEvent*)untag_ptr(ptr);
3943         assert(obj->tag == LDKMessageSendEvent_SendAnnouncementSignatures);
3944         LDKAnnouncementSignatures msg_var = obj->send_announcement_signatures.msg;
3945                         uint64_t msg_ref = 0;
3946                         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
3947                         msg_ref = tag_ptr(msg_var.inner, false);
3948         return msg_ref;
3949 }
3950 int8_tArray __attribute__((export_name("TS_LDKMessageSendEvent_UpdateHTLCs_get_node_id"))) TS_LDKMessageSendEvent_UpdateHTLCs_get_node_id(uint64_t ptr) {
3951         LDKMessageSendEvent *obj = (LDKMessageSendEvent*)untag_ptr(ptr);
3952         assert(obj->tag == LDKMessageSendEvent_UpdateHTLCs);
3953         int8_tArray node_id_arr = init_int8_tArray(33, __LINE__);
3954         memcpy(node_id_arr->elems, obj->update_htl_cs.node_id.compressed_form, 33);
3955         return node_id_arr;
3956 }
3957 uint64_t __attribute__((export_name("TS_LDKMessageSendEvent_UpdateHTLCs_get_updates"))) TS_LDKMessageSendEvent_UpdateHTLCs_get_updates(uint64_t ptr) {
3958         LDKMessageSendEvent *obj = (LDKMessageSendEvent*)untag_ptr(ptr);
3959         assert(obj->tag == LDKMessageSendEvent_UpdateHTLCs);
3960         LDKCommitmentUpdate updates_var = obj->update_htl_cs.updates;
3961                         uint64_t updates_ref = 0;
3962                         CHECK_INNER_FIELD_ACCESS_OR_NULL(updates_var);
3963                         updates_ref = tag_ptr(updates_var.inner, false);
3964         return updates_ref;
3965 }
3966 int8_tArray __attribute__((export_name("TS_LDKMessageSendEvent_SendRevokeAndACK_get_node_id"))) TS_LDKMessageSendEvent_SendRevokeAndACK_get_node_id(uint64_t ptr) {
3967         LDKMessageSendEvent *obj = (LDKMessageSendEvent*)untag_ptr(ptr);
3968         assert(obj->tag == LDKMessageSendEvent_SendRevokeAndACK);
3969         int8_tArray node_id_arr = init_int8_tArray(33, __LINE__);
3970         memcpy(node_id_arr->elems, obj->send_revoke_and_ack.node_id.compressed_form, 33);
3971         return node_id_arr;
3972 }
3973 uint64_t __attribute__((export_name("TS_LDKMessageSendEvent_SendRevokeAndACK_get_msg"))) TS_LDKMessageSendEvent_SendRevokeAndACK_get_msg(uint64_t ptr) {
3974         LDKMessageSendEvent *obj = (LDKMessageSendEvent*)untag_ptr(ptr);
3975         assert(obj->tag == LDKMessageSendEvent_SendRevokeAndACK);
3976         LDKRevokeAndACK msg_var = obj->send_revoke_and_ack.msg;
3977                         uint64_t msg_ref = 0;
3978                         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
3979                         msg_ref = tag_ptr(msg_var.inner, false);
3980         return msg_ref;
3981 }
3982 int8_tArray __attribute__((export_name("TS_LDKMessageSendEvent_SendClosingSigned_get_node_id"))) TS_LDKMessageSendEvent_SendClosingSigned_get_node_id(uint64_t ptr) {
3983         LDKMessageSendEvent *obj = (LDKMessageSendEvent*)untag_ptr(ptr);
3984         assert(obj->tag == LDKMessageSendEvent_SendClosingSigned);
3985         int8_tArray node_id_arr = init_int8_tArray(33, __LINE__);
3986         memcpy(node_id_arr->elems, obj->send_closing_signed.node_id.compressed_form, 33);
3987         return node_id_arr;
3988 }
3989 uint64_t __attribute__((export_name("TS_LDKMessageSendEvent_SendClosingSigned_get_msg"))) TS_LDKMessageSendEvent_SendClosingSigned_get_msg(uint64_t ptr) {
3990         LDKMessageSendEvent *obj = (LDKMessageSendEvent*)untag_ptr(ptr);
3991         assert(obj->tag == LDKMessageSendEvent_SendClosingSigned);
3992         LDKClosingSigned msg_var = obj->send_closing_signed.msg;
3993                         uint64_t msg_ref = 0;
3994                         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
3995                         msg_ref = tag_ptr(msg_var.inner, false);
3996         return msg_ref;
3997 }
3998 int8_tArray __attribute__((export_name("TS_LDKMessageSendEvent_SendShutdown_get_node_id"))) TS_LDKMessageSendEvent_SendShutdown_get_node_id(uint64_t ptr) {
3999         LDKMessageSendEvent *obj = (LDKMessageSendEvent*)untag_ptr(ptr);
4000         assert(obj->tag == LDKMessageSendEvent_SendShutdown);
4001         int8_tArray node_id_arr = init_int8_tArray(33, __LINE__);
4002         memcpy(node_id_arr->elems, obj->send_shutdown.node_id.compressed_form, 33);
4003         return node_id_arr;
4004 }
4005 uint64_t __attribute__((export_name("TS_LDKMessageSendEvent_SendShutdown_get_msg"))) TS_LDKMessageSendEvent_SendShutdown_get_msg(uint64_t ptr) {
4006         LDKMessageSendEvent *obj = (LDKMessageSendEvent*)untag_ptr(ptr);
4007         assert(obj->tag == LDKMessageSendEvent_SendShutdown);
4008         LDKShutdown msg_var = obj->send_shutdown.msg;
4009                         uint64_t msg_ref = 0;
4010                         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
4011                         msg_ref = tag_ptr(msg_var.inner, false);
4012         return msg_ref;
4013 }
4014 int8_tArray __attribute__((export_name("TS_LDKMessageSendEvent_SendChannelReestablish_get_node_id"))) TS_LDKMessageSendEvent_SendChannelReestablish_get_node_id(uint64_t ptr) {
4015         LDKMessageSendEvent *obj = (LDKMessageSendEvent*)untag_ptr(ptr);
4016         assert(obj->tag == LDKMessageSendEvent_SendChannelReestablish);
4017         int8_tArray node_id_arr = init_int8_tArray(33, __LINE__);
4018         memcpy(node_id_arr->elems, obj->send_channel_reestablish.node_id.compressed_form, 33);
4019         return node_id_arr;
4020 }
4021 uint64_t __attribute__((export_name("TS_LDKMessageSendEvent_SendChannelReestablish_get_msg"))) TS_LDKMessageSendEvent_SendChannelReestablish_get_msg(uint64_t ptr) {
4022         LDKMessageSendEvent *obj = (LDKMessageSendEvent*)untag_ptr(ptr);
4023         assert(obj->tag == LDKMessageSendEvent_SendChannelReestablish);
4024         LDKChannelReestablish msg_var = obj->send_channel_reestablish.msg;
4025                         uint64_t msg_ref = 0;
4026                         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
4027                         msg_ref = tag_ptr(msg_var.inner, false);
4028         return msg_ref;
4029 }
4030 int8_tArray __attribute__((export_name("TS_LDKMessageSendEvent_SendChannelAnnouncement_get_node_id"))) TS_LDKMessageSendEvent_SendChannelAnnouncement_get_node_id(uint64_t ptr) {
4031         LDKMessageSendEvent *obj = (LDKMessageSendEvent*)untag_ptr(ptr);
4032         assert(obj->tag == LDKMessageSendEvent_SendChannelAnnouncement);
4033         int8_tArray node_id_arr = init_int8_tArray(33, __LINE__);
4034         memcpy(node_id_arr->elems, obj->send_channel_announcement.node_id.compressed_form, 33);
4035         return node_id_arr;
4036 }
4037 uint64_t __attribute__((export_name("TS_LDKMessageSendEvent_SendChannelAnnouncement_get_msg"))) TS_LDKMessageSendEvent_SendChannelAnnouncement_get_msg(uint64_t ptr) {
4038         LDKMessageSendEvent *obj = (LDKMessageSendEvent*)untag_ptr(ptr);
4039         assert(obj->tag == LDKMessageSendEvent_SendChannelAnnouncement);
4040         LDKChannelAnnouncement msg_var = obj->send_channel_announcement.msg;
4041                         uint64_t msg_ref = 0;
4042                         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
4043                         msg_ref = tag_ptr(msg_var.inner, false);
4044         return msg_ref;
4045 }
4046 uint64_t __attribute__((export_name("TS_LDKMessageSendEvent_SendChannelAnnouncement_get_update_msg"))) TS_LDKMessageSendEvent_SendChannelAnnouncement_get_update_msg(uint64_t ptr) {
4047         LDKMessageSendEvent *obj = (LDKMessageSendEvent*)untag_ptr(ptr);
4048         assert(obj->tag == LDKMessageSendEvent_SendChannelAnnouncement);
4049         LDKChannelUpdate update_msg_var = obj->send_channel_announcement.update_msg;
4050                         uint64_t update_msg_ref = 0;
4051                         CHECK_INNER_FIELD_ACCESS_OR_NULL(update_msg_var);
4052                         update_msg_ref = tag_ptr(update_msg_var.inner, false);
4053         return update_msg_ref;
4054 }
4055 uint64_t __attribute__((export_name("TS_LDKMessageSendEvent_BroadcastChannelAnnouncement_get_msg"))) TS_LDKMessageSendEvent_BroadcastChannelAnnouncement_get_msg(uint64_t ptr) {
4056         LDKMessageSendEvent *obj = (LDKMessageSendEvent*)untag_ptr(ptr);
4057         assert(obj->tag == LDKMessageSendEvent_BroadcastChannelAnnouncement);
4058         LDKChannelAnnouncement msg_var = obj->broadcast_channel_announcement.msg;
4059                         uint64_t msg_ref = 0;
4060                         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
4061                         msg_ref = tag_ptr(msg_var.inner, false);
4062         return msg_ref;
4063 }
4064 uint64_t __attribute__((export_name("TS_LDKMessageSendEvent_BroadcastChannelAnnouncement_get_update_msg"))) TS_LDKMessageSendEvent_BroadcastChannelAnnouncement_get_update_msg(uint64_t ptr) {
4065         LDKMessageSendEvent *obj = (LDKMessageSendEvent*)untag_ptr(ptr);
4066         assert(obj->tag == LDKMessageSendEvent_BroadcastChannelAnnouncement);
4067         LDKChannelUpdate update_msg_var = obj->broadcast_channel_announcement.update_msg;
4068                         uint64_t update_msg_ref = 0;
4069                         CHECK_INNER_FIELD_ACCESS_OR_NULL(update_msg_var);
4070                         update_msg_ref = tag_ptr(update_msg_var.inner, false);
4071         return update_msg_ref;
4072 }
4073 uint64_t __attribute__((export_name("TS_LDKMessageSendEvent_BroadcastChannelUpdate_get_msg"))) TS_LDKMessageSendEvent_BroadcastChannelUpdate_get_msg(uint64_t ptr) {
4074         LDKMessageSendEvent *obj = (LDKMessageSendEvent*)untag_ptr(ptr);
4075         assert(obj->tag == LDKMessageSendEvent_BroadcastChannelUpdate);
4076         LDKChannelUpdate msg_var = obj->broadcast_channel_update.msg;
4077                         uint64_t msg_ref = 0;
4078                         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
4079                         msg_ref = tag_ptr(msg_var.inner, false);
4080         return msg_ref;
4081 }
4082 uint64_t __attribute__((export_name("TS_LDKMessageSendEvent_BroadcastNodeAnnouncement_get_msg"))) TS_LDKMessageSendEvent_BroadcastNodeAnnouncement_get_msg(uint64_t ptr) {
4083         LDKMessageSendEvent *obj = (LDKMessageSendEvent*)untag_ptr(ptr);
4084         assert(obj->tag == LDKMessageSendEvent_BroadcastNodeAnnouncement);
4085         LDKNodeAnnouncement msg_var = obj->broadcast_node_announcement.msg;
4086                         uint64_t msg_ref = 0;
4087                         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
4088                         msg_ref = tag_ptr(msg_var.inner, false);
4089         return msg_ref;
4090 }
4091 int8_tArray __attribute__((export_name("TS_LDKMessageSendEvent_SendChannelUpdate_get_node_id"))) TS_LDKMessageSendEvent_SendChannelUpdate_get_node_id(uint64_t ptr) {
4092         LDKMessageSendEvent *obj = (LDKMessageSendEvent*)untag_ptr(ptr);
4093         assert(obj->tag == LDKMessageSendEvent_SendChannelUpdate);
4094         int8_tArray node_id_arr = init_int8_tArray(33, __LINE__);
4095         memcpy(node_id_arr->elems, obj->send_channel_update.node_id.compressed_form, 33);
4096         return node_id_arr;
4097 }
4098 uint64_t __attribute__((export_name("TS_LDKMessageSendEvent_SendChannelUpdate_get_msg"))) TS_LDKMessageSendEvent_SendChannelUpdate_get_msg(uint64_t ptr) {
4099         LDKMessageSendEvent *obj = (LDKMessageSendEvent*)untag_ptr(ptr);
4100         assert(obj->tag == LDKMessageSendEvent_SendChannelUpdate);
4101         LDKChannelUpdate msg_var = obj->send_channel_update.msg;
4102                         uint64_t msg_ref = 0;
4103                         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
4104                         msg_ref = tag_ptr(msg_var.inner, false);
4105         return msg_ref;
4106 }
4107 int8_tArray __attribute__((export_name("TS_LDKMessageSendEvent_HandleError_get_node_id"))) TS_LDKMessageSendEvent_HandleError_get_node_id(uint64_t ptr) {
4108         LDKMessageSendEvent *obj = (LDKMessageSendEvent*)untag_ptr(ptr);
4109         assert(obj->tag == LDKMessageSendEvent_HandleError);
4110         int8_tArray node_id_arr = init_int8_tArray(33, __LINE__);
4111         memcpy(node_id_arr->elems, obj->handle_error.node_id.compressed_form, 33);
4112         return node_id_arr;
4113 }
4114 uint64_t __attribute__((export_name("TS_LDKMessageSendEvent_HandleError_get_action"))) TS_LDKMessageSendEvent_HandleError_get_action(uint64_t ptr) {
4115         LDKMessageSendEvent *obj = (LDKMessageSendEvent*)untag_ptr(ptr);
4116         assert(obj->tag == LDKMessageSendEvent_HandleError);
4117         uint64_t action_ref = tag_ptr(&obj->handle_error.action, false);
4118         return action_ref;
4119 }
4120 int8_tArray __attribute__((export_name("TS_LDKMessageSendEvent_SendChannelRangeQuery_get_node_id"))) TS_LDKMessageSendEvent_SendChannelRangeQuery_get_node_id(uint64_t ptr) {
4121         LDKMessageSendEvent *obj = (LDKMessageSendEvent*)untag_ptr(ptr);
4122         assert(obj->tag == LDKMessageSendEvent_SendChannelRangeQuery);
4123         int8_tArray node_id_arr = init_int8_tArray(33, __LINE__);
4124         memcpy(node_id_arr->elems, obj->send_channel_range_query.node_id.compressed_form, 33);
4125         return node_id_arr;
4126 }
4127 uint64_t __attribute__((export_name("TS_LDKMessageSendEvent_SendChannelRangeQuery_get_msg"))) TS_LDKMessageSendEvent_SendChannelRangeQuery_get_msg(uint64_t ptr) {
4128         LDKMessageSendEvent *obj = (LDKMessageSendEvent*)untag_ptr(ptr);
4129         assert(obj->tag == LDKMessageSendEvent_SendChannelRangeQuery);
4130         LDKQueryChannelRange msg_var = obj->send_channel_range_query.msg;
4131                         uint64_t msg_ref = 0;
4132                         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
4133                         msg_ref = tag_ptr(msg_var.inner, false);
4134         return msg_ref;
4135 }
4136 int8_tArray __attribute__((export_name("TS_LDKMessageSendEvent_SendShortIdsQuery_get_node_id"))) TS_LDKMessageSendEvent_SendShortIdsQuery_get_node_id(uint64_t ptr) {
4137         LDKMessageSendEvent *obj = (LDKMessageSendEvent*)untag_ptr(ptr);
4138         assert(obj->tag == LDKMessageSendEvent_SendShortIdsQuery);
4139         int8_tArray node_id_arr = init_int8_tArray(33, __LINE__);
4140         memcpy(node_id_arr->elems, obj->send_short_ids_query.node_id.compressed_form, 33);
4141         return node_id_arr;
4142 }
4143 uint64_t __attribute__((export_name("TS_LDKMessageSendEvent_SendShortIdsQuery_get_msg"))) TS_LDKMessageSendEvent_SendShortIdsQuery_get_msg(uint64_t ptr) {
4144         LDKMessageSendEvent *obj = (LDKMessageSendEvent*)untag_ptr(ptr);
4145         assert(obj->tag == LDKMessageSendEvent_SendShortIdsQuery);
4146         LDKQueryShortChannelIds msg_var = obj->send_short_ids_query.msg;
4147                         uint64_t msg_ref = 0;
4148                         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
4149                         msg_ref = tag_ptr(msg_var.inner, false);
4150         return msg_ref;
4151 }
4152 int8_tArray __attribute__((export_name("TS_LDKMessageSendEvent_SendReplyChannelRange_get_node_id"))) TS_LDKMessageSendEvent_SendReplyChannelRange_get_node_id(uint64_t ptr) {
4153         LDKMessageSendEvent *obj = (LDKMessageSendEvent*)untag_ptr(ptr);
4154         assert(obj->tag == LDKMessageSendEvent_SendReplyChannelRange);
4155         int8_tArray node_id_arr = init_int8_tArray(33, __LINE__);
4156         memcpy(node_id_arr->elems, obj->send_reply_channel_range.node_id.compressed_form, 33);
4157         return node_id_arr;
4158 }
4159 uint64_t __attribute__((export_name("TS_LDKMessageSendEvent_SendReplyChannelRange_get_msg"))) TS_LDKMessageSendEvent_SendReplyChannelRange_get_msg(uint64_t ptr) {
4160         LDKMessageSendEvent *obj = (LDKMessageSendEvent*)untag_ptr(ptr);
4161         assert(obj->tag == LDKMessageSendEvent_SendReplyChannelRange);
4162         LDKReplyChannelRange msg_var = obj->send_reply_channel_range.msg;
4163                         uint64_t msg_ref = 0;
4164                         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
4165                         msg_ref = tag_ptr(msg_var.inner, false);
4166         return msg_ref;
4167 }
4168 int8_tArray __attribute__((export_name("TS_LDKMessageSendEvent_SendGossipTimestampFilter_get_node_id"))) TS_LDKMessageSendEvent_SendGossipTimestampFilter_get_node_id(uint64_t ptr) {
4169         LDKMessageSendEvent *obj = (LDKMessageSendEvent*)untag_ptr(ptr);
4170         assert(obj->tag == LDKMessageSendEvent_SendGossipTimestampFilter);
4171         int8_tArray node_id_arr = init_int8_tArray(33, __LINE__);
4172         memcpy(node_id_arr->elems, obj->send_gossip_timestamp_filter.node_id.compressed_form, 33);
4173         return node_id_arr;
4174 }
4175 uint64_t __attribute__((export_name("TS_LDKMessageSendEvent_SendGossipTimestampFilter_get_msg"))) TS_LDKMessageSendEvent_SendGossipTimestampFilter_get_msg(uint64_t ptr) {
4176         LDKMessageSendEvent *obj = (LDKMessageSendEvent*)untag_ptr(ptr);
4177         assert(obj->tag == LDKMessageSendEvent_SendGossipTimestampFilter);
4178         LDKGossipTimestampFilter msg_var = obj->send_gossip_timestamp_filter.msg;
4179                         uint64_t msg_ref = 0;
4180                         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
4181                         msg_ref = tag_ptr(msg_var.inner, false);
4182         return msg_ref;
4183 }
4184 static inline LDKCVec_MessageSendEventZ CVec_MessageSendEventZ_clone(const LDKCVec_MessageSendEventZ *orig) {
4185         LDKCVec_MessageSendEventZ ret = { .data = MALLOC(sizeof(LDKMessageSendEvent) * orig->datalen, "LDKCVec_MessageSendEventZ clone bytes"), .datalen = orig->datalen };
4186         for (size_t i = 0; i < ret.datalen; i++) {
4187                 ret.data[i] = MessageSendEvent_clone(&orig->data[i]);
4188         }
4189         return ret;
4190 }
4191 static inline struct LDKChannelUpdateInfo CResult_ChannelUpdateInfoDecodeErrorZ_get_ok(LDKCResult_ChannelUpdateInfoDecodeErrorZ *NONNULL_PTR owner){
4192         LDKChannelUpdateInfo ret = *owner->contents.result;
4193         ret.is_owned = false;
4194         return ret;
4195 }
4196 uint64_t  __attribute__((export_name("TS_CResult_ChannelUpdateInfoDecodeErrorZ_get_ok"))) TS_CResult_ChannelUpdateInfoDecodeErrorZ_get_ok(uint64_t owner) {
4197         LDKCResult_ChannelUpdateInfoDecodeErrorZ* owner_conv = (LDKCResult_ChannelUpdateInfoDecodeErrorZ*)untag_ptr(owner);
4198         LDKChannelUpdateInfo ret_var = CResult_ChannelUpdateInfoDecodeErrorZ_get_ok(owner_conv);
4199         uint64_t ret_ref = 0;
4200         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
4201         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
4202         return ret_ref;
4203 }
4204
4205 static inline struct LDKDecodeError CResult_ChannelUpdateInfoDecodeErrorZ_get_err(LDKCResult_ChannelUpdateInfoDecodeErrorZ *NONNULL_PTR owner){
4206 CHECK(!owner->result_ok);
4207         return DecodeError_clone(&*owner->contents.err);
4208 }
4209 uint64_t  __attribute__((export_name("TS_CResult_ChannelUpdateInfoDecodeErrorZ_get_err"))) TS_CResult_ChannelUpdateInfoDecodeErrorZ_get_err(uint64_t owner) {
4210         LDKCResult_ChannelUpdateInfoDecodeErrorZ* owner_conv = (LDKCResult_ChannelUpdateInfoDecodeErrorZ*)untag_ptr(owner);
4211         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
4212         *ret_copy = CResult_ChannelUpdateInfoDecodeErrorZ_get_err(owner_conv);
4213         uint64_t ret_ref = tag_ptr(ret_copy, true);
4214         return ret_ref;
4215 }
4216
4217 static inline struct LDKChannelInfo CResult_ChannelInfoDecodeErrorZ_get_ok(LDKCResult_ChannelInfoDecodeErrorZ *NONNULL_PTR owner){
4218         LDKChannelInfo ret = *owner->contents.result;
4219         ret.is_owned = false;
4220         return ret;
4221 }
4222 uint64_t  __attribute__((export_name("TS_CResult_ChannelInfoDecodeErrorZ_get_ok"))) TS_CResult_ChannelInfoDecodeErrorZ_get_ok(uint64_t owner) {
4223         LDKCResult_ChannelInfoDecodeErrorZ* owner_conv = (LDKCResult_ChannelInfoDecodeErrorZ*)untag_ptr(owner);
4224         LDKChannelInfo ret_var = CResult_ChannelInfoDecodeErrorZ_get_ok(owner_conv);
4225         uint64_t ret_ref = 0;
4226         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
4227         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
4228         return ret_ref;
4229 }
4230
4231 static inline struct LDKDecodeError CResult_ChannelInfoDecodeErrorZ_get_err(LDKCResult_ChannelInfoDecodeErrorZ *NONNULL_PTR owner){
4232 CHECK(!owner->result_ok);
4233         return DecodeError_clone(&*owner->contents.err);
4234 }
4235 uint64_t  __attribute__((export_name("TS_CResult_ChannelInfoDecodeErrorZ_get_err"))) TS_CResult_ChannelInfoDecodeErrorZ_get_err(uint64_t owner) {
4236         LDKCResult_ChannelInfoDecodeErrorZ* owner_conv = (LDKCResult_ChannelInfoDecodeErrorZ*)untag_ptr(owner);
4237         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
4238         *ret_copy = CResult_ChannelInfoDecodeErrorZ_get_err(owner_conv);
4239         uint64_t ret_ref = tag_ptr(ret_copy, true);
4240         return ret_ref;
4241 }
4242
4243 static inline struct LDKRoutingFees CResult_RoutingFeesDecodeErrorZ_get_ok(LDKCResult_RoutingFeesDecodeErrorZ *NONNULL_PTR owner){
4244         LDKRoutingFees ret = *owner->contents.result;
4245         ret.is_owned = false;
4246         return ret;
4247 }
4248 uint64_t  __attribute__((export_name("TS_CResult_RoutingFeesDecodeErrorZ_get_ok"))) TS_CResult_RoutingFeesDecodeErrorZ_get_ok(uint64_t owner) {
4249         LDKCResult_RoutingFeesDecodeErrorZ* owner_conv = (LDKCResult_RoutingFeesDecodeErrorZ*)untag_ptr(owner);
4250         LDKRoutingFees ret_var = CResult_RoutingFeesDecodeErrorZ_get_ok(owner_conv);
4251         uint64_t ret_ref = 0;
4252         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
4253         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
4254         return ret_ref;
4255 }
4256
4257 static inline struct LDKDecodeError CResult_RoutingFeesDecodeErrorZ_get_err(LDKCResult_RoutingFeesDecodeErrorZ *NONNULL_PTR owner){
4258 CHECK(!owner->result_ok);
4259         return DecodeError_clone(&*owner->contents.err);
4260 }
4261 uint64_t  __attribute__((export_name("TS_CResult_RoutingFeesDecodeErrorZ_get_err"))) TS_CResult_RoutingFeesDecodeErrorZ_get_err(uint64_t owner) {
4262         LDKCResult_RoutingFeesDecodeErrorZ* owner_conv = (LDKCResult_RoutingFeesDecodeErrorZ*)untag_ptr(owner);
4263         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
4264         *ret_copy = CResult_RoutingFeesDecodeErrorZ_get_err(owner_conv);
4265         uint64_t ret_ref = tag_ptr(ret_copy, true);
4266         return ret_ref;
4267 }
4268
4269 uint32_t __attribute__((export_name("TS_LDKSocketAddress_ty_from_ptr"))) TS_LDKSocketAddress_ty_from_ptr(uint64_t ptr) {
4270         LDKSocketAddress *obj = (LDKSocketAddress*)untag_ptr(ptr);
4271         switch(obj->tag) {
4272                 case LDKSocketAddress_TcpIpV4: return 0;
4273                 case LDKSocketAddress_TcpIpV6: return 1;
4274                 case LDKSocketAddress_OnionV2: return 2;
4275                 case LDKSocketAddress_OnionV3: return 3;
4276                 case LDKSocketAddress_Hostname: return 4;
4277                 default: abort();
4278         }
4279 }
4280 int8_tArray __attribute__((export_name("TS_LDKSocketAddress_TcpIpV4_get_addr"))) TS_LDKSocketAddress_TcpIpV4_get_addr(uint64_t ptr) {
4281         LDKSocketAddress *obj = (LDKSocketAddress*)untag_ptr(ptr);
4282         assert(obj->tag == LDKSocketAddress_TcpIpV4);
4283         int8_tArray addr_arr = init_int8_tArray(4, __LINE__);
4284         memcpy(addr_arr->elems, obj->tcp_ip_v4.addr.data, 4);
4285         return addr_arr;
4286 }
4287 int16_t __attribute__((export_name("TS_LDKSocketAddress_TcpIpV4_get_port"))) TS_LDKSocketAddress_TcpIpV4_get_port(uint64_t ptr) {
4288         LDKSocketAddress *obj = (LDKSocketAddress*)untag_ptr(ptr);
4289         assert(obj->tag == LDKSocketAddress_TcpIpV4);
4290         int16_t port_conv = obj->tcp_ip_v4.port;
4291         return port_conv;
4292 }
4293 int8_tArray __attribute__((export_name("TS_LDKSocketAddress_TcpIpV6_get_addr"))) TS_LDKSocketAddress_TcpIpV6_get_addr(uint64_t ptr) {
4294         LDKSocketAddress *obj = (LDKSocketAddress*)untag_ptr(ptr);
4295         assert(obj->tag == LDKSocketAddress_TcpIpV6);
4296         int8_tArray addr_arr = init_int8_tArray(16, __LINE__);
4297         memcpy(addr_arr->elems, obj->tcp_ip_v6.addr.data, 16);
4298         return addr_arr;
4299 }
4300 int16_t __attribute__((export_name("TS_LDKSocketAddress_TcpIpV6_get_port"))) TS_LDKSocketAddress_TcpIpV6_get_port(uint64_t ptr) {
4301         LDKSocketAddress *obj = (LDKSocketAddress*)untag_ptr(ptr);
4302         assert(obj->tag == LDKSocketAddress_TcpIpV6);
4303         int16_t port_conv = obj->tcp_ip_v6.port;
4304         return port_conv;
4305 }
4306 int8_tArray __attribute__((export_name("TS_LDKSocketAddress_OnionV2_get_onion_v2"))) TS_LDKSocketAddress_OnionV2_get_onion_v2(uint64_t ptr) {
4307         LDKSocketAddress *obj = (LDKSocketAddress*)untag_ptr(ptr);
4308         assert(obj->tag == LDKSocketAddress_OnionV2);
4309         int8_tArray onion_v2_arr = init_int8_tArray(12, __LINE__);
4310         memcpy(onion_v2_arr->elems, obj->onion_v2.data, 12);
4311         return onion_v2_arr;
4312 }
4313 int8_tArray __attribute__((export_name("TS_LDKSocketAddress_OnionV3_get_ed25519_pubkey"))) TS_LDKSocketAddress_OnionV3_get_ed25519_pubkey(uint64_t ptr) {
4314         LDKSocketAddress *obj = (LDKSocketAddress*)untag_ptr(ptr);
4315         assert(obj->tag == LDKSocketAddress_OnionV3);
4316         int8_tArray ed25519_pubkey_arr = init_int8_tArray(32, __LINE__);
4317         memcpy(ed25519_pubkey_arr->elems, obj->onion_v3.ed25519_pubkey.data, 32);
4318         return ed25519_pubkey_arr;
4319 }
4320 int16_t __attribute__((export_name("TS_LDKSocketAddress_OnionV3_get_checksum"))) TS_LDKSocketAddress_OnionV3_get_checksum(uint64_t ptr) {
4321         LDKSocketAddress *obj = (LDKSocketAddress*)untag_ptr(ptr);
4322         assert(obj->tag == LDKSocketAddress_OnionV3);
4323         int16_t checksum_conv = obj->onion_v3.checksum;
4324         return checksum_conv;
4325 }
4326 int8_t __attribute__((export_name("TS_LDKSocketAddress_OnionV3_get_version"))) TS_LDKSocketAddress_OnionV3_get_version(uint64_t ptr) {
4327         LDKSocketAddress *obj = (LDKSocketAddress*)untag_ptr(ptr);
4328         assert(obj->tag == LDKSocketAddress_OnionV3);
4329         int8_t version_conv = obj->onion_v3.version;
4330         return version_conv;
4331 }
4332 int16_t __attribute__((export_name("TS_LDKSocketAddress_OnionV3_get_port"))) TS_LDKSocketAddress_OnionV3_get_port(uint64_t ptr) {
4333         LDKSocketAddress *obj = (LDKSocketAddress*)untag_ptr(ptr);
4334         assert(obj->tag == LDKSocketAddress_OnionV3);
4335         int16_t port_conv = obj->onion_v3.port;
4336         return port_conv;
4337 }
4338 uint64_t __attribute__((export_name("TS_LDKSocketAddress_Hostname_get_hostname"))) TS_LDKSocketAddress_Hostname_get_hostname(uint64_t ptr) {
4339         LDKSocketAddress *obj = (LDKSocketAddress*)untag_ptr(ptr);
4340         assert(obj->tag == LDKSocketAddress_Hostname);
4341         LDKHostname hostname_var = obj->hostname.hostname;
4342                         uint64_t hostname_ref = 0;
4343                         CHECK_INNER_FIELD_ACCESS_OR_NULL(hostname_var);
4344                         hostname_ref = tag_ptr(hostname_var.inner, false);
4345         return hostname_ref;
4346 }
4347 int16_t __attribute__((export_name("TS_LDKSocketAddress_Hostname_get_port"))) TS_LDKSocketAddress_Hostname_get_port(uint64_t ptr) {
4348         LDKSocketAddress *obj = (LDKSocketAddress*)untag_ptr(ptr);
4349         assert(obj->tag == LDKSocketAddress_Hostname);
4350         int16_t port_conv = obj->hostname.port;
4351         return port_conv;
4352 }
4353 static inline LDKCVec_SocketAddressZ CVec_SocketAddressZ_clone(const LDKCVec_SocketAddressZ *orig) {
4354         LDKCVec_SocketAddressZ ret = { .data = MALLOC(sizeof(LDKSocketAddress) * orig->datalen, "LDKCVec_SocketAddressZ clone bytes"), .datalen = orig->datalen };
4355         for (size_t i = 0; i < ret.datalen; i++) {
4356                 ret.data[i] = SocketAddress_clone(&orig->data[i]);
4357         }
4358         return ret;
4359 }
4360 static inline struct LDKNodeAnnouncementInfo CResult_NodeAnnouncementInfoDecodeErrorZ_get_ok(LDKCResult_NodeAnnouncementInfoDecodeErrorZ *NONNULL_PTR owner){
4361         LDKNodeAnnouncementInfo ret = *owner->contents.result;
4362         ret.is_owned = false;
4363         return ret;
4364 }
4365 uint64_t  __attribute__((export_name("TS_CResult_NodeAnnouncementInfoDecodeErrorZ_get_ok"))) TS_CResult_NodeAnnouncementInfoDecodeErrorZ_get_ok(uint64_t owner) {
4366         LDKCResult_NodeAnnouncementInfoDecodeErrorZ* owner_conv = (LDKCResult_NodeAnnouncementInfoDecodeErrorZ*)untag_ptr(owner);
4367         LDKNodeAnnouncementInfo ret_var = CResult_NodeAnnouncementInfoDecodeErrorZ_get_ok(owner_conv);
4368         uint64_t ret_ref = 0;
4369         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
4370         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
4371         return ret_ref;
4372 }
4373
4374 static inline struct LDKDecodeError CResult_NodeAnnouncementInfoDecodeErrorZ_get_err(LDKCResult_NodeAnnouncementInfoDecodeErrorZ *NONNULL_PTR owner){
4375 CHECK(!owner->result_ok);
4376         return DecodeError_clone(&*owner->contents.err);
4377 }
4378 uint64_t  __attribute__((export_name("TS_CResult_NodeAnnouncementInfoDecodeErrorZ_get_err"))) TS_CResult_NodeAnnouncementInfoDecodeErrorZ_get_err(uint64_t owner) {
4379         LDKCResult_NodeAnnouncementInfoDecodeErrorZ* owner_conv = (LDKCResult_NodeAnnouncementInfoDecodeErrorZ*)untag_ptr(owner);
4380         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
4381         *ret_copy = CResult_NodeAnnouncementInfoDecodeErrorZ_get_err(owner_conv);
4382         uint64_t ret_ref = tag_ptr(ret_copy, true);
4383         return ret_ref;
4384 }
4385
4386 static inline struct LDKNodeAlias CResult_NodeAliasDecodeErrorZ_get_ok(LDKCResult_NodeAliasDecodeErrorZ *NONNULL_PTR owner){
4387         LDKNodeAlias ret = *owner->contents.result;
4388         ret.is_owned = false;
4389         return ret;
4390 }
4391 uint64_t  __attribute__((export_name("TS_CResult_NodeAliasDecodeErrorZ_get_ok"))) TS_CResult_NodeAliasDecodeErrorZ_get_ok(uint64_t owner) {
4392         LDKCResult_NodeAliasDecodeErrorZ* owner_conv = (LDKCResult_NodeAliasDecodeErrorZ*)untag_ptr(owner);
4393         LDKNodeAlias ret_var = CResult_NodeAliasDecodeErrorZ_get_ok(owner_conv);
4394         uint64_t ret_ref = 0;
4395         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
4396         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
4397         return ret_ref;
4398 }
4399
4400 static inline struct LDKDecodeError CResult_NodeAliasDecodeErrorZ_get_err(LDKCResult_NodeAliasDecodeErrorZ *NONNULL_PTR owner){
4401 CHECK(!owner->result_ok);
4402         return DecodeError_clone(&*owner->contents.err);
4403 }
4404 uint64_t  __attribute__((export_name("TS_CResult_NodeAliasDecodeErrorZ_get_err"))) TS_CResult_NodeAliasDecodeErrorZ_get_err(uint64_t owner) {
4405         LDKCResult_NodeAliasDecodeErrorZ* owner_conv = (LDKCResult_NodeAliasDecodeErrorZ*)untag_ptr(owner);
4406         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
4407         *ret_copy = CResult_NodeAliasDecodeErrorZ_get_err(owner_conv);
4408         uint64_t ret_ref = tag_ptr(ret_copy, true);
4409         return ret_ref;
4410 }
4411
4412 static inline struct LDKNodeInfo CResult_NodeInfoDecodeErrorZ_get_ok(LDKCResult_NodeInfoDecodeErrorZ *NONNULL_PTR owner){
4413         LDKNodeInfo ret = *owner->contents.result;
4414         ret.is_owned = false;
4415         return ret;
4416 }
4417 uint64_t  __attribute__((export_name("TS_CResult_NodeInfoDecodeErrorZ_get_ok"))) TS_CResult_NodeInfoDecodeErrorZ_get_ok(uint64_t owner) {
4418         LDKCResult_NodeInfoDecodeErrorZ* owner_conv = (LDKCResult_NodeInfoDecodeErrorZ*)untag_ptr(owner);
4419         LDKNodeInfo ret_var = CResult_NodeInfoDecodeErrorZ_get_ok(owner_conv);
4420         uint64_t ret_ref = 0;
4421         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
4422         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
4423         return ret_ref;
4424 }
4425
4426 static inline struct LDKDecodeError CResult_NodeInfoDecodeErrorZ_get_err(LDKCResult_NodeInfoDecodeErrorZ *NONNULL_PTR owner){
4427 CHECK(!owner->result_ok);
4428         return DecodeError_clone(&*owner->contents.err);
4429 }
4430 uint64_t  __attribute__((export_name("TS_CResult_NodeInfoDecodeErrorZ_get_err"))) TS_CResult_NodeInfoDecodeErrorZ_get_err(uint64_t owner) {
4431         LDKCResult_NodeInfoDecodeErrorZ* owner_conv = (LDKCResult_NodeInfoDecodeErrorZ*)untag_ptr(owner);
4432         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
4433         *ret_copy = CResult_NodeInfoDecodeErrorZ_get_err(owner_conv);
4434         uint64_t ret_ref = tag_ptr(ret_copy, true);
4435         return ret_ref;
4436 }
4437
4438 static inline struct LDKNetworkGraph CResult_NetworkGraphDecodeErrorZ_get_ok(LDKCResult_NetworkGraphDecodeErrorZ *NONNULL_PTR owner){
4439         LDKNetworkGraph ret = *owner->contents.result;
4440         ret.is_owned = false;
4441         return ret;
4442 }
4443 uint64_t  __attribute__((export_name("TS_CResult_NetworkGraphDecodeErrorZ_get_ok"))) TS_CResult_NetworkGraphDecodeErrorZ_get_ok(uint64_t owner) {
4444         LDKCResult_NetworkGraphDecodeErrorZ* owner_conv = (LDKCResult_NetworkGraphDecodeErrorZ*)untag_ptr(owner);
4445         LDKNetworkGraph ret_var = CResult_NetworkGraphDecodeErrorZ_get_ok(owner_conv);
4446         uint64_t ret_ref = 0;
4447         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
4448         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
4449         return ret_ref;
4450 }
4451
4452 static inline struct LDKDecodeError CResult_NetworkGraphDecodeErrorZ_get_err(LDKCResult_NetworkGraphDecodeErrorZ *NONNULL_PTR owner){
4453 CHECK(!owner->result_ok);
4454         return DecodeError_clone(&*owner->contents.err);
4455 }
4456 uint64_t  __attribute__((export_name("TS_CResult_NetworkGraphDecodeErrorZ_get_err"))) TS_CResult_NetworkGraphDecodeErrorZ_get_err(uint64_t owner) {
4457         LDKCResult_NetworkGraphDecodeErrorZ* owner_conv = (LDKCResult_NetworkGraphDecodeErrorZ*)untag_ptr(owner);
4458         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
4459         *ret_copy = CResult_NetworkGraphDecodeErrorZ_get_err(owner_conv);
4460         uint64_t ret_ref = tag_ptr(ret_copy, true);
4461         return ret_ref;
4462 }
4463
4464 uint32_t __attribute__((export_name("TS_LDKCOption_CVec_SocketAddressZZ_ty_from_ptr"))) TS_LDKCOption_CVec_SocketAddressZZ_ty_from_ptr(uint64_t ptr) {
4465         LDKCOption_CVec_SocketAddressZZ *obj = (LDKCOption_CVec_SocketAddressZZ*)untag_ptr(ptr);
4466         switch(obj->tag) {
4467                 case LDKCOption_CVec_SocketAddressZZ_Some: return 0;
4468                 case LDKCOption_CVec_SocketAddressZZ_None: return 1;
4469                 default: abort();
4470         }
4471 }
4472 uint64_tArray __attribute__((export_name("TS_LDKCOption_CVec_SocketAddressZZ_Some_get_some"))) TS_LDKCOption_CVec_SocketAddressZZ_Some_get_some(uint64_t ptr) {
4473         LDKCOption_CVec_SocketAddressZZ *obj = (LDKCOption_CVec_SocketAddressZZ*)untag_ptr(ptr);
4474         assert(obj->tag == LDKCOption_CVec_SocketAddressZZ_Some);
4475         LDKCVec_SocketAddressZ some_var = obj->some;
4476                         uint64_tArray some_arr = NULL;
4477                         some_arr = init_uint64_tArray(some_var.datalen, __LINE__);
4478                         uint64_t *some_arr_ptr = (uint64_t*)(((uint8_t*)some_arr) + 8);
4479                         for (size_t p = 0; p < some_var.datalen; p++) {
4480                                 uint64_t some_conv_15_ref = tag_ptr(&some_var.data[p], false);
4481                                 some_arr_ptr[p] = some_conv_15_ref;
4482                         }
4483                         
4484         return some_arr;
4485 }
4486 static inline LDKCVec_HTLCOutputInCommitmentZ CVec_HTLCOutputInCommitmentZ_clone(const LDKCVec_HTLCOutputInCommitmentZ *orig) {
4487         LDKCVec_HTLCOutputInCommitmentZ ret = { .data = MALLOC(sizeof(LDKHTLCOutputInCommitment) * orig->datalen, "LDKCVec_HTLCOutputInCommitmentZ clone bytes"), .datalen = orig->datalen };
4488         for (size_t i = 0; i < ret.datalen; i++) {
4489                 ret.data[i] = HTLCOutputInCommitment_clone(&orig->data[i]);
4490         }
4491         return ret;
4492 }
4493 static inline LDKCVec_HTLCDescriptorZ CVec_HTLCDescriptorZ_clone(const LDKCVec_HTLCDescriptorZ *orig) {
4494         LDKCVec_HTLCDescriptorZ ret = { .data = MALLOC(sizeof(LDKHTLCDescriptor) * orig->datalen, "LDKCVec_HTLCDescriptorZ clone bytes"), .datalen = orig->datalen };
4495         for (size_t i = 0; i < ret.datalen; i++) {
4496                 ret.data[i] = HTLCDescriptor_clone(&orig->data[i]);
4497         }
4498         return ret;
4499 }
4500 static inline LDKCVec_UtxoZ CVec_UtxoZ_clone(const LDKCVec_UtxoZ *orig) {
4501         LDKCVec_UtxoZ ret = { .data = MALLOC(sizeof(LDKUtxo) * orig->datalen, "LDKCVec_UtxoZ clone bytes"), .datalen = orig->datalen };
4502         for (size_t i = 0; i < ret.datalen; i++) {
4503                 ret.data[i] = Utxo_clone(&orig->data[i]);
4504         }
4505         return ret;
4506 }
4507 uint32_t __attribute__((export_name("TS_LDKCOption_TxOutZ_ty_from_ptr"))) TS_LDKCOption_TxOutZ_ty_from_ptr(uint64_t ptr) {
4508         LDKCOption_TxOutZ *obj = (LDKCOption_TxOutZ*)untag_ptr(ptr);
4509         switch(obj->tag) {
4510                 case LDKCOption_TxOutZ_Some: return 0;
4511                 case LDKCOption_TxOutZ_None: return 1;
4512                 default: abort();
4513         }
4514 }
4515 uint64_t __attribute__((export_name("TS_LDKCOption_TxOutZ_Some_get_some"))) TS_LDKCOption_TxOutZ_Some_get_some(uint64_t ptr) {
4516         LDKCOption_TxOutZ *obj = (LDKCOption_TxOutZ*)untag_ptr(ptr);
4517         assert(obj->tag == LDKCOption_TxOutZ_Some);
4518         LDKTxOut* some_ref = &obj->some;
4519         return tag_ptr(some_ref, false);
4520 }
4521 static inline LDKCVec_InputZ CVec_InputZ_clone(const LDKCVec_InputZ *orig) {
4522         LDKCVec_InputZ ret = { .data = MALLOC(sizeof(LDKInput) * orig->datalen, "LDKCVec_InputZ clone bytes"), .datalen = orig->datalen };
4523         for (size_t i = 0; i < ret.datalen; i++) {
4524                 ret.data[i] = Input_clone(&orig->data[i]);
4525         }
4526         return ret;
4527 }
4528 static inline struct LDKCoinSelection CResult_CoinSelectionNoneZ_get_ok(LDKCResult_CoinSelectionNoneZ *NONNULL_PTR owner){
4529         LDKCoinSelection ret = *owner->contents.result;
4530         ret.is_owned = false;
4531         return ret;
4532 }
4533 uint64_t  __attribute__((export_name("TS_CResult_CoinSelectionNoneZ_get_ok"))) TS_CResult_CoinSelectionNoneZ_get_ok(uint64_t owner) {
4534         LDKCResult_CoinSelectionNoneZ* owner_conv = (LDKCResult_CoinSelectionNoneZ*)untag_ptr(owner);
4535         LDKCoinSelection ret_var = CResult_CoinSelectionNoneZ_get_ok(owner_conv);
4536         uint64_t ret_ref = 0;
4537         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
4538         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
4539         return ret_ref;
4540 }
4541
4542 static inline void CResult_CoinSelectionNoneZ_get_err(LDKCResult_CoinSelectionNoneZ *NONNULL_PTR owner){
4543 CHECK(!owner->result_ok);
4544         return *owner->contents.err;
4545 }
4546 void  __attribute__((export_name("TS_CResult_CoinSelectionNoneZ_get_err"))) TS_CResult_CoinSelectionNoneZ_get_err(uint64_t owner) {
4547         LDKCResult_CoinSelectionNoneZ* owner_conv = (LDKCResult_CoinSelectionNoneZ*)untag_ptr(owner);
4548         CResult_CoinSelectionNoneZ_get_err(owner_conv);
4549 }
4550
4551 static inline struct LDKCVec_UtxoZ CResult_CVec_UtxoZNoneZ_get_ok(LDKCResult_CVec_UtxoZNoneZ *NONNULL_PTR owner){
4552 CHECK(owner->result_ok);
4553         return CVec_UtxoZ_clone(&*owner->contents.result);
4554 }
4555 uint64_tArray  __attribute__((export_name("TS_CResult_CVec_UtxoZNoneZ_get_ok"))) TS_CResult_CVec_UtxoZNoneZ_get_ok(uint64_t owner) {
4556         LDKCResult_CVec_UtxoZNoneZ* owner_conv = (LDKCResult_CVec_UtxoZNoneZ*)untag_ptr(owner);
4557         LDKCVec_UtxoZ ret_var = CResult_CVec_UtxoZNoneZ_get_ok(owner_conv);
4558         uint64_tArray ret_arr = NULL;
4559         ret_arr = init_uint64_tArray(ret_var.datalen, __LINE__);
4560         uint64_t *ret_arr_ptr = (uint64_t*)(((uint8_t*)ret_arr) + 8);
4561         for (size_t g = 0; g < ret_var.datalen; g++) {
4562                 LDKUtxo ret_conv_6_var = ret_var.data[g];
4563                 uint64_t ret_conv_6_ref = 0;
4564                 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_conv_6_var);
4565                 ret_conv_6_ref = tag_ptr(ret_conv_6_var.inner, ret_conv_6_var.is_owned);
4566                 ret_arr_ptr[g] = ret_conv_6_ref;
4567         }
4568         
4569         FREE(ret_var.data);
4570         return ret_arr;
4571 }
4572
4573 static inline void CResult_CVec_UtxoZNoneZ_get_err(LDKCResult_CVec_UtxoZNoneZ *NONNULL_PTR owner){
4574 CHECK(!owner->result_ok);
4575         return *owner->contents.err;
4576 }
4577 void  __attribute__((export_name("TS_CResult_CVec_UtxoZNoneZ_get_err"))) TS_CResult_CVec_UtxoZNoneZ_get_err(uint64_t owner) {
4578         LDKCResult_CVec_UtxoZNoneZ* owner_conv = (LDKCResult_CVec_UtxoZNoneZ*)untag_ptr(owner);
4579         CResult_CVec_UtxoZNoneZ_get_err(owner_conv);
4580 }
4581
4582 static inline uint64_t C2Tuple_u64u16Z_get_a(LDKC2Tuple_u64u16Z *NONNULL_PTR owner){
4583         return owner->a;
4584 }
4585 int64_t  __attribute__((export_name("TS_C2Tuple_u64u16Z_get_a"))) TS_C2Tuple_u64u16Z_get_a(uint64_t owner) {
4586         LDKC2Tuple_u64u16Z* owner_conv = (LDKC2Tuple_u64u16Z*)untag_ptr(owner);
4587         int64_t ret_conv = C2Tuple_u64u16Z_get_a(owner_conv);
4588         return ret_conv;
4589 }
4590
4591 static inline uint16_t C2Tuple_u64u16Z_get_b(LDKC2Tuple_u64u16Z *NONNULL_PTR owner){
4592         return owner->b;
4593 }
4594 int16_t  __attribute__((export_name("TS_C2Tuple_u64u16Z_get_b"))) TS_C2Tuple_u64u16Z_get_b(uint64_t owner) {
4595         LDKC2Tuple_u64u16Z* owner_conv = (LDKC2Tuple_u64u16Z*)untag_ptr(owner);
4596         int16_t ret_conv = C2Tuple_u64u16Z_get_b(owner_conv);
4597         return ret_conv;
4598 }
4599
4600 uint32_t __attribute__((export_name("TS_LDKCOption_C2Tuple_u64u16ZZ_ty_from_ptr"))) TS_LDKCOption_C2Tuple_u64u16ZZ_ty_from_ptr(uint64_t ptr) {
4601         LDKCOption_C2Tuple_u64u16ZZ *obj = (LDKCOption_C2Tuple_u64u16ZZ*)untag_ptr(ptr);
4602         switch(obj->tag) {
4603                 case LDKCOption_C2Tuple_u64u16ZZ_Some: return 0;
4604                 case LDKCOption_C2Tuple_u64u16ZZ_None: return 1;
4605                 default: abort();
4606         }
4607 }
4608 uint64_t __attribute__((export_name("TS_LDKCOption_C2Tuple_u64u16ZZ_Some_get_some"))) TS_LDKCOption_C2Tuple_u64u16ZZ_Some_get_some(uint64_t ptr) {
4609         LDKCOption_C2Tuple_u64u16ZZ *obj = (LDKCOption_C2Tuple_u64u16ZZ*)untag_ptr(ptr);
4610         assert(obj->tag == LDKCOption_C2Tuple_u64u16ZZ_Some);
4611         LDKC2Tuple_u64u16Z* some_conv = MALLOC(sizeof(LDKC2Tuple_u64u16Z), "LDKC2Tuple_u64u16Z");
4612         *some_conv = obj->some;
4613                         *some_conv = C2Tuple_u64u16Z_clone(some_conv);
4614         return tag_ptr(some_conv, true);
4615 }
4616 uint32_t __attribute__((export_name("TS_LDKCOption_ChannelShutdownStateZ_ty_from_ptr"))) TS_LDKCOption_ChannelShutdownStateZ_ty_from_ptr(uint64_t ptr) {
4617         LDKCOption_ChannelShutdownStateZ *obj = (LDKCOption_ChannelShutdownStateZ*)untag_ptr(ptr);
4618         switch(obj->tag) {
4619                 case LDKCOption_ChannelShutdownStateZ_Some: return 0;
4620                 case LDKCOption_ChannelShutdownStateZ_None: return 1;
4621                 default: abort();
4622         }
4623 }
4624 uint32_t __attribute__((export_name("TS_LDKCOption_ChannelShutdownStateZ_Some_get_some"))) TS_LDKCOption_ChannelShutdownStateZ_Some_get_some(uint64_t ptr) {
4625         LDKCOption_ChannelShutdownStateZ *obj = (LDKCOption_ChannelShutdownStateZ*)untag_ptr(ptr);
4626         assert(obj->tag == LDKCOption_ChannelShutdownStateZ_Some);
4627         uint32_t some_conv = LDKChannelShutdownState_to_js(obj->some);
4628         return some_conv;
4629 }
4630 static inline struct LDKThirtyTwoBytes CResult_ThirtyTwoBytesAPIErrorZ_get_ok(LDKCResult_ThirtyTwoBytesAPIErrorZ *NONNULL_PTR owner){
4631 CHECK(owner->result_ok);
4632         return ThirtyTwoBytes_clone(&*owner->contents.result);
4633 }
4634 int8_tArray  __attribute__((export_name("TS_CResult_ThirtyTwoBytesAPIErrorZ_get_ok"))) TS_CResult_ThirtyTwoBytesAPIErrorZ_get_ok(uint64_t owner) {
4635         LDKCResult_ThirtyTwoBytesAPIErrorZ* owner_conv = (LDKCResult_ThirtyTwoBytesAPIErrorZ*)untag_ptr(owner);
4636         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
4637         memcpy(ret_arr->elems, CResult_ThirtyTwoBytesAPIErrorZ_get_ok(owner_conv).data, 32);
4638         return ret_arr;
4639 }
4640
4641 static inline struct LDKAPIError CResult_ThirtyTwoBytesAPIErrorZ_get_err(LDKCResult_ThirtyTwoBytesAPIErrorZ *NONNULL_PTR owner){
4642 CHECK(!owner->result_ok);
4643         return APIError_clone(&*owner->contents.err);
4644 }
4645 uint64_t  __attribute__((export_name("TS_CResult_ThirtyTwoBytesAPIErrorZ_get_err"))) TS_CResult_ThirtyTwoBytesAPIErrorZ_get_err(uint64_t owner) {
4646         LDKCResult_ThirtyTwoBytesAPIErrorZ* owner_conv = (LDKCResult_ThirtyTwoBytesAPIErrorZ*)untag_ptr(owner);
4647         LDKAPIError *ret_copy = MALLOC(sizeof(LDKAPIError), "LDKAPIError");
4648         *ret_copy = CResult_ThirtyTwoBytesAPIErrorZ_get_err(owner_conv);
4649         uint64_t ret_ref = tag_ptr(ret_copy, true);
4650         return ret_ref;
4651 }
4652
4653 uint32_t __attribute__((export_name("TS_LDKRecentPaymentDetails_ty_from_ptr"))) TS_LDKRecentPaymentDetails_ty_from_ptr(uint64_t ptr) {
4654         LDKRecentPaymentDetails *obj = (LDKRecentPaymentDetails*)untag_ptr(ptr);
4655         switch(obj->tag) {
4656                 case LDKRecentPaymentDetails_AwaitingInvoice: return 0;
4657                 case LDKRecentPaymentDetails_Pending: return 1;
4658                 case LDKRecentPaymentDetails_Fulfilled: return 2;
4659                 case LDKRecentPaymentDetails_Abandoned: return 3;
4660                 default: abort();
4661         }
4662 }
4663 int8_tArray __attribute__((export_name("TS_LDKRecentPaymentDetails_AwaitingInvoice_get_payment_id"))) TS_LDKRecentPaymentDetails_AwaitingInvoice_get_payment_id(uint64_t ptr) {
4664         LDKRecentPaymentDetails *obj = (LDKRecentPaymentDetails*)untag_ptr(ptr);
4665         assert(obj->tag == LDKRecentPaymentDetails_AwaitingInvoice);
4666         int8_tArray payment_id_arr = init_int8_tArray(32, __LINE__);
4667         memcpy(payment_id_arr->elems, obj->awaiting_invoice.payment_id.data, 32);
4668         return payment_id_arr;
4669 }
4670 int8_tArray __attribute__((export_name("TS_LDKRecentPaymentDetails_Pending_get_payment_id"))) TS_LDKRecentPaymentDetails_Pending_get_payment_id(uint64_t ptr) {
4671         LDKRecentPaymentDetails *obj = (LDKRecentPaymentDetails*)untag_ptr(ptr);
4672         assert(obj->tag == LDKRecentPaymentDetails_Pending);
4673         int8_tArray payment_id_arr = init_int8_tArray(32, __LINE__);
4674         memcpy(payment_id_arr->elems, obj->pending.payment_id.data, 32);
4675         return payment_id_arr;
4676 }
4677 int8_tArray __attribute__((export_name("TS_LDKRecentPaymentDetails_Pending_get_payment_hash"))) TS_LDKRecentPaymentDetails_Pending_get_payment_hash(uint64_t ptr) {
4678         LDKRecentPaymentDetails *obj = (LDKRecentPaymentDetails*)untag_ptr(ptr);
4679         assert(obj->tag == LDKRecentPaymentDetails_Pending);
4680         int8_tArray payment_hash_arr = init_int8_tArray(32, __LINE__);
4681         memcpy(payment_hash_arr->elems, obj->pending.payment_hash.data, 32);
4682         return payment_hash_arr;
4683 }
4684 int64_t __attribute__((export_name("TS_LDKRecentPaymentDetails_Pending_get_total_msat"))) TS_LDKRecentPaymentDetails_Pending_get_total_msat(uint64_t ptr) {
4685         LDKRecentPaymentDetails *obj = (LDKRecentPaymentDetails*)untag_ptr(ptr);
4686         assert(obj->tag == LDKRecentPaymentDetails_Pending);
4687         int64_t total_msat_conv = obj->pending.total_msat;
4688         return total_msat_conv;
4689 }
4690 int8_tArray __attribute__((export_name("TS_LDKRecentPaymentDetails_Fulfilled_get_payment_id"))) TS_LDKRecentPaymentDetails_Fulfilled_get_payment_id(uint64_t ptr) {
4691         LDKRecentPaymentDetails *obj = (LDKRecentPaymentDetails*)untag_ptr(ptr);
4692         assert(obj->tag == LDKRecentPaymentDetails_Fulfilled);
4693         int8_tArray payment_id_arr = init_int8_tArray(32, __LINE__);
4694         memcpy(payment_id_arr->elems, obj->fulfilled.payment_id.data, 32);
4695         return payment_id_arr;
4696 }
4697 uint64_t __attribute__((export_name("TS_LDKRecentPaymentDetails_Fulfilled_get_payment_hash"))) TS_LDKRecentPaymentDetails_Fulfilled_get_payment_hash(uint64_t ptr) {
4698         LDKRecentPaymentDetails *obj = (LDKRecentPaymentDetails*)untag_ptr(ptr);
4699         assert(obj->tag == LDKRecentPaymentDetails_Fulfilled);
4700         uint64_t payment_hash_ref = tag_ptr(&obj->fulfilled.payment_hash, false);
4701         return payment_hash_ref;
4702 }
4703 int8_tArray __attribute__((export_name("TS_LDKRecentPaymentDetails_Abandoned_get_payment_id"))) TS_LDKRecentPaymentDetails_Abandoned_get_payment_id(uint64_t ptr) {
4704         LDKRecentPaymentDetails *obj = (LDKRecentPaymentDetails*)untag_ptr(ptr);
4705         assert(obj->tag == LDKRecentPaymentDetails_Abandoned);
4706         int8_tArray payment_id_arr = init_int8_tArray(32, __LINE__);
4707         memcpy(payment_id_arr->elems, obj->abandoned.payment_id.data, 32);
4708         return payment_id_arr;
4709 }
4710 int8_tArray __attribute__((export_name("TS_LDKRecentPaymentDetails_Abandoned_get_payment_hash"))) TS_LDKRecentPaymentDetails_Abandoned_get_payment_hash(uint64_t ptr) {
4711         LDKRecentPaymentDetails *obj = (LDKRecentPaymentDetails*)untag_ptr(ptr);
4712         assert(obj->tag == LDKRecentPaymentDetails_Abandoned);
4713         int8_tArray payment_hash_arr = init_int8_tArray(32, __LINE__);
4714         memcpy(payment_hash_arr->elems, obj->abandoned.payment_hash.data, 32);
4715         return payment_hash_arr;
4716 }
4717 static inline LDKCVec_RecentPaymentDetailsZ CVec_RecentPaymentDetailsZ_clone(const LDKCVec_RecentPaymentDetailsZ *orig) {
4718         LDKCVec_RecentPaymentDetailsZ ret = { .data = MALLOC(sizeof(LDKRecentPaymentDetails) * orig->datalen, "LDKCVec_RecentPaymentDetailsZ clone bytes"), .datalen = orig->datalen };
4719         for (size_t i = 0; i < ret.datalen; i++) {
4720                 ret.data[i] = RecentPaymentDetails_clone(&orig->data[i]);
4721         }
4722         return ret;
4723 }
4724 uint32_t __attribute__((export_name("TS_LDKPaymentSendFailure_ty_from_ptr"))) TS_LDKPaymentSendFailure_ty_from_ptr(uint64_t ptr) {
4725         LDKPaymentSendFailure *obj = (LDKPaymentSendFailure*)untag_ptr(ptr);
4726         switch(obj->tag) {
4727                 case LDKPaymentSendFailure_ParameterError: return 0;
4728                 case LDKPaymentSendFailure_PathParameterError: return 1;
4729                 case LDKPaymentSendFailure_AllFailedResendSafe: return 2;
4730                 case LDKPaymentSendFailure_DuplicatePayment: return 3;
4731                 case LDKPaymentSendFailure_PartialFailure: return 4;
4732                 default: abort();
4733         }
4734 }
4735 uint64_t __attribute__((export_name("TS_LDKPaymentSendFailure_ParameterError_get_parameter_error"))) TS_LDKPaymentSendFailure_ParameterError_get_parameter_error(uint64_t ptr) {
4736         LDKPaymentSendFailure *obj = (LDKPaymentSendFailure*)untag_ptr(ptr);
4737         assert(obj->tag == LDKPaymentSendFailure_ParameterError);
4738         uint64_t parameter_error_ref = tag_ptr(&obj->parameter_error, false);
4739         return parameter_error_ref;
4740 }
4741 uint64_tArray __attribute__((export_name("TS_LDKPaymentSendFailure_PathParameterError_get_path_parameter_error"))) TS_LDKPaymentSendFailure_PathParameterError_get_path_parameter_error(uint64_t ptr) {
4742         LDKPaymentSendFailure *obj = (LDKPaymentSendFailure*)untag_ptr(ptr);
4743         assert(obj->tag == LDKPaymentSendFailure_PathParameterError);
4744         LDKCVec_CResult_NoneAPIErrorZZ path_parameter_error_var = obj->path_parameter_error;
4745                         uint64_tArray path_parameter_error_arr = NULL;
4746                         path_parameter_error_arr = init_uint64_tArray(path_parameter_error_var.datalen, __LINE__);
4747                         uint64_t *path_parameter_error_arr_ptr = (uint64_t*)(((uint8_t*)path_parameter_error_arr) + 8);
4748                         for (size_t w = 0; w < path_parameter_error_var.datalen; w++) {
4749                                 LDKCResult_NoneAPIErrorZ* path_parameter_error_conv_22_conv = MALLOC(sizeof(LDKCResult_NoneAPIErrorZ), "LDKCResult_NoneAPIErrorZ");
4750                                 *path_parameter_error_conv_22_conv = path_parameter_error_var.data[w];
4751                                 *path_parameter_error_conv_22_conv = CResult_NoneAPIErrorZ_clone(path_parameter_error_conv_22_conv);
4752                                 path_parameter_error_arr_ptr[w] = tag_ptr(path_parameter_error_conv_22_conv, true);
4753                         }
4754                         
4755         return path_parameter_error_arr;
4756 }
4757 uint64_tArray __attribute__((export_name("TS_LDKPaymentSendFailure_AllFailedResendSafe_get_all_failed_resend_safe"))) TS_LDKPaymentSendFailure_AllFailedResendSafe_get_all_failed_resend_safe(uint64_t ptr) {
4758         LDKPaymentSendFailure *obj = (LDKPaymentSendFailure*)untag_ptr(ptr);
4759         assert(obj->tag == LDKPaymentSendFailure_AllFailedResendSafe);
4760         LDKCVec_APIErrorZ all_failed_resend_safe_var = obj->all_failed_resend_safe;
4761                         uint64_tArray all_failed_resend_safe_arr = NULL;
4762                         all_failed_resend_safe_arr = init_uint64_tArray(all_failed_resend_safe_var.datalen, __LINE__);
4763                         uint64_t *all_failed_resend_safe_arr_ptr = (uint64_t*)(((uint8_t*)all_failed_resend_safe_arr) + 8);
4764                         for (size_t k = 0; k < all_failed_resend_safe_var.datalen; k++) {
4765                                 uint64_t all_failed_resend_safe_conv_10_ref = tag_ptr(&all_failed_resend_safe_var.data[k], false);
4766                                 all_failed_resend_safe_arr_ptr[k] = all_failed_resend_safe_conv_10_ref;
4767                         }
4768                         
4769         return all_failed_resend_safe_arr;
4770 }
4771 uint64_tArray __attribute__((export_name("TS_LDKPaymentSendFailure_PartialFailure_get_results"))) TS_LDKPaymentSendFailure_PartialFailure_get_results(uint64_t ptr) {
4772         LDKPaymentSendFailure *obj = (LDKPaymentSendFailure*)untag_ptr(ptr);
4773         assert(obj->tag == LDKPaymentSendFailure_PartialFailure);
4774         LDKCVec_CResult_NoneAPIErrorZZ results_var = obj->partial_failure.results;
4775                         uint64_tArray results_arr = NULL;
4776                         results_arr = init_uint64_tArray(results_var.datalen, __LINE__);
4777                         uint64_t *results_arr_ptr = (uint64_t*)(((uint8_t*)results_arr) + 8);
4778                         for (size_t w = 0; w < results_var.datalen; w++) {
4779                                 LDKCResult_NoneAPIErrorZ* results_conv_22_conv = MALLOC(sizeof(LDKCResult_NoneAPIErrorZ), "LDKCResult_NoneAPIErrorZ");
4780                                 *results_conv_22_conv = results_var.data[w];
4781                                 *results_conv_22_conv = CResult_NoneAPIErrorZ_clone(results_conv_22_conv);
4782                                 results_arr_ptr[w] = tag_ptr(results_conv_22_conv, true);
4783                         }
4784                         
4785         return results_arr;
4786 }
4787 uint64_t __attribute__((export_name("TS_LDKPaymentSendFailure_PartialFailure_get_failed_paths_retry"))) TS_LDKPaymentSendFailure_PartialFailure_get_failed_paths_retry(uint64_t ptr) {
4788         LDKPaymentSendFailure *obj = (LDKPaymentSendFailure*)untag_ptr(ptr);
4789         assert(obj->tag == LDKPaymentSendFailure_PartialFailure);
4790         LDKRouteParameters failed_paths_retry_var = obj->partial_failure.failed_paths_retry;
4791                         uint64_t failed_paths_retry_ref = 0;
4792                         CHECK_INNER_FIELD_ACCESS_OR_NULL(failed_paths_retry_var);
4793                         failed_paths_retry_ref = tag_ptr(failed_paths_retry_var.inner, false);
4794         return failed_paths_retry_ref;
4795 }
4796 int8_tArray __attribute__((export_name("TS_LDKPaymentSendFailure_PartialFailure_get_payment_id"))) TS_LDKPaymentSendFailure_PartialFailure_get_payment_id(uint64_t ptr) {
4797         LDKPaymentSendFailure *obj = (LDKPaymentSendFailure*)untag_ptr(ptr);
4798         assert(obj->tag == LDKPaymentSendFailure_PartialFailure);
4799         int8_tArray payment_id_arr = init_int8_tArray(32, __LINE__);
4800         memcpy(payment_id_arr->elems, obj->partial_failure.payment_id.data, 32);
4801         return payment_id_arr;
4802 }
4803 static inline void CResult_NonePaymentSendFailureZ_get_ok(LDKCResult_NonePaymentSendFailureZ *NONNULL_PTR owner){
4804 CHECK(owner->result_ok);
4805         return *owner->contents.result;
4806 }
4807 void  __attribute__((export_name("TS_CResult_NonePaymentSendFailureZ_get_ok"))) TS_CResult_NonePaymentSendFailureZ_get_ok(uint64_t owner) {
4808         LDKCResult_NonePaymentSendFailureZ* owner_conv = (LDKCResult_NonePaymentSendFailureZ*)untag_ptr(owner);
4809         CResult_NonePaymentSendFailureZ_get_ok(owner_conv);
4810 }
4811
4812 static inline struct LDKPaymentSendFailure CResult_NonePaymentSendFailureZ_get_err(LDKCResult_NonePaymentSendFailureZ *NONNULL_PTR owner){
4813 CHECK(!owner->result_ok);
4814         return PaymentSendFailure_clone(&*owner->contents.err);
4815 }
4816 uint64_t  __attribute__((export_name("TS_CResult_NonePaymentSendFailureZ_get_err"))) TS_CResult_NonePaymentSendFailureZ_get_err(uint64_t owner) {
4817         LDKCResult_NonePaymentSendFailureZ* owner_conv = (LDKCResult_NonePaymentSendFailureZ*)untag_ptr(owner);
4818         LDKPaymentSendFailure *ret_copy = MALLOC(sizeof(LDKPaymentSendFailure), "LDKPaymentSendFailure");
4819         *ret_copy = CResult_NonePaymentSendFailureZ_get_err(owner_conv);
4820         uint64_t ret_ref = tag_ptr(ret_copy, true);
4821         return ret_ref;
4822 }
4823
4824 static inline void CResult_NoneRetryableSendFailureZ_get_ok(LDKCResult_NoneRetryableSendFailureZ *NONNULL_PTR owner){
4825 CHECK(owner->result_ok);
4826         return *owner->contents.result;
4827 }
4828 void  __attribute__((export_name("TS_CResult_NoneRetryableSendFailureZ_get_ok"))) TS_CResult_NoneRetryableSendFailureZ_get_ok(uint64_t owner) {
4829         LDKCResult_NoneRetryableSendFailureZ* owner_conv = (LDKCResult_NoneRetryableSendFailureZ*)untag_ptr(owner);
4830         CResult_NoneRetryableSendFailureZ_get_ok(owner_conv);
4831 }
4832
4833 static inline enum LDKRetryableSendFailure CResult_NoneRetryableSendFailureZ_get_err(LDKCResult_NoneRetryableSendFailureZ *NONNULL_PTR owner){
4834 CHECK(!owner->result_ok);
4835         return RetryableSendFailure_clone(&*owner->contents.err);
4836 }
4837 uint32_t  __attribute__((export_name("TS_CResult_NoneRetryableSendFailureZ_get_err"))) TS_CResult_NoneRetryableSendFailureZ_get_err(uint64_t owner) {
4838         LDKCResult_NoneRetryableSendFailureZ* owner_conv = (LDKCResult_NoneRetryableSendFailureZ*)untag_ptr(owner);
4839         uint32_t ret_conv = LDKRetryableSendFailure_to_js(CResult_NoneRetryableSendFailureZ_get_err(owner_conv));
4840         return ret_conv;
4841 }
4842
4843 static inline struct LDKThirtyTwoBytes CResult_ThirtyTwoBytesPaymentSendFailureZ_get_ok(LDKCResult_ThirtyTwoBytesPaymentSendFailureZ *NONNULL_PTR owner){
4844 CHECK(owner->result_ok);
4845         return ThirtyTwoBytes_clone(&*owner->contents.result);
4846 }
4847 int8_tArray  __attribute__((export_name("TS_CResult_ThirtyTwoBytesPaymentSendFailureZ_get_ok"))) TS_CResult_ThirtyTwoBytesPaymentSendFailureZ_get_ok(uint64_t owner) {
4848         LDKCResult_ThirtyTwoBytesPaymentSendFailureZ* owner_conv = (LDKCResult_ThirtyTwoBytesPaymentSendFailureZ*)untag_ptr(owner);
4849         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
4850         memcpy(ret_arr->elems, CResult_ThirtyTwoBytesPaymentSendFailureZ_get_ok(owner_conv).data, 32);
4851         return ret_arr;
4852 }
4853
4854 static inline struct LDKPaymentSendFailure CResult_ThirtyTwoBytesPaymentSendFailureZ_get_err(LDKCResult_ThirtyTwoBytesPaymentSendFailureZ *NONNULL_PTR owner){
4855 CHECK(!owner->result_ok);
4856         return PaymentSendFailure_clone(&*owner->contents.err);
4857 }
4858 uint64_t  __attribute__((export_name("TS_CResult_ThirtyTwoBytesPaymentSendFailureZ_get_err"))) TS_CResult_ThirtyTwoBytesPaymentSendFailureZ_get_err(uint64_t owner) {
4859         LDKCResult_ThirtyTwoBytesPaymentSendFailureZ* owner_conv = (LDKCResult_ThirtyTwoBytesPaymentSendFailureZ*)untag_ptr(owner);
4860         LDKPaymentSendFailure *ret_copy = MALLOC(sizeof(LDKPaymentSendFailure), "LDKPaymentSendFailure");
4861         *ret_copy = CResult_ThirtyTwoBytesPaymentSendFailureZ_get_err(owner_conv);
4862         uint64_t ret_ref = tag_ptr(ret_copy, true);
4863         return ret_ref;
4864 }
4865
4866 static inline struct LDKThirtyTwoBytes CResult_ThirtyTwoBytesRetryableSendFailureZ_get_ok(LDKCResult_ThirtyTwoBytesRetryableSendFailureZ *NONNULL_PTR owner){
4867 CHECK(owner->result_ok);
4868         return ThirtyTwoBytes_clone(&*owner->contents.result);
4869 }
4870 int8_tArray  __attribute__((export_name("TS_CResult_ThirtyTwoBytesRetryableSendFailureZ_get_ok"))) TS_CResult_ThirtyTwoBytesRetryableSendFailureZ_get_ok(uint64_t owner) {
4871         LDKCResult_ThirtyTwoBytesRetryableSendFailureZ* owner_conv = (LDKCResult_ThirtyTwoBytesRetryableSendFailureZ*)untag_ptr(owner);
4872         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
4873         memcpy(ret_arr->elems, CResult_ThirtyTwoBytesRetryableSendFailureZ_get_ok(owner_conv).data, 32);
4874         return ret_arr;
4875 }
4876
4877 static inline enum LDKRetryableSendFailure CResult_ThirtyTwoBytesRetryableSendFailureZ_get_err(LDKCResult_ThirtyTwoBytesRetryableSendFailureZ *NONNULL_PTR owner){
4878 CHECK(!owner->result_ok);
4879         return RetryableSendFailure_clone(&*owner->contents.err);
4880 }
4881 uint32_t  __attribute__((export_name("TS_CResult_ThirtyTwoBytesRetryableSendFailureZ_get_err"))) TS_CResult_ThirtyTwoBytesRetryableSendFailureZ_get_err(uint64_t owner) {
4882         LDKCResult_ThirtyTwoBytesRetryableSendFailureZ* owner_conv = (LDKCResult_ThirtyTwoBytesRetryableSendFailureZ*)untag_ptr(owner);
4883         uint32_t ret_conv = LDKRetryableSendFailure_to_js(CResult_ThirtyTwoBytesRetryableSendFailureZ_get_err(owner_conv));
4884         return ret_conv;
4885 }
4886
4887 static inline struct LDKThirtyTwoBytes C2Tuple_ThirtyTwoBytesThirtyTwoBytesZ_get_a(LDKC2Tuple_ThirtyTwoBytesThirtyTwoBytesZ *NONNULL_PTR owner){
4888         return ThirtyTwoBytes_clone(&owner->a);
4889 }
4890 int8_tArray  __attribute__((export_name("TS_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZ_get_a"))) TS_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZ_get_a(uint64_t owner) {
4891         LDKC2Tuple_ThirtyTwoBytesThirtyTwoBytesZ* owner_conv = (LDKC2Tuple_ThirtyTwoBytesThirtyTwoBytesZ*)untag_ptr(owner);
4892         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
4893         memcpy(ret_arr->elems, C2Tuple_ThirtyTwoBytesThirtyTwoBytesZ_get_a(owner_conv).data, 32);
4894         return ret_arr;
4895 }
4896
4897 static inline struct LDKThirtyTwoBytes C2Tuple_ThirtyTwoBytesThirtyTwoBytesZ_get_b(LDKC2Tuple_ThirtyTwoBytesThirtyTwoBytesZ *NONNULL_PTR owner){
4898         return ThirtyTwoBytes_clone(&owner->b);
4899 }
4900 int8_tArray  __attribute__((export_name("TS_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZ_get_b"))) TS_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZ_get_b(uint64_t owner) {
4901         LDKC2Tuple_ThirtyTwoBytesThirtyTwoBytesZ* owner_conv = (LDKC2Tuple_ThirtyTwoBytesThirtyTwoBytesZ*)untag_ptr(owner);
4902         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
4903         memcpy(ret_arr->elems, C2Tuple_ThirtyTwoBytesThirtyTwoBytesZ_get_b(owner_conv).data, 32);
4904         return ret_arr;
4905 }
4906
4907 static inline struct LDKC2Tuple_ThirtyTwoBytesThirtyTwoBytesZ CResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZPaymentSendFailureZ_get_ok(LDKCResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZPaymentSendFailureZ *NONNULL_PTR owner){
4908 CHECK(owner->result_ok);
4909         return C2Tuple_ThirtyTwoBytesThirtyTwoBytesZ_clone(&*owner->contents.result);
4910 }
4911 uint64_t  __attribute__((export_name("TS_CResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZPaymentSendFailureZ_get_ok"))) TS_CResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZPaymentSendFailureZ_get_ok(uint64_t owner) {
4912         LDKCResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZPaymentSendFailureZ* owner_conv = (LDKCResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZPaymentSendFailureZ*)untag_ptr(owner);
4913         LDKC2Tuple_ThirtyTwoBytesThirtyTwoBytesZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_ThirtyTwoBytesThirtyTwoBytesZ), "LDKC2Tuple_ThirtyTwoBytesThirtyTwoBytesZ");
4914         *ret_conv = CResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZPaymentSendFailureZ_get_ok(owner_conv);
4915         return tag_ptr(ret_conv, true);
4916 }
4917
4918 static inline struct LDKPaymentSendFailure CResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZPaymentSendFailureZ_get_err(LDKCResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZPaymentSendFailureZ *NONNULL_PTR owner){
4919 CHECK(!owner->result_ok);
4920         return PaymentSendFailure_clone(&*owner->contents.err);
4921 }
4922 uint64_t  __attribute__((export_name("TS_CResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZPaymentSendFailureZ_get_err"))) TS_CResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZPaymentSendFailureZ_get_err(uint64_t owner) {
4923         LDKCResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZPaymentSendFailureZ* owner_conv = (LDKCResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZPaymentSendFailureZ*)untag_ptr(owner);
4924         LDKPaymentSendFailure *ret_copy = MALLOC(sizeof(LDKPaymentSendFailure), "LDKPaymentSendFailure");
4925         *ret_copy = CResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZPaymentSendFailureZ_get_err(owner_conv);
4926         uint64_t ret_ref = tag_ptr(ret_copy, true);
4927         return ret_ref;
4928 }
4929
4930 static inline LDKCVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZ CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZ_clone(const LDKCVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZ *orig) {
4931         LDKCVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZ ret = { .data = MALLOC(sizeof(LDKC2Tuple_ThirtyTwoBytesThirtyTwoBytesZ) * orig->datalen, "LDKCVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZ clone bytes"), .datalen = orig->datalen };
4932         for (size_t i = 0; i < ret.datalen; i++) {
4933                 ret.data[i] = C2Tuple_ThirtyTwoBytesThirtyTwoBytesZ_clone(&orig->data[i]);
4934         }
4935         return ret;
4936 }
4937 uint32_t __attribute__((export_name("TS_LDKProbeSendFailure_ty_from_ptr"))) TS_LDKProbeSendFailure_ty_from_ptr(uint64_t ptr) {
4938         LDKProbeSendFailure *obj = (LDKProbeSendFailure*)untag_ptr(ptr);
4939         switch(obj->tag) {
4940                 case LDKProbeSendFailure_RouteNotFound: return 0;
4941                 case LDKProbeSendFailure_SendingFailed: return 1;
4942                 default: abort();
4943         }
4944 }
4945 uint64_t __attribute__((export_name("TS_LDKProbeSendFailure_SendingFailed_get_sending_failed"))) TS_LDKProbeSendFailure_SendingFailed_get_sending_failed(uint64_t ptr) {
4946         LDKProbeSendFailure *obj = (LDKProbeSendFailure*)untag_ptr(ptr);
4947         assert(obj->tag == LDKProbeSendFailure_SendingFailed);
4948         uint64_t sending_failed_ref = tag_ptr(&obj->sending_failed, false);
4949         return sending_failed_ref;
4950 }
4951 static inline struct LDKCVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZ CResult_CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZProbeSendFailureZ_get_ok(LDKCResult_CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZProbeSendFailureZ *NONNULL_PTR owner){
4952 CHECK(owner->result_ok);
4953         return CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZ_clone(&*owner->contents.result);
4954 }
4955 uint64_tArray  __attribute__((export_name("TS_CResult_CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZProbeSendFailureZ_get_ok"))) TS_CResult_CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZProbeSendFailureZ_get_ok(uint64_t owner) {
4956         LDKCResult_CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZProbeSendFailureZ* owner_conv = (LDKCResult_CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZProbeSendFailureZ*)untag_ptr(owner);
4957         LDKCVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZ ret_var = CResult_CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZProbeSendFailureZ_get_ok(owner_conv);
4958         uint64_tArray ret_arr = NULL;
4959         ret_arr = init_uint64_tArray(ret_var.datalen, __LINE__);
4960         uint64_t *ret_arr_ptr = (uint64_t*)(((uint8_t*)ret_arr) + 8);
4961         for (size_t o = 0; o < ret_var.datalen; o++) {
4962                 LDKC2Tuple_ThirtyTwoBytesThirtyTwoBytesZ* ret_conv_40_conv = MALLOC(sizeof(LDKC2Tuple_ThirtyTwoBytesThirtyTwoBytesZ), "LDKC2Tuple_ThirtyTwoBytesThirtyTwoBytesZ");
4963                 *ret_conv_40_conv = ret_var.data[o];
4964                 ret_arr_ptr[o] = tag_ptr(ret_conv_40_conv, true);
4965         }
4966         
4967         FREE(ret_var.data);
4968         return ret_arr;
4969 }
4970
4971 static inline struct LDKProbeSendFailure CResult_CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZProbeSendFailureZ_get_err(LDKCResult_CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZProbeSendFailureZ *NONNULL_PTR owner){
4972 CHECK(!owner->result_ok);
4973         return ProbeSendFailure_clone(&*owner->contents.err);
4974 }
4975 uint64_t  __attribute__((export_name("TS_CResult_CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZProbeSendFailureZ_get_err"))) TS_CResult_CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZProbeSendFailureZ_get_err(uint64_t owner) {
4976         LDKCResult_CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZProbeSendFailureZ* owner_conv = (LDKCResult_CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZProbeSendFailureZ*)untag_ptr(owner);
4977         LDKProbeSendFailure *ret_copy = MALLOC(sizeof(LDKProbeSendFailure), "LDKProbeSendFailure");
4978         *ret_copy = CResult_CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZProbeSendFailureZ_get_err(owner_conv);
4979         uint64_t ret_ref = tag_ptr(ret_copy, true);
4980         return ret_ref;
4981 }
4982
4983 static inline struct LDKThirtyTwoBytes C2Tuple_ThirtyTwoBytesPublicKeyZ_get_a(LDKC2Tuple_ThirtyTwoBytesPublicKeyZ *NONNULL_PTR owner){
4984         return ThirtyTwoBytes_clone(&owner->a);
4985 }
4986 int8_tArray  __attribute__((export_name("TS_C2Tuple_ThirtyTwoBytesPublicKeyZ_get_a"))) TS_C2Tuple_ThirtyTwoBytesPublicKeyZ_get_a(uint64_t owner) {
4987         LDKC2Tuple_ThirtyTwoBytesPublicKeyZ* owner_conv = (LDKC2Tuple_ThirtyTwoBytesPublicKeyZ*)untag_ptr(owner);
4988         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
4989         memcpy(ret_arr->elems, C2Tuple_ThirtyTwoBytesPublicKeyZ_get_a(owner_conv).data, 32);
4990         return ret_arr;
4991 }
4992
4993 static inline struct LDKPublicKey C2Tuple_ThirtyTwoBytesPublicKeyZ_get_b(LDKC2Tuple_ThirtyTwoBytesPublicKeyZ *NONNULL_PTR owner){
4994         return owner->b;
4995 }
4996 int8_tArray  __attribute__((export_name("TS_C2Tuple_ThirtyTwoBytesPublicKeyZ_get_b"))) TS_C2Tuple_ThirtyTwoBytesPublicKeyZ_get_b(uint64_t owner) {
4997         LDKC2Tuple_ThirtyTwoBytesPublicKeyZ* owner_conv = (LDKC2Tuple_ThirtyTwoBytesPublicKeyZ*)untag_ptr(owner);
4998         int8_tArray ret_arr = init_int8_tArray(33, __LINE__);
4999         memcpy(ret_arr->elems, C2Tuple_ThirtyTwoBytesPublicKeyZ_get_b(owner_conv).compressed_form, 33);
5000         return ret_arr;
5001 }
5002
5003 static inline LDKCVec_C2Tuple_ThirtyTwoBytesPublicKeyZZ CVec_C2Tuple_ThirtyTwoBytesPublicKeyZZ_clone(const LDKCVec_C2Tuple_ThirtyTwoBytesPublicKeyZZ *orig) {
5004         LDKCVec_C2Tuple_ThirtyTwoBytesPublicKeyZZ ret = { .data = MALLOC(sizeof(LDKC2Tuple_ThirtyTwoBytesPublicKeyZ) * orig->datalen, "LDKCVec_C2Tuple_ThirtyTwoBytesPublicKeyZZ clone bytes"), .datalen = orig->datalen };
5005         for (size_t i = 0; i < ret.datalen; i++) {
5006                 ret.data[i] = C2Tuple_ThirtyTwoBytesPublicKeyZ_clone(&orig->data[i]);
5007         }
5008         return ret;
5009 }
5010 uint32_t __attribute__((export_name("TS_LDKCOption_StrZ_ty_from_ptr"))) TS_LDKCOption_StrZ_ty_from_ptr(uint64_t ptr) {
5011         LDKCOption_StrZ *obj = (LDKCOption_StrZ*)untag_ptr(ptr);
5012         switch(obj->tag) {
5013                 case LDKCOption_StrZ_Some: return 0;
5014                 case LDKCOption_StrZ_None: return 1;
5015                 default: abort();
5016         }
5017 }
5018 jstring __attribute__((export_name("TS_LDKCOption_StrZ_Some_get_some"))) TS_LDKCOption_StrZ_Some_get_some(uint64_t ptr) {
5019         LDKCOption_StrZ *obj = (LDKCOption_StrZ*)untag_ptr(ptr);
5020         assert(obj->tag == LDKCOption_StrZ_Some);
5021         LDKStr some_str = obj->some;
5022                         jstring some_conv = str_ref_to_ts(some_str.chars, some_str.len);
5023         return some_conv;
5024 }
5025 static inline void CResult_NoneBolt12SemanticErrorZ_get_ok(LDKCResult_NoneBolt12SemanticErrorZ *NONNULL_PTR owner){
5026 CHECK(owner->result_ok);
5027         return *owner->contents.result;
5028 }
5029 void  __attribute__((export_name("TS_CResult_NoneBolt12SemanticErrorZ_get_ok"))) TS_CResult_NoneBolt12SemanticErrorZ_get_ok(uint64_t owner) {
5030         LDKCResult_NoneBolt12SemanticErrorZ* owner_conv = (LDKCResult_NoneBolt12SemanticErrorZ*)untag_ptr(owner);
5031         CResult_NoneBolt12SemanticErrorZ_get_ok(owner_conv);
5032 }
5033
5034 static inline enum LDKBolt12SemanticError CResult_NoneBolt12SemanticErrorZ_get_err(LDKCResult_NoneBolt12SemanticErrorZ *NONNULL_PTR owner){
5035 CHECK(!owner->result_ok);
5036         return Bolt12SemanticError_clone(&*owner->contents.err);
5037 }
5038 uint32_t  __attribute__((export_name("TS_CResult_NoneBolt12SemanticErrorZ_get_err"))) TS_CResult_NoneBolt12SemanticErrorZ_get_err(uint64_t owner) {
5039         LDKCResult_NoneBolt12SemanticErrorZ* owner_conv = (LDKCResult_NoneBolt12SemanticErrorZ*)untag_ptr(owner);
5040         uint32_t ret_conv = LDKBolt12SemanticError_to_js(CResult_NoneBolt12SemanticErrorZ_get_err(owner_conv));
5041         return ret_conv;
5042 }
5043
5044 static inline struct LDKC2Tuple_ThirtyTwoBytesThirtyTwoBytesZ CResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZNoneZ_get_ok(LDKCResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZNoneZ *NONNULL_PTR owner){
5045 CHECK(owner->result_ok);
5046         return C2Tuple_ThirtyTwoBytesThirtyTwoBytesZ_clone(&*owner->contents.result);
5047 }
5048 uint64_t  __attribute__((export_name("TS_CResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZNoneZ_get_ok"))) TS_CResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZNoneZ_get_ok(uint64_t owner) {
5049         LDKCResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZNoneZ* owner_conv = (LDKCResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZNoneZ*)untag_ptr(owner);
5050         LDKC2Tuple_ThirtyTwoBytesThirtyTwoBytesZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_ThirtyTwoBytesThirtyTwoBytesZ), "LDKC2Tuple_ThirtyTwoBytesThirtyTwoBytesZ");
5051         *ret_conv = CResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZNoneZ_get_ok(owner_conv);
5052         return tag_ptr(ret_conv, true);
5053 }
5054
5055 static inline void CResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZNoneZ_get_err(LDKCResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZNoneZ *NONNULL_PTR owner){
5056 CHECK(!owner->result_ok);
5057         return *owner->contents.err;
5058 }
5059 void  __attribute__((export_name("TS_CResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZNoneZ_get_err"))) TS_CResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZNoneZ_get_err(uint64_t owner) {
5060         LDKCResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZNoneZ* owner_conv = (LDKCResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZNoneZ*)untag_ptr(owner);
5061         CResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZNoneZ_get_err(owner_conv);
5062 }
5063
5064 uint32_t __attribute__((export_name("TS_LDKOffersMessage_ty_from_ptr"))) TS_LDKOffersMessage_ty_from_ptr(uint64_t ptr) {
5065         LDKOffersMessage *obj = (LDKOffersMessage*)untag_ptr(ptr);
5066         switch(obj->tag) {
5067                 case LDKOffersMessage_InvoiceRequest: return 0;
5068                 case LDKOffersMessage_Invoice: return 1;
5069                 case LDKOffersMessage_InvoiceError: return 2;
5070                 default: abort();
5071         }
5072 }
5073 uint64_t __attribute__((export_name("TS_LDKOffersMessage_InvoiceRequest_get_invoice_request"))) TS_LDKOffersMessage_InvoiceRequest_get_invoice_request(uint64_t ptr) {
5074         LDKOffersMessage *obj = (LDKOffersMessage*)untag_ptr(ptr);
5075         assert(obj->tag == LDKOffersMessage_InvoiceRequest);
5076         LDKInvoiceRequest invoice_request_var = obj->invoice_request;
5077                         uint64_t invoice_request_ref = 0;
5078                         CHECK_INNER_FIELD_ACCESS_OR_NULL(invoice_request_var);
5079                         invoice_request_ref = tag_ptr(invoice_request_var.inner, false);
5080         return invoice_request_ref;
5081 }
5082 uint64_t __attribute__((export_name("TS_LDKOffersMessage_Invoice_get_invoice"))) TS_LDKOffersMessage_Invoice_get_invoice(uint64_t ptr) {
5083         LDKOffersMessage *obj = (LDKOffersMessage*)untag_ptr(ptr);
5084         assert(obj->tag == LDKOffersMessage_Invoice);
5085         LDKBolt12Invoice invoice_var = obj->invoice;
5086                         uint64_t invoice_ref = 0;
5087                         CHECK_INNER_FIELD_ACCESS_OR_NULL(invoice_var);
5088                         invoice_ref = tag_ptr(invoice_var.inner, false);
5089         return invoice_ref;
5090 }
5091 uint64_t __attribute__((export_name("TS_LDKOffersMessage_InvoiceError_get_invoice_error"))) TS_LDKOffersMessage_InvoiceError_get_invoice_error(uint64_t ptr) {
5092         LDKOffersMessage *obj = (LDKOffersMessage*)untag_ptr(ptr);
5093         assert(obj->tag == LDKOffersMessage_InvoiceError);
5094         LDKInvoiceError invoice_error_var = obj->invoice_error;
5095                         uint64_t invoice_error_ref = 0;
5096                         CHECK_INNER_FIELD_ACCESS_OR_NULL(invoice_error_var);
5097                         invoice_error_ref = tag_ptr(invoice_error_var.inner, false);
5098         return invoice_error_ref;
5099 }
5100 uint32_t __attribute__((export_name("TS_LDKCOption_OffersMessageZ_ty_from_ptr"))) TS_LDKCOption_OffersMessageZ_ty_from_ptr(uint64_t ptr) {
5101         LDKCOption_OffersMessageZ *obj = (LDKCOption_OffersMessageZ*)untag_ptr(ptr);
5102         switch(obj->tag) {
5103                 case LDKCOption_OffersMessageZ_Some: return 0;
5104                 case LDKCOption_OffersMessageZ_None: return 1;
5105                 default: abort();
5106         }
5107 }
5108 uint64_t __attribute__((export_name("TS_LDKCOption_OffersMessageZ_Some_get_some"))) TS_LDKCOption_OffersMessageZ_Some_get_some(uint64_t ptr) {
5109         LDKCOption_OffersMessageZ *obj = (LDKCOption_OffersMessageZ*)untag_ptr(ptr);
5110         assert(obj->tag == LDKCOption_OffersMessageZ_Some);
5111         uint64_t some_ref = tag_ptr(&obj->some, false);
5112         return some_ref;
5113 }
5114 uint32_t __attribute__((export_name("TS_LDKDestination_ty_from_ptr"))) TS_LDKDestination_ty_from_ptr(uint64_t ptr) {
5115         LDKDestination *obj = (LDKDestination*)untag_ptr(ptr);
5116         switch(obj->tag) {
5117                 case LDKDestination_Node: return 0;
5118                 case LDKDestination_BlindedPath: return 1;
5119                 default: abort();
5120         }
5121 }
5122 int8_tArray __attribute__((export_name("TS_LDKDestination_Node_get_node"))) TS_LDKDestination_Node_get_node(uint64_t ptr) {
5123         LDKDestination *obj = (LDKDestination*)untag_ptr(ptr);
5124         assert(obj->tag == LDKDestination_Node);
5125         int8_tArray node_arr = init_int8_tArray(33, __LINE__);
5126         memcpy(node_arr->elems, obj->node.compressed_form, 33);
5127         return node_arr;
5128 }
5129 uint64_t __attribute__((export_name("TS_LDKDestination_BlindedPath_get_blinded_path"))) TS_LDKDestination_BlindedPath_get_blinded_path(uint64_t ptr) {
5130         LDKDestination *obj = (LDKDestination*)untag_ptr(ptr);
5131         assert(obj->tag == LDKDestination_BlindedPath);
5132         LDKBlindedPath blinded_path_var = obj->blinded_path;
5133                         uint64_t blinded_path_ref = 0;
5134                         CHECK_INNER_FIELD_ACCESS_OR_NULL(blinded_path_var);
5135                         blinded_path_ref = tag_ptr(blinded_path_var.inner, false);
5136         return blinded_path_ref;
5137 }
5138 static inline struct LDKOffersMessage C3Tuple_OffersMessageDestinationBlindedPathZ_get_a(LDKC3Tuple_OffersMessageDestinationBlindedPathZ *NONNULL_PTR owner){
5139         return OffersMessage_clone(&owner->a);
5140 }
5141 uint64_t  __attribute__((export_name("TS_C3Tuple_OffersMessageDestinationBlindedPathZ_get_a"))) TS_C3Tuple_OffersMessageDestinationBlindedPathZ_get_a(uint64_t owner) {
5142         LDKC3Tuple_OffersMessageDestinationBlindedPathZ* owner_conv = (LDKC3Tuple_OffersMessageDestinationBlindedPathZ*)untag_ptr(owner);
5143         LDKOffersMessage *ret_copy = MALLOC(sizeof(LDKOffersMessage), "LDKOffersMessage");
5144         *ret_copy = C3Tuple_OffersMessageDestinationBlindedPathZ_get_a(owner_conv);
5145         uint64_t ret_ref = tag_ptr(ret_copy, true);
5146         return ret_ref;
5147 }
5148
5149 static inline struct LDKDestination C3Tuple_OffersMessageDestinationBlindedPathZ_get_b(LDKC3Tuple_OffersMessageDestinationBlindedPathZ *NONNULL_PTR owner){
5150         return Destination_clone(&owner->b);
5151 }
5152 uint64_t  __attribute__((export_name("TS_C3Tuple_OffersMessageDestinationBlindedPathZ_get_b"))) TS_C3Tuple_OffersMessageDestinationBlindedPathZ_get_b(uint64_t owner) {
5153         LDKC3Tuple_OffersMessageDestinationBlindedPathZ* owner_conv = (LDKC3Tuple_OffersMessageDestinationBlindedPathZ*)untag_ptr(owner);
5154         LDKDestination *ret_copy = MALLOC(sizeof(LDKDestination), "LDKDestination");
5155         *ret_copy = C3Tuple_OffersMessageDestinationBlindedPathZ_get_b(owner_conv);
5156         uint64_t ret_ref = tag_ptr(ret_copy, true);
5157         return ret_ref;
5158 }
5159
5160 static inline struct LDKBlindedPath C3Tuple_OffersMessageDestinationBlindedPathZ_get_c(LDKC3Tuple_OffersMessageDestinationBlindedPathZ *NONNULL_PTR owner){
5161         LDKBlindedPath ret = owner->c;
5162         ret.is_owned = false;
5163         return ret;
5164 }
5165 uint64_t  __attribute__((export_name("TS_C3Tuple_OffersMessageDestinationBlindedPathZ_get_c"))) TS_C3Tuple_OffersMessageDestinationBlindedPathZ_get_c(uint64_t owner) {
5166         LDKC3Tuple_OffersMessageDestinationBlindedPathZ* owner_conv = (LDKC3Tuple_OffersMessageDestinationBlindedPathZ*)untag_ptr(owner);
5167         LDKBlindedPath ret_var = C3Tuple_OffersMessageDestinationBlindedPathZ_get_c(owner_conv);
5168         uint64_t ret_ref = 0;
5169         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
5170         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
5171         return ret_ref;
5172 }
5173
5174 static inline LDKCVec_C3Tuple_OffersMessageDestinationBlindedPathZZ CVec_C3Tuple_OffersMessageDestinationBlindedPathZZ_clone(const LDKCVec_C3Tuple_OffersMessageDestinationBlindedPathZZ *orig) {
5175         LDKCVec_C3Tuple_OffersMessageDestinationBlindedPathZZ ret = { .data = MALLOC(sizeof(LDKC3Tuple_OffersMessageDestinationBlindedPathZ) * orig->datalen, "LDKCVec_C3Tuple_OffersMessageDestinationBlindedPathZZ clone bytes"), .datalen = orig->datalen };
5176         for (size_t i = 0; i < ret.datalen; i++) {
5177                 ret.data[i] = C3Tuple_OffersMessageDestinationBlindedPathZ_clone(&orig->data[i]);
5178         }
5179         return ret;
5180 }
5181 static inline struct LDKCounterpartyForwardingInfo CResult_CounterpartyForwardingInfoDecodeErrorZ_get_ok(LDKCResult_CounterpartyForwardingInfoDecodeErrorZ *NONNULL_PTR owner){
5182         LDKCounterpartyForwardingInfo ret = *owner->contents.result;
5183         ret.is_owned = false;
5184         return ret;
5185 }
5186 uint64_t  __attribute__((export_name("TS_CResult_CounterpartyForwardingInfoDecodeErrorZ_get_ok"))) TS_CResult_CounterpartyForwardingInfoDecodeErrorZ_get_ok(uint64_t owner) {
5187         LDKCResult_CounterpartyForwardingInfoDecodeErrorZ* owner_conv = (LDKCResult_CounterpartyForwardingInfoDecodeErrorZ*)untag_ptr(owner);
5188         LDKCounterpartyForwardingInfo ret_var = CResult_CounterpartyForwardingInfoDecodeErrorZ_get_ok(owner_conv);
5189         uint64_t ret_ref = 0;
5190         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
5191         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
5192         return ret_ref;
5193 }
5194
5195 static inline struct LDKDecodeError CResult_CounterpartyForwardingInfoDecodeErrorZ_get_err(LDKCResult_CounterpartyForwardingInfoDecodeErrorZ *NONNULL_PTR owner){
5196 CHECK(!owner->result_ok);
5197         return DecodeError_clone(&*owner->contents.err);
5198 }
5199 uint64_t  __attribute__((export_name("TS_CResult_CounterpartyForwardingInfoDecodeErrorZ_get_err"))) TS_CResult_CounterpartyForwardingInfoDecodeErrorZ_get_err(uint64_t owner) {
5200         LDKCResult_CounterpartyForwardingInfoDecodeErrorZ* owner_conv = (LDKCResult_CounterpartyForwardingInfoDecodeErrorZ*)untag_ptr(owner);
5201         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
5202         *ret_copy = CResult_CounterpartyForwardingInfoDecodeErrorZ_get_err(owner_conv);
5203         uint64_t ret_ref = tag_ptr(ret_copy, true);
5204         return ret_ref;
5205 }
5206
5207 static inline struct LDKChannelCounterparty CResult_ChannelCounterpartyDecodeErrorZ_get_ok(LDKCResult_ChannelCounterpartyDecodeErrorZ *NONNULL_PTR owner){
5208         LDKChannelCounterparty ret = *owner->contents.result;
5209         ret.is_owned = false;
5210         return ret;
5211 }
5212 uint64_t  __attribute__((export_name("TS_CResult_ChannelCounterpartyDecodeErrorZ_get_ok"))) TS_CResult_ChannelCounterpartyDecodeErrorZ_get_ok(uint64_t owner) {
5213         LDKCResult_ChannelCounterpartyDecodeErrorZ* owner_conv = (LDKCResult_ChannelCounterpartyDecodeErrorZ*)untag_ptr(owner);
5214         LDKChannelCounterparty ret_var = CResult_ChannelCounterpartyDecodeErrorZ_get_ok(owner_conv);
5215         uint64_t ret_ref = 0;
5216         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
5217         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
5218         return ret_ref;
5219 }
5220
5221 static inline struct LDKDecodeError CResult_ChannelCounterpartyDecodeErrorZ_get_err(LDKCResult_ChannelCounterpartyDecodeErrorZ *NONNULL_PTR owner){
5222 CHECK(!owner->result_ok);
5223         return DecodeError_clone(&*owner->contents.err);
5224 }
5225 uint64_t  __attribute__((export_name("TS_CResult_ChannelCounterpartyDecodeErrorZ_get_err"))) TS_CResult_ChannelCounterpartyDecodeErrorZ_get_err(uint64_t owner) {
5226         LDKCResult_ChannelCounterpartyDecodeErrorZ* owner_conv = (LDKCResult_ChannelCounterpartyDecodeErrorZ*)untag_ptr(owner);
5227         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
5228         *ret_copy = CResult_ChannelCounterpartyDecodeErrorZ_get_err(owner_conv);
5229         uint64_t ret_ref = tag_ptr(ret_copy, true);
5230         return ret_ref;
5231 }
5232
5233 static inline struct LDKChannelDetails CResult_ChannelDetailsDecodeErrorZ_get_ok(LDKCResult_ChannelDetailsDecodeErrorZ *NONNULL_PTR owner){
5234         LDKChannelDetails ret = *owner->contents.result;
5235         ret.is_owned = false;
5236         return ret;
5237 }
5238 uint64_t  __attribute__((export_name("TS_CResult_ChannelDetailsDecodeErrorZ_get_ok"))) TS_CResult_ChannelDetailsDecodeErrorZ_get_ok(uint64_t owner) {
5239         LDKCResult_ChannelDetailsDecodeErrorZ* owner_conv = (LDKCResult_ChannelDetailsDecodeErrorZ*)untag_ptr(owner);
5240         LDKChannelDetails ret_var = CResult_ChannelDetailsDecodeErrorZ_get_ok(owner_conv);
5241         uint64_t ret_ref = 0;
5242         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
5243         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
5244         return ret_ref;
5245 }
5246
5247 static inline struct LDKDecodeError CResult_ChannelDetailsDecodeErrorZ_get_err(LDKCResult_ChannelDetailsDecodeErrorZ *NONNULL_PTR owner){
5248 CHECK(!owner->result_ok);
5249         return DecodeError_clone(&*owner->contents.err);
5250 }
5251 uint64_t  __attribute__((export_name("TS_CResult_ChannelDetailsDecodeErrorZ_get_err"))) TS_CResult_ChannelDetailsDecodeErrorZ_get_err(uint64_t owner) {
5252         LDKCResult_ChannelDetailsDecodeErrorZ* owner_conv = (LDKCResult_ChannelDetailsDecodeErrorZ*)untag_ptr(owner);
5253         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
5254         *ret_copy = CResult_ChannelDetailsDecodeErrorZ_get_err(owner_conv);
5255         uint64_t ret_ref = tag_ptr(ret_copy, true);
5256         return ret_ref;
5257 }
5258
5259 static inline struct LDKPhantomRouteHints CResult_PhantomRouteHintsDecodeErrorZ_get_ok(LDKCResult_PhantomRouteHintsDecodeErrorZ *NONNULL_PTR owner){
5260         LDKPhantomRouteHints ret = *owner->contents.result;
5261         ret.is_owned = false;
5262         return ret;
5263 }
5264 uint64_t  __attribute__((export_name("TS_CResult_PhantomRouteHintsDecodeErrorZ_get_ok"))) TS_CResult_PhantomRouteHintsDecodeErrorZ_get_ok(uint64_t owner) {
5265         LDKCResult_PhantomRouteHintsDecodeErrorZ* owner_conv = (LDKCResult_PhantomRouteHintsDecodeErrorZ*)untag_ptr(owner);
5266         LDKPhantomRouteHints ret_var = CResult_PhantomRouteHintsDecodeErrorZ_get_ok(owner_conv);
5267         uint64_t ret_ref = 0;
5268         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
5269         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
5270         return ret_ref;
5271 }
5272
5273 static inline struct LDKDecodeError CResult_PhantomRouteHintsDecodeErrorZ_get_err(LDKCResult_PhantomRouteHintsDecodeErrorZ *NONNULL_PTR owner){
5274 CHECK(!owner->result_ok);
5275         return DecodeError_clone(&*owner->contents.err);
5276 }
5277 uint64_t  __attribute__((export_name("TS_CResult_PhantomRouteHintsDecodeErrorZ_get_err"))) TS_CResult_PhantomRouteHintsDecodeErrorZ_get_err(uint64_t owner) {
5278         LDKCResult_PhantomRouteHintsDecodeErrorZ* owner_conv = (LDKCResult_PhantomRouteHintsDecodeErrorZ*)untag_ptr(owner);
5279         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
5280         *ret_copy = CResult_PhantomRouteHintsDecodeErrorZ_get_err(owner_conv);
5281         uint64_t ret_ref = tag_ptr(ret_copy, true);
5282         return ret_ref;
5283 }
5284
5285 static inline enum LDKChannelShutdownState CResult_ChannelShutdownStateDecodeErrorZ_get_ok(LDKCResult_ChannelShutdownStateDecodeErrorZ *NONNULL_PTR owner){
5286 CHECK(owner->result_ok);
5287         return ChannelShutdownState_clone(&*owner->contents.result);
5288 }
5289 uint32_t  __attribute__((export_name("TS_CResult_ChannelShutdownStateDecodeErrorZ_get_ok"))) TS_CResult_ChannelShutdownStateDecodeErrorZ_get_ok(uint64_t owner) {
5290         LDKCResult_ChannelShutdownStateDecodeErrorZ* owner_conv = (LDKCResult_ChannelShutdownStateDecodeErrorZ*)untag_ptr(owner);
5291         uint32_t ret_conv = LDKChannelShutdownState_to_js(CResult_ChannelShutdownStateDecodeErrorZ_get_ok(owner_conv));
5292         return ret_conv;
5293 }
5294
5295 static inline struct LDKDecodeError CResult_ChannelShutdownStateDecodeErrorZ_get_err(LDKCResult_ChannelShutdownStateDecodeErrorZ *NONNULL_PTR owner){
5296 CHECK(!owner->result_ok);
5297         return DecodeError_clone(&*owner->contents.err);
5298 }
5299 uint64_t  __attribute__((export_name("TS_CResult_ChannelShutdownStateDecodeErrorZ_get_err"))) TS_CResult_ChannelShutdownStateDecodeErrorZ_get_err(uint64_t owner) {
5300         LDKCResult_ChannelShutdownStateDecodeErrorZ* owner_conv = (LDKCResult_ChannelShutdownStateDecodeErrorZ*)untag_ptr(owner);
5301         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
5302         *ret_copy = CResult_ChannelShutdownStateDecodeErrorZ_get_err(owner_conv);
5303         uint64_t ret_ref = tag_ptr(ret_copy, true);
5304         return ret_ref;
5305 }
5306
5307 static inline LDKCVec_ChannelMonitorZ CVec_ChannelMonitorZ_clone(const LDKCVec_ChannelMonitorZ *orig) {
5308         LDKCVec_ChannelMonitorZ ret = { .data = MALLOC(sizeof(LDKChannelMonitor) * orig->datalen, "LDKCVec_ChannelMonitorZ clone bytes"), .datalen = orig->datalen };
5309         for (size_t i = 0; i < ret.datalen; i++) {
5310                 ret.data[i] = ChannelMonitor_clone(&orig->data[i]);
5311         }
5312         return ret;
5313 }
5314 typedef struct LDKWatch_JCalls {
5315         atomic_size_t refcnt;
5316         uint32_t instance_ptr;
5317 } LDKWatch_JCalls;
5318 static void LDKWatch_JCalls_free(void* this_arg) {
5319         LDKWatch_JCalls *j_calls = (LDKWatch_JCalls*) this_arg;
5320         if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
5321                 FREE(j_calls);
5322         }
5323 }
5324 LDKCResult_ChannelMonitorUpdateStatusNoneZ watch_channel_LDKWatch_jcall(const void* this_arg, LDKOutPoint funding_txo, LDKChannelMonitor monitor) {
5325         LDKWatch_JCalls *j_calls = (LDKWatch_JCalls*) this_arg;
5326         LDKOutPoint funding_txo_var = funding_txo;
5327         uint64_t funding_txo_ref = 0;
5328         CHECK_INNER_FIELD_ACCESS_OR_NULL(funding_txo_var);
5329         funding_txo_ref = tag_ptr(funding_txo_var.inner, funding_txo_var.is_owned);
5330         LDKChannelMonitor monitor_var = monitor;
5331         uint64_t monitor_ref = 0;
5332         CHECK_INNER_FIELD_ACCESS_OR_NULL(monitor_var);
5333         monitor_ref = tag_ptr(monitor_var.inner, monitor_var.is_owned);
5334         uint64_t ret = js_invoke_function_bbuuuu(j_calls->instance_ptr, 18, funding_txo_ref, monitor_ref, 0, 0, 0, 0);
5335         void* ret_ptr = untag_ptr(ret);
5336         CHECK_ACCESS(ret_ptr);
5337         LDKCResult_ChannelMonitorUpdateStatusNoneZ ret_conv = *(LDKCResult_ChannelMonitorUpdateStatusNoneZ*)(ret_ptr);
5338         FREE(untag_ptr(ret));
5339         return ret_conv;
5340 }
5341 LDKChannelMonitorUpdateStatus update_channel_LDKWatch_jcall(const void* this_arg, LDKOutPoint funding_txo, const LDKChannelMonitorUpdate * update) {
5342         LDKWatch_JCalls *j_calls = (LDKWatch_JCalls*) this_arg;
5343         LDKOutPoint funding_txo_var = funding_txo;
5344         uint64_t funding_txo_ref = 0;
5345         CHECK_INNER_FIELD_ACCESS_OR_NULL(funding_txo_var);
5346         funding_txo_ref = tag_ptr(funding_txo_var.inner, funding_txo_var.is_owned);
5347         LDKChannelMonitorUpdate update_var = *update;
5348         uint64_t update_ref = 0;
5349         update_var = ChannelMonitorUpdate_clone(&update_var);
5350         CHECK_INNER_FIELD_ACCESS_OR_NULL(update_var);
5351         update_ref = tag_ptr(update_var.inner, update_var.is_owned);
5352         uint64_t ret = js_invoke_function_bbuuuu(j_calls->instance_ptr, 19, funding_txo_ref, update_ref, 0, 0, 0, 0);
5353         LDKChannelMonitorUpdateStatus ret_conv = LDKChannelMonitorUpdateStatus_from_js(ret);
5354         return ret_conv;
5355 }
5356 LDKCVec_C3Tuple_OutPointCVec_MonitorEventZPublicKeyZZ release_pending_monitor_events_LDKWatch_jcall(const void* this_arg) {
5357         LDKWatch_JCalls *j_calls = (LDKWatch_JCalls*) this_arg;
5358         uint64_tArray ret = (uint64_tArray)js_invoke_function_uuuuuu(j_calls->instance_ptr, 20, 0, 0, 0, 0, 0, 0);
5359         LDKCVec_C3Tuple_OutPointCVec_MonitorEventZPublicKeyZZ ret_constr;
5360         ret_constr.datalen = ret->arr_len;
5361         if (ret_constr.datalen > 0)
5362                 ret_constr.data = MALLOC(ret_constr.datalen * sizeof(LDKC3Tuple_OutPointCVec_MonitorEventZPublicKeyZ), "LDKCVec_C3Tuple_OutPointCVec_MonitorEventZPublicKeyZZ Elements");
5363         else
5364                 ret_constr.data = NULL;
5365         uint64_t* ret_vals = ret->elems;
5366         for (size_t x = 0; x < ret_constr.datalen; x++) {
5367                 uint64_t ret_conv_49 = ret_vals[x];
5368                 void* ret_conv_49_ptr = untag_ptr(ret_conv_49);
5369                 CHECK_ACCESS(ret_conv_49_ptr);
5370                 LDKC3Tuple_OutPointCVec_MonitorEventZPublicKeyZ ret_conv_49_conv = *(LDKC3Tuple_OutPointCVec_MonitorEventZPublicKeyZ*)(ret_conv_49_ptr);
5371                 FREE(untag_ptr(ret_conv_49));
5372                 ret_constr.data[x] = ret_conv_49_conv;
5373         }
5374         FREE(ret);
5375         return ret_constr;
5376 }
5377 static void LDKWatch_JCalls_cloned(LDKWatch* new_obj) {
5378         LDKWatch_JCalls *j_calls = (LDKWatch_JCalls*) new_obj->this_arg;
5379         atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
5380 }
5381 static inline LDKWatch LDKWatch_init (JSValue o) {
5382         LDKWatch_JCalls *calls = MALLOC(sizeof(LDKWatch_JCalls), "LDKWatch_JCalls");
5383         atomic_init(&calls->refcnt, 1);
5384         calls->instance_ptr = o;
5385
5386         LDKWatch ret = {
5387                 .this_arg = (void*) calls,
5388                 .watch_channel = watch_channel_LDKWatch_jcall,
5389                 .update_channel = update_channel_LDKWatch_jcall,
5390                 .release_pending_monitor_events = release_pending_monitor_events_LDKWatch_jcall,
5391                 .free = LDKWatch_JCalls_free,
5392         };
5393         return ret;
5394 }
5395 uint64_t  __attribute__((export_name("TS_LDKWatch_new"))) TS_LDKWatch_new(JSValue o) {
5396         LDKWatch *res_ptr = MALLOC(sizeof(LDKWatch), "LDKWatch");
5397         *res_ptr = LDKWatch_init(o);
5398         return tag_ptr(res_ptr, true);
5399 }
5400 uint64_t  __attribute__((export_name("TS_Watch_watch_channel"))) TS_Watch_watch_channel(uint64_t this_arg, uint64_t funding_txo, uint64_t monitor) {
5401         void* this_arg_ptr = untag_ptr(this_arg);
5402         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
5403         LDKWatch* this_arg_conv = (LDKWatch*)this_arg_ptr;
5404         LDKOutPoint funding_txo_conv;
5405         funding_txo_conv.inner = untag_ptr(funding_txo);
5406         funding_txo_conv.is_owned = ptr_is_owned(funding_txo);
5407         CHECK_INNER_FIELD_ACCESS_OR_NULL(funding_txo_conv);
5408         funding_txo_conv = OutPoint_clone(&funding_txo_conv);
5409         LDKChannelMonitor monitor_conv;
5410         monitor_conv.inner = untag_ptr(monitor);
5411         monitor_conv.is_owned = ptr_is_owned(monitor);
5412         CHECK_INNER_FIELD_ACCESS_OR_NULL(monitor_conv);
5413         monitor_conv = ChannelMonitor_clone(&monitor_conv);
5414         LDKCResult_ChannelMonitorUpdateStatusNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelMonitorUpdateStatusNoneZ), "LDKCResult_ChannelMonitorUpdateStatusNoneZ");
5415         *ret_conv = (this_arg_conv->watch_channel)(this_arg_conv->this_arg, funding_txo_conv, monitor_conv);
5416         return tag_ptr(ret_conv, true);
5417 }
5418
5419 uint32_t  __attribute__((export_name("TS_Watch_update_channel"))) TS_Watch_update_channel(uint64_t this_arg, uint64_t funding_txo, uint64_t update) {
5420         void* this_arg_ptr = untag_ptr(this_arg);
5421         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
5422         LDKWatch* this_arg_conv = (LDKWatch*)this_arg_ptr;
5423         LDKOutPoint funding_txo_conv;
5424         funding_txo_conv.inner = untag_ptr(funding_txo);
5425         funding_txo_conv.is_owned = ptr_is_owned(funding_txo);
5426         CHECK_INNER_FIELD_ACCESS_OR_NULL(funding_txo_conv);
5427         funding_txo_conv = OutPoint_clone(&funding_txo_conv);
5428         LDKChannelMonitorUpdate update_conv;
5429         update_conv.inner = untag_ptr(update);
5430         update_conv.is_owned = ptr_is_owned(update);
5431         CHECK_INNER_FIELD_ACCESS_OR_NULL(update_conv);
5432         update_conv.is_owned = false;
5433         uint32_t ret_conv = LDKChannelMonitorUpdateStatus_to_js((this_arg_conv->update_channel)(this_arg_conv->this_arg, funding_txo_conv, &update_conv));
5434         return ret_conv;
5435 }
5436
5437 uint64_tArray  __attribute__((export_name("TS_Watch_release_pending_monitor_events"))) TS_Watch_release_pending_monitor_events(uint64_t this_arg) {
5438         void* this_arg_ptr = untag_ptr(this_arg);
5439         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
5440         LDKWatch* this_arg_conv = (LDKWatch*)this_arg_ptr;
5441         LDKCVec_C3Tuple_OutPointCVec_MonitorEventZPublicKeyZZ ret_var = (this_arg_conv->release_pending_monitor_events)(this_arg_conv->this_arg);
5442         uint64_tArray ret_arr = NULL;
5443         ret_arr = init_uint64_tArray(ret_var.datalen, __LINE__);
5444         uint64_t *ret_arr_ptr = (uint64_t*)(((uint8_t*)ret_arr) + 8);
5445         for (size_t x = 0; x < ret_var.datalen; x++) {
5446                 LDKC3Tuple_OutPointCVec_MonitorEventZPublicKeyZ* ret_conv_49_conv = MALLOC(sizeof(LDKC3Tuple_OutPointCVec_MonitorEventZPublicKeyZ), "LDKC3Tuple_OutPointCVec_MonitorEventZPublicKeyZ");
5447                 *ret_conv_49_conv = ret_var.data[x];
5448                 ret_arr_ptr[x] = tag_ptr(ret_conv_49_conv, true);
5449         }
5450         
5451         FREE(ret_var.data);
5452         return ret_arr;
5453 }
5454
5455 typedef struct LDKBroadcasterInterface_JCalls {
5456         atomic_size_t refcnt;
5457         uint32_t instance_ptr;
5458 } LDKBroadcasterInterface_JCalls;
5459 static void LDKBroadcasterInterface_JCalls_free(void* this_arg) {
5460         LDKBroadcasterInterface_JCalls *j_calls = (LDKBroadcasterInterface_JCalls*) this_arg;
5461         if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
5462                 FREE(j_calls);
5463         }
5464 }
5465 void broadcast_transactions_LDKBroadcasterInterface_jcall(const void* this_arg, LDKCVec_TransactionZ txs) {
5466         LDKBroadcasterInterface_JCalls *j_calls = (LDKBroadcasterInterface_JCalls*) this_arg;
5467         LDKCVec_TransactionZ txs_var = txs;
5468         ptrArray txs_arr = NULL;
5469         txs_arr = init_ptrArray(txs_var.datalen, __LINE__);
5470         int8_tArray *txs_arr_ptr = (int8_tArray*)(((uint8_t*)txs_arr) + 8);
5471         for (size_t m = 0; m < txs_var.datalen; m++) {
5472                 LDKTransaction txs_conv_12_var = txs_var.data[m];
5473                 int8_tArray txs_conv_12_arr = init_int8_tArray(txs_conv_12_var.datalen, __LINE__);
5474                 memcpy(txs_conv_12_arr->elems, txs_conv_12_var.data, txs_conv_12_var.datalen);
5475                 Transaction_free(txs_conv_12_var);
5476                 txs_arr_ptr[m] = txs_conv_12_arr;
5477         }
5478         
5479         FREE(txs_var.data);
5480         js_invoke_function_uuuuuu(j_calls->instance_ptr, 21, (uint32_t)txs_arr, 0, 0, 0, 0, 0);
5481 }
5482 static void LDKBroadcasterInterface_JCalls_cloned(LDKBroadcasterInterface* new_obj) {
5483         LDKBroadcasterInterface_JCalls *j_calls = (LDKBroadcasterInterface_JCalls*) new_obj->this_arg;
5484         atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
5485 }
5486 static inline LDKBroadcasterInterface LDKBroadcasterInterface_init (JSValue o) {
5487         LDKBroadcasterInterface_JCalls *calls = MALLOC(sizeof(LDKBroadcasterInterface_JCalls), "LDKBroadcasterInterface_JCalls");
5488         atomic_init(&calls->refcnt, 1);
5489         calls->instance_ptr = o;
5490
5491         LDKBroadcasterInterface ret = {
5492                 .this_arg = (void*) calls,
5493                 .broadcast_transactions = broadcast_transactions_LDKBroadcasterInterface_jcall,
5494                 .free = LDKBroadcasterInterface_JCalls_free,
5495         };
5496         return ret;
5497 }
5498 uint64_t  __attribute__((export_name("TS_LDKBroadcasterInterface_new"))) TS_LDKBroadcasterInterface_new(JSValue o) {
5499         LDKBroadcasterInterface *res_ptr = MALLOC(sizeof(LDKBroadcasterInterface), "LDKBroadcasterInterface");
5500         *res_ptr = LDKBroadcasterInterface_init(o);
5501         return tag_ptr(res_ptr, true);
5502 }
5503 void  __attribute__((export_name("TS_BroadcasterInterface_broadcast_transactions"))) TS_BroadcasterInterface_broadcast_transactions(uint64_t this_arg, ptrArray txs) {
5504         void* this_arg_ptr = untag_ptr(this_arg);
5505         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
5506         LDKBroadcasterInterface* this_arg_conv = (LDKBroadcasterInterface*)this_arg_ptr;
5507         LDKCVec_TransactionZ txs_constr;
5508         txs_constr.datalen = txs->arr_len;
5509         if (txs_constr.datalen > 0)
5510                 txs_constr.data = MALLOC(txs_constr.datalen * sizeof(LDKTransaction), "LDKCVec_TransactionZ Elements");
5511         else
5512                 txs_constr.data = NULL;
5513         int8_tArray* txs_vals = (void*) txs->elems;
5514         for (size_t m = 0; m < txs_constr.datalen; m++) {
5515                 int8_tArray txs_conv_12 = txs_vals[m];
5516                 LDKTransaction txs_conv_12_ref;
5517                 txs_conv_12_ref.datalen = txs_conv_12->arr_len;
5518                 txs_conv_12_ref.data = MALLOC(txs_conv_12_ref.datalen, "LDKTransaction Bytes");
5519                 memcpy(txs_conv_12_ref.data, txs_conv_12->elems, txs_conv_12_ref.datalen); FREE(txs_conv_12);
5520                 txs_conv_12_ref.data_is_owned = true;
5521                 txs_constr.data[m] = txs_conv_12_ref;
5522         }
5523         FREE(txs);
5524         (this_arg_conv->broadcast_transactions)(this_arg_conv->this_arg, txs_constr);
5525 }
5526
5527 typedef struct LDKEntropySource_JCalls {
5528         atomic_size_t refcnt;
5529         uint32_t instance_ptr;
5530 } LDKEntropySource_JCalls;
5531 static void LDKEntropySource_JCalls_free(void* this_arg) {
5532         LDKEntropySource_JCalls *j_calls = (LDKEntropySource_JCalls*) this_arg;
5533         if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
5534                 FREE(j_calls);
5535         }
5536 }
5537 LDKThirtyTwoBytes get_secure_random_bytes_LDKEntropySource_jcall(const void* this_arg) {
5538         LDKEntropySource_JCalls *j_calls = (LDKEntropySource_JCalls*) this_arg;
5539         int8_tArray ret = (int8_tArray)js_invoke_function_uuuuuu(j_calls->instance_ptr, 22, 0, 0, 0, 0, 0, 0);
5540         LDKThirtyTwoBytes ret_ref;
5541         CHECK(ret->arr_len == 32);
5542         memcpy(ret_ref.data, ret->elems, 32); FREE(ret);
5543         return ret_ref;
5544 }
5545 static void LDKEntropySource_JCalls_cloned(LDKEntropySource* new_obj) {
5546         LDKEntropySource_JCalls *j_calls = (LDKEntropySource_JCalls*) new_obj->this_arg;
5547         atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
5548 }
5549 static inline LDKEntropySource LDKEntropySource_init (JSValue o) {
5550         LDKEntropySource_JCalls *calls = MALLOC(sizeof(LDKEntropySource_JCalls), "LDKEntropySource_JCalls");
5551         atomic_init(&calls->refcnt, 1);
5552         calls->instance_ptr = o;
5553
5554         LDKEntropySource ret = {
5555                 .this_arg = (void*) calls,
5556                 .get_secure_random_bytes = get_secure_random_bytes_LDKEntropySource_jcall,
5557                 .free = LDKEntropySource_JCalls_free,
5558         };
5559         return ret;
5560 }
5561 uint64_t  __attribute__((export_name("TS_LDKEntropySource_new"))) TS_LDKEntropySource_new(JSValue o) {
5562         LDKEntropySource *res_ptr = MALLOC(sizeof(LDKEntropySource), "LDKEntropySource");
5563         *res_ptr = LDKEntropySource_init(o);
5564         return tag_ptr(res_ptr, true);
5565 }
5566 int8_tArray  __attribute__((export_name("TS_EntropySource_get_secure_random_bytes"))) TS_EntropySource_get_secure_random_bytes(uint64_t this_arg) {
5567         void* this_arg_ptr = untag_ptr(this_arg);
5568         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
5569         LDKEntropySource* this_arg_conv = (LDKEntropySource*)this_arg_ptr;
5570         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
5571         memcpy(ret_arr->elems, (this_arg_conv->get_secure_random_bytes)(this_arg_conv->this_arg).data, 32);
5572         return ret_arr;
5573 }
5574
5575 uint32_t __attribute__((export_name("TS_LDKUnsignedGossipMessage_ty_from_ptr"))) TS_LDKUnsignedGossipMessage_ty_from_ptr(uint64_t ptr) {
5576         LDKUnsignedGossipMessage *obj = (LDKUnsignedGossipMessage*)untag_ptr(ptr);
5577         switch(obj->tag) {
5578                 case LDKUnsignedGossipMessage_ChannelAnnouncement: return 0;
5579                 case LDKUnsignedGossipMessage_ChannelUpdate: return 1;
5580                 case LDKUnsignedGossipMessage_NodeAnnouncement: return 2;
5581                 default: abort();
5582         }
5583 }
5584 uint64_t __attribute__((export_name("TS_LDKUnsignedGossipMessage_ChannelAnnouncement_get_channel_announcement"))) TS_LDKUnsignedGossipMessage_ChannelAnnouncement_get_channel_announcement(uint64_t ptr) {
5585         LDKUnsignedGossipMessage *obj = (LDKUnsignedGossipMessage*)untag_ptr(ptr);
5586         assert(obj->tag == LDKUnsignedGossipMessage_ChannelAnnouncement);
5587         LDKUnsignedChannelAnnouncement channel_announcement_var = obj->channel_announcement;
5588                         uint64_t channel_announcement_ref = 0;
5589                         CHECK_INNER_FIELD_ACCESS_OR_NULL(channel_announcement_var);
5590                         channel_announcement_ref = tag_ptr(channel_announcement_var.inner, false);
5591         return channel_announcement_ref;
5592 }
5593 uint64_t __attribute__((export_name("TS_LDKUnsignedGossipMessage_ChannelUpdate_get_channel_update"))) TS_LDKUnsignedGossipMessage_ChannelUpdate_get_channel_update(uint64_t ptr) {
5594         LDKUnsignedGossipMessage *obj = (LDKUnsignedGossipMessage*)untag_ptr(ptr);
5595         assert(obj->tag == LDKUnsignedGossipMessage_ChannelUpdate);
5596         LDKUnsignedChannelUpdate channel_update_var = obj->channel_update;
5597                         uint64_t channel_update_ref = 0;
5598                         CHECK_INNER_FIELD_ACCESS_OR_NULL(channel_update_var);
5599                         channel_update_ref = tag_ptr(channel_update_var.inner, false);
5600         return channel_update_ref;
5601 }
5602 uint64_t __attribute__((export_name("TS_LDKUnsignedGossipMessage_NodeAnnouncement_get_node_announcement"))) TS_LDKUnsignedGossipMessage_NodeAnnouncement_get_node_announcement(uint64_t ptr) {
5603         LDKUnsignedGossipMessage *obj = (LDKUnsignedGossipMessage*)untag_ptr(ptr);
5604         assert(obj->tag == LDKUnsignedGossipMessage_NodeAnnouncement);
5605         LDKUnsignedNodeAnnouncement node_announcement_var = obj->node_announcement;
5606                         uint64_t node_announcement_ref = 0;
5607                         CHECK_INNER_FIELD_ACCESS_OR_NULL(node_announcement_var);
5608                         node_announcement_ref = tag_ptr(node_announcement_var.inner, false);
5609         return node_announcement_ref;
5610 }
5611 typedef struct LDKNodeSigner_JCalls {
5612         atomic_size_t refcnt;
5613         uint32_t instance_ptr;
5614 } LDKNodeSigner_JCalls;
5615 static void LDKNodeSigner_JCalls_free(void* this_arg) {
5616         LDKNodeSigner_JCalls *j_calls = (LDKNodeSigner_JCalls*) this_arg;
5617         if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
5618                 FREE(j_calls);
5619         }
5620 }
5621 LDKThirtyTwoBytes get_inbound_payment_key_material_LDKNodeSigner_jcall(const void* this_arg) {
5622         LDKNodeSigner_JCalls *j_calls = (LDKNodeSigner_JCalls*) this_arg;
5623         int8_tArray ret = (int8_tArray)js_invoke_function_uuuuuu(j_calls->instance_ptr, 23, 0, 0, 0, 0, 0, 0);
5624         LDKThirtyTwoBytes ret_ref;
5625         CHECK(ret->arr_len == 32);
5626         memcpy(ret_ref.data, ret->elems, 32); FREE(ret);
5627         return ret_ref;
5628 }
5629 LDKCResult_PublicKeyNoneZ get_node_id_LDKNodeSigner_jcall(const void* this_arg, LDKRecipient recipient) {
5630         LDKNodeSigner_JCalls *j_calls = (LDKNodeSigner_JCalls*) this_arg;
5631         uint32_t recipient_conv = LDKRecipient_to_js(recipient);
5632         uint64_t ret = js_invoke_function_uuuuuu(j_calls->instance_ptr, 24, recipient_conv, 0, 0, 0, 0, 0);
5633         void* ret_ptr = untag_ptr(ret);
5634         CHECK_ACCESS(ret_ptr);
5635         LDKCResult_PublicKeyNoneZ ret_conv = *(LDKCResult_PublicKeyNoneZ*)(ret_ptr);
5636         FREE(untag_ptr(ret));
5637         return ret_conv;
5638 }
5639 LDKCResult_ThirtyTwoBytesNoneZ ecdh_LDKNodeSigner_jcall(const void* this_arg, LDKRecipient recipient, LDKPublicKey other_key, LDKCOption_BigEndianScalarZ tweak) {
5640         LDKNodeSigner_JCalls *j_calls = (LDKNodeSigner_JCalls*) this_arg;
5641         uint32_t recipient_conv = LDKRecipient_to_js(recipient);
5642         int8_tArray other_key_arr = init_int8_tArray(33, __LINE__);
5643         memcpy(other_key_arr->elems, other_key.compressed_form, 33);
5644         LDKCOption_BigEndianScalarZ *tweak_copy = MALLOC(sizeof(LDKCOption_BigEndianScalarZ), "LDKCOption_BigEndianScalarZ");
5645         *tweak_copy = tweak;
5646         uint64_t tweak_ref = tag_ptr(tweak_copy, true);
5647         uint64_t ret = js_invoke_function_uubuuu(j_calls->instance_ptr, 25, recipient_conv, (uint32_t)other_key_arr, tweak_ref, 0, 0, 0);
5648         void* ret_ptr = untag_ptr(ret);
5649         CHECK_ACCESS(ret_ptr);
5650         LDKCResult_ThirtyTwoBytesNoneZ ret_conv = *(LDKCResult_ThirtyTwoBytesNoneZ*)(ret_ptr);
5651         FREE(untag_ptr(ret));
5652         return ret_conv;
5653 }
5654 LDKCResult_RecoverableSignatureNoneZ sign_invoice_LDKNodeSigner_jcall(const void* this_arg, LDKu8slice hrp_bytes, LDKCVec_U5Z invoice_data, LDKRecipient recipient) {
5655         LDKNodeSigner_JCalls *j_calls = (LDKNodeSigner_JCalls*) this_arg;
5656         LDKu8slice hrp_bytes_var = hrp_bytes;
5657         int8_tArray hrp_bytes_arr = init_int8_tArray(hrp_bytes_var.datalen, __LINE__);
5658         memcpy(hrp_bytes_arr->elems, hrp_bytes_var.data, hrp_bytes_var.datalen);
5659         LDKCVec_U5Z invoice_data_var = invoice_data;
5660         ptrArray invoice_data_arr = NULL;
5661         invoice_data_arr = init_ptrArray(invoice_data_var.datalen, __LINE__);
5662         int8_t *invoice_data_arr_ptr = (int8_t*)(((uint8_t*)invoice_data_arr) + 8);
5663         for (size_t h = 0; h < invoice_data_var.datalen; h++) {
5664                 uint8_t invoice_data_conv_7_val = invoice_data_var.data[h]._0;
5665                 invoice_data_arr_ptr[h] = invoice_data_conv_7_val;
5666         }
5667         
5668         FREE(invoice_data_var.data);
5669         uint32_t recipient_conv = LDKRecipient_to_js(recipient);
5670         uint64_t ret = js_invoke_function_uuuuuu(j_calls->instance_ptr, 26, (uint32_t)hrp_bytes_arr, (uint32_t)invoice_data_arr, recipient_conv, 0, 0, 0);
5671         void* ret_ptr = untag_ptr(ret);
5672         CHECK_ACCESS(ret_ptr);
5673         LDKCResult_RecoverableSignatureNoneZ ret_conv = *(LDKCResult_RecoverableSignatureNoneZ*)(ret_ptr);
5674         FREE(untag_ptr(ret));
5675         return ret_conv;
5676 }
5677 LDKCResult_SchnorrSignatureNoneZ sign_bolt12_invoice_request_LDKNodeSigner_jcall(const void* this_arg, const LDKUnsignedInvoiceRequest * invoice_request) {
5678         LDKNodeSigner_JCalls *j_calls = (LDKNodeSigner_JCalls*) this_arg;
5679         LDKUnsignedInvoiceRequest invoice_request_var = *invoice_request;
5680         uint64_t invoice_request_ref = 0;
5681         // WARNING: we may need a move here but no clone is available for LDKUnsignedInvoiceRequest
5682         CHECK_INNER_FIELD_ACCESS_OR_NULL(invoice_request_var);
5683         invoice_request_ref = tag_ptr(invoice_request_var.inner, invoice_request_var.is_owned);
5684         uint64_t ret = js_invoke_function_buuuuu(j_calls->instance_ptr, 27, invoice_request_ref, 0, 0, 0, 0, 0);
5685         void* ret_ptr = untag_ptr(ret);
5686         CHECK_ACCESS(ret_ptr);
5687         LDKCResult_SchnorrSignatureNoneZ ret_conv = *(LDKCResult_SchnorrSignatureNoneZ*)(ret_ptr);
5688         FREE(untag_ptr(ret));
5689         return ret_conv;
5690 }
5691 LDKCResult_SchnorrSignatureNoneZ sign_bolt12_invoice_LDKNodeSigner_jcall(const void* this_arg, const LDKUnsignedBolt12Invoice * invoice) {
5692         LDKNodeSigner_JCalls *j_calls = (LDKNodeSigner_JCalls*) this_arg;
5693         LDKUnsignedBolt12Invoice invoice_var = *invoice;
5694         uint64_t invoice_ref = 0;
5695         // WARNING: we may need a move here but no clone is available for LDKUnsignedBolt12Invoice
5696         CHECK_INNER_FIELD_ACCESS_OR_NULL(invoice_var);
5697         invoice_ref = tag_ptr(invoice_var.inner, invoice_var.is_owned);
5698         uint64_t ret = js_invoke_function_buuuuu(j_calls->instance_ptr, 28, invoice_ref, 0, 0, 0, 0, 0);
5699         void* ret_ptr = untag_ptr(ret);
5700         CHECK_ACCESS(ret_ptr);
5701         LDKCResult_SchnorrSignatureNoneZ ret_conv = *(LDKCResult_SchnorrSignatureNoneZ*)(ret_ptr);
5702         FREE(untag_ptr(ret));
5703         return ret_conv;
5704 }
5705 LDKCResult_ECDSASignatureNoneZ sign_gossip_message_LDKNodeSigner_jcall(const void* this_arg, LDKUnsignedGossipMessage msg) {
5706         LDKNodeSigner_JCalls *j_calls = (LDKNodeSigner_JCalls*) this_arg;
5707         LDKUnsignedGossipMessage *msg_copy = MALLOC(sizeof(LDKUnsignedGossipMessage), "LDKUnsignedGossipMessage");
5708         *msg_copy = msg;
5709         uint64_t msg_ref = tag_ptr(msg_copy, true);
5710         uint64_t ret = js_invoke_function_buuuuu(j_calls->instance_ptr, 29, msg_ref, 0, 0, 0, 0, 0);
5711         void* ret_ptr = untag_ptr(ret);
5712         CHECK_ACCESS(ret_ptr);
5713         LDKCResult_ECDSASignatureNoneZ ret_conv = *(LDKCResult_ECDSASignatureNoneZ*)(ret_ptr);
5714         FREE(untag_ptr(ret));
5715         return ret_conv;
5716 }
5717 static void LDKNodeSigner_JCalls_cloned(LDKNodeSigner* new_obj) {
5718         LDKNodeSigner_JCalls *j_calls = (LDKNodeSigner_JCalls*) new_obj->this_arg;
5719         atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
5720 }
5721 static inline LDKNodeSigner LDKNodeSigner_init (JSValue o) {
5722         LDKNodeSigner_JCalls *calls = MALLOC(sizeof(LDKNodeSigner_JCalls), "LDKNodeSigner_JCalls");
5723         atomic_init(&calls->refcnt, 1);
5724         calls->instance_ptr = o;
5725
5726         LDKNodeSigner ret = {
5727                 .this_arg = (void*) calls,
5728                 .get_inbound_payment_key_material = get_inbound_payment_key_material_LDKNodeSigner_jcall,
5729                 .get_node_id = get_node_id_LDKNodeSigner_jcall,
5730                 .ecdh = ecdh_LDKNodeSigner_jcall,
5731                 .sign_invoice = sign_invoice_LDKNodeSigner_jcall,
5732                 .sign_bolt12_invoice_request = sign_bolt12_invoice_request_LDKNodeSigner_jcall,
5733                 .sign_bolt12_invoice = sign_bolt12_invoice_LDKNodeSigner_jcall,
5734                 .sign_gossip_message = sign_gossip_message_LDKNodeSigner_jcall,
5735                 .free = LDKNodeSigner_JCalls_free,
5736         };
5737         return ret;
5738 }
5739 uint64_t  __attribute__((export_name("TS_LDKNodeSigner_new"))) TS_LDKNodeSigner_new(JSValue o) {
5740         LDKNodeSigner *res_ptr = MALLOC(sizeof(LDKNodeSigner), "LDKNodeSigner");
5741         *res_ptr = LDKNodeSigner_init(o);
5742         return tag_ptr(res_ptr, true);
5743 }
5744 int8_tArray  __attribute__((export_name("TS_NodeSigner_get_inbound_payment_key_material"))) TS_NodeSigner_get_inbound_payment_key_material(uint64_t this_arg) {
5745         void* this_arg_ptr = untag_ptr(this_arg);
5746         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
5747         LDKNodeSigner* this_arg_conv = (LDKNodeSigner*)this_arg_ptr;
5748         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
5749         memcpy(ret_arr->elems, (this_arg_conv->get_inbound_payment_key_material)(this_arg_conv->this_arg).data, 32);
5750         return ret_arr;
5751 }
5752
5753 uint64_t  __attribute__((export_name("TS_NodeSigner_get_node_id"))) TS_NodeSigner_get_node_id(uint64_t this_arg, uint32_t recipient) {
5754         void* this_arg_ptr = untag_ptr(this_arg);
5755         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
5756         LDKNodeSigner* this_arg_conv = (LDKNodeSigner*)this_arg_ptr;
5757         LDKRecipient recipient_conv = LDKRecipient_from_js(recipient);
5758         LDKCResult_PublicKeyNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_PublicKeyNoneZ), "LDKCResult_PublicKeyNoneZ");
5759         *ret_conv = (this_arg_conv->get_node_id)(this_arg_conv->this_arg, recipient_conv);
5760         return tag_ptr(ret_conv, true);
5761 }
5762
5763 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) {
5764         void* this_arg_ptr = untag_ptr(this_arg);
5765         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
5766         LDKNodeSigner* this_arg_conv = (LDKNodeSigner*)this_arg_ptr;
5767         LDKRecipient recipient_conv = LDKRecipient_from_js(recipient);
5768         LDKPublicKey other_key_ref;
5769         CHECK(other_key->arr_len == 33);
5770         memcpy(other_key_ref.compressed_form, other_key->elems, 33); FREE(other_key);
5771         void* tweak_ptr = untag_ptr(tweak);
5772         CHECK_ACCESS(tweak_ptr);
5773         LDKCOption_BigEndianScalarZ tweak_conv = *(LDKCOption_BigEndianScalarZ*)(tweak_ptr);
5774         tweak_conv = COption_BigEndianScalarZ_clone((LDKCOption_BigEndianScalarZ*)untag_ptr(tweak));
5775         LDKCResult_ThirtyTwoBytesNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_ThirtyTwoBytesNoneZ), "LDKCResult_ThirtyTwoBytesNoneZ");
5776         *ret_conv = (this_arg_conv->ecdh)(this_arg_conv->this_arg, recipient_conv, other_key_ref, tweak_conv);
5777         return tag_ptr(ret_conv, true);
5778 }
5779
5780 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) {
5781         void* this_arg_ptr = untag_ptr(this_arg);
5782         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
5783         LDKNodeSigner* this_arg_conv = (LDKNodeSigner*)this_arg_ptr;
5784         LDKu8slice hrp_bytes_ref;
5785         hrp_bytes_ref.datalen = hrp_bytes->arr_len;
5786         hrp_bytes_ref.data = hrp_bytes->elems;
5787         LDKCVec_U5Z invoice_data_constr;
5788         invoice_data_constr.datalen = invoice_data->arr_len;
5789         if (invoice_data_constr.datalen > 0)
5790                 invoice_data_constr.data = MALLOC(invoice_data_constr.datalen * sizeof(LDKU5), "LDKCVec_U5Z Elements");
5791         else
5792                 invoice_data_constr.data = NULL;
5793         int8_t* invoice_data_vals = (void*) invoice_data->elems;
5794         for (size_t h = 0; h < invoice_data_constr.datalen; h++) {
5795                 int8_t invoice_data_conv_7 = invoice_data_vals[h];
5796                 
5797                 invoice_data_constr.data[h] = (LDKU5){ ._0 = invoice_data_conv_7 };
5798         }
5799         FREE(invoice_data);
5800         LDKRecipient recipient_conv = LDKRecipient_from_js(recipient);
5801         LDKCResult_RecoverableSignatureNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_RecoverableSignatureNoneZ), "LDKCResult_RecoverableSignatureNoneZ");
5802         *ret_conv = (this_arg_conv->sign_invoice)(this_arg_conv->this_arg, hrp_bytes_ref, invoice_data_constr, recipient_conv);
5803         FREE(hrp_bytes);
5804         return tag_ptr(ret_conv, true);
5805 }
5806
5807 uint64_t  __attribute__((export_name("TS_NodeSigner_sign_bolt12_invoice_request"))) TS_NodeSigner_sign_bolt12_invoice_request(uint64_t this_arg, uint64_t invoice_request) {
5808         void* this_arg_ptr = untag_ptr(this_arg);
5809         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
5810         LDKNodeSigner* this_arg_conv = (LDKNodeSigner*)this_arg_ptr;
5811         LDKUnsignedInvoiceRequest invoice_request_conv;
5812         invoice_request_conv.inner = untag_ptr(invoice_request);
5813         invoice_request_conv.is_owned = ptr_is_owned(invoice_request);
5814         CHECK_INNER_FIELD_ACCESS_OR_NULL(invoice_request_conv);
5815         invoice_request_conv.is_owned = false;
5816         LDKCResult_SchnorrSignatureNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_SchnorrSignatureNoneZ), "LDKCResult_SchnorrSignatureNoneZ");
5817         *ret_conv = (this_arg_conv->sign_bolt12_invoice_request)(this_arg_conv->this_arg, &invoice_request_conv);
5818         return tag_ptr(ret_conv, true);
5819 }
5820
5821 uint64_t  __attribute__((export_name("TS_NodeSigner_sign_bolt12_invoice"))) TS_NodeSigner_sign_bolt12_invoice(uint64_t this_arg, uint64_t invoice) {
5822         void* this_arg_ptr = untag_ptr(this_arg);
5823         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
5824         LDKNodeSigner* this_arg_conv = (LDKNodeSigner*)this_arg_ptr;
5825         LDKUnsignedBolt12Invoice invoice_conv;
5826         invoice_conv.inner = untag_ptr(invoice);
5827         invoice_conv.is_owned = ptr_is_owned(invoice);
5828         CHECK_INNER_FIELD_ACCESS_OR_NULL(invoice_conv);
5829         invoice_conv.is_owned = false;
5830         LDKCResult_SchnorrSignatureNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_SchnorrSignatureNoneZ), "LDKCResult_SchnorrSignatureNoneZ");
5831         *ret_conv = (this_arg_conv->sign_bolt12_invoice)(this_arg_conv->this_arg, &invoice_conv);
5832         return tag_ptr(ret_conv, true);
5833 }
5834
5835 uint64_t  __attribute__((export_name("TS_NodeSigner_sign_gossip_message"))) TS_NodeSigner_sign_gossip_message(uint64_t this_arg, uint64_t msg) {
5836         void* this_arg_ptr = untag_ptr(this_arg);
5837         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
5838         LDKNodeSigner* this_arg_conv = (LDKNodeSigner*)this_arg_ptr;
5839         void* msg_ptr = untag_ptr(msg);
5840         CHECK_ACCESS(msg_ptr);
5841         LDKUnsignedGossipMessage msg_conv = *(LDKUnsignedGossipMessage*)(msg_ptr);
5842         msg_conv = UnsignedGossipMessage_clone((LDKUnsignedGossipMessage*)untag_ptr(msg));
5843         LDKCResult_ECDSASignatureNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_ECDSASignatureNoneZ), "LDKCResult_ECDSASignatureNoneZ");
5844         *ret_conv = (this_arg_conv->sign_gossip_message)(this_arg_conv->this_arg, msg_conv);
5845         return tag_ptr(ret_conv, true);
5846 }
5847
5848 typedef struct LDKSignerProvider_JCalls {
5849         atomic_size_t refcnt;
5850         uint32_t instance_ptr;
5851 } LDKSignerProvider_JCalls;
5852 static void LDKSignerProvider_JCalls_free(void* this_arg) {
5853         LDKSignerProvider_JCalls *j_calls = (LDKSignerProvider_JCalls*) this_arg;
5854         if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
5855                 FREE(j_calls);
5856         }
5857 }
5858 LDKThirtyTwoBytes generate_channel_keys_id_LDKSignerProvider_jcall(const void* this_arg, bool inbound, uint64_t channel_value_satoshis, LDKU128 user_channel_id) {
5859         LDKSignerProvider_JCalls *j_calls = (LDKSignerProvider_JCalls*) this_arg;
5860         jboolean inbound_conv = inbound;
5861         int64_t channel_value_satoshis_conv = channel_value_satoshis;
5862         int8_tArray user_channel_id_arr = init_int8_tArray(16, __LINE__);
5863         memcpy(user_channel_id_arr->elems, user_channel_id.le_bytes, 16);
5864         int8_tArray ret = (int8_tArray)js_invoke_function_ubuuuu(j_calls->instance_ptr, 30, inbound_conv, channel_value_satoshis_conv, (uint32_t)user_channel_id_arr, 0, 0, 0);
5865         LDKThirtyTwoBytes ret_ref;
5866         CHECK(ret->arr_len == 32);
5867         memcpy(ret_ref.data, ret->elems, 32); FREE(ret);
5868         return ret_ref;
5869 }
5870 LDKWriteableEcdsaChannelSigner derive_channel_signer_LDKSignerProvider_jcall(const void* this_arg, uint64_t channel_value_satoshis, LDKThirtyTwoBytes channel_keys_id) {
5871         LDKSignerProvider_JCalls *j_calls = (LDKSignerProvider_JCalls*) this_arg;
5872         int64_t channel_value_satoshis_conv = channel_value_satoshis;
5873         int8_tArray channel_keys_id_arr = init_int8_tArray(32, __LINE__);
5874         memcpy(channel_keys_id_arr->elems, channel_keys_id.data, 32);
5875         uint64_t ret = js_invoke_function_buuuuu(j_calls->instance_ptr, 31, channel_value_satoshis_conv, (uint32_t)channel_keys_id_arr, 0, 0, 0, 0);
5876         void* ret_ptr = untag_ptr(ret);
5877         CHECK_ACCESS(ret_ptr);
5878         LDKWriteableEcdsaChannelSigner ret_conv = *(LDKWriteableEcdsaChannelSigner*)(ret_ptr);
5879         FREE(untag_ptr(ret));
5880         return ret_conv;
5881 }
5882 LDKCResult_WriteableEcdsaChannelSignerDecodeErrorZ read_chan_signer_LDKSignerProvider_jcall(const void* this_arg, LDKu8slice reader) {
5883         LDKSignerProvider_JCalls *j_calls = (LDKSignerProvider_JCalls*) this_arg;
5884         LDKu8slice reader_var = reader;
5885         int8_tArray reader_arr = init_int8_tArray(reader_var.datalen, __LINE__);
5886         memcpy(reader_arr->elems, reader_var.data, reader_var.datalen);
5887         uint64_t ret = js_invoke_function_uuuuuu(j_calls->instance_ptr, 32, (uint32_t)reader_arr, 0, 0, 0, 0, 0);
5888         void* ret_ptr = untag_ptr(ret);
5889         CHECK_ACCESS(ret_ptr);
5890         LDKCResult_WriteableEcdsaChannelSignerDecodeErrorZ ret_conv = *(LDKCResult_WriteableEcdsaChannelSignerDecodeErrorZ*)(ret_ptr);
5891         FREE(untag_ptr(ret));
5892         return ret_conv;
5893 }
5894 LDKCResult_CVec_u8ZNoneZ get_destination_script_LDKSignerProvider_jcall(const void* this_arg) {
5895         LDKSignerProvider_JCalls *j_calls = (LDKSignerProvider_JCalls*) this_arg;
5896         uint64_t ret = js_invoke_function_uuuuuu(j_calls->instance_ptr, 33, 0, 0, 0, 0, 0, 0);
5897         void* ret_ptr = untag_ptr(ret);
5898         CHECK_ACCESS(ret_ptr);
5899         LDKCResult_CVec_u8ZNoneZ ret_conv = *(LDKCResult_CVec_u8ZNoneZ*)(ret_ptr);
5900         FREE(untag_ptr(ret));
5901         return ret_conv;
5902 }
5903 LDKCResult_ShutdownScriptNoneZ get_shutdown_scriptpubkey_LDKSignerProvider_jcall(const void* this_arg) {
5904         LDKSignerProvider_JCalls *j_calls = (LDKSignerProvider_JCalls*) this_arg;
5905         uint64_t ret = js_invoke_function_uuuuuu(j_calls->instance_ptr, 34, 0, 0, 0, 0, 0, 0);
5906         void* ret_ptr = untag_ptr(ret);
5907         CHECK_ACCESS(ret_ptr);
5908         LDKCResult_ShutdownScriptNoneZ ret_conv = *(LDKCResult_ShutdownScriptNoneZ*)(ret_ptr);
5909         FREE(untag_ptr(ret));
5910         return ret_conv;
5911 }
5912 static void LDKSignerProvider_JCalls_cloned(LDKSignerProvider* new_obj) {
5913         LDKSignerProvider_JCalls *j_calls = (LDKSignerProvider_JCalls*) new_obj->this_arg;
5914         atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
5915 }
5916 static inline LDKSignerProvider LDKSignerProvider_init (JSValue o) {
5917         LDKSignerProvider_JCalls *calls = MALLOC(sizeof(LDKSignerProvider_JCalls), "LDKSignerProvider_JCalls");
5918         atomic_init(&calls->refcnt, 1);
5919         calls->instance_ptr = o;
5920
5921         LDKSignerProvider ret = {
5922                 .this_arg = (void*) calls,
5923                 .generate_channel_keys_id = generate_channel_keys_id_LDKSignerProvider_jcall,
5924                 .derive_channel_signer = derive_channel_signer_LDKSignerProvider_jcall,
5925                 .read_chan_signer = read_chan_signer_LDKSignerProvider_jcall,
5926                 .get_destination_script = get_destination_script_LDKSignerProvider_jcall,
5927                 .get_shutdown_scriptpubkey = get_shutdown_scriptpubkey_LDKSignerProvider_jcall,
5928                 .free = LDKSignerProvider_JCalls_free,
5929         };
5930         return ret;
5931 }
5932 uint64_t  __attribute__((export_name("TS_LDKSignerProvider_new"))) TS_LDKSignerProvider_new(JSValue o) {
5933         LDKSignerProvider *res_ptr = MALLOC(sizeof(LDKSignerProvider), "LDKSignerProvider");
5934         *res_ptr = LDKSignerProvider_init(o);
5935         return tag_ptr(res_ptr, true);
5936 }
5937 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) {
5938         void* this_arg_ptr = untag_ptr(this_arg);
5939         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
5940         LDKSignerProvider* this_arg_conv = (LDKSignerProvider*)this_arg_ptr;
5941         LDKU128 user_channel_id_ref;
5942         CHECK(user_channel_id->arr_len == 16);
5943         memcpy(user_channel_id_ref.le_bytes, user_channel_id->elems, 16); FREE(user_channel_id);
5944         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
5945         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);
5946         return ret_arr;
5947 }
5948
5949 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) {
5950         void* this_arg_ptr = untag_ptr(this_arg);
5951         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
5952         LDKSignerProvider* this_arg_conv = (LDKSignerProvider*)this_arg_ptr;
5953         LDKThirtyTwoBytes channel_keys_id_ref;
5954         CHECK(channel_keys_id->arr_len == 32);
5955         memcpy(channel_keys_id_ref.data, channel_keys_id->elems, 32); FREE(channel_keys_id);
5956         LDKWriteableEcdsaChannelSigner* ret_ret = MALLOC(sizeof(LDKWriteableEcdsaChannelSigner), "LDKWriteableEcdsaChannelSigner");
5957         *ret_ret = (this_arg_conv->derive_channel_signer)(this_arg_conv->this_arg, channel_value_satoshis, channel_keys_id_ref);
5958         return tag_ptr(ret_ret, true);
5959 }
5960
5961 uint64_t  __attribute__((export_name("TS_SignerProvider_read_chan_signer"))) TS_SignerProvider_read_chan_signer(uint64_t this_arg, int8_tArray reader) {
5962         void* this_arg_ptr = untag_ptr(this_arg);
5963         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
5964         LDKSignerProvider* this_arg_conv = (LDKSignerProvider*)this_arg_ptr;
5965         LDKu8slice reader_ref;
5966         reader_ref.datalen = reader->arr_len;
5967         reader_ref.data = reader->elems;
5968         LDKCResult_WriteableEcdsaChannelSignerDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_WriteableEcdsaChannelSignerDecodeErrorZ), "LDKCResult_WriteableEcdsaChannelSignerDecodeErrorZ");
5969         *ret_conv = (this_arg_conv->read_chan_signer)(this_arg_conv->this_arg, reader_ref);
5970         FREE(reader);
5971         return tag_ptr(ret_conv, true);
5972 }
5973
5974 uint64_t  __attribute__((export_name("TS_SignerProvider_get_destination_script"))) TS_SignerProvider_get_destination_script(uint64_t this_arg) {
5975         void* this_arg_ptr = untag_ptr(this_arg);
5976         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
5977         LDKSignerProvider* this_arg_conv = (LDKSignerProvider*)this_arg_ptr;
5978         LDKCResult_CVec_u8ZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_u8ZNoneZ), "LDKCResult_CVec_u8ZNoneZ");
5979         *ret_conv = (this_arg_conv->get_destination_script)(this_arg_conv->this_arg);
5980         return tag_ptr(ret_conv, true);
5981 }
5982
5983 uint64_t  __attribute__((export_name("TS_SignerProvider_get_shutdown_scriptpubkey"))) TS_SignerProvider_get_shutdown_scriptpubkey(uint64_t this_arg) {
5984         void* this_arg_ptr = untag_ptr(this_arg);
5985         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
5986         LDKSignerProvider* this_arg_conv = (LDKSignerProvider*)this_arg_ptr;
5987         LDKCResult_ShutdownScriptNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_ShutdownScriptNoneZ), "LDKCResult_ShutdownScriptNoneZ");
5988         *ret_conv = (this_arg_conv->get_shutdown_scriptpubkey)(this_arg_conv->this_arg);
5989         return tag_ptr(ret_conv, true);
5990 }
5991
5992 typedef struct LDKFeeEstimator_JCalls {
5993         atomic_size_t refcnt;
5994         uint32_t instance_ptr;
5995 } LDKFeeEstimator_JCalls;
5996 static void LDKFeeEstimator_JCalls_free(void* this_arg) {
5997         LDKFeeEstimator_JCalls *j_calls = (LDKFeeEstimator_JCalls*) this_arg;
5998         if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
5999                 FREE(j_calls);
6000         }
6001 }
6002 uint32_t get_est_sat_per_1000_weight_LDKFeeEstimator_jcall(const void* this_arg, LDKConfirmationTarget confirmation_target) {
6003         LDKFeeEstimator_JCalls *j_calls = (LDKFeeEstimator_JCalls*) this_arg;
6004         uint32_t confirmation_target_conv = LDKConfirmationTarget_to_js(confirmation_target);
6005         return js_invoke_function_uuuuuu(j_calls->instance_ptr, 35, confirmation_target_conv, 0, 0, 0, 0, 0);
6006 }
6007 static void LDKFeeEstimator_JCalls_cloned(LDKFeeEstimator* new_obj) {
6008         LDKFeeEstimator_JCalls *j_calls = (LDKFeeEstimator_JCalls*) new_obj->this_arg;
6009         atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
6010 }
6011 static inline LDKFeeEstimator LDKFeeEstimator_init (JSValue o) {
6012         LDKFeeEstimator_JCalls *calls = MALLOC(sizeof(LDKFeeEstimator_JCalls), "LDKFeeEstimator_JCalls");
6013         atomic_init(&calls->refcnt, 1);
6014         calls->instance_ptr = o;
6015
6016         LDKFeeEstimator ret = {
6017                 .this_arg = (void*) calls,
6018                 .get_est_sat_per_1000_weight = get_est_sat_per_1000_weight_LDKFeeEstimator_jcall,
6019                 .free = LDKFeeEstimator_JCalls_free,
6020         };
6021         return ret;
6022 }
6023 uint64_t  __attribute__((export_name("TS_LDKFeeEstimator_new"))) TS_LDKFeeEstimator_new(JSValue o) {
6024         LDKFeeEstimator *res_ptr = MALLOC(sizeof(LDKFeeEstimator), "LDKFeeEstimator");
6025         *res_ptr = LDKFeeEstimator_init(o);
6026         return tag_ptr(res_ptr, true);
6027 }
6028 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) {
6029         void* this_arg_ptr = untag_ptr(this_arg);
6030         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
6031         LDKFeeEstimator* this_arg_conv = (LDKFeeEstimator*)this_arg_ptr;
6032         LDKConfirmationTarget confirmation_target_conv = LDKConfirmationTarget_from_js(confirmation_target);
6033         int32_t ret_conv = (this_arg_conv->get_est_sat_per_1000_weight)(this_arg_conv->this_arg, confirmation_target_conv);
6034         return ret_conv;
6035 }
6036
6037 typedef struct LDKRouter_JCalls {
6038         atomic_size_t refcnt;
6039         uint32_t instance_ptr;
6040 } LDKRouter_JCalls;
6041 static void LDKRouter_JCalls_free(void* this_arg) {
6042         LDKRouter_JCalls *j_calls = (LDKRouter_JCalls*) this_arg;
6043         if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
6044                 FREE(j_calls);
6045         }
6046 }
6047 LDKCResult_RouteLightningErrorZ find_route_LDKRouter_jcall(const void* this_arg, LDKPublicKey payer, const LDKRouteParameters * route_params, LDKCVec_ChannelDetailsZ * first_hops, LDKInFlightHtlcs inflight_htlcs) {
6048         LDKRouter_JCalls *j_calls = (LDKRouter_JCalls*) this_arg;
6049         int8_tArray payer_arr = init_int8_tArray(33, __LINE__);
6050         memcpy(payer_arr->elems, payer.compressed_form, 33);
6051         LDKRouteParameters route_params_var = *route_params;
6052         uint64_t route_params_ref = 0;
6053         route_params_var = RouteParameters_clone(&route_params_var);
6054         CHECK_INNER_FIELD_ACCESS_OR_NULL(route_params_var);
6055         route_params_ref = tag_ptr(route_params_var.inner, route_params_var.is_owned);
6056         LDKCVec_ChannelDetailsZ *first_hops_var_ptr = first_hops;
6057         uint64_tArray first_hops_arr = NULL;
6058         if (first_hops != NULL) {
6059                 LDKCVec_ChannelDetailsZ first_hops_var = *first_hops_var_ptr;
6060                 first_hops_arr = init_uint64_tArray(first_hops_var.datalen, __LINE__);
6061                 uint64_t *first_hops_arr_ptr = (uint64_t*)(((uint8_t*)first_hops_arr) + 8);
6062                 for (size_t q = 0; q < first_hops_var.datalen; q++) {
6063                         LDKChannelDetails first_hops_conv_16_var =      first_hops_var.data[q];
6064                         uint64_t first_hops_conv_16_ref = 0;
6065                         CHECK_INNER_FIELD_ACCESS_OR_NULL(first_hops_conv_16_var);
6066                         first_hops_conv_16_ref = tag_ptr(first_hops_conv_16_var.inner, first_hops_conv_16_var.is_owned);
6067                         first_hops_arr_ptr[q] = first_hops_conv_16_ref;
6068                 }
6069         
6070         }
6071         LDKInFlightHtlcs inflight_htlcs_var = inflight_htlcs;
6072         uint64_t inflight_htlcs_ref = 0;
6073         CHECK_INNER_FIELD_ACCESS_OR_NULL(inflight_htlcs_var);
6074         inflight_htlcs_ref = tag_ptr(inflight_htlcs_var.inner, inflight_htlcs_var.is_owned);
6075         uint64_t ret = js_invoke_function_ububuu(j_calls->instance_ptr, 36, (uint32_t)payer_arr, route_params_ref, (uint32_t)first_hops_arr, inflight_htlcs_ref, 0, 0);
6076         void* ret_ptr = untag_ptr(ret);
6077         CHECK_ACCESS(ret_ptr);
6078         LDKCResult_RouteLightningErrorZ ret_conv = *(LDKCResult_RouteLightningErrorZ*)(ret_ptr);
6079         FREE(untag_ptr(ret));
6080         return ret_conv;
6081 }
6082 LDKCResult_RouteLightningErrorZ find_route_with_id_LDKRouter_jcall(const void* this_arg, LDKPublicKey payer, const LDKRouteParameters * route_params, LDKCVec_ChannelDetailsZ * first_hops, LDKInFlightHtlcs inflight_htlcs, LDKThirtyTwoBytes _payment_hash, LDKThirtyTwoBytes _payment_id) {
6083         LDKRouter_JCalls *j_calls = (LDKRouter_JCalls*) this_arg;
6084         int8_tArray payer_arr = init_int8_tArray(33, __LINE__);
6085         memcpy(payer_arr->elems, payer.compressed_form, 33);
6086         LDKRouteParameters route_params_var = *route_params;
6087         uint64_t route_params_ref = 0;
6088         route_params_var = RouteParameters_clone(&route_params_var);
6089         CHECK_INNER_FIELD_ACCESS_OR_NULL(route_params_var);
6090         route_params_ref = tag_ptr(route_params_var.inner, route_params_var.is_owned);
6091         LDKCVec_ChannelDetailsZ *first_hops_var_ptr = first_hops;
6092         uint64_tArray first_hops_arr = NULL;
6093         if (first_hops != NULL) {
6094                 LDKCVec_ChannelDetailsZ first_hops_var = *first_hops_var_ptr;
6095                 first_hops_arr = init_uint64_tArray(first_hops_var.datalen, __LINE__);
6096                 uint64_t *first_hops_arr_ptr = (uint64_t*)(((uint8_t*)first_hops_arr) + 8);
6097                 for (size_t q = 0; q < first_hops_var.datalen; q++) {
6098                         LDKChannelDetails first_hops_conv_16_var =      first_hops_var.data[q];
6099                         uint64_t first_hops_conv_16_ref = 0;
6100                         CHECK_INNER_FIELD_ACCESS_OR_NULL(first_hops_conv_16_var);
6101                         first_hops_conv_16_ref = tag_ptr(first_hops_conv_16_var.inner, first_hops_conv_16_var.is_owned);
6102                         first_hops_arr_ptr[q] = first_hops_conv_16_ref;
6103                 }
6104         
6105         }
6106         LDKInFlightHtlcs inflight_htlcs_var = inflight_htlcs;
6107         uint64_t inflight_htlcs_ref = 0;
6108         CHECK_INNER_FIELD_ACCESS_OR_NULL(inflight_htlcs_var);
6109         inflight_htlcs_ref = tag_ptr(inflight_htlcs_var.inner, inflight_htlcs_var.is_owned);
6110         int8_tArray _payment_hash_arr = init_int8_tArray(32, __LINE__);
6111         memcpy(_payment_hash_arr->elems, _payment_hash.data, 32);
6112         int8_tArray _payment_id_arr = init_int8_tArray(32, __LINE__);
6113         memcpy(_payment_id_arr->elems, _payment_id.data, 32);
6114         uint64_t ret = js_invoke_function_ububuu(j_calls->instance_ptr, 37, (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);
6115         void* ret_ptr = untag_ptr(ret);
6116         CHECK_ACCESS(ret_ptr);
6117         LDKCResult_RouteLightningErrorZ ret_conv = *(LDKCResult_RouteLightningErrorZ*)(ret_ptr);
6118         FREE(untag_ptr(ret));
6119         return ret_conv;
6120 }
6121 static void LDKRouter_JCalls_cloned(LDKRouter* new_obj) {
6122         LDKRouter_JCalls *j_calls = (LDKRouter_JCalls*) new_obj->this_arg;
6123         atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
6124 }
6125 static inline LDKRouter LDKRouter_init (JSValue o) {
6126         LDKRouter_JCalls *calls = MALLOC(sizeof(LDKRouter_JCalls), "LDKRouter_JCalls");
6127         atomic_init(&calls->refcnt, 1);
6128         calls->instance_ptr = o;
6129
6130         LDKRouter ret = {
6131                 .this_arg = (void*) calls,
6132                 .find_route = find_route_LDKRouter_jcall,
6133                 .find_route_with_id = find_route_with_id_LDKRouter_jcall,
6134                 .free = LDKRouter_JCalls_free,
6135         };
6136         return ret;
6137 }
6138 uint64_t  __attribute__((export_name("TS_LDKRouter_new"))) TS_LDKRouter_new(JSValue o) {
6139         LDKRouter *res_ptr = MALLOC(sizeof(LDKRouter), "LDKRouter");
6140         *res_ptr = LDKRouter_init(o);
6141         return tag_ptr(res_ptr, true);
6142 }
6143 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) {
6144         void* this_arg_ptr = untag_ptr(this_arg);
6145         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
6146         LDKRouter* this_arg_conv = (LDKRouter*)this_arg_ptr;
6147         LDKPublicKey payer_ref;
6148         CHECK(payer->arr_len == 33);
6149         memcpy(payer_ref.compressed_form, payer->elems, 33); FREE(payer);
6150         LDKRouteParameters route_params_conv;
6151         route_params_conv.inner = untag_ptr(route_params);
6152         route_params_conv.is_owned = ptr_is_owned(route_params);
6153         CHECK_INNER_FIELD_ACCESS_OR_NULL(route_params_conv);
6154         route_params_conv.is_owned = false;
6155         LDKCVec_ChannelDetailsZ first_hops_constr;
6156         LDKCVec_ChannelDetailsZ *first_hops_ptr = NULL;
6157         if (first_hops != 0) {
6158                 first_hops_constr.datalen = first_hops->arr_len;
6159                 if (first_hops_constr.datalen > 0)
6160                         first_hops_constr.data = MALLOC(first_hops_constr.datalen * sizeof(LDKChannelDetails), "LDKCVec_ChannelDetailsZ Elements");
6161                 else
6162                         first_hops_constr.data = NULL;
6163                 uint64_t* first_hops_vals = first_hops->elems;
6164                 for (size_t q = 0; q < first_hops_constr.datalen; q++) {
6165                         uint64_t first_hops_conv_16 = first_hops_vals[q];
6166                         LDKChannelDetails first_hops_conv_16_conv;
6167                         first_hops_conv_16_conv.inner = untag_ptr(first_hops_conv_16);
6168                         first_hops_conv_16_conv.is_owned = ptr_is_owned(first_hops_conv_16);
6169                         CHECK_INNER_FIELD_ACCESS_OR_NULL(first_hops_conv_16_conv);
6170                         first_hops_conv_16_conv.is_owned = false;
6171                         first_hops_constr.data[q] = first_hops_conv_16_conv;
6172                 }
6173                 FREE(first_hops);
6174                 first_hops_ptr = &first_hops_constr;
6175         }
6176         LDKInFlightHtlcs inflight_htlcs_conv;
6177         inflight_htlcs_conv.inner = untag_ptr(inflight_htlcs);
6178         inflight_htlcs_conv.is_owned = ptr_is_owned(inflight_htlcs);
6179         CHECK_INNER_FIELD_ACCESS_OR_NULL(inflight_htlcs_conv);
6180         inflight_htlcs_conv = InFlightHtlcs_clone(&inflight_htlcs_conv);
6181         LDKCResult_RouteLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteLightningErrorZ), "LDKCResult_RouteLightningErrorZ");
6182         *ret_conv = (this_arg_conv->find_route)(this_arg_conv->this_arg, payer_ref, &route_params_conv, first_hops_ptr, inflight_htlcs_conv);
6183         if (first_hops_ptr != NULL) { FREE(first_hops_constr.data); }
6184         return tag_ptr(ret_conv, true);
6185 }
6186
6187 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) {
6188         void* this_arg_ptr = untag_ptr(this_arg);
6189         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
6190         LDKRouter* this_arg_conv = (LDKRouter*)this_arg_ptr;
6191         LDKPublicKey payer_ref;
6192         CHECK(payer->arr_len == 33);
6193         memcpy(payer_ref.compressed_form, payer->elems, 33); FREE(payer);
6194         LDKRouteParameters route_params_conv;
6195         route_params_conv.inner = untag_ptr(route_params);
6196         route_params_conv.is_owned = ptr_is_owned(route_params);
6197         CHECK_INNER_FIELD_ACCESS_OR_NULL(route_params_conv);
6198         route_params_conv.is_owned = false;
6199         LDKCVec_ChannelDetailsZ first_hops_constr;
6200         LDKCVec_ChannelDetailsZ *first_hops_ptr = NULL;
6201         if (first_hops != 0) {
6202                 first_hops_constr.datalen = first_hops->arr_len;
6203                 if (first_hops_constr.datalen > 0)
6204                         first_hops_constr.data = MALLOC(first_hops_constr.datalen * sizeof(LDKChannelDetails), "LDKCVec_ChannelDetailsZ Elements");
6205                 else
6206                         first_hops_constr.data = NULL;
6207                 uint64_t* first_hops_vals = first_hops->elems;
6208                 for (size_t q = 0; q < first_hops_constr.datalen; q++) {
6209                         uint64_t first_hops_conv_16 = first_hops_vals[q];
6210                         LDKChannelDetails first_hops_conv_16_conv;
6211                         first_hops_conv_16_conv.inner = untag_ptr(first_hops_conv_16);
6212                         first_hops_conv_16_conv.is_owned = ptr_is_owned(first_hops_conv_16);
6213                         CHECK_INNER_FIELD_ACCESS_OR_NULL(first_hops_conv_16_conv);
6214                         first_hops_conv_16_conv.is_owned = false;
6215                         first_hops_constr.data[q] = first_hops_conv_16_conv;
6216                 }
6217                 FREE(first_hops);
6218                 first_hops_ptr = &first_hops_constr;
6219         }
6220         LDKInFlightHtlcs inflight_htlcs_conv;
6221         inflight_htlcs_conv.inner = untag_ptr(inflight_htlcs);
6222         inflight_htlcs_conv.is_owned = ptr_is_owned(inflight_htlcs);
6223         CHECK_INNER_FIELD_ACCESS_OR_NULL(inflight_htlcs_conv);
6224         inflight_htlcs_conv = InFlightHtlcs_clone(&inflight_htlcs_conv);
6225         LDKThirtyTwoBytes _payment_hash_ref;
6226         CHECK(_payment_hash->arr_len == 32);
6227         memcpy(_payment_hash_ref.data, _payment_hash->elems, 32); FREE(_payment_hash);
6228         LDKThirtyTwoBytes _payment_id_ref;
6229         CHECK(_payment_id->arr_len == 32);
6230         memcpy(_payment_id_ref.data, _payment_id->elems, 32); FREE(_payment_id);
6231         LDKCResult_RouteLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteLightningErrorZ), "LDKCResult_RouteLightningErrorZ");
6232         *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);
6233         if (first_hops_ptr != NULL) { FREE(first_hops_constr.data); }
6234         return tag_ptr(ret_conv, true);
6235 }
6236
6237 static inline struct LDKThirtyTwoBytes C2Tuple_ThirtyTwoBytesChannelManagerZ_get_a(LDKC2Tuple_ThirtyTwoBytesChannelManagerZ *NONNULL_PTR owner){
6238         return ThirtyTwoBytes_clone(&owner->a);
6239 }
6240 int8_tArray  __attribute__((export_name("TS_C2Tuple_ThirtyTwoBytesChannelManagerZ_get_a"))) TS_C2Tuple_ThirtyTwoBytesChannelManagerZ_get_a(uint64_t owner) {
6241         LDKC2Tuple_ThirtyTwoBytesChannelManagerZ* owner_conv = (LDKC2Tuple_ThirtyTwoBytesChannelManagerZ*)untag_ptr(owner);
6242         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
6243         memcpy(ret_arr->elems, C2Tuple_ThirtyTwoBytesChannelManagerZ_get_a(owner_conv).data, 32);
6244         return ret_arr;
6245 }
6246
6247 static inline struct LDKChannelManager C2Tuple_ThirtyTwoBytesChannelManagerZ_get_b(LDKC2Tuple_ThirtyTwoBytesChannelManagerZ *NONNULL_PTR owner){
6248         LDKChannelManager ret = owner->b;
6249         ret.is_owned = false;
6250         return ret;
6251 }
6252 uint64_t  __attribute__((export_name("TS_C2Tuple_ThirtyTwoBytesChannelManagerZ_get_b"))) TS_C2Tuple_ThirtyTwoBytesChannelManagerZ_get_b(uint64_t owner) {
6253         LDKC2Tuple_ThirtyTwoBytesChannelManagerZ* owner_conv = (LDKC2Tuple_ThirtyTwoBytesChannelManagerZ*)untag_ptr(owner);
6254         LDKChannelManager ret_var = C2Tuple_ThirtyTwoBytesChannelManagerZ_get_b(owner_conv);
6255         uint64_t ret_ref = 0;
6256         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
6257         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
6258         return ret_ref;
6259 }
6260
6261 static inline struct LDKC2Tuple_ThirtyTwoBytesChannelManagerZ *CResult_C2Tuple_ThirtyTwoBytesChannelManagerZDecodeErrorZ_get_ok(LDKCResult_C2Tuple_ThirtyTwoBytesChannelManagerZDecodeErrorZ *NONNULL_PTR owner){
6262 CHECK(owner->result_ok);
6263         return &*owner->contents.result;
6264 }
6265 uint64_t  __attribute__((export_name("TS_CResult_C2Tuple_ThirtyTwoBytesChannelManagerZDecodeErrorZ_get_ok"))) TS_CResult_C2Tuple_ThirtyTwoBytesChannelManagerZDecodeErrorZ_get_ok(uint64_t owner) {
6266         LDKCResult_C2Tuple_ThirtyTwoBytesChannelManagerZDecodeErrorZ* owner_conv = (LDKCResult_C2Tuple_ThirtyTwoBytesChannelManagerZDecodeErrorZ*)untag_ptr(owner);
6267         uint64_t ret_ret = tag_ptr(CResult_C2Tuple_ThirtyTwoBytesChannelManagerZDecodeErrorZ_get_ok(owner_conv), false);
6268         return ret_ret;
6269 }
6270
6271 static inline struct LDKDecodeError CResult_C2Tuple_ThirtyTwoBytesChannelManagerZDecodeErrorZ_get_err(LDKCResult_C2Tuple_ThirtyTwoBytesChannelManagerZDecodeErrorZ *NONNULL_PTR owner){
6272 CHECK(!owner->result_ok);
6273         return DecodeError_clone(&*owner->contents.err);
6274 }
6275 uint64_t  __attribute__((export_name("TS_CResult_C2Tuple_ThirtyTwoBytesChannelManagerZDecodeErrorZ_get_err"))) TS_CResult_C2Tuple_ThirtyTwoBytesChannelManagerZDecodeErrorZ_get_err(uint64_t owner) {
6276         LDKCResult_C2Tuple_ThirtyTwoBytesChannelManagerZDecodeErrorZ* owner_conv = (LDKCResult_C2Tuple_ThirtyTwoBytesChannelManagerZDecodeErrorZ*)untag_ptr(owner);
6277         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
6278         *ret_copy = CResult_C2Tuple_ThirtyTwoBytesChannelManagerZDecodeErrorZ_get_err(owner_conv);
6279         uint64_t ret_ref = tag_ptr(ret_copy, true);
6280         return ret_ref;
6281 }
6282
6283 uint32_t __attribute__((export_name("TS_LDKMaxDustHTLCExposure_ty_from_ptr"))) TS_LDKMaxDustHTLCExposure_ty_from_ptr(uint64_t ptr) {
6284         LDKMaxDustHTLCExposure *obj = (LDKMaxDustHTLCExposure*)untag_ptr(ptr);
6285         switch(obj->tag) {
6286                 case LDKMaxDustHTLCExposure_FixedLimitMsat: return 0;
6287                 case LDKMaxDustHTLCExposure_FeeRateMultiplier: return 1;
6288                 default: abort();
6289         }
6290 }
6291 int64_t __attribute__((export_name("TS_LDKMaxDustHTLCExposure_FixedLimitMsat_get_fixed_limit_msat"))) TS_LDKMaxDustHTLCExposure_FixedLimitMsat_get_fixed_limit_msat(uint64_t ptr) {
6292         LDKMaxDustHTLCExposure *obj = (LDKMaxDustHTLCExposure*)untag_ptr(ptr);
6293         assert(obj->tag == LDKMaxDustHTLCExposure_FixedLimitMsat);
6294         int64_t fixed_limit_msat_conv = obj->fixed_limit_msat;
6295         return fixed_limit_msat_conv;
6296 }
6297 int64_t __attribute__((export_name("TS_LDKMaxDustHTLCExposure_FeeRateMultiplier_get_fee_rate_multiplier"))) TS_LDKMaxDustHTLCExposure_FeeRateMultiplier_get_fee_rate_multiplier(uint64_t ptr) {
6298         LDKMaxDustHTLCExposure *obj = (LDKMaxDustHTLCExposure*)untag_ptr(ptr);
6299         assert(obj->tag == LDKMaxDustHTLCExposure_FeeRateMultiplier);
6300         int64_t fee_rate_multiplier_conv = obj->fee_rate_multiplier;
6301         return fee_rate_multiplier_conv;
6302 }
6303 static inline struct LDKMaxDustHTLCExposure CResult_MaxDustHTLCExposureDecodeErrorZ_get_ok(LDKCResult_MaxDustHTLCExposureDecodeErrorZ *NONNULL_PTR owner){
6304 CHECK(owner->result_ok);
6305         return MaxDustHTLCExposure_clone(&*owner->contents.result);
6306 }
6307 uint64_t  __attribute__((export_name("TS_CResult_MaxDustHTLCExposureDecodeErrorZ_get_ok"))) TS_CResult_MaxDustHTLCExposureDecodeErrorZ_get_ok(uint64_t owner) {
6308         LDKCResult_MaxDustHTLCExposureDecodeErrorZ* owner_conv = (LDKCResult_MaxDustHTLCExposureDecodeErrorZ*)untag_ptr(owner);
6309         LDKMaxDustHTLCExposure *ret_copy = MALLOC(sizeof(LDKMaxDustHTLCExposure), "LDKMaxDustHTLCExposure");
6310         *ret_copy = CResult_MaxDustHTLCExposureDecodeErrorZ_get_ok(owner_conv);
6311         uint64_t ret_ref = tag_ptr(ret_copy, true);
6312         return ret_ref;
6313 }
6314
6315 static inline struct LDKDecodeError CResult_MaxDustHTLCExposureDecodeErrorZ_get_err(LDKCResult_MaxDustHTLCExposureDecodeErrorZ *NONNULL_PTR owner){
6316 CHECK(!owner->result_ok);
6317         return DecodeError_clone(&*owner->contents.err);
6318 }
6319 uint64_t  __attribute__((export_name("TS_CResult_MaxDustHTLCExposureDecodeErrorZ_get_err"))) TS_CResult_MaxDustHTLCExposureDecodeErrorZ_get_err(uint64_t owner) {
6320         LDKCResult_MaxDustHTLCExposureDecodeErrorZ* owner_conv = (LDKCResult_MaxDustHTLCExposureDecodeErrorZ*)untag_ptr(owner);
6321         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
6322         *ret_copy = CResult_MaxDustHTLCExposureDecodeErrorZ_get_err(owner_conv);
6323         uint64_t ret_ref = tag_ptr(ret_copy, true);
6324         return ret_ref;
6325 }
6326
6327 static inline struct LDKChannelConfig CResult_ChannelConfigDecodeErrorZ_get_ok(LDKCResult_ChannelConfigDecodeErrorZ *NONNULL_PTR owner){
6328         LDKChannelConfig ret = *owner->contents.result;
6329         ret.is_owned = false;
6330         return ret;
6331 }
6332 uint64_t  __attribute__((export_name("TS_CResult_ChannelConfigDecodeErrorZ_get_ok"))) TS_CResult_ChannelConfigDecodeErrorZ_get_ok(uint64_t owner) {
6333         LDKCResult_ChannelConfigDecodeErrorZ* owner_conv = (LDKCResult_ChannelConfigDecodeErrorZ*)untag_ptr(owner);
6334         LDKChannelConfig ret_var = CResult_ChannelConfigDecodeErrorZ_get_ok(owner_conv);
6335         uint64_t ret_ref = 0;
6336         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
6337         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
6338         return ret_ref;
6339 }
6340
6341 static inline struct LDKDecodeError CResult_ChannelConfigDecodeErrorZ_get_err(LDKCResult_ChannelConfigDecodeErrorZ *NONNULL_PTR owner){
6342 CHECK(!owner->result_ok);
6343         return DecodeError_clone(&*owner->contents.err);
6344 }
6345 uint64_t  __attribute__((export_name("TS_CResult_ChannelConfigDecodeErrorZ_get_err"))) TS_CResult_ChannelConfigDecodeErrorZ_get_err(uint64_t owner) {
6346         LDKCResult_ChannelConfigDecodeErrorZ* owner_conv = (LDKCResult_ChannelConfigDecodeErrorZ*)untag_ptr(owner);
6347         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
6348         *ret_copy = CResult_ChannelConfigDecodeErrorZ_get_err(owner_conv);
6349         uint64_t ret_ref = tag_ptr(ret_copy, true);
6350         return ret_ref;
6351 }
6352
6353 uint32_t __attribute__((export_name("TS_LDKCOption_MaxDustHTLCExposureZ_ty_from_ptr"))) TS_LDKCOption_MaxDustHTLCExposureZ_ty_from_ptr(uint64_t ptr) {
6354         LDKCOption_MaxDustHTLCExposureZ *obj = (LDKCOption_MaxDustHTLCExposureZ*)untag_ptr(ptr);
6355         switch(obj->tag) {
6356                 case LDKCOption_MaxDustHTLCExposureZ_Some: return 0;
6357                 case LDKCOption_MaxDustHTLCExposureZ_None: return 1;
6358                 default: abort();
6359         }
6360 }
6361 uint64_t __attribute__((export_name("TS_LDKCOption_MaxDustHTLCExposureZ_Some_get_some"))) TS_LDKCOption_MaxDustHTLCExposureZ_Some_get_some(uint64_t ptr) {
6362         LDKCOption_MaxDustHTLCExposureZ *obj = (LDKCOption_MaxDustHTLCExposureZ*)untag_ptr(ptr);
6363         assert(obj->tag == LDKCOption_MaxDustHTLCExposureZ_Some);
6364         uint64_t some_ref = tag_ptr(&obj->some, false);
6365         return some_ref;
6366 }
6367 uint32_t __attribute__((export_name("TS_LDKCOption_APIErrorZ_ty_from_ptr"))) TS_LDKCOption_APIErrorZ_ty_from_ptr(uint64_t ptr) {
6368         LDKCOption_APIErrorZ *obj = (LDKCOption_APIErrorZ*)untag_ptr(ptr);
6369         switch(obj->tag) {
6370                 case LDKCOption_APIErrorZ_Some: return 0;
6371                 case LDKCOption_APIErrorZ_None: return 1;
6372                 default: abort();
6373         }
6374 }
6375 uint64_t __attribute__((export_name("TS_LDKCOption_APIErrorZ_Some_get_some"))) TS_LDKCOption_APIErrorZ_Some_get_some(uint64_t ptr) {
6376         LDKCOption_APIErrorZ *obj = (LDKCOption_APIErrorZ*)untag_ptr(ptr);
6377         assert(obj->tag == LDKCOption_APIErrorZ_Some);
6378         uint64_t some_ref = tag_ptr(&obj->some, false);
6379         return some_ref;
6380 }
6381 static inline struct LDKCOption_APIErrorZ CResult_COption_APIErrorZDecodeErrorZ_get_ok(LDKCResult_COption_APIErrorZDecodeErrorZ *NONNULL_PTR owner){
6382 CHECK(owner->result_ok);
6383         return COption_APIErrorZ_clone(&*owner->contents.result);
6384 }
6385 uint64_t  __attribute__((export_name("TS_CResult_COption_APIErrorZDecodeErrorZ_get_ok"))) TS_CResult_COption_APIErrorZDecodeErrorZ_get_ok(uint64_t owner) {
6386         LDKCResult_COption_APIErrorZDecodeErrorZ* owner_conv = (LDKCResult_COption_APIErrorZDecodeErrorZ*)untag_ptr(owner);
6387         LDKCOption_APIErrorZ *ret_copy = MALLOC(sizeof(LDKCOption_APIErrorZ), "LDKCOption_APIErrorZ");
6388         *ret_copy = CResult_COption_APIErrorZDecodeErrorZ_get_ok(owner_conv);
6389         uint64_t ret_ref = tag_ptr(ret_copy, true);
6390         return ret_ref;
6391 }
6392
6393 static inline struct LDKDecodeError CResult_COption_APIErrorZDecodeErrorZ_get_err(LDKCResult_COption_APIErrorZDecodeErrorZ *NONNULL_PTR owner){
6394 CHECK(!owner->result_ok);
6395         return DecodeError_clone(&*owner->contents.err);
6396 }
6397 uint64_t  __attribute__((export_name("TS_CResult_COption_APIErrorZDecodeErrorZ_get_err"))) TS_CResult_COption_APIErrorZDecodeErrorZ_get_err(uint64_t owner) {
6398         LDKCResult_COption_APIErrorZDecodeErrorZ* owner_conv = (LDKCResult_COption_APIErrorZDecodeErrorZ*)untag_ptr(owner);
6399         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
6400         *ret_copy = CResult_COption_APIErrorZDecodeErrorZ_get_err(owner_conv);
6401         uint64_t ret_ref = tag_ptr(ret_copy, true);
6402         return ret_ref;
6403 }
6404
6405 static inline struct LDKChannelMonitorUpdate CResult_ChannelMonitorUpdateDecodeErrorZ_get_ok(LDKCResult_ChannelMonitorUpdateDecodeErrorZ *NONNULL_PTR owner){
6406         LDKChannelMonitorUpdate ret = *owner->contents.result;
6407         ret.is_owned = false;
6408         return ret;
6409 }
6410 uint64_t  __attribute__((export_name("TS_CResult_ChannelMonitorUpdateDecodeErrorZ_get_ok"))) TS_CResult_ChannelMonitorUpdateDecodeErrorZ_get_ok(uint64_t owner) {
6411         LDKCResult_ChannelMonitorUpdateDecodeErrorZ* owner_conv = (LDKCResult_ChannelMonitorUpdateDecodeErrorZ*)untag_ptr(owner);
6412         LDKChannelMonitorUpdate ret_var = CResult_ChannelMonitorUpdateDecodeErrorZ_get_ok(owner_conv);
6413         uint64_t ret_ref = 0;
6414         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
6415         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
6416         return ret_ref;
6417 }
6418
6419 static inline struct LDKDecodeError CResult_ChannelMonitorUpdateDecodeErrorZ_get_err(LDKCResult_ChannelMonitorUpdateDecodeErrorZ *NONNULL_PTR owner){
6420 CHECK(!owner->result_ok);
6421         return DecodeError_clone(&*owner->contents.err);
6422 }
6423 uint64_t  __attribute__((export_name("TS_CResult_ChannelMonitorUpdateDecodeErrorZ_get_err"))) TS_CResult_ChannelMonitorUpdateDecodeErrorZ_get_err(uint64_t owner) {
6424         LDKCResult_ChannelMonitorUpdateDecodeErrorZ* owner_conv = (LDKCResult_ChannelMonitorUpdateDecodeErrorZ*)untag_ptr(owner);
6425         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
6426         *ret_copy = CResult_ChannelMonitorUpdateDecodeErrorZ_get_err(owner_conv);
6427         uint64_t ret_ref = tag_ptr(ret_copy, true);
6428         return ret_ref;
6429 }
6430
6431 uint32_t __attribute__((export_name("TS_LDKCOption_MonitorEventZ_ty_from_ptr"))) TS_LDKCOption_MonitorEventZ_ty_from_ptr(uint64_t ptr) {
6432         LDKCOption_MonitorEventZ *obj = (LDKCOption_MonitorEventZ*)untag_ptr(ptr);
6433         switch(obj->tag) {
6434                 case LDKCOption_MonitorEventZ_Some: return 0;
6435                 case LDKCOption_MonitorEventZ_None: return 1;
6436                 default: abort();
6437         }
6438 }
6439 uint64_t __attribute__((export_name("TS_LDKCOption_MonitorEventZ_Some_get_some"))) TS_LDKCOption_MonitorEventZ_Some_get_some(uint64_t ptr) {
6440         LDKCOption_MonitorEventZ *obj = (LDKCOption_MonitorEventZ*)untag_ptr(ptr);
6441         assert(obj->tag == LDKCOption_MonitorEventZ_Some);
6442         uint64_t some_ref = tag_ptr(&obj->some, false);
6443         return some_ref;
6444 }
6445 static inline struct LDKCOption_MonitorEventZ CResult_COption_MonitorEventZDecodeErrorZ_get_ok(LDKCResult_COption_MonitorEventZDecodeErrorZ *NONNULL_PTR owner){
6446 CHECK(owner->result_ok);
6447         return COption_MonitorEventZ_clone(&*owner->contents.result);
6448 }
6449 uint64_t  __attribute__((export_name("TS_CResult_COption_MonitorEventZDecodeErrorZ_get_ok"))) TS_CResult_COption_MonitorEventZDecodeErrorZ_get_ok(uint64_t owner) {
6450         LDKCResult_COption_MonitorEventZDecodeErrorZ* owner_conv = (LDKCResult_COption_MonitorEventZDecodeErrorZ*)untag_ptr(owner);
6451         LDKCOption_MonitorEventZ *ret_copy = MALLOC(sizeof(LDKCOption_MonitorEventZ), "LDKCOption_MonitorEventZ");
6452         *ret_copy = CResult_COption_MonitorEventZDecodeErrorZ_get_ok(owner_conv);
6453         uint64_t ret_ref = tag_ptr(ret_copy, true);
6454         return ret_ref;
6455 }
6456
6457 static inline struct LDKDecodeError CResult_COption_MonitorEventZDecodeErrorZ_get_err(LDKCResult_COption_MonitorEventZDecodeErrorZ *NONNULL_PTR owner){
6458 CHECK(!owner->result_ok);
6459         return DecodeError_clone(&*owner->contents.err);
6460 }
6461 uint64_t  __attribute__((export_name("TS_CResult_COption_MonitorEventZDecodeErrorZ_get_err"))) TS_CResult_COption_MonitorEventZDecodeErrorZ_get_err(uint64_t owner) {
6462         LDKCResult_COption_MonitorEventZDecodeErrorZ* owner_conv = (LDKCResult_COption_MonitorEventZDecodeErrorZ*)untag_ptr(owner);
6463         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
6464         *ret_copy = CResult_COption_MonitorEventZDecodeErrorZ_get_err(owner_conv);
6465         uint64_t ret_ref = tag_ptr(ret_copy, true);
6466         return ret_ref;
6467 }
6468
6469 static inline struct LDKHTLCUpdate CResult_HTLCUpdateDecodeErrorZ_get_ok(LDKCResult_HTLCUpdateDecodeErrorZ *NONNULL_PTR owner){
6470         LDKHTLCUpdate ret = *owner->contents.result;
6471         ret.is_owned = false;
6472         return ret;
6473 }
6474 uint64_t  __attribute__((export_name("TS_CResult_HTLCUpdateDecodeErrorZ_get_ok"))) TS_CResult_HTLCUpdateDecodeErrorZ_get_ok(uint64_t owner) {
6475         LDKCResult_HTLCUpdateDecodeErrorZ* owner_conv = (LDKCResult_HTLCUpdateDecodeErrorZ*)untag_ptr(owner);
6476         LDKHTLCUpdate ret_var = CResult_HTLCUpdateDecodeErrorZ_get_ok(owner_conv);
6477         uint64_t ret_ref = 0;
6478         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
6479         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
6480         return ret_ref;
6481 }
6482
6483 static inline struct LDKDecodeError CResult_HTLCUpdateDecodeErrorZ_get_err(LDKCResult_HTLCUpdateDecodeErrorZ *NONNULL_PTR owner){
6484 CHECK(!owner->result_ok);
6485         return DecodeError_clone(&*owner->contents.err);
6486 }
6487 uint64_t  __attribute__((export_name("TS_CResult_HTLCUpdateDecodeErrorZ_get_err"))) TS_CResult_HTLCUpdateDecodeErrorZ_get_err(uint64_t owner) {
6488         LDKCResult_HTLCUpdateDecodeErrorZ* owner_conv = (LDKCResult_HTLCUpdateDecodeErrorZ*)untag_ptr(owner);
6489         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
6490         *ret_copy = CResult_HTLCUpdateDecodeErrorZ_get_err(owner_conv);
6491         uint64_t ret_ref = tag_ptr(ret_copy, true);
6492         return ret_ref;
6493 }
6494
6495 static inline struct LDKOutPoint C2Tuple_OutPointCVec_u8ZZ_get_a(LDKC2Tuple_OutPointCVec_u8ZZ *NONNULL_PTR owner){
6496         LDKOutPoint ret = owner->a;
6497         ret.is_owned = false;
6498         return ret;
6499 }
6500 uint64_t  __attribute__((export_name("TS_C2Tuple_OutPointCVec_u8ZZ_get_a"))) TS_C2Tuple_OutPointCVec_u8ZZ_get_a(uint64_t owner) {
6501         LDKC2Tuple_OutPointCVec_u8ZZ* owner_conv = (LDKC2Tuple_OutPointCVec_u8ZZ*)untag_ptr(owner);
6502         LDKOutPoint ret_var = C2Tuple_OutPointCVec_u8ZZ_get_a(owner_conv);
6503         uint64_t ret_ref = 0;
6504         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
6505         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
6506         return ret_ref;
6507 }
6508
6509 static inline struct LDKCVec_u8Z C2Tuple_OutPointCVec_u8ZZ_get_b(LDKC2Tuple_OutPointCVec_u8ZZ *NONNULL_PTR owner){
6510         return CVec_u8Z_clone(&owner->b);
6511 }
6512 int8_tArray  __attribute__((export_name("TS_C2Tuple_OutPointCVec_u8ZZ_get_b"))) TS_C2Tuple_OutPointCVec_u8ZZ_get_b(uint64_t owner) {
6513         LDKC2Tuple_OutPointCVec_u8ZZ* owner_conv = (LDKC2Tuple_OutPointCVec_u8ZZ*)untag_ptr(owner);
6514         LDKCVec_u8Z ret_var = C2Tuple_OutPointCVec_u8ZZ_get_b(owner_conv);
6515         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
6516         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
6517         CVec_u8Z_free(ret_var);
6518         return ret_arr;
6519 }
6520
6521 static inline uint32_t C2Tuple_u32CVec_u8ZZ_get_a(LDKC2Tuple_u32CVec_u8ZZ *NONNULL_PTR owner){
6522         return owner->a;
6523 }
6524 int32_t  __attribute__((export_name("TS_C2Tuple_u32CVec_u8ZZ_get_a"))) TS_C2Tuple_u32CVec_u8ZZ_get_a(uint64_t owner) {
6525         LDKC2Tuple_u32CVec_u8ZZ* owner_conv = (LDKC2Tuple_u32CVec_u8ZZ*)untag_ptr(owner);
6526         int32_t ret_conv = C2Tuple_u32CVec_u8ZZ_get_a(owner_conv);
6527         return ret_conv;
6528 }
6529
6530 static inline struct LDKCVec_u8Z C2Tuple_u32CVec_u8ZZ_get_b(LDKC2Tuple_u32CVec_u8ZZ *NONNULL_PTR owner){
6531         return CVec_u8Z_clone(&owner->b);
6532 }
6533 int8_tArray  __attribute__((export_name("TS_C2Tuple_u32CVec_u8ZZ_get_b"))) TS_C2Tuple_u32CVec_u8ZZ_get_b(uint64_t owner) {
6534         LDKC2Tuple_u32CVec_u8ZZ* owner_conv = (LDKC2Tuple_u32CVec_u8ZZ*)untag_ptr(owner);
6535         LDKCVec_u8Z ret_var = C2Tuple_u32CVec_u8ZZ_get_b(owner_conv);
6536         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
6537         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
6538         CVec_u8Z_free(ret_var);
6539         return ret_arr;
6540 }
6541
6542 static inline LDKCVec_C2Tuple_u32CVec_u8ZZZ CVec_C2Tuple_u32CVec_u8ZZZ_clone(const LDKCVec_C2Tuple_u32CVec_u8ZZZ *orig) {
6543         LDKCVec_C2Tuple_u32CVec_u8ZZZ ret = { .data = MALLOC(sizeof(LDKC2Tuple_u32CVec_u8ZZ) * orig->datalen, "LDKCVec_C2Tuple_u32CVec_u8ZZZ clone bytes"), .datalen = orig->datalen };
6544         for (size_t i = 0; i < ret.datalen; i++) {
6545                 ret.data[i] = C2Tuple_u32CVec_u8ZZ_clone(&orig->data[i]);
6546         }
6547         return ret;
6548 }
6549 static inline struct LDKThirtyTwoBytes C2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32CVec_u8ZZZZ_get_a(LDKC2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32CVec_u8ZZZZ *NONNULL_PTR owner){
6550         return ThirtyTwoBytes_clone(&owner->a);
6551 }
6552 int8_tArray  __attribute__((export_name("TS_C2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32CVec_u8ZZZZ_get_a"))) TS_C2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32CVec_u8ZZZZ_get_a(uint64_t owner) {
6553         LDKC2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32CVec_u8ZZZZ* owner_conv = (LDKC2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32CVec_u8ZZZZ*)untag_ptr(owner);
6554         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
6555         memcpy(ret_arr->elems, C2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32CVec_u8ZZZZ_get_a(owner_conv).data, 32);
6556         return ret_arr;
6557 }
6558
6559 static inline struct LDKCVec_C2Tuple_u32CVec_u8ZZZ C2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32CVec_u8ZZZZ_get_b(LDKC2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32CVec_u8ZZZZ *NONNULL_PTR owner){
6560         return CVec_C2Tuple_u32CVec_u8ZZZ_clone(&owner->b);
6561 }
6562 uint64_tArray  __attribute__((export_name("TS_C2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32CVec_u8ZZZZ_get_b"))) TS_C2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32CVec_u8ZZZZ_get_b(uint64_t owner) {
6563         LDKC2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32CVec_u8ZZZZ* owner_conv = (LDKC2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32CVec_u8ZZZZ*)untag_ptr(owner);
6564         LDKCVec_C2Tuple_u32CVec_u8ZZZ ret_var = C2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32CVec_u8ZZZZ_get_b(owner_conv);
6565         uint64_tArray ret_arr = NULL;
6566         ret_arr = init_uint64_tArray(ret_var.datalen, __LINE__);
6567         uint64_t *ret_arr_ptr = (uint64_t*)(((uint8_t*)ret_arr) + 8);
6568         for (size_t x = 0; x < ret_var.datalen; x++) {
6569                 LDKC2Tuple_u32CVec_u8ZZ* ret_conv_23_conv = MALLOC(sizeof(LDKC2Tuple_u32CVec_u8ZZ), "LDKC2Tuple_u32CVec_u8ZZ");
6570                 *ret_conv_23_conv = ret_var.data[x];
6571                 ret_arr_ptr[x] = tag_ptr(ret_conv_23_conv, true);
6572         }
6573         
6574         FREE(ret_var.data);
6575         return ret_arr;
6576 }
6577
6578 static inline LDKCVec_C2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32CVec_u8ZZZZZ CVec_C2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32CVec_u8ZZZZZ_clone(const LDKCVec_C2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32CVec_u8ZZZZZ *orig) {
6579         LDKCVec_C2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32CVec_u8ZZZZZ ret = { .data = MALLOC(sizeof(LDKC2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32CVec_u8ZZZZ) * orig->datalen, "LDKCVec_C2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32CVec_u8ZZZZZ clone bytes"), .datalen = orig->datalen };
6580         for (size_t i = 0; i < ret.datalen; i++) {
6581                 ret.data[i] = C2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32CVec_u8ZZZZ_clone(&orig->data[i]);
6582         }
6583         return ret;
6584 }
6585 static inline LDKCVec_CommitmentTransactionZ CVec_CommitmentTransactionZ_clone(const LDKCVec_CommitmentTransactionZ *orig) {
6586         LDKCVec_CommitmentTransactionZ ret = { .data = MALLOC(sizeof(LDKCommitmentTransaction) * orig->datalen, "LDKCVec_CommitmentTransactionZ clone bytes"), .datalen = orig->datalen };
6587         for (size_t i = 0; i < ret.datalen; i++) {
6588                 ret.data[i] = CommitmentTransaction_clone(&orig->data[i]);
6589         }
6590         return ret;
6591 }
6592 static inline uint32_t C2Tuple_u32TxOutZ_get_a(LDKC2Tuple_u32TxOutZ *NONNULL_PTR owner){
6593         return owner->a;
6594 }
6595 int32_t  __attribute__((export_name("TS_C2Tuple_u32TxOutZ_get_a"))) TS_C2Tuple_u32TxOutZ_get_a(uint64_t owner) {
6596         LDKC2Tuple_u32TxOutZ* owner_conv = (LDKC2Tuple_u32TxOutZ*)untag_ptr(owner);
6597         int32_t ret_conv = C2Tuple_u32TxOutZ_get_a(owner_conv);
6598         return ret_conv;
6599 }
6600
6601 static inline struct LDKTxOut C2Tuple_u32TxOutZ_get_b(LDKC2Tuple_u32TxOutZ *NONNULL_PTR owner){
6602         return TxOut_clone(&owner->b);
6603 }
6604 uint64_t  __attribute__((export_name("TS_C2Tuple_u32TxOutZ_get_b"))) TS_C2Tuple_u32TxOutZ_get_b(uint64_t owner) {
6605         LDKC2Tuple_u32TxOutZ* owner_conv = (LDKC2Tuple_u32TxOutZ*)untag_ptr(owner);
6606         LDKTxOut* ret_ref = MALLOC(sizeof(LDKTxOut), "LDKTxOut");
6607         *ret_ref = C2Tuple_u32TxOutZ_get_b(owner_conv);
6608         return tag_ptr(ret_ref, true);
6609 }
6610
6611 static inline LDKCVec_C2Tuple_u32TxOutZZ CVec_C2Tuple_u32TxOutZZ_clone(const LDKCVec_C2Tuple_u32TxOutZZ *orig) {
6612         LDKCVec_C2Tuple_u32TxOutZZ ret = { .data = MALLOC(sizeof(LDKC2Tuple_u32TxOutZ) * orig->datalen, "LDKCVec_C2Tuple_u32TxOutZZ clone bytes"), .datalen = orig->datalen };
6613         for (size_t i = 0; i < ret.datalen; i++) {
6614                 ret.data[i] = C2Tuple_u32TxOutZ_clone(&orig->data[i]);
6615         }
6616         return ret;
6617 }
6618 static inline struct LDKThirtyTwoBytes C2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32TxOutZZZ_get_a(LDKC2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32TxOutZZZ *NONNULL_PTR owner){
6619         return ThirtyTwoBytes_clone(&owner->a);
6620 }
6621 int8_tArray  __attribute__((export_name("TS_C2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32TxOutZZZ_get_a"))) TS_C2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32TxOutZZZ_get_a(uint64_t owner) {
6622         LDKC2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32TxOutZZZ* owner_conv = (LDKC2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32TxOutZZZ*)untag_ptr(owner);
6623         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
6624         memcpy(ret_arr->elems, C2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32TxOutZZZ_get_a(owner_conv).data, 32);
6625         return ret_arr;
6626 }
6627
6628 static inline struct LDKCVec_C2Tuple_u32TxOutZZ C2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32TxOutZZZ_get_b(LDKC2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32TxOutZZZ *NONNULL_PTR owner){
6629         return CVec_C2Tuple_u32TxOutZZ_clone(&owner->b);
6630 }
6631 uint64_tArray  __attribute__((export_name("TS_C2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32TxOutZZZ_get_b"))) TS_C2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32TxOutZZZ_get_b(uint64_t owner) {
6632         LDKC2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32TxOutZZZ* owner_conv = (LDKC2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32TxOutZZZ*)untag_ptr(owner);
6633         LDKCVec_C2Tuple_u32TxOutZZ ret_var = C2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32TxOutZZZ_get_b(owner_conv);
6634         uint64_tArray ret_arr = NULL;
6635         ret_arr = init_uint64_tArray(ret_var.datalen, __LINE__);
6636         uint64_t *ret_arr_ptr = (uint64_t*)(((uint8_t*)ret_arr) + 8);
6637         for (size_t u = 0; u < ret_var.datalen; u++) {
6638                 LDKC2Tuple_u32TxOutZ* ret_conv_20_conv = MALLOC(sizeof(LDKC2Tuple_u32TxOutZ), "LDKC2Tuple_u32TxOutZ");
6639                 *ret_conv_20_conv = ret_var.data[u];
6640                 ret_arr_ptr[u] = tag_ptr(ret_conv_20_conv, true);
6641         }
6642         
6643         FREE(ret_var.data);
6644         return ret_arr;
6645 }
6646
6647 static inline LDKCVec_C2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32TxOutZZZZ CVec_C2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32TxOutZZZZ_clone(const LDKCVec_C2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32TxOutZZZZ *orig) {
6648         LDKCVec_C2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32TxOutZZZZ ret = { .data = MALLOC(sizeof(LDKC2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32TxOutZZZ) * orig->datalen, "LDKCVec_C2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32TxOutZZZZ clone bytes"), .datalen = orig->datalen };
6649         for (size_t i = 0; i < ret.datalen; i++) {
6650                 ret.data[i] = C2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32TxOutZZZ_clone(&orig->data[i]);
6651         }
6652         return ret;
6653 }
6654 uint32_t __attribute__((export_name("TS_LDKBalance_ty_from_ptr"))) TS_LDKBalance_ty_from_ptr(uint64_t ptr) {
6655         LDKBalance *obj = (LDKBalance*)untag_ptr(ptr);
6656         switch(obj->tag) {
6657                 case LDKBalance_ClaimableOnChannelClose: return 0;
6658                 case LDKBalance_ClaimableAwaitingConfirmations: return 1;
6659                 case LDKBalance_ContentiousClaimable: return 2;
6660                 case LDKBalance_MaybeTimeoutClaimableHTLC: return 3;
6661                 case LDKBalance_MaybePreimageClaimableHTLC: return 4;
6662                 case LDKBalance_CounterpartyRevokedOutputClaimable: return 5;
6663                 default: abort();
6664         }
6665 }
6666 int64_t __attribute__((export_name("TS_LDKBalance_ClaimableOnChannelClose_get_amount_satoshis"))) TS_LDKBalance_ClaimableOnChannelClose_get_amount_satoshis(uint64_t ptr) {
6667         LDKBalance *obj = (LDKBalance*)untag_ptr(ptr);
6668         assert(obj->tag == LDKBalance_ClaimableOnChannelClose);
6669         int64_t amount_satoshis_conv = obj->claimable_on_channel_close.amount_satoshis;
6670         return amount_satoshis_conv;
6671 }
6672 int64_t __attribute__((export_name("TS_LDKBalance_ClaimableAwaitingConfirmations_get_amount_satoshis"))) TS_LDKBalance_ClaimableAwaitingConfirmations_get_amount_satoshis(uint64_t ptr) {
6673         LDKBalance *obj = (LDKBalance*)untag_ptr(ptr);
6674         assert(obj->tag == LDKBalance_ClaimableAwaitingConfirmations);
6675         int64_t amount_satoshis_conv = obj->claimable_awaiting_confirmations.amount_satoshis;
6676         return amount_satoshis_conv;
6677 }
6678 int32_t __attribute__((export_name("TS_LDKBalance_ClaimableAwaitingConfirmations_get_confirmation_height"))) TS_LDKBalance_ClaimableAwaitingConfirmations_get_confirmation_height(uint64_t ptr) {
6679         LDKBalance *obj = (LDKBalance*)untag_ptr(ptr);
6680         assert(obj->tag == LDKBalance_ClaimableAwaitingConfirmations);
6681         int32_t confirmation_height_conv = obj->claimable_awaiting_confirmations.confirmation_height;
6682         return confirmation_height_conv;
6683 }
6684 int64_t __attribute__((export_name("TS_LDKBalance_ContentiousClaimable_get_amount_satoshis"))) TS_LDKBalance_ContentiousClaimable_get_amount_satoshis(uint64_t ptr) {
6685         LDKBalance *obj = (LDKBalance*)untag_ptr(ptr);
6686         assert(obj->tag == LDKBalance_ContentiousClaimable);
6687         int64_t amount_satoshis_conv = obj->contentious_claimable.amount_satoshis;
6688         return amount_satoshis_conv;
6689 }
6690 int32_t __attribute__((export_name("TS_LDKBalance_ContentiousClaimable_get_timeout_height"))) TS_LDKBalance_ContentiousClaimable_get_timeout_height(uint64_t ptr) {
6691         LDKBalance *obj = (LDKBalance*)untag_ptr(ptr);
6692         assert(obj->tag == LDKBalance_ContentiousClaimable);
6693         int32_t timeout_height_conv = obj->contentious_claimable.timeout_height;
6694         return timeout_height_conv;
6695 }
6696 int8_tArray __attribute__((export_name("TS_LDKBalance_ContentiousClaimable_get_payment_hash"))) TS_LDKBalance_ContentiousClaimable_get_payment_hash(uint64_t ptr) {
6697         LDKBalance *obj = (LDKBalance*)untag_ptr(ptr);
6698         assert(obj->tag == LDKBalance_ContentiousClaimable);
6699         int8_tArray payment_hash_arr = init_int8_tArray(32, __LINE__);
6700         memcpy(payment_hash_arr->elems, obj->contentious_claimable.payment_hash.data, 32);
6701         return payment_hash_arr;
6702 }
6703 int8_tArray __attribute__((export_name("TS_LDKBalance_ContentiousClaimable_get_payment_preimage"))) TS_LDKBalance_ContentiousClaimable_get_payment_preimage(uint64_t ptr) {
6704         LDKBalance *obj = (LDKBalance*)untag_ptr(ptr);
6705         assert(obj->tag == LDKBalance_ContentiousClaimable);
6706         int8_tArray payment_preimage_arr = init_int8_tArray(32, __LINE__);
6707         memcpy(payment_preimage_arr->elems, obj->contentious_claimable.payment_preimage.data, 32);
6708         return payment_preimage_arr;
6709 }
6710 int64_t __attribute__((export_name("TS_LDKBalance_MaybeTimeoutClaimableHTLC_get_amount_satoshis"))) TS_LDKBalance_MaybeTimeoutClaimableHTLC_get_amount_satoshis(uint64_t ptr) {
6711         LDKBalance *obj = (LDKBalance*)untag_ptr(ptr);
6712         assert(obj->tag == LDKBalance_MaybeTimeoutClaimableHTLC);
6713         int64_t amount_satoshis_conv = obj->maybe_timeout_claimable_htlc.amount_satoshis;
6714         return amount_satoshis_conv;
6715 }
6716 int32_t __attribute__((export_name("TS_LDKBalance_MaybeTimeoutClaimableHTLC_get_claimable_height"))) TS_LDKBalance_MaybeTimeoutClaimableHTLC_get_claimable_height(uint64_t ptr) {
6717         LDKBalance *obj = (LDKBalance*)untag_ptr(ptr);
6718         assert(obj->tag == LDKBalance_MaybeTimeoutClaimableHTLC);
6719         int32_t claimable_height_conv = obj->maybe_timeout_claimable_htlc.claimable_height;
6720         return claimable_height_conv;
6721 }
6722 int8_tArray __attribute__((export_name("TS_LDKBalance_MaybeTimeoutClaimableHTLC_get_payment_hash"))) TS_LDKBalance_MaybeTimeoutClaimableHTLC_get_payment_hash(uint64_t ptr) {
6723         LDKBalance *obj = (LDKBalance*)untag_ptr(ptr);
6724         assert(obj->tag == LDKBalance_MaybeTimeoutClaimableHTLC);
6725         int8_tArray payment_hash_arr = init_int8_tArray(32, __LINE__);
6726         memcpy(payment_hash_arr->elems, obj->maybe_timeout_claimable_htlc.payment_hash.data, 32);
6727         return payment_hash_arr;
6728 }
6729 int64_t __attribute__((export_name("TS_LDKBalance_MaybePreimageClaimableHTLC_get_amount_satoshis"))) TS_LDKBalance_MaybePreimageClaimableHTLC_get_amount_satoshis(uint64_t ptr) {
6730         LDKBalance *obj = (LDKBalance*)untag_ptr(ptr);
6731         assert(obj->tag == LDKBalance_MaybePreimageClaimableHTLC);
6732         int64_t amount_satoshis_conv = obj->maybe_preimage_claimable_htlc.amount_satoshis;
6733         return amount_satoshis_conv;
6734 }
6735 int32_t __attribute__((export_name("TS_LDKBalance_MaybePreimageClaimableHTLC_get_expiry_height"))) TS_LDKBalance_MaybePreimageClaimableHTLC_get_expiry_height(uint64_t ptr) {
6736         LDKBalance *obj = (LDKBalance*)untag_ptr(ptr);
6737         assert(obj->tag == LDKBalance_MaybePreimageClaimableHTLC);
6738         int32_t expiry_height_conv = obj->maybe_preimage_claimable_htlc.expiry_height;
6739         return expiry_height_conv;
6740 }
6741 int8_tArray __attribute__((export_name("TS_LDKBalance_MaybePreimageClaimableHTLC_get_payment_hash"))) TS_LDKBalance_MaybePreimageClaimableHTLC_get_payment_hash(uint64_t ptr) {
6742         LDKBalance *obj = (LDKBalance*)untag_ptr(ptr);
6743         assert(obj->tag == LDKBalance_MaybePreimageClaimableHTLC);
6744         int8_tArray payment_hash_arr = init_int8_tArray(32, __LINE__);
6745         memcpy(payment_hash_arr->elems, obj->maybe_preimage_claimable_htlc.payment_hash.data, 32);
6746         return payment_hash_arr;
6747 }
6748 int64_t __attribute__((export_name("TS_LDKBalance_CounterpartyRevokedOutputClaimable_get_amount_satoshis"))) TS_LDKBalance_CounterpartyRevokedOutputClaimable_get_amount_satoshis(uint64_t ptr) {
6749         LDKBalance *obj = (LDKBalance*)untag_ptr(ptr);
6750         assert(obj->tag == LDKBalance_CounterpartyRevokedOutputClaimable);
6751         int64_t amount_satoshis_conv = obj->counterparty_revoked_output_claimable.amount_satoshis;
6752         return amount_satoshis_conv;
6753 }
6754 static inline LDKCVec_BalanceZ CVec_BalanceZ_clone(const LDKCVec_BalanceZ *orig) {
6755         LDKCVec_BalanceZ ret = { .data = MALLOC(sizeof(LDKBalance) * orig->datalen, "LDKCVec_BalanceZ clone bytes"), .datalen = orig->datalen };
6756         for (size_t i = 0; i < ret.datalen; i++) {
6757                 ret.data[i] = Balance_clone(&orig->data[i]);
6758         }
6759         return ret;
6760 }
6761 static inline struct LDKThirtyTwoBytes C2Tuple_ThirtyTwoBytesChannelMonitorZ_get_a(LDKC2Tuple_ThirtyTwoBytesChannelMonitorZ *NONNULL_PTR owner){
6762         return ThirtyTwoBytes_clone(&owner->a);
6763 }
6764 int8_tArray  __attribute__((export_name("TS_C2Tuple_ThirtyTwoBytesChannelMonitorZ_get_a"))) TS_C2Tuple_ThirtyTwoBytesChannelMonitorZ_get_a(uint64_t owner) {
6765         LDKC2Tuple_ThirtyTwoBytesChannelMonitorZ* owner_conv = (LDKC2Tuple_ThirtyTwoBytesChannelMonitorZ*)untag_ptr(owner);
6766         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
6767         memcpy(ret_arr->elems, C2Tuple_ThirtyTwoBytesChannelMonitorZ_get_a(owner_conv).data, 32);
6768         return ret_arr;
6769 }
6770
6771 static inline struct LDKChannelMonitor C2Tuple_ThirtyTwoBytesChannelMonitorZ_get_b(LDKC2Tuple_ThirtyTwoBytesChannelMonitorZ *NONNULL_PTR owner){
6772         LDKChannelMonitor ret = owner->b;
6773         ret.is_owned = false;
6774         return ret;
6775 }
6776 uint64_t  __attribute__((export_name("TS_C2Tuple_ThirtyTwoBytesChannelMonitorZ_get_b"))) TS_C2Tuple_ThirtyTwoBytesChannelMonitorZ_get_b(uint64_t owner) {
6777         LDKC2Tuple_ThirtyTwoBytesChannelMonitorZ* owner_conv = (LDKC2Tuple_ThirtyTwoBytesChannelMonitorZ*)untag_ptr(owner);
6778         LDKChannelMonitor ret_var = C2Tuple_ThirtyTwoBytesChannelMonitorZ_get_b(owner_conv);
6779         uint64_t ret_ref = 0;
6780         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
6781         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
6782         return ret_ref;
6783 }
6784
6785 static inline struct LDKC2Tuple_ThirtyTwoBytesChannelMonitorZ CResult_C2Tuple_ThirtyTwoBytesChannelMonitorZDecodeErrorZ_get_ok(LDKCResult_C2Tuple_ThirtyTwoBytesChannelMonitorZDecodeErrorZ *NONNULL_PTR owner){
6786 CHECK(owner->result_ok);
6787         return C2Tuple_ThirtyTwoBytesChannelMonitorZ_clone(&*owner->contents.result);
6788 }
6789 uint64_t  __attribute__((export_name("TS_CResult_C2Tuple_ThirtyTwoBytesChannelMonitorZDecodeErrorZ_get_ok"))) TS_CResult_C2Tuple_ThirtyTwoBytesChannelMonitorZDecodeErrorZ_get_ok(uint64_t owner) {
6790         LDKCResult_C2Tuple_ThirtyTwoBytesChannelMonitorZDecodeErrorZ* owner_conv = (LDKCResult_C2Tuple_ThirtyTwoBytesChannelMonitorZDecodeErrorZ*)untag_ptr(owner);
6791         LDKC2Tuple_ThirtyTwoBytesChannelMonitorZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_ThirtyTwoBytesChannelMonitorZ), "LDKC2Tuple_ThirtyTwoBytesChannelMonitorZ");
6792         *ret_conv = CResult_C2Tuple_ThirtyTwoBytesChannelMonitorZDecodeErrorZ_get_ok(owner_conv);
6793         return tag_ptr(ret_conv, true);
6794 }
6795
6796 static inline struct LDKDecodeError CResult_C2Tuple_ThirtyTwoBytesChannelMonitorZDecodeErrorZ_get_err(LDKCResult_C2Tuple_ThirtyTwoBytesChannelMonitorZDecodeErrorZ *NONNULL_PTR owner){
6797 CHECK(!owner->result_ok);
6798         return DecodeError_clone(&*owner->contents.err);
6799 }
6800 uint64_t  __attribute__((export_name("TS_CResult_C2Tuple_ThirtyTwoBytesChannelMonitorZDecodeErrorZ_get_err"))) TS_CResult_C2Tuple_ThirtyTwoBytesChannelMonitorZDecodeErrorZ_get_err(uint64_t owner) {
6801         LDKCResult_C2Tuple_ThirtyTwoBytesChannelMonitorZDecodeErrorZ* owner_conv = (LDKCResult_C2Tuple_ThirtyTwoBytesChannelMonitorZDecodeErrorZ*)untag_ptr(owner);
6802         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
6803         *ret_copy = CResult_C2Tuple_ThirtyTwoBytesChannelMonitorZDecodeErrorZ_get_err(owner_conv);
6804         uint64_t ret_ref = tag_ptr(ret_copy, true);
6805         return ret_ref;
6806 }
6807
6808 typedef struct LDKType_JCalls {
6809         atomic_size_t refcnt;
6810         uint32_t instance_ptr;
6811 } LDKType_JCalls;
6812 static void LDKType_JCalls_free(void* this_arg) {
6813         LDKType_JCalls *j_calls = (LDKType_JCalls*) this_arg;
6814         if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
6815                 FREE(j_calls);
6816         }
6817 }
6818 uint16_t type_id_LDKType_jcall(const void* this_arg) {
6819         LDKType_JCalls *j_calls = (LDKType_JCalls*) this_arg;
6820         return js_invoke_function_uuuuuu(j_calls->instance_ptr, 38, 0, 0, 0, 0, 0, 0);
6821 }
6822 LDKStr debug_str_LDKType_jcall(const void* this_arg) {
6823         LDKType_JCalls *j_calls = (LDKType_JCalls*) this_arg;
6824         jstring ret = (jstring)js_invoke_function_uuuuuu(j_calls->instance_ptr, 39, 0, 0, 0, 0, 0, 0);
6825         LDKStr ret_conv = str_ref_to_owned_c(ret);
6826         return ret_conv;
6827 }
6828 LDKCVec_u8Z write_LDKType_jcall(const void* this_arg) {
6829         LDKType_JCalls *j_calls = (LDKType_JCalls*) this_arg;
6830         int8_tArray ret = (int8_tArray)js_invoke_function_uuuuuu(j_calls->instance_ptr, 40, 0, 0, 0, 0, 0, 0);
6831         LDKCVec_u8Z ret_ref;
6832         ret_ref.datalen = ret->arr_len;
6833         ret_ref.data = MALLOC(ret_ref.datalen, "LDKCVec_u8Z Bytes");
6834         memcpy(ret_ref.data, ret->elems, ret_ref.datalen); FREE(ret);
6835         return ret_ref;
6836 }
6837 static void LDKType_JCalls_cloned(LDKType* new_obj) {
6838         LDKType_JCalls *j_calls = (LDKType_JCalls*) new_obj->this_arg;
6839         atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
6840 }
6841 static inline LDKType LDKType_init (JSValue o) {
6842         LDKType_JCalls *calls = MALLOC(sizeof(LDKType_JCalls), "LDKType_JCalls");
6843         atomic_init(&calls->refcnt, 1);
6844         calls->instance_ptr = o;
6845
6846         LDKType ret = {
6847                 .this_arg = (void*) calls,
6848                 .type_id = type_id_LDKType_jcall,
6849                 .debug_str = debug_str_LDKType_jcall,
6850                 .write = write_LDKType_jcall,
6851                 .cloned = LDKType_JCalls_cloned,
6852                 .free = LDKType_JCalls_free,
6853         };
6854         return ret;
6855 }
6856 uint64_t  __attribute__((export_name("TS_LDKType_new"))) TS_LDKType_new(JSValue o) {
6857         LDKType *res_ptr = MALLOC(sizeof(LDKType), "LDKType");
6858         *res_ptr = LDKType_init(o);
6859         return tag_ptr(res_ptr, true);
6860 }
6861 int16_t  __attribute__((export_name("TS_Type_type_id"))) TS_Type_type_id(uint64_t this_arg) {
6862         void* this_arg_ptr = untag_ptr(this_arg);
6863         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
6864         LDKType* this_arg_conv = (LDKType*)this_arg_ptr;
6865         int16_t ret_conv = (this_arg_conv->type_id)(this_arg_conv->this_arg);
6866         return ret_conv;
6867 }
6868
6869 jstring  __attribute__((export_name("TS_Type_debug_str"))) TS_Type_debug_str(uint64_t this_arg) {
6870         void* this_arg_ptr = untag_ptr(this_arg);
6871         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
6872         LDKType* this_arg_conv = (LDKType*)this_arg_ptr;
6873         LDKStr ret_str = (this_arg_conv->debug_str)(this_arg_conv->this_arg);
6874         jstring ret_conv = str_ref_to_ts(ret_str.chars, ret_str.len);
6875         Str_free(ret_str);
6876         return ret_conv;
6877 }
6878
6879 int8_tArray  __attribute__((export_name("TS_Type_write"))) TS_Type_write(uint64_t this_arg) {
6880         void* this_arg_ptr = untag_ptr(this_arg);
6881         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
6882         LDKType* this_arg_conv = (LDKType*)this_arg_ptr;
6883         LDKCVec_u8Z ret_var = (this_arg_conv->write)(this_arg_conv->this_arg);
6884         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
6885         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
6886         CVec_u8Z_free(ret_var);
6887         return ret_arr;
6888 }
6889
6890 static inline struct LDKPublicKey C2Tuple_PublicKeyTypeZ_get_a(LDKC2Tuple_PublicKeyTypeZ *NONNULL_PTR owner){
6891         return owner->a;
6892 }
6893 int8_tArray  __attribute__((export_name("TS_C2Tuple_PublicKeyTypeZ_get_a"))) TS_C2Tuple_PublicKeyTypeZ_get_a(uint64_t owner) {
6894         LDKC2Tuple_PublicKeyTypeZ* owner_conv = (LDKC2Tuple_PublicKeyTypeZ*)untag_ptr(owner);
6895         int8_tArray ret_arr = init_int8_tArray(33, __LINE__);
6896         memcpy(ret_arr->elems, C2Tuple_PublicKeyTypeZ_get_a(owner_conv).compressed_form, 33);
6897         return ret_arr;
6898 }
6899
6900 static inline struct LDKType C2Tuple_PublicKeyTypeZ_get_b(LDKC2Tuple_PublicKeyTypeZ *NONNULL_PTR owner){
6901         return Type_clone(&owner->b);
6902 }
6903 uint64_t  __attribute__((export_name("TS_C2Tuple_PublicKeyTypeZ_get_b"))) TS_C2Tuple_PublicKeyTypeZ_get_b(uint64_t owner) {
6904         LDKC2Tuple_PublicKeyTypeZ* owner_conv = (LDKC2Tuple_PublicKeyTypeZ*)untag_ptr(owner);
6905         LDKType* ret_ret = MALLOC(sizeof(LDKType), "LDKType");
6906         *ret_ret = C2Tuple_PublicKeyTypeZ_get_b(owner_conv);
6907         return tag_ptr(ret_ret, true);
6908 }
6909
6910 static inline LDKCVec_C2Tuple_PublicKeyTypeZZ CVec_C2Tuple_PublicKeyTypeZZ_clone(const LDKCVec_C2Tuple_PublicKeyTypeZZ *orig) {
6911         LDKCVec_C2Tuple_PublicKeyTypeZZ ret = { .data = MALLOC(sizeof(LDKC2Tuple_PublicKeyTypeZ) * orig->datalen, "LDKCVec_C2Tuple_PublicKeyTypeZZ clone bytes"), .datalen = orig->datalen };
6912         for (size_t i = 0; i < ret.datalen; i++) {
6913                 ret.data[i] = C2Tuple_PublicKeyTypeZ_clone(&orig->data[i]);
6914         }
6915         return ret;
6916 }
6917 typedef struct LDKOnionMessageContents_JCalls {
6918         atomic_size_t refcnt;
6919         uint32_t instance_ptr;
6920 } LDKOnionMessageContents_JCalls;
6921 static void LDKOnionMessageContents_JCalls_free(void* this_arg) {
6922         LDKOnionMessageContents_JCalls *j_calls = (LDKOnionMessageContents_JCalls*) this_arg;
6923         if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
6924                 FREE(j_calls);
6925         }
6926 }
6927 uint64_t tlv_type_LDKOnionMessageContents_jcall(const void* this_arg) {
6928         LDKOnionMessageContents_JCalls *j_calls = (LDKOnionMessageContents_JCalls*) this_arg;
6929         return js_invoke_function_uuuuuu(j_calls->instance_ptr, 41, 0, 0, 0, 0, 0, 0);
6930 }
6931 LDKCVec_u8Z write_LDKOnionMessageContents_jcall(const void* this_arg) {
6932         LDKOnionMessageContents_JCalls *j_calls = (LDKOnionMessageContents_JCalls*) this_arg;
6933         int8_tArray ret = (int8_tArray)js_invoke_function_uuuuuu(j_calls->instance_ptr, 42, 0, 0, 0, 0, 0, 0);
6934         LDKCVec_u8Z ret_ref;
6935         ret_ref.datalen = ret->arr_len;
6936         ret_ref.data = MALLOC(ret_ref.datalen, "LDKCVec_u8Z Bytes");
6937         memcpy(ret_ref.data, ret->elems, ret_ref.datalen); FREE(ret);
6938         return ret_ref;
6939 }
6940 static void LDKOnionMessageContents_JCalls_cloned(LDKOnionMessageContents* new_obj) {
6941         LDKOnionMessageContents_JCalls *j_calls = (LDKOnionMessageContents_JCalls*) new_obj->this_arg;
6942         atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
6943 }
6944 static inline LDKOnionMessageContents LDKOnionMessageContents_init (JSValue o) {
6945         LDKOnionMessageContents_JCalls *calls = MALLOC(sizeof(LDKOnionMessageContents_JCalls), "LDKOnionMessageContents_JCalls");
6946         atomic_init(&calls->refcnt, 1);
6947         calls->instance_ptr = o;
6948
6949         LDKOnionMessageContents ret = {
6950                 .this_arg = (void*) calls,
6951                 .tlv_type = tlv_type_LDKOnionMessageContents_jcall,
6952                 .write = write_LDKOnionMessageContents_jcall,
6953                 .cloned = LDKOnionMessageContents_JCalls_cloned,
6954                 .free = LDKOnionMessageContents_JCalls_free,
6955         };
6956         return ret;
6957 }
6958 uint64_t  __attribute__((export_name("TS_LDKOnionMessageContents_new"))) TS_LDKOnionMessageContents_new(JSValue o) {
6959         LDKOnionMessageContents *res_ptr = MALLOC(sizeof(LDKOnionMessageContents), "LDKOnionMessageContents");
6960         *res_ptr = LDKOnionMessageContents_init(o);
6961         return tag_ptr(res_ptr, true);
6962 }
6963 int64_t  __attribute__((export_name("TS_OnionMessageContents_tlv_type"))) TS_OnionMessageContents_tlv_type(uint64_t this_arg) {
6964         void* this_arg_ptr = untag_ptr(this_arg);
6965         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
6966         LDKOnionMessageContents* this_arg_conv = (LDKOnionMessageContents*)this_arg_ptr;
6967         int64_t ret_conv = (this_arg_conv->tlv_type)(this_arg_conv->this_arg);
6968         return ret_conv;
6969 }
6970
6971 int8_tArray  __attribute__((export_name("TS_OnionMessageContents_write"))) TS_OnionMessageContents_write(uint64_t this_arg) {
6972         void* this_arg_ptr = untag_ptr(this_arg);
6973         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
6974         LDKOnionMessageContents* this_arg_conv = (LDKOnionMessageContents*)this_arg_ptr;
6975         LDKCVec_u8Z ret_var = (this_arg_conv->write)(this_arg_conv->this_arg);
6976         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
6977         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
6978         CVec_u8Z_free(ret_var);
6979         return ret_arr;
6980 }
6981
6982 uint32_t __attribute__((export_name("TS_LDKCOption_OnionMessageContentsZ_ty_from_ptr"))) TS_LDKCOption_OnionMessageContentsZ_ty_from_ptr(uint64_t ptr) {
6983         LDKCOption_OnionMessageContentsZ *obj = (LDKCOption_OnionMessageContentsZ*)untag_ptr(ptr);
6984         switch(obj->tag) {
6985                 case LDKCOption_OnionMessageContentsZ_Some: return 0;
6986                 case LDKCOption_OnionMessageContentsZ_None: return 1;
6987                 default: abort();
6988         }
6989 }
6990 uint64_t __attribute__((export_name("TS_LDKCOption_OnionMessageContentsZ_Some_get_some"))) TS_LDKCOption_OnionMessageContentsZ_Some_get_some(uint64_t ptr) {
6991         LDKCOption_OnionMessageContentsZ *obj = (LDKCOption_OnionMessageContentsZ*)untag_ptr(ptr);
6992         assert(obj->tag == LDKCOption_OnionMessageContentsZ_Some);
6993         LDKOnionMessageContents* some_ret = MALLOC(sizeof(LDKOnionMessageContents), "LDKOnionMessageContents");
6994         *some_ret = OnionMessageContents_clone(&obj->some);
6995         return tag_ptr(some_ret, true);
6996 }
6997 static inline struct LDKCOption_OnionMessageContentsZ CResult_COption_OnionMessageContentsZDecodeErrorZ_get_ok(LDKCResult_COption_OnionMessageContentsZDecodeErrorZ *NONNULL_PTR owner){
6998 CHECK(owner->result_ok);
6999         return COption_OnionMessageContentsZ_clone(&*owner->contents.result);
7000 }
7001 uint64_t  __attribute__((export_name("TS_CResult_COption_OnionMessageContentsZDecodeErrorZ_get_ok"))) TS_CResult_COption_OnionMessageContentsZDecodeErrorZ_get_ok(uint64_t owner) {
7002         LDKCResult_COption_OnionMessageContentsZDecodeErrorZ* owner_conv = (LDKCResult_COption_OnionMessageContentsZDecodeErrorZ*)untag_ptr(owner);
7003         LDKCOption_OnionMessageContentsZ *ret_copy = MALLOC(sizeof(LDKCOption_OnionMessageContentsZ), "LDKCOption_OnionMessageContentsZ");
7004         *ret_copy = CResult_COption_OnionMessageContentsZDecodeErrorZ_get_ok(owner_conv);
7005         uint64_t ret_ref = tag_ptr(ret_copy, true);
7006         return ret_ref;
7007 }
7008
7009 static inline struct LDKDecodeError CResult_COption_OnionMessageContentsZDecodeErrorZ_get_err(LDKCResult_COption_OnionMessageContentsZDecodeErrorZ *NONNULL_PTR owner){
7010 CHECK(!owner->result_ok);
7011         return DecodeError_clone(&*owner->contents.err);
7012 }
7013 uint64_t  __attribute__((export_name("TS_CResult_COption_OnionMessageContentsZDecodeErrorZ_get_err"))) TS_CResult_COption_OnionMessageContentsZDecodeErrorZ_get_err(uint64_t owner) {
7014         LDKCResult_COption_OnionMessageContentsZDecodeErrorZ* owner_conv = (LDKCResult_COption_OnionMessageContentsZDecodeErrorZ*)untag_ptr(owner);
7015         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
7016         *ret_copy = CResult_COption_OnionMessageContentsZDecodeErrorZ_get_err(owner_conv);
7017         uint64_t ret_ref = tag_ptr(ret_copy, true);
7018         return ret_ref;
7019 }
7020
7021 static inline struct LDKOnionMessageContents C3Tuple_OnionMessageContentsDestinationBlindedPathZ_get_a(LDKC3Tuple_OnionMessageContentsDestinationBlindedPathZ *NONNULL_PTR owner){
7022         return OnionMessageContents_clone(&owner->a);
7023 }
7024 uint64_t  __attribute__((export_name("TS_C3Tuple_OnionMessageContentsDestinationBlindedPathZ_get_a"))) TS_C3Tuple_OnionMessageContentsDestinationBlindedPathZ_get_a(uint64_t owner) {
7025         LDKC3Tuple_OnionMessageContentsDestinationBlindedPathZ* owner_conv = (LDKC3Tuple_OnionMessageContentsDestinationBlindedPathZ*)untag_ptr(owner);
7026         LDKOnionMessageContents* ret_ret = MALLOC(sizeof(LDKOnionMessageContents), "LDKOnionMessageContents");
7027         *ret_ret = C3Tuple_OnionMessageContentsDestinationBlindedPathZ_get_a(owner_conv);
7028         return tag_ptr(ret_ret, true);
7029 }
7030
7031 static inline struct LDKDestination C3Tuple_OnionMessageContentsDestinationBlindedPathZ_get_b(LDKC3Tuple_OnionMessageContentsDestinationBlindedPathZ *NONNULL_PTR owner){
7032         return Destination_clone(&owner->b);
7033 }
7034 uint64_t  __attribute__((export_name("TS_C3Tuple_OnionMessageContentsDestinationBlindedPathZ_get_b"))) TS_C3Tuple_OnionMessageContentsDestinationBlindedPathZ_get_b(uint64_t owner) {
7035         LDKC3Tuple_OnionMessageContentsDestinationBlindedPathZ* owner_conv = (LDKC3Tuple_OnionMessageContentsDestinationBlindedPathZ*)untag_ptr(owner);
7036         LDKDestination *ret_copy = MALLOC(sizeof(LDKDestination), "LDKDestination");
7037         *ret_copy = C3Tuple_OnionMessageContentsDestinationBlindedPathZ_get_b(owner_conv);
7038         uint64_t ret_ref = tag_ptr(ret_copy, true);
7039         return ret_ref;
7040 }
7041
7042 static inline struct LDKBlindedPath C3Tuple_OnionMessageContentsDestinationBlindedPathZ_get_c(LDKC3Tuple_OnionMessageContentsDestinationBlindedPathZ *NONNULL_PTR owner){
7043         LDKBlindedPath ret = owner->c;
7044         ret.is_owned = false;
7045         return ret;
7046 }
7047 uint64_t  __attribute__((export_name("TS_C3Tuple_OnionMessageContentsDestinationBlindedPathZ_get_c"))) TS_C3Tuple_OnionMessageContentsDestinationBlindedPathZ_get_c(uint64_t owner) {
7048         LDKC3Tuple_OnionMessageContentsDestinationBlindedPathZ* owner_conv = (LDKC3Tuple_OnionMessageContentsDestinationBlindedPathZ*)untag_ptr(owner);
7049         LDKBlindedPath ret_var = C3Tuple_OnionMessageContentsDestinationBlindedPathZ_get_c(owner_conv);
7050         uint64_t ret_ref = 0;
7051         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
7052         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
7053         return ret_ref;
7054 }
7055
7056 static inline LDKCVec_C3Tuple_OnionMessageContentsDestinationBlindedPathZZ CVec_C3Tuple_OnionMessageContentsDestinationBlindedPathZZ_clone(const LDKCVec_C3Tuple_OnionMessageContentsDestinationBlindedPathZZ *orig) {
7057         LDKCVec_C3Tuple_OnionMessageContentsDestinationBlindedPathZZ ret = { .data = MALLOC(sizeof(LDKC3Tuple_OnionMessageContentsDestinationBlindedPathZ) * orig->datalen, "LDKCVec_C3Tuple_OnionMessageContentsDestinationBlindedPathZZ clone bytes"), .datalen = orig->datalen };
7058         for (size_t i = 0; i < ret.datalen; i++) {
7059                 ret.data[i] = C3Tuple_OnionMessageContentsDestinationBlindedPathZ_clone(&orig->data[i]);
7060         }
7061         return ret;
7062 }
7063 uint32_t __attribute__((export_name("TS_LDKCOption_TypeZ_ty_from_ptr"))) TS_LDKCOption_TypeZ_ty_from_ptr(uint64_t ptr) {
7064         LDKCOption_TypeZ *obj = (LDKCOption_TypeZ*)untag_ptr(ptr);
7065         switch(obj->tag) {
7066                 case LDKCOption_TypeZ_Some: return 0;
7067                 case LDKCOption_TypeZ_None: return 1;
7068                 default: abort();
7069         }
7070 }
7071 uint64_t __attribute__((export_name("TS_LDKCOption_TypeZ_Some_get_some"))) TS_LDKCOption_TypeZ_Some_get_some(uint64_t ptr) {
7072         LDKCOption_TypeZ *obj = (LDKCOption_TypeZ*)untag_ptr(ptr);
7073         assert(obj->tag == LDKCOption_TypeZ_Some);
7074         LDKType* some_ret = MALLOC(sizeof(LDKType), "LDKType");
7075         *some_ret = Type_clone(&obj->some);
7076         return tag_ptr(some_ret, true);
7077 }
7078 static inline struct LDKCOption_TypeZ CResult_COption_TypeZDecodeErrorZ_get_ok(LDKCResult_COption_TypeZDecodeErrorZ *NONNULL_PTR owner){
7079 CHECK(owner->result_ok);
7080         return COption_TypeZ_clone(&*owner->contents.result);
7081 }
7082 uint64_t  __attribute__((export_name("TS_CResult_COption_TypeZDecodeErrorZ_get_ok"))) TS_CResult_COption_TypeZDecodeErrorZ_get_ok(uint64_t owner) {
7083         LDKCResult_COption_TypeZDecodeErrorZ* owner_conv = (LDKCResult_COption_TypeZDecodeErrorZ*)untag_ptr(owner);
7084         LDKCOption_TypeZ *ret_copy = MALLOC(sizeof(LDKCOption_TypeZ), "LDKCOption_TypeZ");
7085         *ret_copy = CResult_COption_TypeZDecodeErrorZ_get_ok(owner_conv);
7086         uint64_t ret_ref = tag_ptr(ret_copy, true);
7087         return ret_ref;
7088 }
7089
7090 static inline struct LDKDecodeError CResult_COption_TypeZDecodeErrorZ_get_err(LDKCResult_COption_TypeZDecodeErrorZ *NONNULL_PTR owner){
7091 CHECK(!owner->result_ok);
7092         return DecodeError_clone(&*owner->contents.err);
7093 }
7094 uint64_t  __attribute__((export_name("TS_CResult_COption_TypeZDecodeErrorZ_get_err"))) TS_CResult_COption_TypeZDecodeErrorZ_get_err(uint64_t owner) {
7095         LDKCResult_COption_TypeZDecodeErrorZ* owner_conv = (LDKCResult_COption_TypeZDecodeErrorZ*)untag_ptr(owner);
7096         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
7097         *ret_copy = CResult_COption_TypeZDecodeErrorZ_get_err(owner_conv);
7098         uint64_t ret_ref = tag_ptr(ret_copy, true);
7099         return ret_ref;
7100 }
7101
7102 uint32_t __attribute__((export_name("TS_LDKCOption_SocketAddressZ_ty_from_ptr"))) TS_LDKCOption_SocketAddressZ_ty_from_ptr(uint64_t ptr) {
7103         LDKCOption_SocketAddressZ *obj = (LDKCOption_SocketAddressZ*)untag_ptr(ptr);
7104         switch(obj->tag) {
7105                 case LDKCOption_SocketAddressZ_Some: return 0;
7106                 case LDKCOption_SocketAddressZ_None: return 1;
7107                 default: abort();
7108         }
7109 }
7110 uint64_t __attribute__((export_name("TS_LDKCOption_SocketAddressZ_Some_get_some"))) TS_LDKCOption_SocketAddressZ_Some_get_some(uint64_t ptr) {
7111         LDKCOption_SocketAddressZ *obj = (LDKCOption_SocketAddressZ*)untag_ptr(ptr);
7112         assert(obj->tag == LDKCOption_SocketAddressZ_Some);
7113         uint64_t some_ref = tag_ptr(&obj->some, false);
7114         return some_ref;
7115 }
7116 static inline struct LDKPublicKey C2Tuple_PublicKeyCOption_SocketAddressZZ_get_a(LDKC2Tuple_PublicKeyCOption_SocketAddressZZ *NONNULL_PTR owner){
7117         return owner->a;
7118 }
7119 int8_tArray  __attribute__((export_name("TS_C2Tuple_PublicKeyCOption_SocketAddressZZ_get_a"))) TS_C2Tuple_PublicKeyCOption_SocketAddressZZ_get_a(uint64_t owner) {
7120         LDKC2Tuple_PublicKeyCOption_SocketAddressZZ* owner_conv = (LDKC2Tuple_PublicKeyCOption_SocketAddressZZ*)untag_ptr(owner);
7121         int8_tArray ret_arr = init_int8_tArray(33, __LINE__);
7122         memcpy(ret_arr->elems, C2Tuple_PublicKeyCOption_SocketAddressZZ_get_a(owner_conv).compressed_form, 33);
7123         return ret_arr;
7124 }
7125
7126 static inline struct LDKCOption_SocketAddressZ C2Tuple_PublicKeyCOption_SocketAddressZZ_get_b(LDKC2Tuple_PublicKeyCOption_SocketAddressZZ *NONNULL_PTR owner){
7127         return COption_SocketAddressZ_clone(&owner->b);
7128 }
7129 uint64_t  __attribute__((export_name("TS_C2Tuple_PublicKeyCOption_SocketAddressZZ_get_b"))) TS_C2Tuple_PublicKeyCOption_SocketAddressZZ_get_b(uint64_t owner) {
7130         LDKC2Tuple_PublicKeyCOption_SocketAddressZZ* owner_conv = (LDKC2Tuple_PublicKeyCOption_SocketAddressZZ*)untag_ptr(owner);
7131         LDKCOption_SocketAddressZ *ret_copy = MALLOC(sizeof(LDKCOption_SocketAddressZ), "LDKCOption_SocketAddressZ");
7132         *ret_copy = C2Tuple_PublicKeyCOption_SocketAddressZZ_get_b(owner_conv);
7133         uint64_t ret_ref = tag_ptr(ret_copy, true);
7134         return ret_ref;
7135 }
7136
7137 static inline LDKCVec_C2Tuple_PublicKeyCOption_SocketAddressZZZ CVec_C2Tuple_PublicKeyCOption_SocketAddressZZZ_clone(const LDKCVec_C2Tuple_PublicKeyCOption_SocketAddressZZZ *orig) {
7138         LDKCVec_C2Tuple_PublicKeyCOption_SocketAddressZZZ ret = { .data = MALLOC(sizeof(LDKC2Tuple_PublicKeyCOption_SocketAddressZZ) * orig->datalen, "LDKCVec_C2Tuple_PublicKeyCOption_SocketAddressZZZ clone bytes"), .datalen = orig->datalen };
7139         for (size_t i = 0; i < ret.datalen; i++) {
7140                 ret.data[i] = C2Tuple_PublicKeyCOption_SocketAddressZZ_clone(&orig->data[i]);
7141         }
7142         return ret;
7143 }
7144 static inline struct LDKCVec_u8Z CResult_CVec_u8ZPeerHandleErrorZ_get_ok(LDKCResult_CVec_u8ZPeerHandleErrorZ *NONNULL_PTR owner){
7145 CHECK(owner->result_ok);
7146         return CVec_u8Z_clone(&*owner->contents.result);
7147 }
7148 int8_tArray  __attribute__((export_name("TS_CResult_CVec_u8ZPeerHandleErrorZ_get_ok"))) TS_CResult_CVec_u8ZPeerHandleErrorZ_get_ok(uint64_t owner) {
7149         LDKCResult_CVec_u8ZPeerHandleErrorZ* owner_conv = (LDKCResult_CVec_u8ZPeerHandleErrorZ*)untag_ptr(owner);
7150         LDKCVec_u8Z ret_var = CResult_CVec_u8ZPeerHandleErrorZ_get_ok(owner_conv);
7151         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
7152         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
7153         CVec_u8Z_free(ret_var);
7154         return ret_arr;
7155 }
7156
7157 static inline struct LDKPeerHandleError CResult_CVec_u8ZPeerHandleErrorZ_get_err(LDKCResult_CVec_u8ZPeerHandleErrorZ *NONNULL_PTR owner){
7158         LDKPeerHandleError ret = *owner->contents.err;
7159         ret.is_owned = false;
7160         return ret;
7161 }
7162 uint64_t  __attribute__((export_name("TS_CResult_CVec_u8ZPeerHandleErrorZ_get_err"))) TS_CResult_CVec_u8ZPeerHandleErrorZ_get_err(uint64_t owner) {
7163         LDKCResult_CVec_u8ZPeerHandleErrorZ* owner_conv = (LDKCResult_CVec_u8ZPeerHandleErrorZ*)untag_ptr(owner);
7164         LDKPeerHandleError ret_var = CResult_CVec_u8ZPeerHandleErrorZ_get_err(owner_conv);
7165         uint64_t ret_ref = 0;
7166         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
7167         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
7168         return ret_ref;
7169 }
7170
7171 static inline void CResult_NonePeerHandleErrorZ_get_ok(LDKCResult_NonePeerHandleErrorZ *NONNULL_PTR owner){
7172 CHECK(owner->result_ok);
7173         return *owner->contents.result;
7174 }
7175 void  __attribute__((export_name("TS_CResult_NonePeerHandleErrorZ_get_ok"))) TS_CResult_NonePeerHandleErrorZ_get_ok(uint64_t owner) {
7176         LDKCResult_NonePeerHandleErrorZ* owner_conv = (LDKCResult_NonePeerHandleErrorZ*)untag_ptr(owner);
7177         CResult_NonePeerHandleErrorZ_get_ok(owner_conv);
7178 }
7179
7180 static inline struct LDKPeerHandleError CResult_NonePeerHandleErrorZ_get_err(LDKCResult_NonePeerHandleErrorZ *NONNULL_PTR owner){
7181         LDKPeerHandleError ret = *owner->contents.err;
7182         ret.is_owned = false;
7183         return ret;
7184 }
7185 uint64_t  __attribute__((export_name("TS_CResult_NonePeerHandleErrorZ_get_err"))) TS_CResult_NonePeerHandleErrorZ_get_err(uint64_t owner) {
7186         LDKCResult_NonePeerHandleErrorZ* owner_conv = (LDKCResult_NonePeerHandleErrorZ*)untag_ptr(owner);
7187         LDKPeerHandleError ret_var = CResult_NonePeerHandleErrorZ_get_err(owner_conv);
7188         uint64_t ret_ref = 0;
7189         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
7190         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
7191         return ret_ref;
7192 }
7193
7194 static inline bool CResult_boolPeerHandleErrorZ_get_ok(LDKCResult_boolPeerHandleErrorZ *NONNULL_PTR owner){
7195 CHECK(owner->result_ok);
7196         return *owner->contents.result;
7197 }
7198 jboolean  __attribute__((export_name("TS_CResult_boolPeerHandleErrorZ_get_ok"))) TS_CResult_boolPeerHandleErrorZ_get_ok(uint64_t owner) {
7199         LDKCResult_boolPeerHandleErrorZ* owner_conv = (LDKCResult_boolPeerHandleErrorZ*)untag_ptr(owner);
7200         jboolean ret_conv = CResult_boolPeerHandleErrorZ_get_ok(owner_conv);
7201         return ret_conv;
7202 }
7203
7204 static inline struct LDKPeerHandleError CResult_boolPeerHandleErrorZ_get_err(LDKCResult_boolPeerHandleErrorZ *NONNULL_PTR owner){
7205         LDKPeerHandleError ret = *owner->contents.err;
7206         ret.is_owned = false;
7207         return ret;
7208 }
7209 uint64_t  __attribute__((export_name("TS_CResult_boolPeerHandleErrorZ_get_err"))) TS_CResult_boolPeerHandleErrorZ_get_err(uint64_t owner) {
7210         LDKCResult_boolPeerHandleErrorZ* owner_conv = (LDKCResult_boolPeerHandleErrorZ*)untag_ptr(owner);
7211         LDKPeerHandleError ret_var = CResult_boolPeerHandleErrorZ_get_err(owner_conv);
7212         uint64_t ret_ref = 0;
7213         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
7214         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
7215         return ret_ref;
7216 }
7217
7218 uint32_t __attribute__((export_name("TS_LDKGraphSyncError_ty_from_ptr"))) TS_LDKGraphSyncError_ty_from_ptr(uint64_t ptr) {
7219         LDKGraphSyncError *obj = (LDKGraphSyncError*)untag_ptr(ptr);
7220         switch(obj->tag) {
7221                 case LDKGraphSyncError_DecodeError: return 0;
7222                 case LDKGraphSyncError_LightningError: return 1;
7223                 default: abort();
7224         }
7225 }
7226 uint64_t __attribute__((export_name("TS_LDKGraphSyncError_DecodeError_get_decode_error"))) TS_LDKGraphSyncError_DecodeError_get_decode_error(uint64_t ptr) {
7227         LDKGraphSyncError *obj = (LDKGraphSyncError*)untag_ptr(ptr);
7228         assert(obj->tag == LDKGraphSyncError_DecodeError);
7229         uint64_t decode_error_ref = tag_ptr(&obj->decode_error, false);
7230         return decode_error_ref;
7231 }
7232 uint64_t __attribute__((export_name("TS_LDKGraphSyncError_LightningError_get_lightning_error"))) TS_LDKGraphSyncError_LightningError_get_lightning_error(uint64_t ptr) {
7233         LDKGraphSyncError *obj = (LDKGraphSyncError*)untag_ptr(ptr);
7234         assert(obj->tag == LDKGraphSyncError_LightningError);
7235         LDKLightningError lightning_error_var = obj->lightning_error;
7236                         uint64_t lightning_error_ref = 0;
7237                         CHECK_INNER_FIELD_ACCESS_OR_NULL(lightning_error_var);
7238                         lightning_error_ref = tag_ptr(lightning_error_var.inner, false);
7239         return lightning_error_ref;
7240 }
7241 static inline uint32_t CResult_u32GraphSyncErrorZ_get_ok(LDKCResult_u32GraphSyncErrorZ *NONNULL_PTR owner){
7242 CHECK(owner->result_ok);
7243         return *owner->contents.result;
7244 }
7245 int32_t  __attribute__((export_name("TS_CResult_u32GraphSyncErrorZ_get_ok"))) TS_CResult_u32GraphSyncErrorZ_get_ok(uint64_t owner) {
7246         LDKCResult_u32GraphSyncErrorZ* owner_conv = (LDKCResult_u32GraphSyncErrorZ*)untag_ptr(owner);
7247         int32_t ret_conv = CResult_u32GraphSyncErrorZ_get_ok(owner_conv);
7248         return ret_conv;
7249 }
7250
7251 static inline struct LDKGraphSyncError CResult_u32GraphSyncErrorZ_get_err(LDKCResult_u32GraphSyncErrorZ *NONNULL_PTR owner){
7252 CHECK(!owner->result_ok);
7253         return GraphSyncError_clone(&*owner->contents.err);
7254 }
7255 uint64_t  __attribute__((export_name("TS_CResult_u32GraphSyncErrorZ_get_err"))) TS_CResult_u32GraphSyncErrorZ_get_err(uint64_t owner) {
7256         LDKCResult_u32GraphSyncErrorZ* owner_conv = (LDKCResult_u32GraphSyncErrorZ*)untag_ptr(owner);
7257         LDKGraphSyncError *ret_copy = MALLOC(sizeof(LDKGraphSyncError), "LDKGraphSyncError");
7258         *ret_copy = CResult_u32GraphSyncErrorZ_get_err(owner_conv);
7259         uint64_t ret_ref = tag_ptr(ret_copy, true);
7260         return ret_ref;
7261 }
7262
7263 static inline struct LDKCVec_u8Z CResult_CVec_u8ZIOErrorZ_get_ok(LDKCResult_CVec_u8ZIOErrorZ *NONNULL_PTR owner){
7264 CHECK(owner->result_ok);
7265         return CVec_u8Z_clone(&*owner->contents.result);
7266 }
7267 int8_tArray  __attribute__((export_name("TS_CResult_CVec_u8ZIOErrorZ_get_ok"))) TS_CResult_CVec_u8ZIOErrorZ_get_ok(uint64_t owner) {
7268         LDKCResult_CVec_u8ZIOErrorZ* owner_conv = (LDKCResult_CVec_u8ZIOErrorZ*)untag_ptr(owner);
7269         LDKCVec_u8Z ret_var = CResult_CVec_u8ZIOErrorZ_get_ok(owner_conv);
7270         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
7271         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
7272         CVec_u8Z_free(ret_var);
7273         return ret_arr;
7274 }
7275
7276 static inline enum LDKIOError CResult_CVec_u8ZIOErrorZ_get_err(LDKCResult_CVec_u8ZIOErrorZ *NONNULL_PTR owner){
7277 CHECK(!owner->result_ok);
7278         return *owner->contents.err;
7279 }
7280 uint32_t  __attribute__((export_name("TS_CResult_CVec_u8ZIOErrorZ_get_err"))) TS_CResult_CVec_u8ZIOErrorZ_get_err(uint64_t owner) {
7281         LDKCResult_CVec_u8ZIOErrorZ* owner_conv = (LDKCResult_CVec_u8ZIOErrorZ*)untag_ptr(owner);
7282         uint32_t ret_conv = LDKIOError_to_js(CResult_CVec_u8ZIOErrorZ_get_err(owner_conv));
7283         return ret_conv;
7284 }
7285
7286 static inline void CResult_NoneIOErrorZ_get_ok(LDKCResult_NoneIOErrorZ *NONNULL_PTR owner){
7287 CHECK(owner->result_ok);
7288         return *owner->contents.result;
7289 }
7290 void  __attribute__((export_name("TS_CResult_NoneIOErrorZ_get_ok"))) TS_CResult_NoneIOErrorZ_get_ok(uint64_t owner) {
7291         LDKCResult_NoneIOErrorZ* owner_conv = (LDKCResult_NoneIOErrorZ*)untag_ptr(owner);
7292         CResult_NoneIOErrorZ_get_ok(owner_conv);
7293 }
7294
7295 static inline enum LDKIOError CResult_NoneIOErrorZ_get_err(LDKCResult_NoneIOErrorZ *NONNULL_PTR owner){
7296 CHECK(!owner->result_ok);
7297         return *owner->contents.err;
7298 }
7299 uint32_t  __attribute__((export_name("TS_CResult_NoneIOErrorZ_get_err"))) TS_CResult_NoneIOErrorZ_get_err(uint64_t owner) {
7300         LDKCResult_NoneIOErrorZ* owner_conv = (LDKCResult_NoneIOErrorZ*)untag_ptr(owner);
7301         uint32_t ret_conv = LDKIOError_to_js(CResult_NoneIOErrorZ_get_err(owner_conv));
7302         return ret_conv;
7303 }
7304
7305 static inline struct LDKCVec_StrZ CResult_CVec_StrZIOErrorZ_get_ok(LDKCResult_CVec_StrZIOErrorZ *NONNULL_PTR owner){
7306 CHECK(owner->result_ok);
7307         return *owner->contents.result;
7308 }
7309 ptrArray  __attribute__((export_name("TS_CResult_CVec_StrZIOErrorZ_get_ok"))) TS_CResult_CVec_StrZIOErrorZ_get_ok(uint64_t owner) {
7310         LDKCResult_CVec_StrZIOErrorZ* owner_conv = (LDKCResult_CVec_StrZIOErrorZ*)untag_ptr(owner);
7311         LDKCVec_StrZ ret_var = CResult_CVec_StrZIOErrorZ_get_ok(owner_conv);
7312         ptrArray ret_arr = NULL;
7313         ret_arr = init_ptrArray(ret_var.datalen, __LINE__);
7314         jstring *ret_arr_ptr = (jstring*)(((uint8_t*)ret_arr) + 8);
7315         for (size_t i = 0; i < ret_var.datalen; i++) {
7316                 LDKStr ret_conv_8_str = ret_var.data[i];
7317                 jstring ret_conv_8_conv = str_ref_to_ts(ret_conv_8_str.chars, ret_conv_8_str.len);
7318                 ret_arr_ptr[i] = ret_conv_8_conv;
7319         }
7320         
7321         return ret_arr;
7322 }
7323
7324 static inline enum LDKIOError CResult_CVec_StrZIOErrorZ_get_err(LDKCResult_CVec_StrZIOErrorZ *NONNULL_PTR owner){
7325 CHECK(!owner->result_ok);
7326         return *owner->contents.err;
7327 }
7328 uint32_t  __attribute__((export_name("TS_CResult_CVec_StrZIOErrorZ_get_err"))) TS_CResult_CVec_StrZIOErrorZ_get_err(uint64_t owner) {
7329         LDKCResult_CVec_StrZIOErrorZ* owner_conv = (LDKCResult_CVec_StrZIOErrorZ*)untag_ptr(owner);
7330         uint32_t ret_conv = LDKIOError_to_js(CResult_CVec_StrZIOErrorZ_get_err(owner_conv));
7331         return ret_conv;
7332 }
7333
7334 static inline LDKCVec_C2Tuple_ThirtyTwoBytesChannelMonitorZZ CVec_C2Tuple_ThirtyTwoBytesChannelMonitorZZ_clone(const LDKCVec_C2Tuple_ThirtyTwoBytesChannelMonitorZZ *orig) {
7335         LDKCVec_C2Tuple_ThirtyTwoBytesChannelMonitorZZ ret = { .data = MALLOC(sizeof(LDKC2Tuple_ThirtyTwoBytesChannelMonitorZ) * orig->datalen, "LDKCVec_C2Tuple_ThirtyTwoBytesChannelMonitorZZ clone bytes"), .datalen = orig->datalen };
7336         for (size_t i = 0; i < ret.datalen; i++) {
7337                 ret.data[i] = C2Tuple_ThirtyTwoBytesChannelMonitorZ_clone(&orig->data[i]);
7338         }
7339         return ret;
7340 }
7341 static inline struct LDKCVec_C2Tuple_ThirtyTwoBytesChannelMonitorZZ CResult_CVec_C2Tuple_ThirtyTwoBytesChannelMonitorZZIOErrorZ_get_ok(LDKCResult_CVec_C2Tuple_ThirtyTwoBytesChannelMonitorZZIOErrorZ *NONNULL_PTR owner){
7342 CHECK(owner->result_ok);
7343         return CVec_C2Tuple_ThirtyTwoBytesChannelMonitorZZ_clone(&*owner->contents.result);
7344 }
7345 uint64_tArray  __attribute__((export_name("TS_CResult_CVec_C2Tuple_ThirtyTwoBytesChannelMonitorZZIOErrorZ_get_ok"))) TS_CResult_CVec_C2Tuple_ThirtyTwoBytesChannelMonitorZZIOErrorZ_get_ok(uint64_t owner) {
7346         LDKCResult_CVec_C2Tuple_ThirtyTwoBytesChannelMonitorZZIOErrorZ* owner_conv = (LDKCResult_CVec_C2Tuple_ThirtyTwoBytesChannelMonitorZZIOErrorZ*)untag_ptr(owner);
7347         LDKCVec_C2Tuple_ThirtyTwoBytesChannelMonitorZZ ret_var = CResult_CVec_C2Tuple_ThirtyTwoBytesChannelMonitorZZIOErrorZ_get_ok(owner_conv);
7348         uint64_tArray ret_arr = NULL;
7349         ret_arr = init_uint64_tArray(ret_var.datalen, __LINE__);
7350         uint64_t *ret_arr_ptr = (uint64_t*)(((uint8_t*)ret_arr) + 8);
7351         for (size_t o = 0; o < ret_var.datalen; o++) {
7352                 LDKC2Tuple_ThirtyTwoBytesChannelMonitorZ* ret_conv_40_conv = MALLOC(sizeof(LDKC2Tuple_ThirtyTwoBytesChannelMonitorZ), "LDKC2Tuple_ThirtyTwoBytesChannelMonitorZ");
7353                 *ret_conv_40_conv = ret_var.data[o];
7354                 ret_arr_ptr[o] = tag_ptr(ret_conv_40_conv, true);
7355         }
7356         
7357         FREE(ret_var.data);
7358         return ret_arr;
7359 }
7360
7361 static inline enum LDKIOError CResult_CVec_C2Tuple_ThirtyTwoBytesChannelMonitorZZIOErrorZ_get_err(LDKCResult_CVec_C2Tuple_ThirtyTwoBytesChannelMonitorZZIOErrorZ *NONNULL_PTR owner){
7362 CHECK(!owner->result_ok);
7363         return *owner->contents.err;
7364 }
7365 uint32_t  __attribute__((export_name("TS_CResult_CVec_C2Tuple_ThirtyTwoBytesChannelMonitorZZIOErrorZ_get_err"))) TS_CResult_CVec_C2Tuple_ThirtyTwoBytesChannelMonitorZZIOErrorZ_get_err(uint64_t owner) {
7366         LDKCResult_CVec_C2Tuple_ThirtyTwoBytesChannelMonitorZZIOErrorZ* owner_conv = (LDKCResult_CVec_C2Tuple_ThirtyTwoBytesChannelMonitorZZIOErrorZ*)untag_ptr(owner);
7367         uint32_t ret_conv = LDKIOError_to_js(CResult_CVec_C2Tuple_ThirtyTwoBytesChannelMonitorZZIOErrorZ_get_err(owner_conv));
7368         return ret_conv;
7369 }
7370
7371 static inline struct LDKC2Tuple_ThirtyTwoBytesChannelMonitorZ CResult_C2Tuple_ThirtyTwoBytesChannelMonitorZIOErrorZ_get_ok(LDKCResult_C2Tuple_ThirtyTwoBytesChannelMonitorZIOErrorZ *NONNULL_PTR owner){
7372 CHECK(owner->result_ok);
7373         return C2Tuple_ThirtyTwoBytesChannelMonitorZ_clone(&*owner->contents.result);
7374 }
7375 uint64_t  __attribute__((export_name("TS_CResult_C2Tuple_ThirtyTwoBytesChannelMonitorZIOErrorZ_get_ok"))) TS_CResult_C2Tuple_ThirtyTwoBytesChannelMonitorZIOErrorZ_get_ok(uint64_t owner) {
7376         LDKCResult_C2Tuple_ThirtyTwoBytesChannelMonitorZIOErrorZ* owner_conv = (LDKCResult_C2Tuple_ThirtyTwoBytesChannelMonitorZIOErrorZ*)untag_ptr(owner);
7377         LDKC2Tuple_ThirtyTwoBytesChannelMonitorZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_ThirtyTwoBytesChannelMonitorZ), "LDKC2Tuple_ThirtyTwoBytesChannelMonitorZ");
7378         *ret_conv = CResult_C2Tuple_ThirtyTwoBytesChannelMonitorZIOErrorZ_get_ok(owner_conv);
7379         return tag_ptr(ret_conv, true);
7380 }
7381
7382 static inline enum LDKIOError CResult_C2Tuple_ThirtyTwoBytesChannelMonitorZIOErrorZ_get_err(LDKCResult_C2Tuple_ThirtyTwoBytesChannelMonitorZIOErrorZ *NONNULL_PTR owner){
7383 CHECK(!owner->result_ok);
7384         return *owner->contents.err;
7385 }
7386 uint32_t  __attribute__((export_name("TS_CResult_C2Tuple_ThirtyTwoBytesChannelMonitorZIOErrorZ_get_err"))) TS_CResult_C2Tuple_ThirtyTwoBytesChannelMonitorZIOErrorZ_get_err(uint64_t owner) {
7387         LDKCResult_C2Tuple_ThirtyTwoBytesChannelMonitorZIOErrorZ* owner_conv = (LDKCResult_C2Tuple_ThirtyTwoBytesChannelMonitorZIOErrorZ*)untag_ptr(owner);
7388         uint32_t ret_conv = LDKIOError_to_js(CResult_C2Tuple_ThirtyTwoBytesChannelMonitorZIOErrorZ_get_err(owner_conv));
7389         return ret_conv;
7390 }
7391
7392 uint32_t __attribute__((export_name("TS_LDKCOption_SecretKeyZ_ty_from_ptr"))) TS_LDKCOption_SecretKeyZ_ty_from_ptr(uint64_t ptr) {
7393         LDKCOption_SecretKeyZ *obj = (LDKCOption_SecretKeyZ*)untag_ptr(ptr);
7394         switch(obj->tag) {
7395                 case LDKCOption_SecretKeyZ_Some: return 0;
7396                 case LDKCOption_SecretKeyZ_None: return 1;
7397                 default: abort();
7398         }
7399 }
7400 int8_tArray __attribute__((export_name("TS_LDKCOption_SecretKeyZ_Some_get_some"))) TS_LDKCOption_SecretKeyZ_Some_get_some(uint64_t ptr) {
7401         LDKCOption_SecretKeyZ *obj = (LDKCOption_SecretKeyZ*)untag_ptr(ptr);
7402         assert(obj->tag == LDKCOption_SecretKeyZ_Some);
7403         int8_tArray some_arr = init_int8_tArray(32, __LINE__);
7404         memcpy(some_arr->elems, obj->some.bytes, 32);
7405         return some_arr;
7406 }
7407 static inline struct LDKVerifiedInvoiceRequest CResult_VerifiedInvoiceRequestNoneZ_get_ok(LDKCResult_VerifiedInvoiceRequestNoneZ *NONNULL_PTR owner){
7408         LDKVerifiedInvoiceRequest ret = *owner->contents.result;
7409         ret.is_owned = false;
7410         return ret;
7411 }
7412 uint64_t  __attribute__((export_name("TS_CResult_VerifiedInvoiceRequestNoneZ_get_ok"))) TS_CResult_VerifiedInvoiceRequestNoneZ_get_ok(uint64_t owner) {
7413         LDKCResult_VerifiedInvoiceRequestNoneZ* owner_conv = (LDKCResult_VerifiedInvoiceRequestNoneZ*)untag_ptr(owner);
7414         LDKVerifiedInvoiceRequest ret_var = CResult_VerifiedInvoiceRequestNoneZ_get_ok(owner_conv);
7415         uint64_t ret_ref = 0;
7416         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
7417         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
7418         return ret_ref;
7419 }
7420
7421 static inline void CResult_VerifiedInvoiceRequestNoneZ_get_err(LDKCResult_VerifiedInvoiceRequestNoneZ *NONNULL_PTR owner){
7422 CHECK(!owner->result_ok);
7423         return *owner->contents.err;
7424 }
7425 void  __attribute__((export_name("TS_CResult_VerifiedInvoiceRequestNoneZ_get_err"))) TS_CResult_VerifiedInvoiceRequestNoneZ_get_err(uint64_t owner) {
7426         LDKCResult_VerifiedInvoiceRequestNoneZ* owner_conv = (LDKCResult_VerifiedInvoiceRequestNoneZ*)untag_ptr(owner);
7427         CResult_VerifiedInvoiceRequestNoneZ_get_err(owner_conv);
7428 }
7429
7430 static inline LDKCVec_WitnessZ CVec_WitnessZ_clone(const LDKCVec_WitnessZ *orig) {
7431         LDKCVec_WitnessZ ret = { .data = MALLOC(sizeof(LDKWitness) * orig->datalen, "LDKCVec_WitnessZ clone bytes"), .datalen = orig->datalen };
7432         for (size_t i = 0; i < ret.datalen; i++) {
7433                 ret.data[i] = Witness_clone(&orig->data[i]);
7434         }
7435         return ret;
7436 }
7437 uint32_t __attribute__((export_name("TS_LDKCOption_i64Z_ty_from_ptr"))) TS_LDKCOption_i64Z_ty_from_ptr(uint64_t ptr) {
7438         LDKCOption_i64Z *obj = (LDKCOption_i64Z*)untag_ptr(ptr);
7439         switch(obj->tag) {
7440                 case LDKCOption_i64Z_Some: return 0;
7441                 case LDKCOption_i64Z_None: return 1;
7442                 default: abort();
7443         }
7444 }
7445 int64_t __attribute__((export_name("TS_LDKCOption_i64Z_Some_get_some"))) TS_LDKCOption_i64Z_Some_get_some(uint64_t ptr) {
7446         LDKCOption_i64Z *obj = (LDKCOption_i64Z*)untag_ptr(ptr);
7447         assert(obj->tag == LDKCOption_i64Z_Some);
7448         int64_t some_conv = obj->some;
7449         return some_conv;
7450 }
7451 static inline struct LDKSocketAddress CResult_SocketAddressDecodeErrorZ_get_ok(LDKCResult_SocketAddressDecodeErrorZ *NONNULL_PTR owner){
7452 CHECK(owner->result_ok);
7453         return SocketAddress_clone(&*owner->contents.result);
7454 }
7455 uint64_t  __attribute__((export_name("TS_CResult_SocketAddressDecodeErrorZ_get_ok"))) TS_CResult_SocketAddressDecodeErrorZ_get_ok(uint64_t owner) {
7456         LDKCResult_SocketAddressDecodeErrorZ* owner_conv = (LDKCResult_SocketAddressDecodeErrorZ*)untag_ptr(owner);
7457         LDKSocketAddress *ret_copy = MALLOC(sizeof(LDKSocketAddress), "LDKSocketAddress");
7458         *ret_copy = CResult_SocketAddressDecodeErrorZ_get_ok(owner_conv);
7459         uint64_t ret_ref = tag_ptr(ret_copy, true);
7460         return ret_ref;
7461 }
7462
7463 static inline struct LDKDecodeError CResult_SocketAddressDecodeErrorZ_get_err(LDKCResult_SocketAddressDecodeErrorZ *NONNULL_PTR owner){
7464 CHECK(!owner->result_ok);
7465         return DecodeError_clone(&*owner->contents.err);
7466 }
7467 uint64_t  __attribute__((export_name("TS_CResult_SocketAddressDecodeErrorZ_get_err"))) TS_CResult_SocketAddressDecodeErrorZ_get_err(uint64_t owner) {
7468         LDKCResult_SocketAddressDecodeErrorZ* owner_conv = (LDKCResult_SocketAddressDecodeErrorZ*)untag_ptr(owner);
7469         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
7470         *ret_copy = CResult_SocketAddressDecodeErrorZ_get_err(owner_conv);
7471         uint64_t ret_ref = tag_ptr(ret_copy, true);
7472         return ret_ref;
7473 }
7474
7475 static inline struct LDKSocketAddress CResult_SocketAddressSocketAddressParseErrorZ_get_ok(LDKCResult_SocketAddressSocketAddressParseErrorZ *NONNULL_PTR owner){
7476 CHECK(owner->result_ok);
7477         return SocketAddress_clone(&*owner->contents.result);
7478 }
7479 uint64_t  __attribute__((export_name("TS_CResult_SocketAddressSocketAddressParseErrorZ_get_ok"))) TS_CResult_SocketAddressSocketAddressParseErrorZ_get_ok(uint64_t owner) {
7480         LDKCResult_SocketAddressSocketAddressParseErrorZ* owner_conv = (LDKCResult_SocketAddressSocketAddressParseErrorZ*)untag_ptr(owner);
7481         LDKSocketAddress *ret_copy = MALLOC(sizeof(LDKSocketAddress), "LDKSocketAddress");
7482         *ret_copy = CResult_SocketAddressSocketAddressParseErrorZ_get_ok(owner_conv);
7483         uint64_t ret_ref = tag_ptr(ret_copy, true);
7484         return ret_ref;
7485 }
7486
7487 static inline enum LDKSocketAddressParseError CResult_SocketAddressSocketAddressParseErrorZ_get_err(LDKCResult_SocketAddressSocketAddressParseErrorZ *NONNULL_PTR owner){
7488 CHECK(!owner->result_ok);
7489         return SocketAddressParseError_clone(&*owner->contents.err);
7490 }
7491 uint32_t  __attribute__((export_name("TS_CResult_SocketAddressSocketAddressParseErrorZ_get_err"))) TS_CResult_SocketAddressSocketAddressParseErrorZ_get_err(uint64_t owner) {
7492         LDKCResult_SocketAddressSocketAddressParseErrorZ* owner_conv = (LDKCResult_SocketAddressSocketAddressParseErrorZ*)untag_ptr(owner);
7493         uint32_t ret_conv = LDKSocketAddressParseError_to_js(CResult_SocketAddressSocketAddressParseErrorZ_get_err(owner_conv));
7494         return ret_conv;
7495 }
7496
7497 static inline LDKCVec_UpdateAddHTLCZ CVec_UpdateAddHTLCZ_clone(const LDKCVec_UpdateAddHTLCZ *orig) {
7498         LDKCVec_UpdateAddHTLCZ ret = { .data = MALLOC(sizeof(LDKUpdateAddHTLC) * orig->datalen, "LDKCVec_UpdateAddHTLCZ clone bytes"), .datalen = orig->datalen };
7499         for (size_t i = 0; i < ret.datalen; i++) {
7500                 ret.data[i] = UpdateAddHTLC_clone(&orig->data[i]);
7501         }
7502         return ret;
7503 }
7504 static inline LDKCVec_UpdateFulfillHTLCZ CVec_UpdateFulfillHTLCZ_clone(const LDKCVec_UpdateFulfillHTLCZ *orig) {
7505         LDKCVec_UpdateFulfillHTLCZ ret = { .data = MALLOC(sizeof(LDKUpdateFulfillHTLC) * orig->datalen, "LDKCVec_UpdateFulfillHTLCZ clone bytes"), .datalen = orig->datalen };
7506         for (size_t i = 0; i < ret.datalen; i++) {
7507                 ret.data[i] = UpdateFulfillHTLC_clone(&orig->data[i]);
7508         }
7509         return ret;
7510 }
7511 static inline LDKCVec_UpdateFailHTLCZ CVec_UpdateFailHTLCZ_clone(const LDKCVec_UpdateFailHTLCZ *orig) {
7512         LDKCVec_UpdateFailHTLCZ ret = { .data = MALLOC(sizeof(LDKUpdateFailHTLC) * orig->datalen, "LDKCVec_UpdateFailHTLCZ clone bytes"), .datalen = orig->datalen };
7513         for (size_t i = 0; i < ret.datalen; i++) {
7514                 ret.data[i] = UpdateFailHTLC_clone(&orig->data[i]);
7515         }
7516         return ret;
7517 }
7518 static inline LDKCVec_UpdateFailMalformedHTLCZ CVec_UpdateFailMalformedHTLCZ_clone(const LDKCVec_UpdateFailMalformedHTLCZ *orig) {
7519         LDKCVec_UpdateFailMalformedHTLCZ ret = { .data = MALLOC(sizeof(LDKUpdateFailMalformedHTLC) * orig->datalen, "LDKCVec_UpdateFailMalformedHTLCZ clone bytes"), .datalen = orig->datalen };
7520         for (size_t i = 0; i < ret.datalen; i++) {
7521                 ret.data[i] = UpdateFailMalformedHTLC_clone(&orig->data[i]);
7522         }
7523         return ret;
7524 }
7525 static inline struct LDKAcceptChannel CResult_AcceptChannelDecodeErrorZ_get_ok(LDKCResult_AcceptChannelDecodeErrorZ *NONNULL_PTR owner){
7526         LDKAcceptChannel ret = *owner->contents.result;
7527         ret.is_owned = false;
7528         return ret;
7529 }
7530 uint64_t  __attribute__((export_name("TS_CResult_AcceptChannelDecodeErrorZ_get_ok"))) TS_CResult_AcceptChannelDecodeErrorZ_get_ok(uint64_t owner) {
7531         LDKCResult_AcceptChannelDecodeErrorZ* owner_conv = (LDKCResult_AcceptChannelDecodeErrorZ*)untag_ptr(owner);
7532         LDKAcceptChannel ret_var = CResult_AcceptChannelDecodeErrorZ_get_ok(owner_conv);
7533         uint64_t ret_ref = 0;
7534         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
7535         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
7536         return ret_ref;
7537 }
7538
7539 static inline struct LDKDecodeError CResult_AcceptChannelDecodeErrorZ_get_err(LDKCResult_AcceptChannelDecodeErrorZ *NONNULL_PTR owner){
7540 CHECK(!owner->result_ok);
7541         return DecodeError_clone(&*owner->contents.err);
7542 }
7543 uint64_t  __attribute__((export_name("TS_CResult_AcceptChannelDecodeErrorZ_get_err"))) TS_CResult_AcceptChannelDecodeErrorZ_get_err(uint64_t owner) {
7544         LDKCResult_AcceptChannelDecodeErrorZ* owner_conv = (LDKCResult_AcceptChannelDecodeErrorZ*)untag_ptr(owner);
7545         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
7546         *ret_copy = CResult_AcceptChannelDecodeErrorZ_get_err(owner_conv);
7547         uint64_t ret_ref = tag_ptr(ret_copy, true);
7548         return ret_ref;
7549 }
7550
7551 static inline struct LDKAcceptChannelV2 CResult_AcceptChannelV2DecodeErrorZ_get_ok(LDKCResult_AcceptChannelV2DecodeErrorZ *NONNULL_PTR owner){
7552         LDKAcceptChannelV2 ret = *owner->contents.result;
7553         ret.is_owned = false;
7554         return ret;
7555 }
7556 uint64_t  __attribute__((export_name("TS_CResult_AcceptChannelV2DecodeErrorZ_get_ok"))) TS_CResult_AcceptChannelV2DecodeErrorZ_get_ok(uint64_t owner) {
7557         LDKCResult_AcceptChannelV2DecodeErrorZ* owner_conv = (LDKCResult_AcceptChannelV2DecodeErrorZ*)untag_ptr(owner);
7558         LDKAcceptChannelV2 ret_var = CResult_AcceptChannelV2DecodeErrorZ_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 struct LDKDecodeError CResult_AcceptChannelV2DecodeErrorZ_get_err(LDKCResult_AcceptChannelV2DecodeErrorZ *NONNULL_PTR owner){
7566 CHECK(!owner->result_ok);
7567         return DecodeError_clone(&*owner->contents.err);
7568 }
7569 uint64_t  __attribute__((export_name("TS_CResult_AcceptChannelV2DecodeErrorZ_get_err"))) TS_CResult_AcceptChannelV2DecodeErrorZ_get_err(uint64_t owner) {
7570         LDKCResult_AcceptChannelV2DecodeErrorZ* owner_conv = (LDKCResult_AcceptChannelV2DecodeErrorZ*)untag_ptr(owner);
7571         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
7572         *ret_copy = CResult_AcceptChannelV2DecodeErrorZ_get_err(owner_conv);
7573         uint64_t ret_ref = tag_ptr(ret_copy, true);
7574         return ret_ref;
7575 }
7576
7577 static inline struct LDKTxAddInput CResult_TxAddInputDecodeErrorZ_get_ok(LDKCResult_TxAddInputDecodeErrorZ *NONNULL_PTR owner){
7578         LDKTxAddInput ret = *owner->contents.result;
7579         ret.is_owned = false;
7580         return ret;
7581 }
7582 uint64_t  __attribute__((export_name("TS_CResult_TxAddInputDecodeErrorZ_get_ok"))) TS_CResult_TxAddInputDecodeErrorZ_get_ok(uint64_t owner) {
7583         LDKCResult_TxAddInputDecodeErrorZ* owner_conv = (LDKCResult_TxAddInputDecodeErrorZ*)untag_ptr(owner);
7584         LDKTxAddInput ret_var = CResult_TxAddInputDecodeErrorZ_get_ok(owner_conv);
7585         uint64_t ret_ref = 0;
7586         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
7587         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
7588         return ret_ref;
7589 }
7590
7591 static inline struct LDKDecodeError CResult_TxAddInputDecodeErrorZ_get_err(LDKCResult_TxAddInputDecodeErrorZ *NONNULL_PTR owner){
7592 CHECK(!owner->result_ok);
7593         return DecodeError_clone(&*owner->contents.err);
7594 }
7595 uint64_t  __attribute__((export_name("TS_CResult_TxAddInputDecodeErrorZ_get_err"))) TS_CResult_TxAddInputDecodeErrorZ_get_err(uint64_t owner) {
7596         LDKCResult_TxAddInputDecodeErrorZ* owner_conv = (LDKCResult_TxAddInputDecodeErrorZ*)untag_ptr(owner);
7597         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
7598         *ret_copy = CResult_TxAddInputDecodeErrorZ_get_err(owner_conv);
7599         uint64_t ret_ref = tag_ptr(ret_copy, true);
7600         return ret_ref;
7601 }
7602
7603 static inline struct LDKTxAddOutput CResult_TxAddOutputDecodeErrorZ_get_ok(LDKCResult_TxAddOutputDecodeErrorZ *NONNULL_PTR owner){
7604         LDKTxAddOutput ret = *owner->contents.result;
7605         ret.is_owned = false;
7606         return ret;
7607 }
7608 uint64_t  __attribute__((export_name("TS_CResult_TxAddOutputDecodeErrorZ_get_ok"))) TS_CResult_TxAddOutputDecodeErrorZ_get_ok(uint64_t owner) {
7609         LDKCResult_TxAddOutputDecodeErrorZ* owner_conv = (LDKCResult_TxAddOutputDecodeErrorZ*)untag_ptr(owner);
7610         LDKTxAddOutput ret_var = CResult_TxAddOutputDecodeErrorZ_get_ok(owner_conv);
7611         uint64_t ret_ref = 0;
7612         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
7613         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
7614         return ret_ref;
7615 }
7616
7617 static inline struct LDKDecodeError CResult_TxAddOutputDecodeErrorZ_get_err(LDKCResult_TxAddOutputDecodeErrorZ *NONNULL_PTR owner){
7618 CHECK(!owner->result_ok);
7619         return DecodeError_clone(&*owner->contents.err);
7620 }
7621 uint64_t  __attribute__((export_name("TS_CResult_TxAddOutputDecodeErrorZ_get_err"))) TS_CResult_TxAddOutputDecodeErrorZ_get_err(uint64_t owner) {
7622         LDKCResult_TxAddOutputDecodeErrorZ* owner_conv = (LDKCResult_TxAddOutputDecodeErrorZ*)untag_ptr(owner);
7623         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
7624         *ret_copy = CResult_TxAddOutputDecodeErrorZ_get_err(owner_conv);
7625         uint64_t ret_ref = tag_ptr(ret_copy, true);
7626         return ret_ref;
7627 }
7628
7629 static inline struct LDKTxRemoveInput CResult_TxRemoveInputDecodeErrorZ_get_ok(LDKCResult_TxRemoveInputDecodeErrorZ *NONNULL_PTR owner){
7630         LDKTxRemoveInput ret = *owner->contents.result;
7631         ret.is_owned = false;
7632         return ret;
7633 }
7634 uint64_t  __attribute__((export_name("TS_CResult_TxRemoveInputDecodeErrorZ_get_ok"))) TS_CResult_TxRemoveInputDecodeErrorZ_get_ok(uint64_t owner) {
7635         LDKCResult_TxRemoveInputDecodeErrorZ* owner_conv = (LDKCResult_TxRemoveInputDecodeErrorZ*)untag_ptr(owner);
7636         LDKTxRemoveInput ret_var = CResult_TxRemoveInputDecodeErrorZ_get_ok(owner_conv);
7637         uint64_t ret_ref = 0;
7638         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
7639         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
7640         return ret_ref;
7641 }
7642
7643 static inline struct LDKDecodeError CResult_TxRemoveInputDecodeErrorZ_get_err(LDKCResult_TxRemoveInputDecodeErrorZ *NONNULL_PTR owner){
7644 CHECK(!owner->result_ok);
7645         return DecodeError_clone(&*owner->contents.err);
7646 }
7647 uint64_t  __attribute__((export_name("TS_CResult_TxRemoveInputDecodeErrorZ_get_err"))) TS_CResult_TxRemoveInputDecodeErrorZ_get_err(uint64_t owner) {
7648         LDKCResult_TxRemoveInputDecodeErrorZ* owner_conv = (LDKCResult_TxRemoveInputDecodeErrorZ*)untag_ptr(owner);
7649         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
7650         *ret_copy = CResult_TxRemoveInputDecodeErrorZ_get_err(owner_conv);
7651         uint64_t ret_ref = tag_ptr(ret_copy, true);
7652         return ret_ref;
7653 }
7654
7655 static inline struct LDKTxRemoveOutput CResult_TxRemoveOutputDecodeErrorZ_get_ok(LDKCResult_TxRemoveOutputDecodeErrorZ *NONNULL_PTR owner){
7656         LDKTxRemoveOutput ret = *owner->contents.result;
7657         ret.is_owned = false;
7658         return ret;
7659 }
7660 uint64_t  __attribute__((export_name("TS_CResult_TxRemoveOutputDecodeErrorZ_get_ok"))) TS_CResult_TxRemoveOutputDecodeErrorZ_get_ok(uint64_t owner) {
7661         LDKCResult_TxRemoveOutputDecodeErrorZ* owner_conv = (LDKCResult_TxRemoveOutputDecodeErrorZ*)untag_ptr(owner);
7662         LDKTxRemoveOutput ret_var = CResult_TxRemoveOutputDecodeErrorZ_get_ok(owner_conv);
7663         uint64_t ret_ref = 0;
7664         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
7665         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
7666         return ret_ref;
7667 }
7668
7669 static inline struct LDKDecodeError CResult_TxRemoveOutputDecodeErrorZ_get_err(LDKCResult_TxRemoveOutputDecodeErrorZ *NONNULL_PTR owner){
7670 CHECK(!owner->result_ok);
7671         return DecodeError_clone(&*owner->contents.err);
7672 }
7673 uint64_t  __attribute__((export_name("TS_CResult_TxRemoveOutputDecodeErrorZ_get_err"))) TS_CResult_TxRemoveOutputDecodeErrorZ_get_err(uint64_t owner) {
7674         LDKCResult_TxRemoveOutputDecodeErrorZ* owner_conv = (LDKCResult_TxRemoveOutputDecodeErrorZ*)untag_ptr(owner);
7675         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
7676         *ret_copy = CResult_TxRemoveOutputDecodeErrorZ_get_err(owner_conv);
7677         uint64_t ret_ref = tag_ptr(ret_copy, true);
7678         return ret_ref;
7679 }
7680
7681 static inline struct LDKTxComplete CResult_TxCompleteDecodeErrorZ_get_ok(LDKCResult_TxCompleteDecodeErrorZ *NONNULL_PTR owner){
7682         LDKTxComplete ret = *owner->contents.result;
7683         ret.is_owned = false;
7684         return ret;
7685 }
7686 uint64_t  __attribute__((export_name("TS_CResult_TxCompleteDecodeErrorZ_get_ok"))) TS_CResult_TxCompleteDecodeErrorZ_get_ok(uint64_t owner) {
7687         LDKCResult_TxCompleteDecodeErrorZ* owner_conv = (LDKCResult_TxCompleteDecodeErrorZ*)untag_ptr(owner);
7688         LDKTxComplete ret_var = CResult_TxCompleteDecodeErrorZ_get_ok(owner_conv);
7689         uint64_t ret_ref = 0;
7690         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
7691         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
7692         return ret_ref;
7693 }
7694
7695 static inline struct LDKDecodeError CResult_TxCompleteDecodeErrorZ_get_err(LDKCResult_TxCompleteDecodeErrorZ *NONNULL_PTR owner){
7696 CHECK(!owner->result_ok);
7697         return DecodeError_clone(&*owner->contents.err);
7698 }
7699 uint64_t  __attribute__((export_name("TS_CResult_TxCompleteDecodeErrorZ_get_err"))) TS_CResult_TxCompleteDecodeErrorZ_get_err(uint64_t owner) {
7700         LDKCResult_TxCompleteDecodeErrorZ* owner_conv = (LDKCResult_TxCompleteDecodeErrorZ*)untag_ptr(owner);
7701         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
7702         *ret_copy = CResult_TxCompleteDecodeErrorZ_get_err(owner_conv);
7703         uint64_t ret_ref = tag_ptr(ret_copy, true);
7704         return ret_ref;
7705 }
7706
7707 static inline struct LDKTxSignatures CResult_TxSignaturesDecodeErrorZ_get_ok(LDKCResult_TxSignaturesDecodeErrorZ *NONNULL_PTR owner){
7708         LDKTxSignatures ret = *owner->contents.result;
7709         ret.is_owned = false;
7710         return ret;
7711 }
7712 uint64_t  __attribute__((export_name("TS_CResult_TxSignaturesDecodeErrorZ_get_ok"))) TS_CResult_TxSignaturesDecodeErrorZ_get_ok(uint64_t owner) {
7713         LDKCResult_TxSignaturesDecodeErrorZ* owner_conv = (LDKCResult_TxSignaturesDecodeErrorZ*)untag_ptr(owner);
7714         LDKTxSignatures ret_var = CResult_TxSignaturesDecodeErrorZ_get_ok(owner_conv);
7715         uint64_t ret_ref = 0;
7716         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
7717         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
7718         return ret_ref;
7719 }
7720
7721 static inline struct LDKDecodeError CResult_TxSignaturesDecodeErrorZ_get_err(LDKCResult_TxSignaturesDecodeErrorZ *NONNULL_PTR owner){
7722 CHECK(!owner->result_ok);
7723         return DecodeError_clone(&*owner->contents.err);
7724 }
7725 uint64_t  __attribute__((export_name("TS_CResult_TxSignaturesDecodeErrorZ_get_err"))) TS_CResult_TxSignaturesDecodeErrorZ_get_err(uint64_t owner) {
7726         LDKCResult_TxSignaturesDecodeErrorZ* owner_conv = (LDKCResult_TxSignaturesDecodeErrorZ*)untag_ptr(owner);
7727         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
7728         *ret_copy = CResult_TxSignaturesDecodeErrorZ_get_err(owner_conv);
7729         uint64_t ret_ref = tag_ptr(ret_copy, true);
7730         return ret_ref;
7731 }
7732
7733 static inline struct LDKTxInitRbf CResult_TxInitRbfDecodeErrorZ_get_ok(LDKCResult_TxInitRbfDecodeErrorZ *NONNULL_PTR owner){
7734         LDKTxInitRbf ret = *owner->contents.result;
7735         ret.is_owned = false;
7736         return ret;
7737 }
7738 uint64_t  __attribute__((export_name("TS_CResult_TxInitRbfDecodeErrorZ_get_ok"))) TS_CResult_TxInitRbfDecodeErrorZ_get_ok(uint64_t owner) {
7739         LDKCResult_TxInitRbfDecodeErrorZ* owner_conv = (LDKCResult_TxInitRbfDecodeErrorZ*)untag_ptr(owner);
7740         LDKTxInitRbf ret_var = CResult_TxInitRbfDecodeErrorZ_get_ok(owner_conv);
7741         uint64_t ret_ref = 0;
7742         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
7743         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
7744         return ret_ref;
7745 }
7746
7747 static inline struct LDKDecodeError CResult_TxInitRbfDecodeErrorZ_get_err(LDKCResult_TxInitRbfDecodeErrorZ *NONNULL_PTR owner){
7748 CHECK(!owner->result_ok);
7749         return DecodeError_clone(&*owner->contents.err);
7750 }
7751 uint64_t  __attribute__((export_name("TS_CResult_TxInitRbfDecodeErrorZ_get_err"))) TS_CResult_TxInitRbfDecodeErrorZ_get_err(uint64_t owner) {
7752         LDKCResult_TxInitRbfDecodeErrorZ* owner_conv = (LDKCResult_TxInitRbfDecodeErrorZ*)untag_ptr(owner);
7753         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
7754         *ret_copy = CResult_TxInitRbfDecodeErrorZ_get_err(owner_conv);
7755         uint64_t ret_ref = tag_ptr(ret_copy, true);
7756         return ret_ref;
7757 }
7758
7759 static inline struct LDKTxAckRbf CResult_TxAckRbfDecodeErrorZ_get_ok(LDKCResult_TxAckRbfDecodeErrorZ *NONNULL_PTR owner){
7760         LDKTxAckRbf ret = *owner->contents.result;
7761         ret.is_owned = false;
7762         return ret;
7763 }
7764 uint64_t  __attribute__((export_name("TS_CResult_TxAckRbfDecodeErrorZ_get_ok"))) TS_CResult_TxAckRbfDecodeErrorZ_get_ok(uint64_t owner) {
7765         LDKCResult_TxAckRbfDecodeErrorZ* owner_conv = (LDKCResult_TxAckRbfDecodeErrorZ*)untag_ptr(owner);
7766         LDKTxAckRbf ret_var = CResult_TxAckRbfDecodeErrorZ_get_ok(owner_conv);
7767         uint64_t ret_ref = 0;
7768         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
7769         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
7770         return ret_ref;
7771 }
7772
7773 static inline struct LDKDecodeError CResult_TxAckRbfDecodeErrorZ_get_err(LDKCResult_TxAckRbfDecodeErrorZ *NONNULL_PTR owner){
7774 CHECK(!owner->result_ok);
7775         return DecodeError_clone(&*owner->contents.err);
7776 }
7777 uint64_t  __attribute__((export_name("TS_CResult_TxAckRbfDecodeErrorZ_get_err"))) TS_CResult_TxAckRbfDecodeErrorZ_get_err(uint64_t owner) {
7778         LDKCResult_TxAckRbfDecodeErrorZ* owner_conv = (LDKCResult_TxAckRbfDecodeErrorZ*)untag_ptr(owner);
7779         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
7780         *ret_copy = CResult_TxAckRbfDecodeErrorZ_get_err(owner_conv);
7781         uint64_t ret_ref = tag_ptr(ret_copy, true);
7782         return ret_ref;
7783 }
7784
7785 static inline struct LDKTxAbort CResult_TxAbortDecodeErrorZ_get_ok(LDKCResult_TxAbortDecodeErrorZ *NONNULL_PTR owner){
7786         LDKTxAbort ret = *owner->contents.result;
7787         ret.is_owned = false;
7788         return ret;
7789 }
7790 uint64_t  __attribute__((export_name("TS_CResult_TxAbortDecodeErrorZ_get_ok"))) TS_CResult_TxAbortDecodeErrorZ_get_ok(uint64_t owner) {
7791         LDKCResult_TxAbortDecodeErrorZ* owner_conv = (LDKCResult_TxAbortDecodeErrorZ*)untag_ptr(owner);
7792         LDKTxAbort ret_var = CResult_TxAbortDecodeErrorZ_get_ok(owner_conv);
7793         uint64_t ret_ref = 0;
7794         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
7795         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
7796         return ret_ref;
7797 }
7798
7799 static inline struct LDKDecodeError CResult_TxAbortDecodeErrorZ_get_err(LDKCResult_TxAbortDecodeErrorZ *NONNULL_PTR owner){
7800 CHECK(!owner->result_ok);
7801         return DecodeError_clone(&*owner->contents.err);
7802 }
7803 uint64_t  __attribute__((export_name("TS_CResult_TxAbortDecodeErrorZ_get_err"))) TS_CResult_TxAbortDecodeErrorZ_get_err(uint64_t owner) {
7804         LDKCResult_TxAbortDecodeErrorZ* owner_conv = (LDKCResult_TxAbortDecodeErrorZ*)untag_ptr(owner);
7805         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
7806         *ret_copy = CResult_TxAbortDecodeErrorZ_get_err(owner_conv);
7807         uint64_t ret_ref = tag_ptr(ret_copy, true);
7808         return ret_ref;
7809 }
7810
7811 static inline struct LDKAnnouncementSignatures CResult_AnnouncementSignaturesDecodeErrorZ_get_ok(LDKCResult_AnnouncementSignaturesDecodeErrorZ *NONNULL_PTR owner){
7812         LDKAnnouncementSignatures ret = *owner->contents.result;
7813         ret.is_owned = false;
7814         return ret;
7815 }
7816 uint64_t  __attribute__((export_name("TS_CResult_AnnouncementSignaturesDecodeErrorZ_get_ok"))) TS_CResult_AnnouncementSignaturesDecodeErrorZ_get_ok(uint64_t owner) {
7817         LDKCResult_AnnouncementSignaturesDecodeErrorZ* owner_conv = (LDKCResult_AnnouncementSignaturesDecodeErrorZ*)untag_ptr(owner);
7818         LDKAnnouncementSignatures ret_var = CResult_AnnouncementSignaturesDecodeErrorZ_get_ok(owner_conv);
7819         uint64_t ret_ref = 0;
7820         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
7821         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
7822         return ret_ref;
7823 }
7824
7825 static inline struct LDKDecodeError CResult_AnnouncementSignaturesDecodeErrorZ_get_err(LDKCResult_AnnouncementSignaturesDecodeErrorZ *NONNULL_PTR owner){
7826 CHECK(!owner->result_ok);
7827         return DecodeError_clone(&*owner->contents.err);
7828 }
7829 uint64_t  __attribute__((export_name("TS_CResult_AnnouncementSignaturesDecodeErrorZ_get_err"))) TS_CResult_AnnouncementSignaturesDecodeErrorZ_get_err(uint64_t owner) {
7830         LDKCResult_AnnouncementSignaturesDecodeErrorZ* owner_conv = (LDKCResult_AnnouncementSignaturesDecodeErrorZ*)untag_ptr(owner);
7831         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
7832         *ret_copy = CResult_AnnouncementSignaturesDecodeErrorZ_get_err(owner_conv);
7833         uint64_t ret_ref = tag_ptr(ret_copy, true);
7834         return ret_ref;
7835 }
7836
7837 static inline struct LDKChannelReestablish CResult_ChannelReestablishDecodeErrorZ_get_ok(LDKCResult_ChannelReestablishDecodeErrorZ *NONNULL_PTR owner){
7838         LDKChannelReestablish ret = *owner->contents.result;
7839         ret.is_owned = false;
7840         return ret;
7841 }
7842 uint64_t  __attribute__((export_name("TS_CResult_ChannelReestablishDecodeErrorZ_get_ok"))) TS_CResult_ChannelReestablishDecodeErrorZ_get_ok(uint64_t owner) {
7843         LDKCResult_ChannelReestablishDecodeErrorZ* owner_conv = (LDKCResult_ChannelReestablishDecodeErrorZ*)untag_ptr(owner);
7844         LDKChannelReestablish ret_var = CResult_ChannelReestablishDecodeErrorZ_get_ok(owner_conv);
7845         uint64_t ret_ref = 0;
7846         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
7847         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
7848         return ret_ref;
7849 }
7850
7851 static inline struct LDKDecodeError CResult_ChannelReestablishDecodeErrorZ_get_err(LDKCResult_ChannelReestablishDecodeErrorZ *NONNULL_PTR owner){
7852 CHECK(!owner->result_ok);
7853         return DecodeError_clone(&*owner->contents.err);
7854 }
7855 uint64_t  __attribute__((export_name("TS_CResult_ChannelReestablishDecodeErrorZ_get_err"))) TS_CResult_ChannelReestablishDecodeErrorZ_get_err(uint64_t owner) {
7856         LDKCResult_ChannelReestablishDecodeErrorZ* owner_conv = (LDKCResult_ChannelReestablishDecodeErrorZ*)untag_ptr(owner);
7857         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
7858         *ret_copy = CResult_ChannelReestablishDecodeErrorZ_get_err(owner_conv);
7859         uint64_t ret_ref = tag_ptr(ret_copy, true);
7860         return ret_ref;
7861 }
7862
7863 static inline struct LDKClosingSigned CResult_ClosingSignedDecodeErrorZ_get_ok(LDKCResult_ClosingSignedDecodeErrorZ *NONNULL_PTR owner){
7864         LDKClosingSigned ret = *owner->contents.result;
7865         ret.is_owned = false;
7866         return ret;
7867 }
7868 uint64_t  __attribute__((export_name("TS_CResult_ClosingSignedDecodeErrorZ_get_ok"))) TS_CResult_ClosingSignedDecodeErrorZ_get_ok(uint64_t owner) {
7869         LDKCResult_ClosingSignedDecodeErrorZ* owner_conv = (LDKCResult_ClosingSignedDecodeErrorZ*)untag_ptr(owner);
7870         LDKClosingSigned ret_var = CResult_ClosingSignedDecodeErrorZ_get_ok(owner_conv);
7871         uint64_t ret_ref = 0;
7872         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
7873         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
7874         return ret_ref;
7875 }
7876
7877 static inline struct LDKDecodeError CResult_ClosingSignedDecodeErrorZ_get_err(LDKCResult_ClosingSignedDecodeErrorZ *NONNULL_PTR owner){
7878 CHECK(!owner->result_ok);
7879         return DecodeError_clone(&*owner->contents.err);
7880 }
7881 uint64_t  __attribute__((export_name("TS_CResult_ClosingSignedDecodeErrorZ_get_err"))) TS_CResult_ClosingSignedDecodeErrorZ_get_err(uint64_t owner) {
7882         LDKCResult_ClosingSignedDecodeErrorZ* owner_conv = (LDKCResult_ClosingSignedDecodeErrorZ*)untag_ptr(owner);
7883         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
7884         *ret_copy = CResult_ClosingSignedDecodeErrorZ_get_err(owner_conv);
7885         uint64_t ret_ref = tag_ptr(ret_copy, true);
7886         return ret_ref;
7887 }
7888
7889 static inline struct LDKClosingSignedFeeRange CResult_ClosingSignedFeeRangeDecodeErrorZ_get_ok(LDKCResult_ClosingSignedFeeRangeDecodeErrorZ *NONNULL_PTR owner){
7890         LDKClosingSignedFeeRange ret = *owner->contents.result;
7891         ret.is_owned = false;
7892         return ret;
7893 }
7894 uint64_t  __attribute__((export_name("TS_CResult_ClosingSignedFeeRangeDecodeErrorZ_get_ok"))) TS_CResult_ClosingSignedFeeRangeDecodeErrorZ_get_ok(uint64_t owner) {
7895         LDKCResult_ClosingSignedFeeRangeDecodeErrorZ* owner_conv = (LDKCResult_ClosingSignedFeeRangeDecodeErrorZ*)untag_ptr(owner);
7896         LDKClosingSignedFeeRange ret_var = CResult_ClosingSignedFeeRangeDecodeErrorZ_get_ok(owner_conv);
7897         uint64_t ret_ref = 0;
7898         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
7899         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
7900         return ret_ref;
7901 }
7902
7903 static inline struct LDKDecodeError CResult_ClosingSignedFeeRangeDecodeErrorZ_get_err(LDKCResult_ClosingSignedFeeRangeDecodeErrorZ *NONNULL_PTR owner){
7904 CHECK(!owner->result_ok);
7905         return DecodeError_clone(&*owner->contents.err);
7906 }
7907 uint64_t  __attribute__((export_name("TS_CResult_ClosingSignedFeeRangeDecodeErrorZ_get_err"))) TS_CResult_ClosingSignedFeeRangeDecodeErrorZ_get_err(uint64_t owner) {
7908         LDKCResult_ClosingSignedFeeRangeDecodeErrorZ* owner_conv = (LDKCResult_ClosingSignedFeeRangeDecodeErrorZ*)untag_ptr(owner);
7909         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
7910         *ret_copy = CResult_ClosingSignedFeeRangeDecodeErrorZ_get_err(owner_conv);
7911         uint64_t ret_ref = tag_ptr(ret_copy, true);
7912         return ret_ref;
7913 }
7914
7915 static inline struct LDKCommitmentSigned CResult_CommitmentSignedDecodeErrorZ_get_ok(LDKCResult_CommitmentSignedDecodeErrorZ *NONNULL_PTR owner){
7916         LDKCommitmentSigned ret = *owner->contents.result;
7917         ret.is_owned = false;
7918         return ret;
7919 }
7920 uint64_t  __attribute__((export_name("TS_CResult_CommitmentSignedDecodeErrorZ_get_ok"))) TS_CResult_CommitmentSignedDecodeErrorZ_get_ok(uint64_t owner) {
7921         LDKCResult_CommitmentSignedDecodeErrorZ* owner_conv = (LDKCResult_CommitmentSignedDecodeErrorZ*)untag_ptr(owner);
7922         LDKCommitmentSigned ret_var = CResult_CommitmentSignedDecodeErrorZ_get_ok(owner_conv);
7923         uint64_t ret_ref = 0;
7924         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
7925         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
7926         return ret_ref;
7927 }
7928
7929 static inline struct LDKDecodeError CResult_CommitmentSignedDecodeErrorZ_get_err(LDKCResult_CommitmentSignedDecodeErrorZ *NONNULL_PTR owner){
7930 CHECK(!owner->result_ok);
7931         return DecodeError_clone(&*owner->contents.err);
7932 }
7933 uint64_t  __attribute__((export_name("TS_CResult_CommitmentSignedDecodeErrorZ_get_err"))) TS_CResult_CommitmentSignedDecodeErrorZ_get_err(uint64_t owner) {
7934         LDKCResult_CommitmentSignedDecodeErrorZ* owner_conv = (LDKCResult_CommitmentSignedDecodeErrorZ*)untag_ptr(owner);
7935         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
7936         *ret_copy = CResult_CommitmentSignedDecodeErrorZ_get_err(owner_conv);
7937         uint64_t ret_ref = tag_ptr(ret_copy, true);
7938         return ret_ref;
7939 }
7940
7941 static inline struct LDKFundingCreated CResult_FundingCreatedDecodeErrorZ_get_ok(LDKCResult_FundingCreatedDecodeErrorZ *NONNULL_PTR owner){
7942         LDKFundingCreated ret = *owner->contents.result;
7943         ret.is_owned = false;
7944         return ret;
7945 }
7946 uint64_t  __attribute__((export_name("TS_CResult_FundingCreatedDecodeErrorZ_get_ok"))) TS_CResult_FundingCreatedDecodeErrorZ_get_ok(uint64_t owner) {
7947         LDKCResult_FundingCreatedDecodeErrorZ* owner_conv = (LDKCResult_FundingCreatedDecodeErrorZ*)untag_ptr(owner);
7948         LDKFundingCreated ret_var = CResult_FundingCreatedDecodeErrorZ_get_ok(owner_conv);
7949         uint64_t ret_ref = 0;
7950         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
7951         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
7952         return ret_ref;
7953 }
7954
7955 static inline struct LDKDecodeError CResult_FundingCreatedDecodeErrorZ_get_err(LDKCResult_FundingCreatedDecodeErrorZ *NONNULL_PTR owner){
7956 CHECK(!owner->result_ok);
7957         return DecodeError_clone(&*owner->contents.err);
7958 }
7959 uint64_t  __attribute__((export_name("TS_CResult_FundingCreatedDecodeErrorZ_get_err"))) TS_CResult_FundingCreatedDecodeErrorZ_get_err(uint64_t owner) {
7960         LDKCResult_FundingCreatedDecodeErrorZ* owner_conv = (LDKCResult_FundingCreatedDecodeErrorZ*)untag_ptr(owner);
7961         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
7962         *ret_copy = CResult_FundingCreatedDecodeErrorZ_get_err(owner_conv);
7963         uint64_t ret_ref = tag_ptr(ret_copy, true);
7964         return ret_ref;
7965 }
7966
7967 static inline struct LDKFundingSigned CResult_FundingSignedDecodeErrorZ_get_ok(LDKCResult_FundingSignedDecodeErrorZ *NONNULL_PTR owner){
7968         LDKFundingSigned ret = *owner->contents.result;
7969         ret.is_owned = false;
7970         return ret;
7971 }
7972 uint64_t  __attribute__((export_name("TS_CResult_FundingSignedDecodeErrorZ_get_ok"))) TS_CResult_FundingSignedDecodeErrorZ_get_ok(uint64_t owner) {
7973         LDKCResult_FundingSignedDecodeErrorZ* owner_conv = (LDKCResult_FundingSignedDecodeErrorZ*)untag_ptr(owner);
7974         LDKFundingSigned ret_var = CResult_FundingSignedDecodeErrorZ_get_ok(owner_conv);
7975         uint64_t ret_ref = 0;
7976         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
7977         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
7978         return ret_ref;
7979 }
7980
7981 static inline struct LDKDecodeError CResult_FundingSignedDecodeErrorZ_get_err(LDKCResult_FundingSignedDecodeErrorZ *NONNULL_PTR owner){
7982 CHECK(!owner->result_ok);
7983         return DecodeError_clone(&*owner->contents.err);
7984 }
7985 uint64_t  __attribute__((export_name("TS_CResult_FundingSignedDecodeErrorZ_get_err"))) TS_CResult_FundingSignedDecodeErrorZ_get_err(uint64_t owner) {
7986         LDKCResult_FundingSignedDecodeErrorZ* owner_conv = (LDKCResult_FundingSignedDecodeErrorZ*)untag_ptr(owner);
7987         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
7988         *ret_copy = CResult_FundingSignedDecodeErrorZ_get_err(owner_conv);
7989         uint64_t ret_ref = tag_ptr(ret_copy, true);
7990         return ret_ref;
7991 }
7992
7993 static inline struct LDKChannelReady CResult_ChannelReadyDecodeErrorZ_get_ok(LDKCResult_ChannelReadyDecodeErrorZ *NONNULL_PTR owner){
7994         LDKChannelReady ret = *owner->contents.result;
7995         ret.is_owned = false;
7996         return ret;
7997 }
7998 uint64_t  __attribute__((export_name("TS_CResult_ChannelReadyDecodeErrorZ_get_ok"))) TS_CResult_ChannelReadyDecodeErrorZ_get_ok(uint64_t owner) {
7999         LDKCResult_ChannelReadyDecodeErrorZ* owner_conv = (LDKCResult_ChannelReadyDecodeErrorZ*)untag_ptr(owner);
8000         LDKChannelReady ret_var = CResult_ChannelReadyDecodeErrorZ_get_ok(owner_conv);
8001         uint64_t ret_ref = 0;
8002         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
8003         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
8004         return ret_ref;
8005 }
8006
8007 static inline struct LDKDecodeError CResult_ChannelReadyDecodeErrorZ_get_err(LDKCResult_ChannelReadyDecodeErrorZ *NONNULL_PTR owner){
8008 CHECK(!owner->result_ok);
8009         return DecodeError_clone(&*owner->contents.err);
8010 }
8011 uint64_t  __attribute__((export_name("TS_CResult_ChannelReadyDecodeErrorZ_get_err"))) TS_CResult_ChannelReadyDecodeErrorZ_get_err(uint64_t owner) {
8012         LDKCResult_ChannelReadyDecodeErrorZ* owner_conv = (LDKCResult_ChannelReadyDecodeErrorZ*)untag_ptr(owner);
8013         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
8014         *ret_copy = CResult_ChannelReadyDecodeErrorZ_get_err(owner_conv);
8015         uint64_t ret_ref = tag_ptr(ret_copy, true);
8016         return ret_ref;
8017 }
8018
8019 static inline struct LDKInit CResult_InitDecodeErrorZ_get_ok(LDKCResult_InitDecodeErrorZ *NONNULL_PTR owner){
8020         LDKInit ret = *owner->contents.result;
8021         ret.is_owned = false;
8022         return ret;
8023 }
8024 uint64_t  __attribute__((export_name("TS_CResult_InitDecodeErrorZ_get_ok"))) TS_CResult_InitDecodeErrorZ_get_ok(uint64_t owner) {
8025         LDKCResult_InitDecodeErrorZ* owner_conv = (LDKCResult_InitDecodeErrorZ*)untag_ptr(owner);
8026         LDKInit ret_var = CResult_InitDecodeErrorZ_get_ok(owner_conv);
8027         uint64_t ret_ref = 0;
8028         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
8029         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
8030         return ret_ref;
8031 }
8032
8033 static inline struct LDKDecodeError CResult_InitDecodeErrorZ_get_err(LDKCResult_InitDecodeErrorZ *NONNULL_PTR owner){
8034 CHECK(!owner->result_ok);
8035         return DecodeError_clone(&*owner->contents.err);
8036 }
8037 uint64_t  __attribute__((export_name("TS_CResult_InitDecodeErrorZ_get_err"))) TS_CResult_InitDecodeErrorZ_get_err(uint64_t owner) {
8038         LDKCResult_InitDecodeErrorZ* owner_conv = (LDKCResult_InitDecodeErrorZ*)untag_ptr(owner);
8039         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
8040         *ret_copy = CResult_InitDecodeErrorZ_get_err(owner_conv);
8041         uint64_t ret_ref = tag_ptr(ret_copy, true);
8042         return ret_ref;
8043 }
8044
8045 static inline struct LDKOpenChannel CResult_OpenChannelDecodeErrorZ_get_ok(LDKCResult_OpenChannelDecodeErrorZ *NONNULL_PTR owner){
8046         LDKOpenChannel ret = *owner->contents.result;
8047         ret.is_owned = false;
8048         return ret;
8049 }
8050 uint64_t  __attribute__((export_name("TS_CResult_OpenChannelDecodeErrorZ_get_ok"))) TS_CResult_OpenChannelDecodeErrorZ_get_ok(uint64_t owner) {
8051         LDKCResult_OpenChannelDecodeErrorZ* owner_conv = (LDKCResult_OpenChannelDecodeErrorZ*)untag_ptr(owner);
8052         LDKOpenChannel ret_var = CResult_OpenChannelDecodeErrorZ_get_ok(owner_conv);
8053         uint64_t ret_ref = 0;
8054         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
8055         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
8056         return ret_ref;
8057 }
8058
8059 static inline struct LDKDecodeError CResult_OpenChannelDecodeErrorZ_get_err(LDKCResult_OpenChannelDecodeErrorZ *NONNULL_PTR owner){
8060 CHECK(!owner->result_ok);
8061         return DecodeError_clone(&*owner->contents.err);
8062 }
8063 uint64_t  __attribute__((export_name("TS_CResult_OpenChannelDecodeErrorZ_get_err"))) TS_CResult_OpenChannelDecodeErrorZ_get_err(uint64_t owner) {
8064         LDKCResult_OpenChannelDecodeErrorZ* owner_conv = (LDKCResult_OpenChannelDecodeErrorZ*)untag_ptr(owner);
8065         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
8066         *ret_copy = CResult_OpenChannelDecodeErrorZ_get_err(owner_conv);
8067         uint64_t ret_ref = tag_ptr(ret_copy, true);
8068         return ret_ref;
8069 }
8070
8071 static inline struct LDKOpenChannelV2 CResult_OpenChannelV2DecodeErrorZ_get_ok(LDKCResult_OpenChannelV2DecodeErrorZ *NONNULL_PTR owner){
8072         LDKOpenChannelV2 ret = *owner->contents.result;
8073         ret.is_owned = false;
8074         return ret;
8075 }
8076 uint64_t  __attribute__((export_name("TS_CResult_OpenChannelV2DecodeErrorZ_get_ok"))) TS_CResult_OpenChannelV2DecodeErrorZ_get_ok(uint64_t owner) {
8077         LDKCResult_OpenChannelV2DecodeErrorZ* owner_conv = (LDKCResult_OpenChannelV2DecodeErrorZ*)untag_ptr(owner);
8078         LDKOpenChannelV2 ret_var = CResult_OpenChannelV2DecodeErrorZ_get_ok(owner_conv);
8079         uint64_t ret_ref = 0;
8080         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
8081         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
8082         return ret_ref;
8083 }
8084
8085 static inline struct LDKDecodeError CResult_OpenChannelV2DecodeErrorZ_get_err(LDKCResult_OpenChannelV2DecodeErrorZ *NONNULL_PTR owner){
8086 CHECK(!owner->result_ok);
8087         return DecodeError_clone(&*owner->contents.err);
8088 }
8089 uint64_t  __attribute__((export_name("TS_CResult_OpenChannelV2DecodeErrorZ_get_err"))) TS_CResult_OpenChannelV2DecodeErrorZ_get_err(uint64_t owner) {
8090         LDKCResult_OpenChannelV2DecodeErrorZ* owner_conv = (LDKCResult_OpenChannelV2DecodeErrorZ*)untag_ptr(owner);
8091         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
8092         *ret_copy = CResult_OpenChannelV2DecodeErrorZ_get_err(owner_conv);
8093         uint64_t ret_ref = tag_ptr(ret_copy, true);
8094         return ret_ref;
8095 }
8096
8097 static inline struct LDKRevokeAndACK CResult_RevokeAndACKDecodeErrorZ_get_ok(LDKCResult_RevokeAndACKDecodeErrorZ *NONNULL_PTR owner){
8098         LDKRevokeAndACK ret = *owner->contents.result;
8099         ret.is_owned = false;
8100         return ret;
8101 }
8102 uint64_t  __attribute__((export_name("TS_CResult_RevokeAndACKDecodeErrorZ_get_ok"))) TS_CResult_RevokeAndACKDecodeErrorZ_get_ok(uint64_t owner) {
8103         LDKCResult_RevokeAndACKDecodeErrorZ* owner_conv = (LDKCResult_RevokeAndACKDecodeErrorZ*)untag_ptr(owner);
8104         LDKRevokeAndACK ret_var = CResult_RevokeAndACKDecodeErrorZ_get_ok(owner_conv);
8105         uint64_t ret_ref = 0;
8106         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
8107         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
8108         return ret_ref;
8109 }
8110
8111 static inline struct LDKDecodeError CResult_RevokeAndACKDecodeErrorZ_get_err(LDKCResult_RevokeAndACKDecodeErrorZ *NONNULL_PTR owner){
8112 CHECK(!owner->result_ok);
8113         return DecodeError_clone(&*owner->contents.err);
8114 }
8115 uint64_t  __attribute__((export_name("TS_CResult_RevokeAndACKDecodeErrorZ_get_err"))) TS_CResult_RevokeAndACKDecodeErrorZ_get_err(uint64_t owner) {
8116         LDKCResult_RevokeAndACKDecodeErrorZ* owner_conv = (LDKCResult_RevokeAndACKDecodeErrorZ*)untag_ptr(owner);
8117         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
8118         *ret_copy = CResult_RevokeAndACKDecodeErrorZ_get_err(owner_conv);
8119         uint64_t ret_ref = tag_ptr(ret_copy, true);
8120         return ret_ref;
8121 }
8122
8123 static inline struct LDKShutdown CResult_ShutdownDecodeErrorZ_get_ok(LDKCResult_ShutdownDecodeErrorZ *NONNULL_PTR owner){
8124         LDKShutdown ret = *owner->contents.result;
8125         ret.is_owned = false;
8126         return ret;
8127 }
8128 uint64_t  __attribute__((export_name("TS_CResult_ShutdownDecodeErrorZ_get_ok"))) TS_CResult_ShutdownDecodeErrorZ_get_ok(uint64_t owner) {
8129         LDKCResult_ShutdownDecodeErrorZ* owner_conv = (LDKCResult_ShutdownDecodeErrorZ*)untag_ptr(owner);
8130         LDKShutdown ret_var = CResult_ShutdownDecodeErrorZ_get_ok(owner_conv);
8131         uint64_t ret_ref = 0;
8132         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
8133         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
8134         return ret_ref;
8135 }
8136
8137 static inline struct LDKDecodeError CResult_ShutdownDecodeErrorZ_get_err(LDKCResult_ShutdownDecodeErrorZ *NONNULL_PTR owner){
8138 CHECK(!owner->result_ok);
8139         return DecodeError_clone(&*owner->contents.err);
8140 }
8141 uint64_t  __attribute__((export_name("TS_CResult_ShutdownDecodeErrorZ_get_err"))) TS_CResult_ShutdownDecodeErrorZ_get_err(uint64_t owner) {
8142         LDKCResult_ShutdownDecodeErrorZ* owner_conv = (LDKCResult_ShutdownDecodeErrorZ*)untag_ptr(owner);
8143         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
8144         *ret_copy = CResult_ShutdownDecodeErrorZ_get_err(owner_conv);
8145         uint64_t ret_ref = tag_ptr(ret_copy, true);
8146         return ret_ref;
8147 }
8148
8149 static inline struct LDKUpdateFailHTLC CResult_UpdateFailHTLCDecodeErrorZ_get_ok(LDKCResult_UpdateFailHTLCDecodeErrorZ *NONNULL_PTR owner){
8150         LDKUpdateFailHTLC ret = *owner->contents.result;
8151         ret.is_owned = false;
8152         return ret;
8153 }
8154 uint64_t  __attribute__((export_name("TS_CResult_UpdateFailHTLCDecodeErrorZ_get_ok"))) TS_CResult_UpdateFailHTLCDecodeErrorZ_get_ok(uint64_t owner) {
8155         LDKCResult_UpdateFailHTLCDecodeErrorZ* owner_conv = (LDKCResult_UpdateFailHTLCDecodeErrorZ*)untag_ptr(owner);
8156         LDKUpdateFailHTLC ret_var = CResult_UpdateFailHTLCDecodeErrorZ_get_ok(owner_conv);
8157         uint64_t ret_ref = 0;
8158         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
8159         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
8160         return ret_ref;
8161 }
8162
8163 static inline struct LDKDecodeError CResult_UpdateFailHTLCDecodeErrorZ_get_err(LDKCResult_UpdateFailHTLCDecodeErrorZ *NONNULL_PTR owner){
8164 CHECK(!owner->result_ok);
8165         return DecodeError_clone(&*owner->contents.err);
8166 }
8167 uint64_t  __attribute__((export_name("TS_CResult_UpdateFailHTLCDecodeErrorZ_get_err"))) TS_CResult_UpdateFailHTLCDecodeErrorZ_get_err(uint64_t owner) {
8168         LDKCResult_UpdateFailHTLCDecodeErrorZ* owner_conv = (LDKCResult_UpdateFailHTLCDecodeErrorZ*)untag_ptr(owner);
8169         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
8170         *ret_copy = CResult_UpdateFailHTLCDecodeErrorZ_get_err(owner_conv);
8171         uint64_t ret_ref = tag_ptr(ret_copy, true);
8172         return ret_ref;
8173 }
8174
8175 static inline struct LDKUpdateFailMalformedHTLC CResult_UpdateFailMalformedHTLCDecodeErrorZ_get_ok(LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ *NONNULL_PTR owner){
8176         LDKUpdateFailMalformedHTLC ret = *owner->contents.result;
8177         ret.is_owned = false;
8178         return ret;
8179 }
8180 uint64_t  __attribute__((export_name("TS_CResult_UpdateFailMalformedHTLCDecodeErrorZ_get_ok"))) TS_CResult_UpdateFailMalformedHTLCDecodeErrorZ_get_ok(uint64_t owner) {
8181         LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ* owner_conv = (LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ*)untag_ptr(owner);
8182         LDKUpdateFailMalformedHTLC ret_var = CResult_UpdateFailMalformedHTLCDecodeErrorZ_get_ok(owner_conv);
8183         uint64_t ret_ref = 0;
8184         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
8185         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
8186         return ret_ref;
8187 }
8188
8189 static inline struct LDKDecodeError CResult_UpdateFailMalformedHTLCDecodeErrorZ_get_err(LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ *NONNULL_PTR owner){
8190 CHECK(!owner->result_ok);
8191         return DecodeError_clone(&*owner->contents.err);
8192 }
8193 uint64_t  __attribute__((export_name("TS_CResult_UpdateFailMalformedHTLCDecodeErrorZ_get_err"))) TS_CResult_UpdateFailMalformedHTLCDecodeErrorZ_get_err(uint64_t owner) {
8194         LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ* owner_conv = (LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ*)untag_ptr(owner);
8195         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
8196         *ret_copy = CResult_UpdateFailMalformedHTLCDecodeErrorZ_get_err(owner_conv);
8197         uint64_t ret_ref = tag_ptr(ret_copy, true);
8198         return ret_ref;
8199 }
8200
8201 static inline struct LDKUpdateFee CResult_UpdateFeeDecodeErrorZ_get_ok(LDKCResult_UpdateFeeDecodeErrorZ *NONNULL_PTR owner){
8202         LDKUpdateFee ret = *owner->contents.result;
8203         ret.is_owned = false;
8204         return ret;
8205 }
8206 uint64_t  __attribute__((export_name("TS_CResult_UpdateFeeDecodeErrorZ_get_ok"))) TS_CResult_UpdateFeeDecodeErrorZ_get_ok(uint64_t owner) {
8207         LDKCResult_UpdateFeeDecodeErrorZ* owner_conv = (LDKCResult_UpdateFeeDecodeErrorZ*)untag_ptr(owner);
8208         LDKUpdateFee ret_var = CResult_UpdateFeeDecodeErrorZ_get_ok(owner_conv);
8209         uint64_t ret_ref = 0;
8210         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
8211         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
8212         return ret_ref;
8213 }
8214
8215 static inline struct LDKDecodeError CResult_UpdateFeeDecodeErrorZ_get_err(LDKCResult_UpdateFeeDecodeErrorZ *NONNULL_PTR owner){
8216 CHECK(!owner->result_ok);
8217         return DecodeError_clone(&*owner->contents.err);
8218 }
8219 uint64_t  __attribute__((export_name("TS_CResult_UpdateFeeDecodeErrorZ_get_err"))) TS_CResult_UpdateFeeDecodeErrorZ_get_err(uint64_t owner) {
8220         LDKCResult_UpdateFeeDecodeErrorZ* owner_conv = (LDKCResult_UpdateFeeDecodeErrorZ*)untag_ptr(owner);
8221         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
8222         *ret_copy = CResult_UpdateFeeDecodeErrorZ_get_err(owner_conv);
8223         uint64_t ret_ref = tag_ptr(ret_copy, true);
8224         return ret_ref;
8225 }
8226
8227 static inline struct LDKUpdateFulfillHTLC CResult_UpdateFulfillHTLCDecodeErrorZ_get_ok(LDKCResult_UpdateFulfillHTLCDecodeErrorZ *NONNULL_PTR owner){
8228         LDKUpdateFulfillHTLC ret = *owner->contents.result;
8229         ret.is_owned = false;
8230         return ret;
8231 }
8232 uint64_t  __attribute__((export_name("TS_CResult_UpdateFulfillHTLCDecodeErrorZ_get_ok"))) TS_CResult_UpdateFulfillHTLCDecodeErrorZ_get_ok(uint64_t owner) {
8233         LDKCResult_UpdateFulfillHTLCDecodeErrorZ* owner_conv = (LDKCResult_UpdateFulfillHTLCDecodeErrorZ*)untag_ptr(owner);
8234         LDKUpdateFulfillHTLC ret_var = CResult_UpdateFulfillHTLCDecodeErrorZ_get_ok(owner_conv);
8235         uint64_t ret_ref = 0;
8236         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
8237         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
8238         return ret_ref;
8239 }
8240
8241 static inline struct LDKDecodeError CResult_UpdateFulfillHTLCDecodeErrorZ_get_err(LDKCResult_UpdateFulfillHTLCDecodeErrorZ *NONNULL_PTR owner){
8242 CHECK(!owner->result_ok);
8243         return DecodeError_clone(&*owner->contents.err);
8244 }
8245 uint64_t  __attribute__((export_name("TS_CResult_UpdateFulfillHTLCDecodeErrorZ_get_err"))) TS_CResult_UpdateFulfillHTLCDecodeErrorZ_get_err(uint64_t owner) {
8246         LDKCResult_UpdateFulfillHTLCDecodeErrorZ* owner_conv = (LDKCResult_UpdateFulfillHTLCDecodeErrorZ*)untag_ptr(owner);
8247         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
8248         *ret_copy = CResult_UpdateFulfillHTLCDecodeErrorZ_get_err(owner_conv);
8249         uint64_t ret_ref = tag_ptr(ret_copy, true);
8250         return ret_ref;
8251 }
8252
8253 static inline struct LDKUpdateAddHTLC CResult_UpdateAddHTLCDecodeErrorZ_get_ok(LDKCResult_UpdateAddHTLCDecodeErrorZ *NONNULL_PTR owner){
8254         LDKUpdateAddHTLC ret = *owner->contents.result;
8255         ret.is_owned = false;
8256         return ret;
8257 }
8258 uint64_t  __attribute__((export_name("TS_CResult_UpdateAddHTLCDecodeErrorZ_get_ok"))) TS_CResult_UpdateAddHTLCDecodeErrorZ_get_ok(uint64_t owner) {
8259         LDKCResult_UpdateAddHTLCDecodeErrorZ* owner_conv = (LDKCResult_UpdateAddHTLCDecodeErrorZ*)untag_ptr(owner);
8260         LDKUpdateAddHTLC ret_var = CResult_UpdateAddHTLCDecodeErrorZ_get_ok(owner_conv);
8261         uint64_t ret_ref = 0;
8262         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
8263         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
8264         return ret_ref;
8265 }
8266
8267 static inline struct LDKDecodeError CResult_UpdateAddHTLCDecodeErrorZ_get_err(LDKCResult_UpdateAddHTLCDecodeErrorZ *NONNULL_PTR owner){
8268 CHECK(!owner->result_ok);
8269         return DecodeError_clone(&*owner->contents.err);
8270 }
8271 uint64_t  __attribute__((export_name("TS_CResult_UpdateAddHTLCDecodeErrorZ_get_err"))) TS_CResult_UpdateAddHTLCDecodeErrorZ_get_err(uint64_t owner) {
8272         LDKCResult_UpdateAddHTLCDecodeErrorZ* owner_conv = (LDKCResult_UpdateAddHTLCDecodeErrorZ*)untag_ptr(owner);
8273         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
8274         *ret_copy = CResult_UpdateAddHTLCDecodeErrorZ_get_err(owner_conv);
8275         uint64_t ret_ref = tag_ptr(ret_copy, true);
8276         return ret_ref;
8277 }
8278
8279 static inline struct LDKOnionMessage CResult_OnionMessageDecodeErrorZ_get_ok(LDKCResult_OnionMessageDecodeErrorZ *NONNULL_PTR owner){
8280         LDKOnionMessage ret = *owner->contents.result;
8281         ret.is_owned = false;
8282         return ret;
8283 }
8284 uint64_t  __attribute__((export_name("TS_CResult_OnionMessageDecodeErrorZ_get_ok"))) TS_CResult_OnionMessageDecodeErrorZ_get_ok(uint64_t owner) {
8285         LDKCResult_OnionMessageDecodeErrorZ* owner_conv = (LDKCResult_OnionMessageDecodeErrorZ*)untag_ptr(owner);
8286         LDKOnionMessage ret_var = CResult_OnionMessageDecodeErrorZ_get_ok(owner_conv);
8287         uint64_t ret_ref = 0;
8288         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
8289         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
8290         return ret_ref;
8291 }
8292
8293 static inline struct LDKDecodeError CResult_OnionMessageDecodeErrorZ_get_err(LDKCResult_OnionMessageDecodeErrorZ *NONNULL_PTR owner){
8294 CHECK(!owner->result_ok);
8295         return DecodeError_clone(&*owner->contents.err);
8296 }
8297 uint64_t  __attribute__((export_name("TS_CResult_OnionMessageDecodeErrorZ_get_err"))) TS_CResult_OnionMessageDecodeErrorZ_get_err(uint64_t owner) {
8298         LDKCResult_OnionMessageDecodeErrorZ* owner_conv = (LDKCResult_OnionMessageDecodeErrorZ*)untag_ptr(owner);
8299         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
8300         *ret_copy = CResult_OnionMessageDecodeErrorZ_get_err(owner_conv);
8301         uint64_t ret_ref = tag_ptr(ret_copy, true);
8302         return ret_ref;
8303 }
8304
8305 static inline struct LDKPing CResult_PingDecodeErrorZ_get_ok(LDKCResult_PingDecodeErrorZ *NONNULL_PTR owner){
8306         LDKPing ret = *owner->contents.result;
8307         ret.is_owned = false;
8308         return ret;
8309 }
8310 uint64_t  __attribute__((export_name("TS_CResult_PingDecodeErrorZ_get_ok"))) TS_CResult_PingDecodeErrorZ_get_ok(uint64_t owner) {
8311         LDKCResult_PingDecodeErrorZ* owner_conv = (LDKCResult_PingDecodeErrorZ*)untag_ptr(owner);
8312         LDKPing ret_var = CResult_PingDecodeErrorZ_get_ok(owner_conv);
8313         uint64_t ret_ref = 0;
8314         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
8315         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
8316         return ret_ref;
8317 }
8318
8319 static inline struct LDKDecodeError CResult_PingDecodeErrorZ_get_err(LDKCResult_PingDecodeErrorZ *NONNULL_PTR owner){
8320 CHECK(!owner->result_ok);
8321         return DecodeError_clone(&*owner->contents.err);
8322 }
8323 uint64_t  __attribute__((export_name("TS_CResult_PingDecodeErrorZ_get_err"))) TS_CResult_PingDecodeErrorZ_get_err(uint64_t owner) {
8324         LDKCResult_PingDecodeErrorZ* owner_conv = (LDKCResult_PingDecodeErrorZ*)untag_ptr(owner);
8325         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
8326         *ret_copy = CResult_PingDecodeErrorZ_get_err(owner_conv);
8327         uint64_t ret_ref = tag_ptr(ret_copy, true);
8328         return ret_ref;
8329 }
8330
8331 static inline struct LDKPong CResult_PongDecodeErrorZ_get_ok(LDKCResult_PongDecodeErrorZ *NONNULL_PTR owner){
8332         LDKPong ret = *owner->contents.result;
8333         ret.is_owned = false;
8334         return ret;
8335 }
8336 uint64_t  __attribute__((export_name("TS_CResult_PongDecodeErrorZ_get_ok"))) TS_CResult_PongDecodeErrorZ_get_ok(uint64_t owner) {
8337         LDKCResult_PongDecodeErrorZ* owner_conv = (LDKCResult_PongDecodeErrorZ*)untag_ptr(owner);
8338         LDKPong ret_var = CResult_PongDecodeErrorZ_get_ok(owner_conv);
8339         uint64_t ret_ref = 0;
8340         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
8341         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
8342         return ret_ref;
8343 }
8344
8345 static inline struct LDKDecodeError CResult_PongDecodeErrorZ_get_err(LDKCResult_PongDecodeErrorZ *NONNULL_PTR owner){
8346 CHECK(!owner->result_ok);
8347         return DecodeError_clone(&*owner->contents.err);
8348 }
8349 uint64_t  __attribute__((export_name("TS_CResult_PongDecodeErrorZ_get_err"))) TS_CResult_PongDecodeErrorZ_get_err(uint64_t owner) {
8350         LDKCResult_PongDecodeErrorZ* owner_conv = (LDKCResult_PongDecodeErrorZ*)untag_ptr(owner);
8351         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
8352         *ret_copy = CResult_PongDecodeErrorZ_get_err(owner_conv);
8353         uint64_t ret_ref = tag_ptr(ret_copy, true);
8354         return ret_ref;
8355 }
8356
8357 static inline struct LDKUnsignedChannelAnnouncement CResult_UnsignedChannelAnnouncementDecodeErrorZ_get_ok(LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ *NONNULL_PTR owner){
8358         LDKUnsignedChannelAnnouncement ret = *owner->contents.result;
8359         ret.is_owned = false;
8360         return ret;
8361 }
8362 uint64_t  __attribute__((export_name("TS_CResult_UnsignedChannelAnnouncementDecodeErrorZ_get_ok"))) TS_CResult_UnsignedChannelAnnouncementDecodeErrorZ_get_ok(uint64_t owner) {
8363         LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ* owner_conv = (LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ*)untag_ptr(owner);
8364         LDKUnsignedChannelAnnouncement ret_var = CResult_UnsignedChannelAnnouncementDecodeErrorZ_get_ok(owner_conv);
8365         uint64_t ret_ref = 0;
8366         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
8367         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
8368         return ret_ref;
8369 }
8370
8371 static inline struct LDKDecodeError CResult_UnsignedChannelAnnouncementDecodeErrorZ_get_err(LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ *NONNULL_PTR owner){
8372 CHECK(!owner->result_ok);
8373         return DecodeError_clone(&*owner->contents.err);
8374 }
8375 uint64_t  __attribute__((export_name("TS_CResult_UnsignedChannelAnnouncementDecodeErrorZ_get_err"))) TS_CResult_UnsignedChannelAnnouncementDecodeErrorZ_get_err(uint64_t owner) {
8376         LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ* owner_conv = (LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ*)untag_ptr(owner);
8377         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
8378         *ret_copy = CResult_UnsignedChannelAnnouncementDecodeErrorZ_get_err(owner_conv);
8379         uint64_t ret_ref = tag_ptr(ret_copy, true);
8380         return ret_ref;
8381 }
8382
8383 static inline struct LDKChannelAnnouncement CResult_ChannelAnnouncementDecodeErrorZ_get_ok(LDKCResult_ChannelAnnouncementDecodeErrorZ *NONNULL_PTR owner){
8384         LDKChannelAnnouncement ret = *owner->contents.result;
8385         ret.is_owned = false;
8386         return ret;
8387 }
8388 uint64_t  __attribute__((export_name("TS_CResult_ChannelAnnouncementDecodeErrorZ_get_ok"))) TS_CResult_ChannelAnnouncementDecodeErrorZ_get_ok(uint64_t owner) {
8389         LDKCResult_ChannelAnnouncementDecodeErrorZ* owner_conv = (LDKCResult_ChannelAnnouncementDecodeErrorZ*)untag_ptr(owner);
8390         LDKChannelAnnouncement ret_var = CResult_ChannelAnnouncementDecodeErrorZ_get_ok(owner_conv);
8391         uint64_t ret_ref = 0;
8392         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
8393         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
8394         return ret_ref;
8395 }
8396
8397 static inline struct LDKDecodeError CResult_ChannelAnnouncementDecodeErrorZ_get_err(LDKCResult_ChannelAnnouncementDecodeErrorZ *NONNULL_PTR owner){
8398 CHECK(!owner->result_ok);
8399         return DecodeError_clone(&*owner->contents.err);
8400 }
8401 uint64_t  __attribute__((export_name("TS_CResult_ChannelAnnouncementDecodeErrorZ_get_err"))) TS_CResult_ChannelAnnouncementDecodeErrorZ_get_err(uint64_t owner) {
8402         LDKCResult_ChannelAnnouncementDecodeErrorZ* owner_conv = (LDKCResult_ChannelAnnouncementDecodeErrorZ*)untag_ptr(owner);
8403         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
8404         *ret_copy = CResult_ChannelAnnouncementDecodeErrorZ_get_err(owner_conv);
8405         uint64_t ret_ref = tag_ptr(ret_copy, true);
8406         return ret_ref;
8407 }
8408
8409 static inline struct LDKUnsignedChannelUpdate CResult_UnsignedChannelUpdateDecodeErrorZ_get_ok(LDKCResult_UnsignedChannelUpdateDecodeErrorZ *NONNULL_PTR owner){
8410         LDKUnsignedChannelUpdate ret = *owner->contents.result;
8411         ret.is_owned = false;
8412         return ret;
8413 }
8414 uint64_t  __attribute__((export_name("TS_CResult_UnsignedChannelUpdateDecodeErrorZ_get_ok"))) TS_CResult_UnsignedChannelUpdateDecodeErrorZ_get_ok(uint64_t owner) {
8415         LDKCResult_UnsignedChannelUpdateDecodeErrorZ* owner_conv = (LDKCResult_UnsignedChannelUpdateDecodeErrorZ*)untag_ptr(owner);
8416         LDKUnsignedChannelUpdate ret_var = CResult_UnsignedChannelUpdateDecodeErrorZ_get_ok(owner_conv);
8417         uint64_t ret_ref = 0;
8418         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
8419         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
8420         return ret_ref;
8421 }
8422
8423 static inline struct LDKDecodeError CResult_UnsignedChannelUpdateDecodeErrorZ_get_err(LDKCResult_UnsignedChannelUpdateDecodeErrorZ *NONNULL_PTR owner){
8424 CHECK(!owner->result_ok);
8425         return DecodeError_clone(&*owner->contents.err);
8426 }
8427 uint64_t  __attribute__((export_name("TS_CResult_UnsignedChannelUpdateDecodeErrorZ_get_err"))) TS_CResult_UnsignedChannelUpdateDecodeErrorZ_get_err(uint64_t owner) {
8428         LDKCResult_UnsignedChannelUpdateDecodeErrorZ* owner_conv = (LDKCResult_UnsignedChannelUpdateDecodeErrorZ*)untag_ptr(owner);
8429         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
8430         *ret_copy = CResult_UnsignedChannelUpdateDecodeErrorZ_get_err(owner_conv);
8431         uint64_t ret_ref = tag_ptr(ret_copy, true);
8432         return ret_ref;
8433 }
8434
8435 static inline struct LDKChannelUpdate CResult_ChannelUpdateDecodeErrorZ_get_ok(LDKCResult_ChannelUpdateDecodeErrorZ *NONNULL_PTR owner){
8436         LDKChannelUpdate ret = *owner->contents.result;
8437         ret.is_owned = false;
8438         return ret;
8439 }
8440 uint64_t  __attribute__((export_name("TS_CResult_ChannelUpdateDecodeErrorZ_get_ok"))) TS_CResult_ChannelUpdateDecodeErrorZ_get_ok(uint64_t owner) {
8441         LDKCResult_ChannelUpdateDecodeErrorZ* owner_conv = (LDKCResult_ChannelUpdateDecodeErrorZ*)untag_ptr(owner);
8442         LDKChannelUpdate ret_var = CResult_ChannelUpdateDecodeErrorZ_get_ok(owner_conv);
8443         uint64_t ret_ref = 0;
8444         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
8445         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
8446         return ret_ref;
8447 }
8448
8449 static inline struct LDKDecodeError CResult_ChannelUpdateDecodeErrorZ_get_err(LDKCResult_ChannelUpdateDecodeErrorZ *NONNULL_PTR owner){
8450 CHECK(!owner->result_ok);
8451         return DecodeError_clone(&*owner->contents.err);
8452 }
8453 uint64_t  __attribute__((export_name("TS_CResult_ChannelUpdateDecodeErrorZ_get_err"))) TS_CResult_ChannelUpdateDecodeErrorZ_get_err(uint64_t owner) {
8454         LDKCResult_ChannelUpdateDecodeErrorZ* owner_conv = (LDKCResult_ChannelUpdateDecodeErrorZ*)untag_ptr(owner);
8455         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
8456         *ret_copy = CResult_ChannelUpdateDecodeErrorZ_get_err(owner_conv);
8457         uint64_t ret_ref = tag_ptr(ret_copy, true);
8458         return ret_ref;
8459 }
8460
8461 static inline struct LDKErrorMessage CResult_ErrorMessageDecodeErrorZ_get_ok(LDKCResult_ErrorMessageDecodeErrorZ *NONNULL_PTR owner){
8462         LDKErrorMessage ret = *owner->contents.result;
8463         ret.is_owned = false;
8464         return ret;
8465 }
8466 uint64_t  __attribute__((export_name("TS_CResult_ErrorMessageDecodeErrorZ_get_ok"))) TS_CResult_ErrorMessageDecodeErrorZ_get_ok(uint64_t owner) {
8467         LDKCResult_ErrorMessageDecodeErrorZ* owner_conv = (LDKCResult_ErrorMessageDecodeErrorZ*)untag_ptr(owner);
8468         LDKErrorMessage ret_var = CResult_ErrorMessageDecodeErrorZ_get_ok(owner_conv);
8469         uint64_t ret_ref = 0;
8470         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
8471         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
8472         return ret_ref;
8473 }
8474
8475 static inline struct LDKDecodeError CResult_ErrorMessageDecodeErrorZ_get_err(LDKCResult_ErrorMessageDecodeErrorZ *NONNULL_PTR owner){
8476 CHECK(!owner->result_ok);
8477         return DecodeError_clone(&*owner->contents.err);
8478 }
8479 uint64_t  __attribute__((export_name("TS_CResult_ErrorMessageDecodeErrorZ_get_err"))) TS_CResult_ErrorMessageDecodeErrorZ_get_err(uint64_t owner) {
8480         LDKCResult_ErrorMessageDecodeErrorZ* owner_conv = (LDKCResult_ErrorMessageDecodeErrorZ*)untag_ptr(owner);
8481         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
8482         *ret_copy = CResult_ErrorMessageDecodeErrorZ_get_err(owner_conv);
8483         uint64_t ret_ref = tag_ptr(ret_copy, true);
8484         return ret_ref;
8485 }
8486
8487 static inline struct LDKWarningMessage CResult_WarningMessageDecodeErrorZ_get_ok(LDKCResult_WarningMessageDecodeErrorZ *NONNULL_PTR owner){
8488         LDKWarningMessage ret = *owner->contents.result;
8489         ret.is_owned = false;
8490         return ret;
8491 }
8492 uint64_t  __attribute__((export_name("TS_CResult_WarningMessageDecodeErrorZ_get_ok"))) TS_CResult_WarningMessageDecodeErrorZ_get_ok(uint64_t owner) {
8493         LDKCResult_WarningMessageDecodeErrorZ* owner_conv = (LDKCResult_WarningMessageDecodeErrorZ*)untag_ptr(owner);
8494         LDKWarningMessage ret_var = CResult_WarningMessageDecodeErrorZ_get_ok(owner_conv);
8495         uint64_t ret_ref = 0;
8496         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
8497         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
8498         return ret_ref;
8499 }
8500
8501 static inline struct LDKDecodeError CResult_WarningMessageDecodeErrorZ_get_err(LDKCResult_WarningMessageDecodeErrorZ *NONNULL_PTR owner){
8502 CHECK(!owner->result_ok);
8503         return DecodeError_clone(&*owner->contents.err);
8504 }
8505 uint64_t  __attribute__((export_name("TS_CResult_WarningMessageDecodeErrorZ_get_err"))) TS_CResult_WarningMessageDecodeErrorZ_get_err(uint64_t owner) {
8506         LDKCResult_WarningMessageDecodeErrorZ* owner_conv = (LDKCResult_WarningMessageDecodeErrorZ*)untag_ptr(owner);
8507         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
8508         *ret_copy = CResult_WarningMessageDecodeErrorZ_get_err(owner_conv);
8509         uint64_t ret_ref = tag_ptr(ret_copy, true);
8510         return ret_ref;
8511 }
8512
8513 static inline struct LDKUnsignedNodeAnnouncement CResult_UnsignedNodeAnnouncementDecodeErrorZ_get_ok(LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ *NONNULL_PTR owner){
8514         LDKUnsignedNodeAnnouncement ret = *owner->contents.result;
8515         ret.is_owned = false;
8516         return ret;
8517 }
8518 uint64_t  __attribute__((export_name("TS_CResult_UnsignedNodeAnnouncementDecodeErrorZ_get_ok"))) TS_CResult_UnsignedNodeAnnouncementDecodeErrorZ_get_ok(uint64_t owner) {
8519         LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ* owner_conv = (LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ*)untag_ptr(owner);
8520         LDKUnsignedNodeAnnouncement ret_var = CResult_UnsignedNodeAnnouncementDecodeErrorZ_get_ok(owner_conv);
8521         uint64_t ret_ref = 0;
8522         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
8523         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
8524         return ret_ref;
8525 }
8526
8527 static inline struct LDKDecodeError CResult_UnsignedNodeAnnouncementDecodeErrorZ_get_err(LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ *NONNULL_PTR owner){
8528 CHECK(!owner->result_ok);
8529         return DecodeError_clone(&*owner->contents.err);
8530 }
8531 uint64_t  __attribute__((export_name("TS_CResult_UnsignedNodeAnnouncementDecodeErrorZ_get_err"))) TS_CResult_UnsignedNodeAnnouncementDecodeErrorZ_get_err(uint64_t owner) {
8532         LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ* owner_conv = (LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ*)untag_ptr(owner);
8533         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
8534         *ret_copy = CResult_UnsignedNodeAnnouncementDecodeErrorZ_get_err(owner_conv);
8535         uint64_t ret_ref = tag_ptr(ret_copy, true);
8536         return ret_ref;
8537 }
8538
8539 static inline struct LDKNodeAnnouncement CResult_NodeAnnouncementDecodeErrorZ_get_ok(LDKCResult_NodeAnnouncementDecodeErrorZ *NONNULL_PTR owner){
8540         LDKNodeAnnouncement ret = *owner->contents.result;
8541         ret.is_owned = false;
8542         return ret;
8543 }
8544 uint64_t  __attribute__((export_name("TS_CResult_NodeAnnouncementDecodeErrorZ_get_ok"))) TS_CResult_NodeAnnouncementDecodeErrorZ_get_ok(uint64_t owner) {
8545         LDKCResult_NodeAnnouncementDecodeErrorZ* owner_conv = (LDKCResult_NodeAnnouncementDecodeErrorZ*)untag_ptr(owner);
8546         LDKNodeAnnouncement ret_var = CResult_NodeAnnouncementDecodeErrorZ_get_ok(owner_conv);
8547         uint64_t ret_ref = 0;
8548         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
8549         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
8550         return ret_ref;
8551 }
8552
8553 static inline struct LDKDecodeError CResult_NodeAnnouncementDecodeErrorZ_get_err(LDKCResult_NodeAnnouncementDecodeErrorZ *NONNULL_PTR owner){
8554 CHECK(!owner->result_ok);
8555         return DecodeError_clone(&*owner->contents.err);
8556 }
8557 uint64_t  __attribute__((export_name("TS_CResult_NodeAnnouncementDecodeErrorZ_get_err"))) TS_CResult_NodeAnnouncementDecodeErrorZ_get_err(uint64_t owner) {
8558         LDKCResult_NodeAnnouncementDecodeErrorZ* owner_conv = (LDKCResult_NodeAnnouncementDecodeErrorZ*)untag_ptr(owner);
8559         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
8560         *ret_copy = CResult_NodeAnnouncementDecodeErrorZ_get_err(owner_conv);
8561         uint64_t ret_ref = tag_ptr(ret_copy, true);
8562         return ret_ref;
8563 }
8564
8565 static inline struct LDKQueryShortChannelIds CResult_QueryShortChannelIdsDecodeErrorZ_get_ok(LDKCResult_QueryShortChannelIdsDecodeErrorZ *NONNULL_PTR owner){
8566         LDKQueryShortChannelIds ret = *owner->contents.result;
8567         ret.is_owned = false;
8568         return ret;
8569 }
8570 uint64_t  __attribute__((export_name("TS_CResult_QueryShortChannelIdsDecodeErrorZ_get_ok"))) TS_CResult_QueryShortChannelIdsDecodeErrorZ_get_ok(uint64_t owner) {
8571         LDKCResult_QueryShortChannelIdsDecodeErrorZ* owner_conv = (LDKCResult_QueryShortChannelIdsDecodeErrorZ*)untag_ptr(owner);
8572         LDKQueryShortChannelIds ret_var = CResult_QueryShortChannelIdsDecodeErrorZ_get_ok(owner_conv);
8573         uint64_t ret_ref = 0;
8574         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
8575         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
8576         return ret_ref;
8577 }
8578
8579 static inline struct LDKDecodeError CResult_QueryShortChannelIdsDecodeErrorZ_get_err(LDKCResult_QueryShortChannelIdsDecodeErrorZ *NONNULL_PTR owner){
8580 CHECK(!owner->result_ok);
8581         return DecodeError_clone(&*owner->contents.err);
8582 }
8583 uint64_t  __attribute__((export_name("TS_CResult_QueryShortChannelIdsDecodeErrorZ_get_err"))) TS_CResult_QueryShortChannelIdsDecodeErrorZ_get_err(uint64_t owner) {
8584         LDKCResult_QueryShortChannelIdsDecodeErrorZ* owner_conv = (LDKCResult_QueryShortChannelIdsDecodeErrorZ*)untag_ptr(owner);
8585         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
8586         *ret_copy = CResult_QueryShortChannelIdsDecodeErrorZ_get_err(owner_conv);
8587         uint64_t ret_ref = tag_ptr(ret_copy, true);
8588         return ret_ref;
8589 }
8590
8591 static inline struct LDKReplyShortChannelIdsEnd CResult_ReplyShortChannelIdsEndDecodeErrorZ_get_ok(LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ *NONNULL_PTR owner){
8592         LDKReplyShortChannelIdsEnd ret = *owner->contents.result;
8593         ret.is_owned = false;
8594         return ret;
8595 }
8596 uint64_t  __attribute__((export_name("TS_CResult_ReplyShortChannelIdsEndDecodeErrorZ_get_ok"))) TS_CResult_ReplyShortChannelIdsEndDecodeErrorZ_get_ok(uint64_t owner) {
8597         LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ* owner_conv = (LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ*)untag_ptr(owner);
8598         LDKReplyShortChannelIdsEnd ret_var = CResult_ReplyShortChannelIdsEndDecodeErrorZ_get_ok(owner_conv);
8599         uint64_t ret_ref = 0;
8600         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
8601         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
8602         return ret_ref;
8603 }
8604
8605 static inline struct LDKDecodeError CResult_ReplyShortChannelIdsEndDecodeErrorZ_get_err(LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ *NONNULL_PTR owner){
8606 CHECK(!owner->result_ok);
8607         return DecodeError_clone(&*owner->contents.err);
8608 }
8609 uint64_t  __attribute__((export_name("TS_CResult_ReplyShortChannelIdsEndDecodeErrorZ_get_err"))) TS_CResult_ReplyShortChannelIdsEndDecodeErrorZ_get_err(uint64_t owner) {
8610         LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ* owner_conv = (LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ*)untag_ptr(owner);
8611         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
8612         *ret_copy = CResult_ReplyShortChannelIdsEndDecodeErrorZ_get_err(owner_conv);
8613         uint64_t ret_ref = tag_ptr(ret_copy, true);
8614         return ret_ref;
8615 }
8616
8617 static inline struct LDKQueryChannelRange CResult_QueryChannelRangeDecodeErrorZ_get_ok(LDKCResult_QueryChannelRangeDecodeErrorZ *NONNULL_PTR owner){
8618         LDKQueryChannelRange ret = *owner->contents.result;
8619         ret.is_owned = false;
8620         return ret;
8621 }
8622 uint64_t  __attribute__((export_name("TS_CResult_QueryChannelRangeDecodeErrorZ_get_ok"))) TS_CResult_QueryChannelRangeDecodeErrorZ_get_ok(uint64_t owner) {
8623         LDKCResult_QueryChannelRangeDecodeErrorZ* owner_conv = (LDKCResult_QueryChannelRangeDecodeErrorZ*)untag_ptr(owner);
8624         LDKQueryChannelRange ret_var = CResult_QueryChannelRangeDecodeErrorZ_get_ok(owner_conv);
8625         uint64_t ret_ref = 0;
8626         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
8627         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
8628         return ret_ref;
8629 }
8630
8631 static inline struct LDKDecodeError CResult_QueryChannelRangeDecodeErrorZ_get_err(LDKCResult_QueryChannelRangeDecodeErrorZ *NONNULL_PTR owner){
8632 CHECK(!owner->result_ok);
8633         return DecodeError_clone(&*owner->contents.err);
8634 }
8635 uint64_t  __attribute__((export_name("TS_CResult_QueryChannelRangeDecodeErrorZ_get_err"))) TS_CResult_QueryChannelRangeDecodeErrorZ_get_err(uint64_t owner) {
8636         LDKCResult_QueryChannelRangeDecodeErrorZ* owner_conv = (LDKCResult_QueryChannelRangeDecodeErrorZ*)untag_ptr(owner);
8637         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
8638         *ret_copy = CResult_QueryChannelRangeDecodeErrorZ_get_err(owner_conv);
8639         uint64_t ret_ref = tag_ptr(ret_copy, true);
8640         return ret_ref;
8641 }
8642
8643 static inline struct LDKReplyChannelRange CResult_ReplyChannelRangeDecodeErrorZ_get_ok(LDKCResult_ReplyChannelRangeDecodeErrorZ *NONNULL_PTR owner){
8644         LDKReplyChannelRange ret = *owner->contents.result;
8645         ret.is_owned = false;
8646         return ret;
8647 }
8648 uint64_t  __attribute__((export_name("TS_CResult_ReplyChannelRangeDecodeErrorZ_get_ok"))) TS_CResult_ReplyChannelRangeDecodeErrorZ_get_ok(uint64_t owner) {
8649         LDKCResult_ReplyChannelRangeDecodeErrorZ* owner_conv = (LDKCResult_ReplyChannelRangeDecodeErrorZ*)untag_ptr(owner);
8650         LDKReplyChannelRange ret_var = CResult_ReplyChannelRangeDecodeErrorZ_get_ok(owner_conv);
8651         uint64_t ret_ref = 0;
8652         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
8653         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
8654         return ret_ref;
8655 }
8656
8657 static inline struct LDKDecodeError CResult_ReplyChannelRangeDecodeErrorZ_get_err(LDKCResult_ReplyChannelRangeDecodeErrorZ *NONNULL_PTR owner){
8658 CHECK(!owner->result_ok);
8659         return DecodeError_clone(&*owner->contents.err);
8660 }
8661 uint64_t  __attribute__((export_name("TS_CResult_ReplyChannelRangeDecodeErrorZ_get_err"))) TS_CResult_ReplyChannelRangeDecodeErrorZ_get_err(uint64_t owner) {
8662         LDKCResult_ReplyChannelRangeDecodeErrorZ* owner_conv = (LDKCResult_ReplyChannelRangeDecodeErrorZ*)untag_ptr(owner);
8663         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
8664         *ret_copy = CResult_ReplyChannelRangeDecodeErrorZ_get_err(owner_conv);
8665         uint64_t ret_ref = tag_ptr(ret_copy, true);
8666         return ret_ref;
8667 }
8668
8669 static inline struct LDKGossipTimestampFilter CResult_GossipTimestampFilterDecodeErrorZ_get_ok(LDKCResult_GossipTimestampFilterDecodeErrorZ *NONNULL_PTR owner){
8670         LDKGossipTimestampFilter ret = *owner->contents.result;
8671         ret.is_owned = false;
8672         return ret;
8673 }
8674 uint64_t  __attribute__((export_name("TS_CResult_GossipTimestampFilterDecodeErrorZ_get_ok"))) TS_CResult_GossipTimestampFilterDecodeErrorZ_get_ok(uint64_t owner) {
8675         LDKCResult_GossipTimestampFilterDecodeErrorZ* owner_conv = (LDKCResult_GossipTimestampFilterDecodeErrorZ*)untag_ptr(owner);
8676         LDKGossipTimestampFilter ret_var = CResult_GossipTimestampFilterDecodeErrorZ_get_ok(owner_conv);
8677         uint64_t ret_ref = 0;
8678         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
8679         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
8680         return ret_ref;
8681 }
8682
8683 static inline struct LDKDecodeError CResult_GossipTimestampFilterDecodeErrorZ_get_err(LDKCResult_GossipTimestampFilterDecodeErrorZ *NONNULL_PTR owner){
8684 CHECK(!owner->result_ok);
8685         return DecodeError_clone(&*owner->contents.err);
8686 }
8687 uint64_t  __attribute__((export_name("TS_CResult_GossipTimestampFilterDecodeErrorZ_get_err"))) TS_CResult_GossipTimestampFilterDecodeErrorZ_get_err(uint64_t owner) {
8688         LDKCResult_GossipTimestampFilterDecodeErrorZ* owner_conv = (LDKCResult_GossipTimestampFilterDecodeErrorZ*)untag_ptr(owner);
8689         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
8690         *ret_copy = CResult_GossipTimestampFilterDecodeErrorZ_get_err(owner_conv);
8691         uint64_t ret_ref = tag_ptr(ret_copy, true);
8692         return ret_ref;
8693 }
8694
8695 static inline LDKCVec_PhantomRouteHintsZ CVec_PhantomRouteHintsZ_clone(const LDKCVec_PhantomRouteHintsZ *orig) {
8696         LDKCVec_PhantomRouteHintsZ ret = { .data = MALLOC(sizeof(LDKPhantomRouteHints) * orig->datalen, "LDKCVec_PhantomRouteHintsZ clone bytes"), .datalen = orig->datalen };
8697         for (size_t i = 0; i < ret.datalen; i++) {
8698                 ret.data[i] = PhantomRouteHints_clone(&orig->data[i]);
8699         }
8700         return ret;
8701 }
8702 uint32_t __attribute__((export_name("TS_LDKSignOrCreationError_ty_from_ptr"))) TS_LDKSignOrCreationError_ty_from_ptr(uint64_t ptr) {
8703         LDKSignOrCreationError *obj = (LDKSignOrCreationError*)untag_ptr(ptr);
8704         switch(obj->tag) {
8705                 case LDKSignOrCreationError_SignError: return 0;
8706                 case LDKSignOrCreationError_CreationError: return 1;
8707                 default: abort();
8708         }
8709 }
8710 uint32_t __attribute__((export_name("TS_LDKSignOrCreationError_CreationError_get_creation_error"))) TS_LDKSignOrCreationError_CreationError_get_creation_error(uint64_t ptr) {
8711         LDKSignOrCreationError *obj = (LDKSignOrCreationError*)untag_ptr(ptr);
8712         assert(obj->tag == LDKSignOrCreationError_CreationError);
8713         uint32_t creation_error_conv = LDKCreationError_to_js(obj->creation_error);
8714         return creation_error_conv;
8715 }
8716 static inline struct LDKBolt11Invoice CResult_Bolt11InvoiceSignOrCreationErrorZ_get_ok(LDKCResult_Bolt11InvoiceSignOrCreationErrorZ *NONNULL_PTR owner){
8717         LDKBolt11Invoice ret = *owner->contents.result;
8718         ret.is_owned = false;
8719         return ret;
8720 }
8721 uint64_t  __attribute__((export_name("TS_CResult_Bolt11InvoiceSignOrCreationErrorZ_get_ok"))) TS_CResult_Bolt11InvoiceSignOrCreationErrorZ_get_ok(uint64_t owner) {
8722         LDKCResult_Bolt11InvoiceSignOrCreationErrorZ* owner_conv = (LDKCResult_Bolt11InvoiceSignOrCreationErrorZ*)untag_ptr(owner);
8723         LDKBolt11Invoice ret_var = CResult_Bolt11InvoiceSignOrCreationErrorZ_get_ok(owner_conv);
8724         uint64_t ret_ref = 0;
8725         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
8726         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
8727         return ret_ref;
8728 }
8729
8730 static inline struct LDKSignOrCreationError CResult_Bolt11InvoiceSignOrCreationErrorZ_get_err(LDKCResult_Bolt11InvoiceSignOrCreationErrorZ *NONNULL_PTR owner){
8731 CHECK(!owner->result_ok);
8732         return SignOrCreationError_clone(&*owner->contents.err);
8733 }
8734 uint64_t  __attribute__((export_name("TS_CResult_Bolt11InvoiceSignOrCreationErrorZ_get_err"))) TS_CResult_Bolt11InvoiceSignOrCreationErrorZ_get_err(uint64_t owner) {
8735         LDKCResult_Bolt11InvoiceSignOrCreationErrorZ* owner_conv = (LDKCResult_Bolt11InvoiceSignOrCreationErrorZ*)untag_ptr(owner);
8736         LDKSignOrCreationError *ret_copy = MALLOC(sizeof(LDKSignOrCreationError), "LDKSignOrCreationError");
8737         *ret_copy = CResult_Bolt11InvoiceSignOrCreationErrorZ_get_err(owner_conv);
8738         uint64_t ret_ref = tag_ptr(ret_copy, true);
8739         return ret_ref;
8740 }
8741
8742 static inline struct LDKOffersMessage CResult_OffersMessageDecodeErrorZ_get_ok(LDKCResult_OffersMessageDecodeErrorZ *NONNULL_PTR owner){
8743 CHECK(owner->result_ok);
8744         return OffersMessage_clone(&*owner->contents.result);
8745 }
8746 uint64_t  __attribute__((export_name("TS_CResult_OffersMessageDecodeErrorZ_get_ok"))) TS_CResult_OffersMessageDecodeErrorZ_get_ok(uint64_t owner) {
8747         LDKCResult_OffersMessageDecodeErrorZ* owner_conv = (LDKCResult_OffersMessageDecodeErrorZ*)untag_ptr(owner);
8748         LDKOffersMessage *ret_copy = MALLOC(sizeof(LDKOffersMessage), "LDKOffersMessage");
8749         *ret_copy = CResult_OffersMessageDecodeErrorZ_get_ok(owner_conv);
8750         uint64_t ret_ref = tag_ptr(ret_copy, true);
8751         return ret_ref;
8752 }
8753
8754 static inline struct LDKDecodeError CResult_OffersMessageDecodeErrorZ_get_err(LDKCResult_OffersMessageDecodeErrorZ *NONNULL_PTR owner){
8755 CHECK(!owner->result_ok);
8756         return DecodeError_clone(&*owner->contents.err);
8757 }
8758 uint64_t  __attribute__((export_name("TS_CResult_OffersMessageDecodeErrorZ_get_err"))) TS_CResult_OffersMessageDecodeErrorZ_get_err(uint64_t owner) {
8759         LDKCResult_OffersMessageDecodeErrorZ* owner_conv = (LDKCResult_OffersMessageDecodeErrorZ*)untag_ptr(owner);
8760         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
8761         *ret_copy = CResult_OffersMessageDecodeErrorZ_get_err(owner_conv);
8762         uint64_t ret_ref = tag_ptr(ret_copy, true);
8763         return ret_ref;
8764 }
8765
8766 uint32_t __attribute__((export_name("TS_LDKCOption_HTLCClaimZ_ty_from_ptr"))) TS_LDKCOption_HTLCClaimZ_ty_from_ptr(uint64_t ptr) {
8767         LDKCOption_HTLCClaimZ *obj = (LDKCOption_HTLCClaimZ*)untag_ptr(ptr);
8768         switch(obj->tag) {
8769                 case LDKCOption_HTLCClaimZ_Some: return 0;
8770                 case LDKCOption_HTLCClaimZ_None: return 1;
8771                 default: abort();
8772         }
8773 }
8774 uint32_t __attribute__((export_name("TS_LDKCOption_HTLCClaimZ_Some_get_some"))) TS_LDKCOption_HTLCClaimZ_Some_get_some(uint64_t ptr) {
8775         LDKCOption_HTLCClaimZ *obj = (LDKCOption_HTLCClaimZ*)untag_ptr(ptr);
8776         assert(obj->tag == LDKCOption_HTLCClaimZ_Some);
8777         uint32_t some_conv = LDKHTLCClaim_to_js(obj->some);
8778         return some_conv;
8779 }
8780 static inline struct LDKCounterpartyCommitmentSecrets CResult_CounterpartyCommitmentSecretsDecodeErrorZ_get_ok(LDKCResult_CounterpartyCommitmentSecretsDecodeErrorZ *NONNULL_PTR owner){
8781         LDKCounterpartyCommitmentSecrets ret = *owner->contents.result;
8782         ret.is_owned = false;
8783         return ret;
8784 }
8785 uint64_t  __attribute__((export_name("TS_CResult_CounterpartyCommitmentSecretsDecodeErrorZ_get_ok"))) TS_CResult_CounterpartyCommitmentSecretsDecodeErrorZ_get_ok(uint64_t owner) {
8786         LDKCResult_CounterpartyCommitmentSecretsDecodeErrorZ* owner_conv = (LDKCResult_CounterpartyCommitmentSecretsDecodeErrorZ*)untag_ptr(owner);
8787         LDKCounterpartyCommitmentSecrets ret_var = CResult_CounterpartyCommitmentSecretsDecodeErrorZ_get_ok(owner_conv);
8788         uint64_t ret_ref = 0;
8789         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
8790         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
8791         return ret_ref;
8792 }
8793
8794 static inline struct LDKDecodeError CResult_CounterpartyCommitmentSecretsDecodeErrorZ_get_err(LDKCResult_CounterpartyCommitmentSecretsDecodeErrorZ *NONNULL_PTR owner){
8795 CHECK(!owner->result_ok);
8796         return DecodeError_clone(&*owner->contents.err);
8797 }
8798 uint64_t  __attribute__((export_name("TS_CResult_CounterpartyCommitmentSecretsDecodeErrorZ_get_err"))) TS_CResult_CounterpartyCommitmentSecretsDecodeErrorZ_get_err(uint64_t owner) {
8799         LDKCResult_CounterpartyCommitmentSecretsDecodeErrorZ* owner_conv = (LDKCResult_CounterpartyCommitmentSecretsDecodeErrorZ*)untag_ptr(owner);
8800         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
8801         *ret_copy = CResult_CounterpartyCommitmentSecretsDecodeErrorZ_get_err(owner_conv);
8802         uint64_t ret_ref = tag_ptr(ret_copy, true);
8803         return ret_ref;
8804 }
8805
8806 static inline struct LDKTxCreationKeys CResult_TxCreationKeysDecodeErrorZ_get_ok(LDKCResult_TxCreationKeysDecodeErrorZ *NONNULL_PTR owner){
8807         LDKTxCreationKeys ret = *owner->contents.result;
8808         ret.is_owned = false;
8809         return ret;
8810 }
8811 uint64_t  __attribute__((export_name("TS_CResult_TxCreationKeysDecodeErrorZ_get_ok"))) TS_CResult_TxCreationKeysDecodeErrorZ_get_ok(uint64_t owner) {
8812         LDKCResult_TxCreationKeysDecodeErrorZ* owner_conv = (LDKCResult_TxCreationKeysDecodeErrorZ*)untag_ptr(owner);
8813         LDKTxCreationKeys ret_var = CResult_TxCreationKeysDecodeErrorZ_get_ok(owner_conv);
8814         uint64_t ret_ref = 0;
8815         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
8816         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
8817         return ret_ref;
8818 }
8819
8820 static inline struct LDKDecodeError CResult_TxCreationKeysDecodeErrorZ_get_err(LDKCResult_TxCreationKeysDecodeErrorZ *NONNULL_PTR owner){
8821 CHECK(!owner->result_ok);
8822         return DecodeError_clone(&*owner->contents.err);
8823 }
8824 uint64_t  __attribute__((export_name("TS_CResult_TxCreationKeysDecodeErrorZ_get_err"))) TS_CResult_TxCreationKeysDecodeErrorZ_get_err(uint64_t owner) {
8825         LDKCResult_TxCreationKeysDecodeErrorZ* owner_conv = (LDKCResult_TxCreationKeysDecodeErrorZ*)untag_ptr(owner);
8826         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
8827         *ret_copy = CResult_TxCreationKeysDecodeErrorZ_get_err(owner_conv);
8828         uint64_t ret_ref = tag_ptr(ret_copy, true);
8829         return ret_ref;
8830 }
8831
8832 static inline struct LDKChannelPublicKeys CResult_ChannelPublicKeysDecodeErrorZ_get_ok(LDKCResult_ChannelPublicKeysDecodeErrorZ *NONNULL_PTR owner){
8833         LDKChannelPublicKeys ret = *owner->contents.result;
8834         ret.is_owned = false;
8835         return ret;
8836 }
8837 uint64_t  __attribute__((export_name("TS_CResult_ChannelPublicKeysDecodeErrorZ_get_ok"))) TS_CResult_ChannelPublicKeysDecodeErrorZ_get_ok(uint64_t owner) {
8838         LDKCResult_ChannelPublicKeysDecodeErrorZ* owner_conv = (LDKCResult_ChannelPublicKeysDecodeErrorZ*)untag_ptr(owner);
8839         LDKChannelPublicKeys ret_var = CResult_ChannelPublicKeysDecodeErrorZ_get_ok(owner_conv);
8840         uint64_t ret_ref = 0;
8841         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
8842         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
8843         return ret_ref;
8844 }
8845
8846 static inline struct LDKDecodeError CResult_ChannelPublicKeysDecodeErrorZ_get_err(LDKCResult_ChannelPublicKeysDecodeErrorZ *NONNULL_PTR owner){
8847 CHECK(!owner->result_ok);
8848         return DecodeError_clone(&*owner->contents.err);
8849 }
8850 uint64_t  __attribute__((export_name("TS_CResult_ChannelPublicKeysDecodeErrorZ_get_err"))) TS_CResult_ChannelPublicKeysDecodeErrorZ_get_err(uint64_t owner) {
8851         LDKCResult_ChannelPublicKeysDecodeErrorZ* owner_conv = (LDKCResult_ChannelPublicKeysDecodeErrorZ*)untag_ptr(owner);
8852         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
8853         *ret_copy = CResult_ChannelPublicKeysDecodeErrorZ_get_err(owner_conv);
8854         uint64_t ret_ref = tag_ptr(ret_copy, true);
8855         return ret_ref;
8856 }
8857
8858 static inline struct LDKHTLCOutputInCommitment CResult_HTLCOutputInCommitmentDecodeErrorZ_get_ok(LDKCResult_HTLCOutputInCommitmentDecodeErrorZ *NONNULL_PTR owner){
8859         LDKHTLCOutputInCommitment ret = *owner->contents.result;
8860         ret.is_owned = false;
8861         return ret;
8862 }
8863 uint64_t  __attribute__((export_name("TS_CResult_HTLCOutputInCommitmentDecodeErrorZ_get_ok"))) TS_CResult_HTLCOutputInCommitmentDecodeErrorZ_get_ok(uint64_t owner) {
8864         LDKCResult_HTLCOutputInCommitmentDecodeErrorZ* owner_conv = (LDKCResult_HTLCOutputInCommitmentDecodeErrorZ*)untag_ptr(owner);
8865         LDKHTLCOutputInCommitment ret_var = CResult_HTLCOutputInCommitmentDecodeErrorZ_get_ok(owner_conv);
8866         uint64_t ret_ref = 0;
8867         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
8868         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
8869         return ret_ref;
8870 }
8871
8872 static inline struct LDKDecodeError CResult_HTLCOutputInCommitmentDecodeErrorZ_get_err(LDKCResult_HTLCOutputInCommitmentDecodeErrorZ *NONNULL_PTR owner){
8873 CHECK(!owner->result_ok);
8874         return DecodeError_clone(&*owner->contents.err);
8875 }
8876 uint64_t  __attribute__((export_name("TS_CResult_HTLCOutputInCommitmentDecodeErrorZ_get_err"))) TS_CResult_HTLCOutputInCommitmentDecodeErrorZ_get_err(uint64_t owner) {
8877         LDKCResult_HTLCOutputInCommitmentDecodeErrorZ* owner_conv = (LDKCResult_HTLCOutputInCommitmentDecodeErrorZ*)untag_ptr(owner);
8878         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
8879         *ret_copy = CResult_HTLCOutputInCommitmentDecodeErrorZ_get_err(owner_conv);
8880         uint64_t ret_ref = tag_ptr(ret_copy, true);
8881         return ret_ref;
8882 }
8883
8884 static inline struct LDKCounterpartyChannelTransactionParameters CResult_CounterpartyChannelTransactionParametersDecodeErrorZ_get_ok(LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ *NONNULL_PTR owner){
8885         LDKCounterpartyChannelTransactionParameters ret = *owner->contents.result;
8886         ret.is_owned = false;
8887         return ret;
8888 }
8889 uint64_t  __attribute__((export_name("TS_CResult_CounterpartyChannelTransactionParametersDecodeErrorZ_get_ok"))) TS_CResult_CounterpartyChannelTransactionParametersDecodeErrorZ_get_ok(uint64_t owner) {
8890         LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ* owner_conv = (LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ*)untag_ptr(owner);
8891         LDKCounterpartyChannelTransactionParameters ret_var = CResult_CounterpartyChannelTransactionParametersDecodeErrorZ_get_ok(owner_conv);
8892         uint64_t ret_ref = 0;
8893         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
8894         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
8895         return ret_ref;
8896 }
8897
8898 static inline struct LDKDecodeError CResult_CounterpartyChannelTransactionParametersDecodeErrorZ_get_err(LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ *NONNULL_PTR owner){
8899 CHECK(!owner->result_ok);
8900         return DecodeError_clone(&*owner->contents.err);
8901 }
8902 uint64_t  __attribute__((export_name("TS_CResult_CounterpartyChannelTransactionParametersDecodeErrorZ_get_err"))) TS_CResult_CounterpartyChannelTransactionParametersDecodeErrorZ_get_err(uint64_t owner) {
8903         LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ* owner_conv = (LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ*)untag_ptr(owner);
8904         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
8905         *ret_copy = CResult_CounterpartyChannelTransactionParametersDecodeErrorZ_get_err(owner_conv);
8906         uint64_t ret_ref = tag_ptr(ret_copy, true);
8907         return ret_ref;
8908 }
8909
8910 static inline struct LDKChannelTransactionParameters CResult_ChannelTransactionParametersDecodeErrorZ_get_ok(LDKCResult_ChannelTransactionParametersDecodeErrorZ *NONNULL_PTR owner){
8911         LDKChannelTransactionParameters ret = *owner->contents.result;
8912         ret.is_owned = false;
8913         return ret;
8914 }
8915 uint64_t  __attribute__((export_name("TS_CResult_ChannelTransactionParametersDecodeErrorZ_get_ok"))) TS_CResult_ChannelTransactionParametersDecodeErrorZ_get_ok(uint64_t owner) {
8916         LDKCResult_ChannelTransactionParametersDecodeErrorZ* owner_conv = (LDKCResult_ChannelTransactionParametersDecodeErrorZ*)untag_ptr(owner);
8917         LDKChannelTransactionParameters ret_var = CResult_ChannelTransactionParametersDecodeErrorZ_get_ok(owner_conv);
8918         uint64_t ret_ref = 0;
8919         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
8920         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
8921         return ret_ref;
8922 }
8923
8924 static inline struct LDKDecodeError CResult_ChannelTransactionParametersDecodeErrorZ_get_err(LDKCResult_ChannelTransactionParametersDecodeErrorZ *NONNULL_PTR owner){
8925 CHECK(!owner->result_ok);
8926         return DecodeError_clone(&*owner->contents.err);
8927 }
8928 uint64_t  __attribute__((export_name("TS_CResult_ChannelTransactionParametersDecodeErrorZ_get_err"))) TS_CResult_ChannelTransactionParametersDecodeErrorZ_get_err(uint64_t owner) {
8929         LDKCResult_ChannelTransactionParametersDecodeErrorZ* owner_conv = (LDKCResult_ChannelTransactionParametersDecodeErrorZ*)untag_ptr(owner);
8930         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
8931         *ret_copy = CResult_ChannelTransactionParametersDecodeErrorZ_get_err(owner_conv);
8932         uint64_t ret_ref = tag_ptr(ret_copy, true);
8933         return ret_ref;
8934 }
8935
8936 static inline struct LDKHolderCommitmentTransaction CResult_HolderCommitmentTransactionDecodeErrorZ_get_ok(LDKCResult_HolderCommitmentTransactionDecodeErrorZ *NONNULL_PTR owner){
8937         LDKHolderCommitmentTransaction ret = *owner->contents.result;
8938         ret.is_owned = false;
8939         return ret;
8940 }
8941 uint64_t  __attribute__((export_name("TS_CResult_HolderCommitmentTransactionDecodeErrorZ_get_ok"))) TS_CResult_HolderCommitmentTransactionDecodeErrorZ_get_ok(uint64_t owner) {
8942         LDKCResult_HolderCommitmentTransactionDecodeErrorZ* owner_conv = (LDKCResult_HolderCommitmentTransactionDecodeErrorZ*)untag_ptr(owner);
8943         LDKHolderCommitmentTransaction ret_var = CResult_HolderCommitmentTransactionDecodeErrorZ_get_ok(owner_conv);
8944         uint64_t ret_ref = 0;
8945         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
8946         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
8947         return ret_ref;
8948 }
8949
8950 static inline struct LDKDecodeError CResult_HolderCommitmentTransactionDecodeErrorZ_get_err(LDKCResult_HolderCommitmentTransactionDecodeErrorZ *NONNULL_PTR owner){
8951 CHECK(!owner->result_ok);
8952         return DecodeError_clone(&*owner->contents.err);
8953 }
8954 uint64_t  __attribute__((export_name("TS_CResult_HolderCommitmentTransactionDecodeErrorZ_get_err"))) TS_CResult_HolderCommitmentTransactionDecodeErrorZ_get_err(uint64_t owner) {
8955         LDKCResult_HolderCommitmentTransactionDecodeErrorZ* owner_conv = (LDKCResult_HolderCommitmentTransactionDecodeErrorZ*)untag_ptr(owner);
8956         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
8957         *ret_copy = CResult_HolderCommitmentTransactionDecodeErrorZ_get_err(owner_conv);
8958         uint64_t ret_ref = tag_ptr(ret_copy, true);
8959         return ret_ref;
8960 }
8961
8962 static inline struct LDKBuiltCommitmentTransaction CResult_BuiltCommitmentTransactionDecodeErrorZ_get_ok(LDKCResult_BuiltCommitmentTransactionDecodeErrorZ *NONNULL_PTR owner){
8963         LDKBuiltCommitmentTransaction ret = *owner->contents.result;
8964         ret.is_owned = false;
8965         return ret;
8966 }
8967 uint64_t  __attribute__((export_name("TS_CResult_BuiltCommitmentTransactionDecodeErrorZ_get_ok"))) TS_CResult_BuiltCommitmentTransactionDecodeErrorZ_get_ok(uint64_t owner) {
8968         LDKCResult_BuiltCommitmentTransactionDecodeErrorZ* owner_conv = (LDKCResult_BuiltCommitmentTransactionDecodeErrorZ*)untag_ptr(owner);
8969         LDKBuiltCommitmentTransaction ret_var = CResult_BuiltCommitmentTransactionDecodeErrorZ_get_ok(owner_conv);
8970         uint64_t ret_ref = 0;
8971         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
8972         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
8973         return ret_ref;
8974 }
8975
8976 static inline struct LDKDecodeError CResult_BuiltCommitmentTransactionDecodeErrorZ_get_err(LDKCResult_BuiltCommitmentTransactionDecodeErrorZ *NONNULL_PTR owner){
8977 CHECK(!owner->result_ok);
8978         return DecodeError_clone(&*owner->contents.err);
8979 }
8980 uint64_t  __attribute__((export_name("TS_CResult_BuiltCommitmentTransactionDecodeErrorZ_get_err"))) TS_CResult_BuiltCommitmentTransactionDecodeErrorZ_get_err(uint64_t owner) {
8981         LDKCResult_BuiltCommitmentTransactionDecodeErrorZ* owner_conv = (LDKCResult_BuiltCommitmentTransactionDecodeErrorZ*)untag_ptr(owner);
8982         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
8983         *ret_copy = CResult_BuiltCommitmentTransactionDecodeErrorZ_get_err(owner_conv);
8984         uint64_t ret_ref = tag_ptr(ret_copy, true);
8985         return ret_ref;
8986 }
8987
8988 static inline struct LDKTrustedClosingTransaction CResult_TrustedClosingTransactionNoneZ_get_ok(LDKCResult_TrustedClosingTransactionNoneZ *NONNULL_PTR owner){
8989         LDKTrustedClosingTransaction ret = *owner->contents.result;
8990         ret.is_owned = false;
8991         return ret;
8992 }
8993 uint64_t  __attribute__((export_name("TS_CResult_TrustedClosingTransactionNoneZ_get_ok"))) TS_CResult_TrustedClosingTransactionNoneZ_get_ok(uint64_t owner) {
8994         LDKCResult_TrustedClosingTransactionNoneZ* owner_conv = (LDKCResult_TrustedClosingTransactionNoneZ*)untag_ptr(owner);
8995         LDKTrustedClosingTransaction ret_var = CResult_TrustedClosingTransactionNoneZ_get_ok(owner_conv);
8996         uint64_t ret_ref = 0;
8997         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
8998         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
8999         return ret_ref;
9000 }
9001
9002 static inline void CResult_TrustedClosingTransactionNoneZ_get_err(LDKCResult_TrustedClosingTransactionNoneZ *NONNULL_PTR owner){
9003 CHECK(!owner->result_ok);
9004         return *owner->contents.err;
9005 }
9006 void  __attribute__((export_name("TS_CResult_TrustedClosingTransactionNoneZ_get_err"))) TS_CResult_TrustedClosingTransactionNoneZ_get_err(uint64_t owner) {
9007         LDKCResult_TrustedClosingTransactionNoneZ* owner_conv = (LDKCResult_TrustedClosingTransactionNoneZ*)untag_ptr(owner);
9008         CResult_TrustedClosingTransactionNoneZ_get_err(owner_conv);
9009 }
9010
9011 static inline struct LDKCommitmentTransaction CResult_CommitmentTransactionDecodeErrorZ_get_ok(LDKCResult_CommitmentTransactionDecodeErrorZ *NONNULL_PTR owner){
9012         LDKCommitmentTransaction ret = *owner->contents.result;
9013         ret.is_owned = false;
9014         return ret;
9015 }
9016 uint64_t  __attribute__((export_name("TS_CResult_CommitmentTransactionDecodeErrorZ_get_ok"))) TS_CResult_CommitmentTransactionDecodeErrorZ_get_ok(uint64_t owner) {
9017         LDKCResult_CommitmentTransactionDecodeErrorZ* owner_conv = (LDKCResult_CommitmentTransactionDecodeErrorZ*)untag_ptr(owner);
9018         LDKCommitmentTransaction ret_var = CResult_CommitmentTransactionDecodeErrorZ_get_ok(owner_conv);
9019         uint64_t ret_ref = 0;
9020         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
9021         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
9022         return ret_ref;
9023 }
9024
9025 static inline struct LDKDecodeError CResult_CommitmentTransactionDecodeErrorZ_get_err(LDKCResult_CommitmentTransactionDecodeErrorZ *NONNULL_PTR owner){
9026 CHECK(!owner->result_ok);
9027         return DecodeError_clone(&*owner->contents.err);
9028 }
9029 uint64_t  __attribute__((export_name("TS_CResult_CommitmentTransactionDecodeErrorZ_get_err"))) TS_CResult_CommitmentTransactionDecodeErrorZ_get_err(uint64_t owner) {
9030         LDKCResult_CommitmentTransactionDecodeErrorZ* owner_conv = (LDKCResult_CommitmentTransactionDecodeErrorZ*)untag_ptr(owner);
9031         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
9032         *ret_copy = CResult_CommitmentTransactionDecodeErrorZ_get_err(owner_conv);
9033         uint64_t ret_ref = tag_ptr(ret_copy, true);
9034         return ret_ref;
9035 }
9036
9037 static inline struct LDKTrustedCommitmentTransaction CResult_TrustedCommitmentTransactionNoneZ_get_ok(LDKCResult_TrustedCommitmentTransactionNoneZ *NONNULL_PTR owner){
9038         LDKTrustedCommitmentTransaction ret = *owner->contents.result;
9039         ret.is_owned = false;
9040         return ret;
9041 }
9042 uint64_t  __attribute__((export_name("TS_CResult_TrustedCommitmentTransactionNoneZ_get_ok"))) TS_CResult_TrustedCommitmentTransactionNoneZ_get_ok(uint64_t owner) {
9043         LDKCResult_TrustedCommitmentTransactionNoneZ* owner_conv = (LDKCResult_TrustedCommitmentTransactionNoneZ*)untag_ptr(owner);
9044         LDKTrustedCommitmentTransaction ret_var = CResult_TrustedCommitmentTransactionNoneZ_get_ok(owner_conv);
9045         uint64_t ret_ref = 0;
9046         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
9047         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
9048         return ret_ref;
9049 }
9050
9051 static inline void CResult_TrustedCommitmentTransactionNoneZ_get_err(LDKCResult_TrustedCommitmentTransactionNoneZ *NONNULL_PTR owner){
9052 CHECK(!owner->result_ok);
9053         return *owner->contents.err;
9054 }
9055 void  __attribute__((export_name("TS_CResult_TrustedCommitmentTransactionNoneZ_get_err"))) TS_CResult_TrustedCommitmentTransactionNoneZ_get_err(uint64_t owner) {
9056         LDKCResult_TrustedCommitmentTransactionNoneZ* owner_conv = (LDKCResult_TrustedCommitmentTransactionNoneZ*)untag_ptr(owner);
9057         CResult_TrustedCommitmentTransactionNoneZ_get_err(owner_conv);
9058 }
9059
9060 static inline struct LDKCVec_ECDSASignatureZ CResult_CVec_ECDSASignatureZNoneZ_get_ok(LDKCResult_CVec_ECDSASignatureZNoneZ *NONNULL_PTR owner){
9061 CHECK(owner->result_ok);
9062         return *owner->contents.result;
9063 }
9064 ptrArray  __attribute__((export_name("TS_CResult_CVec_ECDSASignatureZNoneZ_get_ok"))) TS_CResult_CVec_ECDSASignatureZNoneZ_get_ok(uint64_t owner) {
9065         LDKCResult_CVec_ECDSASignatureZNoneZ* owner_conv = (LDKCResult_CVec_ECDSASignatureZNoneZ*)untag_ptr(owner);
9066         LDKCVec_ECDSASignatureZ ret_var = CResult_CVec_ECDSASignatureZNoneZ_get_ok(owner_conv);
9067         ptrArray ret_arr = NULL;
9068         ret_arr = init_ptrArray(ret_var.datalen, __LINE__);
9069         int8_tArray *ret_arr_ptr = (int8_tArray*)(((uint8_t*)ret_arr) + 8);
9070         for (size_t m = 0; m < ret_var.datalen; m++) {
9071                 int8_tArray ret_conv_12_arr = init_int8_tArray(64, __LINE__);
9072                 memcpy(ret_conv_12_arr->elems, ret_var.data[m].compact_form, 64);
9073                 ret_arr_ptr[m] = ret_conv_12_arr;
9074         }
9075         
9076         return ret_arr;
9077 }
9078
9079 static inline void CResult_CVec_ECDSASignatureZNoneZ_get_err(LDKCResult_CVec_ECDSASignatureZNoneZ *NONNULL_PTR owner){
9080 CHECK(!owner->result_ok);
9081         return *owner->contents.err;
9082 }
9083 void  __attribute__((export_name("TS_CResult_CVec_ECDSASignatureZNoneZ_get_err"))) TS_CResult_CVec_ECDSASignatureZNoneZ_get_err(uint64_t owner) {
9084         LDKCResult_CVec_ECDSASignatureZNoneZ* owner_conv = (LDKCResult_CVec_ECDSASignatureZNoneZ*)untag_ptr(owner);
9085         CResult_CVec_ECDSASignatureZNoneZ_get_err(owner_conv);
9086 }
9087
9088 uint32_t __attribute__((export_name("TS_LDKCOption_usizeZ_ty_from_ptr"))) TS_LDKCOption_usizeZ_ty_from_ptr(uint64_t ptr) {
9089         LDKCOption_usizeZ *obj = (LDKCOption_usizeZ*)untag_ptr(ptr);
9090         switch(obj->tag) {
9091                 case LDKCOption_usizeZ_Some: return 0;
9092                 case LDKCOption_usizeZ_None: return 1;
9093                 default: abort();
9094         }
9095 }
9096 uint32_t __attribute__((export_name("TS_LDKCOption_usizeZ_Some_get_some"))) TS_LDKCOption_usizeZ_Some_get_some(uint64_t ptr) {
9097         LDKCOption_usizeZ *obj = (LDKCOption_usizeZ*)untag_ptr(ptr);
9098         assert(obj->tag == LDKCOption_usizeZ_Some);
9099         uint32_t some_conv = obj->some;
9100         return some_conv;
9101 }
9102 static inline struct LDKShutdownScript CResult_ShutdownScriptDecodeErrorZ_get_ok(LDKCResult_ShutdownScriptDecodeErrorZ *NONNULL_PTR owner){
9103         LDKShutdownScript ret = *owner->contents.result;
9104         ret.is_owned = false;
9105         return ret;
9106 }
9107 uint64_t  __attribute__((export_name("TS_CResult_ShutdownScriptDecodeErrorZ_get_ok"))) TS_CResult_ShutdownScriptDecodeErrorZ_get_ok(uint64_t owner) {
9108         LDKCResult_ShutdownScriptDecodeErrorZ* owner_conv = (LDKCResult_ShutdownScriptDecodeErrorZ*)untag_ptr(owner);
9109         LDKShutdownScript ret_var = CResult_ShutdownScriptDecodeErrorZ_get_ok(owner_conv);
9110         uint64_t ret_ref = 0;
9111         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
9112         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
9113         return ret_ref;
9114 }
9115
9116 static inline struct LDKDecodeError CResult_ShutdownScriptDecodeErrorZ_get_err(LDKCResult_ShutdownScriptDecodeErrorZ *NONNULL_PTR owner){
9117 CHECK(!owner->result_ok);
9118         return DecodeError_clone(&*owner->contents.err);
9119 }
9120 uint64_t  __attribute__((export_name("TS_CResult_ShutdownScriptDecodeErrorZ_get_err"))) TS_CResult_ShutdownScriptDecodeErrorZ_get_err(uint64_t owner) {
9121         LDKCResult_ShutdownScriptDecodeErrorZ* owner_conv = (LDKCResult_ShutdownScriptDecodeErrorZ*)untag_ptr(owner);
9122         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
9123         *ret_copy = CResult_ShutdownScriptDecodeErrorZ_get_err(owner_conv);
9124         uint64_t ret_ref = tag_ptr(ret_copy, true);
9125         return ret_ref;
9126 }
9127
9128 static inline struct LDKShutdownScript CResult_ShutdownScriptInvalidShutdownScriptZ_get_ok(LDKCResult_ShutdownScriptInvalidShutdownScriptZ *NONNULL_PTR owner){
9129         LDKShutdownScript ret = *owner->contents.result;
9130         ret.is_owned = false;
9131         return ret;
9132 }
9133 uint64_t  __attribute__((export_name("TS_CResult_ShutdownScriptInvalidShutdownScriptZ_get_ok"))) TS_CResult_ShutdownScriptInvalidShutdownScriptZ_get_ok(uint64_t owner) {
9134         LDKCResult_ShutdownScriptInvalidShutdownScriptZ* owner_conv = (LDKCResult_ShutdownScriptInvalidShutdownScriptZ*)untag_ptr(owner);
9135         LDKShutdownScript ret_var = CResult_ShutdownScriptInvalidShutdownScriptZ_get_ok(owner_conv);
9136         uint64_t ret_ref = 0;
9137         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
9138         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
9139         return ret_ref;
9140 }
9141
9142 static inline struct LDKInvalidShutdownScript CResult_ShutdownScriptInvalidShutdownScriptZ_get_err(LDKCResult_ShutdownScriptInvalidShutdownScriptZ *NONNULL_PTR owner){
9143         LDKInvalidShutdownScript ret = *owner->contents.err;
9144         ret.is_owned = false;
9145         return ret;
9146 }
9147 uint64_t  __attribute__((export_name("TS_CResult_ShutdownScriptInvalidShutdownScriptZ_get_err"))) TS_CResult_ShutdownScriptInvalidShutdownScriptZ_get_err(uint64_t owner) {
9148         LDKCResult_ShutdownScriptInvalidShutdownScriptZ* owner_conv = (LDKCResult_ShutdownScriptInvalidShutdownScriptZ*)untag_ptr(owner);
9149         LDKInvalidShutdownScript ret_var = CResult_ShutdownScriptInvalidShutdownScriptZ_get_err(owner_conv);
9150         uint64_t ret_ref = 0;
9151         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
9152         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
9153         return ret_ref;
9154 }
9155
9156 uint32_t __attribute__((export_name("TS_LDKPaymentPurpose_ty_from_ptr"))) TS_LDKPaymentPurpose_ty_from_ptr(uint64_t ptr) {
9157         LDKPaymentPurpose *obj = (LDKPaymentPurpose*)untag_ptr(ptr);
9158         switch(obj->tag) {
9159                 case LDKPaymentPurpose_InvoicePayment: return 0;
9160                 case LDKPaymentPurpose_SpontaneousPayment: return 1;
9161                 default: abort();
9162         }
9163 }
9164 uint64_t __attribute__((export_name("TS_LDKPaymentPurpose_InvoicePayment_get_payment_preimage"))) TS_LDKPaymentPurpose_InvoicePayment_get_payment_preimage(uint64_t ptr) {
9165         LDKPaymentPurpose *obj = (LDKPaymentPurpose*)untag_ptr(ptr);
9166         assert(obj->tag == LDKPaymentPurpose_InvoicePayment);
9167         uint64_t payment_preimage_ref = tag_ptr(&obj->invoice_payment.payment_preimage, false);
9168         return payment_preimage_ref;
9169 }
9170 int8_tArray __attribute__((export_name("TS_LDKPaymentPurpose_InvoicePayment_get_payment_secret"))) TS_LDKPaymentPurpose_InvoicePayment_get_payment_secret(uint64_t ptr) {
9171         LDKPaymentPurpose *obj = (LDKPaymentPurpose*)untag_ptr(ptr);
9172         assert(obj->tag == LDKPaymentPurpose_InvoicePayment);
9173         int8_tArray payment_secret_arr = init_int8_tArray(32, __LINE__);
9174         memcpy(payment_secret_arr->elems, obj->invoice_payment.payment_secret.data, 32);
9175         return payment_secret_arr;
9176 }
9177 int8_tArray __attribute__((export_name("TS_LDKPaymentPurpose_SpontaneousPayment_get_spontaneous_payment"))) TS_LDKPaymentPurpose_SpontaneousPayment_get_spontaneous_payment(uint64_t ptr) {
9178         LDKPaymentPurpose *obj = (LDKPaymentPurpose*)untag_ptr(ptr);
9179         assert(obj->tag == LDKPaymentPurpose_SpontaneousPayment);
9180         int8_tArray spontaneous_payment_arr = init_int8_tArray(32, __LINE__);
9181         memcpy(spontaneous_payment_arr->elems, obj->spontaneous_payment.data, 32);
9182         return spontaneous_payment_arr;
9183 }
9184 static inline struct LDKPaymentPurpose CResult_PaymentPurposeDecodeErrorZ_get_ok(LDKCResult_PaymentPurposeDecodeErrorZ *NONNULL_PTR owner){
9185 CHECK(owner->result_ok);
9186         return PaymentPurpose_clone(&*owner->contents.result);
9187 }
9188 uint64_t  __attribute__((export_name("TS_CResult_PaymentPurposeDecodeErrorZ_get_ok"))) TS_CResult_PaymentPurposeDecodeErrorZ_get_ok(uint64_t owner) {
9189         LDKCResult_PaymentPurposeDecodeErrorZ* owner_conv = (LDKCResult_PaymentPurposeDecodeErrorZ*)untag_ptr(owner);
9190         LDKPaymentPurpose *ret_copy = MALLOC(sizeof(LDKPaymentPurpose), "LDKPaymentPurpose");
9191         *ret_copy = CResult_PaymentPurposeDecodeErrorZ_get_ok(owner_conv);
9192         uint64_t ret_ref = tag_ptr(ret_copy, true);
9193         return ret_ref;
9194 }
9195
9196 static inline struct LDKDecodeError CResult_PaymentPurposeDecodeErrorZ_get_err(LDKCResult_PaymentPurposeDecodeErrorZ *NONNULL_PTR owner){
9197 CHECK(!owner->result_ok);
9198         return DecodeError_clone(&*owner->contents.err);
9199 }
9200 uint64_t  __attribute__((export_name("TS_CResult_PaymentPurposeDecodeErrorZ_get_err"))) TS_CResult_PaymentPurposeDecodeErrorZ_get_err(uint64_t owner) {
9201         LDKCResult_PaymentPurposeDecodeErrorZ* owner_conv = (LDKCResult_PaymentPurposeDecodeErrorZ*)untag_ptr(owner);
9202         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
9203         *ret_copy = CResult_PaymentPurposeDecodeErrorZ_get_err(owner_conv);
9204         uint64_t ret_ref = tag_ptr(ret_copy, true);
9205         return ret_ref;
9206 }
9207
9208 static inline struct LDKClaimedHTLC CResult_ClaimedHTLCDecodeErrorZ_get_ok(LDKCResult_ClaimedHTLCDecodeErrorZ *NONNULL_PTR owner){
9209         LDKClaimedHTLC ret = *owner->contents.result;
9210         ret.is_owned = false;
9211         return ret;
9212 }
9213 uint64_t  __attribute__((export_name("TS_CResult_ClaimedHTLCDecodeErrorZ_get_ok"))) TS_CResult_ClaimedHTLCDecodeErrorZ_get_ok(uint64_t owner) {
9214         LDKCResult_ClaimedHTLCDecodeErrorZ* owner_conv = (LDKCResult_ClaimedHTLCDecodeErrorZ*)untag_ptr(owner);
9215         LDKClaimedHTLC ret_var = CResult_ClaimedHTLCDecodeErrorZ_get_ok(owner_conv);
9216         uint64_t ret_ref = 0;
9217         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
9218         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
9219         return ret_ref;
9220 }
9221
9222 static inline struct LDKDecodeError CResult_ClaimedHTLCDecodeErrorZ_get_err(LDKCResult_ClaimedHTLCDecodeErrorZ *NONNULL_PTR owner){
9223 CHECK(!owner->result_ok);
9224         return DecodeError_clone(&*owner->contents.err);
9225 }
9226 uint64_t  __attribute__((export_name("TS_CResult_ClaimedHTLCDecodeErrorZ_get_err"))) TS_CResult_ClaimedHTLCDecodeErrorZ_get_err(uint64_t owner) {
9227         LDKCResult_ClaimedHTLCDecodeErrorZ* owner_conv = (LDKCResult_ClaimedHTLCDecodeErrorZ*)untag_ptr(owner);
9228         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
9229         *ret_copy = CResult_ClaimedHTLCDecodeErrorZ_get_err(owner_conv);
9230         uint64_t ret_ref = tag_ptr(ret_copy, true);
9231         return ret_ref;
9232 }
9233
9234 uint32_t __attribute__((export_name("TS_LDKPathFailure_ty_from_ptr"))) TS_LDKPathFailure_ty_from_ptr(uint64_t ptr) {
9235         LDKPathFailure *obj = (LDKPathFailure*)untag_ptr(ptr);
9236         switch(obj->tag) {
9237                 case LDKPathFailure_InitialSend: return 0;
9238                 case LDKPathFailure_OnPath: return 1;
9239                 default: abort();
9240         }
9241 }
9242 uint64_t __attribute__((export_name("TS_LDKPathFailure_InitialSend_get_err"))) TS_LDKPathFailure_InitialSend_get_err(uint64_t ptr) {
9243         LDKPathFailure *obj = (LDKPathFailure*)untag_ptr(ptr);
9244         assert(obj->tag == LDKPathFailure_InitialSend);
9245         uint64_t err_ref = tag_ptr(&obj->initial_send.err, false);
9246         return err_ref;
9247 }
9248 uint64_t __attribute__((export_name("TS_LDKPathFailure_OnPath_get_network_update"))) TS_LDKPathFailure_OnPath_get_network_update(uint64_t ptr) {
9249         LDKPathFailure *obj = (LDKPathFailure*)untag_ptr(ptr);
9250         assert(obj->tag == LDKPathFailure_OnPath);
9251         uint64_t network_update_ref = tag_ptr(&obj->on_path.network_update, false);
9252         return network_update_ref;
9253 }
9254 uint32_t __attribute__((export_name("TS_LDKCOption_PathFailureZ_ty_from_ptr"))) TS_LDKCOption_PathFailureZ_ty_from_ptr(uint64_t ptr) {
9255         LDKCOption_PathFailureZ *obj = (LDKCOption_PathFailureZ*)untag_ptr(ptr);
9256         switch(obj->tag) {
9257                 case LDKCOption_PathFailureZ_Some: return 0;
9258                 case LDKCOption_PathFailureZ_None: return 1;
9259                 default: abort();
9260         }
9261 }
9262 uint64_t __attribute__((export_name("TS_LDKCOption_PathFailureZ_Some_get_some"))) TS_LDKCOption_PathFailureZ_Some_get_some(uint64_t ptr) {
9263         LDKCOption_PathFailureZ *obj = (LDKCOption_PathFailureZ*)untag_ptr(ptr);
9264         assert(obj->tag == LDKCOption_PathFailureZ_Some);
9265         uint64_t some_ref = tag_ptr(&obj->some, false);
9266         return some_ref;
9267 }
9268 static inline struct LDKCOption_PathFailureZ CResult_COption_PathFailureZDecodeErrorZ_get_ok(LDKCResult_COption_PathFailureZDecodeErrorZ *NONNULL_PTR owner){
9269 CHECK(owner->result_ok);
9270         return COption_PathFailureZ_clone(&*owner->contents.result);
9271 }
9272 uint64_t  __attribute__((export_name("TS_CResult_COption_PathFailureZDecodeErrorZ_get_ok"))) TS_CResult_COption_PathFailureZDecodeErrorZ_get_ok(uint64_t owner) {
9273         LDKCResult_COption_PathFailureZDecodeErrorZ* owner_conv = (LDKCResult_COption_PathFailureZDecodeErrorZ*)untag_ptr(owner);
9274         LDKCOption_PathFailureZ *ret_copy = MALLOC(sizeof(LDKCOption_PathFailureZ), "LDKCOption_PathFailureZ");
9275         *ret_copy = CResult_COption_PathFailureZDecodeErrorZ_get_ok(owner_conv);
9276         uint64_t ret_ref = tag_ptr(ret_copy, true);
9277         return ret_ref;
9278 }
9279
9280 static inline struct LDKDecodeError CResult_COption_PathFailureZDecodeErrorZ_get_err(LDKCResult_COption_PathFailureZDecodeErrorZ *NONNULL_PTR owner){
9281 CHECK(!owner->result_ok);
9282         return DecodeError_clone(&*owner->contents.err);
9283 }
9284 uint64_t  __attribute__((export_name("TS_CResult_COption_PathFailureZDecodeErrorZ_get_err"))) TS_CResult_COption_PathFailureZDecodeErrorZ_get_err(uint64_t owner) {
9285         LDKCResult_COption_PathFailureZDecodeErrorZ* owner_conv = (LDKCResult_COption_PathFailureZDecodeErrorZ*)untag_ptr(owner);
9286         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
9287         *ret_copy = CResult_COption_PathFailureZDecodeErrorZ_get_err(owner_conv);
9288         uint64_t ret_ref = tag_ptr(ret_copy, true);
9289         return ret_ref;
9290 }
9291
9292 uint32_t __attribute__((export_name("TS_LDKClosureReason_ty_from_ptr"))) TS_LDKClosureReason_ty_from_ptr(uint64_t ptr) {
9293         LDKClosureReason *obj = (LDKClosureReason*)untag_ptr(ptr);
9294         switch(obj->tag) {
9295                 case LDKClosureReason_CounterpartyForceClosed: return 0;
9296                 case LDKClosureReason_HolderForceClosed: return 1;
9297                 case LDKClosureReason_CooperativeClosure: return 2;
9298                 case LDKClosureReason_CommitmentTxConfirmed: return 3;
9299                 case LDKClosureReason_FundingTimedOut: return 4;
9300                 case LDKClosureReason_ProcessingError: return 5;
9301                 case LDKClosureReason_DisconnectedPeer: return 6;
9302                 case LDKClosureReason_OutdatedChannelManager: return 7;
9303                 case LDKClosureReason_CounterpartyCoopClosedUnfundedChannel: return 8;
9304                 case LDKClosureReason_FundingBatchClosure: return 9;
9305                 default: abort();
9306         }
9307 }
9308 uint64_t __attribute__((export_name("TS_LDKClosureReason_CounterpartyForceClosed_get_peer_msg"))) TS_LDKClosureReason_CounterpartyForceClosed_get_peer_msg(uint64_t ptr) {
9309         LDKClosureReason *obj = (LDKClosureReason*)untag_ptr(ptr);
9310         assert(obj->tag == LDKClosureReason_CounterpartyForceClosed);
9311         LDKUntrustedString peer_msg_var = obj->counterparty_force_closed.peer_msg;
9312                         uint64_t peer_msg_ref = 0;
9313                         CHECK_INNER_FIELD_ACCESS_OR_NULL(peer_msg_var);
9314                         peer_msg_ref = tag_ptr(peer_msg_var.inner, false);
9315         return peer_msg_ref;
9316 }
9317 jstring __attribute__((export_name("TS_LDKClosureReason_ProcessingError_get_err"))) TS_LDKClosureReason_ProcessingError_get_err(uint64_t ptr) {
9318         LDKClosureReason *obj = (LDKClosureReason*)untag_ptr(ptr);
9319         assert(obj->tag == LDKClosureReason_ProcessingError);
9320         LDKStr err_str = obj->processing_error.err;
9321                         jstring err_conv = str_ref_to_ts(err_str.chars, err_str.len);
9322         return err_conv;
9323 }
9324 uint32_t __attribute__((export_name("TS_LDKCOption_ClosureReasonZ_ty_from_ptr"))) TS_LDKCOption_ClosureReasonZ_ty_from_ptr(uint64_t ptr) {
9325         LDKCOption_ClosureReasonZ *obj = (LDKCOption_ClosureReasonZ*)untag_ptr(ptr);
9326         switch(obj->tag) {
9327                 case LDKCOption_ClosureReasonZ_Some: return 0;
9328                 case LDKCOption_ClosureReasonZ_None: return 1;
9329                 default: abort();
9330         }
9331 }
9332 uint64_t __attribute__((export_name("TS_LDKCOption_ClosureReasonZ_Some_get_some"))) TS_LDKCOption_ClosureReasonZ_Some_get_some(uint64_t ptr) {
9333         LDKCOption_ClosureReasonZ *obj = (LDKCOption_ClosureReasonZ*)untag_ptr(ptr);
9334         assert(obj->tag == LDKCOption_ClosureReasonZ_Some);
9335         uint64_t some_ref = tag_ptr(&obj->some, false);
9336         return some_ref;
9337 }
9338 static inline struct LDKCOption_ClosureReasonZ CResult_COption_ClosureReasonZDecodeErrorZ_get_ok(LDKCResult_COption_ClosureReasonZDecodeErrorZ *NONNULL_PTR owner){
9339 CHECK(owner->result_ok);
9340         return COption_ClosureReasonZ_clone(&*owner->contents.result);
9341 }
9342 uint64_t  __attribute__((export_name("TS_CResult_COption_ClosureReasonZDecodeErrorZ_get_ok"))) TS_CResult_COption_ClosureReasonZDecodeErrorZ_get_ok(uint64_t owner) {
9343         LDKCResult_COption_ClosureReasonZDecodeErrorZ* owner_conv = (LDKCResult_COption_ClosureReasonZDecodeErrorZ*)untag_ptr(owner);
9344         LDKCOption_ClosureReasonZ *ret_copy = MALLOC(sizeof(LDKCOption_ClosureReasonZ), "LDKCOption_ClosureReasonZ");
9345         *ret_copy = CResult_COption_ClosureReasonZDecodeErrorZ_get_ok(owner_conv);
9346         uint64_t ret_ref = tag_ptr(ret_copy, true);
9347         return ret_ref;
9348 }
9349
9350 static inline struct LDKDecodeError CResult_COption_ClosureReasonZDecodeErrorZ_get_err(LDKCResult_COption_ClosureReasonZDecodeErrorZ *NONNULL_PTR owner){
9351 CHECK(!owner->result_ok);
9352         return DecodeError_clone(&*owner->contents.err);
9353 }
9354 uint64_t  __attribute__((export_name("TS_CResult_COption_ClosureReasonZDecodeErrorZ_get_err"))) TS_CResult_COption_ClosureReasonZDecodeErrorZ_get_err(uint64_t owner) {
9355         LDKCResult_COption_ClosureReasonZDecodeErrorZ* owner_conv = (LDKCResult_COption_ClosureReasonZDecodeErrorZ*)untag_ptr(owner);
9356         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
9357         *ret_copy = CResult_COption_ClosureReasonZDecodeErrorZ_get_err(owner_conv);
9358         uint64_t ret_ref = tag_ptr(ret_copy, true);
9359         return ret_ref;
9360 }
9361
9362 uint32_t __attribute__((export_name("TS_LDKHTLCDestination_ty_from_ptr"))) TS_LDKHTLCDestination_ty_from_ptr(uint64_t ptr) {
9363         LDKHTLCDestination *obj = (LDKHTLCDestination*)untag_ptr(ptr);
9364         switch(obj->tag) {
9365                 case LDKHTLCDestination_NextHopChannel: return 0;
9366                 case LDKHTLCDestination_UnknownNextHop: return 1;
9367                 case LDKHTLCDestination_InvalidForward: return 2;
9368                 case LDKHTLCDestination_FailedPayment: return 3;
9369                 default: abort();
9370         }
9371 }
9372 int8_tArray __attribute__((export_name("TS_LDKHTLCDestination_NextHopChannel_get_node_id"))) TS_LDKHTLCDestination_NextHopChannel_get_node_id(uint64_t ptr) {
9373         LDKHTLCDestination *obj = (LDKHTLCDestination*)untag_ptr(ptr);
9374         assert(obj->tag == LDKHTLCDestination_NextHopChannel);
9375         int8_tArray node_id_arr = init_int8_tArray(33, __LINE__);
9376         memcpy(node_id_arr->elems, obj->next_hop_channel.node_id.compressed_form, 33);
9377         return node_id_arr;
9378 }
9379 int8_tArray __attribute__((export_name("TS_LDKHTLCDestination_NextHopChannel_get_channel_id"))) TS_LDKHTLCDestination_NextHopChannel_get_channel_id(uint64_t ptr) {
9380         LDKHTLCDestination *obj = (LDKHTLCDestination*)untag_ptr(ptr);
9381         assert(obj->tag == LDKHTLCDestination_NextHopChannel);
9382         int8_tArray channel_id_arr = init_int8_tArray(32, __LINE__);
9383         memcpy(channel_id_arr->elems, obj->next_hop_channel.channel_id.data, 32);
9384         return channel_id_arr;
9385 }
9386 int64_t __attribute__((export_name("TS_LDKHTLCDestination_UnknownNextHop_get_requested_forward_scid"))) TS_LDKHTLCDestination_UnknownNextHop_get_requested_forward_scid(uint64_t ptr) {
9387         LDKHTLCDestination *obj = (LDKHTLCDestination*)untag_ptr(ptr);
9388         assert(obj->tag == LDKHTLCDestination_UnknownNextHop);
9389         int64_t requested_forward_scid_conv = obj->unknown_next_hop.requested_forward_scid;
9390         return requested_forward_scid_conv;
9391 }
9392 int64_t __attribute__((export_name("TS_LDKHTLCDestination_InvalidForward_get_requested_forward_scid"))) TS_LDKHTLCDestination_InvalidForward_get_requested_forward_scid(uint64_t ptr) {
9393         LDKHTLCDestination *obj = (LDKHTLCDestination*)untag_ptr(ptr);
9394         assert(obj->tag == LDKHTLCDestination_InvalidForward);
9395         int64_t requested_forward_scid_conv = obj->invalid_forward.requested_forward_scid;
9396         return requested_forward_scid_conv;
9397 }
9398 int8_tArray __attribute__((export_name("TS_LDKHTLCDestination_FailedPayment_get_payment_hash"))) TS_LDKHTLCDestination_FailedPayment_get_payment_hash(uint64_t ptr) {
9399         LDKHTLCDestination *obj = (LDKHTLCDestination*)untag_ptr(ptr);
9400         assert(obj->tag == LDKHTLCDestination_FailedPayment);
9401         int8_tArray payment_hash_arr = init_int8_tArray(32, __LINE__);
9402         memcpy(payment_hash_arr->elems, obj->failed_payment.payment_hash.data, 32);
9403         return payment_hash_arr;
9404 }
9405 uint32_t __attribute__((export_name("TS_LDKCOption_HTLCDestinationZ_ty_from_ptr"))) TS_LDKCOption_HTLCDestinationZ_ty_from_ptr(uint64_t ptr) {
9406         LDKCOption_HTLCDestinationZ *obj = (LDKCOption_HTLCDestinationZ*)untag_ptr(ptr);
9407         switch(obj->tag) {
9408                 case LDKCOption_HTLCDestinationZ_Some: return 0;
9409                 case LDKCOption_HTLCDestinationZ_None: return 1;
9410                 default: abort();
9411         }
9412 }
9413 uint64_t __attribute__((export_name("TS_LDKCOption_HTLCDestinationZ_Some_get_some"))) TS_LDKCOption_HTLCDestinationZ_Some_get_some(uint64_t ptr) {
9414         LDKCOption_HTLCDestinationZ *obj = (LDKCOption_HTLCDestinationZ*)untag_ptr(ptr);
9415         assert(obj->tag == LDKCOption_HTLCDestinationZ_Some);
9416         uint64_t some_ref = tag_ptr(&obj->some, false);
9417         return some_ref;
9418 }
9419 static inline struct LDKCOption_HTLCDestinationZ CResult_COption_HTLCDestinationZDecodeErrorZ_get_ok(LDKCResult_COption_HTLCDestinationZDecodeErrorZ *NONNULL_PTR owner){
9420 CHECK(owner->result_ok);
9421         return COption_HTLCDestinationZ_clone(&*owner->contents.result);
9422 }
9423 uint64_t  __attribute__((export_name("TS_CResult_COption_HTLCDestinationZDecodeErrorZ_get_ok"))) TS_CResult_COption_HTLCDestinationZDecodeErrorZ_get_ok(uint64_t owner) {
9424         LDKCResult_COption_HTLCDestinationZDecodeErrorZ* owner_conv = (LDKCResult_COption_HTLCDestinationZDecodeErrorZ*)untag_ptr(owner);
9425         LDKCOption_HTLCDestinationZ *ret_copy = MALLOC(sizeof(LDKCOption_HTLCDestinationZ), "LDKCOption_HTLCDestinationZ");
9426         *ret_copy = CResult_COption_HTLCDestinationZDecodeErrorZ_get_ok(owner_conv);
9427         uint64_t ret_ref = tag_ptr(ret_copy, true);
9428         return ret_ref;
9429 }
9430
9431 static inline struct LDKDecodeError CResult_COption_HTLCDestinationZDecodeErrorZ_get_err(LDKCResult_COption_HTLCDestinationZDecodeErrorZ *NONNULL_PTR owner){
9432 CHECK(!owner->result_ok);
9433         return DecodeError_clone(&*owner->contents.err);
9434 }
9435 uint64_t  __attribute__((export_name("TS_CResult_COption_HTLCDestinationZDecodeErrorZ_get_err"))) TS_CResult_COption_HTLCDestinationZDecodeErrorZ_get_err(uint64_t owner) {
9436         LDKCResult_COption_HTLCDestinationZDecodeErrorZ* owner_conv = (LDKCResult_COption_HTLCDestinationZDecodeErrorZ*)untag_ptr(owner);
9437         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
9438         *ret_copy = CResult_COption_HTLCDestinationZDecodeErrorZ_get_err(owner_conv);
9439         uint64_t ret_ref = tag_ptr(ret_copy, true);
9440         return ret_ref;
9441 }
9442
9443 static inline enum LDKPaymentFailureReason CResult_PaymentFailureReasonDecodeErrorZ_get_ok(LDKCResult_PaymentFailureReasonDecodeErrorZ *NONNULL_PTR owner){
9444 CHECK(owner->result_ok);
9445         return PaymentFailureReason_clone(&*owner->contents.result);
9446 }
9447 uint32_t  __attribute__((export_name("TS_CResult_PaymentFailureReasonDecodeErrorZ_get_ok"))) TS_CResult_PaymentFailureReasonDecodeErrorZ_get_ok(uint64_t owner) {
9448         LDKCResult_PaymentFailureReasonDecodeErrorZ* owner_conv = (LDKCResult_PaymentFailureReasonDecodeErrorZ*)untag_ptr(owner);
9449         uint32_t ret_conv = LDKPaymentFailureReason_to_js(CResult_PaymentFailureReasonDecodeErrorZ_get_ok(owner_conv));
9450         return ret_conv;
9451 }
9452
9453 static inline struct LDKDecodeError CResult_PaymentFailureReasonDecodeErrorZ_get_err(LDKCResult_PaymentFailureReasonDecodeErrorZ *NONNULL_PTR owner){
9454 CHECK(!owner->result_ok);
9455         return DecodeError_clone(&*owner->contents.err);
9456 }
9457 uint64_t  __attribute__((export_name("TS_CResult_PaymentFailureReasonDecodeErrorZ_get_err"))) TS_CResult_PaymentFailureReasonDecodeErrorZ_get_err(uint64_t owner) {
9458         LDKCResult_PaymentFailureReasonDecodeErrorZ* owner_conv = (LDKCResult_PaymentFailureReasonDecodeErrorZ*)untag_ptr(owner);
9459         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
9460         *ret_copy = CResult_PaymentFailureReasonDecodeErrorZ_get_err(owner_conv);
9461         uint64_t ret_ref = tag_ptr(ret_copy, true);
9462         return ret_ref;
9463 }
9464
9465 uint32_t __attribute__((export_name("TS_LDKCOption_U128Z_ty_from_ptr"))) TS_LDKCOption_U128Z_ty_from_ptr(uint64_t ptr) {
9466         LDKCOption_U128Z *obj = (LDKCOption_U128Z*)untag_ptr(ptr);
9467         switch(obj->tag) {
9468                 case LDKCOption_U128Z_Some: return 0;
9469                 case LDKCOption_U128Z_None: return 1;
9470                 default: abort();
9471         }
9472 }
9473 int8_tArray __attribute__((export_name("TS_LDKCOption_U128Z_Some_get_some"))) TS_LDKCOption_U128Z_Some_get_some(uint64_t ptr) {
9474         LDKCOption_U128Z *obj = (LDKCOption_U128Z*)untag_ptr(ptr);
9475         assert(obj->tag == LDKCOption_U128Z_Some);
9476         int8_tArray some_arr = init_int8_tArray(16, __LINE__);
9477         memcpy(some_arr->elems, obj->some.le_bytes, 16);
9478         return some_arr;
9479 }
9480 static inline LDKCVec_ClaimedHTLCZ CVec_ClaimedHTLCZ_clone(const LDKCVec_ClaimedHTLCZ *orig) {
9481         LDKCVec_ClaimedHTLCZ ret = { .data = MALLOC(sizeof(LDKClaimedHTLC) * orig->datalen, "LDKCVec_ClaimedHTLCZ clone bytes"), .datalen = orig->datalen };
9482         for (size_t i = 0; i < ret.datalen; i++) {
9483                 ret.data[i] = ClaimedHTLC_clone(&orig->data[i]);
9484         }
9485         return ret;
9486 }
9487 uint32_t __attribute__((export_name("TS_LDKCOption_PaymentFailureReasonZ_ty_from_ptr"))) TS_LDKCOption_PaymentFailureReasonZ_ty_from_ptr(uint64_t ptr) {
9488         LDKCOption_PaymentFailureReasonZ *obj = (LDKCOption_PaymentFailureReasonZ*)untag_ptr(ptr);
9489         switch(obj->tag) {
9490                 case LDKCOption_PaymentFailureReasonZ_Some: return 0;
9491                 case LDKCOption_PaymentFailureReasonZ_None: return 1;
9492                 default: abort();
9493         }
9494 }
9495 uint32_t __attribute__((export_name("TS_LDKCOption_PaymentFailureReasonZ_Some_get_some"))) TS_LDKCOption_PaymentFailureReasonZ_Some_get_some(uint64_t ptr) {
9496         LDKCOption_PaymentFailureReasonZ *obj = (LDKCOption_PaymentFailureReasonZ*)untag_ptr(ptr);
9497         assert(obj->tag == LDKCOption_PaymentFailureReasonZ_Some);
9498         uint32_t some_conv = LDKPaymentFailureReason_to_js(obj->some);
9499         return some_conv;
9500 }
9501 uint32_t __attribute__((export_name("TS_LDKBumpTransactionEvent_ty_from_ptr"))) TS_LDKBumpTransactionEvent_ty_from_ptr(uint64_t ptr) {
9502         LDKBumpTransactionEvent *obj = (LDKBumpTransactionEvent*)untag_ptr(ptr);
9503         switch(obj->tag) {
9504                 case LDKBumpTransactionEvent_ChannelClose: return 0;
9505                 case LDKBumpTransactionEvent_HTLCResolution: return 1;
9506                 default: abort();
9507         }
9508 }
9509 int8_tArray __attribute__((export_name("TS_LDKBumpTransactionEvent_ChannelClose_get_claim_id"))) TS_LDKBumpTransactionEvent_ChannelClose_get_claim_id(uint64_t ptr) {
9510         LDKBumpTransactionEvent *obj = (LDKBumpTransactionEvent*)untag_ptr(ptr);
9511         assert(obj->tag == LDKBumpTransactionEvent_ChannelClose);
9512         int8_tArray claim_id_arr = init_int8_tArray(32, __LINE__);
9513         memcpy(claim_id_arr->elems, obj->channel_close.claim_id.data, 32);
9514         return claim_id_arr;
9515 }
9516 int32_t __attribute__((export_name("TS_LDKBumpTransactionEvent_ChannelClose_get_package_target_feerate_sat_per_1000_weight"))) TS_LDKBumpTransactionEvent_ChannelClose_get_package_target_feerate_sat_per_1000_weight(uint64_t ptr) {
9517         LDKBumpTransactionEvent *obj = (LDKBumpTransactionEvent*)untag_ptr(ptr);
9518         assert(obj->tag == LDKBumpTransactionEvent_ChannelClose);
9519         int32_t package_target_feerate_sat_per_1000_weight_conv = obj->channel_close.package_target_feerate_sat_per_1000_weight;
9520         return package_target_feerate_sat_per_1000_weight_conv;
9521 }
9522 int8_tArray __attribute__((export_name("TS_LDKBumpTransactionEvent_ChannelClose_get_commitment_tx"))) TS_LDKBumpTransactionEvent_ChannelClose_get_commitment_tx(uint64_t ptr) {
9523         LDKBumpTransactionEvent *obj = (LDKBumpTransactionEvent*)untag_ptr(ptr);
9524         assert(obj->tag == LDKBumpTransactionEvent_ChannelClose);
9525         LDKTransaction commitment_tx_var = obj->channel_close.commitment_tx;
9526                         int8_tArray commitment_tx_arr = init_int8_tArray(commitment_tx_var.datalen, __LINE__);
9527                         memcpy(commitment_tx_arr->elems, commitment_tx_var.data, commitment_tx_var.datalen);
9528         return commitment_tx_arr;
9529 }
9530 int64_t __attribute__((export_name("TS_LDKBumpTransactionEvent_ChannelClose_get_commitment_tx_fee_satoshis"))) TS_LDKBumpTransactionEvent_ChannelClose_get_commitment_tx_fee_satoshis(uint64_t ptr) {
9531         LDKBumpTransactionEvent *obj = (LDKBumpTransactionEvent*)untag_ptr(ptr);
9532         assert(obj->tag == LDKBumpTransactionEvent_ChannelClose);
9533         int64_t commitment_tx_fee_satoshis_conv = obj->channel_close.commitment_tx_fee_satoshis;
9534         return commitment_tx_fee_satoshis_conv;
9535 }
9536 uint64_t __attribute__((export_name("TS_LDKBumpTransactionEvent_ChannelClose_get_anchor_descriptor"))) TS_LDKBumpTransactionEvent_ChannelClose_get_anchor_descriptor(uint64_t ptr) {
9537         LDKBumpTransactionEvent *obj = (LDKBumpTransactionEvent*)untag_ptr(ptr);
9538         assert(obj->tag == LDKBumpTransactionEvent_ChannelClose);
9539         LDKAnchorDescriptor anchor_descriptor_var = obj->channel_close.anchor_descriptor;
9540                         uint64_t anchor_descriptor_ref = 0;
9541                         CHECK_INNER_FIELD_ACCESS_OR_NULL(anchor_descriptor_var);
9542                         anchor_descriptor_ref = tag_ptr(anchor_descriptor_var.inner, false);
9543         return anchor_descriptor_ref;
9544 }
9545 uint64_tArray __attribute__((export_name("TS_LDKBumpTransactionEvent_ChannelClose_get_pending_htlcs"))) TS_LDKBumpTransactionEvent_ChannelClose_get_pending_htlcs(uint64_t ptr) {
9546         LDKBumpTransactionEvent *obj = (LDKBumpTransactionEvent*)untag_ptr(ptr);
9547         assert(obj->tag == LDKBumpTransactionEvent_ChannelClose);
9548         LDKCVec_HTLCOutputInCommitmentZ pending_htlcs_var = obj->channel_close.pending_htlcs;
9549                         uint64_tArray pending_htlcs_arr = NULL;
9550                         pending_htlcs_arr = init_uint64_tArray(pending_htlcs_var.datalen, __LINE__);
9551                         uint64_t *pending_htlcs_arr_ptr = (uint64_t*)(((uint8_t*)pending_htlcs_arr) + 8);
9552                         for (size_t y = 0; y < pending_htlcs_var.datalen; y++) {
9553                                 LDKHTLCOutputInCommitment pending_htlcs_conv_24_var = pending_htlcs_var.data[y];
9554                                 uint64_t pending_htlcs_conv_24_ref = 0;
9555                                 CHECK_INNER_FIELD_ACCESS_OR_NULL(pending_htlcs_conv_24_var);
9556                                 pending_htlcs_conv_24_ref = tag_ptr(pending_htlcs_conv_24_var.inner, false);
9557                                 pending_htlcs_arr_ptr[y] = pending_htlcs_conv_24_ref;
9558                         }
9559                         
9560         return pending_htlcs_arr;
9561 }
9562 int8_tArray __attribute__((export_name("TS_LDKBumpTransactionEvent_HTLCResolution_get_claim_id"))) TS_LDKBumpTransactionEvent_HTLCResolution_get_claim_id(uint64_t ptr) {
9563         LDKBumpTransactionEvent *obj = (LDKBumpTransactionEvent*)untag_ptr(ptr);
9564         assert(obj->tag == LDKBumpTransactionEvent_HTLCResolution);
9565         int8_tArray claim_id_arr = init_int8_tArray(32, __LINE__);
9566         memcpy(claim_id_arr->elems, obj->htlc_resolution.claim_id.data, 32);
9567         return claim_id_arr;
9568 }
9569 int32_t __attribute__((export_name("TS_LDKBumpTransactionEvent_HTLCResolution_get_target_feerate_sat_per_1000_weight"))) TS_LDKBumpTransactionEvent_HTLCResolution_get_target_feerate_sat_per_1000_weight(uint64_t ptr) {
9570         LDKBumpTransactionEvent *obj = (LDKBumpTransactionEvent*)untag_ptr(ptr);
9571         assert(obj->tag == LDKBumpTransactionEvent_HTLCResolution);
9572         int32_t target_feerate_sat_per_1000_weight_conv = obj->htlc_resolution.target_feerate_sat_per_1000_weight;
9573         return target_feerate_sat_per_1000_weight_conv;
9574 }
9575 uint64_tArray __attribute__((export_name("TS_LDKBumpTransactionEvent_HTLCResolution_get_htlc_descriptors"))) TS_LDKBumpTransactionEvent_HTLCResolution_get_htlc_descriptors(uint64_t ptr) {
9576         LDKBumpTransactionEvent *obj = (LDKBumpTransactionEvent*)untag_ptr(ptr);
9577         assert(obj->tag == LDKBumpTransactionEvent_HTLCResolution);
9578         LDKCVec_HTLCDescriptorZ htlc_descriptors_var = obj->htlc_resolution.htlc_descriptors;
9579                         uint64_tArray htlc_descriptors_arr = NULL;
9580                         htlc_descriptors_arr = init_uint64_tArray(htlc_descriptors_var.datalen, __LINE__);
9581                         uint64_t *htlc_descriptors_arr_ptr = (uint64_t*)(((uint8_t*)htlc_descriptors_arr) + 8);
9582                         for (size_t q = 0; q < htlc_descriptors_var.datalen; q++) {
9583                                 LDKHTLCDescriptor htlc_descriptors_conv_16_var = htlc_descriptors_var.data[q];
9584                                 uint64_t htlc_descriptors_conv_16_ref = 0;
9585                                 CHECK_INNER_FIELD_ACCESS_OR_NULL(htlc_descriptors_conv_16_var);
9586                                 htlc_descriptors_conv_16_ref = tag_ptr(htlc_descriptors_conv_16_var.inner, false);
9587                                 htlc_descriptors_arr_ptr[q] = htlc_descriptors_conv_16_ref;
9588                         }
9589                         
9590         return htlc_descriptors_arr;
9591 }
9592 int32_t __attribute__((export_name("TS_LDKBumpTransactionEvent_HTLCResolution_get_tx_lock_time"))) TS_LDKBumpTransactionEvent_HTLCResolution_get_tx_lock_time(uint64_t ptr) {
9593         LDKBumpTransactionEvent *obj = (LDKBumpTransactionEvent*)untag_ptr(ptr);
9594         assert(obj->tag == LDKBumpTransactionEvent_HTLCResolution);
9595         int32_t tx_lock_time_conv = obj->htlc_resolution.tx_lock_time;
9596         return tx_lock_time_conv;
9597 }
9598 uint32_t __attribute__((export_name("TS_LDKEvent_ty_from_ptr"))) TS_LDKEvent_ty_from_ptr(uint64_t ptr) {
9599         LDKEvent *obj = (LDKEvent*)untag_ptr(ptr);
9600         switch(obj->tag) {
9601                 case LDKEvent_FundingGenerationReady: return 0;
9602                 case LDKEvent_PaymentClaimable: return 1;
9603                 case LDKEvent_PaymentClaimed: return 2;
9604                 case LDKEvent_InvoiceRequestFailed: return 3;
9605                 case LDKEvent_PaymentSent: return 4;
9606                 case LDKEvent_PaymentFailed: return 5;
9607                 case LDKEvent_PaymentPathSuccessful: return 6;
9608                 case LDKEvent_PaymentPathFailed: return 7;
9609                 case LDKEvent_ProbeSuccessful: return 8;
9610                 case LDKEvent_ProbeFailed: return 9;
9611                 case LDKEvent_PendingHTLCsForwardable: return 10;
9612                 case LDKEvent_HTLCIntercepted: return 11;
9613                 case LDKEvent_SpendableOutputs: return 12;
9614                 case LDKEvent_PaymentForwarded: return 13;
9615                 case LDKEvent_ChannelPending: return 14;
9616                 case LDKEvent_ChannelReady: return 15;
9617                 case LDKEvent_ChannelClosed: return 16;
9618                 case LDKEvent_DiscardFunding: return 17;
9619                 case LDKEvent_OpenChannelRequest: return 18;
9620                 case LDKEvent_HTLCHandlingFailed: return 19;
9621                 case LDKEvent_BumpTransaction: return 20;
9622                 default: abort();
9623         }
9624 }
9625 int8_tArray __attribute__((export_name("TS_LDKEvent_FundingGenerationReady_get_temporary_channel_id"))) TS_LDKEvent_FundingGenerationReady_get_temporary_channel_id(uint64_t ptr) {
9626         LDKEvent *obj = (LDKEvent*)untag_ptr(ptr);
9627         assert(obj->tag == LDKEvent_FundingGenerationReady);
9628         int8_tArray temporary_channel_id_arr = init_int8_tArray(32, __LINE__);
9629         memcpy(temporary_channel_id_arr->elems, obj->funding_generation_ready.temporary_channel_id.data, 32);
9630         return temporary_channel_id_arr;
9631 }
9632 int8_tArray __attribute__((export_name("TS_LDKEvent_FundingGenerationReady_get_counterparty_node_id"))) TS_LDKEvent_FundingGenerationReady_get_counterparty_node_id(uint64_t ptr) {
9633         LDKEvent *obj = (LDKEvent*)untag_ptr(ptr);
9634         assert(obj->tag == LDKEvent_FundingGenerationReady);
9635         int8_tArray counterparty_node_id_arr = init_int8_tArray(33, __LINE__);
9636         memcpy(counterparty_node_id_arr->elems, obj->funding_generation_ready.counterparty_node_id.compressed_form, 33);
9637         return counterparty_node_id_arr;
9638 }
9639 int64_t __attribute__((export_name("TS_LDKEvent_FundingGenerationReady_get_channel_value_satoshis"))) TS_LDKEvent_FundingGenerationReady_get_channel_value_satoshis(uint64_t ptr) {
9640         LDKEvent *obj = (LDKEvent*)untag_ptr(ptr);
9641         assert(obj->tag == LDKEvent_FundingGenerationReady);
9642         int64_t channel_value_satoshis_conv = obj->funding_generation_ready.channel_value_satoshis;
9643         return channel_value_satoshis_conv;
9644 }
9645 int8_tArray __attribute__((export_name("TS_LDKEvent_FundingGenerationReady_get_output_script"))) TS_LDKEvent_FundingGenerationReady_get_output_script(uint64_t ptr) {
9646         LDKEvent *obj = (LDKEvent*)untag_ptr(ptr);
9647         assert(obj->tag == LDKEvent_FundingGenerationReady);
9648         LDKCVec_u8Z output_script_var = obj->funding_generation_ready.output_script;
9649                         int8_tArray output_script_arr = init_int8_tArray(output_script_var.datalen, __LINE__);
9650                         memcpy(output_script_arr->elems, output_script_var.data, output_script_var.datalen);
9651         return output_script_arr;
9652 }
9653 int8_tArray __attribute__((export_name("TS_LDKEvent_FundingGenerationReady_get_user_channel_id"))) TS_LDKEvent_FundingGenerationReady_get_user_channel_id(uint64_t ptr) {
9654         LDKEvent *obj = (LDKEvent*)untag_ptr(ptr);
9655         assert(obj->tag == LDKEvent_FundingGenerationReady);
9656         int8_tArray user_channel_id_arr = init_int8_tArray(16, __LINE__);
9657         memcpy(user_channel_id_arr->elems, obj->funding_generation_ready.user_channel_id.le_bytes, 16);
9658         return user_channel_id_arr;
9659 }
9660 int8_tArray __attribute__((export_name("TS_LDKEvent_PaymentClaimable_get_receiver_node_id"))) TS_LDKEvent_PaymentClaimable_get_receiver_node_id(uint64_t ptr) {
9661         LDKEvent *obj = (LDKEvent*)untag_ptr(ptr);
9662         assert(obj->tag == LDKEvent_PaymentClaimable);
9663         int8_tArray receiver_node_id_arr = init_int8_tArray(33, __LINE__);
9664         memcpy(receiver_node_id_arr->elems, obj->payment_claimable.receiver_node_id.compressed_form, 33);
9665         return receiver_node_id_arr;
9666 }
9667 int8_tArray __attribute__((export_name("TS_LDKEvent_PaymentClaimable_get_payment_hash"))) TS_LDKEvent_PaymentClaimable_get_payment_hash(uint64_t ptr) {
9668         LDKEvent *obj = (LDKEvent*)untag_ptr(ptr);
9669         assert(obj->tag == LDKEvent_PaymentClaimable);
9670         int8_tArray payment_hash_arr = init_int8_tArray(32, __LINE__);
9671         memcpy(payment_hash_arr->elems, obj->payment_claimable.payment_hash.data, 32);
9672         return payment_hash_arr;
9673 }
9674 uint64_t __attribute__((export_name("TS_LDKEvent_PaymentClaimable_get_onion_fields"))) TS_LDKEvent_PaymentClaimable_get_onion_fields(uint64_t ptr) {
9675         LDKEvent *obj = (LDKEvent*)untag_ptr(ptr);
9676         assert(obj->tag == LDKEvent_PaymentClaimable);
9677         LDKRecipientOnionFields onion_fields_var = obj->payment_claimable.onion_fields;
9678                         uint64_t onion_fields_ref = 0;
9679                         CHECK_INNER_FIELD_ACCESS_OR_NULL(onion_fields_var);
9680                         onion_fields_ref = tag_ptr(onion_fields_var.inner, false);
9681         return onion_fields_ref;
9682 }
9683 int64_t __attribute__((export_name("TS_LDKEvent_PaymentClaimable_get_amount_msat"))) TS_LDKEvent_PaymentClaimable_get_amount_msat(uint64_t ptr) {
9684         LDKEvent *obj = (LDKEvent*)untag_ptr(ptr);
9685         assert(obj->tag == LDKEvent_PaymentClaimable);
9686         int64_t amount_msat_conv = obj->payment_claimable.amount_msat;
9687         return amount_msat_conv;
9688 }
9689 int64_t __attribute__((export_name("TS_LDKEvent_PaymentClaimable_get_counterparty_skimmed_fee_msat"))) TS_LDKEvent_PaymentClaimable_get_counterparty_skimmed_fee_msat(uint64_t ptr) {
9690         LDKEvent *obj = (LDKEvent*)untag_ptr(ptr);
9691         assert(obj->tag == LDKEvent_PaymentClaimable);
9692         int64_t counterparty_skimmed_fee_msat_conv = obj->payment_claimable.counterparty_skimmed_fee_msat;
9693         return counterparty_skimmed_fee_msat_conv;
9694 }
9695 uint64_t __attribute__((export_name("TS_LDKEvent_PaymentClaimable_get_purpose"))) TS_LDKEvent_PaymentClaimable_get_purpose(uint64_t ptr) {
9696         LDKEvent *obj = (LDKEvent*)untag_ptr(ptr);
9697         assert(obj->tag == LDKEvent_PaymentClaimable);
9698         uint64_t purpose_ref = tag_ptr(&obj->payment_claimable.purpose, false);
9699         return purpose_ref;
9700 }
9701 uint64_t __attribute__((export_name("TS_LDKEvent_PaymentClaimable_get_via_channel_id"))) TS_LDKEvent_PaymentClaimable_get_via_channel_id(uint64_t ptr) {
9702         LDKEvent *obj = (LDKEvent*)untag_ptr(ptr);
9703         assert(obj->tag == LDKEvent_PaymentClaimable);
9704         uint64_t via_channel_id_ref = tag_ptr(&obj->payment_claimable.via_channel_id, false);
9705         return via_channel_id_ref;
9706 }
9707 uint64_t __attribute__((export_name("TS_LDKEvent_PaymentClaimable_get_via_user_channel_id"))) TS_LDKEvent_PaymentClaimable_get_via_user_channel_id(uint64_t ptr) {
9708         LDKEvent *obj = (LDKEvent*)untag_ptr(ptr);
9709         assert(obj->tag == LDKEvent_PaymentClaimable);
9710         uint64_t via_user_channel_id_ref = tag_ptr(&obj->payment_claimable.via_user_channel_id, false);
9711         return via_user_channel_id_ref;
9712 }
9713 uint64_t __attribute__((export_name("TS_LDKEvent_PaymentClaimable_get_claim_deadline"))) TS_LDKEvent_PaymentClaimable_get_claim_deadline(uint64_t ptr) {
9714         LDKEvent *obj = (LDKEvent*)untag_ptr(ptr);
9715         assert(obj->tag == LDKEvent_PaymentClaimable);
9716         uint64_t claim_deadline_ref = tag_ptr(&obj->payment_claimable.claim_deadline, false);
9717         return claim_deadline_ref;
9718 }
9719 int8_tArray __attribute__((export_name("TS_LDKEvent_PaymentClaimed_get_receiver_node_id"))) TS_LDKEvent_PaymentClaimed_get_receiver_node_id(uint64_t ptr) {
9720         LDKEvent *obj = (LDKEvent*)untag_ptr(ptr);
9721         assert(obj->tag == LDKEvent_PaymentClaimed);
9722         int8_tArray receiver_node_id_arr = init_int8_tArray(33, __LINE__);
9723         memcpy(receiver_node_id_arr->elems, obj->payment_claimed.receiver_node_id.compressed_form, 33);
9724         return receiver_node_id_arr;
9725 }
9726 int8_tArray __attribute__((export_name("TS_LDKEvent_PaymentClaimed_get_payment_hash"))) TS_LDKEvent_PaymentClaimed_get_payment_hash(uint64_t ptr) {
9727         LDKEvent *obj = (LDKEvent*)untag_ptr(ptr);
9728         assert(obj->tag == LDKEvent_PaymentClaimed);
9729         int8_tArray payment_hash_arr = init_int8_tArray(32, __LINE__);
9730         memcpy(payment_hash_arr->elems, obj->payment_claimed.payment_hash.data, 32);
9731         return payment_hash_arr;
9732 }
9733 int64_t __attribute__((export_name("TS_LDKEvent_PaymentClaimed_get_amount_msat"))) TS_LDKEvent_PaymentClaimed_get_amount_msat(uint64_t ptr) {
9734         LDKEvent *obj = (LDKEvent*)untag_ptr(ptr);
9735         assert(obj->tag == LDKEvent_PaymentClaimed);
9736         int64_t amount_msat_conv = obj->payment_claimed.amount_msat;
9737         return amount_msat_conv;
9738 }
9739 uint64_t __attribute__((export_name("TS_LDKEvent_PaymentClaimed_get_purpose"))) TS_LDKEvent_PaymentClaimed_get_purpose(uint64_t ptr) {
9740         LDKEvent *obj = (LDKEvent*)untag_ptr(ptr);
9741         assert(obj->tag == LDKEvent_PaymentClaimed);
9742         uint64_t purpose_ref = tag_ptr(&obj->payment_claimed.purpose, false);
9743         return purpose_ref;
9744 }
9745 uint64_tArray __attribute__((export_name("TS_LDKEvent_PaymentClaimed_get_htlcs"))) TS_LDKEvent_PaymentClaimed_get_htlcs(uint64_t ptr) {
9746         LDKEvent *obj = (LDKEvent*)untag_ptr(ptr);
9747         assert(obj->tag == LDKEvent_PaymentClaimed);
9748         LDKCVec_ClaimedHTLCZ htlcs_var = obj->payment_claimed.htlcs;
9749                         uint64_tArray htlcs_arr = NULL;
9750                         htlcs_arr = init_uint64_tArray(htlcs_var.datalen, __LINE__);
9751                         uint64_t *htlcs_arr_ptr = (uint64_t*)(((uint8_t*)htlcs_arr) + 8);
9752                         for (size_t n = 0; n < htlcs_var.datalen; n++) {
9753                                 LDKClaimedHTLC htlcs_conv_13_var = htlcs_var.data[n];
9754                                 uint64_t htlcs_conv_13_ref = 0;
9755                                 CHECK_INNER_FIELD_ACCESS_OR_NULL(htlcs_conv_13_var);
9756                                 htlcs_conv_13_ref = tag_ptr(htlcs_conv_13_var.inner, false);
9757                                 htlcs_arr_ptr[n] = htlcs_conv_13_ref;
9758                         }
9759                         
9760         return htlcs_arr;
9761 }
9762 uint64_t __attribute__((export_name("TS_LDKEvent_PaymentClaimed_get_sender_intended_total_msat"))) TS_LDKEvent_PaymentClaimed_get_sender_intended_total_msat(uint64_t ptr) {
9763         LDKEvent *obj = (LDKEvent*)untag_ptr(ptr);
9764         assert(obj->tag == LDKEvent_PaymentClaimed);
9765         uint64_t sender_intended_total_msat_ref = tag_ptr(&obj->payment_claimed.sender_intended_total_msat, false);
9766         return sender_intended_total_msat_ref;
9767 }
9768 int8_tArray __attribute__((export_name("TS_LDKEvent_InvoiceRequestFailed_get_payment_id"))) TS_LDKEvent_InvoiceRequestFailed_get_payment_id(uint64_t ptr) {
9769         LDKEvent *obj = (LDKEvent*)untag_ptr(ptr);
9770         assert(obj->tag == LDKEvent_InvoiceRequestFailed);
9771         int8_tArray payment_id_arr = init_int8_tArray(32, __LINE__);
9772         memcpy(payment_id_arr->elems, obj->invoice_request_failed.payment_id.data, 32);
9773         return payment_id_arr;
9774 }
9775 uint64_t __attribute__((export_name("TS_LDKEvent_PaymentSent_get_payment_id"))) TS_LDKEvent_PaymentSent_get_payment_id(uint64_t ptr) {
9776         LDKEvent *obj = (LDKEvent*)untag_ptr(ptr);
9777         assert(obj->tag == LDKEvent_PaymentSent);
9778         uint64_t payment_id_ref = tag_ptr(&obj->payment_sent.payment_id, false);
9779         return payment_id_ref;
9780 }
9781 int8_tArray __attribute__((export_name("TS_LDKEvent_PaymentSent_get_payment_preimage"))) TS_LDKEvent_PaymentSent_get_payment_preimage(uint64_t ptr) {
9782         LDKEvent *obj = (LDKEvent*)untag_ptr(ptr);
9783         assert(obj->tag == LDKEvent_PaymentSent);
9784         int8_tArray payment_preimage_arr = init_int8_tArray(32, __LINE__);
9785         memcpy(payment_preimage_arr->elems, obj->payment_sent.payment_preimage.data, 32);
9786         return payment_preimage_arr;
9787 }
9788 int8_tArray __attribute__((export_name("TS_LDKEvent_PaymentSent_get_payment_hash"))) TS_LDKEvent_PaymentSent_get_payment_hash(uint64_t ptr) {
9789         LDKEvent *obj = (LDKEvent*)untag_ptr(ptr);
9790         assert(obj->tag == LDKEvent_PaymentSent);
9791         int8_tArray payment_hash_arr = init_int8_tArray(32, __LINE__);
9792         memcpy(payment_hash_arr->elems, obj->payment_sent.payment_hash.data, 32);
9793         return payment_hash_arr;
9794 }
9795 uint64_t __attribute__((export_name("TS_LDKEvent_PaymentSent_get_fee_paid_msat"))) TS_LDKEvent_PaymentSent_get_fee_paid_msat(uint64_t ptr) {
9796         LDKEvent *obj = (LDKEvent*)untag_ptr(ptr);
9797         assert(obj->tag == LDKEvent_PaymentSent);
9798         uint64_t fee_paid_msat_ref = tag_ptr(&obj->payment_sent.fee_paid_msat, false);
9799         return fee_paid_msat_ref;
9800 }
9801 int8_tArray __attribute__((export_name("TS_LDKEvent_PaymentFailed_get_payment_id"))) TS_LDKEvent_PaymentFailed_get_payment_id(uint64_t ptr) {
9802         LDKEvent *obj = (LDKEvent*)untag_ptr(ptr);
9803         assert(obj->tag == LDKEvent_PaymentFailed);
9804         int8_tArray payment_id_arr = init_int8_tArray(32, __LINE__);
9805         memcpy(payment_id_arr->elems, obj->payment_failed.payment_id.data, 32);
9806         return payment_id_arr;
9807 }
9808 int8_tArray __attribute__((export_name("TS_LDKEvent_PaymentFailed_get_payment_hash"))) TS_LDKEvent_PaymentFailed_get_payment_hash(uint64_t ptr) {
9809         LDKEvent *obj = (LDKEvent*)untag_ptr(ptr);
9810         assert(obj->tag == LDKEvent_PaymentFailed);
9811         int8_tArray payment_hash_arr = init_int8_tArray(32, __LINE__);
9812         memcpy(payment_hash_arr->elems, obj->payment_failed.payment_hash.data, 32);
9813         return payment_hash_arr;
9814 }
9815 uint64_t __attribute__((export_name("TS_LDKEvent_PaymentFailed_get_reason"))) TS_LDKEvent_PaymentFailed_get_reason(uint64_t ptr) {
9816         LDKEvent *obj = (LDKEvent*)untag_ptr(ptr);
9817         assert(obj->tag == LDKEvent_PaymentFailed);
9818         uint64_t reason_ref = tag_ptr(&obj->payment_failed.reason, false);
9819         return reason_ref;
9820 }
9821 int8_tArray __attribute__((export_name("TS_LDKEvent_PaymentPathSuccessful_get_payment_id"))) TS_LDKEvent_PaymentPathSuccessful_get_payment_id(uint64_t ptr) {
9822         LDKEvent *obj = (LDKEvent*)untag_ptr(ptr);
9823         assert(obj->tag == LDKEvent_PaymentPathSuccessful);
9824         int8_tArray payment_id_arr = init_int8_tArray(32, __LINE__);
9825         memcpy(payment_id_arr->elems, obj->payment_path_successful.payment_id.data, 32);
9826         return payment_id_arr;
9827 }
9828 uint64_t __attribute__((export_name("TS_LDKEvent_PaymentPathSuccessful_get_payment_hash"))) TS_LDKEvent_PaymentPathSuccessful_get_payment_hash(uint64_t ptr) {
9829         LDKEvent *obj = (LDKEvent*)untag_ptr(ptr);
9830         assert(obj->tag == LDKEvent_PaymentPathSuccessful);
9831         uint64_t payment_hash_ref = tag_ptr(&obj->payment_path_successful.payment_hash, false);
9832         return payment_hash_ref;
9833 }
9834 uint64_t __attribute__((export_name("TS_LDKEvent_PaymentPathSuccessful_get_path"))) TS_LDKEvent_PaymentPathSuccessful_get_path(uint64_t ptr) {
9835         LDKEvent *obj = (LDKEvent*)untag_ptr(ptr);
9836         assert(obj->tag == LDKEvent_PaymentPathSuccessful);
9837         LDKPath path_var = obj->payment_path_successful.path;
9838                         uint64_t path_ref = 0;
9839                         CHECK_INNER_FIELD_ACCESS_OR_NULL(path_var);
9840                         path_ref = tag_ptr(path_var.inner, false);
9841         return path_ref;
9842 }
9843 uint64_t __attribute__((export_name("TS_LDKEvent_PaymentPathFailed_get_payment_id"))) TS_LDKEvent_PaymentPathFailed_get_payment_id(uint64_t ptr) {
9844         LDKEvent *obj = (LDKEvent*)untag_ptr(ptr);
9845         assert(obj->tag == LDKEvent_PaymentPathFailed);
9846         uint64_t payment_id_ref = tag_ptr(&obj->payment_path_failed.payment_id, false);
9847         return payment_id_ref;
9848 }
9849 int8_tArray __attribute__((export_name("TS_LDKEvent_PaymentPathFailed_get_payment_hash"))) TS_LDKEvent_PaymentPathFailed_get_payment_hash(uint64_t ptr) {
9850         LDKEvent *obj = (LDKEvent*)untag_ptr(ptr);
9851         assert(obj->tag == LDKEvent_PaymentPathFailed);
9852         int8_tArray payment_hash_arr = init_int8_tArray(32, __LINE__);
9853         memcpy(payment_hash_arr->elems, obj->payment_path_failed.payment_hash.data, 32);
9854         return payment_hash_arr;
9855 }
9856 jboolean __attribute__((export_name("TS_LDKEvent_PaymentPathFailed_get_payment_failed_permanently"))) TS_LDKEvent_PaymentPathFailed_get_payment_failed_permanently(uint64_t ptr) {
9857         LDKEvent *obj = (LDKEvent*)untag_ptr(ptr);
9858         assert(obj->tag == LDKEvent_PaymentPathFailed);
9859         jboolean payment_failed_permanently_conv = obj->payment_path_failed.payment_failed_permanently;
9860         return payment_failed_permanently_conv;
9861 }
9862 uint64_t __attribute__((export_name("TS_LDKEvent_PaymentPathFailed_get_failure"))) TS_LDKEvent_PaymentPathFailed_get_failure(uint64_t ptr) {
9863         LDKEvent *obj = (LDKEvent*)untag_ptr(ptr);
9864         assert(obj->tag == LDKEvent_PaymentPathFailed);
9865         uint64_t failure_ref = tag_ptr(&obj->payment_path_failed.failure, false);
9866         return failure_ref;
9867 }
9868 uint64_t __attribute__((export_name("TS_LDKEvent_PaymentPathFailed_get_path"))) TS_LDKEvent_PaymentPathFailed_get_path(uint64_t ptr) {
9869         LDKEvent *obj = (LDKEvent*)untag_ptr(ptr);
9870         assert(obj->tag == LDKEvent_PaymentPathFailed);
9871         LDKPath path_var = obj->payment_path_failed.path;
9872                         uint64_t path_ref = 0;
9873                         CHECK_INNER_FIELD_ACCESS_OR_NULL(path_var);
9874                         path_ref = tag_ptr(path_var.inner, false);
9875         return path_ref;
9876 }
9877 uint64_t __attribute__((export_name("TS_LDKEvent_PaymentPathFailed_get_short_channel_id"))) TS_LDKEvent_PaymentPathFailed_get_short_channel_id(uint64_t ptr) {
9878         LDKEvent *obj = (LDKEvent*)untag_ptr(ptr);
9879         assert(obj->tag == LDKEvent_PaymentPathFailed);
9880         uint64_t short_channel_id_ref = tag_ptr(&obj->payment_path_failed.short_channel_id, false);
9881         return short_channel_id_ref;
9882 }
9883 int8_tArray __attribute__((export_name("TS_LDKEvent_ProbeSuccessful_get_payment_id"))) TS_LDKEvent_ProbeSuccessful_get_payment_id(uint64_t ptr) {
9884         LDKEvent *obj = (LDKEvent*)untag_ptr(ptr);
9885         assert(obj->tag == LDKEvent_ProbeSuccessful);
9886         int8_tArray payment_id_arr = init_int8_tArray(32, __LINE__);
9887         memcpy(payment_id_arr->elems, obj->probe_successful.payment_id.data, 32);
9888         return payment_id_arr;
9889 }
9890 int8_tArray __attribute__((export_name("TS_LDKEvent_ProbeSuccessful_get_payment_hash"))) TS_LDKEvent_ProbeSuccessful_get_payment_hash(uint64_t ptr) {
9891         LDKEvent *obj = (LDKEvent*)untag_ptr(ptr);
9892         assert(obj->tag == LDKEvent_ProbeSuccessful);
9893         int8_tArray payment_hash_arr = init_int8_tArray(32, __LINE__);
9894         memcpy(payment_hash_arr->elems, obj->probe_successful.payment_hash.data, 32);
9895         return payment_hash_arr;
9896 }
9897 uint64_t __attribute__((export_name("TS_LDKEvent_ProbeSuccessful_get_path"))) TS_LDKEvent_ProbeSuccessful_get_path(uint64_t ptr) {
9898         LDKEvent *obj = (LDKEvent*)untag_ptr(ptr);
9899         assert(obj->tag == LDKEvent_ProbeSuccessful);
9900         LDKPath path_var = obj->probe_successful.path;
9901                         uint64_t path_ref = 0;
9902                         CHECK_INNER_FIELD_ACCESS_OR_NULL(path_var);
9903                         path_ref = tag_ptr(path_var.inner, false);
9904         return path_ref;
9905 }
9906 int8_tArray __attribute__((export_name("TS_LDKEvent_ProbeFailed_get_payment_id"))) TS_LDKEvent_ProbeFailed_get_payment_id(uint64_t ptr) {
9907         LDKEvent *obj = (LDKEvent*)untag_ptr(ptr);
9908         assert(obj->tag == LDKEvent_ProbeFailed);
9909         int8_tArray payment_id_arr = init_int8_tArray(32, __LINE__);
9910         memcpy(payment_id_arr->elems, obj->probe_failed.payment_id.data, 32);
9911         return payment_id_arr;
9912 }
9913 int8_tArray __attribute__((export_name("TS_LDKEvent_ProbeFailed_get_payment_hash"))) TS_LDKEvent_ProbeFailed_get_payment_hash(uint64_t ptr) {
9914         LDKEvent *obj = (LDKEvent*)untag_ptr(ptr);
9915         assert(obj->tag == LDKEvent_ProbeFailed);
9916         int8_tArray payment_hash_arr = init_int8_tArray(32, __LINE__);
9917         memcpy(payment_hash_arr->elems, obj->probe_failed.payment_hash.data, 32);
9918         return payment_hash_arr;
9919 }
9920 uint64_t __attribute__((export_name("TS_LDKEvent_ProbeFailed_get_path"))) TS_LDKEvent_ProbeFailed_get_path(uint64_t ptr) {
9921         LDKEvent *obj = (LDKEvent*)untag_ptr(ptr);
9922         assert(obj->tag == LDKEvent_ProbeFailed);
9923         LDKPath path_var = obj->probe_failed.path;
9924                         uint64_t path_ref = 0;
9925                         CHECK_INNER_FIELD_ACCESS_OR_NULL(path_var);
9926                         path_ref = tag_ptr(path_var.inner, false);
9927         return path_ref;
9928 }
9929 uint64_t __attribute__((export_name("TS_LDKEvent_ProbeFailed_get_short_channel_id"))) TS_LDKEvent_ProbeFailed_get_short_channel_id(uint64_t ptr) {
9930         LDKEvent *obj = (LDKEvent*)untag_ptr(ptr);
9931         assert(obj->tag == LDKEvent_ProbeFailed);
9932         uint64_t short_channel_id_ref = tag_ptr(&obj->probe_failed.short_channel_id, false);
9933         return short_channel_id_ref;
9934 }
9935 int64_t __attribute__((export_name("TS_LDKEvent_PendingHTLCsForwardable_get_time_forwardable"))) TS_LDKEvent_PendingHTLCsForwardable_get_time_forwardable(uint64_t ptr) {
9936         LDKEvent *obj = (LDKEvent*)untag_ptr(ptr);
9937         assert(obj->tag == LDKEvent_PendingHTLCsForwardable);
9938         int64_t time_forwardable_conv = obj->pending_htl_cs_forwardable.time_forwardable;
9939         return time_forwardable_conv;
9940 }
9941 int8_tArray __attribute__((export_name("TS_LDKEvent_HTLCIntercepted_get_intercept_id"))) TS_LDKEvent_HTLCIntercepted_get_intercept_id(uint64_t ptr) {
9942         LDKEvent *obj = (LDKEvent*)untag_ptr(ptr);
9943         assert(obj->tag == LDKEvent_HTLCIntercepted);
9944         int8_tArray intercept_id_arr = init_int8_tArray(32, __LINE__);
9945         memcpy(intercept_id_arr->elems, obj->htlc_intercepted.intercept_id.data, 32);
9946         return intercept_id_arr;
9947 }
9948 int64_t __attribute__((export_name("TS_LDKEvent_HTLCIntercepted_get_requested_next_hop_scid"))) TS_LDKEvent_HTLCIntercepted_get_requested_next_hop_scid(uint64_t ptr) {
9949         LDKEvent *obj = (LDKEvent*)untag_ptr(ptr);
9950         assert(obj->tag == LDKEvent_HTLCIntercepted);
9951         int64_t requested_next_hop_scid_conv = obj->htlc_intercepted.requested_next_hop_scid;
9952         return requested_next_hop_scid_conv;
9953 }
9954 int8_tArray __attribute__((export_name("TS_LDKEvent_HTLCIntercepted_get_payment_hash"))) TS_LDKEvent_HTLCIntercepted_get_payment_hash(uint64_t ptr) {
9955         LDKEvent *obj = (LDKEvent*)untag_ptr(ptr);
9956         assert(obj->tag == LDKEvent_HTLCIntercepted);
9957         int8_tArray payment_hash_arr = init_int8_tArray(32, __LINE__);
9958         memcpy(payment_hash_arr->elems, obj->htlc_intercepted.payment_hash.data, 32);
9959         return payment_hash_arr;
9960 }
9961 int64_t __attribute__((export_name("TS_LDKEvent_HTLCIntercepted_get_inbound_amount_msat"))) TS_LDKEvent_HTLCIntercepted_get_inbound_amount_msat(uint64_t ptr) {
9962         LDKEvent *obj = (LDKEvent*)untag_ptr(ptr);
9963         assert(obj->tag == LDKEvent_HTLCIntercepted);
9964         int64_t inbound_amount_msat_conv = obj->htlc_intercepted.inbound_amount_msat;
9965         return inbound_amount_msat_conv;
9966 }
9967 int64_t __attribute__((export_name("TS_LDKEvent_HTLCIntercepted_get_expected_outbound_amount_msat"))) TS_LDKEvent_HTLCIntercepted_get_expected_outbound_amount_msat(uint64_t ptr) {
9968         LDKEvent *obj = (LDKEvent*)untag_ptr(ptr);
9969         assert(obj->tag == LDKEvent_HTLCIntercepted);
9970         int64_t expected_outbound_amount_msat_conv = obj->htlc_intercepted.expected_outbound_amount_msat;
9971         return expected_outbound_amount_msat_conv;
9972 }
9973 uint64_tArray __attribute__((export_name("TS_LDKEvent_SpendableOutputs_get_outputs"))) TS_LDKEvent_SpendableOutputs_get_outputs(uint64_t ptr) {
9974         LDKEvent *obj = (LDKEvent*)untag_ptr(ptr);
9975         assert(obj->tag == LDKEvent_SpendableOutputs);
9976         LDKCVec_SpendableOutputDescriptorZ outputs_var = obj->spendable_outputs.outputs;
9977                         uint64_tArray outputs_arr = NULL;
9978                         outputs_arr = init_uint64_tArray(outputs_var.datalen, __LINE__);
9979                         uint64_t *outputs_arr_ptr = (uint64_t*)(((uint8_t*)outputs_arr) + 8);
9980                         for (size_t b = 0; b < outputs_var.datalen; b++) {
9981                                 uint64_t outputs_conv_27_ref = tag_ptr(&outputs_var.data[b], false);
9982                                 outputs_arr_ptr[b] = outputs_conv_27_ref;
9983                         }
9984                         
9985         return outputs_arr;
9986 }
9987 uint64_t __attribute__((export_name("TS_LDKEvent_SpendableOutputs_get_channel_id"))) TS_LDKEvent_SpendableOutputs_get_channel_id(uint64_t ptr) {
9988         LDKEvent *obj = (LDKEvent*)untag_ptr(ptr);
9989         assert(obj->tag == LDKEvent_SpendableOutputs);
9990         uint64_t channel_id_ref = tag_ptr(&obj->spendable_outputs.channel_id, false);
9991         return channel_id_ref;
9992 }
9993 uint64_t __attribute__((export_name("TS_LDKEvent_PaymentForwarded_get_prev_channel_id"))) TS_LDKEvent_PaymentForwarded_get_prev_channel_id(uint64_t ptr) {
9994         LDKEvent *obj = (LDKEvent*)untag_ptr(ptr);
9995         assert(obj->tag == LDKEvent_PaymentForwarded);
9996         uint64_t prev_channel_id_ref = tag_ptr(&obj->payment_forwarded.prev_channel_id, false);
9997         return prev_channel_id_ref;
9998 }
9999 uint64_t __attribute__((export_name("TS_LDKEvent_PaymentForwarded_get_next_channel_id"))) TS_LDKEvent_PaymentForwarded_get_next_channel_id(uint64_t ptr) {
10000         LDKEvent *obj = (LDKEvent*)untag_ptr(ptr);
10001         assert(obj->tag == LDKEvent_PaymentForwarded);
10002         uint64_t next_channel_id_ref = tag_ptr(&obj->payment_forwarded.next_channel_id, false);
10003         return next_channel_id_ref;
10004 }
10005 uint64_t __attribute__((export_name("TS_LDKEvent_PaymentForwarded_get_fee_earned_msat"))) TS_LDKEvent_PaymentForwarded_get_fee_earned_msat(uint64_t ptr) {
10006         LDKEvent *obj = (LDKEvent*)untag_ptr(ptr);
10007         assert(obj->tag == LDKEvent_PaymentForwarded);
10008         uint64_t fee_earned_msat_ref = tag_ptr(&obj->payment_forwarded.fee_earned_msat, false);
10009         return fee_earned_msat_ref;
10010 }
10011 jboolean __attribute__((export_name("TS_LDKEvent_PaymentForwarded_get_claim_from_onchain_tx"))) TS_LDKEvent_PaymentForwarded_get_claim_from_onchain_tx(uint64_t ptr) {
10012         LDKEvent *obj = (LDKEvent*)untag_ptr(ptr);
10013         assert(obj->tag == LDKEvent_PaymentForwarded);
10014         jboolean claim_from_onchain_tx_conv = obj->payment_forwarded.claim_from_onchain_tx;
10015         return claim_from_onchain_tx_conv;
10016 }
10017 uint64_t __attribute__((export_name("TS_LDKEvent_PaymentForwarded_get_outbound_amount_forwarded_msat"))) TS_LDKEvent_PaymentForwarded_get_outbound_amount_forwarded_msat(uint64_t ptr) {
10018         LDKEvent *obj = (LDKEvent*)untag_ptr(ptr);
10019         assert(obj->tag == LDKEvent_PaymentForwarded);
10020         uint64_t outbound_amount_forwarded_msat_ref = tag_ptr(&obj->payment_forwarded.outbound_amount_forwarded_msat, false);
10021         return outbound_amount_forwarded_msat_ref;
10022 }
10023 int8_tArray __attribute__((export_name("TS_LDKEvent_ChannelPending_get_channel_id"))) TS_LDKEvent_ChannelPending_get_channel_id(uint64_t ptr) {
10024         LDKEvent *obj = (LDKEvent*)untag_ptr(ptr);
10025         assert(obj->tag == LDKEvent_ChannelPending);
10026         int8_tArray channel_id_arr = init_int8_tArray(32, __LINE__);
10027         memcpy(channel_id_arr->elems, obj->channel_pending.channel_id.data, 32);
10028         return channel_id_arr;
10029 }
10030 int8_tArray __attribute__((export_name("TS_LDKEvent_ChannelPending_get_user_channel_id"))) TS_LDKEvent_ChannelPending_get_user_channel_id(uint64_t ptr) {
10031         LDKEvent *obj = (LDKEvent*)untag_ptr(ptr);
10032         assert(obj->tag == LDKEvent_ChannelPending);
10033         int8_tArray user_channel_id_arr = init_int8_tArray(16, __LINE__);
10034         memcpy(user_channel_id_arr->elems, obj->channel_pending.user_channel_id.le_bytes, 16);
10035         return user_channel_id_arr;
10036 }
10037 uint64_t __attribute__((export_name("TS_LDKEvent_ChannelPending_get_former_temporary_channel_id"))) TS_LDKEvent_ChannelPending_get_former_temporary_channel_id(uint64_t ptr) {
10038         LDKEvent *obj = (LDKEvent*)untag_ptr(ptr);
10039         assert(obj->tag == LDKEvent_ChannelPending);
10040         uint64_t former_temporary_channel_id_ref = tag_ptr(&obj->channel_pending.former_temporary_channel_id, false);
10041         return former_temporary_channel_id_ref;
10042 }
10043 int8_tArray __attribute__((export_name("TS_LDKEvent_ChannelPending_get_counterparty_node_id"))) TS_LDKEvent_ChannelPending_get_counterparty_node_id(uint64_t ptr) {
10044         LDKEvent *obj = (LDKEvent*)untag_ptr(ptr);
10045         assert(obj->tag == LDKEvent_ChannelPending);
10046         int8_tArray counterparty_node_id_arr = init_int8_tArray(33, __LINE__);
10047         memcpy(counterparty_node_id_arr->elems, obj->channel_pending.counterparty_node_id.compressed_form, 33);
10048         return counterparty_node_id_arr;
10049 }
10050 uint64_t __attribute__((export_name("TS_LDKEvent_ChannelPending_get_funding_txo"))) TS_LDKEvent_ChannelPending_get_funding_txo(uint64_t ptr) {
10051         LDKEvent *obj = (LDKEvent*)untag_ptr(ptr);
10052         assert(obj->tag == LDKEvent_ChannelPending);
10053         LDKOutPoint funding_txo_var = obj->channel_pending.funding_txo;
10054                         uint64_t funding_txo_ref = 0;
10055                         CHECK_INNER_FIELD_ACCESS_OR_NULL(funding_txo_var);
10056                         funding_txo_ref = tag_ptr(funding_txo_var.inner, false);
10057         return funding_txo_ref;
10058 }
10059 int8_tArray __attribute__((export_name("TS_LDKEvent_ChannelReady_get_channel_id"))) TS_LDKEvent_ChannelReady_get_channel_id(uint64_t ptr) {
10060         LDKEvent *obj = (LDKEvent*)untag_ptr(ptr);
10061         assert(obj->tag == LDKEvent_ChannelReady);
10062         int8_tArray channel_id_arr = init_int8_tArray(32, __LINE__);
10063         memcpy(channel_id_arr->elems, obj->channel_ready.channel_id.data, 32);
10064         return channel_id_arr;
10065 }
10066 int8_tArray __attribute__((export_name("TS_LDKEvent_ChannelReady_get_user_channel_id"))) TS_LDKEvent_ChannelReady_get_user_channel_id(uint64_t ptr) {
10067         LDKEvent *obj = (LDKEvent*)untag_ptr(ptr);
10068         assert(obj->tag == LDKEvent_ChannelReady);
10069         int8_tArray user_channel_id_arr = init_int8_tArray(16, __LINE__);
10070         memcpy(user_channel_id_arr->elems, obj->channel_ready.user_channel_id.le_bytes, 16);
10071         return user_channel_id_arr;
10072 }
10073 int8_tArray __attribute__((export_name("TS_LDKEvent_ChannelReady_get_counterparty_node_id"))) TS_LDKEvent_ChannelReady_get_counterparty_node_id(uint64_t ptr) {
10074         LDKEvent *obj = (LDKEvent*)untag_ptr(ptr);
10075         assert(obj->tag == LDKEvent_ChannelReady);
10076         int8_tArray counterparty_node_id_arr = init_int8_tArray(33, __LINE__);
10077         memcpy(counterparty_node_id_arr->elems, obj->channel_ready.counterparty_node_id.compressed_form, 33);
10078         return counterparty_node_id_arr;
10079 }
10080 uint64_t __attribute__((export_name("TS_LDKEvent_ChannelReady_get_channel_type"))) TS_LDKEvent_ChannelReady_get_channel_type(uint64_t ptr) {
10081         LDKEvent *obj = (LDKEvent*)untag_ptr(ptr);
10082         assert(obj->tag == LDKEvent_ChannelReady);
10083         LDKChannelTypeFeatures channel_type_var = obj->channel_ready.channel_type;
10084                         uint64_t channel_type_ref = 0;
10085                         CHECK_INNER_FIELD_ACCESS_OR_NULL(channel_type_var);
10086                         channel_type_ref = tag_ptr(channel_type_var.inner, false);
10087         return channel_type_ref;
10088 }
10089 int8_tArray __attribute__((export_name("TS_LDKEvent_ChannelClosed_get_channel_id"))) TS_LDKEvent_ChannelClosed_get_channel_id(uint64_t ptr) {
10090         LDKEvent *obj = (LDKEvent*)untag_ptr(ptr);
10091         assert(obj->tag == LDKEvent_ChannelClosed);
10092         int8_tArray channel_id_arr = init_int8_tArray(32, __LINE__);
10093         memcpy(channel_id_arr->elems, obj->channel_closed.channel_id.data, 32);
10094         return channel_id_arr;
10095 }
10096 int8_tArray __attribute__((export_name("TS_LDKEvent_ChannelClosed_get_user_channel_id"))) TS_LDKEvent_ChannelClosed_get_user_channel_id(uint64_t ptr) {
10097         LDKEvent *obj = (LDKEvent*)untag_ptr(ptr);
10098         assert(obj->tag == LDKEvent_ChannelClosed);
10099         int8_tArray user_channel_id_arr = init_int8_tArray(16, __LINE__);
10100         memcpy(user_channel_id_arr->elems, obj->channel_closed.user_channel_id.le_bytes, 16);
10101         return user_channel_id_arr;
10102 }
10103 uint64_t __attribute__((export_name("TS_LDKEvent_ChannelClosed_get_reason"))) TS_LDKEvent_ChannelClosed_get_reason(uint64_t ptr) {
10104         LDKEvent *obj = (LDKEvent*)untag_ptr(ptr);
10105         assert(obj->tag == LDKEvent_ChannelClosed);
10106         uint64_t reason_ref = tag_ptr(&obj->channel_closed.reason, false);
10107         return reason_ref;
10108 }
10109 int8_tArray __attribute__((export_name("TS_LDKEvent_ChannelClosed_get_counterparty_node_id"))) TS_LDKEvent_ChannelClosed_get_counterparty_node_id(uint64_t ptr) {
10110         LDKEvent *obj = (LDKEvent*)untag_ptr(ptr);
10111         assert(obj->tag == LDKEvent_ChannelClosed);
10112         int8_tArray counterparty_node_id_arr = init_int8_tArray(33, __LINE__);
10113         memcpy(counterparty_node_id_arr->elems, obj->channel_closed.counterparty_node_id.compressed_form, 33);
10114         return counterparty_node_id_arr;
10115 }
10116 uint64_t __attribute__((export_name("TS_LDKEvent_ChannelClosed_get_channel_capacity_sats"))) TS_LDKEvent_ChannelClosed_get_channel_capacity_sats(uint64_t ptr) {
10117         LDKEvent *obj = (LDKEvent*)untag_ptr(ptr);
10118         assert(obj->tag == LDKEvent_ChannelClosed);
10119         uint64_t channel_capacity_sats_ref = tag_ptr(&obj->channel_closed.channel_capacity_sats, false);
10120         return channel_capacity_sats_ref;
10121 }
10122 int8_tArray __attribute__((export_name("TS_LDKEvent_DiscardFunding_get_channel_id"))) TS_LDKEvent_DiscardFunding_get_channel_id(uint64_t ptr) {
10123         LDKEvent *obj = (LDKEvent*)untag_ptr(ptr);
10124         assert(obj->tag == LDKEvent_DiscardFunding);
10125         int8_tArray channel_id_arr = init_int8_tArray(32, __LINE__);
10126         memcpy(channel_id_arr->elems, obj->discard_funding.channel_id.data, 32);
10127         return channel_id_arr;
10128 }
10129 int8_tArray __attribute__((export_name("TS_LDKEvent_DiscardFunding_get_transaction"))) TS_LDKEvent_DiscardFunding_get_transaction(uint64_t ptr) {
10130         LDKEvent *obj = (LDKEvent*)untag_ptr(ptr);
10131         assert(obj->tag == LDKEvent_DiscardFunding);
10132         LDKTransaction transaction_var = obj->discard_funding.transaction;
10133                         int8_tArray transaction_arr = init_int8_tArray(transaction_var.datalen, __LINE__);
10134                         memcpy(transaction_arr->elems, transaction_var.data, transaction_var.datalen);
10135         return transaction_arr;
10136 }
10137 int8_tArray __attribute__((export_name("TS_LDKEvent_OpenChannelRequest_get_temporary_channel_id"))) TS_LDKEvent_OpenChannelRequest_get_temporary_channel_id(uint64_t ptr) {
10138         LDKEvent *obj = (LDKEvent*)untag_ptr(ptr);
10139         assert(obj->tag == LDKEvent_OpenChannelRequest);
10140         int8_tArray temporary_channel_id_arr = init_int8_tArray(32, __LINE__);
10141         memcpy(temporary_channel_id_arr->elems, obj->open_channel_request.temporary_channel_id.data, 32);
10142         return temporary_channel_id_arr;
10143 }
10144 int8_tArray __attribute__((export_name("TS_LDKEvent_OpenChannelRequest_get_counterparty_node_id"))) TS_LDKEvent_OpenChannelRequest_get_counterparty_node_id(uint64_t ptr) {
10145         LDKEvent *obj = (LDKEvent*)untag_ptr(ptr);
10146         assert(obj->tag == LDKEvent_OpenChannelRequest);
10147         int8_tArray counterparty_node_id_arr = init_int8_tArray(33, __LINE__);
10148         memcpy(counterparty_node_id_arr->elems, obj->open_channel_request.counterparty_node_id.compressed_form, 33);
10149         return counterparty_node_id_arr;
10150 }
10151 int64_t __attribute__((export_name("TS_LDKEvent_OpenChannelRequest_get_funding_satoshis"))) TS_LDKEvent_OpenChannelRequest_get_funding_satoshis(uint64_t ptr) {
10152         LDKEvent *obj = (LDKEvent*)untag_ptr(ptr);
10153         assert(obj->tag == LDKEvent_OpenChannelRequest);
10154         int64_t funding_satoshis_conv = obj->open_channel_request.funding_satoshis;
10155         return funding_satoshis_conv;
10156 }
10157 int64_t __attribute__((export_name("TS_LDKEvent_OpenChannelRequest_get_push_msat"))) TS_LDKEvent_OpenChannelRequest_get_push_msat(uint64_t ptr) {
10158         LDKEvent *obj = (LDKEvent*)untag_ptr(ptr);
10159         assert(obj->tag == LDKEvent_OpenChannelRequest);
10160         int64_t push_msat_conv = obj->open_channel_request.push_msat;
10161         return push_msat_conv;
10162 }
10163 uint64_t __attribute__((export_name("TS_LDKEvent_OpenChannelRequest_get_channel_type"))) TS_LDKEvent_OpenChannelRequest_get_channel_type(uint64_t ptr) {
10164         LDKEvent *obj = (LDKEvent*)untag_ptr(ptr);
10165         assert(obj->tag == LDKEvent_OpenChannelRequest);
10166         LDKChannelTypeFeatures channel_type_var = obj->open_channel_request.channel_type;
10167                         uint64_t channel_type_ref = 0;
10168                         CHECK_INNER_FIELD_ACCESS_OR_NULL(channel_type_var);
10169                         channel_type_ref = tag_ptr(channel_type_var.inner, false);
10170         return channel_type_ref;
10171 }
10172 int8_tArray __attribute__((export_name("TS_LDKEvent_HTLCHandlingFailed_get_prev_channel_id"))) TS_LDKEvent_HTLCHandlingFailed_get_prev_channel_id(uint64_t ptr) {
10173         LDKEvent *obj = (LDKEvent*)untag_ptr(ptr);
10174         assert(obj->tag == LDKEvent_HTLCHandlingFailed);
10175         int8_tArray prev_channel_id_arr = init_int8_tArray(32, __LINE__);
10176         memcpy(prev_channel_id_arr->elems, obj->htlc_handling_failed.prev_channel_id.data, 32);
10177         return prev_channel_id_arr;
10178 }
10179 uint64_t __attribute__((export_name("TS_LDKEvent_HTLCHandlingFailed_get_failed_next_destination"))) TS_LDKEvent_HTLCHandlingFailed_get_failed_next_destination(uint64_t ptr) {
10180         LDKEvent *obj = (LDKEvent*)untag_ptr(ptr);
10181         assert(obj->tag == LDKEvent_HTLCHandlingFailed);
10182         uint64_t failed_next_destination_ref = tag_ptr(&obj->htlc_handling_failed.failed_next_destination, false);
10183         return failed_next_destination_ref;
10184 }
10185 uint64_t __attribute__((export_name("TS_LDKEvent_BumpTransaction_get_bump_transaction"))) TS_LDKEvent_BumpTransaction_get_bump_transaction(uint64_t ptr) {
10186         LDKEvent *obj = (LDKEvent*)untag_ptr(ptr);
10187         assert(obj->tag == LDKEvent_BumpTransaction);
10188         uint64_t bump_transaction_ref = tag_ptr(&obj->bump_transaction, false);
10189         return bump_transaction_ref;
10190 }
10191 uint32_t __attribute__((export_name("TS_LDKCOption_EventZ_ty_from_ptr"))) TS_LDKCOption_EventZ_ty_from_ptr(uint64_t ptr) {
10192         LDKCOption_EventZ *obj = (LDKCOption_EventZ*)untag_ptr(ptr);
10193         switch(obj->tag) {
10194                 case LDKCOption_EventZ_Some: return 0;
10195                 case LDKCOption_EventZ_None: return 1;
10196                 default: abort();
10197         }
10198 }
10199 uint64_t __attribute__((export_name("TS_LDKCOption_EventZ_Some_get_some"))) TS_LDKCOption_EventZ_Some_get_some(uint64_t ptr) {
10200         LDKCOption_EventZ *obj = (LDKCOption_EventZ*)untag_ptr(ptr);
10201         assert(obj->tag == LDKCOption_EventZ_Some);
10202         uint64_t some_ref = tag_ptr(&obj->some, false);
10203         return some_ref;
10204 }
10205 static inline struct LDKCOption_EventZ CResult_COption_EventZDecodeErrorZ_get_ok(LDKCResult_COption_EventZDecodeErrorZ *NONNULL_PTR owner){
10206 CHECK(owner->result_ok);
10207         return COption_EventZ_clone(&*owner->contents.result);
10208 }
10209 uint64_t  __attribute__((export_name("TS_CResult_COption_EventZDecodeErrorZ_get_ok"))) TS_CResult_COption_EventZDecodeErrorZ_get_ok(uint64_t owner) {
10210         LDKCResult_COption_EventZDecodeErrorZ* owner_conv = (LDKCResult_COption_EventZDecodeErrorZ*)untag_ptr(owner);
10211         LDKCOption_EventZ *ret_copy = MALLOC(sizeof(LDKCOption_EventZ), "LDKCOption_EventZ");
10212         *ret_copy = CResult_COption_EventZDecodeErrorZ_get_ok(owner_conv);
10213         uint64_t ret_ref = tag_ptr(ret_copy, true);
10214         return ret_ref;
10215 }
10216
10217 static inline struct LDKDecodeError CResult_COption_EventZDecodeErrorZ_get_err(LDKCResult_COption_EventZDecodeErrorZ *NONNULL_PTR owner){
10218 CHECK(!owner->result_ok);
10219         return DecodeError_clone(&*owner->contents.err);
10220 }
10221 uint64_t  __attribute__((export_name("TS_CResult_COption_EventZDecodeErrorZ_get_err"))) TS_CResult_COption_EventZDecodeErrorZ_get_err(uint64_t owner) {
10222         LDKCResult_COption_EventZDecodeErrorZ* owner_conv = (LDKCResult_COption_EventZDecodeErrorZ*)untag_ptr(owner);
10223         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
10224         *ret_copy = CResult_COption_EventZDecodeErrorZ_get_err(owner_conv);
10225         uint64_t ret_ref = tag_ptr(ret_copy, true);
10226         return ret_ref;
10227 }
10228
10229 uint32_t __attribute__((export_name("TS_LDKBolt11ParseError_ty_from_ptr"))) TS_LDKBolt11ParseError_ty_from_ptr(uint64_t ptr) {
10230         LDKBolt11ParseError *obj = (LDKBolt11ParseError*)untag_ptr(ptr);
10231         switch(obj->tag) {
10232                 case LDKBolt11ParseError_Bech32Error: return 0;
10233                 case LDKBolt11ParseError_ParseAmountError: return 1;
10234                 case LDKBolt11ParseError_MalformedSignature: return 2;
10235                 case LDKBolt11ParseError_BadPrefix: return 3;
10236                 case LDKBolt11ParseError_UnknownCurrency: return 4;
10237                 case LDKBolt11ParseError_UnknownSiPrefix: return 5;
10238                 case LDKBolt11ParseError_MalformedHRP: return 6;
10239                 case LDKBolt11ParseError_TooShortDataPart: return 7;
10240                 case LDKBolt11ParseError_UnexpectedEndOfTaggedFields: return 8;
10241                 case LDKBolt11ParseError_DescriptionDecodeError: return 9;
10242                 case LDKBolt11ParseError_PaddingError: return 10;
10243                 case LDKBolt11ParseError_IntegerOverflowError: return 11;
10244                 case LDKBolt11ParseError_InvalidSegWitProgramLength: return 12;
10245                 case LDKBolt11ParseError_InvalidPubKeyHashLength: return 13;
10246                 case LDKBolt11ParseError_InvalidScriptHashLength: return 14;
10247                 case LDKBolt11ParseError_InvalidRecoveryId: return 15;
10248                 case LDKBolt11ParseError_InvalidSliceLength: return 16;
10249                 case LDKBolt11ParseError_Skip: return 17;
10250                 default: abort();
10251         }
10252 }
10253 uint64_t __attribute__((export_name("TS_LDKBolt11ParseError_Bech32Error_get_bech32_error"))) TS_LDKBolt11ParseError_Bech32Error_get_bech32_error(uint64_t ptr) {
10254         LDKBolt11ParseError *obj = (LDKBolt11ParseError*)untag_ptr(ptr);
10255         assert(obj->tag == LDKBolt11ParseError_Bech32Error);
10256         uint64_t bech32_error_ref = tag_ptr(&obj->bech32_error, false);
10257         return bech32_error_ref;
10258 }
10259 int32_t __attribute__((export_name("TS_LDKBolt11ParseError_ParseAmountError_get_parse_amount_error"))) TS_LDKBolt11ParseError_ParseAmountError_get_parse_amount_error(uint64_t ptr) {
10260         LDKBolt11ParseError *obj = (LDKBolt11ParseError*)untag_ptr(ptr);
10261         assert(obj->tag == LDKBolt11ParseError_ParseAmountError);
10262         /*obj->parse_amount_error*/
10263         return 0;
10264 }
10265 uint32_t __attribute__((export_name("TS_LDKBolt11ParseError_MalformedSignature_get_malformed_signature"))) TS_LDKBolt11ParseError_MalformedSignature_get_malformed_signature(uint64_t ptr) {
10266         LDKBolt11ParseError *obj = (LDKBolt11ParseError*)untag_ptr(ptr);
10267         assert(obj->tag == LDKBolt11ParseError_MalformedSignature);
10268         uint32_t malformed_signature_conv = LDKSecp256k1Error_to_js(obj->malformed_signature);
10269         return malformed_signature_conv;
10270 }
10271 int32_t __attribute__((export_name("TS_LDKBolt11ParseError_DescriptionDecodeError_get_description_decode_error"))) TS_LDKBolt11ParseError_DescriptionDecodeError_get_description_decode_error(uint64_t ptr) {
10272         LDKBolt11ParseError *obj = (LDKBolt11ParseError*)untag_ptr(ptr);
10273         assert(obj->tag == LDKBolt11ParseError_DescriptionDecodeError);
10274         /*obj->description_decode_error*/
10275         return 0;
10276 }
10277 jstring __attribute__((export_name("TS_LDKBolt11ParseError_InvalidSliceLength_get_invalid_slice_length"))) TS_LDKBolt11ParseError_InvalidSliceLength_get_invalid_slice_length(uint64_t ptr) {
10278         LDKBolt11ParseError *obj = (LDKBolt11ParseError*)untag_ptr(ptr);
10279         assert(obj->tag == LDKBolt11ParseError_InvalidSliceLength);
10280         LDKStr invalid_slice_length_str = obj->invalid_slice_length;
10281                         jstring invalid_slice_length_conv = str_ref_to_ts(invalid_slice_length_str.chars, invalid_slice_length_str.len);
10282         return invalid_slice_length_conv;
10283 }
10284 static inline enum LDKSiPrefix CResult_SiPrefixBolt11ParseErrorZ_get_ok(LDKCResult_SiPrefixBolt11ParseErrorZ *NONNULL_PTR owner){
10285 CHECK(owner->result_ok);
10286         return SiPrefix_clone(&*owner->contents.result);
10287 }
10288 uint32_t  __attribute__((export_name("TS_CResult_SiPrefixBolt11ParseErrorZ_get_ok"))) TS_CResult_SiPrefixBolt11ParseErrorZ_get_ok(uint64_t owner) {
10289         LDKCResult_SiPrefixBolt11ParseErrorZ* owner_conv = (LDKCResult_SiPrefixBolt11ParseErrorZ*)untag_ptr(owner);
10290         uint32_t ret_conv = LDKSiPrefix_to_js(CResult_SiPrefixBolt11ParseErrorZ_get_ok(owner_conv));
10291         return ret_conv;
10292 }
10293
10294 static inline struct LDKBolt11ParseError CResult_SiPrefixBolt11ParseErrorZ_get_err(LDKCResult_SiPrefixBolt11ParseErrorZ *NONNULL_PTR owner){
10295 CHECK(!owner->result_ok);
10296         return Bolt11ParseError_clone(&*owner->contents.err);
10297 }
10298 uint64_t  __attribute__((export_name("TS_CResult_SiPrefixBolt11ParseErrorZ_get_err"))) TS_CResult_SiPrefixBolt11ParseErrorZ_get_err(uint64_t owner) {
10299         LDKCResult_SiPrefixBolt11ParseErrorZ* owner_conv = (LDKCResult_SiPrefixBolt11ParseErrorZ*)untag_ptr(owner);
10300         LDKBolt11ParseError *ret_copy = MALLOC(sizeof(LDKBolt11ParseError), "LDKBolt11ParseError");
10301         *ret_copy = CResult_SiPrefixBolt11ParseErrorZ_get_err(owner_conv);
10302         uint64_t ret_ref = tag_ptr(ret_copy, true);
10303         return ret_ref;
10304 }
10305
10306 uint32_t __attribute__((export_name("TS_LDKParseOrSemanticError_ty_from_ptr"))) TS_LDKParseOrSemanticError_ty_from_ptr(uint64_t ptr) {
10307         LDKParseOrSemanticError *obj = (LDKParseOrSemanticError*)untag_ptr(ptr);
10308         switch(obj->tag) {
10309                 case LDKParseOrSemanticError_ParseError: return 0;
10310                 case LDKParseOrSemanticError_SemanticError: return 1;
10311                 default: abort();
10312         }
10313 }
10314 uint64_t __attribute__((export_name("TS_LDKParseOrSemanticError_ParseError_get_parse_error"))) TS_LDKParseOrSemanticError_ParseError_get_parse_error(uint64_t ptr) {
10315         LDKParseOrSemanticError *obj = (LDKParseOrSemanticError*)untag_ptr(ptr);
10316         assert(obj->tag == LDKParseOrSemanticError_ParseError);
10317         uint64_t parse_error_ref = tag_ptr(&obj->parse_error, false);
10318         return parse_error_ref;
10319 }
10320 uint32_t __attribute__((export_name("TS_LDKParseOrSemanticError_SemanticError_get_semantic_error"))) TS_LDKParseOrSemanticError_SemanticError_get_semantic_error(uint64_t ptr) {
10321         LDKParseOrSemanticError *obj = (LDKParseOrSemanticError*)untag_ptr(ptr);
10322         assert(obj->tag == LDKParseOrSemanticError_SemanticError);
10323         uint32_t semantic_error_conv = LDKBolt11SemanticError_to_js(obj->semantic_error);
10324         return semantic_error_conv;
10325 }
10326 static inline struct LDKBolt11Invoice CResult_Bolt11InvoiceParseOrSemanticErrorZ_get_ok(LDKCResult_Bolt11InvoiceParseOrSemanticErrorZ *NONNULL_PTR owner){
10327         LDKBolt11Invoice ret = *owner->contents.result;
10328         ret.is_owned = false;
10329         return ret;
10330 }
10331 uint64_t  __attribute__((export_name("TS_CResult_Bolt11InvoiceParseOrSemanticErrorZ_get_ok"))) TS_CResult_Bolt11InvoiceParseOrSemanticErrorZ_get_ok(uint64_t owner) {
10332         LDKCResult_Bolt11InvoiceParseOrSemanticErrorZ* owner_conv = (LDKCResult_Bolt11InvoiceParseOrSemanticErrorZ*)untag_ptr(owner);
10333         LDKBolt11Invoice ret_var = CResult_Bolt11InvoiceParseOrSemanticErrorZ_get_ok(owner_conv);
10334         uint64_t ret_ref = 0;
10335         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
10336         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
10337         return ret_ref;
10338 }
10339
10340 static inline struct LDKParseOrSemanticError CResult_Bolt11InvoiceParseOrSemanticErrorZ_get_err(LDKCResult_Bolt11InvoiceParseOrSemanticErrorZ *NONNULL_PTR owner){
10341 CHECK(!owner->result_ok);
10342         return ParseOrSemanticError_clone(&*owner->contents.err);
10343 }
10344 uint64_t  __attribute__((export_name("TS_CResult_Bolt11InvoiceParseOrSemanticErrorZ_get_err"))) TS_CResult_Bolt11InvoiceParseOrSemanticErrorZ_get_err(uint64_t owner) {
10345         LDKCResult_Bolt11InvoiceParseOrSemanticErrorZ* owner_conv = (LDKCResult_Bolt11InvoiceParseOrSemanticErrorZ*)untag_ptr(owner);
10346         LDKParseOrSemanticError *ret_copy = MALLOC(sizeof(LDKParseOrSemanticError), "LDKParseOrSemanticError");
10347         *ret_copy = CResult_Bolt11InvoiceParseOrSemanticErrorZ_get_err(owner_conv);
10348         uint64_t ret_ref = tag_ptr(ret_copy, true);
10349         return ret_ref;
10350 }
10351
10352 static inline struct LDKSignedRawBolt11Invoice CResult_SignedRawBolt11InvoiceBolt11ParseErrorZ_get_ok(LDKCResult_SignedRawBolt11InvoiceBolt11ParseErrorZ *NONNULL_PTR owner){
10353         LDKSignedRawBolt11Invoice ret = *owner->contents.result;
10354         ret.is_owned = false;
10355         return ret;
10356 }
10357 uint64_t  __attribute__((export_name("TS_CResult_SignedRawBolt11InvoiceBolt11ParseErrorZ_get_ok"))) TS_CResult_SignedRawBolt11InvoiceBolt11ParseErrorZ_get_ok(uint64_t owner) {
10358         LDKCResult_SignedRawBolt11InvoiceBolt11ParseErrorZ* owner_conv = (LDKCResult_SignedRawBolt11InvoiceBolt11ParseErrorZ*)untag_ptr(owner);
10359         LDKSignedRawBolt11Invoice ret_var = CResult_SignedRawBolt11InvoiceBolt11ParseErrorZ_get_ok(owner_conv);
10360         uint64_t ret_ref = 0;
10361         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
10362         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
10363         return ret_ref;
10364 }
10365
10366 static inline struct LDKBolt11ParseError CResult_SignedRawBolt11InvoiceBolt11ParseErrorZ_get_err(LDKCResult_SignedRawBolt11InvoiceBolt11ParseErrorZ *NONNULL_PTR owner){
10367 CHECK(!owner->result_ok);
10368         return Bolt11ParseError_clone(&*owner->contents.err);
10369 }
10370 uint64_t  __attribute__((export_name("TS_CResult_SignedRawBolt11InvoiceBolt11ParseErrorZ_get_err"))) TS_CResult_SignedRawBolt11InvoiceBolt11ParseErrorZ_get_err(uint64_t owner) {
10371         LDKCResult_SignedRawBolt11InvoiceBolt11ParseErrorZ* owner_conv = (LDKCResult_SignedRawBolt11InvoiceBolt11ParseErrorZ*)untag_ptr(owner);
10372         LDKBolt11ParseError *ret_copy = MALLOC(sizeof(LDKBolt11ParseError), "LDKBolt11ParseError");
10373         *ret_copy = CResult_SignedRawBolt11InvoiceBolt11ParseErrorZ_get_err(owner_conv);
10374         uint64_t ret_ref = tag_ptr(ret_copy, true);
10375         return ret_ref;
10376 }
10377
10378 static inline struct LDKRawBolt11Invoice C3Tuple_RawBolt11Invoice_u832Bolt11InvoiceSignatureZ_get_a(LDKC3Tuple_RawBolt11Invoice_u832Bolt11InvoiceSignatureZ *NONNULL_PTR owner){
10379         LDKRawBolt11Invoice ret = owner->a;
10380         ret.is_owned = false;
10381         return ret;
10382 }
10383 uint64_t  __attribute__((export_name("TS_C3Tuple_RawBolt11Invoice_u832Bolt11InvoiceSignatureZ_get_a"))) TS_C3Tuple_RawBolt11Invoice_u832Bolt11InvoiceSignatureZ_get_a(uint64_t owner) {
10384         LDKC3Tuple_RawBolt11Invoice_u832Bolt11InvoiceSignatureZ* owner_conv = (LDKC3Tuple_RawBolt11Invoice_u832Bolt11InvoiceSignatureZ*)untag_ptr(owner);
10385         LDKRawBolt11Invoice ret_var = C3Tuple_RawBolt11Invoice_u832Bolt11InvoiceSignatureZ_get_a(owner_conv);
10386         uint64_t ret_ref = 0;
10387         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
10388         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
10389         return ret_ref;
10390 }
10391
10392 static inline struct LDKThirtyTwoBytes C3Tuple_RawBolt11Invoice_u832Bolt11InvoiceSignatureZ_get_b(LDKC3Tuple_RawBolt11Invoice_u832Bolt11InvoiceSignatureZ *NONNULL_PTR owner){
10393         return ThirtyTwoBytes_clone(&owner->b);
10394 }
10395 int8_tArray  __attribute__((export_name("TS_C3Tuple_RawBolt11Invoice_u832Bolt11InvoiceSignatureZ_get_b"))) TS_C3Tuple_RawBolt11Invoice_u832Bolt11InvoiceSignatureZ_get_b(uint64_t owner) {
10396         LDKC3Tuple_RawBolt11Invoice_u832Bolt11InvoiceSignatureZ* owner_conv = (LDKC3Tuple_RawBolt11Invoice_u832Bolt11InvoiceSignatureZ*)untag_ptr(owner);
10397         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
10398         memcpy(ret_arr->elems, C3Tuple_RawBolt11Invoice_u832Bolt11InvoiceSignatureZ_get_b(owner_conv).data, 32);
10399         return ret_arr;
10400 }
10401
10402 static inline struct LDKBolt11InvoiceSignature C3Tuple_RawBolt11Invoice_u832Bolt11InvoiceSignatureZ_get_c(LDKC3Tuple_RawBolt11Invoice_u832Bolt11InvoiceSignatureZ *NONNULL_PTR owner){
10403         LDKBolt11InvoiceSignature ret = owner->c;
10404         ret.is_owned = false;
10405         return ret;
10406 }
10407 uint64_t  __attribute__((export_name("TS_C3Tuple_RawBolt11Invoice_u832Bolt11InvoiceSignatureZ_get_c"))) TS_C3Tuple_RawBolt11Invoice_u832Bolt11InvoiceSignatureZ_get_c(uint64_t owner) {
10408         LDKC3Tuple_RawBolt11Invoice_u832Bolt11InvoiceSignatureZ* owner_conv = (LDKC3Tuple_RawBolt11Invoice_u832Bolt11InvoiceSignatureZ*)untag_ptr(owner);
10409         LDKBolt11InvoiceSignature ret_var = C3Tuple_RawBolt11Invoice_u832Bolt11InvoiceSignatureZ_get_c(owner_conv);
10410         uint64_t ret_ref = 0;
10411         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
10412         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
10413         return ret_ref;
10414 }
10415
10416 static inline struct LDKPayeePubKey CResult_PayeePubKeySecp256k1ErrorZ_get_ok(LDKCResult_PayeePubKeySecp256k1ErrorZ *NONNULL_PTR owner){
10417         LDKPayeePubKey ret = *owner->contents.result;
10418         ret.is_owned = false;
10419         return ret;
10420 }
10421 uint64_t  __attribute__((export_name("TS_CResult_PayeePubKeySecp256k1ErrorZ_get_ok"))) TS_CResult_PayeePubKeySecp256k1ErrorZ_get_ok(uint64_t owner) {
10422         LDKCResult_PayeePubKeySecp256k1ErrorZ* owner_conv = (LDKCResult_PayeePubKeySecp256k1ErrorZ*)untag_ptr(owner);
10423         LDKPayeePubKey ret_var = CResult_PayeePubKeySecp256k1ErrorZ_get_ok(owner_conv);
10424         uint64_t ret_ref = 0;
10425         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
10426         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
10427         return ret_ref;
10428 }
10429
10430 static inline enum LDKSecp256k1Error CResult_PayeePubKeySecp256k1ErrorZ_get_err(LDKCResult_PayeePubKeySecp256k1ErrorZ *NONNULL_PTR owner){
10431 CHECK(!owner->result_ok);
10432         return *owner->contents.err;
10433 }
10434 uint32_t  __attribute__((export_name("TS_CResult_PayeePubKeySecp256k1ErrorZ_get_err"))) TS_CResult_PayeePubKeySecp256k1ErrorZ_get_err(uint64_t owner) {
10435         LDKCResult_PayeePubKeySecp256k1ErrorZ* owner_conv = (LDKCResult_PayeePubKeySecp256k1ErrorZ*)untag_ptr(owner);
10436         uint32_t ret_conv = LDKSecp256k1Error_to_js(CResult_PayeePubKeySecp256k1ErrorZ_get_err(owner_conv));
10437         return ret_conv;
10438 }
10439
10440 static inline LDKCVec_PrivateRouteZ CVec_PrivateRouteZ_clone(const LDKCVec_PrivateRouteZ *orig) {
10441         LDKCVec_PrivateRouteZ ret = { .data = MALLOC(sizeof(LDKPrivateRoute) * orig->datalen, "LDKCVec_PrivateRouteZ clone bytes"), .datalen = orig->datalen };
10442         for (size_t i = 0; i < ret.datalen; i++) {
10443                 ret.data[i] = PrivateRoute_clone(&orig->data[i]);
10444         }
10445         return ret;
10446 }
10447 static inline struct LDKPositiveTimestamp CResult_PositiveTimestampCreationErrorZ_get_ok(LDKCResult_PositiveTimestampCreationErrorZ *NONNULL_PTR owner){
10448         LDKPositiveTimestamp ret = *owner->contents.result;
10449         ret.is_owned = false;
10450         return ret;
10451 }
10452 uint64_t  __attribute__((export_name("TS_CResult_PositiveTimestampCreationErrorZ_get_ok"))) TS_CResult_PositiveTimestampCreationErrorZ_get_ok(uint64_t owner) {
10453         LDKCResult_PositiveTimestampCreationErrorZ* owner_conv = (LDKCResult_PositiveTimestampCreationErrorZ*)untag_ptr(owner);
10454         LDKPositiveTimestamp ret_var = CResult_PositiveTimestampCreationErrorZ_get_ok(owner_conv);
10455         uint64_t ret_ref = 0;
10456         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
10457         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
10458         return ret_ref;
10459 }
10460
10461 static inline enum LDKCreationError CResult_PositiveTimestampCreationErrorZ_get_err(LDKCResult_PositiveTimestampCreationErrorZ *NONNULL_PTR owner){
10462 CHECK(!owner->result_ok);
10463         return CreationError_clone(&*owner->contents.err);
10464 }
10465 uint32_t  __attribute__((export_name("TS_CResult_PositiveTimestampCreationErrorZ_get_err"))) TS_CResult_PositiveTimestampCreationErrorZ_get_err(uint64_t owner) {
10466         LDKCResult_PositiveTimestampCreationErrorZ* owner_conv = (LDKCResult_PositiveTimestampCreationErrorZ*)untag_ptr(owner);
10467         uint32_t ret_conv = LDKCreationError_to_js(CResult_PositiveTimestampCreationErrorZ_get_err(owner_conv));
10468         return ret_conv;
10469 }
10470
10471 static inline void CResult_NoneBolt11SemanticErrorZ_get_ok(LDKCResult_NoneBolt11SemanticErrorZ *NONNULL_PTR owner){
10472 CHECK(owner->result_ok);
10473         return *owner->contents.result;
10474 }
10475 void  __attribute__((export_name("TS_CResult_NoneBolt11SemanticErrorZ_get_ok"))) TS_CResult_NoneBolt11SemanticErrorZ_get_ok(uint64_t owner) {
10476         LDKCResult_NoneBolt11SemanticErrorZ* owner_conv = (LDKCResult_NoneBolt11SemanticErrorZ*)untag_ptr(owner);
10477         CResult_NoneBolt11SemanticErrorZ_get_ok(owner_conv);
10478 }
10479
10480 static inline enum LDKBolt11SemanticError CResult_NoneBolt11SemanticErrorZ_get_err(LDKCResult_NoneBolt11SemanticErrorZ *NONNULL_PTR owner){
10481 CHECK(!owner->result_ok);
10482         return Bolt11SemanticError_clone(&*owner->contents.err);
10483 }
10484 uint32_t  __attribute__((export_name("TS_CResult_NoneBolt11SemanticErrorZ_get_err"))) TS_CResult_NoneBolt11SemanticErrorZ_get_err(uint64_t owner) {
10485         LDKCResult_NoneBolt11SemanticErrorZ* owner_conv = (LDKCResult_NoneBolt11SemanticErrorZ*)untag_ptr(owner);
10486         uint32_t ret_conv = LDKBolt11SemanticError_to_js(CResult_NoneBolt11SemanticErrorZ_get_err(owner_conv));
10487         return ret_conv;
10488 }
10489
10490 static inline struct LDKBolt11Invoice CResult_Bolt11InvoiceBolt11SemanticErrorZ_get_ok(LDKCResult_Bolt11InvoiceBolt11SemanticErrorZ *NONNULL_PTR owner){
10491         LDKBolt11Invoice ret = *owner->contents.result;
10492         ret.is_owned = false;
10493         return ret;
10494 }
10495 uint64_t  __attribute__((export_name("TS_CResult_Bolt11InvoiceBolt11SemanticErrorZ_get_ok"))) TS_CResult_Bolt11InvoiceBolt11SemanticErrorZ_get_ok(uint64_t owner) {
10496         LDKCResult_Bolt11InvoiceBolt11SemanticErrorZ* owner_conv = (LDKCResult_Bolt11InvoiceBolt11SemanticErrorZ*)untag_ptr(owner);
10497         LDKBolt11Invoice ret_var = CResult_Bolt11InvoiceBolt11SemanticErrorZ_get_ok(owner_conv);
10498         uint64_t ret_ref = 0;
10499         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
10500         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
10501         return ret_ref;
10502 }
10503
10504 static inline enum LDKBolt11SemanticError CResult_Bolt11InvoiceBolt11SemanticErrorZ_get_err(LDKCResult_Bolt11InvoiceBolt11SemanticErrorZ *NONNULL_PTR owner){
10505 CHECK(!owner->result_ok);
10506         return Bolt11SemanticError_clone(&*owner->contents.err);
10507 }
10508 uint32_t  __attribute__((export_name("TS_CResult_Bolt11InvoiceBolt11SemanticErrorZ_get_err"))) TS_CResult_Bolt11InvoiceBolt11SemanticErrorZ_get_err(uint64_t owner) {
10509         LDKCResult_Bolt11InvoiceBolt11SemanticErrorZ* owner_conv = (LDKCResult_Bolt11InvoiceBolt11SemanticErrorZ*)untag_ptr(owner);
10510         uint32_t ret_conv = LDKBolt11SemanticError_to_js(CResult_Bolt11InvoiceBolt11SemanticErrorZ_get_err(owner_conv));
10511         return ret_conv;
10512 }
10513
10514 static inline struct LDKDescription CResult_DescriptionCreationErrorZ_get_ok(LDKCResult_DescriptionCreationErrorZ *NONNULL_PTR owner){
10515         LDKDescription ret = *owner->contents.result;
10516         ret.is_owned = false;
10517         return ret;
10518 }
10519 uint64_t  __attribute__((export_name("TS_CResult_DescriptionCreationErrorZ_get_ok"))) TS_CResult_DescriptionCreationErrorZ_get_ok(uint64_t owner) {
10520         LDKCResult_DescriptionCreationErrorZ* owner_conv = (LDKCResult_DescriptionCreationErrorZ*)untag_ptr(owner);
10521         LDKDescription ret_var = CResult_DescriptionCreationErrorZ_get_ok(owner_conv);
10522         uint64_t ret_ref = 0;
10523         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
10524         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
10525         return ret_ref;
10526 }
10527
10528 static inline enum LDKCreationError CResult_DescriptionCreationErrorZ_get_err(LDKCResult_DescriptionCreationErrorZ *NONNULL_PTR owner){
10529 CHECK(!owner->result_ok);
10530         return CreationError_clone(&*owner->contents.err);
10531 }
10532 uint32_t  __attribute__((export_name("TS_CResult_DescriptionCreationErrorZ_get_err"))) TS_CResult_DescriptionCreationErrorZ_get_err(uint64_t owner) {
10533         LDKCResult_DescriptionCreationErrorZ* owner_conv = (LDKCResult_DescriptionCreationErrorZ*)untag_ptr(owner);
10534         uint32_t ret_conv = LDKCreationError_to_js(CResult_DescriptionCreationErrorZ_get_err(owner_conv));
10535         return ret_conv;
10536 }
10537
10538 static inline struct LDKPrivateRoute CResult_PrivateRouteCreationErrorZ_get_ok(LDKCResult_PrivateRouteCreationErrorZ *NONNULL_PTR owner){
10539         LDKPrivateRoute ret = *owner->contents.result;
10540         ret.is_owned = false;
10541         return ret;
10542 }
10543 uint64_t  __attribute__((export_name("TS_CResult_PrivateRouteCreationErrorZ_get_ok"))) TS_CResult_PrivateRouteCreationErrorZ_get_ok(uint64_t owner) {
10544         LDKCResult_PrivateRouteCreationErrorZ* owner_conv = (LDKCResult_PrivateRouteCreationErrorZ*)untag_ptr(owner);
10545         LDKPrivateRoute ret_var = CResult_PrivateRouteCreationErrorZ_get_ok(owner_conv);
10546         uint64_t ret_ref = 0;
10547         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
10548         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
10549         return ret_ref;
10550 }
10551
10552 static inline enum LDKCreationError CResult_PrivateRouteCreationErrorZ_get_err(LDKCResult_PrivateRouteCreationErrorZ *NONNULL_PTR owner){
10553 CHECK(!owner->result_ok);
10554         return CreationError_clone(&*owner->contents.err);
10555 }
10556 uint32_t  __attribute__((export_name("TS_CResult_PrivateRouteCreationErrorZ_get_err"))) TS_CResult_PrivateRouteCreationErrorZ_get_err(uint64_t owner) {
10557         LDKCResult_PrivateRouteCreationErrorZ* owner_conv = (LDKCResult_PrivateRouteCreationErrorZ*)untag_ptr(owner);
10558         uint32_t ret_conv = LDKCreationError_to_js(CResult_PrivateRouteCreationErrorZ_get_err(owner_conv));
10559         return ret_conv;
10560 }
10561
10562 static inline struct LDKOutPoint CResult_OutPointDecodeErrorZ_get_ok(LDKCResult_OutPointDecodeErrorZ *NONNULL_PTR owner){
10563         LDKOutPoint ret = *owner->contents.result;
10564         ret.is_owned = false;
10565         return ret;
10566 }
10567 uint64_t  __attribute__((export_name("TS_CResult_OutPointDecodeErrorZ_get_ok"))) TS_CResult_OutPointDecodeErrorZ_get_ok(uint64_t owner) {
10568         LDKCResult_OutPointDecodeErrorZ* owner_conv = (LDKCResult_OutPointDecodeErrorZ*)untag_ptr(owner);
10569         LDKOutPoint ret_var = CResult_OutPointDecodeErrorZ_get_ok(owner_conv);
10570         uint64_t ret_ref = 0;
10571         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
10572         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
10573         return ret_ref;
10574 }
10575
10576 static inline struct LDKDecodeError CResult_OutPointDecodeErrorZ_get_err(LDKCResult_OutPointDecodeErrorZ *NONNULL_PTR owner){
10577 CHECK(!owner->result_ok);
10578         return DecodeError_clone(&*owner->contents.err);
10579 }
10580 uint64_t  __attribute__((export_name("TS_CResult_OutPointDecodeErrorZ_get_err"))) TS_CResult_OutPointDecodeErrorZ_get_err(uint64_t owner) {
10581         LDKCResult_OutPointDecodeErrorZ* owner_conv = (LDKCResult_OutPointDecodeErrorZ*)untag_ptr(owner);
10582         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
10583         *ret_copy = CResult_OutPointDecodeErrorZ_get_err(owner_conv);
10584         uint64_t ret_ref = tag_ptr(ret_copy, true);
10585         return ret_ref;
10586 }
10587
10588 static inline struct LDKBigSize CResult_BigSizeDecodeErrorZ_get_ok(LDKCResult_BigSizeDecodeErrorZ *NONNULL_PTR owner){
10589         LDKBigSize ret = *owner->contents.result;
10590         ret.is_owned = false;
10591         return ret;
10592 }
10593 uint64_t  __attribute__((export_name("TS_CResult_BigSizeDecodeErrorZ_get_ok"))) TS_CResult_BigSizeDecodeErrorZ_get_ok(uint64_t owner) {
10594         LDKCResult_BigSizeDecodeErrorZ* owner_conv = (LDKCResult_BigSizeDecodeErrorZ*)untag_ptr(owner);
10595         LDKBigSize ret_var = CResult_BigSizeDecodeErrorZ_get_ok(owner_conv);
10596         uint64_t ret_ref = 0;
10597         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
10598         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
10599         return ret_ref;
10600 }
10601
10602 static inline struct LDKDecodeError CResult_BigSizeDecodeErrorZ_get_err(LDKCResult_BigSizeDecodeErrorZ *NONNULL_PTR owner){
10603 CHECK(!owner->result_ok);
10604         return DecodeError_clone(&*owner->contents.err);
10605 }
10606 uint64_t  __attribute__((export_name("TS_CResult_BigSizeDecodeErrorZ_get_err"))) TS_CResult_BigSizeDecodeErrorZ_get_err(uint64_t owner) {
10607         LDKCResult_BigSizeDecodeErrorZ* owner_conv = (LDKCResult_BigSizeDecodeErrorZ*)untag_ptr(owner);
10608         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
10609         *ret_copy = CResult_BigSizeDecodeErrorZ_get_err(owner_conv);
10610         uint64_t ret_ref = tag_ptr(ret_copy, true);
10611         return ret_ref;
10612 }
10613
10614 static inline struct LDKHostname CResult_HostnameDecodeErrorZ_get_ok(LDKCResult_HostnameDecodeErrorZ *NONNULL_PTR owner){
10615         LDKHostname ret = *owner->contents.result;
10616         ret.is_owned = false;
10617         return ret;
10618 }
10619 uint64_t  __attribute__((export_name("TS_CResult_HostnameDecodeErrorZ_get_ok"))) TS_CResult_HostnameDecodeErrorZ_get_ok(uint64_t owner) {
10620         LDKCResult_HostnameDecodeErrorZ* owner_conv = (LDKCResult_HostnameDecodeErrorZ*)untag_ptr(owner);
10621         LDKHostname ret_var = CResult_HostnameDecodeErrorZ_get_ok(owner_conv);
10622         uint64_t ret_ref = 0;
10623         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
10624         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
10625         return ret_ref;
10626 }
10627
10628 static inline struct LDKDecodeError CResult_HostnameDecodeErrorZ_get_err(LDKCResult_HostnameDecodeErrorZ *NONNULL_PTR owner){
10629 CHECK(!owner->result_ok);
10630         return DecodeError_clone(&*owner->contents.err);
10631 }
10632 uint64_t  __attribute__((export_name("TS_CResult_HostnameDecodeErrorZ_get_err"))) TS_CResult_HostnameDecodeErrorZ_get_err(uint64_t owner) {
10633         LDKCResult_HostnameDecodeErrorZ* owner_conv = (LDKCResult_HostnameDecodeErrorZ*)untag_ptr(owner);
10634         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
10635         *ret_copy = CResult_HostnameDecodeErrorZ_get_err(owner_conv);
10636         uint64_t ret_ref = tag_ptr(ret_copy, true);
10637         return ret_ref;
10638 }
10639
10640 static inline struct LDKTransactionU16LenLimited CResult_TransactionU16LenLimitedNoneZ_get_ok(LDKCResult_TransactionU16LenLimitedNoneZ *NONNULL_PTR owner){
10641         LDKTransactionU16LenLimited ret = *owner->contents.result;
10642         ret.is_owned = false;
10643         return ret;
10644 }
10645 uint64_t  __attribute__((export_name("TS_CResult_TransactionU16LenLimitedNoneZ_get_ok"))) TS_CResult_TransactionU16LenLimitedNoneZ_get_ok(uint64_t owner) {
10646         LDKCResult_TransactionU16LenLimitedNoneZ* owner_conv = (LDKCResult_TransactionU16LenLimitedNoneZ*)untag_ptr(owner);
10647         LDKTransactionU16LenLimited ret_var = CResult_TransactionU16LenLimitedNoneZ_get_ok(owner_conv);
10648         uint64_t ret_ref = 0;
10649         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
10650         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
10651         return ret_ref;
10652 }
10653
10654 static inline void CResult_TransactionU16LenLimitedNoneZ_get_err(LDKCResult_TransactionU16LenLimitedNoneZ *NONNULL_PTR owner){
10655 CHECK(!owner->result_ok);
10656         return *owner->contents.err;
10657 }
10658 void  __attribute__((export_name("TS_CResult_TransactionU16LenLimitedNoneZ_get_err"))) TS_CResult_TransactionU16LenLimitedNoneZ_get_err(uint64_t owner) {
10659         LDKCResult_TransactionU16LenLimitedNoneZ* owner_conv = (LDKCResult_TransactionU16LenLimitedNoneZ*)untag_ptr(owner);
10660         CResult_TransactionU16LenLimitedNoneZ_get_err(owner_conv);
10661 }
10662
10663 static inline struct LDKTransactionU16LenLimited CResult_TransactionU16LenLimitedDecodeErrorZ_get_ok(LDKCResult_TransactionU16LenLimitedDecodeErrorZ *NONNULL_PTR owner){
10664         LDKTransactionU16LenLimited ret = *owner->contents.result;
10665         ret.is_owned = false;
10666         return ret;
10667 }
10668 uint64_t  __attribute__((export_name("TS_CResult_TransactionU16LenLimitedDecodeErrorZ_get_ok"))) TS_CResult_TransactionU16LenLimitedDecodeErrorZ_get_ok(uint64_t owner) {
10669         LDKCResult_TransactionU16LenLimitedDecodeErrorZ* owner_conv = (LDKCResult_TransactionU16LenLimitedDecodeErrorZ*)untag_ptr(owner);
10670         LDKTransactionU16LenLimited ret_var = CResult_TransactionU16LenLimitedDecodeErrorZ_get_ok(owner_conv);
10671         uint64_t ret_ref = 0;
10672         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
10673         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
10674         return ret_ref;
10675 }
10676
10677 static inline struct LDKDecodeError CResult_TransactionU16LenLimitedDecodeErrorZ_get_err(LDKCResult_TransactionU16LenLimitedDecodeErrorZ *NONNULL_PTR owner){
10678 CHECK(!owner->result_ok);
10679         return DecodeError_clone(&*owner->contents.err);
10680 }
10681 uint64_t  __attribute__((export_name("TS_CResult_TransactionU16LenLimitedDecodeErrorZ_get_err"))) TS_CResult_TransactionU16LenLimitedDecodeErrorZ_get_err(uint64_t owner) {
10682         LDKCResult_TransactionU16LenLimitedDecodeErrorZ* owner_conv = (LDKCResult_TransactionU16LenLimitedDecodeErrorZ*)untag_ptr(owner);
10683         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
10684         *ret_copy = CResult_TransactionU16LenLimitedDecodeErrorZ_get_err(owner_conv);
10685         uint64_t ret_ref = tag_ptr(ret_copy, true);
10686         return ret_ref;
10687 }
10688
10689 static inline struct LDKUntrustedString CResult_UntrustedStringDecodeErrorZ_get_ok(LDKCResult_UntrustedStringDecodeErrorZ *NONNULL_PTR owner){
10690         LDKUntrustedString ret = *owner->contents.result;
10691         ret.is_owned = false;
10692         return ret;
10693 }
10694 uint64_t  __attribute__((export_name("TS_CResult_UntrustedStringDecodeErrorZ_get_ok"))) TS_CResult_UntrustedStringDecodeErrorZ_get_ok(uint64_t owner) {
10695         LDKCResult_UntrustedStringDecodeErrorZ* owner_conv = (LDKCResult_UntrustedStringDecodeErrorZ*)untag_ptr(owner);
10696         LDKUntrustedString ret_var = CResult_UntrustedStringDecodeErrorZ_get_ok(owner_conv);
10697         uint64_t ret_ref = 0;
10698         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
10699         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
10700         return ret_ref;
10701 }
10702
10703 static inline struct LDKDecodeError CResult_UntrustedStringDecodeErrorZ_get_err(LDKCResult_UntrustedStringDecodeErrorZ *NONNULL_PTR owner){
10704 CHECK(!owner->result_ok);
10705         return DecodeError_clone(&*owner->contents.err);
10706 }
10707 uint64_t  __attribute__((export_name("TS_CResult_UntrustedStringDecodeErrorZ_get_err"))) TS_CResult_UntrustedStringDecodeErrorZ_get_err(uint64_t owner) {
10708         LDKCResult_UntrustedStringDecodeErrorZ* owner_conv = (LDKCResult_UntrustedStringDecodeErrorZ*)untag_ptr(owner);
10709         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
10710         *ret_copy = CResult_UntrustedStringDecodeErrorZ_get_err(owner_conv);
10711         uint64_t ret_ref = tag_ptr(ret_copy, true);
10712         return ret_ref;
10713 }
10714
10715 static inline struct LDKReceiveTlvs CResult_ReceiveTlvsDecodeErrorZ_get_ok(LDKCResult_ReceiveTlvsDecodeErrorZ *NONNULL_PTR owner){
10716         LDKReceiveTlvs ret = *owner->contents.result;
10717         ret.is_owned = false;
10718         return ret;
10719 }
10720 uint64_t  __attribute__((export_name("TS_CResult_ReceiveTlvsDecodeErrorZ_get_ok"))) TS_CResult_ReceiveTlvsDecodeErrorZ_get_ok(uint64_t owner) {
10721         LDKCResult_ReceiveTlvsDecodeErrorZ* owner_conv = (LDKCResult_ReceiveTlvsDecodeErrorZ*)untag_ptr(owner);
10722         LDKReceiveTlvs ret_var = CResult_ReceiveTlvsDecodeErrorZ_get_ok(owner_conv);
10723         uint64_t ret_ref = 0;
10724         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
10725         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
10726         return ret_ref;
10727 }
10728
10729 static inline struct LDKDecodeError CResult_ReceiveTlvsDecodeErrorZ_get_err(LDKCResult_ReceiveTlvsDecodeErrorZ *NONNULL_PTR owner){
10730 CHECK(!owner->result_ok);
10731         return DecodeError_clone(&*owner->contents.err);
10732 }
10733 uint64_t  __attribute__((export_name("TS_CResult_ReceiveTlvsDecodeErrorZ_get_err"))) TS_CResult_ReceiveTlvsDecodeErrorZ_get_err(uint64_t owner) {
10734         LDKCResult_ReceiveTlvsDecodeErrorZ* owner_conv = (LDKCResult_ReceiveTlvsDecodeErrorZ*)untag_ptr(owner);
10735         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
10736         *ret_copy = CResult_ReceiveTlvsDecodeErrorZ_get_err(owner_conv);
10737         uint64_t ret_ref = tag_ptr(ret_copy, true);
10738         return ret_ref;
10739 }
10740
10741 static inline struct LDKPaymentRelay CResult_PaymentRelayDecodeErrorZ_get_ok(LDKCResult_PaymentRelayDecodeErrorZ *NONNULL_PTR owner){
10742         LDKPaymentRelay ret = *owner->contents.result;
10743         ret.is_owned = false;
10744         return ret;
10745 }
10746 uint64_t  __attribute__((export_name("TS_CResult_PaymentRelayDecodeErrorZ_get_ok"))) TS_CResult_PaymentRelayDecodeErrorZ_get_ok(uint64_t owner) {
10747         LDKCResult_PaymentRelayDecodeErrorZ* owner_conv = (LDKCResult_PaymentRelayDecodeErrorZ*)untag_ptr(owner);
10748         LDKPaymentRelay ret_var = CResult_PaymentRelayDecodeErrorZ_get_ok(owner_conv);
10749         uint64_t ret_ref = 0;
10750         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
10751         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
10752         return ret_ref;
10753 }
10754
10755 static inline struct LDKDecodeError CResult_PaymentRelayDecodeErrorZ_get_err(LDKCResult_PaymentRelayDecodeErrorZ *NONNULL_PTR owner){
10756 CHECK(!owner->result_ok);
10757         return DecodeError_clone(&*owner->contents.err);
10758 }
10759 uint64_t  __attribute__((export_name("TS_CResult_PaymentRelayDecodeErrorZ_get_err"))) TS_CResult_PaymentRelayDecodeErrorZ_get_err(uint64_t owner) {
10760         LDKCResult_PaymentRelayDecodeErrorZ* owner_conv = (LDKCResult_PaymentRelayDecodeErrorZ*)untag_ptr(owner);
10761         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
10762         *ret_copy = CResult_PaymentRelayDecodeErrorZ_get_err(owner_conv);
10763         uint64_t ret_ref = tag_ptr(ret_copy, true);
10764         return ret_ref;
10765 }
10766
10767 static inline struct LDKPaymentConstraints CResult_PaymentConstraintsDecodeErrorZ_get_ok(LDKCResult_PaymentConstraintsDecodeErrorZ *NONNULL_PTR owner){
10768         LDKPaymentConstraints ret = *owner->contents.result;
10769         ret.is_owned = false;
10770         return ret;
10771 }
10772 uint64_t  __attribute__((export_name("TS_CResult_PaymentConstraintsDecodeErrorZ_get_ok"))) TS_CResult_PaymentConstraintsDecodeErrorZ_get_ok(uint64_t owner) {
10773         LDKCResult_PaymentConstraintsDecodeErrorZ* owner_conv = (LDKCResult_PaymentConstraintsDecodeErrorZ*)untag_ptr(owner);
10774         LDKPaymentConstraints ret_var = CResult_PaymentConstraintsDecodeErrorZ_get_ok(owner_conv);
10775         uint64_t ret_ref = 0;
10776         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
10777         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
10778         return ret_ref;
10779 }
10780
10781 static inline struct LDKDecodeError CResult_PaymentConstraintsDecodeErrorZ_get_err(LDKCResult_PaymentConstraintsDecodeErrorZ *NONNULL_PTR owner){
10782 CHECK(!owner->result_ok);
10783         return DecodeError_clone(&*owner->contents.err);
10784 }
10785 uint64_t  __attribute__((export_name("TS_CResult_PaymentConstraintsDecodeErrorZ_get_err"))) TS_CResult_PaymentConstraintsDecodeErrorZ_get_err(uint64_t owner) {
10786         LDKCResult_PaymentConstraintsDecodeErrorZ* owner_conv = (LDKCResult_PaymentConstraintsDecodeErrorZ*)untag_ptr(owner);
10787         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
10788         *ret_copy = CResult_PaymentConstraintsDecodeErrorZ_get_err(owner_conv);
10789         uint64_t ret_ref = tag_ptr(ret_copy, true);
10790         return ret_ref;
10791 }
10792
10793 uint32_t __attribute__((export_name("TS_LDKPaymentError_ty_from_ptr"))) TS_LDKPaymentError_ty_from_ptr(uint64_t ptr) {
10794         LDKPaymentError *obj = (LDKPaymentError*)untag_ptr(ptr);
10795         switch(obj->tag) {
10796                 case LDKPaymentError_Invoice: return 0;
10797                 case LDKPaymentError_Sending: return 1;
10798                 default: abort();
10799         }
10800 }
10801 jstring __attribute__((export_name("TS_LDKPaymentError_Invoice_get_invoice"))) TS_LDKPaymentError_Invoice_get_invoice(uint64_t ptr) {
10802         LDKPaymentError *obj = (LDKPaymentError*)untag_ptr(ptr);
10803         assert(obj->tag == LDKPaymentError_Invoice);
10804         LDKStr invoice_str = obj->invoice;
10805                         jstring invoice_conv = str_ref_to_ts(invoice_str.chars, invoice_str.len);
10806         return invoice_conv;
10807 }
10808 uint32_t __attribute__((export_name("TS_LDKPaymentError_Sending_get_sending"))) TS_LDKPaymentError_Sending_get_sending(uint64_t ptr) {
10809         LDKPaymentError *obj = (LDKPaymentError*)untag_ptr(ptr);
10810         assert(obj->tag == LDKPaymentError_Sending);
10811         uint32_t sending_conv = LDKRetryableSendFailure_to_js(obj->sending);
10812         return sending_conv;
10813 }
10814 static inline struct LDKThirtyTwoBytes CResult_ThirtyTwoBytesPaymentErrorZ_get_ok(LDKCResult_ThirtyTwoBytesPaymentErrorZ *NONNULL_PTR owner){
10815 CHECK(owner->result_ok);
10816         return ThirtyTwoBytes_clone(&*owner->contents.result);
10817 }
10818 int8_tArray  __attribute__((export_name("TS_CResult_ThirtyTwoBytesPaymentErrorZ_get_ok"))) TS_CResult_ThirtyTwoBytesPaymentErrorZ_get_ok(uint64_t owner) {
10819         LDKCResult_ThirtyTwoBytesPaymentErrorZ* owner_conv = (LDKCResult_ThirtyTwoBytesPaymentErrorZ*)untag_ptr(owner);
10820         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
10821         memcpy(ret_arr->elems, CResult_ThirtyTwoBytesPaymentErrorZ_get_ok(owner_conv).data, 32);
10822         return ret_arr;
10823 }
10824
10825 static inline struct LDKPaymentError CResult_ThirtyTwoBytesPaymentErrorZ_get_err(LDKCResult_ThirtyTwoBytesPaymentErrorZ *NONNULL_PTR owner){
10826 CHECK(!owner->result_ok);
10827         return PaymentError_clone(&*owner->contents.err);
10828 }
10829 uint64_t  __attribute__((export_name("TS_CResult_ThirtyTwoBytesPaymentErrorZ_get_err"))) TS_CResult_ThirtyTwoBytesPaymentErrorZ_get_err(uint64_t owner) {
10830         LDKCResult_ThirtyTwoBytesPaymentErrorZ* owner_conv = (LDKCResult_ThirtyTwoBytesPaymentErrorZ*)untag_ptr(owner);
10831         LDKPaymentError *ret_copy = MALLOC(sizeof(LDKPaymentError), "LDKPaymentError");
10832         *ret_copy = CResult_ThirtyTwoBytesPaymentErrorZ_get_err(owner_conv);
10833         uint64_t ret_ref = tag_ptr(ret_copy, true);
10834         return ret_ref;
10835 }
10836
10837 static inline void CResult_NonePaymentErrorZ_get_ok(LDKCResult_NonePaymentErrorZ *NONNULL_PTR owner){
10838 CHECK(owner->result_ok);
10839         return *owner->contents.result;
10840 }
10841 void  __attribute__((export_name("TS_CResult_NonePaymentErrorZ_get_ok"))) TS_CResult_NonePaymentErrorZ_get_ok(uint64_t owner) {
10842         LDKCResult_NonePaymentErrorZ* owner_conv = (LDKCResult_NonePaymentErrorZ*)untag_ptr(owner);
10843         CResult_NonePaymentErrorZ_get_ok(owner_conv);
10844 }
10845
10846 static inline struct LDKPaymentError CResult_NonePaymentErrorZ_get_err(LDKCResult_NonePaymentErrorZ *NONNULL_PTR owner){
10847 CHECK(!owner->result_ok);
10848         return PaymentError_clone(&*owner->contents.err);
10849 }
10850 uint64_t  __attribute__((export_name("TS_CResult_NonePaymentErrorZ_get_err"))) TS_CResult_NonePaymentErrorZ_get_err(uint64_t owner) {
10851         LDKCResult_NonePaymentErrorZ* owner_conv = (LDKCResult_NonePaymentErrorZ*)untag_ptr(owner);
10852         LDKPaymentError *ret_copy = MALLOC(sizeof(LDKPaymentError), "LDKPaymentError");
10853         *ret_copy = CResult_NonePaymentErrorZ_get_err(owner_conv);
10854         uint64_t ret_ref = tag_ptr(ret_copy, true);
10855         return ret_ref;
10856 }
10857
10858 uint32_t __attribute__((export_name("TS_LDKProbingError_ty_from_ptr"))) TS_LDKProbingError_ty_from_ptr(uint64_t ptr) {
10859         LDKProbingError *obj = (LDKProbingError*)untag_ptr(ptr);
10860         switch(obj->tag) {
10861                 case LDKProbingError_Invoice: return 0;
10862                 case LDKProbingError_Sending: return 1;
10863                 default: abort();
10864         }
10865 }
10866 jstring __attribute__((export_name("TS_LDKProbingError_Invoice_get_invoice"))) TS_LDKProbingError_Invoice_get_invoice(uint64_t ptr) {
10867         LDKProbingError *obj = (LDKProbingError*)untag_ptr(ptr);
10868         assert(obj->tag == LDKProbingError_Invoice);
10869         LDKStr invoice_str = obj->invoice;
10870                         jstring invoice_conv = str_ref_to_ts(invoice_str.chars, invoice_str.len);
10871         return invoice_conv;
10872 }
10873 uint64_t __attribute__((export_name("TS_LDKProbingError_Sending_get_sending"))) TS_LDKProbingError_Sending_get_sending(uint64_t ptr) {
10874         LDKProbingError *obj = (LDKProbingError*)untag_ptr(ptr);
10875         assert(obj->tag == LDKProbingError_Sending);
10876         uint64_t sending_ref = tag_ptr(&obj->sending, false);
10877         return sending_ref;
10878 }
10879 static inline struct LDKCVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZ CResult_CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZProbingErrorZ_get_ok(LDKCResult_CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZProbingErrorZ *NONNULL_PTR owner){
10880 CHECK(owner->result_ok);
10881         return CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZ_clone(&*owner->contents.result);
10882 }
10883 uint64_tArray  __attribute__((export_name("TS_CResult_CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZProbingErrorZ_get_ok"))) TS_CResult_CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZProbingErrorZ_get_ok(uint64_t owner) {
10884         LDKCResult_CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZProbingErrorZ* owner_conv = (LDKCResult_CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZProbingErrorZ*)untag_ptr(owner);
10885         LDKCVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZ ret_var = CResult_CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZProbingErrorZ_get_ok(owner_conv);
10886         uint64_tArray ret_arr = NULL;
10887         ret_arr = init_uint64_tArray(ret_var.datalen, __LINE__);
10888         uint64_t *ret_arr_ptr = (uint64_t*)(((uint8_t*)ret_arr) + 8);
10889         for (size_t o = 0; o < ret_var.datalen; o++) {
10890                 LDKC2Tuple_ThirtyTwoBytesThirtyTwoBytesZ* ret_conv_40_conv = MALLOC(sizeof(LDKC2Tuple_ThirtyTwoBytesThirtyTwoBytesZ), "LDKC2Tuple_ThirtyTwoBytesThirtyTwoBytesZ");
10891                 *ret_conv_40_conv = ret_var.data[o];
10892                 ret_arr_ptr[o] = tag_ptr(ret_conv_40_conv, true);
10893         }
10894         
10895         FREE(ret_var.data);
10896         return ret_arr;
10897 }
10898
10899 static inline struct LDKProbingError CResult_CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZProbingErrorZ_get_err(LDKCResult_CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZProbingErrorZ *NONNULL_PTR owner){
10900 CHECK(!owner->result_ok);
10901         return ProbingError_clone(&*owner->contents.err);
10902 }
10903 uint64_t  __attribute__((export_name("TS_CResult_CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZProbingErrorZ_get_err"))) TS_CResult_CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZProbingErrorZ_get_err(uint64_t owner) {
10904         LDKCResult_CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZProbingErrorZ* owner_conv = (LDKCResult_CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZProbingErrorZ*)untag_ptr(owner);
10905         LDKProbingError *ret_copy = MALLOC(sizeof(LDKProbingError), "LDKProbingError");
10906         *ret_copy = CResult_CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZProbingErrorZ_get_err(owner_conv);
10907         uint64_t ret_ref = tag_ptr(ret_copy, true);
10908         return ret_ref;
10909 }
10910
10911 static inline struct LDKStr CResult_StrSecp256k1ErrorZ_get_ok(LDKCResult_StrSecp256k1ErrorZ *NONNULL_PTR owner){
10912 CHECK(owner->result_ok);
10913         return *owner->contents.result;
10914 }
10915 jstring  __attribute__((export_name("TS_CResult_StrSecp256k1ErrorZ_get_ok"))) TS_CResult_StrSecp256k1ErrorZ_get_ok(uint64_t owner) {
10916         LDKCResult_StrSecp256k1ErrorZ* owner_conv = (LDKCResult_StrSecp256k1ErrorZ*)untag_ptr(owner);
10917         LDKStr ret_str = CResult_StrSecp256k1ErrorZ_get_ok(owner_conv);
10918         jstring ret_conv = str_ref_to_ts(ret_str.chars, ret_str.len);
10919         return ret_conv;
10920 }
10921
10922 static inline enum LDKSecp256k1Error CResult_StrSecp256k1ErrorZ_get_err(LDKCResult_StrSecp256k1ErrorZ *NONNULL_PTR owner){
10923 CHECK(!owner->result_ok);
10924         return *owner->contents.err;
10925 }
10926 uint32_t  __attribute__((export_name("TS_CResult_StrSecp256k1ErrorZ_get_err"))) TS_CResult_StrSecp256k1ErrorZ_get_err(uint64_t owner) {
10927         LDKCResult_StrSecp256k1ErrorZ* owner_conv = (LDKCResult_StrSecp256k1ErrorZ*)untag_ptr(owner);
10928         uint32_t ret_conv = LDKSecp256k1Error_to_js(CResult_StrSecp256k1ErrorZ_get_err(owner_conv));
10929         return ret_conv;
10930 }
10931
10932 static inline struct LDKOnionMessagePath CResult_OnionMessagePathNoneZ_get_ok(LDKCResult_OnionMessagePathNoneZ *NONNULL_PTR owner){
10933         LDKOnionMessagePath ret = *owner->contents.result;
10934         ret.is_owned = false;
10935         return ret;
10936 }
10937 uint64_t  __attribute__((export_name("TS_CResult_OnionMessagePathNoneZ_get_ok"))) TS_CResult_OnionMessagePathNoneZ_get_ok(uint64_t owner) {
10938         LDKCResult_OnionMessagePathNoneZ* owner_conv = (LDKCResult_OnionMessagePathNoneZ*)untag_ptr(owner);
10939         LDKOnionMessagePath ret_var = CResult_OnionMessagePathNoneZ_get_ok(owner_conv);
10940         uint64_t ret_ref = 0;
10941         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
10942         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
10943         return ret_ref;
10944 }
10945
10946 static inline void CResult_OnionMessagePathNoneZ_get_err(LDKCResult_OnionMessagePathNoneZ *NONNULL_PTR owner){
10947 CHECK(!owner->result_ok);
10948         return *owner->contents.err;
10949 }
10950 void  __attribute__((export_name("TS_CResult_OnionMessagePathNoneZ_get_err"))) TS_CResult_OnionMessagePathNoneZ_get_err(uint64_t owner) {
10951         LDKCResult_OnionMessagePathNoneZ* owner_conv = (LDKCResult_OnionMessagePathNoneZ*)untag_ptr(owner);
10952         CResult_OnionMessagePathNoneZ_get_err(owner_conv);
10953 }
10954
10955 static inline struct LDKPublicKey C2Tuple_PublicKeyOnionMessageZ_get_a(LDKC2Tuple_PublicKeyOnionMessageZ *NONNULL_PTR owner){
10956         return owner->a;
10957 }
10958 int8_tArray  __attribute__((export_name("TS_C2Tuple_PublicKeyOnionMessageZ_get_a"))) TS_C2Tuple_PublicKeyOnionMessageZ_get_a(uint64_t owner) {
10959         LDKC2Tuple_PublicKeyOnionMessageZ* owner_conv = (LDKC2Tuple_PublicKeyOnionMessageZ*)untag_ptr(owner);
10960         int8_tArray ret_arr = init_int8_tArray(33, __LINE__);
10961         memcpy(ret_arr->elems, C2Tuple_PublicKeyOnionMessageZ_get_a(owner_conv).compressed_form, 33);
10962         return ret_arr;
10963 }
10964
10965 static inline struct LDKOnionMessage C2Tuple_PublicKeyOnionMessageZ_get_b(LDKC2Tuple_PublicKeyOnionMessageZ *NONNULL_PTR owner){
10966         LDKOnionMessage ret = owner->b;
10967         ret.is_owned = false;
10968         return ret;
10969 }
10970 uint64_t  __attribute__((export_name("TS_C2Tuple_PublicKeyOnionMessageZ_get_b"))) TS_C2Tuple_PublicKeyOnionMessageZ_get_b(uint64_t owner) {
10971         LDKC2Tuple_PublicKeyOnionMessageZ* owner_conv = (LDKC2Tuple_PublicKeyOnionMessageZ*)untag_ptr(owner);
10972         LDKOnionMessage ret_var = C2Tuple_PublicKeyOnionMessageZ_get_b(owner_conv);
10973         uint64_t ret_ref = 0;
10974         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
10975         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
10976         return ret_ref;
10977 }
10978
10979 uint32_t __attribute__((export_name("TS_LDKSendError_ty_from_ptr"))) TS_LDKSendError_ty_from_ptr(uint64_t ptr) {
10980         LDKSendError *obj = (LDKSendError*)untag_ptr(ptr);
10981         switch(obj->tag) {
10982                 case LDKSendError_Secp256k1: return 0;
10983                 case LDKSendError_TooBigPacket: return 1;
10984                 case LDKSendError_TooFewBlindedHops: return 2;
10985                 case LDKSendError_InvalidFirstHop: return 3;
10986                 case LDKSendError_InvalidMessage: return 4;
10987                 case LDKSendError_BufferFull: return 5;
10988                 case LDKSendError_GetNodeIdFailed: return 6;
10989                 case LDKSendError_BlindedPathAdvanceFailed: return 7;
10990                 default: abort();
10991         }
10992 }
10993 uint32_t __attribute__((export_name("TS_LDKSendError_Secp256k1_get_secp256k1"))) TS_LDKSendError_Secp256k1_get_secp256k1(uint64_t ptr) {
10994         LDKSendError *obj = (LDKSendError*)untag_ptr(ptr);
10995         assert(obj->tag == LDKSendError_Secp256k1);
10996         uint32_t secp256k1_conv = LDKSecp256k1Error_to_js(obj->secp256k1);
10997         return secp256k1_conv;
10998 }
10999 static inline struct LDKC2Tuple_PublicKeyOnionMessageZ CResult_C2Tuple_PublicKeyOnionMessageZSendErrorZ_get_ok(LDKCResult_C2Tuple_PublicKeyOnionMessageZSendErrorZ *NONNULL_PTR owner){
11000 CHECK(owner->result_ok);
11001         return C2Tuple_PublicKeyOnionMessageZ_clone(&*owner->contents.result);
11002 }
11003 uint64_t  __attribute__((export_name("TS_CResult_C2Tuple_PublicKeyOnionMessageZSendErrorZ_get_ok"))) TS_CResult_C2Tuple_PublicKeyOnionMessageZSendErrorZ_get_ok(uint64_t owner) {
11004         LDKCResult_C2Tuple_PublicKeyOnionMessageZSendErrorZ* owner_conv = (LDKCResult_C2Tuple_PublicKeyOnionMessageZSendErrorZ*)untag_ptr(owner);
11005         LDKC2Tuple_PublicKeyOnionMessageZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_PublicKeyOnionMessageZ), "LDKC2Tuple_PublicKeyOnionMessageZ");
11006         *ret_conv = CResult_C2Tuple_PublicKeyOnionMessageZSendErrorZ_get_ok(owner_conv);
11007         return tag_ptr(ret_conv, true);
11008 }
11009
11010 static inline struct LDKSendError CResult_C2Tuple_PublicKeyOnionMessageZSendErrorZ_get_err(LDKCResult_C2Tuple_PublicKeyOnionMessageZSendErrorZ *NONNULL_PTR owner){
11011 CHECK(!owner->result_ok);
11012         return SendError_clone(&*owner->contents.err);
11013 }
11014 uint64_t  __attribute__((export_name("TS_CResult_C2Tuple_PublicKeyOnionMessageZSendErrorZ_get_err"))) TS_CResult_C2Tuple_PublicKeyOnionMessageZSendErrorZ_get_err(uint64_t owner) {
11015         LDKCResult_C2Tuple_PublicKeyOnionMessageZSendErrorZ* owner_conv = (LDKCResult_C2Tuple_PublicKeyOnionMessageZSendErrorZ*)untag_ptr(owner);
11016         LDKSendError *ret_copy = MALLOC(sizeof(LDKSendError), "LDKSendError");
11017         *ret_copy = CResult_C2Tuple_PublicKeyOnionMessageZSendErrorZ_get_err(owner_conv);
11018         uint64_t ret_ref = tag_ptr(ret_copy, true);
11019         return ret_ref;
11020 }
11021
11022 uint32_t __attribute__((export_name("TS_LDKParsedOnionMessageContents_ty_from_ptr"))) TS_LDKParsedOnionMessageContents_ty_from_ptr(uint64_t ptr) {
11023         LDKParsedOnionMessageContents *obj = (LDKParsedOnionMessageContents*)untag_ptr(ptr);
11024         switch(obj->tag) {
11025                 case LDKParsedOnionMessageContents_Offers: return 0;
11026                 case LDKParsedOnionMessageContents_Custom: return 1;
11027                 default: abort();
11028         }
11029 }
11030 uint64_t __attribute__((export_name("TS_LDKParsedOnionMessageContents_Offers_get_offers"))) TS_LDKParsedOnionMessageContents_Offers_get_offers(uint64_t ptr) {
11031         LDKParsedOnionMessageContents *obj = (LDKParsedOnionMessageContents*)untag_ptr(ptr);
11032         assert(obj->tag == LDKParsedOnionMessageContents_Offers);
11033         uint64_t offers_ref = tag_ptr(&obj->offers, false);
11034         return offers_ref;
11035 }
11036 uint64_t __attribute__((export_name("TS_LDKParsedOnionMessageContents_Custom_get_custom"))) TS_LDKParsedOnionMessageContents_Custom_get_custom(uint64_t ptr) {
11037         LDKParsedOnionMessageContents *obj = (LDKParsedOnionMessageContents*)untag_ptr(ptr);
11038         assert(obj->tag == LDKParsedOnionMessageContents_Custom);
11039         LDKOnionMessageContents* custom_ret = MALLOC(sizeof(LDKOnionMessageContents), "LDKOnionMessageContents");
11040         *custom_ret = OnionMessageContents_clone(&obj->custom);
11041         return tag_ptr(custom_ret, true);
11042 }
11043 uint32_t __attribute__((export_name("TS_LDKPeeledOnion_ty_from_ptr"))) TS_LDKPeeledOnion_ty_from_ptr(uint64_t ptr) {
11044         LDKPeeledOnion *obj = (LDKPeeledOnion*)untag_ptr(ptr);
11045         switch(obj->tag) {
11046                 case LDKPeeledOnion_Forward: return 0;
11047                 case LDKPeeledOnion_Receive: return 1;
11048                 default: abort();
11049         }
11050 }
11051 int8_tArray __attribute__((export_name("TS_LDKPeeledOnion_Forward_get__0"))) TS_LDKPeeledOnion_Forward_get__0(uint64_t ptr) {
11052         LDKPeeledOnion *obj = (LDKPeeledOnion*)untag_ptr(ptr);
11053         assert(obj->tag == LDKPeeledOnion_Forward);
11054         int8_tArray _0_arr = init_int8_tArray(33, __LINE__);
11055         memcpy(_0_arr->elems, obj->forward._0.compressed_form, 33);
11056         return _0_arr;
11057 }
11058 uint64_t __attribute__((export_name("TS_LDKPeeledOnion_Forward_get__1"))) TS_LDKPeeledOnion_Forward_get__1(uint64_t ptr) {
11059         LDKPeeledOnion *obj = (LDKPeeledOnion*)untag_ptr(ptr);
11060         assert(obj->tag == LDKPeeledOnion_Forward);
11061         LDKOnionMessage _1_var = obj->forward._1;
11062                         uint64_t _1_ref = 0;
11063                         CHECK_INNER_FIELD_ACCESS_OR_NULL(_1_var);
11064                         _1_ref = tag_ptr(_1_var.inner, false);
11065         return _1_ref;
11066 }
11067 uint64_t __attribute__((export_name("TS_LDKPeeledOnion_Receive_get__0"))) TS_LDKPeeledOnion_Receive_get__0(uint64_t ptr) {
11068         LDKPeeledOnion *obj = (LDKPeeledOnion*)untag_ptr(ptr);
11069         assert(obj->tag == LDKPeeledOnion_Receive);
11070         uint64_t _0_ref = tag_ptr(&obj->receive._0, false);
11071         return _0_ref;
11072 }
11073 int8_tArray __attribute__((export_name("TS_LDKPeeledOnion_Receive_get__1"))) TS_LDKPeeledOnion_Receive_get__1(uint64_t ptr) {
11074         LDKPeeledOnion *obj = (LDKPeeledOnion*)untag_ptr(ptr);
11075         assert(obj->tag == LDKPeeledOnion_Receive);
11076         int8_tArray _1_arr = init_int8_tArray(32, __LINE__);
11077         memcpy(_1_arr->elems, obj->receive._1.data, 32);
11078         return _1_arr;
11079 }
11080 uint64_t __attribute__((export_name("TS_LDKPeeledOnion_Receive_get__2"))) TS_LDKPeeledOnion_Receive_get__2(uint64_t ptr) {
11081         LDKPeeledOnion *obj = (LDKPeeledOnion*)untag_ptr(ptr);
11082         assert(obj->tag == LDKPeeledOnion_Receive);
11083         LDKBlindedPath _2_var = obj->receive._2;
11084                         uint64_t _2_ref = 0;
11085                         CHECK_INNER_FIELD_ACCESS_OR_NULL(_2_var);
11086                         _2_ref = tag_ptr(_2_var.inner, false);
11087         return _2_ref;
11088 }
11089 static inline struct LDKPeeledOnion CResult_PeeledOnionNoneZ_get_ok(LDKCResult_PeeledOnionNoneZ *NONNULL_PTR owner){
11090 CHECK(owner->result_ok);
11091         return PeeledOnion_clone(&*owner->contents.result);
11092 }
11093 uint64_t  __attribute__((export_name("TS_CResult_PeeledOnionNoneZ_get_ok"))) TS_CResult_PeeledOnionNoneZ_get_ok(uint64_t owner) {
11094         LDKCResult_PeeledOnionNoneZ* owner_conv = (LDKCResult_PeeledOnionNoneZ*)untag_ptr(owner);
11095         LDKPeeledOnion *ret_copy = MALLOC(sizeof(LDKPeeledOnion), "LDKPeeledOnion");
11096         *ret_copy = CResult_PeeledOnionNoneZ_get_ok(owner_conv);
11097         uint64_t ret_ref = tag_ptr(ret_copy, true);
11098         return ret_ref;
11099 }
11100
11101 static inline void CResult_PeeledOnionNoneZ_get_err(LDKCResult_PeeledOnionNoneZ *NONNULL_PTR owner){
11102 CHECK(!owner->result_ok);
11103         return *owner->contents.err;
11104 }
11105 void  __attribute__((export_name("TS_CResult_PeeledOnionNoneZ_get_err"))) TS_CResult_PeeledOnionNoneZ_get_err(uint64_t owner) {
11106         LDKCResult_PeeledOnionNoneZ* owner_conv = (LDKCResult_PeeledOnionNoneZ*)untag_ptr(owner);
11107         CResult_PeeledOnionNoneZ_get_err(owner_conv);
11108 }
11109
11110 static inline void CResult_NoneSendErrorZ_get_ok(LDKCResult_NoneSendErrorZ *NONNULL_PTR owner){
11111 CHECK(owner->result_ok);
11112         return *owner->contents.result;
11113 }
11114 void  __attribute__((export_name("TS_CResult_NoneSendErrorZ_get_ok"))) TS_CResult_NoneSendErrorZ_get_ok(uint64_t owner) {
11115         LDKCResult_NoneSendErrorZ* owner_conv = (LDKCResult_NoneSendErrorZ*)untag_ptr(owner);
11116         CResult_NoneSendErrorZ_get_ok(owner_conv);
11117 }
11118
11119 static inline struct LDKSendError CResult_NoneSendErrorZ_get_err(LDKCResult_NoneSendErrorZ *NONNULL_PTR owner){
11120 CHECK(!owner->result_ok);
11121         return SendError_clone(&*owner->contents.err);
11122 }
11123 uint64_t  __attribute__((export_name("TS_CResult_NoneSendErrorZ_get_err"))) TS_CResult_NoneSendErrorZ_get_err(uint64_t owner) {
11124         LDKCResult_NoneSendErrorZ* owner_conv = (LDKCResult_NoneSendErrorZ*)untag_ptr(owner);
11125         LDKSendError *ret_copy = MALLOC(sizeof(LDKSendError), "LDKSendError");
11126         *ret_copy = CResult_NoneSendErrorZ_get_err(owner_conv);
11127         uint64_t ret_ref = tag_ptr(ret_copy, true);
11128         return ret_ref;
11129 }
11130
11131 static inline struct LDKBlindedPath CResult_BlindedPathNoneZ_get_ok(LDKCResult_BlindedPathNoneZ *NONNULL_PTR owner){
11132         LDKBlindedPath ret = *owner->contents.result;
11133         ret.is_owned = false;
11134         return ret;
11135 }
11136 uint64_t  __attribute__((export_name("TS_CResult_BlindedPathNoneZ_get_ok"))) TS_CResult_BlindedPathNoneZ_get_ok(uint64_t owner) {
11137         LDKCResult_BlindedPathNoneZ* owner_conv = (LDKCResult_BlindedPathNoneZ*)untag_ptr(owner);
11138         LDKBlindedPath ret_var = CResult_BlindedPathNoneZ_get_ok(owner_conv);
11139         uint64_t ret_ref = 0;
11140         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
11141         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
11142         return ret_ref;
11143 }
11144
11145 static inline void CResult_BlindedPathNoneZ_get_err(LDKCResult_BlindedPathNoneZ *NONNULL_PTR owner){
11146 CHECK(!owner->result_ok);
11147         return *owner->contents.err;
11148 }
11149 void  __attribute__((export_name("TS_CResult_BlindedPathNoneZ_get_err"))) TS_CResult_BlindedPathNoneZ_get_err(uint64_t owner) {
11150         LDKCResult_BlindedPathNoneZ* owner_conv = (LDKCResult_BlindedPathNoneZ*)untag_ptr(owner);
11151         CResult_BlindedPathNoneZ_get_err(owner_conv);
11152 }
11153
11154 static inline struct LDKC2Tuple_BlindedPayInfoBlindedPathZ CResult_C2Tuple_BlindedPayInfoBlindedPathZNoneZ_get_ok(LDKCResult_C2Tuple_BlindedPayInfoBlindedPathZNoneZ *NONNULL_PTR owner){
11155 CHECK(owner->result_ok);
11156         return C2Tuple_BlindedPayInfoBlindedPathZ_clone(&*owner->contents.result);
11157 }
11158 uint64_t  __attribute__((export_name("TS_CResult_C2Tuple_BlindedPayInfoBlindedPathZNoneZ_get_ok"))) TS_CResult_C2Tuple_BlindedPayInfoBlindedPathZNoneZ_get_ok(uint64_t owner) {
11159         LDKCResult_C2Tuple_BlindedPayInfoBlindedPathZNoneZ* owner_conv = (LDKCResult_C2Tuple_BlindedPayInfoBlindedPathZNoneZ*)untag_ptr(owner);
11160         LDKC2Tuple_BlindedPayInfoBlindedPathZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_BlindedPayInfoBlindedPathZ), "LDKC2Tuple_BlindedPayInfoBlindedPathZ");
11161         *ret_conv = CResult_C2Tuple_BlindedPayInfoBlindedPathZNoneZ_get_ok(owner_conv);
11162         return tag_ptr(ret_conv, true);
11163 }
11164
11165 static inline void CResult_C2Tuple_BlindedPayInfoBlindedPathZNoneZ_get_err(LDKCResult_C2Tuple_BlindedPayInfoBlindedPathZNoneZ *NONNULL_PTR owner){
11166 CHECK(!owner->result_ok);
11167         return *owner->contents.err;
11168 }
11169 void  __attribute__((export_name("TS_CResult_C2Tuple_BlindedPayInfoBlindedPathZNoneZ_get_err"))) TS_CResult_C2Tuple_BlindedPayInfoBlindedPathZNoneZ_get_err(uint64_t owner) {
11170         LDKCResult_C2Tuple_BlindedPayInfoBlindedPathZNoneZ* owner_conv = (LDKCResult_C2Tuple_BlindedPayInfoBlindedPathZNoneZ*)untag_ptr(owner);
11171         CResult_C2Tuple_BlindedPayInfoBlindedPathZNoneZ_get_err(owner_conv);
11172 }
11173
11174 static inline struct LDKBlindedPath CResult_BlindedPathDecodeErrorZ_get_ok(LDKCResult_BlindedPathDecodeErrorZ *NONNULL_PTR owner){
11175         LDKBlindedPath ret = *owner->contents.result;
11176         ret.is_owned = false;
11177         return ret;
11178 }
11179 uint64_t  __attribute__((export_name("TS_CResult_BlindedPathDecodeErrorZ_get_ok"))) TS_CResult_BlindedPathDecodeErrorZ_get_ok(uint64_t owner) {
11180         LDKCResult_BlindedPathDecodeErrorZ* owner_conv = (LDKCResult_BlindedPathDecodeErrorZ*)untag_ptr(owner);
11181         LDKBlindedPath ret_var = CResult_BlindedPathDecodeErrorZ_get_ok(owner_conv);
11182         uint64_t ret_ref = 0;
11183         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
11184         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
11185         return ret_ref;
11186 }
11187
11188 static inline struct LDKDecodeError CResult_BlindedPathDecodeErrorZ_get_err(LDKCResult_BlindedPathDecodeErrorZ *NONNULL_PTR owner){
11189 CHECK(!owner->result_ok);
11190         return DecodeError_clone(&*owner->contents.err);
11191 }
11192 uint64_t  __attribute__((export_name("TS_CResult_BlindedPathDecodeErrorZ_get_err"))) TS_CResult_BlindedPathDecodeErrorZ_get_err(uint64_t owner) {
11193         LDKCResult_BlindedPathDecodeErrorZ* owner_conv = (LDKCResult_BlindedPathDecodeErrorZ*)untag_ptr(owner);
11194         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
11195         *ret_copy = CResult_BlindedPathDecodeErrorZ_get_err(owner_conv);
11196         uint64_t ret_ref = tag_ptr(ret_copy, true);
11197         return ret_ref;
11198 }
11199
11200 static inline struct LDKBlindedHop CResult_BlindedHopDecodeErrorZ_get_ok(LDKCResult_BlindedHopDecodeErrorZ *NONNULL_PTR owner){
11201         LDKBlindedHop ret = *owner->contents.result;
11202         ret.is_owned = false;
11203         return ret;
11204 }
11205 uint64_t  __attribute__((export_name("TS_CResult_BlindedHopDecodeErrorZ_get_ok"))) TS_CResult_BlindedHopDecodeErrorZ_get_ok(uint64_t owner) {
11206         LDKCResult_BlindedHopDecodeErrorZ* owner_conv = (LDKCResult_BlindedHopDecodeErrorZ*)untag_ptr(owner);
11207         LDKBlindedHop ret_var = CResult_BlindedHopDecodeErrorZ_get_ok(owner_conv);
11208         uint64_t ret_ref = 0;
11209         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
11210         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
11211         return ret_ref;
11212 }
11213
11214 static inline struct LDKDecodeError CResult_BlindedHopDecodeErrorZ_get_err(LDKCResult_BlindedHopDecodeErrorZ *NONNULL_PTR owner){
11215 CHECK(!owner->result_ok);
11216         return DecodeError_clone(&*owner->contents.err);
11217 }
11218 uint64_t  __attribute__((export_name("TS_CResult_BlindedHopDecodeErrorZ_get_err"))) TS_CResult_BlindedHopDecodeErrorZ_get_err(uint64_t owner) {
11219         LDKCResult_BlindedHopDecodeErrorZ* owner_conv = (LDKCResult_BlindedHopDecodeErrorZ*)untag_ptr(owner);
11220         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
11221         *ret_copy = CResult_BlindedHopDecodeErrorZ_get_err(owner_conv);
11222         uint64_t ret_ref = tag_ptr(ret_copy, true);
11223         return ret_ref;
11224 }
11225
11226 static inline struct LDKInvoiceError CResult_InvoiceErrorDecodeErrorZ_get_ok(LDKCResult_InvoiceErrorDecodeErrorZ *NONNULL_PTR owner){
11227         LDKInvoiceError ret = *owner->contents.result;
11228         ret.is_owned = false;
11229         return ret;
11230 }
11231 uint64_t  __attribute__((export_name("TS_CResult_InvoiceErrorDecodeErrorZ_get_ok"))) TS_CResult_InvoiceErrorDecodeErrorZ_get_ok(uint64_t owner) {
11232         LDKCResult_InvoiceErrorDecodeErrorZ* owner_conv = (LDKCResult_InvoiceErrorDecodeErrorZ*)untag_ptr(owner);
11233         LDKInvoiceError ret_var = CResult_InvoiceErrorDecodeErrorZ_get_ok(owner_conv);
11234         uint64_t ret_ref = 0;
11235         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
11236         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
11237         return ret_ref;
11238 }
11239
11240 static inline struct LDKDecodeError CResult_InvoiceErrorDecodeErrorZ_get_err(LDKCResult_InvoiceErrorDecodeErrorZ *NONNULL_PTR owner){
11241 CHECK(!owner->result_ok);
11242         return DecodeError_clone(&*owner->contents.err);
11243 }
11244 uint64_t  __attribute__((export_name("TS_CResult_InvoiceErrorDecodeErrorZ_get_err"))) TS_CResult_InvoiceErrorDecodeErrorZ_get_err(uint64_t owner) {
11245         LDKCResult_InvoiceErrorDecodeErrorZ* owner_conv = (LDKCResult_InvoiceErrorDecodeErrorZ*)untag_ptr(owner);
11246         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
11247         *ret_copy = CResult_InvoiceErrorDecodeErrorZ_get_err(owner_conv);
11248         uint64_t ret_ref = tag_ptr(ret_copy, true);
11249         return ret_ref;
11250 }
11251
11252 typedef struct LDKFilter_JCalls {
11253         atomic_size_t refcnt;
11254         uint32_t instance_ptr;
11255 } LDKFilter_JCalls;
11256 static void LDKFilter_JCalls_free(void* this_arg) {
11257         LDKFilter_JCalls *j_calls = (LDKFilter_JCalls*) this_arg;
11258         if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
11259                 FREE(j_calls);
11260         }
11261 }
11262 void register_tx_LDKFilter_jcall(const void* this_arg, const uint8_t (* txid)[32], LDKu8slice script_pubkey) {
11263         LDKFilter_JCalls *j_calls = (LDKFilter_JCalls*) this_arg;
11264         int8_tArray txid_arr = init_int8_tArray(32, __LINE__);
11265         memcpy(txid_arr->elems, *txid, 32);
11266         LDKu8slice script_pubkey_var = script_pubkey;
11267         int8_tArray script_pubkey_arr = init_int8_tArray(script_pubkey_var.datalen, __LINE__);
11268         memcpy(script_pubkey_arr->elems, script_pubkey_var.data, script_pubkey_var.datalen);
11269         js_invoke_function_uuuuuu(j_calls->instance_ptr, 43, (uint32_t)txid_arr, (uint32_t)script_pubkey_arr, 0, 0, 0, 0);
11270 }
11271 void register_output_LDKFilter_jcall(const void* this_arg, LDKWatchedOutput output) {
11272         LDKFilter_JCalls *j_calls = (LDKFilter_JCalls*) this_arg;
11273         LDKWatchedOutput output_var = output;
11274         uint64_t output_ref = 0;
11275         CHECK_INNER_FIELD_ACCESS_OR_NULL(output_var);
11276         output_ref = tag_ptr(output_var.inner, output_var.is_owned);
11277         js_invoke_function_buuuuu(j_calls->instance_ptr, 44, output_ref, 0, 0, 0, 0, 0);
11278 }
11279 static void LDKFilter_JCalls_cloned(LDKFilter* new_obj) {
11280         LDKFilter_JCalls *j_calls = (LDKFilter_JCalls*) new_obj->this_arg;
11281         atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
11282 }
11283 static inline LDKFilter LDKFilter_init (JSValue o) {
11284         LDKFilter_JCalls *calls = MALLOC(sizeof(LDKFilter_JCalls), "LDKFilter_JCalls");
11285         atomic_init(&calls->refcnt, 1);
11286         calls->instance_ptr = o;
11287
11288         LDKFilter ret = {
11289                 .this_arg = (void*) calls,
11290                 .register_tx = register_tx_LDKFilter_jcall,
11291                 .register_output = register_output_LDKFilter_jcall,
11292                 .free = LDKFilter_JCalls_free,
11293         };
11294         return ret;
11295 }
11296 uint64_t  __attribute__((export_name("TS_LDKFilter_new"))) TS_LDKFilter_new(JSValue o) {
11297         LDKFilter *res_ptr = MALLOC(sizeof(LDKFilter), "LDKFilter");
11298         *res_ptr = LDKFilter_init(o);
11299         return tag_ptr(res_ptr, true);
11300 }
11301 void  __attribute__((export_name("TS_Filter_register_tx"))) TS_Filter_register_tx(uint64_t this_arg, int8_tArray txid, int8_tArray script_pubkey) {
11302         void* this_arg_ptr = untag_ptr(this_arg);
11303         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
11304         LDKFilter* this_arg_conv = (LDKFilter*)this_arg_ptr;
11305         uint8_t txid_arr[32];
11306         CHECK(txid->arr_len == 32);
11307         memcpy(txid_arr, txid->elems, 32); FREE(txid);
11308         uint8_t (*txid_ref)[32] = &txid_arr;
11309         LDKu8slice script_pubkey_ref;
11310         script_pubkey_ref.datalen = script_pubkey->arr_len;
11311         script_pubkey_ref.data = script_pubkey->elems;
11312         (this_arg_conv->register_tx)(this_arg_conv->this_arg, txid_ref, script_pubkey_ref);
11313         FREE(script_pubkey);
11314 }
11315
11316 void  __attribute__((export_name("TS_Filter_register_output"))) TS_Filter_register_output(uint64_t this_arg, uint64_t output) {
11317         void* this_arg_ptr = untag_ptr(this_arg);
11318         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
11319         LDKFilter* this_arg_conv = (LDKFilter*)this_arg_ptr;
11320         LDKWatchedOutput output_conv;
11321         output_conv.inner = untag_ptr(output);
11322         output_conv.is_owned = ptr_is_owned(output);
11323         CHECK_INNER_FIELD_ACCESS_OR_NULL(output_conv);
11324         output_conv = WatchedOutput_clone(&output_conv);
11325         (this_arg_conv->register_output)(this_arg_conv->this_arg, output_conv);
11326 }
11327
11328 uint32_t __attribute__((export_name("TS_LDKCOption_FilterZ_ty_from_ptr"))) TS_LDKCOption_FilterZ_ty_from_ptr(uint64_t ptr) {
11329         LDKCOption_FilterZ *obj = (LDKCOption_FilterZ*)untag_ptr(ptr);
11330         switch(obj->tag) {
11331                 case LDKCOption_FilterZ_Some: return 0;
11332                 case LDKCOption_FilterZ_None: return 1;
11333                 default: abort();
11334         }
11335 }
11336 uint64_t __attribute__((export_name("TS_LDKCOption_FilterZ_Some_get_some"))) TS_LDKCOption_FilterZ_Some_get_some(uint64_t ptr) {
11337         LDKCOption_FilterZ *obj = (LDKCOption_FilterZ*)untag_ptr(ptr);
11338         assert(obj->tag == LDKCOption_FilterZ_Some);
11339         LDKFilter* some_ret = MALLOC(sizeof(LDKFilter), "LDKFilter");
11340         *some_ret = obj->some;
11341                         // WARNING: We likely need to clone here, but no clone is available, so we just do it for Java instances
11342                         if ((*some_ret).free == LDKFilter_JCalls_free) {
11343                                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
11344                                 LDKFilter_JCalls_cloned(&(*some_ret));
11345                         }
11346         return tag_ptr(some_ret, true);
11347 }
11348 static inline struct LDKLockedChannelMonitor CResult_LockedChannelMonitorNoneZ_get_ok(LDKCResult_LockedChannelMonitorNoneZ *NONNULL_PTR owner){
11349         LDKLockedChannelMonitor ret = *owner->contents.result;
11350         ret.is_owned = false;
11351         return ret;
11352 }
11353 uint64_t  __attribute__((export_name("TS_CResult_LockedChannelMonitorNoneZ_get_ok"))) TS_CResult_LockedChannelMonitorNoneZ_get_ok(uint64_t owner) {
11354         LDKCResult_LockedChannelMonitorNoneZ* owner_conv = (LDKCResult_LockedChannelMonitorNoneZ*)untag_ptr(owner);
11355         LDKLockedChannelMonitor ret_var = CResult_LockedChannelMonitorNoneZ_get_ok(owner_conv);
11356         uint64_t ret_ref = 0;
11357         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
11358         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
11359         return ret_ref;
11360 }
11361
11362 static inline void CResult_LockedChannelMonitorNoneZ_get_err(LDKCResult_LockedChannelMonitorNoneZ *NONNULL_PTR owner){
11363 CHECK(!owner->result_ok);
11364         return *owner->contents.err;
11365 }
11366 void  __attribute__((export_name("TS_CResult_LockedChannelMonitorNoneZ_get_err"))) TS_CResult_LockedChannelMonitorNoneZ_get_err(uint64_t owner) {
11367         LDKCResult_LockedChannelMonitorNoneZ* owner_conv = (LDKCResult_LockedChannelMonitorNoneZ*)untag_ptr(owner);
11368         CResult_LockedChannelMonitorNoneZ_get_err(owner_conv);
11369 }
11370
11371 static inline LDKCVec_OutPointZ CVec_OutPointZ_clone(const LDKCVec_OutPointZ *orig) {
11372         LDKCVec_OutPointZ ret = { .data = MALLOC(sizeof(LDKOutPoint) * orig->datalen, "LDKCVec_OutPointZ clone bytes"), .datalen = orig->datalen };
11373         for (size_t i = 0; i < ret.datalen; i++) {
11374                 ret.data[i] = OutPoint_clone(&orig->data[i]);
11375         }
11376         return ret;
11377 }
11378 static inline LDKCVec_MonitorUpdateIdZ CVec_MonitorUpdateIdZ_clone(const LDKCVec_MonitorUpdateIdZ *orig) {
11379         LDKCVec_MonitorUpdateIdZ ret = { .data = MALLOC(sizeof(LDKMonitorUpdateId) * orig->datalen, "LDKCVec_MonitorUpdateIdZ clone bytes"), .datalen = orig->datalen };
11380         for (size_t i = 0; i < ret.datalen; i++) {
11381                 ret.data[i] = MonitorUpdateId_clone(&orig->data[i]);
11382         }
11383         return ret;
11384 }
11385 static inline struct LDKOutPoint C2Tuple_OutPointCVec_MonitorUpdateIdZZ_get_a(LDKC2Tuple_OutPointCVec_MonitorUpdateIdZZ *NONNULL_PTR owner){
11386         LDKOutPoint ret = owner->a;
11387         ret.is_owned = false;
11388         return ret;
11389 }
11390 uint64_t  __attribute__((export_name("TS_C2Tuple_OutPointCVec_MonitorUpdateIdZZ_get_a"))) TS_C2Tuple_OutPointCVec_MonitorUpdateIdZZ_get_a(uint64_t owner) {
11391         LDKC2Tuple_OutPointCVec_MonitorUpdateIdZZ* owner_conv = (LDKC2Tuple_OutPointCVec_MonitorUpdateIdZZ*)untag_ptr(owner);
11392         LDKOutPoint ret_var = C2Tuple_OutPointCVec_MonitorUpdateIdZZ_get_a(owner_conv);
11393         uint64_t ret_ref = 0;
11394         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
11395         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
11396         return ret_ref;
11397 }
11398
11399 static inline struct LDKCVec_MonitorUpdateIdZ C2Tuple_OutPointCVec_MonitorUpdateIdZZ_get_b(LDKC2Tuple_OutPointCVec_MonitorUpdateIdZZ *NONNULL_PTR owner){
11400         return CVec_MonitorUpdateIdZ_clone(&owner->b);
11401 }
11402 uint64_tArray  __attribute__((export_name("TS_C2Tuple_OutPointCVec_MonitorUpdateIdZZ_get_b"))) TS_C2Tuple_OutPointCVec_MonitorUpdateIdZZ_get_b(uint64_t owner) {
11403         LDKC2Tuple_OutPointCVec_MonitorUpdateIdZZ* owner_conv = (LDKC2Tuple_OutPointCVec_MonitorUpdateIdZZ*)untag_ptr(owner);
11404         LDKCVec_MonitorUpdateIdZ ret_var = C2Tuple_OutPointCVec_MonitorUpdateIdZZ_get_b(owner_conv);
11405         uint64_tArray ret_arr = NULL;
11406         ret_arr = init_uint64_tArray(ret_var.datalen, __LINE__);
11407         uint64_t *ret_arr_ptr = (uint64_t*)(((uint8_t*)ret_arr) + 8);
11408         for (size_t r = 0; r < ret_var.datalen; r++) {
11409                 LDKMonitorUpdateId ret_conv_17_var = ret_var.data[r];
11410                 uint64_t ret_conv_17_ref = 0;
11411                 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_conv_17_var);
11412                 ret_conv_17_ref = tag_ptr(ret_conv_17_var.inner, ret_conv_17_var.is_owned);
11413                 ret_arr_ptr[r] = ret_conv_17_ref;
11414         }
11415         
11416         FREE(ret_var.data);
11417         return ret_arr;
11418 }
11419
11420 static inline LDKCVec_C2Tuple_OutPointCVec_MonitorUpdateIdZZZ CVec_C2Tuple_OutPointCVec_MonitorUpdateIdZZZ_clone(const LDKCVec_C2Tuple_OutPointCVec_MonitorUpdateIdZZZ *orig) {
11421         LDKCVec_C2Tuple_OutPointCVec_MonitorUpdateIdZZZ ret = { .data = MALLOC(sizeof(LDKC2Tuple_OutPointCVec_MonitorUpdateIdZZ) * orig->datalen, "LDKCVec_C2Tuple_OutPointCVec_MonitorUpdateIdZZZ clone bytes"), .datalen = orig->datalen };
11422         for (size_t i = 0; i < ret.datalen; i++) {
11423                 ret.data[i] = C2Tuple_OutPointCVec_MonitorUpdateIdZZ_clone(&orig->data[i]);
11424         }
11425         return ret;
11426 }
11427 typedef struct LDKKVStore_JCalls {
11428         atomic_size_t refcnt;
11429         uint32_t instance_ptr;
11430 } LDKKVStore_JCalls;
11431 static void LDKKVStore_JCalls_free(void* this_arg) {
11432         LDKKVStore_JCalls *j_calls = (LDKKVStore_JCalls*) this_arg;
11433         if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
11434                 FREE(j_calls);
11435         }
11436 }
11437 LDKCResult_CVec_u8ZIOErrorZ read_LDKKVStore_jcall(const void* this_arg, LDKStr primary_namespace, LDKStr secondary_namespace, LDKStr key) {
11438         LDKKVStore_JCalls *j_calls = (LDKKVStore_JCalls*) this_arg;
11439         LDKStr primary_namespace_str = primary_namespace;
11440         jstring primary_namespace_conv = str_ref_to_ts(primary_namespace_str.chars, primary_namespace_str.len);
11441         Str_free(primary_namespace_str);
11442         LDKStr secondary_namespace_str = secondary_namespace;
11443         jstring secondary_namespace_conv = str_ref_to_ts(secondary_namespace_str.chars, secondary_namespace_str.len);
11444         Str_free(secondary_namespace_str);
11445         LDKStr key_str = key;
11446         jstring key_conv = str_ref_to_ts(key_str.chars, key_str.len);
11447         Str_free(key_str);
11448         uint64_t ret = js_invoke_function_uuuuuu(j_calls->instance_ptr, 45, primary_namespace_conv, secondary_namespace_conv, key_conv, 0, 0, 0);
11449         void* ret_ptr = untag_ptr(ret);
11450         CHECK_ACCESS(ret_ptr);
11451         LDKCResult_CVec_u8ZIOErrorZ ret_conv = *(LDKCResult_CVec_u8ZIOErrorZ*)(ret_ptr);
11452         FREE(untag_ptr(ret));
11453         return ret_conv;
11454 }
11455 LDKCResult_NoneIOErrorZ write_LDKKVStore_jcall(const void* this_arg, LDKStr primary_namespace, LDKStr secondary_namespace, LDKStr key, LDKu8slice buf) {
11456         LDKKVStore_JCalls *j_calls = (LDKKVStore_JCalls*) this_arg;
11457         LDKStr primary_namespace_str = primary_namespace;
11458         jstring primary_namespace_conv = str_ref_to_ts(primary_namespace_str.chars, primary_namespace_str.len);
11459         Str_free(primary_namespace_str);
11460         LDKStr secondary_namespace_str = secondary_namespace;
11461         jstring secondary_namespace_conv = str_ref_to_ts(secondary_namespace_str.chars, secondary_namespace_str.len);
11462         Str_free(secondary_namespace_str);
11463         LDKStr key_str = key;
11464         jstring key_conv = str_ref_to_ts(key_str.chars, key_str.len);
11465         Str_free(key_str);
11466         LDKu8slice buf_var = buf;
11467         int8_tArray buf_arr = init_int8_tArray(buf_var.datalen, __LINE__);
11468         memcpy(buf_arr->elems, buf_var.data, buf_var.datalen);
11469         uint64_t ret = js_invoke_function_uuuuuu(j_calls->instance_ptr, 46, primary_namespace_conv, secondary_namespace_conv, key_conv, (uint32_t)buf_arr, 0, 0);
11470         void* ret_ptr = untag_ptr(ret);
11471         CHECK_ACCESS(ret_ptr);
11472         LDKCResult_NoneIOErrorZ ret_conv = *(LDKCResult_NoneIOErrorZ*)(ret_ptr);
11473         FREE(untag_ptr(ret));
11474         return ret_conv;
11475 }
11476 LDKCResult_NoneIOErrorZ remove_LDKKVStore_jcall(const void* this_arg, LDKStr primary_namespace, LDKStr secondary_namespace, LDKStr key, bool lazy) {
11477         LDKKVStore_JCalls *j_calls = (LDKKVStore_JCalls*) this_arg;
11478         LDKStr primary_namespace_str = primary_namespace;
11479         jstring primary_namespace_conv = str_ref_to_ts(primary_namespace_str.chars, primary_namespace_str.len);
11480         Str_free(primary_namespace_str);
11481         LDKStr secondary_namespace_str = secondary_namespace;
11482         jstring secondary_namespace_conv = str_ref_to_ts(secondary_namespace_str.chars, secondary_namespace_str.len);
11483         Str_free(secondary_namespace_str);
11484         LDKStr key_str = key;
11485         jstring key_conv = str_ref_to_ts(key_str.chars, key_str.len);
11486         Str_free(key_str);
11487         jboolean lazy_conv = lazy;
11488         uint64_t ret = js_invoke_function_uuuuuu(j_calls->instance_ptr, 47, primary_namespace_conv, secondary_namespace_conv, key_conv, lazy_conv, 0, 0);
11489         void* ret_ptr = untag_ptr(ret);
11490         CHECK_ACCESS(ret_ptr);
11491         LDKCResult_NoneIOErrorZ ret_conv = *(LDKCResult_NoneIOErrorZ*)(ret_ptr);
11492         FREE(untag_ptr(ret));
11493         return ret_conv;
11494 }
11495 LDKCResult_CVec_StrZIOErrorZ list_LDKKVStore_jcall(const void* this_arg, LDKStr primary_namespace, LDKStr secondary_namespace) {
11496         LDKKVStore_JCalls *j_calls = (LDKKVStore_JCalls*) this_arg;
11497         LDKStr primary_namespace_str = primary_namespace;
11498         jstring primary_namespace_conv = str_ref_to_ts(primary_namespace_str.chars, primary_namespace_str.len);
11499         Str_free(primary_namespace_str);
11500         LDKStr secondary_namespace_str = secondary_namespace;
11501         jstring secondary_namespace_conv = str_ref_to_ts(secondary_namespace_str.chars, secondary_namespace_str.len);
11502         Str_free(secondary_namespace_str);
11503         uint64_t ret = js_invoke_function_uuuuuu(j_calls->instance_ptr, 48, primary_namespace_conv, secondary_namespace_conv, 0, 0, 0, 0);
11504         void* ret_ptr = untag_ptr(ret);
11505         CHECK_ACCESS(ret_ptr);
11506         LDKCResult_CVec_StrZIOErrorZ ret_conv = *(LDKCResult_CVec_StrZIOErrorZ*)(ret_ptr);
11507         FREE(untag_ptr(ret));
11508         return ret_conv;
11509 }
11510 static void LDKKVStore_JCalls_cloned(LDKKVStore* new_obj) {
11511         LDKKVStore_JCalls *j_calls = (LDKKVStore_JCalls*) new_obj->this_arg;
11512         atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
11513 }
11514 static inline LDKKVStore LDKKVStore_init (JSValue o) {
11515         LDKKVStore_JCalls *calls = MALLOC(sizeof(LDKKVStore_JCalls), "LDKKVStore_JCalls");
11516         atomic_init(&calls->refcnt, 1);
11517         calls->instance_ptr = o;
11518
11519         LDKKVStore ret = {
11520                 .this_arg = (void*) calls,
11521                 .read = read_LDKKVStore_jcall,
11522                 .write = write_LDKKVStore_jcall,
11523                 .remove = remove_LDKKVStore_jcall,
11524                 .list = list_LDKKVStore_jcall,
11525                 .free = LDKKVStore_JCalls_free,
11526         };
11527         return ret;
11528 }
11529 uint64_t  __attribute__((export_name("TS_LDKKVStore_new"))) TS_LDKKVStore_new(JSValue o) {
11530         LDKKVStore *res_ptr = MALLOC(sizeof(LDKKVStore), "LDKKVStore");
11531         *res_ptr = LDKKVStore_init(o);
11532         return tag_ptr(res_ptr, true);
11533 }
11534 uint64_t  __attribute__((export_name("TS_KVStore_read"))) TS_KVStore_read(uint64_t this_arg, jstring primary_namespace, jstring secondary_namespace, jstring key) {
11535         void* this_arg_ptr = untag_ptr(this_arg);
11536         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
11537         LDKKVStore* this_arg_conv = (LDKKVStore*)this_arg_ptr;
11538         LDKStr primary_namespace_conv = str_ref_to_owned_c(primary_namespace);
11539         LDKStr secondary_namespace_conv = str_ref_to_owned_c(secondary_namespace);
11540         LDKStr key_conv = str_ref_to_owned_c(key);
11541         LDKCResult_CVec_u8ZIOErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_u8ZIOErrorZ), "LDKCResult_CVec_u8ZIOErrorZ");
11542         *ret_conv = (this_arg_conv->read)(this_arg_conv->this_arg, primary_namespace_conv, secondary_namespace_conv, key_conv);
11543         return tag_ptr(ret_conv, true);
11544 }
11545
11546 uint64_t  __attribute__((export_name("TS_KVStore_write"))) TS_KVStore_write(uint64_t this_arg, jstring primary_namespace, jstring secondary_namespace, jstring key, int8_tArray buf) {
11547         void* this_arg_ptr = untag_ptr(this_arg);
11548         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
11549         LDKKVStore* this_arg_conv = (LDKKVStore*)this_arg_ptr;
11550         LDKStr primary_namespace_conv = str_ref_to_owned_c(primary_namespace);
11551         LDKStr secondary_namespace_conv = str_ref_to_owned_c(secondary_namespace);
11552         LDKStr key_conv = str_ref_to_owned_c(key);
11553         LDKu8slice buf_ref;
11554         buf_ref.datalen = buf->arr_len;
11555         buf_ref.data = buf->elems;
11556         LDKCResult_NoneIOErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneIOErrorZ), "LDKCResult_NoneIOErrorZ");
11557         *ret_conv = (this_arg_conv->write)(this_arg_conv->this_arg, primary_namespace_conv, secondary_namespace_conv, key_conv, buf_ref);
11558         FREE(buf);
11559         return tag_ptr(ret_conv, true);
11560 }
11561
11562 uint64_t  __attribute__((export_name("TS_KVStore_remove"))) TS_KVStore_remove(uint64_t this_arg, jstring primary_namespace, jstring secondary_namespace, jstring key, jboolean lazy) {
11563         void* this_arg_ptr = untag_ptr(this_arg);
11564         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
11565         LDKKVStore* this_arg_conv = (LDKKVStore*)this_arg_ptr;
11566         LDKStr primary_namespace_conv = str_ref_to_owned_c(primary_namespace);
11567         LDKStr secondary_namespace_conv = str_ref_to_owned_c(secondary_namespace);
11568         LDKStr key_conv = str_ref_to_owned_c(key);
11569         LDKCResult_NoneIOErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneIOErrorZ), "LDKCResult_NoneIOErrorZ");
11570         *ret_conv = (this_arg_conv->remove)(this_arg_conv->this_arg, primary_namespace_conv, secondary_namespace_conv, key_conv, lazy);
11571         return tag_ptr(ret_conv, true);
11572 }
11573
11574 uint64_t  __attribute__((export_name("TS_KVStore_list"))) TS_KVStore_list(uint64_t this_arg, jstring primary_namespace, jstring secondary_namespace) {
11575         void* this_arg_ptr = untag_ptr(this_arg);
11576         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
11577         LDKKVStore* this_arg_conv = (LDKKVStore*)this_arg_ptr;
11578         LDKStr primary_namespace_conv = str_ref_to_owned_c(primary_namespace);
11579         LDKStr secondary_namespace_conv = str_ref_to_owned_c(secondary_namespace);
11580         LDKCResult_CVec_StrZIOErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_StrZIOErrorZ), "LDKCResult_CVec_StrZIOErrorZ");
11581         *ret_conv = (this_arg_conv->list)(this_arg_conv->this_arg, primary_namespace_conv, secondary_namespace_conv);
11582         return tag_ptr(ret_conv, true);
11583 }
11584
11585 typedef struct LDKScoreLookUp_JCalls {
11586         atomic_size_t refcnt;
11587         uint32_t instance_ptr;
11588 } LDKScoreLookUp_JCalls;
11589 static void LDKScoreLookUp_JCalls_free(void* this_arg) {
11590         LDKScoreLookUp_JCalls *j_calls = (LDKScoreLookUp_JCalls*) this_arg;
11591         if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
11592                 FREE(j_calls);
11593         }
11594 }
11595 uint64_t channel_penalty_msat_LDKScoreLookUp_jcall(const void* this_arg, uint64_t short_channel_id, const LDKNodeId * source, const LDKNodeId * target, LDKChannelUsage usage, const LDKProbabilisticScoringFeeParameters * score_params) {
11596         LDKScoreLookUp_JCalls *j_calls = (LDKScoreLookUp_JCalls*) this_arg;
11597         int64_t short_channel_id_conv = short_channel_id;
11598         LDKNodeId source_var = *source;
11599         uint64_t source_ref = 0;
11600         source_var = NodeId_clone(&source_var);
11601         CHECK_INNER_FIELD_ACCESS_OR_NULL(source_var);
11602         source_ref = tag_ptr(source_var.inner, source_var.is_owned);
11603         LDKNodeId target_var = *target;
11604         uint64_t target_ref = 0;
11605         target_var = NodeId_clone(&target_var);
11606         CHECK_INNER_FIELD_ACCESS_OR_NULL(target_var);
11607         target_ref = tag_ptr(target_var.inner, target_var.is_owned);
11608         LDKChannelUsage usage_var = usage;
11609         uint64_t usage_ref = 0;
11610         CHECK_INNER_FIELD_ACCESS_OR_NULL(usage_var);
11611         usage_ref = tag_ptr(usage_var.inner, usage_var.is_owned);
11612         LDKProbabilisticScoringFeeParameters score_params_var = *score_params;
11613         uint64_t score_params_ref = 0;
11614         score_params_var = ProbabilisticScoringFeeParameters_clone(&score_params_var);
11615         CHECK_INNER_FIELD_ACCESS_OR_NULL(score_params_var);
11616         score_params_ref = tag_ptr(score_params_var.inner, score_params_var.is_owned);
11617         return js_invoke_function_bbbbbu(j_calls->instance_ptr, 49, short_channel_id_conv, source_ref, target_ref, usage_ref, score_params_ref, 0);
11618 }
11619 static void LDKScoreLookUp_JCalls_cloned(LDKScoreLookUp* new_obj) {
11620         LDKScoreLookUp_JCalls *j_calls = (LDKScoreLookUp_JCalls*) new_obj->this_arg;
11621         atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
11622 }
11623 static inline LDKScoreLookUp LDKScoreLookUp_init (JSValue o) {
11624         LDKScoreLookUp_JCalls *calls = MALLOC(sizeof(LDKScoreLookUp_JCalls), "LDKScoreLookUp_JCalls");
11625         atomic_init(&calls->refcnt, 1);
11626         calls->instance_ptr = o;
11627
11628         LDKScoreLookUp ret = {
11629                 .this_arg = (void*) calls,
11630                 .channel_penalty_msat = channel_penalty_msat_LDKScoreLookUp_jcall,
11631                 .free = LDKScoreLookUp_JCalls_free,
11632         };
11633         return ret;
11634 }
11635 uint64_t  __attribute__((export_name("TS_LDKScoreLookUp_new"))) TS_LDKScoreLookUp_new(JSValue o) {
11636         LDKScoreLookUp *res_ptr = MALLOC(sizeof(LDKScoreLookUp), "LDKScoreLookUp");
11637         *res_ptr = LDKScoreLookUp_init(o);
11638         return tag_ptr(res_ptr, true);
11639 }
11640 int64_t  __attribute__((export_name("TS_ScoreLookUp_channel_penalty_msat"))) TS_ScoreLookUp_channel_penalty_msat(uint64_t this_arg, int64_t short_channel_id, uint64_t source, uint64_t target, uint64_t usage, uint64_t score_params) {
11641         void* this_arg_ptr = untag_ptr(this_arg);
11642         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
11643         LDKScoreLookUp* this_arg_conv = (LDKScoreLookUp*)this_arg_ptr;
11644         LDKNodeId source_conv;
11645         source_conv.inner = untag_ptr(source);
11646         source_conv.is_owned = ptr_is_owned(source);
11647         CHECK_INNER_FIELD_ACCESS_OR_NULL(source_conv);
11648         source_conv.is_owned = false;
11649         LDKNodeId target_conv;
11650         target_conv.inner = untag_ptr(target);
11651         target_conv.is_owned = ptr_is_owned(target);
11652         CHECK_INNER_FIELD_ACCESS_OR_NULL(target_conv);
11653         target_conv.is_owned = false;
11654         LDKChannelUsage usage_conv;
11655         usage_conv.inner = untag_ptr(usage);
11656         usage_conv.is_owned = ptr_is_owned(usage);
11657         CHECK_INNER_FIELD_ACCESS_OR_NULL(usage_conv);
11658         usage_conv = ChannelUsage_clone(&usage_conv);
11659         LDKProbabilisticScoringFeeParameters score_params_conv;
11660         score_params_conv.inner = untag_ptr(score_params);
11661         score_params_conv.is_owned = ptr_is_owned(score_params);
11662         CHECK_INNER_FIELD_ACCESS_OR_NULL(score_params_conv);
11663         score_params_conv.is_owned = false;
11664         int64_t ret_conv = (this_arg_conv->channel_penalty_msat)(this_arg_conv->this_arg, short_channel_id, &source_conv, &target_conv, usage_conv, &score_params_conv);
11665         return ret_conv;
11666 }
11667
11668 typedef struct LDKScoreUpdate_JCalls {
11669         atomic_size_t refcnt;
11670         uint32_t instance_ptr;
11671 } LDKScoreUpdate_JCalls;
11672 static void LDKScoreUpdate_JCalls_free(void* this_arg) {
11673         LDKScoreUpdate_JCalls *j_calls = (LDKScoreUpdate_JCalls*) this_arg;
11674         if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
11675                 FREE(j_calls);
11676         }
11677 }
11678 void payment_path_failed_LDKScoreUpdate_jcall(void* this_arg, const LDKPath * path, uint64_t short_channel_id) {
11679         LDKScoreUpdate_JCalls *j_calls = (LDKScoreUpdate_JCalls*) this_arg;
11680         LDKPath path_var = *path;
11681         uint64_t path_ref = 0;
11682         path_var = Path_clone(&path_var);
11683         CHECK_INNER_FIELD_ACCESS_OR_NULL(path_var);
11684         path_ref = tag_ptr(path_var.inner, path_var.is_owned);
11685         int64_t short_channel_id_conv = short_channel_id;
11686         js_invoke_function_bbuuuu(j_calls->instance_ptr, 50, path_ref, short_channel_id_conv, 0, 0, 0, 0);
11687 }
11688 void payment_path_successful_LDKScoreUpdate_jcall(void* this_arg, const LDKPath * path) {
11689         LDKScoreUpdate_JCalls *j_calls = (LDKScoreUpdate_JCalls*) this_arg;
11690         LDKPath path_var = *path;
11691         uint64_t path_ref = 0;
11692         path_var = Path_clone(&path_var);
11693         CHECK_INNER_FIELD_ACCESS_OR_NULL(path_var);
11694         path_ref = tag_ptr(path_var.inner, path_var.is_owned);
11695         js_invoke_function_buuuuu(j_calls->instance_ptr, 51, path_ref, 0, 0, 0, 0, 0);
11696 }
11697 void probe_failed_LDKScoreUpdate_jcall(void* this_arg, const LDKPath * path, uint64_t short_channel_id) {
11698         LDKScoreUpdate_JCalls *j_calls = (LDKScoreUpdate_JCalls*) this_arg;
11699         LDKPath path_var = *path;
11700         uint64_t path_ref = 0;
11701         path_var = Path_clone(&path_var);
11702         CHECK_INNER_FIELD_ACCESS_OR_NULL(path_var);
11703         path_ref = tag_ptr(path_var.inner, path_var.is_owned);
11704         int64_t short_channel_id_conv = short_channel_id;
11705         js_invoke_function_bbuuuu(j_calls->instance_ptr, 52, path_ref, short_channel_id_conv, 0, 0, 0, 0);
11706 }
11707 void probe_successful_LDKScoreUpdate_jcall(void* this_arg, const LDKPath * path) {
11708         LDKScoreUpdate_JCalls *j_calls = (LDKScoreUpdate_JCalls*) this_arg;
11709         LDKPath path_var = *path;
11710         uint64_t path_ref = 0;
11711         path_var = Path_clone(&path_var);
11712         CHECK_INNER_FIELD_ACCESS_OR_NULL(path_var);
11713         path_ref = tag_ptr(path_var.inner, path_var.is_owned);
11714         js_invoke_function_buuuuu(j_calls->instance_ptr, 53, path_ref, 0, 0, 0, 0, 0);
11715 }
11716 static void LDKScoreUpdate_JCalls_cloned(LDKScoreUpdate* new_obj) {
11717         LDKScoreUpdate_JCalls *j_calls = (LDKScoreUpdate_JCalls*) new_obj->this_arg;
11718         atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
11719 }
11720 static inline LDKScoreUpdate LDKScoreUpdate_init (JSValue o) {
11721         LDKScoreUpdate_JCalls *calls = MALLOC(sizeof(LDKScoreUpdate_JCalls), "LDKScoreUpdate_JCalls");
11722         atomic_init(&calls->refcnt, 1);
11723         calls->instance_ptr = o;
11724
11725         LDKScoreUpdate ret = {
11726                 .this_arg = (void*) calls,
11727                 .payment_path_failed = payment_path_failed_LDKScoreUpdate_jcall,
11728                 .payment_path_successful = payment_path_successful_LDKScoreUpdate_jcall,
11729                 .probe_failed = probe_failed_LDKScoreUpdate_jcall,
11730                 .probe_successful = probe_successful_LDKScoreUpdate_jcall,
11731                 .free = LDKScoreUpdate_JCalls_free,
11732         };
11733         return ret;
11734 }
11735 uint64_t  __attribute__((export_name("TS_LDKScoreUpdate_new"))) TS_LDKScoreUpdate_new(JSValue o) {
11736         LDKScoreUpdate *res_ptr = MALLOC(sizeof(LDKScoreUpdate), "LDKScoreUpdate");
11737         *res_ptr = LDKScoreUpdate_init(o);
11738         return tag_ptr(res_ptr, true);
11739 }
11740 void  __attribute__((export_name("TS_ScoreUpdate_payment_path_failed"))) TS_ScoreUpdate_payment_path_failed(uint64_t this_arg, uint64_t path, int64_t short_channel_id) {
11741         void* this_arg_ptr = untag_ptr(this_arg);
11742         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
11743         LDKScoreUpdate* this_arg_conv = (LDKScoreUpdate*)this_arg_ptr;
11744         LDKPath path_conv;
11745         path_conv.inner = untag_ptr(path);
11746         path_conv.is_owned = ptr_is_owned(path);
11747         CHECK_INNER_FIELD_ACCESS_OR_NULL(path_conv);
11748         path_conv.is_owned = false;
11749         (this_arg_conv->payment_path_failed)(this_arg_conv->this_arg, &path_conv, short_channel_id);
11750 }
11751
11752 void  __attribute__((export_name("TS_ScoreUpdate_payment_path_successful"))) TS_ScoreUpdate_payment_path_successful(uint64_t this_arg, uint64_t path) {
11753         void* this_arg_ptr = untag_ptr(this_arg);
11754         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
11755         LDKScoreUpdate* this_arg_conv = (LDKScoreUpdate*)this_arg_ptr;
11756         LDKPath path_conv;
11757         path_conv.inner = untag_ptr(path);
11758         path_conv.is_owned = ptr_is_owned(path);
11759         CHECK_INNER_FIELD_ACCESS_OR_NULL(path_conv);
11760         path_conv.is_owned = false;
11761         (this_arg_conv->payment_path_successful)(this_arg_conv->this_arg, &path_conv);
11762 }
11763
11764 void  __attribute__((export_name("TS_ScoreUpdate_probe_failed"))) TS_ScoreUpdate_probe_failed(uint64_t this_arg, uint64_t path, int64_t short_channel_id) {
11765         void* this_arg_ptr = untag_ptr(this_arg);
11766         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
11767         LDKScoreUpdate* this_arg_conv = (LDKScoreUpdate*)this_arg_ptr;
11768         LDKPath path_conv;
11769         path_conv.inner = untag_ptr(path);
11770         path_conv.is_owned = ptr_is_owned(path);
11771         CHECK_INNER_FIELD_ACCESS_OR_NULL(path_conv);
11772         path_conv.is_owned = false;
11773         (this_arg_conv->probe_failed)(this_arg_conv->this_arg, &path_conv, short_channel_id);
11774 }
11775
11776 void  __attribute__((export_name("TS_ScoreUpdate_probe_successful"))) TS_ScoreUpdate_probe_successful(uint64_t this_arg, uint64_t path) {
11777         void* this_arg_ptr = untag_ptr(this_arg);
11778         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
11779         LDKScoreUpdate* this_arg_conv = (LDKScoreUpdate*)this_arg_ptr;
11780         LDKPath path_conv;
11781         path_conv.inner = untag_ptr(path);
11782         path_conv.is_owned = ptr_is_owned(path);
11783         CHECK_INNER_FIELD_ACCESS_OR_NULL(path_conv);
11784         path_conv.is_owned = false;
11785         (this_arg_conv->probe_successful)(this_arg_conv->this_arg, &path_conv);
11786 }
11787
11788 typedef struct LDKLockableScore_JCalls {
11789         atomic_size_t refcnt;
11790         uint32_t instance_ptr;
11791 } LDKLockableScore_JCalls;
11792 static void LDKLockableScore_JCalls_free(void* this_arg) {
11793         LDKLockableScore_JCalls *j_calls = (LDKLockableScore_JCalls*) this_arg;
11794         if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
11795                 FREE(j_calls);
11796         }
11797 }
11798 LDKScoreLookUp read_lock_LDKLockableScore_jcall(const void* this_arg) {
11799         LDKLockableScore_JCalls *j_calls = (LDKLockableScore_JCalls*) this_arg;
11800         uint64_t ret = js_invoke_function_uuuuuu(j_calls->instance_ptr, 54, 0, 0, 0, 0, 0, 0);
11801         void* ret_ptr = untag_ptr(ret);
11802         CHECK_ACCESS(ret_ptr);
11803         LDKScoreLookUp ret_conv = *(LDKScoreLookUp*)(ret_ptr);
11804         if (ret_conv.free == LDKScoreLookUp_JCalls_free) {
11805                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
11806                 LDKScoreLookUp_JCalls_cloned(&ret_conv);
11807         }// WARNING: we may need a move here but no clone is available for LDKScoreLookUp
11808         
11809         return ret_conv;
11810 }
11811 LDKScoreUpdate write_lock_LDKLockableScore_jcall(const void* this_arg) {
11812         LDKLockableScore_JCalls *j_calls = (LDKLockableScore_JCalls*) this_arg;
11813         uint64_t ret = js_invoke_function_uuuuuu(j_calls->instance_ptr, 55, 0, 0, 0, 0, 0, 0);
11814         void* ret_ptr = untag_ptr(ret);
11815         CHECK_ACCESS(ret_ptr);
11816         LDKScoreUpdate ret_conv = *(LDKScoreUpdate*)(ret_ptr);
11817         if (ret_conv.free == LDKScoreUpdate_JCalls_free) {
11818                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
11819                 LDKScoreUpdate_JCalls_cloned(&ret_conv);
11820         }// WARNING: we may need a move here but no clone is available for LDKScoreUpdate
11821         
11822         return ret_conv;
11823 }
11824 static void LDKLockableScore_JCalls_cloned(LDKLockableScore* new_obj) {
11825         LDKLockableScore_JCalls *j_calls = (LDKLockableScore_JCalls*) new_obj->this_arg;
11826         atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
11827 }
11828 static inline LDKLockableScore LDKLockableScore_init (JSValue o) {
11829         LDKLockableScore_JCalls *calls = MALLOC(sizeof(LDKLockableScore_JCalls), "LDKLockableScore_JCalls");
11830         atomic_init(&calls->refcnt, 1);
11831         calls->instance_ptr = o;
11832
11833         LDKLockableScore ret = {
11834                 .this_arg = (void*) calls,
11835                 .read_lock = read_lock_LDKLockableScore_jcall,
11836                 .write_lock = write_lock_LDKLockableScore_jcall,
11837                 .free = LDKLockableScore_JCalls_free,
11838         };
11839         return ret;
11840 }
11841 uint64_t  __attribute__((export_name("TS_LDKLockableScore_new"))) TS_LDKLockableScore_new(JSValue o) {
11842         LDKLockableScore *res_ptr = MALLOC(sizeof(LDKLockableScore), "LDKLockableScore");
11843         *res_ptr = LDKLockableScore_init(o);
11844         return tag_ptr(res_ptr, true);
11845 }
11846 uint64_t  __attribute__((export_name("TS_LockableScore_read_lock"))) TS_LockableScore_read_lock(uint64_t this_arg) {
11847         void* this_arg_ptr = untag_ptr(this_arg);
11848         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
11849         LDKLockableScore* this_arg_conv = (LDKLockableScore*)this_arg_ptr;
11850         LDKScoreLookUp* ret_ret = MALLOC(sizeof(LDKScoreLookUp), "LDKScoreLookUp");
11851         *ret_ret = (this_arg_conv->read_lock)(this_arg_conv->this_arg);
11852         return tag_ptr(ret_ret, true);
11853 }
11854
11855 uint64_t  __attribute__((export_name("TS_LockableScore_write_lock"))) TS_LockableScore_write_lock(uint64_t this_arg) {
11856         void* this_arg_ptr = untag_ptr(this_arg);
11857         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
11858         LDKLockableScore* this_arg_conv = (LDKLockableScore*)this_arg_ptr;
11859         LDKScoreUpdate* ret_ret = MALLOC(sizeof(LDKScoreUpdate), "LDKScoreUpdate");
11860         *ret_ret = (this_arg_conv->write_lock)(this_arg_conv->this_arg);
11861         return tag_ptr(ret_ret, true);
11862 }
11863
11864 typedef struct LDKWriteableScore_JCalls {
11865         atomic_size_t refcnt;
11866         uint32_t instance_ptr;
11867         LDKLockableScore_JCalls* LockableScore;
11868 } LDKWriteableScore_JCalls;
11869 static void LDKWriteableScore_JCalls_free(void* this_arg) {
11870         LDKWriteableScore_JCalls *j_calls = (LDKWriteableScore_JCalls*) this_arg;
11871         if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
11872                 FREE(j_calls);
11873         }
11874 }
11875 LDKCVec_u8Z write_LDKWriteableScore_jcall(const void* this_arg) {
11876         LDKWriteableScore_JCalls *j_calls = (LDKWriteableScore_JCalls*) this_arg;
11877         int8_tArray ret = (int8_tArray)js_invoke_function_uuuuuu(j_calls->instance_ptr, 56, 0, 0, 0, 0, 0, 0);
11878         LDKCVec_u8Z ret_ref;
11879         ret_ref.datalen = ret->arr_len;
11880         ret_ref.data = MALLOC(ret_ref.datalen, "LDKCVec_u8Z Bytes");
11881         memcpy(ret_ref.data, ret->elems, ret_ref.datalen); FREE(ret);
11882         return ret_ref;
11883 }
11884 static void LDKWriteableScore_JCalls_cloned(LDKWriteableScore* new_obj) {
11885         LDKWriteableScore_JCalls *j_calls = (LDKWriteableScore_JCalls*) new_obj->this_arg;
11886         atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
11887         atomic_fetch_add_explicit(&j_calls->LockableScore->refcnt, 1, memory_order_release);
11888 }
11889 static inline LDKWriteableScore LDKWriteableScore_init (JSValue o, JSValue LockableScore) {
11890         LDKWriteableScore_JCalls *calls = MALLOC(sizeof(LDKWriteableScore_JCalls), "LDKWriteableScore_JCalls");
11891         atomic_init(&calls->refcnt, 1);
11892         calls->instance_ptr = o;
11893
11894         LDKWriteableScore ret = {
11895                 .this_arg = (void*) calls,
11896                 .write = write_LDKWriteableScore_jcall,
11897                 .free = LDKWriteableScore_JCalls_free,
11898                 .LockableScore = LDKLockableScore_init(LockableScore),
11899         };
11900         calls->LockableScore = ret.LockableScore.this_arg;
11901         return ret;
11902 }
11903 uint64_t  __attribute__((export_name("TS_LDKWriteableScore_new"))) TS_LDKWriteableScore_new(JSValue o, JSValue LockableScore) {
11904         LDKWriteableScore *res_ptr = MALLOC(sizeof(LDKWriteableScore), "LDKWriteableScore");
11905         *res_ptr = LDKWriteableScore_init(o, LockableScore);
11906         return tag_ptr(res_ptr, true);
11907 }
11908 int8_tArray  __attribute__((export_name("TS_WriteableScore_write"))) TS_WriteableScore_write(uint64_t this_arg) {
11909         void* this_arg_ptr = untag_ptr(this_arg);
11910         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
11911         LDKWriteableScore* this_arg_conv = (LDKWriteableScore*)this_arg_ptr;
11912         LDKCVec_u8Z ret_var = (this_arg_conv->write)(this_arg_conv->this_arg);
11913         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
11914         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
11915         CVec_u8Z_free(ret_var);
11916         return ret_arr;
11917 }
11918
11919 typedef struct LDKPersister_JCalls {
11920         atomic_size_t refcnt;
11921         uint32_t instance_ptr;
11922 } LDKPersister_JCalls;
11923 static void LDKPersister_JCalls_free(void* this_arg) {
11924         LDKPersister_JCalls *j_calls = (LDKPersister_JCalls*) this_arg;
11925         if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
11926                 FREE(j_calls);
11927         }
11928 }
11929 LDKCResult_NoneIOErrorZ persist_manager_LDKPersister_jcall(const void* this_arg, const LDKChannelManager * channel_manager) {
11930         LDKPersister_JCalls *j_calls = (LDKPersister_JCalls*) this_arg;
11931         LDKChannelManager channel_manager_var = *channel_manager;
11932         uint64_t channel_manager_ref = 0;
11933         // WARNING: we may need a move here but no clone is available for LDKChannelManager
11934         CHECK_INNER_FIELD_ACCESS_OR_NULL(channel_manager_var);
11935         channel_manager_ref = tag_ptr(channel_manager_var.inner, channel_manager_var.is_owned);
11936         uint64_t ret = js_invoke_function_buuuuu(j_calls->instance_ptr, 57, channel_manager_ref, 0, 0, 0, 0, 0);
11937         void* ret_ptr = untag_ptr(ret);
11938         CHECK_ACCESS(ret_ptr);
11939         LDKCResult_NoneIOErrorZ ret_conv = *(LDKCResult_NoneIOErrorZ*)(ret_ptr);
11940         FREE(untag_ptr(ret));
11941         return ret_conv;
11942 }
11943 LDKCResult_NoneIOErrorZ persist_graph_LDKPersister_jcall(const void* this_arg, const LDKNetworkGraph * network_graph) {
11944         LDKPersister_JCalls *j_calls = (LDKPersister_JCalls*) this_arg;
11945         LDKNetworkGraph network_graph_var = *network_graph;
11946         uint64_t network_graph_ref = 0;
11947         // WARNING: we may need a move here but no clone is available for LDKNetworkGraph
11948         CHECK_INNER_FIELD_ACCESS_OR_NULL(network_graph_var);
11949         network_graph_ref = tag_ptr(network_graph_var.inner, network_graph_var.is_owned);
11950         uint64_t ret = js_invoke_function_buuuuu(j_calls->instance_ptr, 58, network_graph_ref, 0, 0, 0, 0, 0);
11951         void* ret_ptr = untag_ptr(ret);
11952         CHECK_ACCESS(ret_ptr);
11953         LDKCResult_NoneIOErrorZ ret_conv = *(LDKCResult_NoneIOErrorZ*)(ret_ptr);
11954         FREE(untag_ptr(ret));
11955         return ret_conv;
11956 }
11957 LDKCResult_NoneIOErrorZ persist_scorer_LDKPersister_jcall(const void* this_arg, const LDKWriteableScore * scorer) {
11958         LDKPersister_JCalls *j_calls = (LDKPersister_JCalls*) this_arg;
11959         // WARNING: This object doesn't live past this scope, needs clone!
11960         uint64_t ret_scorer = tag_ptr(scorer, false);
11961         uint64_t ret = js_invoke_function_buuuuu(j_calls->instance_ptr, 59, ret_scorer, 0, 0, 0, 0, 0);
11962         void* ret_ptr = untag_ptr(ret);
11963         CHECK_ACCESS(ret_ptr);
11964         LDKCResult_NoneIOErrorZ ret_conv = *(LDKCResult_NoneIOErrorZ*)(ret_ptr);
11965         FREE(untag_ptr(ret));
11966         return ret_conv;
11967 }
11968 static void LDKPersister_JCalls_cloned(LDKPersister* new_obj) {
11969         LDKPersister_JCalls *j_calls = (LDKPersister_JCalls*) new_obj->this_arg;
11970         atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
11971 }
11972 static inline LDKPersister LDKPersister_init (JSValue o) {
11973         LDKPersister_JCalls *calls = MALLOC(sizeof(LDKPersister_JCalls), "LDKPersister_JCalls");
11974         atomic_init(&calls->refcnt, 1);
11975         calls->instance_ptr = o;
11976
11977         LDKPersister ret = {
11978                 .this_arg = (void*) calls,
11979                 .persist_manager = persist_manager_LDKPersister_jcall,
11980                 .persist_graph = persist_graph_LDKPersister_jcall,
11981                 .persist_scorer = persist_scorer_LDKPersister_jcall,
11982                 .free = LDKPersister_JCalls_free,
11983         };
11984         return ret;
11985 }
11986 uint64_t  __attribute__((export_name("TS_LDKPersister_new"))) TS_LDKPersister_new(JSValue o) {
11987         LDKPersister *res_ptr = MALLOC(sizeof(LDKPersister), "LDKPersister");
11988         *res_ptr = LDKPersister_init(o);
11989         return tag_ptr(res_ptr, true);
11990 }
11991 uint64_t  __attribute__((export_name("TS_Persister_persist_manager"))) TS_Persister_persist_manager(uint64_t this_arg, uint64_t channel_manager) {
11992         void* this_arg_ptr = untag_ptr(this_arg);
11993         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
11994         LDKPersister* this_arg_conv = (LDKPersister*)this_arg_ptr;
11995         LDKChannelManager channel_manager_conv;
11996         channel_manager_conv.inner = untag_ptr(channel_manager);
11997         channel_manager_conv.is_owned = ptr_is_owned(channel_manager);
11998         CHECK_INNER_FIELD_ACCESS_OR_NULL(channel_manager_conv);
11999         channel_manager_conv.is_owned = false;
12000         LDKCResult_NoneIOErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneIOErrorZ), "LDKCResult_NoneIOErrorZ");
12001         *ret_conv = (this_arg_conv->persist_manager)(this_arg_conv->this_arg, &channel_manager_conv);
12002         return tag_ptr(ret_conv, true);
12003 }
12004
12005 uint64_t  __attribute__((export_name("TS_Persister_persist_graph"))) TS_Persister_persist_graph(uint64_t this_arg, uint64_t network_graph) {
12006         void* this_arg_ptr = untag_ptr(this_arg);
12007         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
12008         LDKPersister* this_arg_conv = (LDKPersister*)this_arg_ptr;
12009         LDKNetworkGraph network_graph_conv;
12010         network_graph_conv.inner = untag_ptr(network_graph);
12011         network_graph_conv.is_owned = ptr_is_owned(network_graph);
12012         CHECK_INNER_FIELD_ACCESS_OR_NULL(network_graph_conv);
12013         network_graph_conv.is_owned = false;
12014         LDKCResult_NoneIOErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneIOErrorZ), "LDKCResult_NoneIOErrorZ");
12015         *ret_conv = (this_arg_conv->persist_graph)(this_arg_conv->this_arg, &network_graph_conv);
12016         return tag_ptr(ret_conv, true);
12017 }
12018
12019 uint64_t  __attribute__((export_name("TS_Persister_persist_scorer"))) TS_Persister_persist_scorer(uint64_t this_arg, uint64_t scorer) {
12020         void* this_arg_ptr = untag_ptr(this_arg);
12021         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
12022         LDKPersister* this_arg_conv = (LDKPersister*)this_arg_ptr;
12023         void* scorer_ptr = untag_ptr(scorer);
12024         if (ptr_is_owned(scorer)) { CHECK_ACCESS(scorer_ptr); }
12025         LDKWriteableScore* scorer_conv = (LDKWriteableScore*)scorer_ptr;
12026         LDKCResult_NoneIOErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneIOErrorZ), "LDKCResult_NoneIOErrorZ");
12027         *ret_conv = (this_arg_conv->persist_scorer)(this_arg_conv->this_arg, scorer_conv);
12028         return tag_ptr(ret_conv, true);
12029 }
12030
12031 typedef struct LDKPersist_JCalls {
12032         atomic_size_t refcnt;
12033         uint32_t instance_ptr;
12034 } LDKPersist_JCalls;
12035 static void LDKPersist_JCalls_free(void* this_arg) {
12036         LDKPersist_JCalls *j_calls = (LDKPersist_JCalls*) this_arg;
12037         if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
12038                 FREE(j_calls);
12039         }
12040 }
12041 LDKChannelMonitorUpdateStatus persist_new_channel_LDKPersist_jcall(const void* this_arg, LDKOutPoint channel_id, const LDKChannelMonitor * data, LDKMonitorUpdateId update_id) {
12042         LDKPersist_JCalls *j_calls = (LDKPersist_JCalls*) this_arg;
12043         LDKOutPoint channel_id_var = channel_id;
12044         uint64_t channel_id_ref = 0;
12045         CHECK_INNER_FIELD_ACCESS_OR_NULL(channel_id_var);
12046         channel_id_ref = tag_ptr(channel_id_var.inner, channel_id_var.is_owned);
12047         LDKChannelMonitor data_var = *data;
12048         uint64_t data_ref = 0;
12049         data_var = ChannelMonitor_clone(&data_var);
12050         CHECK_INNER_FIELD_ACCESS_OR_NULL(data_var);
12051         data_ref = tag_ptr(data_var.inner, data_var.is_owned);
12052         LDKMonitorUpdateId update_id_var = update_id;
12053         uint64_t update_id_ref = 0;
12054         CHECK_INNER_FIELD_ACCESS_OR_NULL(update_id_var);
12055         update_id_ref = tag_ptr(update_id_var.inner, update_id_var.is_owned);
12056         uint64_t ret = js_invoke_function_bbbuuu(j_calls->instance_ptr, 60, channel_id_ref, data_ref, update_id_ref, 0, 0, 0);
12057         LDKChannelMonitorUpdateStatus ret_conv = LDKChannelMonitorUpdateStatus_from_js(ret);
12058         return ret_conv;
12059 }
12060 LDKChannelMonitorUpdateStatus update_persisted_channel_LDKPersist_jcall(const void* this_arg, LDKOutPoint channel_id, LDKChannelMonitorUpdate update, const LDKChannelMonitor * data, LDKMonitorUpdateId update_id) {
12061         LDKPersist_JCalls *j_calls = (LDKPersist_JCalls*) this_arg;
12062         LDKOutPoint channel_id_var = channel_id;
12063         uint64_t channel_id_ref = 0;
12064         CHECK_INNER_FIELD_ACCESS_OR_NULL(channel_id_var);
12065         channel_id_ref = tag_ptr(channel_id_var.inner, channel_id_var.is_owned);
12066         LDKChannelMonitorUpdate update_var = update;
12067         uint64_t update_ref = 0;
12068         CHECK_INNER_FIELD_ACCESS_OR_NULL(update_var);
12069         update_ref = tag_ptr(update_var.inner, update_var.is_owned);
12070         LDKChannelMonitor data_var = *data;
12071         uint64_t data_ref = 0;
12072         data_var = ChannelMonitor_clone(&data_var);
12073         CHECK_INNER_FIELD_ACCESS_OR_NULL(data_var);
12074         data_ref = tag_ptr(data_var.inner, data_var.is_owned);
12075         LDKMonitorUpdateId update_id_var = update_id;
12076         uint64_t update_id_ref = 0;
12077         CHECK_INNER_FIELD_ACCESS_OR_NULL(update_id_var);
12078         update_id_ref = tag_ptr(update_id_var.inner, update_id_var.is_owned);
12079         uint64_t ret = js_invoke_function_bbbbuu(j_calls->instance_ptr, 61, channel_id_ref, update_ref, data_ref, update_id_ref, 0, 0);
12080         LDKChannelMonitorUpdateStatus ret_conv = LDKChannelMonitorUpdateStatus_from_js(ret);
12081         return ret_conv;
12082 }
12083 static void LDKPersist_JCalls_cloned(LDKPersist* new_obj) {
12084         LDKPersist_JCalls *j_calls = (LDKPersist_JCalls*) new_obj->this_arg;
12085         atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
12086 }
12087 static inline LDKPersist LDKPersist_init (JSValue o) {
12088         LDKPersist_JCalls *calls = MALLOC(sizeof(LDKPersist_JCalls), "LDKPersist_JCalls");
12089         atomic_init(&calls->refcnt, 1);
12090         calls->instance_ptr = o;
12091
12092         LDKPersist ret = {
12093                 .this_arg = (void*) calls,
12094                 .persist_new_channel = persist_new_channel_LDKPersist_jcall,
12095                 .update_persisted_channel = update_persisted_channel_LDKPersist_jcall,
12096                 .free = LDKPersist_JCalls_free,
12097         };
12098         return ret;
12099 }
12100 uint64_t  __attribute__((export_name("TS_LDKPersist_new"))) TS_LDKPersist_new(JSValue o) {
12101         LDKPersist *res_ptr = MALLOC(sizeof(LDKPersist), "LDKPersist");
12102         *res_ptr = LDKPersist_init(o);
12103         return tag_ptr(res_ptr, true);
12104 }
12105 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) {
12106         void* this_arg_ptr = untag_ptr(this_arg);
12107         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
12108         LDKPersist* this_arg_conv = (LDKPersist*)this_arg_ptr;
12109         LDKOutPoint channel_id_conv;
12110         channel_id_conv.inner = untag_ptr(channel_id);
12111         channel_id_conv.is_owned = ptr_is_owned(channel_id);
12112         CHECK_INNER_FIELD_ACCESS_OR_NULL(channel_id_conv);
12113         channel_id_conv = OutPoint_clone(&channel_id_conv);
12114         LDKChannelMonitor data_conv;
12115         data_conv.inner = untag_ptr(data);
12116         data_conv.is_owned = ptr_is_owned(data);
12117         CHECK_INNER_FIELD_ACCESS_OR_NULL(data_conv);
12118         data_conv.is_owned = false;
12119         LDKMonitorUpdateId update_id_conv;
12120         update_id_conv.inner = untag_ptr(update_id);
12121         update_id_conv.is_owned = ptr_is_owned(update_id);
12122         CHECK_INNER_FIELD_ACCESS_OR_NULL(update_id_conv);
12123         update_id_conv = MonitorUpdateId_clone(&update_id_conv);
12124         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));
12125         return ret_conv;
12126 }
12127
12128 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) {
12129         void* this_arg_ptr = untag_ptr(this_arg);
12130         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
12131         LDKPersist* this_arg_conv = (LDKPersist*)this_arg_ptr;
12132         LDKOutPoint channel_id_conv;
12133         channel_id_conv.inner = untag_ptr(channel_id);
12134         channel_id_conv.is_owned = ptr_is_owned(channel_id);
12135         CHECK_INNER_FIELD_ACCESS_OR_NULL(channel_id_conv);
12136         channel_id_conv = OutPoint_clone(&channel_id_conv);
12137         LDKChannelMonitorUpdate update_conv;
12138         update_conv.inner = untag_ptr(update);
12139         update_conv.is_owned = ptr_is_owned(update);
12140         CHECK_INNER_FIELD_ACCESS_OR_NULL(update_conv);
12141         update_conv = ChannelMonitorUpdate_clone(&update_conv);
12142         LDKChannelMonitor data_conv;
12143         data_conv.inner = untag_ptr(data);
12144         data_conv.is_owned = ptr_is_owned(data);
12145         CHECK_INNER_FIELD_ACCESS_OR_NULL(data_conv);
12146         data_conv.is_owned = false;
12147         LDKMonitorUpdateId update_id_conv;
12148         update_id_conv.inner = untag_ptr(update_id);
12149         update_id_conv.is_owned = ptr_is_owned(update_id);
12150         CHECK_INNER_FIELD_ACCESS_OR_NULL(update_id_conv);
12151         update_id_conv = MonitorUpdateId_clone(&update_id_conv);
12152         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));
12153         return ret_conv;
12154 }
12155
12156 typedef struct LDKFutureCallback_JCalls {
12157         atomic_size_t refcnt;
12158         uint32_t instance_ptr;
12159 } LDKFutureCallback_JCalls;
12160 static void LDKFutureCallback_JCalls_free(void* this_arg) {
12161         LDKFutureCallback_JCalls *j_calls = (LDKFutureCallback_JCalls*) this_arg;
12162         if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
12163                 FREE(j_calls);
12164         }
12165 }
12166 void call_LDKFutureCallback_jcall(const void* this_arg) {
12167         LDKFutureCallback_JCalls *j_calls = (LDKFutureCallback_JCalls*) this_arg;
12168         js_invoke_function_uuuuuu(j_calls->instance_ptr, 62, 0, 0, 0, 0, 0, 0);
12169 }
12170 static void LDKFutureCallback_JCalls_cloned(LDKFutureCallback* new_obj) {
12171         LDKFutureCallback_JCalls *j_calls = (LDKFutureCallback_JCalls*) new_obj->this_arg;
12172         atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
12173 }
12174 static inline LDKFutureCallback LDKFutureCallback_init (JSValue o) {
12175         LDKFutureCallback_JCalls *calls = MALLOC(sizeof(LDKFutureCallback_JCalls), "LDKFutureCallback_JCalls");
12176         atomic_init(&calls->refcnt, 1);
12177         calls->instance_ptr = o;
12178
12179         LDKFutureCallback ret = {
12180                 .this_arg = (void*) calls,
12181                 .call = call_LDKFutureCallback_jcall,
12182                 .free = LDKFutureCallback_JCalls_free,
12183         };
12184         return ret;
12185 }
12186 uint64_t  __attribute__((export_name("TS_LDKFutureCallback_new"))) TS_LDKFutureCallback_new(JSValue o) {
12187         LDKFutureCallback *res_ptr = MALLOC(sizeof(LDKFutureCallback), "LDKFutureCallback");
12188         *res_ptr = LDKFutureCallback_init(o);
12189         return tag_ptr(res_ptr, true);
12190 }
12191 void  __attribute__((export_name("TS_FutureCallback_call"))) TS_FutureCallback_call(uint64_t this_arg) {
12192         void* this_arg_ptr = untag_ptr(this_arg);
12193         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
12194         LDKFutureCallback* this_arg_conv = (LDKFutureCallback*)this_arg_ptr;
12195         (this_arg_conv->call)(this_arg_conv->this_arg);
12196 }
12197
12198 typedef struct LDKListen_JCalls {
12199         atomic_size_t refcnt;
12200         uint32_t instance_ptr;
12201 } LDKListen_JCalls;
12202 static void LDKListen_JCalls_free(void* this_arg) {
12203         LDKListen_JCalls *j_calls = (LDKListen_JCalls*) this_arg;
12204         if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
12205                 FREE(j_calls);
12206         }
12207 }
12208 void filtered_block_connected_LDKListen_jcall(const void* this_arg, const uint8_t (* header)[80], LDKCVec_C2Tuple_usizeTransactionZZ txdata, uint32_t height) {
12209         LDKListen_JCalls *j_calls = (LDKListen_JCalls*) this_arg;
12210         int8_tArray header_arr = init_int8_tArray(80, __LINE__);
12211         memcpy(header_arr->elems, *header, 80);
12212         LDKCVec_C2Tuple_usizeTransactionZZ txdata_var = txdata;
12213         uint64_tArray txdata_arr = NULL;
12214         txdata_arr = init_uint64_tArray(txdata_var.datalen, __LINE__);
12215         uint64_t *txdata_arr_ptr = (uint64_t*)(((uint8_t*)txdata_arr) + 8);
12216         for (size_t c = 0; c < txdata_var.datalen; c++) {
12217                 LDKC2Tuple_usizeTransactionZ* txdata_conv_28_conv = MALLOC(sizeof(LDKC2Tuple_usizeTransactionZ), "LDKC2Tuple_usizeTransactionZ");
12218                 *txdata_conv_28_conv = txdata_var.data[c];
12219                 txdata_arr_ptr[c] = tag_ptr(txdata_conv_28_conv, true);
12220         }
12221         
12222         FREE(txdata_var.data);
12223         int32_t height_conv = height;
12224         js_invoke_function_uuuuuu(j_calls->instance_ptr, 63, (uint32_t)header_arr, (uint32_t)txdata_arr, height_conv, 0, 0, 0);
12225 }
12226 void block_connected_LDKListen_jcall(const void* this_arg, LDKu8slice block, uint32_t height) {
12227         LDKListen_JCalls *j_calls = (LDKListen_JCalls*) this_arg;
12228         LDKu8slice block_var = block;
12229         int8_tArray block_arr = init_int8_tArray(block_var.datalen, __LINE__);
12230         memcpy(block_arr->elems, block_var.data, block_var.datalen);
12231         int32_t height_conv = height;
12232         js_invoke_function_uuuuuu(j_calls->instance_ptr, 64, (uint32_t)block_arr, height_conv, 0, 0, 0, 0);
12233 }
12234 void block_disconnected_LDKListen_jcall(const void* this_arg, const uint8_t (* header)[80], uint32_t height) {
12235         LDKListen_JCalls *j_calls = (LDKListen_JCalls*) this_arg;
12236         int8_tArray header_arr = init_int8_tArray(80, __LINE__);
12237         memcpy(header_arr->elems, *header, 80);
12238         int32_t height_conv = height;
12239         js_invoke_function_uuuuuu(j_calls->instance_ptr, 65, (uint32_t)header_arr, height_conv, 0, 0, 0, 0);
12240 }
12241 static void LDKListen_JCalls_cloned(LDKListen* new_obj) {
12242         LDKListen_JCalls *j_calls = (LDKListen_JCalls*) new_obj->this_arg;
12243         atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
12244 }
12245 static inline LDKListen LDKListen_init (JSValue o) {
12246         LDKListen_JCalls *calls = MALLOC(sizeof(LDKListen_JCalls), "LDKListen_JCalls");
12247         atomic_init(&calls->refcnt, 1);
12248         calls->instance_ptr = o;
12249
12250         LDKListen ret = {
12251                 .this_arg = (void*) calls,
12252                 .filtered_block_connected = filtered_block_connected_LDKListen_jcall,
12253                 .block_connected = block_connected_LDKListen_jcall,
12254                 .block_disconnected = block_disconnected_LDKListen_jcall,
12255                 .free = LDKListen_JCalls_free,
12256         };
12257         return ret;
12258 }
12259 uint64_t  __attribute__((export_name("TS_LDKListen_new"))) TS_LDKListen_new(JSValue o) {
12260         LDKListen *res_ptr = MALLOC(sizeof(LDKListen), "LDKListen");
12261         *res_ptr = LDKListen_init(o);
12262         return tag_ptr(res_ptr, true);
12263 }
12264 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) {
12265         void* this_arg_ptr = untag_ptr(this_arg);
12266         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
12267         LDKListen* this_arg_conv = (LDKListen*)this_arg_ptr;
12268         uint8_t header_arr[80];
12269         CHECK(header->arr_len == 80);
12270         memcpy(header_arr, header->elems, 80); FREE(header);
12271         uint8_t (*header_ref)[80] = &header_arr;
12272         LDKCVec_C2Tuple_usizeTransactionZZ txdata_constr;
12273         txdata_constr.datalen = txdata->arr_len;
12274         if (txdata_constr.datalen > 0)
12275                 txdata_constr.data = MALLOC(txdata_constr.datalen * sizeof(LDKC2Tuple_usizeTransactionZ), "LDKCVec_C2Tuple_usizeTransactionZZ Elements");
12276         else
12277                 txdata_constr.data = NULL;
12278         uint64_t* txdata_vals = txdata->elems;
12279         for (size_t c = 0; c < txdata_constr.datalen; c++) {
12280                 uint64_t txdata_conv_28 = txdata_vals[c];
12281                 void* txdata_conv_28_ptr = untag_ptr(txdata_conv_28);
12282                 CHECK_ACCESS(txdata_conv_28_ptr);
12283                 LDKC2Tuple_usizeTransactionZ txdata_conv_28_conv = *(LDKC2Tuple_usizeTransactionZ*)(txdata_conv_28_ptr);
12284                 txdata_conv_28_conv = C2Tuple_usizeTransactionZ_clone((LDKC2Tuple_usizeTransactionZ*)untag_ptr(txdata_conv_28));
12285                 txdata_constr.data[c] = txdata_conv_28_conv;
12286         }
12287         FREE(txdata);
12288         (this_arg_conv->filtered_block_connected)(this_arg_conv->this_arg, header_ref, txdata_constr, height);
12289 }
12290
12291 void  __attribute__((export_name("TS_Listen_block_connected"))) TS_Listen_block_connected(uint64_t this_arg, int8_tArray block, int32_t height) {
12292         void* this_arg_ptr = untag_ptr(this_arg);
12293         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
12294         LDKListen* this_arg_conv = (LDKListen*)this_arg_ptr;
12295         LDKu8slice block_ref;
12296         block_ref.datalen = block->arr_len;
12297         block_ref.data = block->elems;
12298         (this_arg_conv->block_connected)(this_arg_conv->this_arg, block_ref, height);
12299         FREE(block);
12300 }
12301
12302 void  __attribute__((export_name("TS_Listen_block_disconnected"))) TS_Listen_block_disconnected(uint64_t this_arg, int8_tArray header, int32_t height) {
12303         void* this_arg_ptr = untag_ptr(this_arg);
12304         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
12305         LDKListen* this_arg_conv = (LDKListen*)this_arg_ptr;
12306         uint8_t header_arr[80];
12307         CHECK(header->arr_len == 80);
12308         memcpy(header_arr, header->elems, 80); FREE(header);
12309         uint8_t (*header_ref)[80] = &header_arr;
12310         (this_arg_conv->block_disconnected)(this_arg_conv->this_arg, header_ref, height);
12311 }
12312
12313 typedef struct LDKConfirm_JCalls {
12314         atomic_size_t refcnt;
12315         uint32_t instance_ptr;
12316 } LDKConfirm_JCalls;
12317 static void LDKConfirm_JCalls_free(void* this_arg) {
12318         LDKConfirm_JCalls *j_calls = (LDKConfirm_JCalls*) this_arg;
12319         if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
12320                 FREE(j_calls);
12321         }
12322 }
12323 void transactions_confirmed_LDKConfirm_jcall(const void* this_arg, const uint8_t (* header)[80], LDKCVec_C2Tuple_usizeTransactionZZ txdata, uint32_t height) {
12324         LDKConfirm_JCalls *j_calls = (LDKConfirm_JCalls*) this_arg;
12325         int8_tArray header_arr = init_int8_tArray(80, __LINE__);
12326         memcpy(header_arr->elems, *header, 80);
12327         LDKCVec_C2Tuple_usizeTransactionZZ txdata_var = txdata;
12328         uint64_tArray txdata_arr = NULL;
12329         txdata_arr = init_uint64_tArray(txdata_var.datalen, __LINE__);
12330         uint64_t *txdata_arr_ptr = (uint64_t*)(((uint8_t*)txdata_arr) + 8);
12331         for (size_t c = 0; c < txdata_var.datalen; c++) {
12332                 LDKC2Tuple_usizeTransactionZ* txdata_conv_28_conv = MALLOC(sizeof(LDKC2Tuple_usizeTransactionZ), "LDKC2Tuple_usizeTransactionZ");
12333                 *txdata_conv_28_conv = txdata_var.data[c];
12334                 txdata_arr_ptr[c] = tag_ptr(txdata_conv_28_conv, true);
12335         }
12336         
12337         FREE(txdata_var.data);
12338         int32_t height_conv = height;
12339         js_invoke_function_uuuuuu(j_calls->instance_ptr, 66, (uint32_t)header_arr, (uint32_t)txdata_arr, height_conv, 0, 0, 0);
12340 }
12341 void transaction_unconfirmed_LDKConfirm_jcall(const void* this_arg, const uint8_t (* txid)[32]) {
12342         LDKConfirm_JCalls *j_calls = (LDKConfirm_JCalls*) this_arg;
12343         int8_tArray txid_arr = init_int8_tArray(32, __LINE__);
12344         memcpy(txid_arr->elems, *txid, 32);
12345         js_invoke_function_uuuuuu(j_calls->instance_ptr, 67, (uint32_t)txid_arr, 0, 0, 0, 0, 0);
12346 }
12347 void best_block_updated_LDKConfirm_jcall(const void* this_arg, const uint8_t (* header)[80], uint32_t height) {
12348         LDKConfirm_JCalls *j_calls = (LDKConfirm_JCalls*) this_arg;
12349         int8_tArray header_arr = init_int8_tArray(80, __LINE__);
12350         memcpy(header_arr->elems, *header, 80);
12351         int32_t height_conv = height;
12352         js_invoke_function_uuuuuu(j_calls->instance_ptr, 68, (uint32_t)header_arr, height_conv, 0, 0, 0, 0);
12353 }
12354 LDKCVec_C2Tuple_ThirtyTwoBytesCOption_ThirtyTwoBytesZZZ get_relevant_txids_LDKConfirm_jcall(const void* this_arg) {
12355         LDKConfirm_JCalls *j_calls = (LDKConfirm_JCalls*) this_arg;
12356         uint64_tArray ret = (uint64_tArray)js_invoke_function_uuuuuu(j_calls->instance_ptr, 69, 0, 0, 0, 0, 0, 0);
12357         LDKCVec_C2Tuple_ThirtyTwoBytesCOption_ThirtyTwoBytesZZZ ret_constr;
12358         ret_constr.datalen = ret->arr_len;
12359         if (ret_constr.datalen > 0)
12360                 ret_constr.data = MALLOC(ret_constr.datalen * sizeof(LDKC2Tuple_ThirtyTwoBytesCOption_ThirtyTwoBytesZZ), "LDKCVec_C2Tuple_ThirtyTwoBytesCOption_ThirtyTwoBytesZZZ Elements");
12361         else
12362                 ret_constr.data = NULL;
12363         uint64_t* ret_vals = ret->elems;
12364         for (size_t x = 0; x < ret_constr.datalen; x++) {
12365                 uint64_t ret_conv_49 = ret_vals[x];
12366                 void* ret_conv_49_ptr = untag_ptr(ret_conv_49);
12367                 CHECK_ACCESS(ret_conv_49_ptr);
12368                 LDKC2Tuple_ThirtyTwoBytesCOption_ThirtyTwoBytesZZ ret_conv_49_conv = *(LDKC2Tuple_ThirtyTwoBytesCOption_ThirtyTwoBytesZZ*)(ret_conv_49_ptr);
12369                 FREE(untag_ptr(ret_conv_49));
12370                 ret_constr.data[x] = ret_conv_49_conv;
12371         }
12372         FREE(ret);
12373         return ret_constr;
12374 }
12375 static void LDKConfirm_JCalls_cloned(LDKConfirm* new_obj) {
12376         LDKConfirm_JCalls *j_calls = (LDKConfirm_JCalls*) new_obj->this_arg;
12377         atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
12378 }
12379 static inline LDKConfirm LDKConfirm_init (JSValue o) {
12380         LDKConfirm_JCalls *calls = MALLOC(sizeof(LDKConfirm_JCalls), "LDKConfirm_JCalls");
12381         atomic_init(&calls->refcnt, 1);
12382         calls->instance_ptr = o;
12383
12384         LDKConfirm ret = {
12385                 .this_arg = (void*) calls,
12386                 .transactions_confirmed = transactions_confirmed_LDKConfirm_jcall,
12387                 .transaction_unconfirmed = transaction_unconfirmed_LDKConfirm_jcall,
12388                 .best_block_updated = best_block_updated_LDKConfirm_jcall,
12389                 .get_relevant_txids = get_relevant_txids_LDKConfirm_jcall,
12390                 .free = LDKConfirm_JCalls_free,
12391         };
12392         return ret;
12393 }
12394 uint64_t  __attribute__((export_name("TS_LDKConfirm_new"))) TS_LDKConfirm_new(JSValue o) {
12395         LDKConfirm *res_ptr = MALLOC(sizeof(LDKConfirm), "LDKConfirm");
12396         *res_ptr = LDKConfirm_init(o);
12397         return tag_ptr(res_ptr, true);
12398 }
12399 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) {
12400         void* this_arg_ptr = untag_ptr(this_arg);
12401         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
12402         LDKConfirm* this_arg_conv = (LDKConfirm*)this_arg_ptr;
12403         uint8_t header_arr[80];
12404         CHECK(header->arr_len == 80);
12405         memcpy(header_arr, header->elems, 80); FREE(header);
12406         uint8_t (*header_ref)[80] = &header_arr;
12407         LDKCVec_C2Tuple_usizeTransactionZZ txdata_constr;
12408         txdata_constr.datalen = txdata->arr_len;
12409         if (txdata_constr.datalen > 0)
12410                 txdata_constr.data = MALLOC(txdata_constr.datalen * sizeof(LDKC2Tuple_usizeTransactionZ), "LDKCVec_C2Tuple_usizeTransactionZZ Elements");
12411         else
12412                 txdata_constr.data = NULL;
12413         uint64_t* txdata_vals = txdata->elems;
12414         for (size_t c = 0; c < txdata_constr.datalen; c++) {
12415                 uint64_t txdata_conv_28 = txdata_vals[c];
12416                 void* txdata_conv_28_ptr = untag_ptr(txdata_conv_28);
12417                 CHECK_ACCESS(txdata_conv_28_ptr);
12418                 LDKC2Tuple_usizeTransactionZ txdata_conv_28_conv = *(LDKC2Tuple_usizeTransactionZ*)(txdata_conv_28_ptr);
12419                 txdata_conv_28_conv = C2Tuple_usizeTransactionZ_clone((LDKC2Tuple_usizeTransactionZ*)untag_ptr(txdata_conv_28));
12420                 txdata_constr.data[c] = txdata_conv_28_conv;
12421         }
12422         FREE(txdata);
12423         (this_arg_conv->transactions_confirmed)(this_arg_conv->this_arg, header_ref, txdata_constr, height);
12424 }
12425
12426 void  __attribute__((export_name("TS_Confirm_transaction_unconfirmed"))) TS_Confirm_transaction_unconfirmed(uint64_t this_arg, int8_tArray txid) {
12427         void* this_arg_ptr = untag_ptr(this_arg);
12428         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
12429         LDKConfirm* this_arg_conv = (LDKConfirm*)this_arg_ptr;
12430         uint8_t txid_arr[32];
12431         CHECK(txid->arr_len == 32);
12432         memcpy(txid_arr, txid->elems, 32); FREE(txid);
12433         uint8_t (*txid_ref)[32] = &txid_arr;
12434         (this_arg_conv->transaction_unconfirmed)(this_arg_conv->this_arg, txid_ref);
12435 }
12436
12437 void  __attribute__((export_name("TS_Confirm_best_block_updated"))) TS_Confirm_best_block_updated(uint64_t this_arg, int8_tArray header, int32_t height) {
12438         void* this_arg_ptr = untag_ptr(this_arg);
12439         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
12440         LDKConfirm* this_arg_conv = (LDKConfirm*)this_arg_ptr;
12441         uint8_t header_arr[80];
12442         CHECK(header->arr_len == 80);
12443         memcpy(header_arr, header->elems, 80); FREE(header);
12444         uint8_t (*header_ref)[80] = &header_arr;
12445         (this_arg_conv->best_block_updated)(this_arg_conv->this_arg, header_ref, height);
12446 }
12447
12448 uint64_tArray  __attribute__((export_name("TS_Confirm_get_relevant_txids"))) TS_Confirm_get_relevant_txids(uint64_t this_arg) {
12449         void* this_arg_ptr = untag_ptr(this_arg);
12450         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
12451         LDKConfirm* this_arg_conv = (LDKConfirm*)this_arg_ptr;
12452         LDKCVec_C2Tuple_ThirtyTwoBytesCOption_ThirtyTwoBytesZZZ ret_var = (this_arg_conv->get_relevant_txids)(this_arg_conv->this_arg);
12453         uint64_tArray ret_arr = NULL;
12454         ret_arr = init_uint64_tArray(ret_var.datalen, __LINE__);
12455         uint64_t *ret_arr_ptr = (uint64_t*)(((uint8_t*)ret_arr) + 8);
12456         for (size_t x = 0; x < ret_var.datalen; x++) {
12457                 LDKC2Tuple_ThirtyTwoBytesCOption_ThirtyTwoBytesZZ* ret_conv_49_conv = MALLOC(sizeof(LDKC2Tuple_ThirtyTwoBytesCOption_ThirtyTwoBytesZZ), "LDKC2Tuple_ThirtyTwoBytesCOption_ThirtyTwoBytesZZ");
12458                 *ret_conv_49_conv = ret_var.data[x];
12459                 ret_arr_ptr[x] = tag_ptr(ret_conv_49_conv, true);
12460         }
12461         
12462         FREE(ret_var.data);
12463         return ret_arr;
12464 }
12465
12466 typedef struct LDKEventHandler_JCalls {
12467         atomic_size_t refcnt;
12468         uint32_t instance_ptr;
12469 } LDKEventHandler_JCalls;
12470 static void LDKEventHandler_JCalls_free(void* this_arg) {
12471         LDKEventHandler_JCalls *j_calls = (LDKEventHandler_JCalls*) this_arg;
12472         if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
12473                 FREE(j_calls);
12474         }
12475 }
12476 void handle_event_LDKEventHandler_jcall(const void* this_arg, LDKEvent event) {
12477         LDKEventHandler_JCalls *j_calls = (LDKEventHandler_JCalls*) this_arg;
12478         LDKEvent *event_copy = MALLOC(sizeof(LDKEvent), "LDKEvent");
12479         *event_copy = event;
12480         uint64_t event_ref = tag_ptr(event_copy, true);
12481         js_invoke_function_buuuuu(j_calls->instance_ptr, 70, event_ref, 0, 0, 0, 0, 0);
12482 }
12483 static void LDKEventHandler_JCalls_cloned(LDKEventHandler* new_obj) {
12484         LDKEventHandler_JCalls *j_calls = (LDKEventHandler_JCalls*) new_obj->this_arg;
12485         atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
12486 }
12487 static inline LDKEventHandler LDKEventHandler_init (JSValue o) {
12488         LDKEventHandler_JCalls *calls = MALLOC(sizeof(LDKEventHandler_JCalls), "LDKEventHandler_JCalls");
12489         atomic_init(&calls->refcnt, 1);
12490         calls->instance_ptr = o;
12491
12492         LDKEventHandler ret = {
12493                 .this_arg = (void*) calls,
12494                 .handle_event = handle_event_LDKEventHandler_jcall,
12495                 .free = LDKEventHandler_JCalls_free,
12496         };
12497         return ret;
12498 }
12499 uint64_t  __attribute__((export_name("TS_LDKEventHandler_new"))) TS_LDKEventHandler_new(JSValue o) {
12500         LDKEventHandler *res_ptr = MALLOC(sizeof(LDKEventHandler), "LDKEventHandler");
12501         *res_ptr = LDKEventHandler_init(o);
12502         return tag_ptr(res_ptr, true);
12503 }
12504 void  __attribute__((export_name("TS_EventHandler_handle_event"))) TS_EventHandler_handle_event(uint64_t this_arg, uint64_t event) {
12505         void* this_arg_ptr = untag_ptr(this_arg);
12506         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
12507         LDKEventHandler* this_arg_conv = (LDKEventHandler*)this_arg_ptr;
12508         void* event_ptr = untag_ptr(event);
12509         CHECK_ACCESS(event_ptr);
12510         LDKEvent event_conv = *(LDKEvent*)(event_ptr);
12511         event_conv = Event_clone((LDKEvent*)untag_ptr(event));
12512         (this_arg_conv->handle_event)(this_arg_conv->this_arg, event_conv);
12513 }
12514
12515 typedef struct LDKEventsProvider_JCalls {
12516         atomic_size_t refcnt;
12517         uint32_t instance_ptr;
12518 } LDKEventsProvider_JCalls;
12519 static void LDKEventsProvider_JCalls_free(void* this_arg) {
12520         LDKEventsProvider_JCalls *j_calls = (LDKEventsProvider_JCalls*) this_arg;
12521         if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
12522                 FREE(j_calls);
12523         }
12524 }
12525 void process_pending_events_LDKEventsProvider_jcall(const void* this_arg, LDKEventHandler handler) {
12526         LDKEventsProvider_JCalls *j_calls = (LDKEventsProvider_JCalls*) this_arg;
12527         LDKEventHandler* handler_ret = MALLOC(sizeof(LDKEventHandler), "LDKEventHandler");
12528         *handler_ret = handler;
12529         js_invoke_function_buuuuu(j_calls->instance_ptr, 71, tag_ptr(handler_ret, true), 0, 0, 0, 0, 0);
12530 }
12531 static void LDKEventsProvider_JCalls_cloned(LDKEventsProvider* new_obj) {
12532         LDKEventsProvider_JCalls *j_calls = (LDKEventsProvider_JCalls*) new_obj->this_arg;
12533         atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
12534 }
12535 static inline LDKEventsProvider LDKEventsProvider_init (JSValue o) {
12536         LDKEventsProvider_JCalls *calls = MALLOC(sizeof(LDKEventsProvider_JCalls), "LDKEventsProvider_JCalls");
12537         atomic_init(&calls->refcnt, 1);
12538         calls->instance_ptr = o;
12539
12540         LDKEventsProvider ret = {
12541                 .this_arg = (void*) calls,
12542                 .process_pending_events = process_pending_events_LDKEventsProvider_jcall,
12543                 .free = LDKEventsProvider_JCalls_free,
12544         };
12545         return ret;
12546 }
12547 uint64_t  __attribute__((export_name("TS_LDKEventsProvider_new"))) TS_LDKEventsProvider_new(JSValue o) {
12548         LDKEventsProvider *res_ptr = MALLOC(sizeof(LDKEventsProvider), "LDKEventsProvider");
12549         *res_ptr = LDKEventsProvider_init(o);
12550         return tag_ptr(res_ptr, true);
12551 }
12552 void  __attribute__((export_name("TS_EventsProvider_process_pending_events"))) TS_EventsProvider_process_pending_events(uint64_t this_arg, uint64_t handler) {
12553         void* this_arg_ptr = untag_ptr(this_arg);
12554         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
12555         LDKEventsProvider* this_arg_conv = (LDKEventsProvider*)this_arg_ptr;
12556         void* handler_ptr = untag_ptr(handler);
12557         CHECK_ACCESS(handler_ptr);
12558         LDKEventHandler handler_conv = *(LDKEventHandler*)(handler_ptr);
12559         if (handler_conv.free == LDKEventHandler_JCalls_free) {
12560                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
12561                 LDKEventHandler_JCalls_cloned(&handler_conv);
12562         }
12563         (this_arg_conv->process_pending_events)(this_arg_conv->this_arg, handler_conv);
12564 }
12565
12566 uint32_t __attribute__((export_name("TS_LDKFailureCode_ty_from_ptr"))) TS_LDKFailureCode_ty_from_ptr(uint64_t ptr) {
12567         LDKFailureCode *obj = (LDKFailureCode*)untag_ptr(ptr);
12568         switch(obj->tag) {
12569                 case LDKFailureCode_TemporaryNodeFailure: return 0;
12570                 case LDKFailureCode_RequiredNodeFeatureMissing: return 1;
12571                 case LDKFailureCode_IncorrectOrUnknownPaymentDetails: return 2;
12572                 case LDKFailureCode_InvalidOnionPayload: return 3;
12573                 default: abort();
12574         }
12575 }
12576 uint64_t __attribute__((export_name("TS_LDKFailureCode_InvalidOnionPayload_get_invalid_onion_payload"))) TS_LDKFailureCode_InvalidOnionPayload_get_invalid_onion_payload(uint64_t ptr) {
12577         LDKFailureCode *obj = (LDKFailureCode*)untag_ptr(ptr);
12578         assert(obj->tag == LDKFailureCode_InvalidOnionPayload);
12579         uint64_t invalid_onion_payload_ref = tag_ptr(&obj->invalid_onion_payload, false);
12580         return invalid_onion_payload_ref;
12581 }
12582 typedef struct LDKMessageSendEventsProvider_JCalls {
12583         atomic_size_t refcnt;
12584         uint32_t instance_ptr;
12585 } LDKMessageSendEventsProvider_JCalls;
12586 static void LDKMessageSendEventsProvider_JCalls_free(void* this_arg) {
12587         LDKMessageSendEventsProvider_JCalls *j_calls = (LDKMessageSendEventsProvider_JCalls*) this_arg;
12588         if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
12589                 FREE(j_calls);
12590         }
12591 }
12592 LDKCVec_MessageSendEventZ get_and_clear_pending_msg_events_LDKMessageSendEventsProvider_jcall(const void* this_arg) {
12593         LDKMessageSendEventsProvider_JCalls *j_calls = (LDKMessageSendEventsProvider_JCalls*) this_arg;
12594         uint64_tArray ret = (uint64_tArray)js_invoke_function_uuuuuu(j_calls->instance_ptr, 72, 0, 0, 0, 0, 0, 0);
12595         LDKCVec_MessageSendEventZ ret_constr;
12596         ret_constr.datalen = ret->arr_len;
12597         if (ret_constr.datalen > 0)
12598                 ret_constr.data = MALLOC(ret_constr.datalen * sizeof(LDKMessageSendEvent), "LDKCVec_MessageSendEventZ Elements");
12599         else
12600                 ret_constr.data = NULL;
12601         uint64_t* ret_vals = ret->elems;
12602         for (size_t s = 0; s < ret_constr.datalen; s++) {
12603                 uint64_t ret_conv_18 = ret_vals[s];
12604                 void* ret_conv_18_ptr = untag_ptr(ret_conv_18);
12605                 CHECK_ACCESS(ret_conv_18_ptr);
12606                 LDKMessageSendEvent ret_conv_18_conv = *(LDKMessageSendEvent*)(ret_conv_18_ptr);
12607                 FREE(untag_ptr(ret_conv_18));
12608                 ret_constr.data[s] = ret_conv_18_conv;
12609         }
12610         FREE(ret);
12611         return ret_constr;
12612 }
12613 static void LDKMessageSendEventsProvider_JCalls_cloned(LDKMessageSendEventsProvider* new_obj) {
12614         LDKMessageSendEventsProvider_JCalls *j_calls = (LDKMessageSendEventsProvider_JCalls*) new_obj->this_arg;
12615         atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
12616 }
12617 static inline LDKMessageSendEventsProvider LDKMessageSendEventsProvider_init (JSValue o) {
12618         LDKMessageSendEventsProvider_JCalls *calls = MALLOC(sizeof(LDKMessageSendEventsProvider_JCalls), "LDKMessageSendEventsProvider_JCalls");
12619         atomic_init(&calls->refcnt, 1);
12620         calls->instance_ptr = o;
12621
12622         LDKMessageSendEventsProvider ret = {
12623                 .this_arg = (void*) calls,
12624                 .get_and_clear_pending_msg_events = get_and_clear_pending_msg_events_LDKMessageSendEventsProvider_jcall,
12625                 .free = LDKMessageSendEventsProvider_JCalls_free,
12626         };
12627         return ret;
12628 }
12629 uint64_t  __attribute__((export_name("TS_LDKMessageSendEventsProvider_new"))) TS_LDKMessageSendEventsProvider_new(JSValue o) {
12630         LDKMessageSendEventsProvider *res_ptr = MALLOC(sizeof(LDKMessageSendEventsProvider), "LDKMessageSendEventsProvider");
12631         *res_ptr = LDKMessageSendEventsProvider_init(o);
12632         return tag_ptr(res_ptr, true);
12633 }
12634 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) {
12635         void* this_arg_ptr = untag_ptr(this_arg);
12636         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
12637         LDKMessageSendEventsProvider* this_arg_conv = (LDKMessageSendEventsProvider*)this_arg_ptr;
12638         LDKCVec_MessageSendEventZ ret_var = (this_arg_conv->get_and_clear_pending_msg_events)(this_arg_conv->this_arg);
12639         uint64_tArray ret_arr = NULL;
12640         ret_arr = init_uint64_tArray(ret_var.datalen, __LINE__);
12641         uint64_t *ret_arr_ptr = (uint64_t*)(((uint8_t*)ret_arr) + 8);
12642         for (size_t s = 0; s < ret_var.datalen; s++) {
12643                 LDKMessageSendEvent *ret_conv_18_copy = MALLOC(sizeof(LDKMessageSendEvent), "LDKMessageSendEvent");
12644                 *ret_conv_18_copy = ret_var.data[s];
12645                 uint64_t ret_conv_18_ref = tag_ptr(ret_conv_18_copy, true);
12646                 ret_arr_ptr[s] = ret_conv_18_ref;
12647         }
12648         
12649         FREE(ret_var.data);
12650         return ret_arr;
12651 }
12652
12653 typedef struct LDKChannelMessageHandler_JCalls {
12654         atomic_size_t refcnt;
12655         uint32_t instance_ptr;
12656         LDKMessageSendEventsProvider_JCalls* MessageSendEventsProvider;
12657 } LDKChannelMessageHandler_JCalls;
12658 static void LDKChannelMessageHandler_JCalls_free(void* this_arg) {
12659         LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
12660         if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
12661                 FREE(j_calls);
12662         }
12663 }
12664 void handle_open_channel_LDKChannelMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKOpenChannel * msg) {
12665         LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
12666         int8_tArray their_node_id_arr = init_int8_tArray(33, __LINE__);
12667         memcpy(their_node_id_arr->elems, their_node_id.compressed_form, 33);
12668         LDKOpenChannel msg_var = *msg;
12669         uint64_t msg_ref = 0;
12670         msg_var = OpenChannel_clone(&msg_var);
12671         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
12672         msg_ref = tag_ptr(msg_var.inner, msg_var.is_owned);
12673         js_invoke_function_ubuuuu(j_calls->instance_ptr, 73, (uint32_t)their_node_id_arr, msg_ref, 0, 0, 0, 0);
12674 }
12675 void handle_open_channel_v2_LDKChannelMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKOpenChannelV2 * msg) {
12676         LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
12677         int8_tArray their_node_id_arr = init_int8_tArray(33, __LINE__);
12678         memcpy(their_node_id_arr->elems, their_node_id.compressed_form, 33);
12679         LDKOpenChannelV2 msg_var = *msg;
12680         uint64_t msg_ref = 0;
12681         msg_var = OpenChannelV2_clone(&msg_var);
12682         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
12683         msg_ref = tag_ptr(msg_var.inner, msg_var.is_owned);
12684         js_invoke_function_ubuuuu(j_calls->instance_ptr, 74, (uint32_t)their_node_id_arr, msg_ref, 0, 0, 0, 0);
12685 }
12686 void handle_accept_channel_LDKChannelMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKAcceptChannel * msg) {
12687         LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
12688         int8_tArray their_node_id_arr = init_int8_tArray(33, __LINE__);
12689         memcpy(their_node_id_arr->elems, their_node_id.compressed_form, 33);
12690         LDKAcceptChannel msg_var = *msg;
12691         uint64_t msg_ref = 0;
12692         msg_var = AcceptChannel_clone(&msg_var);
12693         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
12694         msg_ref = tag_ptr(msg_var.inner, msg_var.is_owned);
12695         js_invoke_function_ubuuuu(j_calls->instance_ptr, 75, (uint32_t)their_node_id_arr, msg_ref, 0, 0, 0, 0);
12696 }
12697 void handle_accept_channel_v2_LDKChannelMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKAcceptChannelV2 * msg) {
12698         LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
12699         int8_tArray their_node_id_arr = init_int8_tArray(33, __LINE__);
12700         memcpy(their_node_id_arr->elems, their_node_id.compressed_form, 33);
12701         LDKAcceptChannelV2 msg_var = *msg;
12702         uint64_t msg_ref = 0;
12703         msg_var = AcceptChannelV2_clone(&msg_var);
12704         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
12705         msg_ref = tag_ptr(msg_var.inner, msg_var.is_owned);
12706         js_invoke_function_ubuuuu(j_calls->instance_ptr, 76, (uint32_t)their_node_id_arr, msg_ref, 0, 0, 0, 0);
12707 }
12708 void handle_funding_created_LDKChannelMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKFundingCreated * msg) {
12709         LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
12710         int8_tArray their_node_id_arr = init_int8_tArray(33, __LINE__);
12711         memcpy(their_node_id_arr->elems, their_node_id.compressed_form, 33);
12712         LDKFundingCreated msg_var = *msg;
12713         uint64_t msg_ref = 0;
12714         msg_var = FundingCreated_clone(&msg_var);
12715         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
12716         msg_ref = tag_ptr(msg_var.inner, msg_var.is_owned);
12717         js_invoke_function_ubuuuu(j_calls->instance_ptr, 77, (uint32_t)their_node_id_arr, msg_ref, 0, 0, 0, 0);
12718 }
12719 void handle_funding_signed_LDKChannelMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKFundingSigned * msg) {
12720         LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
12721         int8_tArray their_node_id_arr = init_int8_tArray(33, __LINE__);
12722         memcpy(their_node_id_arr->elems, their_node_id.compressed_form, 33);
12723         LDKFundingSigned msg_var = *msg;
12724         uint64_t msg_ref = 0;
12725         msg_var = FundingSigned_clone(&msg_var);
12726         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
12727         msg_ref = tag_ptr(msg_var.inner, msg_var.is_owned);
12728         js_invoke_function_ubuuuu(j_calls->instance_ptr, 78, (uint32_t)their_node_id_arr, msg_ref, 0, 0, 0, 0);
12729 }
12730 void handle_channel_ready_LDKChannelMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKChannelReady * msg) {
12731         LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
12732         int8_tArray their_node_id_arr = init_int8_tArray(33, __LINE__);
12733         memcpy(their_node_id_arr->elems, their_node_id.compressed_form, 33);
12734         LDKChannelReady msg_var = *msg;
12735         uint64_t msg_ref = 0;
12736         msg_var = ChannelReady_clone(&msg_var);
12737         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
12738         msg_ref = tag_ptr(msg_var.inner, msg_var.is_owned);
12739         js_invoke_function_ubuuuu(j_calls->instance_ptr, 79, (uint32_t)their_node_id_arr, msg_ref, 0, 0, 0, 0);
12740 }
12741 void handle_shutdown_LDKChannelMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKShutdown * msg) {
12742         LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
12743         int8_tArray their_node_id_arr = init_int8_tArray(33, __LINE__);
12744         memcpy(their_node_id_arr->elems, their_node_id.compressed_form, 33);
12745         LDKShutdown msg_var = *msg;
12746         uint64_t msg_ref = 0;
12747         msg_var = Shutdown_clone(&msg_var);
12748         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
12749         msg_ref = tag_ptr(msg_var.inner, msg_var.is_owned);
12750         js_invoke_function_ubuuuu(j_calls->instance_ptr, 80, (uint32_t)their_node_id_arr, msg_ref, 0, 0, 0, 0);
12751 }
12752 void handle_closing_signed_LDKChannelMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKClosingSigned * msg) {
12753         LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
12754         int8_tArray their_node_id_arr = init_int8_tArray(33, __LINE__);
12755         memcpy(their_node_id_arr->elems, their_node_id.compressed_form, 33);
12756         LDKClosingSigned msg_var = *msg;
12757         uint64_t msg_ref = 0;
12758         msg_var = ClosingSigned_clone(&msg_var);
12759         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
12760         msg_ref = tag_ptr(msg_var.inner, msg_var.is_owned);
12761         js_invoke_function_ubuuuu(j_calls->instance_ptr, 81, (uint32_t)their_node_id_arr, msg_ref, 0, 0, 0, 0);
12762 }
12763 void handle_tx_add_input_LDKChannelMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKTxAddInput * msg) {
12764         LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
12765         int8_tArray their_node_id_arr = init_int8_tArray(33, __LINE__);
12766         memcpy(their_node_id_arr->elems, their_node_id.compressed_form, 33);
12767         LDKTxAddInput msg_var = *msg;
12768         uint64_t msg_ref = 0;
12769         msg_var = TxAddInput_clone(&msg_var);
12770         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
12771         msg_ref = tag_ptr(msg_var.inner, msg_var.is_owned);
12772         js_invoke_function_ubuuuu(j_calls->instance_ptr, 82, (uint32_t)their_node_id_arr, msg_ref, 0, 0, 0, 0);
12773 }
12774 void handle_tx_add_output_LDKChannelMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKTxAddOutput * msg) {
12775         LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
12776         int8_tArray their_node_id_arr = init_int8_tArray(33, __LINE__);
12777         memcpy(their_node_id_arr->elems, their_node_id.compressed_form, 33);
12778         LDKTxAddOutput msg_var = *msg;
12779         uint64_t msg_ref = 0;
12780         msg_var = TxAddOutput_clone(&msg_var);
12781         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
12782         msg_ref = tag_ptr(msg_var.inner, msg_var.is_owned);
12783         js_invoke_function_ubuuuu(j_calls->instance_ptr, 83, (uint32_t)their_node_id_arr, msg_ref, 0, 0, 0, 0);
12784 }
12785 void handle_tx_remove_input_LDKChannelMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKTxRemoveInput * msg) {
12786         LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
12787         int8_tArray their_node_id_arr = init_int8_tArray(33, __LINE__);
12788         memcpy(their_node_id_arr->elems, their_node_id.compressed_form, 33);
12789         LDKTxRemoveInput msg_var = *msg;
12790         uint64_t msg_ref = 0;
12791         msg_var = TxRemoveInput_clone(&msg_var);
12792         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
12793         msg_ref = tag_ptr(msg_var.inner, msg_var.is_owned);
12794         js_invoke_function_ubuuuu(j_calls->instance_ptr, 84, (uint32_t)their_node_id_arr, msg_ref, 0, 0, 0, 0);
12795 }
12796 void handle_tx_remove_output_LDKChannelMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKTxRemoveOutput * msg) {
12797         LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
12798         int8_tArray their_node_id_arr = init_int8_tArray(33, __LINE__);
12799         memcpy(their_node_id_arr->elems, their_node_id.compressed_form, 33);
12800         LDKTxRemoveOutput msg_var = *msg;
12801         uint64_t msg_ref = 0;
12802         msg_var = TxRemoveOutput_clone(&msg_var);
12803         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
12804         msg_ref = tag_ptr(msg_var.inner, msg_var.is_owned);
12805         js_invoke_function_ubuuuu(j_calls->instance_ptr, 85, (uint32_t)their_node_id_arr, msg_ref, 0, 0, 0, 0);
12806 }
12807 void handle_tx_complete_LDKChannelMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKTxComplete * msg) {
12808         LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
12809         int8_tArray their_node_id_arr = init_int8_tArray(33, __LINE__);
12810         memcpy(their_node_id_arr->elems, their_node_id.compressed_form, 33);
12811         LDKTxComplete msg_var = *msg;
12812         uint64_t msg_ref = 0;
12813         msg_var = TxComplete_clone(&msg_var);
12814         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
12815         msg_ref = tag_ptr(msg_var.inner, msg_var.is_owned);
12816         js_invoke_function_ubuuuu(j_calls->instance_ptr, 86, (uint32_t)their_node_id_arr, msg_ref, 0, 0, 0, 0);
12817 }
12818 void handle_tx_signatures_LDKChannelMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKTxSignatures * msg) {
12819         LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
12820         int8_tArray their_node_id_arr = init_int8_tArray(33, __LINE__);
12821         memcpy(their_node_id_arr->elems, their_node_id.compressed_form, 33);
12822         LDKTxSignatures msg_var = *msg;
12823         uint64_t msg_ref = 0;
12824         msg_var = TxSignatures_clone(&msg_var);
12825         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
12826         msg_ref = tag_ptr(msg_var.inner, msg_var.is_owned);
12827         js_invoke_function_ubuuuu(j_calls->instance_ptr, 87, (uint32_t)their_node_id_arr, msg_ref, 0, 0, 0, 0);
12828 }
12829 void handle_tx_init_rbf_LDKChannelMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKTxInitRbf * msg) {
12830         LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
12831         int8_tArray their_node_id_arr = init_int8_tArray(33, __LINE__);
12832         memcpy(their_node_id_arr->elems, their_node_id.compressed_form, 33);
12833         LDKTxInitRbf msg_var = *msg;
12834         uint64_t msg_ref = 0;
12835         msg_var = TxInitRbf_clone(&msg_var);
12836         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
12837         msg_ref = tag_ptr(msg_var.inner, msg_var.is_owned);
12838         js_invoke_function_ubuuuu(j_calls->instance_ptr, 88, (uint32_t)their_node_id_arr, msg_ref, 0, 0, 0, 0);
12839 }
12840 void handle_tx_ack_rbf_LDKChannelMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKTxAckRbf * msg) {
12841         LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
12842         int8_tArray their_node_id_arr = init_int8_tArray(33, __LINE__);
12843         memcpy(their_node_id_arr->elems, their_node_id.compressed_form, 33);
12844         LDKTxAckRbf msg_var = *msg;
12845         uint64_t msg_ref = 0;
12846         msg_var = TxAckRbf_clone(&msg_var);
12847         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
12848         msg_ref = tag_ptr(msg_var.inner, msg_var.is_owned);
12849         js_invoke_function_ubuuuu(j_calls->instance_ptr, 89, (uint32_t)their_node_id_arr, msg_ref, 0, 0, 0, 0);
12850 }
12851 void handle_tx_abort_LDKChannelMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKTxAbort * msg) {
12852         LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
12853         int8_tArray their_node_id_arr = init_int8_tArray(33, __LINE__);
12854         memcpy(their_node_id_arr->elems, their_node_id.compressed_form, 33);
12855         LDKTxAbort msg_var = *msg;
12856         uint64_t msg_ref = 0;
12857         msg_var = TxAbort_clone(&msg_var);
12858         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
12859         msg_ref = tag_ptr(msg_var.inner, msg_var.is_owned);
12860         js_invoke_function_ubuuuu(j_calls->instance_ptr, 90, (uint32_t)their_node_id_arr, msg_ref, 0, 0, 0, 0);
12861 }
12862 void handle_update_add_htlc_LDKChannelMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKUpdateAddHTLC * msg) {
12863         LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
12864         int8_tArray their_node_id_arr = init_int8_tArray(33, __LINE__);
12865         memcpy(their_node_id_arr->elems, their_node_id.compressed_form, 33);
12866         LDKUpdateAddHTLC msg_var = *msg;
12867         uint64_t msg_ref = 0;
12868         msg_var = UpdateAddHTLC_clone(&msg_var);
12869         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
12870         msg_ref = tag_ptr(msg_var.inner, msg_var.is_owned);
12871         js_invoke_function_ubuuuu(j_calls->instance_ptr, 91, (uint32_t)their_node_id_arr, msg_ref, 0, 0, 0, 0);
12872 }
12873 void handle_update_fulfill_htlc_LDKChannelMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKUpdateFulfillHTLC * msg) {
12874         LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
12875         int8_tArray their_node_id_arr = init_int8_tArray(33, __LINE__);
12876         memcpy(their_node_id_arr->elems, their_node_id.compressed_form, 33);
12877         LDKUpdateFulfillHTLC msg_var = *msg;
12878         uint64_t msg_ref = 0;
12879         msg_var = UpdateFulfillHTLC_clone(&msg_var);
12880         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
12881         msg_ref = tag_ptr(msg_var.inner, msg_var.is_owned);
12882         js_invoke_function_ubuuuu(j_calls->instance_ptr, 92, (uint32_t)their_node_id_arr, msg_ref, 0, 0, 0, 0);
12883 }
12884 void handle_update_fail_htlc_LDKChannelMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKUpdateFailHTLC * msg) {
12885         LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
12886         int8_tArray their_node_id_arr = init_int8_tArray(33, __LINE__);
12887         memcpy(their_node_id_arr->elems, their_node_id.compressed_form, 33);
12888         LDKUpdateFailHTLC msg_var = *msg;
12889         uint64_t msg_ref = 0;
12890         msg_var = UpdateFailHTLC_clone(&msg_var);
12891         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
12892         msg_ref = tag_ptr(msg_var.inner, msg_var.is_owned);
12893         js_invoke_function_ubuuuu(j_calls->instance_ptr, 93, (uint32_t)their_node_id_arr, msg_ref, 0, 0, 0, 0);
12894 }
12895 void handle_update_fail_malformed_htlc_LDKChannelMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKUpdateFailMalformedHTLC * msg) {
12896         LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
12897         int8_tArray their_node_id_arr = init_int8_tArray(33, __LINE__);
12898         memcpy(their_node_id_arr->elems, their_node_id.compressed_form, 33);
12899         LDKUpdateFailMalformedHTLC msg_var = *msg;
12900         uint64_t msg_ref = 0;
12901         msg_var = UpdateFailMalformedHTLC_clone(&msg_var);
12902         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
12903         msg_ref = tag_ptr(msg_var.inner, msg_var.is_owned);
12904         js_invoke_function_ubuuuu(j_calls->instance_ptr, 94, (uint32_t)their_node_id_arr, msg_ref, 0, 0, 0, 0);
12905 }
12906 void handle_commitment_signed_LDKChannelMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKCommitmentSigned * msg) {
12907         LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
12908         int8_tArray their_node_id_arr = init_int8_tArray(33, __LINE__);
12909         memcpy(their_node_id_arr->elems, their_node_id.compressed_form, 33);
12910         LDKCommitmentSigned msg_var = *msg;
12911         uint64_t msg_ref = 0;
12912         msg_var = CommitmentSigned_clone(&msg_var);
12913         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
12914         msg_ref = tag_ptr(msg_var.inner, msg_var.is_owned);
12915         js_invoke_function_ubuuuu(j_calls->instance_ptr, 95, (uint32_t)their_node_id_arr, msg_ref, 0, 0, 0, 0);
12916 }
12917 void handle_revoke_and_ack_LDKChannelMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKRevokeAndACK * msg) {
12918         LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
12919         int8_tArray their_node_id_arr = init_int8_tArray(33, __LINE__);
12920         memcpy(their_node_id_arr->elems, their_node_id.compressed_form, 33);
12921         LDKRevokeAndACK msg_var = *msg;
12922         uint64_t msg_ref = 0;
12923         msg_var = RevokeAndACK_clone(&msg_var);
12924         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
12925         msg_ref = tag_ptr(msg_var.inner, msg_var.is_owned);
12926         js_invoke_function_ubuuuu(j_calls->instance_ptr, 96, (uint32_t)their_node_id_arr, msg_ref, 0, 0, 0, 0);
12927 }
12928 void handle_update_fee_LDKChannelMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKUpdateFee * msg) {
12929         LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
12930         int8_tArray their_node_id_arr = init_int8_tArray(33, __LINE__);
12931         memcpy(their_node_id_arr->elems, their_node_id.compressed_form, 33);
12932         LDKUpdateFee msg_var = *msg;
12933         uint64_t msg_ref = 0;
12934         msg_var = UpdateFee_clone(&msg_var);
12935         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
12936         msg_ref = tag_ptr(msg_var.inner, msg_var.is_owned);
12937         js_invoke_function_ubuuuu(j_calls->instance_ptr, 97, (uint32_t)their_node_id_arr, msg_ref, 0, 0, 0, 0);
12938 }
12939 void handle_announcement_signatures_LDKChannelMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKAnnouncementSignatures * msg) {
12940         LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
12941         int8_tArray their_node_id_arr = init_int8_tArray(33, __LINE__);
12942         memcpy(their_node_id_arr->elems, their_node_id.compressed_form, 33);
12943         LDKAnnouncementSignatures msg_var = *msg;
12944         uint64_t msg_ref = 0;
12945         msg_var = AnnouncementSignatures_clone(&msg_var);
12946         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
12947         msg_ref = tag_ptr(msg_var.inner, msg_var.is_owned);
12948         js_invoke_function_ubuuuu(j_calls->instance_ptr, 98, (uint32_t)their_node_id_arr, msg_ref, 0, 0, 0, 0);
12949 }
12950 void peer_disconnected_LDKChannelMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id) {
12951         LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
12952         int8_tArray their_node_id_arr = init_int8_tArray(33, __LINE__);
12953         memcpy(their_node_id_arr->elems, their_node_id.compressed_form, 33);
12954         js_invoke_function_uuuuuu(j_calls->instance_ptr, 99, (uint32_t)their_node_id_arr, 0, 0, 0, 0, 0);
12955 }
12956 LDKCResult_NoneNoneZ peer_connected_LDKChannelMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKInit * msg, bool inbound) {
12957         LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
12958         int8_tArray their_node_id_arr = init_int8_tArray(33, __LINE__);
12959         memcpy(their_node_id_arr->elems, their_node_id.compressed_form, 33);
12960         LDKInit msg_var = *msg;
12961         uint64_t msg_ref = 0;
12962         msg_var = Init_clone(&msg_var);
12963         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
12964         msg_ref = tag_ptr(msg_var.inner, msg_var.is_owned);
12965         jboolean inbound_conv = inbound;
12966         uint64_t ret = js_invoke_function_ubuuuu(j_calls->instance_ptr, 100, (uint32_t)their_node_id_arr, msg_ref, inbound_conv, 0, 0, 0);
12967         void* ret_ptr = untag_ptr(ret);
12968         CHECK_ACCESS(ret_ptr);
12969         LDKCResult_NoneNoneZ ret_conv = *(LDKCResult_NoneNoneZ*)(ret_ptr);
12970         FREE(untag_ptr(ret));
12971         return ret_conv;
12972 }
12973 void handle_channel_reestablish_LDKChannelMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKChannelReestablish * msg) {
12974         LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
12975         int8_tArray their_node_id_arr = init_int8_tArray(33, __LINE__);
12976         memcpy(their_node_id_arr->elems, their_node_id.compressed_form, 33);
12977         LDKChannelReestablish msg_var = *msg;
12978         uint64_t msg_ref = 0;
12979         msg_var = ChannelReestablish_clone(&msg_var);
12980         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
12981         msg_ref = tag_ptr(msg_var.inner, msg_var.is_owned);
12982         js_invoke_function_ubuuuu(j_calls->instance_ptr, 101, (uint32_t)their_node_id_arr, msg_ref, 0, 0, 0, 0);
12983 }
12984 void handle_channel_update_LDKChannelMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKChannelUpdate * msg) {
12985         LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
12986         int8_tArray their_node_id_arr = init_int8_tArray(33, __LINE__);
12987         memcpy(their_node_id_arr->elems, their_node_id.compressed_form, 33);
12988         LDKChannelUpdate msg_var = *msg;
12989         uint64_t msg_ref = 0;
12990         msg_var = ChannelUpdate_clone(&msg_var);
12991         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
12992         msg_ref = tag_ptr(msg_var.inner, msg_var.is_owned);
12993         js_invoke_function_ubuuuu(j_calls->instance_ptr, 102, (uint32_t)their_node_id_arr, msg_ref, 0, 0, 0, 0);
12994 }
12995 void handle_error_LDKChannelMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKErrorMessage * msg) {
12996         LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
12997         int8_tArray their_node_id_arr = init_int8_tArray(33, __LINE__);
12998         memcpy(their_node_id_arr->elems, their_node_id.compressed_form, 33);
12999         LDKErrorMessage msg_var = *msg;
13000         uint64_t msg_ref = 0;
13001         msg_var = ErrorMessage_clone(&msg_var);
13002         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
13003         msg_ref = tag_ptr(msg_var.inner, msg_var.is_owned);
13004         js_invoke_function_ubuuuu(j_calls->instance_ptr, 103, (uint32_t)their_node_id_arr, msg_ref, 0, 0, 0, 0);
13005 }
13006 LDKNodeFeatures provided_node_features_LDKChannelMessageHandler_jcall(const void* this_arg) {
13007         LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
13008         uint64_t ret = js_invoke_function_uuuuuu(j_calls->instance_ptr, 104, 0, 0, 0, 0, 0, 0);
13009         LDKNodeFeatures ret_conv;
13010         ret_conv.inner = untag_ptr(ret);
13011         ret_conv.is_owned = ptr_is_owned(ret);
13012         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_conv);
13013         return ret_conv;
13014 }
13015 LDKInitFeatures provided_init_features_LDKChannelMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id) {
13016         LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
13017         int8_tArray their_node_id_arr = init_int8_tArray(33, __LINE__);
13018         memcpy(their_node_id_arr->elems, their_node_id.compressed_form, 33);
13019         uint64_t ret = js_invoke_function_uuuuuu(j_calls->instance_ptr, 105, (uint32_t)their_node_id_arr, 0, 0, 0, 0, 0);
13020         LDKInitFeatures ret_conv;
13021         ret_conv.inner = untag_ptr(ret);
13022         ret_conv.is_owned = ptr_is_owned(ret);
13023         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_conv);
13024         return ret_conv;
13025 }
13026 LDKCOption_CVec_ThirtyTwoBytesZZ get_chain_hashes_LDKChannelMessageHandler_jcall(const void* this_arg) {
13027         LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
13028         uint64_t ret = js_invoke_function_uuuuuu(j_calls->instance_ptr, 106, 0, 0, 0, 0, 0, 0);
13029         void* ret_ptr = untag_ptr(ret);
13030         CHECK_ACCESS(ret_ptr);
13031         LDKCOption_CVec_ThirtyTwoBytesZZ ret_conv = *(LDKCOption_CVec_ThirtyTwoBytesZZ*)(ret_ptr);
13032         FREE(untag_ptr(ret));
13033         return ret_conv;
13034 }
13035 static void LDKChannelMessageHandler_JCalls_cloned(LDKChannelMessageHandler* new_obj) {
13036         LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) new_obj->this_arg;
13037         atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
13038         atomic_fetch_add_explicit(&j_calls->MessageSendEventsProvider->refcnt, 1, memory_order_release);
13039 }
13040 static inline LDKChannelMessageHandler LDKChannelMessageHandler_init (JSValue o, JSValue MessageSendEventsProvider) {
13041         LDKChannelMessageHandler_JCalls *calls = MALLOC(sizeof(LDKChannelMessageHandler_JCalls), "LDKChannelMessageHandler_JCalls");
13042         atomic_init(&calls->refcnt, 1);
13043         calls->instance_ptr = o;
13044
13045         LDKChannelMessageHandler ret = {
13046                 .this_arg = (void*) calls,
13047                 .handle_open_channel = handle_open_channel_LDKChannelMessageHandler_jcall,
13048                 .handle_open_channel_v2 = handle_open_channel_v2_LDKChannelMessageHandler_jcall,
13049                 .handle_accept_channel = handle_accept_channel_LDKChannelMessageHandler_jcall,
13050                 .handle_accept_channel_v2 = handle_accept_channel_v2_LDKChannelMessageHandler_jcall,
13051                 .handle_funding_created = handle_funding_created_LDKChannelMessageHandler_jcall,
13052                 .handle_funding_signed = handle_funding_signed_LDKChannelMessageHandler_jcall,
13053                 .handle_channel_ready = handle_channel_ready_LDKChannelMessageHandler_jcall,
13054                 .handle_shutdown = handle_shutdown_LDKChannelMessageHandler_jcall,
13055                 .handle_closing_signed = handle_closing_signed_LDKChannelMessageHandler_jcall,
13056                 .handle_tx_add_input = handle_tx_add_input_LDKChannelMessageHandler_jcall,
13057                 .handle_tx_add_output = handle_tx_add_output_LDKChannelMessageHandler_jcall,
13058                 .handle_tx_remove_input = handle_tx_remove_input_LDKChannelMessageHandler_jcall,
13059                 .handle_tx_remove_output = handle_tx_remove_output_LDKChannelMessageHandler_jcall,
13060                 .handle_tx_complete = handle_tx_complete_LDKChannelMessageHandler_jcall,
13061                 .handle_tx_signatures = handle_tx_signatures_LDKChannelMessageHandler_jcall,
13062                 .handle_tx_init_rbf = handle_tx_init_rbf_LDKChannelMessageHandler_jcall,
13063                 .handle_tx_ack_rbf = handle_tx_ack_rbf_LDKChannelMessageHandler_jcall,
13064                 .handle_tx_abort = handle_tx_abort_LDKChannelMessageHandler_jcall,
13065                 .handle_update_add_htlc = handle_update_add_htlc_LDKChannelMessageHandler_jcall,
13066                 .handle_update_fulfill_htlc = handle_update_fulfill_htlc_LDKChannelMessageHandler_jcall,
13067                 .handle_update_fail_htlc = handle_update_fail_htlc_LDKChannelMessageHandler_jcall,
13068                 .handle_update_fail_malformed_htlc = handle_update_fail_malformed_htlc_LDKChannelMessageHandler_jcall,
13069                 .handle_commitment_signed = handle_commitment_signed_LDKChannelMessageHandler_jcall,
13070                 .handle_revoke_and_ack = handle_revoke_and_ack_LDKChannelMessageHandler_jcall,
13071                 .handle_update_fee = handle_update_fee_LDKChannelMessageHandler_jcall,
13072                 .handle_announcement_signatures = handle_announcement_signatures_LDKChannelMessageHandler_jcall,
13073                 .peer_disconnected = peer_disconnected_LDKChannelMessageHandler_jcall,
13074                 .peer_connected = peer_connected_LDKChannelMessageHandler_jcall,
13075                 .handle_channel_reestablish = handle_channel_reestablish_LDKChannelMessageHandler_jcall,
13076                 .handle_channel_update = handle_channel_update_LDKChannelMessageHandler_jcall,
13077                 .handle_error = handle_error_LDKChannelMessageHandler_jcall,
13078                 .provided_node_features = provided_node_features_LDKChannelMessageHandler_jcall,
13079                 .provided_init_features = provided_init_features_LDKChannelMessageHandler_jcall,
13080                 .get_chain_hashes = get_chain_hashes_LDKChannelMessageHandler_jcall,
13081                 .free = LDKChannelMessageHandler_JCalls_free,
13082                 .MessageSendEventsProvider = LDKMessageSendEventsProvider_init(MessageSendEventsProvider),
13083         };
13084         calls->MessageSendEventsProvider = ret.MessageSendEventsProvider.this_arg;
13085         return ret;
13086 }
13087 uint64_t  __attribute__((export_name("TS_LDKChannelMessageHandler_new"))) TS_LDKChannelMessageHandler_new(JSValue o, JSValue MessageSendEventsProvider) {
13088         LDKChannelMessageHandler *res_ptr = MALLOC(sizeof(LDKChannelMessageHandler), "LDKChannelMessageHandler");
13089         *res_ptr = LDKChannelMessageHandler_init(o, MessageSendEventsProvider);
13090         return tag_ptr(res_ptr, true);
13091 }
13092 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) {
13093         void* this_arg_ptr = untag_ptr(this_arg);
13094         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
13095         LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)this_arg_ptr;
13096         LDKPublicKey their_node_id_ref;
13097         CHECK(their_node_id->arr_len == 33);
13098         memcpy(their_node_id_ref.compressed_form, their_node_id->elems, 33); FREE(their_node_id);
13099         LDKOpenChannel msg_conv;
13100         msg_conv.inner = untag_ptr(msg);
13101         msg_conv.is_owned = ptr_is_owned(msg);
13102         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
13103         msg_conv.is_owned = false;
13104         (this_arg_conv->handle_open_channel)(this_arg_conv->this_arg, their_node_id_ref, &msg_conv);
13105 }
13106
13107 void  __attribute__((export_name("TS_ChannelMessageHandler_handle_open_channel_v2"))) TS_ChannelMessageHandler_handle_open_channel_v2(uint64_t this_arg, int8_tArray their_node_id, uint64_t msg) {
13108         void* this_arg_ptr = untag_ptr(this_arg);
13109         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
13110         LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)this_arg_ptr;
13111         LDKPublicKey their_node_id_ref;
13112         CHECK(their_node_id->arr_len == 33);
13113         memcpy(their_node_id_ref.compressed_form, their_node_id->elems, 33); FREE(their_node_id);
13114         LDKOpenChannelV2 msg_conv;
13115         msg_conv.inner = untag_ptr(msg);
13116         msg_conv.is_owned = ptr_is_owned(msg);
13117         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
13118         msg_conv.is_owned = false;
13119         (this_arg_conv->handle_open_channel_v2)(this_arg_conv->this_arg, their_node_id_ref, &msg_conv);
13120 }
13121
13122 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) {
13123         void* this_arg_ptr = untag_ptr(this_arg);
13124         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
13125         LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)this_arg_ptr;
13126         LDKPublicKey their_node_id_ref;
13127         CHECK(their_node_id->arr_len == 33);
13128         memcpy(their_node_id_ref.compressed_form, their_node_id->elems, 33); FREE(their_node_id);
13129         LDKAcceptChannel msg_conv;
13130         msg_conv.inner = untag_ptr(msg);
13131         msg_conv.is_owned = ptr_is_owned(msg);
13132         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
13133         msg_conv.is_owned = false;
13134         (this_arg_conv->handle_accept_channel)(this_arg_conv->this_arg, their_node_id_ref, &msg_conv);
13135 }
13136
13137 void  __attribute__((export_name("TS_ChannelMessageHandler_handle_accept_channel_v2"))) TS_ChannelMessageHandler_handle_accept_channel_v2(uint64_t this_arg, int8_tArray their_node_id, uint64_t msg) {
13138         void* this_arg_ptr = untag_ptr(this_arg);
13139         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
13140         LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)this_arg_ptr;
13141         LDKPublicKey their_node_id_ref;
13142         CHECK(their_node_id->arr_len == 33);
13143         memcpy(their_node_id_ref.compressed_form, their_node_id->elems, 33); FREE(their_node_id);
13144         LDKAcceptChannelV2 msg_conv;
13145         msg_conv.inner = untag_ptr(msg);
13146         msg_conv.is_owned = ptr_is_owned(msg);
13147         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
13148         msg_conv.is_owned = false;
13149         (this_arg_conv->handle_accept_channel_v2)(this_arg_conv->this_arg, their_node_id_ref, &msg_conv);
13150 }
13151
13152 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) {
13153         void* this_arg_ptr = untag_ptr(this_arg);
13154         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
13155         LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)this_arg_ptr;
13156         LDKPublicKey their_node_id_ref;
13157         CHECK(their_node_id->arr_len == 33);
13158         memcpy(their_node_id_ref.compressed_form, their_node_id->elems, 33); FREE(their_node_id);
13159         LDKFundingCreated msg_conv;
13160         msg_conv.inner = untag_ptr(msg);
13161         msg_conv.is_owned = ptr_is_owned(msg);
13162         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
13163         msg_conv.is_owned = false;
13164         (this_arg_conv->handle_funding_created)(this_arg_conv->this_arg, their_node_id_ref, &msg_conv);
13165 }
13166
13167 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) {
13168         void* this_arg_ptr = untag_ptr(this_arg);
13169         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
13170         LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)this_arg_ptr;
13171         LDKPublicKey their_node_id_ref;
13172         CHECK(their_node_id->arr_len == 33);
13173         memcpy(their_node_id_ref.compressed_form, their_node_id->elems, 33); FREE(their_node_id);
13174         LDKFundingSigned msg_conv;
13175         msg_conv.inner = untag_ptr(msg);
13176         msg_conv.is_owned = ptr_is_owned(msg);
13177         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
13178         msg_conv.is_owned = false;
13179         (this_arg_conv->handle_funding_signed)(this_arg_conv->this_arg, their_node_id_ref, &msg_conv);
13180 }
13181
13182 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) {
13183         void* this_arg_ptr = untag_ptr(this_arg);
13184         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
13185         LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)this_arg_ptr;
13186         LDKPublicKey their_node_id_ref;
13187         CHECK(their_node_id->arr_len == 33);
13188         memcpy(their_node_id_ref.compressed_form, their_node_id->elems, 33); FREE(their_node_id);
13189         LDKChannelReady msg_conv;
13190         msg_conv.inner = untag_ptr(msg);
13191         msg_conv.is_owned = ptr_is_owned(msg);
13192         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
13193         msg_conv.is_owned = false;
13194         (this_arg_conv->handle_channel_ready)(this_arg_conv->this_arg, their_node_id_ref, &msg_conv);
13195 }
13196
13197 void  __attribute__((export_name("TS_ChannelMessageHandler_handle_shutdown"))) TS_ChannelMessageHandler_handle_shutdown(uint64_t this_arg, int8_tArray their_node_id, uint64_t msg) {
13198         void* this_arg_ptr = untag_ptr(this_arg);
13199         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
13200         LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)this_arg_ptr;
13201         LDKPublicKey their_node_id_ref;
13202         CHECK(their_node_id->arr_len == 33);
13203         memcpy(their_node_id_ref.compressed_form, their_node_id->elems, 33); FREE(their_node_id);
13204         LDKShutdown msg_conv;
13205         msg_conv.inner = untag_ptr(msg);
13206         msg_conv.is_owned = ptr_is_owned(msg);
13207         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
13208         msg_conv.is_owned = false;
13209         (this_arg_conv->handle_shutdown)(this_arg_conv->this_arg, their_node_id_ref, &msg_conv);
13210 }
13211
13212 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) {
13213         void* this_arg_ptr = untag_ptr(this_arg);
13214         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
13215         LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)this_arg_ptr;
13216         LDKPublicKey their_node_id_ref;
13217         CHECK(their_node_id->arr_len == 33);
13218         memcpy(their_node_id_ref.compressed_form, their_node_id->elems, 33); FREE(their_node_id);
13219         LDKClosingSigned msg_conv;
13220         msg_conv.inner = untag_ptr(msg);
13221         msg_conv.is_owned = ptr_is_owned(msg);
13222         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
13223         msg_conv.is_owned = false;
13224         (this_arg_conv->handle_closing_signed)(this_arg_conv->this_arg, their_node_id_ref, &msg_conv);
13225 }
13226
13227 void  __attribute__((export_name("TS_ChannelMessageHandler_handle_tx_add_input"))) TS_ChannelMessageHandler_handle_tx_add_input(uint64_t this_arg, int8_tArray their_node_id, uint64_t msg) {
13228         void* this_arg_ptr = untag_ptr(this_arg);
13229         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
13230         LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)this_arg_ptr;
13231         LDKPublicKey their_node_id_ref;
13232         CHECK(their_node_id->arr_len == 33);
13233         memcpy(their_node_id_ref.compressed_form, their_node_id->elems, 33); FREE(their_node_id);
13234         LDKTxAddInput msg_conv;
13235         msg_conv.inner = untag_ptr(msg);
13236         msg_conv.is_owned = ptr_is_owned(msg);
13237         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
13238         msg_conv.is_owned = false;
13239         (this_arg_conv->handle_tx_add_input)(this_arg_conv->this_arg, their_node_id_ref, &msg_conv);
13240 }
13241
13242 void  __attribute__((export_name("TS_ChannelMessageHandler_handle_tx_add_output"))) TS_ChannelMessageHandler_handle_tx_add_output(uint64_t this_arg, int8_tArray their_node_id, uint64_t msg) {
13243         void* this_arg_ptr = untag_ptr(this_arg);
13244         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
13245         LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)this_arg_ptr;
13246         LDKPublicKey their_node_id_ref;
13247         CHECK(their_node_id->arr_len == 33);
13248         memcpy(their_node_id_ref.compressed_form, their_node_id->elems, 33); FREE(their_node_id);
13249         LDKTxAddOutput msg_conv;
13250         msg_conv.inner = untag_ptr(msg);
13251         msg_conv.is_owned = ptr_is_owned(msg);
13252         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
13253         msg_conv.is_owned = false;
13254         (this_arg_conv->handle_tx_add_output)(this_arg_conv->this_arg, their_node_id_ref, &msg_conv);
13255 }
13256
13257 void  __attribute__((export_name("TS_ChannelMessageHandler_handle_tx_remove_input"))) TS_ChannelMessageHandler_handle_tx_remove_input(uint64_t this_arg, int8_tArray their_node_id, uint64_t msg) {
13258         void* this_arg_ptr = untag_ptr(this_arg);
13259         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
13260         LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)this_arg_ptr;
13261         LDKPublicKey their_node_id_ref;
13262         CHECK(their_node_id->arr_len == 33);
13263         memcpy(their_node_id_ref.compressed_form, their_node_id->elems, 33); FREE(their_node_id);
13264         LDKTxRemoveInput msg_conv;
13265         msg_conv.inner = untag_ptr(msg);
13266         msg_conv.is_owned = ptr_is_owned(msg);
13267         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
13268         msg_conv.is_owned = false;
13269         (this_arg_conv->handle_tx_remove_input)(this_arg_conv->this_arg, their_node_id_ref, &msg_conv);
13270 }
13271
13272 void  __attribute__((export_name("TS_ChannelMessageHandler_handle_tx_remove_output"))) TS_ChannelMessageHandler_handle_tx_remove_output(uint64_t this_arg, int8_tArray their_node_id, uint64_t msg) {
13273         void* this_arg_ptr = untag_ptr(this_arg);
13274         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
13275         LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)this_arg_ptr;
13276         LDKPublicKey their_node_id_ref;
13277         CHECK(their_node_id->arr_len == 33);
13278         memcpy(their_node_id_ref.compressed_form, their_node_id->elems, 33); FREE(their_node_id);
13279         LDKTxRemoveOutput msg_conv;
13280         msg_conv.inner = untag_ptr(msg);
13281         msg_conv.is_owned = ptr_is_owned(msg);
13282         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
13283         msg_conv.is_owned = false;
13284         (this_arg_conv->handle_tx_remove_output)(this_arg_conv->this_arg, their_node_id_ref, &msg_conv);
13285 }
13286
13287 void  __attribute__((export_name("TS_ChannelMessageHandler_handle_tx_complete"))) TS_ChannelMessageHandler_handle_tx_complete(uint64_t this_arg, int8_tArray their_node_id, uint64_t msg) {
13288         void* this_arg_ptr = untag_ptr(this_arg);
13289         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
13290         LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)this_arg_ptr;
13291         LDKPublicKey their_node_id_ref;
13292         CHECK(their_node_id->arr_len == 33);
13293         memcpy(their_node_id_ref.compressed_form, their_node_id->elems, 33); FREE(their_node_id);
13294         LDKTxComplete msg_conv;
13295         msg_conv.inner = untag_ptr(msg);
13296         msg_conv.is_owned = ptr_is_owned(msg);
13297         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
13298         msg_conv.is_owned = false;
13299         (this_arg_conv->handle_tx_complete)(this_arg_conv->this_arg, their_node_id_ref, &msg_conv);
13300 }
13301
13302 void  __attribute__((export_name("TS_ChannelMessageHandler_handle_tx_signatures"))) TS_ChannelMessageHandler_handle_tx_signatures(uint64_t this_arg, int8_tArray their_node_id, uint64_t msg) {
13303         void* this_arg_ptr = untag_ptr(this_arg);
13304         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
13305         LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)this_arg_ptr;
13306         LDKPublicKey their_node_id_ref;
13307         CHECK(their_node_id->arr_len == 33);
13308         memcpy(their_node_id_ref.compressed_form, their_node_id->elems, 33); FREE(their_node_id);
13309         LDKTxSignatures msg_conv;
13310         msg_conv.inner = untag_ptr(msg);
13311         msg_conv.is_owned = ptr_is_owned(msg);
13312         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
13313         msg_conv.is_owned = false;
13314         (this_arg_conv->handle_tx_signatures)(this_arg_conv->this_arg, their_node_id_ref, &msg_conv);
13315 }
13316
13317 void  __attribute__((export_name("TS_ChannelMessageHandler_handle_tx_init_rbf"))) TS_ChannelMessageHandler_handle_tx_init_rbf(uint64_t this_arg, int8_tArray their_node_id, uint64_t msg) {
13318         void* this_arg_ptr = untag_ptr(this_arg);
13319         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
13320         LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)this_arg_ptr;
13321         LDKPublicKey their_node_id_ref;
13322         CHECK(their_node_id->arr_len == 33);
13323         memcpy(their_node_id_ref.compressed_form, their_node_id->elems, 33); FREE(their_node_id);
13324         LDKTxInitRbf msg_conv;
13325         msg_conv.inner = untag_ptr(msg);
13326         msg_conv.is_owned = ptr_is_owned(msg);
13327         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
13328         msg_conv.is_owned = false;
13329         (this_arg_conv->handle_tx_init_rbf)(this_arg_conv->this_arg, their_node_id_ref, &msg_conv);
13330 }
13331
13332 void  __attribute__((export_name("TS_ChannelMessageHandler_handle_tx_ack_rbf"))) TS_ChannelMessageHandler_handle_tx_ack_rbf(uint64_t this_arg, int8_tArray their_node_id, uint64_t msg) {
13333         void* this_arg_ptr = untag_ptr(this_arg);
13334         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
13335         LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)this_arg_ptr;
13336         LDKPublicKey their_node_id_ref;
13337         CHECK(their_node_id->arr_len == 33);
13338         memcpy(their_node_id_ref.compressed_form, their_node_id->elems, 33); FREE(their_node_id);
13339         LDKTxAckRbf msg_conv;
13340         msg_conv.inner = untag_ptr(msg);
13341         msg_conv.is_owned = ptr_is_owned(msg);
13342         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
13343         msg_conv.is_owned = false;
13344         (this_arg_conv->handle_tx_ack_rbf)(this_arg_conv->this_arg, their_node_id_ref, &msg_conv);
13345 }
13346
13347 void  __attribute__((export_name("TS_ChannelMessageHandler_handle_tx_abort"))) TS_ChannelMessageHandler_handle_tx_abort(uint64_t this_arg, int8_tArray their_node_id, uint64_t msg) {
13348         void* this_arg_ptr = untag_ptr(this_arg);
13349         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
13350         LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)this_arg_ptr;
13351         LDKPublicKey their_node_id_ref;
13352         CHECK(their_node_id->arr_len == 33);
13353         memcpy(their_node_id_ref.compressed_form, their_node_id->elems, 33); FREE(their_node_id);
13354         LDKTxAbort msg_conv;
13355         msg_conv.inner = untag_ptr(msg);
13356         msg_conv.is_owned = ptr_is_owned(msg);
13357         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
13358         msg_conv.is_owned = false;
13359         (this_arg_conv->handle_tx_abort)(this_arg_conv->this_arg, their_node_id_ref, &msg_conv);
13360 }
13361
13362 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) {
13363         void* this_arg_ptr = untag_ptr(this_arg);
13364         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
13365         LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)this_arg_ptr;
13366         LDKPublicKey their_node_id_ref;
13367         CHECK(their_node_id->arr_len == 33);
13368         memcpy(their_node_id_ref.compressed_form, their_node_id->elems, 33); FREE(their_node_id);
13369         LDKUpdateAddHTLC msg_conv;
13370         msg_conv.inner = untag_ptr(msg);
13371         msg_conv.is_owned = ptr_is_owned(msg);
13372         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
13373         msg_conv.is_owned = false;
13374         (this_arg_conv->handle_update_add_htlc)(this_arg_conv->this_arg, their_node_id_ref, &msg_conv);
13375 }
13376
13377 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) {
13378         void* this_arg_ptr = untag_ptr(this_arg);
13379         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
13380         LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)this_arg_ptr;
13381         LDKPublicKey their_node_id_ref;
13382         CHECK(their_node_id->arr_len == 33);
13383         memcpy(their_node_id_ref.compressed_form, their_node_id->elems, 33); FREE(their_node_id);
13384         LDKUpdateFulfillHTLC msg_conv;
13385         msg_conv.inner = untag_ptr(msg);
13386         msg_conv.is_owned = ptr_is_owned(msg);
13387         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
13388         msg_conv.is_owned = false;
13389         (this_arg_conv->handle_update_fulfill_htlc)(this_arg_conv->this_arg, their_node_id_ref, &msg_conv);
13390 }
13391
13392 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) {
13393         void* this_arg_ptr = untag_ptr(this_arg);
13394         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
13395         LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)this_arg_ptr;
13396         LDKPublicKey their_node_id_ref;
13397         CHECK(their_node_id->arr_len == 33);
13398         memcpy(their_node_id_ref.compressed_form, their_node_id->elems, 33); FREE(their_node_id);
13399         LDKUpdateFailHTLC msg_conv;
13400         msg_conv.inner = untag_ptr(msg);
13401         msg_conv.is_owned = ptr_is_owned(msg);
13402         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
13403         msg_conv.is_owned = false;
13404         (this_arg_conv->handle_update_fail_htlc)(this_arg_conv->this_arg, their_node_id_ref, &msg_conv);
13405 }
13406
13407 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) {
13408         void* this_arg_ptr = untag_ptr(this_arg);
13409         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
13410         LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)this_arg_ptr;
13411         LDKPublicKey their_node_id_ref;
13412         CHECK(their_node_id->arr_len == 33);
13413         memcpy(their_node_id_ref.compressed_form, their_node_id->elems, 33); FREE(their_node_id);
13414         LDKUpdateFailMalformedHTLC msg_conv;
13415         msg_conv.inner = untag_ptr(msg);
13416         msg_conv.is_owned = ptr_is_owned(msg);
13417         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
13418         msg_conv.is_owned = false;
13419         (this_arg_conv->handle_update_fail_malformed_htlc)(this_arg_conv->this_arg, their_node_id_ref, &msg_conv);
13420 }
13421
13422 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) {
13423         void* this_arg_ptr = untag_ptr(this_arg);
13424         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
13425         LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)this_arg_ptr;
13426         LDKPublicKey their_node_id_ref;
13427         CHECK(their_node_id->arr_len == 33);
13428         memcpy(their_node_id_ref.compressed_form, their_node_id->elems, 33); FREE(their_node_id);
13429         LDKCommitmentSigned msg_conv;
13430         msg_conv.inner = untag_ptr(msg);
13431         msg_conv.is_owned = ptr_is_owned(msg);
13432         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
13433         msg_conv.is_owned = false;
13434         (this_arg_conv->handle_commitment_signed)(this_arg_conv->this_arg, their_node_id_ref, &msg_conv);
13435 }
13436
13437 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) {
13438         void* this_arg_ptr = untag_ptr(this_arg);
13439         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
13440         LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)this_arg_ptr;
13441         LDKPublicKey their_node_id_ref;
13442         CHECK(their_node_id->arr_len == 33);
13443         memcpy(their_node_id_ref.compressed_form, their_node_id->elems, 33); FREE(their_node_id);
13444         LDKRevokeAndACK msg_conv;
13445         msg_conv.inner = untag_ptr(msg);
13446         msg_conv.is_owned = ptr_is_owned(msg);
13447         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
13448         msg_conv.is_owned = false;
13449         (this_arg_conv->handle_revoke_and_ack)(this_arg_conv->this_arg, their_node_id_ref, &msg_conv);
13450 }
13451
13452 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) {
13453         void* this_arg_ptr = untag_ptr(this_arg);
13454         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
13455         LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)this_arg_ptr;
13456         LDKPublicKey their_node_id_ref;
13457         CHECK(their_node_id->arr_len == 33);
13458         memcpy(their_node_id_ref.compressed_form, their_node_id->elems, 33); FREE(their_node_id);
13459         LDKUpdateFee msg_conv;
13460         msg_conv.inner = untag_ptr(msg);
13461         msg_conv.is_owned = ptr_is_owned(msg);
13462         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
13463         msg_conv.is_owned = false;
13464         (this_arg_conv->handle_update_fee)(this_arg_conv->this_arg, their_node_id_ref, &msg_conv);
13465 }
13466
13467 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) {
13468         void* this_arg_ptr = untag_ptr(this_arg);
13469         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
13470         LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)this_arg_ptr;
13471         LDKPublicKey their_node_id_ref;
13472         CHECK(their_node_id->arr_len == 33);
13473         memcpy(their_node_id_ref.compressed_form, their_node_id->elems, 33); FREE(their_node_id);
13474         LDKAnnouncementSignatures msg_conv;
13475         msg_conv.inner = untag_ptr(msg);
13476         msg_conv.is_owned = ptr_is_owned(msg);
13477         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
13478         msg_conv.is_owned = false;
13479         (this_arg_conv->handle_announcement_signatures)(this_arg_conv->this_arg, their_node_id_ref, &msg_conv);
13480 }
13481
13482 void  __attribute__((export_name("TS_ChannelMessageHandler_peer_disconnected"))) TS_ChannelMessageHandler_peer_disconnected(uint64_t this_arg, int8_tArray their_node_id) {
13483         void* this_arg_ptr = untag_ptr(this_arg);
13484         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
13485         LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)this_arg_ptr;
13486         LDKPublicKey their_node_id_ref;
13487         CHECK(their_node_id->arr_len == 33);
13488         memcpy(their_node_id_ref.compressed_form, their_node_id->elems, 33); FREE(their_node_id);
13489         (this_arg_conv->peer_disconnected)(this_arg_conv->this_arg, their_node_id_ref);
13490 }
13491
13492 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) {
13493         void* this_arg_ptr = untag_ptr(this_arg);
13494         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
13495         LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)this_arg_ptr;
13496         LDKPublicKey their_node_id_ref;
13497         CHECK(their_node_id->arr_len == 33);
13498         memcpy(their_node_id_ref.compressed_form, their_node_id->elems, 33); FREE(their_node_id);
13499         LDKInit msg_conv;
13500         msg_conv.inner = untag_ptr(msg);
13501         msg_conv.is_owned = ptr_is_owned(msg);
13502         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
13503         msg_conv.is_owned = false;
13504         LDKCResult_NoneNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneNoneZ), "LDKCResult_NoneNoneZ");
13505         *ret_conv = (this_arg_conv->peer_connected)(this_arg_conv->this_arg, their_node_id_ref, &msg_conv, inbound);
13506         return tag_ptr(ret_conv, true);
13507 }
13508
13509 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) {
13510         void* this_arg_ptr = untag_ptr(this_arg);
13511         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
13512         LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)this_arg_ptr;
13513         LDKPublicKey their_node_id_ref;
13514         CHECK(their_node_id->arr_len == 33);
13515         memcpy(their_node_id_ref.compressed_form, their_node_id->elems, 33); FREE(their_node_id);
13516         LDKChannelReestablish msg_conv;
13517         msg_conv.inner = untag_ptr(msg);
13518         msg_conv.is_owned = ptr_is_owned(msg);
13519         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
13520         msg_conv.is_owned = false;
13521         (this_arg_conv->handle_channel_reestablish)(this_arg_conv->this_arg, their_node_id_ref, &msg_conv);
13522 }
13523
13524 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) {
13525         void* this_arg_ptr = untag_ptr(this_arg);
13526         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
13527         LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)this_arg_ptr;
13528         LDKPublicKey their_node_id_ref;
13529         CHECK(their_node_id->arr_len == 33);
13530         memcpy(their_node_id_ref.compressed_form, their_node_id->elems, 33); FREE(their_node_id);
13531         LDKChannelUpdate msg_conv;
13532         msg_conv.inner = untag_ptr(msg);
13533         msg_conv.is_owned = ptr_is_owned(msg);
13534         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
13535         msg_conv.is_owned = false;
13536         (this_arg_conv->handle_channel_update)(this_arg_conv->this_arg, their_node_id_ref, &msg_conv);
13537 }
13538
13539 void  __attribute__((export_name("TS_ChannelMessageHandler_handle_error"))) TS_ChannelMessageHandler_handle_error(uint64_t this_arg, int8_tArray their_node_id, uint64_t msg) {
13540         void* this_arg_ptr = untag_ptr(this_arg);
13541         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
13542         LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)this_arg_ptr;
13543         LDKPublicKey their_node_id_ref;
13544         CHECK(their_node_id->arr_len == 33);
13545         memcpy(their_node_id_ref.compressed_form, their_node_id->elems, 33); FREE(their_node_id);
13546         LDKErrorMessage msg_conv;
13547         msg_conv.inner = untag_ptr(msg);
13548         msg_conv.is_owned = ptr_is_owned(msg);
13549         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
13550         msg_conv.is_owned = false;
13551         (this_arg_conv->handle_error)(this_arg_conv->this_arg, their_node_id_ref, &msg_conv);
13552 }
13553
13554 uint64_t  __attribute__((export_name("TS_ChannelMessageHandler_provided_node_features"))) TS_ChannelMessageHandler_provided_node_features(uint64_t this_arg) {
13555         void* this_arg_ptr = untag_ptr(this_arg);
13556         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
13557         LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)this_arg_ptr;
13558         LDKNodeFeatures ret_var = (this_arg_conv->provided_node_features)(this_arg_conv->this_arg);
13559         uint64_t ret_ref = 0;
13560         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
13561         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
13562         return ret_ref;
13563 }
13564
13565 uint64_t  __attribute__((export_name("TS_ChannelMessageHandler_provided_init_features"))) TS_ChannelMessageHandler_provided_init_features(uint64_t this_arg, int8_tArray their_node_id) {
13566         void* this_arg_ptr = untag_ptr(this_arg);
13567         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
13568         LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)this_arg_ptr;
13569         LDKPublicKey their_node_id_ref;
13570         CHECK(their_node_id->arr_len == 33);
13571         memcpy(their_node_id_ref.compressed_form, their_node_id->elems, 33); FREE(their_node_id);
13572         LDKInitFeatures ret_var = (this_arg_conv->provided_init_features)(this_arg_conv->this_arg, their_node_id_ref);
13573         uint64_t ret_ref = 0;
13574         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
13575         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
13576         return ret_ref;
13577 }
13578
13579 uint64_t  __attribute__((export_name("TS_ChannelMessageHandler_get_chain_hashes"))) TS_ChannelMessageHandler_get_chain_hashes(uint64_t this_arg) {
13580         void* this_arg_ptr = untag_ptr(this_arg);
13581         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
13582         LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)this_arg_ptr;
13583         LDKCOption_CVec_ThirtyTwoBytesZZ *ret_copy = MALLOC(sizeof(LDKCOption_CVec_ThirtyTwoBytesZZ), "LDKCOption_CVec_ThirtyTwoBytesZZ");
13584         *ret_copy = (this_arg_conv->get_chain_hashes)(this_arg_conv->this_arg);
13585         uint64_t ret_ref = tag_ptr(ret_copy, true);
13586         return ret_ref;
13587 }
13588
13589 typedef struct LDKOffersMessageHandler_JCalls {
13590         atomic_size_t refcnt;
13591         uint32_t instance_ptr;
13592 } LDKOffersMessageHandler_JCalls;
13593 static void LDKOffersMessageHandler_JCalls_free(void* this_arg) {
13594         LDKOffersMessageHandler_JCalls *j_calls = (LDKOffersMessageHandler_JCalls*) this_arg;
13595         if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
13596                 FREE(j_calls);
13597         }
13598 }
13599 LDKCOption_OffersMessageZ handle_message_LDKOffersMessageHandler_jcall(const void* this_arg, LDKOffersMessage message) {
13600         LDKOffersMessageHandler_JCalls *j_calls = (LDKOffersMessageHandler_JCalls*) this_arg;
13601         LDKOffersMessage *message_copy = MALLOC(sizeof(LDKOffersMessage), "LDKOffersMessage");
13602         *message_copy = message;
13603         uint64_t message_ref = tag_ptr(message_copy, true);
13604         uint64_t ret = js_invoke_function_buuuuu(j_calls->instance_ptr, 107, message_ref, 0, 0, 0, 0, 0);
13605         void* ret_ptr = untag_ptr(ret);
13606         CHECK_ACCESS(ret_ptr);
13607         LDKCOption_OffersMessageZ ret_conv = *(LDKCOption_OffersMessageZ*)(ret_ptr);
13608         FREE(untag_ptr(ret));
13609         return ret_conv;
13610 }
13611 LDKCVec_C3Tuple_OffersMessageDestinationBlindedPathZZ release_pending_messages_LDKOffersMessageHandler_jcall(const void* this_arg) {
13612         LDKOffersMessageHandler_JCalls *j_calls = (LDKOffersMessageHandler_JCalls*) this_arg;
13613         uint64_tArray ret = (uint64_tArray)js_invoke_function_uuuuuu(j_calls->instance_ptr, 108, 0, 0, 0, 0, 0, 0);
13614         LDKCVec_C3Tuple_OffersMessageDestinationBlindedPathZZ ret_constr;
13615         ret_constr.datalen = ret->arr_len;
13616         if (ret_constr.datalen > 0)
13617                 ret_constr.data = MALLOC(ret_constr.datalen * sizeof(LDKC3Tuple_OffersMessageDestinationBlindedPathZ), "LDKCVec_C3Tuple_OffersMessageDestinationBlindedPathZZ Elements");
13618         else
13619                 ret_constr.data = NULL;
13620         uint64_t* ret_vals = ret->elems;
13621         for (size_t x = 0; x < ret_constr.datalen; x++) {
13622                 uint64_t ret_conv_49 = ret_vals[x];
13623                 void* ret_conv_49_ptr = untag_ptr(ret_conv_49);
13624                 CHECK_ACCESS(ret_conv_49_ptr);
13625                 LDKC3Tuple_OffersMessageDestinationBlindedPathZ ret_conv_49_conv = *(LDKC3Tuple_OffersMessageDestinationBlindedPathZ*)(ret_conv_49_ptr);
13626                 FREE(untag_ptr(ret_conv_49));
13627                 ret_constr.data[x] = ret_conv_49_conv;
13628         }
13629         FREE(ret);
13630         return ret_constr;
13631 }
13632 static void LDKOffersMessageHandler_JCalls_cloned(LDKOffersMessageHandler* new_obj) {
13633         LDKOffersMessageHandler_JCalls *j_calls = (LDKOffersMessageHandler_JCalls*) new_obj->this_arg;
13634         atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
13635 }
13636 static inline LDKOffersMessageHandler LDKOffersMessageHandler_init (JSValue o) {
13637         LDKOffersMessageHandler_JCalls *calls = MALLOC(sizeof(LDKOffersMessageHandler_JCalls), "LDKOffersMessageHandler_JCalls");
13638         atomic_init(&calls->refcnt, 1);
13639         calls->instance_ptr = o;
13640
13641         LDKOffersMessageHandler ret = {
13642                 .this_arg = (void*) calls,
13643                 .handle_message = handle_message_LDKOffersMessageHandler_jcall,
13644                 .release_pending_messages = release_pending_messages_LDKOffersMessageHandler_jcall,
13645                 .free = LDKOffersMessageHandler_JCalls_free,
13646         };
13647         return ret;
13648 }
13649 uint64_t  __attribute__((export_name("TS_LDKOffersMessageHandler_new"))) TS_LDKOffersMessageHandler_new(JSValue o) {
13650         LDKOffersMessageHandler *res_ptr = MALLOC(sizeof(LDKOffersMessageHandler), "LDKOffersMessageHandler");
13651         *res_ptr = LDKOffersMessageHandler_init(o);
13652         return tag_ptr(res_ptr, true);
13653 }
13654 uint64_t  __attribute__((export_name("TS_OffersMessageHandler_handle_message"))) TS_OffersMessageHandler_handle_message(uint64_t this_arg, uint64_t message) {
13655         void* this_arg_ptr = untag_ptr(this_arg);
13656         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
13657         LDKOffersMessageHandler* this_arg_conv = (LDKOffersMessageHandler*)this_arg_ptr;
13658         void* message_ptr = untag_ptr(message);
13659         CHECK_ACCESS(message_ptr);
13660         LDKOffersMessage message_conv = *(LDKOffersMessage*)(message_ptr);
13661         message_conv = OffersMessage_clone((LDKOffersMessage*)untag_ptr(message));
13662         LDKCOption_OffersMessageZ *ret_copy = MALLOC(sizeof(LDKCOption_OffersMessageZ), "LDKCOption_OffersMessageZ");
13663         *ret_copy = (this_arg_conv->handle_message)(this_arg_conv->this_arg, message_conv);
13664         uint64_t ret_ref = tag_ptr(ret_copy, true);
13665         return ret_ref;
13666 }
13667
13668 uint64_tArray  __attribute__((export_name("TS_OffersMessageHandler_release_pending_messages"))) TS_OffersMessageHandler_release_pending_messages(uint64_t this_arg) {
13669         void* this_arg_ptr = untag_ptr(this_arg);
13670         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
13671         LDKOffersMessageHandler* this_arg_conv = (LDKOffersMessageHandler*)this_arg_ptr;
13672         LDKCVec_C3Tuple_OffersMessageDestinationBlindedPathZZ ret_var = (this_arg_conv->release_pending_messages)(this_arg_conv->this_arg);
13673         uint64_tArray ret_arr = NULL;
13674         ret_arr = init_uint64_tArray(ret_var.datalen, __LINE__);
13675         uint64_t *ret_arr_ptr = (uint64_t*)(((uint8_t*)ret_arr) + 8);
13676         for (size_t x = 0; x < ret_var.datalen; x++) {
13677                 LDKC3Tuple_OffersMessageDestinationBlindedPathZ* ret_conv_49_conv = MALLOC(sizeof(LDKC3Tuple_OffersMessageDestinationBlindedPathZ), "LDKC3Tuple_OffersMessageDestinationBlindedPathZ");
13678                 *ret_conv_49_conv = ret_var.data[x];
13679                 ret_arr_ptr[x] = tag_ptr(ret_conv_49_conv, true);
13680         }
13681         
13682         FREE(ret_var.data);
13683         return ret_arr;
13684 }
13685
13686 typedef struct LDKRoutingMessageHandler_JCalls {
13687         atomic_size_t refcnt;
13688         uint32_t instance_ptr;
13689         LDKMessageSendEventsProvider_JCalls* MessageSendEventsProvider;
13690 } LDKRoutingMessageHandler_JCalls;
13691 static void LDKRoutingMessageHandler_JCalls_free(void* this_arg) {
13692         LDKRoutingMessageHandler_JCalls *j_calls = (LDKRoutingMessageHandler_JCalls*) this_arg;
13693         if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
13694                 FREE(j_calls);
13695         }
13696 }
13697 LDKCResult_boolLightningErrorZ handle_node_announcement_LDKRoutingMessageHandler_jcall(const void* this_arg, const LDKNodeAnnouncement * msg) {
13698         LDKRoutingMessageHandler_JCalls *j_calls = (LDKRoutingMessageHandler_JCalls*) this_arg;
13699         LDKNodeAnnouncement msg_var = *msg;
13700         uint64_t msg_ref = 0;
13701         msg_var = NodeAnnouncement_clone(&msg_var);
13702         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
13703         msg_ref = tag_ptr(msg_var.inner, msg_var.is_owned);
13704         uint64_t ret = js_invoke_function_buuuuu(j_calls->instance_ptr, 109, msg_ref, 0, 0, 0, 0, 0);
13705         void* ret_ptr = untag_ptr(ret);
13706         CHECK_ACCESS(ret_ptr);
13707         LDKCResult_boolLightningErrorZ ret_conv = *(LDKCResult_boolLightningErrorZ*)(ret_ptr);
13708         FREE(untag_ptr(ret));
13709         return ret_conv;
13710 }
13711 LDKCResult_boolLightningErrorZ handle_channel_announcement_LDKRoutingMessageHandler_jcall(const void* this_arg, const LDKChannelAnnouncement * msg) {
13712         LDKRoutingMessageHandler_JCalls *j_calls = (LDKRoutingMessageHandler_JCalls*) this_arg;
13713         LDKChannelAnnouncement msg_var = *msg;
13714         uint64_t msg_ref = 0;
13715         msg_var = ChannelAnnouncement_clone(&msg_var);
13716         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
13717         msg_ref = tag_ptr(msg_var.inner, msg_var.is_owned);
13718         uint64_t ret = js_invoke_function_buuuuu(j_calls->instance_ptr, 110, msg_ref, 0, 0, 0, 0, 0);
13719         void* ret_ptr = untag_ptr(ret);
13720         CHECK_ACCESS(ret_ptr);
13721         LDKCResult_boolLightningErrorZ ret_conv = *(LDKCResult_boolLightningErrorZ*)(ret_ptr);
13722         FREE(untag_ptr(ret));
13723         return ret_conv;
13724 }
13725 LDKCResult_boolLightningErrorZ handle_channel_update_LDKRoutingMessageHandler_jcall(const void* this_arg, const LDKChannelUpdate * msg) {
13726         LDKRoutingMessageHandler_JCalls *j_calls = (LDKRoutingMessageHandler_JCalls*) this_arg;
13727         LDKChannelUpdate msg_var = *msg;
13728         uint64_t msg_ref = 0;
13729         msg_var = ChannelUpdate_clone(&msg_var);
13730         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
13731         msg_ref = tag_ptr(msg_var.inner, msg_var.is_owned);
13732         uint64_t ret = js_invoke_function_buuuuu(j_calls->instance_ptr, 111, msg_ref, 0, 0, 0, 0, 0);
13733         void* ret_ptr = untag_ptr(ret);
13734         CHECK_ACCESS(ret_ptr);
13735         LDKCResult_boolLightningErrorZ ret_conv = *(LDKCResult_boolLightningErrorZ*)(ret_ptr);
13736         FREE(untag_ptr(ret));
13737         return ret_conv;
13738 }
13739 LDKCOption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ get_next_channel_announcement_LDKRoutingMessageHandler_jcall(const void* this_arg, uint64_t starting_point) {
13740         LDKRoutingMessageHandler_JCalls *j_calls = (LDKRoutingMessageHandler_JCalls*) this_arg;
13741         int64_t starting_point_conv = starting_point;
13742         uint64_t ret = js_invoke_function_buuuuu(j_calls->instance_ptr, 112, starting_point_conv, 0, 0, 0, 0, 0);
13743         void* ret_ptr = untag_ptr(ret);
13744         CHECK_ACCESS(ret_ptr);
13745         LDKCOption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ ret_conv = *(LDKCOption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ*)(ret_ptr);
13746         FREE(untag_ptr(ret));
13747         return ret_conv;
13748 }
13749 LDKNodeAnnouncement get_next_node_announcement_LDKRoutingMessageHandler_jcall(const void* this_arg, LDKNodeId starting_point) {
13750         LDKRoutingMessageHandler_JCalls *j_calls = (LDKRoutingMessageHandler_JCalls*) this_arg;
13751         LDKNodeId starting_point_var = starting_point;
13752         uint64_t starting_point_ref = 0;
13753         CHECK_INNER_FIELD_ACCESS_OR_NULL(starting_point_var);
13754         starting_point_ref = tag_ptr(starting_point_var.inner, starting_point_var.is_owned);
13755         uint64_t ret = js_invoke_function_buuuuu(j_calls->instance_ptr, 113, starting_point_ref, 0, 0, 0, 0, 0);
13756         LDKNodeAnnouncement ret_conv;
13757         ret_conv.inner = untag_ptr(ret);
13758         ret_conv.is_owned = ptr_is_owned(ret);
13759         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_conv);
13760         return ret_conv;
13761 }
13762 LDKCResult_NoneNoneZ peer_connected_LDKRoutingMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKInit * init, bool inbound) {
13763         LDKRoutingMessageHandler_JCalls *j_calls = (LDKRoutingMessageHandler_JCalls*) this_arg;
13764         int8_tArray their_node_id_arr = init_int8_tArray(33, __LINE__);
13765         memcpy(their_node_id_arr->elems, their_node_id.compressed_form, 33);
13766         LDKInit init_var = *init;
13767         uint64_t init_ref = 0;
13768         init_var = Init_clone(&init_var);
13769         CHECK_INNER_FIELD_ACCESS_OR_NULL(init_var);
13770         init_ref = tag_ptr(init_var.inner, init_var.is_owned);
13771         jboolean inbound_conv = inbound;
13772         uint64_t ret = js_invoke_function_ubuuuu(j_calls->instance_ptr, 114, (uint32_t)their_node_id_arr, init_ref, inbound_conv, 0, 0, 0);
13773         void* ret_ptr = untag_ptr(ret);
13774         CHECK_ACCESS(ret_ptr);
13775         LDKCResult_NoneNoneZ ret_conv = *(LDKCResult_NoneNoneZ*)(ret_ptr);
13776         FREE(untag_ptr(ret));
13777         return ret_conv;
13778 }
13779 LDKCResult_NoneLightningErrorZ handle_reply_channel_range_LDKRoutingMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, LDKReplyChannelRange msg) {
13780         LDKRoutingMessageHandler_JCalls *j_calls = (LDKRoutingMessageHandler_JCalls*) this_arg;
13781         int8_tArray their_node_id_arr = init_int8_tArray(33, __LINE__);
13782         memcpy(their_node_id_arr->elems, their_node_id.compressed_form, 33);
13783         LDKReplyChannelRange msg_var = msg;
13784         uint64_t msg_ref = 0;
13785         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
13786         msg_ref = tag_ptr(msg_var.inner, msg_var.is_owned);
13787         uint64_t ret = js_invoke_function_ubuuuu(j_calls->instance_ptr, 115, (uint32_t)their_node_id_arr, msg_ref, 0, 0, 0, 0);
13788         void* ret_ptr = untag_ptr(ret);
13789         CHECK_ACCESS(ret_ptr);
13790         LDKCResult_NoneLightningErrorZ ret_conv = *(LDKCResult_NoneLightningErrorZ*)(ret_ptr);
13791         FREE(untag_ptr(ret));
13792         return ret_conv;
13793 }
13794 LDKCResult_NoneLightningErrorZ handle_reply_short_channel_ids_end_LDKRoutingMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, LDKReplyShortChannelIdsEnd msg) {
13795         LDKRoutingMessageHandler_JCalls *j_calls = (LDKRoutingMessageHandler_JCalls*) this_arg;
13796         int8_tArray their_node_id_arr = init_int8_tArray(33, __LINE__);
13797         memcpy(their_node_id_arr->elems, their_node_id.compressed_form, 33);
13798         LDKReplyShortChannelIdsEnd msg_var = msg;
13799         uint64_t msg_ref = 0;
13800         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
13801         msg_ref = tag_ptr(msg_var.inner, msg_var.is_owned);
13802         uint64_t ret = js_invoke_function_ubuuuu(j_calls->instance_ptr, 116, (uint32_t)their_node_id_arr, msg_ref, 0, 0, 0, 0);
13803         void* ret_ptr = untag_ptr(ret);
13804         CHECK_ACCESS(ret_ptr);
13805         LDKCResult_NoneLightningErrorZ ret_conv = *(LDKCResult_NoneLightningErrorZ*)(ret_ptr);
13806         FREE(untag_ptr(ret));
13807         return ret_conv;
13808 }
13809 LDKCResult_NoneLightningErrorZ handle_query_channel_range_LDKRoutingMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, LDKQueryChannelRange msg) {
13810         LDKRoutingMessageHandler_JCalls *j_calls = (LDKRoutingMessageHandler_JCalls*) this_arg;
13811         int8_tArray their_node_id_arr = init_int8_tArray(33, __LINE__);
13812         memcpy(their_node_id_arr->elems, their_node_id.compressed_form, 33);
13813         LDKQueryChannelRange msg_var = msg;
13814         uint64_t msg_ref = 0;
13815         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
13816         msg_ref = tag_ptr(msg_var.inner, msg_var.is_owned);
13817         uint64_t ret = js_invoke_function_ubuuuu(j_calls->instance_ptr, 117, (uint32_t)their_node_id_arr, msg_ref, 0, 0, 0, 0);
13818         void* ret_ptr = untag_ptr(ret);
13819         CHECK_ACCESS(ret_ptr);
13820         LDKCResult_NoneLightningErrorZ ret_conv = *(LDKCResult_NoneLightningErrorZ*)(ret_ptr);
13821         FREE(untag_ptr(ret));
13822         return ret_conv;
13823 }
13824 LDKCResult_NoneLightningErrorZ handle_query_short_channel_ids_LDKRoutingMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, LDKQueryShortChannelIds msg) {
13825         LDKRoutingMessageHandler_JCalls *j_calls = (LDKRoutingMessageHandler_JCalls*) this_arg;
13826         int8_tArray their_node_id_arr = init_int8_tArray(33, __LINE__);
13827         memcpy(their_node_id_arr->elems, their_node_id.compressed_form, 33);
13828         LDKQueryShortChannelIds msg_var = msg;
13829         uint64_t msg_ref = 0;
13830         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
13831         msg_ref = tag_ptr(msg_var.inner, msg_var.is_owned);
13832         uint64_t ret = js_invoke_function_ubuuuu(j_calls->instance_ptr, 118, (uint32_t)their_node_id_arr, msg_ref, 0, 0, 0, 0);
13833         void* ret_ptr = untag_ptr(ret);
13834         CHECK_ACCESS(ret_ptr);
13835         LDKCResult_NoneLightningErrorZ ret_conv = *(LDKCResult_NoneLightningErrorZ*)(ret_ptr);
13836         FREE(untag_ptr(ret));
13837         return ret_conv;
13838 }
13839 bool processing_queue_high_LDKRoutingMessageHandler_jcall(const void* this_arg) {
13840         LDKRoutingMessageHandler_JCalls *j_calls = (LDKRoutingMessageHandler_JCalls*) this_arg;
13841         return js_invoke_function_uuuuuu(j_calls->instance_ptr, 119, 0, 0, 0, 0, 0, 0);
13842 }
13843 LDKNodeFeatures provided_node_features_LDKRoutingMessageHandler_jcall(const void* this_arg) {
13844         LDKRoutingMessageHandler_JCalls *j_calls = (LDKRoutingMessageHandler_JCalls*) this_arg;
13845         uint64_t ret = js_invoke_function_uuuuuu(j_calls->instance_ptr, 120, 0, 0, 0, 0, 0, 0);
13846         LDKNodeFeatures ret_conv;
13847         ret_conv.inner = untag_ptr(ret);
13848         ret_conv.is_owned = ptr_is_owned(ret);
13849         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_conv);
13850         return ret_conv;
13851 }
13852 LDKInitFeatures provided_init_features_LDKRoutingMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id) {
13853         LDKRoutingMessageHandler_JCalls *j_calls = (LDKRoutingMessageHandler_JCalls*) this_arg;
13854         int8_tArray their_node_id_arr = init_int8_tArray(33, __LINE__);
13855         memcpy(their_node_id_arr->elems, their_node_id.compressed_form, 33);
13856         uint64_t ret = js_invoke_function_uuuuuu(j_calls->instance_ptr, 121, (uint32_t)their_node_id_arr, 0, 0, 0, 0, 0);
13857         LDKInitFeatures ret_conv;
13858         ret_conv.inner = untag_ptr(ret);
13859         ret_conv.is_owned = ptr_is_owned(ret);
13860         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_conv);
13861         return ret_conv;
13862 }
13863 static void LDKRoutingMessageHandler_JCalls_cloned(LDKRoutingMessageHandler* new_obj) {
13864         LDKRoutingMessageHandler_JCalls *j_calls = (LDKRoutingMessageHandler_JCalls*) new_obj->this_arg;
13865         atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
13866         atomic_fetch_add_explicit(&j_calls->MessageSendEventsProvider->refcnt, 1, memory_order_release);
13867 }
13868 static inline LDKRoutingMessageHandler LDKRoutingMessageHandler_init (JSValue o, JSValue MessageSendEventsProvider) {
13869         LDKRoutingMessageHandler_JCalls *calls = MALLOC(sizeof(LDKRoutingMessageHandler_JCalls), "LDKRoutingMessageHandler_JCalls");
13870         atomic_init(&calls->refcnt, 1);
13871         calls->instance_ptr = o;
13872
13873         LDKRoutingMessageHandler ret = {
13874                 .this_arg = (void*) calls,
13875                 .handle_node_announcement = handle_node_announcement_LDKRoutingMessageHandler_jcall,
13876                 .handle_channel_announcement = handle_channel_announcement_LDKRoutingMessageHandler_jcall,
13877                 .handle_channel_update = handle_channel_update_LDKRoutingMessageHandler_jcall,
13878                 .get_next_channel_announcement = get_next_channel_announcement_LDKRoutingMessageHandler_jcall,
13879                 .get_next_node_announcement = get_next_node_announcement_LDKRoutingMessageHandler_jcall,
13880                 .peer_connected = peer_connected_LDKRoutingMessageHandler_jcall,
13881                 .handle_reply_channel_range = handle_reply_channel_range_LDKRoutingMessageHandler_jcall,
13882                 .handle_reply_short_channel_ids_end = handle_reply_short_channel_ids_end_LDKRoutingMessageHandler_jcall,
13883                 .handle_query_channel_range = handle_query_channel_range_LDKRoutingMessageHandler_jcall,
13884                 .handle_query_short_channel_ids = handle_query_short_channel_ids_LDKRoutingMessageHandler_jcall,
13885                 .processing_queue_high = processing_queue_high_LDKRoutingMessageHandler_jcall,
13886                 .provided_node_features = provided_node_features_LDKRoutingMessageHandler_jcall,
13887                 .provided_init_features = provided_init_features_LDKRoutingMessageHandler_jcall,
13888                 .free = LDKRoutingMessageHandler_JCalls_free,
13889                 .MessageSendEventsProvider = LDKMessageSendEventsProvider_init(MessageSendEventsProvider),
13890         };
13891         calls->MessageSendEventsProvider = ret.MessageSendEventsProvider.this_arg;
13892         return ret;
13893 }
13894 uint64_t  __attribute__((export_name("TS_LDKRoutingMessageHandler_new"))) TS_LDKRoutingMessageHandler_new(JSValue o, JSValue MessageSendEventsProvider) {
13895         LDKRoutingMessageHandler *res_ptr = MALLOC(sizeof(LDKRoutingMessageHandler), "LDKRoutingMessageHandler");
13896         *res_ptr = LDKRoutingMessageHandler_init(o, MessageSendEventsProvider);
13897         return tag_ptr(res_ptr, true);
13898 }
13899 uint64_t  __attribute__((export_name("TS_RoutingMessageHandler_handle_node_announcement"))) TS_RoutingMessageHandler_handle_node_announcement(uint64_t this_arg, uint64_t msg) {
13900         void* this_arg_ptr = untag_ptr(this_arg);
13901         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
13902         LDKRoutingMessageHandler* this_arg_conv = (LDKRoutingMessageHandler*)this_arg_ptr;
13903         LDKNodeAnnouncement msg_conv;
13904         msg_conv.inner = untag_ptr(msg);
13905         msg_conv.is_owned = ptr_is_owned(msg);
13906         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
13907         msg_conv.is_owned = false;
13908         LDKCResult_boolLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_boolLightningErrorZ), "LDKCResult_boolLightningErrorZ");
13909         *ret_conv = (this_arg_conv->handle_node_announcement)(this_arg_conv->this_arg, &msg_conv);
13910         return tag_ptr(ret_conv, true);
13911 }
13912
13913 uint64_t  __attribute__((export_name("TS_RoutingMessageHandler_handle_channel_announcement"))) TS_RoutingMessageHandler_handle_channel_announcement(uint64_t this_arg, uint64_t msg) {
13914         void* this_arg_ptr = untag_ptr(this_arg);
13915         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
13916         LDKRoutingMessageHandler* this_arg_conv = (LDKRoutingMessageHandler*)this_arg_ptr;
13917         LDKChannelAnnouncement msg_conv;
13918         msg_conv.inner = untag_ptr(msg);
13919         msg_conv.is_owned = ptr_is_owned(msg);
13920         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
13921         msg_conv.is_owned = false;
13922         LDKCResult_boolLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_boolLightningErrorZ), "LDKCResult_boolLightningErrorZ");
13923         *ret_conv = (this_arg_conv->handle_channel_announcement)(this_arg_conv->this_arg, &msg_conv);
13924         return tag_ptr(ret_conv, true);
13925 }
13926
13927 uint64_t  __attribute__((export_name("TS_RoutingMessageHandler_handle_channel_update"))) TS_RoutingMessageHandler_handle_channel_update(uint64_t this_arg, uint64_t msg) {
13928         void* this_arg_ptr = untag_ptr(this_arg);
13929         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
13930         LDKRoutingMessageHandler* this_arg_conv = (LDKRoutingMessageHandler*)this_arg_ptr;
13931         LDKChannelUpdate msg_conv;
13932         msg_conv.inner = untag_ptr(msg);
13933         msg_conv.is_owned = ptr_is_owned(msg);
13934         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
13935         msg_conv.is_owned = false;
13936         LDKCResult_boolLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_boolLightningErrorZ), "LDKCResult_boolLightningErrorZ");
13937         *ret_conv = (this_arg_conv->handle_channel_update)(this_arg_conv->this_arg, &msg_conv);
13938         return tag_ptr(ret_conv, true);
13939 }
13940
13941 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) {
13942         void* this_arg_ptr = untag_ptr(this_arg);
13943         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
13944         LDKRoutingMessageHandler* this_arg_conv = (LDKRoutingMessageHandler*)this_arg_ptr;
13945         LDKCOption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ *ret_copy = MALLOC(sizeof(LDKCOption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ), "LDKCOption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ");
13946         *ret_copy = (this_arg_conv->get_next_channel_announcement)(this_arg_conv->this_arg, starting_point);
13947         uint64_t ret_ref = tag_ptr(ret_copy, true);
13948         return ret_ref;
13949 }
13950
13951 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) {
13952         void* this_arg_ptr = untag_ptr(this_arg);
13953         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
13954         LDKRoutingMessageHandler* this_arg_conv = (LDKRoutingMessageHandler*)this_arg_ptr;
13955         LDKNodeId starting_point_conv;
13956         starting_point_conv.inner = untag_ptr(starting_point);
13957         starting_point_conv.is_owned = ptr_is_owned(starting_point);
13958         CHECK_INNER_FIELD_ACCESS_OR_NULL(starting_point_conv);
13959         starting_point_conv = NodeId_clone(&starting_point_conv);
13960         LDKNodeAnnouncement ret_var = (this_arg_conv->get_next_node_announcement)(this_arg_conv->this_arg, starting_point_conv);
13961         uint64_t ret_ref = 0;
13962         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
13963         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
13964         return ret_ref;
13965 }
13966
13967 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) {
13968         void* this_arg_ptr = untag_ptr(this_arg);
13969         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
13970         LDKRoutingMessageHandler* this_arg_conv = (LDKRoutingMessageHandler*)this_arg_ptr;
13971         LDKPublicKey their_node_id_ref;
13972         CHECK(their_node_id->arr_len == 33);
13973         memcpy(their_node_id_ref.compressed_form, their_node_id->elems, 33); FREE(their_node_id);
13974         LDKInit init_conv;
13975         init_conv.inner = untag_ptr(init);
13976         init_conv.is_owned = ptr_is_owned(init);
13977         CHECK_INNER_FIELD_ACCESS_OR_NULL(init_conv);
13978         init_conv.is_owned = false;
13979         LDKCResult_NoneNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneNoneZ), "LDKCResult_NoneNoneZ");
13980         *ret_conv = (this_arg_conv->peer_connected)(this_arg_conv->this_arg, their_node_id_ref, &init_conv, inbound);
13981         return tag_ptr(ret_conv, true);
13982 }
13983
13984 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) {
13985         void* this_arg_ptr = untag_ptr(this_arg);
13986         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
13987         LDKRoutingMessageHandler* this_arg_conv = (LDKRoutingMessageHandler*)this_arg_ptr;
13988         LDKPublicKey their_node_id_ref;
13989         CHECK(their_node_id->arr_len == 33);
13990         memcpy(their_node_id_ref.compressed_form, their_node_id->elems, 33); FREE(their_node_id);
13991         LDKReplyChannelRange msg_conv;
13992         msg_conv.inner = untag_ptr(msg);
13993         msg_conv.is_owned = ptr_is_owned(msg);
13994         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
13995         msg_conv = ReplyChannelRange_clone(&msg_conv);
13996         LDKCResult_NoneLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneLightningErrorZ), "LDKCResult_NoneLightningErrorZ");
13997         *ret_conv = (this_arg_conv->handle_reply_channel_range)(this_arg_conv->this_arg, their_node_id_ref, msg_conv);
13998         return tag_ptr(ret_conv, true);
13999 }
14000
14001 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) {
14002         void* this_arg_ptr = untag_ptr(this_arg);
14003         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
14004         LDKRoutingMessageHandler* this_arg_conv = (LDKRoutingMessageHandler*)this_arg_ptr;
14005         LDKPublicKey their_node_id_ref;
14006         CHECK(their_node_id->arr_len == 33);
14007         memcpy(their_node_id_ref.compressed_form, their_node_id->elems, 33); FREE(their_node_id);
14008         LDKReplyShortChannelIdsEnd msg_conv;
14009         msg_conv.inner = untag_ptr(msg);
14010         msg_conv.is_owned = ptr_is_owned(msg);
14011         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
14012         msg_conv = ReplyShortChannelIdsEnd_clone(&msg_conv);
14013         LDKCResult_NoneLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneLightningErrorZ), "LDKCResult_NoneLightningErrorZ");
14014         *ret_conv = (this_arg_conv->handle_reply_short_channel_ids_end)(this_arg_conv->this_arg, their_node_id_ref, msg_conv);
14015         return tag_ptr(ret_conv, true);
14016 }
14017
14018 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) {
14019         void* this_arg_ptr = untag_ptr(this_arg);
14020         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
14021         LDKRoutingMessageHandler* this_arg_conv = (LDKRoutingMessageHandler*)this_arg_ptr;
14022         LDKPublicKey their_node_id_ref;
14023         CHECK(their_node_id->arr_len == 33);
14024         memcpy(their_node_id_ref.compressed_form, their_node_id->elems, 33); FREE(their_node_id);
14025         LDKQueryChannelRange msg_conv;
14026         msg_conv.inner = untag_ptr(msg);
14027         msg_conv.is_owned = ptr_is_owned(msg);
14028         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
14029         msg_conv = QueryChannelRange_clone(&msg_conv);
14030         LDKCResult_NoneLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneLightningErrorZ), "LDKCResult_NoneLightningErrorZ");
14031         *ret_conv = (this_arg_conv->handle_query_channel_range)(this_arg_conv->this_arg, their_node_id_ref, msg_conv);
14032         return tag_ptr(ret_conv, true);
14033 }
14034
14035 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) {
14036         void* this_arg_ptr = untag_ptr(this_arg);
14037         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
14038         LDKRoutingMessageHandler* this_arg_conv = (LDKRoutingMessageHandler*)this_arg_ptr;
14039         LDKPublicKey their_node_id_ref;
14040         CHECK(their_node_id->arr_len == 33);
14041         memcpy(their_node_id_ref.compressed_form, their_node_id->elems, 33); FREE(their_node_id);
14042         LDKQueryShortChannelIds msg_conv;
14043         msg_conv.inner = untag_ptr(msg);
14044         msg_conv.is_owned = ptr_is_owned(msg);
14045         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
14046         msg_conv = QueryShortChannelIds_clone(&msg_conv);
14047         LDKCResult_NoneLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneLightningErrorZ), "LDKCResult_NoneLightningErrorZ");
14048         *ret_conv = (this_arg_conv->handle_query_short_channel_ids)(this_arg_conv->this_arg, their_node_id_ref, msg_conv);
14049         return tag_ptr(ret_conv, true);
14050 }
14051
14052 jboolean  __attribute__((export_name("TS_RoutingMessageHandler_processing_queue_high"))) TS_RoutingMessageHandler_processing_queue_high(uint64_t this_arg) {
14053         void* this_arg_ptr = untag_ptr(this_arg);
14054         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
14055         LDKRoutingMessageHandler* this_arg_conv = (LDKRoutingMessageHandler*)this_arg_ptr;
14056         jboolean ret_conv = (this_arg_conv->processing_queue_high)(this_arg_conv->this_arg);
14057         return ret_conv;
14058 }
14059
14060 uint64_t  __attribute__((export_name("TS_RoutingMessageHandler_provided_node_features"))) TS_RoutingMessageHandler_provided_node_features(uint64_t this_arg) {
14061         void* this_arg_ptr = untag_ptr(this_arg);
14062         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
14063         LDKRoutingMessageHandler* this_arg_conv = (LDKRoutingMessageHandler*)this_arg_ptr;
14064         LDKNodeFeatures ret_var = (this_arg_conv->provided_node_features)(this_arg_conv->this_arg);
14065         uint64_t ret_ref = 0;
14066         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
14067         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
14068         return ret_ref;
14069 }
14070
14071 uint64_t  __attribute__((export_name("TS_RoutingMessageHandler_provided_init_features"))) TS_RoutingMessageHandler_provided_init_features(uint64_t this_arg, int8_tArray their_node_id) {
14072         void* this_arg_ptr = untag_ptr(this_arg);
14073         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
14074         LDKRoutingMessageHandler* this_arg_conv = (LDKRoutingMessageHandler*)this_arg_ptr;
14075         LDKPublicKey their_node_id_ref;
14076         CHECK(their_node_id->arr_len == 33);
14077         memcpy(their_node_id_ref.compressed_form, their_node_id->elems, 33); FREE(their_node_id);
14078         LDKInitFeatures ret_var = (this_arg_conv->provided_init_features)(this_arg_conv->this_arg, their_node_id_ref);
14079         uint64_t ret_ref = 0;
14080         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
14081         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
14082         return ret_ref;
14083 }
14084
14085 typedef struct LDKOnionMessageHandler_JCalls {
14086         atomic_size_t refcnt;
14087         uint32_t instance_ptr;
14088 } LDKOnionMessageHandler_JCalls;
14089 static void LDKOnionMessageHandler_JCalls_free(void* this_arg) {
14090         LDKOnionMessageHandler_JCalls *j_calls = (LDKOnionMessageHandler_JCalls*) this_arg;
14091         if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
14092                 FREE(j_calls);
14093         }
14094 }
14095 void handle_onion_message_LDKOnionMessageHandler_jcall(const void* this_arg, LDKPublicKey peer_node_id, const LDKOnionMessage * msg) {
14096         LDKOnionMessageHandler_JCalls *j_calls = (LDKOnionMessageHandler_JCalls*) this_arg;
14097         int8_tArray peer_node_id_arr = init_int8_tArray(33, __LINE__);
14098         memcpy(peer_node_id_arr->elems, peer_node_id.compressed_form, 33);
14099         LDKOnionMessage msg_var = *msg;
14100         uint64_t msg_ref = 0;
14101         msg_var = OnionMessage_clone(&msg_var);
14102         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
14103         msg_ref = tag_ptr(msg_var.inner, msg_var.is_owned);
14104         js_invoke_function_ubuuuu(j_calls->instance_ptr, 122, (uint32_t)peer_node_id_arr, msg_ref, 0, 0, 0, 0);
14105 }
14106 LDKOnionMessage next_onion_message_for_peer_LDKOnionMessageHandler_jcall(const void* this_arg, LDKPublicKey peer_node_id) {
14107         LDKOnionMessageHandler_JCalls *j_calls = (LDKOnionMessageHandler_JCalls*) this_arg;
14108         int8_tArray peer_node_id_arr = init_int8_tArray(33, __LINE__);
14109         memcpy(peer_node_id_arr->elems, peer_node_id.compressed_form, 33);
14110         uint64_t ret = js_invoke_function_uuuuuu(j_calls->instance_ptr, 123, (uint32_t)peer_node_id_arr, 0, 0, 0, 0, 0);
14111         LDKOnionMessage ret_conv;
14112         ret_conv.inner = untag_ptr(ret);
14113         ret_conv.is_owned = ptr_is_owned(ret);
14114         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_conv);
14115         return ret_conv;
14116 }
14117 LDKCResult_NoneNoneZ peer_connected_LDKOnionMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKInit * init, bool inbound) {
14118         LDKOnionMessageHandler_JCalls *j_calls = (LDKOnionMessageHandler_JCalls*) this_arg;
14119         int8_tArray their_node_id_arr = init_int8_tArray(33, __LINE__);
14120         memcpy(their_node_id_arr->elems, their_node_id.compressed_form, 33);
14121         LDKInit init_var = *init;
14122         uint64_t init_ref = 0;
14123         init_var = Init_clone(&init_var);
14124         CHECK_INNER_FIELD_ACCESS_OR_NULL(init_var);
14125         init_ref = tag_ptr(init_var.inner, init_var.is_owned);
14126         jboolean inbound_conv = inbound;
14127         uint64_t ret = js_invoke_function_ubuuuu(j_calls->instance_ptr, 124, (uint32_t)their_node_id_arr, init_ref, inbound_conv, 0, 0, 0);
14128         void* ret_ptr = untag_ptr(ret);
14129         CHECK_ACCESS(ret_ptr);
14130         LDKCResult_NoneNoneZ ret_conv = *(LDKCResult_NoneNoneZ*)(ret_ptr);
14131         FREE(untag_ptr(ret));
14132         return ret_conv;
14133 }
14134 void peer_disconnected_LDKOnionMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id) {
14135         LDKOnionMessageHandler_JCalls *j_calls = (LDKOnionMessageHandler_JCalls*) this_arg;
14136         int8_tArray their_node_id_arr = init_int8_tArray(33, __LINE__);
14137         memcpy(their_node_id_arr->elems, their_node_id.compressed_form, 33);
14138         js_invoke_function_uuuuuu(j_calls->instance_ptr, 125, (uint32_t)their_node_id_arr, 0, 0, 0, 0, 0);
14139 }
14140 LDKNodeFeatures provided_node_features_LDKOnionMessageHandler_jcall(const void* this_arg) {
14141         LDKOnionMessageHandler_JCalls *j_calls = (LDKOnionMessageHandler_JCalls*) this_arg;
14142         uint64_t ret = js_invoke_function_uuuuuu(j_calls->instance_ptr, 126, 0, 0, 0, 0, 0, 0);
14143         LDKNodeFeatures ret_conv;
14144         ret_conv.inner = untag_ptr(ret);
14145         ret_conv.is_owned = ptr_is_owned(ret);
14146         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_conv);
14147         return ret_conv;
14148 }
14149 LDKInitFeatures provided_init_features_LDKOnionMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id) {
14150         LDKOnionMessageHandler_JCalls *j_calls = (LDKOnionMessageHandler_JCalls*) this_arg;
14151         int8_tArray their_node_id_arr = init_int8_tArray(33, __LINE__);
14152         memcpy(their_node_id_arr->elems, their_node_id.compressed_form, 33);
14153         uint64_t ret = js_invoke_function_uuuuuu(j_calls->instance_ptr, 127, (uint32_t)their_node_id_arr, 0, 0, 0, 0, 0);
14154         LDKInitFeatures ret_conv;
14155         ret_conv.inner = untag_ptr(ret);
14156         ret_conv.is_owned = ptr_is_owned(ret);
14157         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_conv);
14158         return ret_conv;
14159 }
14160 static void LDKOnionMessageHandler_JCalls_cloned(LDKOnionMessageHandler* new_obj) {
14161         LDKOnionMessageHandler_JCalls *j_calls = (LDKOnionMessageHandler_JCalls*) new_obj->this_arg;
14162         atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
14163 }
14164 static inline LDKOnionMessageHandler LDKOnionMessageHandler_init (JSValue o) {
14165         LDKOnionMessageHandler_JCalls *calls = MALLOC(sizeof(LDKOnionMessageHandler_JCalls), "LDKOnionMessageHandler_JCalls");
14166         atomic_init(&calls->refcnt, 1);
14167         calls->instance_ptr = o;
14168
14169         LDKOnionMessageHandler ret = {
14170                 .this_arg = (void*) calls,
14171                 .handle_onion_message = handle_onion_message_LDKOnionMessageHandler_jcall,
14172                 .next_onion_message_for_peer = next_onion_message_for_peer_LDKOnionMessageHandler_jcall,
14173                 .peer_connected = peer_connected_LDKOnionMessageHandler_jcall,
14174                 .peer_disconnected = peer_disconnected_LDKOnionMessageHandler_jcall,
14175                 .provided_node_features = provided_node_features_LDKOnionMessageHandler_jcall,
14176                 .provided_init_features = provided_init_features_LDKOnionMessageHandler_jcall,
14177                 .free = LDKOnionMessageHandler_JCalls_free,
14178         };
14179         return ret;
14180 }
14181 uint64_t  __attribute__((export_name("TS_LDKOnionMessageHandler_new"))) TS_LDKOnionMessageHandler_new(JSValue o) {
14182         LDKOnionMessageHandler *res_ptr = MALLOC(sizeof(LDKOnionMessageHandler), "LDKOnionMessageHandler");
14183         *res_ptr = LDKOnionMessageHandler_init(o);
14184         return tag_ptr(res_ptr, true);
14185 }
14186 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) {
14187         void* this_arg_ptr = untag_ptr(this_arg);
14188         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
14189         LDKOnionMessageHandler* this_arg_conv = (LDKOnionMessageHandler*)this_arg_ptr;
14190         LDKPublicKey peer_node_id_ref;
14191         CHECK(peer_node_id->arr_len == 33);
14192         memcpy(peer_node_id_ref.compressed_form, peer_node_id->elems, 33); FREE(peer_node_id);
14193         LDKOnionMessage msg_conv;
14194         msg_conv.inner = untag_ptr(msg);
14195         msg_conv.is_owned = ptr_is_owned(msg);
14196         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
14197         msg_conv.is_owned = false;
14198         (this_arg_conv->handle_onion_message)(this_arg_conv->this_arg, peer_node_id_ref, &msg_conv);
14199 }
14200
14201 uint64_t  __attribute__((export_name("TS_OnionMessageHandler_next_onion_message_for_peer"))) TS_OnionMessageHandler_next_onion_message_for_peer(uint64_t this_arg, int8_tArray peer_node_id) {
14202         void* this_arg_ptr = untag_ptr(this_arg);
14203         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
14204         LDKOnionMessageHandler* this_arg_conv = (LDKOnionMessageHandler*)this_arg_ptr;
14205         LDKPublicKey peer_node_id_ref;
14206         CHECK(peer_node_id->arr_len == 33);
14207         memcpy(peer_node_id_ref.compressed_form, peer_node_id->elems, 33); FREE(peer_node_id);
14208         LDKOnionMessage ret_var = (this_arg_conv->next_onion_message_for_peer)(this_arg_conv->this_arg, peer_node_id_ref);
14209         uint64_t ret_ref = 0;
14210         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
14211         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
14212         return ret_ref;
14213 }
14214
14215 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) {
14216         void* this_arg_ptr = untag_ptr(this_arg);
14217         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
14218         LDKOnionMessageHandler* this_arg_conv = (LDKOnionMessageHandler*)this_arg_ptr;
14219         LDKPublicKey their_node_id_ref;
14220         CHECK(their_node_id->arr_len == 33);
14221         memcpy(their_node_id_ref.compressed_form, their_node_id->elems, 33); FREE(their_node_id);
14222         LDKInit init_conv;
14223         init_conv.inner = untag_ptr(init);
14224         init_conv.is_owned = ptr_is_owned(init);
14225         CHECK_INNER_FIELD_ACCESS_OR_NULL(init_conv);
14226         init_conv.is_owned = false;
14227         LDKCResult_NoneNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneNoneZ), "LDKCResult_NoneNoneZ");
14228         *ret_conv = (this_arg_conv->peer_connected)(this_arg_conv->this_arg, their_node_id_ref, &init_conv, inbound);
14229         return tag_ptr(ret_conv, true);
14230 }
14231
14232 void  __attribute__((export_name("TS_OnionMessageHandler_peer_disconnected"))) TS_OnionMessageHandler_peer_disconnected(uint64_t this_arg, int8_tArray their_node_id) {
14233         void* this_arg_ptr = untag_ptr(this_arg);
14234         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
14235         LDKOnionMessageHandler* this_arg_conv = (LDKOnionMessageHandler*)this_arg_ptr;
14236         LDKPublicKey their_node_id_ref;
14237         CHECK(their_node_id->arr_len == 33);
14238         memcpy(their_node_id_ref.compressed_form, their_node_id->elems, 33); FREE(their_node_id);
14239         (this_arg_conv->peer_disconnected)(this_arg_conv->this_arg, their_node_id_ref);
14240 }
14241
14242 uint64_t  __attribute__((export_name("TS_OnionMessageHandler_provided_node_features"))) TS_OnionMessageHandler_provided_node_features(uint64_t this_arg) {
14243         void* this_arg_ptr = untag_ptr(this_arg);
14244         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
14245         LDKOnionMessageHandler* this_arg_conv = (LDKOnionMessageHandler*)this_arg_ptr;
14246         LDKNodeFeatures ret_var = (this_arg_conv->provided_node_features)(this_arg_conv->this_arg);
14247         uint64_t ret_ref = 0;
14248         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
14249         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
14250         return ret_ref;
14251 }
14252
14253 uint64_t  __attribute__((export_name("TS_OnionMessageHandler_provided_init_features"))) TS_OnionMessageHandler_provided_init_features(uint64_t this_arg, int8_tArray their_node_id) {
14254         void* this_arg_ptr = untag_ptr(this_arg);
14255         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
14256         LDKOnionMessageHandler* this_arg_conv = (LDKOnionMessageHandler*)this_arg_ptr;
14257         LDKPublicKey their_node_id_ref;
14258         CHECK(their_node_id->arr_len == 33);
14259         memcpy(their_node_id_ref.compressed_form, their_node_id->elems, 33); FREE(their_node_id);
14260         LDKInitFeatures ret_var = (this_arg_conv->provided_init_features)(this_arg_conv->this_arg, their_node_id_ref);
14261         uint64_t ret_ref = 0;
14262         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
14263         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
14264         return ret_ref;
14265 }
14266
14267 typedef struct LDKCustomMessageReader_JCalls {
14268         atomic_size_t refcnt;
14269         uint32_t instance_ptr;
14270 } LDKCustomMessageReader_JCalls;
14271 static void LDKCustomMessageReader_JCalls_free(void* this_arg) {
14272         LDKCustomMessageReader_JCalls *j_calls = (LDKCustomMessageReader_JCalls*) this_arg;
14273         if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
14274                 FREE(j_calls);
14275         }
14276 }
14277 LDKCResult_COption_TypeZDecodeErrorZ read_LDKCustomMessageReader_jcall(const void* this_arg, uint16_t message_type, LDKu8slice buffer) {
14278         LDKCustomMessageReader_JCalls *j_calls = (LDKCustomMessageReader_JCalls*) this_arg;
14279         int16_t message_type_conv = message_type;
14280         LDKu8slice buffer_var = buffer;
14281         int8_tArray buffer_arr = init_int8_tArray(buffer_var.datalen, __LINE__);
14282         memcpy(buffer_arr->elems, buffer_var.data, buffer_var.datalen);
14283         uint64_t ret = js_invoke_function_uuuuuu(j_calls->instance_ptr, 128, message_type_conv, (uint32_t)buffer_arr, 0, 0, 0, 0);
14284         void* ret_ptr = untag_ptr(ret);
14285         CHECK_ACCESS(ret_ptr);
14286         LDKCResult_COption_TypeZDecodeErrorZ ret_conv = *(LDKCResult_COption_TypeZDecodeErrorZ*)(ret_ptr);
14287         FREE(untag_ptr(ret));
14288         return ret_conv;
14289 }
14290 static void LDKCustomMessageReader_JCalls_cloned(LDKCustomMessageReader* new_obj) {
14291         LDKCustomMessageReader_JCalls *j_calls = (LDKCustomMessageReader_JCalls*) new_obj->this_arg;
14292         atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
14293 }
14294 static inline LDKCustomMessageReader LDKCustomMessageReader_init (JSValue o) {
14295         LDKCustomMessageReader_JCalls *calls = MALLOC(sizeof(LDKCustomMessageReader_JCalls), "LDKCustomMessageReader_JCalls");
14296         atomic_init(&calls->refcnt, 1);
14297         calls->instance_ptr = o;
14298
14299         LDKCustomMessageReader ret = {
14300                 .this_arg = (void*) calls,
14301                 .read = read_LDKCustomMessageReader_jcall,
14302                 .free = LDKCustomMessageReader_JCalls_free,
14303         };
14304         return ret;
14305 }
14306 uint64_t  __attribute__((export_name("TS_LDKCustomMessageReader_new"))) TS_LDKCustomMessageReader_new(JSValue o) {
14307         LDKCustomMessageReader *res_ptr = MALLOC(sizeof(LDKCustomMessageReader), "LDKCustomMessageReader");
14308         *res_ptr = LDKCustomMessageReader_init(o);
14309         return tag_ptr(res_ptr, true);
14310 }
14311 uint64_t  __attribute__((export_name("TS_CustomMessageReader_read"))) TS_CustomMessageReader_read(uint64_t this_arg, int16_t message_type, int8_tArray buffer) {
14312         void* this_arg_ptr = untag_ptr(this_arg);
14313         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
14314         LDKCustomMessageReader* this_arg_conv = (LDKCustomMessageReader*)this_arg_ptr;
14315         LDKu8slice buffer_ref;
14316         buffer_ref.datalen = buffer->arr_len;
14317         buffer_ref.data = buffer->elems;
14318         LDKCResult_COption_TypeZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_COption_TypeZDecodeErrorZ), "LDKCResult_COption_TypeZDecodeErrorZ");
14319         *ret_conv = (this_arg_conv->read)(this_arg_conv->this_arg, message_type, buffer_ref);
14320         FREE(buffer);
14321         return tag_ptr(ret_conv, true);
14322 }
14323
14324 typedef struct LDKCustomMessageHandler_JCalls {
14325         atomic_size_t refcnt;
14326         uint32_t instance_ptr;
14327         LDKCustomMessageReader_JCalls* CustomMessageReader;
14328 } LDKCustomMessageHandler_JCalls;
14329 static void LDKCustomMessageHandler_JCalls_free(void* this_arg) {
14330         LDKCustomMessageHandler_JCalls *j_calls = (LDKCustomMessageHandler_JCalls*) this_arg;
14331         if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
14332                 FREE(j_calls);
14333         }
14334 }
14335 LDKCResult_NoneLightningErrorZ handle_custom_message_LDKCustomMessageHandler_jcall(const void* this_arg, LDKType msg, LDKPublicKey sender_node_id) {
14336         LDKCustomMessageHandler_JCalls *j_calls = (LDKCustomMessageHandler_JCalls*) this_arg;
14337         LDKType* msg_ret = MALLOC(sizeof(LDKType), "LDKType");
14338         *msg_ret = msg;
14339         int8_tArray sender_node_id_arr = init_int8_tArray(33, __LINE__);
14340         memcpy(sender_node_id_arr->elems, sender_node_id.compressed_form, 33);
14341         uint64_t ret = js_invoke_function_buuuuu(j_calls->instance_ptr, 129, tag_ptr(msg_ret, true), (uint32_t)sender_node_id_arr, 0, 0, 0, 0);
14342         void* ret_ptr = untag_ptr(ret);
14343         CHECK_ACCESS(ret_ptr);
14344         LDKCResult_NoneLightningErrorZ ret_conv = *(LDKCResult_NoneLightningErrorZ*)(ret_ptr);
14345         FREE(untag_ptr(ret));
14346         return ret_conv;
14347 }
14348 LDKCVec_C2Tuple_PublicKeyTypeZZ get_and_clear_pending_msg_LDKCustomMessageHandler_jcall(const void* this_arg) {
14349         LDKCustomMessageHandler_JCalls *j_calls = (LDKCustomMessageHandler_JCalls*) this_arg;
14350         uint64_tArray ret = (uint64_tArray)js_invoke_function_uuuuuu(j_calls->instance_ptr, 130, 0, 0, 0, 0, 0, 0);
14351         LDKCVec_C2Tuple_PublicKeyTypeZZ ret_constr;
14352         ret_constr.datalen = ret->arr_len;
14353         if (ret_constr.datalen > 0)
14354                 ret_constr.data = MALLOC(ret_constr.datalen * sizeof(LDKC2Tuple_PublicKeyTypeZ), "LDKCVec_C2Tuple_PublicKeyTypeZZ Elements");
14355         else
14356                 ret_constr.data = NULL;
14357         uint64_t* ret_vals = ret->elems;
14358         for (size_t z = 0; z < ret_constr.datalen; z++) {
14359                 uint64_t ret_conv_25 = ret_vals[z];
14360                 void* ret_conv_25_ptr = untag_ptr(ret_conv_25);
14361                 CHECK_ACCESS(ret_conv_25_ptr);
14362                 LDKC2Tuple_PublicKeyTypeZ ret_conv_25_conv = *(LDKC2Tuple_PublicKeyTypeZ*)(ret_conv_25_ptr);
14363                 FREE(untag_ptr(ret_conv_25));
14364                 ret_constr.data[z] = ret_conv_25_conv;
14365         }
14366         FREE(ret);
14367         return ret_constr;
14368 }
14369 LDKNodeFeatures provided_node_features_LDKCustomMessageHandler_jcall(const void* this_arg) {
14370         LDKCustomMessageHandler_JCalls *j_calls = (LDKCustomMessageHandler_JCalls*) this_arg;
14371         uint64_t ret = js_invoke_function_uuuuuu(j_calls->instance_ptr, 131, 0, 0, 0, 0, 0, 0);
14372         LDKNodeFeatures ret_conv;
14373         ret_conv.inner = untag_ptr(ret);
14374         ret_conv.is_owned = ptr_is_owned(ret);
14375         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_conv);
14376         return ret_conv;
14377 }
14378 LDKInitFeatures provided_init_features_LDKCustomMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id) {
14379         LDKCustomMessageHandler_JCalls *j_calls = (LDKCustomMessageHandler_JCalls*) this_arg;
14380         int8_tArray their_node_id_arr = init_int8_tArray(33, __LINE__);
14381         memcpy(their_node_id_arr->elems, their_node_id.compressed_form, 33);
14382         uint64_t ret = js_invoke_function_uuuuuu(j_calls->instance_ptr, 132, (uint32_t)their_node_id_arr, 0, 0, 0, 0, 0);
14383         LDKInitFeatures ret_conv;
14384         ret_conv.inner = untag_ptr(ret);
14385         ret_conv.is_owned = ptr_is_owned(ret);
14386         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_conv);
14387         return ret_conv;
14388 }
14389 static void LDKCustomMessageHandler_JCalls_cloned(LDKCustomMessageHandler* new_obj) {
14390         LDKCustomMessageHandler_JCalls *j_calls = (LDKCustomMessageHandler_JCalls*) new_obj->this_arg;
14391         atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
14392         atomic_fetch_add_explicit(&j_calls->CustomMessageReader->refcnt, 1, memory_order_release);
14393 }
14394 static inline LDKCustomMessageHandler LDKCustomMessageHandler_init (JSValue o, JSValue CustomMessageReader) {
14395         LDKCustomMessageHandler_JCalls *calls = MALLOC(sizeof(LDKCustomMessageHandler_JCalls), "LDKCustomMessageHandler_JCalls");
14396         atomic_init(&calls->refcnt, 1);
14397         calls->instance_ptr = o;
14398
14399         LDKCustomMessageHandler ret = {
14400                 .this_arg = (void*) calls,
14401                 .handle_custom_message = handle_custom_message_LDKCustomMessageHandler_jcall,
14402                 .get_and_clear_pending_msg = get_and_clear_pending_msg_LDKCustomMessageHandler_jcall,
14403                 .provided_node_features = provided_node_features_LDKCustomMessageHandler_jcall,
14404                 .provided_init_features = provided_init_features_LDKCustomMessageHandler_jcall,
14405                 .free = LDKCustomMessageHandler_JCalls_free,
14406                 .CustomMessageReader = LDKCustomMessageReader_init(CustomMessageReader),
14407         };
14408         calls->CustomMessageReader = ret.CustomMessageReader.this_arg;
14409         return ret;
14410 }
14411 uint64_t  __attribute__((export_name("TS_LDKCustomMessageHandler_new"))) TS_LDKCustomMessageHandler_new(JSValue o, JSValue CustomMessageReader) {
14412         LDKCustomMessageHandler *res_ptr = MALLOC(sizeof(LDKCustomMessageHandler), "LDKCustomMessageHandler");
14413         *res_ptr = LDKCustomMessageHandler_init(o, CustomMessageReader);
14414         return tag_ptr(res_ptr, true);
14415 }
14416 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) {
14417         void* this_arg_ptr = untag_ptr(this_arg);
14418         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
14419         LDKCustomMessageHandler* this_arg_conv = (LDKCustomMessageHandler*)this_arg_ptr;
14420         void* msg_ptr = untag_ptr(msg);
14421         CHECK_ACCESS(msg_ptr);
14422         LDKType msg_conv = *(LDKType*)(msg_ptr);
14423         if (msg_conv.free == LDKType_JCalls_free) {
14424                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
14425                 LDKType_JCalls_cloned(&msg_conv);
14426         }
14427         LDKPublicKey sender_node_id_ref;
14428         CHECK(sender_node_id->arr_len == 33);
14429         memcpy(sender_node_id_ref.compressed_form, sender_node_id->elems, 33); FREE(sender_node_id);
14430         LDKCResult_NoneLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneLightningErrorZ), "LDKCResult_NoneLightningErrorZ");
14431         *ret_conv = (this_arg_conv->handle_custom_message)(this_arg_conv->this_arg, msg_conv, sender_node_id_ref);
14432         return tag_ptr(ret_conv, true);
14433 }
14434
14435 uint64_tArray  __attribute__((export_name("TS_CustomMessageHandler_get_and_clear_pending_msg"))) TS_CustomMessageHandler_get_and_clear_pending_msg(uint64_t this_arg) {
14436         void* this_arg_ptr = untag_ptr(this_arg);
14437         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
14438         LDKCustomMessageHandler* this_arg_conv = (LDKCustomMessageHandler*)this_arg_ptr;
14439         LDKCVec_C2Tuple_PublicKeyTypeZZ ret_var = (this_arg_conv->get_and_clear_pending_msg)(this_arg_conv->this_arg);
14440         uint64_tArray ret_arr = NULL;
14441         ret_arr = init_uint64_tArray(ret_var.datalen, __LINE__);
14442         uint64_t *ret_arr_ptr = (uint64_t*)(((uint8_t*)ret_arr) + 8);
14443         for (size_t z = 0; z < ret_var.datalen; z++) {
14444                 LDKC2Tuple_PublicKeyTypeZ* ret_conv_25_conv = MALLOC(sizeof(LDKC2Tuple_PublicKeyTypeZ), "LDKC2Tuple_PublicKeyTypeZ");
14445                 *ret_conv_25_conv = ret_var.data[z];
14446                 ret_arr_ptr[z] = tag_ptr(ret_conv_25_conv, true);
14447         }
14448         
14449         FREE(ret_var.data);
14450         return ret_arr;
14451 }
14452
14453 uint64_t  __attribute__((export_name("TS_CustomMessageHandler_provided_node_features"))) TS_CustomMessageHandler_provided_node_features(uint64_t this_arg) {
14454         void* this_arg_ptr = untag_ptr(this_arg);
14455         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
14456         LDKCustomMessageHandler* this_arg_conv = (LDKCustomMessageHandler*)this_arg_ptr;
14457         LDKNodeFeatures ret_var = (this_arg_conv->provided_node_features)(this_arg_conv->this_arg);
14458         uint64_t ret_ref = 0;
14459         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
14460         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
14461         return ret_ref;
14462 }
14463
14464 uint64_t  __attribute__((export_name("TS_CustomMessageHandler_provided_init_features"))) TS_CustomMessageHandler_provided_init_features(uint64_t this_arg, int8_tArray their_node_id) {
14465         void* this_arg_ptr = untag_ptr(this_arg);
14466         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
14467         LDKCustomMessageHandler* this_arg_conv = (LDKCustomMessageHandler*)this_arg_ptr;
14468         LDKPublicKey their_node_id_ref;
14469         CHECK(their_node_id->arr_len == 33);
14470         memcpy(their_node_id_ref.compressed_form, their_node_id->elems, 33); FREE(their_node_id);
14471         LDKInitFeatures ret_var = (this_arg_conv->provided_init_features)(this_arg_conv->this_arg, their_node_id_ref);
14472         uint64_t ret_ref = 0;
14473         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
14474         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
14475         return ret_ref;
14476 }
14477
14478 typedef struct LDKCustomOnionMessageHandler_JCalls {
14479         atomic_size_t refcnt;
14480         uint32_t instance_ptr;
14481 } LDKCustomOnionMessageHandler_JCalls;
14482 static void LDKCustomOnionMessageHandler_JCalls_free(void* this_arg) {
14483         LDKCustomOnionMessageHandler_JCalls *j_calls = (LDKCustomOnionMessageHandler_JCalls*) this_arg;
14484         if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
14485                 FREE(j_calls);
14486         }
14487 }
14488 LDKCOption_OnionMessageContentsZ handle_custom_message_LDKCustomOnionMessageHandler_jcall(const void* this_arg, LDKOnionMessageContents msg) {
14489         LDKCustomOnionMessageHandler_JCalls *j_calls = (LDKCustomOnionMessageHandler_JCalls*) this_arg;
14490         LDKOnionMessageContents* msg_ret = MALLOC(sizeof(LDKOnionMessageContents), "LDKOnionMessageContents");
14491         *msg_ret = msg;
14492         uint64_t ret = js_invoke_function_buuuuu(j_calls->instance_ptr, 133, tag_ptr(msg_ret, true), 0, 0, 0, 0, 0);
14493         void* ret_ptr = untag_ptr(ret);
14494         CHECK_ACCESS(ret_ptr);
14495         LDKCOption_OnionMessageContentsZ ret_conv = *(LDKCOption_OnionMessageContentsZ*)(ret_ptr);
14496         FREE(untag_ptr(ret));
14497         return ret_conv;
14498 }
14499 LDKCResult_COption_OnionMessageContentsZDecodeErrorZ read_custom_message_LDKCustomOnionMessageHandler_jcall(const void* this_arg, uint64_t message_type, LDKu8slice buffer) {
14500         LDKCustomOnionMessageHandler_JCalls *j_calls = (LDKCustomOnionMessageHandler_JCalls*) this_arg;
14501         int64_t message_type_conv = message_type;
14502         LDKu8slice buffer_var = buffer;
14503         int8_tArray buffer_arr = init_int8_tArray(buffer_var.datalen, __LINE__);
14504         memcpy(buffer_arr->elems, buffer_var.data, buffer_var.datalen);
14505         uint64_t ret = js_invoke_function_buuuuu(j_calls->instance_ptr, 134, message_type_conv, (uint32_t)buffer_arr, 0, 0, 0, 0);
14506         void* ret_ptr = untag_ptr(ret);
14507         CHECK_ACCESS(ret_ptr);
14508         LDKCResult_COption_OnionMessageContentsZDecodeErrorZ ret_conv = *(LDKCResult_COption_OnionMessageContentsZDecodeErrorZ*)(ret_ptr);
14509         FREE(untag_ptr(ret));
14510         return ret_conv;
14511 }
14512 LDKCVec_C3Tuple_OnionMessageContentsDestinationBlindedPathZZ release_pending_custom_messages_LDKCustomOnionMessageHandler_jcall(const void* this_arg) {
14513         LDKCustomOnionMessageHandler_JCalls *j_calls = (LDKCustomOnionMessageHandler_JCalls*) this_arg;
14514         uint64_tArray ret = (uint64_tArray)js_invoke_function_uuuuuu(j_calls->instance_ptr, 135, 0, 0, 0, 0, 0, 0);
14515         LDKCVec_C3Tuple_OnionMessageContentsDestinationBlindedPathZZ ret_constr;
14516         ret_constr.datalen = ret->arr_len;
14517         if (ret_constr.datalen > 0)
14518                 ret_constr.data = MALLOC(ret_constr.datalen * sizeof(LDKC3Tuple_OnionMessageContentsDestinationBlindedPathZ), "LDKCVec_C3Tuple_OnionMessageContentsDestinationBlindedPathZZ Elements");
14519         else
14520                 ret_constr.data = NULL;
14521         uint64_t* ret_vals = ret->elems;
14522         for (size_t e = 0; e < ret_constr.datalen; e++) {
14523                 uint64_t ret_conv_56 = ret_vals[e];
14524                 void* ret_conv_56_ptr = untag_ptr(ret_conv_56);
14525                 CHECK_ACCESS(ret_conv_56_ptr);
14526                 LDKC3Tuple_OnionMessageContentsDestinationBlindedPathZ ret_conv_56_conv = *(LDKC3Tuple_OnionMessageContentsDestinationBlindedPathZ*)(ret_conv_56_ptr);
14527                 FREE(untag_ptr(ret_conv_56));
14528                 ret_constr.data[e] = ret_conv_56_conv;
14529         }
14530         FREE(ret);
14531         return ret_constr;
14532 }
14533 static void LDKCustomOnionMessageHandler_JCalls_cloned(LDKCustomOnionMessageHandler* new_obj) {
14534         LDKCustomOnionMessageHandler_JCalls *j_calls = (LDKCustomOnionMessageHandler_JCalls*) new_obj->this_arg;
14535         atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
14536 }
14537 static inline LDKCustomOnionMessageHandler LDKCustomOnionMessageHandler_init (JSValue o) {
14538         LDKCustomOnionMessageHandler_JCalls *calls = MALLOC(sizeof(LDKCustomOnionMessageHandler_JCalls), "LDKCustomOnionMessageHandler_JCalls");
14539         atomic_init(&calls->refcnt, 1);
14540         calls->instance_ptr = o;
14541
14542         LDKCustomOnionMessageHandler ret = {
14543                 .this_arg = (void*) calls,
14544                 .handle_custom_message = handle_custom_message_LDKCustomOnionMessageHandler_jcall,
14545                 .read_custom_message = read_custom_message_LDKCustomOnionMessageHandler_jcall,
14546                 .release_pending_custom_messages = release_pending_custom_messages_LDKCustomOnionMessageHandler_jcall,
14547                 .free = LDKCustomOnionMessageHandler_JCalls_free,
14548         };
14549         return ret;
14550 }
14551 uint64_t  __attribute__((export_name("TS_LDKCustomOnionMessageHandler_new"))) TS_LDKCustomOnionMessageHandler_new(JSValue o) {
14552         LDKCustomOnionMessageHandler *res_ptr = MALLOC(sizeof(LDKCustomOnionMessageHandler), "LDKCustomOnionMessageHandler");
14553         *res_ptr = LDKCustomOnionMessageHandler_init(o);
14554         return tag_ptr(res_ptr, true);
14555 }
14556 uint64_t  __attribute__((export_name("TS_CustomOnionMessageHandler_handle_custom_message"))) TS_CustomOnionMessageHandler_handle_custom_message(uint64_t this_arg, uint64_t msg) {
14557         void* this_arg_ptr = untag_ptr(this_arg);
14558         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
14559         LDKCustomOnionMessageHandler* this_arg_conv = (LDKCustomOnionMessageHandler*)this_arg_ptr;
14560         void* msg_ptr = untag_ptr(msg);
14561         CHECK_ACCESS(msg_ptr);
14562         LDKOnionMessageContents msg_conv = *(LDKOnionMessageContents*)(msg_ptr);
14563         if (msg_conv.free == LDKOnionMessageContents_JCalls_free) {
14564                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
14565                 LDKOnionMessageContents_JCalls_cloned(&msg_conv);
14566         }
14567         LDKCOption_OnionMessageContentsZ *ret_copy = MALLOC(sizeof(LDKCOption_OnionMessageContentsZ), "LDKCOption_OnionMessageContentsZ");
14568         *ret_copy = (this_arg_conv->handle_custom_message)(this_arg_conv->this_arg, msg_conv);
14569         uint64_t ret_ref = tag_ptr(ret_copy, true);
14570         return ret_ref;
14571 }
14572
14573 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) {
14574         void* this_arg_ptr = untag_ptr(this_arg);
14575         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
14576         LDKCustomOnionMessageHandler* this_arg_conv = (LDKCustomOnionMessageHandler*)this_arg_ptr;
14577         LDKu8slice buffer_ref;
14578         buffer_ref.datalen = buffer->arr_len;
14579         buffer_ref.data = buffer->elems;
14580         LDKCResult_COption_OnionMessageContentsZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_COption_OnionMessageContentsZDecodeErrorZ), "LDKCResult_COption_OnionMessageContentsZDecodeErrorZ");
14581         *ret_conv = (this_arg_conv->read_custom_message)(this_arg_conv->this_arg, message_type, buffer_ref);
14582         FREE(buffer);
14583         return tag_ptr(ret_conv, true);
14584 }
14585
14586 uint64_tArray  __attribute__((export_name("TS_CustomOnionMessageHandler_release_pending_custom_messages"))) TS_CustomOnionMessageHandler_release_pending_custom_messages(uint64_t this_arg) {
14587         void* this_arg_ptr = untag_ptr(this_arg);
14588         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
14589         LDKCustomOnionMessageHandler* this_arg_conv = (LDKCustomOnionMessageHandler*)this_arg_ptr;
14590         LDKCVec_C3Tuple_OnionMessageContentsDestinationBlindedPathZZ ret_var = (this_arg_conv->release_pending_custom_messages)(this_arg_conv->this_arg);
14591         uint64_tArray ret_arr = NULL;
14592         ret_arr = init_uint64_tArray(ret_var.datalen, __LINE__);
14593         uint64_t *ret_arr_ptr = (uint64_t*)(((uint8_t*)ret_arr) + 8);
14594         for (size_t e = 0; e < ret_var.datalen; e++) {
14595                 LDKC3Tuple_OnionMessageContentsDestinationBlindedPathZ* ret_conv_56_conv = MALLOC(sizeof(LDKC3Tuple_OnionMessageContentsDestinationBlindedPathZ), "LDKC3Tuple_OnionMessageContentsDestinationBlindedPathZ");
14596                 *ret_conv_56_conv = ret_var.data[e];
14597                 ret_arr_ptr[e] = tag_ptr(ret_conv_56_conv, true);
14598         }
14599         
14600         FREE(ret_var.data);
14601         return ret_arr;
14602 }
14603
14604 typedef struct LDKSocketDescriptor_JCalls {
14605         atomic_size_t refcnt;
14606         uint32_t instance_ptr;
14607 } LDKSocketDescriptor_JCalls;
14608 static void LDKSocketDescriptor_JCalls_free(void* this_arg) {
14609         LDKSocketDescriptor_JCalls *j_calls = (LDKSocketDescriptor_JCalls*) this_arg;
14610         if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
14611                 FREE(j_calls);
14612         }
14613 }
14614 uintptr_t send_data_LDKSocketDescriptor_jcall(void* this_arg, LDKu8slice data, bool resume_read) {
14615         LDKSocketDescriptor_JCalls *j_calls = (LDKSocketDescriptor_JCalls*) this_arg;
14616         LDKu8slice data_var = data;
14617         int8_tArray data_arr = init_int8_tArray(data_var.datalen, __LINE__);
14618         memcpy(data_arr->elems, data_var.data, data_var.datalen);
14619         jboolean resume_read_conv = resume_read;
14620         return js_invoke_function_uuuuuu(j_calls->instance_ptr, 136, (uint32_t)data_arr, resume_read_conv, 0, 0, 0, 0);
14621 }
14622 void disconnect_socket_LDKSocketDescriptor_jcall(void* this_arg) {
14623         LDKSocketDescriptor_JCalls *j_calls = (LDKSocketDescriptor_JCalls*) this_arg;
14624         js_invoke_function_uuuuuu(j_calls->instance_ptr, 137, 0, 0, 0, 0, 0, 0);
14625 }
14626 bool eq_LDKSocketDescriptor_jcall(const void* this_arg, const LDKSocketDescriptor * other_arg) {
14627         LDKSocketDescriptor_JCalls *j_calls = (LDKSocketDescriptor_JCalls*) this_arg;
14628         LDKSocketDescriptor *other_arg_clone = MALLOC(sizeof(LDKSocketDescriptor), "LDKSocketDescriptor");
14629         *other_arg_clone = SocketDescriptor_clone(other_arg);
14630         return js_invoke_function_buuuuu(j_calls->instance_ptr, 138, tag_ptr(other_arg_clone, true), 0, 0, 0, 0, 0);
14631 }
14632 uint64_t hash_LDKSocketDescriptor_jcall(const void* this_arg) {
14633         LDKSocketDescriptor_JCalls *j_calls = (LDKSocketDescriptor_JCalls*) this_arg;
14634         return js_invoke_function_uuuuuu(j_calls->instance_ptr, 139, 0, 0, 0, 0, 0, 0);
14635 }
14636 static void LDKSocketDescriptor_JCalls_cloned(LDKSocketDescriptor* new_obj) {
14637         LDKSocketDescriptor_JCalls *j_calls = (LDKSocketDescriptor_JCalls*) new_obj->this_arg;
14638         atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
14639 }
14640 static inline LDKSocketDescriptor LDKSocketDescriptor_init (JSValue o) {
14641         LDKSocketDescriptor_JCalls *calls = MALLOC(sizeof(LDKSocketDescriptor_JCalls), "LDKSocketDescriptor_JCalls");
14642         atomic_init(&calls->refcnt, 1);
14643         calls->instance_ptr = o;
14644
14645         LDKSocketDescriptor ret = {
14646                 .this_arg = (void*) calls,
14647                 .send_data = send_data_LDKSocketDescriptor_jcall,
14648                 .disconnect_socket = disconnect_socket_LDKSocketDescriptor_jcall,
14649                 .eq = eq_LDKSocketDescriptor_jcall,
14650                 .hash = hash_LDKSocketDescriptor_jcall,
14651                 .cloned = LDKSocketDescriptor_JCalls_cloned,
14652                 .free = LDKSocketDescriptor_JCalls_free,
14653         };
14654         return ret;
14655 }
14656 uint64_t  __attribute__((export_name("TS_LDKSocketDescriptor_new"))) TS_LDKSocketDescriptor_new(JSValue o) {
14657         LDKSocketDescriptor *res_ptr = MALLOC(sizeof(LDKSocketDescriptor), "LDKSocketDescriptor");
14658         *res_ptr = LDKSocketDescriptor_init(o);
14659         return tag_ptr(res_ptr, true);
14660 }
14661 uint32_t  __attribute__((export_name("TS_SocketDescriptor_send_data"))) TS_SocketDescriptor_send_data(uint64_t this_arg, int8_tArray data, jboolean resume_read) {
14662         void* this_arg_ptr = untag_ptr(this_arg);
14663         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
14664         LDKSocketDescriptor* this_arg_conv = (LDKSocketDescriptor*)this_arg_ptr;
14665         LDKu8slice data_ref;
14666         data_ref.datalen = data->arr_len;
14667         data_ref.data = data->elems;
14668         uint32_t ret_conv = (this_arg_conv->send_data)(this_arg_conv->this_arg, data_ref, resume_read);
14669         FREE(data);
14670         return ret_conv;
14671 }
14672
14673 void  __attribute__((export_name("TS_SocketDescriptor_disconnect_socket"))) TS_SocketDescriptor_disconnect_socket(uint64_t this_arg) {
14674         void* this_arg_ptr = untag_ptr(this_arg);
14675         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
14676         LDKSocketDescriptor* this_arg_conv = (LDKSocketDescriptor*)this_arg_ptr;
14677         (this_arg_conv->disconnect_socket)(this_arg_conv->this_arg);
14678 }
14679
14680 int64_t  __attribute__((export_name("TS_SocketDescriptor_hash"))) TS_SocketDescriptor_hash(uint64_t this_arg) {
14681         void* this_arg_ptr = untag_ptr(this_arg);
14682         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
14683         LDKSocketDescriptor* this_arg_conv = (LDKSocketDescriptor*)this_arg_ptr;
14684         int64_t ret_conv = (this_arg_conv->hash)(this_arg_conv->this_arg);
14685         return ret_conv;
14686 }
14687
14688 uint32_t __attribute__((export_name("TS_LDKEffectiveCapacity_ty_from_ptr"))) TS_LDKEffectiveCapacity_ty_from_ptr(uint64_t ptr) {
14689         LDKEffectiveCapacity *obj = (LDKEffectiveCapacity*)untag_ptr(ptr);
14690         switch(obj->tag) {
14691                 case LDKEffectiveCapacity_ExactLiquidity: return 0;
14692                 case LDKEffectiveCapacity_AdvertisedMaxHTLC: return 1;
14693                 case LDKEffectiveCapacity_Total: return 2;
14694                 case LDKEffectiveCapacity_Infinite: return 3;
14695                 case LDKEffectiveCapacity_HintMaxHTLC: return 4;
14696                 case LDKEffectiveCapacity_Unknown: return 5;
14697                 default: abort();
14698         }
14699 }
14700 int64_t __attribute__((export_name("TS_LDKEffectiveCapacity_ExactLiquidity_get_liquidity_msat"))) TS_LDKEffectiveCapacity_ExactLiquidity_get_liquidity_msat(uint64_t ptr) {
14701         LDKEffectiveCapacity *obj = (LDKEffectiveCapacity*)untag_ptr(ptr);
14702         assert(obj->tag == LDKEffectiveCapacity_ExactLiquidity);
14703         int64_t liquidity_msat_conv = obj->exact_liquidity.liquidity_msat;
14704         return liquidity_msat_conv;
14705 }
14706 int64_t __attribute__((export_name("TS_LDKEffectiveCapacity_AdvertisedMaxHTLC_get_amount_msat"))) TS_LDKEffectiveCapacity_AdvertisedMaxHTLC_get_amount_msat(uint64_t ptr) {
14707         LDKEffectiveCapacity *obj = (LDKEffectiveCapacity*)untag_ptr(ptr);
14708         assert(obj->tag == LDKEffectiveCapacity_AdvertisedMaxHTLC);
14709         int64_t amount_msat_conv = obj->advertised_max_htlc.amount_msat;
14710         return amount_msat_conv;
14711 }
14712 int64_t __attribute__((export_name("TS_LDKEffectiveCapacity_Total_get_capacity_msat"))) TS_LDKEffectiveCapacity_Total_get_capacity_msat(uint64_t ptr) {
14713         LDKEffectiveCapacity *obj = (LDKEffectiveCapacity*)untag_ptr(ptr);
14714         assert(obj->tag == LDKEffectiveCapacity_Total);
14715         int64_t capacity_msat_conv = obj->total.capacity_msat;
14716         return capacity_msat_conv;
14717 }
14718 int64_t __attribute__((export_name("TS_LDKEffectiveCapacity_Total_get_htlc_maximum_msat"))) TS_LDKEffectiveCapacity_Total_get_htlc_maximum_msat(uint64_t ptr) {
14719         LDKEffectiveCapacity *obj = (LDKEffectiveCapacity*)untag_ptr(ptr);
14720         assert(obj->tag == LDKEffectiveCapacity_Total);
14721         int64_t htlc_maximum_msat_conv = obj->total.htlc_maximum_msat;
14722         return htlc_maximum_msat_conv;
14723 }
14724 int64_t __attribute__((export_name("TS_LDKEffectiveCapacity_HintMaxHTLC_get_amount_msat"))) TS_LDKEffectiveCapacity_HintMaxHTLC_get_amount_msat(uint64_t ptr) {
14725         LDKEffectiveCapacity *obj = (LDKEffectiveCapacity*)untag_ptr(ptr);
14726         assert(obj->tag == LDKEffectiveCapacity_HintMaxHTLC);
14727         int64_t amount_msat_conv = obj->hint_max_htlc.amount_msat;
14728         return amount_msat_conv;
14729 }
14730 uint32_t __attribute__((export_name("TS_LDKPayee_ty_from_ptr"))) TS_LDKPayee_ty_from_ptr(uint64_t ptr) {
14731         LDKPayee *obj = (LDKPayee*)untag_ptr(ptr);
14732         switch(obj->tag) {
14733                 case LDKPayee_Blinded: return 0;
14734                 case LDKPayee_Clear: return 1;
14735                 default: abort();
14736         }
14737 }
14738 uint64_tArray __attribute__((export_name("TS_LDKPayee_Blinded_get_route_hints"))) TS_LDKPayee_Blinded_get_route_hints(uint64_t ptr) {
14739         LDKPayee *obj = (LDKPayee*)untag_ptr(ptr);
14740         assert(obj->tag == LDKPayee_Blinded);
14741         LDKCVec_C2Tuple_BlindedPayInfoBlindedPathZZ route_hints_var = obj->blinded.route_hints;
14742                         uint64_tArray route_hints_arr = NULL;
14743                         route_hints_arr = init_uint64_tArray(route_hints_var.datalen, __LINE__);
14744                         uint64_t *route_hints_arr_ptr = (uint64_t*)(((uint8_t*)route_hints_arr) + 8);
14745                         for (size_t l = 0; l < route_hints_var.datalen; l++) {
14746                                 LDKC2Tuple_BlindedPayInfoBlindedPathZ* route_hints_conv_37_conv = MALLOC(sizeof(LDKC2Tuple_BlindedPayInfoBlindedPathZ), "LDKC2Tuple_BlindedPayInfoBlindedPathZ");
14747                                 *route_hints_conv_37_conv = route_hints_var.data[l];
14748                                 *route_hints_conv_37_conv = C2Tuple_BlindedPayInfoBlindedPathZ_clone(route_hints_conv_37_conv);
14749                                 route_hints_arr_ptr[l] = tag_ptr(route_hints_conv_37_conv, true);
14750                         }
14751                         
14752         return route_hints_arr;
14753 }
14754 uint64_t __attribute__((export_name("TS_LDKPayee_Blinded_get_features"))) TS_LDKPayee_Blinded_get_features(uint64_t ptr) {
14755         LDKPayee *obj = (LDKPayee*)untag_ptr(ptr);
14756         assert(obj->tag == LDKPayee_Blinded);
14757         LDKBolt12InvoiceFeatures features_var = obj->blinded.features;
14758                         uint64_t features_ref = 0;
14759                         CHECK_INNER_FIELD_ACCESS_OR_NULL(features_var);
14760                         features_ref = tag_ptr(features_var.inner, false);
14761         return features_ref;
14762 }
14763 int8_tArray __attribute__((export_name("TS_LDKPayee_Clear_get_node_id"))) TS_LDKPayee_Clear_get_node_id(uint64_t ptr) {
14764         LDKPayee *obj = (LDKPayee*)untag_ptr(ptr);
14765         assert(obj->tag == LDKPayee_Clear);
14766         int8_tArray node_id_arr = init_int8_tArray(33, __LINE__);
14767         memcpy(node_id_arr->elems, obj->clear.node_id.compressed_form, 33);
14768         return node_id_arr;
14769 }
14770 uint64_tArray __attribute__((export_name("TS_LDKPayee_Clear_get_route_hints"))) TS_LDKPayee_Clear_get_route_hints(uint64_t ptr) {
14771         LDKPayee *obj = (LDKPayee*)untag_ptr(ptr);
14772         assert(obj->tag == LDKPayee_Clear);
14773         LDKCVec_RouteHintZ route_hints_var = obj->clear.route_hints;
14774                         uint64_tArray route_hints_arr = NULL;
14775                         route_hints_arr = init_uint64_tArray(route_hints_var.datalen, __LINE__);
14776                         uint64_t *route_hints_arr_ptr = (uint64_t*)(((uint8_t*)route_hints_arr) + 8);
14777                         for (size_t l = 0; l < route_hints_var.datalen; l++) {
14778                                 LDKRouteHint route_hints_conv_11_var = route_hints_var.data[l];
14779                                 uint64_t route_hints_conv_11_ref = 0;
14780                                 CHECK_INNER_FIELD_ACCESS_OR_NULL(route_hints_conv_11_var);
14781                                 route_hints_conv_11_ref = tag_ptr(route_hints_conv_11_var.inner, false);
14782                                 route_hints_arr_ptr[l] = route_hints_conv_11_ref;
14783                         }
14784                         
14785         return route_hints_arr;
14786 }
14787 uint64_t __attribute__((export_name("TS_LDKPayee_Clear_get_features"))) TS_LDKPayee_Clear_get_features(uint64_t ptr) {
14788         LDKPayee *obj = (LDKPayee*)untag_ptr(ptr);
14789         assert(obj->tag == LDKPayee_Clear);
14790         LDKBolt11InvoiceFeatures features_var = obj->clear.features;
14791                         uint64_t features_ref = 0;
14792                         CHECK_INNER_FIELD_ACCESS_OR_NULL(features_var);
14793                         features_ref = tag_ptr(features_var.inner, false);
14794         return features_ref;
14795 }
14796 int32_t __attribute__((export_name("TS_LDKPayee_Clear_get_final_cltv_expiry_delta"))) TS_LDKPayee_Clear_get_final_cltv_expiry_delta(uint64_t ptr) {
14797         LDKPayee *obj = (LDKPayee*)untag_ptr(ptr);
14798         assert(obj->tag == LDKPayee_Clear);
14799         int32_t final_cltv_expiry_delta_conv = obj->clear.final_cltv_expiry_delta;
14800         return final_cltv_expiry_delta_conv;
14801 }
14802 typedef struct LDKScore_JCalls {
14803         atomic_size_t refcnt;
14804         uint32_t instance_ptr;
14805         LDKScoreLookUp_JCalls* ScoreLookUp;
14806         LDKScoreUpdate_JCalls* ScoreUpdate;
14807 } LDKScore_JCalls;
14808 static void LDKScore_JCalls_free(void* this_arg) {
14809         LDKScore_JCalls *j_calls = (LDKScore_JCalls*) this_arg;
14810         if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
14811                 FREE(j_calls);
14812         }
14813 }
14814 LDKCVec_u8Z write_LDKScore_jcall(const void* this_arg) {
14815         LDKScore_JCalls *j_calls = (LDKScore_JCalls*) this_arg;
14816         int8_tArray ret = (int8_tArray)js_invoke_function_uuuuuu(j_calls->instance_ptr, 140, 0, 0, 0, 0, 0, 0);
14817         LDKCVec_u8Z ret_ref;
14818         ret_ref.datalen = ret->arr_len;
14819         ret_ref.data = MALLOC(ret_ref.datalen, "LDKCVec_u8Z Bytes");
14820         memcpy(ret_ref.data, ret->elems, ret_ref.datalen); FREE(ret);
14821         return ret_ref;
14822 }
14823 static void LDKScore_JCalls_cloned(LDKScore* new_obj) {
14824         LDKScore_JCalls *j_calls = (LDKScore_JCalls*) new_obj->this_arg;
14825         atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
14826         atomic_fetch_add_explicit(&j_calls->ScoreLookUp->refcnt, 1, memory_order_release);
14827         atomic_fetch_add_explicit(&j_calls->ScoreUpdate->refcnt, 1, memory_order_release);
14828 }
14829 static inline LDKScore LDKScore_init (JSValue o, JSValue ScoreLookUp, JSValue ScoreUpdate) {
14830         LDKScore_JCalls *calls = MALLOC(sizeof(LDKScore_JCalls), "LDKScore_JCalls");
14831         atomic_init(&calls->refcnt, 1);
14832         calls->instance_ptr = o;
14833
14834         LDKScore ret = {
14835                 .this_arg = (void*) calls,
14836                 .write = write_LDKScore_jcall,
14837                 .free = LDKScore_JCalls_free,
14838                 .ScoreLookUp = LDKScoreLookUp_init(ScoreLookUp),
14839                 .ScoreUpdate = LDKScoreUpdate_init(ScoreUpdate),
14840         };
14841         calls->ScoreLookUp = ret.ScoreLookUp.this_arg;
14842         calls->ScoreUpdate = ret.ScoreUpdate.this_arg;
14843         return ret;
14844 }
14845 uint64_t  __attribute__((export_name("TS_LDKScore_new"))) TS_LDKScore_new(JSValue o, JSValue ScoreLookUp, JSValue ScoreUpdate) {
14846         LDKScore *res_ptr = MALLOC(sizeof(LDKScore), "LDKScore");
14847         *res_ptr = LDKScore_init(o, ScoreLookUp, ScoreUpdate);
14848         return tag_ptr(res_ptr, true);
14849 }
14850 int8_tArray  __attribute__((export_name("TS_Score_write"))) TS_Score_write(uint64_t this_arg) {
14851         void* this_arg_ptr = untag_ptr(this_arg);
14852         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
14853         LDKScore* this_arg_conv = (LDKScore*)this_arg_ptr;
14854         LDKCVec_u8Z ret_var = (this_arg_conv->write)(this_arg_conv->this_arg);
14855         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
14856         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
14857         CVec_u8Z_free(ret_var);
14858         return ret_arr;
14859 }
14860
14861 typedef struct LDKMessageRouter_JCalls {
14862         atomic_size_t refcnt;
14863         uint32_t instance_ptr;
14864 } LDKMessageRouter_JCalls;
14865 static void LDKMessageRouter_JCalls_free(void* this_arg) {
14866         LDKMessageRouter_JCalls *j_calls = (LDKMessageRouter_JCalls*) this_arg;
14867         if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
14868                 FREE(j_calls);
14869         }
14870 }
14871 LDKCResult_OnionMessagePathNoneZ find_path_LDKMessageRouter_jcall(const void* this_arg, LDKPublicKey sender, LDKCVec_PublicKeyZ peers, LDKDestination destination) {
14872         LDKMessageRouter_JCalls *j_calls = (LDKMessageRouter_JCalls*) this_arg;
14873         int8_tArray sender_arr = init_int8_tArray(33, __LINE__);
14874         memcpy(sender_arr->elems, sender.compressed_form, 33);
14875         LDKCVec_PublicKeyZ peers_var = peers;
14876         ptrArray peers_arr = NULL;
14877         peers_arr = init_ptrArray(peers_var.datalen, __LINE__);
14878         int8_tArray *peers_arr_ptr = (int8_tArray*)(((uint8_t*)peers_arr) + 8);
14879         for (size_t m = 0; m < peers_var.datalen; m++) {
14880                 int8_tArray peers_conv_12_arr = init_int8_tArray(33, __LINE__);
14881                 memcpy(peers_conv_12_arr->elems, peers_var.data[m].compressed_form, 33);
14882                 peers_arr_ptr[m] = peers_conv_12_arr;
14883         }
14884         
14885         FREE(peers_var.data);
14886         LDKDestination *destination_copy = MALLOC(sizeof(LDKDestination), "LDKDestination");
14887         *destination_copy = destination;
14888         uint64_t destination_ref = tag_ptr(destination_copy, true);
14889         uint64_t ret = js_invoke_function_uubuuu(j_calls->instance_ptr, 141, (uint32_t)sender_arr, (uint32_t)peers_arr, destination_ref, 0, 0, 0);
14890         void* ret_ptr = untag_ptr(ret);
14891         CHECK_ACCESS(ret_ptr);
14892         LDKCResult_OnionMessagePathNoneZ ret_conv = *(LDKCResult_OnionMessagePathNoneZ*)(ret_ptr);
14893         FREE(untag_ptr(ret));
14894         return ret_conv;
14895 }
14896 static void LDKMessageRouter_JCalls_cloned(LDKMessageRouter* new_obj) {
14897         LDKMessageRouter_JCalls *j_calls = (LDKMessageRouter_JCalls*) new_obj->this_arg;
14898         atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
14899 }
14900 static inline LDKMessageRouter LDKMessageRouter_init (JSValue o) {
14901         LDKMessageRouter_JCalls *calls = MALLOC(sizeof(LDKMessageRouter_JCalls), "LDKMessageRouter_JCalls");
14902         atomic_init(&calls->refcnt, 1);
14903         calls->instance_ptr = o;
14904
14905         LDKMessageRouter ret = {
14906                 .this_arg = (void*) calls,
14907                 .find_path = find_path_LDKMessageRouter_jcall,
14908                 .free = LDKMessageRouter_JCalls_free,
14909         };
14910         return ret;
14911 }
14912 uint64_t  __attribute__((export_name("TS_LDKMessageRouter_new"))) TS_LDKMessageRouter_new(JSValue o) {
14913         LDKMessageRouter *res_ptr = MALLOC(sizeof(LDKMessageRouter), "LDKMessageRouter");
14914         *res_ptr = LDKMessageRouter_init(o);
14915         return tag_ptr(res_ptr, true);
14916 }
14917 uint64_t  __attribute__((export_name("TS_MessageRouter_find_path"))) TS_MessageRouter_find_path(uint64_t this_arg, int8_tArray sender, ptrArray peers, uint64_t destination) {
14918         void* this_arg_ptr = untag_ptr(this_arg);
14919         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
14920         LDKMessageRouter* this_arg_conv = (LDKMessageRouter*)this_arg_ptr;
14921         LDKPublicKey sender_ref;
14922         CHECK(sender->arr_len == 33);
14923         memcpy(sender_ref.compressed_form, sender->elems, 33); FREE(sender);
14924         LDKCVec_PublicKeyZ peers_constr;
14925         peers_constr.datalen = peers->arr_len;
14926         if (peers_constr.datalen > 0)
14927                 peers_constr.data = MALLOC(peers_constr.datalen * sizeof(LDKPublicKey), "LDKCVec_PublicKeyZ Elements");
14928         else
14929                 peers_constr.data = NULL;
14930         int8_tArray* peers_vals = (void*) peers->elems;
14931         for (size_t m = 0; m < peers_constr.datalen; m++) {
14932                 int8_tArray peers_conv_12 = peers_vals[m];
14933                 LDKPublicKey peers_conv_12_ref;
14934                 CHECK(peers_conv_12->arr_len == 33);
14935                 memcpy(peers_conv_12_ref.compressed_form, peers_conv_12->elems, 33); FREE(peers_conv_12);
14936                 peers_constr.data[m] = peers_conv_12_ref;
14937         }
14938         FREE(peers);
14939         void* destination_ptr = untag_ptr(destination);
14940         CHECK_ACCESS(destination_ptr);
14941         LDKDestination destination_conv = *(LDKDestination*)(destination_ptr);
14942         destination_conv = Destination_clone((LDKDestination*)untag_ptr(destination));
14943         LDKCResult_OnionMessagePathNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_OnionMessagePathNoneZ), "LDKCResult_OnionMessagePathNoneZ");
14944         *ret_conv = (this_arg_conv->find_path)(this_arg_conv->this_arg, sender_ref, peers_constr, destination_conv);
14945         return tag_ptr(ret_conv, true);
14946 }
14947
14948 typedef struct LDKCoinSelectionSource_JCalls {
14949         atomic_size_t refcnt;
14950         uint32_t instance_ptr;
14951 } LDKCoinSelectionSource_JCalls;
14952 static void LDKCoinSelectionSource_JCalls_free(void* this_arg) {
14953         LDKCoinSelectionSource_JCalls *j_calls = (LDKCoinSelectionSource_JCalls*) this_arg;
14954         if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
14955                 FREE(j_calls);
14956         }
14957 }
14958 LDKCResult_CoinSelectionNoneZ select_confirmed_utxos_LDKCoinSelectionSource_jcall(const void* this_arg, LDKThirtyTwoBytes claim_id, LDKCVec_InputZ must_spend, LDKCVec_TxOutZ must_pay_to, uint32_t target_feerate_sat_per_1000_weight) {
14959         LDKCoinSelectionSource_JCalls *j_calls = (LDKCoinSelectionSource_JCalls*) this_arg;
14960         int8_tArray claim_id_arr = init_int8_tArray(32, __LINE__);
14961         memcpy(claim_id_arr->elems, claim_id.data, 32);
14962         LDKCVec_InputZ must_spend_var = must_spend;
14963         uint64_tArray must_spend_arr = NULL;
14964         must_spend_arr = init_uint64_tArray(must_spend_var.datalen, __LINE__);
14965         uint64_t *must_spend_arr_ptr = (uint64_t*)(((uint8_t*)must_spend_arr) + 8);
14966         for (size_t h = 0; h < must_spend_var.datalen; h++) {
14967                 LDKInput must_spend_conv_7_var = must_spend_var.data[h];
14968                 uint64_t must_spend_conv_7_ref = 0;
14969                 CHECK_INNER_FIELD_ACCESS_OR_NULL(must_spend_conv_7_var);
14970                 must_spend_conv_7_ref = tag_ptr(must_spend_conv_7_var.inner, must_spend_conv_7_var.is_owned);
14971                 must_spend_arr_ptr[h] = must_spend_conv_7_ref;
14972         }
14973         
14974         FREE(must_spend_var.data);
14975         LDKCVec_TxOutZ must_pay_to_var = must_pay_to;
14976         uint64_tArray must_pay_to_arr = NULL;
14977         must_pay_to_arr = init_uint64_tArray(must_pay_to_var.datalen, __LINE__);
14978         uint64_t *must_pay_to_arr_ptr = (uint64_t*)(((uint8_t*)must_pay_to_arr) + 8);
14979         for (size_t h = 0; h < must_pay_to_var.datalen; h++) {
14980                 LDKTxOut* must_pay_to_conv_7_ref = MALLOC(sizeof(LDKTxOut), "LDKTxOut");
14981                 *must_pay_to_conv_7_ref = must_pay_to_var.data[h];
14982                 must_pay_to_arr_ptr[h] = tag_ptr(must_pay_to_conv_7_ref, true);
14983         }
14984         
14985         FREE(must_pay_to_var.data);
14986         int32_t target_feerate_sat_per_1000_weight_conv = target_feerate_sat_per_1000_weight;
14987         uint64_t ret = js_invoke_function_uuuuuu(j_calls->instance_ptr, 142, (uint32_t)claim_id_arr, (uint32_t)must_spend_arr, (uint32_t)must_pay_to_arr, target_feerate_sat_per_1000_weight_conv, 0, 0);
14988         void* ret_ptr = untag_ptr(ret);
14989         CHECK_ACCESS(ret_ptr);
14990         LDKCResult_CoinSelectionNoneZ ret_conv = *(LDKCResult_CoinSelectionNoneZ*)(ret_ptr);
14991         FREE(untag_ptr(ret));
14992         return ret_conv;
14993 }
14994 LDKCResult_TransactionNoneZ sign_tx_LDKCoinSelectionSource_jcall(const void* this_arg, LDKTransaction tx) {
14995         LDKCoinSelectionSource_JCalls *j_calls = (LDKCoinSelectionSource_JCalls*) this_arg;
14996         LDKTransaction tx_var = tx;
14997         int8_tArray tx_arr = init_int8_tArray(tx_var.datalen, __LINE__);
14998         memcpy(tx_arr->elems, tx_var.data, tx_var.datalen);
14999         Transaction_free(tx_var);
15000         uint64_t ret = js_invoke_function_uuuuuu(j_calls->instance_ptr, 143, (uint32_t)tx_arr, 0, 0, 0, 0, 0);
15001         void* ret_ptr = untag_ptr(ret);
15002         CHECK_ACCESS(ret_ptr);
15003         LDKCResult_TransactionNoneZ ret_conv = *(LDKCResult_TransactionNoneZ*)(ret_ptr);
15004         FREE(untag_ptr(ret));
15005         return ret_conv;
15006 }
15007 static void LDKCoinSelectionSource_JCalls_cloned(LDKCoinSelectionSource* new_obj) {
15008         LDKCoinSelectionSource_JCalls *j_calls = (LDKCoinSelectionSource_JCalls*) new_obj->this_arg;
15009         atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
15010 }
15011 static inline LDKCoinSelectionSource LDKCoinSelectionSource_init (JSValue o) {
15012         LDKCoinSelectionSource_JCalls *calls = MALLOC(sizeof(LDKCoinSelectionSource_JCalls), "LDKCoinSelectionSource_JCalls");
15013         atomic_init(&calls->refcnt, 1);
15014         calls->instance_ptr = o;
15015
15016         LDKCoinSelectionSource ret = {
15017                 .this_arg = (void*) calls,
15018                 .select_confirmed_utxos = select_confirmed_utxos_LDKCoinSelectionSource_jcall,
15019                 .sign_tx = sign_tx_LDKCoinSelectionSource_jcall,
15020                 .free = LDKCoinSelectionSource_JCalls_free,
15021         };
15022         return ret;
15023 }
15024 uint64_t  __attribute__((export_name("TS_LDKCoinSelectionSource_new"))) TS_LDKCoinSelectionSource_new(JSValue o) {
15025         LDKCoinSelectionSource *res_ptr = MALLOC(sizeof(LDKCoinSelectionSource), "LDKCoinSelectionSource");
15026         *res_ptr = LDKCoinSelectionSource_init(o);
15027         return tag_ptr(res_ptr, true);
15028 }
15029 uint64_t  __attribute__((export_name("TS_CoinSelectionSource_select_confirmed_utxos"))) TS_CoinSelectionSource_select_confirmed_utxos(uint64_t this_arg, int8_tArray claim_id, uint64_tArray must_spend, uint64_tArray must_pay_to, int32_t target_feerate_sat_per_1000_weight) {
15030         void* this_arg_ptr = untag_ptr(this_arg);
15031         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
15032         LDKCoinSelectionSource* this_arg_conv = (LDKCoinSelectionSource*)this_arg_ptr;
15033         LDKThirtyTwoBytes claim_id_ref;
15034         CHECK(claim_id->arr_len == 32);
15035         memcpy(claim_id_ref.data, claim_id->elems, 32); FREE(claim_id);
15036         LDKCVec_InputZ must_spend_constr;
15037         must_spend_constr.datalen = must_spend->arr_len;
15038         if (must_spend_constr.datalen > 0)
15039                 must_spend_constr.data = MALLOC(must_spend_constr.datalen * sizeof(LDKInput), "LDKCVec_InputZ Elements");
15040         else
15041                 must_spend_constr.data = NULL;
15042         uint64_t* must_spend_vals = must_spend->elems;
15043         for (size_t h = 0; h < must_spend_constr.datalen; h++) {
15044                 uint64_t must_spend_conv_7 = must_spend_vals[h];
15045                 LDKInput must_spend_conv_7_conv;
15046                 must_spend_conv_7_conv.inner = untag_ptr(must_spend_conv_7);
15047                 must_spend_conv_7_conv.is_owned = ptr_is_owned(must_spend_conv_7);
15048                 CHECK_INNER_FIELD_ACCESS_OR_NULL(must_spend_conv_7_conv);
15049                 must_spend_conv_7_conv = Input_clone(&must_spend_conv_7_conv);
15050                 must_spend_constr.data[h] = must_spend_conv_7_conv;
15051         }
15052         FREE(must_spend);
15053         LDKCVec_TxOutZ must_pay_to_constr;
15054         must_pay_to_constr.datalen = must_pay_to->arr_len;
15055         if (must_pay_to_constr.datalen > 0)
15056                 must_pay_to_constr.data = MALLOC(must_pay_to_constr.datalen * sizeof(LDKTxOut), "LDKCVec_TxOutZ Elements");
15057         else
15058                 must_pay_to_constr.data = NULL;
15059         uint64_t* must_pay_to_vals = must_pay_to->elems;
15060         for (size_t h = 0; h < must_pay_to_constr.datalen; h++) {
15061                 uint64_t must_pay_to_conv_7 = must_pay_to_vals[h];
15062                 void* must_pay_to_conv_7_ptr = untag_ptr(must_pay_to_conv_7);
15063                 CHECK_ACCESS(must_pay_to_conv_7_ptr);
15064                 LDKTxOut must_pay_to_conv_7_conv = *(LDKTxOut*)(must_pay_to_conv_7_ptr);
15065                 must_pay_to_conv_7_conv = TxOut_clone((LDKTxOut*)untag_ptr(must_pay_to_conv_7));
15066                 must_pay_to_constr.data[h] = must_pay_to_conv_7_conv;
15067         }
15068         FREE(must_pay_to);
15069         LDKCResult_CoinSelectionNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_CoinSelectionNoneZ), "LDKCResult_CoinSelectionNoneZ");
15070         *ret_conv = (this_arg_conv->select_confirmed_utxos)(this_arg_conv->this_arg, claim_id_ref, must_spend_constr, must_pay_to_constr, target_feerate_sat_per_1000_weight);
15071         return tag_ptr(ret_conv, true);
15072 }
15073
15074 uint64_t  __attribute__((export_name("TS_CoinSelectionSource_sign_tx"))) TS_CoinSelectionSource_sign_tx(uint64_t this_arg, int8_tArray tx) {
15075         void* this_arg_ptr = untag_ptr(this_arg);
15076         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
15077         LDKCoinSelectionSource* this_arg_conv = (LDKCoinSelectionSource*)this_arg_ptr;
15078         LDKTransaction tx_ref;
15079         tx_ref.datalen = tx->arr_len;
15080         tx_ref.data = MALLOC(tx_ref.datalen, "LDKTransaction Bytes");
15081         memcpy(tx_ref.data, tx->elems, tx_ref.datalen); FREE(tx);
15082         tx_ref.data_is_owned = true;
15083         LDKCResult_TransactionNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_TransactionNoneZ), "LDKCResult_TransactionNoneZ");
15084         *ret_conv = (this_arg_conv->sign_tx)(this_arg_conv->this_arg, tx_ref);
15085         return tag_ptr(ret_conv, true);
15086 }
15087
15088 typedef struct LDKWalletSource_JCalls {
15089         atomic_size_t refcnt;
15090         uint32_t instance_ptr;
15091 } LDKWalletSource_JCalls;
15092 static void LDKWalletSource_JCalls_free(void* this_arg) {
15093         LDKWalletSource_JCalls *j_calls = (LDKWalletSource_JCalls*) this_arg;
15094         if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
15095                 FREE(j_calls);
15096         }
15097 }
15098 LDKCResult_CVec_UtxoZNoneZ list_confirmed_utxos_LDKWalletSource_jcall(const void* this_arg) {
15099         LDKWalletSource_JCalls *j_calls = (LDKWalletSource_JCalls*) this_arg;
15100         uint64_t ret = js_invoke_function_uuuuuu(j_calls->instance_ptr, 144, 0, 0, 0, 0, 0, 0);
15101         void* ret_ptr = untag_ptr(ret);
15102         CHECK_ACCESS(ret_ptr);
15103         LDKCResult_CVec_UtxoZNoneZ ret_conv = *(LDKCResult_CVec_UtxoZNoneZ*)(ret_ptr);
15104         FREE(untag_ptr(ret));
15105         return ret_conv;
15106 }
15107 LDKCResult_CVec_u8ZNoneZ get_change_script_LDKWalletSource_jcall(const void* this_arg) {
15108         LDKWalletSource_JCalls *j_calls = (LDKWalletSource_JCalls*) this_arg;
15109         uint64_t ret = js_invoke_function_uuuuuu(j_calls->instance_ptr, 145, 0, 0, 0, 0, 0, 0);
15110         void* ret_ptr = untag_ptr(ret);
15111         CHECK_ACCESS(ret_ptr);
15112         LDKCResult_CVec_u8ZNoneZ ret_conv = *(LDKCResult_CVec_u8ZNoneZ*)(ret_ptr);
15113         FREE(untag_ptr(ret));
15114         return ret_conv;
15115 }
15116 LDKCResult_TransactionNoneZ sign_tx_LDKWalletSource_jcall(const void* this_arg, LDKTransaction tx) {
15117         LDKWalletSource_JCalls *j_calls = (LDKWalletSource_JCalls*) this_arg;
15118         LDKTransaction tx_var = tx;
15119         int8_tArray tx_arr = init_int8_tArray(tx_var.datalen, __LINE__);
15120         memcpy(tx_arr->elems, tx_var.data, tx_var.datalen);
15121         Transaction_free(tx_var);
15122         uint64_t ret = js_invoke_function_uuuuuu(j_calls->instance_ptr, 146, (uint32_t)tx_arr, 0, 0, 0, 0, 0);
15123         void* ret_ptr = untag_ptr(ret);
15124         CHECK_ACCESS(ret_ptr);
15125         LDKCResult_TransactionNoneZ ret_conv = *(LDKCResult_TransactionNoneZ*)(ret_ptr);
15126         FREE(untag_ptr(ret));
15127         return ret_conv;
15128 }
15129 static void LDKWalletSource_JCalls_cloned(LDKWalletSource* new_obj) {
15130         LDKWalletSource_JCalls *j_calls = (LDKWalletSource_JCalls*) new_obj->this_arg;
15131         atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
15132 }
15133 static inline LDKWalletSource LDKWalletSource_init (JSValue o) {
15134         LDKWalletSource_JCalls *calls = MALLOC(sizeof(LDKWalletSource_JCalls), "LDKWalletSource_JCalls");
15135         atomic_init(&calls->refcnt, 1);
15136         calls->instance_ptr = o;
15137
15138         LDKWalletSource ret = {
15139                 .this_arg = (void*) calls,
15140                 .list_confirmed_utxos = list_confirmed_utxos_LDKWalletSource_jcall,
15141                 .get_change_script = get_change_script_LDKWalletSource_jcall,
15142                 .sign_tx = sign_tx_LDKWalletSource_jcall,
15143                 .free = LDKWalletSource_JCalls_free,
15144         };
15145         return ret;
15146 }
15147 uint64_t  __attribute__((export_name("TS_LDKWalletSource_new"))) TS_LDKWalletSource_new(JSValue o) {
15148         LDKWalletSource *res_ptr = MALLOC(sizeof(LDKWalletSource), "LDKWalletSource");
15149         *res_ptr = LDKWalletSource_init(o);
15150         return tag_ptr(res_ptr, true);
15151 }
15152 uint64_t  __attribute__((export_name("TS_WalletSource_list_confirmed_utxos"))) TS_WalletSource_list_confirmed_utxos(uint64_t this_arg) {
15153         void* this_arg_ptr = untag_ptr(this_arg);
15154         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
15155         LDKWalletSource* this_arg_conv = (LDKWalletSource*)this_arg_ptr;
15156         LDKCResult_CVec_UtxoZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_UtxoZNoneZ), "LDKCResult_CVec_UtxoZNoneZ");
15157         *ret_conv = (this_arg_conv->list_confirmed_utxos)(this_arg_conv->this_arg);
15158         return tag_ptr(ret_conv, true);
15159 }
15160
15161 uint64_t  __attribute__((export_name("TS_WalletSource_get_change_script"))) TS_WalletSource_get_change_script(uint64_t this_arg) {
15162         void* this_arg_ptr = untag_ptr(this_arg);
15163         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
15164         LDKWalletSource* this_arg_conv = (LDKWalletSource*)this_arg_ptr;
15165         LDKCResult_CVec_u8ZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_u8ZNoneZ), "LDKCResult_CVec_u8ZNoneZ");
15166         *ret_conv = (this_arg_conv->get_change_script)(this_arg_conv->this_arg);
15167         return tag_ptr(ret_conv, true);
15168 }
15169
15170 uint64_t  __attribute__((export_name("TS_WalletSource_sign_tx"))) TS_WalletSource_sign_tx(uint64_t this_arg, int8_tArray tx) {
15171         void* this_arg_ptr = untag_ptr(this_arg);
15172         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
15173         LDKWalletSource* this_arg_conv = (LDKWalletSource*)this_arg_ptr;
15174         LDKTransaction tx_ref;
15175         tx_ref.datalen = tx->arr_len;
15176         tx_ref.data = MALLOC(tx_ref.datalen, "LDKTransaction Bytes");
15177         memcpy(tx_ref.data, tx->elems, tx_ref.datalen); FREE(tx);
15178         tx_ref.data_is_owned = true;
15179         LDKCResult_TransactionNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_TransactionNoneZ), "LDKCResult_TransactionNoneZ");
15180         *ret_conv = (this_arg_conv->sign_tx)(this_arg_conv->this_arg, tx_ref);
15181         return tag_ptr(ret_conv, true);
15182 }
15183
15184 uint32_t __attribute__((export_name("TS_LDKGossipSync_ty_from_ptr"))) TS_LDKGossipSync_ty_from_ptr(uint64_t ptr) {
15185         LDKGossipSync *obj = (LDKGossipSync*)untag_ptr(ptr);
15186         switch(obj->tag) {
15187                 case LDKGossipSync_P2P: return 0;
15188                 case LDKGossipSync_Rapid: return 1;
15189                 case LDKGossipSync_None: return 2;
15190                 default: abort();
15191         }
15192 }
15193 uint64_t __attribute__((export_name("TS_LDKGossipSync_P2P_get_p2p"))) TS_LDKGossipSync_P2P_get_p2p(uint64_t ptr) {
15194         LDKGossipSync *obj = (LDKGossipSync*)untag_ptr(ptr);
15195         assert(obj->tag == LDKGossipSync_P2P);
15196         LDKP2PGossipSync p2p_var = obj->p2p;
15197                         uint64_t p2p_ref = 0;
15198                         CHECK_INNER_FIELD_ACCESS_OR_NULL(p2p_var);
15199                         p2p_ref = tag_ptr(p2p_var.inner, false);
15200         return p2p_ref;
15201 }
15202 uint64_t __attribute__((export_name("TS_LDKGossipSync_Rapid_get_rapid"))) TS_LDKGossipSync_Rapid_get_rapid(uint64_t ptr) {
15203         LDKGossipSync *obj = (LDKGossipSync*)untag_ptr(ptr);
15204         assert(obj->tag == LDKGossipSync_Rapid);
15205         LDKRapidGossipSync rapid_var = obj->rapid;
15206                         uint64_t rapid_ref = 0;
15207                         CHECK_INNER_FIELD_ACCESS_OR_NULL(rapid_var);
15208                         rapid_ref = tag_ptr(rapid_var.inner, false);
15209         return rapid_ref;
15210 }
15211 uint32_t __attribute__((export_name("TS_LDKFallback_ty_from_ptr"))) TS_LDKFallback_ty_from_ptr(uint64_t ptr) {
15212         LDKFallback *obj = (LDKFallback*)untag_ptr(ptr);
15213         switch(obj->tag) {
15214                 case LDKFallback_SegWitProgram: return 0;
15215                 case LDKFallback_PubKeyHash: return 1;
15216                 case LDKFallback_ScriptHash: return 2;
15217                 default: abort();
15218         }
15219 }
15220 int8_t __attribute__((export_name("TS_LDKFallback_SegWitProgram_get_version"))) TS_LDKFallback_SegWitProgram_get_version(uint64_t ptr) {
15221         LDKFallback *obj = (LDKFallback*)untag_ptr(ptr);
15222         assert(obj->tag == LDKFallback_SegWitProgram);
15223         uint8_t version_val = obj->seg_wit_program.version._0;
15224         return version_val;
15225 }
15226 int8_tArray __attribute__((export_name("TS_LDKFallback_SegWitProgram_get_program"))) TS_LDKFallback_SegWitProgram_get_program(uint64_t ptr) {
15227         LDKFallback *obj = (LDKFallback*)untag_ptr(ptr);
15228         assert(obj->tag == LDKFallback_SegWitProgram);
15229         LDKCVec_u8Z program_var = obj->seg_wit_program.program;
15230                         int8_tArray program_arr = init_int8_tArray(program_var.datalen, __LINE__);
15231                         memcpy(program_arr->elems, program_var.data, program_var.datalen);
15232         return program_arr;
15233 }
15234 int8_tArray __attribute__((export_name("TS_LDKFallback_PubKeyHash_get_pub_key_hash"))) TS_LDKFallback_PubKeyHash_get_pub_key_hash(uint64_t ptr) {
15235         LDKFallback *obj = (LDKFallback*)untag_ptr(ptr);
15236         assert(obj->tag == LDKFallback_PubKeyHash);
15237         int8_tArray pub_key_hash_arr = init_int8_tArray(20, __LINE__);
15238         memcpy(pub_key_hash_arr->elems, obj->pub_key_hash.data, 20);
15239         return pub_key_hash_arr;
15240 }
15241 int8_tArray __attribute__((export_name("TS_LDKFallback_ScriptHash_get_script_hash"))) TS_LDKFallback_ScriptHash_get_script_hash(uint64_t ptr) {
15242         LDKFallback *obj = (LDKFallback*)untag_ptr(ptr);
15243         assert(obj->tag == LDKFallback_ScriptHash);
15244         int8_tArray script_hash_arr = init_int8_tArray(20, __LINE__);
15245         memcpy(script_hash_arr->elems, obj->script_hash.data, 20);
15246         return script_hash_arr;
15247 }
15248 jstring  __attribute__((export_name("TS__ldk_get_compiled_version"))) TS__ldk_get_compiled_version() {
15249         LDKStr ret_str = _ldk_get_compiled_version();
15250         jstring ret_conv = str_ref_to_ts(ret_str.chars, ret_str.len);
15251         Str_free(ret_str);
15252         return ret_conv;
15253 }
15254
15255 jstring  __attribute__((export_name("TS__ldk_c_bindings_get_compiled_version"))) TS__ldk_c_bindings_get_compiled_version() {
15256         LDKStr ret_str = _ldk_c_bindings_get_compiled_version();
15257         jstring ret_conv = str_ref_to_ts(ret_str.chars, ret_str.len);
15258         Str_free(ret_str);
15259         return ret_conv;
15260 }
15261
15262 int8_tArray  __attribute__((export_name("TS_U128_le_bytes"))) TS_U128_le_bytes(int8_tArray val) {
15263         LDKU128 val_ref;
15264         CHECK(val->arr_len == 16);
15265         memcpy(val_ref.le_bytes, val->elems, 16); FREE(val);
15266         int8_tArray ret_arr = init_int8_tArray(16, __LINE__);
15267         memcpy(ret_arr->elems, U128_le_bytes(val_ref).data, 16);
15268         return ret_arr;
15269 }
15270
15271 int8_tArray  __attribute__((export_name("TS_U128_new"))) TS_U128_new(int8_tArray le_bytes) {
15272         LDKSixteenBytes le_bytes_ref;
15273         CHECK(le_bytes->arr_len == 16);
15274         memcpy(le_bytes_ref.data, le_bytes->elems, 16); FREE(le_bytes);
15275         int8_tArray ret_arr = init_int8_tArray(16, __LINE__);
15276         memcpy(ret_arr->elems, U128_new(le_bytes_ref).le_bytes, 16);
15277         return ret_arr;
15278 }
15279
15280 uint64_t  __attribute__((export_name("TS_BigEndianScalar_new"))) TS_BigEndianScalar_new(int8_tArray big_endian_bytes) {
15281         LDKThirtyTwoBytes big_endian_bytes_ref;
15282         CHECK(big_endian_bytes->arr_len == 32);
15283         memcpy(big_endian_bytes_ref.data, big_endian_bytes->elems, 32); FREE(big_endian_bytes);
15284         LDKBigEndianScalar* ret_ref = MALLOC(sizeof(LDKBigEndianScalar), "LDKBigEndianScalar");
15285         *ret_ref = BigEndianScalar_new(big_endian_bytes_ref);
15286         return tag_ptr(ret_ref, true);
15287 }
15288
15289 static inline uint64_t Bech32Error_clone_ptr(LDKBech32Error *NONNULL_PTR arg) {
15290         LDKBech32Error *ret_copy = MALLOC(sizeof(LDKBech32Error), "LDKBech32Error");
15291         *ret_copy = Bech32Error_clone(arg);
15292         uint64_t ret_ref = tag_ptr(ret_copy, true);
15293         return ret_ref;
15294 }
15295 int64_t  __attribute__((export_name("TS_Bech32Error_clone_ptr"))) TS_Bech32Error_clone_ptr(uint64_t arg) {
15296         LDKBech32Error* arg_conv = (LDKBech32Error*)untag_ptr(arg);
15297         int64_t ret_conv = Bech32Error_clone_ptr(arg_conv);
15298         return ret_conv;
15299 }
15300
15301 uint64_t  __attribute__((export_name("TS_Bech32Error_clone"))) TS_Bech32Error_clone(uint64_t orig) {
15302         LDKBech32Error* orig_conv = (LDKBech32Error*)untag_ptr(orig);
15303         LDKBech32Error *ret_copy = MALLOC(sizeof(LDKBech32Error), "LDKBech32Error");
15304         *ret_copy = Bech32Error_clone(orig_conv);
15305         uint64_t ret_ref = tag_ptr(ret_copy, true);
15306         return ret_ref;
15307 }
15308
15309 void  __attribute__((export_name("TS_Bech32Error_free"))) TS_Bech32Error_free(uint64_t o) {
15310         if (!ptr_is_owned(o)) return;
15311         void* o_ptr = untag_ptr(o);
15312         CHECK_ACCESS(o_ptr);
15313         LDKBech32Error o_conv = *(LDKBech32Error*)(o_ptr);
15314         FREE(untag_ptr(o));
15315         Bech32Error_free(o_conv);
15316 }
15317
15318 void  __attribute__((export_name("TS_Transaction_free"))) TS_Transaction_free(int8_tArray _res) {
15319         LDKTransaction _res_ref;
15320         _res_ref.datalen = _res->arr_len;
15321         _res_ref.data = MALLOC(_res_ref.datalen, "LDKTransaction Bytes");
15322         memcpy(_res_ref.data, _res->elems, _res_ref.datalen); FREE(_res);
15323         _res_ref.data_is_owned = true;
15324         Transaction_free(_res_ref);
15325 }
15326
15327 void  __attribute__((export_name("TS_Witness_free"))) TS_Witness_free(int8_tArray _res) {
15328         LDKWitness _res_ref;
15329         _res_ref.datalen = _res->arr_len;
15330         _res_ref.data = MALLOC(_res_ref.datalen, "LDKWitness Bytes");
15331         memcpy(_res_ref.data, _res->elems, _res_ref.datalen); FREE(_res);
15332         _res_ref.data_is_owned = true;
15333         Witness_free(_res_ref);
15334 }
15335
15336 void  __attribute__((export_name("TS_TxIn_free"))) TS_TxIn_free(uint64_t _res) {
15337         if (!ptr_is_owned(_res)) return;
15338         void* _res_ptr = untag_ptr(_res);
15339         CHECK_ACCESS(_res_ptr);
15340         LDKTxIn _res_conv = *(LDKTxIn*)(_res_ptr);
15341         FREE(untag_ptr(_res));
15342         TxIn_free(_res_conv);
15343 }
15344
15345 uint64_t  __attribute__((export_name("TS_TxIn_new"))) TS_TxIn_new(int8_tArray witness, int8_tArray script_sig, int32_t sequence, int8_tArray previous_txid, int32_t previous_vout) {
15346         LDKWitness witness_ref;
15347         witness_ref.datalen = witness->arr_len;
15348         witness_ref.data = MALLOC(witness_ref.datalen, "LDKWitness Bytes");
15349         memcpy(witness_ref.data, witness->elems, witness_ref.datalen); FREE(witness);
15350         witness_ref.data_is_owned = true;
15351         LDKCVec_u8Z script_sig_ref;
15352         script_sig_ref.datalen = script_sig->arr_len;
15353         script_sig_ref.data = MALLOC(script_sig_ref.datalen, "LDKCVec_u8Z Bytes");
15354         memcpy(script_sig_ref.data, script_sig->elems, script_sig_ref.datalen); FREE(script_sig);
15355         LDKThirtyTwoBytes previous_txid_ref;
15356         CHECK(previous_txid->arr_len == 32);
15357         memcpy(previous_txid_ref.data, previous_txid->elems, 32); FREE(previous_txid);
15358         LDKTxIn* ret_ref = MALLOC(sizeof(LDKTxIn), "LDKTxIn");
15359         *ret_ref = TxIn_new(witness_ref, script_sig_ref, sequence, previous_txid_ref, previous_vout);
15360         return tag_ptr(ret_ref, true);
15361 }
15362
15363 uint64_t  __attribute__((export_name("TS_TxOut_new"))) TS_TxOut_new(int8_tArray script_pubkey, int64_t value) {
15364         LDKCVec_u8Z script_pubkey_ref;
15365         script_pubkey_ref.datalen = script_pubkey->arr_len;
15366         script_pubkey_ref.data = MALLOC(script_pubkey_ref.datalen, "LDKCVec_u8Z Bytes");
15367         memcpy(script_pubkey_ref.data, script_pubkey->elems, script_pubkey_ref.datalen); FREE(script_pubkey);
15368         LDKTxOut* ret_ref = MALLOC(sizeof(LDKTxOut), "LDKTxOut");
15369         *ret_ref = TxOut_new(script_pubkey_ref, value);
15370         return tag_ptr(ret_ref, true);
15371 }
15372
15373 void  __attribute__((export_name("TS_TxOut_free"))) TS_TxOut_free(uint64_t _res) {
15374         if (!ptr_is_owned(_res)) return;
15375         void* _res_ptr = untag_ptr(_res);
15376         CHECK_ACCESS(_res_ptr);
15377         LDKTxOut _res_conv = *(LDKTxOut*)(_res_ptr);
15378         FREE(untag_ptr(_res));
15379         TxOut_free(_res_conv);
15380 }
15381
15382 static inline uint64_t TxOut_clone_ptr(LDKTxOut *NONNULL_PTR arg) {
15383         LDKTxOut* ret_ref = MALLOC(sizeof(LDKTxOut), "LDKTxOut");
15384         *ret_ref = TxOut_clone(arg);
15385         return tag_ptr(ret_ref, true);
15386 }
15387 int64_t  __attribute__((export_name("TS_TxOut_clone_ptr"))) TS_TxOut_clone_ptr(uint64_t arg) {
15388         LDKTxOut* arg_conv = (LDKTxOut*)untag_ptr(arg);
15389         int64_t ret_conv = TxOut_clone_ptr(arg_conv);
15390         return ret_conv;
15391 }
15392
15393 uint64_t  __attribute__((export_name("TS_TxOut_clone"))) TS_TxOut_clone(uint64_t orig) {
15394         LDKTxOut* orig_conv = (LDKTxOut*)untag_ptr(orig);
15395         LDKTxOut* ret_ref = MALLOC(sizeof(LDKTxOut), "LDKTxOut");
15396         *ret_ref = TxOut_clone(orig_conv);
15397         return tag_ptr(ret_ref, true);
15398 }
15399
15400 void  __attribute__((export_name("TS_Str_free"))) TS_Str_free(jstring _res) {
15401         LDKStr dummy = { .chars = NULL, .len = 0, .chars_is_owned = false };
15402         Str_free(dummy);
15403 }
15404
15405 uint64_t  __attribute__((export_name("TS_COption_u64Z_some"))) TS_COption_u64Z_some(int64_t o) {
15406         LDKCOption_u64Z *ret_copy = MALLOC(sizeof(LDKCOption_u64Z), "LDKCOption_u64Z");
15407         *ret_copy = COption_u64Z_some(o);
15408         uint64_t ret_ref = tag_ptr(ret_copy, true);
15409         return ret_ref;
15410 }
15411
15412 uint64_t  __attribute__((export_name("TS_COption_u64Z_none"))) TS_COption_u64Z_none() {
15413         LDKCOption_u64Z *ret_copy = MALLOC(sizeof(LDKCOption_u64Z), "LDKCOption_u64Z");
15414         *ret_copy = COption_u64Z_none();
15415         uint64_t ret_ref = tag_ptr(ret_copy, true);
15416         return ret_ref;
15417 }
15418
15419 void  __attribute__((export_name("TS_COption_u64Z_free"))) TS_COption_u64Z_free(uint64_t _res) {
15420         if (!ptr_is_owned(_res)) return;
15421         void* _res_ptr = untag_ptr(_res);
15422         CHECK_ACCESS(_res_ptr);
15423         LDKCOption_u64Z _res_conv = *(LDKCOption_u64Z*)(_res_ptr);
15424         FREE(untag_ptr(_res));
15425         COption_u64Z_free(_res_conv);
15426 }
15427
15428 static inline uint64_t COption_u64Z_clone_ptr(LDKCOption_u64Z *NONNULL_PTR arg) {
15429         LDKCOption_u64Z *ret_copy = MALLOC(sizeof(LDKCOption_u64Z), "LDKCOption_u64Z");
15430         *ret_copy = COption_u64Z_clone(arg);
15431         uint64_t ret_ref = tag_ptr(ret_copy, true);
15432         return ret_ref;
15433 }
15434 int64_t  __attribute__((export_name("TS_COption_u64Z_clone_ptr"))) TS_COption_u64Z_clone_ptr(uint64_t arg) {
15435         LDKCOption_u64Z* arg_conv = (LDKCOption_u64Z*)untag_ptr(arg);
15436         int64_t ret_conv = COption_u64Z_clone_ptr(arg_conv);
15437         return ret_conv;
15438 }
15439
15440 uint64_t  __attribute__((export_name("TS_COption_u64Z_clone"))) TS_COption_u64Z_clone(uint64_t orig) {
15441         LDKCOption_u64Z* orig_conv = (LDKCOption_u64Z*)untag_ptr(orig);
15442         LDKCOption_u64Z *ret_copy = MALLOC(sizeof(LDKCOption_u64Z), "LDKCOption_u64Z");
15443         *ret_copy = COption_u64Z_clone(orig_conv);
15444         uint64_t ret_ref = tag_ptr(ret_copy, true);
15445         return ret_ref;
15446 }
15447
15448 void  __attribute__((export_name("TS_CVec_BlindedPathZ_free"))) TS_CVec_BlindedPathZ_free(uint64_tArray _res) {
15449         LDKCVec_BlindedPathZ _res_constr;
15450         _res_constr.datalen = _res->arr_len;
15451         if (_res_constr.datalen > 0)
15452                 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKBlindedPath), "LDKCVec_BlindedPathZ Elements");
15453         else
15454                 _res_constr.data = NULL;
15455         uint64_t* _res_vals = _res->elems;
15456         for (size_t n = 0; n < _res_constr.datalen; n++) {
15457                 uint64_t _res_conv_13 = _res_vals[n];
15458                 LDKBlindedPath _res_conv_13_conv;
15459                 _res_conv_13_conv.inner = untag_ptr(_res_conv_13);
15460                 _res_conv_13_conv.is_owned = ptr_is_owned(_res_conv_13);
15461                 CHECK_INNER_FIELD_ACCESS_OR_NULL(_res_conv_13_conv);
15462                 _res_constr.data[n] = _res_conv_13_conv;
15463         }
15464         FREE(_res);
15465         CVec_BlindedPathZ_free(_res_constr);
15466 }
15467
15468 uint64_t  __attribute__((export_name("TS_CResult_RefundBolt12ParseErrorZ_ok"))) TS_CResult_RefundBolt12ParseErrorZ_ok(uint64_t o) {
15469         LDKRefund o_conv;
15470         o_conv.inner = untag_ptr(o);
15471         o_conv.is_owned = ptr_is_owned(o);
15472         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
15473         o_conv = Refund_clone(&o_conv);
15474         LDKCResult_RefundBolt12ParseErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RefundBolt12ParseErrorZ), "LDKCResult_RefundBolt12ParseErrorZ");
15475         *ret_conv = CResult_RefundBolt12ParseErrorZ_ok(o_conv);
15476         return tag_ptr(ret_conv, true);
15477 }
15478
15479 uint64_t  __attribute__((export_name("TS_CResult_RefundBolt12ParseErrorZ_err"))) TS_CResult_RefundBolt12ParseErrorZ_err(uint64_t e) {
15480         LDKBolt12ParseError e_conv;
15481         e_conv.inner = untag_ptr(e);
15482         e_conv.is_owned = ptr_is_owned(e);
15483         CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
15484         e_conv = Bolt12ParseError_clone(&e_conv);
15485         LDKCResult_RefundBolt12ParseErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RefundBolt12ParseErrorZ), "LDKCResult_RefundBolt12ParseErrorZ");
15486         *ret_conv = CResult_RefundBolt12ParseErrorZ_err(e_conv);
15487         return tag_ptr(ret_conv, true);
15488 }
15489
15490 jboolean  __attribute__((export_name("TS_CResult_RefundBolt12ParseErrorZ_is_ok"))) TS_CResult_RefundBolt12ParseErrorZ_is_ok(uint64_t o) {
15491         LDKCResult_RefundBolt12ParseErrorZ* o_conv = (LDKCResult_RefundBolt12ParseErrorZ*)untag_ptr(o);
15492         jboolean ret_conv = CResult_RefundBolt12ParseErrorZ_is_ok(o_conv);
15493         return ret_conv;
15494 }
15495
15496 void  __attribute__((export_name("TS_CResult_RefundBolt12ParseErrorZ_free"))) TS_CResult_RefundBolt12ParseErrorZ_free(uint64_t _res) {
15497         if (!ptr_is_owned(_res)) return;
15498         void* _res_ptr = untag_ptr(_res);
15499         CHECK_ACCESS(_res_ptr);
15500         LDKCResult_RefundBolt12ParseErrorZ _res_conv = *(LDKCResult_RefundBolt12ParseErrorZ*)(_res_ptr);
15501         FREE(untag_ptr(_res));
15502         CResult_RefundBolt12ParseErrorZ_free(_res_conv);
15503 }
15504
15505 static inline uint64_t CResult_RefundBolt12ParseErrorZ_clone_ptr(LDKCResult_RefundBolt12ParseErrorZ *NONNULL_PTR arg) {
15506         LDKCResult_RefundBolt12ParseErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RefundBolt12ParseErrorZ), "LDKCResult_RefundBolt12ParseErrorZ");
15507         *ret_conv = CResult_RefundBolt12ParseErrorZ_clone(arg);
15508         return tag_ptr(ret_conv, true);
15509 }
15510 int64_t  __attribute__((export_name("TS_CResult_RefundBolt12ParseErrorZ_clone_ptr"))) TS_CResult_RefundBolt12ParseErrorZ_clone_ptr(uint64_t arg) {
15511         LDKCResult_RefundBolt12ParseErrorZ* arg_conv = (LDKCResult_RefundBolt12ParseErrorZ*)untag_ptr(arg);
15512         int64_t ret_conv = CResult_RefundBolt12ParseErrorZ_clone_ptr(arg_conv);
15513         return ret_conv;
15514 }
15515
15516 uint64_t  __attribute__((export_name("TS_CResult_RefundBolt12ParseErrorZ_clone"))) TS_CResult_RefundBolt12ParseErrorZ_clone(uint64_t orig) {
15517         LDKCResult_RefundBolt12ParseErrorZ* orig_conv = (LDKCResult_RefundBolt12ParseErrorZ*)untag_ptr(orig);
15518         LDKCResult_RefundBolt12ParseErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RefundBolt12ParseErrorZ), "LDKCResult_RefundBolt12ParseErrorZ");
15519         *ret_conv = CResult_RefundBolt12ParseErrorZ_clone(orig_conv);
15520         return tag_ptr(ret_conv, true);
15521 }
15522
15523 uint64_t  __attribute__((export_name("TS_CResult_RetryDecodeErrorZ_ok"))) TS_CResult_RetryDecodeErrorZ_ok(uint64_t o) {
15524         void* o_ptr = untag_ptr(o);
15525         CHECK_ACCESS(o_ptr);
15526         LDKRetry o_conv = *(LDKRetry*)(o_ptr);
15527         o_conv = Retry_clone((LDKRetry*)untag_ptr(o));
15528         LDKCResult_RetryDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RetryDecodeErrorZ), "LDKCResult_RetryDecodeErrorZ");
15529         *ret_conv = CResult_RetryDecodeErrorZ_ok(o_conv);
15530         return tag_ptr(ret_conv, true);
15531 }
15532
15533 uint64_t  __attribute__((export_name("TS_CResult_RetryDecodeErrorZ_err"))) TS_CResult_RetryDecodeErrorZ_err(uint64_t e) {
15534         void* e_ptr = untag_ptr(e);
15535         CHECK_ACCESS(e_ptr);
15536         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
15537         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
15538         LDKCResult_RetryDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RetryDecodeErrorZ), "LDKCResult_RetryDecodeErrorZ");
15539         *ret_conv = CResult_RetryDecodeErrorZ_err(e_conv);
15540         return tag_ptr(ret_conv, true);
15541 }
15542
15543 jboolean  __attribute__((export_name("TS_CResult_RetryDecodeErrorZ_is_ok"))) TS_CResult_RetryDecodeErrorZ_is_ok(uint64_t o) {
15544         LDKCResult_RetryDecodeErrorZ* o_conv = (LDKCResult_RetryDecodeErrorZ*)untag_ptr(o);
15545         jboolean ret_conv = CResult_RetryDecodeErrorZ_is_ok(o_conv);
15546         return ret_conv;
15547 }
15548
15549 void  __attribute__((export_name("TS_CResult_RetryDecodeErrorZ_free"))) TS_CResult_RetryDecodeErrorZ_free(uint64_t _res) {
15550         if (!ptr_is_owned(_res)) return;
15551         void* _res_ptr = untag_ptr(_res);
15552         CHECK_ACCESS(_res_ptr);
15553         LDKCResult_RetryDecodeErrorZ _res_conv = *(LDKCResult_RetryDecodeErrorZ*)(_res_ptr);
15554         FREE(untag_ptr(_res));
15555         CResult_RetryDecodeErrorZ_free(_res_conv);
15556 }
15557
15558 static inline uint64_t CResult_RetryDecodeErrorZ_clone_ptr(LDKCResult_RetryDecodeErrorZ *NONNULL_PTR arg) {
15559         LDKCResult_RetryDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RetryDecodeErrorZ), "LDKCResult_RetryDecodeErrorZ");
15560         *ret_conv = CResult_RetryDecodeErrorZ_clone(arg);
15561         return tag_ptr(ret_conv, true);
15562 }
15563 int64_t  __attribute__((export_name("TS_CResult_RetryDecodeErrorZ_clone_ptr"))) TS_CResult_RetryDecodeErrorZ_clone_ptr(uint64_t arg) {
15564         LDKCResult_RetryDecodeErrorZ* arg_conv = (LDKCResult_RetryDecodeErrorZ*)untag_ptr(arg);
15565         int64_t ret_conv = CResult_RetryDecodeErrorZ_clone_ptr(arg_conv);
15566         return ret_conv;
15567 }
15568
15569 uint64_t  __attribute__((export_name("TS_CResult_RetryDecodeErrorZ_clone"))) TS_CResult_RetryDecodeErrorZ_clone(uint64_t orig) {
15570         LDKCResult_RetryDecodeErrorZ* orig_conv = (LDKCResult_RetryDecodeErrorZ*)untag_ptr(orig);
15571         LDKCResult_RetryDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RetryDecodeErrorZ), "LDKCResult_RetryDecodeErrorZ");
15572         *ret_conv = CResult_RetryDecodeErrorZ_clone(orig_conv);
15573         return tag_ptr(ret_conv, true);
15574 }
15575
15576 uint64_t  __attribute__((export_name("TS_CResult_NoneAPIErrorZ_ok"))) TS_CResult_NoneAPIErrorZ_ok() {
15577         LDKCResult_NoneAPIErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneAPIErrorZ), "LDKCResult_NoneAPIErrorZ");
15578         *ret_conv = CResult_NoneAPIErrorZ_ok();
15579         return tag_ptr(ret_conv, true);
15580 }
15581
15582 uint64_t  __attribute__((export_name("TS_CResult_NoneAPIErrorZ_err"))) TS_CResult_NoneAPIErrorZ_err(uint64_t e) {
15583         void* e_ptr = untag_ptr(e);
15584         CHECK_ACCESS(e_ptr);
15585         LDKAPIError e_conv = *(LDKAPIError*)(e_ptr);
15586         e_conv = APIError_clone((LDKAPIError*)untag_ptr(e));
15587         LDKCResult_NoneAPIErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneAPIErrorZ), "LDKCResult_NoneAPIErrorZ");
15588         *ret_conv = CResult_NoneAPIErrorZ_err(e_conv);
15589         return tag_ptr(ret_conv, true);
15590 }
15591
15592 jboolean  __attribute__((export_name("TS_CResult_NoneAPIErrorZ_is_ok"))) TS_CResult_NoneAPIErrorZ_is_ok(uint64_t o) {
15593         LDKCResult_NoneAPIErrorZ* o_conv = (LDKCResult_NoneAPIErrorZ*)untag_ptr(o);
15594         jboolean ret_conv = CResult_NoneAPIErrorZ_is_ok(o_conv);
15595         return ret_conv;
15596 }
15597
15598 void  __attribute__((export_name("TS_CResult_NoneAPIErrorZ_free"))) TS_CResult_NoneAPIErrorZ_free(uint64_t _res) {
15599         if (!ptr_is_owned(_res)) return;
15600         void* _res_ptr = untag_ptr(_res);
15601         CHECK_ACCESS(_res_ptr);
15602         LDKCResult_NoneAPIErrorZ _res_conv = *(LDKCResult_NoneAPIErrorZ*)(_res_ptr);
15603         FREE(untag_ptr(_res));
15604         CResult_NoneAPIErrorZ_free(_res_conv);
15605 }
15606
15607 static inline uint64_t CResult_NoneAPIErrorZ_clone_ptr(LDKCResult_NoneAPIErrorZ *NONNULL_PTR arg) {
15608         LDKCResult_NoneAPIErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneAPIErrorZ), "LDKCResult_NoneAPIErrorZ");
15609         *ret_conv = CResult_NoneAPIErrorZ_clone(arg);
15610         return tag_ptr(ret_conv, true);
15611 }
15612 int64_t  __attribute__((export_name("TS_CResult_NoneAPIErrorZ_clone_ptr"))) TS_CResult_NoneAPIErrorZ_clone_ptr(uint64_t arg) {
15613         LDKCResult_NoneAPIErrorZ* arg_conv = (LDKCResult_NoneAPIErrorZ*)untag_ptr(arg);
15614         int64_t ret_conv = CResult_NoneAPIErrorZ_clone_ptr(arg_conv);
15615         return ret_conv;
15616 }
15617
15618 uint64_t  __attribute__((export_name("TS_CResult_NoneAPIErrorZ_clone"))) TS_CResult_NoneAPIErrorZ_clone(uint64_t orig) {
15619         LDKCResult_NoneAPIErrorZ* orig_conv = (LDKCResult_NoneAPIErrorZ*)untag_ptr(orig);
15620         LDKCResult_NoneAPIErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneAPIErrorZ), "LDKCResult_NoneAPIErrorZ");
15621         *ret_conv = CResult_NoneAPIErrorZ_clone(orig_conv);
15622         return tag_ptr(ret_conv, true);
15623 }
15624
15625 void  __attribute__((export_name("TS_CVec_CResult_NoneAPIErrorZZ_free"))) TS_CVec_CResult_NoneAPIErrorZZ_free(uint64_tArray _res) {
15626         LDKCVec_CResult_NoneAPIErrorZZ _res_constr;
15627         _res_constr.datalen = _res->arr_len;
15628         if (_res_constr.datalen > 0)
15629                 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKCResult_NoneAPIErrorZ), "LDKCVec_CResult_NoneAPIErrorZZ Elements");
15630         else
15631                 _res_constr.data = NULL;
15632         uint64_t* _res_vals = _res->elems;
15633         for (size_t w = 0; w < _res_constr.datalen; w++) {
15634                 uint64_t _res_conv_22 = _res_vals[w];
15635                 void* _res_conv_22_ptr = untag_ptr(_res_conv_22);
15636                 CHECK_ACCESS(_res_conv_22_ptr);
15637                 LDKCResult_NoneAPIErrorZ _res_conv_22_conv = *(LDKCResult_NoneAPIErrorZ*)(_res_conv_22_ptr);
15638                 FREE(untag_ptr(_res_conv_22));
15639                 _res_constr.data[w] = _res_conv_22_conv;
15640         }
15641         FREE(_res);
15642         CVec_CResult_NoneAPIErrorZZ_free(_res_constr);
15643 }
15644
15645 void  __attribute__((export_name("TS_CVec_APIErrorZ_free"))) TS_CVec_APIErrorZ_free(uint64_tArray _res) {
15646         LDKCVec_APIErrorZ _res_constr;
15647         _res_constr.datalen = _res->arr_len;
15648         if (_res_constr.datalen > 0)
15649                 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKAPIError), "LDKCVec_APIErrorZ Elements");
15650         else
15651                 _res_constr.data = NULL;
15652         uint64_t* _res_vals = _res->elems;
15653         for (size_t k = 0; k < _res_constr.datalen; k++) {
15654                 uint64_t _res_conv_10 = _res_vals[k];
15655                 void* _res_conv_10_ptr = untag_ptr(_res_conv_10);
15656                 CHECK_ACCESS(_res_conv_10_ptr);
15657                 LDKAPIError _res_conv_10_conv = *(LDKAPIError*)(_res_conv_10_ptr);
15658                 FREE(untag_ptr(_res_conv_10));
15659                 _res_constr.data[k] = _res_conv_10_conv;
15660         }
15661         FREE(_res);
15662         CVec_APIErrorZ_free(_res_constr);
15663 }
15664
15665 uint64_t  __attribute__((export_name("TS_COption_ThirtyTwoBytesZ_some"))) TS_COption_ThirtyTwoBytesZ_some(int8_tArray o) {
15666         LDKThirtyTwoBytes o_ref;
15667         CHECK(o->arr_len == 32);
15668         memcpy(o_ref.data, o->elems, 32); FREE(o);
15669         LDKCOption_ThirtyTwoBytesZ *ret_copy = MALLOC(sizeof(LDKCOption_ThirtyTwoBytesZ), "LDKCOption_ThirtyTwoBytesZ");
15670         *ret_copy = COption_ThirtyTwoBytesZ_some(o_ref);
15671         uint64_t ret_ref = tag_ptr(ret_copy, true);
15672         return ret_ref;
15673 }
15674
15675 uint64_t  __attribute__((export_name("TS_COption_ThirtyTwoBytesZ_none"))) TS_COption_ThirtyTwoBytesZ_none() {
15676         LDKCOption_ThirtyTwoBytesZ *ret_copy = MALLOC(sizeof(LDKCOption_ThirtyTwoBytesZ), "LDKCOption_ThirtyTwoBytesZ");
15677         *ret_copy = COption_ThirtyTwoBytesZ_none();
15678         uint64_t ret_ref = tag_ptr(ret_copy, true);
15679         return ret_ref;
15680 }
15681
15682 void  __attribute__((export_name("TS_COption_ThirtyTwoBytesZ_free"))) TS_COption_ThirtyTwoBytesZ_free(uint64_t _res) {
15683         if (!ptr_is_owned(_res)) return;
15684         void* _res_ptr = untag_ptr(_res);
15685         CHECK_ACCESS(_res_ptr);
15686         LDKCOption_ThirtyTwoBytesZ _res_conv = *(LDKCOption_ThirtyTwoBytesZ*)(_res_ptr);
15687         FREE(untag_ptr(_res));
15688         COption_ThirtyTwoBytesZ_free(_res_conv);
15689 }
15690
15691 static inline uint64_t COption_ThirtyTwoBytesZ_clone_ptr(LDKCOption_ThirtyTwoBytesZ *NONNULL_PTR arg) {
15692         LDKCOption_ThirtyTwoBytesZ *ret_copy = MALLOC(sizeof(LDKCOption_ThirtyTwoBytesZ), "LDKCOption_ThirtyTwoBytesZ");
15693         *ret_copy = COption_ThirtyTwoBytesZ_clone(arg);
15694         uint64_t ret_ref = tag_ptr(ret_copy, true);
15695         return ret_ref;
15696 }
15697 int64_t  __attribute__((export_name("TS_COption_ThirtyTwoBytesZ_clone_ptr"))) TS_COption_ThirtyTwoBytesZ_clone_ptr(uint64_t arg) {
15698         LDKCOption_ThirtyTwoBytesZ* arg_conv = (LDKCOption_ThirtyTwoBytesZ*)untag_ptr(arg);
15699         int64_t ret_conv = COption_ThirtyTwoBytesZ_clone_ptr(arg_conv);
15700         return ret_conv;
15701 }
15702
15703 uint64_t  __attribute__((export_name("TS_COption_ThirtyTwoBytesZ_clone"))) TS_COption_ThirtyTwoBytesZ_clone(uint64_t orig) {
15704         LDKCOption_ThirtyTwoBytesZ* orig_conv = (LDKCOption_ThirtyTwoBytesZ*)untag_ptr(orig);
15705         LDKCOption_ThirtyTwoBytesZ *ret_copy = MALLOC(sizeof(LDKCOption_ThirtyTwoBytesZ), "LDKCOption_ThirtyTwoBytesZ");
15706         *ret_copy = COption_ThirtyTwoBytesZ_clone(orig_conv);
15707         uint64_t ret_ref = tag_ptr(ret_copy, true);
15708         return ret_ref;
15709 }
15710
15711 void  __attribute__((export_name("TS_CVec_u8Z_free"))) TS_CVec_u8Z_free(int8_tArray _res) {
15712         LDKCVec_u8Z _res_ref;
15713         _res_ref.datalen = _res->arr_len;
15714         _res_ref.data = MALLOC(_res_ref.datalen, "LDKCVec_u8Z Bytes");
15715         memcpy(_res_ref.data, _res->elems, _res_ref.datalen); FREE(_res);
15716         CVec_u8Z_free(_res_ref);
15717 }
15718
15719 uint64_t  __attribute__((export_name("TS_COption_CVec_u8ZZ_some"))) TS_COption_CVec_u8ZZ_some(int8_tArray o) {
15720         LDKCVec_u8Z o_ref;
15721         o_ref.datalen = o->arr_len;
15722         o_ref.data = MALLOC(o_ref.datalen, "LDKCVec_u8Z Bytes");
15723         memcpy(o_ref.data, o->elems, o_ref.datalen); FREE(o);
15724         LDKCOption_CVec_u8ZZ *ret_copy = MALLOC(sizeof(LDKCOption_CVec_u8ZZ), "LDKCOption_CVec_u8ZZ");
15725         *ret_copy = COption_CVec_u8ZZ_some(o_ref);
15726         uint64_t ret_ref = tag_ptr(ret_copy, true);
15727         return ret_ref;
15728 }
15729
15730 uint64_t  __attribute__((export_name("TS_COption_CVec_u8ZZ_none"))) TS_COption_CVec_u8ZZ_none() {
15731         LDKCOption_CVec_u8ZZ *ret_copy = MALLOC(sizeof(LDKCOption_CVec_u8ZZ), "LDKCOption_CVec_u8ZZ");
15732         *ret_copy = COption_CVec_u8ZZ_none();
15733         uint64_t ret_ref = tag_ptr(ret_copy, true);
15734         return ret_ref;
15735 }
15736
15737 void  __attribute__((export_name("TS_COption_CVec_u8ZZ_free"))) TS_COption_CVec_u8ZZ_free(uint64_t _res) {
15738         if (!ptr_is_owned(_res)) return;
15739         void* _res_ptr = untag_ptr(_res);
15740         CHECK_ACCESS(_res_ptr);
15741         LDKCOption_CVec_u8ZZ _res_conv = *(LDKCOption_CVec_u8ZZ*)(_res_ptr);
15742         FREE(untag_ptr(_res));
15743         COption_CVec_u8ZZ_free(_res_conv);
15744 }
15745
15746 static inline uint64_t COption_CVec_u8ZZ_clone_ptr(LDKCOption_CVec_u8ZZ *NONNULL_PTR arg) {
15747         LDKCOption_CVec_u8ZZ *ret_copy = MALLOC(sizeof(LDKCOption_CVec_u8ZZ), "LDKCOption_CVec_u8ZZ");
15748         *ret_copy = COption_CVec_u8ZZ_clone(arg);
15749         uint64_t ret_ref = tag_ptr(ret_copy, true);
15750         return ret_ref;
15751 }
15752 int64_t  __attribute__((export_name("TS_COption_CVec_u8ZZ_clone_ptr"))) TS_COption_CVec_u8ZZ_clone_ptr(uint64_t arg) {
15753         LDKCOption_CVec_u8ZZ* arg_conv = (LDKCOption_CVec_u8ZZ*)untag_ptr(arg);
15754         int64_t ret_conv = COption_CVec_u8ZZ_clone_ptr(arg_conv);
15755         return ret_conv;
15756 }
15757
15758 uint64_t  __attribute__((export_name("TS_COption_CVec_u8ZZ_clone"))) TS_COption_CVec_u8ZZ_clone(uint64_t orig) {
15759         LDKCOption_CVec_u8ZZ* orig_conv = (LDKCOption_CVec_u8ZZ*)untag_ptr(orig);
15760         LDKCOption_CVec_u8ZZ *ret_copy = MALLOC(sizeof(LDKCOption_CVec_u8ZZ), "LDKCOption_CVec_u8ZZ");
15761         *ret_copy = COption_CVec_u8ZZ_clone(orig_conv);
15762         uint64_t ret_ref = tag_ptr(ret_copy, true);
15763         return ret_ref;
15764 }
15765
15766 uint64_t  __attribute__((export_name("TS_CResult_RecipientOnionFieldsDecodeErrorZ_ok"))) TS_CResult_RecipientOnionFieldsDecodeErrorZ_ok(uint64_t o) {
15767         LDKRecipientOnionFields o_conv;
15768         o_conv.inner = untag_ptr(o);
15769         o_conv.is_owned = ptr_is_owned(o);
15770         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
15771         o_conv = RecipientOnionFields_clone(&o_conv);
15772         LDKCResult_RecipientOnionFieldsDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RecipientOnionFieldsDecodeErrorZ), "LDKCResult_RecipientOnionFieldsDecodeErrorZ");
15773         *ret_conv = CResult_RecipientOnionFieldsDecodeErrorZ_ok(o_conv);
15774         return tag_ptr(ret_conv, true);
15775 }
15776
15777 uint64_t  __attribute__((export_name("TS_CResult_RecipientOnionFieldsDecodeErrorZ_err"))) TS_CResult_RecipientOnionFieldsDecodeErrorZ_err(uint64_t e) {
15778         void* e_ptr = untag_ptr(e);
15779         CHECK_ACCESS(e_ptr);
15780         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
15781         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
15782         LDKCResult_RecipientOnionFieldsDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RecipientOnionFieldsDecodeErrorZ), "LDKCResult_RecipientOnionFieldsDecodeErrorZ");
15783         *ret_conv = CResult_RecipientOnionFieldsDecodeErrorZ_err(e_conv);
15784         return tag_ptr(ret_conv, true);
15785 }
15786
15787 jboolean  __attribute__((export_name("TS_CResult_RecipientOnionFieldsDecodeErrorZ_is_ok"))) TS_CResult_RecipientOnionFieldsDecodeErrorZ_is_ok(uint64_t o) {
15788         LDKCResult_RecipientOnionFieldsDecodeErrorZ* o_conv = (LDKCResult_RecipientOnionFieldsDecodeErrorZ*)untag_ptr(o);
15789         jboolean ret_conv = CResult_RecipientOnionFieldsDecodeErrorZ_is_ok(o_conv);
15790         return ret_conv;
15791 }
15792
15793 void  __attribute__((export_name("TS_CResult_RecipientOnionFieldsDecodeErrorZ_free"))) TS_CResult_RecipientOnionFieldsDecodeErrorZ_free(uint64_t _res) {
15794         if (!ptr_is_owned(_res)) return;
15795         void* _res_ptr = untag_ptr(_res);
15796         CHECK_ACCESS(_res_ptr);
15797         LDKCResult_RecipientOnionFieldsDecodeErrorZ _res_conv = *(LDKCResult_RecipientOnionFieldsDecodeErrorZ*)(_res_ptr);
15798         FREE(untag_ptr(_res));
15799         CResult_RecipientOnionFieldsDecodeErrorZ_free(_res_conv);
15800 }
15801
15802 static inline uint64_t CResult_RecipientOnionFieldsDecodeErrorZ_clone_ptr(LDKCResult_RecipientOnionFieldsDecodeErrorZ *NONNULL_PTR arg) {
15803         LDKCResult_RecipientOnionFieldsDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RecipientOnionFieldsDecodeErrorZ), "LDKCResult_RecipientOnionFieldsDecodeErrorZ");
15804         *ret_conv = CResult_RecipientOnionFieldsDecodeErrorZ_clone(arg);
15805         return tag_ptr(ret_conv, true);
15806 }
15807 int64_t  __attribute__((export_name("TS_CResult_RecipientOnionFieldsDecodeErrorZ_clone_ptr"))) TS_CResult_RecipientOnionFieldsDecodeErrorZ_clone_ptr(uint64_t arg) {
15808         LDKCResult_RecipientOnionFieldsDecodeErrorZ* arg_conv = (LDKCResult_RecipientOnionFieldsDecodeErrorZ*)untag_ptr(arg);
15809         int64_t ret_conv = CResult_RecipientOnionFieldsDecodeErrorZ_clone_ptr(arg_conv);
15810         return ret_conv;
15811 }
15812
15813 uint64_t  __attribute__((export_name("TS_CResult_RecipientOnionFieldsDecodeErrorZ_clone"))) TS_CResult_RecipientOnionFieldsDecodeErrorZ_clone(uint64_t orig) {
15814         LDKCResult_RecipientOnionFieldsDecodeErrorZ* orig_conv = (LDKCResult_RecipientOnionFieldsDecodeErrorZ*)untag_ptr(orig);
15815         LDKCResult_RecipientOnionFieldsDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RecipientOnionFieldsDecodeErrorZ), "LDKCResult_RecipientOnionFieldsDecodeErrorZ");
15816         *ret_conv = CResult_RecipientOnionFieldsDecodeErrorZ_clone(orig_conv);
15817         return tag_ptr(ret_conv, true);
15818 }
15819
15820 static inline uint64_t C2Tuple_u64CVec_u8ZZ_clone_ptr(LDKC2Tuple_u64CVec_u8ZZ *NONNULL_PTR arg) {
15821         LDKC2Tuple_u64CVec_u8ZZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_u64CVec_u8ZZ), "LDKC2Tuple_u64CVec_u8ZZ");
15822         *ret_conv = C2Tuple_u64CVec_u8ZZ_clone(arg);
15823         return tag_ptr(ret_conv, true);
15824 }
15825 int64_t  __attribute__((export_name("TS_C2Tuple_u64CVec_u8ZZ_clone_ptr"))) TS_C2Tuple_u64CVec_u8ZZ_clone_ptr(uint64_t arg) {
15826         LDKC2Tuple_u64CVec_u8ZZ* arg_conv = (LDKC2Tuple_u64CVec_u8ZZ*)untag_ptr(arg);
15827         int64_t ret_conv = C2Tuple_u64CVec_u8ZZ_clone_ptr(arg_conv);
15828         return ret_conv;
15829 }
15830
15831 uint64_t  __attribute__((export_name("TS_C2Tuple_u64CVec_u8ZZ_clone"))) TS_C2Tuple_u64CVec_u8ZZ_clone(uint64_t orig) {
15832         LDKC2Tuple_u64CVec_u8ZZ* orig_conv = (LDKC2Tuple_u64CVec_u8ZZ*)untag_ptr(orig);
15833         LDKC2Tuple_u64CVec_u8ZZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_u64CVec_u8ZZ), "LDKC2Tuple_u64CVec_u8ZZ");
15834         *ret_conv = C2Tuple_u64CVec_u8ZZ_clone(orig_conv);
15835         return tag_ptr(ret_conv, true);
15836 }
15837
15838 uint64_t  __attribute__((export_name("TS_C2Tuple_u64CVec_u8ZZ_new"))) TS_C2Tuple_u64CVec_u8ZZ_new(int64_t a, int8_tArray b) {
15839         LDKCVec_u8Z b_ref;
15840         b_ref.datalen = b->arr_len;
15841         b_ref.data = MALLOC(b_ref.datalen, "LDKCVec_u8Z Bytes");
15842         memcpy(b_ref.data, b->elems, b_ref.datalen); FREE(b);
15843         LDKC2Tuple_u64CVec_u8ZZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_u64CVec_u8ZZ), "LDKC2Tuple_u64CVec_u8ZZ");
15844         *ret_conv = C2Tuple_u64CVec_u8ZZ_new(a, b_ref);
15845         return tag_ptr(ret_conv, true);
15846 }
15847
15848 void  __attribute__((export_name("TS_C2Tuple_u64CVec_u8ZZ_free"))) TS_C2Tuple_u64CVec_u8ZZ_free(uint64_t _res) {
15849         if (!ptr_is_owned(_res)) return;
15850         void* _res_ptr = untag_ptr(_res);
15851         CHECK_ACCESS(_res_ptr);
15852         LDKC2Tuple_u64CVec_u8ZZ _res_conv = *(LDKC2Tuple_u64CVec_u8ZZ*)(_res_ptr);
15853         FREE(untag_ptr(_res));
15854         C2Tuple_u64CVec_u8ZZ_free(_res_conv);
15855 }
15856
15857 void  __attribute__((export_name("TS_CVec_C2Tuple_u64CVec_u8ZZZ_free"))) TS_CVec_C2Tuple_u64CVec_u8ZZZ_free(uint64_tArray _res) {
15858         LDKCVec_C2Tuple_u64CVec_u8ZZZ _res_constr;
15859         _res_constr.datalen = _res->arr_len;
15860         if (_res_constr.datalen > 0)
15861                 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKC2Tuple_u64CVec_u8ZZ), "LDKCVec_C2Tuple_u64CVec_u8ZZZ Elements");
15862         else
15863                 _res_constr.data = NULL;
15864         uint64_t* _res_vals = _res->elems;
15865         for (size_t x = 0; x < _res_constr.datalen; x++) {
15866                 uint64_t _res_conv_23 = _res_vals[x];
15867                 void* _res_conv_23_ptr = untag_ptr(_res_conv_23);
15868                 CHECK_ACCESS(_res_conv_23_ptr);
15869                 LDKC2Tuple_u64CVec_u8ZZ _res_conv_23_conv = *(LDKC2Tuple_u64CVec_u8ZZ*)(_res_conv_23_ptr);
15870                 FREE(untag_ptr(_res_conv_23));
15871                 _res_constr.data[x] = _res_conv_23_conv;
15872         }
15873         FREE(_res);
15874         CVec_C2Tuple_u64CVec_u8ZZZ_free(_res_constr);
15875 }
15876
15877 uint64_t  __attribute__((export_name("TS_CResult_RecipientOnionFieldsNoneZ_ok"))) TS_CResult_RecipientOnionFieldsNoneZ_ok(uint64_t o) {
15878         LDKRecipientOnionFields o_conv;
15879         o_conv.inner = untag_ptr(o);
15880         o_conv.is_owned = ptr_is_owned(o);
15881         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
15882         o_conv = RecipientOnionFields_clone(&o_conv);
15883         LDKCResult_RecipientOnionFieldsNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_RecipientOnionFieldsNoneZ), "LDKCResult_RecipientOnionFieldsNoneZ");
15884         *ret_conv = CResult_RecipientOnionFieldsNoneZ_ok(o_conv);
15885         return tag_ptr(ret_conv, true);
15886 }
15887
15888 uint64_t  __attribute__((export_name("TS_CResult_RecipientOnionFieldsNoneZ_err"))) TS_CResult_RecipientOnionFieldsNoneZ_err() {
15889         LDKCResult_RecipientOnionFieldsNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_RecipientOnionFieldsNoneZ), "LDKCResult_RecipientOnionFieldsNoneZ");
15890         *ret_conv = CResult_RecipientOnionFieldsNoneZ_err();
15891         return tag_ptr(ret_conv, true);
15892 }
15893
15894 jboolean  __attribute__((export_name("TS_CResult_RecipientOnionFieldsNoneZ_is_ok"))) TS_CResult_RecipientOnionFieldsNoneZ_is_ok(uint64_t o) {
15895         LDKCResult_RecipientOnionFieldsNoneZ* o_conv = (LDKCResult_RecipientOnionFieldsNoneZ*)untag_ptr(o);
15896         jboolean ret_conv = CResult_RecipientOnionFieldsNoneZ_is_ok(o_conv);
15897         return ret_conv;
15898 }
15899
15900 void  __attribute__((export_name("TS_CResult_RecipientOnionFieldsNoneZ_free"))) TS_CResult_RecipientOnionFieldsNoneZ_free(uint64_t _res) {
15901         if (!ptr_is_owned(_res)) return;
15902         void* _res_ptr = untag_ptr(_res);
15903         CHECK_ACCESS(_res_ptr);
15904         LDKCResult_RecipientOnionFieldsNoneZ _res_conv = *(LDKCResult_RecipientOnionFieldsNoneZ*)(_res_ptr);
15905         FREE(untag_ptr(_res));
15906         CResult_RecipientOnionFieldsNoneZ_free(_res_conv);
15907 }
15908
15909 static inline uint64_t CResult_RecipientOnionFieldsNoneZ_clone_ptr(LDKCResult_RecipientOnionFieldsNoneZ *NONNULL_PTR arg) {
15910         LDKCResult_RecipientOnionFieldsNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_RecipientOnionFieldsNoneZ), "LDKCResult_RecipientOnionFieldsNoneZ");
15911         *ret_conv = CResult_RecipientOnionFieldsNoneZ_clone(arg);
15912         return tag_ptr(ret_conv, true);
15913 }
15914 int64_t  __attribute__((export_name("TS_CResult_RecipientOnionFieldsNoneZ_clone_ptr"))) TS_CResult_RecipientOnionFieldsNoneZ_clone_ptr(uint64_t arg) {
15915         LDKCResult_RecipientOnionFieldsNoneZ* arg_conv = (LDKCResult_RecipientOnionFieldsNoneZ*)untag_ptr(arg);
15916         int64_t ret_conv = CResult_RecipientOnionFieldsNoneZ_clone_ptr(arg_conv);
15917         return ret_conv;
15918 }
15919
15920 uint64_t  __attribute__((export_name("TS_CResult_RecipientOnionFieldsNoneZ_clone"))) TS_CResult_RecipientOnionFieldsNoneZ_clone(uint64_t orig) {
15921         LDKCResult_RecipientOnionFieldsNoneZ* orig_conv = (LDKCResult_RecipientOnionFieldsNoneZ*)untag_ptr(orig);
15922         LDKCResult_RecipientOnionFieldsNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_RecipientOnionFieldsNoneZ), "LDKCResult_RecipientOnionFieldsNoneZ");
15923         *ret_conv = CResult_RecipientOnionFieldsNoneZ_clone(orig_conv);
15924         return tag_ptr(ret_conv, true);
15925 }
15926
15927 void  __attribute__((export_name("TS_CVec_ThirtyTwoBytesZ_free"))) TS_CVec_ThirtyTwoBytesZ_free(ptrArray _res) {
15928         LDKCVec_ThirtyTwoBytesZ _res_constr;
15929         _res_constr.datalen = _res->arr_len;
15930         if (_res_constr.datalen > 0)
15931                 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKThirtyTwoBytes), "LDKCVec_ThirtyTwoBytesZ Elements");
15932         else
15933                 _res_constr.data = NULL;
15934         int8_tArray* _res_vals = (void*) _res->elems;
15935         for (size_t m = 0; m < _res_constr.datalen; m++) {
15936                 int8_tArray _res_conv_12 = _res_vals[m];
15937                 LDKThirtyTwoBytes _res_conv_12_ref;
15938                 CHECK(_res_conv_12->arr_len == 32);
15939                 memcpy(_res_conv_12_ref.data, _res_conv_12->elems, 32); FREE(_res_conv_12);
15940                 _res_constr.data[m] = _res_conv_12_ref;
15941         }
15942         FREE(_res);
15943         CVec_ThirtyTwoBytesZ_free(_res_constr);
15944 }
15945
15946 uint64_t  __attribute__((export_name("TS_COption_CVec_ThirtyTwoBytesZZ_some"))) TS_COption_CVec_ThirtyTwoBytesZZ_some(ptrArray o) {
15947         LDKCVec_ThirtyTwoBytesZ o_constr;
15948         o_constr.datalen = o->arr_len;
15949         if (o_constr.datalen > 0)
15950                 o_constr.data = MALLOC(o_constr.datalen * sizeof(LDKThirtyTwoBytes), "LDKCVec_ThirtyTwoBytesZ Elements");
15951         else
15952                 o_constr.data = NULL;
15953         int8_tArray* o_vals = (void*) o->elems;
15954         for (size_t m = 0; m < o_constr.datalen; m++) {
15955                 int8_tArray o_conv_12 = o_vals[m];
15956                 LDKThirtyTwoBytes o_conv_12_ref;
15957                 CHECK(o_conv_12->arr_len == 32);
15958                 memcpy(o_conv_12_ref.data, o_conv_12->elems, 32); FREE(o_conv_12);
15959                 o_constr.data[m] = o_conv_12_ref;
15960         }
15961         FREE(o);
15962         LDKCOption_CVec_ThirtyTwoBytesZZ *ret_copy = MALLOC(sizeof(LDKCOption_CVec_ThirtyTwoBytesZZ), "LDKCOption_CVec_ThirtyTwoBytesZZ");
15963         *ret_copy = COption_CVec_ThirtyTwoBytesZZ_some(o_constr);
15964         uint64_t ret_ref = tag_ptr(ret_copy, true);
15965         return ret_ref;
15966 }
15967
15968 uint64_t  __attribute__((export_name("TS_COption_CVec_ThirtyTwoBytesZZ_none"))) TS_COption_CVec_ThirtyTwoBytesZZ_none() {
15969         LDKCOption_CVec_ThirtyTwoBytesZZ *ret_copy = MALLOC(sizeof(LDKCOption_CVec_ThirtyTwoBytesZZ), "LDKCOption_CVec_ThirtyTwoBytesZZ");
15970         *ret_copy = COption_CVec_ThirtyTwoBytesZZ_none();
15971         uint64_t ret_ref = tag_ptr(ret_copy, true);
15972         return ret_ref;
15973 }
15974
15975 void  __attribute__((export_name("TS_COption_CVec_ThirtyTwoBytesZZ_free"))) TS_COption_CVec_ThirtyTwoBytesZZ_free(uint64_t _res) {
15976         if (!ptr_is_owned(_res)) return;
15977         void* _res_ptr = untag_ptr(_res);
15978         CHECK_ACCESS(_res_ptr);
15979         LDKCOption_CVec_ThirtyTwoBytesZZ _res_conv = *(LDKCOption_CVec_ThirtyTwoBytesZZ*)(_res_ptr);
15980         FREE(untag_ptr(_res));
15981         COption_CVec_ThirtyTwoBytesZZ_free(_res_conv);
15982 }
15983
15984 static inline uint64_t COption_CVec_ThirtyTwoBytesZZ_clone_ptr(LDKCOption_CVec_ThirtyTwoBytesZZ *NONNULL_PTR arg) {
15985         LDKCOption_CVec_ThirtyTwoBytesZZ *ret_copy = MALLOC(sizeof(LDKCOption_CVec_ThirtyTwoBytesZZ), "LDKCOption_CVec_ThirtyTwoBytesZZ");
15986         *ret_copy = COption_CVec_ThirtyTwoBytesZZ_clone(arg);
15987         uint64_t ret_ref = tag_ptr(ret_copy, true);
15988         return ret_ref;
15989 }
15990 int64_t  __attribute__((export_name("TS_COption_CVec_ThirtyTwoBytesZZ_clone_ptr"))) TS_COption_CVec_ThirtyTwoBytesZZ_clone_ptr(uint64_t arg) {
15991         LDKCOption_CVec_ThirtyTwoBytesZZ* arg_conv = (LDKCOption_CVec_ThirtyTwoBytesZZ*)untag_ptr(arg);
15992         int64_t ret_conv = COption_CVec_ThirtyTwoBytesZZ_clone_ptr(arg_conv);
15993         return ret_conv;
15994 }
15995
15996 uint64_t  __attribute__((export_name("TS_COption_CVec_ThirtyTwoBytesZZ_clone"))) TS_COption_CVec_ThirtyTwoBytesZZ_clone(uint64_t orig) {
15997         LDKCOption_CVec_ThirtyTwoBytesZZ* orig_conv = (LDKCOption_CVec_ThirtyTwoBytesZZ*)untag_ptr(orig);
15998         LDKCOption_CVec_ThirtyTwoBytesZZ *ret_copy = MALLOC(sizeof(LDKCOption_CVec_ThirtyTwoBytesZZ), "LDKCOption_CVec_ThirtyTwoBytesZZ");
15999         *ret_copy = COption_CVec_ThirtyTwoBytesZZ_clone(orig_conv);
16000         uint64_t ret_ref = tag_ptr(ret_copy, true);
16001         return ret_ref;
16002 }
16003
16004 uint64_t  __attribute__((export_name("TS_CResult_ThirtyTwoBytesNoneZ_ok"))) TS_CResult_ThirtyTwoBytesNoneZ_ok(int8_tArray o) {
16005         LDKThirtyTwoBytes o_ref;
16006         CHECK(o->arr_len == 32);
16007         memcpy(o_ref.data, o->elems, 32); FREE(o);
16008         LDKCResult_ThirtyTwoBytesNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_ThirtyTwoBytesNoneZ), "LDKCResult_ThirtyTwoBytesNoneZ");
16009         *ret_conv = CResult_ThirtyTwoBytesNoneZ_ok(o_ref);
16010         return tag_ptr(ret_conv, true);
16011 }
16012
16013 uint64_t  __attribute__((export_name("TS_CResult_ThirtyTwoBytesNoneZ_err"))) TS_CResult_ThirtyTwoBytesNoneZ_err() {
16014         LDKCResult_ThirtyTwoBytesNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_ThirtyTwoBytesNoneZ), "LDKCResult_ThirtyTwoBytesNoneZ");
16015         *ret_conv = CResult_ThirtyTwoBytesNoneZ_err();
16016         return tag_ptr(ret_conv, true);
16017 }
16018
16019 jboolean  __attribute__((export_name("TS_CResult_ThirtyTwoBytesNoneZ_is_ok"))) TS_CResult_ThirtyTwoBytesNoneZ_is_ok(uint64_t o) {
16020         LDKCResult_ThirtyTwoBytesNoneZ* o_conv = (LDKCResult_ThirtyTwoBytesNoneZ*)untag_ptr(o);
16021         jboolean ret_conv = CResult_ThirtyTwoBytesNoneZ_is_ok(o_conv);
16022         return ret_conv;
16023 }
16024
16025 void  __attribute__((export_name("TS_CResult_ThirtyTwoBytesNoneZ_free"))) TS_CResult_ThirtyTwoBytesNoneZ_free(uint64_t _res) {
16026         if (!ptr_is_owned(_res)) return;
16027         void* _res_ptr = untag_ptr(_res);
16028         CHECK_ACCESS(_res_ptr);
16029         LDKCResult_ThirtyTwoBytesNoneZ _res_conv = *(LDKCResult_ThirtyTwoBytesNoneZ*)(_res_ptr);
16030         FREE(untag_ptr(_res));
16031         CResult_ThirtyTwoBytesNoneZ_free(_res_conv);
16032 }
16033
16034 static inline uint64_t CResult_ThirtyTwoBytesNoneZ_clone_ptr(LDKCResult_ThirtyTwoBytesNoneZ *NONNULL_PTR arg) {
16035         LDKCResult_ThirtyTwoBytesNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_ThirtyTwoBytesNoneZ), "LDKCResult_ThirtyTwoBytesNoneZ");
16036         *ret_conv = CResult_ThirtyTwoBytesNoneZ_clone(arg);
16037         return tag_ptr(ret_conv, true);
16038 }
16039 int64_t  __attribute__((export_name("TS_CResult_ThirtyTwoBytesNoneZ_clone_ptr"))) TS_CResult_ThirtyTwoBytesNoneZ_clone_ptr(uint64_t arg) {
16040         LDKCResult_ThirtyTwoBytesNoneZ* arg_conv = (LDKCResult_ThirtyTwoBytesNoneZ*)untag_ptr(arg);
16041         int64_t ret_conv = CResult_ThirtyTwoBytesNoneZ_clone_ptr(arg_conv);
16042         return ret_conv;
16043 }
16044
16045 uint64_t  __attribute__((export_name("TS_CResult_ThirtyTwoBytesNoneZ_clone"))) TS_CResult_ThirtyTwoBytesNoneZ_clone(uint64_t orig) {
16046         LDKCResult_ThirtyTwoBytesNoneZ* orig_conv = (LDKCResult_ThirtyTwoBytesNoneZ*)untag_ptr(orig);
16047         LDKCResult_ThirtyTwoBytesNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_ThirtyTwoBytesNoneZ), "LDKCResult_ThirtyTwoBytesNoneZ");
16048         *ret_conv = CResult_ThirtyTwoBytesNoneZ_clone(orig_conv);
16049         return tag_ptr(ret_conv, true);
16050 }
16051
16052 uint64_t  __attribute__((export_name("TS_CResult_BlindedPayInfoDecodeErrorZ_ok"))) TS_CResult_BlindedPayInfoDecodeErrorZ_ok(uint64_t o) {
16053         LDKBlindedPayInfo o_conv;
16054         o_conv.inner = untag_ptr(o);
16055         o_conv.is_owned = ptr_is_owned(o);
16056         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
16057         o_conv = BlindedPayInfo_clone(&o_conv);
16058         LDKCResult_BlindedPayInfoDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_BlindedPayInfoDecodeErrorZ), "LDKCResult_BlindedPayInfoDecodeErrorZ");
16059         *ret_conv = CResult_BlindedPayInfoDecodeErrorZ_ok(o_conv);
16060         return tag_ptr(ret_conv, true);
16061 }
16062
16063 uint64_t  __attribute__((export_name("TS_CResult_BlindedPayInfoDecodeErrorZ_err"))) TS_CResult_BlindedPayInfoDecodeErrorZ_err(uint64_t e) {
16064         void* e_ptr = untag_ptr(e);
16065         CHECK_ACCESS(e_ptr);
16066         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
16067         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
16068         LDKCResult_BlindedPayInfoDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_BlindedPayInfoDecodeErrorZ), "LDKCResult_BlindedPayInfoDecodeErrorZ");
16069         *ret_conv = CResult_BlindedPayInfoDecodeErrorZ_err(e_conv);
16070         return tag_ptr(ret_conv, true);
16071 }
16072
16073 jboolean  __attribute__((export_name("TS_CResult_BlindedPayInfoDecodeErrorZ_is_ok"))) TS_CResult_BlindedPayInfoDecodeErrorZ_is_ok(uint64_t o) {
16074         LDKCResult_BlindedPayInfoDecodeErrorZ* o_conv = (LDKCResult_BlindedPayInfoDecodeErrorZ*)untag_ptr(o);
16075         jboolean ret_conv = CResult_BlindedPayInfoDecodeErrorZ_is_ok(o_conv);
16076         return ret_conv;
16077 }
16078
16079 void  __attribute__((export_name("TS_CResult_BlindedPayInfoDecodeErrorZ_free"))) TS_CResult_BlindedPayInfoDecodeErrorZ_free(uint64_t _res) {
16080         if (!ptr_is_owned(_res)) return;
16081         void* _res_ptr = untag_ptr(_res);
16082         CHECK_ACCESS(_res_ptr);
16083         LDKCResult_BlindedPayInfoDecodeErrorZ _res_conv = *(LDKCResult_BlindedPayInfoDecodeErrorZ*)(_res_ptr);
16084         FREE(untag_ptr(_res));
16085         CResult_BlindedPayInfoDecodeErrorZ_free(_res_conv);
16086 }
16087
16088 static inline uint64_t CResult_BlindedPayInfoDecodeErrorZ_clone_ptr(LDKCResult_BlindedPayInfoDecodeErrorZ *NONNULL_PTR arg) {
16089         LDKCResult_BlindedPayInfoDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_BlindedPayInfoDecodeErrorZ), "LDKCResult_BlindedPayInfoDecodeErrorZ");
16090         *ret_conv = CResult_BlindedPayInfoDecodeErrorZ_clone(arg);
16091         return tag_ptr(ret_conv, true);
16092 }
16093 int64_t  __attribute__((export_name("TS_CResult_BlindedPayInfoDecodeErrorZ_clone_ptr"))) TS_CResult_BlindedPayInfoDecodeErrorZ_clone_ptr(uint64_t arg) {
16094         LDKCResult_BlindedPayInfoDecodeErrorZ* arg_conv = (LDKCResult_BlindedPayInfoDecodeErrorZ*)untag_ptr(arg);
16095         int64_t ret_conv = CResult_BlindedPayInfoDecodeErrorZ_clone_ptr(arg_conv);
16096         return ret_conv;
16097 }
16098
16099 uint64_t  __attribute__((export_name("TS_CResult_BlindedPayInfoDecodeErrorZ_clone"))) TS_CResult_BlindedPayInfoDecodeErrorZ_clone(uint64_t orig) {
16100         LDKCResult_BlindedPayInfoDecodeErrorZ* orig_conv = (LDKCResult_BlindedPayInfoDecodeErrorZ*)untag_ptr(orig);
16101         LDKCResult_BlindedPayInfoDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_BlindedPayInfoDecodeErrorZ), "LDKCResult_BlindedPayInfoDecodeErrorZ");
16102         *ret_conv = CResult_BlindedPayInfoDecodeErrorZ_clone(orig_conv);
16103         return tag_ptr(ret_conv, true);
16104 }
16105
16106 uint64_t  __attribute__((export_name("TS_CResult_DelayedPaymentOutputDescriptorDecodeErrorZ_ok"))) TS_CResult_DelayedPaymentOutputDescriptorDecodeErrorZ_ok(uint64_t o) {
16107         LDKDelayedPaymentOutputDescriptor o_conv;
16108         o_conv.inner = untag_ptr(o);
16109         o_conv.is_owned = ptr_is_owned(o);
16110         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
16111         o_conv = DelayedPaymentOutputDescriptor_clone(&o_conv);
16112         LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ), "LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ");
16113         *ret_conv = CResult_DelayedPaymentOutputDescriptorDecodeErrorZ_ok(o_conv);
16114         return tag_ptr(ret_conv, true);
16115 }
16116
16117 uint64_t  __attribute__((export_name("TS_CResult_DelayedPaymentOutputDescriptorDecodeErrorZ_err"))) TS_CResult_DelayedPaymentOutputDescriptorDecodeErrorZ_err(uint64_t e) {
16118         void* e_ptr = untag_ptr(e);
16119         CHECK_ACCESS(e_ptr);
16120         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
16121         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
16122         LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ), "LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ");
16123         *ret_conv = CResult_DelayedPaymentOutputDescriptorDecodeErrorZ_err(e_conv);
16124         return tag_ptr(ret_conv, true);
16125 }
16126
16127 jboolean  __attribute__((export_name("TS_CResult_DelayedPaymentOutputDescriptorDecodeErrorZ_is_ok"))) TS_CResult_DelayedPaymentOutputDescriptorDecodeErrorZ_is_ok(uint64_t o) {
16128         LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ* o_conv = (LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ*)untag_ptr(o);
16129         jboolean ret_conv = CResult_DelayedPaymentOutputDescriptorDecodeErrorZ_is_ok(o_conv);
16130         return ret_conv;
16131 }
16132
16133 void  __attribute__((export_name("TS_CResult_DelayedPaymentOutputDescriptorDecodeErrorZ_free"))) TS_CResult_DelayedPaymentOutputDescriptorDecodeErrorZ_free(uint64_t _res) {
16134         if (!ptr_is_owned(_res)) return;
16135         void* _res_ptr = untag_ptr(_res);
16136         CHECK_ACCESS(_res_ptr);
16137         LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ _res_conv = *(LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ*)(_res_ptr);
16138         FREE(untag_ptr(_res));
16139         CResult_DelayedPaymentOutputDescriptorDecodeErrorZ_free(_res_conv);
16140 }
16141
16142 static inline uint64_t CResult_DelayedPaymentOutputDescriptorDecodeErrorZ_clone_ptr(LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ *NONNULL_PTR arg) {
16143         LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ), "LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ");
16144         *ret_conv = CResult_DelayedPaymentOutputDescriptorDecodeErrorZ_clone(arg);
16145         return tag_ptr(ret_conv, true);
16146 }
16147 int64_t  __attribute__((export_name("TS_CResult_DelayedPaymentOutputDescriptorDecodeErrorZ_clone_ptr"))) TS_CResult_DelayedPaymentOutputDescriptorDecodeErrorZ_clone_ptr(uint64_t arg) {
16148         LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ* arg_conv = (LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ*)untag_ptr(arg);
16149         int64_t ret_conv = CResult_DelayedPaymentOutputDescriptorDecodeErrorZ_clone_ptr(arg_conv);
16150         return ret_conv;
16151 }
16152
16153 uint64_t  __attribute__((export_name("TS_CResult_DelayedPaymentOutputDescriptorDecodeErrorZ_clone"))) TS_CResult_DelayedPaymentOutputDescriptorDecodeErrorZ_clone(uint64_t orig) {
16154         LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ* orig_conv = (LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ*)untag_ptr(orig);
16155         LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ), "LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ");
16156         *ret_conv = CResult_DelayedPaymentOutputDescriptorDecodeErrorZ_clone(orig_conv);
16157         return tag_ptr(ret_conv, true);
16158 }
16159
16160 uint64_t  __attribute__((export_name("TS_CResult_StaticPaymentOutputDescriptorDecodeErrorZ_ok"))) TS_CResult_StaticPaymentOutputDescriptorDecodeErrorZ_ok(uint64_t o) {
16161         LDKStaticPaymentOutputDescriptor o_conv;
16162         o_conv.inner = untag_ptr(o);
16163         o_conv.is_owned = ptr_is_owned(o);
16164         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
16165         o_conv = StaticPaymentOutputDescriptor_clone(&o_conv);
16166         LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ), "LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ");
16167         *ret_conv = CResult_StaticPaymentOutputDescriptorDecodeErrorZ_ok(o_conv);
16168         return tag_ptr(ret_conv, true);
16169 }
16170
16171 uint64_t  __attribute__((export_name("TS_CResult_StaticPaymentOutputDescriptorDecodeErrorZ_err"))) TS_CResult_StaticPaymentOutputDescriptorDecodeErrorZ_err(uint64_t e) {
16172         void* e_ptr = untag_ptr(e);
16173         CHECK_ACCESS(e_ptr);
16174         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
16175         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
16176         LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ), "LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ");
16177         *ret_conv = CResult_StaticPaymentOutputDescriptorDecodeErrorZ_err(e_conv);
16178         return tag_ptr(ret_conv, true);
16179 }
16180
16181 jboolean  __attribute__((export_name("TS_CResult_StaticPaymentOutputDescriptorDecodeErrorZ_is_ok"))) TS_CResult_StaticPaymentOutputDescriptorDecodeErrorZ_is_ok(uint64_t o) {
16182         LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ* o_conv = (LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ*)untag_ptr(o);
16183         jboolean ret_conv = CResult_StaticPaymentOutputDescriptorDecodeErrorZ_is_ok(o_conv);
16184         return ret_conv;
16185 }
16186
16187 void  __attribute__((export_name("TS_CResult_StaticPaymentOutputDescriptorDecodeErrorZ_free"))) TS_CResult_StaticPaymentOutputDescriptorDecodeErrorZ_free(uint64_t _res) {
16188         if (!ptr_is_owned(_res)) return;
16189         void* _res_ptr = untag_ptr(_res);
16190         CHECK_ACCESS(_res_ptr);
16191         LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ _res_conv = *(LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ*)(_res_ptr);
16192         FREE(untag_ptr(_res));
16193         CResult_StaticPaymentOutputDescriptorDecodeErrorZ_free(_res_conv);
16194 }
16195
16196 static inline uint64_t CResult_StaticPaymentOutputDescriptorDecodeErrorZ_clone_ptr(LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ *NONNULL_PTR arg) {
16197         LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ), "LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ");
16198         *ret_conv = CResult_StaticPaymentOutputDescriptorDecodeErrorZ_clone(arg);
16199         return tag_ptr(ret_conv, true);
16200 }
16201 int64_t  __attribute__((export_name("TS_CResult_StaticPaymentOutputDescriptorDecodeErrorZ_clone_ptr"))) TS_CResult_StaticPaymentOutputDescriptorDecodeErrorZ_clone_ptr(uint64_t arg) {
16202         LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ* arg_conv = (LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ*)untag_ptr(arg);
16203         int64_t ret_conv = CResult_StaticPaymentOutputDescriptorDecodeErrorZ_clone_ptr(arg_conv);
16204         return ret_conv;
16205 }
16206
16207 uint64_t  __attribute__((export_name("TS_CResult_StaticPaymentOutputDescriptorDecodeErrorZ_clone"))) TS_CResult_StaticPaymentOutputDescriptorDecodeErrorZ_clone(uint64_t orig) {
16208         LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ* orig_conv = (LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ*)untag_ptr(orig);
16209         LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ), "LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ");
16210         *ret_conv = CResult_StaticPaymentOutputDescriptorDecodeErrorZ_clone(orig_conv);
16211         return tag_ptr(ret_conv, true);
16212 }
16213
16214 uint64_t  __attribute__((export_name("TS_CResult_SpendableOutputDescriptorDecodeErrorZ_ok"))) TS_CResult_SpendableOutputDescriptorDecodeErrorZ_ok(uint64_t o) {
16215         void* o_ptr = untag_ptr(o);
16216         CHECK_ACCESS(o_ptr);
16217         LDKSpendableOutputDescriptor o_conv = *(LDKSpendableOutputDescriptor*)(o_ptr);
16218         o_conv = SpendableOutputDescriptor_clone((LDKSpendableOutputDescriptor*)untag_ptr(o));
16219         LDKCResult_SpendableOutputDescriptorDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_SpendableOutputDescriptorDecodeErrorZ), "LDKCResult_SpendableOutputDescriptorDecodeErrorZ");
16220         *ret_conv = CResult_SpendableOutputDescriptorDecodeErrorZ_ok(o_conv);
16221         return tag_ptr(ret_conv, true);
16222 }
16223
16224 uint64_t  __attribute__((export_name("TS_CResult_SpendableOutputDescriptorDecodeErrorZ_err"))) TS_CResult_SpendableOutputDescriptorDecodeErrorZ_err(uint64_t e) {
16225         void* e_ptr = untag_ptr(e);
16226         CHECK_ACCESS(e_ptr);
16227         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
16228         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
16229         LDKCResult_SpendableOutputDescriptorDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_SpendableOutputDescriptorDecodeErrorZ), "LDKCResult_SpendableOutputDescriptorDecodeErrorZ");
16230         *ret_conv = CResult_SpendableOutputDescriptorDecodeErrorZ_err(e_conv);
16231         return tag_ptr(ret_conv, true);
16232 }
16233
16234 jboolean  __attribute__((export_name("TS_CResult_SpendableOutputDescriptorDecodeErrorZ_is_ok"))) TS_CResult_SpendableOutputDescriptorDecodeErrorZ_is_ok(uint64_t o) {
16235         LDKCResult_SpendableOutputDescriptorDecodeErrorZ* o_conv = (LDKCResult_SpendableOutputDescriptorDecodeErrorZ*)untag_ptr(o);
16236         jboolean ret_conv = CResult_SpendableOutputDescriptorDecodeErrorZ_is_ok(o_conv);
16237         return ret_conv;
16238 }
16239
16240 void  __attribute__((export_name("TS_CResult_SpendableOutputDescriptorDecodeErrorZ_free"))) TS_CResult_SpendableOutputDescriptorDecodeErrorZ_free(uint64_t _res) {
16241         if (!ptr_is_owned(_res)) return;
16242         void* _res_ptr = untag_ptr(_res);
16243         CHECK_ACCESS(_res_ptr);
16244         LDKCResult_SpendableOutputDescriptorDecodeErrorZ _res_conv = *(LDKCResult_SpendableOutputDescriptorDecodeErrorZ*)(_res_ptr);
16245         FREE(untag_ptr(_res));
16246         CResult_SpendableOutputDescriptorDecodeErrorZ_free(_res_conv);
16247 }
16248
16249 static inline uint64_t CResult_SpendableOutputDescriptorDecodeErrorZ_clone_ptr(LDKCResult_SpendableOutputDescriptorDecodeErrorZ *NONNULL_PTR arg) {
16250         LDKCResult_SpendableOutputDescriptorDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_SpendableOutputDescriptorDecodeErrorZ), "LDKCResult_SpendableOutputDescriptorDecodeErrorZ");
16251         *ret_conv = CResult_SpendableOutputDescriptorDecodeErrorZ_clone(arg);
16252         return tag_ptr(ret_conv, true);
16253 }
16254 int64_t  __attribute__((export_name("TS_CResult_SpendableOutputDescriptorDecodeErrorZ_clone_ptr"))) TS_CResult_SpendableOutputDescriptorDecodeErrorZ_clone_ptr(uint64_t arg) {
16255         LDKCResult_SpendableOutputDescriptorDecodeErrorZ* arg_conv = (LDKCResult_SpendableOutputDescriptorDecodeErrorZ*)untag_ptr(arg);
16256         int64_t ret_conv = CResult_SpendableOutputDescriptorDecodeErrorZ_clone_ptr(arg_conv);
16257         return ret_conv;
16258 }
16259
16260 uint64_t  __attribute__((export_name("TS_CResult_SpendableOutputDescriptorDecodeErrorZ_clone"))) TS_CResult_SpendableOutputDescriptorDecodeErrorZ_clone(uint64_t orig) {
16261         LDKCResult_SpendableOutputDescriptorDecodeErrorZ* orig_conv = (LDKCResult_SpendableOutputDescriptorDecodeErrorZ*)untag_ptr(orig);
16262         LDKCResult_SpendableOutputDescriptorDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_SpendableOutputDescriptorDecodeErrorZ), "LDKCResult_SpendableOutputDescriptorDecodeErrorZ");
16263         *ret_conv = CResult_SpendableOutputDescriptorDecodeErrorZ_clone(orig_conv);
16264         return tag_ptr(ret_conv, true);
16265 }
16266
16267 void  __attribute__((export_name("TS_CVec_SpendableOutputDescriptorZ_free"))) TS_CVec_SpendableOutputDescriptorZ_free(uint64_tArray _res) {
16268         LDKCVec_SpendableOutputDescriptorZ _res_constr;
16269         _res_constr.datalen = _res->arr_len;
16270         if (_res_constr.datalen > 0)
16271                 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKSpendableOutputDescriptor), "LDKCVec_SpendableOutputDescriptorZ Elements");
16272         else
16273                 _res_constr.data = NULL;
16274         uint64_t* _res_vals = _res->elems;
16275         for (size_t b = 0; b < _res_constr.datalen; b++) {
16276                 uint64_t _res_conv_27 = _res_vals[b];
16277                 void* _res_conv_27_ptr = untag_ptr(_res_conv_27);
16278                 CHECK_ACCESS(_res_conv_27_ptr);
16279                 LDKSpendableOutputDescriptor _res_conv_27_conv = *(LDKSpendableOutputDescriptor*)(_res_conv_27_ptr);
16280                 FREE(untag_ptr(_res_conv_27));
16281                 _res_constr.data[b] = _res_conv_27_conv;
16282         }
16283         FREE(_res);
16284         CVec_SpendableOutputDescriptorZ_free(_res_constr);
16285 }
16286
16287 void  __attribute__((export_name("TS_CVec_TxOutZ_free"))) TS_CVec_TxOutZ_free(uint64_tArray _res) {
16288         LDKCVec_TxOutZ _res_constr;
16289         _res_constr.datalen = _res->arr_len;
16290         if (_res_constr.datalen > 0)
16291                 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKTxOut), "LDKCVec_TxOutZ Elements");
16292         else
16293                 _res_constr.data = NULL;
16294         uint64_t* _res_vals = _res->elems;
16295         for (size_t h = 0; h < _res_constr.datalen; h++) {
16296                 uint64_t _res_conv_7 = _res_vals[h];
16297                 void* _res_conv_7_ptr = untag_ptr(_res_conv_7);
16298                 CHECK_ACCESS(_res_conv_7_ptr);
16299                 LDKTxOut _res_conv_7_conv = *(LDKTxOut*)(_res_conv_7_ptr);
16300                 FREE(untag_ptr(_res_conv_7));
16301                 _res_constr.data[h] = _res_conv_7_conv;
16302         }
16303         FREE(_res);
16304         CVec_TxOutZ_free(_res_constr);
16305 }
16306
16307 uint64_t  __attribute__((export_name("TS_COption_u32Z_some"))) TS_COption_u32Z_some(int32_t o) {
16308         LDKCOption_u32Z *ret_copy = MALLOC(sizeof(LDKCOption_u32Z), "LDKCOption_u32Z");
16309         *ret_copy = COption_u32Z_some(o);
16310         uint64_t ret_ref = tag_ptr(ret_copy, true);
16311         return ret_ref;
16312 }
16313
16314 uint64_t  __attribute__((export_name("TS_COption_u32Z_none"))) TS_COption_u32Z_none() {
16315         LDKCOption_u32Z *ret_copy = MALLOC(sizeof(LDKCOption_u32Z), "LDKCOption_u32Z");
16316         *ret_copy = COption_u32Z_none();
16317         uint64_t ret_ref = tag_ptr(ret_copy, true);
16318         return ret_ref;
16319 }
16320
16321 void  __attribute__((export_name("TS_COption_u32Z_free"))) TS_COption_u32Z_free(uint64_t _res) {
16322         if (!ptr_is_owned(_res)) return;
16323         void* _res_ptr = untag_ptr(_res);
16324         CHECK_ACCESS(_res_ptr);
16325         LDKCOption_u32Z _res_conv = *(LDKCOption_u32Z*)(_res_ptr);
16326         FREE(untag_ptr(_res));
16327         COption_u32Z_free(_res_conv);
16328 }
16329
16330 static inline uint64_t COption_u32Z_clone_ptr(LDKCOption_u32Z *NONNULL_PTR arg) {
16331         LDKCOption_u32Z *ret_copy = MALLOC(sizeof(LDKCOption_u32Z), "LDKCOption_u32Z");
16332         *ret_copy = COption_u32Z_clone(arg);
16333         uint64_t ret_ref = tag_ptr(ret_copy, true);
16334         return ret_ref;
16335 }
16336 int64_t  __attribute__((export_name("TS_COption_u32Z_clone_ptr"))) TS_COption_u32Z_clone_ptr(uint64_t arg) {
16337         LDKCOption_u32Z* arg_conv = (LDKCOption_u32Z*)untag_ptr(arg);
16338         int64_t ret_conv = COption_u32Z_clone_ptr(arg_conv);
16339         return ret_conv;
16340 }
16341
16342 uint64_t  __attribute__((export_name("TS_COption_u32Z_clone"))) TS_COption_u32Z_clone(uint64_t orig) {
16343         LDKCOption_u32Z* orig_conv = (LDKCOption_u32Z*)untag_ptr(orig);
16344         LDKCOption_u32Z *ret_copy = MALLOC(sizeof(LDKCOption_u32Z), "LDKCOption_u32Z");
16345         *ret_copy = COption_u32Z_clone(orig_conv);
16346         uint64_t ret_ref = tag_ptr(ret_copy, true);
16347         return ret_ref;
16348 }
16349
16350 static inline uint64_t C2Tuple_CVec_u8ZusizeZ_clone_ptr(LDKC2Tuple_CVec_u8ZusizeZ *NONNULL_PTR arg) {
16351         LDKC2Tuple_CVec_u8ZusizeZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_CVec_u8ZusizeZ), "LDKC2Tuple_CVec_u8ZusizeZ");
16352         *ret_conv = C2Tuple_CVec_u8ZusizeZ_clone(arg);
16353         return tag_ptr(ret_conv, true);
16354 }
16355 int64_t  __attribute__((export_name("TS_C2Tuple_CVec_u8ZusizeZ_clone_ptr"))) TS_C2Tuple_CVec_u8ZusizeZ_clone_ptr(uint64_t arg) {
16356         LDKC2Tuple_CVec_u8ZusizeZ* arg_conv = (LDKC2Tuple_CVec_u8ZusizeZ*)untag_ptr(arg);
16357         int64_t ret_conv = C2Tuple_CVec_u8ZusizeZ_clone_ptr(arg_conv);
16358         return ret_conv;
16359 }
16360
16361 uint64_t  __attribute__((export_name("TS_C2Tuple_CVec_u8ZusizeZ_clone"))) TS_C2Tuple_CVec_u8ZusizeZ_clone(uint64_t orig) {
16362         LDKC2Tuple_CVec_u8ZusizeZ* orig_conv = (LDKC2Tuple_CVec_u8ZusizeZ*)untag_ptr(orig);
16363         LDKC2Tuple_CVec_u8ZusizeZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_CVec_u8ZusizeZ), "LDKC2Tuple_CVec_u8ZusizeZ");
16364         *ret_conv = C2Tuple_CVec_u8ZusizeZ_clone(orig_conv);
16365         return tag_ptr(ret_conv, true);
16366 }
16367
16368 uint64_t  __attribute__((export_name("TS_C2Tuple_CVec_u8ZusizeZ_new"))) TS_C2Tuple_CVec_u8ZusizeZ_new(int8_tArray a, uint32_t b) {
16369         LDKCVec_u8Z a_ref;
16370         a_ref.datalen = a->arr_len;
16371         a_ref.data = MALLOC(a_ref.datalen, "LDKCVec_u8Z Bytes");
16372         memcpy(a_ref.data, a->elems, a_ref.datalen); FREE(a);
16373         LDKC2Tuple_CVec_u8ZusizeZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_CVec_u8ZusizeZ), "LDKC2Tuple_CVec_u8ZusizeZ");
16374         *ret_conv = C2Tuple_CVec_u8ZusizeZ_new(a_ref, b);
16375         return tag_ptr(ret_conv, true);
16376 }
16377
16378 void  __attribute__((export_name("TS_C2Tuple_CVec_u8ZusizeZ_free"))) TS_C2Tuple_CVec_u8ZusizeZ_free(uint64_t _res) {
16379         if (!ptr_is_owned(_res)) return;
16380         void* _res_ptr = untag_ptr(_res);
16381         CHECK_ACCESS(_res_ptr);
16382         LDKC2Tuple_CVec_u8ZusizeZ _res_conv = *(LDKC2Tuple_CVec_u8ZusizeZ*)(_res_ptr);
16383         FREE(untag_ptr(_res));
16384         C2Tuple_CVec_u8ZusizeZ_free(_res_conv);
16385 }
16386
16387 uint64_t  __attribute__((export_name("TS_CResult_C2Tuple_CVec_u8ZusizeZNoneZ_ok"))) TS_CResult_C2Tuple_CVec_u8ZusizeZNoneZ_ok(uint64_t o) {
16388         void* o_ptr = untag_ptr(o);
16389         CHECK_ACCESS(o_ptr);
16390         LDKC2Tuple_CVec_u8ZusizeZ o_conv = *(LDKC2Tuple_CVec_u8ZusizeZ*)(o_ptr);
16391         o_conv = C2Tuple_CVec_u8ZusizeZ_clone((LDKC2Tuple_CVec_u8ZusizeZ*)untag_ptr(o));
16392         LDKCResult_C2Tuple_CVec_u8ZusizeZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_CVec_u8ZusizeZNoneZ), "LDKCResult_C2Tuple_CVec_u8ZusizeZNoneZ");
16393         *ret_conv = CResult_C2Tuple_CVec_u8ZusizeZNoneZ_ok(o_conv);
16394         return tag_ptr(ret_conv, true);
16395 }
16396
16397 uint64_t  __attribute__((export_name("TS_CResult_C2Tuple_CVec_u8ZusizeZNoneZ_err"))) TS_CResult_C2Tuple_CVec_u8ZusizeZNoneZ_err() {
16398         LDKCResult_C2Tuple_CVec_u8ZusizeZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_CVec_u8ZusizeZNoneZ), "LDKCResult_C2Tuple_CVec_u8ZusizeZNoneZ");
16399         *ret_conv = CResult_C2Tuple_CVec_u8ZusizeZNoneZ_err();
16400         return tag_ptr(ret_conv, true);
16401 }
16402
16403 jboolean  __attribute__((export_name("TS_CResult_C2Tuple_CVec_u8ZusizeZNoneZ_is_ok"))) TS_CResult_C2Tuple_CVec_u8ZusizeZNoneZ_is_ok(uint64_t o) {
16404         LDKCResult_C2Tuple_CVec_u8ZusizeZNoneZ* o_conv = (LDKCResult_C2Tuple_CVec_u8ZusizeZNoneZ*)untag_ptr(o);
16405         jboolean ret_conv = CResult_C2Tuple_CVec_u8ZusizeZNoneZ_is_ok(o_conv);
16406         return ret_conv;
16407 }
16408
16409 void  __attribute__((export_name("TS_CResult_C2Tuple_CVec_u8ZusizeZNoneZ_free"))) TS_CResult_C2Tuple_CVec_u8ZusizeZNoneZ_free(uint64_t _res) {
16410         if (!ptr_is_owned(_res)) return;
16411         void* _res_ptr = untag_ptr(_res);
16412         CHECK_ACCESS(_res_ptr);
16413         LDKCResult_C2Tuple_CVec_u8ZusizeZNoneZ _res_conv = *(LDKCResult_C2Tuple_CVec_u8ZusizeZNoneZ*)(_res_ptr);
16414         FREE(untag_ptr(_res));
16415         CResult_C2Tuple_CVec_u8ZusizeZNoneZ_free(_res_conv);
16416 }
16417
16418 static inline uint64_t CResult_C2Tuple_CVec_u8ZusizeZNoneZ_clone_ptr(LDKCResult_C2Tuple_CVec_u8ZusizeZNoneZ *NONNULL_PTR arg) {
16419         LDKCResult_C2Tuple_CVec_u8ZusizeZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_CVec_u8ZusizeZNoneZ), "LDKCResult_C2Tuple_CVec_u8ZusizeZNoneZ");
16420         *ret_conv = CResult_C2Tuple_CVec_u8ZusizeZNoneZ_clone(arg);
16421         return tag_ptr(ret_conv, true);
16422 }
16423 int64_t  __attribute__((export_name("TS_CResult_C2Tuple_CVec_u8ZusizeZNoneZ_clone_ptr"))) TS_CResult_C2Tuple_CVec_u8ZusizeZNoneZ_clone_ptr(uint64_t arg) {
16424         LDKCResult_C2Tuple_CVec_u8ZusizeZNoneZ* arg_conv = (LDKCResult_C2Tuple_CVec_u8ZusizeZNoneZ*)untag_ptr(arg);
16425         int64_t ret_conv = CResult_C2Tuple_CVec_u8ZusizeZNoneZ_clone_ptr(arg_conv);
16426         return ret_conv;
16427 }
16428
16429 uint64_t  __attribute__((export_name("TS_CResult_C2Tuple_CVec_u8ZusizeZNoneZ_clone"))) TS_CResult_C2Tuple_CVec_u8ZusizeZNoneZ_clone(uint64_t orig) {
16430         LDKCResult_C2Tuple_CVec_u8ZusizeZNoneZ* orig_conv = (LDKCResult_C2Tuple_CVec_u8ZusizeZNoneZ*)untag_ptr(orig);
16431         LDKCResult_C2Tuple_CVec_u8ZusizeZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_CVec_u8ZusizeZNoneZ), "LDKCResult_C2Tuple_CVec_u8ZusizeZNoneZ");
16432         *ret_conv = CResult_C2Tuple_CVec_u8ZusizeZNoneZ_clone(orig_conv);
16433         return tag_ptr(ret_conv, true);
16434 }
16435
16436 uint64_t  __attribute__((export_name("TS_CResult_ChannelDerivationParametersDecodeErrorZ_ok"))) TS_CResult_ChannelDerivationParametersDecodeErrorZ_ok(uint64_t o) {
16437         LDKChannelDerivationParameters o_conv;
16438         o_conv.inner = untag_ptr(o);
16439         o_conv.is_owned = ptr_is_owned(o);
16440         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
16441         o_conv = ChannelDerivationParameters_clone(&o_conv);
16442         LDKCResult_ChannelDerivationParametersDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelDerivationParametersDecodeErrorZ), "LDKCResult_ChannelDerivationParametersDecodeErrorZ");
16443         *ret_conv = CResult_ChannelDerivationParametersDecodeErrorZ_ok(o_conv);
16444         return tag_ptr(ret_conv, true);
16445 }
16446
16447 uint64_t  __attribute__((export_name("TS_CResult_ChannelDerivationParametersDecodeErrorZ_err"))) TS_CResult_ChannelDerivationParametersDecodeErrorZ_err(uint64_t e) {
16448         void* e_ptr = untag_ptr(e);
16449         CHECK_ACCESS(e_ptr);
16450         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
16451         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
16452         LDKCResult_ChannelDerivationParametersDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelDerivationParametersDecodeErrorZ), "LDKCResult_ChannelDerivationParametersDecodeErrorZ");
16453         *ret_conv = CResult_ChannelDerivationParametersDecodeErrorZ_err(e_conv);
16454         return tag_ptr(ret_conv, true);
16455 }
16456
16457 jboolean  __attribute__((export_name("TS_CResult_ChannelDerivationParametersDecodeErrorZ_is_ok"))) TS_CResult_ChannelDerivationParametersDecodeErrorZ_is_ok(uint64_t o) {
16458         LDKCResult_ChannelDerivationParametersDecodeErrorZ* o_conv = (LDKCResult_ChannelDerivationParametersDecodeErrorZ*)untag_ptr(o);
16459         jboolean ret_conv = CResult_ChannelDerivationParametersDecodeErrorZ_is_ok(o_conv);
16460         return ret_conv;
16461 }
16462
16463 void  __attribute__((export_name("TS_CResult_ChannelDerivationParametersDecodeErrorZ_free"))) TS_CResult_ChannelDerivationParametersDecodeErrorZ_free(uint64_t _res) {
16464         if (!ptr_is_owned(_res)) return;
16465         void* _res_ptr = untag_ptr(_res);
16466         CHECK_ACCESS(_res_ptr);
16467         LDKCResult_ChannelDerivationParametersDecodeErrorZ _res_conv = *(LDKCResult_ChannelDerivationParametersDecodeErrorZ*)(_res_ptr);
16468         FREE(untag_ptr(_res));
16469         CResult_ChannelDerivationParametersDecodeErrorZ_free(_res_conv);
16470 }
16471
16472 static inline uint64_t CResult_ChannelDerivationParametersDecodeErrorZ_clone_ptr(LDKCResult_ChannelDerivationParametersDecodeErrorZ *NONNULL_PTR arg) {
16473         LDKCResult_ChannelDerivationParametersDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelDerivationParametersDecodeErrorZ), "LDKCResult_ChannelDerivationParametersDecodeErrorZ");
16474         *ret_conv = CResult_ChannelDerivationParametersDecodeErrorZ_clone(arg);
16475         return tag_ptr(ret_conv, true);
16476 }
16477 int64_t  __attribute__((export_name("TS_CResult_ChannelDerivationParametersDecodeErrorZ_clone_ptr"))) TS_CResult_ChannelDerivationParametersDecodeErrorZ_clone_ptr(uint64_t arg) {
16478         LDKCResult_ChannelDerivationParametersDecodeErrorZ* arg_conv = (LDKCResult_ChannelDerivationParametersDecodeErrorZ*)untag_ptr(arg);
16479         int64_t ret_conv = CResult_ChannelDerivationParametersDecodeErrorZ_clone_ptr(arg_conv);
16480         return ret_conv;
16481 }
16482
16483 uint64_t  __attribute__((export_name("TS_CResult_ChannelDerivationParametersDecodeErrorZ_clone"))) TS_CResult_ChannelDerivationParametersDecodeErrorZ_clone(uint64_t orig) {
16484         LDKCResult_ChannelDerivationParametersDecodeErrorZ* orig_conv = (LDKCResult_ChannelDerivationParametersDecodeErrorZ*)untag_ptr(orig);
16485         LDKCResult_ChannelDerivationParametersDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelDerivationParametersDecodeErrorZ), "LDKCResult_ChannelDerivationParametersDecodeErrorZ");
16486         *ret_conv = CResult_ChannelDerivationParametersDecodeErrorZ_clone(orig_conv);
16487         return tag_ptr(ret_conv, true);
16488 }
16489
16490 uint64_t  __attribute__((export_name("TS_CResult_HTLCDescriptorDecodeErrorZ_ok"))) TS_CResult_HTLCDescriptorDecodeErrorZ_ok(uint64_t o) {
16491         LDKHTLCDescriptor o_conv;
16492         o_conv.inner = untag_ptr(o);
16493         o_conv.is_owned = ptr_is_owned(o);
16494         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
16495         o_conv = HTLCDescriptor_clone(&o_conv);
16496         LDKCResult_HTLCDescriptorDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_HTLCDescriptorDecodeErrorZ), "LDKCResult_HTLCDescriptorDecodeErrorZ");
16497         *ret_conv = CResult_HTLCDescriptorDecodeErrorZ_ok(o_conv);
16498         return tag_ptr(ret_conv, true);
16499 }
16500
16501 uint64_t  __attribute__((export_name("TS_CResult_HTLCDescriptorDecodeErrorZ_err"))) TS_CResult_HTLCDescriptorDecodeErrorZ_err(uint64_t e) {
16502         void* e_ptr = untag_ptr(e);
16503         CHECK_ACCESS(e_ptr);
16504         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
16505         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
16506         LDKCResult_HTLCDescriptorDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_HTLCDescriptorDecodeErrorZ), "LDKCResult_HTLCDescriptorDecodeErrorZ");
16507         *ret_conv = CResult_HTLCDescriptorDecodeErrorZ_err(e_conv);
16508         return tag_ptr(ret_conv, true);
16509 }
16510
16511 jboolean  __attribute__((export_name("TS_CResult_HTLCDescriptorDecodeErrorZ_is_ok"))) TS_CResult_HTLCDescriptorDecodeErrorZ_is_ok(uint64_t o) {
16512         LDKCResult_HTLCDescriptorDecodeErrorZ* o_conv = (LDKCResult_HTLCDescriptorDecodeErrorZ*)untag_ptr(o);
16513         jboolean ret_conv = CResult_HTLCDescriptorDecodeErrorZ_is_ok(o_conv);
16514         return ret_conv;
16515 }
16516
16517 void  __attribute__((export_name("TS_CResult_HTLCDescriptorDecodeErrorZ_free"))) TS_CResult_HTLCDescriptorDecodeErrorZ_free(uint64_t _res) {
16518         if (!ptr_is_owned(_res)) return;
16519         void* _res_ptr = untag_ptr(_res);
16520         CHECK_ACCESS(_res_ptr);
16521         LDKCResult_HTLCDescriptorDecodeErrorZ _res_conv = *(LDKCResult_HTLCDescriptorDecodeErrorZ*)(_res_ptr);
16522         FREE(untag_ptr(_res));
16523         CResult_HTLCDescriptorDecodeErrorZ_free(_res_conv);
16524 }
16525
16526 static inline uint64_t CResult_HTLCDescriptorDecodeErrorZ_clone_ptr(LDKCResult_HTLCDescriptorDecodeErrorZ *NONNULL_PTR arg) {
16527         LDKCResult_HTLCDescriptorDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_HTLCDescriptorDecodeErrorZ), "LDKCResult_HTLCDescriptorDecodeErrorZ");
16528         *ret_conv = CResult_HTLCDescriptorDecodeErrorZ_clone(arg);
16529         return tag_ptr(ret_conv, true);
16530 }
16531 int64_t  __attribute__((export_name("TS_CResult_HTLCDescriptorDecodeErrorZ_clone_ptr"))) TS_CResult_HTLCDescriptorDecodeErrorZ_clone_ptr(uint64_t arg) {
16532         LDKCResult_HTLCDescriptorDecodeErrorZ* arg_conv = (LDKCResult_HTLCDescriptorDecodeErrorZ*)untag_ptr(arg);
16533         int64_t ret_conv = CResult_HTLCDescriptorDecodeErrorZ_clone_ptr(arg_conv);
16534         return ret_conv;
16535 }
16536
16537 uint64_t  __attribute__((export_name("TS_CResult_HTLCDescriptorDecodeErrorZ_clone"))) TS_CResult_HTLCDescriptorDecodeErrorZ_clone(uint64_t orig) {
16538         LDKCResult_HTLCDescriptorDecodeErrorZ* orig_conv = (LDKCResult_HTLCDescriptorDecodeErrorZ*)untag_ptr(orig);
16539         LDKCResult_HTLCDescriptorDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_HTLCDescriptorDecodeErrorZ), "LDKCResult_HTLCDescriptorDecodeErrorZ");
16540         *ret_conv = CResult_HTLCDescriptorDecodeErrorZ_clone(orig_conv);
16541         return tag_ptr(ret_conv, true);
16542 }
16543
16544 uint64_t  __attribute__((export_name("TS_CResult_NoneNoneZ_ok"))) TS_CResult_NoneNoneZ_ok() {
16545         LDKCResult_NoneNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneNoneZ), "LDKCResult_NoneNoneZ");
16546         *ret_conv = CResult_NoneNoneZ_ok();
16547         return tag_ptr(ret_conv, true);
16548 }
16549
16550 uint64_t  __attribute__((export_name("TS_CResult_NoneNoneZ_err"))) TS_CResult_NoneNoneZ_err() {
16551         LDKCResult_NoneNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneNoneZ), "LDKCResult_NoneNoneZ");
16552         *ret_conv = CResult_NoneNoneZ_err();
16553         return tag_ptr(ret_conv, true);
16554 }
16555
16556 jboolean  __attribute__((export_name("TS_CResult_NoneNoneZ_is_ok"))) TS_CResult_NoneNoneZ_is_ok(uint64_t o) {
16557         LDKCResult_NoneNoneZ* o_conv = (LDKCResult_NoneNoneZ*)untag_ptr(o);
16558         jboolean ret_conv = CResult_NoneNoneZ_is_ok(o_conv);
16559         return ret_conv;
16560 }
16561
16562 void  __attribute__((export_name("TS_CResult_NoneNoneZ_free"))) TS_CResult_NoneNoneZ_free(uint64_t _res) {
16563         if (!ptr_is_owned(_res)) return;
16564         void* _res_ptr = untag_ptr(_res);
16565         CHECK_ACCESS(_res_ptr);
16566         LDKCResult_NoneNoneZ _res_conv = *(LDKCResult_NoneNoneZ*)(_res_ptr);
16567         FREE(untag_ptr(_res));
16568         CResult_NoneNoneZ_free(_res_conv);
16569 }
16570
16571 static inline uint64_t CResult_NoneNoneZ_clone_ptr(LDKCResult_NoneNoneZ *NONNULL_PTR arg) {
16572         LDKCResult_NoneNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneNoneZ), "LDKCResult_NoneNoneZ");
16573         *ret_conv = CResult_NoneNoneZ_clone(arg);
16574         return tag_ptr(ret_conv, true);
16575 }
16576 int64_t  __attribute__((export_name("TS_CResult_NoneNoneZ_clone_ptr"))) TS_CResult_NoneNoneZ_clone_ptr(uint64_t arg) {
16577         LDKCResult_NoneNoneZ* arg_conv = (LDKCResult_NoneNoneZ*)untag_ptr(arg);
16578         int64_t ret_conv = CResult_NoneNoneZ_clone_ptr(arg_conv);
16579         return ret_conv;
16580 }
16581
16582 uint64_t  __attribute__((export_name("TS_CResult_NoneNoneZ_clone"))) TS_CResult_NoneNoneZ_clone(uint64_t orig) {
16583         LDKCResult_NoneNoneZ* orig_conv = (LDKCResult_NoneNoneZ*)untag_ptr(orig);
16584         LDKCResult_NoneNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneNoneZ), "LDKCResult_NoneNoneZ");
16585         *ret_conv = CResult_NoneNoneZ_clone(orig_conv);
16586         return tag_ptr(ret_conv, true);
16587 }
16588
16589 void  __attribute__((export_name("TS_CVec_ECDSASignatureZ_free"))) TS_CVec_ECDSASignatureZ_free(ptrArray _res) {
16590         LDKCVec_ECDSASignatureZ _res_constr;
16591         _res_constr.datalen = _res->arr_len;
16592         if (_res_constr.datalen > 0)
16593                 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKECDSASignature), "LDKCVec_ECDSASignatureZ Elements");
16594         else
16595                 _res_constr.data = NULL;
16596         int8_tArray* _res_vals = (void*) _res->elems;
16597         for (size_t m = 0; m < _res_constr.datalen; m++) {
16598                 int8_tArray _res_conv_12 = _res_vals[m];
16599                 LDKECDSASignature _res_conv_12_ref;
16600                 CHECK(_res_conv_12->arr_len == 64);
16601                 memcpy(_res_conv_12_ref.compact_form, _res_conv_12->elems, 64); FREE(_res_conv_12);
16602                 _res_constr.data[m] = _res_conv_12_ref;
16603         }
16604         FREE(_res);
16605         CVec_ECDSASignatureZ_free(_res_constr);
16606 }
16607
16608 static inline uint64_t C2Tuple_ECDSASignatureCVec_ECDSASignatureZZ_clone_ptr(LDKC2Tuple_ECDSASignatureCVec_ECDSASignatureZZ *NONNULL_PTR arg) {
16609         LDKC2Tuple_ECDSASignatureCVec_ECDSASignatureZZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_ECDSASignatureCVec_ECDSASignatureZZ), "LDKC2Tuple_ECDSASignatureCVec_ECDSASignatureZZ");
16610         *ret_conv = C2Tuple_ECDSASignatureCVec_ECDSASignatureZZ_clone(arg);
16611         return tag_ptr(ret_conv, true);
16612 }
16613 int64_t  __attribute__((export_name("TS_C2Tuple_ECDSASignatureCVec_ECDSASignatureZZ_clone_ptr"))) TS_C2Tuple_ECDSASignatureCVec_ECDSASignatureZZ_clone_ptr(uint64_t arg) {
16614         LDKC2Tuple_ECDSASignatureCVec_ECDSASignatureZZ* arg_conv = (LDKC2Tuple_ECDSASignatureCVec_ECDSASignatureZZ*)untag_ptr(arg);
16615         int64_t ret_conv = C2Tuple_ECDSASignatureCVec_ECDSASignatureZZ_clone_ptr(arg_conv);
16616         return ret_conv;
16617 }
16618
16619 uint64_t  __attribute__((export_name("TS_C2Tuple_ECDSASignatureCVec_ECDSASignatureZZ_clone"))) TS_C2Tuple_ECDSASignatureCVec_ECDSASignatureZZ_clone(uint64_t orig) {
16620         LDKC2Tuple_ECDSASignatureCVec_ECDSASignatureZZ* orig_conv = (LDKC2Tuple_ECDSASignatureCVec_ECDSASignatureZZ*)untag_ptr(orig);
16621         LDKC2Tuple_ECDSASignatureCVec_ECDSASignatureZZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_ECDSASignatureCVec_ECDSASignatureZZ), "LDKC2Tuple_ECDSASignatureCVec_ECDSASignatureZZ");
16622         *ret_conv = C2Tuple_ECDSASignatureCVec_ECDSASignatureZZ_clone(orig_conv);
16623         return tag_ptr(ret_conv, true);
16624 }
16625
16626 uint64_t  __attribute__((export_name("TS_C2Tuple_ECDSASignatureCVec_ECDSASignatureZZ_new"))) TS_C2Tuple_ECDSASignatureCVec_ECDSASignatureZZ_new(int8_tArray a, ptrArray b) {
16627         LDKECDSASignature a_ref;
16628         CHECK(a->arr_len == 64);
16629         memcpy(a_ref.compact_form, a->elems, 64); FREE(a);
16630         LDKCVec_ECDSASignatureZ b_constr;
16631         b_constr.datalen = b->arr_len;
16632         if (b_constr.datalen > 0)
16633                 b_constr.data = MALLOC(b_constr.datalen * sizeof(LDKECDSASignature), "LDKCVec_ECDSASignatureZ Elements");
16634         else
16635                 b_constr.data = NULL;
16636         int8_tArray* b_vals = (void*) b->elems;
16637         for (size_t m = 0; m < b_constr.datalen; m++) {
16638                 int8_tArray b_conv_12 = b_vals[m];
16639                 LDKECDSASignature b_conv_12_ref;
16640                 CHECK(b_conv_12->arr_len == 64);
16641                 memcpy(b_conv_12_ref.compact_form, b_conv_12->elems, 64); FREE(b_conv_12);
16642                 b_constr.data[m] = b_conv_12_ref;
16643         }
16644         FREE(b);
16645         LDKC2Tuple_ECDSASignatureCVec_ECDSASignatureZZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_ECDSASignatureCVec_ECDSASignatureZZ), "LDKC2Tuple_ECDSASignatureCVec_ECDSASignatureZZ");
16646         *ret_conv = C2Tuple_ECDSASignatureCVec_ECDSASignatureZZ_new(a_ref, b_constr);
16647         return tag_ptr(ret_conv, true);
16648 }
16649
16650 void  __attribute__((export_name("TS_C2Tuple_ECDSASignatureCVec_ECDSASignatureZZ_free"))) TS_C2Tuple_ECDSASignatureCVec_ECDSASignatureZZ_free(uint64_t _res) {
16651         if (!ptr_is_owned(_res)) return;
16652         void* _res_ptr = untag_ptr(_res);
16653         CHECK_ACCESS(_res_ptr);
16654         LDKC2Tuple_ECDSASignatureCVec_ECDSASignatureZZ _res_conv = *(LDKC2Tuple_ECDSASignatureCVec_ECDSASignatureZZ*)(_res_ptr);
16655         FREE(untag_ptr(_res));
16656         C2Tuple_ECDSASignatureCVec_ECDSASignatureZZ_free(_res_conv);
16657 }
16658
16659 uint64_t  __attribute__((export_name("TS_CResult_C2Tuple_ECDSASignatureCVec_ECDSASignatureZZNoneZ_ok"))) TS_CResult_C2Tuple_ECDSASignatureCVec_ECDSASignatureZZNoneZ_ok(uint64_t o) {
16660         void* o_ptr = untag_ptr(o);
16661         CHECK_ACCESS(o_ptr);
16662         LDKC2Tuple_ECDSASignatureCVec_ECDSASignatureZZ o_conv = *(LDKC2Tuple_ECDSASignatureCVec_ECDSASignatureZZ*)(o_ptr);
16663         o_conv = C2Tuple_ECDSASignatureCVec_ECDSASignatureZZ_clone((LDKC2Tuple_ECDSASignatureCVec_ECDSASignatureZZ*)untag_ptr(o));
16664         LDKCResult_C2Tuple_ECDSASignatureCVec_ECDSASignatureZZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_ECDSASignatureCVec_ECDSASignatureZZNoneZ), "LDKCResult_C2Tuple_ECDSASignatureCVec_ECDSASignatureZZNoneZ");
16665         *ret_conv = CResult_C2Tuple_ECDSASignatureCVec_ECDSASignatureZZNoneZ_ok(o_conv);
16666         return tag_ptr(ret_conv, true);
16667 }
16668
16669 uint64_t  __attribute__((export_name("TS_CResult_C2Tuple_ECDSASignatureCVec_ECDSASignatureZZNoneZ_err"))) TS_CResult_C2Tuple_ECDSASignatureCVec_ECDSASignatureZZNoneZ_err() {
16670         LDKCResult_C2Tuple_ECDSASignatureCVec_ECDSASignatureZZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_ECDSASignatureCVec_ECDSASignatureZZNoneZ), "LDKCResult_C2Tuple_ECDSASignatureCVec_ECDSASignatureZZNoneZ");
16671         *ret_conv = CResult_C2Tuple_ECDSASignatureCVec_ECDSASignatureZZNoneZ_err();
16672         return tag_ptr(ret_conv, true);
16673 }
16674
16675 jboolean  __attribute__((export_name("TS_CResult_C2Tuple_ECDSASignatureCVec_ECDSASignatureZZNoneZ_is_ok"))) TS_CResult_C2Tuple_ECDSASignatureCVec_ECDSASignatureZZNoneZ_is_ok(uint64_t o) {
16676         LDKCResult_C2Tuple_ECDSASignatureCVec_ECDSASignatureZZNoneZ* o_conv = (LDKCResult_C2Tuple_ECDSASignatureCVec_ECDSASignatureZZNoneZ*)untag_ptr(o);
16677         jboolean ret_conv = CResult_C2Tuple_ECDSASignatureCVec_ECDSASignatureZZNoneZ_is_ok(o_conv);
16678         return ret_conv;
16679 }
16680
16681 void  __attribute__((export_name("TS_CResult_C2Tuple_ECDSASignatureCVec_ECDSASignatureZZNoneZ_free"))) TS_CResult_C2Tuple_ECDSASignatureCVec_ECDSASignatureZZNoneZ_free(uint64_t _res) {
16682         if (!ptr_is_owned(_res)) return;
16683         void* _res_ptr = untag_ptr(_res);
16684         CHECK_ACCESS(_res_ptr);
16685         LDKCResult_C2Tuple_ECDSASignatureCVec_ECDSASignatureZZNoneZ _res_conv = *(LDKCResult_C2Tuple_ECDSASignatureCVec_ECDSASignatureZZNoneZ*)(_res_ptr);
16686         FREE(untag_ptr(_res));
16687         CResult_C2Tuple_ECDSASignatureCVec_ECDSASignatureZZNoneZ_free(_res_conv);
16688 }
16689
16690 static inline uint64_t CResult_C2Tuple_ECDSASignatureCVec_ECDSASignatureZZNoneZ_clone_ptr(LDKCResult_C2Tuple_ECDSASignatureCVec_ECDSASignatureZZNoneZ *NONNULL_PTR arg) {
16691         LDKCResult_C2Tuple_ECDSASignatureCVec_ECDSASignatureZZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_ECDSASignatureCVec_ECDSASignatureZZNoneZ), "LDKCResult_C2Tuple_ECDSASignatureCVec_ECDSASignatureZZNoneZ");
16692         *ret_conv = CResult_C2Tuple_ECDSASignatureCVec_ECDSASignatureZZNoneZ_clone(arg);
16693         return tag_ptr(ret_conv, true);
16694 }
16695 int64_t  __attribute__((export_name("TS_CResult_C2Tuple_ECDSASignatureCVec_ECDSASignatureZZNoneZ_clone_ptr"))) TS_CResult_C2Tuple_ECDSASignatureCVec_ECDSASignatureZZNoneZ_clone_ptr(uint64_t arg) {
16696         LDKCResult_C2Tuple_ECDSASignatureCVec_ECDSASignatureZZNoneZ* arg_conv = (LDKCResult_C2Tuple_ECDSASignatureCVec_ECDSASignatureZZNoneZ*)untag_ptr(arg);
16697         int64_t ret_conv = CResult_C2Tuple_ECDSASignatureCVec_ECDSASignatureZZNoneZ_clone_ptr(arg_conv);
16698         return ret_conv;
16699 }
16700
16701 uint64_t  __attribute__((export_name("TS_CResult_C2Tuple_ECDSASignatureCVec_ECDSASignatureZZNoneZ_clone"))) TS_CResult_C2Tuple_ECDSASignatureCVec_ECDSASignatureZZNoneZ_clone(uint64_t orig) {
16702         LDKCResult_C2Tuple_ECDSASignatureCVec_ECDSASignatureZZNoneZ* orig_conv = (LDKCResult_C2Tuple_ECDSASignatureCVec_ECDSASignatureZZNoneZ*)untag_ptr(orig);
16703         LDKCResult_C2Tuple_ECDSASignatureCVec_ECDSASignatureZZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_ECDSASignatureCVec_ECDSASignatureZZNoneZ), "LDKCResult_C2Tuple_ECDSASignatureCVec_ECDSASignatureZZNoneZ");
16704         *ret_conv = CResult_C2Tuple_ECDSASignatureCVec_ECDSASignatureZZNoneZ_clone(orig_conv);
16705         return tag_ptr(ret_conv, true);
16706 }
16707
16708 uint64_t  __attribute__((export_name("TS_CResult_ECDSASignatureNoneZ_ok"))) TS_CResult_ECDSASignatureNoneZ_ok(int8_tArray o) {
16709         LDKECDSASignature o_ref;
16710         CHECK(o->arr_len == 64);
16711         memcpy(o_ref.compact_form, o->elems, 64); FREE(o);
16712         LDKCResult_ECDSASignatureNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_ECDSASignatureNoneZ), "LDKCResult_ECDSASignatureNoneZ");
16713         *ret_conv = CResult_ECDSASignatureNoneZ_ok(o_ref);
16714         return tag_ptr(ret_conv, true);
16715 }
16716
16717 uint64_t  __attribute__((export_name("TS_CResult_ECDSASignatureNoneZ_err"))) TS_CResult_ECDSASignatureNoneZ_err() {
16718         LDKCResult_ECDSASignatureNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_ECDSASignatureNoneZ), "LDKCResult_ECDSASignatureNoneZ");
16719         *ret_conv = CResult_ECDSASignatureNoneZ_err();
16720         return tag_ptr(ret_conv, true);
16721 }
16722
16723 jboolean  __attribute__((export_name("TS_CResult_ECDSASignatureNoneZ_is_ok"))) TS_CResult_ECDSASignatureNoneZ_is_ok(uint64_t o) {
16724         LDKCResult_ECDSASignatureNoneZ* o_conv = (LDKCResult_ECDSASignatureNoneZ*)untag_ptr(o);
16725         jboolean ret_conv = CResult_ECDSASignatureNoneZ_is_ok(o_conv);
16726         return ret_conv;
16727 }
16728
16729 void  __attribute__((export_name("TS_CResult_ECDSASignatureNoneZ_free"))) TS_CResult_ECDSASignatureNoneZ_free(uint64_t _res) {
16730         if (!ptr_is_owned(_res)) return;
16731         void* _res_ptr = untag_ptr(_res);
16732         CHECK_ACCESS(_res_ptr);
16733         LDKCResult_ECDSASignatureNoneZ _res_conv = *(LDKCResult_ECDSASignatureNoneZ*)(_res_ptr);
16734         FREE(untag_ptr(_res));
16735         CResult_ECDSASignatureNoneZ_free(_res_conv);
16736 }
16737
16738 static inline uint64_t CResult_ECDSASignatureNoneZ_clone_ptr(LDKCResult_ECDSASignatureNoneZ *NONNULL_PTR arg) {
16739         LDKCResult_ECDSASignatureNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_ECDSASignatureNoneZ), "LDKCResult_ECDSASignatureNoneZ");
16740         *ret_conv = CResult_ECDSASignatureNoneZ_clone(arg);
16741         return tag_ptr(ret_conv, true);
16742 }
16743 int64_t  __attribute__((export_name("TS_CResult_ECDSASignatureNoneZ_clone_ptr"))) TS_CResult_ECDSASignatureNoneZ_clone_ptr(uint64_t arg) {
16744         LDKCResult_ECDSASignatureNoneZ* arg_conv = (LDKCResult_ECDSASignatureNoneZ*)untag_ptr(arg);
16745         int64_t ret_conv = CResult_ECDSASignatureNoneZ_clone_ptr(arg_conv);
16746         return ret_conv;
16747 }
16748
16749 uint64_t  __attribute__((export_name("TS_CResult_ECDSASignatureNoneZ_clone"))) TS_CResult_ECDSASignatureNoneZ_clone(uint64_t orig) {
16750         LDKCResult_ECDSASignatureNoneZ* orig_conv = (LDKCResult_ECDSASignatureNoneZ*)untag_ptr(orig);
16751         LDKCResult_ECDSASignatureNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_ECDSASignatureNoneZ), "LDKCResult_ECDSASignatureNoneZ");
16752         *ret_conv = CResult_ECDSASignatureNoneZ_clone(orig_conv);
16753         return tag_ptr(ret_conv, true);
16754 }
16755
16756 uint64_t  __attribute__((export_name("TS_CResult_PublicKeyNoneZ_ok"))) TS_CResult_PublicKeyNoneZ_ok(int8_tArray o) {
16757         LDKPublicKey o_ref;
16758         CHECK(o->arr_len == 33);
16759         memcpy(o_ref.compressed_form, o->elems, 33); FREE(o);
16760         LDKCResult_PublicKeyNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_PublicKeyNoneZ), "LDKCResult_PublicKeyNoneZ");
16761         *ret_conv = CResult_PublicKeyNoneZ_ok(o_ref);
16762         return tag_ptr(ret_conv, true);
16763 }
16764
16765 uint64_t  __attribute__((export_name("TS_CResult_PublicKeyNoneZ_err"))) TS_CResult_PublicKeyNoneZ_err() {
16766         LDKCResult_PublicKeyNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_PublicKeyNoneZ), "LDKCResult_PublicKeyNoneZ");
16767         *ret_conv = CResult_PublicKeyNoneZ_err();
16768         return tag_ptr(ret_conv, true);
16769 }
16770
16771 jboolean  __attribute__((export_name("TS_CResult_PublicKeyNoneZ_is_ok"))) TS_CResult_PublicKeyNoneZ_is_ok(uint64_t o) {
16772         LDKCResult_PublicKeyNoneZ* o_conv = (LDKCResult_PublicKeyNoneZ*)untag_ptr(o);
16773         jboolean ret_conv = CResult_PublicKeyNoneZ_is_ok(o_conv);
16774         return ret_conv;
16775 }
16776
16777 void  __attribute__((export_name("TS_CResult_PublicKeyNoneZ_free"))) TS_CResult_PublicKeyNoneZ_free(uint64_t _res) {
16778         if (!ptr_is_owned(_res)) return;
16779         void* _res_ptr = untag_ptr(_res);
16780         CHECK_ACCESS(_res_ptr);
16781         LDKCResult_PublicKeyNoneZ _res_conv = *(LDKCResult_PublicKeyNoneZ*)(_res_ptr);
16782         FREE(untag_ptr(_res));
16783         CResult_PublicKeyNoneZ_free(_res_conv);
16784 }
16785
16786 static inline uint64_t CResult_PublicKeyNoneZ_clone_ptr(LDKCResult_PublicKeyNoneZ *NONNULL_PTR arg) {
16787         LDKCResult_PublicKeyNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_PublicKeyNoneZ), "LDKCResult_PublicKeyNoneZ");
16788         *ret_conv = CResult_PublicKeyNoneZ_clone(arg);
16789         return tag_ptr(ret_conv, true);
16790 }
16791 int64_t  __attribute__((export_name("TS_CResult_PublicKeyNoneZ_clone_ptr"))) TS_CResult_PublicKeyNoneZ_clone_ptr(uint64_t arg) {
16792         LDKCResult_PublicKeyNoneZ* arg_conv = (LDKCResult_PublicKeyNoneZ*)untag_ptr(arg);
16793         int64_t ret_conv = CResult_PublicKeyNoneZ_clone_ptr(arg_conv);
16794         return ret_conv;
16795 }
16796
16797 uint64_t  __attribute__((export_name("TS_CResult_PublicKeyNoneZ_clone"))) TS_CResult_PublicKeyNoneZ_clone(uint64_t orig) {
16798         LDKCResult_PublicKeyNoneZ* orig_conv = (LDKCResult_PublicKeyNoneZ*)untag_ptr(orig);
16799         LDKCResult_PublicKeyNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_PublicKeyNoneZ), "LDKCResult_PublicKeyNoneZ");
16800         *ret_conv = CResult_PublicKeyNoneZ_clone(orig_conv);
16801         return tag_ptr(ret_conv, true);
16802 }
16803
16804 uint64_t  __attribute__((export_name("TS_COption_BigEndianScalarZ_some"))) TS_COption_BigEndianScalarZ_some(uint64_t o) {
16805         void* o_ptr = untag_ptr(o);
16806         CHECK_ACCESS(o_ptr);
16807         LDKBigEndianScalar o_conv = *(LDKBigEndianScalar*)(o_ptr);
16808         // WARNING: we may need a move here but no clone is available for LDKBigEndianScalar
16809         LDKCOption_BigEndianScalarZ *ret_copy = MALLOC(sizeof(LDKCOption_BigEndianScalarZ), "LDKCOption_BigEndianScalarZ");
16810         *ret_copy = COption_BigEndianScalarZ_some(o_conv);
16811         uint64_t ret_ref = tag_ptr(ret_copy, true);
16812         return ret_ref;
16813 }
16814
16815 uint64_t  __attribute__((export_name("TS_COption_BigEndianScalarZ_none"))) TS_COption_BigEndianScalarZ_none() {
16816         LDKCOption_BigEndianScalarZ *ret_copy = MALLOC(sizeof(LDKCOption_BigEndianScalarZ), "LDKCOption_BigEndianScalarZ");
16817         *ret_copy = COption_BigEndianScalarZ_none();
16818         uint64_t ret_ref = tag_ptr(ret_copy, true);
16819         return ret_ref;
16820 }
16821
16822 void  __attribute__((export_name("TS_COption_BigEndianScalarZ_free"))) TS_COption_BigEndianScalarZ_free(uint64_t _res) {
16823         if (!ptr_is_owned(_res)) return;
16824         void* _res_ptr = untag_ptr(_res);
16825         CHECK_ACCESS(_res_ptr);
16826         LDKCOption_BigEndianScalarZ _res_conv = *(LDKCOption_BigEndianScalarZ*)(_res_ptr);
16827         FREE(untag_ptr(_res));
16828         COption_BigEndianScalarZ_free(_res_conv);
16829 }
16830
16831 static inline uint64_t COption_BigEndianScalarZ_clone_ptr(LDKCOption_BigEndianScalarZ *NONNULL_PTR arg) {
16832         LDKCOption_BigEndianScalarZ *ret_copy = MALLOC(sizeof(LDKCOption_BigEndianScalarZ), "LDKCOption_BigEndianScalarZ");
16833         *ret_copy = COption_BigEndianScalarZ_clone(arg);
16834         uint64_t ret_ref = tag_ptr(ret_copy, true);
16835         return ret_ref;
16836 }
16837 int64_t  __attribute__((export_name("TS_COption_BigEndianScalarZ_clone_ptr"))) TS_COption_BigEndianScalarZ_clone_ptr(uint64_t arg) {
16838         LDKCOption_BigEndianScalarZ* arg_conv = (LDKCOption_BigEndianScalarZ*)untag_ptr(arg);
16839         int64_t ret_conv = COption_BigEndianScalarZ_clone_ptr(arg_conv);
16840         return ret_conv;
16841 }
16842
16843 uint64_t  __attribute__((export_name("TS_COption_BigEndianScalarZ_clone"))) TS_COption_BigEndianScalarZ_clone(uint64_t orig) {
16844         LDKCOption_BigEndianScalarZ* orig_conv = (LDKCOption_BigEndianScalarZ*)untag_ptr(orig);
16845         LDKCOption_BigEndianScalarZ *ret_copy = MALLOC(sizeof(LDKCOption_BigEndianScalarZ), "LDKCOption_BigEndianScalarZ");
16846         *ret_copy = COption_BigEndianScalarZ_clone(orig_conv);
16847         uint64_t ret_ref = tag_ptr(ret_copy, true);
16848         return ret_ref;
16849 }
16850
16851 void  __attribute__((export_name("TS_CVec_U5Z_free"))) TS_CVec_U5Z_free(ptrArray _res) {
16852         LDKCVec_U5Z _res_constr;
16853         _res_constr.datalen = _res->arr_len;
16854         if (_res_constr.datalen > 0)
16855                 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKU5), "LDKCVec_U5Z Elements");
16856         else
16857                 _res_constr.data = NULL;
16858         int8_t* _res_vals = (void*) _res->elems;
16859         for (size_t h = 0; h < _res_constr.datalen; h++) {
16860                 int8_t _res_conv_7 = _res_vals[h];
16861                 
16862                 _res_constr.data[h] = (LDKU5){ ._0 = _res_conv_7 };
16863         }
16864         FREE(_res);
16865         CVec_U5Z_free(_res_constr);
16866 }
16867
16868 uint64_t  __attribute__((export_name("TS_CResult_RecoverableSignatureNoneZ_ok"))) TS_CResult_RecoverableSignatureNoneZ_ok(int8_tArray o) {
16869         LDKRecoverableSignature o_ref;
16870         CHECK(o->arr_len == 68);
16871         memcpy(o_ref.serialized_form, o->elems, 68); FREE(o);
16872         LDKCResult_RecoverableSignatureNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_RecoverableSignatureNoneZ), "LDKCResult_RecoverableSignatureNoneZ");
16873         *ret_conv = CResult_RecoverableSignatureNoneZ_ok(o_ref);
16874         return tag_ptr(ret_conv, true);
16875 }
16876
16877 uint64_t  __attribute__((export_name("TS_CResult_RecoverableSignatureNoneZ_err"))) TS_CResult_RecoverableSignatureNoneZ_err() {
16878         LDKCResult_RecoverableSignatureNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_RecoverableSignatureNoneZ), "LDKCResult_RecoverableSignatureNoneZ");
16879         *ret_conv = CResult_RecoverableSignatureNoneZ_err();
16880         return tag_ptr(ret_conv, true);
16881 }
16882
16883 jboolean  __attribute__((export_name("TS_CResult_RecoverableSignatureNoneZ_is_ok"))) TS_CResult_RecoverableSignatureNoneZ_is_ok(uint64_t o) {
16884         LDKCResult_RecoverableSignatureNoneZ* o_conv = (LDKCResult_RecoverableSignatureNoneZ*)untag_ptr(o);
16885         jboolean ret_conv = CResult_RecoverableSignatureNoneZ_is_ok(o_conv);
16886         return ret_conv;
16887 }
16888
16889 void  __attribute__((export_name("TS_CResult_RecoverableSignatureNoneZ_free"))) TS_CResult_RecoverableSignatureNoneZ_free(uint64_t _res) {
16890         if (!ptr_is_owned(_res)) return;
16891         void* _res_ptr = untag_ptr(_res);
16892         CHECK_ACCESS(_res_ptr);
16893         LDKCResult_RecoverableSignatureNoneZ _res_conv = *(LDKCResult_RecoverableSignatureNoneZ*)(_res_ptr);
16894         FREE(untag_ptr(_res));
16895         CResult_RecoverableSignatureNoneZ_free(_res_conv);
16896 }
16897
16898 static inline uint64_t CResult_RecoverableSignatureNoneZ_clone_ptr(LDKCResult_RecoverableSignatureNoneZ *NONNULL_PTR arg) {
16899         LDKCResult_RecoverableSignatureNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_RecoverableSignatureNoneZ), "LDKCResult_RecoverableSignatureNoneZ");
16900         *ret_conv = CResult_RecoverableSignatureNoneZ_clone(arg);
16901         return tag_ptr(ret_conv, true);
16902 }
16903 int64_t  __attribute__((export_name("TS_CResult_RecoverableSignatureNoneZ_clone_ptr"))) TS_CResult_RecoverableSignatureNoneZ_clone_ptr(uint64_t arg) {
16904         LDKCResult_RecoverableSignatureNoneZ* arg_conv = (LDKCResult_RecoverableSignatureNoneZ*)untag_ptr(arg);
16905         int64_t ret_conv = CResult_RecoverableSignatureNoneZ_clone_ptr(arg_conv);
16906         return ret_conv;
16907 }
16908
16909 uint64_t  __attribute__((export_name("TS_CResult_RecoverableSignatureNoneZ_clone"))) TS_CResult_RecoverableSignatureNoneZ_clone(uint64_t orig) {
16910         LDKCResult_RecoverableSignatureNoneZ* orig_conv = (LDKCResult_RecoverableSignatureNoneZ*)untag_ptr(orig);
16911         LDKCResult_RecoverableSignatureNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_RecoverableSignatureNoneZ), "LDKCResult_RecoverableSignatureNoneZ");
16912         *ret_conv = CResult_RecoverableSignatureNoneZ_clone(orig_conv);
16913         return tag_ptr(ret_conv, true);
16914 }
16915
16916 uint64_t  __attribute__((export_name("TS_CResult_SchnorrSignatureNoneZ_ok"))) TS_CResult_SchnorrSignatureNoneZ_ok(int8_tArray o) {
16917         LDKSchnorrSignature o_ref;
16918         CHECK(o->arr_len == 64);
16919         memcpy(o_ref.compact_form, o->elems, 64); FREE(o);
16920         LDKCResult_SchnorrSignatureNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_SchnorrSignatureNoneZ), "LDKCResult_SchnorrSignatureNoneZ");
16921         *ret_conv = CResult_SchnorrSignatureNoneZ_ok(o_ref);
16922         return tag_ptr(ret_conv, true);
16923 }
16924
16925 uint64_t  __attribute__((export_name("TS_CResult_SchnorrSignatureNoneZ_err"))) TS_CResult_SchnorrSignatureNoneZ_err() {
16926         LDKCResult_SchnorrSignatureNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_SchnorrSignatureNoneZ), "LDKCResult_SchnorrSignatureNoneZ");
16927         *ret_conv = CResult_SchnorrSignatureNoneZ_err();
16928         return tag_ptr(ret_conv, true);
16929 }
16930
16931 jboolean  __attribute__((export_name("TS_CResult_SchnorrSignatureNoneZ_is_ok"))) TS_CResult_SchnorrSignatureNoneZ_is_ok(uint64_t o) {
16932         LDKCResult_SchnorrSignatureNoneZ* o_conv = (LDKCResult_SchnorrSignatureNoneZ*)untag_ptr(o);
16933         jboolean ret_conv = CResult_SchnorrSignatureNoneZ_is_ok(o_conv);
16934         return ret_conv;
16935 }
16936
16937 void  __attribute__((export_name("TS_CResult_SchnorrSignatureNoneZ_free"))) TS_CResult_SchnorrSignatureNoneZ_free(uint64_t _res) {
16938         if (!ptr_is_owned(_res)) return;
16939         void* _res_ptr = untag_ptr(_res);
16940         CHECK_ACCESS(_res_ptr);
16941         LDKCResult_SchnorrSignatureNoneZ _res_conv = *(LDKCResult_SchnorrSignatureNoneZ*)(_res_ptr);
16942         FREE(untag_ptr(_res));
16943         CResult_SchnorrSignatureNoneZ_free(_res_conv);
16944 }
16945
16946 static inline uint64_t CResult_SchnorrSignatureNoneZ_clone_ptr(LDKCResult_SchnorrSignatureNoneZ *NONNULL_PTR arg) {
16947         LDKCResult_SchnorrSignatureNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_SchnorrSignatureNoneZ), "LDKCResult_SchnorrSignatureNoneZ");
16948         *ret_conv = CResult_SchnorrSignatureNoneZ_clone(arg);
16949         return tag_ptr(ret_conv, true);
16950 }
16951 int64_t  __attribute__((export_name("TS_CResult_SchnorrSignatureNoneZ_clone_ptr"))) TS_CResult_SchnorrSignatureNoneZ_clone_ptr(uint64_t arg) {
16952         LDKCResult_SchnorrSignatureNoneZ* arg_conv = (LDKCResult_SchnorrSignatureNoneZ*)untag_ptr(arg);
16953         int64_t ret_conv = CResult_SchnorrSignatureNoneZ_clone_ptr(arg_conv);
16954         return ret_conv;
16955 }
16956
16957 uint64_t  __attribute__((export_name("TS_CResult_SchnorrSignatureNoneZ_clone"))) TS_CResult_SchnorrSignatureNoneZ_clone(uint64_t orig) {
16958         LDKCResult_SchnorrSignatureNoneZ* orig_conv = (LDKCResult_SchnorrSignatureNoneZ*)untag_ptr(orig);
16959         LDKCResult_SchnorrSignatureNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_SchnorrSignatureNoneZ), "LDKCResult_SchnorrSignatureNoneZ");
16960         *ret_conv = CResult_SchnorrSignatureNoneZ_clone(orig_conv);
16961         return tag_ptr(ret_conv, true);
16962 }
16963
16964 uint64_t  __attribute__((export_name("TS_CResult_WriteableEcdsaChannelSignerDecodeErrorZ_ok"))) TS_CResult_WriteableEcdsaChannelSignerDecodeErrorZ_ok(uint64_t o) {
16965         void* o_ptr = untag_ptr(o);
16966         CHECK_ACCESS(o_ptr);
16967         LDKWriteableEcdsaChannelSigner o_conv = *(LDKWriteableEcdsaChannelSigner*)(o_ptr);
16968         if (o_conv.free == LDKWriteableEcdsaChannelSigner_JCalls_free) {
16969                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
16970                 LDKWriteableEcdsaChannelSigner_JCalls_cloned(&o_conv);
16971         }
16972         LDKCResult_WriteableEcdsaChannelSignerDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_WriteableEcdsaChannelSignerDecodeErrorZ), "LDKCResult_WriteableEcdsaChannelSignerDecodeErrorZ");
16973         *ret_conv = CResult_WriteableEcdsaChannelSignerDecodeErrorZ_ok(o_conv);
16974         return tag_ptr(ret_conv, true);
16975 }
16976
16977 uint64_t  __attribute__((export_name("TS_CResult_WriteableEcdsaChannelSignerDecodeErrorZ_err"))) TS_CResult_WriteableEcdsaChannelSignerDecodeErrorZ_err(uint64_t e) {
16978         void* e_ptr = untag_ptr(e);
16979         CHECK_ACCESS(e_ptr);
16980         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
16981         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
16982         LDKCResult_WriteableEcdsaChannelSignerDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_WriteableEcdsaChannelSignerDecodeErrorZ), "LDKCResult_WriteableEcdsaChannelSignerDecodeErrorZ");
16983         *ret_conv = CResult_WriteableEcdsaChannelSignerDecodeErrorZ_err(e_conv);
16984         return tag_ptr(ret_conv, true);
16985 }
16986
16987 jboolean  __attribute__((export_name("TS_CResult_WriteableEcdsaChannelSignerDecodeErrorZ_is_ok"))) TS_CResult_WriteableEcdsaChannelSignerDecodeErrorZ_is_ok(uint64_t o) {
16988         LDKCResult_WriteableEcdsaChannelSignerDecodeErrorZ* o_conv = (LDKCResult_WriteableEcdsaChannelSignerDecodeErrorZ*)untag_ptr(o);
16989         jboolean ret_conv = CResult_WriteableEcdsaChannelSignerDecodeErrorZ_is_ok(o_conv);
16990         return ret_conv;
16991 }
16992
16993 void  __attribute__((export_name("TS_CResult_WriteableEcdsaChannelSignerDecodeErrorZ_free"))) TS_CResult_WriteableEcdsaChannelSignerDecodeErrorZ_free(uint64_t _res) {
16994         if (!ptr_is_owned(_res)) return;
16995         void* _res_ptr = untag_ptr(_res);
16996         CHECK_ACCESS(_res_ptr);
16997         LDKCResult_WriteableEcdsaChannelSignerDecodeErrorZ _res_conv = *(LDKCResult_WriteableEcdsaChannelSignerDecodeErrorZ*)(_res_ptr);
16998         FREE(untag_ptr(_res));
16999         CResult_WriteableEcdsaChannelSignerDecodeErrorZ_free(_res_conv);
17000 }
17001
17002 static inline uint64_t CResult_WriteableEcdsaChannelSignerDecodeErrorZ_clone_ptr(LDKCResult_WriteableEcdsaChannelSignerDecodeErrorZ *NONNULL_PTR arg) {
17003         LDKCResult_WriteableEcdsaChannelSignerDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_WriteableEcdsaChannelSignerDecodeErrorZ), "LDKCResult_WriteableEcdsaChannelSignerDecodeErrorZ");
17004         *ret_conv = CResult_WriteableEcdsaChannelSignerDecodeErrorZ_clone(arg);
17005         return tag_ptr(ret_conv, true);
17006 }
17007 int64_t  __attribute__((export_name("TS_CResult_WriteableEcdsaChannelSignerDecodeErrorZ_clone_ptr"))) TS_CResult_WriteableEcdsaChannelSignerDecodeErrorZ_clone_ptr(uint64_t arg) {
17008         LDKCResult_WriteableEcdsaChannelSignerDecodeErrorZ* arg_conv = (LDKCResult_WriteableEcdsaChannelSignerDecodeErrorZ*)untag_ptr(arg);
17009         int64_t ret_conv = CResult_WriteableEcdsaChannelSignerDecodeErrorZ_clone_ptr(arg_conv);
17010         return ret_conv;
17011 }
17012
17013 uint64_t  __attribute__((export_name("TS_CResult_WriteableEcdsaChannelSignerDecodeErrorZ_clone"))) TS_CResult_WriteableEcdsaChannelSignerDecodeErrorZ_clone(uint64_t orig) {
17014         LDKCResult_WriteableEcdsaChannelSignerDecodeErrorZ* orig_conv = (LDKCResult_WriteableEcdsaChannelSignerDecodeErrorZ*)untag_ptr(orig);
17015         LDKCResult_WriteableEcdsaChannelSignerDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_WriteableEcdsaChannelSignerDecodeErrorZ), "LDKCResult_WriteableEcdsaChannelSignerDecodeErrorZ");
17016         *ret_conv = CResult_WriteableEcdsaChannelSignerDecodeErrorZ_clone(orig_conv);
17017         return tag_ptr(ret_conv, true);
17018 }
17019
17020 uint64_t  __attribute__((export_name("TS_CResult_CVec_u8ZNoneZ_ok"))) TS_CResult_CVec_u8ZNoneZ_ok(int8_tArray o) {
17021         LDKCVec_u8Z o_ref;
17022         o_ref.datalen = o->arr_len;
17023         o_ref.data = MALLOC(o_ref.datalen, "LDKCVec_u8Z Bytes");
17024         memcpy(o_ref.data, o->elems, o_ref.datalen); FREE(o);
17025         LDKCResult_CVec_u8ZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_u8ZNoneZ), "LDKCResult_CVec_u8ZNoneZ");
17026         *ret_conv = CResult_CVec_u8ZNoneZ_ok(o_ref);
17027         return tag_ptr(ret_conv, true);
17028 }
17029
17030 uint64_t  __attribute__((export_name("TS_CResult_CVec_u8ZNoneZ_err"))) TS_CResult_CVec_u8ZNoneZ_err() {
17031         LDKCResult_CVec_u8ZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_u8ZNoneZ), "LDKCResult_CVec_u8ZNoneZ");
17032         *ret_conv = CResult_CVec_u8ZNoneZ_err();
17033         return tag_ptr(ret_conv, true);
17034 }
17035
17036 jboolean  __attribute__((export_name("TS_CResult_CVec_u8ZNoneZ_is_ok"))) TS_CResult_CVec_u8ZNoneZ_is_ok(uint64_t o) {
17037         LDKCResult_CVec_u8ZNoneZ* o_conv = (LDKCResult_CVec_u8ZNoneZ*)untag_ptr(o);
17038         jboolean ret_conv = CResult_CVec_u8ZNoneZ_is_ok(o_conv);
17039         return ret_conv;
17040 }
17041
17042 void  __attribute__((export_name("TS_CResult_CVec_u8ZNoneZ_free"))) TS_CResult_CVec_u8ZNoneZ_free(uint64_t _res) {
17043         if (!ptr_is_owned(_res)) return;
17044         void* _res_ptr = untag_ptr(_res);
17045         CHECK_ACCESS(_res_ptr);
17046         LDKCResult_CVec_u8ZNoneZ _res_conv = *(LDKCResult_CVec_u8ZNoneZ*)(_res_ptr);
17047         FREE(untag_ptr(_res));
17048         CResult_CVec_u8ZNoneZ_free(_res_conv);
17049 }
17050
17051 static inline uint64_t CResult_CVec_u8ZNoneZ_clone_ptr(LDKCResult_CVec_u8ZNoneZ *NONNULL_PTR arg) {
17052         LDKCResult_CVec_u8ZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_u8ZNoneZ), "LDKCResult_CVec_u8ZNoneZ");
17053         *ret_conv = CResult_CVec_u8ZNoneZ_clone(arg);
17054         return tag_ptr(ret_conv, true);
17055 }
17056 int64_t  __attribute__((export_name("TS_CResult_CVec_u8ZNoneZ_clone_ptr"))) TS_CResult_CVec_u8ZNoneZ_clone_ptr(uint64_t arg) {
17057         LDKCResult_CVec_u8ZNoneZ* arg_conv = (LDKCResult_CVec_u8ZNoneZ*)untag_ptr(arg);
17058         int64_t ret_conv = CResult_CVec_u8ZNoneZ_clone_ptr(arg_conv);
17059         return ret_conv;
17060 }
17061
17062 uint64_t  __attribute__((export_name("TS_CResult_CVec_u8ZNoneZ_clone"))) TS_CResult_CVec_u8ZNoneZ_clone(uint64_t orig) {
17063         LDKCResult_CVec_u8ZNoneZ* orig_conv = (LDKCResult_CVec_u8ZNoneZ*)untag_ptr(orig);
17064         LDKCResult_CVec_u8ZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_u8ZNoneZ), "LDKCResult_CVec_u8ZNoneZ");
17065         *ret_conv = CResult_CVec_u8ZNoneZ_clone(orig_conv);
17066         return tag_ptr(ret_conv, true);
17067 }
17068
17069 uint64_t  __attribute__((export_name("TS_CResult_ShutdownScriptNoneZ_ok"))) TS_CResult_ShutdownScriptNoneZ_ok(uint64_t o) {
17070         LDKShutdownScript o_conv;
17071         o_conv.inner = untag_ptr(o);
17072         o_conv.is_owned = ptr_is_owned(o);
17073         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
17074         o_conv = ShutdownScript_clone(&o_conv);
17075         LDKCResult_ShutdownScriptNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_ShutdownScriptNoneZ), "LDKCResult_ShutdownScriptNoneZ");
17076         *ret_conv = CResult_ShutdownScriptNoneZ_ok(o_conv);
17077         return tag_ptr(ret_conv, true);
17078 }
17079
17080 uint64_t  __attribute__((export_name("TS_CResult_ShutdownScriptNoneZ_err"))) TS_CResult_ShutdownScriptNoneZ_err() {
17081         LDKCResult_ShutdownScriptNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_ShutdownScriptNoneZ), "LDKCResult_ShutdownScriptNoneZ");
17082         *ret_conv = CResult_ShutdownScriptNoneZ_err();
17083         return tag_ptr(ret_conv, true);
17084 }
17085
17086 jboolean  __attribute__((export_name("TS_CResult_ShutdownScriptNoneZ_is_ok"))) TS_CResult_ShutdownScriptNoneZ_is_ok(uint64_t o) {
17087         LDKCResult_ShutdownScriptNoneZ* o_conv = (LDKCResult_ShutdownScriptNoneZ*)untag_ptr(o);
17088         jboolean ret_conv = CResult_ShutdownScriptNoneZ_is_ok(o_conv);
17089         return ret_conv;
17090 }
17091
17092 void  __attribute__((export_name("TS_CResult_ShutdownScriptNoneZ_free"))) TS_CResult_ShutdownScriptNoneZ_free(uint64_t _res) {
17093         if (!ptr_is_owned(_res)) return;
17094         void* _res_ptr = untag_ptr(_res);
17095         CHECK_ACCESS(_res_ptr);
17096         LDKCResult_ShutdownScriptNoneZ _res_conv = *(LDKCResult_ShutdownScriptNoneZ*)(_res_ptr);
17097         FREE(untag_ptr(_res));
17098         CResult_ShutdownScriptNoneZ_free(_res_conv);
17099 }
17100
17101 static inline uint64_t CResult_ShutdownScriptNoneZ_clone_ptr(LDKCResult_ShutdownScriptNoneZ *NONNULL_PTR arg) {
17102         LDKCResult_ShutdownScriptNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_ShutdownScriptNoneZ), "LDKCResult_ShutdownScriptNoneZ");
17103         *ret_conv = CResult_ShutdownScriptNoneZ_clone(arg);
17104         return tag_ptr(ret_conv, true);
17105 }
17106 int64_t  __attribute__((export_name("TS_CResult_ShutdownScriptNoneZ_clone_ptr"))) TS_CResult_ShutdownScriptNoneZ_clone_ptr(uint64_t arg) {
17107         LDKCResult_ShutdownScriptNoneZ* arg_conv = (LDKCResult_ShutdownScriptNoneZ*)untag_ptr(arg);
17108         int64_t ret_conv = CResult_ShutdownScriptNoneZ_clone_ptr(arg_conv);
17109         return ret_conv;
17110 }
17111
17112 uint64_t  __attribute__((export_name("TS_CResult_ShutdownScriptNoneZ_clone"))) TS_CResult_ShutdownScriptNoneZ_clone(uint64_t orig) {
17113         LDKCResult_ShutdownScriptNoneZ* orig_conv = (LDKCResult_ShutdownScriptNoneZ*)untag_ptr(orig);
17114         LDKCResult_ShutdownScriptNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_ShutdownScriptNoneZ), "LDKCResult_ShutdownScriptNoneZ");
17115         *ret_conv = CResult_ShutdownScriptNoneZ_clone(orig_conv);
17116         return tag_ptr(ret_conv, true);
17117 }
17118
17119 uint64_t  __attribute__((export_name("TS_COption_u16Z_some"))) TS_COption_u16Z_some(int16_t o) {
17120         LDKCOption_u16Z *ret_copy = MALLOC(sizeof(LDKCOption_u16Z), "LDKCOption_u16Z");
17121         *ret_copy = COption_u16Z_some(o);
17122         uint64_t ret_ref = tag_ptr(ret_copy, true);
17123         return ret_ref;
17124 }
17125
17126 uint64_t  __attribute__((export_name("TS_COption_u16Z_none"))) TS_COption_u16Z_none() {
17127         LDKCOption_u16Z *ret_copy = MALLOC(sizeof(LDKCOption_u16Z), "LDKCOption_u16Z");
17128         *ret_copy = COption_u16Z_none();
17129         uint64_t ret_ref = tag_ptr(ret_copy, true);
17130         return ret_ref;
17131 }
17132
17133 void  __attribute__((export_name("TS_COption_u16Z_free"))) TS_COption_u16Z_free(uint64_t _res) {
17134         if (!ptr_is_owned(_res)) return;
17135         void* _res_ptr = untag_ptr(_res);
17136         CHECK_ACCESS(_res_ptr);
17137         LDKCOption_u16Z _res_conv = *(LDKCOption_u16Z*)(_res_ptr);
17138         FREE(untag_ptr(_res));
17139         COption_u16Z_free(_res_conv);
17140 }
17141
17142 static inline uint64_t COption_u16Z_clone_ptr(LDKCOption_u16Z *NONNULL_PTR arg) {
17143         LDKCOption_u16Z *ret_copy = MALLOC(sizeof(LDKCOption_u16Z), "LDKCOption_u16Z");
17144         *ret_copy = COption_u16Z_clone(arg);
17145         uint64_t ret_ref = tag_ptr(ret_copy, true);
17146         return ret_ref;
17147 }
17148 int64_t  __attribute__((export_name("TS_COption_u16Z_clone_ptr"))) TS_COption_u16Z_clone_ptr(uint64_t arg) {
17149         LDKCOption_u16Z* arg_conv = (LDKCOption_u16Z*)untag_ptr(arg);
17150         int64_t ret_conv = COption_u16Z_clone_ptr(arg_conv);
17151         return ret_conv;
17152 }
17153
17154 uint64_t  __attribute__((export_name("TS_COption_u16Z_clone"))) TS_COption_u16Z_clone(uint64_t orig) {
17155         LDKCOption_u16Z* orig_conv = (LDKCOption_u16Z*)untag_ptr(orig);
17156         LDKCOption_u16Z *ret_copy = MALLOC(sizeof(LDKCOption_u16Z), "LDKCOption_u16Z");
17157         *ret_copy = COption_u16Z_clone(orig_conv);
17158         uint64_t ret_ref = tag_ptr(ret_copy, true);
17159         return ret_ref;
17160 }
17161
17162 uint64_t  __attribute__((export_name("TS_COption_boolZ_some"))) TS_COption_boolZ_some(jboolean o) {
17163         LDKCOption_boolZ *ret_copy = MALLOC(sizeof(LDKCOption_boolZ), "LDKCOption_boolZ");
17164         *ret_copy = COption_boolZ_some(o);
17165         uint64_t ret_ref = tag_ptr(ret_copy, true);
17166         return ret_ref;
17167 }
17168
17169 uint64_t  __attribute__((export_name("TS_COption_boolZ_none"))) TS_COption_boolZ_none() {
17170         LDKCOption_boolZ *ret_copy = MALLOC(sizeof(LDKCOption_boolZ), "LDKCOption_boolZ");
17171         *ret_copy = COption_boolZ_none();
17172         uint64_t ret_ref = tag_ptr(ret_copy, true);
17173         return ret_ref;
17174 }
17175
17176 void  __attribute__((export_name("TS_COption_boolZ_free"))) TS_COption_boolZ_free(uint64_t _res) {
17177         if (!ptr_is_owned(_res)) return;
17178         void* _res_ptr = untag_ptr(_res);
17179         CHECK_ACCESS(_res_ptr);
17180         LDKCOption_boolZ _res_conv = *(LDKCOption_boolZ*)(_res_ptr);
17181         FREE(untag_ptr(_res));
17182         COption_boolZ_free(_res_conv);
17183 }
17184
17185 static inline uint64_t COption_boolZ_clone_ptr(LDKCOption_boolZ *NONNULL_PTR arg) {
17186         LDKCOption_boolZ *ret_copy = MALLOC(sizeof(LDKCOption_boolZ), "LDKCOption_boolZ");
17187         *ret_copy = COption_boolZ_clone(arg);
17188         uint64_t ret_ref = tag_ptr(ret_copy, true);
17189         return ret_ref;
17190 }
17191 int64_t  __attribute__((export_name("TS_COption_boolZ_clone_ptr"))) TS_COption_boolZ_clone_ptr(uint64_t arg) {
17192         LDKCOption_boolZ* arg_conv = (LDKCOption_boolZ*)untag_ptr(arg);
17193         int64_t ret_conv = COption_boolZ_clone_ptr(arg_conv);
17194         return ret_conv;
17195 }
17196
17197 uint64_t  __attribute__((export_name("TS_COption_boolZ_clone"))) TS_COption_boolZ_clone(uint64_t orig) {
17198         LDKCOption_boolZ* orig_conv = (LDKCOption_boolZ*)untag_ptr(orig);
17199         LDKCOption_boolZ *ret_copy = MALLOC(sizeof(LDKCOption_boolZ), "LDKCOption_boolZ");
17200         *ret_copy = COption_boolZ_clone(orig_conv);
17201         uint64_t ret_ref = tag_ptr(ret_copy, true);
17202         return ret_ref;
17203 }
17204
17205 void  __attribute__((export_name("TS_CVec_CVec_u8ZZ_free"))) TS_CVec_CVec_u8ZZ_free(ptrArray _res) {
17206         LDKCVec_CVec_u8ZZ _res_constr;
17207         _res_constr.datalen = _res->arr_len;
17208         if (_res_constr.datalen > 0)
17209                 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKCVec_u8Z), "LDKCVec_CVec_u8ZZ Elements");
17210         else
17211                 _res_constr.data = NULL;
17212         int8_tArray* _res_vals = (void*) _res->elems;
17213         for (size_t m = 0; m < _res_constr.datalen; m++) {
17214                 int8_tArray _res_conv_12 = _res_vals[m];
17215                 LDKCVec_u8Z _res_conv_12_ref;
17216                 _res_conv_12_ref.datalen = _res_conv_12->arr_len;
17217                 _res_conv_12_ref.data = MALLOC(_res_conv_12_ref.datalen, "LDKCVec_u8Z Bytes");
17218                 memcpy(_res_conv_12_ref.data, _res_conv_12->elems, _res_conv_12_ref.datalen); FREE(_res_conv_12);
17219                 _res_constr.data[m] = _res_conv_12_ref;
17220         }
17221         FREE(_res);
17222         CVec_CVec_u8ZZ_free(_res_constr);
17223 }
17224
17225 uint64_t  __attribute__((export_name("TS_CResult_CVec_CVec_u8ZZNoneZ_ok"))) TS_CResult_CVec_CVec_u8ZZNoneZ_ok(ptrArray o) {
17226         LDKCVec_CVec_u8ZZ o_constr;
17227         o_constr.datalen = o->arr_len;
17228         if (o_constr.datalen > 0)
17229                 o_constr.data = MALLOC(o_constr.datalen * sizeof(LDKCVec_u8Z), "LDKCVec_CVec_u8ZZ Elements");
17230         else
17231                 o_constr.data = NULL;
17232         int8_tArray* o_vals = (void*) o->elems;
17233         for (size_t m = 0; m < o_constr.datalen; m++) {
17234                 int8_tArray o_conv_12 = o_vals[m];
17235                 LDKCVec_u8Z o_conv_12_ref;
17236                 o_conv_12_ref.datalen = o_conv_12->arr_len;
17237                 o_conv_12_ref.data = MALLOC(o_conv_12_ref.datalen, "LDKCVec_u8Z Bytes");
17238                 memcpy(o_conv_12_ref.data, o_conv_12->elems, o_conv_12_ref.datalen); FREE(o_conv_12);
17239                 o_constr.data[m] = o_conv_12_ref;
17240         }
17241         FREE(o);
17242         LDKCResult_CVec_CVec_u8ZZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_CVec_u8ZZNoneZ), "LDKCResult_CVec_CVec_u8ZZNoneZ");
17243         *ret_conv = CResult_CVec_CVec_u8ZZNoneZ_ok(o_constr);
17244         return tag_ptr(ret_conv, true);
17245 }
17246
17247 uint64_t  __attribute__((export_name("TS_CResult_CVec_CVec_u8ZZNoneZ_err"))) TS_CResult_CVec_CVec_u8ZZNoneZ_err() {
17248         LDKCResult_CVec_CVec_u8ZZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_CVec_u8ZZNoneZ), "LDKCResult_CVec_CVec_u8ZZNoneZ");
17249         *ret_conv = CResult_CVec_CVec_u8ZZNoneZ_err();
17250         return tag_ptr(ret_conv, true);
17251 }
17252
17253 jboolean  __attribute__((export_name("TS_CResult_CVec_CVec_u8ZZNoneZ_is_ok"))) TS_CResult_CVec_CVec_u8ZZNoneZ_is_ok(uint64_t o) {
17254         LDKCResult_CVec_CVec_u8ZZNoneZ* o_conv = (LDKCResult_CVec_CVec_u8ZZNoneZ*)untag_ptr(o);
17255         jboolean ret_conv = CResult_CVec_CVec_u8ZZNoneZ_is_ok(o_conv);
17256         return ret_conv;
17257 }
17258
17259 void  __attribute__((export_name("TS_CResult_CVec_CVec_u8ZZNoneZ_free"))) TS_CResult_CVec_CVec_u8ZZNoneZ_free(uint64_t _res) {
17260         if (!ptr_is_owned(_res)) return;
17261         void* _res_ptr = untag_ptr(_res);
17262         CHECK_ACCESS(_res_ptr);
17263         LDKCResult_CVec_CVec_u8ZZNoneZ _res_conv = *(LDKCResult_CVec_CVec_u8ZZNoneZ*)(_res_ptr);
17264         FREE(untag_ptr(_res));
17265         CResult_CVec_CVec_u8ZZNoneZ_free(_res_conv);
17266 }
17267
17268 static inline uint64_t CResult_CVec_CVec_u8ZZNoneZ_clone_ptr(LDKCResult_CVec_CVec_u8ZZNoneZ *NONNULL_PTR arg) {
17269         LDKCResult_CVec_CVec_u8ZZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_CVec_u8ZZNoneZ), "LDKCResult_CVec_CVec_u8ZZNoneZ");
17270         *ret_conv = CResult_CVec_CVec_u8ZZNoneZ_clone(arg);
17271         return tag_ptr(ret_conv, true);
17272 }
17273 int64_t  __attribute__((export_name("TS_CResult_CVec_CVec_u8ZZNoneZ_clone_ptr"))) TS_CResult_CVec_CVec_u8ZZNoneZ_clone_ptr(uint64_t arg) {
17274         LDKCResult_CVec_CVec_u8ZZNoneZ* arg_conv = (LDKCResult_CVec_CVec_u8ZZNoneZ*)untag_ptr(arg);
17275         int64_t ret_conv = CResult_CVec_CVec_u8ZZNoneZ_clone_ptr(arg_conv);
17276         return ret_conv;
17277 }
17278
17279 uint64_t  __attribute__((export_name("TS_CResult_CVec_CVec_u8ZZNoneZ_clone"))) TS_CResult_CVec_CVec_u8ZZNoneZ_clone(uint64_t orig) {
17280         LDKCResult_CVec_CVec_u8ZZNoneZ* orig_conv = (LDKCResult_CVec_CVec_u8ZZNoneZ*)untag_ptr(orig);
17281         LDKCResult_CVec_CVec_u8ZZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_CVec_u8ZZNoneZ), "LDKCResult_CVec_CVec_u8ZZNoneZ");
17282         *ret_conv = CResult_CVec_CVec_u8ZZNoneZ_clone(orig_conv);
17283         return tag_ptr(ret_conv, true);
17284 }
17285
17286 uint64_t  __attribute__((export_name("TS_CResult_InMemorySignerDecodeErrorZ_ok"))) TS_CResult_InMemorySignerDecodeErrorZ_ok(uint64_t o) {
17287         LDKInMemorySigner o_conv;
17288         o_conv.inner = untag_ptr(o);
17289         o_conv.is_owned = ptr_is_owned(o);
17290         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
17291         o_conv = InMemorySigner_clone(&o_conv);
17292         LDKCResult_InMemorySignerDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InMemorySignerDecodeErrorZ), "LDKCResult_InMemorySignerDecodeErrorZ");
17293         *ret_conv = CResult_InMemorySignerDecodeErrorZ_ok(o_conv);
17294         return tag_ptr(ret_conv, true);
17295 }
17296
17297 uint64_t  __attribute__((export_name("TS_CResult_InMemorySignerDecodeErrorZ_err"))) TS_CResult_InMemorySignerDecodeErrorZ_err(uint64_t e) {
17298         void* e_ptr = untag_ptr(e);
17299         CHECK_ACCESS(e_ptr);
17300         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
17301         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
17302         LDKCResult_InMemorySignerDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InMemorySignerDecodeErrorZ), "LDKCResult_InMemorySignerDecodeErrorZ");
17303         *ret_conv = CResult_InMemorySignerDecodeErrorZ_err(e_conv);
17304         return tag_ptr(ret_conv, true);
17305 }
17306
17307 jboolean  __attribute__((export_name("TS_CResult_InMemorySignerDecodeErrorZ_is_ok"))) TS_CResult_InMemorySignerDecodeErrorZ_is_ok(uint64_t o) {
17308         LDKCResult_InMemorySignerDecodeErrorZ* o_conv = (LDKCResult_InMemorySignerDecodeErrorZ*)untag_ptr(o);
17309         jboolean ret_conv = CResult_InMemorySignerDecodeErrorZ_is_ok(o_conv);
17310         return ret_conv;
17311 }
17312
17313 void  __attribute__((export_name("TS_CResult_InMemorySignerDecodeErrorZ_free"))) TS_CResult_InMemorySignerDecodeErrorZ_free(uint64_t _res) {
17314         if (!ptr_is_owned(_res)) return;
17315         void* _res_ptr = untag_ptr(_res);
17316         CHECK_ACCESS(_res_ptr);
17317         LDKCResult_InMemorySignerDecodeErrorZ _res_conv = *(LDKCResult_InMemorySignerDecodeErrorZ*)(_res_ptr);
17318         FREE(untag_ptr(_res));
17319         CResult_InMemorySignerDecodeErrorZ_free(_res_conv);
17320 }
17321
17322 static inline uint64_t CResult_InMemorySignerDecodeErrorZ_clone_ptr(LDKCResult_InMemorySignerDecodeErrorZ *NONNULL_PTR arg) {
17323         LDKCResult_InMemorySignerDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InMemorySignerDecodeErrorZ), "LDKCResult_InMemorySignerDecodeErrorZ");
17324         *ret_conv = CResult_InMemorySignerDecodeErrorZ_clone(arg);
17325         return tag_ptr(ret_conv, true);
17326 }
17327 int64_t  __attribute__((export_name("TS_CResult_InMemorySignerDecodeErrorZ_clone_ptr"))) TS_CResult_InMemorySignerDecodeErrorZ_clone_ptr(uint64_t arg) {
17328         LDKCResult_InMemorySignerDecodeErrorZ* arg_conv = (LDKCResult_InMemorySignerDecodeErrorZ*)untag_ptr(arg);
17329         int64_t ret_conv = CResult_InMemorySignerDecodeErrorZ_clone_ptr(arg_conv);
17330         return ret_conv;
17331 }
17332
17333 uint64_t  __attribute__((export_name("TS_CResult_InMemorySignerDecodeErrorZ_clone"))) TS_CResult_InMemorySignerDecodeErrorZ_clone(uint64_t orig) {
17334         LDKCResult_InMemorySignerDecodeErrorZ* orig_conv = (LDKCResult_InMemorySignerDecodeErrorZ*)untag_ptr(orig);
17335         LDKCResult_InMemorySignerDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InMemorySignerDecodeErrorZ), "LDKCResult_InMemorySignerDecodeErrorZ");
17336         *ret_conv = CResult_InMemorySignerDecodeErrorZ_clone(orig_conv);
17337         return tag_ptr(ret_conv, true);
17338 }
17339
17340 uint64_t  __attribute__((export_name("TS_CResult_TransactionNoneZ_ok"))) TS_CResult_TransactionNoneZ_ok(int8_tArray o) {
17341         LDKTransaction o_ref;
17342         o_ref.datalen = o->arr_len;
17343         o_ref.data = MALLOC(o_ref.datalen, "LDKTransaction Bytes");
17344         memcpy(o_ref.data, o->elems, o_ref.datalen); FREE(o);
17345         o_ref.data_is_owned = true;
17346         LDKCResult_TransactionNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_TransactionNoneZ), "LDKCResult_TransactionNoneZ");
17347         *ret_conv = CResult_TransactionNoneZ_ok(o_ref);
17348         return tag_ptr(ret_conv, true);
17349 }
17350
17351 uint64_t  __attribute__((export_name("TS_CResult_TransactionNoneZ_err"))) TS_CResult_TransactionNoneZ_err() {
17352         LDKCResult_TransactionNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_TransactionNoneZ), "LDKCResult_TransactionNoneZ");
17353         *ret_conv = CResult_TransactionNoneZ_err();
17354         return tag_ptr(ret_conv, true);
17355 }
17356
17357 jboolean  __attribute__((export_name("TS_CResult_TransactionNoneZ_is_ok"))) TS_CResult_TransactionNoneZ_is_ok(uint64_t o) {
17358         LDKCResult_TransactionNoneZ* o_conv = (LDKCResult_TransactionNoneZ*)untag_ptr(o);
17359         jboolean ret_conv = CResult_TransactionNoneZ_is_ok(o_conv);
17360         return ret_conv;
17361 }
17362
17363 void  __attribute__((export_name("TS_CResult_TransactionNoneZ_free"))) TS_CResult_TransactionNoneZ_free(uint64_t _res) {
17364         if (!ptr_is_owned(_res)) return;
17365         void* _res_ptr = untag_ptr(_res);
17366         CHECK_ACCESS(_res_ptr);
17367         LDKCResult_TransactionNoneZ _res_conv = *(LDKCResult_TransactionNoneZ*)(_res_ptr);
17368         FREE(untag_ptr(_res));
17369         CResult_TransactionNoneZ_free(_res_conv);
17370 }
17371
17372 static inline uint64_t CResult_TransactionNoneZ_clone_ptr(LDKCResult_TransactionNoneZ *NONNULL_PTR arg) {
17373         LDKCResult_TransactionNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_TransactionNoneZ), "LDKCResult_TransactionNoneZ");
17374         *ret_conv = CResult_TransactionNoneZ_clone(arg);
17375         return tag_ptr(ret_conv, true);
17376 }
17377 int64_t  __attribute__((export_name("TS_CResult_TransactionNoneZ_clone_ptr"))) TS_CResult_TransactionNoneZ_clone_ptr(uint64_t arg) {
17378         LDKCResult_TransactionNoneZ* arg_conv = (LDKCResult_TransactionNoneZ*)untag_ptr(arg);
17379         int64_t ret_conv = CResult_TransactionNoneZ_clone_ptr(arg_conv);
17380         return ret_conv;
17381 }
17382
17383 uint64_t  __attribute__((export_name("TS_CResult_TransactionNoneZ_clone"))) TS_CResult_TransactionNoneZ_clone(uint64_t orig) {
17384         LDKCResult_TransactionNoneZ* orig_conv = (LDKCResult_TransactionNoneZ*)untag_ptr(orig);
17385         LDKCResult_TransactionNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_TransactionNoneZ), "LDKCResult_TransactionNoneZ");
17386         *ret_conv = CResult_TransactionNoneZ_clone(orig_conv);
17387         return tag_ptr(ret_conv, true);
17388 }
17389
17390 void  __attribute__((export_name("TS_CVec_ChannelDetailsZ_free"))) TS_CVec_ChannelDetailsZ_free(uint64_tArray _res) {
17391         LDKCVec_ChannelDetailsZ _res_constr;
17392         _res_constr.datalen = _res->arr_len;
17393         if (_res_constr.datalen > 0)
17394                 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKChannelDetails), "LDKCVec_ChannelDetailsZ Elements");
17395         else
17396                 _res_constr.data = NULL;
17397         uint64_t* _res_vals = _res->elems;
17398         for (size_t q = 0; q < _res_constr.datalen; q++) {
17399                 uint64_t _res_conv_16 = _res_vals[q];
17400                 LDKChannelDetails _res_conv_16_conv;
17401                 _res_conv_16_conv.inner = untag_ptr(_res_conv_16);
17402                 _res_conv_16_conv.is_owned = ptr_is_owned(_res_conv_16);
17403                 CHECK_INNER_FIELD_ACCESS_OR_NULL(_res_conv_16_conv);
17404                 _res_constr.data[q] = _res_conv_16_conv;
17405         }
17406         FREE(_res);
17407         CVec_ChannelDetailsZ_free(_res_constr);
17408 }
17409
17410 uint64_t  __attribute__((export_name("TS_CResult_RouteLightningErrorZ_ok"))) TS_CResult_RouteLightningErrorZ_ok(uint64_t o) {
17411         LDKRoute o_conv;
17412         o_conv.inner = untag_ptr(o);
17413         o_conv.is_owned = ptr_is_owned(o);
17414         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
17415         o_conv = Route_clone(&o_conv);
17416         LDKCResult_RouteLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteLightningErrorZ), "LDKCResult_RouteLightningErrorZ");
17417         *ret_conv = CResult_RouteLightningErrorZ_ok(o_conv);
17418         return tag_ptr(ret_conv, true);
17419 }
17420
17421 uint64_t  __attribute__((export_name("TS_CResult_RouteLightningErrorZ_err"))) TS_CResult_RouteLightningErrorZ_err(uint64_t e) {
17422         LDKLightningError e_conv;
17423         e_conv.inner = untag_ptr(e);
17424         e_conv.is_owned = ptr_is_owned(e);
17425         CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
17426         e_conv = LightningError_clone(&e_conv);
17427         LDKCResult_RouteLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteLightningErrorZ), "LDKCResult_RouteLightningErrorZ");
17428         *ret_conv = CResult_RouteLightningErrorZ_err(e_conv);
17429         return tag_ptr(ret_conv, true);
17430 }
17431
17432 jboolean  __attribute__((export_name("TS_CResult_RouteLightningErrorZ_is_ok"))) TS_CResult_RouteLightningErrorZ_is_ok(uint64_t o) {
17433         LDKCResult_RouteLightningErrorZ* o_conv = (LDKCResult_RouteLightningErrorZ*)untag_ptr(o);
17434         jboolean ret_conv = CResult_RouteLightningErrorZ_is_ok(o_conv);
17435         return ret_conv;
17436 }
17437
17438 void  __attribute__((export_name("TS_CResult_RouteLightningErrorZ_free"))) TS_CResult_RouteLightningErrorZ_free(uint64_t _res) {
17439         if (!ptr_is_owned(_res)) return;
17440         void* _res_ptr = untag_ptr(_res);
17441         CHECK_ACCESS(_res_ptr);
17442         LDKCResult_RouteLightningErrorZ _res_conv = *(LDKCResult_RouteLightningErrorZ*)(_res_ptr);
17443         FREE(untag_ptr(_res));
17444         CResult_RouteLightningErrorZ_free(_res_conv);
17445 }
17446
17447 static inline uint64_t CResult_RouteLightningErrorZ_clone_ptr(LDKCResult_RouteLightningErrorZ *NONNULL_PTR arg) {
17448         LDKCResult_RouteLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteLightningErrorZ), "LDKCResult_RouteLightningErrorZ");
17449         *ret_conv = CResult_RouteLightningErrorZ_clone(arg);
17450         return tag_ptr(ret_conv, true);
17451 }
17452 int64_t  __attribute__((export_name("TS_CResult_RouteLightningErrorZ_clone_ptr"))) TS_CResult_RouteLightningErrorZ_clone_ptr(uint64_t arg) {
17453         LDKCResult_RouteLightningErrorZ* arg_conv = (LDKCResult_RouteLightningErrorZ*)untag_ptr(arg);
17454         int64_t ret_conv = CResult_RouteLightningErrorZ_clone_ptr(arg_conv);
17455         return ret_conv;
17456 }
17457
17458 uint64_t  __attribute__((export_name("TS_CResult_RouteLightningErrorZ_clone"))) TS_CResult_RouteLightningErrorZ_clone(uint64_t orig) {
17459         LDKCResult_RouteLightningErrorZ* orig_conv = (LDKCResult_RouteLightningErrorZ*)untag_ptr(orig);
17460         LDKCResult_RouteLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteLightningErrorZ), "LDKCResult_RouteLightningErrorZ");
17461         *ret_conv = CResult_RouteLightningErrorZ_clone(orig_conv);
17462         return tag_ptr(ret_conv, true);
17463 }
17464
17465 uint64_t  __attribute__((export_name("TS_CResult_InFlightHtlcsDecodeErrorZ_ok"))) TS_CResult_InFlightHtlcsDecodeErrorZ_ok(uint64_t o) {
17466         LDKInFlightHtlcs o_conv;
17467         o_conv.inner = untag_ptr(o);
17468         o_conv.is_owned = ptr_is_owned(o);
17469         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
17470         o_conv = InFlightHtlcs_clone(&o_conv);
17471         LDKCResult_InFlightHtlcsDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InFlightHtlcsDecodeErrorZ), "LDKCResult_InFlightHtlcsDecodeErrorZ");
17472         *ret_conv = CResult_InFlightHtlcsDecodeErrorZ_ok(o_conv);
17473         return tag_ptr(ret_conv, true);
17474 }
17475
17476 uint64_t  __attribute__((export_name("TS_CResult_InFlightHtlcsDecodeErrorZ_err"))) TS_CResult_InFlightHtlcsDecodeErrorZ_err(uint64_t e) {
17477         void* e_ptr = untag_ptr(e);
17478         CHECK_ACCESS(e_ptr);
17479         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
17480         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
17481         LDKCResult_InFlightHtlcsDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InFlightHtlcsDecodeErrorZ), "LDKCResult_InFlightHtlcsDecodeErrorZ");
17482         *ret_conv = CResult_InFlightHtlcsDecodeErrorZ_err(e_conv);
17483         return tag_ptr(ret_conv, true);
17484 }
17485
17486 jboolean  __attribute__((export_name("TS_CResult_InFlightHtlcsDecodeErrorZ_is_ok"))) TS_CResult_InFlightHtlcsDecodeErrorZ_is_ok(uint64_t o) {
17487         LDKCResult_InFlightHtlcsDecodeErrorZ* o_conv = (LDKCResult_InFlightHtlcsDecodeErrorZ*)untag_ptr(o);
17488         jboolean ret_conv = CResult_InFlightHtlcsDecodeErrorZ_is_ok(o_conv);
17489         return ret_conv;
17490 }
17491
17492 void  __attribute__((export_name("TS_CResult_InFlightHtlcsDecodeErrorZ_free"))) TS_CResult_InFlightHtlcsDecodeErrorZ_free(uint64_t _res) {
17493         if (!ptr_is_owned(_res)) return;
17494         void* _res_ptr = untag_ptr(_res);
17495         CHECK_ACCESS(_res_ptr);
17496         LDKCResult_InFlightHtlcsDecodeErrorZ _res_conv = *(LDKCResult_InFlightHtlcsDecodeErrorZ*)(_res_ptr);
17497         FREE(untag_ptr(_res));
17498         CResult_InFlightHtlcsDecodeErrorZ_free(_res_conv);
17499 }
17500
17501 static inline uint64_t CResult_InFlightHtlcsDecodeErrorZ_clone_ptr(LDKCResult_InFlightHtlcsDecodeErrorZ *NONNULL_PTR arg) {
17502         LDKCResult_InFlightHtlcsDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InFlightHtlcsDecodeErrorZ), "LDKCResult_InFlightHtlcsDecodeErrorZ");
17503         *ret_conv = CResult_InFlightHtlcsDecodeErrorZ_clone(arg);
17504         return tag_ptr(ret_conv, true);
17505 }
17506 int64_t  __attribute__((export_name("TS_CResult_InFlightHtlcsDecodeErrorZ_clone_ptr"))) TS_CResult_InFlightHtlcsDecodeErrorZ_clone_ptr(uint64_t arg) {
17507         LDKCResult_InFlightHtlcsDecodeErrorZ* arg_conv = (LDKCResult_InFlightHtlcsDecodeErrorZ*)untag_ptr(arg);
17508         int64_t ret_conv = CResult_InFlightHtlcsDecodeErrorZ_clone_ptr(arg_conv);
17509         return ret_conv;
17510 }
17511
17512 uint64_t  __attribute__((export_name("TS_CResult_InFlightHtlcsDecodeErrorZ_clone"))) TS_CResult_InFlightHtlcsDecodeErrorZ_clone(uint64_t orig) {
17513         LDKCResult_InFlightHtlcsDecodeErrorZ* orig_conv = (LDKCResult_InFlightHtlcsDecodeErrorZ*)untag_ptr(orig);
17514         LDKCResult_InFlightHtlcsDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InFlightHtlcsDecodeErrorZ), "LDKCResult_InFlightHtlcsDecodeErrorZ");
17515         *ret_conv = CResult_InFlightHtlcsDecodeErrorZ_clone(orig_conv);
17516         return tag_ptr(ret_conv, true);
17517 }
17518
17519 uint64_t  __attribute__((export_name("TS_CResult_RouteHopDecodeErrorZ_ok"))) TS_CResult_RouteHopDecodeErrorZ_ok(uint64_t o) {
17520         LDKRouteHop o_conv;
17521         o_conv.inner = untag_ptr(o);
17522         o_conv.is_owned = ptr_is_owned(o);
17523         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
17524         o_conv = RouteHop_clone(&o_conv);
17525         LDKCResult_RouteHopDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteHopDecodeErrorZ), "LDKCResult_RouteHopDecodeErrorZ");
17526         *ret_conv = CResult_RouteHopDecodeErrorZ_ok(o_conv);
17527         return tag_ptr(ret_conv, true);
17528 }
17529
17530 uint64_t  __attribute__((export_name("TS_CResult_RouteHopDecodeErrorZ_err"))) TS_CResult_RouteHopDecodeErrorZ_err(uint64_t e) {
17531         void* e_ptr = untag_ptr(e);
17532         CHECK_ACCESS(e_ptr);
17533         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
17534         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
17535         LDKCResult_RouteHopDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteHopDecodeErrorZ), "LDKCResult_RouteHopDecodeErrorZ");
17536         *ret_conv = CResult_RouteHopDecodeErrorZ_err(e_conv);
17537         return tag_ptr(ret_conv, true);
17538 }
17539
17540 jboolean  __attribute__((export_name("TS_CResult_RouteHopDecodeErrorZ_is_ok"))) TS_CResult_RouteHopDecodeErrorZ_is_ok(uint64_t o) {
17541         LDKCResult_RouteHopDecodeErrorZ* o_conv = (LDKCResult_RouteHopDecodeErrorZ*)untag_ptr(o);
17542         jboolean ret_conv = CResult_RouteHopDecodeErrorZ_is_ok(o_conv);
17543         return ret_conv;
17544 }
17545
17546 void  __attribute__((export_name("TS_CResult_RouteHopDecodeErrorZ_free"))) TS_CResult_RouteHopDecodeErrorZ_free(uint64_t _res) {
17547         if (!ptr_is_owned(_res)) return;
17548         void* _res_ptr = untag_ptr(_res);
17549         CHECK_ACCESS(_res_ptr);
17550         LDKCResult_RouteHopDecodeErrorZ _res_conv = *(LDKCResult_RouteHopDecodeErrorZ*)(_res_ptr);
17551         FREE(untag_ptr(_res));
17552         CResult_RouteHopDecodeErrorZ_free(_res_conv);
17553 }
17554
17555 static inline uint64_t CResult_RouteHopDecodeErrorZ_clone_ptr(LDKCResult_RouteHopDecodeErrorZ *NONNULL_PTR arg) {
17556         LDKCResult_RouteHopDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteHopDecodeErrorZ), "LDKCResult_RouteHopDecodeErrorZ");
17557         *ret_conv = CResult_RouteHopDecodeErrorZ_clone(arg);
17558         return tag_ptr(ret_conv, true);
17559 }
17560 int64_t  __attribute__((export_name("TS_CResult_RouteHopDecodeErrorZ_clone_ptr"))) TS_CResult_RouteHopDecodeErrorZ_clone_ptr(uint64_t arg) {
17561         LDKCResult_RouteHopDecodeErrorZ* arg_conv = (LDKCResult_RouteHopDecodeErrorZ*)untag_ptr(arg);
17562         int64_t ret_conv = CResult_RouteHopDecodeErrorZ_clone_ptr(arg_conv);
17563         return ret_conv;
17564 }
17565
17566 uint64_t  __attribute__((export_name("TS_CResult_RouteHopDecodeErrorZ_clone"))) TS_CResult_RouteHopDecodeErrorZ_clone(uint64_t orig) {
17567         LDKCResult_RouteHopDecodeErrorZ* orig_conv = (LDKCResult_RouteHopDecodeErrorZ*)untag_ptr(orig);
17568         LDKCResult_RouteHopDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteHopDecodeErrorZ), "LDKCResult_RouteHopDecodeErrorZ");
17569         *ret_conv = CResult_RouteHopDecodeErrorZ_clone(orig_conv);
17570         return tag_ptr(ret_conv, true);
17571 }
17572
17573 void  __attribute__((export_name("TS_CVec_BlindedHopZ_free"))) TS_CVec_BlindedHopZ_free(uint64_tArray _res) {
17574         LDKCVec_BlindedHopZ _res_constr;
17575         _res_constr.datalen = _res->arr_len;
17576         if (_res_constr.datalen > 0)
17577                 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKBlindedHop), "LDKCVec_BlindedHopZ Elements");
17578         else
17579                 _res_constr.data = NULL;
17580         uint64_t* _res_vals = _res->elems;
17581         for (size_t m = 0; m < _res_constr.datalen; m++) {
17582                 uint64_t _res_conv_12 = _res_vals[m];
17583                 LDKBlindedHop _res_conv_12_conv;
17584                 _res_conv_12_conv.inner = untag_ptr(_res_conv_12);
17585                 _res_conv_12_conv.is_owned = ptr_is_owned(_res_conv_12);
17586                 CHECK_INNER_FIELD_ACCESS_OR_NULL(_res_conv_12_conv);
17587                 _res_constr.data[m] = _res_conv_12_conv;
17588         }
17589         FREE(_res);
17590         CVec_BlindedHopZ_free(_res_constr);
17591 }
17592
17593 uint64_t  __attribute__((export_name("TS_CResult_BlindedTailDecodeErrorZ_ok"))) TS_CResult_BlindedTailDecodeErrorZ_ok(uint64_t o) {
17594         LDKBlindedTail o_conv;
17595         o_conv.inner = untag_ptr(o);
17596         o_conv.is_owned = ptr_is_owned(o);
17597         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
17598         o_conv = BlindedTail_clone(&o_conv);
17599         LDKCResult_BlindedTailDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_BlindedTailDecodeErrorZ), "LDKCResult_BlindedTailDecodeErrorZ");
17600         *ret_conv = CResult_BlindedTailDecodeErrorZ_ok(o_conv);
17601         return tag_ptr(ret_conv, true);
17602 }
17603
17604 uint64_t  __attribute__((export_name("TS_CResult_BlindedTailDecodeErrorZ_err"))) TS_CResult_BlindedTailDecodeErrorZ_err(uint64_t e) {
17605         void* e_ptr = untag_ptr(e);
17606         CHECK_ACCESS(e_ptr);
17607         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
17608         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
17609         LDKCResult_BlindedTailDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_BlindedTailDecodeErrorZ), "LDKCResult_BlindedTailDecodeErrorZ");
17610         *ret_conv = CResult_BlindedTailDecodeErrorZ_err(e_conv);
17611         return tag_ptr(ret_conv, true);
17612 }
17613
17614 jboolean  __attribute__((export_name("TS_CResult_BlindedTailDecodeErrorZ_is_ok"))) TS_CResult_BlindedTailDecodeErrorZ_is_ok(uint64_t o) {
17615         LDKCResult_BlindedTailDecodeErrorZ* o_conv = (LDKCResult_BlindedTailDecodeErrorZ*)untag_ptr(o);
17616         jboolean ret_conv = CResult_BlindedTailDecodeErrorZ_is_ok(o_conv);
17617         return ret_conv;
17618 }
17619
17620 void  __attribute__((export_name("TS_CResult_BlindedTailDecodeErrorZ_free"))) TS_CResult_BlindedTailDecodeErrorZ_free(uint64_t _res) {
17621         if (!ptr_is_owned(_res)) return;
17622         void* _res_ptr = untag_ptr(_res);
17623         CHECK_ACCESS(_res_ptr);
17624         LDKCResult_BlindedTailDecodeErrorZ _res_conv = *(LDKCResult_BlindedTailDecodeErrorZ*)(_res_ptr);
17625         FREE(untag_ptr(_res));
17626         CResult_BlindedTailDecodeErrorZ_free(_res_conv);
17627 }
17628
17629 static inline uint64_t CResult_BlindedTailDecodeErrorZ_clone_ptr(LDKCResult_BlindedTailDecodeErrorZ *NONNULL_PTR arg) {
17630         LDKCResult_BlindedTailDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_BlindedTailDecodeErrorZ), "LDKCResult_BlindedTailDecodeErrorZ");
17631         *ret_conv = CResult_BlindedTailDecodeErrorZ_clone(arg);
17632         return tag_ptr(ret_conv, true);
17633 }
17634 int64_t  __attribute__((export_name("TS_CResult_BlindedTailDecodeErrorZ_clone_ptr"))) TS_CResult_BlindedTailDecodeErrorZ_clone_ptr(uint64_t arg) {
17635         LDKCResult_BlindedTailDecodeErrorZ* arg_conv = (LDKCResult_BlindedTailDecodeErrorZ*)untag_ptr(arg);
17636         int64_t ret_conv = CResult_BlindedTailDecodeErrorZ_clone_ptr(arg_conv);
17637         return ret_conv;
17638 }
17639
17640 uint64_t  __attribute__((export_name("TS_CResult_BlindedTailDecodeErrorZ_clone"))) TS_CResult_BlindedTailDecodeErrorZ_clone(uint64_t orig) {
17641         LDKCResult_BlindedTailDecodeErrorZ* orig_conv = (LDKCResult_BlindedTailDecodeErrorZ*)untag_ptr(orig);
17642         LDKCResult_BlindedTailDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_BlindedTailDecodeErrorZ), "LDKCResult_BlindedTailDecodeErrorZ");
17643         *ret_conv = CResult_BlindedTailDecodeErrorZ_clone(orig_conv);
17644         return tag_ptr(ret_conv, true);
17645 }
17646
17647 void  __attribute__((export_name("TS_CVec_RouteHopZ_free"))) TS_CVec_RouteHopZ_free(uint64_tArray _res) {
17648         LDKCVec_RouteHopZ _res_constr;
17649         _res_constr.datalen = _res->arr_len;
17650         if (_res_constr.datalen > 0)
17651                 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKRouteHop), "LDKCVec_RouteHopZ Elements");
17652         else
17653                 _res_constr.data = NULL;
17654         uint64_t* _res_vals = _res->elems;
17655         for (size_t k = 0; k < _res_constr.datalen; k++) {
17656                 uint64_t _res_conv_10 = _res_vals[k];
17657                 LDKRouteHop _res_conv_10_conv;
17658                 _res_conv_10_conv.inner = untag_ptr(_res_conv_10);
17659                 _res_conv_10_conv.is_owned = ptr_is_owned(_res_conv_10);
17660                 CHECK_INNER_FIELD_ACCESS_OR_NULL(_res_conv_10_conv);
17661                 _res_constr.data[k] = _res_conv_10_conv;
17662         }
17663         FREE(_res);
17664         CVec_RouteHopZ_free(_res_constr);
17665 }
17666
17667 void  __attribute__((export_name("TS_CVec_PathZ_free"))) TS_CVec_PathZ_free(uint64_tArray _res) {
17668         LDKCVec_PathZ _res_constr;
17669         _res_constr.datalen = _res->arr_len;
17670         if (_res_constr.datalen > 0)
17671                 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKPath), "LDKCVec_PathZ Elements");
17672         else
17673                 _res_constr.data = NULL;
17674         uint64_t* _res_vals = _res->elems;
17675         for (size_t g = 0; g < _res_constr.datalen; g++) {
17676                 uint64_t _res_conv_6 = _res_vals[g];
17677                 LDKPath _res_conv_6_conv;
17678                 _res_conv_6_conv.inner = untag_ptr(_res_conv_6);
17679                 _res_conv_6_conv.is_owned = ptr_is_owned(_res_conv_6);
17680                 CHECK_INNER_FIELD_ACCESS_OR_NULL(_res_conv_6_conv);
17681                 _res_constr.data[g] = _res_conv_6_conv;
17682         }
17683         FREE(_res);
17684         CVec_PathZ_free(_res_constr);
17685 }
17686
17687 uint64_t  __attribute__((export_name("TS_CResult_RouteDecodeErrorZ_ok"))) TS_CResult_RouteDecodeErrorZ_ok(uint64_t o) {
17688         LDKRoute o_conv;
17689         o_conv.inner = untag_ptr(o);
17690         o_conv.is_owned = ptr_is_owned(o);
17691         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
17692         o_conv = Route_clone(&o_conv);
17693         LDKCResult_RouteDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteDecodeErrorZ), "LDKCResult_RouteDecodeErrorZ");
17694         *ret_conv = CResult_RouteDecodeErrorZ_ok(o_conv);
17695         return tag_ptr(ret_conv, true);
17696 }
17697
17698 uint64_t  __attribute__((export_name("TS_CResult_RouteDecodeErrorZ_err"))) TS_CResult_RouteDecodeErrorZ_err(uint64_t e) {
17699         void* e_ptr = untag_ptr(e);
17700         CHECK_ACCESS(e_ptr);
17701         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
17702         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
17703         LDKCResult_RouteDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteDecodeErrorZ), "LDKCResult_RouteDecodeErrorZ");
17704         *ret_conv = CResult_RouteDecodeErrorZ_err(e_conv);
17705         return tag_ptr(ret_conv, true);
17706 }
17707
17708 jboolean  __attribute__((export_name("TS_CResult_RouteDecodeErrorZ_is_ok"))) TS_CResult_RouteDecodeErrorZ_is_ok(uint64_t o) {
17709         LDKCResult_RouteDecodeErrorZ* o_conv = (LDKCResult_RouteDecodeErrorZ*)untag_ptr(o);
17710         jboolean ret_conv = CResult_RouteDecodeErrorZ_is_ok(o_conv);
17711         return ret_conv;
17712 }
17713
17714 void  __attribute__((export_name("TS_CResult_RouteDecodeErrorZ_free"))) TS_CResult_RouteDecodeErrorZ_free(uint64_t _res) {
17715         if (!ptr_is_owned(_res)) return;
17716         void* _res_ptr = untag_ptr(_res);
17717         CHECK_ACCESS(_res_ptr);
17718         LDKCResult_RouteDecodeErrorZ _res_conv = *(LDKCResult_RouteDecodeErrorZ*)(_res_ptr);
17719         FREE(untag_ptr(_res));
17720         CResult_RouteDecodeErrorZ_free(_res_conv);
17721 }
17722
17723 static inline uint64_t CResult_RouteDecodeErrorZ_clone_ptr(LDKCResult_RouteDecodeErrorZ *NONNULL_PTR arg) {
17724         LDKCResult_RouteDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteDecodeErrorZ), "LDKCResult_RouteDecodeErrorZ");
17725         *ret_conv = CResult_RouteDecodeErrorZ_clone(arg);
17726         return tag_ptr(ret_conv, true);
17727 }
17728 int64_t  __attribute__((export_name("TS_CResult_RouteDecodeErrorZ_clone_ptr"))) TS_CResult_RouteDecodeErrorZ_clone_ptr(uint64_t arg) {
17729         LDKCResult_RouteDecodeErrorZ* arg_conv = (LDKCResult_RouteDecodeErrorZ*)untag_ptr(arg);
17730         int64_t ret_conv = CResult_RouteDecodeErrorZ_clone_ptr(arg_conv);
17731         return ret_conv;
17732 }
17733
17734 uint64_t  __attribute__((export_name("TS_CResult_RouteDecodeErrorZ_clone"))) TS_CResult_RouteDecodeErrorZ_clone(uint64_t orig) {
17735         LDKCResult_RouteDecodeErrorZ* orig_conv = (LDKCResult_RouteDecodeErrorZ*)untag_ptr(orig);
17736         LDKCResult_RouteDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteDecodeErrorZ), "LDKCResult_RouteDecodeErrorZ");
17737         *ret_conv = CResult_RouteDecodeErrorZ_clone(orig_conv);
17738         return tag_ptr(ret_conv, true);
17739 }
17740
17741 uint64_t  __attribute__((export_name("TS_CResult_RouteParametersDecodeErrorZ_ok"))) TS_CResult_RouteParametersDecodeErrorZ_ok(uint64_t o) {
17742         LDKRouteParameters o_conv;
17743         o_conv.inner = untag_ptr(o);
17744         o_conv.is_owned = ptr_is_owned(o);
17745         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
17746         o_conv = RouteParameters_clone(&o_conv);
17747         LDKCResult_RouteParametersDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteParametersDecodeErrorZ), "LDKCResult_RouteParametersDecodeErrorZ");
17748         *ret_conv = CResult_RouteParametersDecodeErrorZ_ok(o_conv);
17749         return tag_ptr(ret_conv, true);
17750 }
17751
17752 uint64_t  __attribute__((export_name("TS_CResult_RouteParametersDecodeErrorZ_err"))) TS_CResult_RouteParametersDecodeErrorZ_err(uint64_t e) {
17753         void* e_ptr = untag_ptr(e);
17754         CHECK_ACCESS(e_ptr);
17755         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
17756         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
17757         LDKCResult_RouteParametersDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteParametersDecodeErrorZ), "LDKCResult_RouteParametersDecodeErrorZ");
17758         *ret_conv = CResult_RouteParametersDecodeErrorZ_err(e_conv);
17759         return tag_ptr(ret_conv, true);
17760 }
17761
17762 jboolean  __attribute__((export_name("TS_CResult_RouteParametersDecodeErrorZ_is_ok"))) TS_CResult_RouteParametersDecodeErrorZ_is_ok(uint64_t o) {
17763         LDKCResult_RouteParametersDecodeErrorZ* o_conv = (LDKCResult_RouteParametersDecodeErrorZ*)untag_ptr(o);
17764         jboolean ret_conv = CResult_RouteParametersDecodeErrorZ_is_ok(o_conv);
17765         return ret_conv;
17766 }
17767
17768 void  __attribute__((export_name("TS_CResult_RouteParametersDecodeErrorZ_free"))) TS_CResult_RouteParametersDecodeErrorZ_free(uint64_t _res) {
17769         if (!ptr_is_owned(_res)) return;
17770         void* _res_ptr = untag_ptr(_res);
17771         CHECK_ACCESS(_res_ptr);
17772         LDKCResult_RouteParametersDecodeErrorZ _res_conv = *(LDKCResult_RouteParametersDecodeErrorZ*)(_res_ptr);
17773         FREE(untag_ptr(_res));
17774         CResult_RouteParametersDecodeErrorZ_free(_res_conv);
17775 }
17776
17777 static inline uint64_t CResult_RouteParametersDecodeErrorZ_clone_ptr(LDKCResult_RouteParametersDecodeErrorZ *NONNULL_PTR arg) {
17778         LDKCResult_RouteParametersDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteParametersDecodeErrorZ), "LDKCResult_RouteParametersDecodeErrorZ");
17779         *ret_conv = CResult_RouteParametersDecodeErrorZ_clone(arg);
17780         return tag_ptr(ret_conv, true);
17781 }
17782 int64_t  __attribute__((export_name("TS_CResult_RouteParametersDecodeErrorZ_clone_ptr"))) TS_CResult_RouteParametersDecodeErrorZ_clone_ptr(uint64_t arg) {
17783         LDKCResult_RouteParametersDecodeErrorZ* arg_conv = (LDKCResult_RouteParametersDecodeErrorZ*)untag_ptr(arg);
17784         int64_t ret_conv = CResult_RouteParametersDecodeErrorZ_clone_ptr(arg_conv);
17785         return ret_conv;
17786 }
17787
17788 uint64_t  __attribute__((export_name("TS_CResult_RouteParametersDecodeErrorZ_clone"))) TS_CResult_RouteParametersDecodeErrorZ_clone(uint64_t orig) {
17789         LDKCResult_RouteParametersDecodeErrorZ* orig_conv = (LDKCResult_RouteParametersDecodeErrorZ*)untag_ptr(orig);
17790         LDKCResult_RouteParametersDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteParametersDecodeErrorZ), "LDKCResult_RouteParametersDecodeErrorZ");
17791         *ret_conv = CResult_RouteParametersDecodeErrorZ_clone(orig_conv);
17792         return tag_ptr(ret_conv, true);
17793 }
17794
17795 void  __attribute__((export_name("TS_CVec_u64Z_free"))) TS_CVec_u64Z_free(int64_tArray _res) {
17796         LDKCVec_u64Z _res_constr;
17797         _res_constr.datalen = _res->arr_len;
17798         if (_res_constr.datalen > 0)
17799                 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(int64_t), "LDKCVec_u64Z Elements");
17800         else
17801                 _res_constr.data = NULL;
17802         int64_t* _res_vals = _res->elems;
17803         for (size_t i = 0; i < _res_constr.datalen; i++) {
17804                 int64_t _res_conv_8 = _res_vals[i];
17805                 _res_constr.data[i] = _res_conv_8;
17806         }
17807         FREE(_res);
17808         CVec_u64Z_free(_res_constr);
17809 }
17810
17811 uint64_t  __attribute__((export_name("TS_CResult_PaymentParametersDecodeErrorZ_ok"))) TS_CResult_PaymentParametersDecodeErrorZ_ok(uint64_t o) {
17812         LDKPaymentParameters o_conv;
17813         o_conv.inner = untag_ptr(o);
17814         o_conv.is_owned = ptr_is_owned(o);
17815         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
17816         o_conv = PaymentParameters_clone(&o_conv);
17817         LDKCResult_PaymentParametersDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PaymentParametersDecodeErrorZ), "LDKCResult_PaymentParametersDecodeErrorZ");
17818         *ret_conv = CResult_PaymentParametersDecodeErrorZ_ok(o_conv);
17819         return tag_ptr(ret_conv, true);
17820 }
17821
17822 uint64_t  __attribute__((export_name("TS_CResult_PaymentParametersDecodeErrorZ_err"))) TS_CResult_PaymentParametersDecodeErrorZ_err(uint64_t e) {
17823         void* e_ptr = untag_ptr(e);
17824         CHECK_ACCESS(e_ptr);
17825         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
17826         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
17827         LDKCResult_PaymentParametersDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PaymentParametersDecodeErrorZ), "LDKCResult_PaymentParametersDecodeErrorZ");
17828         *ret_conv = CResult_PaymentParametersDecodeErrorZ_err(e_conv);
17829         return tag_ptr(ret_conv, true);
17830 }
17831
17832 jboolean  __attribute__((export_name("TS_CResult_PaymentParametersDecodeErrorZ_is_ok"))) TS_CResult_PaymentParametersDecodeErrorZ_is_ok(uint64_t o) {
17833         LDKCResult_PaymentParametersDecodeErrorZ* o_conv = (LDKCResult_PaymentParametersDecodeErrorZ*)untag_ptr(o);
17834         jboolean ret_conv = CResult_PaymentParametersDecodeErrorZ_is_ok(o_conv);
17835         return ret_conv;
17836 }
17837
17838 void  __attribute__((export_name("TS_CResult_PaymentParametersDecodeErrorZ_free"))) TS_CResult_PaymentParametersDecodeErrorZ_free(uint64_t _res) {
17839         if (!ptr_is_owned(_res)) return;
17840         void* _res_ptr = untag_ptr(_res);
17841         CHECK_ACCESS(_res_ptr);
17842         LDKCResult_PaymentParametersDecodeErrorZ _res_conv = *(LDKCResult_PaymentParametersDecodeErrorZ*)(_res_ptr);
17843         FREE(untag_ptr(_res));
17844         CResult_PaymentParametersDecodeErrorZ_free(_res_conv);
17845 }
17846
17847 static inline uint64_t CResult_PaymentParametersDecodeErrorZ_clone_ptr(LDKCResult_PaymentParametersDecodeErrorZ *NONNULL_PTR arg) {
17848         LDKCResult_PaymentParametersDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PaymentParametersDecodeErrorZ), "LDKCResult_PaymentParametersDecodeErrorZ");
17849         *ret_conv = CResult_PaymentParametersDecodeErrorZ_clone(arg);
17850         return tag_ptr(ret_conv, true);
17851 }
17852 int64_t  __attribute__((export_name("TS_CResult_PaymentParametersDecodeErrorZ_clone_ptr"))) TS_CResult_PaymentParametersDecodeErrorZ_clone_ptr(uint64_t arg) {
17853         LDKCResult_PaymentParametersDecodeErrorZ* arg_conv = (LDKCResult_PaymentParametersDecodeErrorZ*)untag_ptr(arg);
17854         int64_t ret_conv = CResult_PaymentParametersDecodeErrorZ_clone_ptr(arg_conv);
17855         return ret_conv;
17856 }
17857
17858 uint64_t  __attribute__((export_name("TS_CResult_PaymentParametersDecodeErrorZ_clone"))) TS_CResult_PaymentParametersDecodeErrorZ_clone(uint64_t orig) {
17859         LDKCResult_PaymentParametersDecodeErrorZ* orig_conv = (LDKCResult_PaymentParametersDecodeErrorZ*)untag_ptr(orig);
17860         LDKCResult_PaymentParametersDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PaymentParametersDecodeErrorZ), "LDKCResult_PaymentParametersDecodeErrorZ");
17861         *ret_conv = CResult_PaymentParametersDecodeErrorZ_clone(orig_conv);
17862         return tag_ptr(ret_conv, true);
17863 }
17864
17865 static inline uint64_t C2Tuple_BlindedPayInfoBlindedPathZ_clone_ptr(LDKC2Tuple_BlindedPayInfoBlindedPathZ *NONNULL_PTR arg) {
17866         LDKC2Tuple_BlindedPayInfoBlindedPathZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_BlindedPayInfoBlindedPathZ), "LDKC2Tuple_BlindedPayInfoBlindedPathZ");
17867         *ret_conv = C2Tuple_BlindedPayInfoBlindedPathZ_clone(arg);
17868         return tag_ptr(ret_conv, true);
17869 }
17870 int64_t  __attribute__((export_name("TS_C2Tuple_BlindedPayInfoBlindedPathZ_clone_ptr"))) TS_C2Tuple_BlindedPayInfoBlindedPathZ_clone_ptr(uint64_t arg) {
17871         LDKC2Tuple_BlindedPayInfoBlindedPathZ* arg_conv = (LDKC2Tuple_BlindedPayInfoBlindedPathZ*)untag_ptr(arg);
17872         int64_t ret_conv = C2Tuple_BlindedPayInfoBlindedPathZ_clone_ptr(arg_conv);
17873         return ret_conv;
17874 }
17875
17876 uint64_t  __attribute__((export_name("TS_C2Tuple_BlindedPayInfoBlindedPathZ_clone"))) TS_C2Tuple_BlindedPayInfoBlindedPathZ_clone(uint64_t orig) {
17877         LDKC2Tuple_BlindedPayInfoBlindedPathZ* orig_conv = (LDKC2Tuple_BlindedPayInfoBlindedPathZ*)untag_ptr(orig);
17878         LDKC2Tuple_BlindedPayInfoBlindedPathZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_BlindedPayInfoBlindedPathZ), "LDKC2Tuple_BlindedPayInfoBlindedPathZ");
17879         *ret_conv = C2Tuple_BlindedPayInfoBlindedPathZ_clone(orig_conv);
17880         return tag_ptr(ret_conv, true);
17881 }
17882
17883 uint64_t  __attribute__((export_name("TS_C2Tuple_BlindedPayInfoBlindedPathZ_new"))) TS_C2Tuple_BlindedPayInfoBlindedPathZ_new(uint64_t a, uint64_t b) {
17884         LDKBlindedPayInfo a_conv;
17885         a_conv.inner = untag_ptr(a);
17886         a_conv.is_owned = ptr_is_owned(a);
17887         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
17888         a_conv = BlindedPayInfo_clone(&a_conv);
17889         LDKBlindedPath b_conv;
17890         b_conv.inner = untag_ptr(b);
17891         b_conv.is_owned = ptr_is_owned(b);
17892         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
17893         b_conv = BlindedPath_clone(&b_conv);
17894         LDKC2Tuple_BlindedPayInfoBlindedPathZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_BlindedPayInfoBlindedPathZ), "LDKC2Tuple_BlindedPayInfoBlindedPathZ");
17895         *ret_conv = C2Tuple_BlindedPayInfoBlindedPathZ_new(a_conv, b_conv);
17896         return tag_ptr(ret_conv, true);
17897 }
17898
17899 void  __attribute__((export_name("TS_C2Tuple_BlindedPayInfoBlindedPathZ_free"))) TS_C2Tuple_BlindedPayInfoBlindedPathZ_free(uint64_t _res) {
17900         if (!ptr_is_owned(_res)) return;
17901         void* _res_ptr = untag_ptr(_res);
17902         CHECK_ACCESS(_res_ptr);
17903         LDKC2Tuple_BlindedPayInfoBlindedPathZ _res_conv = *(LDKC2Tuple_BlindedPayInfoBlindedPathZ*)(_res_ptr);
17904         FREE(untag_ptr(_res));
17905         C2Tuple_BlindedPayInfoBlindedPathZ_free(_res_conv);
17906 }
17907
17908 void  __attribute__((export_name("TS_CVec_C2Tuple_BlindedPayInfoBlindedPathZZ_free"))) TS_CVec_C2Tuple_BlindedPayInfoBlindedPathZZ_free(uint64_tArray _res) {
17909         LDKCVec_C2Tuple_BlindedPayInfoBlindedPathZZ _res_constr;
17910         _res_constr.datalen = _res->arr_len;
17911         if (_res_constr.datalen > 0)
17912                 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKC2Tuple_BlindedPayInfoBlindedPathZ), "LDKCVec_C2Tuple_BlindedPayInfoBlindedPathZZ Elements");
17913         else
17914                 _res_constr.data = NULL;
17915         uint64_t* _res_vals = _res->elems;
17916         for (size_t l = 0; l < _res_constr.datalen; l++) {
17917                 uint64_t _res_conv_37 = _res_vals[l];
17918                 void* _res_conv_37_ptr = untag_ptr(_res_conv_37);
17919                 CHECK_ACCESS(_res_conv_37_ptr);
17920                 LDKC2Tuple_BlindedPayInfoBlindedPathZ _res_conv_37_conv = *(LDKC2Tuple_BlindedPayInfoBlindedPathZ*)(_res_conv_37_ptr);
17921                 FREE(untag_ptr(_res_conv_37));
17922                 _res_constr.data[l] = _res_conv_37_conv;
17923         }
17924         FREE(_res);
17925         CVec_C2Tuple_BlindedPayInfoBlindedPathZZ_free(_res_constr);
17926 }
17927
17928 void  __attribute__((export_name("TS_CVec_RouteHintZ_free"))) TS_CVec_RouteHintZ_free(uint64_tArray _res) {
17929         LDKCVec_RouteHintZ _res_constr;
17930         _res_constr.datalen = _res->arr_len;
17931         if (_res_constr.datalen > 0)
17932                 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKRouteHint), "LDKCVec_RouteHintZ Elements");
17933         else
17934                 _res_constr.data = NULL;
17935         uint64_t* _res_vals = _res->elems;
17936         for (size_t l = 0; l < _res_constr.datalen; l++) {
17937                 uint64_t _res_conv_11 = _res_vals[l];
17938                 LDKRouteHint _res_conv_11_conv;
17939                 _res_conv_11_conv.inner = untag_ptr(_res_conv_11);
17940                 _res_conv_11_conv.is_owned = ptr_is_owned(_res_conv_11);
17941                 CHECK_INNER_FIELD_ACCESS_OR_NULL(_res_conv_11_conv);
17942                 _res_constr.data[l] = _res_conv_11_conv;
17943         }
17944         FREE(_res);
17945         CVec_RouteHintZ_free(_res_constr);
17946 }
17947
17948 void  __attribute__((export_name("TS_CVec_RouteHintHopZ_free"))) TS_CVec_RouteHintHopZ_free(uint64_tArray _res) {
17949         LDKCVec_RouteHintHopZ _res_constr;
17950         _res_constr.datalen = _res->arr_len;
17951         if (_res_constr.datalen > 0)
17952                 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKRouteHintHop), "LDKCVec_RouteHintHopZ Elements");
17953         else
17954                 _res_constr.data = NULL;
17955         uint64_t* _res_vals = _res->elems;
17956         for (size_t o = 0; o < _res_constr.datalen; o++) {
17957                 uint64_t _res_conv_14 = _res_vals[o];
17958                 LDKRouteHintHop _res_conv_14_conv;
17959                 _res_conv_14_conv.inner = untag_ptr(_res_conv_14);
17960                 _res_conv_14_conv.is_owned = ptr_is_owned(_res_conv_14);
17961                 CHECK_INNER_FIELD_ACCESS_OR_NULL(_res_conv_14_conv);
17962                 _res_constr.data[o] = _res_conv_14_conv;
17963         }
17964         FREE(_res);
17965         CVec_RouteHintHopZ_free(_res_constr);
17966 }
17967
17968 uint64_t  __attribute__((export_name("TS_CResult_RouteHintDecodeErrorZ_ok"))) TS_CResult_RouteHintDecodeErrorZ_ok(uint64_t o) {
17969         LDKRouteHint o_conv;
17970         o_conv.inner = untag_ptr(o);
17971         o_conv.is_owned = ptr_is_owned(o);
17972         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
17973         o_conv = RouteHint_clone(&o_conv);
17974         LDKCResult_RouteHintDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteHintDecodeErrorZ), "LDKCResult_RouteHintDecodeErrorZ");
17975         *ret_conv = CResult_RouteHintDecodeErrorZ_ok(o_conv);
17976         return tag_ptr(ret_conv, true);
17977 }
17978
17979 uint64_t  __attribute__((export_name("TS_CResult_RouteHintDecodeErrorZ_err"))) TS_CResult_RouteHintDecodeErrorZ_err(uint64_t e) {
17980         void* e_ptr = untag_ptr(e);
17981         CHECK_ACCESS(e_ptr);
17982         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
17983         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
17984         LDKCResult_RouteHintDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteHintDecodeErrorZ), "LDKCResult_RouteHintDecodeErrorZ");
17985         *ret_conv = CResult_RouteHintDecodeErrorZ_err(e_conv);
17986         return tag_ptr(ret_conv, true);
17987 }
17988
17989 jboolean  __attribute__((export_name("TS_CResult_RouteHintDecodeErrorZ_is_ok"))) TS_CResult_RouteHintDecodeErrorZ_is_ok(uint64_t o) {
17990         LDKCResult_RouteHintDecodeErrorZ* o_conv = (LDKCResult_RouteHintDecodeErrorZ*)untag_ptr(o);
17991         jboolean ret_conv = CResult_RouteHintDecodeErrorZ_is_ok(o_conv);
17992         return ret_conv;
17993 }
17994
17995 void  __attribute__((export_name("TS_CResult_RouteHintDecodeErrorZ_free"))) TS_CResult_RouteHintDecodeErrorZ_free(uint64_t _res) {
17996         if (!ptr_is_owned(_res)) return;
17997         void* _res_ptr = untag_ptr(_res);
17998         CHECK_ACCESS(_res_ptr);
17999         LDKCResult_RouteHintDecodeErrorZ _res_conv = *(LDKCResult_RouteHintDecodeErrorZ*)(_res_ptr);
18000         FREE(untag_ptr(_res));
18001         CResult_RouteHintDecodeErrorZ_free(_res_conv);
18002 }
18003
18004 static inline uint64_t CResult_RouteHintDecodeErrorZ_clone_ptr(LDKCResult_RouteHintDecodeErrorZ *NONNULL_PTR arg) {
18005         LDKCResult_RouteHintDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteHintDecodeErrorZ), "LDKCResult_RouteHintDecodeErrorZ");
18006         *ret_conv = CResult_RouteHintDecodeErrorZ_clone(arg);
18007         return tag_ptr(ret_conv, true);
18008 }
18009 int64_t  __attribute__((export_name("TS_CResult_RouteHintDecodeErrorZ_clone_ptr"))) TS_CResult_RouteHintDecodeErrorZ_clone_ptr(uint64_t arg) {
18010         LDKCResult_RouteHintDecodeErrorZ* arg_conv = (LDKCResult_RouteHintDecodeErrorZ*)untag_ptr(arg);
18011         int64_t ret_conv = CResult_RouteHintDecodeErrorZ_clone_ptr(arg_conv);
18012         return ret_conv;
18013 }
18014
18015 uint64_t  __attribute__((export_name("TS_CResult_RouteHintDecodeErrorZ_clone"))) TS_CResult_RouteHintDecodeErrorZ_clone(uint64_t orig) {
18016         LDKCResult_RouteHintDecodeErrorZ* orig_conv = (LDKCResult_RouteHintDecodeErrorZ*)untag_ptr(orig);
18017         LDKCResult_RouteHintDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteHintDecodeErrorZ), "LDKCResult_RouteHintDecodeErrorZ");
18018         *ret_conv = CResult_RouteHintDecodeErrorZ_clone(orig_conv);
18019         return tag_ptr(ret_conv, true);
18020 }
18021
18022 uint64_t  __attribute__((export_name("TS_CResult_RouteHintHopDecodeErrorZ_ok"))) TS_CResult_RouteHintHopDecodeErrorZ_ok(uint64_t o) {
18023         LDKRouteHintHop o_conv;
18024         o_conv.inner = untag_ptr(o);
18025         o_conv.is_owned = ptr_is_owned(o);
18026         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
18027         o_conv = RouteHintHop_clone(&o_conv);
18028         LDKCResult_RouteHintHopDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteHintHopDecodeErrorZ), "LDKCResult_RouteHintHopDecodeErrorZ");
18029         *ret_conv = CResult_RouteHintHopDecodeErrorZ_ok(o_conv);
18030         return tag_ptr(ret_conv, true);
18031 }
18032
18033 uint64_t  __attribute__((export_name("TS_CResult_RouteHintHopDecodeErrorZ_err"))) TS_CResult_RouteHintHopDecodeErrorZ_err(uint64_t e) {
18034         void* e_ptr = untag_ptr(e);
18035         CHECK_ACCESS(e_ptr);
18036         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
18037         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
18038         LDKCResult_RouteHintHopDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteHintHopDecodeErrorZ), "LDKCResult_RouteHintHopDecodeErrorZ");
18039         *ret_conv = CResult_RouteHintHopDecodeErrorZ_err(e_conv);
18040         return tag_ptr(ret_conv, true);
18041 }
18042
18043 jboolean  __attribute__((export_name("TS_CResult_RouteHintHopDecodeErrorZ_is_ok"))) TS_CResult_RouteHintHopDecodeErrorZ_is_ok(uint64_t o) {
18044         LDKCResult_RouteHintHopDecodeErrorZ* o_conv = (LDKCResult_RouteHintHopDecodeErrorZ*)untag_ptr(o);
18045         jboolean ret_conv = CResult_RouteHintHopDecodeErrorZ_is_ok(o_conv);
18046         return ret_conv;
18047 }
18048
18049 void  __attribute__((export_name("TS_CResult_RouteHintHopDecodeErrorZ_free"))) TS_CResult_RouteHintHopDecodeErrorZ_free(uint64_t _res) {
18050         if (!ptr_is_owned(_res)) return;
18051         void* _res_ptr = untag_ptr(_res);
18052         CHECK_ACCESS(_res_ptr);
18053         LDKCResult_RouteHintHopDecodeErrorZ _res_conv = *(LDKCResult_RouteHintHopDecodeErrorZ*)(_res_ptr);
18054         FREE(untag_ptr(_res));
18055         CResult_RouteHintHopDecodeErrorZ_free(_res_conv);
18056 }
18057
18058 static inline uint64_t CResult_RouteHintHopDecodeErrorZ_clone_ptr(LDKCResult_RouteHintHopDecodeErrorZ *NONNULL_PTR arg) {
18059         LDKCResult_RouteHintHopDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteHintHopDecodeErrorZ), "LDKCResult_RouteHintHopDecodeErrorZ");
18060         *ret_conv = CResult_RouteHintHopDecodeErrorZ_clone(arg);
18061         return tag_ptr(ret_conv, true);
18062 }
18063 int64_t  __attribute__((export_name("TS_CResult_RouteHintHopDecodeErrorZ_clone_ptr"))) TS_CResult_RouteHintHopDecodeErrorZ_clone_ptr(uint64_t arg) {
18064         LDKCResult_RouteHintHopDecodeErrorZ* arg_conv = (LDKCResult_RouteHintHopDecodeErrorZ*)untag_ptr(arg);
18065         int64_t ret_conv = CResult_RouteHintHopDecodeErrorZ_clone_ptr(arg_conv);
18066         return ret_conv;
18067 }
18068
18069 uint64_t  __attribute__((export_name("TS_CResult_RouteHintHopDecodeErrorZ_clone"))) TS_CResult_RouteHintHopDecodeErrorZ_clone(uint64_t orig) {
18070         LDKCResult_RouteHintHopDecodeErrorZ* orig_conv = (LDKCResult_RouteHintHopDecodeErrorZ*)untag_ptr(orig);
18071         LDKCResult_RouteHintHopDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteHintHopDecodeErrorZ), "LDKCResult_RouteHintHopDecodeErrorZ");
18072         *ret_conv = CResult_RouteHintHopDecodeErrorZ_clone(orig_conv);
18073         return tag_ptr(ret_conv, true);
18074 }
18075
18076 void  __attribute__((export_name("TS_CVec_PublicKeyZ_free"))) TS_CVec_PublicKeyZ_free(ptrArray _res) {
18077         LDKCVec_PublicKeyZ _res_constr;
18078         _res_constr.datalen = _res->arr_len;
18079         if (_res_constr.datalen > 0)
18080                 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKPublicKey), "LDKCVec_PublicKeyZ Elements");
18081         else
18082                 _res_constr.data = NULL;
18083         int8_tArray* _res_vals = (void*) _res->elems;
18084         for (size_t m = 0; m < _res_constr.datalen; m++) {
18085                 int8_tArray _res_conv_12 = _res_vals[m];
18086                 LDKPublicKey _res_conv_12_ref;
18087                 CHECK(_res_conv_12->arr_len == 33);
18088                 memcpy(_res_conv_12_ref.compressed_form, _res_conv_12->elems, 33); FREE(_res_conv_12);
18089                 _res_constr.data[m] = _res_conv_12_ref;
18090         }
18091         FREE(_res);
18092         CVec_PublicKeyZ_free(_res_constr);
18093 }
18094
18095 uint64_t  __attribute__((export_name("TS_CResult_FixedPenaltyScorerDecodeErrorZ_ok"))) TS_CResult_FixedPenaltyScorerDecodeErrorZ_ok(uint64_t o) {
18096         LDKFixedPenaltyScorer o_conv;
18097         o_conv.inner = untag_ptr(o);
18098         o_conv.is_owned = ptr_is_owned(o);
18099         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
18100         o_conv = FixedPenaltyScorer_clone(&o_conv);
18101         LDKCResult_FixedPenaltyScorerDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_FixedPenaltyScorerDecodeErrorZ), "LDKCResult_FixedPenaltyScorerDecodeErrorZ");
18102         *ret_conv = CResult_FixedPenaltyScorerDecodeErrorZ_ok(o_conv);
18103         return tag_ptr(ret_conv, true);
18104 }
18105
18106 uint64_t  __attribute__((export_name("TS_CResult_FixedPenaltyScorerDecodeErrorZ_err"))) TS_CResult_FixedPenaltyScorerDecodeErrorZ_err(uint64_t e) {
18107         void* e_ptr = untag_ptr(e);
18108         CHECK_ACCESS(e_ptr);
18109         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
18110         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
18111         LDKCResult_FixedPenaltyScorerDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_FixedPenaltyScorerDecodeErrorZ), "LDKCResult_FixedPenaltyScorerDecodeErrorZ");
18112         *ret_conv = CResult_FixedPenaltyScorerDecodeErrorZ_err(e_conv);
18113         return tag_ptr(ret_conv, true);
18114 }
18115
18116 jboolean  __attribute__((export_name("TS_CResult_FixedPenaltyScorerDecodeErrorZ_is_ok"))) TS_CResult_FixedPenaltyScorerDecodeErrorZ_is_ok(uint64_t o) {
18117         LDKCResult_FixedPenaltyScorerDecodeErrorZ* o_conv = (LDKCResult_FixedPenaltyScorerDecodeErrorZ*)untag_ptr(o);
18118         jboolean ret_conv = CResult_FixedPenaltyScorerDecodeErrorZ_is_ok(o_conv);
18119         return ret_conv;
18120 }
18121
18122 void  __attribute__((export_name("TS_CResult_FixedPenaltyScorerDecodeErrorZ_free"))) TS_CResult_FixedPenaltyScorerDecodeErrorZ_free(uint64_t _res) {
18123         if (!ptr_is_owned(_res)) return;
18124         void* _res_ptr = untag_ptr(_res);
18125         CHECK_ACCESS(_res_ptr);
18126         LDKCResult_FixedPenaltyScorerDecodeErrorZ _res_conv = *(LDKCResult_FixedPenaltyScorerDecodeErrorZ*)(_res_ptr);
18127         FREE(untag_ptr(_res));
18128         CResult_FixedPenaltyScorerDecodeErrorZ_free(_res_conv);
18129 }
18130
18131 static inline uint64_t CResult_FixedPenaltyScorerDecodeErrorZ_clone_ptr(LDKCResult_FixedPenaltyScorerDecodeErrorZ *NONNULL_PTR arg) {
18132         LDKCResult_FixedPenaltyScorerDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_FixedPenaltyScorerDecodeErrorZ), "LDKCResult_FixedPenaltyScorerDecodeErrorZ");
18133         *ret_conv = CResult_FixedPenaltyScorerDecodeErrorZ_clone(arg);
18134         return tag_ptr(ret_conv, true);
18135 }
18136 int64_t  __attribute__((export_name("TS_CResult_FixedPenaltyScorerDecodeErrorZ_clone_ptr"))) TS_CResult_FixedPenaltyScorerDecodeErrorZ_clone_ptr(uint64_t arg) {
18137         LDKCResult_FixedPenaltyScorerDecodeErrorZ* arg_conv = (LDKCResult_FixedPenaltyScorerDecodeErrorZ*)untag_ptr(arg);
18138         int64_t ret_conv = CResult_FixedPenaltyScorerDecodeErrorZ_clone_ptr(arg_conv);
18139         return ret_conv;
18140 }
18141
18142 uint64_t  __attribute__((export_name("TS_CResult_FixedPenaltyScorerDecodeErrorZ_clone"))) TS_CResult_FixedPenaltyScorerDecodeErrorZ_clone(uint64_t orig) {
18143         LDKCResult_FixedPenaltyScorerDecodeErrorZ* orig_conv = (LDKCResult_FixedPenaltyScorerDecodeErrorZ*)untag_ptr(orig);
18144         LDKCResult_FixedPenaltyScorerDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_FixedPenaltyScorerDecodeErrorZ), "LDKCResult_FixedPenaltyScorerDecodeErrorZ");
18145         *ret_conv = CResult_FixedPenaltyScorerDecodeErrorZ_clone(orig_conv);
18146         return tag_ptr(ret_conv, true);
18147 }
18148
18149 void  __attribute__((export_name("TS_CVec_NodeIdZ_free"))) TS_CVec_NodeIdZ_free(uint64_tArray _res) {
18150         LDKCVec_NodeIdZ _res_constr;
18151         _res_constr.datalen = _res->arr_len;
18152         if (_res_constr.datalen > 0)
18153                 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKNodeId), "LDKCVec_NodeIdZ Elements");
18154         else
18155                 _res_constr.data = NULL;
18156         uint64_t* _res_vals = _res->elems;
18157         for (size_t i = 0; i < _res_constr.datalen; i++) {
18158                 uint64_t _res_conv_8 = _res_vals[i];
18159                 LDKNodeId _res_conv_8_conv;
18160                 _res_conv_8_conv.inner = untag_ptr(_res_conv_8);
18161                 _res_conv_8_conv.is_owned = ptr_is_owned(_res_conv_8);
18162                 CHECK_INNER_FIELD_ACCESS_OR_NULL(_res_conv_8_conv);
18163                 _res_constr.data[i] = _res_conv_8_conv;
18164         }
18165         FREE(_res);
18166         CVec_NodeIdZ_free(_res_constr);
18167 }
18168
18169 static inline uint64_t C2Tuple_u64u64Z_clone_ptr(LDKC2Tuple_u64u64Z *NONNULL_PTR arg) {
18170         LDKC2Tuple_u64u64Z* ret_conv = MALLOC(sizeof(LDKC2Tuple_u64u64Z), "LDKC2Tuple_u64u64Z");
18171         *ret_conv = C2Tuple_u64u64Z_clone(arg);
18172         return tag_ptr(ret_conv, true);
18173 }
18174 int64_t  __attribute__((export_name("TS_C2Tuple_u64u64Z_clone_ptr"))) TS_C2Tuple_u64u64Z_clone_ptr(uint64_t arg) {
18175         LDKC2Tuple_u64u64Z* arg_conv = (LDKC2Tuple_u64u64Z*)untag_ptr(arg);
18176         int64_t ret_conv = C2Tuple_u64u64Z_clone_ptr(arg_conv);
18177         return ret_conv;
18178 }
18179
18180 uint64_t  __attribute__((export_name("TS_C2Tuple_u64u64Z_clone"))) TS_C2Tuple_u64u64Z_clone(uint64_t orig) {
18181         LDKC2Tuple_u64u64Z* orig_conv = (LDKC2Tuple_u64u64Z*)untag_ptr(orig);
18182         LDKC2Tuple_u64u64Z* ret_conv = MALLOC(sizeof(LDKC2Tuple_u64u64Z), "LDKC2Tuple_u64u64Z");
18183         *ret_conv = C2Tuple_u64u64Z_clone(orig_conv);
18184         return tag_ptr(ret_conv, true);
18185 }
18186
18187 uint64_t  __attribute__((export_name("TS_C2Tuple_u64u64Z_new"))) TS_C2Tuple_u64u64Z_new(int64_t a, int64_t b) {
18188         LDKC2Tuple_u64u64Z* ret_conv = MALLOC(sizeof(LDKC2Tuple_u64u64Z), "LDKC2Tuple_u64u64Z");
18189         *ret_conv = C2Tuple_u64u64Z_new(a, b);
18190         return tag_ptr(ret_conv, true);
18191 }
18192
18193 void  __attribute__((export_name("TS_C2Tuple_u64u64Z_free"))) TS_C2Tuple_u64u64Z_free(uint64_t _res) {
18194         if (!ptr_is_owned(_res)) return;
18195         void* _res_ptr = untag_ptr(_res);
18196         CHECK_ACCESS(_res_ptr);
18197         LDKC2Tuple_u64u64Z _res_conv = *(LDKC2Tuple_u64u64Z*)(_res_ptr);
18198         FREE(untag_ptr(_res));
18199         C2Tuple_u64u64Z_free(_res_conv);
18200 }
18201
18202 uint64_t  __attribute__((export_name("TS_COption_C2Tuple_u64u64ZZ_some"))) TS_COption_C2Tuple_u64u64ZZ_some(uint64_t o) {
18203         void* o_ptr = untag_ptr(o);
18204         CHECK_ACCESS(o_ptr);
18205         LDKC2Tuple_u64u64Z o_conv = *(LDKC2Tuple_u64u64Z*)(o_ptr);
18206         o_conv = C2Tuple_u64u64Z_clone((LDKC2Tuple_u64u64Z*)untag_ptr(o));
18207         LDKCOption_C2Tuple_u64u64ZZ *ret_copy = MALLOC(sizeof(LDKCOption_C2Tuple_u64u64ZZ), "LDKCOption_C2Tuple_u64u64ZZ");
18208         *ret_copy = COption_C2Tuple_u64u64ZZ_some(o_conv);
18209         uint64_t ret_ref = tag_ptr(ret_copy, true);
18210         return ret_ref;
18211 }
18212
18213 uint64_t  __attribute__((export_name("TS_COption_C2Tuple_u64u64ZZ_none"))) TS_COption_C2Tuple_u64u64ZZ_none() {
18214         LDKCOption_C2Tuple_u64u64ZZ *ret_copy = MALLOC(sizeof(LDKCOption_C2Tuple_u64u64ZZ), "LDKCOption_C2Tuple_u64u64ZZ");
18215         *ret_copy = COption_C2Tuple_u64u64ZZ_none();
18216         uint64_t ret_ref = tag_ptr(ret_copy, true);
18217         return ret_ref;
18218 }
18219
18220 void  __attribute__((export_name("TS_COption_C2Tuple_u64u64ZZ_free"))) TS_COption_C2Tuple_u64u64ZZ_free(uint64_t _res) {
18221         if (!ptr_is_owned(_res)) return;
18222         void* _res_ptr = untag_ptr(_res);
18223         CHECK_ACCESS(_res_ptr);
18224         LDKCOption_C2Tuple_u64u64ZZ _res_conv = *(LDKCOption_C2Tuple_u64u64ZZ*)(_res_ptr);
18225         FREE(untag_ptr(_res));
18226         COption_C2Tuple_u64u64ZZ_free(_res_conv);
18227 }
18228
18229 static inline uint64_t COption_C2Tuple_u64u64ZZ_clone_ptr(LDKCOption_C2Tuple_u64u64ZZ *NONNULL_PTR arg) {
18230         LDKCOption_C2Tuple_u64u64ZZ *ret_copy = MALLOC(sizeof(LDKCOption_C2Tuple_u64u64ZZ), "LDKCOption_C2Tuple_u64u64ZZ");
18231         *ret_copy = COption_C2Tuple_u64u64ZZ_clone(arg);
18232         uint64_t ret_ref = tag_ptr(ret_copy, true);
18233         return ret_ref;
18234 }
18235 int64_t  __attribute__((export_name("TS_COption_C2Tuple_u64u64ZZ_clone_ptr"))) TS_COption_C2Tuple_u64u64ZZ_clone_ptr(uint64_t arg) {
18236         LDKCOption_C2Tuple_u64u64ZZ* arg_conv = (LDKCOption_C2Tuple_u64u64ZZ*)untag_ptr(arg);
18237         int64_t ret_conv = COption_C2Tuple_u64u64ZZ_clone_ptr(arg_conv);
18238         return ret_conv;
18239 }
18240
18241 uint64_t  __attribute__((export_name("TS_COption_C2Tuple_u64u64ZZ_clone"))) TS_COption_C2Tuple_u64u64ZZ_clone(uint64_t orig) {
18242         LDKCOption_C2Tuple_u64u64ZZ* orig_conv = (LDKCOption_C2Tuple_u64u64ZZ*)untag_ptr(orig);
18243         LDKCOption_C2Tuple_u64u64ZZ *ret_copy = MALLOC(sizeof(LDKCOption_C2Tuple_u64u64ZZ), "LDKCOption_C2Tuple_u64u64ZZ");
18244         *ret_copy = COption_C2Tuple_u64u64ZZ_clone(orig_conv);
18245         uint64_t ret_ref = tag_ptr(ret_copy, true);
18246         return ret_ref;
18247 }
18248
18249 uint64_t  __attribute__((export_name("TS_C2Tuple_Z_new"))) TS_C2Tuple_Z_new(int16_tArray a, int16_tArray b) {
18250         LDKThirtyTwoU16s a_ref;
18251         CHECK(a->arr_len == 32);
18252         memcpy(a_ref.data, a->elems, 32 * 2); FREE(a);
18253         LDKThirtyTwoU16s b_ref;
18254         CHECK(b->arr_len == 32);
18255         memcpy(b_ref.data, b->elems, 32 * 2); FREE(b);
18256         LDKC2Tuple_Z* ret_conv = MALLOC(sizeof(LDKC2Tuple_Z), "LDKC2Tuple_Z");
18257         *ret_conv = C2Tuple_Z_new(a_ref, b_ref);
18258         return tag_ptr(ret_conv, true);
18259 }
18260
18261 void  __attribute__((export_name("TS_C2Tuple_Z_free"))) TS_C2Tuple_Z_free(uint64_t _res) {
18262         if (!ptr_is_owned(_res)) return;
18263         void* _res_ptr = untag_ptr(_res);
18264         CHECK_ACCESS(_res_ptr);
18265         LDKC2Tuple_Z _res_conv = *(LDKC2Tuple_Z*)(_res_ptr);
18266         FREE(untag_ptr(_res));
18267         C2Tuple_Z_free(_res_conv);
18268 }
18269
18270 uint64_t  __attribute__((export_name("TS_C2Tuple__u1632_u1632Z_new"))) TS_C2Tuple__u1632_u1632Z_new(int16_tArray a, int16_tArray b) {
18271         LDKThirtyTwoU16s a_ref;
18272         CHECK(a->arr_len == 32);
18273         memcpy(a_ref.data, a->elems, 32 * 2); FREE(a);
18274         LDKThirtyTwoU16s b_ref;
18275         CHECK(b->arr_len == 32);
18276         memcpy(b_ref.data, b->elems, 32 * 2); FREE(b);
18277         LDKC2Tuple__u1632_u1632Z* ret_conv = MALLOC(sizeof(LDKC2Tuple__u1632_u1632Z), "LDKC2Tuple__u1632_u1632Z");
18278         *ret_conv = C2Tuple__u1632_u1632Z_new(a_ref, b_ref);
18279         return tag_ptr(ret_conv, true);
18280 }
18281
18282 void  __attribute__((export_name("TS_C2Tuple__u1632_u1632Z_free"))) TS_C2Tuple__u1632_u1632Z_free(uint64_t _res) {
18283         if (!ptr_is_owned(_res)) return;
18284         void* _res_ptr = untag_ptr(_res);
18285         CHECK_ACCESS(_res_ptr);
18286         LDKC2Tuple__u1632_u1632Z _res_conv = *(LDKC2Tuple__u1632_u1632Z*)(_res_ptr);
18287         FREE(untag_ptr(_res));
18288         C2Tuple__u1632_u1632Z_free(_res_conv);
18289 }
18290
18291 uint64_t  __attribute__((export_name("TS_COption_C2Tuple_ThirtyTwoU16sThirtyTwoU16sZZ_some"))) TS_COption_C2Tuple_ThirtyTwoU16sThirtyTwoU16sZZ_some(uint64_t o) {
18292         void* o_ptr = untag_ptr(o);
18293         CHECK_ACCESS(o_ptr);
18294         LDKC2Tuple__u1632_u1632Z o_conv = *(LDKC2Tuple__u1632_u1632Z*)(o_ptr);
18295         // WARNING: we may need a move here but no clone is available for LDKC2Tuple__u1632_u1632Z
18296         LDKCOption_C2Tuple_ThirtyTwoU16sThirtyTwoU16sZZ *ret_copy = MALLOC(sizeof(LDKCOption_C2Tuple_ThirtyTwoU16sThirtyTwoU16sZZ), "LDKCOption_C2Tuple_ThirtyTwoU16sThirtyTwoU16sZZ");
18297         *ret_copy = COption_C2Tuple_ThirtyTwoU16sThirtyTwoU16sZZ_some(o_conv);
18298         uint64_t ret_ref = tag_ptr(ret_copy, true);
18299         return ret_ref;
18300 }
18301
18302 uint64_t  __attribute__((export_name("TS_COption_C2Tuple_ThirtyTwoU16sThirtyTwoU16sZZ_none"))) TS_COption_C2Tuple_ThirtyTwoU16sThirtyTwoU16sZZ_none() {
18303         LDKCOption_C2Tuple_ThirtyTwoU16sThirtyTwoU16sZZ *ret_copy = MALLOC(sizeof(LDKCOption_C2Tuple_ThirtyTwoU16sThirtyTwoU16sZZ), "LDKCOption_C2Tuple_ThirtyTwoU16sThirtyTwoU16sZZ");
18304         *ret_copy = COption_C2Tuple_ThirtyTwoU16sThirtyTwoU16sZZ_none();
18305         uint64_t ret_ref = tag_ptr(ret_copy, true);
18306         return ret_ref;
18307 }
18308
18309 void  __attribute__((export_name("TS_COption_C2Tuple_ThirtyTwoU16sThirtyTwoU16sZZ_free"))) TS_COption_C2Tuple_ThirtyTwoU16sThirtyTwoU16sZZ_free(uint64_t _res) {
18310         if (!ptr_is_owned(_res)) return;
18311         void* _res_ptr = untag_ptr(_res);
18312         CHECK_ACCESS(_res_ptr);
18313         LDKCOption_C2Tuple_ThirtyTwoU16sThirtyTwoU16sZZ _res_conv = *(LDKCOption_C2Tuple_ThirtyTwoU16sThirtyTwoU16sZZ*)(_res_ptr);
18314         FREE(untag_ptr(_res));
18315         COption_C2Tuple_ThirtyTwoU16sThirtyTwoU16sZZ_free(_res_conv);
18316 }
18317
18318 uint64_t  __attribute__((export_name("TS_COption_f64Z_some"))) TS_COption_f64Z_some(double o) {
18319         LDKCOption_f64Z *ret_copy = MALLOC(sizeof(LDKCOption_f64Z), "LDKCOption_f64Z");
18320         *ret_copy = COption_f64Z_some(o);
18321         uint64_t ret_ref = tag_ptr(ret_copy, true);
18322         return ret_ref;
18323 }
18324
18325 uint64_t  __attribute__((export_name("TS_COption_f64Z_none"))) TS_COption_f64Z_none() {
18326         LDKCOption_f64Z *ret_copy = MALLOC(sizeof(LDKCOption_f64Z), "LDKCOption_f64Z");
18327         *ret_copy = COption_f64Z_none();
18328         uint64_t ret_ref = tag_ptr(ret_copy, true);
18329         return ret_ref;
18330 }
18331
18332 void  __attribute__((export_name("TS_COption_f64Z_free"))) TS_COption_f64Z_free(uint64_t _res) {
18333         if (!ptr_is_owned(_res)) return;
18334         void* _res_ptr = untag_ptr(_res);
18335         CHECK_ACCESS(_res_ptr);
18336         LDKCOption_f64Z _res_conv = *(LDKCOption_f64Z*)(_res_ptr);
18337         FREE(untag_ptr(_res));
18338         COption_f64Z_free(_res_conv);
18339 }
18340
18341 static inline uint64_t COption_f64Z_clone_ptr(LDKCOption_f64Z *NONNULL_PTR arg) {
18342         LDKCOption_f64Z *ret_copy = MALLOC(sizeof(LDKCOption_f64Z), "LDKCOption_f64Z");
18343         *ret_copy = COption_f64Z_clone(arg);
18344         uint64_t ret_ref = tag_ptr(ret_copy, true);
18345         return ret_ref;
18346 }
18347 int64_t  __attribute__((export_name("TS_COption_f64Z_clone_ptr"))) TS_COption_f64Z_clone_ptr(uint64_t arg) {
18348         LDKCOption_f64Z* arg_conv = (LDKCOption_f64Z*)untag_ptr(arg);
18349         int64_t ret_conv = COption_f64Z_clone_ptr(arg_conv);
18350         return ret_conv;
18351 }
18352
18353 uint64_t  __attribute__((export_name("TS_COption_f64Z_clone"))) TS_COption_f64Z_clone(uint64_t orig) {
18354         LDKCOption_f64Z* orig_conv = (LDKCOption_f64Z*)untag_ptr(orig);
18355         LDKCOption_f64Z *ret_copy = MALLOC(sizeof(LDKCOption_f64Z), "LDKCOption_f64Z");
18356         *ret_copy = COption_f64Z_clone(orig_conv);
18357         uint64_t ret_ref = tag_ptr(ret_copy, true);
18358         return ret_ref;
18359 }
18360
18361 uint64_t  __attribute__((export_name("TS_CResult_ProbabilisticScorerDecodeErrorZ_ok"))) TS_CResult_ProbabilisticScorerDecodeErrorZ_ok(uint64_t o) {
18362         LDKProbabilisticScorer o_conv;
18363         o_conv.inner = untag_ptr(o);
18364         o_conv.is_owned = ptr_is_owned(o);
18365         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
18366         // WARNING: we need a move here but no clone is available for LDKProbabilisticScorer
18367         
18368         LDKCResult_ProbabilisticScorerDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ProbabilisticScorerDecodeErrorZ), "LDKCResult_ProbabilisticScorerDecodeErrorZ");
18369         *ret_conv = CResult_ProbabilisticScorerDecodeErrorZ_ok(o_conv);
18370         return tag_ptr(ret_conv, true);
18371 }
18372
18373 uint64_t  __attribute__((export_name("TS_CResult_ProbabilisticScorerDecodeErrorZ_err"))) TS_CResult_ProbabilisticScorerDecodeErrorZ_err(uint64_t e) {
18374         void* e_ptr = untag_ptr(e);
18375         CHECK_ACCESS(e_ptr);
18376         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
18377         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
18378         LDKCResult_ProbabilisticScorerDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ProbabilisticScorerDecodeErrorZ), "LDKCResult_ProbabilisticScorerDecodeErrorZ");
18379         *ret_conv = CResult_ProbabilisticScorerDecodeErrorZ_err(e_conv);
18380         return tag_ptr(ret_conv, true);
18381 }
18382
18383 jboolean  __attribute__((export_name("TS_CResult_ProbabilisticScorerDecodeErrorZ_is_ok"))) TS_CResult_ProbabilisticScorerDecodeErrorZ_is_ok(uint64_t o) {
18384         LDKCResult_ProbabilisticScorerDecodeErrorZ* o_conv = (LDKCResult_ProbabilisticScorerDecodeErrorZ*)untag_ptr(o);
18385         jboolean ret_conv = CResult_ProbabilisticScorerDecodeErrorZ_is_ok(o_conv);
18386         return ret_conv;
18387 }
18388
18389 void  __attribute__((export_name("TS_CResult_ProbabilisticScorerDecodeErrorZ_free"))) TS_CResult_ProbabilisticScorerDecodeErrorZ_free(uint64_t _res) {
18390         if (!ptr_is_owned(_res)) return;
18391         void* _res_ptr = untag_ptr(_res);
18392         CHECK_ACCESS(_res_ptr);
18393         LDKCResult_ProbabilisticScorerDecodeErrorZ _res_conv = *(LDKCResult_ProbabilisticScorerDecodeErrorZ*)(_res_ptr);
18394         FREE(untag_ptr(_res));
18395         CResult_ProbabilisticScorerDecodeErrorZ_free(_res_conv);
18396 }
18397
18398 static inline uint64_t C2Tuple_usizeTransactionZ_clone_ptr(LDKC2Tuple_usizeTransactionZ *NONNULL_PTR arg) {
18399         LDKC2Tuple_usizeTransactionZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_usizeTransactionZ), "LDKC2Tuple_usizeTransactionZ");
18400         *ret_conv = C2Tuple_usizeTransactionZ_clone(arg);
18401         return tag_ptr(ret_conv, true);
18402 }
18403 int64_t  __attribute__((export_name("TS_C2Tuple_usizeTransactionZ_clone_ptr"))) TS_C2Tuple_usizeTransactionZ_clone_ptr(uint64_t arg) {
18404         LDKC2Tuple_usizeTransactionZ* arg_conv = (LDKC2Tuple_usizeTransactionZ*)untag_ptr(arg);
18405         int64_t ret_conv = C2Tuple_usizeTransactionZ_clone_ptr(arg_conv);
18406         return ret_conv;
18407 }
18408
18409 uint64_t  __attribute__((export_name("TS_C2Tuple_usizeTransactionZ_clone"))) TS_C2Tuple_usizeTransactionZ_clone(uint64_t orig) {
18410         LDKC2Tuple_usizeTransactionZ* orig_conv = (LDKC2Tuple_usizeTransactionZ*)untag_ptr(orig);
18411         LDKC2Tuple_usizeTransactionZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_usizeTransactionZ), "LDKC2Tuple_usizeTransactionZ");
18412         *ret_conv = C2Tuple_usizeTransactionZ_clone(orig_conv);
18413         return tag_ptr(ret_conv, true);
18414 }
18415
18416 uint64_t  __attribute__((export_name("TS_C2Tuple_usizeTransactionZ_new"))) TS_C2Tuple_usizeTransactionZ_new(uint32_t a, int8_tArray b) {
18417         LDKTransaction b_ref;
18418         b_ref.datalen = b->arr_len;
18419         b_ref.data = MALLOC(b_ref.datalen, "LDKTransaction Bytes");
18420         memcpy(b_ref.data, b->elems, b_ref.datalen); FREE(b);
18421         b_ref.data_is_owned = true;
18422         LDKC2Tuple_usizeTransactionZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_usizeTransactionZ), "LDKC2Tuple_usizeTransactionZ");
18423         *ret_conv = C2Tuple_usizeTransactionZ_new(a, b_ref);
18424         return tag_ptr(ret_conv, true);
18425 }
18426
18427 void  __attribute__((export_name("TS_C2Tuple_usizeTransactionZ_free"))) TS_C2Tuple_usizeTransactionZ_free(uint64_t _res) {
18428         if (!ptr_is_owned(_res)) return;
18429         void* _res_ptr = untag_ptr(_res);
18430         CHECK_ACCESS(_res_ptr);
18431         LDKC2Tuple_usizeTransactionZ _res_conv = *(LDKC2Tuple_usizeTransactionZ*)(_res_ptr);
18432         FREE(untag_ptr(_res));
18433         C2Tuple_usizeTransactionZ_free(_res_conv);
18434 }
18435
18436 void  __attribute__((export_name("TS_CVec_C2Tuple_usizeTransactionZZ_free"))) TS_CVec_C2Tuple_usizeTransactionZZ_free(uint64_tArray _res) {
18437         LDKCVec_C2Tuple_usizeTransactionZZ _res_constr;
18438         _res_constr.datalen = _res->arr_len;
18439         if (_res_constr.datalen > 0)
18440                 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKC2Tuple_usizeTransactionZ), "LDKCVec_C2Tuple_usizeTransactionZZ Elements");
18441         else
18442                 _res_constr.data = NULL;
18443         uint64_t* _res_vals = _res->elems;
18444         for (size_t c = 0; c < _res_constr.datalen; c++) {
18445                 uint64_t _res_conv_28 = _res_vals[c];
18446                 void* _res_conv_28_ptr = untag_ptr(_res_conv_28);
18447                 CHECK_ACCESS(_res_conv_28_ptr);
18448                 LDKC2Tuple_usizeTransactionZ _res_conv_28_conv = *(LDKC2Tuple_usizeTransactionZ*)(_res_conv_28_ptr);
18449                 FREE(untag_ptr(_res_conv_28));
18450                 _res_constr.data[c] = _res_conv_28_conv;
18451         }
18452         FREE(_res);
18453         CVec_C2Tuple_usizeTransactionZZ_free(_res_constr);
18454 }
18455
18456 static inline uint64_t C2Tuple_ThirtyTwoBytesCOption_ThirtyTwoBytesZZ_clone_ptr(LDKC2Tuple_ThirtyTwoBytesCOption_ThirtyTwoBytesZZ *NONNULL_PTR arg) {
18457         LDKC2Tuple_ThirtyTwoBytesCOption_ThirtyTwoBytesZZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_ThirtyTwoBytesCOption_ThirtyTwoBytesZZ), "LDKC2Tuple_ThirtyTwoBytesCOption_ThirtyTwoBytesZZ");
18458         *ret_conv = C2Tuple_ThirtyTwoBytesCOption_ThirtyTwoBytesZZ_clone(arg);
18459         return tag_ptr(ret_conv, true);
18460 }
18461 int64_t  __attribute__((export_name("TS_C2Tuple_ThirtyTwoBytesCOption_ThirtyTwoBytesZZ_clone_ptr"))) TS_C2Tuple_ThirtyTwoBytesCOption_ThirtyTwoBytesZZ_clone_ptr(uint64_t arg) {
18462         LDKC2Tuple_ThirtyTwoBytesCOption_ThirtyTwoBytesZZ* arg_conv = (LDKC2Tuple_ThirtyTwoBytesCOption_ThirtyTwoBytesZZ*)untag_ptr(arg);
18463         int64_t ret_conv = C2Tuple_ThirtyTwoBytesCOption_ThirtyTwoBytesZZ_clone_ptr(arg_conv);
18464         return ret_conv;
18465 }
18466
18467 uint64_t  __attribute__((export_name("TS_C2Tuple_ThirtyTwoBytesCOption_ThirtyTwoBytesZZ_clone"))) TS_C2Tuple_ThirtyTwoBytesCOption_ThirtyTwoBytesZZ_clone(uint64_t orig) {
18468         LDKC2Tuple_ThirtyTwoBytesCOption_ThirtyTwoBytesZZ* orig_conv = (LDKC2Tuple_ThirtyTwoBytesCOption_ThirtyTwoBytesZZ*)untag_ptr(orig);
18469         LDKC2Tuple_ThirtyTwoBytesCOption_ThirtyTwoBytesZZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_ThirtyTwoBytesCOption_ThirtyTwoBytesZZ), "LDKC2Tuple_ThirtyTwoBytesCOption_ThirtyTwoBytesZZ");
18470         *ret_conv = C2Tuple_ThirtyTwoBytesCOption_ThirtyTwoBytesZZ_clone(orig_conv);
18471         return tag_ptr(ret_conv, true);
18472 }
18473
18474 uint64_t  __attribute__((export_name("TS_C2Tuple_ThirtyTwoBytesCOption_ThirtyTwoBytesZZ_new"))) TS_C2Tuple_ThirtyTwoBytesCOption_ThirtyTwoBytesZZ_new(int8_tArray a, uint64_t b) {
18475         LDKThirtyTwoBytes a_ref;
18476         CHECK(a->arr_len == 32);
18477         memcpy(a_ref.data, a->elems, 32); FREE(a);
18478         void* b_ptr = untag_ptr(b);
18479         CHECK_ACCESS(b_ptr);
18480         LDKCOption_ThirtyTwoBytesZ b_conv = *(LDKCOption_ThirtyTwoBytesZ*)(b_ptr);
18481         b_conv = COption_ThirtyTwoBytesZ_clone((LDKCOption_ThirtyTwoBytesZ*)untag_ptr(b));
18482         LDKC2Tuple_ThirtyTwoBytesCOption_ThirtyTwoBytesZZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_ThirtyTwoBytesCOption_ThirtyTwoBytesZZ), "LDKC2Tuple_ThirtyTwoBytesCOption_ThirtyTwoBytesZZ");
18483         *ret_conv = C2Tuple_ThirtyTwoBytesCOption_ThirtyTwoBytesZZ_new(a_ref, b_conv);
18484         return tag_ptr(ret_conv, true);
18485 }
18486
18487 void  __attribute__((export_name("TS_C2Tuple_ThirtyTwoBytesCOption_ThirtyTwoBytesZZ_free"))) TS_C2Tuple_ThirtyTwoBytesCOption_ThirtyTwoBytesZZ_free(uint64_t _res) {
18488         if (!ptr_is_owned(_res)) return;
18489         void* _res_ptr = untag_ptr(_res);
18490         CHECK_ACCESS(_res_ptr);
18491         LDKC2Tuple_ThirtyTwoBytesCOption_ThirtyTwoBytesZZ _res_conv = *(LDKC2Tuple_ThirtyTwoBytesCOption_ThirtyTwoBytesZZ*)(_res_ptr);
18492         FREE(untag_ptr(_res));
18493         C2Tuple_ThirtyTwoBytesCOption_ThirtyTwoBytesZZ_free(_res_conv);
18494 }
18495
18496 void  __attribute__((export_name("TS_CVec_C2Tuple_ThirtyTwoBytesCOption_ThirtyTwoBytesZZZ_free"))) TS_CVec_C2Tuple_ThirtyTwoBytesCOption_ThirtyTwoBytesZZZ_free(uint64_tArray _res) {
18497         LDKCVec_C2Tuple_ThirtyTwoBytesCOption_ThirtyTwoBytesZZZ _res_constr;
18498         _res_constr.datalen = _res->arr_len;
18499         if (_res_constr.datalen > 0)
18500                 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKC2Tuple_ThirtyTwoBytesCOption_ThirtyTwoBytesZZ), "LDKCVec_C2Tuple_ThirtyTwoBytesCOption_ThirtyTwoBytesZZZ Elements");
18501         else
18502                 _res_constr.data = NULL;
18503         uint64_t* _res_vals = _res->elems;
18504         for (size_t x = 0; x < _res_constr.datalen; x++) {
18505                 uint64_t _res_conv_49 = _res_vals[x];
18506                 void* _res_conv_49_ptr = untag_ptr(_res_conv_49);
18507                 CHECK_ACCESS(_res_conv_49_ptr);
18508                 LDKC2Tuple_ThirtyTwoBytesCOption_ThirtyTwoBytesZZ _res_conv_49_conv = *(LDKC2Tuple_ThirtyTwoBytesCOption_ThirtyTwoBytesZZ*)(_res_conv_49_ptr);
18509                 FREE(untag_ptr(_res_conv_49));
18510                 _res_constr.data[x] = _res_conv_49_conv;
18511         }
18512         FREE(_res);
18513         CVec_C2Tuple_ThirtyTwoBytesCOption_ThirtyTwoBytesZZZ_free(_res_constr);
18514 }
18515
18516 uint64_t  __attribute__((export_name("TS_CResult_ChannelMonitorUpdateStatusNoneZ_ok"))) TS_CResult_ChannelMonitorUpdateStatusNoneZ_ok(uint32_t o) {
18517         LDKChannelMonitorUpdateStatus o_conv = LDKChannelMonitorUpdateStatus_from_js(o);
18518         LDKCResult_ChannelMonitorUpdateStatusNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelMonitorUpdateStatusNoneZ), "LDKCResult_ChannelMonitorUpdateStatusNoneZ");
18519         *ret_conv = CResult_ChannelMonitorUpdateStatusNoneZ_ok(o_conv);
18520         return tag_ptr(ret_conv, true);
18521 }
18522
18523 uint64_t  __attribute__((export_name("TS_CResult_ChannelMonitorUpdateStatusNoneZ_err"))) TS_CResult_ChannelMonitorUpdateStatusNoneZ_err() {
18524         LDKCResult_ChannelMonitorUpdateStatusNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelMonitorUpdateStatusNoneZ), "LDKCResult_ChannelMonitorUpdateStatusNoneZ");
18525         *ret_conv = CResult_ChannelMonitorUpdateStatusNoneZ_err();
18526         return tag_ptr(ret_conv, true);
18527 }
18528
18529 jboolean  __attribute__((export_name("TS_CResult_ChannelMonitorUpdateStatusNoneZ_is_ok"))) TS_CResult_ChannelMonitorUpdateStatusNoneZ_is_ok(uint64_t o) {
18530         LDKCResult_ChannelMonitorUpdateStatusNoneZ* o_conv = (LDKCResult_ChannelMonitorUpdateStatusNoneZ*)untag_ptr(o);
18531         jboolean ret_conv = CResult_ChannelMonitorUpdateStatusNoneZ_is_ok(o_conv);
18532         return ret_conv;
18533 }
18534
18535 void  __attribute__((export_name("TS_CResult_ChannelMonitorUpdateStatusNoneZ_free"))) TS_CResult_ChannelMonitorUpdateStatusNoneZ_free(uint64_t _res) {
18536         if (!ptr_is_owned(_res)) return;
18537         void* _res_ptr = untag_ptr(_res);
18538         CHECK_ACCESS(_res_ptr);
18539         LDKCResult_ChannelMonitorUpdateStatusNoneZ _res_conv = *(LDKCResult_ChannelMonitorUpdateStatusNoneZ*)(_res_ptr);
18540         FREE(untag_ptr(_res));
18541         CResult_ChannelMonitorUpdateStatusNoneZ_free(_res_conv);
18542 }
18543
18544 static inline uint64_t CResult_ChannelMonitorUpdateStatusNoneZ_clone_ptr(LDKCResult_ChannelMonitorUpdateStatusNoneZ *NONNULL_PTR arg) {
18545         LDKCResult_ChannelMonitorUpdateStatusNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelMonitorUpdateStatusNoneZ), "LDKCResult_ChannelMonitorUpdateStatusNoneZ");
18546         *ret_conv = CResult_ChannelMonitorUpdateStatusNoneZ_clone(arg);
18547         return tag_ptr(ret_conv, true);
18548 }
18549 int64_t  __attribute__((export_name("TS_CResult_ChannelMonitorUpdateStatusNoneZ_clone_ptr"))) TS_CResult_ChannelMonitorUpdateStatusNoneZ_clone_ptr(uint64_t arg) {
18550         LDKCResult_ChannelMonitorUpdateStatusNoneZ* arg_conv = (LDKCResult_ChannelMonitorUpdateStatusNoneZ*)untag_ptr(arg);
18551         int64_t ret_conv = CResult_ChannelMonitorUpdateStatusNoneZ_clone_ptr(arg_conv);
18552         return ret_conv;
18553 }
18554
18555 uint64_t  __attribute__((export_name("TS_CResult_ChannelMonitorUpdateStatusNoneZ_clone"))) TS_CResult_ChannelMonitorUpdateStatusNoneZ_clone(uint64_t orig) {
18556         LDKCResult_ChannelMonitorUpdateStatusNoneZ* orig_conv = (LDKCResult_ChannelMonitorUpdateStatusNoneZ*)untag_ptr(orig);
18557         LDKCResult_ChannelMonitorUpdateStatusNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelMonitorUpdateStatusNoneZ), "LDKCResult_ChannelMonitorUpdateStatusNoneZ");
18558         *ret_conv = CResult_ChannelMonitorUpdateStatusNoneZ_clone(orig_conv);
18559         return tag_ptr(ret_conv, true);
18560 }
18561
18562 void  __attribute__((export_name("TS_CVec_MonitorEventZ_free"))) TS_CVec_MonitorEventZ_free(uint64_tArray _res) {
18563         LDKCVec_MonitorEventZ _res_constr;
18564         _res_constr.datalen = _res->arr_len;
18565         if (_res_constr.datalen > 0)
18566                 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKMonitorEvent), "LDKCVec_MonitorEventZ Elements");
18567         else
18568                 _res_constr.data = NULL;
18569         uint64_t* _res_vals = _res->elems;
18570         for (size_t o = 0; o < _res_constr.datalen; o++) {
18571                 uint64_t _res_conv_14 = _res_vals[o];
18572                 void* _res_conv_14_ptr = untag_ptr(_res_conv_14);
18573                 CHECK_ACCESS(_res_conv_14_ptr);
18574                 LDKMonitorEvent _res_conv_14_conv = *(LDKMonitorEvent*)(_res_conv_14_ptr);
18575                 FREE(untag_ptr(_res_conv_14));
18576                 _res_constr.data[o] = _res_conv_14_conv;
18577         }
18578         FREE(_res);
18579         CVec_MonitorEventZ_free(_res_constr);
18580 }
18581
18582 static inline uint64_t C3Tuple_OutPointCVec_MonitorEventZPublicKeyZ_clone_ptr(LDKC3Tuple_OutPointCVec_MonitorEventZPublicKeyZ *NONNULL_PTR arg) {
18583         LDKC3Tuple_OutPointCVec_MonitorEventZPublicKeyZ* ret_conv = MALLOC(sizeof(LDKC3Tuple_OutPointCVec_MonitorEventZPublicKeyZ), "LDKC3Tuple_OutPointCVec_MonitorEventZPublicKeyZ");
18584         *ret_conv = C3Tuple_OutPointCVec_MonitorEventZPublicKeyZ_clone(arg);
18585         return tag_ptr(ret_conv, true);
18586 }
18587 int64_t  __attribute__((export_name("TS_C3Tuple_OutPointCVec_MonitorEventZPublicKeyZ_clone_ptr"))) TS_C3Tuple_OutPointCVec_MonitorEventZPublicKeyZ_clone_ptr(uint64_t arg) {
18588         LDKC3Tuple_OutPointCVec_MonitorEventZPublicKeyZ* arg_conv = (LDKC3Tuple_OutPointCVec_MonitorEventZPublicKeyZ*)untag_ptr(arg);
18589         int64_t ret_conv = C3Tuple_OutPointCVec_MonitorEventZPublicKeyZ_clone_ptr(arg_conv);
18590         return ret_conv;
18591 }
18592
18593 uint64_t  __attribute__((export_name("TS_C3Tuple_OutPointCVec_MonitorEventZPublicKeyZ_clone"))) TS_C3Tuple_OutPointCVec_MonitorEventZPublicKeyZ_clone(uint64_t orig) {
18594         LDKC3Tuple_OutPointCVec_MonitorEventZPublicKeyZ* orig_conv = (LDKC3Tuple_OutPointCVec_MonitorEventZPublicKeyZ*)untag_ptr(orig);
18595         LDKC3Tuple_OutPointCVec_MonitorEventZPublicKeyZ* ret_conv = MALLOC(sizeof(LDKC3Tuple_OutPointCVec_MonitorEventZPublicKeyZ), "LDKC3Tuple_OutPointCVec_MonitorEventZPublicKeyZ");
18596         *ret_conv = C3Tuple_OutPointCVec_MonitorEventZPublicKeyZ_clone(orig_conv);
18597         return tag_ptr(ret_conv, true);
18598 }
18599
18600 uint64_t  __attribute__((export_name("TS_C3Tuple_OutPointCVec_MonitorEventZPublicKeyZ_new"))) TS_C3Tuple_OutPointCVec_MonitorEventZPublicKeyZ_new(uint64_t a, uint64_tArray b, int8_tArray c) {
18601         LDKOutPoint a_conv;
18602         a_conv.inner = untag_ptr(a);
18603         a_conv.is_owned = ptr_is_owned(a);
18604         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
18605         a_conv = OutPoint_clone(&a_conv);
18606         LDKCVec_MonitorEventZ b_constr;
18607         b_constr.datalen = b->arr_len;
18608         if (b_constr.datalen > 0)
18609                 b_constr.data = MALLOC(b_constr.datalen * sizeof(LDKMonitorEvent), "LDKCVec_MonitorEventZ Elements");
18610         else
18611                 b_constr.data = NULL;
18612         uint64_t* b_vals = b->elems;
18613         for (size_t o = 0; o < b_constr.datalen; o++) {
18614                 uint64_t b_conv_14 = b_vals[o];
18615                 void* b_conv_14_ptr = untag_ptr(b_conv_14);
18616                 CHECK_ACCESS(b_conv_14_ptr);
18617                 LDKMonitorEvent b_conv_14_conv = *(LDKMonitorEvent*)(b_conv_14_ptr);
18618                 b_conv_14_conv = MonitorEvent_clone((LDKMonitorEvent*)untag_ptr(b_conv_14));
18619                 b_constr.data[o] = b_conv_14_conv;
18620         }
18621         FREE(b);
18622         LDKPublicKey c_ref;
18623         CHECK(c->arr_len == 33);
18624         memcpy(c_ref.compressed_form, c->elems, 33); FREE(c);
18625         LDKC3Tuple_OutPointCVec_MonitorEventZPublicKeyZ* ret_conv = MALLOC(sizeof(LDKC3Tuple_OutPointCVec_MonitorEventZPublicKeyZ), "LDKC3Tuple_OutPointCVec_MonitorEventZPublicKeyZ");
18626         *ret_conv = C3Tuple_OutPointCVec_MonitorEventZPublicKeyZ_new(a_conv, b_constr, c_ref);
18627         return tag_ptr(ret_conv, true);
18628 }
18629
18630 void  __attribute__((export_name("TS_C3Tuple_OutPointCVec_MonitorEventZPublicKeyZ_free"))) TS_C3Tuple_OutPointCVec_MonitorEventZPublicKeyZ_free(uint64_t _res) {
18631         if (!ptr_is_owned(_res)) return;
18632         void* _res_ptr = untag_ptr(_res);
18633         CHECK_ACCESS(_res_ptr);
18634         LDKC3Tuple_OutPointCVec_MonitorEventZPublicKeyZ _res_conv = *(LDKC3Tuple_OutPointCVec_MonitorEventZPublicKeyZ*)(_res_ptr);
18635         FREE(untag_ptr(_res));
18636         C3Tuple_OutPointCVec_MonitorEventZPublicKeyZ_free(_res_conv);
18637 }
18638
18639 void  __attribute__((export_name("TS_CVec_C3Tuple_OutPointCVec_MonitorEventZPublicKeyZZ_free"))) TS_CVec_C3Tuple_OutPointCVec_MonitorEventZPublicKeyZZ_free(uint64_tArray _res) {
18640         LDKCVec_C3Tuple_OutPointCVec_MonitorEventZPublicKeyZZ _res_constr;
18641         _res_constr.datalen = _res->arr_len;
18642         if (_res_constr.datalen > 0)
18643                 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKC3Tuple_OutPointCVec_MonitorEventZPublicKeyZ), "LDKCVec_C3Tuple_OutPointCVec_MonitorEventZPublicKeyZZ Elements");
18644         else
18645                 _res_constr.data = NULL;
18646         uint64_t* _res_vals = _res->elems;
18647         for (size_t x = 0; x < _res_constr.datalen; x++) {
18648                 uint64_t _res_conv_49 = _res_vals[x];
18649                 void* _res_conv_49_ptr = untag_ptr(_res_conv_49);
18650                 CHECK_ACCESS(_res_conv_49_ptr);
18651                 LDKC3Tuple_OutPointCVec_MonitorEventZPublicKeyZ _res_conv_49_conv = *(LDKC3Tuple_OutPointCVec_MonitorEventZPublicKeyZ*)(_res_conv_49_ptr);
18652                 FREE(untag_ptr(_res_conv_49));
18653                 _res_constr.data[x] = _res_conv_49_conv;
18654         }
18655         FREE(_res);
18656         CVec_C3Tuple_OutPointCVec_MonitorEventZPublicKeyZZ_free(_res_constr);
18657 }
18658
18659 uint64_t  __attribute__((export_name("TS_CResult_InitFeaturesDecodeErrorZ_ok"))) TS_CResult_InitFeaturesDecodeErrorZ_ok(uint64_t o) {
18660         LDKInitFeatures o_conv;
18661         o_conv.inner = untag_ptr(o);
18662         o_conv.is_owned = ptr_is_owned(o);
18663         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
18664         o_conv = InitFeatures_clone(&o_conv);
18665         LDKCResult_InitFeaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InitFeaturesDecodeErrorZ), "LDKCResult_InitFeaturesDecodeErrorZ");
18666         *ret_conv = CResult_InitFeaturesDecodeErrorZ_ok(o_conv);
18667         return tag_ptr(ret_conv, true);
18668 }
18669
18670 uint64_t  __attribute__((export_name("TS_CResult_InitFeaturesDecodeErrorZ_err"))) TS_CResult_InitFeaturesDecodeErrorZ_err(uint64_t e) {
18671         void* e_ptr = untag_ptr(e);
18672         CHECK_ACCESS(e_ptr);
18673         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
18674         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
18675         LDKCResult_InitFeaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InitFeaturesDecodeErrorZ), "LDKCResult_InitFeaturesDecodeErrorZ");
18676         *ret_conv = CResult_InitFeaturesDecodeErrorZ_err(e_conv);
18677         return tag_ptr(ret_conv, true);
18678 }
18679
18680 jboolean  __attribute__((export_name("TS_CResult_InitFeaturesDecodeErrorZ_is_ok"))) TS_CResult_InitFeaturesDecodeErrorZ_is_ok(uint64_t o) {
18681         LDKCResult_InitFeaturesDecodeErrorZ* o_conv = (LDKCResult_InitFeaturesDecodeErrorZ*)untag_ptr(o);
18682         jboolean ret_conv = CResult_InitFeaturesDecodeErrorZ_is_ok(o_conv);
18683         return ret_conv;
18684 }
18685
18686 void  __attribute__((export_name("TS_CResult_InitFeaturesDecodeErrorZ_free"))) TS_CResult_InitFeaturesDecodeErrorZ_free(uint64_t _res) {
18687         if (!ptr_is_owned(_res)) return;
18688         void* _res_ptr = untag_ptr(_res);
18689         CHECK_ACCESS(_res_ptr);
18690         LDKCResult_InitFeaturesDecodeErrorZ _res_conv = *(LDKCResult_InitFeaturesDecodeErrorZ*)(_res_ptr);
18691         FREE(untag_ptr(_res));
18692         CResult_InitFeaturesDecodeErrorZ_free(_res_conv);
18693 }
18694
18695 static inline uint64_t CResult_InitFeaturesDecodeErrorZ_clone_ptr(LDKCResult_InitFeaturesDecodeErrorZ *NONNULL_PTR arg) {
18696         LDKCResult_InitFeaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InitFeaturesDecodeErrorZ), "LDKCResult_InitFeaturesDecodeErrorZ");
18697         *ret_conv = CResult_InitFeaturesDecodeErrorZ_clone(arg);
18698         return tag_ptr(ret_conv, true);
18699 }
18700 int64_t  __attribute__((export_name("TS_CResult_InitFeaturesDecodeErrorZ_clone_ptr"))) TS_CResult_InitFeaturesDecodeErrorZ_clone_ptr(uint64_t arg) {
18701         LDKCResult_InitFeaturesDecodeErrorZ* arg_conv = (LDKCResult_InitFeaturesDecodeErrorZ*)untag_ptr(arg);
18702         int64_t ret_conv = CResult_InitFeaturesDecodeErrorZ_clone_ptr(arg_conv);
18703         return ret_conv;
18704 }
18705
18706 uint64_t  __attribute__((export_name("TS_CResult_InitFeaturesDecodeErrorZ_clone"))) TS_CResult_InitFeaturesDecodeErrorZ_clone(uint64_t orig) {
18707         LDKCResult_InitFeaturesDecodeErrorZ* orig_conv = (LDKCResult_InitFeaturesDecodeErrorZ*)untag_ptr(orig);
18708         LDKCResult_InitFeaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InitFeaturesDecodeErrorZ), "LDKCResult_InitFeaturesDecodeErrorZ");
18709         *ret_conv = CResult_InitFeaturesDecodeErrorZ_clone(orig_conv);
18710         return tag_ptr(ret_conv, true);
18711 }
18712
18713 uint64_t  __attribute__((export_name("TS_CResult_ChannelFeaturesDecodeErrorZ_ok"))) TS_CResult_ChannelFeaturesDecodeErrorZ_ok(uint64_t o) {
18714         LDKChannelFeatures o_conv;
18715         o_conv.inner = untag_ptr(o);
18716         o_conv.is_owned = ptr_is_owned(o);
18717         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
18718         o_conv = ChannelFeatures_clone(&o_conv);
18719         LDKCResult_ChannelFeaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelFeaturesDecodeErrorZ), "LDKCResult_ChannelFeaturesDecodeErrorZ");
18720         *ret_conv = CResult_ChannelFeaturesDecodeErrorZ_ok(o_conv);
18721         return tag_ptr(ret_conv, true);
18722 }
18723
18724 uint64_t  __attribute__((export_name("TS_CResult_ChannelFeaturesDecodeErrorZ_err"))) TS_CResult_ChannelFeaturesDecodeErrorZ_err(uint64_t e) {
18725         void* e_ptr = untag_ptr(e);
18726         CHECK_ACCESS(e_ptr);
18727         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
18728         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
18729         LDKCResult_ChannelFeaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelFeaturesDecodeErrorZ), "LDKCResult_ChannelFeaturesDecodeErrorZ");
18730         *ret_conv = CResult_ChannelFeaturesDecodeErrorZ_err(e_conv);
18731         return tag_ptr(ret_conv, true);
18732 }
18733
18734 jboolean  __attribute__((export_name("TS_CResult_ChannelFeaturesDecodeErrorZ_is_ok"))) TS_CResult_ChannelFeaturesDecodeErrorZ_is_ok(uint64_t o) {
18735         LDKCResult_ChannelFeaturesDecodeErrorZ* o_conv = (LDKCResult_ChannelFeaturesDecodeErrorZ*)untag_ptr(o);
18736         jboolean ret_conv = CResult_ChannelFeaturesDecodeErrorZ_is_ok(o_conv);
18737         return ret_conv;
18738 }
18739
18740 void  __attribute__((export_name("TS_CResult_ChannelFeaturesDecodeErrorZ_free"))) TS_CResult_ChannelFeaturesDecodeErrorZ_free(uint64_t _res) {
18741         if (!ptr_is_owned(_res)) return;
18742         void* _res_ptr = untag_ptr(_res);
18743         CHECK_ACCESS(_res_ptr);
18744         LDKCResult_ChannelFeaturesDecodeErrorZ _res_conv = *(LDKCResult_ChannelFeaturesDecodeErrorZ*)(_res_ptr);
18745         FREE(untag_ptr(_res));
18746         CResult_ChannelFeaturesDecodeErrorZ_free(_res_conv);
18747 }
18748
18749 static inline uint64_t CResult_ChannelFeaturesDecodeErrorZ_clone_ptr(LDKCResult_ChannelFeaturesDecodeErrorZ *NONNULL_PTR arg) {
18750         LDKCResult_ChannelFeaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelFeaturesDecodeErrorZ), "LDKCResult_ChannelFeaturesDecodeErrorZ");
18751         *ret_conv = CResult_ChannelFeaturesDecodeErrorZ_clone(arg);
18752         return tag_ptr(ret_conv, true);
18753 }
18754 int64_t  __attribute__((export_name("TS_CResult_ChannelFeaturesDecodeErrorZ_clone_ptr"))) TS_CResult_ChannelFeaturesDecodeErrorZ_clone_ptr(uint64_t arg) {
18755         LDKCResult_ChannelFeaturesDecodeErrorZ* arg_conv = (LDKCResult_ChannelFeaturesDecodeErrorZ*)untag_ptr(arg);
18756         int64_t ret_conv = CResult_ChannelFeaturesDecodeErrorZ_clone_ptr(arg_conv);
18757         return ret_conv;
18758 }
18759
18760 uint64_t  __attribute__((export_name("TS_CResult_ChannelFeaturesDecodeErrorZ_clone"))) TS_CResult_ChannelFeaturesDecodeErrorZ_clone(uint64_t orig) {
18761         LDKCResult_ChannelFeaturesDecodeErrorZ* orig_conv = (LDKCResult_ChannelFeaturesDecodeErrorZ*)untag_ptr(orig);
18762         LDKCResult_ChannelFeaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelFeaturesDecodeErrorZ), "LDKCResult_ChannelFeaturesDecodeErrorZ");
18763         *ret_conv = CResult_ChannelFeaturesDecodeErrorZ_clone(orig_conv);
18764         return tag_ptr(ret_conv, true);
18765 }
18766
18767 uint64_t  __attribute__((export_name("TS_CResult_NodeFeaturesDecodeErrorZ_ok"))) TS_CResult_NodeFeaturesDecodeErrorZ_ok(uint64_t o) {
18768         LDKNodeFeatures o_conv;
18769         o_conv.inner = untag_ptr(o);
18770         o_conv.is_owned = ptr_is_owned(o);
18771         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
18772         o_conv = NodeFeatures_clone(&o_conv);
18773         LDKCResult_NodeFeaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NodeFeaturesDecodeErrorZ), "LDKCResult_NodeFeaturesDecodeErrorZ");
18774         *ret_conv = CResult_NodeFeaturesDecodeErrorZ_ok(o_conv);
18775         return tag_ptr(ret_conv, true);
18776 }
18777
18778 uint64_t  __attribute__((export_name("TS_CResult_NodeFeaturesDecodeErrorZ_err"))) TS_CResult_NodeFeaturesDecodeErrorZ_err(uint64_t e) {
18779         void* e_ptr = untag_ptr(e);
18780         CHECK_ACCESS(e_ptr);
18781         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
18782         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
18783         LDKCResult_NodeFeaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NodeFeaturesDecodeErrorZ), "LDKCResult_NodeFeaturesDecodeErrorZ");
18784         *ret_conv = CResult_NodeFeaturesDecodeErrorZ_err(e_conv);
18785         return tag_ptr(ret_conv, true);
18786 }
18787
18788 jboolean  __attribute__((export_name("TS_CResult_NodeFeaturesDecodeErrorZ_is_ok"))) TS_CResult_NodeFeaturesDecodeErrorZ_is_ok(uint64_t o) {
18789         LDKCResult_NodeFeaturesDecodeErrorZ* o_conv = (LDKCResult_NodeFeaturesDecodeErrorZ*)untag_ptr(o);
18790         jboolean ret_conv = CResult_NodeFeaturesDecodeErrorZ_is_ok(o_conv);
18791         return ret_conv;
18792 }
18793
18794 void  __attribute__((export_name("TS_CResult_NodeFeaturesDecodeErrorZ_free"))) TS_CResult_NodeFeaturesDecodeErrorZ_free(uint64_t _res) {
18795         if (!ptr_is_owned(_res)) return;
18796         void* _res_ptr = untag_ptr(_res);
18797         CHECK_ACCESS(_res_ptr);
18798         LDKCResult_NodeFeaturesDecodeErrorZ _res_conv = *(LDKCResult_NodeFeaturesDecodeErrorZ*)(_res_ptr);
18799         FREE(untag_ptr(_res));
18800         CResult_NodeFeaturesDecodeErrorZ_free(_res_conv);
18801 }
18802
18803 static inline uint64_t CResult_NodeFeaturesDecodeErrorZ_clone_ptr(LDKCResult_NodeFeaturesDecodeErrorZ *NONNULL_PTR arg) {
18804         LDKCResult_NodeFeaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NodeFeaturesDecodeErrorZ), "LDKCResult_NodeFeaturesDecodeErrorZ");
18805         *ret_conv = CResult_NodeFeaturesDecodeErrorZ_clone(arg);
18806         return tag_ptr(ret_conv, true);
18807 }
18808 int64_t  __attribute__((export_name("TS_CResult_NodeFeaturesDecodeErrorZ_clone_ptr"))) TS_CResult_NodeFeaturesDecodeErrorZ_clone_ptr(uint64_t arg) {
18809         LDKCResult_NodeFeaturesDecodeErrorZ* arg_conv = (LDKCResult_NodeFeaturesDecodeErrorZ*)untag_ptr(arg);
18810         int64_t ret_conv = CResult_NodeFeaturesDecodeErrorZ_clone_ptr(arg_conv);
18811         return ret_conv;
18812 }
18813
18814 uint64_t  __attribute__((export_name("TS_CResult_NodeFeaturesDecodeErrorZ_clone"))) TS_CResult_NodeFeaturesDecodeErrorZ_clone(uint64_t orig) {
18815         LDKCResult_NodeFeaturesDecodeErrorZ* orig_conv = (LDKCResult_NodeFeaturesDecodeErrorZ*)untag_ptr(orig);
18816         LDKCResult_NodeFeaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NodeFeaturesDecodeErrorZ), "LDKCResult_NodeFeaturesDecodeErrorZ");
18817         *ret_conv = CResult_NodeFeaturesDecodeErrorZ_clone(orig_conv);
18818         return tag_ptr(ret_conv, true);
18819 }
18820
18821 uint64_t  __attribute__((export_name("TS_CResult_Bolt11InvoiceFeaturesDecodeErrorZ_ok"))) TS_CResult_Bolt11InvoiceFeaturesDecodeErrorZ_ok(uint64_t o) {
18822         LDKBolt11InvoiceFeatures o_conv;
18823         o_conv.inner = untag_ptr(o);
18824         o_conv.is_owned = ptr_is_owned(o);
18825         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
18826         o_conv = Bolt11InvoiceFeatures_clone(&o_conv);
18827         LDKCResult_Bolt11InvoiceFeaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_Bolt11InvoiceFeaturesDecodeErrorZ), "LDKCResult_Bolt11InvoiceFeaturesDecodeErrorZ");
18828         *ret_conv = CResult_Bolt11InvoiceFeaturesDecodeErrorZ_ok(o_conv);
18829         return tag_ptr(ret_conv, true);
18830 }
18831
18832 uint64_t  __attribute__((export_name("TS_CResult_Bolt11InvoiceFeaturesDecodeErrorZ_err"))) TS_CResult_Bolt11InvoiceFeaturesDecodeErrorZ_err(uint64_t e) {
18833         void* e_ptr = untag_ptr(e);
18834         CHECK_ACCESS(e_ptr);
18835         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
18836         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
18837         LDKCResult_Bolt11InvoiceFeaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_Bolt11InvoiceFeaturesDecodeErrorZ), "LDKCResult_Bolt11InvoiceFeaturesDecodeErrorZ");
18838         *ret_conv = CResult_Bolt11InvoiceFeaturesDecodeErrorZ_err(e_conv);
18839         return tag_ptr(ret_conv, true);
18840 }
18841
18842 jboolean  __attribute__((export_name("TS_CResult_Bolt11InvoiceFeaturesDecodeErrorZ_is_ok"))) TS_CResult_Bolt11InvoiceFeaturesDecodeErrorZ_is_ok(uint64_t o) {
18843         LDKCResult_Bolt11InvoiceFeaturesDecodeErrorZ* o_conv = (LDKCResult_Bolt11InvoiceFeaturesDecodeErrorZ*)untag_ptr(o);
18844         jboolean ret_conv = CResult_Bolt11InvoiceFeaturesDecodeErrorZ_is_ok(o_conv);
18845         return ret_conv;
18846 }
18847
18848 void  __attribute__((export_name("TS_CResult_Bolt11InvoiceFeaturesDecodeErrorZ_free"))) TS_CResult_Bolt11InvoiceFeaturesDecodeErrorZ_free(uint64_t _res) {
18849         if (!ptr_is_owned(_res)) return;
18850         void* _res_ptr = untag_ptr(_res);
18851         CHECK_ACCESS(_res_ptr);
18852         LDKCResult_Bolt11InvoiceFeaturesDecodeErrorZ _res_conv = *(LDKCResult_Bolt11InvoiceFeaturesDecodeErrorZ*)(_res_ptr);
18853         FREE(untag_ptr(_res));
18854         CResult_Bolt11InvoiceFeaturesDecodeErrorZ_free(_res_conv);
18855 }
18856
18857 static inline uint64_t CResult_Bolt11InvoiceFeaturesDecodeErrorZ_clone_ptr(LDKCResult_Bolt11InvoiceFeaturesDecodeErrorZ *NONNULL_PTR arg) {
18858         LDKCResult_Bolt11InvoiceFeaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_Bolt11InvoiceFeaturesDecodeErrorZ), "LDKCResult_Bolt11InvoiceFeaturesDecodeErrorZ");
18859         *ret_conv = CResult_Bolt11InvoiceFeaturesDecodeErrorZ_clone(arg);
18860         return tag_ptr(ret_conv, true);
18861 }
18862 int64_t  __attribute__((export_name("TS_CResult_Bolt11InvoiceFeaturesDecodeErrorZ_clone_ptr"))) TS_CResult_Bolt11InvoiceFeaturesDecodeErrorZ_clone_ptr(uint64_t arg) {
18863         LDKCResult_Bolt11InvoiceFeaturesDecodeErrorZ* arg_conv = (LDKCResult_Bolt11InvoiceFeaturesDecodeErrorZ*)untag_ptr(arg);
18864         int64_t ret_conv = CResult_Bolt11InvoiceFeaturesDecodeErrorZ_clone_ptr(arg_conv);
18865         return ret_conv;
18866 }
18867
18868 uint64_t  __attribute__((export_name("TS_CResult_Bolt11InvoiceFeaturesDecodeErrorZ_clone"))) TS_CResult_Bolt11InvoiceFeaturesDecodeErrorZ_clone(uint64_t orig) {
18869         LDKCResult_Bolt11InvoiceFeaturesDecodeErrorZ* orig_conv = (LDKCResult_Bolt11InvoiceFeaturesDecodeErrorZ*)untag_ptr(orig);
18870         LDKCResult_Bolt11InvoiceFeaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_Bolt11InvoiceFeaturesDecodeErrorZ), "LDKCResult_Bolt11InvoiceFeaturesDecodeErrorZ");
18871         *ret_conv = CResult_Bolt11InvoiceFeaturesDecodeErrorZ_clone(orig_conv);
18872         return tag_ptr(ret_conv, true);
18873 }
18874
18875 uint64_t  __attribute__((export_name("TS_CResult_Bolt12InvoiceFeaturesDecodeErrorZ_ok"))) TS_CResult_Bolt12InvoiceFeaturesDecodeErrorZ_ok(uint64_t o) {
18876         LDKBolt12InvoiceFeatures o_conv;
18877         o_conv.inner = untag_ptr(o);
18878         o_conv.is_owned = ptr_is_owned(o);
18879         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
18880         o_conv = Bolt12InvoiceFeatures_clone(&o_conv);
18881         LDKCResult_Bolt12InvoiceFeaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_Bolt12InvoiceFeaturesDecodeErrorZ), "LDKCResult_Bolt12InvoiceFeaturesDecodeErrorZ");
18882         *ret_conv = CResult_Bolt12InvoiceFeaturesDecodeErrorZ_ok(o_conv);
18883         return tag_ptr(ret_conv, true);
18884 }
18885
18886 uint64_t  __attribute__((export_name("TS_CResult_Bolt12InvoiceFeaturesDecodeErrorZ_err"))) TS_CResult_Bolt12InvoiceFeaturesDecodeErrorZ_err(uint64_t e) {
18887         void* e_ptr = untag_ptr(e);
18888         CHECK_ACCESS(e_ptr);
18889         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
18890         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
18891         LDKCResult_Bolt12InvoiceFeaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_Bolt12InvoiceFeaturesDecodeErrorZ), "LDKCResult_Bolt12InvoiceFeaturesDecodeErrorZ");
18892         *ret_conv = CResult_Bolt12InvoiceFeaturesDecodeErrorZ_err(e_conv);
18893         return tag_ptr(ret_conv, true);
18894 }
18895
18896 jboolean  __attribute__((export_name("TS_CResult_Bolt12InvoiceFeaturesDecodeErrorZ_is_ok"))) TS_CResult_Bolt12InvoiceFeaturesDecodeErrorZ_is_ok(uint64_t o) {
18897         LDKCResult_Bolt12InvoiceFeaturesDecodeErrorZ* o_conv = (LDKCResult_Bolt12InvoiceFeaturesDecodeErrorZ*)untag_ptr(o);
18898         jboolean ret_conv = CResult_Bolt12InvoiceFeaturesDecodeErrorZ_is_ok(o_conv);
18899         return ret_conv;
18900 }
18901
18902 void  __attribute__((export_name("TS_CResult_Bolt12InvoiceFeaturesDecodeErrorZ_free"))) TS_CResult_Bolt12InvoiceFeaturesDecodeErrorZ_free(uint64_t _res) {
18903         if (!ptr_is_owned(_res)) return;
18904         void* _res_ptr = untag_ptr(_res);
18905         CHECK_ACCESS(_res_ptr);
18906         LDKCResult_Bolt12InvoiceFeaturesDecodeErrorZ _res_conv = *(LDKCResult_Bolt12InvoiceFeaturesDecodeErrorZ*)(_res_ptr);
18907         FREE(untag_ptr(_res));
18908         CResult_Bolt12InvoiceFeaturesDecodeErrorZ_free(_res_conv);
18909 }
18910
18911 static inline uint64_t CResult_Bolt12InvoiceFeaturesDecodeErrorZ_clone_ptr(LDKCResult_Bolt12InvoiceFeaturesDecodeErrorZ *NONNULL_PTR arg) {
18912         LDKCResult_Bolt12InvoiceFeaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_Bolt12InvoiceFeaturesDecodeErrorZ), "LDKCResult_Bolt12InvoiceFeaturesDecodeErrorZ");
18913         *ret_conv = CResult_Bolt12InvoiceFeaturesDecodeErrorZ_clone(arg);
18914         return tag_ptr(ret_conv, true);
18915 }
18916 int64_t  __attribute__((export_name("TS_CResult_Bolt12InvoiceFeaturesDecodeErrorZ_clone_ptr"))) TS_CResult_Bolt12InvoiceFeaturesDecodeErrorZ_clone_ptr(uint64_t arg) {
18917         LDKCResult_Bolt12InvoiceFeaturesDecodeErrorZ* arg_conv = (LDKCResult_Bolt12InvoiceFeaturesDecodeErrorZ*)untag_ptr(arg);
18918         int64_t ret_conv = CResult_Bolt12InvoiceFeaturesDecodeErrorZ_clone_ptr(arg_conv);
18919         return ret_conv;
18920 }
18921
18922 uint64_t  __attribute__((export_name("TS_CResult_Bolt12InvoiceFeaturesDecodeErrorZ_clone"))) TS_CResult_Bolt12InvoiceFeaturesDecodeErrorZ_clone(uint64_t orig) {
18923         LDKCResult_Bolt12InvoiceFeaturesDecodeErrorZ* orig_conv = (LDKCResult_Bolt12InvoiceFeaturesDecodeErrorZ*)untag_ptr(orig);
18924         LDKCResult_Bolt12InvoiceFeaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_Bolt12InvoiceFeaturesDecodeErrorZ), "LDKCResult_Bolt12InvoiceFeaturesDecodeErrorZ");
18925         *ret_conv = CResult_Bolt12InvoiceFeaturesDecodeErrorZ_clone(orig_conv);
18926         return tag_ptr(ret_conv, true);
18927 }
18928
18929 uint64_t  __attribute__((export_name("TS_CResult_BlindedHopFeaturesDecodeErrorZ_ok"))) TS_CResult_BlindedHopFeaturesDecodeErrorZ_ok(uint64_t o) {
18930         LDKBlindedHopFeatures o_conv;
18931         o_conv.inner = untag_ptr(o);
18932         o_conv.is_owned = ptr_is_owned(o);
18933         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
18934         o_conv = BlindedHopFeatures_clone(&o_conv);
18935         LDKCResult_BlindedHopFeaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_BlindedHopFeaturesDecodeErrorZ), "LDKCResult_BlindedHopFeaturesDecodeErrorZ");
18936         *ret_conv = CResult_BlindedHopFeaturesDecodeErrorZ_ok(o_conv);
18937         return tag_ptr(ret_conv, true);
18938 }
18939
18940 uint64_t  __attribute__((export_name("TS_CResult_BlindedHopFeaturesDecodeErrorZ_err"))) TS_CResult_BlindedHopFeaturesDecodeErrorZ_err(uint64_t e) {
18941         void* e_ptr = untag_ptr(e);
18942         CHECK_ACCESS(e_ptr);
18943         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
18944         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
18945         LDKCResult_BlindedHopFeaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_BlindedHopFeaturesDecodeErrorZ), "LDKCResult_BlindedHopFeaturesDecodeErrorZ");
18946         *ret_conv = CResult_BlindedHopFeaturesDecodeErrorZ_err(e_conv);
18947         return tag_ptr(ret_conv, true);
18948 }
18949
18950 jboolean  __attribute__((export_name("TS_CResult_BlindedHopFeaturesDecodeErrorZ_is_ok"))) TS_CResult_BlindedHopFeaturesDecodeErrorZ_is_ok(uint64_t o) {
18951         LDKCResult_BlindedHopFeaturesDecodeErrorZ* o_conv = (LDKCResult_BlindedHopFeaturesDecodeErrorZ*)untag_ptr(o);
18952         jboolean ret_conv = CResult_BlindedHopFeaturesDecodeErrorZ_is_ok(o_conv);
18953         return ret_conv;
18954 }
18955
18956 void  __attribute__((export_name("TS_CResult_BlindedHopFeaturesDecodeErrorZ_free"))) TS_CResult_BlindedHopFeaturesDecodeErrorZ_free(uint64_t _res) {
18957         if (!ptr_is_owned(_res)) return;
18958         void* _res_ptr = untag_ptr(_res);
18959         CHECK_ACCESS(_res_ptr);
18960         LDKCResult_BlindedHopFeaturesDecodeErrorZ _res_conv = *(LDKCResult_BlindedHopFeaturesDecodeErrorZ*)(_res_ptr);
18961         FREE(untag_ptr(_res));
18962         CResult_BlindedHopFeaturesDecodeErrorZ_free(_res_conv);
18963 }
18964
18965 static inline uint64_t CResult_BlindedHopFeaturesDecodeErrorZ_clone_ptr(LDKCResult_BlindedHopFeaturesDecodeErrorZ *NONNULL_PTR arg) {
18966         LDKCResult_BlindedHopFeaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_BlindedHopFeaturesDecodeErrorZ), "LDKCResult_BlindedHopFeaturesDecodeErrorZ");
18967         *ret_conv = CResult_BlindedHopFeaturesDecodeErrorZ_clone(arg);
18968         return tag_ptr(ret_conv, true);
18969 }
18970 int64_t  __attribute__((export_name("TS_CResult_BlindedHopFeaturesDecodeErrorZ_clone_ptr"))) TS_CResult_BlindedHopFeaturesDecodeErrorZ_clone_ptr(uint64_t arg) {
18971         LDKCResult_BlindedHopFeaturesDecodeErrorZ* arg_conv = (LDKCResult_BlindedHopFeaturesDecodeErrorZ*)untag_ptr(arg);
18972         int64_t ret_conv = CResult_BlindedHopFeaturesDecodeErrorZ_clone_ptr(arg_conv);
18973         return ret_conv;
18974 }
18975
18976 uint64_t  __attribute__((export_name("TS_CResult_BlindedHopFeaturesDecodeErrorZ_clone"))) TS_CResult_BlindedHopFeaturesDecodeErrorZ_clone(uint64_t orig) {
18977         LDKCResult_BlindedHopFeaturesDecodeErrorZ* orig_conv = (LDKCResult_BlindedHopFeaturesDecodeErrorZ*)untag_ptr(orig);
18978         LDKCResult_BlindedHopFeaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_BlindedHopFeaturesDecodeErrorZ), "LDKCResult_BlindedHopFeaturesDecodeErrorZ");
18979         *ret_conv = CResult_BlindedHopFeaturesDecodeErrorZ_clone(orig_conv);
18980         return tag_ptr(ret_conv, true);
18981 }
18982
18983 uint64_t  __attribute__((export_name("TS_CResult_ChannelTypeFeaturesDecodeErrorZ_ok"))) TS_CResult_ChannelTypeFeaturesDecodeErrorZ_ok(uint64_t o) {
18984         LDKChannelTypeFeatures o_conv;
18985         o_conv.inner = untag_ptr(o);
18986         o_conv.is_owned = ptr_is_owned(o);
18987         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
18988         o_conv = ChannelTypeFeatures_clone(&o_conv);
18989         LDKCResult_ChannelTypeFeaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelTypeFeaturesDecodeErrorZ), "LDKCResult_ChannelTypeFeaturesDecodeErrorZ");
18990         *ret_conv = CResult_ChannelTypeFeaturesDecodeErrorZ_ok(o_conv);
18991         return tag_ptr(ret_conv, true);
18992 }
18993
18994 uint64_t  __attribute__((export_name("TS_CResult_ChannelTypeFeaturesDecodeErrorZ_err"))) TS_CResult_ChannelTypeFeaturesDecodeErrorZ_err(uint64_t e) {
18995         void* e_ptr = untag_ptr(e);
18996         CHECK_ACCESS(e_ptr);
18997         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
18998         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
18999         LDKCResult_ChannelTypeFeaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelTypeFeaturesDecodeErrorZ), "LDKCResult_ChannelTypeFeaturesDecodeErrorZ");
19000         *ret_conv = CResult_ChannelTypeFeaturesDecodeErrorZ_err(e_conv);
19001         return tag_ptr(ret_conv, true);
19002 }
19003
19004 jboolean  __attribute__((export_name("TS_CResult_ChannelTypeFeaturesDecodeErrorZ_is_ok"))) TS_CResult_ChannelTypeFeaturesDecodeErrorZ_is_ok(uint64_t o) {
19005         LDKCResult_ChannelTypeFeaturesDecodeErrorZ* o_conv = (LDKCResult_ChannelTypeFeaturesDecodeErrorZ*)untag_ptr(o);
19006         jboolean ret_conv = CResult_ChannelTypeFeaturesDecodeErrorZ_is_ok(o_conv);
19007         return ret_conv;
19008 }
19009
19010 void  __attribute__((export_name("TS_CResult_ChannelTypeFeaturesDecodeErrorZ_free"))) TS_CResult_ChannelTypeFeaturesDecodeErrorZ_free(uint64_t _res) {
19011         if (!ptr_is_owned(_res)) return;
19012         void* _res_ptr = untag_ptr(_res);
19013         CHECK_ACCESS(_res_ptr);
19014         LDKCResult_ChannelTypeFeaturesDecodeErrorZ _res_conv = *(LDKCResult_ChannelTypeFeaturesDecodeErrorZ*)(_res_ptr);
19015         FREE(untag_ptr(_res));
19016         CResult_ChannelTypeFeaturesDecodeErrorZ_free(_res_conv);
19017 }
19018
19019 static inline uint64_t CResult_ChannelTypeFeaturesDecodeErrorZ_clone_ptr(LDKCResult_ChannelTypeFeaturesDecodeErrorZ *NONNULL_PTR arg) {
19020         LDKCResult_ChannelTypeFeaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelTypeFeaturesDecodeErrorZ), "LDKCResult_ChannelTypeFeaturesDecodeErrorZ");
19021         *ret_conv = CResult_ChannelTypeFeaturesDecodeErrorZ_clone(arg);
19022         return tag_ptr(ret_conv, true);
19023 }
19024 int64_t  __attribute__((export_name("TS_CResult_ChannelTypeFeaturesDecodeErrorZ_clone_ptr"))) TS_CResult_ChannelTypeFeaturesDecodeErrorZ_clone_ptr(uint64_t arg) {
19025         LDKCResult_ChannelTypeFeaturesDecodeErrorZ* arg_conv = (LDKCResult_ChannelTypeFeaturesDecodeErrorZ*)untag_ptr(arg);
19026         int64_t ret_conv = CResult_ChannelTypeFeaturesDecodeErrorZ_clone_ptr(arg_conv);
19027         return ret_conv;
19028 }
19029
19030 uint64_t  __attribute__((export_name("TS_CResult_ChannelTypeFeaturesDecodeErrorZ_clone"))) TS_CResult_ChannelTypeFeaturesDecodeErrorZ_clone(uint64_t orig) {
19031         LDKCResult_ChannelTypeFeaturesDecodeErrorZ* orig_conv = (LDKCResult_ChannelTypeFeaturesDecodeErrorZ*)untag_ptr(orig);
19032         LDKCResult_ChannelTypeFeaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelTypeFeaturesDecodeErrorZ), "LDKCResult_ChannelTypeFeaturesDecodeErrorZ");
19033         *ret_conv = CResult_ChannelTypeFeaturesDecodeErrorZ_clone(orig_conv);
19034         return tag_ptr(ret_conv, true);
19035 }
19036
19037 uint64_t  __attribute__((export_name("TS_CResult_OfferBolt12ParseErrorZ_ok"))) TS_CResult_OfferBolt12ParseErrorZ_ok(uint64_t o) {
19038         LDKOffer o_conv;
19039         o_conv.inner = untag_ptr(o);
19040         o_conv.is_owned = ptr_is_owned(o);
19041         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
19042         o_conv = Offer_clone(&o_conv);
19043         LDKCResult_OfferBolt12ParseErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_OfferBolt12ParseErrorZ), "LDKCResult_OfferBolt12ParseErrorZ");
19044         *ret_conv = CResult_OfferBolt12ParseErrorZ_ok(o_conv);
19045         return tag_ptr(ret_conv, true);
19046 }
19047
19048 uint64_t  __attribute__((export_name("TS_CResult_OfferBolt12ParseErrorZ_err"))) TS_CResult_OfferBolt12ParseErrorZ_err(uint64_t e) {
19049         LDKBolt12ParseError e_conv;
19050         e_conv.inner = untag_ptr(e);
19051         e_conv.is_owned = ptr_is_owned(e);
19052         CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
19053         e_conv = Bolt12ParseError_clone(&e_conv);
19054         LDKCResult_OfferBolt12ParseErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_OfferBolt12ParseErrorZ), "LDKCResult_OfferBolt12ParseErrorZ");
19055         *ret_conv = CResult_OfferBolt12ParseErrorZ_err(e_conv);
19056         return tag_ptr(ret_conv, true);
19057 }
19058
19059 jboolean  __attribute__((export_name("TS_CResult_OfferBolt12ParseErrorZ_is_ok"))) TS_CResult_OfferBolt12ParseErrorZ_is_ok(uint64_t o) {
19060         LDKCResult_OfferBolt12ParseErrorZ* o_conv = (LDKCResult_OfferBolt12ParseErrorZ*)untag_ptr(o);
19061         jboolean ret_conv = CResult_OfferBolt12ParseErrorZ_is_ok(o_conv);
19062         return ret_conv;
19063 }
19064
19065 void  __attribute__((export_name("TS_CResult_OfferBolt12ParseErrorZ_free"))) TS_CResult_OfferBolt12ParseErrorZ_free(uint64_t _res) {
19066         if (!ptr_is_owned(_res)) return;
19067         void* _res_ptr = untag_ptr(_res);
19068         CHECK_ACCESS(_res_ptr);
19069         LDKCResult_OfferBolt12ParseErrorZ _res_conv = *(LDKCResult_OfferBolt12ParseErrorZ*)(_res_ptr);
19070         FREE(untag_ptr(_res));
19071         CResult_OfferBolt12ParseErrorZ_free(_res_conv);
19072 }
19073
19074 static inline uint64_t CResult_OfferBolt12ParseErrorZ_clone_ptr(LDKCResult_OfferBolt12ParseErrorZ *NONNULL_PTR arg) {
19075         LDKCResult_OfferBolt12ParseErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_OfferBolt12ParseErrorZ), "LDKCResult_OfferBolt12ParseErrorZ");
19076         *ret_conv = CResult_OfferBolt12ParseErrorZ_clone(arg);
19077         return tag_ptr(ret_conv, true);
19078 }
19079 int64_t  __attribute__((export_name("TS_CResult_OfferBolt12ParseErrorZ_clone_ptr"))) TS_CResult_OfferBolt12ParseErrorZ_clone_ptr(uint64_t arg) {
19080         LDKCResult_OfferBolt12ParseErrorZ* arg_conv = (LDKCResult_OfferBolt12ParseErrorZ*)untag_ptr(arg);
19081         int64_t ret_conv = CResult_OfferBolt12ParseErrorZ_clone_ptr(arg_conv);
19082         return ret_conv;
19083 }
19084
19085 uint64_t  __attribute__((export_name("TS_CResult_OfferBolt12ParseErrorZ_clone"))) TS_CResult_OfferBolt12ParseErrorZ_clone(uint64_t orig) {
19086         LDKCResult_OfferBolt12ParseErrorZ* orig_conv = (LDKCResult_OfferBolt12ParseErrorZ*)untag_ptr(orig);
19087         LDKCResult_OfferBolt12ParseErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_OfferBolt12ParseErrorZ), "LDKCResult_OfferBolt12ParseErrorZ");
19088         *ret_conv = CResult_OfferBolt12ParseErrorZ_clone(orig_conv);
19089         return tag_ptr(ret_conv, true);
19090 }
19091
19092 uint64_t  __attribute__((export_name("TS_CResult_PublicKeySecp256k1ErrorZ_ok"))) TS_CResult_PublicKeySecp256k1ErrorZ_ok(int8_tArray o) {
19093         LDKPublicKey o_ref;
19094         CHECK(o->arr_len == 33);
19095         memcpy(o_ref.compressed_form, o->elems, 33); FREE(o);
19096         LDKCResult_PublicKeySecp256k1ErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PublicKeySecp256k1ErrorZ), "LDKCResult_PublicKeySecp256k1ErrorZ");
19097         *ret_conv = CResult_PublicKeySecp256k1ErrorZ_ok(o_ref);
19098         return tag_ptr(ret_conv, true);
19099 }
19100
19101 uint64_t  __attribute__((export_name("TS_CResult_PublicKeySecp256k1ErrorZ_err"))) TS_CResult_PublicKeySecp256k1ErrorZ_err(uint32_t e) {
19102         LDKSecp256k1Error e_conv = LDKSecp256k1Error_from_js(e);
19103         LDKCResult_PublicKeySecp256k1ErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PublicKeySecp256k1ErrorZ), "LDKCResult_PublicKeySecp256k1ErrorZ");
19104         *ret_conv = CResult_PublicKeySecp256k1ErrorZ_err(e_conv);
19105         return tag_ptr(ret_conv, true);
19106 }
19107
19108 jboolean  __attribute__((export_name("TS_CResult_PublicKeySecp256k1ErrorZ_is_ok"))) TS_CResult_PublicKeySecp256k1ErrorZ_is_ok(uint64_t o) {
19109         LDKCResult_PublicKeySecp256k1ErrorZ* o_conv = (LDKCResult_PublicKeySecp256k1ErrorZ*)untag_ptr(o);
19110         jboolean ret_conv = CResult_PublicKeySecp256k1ErrorZ_is_ok(o_conv);
19111         return ret_conv;
19112 }
19113
19114 void  __attribute__((export_name("TS_CResult_PublicKeySecp256k1ErrorZ_free"))) TS_CResult_PublicKeySecp256k1ErrorZ_free(uint64_t _res) {
19115         if (!ptr_is_owned(_res)) return;
19116         void* _res_ptr = untag_ptr(_res);
19117         CHECK_ACCESS(_res_ptr);
19118         LDKCResult_PublicKeySecp256k1ErrorZ _res_conv = *(LDKCResult_PublicKeySecp256k1ErrorZ*)(_res_ptr);
19119         FREE(untag_ptr(_res));
19120         CResult_PublicKeySecp256k1ErrorZ_free(_res_conv);
19121 }
19122
19123 static inline uint64_t CResult_PublicKeySecp256k1ErrorZ_clone_ptr(LDKCResult_PublicKeySecp256k1ErrorZ *NONNULL_PTR arg) {
19124         LDKCResult_PublicKeySecp256k1ErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PublicKeySecp256k1ErrorZ), "LDKCResult_PublicKeySecp256k1ErrorZ");
19125         *ret_conv = CResult_PublicKeySecp256k1ErrorZ_clone(arg);
19126         return tag_ptr(ret_conv, true);
19127 }
19128 int64_t  __attribute__((export_name("TS_CResult_PublicKeySecp256k1ErrorZ_clone_ptr"))) TS_CResult_PublicKeySecp256k1ErrorZ_clone_ptr(uint64_t arg) {
19129         LDKCResult_PublicKeySecp256k1ErrorZ* arg_conv = (LDKCResult_PublicKeySecp256k1ErrorZ*)untag_ptr(arg);
19130         int64_t ret_conv = CResult_PublicKeySecp256k1ErrorZ_clone_ptr(arg_conv);
19131         return ret_conv;
19132 }
19133
19134 uint64_t  __attribute__((export_name("TS_CResult_PublicKeySecp256k1ErrorZ_clone"))) TS_CResult_PublicKeySecp256k1ErrorZ_clone(uint64_t orig) {
19135         LDKCResult_PublicKeySecp256k1ErrorZ* orig_conv = (LDKCResult_PublicKeySecp256k1ErrorZ*)untag_ptr(orig);
19136         LDKCResult_PublicKeySecp256k1ErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PublicKeySecp256k1ErrorZ), "LDKCResult_PublicKeySecp256k1ErrorZ");
19137         *ret_conv = CResult_PublicKeySecp256k1ErrorZ_clone(orig_conv);
19138         return tag_ptr(ret_conv, true);
19139 }
19140
19141 uint64_t  __attribute__((export_name("TS_CResult_NodeIdDecodeErrorZ_ok"))) TS_CResult_NodeIdDecodeErrorZ_ok(uint64_t o) {
19142         LDKNodeId o_conv;
19143         o_conv.inner = untag_ptr(o);
19144         o_conv.is_owned = ptr_is_owned(o);
19145         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
19146         o_conv = NodeId_clone(&o_conv);
19147         LDKCResult_NodeIdDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NodeIdDecodeErrorZ), "LDKCResult_NodeIdDecodeErrorZ");
19148         *ret_conv = CResult_NodeIdDecodeErrorZ_ok(o_conv);
19149         return tag_ptr(ret_conv, true);
19150 }
19151
19152 uint64_t  __attribute__((export_name("TS_CResult_NodeIdDecodeErrorZ_err"))) TS_CResult_NodeIdDecodeErrorZ_err(uint64_t e) {
19153         void* e_ptr = untag_ptr(e);
19154         CHECK_ACCESS(e_ptr);
19155         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
19156         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
19157         LDKCResult_NodeIdDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NodeIdDecodeErrorZ), "LDKCResult_NodeIdDecodeErrorZ");
19158         *ret_conv = CResult_NodeIdDecodeErrorZ_err(e_conv);
19159         return tag_ptr(ret_conv, true);
19160 }
19161
19162 jboolean  __attribute__((export_name("TS_CResult_NodeIdDecodeErrorZ_is_ok"))) TS_CResult_NodeIdDecodeErrorZ_is_ok(uint64_t o) {
19163         LDKCResult_NodeIdDecodeErrorZ* o_conv = (LDKCResult_NodeIdDecodeErrorZ*)untag_ptr(o);
19164         jboolean ret_conv = CResult_NodeIdDecodeErrorZ_is_ok(o_conv);
19165         return ret_conv;
19166 }
19167
19168 void  __attribute__((export_name("TS_CResult_NodeIdDecodeErrorZ_free"))) TS_CResult_NodeIdDecodeErrorZ_free(uint64_t _res) {
19169         if (!ptr_is_owned(_res)) return;
19170         void* _res_ptr = untag_ptr(_res);
19171         CHECK_ACCESS(_res_ptr);
19172         LDKCResult_NodeIdDecodeErrorZ _res_conv = *(LDKCResult_NodeIdDecodeErrorZ*)(_res_ptr);
19173         FREE(untag_ptr(_res));
19174         CResult_NodeIdDecodeErrorZ_free(_res_conv);
19175 }
19176
19177 static inline uint64_t CResult_NodeIdDecodeErrorZ_clone_ptr(LDKCResult_NodeIdDecodeErrorZ *NONNULL_PTR arg) {
19178         LDKCResult_NodeIdDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NodeIdDecodeErrorZ), "LDKCResult_NodeIdDecodeErrorZ");
19179         *ret_conv = CResult_NodeIdDecodeErrorZ_clone(arg);
19180         return tag_ptr(ret_conv, true);
19181 }
19182 int64_t  __attribute__((export_name("TS_CResult_NodeIdDecodeErrorZ_clone_ptr"))) TS_CResult_NodeIdDecodeErrorZ_clone_ptr(uint64_t arg) {
19183         LDKCResult_NodeIdDecodeErrorZ* arg_conv = (LDKCResult_NodeIdDecodeErrorZ*)untag_ptr(arg);
19184         int64_t ret_conv = CResult_NodeIdDecodeErrorZ_clone_ptr(arg_conv);
19185         return ret_conv;
19186 }
19187
19188 uint64_t  __attribute__((export_name("TS_CResult_NodeIdDecodeErrorZ_clone"))) TS_CResult_NodeIdDecodeErrorZ_clone(uint64_t orig) {
19189         LDKCResult_NodeIdDecodeErrorZ* orig_conv = (LDKCResult_NodeIdDecodeErrorZ*)untag_ptr(orig);
19190         LDKCResult_NodeIdDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NodeIdDecodeErrorZ), "LDKCResult_NodeIdDecodeErrorZ");
19191         *ret_conv = CResult_NodeIdDecodeErrorZ_clone(orig_conv);
19192         return tag_ptr(ret_conv, true);
19193 }
19194
19195 uint64_t  __attribute__((export_name("TS_COption_NetworkUpdateZ_some"))) TS_COption_NetworkUpdateZ_some(uint64_t o) {
19196         void* o_ptr = untag_ptr(o);
19197         CHECK_ACCESS(o_ptr);
19198         LDKNetworkUpdate o_conv = *(LDKNetworkUpdate*)(o_ptr);
19199         o_conv = NetworkUpdate_clone((LDKNetworkUpdate*)untag_ptr(o));
19200         LDKCOption_NetworkUpdateZ *ret_copy = MALLOC(sizeof(LDKCOption_NetworkUpdateZ), "LDKCOption_NetworkUpdateZ");
19201         *ret_copy = COption_NetworkUpdateZ_some(o_conv);
19202         uint64_t ret_ref = tag_ptr(ret_copy, true);
19203         return ret_ref;
19204 }
19205
19206 uint64_t  __attribute__((export_name("TS_COption_NetworkUpdateZ_none"))) TS_COption_NetworkUpdateZ_none() {
19207         LDKCOption_NetworkUpdateZ *ret_copy = MALLOC(sizeof(LDKCOption_NetworkUpdateZ), "LDKCOption_NetworkUpdateZ");
19208         *ret_copy = COption_NetworkUpdateZ_none();
19209         uint64_t ret_ref = tag_ptr(ret_copy, true);
19210         return ret_ref;
19211 }
19212
19213 void  __attribute__((export_name("TS_COption_NetworkUpdateZ_free"))) TS_COption_NetworkUpdateZ_free(uint64_t _res) {
19214         if (!ptr_is_owned(_res)) return;
19215         void* _res_ptr = untag_ptr(_res);
19216         CHECK_ACCESS(_res_ptr);
19217         LDKCOption_NetworkUpdateZ _res_conv = *(LDKCOption_NetworkUpdateZ*)(_res_ptr);
19218         FREE(untag_ptr(_res));
19219         COption_NetworkUpdateZ_free(_res_conv);
19220 }
19221
19222 static inline uint64_t COption_NetworkUpdateZ_clone_ptr(LDKCOption_NetworkUpdateZ *NONNULL_PTR arg) {
19223         LDKCOption_NetworkUpdateZ *ret_copy = MALLOC(sizeof(LDKCOption_NetworkUpdateZ), "LDKCOption_NetworkUpdateZ");
19224         *ret_copy = COption_NetworkUpdateZ_clone(arg);
19225         uint64_t ret_ref = tag_ptr(ret_copy, true);
19226         return ret_ref;
19227 }
19228 int64_t  __attribute__((export_name("TS_COption_NetworkUpdateZ_clone_ptr"))) TS_COption_NetworkUpdateZ_clone_ptr(uint64_t arg) {
19229         LDKCOption_NetworkUpdateZ* arg_conv = (LDKCOption_NetworkUpdateZ*)untag_ptr(arg);
19230         int64_t ret_conv = COption_NetworkUpdateZ_clone_ptr(arg_conv);
19231         return ret_conv;
19232 }
19233
19234 uint64_t  __attribute__((export_name("TS_COption_NetworkUpdateZ_clone"))) TS_COption_NetworkUpdateZ_clone(uint64_t orig) {
19235         LDKCOption_NetworkUpdateZ* orig_conv = (LDKCOption_NetworkUpdateZ*)untag_ptr(orig);
19236         LDKCOption_NetworkUpdateZ *ret_copy = MALLOC(sizeof(LDKCOption_NetworkUpdateZ), "LDKCOption_NetworkUpdateZ");
19237         *ret_copy = COption_NetworkUpdateZ_clone(orig_conv);
19238         uint64_t ret_ref = tag_ptr(ret_copy, true);
19239         return ret_ref;
19240 }
19241
19242 uint64_t  __attribute__((export_name("TS_CResult_COption_NetworkUpdateZDecodeErrorZ_ok"))) TS_CResult_COption_NetworkUpdateZDecodeErrorZ_ok(uint64_t o) {
19243         void* o_ptr = untag_ptr(o);
19244         CHECK_ACCESS(o_ptr);
19245         LDKCOption_NetworkUpdateZ o_conv = *(LDKCOption_NetworkUpdateZ*)(o_ptr);
19246         o_conv = COption_NetworkUpdateZ_clone((LDKCOption_NetworkUpdateZ*)untag_ptr(o));
19247         LDKCResult_COption_NetworkUpdateZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_COption_NetworkUpdateZDecodeErrorZ), "LDKCResult_COption_NetworkUpdateZDecodeErrorZ");
19248         *ret_conv = CResult_COption_NetworkUpdateZDecodeErrorZ_ok(o_conv);
19249         return tag_ptr(ret_conv, true);
19250 }
19251
19252 uint64_t  __attribute__((export_name("TS_CResult_COption_NetworkUpdateZDecodeErrorZ_err"))) TS_CResult_COption_NetworkUpdateZDecodeErrorZ_err(uint64_t e) {
19253         void* e_ptr = untag_ptr(e);
19254         CHECK_ACCESS(e_ptr);
19255         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
19256         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
19257         LDKCResult_COption_NetworkUpdateZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_COption_NetworkUpdateZDecodeErrorZ), "LDKCResult_COption_NetworkUpdateZDecodeErrorZ");
19258         *ret_conv = CResult_COption_NetworkUpdateZDecodeErrorZ_err(e_conv);
19259         return tag_ptr(ret_conv, true);
19260 }
19261
19262 jboolean  __attribute__((export_name("TS_CResult_COption_NetworkUpdateZDecodeErrorZ_is_ok"))) TS_CResult_COption_NetworkUpdateZDecodeErrorZ_is_ok(uint64_t o) {
19263         LDKCResult_COption_NetworkUpdateZDecodeErrorZ* o_conv = (LDKCResult_COption_NetworkUpdateZDecodeErrorZ*)untag_ptr(o);
19264         jboolean ret_conv = CResult_COption_NetworkUpdateZDecodeErrorZ_is_ok(o_conv);
19265         return ret_conv;
19266 }
19267
19268 void  __attribute__((export_name("TS_CResult_COption_NetworkUpdateZDecodeErrorZ_free"))) TS_CResult_COption_NetworkUpdateZDecodeErrorZ_free(uint64_t _res) {
19269         if (!ptr_is_owned(_res)) return;
19270         void* _res_ptr = untag_ptr(_res);
19271         CHECK_ACCESS(_res_ptr);
19272         LDKCResult_COption_NetworkUpdateZDecodeErrorZ _res_conv = *(LDKCResult_COption_NetworkUpdateZDecodeErrorZ*)(_res_ptr);
19273         FREE(untag_ptr(_res));
19274         CResult_COption_NetworkUpdateZDecodeErrorZ_free(_res_conv);
19275 }
19276
19277 static inline uint64_t CResult_COption_NetworkUpdateZDecodeErrorZ_clone_ptr(LDKCResult_COption_NetworkUpdateZDecodeErrorZ *NONNULL_PTR arg) {
19278         LDKCResult_COption_NetworkUpdateZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_COption_NetworkUpdateZDecodeErrorZ), "LDKCResult_COption_NetworkUpdateZDecodeErrorZ");
19279         *ret_conv = CResult_COption_NetworkUpdateZDecodeErrorZ_clone(arg);
19280         return tag_ptr(ret_conv, true);
19281 }
19282 int64_t  __attribute__((export_name("TS_CResult_COption_NetworkUpdateZDecodeErrorZ_clone_ptr"))) TS_CResult_COption_NetworkUpdateZDecodeErrorZ_clone_ptr(uint64_t arg) {
19283         LDKCResult_COption_NetworkUpdateZDecodeErrorZ* arg_conv = (LDKCResult_COption_NetworkUpdateZDecodeErrorZ*)untag_ptr(arg);
19284         int64_t ret_conv = CResult_COption_NetworkUpdateZDecodeErrorZ_clone_ptr(arg_conv);
19285         return ret_conv;
19286 }
19287
19288 uint64_t  __attribute__((export_name("TS_CResult_COption_NetworkUpdateZDecodeErrorZ_clone"))) TS_CResult_COption_NetworkUpdateZDecodeErrorZ_clone(uint64_t orig) {
19289         LDKCResult_COption_NetworkUpdateZDecodeErrorZ* orig_conv = (LDKCResult_COption_NetworkUpdateZDecodeErrorZ*)untag_ptr(orig);
19290         LDKCResult_COption_NetworkUpdateZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_COption_NetworkUpdateZDecodeErrorZ), "LDKCResult_COption_NetworkUpdateZDecodeErrorZ");
19291         *ret_conv = CResult_COption_NetworkUpdateZDecodeErrorZ_clone(orig_conv);
19292         return tag_ptr(ret_conv, true);
19293 }
19294
19295 uint64_t  __attribute__((export_name("TS_COption_UtxoLookupZ_some"))) TS_COption_UtxoLookupZ_some(uint64_t o) {
19296         void* o_ptr = untag_ptr(o);
19297         CHECK_ACCESS(o_ptr);
19298         LDKUtxoLookup o_conv = *(LDKUtxoLookup*)(o_ptr);
19299         if (o_conv.free == LDKUtxoLookup_JCalls_free) {
19300                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
19301                 LDKUtxoLookup_JCalls_cloned(&o_conv);
19302         }
19303         LDKCOption_UtxoLookupZ *ret_copy = MALLOC(sizeof(LDKCOption_UtxoLookupZ), "LDKCOption_UtxoLookupZ");
19304         *ret_copy = COption_UtxoLookupZ_some(o_conv);
19305         uint64_t ret_ref = tag_ptr(ret_copy, true);
19306         return ret_ref;
19307 }
19308
19309 uint64_t  __attribute__((export_name("TS_COption_UtxoLookupZ_none"))) TS_COption_UtxoLookupZ_none() {
19310         LDKCOption_UtxoLookupZ *ret_copy = MALLOC(sizeof(LDKCOption_UtxoLookupZ), "LDKCOption_UtxoLookupZ");
19311         *ret_copy = COption_UtxoLookupZ_none();
19312         uint64_t ret_ref = tag_ptr(ret_copy, true);
19313         return ret_ref;
19314 }
19315
19316 void  __attribute__((export_name("TS_COption_UtxoLookupZ_free"))) TS_COption_UtxoLookupZ_free(uint64_t _res) {
19317         if (!ptr_is_owned(_res)) return;
19318         void* _res_ptr = untag_ptr(_res);
19319         CHECK_ACCESS(_res_ptr);
19320         LDKCOption_UtxoLookupZ _res_conv = *(LDKCOption_UtxoLookupZ*)(_res_ptr);
19321         FREE(untag_ptr(_res));
19322         COption_UtxoLookupZ_free(_res_conv);
19323 }
19324
19325 uint64_t  __attribute__((export_name("TS_CResult_NoneLightningErrorZ_ok"))) TS_CResult_NoneLightningErrorZ_ok() {
19326         LDKCResult_NoneLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneLightningErrorZ), "LDKCResult_NoneLightningErrorZ");
19327         *ret_conv = CResult_NoneLightningErrorZ_ok();
19328         return tag_ptr(ret_conv, true);
19329 }
19330
19331 uint64_t  __attribute__((export_name("TS_CResult_NoneLightningErrorZ_err"))) TS_CResult_NoneLightningErrorZ_err(uint64_t e) {
19332         LDKLightningError e_conv;
19333         e_conv.inner = untag_ptr(e);
19334         e_conv.is_owned = ptr_is_owned(e);
19335         CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
19336         e_conv = LightningError_clone(&e_conv);
19337         LDKCResult_NoneLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneLightningErrorZ), "LDKCResult_NoneLightningErrorZ");
19338         *ret_conv = CResult_NoneLightningErrorZ_err(e_conv);
19339         return tag_ptr(ret_conv, true);
19340 }
19341
19342 jboolean  __attribute__((export_name("TS_CResult_NoneLightningErrorZ_is_ok"))) TS_CResult_NoneLightningErrorZ_is_ok(uint64_t o) {
19343         LDKCResult_NoneLightningErrorZ* o_conv = (LDKCResult_NoneLightningErrorZ*)untag_ptr(o);
19344         jboolean ret_conv = CResult_NoneLightningErrorZ_is_ok(o_conv);
19345         return ret_conv;
19346 }
19347
19348 void  __attribute__((export_name("TS_CResult_NoneLightningErrorZ_free"))) TS_CResult_NoneLightningErrorZ_free(uint64_t _res) {
19349         if (!ptr_is_owned(_res)) return;
19350         void* _res_ptr = untag_ptr(_res);
19351         CHECK_ACCESS(_res_ptr);
19352         LDKCResult_NoneLightningErrorZ _res_conv = *(LDKCResult_NoneLightningErrorZ*)(_res_ptr);
19353         FREE(untag_ptr(_res));
19354         CResult_NoneLightningErrorZ_free(_res_conv);
19355 }
19356
19357 static inline uint64_t CResult_NoneLightningErrorZ_clone_ptr(LDKCResult_NoneLightningErrorZ *NONNULL_PTR arg) {
19358         LDKCResult_NoneLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneLightningErrorZ), "LDKCResult_NoneLightningErrorZ");
19359         *ret_conv = CResult_NoneLightningErrorZ_clone(arg);
19360         return tag_ptr(ret_conv, true);
19361 }
19362 int64_t  __attribute__((export_name("TS_CResult_NoneLightningErrorZ_clone_ptr"))) TS_CResult_NoneLightningErrorZ_clone_ptr(uint64_t arg) {
19363         LDKCResult_NoneLightningErrorZ* arg_conv = (LDKCResult_NoneLightningErrorZ*)untag_ptr(arg);
19364         int64_t ret_conv = CResult_NoneLightningErrorZ_clone_ptr(arg_conv);
19365         return ret_conv;
19366 }
19367
19368 uint64_t  __attribute__((export_name("TS_CResult_NoneLightningErrorZ_clone"))) TS_CResult_NoneLightningErrorZ_clone(uint64_t orig) {
19369         LDKCResult_NoneLightningErrorZ* orig_conv = (LDKCResult_NoneLightningErrorZ*)untag_ptr(orig);
19370         LDKCResult_NoneLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneLightningErrorZ), "LDKCResult_NoneLightningErrorZ");
19371         *ret_conv = CResult_NoneLightningErrorZ_clone(orig_conv);
19372         return tag_ptr(ret_conv, true);
19373 }
19374
19375 uint64_t  __attribute__((export_name("TS_CResult_boolLightningErrorZ_ok"))) TS_CResult_boolLightningErrorZ_ok(jboolean o) {
19376         LDKCResult_boolLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_boolLightningErrorZ), "LDKCResult_boolLightningErrorZ");
19377         *ret_conv = CResult_boolLightningErrorZ_ok(o);
19378         return tag_ptr(ret_conv, true);
19379 }
19380
19381 uint64_t  __attribute__((export_name("TS_CResult_boolLightningErrorZ_err"))) TS_CResult_boolLightningErrorZ_err(uint64_t e) {
19382         LDKLightningError e_conv;
19383         e_conv.inner = untag_ptr(e);
19384         e_conv.is_owned = ptr_is_owned(e);
19385         CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
19386         e_conv = LightningError_clone(&e_conv);
19387         LDKCResult_boolLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_boolLightningErrorZ), "LDKCResult_boolLightningErrorZ");
19388         *ret_conv = CResult_boolLightningErrorZ_err(e_conv);
19389         return tag_ptr(ret_conv, true);
19390 }
19391
19392 jboolean  __attribute__((export_name("TS_CResult_boolLightningErrorZ_is_ok"))) TS_CResult_boolLightningErrorZ_is_ok(uint64_t o) {
19393         LDKCResult_boolLightningErrorZ* o_conv = (LDKCResult_boolLightningErrorZ*)untag_ptr(o);
19394         jboolean ret_conv = CResult_boolLightningErrorZ_is_ok(o_conv);
19395         return ret_conv;
19396 }
19397
19398 void  __attribute__((export_name("TS_CResult_boolLightningErrorZ_free"))) TS_CResult_boolLightningErrorZ_free(uint64_t _res) {
19399         if (!ptr_is_owned(_res)) return;
19400         void* _res_ptr = untag_ptr(_res);
19401         CHECK_ACCESS(_res_ptr);
19402         LDKCResult_boolLightningErrorZ _res_conv = *(LDKCResult_boolLightningErrorZ*)(_res_ptr);
19403         FREE(untag_ptr(_res));
19404         CResult_boolLightningErrorZ_free(_res_conv);
19405 }
19406
19407 static inline uint64_t CResult_boolLightningErrorZ_clone_ptr(LDKCResult_boolLightningErrorZ *NONNULL_PTR arg) {
19408         LDKCResult_boolLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_boolLightningErrorZ), "LDKCResult_boolLightningErrorZ");
19409         *ret_conv = CResult_boolLightningErrorZ_clone(arg);
19410         return tag_ptr(ret_conv, true);
19411 }
19412 int64_t  __attribute__((export_name("TS_CResult_boolLightningErrorZ_clone_ptr"))) TS_CResult_boolLightningErrorZ_clone_ptr(uint64_t arg) {
19413         LDKCResult_boolLightningErrorZ* arg_conv = (LDKCResult_boolLightningErrorZ*)untag_ptr(arg);
19414         int64_t ret_conv = CResult_boolLightningErrorZ_clone_ptr(arg_conv);
19415         return ret_conv;
19416 }
19417
19418 uint64_t  __attribute__((export_name("TS_CResult_boolLightningErrorZ_clone"))) TS_CResult_boolLightningErrorZ_clone(uint64_t orig) {
19419         LDKCResult_boolLightningErrorZ* orig_conv = (LDKCResult_boolLightningErrorZ*)untag_ptr(orig);
19420         LDKCResult_boolLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_boolLightningErrorZ), "LDKCResult_boolLightningErrorZ");
19421         *ret_conv = CResult_boolLightningErrorZ_clone(orig_conv);
19422         return tag_ptr(ret_conv, true);
19423 }
19424
19425 static inline uint64_t C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ_clone_ptr(LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ *NONNULL_PTR arg) {
19426         LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ* ret_conv = MALLOC(sizeof(LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ), "LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ");
19427         *ret_conv = C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ_clone(arg);
19428         return tag_ptr(ret_conv, true);
19429 }
19430 int64_t  __attribute__((export_name("TS_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ_clone_ptr"))) TS_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ_clone_ptr(uint64_t arg) {
19431         LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ* arg_conv = (LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ*)untag_ptr(arg);
19432         int64_t ret_conv = C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ_clone_ptr(arg_conv);
19433         return ret_conv;
19434 }
19435
19436 uint64_t  __attribute__((export_name("TS_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ_clone"))) TS_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ_clone(uint64_t orig) {
19437         LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ* orig_conv = (LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ*)untag_ptr(orig);
19438         LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ* ret_conv = MALLOC(sizeof(LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ), "LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ");
19439         *ret_conv = C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ_clone(orig_conv);
19440         return tag_ptr(ret_conv, true);
19441 }
19442
19443 uint64_t  __attribute__((export_name("TS_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ_new"))) TS_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ_new(uint64_t a, uint64_t b, uint64_t c) {
19444         LDKChannelAnnouncement a_conv;
19445         a_conv.inner = untag_ptr(a);
19446         a_conv.is_owned = ptr_is_owned(a);
19447         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
19448         a_conv = ChannelAnnouncement_clone(&a_conv);
19449         LDKChannelUpdate b_conv;
19450         b_conv.inner = untag_ptr(b);
19451         b_conv.is_owned = ptr_is_owned(b);
19452         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
19453         b_conv = ChannelUpdate_clone(&b_conv);
19454         LDKChannelUpdate c_conv;
19455         c_conv.inner = untag_ptr(c);
19456         c_conv.is_owned = ptr_is_owned(c);
19457         CHECK_INNER_FIELD_ACCESS_OR_NULL(c_conv);
19458         c_conv = ChannelUpdate_clone(&c_conv);
19459         LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ* ret_conv = MALLOC(sizeof(LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ), "LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ");
19460         *ret_conv = C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ_new(a_conv, b_conv, c_conv);
19461         return tag_ptr(ret_conv, true);
19462 }
19463
19464 void  __attribute__((export_name("TS_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ_free"))) TS_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ_free(uint64_t _res) {
19465         if (!ptr_is_owned(_res)) return;
19466         void* _res_ptr = untag_ptr(_res);
19467         CHECK_ACCESS(_res_ptr);
19468         LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ _res_conv = *(LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ*)(_res_ptr);
19469         FREE(untag_ptr(_res));
19470         C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ_free(_res_conv);
19471 }
19472
19473 uint64_t  __attribute__((export_name("TS_COption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ_some"))) TS_COption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ_some(uint64_t o) {
19474         void* o_ptr = untag_ptr(o);
19475         CHECK_ACCESS(o_ptr);
19476         LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ o_conv = *(LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ*)(o_ptr);
19477         o_conv = C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ_clone((LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ*)untag_ptr(o));
19478         LDKCOption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ *ret_copy = MALLOC(sizeof(LDKCOption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ), "LDKCOption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ");
19479         *ret_copy = COption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ_some(o_conv);
19480         uint64_t ret_ref = tag_ptr(ret_copy, true);
19481         return ret_ref;
19482 }
19483
19484 uint64_t  __attribute__((export_name("TS_COption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ_none"))) TS_COption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ_none() {
19485         LDKCOption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ *ret_copy = MALLOC(sizeof(LDKCOption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ), "LDKCOption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ");
19486         *ret_copy = COption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ_none();
19487         uint64_t ret_ref = tag_ptr(ret_copy, true);
19488         return ret_ref;
19489 }
19490
19491 void  __attribute__((export_name("TS_COption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ_free"))) TS_COption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ_free(uint64_t _res) {
19492         if (!ptr_is_owned(_res)) return;
19493         void* _res_ptr = untag_ptr(_res);
19494         CHECK_ACCESS(_res_ptr);
19495         LDKCOption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ _res_conv = *(LDKCOption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ*)(_res_ptr);
19496         FREE(untag_ptr(_res));
19497         COption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ_free(_res_conv);
19498 }
19499
19500 static inline uint64_t COption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ_clone_ptr(LDKCOption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ *NONNULL_PTR arg) {
19501         LDKCOption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ *ret_copy = MALLOC(sizeof(LDKCOption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ), "LDKCOption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ");
19502         *ret_copy = COption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ_clone(arg);
19503         uint64_t ret_ref = tag_ptr(ret_copy, true);
19504         return ret_ref;
19505 }
19506 int64_t  __attribute__((export_name("TS_COption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ_clone_ptr"))) TS_COption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ_clone_ptr(uint64_t arg) {
19507         LDKCOption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ* arg_conv = (LDKCOption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ*)untag_ptr(arg);
19508         int64_t ret_conv = COption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ_clone_ptr(arg_conv);
19509         return ret_conv;
19510 }
19511
19512 uint64_t  __attribute__((export_name("TS_COption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ_clone"))) TS_COption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ_clone(uint64_t orig) {
19513         LDKCOption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ* orig_conv = (LDKCOption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ*)untag_ptr(orig);
19514         LDKCOption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ *ret_copy = MALLOC(sizeof(LDKCOption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ), "LDKCOption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ");
19515         *ret_copy = COption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ_clone(orig_conv);
19516         uint64_t ret_ref = tag_ptr(ret_copy, true);
19517         return ret_ref;
19518 }
19519
19520 void  __attribute__((export_name("TS_CVec_MessageSendEventZ_free"))) TS_CVec_MessageSendEventZ_free(uint64_tArray _res) {
19521         LDKCVec_MessageSendEventZ _res_constr;
19522         _res_constr.datalen = _res->arr_len;
19523         if (_res_constr.datalen > 0)
19524                 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKMessageSendEvent), "LDKCVec_MessageSendEventZ Elements");
19525         else
19526                 _res_constr.data = NULL;
19527         uint64_t* _res_vals = _res->elems;
19528         for (size_t s = 0; s < _res_constr.datalen; s++) {
19529                 uint64_t _res_conv_18 = _res_vals[s];
19530                 void* _res_conv_18_ptr = untag_ptr(_res_conv_18);
19531                 CHECK_ACCESS(_res_conv_18_ptr);
19532                 LDKMessageSendEvent _res_conv_18_conv = *(LDKMessageSendEvent*)(_res_conv_18_ptr);
19533                 FREE(untag_ptr(_res_conv_18));
19534                 _res_constr.data[s] = _res_conv_18_conv;
19535         }
19536         FREE(_res);
19537         CVec_MessageSendEventZ_free(_res_constr);
19538 }
19539
19540 uint64_t  __attribute__((export_name("TS_CResult_ChannelUpdateInfoDecodeErrorZ_ok"))) TS_CResult_ChannelUpdateInfoDecodeErrorZ_ok(uint64_t o) {
19541         LDKChannelUpdateInfo o_conv;
19542         o_conv.inner = untag_ptr(o);
19543         o_conv.is_owned = ptr_is_owned(o);
19544         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
19545         o_conv = ChannelUpdateInfo_clone(&o_conv);
19546         LDKCResult_ChannelUpdateInfoDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelUpdateInfoDecodeErrorZ), "LDKCResult_ChannelUpdateInfoDecodeErrorZ");
19547         *ret_conv = CResult_ChannelUpdateInfoDecodeErrorZ_ok(o_conv);
19548         return tag_ptr(ret_conv, true);
19549 }
19550
19551 uint64_t  __attribute__((export_name("TS_CResult_ChannelUpdateInfoDecodeErrorZ_err"))) TS_CResult_ChannelUpdateInfoDecodeErrorZ_err(uint64_t e) {
19552         void* e_ptr = untag_ptr(e);
19553         CHECK_ACCESS(e_ptr);
19554         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
19555         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
19556         LDKCResult_ChannelUpdateInfoDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelUpdateInfoDecodeErrorZ), "LDKCResult_ChannelUpdateInfoDecodeErrorZ");
19557         *ret_conv = CResult_ChannelUpdateInfoDecodeErrorZ_err(e_conv);
19558         return tag_ptr(ret_conv, true);
19559 }
19560
19561 jboolean  __attribute__((export_name("TS_CResult_ChannelUpdateInfoDecodeErrorZ_is_ok"))) TS_CResult_ChannelUpdateInfoDecodeErrorZ_is_ok(uint64_t o) {
19562         LDKCResult_ChannelUpdateInfoDecodeErrorZ* o_conv = (LDKCResult_ChannelUpdateInfoDecodeErrorZ*)untag_ptr(o);
19563         jboolean ret_conv = CResult_ChannelUpdateInfoDecodeErrorZ_is_ok(o_conv);
19564         return ret_conv;
19565 }
19566
19567 void  __attribute__((export_name("TS_CResult_ChannelUpdateInfoDecodeErrorZ_free"))) TS_CResult_ChannelUpdateInfoDecodeErrorZ_free(uint64_t _res) {
19568         if (!ptr_is_owned(_res)) return;
19569         void* _res_ptr = untag_ptr(_res);
19570         CHECK_ACCESS(_res_ptr);
19571         LDKCResult_ChannelUpdateInfoDecodeErrorZ _res_conv = *(LDKCResult_ChannelUpdateInfoDecodeErrorZ*)(_res_ptr);
19572         FREE(untag_ptr(_res));
19573         CResult_ChannelUpdateInfoDecodeErrorZ_free(_res_conv);
19574 }
19575
19576 static inline uint64_t CResult_ChannelUpdateInfoDecodeErrorZ_clone_ptr(LDKCResult_ChannelUpdateInfoDecodeErrorZ *NONNULL_PTR arg) {
19577         LDKCResult_ChannelUpdateInfoDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelUpdateInfoDecodeErrorZ), "LDKCResult_ChannelUpdateInfoDecodeErrorZ");
19578         *ret_conv = CResult_ChannelUpdateInfoDecodeErrorZ_clone(arg);
19579         return tag_ptr(ret_conv, true);
19580 }
19581 int64_t  __attribute__((export_name("TS_CResult_ChannelUpdateInfoDecodeErrorZ_clone_ptr"))) TS_CResult_ChannelUpdateInfoDecodeErrorZ_clone_ptr(uint64_t arg) {
19582         LDKCResult_ChannelUpdateInfoDecodeErrorZ* arg_conv = (LDKCResult_ChannelUpdateInfoDecodeErrorZ*)untag_ptr(arg);
19583         int64_t ret_conv = CResult_ChannelUpdateInfoDecodeErrorZ_clone_ptr(arg_conv);
19584         return ret_conv;
19585 }
19586
19587 uint64_t  __attribute__((export_name("TS_CResult_ChannelUpdateInfoDecodeErrorZ_clone"))) TS_CResult_ChannelUpdateInfoDecodeErrorZ_clone(uint64_t orig) {
19588         LDKCResult_ChannelUpdateInfoDecodeErrorZ* orig_conv = (LDKCResult_ChannelUpdateInfoDecodeErrorZ*)untag_ptr(orig);
19589         LDKCResult_ChannelUpdateInfoDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelUpdateInfoDecodeErrorZ), "LDKCResult_ChannelUpdateInfoDecodeErrorZ");
19590         *ret_conv = CResult_ChannelUpdateInfoDecodeErrorZ_clone(orig_conv);
19591         return tag_ptr(ret_conv, true);
19592 }
19593
19594 uint64_t  __attribute__((export_name("TS_CResult_ChannelInfoDecodeErrorZ_ok"))) TS_CResult_ChannelInfoDecodeErrorZ_ok(uint64_t o) {
19595         LDKChannelInfo o_conv;
19596         o_conv.inner = untag_ptr(o);
19597         o_conv.is_owned = ptr_is_owned(o);
19598         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
19599         o_conv = ChannelInfo_clone(&o_conv);
19600         LDKCResult_ChannelInfoDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelInfoDecodeErrorZ), "LDKCResult_ChannelInfoDecodeErrorZ");
19601         *ret_conv = CResult_ChannelInfoDecodeErrorZ_ok(o_conv);
19602         return tag_ptr(ret_conv, true);
19603 }
19604
19605 uint64_t  __attribute__((export_name("TS_CResult_ChannelInfoDecodeErrorZ_err"))) TS_CResult_ChannelInfoDecodeErrorZ_err(uint64_t e) {
19606         void* e_ptr = untag_ptr(e);
19607         CHECK_ACCESS(e_ptr);
19608         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
19609         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
19610         LDKCResult_ChannelInfoDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelInfoDecodeErrorZ), "LDKCResult_ChannelInfoDecodeErrorZ");
19611         *ret_conv = CResult_ChannelInfoDecodeErrorZ_err(e_conv);
19612         return tag_ptr(ret_conv, true);
19613 }
19614
19615 jboolean  __attribute__((export_name("TS_CResult_ChannelInfoDecodeErrorZ_is_ok"))) TS_CResult_ChannelInfoDecodeErrorZ_is_ok(uint64_t o) {
19616         LDKCResult_ChannelInfoDecodeErrorZ* o_conv = (LDKCResult_ChannelInfoDecodeErrorZ*)untag_ptr(o);
19617         jboolean ret_conv = CResult_ChannelInfoDecodeErrorZ_is_ok(o_conv);
19618         return ret_conv;
19619 }
19620
19621 void  __attribute__((export_name("TS_CResult_ChannelInfoDecodeErrorZ_free"))) TS_CResult_ChannelInfoDecodeErrorZ_free(uint64_t _res) {
19622         if (!ptr_is_owned(_res)) return;
19623         void* _res_ptr = untag_ptr(_res);
19624         CHECK_ACCESS(_res_ptr);
19625         LDKCResult_ChannelInfoDecodeErrorZ _res_conv = *(LDKCResult_ChannelInfoDecodeErrorZ*)(_res_ptr);
19626         FREE(untag_ptr(_res));
19627         CResult_ChannelInfoDecodeErrorZ_free(_res_conv);
19628 }
19629
19630 static inline uint64_t CResult_ChannelInfoDecodeErrorZ_clone_ptr(LDKCResult_ChannelInfoDecodeErrorZ *NONNULL_PTR arg) {
19631         LDKCResult_ChannelInfoDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelInfoDecodeErrorZ), "LDKCResult_ChannelInfoDecodeErrorZ");
19632         *ret_conv = CResult_ChannelInfoDecodeErrorZ_clone(arg);
19633         return tag_ptr(ret_conv, true);
19634 }
19635 int64_t  __attribute__((export_name("TS_CResult_ChannelInfoDecodeErrorZ_clone_ptr"))) TS_CResult_ChannelInfoDecodeErrorZ_clone_ptr(uint64_t arg) {
19636         LDKCResult_ChannelInfoDecodeErrorZ* arg_conv = (LDKCResult_ChannelInfoDecodeErrorZ*)untag_ptr(arg);
19637         int64_t ret_conv = CResult_ChannelInfoDecodeErrorZ_clone_ptr(arg_conv);
19638         return ret_conv;
19639 }
19640
19641 uint64_t  __attribute__((export_name("TS_CResult_ChannelInfoDecodeErrorZ_clone"))) TS_CResult_ChannelInfoDecodeErrorZ_clone(uint64_t orig) {
19642         LDKCResult_ChannelInfoDecodeErrorZ* orig_conv = (LDKCResult_ChannelInfoDecodeErrorZ*)untag_ptr(orig);
19643         LDKCResult_ChannelInfoDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelInfoDecodeErrorZ), "LDKCResult_ChannelInfoDecodeErrorZ");
19644         *ret_conv = CResult_ChannelInfoDecodeErrorZ_clone(orig_conv);
19645         return tag_ptr(ret_conv, true);
19646 }
19647
19648 uint64_t  __attribute__((export_name("TS_CResult_RoutingFeesDecodeErrorZ_ok"))) TS_CResult_RoutingFeesDecodeErrorZ_ok(uint64_t o) {
19649         LDKRoutingFees o_conv;
19650         o_conv.inner = untag_ptr(o);
19651         o_conv.is_owned = ptr_is_owned(o);
19652         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
19653         o_conv = RoutingFees_clone(&o_conv);
19654         LDKCResult_RoutingFeesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RoutingFeesDecodeErrorZ), "LDKCResult_RoutingFeesDecodeErrorZ");
19655         *ret_conv = CResult_RoutingFeesDecodeErrorZ_ok(o_conv);
19656         return tag_ptr(ret_conv, true);
19657 }
19658
19659 uint64_t  __attribute__((export_name("TS_CResult_RoutingFeesDecodeErrorZ_err"))) TS_CResult_RoutingFeesDecodeErrorZ_err(uint64_t e) {
19660         void* e_ptr = untag_ptr(e);
19661         CHECK_ACCESS(e_ptr);
19662         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
19663         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
19664         LDKCResult_RoutingFeesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RoutingFeesDecodeErrorZ), "LDKCResult_RoutingFeesDecodeErrorZ");
19665         *ret_conv = CResult_RoutingFeesDecodeErrorZ_err(e_conv);
19666         return tag_ptr(ret_conv, true);
19667 }
19668
19669 jboolean  __attribute__((export_name("TS_CResult_RoutingFeesDecodeErrorZ_is_ok"))) TS_CResult_RoutingFeesDecodeErrorZ_is_ok(uint64_t o) {
19670         LDKCResult_RoutingFeesDecodeErrorZ* o_conv = (LDKCResult_RoutingFeesDecodeErrorZ*)untag_ptr(o);
19671         jboolean ret_conv = CResult_RoutingFeesDecodeErrorZ_is_ok(o_conv);
19672         return ret_conv;
19673 }
19674
19675 void  __attribute__((export_name("TS_CResult_RoutingFeesDecodeErrorZ_free"))) TS_CResult_RoutingFeesDecodeErrorZ_free(uint64_t _res) {
19676         if (!ptr_is_owned(_res)) return;
19677         void* _res_ptr = untag_ptr(_res);
19678         CHECK_ACCESS(_res_ptr);
19679         LDKCResult_RoutingFeesDecodeErrorZ _res_conv = *(LDKCResult_RoutingFeesDecodeErrorZ*)(_res_ptr);
19680         FREE(untag_ptr(_res));
19681         CResult_RoutingFeesDecodeErrorZ_free(_res_conv);
19682 }
19683
19684 static inline uint64_t CResult_RoutingFeesDecodeErrorZ_clone_ptr(LDKCResult_RoutingFeesDecodeErrorZ *NONNULL_PTR arg) {
19685         LDKCResult_RoutingFeesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RoutingFeesDecodeErrorZ), "LDKCResult_RoutingFeesDecodeErrorZ");
19686         *ret_conv = CResult_RoutingFeesDecodeErrorZ_clone(arg);
19687         return tag_ptr(ret_conv, true);
19688 }
19689 int64_t  __attribute__((export_name("TS_CResult_RoutingFeesDecodeErrorZ_clone_ptr"))) TS_CResult_RoutingFeesDecodeErrorZ_clone_ptr(uint64_t arg) {
19690         LDKCResult_RoutingFeesDecodeErrorZ* arg_conv = (LDKCResult_RoutingFeesDecodeErrorZ*)untag_ptr(arg);
19691         int64_t ret_conv = CResult_RoutingFeesDecodeErrorZ_clone_ptr(arg_conv);
19692         return ret_conv;
19693 }
19694
19695 uint64_t  __attribute__((export_name("TS_CResult_RoutingFeesDecodeErrorZ_clone"))) TS_CResult_RoutingFeesDecodeErrorZ_clone(uint64_t orig) {
19696         LDKCResult_RoutingFeesDecodeErrorZ* orig_conv = (LDKCResult_RoutingFeesDecodeErrorZ*)untag_ptr(orig);
19697         LDKCResult_RoutingFeesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RoutingFeesDecodeErrorZ), "LDKCResult_RoutingFeesDecodeErrorZ");
19698         *ret_conv = CResult_RoutingFeesDecodeErrorZ_clone(orig_conv);
19699         return tag_ptr(ret_conv, true);
19700 }
19701
19702 void  __attribute__((export_name("TS_CVec_SocketAddressZ_free"))) TS_CVec_SocketAddressZ_free(uint64_tArray _res) {
19703         LDKCVec_SocketAddressZ _res_constr;
19704         _res_constr.datalen = _res->arr_len;
19705         if (_res_constr.datalen > 0)
19706                 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKSocketAddress), "LDKCVec_SocketAddressZ Elements");
19707         else
19708                 _res_constr.data = NULL;
19709         uint64_t* _res_vals = _res->elems;
19710         for (size_t p = 0; p < _res_constr.datalen; p++) {
19711                 uint64_t _res_conv_15 = _res_vals[p];
19712                 void* _res_conv_15_ptr = untag_ptr(_res_conv_15);
19713                 CHECK_ACCESS(_res_conv_15_ptr);
19714                 LDKSocketAddress _res_conv_15_conv = *(LDKSocketAddress*)(_res_conv_15_ptr);
19715                 FREE(untag_ptr(_res_conv_15));
19716                 _res_constr.data[p] = _res_conv_15_conv;
19717         }
19718         FREE(_res);
19719         CVec_SocketAddressZ_free(_res_constr);
19720 }
19721
19722 uint64_t  __attribute__((export_name("TS_CResult_NodeAnnouncementInfoDecodeErrorZ_ok"))) TS_CResult_NodeAnnouncementInfoDecodeErrorZ_ok(uint64_t o) {
19723         LDKNodeAnnouncementInfo o_conv;
19724         o_conv.inner = untag_ptr(o);
19725         o_conv.is_owned = ptr_is_owned(o);
19726         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
19727         o_conv = NodeAnnouncementInfo_clone(&o_conv);
19728         LDKCResult_NodeAnnouncementInfoDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NodeAnnouncementInfoDecodeErrorZ), "LDKCResult_NodeAnnouncementInfoDecodeErrorZ");
19729         *ret_conv = CResult_NodeAnnouncementInfoDecodeErrorZ_ok(o_conv);
19730         return tag_ptr(ret_conv, true);
19731 }
19732
19733 uint64_t  __attribute__((export_name("TS_CResult_NodeAnnouncementInfoDecodeErrorZ_err"))) TS_CResult_NodeAnnouncementInfoDecodeErrorZ_err(uint64_t e) {
19734         void* e_ptr = untag_ptr(e);
19735         CHECK_ACCESS(e_ptr);
19736         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
19737         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
19738         LDKCResult_NodeAnnouncementInfoDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NodeAnnouncementInfoDecodeErrorZ), "LDKCResult_NodeAnnouncementInfoDecodeErrorZ");
19739         *ret_conv = CResult_NodeAnnouncementInfoDecodeErrorZ_err(e_conv);
19740         return tag_ptr(ret_conv, true);
19741 }
19742
19743 jboolean  __attribute__((export_name("TS_CResult_NodeAnnouncementInfoDecodeErrorZ_is_ok"))) TS_CResult_NodeAnnouncementInfoDecodeErrorZ_is_ok(uint64_t o) {
19744         LDKCResult_NodeAnnouncementInfoDecodeErrorZ* o_conv = (LDKCResult_NodeAnnouncementInfoDecodeErrorZ*)untag_ptr(o);
19745         jboolean ret_conv = CResult_NodeAnnouncementInfoDecodeErrorZ_is_ok(o_conv);
19746         return ret_conv;
19747 }
19748
19749 void  __attribute__((export_name("TS_CResult_NodeAnnouncementInfoDecodeErrorZ_free"))) TS_CResult_NodeAnnouncementInfoDecodeErrorZ_free(uint64_t _res) {
19750         if (!ptr_is_owned(_res)) return;
19751         void* _res_ptr = untag_ptr(_res);
19752         CHECK_ACCESS(_res_ptr);
19753         LDKCResult_NodeAnnouncementInfoDecodeErrorZ _res_conv = *(LDKCResult_NodeAnnouncementInfoDecodeErrorZ*)(_res_ptr);
19754         FREE(untag_ptr(_res));
19755         CResult_NodeAnnouncementInfoDecodeErrorZ_free(_res_conv);
19756 }
19757
19758 static inline uint64_t CResult_NodeAnnouncementInfoDecodeErrorZ_clone_ptr(LDKCResult_NodeAnnouncementInfoDecodeErrorZ *NONNULL_PTR arg) {
19759         LDKCResult_NodeAnnouncementInfoDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NodeAnnouncementInfoDecodeErrorZ), "LDKCResult_NodeAnnouncementInfoDecodeErrorZ");
19760         *ret_conv = CResult_NodeAnnouncementInfoDecodeErrorZ_clone(arg);
19761         return tag_ptr(ret_conv, true);
19762 }
19763 int64_t  __attribute__((export_name("TS_CResult_NodeAnnouncementInfoDecodeErrorZ_clone_ptr"))) TS_CResult_NodeAnnouncementInfoDecodeErrorZ_clone_ptr(uint64_t arg) {
19764         LDKCResult_NodeAnnouncementInfoDecodeErrorZ* arg_conv = (LDKCResult_NodeAnnouncementInfoDecodeErrorZ*)untag_ptr(arg);
19765         int64_t ret_conv = CResult_NodeAnnouncementInfoDecodeErrorZ_clone_ptr(arg_conv);
19766         return ret_conv;
19767 }
19768
19769 uint64_t  __attribute__((export_name("TS_CResult_NodeAnnouncementInfoDecodeErrorZ_clone"))) TS_CResult_NodeAnnouncementInfoDecodeErrorZ_clone(uint64_t orig) {
19770         LDKCResult_NodeAnnouncementInfoDecodeErrorZ* orig_conv = (LDKCResult_NodeAnnouncementInfoDecodeErrorZ*)untag_ptr(orig);
19771         LDKCResult_NodeAnnouncementInfoDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NodeAnnouncementInfoDecodeErrorZ), "LDKCResult_NodeAnnouncementInfoDecodeErrorZ");
19772         *ret_conv = CResult_NodeAnnouncementInfoDecodeErrorZ_clone(orig_conv);
19773         return tag_ptr(ret_conv, true);
19774 }
19775
19776 uint64_t  __attribute__((export_name("TS_CResult_NodeAliasDecodeErrorZ_ok"))) TS_CResult_NodeAliasDecodeErrorZ_ok(uint64_t o) {
19777         LDKNodeAlias o_conv;
19778         o_conv.inner = untag_ptr(o);
19779         o_conv.is_owned = ptr_is_owned(o);
19780         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
19781         o_conv = NodeAlias_clone(&o_conv);
19782         LDKCResult_NodeAliasDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NodeAliasDecodeErrorZ), "LDKCResult_NodeAliasDecodeErrorZ");
19783         *ret_conv = CResult_NodeAliasDecodeErrorZ_ok(o_conv);
19784         return tag_ptr(ret_conv, true);
19785 }
19786
19787 uint64_t  __attribute__((export_name("TS_CResult_NodeAliasDecodeErrorZ_err"))) TS_CResult_NodeAliasDecodeErrorZ_err(uint64_t e) {
19788         void* e_ptr = untag_ptr(e);
19789         CHECK_ACCESS(e_ptr);
19790         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
19791         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
19792         LDKCResult_NodeAliasDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NodeAliasDecodeErrorZ), "LDKCResult_NodeAliasDecodeErrorZ");
19793         *ret_conv = CResult_NodeAliasDecodeErrorZ_err(e_conv);
19794         return tag_ptr(ret_conv, true);
19795 }
19796
19797 jboolean  __attribute__((export_name("TS_CResult_NodeAliasDecodeErrorZ_is_ok"))) TS_CResult_NodeAliasDecodeErrorZ_is_ok(uint64_t o) {
19798         LDKCResult_NodeAliasDecodeErrorZ* o_conv = (LDKCResult_NodeAliasDecodeErrorZ*)untag_ptr(o);
19799         jboolean ret_conv = CResult_NodeAliasDecodeErrorZ_is_ok(o_conv);
19800         return ret_conv;
19801 }
19802
19803 void  __attribute__((export_name("TS_CResult_NodeAliasDecodeErrorZ_free"))) TS_CResult_NodeAliasDecodeErrorZ_free(uint64_t _res) {
19804         if (!ptr_is_owned(_res)) return;
19805         void* _res_ptr = untag_ptr(_res);
19806         CHECK_ACCESS(_res_ptr);
19807         LDKCResult_NodeAliasDecodeErrorZ _res_conv = *(LDKCResult_NodeAliasDecodeErrorZ*)(_res_ptr);
19808         FREE(untag_ptr(_res));
19809         CResult_NodeAliasDecodeErrorZ_free(_res_conv);
19810 }
19811
19812 static inline uint64_t CResult_NodeAliasDecodeErrorZ_clone_ptr(LDKCResult_NodeAliasDecodeErrorZ *NONNULL_PTR arg) {
19813         LDKCResult_NodeAliasDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NodeAliasDecodeErrorZ), "LDKCResult_NodeAliasDecodeErrorZ");
19814         *ret_conv = CResult_NodeAliasDecodeErrorZ_clone(arg);
19815         return tag_ptr(ret_conv, true);
19816 }
19817 int64_t  __attribute__((export_name("TS_CResult_NodeAliasDecodeErrorZ_clone_ptr"))) TS_CResult_NodeAliasDecodeErrorZ_clone_ptr(uint64_t arg) {
19818         LDKCResult_NodeAliasDecodeErrorZ* arg_conv = (LDKCResult_NodeAliasDecodeErrorZ*)untag_ptr(arg);
19819         int64_t ret_conv = CResult_NodeAliasDecodeErrorZ_clone_ptr(arg_conv);
19820         return ret_conv;
19821 }
19822
19823 uint64_t  __attribute__((export_name("TS_CResult_NodeAliasDecodeErrorZ_clone"))) TS_CResult_NodeAliasDecodeErrorZ_clone(uint64_t orig) {
19824         LDKCResult_NodeAliasDecodeErrorZ* orig_conv = (LDKCResult_NodeAliasDecodeErrorZ*)untag_ptr(orig);
19825         LDKCResult_NodeAliasDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NodeAliasDecodeErrorZ), "LDKCResult_NodeAliasDecodeErrorZ");
19826         *ret_conv = CResult_NodeAliasDecodeErrorZ_clone(orig_conv);
19827         return tag_ptr(ret_conv, true);
19828 }
19829
19830 uint64_t  __attribute__((export_name("TS_CResult_NodeInfoDecodeErrorZ_ok"))) TS_CResult_NodeInfoDecodeErrorZ_ok(uint64_t o) {
19831         LDKNodeInfo o_conv;
19832         o_conv.inner = untag_ptr(o);
19833         o_conv.is_owned = ptr_is_owned(o);
19834         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
19835         o_conv = NodeInfo_clone(&o_conv);
19836         LDKCResult_NodeInfoDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NodeInfoDecodeErrorZ), "LDKCResult_NodeInfoDecodeErrorZ");
19837         *ret_conv = CResult_NodeInfoDecodeErrorZ_ok(o_conv);
19838         return tag_ptr(ret_conv, true);
19839 }
19840
19841 uint64_t  __attribute__((export_name("TS_CResult_NodeInfoDecodeErrorZ_err"))) TS_CResult_NodeInfoDecodeErrorZ_err(uint64_t e) {
19842         void* e_ptr = untag_ptr(e);
19843         CHECK_ACCESS(e_ptr);
19844         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
19845         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
19846         LDKCResult_NodeInfoDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NodeInfoDecodeErrorZ), "LDKCResult_NodeInfoDecodeErrorZ");
19847         *ret_conv = CResult_NodeInfoDecodeErrorZ_err(e_conv);
19848         return tag_ptr(ret_conv, true);
19849 }
19850
19851 jboolean  __attribute__((export_name("TS_CResult_NodeInfoDecodeErrorZ_is_ok"))) TS_CResult_NodeInfoDecodeErrorZ_is_ok(uint64_t o) {
19852         LDKCResult_NodeInfoDecodeErrorZ* o_conv = (LDKCResult_NodeInfoDecodeErrorZ*)untag_ptr(o);
19853         jboolean ret_conv = CResult_NodeInfoDecodeErrorZ_is_ok(o_conv);
19854         return ret_conv;
19855 }
19856
19857 void  __attribute__((export_name("TS_CResult_NodeInfoDecodeErrorZ_free"))) TS_CResult_NodeInfoDecodeErrorZ_free(uint64_t _res) {
19858         if (!ptr_is_owned(_res)) return;
19859         void* _res_ptr = untag_ptr(_res);
19860         CHECK_ACCESS(_res_ptr);
19861         LDKCResult_NodeInfoDecodeErrorZ _res_conv = *(LDKCResult_NodeInfoDecodeErrorZ*)(_res_ptr);
19862         FREE(untag_ptr(_res));
19863         CResult_NodeInfoDecodeErrorZ_free(_res_conv);
19864 }
19865
19866 static inline uint64_t CResult_NodeInfoDecodeErrorZ_clone_ptr(LDKCResult_NodeInfoDecodeErrorZ *NONNULL_PTR arg) {
19867         LDKCResult_NodeInfoDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NodeInfoDecodeErrorZ), "LDKCResult_NodeInfoDecodeErrorZ");
19868         *ret_conv = CResult_NodeInfoDecodeErrorZ_clone(arg);
19869         return tag_ptr(ret_conv, true);
19870 }
19871 int64_t  __attribute__((export_name("TS_CResult_NodeInfoDecodeErrorZ_clone_ptr"))) TS_CResult_NodeInfoDecodeErrorZ_clone_ptr(uint64_t arg) {
19872         LDKCResult_NodeInfoDecodeErrorZ* arg_conv = (LDKCResult_NodeInfoDecodeErrorZ*)untag_ptr(arg);
19873         int64_t ret_conv = CResult_NodeInfoDecodeErrorZ_clone_ptr(arg_conv);
19874         return ret_conv;
19875 }
19876
19877 uint64_t  __attribute__((export_name("TS_CResult_NodeInfoDecodeErrorZ_clone"))) TS_CResult_NodeInfoDecodeErrorZ_clone(uint64_t orig) {
19878         LDKCResult_NodeInfoDecodeErrorZ* orig_conv = (LDKCResult_NodeInfoDecodeErrorZ*)untag_ptr(orig);
19879         LDKCResult_NodeInfoDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NodeInfoDecodeErrorZ), "LDKCResult_NodeInfoDecodeErrorZ");
19880         *ret_conv = CResult_NodeInfoDecodeErrorZ_clone(orig_conv);
19881         return tag_ptr(ret_conv, true);
19882 }
19883
19884 uint64_t  __attribute__((export_name("TS_CResult_NetworkGraphDecodeErrorZ_ok"))) TS_CResult_NetworkGraphDecodeErrorZ_ok(uint64_t o) {
19885         LDKNetworkGraph o_conv;
19886         o_conv.inner = untag_ptr(o);
19887         o_conv.is_owned = ptr_is_owned(o);
19888         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
19889         // WARNING: we need a move here but no clone is available for LDKNetworkGraph
19890         
19891         LDKCResult_NetworkGraphDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NetworkGraphDecodeErrorZ), "LDKCResult_NetworkGraphDecodeErrorZ");
19892         *ret_conv = CResult_NetworkGraphDecodeErrorZ_ok(o_conv);
19893         return tag_ptr(ret_conv, true);
19894 }
19895
19896 uint64_t  __attribute__((export_name("TS_CResult_NetworkGraphDecodeErrorZ_err"))) TS_CResult_NetworkGraphDecodeErrorZ_err(uint64_t e) {
19897         void* e_ptr = untag_ptr(e);
19898         CHECK_ACCESS(e_ptr);
19899         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
19900         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
19901         LDKCResult_NetworkGraphDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NetworkGraphDecodeErrorZ), "LDKCResult_NetworkGraphDecodeErrorZ");
19902         *ret_conv = CResult_NetworkGraphDecodeErrorZ_err(e_conv);
19903         return tag_ptr(ret_conv, true);
19904 }
19905
19906 jboolean  __attribute__((export_name("TS_CResult_NetworkGraphDecodeErrorZ_is_ok"))) TS_CResult_NetworkGraphDecodeErrorZ_is_ok(uint64_t o) {
19907         LDKCResult_NetworkGraphDecodeErrorZ* o_conv = (LDKCResult_NetworkGraphDecodeErrorZ*)untag_ptr(o);
19908         jboolean ret_conv = CResult_NetworkGraphDecodeErrorZ_is_ok(o_conv);
19909         return ret_conv;
19910 }
19911
19912 void  __attribute__((export_name("TS_CResult_NetworkGraphDecodeErrorZ_free"))) TS_CResult_NetworkGraphDecodeErrorZ_free(uint64_t _res) {
19913         if (!ptr_is_owned(_res)) return;
19914         void* _res_ptr = untag_ptr(_res);
19915         CHECK_ACCESS(_res_ptr);
19916         LDKCResult_NetworkGraphDecodeErrorZ _res_conv = *(LDKCResult_NetworkGraphDecodeErrorZ*)(_res_ptr);
19917         FREE(untag_ptr(_res));
19918         CResult_NetworkGraphDecodeErrorZ_free(_res_conv);
19919 }
19920
19921 uint64_t  __attribute__((export_name("TS_COption_CVec_SocketAddressZZ_some"))) TS_COption_CVec_SocketAddressZZ_some(uint64_tArray o) {
19922         LDKCVec_SocketAddressZ o_constr;
19923         o_constr.datalen = o->arr_len;
19924         if (o_constr.datalen > 0)
19925                 o_constr.data = MALLOC(o_constr.datalen * sizeof(LDKSocketAddress), "LDKCVec_SocketAddressZ Elements");
19926         else
19927                 o_constr.data = NULL;
19928         uint64_t* o_vals = o->elems;
19929         for (size_t p = 0; p < o_constr.datalen; p++) {
19930                 uint64_t o_conv_15 = o_vals[p];
19931                 void* o_conv_15_ptr = untag_ptr(o_conv_15);
19932                 CHECK_ACCESS(o_conv_15_ptr);
19933                 LDKSocketAddress o_conv_15_conv = *(LDKSocketAddress*)(o_conv_15_ptr);
19934                 o_conv_15_conv = SocketAddress_clone((LDKSocketAddress*)untag_ptr(o_conv_15));
19935                 o_constr.data[p] = o_conv_15_conv;
19936         }
19937         FREE(o);
19938         LDKCOption_CVec_SocketAddressZZ *ret_copy = MALLOC(sizeof(LDKCOption_CVec_SocketAddressZZ), "LDKCOption_CVec_SocketAddressZZ");
19939         *ret_copy = COption_CVec_SocketAddressZZ_some(o_constr);
19940         uint64_t ret_ref = tag_ptr(ret_copy, true);
19941         return ret_ref;
19942 }
19943
19944 uint64_t  __attribute__((export_name("TS_COption_CVec_SocketAddressZZ_none"))) TS_COption_CVec_SocketAddressZZ_none() {
19945         LDKCOption_CVec_SocketAddressZZ *ret_copy = MALLOC(sizeof(LDKCOption_CVec_SocketAddressZZ), "LDKCOption_CVec_SocketAddressZZ");
19946         *ret_copy = COption_CVec_SocketAddressZZ_none();
19947         uint64_t ret_ref = tag_ptr(ret_copy, true);
19948         return ret_ref;
19949 }
19950
19951 void  __attribute__((export_name("TS_COption_CVec_SocketAddressZZ_free"))) TS_COption_CVec_SocketAddressZZ_free(uint64_t _res) {
19952         if (!ptr_is_owned(_res)) return;
19953         void* _res_ptr = untag_ptr(_res);
19954         CHECK_ACCESS(_res_ptr);
19955         LDKCOption_CVec_SocketAddressZZ _res_conv = *(LDKCOption_CVec_SocketAddressZZ*)(_res_ptr);
19956         FREE(untag_ptr(_res));
19957         COption_CVec_SocketAddressZZ_free(_res_conv);
19958 }
19959
19960 static inline uint64_t COption_CVec_SocketAddressZZ_clone_ptr(LDKCOption_CVec_SocketAddressZZ *NONNULL_PTR arg) {
19961         LDKCOption_CVec_SocketAddressZZ *ret_copy = MALLOC(sizeof(LDKCOption_CVec_SocketAddressZZ), "LDKCOption_CVec_SocketAddressZZ");
19962         *ret_copy = COption_CVec_SocketAddressZZ_clone(arg);
19963         uint64_t ret_ref = tag_ptr(ret_copy, true);
19964         return ret_ref;
19965 }
19966 int64_t  __attribute__((export_name("TS_COption_CVec_SocketAddressZZ_clone_ptr"))) TS_COption_CVec_SocketAddressZZ_clone_ptr(uint64_t arg) {
19967         LDKCOption_CVec_SocketAddressZZ* arg_conv = (LDKCOption_CVec_SocketAddressZZ*)untag_ptr(arg);
19968         int64_t ret_conv = COption_CVec_SocketAddressZZ_clone_ptr(arg_conv);
19969         return ret_conv;
19970 }
19971
19972 uint64_t  __attribute__((export_name("TS_COption_CVec_SocketAddressZZ_clone"))) TS_COption_CVec_SocketAddressZZ_clone(uint64_t orig) {
19973         LDKCOption_CVec_SocketAddressZZ* orig_conv = (LDKCOption_CVec_SocketAddressZZ*)untag_ptr(orig);
19974         LDKCOption_CVec_SocketAddressZZ *ret_copy = MALLOC(sizeof(LDKCOption_CVec_SocketAddressZZ), "LDKCOption_CVec_SocketAddressZZ");
19975         *ret_copy = COption_CVec_SocketAddressZZ_clone(orig_conv);
19976         uint64_t ret_ref = tag_ptr(ret_copy, true);
19977         return ret_ref;
19978 }
19979
19980 void  __attribute__((export_name("TS_CVec_HTLCOutputInCommitmentZ_free"))) TS_CVec_HTLCOutputInCommitmentZ_free(uint64_tArray _res) {
19981         LDKCVec_HTLCOutputInCommitmentZ _res_constr;
19982         _res_constr.datalen = _res->arr_len;
19983         if (_res_constr.datalen > 0)
19984                 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKHTLCOutputInCommitment), "LDKCVec_HTLCOutputInCommitmentZ Elements");
19985         else
19986                 _res_constr.data = NULL;
19987         uint64_t* _res_vals = _res->elems;
19988         for (size_t y = 0; y < _res_constr.datalen; y++) {
19989                 uint64_t _res_conv_24 = _res_vals[y];
19990                 LDKHTLCOutputInCommitment _res_conv_24_conv;
19991                 _res_conv_24_conv.inner = untag_ptr(_res_conv_24);
19992                 _res_conv_24_conv.is_owned = ptr_is_owned(_res_conv_24);
19993                 CHECK_INNER_FIELD_ACCESS_OR_NULL(_res_conv_24_conv);
19994                 _res_constr.data[y] = _res_conv_24_conv;
19995         }
19996         FREE(_res);
19997         CVec_HTLCOutputInCommitmentZ_free(_res_constr);
19998 }
19999
20000 void  __attribute__((export_name("TS_CVec_HTLCDescriptorZ_free"))) TS_CVec_HTLCDescriptorZ_free(uint64_tArray _res) {
20001         LDKCVec_HTLCDescriptorZ _res_constr;
20002         _res_constr.datalen = _res->arr_len;
20003         if (_res_constr.datalen > 0)
20004                 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKHTLCDescriptor), "LDKCVec_HTLCDescriptorZ Elements");
20005         else
20006                 _res_constr.data = NULL;
20007         uint64_t* _res_vals = _res->elems;
20008         for (size_t q = 0; q < _res_constr.datalen; q++) {
20009                 uint64_t _res_conv_16 = _res_vals[q];
20010                 LDKHTLCDescriptor _res_conv_16_conv;
20011                 _res_conv_16_conv.inner = untag_ptr(_res_conv_16);
20012                 _res_conv_16_conv.is_owned = ptr_is_owned(_res_conv_16);
20013                 CHECK_INNER_FIELD_ACCESS_OR_NULL(_res_conv_16_conv);
20014                 _res_constr.data[q] = _res_conv_16_conv;
20015         }
20016         FREE(_res);
20017         CVec_HTLCDescriptorZ_free(_res_constr);
20018 }
20019
20020 void  __attribute__((export_name("TS_CVec_UtxoZ_free"))) TS_CVec_UtxoZ_free(uint64_tArray _res) {
20021         LDKCVec_UtxoZ _res_constr;
20022         _res_constr.datalen = _res->arr_len;
20023         if (_res_constr.datalen > 0)
20024                 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKUtxo), "LDKCVec_UtxoZ Elements");
20025         else
20026                 _res_constr.data = NULL;
20027         uint64_t* _res_vals = _res->elems;
20028         for (size_t g = 0; g < _res_constr.datalen; g++) {
20029                 uint64_t _res_conv_6 = _res_vals[g];
20030                 LDKUtxo _res_conv_6_conv;
20031                 _res_conv_6_conv.inner = untag_ptr(_res_conv_6);
20032                 _res_conv_6_conv.is_owned = ptr_is_owned(_res_conv_6);
20033                 CHECK_INNER_FIELD_ACCESS_OR_NULL(_res_conv_6_conv);
20034                 _res_constr.data[g] = _res_conv_6_conv;
20035         }
20036         FREE(_res);
20037         CVec_UtxoZ_free(_res_constr);
20038 }
20039
20040 uint64_t  __attribute__((export_name("TS_COption_TxOutZ_some"))) TS_COption_TxOutZ_some(uint64_t o) {
20041         void* o_ptr = untag_ptr(o);
20042         CHECK_ACCESS(o_ptr);
20043         LDKTxOut o_conv = *(LDKTxOut*)(o_ptr);
20044         o_conv = TxOut_clone((LDKTxOut*)untag_ptr(o));
20045         LDKCOption_TxOutZ *ret_copy = MALLOC(sizeof(LDKCOption_TxOutZ), "LDKCOption_TxOutZ");
20046         *ret_copy = COption_TxOutZ_some(o_conv);
20047         uint64_t ret_ref = tag_ptr(ret_copy, true);
20048         return ret_ref;
20049 }
20050
20051 uint64_t  __attribute__((export_name("TS_COption_TxOutZ_none"))) TS_COption_TxOutZ_none() {
20052         LDKCOption_TxOutZ *ret_copy = MALLOC(sizeof(LDKCOption_TxOutZ), "LDKCOption_TxOutZ");
20053         *ret_copy = COption_TxOutZ_none();
20054         uint64_t ret_ref = tag_ptr(ret_copy, true);
20055         return ret_ref;
20056 }
20057
20058 void  __attribute__((export_name("TS_COption_TxOutZ_free"))) TS_COption_TxOutZ_free(uint64_t _res) {
20059         if (!ptr_is_owned(_res)) return;
20060         void* _res_ptr = untag_ptr(_res);
20061         CHECK_ACCESS(_res_ptr);
20062         LDKCOption_TxOutZ _res_conv = *(LDKCOption_TxOutZ*)(_res_ptr);
20063         FREE(untag_ptr(_res));
20064         COption_TxOutZ_free(_res_conv);
20065 }
20066
20067 static inline uint64_t COption_TxOutZ_clone_ptr(LDKCOption_TxOutZ *NONNULL_PTR arg) {
20068         LDKCOption_TxOutZ *ret_copy = MALLOC(sizeof(LDKCOption_TxOutZ), "LDKCOption_TxOutZ");
20069         *ret_copy = COption_TxOutZ_clone(arg);
20070         uint64_t ret_ref = tag_ptr(ret_copy, true);
20071         return ret_ref;
20072 }
20073 int64_t  __attribute__((export_name("TS_COption_TxOutZ_clone_ptr"))) TS_COption_TxOutZ_clone_ptr(uint64_t arg) {
20074         LDKCOption_TxOutZ* arg_conv = (LDKCOption_TxOutZ*)untag_ptr(arg);
20075         int64_t ret_conv = COption_TxOutZ_clone_ptr(arg_conv);
20076         return ret_conv;
20077 }
20078
20079 uint64_t  __attribute__((export_name("TS_COption_TxOutZ_clone"))) TS_COption_TxOutZ_clone(uint64_t orig) {
20080         LDKCOption_TxOutZ* orig_conv = (LDKCOption_TxOutZ*)untag_ptr(orig);
20081         LDKCOption_TxOutZ *ret_copy = MALLOC(sizeof(LDKCOption_TxOutZ), "LDKCOption_TxOutZ");
20082         *ret_copy = COption_TxOutZ_clone(orig_conv);
20083         uint64_t ret_ref = tag_ptr(ret_copy, true);
20084         return ret_ref;
20085 }
20086
20087 void  __attribute__((export_name("TS_CVec_InputZ_free"))) TS_CVec_InputZ_free(uint64_tArray _res) {
20088         LDKCVec_InputZ _res_constr;
20089         _res_constr.datalen = _res->arr_len;
20090         if (_res_constr.datalen > 0)
20091                 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKInput), "LDKCVec_InputZ Elements");
20092         else
20093                 _res_constr.data = NULL;
20094         uint64_t* _res_vals = _res->elems;
20095         for (size_t h = 0; h < _res_constr.datalen; h++) {
20096                 uint64_t _res_conv_7 = _res_vals[h];
20097                 LDKInput _res_conv_7_conv;
20098                 _res_conv_7_conv.inner = untag_ptr(_res_conv_7);
20099                 _res_conv_7_conv.is_owned = ptr_is_owned(_res_conv_7);
20100                 CHECK_INNER_FIELD_ACCESS_OR_NULL(_res_conv_7_conv);
20101                 _res_constr.data[h] = _res_conv_7_conv;
20102         }
20103         FREE(_res);
20104         CVec_InputZ_free(_res_constr);
20105 }
20106
20107 uint64_t  __attribute__((export_name("TS_CResult_CoinSelectionNoneZ_ok"))) TS_CResult_CoinSelectionNoneZ_ok(uint64_t o) {
20108         LDKCoinSelection o_conv;
20109         o_conv.inner = untag_ptr(o);
20110         o_conv.is_owned = ptr_is_owned(o);
20111         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
20112         o_conv = CoinSelection_clone(&o_conv);
20113         LDKCResult_CoinSelectionNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_CoinSelectionNoneZ), "LDKCResult_CoinSelectionNoneZ");
20114         *ret_conv = CResult_CoinSelectionNoneZ_ok(o_conv);
20115         return tag_ptr(ret_conv, true);
20116 }
20117
20118 uint64_t  __attribute__((export_name("TS_CResult_CoinSelectionNoneZ_err"))) TS_CResult_CoinSelectionNoneZ_err() {
20119         LDKCResult_CoinSelectionNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_CoinSelectionNoneZ), "LDKCResult_CoinSelectionNoneZ");
20120         *ret_conv = CResult_CoinSelectionNoneZ_err();
20121         return tag_ptr(ret_conv, true);
20122 }
20123
20124 jboolean  __attribute__((export_name("TS_CResult_CoinSelectionNoneZ_is_ok"))) TS_CResult_CoinSelectionNoneZ_is_ok(uint64_t o) {
20125         LDKCResult_CoinSelectionNoneZ* o_conv = (LDKCResult_CoinSelectionNoneZ*)untag_ptr(o);
20126         jboolean ret_conv = CResult_CoinSelectionNoneZ_is_ok(o_conv);
20127         return ret_conv;
20128 }
20129
20130 void  __attribute__((export_name("TS_CResult_CoinSelectionNoneZ_free"))) TS_CResult_CoinSelectionNoneZ_free(uint64_t _res) {
20131         if (!ptr_is_owned(_res)) return;
20132         void* _res_ptr = untag_ptr(_res);
20133         CHECK_ACCESS(_res_ptr);
20134         LDKCResult_CoinSelectionNoneZ _res_conv = *(LDKCResult_CoinSelectionNoneZ*)(_res_ptr);
20135         FREE(untag_ptr(_res));
20136         CResult_CoinSelectionNoneZ_free(_res_conv);
20137 }
20138
20139 static inline uint64_t CResult_CoinSelectionNoneZ_clone_ptr(LDKCResult_CoinSelectionNoneZ *NONNULL_PTR arg) {
20140         LDKCResult_CoinSelectionNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_CoinSelectionNoneZ), "LDKCResult_CoinSelectionNoneZ");
20141         *ret_conv = CResult_CoinSelectionNoneZ_clone(arg);
20142         return tag_ptr(ret_conv, true);
20143 }
20144 int64_t  __attribute__((export_name("TS_CResult_CoinSelectionNoneZ_clone_ptr"))) TS_CResult_CoinSelectionNoneZ_clone_ptr(uint64_t arg) {
20145         LDKCResult_CoinSelectionNoneZ* arg_conv = (LDKCResult_CoinSelectionNoneZ*)untag_ptr(arg);
20146         int64_t ret_conv = CResult_CoinSelectionNoneZ_clone_ptr(arg_conv);
20147         return ret_conv;
20148 }
20149
20150 uint64_t  __attribute__((export_name("TS_CResult_CoinSelectionNoneZ_clone"))) TS_CResult_CoinSelectionNoneZ_clone(uint64_t orig) {
20151         LDKCResult_CoinSelectionNoneZ* orig_conv = (LDKCResult_CoinSelectionNoneZ*)untag_ptr(orig);
20152         LDKCResult_CoinSelectionNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_CoinSelectionNoneZ), "LDKCResult_CoinSelectionNoneZ");
20153         *ret_conv = CResult_CoinSelectionNoneZ_clone(orig_conv);
20154         return tag_ptr(ret_conv, true);
20155 }
20156
20157 uint64_t  __attribute__((export_name("TS_CResult_CVec_UtxoZNoneZ_ok"))) TS_CResult_CVec_UtxoZNoneZ_ok(uint64_tArray o) {
20158         LDKCVec_UtxoZ o_constr;
20159         o_constr.datalen = o->arr_len;
20160         if (o_constr.datalen > 0)
20161                 o_constr.data = MALLOC(o_constr.datalen * sizeof(LDKUtxo), "LDKCVec_UtxoZ Elements");
20162         else
20163                 o_constr.data = NULL;
20164         uint64_t* o_vals = o->elems;
20165         for (size_t g = 0; g < o_constr.datalen; g++) {
20166                 uint64_t o_conv_6 = o_vals[g];
20167                 LDKUtxo o_conv_6_conv;
20168                 o_conv_6_conv.inner = untag_ptr(o_conv_6);
20169                 o_conv_6_conv.is_owned = ptr_is_owned(o_conv_6);
20170                 CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv_6_conv);
20171                 o_conv_6_conv = Utxo_clone(&o_conv_6_conv);
20172                 o_constr.data[g] = o_conv_6_conv;
20173         }
20174         FREE(o);
20175         LDKCResult_CVec_UtxoZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_UtxoZNoneZ), "LDKCResult_CVec_UtxoZNoneZ");
20176         *ret_conv = CResult_CVec_UtxoZNoneZ_ok(o_constr);
20177         return tag_ptr(ret_conv, true);
20178 }
20179
20180 uint64_t  __attribute__((export_name("TS_CResult_CVec_UtxoZNoneZ_err"))) TS_CResult_CVec_UtxoZNoneZ_err() {
20181         LDKCResult_CVec_UtxoZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_UtxoZNoneZ), "LDKCResult_CVec_UtxoZNoneZ");
20182         *ret_conv = CResult_CVec_UtxoZNoneZ_err();
20183         return tag_ptr(ret_conv, true);
20184 }
20185
20186 jboolean  __attribute__((export_name("TS_CResult_CVec_UtxoZNoneZ_is_ok"))) TS_CResult_CVec_UtxoZNoneZ_is_ok(uint64_t o) {
20187         LDKCResult_CVec_UtxoZNoneZ* o_conv = (LDKCResult_CVec_UtxoZNoneZ*)untag_ptr(o);
20188         jboolean ret_conv = CResult_CVec_UtxoZNoneZ_is_ok(o_conv);
20189         return ret_conv;
20190 }
20191
20192 void  __attribute__((export_name("TS_CResult_CVec_UtxoZNoneZ_free"))) TS_CResult_CVec_UtxoZNoneZ_free(uint64_t _res) {
20193         if (!ptr_is_owned(_res)) return;
20194         void* _res_ptr = untag_ptr(_res);
20195         CHECK_ACCESS(_res_ptr);
20196         LDKCResult_CVec_UtxoZNoneZ _res_conv = *(LDKCResult_CVec_UtxoZNoneZ*)(_res_ptr);
20197         FREE(untag_ptr(_res));
20198         CResult_CVec_UtxoZNoneZ_free(_res_conv);
20199 }
20200
20201 static inline uint64_t CResult_CVec_UtxoZNoneZ_clone_ptr(LDKCResult_CVec_UtxoZNoneZ *NONNULL_PTR arg) {
20202         LDKCResult_CVec_UtxoZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_UtxoZNoneZ), "LDKCResult_CVec_UtxoZNoneZ");
20203         *ret_conv = CResult_CVec_UtxoZNoneZ_clone(arg);
20204         return tag_ptr(ret_conv, true);
20205 }
20206 int64_t  __attribute__((export_name("TS_CResult_CVec_UtxoZNoneZ_clone_ptr"))) TS_CResult_CVec_UtxoZNoneZ_clone_ptr(uint64_t arg) {
20207         LDKCResult_CVec_UtxoZNoneZ* arg_conv = (LDKCResult_CVec_UtxoZNoneZ*)untag_ptr(arg);
20208         int64_t ret_conv = CResult_CVec_UtxoZNoneZ_clone_ptr(arg_conv);
20209         return ret_conv;
20210 }
20211
20212 uint64_t  __attribute__((export_name("TS_CResult_CVec_UtxoZNoneZ_clone"))) TS_CResult_CVec_UtxoZNoneZ_clone(uint64_t orig) {
20213         LDKCResult_CVec_UtxoZNoneZ* orig_conv = (LDKCResult_CVec_UtxoZNoneZ*)untag_ptr(orig);
20214         LDKCResult_CVec_UtxoZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_UtxoZNoneZ), "LDKCResult_CVec_UtxoZNoneZ");
20215         *ret_conv = CResult_CVec_UtxoZNoneZ_clone(orig_conv);
20216         return tag_ptr(ret_conv, true);
20217 }
20218
20219 static inline uint64_t C2Tuple_u64u16Z_clone_ptr(LDKC2Tuple_u64u16Z *NONNULL_PTR arg) {
20220         LDKC2Tuple_u64u16Z* ret_conv = MALLOC(sizeof(LDKC2Tuple_u64u16Z), "LDKC2Tuple_u64u16Z");
20221         *ret_conv = C2Tuple_u64u16Z_clone(arg);
20222         return tag_ptr(ret_conv, true);
20223 }
20224 int64_t  __attribute__((export_name("TS_C2Tuple_u64u16Z_clone_ptr"))) TS_C2Tuple_u64u16Z_clone_ptr(uint64_t arg) {
20225         LDKC2Tuple_u64u16Z* arg_conv = (LDKC2Tuple_u64u16Z*)untag_ptr(arg);
20226         int64_t ret_conv = C2Tuple_u64u16Z_clone_ptr(arg_conv);
20227         return ret_conv;
20228 }
20229
20230 uint64_t  __attribute__((export_name("TS_C2Tuple_u64u16Z_clone"))) TS_C2Tuple_u64u16Z_clone(uint64_t orig) {
20231         LDKC2Tuple_u64u16Z* orig_conv = (LDKC2Tuple_u64u16Z*)untag_ptr(orig);
20232         LDKC2Tuple_u64u16Z* ret_conv = MALLOC(sizeof(LDKC2Tuple_u64u16Z), "LDKC2Tuple_u64u16Z");
20233         *ret_conv = C2Tuple_u64u16Z_clone(orig_conv);
20234         return tag_ptr(ret_conv, true);
20235 }
20236
20237 uint64_t  __attribute__((export_name("TS_C2Tuple_u64u16Z_new"))) TS_C2Tuple_u64u16Z_new(int64_t a, int16_t b) {
20238         LDKC2Tuple_u64u16Z* ret_conv = MALLOC(sizeof(LDKC2Tuple_u64u16Z), "LDKC2Tuple_u64u16Z");
20239         *ret_conv = C2Tuple_u64u16Z_new(a, b);
20240         return tag_ptr(ret_conv, true);
20241 }
20242
20243 void  __attribute__((export_name("TS_C2Tuple_u64u16Z_free"))) TS_C2Tuple_u64u16Z_free(uint64_t _res) {
20244         if (!ptr_is_owned(_res)) return;
20245         void* _res_ptr = untag_ptr(_res);
20246         CHECK_ACCESS(_res_ptr);
20247         LDKC2Tuple_u64u16Z _res_conv = *(LDKC2Tuple_u64u16Z*)(_res_ptr);
20248         FREE(untag_ptr(_res));
20249         C2Tuple_u64u16Z_free(_res_conv);
20250 }
20251
20252 uint64_t  __attribute__((export_name("TS_COption_C2Tuple_u64u16ZZ_some"))) TS_COption_C2Tuple_u64u16ZZ_some(uint64_t o) {
20253         void* o_ptr = untag_ptr(o);
20254         CHECK_ACCESS(o_ptr);
20255         LDKC2Tuple_u64u16Z o_conv = *(LDKC2Tuple_u64u16Z*)(o_ptr);
20256         o_conv = C2Tuple_u64u16Z_clone((LDKC2Tuple_u64u16Z*)untag_ptr(o));
20257         LDKCOption_C2Tuple_u64u16ZZ *ret_copy = MALLOC(sizeof(LDKCOption_C2Tuple_u64u16ZZ), "LDKCOption_C2Tuple_u64u16ZZ");
20258         *ret_copy = COption_C2Tuple_u64u16ZZ_some(o_conv);
20259         uint64_t ret_ref = tag_ptr(ret_copy, true);
20260         return ret_ref;
20261 }
20262
20263 uint64_t  __attribute__((export_name("TS_COption_C2Tuple_u64u16ZZ_none"))) TS_COption_C2Tuple_u64u16ZZ_none() {
20264         LDKCOption_C2Tuple_u64u16ZZ *ret_copy = MALLOC(sizeof(LDKCOption_C2Tuple_u64u16ZZ), "LDKCOption_C2Tuple_u64u16ZZ");
20265         *ret_copy = COption_C2Tuple_u64u16ZZ_none();
20266         uint64_t ret_ref = tag_ptr(ret_copy, true);
20267         return ret_ref;
20268 }
20269
20270 void  __attribute__((export_name("TS_COption_C2Tuple_u64u16ZZ_free"))) TS_COption_C2Tuple_u64u16ZZ_free(uint64_t _res) {
20271         if (!ptr_is_owned(_res)) return;
20272         void* _res_ptr = untag_ptr(_res);
20273         CHECK_ACCESS(_res_ptr);
20274         LDKCOption_C2Tuple_u64u16ZZ _res_conv = *(LDKCOption_C2Tuple_u64u16ZZ*)(_res_ptr);
20275         FREE(untag_ptr(_res));
20276         COption_C2Tuple_u64u16ZZ_free(_res_conv);
20277 }
20278
20279 static inline uint64_t COption_C2Tuple_u64u16ZZ_clone_ptr(LDKCOption_C2Tuple_u64u16ZZ *NONNULL_PTR arg) {
20280         LDKCOption_C2Tuple_u64u16ZZ *ret_copy = MALLOC(sizeof(LDKCOption_C2Tuple_u64u16ZZ), "LDKCOption_C2Tuple_u64u16ZZ");
20281         *ret_copy = COption_C2Tuple_u64u16ZZ_clone(arg);
20282         uint64_t ret_ref = tag_ptr(ret_copy, true);
20283         return ret_ref;
20284 }
20285 int64_t  __attribute__((export_name("TS_COption_C2Tuple_u64u16ZZ_clone_ptr"))) TS_COption_C2Tuple_u64u16ZZ_clone_ptr(uint64_t arg) {
20286         LDKCOption_C2Tuple_u64u16ZZ* arg_conv = (LDKCOption_C2Tuple_u64u16ZZ*)untag_ptr(arg);
20287         int64_t ret_conv = COption_C2Tuple_u64u16ZZ_clone_ptr(arg_conv);
20288         return ret_conv;
20289 }
20290
20291 uint64_t  __attribute__((export_name("TS_COption_C2Tuple_u64u16ZZ_clone"))) TS_COption_C2Tuple_u64u16ZZ_clone(uint64_t orig) {
20292         LDKCOption_C2Tuple_u64u16ZZ* orig_conv = (LDKCOption_C2Tuple_u64u16ZZ*)untag_ptr(orig);
20293         LDKCOption_C2Tuple_u64u16ZZ *ret_copy = MALLOC(sizeof(LDKCOption_C2Tuple_u64u16ZZ), "LDKCOption_C2Tuple_u64u16ZZ");
20294         *ret_copy = COption_C2Tuple_u64u16ZZ_clone(orig_conv);
20295         uint64_t ret_ref = tag_ptr(ret_copy, true);
20296         return ret_ref;
20297 }
20298
20299 uint64_t  __attribute__((export_name("TS_COption_ChannelShutdownStateZ_some"))) TS_COption_ChannelShutdownStateZ_some(uint32_t o) {
20300         LDKChannelShutdownState o_conv = LDKChannelShutdownState_from_js(o);
20301         LDKCOption_ChannelShutdownStateZ *ret_copy = MALLOC(sizeof(LDKCOption_ChannelShutdownStateZ), "LDKCOption_ChannelShutdownStateZ");
20302         *ret_copy = COption_ChannelShutdownStateZ_some(o_conv);
20303         uint64_t ret_ref = tag_ptr(ret_copy, true);
20304         return ret_ref;
20305 }
20306
20307 uint64_t  __attribute__((export_name("TS_COption_ChannelShutdownStateZ_none"))) TS_COption_ChannelShutdownStateZ_none() {
20308         LDKCOption_ChannelShutdownStateZ *ret_copy = MALLOC(sizeof(LDKCOption_ChannelShutdownStateZ), "LDKCOption_ChannelShutdownStateZ");
20309         *ret_copy = COption_ChannelShutdownStateZ_none();
20310         uint64_t ret_ref = tag_ptr(ret_copy, true);
20311         return ret_ref;
20312 }
20313
20314 void  __attribute__((export_name("TS_COption_ChannelShutdownStateZ_free"))) TS_COption_ChannelShutdownStateZ_free(uint64_t _res) {
20315         if (!ptr_is_owned(_res)) return;
20316         void* _res_ptr = untag_ptr(_res);
20317         CHECK_ACCESS(_res_ptr);
20318         LDKCOption_ChannelShutdownStateZ _res_conv = *(LDKCOption_ChannelShutdownStateZ*)(_res_ptr);
20319         FREE(untag_ptr(_res));
20320         COption_ChannelShutdownStateZ_free(_res_conv);
20321 }
20322
20323 static inline uint64_t COption_ChannelShutdownStateZ_clone_ptr(LDKCOption_ChannelShutdownStateZ *NONNULL_PTR arg) {
20324         LDKCOption_ChannelShutdownStateZ *ret_copy = MALLOC(sizeof(LDKCOption_ChannelShutdownStateZ), "LDKCOption_ChannelShutdownStateZ");
20325         *ret_copy = COption_ChannelShutdownStateZ_clone(arg);
20326         uint64_t ret_ref = tag_ptr(ret_copy, true);
20327         return ret_ref;
20328 }
20329 int64_t  __attribute__((export_name("TS_COption_ChannelShutdownStateZ_clone_ptr"))) TS_COption_ChannelShutdownStateZ_clone_ptr(uint64_t arg) {
20330         LDKCOption_ChannelShutdownStateZ* arg_conv = (LDKCOption_ChannelShutdownStateZ*)untag_ptr(arg);
20331         int64_t ret_conv = COption_ChannelShutdownStateZ_clone_ptr(arg_conv);
20332         return ret_conv;
20333 }
20334
20335 uint64_t  __attribute__((export_name("TS_COption_ChannelShutdownStateZ_clone"))) TS_COption_ChannelShutdownStateZ_clone(uint64_t orig) {
20336         LDKCOption_ChannelShutdownStateZ* orig_conv = (LDKCOption_ChannelShutdownStateZ*)untag_ptr(orig);
20337         LDKCOption_ChannelShutdownStateZ *ret_copy = MALLOC(sizeof(LDKCOption_ChannelShutdownStateZ), "LDKCOption_ChannelShutdownStateZ");
20338         *ret_copy = COption_ChannelShutdownStateZ_clone(orig_conv);
20339         uint64_t ret_ref = tag_ptr(ret_copy, true);
20340         return ret_ref;
20341 }
20342
20343 uint64_t  __attribute__((export_name("TS_CResult_ThirtyTwoBytesAPIErrorZ_ok"))) TS_CResult_ThirtyTwoBytesAPIErrorZ_ok(int8_tArray o) {
20344         LDKThirtyTwoBytes o_ref;
20345         CHECK(o->arr_len == 32);
20346         memcpy(o_ref.data, o->elems, 32); FREE(o);
20347         LDKCResult_ThirtyTwoBytesAPIErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ThirtyTwoBytesAPIErrorZ), "LDKCResult_ThirtyTwoBytesAPIErrorZ");
20348         *ret_conv = CResult_ThirtyTwoBytesAPIErrorZ_ok(o_ref);
20349         return tag_ptr(ret_conv, true);
20350 }
20351
20352 uint64_t  __attribute__((export_name("TS_CResult_ThirtyTwoBytesAPIErrorZ_err"))) TS_CResult_ThirtyTwoBytesAPIErrorZ_err(uint64_t e) {
20353         void* e_ptr = untag_ptr(e);
20354         CHECK_ACCESS(e_ptr);
20355         LDKAPIError e_conv = *(LDKAPIError*)(e_ptr);
20356         e_conv = APIError_clone((LDKAPIError*)untag_ptr(e));
20357         LDKCResult_ThirtyTwoBytesAPIErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ThirtyTwoBytesAPIErrorZ), "LDKCResult_ThirtyTwoBytesAPIErrorZ");
20358         *ret_conv = CResult_ThirtyTwoBytesAPIErrorZ_err(e_conv);
20359         return tag_ptr(ret_conv, true);
20360 }
20361
20362 jboolean  __attribute__((export_name("TS_CResult_ThirtyTwoBytesAPIErrorZ_is_ok"))) TS_CResult_ThirtyTwoBytesAPIErrorZ_is_ok(uint64_t o) {
20363         LDKCResult_ThirtyTwoBytesAPIErrorZ* o_conv = (LDKCResult_ThirtyTwoBytesAPIErrorZ*)untag_ptr(o);
20364         jboolean ret_conv = CResult_ThirtyTwoBytesAPIErrorZ_is_ok(o_conv);
20365         return ret_conv;
20366 }
20367
20368 void  __attribute__((export_name("TS_CResult_ThirtyTwoBytesAPIErrorZ_free"))) TS_CResult_ThirtyTwoBytesAPIErrorZ_free(uint64_t _res) {
20369         if (!ptr_is_owned(_res)) return;
20370         void* _res_ptr = untag_ptr(_res);
20371         CHECK_ACCESS(_res_ptr);
20372         LDKCResult_ThirtyTwoBytesAPIErrorZ _res_conv = *(LDKCResult_ThirtyTwoBytesAPIErrorZ*)(_res_ptr);
20373         FREE(untag_ptr(_res));
20374         CResult_ThirtyTwoBytesAPIErrorZ_free(_res_conv);
20375 }
20376
20377 static inline uint64_t CResult_ThirtyTwoBytesAPIErrorZ_clone_ptr(LDKCResult_ThirtyTwoBytesAPIErrorZ *NONNULL_PTR arg) {
20378         LDKCResult_ThirtyTwoBytesAPIErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ThirtyTwoBytesAPIErrorZ), "LDKCResult_ThirtyTwoBytesAPIErrorZ");
20379         *ret_conv = CResult_ThirtyTwoBytesAPIErrorZ_clone(arg);
20380         return tag_ptr(ret_conv, true);
20381 }
20382 int64_t  __attribute__((export_name("TS_CResult_ThirtyTwoBytesAPIErrorZ_clone_ptr"))) TS_CResult_ThirtyTwoBytesAPIErrorZ_clone_ptr(uint64_t arg) {
20383         LDKCResult_ThirtyTwoBytesAPIErrorZ* arg_conv = (LDKCResult_ThirtyTwoBytesAPIErrorZ*)untag_ptr(arg);
20384         int64_t ret_conv = CResult_ThirtyTwoBytesAPIErrorZ_clone_ptr(arg_conv);
20385         return ret_conv;
20386 }
20387
20388 uint64_t  __attribute__((export_name("TS_CResult_ThirtyTwoBytesAPIErrorZ_clone"))) TS_CResult_ThirtyTwoBytesAPIErrorZ_clone(uint64_t orig) {
20389         LDKCResult_ThirtyTwoBytesAPIErrorZ* orig_conv = (LDKCResult_ThirtyTwoBytesAPIErrorZ*)untag_ptr(orig);
20390         LDKCResult_ThirtyTwoBytesAPIErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ThirtyTwoBytesAPIErrorZ), "LDKCResult_ThirtyTwoBytesAPIErrorZ");
20391         *ret_conv = CResult_ThirtyTwoBytesAPIErrorZ_clone(orig_conv);
20392         return tag_ptr(ret_conv, true);
20393 }
20394
20395 void  __attribute__((export_name("TS_CVec_RecentPaymentDetailsZ_free"))) TS_CVec_RecentPaymentDetailsZ_free(uint64_tArray _res) {
20396         LDKCVec_RecentPaymentDetailsZ _res_constr;
20397         _res_constr.datalen = _res->arr_len;
20398         if (_res_constr.datalen > 0)
20399                 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKRecentPaymentDetails), "LDKCVec_RecentPaymentDetailsZ Elements");
20400         else
20401                 _res_constr.data = NULL;
20402         uint64_t* _res_vals = _res->elems;
20403         for (size_t w = 0; w < _res_constr.datalen; w++) {
20404                 uint64_t _res_conv_22 = _res_vals[w];
20405                 void* _res_conv_22_ptr = untag_ptr(_res_conv_22);
20406                 CHECK_ACCESS(_res_conv_22_ptr);
20407                 LDKRecentPaymentDetails _res_conv_22_conv = *(LDKRecentPaymentDetails*)(_res_conv_22_ptr);
20408                 FREE(untag_ptr(_res_conv_22));
20409                 _res_constr.data[w] = _res_conv_22_conv;
20410         }
20411         FREE(_res);
20412         CVec_RecentPaymentDetailsZ_free(_res_constr);
20413 }
20414
20415 uint64_t  __attribute__((export_name("TS_CResult_NonePaymentSendFailureZ_ok"))) TS_CResult_NonePaymentSendFailureZ_ok() {
20416         LDKCResult_NonePaymentSendFailureZ* ret_conv = MALLOC(sizeof(LDKCResult_NonePaymentSendFailureZ), "LDKCResult_NonePaymentSendFailureZ");
20417         *ret_conv = CResult_NonePaymentSendFailureZ_ok();
20418         return tag_ptr(ret_conv, true);
20419 }
20420
20421 uint64_t  __attribute__((export_name("TS_CResult_NonePaymentSendFailureZ_err"))) TS_CResult_NonePaymentSendFailureZ_err(uint64_t e) {
20422         void* e_ptr = untag_ptr(e);
20423         CHECK_ACCESS(e_ptr);
20424         LDKPaymentSendFailure e_conv = *(LDKPaymentSendFailure*)(e_ptr);
20425         e_conv = PaymentSendFailure_clone((LDKPaymentSendFailure*)untag_ptr(e));
20426         LDKCResult_NonePaymentSendFailureZ* ret_conv = MALLOC(sizeof(LDKCResult_NonePaymentSendFailureZ), "LDKCResult_NonePaymentSendFailureZ");
20427         *ret_conv = CResult_NonePaymentSendFailureZ_err(e_conv);
20428         return tag_ptr(ret_conv, true);
20429 }
20430
20431 jboolean  __attribute__((export_name("TS_CResult_NonePaymentSendFailureZ_is_ok"))) TS_CResult_NonePaymentSendFailureZ_is_ok(uint64_t o) {
20432         LDKCResult_NonePaymentSendFailureZ* o_conv = (LDKCResult_NonePaymentSendFailureZ*)untag_ptr(o);
20433         jboolean ret_conv = CResult_NonePaymentSendFailureZ_is_ok(o_conv);
20434         return ret_conv;
20435 }
20436
20437 void  __attribute__((export_name("TS_CResult_NonePaymentSendFailureZ_free"))) TS_CResult_NonePaymentSendFailureZ_free(uint64_t _res) {
20438         if (!ptr_is_owned(_res)) return;
20439         void* _res_ptr = untag_ptr(_res);
20440         CHECK_ACCESS(_res_ptr);
20441         LDKCResult_NonePaymentSendFailureZ _res_conv = *(LDKCResult_NonePaymentSendFailureZ*)(_res_ptr);
20442         FREE(untag_ptr(_res));
20443         CResult_NonePaymentSendFailureZ_free(_res_conv);
20444 }
20445
20446 static inline uint64_t CResult_NonePaymentSendFailureZ_clone_ptr(LDKCResult_NonePaymentSendFailureZ *NONNULL_PTR arg) {
20447         LDKCResult_NonePaymentSendFailureZ* ret_conv = MALLOC(sizeof(LDKCResult_NonePaymentSendFailureZ), "LDKCResult_NonePaymentSendFailureZ");
20448         *ret_conv = CResult_NonePaymentSendFailureZ_clone(arg);
20449         return tag_ptr(ret_conv, true);
20450 }
20451 int64_t  __attribute__((export_name("TS_CResult_NonePaymentSendFailureZ_clone_ptr"))) TS_CResult_NonePaymentSendFailureZ_clone_ptr(uint64_t arg) {
20452         LDKCResult_NonePaymentSendFailureZ* arg_conv = (LDKCResult_NonePaymentSendFailureZ*)untag_ptr(arg);
20453         int64_t ret_conv = CResult_NonePaymentSendFailureZ_clone_ptr(arg_conv);
20454         return ret_conv;
20455 }
20456
20457 uint64_t  __attribute__((export_name("TS_CResult_NonePaymentSendFailureZ_clone"))) TS_CResult_NonePaymentSendFailureZ_clone(uint64_t orig) {
20458         LDKCResult_NonePaymentSendFailureZ* orig_conv = (LDKCResult_NonePaymentSendFailureZ*)untag_ptr(orig);
20459         LDKCResult_NonePaymentSendFailureZ* ret_conv = MALLOC(sizeof(LDKCResult_NonePaymentSendFailureZ), "LDKCResult_NonePaymentSendFailureZ");
20460         *ret_conv = CResult_NonePaymentSendFailureZ_clone(orig_conv);
20461         return tag_ptr(ret_conv, true);
20462 }
20463
20464 uint64_t  __attribute__((export_name("TS_CResult_NoneRetryableSendFailureZ_ok"))) TS_CResult_NoneRetryableSendFailureZ_ok() {
20465         LDKCResult_NoneRetryableSendFailureZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneRetryableSendFailureZ), "LDKCResult_NoneRetryableSendFailureZ");
20466         *ret_conv = CResult_NoneRetryableSendFailureZ_ok();
20467         return tag_ptr(ret_conv, true);
20468 }
20469
20470 uint64_t  __attribute__((export_name("TS_CResult_NoneRetryableSendFailureZ_err"))) TS_CResult_NoneRetryableSendFailureZ_err(uint32_t e) {
20471         LDKRetryableSendFailure e_conv = LDKRetryableSendFailure_from_js(e);
20472         LDKCResult_NoneRetryableSendFailureZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneRetryableSendFailureZ), "LDKCResult_NoneRetryableSendFailureZ");
20473         *ret_conv = CResult_NoneRetryableSendFailureZ_err(e_conv);
20474         return tag_ptr(ret_conv, true);
20475 }
20476
20477 jboolean  __attribute__((export_name("TS_CResult_NoneRetryableSendFailureZ_is_ok"))) TS_CResult_NoneRetryableSendFailureZ_is_ok(uint64_t o) {
20478         LDKCResult_NoneRetryableSendFailureZ* o_conv = (LDKCResult_NoneRetryableSendFailureZ*)untag_ptr(o);
20479         jboolean ret_conv = CResult_NoneRetryableSendFailureZ_is_ok(o_conv);
20480         return ret_conv;
20481 }
20482
20483 void  __attribute__((export_name("TS_CResult_NoneRetryableSendFailureZ_free"))) TS_CResult_NoneRetryableSendFailureZ_free(uint64_t _res) {
20484         if (!ptr_is_owned(_res)) return;
20485         void* _res_ptr = untag_ptr(_res);
20486         CHECK_ACCESS(_res_ptr);
20487         LDKCResult_NoneRetryableSendFailureZ _res_conv = *(LDKCResult_NoneRetryableSendFailureZ*)(_res_ptr);
20488         FREE(untag_ptr(_res));
20489         CResult_NoneRetryableSendFailureZ_free(_res_conv);
20490 }
20491
20492 static inline uint64_t CResult_NoneRetryableSendFailureZ_clone_ptr(LDKCResult_NoneRetryableSendFailureZ *NONNULL_PTR arg) {
20493         LDKCResult_NoneRetryableSendFailureZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneRetryableSendFailureZ), "LDKCResult_NoneRetryableSendFailureZ");
20494         *ret_conv = CResult_NoneRetryableSendFailureZ_clone(arg);
20495         return tag_ptr(ret_conv, true);
20496 }
20497 int64_t  __attribute__((export_name("TS_CResult_NoneRetryableSendFailureZ_clone_ptr"))) TS_CResult_NoneRetryableSendFailureZ_clone_ptr(uint64_t arg) {
20498         LDKCResult_NoneRetryableSendFailureZ* arg_conv = (LDKCResult_NoneRetryableSendFailureZ*)untag_ptr(arg);
20499         int64_t ret_conv = CResult_NoneRetryableSendFailureZ_clone_ptr(arg_conv);
20500         return ret_conv;
20501 }
20502
20503 uint64_t  __attribute__((export_name("TS_CResult_NoneRetryableSendFailureZ_clone"))) TS_CResult_NoneRetryableSendFailureZ_clone(uint64_t orig) {
20504         LDKCResult_NoneRetryableSendFailureZ* orig_conv = (LDKCResult_NoneRetryableSendFailureZ*)untag_ptr(orig);
20505         LDKCResult_NoneRetryableSendFailureZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneRetryableSendFailureZ), "LDKCResult_NoneRetryableSendFailureZ");
20506         *ret_conv = CResult_NoneRetryableSendFailureZ_clone(orig_conv);
20507         return tag_ptr(ret_conv, true);
20508 }
20509
20510 uint64_t  __attribute__((export_name("TS_CResult_ThirtyTwoBytesPaymentSendFailureZ_ok"))) TS_CResult_ThirtyTwoBytesPaymentSendFailureZ_ok(int8_tArray o) {
20511         LDKThirtyTwoBytes o_ref;
20512         CHECK(o->arr_len == 32);
20513         memcpy(o_ref.data, o->elems, 32); FREE(o);
20514         LDKCResult_ThirtyTwoBytesPaymentSendFailureZ* ret_conv = MALLOC(sizeof(LDKCResult_ThirtyTwoBytesPaymentSendFailureZ), "LDKCResult_ThirtyTwoBytesPaymentSendFailureZ");
20515         *ret_conv = CResult_ThirtyTwoBytesPaymentSendFailureZ_ok(o_ref);
20516         return tag_ptr(ret_conv, true);
20517 }
20518
20519 uint64_t  __attribute__((export_name("TS_CResult_ThirtyTwoBytesPaymentSendFailureZ_err"))) TS_CResult_ThirtyTwoBytesPaymentSendFailureZ_err(uint64_t e) {
20520         void* e_ptr = untag_ptr(e);
20521         CHECK_ACCESS(e_ptr);
20522         LDKPaymentSendFailure e_conv = *(LDKPaymentSendFailure*)(e_ptr);
20523         e_conv = PaymentSendFailure_clone((LDKPaymentSendFailure*)untag_ptr(e));
20524         LDKCResult_ThirtyTwoBytesPaymentSendFailureZ* ret_conv = MALLOC(sizeof(LDKCResult_ThirtyTwoBytesPaymentSendFailureZ), "LDKCResult_ThirtyTwoBytesPaymentSendFailureZ");
20525         *ret_conv = CResult_ThirtyTwoBytesPaymentSendFailureZ_err(e_conv);
20526         return tag_ptr(ret_conv, true);
20527 }
20528
20529 jboolean  __attribute__((export_name("TS_CResult_ThirtyTwoBytesPaymentSendFailureZ_is_ok"))) TS_CResult_ThirtyTwoBytesPaymentSendFailureZ_is_ok(uint64_t o) {
20530         LDKCResult_ThirtyTwoBytesPaymentSendFailureZ* o_conv = (LDKCResult_ThirtyTwoBytesPaymentSendFailureZ*)untag_ptr(o);
20531         jboolean ret_conv = CResult_ThirtyTwoBytesPaymentSendFailureZ_is_ok(o_conv);
20532         return ret_conv;
20533 }
20534
20535 void  __attribute__((export_name("TS_CResult_ThirtyTwoBytesPaymentSendFailureZ_free"))) TS_CResult_ThirtyTwoBytesPaymentSendFailureZ_free(uint64_t _res) {
20536         if (!ptr_is_owned(_res)) return;
20537         void* _res_ptr = untag_ptr(_res);
20538         CHECK_ACCESS(_res_ptr);
20539         LDKCResult_ThirtyTwoBytesPaymentSendFailureZ _res_conv = *(LDKCResult_ThirtyTwoBytesPaymentSendFailureZ*)(_res_ptr);
20540         FREE(untag_ptr(_res));
20541         CResult_ThirtyTwoBytesPaymentSendFailureZ_free(_res_conv);
20542 }
20543
20544 static inline uint64_t CResult_ThirtyTwoBytesPaymentSendFailureZ_clone_ptr(LDKCResult_ThirtyTwoBytesPaymentSendFailureZ *NONNULL_PTR arg) {
20545         LDKCResult_ThirtyTwoBytesPaymentSendFailureZ* ret_conv = MALLOC(sizeof(LDKCResult_ThirtyTwoBytesPaymentSendFailureZ), "LDKCResult_ThirtyTwoBytesPaymentSendFailureZ");
20546         *ret_conv = CResult_ThirtyTwoBytesPaymentSendFailureZ_clone(arg);
20547         return tag_ptr(ret_conv, true);
20548 }
20549 int64_t  __attribute__((export_name("TS_CResult_ThirtyTwoBytesPaymentSendFailureZ_clone_ptr"))) TS_CResult_ThirtyTwoBytesPaymentSendFailureZ_clone_ptr(uint64_t arg) {
20550         LDKCResult_ThirtyTwoBytesPaymentSendFailureZ* arg_conv = (LDKCResult_ThirtyTwoBytesPaymentSendFailureZ*)untag_ptr(arg);
20551         int64_t ret_conv = CResult_ThirtyTwoBytesPaymentSendFailureZ_clone_ptr(arg_conv);
20552         return ret_conv;
20553 }
20554
20555 uint64_t  __attribute__((export_name("TS_CResult_ThirtyTwoBytesPaymentSendFailureZ_clone"))) TS_CResult_ThirtyTwoBytesPaymentSendFailureZ_clone(uint64_t orig) {
20556         LDKCResult_ThirtyTwoBytesPaymentSendFailureZ* orig_conv = (LDKCResult_ThirtyTwoBytesPaymentSendFailureZ*)untag_ptr(orig);
20557         LDKCResult_ThirtyTwoBytesPaymentSendFailureZ* ret_conv = MALLOC(sizeof(LDKCResult_ThirtyTwoBytesPaymentSendFailureZ), "LDKCResult_ThirtyTwoBytesPaymentSendFailureZ");
20558         *ret_conv = CResult_ThirtyTwoBytesPaymentSendFailureZ_clone(orig_conv);
20559         return tag_ptr(ret_conv, true);
20560 }
20561
20562 uint64_t  __attribute__((export_name("TS_CResult_ThirtyTwoBytesRetryableSendFailureZ_ok"))) TS_CResult_ThirtyTwoBytesRetryableSendFailureZ_ok(int8_tArray o) {
20563         LDKThirtyTwoBytes o_ref;
20564         CHECK(o->arr_len == 32);
20565         memcpy(o_ref.data, o->elems, 32); FREE(o);
20566         LDKCResult_ThirtyTwoBytesRetryableSendFailureZ* ret_conv = MALLOC(sizeof(LDKCResult_ThirtyTwoBytesRetryableSendFailureZ), "LDKCResult_ThirtyTwoBytesRetryableSendFailureZ");
20567         *ret_conv = CResult_ThirtyTwoBytesRetryableSendFailureZ_ok(o_ref);
20568         return tag_ptr(ret_conv, true);
20569 }
20570
20571 uint64_t  __attribute__((export_name("TS_CResult_ThirtyTwoBytesRetryableSendFailureZ_err"))) TS_CResult_ThirtyTwoBytesRetryableSendFailureZ_err(uint32_t e) {
20572         LDKRetryableSendFailure e_conv = LDKRetryableSendFailure_from_js(e);
20573         LDKCResult_ThirtyTwoBytesRetryableSendFailureZ* ret_conv = MALLOC(sizeof(LDKCResult_ThirtyTwoBytesRetryableSendFailureZ), "LDKCResult_ThirtyTwoBytesRetryableSendFailureZ");
20574         *ret_conv = CResult_ThirtyTwoBytesRetryableSendFailureZ_err(e_conv);
20575         return tag_ptr(ret_conv, true);
20576 }
20577
20578 jboolean  __attribute__((export_name("TS_CResult_ThirtyTwoBytesRetryableSendFailureZ_is_ok"))) TS_CResult_ThirtyTwoBytesRetryableSendFailureZ_is_ok(uint64_t o) {
20579         LDKCResult_ThirtyTwoBytesRetryableSendFailureZ* o_conv = (LDKCResult_ThirtyTwoBytesRetryableSendFailureZ*)untag_ptr(o);
20580         jboolean ret_conv = CResult_ThirtyTwoBytesRetryableSendFailureZ_is_ok(o_conv);
20581         return ret_conv;
20582 }
20583
20584 void  __attribute__((export_name("TS_CResult_ThirtyTwoBytesRetryableSendFailureZ_free"))) TS_CResult_ThirtyTwoBytesRetryableSendFailureZ_free(uint64_t _res) {
20585         if (!ptr_is_owned(_res)) return;
20586         void* _res_ptr = untag_ptr(_res);
20587         CHECK_ACCESS(_res_ptr);
20588         LDKCResult_ThirtyTwoBytesRetryableSendFailureZ _res_conv = *(LDKCResult_ThirtyTwoBytesRetryableSendFailureZ*)(_res_ptr);
20589         FREE(untag_ptr(_res));
20590         CResult_ThirtyTwoBytesRetryableSendFailureZ_free(_res_conv);
20591 }
20592
20593 static inline uint64_t CResult_ThirtyTwoBytesRetryableSendFailureZ_clone_ptr(LDKCResult_ThirtyTwoBytesRetryableSendFailureZ *NONNULL_PTR arg) {
20594         LDKCResult_ThirtyTwoBytesRetryableSendFailureZ* ret_conv = MALLOC(sizeof(LDKCResult_ThirtyTwoBytesRetryableSendFailureZ), "LDKCResult_ThirtyTwoBytesRetryableSendFailureZ");
20595         *ret_conv = CResult_ThirtyTwoBytesRetryableSendFailureZ_clone(arg);
20596         return tag_ptr(ret_conv, true);
20597 }
20598 int64_t  __attribute__((export_name("TS_CResult_ThirtyTwoBytesRetryableSendFailureZ_clone_ptr"))) TS_CResult_ThirtyTwoBytesRetryableSendFailureZ_clone_ptr(uint64_t arg) {
20599         LDKCResult_ThirtyTwoBytesRetryableSendFailureZ* arg_conv = (LDKCResult_ThirtyTwoBytesRetryableSendFailureZ*)untag_ptr(arg);
20600         int64_t ret_conv = CResult_ThirtyTwoBytesRetryableSendFailureZ_clone_ptr(arg_conv);
20601         return ret_conv;
20602 }
20603
20604 uint64_t  __attribute__((export_name("TS_CResult_ThirtyTwoBytesRetryableSendFailureZ_clone"))) TS_CResult_ThirtyTwoBytesRetryableSendFailureZ_clone(uint64_t orig) {
20605         LDKCResult_ThirtyTwoBytesRetryableSendFailureZ* orig_conv = (LDKCResult_ThirtyTwoBytesRetryableSendFailureZ*)untag_ptr(orig);
20606         LDKCResult_ThirtyTwoBytesRetryableSendFailureZ* ret_conv = MALLOC(sizeof(LDKCResult_ThirtyTwoBytesRetryableSendFailureZ), "LDKCResult_ThirtyTwoBytesRetryableSendFailureZ");
20607         *ret_conv = CResult_ThirtyTwoBytesRetryableSendFailureZ_clone(orig_conv);
20608         return tag_ptr(ret_conv, true);
20609 }
20610
20611 static inline uint64_t C2Tuple_ThirtyTwoBytesThirtyTwoBytesZ_clone_ptr(LDKC2Tuple_ThirtyTwoBytesThirtyTwoBytesZ *NONNULL_PTR arg) {
20612         LDKC2Tuple_ThirtyTwoBytesThirtyTwoBytesZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_ThirtyTwoBytesThirtyTwoBytesZ), "LDKC2Tuple_ThirtyTwoBytesThirtyTwoBytesZ");
20613         *ret_conv = C2Tuple_ThirtyTwoBytesThirtyTwoBytesZ_clone(arg);
20614         return tag_ptr(ret_conv, true);
20615 }
20616 int64_t  __attribute__((export_name("TS_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZ_clone_ptr"))) TS_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZ_clone_ptr(uint64_t arg) {
20617         LDKC2Tuple_ThirtyTwoBytesThirtyTwoBytesZ* arg_conv = (LDKC2Tuple_ThirtyTwoBytesThirtyTwoBytesZ*)untag_ptr(arg);
20618         int64_t ret_conv = C2Tuple_ThirtyTwoBytesThirtyTwoBytesZ_clone_ptr(arg_conv);
20619         return ret_conv;
20620 }
20621
20622 uint64_t  __attribute__((export_name("TS_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZ_clone"))) TS_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZ_clone(uint64_t orig) {
20623         LDKC2Tuple_ThirtyTwoBytesThirtyTwoBytesZ* orig_conv = (LDKC2Tuple_ThirtyTwoBytesThirtyTwoBytesZ*)untag_ptr(orig);
20624         LDKC2Tuple_ThirtyTwoBytesThirtyTwoBytesZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_ThirtyTwoBytesThirtyTwoBytesZ), "LDKC2Tuple_ThirtyTwoBytesThirtyTwoBytesZ");
20625         *ret_conv = C2Tuple_ThirtyTwoBytesThirtyTwoBytesZ_clone(orig_conv);
20626         return tag_ptr(ret_conv, true);
20627 }
20628
20629 uint64_t  __attribute__((export_name("TS_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZ_new"))) TS_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZ_new(int8_tArray a, int8_tArray b) {
20630         LDKThirtyTwoBytes a_ref;
20631         CHECK(a->arr_len == 32);
20632         memcpy(a_ref.data, a->elems, 32); FREE(a);
20633         LDKThirtyTwoBytes b_ref;
20634         CHECK(b->arr_len == 32);
20635         memcpy(b_ref.data, b->elems, 32); FREE(b);
20636         LDKC2Tuple_ThirtyTwoBytesThirtyTwoBytesZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_ThirtyTwoBytesThirtyTwoBytesZ), "LDKC2Tuple_ThirtyTwoBytesThirtyTwoBytesZ");
20637         *ret_conv = C2Tuple_ThirtyTwoBytesThirtyTwoBytesZ_new(a_ref, b_ref);
20638         return tag_ptr(ret_conv, true);
20639 }
20640
20641 void  __attribute__((export_name("TS_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZ_free"))) TS_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZ_free(uint64_t _res) {
20642         if (!ptr_is_owned(_res)) return;
20643         void* _res_ptr = untag_ptr(_res);
20644         CHECK_ACCESS(_res_ptr);
20645         LDKC2Tuple_ThirtyTwoBytesThirtyTwoBytesZ _res_conv = *(LDKC2Tuple_ThirtyTwoBytesThirtyTwoBytesZ*)(_res_ptr);
20646         FREE(untag_ptr(_res));
20647         C2Tuple_ThirtyTwoBytesThirtyTwoBytesZ_free(_res_conv);
20648 }
20649
20650 uint64_t  __attribute__((export_name("TS_CResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZPaymentSendFailureZ_ok"))) TS_CResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZPaymentSendFailureZ_ok(uint64_t o) {
20651         void* o_ptr = untag_ptr(o);
20652         CHECK_ACCESS(o_ptr);
20653         LDKC2Tuple_ThirtyTwoBytesThirtyTwoBytesZ o_conv = *(LDKC2Tuple_ThirtyTwoBytesThirtyTwoBytesZ*)(o_ptr);
20654         o_conv = C2Tuple_ThirtyTwoBytesThirtyTwoBytesZ_clone((LDKC2Tuple_ThirtyTwoBytesThirtyTwoBytesZ*)untag_ptr(o));
20655         LDKCResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZPaymentSendFailureZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZPaymentSendFailureZ), "LDKCResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZPaymentSendFailureZ");
20656         *ret_conv = CResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZPaymentSendFailureZ_ok(o_conv);
20657         return tag_ptr(ret_conv, true);
20658 }
20659
20660 uint64_t  __attribute__((export_name("TS_CResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZPaymentSendFailureZ_err"))) TS_CResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZPaymentSendFailureZ_err(uint64_t e) {
20661         void* e_ptr = untag_ptr(e);
20662         CHECK_ACCESS(e_ptr);
20663         LDKPaymentSendFailure e_conv = *(LDKPaymentSendFailure*)(e_ptr);
20664         e_conv = PaymentSendFailure_clone((LDKPaymentSendFailure*)untag_ptr(e));
20665         LDKCResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZPaymentSendFailureZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZPaymentSendFailureZ), "LDKCResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZPaymentSendFailureZ");
20666         *ret_conv = CResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZPaymentSendFailureZ_err(e_conv);
20667         return tag_ptr(ret_conv, true);
20668 }
20669
20670 jboolean  __attribute__((export_name("TS_CResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZPaymentSendFailureZ_is_ok"))) TS_CResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZPaymentSendFailureZ_is_ok(uint64_t o) {
20671         LDKCResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZPaymentSendFailureZ* o_conv = (LDKCResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZPaymentSendFailureZ*)untag_ptr(o);
20672         jboolean ret_conv = CResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZPaymentSendFailureZ_is_ok(o_conv);
20673         return ret_conv;
20674 }
20675
20676 void  __attribute__((export_name("TS_CResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZPaymentSendFailureZ_free"))) TS_CResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZPaymentSendFailureZ_free(uint64_t _res) {
20677         if (!ptr_is_owned(_res)) return;
20678         void* _res_ptr = untag_ptr(_res);
20679         CHECK_ACCESS(_res_ptr);
20680         LDKCResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZPaymentSendFailureZ _res_conv = *(LDKCResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZPaymentSendFailureZ*)(_res_ptr);
20681         FREE(untag_ptr(_res));
20682         CResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZPaymentSendFailureZ_free(_res_conv);
20683 }
20684
20685 static inline uint64_t CResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZPaymentSendFailureZ_clone_ptr(LDKCResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZPaymentSendFailureZ *NONNULL_PTR arg) {
20686         LDKCResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZPaymentSendFailureZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZPaymentSendFailureZ), "LDKCResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZPaymentSendFailureZ");
20687         *ret_conv = CResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZPaymentSendFailureZ_clone(arg);
20688         return tag_ptr(ret_conv, true);
20689 }
20690 int64_t  __attribute__((export_name("TS_CResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZPaymentSendFailureZ_clone_ptr"))) TS_CResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZPaymentSendFailureZ_clone_ptr(uint64_t arg) {
20691         LDKCResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZPaymentSendFailureZ* arg_conv = (LDKCResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZPaymentSendFailureZ*)untag_ptr(arg);
20692         int64_t ret_conv = CResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZPaymentSendFailureZ_clone_ptr(arg_conv);
20693         return ret_conv;
20694 }
20695
20696 uint64_t  __attribute__((export_name("TS_CResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZPaymentSendFailureZ_clone"))) TS_CResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZPaymentSendFailureZ_clone(uint64_t orig) {
20697         LDKCResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZPaymentSendFailureZ* orig_conv = (LDKCResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZPaymentSendFailureZ*)untag_ptr(orig);
20698         LDKCResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZPaymentSendFailureZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZPaymentSendFailureZ), "LDKCResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZPaymentSendFailureZ");
20699         *ret_conv = CResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZPaymentSendFailureZ_clone(orig_conv);
20700         return tag_ptr(ret_conv, true);
20701 }
20702
20703 void  __attribute__((export_name("TS_CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZ_free"))) TS_CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZ_free(uint64_tArray _res) {
20704         LDKCVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZ _res_constr;
20705         _res_constr.datalen = _res->arr_len;
20706         if (_res_constr.datalen > 0)
20707                 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKC2Tuple_ThirtyTwoBytesThirtyTwoBytesZ), "LDKCVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZ Elements");
20708         else
20709                 _res_constr.data = NULL;
20710         uint64_t* _res_vals = _res->elems;
20711         for (size_t o = 0; o < _res_constr.datalen; o++) {
20712                 uint64_t _res_conv_40 = _res_vals[o];
20713                 void* _res_conv_40_ptr = untag_ptr(_res_conv_40);
20714                 CHECK_ACCESS(_res_conv_40_ptr);
20715                 LDKC2Tuple_ThirtyTwoBytesThirtyTwoBytesZ _res_conv_40_conv = *(LDKC2Tuple_ThirtyTwoBytesThirtyTwoBytesZ*)(_res_conv_40_ptr);
20716                 FREE(untag_ptr(_res_conv_40));
20717                 _res_constr.data[o] = _res_conv_40_conv;
20718         }
20719         FREE(_res);
20720         CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZ_free(_res_constr);
20721 }
20722
20723 uint64_t  __attribute__((export_name("TS_CResult_CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZProbeSendFailureZ_ok"))) TS_CResult_CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZProbeSendFailureZ_ok(uint64_tArray o) {
20724         LDKCVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZ o_constr;
20725         o_constr.datalen = o->arr_len;
20726         if (o_constr.datalen > 0)
20727                 o_constr.data = MALLOC(o_constr.datalen * sizeof(LDKC2Tuple_ThirtyTwoBytesThirtyTwoBytesZ), "LDKCVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZ Elements");
20728         else
20729                 o_constr.data = NULL;
20730         uint64_t* o_vals = o->elems;
20731         for (size_t o = 0; o < o_constr.datalen; o++) {
20732                 uint64_t o_conv_40 = o_vals[o];
20733                 void* o_conv_40_ptr = untag_ptr(o_conv_40);
20734                 CHECK_ACCESS(o_conv_40_ptr);
20735                 LDKC2Tuple_ThirtyTwoBytesThirtyTwoBytesZ o_conv_40_conv = *(LDKC2Tuple_ThirtyTwoBytesThirtyTwoBytesZ*)(o_conv_40_ptr);
20736                 o_conv_40_conv = C2Tuple_ThirtyTwoBytesThirtyTwoBytesZ_clone((LDKC2Tuple_ThirtyTwoBytesThirtyTwoBytesZ*)untag_ptr(o_conv_40));
20737                 o_constr.data[o] = o_conv_40_conv;
20738         }
20739         FREE(o);
20740         LDKCResult_CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZProbeSendFailureZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZProbeSendFailureZ), "LDKCResult_CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZProbeSendFailureZ");
20741         *ret_conv = CResult_CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZProbeSendFailureZ_ok(o_constr);
20742         return tag_ptr(ret_conv, true);
20743 }
20744
20745 uint64_t  __attribute__((export_name("TS_CResult_CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZProbeSendFailureZ_err"))) TS_CResult_CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZProbeSendFailureZ_err(uint64_t e) {
20746         void* e_ptr = untag_ptr(e);
20747         CHECK_ACCESS(e_ptr);
20748         LDKProbeSendFailure e_conv = *(LDKProbeSendFailure*)(e_ptr);
20749         e_conv = ProbeSendFailure_clone((LDKProbeSendFailure*)untag_ptr(e));
20750         LDKCResult_CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZProbeSendFailureZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZProbeSendFailureZ), "LDKCResult_CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZProbeSendFailureZ");
20751         *ret_conv = CResult_CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZProbeSendFailureZ_err(e_conv);
20752         return tag_ptr(ret_conv, true);
20753 }
20754
20755 jboolean  __attribute__((export_name("TS_CResult_CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZProbeSendFailureZ_is_ok"))) TS_CResult_CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZProbeSendFailureZ_is_ok(uint64_t o) {
20756         LDKCResult_CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZProbeSendFailureZ* o_conv = (LDKCResult_CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZProbeSendFailureZ*)untag_ptr(o);
20757         jboolean ret_conv = CResult_CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZProbeSendFailureZ_is_ok(o_conv);
20758         return ret_conv;
20759 }
20760
20761 void  __attribute__((export_name("TS_CResult_CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZProbeSendFailureZ_free"))) TS_CResult_CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZProbeSendFailureZ_free(uint64_t _res) {
20762         if (!ptr_is_owned(_res)) return;
20763         void* _res_ptr = untag_ptr(_res);
20764         CHECK_ACCESS(_res_ptr);
20765         LDKCResult_CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZProbeSendFailureZ _res_conv = *(LDKCResult_CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZProbeSendFailureZ*)(_res_ptr);
20766         FREE(untag_ptr(_res));
20767         CResult_CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZProbeSendFailureZ_free(_res_conv);
20768 }
20769
20770 static inline uint64_t CResult_CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZProbeSendFailureZ_clone_ptr(LDKCResult_CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZProbeSendFailureZ *NONNULL_PTR arg) {
20771         LDKCResult_CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZProbeSendFailureZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZProbeSendFailureZ), "LDKCResult_CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZProbeSendFailureZ");
20772         *ret_conv = CResult_CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZProbeSendFailureZ_clone(arg);
20773         return tag_ptr(ret_conv, true);
20774 }
20775 int64_t  __attribute__((export_name("TS_CResult_CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZProbeSendFailureZ_clone_ptr"))) TS_CResult_CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZProbeSendFailureZ_clone_ptr(uint64_t arg) {
20776         LDKCResult_CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZProbeSendFailureZ* arg_conv = (LDKCResult_CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZProbeSendFailureZ*)untag_ptr(arg);
20777         int64_t ret_conv = CResult_CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZProbeSendFailureZ_clone_ptr(arg_conv);
20778         return ret_conv;
20779 }
20780
20781 uint64_t  __attribute__((export_name("TS_CResult_CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZProbeSendFailureZ_clone"))) TS_CResult_CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZProbeSendFailureZ_clone(uint64_t orig) {
20782         LDKCResult_CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZProbeSendFailureZ* orig_conv = (LDKCResult_CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZProbeSendFailureZ*)untag_ptr(orig);
20783         LDKCResult_CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZProbeSendFailureZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZProbeSendFailureZ), "LDKCResult_CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZProbeSendFailureZ");
20784         *ret_conv = CResult_CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZProbeSendFailureZ_clone(orig_conv);
20785         return tag_ptr(ret_conv, true);
20786 }
20787
20788 static inline uint64_t C2Tuple_ThirtyTwoBytesPublicKeyZ_clone_ptr(LDKC2Tuple_ThirtyTwoBytesPublicKeyZ *NONNULL_PTR arg) {
20789         LDKC2Tuple_ThirtyTwoBytesPublicKeyZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_ThirtyTwoBytesPublicKeyZ), "LDKC2Tuple_ThirtyTwoBytesPublicKeyZ");
20790         *ret_conv = C2Tuple_ThirtyTwoBytesPublicKeyZ_clone(arg);
20791         return tag_ptr(ret_conv, true);
20792 }
20793 int64_t  __attribute__((export_name("TS_C2Tuple_ThirtyTwoBytesPublicKeyZ_clone_ptr"))) TS_C2Tuple_ThirtyTwoBytesPublicKeyZ_clone_ptr(uint64_t arg) {
20794         LDKC2Tuple_ThirtyTwoBytesPublicKeyZ* arg_conv = (LDKC2Tuple_ThirtyTwoBytesPublicKeyZ*)untag_ptr(arg);
20795         int64_t ret_conv = C2Tuple_ThirtyTwoBytesPublicKeyZ_clone_ptr(arg_conv);
20796         return ret_conv;
20797 }
20798
20799 uint64_t  __attribute__((export_name("TS_C2Tuple_ThirtyTwoBytesPublicKeyZ_clone"))) TS_C2Tuple_ThirtyTwoBytesPublicKeyZ_clone(uint64_t orig) {
20800         LDKC2Tuple_ThirtyTwoBytesPublicKeyZ* orig_conv = (LDKC2Tuple_ThirtyTwoBytesPublicKeyZ*)untag_ptr(orig);
20801         LDKC2Tuple_ThirtyTwoBytesPublicKeyZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_ThirtyTwoBytesPublicKeyZ), "LDKC2Tuple_ThirtyTwoBytesPublicKeyZ");
20802         *ret_conv = C2Tuple_ThirtyTwoBytesPublicKeyZ_clone(orig_conv);
20803         return tag_ptr(ret_conv, true);
20804 }
20805
20806 uint64_t  __attribute__((export_name("TS_C2Tuple_ThirtyTwoBytesPublicKeyZ_new"))) TS_C2Tuple_ThirtyTwoBytesPublicKeyZ_new(int8_tArray a, int8_tArray b) {
20807         LDKThirtyTwoBytes a_ref;
20808         CHECK(a->arr_len == 32);
20809         memcpy(a_ref.data, a->elems, 32); FREE(a);
20810         LDKPublicKey b_ref;
20811         CHECK(b->arr_len == 33);
20812         memcpy(b_ref.compressed_form, b->elems, 33); FREE(b);
20813         LDKC2Tuple_ThirtyTwoBytesPublicKeyZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_ThirtyTwoBytesPublicKeyZ), "LDKC2Tuple_ThirtyTwoBytesPublicKeyZ");
20814         *ret_conv = C2Tuple_ThirtyTwoBytesPublicKeyZ_new(a_ref, b_ref);
20815         return tag_ptr(ret_conv, true);
20816 }
20817
20818 void  __attribute__((export_name("TS_C2Tuple_ThirtyTwoBytesPublicKeyZ_free"))) TS_C2Tuple_ThirtyTwoBytesPublicKeyZ_free(uint64_t _res) {
20819         if (!ptr_is_owned(_res)) return;
20820         void* _res_ptr = untag_ptr(_res);
20821         CHECK_ACCESS(_res_ptr);
20822         LDKC2Tuple_ThirtyTwoBytesPublicKeyZ _res_conv = *(LDKC2Tuple_ThirtyTwoBytesPublicKeyZ*)(_res_ptr);
20823         FREE(untag_ptr(_res));
20824         C2Tuple_ThirtyTwoBytesPublicKeyZ_free(_res_conv);
20825 }
20826
20827 void  __attribute__((export_name("TS_CVec_C2Tuple_ThirtyTwoBytesPublicKeyZZ_free"))) TS_CVec_C2Tuple_ThirtyTwoBytesPublicKeyZZ_free(uint64_tArray _res) {
20828         LDKCVec_C2Tuple_ThirtyTwoBytesPublicKeyZZ _res_constr;
20829         _res_constr.datalen = _res->arr_len;
20830         if (_res_constr.datalen > 0)
20831                 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKC2Tuple_ThirtyTwoBytesPublicKeyZ), "LDKCVec_C2Tuple_ThirtyTwoBytesPublicKeyZZ Elements");
20832         else
20833                 _res_constr.data = NULL;
20834         uint64_t* _res_vals = _res->elems;
20835         for (size_t j = 0; j < _res_constr.datalen; j++) {
20836                 uint64_t _res_conv_35 = _res_vals[j];
20837                 void* _res_conv_35_ptr = untag_ptr(_res_conv_35);
20838                 CHECK_ACCESS(_res_conv_35_ptr);
20839                 LDKC2Tuple_ThirtyTwoBytesPublicKeyZ _res_conv_35_conv = *(LDKC2Tuple_ThirtyTwoBytesPublicKeyZ*)(_res_conv_35_ptr);
20840                 FREE(untag_ptr(_res_conv_35));
20841                 _res_constr.data[j] = _res_conv_35_conv;
20842         }
20843         FREE(_res);
20844         CVec_C2Tuple_ThirtyTwoBytesPublicKeyZZ_free(_res_constr);
20845 }
20846
20847 uint64_t  __attribute__((export_name("TS_COption_StrZ_some"))) TS_COption_StrZ_some(jstring o) {
20848         LDKStr o_conv = str_ref_to_owned_c(o);
20849         LDKCOption_StrZ *ret_copy = MALLOC(sizeof(LDKCOption_StrZ), "LDKCOption_StrZ");
20850         *ret_copy = COption_StrZ_some(o_conv);
20851         uint64_t ret_ref = tag_ptr(ret_copy, true);
20852         return ret_ref;
20853 }
20854
20855 uint64_t  __attribute__((export_name("TS_COption_StrZ_none"))) TS_COption_StrZ_none() {
20856         LDKCOption_StrZ *ret_copy = MALLOC(sizeof(LDKCOption_StrZ), "LDKCOption_StrZ");
20857         *ret_copy = COption_StrZ_none();
20858         uint64_t ret_ref = tag_ptr(ret_copy, true);
20859         return ret_ref;
20860 }
20861
20862 void  __attribute__((export_name("TS_COption_StrZ_free"))) TS_COption_StrZ_free(uint64_t _res) {
20863         if (!ptr_is_owned(_res)) return;
20864         void* _res_ptr = untag_ptr(_res);
20865         CHECK_ACCESS(_res_ptr);
20866         LDKCOption_StrZ _res_conv = *(LDKCOption_StrZ*)(_res_ptr);
20867         FREE(untag_ptr(_res));
20868         COption_StrZ_free(_res_conv);
20869 }
20870
20871 static inline uint64_t COption_StrZ_clone_ptr(LDKCOption_StrZ *NONNULL_PTR arg) {
20872         LDKCOption_StrZ *ret_copy = MALLOC(sizeof(LDKCOption_StrZ), "LDKCOption_StrZ");
20873         *ret_copy = COption_StrZ_clone(arg);
20874         uint64_t ret_ref = tag_ptr(ret_copy, true);
20875         return ret_ref;
20876 }
20877 int64_t  __attribute__((export_name("TS_COption_StrZ_clone_ptr"))) TS_COption_StrZ_clone_ptr(uint64_t arg) {
20878         LDKCOption_StrZ* arg_conv = (LDKCOption_StrZ*)untag_ptr(arg);
20879         int64_t ret_conv = COption_StrZ_clone_ptr(arg_conv);
20880         return ret_conv;
20881 }
20882
20883 uint64_t  __attribute__((export_name("TS_COption_StrZ_clone"))) TS_COption_StrZ_clone(uint64_t orig) {
20884         LDKCOption_StrZ* orig_conv = (LDKCOption_StrZ*)untag_ptr(orig);
20885         LDKCOption_StrZ *ret_copy = MALLOC(sizeof(LDKCOption_StrZ), "LDKCOption_StrZ");
20886         *ret_copy = COption_StrZ_clone(orig_conv);
20887         uint64_t ret_ref = tag_ptr(ret_copy, true);
20888         return ret_ref;
20889 }
20890
20891 uint64_t  __attribute__((export_name("TS_CResult_NoneBolt12SemanticErrorZ_ok"))) TS_CResult_NoneBolt12SemanticErrorZ_ok() {
20892         LDKCResult_NoneBolt12SemanticErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneBolt12SemanticErrorZ), "LDKCResult_NoneBolt12SemanticErrorZ");
20893         *ret_conv = CResult_NoneBolt12SemanticErrorZ_ok();
20894         return tag_ptr(ret_conv, true);
20895 }
20896
20897 uint64_t  __attribute__((export_name("TS_CResult_NoneBolt12SemanticErrorZ_err"))) TS_CResult_NoneBolt12SemanticErrorZ_err(uint32_t e) {
20898         LDKBolt12SemanticError e_conv = LDKBolt12SemanticError_from_js(e);
20899         LDKCResult_NoneBolt12SemanticErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneBolt12SemanticErrorZ), "LDKCResult_NoneBolt12SemanticErrorZ");
20900         *ret_conv = CResult_NoneBolt12SemanticErrorZ_err(e_conv);
20901         return tag_ptr(ret_conv, true);
20902 }
20903
20904 jboolean  __attribute__((export_name("TS_CResult_NoneBolt12SemanticErrorZ_is_ok"))) TS_CResult_NoneBolt12SemanticErrorZ_is_ok(uint64_t o) {
20905         LDKCResult_NoneBolt12SemanticErrorZ* o_conv = (LDKCResult_NoneBolt12SemanticErrorZ*)untag_ptr(o);
20906         jboolean ret_conv = CResult_NoneBolt12SemanticErrorZ_is_ok(o_conv);
20907         return ret_conv;
20908 }
20909
20910 void  __attribute__((export_name("TS_CResult_NoneBolt12SemanticErrorZ_free"))) TS_CResult_NoneBolt12SemanticErrorZ_free(uint64_t _res) {
20911         if (!ptr_is_owned(_res)) return;
20912         void* _res_ptr = untag_ptr(_res);
20913         CHECK_ACCESS(_res_ptr);
20914         LDKCResult_NoneBolt12SemanticErrorZ _res_conv = *(LDKCResult_NoneBolt12SemanticErrorZ*)(_res_ptr);
20915         FREE(untag_ptr(_res));
20916         CResult_NoneBolt12SemanticErrorZ_free(_res_conv);
20917 }
20918
20919 static inline uint64_t CResult_NoneBolt12SemanticErrorZ_clone_ptr(LDKCResult_NoneBolt12SemanticErrorZ *NONNULL_PTR arg) {
20920         LDKCResult_NoneBolt12SemanticErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneBolt12SemanticErrorZ), "LDKCResult_NoneBolt12SemanticErrorZ");
20921         *ret_conv = CResult_NoneBolt12SemanticErrorZ_clone(arg);
20922         return tag_ptr(ret_conv, true);
20923 }
20924 int64_t  __attribute__((export_name("TS_CResult_NoneBolt12SemanticErrorZ_clone_ptr"))) TS_CResult_NoneBolt12SemanticErrorZ_clone_ptr(uint64_t arg) {
20925         LDKCResult_NoneBolt12SemanticErrorZ* arg_conv = (LDKCResult_NoneBolt12SemanticErrorZ*)untag_ptr(arg);
20926         int64_t ret_conv = CResult_NoneBolt12SemanticErrorZ_clone_ptr(arg_conv);
20927         return ret_conv;
20928 }
20929
20930 uint64_t  __attribute__((export_name("TS_CResult_NoneBolt12SemanticErrorZ_clone"))) TS_CResult_NoneBolt12SemanticErrorZ_clone(uint64_t orig) {
20931         LDKCResult_NoneBolt12SemanticErrorZ* orig_conv = (LDKCResult_NoneBolt12SemanticErrorZ*)untag_ptr(orig);
20932         LDKCResult_NoneBolt12SemanticErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneBolt12SemanticErrorZ), "LDKCResult_NoneBolt12SemanticErrorZ");
20933         *ret_conv = CResult_NoneBolt12SemanticErrorZ_clone(orig_conv);
20934         return tag_ptr(ret_conv, true);
20935 }
20936
20937 uint64_t  __attribute__((export_name("TS_CResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZNoneZ_ok"))) TS_CResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZNoneZ_ok(uint64_t o) {
20938         void* o_ptr = untag_ptr(o);
20939         CHECK_ACCESS(o_ptr);
20940         LDKC2Tuple_ThirtyTwoBytesThirtyTwoBytesZ o_conv = *(LDKC2Tuple_ThirtyTwoBytesThirtyTwoBytesZ*)(o_ptr);
20941         o_conv = C2Tuple_ThirtyTwoBytesThirtyTwoBytesZ_clone((LDKC2Tuple_ThirtyTwoBytesThirtyTwoBytesZ*)untag_ptr(o));
20942         LDKCResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZNoneZ), "LDKCResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZNoneZ");
20943         *ret_conv = CResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZNoneZ_ok(o_conv);
20944         return tag_ptr(ret_conv, true);
20945 }
20946
20947 uint64_t  __attribute__((export_name("TS_CResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZNoneZ_err"))) TS_CResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZNoneZ_err() {
20948         LDKCResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZNoneZ), "LDKCResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZNoneZ");
20949         *ret_conv = CResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZNoneZ_err();
20950         return tag_ptr(ret_conv, true);
20951 }
20952
20953 jboolean  __attribute__((export_name("TS_CResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZNoneZ_is_ok"))) TS_CResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZNoneZ_is_ok(uint64_t o) {
20954         LDKCResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZNoneZ* o_conv = (LDKCResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZNoneZ*)untag_ptr(o);
20955         jboolean ret_conv = CResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZNoneZ_is_ok(o_conv);
20956         return ret_conv;
20957 }
20958
20959 void  __attribute__((export_name("TS_CResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZNoneZ_free"))) TS_CResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZNoneZ_free(uint64_t _res) {
20960         if (!ptr_is_owned(_res)) return;
20961         void* _res_ptr = untag_ptr(_res);
20962         CHECK_ACCESS(_res_ptr);
20963         LDKCResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZNoneZ _res_conv = *(LDKCResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZNoneZ*)(_res_ptr);
20964         FREE(untag_ptr(_res));
20965         CResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZNoneZ_free(_res_conv);
20966 }
20967
20968 static inline uint64_t CResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZNoneZ_clone_ptr(LDKCResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZNoneZ *NONNULL_PTR arg) {
20969         LDKCResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZNoneZ), "LDKCResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZNoneZ");
20970         *ret_conv = CResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZNoneZ_clone(arg);
20971         return tag_ptr(ret_conv, true);
20972 }
20973 int64_t  __attribute__((export_name("TS_CResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZNoneZ_clone_ptr"))) TS_CResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZNoneZ_clone_ptr(uint64_t arg) {
20974         LDKCResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZNoneZ* arg_conv = (LDKCResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZNoneZ*)untag_ptr(arg);
20975         int64_t ret_conv = CResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZNoneZ_clone_ptr(arg_conv);
20976         return ret_conv;
20977 }
20978
20979 uint64_t  __attribute__((export_name("TS_CResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZNoneZ_clone"))) TS_CResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZNoneZ_clone(uint64_t orig) {
20980         LDKCResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZNoneZ* orig_conv = (LDKCResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZNoneZ*)untag_ptr(orig);
20981         LDKCResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZNoneZ), "LDKCResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZNoneZ");
20982         *ret_conv = CResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZNoneZ_clone(orig_conv);
20983         return tag_ptr(ret_conv, true);
20984 }
20985
20986 uint64_t  __attribute__((export_name("TS_COption_OffersMessageZ_some"))) TS_COption_OffersMessageZ_some(uint64_t o) {
20987         void* o_ptr = untag_ptr(o);
20988         CHECK_ACCESS(o_ptr);
20989         LDKOffersMessage o_conv = *(LDKOffersMessage*)(o_ptr);
20990         o_conv = OffersMessage_clone((LDKOffersMessage*)untag_ptr(o));
20991         LDKCOption_OffersMessageZ *ret_copy = MALLOC(sizeof(LDKCOption_OffersMessageZ), "LDKCOption_OffersMessageZ");
20992         *ret_copy = COption_OffersMessageZ_some(o_conv);
20993         uint64_t ret_ref = tag_ptr(ret_copy, true);
20994         return ret_ref;
20995 }
20996
20997 uint64_t  __attribute__((export_name("TS_COption_OffersMessageZ_none"))) TS_COption_OffersMessageZ_none() {
20998         LDKCOption_OffersMessageZ *ret_copy = MALLOC(sizeof(LDKCOption_OffersMessageZ), "LDKCOption_OffersMessageZ");
20999         *ret_copy = COption_OffersMessageZ_none();
21000         uint64_t ret_ref = tag_ptr(ret_copy, true);
21001         return ret_ref;
21002 }
21003
21004 void  __attribute__((export_name("TS_COption_OffersMessageZ_free"))) TS_COption_OffersMessageZ_free(uint64_t _res) {
21005         if (!ptr_is_owned(_res)) return;
21006         void* _res_ptr = untag_ptr(_res);
21007         CHECK_ACCESS(_res_ptr);
21008         LDKCOption_OffersMessageZ _res_conv = *(LDKCOption_OffersMessageZ*)(_res_ptr);
21009         FREE(untag_ptr(_res));
21010         COption_OffersMessageZ_free(_res_conv);
21011 }
21012
21013 static inline uint64_t COption_OffersMessageZ_clone_ptr(LDKCOption_OffersMessageZ *NONNULL_PTR arg) {
21014         LDKCOption_OffersMessageZ *ret_copy = MALLOC(sizeof(LDKCOption_OffersMessageZ), "LDKCOption_OffersMessageZ");
21015         *ret_copy = COption_OffersMessageZ_clone(arg);
21016         uint64_t ret_ref = tag_ptr(ret_copy, true);
21017         return ret_ref;
21018 }
21019 int64_t  __attribute__((export_name("TS_COption_OffersMessageZ_clone_ptr"))) TS_COption_OffersMessageZ_clone_ptr(uint64_t arg) {
21020         LDKCOption_OffersMessageZ* arg_conv = (LDKCOption_OffersMessageZ*)untag_ptr(arg);
21021         int64_t ret_conv = COption_OffersMessageZ_clone_ptr(arg_conv);
21022         return ret_conv;
21023 }
21024
21025 uint64_t  __attribute__((export_name("TS_COption_OffersMessageZ_clone"))) TS_COption_OffersMessageZ_clone(uint64_t orig) {
21026         LDKCOption_OffersMessageZ* orig_conv = (LDKCOption_OffersMessageZ*)untag_ptr(orig);
21027         LDKCOption_OffersMessageZ *ret_copy = MALLOC(sizeof(LDKCOption_OffersMessageZ), "LDKCOption_OffersMessageZ");
21028         *ret_copy = COption_OffersMessageZ_clone(orig_conv);
21029         uint64_t ret_ref = tag_ptr(ret_copy, true);
21030         return ret_ref;
21031 }
21032
21033 static inline uint64_t C3Tuple_OffersMessageDestinationBlindedPathZ_clone_ptr(LDKC3Tuple_OffersMessageDestinationBlindedPathZ *NONNULL_PTR arg) {
21034         LDKC3Tuple_OffersMessageDestinationBlindedPathZ* ret_conv = MALLOC(sizeof(LDKC3Tuple_OffersMessageDestinationBlindedPathZ), "LDKC3Tuple_OffersMessageDestinationBlindedPathZ");
21035         *ret_conv = C3Tuple_OffersMessageDestinationBlindedPathZ_clone(arg);
21036         return tag_ptr(ret_conv, true);
21037 }
21038 int64_t  __attribute__((export_name("TS_C3Tuple_OffersMessageDestinationBlindedPathZ_clone_ptr"))) TS_C3Tuple_OffersMessageDestinationBlindedPathZ_clone_ptr(uint64_t arg) {
21039         LDKC3Tuple_OffersMessageDestinationBlindedPathZ* arg_conv = (LDKC3Tuple_OffersMessageDestinationBlindedPathZ*)untag_ptr(arg);
21040         int64_t ret_conv = C3Tuple_OffersMessageDestinationBlindedPathZ_clone_ptr(arg_conv);
21041         return ret_conv;
21042 }
21043
21044 uint64_t  __attribute__((export_name("TS_C3Tuple_OffersMessageDestinationBlindedPathZ_clone"))) TS_C3Tuple_OffersMessageDestinationBlindedPathZ_clone(uint64_t orig) {
21045         LDKC3Tuple_OffersMessageDestinationBlindedPathZ* orig_conv = (LDKC3Tuple_OffersMessageDestinationBlindedPathZ*)untag_ptr(orig);
21046         LDKC3Tuple_OffersMessageDestinationBlindedPathZ* ret_conv = MALLOC(sizeof(LDKC3Tuple_OffersMessageDestinationBlindedPathZ), "LDKC3Tuple_OffersMessageDestinationBlindedPathZ");
21047         *ret_conv = C3Tuple_OffersMessageDestinationBlindedPathZ_clone(orig_conv);
21048         return tag_ptr(ret_conv, true);
21049 }
21050
21051 uint64_t  __attribute__((export_name("TS_C3Tuple_OffersMessageDestinationBlindedPathZ_new"))) TS_C3Tuple_OffersMessageDestinationBlindedPathZ_new(uint64_t a, uint64_t b, uint64_t c) {
21052         void* a_ptr = untag_ptr(a);
21053         CHECK_ACCESS(a_ptr);
21054         LDKOffersMessage a_conv = *(LDKOffersMessage*)(a_ptr);
21055         a_conv = OffersMessage_clone((LDKOffersMessage*)untag_ptr(a));
21056         void* b_ptr = untag_ptr(b);
21057         CHECK_ACCESS(b_ptr);
21058         LDKDestination b_conv = *(LDKDestination*)(b_ptr);
21059         b_conv = Destination_clone((LDKDestination*)untag_ptr(b));
21060         LDKBlindedPath c_conv;
21061         c_conv.inner = untag_ptr(c);
21062         c_conv.is_owned = ptr_is_owned(c);
21063         CHECK_INNER_FIELD_ACCESS_OR_NULL(c_conv);
21064         c_conv = BlindedPath_clone(&c_conv);
21065         LDKC3Tuple_OffersMessageDestinationBlindedPathZ* ret_conv = MALLOC(sizeof(LDKC3Tuple_OffersMessageDestinationBlindedPathZ), "LDKC3Tuple_OffersMessageDestinationBlindedPathZ");
21066         *ret_conv = C3Tuple_OffersMessageDestinationBlindedPathZ_new(a_conv, b_conv, c_conv);
21067         return tag_ptr(ret_conv, true);
21068 }
21069
21070 void  __attribute__((export_name("TS_C3Tuple_OffersMessageDestinationBlindedPathZ_free"))) TS_C3Tuple_OffersMessageDestinationBlindedPathZ_free(uint64_t _res) {
21071         if (!ptr_is_owned(_res)) return;
21072         void* _res_ptr = untag_ptr(_res);
21073         CHECK_ACCESS(_res_ptr);
21074         LDKC3Tuple_OffersMessageDestinationBlindedPathZ _res_conv = *(LDKC3Tuple_OffersMessageDestinationBlindedPathZ*)(_res_ptr);
21075         FREE(untag_ptr(_res));
21076         C3Tuple_OffersMessageDestinationBlindedPathZ_free(_res_conv);
21077 }
21078
21079 void  __attribute__((export_name("TS_CVec_C3Tuple_OffersMessageDestinationBlindedPathZZ_free"))) TS_CVec_C3Tuple_OffersMessageDestinationBlindedPathZZ_free(uint64_tArray _res) {
21080         LDKCVec_C3Tuple_OffersMessageDestinationBlindedPathZZ _res_constr;
21081         _res_constr.datalen = _res->arr_len;
21082         if (_res_constr.datalen > 0)
21083                 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKC3Tuple_OffersMessageDestinationBlindedPathZ), "LDKCVec_C3Tuple_OffersMessageDestinationBlindedPathZZ Elements");
21084         else
21085                 _res_constr.data = NULL;
21086         uint64_t* _res_vals = _res->elems;
21087         for (size_t x = 0; x < _res_constr.datalen; x++) {
21088                 uint64_t _res_conv_49 = _res_vals[x];
21089                 void* _res_conv_49_ptr = untag_ptr(_res_conv_49);
21090                 CHECK_ACCESS(_res_conv_49_ptr);
21091                 LDKC3Tuple_OffersMessageDestinationBlindedPathZ _res_conv_49_conv = *(LDKC3Tuple_OffersMessageDestinationBlindedPathZ*)(_res_conv_49_ptr);
21092                 FREE(untag_ptr(_res_conv_49));
21093                 _res_constr.data[x] = _res_conv_49_conv;
21094         }
21095         FREE(_res);
21096         CVec_C3Tuple_OffersMessageDestinationBlindedPathZZ_free(_res_constr);
21097 }
21098
21099 uint64_t  __attribute__((export_name("TS_CResult_CounterpartyForwardingInfoDecodeErrorZ_ok"))) TS_CResult_CounterpartyForwardingInfoDecodeErrorZ_ok(uint64_t o) {
21100         LDKCounterpartyForwardingInfo o_conv;
21101         o_conv.inner = untag_ptr(o);
21102         o_conv.is_owned = ptr_is_owned(o);
21103         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
21104         o_conv = CounterpartyForwardingInfo_clone(&o_conv);
21105         LDKCResult_CounterpartyForwardingInfoDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CounterpartyForwardingInfoDecodeErrorZ), "LDKCResult_CounterpartyForwardingInfoDecodeErrorZ");
21106         *ret_conv = CResult_CounterpartyForwardingInfoDecodeErrorZ_ok(o_conv);
21107         return tag_ptr(ret_conv, true);
21108 }
21109
21110 uint64_t  __attribute__((export_name("TS_CResult_CounterpartyForwardingInfoDecodeErrorZ_err"))) TS_CResult_CounterpartyForwardingInfoDecodeErrorZ_err(uint64_t e) {
21111         void* e_ptr = untag_ptr(e);
21112         CHECK_ACCESS(e_ptr);
21113         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
21114         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
21115         LDKCResult_CounterpartyForwardingInfoDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CounterpartyForwardingInfoDecodeErrorZ), "LDKCResult_CounterpartyForwardingInfoDecodeErrorZ");
21116         *ret_conv = CResult_CounterpartyForwardingInfoDecodeErrorZ_err(e_conv);
21117         return tag_ptr(ret_conv, true);
21118 }
21119
21120 jboolean  __attribute__((export_name("TS_CResult_CounterpartyForwardingInfoDecodeErrorZ_is_ok"))) TS_CResult_CounterpartyForwardingInfoDecodeErrorZ_is_ok(uint64_t o) {
21121         LDKCResult_CounterpartyForwardingInfoDecodeErrorZ* o_conv = (LDKCResult_CounterpartyForwardingInfoDecodeErrorZ*)untag_ptr(o);
21122         jboolean ret_conv = CResult_CounterpartyForwardingInfoDecodeErrorZ_is_ok(o_conv);
21123         return ret_conv;
21124 }
21125
21126 void  __attribute__((export_name("TS_CResult_CounterpartyForwardingInfoDecodeErrorZ_free"))) TS_CResult_CounterpartyForwardingInfoDecodeErrorZ_free(uint64_t _res) {
21127         if (!ptr_is_owned(_res)) return;
21128         void* _res_ptr = untag_ptr(_res);
21129         CHECK_ACCESS(_res_ptr);
21130         LDKCResult_CounterpartyForwardingInfoDecodeErrorZ _res_conv = *(LDKCResult_CounterpartyForwardingInfoDecodeErrorZ*)(_res_ptr);
21131         FREE(untag_ptr(_res));
21132         CResult_CounterpartyForwardingInfoDecodeErrorZ_free(_res_conv);
21133 }
21134
21135 static inline uint64_t CResult_CounterpartyForwardingInfoDecodeErrorZ_clone_ptr(LDKCResult_CounterpartyForwardingInfoDecodeErrorZ *NONNULL_PTR arg) {
21136         LDKCResult_CounterpartyForwardingInfoDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CounterpartyForwardingInfoDecodeErrorZ), "LDKCResult_CounterpartyForwardingInfoDecodeErrorZ");
21137         *ret_conv = CResult_CounterpartyForwardingInfoDecodeErrorZ_clone(arg);
21138         return tag_ptr(ret_conv, true);
21139 }
21140 int64_t  __attribute__((export_name("TS_CResult_CounterpartyForwardingInfoDecodeErrorZ_clone_ptr"))) TS_CResult_CounterpartyForwardingInfoDecodeErrorZ_clone_ptr(uint64_t arg) {
21141         LDKCResult_CounterpartyForwardingInfoDecodeErrorZ* arg_conv = (LDKCResult_CounterpartyForwardingInfoDecodeErrorZ*)untag_ptr(arg);
21142         int64_t ret_conv = CResult_CounterpartyForwardingInfoDecodeErrorZ_clone_ptr(arg_conv);
21143         return ret_conv;
21144 }
21145
21146 uint64_t  __attribute__((export_name("TS_CResult_CounterpartyForwardingInfoDecodeErrorZ_clone"))) TS_CResult_CounterpartyForwardingInfoDecodeErrorZ_clone(uint64_t orig) {
21147         LDKCResult_CounterpartyForwardingInfoDecodeErrorZ* orig_conv = (LDKCResult_CounterpartyForwardingInfoDecodeErrorZ*)untag_ptr(orig);
21148         LDKCResult_CounterpartyForwardingInfoDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CounterpartyForwardingInfoDecodeErrorZ), "LDKCResult_CounterpartyForwardingInfoDecodeErrorZ");
21149         *ret_conv = CResult_CounterpartyForwardingInfoDecodeErrorZ_clone(orig_conv);
21150         return tag_ptr(ret_conv, true);
21151 }
21152
21153 uint64_t  __attribute__((export_name("TS_CResult_ChannelCounterpartyDecodeErrorZ_ok"))) TS_CResult_ChannelCounterpartyDecodeErrorZ_ok(uint64_t o) {
21154         LDKChannelCounterparty o_conv;
21155         o_conv.inner = untag_ptr(o);
21156         o_conv.is_owned = ptr_is_owned(o);
21157         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
21158         o_conv = ChannelCounterparty_clone(&o_conv);
21159         LDKCResult_ChannelCounterpartyDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelCounterpartyDecodeErrorZ), "LDKCResult_ChannelCounterpartyDecodeErrorZ");
21160         *ret_conv = CResult_ChannelCounterpartyDecodeErrorZ_ok(o_conv);
21161         return tag_ptr(ret_conv, true);
21162 }
21163
21164 uint64_t  __attribute__((export_name("TS_CResult_ChannelCounterpartyDecodeErrorZ_err"))) TS_CResult_ChannelCounterpartyDecodeErrorZ_err(uint64_t e) {
21165         void* e_ptr = untag_ptr(e);
21166         CHECK_ACCESS(e_ptr);
21167         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
21168         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
21169         LDKCResult_ChannelCounterpartyDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelCounterpartyDecodeErrorZ), "LDKCResult_ChannelCounterpartyDecodeErrorZ");
21170         *ret_conv = CResult_ChannelCounterpartyDecodeErrorZ_err(e_conv);
21171         return tag_ptr(ret_conv, true);
21172 }
21173
21174 jboolean  __attribute__((export_name("TS_CResult_ChannelCounterpartyDecodeErrorZ_is_ok"))) TS_CResult_ChannelCounterpartyDecodeErrorZ_is_ok(uint64_t o) {
21175         LDKCResult_ChannelCounterpartyDecodeErrorZ* o_conv = (LDKCResult_ChannelCounterpartyDecodeErrorZ*)untag_ptr(o);
21176         jboolean ret_conv = CResult_ChannelCounterpartyDecodeErrorZ_is_ok(o_conv);
21177         return ret_conv;
21178 }
21179
21180 void  __attribute__((export_name("TS_CResult_ChannelCounterpartyDecodeErrorZ_free"))) TS_CResult_ChannelCounterpartyDecodeErrorZ_free(uint64_t _res) {
21181         if (!ptr_is_owned(_res)) return;
21182         void* _res_ptr = untag_ptr(_res);
21183         CHECK_ACCESS(_res_ptr);
21184         LDKCResult_ChannelCounterpartyDecodeErrorZ _res_conv = *(LDKCResult_ChannelCounterpartyDecodeErrorZ*)(_res_ptr);
21185         FREE(untag_ptr(_res));
21186         CResult_ChannelCounterpartyDecodeErrorZ_free(_res_conv);
21187 }
21188
21189 static inline uint64_t CResult_ChannelCounterpartyDecodeErrorZ_clone_ptr(LDKCResult_ChannelCounterpartyDecodeErrorZ *NONNULL_PTR arg) {
21190         LDKCResult_ChannelCounterpartyDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelCounterpartyDecodeErrorZ), "LDKCResult_ChannelCounterpartyDecodeErrorZ");
21191         *ret_conv = CResult_ChannelCounterpartyDecodeErrorZ_clone(arg);
21192         return tag_ptr(ret_conv, true);
21193 }
21194 int64_t  __attribute__((export_name("TS_CResult_ChannelCounterpartyDecodeErrorZ_clone_ptr"))) TS_CResult_ChannelCounterpartyDecodeErrorZ_clone_ptr(uint64_t arg) {
21195         LDKCResult_ChannelCounterpartyDecodeErrorZ* arg_conv = (LDKCResult_ChannelCounterpartyDecodeErrorZ*)untag_ptr(arg);
21196         int64_t ret_conv = CResult_ChannelCounterpartyDecodeErrorZ_clone_ptr(arg_conv);
21197         return ret_conv;
21198 }
21199
21200 uint64_t  __attribute__((export_name("TS_CResult_ChannelCounterpartyDecodeErrorZ_clone"))) TS_CResult_ChannelCounterpartyDecodeErrorZ_clone(uint64_t orig) {
21201         LDKCResult_ChannelCounterpartyDecodeErrorZ* orig_conv = (LDKCResult_ChannelCounterpartyDecodeErrorZ*)untag_ptr(orig);
21202         LDKCResult_ChannelCounterpartyDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelCounterpartyDecodeErrorZ), "LDKCResult_ChannelCounterpartyDecodeErrorZ");
21203         *ret_conv = CResult_ChannelCounterpartyDecodeErrorZ_clone(orig_conv);
21204         return tag_ptr(ret_conv, true);
21205 }
21206
21207 uint64_t  __attribute__((export_name("TS_CResult_ChannelDetailsDecodeErrorZ_ok"))) TS_CResult_ChannelDetailsDecodeErrorZ_ok(uint64_t o) {
21208         LDKChannelDetails o_conv;
21209         o_conv.inner = untag_ptr(o);
21210         o_conv.is_owned = ptr_is_owned(o);
21211         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
21212         o_conv = ChannelDetails_clone(&o_conv);
21213         LDKCResult_ChannelDetailsDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelDetailsDecodeErrorZ), "LDKCResult_ChannelDetailsDecodeErrorZ");
21214         *ret_conv = CResult_ChannelDetailsDecodeErrorZ_ok(o_conv);
21215         return tag_ptr(ret_conv, true);
21216 }
21217
21218 uint64_t  __attribute__((export_name("TS_CResult_ChannelDetailsDecodeErrorZ_err"))) TS_CResult_ChannelDetailsDecodeErrorZ_err(uint64_t e) {
21219         void* e_ptr = untag_ptr(e);
21220         CHECK_ACCESS(e_ptr);
21221         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
21222         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
21223         LDKCResult_ChannelDetailsDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelDetailsDecodeErrorZ), "LDKCResult_ChannelDetailsDecodeErrorZ");
21224         *ret_conv = CResult_ChannelDetailsDecodeErrorZ_err(e_conv);
21225         return tag_ptr(ret_conv, true);
21226 }
21227
21228 jboolean  __attribute__((export_name("TS_CResult_ChannelDetailsDecodeErrorZ_is_ok"))) TS_CResult_ChannelDetailsDecodeErrorZ_is_ok(uint64_t o) {
21229         LDKCResult_ChannelDetailsDecodeErrorZ* o_conv = (LDKCResult_ChannelDetailsDecodeErrorZ*)untag_ptr(o);
21230         jboolean ret_conv = CResult_ChannelDetailsDecodeErrorZ_is_ok(o_conv);
21231         return ret_conv;
21232 }
21233
21234 void  __attribute__((export_name("TS_CResult_ChannelDetailsDecodeErrorZ_free"))) TS_CResult_ChannelDetailsDecodeErrorZ_free(uint64_t _res) {
21235         if (!ptr_is_owned(_res)) return;
21236         void* _res_ptr = untag_ptr(_res);
21237         CHECK_ACCESS(_res_ptr);
21238         LDKCResult_ChannelDetailsDecodeErrorZ _res_conv = *(LDKCResult_ChannelDetailsDecodeErrorZ*)(_res_ptr);
21239         FREE(untag_ptr(_res));
21240         CResult_ChannelDetailsDecodeErrorZ_free(_res_conv);
21241 }
21242
21243 static inline uint64_t CResult_ChannelDetailsDecodeErrorZ_clone_ptr(LDKCResult_ChannelDetailsDecodeErrorZ *NONNULL_PTR arg) {
21244         LDKCResult_ChannelDetailsDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelDetailsDecodeErrorZ), "LDKCResult_ChannelDetailsDecodeErrorZ");
21245         *ret_conv = CResult_ChannelDetailsDecodeErrorZ_clone(arg);
21246         return tag_ptr(ret_conv, true);
21247 }
21248 int64_t  __attribute__((export_name("TS_CResult_ChannelDetailsDecodeErrorZ_clone_ptr"))) TS_CResult_ChannelDetailsDecodeErrorZ_clone_ptr(uint64_t arg) {
21249         LDKCResult_ChannelDetailsDecodeErrorZ* arg_conv = (LDKCResult_ChannelDetailsDecodeErrorZ*)untag_ptr(arg);
21250         int64_t ret_conv = CResult_ChannelDetailsDecodeErrorZ_clone_ptr(arg_conv);
21251         return ret_conv;
21252 }
21253
21254 uint64_t  __attribute__((export_name("TS_CResult_ChannelDetailsDecodeErrorZ_clone"))) TS_CResult_ChannelDetailsDecodeErrorZ_clone(uint64_t orig) {
21255         LDKCResult_ChannelDetailsDecodeErrorZ* orig_conv = (LDKCResult_ChannelDetailsDecodeErrorZ*)untag_ptr(orig);
21256         LDKCResult_ChannelDetailsDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelDetailsDecodeErrorZ), "LDKCResult_ChannelDetailsDecodeErrorZ");
21257         *ret_conv = CResult_ChannelDetailsDecodeErrorZ_clone(orig_conv);
21258         return tag_ptr(ret_conv, true);
21259 }
21260
21261 uint64_t  __attribute__((export_name("TS_CResult_PhantomRouteHintsDecodeErrorZ_ok"))) TS_CResult_PhantomRouteHintsDecodeErrorZ_ok(uint64_t o) {
21262         LDKPhantomRouteHints o_conv;
21263         o_conv.inner = untag_ptr(o);
21264         o_conv.is_owned = ptr_is_owned(o);
21265         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
21266         o_conv = PhantomRouteHints_clone(&o_conv);
21267         LDKCResult_PhantomRouteHintsDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PhantomRouteHintsDecodeErrorZ), "LDKCResult_PhantomRouteHintsDecodeErrorZ");
21268         *ret_conv = CResult_PhantomRouteHintsDecodeErrorZ_ok(o_conv);
21269         return tag_ptr(ret_conv, true);
21270 }
21271
21272 uint64_t  __attribute__((export_name("TS_CResult_PhantomRouteHintsDecodeErrorZ_err"))) TS_CResult_PhantomRouteHintsDecodeErrorZ_err(uint64_t e) {
21273         void* e_ptr = untag_ptr(e);
21274         CHECK_ACCESS(e_ptr);
21275         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
21276         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
21277         LDKCResult_PhantomRouteHintsDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PhantomRouteHintsDecodeErrorZ), "LDKCResult_PhantomRouteHintsDecodeErrorZ");
21278         *ret_conv = CResult_PhantomRouteHintsDecodeErrorZ_err(e_conv);
21279         return tag_ptr(ret_conv, true);
21280 }
21281
21282 jboolean  __attribute__((export_name("TS_CResult_PhantomRouteHintsDecodeErrorZ_is_ok"))) TS_CResult_PhantomRouteHintsDecodeErrorZ_is_ok(uint64_t o) {
21283         LDKCResult_PhantomRouteHintsDecodeErrorZ* o_conv = (LDKCResult_PhantomRouteHintsDecodeErrorZ*)untag_ptr(o);
21284         jboolean ret_conv = CResult_PhantomRouteHintsDecodeErrorZ_is_ok(o_conv);
21285         return ret_conv;
21286 }
21287
21288 void  __attribute__((export_name("TS_CResult_PhantomRouteHintsDecodeErrorZ_free"))) TS_CResult_PhantomRouteHintsDecodeErrorZ_free(uint64_t _res) {
21289         if (!ptr_is_owned(_res)) return;
21290         void* _res_ptr = untag_ptr(_res);
21291         CHECK_ACCESS(_res_ptr);
21292         LDKCResult_PhantomRouteHintsDecodeErrorZ _res_conv = *(LDKCResult_PhantomRouteHintsDecodeErrorZ*)(_res_ptr);
21293         FREE(untag_ptr(_res));
21294         CResult_PhantomRouteHintsDecodeErrorZ_free(_res_conv);
21295 }
21296
21297 static inline uint64_t CResult_PhantomRouteHintsDecodeErrorZ_clone_ptr(LDKCResult_PhantomRouteHintsDecodeErrorZ *NONNULL_PTR arg) {
21298         LDKCResult_PhantomRouteHintsDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PhantomRouteHintsDecodeErrorZ), "LDKCResult_PhantomRouteHintsDecodeErrorZ");
21299         *ret_conv = CResult_PhantomRouteHintsDecodeErrorZ_clone(arg);
21300         return tag_ptr(ret_conv, true);
21301 }
21302 int64_t  __attribute__((export_name("TS_CResult_PhantomRouteHintsDecodeErrorZ_clone_ptr"))) TS_CResult_PhantomRouteHintsDecodeErrorZ_clone_ptr(uint64_t arg) {
21303         LDKCResult_PhantomRouteHintsDecodeErrorZ* arg_conv = (LDKCResult_PhantomRouteHintsDecodeErrorZ*)untag_ptr(arg);
21304         int64_t ret_conv = CResult_PhantomRouteHintsDecodeErrorZ_clone_ptr(arg_conv);
21305         return ret_conv;
21306 }
21307
21308 uint64_t  __attribute__((export_name("TS_CResult_PhantomRouteHintsDecodeErrorZ_clone"))) TS_CResult_PhantomRouteHintsDecodeErrorZ_clone(uint64_t orig) {
21309         LDKCResult_PhantomRouteHintsDecodeErrorZ* orig_conv = (LDKCResult_PhantomRouteHintsDecodeErrorZ*)untag_ptr(orig);
21310         LDKCResult_PhantomRouteHintsDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PhantomRouteHintsDecodeErrorZ), "LDKCResult_PhantomRouteHintsDecodeErrorZ");
21311         *ret_conv = CResult_PhantomRouteHintsDecodeErrorZ_clone(orig_conv);
21312         return tag_ptr(ret_conv, true);
21313 }
21314
21315 uint64_t  __attribute__((export_name("TS_CResult_ChannelShutdownStateDecodeErrorZ_ok"))) TS_CResult_ChannelShutdownStateDecodeErrorZ_ok(uint32_t o) {
21316         LDKChannelShutdownState o_conv = LDKChannelShutdownState_from_js(o);
21317         LDKCResult_ChannelShutdownStateDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelShutdownStateDecodeErrorZ), "LDKCResult_ChannelShutdownStateDecodeErrorZ");
21318         *ret_conv = CResult_ChannelShutdownStateDecodeErrorZ_ok(o_conv);
21319         return tag_ptr(ret_conv, true);
21320 }
21321
21322 uint64_t  __attribute__((export_name("TS_CResult_ChannelShutdownStateDecodeErrorZ_err"))) TS_CResult_ChannelShutdownStateDecodeErrorZ_err(uint64_t e) {
21323         void* e_ptr = untag_ptr(e);
21324         CHECK_ACCESS(e_ptr);
21325         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
21326         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
21327         LDKCResult_ChannelShutdownStateDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelShutdownStateDecodeErrorZ), "LDKCResult_ChannelShutdownStateDecodeErrorZ");
21328         *ret_conv = CResult_ChannelShutdownStateDecodeErrorZ_err(e_conv);
21329         return tag_ptr(ret_conv, true);
21330 }
21331
21332 jboolean  __attribute__((export_name("TS_CResult_ChannelShutdownStateDecodeErrorZ_is_ok"))) TS_CResult_ChannelShutdownStateDecodeErrorZ_is_ok(uint64_t o) {
21333         LDKCResult_ChannelShutdownStateDecodeErrorZ* o_conv = (LDKCResult_ChannelShutdownStateDecodeErrorZ*)untag_ptr(o);
21334         jboolean ret_conv = CResult_ChannelShutdownStateDecodeErrorZ_is_ok(o_conv);
21335         return ret_conv;
21336 }
21337
21338 void  __attribute__((export_name("TS_CResult_ChannelShutdownStateDecodeErrorZ_free"))) TS_CResult_ChannelShutdownStateDecodeErrorZ_free(uint64_t _res) {
21339         if (!ptr_is_owned(_res)) return;
21340         void* _res_ptr = untag_ptr(_res);
21341         CHECK_ACCESS(_res_ptr);
21342         LDKCResult_ChannelShutdownStateDecodeErrorZ _res_conv = *(LDKCResult_ChannelShutdownStateDecodeErrorZ*)(_res_ptr);
21343         FREE(untag_ptr(_res));
21344         CResult_ChannelShutdownStateDecodeErrorZ_free(_res_conv);
21345 }
21346
21347 static inline uint64_t CResult_ChannelShutdownStateDecodeErrorZ_clone_ptr(LDKCResult_ChannelShutdownStateDecodeErrorZ *NONNULL_PTR arg) {
21348         LDKCResult_ChannelShutdownStateDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelShutdownStateDecodeErrorZ), "LDKCResult_ChannelShutdownStateDecodeErrorZ");
21349         *ret_conv = CResult_ChannelShutdownStateDecodeErrorZ_clone(arg);
21350         return tag_ptr(ret_conv, true);
21351 }
21352 int64_t  __attribute__((export_name("TS_CResult_ChannelShutdownStateDecodeErrorZ_clone_ptr"))) TS_CResult_ChannelShutdownStateDecodeErrorZ_clone_ptr(uint64_t arg) {
21353         LDKCResult_ChannelShutdownStateDecodeErrorZ* arg_conv = (LDKCResult_ChannelShutdownStateDecodeErrorZ*)untag_ptr(arg);
21354         int64_t ret_conv = CResult_ChannelShutdownStateDecodeErrorZ_clone_ptr(arg_conv);
21355         return ret_conv;
21356 }
21357
21358 uint64_t  __attribute__((export_name("TS_CResult_ChannelShutdownStateDecodeErrorZ_clone"))) TS_CResult_ChannelShutdownStateDecodeErrorZ_clone(uint64_t orig) {
21359         LDKCResult_ChannelShutdownStateDecodeErrorZ* orig_conv = (LDKCResult_ChannelShutdownStateDecodeErrorZ*)untag_ptr(orig);
21360         LDKCResult_ChannelShutdownStateDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelShutdownStateDecodeErrorZ), "LDKCResult_ChannelShutdownStateDecodeErrorZ");
21361         *ret_conv = CResult_ChannelShutdownStateDecodeErrorZ_clone(orig_conv);
21362         return tag_ptr(ret_conv, true);
21363 }
21364
21365 void  __attribute__((export_name("TS_CVec_ChannelMonitorZ_free"))) TS_CVec_ChannelMonitorZ_free(uint64_tArray _res) {
21366         LDKCVec_ChannelMonitorZ _res_constr;
21367         _res_constr.datalen = _res->arr_len;
21368         if (_res_constr.datalen > 0)
21369                 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKChannelMonitor), "LDKCVec_ChannelMonitorZ Elements");
21370         else
21371                 _res_constr.data = NULL;
21372         uint64_t* _res_vals = _res->elems;
21373         for (size_t q = 0; q < _res_constr.datalen; q++) {
21374                 uint64_t _res_conv_16 = _res_vals[q];
21375                 LDKChannelMonitor _res_conv_16_conv;
21376                 _res_conv_16_conv.inner = untag_ptr(_res_conv_16);
21377                 _res_conv_16_conv.is_owned = ptr_is_owned(_res_conv_16);
21378                 CHECK_INNER_FIELD_ACCESS_OR_NULL(_res_conv_16_conv);
21379                 _res_constr.data[q] = _res_conv_16_conv;
21380         }
21381         FREE(_res);
21382         CVec_ChannelMonitorZ_free(_res_constr);
21383 }
21384
21385 uint64_t  __attribute__((export_name("TS_C2Tuple_ThirtyTwoBytesChannelManagerZ_new"))) TS_C2Tuple_ThirtyTwoBytesChannelManagerZ_new(int8_tArray a, uint64_t b) {
21386         LDKThirtyTwoBytes a_ref;
21387         CHECK(a->arr_len == 32);
21388         memcpy(a_ref.data, a->elems, 32); FREE(a);
21389         LDKChannelManager b_conv;
21390         b_conv.inner = untag_ptr(b);
21391         b_conv.is_owned = ptr_is_owned(b);
21392         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
21393         // WARNING: we need a move here but no clone is available for LDKChannelManager
21394         
21395         LDKC2Tuple_ThirtyTwoBytesChannelManagerZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_ThirtyTwoBytesChannelManagerZ), "LDKC2Tuple_ThirtyTwoBytesChannelManagerZ");
21396         *ret_conv = C2Tuple_ThirtyTwoBytesChannelManagerZ_new(a_ref, b_conv);
21397         return tag_ptr(ret_conv, true);
21398 }
21399
21400 void  __attribute__((export_name("TS_C2Tuple_ThirtyTwoBytesChannelManagerZ_free"))) TS_C2Tuple_ThirtyTwoBytesChannelManagerZ_free(uint64_t _res) {
21401         if (!ptr_is_owned(_res)) return;
21402         void* _res_ptr = untag_ptr(_res);
21403         CHECK_ACCESS(_res_ptr);
21404         LDKC2Tuple_ThirtyTwoBytesChannelManagerZ _res_conv = *(LDKC2Tuple_ThirtyTwoBytesChannelManagerZ*)(_res_ptr);
21405         FREE(untag_ptr(_res));
21406         C2Tuple_ThirtyTwoBytesChannelManagerZ_free(_res_conv);
21407 }
21408
21409 uint64_t  __attribute__((export_name("TS_CResult_C2Tuple_ThirtyTwoBytesChannelManagerZDecodeErrorZ_ok"))) TS_CResult_C2Tuple_ThirtyTwoBytesChannelManagerZDecodeErrorZ_ok(uint64_t o) {
21410         void* o_ptr = untag_ptr(o);
21411         CHECK_ACCESS(o_ptr);
21412         LDKC2Tuple_ThirtyTwoBytesChannelManagerZ o_conv = *(LDKC2Tuple_ThirtyTwoBytesChannelManagerZ*)(o_ptr);
21413         // WARNING: we may need a move here but no clone is available for LDKC2Tuple_ThirtyTwoBytesChannelManagerZ
21414         LDKCResult_C2Tuple_ThirtyTwoBytesChannelManagerZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_ThirtyTwoBytesChannelManagerZDecodeErrorZ), "LDKCResult_C2Tuple_ThirtyTwoBytesChannelManagerZDecodeErrorZ");
21415         *ret_conv = CResult_C2Tuple_ThirtyTwoBytesChannelManagerZDecodeErrorZ_ok(o_conv);
21416         return tag_ptr(ret_conv, true);
21417 }
21418
21419 uint64_t  __attribute__((export_name("TS_CResult_C2Tuple_ThirtyTwoBytesChannelManagerZDecodeErrorZ_err"))) TS_CResult_C2Tuple_ThirtyTwoBytesChannelManagerZDecodeErrorZ_err(uint64_t e) {
21420         void* e_ptr = untag_ptr(e);
21421         CHECK_ACCESS(e_ptr);
21422         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
21423         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
21424         LDKCResult_C2Tuple_ThirtyTwoBytesChannelManagerZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_ThirtyTwoBytesChannelManagerZDecodeErrorZ), "LDKCResult_C2Tuple_ThirtyTwoBytesChannelManagerZDecodeErrorZ");
21425         *ret_conv = CResult_C2Tuple_ThirtyTwoBytesChannelManagerZDecodeErrorZ_err(e_conv);
21426         return tag_ptr(ret_conv, true);
21427 }
21428
21429 jboolean  __attribute__((export_name("TS_CResult_C2Tuple_ThirtyTwoBytesChannelManagerZDecodeErrorZ_is_ok"))) TS_CResult_C2Tuple_ThirtyTwoBytesChannelManagerZDecodeErrorZ_is_ok(uint64_t o) {
21430         LDKCResult_C2Tuple_ThirtyTwoBytesChannelManagerZDecodeErrorZ* o_conv = (LDKCResult_C2Tuple_ThirtyTwoBytesChannelManagerZDecodeErrorZ*)untag_ptr(o);
21431         jboolean ret_conv = CResult_C2Tuple_ThirtyTwoBytesChannelManagerZDecodeErrorZ_is_ok(o_conv);
21432         return ret_conv;
21433 }
21434
21435 void  __attribute__((export_name("TS_CResult_C2Tuple_ThirtyTwoBytesChannelManagerZDecodeErrorZ_free"))) TS_CResult_C2Tuple_ThirtyTwoBytesChannelManagerZDecodeErrorZ_free(uint64_t _res) {
21436         if (!ptr_is_owned(_res)) return;
21437         void* _res_ptr = untag_ptr(_res);
21438         CHECK_ACCESS(_res_ptr);
21439         LDKCResult_C2Tuple_ThirtyTwoBytesChannelManagerZDecodeErrorZ _res_conv = *(LDKCResult_C2Tuple_ThirtyTwoBytesChannelManagerZDecodeErrorZ*)(_res_ptr);
21440         FREE(untag_ptr(_res));
21441         CResult_C2Tuple_ThirtyTwoBytesChannelManagerZDecodeErrorZ_free(_res_conv);
21442 }
21443
21444 uint64_t  __attribute__((export_name("TS_CResult_MaxDustHTLCExposureDecodeErrorZ_ok"))) TS_CResult_MaxDustHTLCExposureDecodeErrorZ_ok(uint64_t o) {
21445         void* o_ptr = untag_ptr(o);
21446         CHECK_ACCESS(o_ptr);
21447         LDKMaxDustHTLCExposure o_conv = *(LDKMaxDustHTLCExposure*)(o_ptr);
21448         o_conv = MaxDustHTLCExposure_clone((LDKMaxDustHTLCExposure*)untag_ptr(o));
21449         LDKCResult_MaxDustHTLCExposureDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_MaxDustHTLCExposureDecodeErrorZ), "LDKCResult_MaxDustHTLCExposureDecodeErrorZ");
21450         *ret_conv = CResult_MaxDustHTLCExposureDecodeErrorZ_ok(o_conv);
21451         return tag_ptr(ret_conv, true);
21452 }
21453
21454 uint64_t  __attribute__((export_name("TS_CResult_MaxDustHTLCExposureDecodeErrorZ_err"))) TS_CResult_MaxDustHTLCExposureDecodeErrorZ_err(uint64_t e) {
21455         void* e_ptr = untag_ptr(e);
21456         CHECK_ACCESS(e_ptr);
21457         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
21458         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
21459         LDKCResult_MaxDustHTLCExposureDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_MaxDustHTLCExposureDecodeErrorZ), "LDKCResult_MaxDustHTLCExposureDecodeErrorZ");
21460         *ret_conv = CResult_MaxDustHTLCExposureDecodeErrorZ_err(e_conv);
21461         return tag_ptr(ret_conv, true);
21462 }
21463
21464 jboolean  __attribute__((export_name("TS_CResult_MaxDustHTLCExposureDecodeErrorZ_is_ok"))) TS_CResult_MaxDustHTLCExposureDecodeErrorZ_is_ok(uint64_t o) {
21465         LDKCResult_MaxDustHTLCExposureDecodeErrorZ* o_conv = (LDKCResult_MaxDustHTLCExposureDecodeErrorZ*)untag_ptr(o);
21466         jboolean ret_conv = CResult_MaxDustHTLCExposureDecodeErrorZ_is_ok(o_conv);
21467         return ret_conv;
21468 }
21469
21470 void  __attribute__((export_name("TS_CResult_MaxDustHTLCExposureDecodeErrorZ_free"))) TS_CResult_MaxDustHTLCExposureDecodeErrorZ_free(uint64_t _res) {
21471         if (!ptr_is_owned(_res)) return;
21472         void* _res_ptr = untag_ptr(_res);
21473         CHECK_ACCESS(_res_ptr);
21474         LDKCResult_MaxDustHTLCExposureDecodeErrorZ _res_conv = *(LDKCResult_MaxDustHTLCExposureDecodeErrorZ*)(_res_ptr);
21475         FREE(untag_ptr(_res));
21476         CResult_MaxDustHTLCExposureDecodeErrorZ_free(_res_conv);
21477 }
21478
21479 static inline uint64_t CResult_MaxDustHTLCExposureDecodeErrorZ_clone_ptr(LDKCResult_MaxDustHTLCExposureDecodeErrorZ *NONNULL_PTR arg) {
21480         LDKCResult_MaxDustHTLCExposureDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_MaxDustHTLCExposureDecodeErrorZ), "LDKCResult_MaxDustHTLCExposureDecodeErrorZ");
21481         *ret_conv = CResult_MaxDustHTLCExposureDecodeErrorZ_clone(arg);
21482         return tag_ptr(ret_conv, true);
21483 }
21484 int64_t  __attribute__((export_name("TS_CResult_MaxDustHTLCExposureDecodeErrorZ_clone_ptr"))) TS_CResult_MaxDustHTLCExposureDecodeErrorZ_clone_ptr(uint64_t arg) {
21485         LDKCResult_MaxDustHTLCExposureDecodeErrorZ* arg_conv = (LDKCResult_MaxDustHTLCExposureDecodeErrorZ*)untag_ptr(arg);
21486         int64_t ret_conv = CResult_MaxDustHTLCExposureDecodeErrorZ_clone_ptr(arg_conv);
21487         return ret_conv;
21488 }
21489
21490 uint64_t  __attribute__((export_name("TS_CResult_MaxDustHTLCExposureDecodeErrorZ_clone"))) TS_CResult_MaxDustHTLCExposureDecodeErrorZ_clone(uint64_t orig) {
21491         LDKCResult_MaxDustHTLCExposureDecodeErrorZ* orig_conv = (LDKCResult_MaxDustHTLCExposureDecodeErrorZ*)untag_ptr(orig);
21492         LDKCResult_MaxDustHTLCExposureDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_MaxDustHTLCExposureDecodeErrorZ), "LDKCResult_MaxDustHTLCExposureDecodeErrorZ");
21493         *ret_conv = CResult_MaxDustHTLCExposureDecodeErrorZ_clone(orig_conv);
21494         return tag_ptr(ret_conv, true);
21495 }
21496
21497 uint64_t  __attribute__((export_name("TS_CResult_ChannelConfigDecodeErrorZ_ok"))) TS_CResult_ChannelConfigDecodeErrorZ_ok(uint64_t o) {
21498         LDKChannelConfig o_conv;
21499         o_conv.inner = untag_ptr(o);
21500         o_conv.is_owned = ptr_is_owned(o);
21501         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
21502         o_conv = ChannelConfig_clone(&o_conv);
21503         LDKCResult_ChannelConfigDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelConfigDecodeErrorZ), "LDKCResult_ChannelConfigDecodeErrorZ");
21504         *ret_conv = CResult_ChannelConfigDecodeErrorZ_ok(o_conv);
21505         return tag_ptr(ret_conv, true);
21506 }
21507
21508 uint64_t  __attribute__((export_name("TS_CResult_ChannelConfigDecodeErrorZ_err"))) TS_CResult_ChannelConfigDecodeErrorZ_err(uint64_t e) {
21509         void* e_ptr = untag_ptr(e);
21510         CHECK_ACCESS(e_ptr);
21511         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
21512         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
21513         LDKCResult_ChannelConfigDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelConfigDecodeErrorZ), "LDKCResult_ChannelConfigDecodeErrorZ");
21514         *ret_conv = CResult_ChannelConfigDecodeErrorZ_err(e_conv);
21515         return tag_ptr(ret_conv, true);
21516 }
21517
21518 jboolean  __attribute__((export_name("TS_CResult_ChannelConfigDecodeErrorZ_is_ok"))) TS_CResult_ChannelConfigDecodeErrorZ_is_ok(uint64_t o) {
21519         LDKCResult_ChannelConfigDecodeErrorZ* o_conv = (LDKCResult_ChannelConfigDecodeErrorZ*)untag_ptr(o);
21520         jboolean ret_conv = CResult_ChannelConfigDecodeErrorZ_is_ok(o_conv);
21521         return ret_conv;
21522 }
21523
21524 void  __attribute__((export_name("TS_CResult_ChannelConfigDecodeErrorZ_free"))) TS_CResult_ChannelConfigDecodeErrorZ_free(uint64_t _res) {
21525         if (!ptr_is_owned(_res)) return;
21526         void* _res_ptr = untag_ptr(_res);
21527         CHECK_ACCESS(_res_ptr);
21528         LDKCResult_ChannelConfigDecodeErrorZ _res_conv = *(LDKCResult_ChannelConfigDecodeErrorZ*)(_res_ptr);
21529         FREE(untag_ptr(_res));
21530         CResult_ChannelConfigDecodeErrorZ_free(_res_conv);
21531 }
21532
21533 static inline uint64_t CResult_ChannelConfigDecodeErrorZ_clone_ptr(LDKCResult_ChannelConfigDecodeErrorZ *NONNULL_PTR arg) {
21534         LDKCResult_ChannelConfigDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelConfigDecodeErrorZ), "LDKCResult_ChannelConfigDecodeErrorZ");
21535         *ret_conv = CResult_ChannelConfigDecodeErrorZ_clone(arg);
21536         return tag_ptr(ret_conv, true);
21537 }
21538 int64_t  __attribute__((export_name("TS_CResult_ChannelConfigDecodeErrorZ_clone_ptr"))) TS_CResult_ChannelConfigDecodeErrorZ_clone_ptr(uint64_t arg) {
21539         LDKCResult_ChannelConfigDecodeErrorZ* arg_conv = (LDKCResult_ChannelConfigDecodeErrorZ*)untag_ptr(arg);
21540         int64_t ret_conv = CResult_ChannelConfigDecodeErrorZ_clone_ptr(arg_conv);
21541         return ret_conv;
21542 }
21543
21544 uint64_t  __attribute__((export_name("TS_CResult_ChannelConfigDecodeErrorZ_clone"))) TS_CResult_ChannelConfigDecodeErrorZ_clone(uint64_t orig) {
21545         LDKCResult_ChannelConfigDecodeErrorZ* orig_conv = (LDKCResult_ChannelConfigDecodeErrorZ*)untag_ptr(orig);
21546         LDKCResult_ChannelConfigDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelConfigDecodeErrorZ), "LDKCResult_ChannelConfigDecodeErrorZ");
21547         *ret_conv = CResult_ChannelConfigDecodeErrorZ_clone(orig_conv);
21548         return tag_ptr(ret_conv, true);
21549 }
21550
21551 uint64_t  __attribute__((export_name("TS_COption_MaxDustHTLCExposureZ_some"))) TS_COption_MaxDustHTLCExposureZ_some(uint64_t o) {
21552         void* o_ptr = untag_ptr(o);
21553         CHECK_ACCESS(o_ptr);
21554         LDKMaxDustHTLCExposure o_conv = *(LDKMaxDustHTLCExposure*)(o_ptr);
21555         o_conv = MaxDustHTLCExposure_clone((LDKMaxDustHTLCExposure*)untag_ptr(o));
21556         LDKCOption_MaxDustHTLCExposureZ *ret_copy = MALLOC(sizeof(LDKCOption_MaxDustHTLCExposureZ), "LDKCOption_MaxDustHTLCExposureZ");
21557         *ret_copy = COption_MaxDustHTLCExposureZ_some(o_conv);
21558         uint64_t ret_ref = tag_ptr(ret_copy, true);
21559         return ret_ref;
21560 }
21561
21562 uint64_t  __attribute__((export_name("TS_COption_MaxDustHTLCExposureZ_none"))) TS_COption_MaxDustHTLCExposureZ_none() {
21563         LDKCOption_MaxDustHTLCExposureZ *ret_copy = MALLOC(sizeof(LDKCOption_MaxDustHTLCExposureZ), "LDKCOption_MaxDustHTLCExposureZ");
21564         *ret_copy = COption_MaxDustHTLCExposureZ_none();
21565         uint64_t ret_ref = tag_ptr(ret_copy, true);
21566         return ret_ref;
21567 }
21568
21569 void  __attribute__((export_name("TS_COption_MaxDustHTLCExposureZ_free"))) TS_COption_MaxDustHTLCExposureZ_free(uint64_t _res) {
21570         if (!ptr_is_owned(_res)) return;
21571         void* _res_ptr = untag_ptr(_res);
21572         CHECK_ACCESS(_res_ptr);
21573         LDKCOption_MaxDustHTLCExposureZ _res_conv = *(LDKCOption_MaxDustHTLCExposureZ*)(_res_ptr);
21574         FREE(untag_ptr(_res));
21575         COption_MaxDustHTLCExposureZ_free(_res_conv);
21576 }
21577
21578 static inline uint64_t COption_MaxDustHTLCExposureZ_clone_ptr(LDKCOption_MaxDustHTLCExposureZ *NONNULL_PTR arg) {
21579         LDKCOption_MaxDustHTLCExposureZ *ret_copy = MALLOC(sizeof(LDKCOption_MaxDustHTLCExposureZ), "LDKCOption_MaxDustHTLCExposureZ");
21580         *ret_copy = COption_MaxDustHTLCExposureZ_clone(arg);
21581         uint64_t ret_ref = tag_ptr(ret_copy, true);
21582         return ret_ref;
21583 }
21584 int64_t  __attribute__((export_name("TS_COption_MaxDustHTLCExposureZ_clone_ptr"))) TS_COption_MaxDustHTLCExposureZ_clone_ptr(uint64_t arg) {
21585         LDKCOption_MaxDustHTLCExposureZ* arg_conv = (LDKCOption_MaxDustHTLCExposureZ*)untag_ptr(arg);
21586         int64_t ret_conv = COption_MaxDustHTLCExposureZ_clone_ptr(arg_conv);
21587         return ret_conv;
21588 }
21589
21590 uint64_t  __attribute__((export_name("TS_COption_MaxDustHTLCExposureZ_clone"))) TS_COption_MaxDustHTLCExposureZ_clone(uint64_t orig) {
21591         LDKCOption_MaxDustHTLCExposureZ* orig_conv = (LDKCOption_MaxDustHTLCExposureZ*)untag_ptr(orig);
21592         LDKCOption_MaxDustHTLCExposureZ *ret_copy = MALLOC(sizeof(LDKCOption_MaxDustHTLCExposureZ), "LDKCOption_MaxDustHTLCExposureZ");
21593         *ret_copy = COption_MaxDustHTLCExposureZ_clone(orig_conv);
21594         uint64_t ret_ref = tag_ptr(ret_copy, true);
21595         return ret_ref;
21596 }
21597
21598 uint64_t  __attribute__((export_name("TS_COption_APIErrorZ_some"))) TS_COption_APIErrorZ_some(uint64_t o) {
21599         void* o_ptr = untag_ptr(o);
21600         CHECK_ACCESS(o_ptr);
21601         LDKAPIError o_conv = *(LDKAPIError*)(o_ptr);
21602         o_conv = APIError_clone((LDKAPIError*)untag_ptr(o));
21603         LDKCOption_APIErrorZ *ret_copy = MALLOC(sizeof(LDKCOption_APIErrorZ), "LDKCOption_APIErrorZ");
21604         *ret_copy = COption_APIErrorZ_some(o_conv);
21605         uint64_t ret_ref = tag_ptr(ret_copy, true);
21606         return ret_ref;
21607 }
21608
21609 uint64_t  __attribute__((export_name("TS_COption_APIErrorZ_none"))) TS_COption_APIErrorZ_none() {
21610         LDKCOption_APIErrorZ *ret_copy = MALLOC(sizeof(LDKCOption_APIErrorZ), "LDKCOption_APIErrorZ");
21611         *ret_copy = COption_APIErrorZ_none();
21612         uint64_t ret_ref = tag_ptr(ret_copy, true);
21613         return ret_ref;
21614 }
21615
21616 void  __attribute__((export_name("TS_COption_APIErrorZ_free"))) TS_COption_APIErrorZ_free(uint64_t _res) {
21617         if (!ptr_is_owned(_res)) return;
21618         void* _res_ptr = untag_ptr(_res);
21619         CHECK_ACCESS(_res_ptr);
21620         LDKCOption_APIErrorZ _res_conv = *(LDKCOption_APIErrorZ*)(_res_ptr);
21621         FREE(untag_ptr(_res));
21622         COption_APIErrorZ_free(_res_conv);
21623 }
21624
21625 static inline uint64_t COption_APIErrorZ_clone_ptr(LDKCOption_APIErrorZ *NONNULL_PTR arg) {
21626         LDKCOption_APIErrorZ *ret_copy = MALLOC(sizeof(LDKCOption_APIErrorZ), "LDKCOption_APIErrorZ");
21627         *ret_copy = COption_APIErrorZ_clone(arg);
21628         uint64_t ret_ref = tag_ptr(ret_copy, true);
21629         return ret_ref;
21630 }
21631 int64_t  __attribute__((export_name("TS_COption_APIErrorZ_clone_ptr"))) TS_COption_APIErrorZ_clone_ptr(uint64_t arg) {
21632         LDKCOption_APIErrorZ* arg_conv = (LDKCOption_APIErrorZ*)untag_ptr(arg);
21633         int64_t ret_conv = COption_APIErrorZ_clone_ptr(arg_conv);
21634         return ret_conv;
21635 }
21636
21637 uint64_t  __attribute__((export_name("TS_COption_APIErrorZ_clone"))) TS_COption_APIErrorZ_clone(uint64_t orig) {
21638         LDKCOption_APIErrorZ* orig_conv = (LDKCOption_APIErrorZ*)untag_ptr(orig);
21639         LDKCOption_APIErrorZ *ret_copy = MALLOC(sizeof(LDKCOption_APIErrorZ), "LDKCOption_APIErrorZ");
21640         *ret_copy = COption_APIErrorZ_clone(orig_conv);
21641         uint64_t ret_ref = tag_ptr(ret_copy, true);
21642         return ret_ref;
21643 }
21644
21645 uint64_t  __attribute__((export_name("TS_CResult_COption_APIErrorZDecodeErrorZ_ok"))) TS_CResult_COption_APIErrorZDecodeErrorZ_ok(uint64_t o) {
21646         void* o_ptr = untag_ptr(o);
21647         CHECK_ACCESS(o_ptr);
21648         LDKCOption_APIErrorZ o_conv = *(LDKCOption_APIErrorZ*)(o_ptr);
21649         o_conv = COption_APIErrorZ_clone((LDKCOption_APIErrorZ*)untag_ptr(o));
21650         LDKCResult_COption_APIErrorZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_COption_APIErrorZDecodeErrorZ), "LDKCResult_COption_APIErrorZDecodeErrorZ");
21651         *ret_conv = CResult_COption_APIErrorZDecodeErrorZ_ok(o_conv);
21652         return tag_ptr(ret_conv, true);
21653 }
21654
21655 uint64_t  __attribute__((export_name("TS_CResult_COption_APIErrorZDecodeErrorZ_err"))) TS_CResult_COption_APIErrorZDecodeErrorZ_err(uint64_t e) {
21656         void* e_ptr = untag_ptr(e);
21657         CHECK_ACCESS(e_ptr);
21658         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
21659         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
21660         LDKCResult_COption_APIErrorZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_COption_APIErrorZDecodeErrorZ), "LDKCResult_COption_APIErrorZDecodeErrorZ");
21661         *ret_conv = CResult_COption_APIErrorZDecodeErrorZ_err(e_conv);
21662         return tag_ptr(ret_conv, true);
21663 }
21664
21665 jboolean  __attribute__((export_name("TS_CResult_COption_APIErrorZDecodeErrorZ_is_ok"))) TS_CResult_COption_APIErrorZDecodeErrorZ_is_ok(uint64_t o) {
21666         LDKCResult_COption_APIErrorZDecodeErrorZ* o_conv = (LDKCResult_COption_APIErrorZDecodeErrorZ*)untag_ptr(o);
21667         jboolean ret_conv = CResult_COption_APIErrorZDecodeErrorZ_is_ok(o_conv);
21668         return ret_conv;
21669 }
21670
21671 void  __attribute__((export_name("TS_CResult_COption_APIErrorZDecodeErrorZ_free"))) TS_CResult_COption_APIErrorZDecodeErrorZ_free(uint64_t _res) {
21672         if (!ptr_is_owned(_res)) return;
21673         void* _res_ptr = untag_ptr(_res);
21674         CHECK_ACCESS(_res_ptr);
21675         LDKCResult_COption_APIErrorZDecodeErrorZ _res_conv = *(LDKCResult_COption_APIErrorZDecodeErrorZ*)(_res_ptr);
21676         FREE(untag_ptr(_res));
21677         CResult_COption_APIErrorZDecodeErrorZ_free(_res_conv);
21678 }
21679
21680 static inline uint64_t CResult_COption_APIErrorZDecodeErrorZ_clone_ptr(LDKCResult_COption_APIErrorZDecodeErrorZ *NONNULL_PTR arg) {
21681         LDKCResult_COption_APIErrorZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_COption_APIErrorZDecodeErrorZ), "LDKCResult_COption_APIErrorZDecodeErrorZ");
21682         *ret_conv = CResult_COption_APIErrorZDecodeErrorZ_clone(arg);
21683         return tag_ptr(ret_conv, true);
21684 }
21685 int64_t  __attribute__((export_name("TS_CResult_COption_APIErrorZDecodeErrorZ_clone_ptr"))) TS_CResult_COption_APIErrorZDecodeErrorZ_clone_ptr(uint64_t arg) {
21686         LDKCResult_COption_APIErrorZDecodeErrorZ* arg_conv = (LDKCResult_COption_APIErrorZDecodeErrorZ*)untag_ptr(arg);
21687         int64_t ret_conv = CResult_COption_APIErrorZDecodeErrorZ_clone_ptr(arg_conv);
21688         return ret_conv;
21689 }
21690
21691 uint64_t  __attribute__((export_name("TS_CResult_COption_APIErrorZDecodeErrorZ_clone"))) TS_CResult_COption_APIErrorZDecodeErrorZ_clone(uint64_t orig) {
21692         LDKCResult_COption_APIErrorZDecodeErrorZ* orig_conv = (LDKCResult_COption_APIErrorZDecodeErrorZ*)untag_ptr(orig);
21693         LDKCResult_COption_APIErrorZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_COption_APIErrorZDecodeErrorZ), "LDKCResult_COption_APIErrorZDecodeErrorZ");
21694         *ret_conv = CResult_COption_APIErrorZDecodeErrorZ_clone(orig_conv);
21695         return tag_ptr(ret_conv, true);
21696 }
21697
21698 uint64_t  __attribute__((export_name("TS_CResult_ChannelMonitorUpdateDecodeErrorZ_ok"))) TS_CResult_ChannelMonitorUpdateDecodeErrorZ_ok(uint64_t o) {
21699         LDKChannelMonitorUpdate o_conv;
21700         o_conv.inner = untag_ptr(o);
21701         o_conv.is_owned = ptr_is_owned(o);
21702         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
21703         o_conv = ChannelMonitorUpdate_clone(&o_conv);
21704         LDKCResult_ChannelMonitorUpdateDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelMonitorUpdateDecodeErrorZ), "LDKCResult_ChannelMonitorUpdateDecodeErrorZ");
21705         *ret_conv = CResult_ChannelMonitorUpdateDecodeErrorZ_ok(o_conv);
21706         return tag_ptr(ret_conv, true);
21707 }
21708
21709 uint64_t  __attribute__((export_name("TS_CResult_ChannelMonitorUpdateDecodeErrorZ_err"))) TS_CResult_ChannelMonitorUpdateDecodeErrorZ_err(uint64_t e) {
21710         void* e_ptr = untag_ptr(e);
21711         CHECK_ACCESS(e_ptr);
21712         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
21713         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
21714         LDKCResult_ChannelMonitorUpdateDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelMonitorUpdateDecodeErrorZ), "LDKCResult_ChannelMonitorUpdateDecodeErrorZ");
21715         *ret_conv = CResult_ChannelMonitorUpdateDecodeErrorZ_err(e_conv);
21716         return tag_ptr(ret_conv, true);
21717 }
21718
21719 jboolean  __attribute__((export_name("TS_CResult_ChannelMonitorUpdateDecodeErrorZ_is_ok"))) TS_CResult_ChannelMonitorUpdateDecodeErrorZ_is_ok(uint64_t o) {
21720         LDKCResult_ChannelMonitorUpdateDecodeErrorZ* o_conv = (LDKCResult_ChannelMonitorUpdateDecodeErrorZ*)untag_ptr(o);
21721         jboolean ret_conv = CResult_ChannelMonitorUpdateDecodeErrorZ_is_ok(o_conv);
21722         return ret_conv;
21723 }
21724
21725 void  __attribute__((export_name("TS_CResult_ChannelMonitorUpdateDecodeErrorZ_free"))) TS_CResult_ChannelMonitorUpdateDecodeErrorZ_free(uint64_t _res) {
21726         if (!ptr_is_owned(_res)) return;
21727         void* _res_ptr = untag_ptr(_res);
21728         CHECK_ACCESS(_res_ptr);
21729         LDKCResult_ChannelMonitorUpdateDecodeErrorZ _res_conv = *(LDKCResult_ChannelMonitorUpdateDecodeErrorZ*)(_res_ptr);
21730         FREE(untag_ptr(_res));
21731         CResult_ChannelMonitorUpdateDecodeErrorZ_free(_res_conv);
21732 }
21733
21734 static inline uint64_t CResult_ChannelMonitorUpdateDecodeErrorZ_clone_ptr(LDKCResult_ChannelMonitorUpdateDecodeErrorZ *NONNULL_PTR arg) {
21735         LDKCResult_ChannelMonitorUpdateDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelMonitorUpdateDecodeErrorZ), "LDKCResult_ChannelMonitorUpdateDecodeErrorZ");
21736         *ret_conv = CResult_ChannelMonitorUpdateDecodeErrorZ_clone(arg);
21737         return tag_ptr(ret_conv, true);
21738 }
21739 int64_t  __attribute__((export_name("TS_CResult_ChannelMonitorUpdateDecodeErrorZ_clone_ptr"))) TS_CResult_ChannelMonitorUpdateDecodeErrorZ_clone_ptr(uint64_t arg) {
21740         LDKCResult_ChannelMonitorUpdateDecodeErrorZ* arg_conv = (LDKCResult_ChannelMonitorUpdateDecodeErrorZ*)untag_ptr(arg);
21741         int64_t ret_conv = CResult_ChannelMonitorUpdateDecodeErrorZ_clone_ptr(arg_conv);
21742         return ret_conv;
21743 }
21744
21745 uint64_t  __attribute__((export_name("TS_CResult_ChannelMonitorUpdateDecodeErrorZ_clone"))) TS_CResult_ChannelMonitorUpdateDecodeErrorZ_clone(uint64_t orig) {
21746         LDKCResult_ChannelMonitorUpdateDecodeErrorZ* orig_conv = (LDKCResult_ChannelMonitorUpdateDecodeErrorZ*)untag_ptr(orig);
21747         LDKCResult_ChannelMonitorUpdateDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelMonitorUpdateDecodeErrorZ), "LDKCResult_ChannelMonitorUpdateDecodeErrorZ");
21748         *ret_conv = CResult_ChannelMonitorUpdateDecodeErrorZ_clone(orig_conv);
21749         return tag_ptr(ret_conv, true);
21750 }
21751
21752 uint64_t  __attribute__((export_name("TS_COption_MonitorEventZ_some"))) TS_COption_MonitorEventZ_some(uint64_t o) {
21753         void* o_ptr = untag_ptr(o);
21754         CHECK_ACCESS(o_ptr);
21755         LDKMonitorEvent o_conv = *(LDKMonitorEvent*)(o_ptr);
21756         o_conv = MonitorEvent_clone((LDKMonitorEvent*)untag_ptr(o));
21757         LDKCOption_MonitorEventZ *ret_copy = MALLOC(sizeof(LDKCOption_MonitorEventZ), "LDKCOption_MonitorEventZ");
21758         *ret_copy = COption_MonitorEventZ_some(o_conv);
21759         uint64_t ret_ref = tag_ptr(ret_copy, true);
21760         return ret_ref;
21761 }
21762
21763 uint64_t  __attribute__((export_name("TS_COption_MonitorEventZ_none"))) TS_COption_MonitorEventZ_none() {
21764         LDKCOption_MonitorEventZ *ret_copy = MALLOC(sizeof(LDKCOption_MonitorEventZ), "LDKCOption_MonitorEventZ");
21765         *ret_copy = COption_MonitorEventZ_none();
21766         uint64_t ret_ref = tag_ptr(ret_copy, true);
21767         return ret_ref;
21768 }
21769
21770 void  __attribute__((export_name("TS_COption_MonitorEventZ_free"))) TS_COption_MonitorEventZ_free(uint64_t _res) {
21771         if (!ptr_is_owned(_res)) return;
21772         void* _res_ptr = untag_ptr(_res);
21773         CHECK_ACCESS(_res_ptr);
21774         LDKCOption_MonitorEventZ _res_conv = *(LDKCOption_MonitorEventZ*)(_res_ptr);
21775         FREE(untag_ptr(_res));
21776         COption_MonitorEventZ_free(_res_conv);
21777 }
21778
21779 static inline uint64_t COption_MonitorEventZ_clone_ptr(LDKCOption_MonitorEventZ *NONNULL_PTR arg) {
21780         LDKCOption_MonitorEventZ *ret_copy = MALLOC(sizeof(LDKCOption_MonitorEventZ), "LDKCOption_MonitorEventZ");
21781         *ret_copy = COption_MonitorEventZ_clone(arg);
21782         uint64_t ret_ref = tag_ptr(ret_copy, true);
21783         return ret_ref;
21784 }
21785 int64_t  __attribute__((export_name("TS_COption_MonitorEventZ_clone_ptr"))) TS_COption_MonitorEventZ_clone_ptr(uint64_t arg) {
21786         LDKCOption_MonitorEventZ* arg_conv = (LDKCOption_MonitorEventZ*)untag_ptr(arg);
21787         int64_t ret_conv = COption_MonitorEventZ_clone_ptr(arg_conv);
21788         return ret_conv;
21789 }
21790
21791 uint64_t  __attribute__((export_name("TS_COption_MonitorEventZ_clone"))) TS_COption_MonitorEventZ_clone(uint64_t orig) {
21792         LDKCOption_MonitorEventZ* orig_conv = (LDKCOption_MonitorEventZ*)untag_ptr(orig);
21793         LDKCOption_MonitorEventZ *ret_copy = MALLOC(sizeof(LDKCOption_MonitorEventZ), "LDKCOption_MonitorEventZ");
21794         *ret_copy = COption_MonitorEventZ_clone(orig_conv);
21795         uint64_t ret_ref = tag_ptr(ret_copy, true);
21796         return ret_ref;
21797 }
21798
21799 uint64_t  __attribute__((export_name("TS_CResult_COption_MonitorEventZDecodeErrorZ_ok"))) TS_CResult_COption_MonitorEventZDecodeErrorZ_ok(uint64_t o) {
21800         void* o_ptr = untag_ptr(o);
21801         CHECK_ACCESS(o_ptr);
21802         LDKCOption_MonitorEventZ o_conv = *(LDKCOption_MonitorEventZ*)(o_ptr);
21803         o_conv = COption_MonitorEventZ_clone((LDKCOption_MonitorEventZ*)untag_ptr(o));
21804         LDKCResult_COption_MonitorEventZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_COption_MonitorEventZDecodeErrorZ), "LDKCResult_COption_MonitorEventZDecodeErrorZ");
21805         *ret_conv = CResult_COption_MonitorEventZDecodeErrorZ_ok(o_conv);
21806         return tag_ptr(ret_conv, true);
21807 }
21808
21809 uint64_t  __attribute__((export_name("TS_CResult_COption_MonitorEventZDecodeErrorZ_err"))) TS_CResult_COption_MonitorEventZDecodeErrorZ_err(uint64_t e) {
21810         void* e_ptr = untag_ptr(e);
21811         CHECK_ACCESS(e_ptr);
21812         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
21813         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
21814         LDKCResult_COption_MonitorEventZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_COption_MonitorEventZDecodeErrorZ), "LDKCResult_COption_MonitorEventZDecodeErrorZ");
21815         *ret_conv = CResult_COption_MonitorEventZDecodeErrorZ_err(e_conv);
21816         return tag_ptr(ret_conv, true);
21817 }
21818
21819 jboolean  __attribute__((export_name("TS_CResult_COption_MonitorEventZDecodeErrorZ_is_ok"))) TS_CResult_COption_MonitorEventZDecodeErrorZ_is_ok(uint64_t o) {
21820         LDKCResult_COption_MonitorEventZDecodeErrorZ* o_conv = (LDKCResult_COption_MonitorEventZDecodeErrorZ*)untag_ptr(o);
21821         jboolean ret_conv = CResult_COption_MonitorEventZDecodeErrorZ_is_ok(o_conv);
21822         return ret_conv;
21823 }
21824
21825 void  __attribute__((export_name("TS_CResult_COption_MonitorEventZDecodeErrorZ_free"))) TS_CResult_COption_MonitorEventZDecodeErrorZ_free(uint64_t _res) {
21826         if (!ptr_is_owned(_res)) return;
21827         void* _res_ptr = untag_ptr(_res);
21828         CHECK_ACCESS(_res_ptr);
21829         LDKCResult_COption_MonitorEventZDecodeErrorZ _res_conv = *(LDKCResult_COption_MonitorEventZDecodeErrorZ*)(_res_ptr);
21830         FREE(untag_ptr(_res));
21831         CResult_COption_MonitorEventZDecodeErrorZ_free(_res_conv);
21832 }
21833
21834 static inline uint64_t CResult_COption_MonitorEventZDecodeErrorZ_clone_ptr(LDKCResult_COption_MonitorEventZDecodeErrorZ *NONNULL_PTR arg) {
21835         LDKCResult_COption_MonitorEventZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_COption_MonitorEventZDecodeErrorZ), "LDKCResult_COption_MonitorEventZDecodeErrorZ");
21836         *ret_conv = CResult_COption_MonitorEventZDecodeErrorZ_clone(arg);
21837         return tag_ptr(ret_conv, true);
21838 }
21839 int64_t  __attribute__((export_name("TS_CResult_COption_MonitorEventZDecodeErrorZ_clone_ptr"))) TS_CResult_COption_MonitorEventZDecodeErrorZ_clone_ptr(uint64_t arg) {
21840         LDKCResult_COption_MonitorEventZDecodeErrorZ* arg_conv = (LDKCResult_COption_MonitorEventZDecodeErrorZ*)untag_ptr(arg);
21841         int64_t ret_conv = CResult_COption_MonitorEventZDecodeErrorZ_clone_ptr(arg_conv);
21842         return ret_conv;
21843 }
21844
21845 uint64_t  __attribute__((export_name("TS_CResult_COption_MonitorEventZDecodeErrorZ_clone"))) TS_CResult_COption_MonitorEventZDecodeErrorZ_clone(uint64_t orig) {
21846         LDKCResult_COption_MonitorEventZDecodeErrorZ* orig_conv = (LDKCResult_COption_MonitorEventZDecodeErrorZ*)untag_ptr(orig);
21847         LDKCResult_COption_MonitorEventZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_COption_MonitorEventZDecodeErrorZ), "LDKCResult_COption_MonitorEventZDecodeErrorZ");
21848         *ret_conv = CResult_COption_MonitorEventZDecodeErrorZ_clone(orig_conv);
21849         return tag_ptr(ret_conv, true);
21850 }
21851
21852 uint64_t  __attribute__((export_name("TS_CResult_HTLCUpdateDecodeErrorZ_ok"))) TS_CResult_HTLCUpdateDecodeErrorZ_ok(uint64_t o) {
21853         LDKHTLCUpdate o_conv;
21854         o_conv.inner = untag_ptr(o);
21855         o_conv.is_owned = ptr_is_owned(o);
21856         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
21857         o_conv = HTLCUpdate_clone(&o_conv);
21858         LDKCResult_HTLCUpdateDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_HTLCUpdateDecodeErrorZ), "LDKCResult_HTLCUpdateDecodeErrorZ");
21859         *ret_conv = CResult_HTLCUpdateDecodeErrorZ_ok(o_conv);
21860         return tag_ptr(ret_conv, true);
21861 }
21862
21863 uint64_t  __attribute__((export_name("TS_CResult_HTLCUpdateDecodeErrorZ_err"))) TS_CResult_HTLCUpdateDecodeErrorZ_err(uint64_t e) {
21864         void* e_ptr = untag_ptr(e);
21865         CHECK_ACCESS(e_ptr);
21866         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
21867         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
21868         LDKCResult_HTLCUpdateDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_HTLCUpdateDecodeErrorZ), "LDKCResult_HTLCUpdateDecodeErrorZ");
21869         *ret_conv = CResult_HTLCUpdateDecodeErrorZ_err(e_conv);
21870         return tag_ptr(ret_conv, true);
21871 }
21872
21873 jboolean  __attribute__((export_name("TS_CResult_HTLCUpdateDecodeErrorZ_is_ok"))) TS_CResult_HTLCUpdateDecodeErrorZ_is_ok(uint64_t o) {
21874         LDKCResult_HTLCUpdateDecodeErrorZ* o_conv = (LDKCResult_HTLCUpdateDecodeErrorZ*)untag_ptr(o);
21875         jboolean ret_conv = CResult_HTLCUpdateDecodeErrorZ_is_ok(o_conv);
21876         return ret_conv;
21877 }
21878
21879 void  __attribute__((export_name("TS_CResult_HTLCUpdateDecodeErrorZ_free"))) TS_CResult_HTLCUpdateDecodeErrorZ_free(uint64_t _res) {
21880         if (!ptr_is_owned(_res)) return;
21881         void* _res_ptr = untag_ptr(_res);
21882         CHECK_ACCESS(_res_ptr);
21883         LDKCResult_HTLCUpdateDecodeErrorZ _res_conv = *(LDKCResult_HTLCUpdateDecodeErrorZ*)(_res_ptr);
21884         FREE(untag_ptr(_res));
21885         CResult_HTLCUpdateDecodeErrorZ_free(_res_conv);
21886 }
21887
21888 static inline uint64_t CResult_HTLCUpdateDecodeErrorZ_clone_ptr(LDKCResult_HTLCUpdateDecodeErrorZ *NONNULL_PTR arg) {
21889         LDKCResult_HTLCUpdateDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_HTLCUpdateDecodeErrorZ), "LDKCResult_HTLCUpdateDecodeErrorZ");
21890         *ret_conv = CResult_HTLCUpdateDecodeErrorZ_clone(arg);
21891         return tag_ptr(ret_conv, true);
21892 }
21893 int64_t  __attribute__((export_name("TS_CResult_HTLCUpdateDecodeErrorZ_clone_ptr"))) TS_CResult_HTLCUpdateDecodeErrorZ_clone_ptr(uint64_t arg) {
21894         LDKCResult_HTLCUpdateDecodeErrorZ* arg_conv = (LDKCResult_HTLCUpdateDecodeErrorZ*)untag_ptr(arg);
21895         int64_t ret_conv = CResult_HTLCUpdateDecodeErrorZ_clone_ptr(arg_conv);
21896         return ret_conv;
21897 }
21898
21899 uint64_t  __attribute__((export_name("TS_CResult_HTLCUpdateDecodeErrorZ_clone"))) TS_CResult_HTLCUpdateDecodeErrorZ_clone(uint64_t orig) {
21900         LDKCResult_HTLCUpdateDecodeErrorZ* orig_conv = (LDKCResult_HTLCUpdateDecodeErrorZ*)untag_ptr(orig);
21901         LDKCResult_HTLCUpdateDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_HTLCUpdateDecodeErrorZ), "LDKCResult_HTLCUpdateDecodeErrorZ");
21902         *ret_conv = CResult_HTLCUpdateDecodeErrorZ_clone(orig_conv);
21903         return tag_ptr(ret_conv, true);
21904 }
21905
21906 static inline uint64_t C2Tuple_OutPointCVec_u8ZZ_clone_ptr(LDKC2Tuple_OutPointCVec_u8ZZ *NONNULL_PTR arg) {
21907         LDKC2Tuple_OutPointCVec_u8ZZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_OutPointCVec_u8ZZ), "LDKC2Tuple_OutPointCVec_u8ZZ");
21908         *ret_conv = C2Tuple_OutPointCVec_u8ZZ_clone(arg);
21909         return tag_ptr(ret_conv, true);
21910 }
21911 int64_t  __attribute__((export_name("TS_C2Tuple_OutPointCVec_u8ZZ_clone_ptr"))) TS_C2Tuple_OutPointCVec_u8ZZ_clone_ptr(uint64_t arg) {
21912         LDKC2Tuple_OutPointCVec_u8ZZ* arg_conv = (LDKC2Tuple_OutPointCVec_u8ZZ*)untag_ptr(arg);
21913         int64_t ret_conv = C2Tuple_OutPointCVec_u8ZZ_clone_ptr(arg_conv);
21914         return ret_conv;
21915 }
21916
21917 uint64_t  __attribute__((export_name("TS_C2Tuple_OutPointCVec_u8ZZ_clone"))) TS_C2Tuple_OutPointCVec_u8ZZ_clone(uint64_t orig) {
21918         LDKC2Tuple_OutPointCVec_u8ZZ* orig_conv = (LDKC2Tuple_OutPointCVec_u8ZZ*)untag_ptr(orig);
21919         LDKC2Tuple_OutPointCVec_u8ZZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_OutPointCVec_u8ZZ), "LDKC2Tuple_OutPointCVec_u8ZZ");
21920         *ret_conv = C2Tuple_OutPointCVec_u8ZZ_clone(orig_conv);
21921         return tag_ptr(ret_conv, true);
21922 }
21923
21924 uint64_t  __attribute__((export_name("TS_C2Tuple_OutPointCVec_u8ZZ_new"))) TS_C2Tuple_OutPointCVec_u8ZZ_new(uint64_t a, int8_tArray b) {
21925         LDKOutPoint a_conv;
21926         a_conv.inner = untag_ptr(a);
21927         a_conv.is_owned = ptr_is_owned(a);
21928         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
21929         a_conv = OutPoint_clone(&a_conv);
21930         LDKCVec_u8Z b_ref;
21931         b_ref.datalen = b->arr_len;
21932         b_ref.data = MALLOC(b_ref.datalen, "LDKCVec_u8Z Bytes");
21933         memcpy(b_ref.data, b->elems, b_ref.datalen); FREE(b);
21934         LDKC2Tuple_OutPointCVec_u8ZZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_OutPointCVec_u8ZZ), "LDKC2Tuple_OutPointCVec_u8ZZ");
21935         *ret_conv = C2Tuple_OutPointCVec_u8ZZ_new(a_conv, b_ref);
21936         return tag_ptr(ret_conv, true);
21937 }
21938
21939 void  __attribute__((export_name("TS_C2Tuple_OutPointCVec_u8ZZ_free"))) TS_C2Tuple_OutPointCVec_u8ZZ_free(uint64_t _res) {
21940         if (!ptr_is_owned(_res)) return;
21941         void* _res_ptr = untag_ptr(_res);
21942         CHECK_ACCESS(_res_ptr);
21943         LDKC2Tuple_OutPointCVec_u8ZZ _res_conv = *(LDKC2Tuple_OutPointCVec_u8ZZ*)(_res_ptr);
21944         FREE(untag_ptr(_res));
21945         C2Tuple_OutPointCVec_u8ZZ_free(_res_conv);
21946 }
21947
21948 static inline uint64_t C2Tuple_u32CVec_u8ZZ_clone_ptr(LDKC2Tuple_u32CVec_u8ZZ *NONNULL_PTR arg) {
21949         LDKC2Tuple_u32CVec_u8ZZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_u32CVec_u8ZZ), "LDKC2Tuple_u32CVec_u8ZZ");
21950         *ret_conv = C2Tuple_u32CVec_u8ZZ_clone(arg);
21951         return tag_ptr(ret_conv, true);
21952 }
21953 int64_t  __attribute__((export_name("TS_C2Tuple_u32CVec_u8ZZ_clone_ptr"))) TS_C2Tuple_u32CVec_u8ZZ_clone_ptr(uint64_t arg) {
21954         LDKC2Tuple_u32CVec_u8ZZ* arg_conv = (LDKC2Tuple_u32CVec_u8ZZ*)untag_ptr(arg);
21955         int64_t ret_conv = C2Tuple_u32CVec_u8ZZ_clone_ptr(arg_conv);
21956         return ret_conv;
21957 }
21958
21959 uint64_t  __attribute__((export_name("TS_C2Tuple_u32CVec_u8ZZ_clone"))) TS_C2Tuple_u32CVec_u8ZZ_clone(uint64_t orig) {
21960         LDKC2Tuple_u32CVec_u8ZZ* orig_conv = (LDKC2Tuple_u32CVec_u8ZZ*)untag_ptr(orig);
21961         LDKC2Tuple_u32CVec_u8ZZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_u32CVec_u8ZZ), "LDKC2Tuple_u32CVec_u8ZZ");
21962         *ret_conv = C2Tuple_u32CVec_u8ZZ_clone(orig_conv);
21963         return tag_ptr(ret_conv, true);
21964 }
21965
21966 uint64_t  __attribute__((export_name("TS_C2Tuple_u32CVec_u8ZZ_new"))) TS_C2Tuple_u32CVec_u8ZZ_new(int32_t a, int8_tArray b) {
21967         LDKCVec_u8Z b_ref;
21968         b_ref.datalen = b->arr_len;
21969         b_ref.data = MALLOC(b_ref.datalen, "LDKCVec_u8Z Bytes");
21970         memcpy(b_ref.data, b->elems, b_ref.datalen); FREE(b);
21971         LDKC2Tuple_u32CVec_u8ZZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_u32CVec_u8ZZ), "LDKC2Tuple_u32CVec_u8ZZ");
21972         *ret_conv = C2Tuple_u32CVec_u8ZZ_new(a, b_ref);
21973         return tag_ptr(ret_conv, true);
21974 }
21975
21976 void  __attribute__((export_name("TS_C2Tuple_u32CVec_u8ZZ_free"))) TS_C2Tuple_u32CVec_u8ZZ_free(uint64_t _res) {
21977         if (!ptr_is_owned(_res)) return;
21978         void* _res_ptr = untag_ptr(_res);
21979         CHECK_ACCESS(_res_ptr);
21980         LDKC2Tuple_u32CVec_u8ZZ _res_conv = *(LDKC2Tuple_u32CVec_u8ZZ*)(_res_ptr);
21981         FREE(untag_ptr(_res));
21982         C2Tuple_u32CVec_u8ZZ_free(_res_conv);
21983 }
21984
21985 void  __attribute__((export_name("TS_CVec_C2Tuple_u32CVec_u8ZZZ_free"))) TS_CVec_C2Tuple_u32CVec_u8ZZZ_free(uint64_tArray _res) {
21986         LDKCVec_C2Tuple_u32CVec_u8ZZZ _res_constr;
21987         _res_constr.datalen = _res->arr_len;
21988         if (_res_constr.datalen > 0)
21989                 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKC2Tuple_u32CVec_u8ZZ), "LDKCVec_C2Tuple_u32CVec_u8ZZZ Elements");
21990         else
21991                 _res_constr.data = NULL;
21992         uint64_t* _res_vals = _res->elems;
21993         for (size_t x = 0; x < _res_constr.datalen; x++) {
21994                 uint64_t _res_conv_23 = _res_vals[x];
21995                 void* _res_conv_23_ptr = untag_ptr(_res_conv_23);
21996                 CHECK_ACCESS(_res_conv_23_ptr);
21997                 LDKC2Tuple_u32CVec_u8ZZ _res_conv_23_conv = *(LDKC2Tuple_u32CVec_u8ZZ*)(_res_conv_23_ptr);
21998                 FREE(untag_ptr(_res_conv_23));
21999                 _res_constr.data[x] = _res_conv_23_conv;
22000         }
22001         FREE(_res);
22002         CVec_C2Tuple_u32CVec_u8ZZZ_free(_res_constr);
22003 }
22004
22005 static inline uint64_t C2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32CVec_u8ZZZZ_clone_ptr(LDKC2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32CVec_u8ZZZZ *NONNULL_PTR arg) {
22006         LDKC2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32CVec_u8ZZZZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32CVec_u8ZZZZ), "LDKC2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32CVec_u8ZZZZ");
22007         *ret_conv = C2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32CVec_u8ZZZZ_clone(arg);
22008         return tag_ptr(ret_conv, true);
22009 }
22010 int64_t  __attribute__((export_name("TS_C2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32CVec_u8ZZZZ_clone_ptr"))) TS_C2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32CVec_u8ZZZZ_clone_ptr(uint64_t arg) {
22011         LDKC2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32CVec_u8ZZZZ* arg_conv = (LDKC2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32CVec_u8ZZZZ*)untag_ptr(arg);
22012         int64_t ret_conv = C2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32CVec_u8ZZZZ_clone_ptr(arg_conv);
22013         return ret_conv;
22014 }
22015
22016 uint64_t  __attribute__((export_name("TS_C2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32CVec_u8ZZZZ_clone"))) TS_C2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32CVec_u8ZZZZ_clone(uint64_t orig) {
22017         LDKC2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32CVec_u8ZZZZ* orig_conv = (LDKC2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32CVec_u8ZZZZ*)untag_ptr(orig);
22018         LDKC2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32CVec_u8ZZZZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32CVec_u8ZZZZ), "LDKC2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32CVec_u8ZZZZ");
22019         *ret_conv = C2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32CVec_u8ZZZZ_clone(orig_conv);
22020         return tag_ptr(ret_conv, true);
22021 }
22022
22023 uint64_t  __attribute__((export_name("TS_C2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32CVec_u8ZZZZ_new"))) TS_C2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32CVec_u8ZZZZ_new(int8_tArray a, uint64_tArray b) {
22024         LDKThirtyTwoBytes a_ref;
22025         CHECK(a->arr_len == 32);
22026         memcpy(a_ref.data, a->elems, 32); FREE(a);
22027         LDKCVec_C2Tuple_u32CVec_u8ZZZ b_constr;
22028         b_constr.datalen = b->arr_len;
22029         if (b_constr.datalen > 0)
22030                 b_constr.data = MALLOC(b_constr.datalen * sizeof(LDKC2Tuple_u32CVec_u8ZZ), "LDKCVec_C2Tuple_u32CVec_u8ZZZ Elements");
22031         else
22032                 b_constr.data = NULL;
22033         uint64_t* b_vals = b->elems;
22034         for (size_t x = 0; x < b_constr.datalen; x++) {
22035                 uint64_t b_conv_23 = b_vals[x];
22036                 void* b_conv_23_ptr = untag_ptr(b_conv_23);
22037                 CHECK_ACCESS(b_conv_23_ptr);
22038                 LDKC2Tuple_u32CVec_u8ZZ b_conv_23_conv = *(LDKC2Tuple_u32CVec_u8ZZ*)(b_conv_23_ptr);
22039                 b_conv_23_conv = C2Tuple_u32CVec_u8ZZ_clone((LDKC2Tuple_u32CVec_u8ZZ*)untag_ptr(b_conv_23));
22040                 b_constr.data[x] = b_conv_23_conv;
22041         }
22042         FREE(b);
22043         LDKC2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32CVec_u8ZZZZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32CVec_u8ZZZZ), "LDKC2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32CVec_u8ZZZZ");
22044         *ret_conv = C2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32CVec_u8ZZZZ_new(a_ref, b_constr);
22045         return tag_ptr(ret_conv, true);
22046 }
22047
22048 void  __attribute__((export_name("TS_C2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32CVec_u8ZZZZ_free"))) TS_C2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32CVec_u8ZZZZ_free(uint64_t _res) {
22049         if (!ptr_is_owned(_res)) return;
22050         void* _res_ptr = untag_ptr(_res);
22051         CHECK_ACCESS(_res_ptr);
22052         LDKC2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32CVec_u8ZZZZ _res_conv = *(LDKC2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32CVec_u8ZZZZ*)(_res_ptr);
22053         FREE(untag_ptr(_res));
22054         C2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32CVec_u8ZZZZ_free(_res_conv);
22055 }
22056
22057 void  __attribute__((export_name("TS_CVec_C2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32CVec_u8ZZZZZ_free"))) TS_CVec_C2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32CVec_u8ZZZZZ_free(uint64_tArray _res) {
22058         LDKCVec_C2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32CVec_u8ZZZZZ _res_constr;
22059         _res_constr.datalen = _res->arr_len;
22060         if (_res_constr.datalen > 0)
22061                 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKC2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32CVec_u8ZZZZ), "LDKCVec_C2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32CVec_u8ZZZZZ Elements");
22062         else
22063                 _res_constr.data = NULL;
22064         uint64_t* _res_vals = _res->elems;
22065         for (size_t a = 0; a < _res_constr.datalen; a++) {
22066                 uint64_t _res_conv_52 = _res_vals[a];
22067                 void* _res_conv_52_ptr = untag_ptr(_res_conv_52);
22068                 CHECK_ACCESS(_res_conv_52_ptr);
22069                 LDKC2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32CVec_u8ZZZZ _res_conv_52_conv = *(LDKC2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32CVec_u8ZZZZ*)(_res_conv_52_ptr);
22070                 FREE(untag_ptr(_res_conv_52));
22071                 _res_constr.data[a] = _res_conv_52_conv;
22072         }
22073         FREE(_res);
22074         CVec_C2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32CVec_u8ZZZZZ_free(_res_constr);
22075 }
22076
22077 void  __attribute__((export_name("TS_CVec_CommitmentTransactionZ_free"))) TS_CVec_CommitmentTransactionZ_free(uint64_tArray _res) {
22078         LDKCVec_CommitmentTransactionZ _res_constr;
22079         _res_constr.datalen = _res->arr_len;
22080         if (_res_constr.datalen > 0)
22081                 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKCommitmentTransaction), "LDKCVec_CommitmentTransactionZ Elements");
22082         else
22083                 _res_constr.data = NULL;
22084         uint64_t* _res_vals = _res->elems;
22085         for (size_t x = 0; x < _res_constr.datalen; x++) {
22086                 uint64_t _res_conv_23 = _res_vals[x];
22087                 LDKCommitmentTransaction _res_conv_23_conv;
22088                 _res_conv_23_conv.inner = untag_ptr(_res_conv_23);
22089                 _res_conv_23_conv.is_owned = ptr_is_owned(_res_conv_23);
22090                 CHECK_INNER_FIELD_ACCESS_OR_NULL(_res_conv_23_conv);
22091                 _res_constr.data[x] = _res_conv_23_conv;
22092         }
22093         FREE(_res);
22094         CVec_CommitmentTransactionZ_free(_res_constr);
22095 }
22096
22097 void  __attribute__((export_name("TS_CVec_TransactionZ_free"))) TS_CVec_TransactionZ_free(ptrArray _res) {
22098         LDKCVec_TransactionZ _res_constr;
22099         _res_constr.datalen = _res->arr_len;
22100         if (_res_constr.datalen > 0)
22101                 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKTransaction), "LDKCVec_TransactionZ Elements");
22102         else
22103                 _res_constr.data = NULL;
22104         int8_tArray* _res_vals = (void*) _res->elems;
22105         for (size_t m = 0; m < _res_constr.datalen; m++) {
22106                 int8_tArray _res_conv_12 = _res_vals[m];
22107                 LDKTransaction _res_conv_12_ref;
22108                 _res_conv_12_ref.datalen = _res_conv_12->arr_len;
22109                 _res_conv_12_ref.data = MALLOC(_res_conv_12_ref.datalen, "LDKTransaction Bytes");
22110                 memcpy(_res_conv_12_ref.data, _res_conv_12->elems, _res_conv_12_ref.datalen); FREE(_res_conv_12);
22111                 _res_conv_12_ref.data_is_owned = true;
22112                 _res_constr.data[m] = _res_conv_12_ref;
22113         }
22114         FREE(_res);
22115         CVec_TransactionZ_free(_res_constr);
22116 }
22117
22118 static inline uint64_t C2Tuple_u32TxOutZ_clone_ptr(LDKC2Tuple_u32TxOutZ *NONNULL_PTR arg) {
22119         LDKC2Tuple_u32TxOutZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_u32TxOutZ), "LDKC2Tuple_u32TxOutZ");
22120         *ret_conv = C2Tuple_u32TxOutZ_clone(arg);
22121         return tag_ptr(ret_conv, true);
22122 }
22123 int64_t  __attribute__((export_name("TS_C2Tuple_u32TxOutZ_clone_ptr"))) TS_C2Tuple_u32TxOutZ_clone_ptr(uint64_t arg) {
22124         LDKC2Tuple_u32TxOutZ* arg_conv = (LDKC2Tuple_u32TxOutZ*)untag_ptr(arg);
22125         int64_t ret_conv = C2Tuple_u32TxOutZ_clone_ptr(arg_conv);
22126         return ret_conv;
22127 }
22128
22129 uint64_t  __attribute__((export_name("TS_C2Tuple_u32TxOutZ_clone"))) TS_C2Tuple_u32TxOutZ_clone(uint64_t orig) {
22130         LDKC2Tuple_u32TxOutZ* orig_conv = (LDKC2Tuple_u32TxOutZ*)untag_ptr(orig);
22131         LDKC2Tuple_u32TxOutZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_u32TxOutZ), "LDKC2Tuple_u32TxOutZ");
22132         *ret_conv = C2Tuple_u32TxOutZ_clone(orig_conv);
22133         return tag_ptr(ret_conv, true);
22134 }
22135
22136 uint64_t  __attribute__((export_name("TS_C2Tuple_u32TxOutZ_new"))) TS_C2Tuple_u32TxOutZ_new(int32_t a, uint64_t b) {
22137         void* b_ptr = untag_ptr(b);
22138         CHECK_ACCESS(b_ptr);
22139         LDKTxOut b_conv = *(LDKTxOut*)(b_ptr);
22140         b_conv = TxOut_clone((LDKTxOut*)untag_ptr(b));
22141         LDKC2Tuple_u32TxOutZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_u32TxOutZ), "LDKC2Tuple_u32TxOutZ");
22142         *ret_conv = C2Tuple_u32TxOutZ_new(a, b_conv);
22143         return tag_ptr(ret_conv, true);
22144 }
22145
22146 void  __attribute__((export_name("TS_C2Tuple_u32TxOutZ_free"))) TS_C2Tuple_u32TxOutZ_free(uint64_t _res) {
22147         if (!ptr_is_owned(_res)) return;
22148         void* _res_ptr = untag_ptr(_res);
22149         CHECK_ACCESS(_res_ptr);
22150         LDKC2Tuple_u32TxOutZ _res_conv = *(LDKC2Tuple_u32TxOutZ*)(_res_ptr);
22151         FREE(untag_ptr(_res));
22152         C2Tuple_u32TxOutZ_free(_res_conv);
22153 }
22154
22155 void  __attribute__((export_name("TS_CVec_C2Tuple_u32TxOutZZ_free"))) TS_CVec_C2Tuple_u32TxOutZZ_free(uint64_tArray _res) {
22156         LDKCVec_C2Tuple_u32TxOutZZ _res_constr;
22157         _res_constr.datalen = _res->arr_len;
22158         if (_res_constr.datalen > 0)
22159                 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKC2Tuple_u32TxOutZ), "LDKCVec_C2Tuple_u32TxOutZZ Elements");
22160         else
22161                 _res_constr.data = NULL;
22162         uint64_t* _res_vals = _res->elems;
22163         for (size_t u = 0; u < _res_constr.datalen; u++) {
22164                 uint64_t _res_conv_20 = _res_vals[u];
22165                 void* _res_conv_20_ptr = untag_ptr(_res_conv_20);
22166                 CHECK_ACCESS(_res_conv_20_ptr);
22167                 LDKC2Tuple_u32TxOutZ _res_conv_20_conv = *(LDKC2Tuple_u32TxOutZ*)(_res_conv_20_ptr);
22168                 FREE(untag_ptr(_res_conv_20));
22169                 _res_constr.data[u] = _res_conv_20_conv;
22170         }
22171         FREE(_res);
22172         CVec_C2Tuple_u32TxOutZZ_free(_res_constr);
22173 }
22174
22175 static inline uint64_t C2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32TxOutZZZ_clone_ptr(LDKC2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32TxOutZZZ *NONNULL_PTR arg) {
22176         LDKC2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32TxOutZZZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32TxOutZZZ), "LDKC2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32TxOutZZZ");
22177         *ret_conv = C2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32TxOutZZZ_clone(arg);
22178         return tag_ptr(ret_conv, true);
22179 }
22180 int64_t  __attribute__((export_name("TS_C2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32TxOutZZZ_clone_ptr"))) TS_C2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32TxOutZZZ_clone_ptr(uint64_t arg) {
22181         LDKC2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32TxOutZZZ* arg_conv = (LDKC2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32TxOutZZZ*)untag_ptr(arg);
22182         int64_t ret_conv = C2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32TxOutZZZ_clone_ptr(arg_conv);
22183         return ret_conv;
22184 }
22185
22186 uint64_t  __attribute__((export_name("TS_C2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32TxOutZZZ_clone"))) TS_C2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32TxOutZZZ_clone(uint64_t orig) {
22187         LDKC2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32TxOutZZZ* orig_conv = (LDKC2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32TxOutZZZ*)untag_ptr(orig);
22188         LDKC2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32TxOutZZZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32TxOutZZZ), "LDKC2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32TxOutZZZ");
22189         *ret_conv = C2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32TxOutZZZ_clone(orig_conv);
22190         return tag_ptr(ret_conv, true);
22191 }
22192
22193 uint64_t  __attribute__((export_name("TS_C2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32TxOutZZZ_new"))) TS_C2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32TxOutZZZ_new(int8_tArray a, uint64_tArray b) {
22194         LDKThirtyTwoBytes a_ref;
22195         CHECK(a->arr_len == 32);
22196         memcpy(a_ref.data, a->elems, 32); FREE(a);
22197         LDKCVec_C2Tuple_u32TxOutZZ b_constr;
22198         b_constr.datalen = b->arr_len;
22199         if (b_constr.datalen > 0)
22200                 b_constr.data = MALLOC(b_constr.datalen * sizeof(LDKC2Tuple_u32TxOutZ), "LDKCVec_C2Tuple_u32TxOutZZ Elements");
22201         else
22202                 b_constr.data = NULL;
22203         uint64_t* b_vals = b->elems;
22204         for (size_t u = 0; u < b_constr.datalen; u++) {
22205                 uint64_t b_conv_20 = b_vals[u];
22206                 void* b_conv_20_ptr = untag_ptr(b_conv_20);
22207                 CHECK_ACCESS(b_conv_20_ptr);
22208                 LDKC2Tuple_u32TxOutZ b_conv_20_conv = *(LDKC2Tuple_u32TxOutZ*)(b_conv_20_ptr);
22209                 b_conv_20_conv = C2Tuple_u32TxOutZ_clone((LDKC2Tuple_u32TxOutZ*)untag_ptr(b_conv_20));
22210                 b_constr.data[u] = b_conv_20_conv;
22211         }
22212         FREE(b);
22213         LDKC2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32TxOutZZZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32TxOutZZZ), "LDKC2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32TxOutZZZ");
22214         *ret_conv = C2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32TxOutZZZ_new(a_ref, b_constr);
22215         return tag_ptr(ret_conv, true);
22216 }
22217
22218 void  __attribute__((export_name("TS_C2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32TxOutZZZ_free"))) TS_C2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32TxOutZZZ_free(uint64_t _res) {
22219         if (!ptr_is_owned(_res)) return;
22220         void* _res_ptr = untag_ptr(_res);
22221         CHECK_ACCESS(_res_ptr);
22222         LDKC2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32TxOutZZZ _res_conv = *(LDKC2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32TxOutZZZ*)(_res_ptr);
22223         FREE(untag_ptr(_res));
22224         C2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32TxOutZZZ_free(_res_conv);
22225 }
22226
22227 void  __attribute__((export_name("TS_CVec_C2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32TxOutZZZZ_free"))) TS_CVec_C2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32TxOutZZZZ_free(uint64_tArray _res) {
22228         LDKCVec_C2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32TxOutZZZZ _res_constr;
22229         _res_constr.datalen = _res->arr_len;
22230         if (_res_constr.datalen > 0)
22231                 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKC2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32TxOutZZZ), "LDKCVec_C2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32TxOutZZZZ Elements");
22232         else
22233                 _res_constr.data = NULL;
22234         uint64_t* _res_vals = _res->elems;
22235         for (size_t x = 0; x < _res_constr.datalen; x++) {
22236                 uint64_t _res_conv_49 = _res_vals[x];
22237                 void* _res_conv_49_ptr = untag_ptr(_res_conv_49);
22238                 CHECK_ACCESS(_res_conv_49_ptr);
22239                 LDKC2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32TxOutZZZ _res_conv_49_conv = *(LDKC2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32TxOutZZZ*)(_res_conv_49_ptr);
22240                 FREE(untag_ptr(_res_conv_49));
22241                 _res_constr.data[x] = _res_conv_49_conv;
22242         }
22243         FREE(_res);
22244         CVec_C2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32TxOutZZZZ_free(_res_constr);
22245 }
22246
22247 void  __attribute__((export_name("TS_CVec_BalanceZ_free"))) TS_CVec_BalanceZ_free(uint64_tArray _res) {
22248         LDKCVec_BalanceZ _res_constr;
22249         _res_constr.datalen = _res->arr_len;
22250         if (_res_constr.datalen > 0)
22251                 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKBalance), "LDKCVec_BalanceZ Elements");
22252         else
22253                 _res_constr.data = NULL;
22254         uint64_t* _res_vals = _res->elems;
22255         for (size_t j = 0; j < _res_constr.datalen; j++) {
22256                 uint64_t _res_conv_9 = _res_vals[j];
22257                 void* _res_conv_9_ptr = untag_ptr(_res_conv_9);
22258                 CHECK_ACCESS(_res_conv_9_ptr);
22259                 LDKBalance _res_conv_9_conv = *(LDKBalance*)(_res_conv_9_ptr);
22260                 FREE(untag_ptr(_res_conv_9));
22261                 _res_constr.data[j] = _res_conv_9_conv;
22262         }
22263         FREE(_res);
22264         CVec_BalanceZ_free(_res_constr);
22265 }
22266
22267 static inline uint64_t C2Tuple_ThirtyTwoBytesChannelMonitorZ_clone_ptr(LDKC2Tuple_ThirtyTwoBytesChannelMonitorZ *NONNULL_PTR arg) {
22268         LDKC2Tuple_ThirtyTwoBytesChannelMonitorZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_ThirtyTwoBytesChannelMonitorZ), "LDKC2Tuple_ThirtyTwoBytesChannelMonitorZ");
22269         *ret_conv = C2Tuple_ThirtyTwoBytesChannelMonitorZ_clone(arg);
22270         return tag_ptr(ret_conv, true);
22271 }
22272 int64_t  __attribute__((export_name("TS_C2Tuple_ThirtyTwoBytesChannelMonitorZ_clone_ptr"))) TS_C2Tuple_ThirtyTwoBytesChannelMonitorZ_clone_ptr(uint64_t arg) {
22273         LDKC2Tuple_ThirtyTwoBytesChannelMonitorZ* arg_conv = (LDKC2Tuple_ThirtyTwoBytesChannelMonitorZ*)untag_ptr(arg);
22274         int64_t ret_conv = C2Tuple_ThirtyTwoBytesChannelMonitorZ_clone_ptr(arg_conv);
22275         return ret_conv;
22276 }
22277
22278 uint64_t  __attribute__((export_name("TS_C2Tuple_ThirtyTwoBytesChannelMonitorZ_clone"))) TS_C2Tuple_ThirtyTwoBytesChannelMonitorZ_clone(uint64_t orig) {
22279         LDKC2Tuple_ThirtyTwoBytesChannelMonitorZ* orig_conv = (LDKC2Tuple_ThirtyTwoBytesChannelMonitorZ*)untag_ptr(orig);
22280         LDKC2Tuple_ThirtyTwoBytesChannelMonitorZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_ThirtyTwoBytesChannelMonitorZ), "LDKC2Tuple_ThirtyTwoBytesChannelMonitorZ");
22281         *ret_conv = C2Tuple_ThirtyTwoBytesChannelMonitorZ_clone(orig_conv);
22282         return tag_ptr(ret_conv, true);
22283 }
22284
22285 uint64_t  __attribute__((export_name("TS_C2Tuple_ThirtyTwoBytesChannelMonitorZ_new"))) TS_C2Tuple_ThirtyTwoBytesChannelMonitorZ_new(int8_tArray a, uint64_t b) {
22286         LDKThirtyTwoBytes a_ref;
22287         CHECK(a->arr_len == 32);
22288         memcpy(a_ref.data, a->elems, 32); FREE(a);
22289         LDKChannelMonitor b_conv;
22290         b_conv.inner = untag_ptr(b);
22291         b_conv.is_owned = ptr_is_owned(b);
22292         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
22293         b_conv = ChannelMonitor_clone(&b_conv);
22294         LDKC2Tuple_ThirtyTwoBytesChannelMonitorZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_ThirtyTwoBytesChannelMonitorZ), "LDKC2Tuple_ThirtyTwoBytesChannelMonitorZ");
22295         *ret_conv = C2Tuple_ThirtyTwoBytesChannelMonitorZ_new(a_ref, b_conv);
22296         return tag_ptr(ret_conv, true);
22297 }
22298
22299 void  __attribute__((export_name("TS_C2Tuple_ThirtyTwoBytesChannelMonitorZ_free"))) TS_C2Tuple_ThirtyTwoBytesChannelMonitorZ_free(uint64_t _res) {
22300         if (!ptr_is_owned(_res)) return;
22301         void* _res_ptr = untag_ptr(_res);
22302         CHECK_ACCESS(_res_ptr);
22303         LDKC2Tuple_ThirtyTwoBytesChannelMonitorZ _res_conv = *(LDKC2Tuple_ThirtyTwoBytesChannelMonitorZ*)(_res_ptr);
22304         FREE(untag_ptr(_res));
22305         C2Tuple_ThirtyTwoBytesChannelMonitorZ_free(_res_conv);
22306 }
22307
22308 uint64_t  __attribute__((export_name("TS_CResult_C2Tuple_ThirtyTwoBytesChannelMonitorZDecodeErrorZ_ok"))) TS_CResult_C2Tuple_ThirtyTwoBytesChannelMonitorZDecodeErrorZ_ok(uint64_t o) {
22309         void* o_ptr = untag_ptr(o);
22310         CHECK_ACCESS(o_ptr);
22311         LDKC2Tuple_ThirtyTwoBytesChannelMonitorZ o_conv = *(LDKC2Tuple_ThirtyTwoBytesChannelMonitorZ*)(o_ptr);
22312         o_conv = C2Tuple_ThirtyTwoBytesChannelMonitorZ_clone((LDKC2Tuple_ThirtyTwoBytesChannelMonitorZ*)untag_ptr(o));
22313         LDKCResult_C2Tuple_ThirtyTwoBytesChannelMonitorZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_ThirtyTwoBytesChannelMonitorZDecodeErrorZ), "LDKCResult_C2Tuple_ThirtyTwoBytesChannelMonitorZDecodeErrorZ");
22314         *ret_conv = CResult_C2Tuple_ThirtyTwoBytesChannelMonitorZDecodeErrorZ_ok(o_conv);
22315         return tag_ptr(ret_conv, true);
22316 }
22317
22318 uint64_t  __attribute__((export_name("TS_CResult_C2Tuple_ThirtyTwoBytesChannelMonitorZDecodeErrorZ_err"))) TS_CResult_C2Tuple_ThirtyTwoBytesChannelMonitorZDecodeErrorZ_err(uint64_t e) {
22319         void* e_ptr = untag_ptr(e);
22320         CHECK_ACCESS(e_ptr);
22321         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
22322         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
22323         LDKCResult_C2Tuple_ThirtyTwoBytesChannelMonitorZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_ThirtyTwoBytesChannelMonitorZDecodeErrorZ), "LDKCResult_C2Tuple_ThirtyTwoBytesChannelMonitorZDecodeErrorZ");
22324         *ret_conv = CResult_C2Tuple_ThirtyTwoBytesChannelMonitorZDecodeErrorZ_err(e_conv);
22325         return tag_ptr(ret_conv, true);
22326 }
22327
22328 jboolean  __attribute__((export_name("TS_CResult_C2Tuple_ThirtyTwoBytesChannelMonitorZDecodeErrorZ_is_ok"))) TS_CResult_C2Tuple_ThirtyTwoBytesChannelMonitorZDecodeErrorZ_is_ok(uint64_t o) {
22329         LDKCResult_C2Tuple_ThirtyTwoBytesChannelMonitorZDecodeErrorZ* o_conv = (LDKCResult_C2Tuple_ThirtyTwoBytesChannelMonitorZDecodeErrorZ*)untag_ptr(o);
22330         jboolean ret_conv = CResult_C2Tuple_ThirtyTwoBytesChannelMonitorZDecodeErrorZ_is_ok(o_conv);
22331         return ret_conv;
22332 }
22333
22334 void  __attribute__((export_name("TS_CResult_C2Tuple_ThirtyTwoBytesChannelMonitorZDecodeErrorZ_free"))) TS_CResult_C2Tuple_ThirtyTwoBytesChannelMonitorZDecodeErrorZ_free(uint64_t _res) {
22335         if (!ptr_is_owned(_res)) return;
22336         void* _res_ptr = untag_ptr(_res);
22337         CHECK_ACCESS(_res_ptr);
22338         LDKCResult_C2Tuple_ThirtyTwoBytesChannelMonitorZDecodeErrorZ _res_conv = *(LDKCResult_C2Tuple_ThirtyTwoBytesChannelMonitorZDecodeErrorZ*)(_res_ptr);
22339         FREE(untag_ptr(_res));
22340         CResult_C2Tuple_ThirtyTwoBytesChannelMonitorZDecodeErrorZ_free(_res_conv);
22341 }
22342
22343 static inline uint64_t CResult_C2Tuple_ThirtyTwoBytesChannelMonitorZDecodeErrorZ_clone_ptr(LDKCResult_C2Tuple_ThirtyTwoBytesChannelMonitorZDecodeErrorZ *NONNULL_PTR arg) {
22344         LDKCResult_C2Tuple_ThirtyTwoBytesChannelMonitorZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_ThirtyTwoBytesChannelMonitorZDecodeErrorZ), "LDKCResult_C2Tuple_ThirtyTwoBytesChannelMonitorZDecodeErrorZ");
22345         *ret_conv = CResult_C2Tuple_ThirtyTwoBytesChannelMonitorZDecodeErrorZ_clone(arg);
22346         return tag_ptr(ret_conv, true);
22347 }
22348 int64_t  __attribute__((export_name("TS_CResult_C2Tuple_ThirtyTwoBytesChannelMonitorZDecodeErrorZ_clone_ptr"))) TS_CResult_C2Tuple_ThirtyTwoBytesChannelMonitorZDecodeErrorZ_clone_ptr(uint64_t arg) {
22349         LDKCResult_C2Tuple_ThirtyTwoBytesChannelMonitorZDecodeErrorZ* arg_conv = (LDKCResult_C2Tuple_ThirtyTwoBytesChannelMonitorZDecodeErrorZ*)untag_ptr(arg);
22350         int64_t ret_conv = CResult_C2Tuple_ThirtyTwoBytesChannelMonitorZDecodeErrorZ_clone_ptr(arg_conv);
22351         return ret_conv;
22352 }
22353
22354 uint64_t  __attribute__((export_name("TS_CResult_C2Tuple_ThirtyTwoBytesChannelMonitorZDecodeErrorZ_clone"))) TS_CResult_C2Tuple_ThirtyTwoBytesChannelMonitorZDecodeErrorZ_clone(uint64_t orig) {
22355         LDKCResult_C2Tuple_ThirtyTwoBytesChannelMonitorZDecodeErrorZ* orig_conv = (LDKCResult_C2Tuple_ThirtyTwoBytesChannelMonitorZDecodeErrorZ*)untag_ptr(orig);
22356         LDKCResult_C2Tuple_ThirtyTwoBytesChannelMonitorZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_ThirtyTwoBytesChannelMonitorZDecodeErrorZ), "LDKCResult_C2Tuple_ThirtyTwoBytesChannelMonitorZDecodeErrorZ");
22357         *ret_conv = CResult_C2Tuple_ThirtyTwoBytesChannelMonitorZDecodeErrorZ_clone(orig_conv);
22358         return tag_ptr(ret_conv, true);
22359 }
22360
22361 static inline uint64_t C2Tuple_PublicKeyTypeZ_clone_ptr(LDKC2Tuple_PublicKeyTypeZ *NONNULL_PTR arg) {
22362         LDKC2Tuple_PublicKeyTypeZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_PublicKeyTypeZ), "LDKC2Tuple_PublicKeyTypeZ");
22363         *ret_conv = C2Tuple_PublicKeyTypeZ_clone(arg);
22364         return tag_ptr(ret_conv, true);
22365 }
22366 int64_t  __attribute__((export_name("TS_C2Tuple_PublicKeyTypeZ_clone_ptr"))) TS_C2Tuple_PublicKeyTypeZ_clone_ptr(uint64_t arg) {
22367         LDKC2Tuple_PublicKeyTypeZ* arg_conv = (LDKC2Tuple_PublicKeyTypeZ*)untag_ptr(arg);
22368         int64_t ret_conv = C2Tuple_PublicKeyTypeZ_clone_ptr(arg_conv);
22369         return ret_conv;
22370 }
22371
22372 uint64_t  __attribute__((export_name("TS_C2Tuple_PublicKeyTypeZ_clone"))) TS_C2Tuple_PublicKeyTypeZ_clone(uint64_t orig) {
22373         LDKC2Tuple_PublicKeyTypeZ* orig_conv = (LDKC2Tuple_PublicKeyTypeZ*)untag_ptr(orig);
22374         LDKC2Tuple_PublicKeyTypeZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_PublicKeyTypeZ), "LDKC2Tuple_PublicKeyTypeZ");
22375         *ret_conv = C2Tuple_PublicKeyTypeZ_clone(orig_conv);
22376         return tag_ptr(ret_conv, true);
22377 }
22378
22379 uint64_t  __attribute__((export_name("TS_C2Tuple_PublicKeyTypeZ_new"))) TS_C2Tuple_PublicKeyTypeZ_new(int8_tArray a, uint64_t b) {
22380         LDKPublicKey a_ref;
22381         CHECK(a->arr_len == 33);
22382         memcpy(a_ref.compressed_form, a->elems, 33); FREE(a);
22383         void* b_ptr = untag_ptr(b);
22384         CHECK_ACCESS(b_ptr);
22385         LDKType b_conv = *(LDKType*)(b_ptr);
22386         if (b_conv.free == LDKType_JCalls_free) {
22387                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
22388                 LDKType_JCalls_cloned(&b_conv);
22389         }
22390         LDKC2Tuple_PublicKeyTypeZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_PublicKeyTypeZ), "LDKC2Tuple_PublicKeyTypeZ");
22391         *ret_conv = C2Tuple_PublicKeyTypeZ_new(a_ref, b_conv);
22392         return tag_ptr(ret_conv, true);
22393 }
22394
22395 void  __attribute__((export_name("TS_C2Tuple_PublicKeyTypeZ_free"))) TS_C2Tuple_PublicKeyTypeZ_free(uint64_t _res) {
22396         if (!ptr_is_owned(_res)) return;
22397         void* _res_ptr = untag_ptr(_res);
22398         CHECK_ACCESS(_res_ptr);
22399         LDKC2Tuple_PublicKeyTypeZ _res_conv = *(LDKC2Tuple_PublicKeyTypeZ*)(_res_ptr);
22400         FREE(untag_ptr(_res));
22401         C2Tuple_PublicKeyTypeZ_free(_res_conv);
22402 }
22403
22404 void  __attribute__((export_name("TS_CVec_C2Tuple_PublicKeyTypeZZ_free"))) TS_CVec_C2Tuple_PublicKeyTypeZZ_free(uint64_tArray _res) {
22405         LDKCVec_C2Tuple_PublicKeyTypeZZ _res_constr;
22406         _res_constr.datalen = _res->arr_len;
22407         if (_res_constr.datalen > 0)
22408                 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKC2Tuple_PublicKeyTypeZ), "LDKCVec_C2Tuple_PublicKeyTypeZZ Elements");
22409         else
22410                 _res_constr.data = NULL;
22411         uint64_t* _res_vals = _res->elems;
22412         for (size_t z = 0; z < _res_constr.datalen; z++) {
22413                 uint64_t _res_conv_25 = _res_vals[z];
22414                 void* _res_conv_25_ptr = untag_ptr(_res_conv_25);
22415                 CHECK_ACCESS(_res_conv_25_ptr);
22416                 LDKC2Tuple_PublicKeyTypeZ _res_conv_25_conv = *(LDKC2Tuple_PublicKeyTypeZ*)(_res_conv_25_ptr);
22417                 FREE(untag_ptr(_res_conv_25));
22418                 _res_constr.data[z] = _res_conv_25_conv;
22419         }
22420         FREE(_res);
22421         CVec_C2Tuple_PublicKeyTypeZZ_free(_res_constr);
22422 }
22423
22424 uint64_t  __attribute__((export_name("TS_COption_OnionMessageContentsZ_some"))) TS_COption_OnionMessageContentsZ_some(uint64_t o) {
22425         void* o_ptr = untag_ptr(o);
22426         CHECK_ACCESS(o_ptr);
22427         LDKOnionMessageContents o_conv = *(LDKOnionMessageContents*)(o_ptr);
22428         if (o_conv.free == LDKOnionMessageContents_JCalls_free) {
22429                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
22430                 LDKOnionMessageContents_JCalls_cloned(&o_conv);
22431         }
22432         LDKCOption_OnionMessageContentsZ *ret_copy = MALLOC(sizeof(LDKCOption_OnionMessageContentsZ), "LDKCOption_OnionMessageContentsZ");
22433         *ret_copy = COption_OnionMessageContentsZ_some(o_conv);
22434         uint64_t ret_ref = tag_ptr(ret_copy, true);
22435         return ret_ref;
22436 }
22437
22438 uint64_t  __attribute__((export_name("TS_COption_OnionMessageContentsZ_none"))) TS_COption_OnionMessageContentsZ_none() {
22439         LDKCOption_OnionMessageContentsZ *ret_copy = MALLOC(sizeof(LDKCOption_OnionMessageContentsZ), "LDKCOption_OnionMessageContentsZ");
22440         *ret_copy = COption_OnionMessageContentsZ_none();
22441         uint64_t ret_ref = tag_ptr(ret_copy, true);
22442         return ret_ref;
22443 }
22444
22445 void  __attribute__((export_name("TS_COption_OnionMessageContentsZ_free"))) TS_COption_OnionMessageContentsZ_free(uint64_t _res) {
22446         if (!ptr_is_owned(_res)) return;
22447         void* _res_ptr = untag_ptr(_res);
22448         CHECK_ACCESS(_res_ptr);
22449         LDKCOption_OnionMessageContentsZ _res_conv = *(LDKCOption_OnionMessageContentsZ*)(_res_ptr);
22450         FREE(untag_ptr(_res));
22451         COption_OnionMessageContentsZ_free(_res_conv);
22452 }
22453
22454 static inline uint64_t COption_OnionMessageContentsZ_clone_ptr(LDKCOption_OnionMessageContentsZ *NONNULL_PTR arg) {
22455         LDKCOption_OnionMessageContentsZ *ret_copy = MALLOC(sizeof(LDKCOption_OnionMessageContentsZ), "LDKCOption_OnionMessageContentsZ");
22456         *ret_copy = COption_OnionMessageContentsZ_clone(arg);
22457         uint64_t ret_ref = tag_ptr(ret_copy, true);
22458         return ret_ref;
22459 }
22460 int64_t  __attribute__((export_name("TS_COption_OnionMessageContentsZ_clone_ptr"))) TS_COption_OnionMessageContentsZ_clone_ptr(uint64_t arg) {
22461         LDKCOption_OnionMessageContentsZ* arg_conv = (LDKCOption_OnionMessageContentsZ*)untag_ptr(arg);
22462         int64_t ret_conv = COption_OnionMessageContentsZ_clone_ptr(arg_conv);
22463         return ret_conv;
22464 }
22465
22466 uint64_t  __attribute__((export_name("TS_COption_OnionMessageContentsZ_clone"))) TS_COption_OnionMessageContentsZ_clone(uint64_t orig) {
22467         LDKCOption_OnionMessageContentsZ* orig_conv = (LDKCOption_OnionMessageContentsZ*)untag_ptr(orig);
22468         LDKCOption_OnionMessageContentsZ *ret_copy = MALLOC(sizeof(LDKCOption_OnionMessageContentsZ), "LDKCOption_OnionMessageContentsZ");
22469         *ret_copy = COption_OnionMessageContentsZ_clone(orig_conv);
22470         uint64_t ret_ref = tag_ptr(ret_copy, true);
22471         return ret_ref;
22472 }
22473
22474 uint64_t  __attribute__((export_name("TS_CResult_COption_OnionMessageContentsZDecodeErrorZ_ok"))) TS_CResult_COption_OnionMessageContentsZDecodeErrorZ_ok(uint64_t o) {
22475         void* o_ptr = untag_ptr(o);
22476         CHECK_ACCESS(o_ptr);
22477         LDKCOption_OnionMessageContentsZ o_conv = *(LDKCOption_OnionMessageContentsZ*)(o_ptr);
22478         o_conv = COption_OnionMessageContentsZ_clone((LDKCOption_OnionMessageContentsZ*)untag_ptr(o));
22479         LDKCResult_COption_OnionMessageContentsZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_COption_OnionMessageContentsZDecodeErrorZ), "LDKCResult_COption_OnionMessageContentsZDecodeErrorZ");
22480         *ret_conv = CResult_COption_OnionMessageContentsZDecodeErrorZ_ok(o_conv);
22481         return tag_ptr(ret_conv, true);
22482 }
22483
22484 uint64_t  __attribute__((export_name("TS_CResult_COption_OnionMessageContentsZDecodeErrorZ_err"))) TS_CResult_COption_OnionMessageContentsZDecodeErrorZ_err(uint64_t e) {
22485         void* e_ptr = untag_ptr(e);
22486         CHECK_ACCESS(e_ptr);
22487         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
22488         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
22489         LDKCResult_COption_OnionMessageContentsZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_COption_OnionMessageContentsZDecodeErrorZ), "LDKCResult_COption_OnionMessageContentsZDecodeErrorZ");
22490         *ret_conv = CResult_COption_OnionMessageContentsZDecodeErrorZ_err(e_conv);
22491         return tag_ptr(ret_conv, true);
22492 }
22493
22494 jboolean  __attribute__((export_name("TS_CResult_COption_OnionMessageContentsZDecodeErrorZ_is_ok"))) TS_CResult_COption_OnionMessageContentsZDecodeErrorZ_is_ok(uint64_t o) {
22495         LDKCResult_COption_OnionMessageContentsZDecodeErrorZ* o_conv = (LDKCResult_COption_OnionMessageContentsZDecodeErrorZ*)untag_ptr(o);
22496         jboolean ret_conv = CResult_COption_OnionMessageContentsZDecodeErrorZ_is_ok(o_conv);
22497         return ret_conv;
22498 }
22499
22500 void  __attribute__((export_name("TS_CResult_COption_OnionMessageContentsZDecodeErrorZ_free"))) TS_CResult_COption_OnionMessageContentsZDecodeErrorZ_free(uint64_t _res) {
22501         if (!ptr_is_owned(_res)) return;
22502         void* _res_ptr = untag_ptr(_res);
22503         CHECK_ACCESS(_res_ptr);
22504         LDKCResult_COption_OnionMessageContentsZDecodeErrorZ _res_conv = *(LDKCResult_COption_OnionMessageContentsZDecodeErrorZ*)(_res_ptr);
22505         FREE(untag_ptr(_res));
22506         CResult_COption_OnionMessageContentsZDecodeErrorZ_free(_res_conv);
22507 }
22508
22509 static inline uint64_t CResult_COption_OnionMessageContentsZDecodeErrorZ_clone_ptr(LDKCResult_COption_OnionMessageContentsZDecodeErrorZ *NONNULL_PTR arg) {
22510         LDKCResult_COption_OnionMessageContentsZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_COption_OnionMessageContentsZDecodeErrorZ), "LDKCResult_COption_OnionMessageContentsZDecodeErrorZ");
22511         *ret_conv = CResult_COption_OnionMessageContentsZDecodeErrorZ_clone(arg);
22512         return tag_ptr(ret_conv, true);
22513 }
22514 int64_t  __attribute__((export_name("TS_CResult_COption_OnionMessageContentsZDecodeErrorZ_clone_ptr"))) TS_CResult_COption_OnionMessageContentsZDecodeErrorZ_clone_ptr(uint64_t arg) {
22515         LDKCResult_COption_OnionMessageContentsZDecodeErrorZ* arg_conv = (LDKCResult_COption_OnionMessageContentsZDecodeErrorZ*)untag_ptr(arg);
22516         int64_t ret_conv = CResult_COption_OnionMessageContentsZDecodeErrorZ_clone_ptr(arg_conv);
22517         return ret_conv;
22518 }
22519
22520 uint64_t  __attribute__((export_name("TS_CResult_COption_OnionMessageContentsZDecodeErrorZ_clone"))) TS_CResult_COption_OnionMessageContentsZDecodeErrorZ_clone(uint64_t orig) {
22521         LDKCResult_COption_OnionMessageContentsZDecodeErrorZ* orig_conv = (LDKCResult_COption_OnionMessageContentsZDecodeErrorZ*)untag_ptr(orig);
22522         LDKCResult_COption_OnionMessageContentsZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_COption_OnionMessageContentsZDecodeErrorZ), "LDKCResult_COption_OnionMessageContentsZDecodeErrorZ");
22523         *ret_conv = CResult_COption_OnionMessageContentsZDecodeErrorZ_clone(orig_conv);
22524         return tag_ptr(ret_conv, true);
22525 }
22526
22527 static inline uint64_t C3Tuple_OnionMessageContentsDestinationBlindedPathZ_clone_ptr(LDKC3Tuple_OnionMessageContentsDestinationBlindedPathZ *NONNULL_PTR arg) {
22528         LDKC3Tuple_OnionMessageContentsDestinationBlindedPathZ* ret_conv = MALLOC(sizeof(LDKC3Tuple_OnionMessageContentsDestinationBlindedPathZ), "LDKC3Tuple_OnionMessageContentsDestinationBlindedPathZ");
22529         *ret_conv = C3Tuple_OnionMessageContentsDestinationBlindedPathZ_clone(arg);
22530         return tag_ptr(ret_conv, true);
22531 }
22532 int64_t  __attribute__((export_name("TS_C3Tuple_OnionMessageContentsDestinationBlindedPathZ_clone_ptr"))) TS_C3Tuple_OnionMessageContentsDestinationBlindedPathZ_clone_ptr(uint64_t arg) {
22533         LDKC3Tuple_OnionMessageContentsDestinationBlindedPathZ* arg_conv = (LDKC3Tuple_OnionMessageContentsDestinationBlindedPathZ*)untag_ptr(arg);
22534         int64_t ret_conv = C3Tuple_OnionMessageContentsDestinationBlindedPathZ_clone_ptr(arg_conv);
22535         return ret_conv;
22536 }
22537
22538 uint64_t  __attribute__((export_name("TS_C3Tuple_OnionMessageContentsDestinationBlindedPathZ_clone"))) TS_C3Tuple_OnionMessageContentsDestinationBlindedPathZ_clone(uint64_t orig) {
22539         LDKC3Tuple_OnionMessageContentsDestinationBlindedPathZ* orig_conv = (LDKC3Tuple_OnionMessageContentsDestinationBlindedPathZ*)untag_ptr(orig);
22540         LDKC3Tuple_OnionMessageContentsDestinationBlindedPathZ* ret_conv = MALLOC(sizeof(LDKC3Tuple_OnionMessageContentsDestinationBlindedPathZ), "LDKC3Tuple_OnionMessageContentsDestinationBlindedPathZ");
22541         *ret_conv = C3Tuple_OnionMessageContentsDestinationBlindedPathZ_clone(orig_conv);
22542         return tag_ptr(ret_conv, true);
22543 }
22544
22545 uint64_t  __attribute__((export_name("TS_C3Tuple_OnionMessageContentsDestinationBlindedPathZ_new"))) TS_C3Tuple_OnionMessageContentsDestinationBlindedPathZ_new(uint64_t a, uint64_t b, uint64_t c) {
22546         void* a_ptr = untag_ptr(a);
22547         CHECK_ACCESS(a_ptr);
22548         LDKOnionMessageContents a_conv = *(LDKOnionMessageContents*)(a_ptr);
22549         if (a_conv.free == LDKOnionMessageContents_JCalls_free) {
22550                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
22551                 LDKOnionMessageContents_JCalls_cloned(&a_conv);
22552         }
22553         void* b_ptr = untag_ptr(b);
22554         CHECK_ACCESS(b_ptr);
22555         LDKDestination b_conv = *(LDKDestination*)(b_ptr);
22556         b_conv = Destination_clone((LDKDestination*)untag_ptr(b));
22557         LDKBlindedPath c_conv;
22558         c_conv.inner = untag_ptr(c);
22559         c_conv.is_owned = ptr_is_owned(c);
22560         CHECK_INNER_FIELD_ACCESS_OR_NULL(c_conv);
22561         c_conv = BlindedPath_clone(&c_conv);
22562         LDKC3Tuple_OnionMessageContentsDestinationBlindedPathZ* ret_conv = MALLOC(sizeof(LDKC3Tuple_OnionMessageContentsDestinationBlindedPathZ), "LDKC3Tuple_OnionMessageContentsDestinationBlindedPathZ");
22563         *ret_conv = C3Tuple_OnionMessageContentsDestinationBlindedPathZ_new(a_conv, b_conv, c_conv);
22564         return tag_ptr(ret_conv, true);
22565 }
22566
22567 void  __attribute__((export_name("TS_C3Tuple_OnionMessageContentsDestinationBlindedPathZ_free"))) TS_C3Tuple_OnionMessageContentsDestinationBlindedPathZ_free(uint64_t _res) {
22568         if (!ptr_is_owned(_res)) return;
22569         void* _res_ptr = untag_ptr(_res);
22570         CHECK_ACCESS(_res_ptr);
22571         LDKC3Tuple_OnionMessageContentsDestinationBlindedPathZ _res_conv = *(LDKC3Tuple_OnionMessageContentsDestinationBlindedPathZ*)(_res_ptr);
22572         FREE(untag_ptr(_res));
22573         C3Tuple_OnionMessageContentsDestinationBlindedPathZ_free(_res_conv);
22574 }
22575
22576 void  __attribute__((export_name("TS_CVec_C3Tuple_OnionMessageContentsDestinationBlindedPathZZ_free"))) TS_CVec_C3Tuple_OnionMessageContentsDestinationBlindedPathZZ_free(uint64_tArray _res) {
22577         LDKCVec_C3Tuple_OnionMessageContentsDestinationBlindedPathZZ _res_constr;
22578         _res_constr.datalen = _res->arr_len;
22579         if (_res_constr.datalen > 0)
22580                 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKC3Tuple_OnionMessageContentsDestinationBlindedPathZ), "LDKCVec_C3Tuple_OnionMessageContentsDestinationBlindedPathZZ Elements");
22581         else
22582                 _res_constr.data = NULL;
22583         uint64_t* _res_vals = _res->elems;
22584         for (size_t e = 0; e < _res_constr.datalen; e++) {
22585                 uint64_t _res_conv_56 = _res_vals[e];
22586                 void* _res_conv_56_ptr = untag_ptr(_res_conv_56);
22587                 CHECK_ACCESS(_res_conv_56_ptr);
22588                 LDKC3Tuple_OnionMessageContentsDestinationBlindedPathZ _res_conv_56_conv = *(LDKC3Tuple_OnionMessageContentsDestinationBlindedPathZ*)(_res_conv_56_ptr);
22589                 FREE(untag_ptr(_res_conv_56));
22590                 _res_constr.data[e] = _res_conv_56_conv;
22591         }
22592         FREE(_res);
22593         CVec_C3Tuple_OnionMessageContentsDestinationBlindedPathZZ_free(_res_constr);
22594 }
22595
22596 uint64_t  __attribute__((export_name("TS_COption_TypeZ_some"))) TS_COption_TypeZ_some(uint64_t o) {
22597         void* o_ptr = untag_ptr(o);
22598         CHECK_ACCESS(o_ptr);
22599         LDKType o_conv = *(LDKType*)(o_ptr);
22600         if (o_conv.free == LDKType_JCalls_free) {
22601                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
22602                 LDKType_JCalls_cloned(&o_conv);
22603         }
22604         LDKCOption_TypeZ *ret_copy = MALLOC(sizeof(LDKCOption_TypeZ), "LDKCOption_TypeZ");
22605         *ret_copy = COption_TypeZ_some(o_conv);
22606         uint64_t ret_ref = tag_ptr(ret_copy, true);
22607         return ret_ref;
22608 }
22609
22610 uint64_t  __attribute__((export_name("TS_COption_TypeZ_none"))) TS_COption_TypeZ_none() {
22611         LDKCOption_TypeZ *ret_copy = MALLOC(sizeof(LDKCOption_TypeZ), "LDKCOption_TypeZ");
22612         *ret_copy = COption_TypeZ_none();
22613         uint64_t ret_ref = tag_ptr(ret_copy, true);
22614         return ret_ref;
22615 }
22616
22617 void  __attribute__((export_name("TS_COption_TypeZ_free"))) TS_COption_TypeZ_free(uint64_t _res) {
22618         if (!ptr_is_owned(_res)) return;
22619         void* _res_ptr = untag_ptr(_res);
22620         CHECK_ACCESS(_res_ptr);
22621         LDKCOption_TypeZ _res_conv = *(LDKCOption_TypeZ*)(_res_ptr);
22622         FREE(untag_ptr(_res));
22623         COption_TypeZ_free(_res_conv);
22624 }
22625
22626 static inline uint64_t COption_TypeZ_clone_ptr(LDKCOption_TypeZ *NONNULL_PTR arg) {
22627         LDKCOption_TypeZ *ret_copy = MALLOC(sizeof(LDKCOption_TypeZ), "LDKCOption_TypeZ");
22628         *ret_copy = COption_TypeZ_clone(arg);
22629         uint64_t ret_ref = tag_ptr(ret_copy, true);
22630         return ret_ref;
22631 }
22632 int64_t  __attribute__((export_name("TS_COption_TypeZ_clone_ptr"))) TS_COption_TypeZ_clone_ptr(uint64_t arg) {
22633         LDKCOption_TypeZ* arg_conv = (LDKCOption_TypeZ*)untag_ptr(arg);
22634         int64_t ret_conv = COption_TypeZ_clone_ptr(arg_conv);
22635         return ret_conv;
22636 }
22637
22638 uint64_t  __attribute__((export_name("TS_COption_TypeZ_clone"))) TS_COption_TypeZ_clone(uint64_t orig) {
22639         LDKCOption_TypeZ* orig_conv = (LDKCOption_TypeZ*)untag_ptr(orig);
22640         LDKCOption_TypeZ *ret_copy = MALLOC(sizeof(LDKCOption_TypeZ), "LDKCOption_TypeZ");
22641         *ret_copy = COption_TypeZ_clone(orig_conv);
22642         uint64_t ret_ref = tag_ptr(ret_copy, true);
22643         return ret_ref;
22644 }
22645
22646 uint64_t  __attribute__((export_name("TS_CResult_COption_TypeZDecodeErrorZ_ok"))) TS_CResult_COption_TypeZDecodeErrorZ_ok(uint64_t o) {
22647         void* o_ptr = untag_ptr(o);
22648         CHECK_ACCESS(o_ptr);
22649         LDKCOption_TypeZ o_conv = *(LDKCOption_TypeZ*)(o_ptr);
22650         o_conv = COption_TypeZ_clone((LDKCOption_TypeZ*)untag_ptr(o));
22651         LDKCResult_COption_TypeZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_COption_TypeZDecodeErrorZ), "LDKCResult_COption_TypeZDecodeErrorZ");
22652         *ret_conv = CResult_COption_TypeZDecodeErrorZ_ok(o_conv);
22653         return tag_ptr(ret_conv, true);
22654 }
22655
22656 uint64_t  __attribute__((export_name("TS_CResult_COption_TypeZDecodeErrorZ_err"))) TS_CResult_COption_TypeZDecodeErrorZ_err(uint64_t e) {
22657         void* e_ptr = untag_ptr(e);
22658         CHECK_ACCESS(e_ptr);
22659         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
22660         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
22661         LDKCResult_COption_TypeZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_COption_TypeZDecodeErrorZ), "LDKCResult_COption_TypeZDecodeErrorZ");
22662         *ret_conv = CResult_COption_TypeZDecodeErrorZ_err(e_conv);
22663         return tag_ptr(ret_conv, true);
22664 }
22665
22666 jboolean  __attribute__((export_name("TS_CResult_COption_TypeZDecodeErrorZ_is_ok"))) TS_CResult_COption_TypeZDecodeErrorZ_is_ok(uint64_t o) {
22667         LDKCResult_COption_TypeZDecodeErrorZ* o_conv = (LDKCResult_COption_TypeZDecodeErrorZ*)untag_ptr(o);
22668         jboolean ret_conv = CResult_COption_TypeZDecodeErrorZ_is_ok(o_conv);
22669         return ret_conv;
22670 }
22671
22672 void  __attribute__((export_name("TS_CResult_COption_TypeZDecodeErrorZ_free"))) TS_CResult_COption_TypeZDecodeErrorZ_free(uint64_t _res) {
22673         if (!ptr_is_owned(_res)) return;
22674         void* _res_ptr = untag_ptr(_res);
22675         CHECK_ACCESS(_res_ptr);
22676         LDKCResult_COption_TypeZDecodeErrorZ _res_conv = *(LDKCResult_COption_TypeZDecodeErrorZ*)(_res_ptr);
22677         FREE(untag_ptr(_res));
22678         CResult_COption_TypeZDecodeErrorZ_free(_res_conv);
22679 }
22680
22681 static inline uint64_t CResult_COption_TypeZDecodeErrorZ_clone_ptr(LDKCResult_COption_TypeZDecodeErrorZ *NONNULL_PTR arg) {
22682         LDKCResult_COption_TypeZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_COption_TypeZDecodeErrorZ), "LDKCResult_COption_TypeZDecodeErrorZ");
22683         *ret_conv = CResult_COption_TypeZDecodeErrorZ_clone(arg);
22684         return tag_ptr(ret_conv, true);
22685 }
22686 int64_t  __attribute__((export_name("TS_CResult_COption_TypeZDecodeErrorZ_clone_ptr"))) TS_CResult_COption_TypeZDecodeErrorZ_clone_ptr(uint64_t arg) {
22687         LDKCResult_COption_TypeZDecodeErrorZ* arg_conv = (LDKCResult_COption_TypeZDecodeErrorZ*)untag_ptr(arg);
22688         int64_t ret_conv = CResult_COption_TypeZDecodeErrorZ_clone_ptr(arg_conv);
22689         return ret_conv;
22690 }
22691
22692 uint64_t  __attribute__((export_name("TS_CResult_COption_TypeZDecodeErrorZ_clone"))) TS_CResult_COption_TypeZDecodeErrorZ_clone(uint64_t orig) {
22693         LDKCResult_COption_TypeZDecodeErrorZ* orig_conv = (LDKCResult_COption_TypeZDecodeErrorZ*)untag_ptr(orig);
22694         LDKCResult_COption_TypeZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_COption_TypeZDecodeErrorZ), "LDKCResult_COption_TypeZDecodeErrorZ");
22695         *ret_conv = CResult_COption_TypeZDecodeErrorZ_clone(orig_conv);
22696         return tag_ptr(ret_conv, true);
22697 }
22698
22699 uint64_t  __attribute__((export_name("TS_COption_SocketAddressZ_some"))) TS_COption_SocketAddressZ_some(uint64_t o) {
22700         void* o_ptr = untag_ptr(o);
22701         CHECK_ACCESS(o_ptr);
22702         LDKSocketAddress o_conv = *(LDKSocketAddress*)(o_ptr);
22703         o_conv = SocketAddress_clone((LDKSocketAddress*)untag_ptr(o));
22704         LDKCOption_SocketAddressZ *ret_copy = MALLOC(sizeof(LDKCOption_SocketAddressZ), "LDKCOption_SocketAddressZ");
22705         *ret_copy = COption_SocketAddressZ_some(o_conv);
22706         uint64_t ret_ref = tag_ptr(ret_copy, true);
22707         return ret_ref;
22708 }
22709
22710 uint64_t  __attribute__((export_name("TS_COption_SocketAddressZ_none"))) TS_COption_SocketAddressZ_none() {
22711         LDKCOption_SocketAddressZ *ret_copy = MALLOC(sizeof(LDKCOption_SocketAddressZ), "LDKCOption_SocketAddressZ");
22712         *ret_copy = COption_SocketAddressZ_none();
22713         uint64_t ret_ref = tag_ptr(ret_copy, true);
22714         return ret_ref;
22715 }
22716
22717 void  __attribute__((export_name("TS_COption_SocketAddressZ_free"))) TS_COption_SocketAddressZ_free(uint64_t _res) {
22718         if (!ptr_is_owned(_res)) return;
22719         void* _res_ptr = untag_ptr(_res);
22720         CHECK_ACCESS(_res_ptr);
22721         LDKCOption_SocketAddressZ _res_conv = *(LDKCOption_SocketAddressZ*)(_res_ptr);
22722         FREE(untag_ptr(_res));
22723         COption_SocketAddressZ_free(_res_conv);
22724 }
22725
22726 static inline uint64_t COption_SocketAddressZ_clone_ptr(LDKCOption_SocketAddressZ *NONNULL_PTR arg) {
22727         LDKCOption_SocketAddressZ *ret_copy = MALLOC(sizeof(LDKCOption_SocketAddressZ), "LDKCOption_SocketAddressZ");
22728         *ret_copy = COption_SocketAddressZ_clone(arg);
22729         uint64_t ret_ref = tag_ptr(ret_copy, true);
22730         return ret_ref;
22731 }
22732 int64_t  __attribute__((export_name("TS_COption_SocketAddressZ_clone_ptr"))) TS_COption_SocketAddressZ_clone_ptr(uint64_t arg) {
22733         LDKCOption_SocketAddressZ* arg_conv = (LDKCOption_SocketAddressZ*)untag_ptr(arg);
22734         int64_t ret_conv = COption_SocketAddressZ_clone_ptr(arg_conv);
22735         return ret_conv;
22736 }
22737
22738 uint64_t  __attribute__((export_name("TS_COption_SocketAddressZ_clone"))) TS_COption_SocketAddressZ_clone(uint64_t orig) {
22739         LDKCOption_SocketAddressZ* orig_conv = (LDKCOption_SocketAddressZ*)untag_ptr(orig);
22740         LDKCOption_SocketAddressZ *ret_copy = MALLOC(sizeof(LDKCOption_SocketAddressZ), "LDKCOption_SocketAddressZ");
22741         *ret_copy = COption_SocketAddressZ_clone(orig_conv);
22742         uint64_t ret_ref = tag_ptr(ret_copy, true);
22743         return ret_ref;
22744 }
22745
22746 static inline uint64_t C2Tuple_PublicKeyCOption_SocketAddressZZ_clone_ptr(LDKC2Tuple_PublicKeyCOption_SocketAddressZZ *NONNULL_PTR arg) {
22747         LDKC2Tuple_PublicKeyCOption_SocketAddressZZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_PublicKeyCOption_SocketAddressZZ), "LDKC2Tuple_PublicKeyCOption_SocketAddressZZ");
22748         *ret_conv = C2Tuple_PublicKeyCOption_SocketAddressZZ_clone(arg);
22749         return tag_ptr(ret_conv, true);
22750 }
22751 int64_t  __attribute__((export_name("TS_C2Tuple_PublicKeyCOption_SocketAddressZZ_clone_ptr"))) TS_C2Tuple_PublicKeyCOption_SocketAddressZZ_clone_ptr(uint64_t arg) {
22752         LDKC2Tuple_PublicKeyCOption_SocketAddressZZ* arg_conv = (LDKC2Tuple_PublicKeyCOption_SocketAddressZZ*)untag_ptr(arg);
22753         int64_t ret_conv = C2Tuple_PublicKeyCOption_SocketAddressZZ_clone_ptr(arg_conv);
22754         return ret_conv;
22755 }
22756
22757 uint64_t  __attribute__((export_name("TS_C2Tuple_PublicKeyCOption_SocketAddressZZ_clone"))) TS_C2Tuple_PublicKeyCOption_SocketAddressZZ_clone(uint64_t orig) {
22758         LDKC2Tuple_PublicKeyCOption_SocketAddressZZ* orig_conv = (LDKC2Tuple_PublicKeyCOption_SocketAddressZZ*)untag_ptr(orig);
22759         LDKC2Tuple_PublicKeyCOption_SocketAddressZZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_PublicKeyCOption_SocketAddressZZ), "LDKC2Tuple_PublicKeyCOption_SocketAddressZZ");
22760         *ret_conv = C2Tuple_PublicKeyCOption_SocketAddressZZ_clone(orig_conv);
22761         return tag_ptr(ret_conv, true);
22762 }
22763
22764 uint64_t  __attribute__((export_name("TS_C2Tuple_PublicKeyCOption_SocketAddressZZ_new"))) TS_C2Tuple_PublicKeyCOption_SocketAddressZZ_new(int8_tArray a, uint64_t b) {
22765         LDKPublicKey a_ref;
22766         CHECK(a->arr_len == 33);
22767         memcpy(a_ref.compressed_form, a->elems, 33); FREE(a);
22768         void* b_ptr = untag_ptr(b);
22769         CHECK_ACCESS(b_ptr);
22770         LDKCOption_SocketAddressZ b_conv = *(LDKCOption_SocketAddressZ*)(b_ptr);
22771         b_conv = COption_SocketAddressZ_clone((LDKCOption_SocketAddressZ*)untag_ptr(b));
22772         LDKC2Tuple_PublicKeyCOption_SocketAddressZZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_PublicKeyCOption_SocketAddressZZ), "LDKC2Tuple_PublicKeyCOption_SocketAddressZZ");
22773         *ret_conv = C2Tuple_PublicKeyCOption_SocketAddressZZ_new(a_ref, b_conv);
22774         return tag_ptr(ret_conv, true);
22775 }
22776
22777 void  __attribute__((export_name("TS_C2Tuple_PublicKeyCOption_SocketAddressZZ_free"))) TS_C2Tuple_PublicKeyCOption_SocketAddressZZ_free(uint64_t _res) {
22778         if (!ptr_is_owned(_res)) return;
22779         void* _res_ptr = untag_ptr(_res);
22780         CHECK_ACCESS(_res_ptr);
22781         LDKC2Tuple_PublicKeyCOption_SocketAddressZZ _res_conv = *(LDKC2Tuple_PublicKeyCOption_SocketAddressZZ*)(_res_ptr);
22782         FREE(untag_ptr(_res));
22783         C2Tuple_PublicKeyCOption_SocketAddressZZ_free(_res_conv);
22784 }
22785
22786 void  __attribute__((export_name("TS_CVec_C2Tuple_PublicKeyCOption_SocketAddressZZZ_free"))) TS_CVec_C2Tuple_PublicKeyCOption_SocketAddressZZZ_free(uint64_tArray _res) {
22787         LDKCVec_C2Tuple_PublicKeyCOption_SocketAddressZZZ _res_constr;
22788         _res_constr.datalen = _res->arr_len;
22789         if (_res_constr.datalen > 0)
22790                 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKC2Tuple_PublicKeyCOption_SocketAddressZZ), "LDKCVec_C2Tuple_PublicKeyCOption_SocketAddressZZZ Elements");
22791         else
22792                 _res_constr.data = NULL;
22793         uint64_t* _res_vals = _res->elems;
22794         for (size_t r = 0; r < _res_constr.datalen; r++) {
22795                 uint64_t _res_conv_43 = _res_vals[r];
22796                 void* _res_conv_43_ptr = untag_ptr(_res_conv_43);
22797                 CHECK_ACCESS(_res_conv_43_ptr);
22798                 LDKC2Tuple_PublicKeyCOption_SocketAddressZZ _res_conv_43_conv = *(LDKC2Tuple_PublicKeyCOption_SocketAddressZZ*)(_res_conv_43_ptr);
22799                 FREE(untag_ptr(_res_conv_43));
22800                 _res_constr.data[r] = _res_conv_43_conv;
22801         }
22802         FREE(_res);
22803         CVec_C2Tuple_PublicKeyCOption_SocketAddressZZZ_free(_res_constr);
22804 }
22805
22806 uint64_t  __attribute__((export_name("TS_CResult_CVec_u8ZPeerHandleErrorZ_ok"))) TS_CResult_CVec_u8ZPeerHandleErrorZ_ok(int8_tArray o) {
22807         LDKCVec_u8Z o_ref;
22808         o_ref.datalen = o->arr_len;
22809         o_ref.data = MALLOC(o_ref.datalen, "LDKCVec_u8Z Bytes");
22810         memcpy(o_ref.data, o->elems, o_ref.datalen); FREE(o);
22811         LDKCResult_CVec_u8ZPeerHandleErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_u8ZPeerHandleErrorZ), "LDKCResult_CVec_u8ZPeerHandleErrorZ");
22812         *ret_conv = CResult_CVec_u8ZPeerHandleErrorZ_ok(o_ref);
22813         return tag_ptr(ret_conv, true);
22814 }
22815
22816 uint64_t  __attribute__((export_name("TS_CResult_CVec_u8ZPeerHandleErrorZ_err"))) TS_CResult_CVec_u8ZPeerHandleErrorZ_err(uint64_t e) {
22817         LDKPeerHandleError e_conv;
22818         e_conv.inner = untag_ptr(e);
22819         e_conv.is_owned = ptr_is_owned(e);
22820         CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
22821         e_conv = PeerHandleError_clone(&e_conv);
22822         LDKCResult_CVec_u8ZPeerHandleErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_u8ZPeerHandleErrorZ), "LDKCResult_CVec_u8ZPeerHandleErrorZ");
22823         *ret_conv = CResult_CVec_u8ZPeerHandleErrorZ_err(e_conv);
22824         return tag_ptr(ret_conv, true);
22825 }
22826
22827 jboolean  __attribute__((export_name("TS_CResult_CVec_u8ZPeerHandleErrorZ_is_ok"))) TS_CResult_CVec_u8ZPeerHandleErrorZ_is_ok(uint64_t o) {
22828         LDKCResult_CVec_u8ZPeerHandleErrorZ* o_conv = (LDKCResult_CVec_u8ZPeerHandleErrorZ*)untag_ptr(o);
22829         jboolean ret_conv = CResult_CVec_u8ZPeerHandleErrorZ_is_ok(o_conv);
22830         return ret_conv;
22831 }
22832
22833 void  __attribute__((export_name("TS_CResult_CVec_u8ZPeerHandleErrorZ_free"))) TS_CResult_CVec_u8ZPeerHandleErrorZ_free(uint64_t _res) {
22834         if (!ptr_is_owned(_res)) return;
22835         void* _res_ptr = untag_ptr(_res);
22836         CHECK_ACCESS(_res_ptr);
22837         LDKCResult_CVec_u8ZPeerHandleErrorZ _res_conv = *(LDKCResult_CVec_u8ZPeerHandleErrorZ*)(_res_ptr);
22838         FREE(untag_ptr(_res));
22839         CResult_CVec_u8ZPeerHandleErrorZ_free(_res_conv);
22840 }
22841
22842 static inline uint64_t CResult_CVec_u8ZPeerHandleErrorZ_clone_ptr(LDKCResult_CVec_u8ZPeerHandleErrorZ *NONNULL_PTR arg) {
22843         LDKCResult_CVec_u8ZPeerHandleErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_u8ZPeerHandleErrorZ), "LDKCResult_CVec_u8ZPeerHandleErrorZ");
22844         *ret_conv = CResult_CVec_u8ZPeerHandleErrorZ_clone(arg);
22845         return tag_ptr(ret_conv, true);
22846 }
22847 int64_t  __attribute__((export_name("TS_CResult_CVec_u8ZPeerHandleErrorZ_clone_ptr"))) TS_CResult_CVec_u8ZPeerHandleErrorZ_clone_ptr(uint64_t arg) {
22848         LDKCResult_CVec_u8ZPeerHandleErrorZ* arg_conv = (LDKCResult_CVec_u8ZPeerHandleErrorZ*)untag_ptr(arg);
22849         int64_t ret_conv = CResult_CVec_u8ZPeerHandleErrorZ_clone_ptr(arg_conv);
22850         return ret_conv;
22851 }
22852
22853 uint64_t  __attribute__((export_name("TS_CResult_CVec_u8ZPeerHandleErrorZ_clone"))) TS_CResult_CVec_u8ZPeerHandleErrorZ_clone(uint64_t orig) {
22854         LDKCResult_CVec_u8ZPeerHandleErrorZ* orig_conv = (LDKCResult_CVec_u8ZPeerHandleErrorZ*)untag_ptr(orig);
22855         LDKCResult_CVec_u8ZPeerHandleErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_u8ZPeerHandleErrorZ), "LDKCResult_CVec_u8ZPeerHandleErrorZ");
22856         *ret_conv = CResult_CVec_u8ZPeerHandleErrorZ_clone(orig_conv);
22857         return tag_ptr(ret_conv, true);
22858 }
22859
22860 uint64_t  __attribute__((export_name("TS_CResult_NonePeerHandleErrorZ_ok"))) TS_CResult_NonePeerHandleErrorZ_ok() {
22861         LDKCResult_NonePeerHandleErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NonePeerHandleErrorZ), "LDKCResult_NonePeerHandleErrorZ");
22862         *ret_conv = CResult_NonePeerHandleErrorZ_ok();
22863         return tag_ptr(ret_conv, true);
22864 }
22865
22866 uint64_t  __attribute__((export_name("TS_CResult_NonePeerHandleErrorZ_err"))) TS_CResult_NonePeerHandleErrorZ_err(uint64_t e) {
22867         LDKPeerHandleError e_conv;
22868         e_conv.inner = untag_ptr(e);
22869         e_conv.is_owned = ptr_is_owned(e);
22870         CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
22871         e_conv = PeerHandleError_clone(&e_conv);
22872         LDKCResult_NonePeerHandleErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NonePeerHandleErrorZ), "LDKCResult_NonePeerHandleErrorZ");
22873         *ret_conv = CResult_NonePeerHandleErrorZ_err(e_conv);
22874         return tag_ptr(ret_conv, true);
22875 }
22876
22877 jboolean  __attribute__((export_name("TS_CResult_NonePeerHandleErrorZ_is_ok"))) TS_CResult_NonePeerHandleErrorZ_is_ok(uint64_t o) {
22878         LDKCResult_NonePeerHandleErrorZ* o_conv = (LDKCResult_NonePeerHandleErrorZ*)untag_ptr(o);
22879         jboolean ret_conv = CResult_NonePeerHandleErrorZ_is_ok(o_conv);
22880         return ret_conv;
22881 }
22882
22883 void  __attribute__((export_name("TS_CResult_NonePeerHandleErrorZ_free"))) TS_CResult_NonePeerHandleErrorZ_free(uint64_t _res) {
22884         if (!ptr_is_owned(_res)) return;
22885         void* _res_ptr = untag_ptr(_res);
22886         CHECK_ACCESS(_res_ptr);
22887         LDKCResult_NonePeerHandleErrorZ _res_conv = *(LDKCResult_NonePeerHandleErrorZ*)(_res_ptr);
22888         FREE(untag_ptr(_res));
22889         CResult_NonePeerHandleErrorZ_free(_res_conv);
22890 }
22891
22892 static inline uint64_t CResult_NonePeerHandleErrorZ_clone_ptr(LDKCResult_NonePeerHandleErrorZ *NONNULL_PTR arg) {
22893         LDKCResult_NonePeerHandleErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NonePeerHandleErrorZ), "LDKCResult_NonePeerHandleErrorZ");
22894         *ret_conv = CResult_NonePeerHandleErrorZ_clone(arg);
22895         return tag_ptr(ret_conv, true);
22896 }
22897 int64_t  __attribute__((export_name("TS_CResult_NonePeerHandleErrorZ_clone_ptr"))) TS_CResult_NonePeerHandleErrorZ_clone_ptr(uint64_t arg) {
22898         LDKCResult_NonePeerHandleErrorZ* arg_conv = (LDKCResult_NonePeerHandleErrorZ*)untag_ptr(arg);
22899         int64_t ret_conv = CResult_NonePeerHandleErrorZ_clone_ptr(arg_conv);
22900         return ret_conv;
22901 }
22902
22903 uint64_t  __attribute__((export_name("TS_CResult_NonePeerHandleErrorZ_clone"))) TS_CResult_NonePeerHandleErrorZ_clone(uint64_t orig) {
22904         LDKCResult_NonePeerHandleErrorZ* orig_conv = (LDKCResult_NonePeerHandleErrorZ*)untag_ptr(orig);
22905         LDKCResult_NonePeerHandleErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NonePeerHandleErrorZ), "LDKCResult_NonePeerHandleErrorZ");
22906         *ret_conv = CResult_NonePeerHandleErrorZ_clone(orig_conv);
22907         return tag_ptr(ret_conv, true);
22908 }
22909
22910 uint64_t  __attribute__((export_name("TS_CResult_boolPeerHandleErrorZ_ok"))) TS_CResult_boolPeerHandleErrorZ_ok(jboolean o) {
22911         LDKCResult_boolPeerHandleErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_boolPeerHandleErrorZ), "LDKCResult_boolPeerHandleErrorZ");
22912         *ret_conv = CResult_boolPeerHandleErrorZ_ok(o);
22913         return tag_ptr(ret_conv, true);
22914 }
22915
22916 uint64_t  __attribute__((export_name("TS_CResult_boolPeerHandleErrorZ_err"))) TS_CResult_boolPeerHandleErrorZ_err(uint64_t e) {
22917         LDKPeerHandleError e_conv;
22918         e_conv.inner = untag_ptr(e);
22919         e_conv.is_owned = ptr_is_owned(e);
22920         CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
22921         e_conv = PeerHandleError_clone(&e_conv);
22922         LDKCResult_boolPeerHandleErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_boolPeerHandleErrorZ), "LDKCResult_boolPeerHandleErrorZ");
22923         *ret_conv = CResult_boolPeerHandleErrorZ_err(e_conv);
22924         return tag_ptr(ret_conv, true);
22925 }
22926
22927 jboolean  __attribute__((export_name("TS_CResult_boolPeerHandleErrorZ_is_ok"))) TS_CResult_boolPeerHandleErrorZ_is_ok(uint64_t o) {
22928         LDKCResult_boolPeerHandleErrorZ* o_conv = (LDKCResult_boolPeerHandleErrorZ*)untag_ptr(o);
22929         jboolean ret_conv = CResult_boolPeerHandleErrorZ_is_ok(o_conv);
22930         return ret_conv;
22931 }
22932
22933 void  __attribute__((export_name("TS_CResult_boolPeerHandleErrorZ_free"))) TS_CResult_boolPeerHandleErrorZ_free(uint64_t _res) {
22934         if (!ptr_is_owned(_res)) return;
22935         void* _res_ptr = untag_ptr(_res);
22936         CHECK_ACCESS(_res_ptr);
22937         LDKCResult_boolPeerHandleErrorZ _res_conv = *(LDKCResult_boolPeerHandleErrorZ*)(_res_ptr);
22938         FREE(untag_ptr(_res));
22939         CResult_boolPeerHandleErrorZ_free(_res_conv);
22940 }
22941
22942 static inline uint64_t CResult_boolPeerHandleErrorZ_clone_ptr(LDKCResult_boolPeerHandleErrorZ *NONNULL_PTR arg) {
22943         LDKCResult_boolPeerHandleErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_boolPeerHandleErrorZ), "LDKCResult_boolPeerHandleErrorZ");
22944         *ret_conv = CResult_boolPeerHandleErrorZ_clone(arg);
22945         return tag_ptr(ret_conv, true);
22946 }
22947 int64_t  __attribute__((export_name("TS_CResult_boolPeerHandleErrorZ_clone_ptr"))) TS_CResult_boolPeerHandleErrorZ_clone_ptr(uint64_t arg) {
22948         LDKCResult_boolPeerHandleErrorZ* arg_conv = (LDKCResult_boolPeerHandleErrorZ*)untag_ptr(arg);
22949         int64_t ret_conv = CResult_boolPeerHandleErrorZ_clone_ptr(arg_conv);
22950         return ret_conv;
22951 }
22952
22953 uint64_t  __attribute__((export_name("TS_CResult_boolPeerHandleErrorZ_clone"))) TS_CResult_boolPeerHandleErrorZ_clone(uint64_t orig) {
22954         LDKCResult_boolPeerHandleErrorZ* orig_conv = (LDKCResult_boolPeerHandleErrorZ*)untag_ptr(orig);
22955         LDKCResult_boolPeerHandleErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_boolPeerHandleErrorZ), "LDKCResult_boolPeerHandleErrorZ");
22956         *ret_conv = CResult_boolPeerHandleErrorZ_clone(orig_conv);
22957         return tag_ptr(ret_conv, true);
22958 }
22959
22960 uint64_t  __attribute__((export_name("TS_CResult_u32GraphSyncErrorZ_ok"))) TS_CResult_u32GraphSyncErrorZ_ok(int32_t o) {
22961         LDKCResult_u32GraphSyncErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_u32GraphSyncErrorZ), "LDKCResult_u32GraphSyncErrorZ");
22962         *ret_conv = CResult_u32GraphSyncErrorZ_ok(o);
22963         return tag_ptr(ret_conv, true);
22964 }
22965
22966 uint64_t  __attribute__((export_name("TS_CResult_u32GraphSyncErrorZ_err"))) TS_CResult_u32GraphSyncErrorZ_err(uint64_t e) {
22967         void* e_ptr = untag_ptr(e);
22968         CHECK_ACCESS(e_ptr);
22969         LDKGraphSyncError e_conv = *(LDKGraphSyncError*)(e_ptr);
22970         e_conv = GraphSyncError_clone((LDKGraphSyncError*)untag_ptr(e));
22971         LDKCResult_u32GraphSyncErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_u32GraphSyncErrorZ), "LDKCResult_u32GraphSyncErrorZ");
22972         *ret_conv = CResult_u32GraphSyncErrorZ_err(e_conv);
22973         return tag_ptr(ret_conv, true);
22974 }
22975
22976 jboolean  __attribute__((export_name("TS_CResult_u32GraphSyncErrorZ_is_ok"))) TS_CResult_u32GraphSyncErrorZ_is_ok(uint64_t o) {
22977         LDKCResult_u32GraphSyncErrorZ* o_conv = (LDKCResult_u32GraphSyncErrorZ*)untag_ptr(o);
22978         jboolean ret_conv = CResult_u32GraphSyncErrorZ_is_ok(o_conv);
22979         return ret_conv;
22980 }
22981
22982 void  __attribute__((export_name("TS_CResult_u32GraphSyncErrorZ_free"))) TS_CResult_u32GraphSyncErrorZ_free(uint64_t _res) {
22983         if (!ptr_is_owned(_res)) return;
22984         void* _res_ptr = untag_ptr(_res);
22985         CHECK_ACCESS(_res_ptr);
22986         LDKCResult_u32GraphSyncErrorZ _res_conv = *(LDKCResult_u32GraphSyncErrorZ*)(_res_ptr);
22987         FREE(untag_ptr(_res));
22988         CResult_u32GraphSyncErrorZ_free(_res_conv);
22989 }
22990
22991 uint64_t  __attribute__((export_name("TS_CResult_CVec_u8ZIOErrorZ_ok"))) TS_CResult_CVec_u8ZIOErrorZ_ok(int8_tArray o) {
22992         LDKCVec_u8Z o_ref;
22993         o_ref.datalen = o->arr_len;
22994         o_ref.data = MALLOC(o_ref.datalen, "LDKCVec_u8Z Bytes");
22995         memcpy(o_ref.data, o->elems, o_ref.datalen); FREE(o);
22996         LDKCResult_CVec_u8ZIOErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_u8ZIOErrorZ), "LDKCResult_CVec_u8ZIOErrorZ");
22997         *ret_conv = CResult_CVec_u8ZIOErrorZ_ok(o_ref);
22998         return tag_ptr(ret_conv, true);
22999 }
23000
23001 uint64_t  __attribute__((export_name("TS_CResult_CVec_u8ZIOErrorZ_err"))) TS_CResult_CVec_u8ZIOErrorZ_err(uint32_t e) {
23002         LDKIOError e_conv = LDKIOError_from_js(e);
23003         LDKCResult_CVec_u8ZIOErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_u8ZIOErrorZ), "LDKCResult_CVec_u8ZIOErrorZ");
23004         *ret_conv = CResult_CVec_u8ZIOErrorZ_err(e_conv);
23005         return tag_ptr(ret_conv, true);
23006 }
23007
23008 jboolean  __attribute__((export_name("TS_CResult_CVec_u8ZIOErrorZ_is_ok"))) TS_CResult_CVec_u8ZIOErrorZ_is_ok(uint64_t o) {
23009         LDKCResult_CVec_u8ZIOErrorZ* o_conv = (LDKCResult_CVec_u8ZIOErrorZ*)untag_ptr(o);
23010         jboolean ret_conv = CResult_CVec_u8ZIOErrorZ_is_ok(o_conv);
23011         return ret_conv;
23012 }
23013
23014 void  __attribute__((export_name("TS_CResult_CVec_u8ZIOErrorZ_free"))) TS_CResult_CVec_u8ZIOErrorZ_free(uint64_t _res) {
23015         if (!ptr_is_owned(_res)) return;
23016         void* _res_ptr = untag_ptr(_res);
23017         CHECK_ACCESS(_res_ptr);
23018         LDKCResult_CVec_u8ZIOErrorZ _res_conv = *(LDKCResult_CVec_u8ZIOErrorZ*)(_res_ptr);
23019         FREE(untag_ptr(_res));
23020         CResult_CVec_u8ZIOErrorZ_free(_res_conv);
23021 }
23022
23023 static inline uint64_t CResult_CVec_u8ZIOErrorZ_clone_ptr(LDKCResult_CVec_u8ZIOErrorZ *NONNULL_PTR arg) {
23024         LDKCResult_CVec_u8ZIOErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_u8ZIOErrorZ), "LDKCResult_CVec_u8ZIOErrorZ");
23025         *ret_conv = CResult_CVec_u8ZIOErrorZ_clone(arg);
23026         return tag_ptr(ret_conv, true);
23027 }
23028 int64_t  __attribute__((export_name("TS_CResult_CVec_u8ZIOErrorZ_clone_ptr"))) TS_CResult_CVec_u8ZIOErrorZ_clone_ptr(uint64_t arg) {
23029         LDKCResult_CVec_u8ZIOErrorZ* arg_conv = (LDKCResult_CVec_u8ZIOErrorZ*)untag_ptr(arg);
23030         int64_t ret_conv = CResult_CVec_u8ZIOErrorZ_clone_ptr(arg_conv);
23031         return ret_conv;
23032 }
23033
23034 uint64_t  __attribute__((export_name("TS_CResult_CVec_u8ZIOErrorZ_clone"))) TS_CResult_CVec_u8ZIOErrorZ_clone(uint64_t orig) {
23035         LDKCResult_CVec_u8ZIOErrorZ* orig_conv = (LDKCResult_CVec_u8ZIOErrorZ*)untag_ptr(orig);
23036         LDKCResult_CVec_u8ZIOErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_u8ZIOErrorZ), "LDKCResult_CVec_u8ZIOErrorZ");
23037         *ret_conv = CResult_CVec_u8ZIOErrorZ_clone(orig_conv);
23038         return tag_ptr(ret_conv, true);
23039 }
23040
23041 uint64_t  __attribute__((export_name("TS_CResult_NoneIOErrorZ_ok"))) TS_CResult_NoneIOErrorZ_ok() {
23042         LDKCResult_NoneIOErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneIOErrorZ), "LDKCResult_NoneIOErrorZ");
23043         *ret_conv = CResult_NoneIOErrorZ_ok();
23044         return tag_ptr(ret_conv, true);
23045 }
23046
23047 uint64_t  __attribute__((export_name("TS_CResult_NoneIOErrorZ_err"))) TS_CResult_NoneIOErrorZ_err(uint32_t e) {
23048         LDKIOError e_conv = LDKIOError_from_js(e);
23049         LDKCResult_NoneIOErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneIOErrorZ), "LDKCResult_NoneIOErrorZ");
23050         *ret_conv = CResult_NoneIOErrorZ_err(e_conv);
23051         return tag_ptr(ret_conv, true);
23052 }
23053
23054 jboolean  __attribute__((export_name("TS_CResult_NoneIOErrorZ_is_ok"))) TS_CResult_NoneIOErrorZ_is_ok(uint64_t o) {
23055         LDKCResult_NoneIOErrorZ* o_conv = (LDKCResult_NoneIOErrorZ*)untag_ptr(o);
23056         jboolean ret_conv = CResult_NoneIOErrorZ_is_ok(o_conv);
23057         return ret_conv;
23058 }
23059
23060 void  __attribute__((export_name("TS_CResult_NoneIOErrorZ_free"))) TS_CResult_NoneIOErrorZ_free(uint64_t _res) {
23061         if (!ptr_is_owned(_res)) return;
23062         void* _res_ptr = untag_ptr(_res);
23063         CHECK_ACCESS(_res_ptr);
23064         LDKCResult_NoneIOErrorZ _res_conv = *(LDKCResult_NoneIOErrorZ*)(_res_ptr);
23065         FREE(untag_ptr(_res));
23066         CResult_NoneIOErrorZ_free(_res_conv);
23067 }
23068
23069 static inline uint64_t CResult_NoneIOErrorZ_clone_ptr(LDKCResult_NoneIOErrorZ *NONNULL_PTR arg) {
23070         LDKCResult_NoneIOErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneIOErrorZ), "LDKCResult_NoneIOErrorZ");
23071         *ret_conv = CResult_NoneIOErrorZ_clone(arg);
23072         return tag_ptr(ret_conv, true);
23073 }
23074 int64_t  __attribute__((export_name("TS_CResult_NoneIOErrorZ_clone_ptr"))) TS_CResult_NoneIOErrorZ_clone_ptr(uint64_t arg) {
23075         LDKCResult_NoneIOErrorZ* arg_conv = (LDKCResult_NoneIOErrorZ*)untag_ptr(arg);
23076         int64_t ret_conv = CResult_NoneIOErrorZ_clone_ptr(arg_conv);
23077         return ret_conv;
23078 }
23079
23080 uint64_t  __attribute__((export_name("TS_CResult_NoneIOErrorZ_clone"))) TS_CResult_NoneIOErrorZ_clone(uint64_t orig) {
23081         LDKCResult_NoneIOErrorZ* orig_conv = (LDKCResult_NoneIOErrorZ*)untag_ptr(orig);
23082         LDKCResult_NoneIOErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneIOErrorZ), "LDKCResult_NoneIOErrorZ");
23083         *ret_conv = CResult_NoneIOErrorZ_clone(orig_conv);
23084         return tag_ptr(ret_conv, true);
23085 }
23086
23087 void  __attribute__((export_name("TS_CVec_StrZ_free"))) TS_CVec_StrZ_free(ptrArray _res) {
23088         LDKCVec_StrZ _res_constr;
23089         _res_constr.datalen = _res->arr_len;
23090         if (_res_constr.datalen > 0)
23091                 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKStr), "LDKCVec_StrZ Elements");
23092         else
23093                 _res_constr.data = NULL;
23094         jstring* _res_vals = (void*) _res->elems;
23095         for (size_t i = 0; i < _res_constr.datalen; i++) {
23096                 jstring _res_conv_8 = _res_vals[i];
23097                 LDKStr dummy = { .chars = NULL, .len = 0, .chars_is_owned = false };
23098                 _res_constr.data[i] = dummy;
23099         }
23100         FREE(_res);
23101         CVec_StrZ_free(_res_constr);
23102 }
23103
23104 uint64_t  __attribute__((export_name("TS_CResult_CVec_StrZIOErrorZ_ok"))) TS_CResult_CVec_StrZIOErrorZ_ok(ptrArray o) {
23105         LDKCVec_StrZ o_constr;
23106         o_constr.datalen = o->arr_len;
23107         if (o_constr.datalen > 0)
23108                 o_constr.data = MALLOC(o_constr.datalen * sizeof(LDKStr), "LDKCVec_StrZ Elements");
23109         else
23110                 o_constr.data = NULL;
23111         jstring* o_vals = (void*) o->elems;
23112         for (size_t i = 0; i < o_constr.datalen; i++) {
23113                 jstring o_conv_8 = o_vals[i];
23114                 LDKStr o_conv_8_conv = str_ref_to_owned_c(o_conv_8);
23115                 o_constr.data[i] = o_conv_8_conv;
23116         }
23117         FREE(o);
23118         LDKCResult_CVec_StrZIOErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_StrZIOErrorZ), "LDKCResult_CVec_StrZIOErrorZ");
23119         *ret_conv = CResult_CVec_StrZIOErrorZ_ok(o_constr);
23120         return tag_ptr(ret_conv, true);
23121 }
23122
23123 uint64_t  __attribute__((export_name("TS_CResult_CVec_StrZIOErrorZ_err"))) TS_CResult_CVec_StrZIOErrorZ_err(uint32_t e) {
23124         LDKIOError e_conv = LDKIOError_from_js(e);
23125         LDKCResult_CVec_StrZIOErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_StrZIOErrorZ), "LDKCResult_CVec_StrZIOErrorZ");
23126         *ret_conv = CResult_CVec_StrZIOErrorZ_err(e_conv);
23127         return tag_ptr(ret_conv, true);
23128 }
23129
23130 jboolean  __attribute__((export_name("TS_CResult_CVec_StrZIOErrorZ_is_ok"))) TS_CResult_CVec_StrZIOErrorZ_is_ok(uint64_t o) {
23131         LDKCResult_CVec_StrZIOErrorZ* o_conv = (LDKCResult_CVec_StrZIOErrorZ*)untag_ptr(o);
23132         jboolean ret_conv = CResult_CVec_StrZIOErrorZ_is_ok(o_conv);
23133         return ret_conv;
23134 }
23135
23136 void  __attribute__((export_name("TS_CResult_CVec_StrZIOErrorZ_free"))) TS_CResult_CVec_StrZIOErrorZ_free(uint64_t _res) {
23137         if (!ptr_is_owned(_res)) return;
23138         void* _res_ptr = untag_ptr(_res);
23139         CHECK_ACCESS(_res_ptr);
23140         LDKCResult_CVec_StrZIOErrorZ _res_conv = *(LDKCResult_CVec_StrZIOErrorZ*)(_res_ptr);
23141         FREE(untag_ptr(_res));
23142         CResult_CVec_StrZIOErrorZ_free(_res_conv);
23143 }
23144
23145 static inline uint64_t CResult_CVec_StrZIOErrorZ_clone_ptr(LDKCResult_CVec_StrZIOErrorZ *NONNULL_PTR arg) {
23146         LDKCResult_CVec_StrZIOErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_StrZIOErrorZ), "LDKCResult_CVec_StrZIOErrorZ");
23147         *ret_conv = CResult_CVec_StrZIOErrorZ_clone(arg);
23148         return tag_ptr(ret_conv, true);
23149 }
23150 int64_t  __attribute__((export_name("TS_CResult_CVec_StrZIOErrorZ_clone_ptr"))) TS_CResult_CVec_StrZIOErrorZ_clone_ptr(uint64_t arg) {
23151         LDKCResult_CVec_StrZIOErrorZ* arg_conv = (LDKCResult_CVec_StrZIOErrorZ*)untag_ptr(arg);
23152         int64_t ret_conv = CResult_CVec_StrZIOErrorZ_clone_ptr(arg_conv);
23153         return ret_conv;
23154 }
23155
23156 uint64_t  __attribute__((export_name("TS_CResult_CVec_StrZIOErrorZ_clone"))) TS_CResult_CVec_StrZIOErrorZ_clone(uint64_t orig) {
23157         LDKCResult_CVec_StrZIOErrorZ* orig_conv = (LDKCResult_CVec_StrZIOErrorZ*)untag_ptr(orig);
23158         LDKCResult_CVec_StrZIOErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_StrZIOErrorZ), "LDKCResult_CVec_StrZIOErrorZ");
23159         *ret_conv = CResult_CVec_StrZIOErrorZ_clone(orig_conv);
23160         return tag_ptr(ret_conv, true);
23161 }
23162
23163 void  __attribute__((export_name("TS_CVec_C2Tuple_ThirtyTwoBytesChannelMonitorZZ_free"))) TS_CVec_C2Tuple_ThirtyTwoBytesChannelMonitorZZ_free(uint64_tArray _res) {
23164         LDKCVec_C2Tuple_ThirtyTwoBytesChannelMonitorZZ _res_constr;
23165         _res_constr.datalen = _res->arr_len;
23166         if (_res_constr.datalen > 0)
23167                 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKC2Tuple_ThirtyTwoBytesChannelMonitorZ), "LDKCVec_C2Tuple_ThirtyTwoBytesChannelMonitorZZ Elements");
23168         else
23169                 _res_constr.data = NULL;
23170         uint64_t* _res_vals = _res->elems;
23171         for (size_t o = 0; o < _res_constr.datalen; o++) {
23172                 uint64_t _res_conv_40 = _res_vals[o];
23173                 void* _res_conv_40_ptr = untag_ptr(_res_conv_40);
23174                 CHECK_ACCESS(_res_conv_40_ptr);
23175                 LDKC2Tuple_ThirtyTwoBytesChannelMonitorZ _res_conv_40_conv = *(LDKC2Tuple_ThirtyTwoBytesChannelMonitorZ*)(_res_conv_40_ptr);
23176                 FREE(untag_ptr(_res_conv_40));
23177                 _res_constr.data[o] = _res_conv_40_conv;
23178         }
23179         FREE(_res);
23180         CVec_C2Tuple_ThirtyTwoBytesChannelMonitorZZ_free(_res_constr);
23181 }
23182
23183 uint64_t  __attribute__((export_name("TS_CResult_CVec_C2Tuple_ThirtyTwoBytesChannelMonitorZZIOErrorZ_ok"))) TS_CResult_CVec_C2Tuple_ThirtyTwoBytesChannelMonitorZZIOErrorZ_ok(uint64_tArray o) {
23184         LDKCVec_C2Tuple_ThirtyTwoBytesChannelMonitorZZ o_constr;
23185         o_constr.datalen = o->arr_len;
23186         if (o_constr.datalen > 0)
23187                 o_constr.data = MALLOC(o_constr.datalen * sizeof(LDKC2Tuple_ThirtyTwoBytesChannelMonitorZ), "LDKCVec_C2Tuple_ThirtyTwoBytesChannelMonitorZZ Elements");
23188         else
23189                 o_constr.data = NULL;
23190         uint64_t* o_vals = o->elems;
23191         for (size_t o = 0; o < o_constr.datalen; o++) {
23192                 uint64_t o_conv_40 = o_vals[o];
23193                 void* o_conv_40_ptr = untag_ptr(o_conv_40);
23194                 CHECK_ACCESS(o_conv_40_ptr);
23195                 LDKC2Tuple_ThirtyTwoBytesChannelMonitorZ o_conv_40_conv = *(LDKC2Tuple_ThirtyTwoBytesChannelMonitorZ*)(o_conv_40_ptr);
23196                 o_conv_40_conv = C2Tuple_ThirtyTwoBytesChannelMonitorZ_clone((LDKC2Tuple_ThirtyTwoBytesChannelMonitorZ*)untag_ptr(o_conv_40));
23197                 o_constr.data[o] = o_conv_40_conv;
23198         }
23199         FREE(o);
23200         LDKCResult_CVec_C2Tuple_ThirtyTwoBytesChannelMonitorZZIOErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_C2Tuple_ThirtyTwoBytesChannelMonitorZZIOErrorZ), "LDKCResult_CVec_C2Tuple_ThirtyTwoBytesChannelMonitorZZIOErrorZ");
23201         *ret_conv = CResult_CVec_C2Tuple_ThirtyTwoBytesChannelMonitorZZIOErrorZ_ok(o_constr);
23202         return tag_ptr(ret_conv, true);
23203 }
23204
23205 uint64_t  __attribute__((export_name("TS_CResult_CVec_C2Tuple_ThirtyTwoBytesChannelMonitorZZIOErrorZ_err"))) TS_CResult_CVec_C2Tuple_ThirtyTwoBytesChannelMonitorZZIOErrorZ_err(uint32_t e) {
23206         LDKIOError e_conv = LDKIOError_from_js(e);
23207         LDKCResult_CVec_C2Tuple_ThirtyTwoBytesChannelMonitorZZIOErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_C2Tuple_ThirtyTwoBytesChannelMonitorZZIOErrorZ), "LDKCResult_CVec_C2Tuple_ThirtyTwoBytesChannelMonitorZZIOErrorZ");
23208         *ret_conv = CResult_CVec_C2Tuple_ThirtyTwoBytesChannelMonitorZZIOErrorZ_err(e_conv);
23209         return tag_ptr(ret_conv, true);
23210 }
23211
23212 jboolean  __attribute__((export_name("TS_CResult_CVec_C2Tuple_ThirtyTwoBytesChannelMonitorZZIOErrorZ_is_ok"))) TS_CResult_CVec_C2Tuple_ThirtyTwoBytesChannelMonitorZZIOErrorZ_is_ok(uint64_t o) {
23213         LDKCResult_CVec_C2Tuple_ThirtyTwoBytesChannelMonitorZZIOErrorZ* o_conv = (LDKCResult_CVec_C2Tuple_ThirtyTwoBytesChannelMonitorZZIOErrorZ*)untag_ptr(o);
23214         jboolean ret_conv = CResult_CVec_C2Tuple_ThirtyTwoBytesChannelMonitorZZIOErrorZ_is_ok(o_conv);
23215         return ret_conv;
23216 }
23217
23218 void  __attribute__((export_name("TS_CResult_CVec_C2Tuple_ThirtyTwoBytesChannelMonitorZZIOErrorZ_free"))) TS_CResult_CVec_C2Tuple_ThirtyTwoBytesChannelMonitorZZIOErrorZ_free(uint64_t _res) {
23219         if (!ptr_is_owned(_res)) return;
23220         void* _res_ptr = untag_ptr(_res);
23221         CHECK_ACCESS(_res_ptr);
23222         LDKCResult_CVec_C2Tuple_ThirtyTwoBytesChannelMonitorZZIOErrorZ _res_conv = *(LDKCResult_CVec_C2Tuple_ThirtyTwoBytesChannelMonitorZZIOErrorZ*)(_res_ptr);
23223         FREE(untag_ptr(_res));
23224         CResult_CVec_C2Tuple_ThirtyTwoBytesChannelMonitorZZIOErrorZ_free(_res_conv);
23225 }
23226
23227 static inline uint64_t CResult_CVec_C2Tuple_ThirtyTwoBytesChannelMonitorZZIOErrorZ_clone_ptr(LDKCResult_CVec_C2Tuple_ThirtyTwoBytesChannelMonitorZZIOErrorZ *NONNULL_PTR arg) {
23228         LDKCResult_CVec_C2Tuple_ThirtyTwoBytesChannelMonitorZZIOErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_C2Tuple_ThirtyTwoBytesChannelMonitorZZIOErrorZ), "LDKCResult_CVec_C2Tuple_ThirtyTwoBytesChannelMonitorZZIOErrorZ");
23229         *ret_conv = CResult_CVec_C2Tuple_ThirtyTwoBytesChannelMonitorZZIOErrorZ_clone(arg);
23230         return tag_ptr(ret_conv, true);
23231 }
23232 int64_t  __attribute__((export_name("TS_CResult_CVec_C2Tuple_ThirtyTwoBytesChannelMonitorZZIOErrorZ_clone_ptr"))) TS_CResult_CVec_C2Tuple_ThirtyTwoBytesChannelMonitorZZIOErrorZ_clone_ptr(uint64_t arg) {
23233         LDKCResult_CVec_C2Tuple_ThirtyTwoBytesChannelMonitorZZIOErrorZ* arg_conv = (LDKCResult_CVec_C2Tuple_ThirtyTwoBytesChannelMonitorZZIOErrorZ*)untag_ptr(arg);
23234         int64_t ret_conv = CResult_CVec_C2Tuple_ThirtyTwoBytesChannelMonitorZZIOErrorZ_clone_ptr(arg_conv);
23235         return ret_conv;
23236 }
23237
23238 uint64_t  __attribute__((export_name("TS_CResult_CVec_C2Tuple_ThirtyTwoBytesChannelMonitorZZIOErrorZ_clone"))) TS_CResult_CVec_C2Tuple_ThirtyTwoBytesChannelMonitorZZIOErrorZ_clone(uint64_t orig) {
23239         LDKCResult_CVec_C2Tuple_ThirtyTwoBytesChannelMonitorZZIOErrorZ* orig_conv = (LDKCResult_CVec_C2Tuple_ThirtyTwoBytesChannelMonitorZZIOErrorZ*)untag_ptr(orig);
23240         LDKCResult_CVec_C2Tuple_ThirtyTwoBytesChannelMonitorZZIOErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_C2Tuple_ThirtyTwoBytesChannelMonitorZZIOErrorZ), "LDKCResult_CVec_C2Tuple_ThirtyTwoBytesChannelMonitorZZIOErrorZ");
23241         *ret_conv = CResult_CVec_C2Tuple_ThirtyTwoBytesChannelMonitorZZIOErrorZ_clone(orig_conv);
23242         return tag_ptr(ret_conv, true);
23243 }
23244
23245 uint64_t  __attribute__((export_name("TS_CResult_C2Tuple_ThirtyTwoBytesChannelMonitorZIOErrorZ_ok"))) TS_CResult_C2Tuple_ThirtyTwoBytesChannelMonitorZIOErrorZ_ok(uint64_t o) {
23246         void* o_ptr = untag_ptr(o);
23247         CHECK_ACCESS(o_ptr);
23248         LDKC2Tuple_ThirtyTwoBytesChannelMonitorZ o_conv = *(LDKC2Tuple_ThirtyTwoBytesChannelMonitorZ*)(o_ptr);
23249         o_conv = C2Tuple_ThirtyTwoBytesChannelMonitorZ_clone((LDKC2Tuple_ThirtyTwoBytesChannelMonitorZ*)untag_ptr(o));
23250         LDKCResult_C2Tuple_ThirtyTwoBytesChannelMonitorZIOErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_ThirtyTwoBytesChannelMonitorZIOErrorZ), "LDKCResult_C2Tuple_ThirtyTwoBytesChannelMonitorZIOErrorZ");
23251         *ret_conv = CResult_C2Tuple_ThirtyTwoBytesChannelMonitorZIOErrorZ_ok(o_conv);
23252         return tag_ptr(ret_conv, true);
23253 }
23254
23255 uint64_t  __attribute__((export_name("TS_CResult_C2Tuple_ThirtyTwoBytesChannelMonitorZIOErrorZ_err"))) TS_CResult_C2Tuple_ThirtyTwoBytesChannelMonitorZIOErrorZ_err(uint32_t e) {
23256         LDKIOError e_conv = LDKIOError_from_js(e);
23257         LDKCResult_C2Tuple_ThirtyTwoBytesChannelMonitorZIOErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_ThirtyTwoBytesChannelMonitorZIOErrorZ), "LDKCResult_C2Tuple_ThirtyTwoBytesChannelMonitorZIOErrorZ");
23258         *ret_conv = CResult_C2Tuple_ThirtyTwoBytesChannelMonitorZIOErrorZ_err(e_conv);
23259         return tag_ptr(ret_conv, true);
23260 }
23261
23262 jboolean  __attribute__((export_name("TS_CResult_C2Tuple_ThirtyTwoBytesChannelMonitorZIOErrorZ_is_ok"))) TS_CResult_C2Tuple_ThirtyTwoBytesChannelMonitorZIOErrorZ_is_ok(uint64_t o) {
23263         LDKCResult_C2Tuple_ThirtyTwoBytesChannelMonitorZIOErrorZ* o_conv = (LDKCResult_C2Tuple_ThirtyTwoBytesChannelMonitorZIOErrorZ*)untag_ptr(o);
23264         jboolean ret_conv = CResult_C2Tuple_ThirtyTwoBytesChannelMonitorZIOErrorZ_is_ok(o_conv);
23265         return ret_conv;
23266 }
23267
23268 void  __attribute__((export_name("TS_CResult_C2Tuple_ThirtyTwoBytesChannelMonitorZIOErrorZ_free"))) TS_CResult_C2Tuple_ThirtyTwoBytesChannelMonitorZIOErrorZ_free(uint64_t _res) {
23269         if (!ptr_is_owned(_res)) return;
23270         void* _res_ptr = untag_ptr(_res);
23271         CHECK_ACCESS(_res_ptr);
23272         LDKCResult_C2Tuple_ThirtyTwoBytesChannelMonitorZIOErrorZ _res_conv = *(LDKCResult_C2Tuple_ThirtyTwoBytesChannelMonitorZIOErrorZ*)(_res_ptr);
23273         FREE(untag_ptr(_res));
23274         CResult_C2Tuple_ThirtyTwoBytesChannelMonitorZIOErrorZ_free(_res_conv);
23275 }
23276
23277 static inline uint64_t CResult_C2Tuple_ThirtyTwoBytesChannelMonitorZIOErrorZ_clone_ptr(LDKCResult_C2Tuple_ThirtyTwoBytesChannelMonitorZIOErrorZ *NONNULL_PTR arg) {
23278         LDKCResult_C2Tuple_ThirtyTwoBytesChannelMonitorZIOErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_ThirtyTwoBytesChannelMonitorZIOErrorZ), "LDKCResult_C2Tuple_ThirtyTwoBytesChannelMonitorZIOErrorZ");
23279         *ret_conv = CResult_C2Tuple_ThirtyTwoBytesChannelMonitorZIOErrorZ_clone(arg);
23280         return tag_ptr(ret_conv, true);
23281 }
23282 int64_t  __attribute__((export_name("TS_CResult_C2Tuple_ThirtyTwoBytesChannelMonitorZIOErrorZ_clone_ptr"))) TS_CResult_C2Tuple_ThirtyTwoBytesChannelMonitorZIOErrorZ_clone_ptr(uint64_t arg) {
23283         LDKCResult_C2Tuple_ThirtyTwoBytesChannelMonitorZIOErrorZ* arg_conv = (LDKCResult_C2Tuple_ThirtyTwoBytesChannelMonitorZIOErrorZ*)untag_ptr(arg);
23284         int64_t ret_conv = CResult_C2Tuple_ThirtyTwoBytesChannelMonitorZIOErrorZ_clone_ptr(arg_conv);
23285         return ret_conv;
23286 }
23287
23288 uint64_t  __attribute__((export_name("TS_CResult_C2Tuple_ThirtyTwoBytesChannelMonitorZIOErrorZ_clone"))) TS_CResult_C2Tuple_ThirtyTwoBytesChannelMonitorZIOErrorZ_clone(uint64_t orig) {
23289         LDKCResult_C2Tuple_ThirtyTwoBytesChannelMonitorZIOErrorZ* orig_conv = (LDKCResult_C2Tuple_ThirtyTwoBytesChannelMonitorZIOErrorZ*)untag_ptr(orig);
23290         LDKCResult_C2Tuple_ThirtyTwoBytesChannelMonitorZIOErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_ThirtyTwoBytesChannelMonitorZIOErrorZ), "LDKCResult_C2Tuple_ThirtyTwoBytesChannelMonitorZIOErrorZ");
23291         *ret_conv = CResult_C2Tuple_ThirtyTwoBytesChannelMonitorZIOErrorZ_clone(orig_conv);
23292         return tag_ptr(ret_conv, true);
23293 }
23294
23295 uint64_t  __attribute__((export_name("TS_COption_SecretKeyZ_some"))) TS_COption_SecretKeyZ_some(int8_tArray o) {
23296         LDKSecretKey o_ref;
23297         CHECK(o->arr_len == 32);
23298         memcpy(o_ref.bytes, o->elems, 32); FREE(o);
23299         LDKCOption_SecretKeyZ *ret_copy = MALLOC(sizeof(LDKCOption_SecretKeyZ), "LDKCOption_SecretKeyZ");
23300         *ret_copy = COption_SecretKeyZ_some(o_ref);
23301         uint64_t ret_ref = tag_ptr(ret_copy, true);
23302         return ret_ref;
23303 }
23304
23305 uint64_t  __attribute__((export_name("TS_COption_SecretKeyZ_none"))) TS_COption_SecretKeyZ_none() {
23306         LDKCOption_SecretKeyZ *ret_copy = MALLOC(sizeof(LDKCOption_SecretKeyZ), "LDKCOption_SecretKeyZ");
23307         *ret_copy = COption_SecretKeyZ_none();
23308         uint64_t ret_ref = tag_ptr(ret_copy, true);
23309         return ret_ref;
23310 }
23311
23312 void  __attribute__((export_name("TS_COption_SecretKeyZ_free"))) TS_COption_SecretKeyZ_free(uint64_t _res) {
23313         if (!ptr_is_owned(_res)) return;
23314         void* _res_ptr = untag_ptr(_res);
23315         CHECK_ACCESS(_res_ptr);
23316         LDKCOption_SecretKeyZ _res_conv = *(LDKCOption_SecretKeyZ*)(_res_ptr);
23317         FREE(untag_ptr(_res));
23318         COption_SecretKeyZ_free(_res_conv);
23319 }
23320
23321 static inline uint64_t COption_SecretKeyZ_clone_ptr(LDKCOption_SecretKeyZ *NONNULL_PTR arg) {
23322         LDKCOption_SecretKeyZ *ret_copy = MALLOC(sizeof(LDKCOption_SecretKeyZ), "LDKCOption_SecretKeyZ");
23323         *ret_copy = COption_SecretKeyZ_clone(arg);
23324         uint64_t ret_ref = tag_ptr(ret_copy, true);
23325         return ret_ref;
23326 }
23327 int64_t  __attribute__((export_name("TS_COption_SecretKeyZ_clone_ptr"))) TS_COption_SecretKeyZ_clone_ptr(uint64_t arg) {
23328         LDKCOption_SecretKeyZ* arg_conv = (LDKCOption_SecretKeyZ*)untag_ptr(arg);
23329         int64_t ret_conv = COption_SecretKeyZ_clone_ptr(arg_conv);
23330         return ret_conv;
23331 }
23332
23333 uint64_t  __attribute__((export_name("TS_COption_SecretKeyZ_clone"))) TS_COption_SecretKeyZ_clone(uint64_t orig) {
23334         LDKCOption_SecretKeyZ* orig_conv = (LDKCOption_SecretKeyZ*)untag_ptr(orig);
23335         LDKCOption_SecretKeyZ *ret_copy = MALLOC(sizeof(LDKCOption_SecretKeyZ), "LDKCOption_SecretKeyZ");
23336         *ret_copy = COption_SecretKeyZ_clone(orig_conv);
23337         uint64_t ret_ref = tag_ptr(ret_copy, true);
23338         return ret_ref;
23339 }
23340
23341 uint64_t  __attribute__((export_name("TS_CResult_VerifiedInvoiceRequestNoneZ_ok"))) TS_CResult_VerifiedInvoiceRequestNoneZ_ok(uint64_t o) {
23342         LDKVerifiedInvoiceRequest o_conv;
23343         o_conv.inner = untag_ptr(o);
23344         o_conv.is_owned = ptr_is_owned(o);
23345         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
23346         o_conv = VerifiedInvoiceRequest_clone(&o_conv);
23347         LDKCResult_VerifiedInvoiceRequestNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_VerifiedInvoiceRequestNoneZ), "LDKCResult_VerifiedInvoiceRequestNoneZ");
23348         *ret_conv = CResult_VerifiedInvoiceRequestNoneZ_ok(o_conv);
23349         return tag_ptr(ret_conv, true);
23350 }
23351
23352 uint64_t  __attribute__((export_name("TS_CResult_VerifiedInvoiceRequestNoneZ_err"))) TS_CResult_VerifiedInvoiceRequestNoneZ_err() {
23353         LDKCResult_VerifiedInvoiceRequestNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_VerifiedInvoiceRequestNoneZ), "LDKCResult_VerifiedInvoiceRequestNoneZ");
23354         *ret_conv = CResult_VerifiedInvoiceRequestNoneZ_err();
23355         return tag_ptr(ret_conv, true);
23356 }
23357
23358 jboolean  __attribute__((export_name("TS_CResult_VerifiedInvoiceRequestNoneZ_is_ok"))) TS_CResult_VerifiedInvoiceRequestNoneZ_is_ok(uint64_t o) {
23359         LDKCResult_VerifiedInvoiceRequestNoneZ* o_conv = (LDKCResult_VerifiedInvoiceRequestNoneZ*)untag_ptr(o);
23360         jboolean ret_conv = CResult_VerifiedInvoiceRequestNoneZ_is_ok(o_conv);
23361         return ret_conv;
23362 }
23363
23364 void  __attribute__((export_name("TS_CResult_VerifiedInvoiceRequestNoneZ_free"))) TS_CResult_VerifiedInvoiceRequestNoneZ_free(uint64_t _res) {
23365         if (!ptr_is_owned(_res)) return;
23366         void* _res_ptr = untag_ptr(_res);
23367         CHECK_ACCESS(_res_ptr);
23368         LDKCResult_VerifiedInvoiceRequestNoneZ _res_conv = *(LDKCResult_VerifiedInvoiceRequestNoneZ*)(_res_ptr);
23369         FREE(untag_ptr(_res));
23370         CResult_VerifiedInvoiceRequestNoneZ_free(_res_conv);
23371 }
23372
23373 static inline uint64_t CResult_VerifiedInvoiceRequestNoneZ_clone_ptr(LDKCResult_VerifiedInvoiceRequestNoneZ *NONNULL_PTR arg) {
23374         LDKCResult_VerifiedInvoiceRequestNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_VerifiedInvoiceRequestNoneZ), "LDKCResult_VerifiedInvoiceRequestNoneZ");
23375         *ret_conv = CResult_VerifiedInvoiceRequestNoneZ_clone(arg);
23376         return tag_ptr(ret_conv, true);
23377 }
23378 int64_t  __attribute__((export_name("TS_CResult_VerifiedInvoiceRequestNoneZ_clone_ptr"))) TS_CResult_VerifiedInvoiceRequestNoneZ_clone_ptr(uint64_t arg) {
23379         LDKCResult_VerifiedInvoiceRequestNoneZ* arg_conv = (LDKCResult_VerifiedInvoiceRequestNoneZ*)untag_ptr(arg);
23380         int64_t ret_conv = CResult_VerifiedInvoiceRequestNoneZ_clone_ptr(arg_conv);
23381         return ret_conv;
23382 }
23383
23384 uint64_t  __attribute__((export_name("TS_CResult_VerifiedInvoiceRequestNoneZ_clone"))) TS_CResult_VerifiedInvoiceRequestNoneZ_clone(uint64_t orig) {
23385         LDKCResult_VerifiedInvoiceRequestNoneZ* orig_conv = (LDKCResult_VerifiedInvoiceRequestNoneZ*)untag_ptr(orig);
23386         LDKCResult_VerifiedInvoiceRequestNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_VerifiedInvoiceRequestNoneZ), "LDKCResult_VerifiedInvoiceRequestNoneZ");
23387         *ret_conv = CResult_VerifiedInvoiceRequestNoneZ_clone(orig_conv);
23388         return tag_ptr(ret_conv, true);
23389 }
23390
23391 uint32_t  __attribute__((export_name("TS_COption_NoneZ_some"))) TS_COption_NoneZ_some() {
23392         uint32_t ret_conv = LDKCOption_NoneZ_to_js(COption_NoneZ_some());
23393         return ret_conv;
23394 }
23395
23396 uint32_t  __attribute__((export_name("TS_COption_NoneZ_none"))) TS_COption_NoneZ_none() {
23397         uint32_t ret_conv = LDKCOption_NoneZ_to_js(COption_NoneZ_none());
23398         return ret_conv;
23399 }
23400
23401 void  __attribute__((export_name("TS_COption_NoneZ_free"))) TS_COption_NoneZ_free(uint32_t _res) {
23402         LDKCOption_NoneZ _res_conv = LDKCOption_NoneZ_from_js(_res);
23403         COption_NoneZ_free(_res_conv);
23404 }
23405
23406 void  __attribute__((export_name("TS_CVec_WitnessZ_free"))) TS_CVec_WitnessZ_free(ptrArray _res) {
23407         LDKCVec_WitnessZ _res_constr;
23408         _res_constr.datalen = _res->arr_len;
23409         if (_res_constr.datalen > 0)
23410                 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKWitness), "LDKCVec_WitnessZ Elements");
23411         else
23412                 _res_constr.data = NULL;
23413         int8_tArray* _res_vals = (void*) _res->elems;
23414         for (size_t m = 0; m < _res_constr.datalen; m++) {
23415                 int8_tArray _res_conv_12 = _res_vals[m];
23416                 LDKWitness _res_conv_12_ref;
23417                 _res_conv_12_ref.datalen = _res_conv_12->arr_len;
23418                 _res_conv_12_ref.data = MALLOC(_res_conv_12_ref.datalen, "LDKWitness Bytes");
23419                 memcpy(_res_conv_12_ref.data, _res_conv_12->elems, _res_conv_12_ref.datalen); FREE(_res_conv_12);
23420                 _res_conv_12_ref.data_is_owned = true;
23421                 _res_constr.data[m] = _res_conv_12_ref;
23422         }
23423         FREE(_res);
23424         CVec_WitnessZ_free(_res_constr);
23425 }
23426
23427 uint64_t  __attribute__((export_name("TS_COption_i64Z_some"))) TS_COption_i64Z_some(int64_t o) {
23428         LDKCOption_i64Z *ret_copy = MALLOC(sizeof(LDKCOption_i64Z), "LDKCOption_i64Z");
23429         *ret_copy = COption_i64Z_some(o);
23430         uint64_t ret_ref = tag_ptr(ret_copy, true);
23431         return ret_ref;
23432 }
23433
23434 uint64_t  __attribute__((export_name("TS_COption_i64Z_none"))) TS_COption_i64Z_none() {
23435         LDKCOption_i64Z *ret_copy = MALLOC(sizeof(LDKCOption_i64Z), "LDKCOption_i64Z");
23436         *ret_copy = COption_i64Z_none();
23437         uint64_t ret_ref = tag_ptr(ret_copy, true);
23438         return ret_ref;
23439 }
23440
23441 void  __attribute__((export_name("TS_COption_i64Z_free"))) TS_COption_i64Z_free(uint64_t _res) {
23442         if (!ptr_is_owned(_res)) return;
23443         void* _res_ptr = untag_ptr(_res);
23444         CHECK_ACCESS(_res_ptr);
23445         LDKCOption_i64Z _res_conv = *(LDKCOption_i64Z*)(_res_ptr);
23446         FREE(untag_ptr(_res));
23447         COption_i64Z_free(_res_conv);
23448 }
23449
23450 static inline uint64_t COption_i64Z_clone_ptr(LDKCOption_i64Z *NONNULL_PTR arg) {
23451         LDKCOption_i64Z *ret_copy = MALLOC(sizeof(LDKCOption_i64Z), "LDKCOption_i64Z");
23452         *ret_copy = COption_i64Z_clone(arg);
23453         uint64_t ret_ref = tag_ptr(ret_copy, true);
23454         return ret_ref;
23455 }
23456 int64_t  __attribute__((export_name("TS_COption_i64Z_clone_ptr"))) TS_COption_i64Z_clone_ptr(uint64_t arg) {
23457         LDKCOption_i64Z* arg_conv = (LDKCOption_i64Z*)untag_ptr(arg);
23458         int64_t ret_conv = COption_i64Z_clone_ptr(arg_conv);
23459         return ret_conv;
23460 }
23461
23462 uint64_t  __attribute__((export_name("TS_COption_i64Z_clone"))) TS_COption_i64Z_clone(uint64_t orig) {
23463         LDKCOption_i64Z* orig_conv = (LDKCOption_i64Z*)untag_ptr(orig);
23464         LDKCOption_i64Z *ret_copy = MALLOC(sizeof(LDKCOption_i64Z), "LDKCOption_i64Z");
23465         *ret_copy = COption_i64Z_clone(orig_conv);
23466         uint64_t ret_ref = tag_ptr(ret_copy, true);
23467         return ret_ref;
23468 }
23469
23470 uint64_t  __attribute__((export_name("TS_CResult_SocketAddressDecodeErrorZ_ok"))) TS_CResult_SocketAddressDecodeErrorZ_ok(uint64_t o) {
23471         void* o_ptr = untag_ptr(o);
23472         CHECK_ACCESS(o_ptr);
23473         LDKSocketAddress o_conv = *(LDKSocketAddress*)(o_ptr);
23474         o_conv = SocketAddress_clone((LDKSocketAddress*)untag_ptr(o));
23475         LDKCResult_SocketAddressDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_SocketAddressDecodeErrorZ), "LDKCResult_SocketAddressDecodeErrorZ");
23476         *ret_conv = CResult_SocketAddressDecodeErrorZ_ok(o_conv);
23477         return tag_ptr(ret_conv, true);
23478 }
23479
23480 uint64_t  __attribute__((export_name("TS_CResult_SocketAddressDecodeErrorZ_err"))) TS_CResult_SocketAddressDecodeErrorZ_err(uint64_t e) {
23481         void* e_ptr = untag_ptr(e);
23482         CHECK_ACCESS(e_ptr);
23483         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
23484         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
23485         LDKCResult_SocketAddressDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_SocketAddressDecodeErrorZ), "LDKCResult_SocketAddressDecodeErrorZ");
23486         *ret_conv = CResult_SocketAddressDecodeErrorZ_err(e_conv);
23487         return tag_ptr(ret_conv, true);
23488 }
23489
23490 jboolean  __attribute__((export_name("TS_CResult_SocketAddressDecodeErrorZ_is_ok"))) TS_CResult_SocketAddressDecodeErrorZ_is_ok(uint64_t o) {
23491         LDKCResult_SocketAddressDecodeErrorZ* o_conv = (LDKCResult_SocketAddressDecodeErrorZ*)untag_ptr(o);
23492         jboolean ret_conv = CResult_SocketAddressDecodeErrorZ_is_ok(o_conv);
23493         return ret_conv;
23494 }
23495
23496 void  __attribute__((export_name("TS_CResult_SocketAddressDecodeErrorZ_free"))) TS_CResult_SocketAddressDecodeErrorZ_free(uint64_t _res) {
23497         if (!ptr_is_owned(_res)) return;
23498         void* _res_ptr = untag_ptr(_res);
23499         CHECK_ACCESS(_res_ptr);
23500         LDKCResult_SocketAddressDecodeErrorZ _res_conv = *(LDKCResult_SocketAddressDecodeErrorZ*)(_res_ptr);
23501         FREE(untag_ptr(_res));
23502         CResult_SocketAddressDecodeErrorZ_free(_res_conv);
23503 }
23504
23505 static inline uint64_t CResult_SocketAddressDecodeErrorZ_clone_ptr(LDKCResult_SocketAddressDecodeErrorZ *NONNULL_PTR arg) {
23506         LDKCResult_SocketAddressDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_SocketAddressDecodeErrorZ), "LDKCResult_SocketAddressDecodeErrorZ");
23507         *ret_conv = CResult_SocketAddressDecodeErrorZ_clone(arg);
23508         return tag_ptr(ret_conv, true);
23509 }
23510 int64_t  __attribute__((export_name("TS_CResult_SocketAddressDecodeErrorZ_clone_ptr"))) TS_CResult_SocketAddressDecodeErrorZ_clone_ptr(uint64_t arg) {
23511         LDKCResult_SocketAddressDecodeErrorZ* arg_conv = (LDKCResult_SocketAddressDecodeErrorZ*)untag_ptr(arg);
23512         int64_t ret_conv = CResult_SocketAddressDecodeErrorZ_clone_ptr(arg_conv);
23513         return ret_conv;
23514 }
23515
23516 uint64_t  __attribute__((export_name("TS_CResult_SocketAddressDecodeErrorZ_clone"))) TS_CResult_SocketAddressDecodeErrorZ_clone(uint64_t orig) {
23517         LDKCResult_SocketAddressDecodeErrorZ* orig_conv = (LDKCResult_SocketAddressDecodeErrorZ*)untag_ptr(orig);
23518         LDKCResult_SocketAddressDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_SocketAddressDecodeErrorZ), "LDKCResult_SocketAddressDecodeErrorZ");
23519         *ret_conv = CResult_SocketAddressDecodeErrorZ_clone(orig_conv);
23520         return tag_ptr(ret_conv, true);
23521 }
23522
23523 uint64_t  __attribute__((export_name("TS_CResult_SocketAddressSocketAddressParseErrorZ_ok"))) TS_CResult_SocketAddressSocketAddressParseErrorZ_ok(uint64_t o) {
23524         void* o_ptr = untag_ptr(o);
23525         CHECK_ACCESS(o_ptr);
23526         LDKSocketAddress o_conv = *(LDKSocketAddress*)(o_ptr);
23527         o_conv = SocketAddress_clone((LDKSocketAddress*)untag_ptr(o));
23528         LDKCResult_SocketAddressSocketAddressParseErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_SocketAddressSocketAddressParseErrorZ), "LDKCResult_SocketAddressSocketAddressParseErrorZ");
23529         *ret_conv = CResult_SocketAddressSocketAddressParseErrorZ_ok(o_conv);
23530         return tag_ptr(ret_conv, true);
23531 }
23532
23533 uint64_t  __attribute__((export_name("TS_CResult_SocketAddressSocketAddressParseErrorZ_err"))) TS_CResult_SocketAddressSocketAddressParseErrorZ_err(uint32_t e) {
23534         LDKSocketAddressParseError e_conv = LDKSocketAddressParseError_from_js(e);
23535         LDKCResult_SocketAddressSocketAddressParseErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_SocketAddressSocketAddressParseErrorZ), "LDKCResult_SocketAddressSocketAddressParseErrorZ");
23536         *ret_conv = CResult_SocketAddressSocketAddressParseErrorZ_err(e_conv);
23537         return tag_ptr(ret_conv, true);
23538 }
23539
23540 jboolean  __attribute__((export_name("TS_CResult_SocketAddressSocketAddressParseErrorZ_is_ok"))) TS_CResult_SocketAddressSocketAddressParseErrorZ_is_ok(uint64_t o) {
23541         LDKCResult_SocketAddressSocketAddressParseErrorZ* o_conv = (LDKCResult_SocketAddressSocketAddressParseErrorZ*)untag_ptr(o);
23542         jboolean ret_conv = CResult_SocketAddressSocketAddressParseErrorZ_is_ok(o_conv);
23543         return ret_conv;
23544 }
23545
23546 void  __attribute__((export_name("TS_CResult_SocketAddressSocketAddressParseErrorZ_free"))) TS_CResult_SocketAddressSocketAddressParseErrorZ_free(uint64_t _res) {
23547         if (!ptr_is_owned(_res)) return;
23548         void* _res_ptr = untag_ptr(_res);
23549         CHECK_ACCESS(_res_ptr);
23550         LDKCResult_SocketAddressSocketAddressParseErrorZ _res_conv = *(LDKCResult_SocketAddressSocketAddressParseErrorZ*)(_res_ptr);
23551         FREE(untag_ptr(_res));
23552         CResult_SocketAddressSocketAddressParseErrorZ_free(_res_conv);
23553 }
23554
23555 static inline uint64_t CResult_SocketAddressSocketAddressParseErrorZ_clone_ptr(LDKCResult_SocketAddressSocketAddressParseErrorZ *NONNULL_PTR arg) {
23556         LDKCResult_SocketAddressSocketAddressParseErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_SocketAddressSocketAddressParseErrorZ), "LDKCResult_SocketAddressSocketAddressParseErrorZ");
23557         *ret_conv = CResult_SocketAddressSocketAddressParseErrorZ_clone(arg);
23558         return tag_ptr(ret_conv, true);
23559 }
23560 int64_t  __attribute__((export_name("TS_CResult_SocketAddressSocketAddressParseErrorZ_clone_ptr"))) TS_CResult_SocketAddressSocketAddressParseErrorZ_clone_ptr(uint64_t arg) {
23561         LDKCResult_SocketAddressSocketAddressParseErrorZ* arg_conv = (LDKCResult_SocketAddressSocketAddressParseErrorZ*)untag_ptr(arg);
23562         int64_t ret_conv = CResult_SocketAddressSocketAddressParseErrorZ_clone_ptr(arg_conv);
23563         return ret_conv;
23564 }
23565
23566 uint64_t  __attribute__((export_name("TS_CResult_SocketAddressSocketAddressParseErrorZ_clone"))) TS_CResult_SocketAddressSocketAddressParseErrorZ_clone(uint64_t orig) {
23567         LDKCResult_SocketAddressSocketAddressParseErrorZ* orig_conv = (LDKCResult_SocketAddressSocketAddressParseErrorZ*)untag_ptr(orig);
23568         LDKCResult_SocketAddressSocketAddressParseErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_SocketAddressSocketAddressParseErrorZ), "LDKCResult_SocketAddressSocketAddressParseErrorZ");
23569         *ret_conv = CResult_SocketAddressSocketAddressParseErrorZ_clone(orig_conv);
23570         return tag_ptr(ret_conv, true);
23571 }
23572
23573 void  __attribute__((export_name("TS_CVec_UpdateAddHTLCZ_free"))) TS_CVec_UpdateAddHTLCZ_free(uint64_tArray _res) {
23574         LDKCVec_UpdateAddHTLCZ _res_constr;
23575         _res_constr.datalen = _res->arr_len;
23576         if (_res_constr.datalen > 0)
23577                 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKUpdateAddHTLC), "LDKCVec_UpdateAddHTLCZ Elements");
23578         else
23579                 _res_constr.data = NULL;
23580         uint64_t* _res_vals = _res->elems;
23581         for (size_t p = 0; p < _res_constr.datalen; p++) {
23582                 uint64_t _res_conv_15 = _res_vals[p];
23583                 LDKUpdateAddHTLC _res_conv_15_conv;
23584                 _res_conv_15_conv.inner = untag_ptr(_res_conv_15);
23585                 _res_conv_15_conv.is_owned = ptr_is_owned(_res_conv_15);
23586                 CHECK_INNER_FIELD_ACCESS_OR_NULL(_res_conv_15_conv);
23587                 _res_constr.data[p] = _res_conv_15_conv;
23588         }
23589         FREE(_res);
23590         CVec_UpdateAddHTLCZ_free(_res_constr);
23591 }
23592
23593 void  __attribute__((export_name("TS_CVec_UpdateFulfillHTLCZ_free"))) TS_CVec_UpdateFulfillHTLCZ_free(uint64_tArray _res) {
23594         LDKCVec_UpdateFulfillHTLCZ _res_constr;
23595         _res_constr.datalen = _res->arr_len;
23596         if (_res_constr.datalen > 0)
23597                 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKUpdateFulfillHTLC), "LDKCVec_UpdateFulfillHTLCZ Elements");
23598         else
23599                 _res_constr.data = NULL;
23600         uint64_t* _res_vals = _res->elems;
23601         for (size_t t = 0; t < _res_constr.datalen; t++) {
23602                 uint64_t _res_conv_19 = _res_vals[t];
23603                 LDKUpdateFulfillHTLC _res_conv_19_conv;
23604                 _res_conv_19_conv.inner = untag_ptr(_res_conv_19);
23605                 _res_conv_19_conv.is_owned = ptr_is_owned(_res_conv_19);
23606                 CHECK_INNER_FIELD_ACCESS_OR_NULL(_res_conv_19_conv);
23607                 _res_constr.data[t] = _res_conv_19_conv;
23608         }
23609         FREE(_res);
23610         CVec_UpdateFulfillHTLCZ_free(_res_constr);
23611 }
23612
23613 void  __attribute__((export_name("TS_CVec_UpdateFailHTLCZ_free"))) TS_CVec_UpdateFailHTLCZ_free(uint64_tArray _res) {
23614         LDKCVec_UpdateFailHTLCZ _res_constr;
23615         _res_constr.datalen = _res->arr_len;
23616         if (_res_constr.datalen > 0)
23617                 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKUpdateFailHTLC), "LDKCVec_UpdateFailHTLCZ Elements");
23618         else
23619                 _res_constr.data = NULL;
23620         uint64_t* _res_vals = _res->elems;
23621         for (size_t q = 0; q < _res_constr.datalen; q++) {
23622                 uint64_t _res_conv_16 = _res_vals[q];
23623                 LDKUpdateFailHTLC _res_conv_16_conv;
23624                 _res_conv_16_conv.inner = untag_ptr(_res_conv_16);
23625                 _res_conv_16_conv.is_owned = ptr_is_owned(_res_conv_16);
23626                 CHECK_INNER_FIELD_ACCESS_OR_NULL(_res_conv_16_conv);
23627                 _res_constr.data[q] = _res_conv_16_conv;
23628         }
23629         FREE(_res);
23630         CVec_UpdateFailHTLCZ_free(_res_constr);
23631 }
23632
23633 void  __attribute__((export_name("TS_CVec_UpdateFailMalformedHTLCZ_free"))) TS_CVec_UpdateFailMalformedHTLCZ_free(uint64_tArray _res) {
23634         LDKCVec_UpdateFailMalformedHTLCZ _res_constr;
23635         _res_constr.datalen = _res->arr_len;
23636         if (_res_constr.datalen > 0)
23637                 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKUpdateFailMalformedHTLC), "LDKCVec_UpdateFailMalformedHTLCZ Elements");
23638         else
23639                 _res_constr.data = NULL;
23640         uint64_t* _res_vals = _res->elems;
23641         for (size_t z = 0; z < _res_constr.datalen; z++) {
23642                 uint64_t _res_conv_25 = _res_vals[z];
23643                 LDKUpdateFailMalformedHTLC _res_conv_25_conv;
23644                 _res_conv_25_conv.inner = untag_ptr(_res_conv_25);
23645                 _res_conv_25_conv.is_owned = ptr_is_owned(_res_conv_25);
23646                 CHECK_INNER_FIELD_ACCESS_OR_NULL(_res_conv_25_conv);
23647                 _res_constr.data[z] = _res_conv_25_conv;
23648         }
23649         FREE(_res);
23650         CVec_UpdateFailMalformedHTLCZ_free(_res_constr);
23651 }
23652
23653 uint64_t  __attribute__((export_name("TS_CResult_AcceptChannelDecodeErrorZ_ok"))) TS_CResult_AcceptChannelDecodeErrorZ_ok(uint64_t o) {
23654         LDKAcceptChannel o_conv;
23655         o_conv.inner = untag_ptr(o);
23656         o_conv.is_owned = ptr_is_owned(o);
23657         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
23658         o_conv = AcceptChannel_clone(&o_conv);
23659         LDKCResult_AcceptChannelDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_AcceptChannelDecodeErrorZ), "LDKCResult_AcceptChannelDecodeErrorZ");
23660         *ret_conv = CResult_AcceptChannelDecodeErrorZ_ok(o_conv);
23661         return tag_ptr(ret_conv, true);
23662 }
23663
23664 uint64_t  __attribute__((export_name("TS_CResult_AcceptChannelDecodeErrorZ_err"))) TS_CResult_AcceptChannelDecodeErrorZ_err(uint64_t e) {
23665         void* e_ptr = untag_ptr(e);
23666         CHECK_ACCESS(e_ptr);
23667         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
23668         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
23669         LDKCResult_AcceptChannelDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_AcceptChannelDecodeErrorZ), "LDKCResult_AcceptChannelDecodeErrorZ");
23670         *ret_conv = CResult_AcceptChannelDecodeErrorZ_err(e_conv);
23671         return tag_ptr(ret_conv, true);
23672 }
23673
23674 jboolean  __attribute__((export_name("TS_CResult_AcceptChannelDecodeErrorZ_is_ok"))) TS_CResult_AcceptChannelDecodeErrorZ_is_ok(uint64_t o) {
23675         LDKCResult_AcceptChannelDecodeErrorZ* o_conv = (LDKCResult_AcceptChannelDecodeErrorZ*)untag_ptr(o);
23676         jboolean ret_conv = CResult_AcceptChannelDecodeErrorZ_is_ok(o_conv);
23677         return ret_conv;
23678 }
23679
23680 void  __attribute__((export_name("TS_CResult_AcceptChannelDecodeErrorZ_free"))) TS_CResult_AcceptChannelDecodeErrorZ_free(uint64_t _res) {
23681         if (!ptr_is_owned(_res)) return;
23682         void* _res_ptr = untag_ptr(_res);
23683         CHECK_ACCESS(_res_ptr);
23684         LDKCResult_AcceptChannelDecodeErrorZ _res_conv = *(LDKCResult_AcceptChannelDecodeErrorZ*)(_res_ptr);
23685         FREE(untag_ptr(_res));
23686         CResult_AcceptChannelDecodeErrorZ_free(_res_conv);
23687 }
23688
23689 static inline uint64_t CResult_AcceptChannelDecodeErrorZ_clone_ptr(LDKCResult_AcceptChannelDecodeErrorZ *NONNULL_PTR arg) {
23690         LDKCResult_AcceptChannelDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_AcceptChannelDecodeErrorZ), "LDKCResult_AcceptChannelDecodeErrorZ");
23691         *ret_conv = CResult_AcceptChannelDecodeErrorZ_clone(arg);
23692         return tag_ptr(ret_conv, true);
23693 }
23694 int64_t  __attribute__((export_name("TS_CResult_AcceptChannelDecodeErrorZ_clone_ptr"))) TS_CResult_AcceptChannelDecodeErrorZ_clone_ptr(uint64_t arg) {
23695         LDKCResult_AcceptChannelDecodeErrorZ* arg_conv = (LDKCResult_AcceptChannelDecodeErrorZ*)untag_ptr(arg);
23696         int64_t ret_conv = CResult_AcceptChannelDecodeErrorZ_clone_ptr(arg_conv);
23697         return ret_conv;
23698 }
23699
23700 uint64_t  __attribute__((export_name("TS_CResult_AcceptChannelDecodeErrorZ_clone"))) TS_CResult_AcceptChannelDecodeErrorZ_clone(uint64_t orig) {
23701         LDKCResult_AcceptChannelDecodeErrorZ* orig_conv = (LDKCResult_AcceptChannelDecodeErrorZ*)untag_ptr(orig);
23702         LDKCResult_AcceptChannelDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_AcceptChannelDecodeErrorZ), "LDKCResult_AcceptChannelDecodeErrorZ");
23703         *ret_conv = CResult_AcceptChannelDecodeErrorZ_clone(orig_conv);
23704         return tag_ptr(ret_conv, true);
23705 }
23706
23707 uint64_t  __attribute__((export_name("TS_CResult_AcceptChannelV2DecodeErrorZ_ok"))) TS_CResult_AcceptChannelV2DecodeErrorZ_ok(uint64_t o) {
23708         LDKAcceptChannelV2 o_conv;
23709         o_conv.inner = untag_ptr(o);
23710         o_conv.is_owned = ptr_is_owned(o);
23711         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
23712         o_conv = AcceptChannelV2_clone(&o_conv);
23713         LDKCResult_AcceptChannelV2DecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_AcceptChannelV2DecodeErrorZ), "LDKCResult_AcceptChannelV2DecodeErrorZ");
23714         *ret_conv = CResult_AcceptChannelV2DecodeErrorZ_ok(o_conv);
23715         return tag_ptr(ret_conv, true);
23716 }
23717
23718 uint64_t  __attribute__((export_name("TS_CResult_AcceptChannelV2DecodeErrorZ_err"))) TS_CResult_AcceptChannelV2DecodeErrorZ_err(uint64_t e) {
23719         void* e_ptr = untag_ptr(e);
23720         CHECK_ACCESS(e_ptr);
23721         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
23722         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
23723         LDKCResult_AcceptChannelV2DecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_AcceptChannelV2DecodeErrorZ), "LDKCResult_AcceptChannelV2DecodeErrorZ");
23724         *ret_conv = CResult_AcceptChannelV2DecodeErrorZ_err(e_conv);
23725         return tag_ptr(ret_conv, true);
23726 }
23727
23728 jboolean  __attribute__((export_name("TS_CResult_AcceptChannelV2DecodeErrorZ_is_ok"))) TS_CResult_AcceptChannelV2DecodeErrorZ_is_ok(uint64_t o) {
23729         LDKCResult_AcceptChannelV2DecodeErrorZ* o_conv = (LDKCResult_AcceptChannelV2DecodeErrorZ*)untag_ptr(o);
23730         jboolean ret_conv = CResult_AcceptChannelV2DecodeErrorZ_is_ok(o_conv);
23731         return ret_conv;
23732 }
23733
23734 void  __attribute__((export_name("TS_CResult_AcceptChannelV2DecodeErrorZ_free"))) TS_CResult_AcceptChannelV2DecodeErrorZ_free(uint64_t _res) {
23735         if (!ptr_is_owned(_res)) return;
23736         void* _res_ptr = untag_ptr(_res);
23737         CHECK_ACCESS(_res_ptr);
23738         LDKCResult_AcceptChannelV2DecodeErrorZ _res_conv = *(LDKCResult_AcceptChannelV2DecodeErrorZ*)(_res_ptr);
23739         FREE(untag_ptr(_res));
23740         CResult_AcceptChannelV2DecodeErrorZ_free(_res_conv);
23741 }
23742
23743 static inline uint64_t CResult_AcceptChannelV2DecodeErrorZ_clone_ptr(LDKCResult_AcceptChannelV2DecodeErrorZ *NONNULL_PTR arg) {
23744         LDKCResult_AcceptChannelV2DecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_AcceptChannelV2DecodeErrorZ), "LDKCResult_AcceptChannelV2DecodeErrorZ");
23745         *ret_conv = CResult_AcceptChannelV2DecodeErrorZ_clone(arg);
23746         return tag_ptr(ret_conv, true);
23747 }
23748 int64_t  __attribute__((export_name("TS_CResult_AcceptChannelV2DecodeErrorZ_clone_ptr"))) TS_CResult_AcceptChannelV2DecodeErrorZ_clone_ptr(uint64_t arg) {
23749         LDKCResult_AcceptChannelV2DecodeErrorZ* arg_conv = (LDKCResult_AcceptChannelV2DecodeErrorZ*)untag_ptr(arg);
23750         int64_t ret_conv = CResult_AcceptChannelV2DecodeErrorZ_clone_ptr(arg_conv);
23751         return ret_conv;
23752 }
23753
23754 uint64_t  __attribute__((export_name("TS_CResult_AcceptChannelV2DecodeErrorZ_clone"))) TS_CResult_AcceptChannelV2DecodeErrorZ_clone(uint64_t orig) {
23755         LDKCResult_AcceptChannelV2DecodeErrorZ* orig_conv = (LDKCResult_AcceptChannelV2DecodeErrorZ*)untag_ptr(orig);
23756         LDKCResult_AcceptChannelV2DecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_AcceptChannelV2DecodeErrorZ), "LDKCResult_AcceptChannelV2DecodeErrorZ");
23757         *ret_conv = CResult_AcceptChannelV2DecodeErrorZ_clone(orig_conv);
23758         return tag_ptr(ret_conv, true);
23759 }
23760
23761 uint64_t  __attribute__((export_name("TS_CResult_TxAddInputDecodeErrorZ_ok"))) TS_CResult_TxAddInputDecodeErrorZ_ok(uint64_t o) {
23762         LDKTxAddInput o_conv;
23763         o_conv.inner = untag_ptr(o);
23764         o_conv.is_owned = ptr_is_owned(o);
23765         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
23766         o_conv = TxAddInput_clone(&o_conv);
23767         LDKCResult_TxAddInputDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TxAddInputDecodeErrorZ), "LDKCResult_TxAddInputDecodeErrorZ");
23768         *ret_conv = CResult_TxAddInputDecodeErrorZ_ok(o_conv);
23769         return tag_ptr(ret_conv, true);
23770 }
23771
23772 uint64_t  __attribute__((export_name("TS_CResult_TxAddInputDecodeErrorZ_err"))) TS_CResult_TxAddInputDecodeErrorZ_err(uint64_t e) {
23773         void* e_ptr = untag_ptr(e);
23774         CHECK_ACCESS(e_ptr);
23775         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
23776         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
23777         LDKCResult_TxAddInputDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TxAddInputDecodeErrorZ), "LDKCResult_TxAddInputDecodeErrorZ");
23778         *ret_conv = CResult_TxAddInputDecodeErrorZ_err(e_conv);
23779         return tag_ptr(ret_conv, true);
23780 }
23781
23782 jboolean  __attribute__((export_name("TS_CResult_TxAddInputDecodeErrorZ_is_ok"))) TS_CResult_TxAddInputDecodeErrorZ_is_ok(uint64_t o) {
23783         LDKCResult_TxAddInputDecodeErrorZ* o_conv = (LDKCResult_TxAddInputDecodeErrorZ*)untag_ptr(o);
23784         jboolean ret_conv = CResult_TxAddInputDecodeErrorZ_is_ok(o_conv);
23785         return ret_conv;
23786 }
23787
23788 void  __attribute__((export_name("TS_CResult_TxAddInputDecodeErrorZ_free"))) TS_CResult_TxAddInputDecodeErrorZ_free(uint64_t _res) {
23789         if (!ptr_is_owned(_res)) return;
23790         void* _res_ptr = untag_ptr(_res);
23791         CHECK_ACCESS(_res_ptr);
23792         LDKCResult_TxAddInputDecodeErrorZ _res_conv = *(LDKCResult_TxAddInputDecodeErrorZ*)(_res_ptr);
23793         FREE(untag_ptr(_res));
23794         CResult_TxAddInputDecodeErrorZ_free(_res_conv);
23795 }
23796
23797 static inline uint64_t CResult_TxAddInputDecodeErrorZ_clone_ptr(LDKCResult_TxAddInputDecodeErrorZ *NONNULL_PTR arg) {
23798         LDKCResult_TxAddInputDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TxAddInputDecodeErrorZ), "LDKCResult_TxAddInputDecodeErrorZ");
23799         *ret_conv = CResult_TxAddInputDecodeErrorZ_clone(arg);
23800         return tag_ptr(ret_conv, true);
23801 }
23802 int64_t  __attribute__((export_name("TS_CResult_TxAddInputDecodeErrorZ_clone_ptr"))) TS_CResult_TxAddInputDecodeErrorZ_clone_ptr(uint64_t arg) {
23803         LDKCResult_TxAddInputDecodeErrorZ* arg_conv = (LDKCResult_TxAddInputDecodeErrorZ*)untag_ptr(arg);
23804         int64_t ret_conv = CResult_TxAddInputDecodeErrorZ_clone_ptr(arg_conv);
23805         return ret_conv;
23806 }
23807
23808 uint64_t  __attribute__((export_name("TS_CResult_TxAddInputDecodeErrorZ_clone"))) TS_CResult_TxAddInputDecodeErrorZ_clone(uint64_t orig) {
23809         LDKCResult_TxAddInputDecodeErrorZ* orig_conv = (LDKCResult_TxAddInputDecodeErrorZ*)untag_ptr(orig);
23810         LDKCResult_TxAddInputDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TxAddInputDecodeErrorZ), "LDKCResult_TxAddInputDecodeErrorZ");
23811         *ret_conv = CResult_TxAddInputDecodeErrorZ_clone(orig_conv);
23812         return tag_ptr(ret_conv, true);
23813 }
23814
23815 uint64_t  __attribute__((export_name("TS_CResult_TxAddOutputDecodeErrorZ_ok"))) TS_CResult_TxAddOutputDecodeErrorZ_ok(uint64_t o) {
23816         LDKTxAddOutput o_conv;
23817         o_conv.inner = untag_ptr(o);
23818         o_conv.is_owned = ptr_is_owned(o);
23819         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
23820         o_conv = TxAddOutput_clone(&o_conv);
23821         LDKCResult_TxAddOutputDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TxAddOutputDecodeErrorZ), "LDKCResult_TxAddOutputDecodeErrorZ");
23822         *ret_conv = CResult_TxAddOutputDecodeErrorZ_ok(o_conv);
23823         return tag_ptr(ret_conv, true);
23824 }
23825
23826 uint64_t  __attribute__((export_name("TS_CResult_TxAddOutputDecodeErrorZ_err"))) TS_CResult_TxAddOutputDecodeErrorZ_err(uint64_t e) {
23827         void* e_ptr = untag_ptr(e);
23828         CHECK_ACCESS(e_ptr);
23829         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
23830         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
23831         LDKCResult_TxAddOutputDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TxAddOutputDecodeErrorZ), "LDKCResult_TxAddOutputDecodeErrorZ");
23832         *ret_conv = CResult_TxAddOutputDecodeErrorZ_err(e_conv);
23833         return tag_ptr(ret_conv, true);
23834 }
23835
23836 jboolean  __attribute__((export_name("TS_CResult_TxAddOutputDecodeErrorZ_is_ok"))) TS_CResult_TxAddOutputDecodeErrorZ_is_ok(uint64_t o) {
23837         LDKCResult_TxAddOutputDecodeErrorZ* o_conv = (LDKCResult_TxAddOutputDecodeErrorZ*)untag_ptr(o);
23838         jboolean ret_conv = CResult_TxAddOutputDecodeErrorZ_is_ok(o_conv);
23839         return ret_conv;
23840 }
23841
23842 void  __attribute__((export_name("TS_CResult_TxAddOutputDecodeErrorZ_free"))) TS_CResult_TxAddOutputDecodeErrorZ_free(uint64_t _res) {
23843         if (!ptr_is_owned(_res)) return;
23844         void* _res_ptr = untag_ptr(_res);
23845         CHECK_ACCESS(_res_ptr);
23846         LDKCResult_TxAddOutputDecodeErrorZ _res_conv = *(LDKCResult_TxAddOutputDecodeErrorZ*)(_res_ptr);
23847         FREE(untag_ptr(_res));
23848         CResult_TxAddOutputDecodeErrorZ_free(_res_conv);
23849 }
23850
23851 static inline uint64_t CResult_TxAddOutputDecodeErrorZ_clone_ptr(LDKCResult_TxAddOutputDecodeErrorZ *NONNULL_PTR arg) {
23852         LDKCResult_TxAddOutputDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TxAddOutputDecodeErrorZ), "LDKCResult_TxAddOutputDecodeErrorZ");
23853         *ret_conv = CResult_TxAddOutputDecodeErrorZ_clone(arg);
23854         return tag_ptr(ret_conv, true);
23855 }
23856 int64_t  __attribute__((export_name("TS_CResult_TxAddOutputDecodeErrorZ_clone_ptr"))) TS_CResult_TxAddOutputDecodeErrorZ_clone_ptr(uint64_t arg) {
23857         LDKCResult_TxAddOutputDecodeErrorZ* arg_conv = (LDKCResult_TxAddOutputDecodeErrorZ*)untag_ptr(arg);
23858         int64_t ret_conv = CResult_TxAddOutputDecodeErrorZ_clone_ptr(arg_conv);
23859         return ret_conv;
23860 }
23861
23862 uint64_t  __attribute__((export_name("TS_CResult_TxAddOutputDecodeErrorZ_clone"))) TS_CResult_TxAddOutputDecodeErrorZ_clone(uint64_t orig) {
23863         LDKCResult_TxAddOutputDecodeErrorZ* orig_conv = (LDKCResult_TxAddOutputDecodeErrorZ*)untag_ptr(orig);
23864         LDKCResult_TxAddOutputDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TxAddOutputDecodeErrorZ), "LDKCResult_TxAddOutputDecodeErrorZ");
23865         *ret_conv = CResult_TxAddOutputDecodeErrorZ_clone(orig_conv);
23866         return tag_ptr(ret_conv, true);
23867 }
23868
23869 uint64_t  __attribute__((export_name("TS_CResult_TxRemoveInputDecodeErrorZ_ok"))) TS_CResult_TxRemoveInputDecodeErrorZ_ok(uint64_t o) {
23870         LDKTxRemoveInput o_conv;
23871         o_conv.inner = untag_ptr(o);
23872         o_conv.is_owned = ptr_is_owned(o);
23873         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
23874         o_conv = TxRemoveInput_clone(&o_conv);
23875         LDKCResult_TxRemoveInputDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TxRemoveInputDecodeErrorZ), "LDKCResult_TxRemoveInputDecodeErrorZ");
23876         *ret_conv = CResult_TxRemoveInputDecodeErrorZ_ok(o_conv);
23877         return tag_ptr(ret_conv, true);
23878 }
23879
23880 uint64_t  __attribute__((export_name("TS_CResult_TxRemoveInputDecodeErrorZ_err"))) TS_CResult_TxRemoveInputDecodeErrorZ_err(uint64_t e) {
23881         void* e_ptr = untag_ptr(e);
23882         CHECK_ACCESS(e_ptr);
23883         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
23884         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
23885         LDKCResult_TxRemoveInputDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TxRemoveInputDecodeErrorZ), "LDKCResult_TxRemoveInputDecodeErrorZ");
23886         *ret_conv = CResult_TxRemoveInputDecodeErrorZ_err(e_conv);
23887         return tag_ptr(ret_conv, true);
23888 }
23889
23890 jboolean  __attribute__((export_name("TS_CResult_TxRemoveInputDecodeErrorZ_is_ok"))) TS_CResult_TxRemoveInputDecodeErrorZ_is_ok(uint64_t o) {
23891         LDKCResult_TxRemoveInputDecodeErrorZ* o_conv = (LDKCResult_TxRemoveInputDecodeErrorZ*)untag_ptr(o);
23892         jboolean ret_conv = CResult_TxRemoveInputDecodeErrorZ_is_ok(o_conv);
23893         return ret_conv;
23894 }
23895
23896 void  __attribute__((export_name("TS_CResult_TxRemoveInputDecodeErrorZ_free"))) TS_CResult_TxRemoveInputDecodeErrorZ_free(uint64_t _res) {
23897         if (!ptr_is_owned(_res)) return;
23898         void* _res_ptr = untag_ptr(_res);
23899         CHECK_ACCESS(_res_ptr);
23900         LDKCResult_TxRemoveInputDecodeErrorZ _res_conv = *(LDKCResult_TxRemoveInputDecodeErrorZ*)(_res_ptr);
23901         FREE(untag_ptr(_res));
23902         CResult_TxRemoveInputDecodeErrorZ_free(_res_conv);
23903 }
23904
23905 static inline uint64_t CResult_TxRemoveInputDecodeErrorZ_clone_ptr(LDKCResult_TxRemoveInputDecodeErrorZ *NONNULL_PTR arg) {
23906         LDKCResult_TxRemoveInputDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TxRemoveInputDecodeErrorZ), "LDKCResult_TxRemoveInputDecodeErrorZ");
23907         *ret_conv = CResult_TxRemoveInputDecodeErrorZ_clone(arg);
23908         return tag_ptr(ret_conv, true);
23909 }
23910 int64_t  __attribute__((export_name("TS_CResult_TxRemoveInputDecodeErrorZ_clone_ptr"))) TS_CResult_TxRemoveInputDecodeErrorZ_clone_ptr(uint64_t arg) {
23911         LDKCResult_TxRemoveInputDecodeErrorZ* arg_conv = (LDKCResult_TxRemoveInputDecodeErrorZ*)untag_ptr(arg);
23912         int64_t ret_conv = CResult_TxRemoveInputDecodeErrorZ_clone_ptr(arg_conv);
23913         return ret_conv;
23914 }
23915
23916 uint64_t  __attribute__((export_name("TS_CResult_TxRemoveInputDecodeErrorZ_clone"))) TS_CResult_TxRemoveInputDecodeErrorZ_clone(uint64_t orig) {
23917         LDKCResult_TxRemoveInputDecodeErrorZ* orig_conv = (LDKCResult_TxRemoveInputDecodeErrorZ*)untag_ptr(orig);
23918         LDKCResult_TxRemoveInputDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TxRemoveInputDecodeErrorZ), "LDKCResult_TxRemoveInputDecodeErrorZ");
23919         *ret_conv = CResult_TxRemoveInputDecodeErrorZ_clone(orig_conv);
23920         return tag_ptr(ret_conv, true);
23921 }
23922
23923 uint64_t  __attribute__((export_name("TS_CResult_TxRemoveOutputDecodeErrorZ_ok"))) TS_CResult_TxRemoveOutputDecodeErrorZ_ok(uint64_t o) {
23924         LDKTxRemoveOutput o_conv;
23925         o_conv.inner = untag_ptr(o);
23926         o_conv.is_owned = ptr_is_owned(o);
23927         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
23928         o_conv = TxRemoveOutput_clone(&o_conv);
23929         LDKCResult_TxRemoveOutputDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TxRemoveOutputDecodeErrorZ), "LDKCResult_TxRemoveOutputDecodeErrorZ");
23930         *ret_conv = CResult_TxRemoveOutputDecodeErrorZ_ok(o_conv);
23931         return tag_ptr(ret_conv, true);
23932 }
23933
23934 uint64_t  __attribute__((export_name("TS_CResult_TxRemoveOutputDecodeErrorZ_err"))) TS_CResult_TxRemoveOutputDecodeErrorZ_err(uint64_t e) {
23935         void* e_ptr = untag_ptr(e);
23936         CHECK_ACCESS(e_ptr);
23937         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
23938         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
23939         LDKCResult_TxRemoveOutputDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TxRemoveOutputDecodeErrorZ), "LDKCResult_TxRemoveOutputDecodeErrorZ");
23940         *ret_conv = CResult_TxRemoveOutputDecodeErrorZ_err(e_conv);
23941         return tag_ptr(ret_conv, true);
23942 }
23943
23944 jboolean  __attribute__((export_name("TS_CResult_TxRemoveOutputDecodeErrorZ_is_ok"))) TS_CResult_TxRemoveOutputDecodeErrorZ_is_ok(uint64_t o) {
23945         LDKCResult_TxRemoveOutputDecodeErrorZ* o_conv = (LDKCResult_TxRemoveOutputDecodeErrorZ*)untag_ptr(o);
23946         jboolean ret_conv = CResult_TxRemoveOutputDecodeErrorZ_is_ok(o_conv);
23947         return ret_conv;
23948 }
23949
23950 void  __attribute__((export_name("TS_CResult_TxRemoveOutputDecodeErrorZ_free"))) TS_CResult_TxRemoveOutputDecodeErrorZ_free(uint64_t _res) {
23951         if (!ptr_is_owned(_res)) return;
23952         void* _res_ptr = untag_ptr(_res);
23953         CHECK_ACCESS(_res_ptr);
23954         LDKCResult_TxRemoveOutputDecodeErrorZ _res_conv = *(LDKCResult_TxRemoveOutputDecodeErrorZ*)(_res_ptr);
23955         FREE(untag_ptr(_res));
23956         CResult_TxRemoveOutputDecodeErrorZ_free(_res_conv);
23957 }
23958
23959 static inline uint64_t CResult_TxRemoveOutputDecodeErrorZ_clone_ptr(LDKCResult_TxRemoveOutputDecodeErrorZ *NONNULL_PTR arg) {
23960         LDKCResult_TxRemoveOutputDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TxRemoveOutputDecodeErrorZ), "LDKCResult_TxRemoveOutputDecodeErrorZ");
23961         *ret_conv = CResult_TxRemoveOutputDecodeErrorZ_clone(arg);
23962         return tag_ptr(ret_conv, true);
23963 }
23964 int64_t  __attribute__((export_name("TS_CResult_TxRemoveOutputDecodeErrorZ_clone_ptr"))) TS_CResult_TxRemoveOutputDecodeErrorZ_clone_ptr(uint64_t arg) {
23965         LDKCResult_TxRemoveOutputDecodeErrorZ* arg_conv = (LDKCResult_TxRemoveOutputDecodeErrorZ*)untag_ptr(arg);
23966         int64_t ret_conv = CResult_TxRemoveOutputDecodeErrorZ_clone_ptr(arg_conv);
23967         return ret_conv;
23968 }
23969
23970 uint64_t  __attribute__((export_name("TS_CResult_TxRemoveOutputDecodeErrorZ_clone"))) TS_CResult_TxRemoveOutputDecodeErrorZ_clone(uint64_t orig) {
23971         LDKCResult_TxRemoveOutputDecodeErrorZ* orig_conv = (LDKCResult_TxRemoveOutputDecodeErrorZ*)untag_ptr(orig);
23972         LDKCResult_TxRemoveOutputDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TxRemoveOutputDecodeErrorZ), "LDKCResult_TxRemoveOutputDecodeErrorZ");
23973         *ret_conv = CResult_TxRemoveOutputDecodeErrorZ_clone(orig_conv);
23974         return tag_ptr(ret_conv, true);
23975 }
23976
23977 uint64_t  __attribute__((export_name("TS_CResult_TxCompleteDecodeErrorZ_ok"))) TS_CResult_TxCompleteDecodeErrorZ_ok(uint64_t o) {
23978         LDKTxComplete o_conv;
23979         o_conv.inner = untag_ptr(o);
23980         o_conv.is_owned = ptr_is_owned(o);
23981         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
23982         o_conv = TxComplete_clone(&o_conv);
23983         LDKCResult_TxCompleteDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TxCompleteDecodeErrorZ), "LDKCResult_TxCompleteDecodeErrorZ");
23984         *ret_conv = CResult_TxCompleteDecodeErrorZ_ok(o_conv);
23985         return tag_ptr(ret_conv, true);
23986 }
23987
23988 uint64_t  __attribute__((export_name("TS_CResult_TxCompleteDecodeErrorZ_err"))) TS_CResult_TxCompleteDecodeErrorZ_err(uint64_t e) {
23989         void* e_ptr = untag_ptr(e);
23990         CHECK_ACCESS(e_ptr);
23991         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
23992         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
23993         LDKCResult_TxCompleteDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TxCompleteDecodeErrorZ), "LDKCResult_TxCompleteDecodeErrorZ");
23994         *ret_conv = CResult_TxCompleteDecodeErrorZ_err(e_conv);
23995         return tag_ptr(ret_conv, true);
23996 }
23997
23998 jboolean  __attribute__((export_name("TS_CResult_TxCompleteDecodeErrorZ_is_ok"))) TS_CResult_TxCompleteDecodeErrorZ_is_ok(uint64_t o) {
23999         LDKCResult_TxCompleteDecodeErrorZ* o_conv = (LDKCResult_TxCompleteDecodeErrorZ*)untag_ptr(o);
24000         jboolean ret_conv = CResult_TxCompleteDecodeErrorZ_is_ok(o_conv);
24001         return ret_conv;
24002 }
24003
24004 void  __attribute__((export_name("TS_CResult_TxCompleteDecodeErrorZ_free"))) TS_CResult_TxCompleteDecodeErrorZ_free(uint64_t _res) {
24005         if (!ptr_is_owned(_res)) return;
24006         void* _res_ptr = untag_ptr(_res);
24007         CHECK_ACCESS(_res_ptr);
24008         LDKCResult_TxCompleteDecodeErrorZ _res_conv = *(LDKCResult_TxCompleteDecodeErrorZ*)(_res_ptr);
24009         FREE(untag_ptr(_res));
24010         CResult_TxCompleteDecodeErrorZ_free(_res_conv);
24011 }
24012
24013 static inline uint64_t CResult_TxCompleteDecodeErrorZ_clone_ptr(LDKCResult_TxCompleteDecodeErrorZ *NONNULL_PTR arg) {
24014         LDKCResult_TxCompleteDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TxCompleteDecodeErrorZ), "LDKCResult_TxCompleteDecodeErrorZ");
24015         *ret_conv = CResult_TxCompleteDecodeErrorZ_clone(arg);
24016         return tag_ptr(ret_conv, true);
24017 }
24018 int64_t  __attribute__((export_name("TS_CResult_TxCompleteDecodeErrorZ_clone_ptr"))) TS_CResult_TxCompleteDecodeErrorZ_clone_ptr(uint64_t arg) {
24019         LDKCResult_TxCompleteDecodeErrorZ* arg_conv = (LDKCResult_TxCompleteDecodeErrorZ*)untag_ptr(arg);
24020         int64_t ret_conv = CResult_TxCompleteDecodeErrorZ_clone_ptr(arg_conv);
24021         return ret_conv;
24022 }
24023
24024 uint64_t  __attribute__((export_name("TS_CResult_TxCompleteDecodeErrorZ_clone"))) TS_CResult_TxCompleteDecodeErrorZ_clone(uint64_t orig) {
24025         LDKCResult_TxCompleteDecodeErrorZ* orig_conv = (LDKCResult_TxCompleteDecodeErrorZ*)untag_ptr(orig);
24026         LDKCResult_TxCompleteDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TxCompleteDecodeErrorZ), "LDKCResult_TxCompleteDecodeErrorZ");
24027         *ret_conv = CResult_TxCompleteDecodeErrorZ_clone(orig_conv);
24028         return tag_ptr(ret_conv, true);
24029 }
24030
24031 uint64_t  __attribute__((export_name("TS_CResult_TxSignaturesDecodeErrorZ_ok"))) TS_CResult_TxSignaturesDecodeErrorZ_ok(uint64_t o) {
24032         LDKTxSignatures o_conv;
24033         o_conv.inner = untag_ptr(o);
24034         o_conv.is_owned = ptr_is_owned(o);
24035         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
24036         o_conv = TxSignatures_clone(&o_conv);
24037         LDKCResult_TxSignaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TxSignaturesDecodeErrorZ), "LDKCResult_TxSignaturesDecodeErrorZ");
24038         *ret_conv = CResult_TxSignaturesDecodeErrorZ_ok(o_conv);
24039         return tag_ptr(ret_conv, true);
24040 }
24041
24042 uint64_t  __attribute__((export_name("TS_CResult_TxSignaturesDecodeErrorZ_err"))) TS_CResult_TxSignaturesDecodeErrorZ_err(uint64_t e) {
24043         void* e_ptr = untag_ptr(e);
24044         CHECK_ACCESS(e_ptr);
24045         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
24046         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
24047         LDKCResult_TxSignaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TxSignaturesDecodeErrorZ), "LDKCResult_TxSignaturesDecodeErrorZ");
24048         *ret_conv = CResult_TxSignaturesDecodeErrorZ_err(e_conv);
24049         return tag_ptr(ret_conv, true);
24050 }
24051
24052 jboolean  __attribute__((export_name("TS_CResult_TxSignaturesDecodeErrorZ_is_ok"))) TS_CResult_TxSignaturesDecodeErrorZ_is_ok(uint64_t o) {
24053         LDKCResult_TxSignaturesDecodeErrorZ* o_conv = (LDKCResult_TxSignaturesDecodeErrorZ*)untag_ptr(o);
24054         jboolean ret_conv = CResult_TxSignaturesDecodeErrorZ_is_ok(o_conv);
24055         return ret_conv;
24056 }
24057
24058 void  __attribute__((export_name("TS_CResult_TxSignaturesDecodeErrorZ_free"))) TS_CResult_TxSignaturesDecodeErrorZ_free(uint64_t _res) {
24059         if (!ptr_is_owned(_res)) return;
24060         void* _res_ptr = untag_ptr(_res);
24061         CHECK_ACCESS(_res_ptr);
24062         LDKCResult_TxSignaturesDecodeErrorZ _res_conv = *(LDKCResult_TxSignaturesDecodeErrorZ*)(_res_ptr);
24063         FREE(untag_ptr(_res));
24064         CResult_TxSignaturesDecodeErrorZ_free(_res_conv);
24065 }
24066
24067 static inline uint64_t CResult_TxSignaturesDecodeErrorZ_clone_ptr(LDKCResult_TxSignaturesDecodeErrorZ *NONNULL_PTR arg) {
24068         LDKCResult_TxSignaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TxSignaturesDecodeErrorZ), "LDKCResult_TxSignaturesDecodeErrorZ");
24069         *ret_conv = CResult_TxSignaturesDecodeErrorZ_clone(arg);
24070         return tag_ptr(ret_conv, true);
24071 }
24072 int64_t  __attribute__((export_name("TS_CResult_TxSignaturesDecodeErrorZ_clone_ptr"))) TS_CResult_TxSignaturesDecodeErrorZ_clone_ptr(uint64_t arg) {
24073         LDKCResult_TxSignaturesDecodeErrorZ* arg_conv = (LDKCResult_TxSignaturesDecodeErrorZ*)untag_ptr(arg);
24074         int64_t ret_conv = CResult_TxSignaturesDecodeErrorZ_clone_ptr(arg_conv);
24075         return ret_conv;
24076 }
24077
24078 uint64_t  __attribute__((export_name("TS_CResult_TxSignaturesDecodeErrorZ_clone"))) TS_CResult_TxSignaturesDecodeErrorZ_clone(uint64_t orig) {
24079         LDKCResult_TxSignaturesDecodeErrorZ* orig_conv = (LDKCResult_TxSignaturesDecodeErrorZ*)untag_ptr(orig);
24080         LDKCResult_TxSignaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TxSignaturesDecodeErrorZ), "LDKCResult_TxSignaturesDecodeErrorZ");
24081         *ret_conv = CResult_TxSignaturesDecodeErrorZ_clone(orig_conv);
24082         return tag_ptr(ret_conv, true);
24083 }
24084
24085 uint64_t  __attribute__((export_name("TS_CResult_TxInitRbfDecodeErrorZ_ok"))) TS_CResult_TxInitRbfDecodeErrorZ_ok(uint64_t o) {
24086         LDKTxInitRbf o_conv;
24087         o_conv.inner = untag_ptr(o);
24088         o_conv.is_owned = ptr_is_owned(o);
24089         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
24090         o_conv = TxInitRbf_clone(&o_conv);
24091         LDKCResult_TxInitRbfDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TxInitRbfDecodeErrorZ), "LDKCResult_TxInitRbfDecodeErrorZ");
24092         *ret_conv = CResult_TxInitRbfDecodeErrorZ_ok(o_conv);
24093         return tag_ptr(ret_conv, true);
24094 }
24095
24096 uint64_t  __attribute__((export_name("TS_CResult_TxInitRbfDecodeErrorZ_err"))) TS_CResult_TxInitRbfDecodeErrorZ_err(uint64_t e) {
24097         void* e_ptr = untag_ptr(e);
24098         CHECK_ACCESS(e_ptr);
24099         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
24100         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
24101         LDKCResult_TxInitRbfDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TxInitRbfDecodeErrorZ), "LDKCResult_TxInitRbfDecodeErrorZ");
24102         *ret_conv = CResult_TxInitRbfDecodeErrorZ_err(e_conv);
24103         return tag_ptr(ret_conv, true);
24104 }
24105
24106 jboolean  __attribute__((export_name("TS_CResult_TxInitRbfDecodeErrorZ_is_ok"))) TS_CResult_TxInitRbfDecodeErrorZ_is_ok(uint64_t o) {
24107         LDKCResult_TxInitRbfDecodeErrorZ* o_conv = (LDKCResult_TxInitRbfDecodeErrorZ*)untag_ptr(o);
24108         jboolean ret_conv = CResult_TxInitRbfDecodeErrorZ_is_ok(o_conv);
24109         return ret_conv;
24110 }
24111
24112 void  __attribute__((export_name("TS_CResult_TxInitRbfDecodeErrorZ_free"))) TS_CResult_TxInitRbfDecodeErrorZ_free(uint64_t _res) {
24113         if (!ptr_is_owned(_res)) return;
24114         void* _res_ptr = untag_ptr(_res);
24115         CHECK_ACCESS(_res_ptr);
24116         LDKCResult_TxInitRbfDecodeErrorZ _res_conv = *(LDKCResult_TxInitRbfDecodeErrorZ*)(_res_ptr);
24117         FREE(untag_ptr(_res));
24118         CResult_TxInitRbfDecodeErrorZ_free(_res_conv);
24119 }
24120
24121 static inline uint64_t CResult_TxInitRbfDecodeErrorZ_clone_ptr(LDKCResult_TxInitRbfDecodeErrorZ *NONNULL_PTR arg) {
24122         LDKCResult_TxInitRbfDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TxInitRbfDecodeErrorZ), "LDKCResult_TxInitRbfDecodeErrorZ");
24123         *ret_conv = CResult_TxInitRbfDecodeErrorZ_clone(arg);
24124         return tag_ptr(ret_conv, true);
24125 }
24126 int64_t  __attribute__((export_name("TS_CResult_TxInitRbfDecodeErrorZ_clone_ptr"))) TS_CResult_TxInitRbfDecodeErrorZ_clone_ptr(uint64_t arg) {
24127         LDKCResult_TxInitRbfDecodeErrorZ* arg_conv = (LDKCResult_TxInitRbfDecodeErrorZ*)untag_ptr(arg);
24128         int64_t ret_conv = CResult_TxInitRbfDecodeErrorZ_clone_ptr(arg_conv);
24129         return ret_conv;
24130 }
24131
24132 uint64_t  __attribute__((export_name("TS_CResult_TxInitRbfDecodeErrorZ_clone"))) TS_CResult_TxInitRbfDecodeErrorZ_clone(uint64_t orig) {
24133         LDKCResult_TxInitRbfDecodeErrorZ* orig_conv = (LDKCResult_TxInitRbfDecodeErrorZ*)untag_ptr(orig);
24134         LDKCResult_TxInitRbfDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TxInitRbfDecodeErrorZ), "LDKCResult_TxInitRbfDecodeErrorZ");
24135         *ret_conv = CResult_TxInitRbfDecodeErrorZ_clone(orig_conv);
24136         return tag_ptr(ret_conv, true);
24137 }
24138
24139 uint64_t  __attribute__((export_name("TS_CResult_TxAckRbfDecodeErrorZ_ok"))) TS_CResult_TxAckRbfDecodeErrorZ_ok(uint64_t o) {
24140         LDKTxAckRbf o_conv;
24141         o_conv.inner = untag_ptr(o);
24142         o_conv.is_owned = ptr_is_owned(o);
24143         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
24144         o_conv = TxAckRbf_clone(&o_conv);
24145         LDKCResult_TxAckRbfDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TxAckRbfDecodeErrorZ), "LDKCResult_TxAckRbfDecodeErrorZ");
24146         *ret_conv = CResult_TxAckRbfDecodeErrorZ_ok(o_conv);
24147         return tag_ptr(ret_conv, true);
24148 }
24149
24150 uint64_t  __attribute__((export_name("TS_CResult_TxAckRbfDecodeErrorZ_err"))) TS_CResult_TxAckRbfDecodeErrorZ_err(uint64_t e) {
24151         void* e_ptr = untag_ptr(e);
24152         CHECK_ACCESS(e_ptr);
24153         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
24154         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
24155         LDKCResult_TxAckRbfDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TxAckRbfDecodeErrorZ), "LDKCResult_TxAckRbfDecodeErrorZ");
24156         *ret_conv = CResult_TxAckRbfDecodeErrorZ_err(e_conv);
24157         return tag_ptr(ret_conv, true);
24158 }
24159
24160 jboolean  __attribute__((export_name("TS_CResult_TxAckRbfDecodeErrorZ_is_ok"))) TS_CResult_TxAckRbfDecodeErrorZ_is_ok(uint64_t o) {
24161         LDKCResult_TxAckRbfDecodeErrorZ* o_conv = (LDKCResult_TxAckRbfDecodeErrorZ*)untag_ptr(o);
24162         jboolean ret_conv = CResult_TxAckRbfDecodeErrorZ_is_ok(o_conv);
24163         return ret_conv;
24164 }
24165
24166 void  __attribute__((export_name("TS_CResult_TxAckRbfDecodeErrorZ_free"))) TS_CResult_TxAckRbfDecodeErrorZ_free(uint64_t _res) {
24167         if (!ptr_is_owned(_res)) return;
24168         void* _res_ptr = untag_ptr(_res);
24169         CHECK_ACCESS(_res_ptr);
24170         LDKCResult_TxAckRbfDecodeErrorZ _res_conv = *(LDKCResult_TxAckRbfDecodeErrorZ*)(_res_ptr);
24171         FREE(untag_ptr(_res));
24172         CResult_TxAckRbfDecodeErrorZ_free(_res_conv);
24173 }
24174
24175 static inline uint64_t CResult_TxAckRbfDecodeErrorZ_clone_ptr(LDKCResult_TxAckRbfDecodeErrorZ *NONNULL_PTR arg) {
24176         LDKCResult_TxAckRbfDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TxAckRbfDecodeErrorZ), "LDKCResult_TxAckRbfDecodeErrorZ");
24177         *ret_conv = CResult_TxAckRbfDecodeErrorZ_clone(arg);
24178         return tag_ptr(ret_conv, true);
24179 }
24180 int64_t  __attribute__((export_name("TS_CResult_TxAckRbfDecodeErrorZ_clone_ptr"))) TS_CResult_TxAckRbfDecodeErrorZ_clone_ptr(uint64_t arg) {
24181         LDKCResult_TxAckRbfDecodeErrorZ* arg_conv = (LDKCResult_TxAckRbfDecodeErrorZ*)untag_ptr(arg);
24182         int64_t ret_conv = CResult_TxAckRbfDecodeErrorZ_clone_ptr(arg_conv);
24183         return ret_conv;
24184 }
24185
24186 uint64_t  __attribute__((export_name("TS_CResult_TxAckRbfDecodeErrorZ_clone"))) TS_CResult_TxAckRbfDecodeErrorZ_clone(uint64_t orig) {
24187         LDKCResult_TxAckRbfDecodeErrorZ* orig_conv = (LDKCResult_TxAckRbfDecodeErrorZ*)untag_ptr(orig);
24188         LDKCResult_TxAckRbfDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TxAckRbfDecodeErrorZ), "LDKCResult_TxAckRbfDecodeErrorZ");
24189         *ret_conv = CResult_TxAckRbfDecodeErrorZ_clone(orig_conv);
24190         return tag_ptr(ret_conv, true);
24191 }
24192
24193 uint64_t  __attribute__((export_name("TS_CResult_TxAbortDecodeErrorZ_ok"))) TS_CResult_TxAbortDecodeErrorZ_ok(uint64_t o) {
24194         LDKTxAbort o_conv;
24195         o_conv.inner = untag_ptr(o);
24196         o_conv.is_owned = ptr_is_owned(o);
24197         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
24198         o_conv = TxAbort_clone(&o_conv);
24199         LDKCResult_TxAbortDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TxAbortDecodeErrorZ), "LDKCResult_TxAbortDecodeErrorZ");
24200         *ret_conv = CResult_TxAbortDecodeErrorZ_ok(o_conv);
24201         return tag_ptr(ret_conv, true);
24202 }
24203
24204 uint64_t  __attribute__((export_name("TS_CResult_TxAbortDecodeErrorZ_err"))) TS_CResult_TxAbortDecodeErrorZ_err(uint64_t e) {
24205         void* e_ptr = untag_ptr(e);
24206         CHECK_ACCESS(e_ptr);
24207         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
24208         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
24209         LDKCResult_TxAbortDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TxAbortDecodeErrorZ), "LDKCResult_TxAbortDecodeErrorZ");
24210         *ret_conv = CResult_TxAbortDecodeErrorZ_err(e_conv);
24211         return tag_ptr(ret_conv, true);
24212 }
24213
24214 jboolean  __attribute__((export_name("TS_CResult_TxAbortDecodeErrorZ_is_ok"))) TS_CResult_TxAbortDecodeErrorZ_is_ok(uint64_t o) {
24215         LDKCResult_TxAbortDecodeErrorZ* o_conv = (LDKCResult_TxAbortDecodeErrorZ*)untag_ptr(o);
24216         jboolean ret_conv = CResult_TxAbortDecodeErrorZ_is_ok(o_conv);
24217         return ret_conv;
24218 }
24219
24220 void  __attribute__((export_name("TS_CResult_TxAbortDecodeErrorZ_free"))) TS_CResult_TxAbortDecodeErrorZ_free(uint64_t _res) {
24221         if (!ptr_is_owned(_res)) return;
24222         void* _res_ptr = untag_ptr(_res);
24223         CHECK_ACCESS(_res_ptr);
24224         LDKCResult_TxAbortDecodeErrorZ _res_conv = *(LDKCResult_TxAbortDecodeErrorZ*)(_res_ptr);
24225         FREE(untag_ptr(_res));
24226         CResult_TxAbortDecodeErrorZ_free(_res_conv);
24227 }
24228
24229 static inline uint64_t CResult_TxAbortDecodeErrorZ_clone_ptr(LDKCResult_TxAbortDecodeErrorZ *NONNULL_PTR arg) {
24230         LDKCResult_TxAbortDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TxAbortDecodeErrorZ), "LDKCResult_TxAbortDecodeErrorZ");
24231         *ret_conv = CResult_TxAbortDecodeErrorZ_clone(arg);
24232         return tag_ptr(ret_conv, true);
24233 }
24234 int64_t  __attribute__((export_name("TS_CResult_TxAbortDecodeErrorZ_clone_ptr"))) TS_CResult_TxAbortDecodeErrorZ_clone_ptr(uint64_t arg) {
24235         LDKCResult_TxAbortDecodeErrorZ* arg_conv = (LDKCResult_TxAbortDecodeErrorZ*)untag_ptr(arg);
24236         int64_t ret_conv = CResult_TxAbortDecodeErrorZ_clone_ptr(arg_conv);
24237         return ret_conv;
24238 }
24239
24240 uint64_t  __attribute__((export_name("TS_CResult_TxAbortDecodeErrorZ_clone"))) TS_CResult_TxAbortDecodeErrorZ_clone(uint64_t orig) {
24241         LDKCResult_TxAbortDecodeErrorZ* orig_conv = (LDKCResult_TxAbortDecodeErrorZ*)untag_ptr(orig);
24242         LDKCResult_TxAbortDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TxAbortDecodeErrorZ), "LDKCResult_TxAbortDecodeErrorZ");
24243         *ret_conv = CResult_TxAbortDecodeErrorZ_clone(orig_conv);
24244         return tag_ptr(ret_conv, true);
24245 }
24246
24247 uint64_t  __attribute__((export_name("TS_CResult_AnnouncementSignaturesDecodeErrorZ_ok"))) TS_CResult_AnnouncementSignaturesDecodeErrorZ_ok(uint64_t o) {
24248         LDKAnnouncementSignatures o_conv;
24249         o_conv.inner = untag_ptr(o);
24250         o_conv.is_owned = ptr_is_owned(o);
24251         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
24252         o_conv = AnnouncementSignatures_clone(&o_conv);
24253         LDKCResult_AnnouncementSignaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_AnnouncementSignaturesDecodeErrorZ), "LDKCResult_AnnouncementSignaturesDecodeErrorZ");
24254         *ret_conv = CResult_AnnouncementSignaturesDecodeErrorZ_ok(o_conv);
24255         return tag_ptr(ret_conv, true);
24256 }
24257
24258 uint64_t  __attribute__((export_name("TS_CResult_AnnouncementSignaturesDecodeErrorZ_err"))) TS_CResult_AnnouncementSignaturesDecodeErrorZ_err(uint64_t e) {
24259         void* e_ptr = untag_ptr(e);
24260         CHECK_ACCESS(e_ptr);
24261         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
24262         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
24263         LDKCResult_AnnouncementSignaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_AnnouncementSignaturesDecodeErrorZ), "LDKCResult_AnnouncementSignaturesDecodeErrorZ");
24264         *ret_conv = CResult_AnnouncementSignaturesDecodeErrorZ_err(e_conv);
24265         return tag_ptr(ret_conv, true);
24266 }
24267
24268 jboolean  __attribute__((export_name("TS_CResult_AnnouncementSignaturesDecodeErrorZ_is_ok"))) TS_CResult_AnnouncementSignaturesDecodeErrorZ_is_ok(uint64_t o) {
24269         LDKCResult_AnnouncementSignaturesDecodeErrorZ* o_conv = (LDKCResult_AnnouncementSignaturesDecodeErrorZ*)untag_ptr(o);
24270         jboolean ret_conv = CResult_AnnouncementSignaturesDecodeErrorZ_is_ok(o_conv);
24271         return ret_conv;
24272 }
24273
24274 void  __attribute__((export_name("TS_CResult_AnnouncementSignaturesDecodeErrorZ_free"))) TS_CResult_AnnouncementSignaturesDecodeErrorZ_free(uint64_t _res) {
24275         if (!ptr_is_owned(_res)) return;
24276         void* _res_ptr = untag_ptr(_res);
24277         CHECK_ACCESS(_res_ptr);
24278         LDKCResult_AnnouncementSignaturesDecodeErrorZ _res_conv = *(LDKCResult_AnnouncementSignaturesDecodeErrorZ*)(_res_ptr);
24279         FREE(untag_ptr(_res));
24280         CResult_AnnouncementSignaturesDecodeErrorZ_free(_res_conv);
24281 }
24282
24283 static inline uint64_t CResult_AnnouncementSignaturesDecodeErrorZ_clone_ptr(LDKCResult_AnnouncementSignaturesDecodeErrorZ *NONNULL_PTR arg) {
24284         LDKCResult_AnnouncementSignaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_AnnouncementSignaturesDecodeErrorZ), "LDKCResult_AnnouncementSignaturesDecodeErrorZ");
24285         *ret_conv = CResult_AnnouncementSignaturesDecodeErrorZ_clone(arg);
24286         return tag_ptr(ret_conv, true);
24287 }
24288 int64_t  __attribute__((export_name("TS_CResult_AnnouncementSignaturesDecodeErrorZ_clone_ptr"))) TS_CResult_AnnouncementSignaturesDecodeErrorZ_clone_ptr(uint64_t arg) {
24289         LDKCResult_AnnouncementSignaturesDecodeErrorZ* arg_conv = (LDKCResult_AnnouncementSignaturesDecodeErrorZ*)untag_ptr(arg);
24290         int64_t ret_conv = CResult_AnnouncementSignaturesDecodeErrorZ_clone_ptr(arg_conv);
24291         return ret_conv;
24292 }
24293
24294 uint64_t  __attribute__((export_name("TS_CResult_AnnouncementSignaturesDecodeErrorZ_clone"))) TS_CResult_AnnouncementSignaturesDecodeErrorZ_clone(uint64_t orig) {
24295         LDKCResult_AnnouncementSignaturesDecodeErrorZ* orig_conv = (LDKCResult_AnnouncementSignaturesDecodeErrorZ*)untag_ptr(orig);
24296         LDKCResult_AnnouncementSignaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_AnnouncementSignaturesDecodeErrorZ), "LDKCResult_AnnouncementSignaturesDecodeErrorZ");
24297         *ret_conv = CResult_AnnouncementSignaturesDecodeErrorZ_clone(orig_conv);
24298         return tag_ptr(ret_conv, true);
24299 }
24300
24301 uint64_t  __attribute__((export_name("TS_CResult_ChannelReestablishDecodeErrorZ_ok"))) TS_CResult_ChannelReestablishDecodeErrorZ_ok(uint64_t o) {
24302         LDKChannelReestablish o_conv;
24303         o_conv.inner = untag_ptr(o);
24304         o_conv.is_owned = ptr_is_owned(o);
24305         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
24306         o_conv = ChannelReestablish_clone(&o_conv);
24307         LDKCResult_ChannelReestablishDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelReestablishDecodeErrorZ), "LDKCResult_ChannelReestablishDecodeErrorZ");
24308         *ret_conv = CResult_ChannelReestablishDecodeErrorZ_ok(o_conv);
24309         return tag_ptr(ret_conv, true);
24310 }
24311
24312 uint64_t  __attribute__((export_name("TS_CResult_ChannelReestablishDecodeErrorZ_err"))) TS_CResult_ChannelReestablishDecodeErrorZ_err(uint64_t e) {
24313         void* e_ptr = untag_ptr(e);
24314         CHECK_ACCESS(e_ptr);
24315         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
24316         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
24317         LDKCResult_ChannelReestablishDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelReestablishDecodeErrorZ), "LDKCResult_ChannelReestablishDecodeErrorZ");
24318         *ret_conv = CResult_ChannelReestablishDecodeErrorZ_err(e_conv);
24319         return tag_ptr(ret_conv, true);
24320 }
24321
24322 jboolean  __attribute__((export_name("TS_CResult_ChannelReestablishDecodeErrorZ_is_ok"))) TS_CResult_ChannelReestablishDecodeErrorZ_is_ok(uint64_t o) {
24323         LDKCResult_ChannelReestablishDecodeErrorZ* o_conv = (LDKCResult_ChannelReestablishDecodeErrorZ*)untag_ptr(o);
24324         jboolean ret_conv = CResult_ChannelReestablishDecodeErrorZ_is_ok(o_conv);
24325         return ret_conv;
24326 }
24327
24328 void  __attribute__((export_name("TS_CResult_ChannelReestablishDecodeErrorZ_free"))) TS_CResult_ChannelReestablishDecodeErrorZ_free(uint64_t _res) {
24329         if (!ptr_is_owned(_res)) return;
24330         void* _res_ptr = untag_ptr(_res);
24331         CHECK_ACCESS(_res_ptr);
24332         LDKCResult_ChannelReestablishDecodeErrorZ _res_conv = *(LDKCResult_ChannelReestablishDecodeErrorZ*)(_res_ptr);
24333         FREE(untag_ptr(_res));
24334         CResult_ChannelReestablishDecodeErrorZ_free(_res_conv);
24335 }
24336
24337 static inline uint64_t CResult_ChannelReestablishDecodeErrorZ_clone_ptr(LDKCResult_ChannelReestablishDecodeErrorZ *NONNULL_PTR arg) {
24338         LDKCResult_ChannelReestablishDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelReestablishDecodeErrorZ), "LDKCResult_ChannelReestablishDecodeErrorZ");
24339         *ret_conv = CResult_ChannelReestablishDecodeErrorZ_clone(arg);
24340         return tag_ptr(ret_conv, true);
24341 }
24342 int64_t  __attribute__((export_name("TS_CResult_ChannelReestablishDecodeErrorZ_clone_ptr"))) TS_CResult_ChannelReestablishDecodeErrorZ_clone_ptr(uint64_t arg) {
24343         LDKCResult_ChannelReestablishDecodeErrorZ* arg_conv = (LDKCResult_ChannelReestablishDecodeErrorZ*)untag_ptr(arg);
24344         int64_t ret_conv = CResult_ChannelReestablishDecodeErrorZ_clone_ptr(arg_conv);
24345         return ret_conv;
24346 }
24347
24348 uint64_t  __attribute__((export_name("TS_CResult_ChannelReestablishDecodeErrorZ_clone"))) TS_CResult_ChannelReestablishDecodeErrorZ_clone(uint64_t orig) {
24349         LDKCResult_ChannelReestablishDecodeErrorZ* orig_conv = (LDKCResult_ChannelReestablishDecodeErrorZ*)untag_ptr(orig);
24350         LDKCResult_ChannelReestablishDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelReestablishDecodeErrorZ), "LDKCResult_ChannelReestablishDecodeErrorZ");
24351         *ret_conv = CResult_ChannelReestablishDecodeErrorZ_clone(orig_conv);
24352         return tag_ptr(ret_conv, true);
24353 }
24354
24355 uint64_t  __attribute__((export_name("TS_CResult_ClosingSignedDecodeErrorZ_ok"))) TS_CResult_ClosingSignedDecodeErrorZ_ok(uint64_t o) {
24356         LDKClosingSigned o_conv;
24357         o_conv.inner = untag_ptr(o);
24358         o_conv.is_owned = ptr_is_owned(o);
24359         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
24360         o_conv = ClosingSigned_clone(&o_conv);
24361         LDKCResult_ClosingSignedDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ClosingSignedDecodeErrorZ), "LDKCResult_ClosingSignedDecodeErrorZ");
24362         *ret_conv = CResult_ClosingSignedDecodeErrorZ_ok(o_conv);
24363         return tag_ptr(ret_conv, true);
24364 }
24365
24366 uint64_t  __attribute__((export_name("TS_CResult_ClosingSignedDecodeErrorZ_err"))) TS_CResult_ClosingSignedDecodeErrorZ_err(uint64_t e) {
24367         void* e_ptr = untag_ptr(e);
24368         CHECK_ACCESS(e_ptr);
24369         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
24370         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
24371         LDKCResult_ClosingSignedDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ClosingSignedDecodeErrorZ), "LDKCResult_ClosingSignedDecodeErrorZ");
24372         *ret_conv = CResult_ClosingSignedDecodeErrorZ_err(e_conv);
24373         return tag_ptr(ret_conv, true);
24374 }
24375
24376 jboolean  __attribute__((export_name("TS_CResult_ClosingSignedDecodeErrorZ_is_ok"))) TS_CResult_ClosingSignedDecodeErrorZ_is_ok(uint64_t o) {
24377         LDKCResult_ClosingSignedDecodeErrorZ* o_conv = (LDKCResult_ClosingSignedDecodeErrorZ*)untag_ptr(o);
24378         jboolean ret_conv = CResult_ClosingSignedDecodeErrorZ_is_ok(o_conv);
24379         return ret_conv;
24380 }
24381
24382 void  __attribute__((export_name("TS_CResult_ClosingSignedDecodeErrorZ_free"))) TS_CResult_ClosingSignedDecodeErrorZ_free(uint64_t _res) {
24383         if (!ptr_is_owned(_res)) return;
24384         void* _res_ptr = untag_ptr(_res);
24385         CHECK_ACCESS(_res_ptr);
24386         LDKCResult_ClosingSignedDecodeErrorZ _res_conv = *(LDKCResult_ClosingSignedDecodeErrorZ*)(_res_ptr);
24387         FREE(untag_ptr(_res));
24388         CResult_ClosingSignedDecodeErrorZ_free(_res_conv);
24389 }
24390
24391 static inline uint64_t CResult_ClosingSignedDecodeErrorZ_clone_ptr(LDKCResult_ClosingSignedDecodeErrorZ *NONNULL_PTR arg) {
24392         LDKCResult_ClosingSignedDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ClosingSignedDecodeErrorZ), "LDKCResult_ClosingSignedDecodeErrorZ");
24393         *ret_conv = CResult_ClosingSignedDecodeErrorZ_clone(arg);
24394         return tag_ptr(ret_conv, true);
24395 }
24396 int64_t  __attribute__((export_name("TS_CResult_ClosingSignedDecodeErrorZ_clone_ptr"))) TS_CResult_ClosingSignedDecodeErrorZ_clone_ptr(uint64_t arg) {
24397         LDKCResult_ClosingSignedDecodeErrorZ* arg_conv = (LDKCResult_ClosingSignedDecodeErrorZ*)untag_ptr(arg);
24398         int64_t ret_conv = CResult_ClosingSignedDecodeErrorZ_clone_ptr(arg_conv);
24399         return ret_conv;
24400 }
24401
24402 uint64_t  __attribute__((export_name("TS_CResult_ClosingSignedDecodeErrorZ_clone"))) TS_CResult_ClosingSignedDecodeErrorZ_clone(uint64_t orig) {
24403         LDKCResult_ClosingSignedDecodeErrorZ* orig_conv = (LDKCResult_ClosingSignedDecodeErrorZ*)untag_ptr(orig);
24404         LDKCResult_ClosingSignedDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ClosingSignedDecodeErrorZ), "LDKCResult_ClosingSignedDecodeErrorZ");
24405         *ret_conv = CResult_ClosingSignedDecodeErrorZ_clone(orig_conv);
24406         return tag_ptr(ret_conv, true);
24407 }
24408
24409 uint64_t  __attribute__((export_name("TS_CResult_ClosingSignedFeeRangeDecodeErrorZ_ok"))) TS_CResult_ClosingSignedFeeRangeDecodeErrorZ_ok(uint64_t o) {
24410         LDKClosingSignedFeeRange o_conv;
24411         o_conv.inner = untag_ptr(o);
24412         o_conv.is_owned = ptr_is_owned(o);
24413         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
24414         o_conv = ClosingSignedFeeRange_clone(&o_conv);
24415         LDKCResult_ClosingSignedFeeRangeDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ClosingSignedFeeRangeDecodeErrorZ), "LDKCResult_ClosingSignedFeeRangeDecodeErrorZ");
24416         *ret_conv = CResult_ClosingSignedFeeRangeDecodeErrorZ_ok(o_conv);
24417         return tag_ptr(ret_conv, true);
24418 }
24419
24420 uint64_t  __attribute__((export_name("TS_CResult_ClosingSignedFeeRangeDecodeErrorZ_err"))) TS_CResult_ClosingSignedFeeRangeDecodeErrorZ_err(uint64_t e) {
24421         void* e_ptr = untag_ptr(e);
24422         CHECK_ACCESS(e_ptr);
24423         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
24424         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
24425         LDKCResult_ClosingSignedFeeRangeDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ClosingSignedFeeRangeDecodeErrorZ), "LDKCResult_ClosingSignedFeeRangeDecodeErrorZ");
24426         *ret_conv = CResult_ClosingSignedFeeRangeDecodeErrorZ_err(e_conv);
24427         return tag_ptr(ret_conv, true);
24428 }
24429
24430 jboolean  __attribute__((export_name("TS_CResult_ClosingSignedFeeRangeDecodeErrorZ_is_ok"))) TS_CResult_ClosingSignedFeeRangeDecodeErrorZ_is_ok(uint64_t o) {
24431         LDKCResult_ClosingSignedFeeRangeDecodeErrorZ* o_conv = (LDKCResult_ClosingSignedFeeRangeDecodeErrorZ*)untag_ptr(o);
24432         jboolean ret_conv = CResult_ClosingSignedFeeRangeDecodeErrorZ_is_ok(o_conv);
24433         return ret_conv;
24434 }
24435
24436 void  __attribute__((export_name("TS_CResult_ClosingSignedFeeRangeDecodeErrorZ_free"))) TS_CResult_ClosingSignedFeeRangeDecodeErrorZ_free(uint64_t _res) {
24437         if (!ptr_is_owned(_res)) return;
24438         void* _res_ptr = untag_ptr(_res);
24439         CHECK_ACCESS(_res_ptr);
24440         LDKCResult_ClosingSignedFeeRangeDecodeErrorZ _res_conv = *(LDKCResult_ClosingSignedFeeRangeDecodeErrorZ*)(_res_ptr);
24441         FREE(untag_ptr(_res));
24442         CResult_ClosingSignedFeeRangeDecodeErrorZ_free(_res_conv);
24443 }
24444
24445 static inline uint64_t CResult_ClosingSignedFeeRangeDecodeErrorZ_clone_ptr(LDKCResult_ClosingSignedFeeRangeDecodeErrorZ *NONNULL_PTR arg) {
24446         LDKCResult_ClosingSignedFeeRangeDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ClosingSignedFeeRangeDecodeErrorZ), "LDKCResult_ClosingSignedFeeRangeDecodeErrorZ");
24447         *ret_conv = CResult_ClosingSignedFeeRangeDecodeErrorZ_clone(arg);
24448         return tag_ptr(ret_conv, true);
24449 }
24450 int64_t  __attribute__((export_name("TS_CResult_ClosingSignedFeeRangeDecodeErrorZ_clone_ptr"))) TS_CResult_ClosingSignedFeeRangeDecodeErrorZ_clone_ptr(uint64_t arg) {
24451         LDKCResult_ClosingSignedFeeRangeDecodeErrorZ* arg_conv = (LDKCResult_ClosingSignedFeeRangeDecodeErrorZ*)untag_ptr(arg);
24452         int64_t ret_conv = CResult_ClosingSignedFeeRangeDecodeErrorZ_clone_ptr(arg_conv);
24453         return ret_conv;
24454 }
24455
24456 uint64_t  __attribute__((export_name("TS_CResult_ClosingSignedFeeRangeDecodeErrorZ_clone"))) TS_CResult_ClosingSignedFeeRangeDecodeErrorZ_clone(uint64_t orig) {
24457         LDKCResult_ClosingSignedFeeRangeDecodeErrorZ* orig_conv = (LDKCResult_ClosingSignedFeeRangeDecodeErrorZ*)untag_ptr(orig);
24458         LDKCResult_ClosingSignedFeeRangeDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ClosingSignedFeeRangeDecodeErrorZ), "LDKCResult_ClosingSignedFeeRangeDecodeErrorZ");
24459         *ret_conv = CResult_ClosingSignedFeeRangeDecodeErrorZ_clone(orig_conv);
24460         return tag_ptr(ret_conv, true);
24461 }
24462
24463 uint64_t  __attribute__((export_name("TS_CResult_CommitmentSignedDecodeErrorZ_ok"))) TS_CResult_CommitmentSignedDecodeErrorZ_ok(uint64_t o) {
24464         LDKCommitmentSigned o_conv;
24465         o_conv.inner = untag_ptr(o);
24466         o_conv.is_owned = ptr_is_owned(o);
24467         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
24468         o_conv = CommitmentSigned_clone(&o_conv);
24469         LDKCResult_CommitmentSignedDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CommitmentSignedDecodeErrorZ), "LDKCResult_CommitmentSignedDecodeErrorZ");
24470         *ret_conv = CResult_CommitmentSignedDecodeErrorZ_ok(o_conv);
24471         return tag_ptr(ret_conv, true);
24472 }
24473
24474 uint64_t  __attribute__((export_name("TS_CResult_CommitmentSignedDecodeErrorZ_err"))) TS_CResult_CommitmentSignedDecodeErrorZ_err(uint64_t e) {
24475         void* e_ptr = untag_ptr(e);
24476         CHECK_ACCESS(e_ptr);
24477         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
24478         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
24479         LDKCResult_CommitmentSignedDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CommitmentSignedDecodeErrorZ), "LDKCResult_CommitmentSignedDecodeErrorZ");
24480         *ret_conv = CResult_CommitmentSignedDecodeErrorZ_err(e_conv);
24481         return tag_ptr(ret_conv, true);
24482 }
24483
24484 jboolean  __attribute__((export_name("TS_CResult_CommitmentSignedDecodeErrorZ_is_ok"))) TS_CResult_CommitmentSignedDecodeErrorZ_is_ok(uint64_t o) {
24485         LDKCResult_CommitmentSignedDecodeErrorZ* o_conv = (LDKCResult_CommitmentSignedDecodeErrorZ*)untag_ptr(o);
24486         jboolean ret_conv = CResult_CommitmentSignedDecodeErrorZ_is_ok(o_conv);
24487         return ret_conv;
24488 }
24489
24490 void  __attribute__((export_name("TS_CResult_CommitmentSignedDecodeErrorZ_free"))) TS_CResult_CommitmentSignedDecodeErrorZ_free(uint64_t _res) {
24491         if (!ptr_is_owned(_res)) return;
24492         void* _res_ptr = untag_ptr(_res);
24493         CHECK_ACCESS(_res_ptr);
24494         LDKCResult_CommitmentSignedDecodeErrorZ _res_conv = *(LDKCResult_CommitmentSignedDecodeErrorZ*)(_res_ptr);
24495         FREE(untag_ptr(_res));
24496         CResult_CommitmentSignedDecodeErrorZ_free(_res_conv);
24497 }
24498
24499 static inline uint64_t CResult_CommitmentSignedDecodeErrorZ_clone_ptr(LDKCResult_CommitmentSignedDecodeErrorZ *NONNULL_PTR arg) {
24500         LDKCResult_CommitmentSignedDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CommitmentSignedDecodeErrorZ), "LDKCResult_CommitmentSignedDecodeErrorZ");
24501         *ret_conv = CResult_CommitmentSignedDecodeErrorZ_clone(arg);
24502         return tag_ptr(ret_conv, true);
24503 }
24504 int64_t  __attribute__((export_name("TS_CResult_CommitmentSignedDecodeErrorZ_clone_ptr"))) TS_CResult_CommitmentSignedDecodeErrorZ_clone_ptr(uint64_t arg) {
24505         LDKCResult_CommitmentSignedDecodeErrorZ* arg_conv = (LDKCResult_CommitmentSignedDecodeErrorZ*)untag_ptr(arg);
24506         int64_t ret_conv = CResult_CommitmentSignedDecodeErrorZ_clone_ptr(arg_conv);
24507         return ret_conv;
24508 }
24509
24510 uint64_t  __attribute__((export_name("TS_CResult_CommitmentSignedDecodeErrorZ_clone"))) TS_CResult_CommitmentSignedDecodeErrorZ_clone(uint64_t orig) {
24511         LDKCResult_CommitmentSignedDecodeErrorZ* orig_conv = (LDKCResult_CommitmentSignedDecodeErrorZ*)untag_ptr(orig);
24512         LDKCResult_CommitmentSignedDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CommitmentSignedDecodeErrorZ), "LDKCResult_CommitmentSignedDecodeErrorZ");
24513         *ret_conv = CResult_CommitmentSignedDecodeErrorZ_clone(orig_conv);
24514         return tag_ptr(ret_conv, true);
24515 }
24516
24517 uint64_t  __attribute__((export_name("TS_CResult_FundingCreatedDecodeErrorZ_ok"))) TS_CResult_FundingCreatedDecodeErrorZ_ok(uint64_t o) {
24518         LDKFundingCreated o_conv;
24519         o_conv.inner = untag_ptr(o);
24520         o_conv.is_owned = ptr_is_owned(o);
24521         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
24522         o_conv = FundingCreated_clone(&o_conv);
24523         LDKCResult_FundingCreatedDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_FundingCreatedDecodeErrorZ), "LDKCResult_FundingCreatedDecodeErrorZ");
24524         *ret_conv = CResult_FundingCreatedDecodeErrorZ_ok(o_conv);
24525         return tag_ptr(ret_conv, true);
24526 }
24527
24528 uint64_t  __attribute__((export_name("TS_CResult_FundingCreatedDecodeErrorZ_err"))) TS_CResult_FundingCreatedDecodeErrorZ_err(uint64_t e) {
24529         void* e_ptr = untag_ptr(e);
24530         CHECK_ACCESS(e_ptr);
24531         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
24532         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
24533         LDKCResult_FundingCreatedDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_FundingCreatedDecodeErrorZ), "LDKCResult_FundingCreatedDecodeErrorZ");
24534         *ret_conv = CResult_FundingCreatedDecodeErrorZ_err(e_conv);
24535         return tag_ptr(ret_conv, true);
24536 }
24537
24538 jboolean  __attribute__((export_name("TS_CResult_FundingCreatedDecodeErrorZ_is_ok"))) TS_CResult_FundingCreatedDecodeErrorZ_is_ok(uint64_t o) {
24539         LDKCResult_FundingCreatedDecodeErrorZ* o_conv = (LDKCResult_FundingCreatedDecodeErrorZ*)untag_ptr(o);
24540         jboolean ret_conv = CResult_FundingCreatedDecodeErrorZ_is_ok(o_conv);
24541         return ret_conv;
24542 }
24543
24544 void  __attribute__((export_name("TS_CResult_FundingCreatedDecodeErrorZ_free"))) TS_CResult_FundingCreatedDecodeErrorZ_free(uint64_t _res) {
24545         if (!ptr_is_owned(_res)) return;
24546         void* _res_ptr = untag_ptr(_res);
24547         CHECK_ACCESS(_res_ptr);
24548         LDKCResult_FundingCreatedDecodeErrorZ _res_conv = *(LDKCResult_FundingCreatedDecodeErrorZ*)(_res_ptr);
24549         FREE(untag_ptr(_res));
24550         CResult_FundingCreatedDecodeErrorZ_free(_res_conv);
24551 }
24552
24553 static inline uint64_t CResult_FundingCreatedDecodeErrorZ_clone_ptr(LDKCResult_FundingCreatedDecodeErrorZ *NONNULL_PTR arg) {
24554         LDKCResult_FundingCreatedDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_FundingCreatedDecodeErrorZ), "LDKCResult_FundingCreatedDecodeErrorZ");
24555         *ret_conv = CResult_FundingCreatedDecodeErrorZ_clone(arg);
24556         return tag_ptr(ret_conv, true);
24557 }
24558 int64_t  __attribute__((export_name("TS_CResult_FundingCreatedDecodeErrorZ_clone_ptr"))) TS_CResult_FundingCreatedDecodeErrorZ_clone_ptr(uint64_t arg) {
24559         LDKCResult_FundingCreatedDecodeErrorZ* arg_conv = (LDKCResult_FundingCreatedDecodeErrorZ*)untag_ptr(arg);
24560         int64_t ret_conv = CResult_FundingCreatedDecodeErrorZ_clone_ptr(arg_conv);
24561         return ret_conv;
24562 }
24563
24564 uint64_t  __attribute__((export_name("TS_CResult_FundingCreatedDecodeErrorZ_clone"))) TS_CResult_FundingCreatedDecodeErrorZ_clone(uint64_t orig) {
24565         LDKCResult_FundingCreatedDecodeErrorZ* orig_conv = (LDKCResult_FundingCreatedDecodeErrorZ*)untag_ptr(orig);
24566         LDKCResult_FundingCreatedDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_FundingCreatedDecodeErrorZ), "LDKCResult_FundingCreatedDecodeErrorZ");
24567         *ret_conv = CResult_FundingCreatedDecodeErrorZ_clone(orig_conv);
24568         return tag_ptr(ret_conv, true);
24569 }
24570
24571 uint64_t  __attribute__((export_name("TS_CResult_FundingSignedDecodeErrorZ_ok"))) TS_CResult_FundingSignedDecodeErrorZ_ok(uint64_t o) {
24572         LDKFundingSigned o_conv;
24573         o_conv.inner = untag_ptr(o);
24574         o_conv.is_owned = ptr_is_owned(o);
24575         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
24576         o_conv = FundingSigned_clone(&o_conv);
24577         LDKCResult_FundingSignedDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_FundingSignedDecodeErrorZ), "LDKCResult_FundingSignedDecodeErrorZ");
24578         *ret_conv = CResult_FundingSignedDecodeErrorZ_ok(o_conv);
24579         return tag_ptr(ret_conv, true);
24580 }
24581
24582 uint64_t  __attribute__((export_name("TS_CResult_FundingSignedDecodeErrorZ_err"))) TS_CResult_FundingSignedDecodeErrorZ_err(uint64_t e) {
24583         void* e_ptr = untag_ptr(e);
24584         CHECK_ACCESS(e_ptr);
24585         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
24586         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
24587         LDKCResult_FundingSignedDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_FundingSignedDecodeErrorZ), "LDKCResult_FundingSignedDecodeErrorZ");
24588         *ret_conv = CResult_FundingSignedDecodeErrorZ_err(e_conv);
24589         return tag_ptr(ret_conv, true);
24590 }
24591
24592 jboolean  __attribute__((export_name("TS_CResult_FundingSignedDecodeErrorZ_is_ok"))) TS_CResult_FundingSignedDecodeErrorZ_is_ok(uint64_t o) {
24593         LDKCResult_FundingSignedDecodeErrorZ* o_conv = (LDKCResult_FundingSignedDecodeErrorZ*)untag_ptr(o);
24594         jboolean ret_conv = CResult_FundingSignedDecodeErrorZ_is_ok(o_conv);
24595         return ret_conv;
24596 }
24597
24598 void  __attribute__((export_name("TS_CResult_FundingSignedDecodeErrorZ_free"))) TS_CResult_FundingSignedDecodeErrorZ_free(uint64_t _res) {
24599         if (!ptr_is_owned(_res)) return;
24600         void* _res_ptr = untag_ptr(_res);
24601         CHECK_ACCESS(_res_ptr);
24602         LDKCResult_FundingSignedDecodeErrorZ _res_conv = *(LDKCResult_FundingSignedDecodeErrorZ*)(_res_ptr);
24603         FREE(untag_ptr(_res));
24604         CResult_FundingSignedDecodeErrorZ_free(_res_conv);
24605 }
24606
24607 static inline uint64_t CResult_FundingSignedDecodeErrorZ_clone_ptr(LDKCResult_FundingSignedDecodeErrorZ *NONNULL_PTR arg) {
24608         LDKCResult_FundingSignedDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_FundingSignedDecodeErrorZ), "LDKCResult_FundingSignedDecodeErrorZ");
24609         *ret_conv = CResult_FundingSignedDecodeErrorZ_clone(arg);
24610         return tag_ptr(ret_conv, true);
24611 }
24612 int64_t  __attribute__((export_name("TS_CResult_FundingSignedDecodeErrorZ_clone_ptr"))) TS_CResult_FundingSignedDecodeErrorZ_clone_ptr(uint64_t arg) {
24613         LDKCResult_FundingSignedDecodeErrorZ* arg_conv = (LDKCResult_FundingSignedDecodeErrorZ*)untag_ptr(arg);
24614         int64_t ret_conv = CResult_FundingSignedDecodeErrorZ_clone_ptr(arg_conv);
24615         return ret_conv;
24616 }
24617
24618 uint64_t  __attribute__((export_name("TS_CResult_FundingSignedDecodeErrorZ_clone"))) TS_CResult_FundingSignedDecodeErrorZ_clone(uint64_t orig) {
24619         LDKCResult_FundingSignedDecodeErrorZ* orig_conv = (LDKCResult_FundingSignedDecodeErrorZ*)untag_ptr(orig);
24620         LDKCResult_FundingSignedDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_FundingSignedDecodeErrorZ), "LDKCResult_FundingSignedDecodeErrorZ");
24621         *ret_conv = CResult_FundingSignedDecodeErrorZ_clone(orig_conv);
24622         return tag_ptr(ret_conv, true);
24623 }
24624
24625 uint64_t  __attribute__((export_name("TS_CResult_ChannelReadyDecodeErrorZ_ok"))) TS_CResult_ChannelReadyDecodeErrorZ_ok(uint64_t o) {
24626         LDKChannelReady o_conv;
24627         o_conv.inner = untag_ptr(o);
24628         o_conv.is_owned = ptr_is_owned(o);
24629         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
24630         o_conv = ChannelReady_clone(&o_conv);
24631         LDKCResult_ChannelReadyDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelReadyDecodeErrorZ), "LDKCResult_ChannelReadyDecodeErrorZ");
24632         *ret_conv = CResult_ChannelReadyDecodeErrorZ_ok(o_conv);
24633         return tag_ptr(ret_conv, true);
24634 }
24635
24636 uint64_t  __attribute__((export_name("TS_CResult_ChannelReadyDecodeErrorZ_err"))) TS_CResult_ChannelReadyDecodeErrorZ_err(uint64_t e) {
24637         void* e_ptr = untag_ptr(e);
24638         CHECK_ACCESS(e_ptr);
24639         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
24640         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
24641         LDKCResult_ChannelReadyDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelReadyDecodeErrorZ), "LDKCResult_ChannelReadyDecodeErrorZ");
24642         *ret_conv = CResult_ChannelReadyDecodeErrorZ_err(e_conv);
24643         return tag_ptr(ret_conv, true);
24644 }
24645
24646 jboolean  __attribute__((export_name("TS_CResult_ChannelReadyDecodeErrorZ_is_ok"))) TS_CResult_ChannelReadyDecodeErrorZ_is_ok(uint64_t o) {
24647         LDKCResult_ChannelReadyDecodeErrorZ* o_conv = (LDKCResult_ChannelReadyDecodeErrorZ*)untag_ptr(o);
24648         jboolean ret_conv = CResult_ChannelReadyDecodeErrorZ_is_ok(o_conv);
24649         return ret_conv;
24650 }
24651
24652 void  __attribute__((export_name("TS_CResult_ChannelReadyDecodeErrorZ_free"))) TS_CResult_ChannelReadyDecodeErrorZ_free(uint64_t _res) {
24653         if (!ptr_is_owned(_res)) return;
24654         void* _res_ptr = untag_ptr(_res);
24655         CHECK_ACCESS(_res_ptr);
24656         LDKCResult_ChannelReadyDecodeErrorZ _res_conv = *(LDKCResult_ChannelReadyDecodeErrorZ*)(_res_ptr);
24657         FREE(untag_ptr(_res));
24658         CResult_ChannelReadyDecodeErrorZ_free(_res_conv);
24659 }
24660
24661 static inline uint64_t CResult_ChannelReadyDecodeErrorZ_clone_ptr(LDKCResult_ChannelReadyDecodeErrorZ *NONNULL_PTR arg) {
24662         LDKCResult_ChannelReadyDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelReadyDecodeErrorZ), "LDKCResult_ChannelReadyDecodeErrorZ");
24663         *ret_conv = CResult_ChannelReadyDecodeErrorZ_clone(arg);
24664         return tag_ptr(ret_conv, true);
24665 }
24666 int64_t  __attribute__((export_name("TS_CResult_ChannelReadyDecodeErrorZ_clone_ptr"))) TS_CResult_ChannelReadyDecodeErrorZ_clone_ptr(uint64_t arg) {
24667         LDKCResult_ChannelReadyDecodeErrorZ* arg_conv = (LDKCResult_ChannelReadyDecodeErrorZ*)untag_ptr(arg);
24668         int64_t ret_conv = CResult_ChannelReadyDecodeErrorZ_clone_ptr(arg_conv);
24669         return ret_conv;
24670 }
24671
24672 uint64_t  __attribute__((export_name("TS_CResult_ChannelReadyDecodeErrorZ_clone"))) TS_CResult_ChannelReadyDecodeErrorZ_clone(uint64_t orig) {
24673         LDKCResult_ChannelReadyDecodeErrorZ* orig_conv = (LDKCResult_ChannelReadyDecodeErrorZ*)untag_ptr(orig);
24674         LDKCResult_ChannelReadyDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelReadyDecodeErrorZ), "LDKCResult_ChannelReadyDecodeErrorZ");
24675         *ret_conv = CResult_ChannelReadyDecodeErrorZ_clone(orig_conv);
24676         return tag_ptr(ret_conv, true);
24677 }
24678
24679 uint64_t  __attribute__((export_name("TS_CResult_InitDecodeErrorZ_ok"))) TS_CResult_InitDecodeErrorZ_ok(uint64_t o) {
24680         LDKInit o_conv;
24681         o_conv.inner = untag_ptr(o);
24682         o_conv.is_owned = ptr_is_owned(o);
24683         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
24684         o_conv = Init_clone(&o_conv);
24685         LDKCResult_InitDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InitDecodeErrorZ), "LDKCResult_InitDecodeErrorZ");
24686         *ret_conv = CResult_InitDecodeErrorZ_ok(o_conv);
24687         return tag_ptr(ret_conv, true);
24688 }
24689
24690 uint64_t  __attribute__((export_name("TS_CResult_InitDecodeErrorZ_err"))) TS_CResult_InitDecodeErrorZ_err(uint64_t e) {
24691         void* e_ptr = untag_ptr(e);
24692         CHECK_ACCESS(e_ptr);
24693         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
24694         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
24695         LDKCResult_InitDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InitDecodeErrorZ), "LDKCResult_InitDecodeErrorZ");
24696         *ret_conv = CResult_InitDecodeErrorZ_err(e_conv);
24697         return tag_ptr(ret_conv, true);
24698 }
24699
24700 jboolean  __attribute__((export_name("TS_CResult_InitDecodeErrorZ_is_ok"))) TS_CResult_InitDecodeErrorZ_is_ok(uint64_t o) {
24701         LDKCResult_InitDecodeErrorZ* o_conv = (LDKCResult_InitDecodeErrorZ*)untag_ptr(o);
24702         jboolean ret_conv = CResult_InitDecodeErrorZ_is_ok(o_conv);
24703         return ret_conv;
24704 }
24705
24706 void  __attribute__((export_name("TS_CResult_InitDecodeErrorZ_free"))) TS_CResult_InitDecodeErrorZ_free(uint64_t _res) {
24707         if (!ptr_is_owned(_res)) return;
24708         void* _res_ptr = untag_ptr(_res);
24709         CHECK_ACCESS(_res_ptr);
24710         LDKCResult_InitDecodeErrorZ _res_conv = *(LDKCResult_InitDecodeErrorZ*)(_res_ptr);
24711         FREE(untag_ptr(_res));
24712         CResult_InitDecodeErrorZ_free(_res_conv);
24713 }
24714
24715 static inline uint64_t CResult_InitDecodeErrorZ_clone_ptr(LDKCResult_InitDecodeErrorZ *NONNULL_PTR arg) {
24716         LDKCResult_InitDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InitDecodeErrorZ), "LDKCResult_InitDecodeErrorZ");
24717         *ret_conv = CResult_InitDecodeErrorZ_clone(arg);
24718         return tag_ptr(ret_conv, true);
24719 }
24720 int64_t  __attribute__((export_name("TS_CResult_InitDecodeErrorZ_clone_ptr"))) TS_CResult_InitDecodeErrorZ_clone_ptr(uint64_t arg) {
24721         LDKCResult_InitDecodeErrorZ* arg_conv = (LDKCResult_InitDecodeErrorZ*)untag_ptr(arg);
24722         int64_t ret_conv = CResult_InitDecodeErrorZ_clone_ptr(arg_conv);
24723         return ret_conv;
24724 }
24725
24726 uint64_t  __attribute__((export_name("TS_CResult_InitDecodeErrorZ_clone"))) TS_CResult_InitDecodeErrorZ_clone(uint64_t orig) {
24727         LDKCResult_InitDecodeErrorZ* orig_conv = (LDKCResult_InitDecodeErrorZ*)untag_ptr(orig);
24728         LDKCResult_InitDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InitDecodeErrorZ), "LDKCResult_InitDecodeErrorZ");
24729         *ret_conv = CResult_InitDecodeErrorZ_clone(orig_conv);
24730         return tag_ptr(ret_conv, true);
24731 }
24732
24733 uint64_t  __attribute__((export_name("TS_CResult_OpenChannelDecodeErrorZ_ok"))) TS_CResult_OpenChannelDecodeErrorZ_ok(uint64_t o) {
24734         LDKOpenChannel o_conv;
24735         o_conv.inner = untag_ptr(o);
24736         o_conv.is_owned = ptr_is_owned(o);
24737         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
24738         o_conv = OpenChannel_clone(&o_conv);
24739         LDKCResult_OpenChannelDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_OpenChannelDecodeErrorZ), "LDKCResult_OpenChannelDecodeErrorZ");
24740         *ret_conv = CResult_OpenChannelDecodeErrorZ_ok(o_conv);
24741         return tag_ptr(ret_conv, true);
24742 }
24743
24744 uint64_t  __attribute__((export_name("TS_CResult_OpenChannelDecodeErrorZ_err"))) TS_CResult_OpenChannelDecodeErrorZ_err(uint64_t e) {
24745         void* e_ptr = untag_ptr(e);
24746         CHECK_ACCESS(e_ptr);
24747         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
24748         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
24749         LDKCResult_OpenChannelDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_OpenChannelDecodeErrorZ), "LDKCResult_OpenChannelDecodeErrorZ");
24750         *ret_conv = CResult_OpenChannelDecodeErrorZ_err(e_conv);
24751         return tag_ptr(ret_conv, true);
24752 }
24753
24754 jboolean  __attribute__((export_name("TS_CResult_OpenChannelDecodeErrorZ_is_ok"))) TS_CResult_OpenChannelDecodeErrorZ_is_ok(uint64_t o) {
24755         LDKCResult_OpenChannelDecodeErrorZ* o_conv = (LDKCResult_OpenChannelDecodeErrorZ*)untag_ptr(o);
24756         jboolean ret_conv = CResult_OpenChannelDecodeErrorZ_is_ok(o_conv);
24757         return ret_conv;
24758 }
24759
24760 void  __attribute__((export_name("TS_CResult_OpenChannelDecodeErrorZ_free"))) TS_CResult_OpenChannelDecodeErrorZ_free(uint64_t _res) {
24761         if (!ptr_is_owned(_res)) return;
24762         void* _res_ptr = untag_ptr(_res);
24763         CHECK_ACCESS(_res_ptr);
24764         LDKCResult_OpenChannelDecodeErrorZ _res_conv = *(LDKCResult_OpenChannelDecodeErrorZ*)(_res_ptr);
24765         FREE(untag_ptr(_res));
24766         CResult_OpenChannelDecodeErrorZ_free(_res_conv);
24767 }
24768
24769 static inline uint64_t CResult_OpenChannelDecodeErrorZ_clone_ptr(LDKCResult_OpenChannelDecodeErrorZ *NONNULL_PTR arg) {
24770         LDKCResult_OpenChannelDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_OpenChannelDecodeErrorZ), "LDKCResult_OpenChannelDecodeErrorZ");
24771         *ret_conv = CResult_OpenChannelDecodeErrorZ_clone(arg);
24772         return tag_ptr(ret_conv, true);
24773 }
24774 int64_t  __attribute__((export_name("TS_CResult_OpenChannelDecodeErrorZ_clone_ptr"))) TS_CResult_OpenChannelDecodeErrorZ_clone_ptr(uint64_t arg) {
24775         LDKCResult_OpenChannelDecodeErrorZ* arg_conv = (LDKCResult_OpenChannelDecodeErrorZ*)untag_ptr(arg);
24776         int64_t ret_conv = CResult_OpenChannelDecodeErrorZ_clone_ptr(arg_conv);
24777         return ret_conv;
24778 }
24779
24780 uint64_t  __attribute__((export_name("TS_CResult_OpenChannelDecodeErrorZ_clone"))) TS_CResult_OpenChannelDecodeErrorZ_clone(uint64_t orig) {
24781         LDKCResult_OpenChannelDecodeErrorZ* orig_conv = (LDKCResult_OpenChannelDecodeErrorZ*)untag_ptr(orig);
24782         LDKCResult_OpenChannelDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_OpenChannelDecodeErrorZ), "LDKCResult_OpenChannelDecodeErrorZ");
24783         *ret_conv = CResult_OpenChannelDecodeErrorZ_clone(orig_conv);
24784         return tag_ptr(ret_conv, true);
24785 }
24786
24787 uint64_t  __attribute__((export_name("TS_CResult_OpenChannelV2DecodeErrorZ_ok"))) TS_CResult_OpenChannelV2DecodeErrorZ_ok(uint64_t o) {
24788         LDKOpenChannelV2 o_conv;
24789         o_conv.inner = untag_ptr(o);
24790         o_conv.is_owned = ptr_is_owned(o);
24791         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
24792         o_conv = OpenChannelV2_clone(&o_conv);
24793         LDKCResult_OpenChannelV2DecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_OpenChannelV2DecodeErrorZ), "LDKCResult_OpenChannelV2DecodeErrorZ");
24794         *ret_conv = CResult_OpenChannelV2DecodeErrorZ_ok(o_conv);
24795         return tag_ptr(ret_conv, true);
24796 }
24797
24798 uint64_t  __attribute__((export_name("TS_CResult_OpenChannelV2DecodeErrorZ_err"))) TS_CResult_OpenChannelV2DecodeErrorZ_err(uint64_t e) {
24799         void* e_ptr = untag_ptr(e);
24800         CHECK_ACCESS(e_ptr);
24801         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
24802         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
24803         LDKCResult_OpenChannelV2DecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_OpenChannelV2DecodeErrorZ), "LDKCResult_OpenChannelV2DecodeErrorZ");
24804         *ret_conv = CResult_OpenChannelV2DecodeErrorZ_err(e_conv);
24805         return tag_ptr(ret_conv, true);
24806 }
24807
24808 jboolean  __attribute__((export_name("TS_CResult_OpenChannelV2DecodeErrorZ_is_ok"))) TS_CResult_OpenChannelV2DecodeErrorZ_is_ok(uint64_t o) {
24809         LDKCResult_OpenChannelV2DecodeErrorZ* o_conv = (LDKCResult_OpenChannelV2DecodeErrorZ*)untag_ptr(o);
24810         jboolean ret_conv = CResult_OpenChannelV2DecodeErrorZ_is_ok(o_conv);
24811         return ret_conv;
24812 }
24813
24814 void  __attribute__((export_name("TS_CResult_OpenChannelV2DecodeErrorZ_free"))) TS_CResult_OpenChannelV2DecodeErrorZ_free(uint64_t _res) {
24815         if (!ptr_is_owned(_res)) return;
24816         void* _res_ptr = untag_ptr(_res);
24817         CHECK_ACCESS(_res_ptr);
24818         LDKCResult_OpenChannelV2DecodeErrorZ _res_conv = *(LDKCResult_OpenChannelV2DecodeErrorZ*)(_res_ptr);
24819         FREE(untag_ptr(_res));
24820         CResult_OpenChannelV2DecodeErrorZ_free(_res_conv);
24821 }
24822
24823 static inline uint64_t CResult_OpenChannelV2DecodeErrorZ_clone_ptr(LDKCResult_OpenChannelV2DecodeErrorZ *NONNULL_PTR arg) {
24824         LDKCResult_OpenChannelV2DecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_OpenChannelV2DecodeErrorZ), "LDKCResult_OpenChannelV2DecodeErrorZ");
24825         *ret_conv = CResult_OpenChannelV2DecodeErrorZ_clone(arg);
24826         return tag_ptr(ret_conv, true);
24827 }
24828 int64_t  __attribute__((export_name("TS_CResult_OpenChannelV2DecodeErrorZ_clone_ptr"))) TS_CResult_OpenChannelV2DecodeErrorZ_clone_ptr(uint64_t arg) {
24829         LDKCResult_OpenChannelV2DecodeErrorZ* arg_conv = (LDKCResult_OpenChannelV2DecodeErrorZ*)untag_ptr(arg);
24830         int64_t ret_conv = CResult_OpenChannelV2DecodeErrorZ_clone_ptr(arg_conv);
24831         return ret_conv;
24832 }
24833
24834 uint64_t  __attribute__((export_name("TS_CResult_OpenChannelV2DecodeErrorZ_clone"))) TS_CResult_OpenChannelV2DecodeErrorZ_clone(uint64_t orig) {
24835         LDKCResult_OpenChannelV2DecodeErrorZ* orig_conv = (LDKCResult_OpenChannelV2DecodeErrorZ*)untag_ptr(orig);
24836         LDKCResult_OpenChannelV2DecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_OpenChannelV2DecodeErrorZ), "LDKCResult_OpenChannelV2DecodeErrorZ");
24837         *ret_conv = CResult_OpenChannelV2DecodeErrorZ_clone(orig_conv);
24838         return tag_ptr(ret_conv, true);
24839 }
24840
24841 uint64_t  __attribute__((export_name("TS_CResult_RevokeAndACKDecodeErrorZ_ok"))) TS_CResult_RevokeAndACKDecodeErrorZ_ok(uint64_t o) {
24842         LDKRevokeAndACK o_conv;
24843         o_conv.inner = untag_ptr(o);
24844         o_conv.is_owned = ptr_is_owned(o);
24845         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
24846         o_conv = RevokeAndACK_clone(&o_conv);
24847         LDKCResult_RevokeAndACKDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RevokeAndACKDecodeErrorZ), "LDKCResult_RevokeAndACKDecodeErrorZ");
24848         *ret_conv = CResult_RevokeAndACKDecodeErrorZ_ok(o_conv);
24849         return tag_ptr(ret_conv, true);
24850 }
24851
24852 uint64_t  __attribute__((export_name("TS_CResult_RevokeAndACKDecodeErrorZ_err"))) TS_CResult_RevokeAndACKDecodeErrorZ_err(uint64_t e) {
24853         void* e_ptr = untag_ptr(e);
24854         CHECK_ACCESS(e_ptr);
24855         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
24856         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
24857         LDKCResult_RevokeAndACKDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RevokeAndACKDecodeErrorZ), "LDKCResult_RevokeAndACKDecodeErrorZ");
24858         *ret_conv = CResult_RevokeAndACKDecodeErrorZ_err(e_conv);
24859         return tag_ptr(ret_conv, true);
24860 }
24861
24862 jboolean  __attribute__((export_name("TS_CResult_RevokeAndACKDecodeErrorZ_is_ok"))) TS_CResult_RevokeAndACKDecodeErrorZ_is_ok(uint64_t o) {
24863         LDKCResult_RevokeAndACKDecodeErrorZ* o_conv = (LDKCResult_RevokeAndACKDecodeErrorZ*)untag_ptr(o);
24864         jboolean ret_conv = CResult_RevokeAndACKDecodeErrorZ_is_ok(o_conv);
24865         return ret_conv;
24866 }
24867
24868 void  __attribute__((export_name("TS_CResult_RevokeAndACKDecodeErrorZ_free"))) TS_CResult_RevokeAndACKDecodeErrorZ_free(uint64_t _res) {
24869         if (!ptr_is_owned(_res)) return;
24870         void* _res_ptr = untag_ptr(_res);
24871         CHECK_ACCESS(_res_ptr);
24872         LDKCResult_RevokeAndACKDecodeErrorZ _res_conv = *(LDKCResult_RevokeAndACKDecodeErrorZ*)(_res_ptr);
24873         FREE(untag_ptr(_res));
24874         CResult_RevokeAndACKDecodeErrorZ_free(_res_conv);
24875 }
24876
24877 static inline uint64_t CResult_RevokeAndACKDecodeErrorZ_clone_ptr(LDKCResult_RevokeAndACKDecodeErrorZ *NONNULL_PTR arg) {
24878         LDKCResult_RevokeAndACKDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RevokeAndACKDecodeErrorZ), "LDKCResult_RevokeAndACKDecodeErrorZ");
24879         *ret_conv = CResult_RevokeAndACKDecodeErrorZ_clone(arg);
24880         return tag_ptr(ret_conv, true);
24881 }
24882 int64_t  __attribute__((export_name("TS_CResult_RevokeAndACKDecodeErrorZ_clone_ptr"))) TS_CResult_RevokeAndACKDecodeErrorZ_clone_ptr(uint64_t arg) {
24883         LDKCResult_RevokeAndACKDecodeErrorZ* arg_conv = (LDKCResult_RevokeAndACKDecodeErrorZ*)untag_ptr(arg);
24884         int64_t ret_conv = CResult_RevokeAndACKDecodeErrorZ_clone_ptr(arg_conv);
24885         return ret_conv;
24886 }
24887
24888 uint64_t  __attribute__((export_name("TS_CResult_RevokeAndACKDecodeErrorZ_clone"))) TS_CResult_RevokeAndACKDecodeErrorZ_clone(uint64_t orig) {
24889         LDKCResult_RevokeAndACKDecodeErrorZ* orig_conv = (LDKCResult_RevokeAndACKDecodeErrorZ*)untag_ptr(orig);
24890         LDKCResult_RevokeAndACKDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RevokeAndACKDecodeErrorZ), "LDKCResult_RevokeAndACKDecodeErrorZ");
24891         *ret_conv = CResult_RevokeAndACKDecodeErrorZ_clone(orig_conv);
24892         return tag_ptr(ret_conv, true);
24893 }
24894
24895 uint64_t  __attribute__((export_name("TS_CResult_ShutdownDecodeErrorZ_ok"))) TS_CResult_ShutdownDecodeErrorZ_ok(uint64_t o) {
24896         LDKShutdown o_conv;
24897         o_conv.inner = untag_ptr(o);
24898         o_conv.is_owned = ptr_is_owned(o);
24899         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
24900         o_conv = Shutdown_clone(&o_conv);
24901         LDKCResult_ShutdownDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ShutdownDecodeErrorZ), "LDKCResult_ShutdownDecodeErrorZ");
24902         *ret_conv = CResult_ShutdownDecodeErrorZ_ok(o_conv);
24903         return tag_ptr(ret_conv, true);
24904 }
24905
24906 uint64_t  __attribute__((export_name("TS_CResult_ShutdownDecodeErrorZ_err"))) TS_CResult_ShutdownDecodeErrorZ_err(uint64_t e) {
24907         void* e_ptr = untag_ptr(e);
24908         CHECK_ACCESS(e_ptr);
24909         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
24910         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
24911         LDKCResult_ShutdownDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ShutdownDecodeErrorZ), "LDKCResult_ShutdownDecodeErrorZ");
24912         *ret_conv = CResult_ShutdownDecodeErrorZ_err(e_conv);
24913         return tag_ptr(ret_conv, true);
24914 }
24915
24916 jboolean  __attribute__((export_name("TS_CResult_ShutdownDecodeErrorZ_is_ok"))) TS_CResult_ShutdownDecodeErrorZ_is_ok(uint64_t o) {
24917         LDKCResult_ShutdownDecodeErrorZ* o_conv = (LDKCResult_ShutdownDecodeErrorZ*)untag_ptr(o);
24918         jboolean ret_conv = CResult_ShutdownDecodeErrorZ_is_ok(o_conv);
24919         return ret_conv;
24920 }
24921
24922 void  __attribute__((export_name("TS_CResult_ShutdownDecodeErrorZ_free"))) TS_CResult_ShutdownDecodeErrorZ_free(uint64_t _res) {
24923         if (!ptr_is_owned(_res)) return;
24924         void* _res_ptr = untag_ptr(_res);
24925         CHECK_ACCESS(_res_ptr);
24926         LDKCResult_ShutdownDecodeErrorZ _res_conv = *(LDKCResult_ShutdownDecodeErrorZ*)(_res_ptr);
24927         FREE(untag_ptr(_res));
24928         CResult_ShutdownDecodeErrorZ_free(_res_conv);
24929 }
24930
24931 static inline uint64_t CResult_ShutdownDecodeErrorZ_clone_ptr(LDKCResult_ShutdownDecodeErrorZ *NONNULL_PTR arg) {
24932         LDKCResult_ShutdownDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ShutdownDecodeErrorZ), "LDKCResult_ShutdownDecodeErrorZ");
24933         *ret_conv = CResult_ShutdownDecodeErrorZ_clone(arg);
24934         return tag_ptr(ret_conv, true);
24935 }
24936 int64_t  __attribute__((export_name("TS_CResult_ShutdownDecodeErrorZ_clone_ptr"))) TS_CResult_ShutdownDecodeErrorZ_clone_ptr(uint64_t arg) {
24937         LDKCResult_ShutdownDecodeErrorZ* arg_conv = (LDKCResult_ShutdownDecodeErrorZ*)untag_ptr(arg);
24938         int64_t ret_conv = CResult_ShutdownDecodeErrorZ_clone_ptr(arg_conv);
24939         return ret_conv;
24940 }
24941
24942 uint64_t  __attribute__((export_name("TS_CResult_ShutdownDecodeErrorZ_clone"))) TS_CResult_ShutdownDecodeErrorZ_clone(uint64_t orig) {
24943         LDKCResult_ShutdownDecodeErrorZ* orig_conv = (LDKCResult_ShutdownDecodeErrorZ*)untag_ptr(orig);
24944         LDKCResult_ShutdownDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ShutdownDecodeErrorZ), "LDKCResult_ShutdownDecodeErrorZ");
24945         *ret_conv = CResult_ShutdownDecodeErrorZ_clone(orig_conv);
24946         return tag_ptr(ret_conv, true);
24947 }
24948
24949 uint64_t  __attribute__((export_name("TS_CResult_UpdateFailHTLCDecodeErrorZ_ok"))) TS_CResult_UpdateFailHTLCDecodeErrorZ_ok(uint64_t o) {
24950         LDKUpdateFailHTLC o_conv;
24951         o_conv.inner = untag_ptr(o);
24952         o_conv.is_owned = ptr_is_owned(o);
24953         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
24954         o_conv = UpdateFailHTLC_clone(&o_conv);
24955         LDKCResult_UpdateFailHTLCDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UpdateFailHTLCDecodeErrorZ), "LDKCResult_UpdateFailHTLCDecodeErrorZ");
24956         *ret_conv = CResult_UpdateFailHTLCDecodeErrorZ_ok(o_conv);
24957         return tag_ptr(ret_conv, true);
24958 }
24959
24960 uint64_t  __attribute__((export_name("TS_CResult_UpdateFailHTLCDecodeErrorZ_err"))) TS_CResult_UpdateFailHTLCDecodeErrorZ_err(uint64_t e) {
24961         void* e_ptr = untag_ptr(e);
24962         CHECK_ACCESS(e_ptr);
24963         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
24964         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
24965         LDKCResult_UpdateFailHTLCDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UpdateFailHTLCDecodeErrorZ), "LDKCResult_UpdateFailHTLCDecodeErrorZ");
24966         *ret_conv = CResult_UpdateFailHTLCDecodeErrorZ_err(e_conv);
24967         return tag_ptr(ret_conv, true);
24968 }
24969
24970 jboolean  __attribute__((export_name("TS_CResult_UpdateFailHTLCDecodeErrorZ_is_ok"))) TS_CResult_UpdateFailHTLCDecodeErrorZ_is_ok(uint64_t o) {
24971         LDKCResult_UpdateFailHTLCDecodeErrorZ* o_conv = (LDKCResult_UpdateFailHTLCDecodeErrorZ*)untag_ptr(o);
24972         jboolean ret_conv = CResult_UpdateFailHTLCDecodeErrorZ_is_ok(o_conv);
24973         return ret_conv;
24974 }
24975
24976 void  __attribute__((export_name("TS_CResult_UpdateFailHTLCDecodeErrorZ_free"))) TS_CResult_UpdateFailHTLCDecodeErrorZ_free(uint64_t _res) {
24977         if (!ptr_is_owned(_res)) return;
24978         void* _res_ptr = untag_ptr(_res);
24979         CHECK_ACCESS(_res_ptr);
24980         LDKCResult_UpdateFailHTLCDecodeErrorZ _res_conv = *(LDKCResult_UpdateFailHTLCDecodeErrorZ*)(_res_ptr);
24981         FREE(untag_ptr(_res));
24982         CResult_UpdateFailHTLCDecodeErrorZ_free(_res_conv);
24983 }
24984
24985 static inline uint64_t CResult_UpdateFailHTLCDecodeErrorZ_clone_ptr(LDKCResult_UpdateFailHTLCDecodeErrorZ *NONNULL_PTR arg) {
24986         LDKCResult_UpdateFailHTLCDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UpdateFailHTLCDecodeErrorZ), "LDKCResult_UpdateFailHTLCDecodeErrorZ");
24987         *ret_conv = CResult_UpdateFailHTLCDecodeErrorZ_clone(arg);
24988         return tag_ptr(ret_conv, true);
24989 }
24990 int64_t  __attribute__((export_name("TS_CResult_UpdateFailHTLCDecodeErrorZ_clone_ptr"))) TS_CResult_UpdateFailHTLCDecodeErrorZ_clone_ptr(uint64_t arg) {
24991         LDKCResult_UpdateFailHTLCDecodeErrorZ* arg_conv = (LDKCResult_UpdateFailHTLCDecodeErrorZ*)untag_ptr(arg);
24992         int64_t ret_conv = CResult_UpdateFailHTLCDecodeErrorZ_clone_ptr(arg_conv);
24993         return ret_conv;
24994 }
24995
24996 uint64_t  __attribute__((export_name("TS_CResult_UpdateFailHTLCDecodeErrorZ_clone"))) TS_CResult_UpdateFailHTLCDecodeErrorZ_clone(uint64_t orig) {
24997         LDKCResult_UpdateFailHTLCDecodeErrorZ* orig_conv = (LDKCResult_UpdateFailHTLCDecodeErrorZ*)untag_ptr(orig);
24998         LDKCResult_UpdateFailHTLCDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UpdateFailHTLCDecodeErrorZ), "LDKCResult_UpdateFailHTLCDecodeErrorZ");
24999         *ret_conv = CResult_UpdateFailHTLCDecodeErrorZ_clone(orig_conv);
25000         return tag_ptr(ret_conv, true);
25001 }
25002
25003 uint64_t  __attribute__((export_name("TS_CResult_UpdateFailMalformedHTLCDecodeErrorZ_ok"))) TS_CResult_UpdateFailMalformedHTLCDecodeErrorZ_ok(uint64_t o) {
25004         LDKUpdateFailMalformedHTLC o_conv;
25005         o_conv.inner = untag_ptr(o);
25006         o_conv.is_owned = ptr_is_owned(o);
25007         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
25008         o_conv = UpdateFailMalformedHTLC_clone(&o_conv);
25009         LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ), "LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ");
25010         *ret_conv = CResult_UpdateFailMalformedHTLCDecodeErrorZ_ok(o_conv);
25011         return tag_ptr(ret_conv, true);
25012 }
25013
25014 uint64_t  __attribute__((export_name("TS_CResult_UpdateFailMalformedHTLCDecodeErrorZ_err"))) TS_CResult_UpdateFailMalformedHTLCDecodeErrorZ_err(uint64_t e) {
25015         void* e_ptr = untag_ptr(e);
25016         CHECK_ACCESS(e_ptr);
25017         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
25018         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
25019         LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ), "LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ");
25020         *ret_conv = CResult_UpdateFailMalformedHTLCDecodeErrorZ_err(e_conv);
25021         return tag_ptr(ret_conv, true);
25022 }
25023
25024 jboolean  __attribute__((export_name("TS_CResult_UpdateFailMalformedHTLCDecodeErrorZ_is_ok"))) TS_CResult_UpdateFailMalformedHTLCDecodeErrorZ_is_ok(uint64_t o) {
25025         LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ* o_conv = (LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ*)untag_ptr(o);
25026         jboolean ret_conv = CResult_UpdateFailMalformedHTLCDecodeErrorZ_is_ok(o_conv);
25027         return ret_conv;
25028 }
25029
25030 void  __attribute__((export_name("TS_CResult_UpdateFailMalformedHTLCDecodeErrorZ_free"))) TS_CResult_UpdateFailMalformedHTLCDecodeErrorZ_free(uint64_t _res) {
25031         if (!ptr_is_owned(_res)) return;
25032         void* _res_ptr = untag_ptr(_res);
25033         CHECK_ACCESS(_res_ptr);
25034         LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ _res_conv = *(LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ*)(_res_ptr);
25035         FREE(untag_ptr(_res));
25036         CResult_UpdateFailMalformedHTLCDecodeErrorZ_free(_res_conv);
25037 }
25038
25039 static inline uint64_t CResult_UpdateFailMalformedHTLCDecodeErrorZ_clone_ptr(LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ *NONNULL_PTR arg) {
25040         LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ), "LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ");
25041         *ret_conv = CResult_UpdateFailMalformedHTLCDecodeErrorZ_clone(arg);
25042         return tag_ptr(ret_conv, true);
25043 }
25044 int64_t  __attribute__((export_name("TS_CResult_UpdateFailMalformedHTLCDecodeErrorZ_clone_ptr"))) TS_CResult_UpdateFailMalformedHTLCDecodeErrorZ_clone_ptr(uint64_t arg) {
25045         LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ* arg_conv = (LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ*)untag_ptr(arg);
25046         int64_t ret_conv = CResult_UpdateFailMalformedHTLCDecodeErrorZ_clone_ptr(arg_conv);
25047         return ret_conv;
25048 }
25049
25050 uint64_t  __attribute__((export_name("TS_CResult_UpdateFailMalformedHTLCDecodeErrorZ_clone"))) TS_CResult_UpdateFailMalformedHTLCDecodeErrorZ_clone(uint64_t orig) {
25051         LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ* orig_conv = (LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ*)untag_ptr(orig);
25052         LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ), "LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ");
25053         *ret_conv = CResult_UpdateFailMalformedHTLCDecodeErrorZ_clone(orig_conv);
25054         return tag_ptr(ret_conv, true);
25055 }
25056
25057 uint64_t  __attribute__((export_name("TS_CResult_UpdateFeeDecodeErrorZ_ok"))) TS_CResult_UpdateFeeDecodeErrorZ_ok(uint64_t o) {
25058         LDKUpdateFee o_conv;
25059         o_conv.inner = untag_ptr(o);
25060         o_conv.is_owned = ptr_is_owned(o);
25061         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
25062         o_conv = UpdateFee_clone(&o_conv);
25063         LDKCResult_UpdateFeeDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UpdateFeeDecodeErrorZ), "LDKCResult_UpdateFeeDecodeErrorZ");
25064         *ret_conv = CResult_UpdateFeeDecodeErrorZ_ok(o_conv);
25065         return tag_ptr(ret_conv, true);
25066 }
25067
25068 uint64_t  __attribute__((export_name("TS_CResult_UpdateFeeDecodeErrorZ_err"))) TS_CResult_UpdateFeeDecodeErrorZ_err(uint64_t e) {
25069         void* e_ptr = untag_ptr(e);
25070         CHECK_ACCESS(e_ptr);
25071         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
25072         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
25073         LDKCResult_UpdateFeeDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UpdateFeeDecodeErrorZ), "LDKCResult_UpdateFeeDecodeErrorZ");
25074         *ret_conv = CResult_UpdateFeeDecodeErrorZ_err(e_conv);
25075         return tag_ptr(ret_conv, true);
25076 }
25077
25078 jboolean  __attribute__((export_name("TS_CResult_UpdateFeeDecodeErrorZ_is_ok"))) TS_CResult_UpdateFeeDecodeErrorZ_is_ok(uint64_t o) {
25079         LDKCResult_UpdateFeeDecodeErrorZ* o_conv = (LDKCResult_UpdateFeeDecodeErrorZ*)untag_ptr(o);
25080         jboolean ret_conv = CResult_UpdateFeeDecodeErrorZ_is_ok(o_conv);
25081         return ret_conv;
25082 }
25083
25084 void  __attribute__((export_name("TS_CResult_UpdateFeeDecodeErrorZ_free"))) TS_CResult_UpdateFeeDecodeErrorZ_free(uint64_t _res) {
25085         if (!ptr_is_owned(_res)) return;
25086         void* _res_ptr = untag_ptr(_res);
25087         CHECK_ACCESS(_res_ptr);
25088         LDKCResult_UpdateFeeDecodeErrorZ _res_conv = *(LDKCResult_UpdateFeeDecodeErrorZ*)(_res_ptr);
25089         FREE(untag_ptr(_res));
25090         CResult_UpdateFeeDecodeErrorZ_free(_res_conv);
25091 }
25092
25093 static inline uint64_t CResult_UpdateFeeDecodeErrorZ_clone_ptr(LDKCResult_UpdateFeeDecodeErrorZ *NONNULL_PTR arg) {
25094         LDKCResult_UpdateFeeDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UpdateFeeDecodeErrorZ), "LDKCResult_UpdateFeeDecodeErrorZ");
25095         *ret_conv = CResult_UpdateFeeDecodeErrorZ_clone(arg);
25096         return tag_ptr(ret_conv, true);
25097 }
25098 int64_t  __attribute__((export_name("TS_CResult_UpdateFeeDecodeErrorZ_clone_ptr"))) TS_CResult_UpdateFeeDecodeErrorZ_clone_ptr(uint64_t arg) {
25099         LDKCResult_UpdateFeeDecodeErrorZ* arg_conv = (LDKCResult_UpdateFeeDecodeErrorZ*)untag_ptr(arg);
25100         int64_t ret_conv = CResult_UpdateFeeDecodeErrorZ_clone_ptr(arg_conv);
25101         return ret_conv;
25102 }
25103
25104 uint64_t  __attribute__((export_name("TS_CResult_UpdateFeeDecodeErrorZ_clone"))) TS_CResult_UpdateFeeDecodeErrorZ_clone(uint64_t orig) {
25105         LDKCResult_UpdateFeeDecodeErrorZ* orig_conv = (LDKCResult_UpdateFeeDecodeErrorZ*)untag_ptr(orig);
25106         LDKCResult_UpdateFeeDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UpdateFeeDecodeErrorZ), "LDKCResult_UpdateFeeDecodeErrorZ");
25107         *ret_conv = CResult_UpdateFeeDecodeErrorZ_clone(orig_conv);
25108         return tag_ptr(ret_conv, true);
25109 }
25110
25111 uint64_t  __attribute__((export_name("TS_CResult_UpdateFulfillHTLCDecodeErrorZ_ok"))) TS_CResult_UpdateFulfillHTLCDecodeErrorZ_ok(uint64_t o) {
25112         LDKUpdateFulfillHTLC o_conv;
25113         o_conv.inner = untag_ptr(o);
25114         o_conv.is_owned = ptr_is_owned(o);
25115         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
25116         o_conv = UpdateFulfillHTLC_clone(&o_conv);
25117         LDKCResult_UpdateFulfillHTLCDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UpdateFulfillHTLCDecodeErrorZ), "LDKCResult_UpdateFulfillHTLCDecodeErrorZ");
25118         *ret_conv = CResult_UpdateFulfillHTLCDecodeErrorZ_ok(o_conv);
25119         return tag_ptr(ret_conv, true);
25120 }
25121
25122 uint64_t  __attribute__((export_name("TS_CResult_UpdateFulfillHTLCDecodeErrorZ_err"))) TS_CResult_UpdateFulfillHTLCDecodeErrorZ_err(uint64_t e) {
25123         void* e_ptr = untag_ptr(e);
25124         CHECK_ACCESS(e_ptr);
25125         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
25126         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
25127         LDKCResult_UpdateFulfillHTLCDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UpdateFulfillHTLCDecodeErrorZ), "LDKCResult_UpdateFulfillHTLCDecodeErrorZ");
25128         *ret_conv = CResult_UpdateFulfillHTLCDecodeErrorZ_err(e_conv);
25129         return tag_ptr(ret_conv, true);
25130 }
25131
25132 jboolean  __attribute__((export_name("TS_CResult_UpdateFulfillHTLCDecodeErrorZ_is_ok"))) TS_CResult_UpdateFulfillHTLCDecodeErrorZ_is_ok(uint64_t o) {
25133         LDKCResult_UpdateFulfillHTLCDecodeErrorZ* o_conv = (LDKCResult_UpdateFulfillHTLCDecodeErrorZ*)untag_ptr(o);
25134         jboolean ret_conv = CResult_UpdateFulfillHTLCDecodeErrorZ_is_ok(o_conv);
25135         return ret_conv;
25136 }
25137
25138 void  __attribute__((export_name("TS_CResult_UpdateFulfillHTLCDecodeErrorZ_free"))) TS_CResult_UpdateFulfillHTLCDecodeErrorZ_free(uint64_t _res) {
25139         if (!ptr_is_owned(_res)) return;
25140         void* _res_ptr = untag_ptr(_res);
25141         CHECK_ACCESS(_res_ptr);
25142         LDKCResult_UpdateFulfillHTLCDecodeErrorZ _res_conv = *(LDKCResult_UpdateFulfillHTLCDecodeErrorZ*)(_res_ptr);
25143         FREE(untag_ptr(_res));
25144         CResult_UpdateFulfillHTLCDecodeErrorZ_free(_res_conv);
25145 }
25146
25147 static inline uint64_t CResult_UpdateFulfillHTLCDecodeErrorZ_clone_ptr(LDKCResult_UpdateFulfillHTLCDecodeErrorZ *NONNULL_PTR arg) {
25148         LDKCResult_UpdateFulfillHTLCDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UpdateFulfillHTLCDecodeErrorZ), "LDKCResult_UpdateFulfillHTLCDecodeErrorZ");
25149         *ret_conv = CResult_UpdateFulfillHTLCDecodeErrorZ_clone(arg);
25150         return tag_ptr(ret_conv, true);
25151 }
25152 int64_t  __attribute__((export_name("TS_CResult_UpdateFulfillHTLCDecodeErrorZ_clone_ptr"))) TS_CResult_UpdateFulfillHTLCDecodeErrorZ_clone_ptr(uint64_t arg) {
25153         LDKCResult_UpdateFulfillHTLCDecodeErrorZ* arg_conv = (LDKCResult_UpdateFulfillHTLCDecodeErrorZ*)untag_ptr(arg);
25154         int64_t ret_conv = CResult_UpdateFulfillHTLCDecodeErrorZ_clone_ptr(arg_conv);
25155         return ret_conv;
25156 }
25157
25158 uint64_t  __attribute__((export_name("TS_CResult_UpdateFulfillHTLCDecodeErrorZ_clone"))) TS_CResult_UpdateFulfillHTLCDecodeErrorZ_clone(uint64_t orig) {
25159         LDKCResult_UpdateFulfillHTLCDecodeErrorZ* orig_conv = (LDKCResult_UpdateFulfillHTLCDecodeErrorZ*)untag_ptr(orig);
25160         LDKCResult_UpdateFulfillHTLCDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UpdateFulfillHTLCDecodeErrorZ), "LDKCResult_UpdateFulfillHTLCDecodeErrorZ");
25161         *ret_conv = CResult_UpdateFulfillHTLCDecodeErrorZ_clone(orig_conv);
25162         return tag_ptr(ret_conv, true);
25163 }
25164
25165 uint64_t  __attribute__((export_name("TS_CResult_UpdateAddHTLCDecodeErrorZ_ok"))) TS_CResult_UpdateAddHTLCDecodeErrorZ_ok(uint64_t o) {
25166         LDKUpdateAddHTLC o_conv;
25167         o_conv.inner = untag_ptr(o);
25168         o_conv.is_owned = ptr_is_owned(o);
25169         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
25170         o_conv = UpdateAddHTLC_clone(&o_conv);
25171         LDKCResult_UpdateAddHTLCDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UpdateAddHTLCDecodeErrorZ), "LDKCResult_UpdateAddHTLCDecodeErrorZ");
25172         *ret_conv = CResult_UpdateAddHTLCDecodeErrorZ_ok(o_conv);
25173         return tag_ptr(ret_conv, true);
25174 }
25175
25176 uint64_t  __attribute__((export_name("TS_CResult_UpdateAddHTLCDecodeErrorZ_err"))) TS_CResult_UpdateAddHTLCDecodeErrorZ_err(uint64_t e) {
25177         void* e_ptr = untag_ptr(e);
25178         CHECK_ACCESS(e_ptr);
25179         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
25180         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
25181         LDKCResult_UpdateAddHTLCDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UpdateAddHTLCDecodeErrorZ), "LDKCResult_UpdateAddHTLCDecodeErrorZ");
25182         *ret_conv = CResult_UpdateAddHTLCDecodeErrorZ_err(e_conv);
25183         return tag_ptr(ret_conv, true);
25184 }
25185
25186 jboolean  __attribute__((export_name("TS_CResult_UpdateAddHTLCDecodeErrorZ_is_ok"))) TS_CResult_UpdateAddHTLCDecodeErrorZ_is_ok(uint64_t o) {
25187         LDKCResult_UpdateAddHTLCDecodeErrorZ* o_conv = (LDKCResult_UpdateAddHTLCDecodeErrorZ*)untag_ptr(o);
25188         jboolean ret_conv = CResult_UpdateAddHTLCDecodeErrorZ_is_ok(o_conv);
25189         return ret_conv;
25190 }
25191
25192 void  __attribute__((export_name("TS_CResult_UpdateAddHTLCDecodeErrorZ_free"))) TS_CResult_UpdateAddHTLCDecodeErrorZ_free(uint64_t _res) {
25193         if (!ptr_is_owned(_res)) return;
25194         void* _res_ptr = untag_ptr(_res);
25195         CHECK_ACCESS(_res_ptr);
25196         LDKCResult_UpdateAddHTLCDecodeErrorZ _res_conv = *(LDKCResult_UpdateAddHTLCDecodeErrorZ*)(_res_ptr);
25197         FREE(untag_ptr(_res));
25198         CResult_UpdateAddHTLCDecodeErrorZ_free(_res_conv);
25199 }
25200
25201 static inline uint64_t CResult_UpdateAddHTLCDecodeErrorZ_clone_ptr(LDKCResult_UpdateAddHTLCDecodeErrorZ *NONNULL_PTR arg) {
25202         LDKCResult_UpdateAddHTLCDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UpdateAddHTLCDecodeErrorZ), "LDKCResult_UpdateAddHTLCDecodeErrorZ");
25203         *ret_conv = CResult_UpdateAddHTLCDecodeErrorZ_clone(arg);
25204         return tag_ptr(ret_conv, true);
25205 }
25206 int64_t  __attribute__((export_name("TS_CResult_UpdateAddHTLCDecodeErrorZ_clone_ptr"))) TS_CResult_UpdateAddHTLCDecodeErrorZ_clone_ptr(uint64_t arg) {
25207         LDKCResult_UpdateAddHTLCDecodeErrorZ* arg_conv = (LDKCResult_UpdateAddHTLCDecodeErrorZ*)untag_ptr(arg);
25208         int64_t ret_conv = CResult_UpdateAddHTLCDecodeErrorZ_clone_ptr(arg_conv);
25209         return ret_conv;
25210 }
25211
25212 uint64_t  __attribute__((export_name("TS_CResult_UpdateAddHTLCDecodeErrorZ_clone"))) TS_CResult_UpdateAddHTLCDecodeErrorZ_clone(uint64_t orig) {
25213         LDKCResult_UpdateAddHTLCDecodeErrorZ* orig_conv = (LDKCResult_UpdateAddHTLCDecodeErrorZ*)untag_ptr(orig);
25214         LDKCResult_UpdateAddHTLCDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UpdateAddHTLCDecodeErrorZ), "LDKCResult_UpdateAddHTLCDecodeErrorZ");
25215         *ret_conv = CResult_UpdateAddHTLCDecodeErrorZ_clone(orig_conv);
25216         return tag_ptr(ret_conv, true);
25217 }
25218
25219 uint64_t  __attribute__((export_name("TS_CResult_OnionMessageDecodeErrorZ_ok"))) TS_CResult_OnionMessageDecodeErrorZ_ok(uint64_t o) {
25220         LDKOnionMessage o_conv;
25221         o_conv.inner = untag_ptr(o);
25222         o_conv.is_owned = ptr_is_owned(o);
25223         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
25224         o_conv = OnionMessage_clone(&o_conv);
25225         LDKCResult_OnionMessageDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_OnionMessageDecodeErrorZ), "LDKCResult_OnionMessageDecodeErrorZ");
25226         *ret_conv = CResult_OnionMessageDecodeErrorZ_ok(o_conv);
25227         return tag_ptr(ret_conv, true);
25228 }
25229
25230 uint64_t  __attribute__((export_name("TS_CResult_OnionMessageDecodeErrorZ_err"))) TS_CResult_OnionMessageDecodeErrorZ_err(uint64_t e) {
25231         void* e_ptr = untag_ptr(e);
25232         CHECK_ACCESS(e_ptr);
25233         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
25234         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
25235         LDKCResult_OnionMessageDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_OnionMessageDecodeErrorZ), "LDKCResult_OnionMessageDecodeErrorZ");
25236         *ret_conv = CResult_OnionMessageDecodeErrorZ_err(e_conv);
25237         return tag_ptr(ret_conv, true);
25238 }
25239
25240 jboolean  __attribute__((export_name("TS_CResult_OnionMessageDecodeErrorZ_is_ok"))) TS_CResult_OnionMessageDecodeErrorZ_is_ok(uint64_t o) {
25241         LDKCResult_OnionMessageDecodeErrorZ* o_conv = (LDKCResult_OnionMessageDecodeErrorZ*)untag_ptr(o);
25242         jboolean ret_conv = CResult_OnionMessageDecodeErrorZ_is_ok(o_conv);
25243         return ret_conv;
25244 }
25245
25246 void  __attribute__((export_name("TS_CResult_OnionMessageDecodeErrorZ_free"))) TS_CResult_OnionMessageDecodeErrorZ_free(uint64_t _res) {
25247         if (!ptr_is_owned(_res)) return;
25248         void* _res_ptr = untag_ptr(_res);
25249         CHECK_ACCESS(_res_ptr);
25250         LDKCResult_OnionMessageDecodeErrorZ _res_conv = *(LDKCResult_OnionMessageDecodeErrorZ*)(_res_ptr);
25251         FREE(untag_ptr(_res));
25252         CResult_OnionMessageDecodeErrorZ_free(_res_conv);
25253 }
25254
25255 static inline uint64_t CResult_OnionMessageDecodeErrorZ_clone_ptr(LDKCResult_OnionMessageDecodeErrorZ *NONNULL_PTR arg) {
25256         LDKCResult_OnionMessageDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_OnionMessageDecodeErrorZ), "LDKCResult_OnionMessageDecodeErrorZ");
25257         *ret_conv = CResult_OnionMessageDecodeErrorZ_clone(arg);
25258         return tag_ptr(ret_conv, true);
25259 }
25260 int64_t  __attribute__((export_name("TS_CResult_OnionMessageDecodeErrorZ_clone_ptr"))) TS_CResult_OnionMessageDecodeErrorZ_clone_ptr(uint64_t arg) {
25261         LDKCResult_OnionMessageDecodeErrorZ* arg_conv = (LDKCResult_OnionMessageDecodeErrorZ*)untag_ptr(arg);
25262         int64_t ret_conv = CResult_OnionMessageDecodeErrorZ_clone_ptr(arg_conv);
25263         return ret_conv;
25264 }
25265
25266 uint64_t  __attribute__((export_name("TS_CResult_OnionMessageDecodeErrorZ_clone"))) TS_CResult_OnionMessageDecodeErrorZ_clone(uint64_t orig) {
25267         LDKCResult_OnionMessageDecodeErrorZ* orig_conv = (LDKCResult_OnionMessageDecodeErrorZ*)untag_ptr(orig);
25268         LDKCResult_OnionMessageDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_OnionMessageDecodeErrorZ), "LDKCResult_OnionMessageDecodeErrorZ");
25269         *ret_conv = CResult_OnionMessageDecodeErrorZ_clone(orig_conv);
25270         return tag_ptr(ret_conv, true);
25271 }
25272
25273 uint64_t  __attribute__((export_name("TS_CResult_PingDecodeErrorZ_ok"))) TS_CResult_PingDecodeErrorZ_ok(uint64_t o) {
25274         LDKPing o_conv;
25275         o_conv.inner = untag_ptr(o);
25276         o_conv.is_owned = ptr_is_owned(o);
25277         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
25278         o_conv = Ping_clone(&o_conv);
25279         LDKCResult_PingDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PingDecodeErrorZ), "LDKCResult_PingDecodeErrorZ");
25280         *ret_conv = CResult_PingDecodeErrorZ_ok(o_conv);
25281         return tag_ptr(ret_conv, true);
25282 }
25283
25284 uint64_t  __attribute__((export_name("TS_CResult_PingDecodeErrorZ_err"))) TS_CResult_PingDecodeErrorZ_err(uint64_t e) {
25285         void* e_ptr = untag_ptr(e);
25286         CHECK_ACCESS(e_ptr);
25287         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
25288         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
25289         LDKCResult_PingDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PingDecodeErrorZ), "LDKCResult_PingDecodeErrorZ");
25290         *ret_conv = CResult_PingDecodeErrorZ_err(e_conv);
25291         return tag_ptr(ret_conv, true);
25292 }
25293
25294 jboolean  __attribute__((export_name("TS_CResult_PingDecodeErrorZ_is_ok"))) TS_CResult_PingDecodeErrorZ_is_ok(uint64_t o) {
25295         LDKCResult_PingDecodeErrorZ* o_conv = (LDKCResult_PingDecodeErrorZ*)untag_ptr(o);
25296         jboolean ret_conv = CResult_PingDecodeErrorZ_is_ok(o_conv);
25297         return ret_conv;
25298 }
25299
25300 void  __attribute__((export_name("TS_CResult_PingDecodeErrorZ_free"))) TS_CResult_PingDecodeErrorZ_free(uint64_t _res) {
25301         if (!ptr_is_owned(_res)) return;
25302         void* _res_ptr = untag_ptr(_res);
25303         CHECK_ACCESS(_res_ptr);
25304         LDKCResult_PingDecodeErrorZ _res_conv = *(LDKCResult_PingDecodeErrorZ*)(_res_ptr);
25305         FREE(untag_ptr(_res));
25306         CResult_PingDecodeErrorZ_free(_res_conv);
25307 }
25308
25309 static inline uint64_t CResult_PingDecodeErrorZ_clone_ptr(LDKCResult_PingDecodeErrorZ *NONNULL_PTR arg) {
25310         LDKCResult_PingDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PingDecodeErrorZ), "LDKCResult_PingDecodeErrorZ");
25311         *ret_conv = CResult_PingDecodeErrorZ_clone(arg);
25312         return tag_ptr(ret_conv, true);
25313 }
25314 int64_t  __attribute__((export_name("TS_CResult_PingDecodeErrorZ_clone_ptr"))) TS_CResult_PingDecodeErrorZ_clone_ptr(uint64_t arg) {
25315         LDKCResult_PingDecodeErrorZ* arg_conv = (LDKCResult_PingDecodeErrorZ*)untag_ptr(arg);
25316         int64_t ret_conv = CResult_PingDecodeErrorZ_clone_ptr(arg_conv);
25317         return ret_conv;
25318 }
25319
25320 uint64_t  __attribute__((export_name("TS_CResult_PingDecodeErrorZ_clone"))) TS_CResult_PingDecodeErrorZ_clone(uint64_t orig) {
25321         LDKCResult_PingDecodeErrorZ* orig_conv = (LDKCResult_PingDecodeErrorZ*)untag_ptr(orig);
25322         LDKCResult_PingDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PingDecodeErrorZ), "LDKCResult_PingDecodeErrorZ");
25323         *ret_conv = CResult_PingDecodeErrorZ_clone(orig_conv);
25324         return tag_ptr(ret_conv, true);
25325 }
25326
25327 uint64_t  __attribute__((export_name("TS_CResult_PongDecodeErrorZ_ok"))) TS_CResult_PongDecodeErrorZ_ok(uint64_t o) {
25328         LDKPong o_conv;
25329         o_conv.inner = untag_ptr(o);
25330         o_conv.is_owned = ptr_is_owned(o);
25331         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
25332         o_conv = Pong_clone(&o_conv);
25333         LDKCResult_PongDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PongDecodeErrorZ), "LDKCResult_PongDecodeErrorZ");
25334         *ret_conv = CResult_PongDecodeErrorZ_ok(o_conv);
25335         return tag_ptr(ret_conv, true);
25336 }
25337
25338 uint64_t  __attribute__((export_name("TS_CResult_PongDecodeErrorZ_err"))) TS_CResult_PongDecodeErrorZ_err(uint64_t e) {
25339         void* e_ptr = untag_ptr(e);
25340         CHECK_ACCESS(e_ptr);
25341         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
25342         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
25343         LDKCResult_PongDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PongDecodeErrorZ), "LDKCResult_PongDecodeErrorZ");
25344         *ret_conv = CResult_PongDecodeErrorZ_err(e_conv);
25345         return tag_ptr(ret_conv, true);
25346 }
25347
25348 jboolean  __attribute__((export_name("TS_CResult_PongDecodeErrorZ_is_ok"))) TS_CResult_PongDecodeErrorZ_is_ok(uint64_t o) {
25349         LDKCResult_PongDecodeErrorZ* o_conv = (LDKCResult_PongDecodeErrorZ*)untag_ptr(o);
25350         jboolean ret_conv = CResult_PongDecodeErrorZ_is_ok(o_conv);
25351         return ret_conv;
25352 }
25353
25354 void  __attribute__((export_name("TS_CResult_PongDecodeErrorZ_free"))) TS_CResult_PongDecodeErrorZ_free(uint64_t _res) {
25355         if (!ptr_is_owned(_res)) return;
25356         void* _res_ptr = untag_ptr(_res);
25357         CHECK_ACCESS(_res_ptr);
25358         LDKCResult_PongDecodeErrorZ _res_conv = *(LDKCResult_PongDecodeErrorZ*)(_res_ptr);
25359         FREE(untag_ptr(_res));
25360         CResult_PongDecodeErrorZ_free(_res_conv);
25361 }
25362
25363 static inline uint64_t CResult_PongDecodeErrorZ_clone_ptr(LDKCResult_PongDecodeErrorZ *NONNULL_PTR arg) {
25364         LDKCResult_PongDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PongDecodeErrorZ), "LDKCResult_PongDecodeErrorZ");
25365         *ret_conv = CResult_PongDecodeErrorZ_clone(arg);
25366         return tag_ptr(ret_conv, true);
25367 }
25368 int64_t  __attribute__((export_name("TS_CResult_PongDecodeErrorZ_clone_ptr"))) TS_CResult_PongDecodeErrorZ_clone_ptr(uint64_t arg) {
25369         LDKCResult_PongDecodeErrorZ* arg_conv = (LDKCResult_PongDecodeErrorZ*)untag_ptr(arg);
25370         int64_t ret_conv = CResult_PongDecodeErrorZ_clone_ptr(arg_conv);
25371         return ret_conv;
25372 }
25373
25374 uint64_t  __attribute__((export_name("TS_CResult_PongDecodeErrorZ_clone"))) TS_CResult_PongDecodeErrorZ_clone(uint64_t orig) {
25375         LDKCResult_PongDecodeErrorZ* orig_conv = (LDKCResult_PongDecodeErrorZ*)untag_ptr(orig);
25376         LDKCResult_PongDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PongDecodeErrorZ), "LDKCResult_PongDecodeErrorZ");
25377         *ret_conv = CResult_PongDecodeErrorZ_clone(orig_conv);
25378         return tag_ptr(ret_conv, true);
25379 }
25380
25381 uint64_t  __attribute__((export_name("TS_CResult_UnsignedChannelAnnouncementDecodeErrorZ_ok"))) TS_CResult_UnsignedChannelAnnouncementDecodeErrorZ_ok(uint64_t o) {
25382         LDKUnsignedChannelAnnouncement o_conv;
25383         o_conv.inner = untag_ptr(o);
25384         o_conv.is_owned = ptr_is_owned(o);
25385         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
25386         o_conv = UnsignedChannelAnnouncement_clone(&o_conv);
25387         LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ), "LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ");
25388         *ret_conv = CResult_UnsignedChannelAnnouncementDecodeErrorZ_ok(o_conv);
25389         return tag_ptr(ret_conv, true);
25390 }
25391
25392 uint64_t  __attribute__((export_name("TS_CResult_UnsignedChannelAnnouncementDecodeErrorZ_err"))) TS_CResult_UnsignedChannelAnnouncementDecodeErrorZ_err(uint64_t e) {
25393         void* e_ptr = untag_ptr(e);
25394         CHECK_ACCESS(e_ptr);
25395         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
25396         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
25397         LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ), "LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ");
25398         *ret_conv = CResult_UnsignedChannelAnnouncementDecodeErrorZ_err(e_conv);
25399         return tag_ptr(ret_conv, true);
25400 }
25401
25402 jboolean  __attribute__((export_name("TS_CResult_UnsignedChannelAnnouncementDecodeErrorZ_is_ok"))) TS_CResult_UnsignedChannelAnnouncementDecodeErrorZ_is_ok(uint64_t o) {
25403         LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ* o_conv = (LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ*)untag_ptr(o);
25404         jboolean ret_conv = CResult_UnsignedChannelAnnouncementDecodeErrorZ_is_ok(o_conv);
25405         return ret_conv;
25406 }
25407
25408 void  __attribute__((export_name("TS_CResult_UnsignedChannelAnnouncementDecodeErrorZ_free"))) TS_CResult_UnsignedChannelAnnouncementDecodeErrorZ_free(uint64_t _res) {
25409         if (!ptr_is_owned(_res)) return;
25410         void* _res_ptr = untag_ptr(_res);
25411         CHECK_ACCESS(_res_ptr);
25412         LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ _res_conv = *(LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ*)(_res_ptr);
25413         FREE(untag_ptr(_res));
25414         CResult_UnsignedChannelAnnouncementDecodeErrorZ_free(_res_conv);
25415 }
25416
25417 static inline uint64_t CResult_UnsignedChannelAnnouncementDecodeErrorZ_clone_ptr(LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ *NONNULL_PTR arg) {
25418         LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ), "LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ");
25419         *ret_conv = CResult_UnsignedChannelAnnouncementDecodeErrorZ_clone(arg);
25420         return tag_ptr(ret_conv, true);
25421 }
25422 int64_t  __attribute__((export_name("TS_CResult_UnsignedChannelAnnouncementDecodeErrorZ_clone_ptr"))) TS_CResult_UnsignedChannelAnnouncementDecodeErrorZ_clone_ptr(uint64_t arg) {
25423         LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ* arg_conv = (LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ*)untag_ptr(arg);
25424         int64_t ret_conv = CResult_UnsignedChannelAnnouncementDecodeErrorZ_clone_ptr(arg_conv);
25425         return ret_conv;
25426 }
25427
25428 uint64_t  __attribute__((export_name("TS_CResult_UnsignedChannelAnnouncementDecodeErrorZ_clone"))) TS_CResult_UnsignedChannelAnnouncementDecodeErrorZ_clone(uint64_t orig) {
25429         LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ* orig_conv = (LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ*)untag_ptr(orig);
25430         LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ), "LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ");
25431         *ret_conv = CResult_UnsignedChannelAnnouncementDecodeErrorZ_clone(orig_conv);
25432         return tag_ptr(ret_conv, true);
25433 }
25434
25435 uint64_t  __attribute__((export_name("TS_CResult_ChannelAnnouncementDecodeErrorZ_ok"))) TS_CResult_ChannelAnnouncementDecodeErrorZ_ok(uint64_t o) {
25436         LDKChannelAnnouncement o_conv;
25437         o_conv.inner = untag_ptr(o);
25438         o_conv.is_owned = ptr_is_owned(o);
25439         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
25440         o_conv = ChannelAnnouncement_clone(&o_conv);
25441         LDKCResult_ChannelAnnouncementDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelAnnouncementDecodeErrorZ), "LDKCResult_ChannelAnnouncementDecodeErrorZ");
25442         *ret_conv = CResult_ChannelAnnouncementDecodeErrorZ_ok(o_conv);
25443         return tag_ptr(ret_conv, true);
25444 }
25445
25446 uint64_t  __attribute__((export_name("TS_CResult_ChannelAnnouncementDecodeErrorZ_err"))) TS_CResult_ChannelAnnouncementDecodeErrorZ_err(uint64_t e) {
25447         void* e_ptr = untag_ptr(e);
25448         CHECK_ACCESS(e_ptr);
25449         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
25450         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
25451         LDKCResult_ChannelAnnouncementDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelAnnouncementDecodeErrorZ), "LDKCResult_ChannelAnnouncementDecodeErrorZ");
25452         *ret_conv = CResult_ChannelAnnouncementDecodeErrorZ_err(e_conv);
25453         return tag_ptr(ret_conv, true);
25454 }
25455
25456 jboolean  __attribute__((export_name("TS_CResult_ChannelAnnouncementDecodeErrorZ_is_ok"))) TS_CResult_ChannelAnnouncementDecodeErrorZ_is_ok(uint64_t o) {
25457         LDKCResult_ChannelAnnouncementDecodeErrorZ* o_conv = (LDKCResult_ChannelAnnouncementDecodeErrorZ*)untag_ptr(o);
25458         jboolean ret_conv = CResult_ChannelAnnouncementDecodeErrorZ_is_ok(o_conv);
25459         return ret_conv;
25460 }
25461
25462 void  __attribute__((export_name("TS_CResult_ChannelAnnouncementDecodeErrorZ_free"))) TS_CResult_ChannelAnnouncementDecodeErrorZ_free(uint64_t _res) {
25463         if (!ptr_is_owned(_res)) return;
25464         void* _res_ptr = untag_ptr(_res);
25465         CHECK_ACCESS(_res_ptr);
25466         LDKCResult_ChannelAnnouncementDecodeErrorZ _res_conv = *(LDKCResult_ChannelAnnouncementDecodeErrorZ*)(_res_ptr);
25467         FREE(untag_ptr(_res));
25468         CResult_ChannelAnnouncementDecodeErrorZ_free(_res_conv);
25469 }
25470
25471 static inline uint64_t CResult_ChannelAnnouncementDecodeErrorZ_clone_ptr(LDKCResult_ChannelAnnouncementDecodeErrorZ *NONNULL_PTR arg) {
25472         LDKCResult_ChannelAnnouncementDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelAnnouncementDecodeErrorZ), "LDKCResult_ChannelAnnouncementDecodeErrorZ");
25473         *ret_conv = CResult_ChannelAnnouncementDecodeErrorZ_clone(arg);
25474         return tag_ptr(ret_conv, true);
25475 }
25476 int64_t  __attribute__((export_name("TS_CResult_ChannelAnnouncementDecodeErrorZ_clone_ptr"))) TS_CResult_ChannelAnnouncementDecodeErrorZ_clone_ptr(uint64_t arg) {
25477         LDKCResult_ChannelAnnouncementDecodeErrorZ* arg_conv = (LDKCResult_ChannelAnnouncementDecodeErrorZ*)untag_ptr(arg);
25478         int64_t ret_conv = CResult_ChannelAnnouncementDecodeErrorZ_clone_ptr(arg_conv);
25479         return ret_conv;
25480 }
25481
25482 uint64_t  __attribute__((export_name("TS_CResult_ChannelAnnouncementDecodeErrorZ_clone"))) TS_CResult_ChannelAnnouncementDecodeErrorZ_clone(uint64_t orig) {
25483         LDKCResult_ChannelAnnouncementDecodeErrorZ* orig_conv = (LDKCResult_ChannelAnnouncementDecodeErrorZ*)untag_ptr(orig);
25484         LDKCResult_ChannelAnnouncementDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelAnnouncementDecodeErrorZ), "LDKCResult_ChannelAnnouncementDecodeErrorZ");
25485         *ret_conv = CResult_ChannelAnnouncementDecodeErrorZ_clone(orig_conv);
25486         return tag_ptr(ret_conv, true);
25487 }
25488
25489 uint64_t  __attribute__((export_name("TS_CResult_UnsignedChannelUpdateDecodeErrorZ_ok"))) TS_CResult_UnsignedChannelUpdateDecodeErrorZ_ok(uint64_t o) {
25490         LDKUnsignedChannelUpdate o_conv;
25491         o_conv.inner = untag_ptr(o);
25492         o_conv.is_owned = ptr_is_owned(o);
25493         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
25494         o_conv = UnsignedChannelUpdate_clone(&o_conv);
25495         LDKCResult_UnsignedChannelUpdateDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UnsignedChannelUpdateDecodeErrorZ), "LDKCResult_UnsignedChannelUpdateDecodeErrorZ");
25496         *ret_conv = CResult_UnsignedChannelUpdateDecodeErrorZ_ok(o_conv);
25497         return tag_ptr(ret_conv, true);
25498 }
25499
25500 uint64_t  __attribute__((export_name("TS_CResult_UnsignedChannelUpdateDecodeErrorZ_err"))) TS_CResult_UnsignedChannelUpdateDecodeErrorZ_err(uint64_t e) {
25501         void* e_ptr = untag_ptr(e);
25502         CHECK_ACCESS(e_ptr);
25503         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
25504         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
25505         LDKCResult_UnsignedChannelUpdateDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UnsignedChannelUpdateDecodeErrorZ), "LDKCResult_UnsignedChannelUpdateDecodeErrorZ");
25506         *ret_conv = CResult_UnsignedChannelUpdateDecodeErrorZ_err(e_conv);
25507         return tag_ptr(ret_conv, true);
25508 }
25509
25510 jboolean  __attribute__((export_name("TS_CResult_UnsignedChannelUpdateDecodeErrorZ_is_ok"))) TS_CResult_UnsignedChannelUpdateDecodeErrorZ_is_ok(uint64_t o) {
25511         LDKCResult_UnsignedChannelUpdateDecodeErrorZ* o_conv = (LDKCResult_UnsignedChannelUpdateDecodeErrorZ*)untag_ptr(o);
25512         jboolean ret_conv = CResult_UnsignedChannelUpdateDecodeErrorZ_is_ok(o_conv);
25513         return ret_conv;
25514 }
25515
25516 void  __attribute__((export_name("TS_CResult_UnsignedChannelUpdateDecodeErrorZ_free"))) TS_CResult_UnsignedChannelUpdateDecodeErrorZ_free(uint64_t _res) {
25517         if (!ptr_is_owned(_res)) return;
25518         void* _res_ptr = untag_ptr(_res);
25519         CHECK_ACCESS(_res_ptr);
25520         LDKCResult_UnsignedChannelUpdateDecodeErrorZ _res_conv = *(LDKCResult_UnsignedChannelUpdateDecodeErrorZ*)(_res_ptr);
25521         FREE(untag_ptr(_res));
25522         CResult_UnsignedChannelUpdateDecodeErrorZ_free(_res_conv);
25523 }
25524
25525 static inline uint64_t CResult_UnsignedChannelUpdateDecodeErrorZ_clone_ptr(LDKCResult_UnsignedChannelUpdateDecodeErrorZ *NONNULL_PTR arg) {
25526         LDKCResult_UnsignedChannelUpdateDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UnsignedChannelUpdateDecodeErrorZ), "LDKCResult_UnsignedChannelUpdateDecodeErrorZ");
25527         *ret_conv = CResult_UnsignedChannelUpdateDecodeErrorZ_clone(arg);
25528         return tag_ptr(ret_conv, true);
25529 }
25530 int64_t  __attribute__((export_name("TS_CResult_UnsignedChannelUpdateDecodeErrorZ_clone_ptr"))) TS_CResult_UnsignedChannelUpdateDecodeErrorZ_clone_ptr(uint64_t arg) {
25531         LDKCResult_UnsignedChannelUpdateDecodeErrorZ* arg_conv = (LDKCResult_UnsignedChannelUpdateDecodeErrorZ*)untag_ptr(arg);
25532         int64_t ret_conv = CResult_UnsignedChannelUpdateDecodeErrorZ_clone_ptr(arg_conv);
25533         return ret_conv;
25534 }
25535
25536 uint64_t  __attribute__((export_name("TS_CResult_UnsignedChannelUpdateDecodeErrorZ_clone"))) TS_CResult_UnsignedChannelUpdateDecodeErrorZ_clone(uint64_t orig) {
25537         LDKCResult_UnsignedChannelUpdateDecodeErrorZ* orig_conv = (LDKCResult_UnsignedChannelUpdateDecodeErrorZ*)untag_ptr(orig);
25538         LDKCResult_UnsignedChannelUpdateDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UnsignedChannelUpdateDecodeErrorZ), "LDKCResult_UnsignedChannelUpdateDecodeErrorZ");
25539         *ret_conv = CResult_UnsignedChannelUpdateDecodeErrorZ_clone(orig_conv);
25540         return tag_ptr(ret_conv, true);
25541 }
25542
25543 uint64_t  __attribute__((export_name("TS_CResult_ChannelUpdateDecodeErrorZ_ok"))) TS_CResult_ChannelUpdateDecodeErrorZ_ok(uint64_t o) {
25544         LDKChannelUpdate o_conv;
25545         o_conv.inner = untag_ptr(o);
25546         o_conv.is_owned = ptr_is_owned(o);
25547         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
25548         o_conv = ChannelUpdate_clone(&o_conv);
25549         LDKCResult_ChannelUpdateDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelUpdateDecodeErrorZ), "LDKCResult_ChannelUpdateDecodeErrorZ");
25550         *ret_conv = CResult_ChannelUpdateDecodeErrorZ_ok(o_conv);
25551         return tag_ptr(ret_conv, true);
25552 }
25553
25554 uint64_t  __attribute__((export_name("TS_CResult_ChannelUpdateDecodeErrorZ_err"))) TS_CResult_ChannelUpdateDecodeErrorZ_err(uint64_t e) {
25555         void* e_ptr = untag_ptr(e);
25556         CHECK_ACCESS(e_ptr);
25557         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
25558         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
25559         LDKCResult_ChannelUpdateDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelUpdateDecodeErrorZ), "LDKCResult_ChannelUpdateDecodeErrorZ");
25560         *ret_conv = CResult_ChannelUpdateDecodeErrorZ_err(e_conv);
25561         return tag_ptr(ret_conv, true);
25562 }
25563
25564 jboolean  __attribute__((export_name("TS_CResult_ChannelUpdateDecodeErrorZ_is_ok"))) TS_CResult_ChannelUpdateDecodeErrorZ_is_ok(uint64_t o) {
25565         LDKCResult_ChannelUpdateDecodeErrorZ* o_conv = (LDKCResult_ChannelUpdateDecodeErrorZ*)untag_ptr(o);
25566         jboolean ret_conv = CResult_ChannelUpdateDecodeErrorZ_is_ok(o_conv);
25567         return ret_conv;
25568 }
25569
25570 void  __attribute__((export_name("TS_CResult_ChannelUpdateDecodeErrorZ_free"))) TS_CResult_ChannelUpdateDecodeErrorZ_free(uint64_t _res) {
25571         if (!ptr_is_owned(_res)) return;
25572         void* _res_ptr = untag_ptr(_res);
25573         CHECK_ACCESS(_res_ptr);
25574         LDKCResult_ChannelUpdateDecodeErrorZ _res_conv = *(LDKCResult_ChannelUpdateDecodeErrorZ*)(_res_ptr);
25575         FREE(untag_ptr(_res));
25576         CResult_ChannelUpdateDecodeErrorZ_free(_res_conv);
25577 }
25578
25579 static inline uint64_t CResult_ChannelUpdateDecodeErrorZ_clone_ptr(LDKCResult_ChannelUpdateDecodeErrorZ *NONNULL_PTR arg) {
25580         LDKCResult_ChannelUpdateDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelUpdateDecodeErrorZ), "LDKCResult_ChannelUpdateDecodeErrorZ");
25581         *ret_conv = CResult_ChannelUpdateDecodeErrorZ_clone(arg);
25582         return tag_ptr(ret_conv, true);
25583 }
25584 int64_t  __attribute__((export_name("TS_CResult_ChannelUpdateDecodeErrorZ_clone_ptr"))) TS_CResult_ChannelUpdateDecodeErrorZ_clone_ptr(uint64_t arg) {
25585         LDKCResult_ChannelUpdateDecodeErrorZ* arg_conv = (LDKCResult_ChannelUpdateDecodeErrorZ*)untag_ptr(arg);
25586         int64_t ret_conv = CResult_ChannelUpdateDecodeErrorZ_clone_ptr(arg_conv);
25587         return ret_conv;
25588 }
25589
25590 uint64_t  __attribute__((export_name("TS_CResult_ChannelUpdateDecodeErrorZ_clone"))) TS_CResult_ChannelUpdateDecodeErrorZ_clone(uint64_t orig) {
25591         LDKCResult_ChannelUpdateDecodeErrorZ* orig_conv = (LDKCResult_ChannelUpdateDecodeErrorZ*)untag_ptr(orig);
25592         LDKCResult_ChannelUpdateDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelUpdateDecodeErrorZ), "LDKCResult_ChannelUpdateDecodeErrorZ");
25593         *ret_conv = CResult_ChannelUpdateDecodeErrorZ_clone(orig_conv);
25594         return tag_ptr(ret_conv, true);
25595 }
25596
25597 uint64_t  __attribute__((export_name("TS_CResult_ErrorMessageDecodeErrorZ_ok"))) TS_CResult_ErrorMessageDecodeErrorZ_ok(uint64_t o) {
25598         LDKErrorMessage o_conv;
25599         o_conv.inner = untag_ptr(o);
25600         o_conv.is_owned = ptr_is_owned(o);
25601         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
25602         o_conv = ErrorMessage_clone(&o_conv);
25603         LDKCResult_ErrorMessageDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ErrorMessageDecodeErrorZ), "LDKCResult_ErrorMessageDecodeErrorZ");
25604         *ret_conv = CResult_ErrorMessageDecodeErrorZ_ok(o_conv);
25605         return tag_ptr(ret_conv, true);
25606 }
25607
25608 uint64_t  __attribute__((export_name("TS_CResult_ErrorMessageDecodeErrorZ_err"))) TS_CResult_ErrorMessageDecodeErrorZ_err(uint64_t e) {
25609         void* e_ptr = untag_ptr(e);
25610         CHECK_ACCESS(e_ptr);
25611         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
25612         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
25613         LDKCResult_ErrorMessageDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ErrorMessageDecodeErrorZ), "LDKCResult_ErrorMessageDecodeErrorZ");
25614         *ret_conv = CResult_ErrorMessageDecodeErrorZ_err(e_conv);
25615         return tag_ptr(ret_conv, true);
25616 }
25617
25618 jboolean  __attribute__((export_name("TS_CResult_ErrorMessageDecodeErrorZ_is_ok"))) TS_CResult_ErrorMessageDecodeErrorZ_is_ok(uint64_t o) {
25619         LDKCResult_ErrorMessageDecodeErrorZ* o_conv = (LDKCResult_ErrorMessageDecodeErrorZ*)untag_ptr(o);
25620         jboolean ret_conv = CResult_ErrorMessageDecodeErrorZ_is_ok(o_conv);
25621         return ret_conv;
25622 }
25623
25624 void  __attribute__((export_name("TS_CResult_ErrorMessageDecodeErrorZ_free"))) TS_CResult_ErrorMessageDecodeErrorZ_free(uint64_t _res) {
25625         if (!ptr_is_owned(_res)) return;
25626         void* _res_ptr = untag_ptr(_res);
25627         CHECK_ACCESS(_res_ptr);
25628         LDKCResult_ErrorMessageDecodeErrorZ _res_conv = *(LDKCResult_ErrorMessageDecodeErrorZ*)(_res_ptr);
25629         FREE(untag_ptr(_res));
25630         CResult_ErrorMessageDecodeErrorZ_free(_res_conv);
25631 }
25632
25633 static inline uint64_t CResult_ErrorMessageDecodeErrorZ_clone_ptr(LDKCResult_ErrorMessageDecodeErrorZ *NONNULL_PTR arg) {
25634         LDKCResult_ErrorMessageDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ErrorMessageDecodeErrorZ), "LDKCResult_ErrorMessageDecodeErrorZ");
25635         *ret_conv = CResult_ErrorMessageDecodeErrorZ_clone(arg);
25636         return tag_ptr(ret_conv, true);
25637 }
25638 int64_t  __attribute__((export_name("TS_CResult_ErrorMessageDecodeErrorZ_clone_ptr"))) TS_CResult_ErrorMessageDecodeErrorZ_clone_ptr(uint64_t arg) {
25639         LDKCResult_ErrorMessageDecodeErrorZ* arg_conv = (LDKCResult_ErrorMessageDecodeErrorZ*)untag_ptr(arg);
25640         int64_t ret_conv = CResult_ErrorMessageDecodeErrorZ_clone_ptr(arg_conv);
25641         return ret_conv;
25642 }
25643
25644 uint64_t  __attribute__((export_name("TS_CResult_ErrorMessageDecodeErrorZ_clone"))) TS_CResult_ErrorMessageDecodeErrorZ_clone(uint64_t orig) {
25645         LDKCResult_ErrorMessageDecodeErrorZ* orig_conv = (LDKCResult_ErrorMessageDecodeErrorZ*)untag_ptr(orig);
25646         LDKCResult_ErrorMessageDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ErrorMessageDecodeErrorZ), "LDKCResult_ErrorMessageDecodeErrorZ");
25647         *ret_conv = CResult_ErrorMessageDecodeErrorZ_clone(orig_conv);
25648         return tag_ptr(ret_conv, true);
25649 }
25650
25651 uint64_t  __attribute__((export_name("TS_CResult_WarningMessageDecodeErrorZ_ok"))) TS_CResult_WarningMessageDecodeErrorZ_ok(uint64_t o) {
25652         LDKWarningMessage o_conv;
25653         o_conv.inner = untag_ptr(o);
25654         o_conv.is_owned = ptr_is_owned(o);
25655         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
25656         o_conv = WarningMessage_clone(&o_conv);
25657         LDKCResult_WarningMessageDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_WarningMessageDecodeErrorZ), "LDKCResult_WarningMessageDecodeErrorZ");
25658         *ret_conv = CResult_WarningMessageDecodeErrorZ_ok(o_conv);
25659         return tag_ptr(ret_conv, true);
25660 }
25661
25662 uint64_t  __attribute__((export_name("TS_CResult_WarningMessageDecodeErrorZ_err"))) TS_CResult_WarningMessageDecodeErrorZ_err(uint64_t e) {
25663         void* e_ptr = untag_ptr(e);
25664         CHECK_ACCESS(e_ptr);
25665         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
25666         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
25667         LDKCResult_WarningMessageDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_WarningMessageDecodeErrorZ), "LDKCResult_WarningMessageDecodeErrorZ");
25668         *ret_conv = CResult_WarningMessageDecodeErrorZ_err(e_conv);
25669         return tag_ptr(ret_conv, true);
25670 }
25671
25672 jboolean  __attribute__((export_name("TS_CResult_WarningMessageDecodeErrorZ_is_ok"))) TS_CResult_WarningMessageDecodeErrorZ_is_ok(uint64_t o) {
25673         LDKCResult_WarningMessageDecodeErrorZ* o_conv = (LDKCResult_WarningMessageDecodeErrorZ*)untag_ptr(o);
25674         jboolean ret_conv = CResult_WarningMessageDecodeErrorZ_is_ok(o_conv);
25675         return ret_conv;
25676 }
25677
25678 void  __attribute__((export_name("TS_CResult_WarningMessageDecodeErrorZ_free"))) TS_CResult_WarningMessageDecodeErrorZ_free(uint64_t _res) {
25679         if (!ptr_is_owned(_res)) return;
25680         void* _res_ptr = untag_ptr(_res);
25681         CHECK_ACCESS(_res_ptr);
25682         LDKCResult_WarningMessageDecodeErrorZ _res_conv = *(LDKCResult_WarningMessageDecodeErrorZ*)(_res_ptr);
25683         FREE(untag_ptr(_res));
25684         CResult_WarningMessageDecodeErrorZ_free(_res_conv);
25685 }
25686
25687 static inline uint64_t CResult_WarningMessageDecodeErrorZ_clone_ptr(LDKCResult_WarningMessageDecodeErrorZ *NONNULL_PTR arg) {
25688         LDKCResult_WarningMessageDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_WarningMessageDecodeErrorZ), "LDKCResult_WarningMessageDecodeErrorZ");
25689         *ret_conv = CResult_WarningMessageDecodeErrorZ_clone(arg);
25690         return tag_ptr(ret_conv, true);
25691 }
25692 int64_t  __attribute__((export_name("TS_CResult_WarningMessageDecodeErrorZ_clone_ptr"))) TS_CResult_WarningMessageDecodeErrorZ_clone_ptr(uint64_t arg) {
25693         LDKCResult_WarningMessageDecodeErrorZ* arg_conv = (LDKCResult_WarningMessageDecodeErrorZ*)untag_ptr(arg);
25694         int64_t ret_conv = CResult_WarningMessageDecodeErrorZ_clone_ptr(arg_conv);
25695         return ret_conv;
25696 }
25697
25698 uint64_t  __attribute__((export_name("TS_CResult_WarningMessageDecodeErrorZ_clone"))) TS_CResult_WarningMessageDecodeErrorZ_clone(uint64_t orig) {
25699         LDKCResult_WarningMessageDecodeErrorZ* orig_conv = (LDKCResult_WarningMessageDecodeErrorZ*)untag_ptr(orig);
25700         LDKCResult_WarningMessageDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_WarningMessageDecodeErrorZ), "LDKCResult_WarningMessageDecodeErrorZ");
25701         *ret_conv = CResult_WarningMessageDecodeErrorZ_clone(orig_conv);
25702         return tag_ptr(ret_conv, true);
25703 }
25704
25705 uint64_t  __attribute__((export_name("TS_CResult_UnsignedNodeAnnouncementDecodeErrorZ_ok"))) TS_CResult_UnsignedNodeAnnouncementDecodeErrorZ_ok(uint64_t o) {
25706         LDKUnsignedNodeAnnouncement o_conv;
25707         o_conv.inner = untag_ptr(o);
25708         o_conv.is_owned = ptr_is_owned(o);
25709         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
25710         o_conv = UnsignedNodeAnnouncement_clone(&o_conv);
25711         LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ), "LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ");
25712         *ret_conv = CResult_UnsignedNodeAnnouncementDecodeErrorZ_ok(o_conv);
25713         return tag_ptr(ret_conv, true);
25714 }
25715
25716 uint64_t  __attribute__((export_name("TS_CResult_UnsignedNodeAnnouncementDecodeErrorZ_err"))) TS_CResult_UnsignedNodeAnnouncementDecodeErrorZ_err(uint64_t e) {
25717         void* e_ptr = untag_ptr(e);
25718         CHECK_ACCESS(e_ptr);
25719         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
25720         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
25721         LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ), "LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ");
25722         *ret_conv = CResult_UnsignedNodeAnnouncementDecodeErrorZ_err(e_conv);
25723         return tag_ptr(ret_conv, true);
25724 }
25725
25726 jboolean  __attribute__((export_name("TS_CResult_UnsignedNodeAnnouncementDecodeErrorZ_is_ok"))) TS_CResult_UnsignedNodeAnnouncementDecodeErrorZ_is_ok(uint64_t o) {
25727         LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ* o_conv = (LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ*)untag_ptr(o);
25728         jboolean ret_conv = CResult_UnsignedNodeAnnouncementDecodeErrorZ_is_ok(o_conv);
25729         return ret_conv;
25730 }
25731
25732 void  __attribute__((export_name("TS_CResult_UnsignedNodeAnnouncementDecodeErrorZ_free"))) TS_CResult_UnsignedNodeAnnouncementDecodeErrorZ_free(uint64_t _res) {
25733         if (!ptr_is_owned(_res)) return;
25734         void* _res_ptr = untag_ptr(_res);
25735         CHECK_ACCESS(_res_ptr);
25736         LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ _res_conv = *(LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ*)(_res_ptr);
25737         FREE(untag_ptr(_res));
25738         CResult_UnsignedNodeAnnouncementDecodeErrorZ_free(_res_conv);
25739 }
25740
25741 static inline uint64_t CResult_UnsignedNodeAnnouncementDecodeErrorZ_clone_ptr(LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ *NONNULL_PTR arg) {
25742         LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ), "LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ");
25743         *ret_conv = CResult_UnsignedNodeAnnouncementDecodeErrorZ_clone(arg);
25744         return tag_ptr(ret_conv, true);
25745 }
25746 int64_t  __attribute__((export_name("TS_CResult_UnsignedNodeAnnouncementDecodeErrorZ_clone_ptr"))) TS_CResult_UnsignedNodeAnnouncementDecodeErrorZ_clone_ptr(uint64_t arg) {
25747         LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ* arg_conv = (LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ*)untag_ptr(arg);
25748         int64_t ret_conv = CResult_UnsignedNodeAnnouncementDecodeErrorZ_clone_ptr(arg_conv);
25749         return ret_conv;
25750 }
25751
25752 uint64_t  __attribute__((export_name("TS_CResult_UnsignedNodeAnnouncementDecodeErrorZ_clone"))) TS_CResult_UnsignedNodeAnnouncementDecodeErrorZ_clone(uint64_t orig) {
25753         LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ* orig_conv = (LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ*)untag_ptr(orig);
25754         LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ), "LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ");
25755         *ret_conv = CResult_UnsignedNodeAnnouncementDecodeErrorZ_clone(orig_conv);
25756         return tag_ptr(ret_conv, true);
25757 }
25758
25759 uint64_t  __attribute__((export_name("TS_CResult_NodeAnnouncementDecodeErrorZ_ok"))) TS_CResult_NodeAnnouncementDecodeErrorZ_ok(uint64_t o) {
25760         LDKNodeAnnouncement o_conv;
25761         o_conv.inner = untag_ptr(o);
25762         o_conv.is_owned = ptr_is_owned(o);
25763         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
25764         o_conv = NodeAnnouncement_clone(&o_conv);
25765         LDKCResult_NodeAnnouncementDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NodeAnnouncementDecodeErrorZ), "LDKCResult_NodeAnnouncementDecodeErrorZ");
25766         *ret_conv = CResult_NodeAnnouncementDecodeErrorZ_ok(o_conv);
25767         return tag_ptr(ret_conv, true);
25768 }
25769
25770 uint64_t  __attribute__((export_name("TS_CResult_NodeAnnouncementDecodeErrorZ_err"))) TS_CResult_NodeAnnouncementDecodeErrorZ_err(uint64_t e) {
25771         void* e_ptr = untag_ptr(e);
25772         CHECK_ACCESS(e_ptr);
25773         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
25774         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
25775         LDKCResult_NodeAnnouncementDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NodeAnnouncementDecodeErrorZ), "LDKCResult_NodeAnnouncementDecodeErrorZ");
25776         *ret_conv = CResult_NodeAnnouncementDecodeErrorZ_err(e_conv);
25777         return tag_ptr(ret_conv, true);
25778 }
25779
25780 jboolean  __attribute__((export_name("TS_CResult_NodeAnnouncementDecodeErrorZ_is_ok"))) TS_CResult_NodeAnnouncementDecodeErrorZ_is_ok(uint64_t o) {
25781         LDKCResult_NodeAnnouncementDecodeErrorZ* o_conv = (LDKCResult_NodeAnnouncementDecodeErrorZ*)untag_ptr(o);
25782         jboolean ret_conv = CResult_NodeAnnouncementDecodeErrorZ_is_ok(o_conv);
25783         return ret_conv;
25784 }
25785
25786 void  __attribute__((export_name("TS_CResult_NodeAnnouncementDecodeErrorZ_free"))) TS_CResult_NodeAnnouncementDecodeErrorZ_free(uint64_t _res) {
25787         if (!ptr_is_owned(_res)) return;
25788         void* _res_ptr = untag_ptr(_res);
25789         CHECK_ACCESS(_res_ptr);
25790         LDKCResult_NodeAnnouncementDecodeErrorZ _res_conv = *(LDKCResult_NodeAnnouncementDecodeErrorZ*)(_res_ptr);
25791         FREE(untag_ptr(_res));
25792         CResult_NodeAnnouncementDecodeErrorZ_free(_res_conv);
25793 }
25794
25795 static inline uint64_t CResult_NodeAnnouncementDecodeErrorZ_clone_ptr(LDKCResult_NodeAnnouncementDecodeErrorZ *NONNULL_PTR arg) {
25796         LDKCResult_NodeAnnouncementDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NodeAnnouncementDecodeErrorZ), "LDKCResult_NodeAnnouncementDecodeErrorZ");
25797         *ret_conv = CResult_NodeAnnouncementDecodeErrorZ_clone(arg);
25798         return tag_ptr(ret_conv, true);
25799 }
25800 int64_t  __attribute__((export_name("TS_CResult_NodeAnnouncementDecodeErrorZ_clone_ptr"))) TS_CResult_NodeAnnouncementDecodeErrorZ_clone_ptr(uint64_t arg) {
25801         LDKCResult_NodeAnnouncementDecodeErrorZ* arg_conv = (LDKCResult_NodeAnnouncementDecodeErrorZ*)untag_ptr(arg);
25802         int64_t ret_conv = CResult_NodeAnnouncementDecodeErrorZ_clone_ptr(arg_conv);
25803         return ret_conv;
25804 }
25805
25806 uint64_t  __attribute__((export_name("TS_CResult_NodeAnnouncementDecodeErrorZ_clone"))) TS_CResult_NodeAnnouncementDecodeErrorZ_clone(uint64_t orig) {
25807         LDKCResult_NodeAnnouncementDecodeErrorZ* orig_conv = (LDKCResult_NodeAnnouncementDecodeErrorZ*)untag_ptr(orig);
25808         LDKCResult_NodeAnnouncementDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NodeAnnouncementDecodeErrorZ), "LDKCResult_NodeAnnouncementDecodeErrorZ");
25809         *ret_conv = CResult_NodeAnnouncementDecodeErrorZ_clone(orig_conv);
25810         return tag_ptr(ret_conv, true);
25811 }
25812
25813 uint64_t  __attribute__((export_name("TS_CResult_QueryShortChannelIdsDecodeErrorZ_ok"))) TS_CResult_QueryShortChannelIdsDecodeErrorZ_ok(uint64_t o) {
25814         LDKQueryShortChannelIds o_conv;
25815         o_conv.inner = untag_ptr(o);
25816         o_conv.is_owned = ptr_is_owned(o);
25817         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
25818         o_conv = QueryShortChannelIds_clone(&o_conv);
25819         LDKCResult_QueryShortChannelIdsDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_QueryShortChannelIdsDecodeErrorZ), "LDKCResult_QueryShortChannelIdsDecodeErrorZ");
25820         *ret_conv = CResult_QueryShortChannelIdsDecodeErrorZ_ok(o_conv);
25821         return tag_ptr(ret_conv, true);
25822 }
25823
25824 uint64_t  __attribute__((export_name("TS_CResult_QueryShortChannelIdsDecodeErrorZ_err"))) TS_CResult_QueryShortChannelIdsDecodeErrorZ_err(uint64_t e) {
25825         void* e_ptr = untag_ptr(e);
25826         CHECK_ACCESS(e_ptr);
25827         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
25828         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
25829         LDKCResult_QueryShortChannelIdsDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_QueryShortChannelIdsDecodeErrorZ), "LDKCResult_QueryShortChannelIdsDecodeErrorZ");
25830         *ret_conv = CResult_QueryShortChannelIdsDecodeErrorZ_err(e_conv);
25831         return tag_ptr(ret_conv, true);
25832 }
25833
25834 jboolean  __attribute__((export_name("TS_CResult_QueryShortChannelIdsDecodeErrorZ_is_ok"))) TS_CResult_QueryShortChannelIdsDecodeErrorZ_is_ok(uint64_t o) {
25835         LDKCResult_QueryShortChannelIdsDecodeErrorZ* o_conv = (LDKCResult_QueryShortChannelIdsDecodeErrorZ*)untag_ptr(o);
25836         jboolean ret_conv = CResult_QueryShortChannelIdsDecodeErrorZ_is_ok(o_conv);
25837         return ret_conv;
25838 }
25839
25840 void  __attribute__((export_name("TS_CResult_QueryShortChannelIdsDecodeErrorZ_free"))) TS_CResult_QueryShortChannelIdsDecodeErrorZ_free(uint64_t _res) {
25841         if (!ptr_is_owned(_res)) return;
25842         void* _res_ptr = untag_ptr(_res);
25843         CHECK_ACCESS(_res_ptr);
25844         LDKCResult_QueryShortChannelIdsDecodeErrorZ _res_conv = *(LDKCResult_QueryShortChannelIdsDecodeErrorZ*)(_res_ptr);
25845         FREE(untag_ptr(_res));
25846         CResult_QueryShortChannelIdsDecodeErrorZ_free(_res_conv);
25847 }
25848
25849 static inline uint64_t CResult_QueryShortChannelIdsDecodeErrorZ_clone_ptr(LDKCResult_QueryShortChannelIdsDecodeErrorZ *NONNULL_PTR arg) {
25850         LDKCResult_QueryShortChannelIdsDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_QueryShortChannelIdsDecodeErrorZ), "LDKCResult_QueryShortChannelIdsDecodeErrorZ");
25851         *ret_conv = CResult_QueryShortChannelIdsDecodeErrorZ_clone(arg);
25852         return tag_ptr(ret_conv, true);
25853 }
25854 int64_t  __attribute__((export_name("TS_CResult_QueryShortChannelIdsDecodeErrorZ_clone_ptr"))) TS_CResult_QueryShortChannelIdsDecodeErrorZ_clone_ptr(uint64_t arg) {
25855         LDKCResult_QueryShortChannelIdsDecodeErrorZ* arg_conv = (LDKCResult_QueryShortChannelIdsDecodeErrorZ*)untag_ptr(arg);
25856         int64_t ret_conv = CResult_QueryShortChannelIdsDecodeErrorZ_clone_ptr(arg_conv);
25857         return ret_conv;
25858 }
25859
25860 uint64_t  __attribute__((export_name("TS_CResult_QueryShortChannelIdsDecodeErrorZ_clone"))) TS_CResult_QueryShortChannelIdsDecodeErrorZ_clone(uint64_t orig) {
25861         LDKCResult_QueryShortChannelIdsDecodeErrorZ* orig_conv = (LDKCResult_QueryShortChannelIdsDecodeErrorZ*)untag_ptr(orig);
25862         LDKCResult_QueryShortChannelIdsDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_QueryShortChannelIdsDecodeErrorZ), "LDKCResult_QueryShortChannelIdsDecodeErrorZ");
25863         *ret_conv = CResult_QueryShortChannelIdsDecodeErrorZ_clone(orig_conv);
25864         return tag_ptr(ret_conv, true);
25865 }
25866
25867 uint64_t  __attribute__((export_name("TS_CResult_ReplyShortChannelIdsEndDecodeErrorZ_ok"))) TS_CResult_ReplyShortChannelIdsEndDecodeErrorZ_ok(uint64_t o) {
25868         LDKReplyShortChannelIdsEnd o_conv;
25869         o_conv.inner = untag_ptr(o);
25870         o_conv.is_owned = ptr_is_owned(o);
25871         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
25872         o_conv = ReplyShortChannelIdsEnd_clone(&o_conv);
25873         LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ), "LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ");
25874         *ret_conv = CResult_ReplyShortChannelIdsEndDecodeErrorZ_ok(o_conv);
25875         return tag_ptr(ret_conv, true);
25876 }
25877
25878 uint64_t  __attribute__((export_name("TS_CResult_ReplyShortChannelIdsEndDecodeErrorZ_err"))) TS_CResult_ReplyShortChannelIdsEndDecodeErrorZ_err(uint64_t e) {
25879         void* e_ptr = untag_ptr(e);
25880         CHECK_ACCESS(e_ptr);
25881         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
25882         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
25883         LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ), "LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ");
25884         *ret_conv = CResult_ReplyShortChannelIdsEndDecodeErrorZ_err(e_conv);
25885         return tag_ptr(ret_conv, true);
25886 }
25887
25888 jboolean  __attribute__((export_name("TS_CResult_ReplyShortChannelIdsEndDecodeErrorZ_is_ok"))) TS_CResult_ReplyShortChannelIdsEndDecodeErrorZ_is_ok(uint64_t o) {
25889         LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ* o_conv = (LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ*)untag_ptr(o);
25890         jboolean ret_conv = CResult_ReplyShortChannelIdsEndDecodeErrorZ_is_ok(o_conv);
25891         return ret_conv;
25892 }
25893
25894 void  __attribute__((export_name("TS_CResult_ReplyShortChannelIdsEndDecodeErrorZ_free"))) TS_CResult_ReplyShortChannelIdsEndDecodeErrorZ_free(uint64_t _res) {
25895         if (!ptr_is_owned(_res)) return;
25896         void* _res_ptr = untag_ptr(_res);
25897         CHECK_ACCESS(_res_ptr);
25898         LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ _res_conv = *(LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ*)(_res_ptr);
25899         FREE(untag_ptr(_res));
25900         CResult_ReplyShortChannelIdsEndDecodeErrorZ_free(_res_conv);
25901 }
25902
25903 static inline uint64_t CResult_ReplyShortChannelIdsEndDecodeErrorZ_clone_ptr(LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ *NONNULL_PTR arg) {
25904         LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ), "LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ");
25905         *ret_conv = CResult_ReplyShortChannelIdsEndDecodeErrorZ_clone(arg);
25906         return tag_ptr(ret_conv, true);
25907 }
25908 int64_t  __attribute__((export_name("TS_CResult_ReplyShortChannelIdsEndDecodeErrorZ_clone_ptr"))) TS_CResult_ReplyShortChannelIdsEndDecodeErrorZ_clone_ptr(uint64_t arg) {
25909         LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ* arg_conv = (LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ*)untag_ptr(arg);
25910         int64_t ret_conv = CResult_ReplyShortChannelIdsEndDecodeErrorZ_clone_ptr(arg_conv);
25911         return ret_conv;
25912 }
25913
25914 uint64_t  __attribute__((export_name("TS_CResult_ReplyShortChannelIdsEndDecodeErrorZ_clone"))) TS_CResult_ReplyShortChannelIdsEndDecodeErrorZ_clone(uint64_t orig) {
25915         LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ* orig_conv = (LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ*)untag_ptr(orig);
25916         LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ), "LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ");
25917         *ret_conv = CResult_ReplyShortChannelIdsEndDecodeErrorZ_clone(orig_conv);
25918         return tag_ptr(ret_conv, true);
25919 }
25920
25921 uint64_t  __attribute__((export_name("TS_CResult_QueryChannelRangeDecodeErrorZ_ok"))) TS_CResult_QueryChannelRangeDecodeErrorZ_ok(uint64_t o) {
25922         LDKQueryChannelRange o_conv;
25923         o_conv.inner = untag_ptr(o);
25924         o_conv.is_owned = ptr_is_owned(o);
25925         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
25926         o_conv = QueryChannelRange_clone(&o_conv);
25927         LDKCResult_QueryChannelRangeDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_QueryChannelRangeDecodeErrorZ), "LDKCResult_QueryChannelRangeDecodeErrorZ");
25928         *ret_conv = CResult_QueryChannelRangeDecodeErrorZ_ok(o_conv);
25929         return tag_ptr(ret_conv, true);
25930 }
25931
25932 uint64_t  __attribute__((export_name("TS_CResult_QueryChannelRangeDecodeErrorZ_err"))) TS_CResult_QueryChannelRangeDecodeErrorZ_err(uint64_t e) {
25933         void* e_ptr = untag_ptr(e);
25934         CHECK_ACCESS(e_ptr);
25935         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
25936         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
25937         LDKCResult_QueryChannelRangeDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_QueryChannelRangeDecodeErrorZ), "LDKCResult_QueryChannelRangeDecodeErrorZ");
25938         *ret_conv = CResult_QueryChannelRangeDecodeErrorZ_err(e_conv);
25939         return tag_ptr(ret_conv, true);
25940 }
25941
25942 jboolean  __attribute__((export_name("TS_CResult_QueryChannelRangeDecodeErrorZ_is_ok"))) TS_CResult_QueryChannelRangeDecodeErrorZ_is_ok(uint64_t o) {
25943         LDKCResult_QueryChannelRangeDecodeErrorZ* o_conv = (LDKCResult_QueryChannelRangeDecodeErrorZ*)untag_ptr(o);
25944         jboolean ret_conv = CResult_QueryChannelRangeDecodeErrorZ_is_ok(o_conv);
25945         return ret_conv;
25946 }
25947
25948 void  __attribute__((export_name("TS_CResult_QueryChannelRangeDecodeErrorZ_free"))) TS_CResult_QueryChannelRangeDecodeErrorZ_free(uint64_t _res) {
25949         if (!ptr_is_owned(_res)) return;
25950         void* _res_ptr = untag_ptr(_res);
25951         CHECK_ACCESS(_res_ptr);
25952         LDKCResult_QueryChannelRangeDecodeErrorZ _res_conv = *(LDKCResult_QueryChannelRangeDecodeErrorZ*)(_res_ptr);
25953         FREE(untag_ptr(_res));
25954         CResult_QueryChannelRangeDecodeErrorZ_free(_res_conv);
25955 }
25956
25957 static inline uint64_t CResult_QueryChannelRangeDecodeErrorZ_clone_ptr(LDKCResult_QueryChannelRangeDecodeErrorZ *NONNULL_PTR arg) {
25958         LDKCResult_QueryChannelRangeDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_QueryChannelRangeDecodeErrorZ), "LDKCResult_QueryChannelRangeDecodeErrorZ");
25959         *ret_conv = CResult_QueryChannelRangeDecodeErrorZ_clone(arg);
25960         return tag_ptr(ret_conv, true);
25961 }
25962 int64_t  __attribute__((export_name("TS_CResult_QueryChannelRangeDecodeErrorZ_clone_ptr"))) TS_CResult_QueryChannelRangeDecodeErrorZ_clone_ptr(uint64_t arg) {
25963         LDKCResult_QueryChannelRangeDecodeErrorZ* arg_conv = (LDKCResult_QueryChannelRangeDecodeErrorZ*)untag_ptr(arg);
25964         int64_t ret_conv = CResult_QueryChannelRangeDecodeErrorZ_clone_ptr(arg_conv);
25965         return ret_conv;
25966 }
25967
25968 uint64_t  __attribute__((export_name("TS_CResult_QueryChannelRangeDecodeErrorZ_clone"))) TS_CResult_QueryChannelRangeDecodeErrorZ_clone(uint64_t orig) {
25969         LDKCResult_QueryChannelRangeDecodeErrorZ* orig_conv = (LDKCResult_QueryChannelRangeDecodeErrorZ*)untag_ptr(orig);
25970         LDKCResult_QueryChannelRangeDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_QueryChannelRangeDecodeErrorZ), "LDKCResult_QueryChannelRangeDecodeErrorZ");
25971         *ret_conv = CResult_QueryChannelRangeDecodeErrorZ_clone(orig_conv);
25972         return tag_ptr(ret_conv, true);
25973 }
25974
25975 uint64_t  __attribute__((export_name("TS_CResult_ReplyChannelRangeDecodeErrorZ_ok"))) TS_CResult_ReplyChannelRangeDecodeErrorZ_ok(uint64_t o) {
25976         LDKReplyChannelRange o_conv;
25977         o_conv.inner = untag_ptr(o);
25978         o_conv.is_owned = ptr_is_owned(o);
25979         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
25980         o_conv = ReplyChannelRange_clone(&o_conv);
25981         LDKCResult_ReplyChannelRangeDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ReplyChannelRangeDecodeErrorZ), "LDKCResult_ReplyChannelRangeDecodeErrorZ");
25982         *ret_conv = CResult_ReplyChannelRangeDecodeErrorZ_ok(o_conv);
25983         return tag_ptr(ret_conv, true);
25984 }
25985
25986 uint64_t  __attribute__((export_name("TS_CResult_ReplyChannelRangeDecodeErrorZ_err"))) TS_CResult_ReplyChannelRangeDecodeErrorZ_err(uint64_t e) {
25987         void* e_ptr = untag_ptr(e);
25988         CHECK_ACCESS(e_ptr);
25989         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
25990         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
25991         LDKCResult_ReplyChannelRangeDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ReplyChannelRangeDecodeErrorZ), "LDKCResult_ReplyChannelRangeDecodeErrorZ");
25992         *ret_conv = CResult_ReplyChannelRangeDecodeErrorZ_err(e_conv);
25993         return tag_ptr(ret_conv, true);
25994 }
25995
25996 jboolean  __attribute__((export_name("TS_CResult_ReplyChannelRangeDecodeErrorZ_is_ok"))) TS_CResult_ReplyChannelRangeDecodeErrorZ_is_ok(uint64_t o) {
25997         LDKCResult_ReplyChannelRangeDecodeErrorZ* o_conv = (LDKCResult_ReplyChannelRangeDecodeErrorZ*)untag_ptr(o);
25998         jboolean ret_conv = CResult_ReplyChannelRangeDecodeErrorZ_is_ok(o_conv);
25999         return ret_conv;
26000 }
26001
26002 void  __attribute__((export_name("TS_CResult_ReplyChannelRangeDecodeErrorZ_free"))) TS_CResult_ReplyChannelRangeDecodeErrorZ_free(uint64_t _res) {
26003         if (!ptr_is_owned(_res)) return;
26004         void* _res_ptr = untag_ptr(_res);
26005         CHECK_ACCESS(_res_ptr);
26006         LDKCResult_ReplyChannelRangeDecodeErrorZ _res_conv = *(LDKCResult_ReplyChannelRangeDecodeErrorZ*)(_res_ptr);
26007         FREE(untag_ptr(_res));
26008         CResult_ReplyChannelRangeDecodeErrorZ_free(_res_conv);
26009 }
26010
26011 static inline uint64_t CResult_ReplyChannelRangeDecodeErrorZ_clone_ptr(LDKCResult_ReplyChannelRangeDecodeErrorZ *NONNULL_PTR arg) {
26012         LDKCResult_ReplyChannelRangeDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ReplyChannelRangeDecodeErrorZ), "LDKCResult_ReplyChannelRangeDecodeErrorZ");
26013         *ret_conv = CResult_ReplyChannelRangeDecodeErrorZ_clone(arg);
26014         return tag_ptr(ret_conv, true);
26015 }
26016 int64_t  __attribute__((export_name("TS_CResult_ReplyChannelRangeDecodeErrorZ_clone_ptr"))) TS_CResult_ReplyChannelRangeDecodeErrorZ_clone_ptr(uint64_t arg) {
26017         LDKCResult_ReplyChannelRangeDecodeErrorZ* arg_conv = (LDKCResult_ReplyChannelRangeDecodeErrorZ*)untag_ptr(arg);
26018         int64_t ret_conv = CResult_ReplyChannelRangeDecodeErrorZ_clone_ptr(arg_conv);
26019         return ret_conv;
26020 }
26021
26022 uint64_t  __attribute__((export_name("TS_CResult_ReplyChannelRangeDecodeErrorZ_clone"))) TS_CResult_ReplyChannelRangeDecodeErrorZ_clone(uint64_t orig) {
26023         LDKCResult_ReplyChannelRangeDecodeErrorZ* orig_conv = (LDKCResult_ReplyChannelRangeDecodeErrorZ*)untag_ptr(orig);
26024         LDKCResult_ReplyChannelRangeDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ReplyChannelRangeDecodeErrorZ), "LDKCResult_ReplyChannelRangeDecodeErrorZ");
26025         *ret_conv = CResult_ReplyChannelRangeDecodeErrorZ_clone(orig_conv);
26026         return tag_ptr(ret_conv, true);
26027 }
26028
26029 uint64_t  __attribute__((export_name("TS_CResult_GossipTimestampFilterDecodeErrorZ_ok"))) TS_CResult_GossipTimestampFilterDecodeErrorZ_ok(uint64_t o) {
26030         LDKGossipTimestampFilter o_conv;
26031         o_conv.inner = untag_ptr(o);
26032         o_conv.is_owned = ptr_is_owned(o);
26033         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
26034         o_conv = GossipTimestampFilter_clone(&o_conv);
26035         LDKCResult_GossipTimestampFilterDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_GossipTimestampFilterDecodeErrorZ), "LDKCResult_GossipTimestampFilterDecodeErrorZ");
26036         *ret_conv = CResult_GossipTimestampFilterDecodeErrorZ_ok(o_conv);
26037         return tag_ptr(ret_conv, true);
26038 }
26039
26040 uint64_t  __attribute__((export_name("TS_CResult_GossipTimestampFilterDecodeErrorZ_err"))) TS_CResult_GossipTimestampFilterDecodeErrorZ_err(uint64_t e) {
26041         void* e_ptr = untag_ptr(e);
26042         CHECK_ACCESS(e_ptr);
26043         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
26044         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
26045         LDKCResult_GossipTimestampFilterDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_GossipTimestampFilterDecodeErrorZ), "LDKCResult_GossipTimestampFilterDecodeErrorZ");
26046         *ret_conv = CResult_GossipTimestampFilterDecodeErrorZ_err(e_conv);
26047         return tag_ptr(ret_conv, true);
26048 }
26049
26050 jboolean  __attribute__((export_name("TS_CResult_GossipTimestampFilterDecodeErrorZ_is_ok"))) TS_CResult_GossipTimestampFilterDecodeErrorZ_is_ok(uint64_t o) {
26051         LDKCResult_GossipTimestampFilterDecodeErrorZ* o_conv = (LDKCResult_GossipTimestampFilterDecodeErrorZ*)untag_ptr(o);
26052         jboolean ret_conv = CResult_GossipTimestampFilterDecodeErrorZ_is_ok(o_conv);
26053         return ret_conv;
26054 }
26055
26056 void  __attribute__((export_name("TS_CResult_GossipTimestampFilterDecodeErrorZ_free"))) TS_CResult_GossipTimestampFilterDecodeErrorZ_free(uint64_t _res) {
26057         if (!ptr_is_owned(_res)) return;
26058         void* _res_ptr = untag_ptr(_res);
26059         CHECK_ACCESS(_res_ptr);
26060         LDKCResult_GossipTimestampFilterDecodeErrorZ _res_conv = *(LDKCResult_GossipTimestampFilterDecodeErrorZ*)(_res_ptr);
26061         FREE(untag_ptr(_res));
26062         CResult_GossipTimestampFilterDecodeErrorZ_free(_res_conv);
26063 }
26064
26065 static inline uint64_t CResult_GossipTimestampFilterDecodeErrorZ_clone_ptr(LDKCResult_GossipTimestampFilterDecodeErrorZ *NONNULL_PTR arg) {
26066         LDKCResult_GossipTimestampFilterDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_GossipTimestampFilterDecodeErrorZ), "LDKCResult_GossipTimestampFilterDecodeErrorZ");
26067         *ret_conv = CResult_GossipTimestampFilterDecodeErrorZ_clone(arg);
26068         return tag_ptr(ret_conv, true);
26069 }
26070 int64_t  __attribute__((export_name("TS_CResult_GossipTimestampFilterDecodeErrorZ_clone_ptr"))) TS_CResult_GossipTimestampFilterDecodeErrorZ_clone_ptr(uint64_t arg) {
26071         LDKCResult_GossipTimestampFilterDecodeErrorZ* arg_conv = (LDKCResult_GossipTimestampFilterDecodeErrorZ*)untag_ptr(arg);
26072         int64_t ret_conv = CResult_GossipTimestampFilterDecodeErrorZ_clone_ptr(arg_conv);
26073         return ret_conv;
26074 }
26075
26076 uint64_t  __attribute__((export_name("TS_CResult_GossipTimestampFilterDecodeErrorZ_clone"))) TS_CResult_GossipTimestampFilterDecodeErrorZ_clone(uint64_t orig) {
26077         LDKCResult_GossipTimestampFilterDecodeErrorZ* orig_conv = (LDKCResult_GossipTimestampFilterDecodeErrorZ*)untag_ptr(orig);
26078         LDKCResult_GossipTimestampFilterDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_GossipTimestampFilterDecodeErrorZ), "LDKCResult_GossipTimestampFilterDecodeErrorZ");
26079         *ret_conv = CResult_GossipTimestampFilterDecodeErrorZ_clone(orig_conv);
26080         return tag_ptr(ret_conv, true);
26081 }
26082
26083 void  __attribute__((export_name("TS_CVec_PhantomRouteHintsZ_free"))) TS_CVec_PhantomRouteHintsZ_free(uint64_tArray _res) {
26084         LDKCVec_PhantomRouteHintsZ _res_constr;
26085         _res_constr.datalen = _res->arr_len;
26086         if (_res_constr.datalen > 0)
26087                 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKPhantomRouteHints), "LDKCVec_PhantomRouteHintsZ Elements");
26088         else
26089                 _res_constr.data = NULL;
26090         uint64_t* _res_vals = _res->elems;
26091         for (size_t t = 0; t < _res_constr.datalen; t++) {
26092                 uint64_t _res_conv_19 = _res_vals[t];
26093                 LDKPhantomRouteHints _res_conv_19_conv;
26094                 _res_conv_19_conv.inner = untag_ptr(_res_conv_19);
26095                 _res_conv_19_conv.is_owned = ptr_is_owned(_res_conv_19);
26096                 CHECK_INNER_FIELD_ACCESS_OR_NULL(_res_conv_19_conv);
26097                 _res_constr.data[t] = _res_conv_19_conv;
26098         }
26099         FREE(_res);
26100         CVec_PhantomRouteHintsZ_free(_res_constr);
26101 }
26102
26103 uint64_t  __attribute__((export_name("TS_CResult_Bolt11InvoiceSignOrCreationErrorZ_ok"))) TS_CResult_Bolt11InvoiceSignOrCreationErrorZ_ok(uint64_t o) {
26104         LDKBolt11Invoice o_conv;
26105         o_conv.inner = untag_ptr(o);
26106         o_conv.is_owned = ptr_is_owned(o);
26107         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
26108         o_conv = Bolt11Invoice_clone(&o_conv);
26109         LDKCResult_Bolt11InvoiceSignOrCreationErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_Bolt11InvoiceSignOrCreationErrorZ), "LDKCResult_Bolt11InvoiceSignOrCreationErrorZ");
26110         *ret_conv = CResult_Bolt11InvoiceSignOrCreationErrorZ_ok(o_conv);
26111         return tag_ptr(ret_conv, true);
26112 }
26113
26114 uint64_t  __attribute__((export_name("TS_CResult_Bolt11InvoiceSignOrCreationErrorZ_err"))) TS_CResult_Bolt11InvoiceSignOrCreationErrorZ_err(uint64_t e) {
26115         void* e_ptr = untag_ptr(e);
26116         CHECK_ACCESS(e_ptr);
26117         LDKSignOrCreationError e_conv = *(LDKSignOrCreationError*)(e_ptr);
26118         e_conv = SignOrCreationError_clone((LDKSignOrCreationError*)untag_ptr(e));
26119         LDKCResult_Bolt11InvoiceSignOrCreationErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_Bolt11InvoiceSignOrCreationErrorZ), "LDKCResult_Bolt11InvoiceSignOrCreationErrorZ");
26120         *ret_conv = CResult_Bolt11InvoiceSignOrCreationErrorZ_err(e_conv);
26121         return tag_ptr(ret_conv, true);
26122 }
26123
26124 jboolean  __attribute__((export_name("TS_CResult_Bolt11InvoiceSignOrCreationErrorZ_is_ok"))) TS_CResult_Bolt11InvoiceSignOrCreationErrorZ_is_ok(uint64_t o) {
26125         LDKCResult_Bolt11InvoiceSignOrCreationErrorZ* o_conv = (LDKCResult_Bolt11InvoiceSignOrCreationErrorZ*)untag_ptr(o);
26126         jboolean ret_conv = CResult_Bolt11InvoiceSignOrCreationErrorZ_is_ok(o_conv);
26127         return ret_conv;
26128 }
26129
26130 void  __attribute__((export_name("TS_CResult_Bolt11InvoiceSignOrCreationErrorZ_free"))) TS_CResult_Bolt11InvoiceSignOrCreationErrorZ_free(uint64_t _res) {
26131         if (!ptr_is_owned(_res)) return;
26132         void* _res_ptr = untag_ptr(_res);
26133         CHECK_ACCESS(_res_ptr);
26134         LDKCResult_Bolt11InvoiceSignOrCreationErrorZ _res_conv = *(LDKCResult_Bolt11InvoiceSignOrCreationErrorZ*)(_res_ptr);
26135         FREE(untag_ptr(_res));
26136         CResult_Bolt11InvoiceSignOrCreationErrorZ_free(_res_conv);
26137 }
26138
26139 static inline uint64_t CResult_Bolt11InvoiceSignOrCreationErrorZ_clone_ptr(LDKCResult_Bolt11InvoiceSignOrCreationErrorZ *NONNULL_PTR arg) {
26140         LDKCResult_Bolt11InvoiceSignOrCreationErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_Bolt11InvoiceSignOrCreationErrorZ), "LDKCResult_Bolt11InvoiceSignOrCreationErrorZ");
26141         *ret_conv = CResult_Bolt11InvoiceSignOrCreationErrorZ_clone(arg);
26142         return tag_ptr(ret_conv, true);
26143 }
26144 int64_t  __attribute__((export_name("TS_CResult_Bolt11InvoiceSignOrCreationErrorZ_clone_ptr"))) TS_CResult_Bolt11InvoiceSignOrCreationErrorZ_clone_ptr(uint64_t arg) {
26145         LDKCResult_Bolt11InvoiceSignOrCreationErrorZ* arg_conv = (LDKCResult_Bolt11InvoiceSignOrCreationErrorZ*)untag_ptr(arg);
26146         int64_t ret_conv = CResult_Bolt11InvoiceSignOrCreationErrorZ_clone_ptr(arg_conv);
26147         return ret_conv;
26148 }
26149
26150 uint64_t  __attribute__((export_name("TS_CResult_Bolt11InvoiceSignOrCreationErrorZ_clone"))) TS_CResult_Bolt11InvoiceSignOrCreationErrorZ_clone(uint64_t orig) {
26151         LDKCResult_Bolt11InvoiceSignOrCreationErrorZ* orig_conv = (LDKCResult_Bolt11InvoiceSignOrCreationErrorZ*)untag_ptr(orig);
26152         LDKCResult_Bolt11InvoiceSignOrCreationErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_Bolt11InvoiceSignOrCreationErrorZ), "LDKCResult_Bolt11InvoiceSignOrCreationErrorZ");
26153         *ret_conv = CResult_Bolt11InvoiceSignOrCreationErrorZ_clone(orig_conv);
26154         return tag_ptr(ret_conv, true);
26155 }
26156
26157 uint64_t  __attribute__((export_name("TS_CResult_OffersMessageDecodeErrorZ_ok"))) TS_CResult_OffersMessageDecodeErrorZ_ok(uint64_t o) {
26158         void* o_ptr = untag_ptr(o);
26159         CHECK_ACCESS(o_ptr);
26160         LDKOffersMessage o_conv = *(LDKOffersMessage*)(o_ptr);
26161         o_conv = OffersMessage_clone((LDKOffersMessage*)untag_ptr(o));
26162         LDKCResult_OffersMessageDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_OffersMessageDecodeErrorZ), "LDKCResult_OffersMessageDecodeErrorZ");
26163         *ret_conv = CResult_OffersMessageDecodeErrorZ_ok(o_conv);
26164         return tag_ptr(ret_conv, true);
26165 }
26166
26167 uint64_t  __attribute__((export_name("TS_CResult_OffersMessageDecodeErrorZ_err"))) TS_CResult_OffersMessageDecodeErrorZ_err(uint64_t e) {
26168         void* e_ptr = untag_ptr(e);
26169         CHECK_ACCESS(e_ptr);
26170         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
26171         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
26172         LDKCResult_OffersMessageDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_OffersMessageDecodeErrorZ), "LDKCResult_OffersMessageDecodeErrorZ");
26173         *ret_conv = CResult_OffersMessageDecodeErrorZ_err(e_conv);
26174         return tag_ptr(ret_conv, true);
26175 }
26176
26177 jboolean  __attribute__((export_name("TS_CResult_OffersMessageDecodeErrorZ_is_ok"))) TS_CResult_OffersMessageDecodeErrorZ_is_ok(uint64_t o) {
26178         LDKCResult_OffersMessageDecodeErrorZ* o_conv = (LDKCResult_OffersMessageDecodeErrorZ*)untag_ptr(o);
26179         jboolean ret_conv = CResult_OffersMessageDecodeErrorZ_is_ok(o_conv);
26180         return ret_conv;
26181 }
26182
26183 void  __attribute__((export_name("TS_CResult_OffersMessageDecodeErrorZ_free"))) TS_CResult_OffersMessageDecodeErrorZ_free(uint64_t _res) {
26184         if (!ptr_is_owned(_res)) return;
26185         void* _res_ptr = untag_ptr(_res);
26186         CHECK_ACCESS(_res_ptr);
26187         LDKCResult_OffersMessageDecodeErrorZ _res_conv = *(LDKCResult_OffersMessageDecodeErrorZ*)(_res_ptr);
26188         FREE(untag_ptr(_res));
26189         CResult_OffersMessageDecodeErrorZ_free(_res_conv);
26190 }
26191
26192 static inline uint64_t CResult_OffersMessageDecodeErrorZ_clone_ptr(LDKCResult_OffersMessageDecodeErrorZ *NONNULL_PTR arg) {
26193         LDKCResult_OffersMessageDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_OffersMessageDecodeErrorZ), "LDKCResult_OffersMessageDecodeErrorZ");
26194         *ret_conv = CResult_OffersMessageDecodeErrorZ_clone(arg);
26195         return tag_ptr(ret_conv, true);
26196 }
26197 int64_t  __attribute__((export_name("TS_CResult_OffersMessageDecodeErrorZ_clone_ptr"))) TS_CResult_OffersMessageDecodeErrorZ_clone_ptr(uint64_t arg) {
26198         LDKCResult_OffersMessageDecodeErrorZ* arg_conv = (LDKCResult_OffersMessageDecodeErrorZ*)untag_ptr(arg);
26199         int64_t ret_conv = CResult_OffersMessageDecodeErrorZ_clone_ptr(arg_conv);
26200         return ret_conv;
26201 }
26202
26203 uint64_t  __attribute__((export_name("TS_CResult_OffersMessageDecodeErrorZ_clone"))) TS_CResult_OffersMessageDecodeErrorZ_clone(uint64_t orig) {
26204         LDKCResult_OffersMessageDecodeErrorZ* orig_conv = (LDKCResult_OffersMessageDecodeErrorZ*)untag_ptr(orig);
26205         LDKCResult_OffersMessageDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_OffersMessageDecodeErrorZ), "LDKCResult_OffersMessageDecodeErrorZ");
26206         *ret_conv = CResult_OffersMessageDecodeErrorZ_clone(orig_conv);
26207         return tag_ptr(ret_conv, true);
26208 }
26209
26210 uint64_t  __attribute__((export_name("TS_COption_HTLCClaimZ_some"))) TS_COption_HTLCClaimZ_some(uint32_t o) {
26211         LDKHTLCClaim o_conv = LDKHTLCClaim_from_js(o);
26212         LDKCOption_HTLCClaimZ *ret_copy = MALLOC(sizeof(LDKCOption_HTLCClaimZ), "LDKCOption_HTLCClaimZ");
26213         *ret_copy = COption_HTLCClaimZ_some(o_conv);
26214         uint64_t ret_ref = tag_ptr(ret_copy, true);
26215         return ret_ref;
26216 }
26217
26218 uint64_t  __attribute__((export_name("TS_COption_HTLCClaimZ_none"))) TS_COption_HTLCClaimZ_none() {
26219         LDKCOption_HTLCClaimZ *ret_copy = MALLOC(sizeof(LDKCOption_HTLCClaimZ), "LDKCOption_HTLCClaimZ");
26220         *ret_copy = COption_HTLCClaimZ_none();
26221         uint64_t ret_ref = tag_ptr(ret_copy, true);
26222         return ret_ref;
26223 }
26224
26225 void  __attribute__((export_name("TS_COption_HTLCClaimZ_free"))) TS_COption_HTLCClaimZ_free(uint64_t _res) {
26226         if (!ptr_is_owned(_res)) return;
26227         void* _res_ptr = untag_ptr(_res);
26228         CHECK_ACCESS(_res_ptr);
26229         LDKCOption_HTLCClaimZ _res_conv = *(LDKCOption_HTLCClaimZ*)(_res_ptr);
26230         FREE(untag_ptr(_res));
26231         COption_HTLCClaimZ_free(_res_conv);
26232 }
26233
26234 uint64_t  __attribute__((export_name("TS_CResult_CounterpartyCommitmentSecretsDecodeErrorZ_ok"))) TS_CResult_CounterpartyCommitmentSecretsDecodeErrorZ_ok(uint64_t o) {
26235         LDKCounterpartyCommitmentSecrets o_conv;
26236         o_conv.inner = untag_ptr(o);
26237         o_conv.is_owned = ptr_is_owned(o);
26238         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
26239         o_conv = CounterpartyCommitmentSecrets_clone(&o_conv);
26240         LDKCResult_CounterpartyCommitmentSecretsDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CounterpartyCommitmentSecretsDecodeErrorZ), "LDKCResult_CounterpartyCommitmentSecretsDecodeErrorZ");
26241         *ret_conv = CResult_CounterpartyCommitmentSecretsDecodeErrorZ_ok(o_conv);
26242         return tag_ptr(ret_conv, true);
26243 }
26244
26245 uint64_t  __attribute__((export_name("TS_CResult_CounterpartyCommitmentSecretsDecodeErrorZ_err"))) TS_CResult_CounterpartyCommitmentSecretsDecodeErrorZ_err(uint64_t e) {
26246         void* e_ptr = untag_ptr(e);
26247         CHECK_ACCESS(e_ptr);
26248         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
26249         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
26250         LDKCResult_CounterpartyCommitmentSecretsDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CounterpartyCommitmentSecretsDecodeErrorZ), "LDKCResult_CounterpartyCommitmentSecretsDecodeErrorZ");
26251         *ret_conv = CResult_CounterpartyCommitmentSecretsDecodeErrorZ_err(e_conv);
26252         return tag_ptr(ret_conv, true);
26253 }
26254
26255 jboolean  __attribute__((export_name("TS_CResult_CounterpartyCommitmentSecretsDecodeErrorZ_is_ok"))) TS_CResult_CounterpartyCommitmentSecretsDecodeErrorZ_is_ok(uint64_t o) {
26256         LDKCResult_CounterpartyCommitmentSecretsDecodeErrorZ* o_conv = (LDKCResult_CounterpartyCommitmentSecretsDecodeErrorZ*)untag_ptr(o);
26257         jboolean ret_conv = CResult_CounterpartyCommitmentSecretsDecodeErrorZ_is_ok(o_conv);
26258         return ret_conv;
26259 }
26260
26261 void  __attribute__((export_name("TS_CResult_CounterpartyCommitmentSecretsDecodeErrorZ_free"))) TS_CResult_CounterpartyCommitmentSecretsDecodeErrorZ_free(uint64_t _res) {
26262         if (!ptr_is_owned(_res)) return;
26263         void* _res_ptr = untag_ptr(_res);
26264         CHECK_ACCESS(_res_ptr);
26265         LDKCResult_CounterpartyCommitmentSecretsDecodeErrorZ _res_conv = *(LDKCResult_CounterpartyCommitmentSecretsDecodeErrorZ*)(_res_ptr);
26266         FREE(untag_ptr(_res));
26267         CResult_CounterpartyCommitmentSecretsDecodeErrorZ_free(_res_conv);
26268 }
26269
26270 static inline uint64_t CResult_CounterpartyCommitmentSecretsDecodeErrorZ_clone_ptr(LDKCResult_CounterpartyCommitmentSecretsDecodeErrorZ *NONNULL_PTR arg) {
26271         LDKCResult_CounterpartyCommitmentSecretsDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CounterpartyCommitmentSecretsDecodeErrorZ), "LDKCResult_CounterpartyCommitmentSecretsDecodeErrorZ");
26272         *ret_conv = CResult_CounterpartyCommitmentSecretsDecodeErrorZ_clone(arg);
26273         return tag_ptr(ret_conv, true);
26274 }
26275 int64_t  __attribute__((export_name("TS_CResult_CounterpartyCommitmentSecretsDecodeErrorZ_clone_ptr"))) TS_CResult_CounterpartyCommitmentSecretsDecodeErrorZ_clone_ptr(uint64_t arg) {
26276         LDKCResult_CounterpartyCommitmentSecretsDecodeErrorZ* arg_conv = (LDKCResult_CounterpartyCommitmentSecretsDecodeErrorZ*)untag_ptr(arg);
26277         int64_t ret_conv = CResult_CounterpartyCommitmentSecretsDecodeErrorZ_clone_ptr(arg_conv);
26278         return ret_conv;
26279 }
26280
26281 uint64_t  __attribute__((export_name("TS_CResult_CounterpartyCommitmentSecretsDecodeErrorZ_clone"))) TS_CResult_CounterpartyCommitmentSecretsDecodeErrorZ_clone(uint64_t orig) {
26282         LDKCResult_CounterpartyCommitmentSecretsDecodeErrorZ* orig_conv = (LDKCResult_CounterpartyCommitmentSecretsDecodeErrorZ*)untag_ptr(orig);
26283         LDKCResult_CounterpartyCommitmentSecretsDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CounterpartyCommitmentSecretsDecodeErrorZ), "LDKCResult_CounterpartyCommitmentSecretsDecodeErrorZ");
26284         *ret_conv = CResult_CounterpartyCommitmentSecretsDecodeErrorZ_clone(orig_conv);
26285         return tag_ptr(ret_conv, true);
26286 }
26287
26288 uint64_t  __attribute__((export_name("TS_CResult_TxCreationKeysDecodeErrorZ_ok"))) TS_CResult_TxCreationKeysDecodeErrorZ_ok(uint64_t o) {
26289         LDKTxCreationKeys o_conv;
26290         o_conv.inner = untag_ptr(o);
26291         o_conv.is_owned = ptr_is_owned(o);
26292         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
26293         o_conv = TxCreationKeys_clone(&o_conv);
26294         LDKCResult_TxCreationKeysDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TxCreationKeysDecodeErrorZ), "LDKCResult_TxCreationKeysDecodeErrorZ");
26295         *ret_conv = CResult_TxCreationKeysDecodeErrorZ_ok(o_conv);
26296         return tag_ptr(ret_conv, true);
26297 }
26298
26299 uint64_t  __attribute__((export_name("TS_CResult_TxCreationKeysDecodeErrorZ_err"))) TS_CResult_TxCreationKeysDecodeErrorZ_err(uint64_t e) {
26300         void* e_ptr = untag_ptr(e);
26301         CHECK_ACCESS(e_ptr);
26302         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
26303         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
26304         LDKCResult_TxCreationKeysDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TxCreationKeysDecodeErrorZ), "LDKCResult_TxCreationKeysDecodeErrorZ");
26305         *ret_conv = CResult_TxCreationKeysDecodeErrorZ_err(e_conv);
26306         return tag_ptr(ret_conv, true);
26307 }
26308
26309 jboolean  __attribute__((export_name("TS_CResult_TxCreationKeysDecodeErrorZ_is_ok"))) TS_CResult_TxCreationKeysDecodeErrorZ_is_ok(uint64_t o) {
26310         LDKCResult_TxCreationKeysDecodeErrorZ* o_conv = (LDKCResult_TxCreationKeysDecodeErrorZ*)untag_ptr(o);
26311         jboolean ret_conv = CResult_TxCreationKeysDecodeErrorZ_is_ok(o_conv);
26312         return ret_conv;
26313 }
26314
26315 void  __attribute__((export_name("TS_CResult_TxCreationKeysDecodeErrorZ_free"))) TS_CResult_TxCreationKeysDecodeErrorZ_free(uint64_t _res) {
26316         if (!ptr_is_owned(_res)) return;
26317         void* _res_ptr = untag_ptr(_res);
26318         CHECK_ACCESS(_res_ptr);
26319         LDKCResult_TxCreationKeysDecodeErrorZ _res_conv = *(LDKCResult_TxCreationKeysDecodeErrorZ*)(_res_ptr);
26320         FREE(untag_ptr(_res));
26321         CResult_TxCreationKeysDecodeErrorZ_free(_res_conv);
26322 }
26323
26324 static inline uint64_t CResult_TxCreationKeysDecodeErrorZ_clone_ptr(LDKCResult_TxCreationKeysDecodeErrorZ *NONNULL_PTR arg) {
26325         LDKCResult_TxCreationKeysDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TxCreationKeysDecodeErrorZ), "LDKCResult_TxCreationKeysDecodeErrorZ");
26326         *ret_conv = CResult_TxCreationKeysDecodeErrorZ_clone(arg);
26327         return tag_ptr(ret_conv, true);
26328 }
26329 int64_t  __attribute__((export_name("TS_CResult_TxCreationKeysDecodeErrorZ_clone_ptr"))) TS_CResult_TxCreationKeysDecodeErrorZ_clone_ptr(uint64_t arg) {
26330         LDKCResult_TxCreationKeysDecodeErrorZ* arg_conv = (LDKCResult_TxCreationKeysDecodeErrorZ*)untag_ptr(arg);
26331         int64_t ret_conv = CResult_TxCreationKeysDecodeErrorZ_clone_ptr(arg_conv);
26332         return ret_conv;
26333 }
26334
26335 uint64_t  __attribute__((export_name("TS_CResult_TxCreationKeysDecodeErrorZ_clone"))) TS_CResult_TxCreationKeysDecodeErrorZ_clone(uint64_t orig) {
26336         LDKCResult_TxCreationKeysDecodeErrorZ* orig_conv = (LDKCResult_TxCreationKeysDecodeErrorZ*)untag_ptr(orig);
26337         LDKCResult_TxCreationKeysDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TxCreationKeysDecodeErrorZ), "LDKCResult_TxCreationKeysDecodeErrorZ");
26338         *ret_conv = CResult_TxCreationKeysDecodeErrorZ_clone(orig_conv);
26339         return tag_ptr(ret_conv, true);
26340 }
26341
26342 uint64_t  __attribute__((export_name("TS_CResult_ChannelPublicKeysDecodeErrorZ_ok"))) TS_CResult_ChannelPublicKeysDecodeErrorZ_ok(uint64_t o) {
26343         LDKChannelPublicKeys o_conv;
26344         o_conv.inner = untag_ptr(o);
26345         o_conv.is_owned = ptr_is_owned(o);
26346         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
26347         o_conv = ChannelPublicKeys_clone(&o_conv);
26348         LDKCResult_ChannelPublicKeysDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelPublicKeysDecodeErrorZ), "LDKCResult_ChannelPublicKeysDecodeErrorZ");
26349         *ret_conv = CResult_ChannelPublicKeysDecodeErrorZ_ok(o_conv);
26350         return tag_ptr(ret_conv, true);
26351 }
26352
26353 uint64_t  __attribute__((export_name("TS_CResult_ChannelPublicKeysDecodeErrorZ_err"))) TS_CResult_ChannelPublicKeysDecodeErrorZ_err(uint64_t e) {
26354         void* e_ptr = untag_ptr(e);
26355         CHECK_ACCESS(e_ptr);
26356         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
26357         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
26358         LDKCResult_ChannelPublicKeysDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelPublicKeysDecodeErrorZ), "LDKCResult_ChannelPublicKeysDecodeErrorZ");
26359         *ret_conv = CResult_ChannelPublicKeysDecodeErrorZ_err(e_conv);
26360         return tag_ptr(ret_conv, true);
26361 }
26362
26363 jboolean  __attribute__((export_name("TS_CResult_ChannelPublicKeysDecodeErrorZ_is_ok"))) TS_CResult_ChannelPublicKeysDecodeErrorZ_is_ok(uint64_t o) {
26364         LDKCResult_ChannelPublicKeysDecodeErrorZ* o_conv = (LDKCResult_ChannelPublicKeysDecodeErrorZ*)untag_ptr(o);
26365         jboolean ret_conv = CResult_ChannelPublicKeysDecodeErrorZ_is_ok(o_conv);
26366         return ret_conv;
26367 }
26368
26369 void  __attribute__((export_name("TS_CResult_ChannelPublicKeysDecodeErrorZ_free"))) TS_CResult_ChannelPublicKeysDecodeErrorZ_free(uint64_t _res) {
26370         if (!ptr_is_owned(_res)) return;
26371         void* _res_ptr = untag_ptr(_res);
26372         CHECK_ACCESS(_res_ptr);
26373         LDKCResult_ChannelPublicKeysDecodeErrorZ _res_conv = *(LDKCResult_ChannelPublicKeysDecodeErrorZ*)(_res_ptr);
26374         FREE(untag_ptr(_res));
26375         CResult_ChannelPublicKeysDecodeErrorZ_free(_res_conv);
26376 }
26377
26378 static inline uint64_t CResult_ChannelPublicKeysDecodeErrorZ_clone_ptr(LDKCResult_ChannelPublicKeysDecodeErrorZ *NONNULL_PTR arg) {
26379         LDKCResult_ChannelPublicKeysDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelPublicKeysDecodeErrorZ), "LDKCResult_ChannelPublicKeysDecodeErrorZ");
26380         *ret_conv = CResult_ChannelPublicKeysDecodeErrorZ_clone(arg);
26381         return tag_ptr(ret_conv, true);
26382 }
26383 int64_t  __attribute__((export_name("TS_CResult_ChannelPublicKeysDecodeErrorZ_clone_ptr"))) TS_CResult_ChannelPublicKeysDecodeErrorZ_clone_ptr(uint64_t arg) {
26384         LDKCResult_ChannelPublicKeysDecodeErrorZ* arg_conv = (LDKCResult_ChannelPublicKeysDecodeErrorZ*)untag_ptr(arg);
26385         int64_t ret_conv = CResult_ChannelPublicKeysDecodeErrorZ_clone_ptr(arg_conv);
26386         return ret_conv;
26387 }
26388
26389 uint64_t  __attribute__((export_name("TS_CResult_ChannelPublicKeysDecodeErrorZ_clone"))) TS_CResult_ChannelPublicKeysDecodeErrorZ_clone(uint64_t orig) {
26390         LDKCResult_ChannelPublicKeysDecodeErrorZ* orig_conv = (LDKCResult_ChannelPublicKeysDecodeErrorZ*)untag_ptr(orig);
26391         LDKCResult_ChannelPublicKeysDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelPublicKeysDecodeErrorZ), "LDKCResult_ChannelPublicKeysDecodeErrorZ");
26392         *ret_conv = CResult_ChannelPublicKeysDecodeErrorZ_clone(orig_conv);
26393         return tag_ptr(ret_conv, true);
26394 }
26395
26396 uint64_t  __attribute__((export_name("TS_CResult_HTLCOutputInCommitmentDecodeErrorZ_ok"))) TS_CResult_HTLCOutputInCommitmentDecodeErrorZ_ok(uint64_t o) {
26397         LDKHTLCOutputInCommitment o_conv;
26398         o_conv.inner = untag_ptr(o);
26399         o_conv.is_owned = ptr_is_owned(o);
26400         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
26401         o_conv = HTLCOutputInCommitment_clone(&o_conv);
26402         LDKCResult_HTLCOutputInCommitmentDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_HTLCOutputInCommitmentDecodeErrorZ), "LDKCResult_HTLCOutputInCommitmentDecodeErrorZ");
26403         *ret_conv = CResult_HTLCOutputInCommitmentDecodeErrorZ_ok(o_conv);
26404         return tag_ptr(ret_conv, true);
26405 }
26406
26407 uint64_t  __attribute__((export_name("TS_CResult_HTLCOutputInCommitmentDecodeErrorZ_err"))) TS_CResult_HTLCOutputInCommitmentDecodeErrorZ_err(uint64_t e) {
26408         void* e_ptr = untag_ptr(e);
26409         CHECK_ACCESS(e_ptr);
26410         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
26411         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
26412         LDKCResult_HTLCOutputInCommitmentDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_HTLCOutputInCommitmentDecodeErrorZ), "LDKCResult_HTLCOutputInCommitmentDecodeErrorZ");
26413         *ret_conv = CResult_HTLCOutputInCommitmentDecodeErrorZ_err(e_conv);
26414         return tag_ptr(ret_conv, true);
26415 }
26416
26417 jboolean  __attribute__((export_name("TS_CResult_HTLCOutputInCommitmentDecodeErrorZ_is_ok"))) TS_CResult_HTLCOutputInCommitmentDecodeErrorZ_is_ok(uint64_t o) {
26418         LDKCResult_HTLCOutputInCommitmentDecodeErrorZ* o_conv = (LDKCResult_HTLCOutputInCommitmentDecodeErrorZ*)untag_ptr(o);
26419         jboolean ret_conv = CResult_HTLCOutputInCommitmentDecodeErrorZ_is_ok(o_conv);
26420         return ret_conv;
26421 }
26422
26423 void  __attribute__((export_name("TS_CResult_HTLCOutputInCommitmentDecodeErrorZ_free"))) TS_CResult_HTLCOutputInCommitmentDecodeErrorZ_free(uint64_t _res) {
26424         if (!ptr_is_owned(_res)) return;
26425         void* _res_ptr = untag_ptr(_res);
26426         CHECK_ACCESS(_res_ptr);
26427         LDKCResult_HTLCOutputInCommitmentDecodeErrorZ _res_conv = *(LDKCResult_HTLCOutputInCommitmentDecodeErrorZ*)(_res_ptr);
26428         FREE(untag_ptr(_res));
26429         CResult_HTLCOutputInCommitmentDecodeErrorZ_free(_res_conv);
26430 }
26431
26432 static inline uint64_t CResult_HTLCOutputInCommitmentDecodeErrorZ_clone_ptr(LDKCResult_HTLCOutputInCommitmentDecodeErrorZ *NONNULL_PTR arg) {
26433         LDKCResult_HTLCOutputInCommitmentDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_HTLCOutputInCommitmentDecodeErrorZ), "LDKCResult_HTLCOutputInCommitmentDecodeErrorZ");
26434         *ret_conv = CResult_HTLCOutputInCommitmentDecodeErrorZ_clone(arg);
26435         return tag_ptr(ret_conv, true);
26436 }
26437 int64_t  __attribute__((export_name("TS_CResult_HTLCOutputInCommitmentDecodeErrorZ_clone_ptr"))) TS_CResult_HTLCOutputInCommitmentDecodeErrorZ_clone_ptr(uint64_t arg) {
26438         LDKCResult_HTLCOutputInCommitmentDecodeErrorZ* arg_conv = (LDKCResult_HTLCOutputInCommitmentDecodeErrorZ*)untag_ptr(arg);
26439         int64_t ret_conv = CResult_HTLCOutputInCommitmentDecodeErrorZ_clone_ptr(arg_conv);
26440         return ret_conv;
26441 }
26442
26443 uint64_t  __attribute__((export_name("TS_CResult_HTLCOutputInCommitmentDecodeErrorZ_clone"))) TS_CResult_HTLCOutputInCommitmentDecodeErrorZ_clone(uint64_t orig) {
26444         LDKCResult_HTLCOutputInCommitmentDecodeErrorZ* orig_conv = (LDKCResult_HTLCOutputInCommitmentDecodeErrorZ*)untag_ptr(orig);
26445         LDKCResult_HTLCOutputInCommitmentDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_HTLCOutputInCommitmentDecodeErrorZ), "LDKCResult_HTLCOutputInCommitmentDecodeErrorZ");
26446         *ret_conv = CResult_HTLCOutputInCommitmentDecodeErrorZ_clone(orig_conv);
26447         return tag_ptr(ret_conv, true);
26448 }
26449
26450 uint64_t  __attribute__((export_name("TS_CResult_CounterpartyChannelTransactionParametersDecodeErrorZ_ok"))) TS_CResult_CounterpartyChannelTransactionParametersDecodeErrorZ_ok(uint64_t o) {
26451         LDKCounterpartyChannelTransactionParameters o_conv;
26452         o_conv.inner = untag_ptr(o);
26453         o_conv.is_owned = ptr_is_owned(o);
26454         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
26455         o_conv = CounterpartyChannelTransactionParameters_clone(&o_conv);
26456         LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ), "LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ");
26457         *ret_conv = CResult_CounterpartyChannelTransactionParametersDecodeErrorZ_ok(o_conv);
26458         return tag_ptr(ret_conv, true);
26459 }
26460
26461 uint64_t  __attribute__((export_name("TS_CResult_CounterpartyChannelTransactionParametersDecodeErrorZ_err"))) TS_CResult_CounterpartyChannelTransactionParametersDecodeErrorZ_err(uint64_t e) {
26462         void* e_ptr = untag_ptr(e);
26463         CHECK_ACCESS(e_ptr);
26464         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
26465         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
26466         LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ), "LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ");
26467         *ret_conv = CResult_CounterpartyChannelTransactionParametersDecodeErrorZ_err(e_conv);
26468         return tag_ptr(ret_conv, true);
26469 }
26470
26471 jboolean  __attribute__((export_name("TS_CResult_CounterpartyChannelTransactionParametersDecodeErrorZ_is_ok"))) TS_CResult_CounterpartyChannelTransactionParametersDecodeErrorZ_is_ok(uint64_t o) {
26472         LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ* o_conv = (LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ*)untag_ptr(o);
26473         jboolean ret_conv = CResult_CounterpartyChannelTransactionParametersDecodeErrorZ_is_ok(o_conv);
26474         return ret_conv;
26475 }
26476
26477 void  __attribute__((export_name("TS_CResult_CounterpartyChannelTransactionParametersDecodeErrorZ_free"))) TS_CResult_CounterpartyChannelTransactionParametersDecodeErrorZ_free(uint64_t _res) {
26478         if (!ptr_is_owned(_res)) return;
26479         void* _res_ptr = untag_ptr(_res);
26480         CHECK_ACCESS(_res_ptr);
26481         LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ _res_conv = *(LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ*)(_res_ptr);
26482         FREE(untag_ptr(_res));
26483         CResult_CounterpartyChannelTransactionParametersDecodeErrorZ_free(_res_conv);
26484 }
26485
26486 static inline uint64_t CResult_CounterpartyChannelTransactionParametersDecodeErrorZ_clone_ptr(LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ *NONNULL_PTR arg) {
26487         LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ), "LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ");
26488         *ret_conv = CResult_CounterpartyChannelTransactionParametersDecodeErrorZ_clone(arg);
26489         return tag_ptr(ret_conv, true);
26490 }
26491 int64_t  __attribute__((export_name("TS_CResult_CounterpartyChannelTransactionParametersDecodeErrorZ_clone_ptr"))) TS_CResult_CounterpartyChannelTransactionParametersDecodeErrorZ_clone_ptr(uint64_t arg) {
26492         LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ* arg_conv = (LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ*)untag_ptr(arg);
26493         int64_t ret_conv = CResult_CounterpartyChannelTransactionParametersDecodeErrorZ_clone_ptr(arg_conv);
26494         return ret_conv;
26495 }
26496
26497 uint64_t  __attribute__((export_name("TS_CResult_CounterpartyChannelTransactionParametersDecodeErrorZ_clone"))) TS_CResult_CounterpartyChannelTransactionParametersDecodeErrorZ_clone(uint64_t orig) {
26498         LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ* orig_conv = (LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ*)untag_ptr(orig);
26499         LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ), "LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ");
26500         *ret_conv = CResult_CounterpartyChannelTransactionParametersDecodeErrorZ_clone(orig_conv);
26501         return tag_ptr(ret_conv, true);
26502 }
26503
26504 uint64_t  __attribute__((export_name("TS_CResult_ChannelTransactionParametersDecodeErrorZ_ok"))) TS_CResult_ChannelTransactionParametersDecodeErrorZ_ok(uint64_t o) {
26505         LDKChannelTransactionParameters o_conv;
26506         o_conv.inner = untag_ptr(o);
26507         o_conv.is_owned = ptr_is_owned(o);
26508         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
26509         o_conv = ChannelTransactionParameters_clone(&o_conv);
26510         LDKCResult_ChannelTransactionParametersDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelTransactionParametersDecodeErrorZ), "LDKCResult_ChannelTransactionParametersDecodeErrorZ");
26511         *ret_conv = CResult_ChannelTransactionParametersDecodeErrorZ_ok(o_conv);
26512         return tag_ptr(ret_conv, true);
26513 }
26514
26515 uint64_t  __attribute__((export_name("TS_CResult_ChannelTransactionParametersDecodeErrorZ_err"))) TS_CResult_ChannelTransactionParametersDecodeErrorZ_err(uint64_t e) {
26516         void* e_ptr = untag_ptr(e);
26517         CHECK_ACCESS(e_ptr);
26518         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
26519         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
26520         LDKCResult_ChannelTransactionParametersDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelTransactionParametersDecodeErrorZ), "LDKCResult_ChannelTransactionParametersDecodeErrorZ");
26521         *ret_conv = CResult_ChannelTransactionParametersDecodeErrorZ_err(e_conv);
26522         return tag_ptr(ret_conv, true);
26523 }
26524
26525 jboolean  __attribute__((export_name("TS_CResult_ChannelTransactionParametersDecodeErrorZ_is_ok"))) TS_CResult_ChannelTransactionParametersDecodeErrorZ_is_ok(uint64_t o) {
26526         LDKCResult_ChannelTransactionParametersDecodeErrorZ* o_conv = (LDKCResult_ChannelTransactionParametersDecodeErrorZ*)untag_ptr(o);
26527         jboolean ret_conv = CResult_ChannelTransactionParametersDecodeErrorZ_is_ok(o_conv);
26528         return ret_conv;
26529 }
26530
26531 void  __attribute__((export_name("TS_CResult_ChannelTransactionParametersDecodeErrorZ_free"))) TS_CResult_ChannelTransactionParametersDecodeErrorZ_free(uint64_t _res) {
26532         if (!ptr_is_owned(_res)) return;
26533         void* _res_ptr = untag_ptr(_res);
26534         CHECK_ACCESS(_res_ptr);
26535         LDKCResult_ChannelTransactionParametersDecodeErrorZ _res_conv = *(LDKCResult_ChannelTransactionParametersDecodeErrorZ*)(_res_ptr);
26536         FREE(untag_ptr(_res));
26537         CResult_ChannelTransactionParametersDecodeErrorZ_free(_res_conv);
26538 }
26539
26540 static inline uint64_t CResult_ChannelTransactionParametersDecodeErrorZ_clone_ptr(LDKCResult_ChannelTransactionParametersDecodeErrorZ *NONNULL_PTR arg) {
26541         LDKCResult_ChannelTransactionParametersDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelTransactionParametersDecodeErrorZ), "LDKCResult_ChannelTransactionParametersDecodeErrorZ");
26542         *ret_conv = CResult_ChannelTransactionParametersDecodeErrorZ_clone(arg);
26543         return tag_ptr(ret_conv, true);
26544 }
26545 int64_t  __attribute__((export_name("TS_CResult_ChannelTransactionParametersDecodeErrorZ_clone_ptr"))) TS_CResult_ChannelTransactionParametersDecodeErrorZ_clone_ptr(uint64_t arg) {
26546         LDKCResult_ChannelTransactionParametersDecodeErrorZ* arg_conv = (LDKCResult_ChannelTransactionParametersDecodeErrorZ*)untag_ptr(arg);
26547         int64_t ret_conv = CResult_ChannelTransactionParametersDecodeErrorZ_clone_ptr(arg_conv);
26548         return ret_conv;
26549 }
26550
26551 uint64_t  __attribute__((export_name("TS_CResult_ChannelTransactionParametersDecodeErrorZ_clone"))) TS_CResult_ChannelTransactionParametersDecodeErrorZ_clone(uint64_t orig) {
26552         LDKCResult_ChannelTransactionParametersDecodeErrorZ* orig_conv = (LDKCResult_ChannelTransactionParametersDecodeErrorZ*)untag_ptr(orig);
26553         LDKCResult_ChannelTransactionParametersDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelTransactionParametersDecodeErrorZ), "LDKCResult_ChannelTransactionParametersDecodeErrorZ");
26554         *ret_conv = CResult_ChannelTransactionParametersDecodeErrorZ_clone(orig_conv);
26555         return tag_ptr(ret_conv, true);
26556 }
26557
26558 uint64_t  __attribute__((export_name("TS_CResult_HolderCommitmentTransactionDecodeErrorZ_ok"))) TS_CResult_HolderCommitmentTransactionDecodeErrorZ_ok(uint64_t o) {
26559         LDKHolderCommitmentTransaction o_conv;
26560         o_conv.inner = untag_ptr(o);
26561         o_conv.is_owned = ptr_is_owned(o);
26562         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
26563         o_conv = HolderCommitmentTransaction_clone(&o_conv);
26564         LDKCResult_HolderCommitmentTransactionDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_HolderCommitmentTransactionDecodeErrorZ), "LDKCResult_HolderCommitmentTransactionDecodeErrorZ");
26565         *ret_conv = CResult_HolderCommitmentTransactionDecodeErrorZ_ok(o_conv);
26566         return tag_ptr(ret_conv, true);
26567 }
26568
26569 uint64_t  __attribute__((export_name("TS_CResult_HolderCommitmentTransactionDecodeErrorZ_err"))) TS_CResult_HolderCommitmentTransactionDecodeErrorZ_err(uint64_t e) {
26570         void* e_ptr = untag_ptr(e);
26571         CHECK_ACCESS(e_ptr);
26572         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
26573         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
26574         LDKCResult_HolderCommitmentTransactionDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_HolderCommitmentTransactionDecodeErrorZ), "LDKCResult_HolderCommitmentTransactionDecodeErrorZ");
26575         *ret_conv = CResult_HolderCommitmentTransactionDecodeErrorZ_err(e_conv);
26576         return tag_ptr(ret_conv, true);
26577 }
26578
26579 jboolean  __attribute__((export_name("TS_CResult_HolderCommitmentTransactionDecodeErrorZ_is_ok"))) TS_CResult_HolderCommitmentTransactionDecodeErrorZ_is_ok(uint64_t o) {
26580         LDKCResult_HolderCommitmentTransactionDecodeErrorZ* o_conv = (LDKCResult_HolderCommitmentTransactionDecodeErrorZ*)untag_ptr(o);
26581         jboolean ret_conv = CResult_HolderCommitmentTransactionDecodeErrorZ_is_ok(o_conv);
26582         return ret_conv;
26583 }
26584
26585 void  __attribute__((export_name("TS_CResult_HolderCommitmentTransactionDecodeErrorZ_free"))) TS_CResult_HolderCommitmentTransactionDecodeErrorZ_free(uint64_t _res) {
26586         if (!ptr_is_owned(_res)) return;
26587         void* _res_ptr = untag_ptr(_res);
26588         CHECK_ACCESS(_res_ptr);
26589         LDKCResult_HolderCommitmentTransactionDecodeErrorZ _res_conv = *(LDKCResult_HolderCommitmentTransactionDecodeErrorZ*)(_res_ptr);
26590         FREE(untag_ptr(_res));
26591         CResult_HolderCommitmentTransactionDecodeErrorZ_free(_res_conv);
26592 }
26593
26594 static inline uint64_t CResult_HolderCommitmentTransactionDecodeErrorZ_clone_ptr(LDKCResult_HolderCommitmentTransactionDecodeErrorZ *NONNULL_PTR arg) {
26595         LDKCResult_HolderCommitmentTransactionDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_HolderCommitmentTransactionDecodeErrorZ), "LDKCResult_HolderCommitmentTransactionDecodeErrorZ");
26596         *ret_conv = CResult_HolderCommitmentTransactionDecodeErrorZ_clone(arg);
26597         return tag_ptr(ret_conv, true);
26598 }
26599 int64_t  __attribute__((export_name("TS_CResult_HolderCommitmentTransactionDecodeErrorZ_clone_ptr"))) TS_CResult_HolderCommitmentTransactionDecodeErrorZ_clone_ptr(uint64_t arg) {
26600         LDKCResult_HolderCommitmentTransactionDecodeErrorZ* arg_conv = (LDKCResult_HolderCommitmentTransactionDecodeErrorZ*)untag_ptr(arg);
26601         int64_t ret_conv = CResult_HolderCommitmentTransactionDecodeErrorZ_clone_ptr(arg_conv);
26602         return ret_conv;
26603 }
26604
26605 uint64_t  __attribute__((export_name("TS_CResult_HolderCommitmentTransactionDecodeErrorZ_clone"))) TS_CResult_HolderCommitmentTransactionDecodeErrorZ_clone(uint64_t orig) {
26606         LDKCResult_HolderCommitmentTransactionDecodeErrorZ* orig_conv = (LDKCResult_HolderCommitmentTransactionDecodeErrorZ*)untag_ptr(orig);
26607         LDKCResult_HolderCommitmentTransactionDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_HolderCommitmentTransactionDecodeErrorZ), "LDKCResult_HolderCommitmentTransactionDecodeErrorZ");
26608         *ret_conv = CResult_HolderCommitmentTransactionDecodeErrorZ_clone(orig_conv);
26609         return tag_ptr(ret_conv, true);
26610 }
26611
26612 uint64_t  __attribute__((export_name("TS_CResult_BuiltCommitmentTransactionDecodeErrorZ_ok"))) TS_CResult_BuiltCommitmentTransactionDecodeErrorZ_ok(uint64_t o) {
26613         LDKBuiltCommitmentTransaction o_conv;
26614         o_conv.inner = untag_ptr(o);
26615         o_conv.is_owned = ptr_is_owned(o);
26616         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
26617         o_conv = BuiltCommitmentTransaction_clone(&o_conv);
26618         LDKCResult_BuiltCommitmentTransactionDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_BuiltCommitmentTransactionDecodeErrorZ), "LDKCResult_BuiltCommitmentTransactionDecodeErrorZ");
26619         *ret_conv = CResult_BuiltCommitmentTransactionDecodeErrorZ_ok(o_conv);
26620         return tag_ptr(ret_conv, true);
26621 }
26622
26623 uint64_t  __attribute__((export_name("TS_CResult_BuiltCommitmentTransactionDecodeErrorZ_err"))) TS_CResult_BuiltCommitmentTransactionDecodeErrorZ_err(uint64_t e) {
26624         void* e_ptr = untag_ptr(e);
26625         CHECK_ACCESS(e_ptr);
26626         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
26627         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
26628         LDKCResult_BuiltCommitmentTransactionDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_BuiltCommitmentTransactionDecodeErrorZ), "LDKCResult_BuiltCommitmentTransactionDecodeErrorZ");
26629         *ret_conv = CResult_BuiltCommitmentTransactionDecodeErrorZ_err(e_conv);
26630         return tag_ptr(ret_conv, true);
26631 }
26632
26633 jboolean  __attribute__((export_name("TS_CResult_BuiltCommitmentTransactionDecodeErrorZ_is_ok"))) TS_CResult_BuiltCommitmentTransactionDecodeErrorZ_is_ok(uint64_t o) {
26634         LDKCResult_BuiltCommitmentTransactionDecodeErrorZ* o_conv = (LDKCResult_BuiltCommitmentTransactionDecodeErrorZ*)untag_ptr(o);
26635         jboolean ret_conv = CResult_BuiltCommitmentTransactionDecodeErrorZ_is_ok(o_conv);
26636         return ret_conv;
26637 }
26638
26639 void  __attribute__((export_name("TS_CResult_BuiltCommitmentTransactionDecodeErrorZ_free"))) TS_CResult_BuiltCommitmentTransactionDecodeErrorZ_free(uint64_t _res) {
26640         if (!ptr_is_owned(_res)) return;
26641         void* _res_ptr = untag_ptr(_res);
26642         CHECK_ACCESS(_res_ptr);
26643         LDKCResult_BuiltCommitmentTransactionDecodeErrorZ _res_conv = *(LDKCResult_BuiltCommitmentTransactionDecodeErrorZ*)(_res_ptr);
26644         FREE(untag_ptr(_res));
26645         CResult_BuiltCommitmentTransactionDecodeErrorZ_free(_res_conv);
26646 }
26647
26648 static inline uint64_t CResult_BuiltCommitmentTransactionDecodeErrorZ_clone_ptr(LDKCResult_BuiltCommitmentTransactionDecodeErrorZ *NONNULL_PTR arg) {
26649         LDKCResult_BuiltCommitmentTransactionDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_BuiltCommitmentTransactionDecodeErrorZ), "LDKCResult_BuiltCommitmentTransactionDecodeErrorZ");
26650         *ret_conv = CResult_BuiltCommitmentTransactionDecodeErrorZ_clone(arg);
26651         return tag_ptr(ret_conv, true);
26652 }
26653 int64_t  __attribute__((export_name("TS_CResult_BuiltCommitmentTransactionDecodeErrorZ_clone_ptr"))) TS_CResult_BuiltCommitmentTransactionDecodeErrorZ_clone_ptr(uint64_t arg) {
26654         LDKCResult_BuiltCommitmentTransactionDecodeErrorZ* arg_conv = (LDKCResult_BuiltCommitmentTransactionDecodeErrorZ*)untag_ptr(arg);
26655         int64_t ret_conv = CResult_BuiltCommitmentTransactionDecodeErrorZ_clone_ptr(arg_conv);
26656         return ret_conv;
26657 }
26658
26659 uint64_t  __attribute__((export_name("TS_CResult_BuiltCommitmentTransactionDecodeErrorZ_clone"))) TS_CResult_BuiltCommitmentTransactionDecodeErrorZ_clone(uint64_t orig) {
26660         LDKCResult_BuiltCommitmentTransactionDecodeErrorZ* orig_conv = (LDKCResult_BuiltCommitmentTransactionDecodeErrorZ*)untag_ptr(orig);
26661         LDKCResult_BuiltCommitmentTransactionDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_BuiltCommitmentTransactionDecodeErrorZ), "LDKCResult_BuiltCommitmentTransactionDecodeErrorZ");
26662         *ret_conv = CResult_BuiltCommitmentTransactionDecodeErrorZ_clone(orig_conv);
26663         return tag_ptr(ret_conv, true);
26664 }
26665
26666 uint64_t  __attribute__((export_name("TS_CResult_TrustedClosingTransactionNoneZ_ok"))) TS_CResult_TrustedClosingTransactionNoneZ_ok(uint64_t o) {
26667         LDKTrustedClosingTransaction o_conv;
26668         o_conv.inner = untag_ptr(o);
26669         o_conv.is_owned = ptr_is_owned(o);
26670         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
26671         // WARNING: we need a move here but no clone is available for LDKTrustedClosingTransaction
26672         
26673         LDKCResult_TrustedClosingTransactionNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_TrustedClosingTransactionNoneZ), "LDKCResult_TrustedClosingTransactionNoneZ");
26674         *ret_conv = CResult_TrustedClosingTransactionNoneZ_ok(o_conv);
26675         return tag_ptr(ret_conv, true);
26676 }
26677
26678 uint64_t  __attribute__((export_name("TS_CResult_TrustedClosingTransactionNoneZ_err"))) TS_CResult_TrustedClosingTransactionNoneZ_err() {
26679         LDKCResult_TrustedClosingTransactionNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_TrustedClosingTransactionNoneZ), "LDKCResult_TrustedClosingTransactionNoneZ");
26680         *ret_conv = CResult_TrustedClosingTransactionNoneZ_err();
26681         return tag_ptr(ret_conv, true);
26682 }
26683
26684 jboolean  __attribute__((export_name("TS_CResult_TrustedClosingTransactionNoneZ_is_ok"))) TS_CResult_TrustedClosingTransactionNoneZ_is_ok(uint64_t o) {
26685         LDKCResult_TrustedClosingTransactionNoneZ* o_conv = (LDKCResult_TrustedClosingTransactionNoneZ*)untag_ptr(o);
26686         jboolean ret_conv = CResult_TrustedClosingTransactionNoneZ_is_ok(o_conv);
26687         return ret_conv;
26688 }
26689
26690 void  __attribute__((export_name("TS_CResult_TrustedClosingTransactionNoneZ_free"))) TS_CResult_TrustedClosingTransactionNoneZ_free(uint64_t _res) {
26691         if (!ptr_is_owned(_res)) return;
26692         void* _res_ptr = untag_ptr(_res);
26693         CHECK_ACCESS(_res_ptr);
26694         LDKCResult_TrustedClosingTransactionNoneZ _res_conv = *(LDKCResult_TrustedClosingTransactionNoneZ*)(_res_ptr);
26695         FREE(untag_ptr(_res));
26696         CResult_TrustedClosingTransactionNoneZ_free(_res_conv);
26697 }
26698
26699 uint64_t  __attribute__((export_name("TS_CResult_CommitmentTransactionDecodeErrorZ_ok"))) TS_CResult_CommitmentTransactionDecodeErrorZ_ok(uint64_t o) {
26700         LDKCommitmentTransaction o_conv;
26701         o_conv.inner = untag_ptr(o);
26702         o_conv.is_owned = ptr_is_owned(o);
26703         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
26704         o_conv = CommitmentTransaction_clone(&o_conv);
26705         LDKCResult_CommitmentTransactionDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CommitmentTransactionDecodeErrorZ), "LDKCResult_CommitmentTransactionDecodeErrorZ");
26706         *ret_conv = CResult_CommitmentTransactionDecodeErrorZ_ok(o_conv);
26707         return tag_ptr(ret_conv, true);
26708 }
26709
26710 uint64_t  __attribute__((export_name("TS_CResult_CommitmentTransactionDecodeErrorZ_err"))) TS_CResult_CommitmentTransactionDecodeErrorZ_err(uint64_t e) {
26711         void* e_ptr = untag_ptr(e);
26712         CHECK_ACCESS(e_ptr);
26713         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
26714         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
26715         LDKCResult_CommitmentTransactionDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CommitmentTransactionDecodeErrorZ), "LDKCResult_CommitmentTransactionDecodeErrorZ");
26716         *ret_conv = CResult_CommitmentTransactionDecodeErrorZ_err(e_conv);
26717         return tag_ptr(ret_conv, true);
26718 }
26719
26720 jboolean  __attribute__((export_name("TS_CResult_CommitmentTransactionDecodeErrorZ_is_ok"))) TS_CResult_CommitmentTransactionDecodeErrorZ_is_ok(uint64_t o) {
26721         LDKCResult_CommitmentTransactionDecodeErrorZ* o_conv = (LDKCResult_CommitmentTransactionDecodeErrorZ*)untag_ptr(o);
26722         jboolean ret_conv = CResult_CommitmentTransactionDecodeErrorZ_is_ok(o_conv);
26723         return ret_conv;
26724 }
26725
26726 void  __attribute__((export_name("TS_CResult_CommitmentTransactionDecodeErrorZ_free"))) TS_CResult_CommitmentTransactionDecodeErrorZ_free(uint64_t _res) {
26727         if (!ptr_is_owned(_res)) return;
26728         void* _res_ptr = untag_ptr(_res);
26729         CHECK_ACCESS(_res_ptr);
26730         LDKCResult_CommitmentTransactionDecodeErrorZ _res_conv = *(LDKCResult_CommitmentTransactionDecodeErrorZ*)(_res_ptr);
26731         FREE(untag_ptr(_res));
26732         CResult_CommitmentTransactionDecodeErrorZ_free(_res_conv);
26733 }
26734
26735 static inline uint64_t CResult_CommitmentTransactionDecodeErrorZ_clone_ptr(LDKCResult_CommitmentTransactionDecodeErrorZ *NONNULL_PTR arg) {
26736         LDKCResult_CommitmentTransactionDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CommitmentTransactionDecodeErrorZ), "LDKCResult_CommitmentTransactionDecodeErrorZ");
26737         *ret_conv = CResult_CommitmentTransactionDecodeErrorZ_clone(arg);
26738         return tag_ptr(ret_conv, true);
26739 }
26740 int64_t  __attribute__((export_name("TS_CResult_CommitmentTransactionDecodeErrorZ_clone_ptr"))) TS_CResult_CommitmentTransactionDecodeErrorZ_clone_ptr(uint64_t arg) {
26741         LDKCResult_CommitmentTransactionDecodeErrorZ* arg_conv = (LDKCResult_CommitmentTransactionDecodeErrorZ*)untag_ptr(arg);
26742         int64_t ret_conv = CResult_CommitmentTransactionDecodeErrorZ_clone_ptr(arg_conv);
26743         return ret_conv;
26744 }
26745
26746 uint64_t  __attribute__((export_name("TS_CResult_CommitmentTransactionDecodeErrorZ_clone"))) TS_CResult_CommitmentTransactionDecodeErrorZ_clone(uint64_t orig) {
26747         LDKCResult_CommitmentTransactionDecodeErrorZ* orig_conv = (LDKCResult_CommitmentTransactionDecodeErrorZ*)untag_ptr(orig);
26748         LDKCResult_CommitmentTransactionDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CommitmentTransactionDecodeErrorZ), "LDKCResult_CommitmentTransactionDecodeErrorZ");
26749         *ret_conv = CResult_CommitmentTransactionDecodeErrorZ_clone(orig_conv);
26750         return tag_ptr(ret_conv, true);
26751 }
26752
26753 uint64_t  __attribute__((export_name("TS_CResult_TrustedCommitmentTransactionNoneZ_ok"))) TS_CResult_TrustedCommitmentTransactionNoneZ_ok(uint64_t o) {
26754         LDKTrustedCommitmentTransaction o_conv;
26755         o_conv.inner = untag_ptr(o);
26756         o_conv.is_owned = ptr_is_owned(o);
26757         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
26758         // WARNING: we need a move here but no clone is available for LDKTrustedCommitmentTransaction
26759         
26760         LDKCResult_TrustedCommitmentTransactionNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_TrustedCommitmentTransactionNoneZ), "LDKCResult_TrustedCommitmentTransactionNoneZ");
26761         *ret_conv = CResult_TrustedCommitmentTransactionNoneZ_ok(o_conv);
26762         return tag_ptr(ret_conv, true);
26763 }
26764
26765 uint64_t  __attribute__((export_name("TS_CResult_TrustedCommitmentTransactionNoneZ_err"))) TS_CResult_TrustedCommitmentTransactionNoneZ_err() {
26766         LDKCResult_TrustedCommitmentTransactionNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_TrustedCommitmentTransactionNoneZ), "LDKCResult_TrustedCommitmentTransactionNoneZ");
26767         *ret_conv = CResult_TrustedCommitmentTransactionNoneZ_err();
26768         return tag_ptr(ret_conv, true);
26769 }
26770
26771 jboolean  __attribute__((export_name("TS_CResult_TrustedCommitmentTransactionNoneZ_is_ok"))) TS_CResult_TrustedCommitmentTransactionNoneZ_is_ok(uint64_t o) {
26772         LDKCResult_TrustedCommitmentTransactionNoneZ* o_conv = (LDKCResult_TrustedCommitmentTransactionNoneZ*)untag_ptr(o);
26773         jboolean ret_conv = CResult_TrustedCommitmentTransactionNoneZ_is_ok(o_conv);
26774         return ret_conv;
26775 }
26776
26777 void  __attribute__((export_name("TS_CResult_TrustedCommitmentTransactionNoneZ_free"))) TS_CResult_TrustedCommitmentTransactionNoneZ_free(uint64_t _res) {
26778         if (!ptr_is_owned(_res)) return;
26779         void* _res_ptr = untag_ptr(_res);
26780         CHECK_ACCESS(_res_ptr);
26781         LDKCResult_TrustedCommitmentTransactionNoneZ _res_conv = *(LDKCResult_TrustedCommitmentTransactionNoneZ*)(_res_ptr);
26782         FREE(untag_ptr(_res));
26783         CResult_TrustedCommitmentTransactionNoneZ_free(_res_conv);
26784 }
26785
26786 uint64_t  __attribute__((export_name("TS_CResult_CVec_ECDSASignatureZNoneZ_ok"))) TS_CResult_CVec_ECDSASignatureZNoneZ_ok(ptrArray o) {
26787         LDKCVec_ECDSASignatureZ o_constr;
26788         o_constr.datalen = o->arr_len;
26789         if (o_constr.datalen > 0)
26790                 o_constr.data = MALLOC(o_constr.datalen * sizeof(LDKECDSASignature), "LDKCVec_ECDSASignatureZ Elements");
26791         else
26792                 o_constr.data = NULL;
26793         int8_tArray* o_vals = (void*) o->elems;
26794         for (size_t m = 0; m < o_constr.datalen; m++) {
26795                 int8_tArray o_conv_12 = o_vals[m];
26796                 LDKECDSASignature o_conv_12_ref;
26797                 CHECK(o_conv_12->arr_len == 64);
26798                 memcpy(o_conv_12_ref.compact_form, o_conv_12->elems, 64); FREE(o_conv_12);
26799                 o_constr.data[m] = o_conv_12_ref;
26800         }
26801         FREE(o);
26802         LDKCResult_CVec_ECDSASignatureZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_ECDSASignatureZNoneZ), "LDKCResult_CVec_ECDSASignatureZNoneZ");
26803         *ret_conv = CResult_CVec_ECDSASignatureZNoneZ_ok(o_constr);
26804         return tag_ptr(ret_conv, true);
26805 }
26806
26807 uint64_t  __attribute__((export_name("TS_CResult_CVec_ECDSASignatureZNoneZ_err"))) TS_CResult_CVec_ECDSASignatureZNoneZ_err() {
26808         LDKCResult_CVec_ECDSASignatureZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_ECDSASignatureZNoneZ), "LDKCResult_CVec_ECDSASignatureZNoneZ");
26809         *ret_conv = CResult_CVec_ECDSASignatureZNoneZ_err();
26810         return tag_ptr(ret_conv, true);
26811 }
26812
26813 jboolean  __attribute__((export_name("TS_CResult_CVec_ECDSASignatureZNoneZ_is_ok"))) TS_CResult_CVec_ECDSASignatureZNoneZ_is_ok(uint64_t o) {
26814         LDKCResult_CVec_ECDSASignatureZNoneZ* o_conv = (LDKCResult_CVec_ECDSASignatureZNoneZ*)untag_ptr(o);
26815         jboolean ret_conv = CResult_CVec_ECDSASignatureZNoneZ_is_ok(o_conv);
26816         return ret_conv;
26817 }
26818
26819 void  __attribute__((export_name("TS_CResult_CVec_ECDSASignatureZNoneZ_free"))) TS_CResult_CVec_ECDSASignatureZNoneZ_free(uint64_t _res) {
26820         if (!ptr_is_owned(_res)) return;
26821         void* _res_ptr = untag_ptr(_res);
26822         CHECK_ACCESS(_res_ptr);
26823         LDKCResult_CVec_ECDSASignatureZNoneZ _res_conv = *(LDKCResult_CVec_ECDSASignatureZNoneZ*)(_res_ptr);
26824         FREE(untag_ptr(_res));
26825         CResult_CVec_ECDSASignatureZNoneZ_free(_res_conv);
26826 }
26827
26828 static inline uint64_t CResult_CVec_ECDSASignatureZNoneZ_clone_ptr(LDKCResult_CVec_ECDSASignatureZNoneZ *NONNULL_PTR arg) {
26829         LDKCResult_CVec_ECDSASignatureZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_ECDSASignatureZNoneZ), "LDKCResult_CVec_ECDSASignatureZNoneZ");
26830         *ret_conv = CResult_CVec_ECDSASignatureZNoneZ_clone(arg);
26831         return tag_ptr(ret_conv, true);
26832 }
26833 int64_t  __attribute__((export_name("TS_CResult_CVec_ECDSASignatureZNoneZ_clone_ptr"))) TS_CResult_CVec_ECDSASignatureZNoneZ_clone_ptr(uint64_t arg) {
26834         LDKCResult_CVec_ECDSASignatureZNoneZ* arg_conv = (LDKCResult_CVec_ECDSASignatureZNoneZ*)untag_ptr(arg);
26835         int64_t ret_conv = CResult_CVec_ECDSASignatureZNoneZ_clone_ptr(arg_conv);
26836         return ret_conv;
26837 }
26838
26839 uint64_t  __attribute__((export_name("TS_CResult_CVec_ECDSASignatureZNoneZ_clone"))) TS_CResult_CVec_ECDSASignatureZNoneZ_clone(uint64_t orig) {
26840         LDKCResult_CVec_ECDSASignatureZNoneZ* orig_conv = (LDKCResult_CVec_ECDSASignatureZNoneZ*)untag_ptr(orig);
26841         LDKCResult_CVec_ECDSASignatureZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_ECDSASignatureZNoneZ), "LDKCResult_CVec_ECDSASignatureZNoneZ");
26842         *ret_conv = CResult_CVec_ECDSASignatureZNoneZ_clone(orig_conv);
26843         return tag_ptr(ret_conv, true);
26844 }
26845
26846 uint64_t  __attribute__((export_name("TS_COption_usizeZ_some"))) TS_COption_usizeZ_some(uint32_t o) {
26847         LDKCOption_usizeZ *ret_copy = MALLOC(sizeof(LDKCOption_usizeZ), "LDKCOption_usizeZ");
26848         *ret_copy = COption_usizeZ_some(o);
26849         uint64_t ret_ref = tag_ptr(ret_copy, true);
26850         return ret_ref;
26851 }
26852
26853 uint64_t  __attribute__((export_name("TS_COption_usizeZ_none"))) TS_COption_usizeZ_none() {
26854         LDKCOption_usizeZ *ret_copy = MALLOC(sizeof(LDKCOption_usizeZ), "LDKCOption_usizeZ");
26855         *ret_copy = COption_usizeZ_none();
26856         uint64_t ret_ref = tag_ptr(ret_copy, true);
26857         return ret_ref;
26858 }
26859
26860 void  __attribute__((export_name("TS_COption_usizeZ_free"))) TS_COption_usizeZ_free(uint64_t _res) {
26861         if (!ptr_is_owned(_res)) return;
26862         void* _res_ptr = untag_ptr(_res);
26863         CHECK_ACCESS(_res_ptr);
26864         LDKCOption_usizeZ _res_conv = *(LDKCOption_usizeZ*)(_res_ptr);
26865         FREE(untag_ptr(_res));
26866         COption_usizeZ_free(_res_conv);
26867 }
26868
26869 static inline uint64_t COption_usizeZ_clone_ptr(LDKCOption_usizeZ *NONNULL_PTR arg) {
26870         LDKCOption_usizeZ *ret_copy = MALLOC(sizeof(LDKCOption_usizeZ), "LDKCOption_usizeZ");
26871         *ret_copy = COption_usizeZ_clone(arg);
26872         uint64_t ret_ref = tag_ptr(ret_copy, true);
26873         return ret_ref;
26874 }
26875 int64_t  __attribute__((export_name("TS_COption_usizeZ_clone_ptr"))) TS_COption_usizeZ_clone_ptr(uint64_t arg) {
26876         LDKCOption_usizeZ* arg_conv = (LDKCOption_usizeZ*)untag_ptr(arg);
26877         int64_t ret_conv = COption_usizeZ_clone_ptr(arg_conv);
26878         return ret_conv;
26879 }
26880
26881 uint64_t  __attribute__((export_name("TS_COption_usizeZ_clone"))) TS_COption_usizeZ_clone(uint64_t orig) {
26882         LDKCOption_usizeZ* orig_conv = (LDKCOption_usizeZ*)untag_ptr(orig);
26883         LDKCOption_usizeZ *ret_copy = MALLOC(sizeof(LDKCOption_usizeZ), "LDKCOption_usizeZ");
26884         *ret_copy = COption_usizeZ_clone(orig_conv);
26885         uint64_t ret_ref = tag_ptr(ret_copy, true);
26886         return ret_ref;
26887 }
26888
26889 uint64_t  __attribute__((export_name("TS_CResult_ShutdownScriptDecodeErrorZ_ok"))) TS_CResult_ShutdownScriptDecodeErrorZ_ok(uint64_t o) {
26890         LDKShutdownScript o_conv;
26891         o_conv.inner = untag_ptr(o);
26892         o_conv.is_owned = ptr_is_owned(o);
26893         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
26894         o_conv = ShutdownScript_clone(&o_conv);
26895         LDKCResult_ShutdownScriptDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ShutdownScriptDecodeErrorZ), "LDKCResult_ShutdownScriptDecodeErrorZ");
26896         *ret_conv = CResult_ShutdownScriptDecodeErrorZ_ok(o_conv);
26897         return tag_ptr(ret_conv, true);
26898 }
26899
26900 uint64_t  __attribute__((export_name("TS_CResult_ShutdownScriptDecodeErrorZ_err"))) TS_CResult_ShutdownScriptDecodeErrorZ_err(uint64_t e) {
26901         void* e_ptr = untag_ptr(e);
26902         CHECK_ACCESS(e_ptr);
26903         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
26904         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
26905         LDKCResult_ShutdownScriptDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ShutdownScriptDecodeErrorZ), "LDKCResult_ShutdownScriptDecodeErrorZ");
26906         *ret_conv = CResult_ShutdownScriptDecodeErrorZ_err(e_conv);
26907         return tag_ptr(ret_conv, true);
26908 }
26909
26910 jboolean  __attribute__((export_name("TS_CResult_ShutdownScriptDecodeErrorZ_is_ok"))) TS_CResult_ShutdownScriptDecodeErrorZ_is_ok(uint64_t o) {
26911         LDKCResult_ShutdownScriptDecodeErrorZ* o_conv = (LDKCResult_ShutdownScriptDecodeErrorZ*)untag_ptr(o);
26912         jboolean ret_conv = CResult_ShutdownScriptDecodeErrorZ_is_ok(o_conv);
26913         return ret_conv;
26914 }
26915
26916 void  __attribute__((export_name("TS_CResult_ShutdownScriptDecodeErrorZ_free"))) TS_CResult_ShutdownScriptDecodeErrorZ_free(uint64_t _res) {
26917         if (!ptr_is_owned(_res)) return;
26918         void* _res_ptr = untag_ptr(_res);
26919         CHECK_ACCESS(_res_ptr);
26920         LDKCResult_ShutdownScriptDecodeErrorZ _res_conv = *(LDKCResult_ShutdownScriptDecodeErrorZ*)(_res_ptr);
26921         FREE(untag_ptr(_res));
26922         CResult_ShutdownScriptDecodeErrorZ_free(_res_conv);
26923 }
26924
26925 static inline uint64_t CResult_ShutdownScriptDecodeErrorZ_clone_ptr(LDKCResult_ShutdownScriptDecodeErrorZ *NONNULL_PTR arg) {
26926         LDKCResult_ShutdownScriptDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ShutdownScriptDecodeErrorZ), "LDKCResult_ShutdownScriptDecodeErrorZ");
26927         *ret_conv = CResult_ShutdownScriptDecodeErrorZ_clone(arg);
26928         return tag_ptr(ret_conv, true);
26929 }
26930 int64_t  __attribute__((export_name("TS_CResult_ShutdownScriptDecodeErrorZ_clone_ptr"))) TS_CResult_ShutdownScriptDecodeErrorZ_clone_ptr(uint64_t arg) {
26931         LDKCResult_ShutdownScriptDecodeErrorZ* arg_conv = (LDKCResult_ShutdownScriptDecodeErrorZ*)untag_ptr(arg);
26932         int64_t ret_conv = CResult_ShutdownScriptDecodeErrorZ_clone_ptr(arg_conv);
26933         return ret_conv;
26934 }
26935
26936 uint64_t  __attribute__((export_name("TS_CResult_ShutdownScriptDecodeErrorZ_clone"))) TS_CResult_ShutdownScriptDecodeErrorZ_clone(uint64_t orig) {
26937         LDKCResult_ShutdownScriptDecodeErrorZ* orig_conv = (LDKCResult_ShutdownScriptDecodeErrorZ*)untag_ptr(orig);
26938         LDKCResult_ShutdownScriptDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ShutdownScriptDecodeErrorZ), "LDKCResult_ShutdownScriptDecodeErrorZ");
26939         *ret_conv = CResult_ShutdownScriptDecodeErrorZ_clone(orig_conv);
26940         return tag_ptr(ret_conv, true);
26941 }
26942
26943 uint64_t  __attribute__((export_name("TS_CResult_ShutdownScriptInvalidShutdownScriptZ_ok"))) TS_CResult_ShutdownScriptInvalidShutdownScriptZ_ok(uint64_t o) {
26944         LDKShutdownScript o_conv;
26945         o_conv.inner = untag_ptr(o);
26946         o_conv.is_owned = ptr_is_owned(o);
26947         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
26948         o_conv = ShutdownScript_clone(&o_conv);
26949         LDKCResult_ShutdownScriptInvalidShutdownScriptZ* ret_conv = MALLOC(sizeof(LDKCResult_ShutdownScriptInvalidShutdownScriptZ), "LDKCResult_ShutdownScriptInvalidShutdownScriptZ");
26950         *ret_conv = CResult_ShutdownScriptInvalidShutdownScriptZ_ok(o_conv);
26951         return tag_ptr(ret_conv, true);
26952 }
26953
26954 uint64_t  __attribute__((export_name("TS_CResult_ShutdownScriptInvalidShutdownScriptZ_err"))) TS_CResult_ShutdownScriptInvalidShutdownScriptZ_err(uint64_t e) {
26955         LDKInvalidShutdownScript e_conv;
26956         e_conv.inner = untag_ptr(e);
26957         e_conv.is_owned = ptr_is_owned(e);
26958         CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
26959         e_conv = InvalidShutdownScript_clone(&e_conv);
26960         LDKCResult_ShutdownScriptInvalidShutdownScriptZ* ret_conv = MALLOC(sizeof(LDKCResult_ShutdownScriptInvalidShutdownScriptZ), "LDKCResult_ShutdownScriptInvalidShutdownScriptZ");
26961         *ret_conv = CResult_ShutdownScriptInvalidShutdownScriptZ_err(e_conv);
26962         return tag_ptr(ret_conv, true);
26963 }
26964
26965 jboolean  __attribute__((export_name("TS_CResult_ShutdownScriptInvalidShutdownScriptZ_is_ok"))) TS_CResult_ShutdownScriptInvalidShutdownScriptZ_is_ok(uint64_t o) {
26966         LDKCResult_ShutdownScriptInvalidShutdownScriptZ* o_conv = (LDKCResult_ShutdownScriptInvalidShutdownScriptZ*)untag_ptr(o);
26967         jboolean ret_conv = CResult_ShutdownScriptInvalidShutdownScriptZ_is_ok(o_conv);
26968         return ret_conv;
26969 }
26970
26971 void  __attribute__((export_name("TS_CResult_ShutdownScriptInvalidShutdownScriptZ_free"))) TS_CResult_ShutdownScriptInvalidShutdownScriptZ_free(uint64_t _res) {
26972         if (!ptr_is_owned(_res)) return;
26973         void* _res_ptr = untag_ptr(_res);
26974         CHECK_ACCESS(_res_ptr);
26975         LDKCResult_ShutdownScriptInvalidShutdownScriptZ _res_conv = *(LDKCResult_ShutdownScriptInvalidShutdownScriptZ*)(_res_ptr);
26976         FREE(untag_ptr(_res));
26977         CResult_ShutdownScriptInvalidShutdownScriptZ_free(_res_conv);
26978 }
26979
26980 static inline uint64_t CResult_ShutdownScriptInvalidShutdownScriptZ_clone_ptr(LDKCResult_ShutdownScriptInvalidShutdownScriptZ *NONNULL_PTR arg) {
26981         LDKCResult_ShutdownScriptInvalidShutdownScriptZ* ret_conv = MALLOC(sizeof(LDKCResult_ShutdownScriptInvalidShutdownScriptZ), "LDKCResult_ShutdownScriptInvalidShutdownScriptZ");
26982         *ret_conv = CResult_ShutdownScriptInvalidShutdownScriptZ_clone(arg);
26983         return tag_ptr(ret_conv, true);
26984 }
26985 int64_t  __attribute__((export_name("TS_CResult_ShutdownScriptInvalidShutdownScriptZ_clone_ptr"))) TS_CResult_ShutdownScriptInvalidShutdownScriptZ_clone_ptr(uint64_t arg) {
26986         LDKCResult_ShutdownScriptInvalidShutdownScriptZ* arg_conv = (LDKCResult_ShutdownScriptInvalidShutdownScriptZ*)untag_ptr(arg);
26987         int64_t ret_conv = CResult_ShutdownScriptInvalidShutdownScriptZ_clone_ptr(arg_conv);
26988         return ret_conv;
26989 }
26990
26991 uint64_t  __attribute__((export_name("TS_CResult_ShutdownScriptInvalidShutdownScriptZ_clone"))) TS_CResult_ShutdownScriptInvalidShutdownScriptZ_clone(uint64_t orig) {
26992         LDKCResult_ShutdownScriptInvalidShutdownScriptZ* orig_conv = (LDKCResult_ShutdownScriptInvalidShutdownScriptZ*)untag_ptr(orig);
26993         LDKCResult_ShutdownScriptInvalidShutdownScriptZ* ret_conv = MALLOC(sizeof(LDKCResult_ShutdownScriptInvalidShutdownScriptZ), "LDKCResult_ShutdownScriptInvalidShutdownScriptZ");
26994         *ret_conv = CResult_ShutdownScriptInvalidShutdownScriptZ_clone(orig_conv);
26995         return tag_ptr(ret_conv, true);
26996 }
26997
26998 uint64_t  __attribute__((export_name("TS_CResult_PaymentPurposeDecodeErrorZ_ok"))) TS_CResult_PaymentPurposeDecodeErrorZ_ok(uint64_t o) {
26999         void* o_ptr = untag_ptr(o);
27000         CHECK_ACCESS(o_ptr);
27001         LDKPaymentPurpose o_conv = *(LDKPaymentPurpose*)(o_ptr);
27002         o_conv = PaymentPurpose_clone((LDKPaymentPurpose*)untag_ptr(o));
27003         LDKCResult_PaymentPurposeDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PaymentPurposeDecodeErrorZ), "LDKCResult_PaymentPurposeDecodeErrorZ");
27004         *ret_conv = CResult_PaymentPurposeDecodeErrorZ_ok(o_conv);
27005         return tag_ptr(ret_conv, true);
27006 }
27007
27008 uint64_t  __attribute__((export_name("TS_CResult_PaymentPurposeDecodeErrorZ_err"))) TS_CResult_PaymentPurposeDecodeErrorZ_err(uint64_t e) {
27009         void* e_ptr = untag_ptr(e);
27010         CHECK_ACCESS(e_ptr);
27011         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
27012         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
27013         LDKCResult_PaymentPurposeDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PaymentPurposeDecodeErrorZ), "LDKCResult_PaymentPurposeDecodeErrorZ");
27014         *ret_conv = CResult_PaymentPurposeDecodeErrorZ_err(e_conv);
27015         return tag_ptr(ret_conv, true);
27016 }
27017
27018 jboolean  __attribute__((export_name("TS_CResult_PaymentPurposeDecodeErrorZ_is_ok"))) TS_CResult_PaymentPurposeDecodeErrorZ_is_ok(uint64_t o) {
27019         LDKCResult_PaymentPurposeDecodeErrorZ* o_conv = (LDKCResult_PaymentPurposeDecodeErrorZ*)untag_ptr(o);
27020         jboolean ret_conv = CResult_PaymentPurposeDecodeErrorZ_is_ok(o_conv);
27021         return ret_conv;
27022 }
27023
27024 void  __attribute__((export_name("TS_CResult_PaymentPurposeDecodeErrorZ_free"))) TS_CResult_PaymentPurposeDecodeErrorZ_free(uint64_t _res) {
27025         if (!ptr_is_owned(_res)) return;
27026         void* _res_ptr = untag_ptr(_res);
27027         CHECK_ACCESS(_res_ptr);
27028         LDKCResult_PaymentPurposeDecodeErrorZ _res_conv = *(LDKCResult_PaymentPurposeDecodeErrorZ*)(_res_ptr);
27029         FREE(untag_ptr(_res));
27030         CResult_PaymentPurposeDecodeErrorZ_free(_res_conv);
27031 }
27032
27033 static inline uint64_t CResult_PaymentPurposeDecodeErrorZ_clone_ptr(LDKCResult_PaymentPurposeDecodeErrorZ *NONNULL_PTR arg) {
27034         LDKCResult_PaymentPurposeDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PaymentPurposeDecodeErrorZ), "LDKCResult_PaymentPurposeDecodeErrorZ");
27035         *ret_conv = CResult_PaymentPurposeDecodeErrorZ_clone(arg);
27036         return tag_ptr(ret_conv, true);
27037 }
27038 int64_t  __attribute__((export_name("TS_CResult_PaymentPurposeDecodeErrorZ_clone_ptr"))) TS_CResult_PaymentPurposeDecodeErrorZ_clone_ptr(uint64_t arg) {
27039         LDKCResult_PaymentPurposeDecodeErrorZ* arg_conv = (LDKCResult_PaymentPurposeDecodeErrorZ*)untag_ptr(arg);
27040         int64_t ret_conv = CResult_PaymentPurposeDecodeErrorZ_clone_ptr(arg_conv);
27041         return ret_conv;
27042 }
27043
27044 uint64_t  __attribute__((export_name("TS_CResult_PaymentPurposeDecodeErrorZ_clone"))) TS_CResult_PaymentPurposeDecodeErrorZ_clone(uint64_t orig) {
27045         LDKCResult_PaymentPurposeDecodeErrorZ* orig_conv = (LDKCResult_PaymentPurposeDecodeErrorZ*)untag_ptr(orig);
27046         LDKCResult_PaymentPurposeDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PaymentPurposeDecodeErrorZ), "LDKCResult_PaymentPurposeDecodeErrorZ");
27047         *ret_conv = CResult_PaymentPurposeDecodeErrorZ_clone(orig_conv);
27048         return tag_ptr(ret_conv, true);
27049 }
27050
27051 uint64_t  __attribute__((export_name("TS_CResult_ClaimedHTLCDecodeErrorZ_ok"))) TS_CResult_ClaimedHTLCDecodeErrorZ_ok(uint64_t o) {
27052         LDKClaimedHTLC o_conv;
27053         o_conv.inner = untag_ptr(o);
27054         o_conv.is_owned = ptr_is_owned(o);
27055         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
27056         o_conv = ClaimedHTLC_clone(&o_conv);
27057         LDKCResult_ClaimedHTLCDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ClaimedHTLCDecodeErrorZ), "LDKCResult_ClaimedHTLCDecodeErrorZ");
27058         *ret_conv = CResult_ClaimedHTLCDecodeErrorZ_ok(o_conv);
27059         return tag_ptr(ret_conv, true);
27060 }
27061
27062 uint64_t  __attribute__((export_name("TS_CResult_ClaimedHTLCDecodeErrorZ_err"))) TS_CResult_ClaimedHTLCDecodeErrorZ_err(uint64_t e) {
27063         void* e_ptr = untag_ptr(e);
27064         CHECK_ACCESS(e_ptr);
27065         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
27066         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
27067         LDKCResult_ClaimedHTLCDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ClaimedHTLCDecodeErrorZ), "LDKCResult_ClaimedHTLCDecodeErrorZ");
27068         *ret_conv = CResult_ClaimedHTLCDecodeErrorZ_err(e_conv);
27069         return tag_ptr(ret_conv, true);
27070 }
27071
27072 jboolean  __attribute__((export_name("TS_CResult_ClaimedHTLCDecodeErrorZ_is_ok"))) TS_CResult_ClaimedHTLCDecodeErrorZ_is_ok(uint64_t o) {
27073         LDKCResult_ClaimedHTLCDecodeErrorZ* o_conv = (LDKCResult_ClaimedHTLCDecodeErrorZ*)untag_ptr(o);
27074         jboolean ret_conv = CResult_ClaimedHTLCDecodeErrorZ_is_ok(o_conv);
27075         return ret_conv;
27076 }
27077
27078 void  __attribute__((export_name("TS_CResult_ClaimedHTLCDecodeErrorZ_free"))) TS_CResult_ClaimedHTLCDecodeErrorZ_free(uint64_t _res) {
27079         if (!ptr_is_owned(_res)) return;
27080         void* _res_ptr = untag_ptr(_res);
27081         CHECK_ACCESS(_res_ptr);
27082         LDKCResult_ClaimedHTLCDecodeErrorZ _res_conv = *(LDKCResult_ClaimedHTLCDecodeErrorZ*)(_res_ptr);
27083         FREE(untag_ptr(_res));
27084         CResult_ClaimedHTLCDecodeErrorZ_free(_res_conv);
27085 }
27086
27087 static inline uint64_t CResult_ClaimedHTLCDecodeErrorZ_clone_ptr(LDKCResult_ClaimedHTLCDecodeErrorZ *NONNULL_PTR arg) {
27088         LDKCResult_ClaimedHTLCDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ClaimedHTLCDecodeErrorZ), "LDKCResult_ClaimedHTLCDecodeErrorZ");
27089         *ret_conv = CResult_ClaimedHTLCDecodeErrorZ_clone(arg);
27090         return tag_ptr(ret_conv, true);
27091 }
27092 int64_t  __attribute__((export_name("TS_CResult_ClaimedHTLCDecodeErrorZ_clone_ptr"))) TS_CResult_ClaimedHTLCDecodeErrorZ_clone_ptr(uint64_t arg) {
27093         LDKCResult_ClaimedHTLCDecodeErrorZ* arg_conv = (LDKCResult_ClaimedHTLCDecodeErrorZ*)untag_ptr(arg);
27094         int64_t ret_conv = CResult_ClaimedHTLCDecodeErrorZ_clone_ptr(arg_conv);
27095         return ret_conv;
27096 }
27097
27098 uint64_t  __attribute__((export_name("TS_CResult_ClaimedHTLCDecodeErrorZ_clone"))) TS_CResult_ClaimedHTLCDecodeErrorZ_clone(uint64_t orig) {
27099         LDKCResult_ClaimedHTLCDecodeErrorZ* orig_conv = (LDKCResult_ClaimedHTLCDecodeErrorZ*)untag_ptr(orig);
27100         LDKCResult_ClaimedHTLCDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ClaimedHTLCDecodeErrorZ), "LDKCResult_ClaimedHTLCDecodeErrorZ");
27101         *ret_conv = CResult_ClaimedHTLCDecodeErrorZ_clone(orig_conv);
27102         return tag_ptr(ret_conv, true);
27103 }
27104
27105 uint64_t  __attribute__((export_name("TS_COption_PathFailureZ_some"))) TS_COption_PathFailureZ_some(uint64_t o) {
27106         void* o_ptr = untag_ptr(o);
27107         CHECK_ACCESS(o_ptr);
27108         LDKPathFailure o_conv = *(LDKPathFailure*)(o_ptr);
27109         o_conv = PathFailure_clone((LDKPathFailure*)untag_ptr(o));
27110         LDKCOption_PathFailureZ *ret_copy = MALLOC(sizeof(LDKCOption_PathFailureZ), "LDKCOption_PathFailureZ");
27111         *ret_copy = COption_PathFailureZ_some(o_conv);
27112         uint64_t ret_ref = tag_ptr(ret_copy, true);
27113         return ret_ref;
27114 }
27115
27116 uint64_t  __attribute__((export_name("TS_COption_PathFailureZ_none"))) TS_COption_PathFailureZ_none() {
27117         LDKCOption_PathFailureZ *ret_copy = MALLOC(sizeof(LDKCOption_PathFailureZ), "LDKCOption_PathFailureZ");
27118         *ret_copy = COption_PathFailureZ_none();
27119         uint64_t ret_ref = tag_ptr(ret_copy, true);
27120         return ret_ref;
27121 }
27122
27123 void  __attribute__((export_name("TS_COption_PathFailureZ_free"))) TS_COption_PathFailureZ_free(uint64_t _res) {
27124         if (!ptr_is_owned(_res)) return;
27125         void* _res_ptr = untag_ptr(_res);
27126         CHECK_ACCESS(_res_ptr);
27127         LDKCOption_PathFailureZ _res_conv = *(LDKCOption_PathFailureZ*)(_res_ptr);
27128         FREE(untag_ptr(_res));
27129         COption_PathFailureZ_free(_res_conv);
27130 }
27131
27132 static inline uint64_t COption_PathFailureZ_clone_ptr(LDKCOption_PathFailureZ *NONNULL_PTR arg) {
27133         LDKCOption_PathFailureZ *ret_copy = MALLOC(sizeof(LDKCOption_PathFailureZ), "LDKCOption_PathFailureZ");
27134         *ret_copy = COption_PathFailureZ_clone(arg);
27135         uint64_t ret_ref = tag_ptr(ret_copy, true);
27136         return ret_ref;
27137 }
27138 int64_t  __attribute__((export_name("TS_COption_PathFailureZ_clone_ptr"))) TS_COption_PathFailureZ_clone_ptr(uint64_t arg) {
27139         LDKCOption_PathFailureZ* arg_conv = (LDKCOption_PathFailureZ*)untag_ptr(arg);
27140         int64_t ret_conv = COption_PathFailureZ_clone_ptr(arg_conv);
27141         return ret_conv;
27142 }
27143
27144 uint64_t  __attribute__((export_name("TS_COption_PathFailureZ_clone"))) TS_COption_PathFailureZ_clone(uint64_t orig) {
27145         LDKCOption_PathFailureZ* orig_conv = (LDKCOption_PathFailureZ*)untag_ptr(orig);
27146         LDKCOption_PathFailureZ *ret_copy = MALLOC(sizeof(LDKCOption_PathFailureZ), "LDKCOption_PathFailureZ");
27147         *ret_copy = COption_PathFailureZ_clone(orig_conv);
27148         uint64_t ret_ref = tag_ptr(ret_copy, true);
27149         return ret_ref;
27150 }
27151
27152 uint64_t  __attribute__((export_name("TS_CResult_COption_PathFailureZDecodeErrorZ_ok"))) TS_CResult_COption_PathFailureZDecodeErrorZ_ok(uint64_t o) {
27153         void* o_ptr = untag_ptr(o);
27154         CHECK_ACCESS(o_ptr);
27155         LDKCOption_PathFailureZ o_conv = *(LDKCOption_PathFailureZ*)(o_ptr);
27156         o_conv = COption_PathFailureZ_clone((LDKCOption_PathFailureZ*)untag_ptr(o));
27157         LDKCResult_COption_PathFailureZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_COption_PathFailureZDecodeErrorZ), "LDKCResult_COption_PathFailureZDecodeErrorZ");
27158         *ret_conv = CResult_COption_PathFailureZDecodeErrorZ_ok(o_conv);
27159         return tag_ptr(ret_conv, true);
27160 }
27161
27162 uint64_t  __attribute__((export_name("TS_CResult_COption_PathFailureZDecodeErrorZ_err"))) TS_CResult_COption_PathFailureZDecodeErrorZ_err(uint64_t e) {
27163         void* e_ptr = untag_ptr(e);
27164         CHECK_ACCESS(e_ptr);
27165         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
27166         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
27167         LDKCResult_COption_PathFailureZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_COption_PathFailureZDecodeErrorZ), "LDKCResult_COption_PathFailureZDecodeErrorZ");
27168         *ret_conv = CResult_COption_PathFailureZDecodeErrorZ_err(e_conv);
27169         return tag_ptr(ret_conv, true);
27170 }
27171
27172 jboolean  __attribute__((export_name("TS_CResult_COption_PathFailureZDecodeErrorZ_is_ok"))) TS_CResult_COption_PathFailureZDecodeErrorZ_is_ok(uint64_t o) {
27173         LDKCResult_COption_PathFailureZDecodeErrorZ* o_conv = (LDKCResult_COption_PathFailureZDecodeErrorZ*)untag_ptr(o);
27174         jboolean ret_conv = CResult_COption_PathFailureZDecodeErrorZ_is_ok(o_conv);
27175         return ret_conv;
27176 }
27177
27178 void  __attribute__((export_name("TS_CResult_COption_PathFailureZDecodeErrorZ_free"))) TS_CResult_COption_PathFailureZDecodeErrorZ_free(uint64_t _res) {
27179         if (!ptr_is_owned(_res)) return;
27180         void* _res_ptr = untag_ptr(_res);
27181         CHECK_ACCESS(_res_ptr);
27182         LDKCResult_COption_PathFailureZDecodeErrorZ _res_conv = *(LDKCResult_COption_PathFailureZDecodeErrorZ*)(_res_ptr);
27183         FREE(untag_ptr(_res));
27184         CResult_COption_PathFailureZDecodeErrorZ_free(_res_conv);
27185 }
27186
27187 static inline uint64_t CResult_COption_PathFailureZDecodeErrorZ_clone_ptr(LDKCResult_COption_PathFailureZDecodeErrorZ *NONNULL_PTR arg) {
27188         LDKCResult_COption_PathFailureZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_COption_PathFailureZDecodeErrorZ), "LDKCResult_COption_PathFailureZDecodeErrorZ");
27189         *ret_conv = CResult_COption_PathFailureZDecodeErrorZ_clone(arg);
27190         return tag_ptr(ret_conv, true);
27191 }
27192 int64_t  __attribute__((export_name("TS_CResult_COption_PathFailureZDecodeErrorZ_clone_ptr"))) TS_CResult_COption_PathFailureZDecodeErrorZ_clone_ptr(uint64_t arg) {
27193         LDKCResult_COption_PathFailureZDecodeErrorZ* arg_conv = (LDKCResult_COption_PathFailureZDecodeErrorZ*)untag_ptr(arg);
27194         int64_t ret_conv = CResult_COption_PathFailureZDecodeErrorZ_clone_ptr(arg_conv);
27195         return ret_conv;
27196 }
27197
27198 uint64_t  __attribute__((export_name("TS_CResult_COption_PathFailureZDecodeErrorZ_clone"))) TS_CResult_COption_PathFailureZDecodeErrorZ_clone(uint64_t orig) {
27199         LDKCResult_COption_PathFailureZDecodeErrorZ* orig_conv = (LDKCResult_COption_PathFailureZDecodeErrorZ*)untag_ptr(orig);
27200         LDKCResult_COption_PathFailureZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_COption_PathFailureZDecodeErrorZ), "LDKCResult_COption_PathFailureZDecodeErrorZ");
27201         *ret_conv = CResult_COption_PathFailureZDecodeErrorZ_clone(orig_conv);
27202         return tag_ptr(ret_conv, true);
27203 }
27204
27205 uint64_t  __attribute__((export_name("TS_COption_ClosureReasonZ_some"))) TS_COption_ClosureReasonZ_some(uint64_t o) {
27206         void* o_ptr = untag_ptr(o);
27207         CHECK_ACCESS(o_ptr);
27208         LDKClosureReason o_conv = *(LDKClosureReason*)(o_ptr);
27209         o_conv = ClosureReason_clone((LDKClosureReason*)untag_ptr(o));
27210         LDKCOption_ClosureReasonZ *ret_copy = MALLOC(sizeof(LDKCOption_ClosureReasonZ), "LDKCOption_ClosureReasonZ");
27211         *ret_copy = COption_ClosureReasonZ_some(o_conv);
27212         uint64_t ret_ref = tag_ptr(ret_copy, true);
27213         return ret_ref;
27214 }
27215
27216 uint64_t  __attribute__((export_name("TS_COption_ClosureReasonZ_none"))) TS_COption_ClosureReasonZ_none() {
27217         LDKCOption_ClosureReasonZ *ret_copy = MALLOC(sizeof(LDKCOption_ClosureReasonZ), "LDKCOption_ClosureReasonZ");
27218         *ret_copy = COption_ClosureReasonZ_none();
27219         uint64_t ret_ref = tag_ptr(ret_copy, true);
27220         return ret_ref;
27221 }
27222
27223 void  __attribute__((export_name("TS_COption_ClosureReasonZ_free"))) TS_COption_ClosureReasonZ_free(uint64_t _res) {
27224         if (!ptr_is_owned(_res)) return;
27225         void* _res_ptr = untag_ptr(_res);
27226         CHECK_ACCESS(_res_ptr);
27227         LDKCOption_ClosureReasonZ _res_conv = *(LDKCOption_ClosureReasonZ*)(_res_ptr);
27228         FREE(untag_ptr(_res));
27229         COption_ClosureReasonZ_free(_res_conv);
27230 }
27231
27232 static inline uint64_t COption_ClosureReasonZ_clone_ptr(LDKCOption_ClosureReasonZ *NONNULL_PTR arg) {
27233         LDKCOption_ClosureReasonZ *ret_copy = MALLOC(sizeof(LDKCOption_ClosureReasonZ), "LDKCOption_ClosureReasonZ");
27234         *ret_copy = COption_ClosureReasonZ_clone(arg);
27235         uint64_t ret_ref = tag_ptr(ret_copy, true);
27236         return ret_ref;
27237 }
27238 int64_t  __attribute__((export_name("TS_COption_ClosureReasonZ_clone_ptr"))) TS_COption_ClosureReasonZ_clone_ptr(uint64_t arg) {
27239         LDKCOption_ClosureReasonZ* arg_conv = (LDKCOption_ClosureReasonZ*)untag_ptr(arg);
27240         int64_t ret_conv = COption_ClosureReasonZ_clone_ptr(arg_conv);
27241         return ret_conv;
27242 }
27243
27244 uint64_t  __attribute__((export_name("TS_COption_ClosureReasonZ_clone"))) TS_COption_ClosureReasonZ_clone(uint64_t orig) {
27245         LDKCOption_ClosureReasonZ* orig_conv = (LDKCOption_ClosureReasonZ*)untag_ptr(orig);
27246         LDKCOption_ClosureReasonZ *ret_copy = MALLOC(sizeof(LDKCOption_ClosureReasonZ), "LDKCOption_ClosureReasonZ");
27247         *ret_copy = COption_ClosureReasonZ_clone(orig_conv);
27248         uint64_t ret_ref = tag_ptr(ret_copy, true);
27249         return ret_ref;
27250 }
27251
27252 uint64_t  __attribute__((export_name("TS_CResult_COption_ClosureReasonZDecodeErrorZ_ok"))) TS_CResult_COption_ClosureReasonZDecodeErrorZ_ok(uint64_t o) {
27253         void* o_ptr = untag_ptr(o);
27254         CHECK_ACCESS(o_ptr);
27255         LDKCOption_ClosureReasonZ o_conv = *(LDKCOption_ClosureReasonZ*)(o_ptr);
27256         o_conv = COption_ClosureReasonZ_clone((LDKCOption_ClosureReasonZ*)untag_ptr(o));
27257         LDKCResult_COption_ClosureReasonZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_COption_ClosureReasonZDecodeErrorZ), "LDKCResult_COption_ClosureReasonZDecodeErrorZ");
27258         *ret_conv = CResult_COption_ClosureReasonZDecodeErrorZ_ok(o_conv);
27259         return tag_ptr(ret_conv, true);
27260 }
27261
27262 uint64_t  __attribute__((export_name("TS_CResult_COption_ClosureReasonZDecodeErrorZ_err"))) TS_CResult_COption_ClosureReasonZDecodeErrorZ_err(uint64_t e) {
27263         void* e_ptr = untag_ptr(e);
27264         CHECK_ACCESS(e_ptr);
27265         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
27266         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
27267         LDKCResult_COption_ClosureReasonZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_COption_ClosureReasonZDecodeErrorZ), "LDKCResult_COption_ClosureReasonZDecodeErrorZ");
27268         *ret_conv = CResult_COption_ClosureReasonZDecodeErrorZ_err(e_conv);
27269         return tag_ptr(ret_conv, true);
27270 }
27271
27272 jboolean  __attribute__((export_name("TS_CResult_COption_ClosureReasonZDecodeErrorZ_is_ok"))) TS_CResult_COption_ClosureReasonZDecodeErrorZ_is_ok(uint64_t o) {
27273         LDKCResult_COption_ClosureReasonZDecodeErrorZ* o_conv = (LDKCResult_COption_ClosureReasonZDecodeErrorZ*)untag_ptr(o);
27274         jboolean ret_conv = CResult_COption_ClosureReasonZDecodeErrorZ_is_ok(o_conv);
27275         return ret_conv;
27276 }
27277
27278 void  __attribute__((export_name("TS_CResult_COption_ClosureReasonZDecodeErrorZ_free"))) TS_CResult_COption_ClosureReasonZDecodeErrorZ_free(uint64_t _res) {
27279         if (!ptr_is_owned(_res)) return;
27280         void* _res_ptr = untag_ptr(_res);
27281         CHECK_ACCESS(_res_ptr);
27282         LDKCResult_COption_ClosureReasonZDecodeErrorZ _res_conv = *(LDKCResult_COption_ClosureReasonZDecodeErrorZ*)(_res_ptr);
27283         FREE(untag_ptr(_res));
27284         CResult_COption_ClosureReasonZDecodeErrorZ_free(_res_conv);
27285 }
27286
27287 static inline uint64_t CResult_COption_ClosureReasonZDecodeErrorZ_clone_ptr(LDKCResult_COption_ClosureReasonZDecodeErrorZ *NONNULL_PTR arg) {
27288         LDKCResult_COption_ClosureReasonZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_COption_ClosureReasonZDecodeErrorZ), "LDKCResult_COption_ClosureReasonZDecodeErrorZ");
27289         *ret_conv = CResult_COption_ClosureReasonZDecodeErrorZ_clone(arg);
27290         return tag_ptr(ret_conv, true);
27291 }
27292 int64_t  __attribute__((export_name("TS_CResult_COption_ClosureReasonZDecodeErrorZ_clone_ptr"))) TS_CResult_COption_ClosureReasonZDecodeErrorZ_clone_ptr(uint64_t arg) {
27293         LDKCResult_COption_ClosureReasonZDecodeErrorZ* arg_conv = (LDKCResult_COption_ClosureReasonZDecodeErrorZ*)untag_ptr(arg);
27294         int64_t ret_conv = CResult_COption_ClosureReasonZDecodeErrorZ_clone_ptr(arg_conv);
27295         return ret_conv;
27296 }
27297
27298 uint64_t  __attribute__((export_name("TS_CResult_COption_ClosureReasonZDecodeErrorZ_clone"))) TS_CResult_COption_ClosureReasonZDecodeErrorZ_clone(uint64_t orig) {
27299         LDKCResult_COption_ClosureReasonZDecodeErrorZ* orig_conv = (LDKCResult_COption_ClosureReasonZDecodeErrorZ*)untag_ptr(orig);
27300         LDKCResult_COption_ClosureReasonZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_COption_ClosureReasonZDecodeErrorZ), "LDKCResult_COption_ClosureReasonZDecodeErrorZ");
27301         *ret_conv = CResult_COption_ClosureReasonZDecodeErrorZ_clone(orig_conv);
27302         return tag_ptr(ret_conv, true);
27303 }
27304
27305 uint64_t  __attribute__((export_name("TS_COption_HTLCDestinationZ_some"))) TS_COption_HTLCDestinationZ_some(uint64_t o) {
27306         void* o_ptr = untag_ptr(o);
27307         CHECK_ACCESS(o_ptr);
27308         LDKHTLCDestination o_conv = *(LDKHTLCDestination*)(o_ptr);
27309         o_conv = HTLCDestination_clone((LDKHTLCDestination*)untag_ptr(o));
27310         LDKCOption_HTLCDestinationZ *ret_copy = MALLOC(sizeof(LDKCOption_HTLCDestinationZ), "LDKCOption_HTLCDestinationZ");
27311         *ret_copy = COption_HTLCDestinationZ_some(o_conv);
27312         uint64_t ret_ref = tag_ptr(ret_copy, true);
27313         return ret_ref;
27314 }
27315
27316 uint64_t  __attribute__((export_name("TS_COption_HTLCDestinationZ_none"))) TS_COption_HTLCDestinationZ_none() {
27317         LDKCOption_HTLCDestinationZ *ret_copy = MALLOC(sizeof(LDKCOption_HTLCDestinationZ), "LDKCOption_HTLCDestinationZ");
27318         *ret_copy = COption_HTLCDestinationZ_none();
27319         uint64_t ret_ref = tag_ptr(ret_copy, true);
27320         return ret_ref;
27321 }
27322
27323 void  __attribute__((export_name("TS_COption_HTLCDestinationZ_free"))) TS_COption_HTLCDestinationZ_free(uint64_t _res) {
27324         if (!ptr_is_owned(_res)) return;
27325         void* _res_ptr = untag_ptr(_res);
27326         CHECK_ACCESS(_res_ptr);
27327         LDKCOption_HTLCDestinationZ _res_conv = *(LDKCOption_HTLCDestinationZ*)(_res_ptr);
27328         FREE(untag_ptr(_res));
27329         COption_HTLCDestinationZ_free(_res_conv);
27330 }
27331
27332 static inline uint64_t COption_HTLCDestinationZ_clone_ptr(LDKCOption_HTLCDestinationZ *NONNULL_PTR arg) {
27333         LDKCOption_HTLCDestinationZ *ret_copy = MALLOC(sizeof(LDKCOption_HTLCDestinationZ), "LDKCOption_HTLCDestinationZ");
27334         *ret_copy = COption_HTLCDestinationZ_clone(arg);
27335         uint64_t ret_ref = tag_ptr(ret_copy, true);
27336         return ret_ref;
27337 }
27338 int64_t  __attribute__((export_name("TS_COption_HTLCDestinationZ_clone_ptr"))) TS_COption_HTLCDestinationZ_clone_ptr(uint64_t arg) {
27339         LDKCOption_HTLCDestinationZ* arg_conv = (LDKCOption_HTLCDestinationZ*)untag_ptr(arg);
27340         int64_t ret_conv = COption_HTLCDestinationZ_clone_ptr(arg_conv);
27341         return ret_conv;
27342 }
27343
27344 uint64_t  __attribute__((export_name("TS_COption_HTLCDestinationZ_clone"))) TS_COption_HTLCDestinationZ_clone(uint64_t orig) {
27345         LDKCOption_HTLCDestinationZ* orig_conv = (LDKCOption_HTLCDestinationZ*)untag_ptr(orig);
27346         LDKCOption_HTLCDestinationZ *ret_copy = MALLOC(sizeof(LDKCOption_HTLCDestinationZ), "LDKCOption_HTLCDestinationZ");
27347         *ret_copy = COption_HTLCDestinationZ_clone(orig_conv);
27348         uint64_t ret_ref = tag_ptr(ret_copy, true);
27349         return ret_ref;
27350 }
27351
27352 uint64_t  __attribute__((export_name("TS_CResult_COption_HTLCDestinationZDecodeErrorZ_ok"))) TS_CResult_COption_HTLCDestinationZDecodeErrorZ_ok(uint64_t o) {
27353         void* o_ptr = untag_ptr(o);
27354         CHECK_ACCESS(o_ptr);
27355         LDKCOption_HTLCDestinationZ o_conv = *(LDKCOption_HTLCDestinationZ*)(o_ptr);
27356         o_conv = COption_HTLCDestinationZ_clone((LDKCOption_HTLCDestinationZ*)untag_ptr(o));
27357         LDKCResult_COption_HTLCDestinationZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_COption_HTLCDestinationZDecodeErrorZ), "LDKCResult_COption_HTLCDestinationZDecodeErrorZ");
27358         *ret_conv = CResult_COption_HTLCDestinationZDecodeErrorZ_ok(o_conv);
27359         return tag_ptr(ret_conv, true);
27360 }
27361
27362 uint64_t  __attribute__((export_name("TS_CResult_COption_HTLCDestinationZDecodeErrorZ_err"))) TS_CResult_COption_HTLCDestinationZDecodeErrorZ_err(uint64_t e) {
27363         void* e_ptr = untag_ptr(e);
27364         CHECK_ACCESS(e_ptr);
27365         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
27366         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
27367         LDKCResult_COption_HTLCDestinationZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_COption_HTLCDestinationZDecodeErrorZ), "LDKCResult_COption_HTLCDestinationZDecodeErrorZ");
27368         *ret_conv = CResult_COption_HTLCDestinationZDecodeErrorZ_err(e_conv);
27369         return tag_ptr(ret_conv, true);
27370 }
27371
27372 jboolean  __attribute__((export_name("TS_CResult_COption_HTLCDestinationZDecodeErrorZ_is_ok"))) TS_CResult_COption_HTLCDestinationZDecodeErrorZ_is_ok(uint64_t o) {
27373         LDKCResult_COption_HTLCDestinationZDecodeErrorZ* o_conv = (LDKCResult_COption_HTLCDestinationZDecodeErrorZ*)untag_ptr(o);
27374         jboolean ret_conv = CResult_COption_HTLCDestinationZDecodeErrorZ_is_ok(o_conv);
27375         return ret_conv;
27376 }
27377
27378 void  __attribute__((export_name("TS_CResult_COption_HTLCDestinationZDecodeErrorZ_free"))) TS_CResult_COption_HTLCDestinationZDecodeErrorZ_free(uint64_t _res) {
27379         if (!ptr_is_owned(_res)) return;
27380         void* _res_ptr = untag_ptr(_res);
27381         CHECK_ACCESS(_res_ptr);
27382         LDKCResult_COption_HTLCDestinationZDecodeErrorZ _res_conv = *(LDKCResult_COption_HTLCDestinationZDecodeErrorZ*)(_res_ptr);
27383         FREE(untag_ptr(_res));
27384         CResult_COption_HTLCDestinationZDecodeErrorZ_free(_res_conv);
27385 }
27386
27387 static inline uint64_t CResult_COption_HTLCDestinationZDecodeErrorZ_clone_ptr(LDKCResult_COption_HTLCDestinationZDecodeErrorZ *NONNULL_PTR arg) {
27388         LDKCResult_COption_HTLCDestinationZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_COption_HTLCDestinationZDecodeErrorZ), "LDKCResult_COption_HTLCDestinationZDecodeErrorZ");
27389         *ret_conv = CResult_COption_HTLCDestinationZDecodeErrorZ_clone(arg);
27390         return tag_ptr(ret_conv, true);
27391 }
27392 int64_t  __attribute__((export_name("TS_CResult_COption_HTLCDestinationZDecodeErrorZ_clone_ptr"))) TS_CResult_COption_HTLCDestinationZDecodeErrorZ_clone_ptr(uint64_t arg) {
27393         LDKCResult_COption_HTLCDestinationZDecodeErrorZ* arg_conv = (LDKCResult_COption_HTLCDestinationZDecodeErrorZ*)untag_ptr(arg);
27394         int64_t ret_conv = CResult_COption_HTLCDestinationZDecodeErrorZ_clone_ptr(arg_conv);
27395         return ret_conv;
27396 }
27397
27398 uint64_t  __attribute__((export_name("TS_CResult_COption_HTLCDestinationZDecodeErrorZ_clone"))) TS_CResult_COption_HTLCDestinationZDecodeErrorZ_clone(uint64_t orig) {
27399         LDKCResult_COption_HTLCDestinationZDecodeErrorZ* orig_conv = (LDKCResult_COption_HTLCDestinationZDecodeErrorZ*)untag_ptr(orig);
27400         LDKCResult_COption_HTLCDestinationZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_COption_HTLCDestinationZDecodeErrorZ), "LDKCResult_COption_HTLCDestinationZDecodeErrorZ");
27401         *ret_conv = CResult_COption_HTLCDestinationZDecodeErrorZ_clone(orig_conv);
27402         return tag_ptr(ret_conv, true);
27403 }
27404
27405 uint64_t  __attribute__((export_name("TS_CResult_PaymentFailureReasonDecodeErrorZ_ok"))) TS_CResult_PaymentFailureReasonDecodeErrorZ_ok(uint32_t o) {
27406         LDKPaymentFailureReason o_conv = LDKPaymentFailureReason_from_js(o);
27407         LDKCResult_PaymentFailureReasonDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PaymentFailureReasonDecodeErrorZ), "LDKCResult_PaymentFailureReasonDecodeErrorZ");
27408         *ret_conv = CResult_PaymentFailureReasonDecodeErrorZ_ok(o_conv);
27409         return tag_ptr(ret_conv, true);
27410 }
27411
27412 uint64_t  __attribute__((export_name("TS_CResult_PaymentFailureReasonDecodeErrorZ_err"))) TS_CResult_PaymentFailureReasonDecodeErrorZ_err(uint64_t e) {
27413         void* e_ptr = untag_ptr(e);
27414         CHECK_ACCESS(e_ptr);
27415         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
27416         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
27417         LDKCResult_PaymentFailureReasonDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PaymentFailureReasonDecodeErrorZ), "LDKCResult_PaymentFailureReasonDecodeErrorZ");
27418         *ret_conv = CResult_PaymentFailureReasonDecodeErrorZ_err(e_conv);
27419         return tag_ptr(ret_conv, true);
27420 }
27421
27422 jboolean  __attribute__((export_name("TS_CResult_PaymentFailureReasonDecodeErrorZ_is_ok"))) TS_CResult_PaymentFailureReasonDecodeErrorZ_is_ok(uint64_t o) {
27423         LDKCResult_PaymentFailureReasonDecodeErrorZ* o_conv = (LDKCResult_PaymentFailureReasonDecodeErrorZ*)untag_ptr(o);
27424         jboolean ret_conv = CResult_PaymentFailureReasonDecodeErrorZ_is_ok(o_conv);
27425         return ret_conv;
27426 }
27427
27428 void  __attribute__((export_name("TS_CResult_PaymentFailureReasonDecodeErrorZ_free"))) TS_CResult_PaymentFailureReasonDecodeErrorZ_free(uint64_t _res) {
27429         if (!ptr_is_owned(_res)) return;
27430         void* _res_ptr = untag_ptr(_res);
27431         CHECK_ACCESS(_res_ptr);
27432         LDKCResult_PaymentFailureReasonDecodeErrorZ _res_conv = *(LDKCResult_PaymentFailureReasonDecodeErrorZ*)(_res_ptr);
27433         FREE(untag_ptr(_res));
27434         CResult_PaymentFailureReasonDecodeErrorZ_free(_res_conv);
27435 }
27436
27437 static inline uint64_t CResult_PaymentFailureReasonDecodeErrorZ_clone_ptr(LDKCResult_PaymentFailureReasonDecodeErrorZ *NONNULL_PTR arg) {
27438         LDKCResult_PaymentFailureReasonDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PaymentFailureReasonDecodeErrorZ), "LDKCResult_PaymentFailureReasonDecodeErrorZ");
27439         *ret_conv = CResult_PaymentFailureReasonDecodeErrorZ_clone(arg);
27440         return tag_ptr(ret_conv, true);
27441 }
27442 int64_t  __attribute__((export_name("TS_CResult_PaymentFailureReasonDecodeErrorZ_clone_ptr"))) TS_CResult_PaymentFailureReasonDecodeErrorZ_clone_ptr(uint64_t arg) {
27443         LDKCResult_PaymentFailureReasonDecodeErrorZ* arg_conv = (LDKCResult_PaymentFailureReasonDecodeErrorZ*)untag_ptr(arg);
27444         int64_t ret_conv = CResult_PaymentFailureReasonDecodeErrorZ_clone_ptr(arg_conv);
27445         return ret_conv;
27446 }
27447
27448 uint64_t  __attribute__((export_name("TS_CResult_PaymentFailureReasonDecodeErrorZ_clone"))) TS_CResult_PaymentFailureReasonDecodeErrorZ_clone(uint64_t orig) {
27449         LDKCResult_PaymentFailureReasonDecodeErrorZ* orig_conv = (LDKCResult_PaymentFailureReasonDecodeErrorZ*)untag_ptr(orig);
27450         LDKCResult_PaymentFailureReasonDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PaymentFailureReasonDecodeErrorZ), "LDKCResult_PaymentFailureReasonDecodeErrorZ");
27451         *ret_conv = CResult_PaymentFailureReasonDecodeErrorZ_clone(orig_conv);
27452         return tag_ptr(ret_conv, true);
27453 }
27454
27455 uint64_t  __attribute__((export_name("TS_COption_U128Z_some"))) TS_COption_U128Z_some(int8_tArray o) {
27456         LDKU128 o_ref;
27457         CHECK(o->arr_len == 16);
27458         memcpy(o_ref.le_bytes, o->elems, 16); FREE(o);
27459         LDKCOption_U128Z *ret_copy = MALLOC(sizeof(LDKCOption_U128Z), "LDKCOption_U128Z");
27460         *ret_copy = COption_U128Z_some(o_ref);
27461         uint64_t ret_ref = tag_ptr(ret_copy, true);
27462         return ret_ref;
27463 }
27464
27465 uint64_t  __attribute__((export_name("TS_COption_U128Z_none"))) TS_COption_U128Z_none() {
27466         LDKCOption_U128Z *ret_copy = MALLOC(sizeof(LDKCOption_U128Z), "LDKCOption_U128Z");
27467         *ret_copy = COption_U128Z_none();
27468         uint64_t ret_ref = tag_ptr(ret_copy, true);
27469         return ret_ref;
27470 }
27471
27472 void  __attribute__((export_name("TS_COption_U128Z_free"))) TS_COption_U128Z_free(uint64_t _res) {
27473         if (!ptr_is_owned(_res)) return;
27474         void* _res_ptr = untag_ptr(_res);
27475         CHECK_ACCESS(_res_ptr);
27476         LDKCOption_U128Z _res_conv = *(LDKCOption_U128Z*)(_res_ptr);
27477         FREE(untag_ptr(_res));
27478         COption_U128Z_free(_res_conv);
27479 }
27480
27481 static inline uint64_t COption_U128Z_clone_ptr(LDKCOption_U128Z *NONNULL_PTR arg) {
27482         LDKCOption_U128Z *ret_copy = MALLOC(sizeof(LDKCOption_U128Z), "LDKCOption_U128Z");
27483         *ret_copy = COption_U128Z_clone(arg);
27484         uint64_t ret_ref = tag_ptr(ret_copy, true);
27485         return ret_ref;
27486 }
27487 int64_t  __attribute__((export_name("TS_COption_U128Z_clone_ptr"))) TS_COption_U128Z_clone_ptr(uint64_t arg) {
27488         LDKCOption_U128Z* arg_conv = (LDKCOption_U128Z*)untag_ptr(arg);
27489         int64_t ret_conv = COption_U128Z_clone_ptr(arg_conv);
27490         return ret_conv;
27491 }
27492
27493 uint64_t  __attribute__((export_name("TS_COption_U128Z_clone"))) TS_COption_U128Z_clone(uint64_t orig) {
27494         LDKCOption_U128Z* orig_conv = (LDKCOption_U128Z*)untag_ptr(orig);
27495         LDKCOption_U128Z *ret_copy = MALLOC(sizeof(LDKCOption_U128Z), "LDKCOption_U128Z");
27496         *ret_copy = COption_U128Z_clone(orig_conv);
27497         uint64_t ret_ref = tag_ptr(ret_copy, true);
27498         return ret_ref;
27499 }
27500
27501 void  __attribute__((export_name("TS_CVec_ClaimedHTLCZ_free"))) TS_CVec_ClaimedHTLCZ_free(uint64_tArray _res) {
27502         LDKCVec_ClaimedHTLCZ _res_constr;
27503         _res_constr.datalen = _res->arr_len;
27504         if (_res_constr.datalen > 0)
27505                 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKClaimedHTLC), "LDKCVec_ClaimedHTLCZ Elements");
27506         else
27507                 _res_constr.data = NULL;
27508         uint64_t* _res_vals = _res->elems;
27509         for (size_t n = 0; n < _res_constr.datalen; n++) {
27510                 uint64_t _res_conv_13 = _res_vals[n];
27511                 LDKClaimedHTLC _res_conv_13_conv;
27512                 _res_conv_13_conv.inner = untag_ptr(_res_conv_13);
27513                 _res_conv_13_conv.is_owned = ptr_is_owned(_res_conv_13);
27514                 CHECK_INNER_FIELD_ACCESS_OR_NULL(_res_conv_13_conv);
27515                 _res_constr.data[n] = _res_conv_13_conv;
27516         }
27517         FREE(_res);
27518         CVec_ClaimedHTLCZ_free(_res_constr);
27519 }
27520
27521 uint64_t  __attribute__((export_name("TS_COption_PaymentFailureReasonZ_some"))) TS_COption_PaymentFailureReasonZ_some(uint32_t o) {
27522         LDKPaymentFailureReason o_conv = LDKPaymentFailureReason_from_js(o);
27523         LDKCOption_PaymentFailureReasonZ *ret_copy = MALLOC(sizeof(LDKCOption_PaymentFailureReasonZ), "LDKCOption_PaymentFailureReasonZ");
27524         *ret_copy = COption_PaymentFailureReasonZ_some(o_conv);
27525         uint64_t ret_ref = tag_ptr(ret_copy, true);
27526         return ret_ref;
27527 }
27528
27529 uint64_t  __attribute__((export_name("TS_COption_PaymentFailureReasonZ_none"))) TS_COption_PaymentFailureReasonZ_none() {
27530         LDKCOption_PaymentFailureReasonZ *ret_copy = MALLOC(sizeof(LDKCOption_PaymentFailureReasonZ), "LDKCOption_PaymentFailureReasonZ");
27531         *ret_copy = COption_PaymentFailureReasonZ_none();
27532         uint64_t ret_ref = tag_ptr(ret_copy, true);
27533         return ret_ref;
27534 }
27535
27536 void  __attribute__((export_name("TS_COption_PaymentFailureReasonZ_free"))) TS_COption_PaymentFailureReasonZ_free(uint64_t _res) {
27537         if (!ptr_is_owned(_res)) return;
27538         void* _res_ptr = untag_ptr(_res);
27539         CHECK_ACCESS(_res_ptr);
27540         LDKCOption_PaymentFailureReasonZ _res_conv = *(LDKCOption_PaymentFailureReasonZ*)(_res_ptr);
27541         FREE(untag_ptr(_res));
27542         COption_PaymentFailureReasonZ_free(_res_conv);
27543 }
27544
27545 static inline uint64_t COption_PaymentFailureReasonZ_clone_ptr(LDKCOption_PaymentFailureReasonZ *NONNULL_PTR arg) {
27546         LDKCOption_PaymentFailureReasonZ *ret_copy = MALLOC(sizeof(LDKCOption_PaymentFailureReasonZ), "LDKCOption_PaymentFailureReasonZ");
27547         *ret_copy = COption_PaymentFailureReasonZ_clone(arg);
27548         uint64_t ret_ref = tag_ptr(ret_copy, true);
27549         return ret_ref;
27550 }
27551 int64_t  __attribute__((export_name("TS_COption_PaymentFailureReasonZ_clone_ptr"))) TS_COption_PaymentFailureReasonZ_clone_ptr(uint64_t arg) {
27552         LDKCOption_PaymentFailureReasonZ* arg_conv = (LDKCOption_PaymentFailureReasonZ*)untag_ptr(arg);
27553         int64_t ret_conv = COption_PaymentFailureReasonZ_clone_ptr(arg_conv);
27554         return ret_conv;
27555 }
27556
27557 uint64_t  __attribute__((export_name("TS_COption_PaymentFailureReasonZ_clone"))) TS_COption_PaymentFailureReasonZ_clone(uint64_t orig) {
27558         LDKCOption_PaymentFailureReasonZ* orig_conv = (LDKCOption_PaymentFailureReasonZ*)untag_ptr(orig);
27559         LDKCOption_PaymentFailureReasonZ *ret_copy = MALLOC(sizeof(LDKCOption_PaymentFailureReasonZ), "LDKCOption_PaymentFailureReasonZ");
27560         *ret_copy = COption_PaymentFailureReasonZ_clone(orig_conv);
27561         uint64_t ret_ref = tag_ptr(ret_copy, true);
27562         return ret_ref;
27563 }
27564
27565 uint64_t  __attribute__((export_name("TS_COption_EventZ_some"))) TS_COption_EventZ_some(uint64_t o) {
27566         void* o_ptr = untag_ptr(o);
27567         CHECK_ACCESS(o_ptr);
27568         LDKEvent o_conv = *(LDKEvent*)(o_ptr);
27569         o_conv = Event_clone((LDKEvent*)untag_ptr(o));
27570         LDKCOption_EventZ *ret_copy = MALLOC(sizeof(LDKCOption_EventZ), "LDKCOption_EventZ");
27571         *ret_copy = COption_EventZ_some(o_conv);
27572         uint64_t ret_ref = tag_ptr(ret_copy, true);
27573         return ret_ref;
27574 }
27575
27576 uint64_t  __attribute__((export_name("TS_COption_EventZ_none"))) TS_COption_EventZ_none() {
27577         LDKCOption_EventZ *ret_copy = MALLOC(sizeof(LDKCOption_EventZ), "LDKCOption_EventZ");
27578         *ret_copy = COption_EventZ_none();
27579         uint64_t ret_ref = tag_ptr(ret_copy, true);
27580         return ret_ref;
27581 }
27582
27583 void  __attribute__((export_name("TS_COption_EventZ_free"))) TS_COption_EventZ_free(uint64_t _res) {
27584         if (!ptr_is_owned(_res)) return;
27585         void* _res_ptr = untag_ptr(_res);
27586         CHECK_ACCESS(_res_ptr);
27587         LDKCOption_EventZ _res_conv = *(LDKCOption_EventZ*)(_res_ptr);
27588         FREE(untag_ptr(_res));
27589         COption_EventZ_free(_res_conv);
27590 }
27591
27592 static inline uint64_t COption_EventZ_clone_ptr(LDKCOption_EventZ *NONNULL_PTR arg) {
27593         LDKCOption_EventZ *ret_copy = MALLOC(sizeof(LDKCOption_EventZ), "LDKCOption_EventZ");
27594         *ret_copy = COption_EventZ_clone(arg);
27595         uint64_t ret_ref = tag_ptr(ret_copy, true);
27596         return ret_ref;
27597 }
27598 int64_t  __attribute__((export_name("TS_COption_EventZ_clone_ptr"))) TS_COption_EventZ_clone_ptr(uint64_t arg) {
27599         LDKCOption_EventZ* arg_conv = (LDKCOption_EventZ*)untag_ptr(arg);
27600         int64_t ret_conv = COption_EventZ_clone_ptr(arg_conv);
27601         return ret_conv;
27602 }
27603
27604 uint64_t  __attribute__((export_name("TS_COption_EventZ_clone"))) TS_COption_EventZ_clone(uint64_t orig) {
27605         LDKCOption_EventZ* orig_conv = (LDKCOption_EventZ*)untag_ptr(orig);
27606         LDKCOption_EventZ *ret_copy = MALLOC(sizeof(LDKCOption_EventZ), "LDKCOption_EventZ");
27607         *ret_copy = COption_EventZ_clone(orig_conv);
27608         uint64_t ret_ref = tag_ptr(ret_copy, true);
27609         return ret_ref;
27610 }
27611
27612 uint64_t  __attribute__((export_name("TS_CResult_COption_EventZDecodeErrorZ_ok"))) TS_CResult_COption_EventZDecodeErrorZ_ok(uint64_t o) {
27613         void* o_ptr = untag_ptr(o);
27614         CHECK_ACCESS(o_ptr);
27615         LDKCOption_EventZ o_conv = *(LDKCOption_EventZ*)(o_ptr);
27616         o_conv = COption_EventZ_clone((LDKCOption_EventZ*)untag_ptr(o));
27617         LDKCResult_COption_EventZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_COption_EventZDecodeErrorZ), "LDKCResult_COption_EventZDecodeErrorZ");
27618         *ret_conv = CResult_COption_EventZDecodeErrorZ_ok(o_conv);
27619         return tag_ptr(ret_conv, true);
27620 }
27621
27622 uint64_t  __attribute__((export_name("TS_CResult_COption_EventZDecodeErrorZ_err"))) TS_CResult_COption_EventZDecodeErrorZ_err(uint64_t e) {
27623         void* e_ptr = untag_ptr(e);
27624         CHECK_ACCESS(e_ptr);
27625         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
27626         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
27627         LDKCResult_COption_EventZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_COption_EventZDecodeErrorZ), "LDKCResult_COption_EventZDecodeErrorZ");
27628         *ret_conv = CResult_COption_EventZDecodeErrorZ_err(e_conv);
27629         return tag_ptr(ret_conv, true);
27630 }
27631
27632 jboolean  __attribute__((export_name("TS_CResult_COption_EventZDecodeErrorZ_is_ok"))) TS_CResult_COption_EventZDecodeErrorZ_is_ok(uint64_t o) {
27633         LDKCResult_COption_EventZDecodeErrorZ* o_conv = (LDKCResult_COption_EventZDecodeErrorZ*)untag_ptr(o);
27634         jboolean ret_conv = CResult_COption_EventZDecodeErrorZ_is_ok(o_conv);
27635         return ret_conv;
27636 }
27637
27638 void  __attribute__((export_name("TS_CResult_COption_EventZDecodeErrorZ_free"))) TS_CResult_COption_EventZDecodeErrorZ_free(uint64_t _res) {
27639         if (!ptr_is_owned(_res)) return;
27640         void* _res_ptr = untag_ptr(_res);
27641         CHECK_ACCESS(_res_ptr);
27642         LDKCResult_COption_EventZDecodeErrorZ _res_conv = *(LDKCResult_COption_EventZDecodeErrorZ*)(_res_ptr);
27643         FREE(untag_ptr(_res));
27644         CResult_COption_EventZDecodeErrorZ_free(_res_conv);
27645 }
27646
27647 static inline uint64_t CResult_COption_EventZDecodeErrorZ_clone_ptr(LDKCResult_COption_EventZDecodeErrorZ *NONNULL_PTR arg) {
27648         LDKCResult_COption_EventZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_COption_EventZDecodeErrorZ), "LDKCResult_COption_EventZDecodeErrorZ");
27649         *ret_conv = CResult_COption_EventZDecodeErrorZ_clone(arg);
27650         return tag_ptr(ret_conv, true);
27651 }
27652 int64_t  __attribute__((export_name("TS_CResult_COption_EventZDecodeErrorZ_clone_ptr"))) TS_CResult_COption_EventZDecodeErrorZ_clone_ptr(uint64_t arg) {
27653         LDKCResult_COption_EventZDecodeErrorZ* arg_conv = (LDKCResult_COption_EventZDecodeErrorZ*)untag_ptr(arg);
27654         int64_t ret_conv = CResult_COption_EventZDecodeErrorZ_clone_ptr(arg_conv);
27655         return ret_conv;
27656 }
27657
27658 uint64_t  __attribute__((export_name("TS_CResult_COption_EventZDecodeErrorZ_clone"))) TS_CResult_COption_EventZDecodeErrorZ_clone(uint64_t orig) {
27659         LDKCResult_COption_EventZDecodeErrorZ* orig_conv = (LDKCResult_COption_EventZDecodeErrorZ*)untag_ptr(orig);
27660         LDKCResult_COption_EventZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_COption_EventZDecodeErrorZ), "LDKCResult_COption_EventZDecodeErrorZ");
27661         *ret_conv = CResult_COption_EventZDecodeErrorZ_clone(orig_conv);
27662         return tag_ptr(ret_conv, true);
27663 }
27664
27665 uint64_t  __attribute__((export_name("TS_CResult_SiPrefixBolt11ParseErrorZ_ok"))) TS_CResult_SiPrefixBolt11ParseErrorZ_ok(uint32_t o) {
27666         LDKSiPrefix o_conv = LDKSiPrefix_from_js(o);
27667         LDKCResult_SiPrefixBolt11ParseErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_SiPrefixBolt11ParseErrorZ), "LDKCResult_SiPrefixBolt11ParseErrorZ");
27668         *ret_conv = CResult_SiPrefixBolt11ParseErrorZ_ok(o_conv);
27669         return tag_ptr(ret_conv, true);
27670 }
27671
27672 uint64_t  __attribute__((export_name("TS_CResult_SiPrefixBolt11ParseErrorZ_err"))) TS_CResult_SiPrefixBolt11ParseErrorZ_err(uint64_t e) {
27673         void* e_ptr = untag_ptr(e);
27674         CHECK_ACCESS(e_ptr);
27675         LDKBolt11ParseError e_conv = *(LDKBolt11ParseError*)(e_ptr);
27676         e_conv = Bolt11ParseError_clone((LDKBolt11ParseError*)untag_ptr(e));
27677         LDKCResult_SiPrefixBolt11ParseErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_SiPrefixBolt11ParseErrorZ), "LDKCResult_SiPrefixBolt11ParseErrorZ");
27678         *ret_conv = CResult_SiPrefixBolt11ParseErrorZ_err(e_conv);
27679         return tag_ptr(ret_conv, true);
27680 }
27681
27682 jboolean  __attribute__((export_name("TS_CResult_SiPrefixBolt11ParseErrorZ_is_ok"))) TS_CResult_SiPrefixBolt11ParseErrorZ_is_ok(uint64_t o) {
27683         LDKCResult_SiPrefixBolt11ParseErrorZ* o_conv = (LDKCResult_SiPrefixBolt11ParseErrorZ*)untag_ptr(o);
27684         jboolean ret_conv = CResult_SiPrefixBolt11ParseErrorZ_is_ok(o_conv);
27685         return ret_conv;
27686 }
27687
27688 void  __attribute__((export_name("TS_CResult_SiPrefixBolt11ParseErrorZ_free"))) TS_CResult_SiPrefixBolt11ParseErrorZ_free(uint64_t _res) {
27689         if (!ptr_is_owned(_res)) return;
27690         void* _res_ptr = untag_ptr(_res);
27691         CHECK_ACCESS(_res_ptr);
27692         LDKCResult_SiPrefixBolt11ParseErrorZ _res_conv = *(LDKCResult_SiPrefixBolt11ParseErrorZ*)(_res_ptr);
27693         FREE(untag_ptr(_res));
27694         CResult_SiPrefixBolt11ParseErrorZ_free(_res_conv);
27695 }
27696
27697 static inline uint64_t CResult_SiPrefixBolt11ParseErrorZ_clone_ptr(LDKCResult_SiPrefixBolt11ParseErrorZ *NONNULL_PTR arg) {
27698         LDKCResult_SiPrefixBolt11ParseErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_SiPrefixBolt11ParseErrorZ), "LDKCResult_SiPrefixBolt11ParseErrorZ");
27699         *ret_conv = CResult_SiPrefixBolt11ParseErrorZ_clone(arg);
27700         return tag_ptr(ret_conv, true);
27701 }
27702 int64_t  __attribute__((export_name("TS_CResult_SiPrefixBolt11ParseErrorZ_clone_ptr"))) TS_CResult_SiPrefixBolt11ParseErrorZ_clone_ptr(uint64_t arg) {
27703         LDKCResult_SiPrefixBolt11ParseErrorZ* arg_conv = (LDKCResult_SiPrefixBolt11ParseErrorZ*)untag_ptr(arg);
27704         int64_t ret_conv = CResult_SiPrefixBolt11ParseErrorZ_clone_ptr(arg_conv);
27705         return ret_conv;
27706 }
27707
27708 uint64_t  __attribute__((export_name("TS_CResult_SiPrefixBolt11ParseErrorZ_clone"))) TS_CResult_SiPrefixBolt11ParseErrorZ_clone(uint64_t orig) {
27709         LDKCResult_SiPrefixBolt11ParseErrorZ* orig_conv = (LDKCResult_SiPrefixBolt11ParseErrorZ*)untag_ptr(orig);
27710         LDKCResult_SiPrefixBolt11ParseErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_SiPrefixBolt11ParseErrorZ), "LDKCResult_SiPrefixBolt11ParseErrorZ");
27711         *ret_conv = CResult_SiPrefixBolt11ParseErrorZ_clone(orig_conv);
27712         return tag_ptr(ret_conv, true);
27713 }
27714
27715 uint64_t  __attribute__((export_name("TS_CResult_Bolt11InvoiceParseOrSemanticErrorZ_ok"))) TS_CResult_Bolt11InvoiceParseOrSemanticErrorZ_ok(uint64_t o) {
27716         LDKBolt11Invoice o_conv;
27717         o_conv.inner = untag_ptr(o);
27718         o_conv.is_owned = ptr_is_owned(o);
27719         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
27720         o_conv = Bolt11Invoice_clone(&o_conv);
27721         LDKCResult_Bolt11InvoiceParseOrSemanticErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_Bolt11InvoiceParseOrSemanticErrorZ), "LDKCResult_Bolt11InvoiceParseOrSemanticErrorZ");
27722         *ret_conv = CResult_Bolt11InvoiceParseOrSemanticErrorZ_ok(o_conv);
27723         return tag_ptr(ret_conv, true);
27724 }
27725
27726 uint64_t  __attribute__((export_name("TS_CResult_Bolt11InvoiceParseOrSemanticErrorZ_err"))) TS_CResult_Bolt11InvoiceParseOrSemanticErrorZ_err(uint64_t e) {
27727         void* e_ptr = untag_ptr(e);
27728         CHECK_ACCESS(e_ptr);
27729         LDKParseOrSemanticError e_conv = *(LDKParseOrSemanticError*)(e_ptr);
27730         e_conv = ParseOrSemanticError_clone((LDKParseOrSemanticError*)untag_ptr(e));
27731         LDKCResult_Bolt11InvoiceParseOrSemanticErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_Bolt11InvoiceParseOrSemanticErrorZ), "LDKCResult_Bolt11InvoiceParseOrSemanticErrorZ");
27732         *ret_conv = CResult_Bolt11InvoiceParseOrSemanticErrorZ_err(e_conv);
27733         return tag_ptr(ret_conv, true);
27734 }
27735
27736 jboolean  __attribute__((export_name("TS_CResult_Bolt11InvoiceParseOrSemanticErrorZ_is_ok"))) TS_CResult_Bolt11InvoiceParseOrSemanticErrorZ_is_ok(uint64_t o) {
27737         LDKCResult_Bolt11InvoiceParseOrSemanticErrorZ* o_conv = (LDKCResult_Bolt11InvoiceParseOrSemanticErrorZ*)untag_ptr(o);
27738         jboolean ret_conv = CResult_Bolt11InvoiceParseOrSemanticErrorZ_is_ok(o_conv);
27739         return ret_conv;
27740 }
27741
27742 void  __attribute__((export_name("TS_CResult_Bolt11InvoiceParseOrSemanticErrorZ_free"))) TS_CResult_Bolt11InvoiceParseOrSemanticErrorZ_free(uint64_t _res) {
27743         if (!ptr_is_owned(_res)) return;
27744         void* _res_ptr = untag_ptr(_res);
27745         CHECK_ACCESS(_res_ptr);
27746         LDKCResult_Bolt11InvoiceParseOrSemanticErrorZ _res_conv = *(LDKCResult_Bolt11InvoiceParseOrSemanticErrorZ*)(_res_ptr);
27747         FREE(untag_ptr(_res));
27748         CResult_Bolt11InvoiceParseOrSemanticErrorZ_free(_res_conv);
27749 }
27750
27751 static inline uint64_t CResult_Bolt11InvoiceParseOrSemanticErrorZ_clone_ptr(LDKCResult_Bolt11InvoiceParseOrSemanticErrorZ *NONNULL_PTR arg) {
27752         LDKCResult_Bolt11InvoiceParseOrSemanticErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_Bolt11InvoiceParseOrSemanticErrorZ), "LDKCResult_Bolt11InvoiceParseOrSemanticErrorZ");
27753         *ret_conv = CResult_Bolt11InvoiceParseOrSemanticErrorZ_clone(arg);
27754         return tag_ptr(ret_conv, true);
27755 }
27756 int64_t  __attribute__((export_name("TS_CResult_Bolt11InvoiceParseOrSemanticErrorZ_clone_ptr"))) TS_CResult_Bolt11InvoiceParseOrSemanticErrorZ_clone_ptr(uint64_t arg) {
27757         LDKCResult_Bolt11InvoiceParseOrSemanticErrorZ* arg_conv = (LDKCResult_Bolt11InvoiceParseOrSemanticErrorZ*)untag_ptr(arg);
27758         int64_t ret_conv = CResult_Bolt11InvoiceParseOrSemanticErrorZ_clone_ptr(arg_conv);
27759         return ret_conv;
27760 }
27761
27762 uint64_t  __attribute__((export_name("TS_CResult_Bolt11InvoiceParseOrSemanticErrorZ_clone"))) TS_CResult_Bolt11InvoiceParseOrSemanticErrorZ_clone(uint64_t orig) {
27763         LDKCResult_Bolt11InvoiceParseOrSemanticErrorZ* orig_conv = (LDKCResult_Bolt11InvoiceParseOrSemanticErrorZ*)untag_ptr(orig);
27764         LDKCResult_Bolt11InvoiceParseOrSemanticErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_Bolt11InvoiceParseOrSemanticErrorZ), "LDKCResult_Bolt11InvoiceParseOrSemanticErrorZ");
27765         *ret_conv = CResult_Bolt11InvoiceParseOrSemanticErrorZ_clone(orig_conv);
27766         return tag_ptr(ret_conv, true);
27767 }
27768
27769 uint64_t  __attribute__((export_name("TS_CResult_SignedRawBolt11InvoiceBolt11ParseErrorZ_ok"))) TS_CResult_SignedRawBolt11InvoiceBolt11ParseErrorZ_ok(uint64_t o) {
27770         LDKSignedRawBolt11Invoice o_conv;
27771         o_conv.inner = untag_ptr(o);
27772         o_conv.is_owned = ptr_is_owned(o);
27773         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
27774         o_conv = SignedRawBolt11Invoice_clone(&o_conv);
27775         LDKCResult_SignedRawBolt11InvoiceBolt11ParseErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_SignedRawBolt11InvoiceBolt11ParseErrorZ), "LDKCResult_SignedRawBolt11InvoiceBolt11ParseErrorZ");
27776         *ret_conv = CResult_SignedRawBolt11InvoiceBolt11ParseErrorZ_ok(o_conv);
27777         return tag_ptr(ret_conv, true);
27778 }
27779
27780 uint64_t  __attribute__((export_name("TS_CResult_SignedRawBolt11InvoiceBolt11ParseErrorZ_err"))) TS_CResult_SignedRawBolt11InvoiceBolt11ParseErrorZ_err(uint64_t e) {
27781         void* e_ptr = untag_ptr(e);
27782         CHECK_ACCESS(e_ptr);
27783         LDKBolt11ParseError e_conv = *(LDKBolt11ParseError*)(e_ptr);
27784         e_conv = Bolt11ParseError_clone((LDKBolt11ParseError*)untag_ptr(e));
27785         LDKCResult_SignedRawBolt11InvoiceBolt11ParseErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_SignedRawBolt11InvoiceBolt11ParseErrorZ), "LDKCResult_SignedRawBolt11InvoiceBolt11ParseErrorZ");
27786         *ret_conv = CResult_SignedRawBolt11InvoiceBolt11ParseErrorZ_err(e_conv);
27787         return tag_ptr(ret_conv, true);
27788 }
27789
27790 jboolean  __attribute__((export_name("TS_CResult_SignedRawBolt11InvoiceBolt11ParseErrorZ_is_ok"))) TS_CResult_SignedRawBolt11InvoiceBolt11ParseErrorZ_is_ok(uint64_t o) {
27791         LDKCResult_SignedRawBolt11InvoiceBolt11ParseErrorZ* o_conv = (LDKCResult_SignedRawBolt11InvoiceBolt11ParseErrorZ*)untag_ptr(o);
27792         jboolean ret_conv = CResult_SignedRawBolt11InvoiceBolt11ParseErrorZ_is_ok(o_conv);
27793         return ret_conv;
27794 }
27795
27796 void  __attribute__((export_name("TS_CResult_SignedRawBolt11InvoiceBolt11ParseErrorZ_free"))) TS_CResult_SignedRawBolt11InvoiceBolt11ParseErrorZ_free(uint64_t _res) {
27797         if (!ptr_is_owned(_res)) return;
27798         void* _res_ptr = untag_ptr(_res);
27799         CHECK_ACCESS(_res_ptr);
27800         LDKCResult_SignedRawBolt11InvoiceBolt11ParseErrorZ _res_conv = *(LDKCResult_SignedRawBolt11InvoiceBolt11ParseErrorZ*)(_res_ptr);
27801         FREE(untag_ptr(_res));
27802         CResult_SignedRawBolt11InvoiceBolt11ParseErrorZ_free(_res_conv);
27803 }
27804
27805 static inline uint64_t CResult_SignedRawBolt11InvoiceBolt11ParseErrorZ_clone_ptr(LDKCResult_SignedRawBolt11InvoiceBolt11ParseErrorZ *NONNULL_PTR arg) {
27806         LDKCResult_SignedRawBolt11InvoiceBolt11ParseErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_SignedRawBolt11InvoiceBolt11ParseErrorZ), "LDKCResult_SignedRawBolt11InvoiceBolt11ParseErrorZ");
27807         *ret_conv = CResult_SignedRawBolt11InvoiceBolt11ParseErrorZ_clone(arg);
27808         return tag_ptr(ret_conv, true);
27809 }
27810 int64_t  __attribute__((export_name("TS_CResult_SignedRawBolt11InvoiceBolt11ParseErrorZ_clone_ptr"))) TS_CResult_SignedRawBolt11InvoiceBolt11ParseErrorZ_clone_ptr(uint64_t arg) {
27811         LDKCResult_SignedRawBolt11InvoiceBolt11ParseErrorZ* arg_conv = (LDKCResult_SignedRawBolt11InvoiceBolt11ParseErrorZ*)untag_ptr(arg);
27812         int64_t ret_conv = CResult_SignedRawBolt11InvoiceBolt11ParseErrorZ_clone_ptr(arg_conv);
27813         return ret_conv;
27814 }
27815
27816 uint64_t  __attribute__((export_name("TS_CResult_SignedRawBolt11InvoiceBolt11ParseErrorZ_clone"))) TS_CResult_SignedRawBolt11InvoiceBolt11ParseErrorZ_clone(uint64_t orig) {
27817         LDKCResult_SignedRawBolt11InvoiceBolt11ParseErrorZ* orig_conv = (LDKCResult_SignedRawBolt11InvoiceBolt11ParseErrorZ*)untag_ptr(orig);
27818         LDKCResult_SignedRawBolt11InvoiceBolt11ParseErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_SignedRawBolt11InvoiceBolt11ParseErrorZ), "LDKCResult_SignedRawBolt11InvoiceBolt11ParseErrorZ");
27819         *ret_conv = CResult_SignedRawBolt11InvoiceBolt11ParseErrorZ_clone(orig_conv);
27820         return tag_ptr(ret_conv, true);
27821 }
27822
27823 static inline uint64_t C3Tuple_RawBolt11Invoice_u832Bolt11InvoiceSignatureZ_clone_ptr(LDKC3Tuple_RawBolt11Invoice_u832Bolt11InvoiceSignatureZ *NONNULL_PTR arg) {
27824         LDKC3Tuple_RawBolt11Invoice_u832Bolt11InvoiceSignatureZ* ret_conv = MALLOC(sizeof(LDKC3Tuple_RawBolt11Invoice_u832Bolt11InvoiceSignatureZ), "LDKC3Tuple_RawBolt11Invoice_u832Bolt11InvoiceSignatureZ");
27825         *ret_conv = C3Tuple_RawBolt11Invoice_u832Bolt11InvoiceSignatureZ_clone(arg);
27826         return tag_ptr(ret_conv, true);
27827 }
27828 int64_t  __attribute__((export_name("TS_C3Tuple_RawBolt11Invoice_u832Bolt11InvoiceSignatureZ_clone_ptr"))) TS_C3Tuple_RawBolt11Invoice_u832Bolt11InvoiceSignatureZ_clone_ptr(uint64_t arg) {
27829         LDKC3Tuple_RawBolt11Invoice_u832Bolt11InvoiceSignatureZ* arg_conv = (LDKC3Tuple_RawBolt11Invoice_u832Bolt11InvoiceSignatureZ*)untag_ptr(arg);
27830         int64_t ret_conv = C3Tuple_RawBolt11Invoice_u832Bolt11InvoiceSignatureZ_clone_ptr(arg_conv);
27831         return ret_conv;
27832 }
27833
27834 uint64_t  __attribute__((export_name("TS_C3Tuple_RawBolt11Invoice_u832Bolt11InvoiceSignatureZ_clone"))) TS_C3Tuple_RawBolt11Invoice_u832Bolt11InvoiceSignatureZ_clone(uint64_t orig) {
27835         LDKC3Tuple_RawBolt11Invoice_u832Bolt11InvoiceSignatureZ* orig_conv = (LDKC3Tuple_RawBolt11Invoice_u832Bolt11InvoiceSignatureZ*)untag_ptr(orig);
27836         LDKC3Tuple_RawBolt11Invoice_u832Bolt11InvoiceSignatureZ* ret_conv = MALLOC(sizeof(LDKC3Tuple_RawBolt11Invoice_u832Bolt11InvoiceSignatureZ), "LDKC3Tuple_RawBolt11Invoice_u832Bolt11InvoiceSignatureZ");
27837         *ret_conv = C3Tuple_RawBolt11Invoice_u832Bolt11InvoiceSignatureZ_clone(orig_conv);
27838         return tag_ptr(ret_conv, true);
27839 }
27840
27841 uint64_t  __attribute__((export_name("TS_C3Tuple_RawBolt11Invoice_u832Bolt11InvoiceSignatureZ_new"))) TS_C3Tuple_RawBolt11Invoice_u832Bolt11InvoiceSignatureZ_new(uint64_t a, int8_tArray b, uint64_t c) {
27842         LDKRawBolt11Invoice a_conv;
27843         a_conv.inner = untag_ptr(a);
27844         a_conv.is_owned = ptr_is_owned(a);
27845         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
27846         a_conv = RawBolt11Invoice_clone(&a_conv);
27847         LDKThirtyTwoBytes b_ref;
27848         CHECK(b->arr_len == 32);
27849         memcpy(b_ref.data, b->elems, 32); FREE(b);
27850         LDKBolt11InvoiceSignature c_conv;
27851         c_conv.inner = untag_ptr(c);
27852         c_conv.is_owned = ptr_is_owned(c);
27853         CHECK_INNER_FIELD_ACCESS_OR_NULL(c_conv);
27854         c_conv = Bolt11InvoiceSignature_clone(&c_conv);
27855         LDKC3Tuple_RawBolt11Invoice_u832Bolt11InvoiceSignatureZ* ret_conv = MALLOC(sizeof(LDKC3Tuple_RawBolt11Invoice_u832Bolt11InvoiceSignatureZ), "LDKC3Tuple_RawBolt11Invoice_u832Bolt11InvoiceSignatureZ");
27856         *ret_conv = C3Tuple_RawBolt11Invoice_u832Bolt11InvoiceSignatureZ_new(a_conv, b_ref, c_conv);
27857         return tag_ptr(ret_conv, true);
27858 }
27859
27860 void  __attribute__((export_name("TS_C3Tuple_RawBolt11Invoice_u832Bolt11InvoiceSignatureZ_free"))) TS_C3Tuple_RawBolt11Invoice_u832Bolt11InvoiceSignatureZ_free(uint64_t _res) {
27861         if (!ptr_is_owned(_res)) return;
27862         void* _res_ptr = untag_ptr(_res);
27863         CHECK_ACCESS(_res_ptr);
27864         LDKC3Tuple_RawBolt11Invoice_u832Bolt11InvoiceSignatureZ _res_conv = *(LDKC3Tuple_RawBolt11Invoice_u832Bolt11InvoiceSignatureZ*)(_res_ptr);
27865         FREE(untag_ptr(_res));
27866         C3Tuple_RawBolt11Invoice_u832Bolt11InvoiceSignatureZ_free(_res_conv);
27867 }
27868
27869 uint64_t  __attribute__((export_name("TS_CResult_PayeePubKeySecp256k1ErrorZ_ok"))) TS_CResult_PayeePubKeySecp256k1ErrorZ_ok(uint64_t o) {
27870         LDKPayeePubKey o_conv;
27871         o_conv.inner = untag_ptr(o);
27872         o_conv.is_owned = ptr_is_owned(o);
27873         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
27874         o_conv = PayeePubKey_clone(&o_conv);
27875         LDKCResult_PayeePubKeySecp256k1ErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PayeePubKeySecp256k1ErrorZ), "LDKCResult_PayeePubKeySecp256k1ErrorZ");
27876         *ret_conv = CResult_PayeePubKeySecp256k1ErrorZ_ok(o_conv);
27877         return tag_ptr(ret_conv, true);
27878 }
27879
27880 uint64_t  __attribute__((export_name("TS_CResult_PayeePubKeySecp256k1ErrorZ_err"))) TS_CResult_PayeePubKeySecp256k1ErrorZ_err(uint32_t e) {
27881         LDKSecp256k1Error e_conv = LDKSecp256k1Error_from_js(e);
27882         LDKCResult_PayeePubKeySecp256k1ErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PayeePubKeySecp256k1ErrorZ), "LDKCResult_PayeePubKeySecp256k1ErrorZ");
27883         *ret_conv = CResult_PayeePubKeySecp256k1ErrorZ_err(e_conv);
27884         return tag_ptr(ret_conv, true);
27885 }
27886
27887 jboolean  __attribute__((export_name("TS_CResult_PayeePubKeySecp256k1ErrorZ_is_ok"))) TS_CResult_PayeePubKeySecp256k1ErrorZ_is_ok(uint64_t o) {
27888         LDKCResult_PayeePubKeySecp256k1ErrorZ* o_conv = (LDKCResult_PayeePubKeySecp256k1ErrorZ*)untag_ptr(o);
27889         jboolean ret_conv = CResult_PayeePubKeySecp256k1ErrorZ_is_ok(o_conv);
27890         return ret_conv;
27891 }
27892
27893 void  __attribute__((export_name("TS_CResult_PayeePubKeySecp256k1ErrorZ_free"))) TS_CResult_PayeePubKeySecp256k1ErrorZ_free(uint64_t _res) {
27894         if (!ptr_is_owned(_res)) return;
27895         void* _res_ptr = untag_ptr(_res);
27896         CHECK_ACCESS(_res_ptr);
27897         LDKCResult_PayeePubKeySecp256k1ErrorZ _res_conv = *(LDKCResult_PayeePubKeySecp256k1ErrorZ*)(_res_ptr);
27898         FREE(untag_ptr(_res));
27899         CResult_PayeePubKeySecp256k1ErrorZ_free(_res_conv);
27900 }
27901
27902 static inline uint64_t CResult_PayeePubKeySecp256k1ErrorZ_clone_ptr(LDKCResult_PayeePubKeySecp256k1ErrorZ *NONNULL_PTR arg) {
27903         LDKCResult_PayeePubKeySecp256k1ErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PayeePubKeySecp256k1ErrorZ), "LDKCResult_PayeePubKeySecp256k1ErrorZ");
27904         *ret_conv = CResult_PayeePubKeySecp256k1ErrorZ_clone(arg);
27905         return tag_ptr(ret_conv, true);
27906 }
27907 int64_t  __attribute__((export_name("TS_CResult_PayeePubKeySecp256k1ErrorZ_clone_ptr"))) TS_CResult_PayeePubKeySecp256k1ErrorZ_clone_ptr(uint64_t arg) {
27908         LDKCResult_PayeePubKeySecp256k1ErrorZ* arg_conv = (LDKCResult_PayeePubKeySecp256k1ErrorZ*)untag_ptr(arg);
27909         int64_t ret_conv = CResult_PayeePubKeySecp256k1ErrorZ_clone_ptr(arg_conv);
27910         return ret_conv;
27911 }
27912
27913 uint64_t  __attribute__((export_name("TS_CResult_PayeePubKeySecp256k1ErrorZ_clone"))) TS_CResult_PayeePubKeySecp256k1ErrorZ_clone(uint64_t orig) {
27914         LDKCResult_PayeePubKeySecp256k1ErrorZ* orig_conv = (LDKCResult_PayeePubKeySecp256k1ErrorZ*)untag_ptr(orig);
27915         LDKCResult_PayeePubKeySecp256k1ErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PayeePubKeySecp256k1ErrorZ), "LDKCResult_PayeePubKeySecp256k1ErrorZ");
27916         *ret_conv = CResult_PayeePubKeySecp256k1ErrorZ_clone(orig_conv);
27917         return tag_ptr(ret_conv, true);
27918 }
27919
27920 void  __attribute__((export_name("TS_CVec_PrivateRouteZ_free"))) TS_CVec_PrivateRouteZ_free(uint64_tArray _res) {
27921         LDKCVec_PrivateRouteZ _res_constr;
27922         _res_constr.datalen = _res->arr_len;
27923         if (_res_constr.datalen > 0)
27924                 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKPrivateRoute), "LDKCVec_PrivateRouteZ Elements");
27925         else
27926                 _res_constr.data = NULL;
27927         uint64_t* _res_vals = _res->elems;
27928         for (size_t o = 0; o < _res_constr.datalen; o++) {
27929                 uint64_t _res_conv_14 = _res_vals[o];
27930                 LDKPrivateRoute _res_conv_14_conv;
27931                 _res_conv_14_conv.inner = untag_ptr(_res_conv_14);
27932                 _res_conv_14_conv.is_owned = ptr_is_owned(_res_conv_14);
27933                 CHECK_INNER_FIELD_ACCESS_OR_NULL(_res_conv_14_conv);
27934                 _res_constr.data[o] = _res_conv_14_conv;
27935         }
27936         FREE(_res);
27937         CVec_PrivateRouteZ_free(_res_constr);
27938 }
27939
27940 uint64_t  __attribute__((export_name("TS_CResult_PositiveTimestampCreationErrorZ_ok"))) TS_CResult_PositiveTimestampCreationErrorZ_ok(uint64_t o) {
27941         LDKPositiveTimestamp o_conv;
27942         o_conv.inner = untag_ptr(o);
27943         o_conv.is_owned = ptr_is_owned(o);
27944         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
27945         o_conv = PositiveTimestamp_clone(&o_conv);
27946         LDKCResult_PositiveTimestampCreationErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PositiveTimestampCreationErrorZ), "LDKCResult_PositiveTimestampCreationErrorZ");
27947         *ret_conv = CResult_PositiveTimestampCreationErrorZ_ok(o_conv);
27948         return tag_ptr(ret_conv, true);
27949 }
27950
27951 uint64_t  __attribute__((export_name("TS_CResult_PositiveTimestampCreationErrorZ_err"))) TS_CResult_PositiveTimestampCreationErrorZ_err(uint32_t e) {
27952         LDKCreationError e_conv = LDKCreationError_from_js(e);
27953         LDKCResult_PositiveTimestampCreationErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PositiveTimestampCreationErrorZ), "LDKCResult_PositiveTimestampCreationErrorZ");
27954         *ret_conv = CResult_PositiveTimestampCreationErrorZ_err(e_conv);
27955         return tag_ptr(ret_conv, true);
27956 }
27957
27958 jboolean  __attribute__((export_name("TS_CResult_PositiveTimestampCreationErrorZ_is_ok"))) TS_CResult_PositiveTimestampCreationErrorZ_is_ok(uint64_t o) {
27959         LDKCResult_PositiveTimestampCreationErrorZ* o_conv = (LDKCResult_PositiveTimestampCreationErrorZ*)untag_ptr(o);
27960         jboolean ret_conv = CResult_PositiveTimestampCreationErrorZ_is_ok(o_conv);
27961         return ret_conv;
27962 }
27963
27964 void  __attribute__((export_name("TS_CResult_PositiveTimestampCreationErrorZ_free"))) TS_CResult_PositiveTimestampCreationErrorZ_free(uint64_t _res) {
27965         if (!ptr_is_owned(_res)) return;
27966         void* _res_ptr = untag_ptr(_res);
27967         CHECK_ACCESS(_res_ptr);
27968         LDKCResult_PositiveTimestampCreationErrorZ _res_conv = *(LDKCResult_PositiveTimestampCreationErrorZ*)(_res_ptr);
27969         FREE(untag_ptr(_res));
27970         CResult_PositiveTimestampCreationErrorZ_free(_res_conv);
27971 }
27972
27973 static inline uint64_t CResult_PositiveTimestampCreationErrorZ_clone_ptr(LDKCResult_PositiveTimestampCreationErrorZ *NONNULL_PTR arg) {
27974         LDKCResult_PositiveTimestampCreationErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PositiveTimestampCreationErrorZ), "LDKCResult_PositiveTimestampCreationErrorZ");
27975         *ret_conv = CResult_PositiveTimestampCreationErrorZ_clone(arg);
27976         return tag_ptr(ret_conv, true);
27977 }
27978 int64_t  __attribute__((export_name("TS_CResult_PositiveTimestampCreationErrorZ_clone_ptr"))) TS_CResult_PositiveTimestampCreationErrorZ_clone_ptr(uint64_t arg) {
27979         LDKCResult_PositiveTimestampCreationErrorZ* arg_conv = (LDKCResult_PositiveTimestampCreationErrorZ*)untag_ptr(arg);
27980         int64_t ret_conv = CResult_PositiveTimestampCreationErrorZ_clone_ptr(arg_conv);
27981         return ret_conv;
27982 }
27983
27984 uint64_t  __attribute__((export_name("TS_CResult_PositiveTimestampCreationErrorZ_clone"))) TS_CResult_PositiveTimestampCreationErrorZ_clone(uint64_t orig) {
27985         LDKCResult_PositiveTimestampCreationErrorZ* orig_conv = (LDKCResult_PositiveTimestampCreationErrorZ*)untag_ptr(orig);
27986         LDKCResult_PositiveTimestampCreationErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PositiveTimestampCreationErrorZ), "LDKCResult_PositiveTimestampCreationErrorZ");
27987         *ret_conv = CResult_PositiveTimestampCreationErrorZ_clone(orig_conv);
27988         return tag_ptr(ret_conv, true);
27989 }
27990
27991 uint64_t  __attribute__((export_name("TS_CResult_NoneBolt11SemanticErrorZ_ok"))) TS_CResult_NoneBolt11SemanticErrorZ_ok() {
27992         LDKCResult_NoneBolt11SemanticErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneBolt11SemanticErrorZ), "LDKCResult_NoneBolt11SemanticErrorZ");
27993         *ret_conv = CResult_NoneBolt11SemanticErrorZ_ok();
27994         return tag_ptr(ret_conv, true);
27995 }
27996
27997 uint64_t  __attribute__((export_name("TS_CResult_NoneBolt11SemanticErrorZ_err"))) TS_CResult_NoneBolt11SemanticErrorZ_err(uint32_t e) {
27998         LDKBolt11SemanticError e_conv = LDKBolt11SemanticError_from_js(e);
27999         LDKCResult_NoneBolt11SemanticErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneBolt11SemanticErrorZ), "LDKCResult_NoneBolt11SemanticErrorZ");
28000         *ret_conv = CResult_NoneBolt11SemanticErrorZ_err(e_conv);
28001         return tag_ptr(ret_conv, true);
28002 }
28003
28004 jboolean  __attribute__((export_name("TS_CResult_NoneBolt11SemanticErrorZ_is_ok"))) TS_CResult_NoneBolt11SemanticErrorZ_is_ok(uint64_t o) {
28005         LDKCResult_NoneBolt11SemanticErrorZ* o_conv = (LDKCResult_NoneBolt11SemanticErrorZ*)untag_ptr(o);
28006         jboolean ret_conv = CResult_NoneBolt11SemanticErrorZ_is_ok(o_conv);
28007         return ret_conv;
28008 }
28009
28010 void  __attribute__((export_name("TS_CResult_NoneBolt11SemanticErrorZ_free"))) TS_CResult_NoneBolt11SemanticErrorZ_free(uint64_t _res) {
28011         if (!ptr_is_owned(_res)) return;
28012         void* _res_ptr = untag_ptr(_res);
28013         CHECK_ACCESS(_res_ptr);
28014         LDKCResult_NoneBolt11SemanticErrorZ _res_conv = *(LDKCResult_NoneBolt11SemanticErrorZ*)(_res_ptr);
28015         FREE(untag_ptr(_res));
28016         CResult_NoneBolt11SemanticErrorZ_free(_res_conv);
28017 }
28018
28019 static inline uint64_t CResult_NoneBolt11SemanticErrorZ_clone_ptr(LDKCResult_NoneBolt11SemanticErrorZ *NONNULL_PTR arg) {
28020         LDKCResult_NoneBolt11SemanticErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneBolt11SemanticErrorZ), "LDKCResult_NoneBolt11SemanticErrorZ");
28021         *ret_conv = CResult_NoneBolt11SemanticErrorZ_clone(arg);
28022         return tag_ptr(ret_conv, true);
28023 }
28024 int64_t  __attribute__((export_name("TS_CResult_NoneBolt11SemanticErrorZ_clone_ptr"))) TS_CResult_NoneBolt11SemanticErrorZ_clone_ptr(uint64_t arg) {
28025         LDKCResult_NoneBolt11SemanticErrorZ* arg_conv = (LDKCResult_NoneBolt11SemanticErrorZ*)untag_ptr(arg);
28026         int64_t ret_conv = CResult_NoneBolt11SemanticErrorZ_clone_ptr(arg_conv);
28027         return ret_conv;
28028 }
28029
28030 uint64_t  __attribute__((export_name("TS_CResult_NoneBolt11SemanticErrorZ_clone"))) TS_CResult_NoneBolt11SemanticErrorZ_clone(uint64_t orig) {
28031         LDKCResult_NoneBolt11SemanticErrorZ* orig_conv = (LDKCResult_NoneBolt11SemanticErrorZ*)untag_ptr(orig);
28032         LDKCResult_NoneBolt11SemanticErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneBolt11SemanticErrorZ), "LDKCResult_NoneBolt11SemanticErrorZ");
28033         *ret_conv = CResult_NoneBolt11SemanticErrorZ_clone(orig_conv);
28034         return tag_ptr(ret_conv, true);
28035 }
28036
28037 uint64_t  __attribute__((export_name("TS_CResult_Bolt11InvoiceBolt11SemanticErrorZ_ok"))) TS_CResult_Bolt11InvoiceBolt11SemanticErrorZ_ok(uint64_t o) {
28038         LDKBolt11Invoice o_conv;
28039         o_conv.inner = untag_ptr(o);
28040         o_conv.is_owned = ptr_is_owned(o);
28041         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
28042         o_conv = Bolt11Invoice_clone(&o_conv);
28043         LDKCResult_Bolt11InvoiceBolt11SemanticErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_Bolt11InvoiceBolt11SemanticErrorZ), "LDKCResult_Bolt11InvoiceBolt11SemanticErrorZ");
28044         *ret_conv = CResult_Bolt11InvoiceBolt11SemanticErrorZ_ok(o_conv);
28045         return tag_ptr(ret_conv, true);
28046 }
28047
28048 uint64_t  __attribute__((export_name("TS_CResult_Bolt11InvoiceBolt11SemanticErrorZ_err"))) TS_CResult_Bolt11InvoiceBolt11SemanticErrorZ_err(uint32_t e) {
28049         LDKBolt11SemanticError e_conv = LDKBolt11SemanticError_from_js(e);
28050         LDKCResult_Bolt11InvoiceBolt11SemanticErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_Bolt11InvoiceBolt11SemanticErrorZ), "LDKCResult_Bolt11InvoiceBolt11SemanticErrorZ");
28051         *ret_conv = CResult_Bolt11InvoiceBolt11SemanticErrorZ_err(e_conv);
28052         return tag_ptr(ret_conv, true);
28053 }
28054
28055 jboolean  __attribute__((export_name("TS_CResult_Bolt11InvoiceBolt11SemanticErrorZ_is_ok"))) TS_CResult_Bolt11InvoiceBolt11SemanticErrorZ_is_ok(uint64_t o) {
28056         LDKCResult_Bolt11InvoiceBolt11SemanticErrorZ* o_conv = (LDKCResult_Bolt11InvoiceBolt11SemanticErrorZ*)untag_ptr(o);
28057         jboolean ret_conv = CResult_Bolt11InvoiceBolt11SemanticErrorZ_is_ok(o_conv);
28058         return ret_conv;
28059 }
28060
28061 void  __attribute__((export_name("TS_CResult_Bolt11InvoiceBolt11SemanticErrorZ_free"))) TS_CResult_Bolt11InvoiceBolt11SemanticErrorZ_free(uint64_t _res) {
28062         if (!ptr_is_owned(_res)) return;
28063         void* _res_ptr = untag_ptr(_res);
28064         CHECK_ACCESS(_res_ptr);
28065         LDKCResult_Bolt11InvoiceBolt11SemanticErrorZ _res_conv = *(LDKCResult_Bolt11InvoiceBolt11SemanticErrorZ*)(_res_ptr);
28066         FREE(untag_ptr(_res));
28067         CResult_Bolt11InvoiceBolt11SemanticErrorZ_free(_res_conv);
28068 }
28069
28070 static inline uint64_t CResult_Bolt11InvoiceBolt11SemanticErrorZ_clone_ptr(LDKCResult_Bolt11InvoiceBolt11SemanticErrorZ *NONNULL_PTR arg) {
28071         LDKCResult_Bolt11InvoiceBolt11SemanticErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_Bolt11InvoiceBolt11SemanticErrorZ), "LDKCResult_Bolt11InvoiceBolt11SemanticErrorZ");
28072         *ret_conv = CResult_Bolt11InvoiceBolt11SemanticErrorZ_clone(arg);
28073         return tag_ptr(ret_conv, true);
28074 }
28075 int64_t  __attribute__((export_name("TS_CResult_Bolt11InvoiceBolt11SemanticErrorZ_clone_ptr"))) TS_CResult_Bolt11InvoiceBolt11SemanticErrorZ_clone_ptr(uint64_t arg) {
28076         LDKCResult_Bolt11InvoiceBolt11SemanticErrorZ* arg_conv = (LDKCResult_Bolt11InvoiceBolt11SemanticErrorZ*)untag_ptr(arg);
28077         int64_t ret_conv = CResult_Bolt11InvoiceBolt11SemanticErrorZ_clone_ptr(arg_conv);
28078         return ret_conv;
28079 }
28080
28081 uint64_t  __attribute__((export_name("TS_CResult_Bolt11InvoiceBolt11SemanticErrorZ_clone"))) TS_CResult_Bolt11InvoiceBolt11SemanticErrorZ_clone(uint64_t orig) {
28082         LDKCResult_Bolt11InvoiceBolt11SemanticErrorZ* orig_conv = (LDKCResult_Bolt11InvoiceBolt11SemanticErrorZ*)untag_ptr(orig);
28083         LDKCResult_Bolt11InvoiceBolt11SemanticErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_Bolt11InvoiceBolt11SemanticErrorZ), "LDKCResult_Bolt11InvoiceBolt11SemanticErrorZ");
28084         *ret_conv = CResult_Bolt11InvoiceBolt11SemanticErrorZ_clone(orig_conv);
28085         return tag_ptr(ret_conv, true);
28086 }
28087
28088 uint64_t  __attribute__((export_name("TS_CResult_DescriptionCreationErrorZ_ok"))) TS_CResult_DescriptionCreationErrorZ_ok(uint64_t o) {
28089         LDKDescription o_conv;
28090         o_conv.inner = untag_ptr(o);
28091         o_conv.is_owned = ptr_is_owned(o);
28092         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
28093         o_conv = Description_clone(&o_conv);
28094         LDKCResult_DescriptionCreationErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_DescriptionCreationErrorZ), "LDKCResult_DescriptionCreationErrorZ");
28095         *ret_conv = CResult_DescriptionCreationErrorZ_ok(o_conv);
28096         return tag_ptr(ret_conv, true);
28097 }
28098
28099 uint64_t  __attribute__((export_name("TS_CResult_DescriptionCreationErrorZ_err"))) TS_CResult_DescriptionCreationErrorZ_err(uint32_t e) {
28100         LDKCreationError e_conv = LDKCreationError_from_js(e);
28101         LDKCResult_DescriptionCreationErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_DescriptionCreationErrorZ), "LDKCResult_DescriptionCreationErrorZ");
28102         *ret_conv = CResult_DescriptionCreationErrorZ_err(e_conv);
28103         return tag_ptr(ret_conv, true);
28104 }
28105
28106 jboolean  __attribute__((export_name("TS_CResult_DescriptionCreationErrorZ_is_ok"))) TS_CResult_DescriptionCreationErrorZ_is_ok(uint64_t o) {
28107         LDKCResult_DescriptionCreationErrorZ* o_conv = (LDKCResult_DescriptionCreationErrorZ*)untag_ptr(o);
28108         jboolean ret_conv = CResult_DescriptionCreationErrorZ_is_ok(o_conv);
28109         return ret_conv;
28110 }
28111
28112 void  __attribute__((export_name("TS_CResult_DescriptionCreationErrorZ_free"))) TS_CResult_DescriptionCreationErrorZ_free(uint64_t _res) {
28113         if (!ptr_is_owned(_res)) return;
28114         void* _res_ptr = untag_ptr(_res);
28115         CHECK_ACCESS(_res_ptr);
28116         LDKCResult_DescriptionCreationErrorZ _res_conv = *(LDKCResult_DescriptionCreationErrorZ*)(_res_ptr);
28117         FREE(untag_ptr(_res));
28118         CResult_DescriptionCreationErrorZ_free(_res_conv);
28119 }
28120
28121 static inline uint64_t CResult_DescriptionCreationErrorZ_clone_ptr(LDKCResult_DescriptionCreationErrorZ *NONNULL_PTR arg) {
28122         LDKCResult_DescriptionCreationErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_DescriptionCreationErrorZ), "LDKCResult_DescriptionCreationErrorZ");
28123         *ret_conv = CResult_DescriptionCreationErrorZ_clone(arg);
28124         return tag_ptr(ret_conv, true);
28125 }
28126 int64_t  __attribute__((export_name("TS_CResult_DescriptionCreationErrorZ_clone_ptr"))) TS_CResult_DescriptionCreationErrorZ_clone_ptr(uint64_t arg) {
28127         LDKCResult_DescriptionCreationErrorZ* arg_conv = (LDKCResult_DescriptionCreationErrorZ*)untag_ptr(arg);
28128         int64_t ret_conv = CResult_DescriptionCreationErrorZ_clone_ptr(arg_conv);
28129         return ret_conv;
28130 }
28131
28132 uint64_t  __attribute__((export_name("TS_CResult_DescriptionCreationErrorZ_clone"))) TS_CResult_DescriptionCreationErrorZ_clone(uint64_t orig) {
28133         LDKCResult_DescriptionCreationErrorZ* orig_conv = (LDKCResult_DescriptionCreationErrorZ*)untag_ptr(orig);
28134         LDKCResult_DescriptionCreationErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_DescriptionCreationErrorZ), "LDKCResult_DescriptionCreationErrorZ");
28135         *ret_conv = CResult_DescriptionCreationErrorZ_clone(orig_conv);
28136         return tag_ptr(ret_conv, true);
28137 }
28138
28139 uint64_t  __attribute__((export_name("TS_CResult_PrivateRouteCreationErrorZ_ok"))) TS_CResult_PrivateRouteCreationErrorZ_ok(uint64_t o) {
28140         LDKPrivateRoute o_conv;
28141         o_conv.inner = untag_ptr(o);
28142         o_conv.is_owned = ptr_is_owned(o);
28143         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
28144         o_conv = PrivateRoute_clone(&o_conv);
28145         LDKCResult_PrivateRouteCreationErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PrivateRouteCreationErrorZ), "LDKCResult_PrivateRouteCreationErrorZ");
28146         *ret_conv = CResult_PrivateRouteCreationErrorZ_ok(o_conv);
28147         return tag_ptr(ret_conv, true);
28148 }
28149
28150 uint64_t  __attribute__((export_name("TS_CResult_PrivateRouteCreationErrorZ_err"))) TS_CResult_PrivateRouteCreationErrorZ_err(uint32_t e) {
28151         LDKCreationError e_conv = LDKCreationError_from_js(e);
28152         LDKCResult_PrivateRouteCreationErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PrivateRouteCreationErrorZ), "LDKCResult_PrivateRouteCreationErrorZ");
28153         *ret_conv = CResult_PrivateRouteCreationErrorZ_err(e_conv);
28154         return tag_ptr(ret_conv, true);
28155 }
28156
28157 jboolean  __attribute__((export_name("TS_CResult_PrivateRouteCreationErrorZ_is_ok"))) TS_CResult_PrivateRouteCreationErrorZ_is_ok(uint64_t o) {
28158         LDKCResult_PrivateRouteCreationErrorZ* o_conv = (LDKCResult_PrivateRouteCreationErrorZ*)untag_ptr(o);
28159         jboolean ret_conv = CResult_PrivateRouteCreationErrorZ_is_ok(o_conv);
28160         return ret_conv;
28161 }
28162
28163 void  __attribute__((export_name("TS_CResult_PrivateRouteCreationErrorZ_free"))) TS_CResult_PrivateRouteCreationErrorZ_free(uint64_t _res) {
28164         if (!ptr_is_owned(_res)) return;
28165         void* _res_ptr = untag_ptr(_res);
28166         CHECK_ACCESS(_res_ptr);
28167         LDKCResult_PrivateRouteCreationErrorZ _res_conv = *(LDKCResult_PrivateRouteCreationErrorZ*)(_res_ptr);
28168         FREE(untag_ptr(_res));
28169         CResult_PrivateRouteCreationErrorZ_free(_res_conv);
28170 }
28171
28172 static inline uint64_t CResult_PrivateRouteCreationErrorZ_clone_ptr(LDKCResult_PrivateRouteCreationErrorZ *NONNULL_PTR arg) {
28173         LDKCResult_PrivateRouteCreationErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PrivateRouteCreationErrorZ), "LDKCResult_PrivateRouteCreationErrorZ");
28174         *ret_conv = CResult_PrivateRouteCreationErrorZ_clone(arg);
28175         return tag_ptr(ret_conv, true);
28176 }
28177 int64_t  __attribute__((export_name("TS_CResult_PrivateRouteCreationErrorZ_clone_ptr"))) TS_CResult_PrivateRouteCreationErrorZ_clone_ptr(uint64_t arg) {
28178         LDKCResult_PrivateRouteCreationErrorZ* arg_conv = (LDKCResult_PrivateRouteCreationErrorZ*)untag_ptr(arg);
28179         int64_t ret_conv = CResult_PrivateRouteCreationErrorZ_clone_ptr(arg_conv);
28180         return ret_conv;
28181 }
28182
28183 uint64_t  __attribute__((export_name("TS_CResult_PrivateRouteCreationErrorZ_clone"))) TS_CResult_PrivateRouteCreationErrorZ_clone(uint64_t orig) {
28184         LDKCResult_PrivateRouteCreationErrorZ* orig_conv = (LDKCResult_PrivateRouteCreationErrorZ*)untag_ptr(orig);
28185         LDKCResult_PrivateRouteCreationErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PrivateRouteCreationErrorZ), "LDKCResult_PrivateRouteCreationErrorZ");
28186         *ret_conv = CResult_PrivateRouteCreationErrorZ_clone(orig_conv);
28187         return tag_ptr(ret_conv, true);
28188 }
28189
28190 uint64_t  __attribute__((export_name("TS_CResult_OutPointDecodeErrorZ_ok"))) TS_CResult_OutPointDecodeErrorZ_ok(uint64_t o) {
28191         LDKOutPoint o_conv;
28192         o_conv.inner = untag_ptr(o);
28193         o_conv.is_owned = ptr_is_owned(o);
28194         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
28195         o_conv = OutPoint_clone(&o_conv);
28196         LDKCResult_OutPointDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_OutPointDecodeErrorZ), "LDKCResult_OutPointDecodeErrorZ");
28197         *ret_conv = CResult_OutPointDecodeErrorZ_ok(o_conv);
28198         return tag_ptr(ret_conv, true);
28199 }
28200
28201 uint64_t  __attribute__((export_name("TS_CResult_OutPointDecodeErrorZ_err"))) TS_CResult_OutPointDecodeErrorZ_err(uint64_t e) {
28202         void* e_ptr = untag_ptr(e);
28203         CHECK_ACCESS(e_ptr);
28204         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
28205         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
28206         LDKCResult_OutPointDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_OutPointDecodeErrorZ), "LDKCResult_OutPointDecodeErrorZ");
28207         *ret_conv = CResult_OutPointDecodeErrorZ_err(e_conv);
28208         return tag_ptr(ret_conv, true);
28209 }
28210
28211 jboolean  __attribute__((export_name("TS_CResult_OutPointDecodeErrorZ_is_ok"))) TS_CResult_OutPointDecodeErrorZ_is_ok(uint64_t o) {
28212         LDKCResult_OutPointDecodeErrorZ* o_conv = (LDKCResult_OutPointDecodeErrorZ*)untag_ptr(o);
28213         jboolean ret_conv = CResult_OutPointDecodeErrorZ_is_ok(o_conv);
28214         return ret_conv;
28215 }
28216
28217 void  __attribute__((export_name("TS_CResult_OutPointDecodeErrorZ_free"))) TS_CResult_OutPointDecodeErrorZ_free(uint64_t _res) {
28218         if (!ptr_is_owned(_res)) return;
28219         void* _res_ptr = untag_ptr(_res);
28220         CHECK_ACCESS(_res_ptr);
28221         LDKCResult_OutPointDecodeErrorZ _res_conv = *(LDKCResult_OutPointDecodeErrorZ*)(_res_ptr);
28222         FREE(untag_ptr(_res));
28223         CResult_OutPointDecodeErrorZ_free(_res_conv);
28224 }
28225
28226 static inline uint64_t CResult_OutPointDecodeErrorZ_clone_ptr(LDKCResult_OutPointDecodeErrorZ *NONNULL_PTR arg) {
28227         LDKCResult_OutPointDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_OutPointDecodeErrorZ), "LDKCResult_OutPointDecodeErrorZ");
28228         *ret_conv = CResult_OutPointDecodeErrorZ_clone(arg);
28229         return tag_ptr(ret_conv, true);
28230 }
28231 int64_t  __attribute__((export_name("TS_CResult_OutPointDecodeErrorZ_clone_ptr"))) TS_CResult_OutPointDecodeErrorZ_clone_ptr(uint64_t arg) {
28232         LDKCResult_OutPointDecodeErrorZ* arg_conv = (LDKCResult_OutPointDecodeErrorZ*)untag_ptr(arg);
28233         int64_t ret_conv = CResult_OutPointDecodeErrorZ_clone_ptr(arg_conv);
28234         return ret_conv;
28235 }
28236
28237 uint64_t  __attribute__((export_name("TS_CResult_OutPointDecodeErrorZ_clone"))) TS_CResult_OutPointDecodeErrorZ_clone(uint64_t orig) {
28238         LDKCResult_OutPointDecodeErrorZ* orig_conv = (LDKCResult_OutPointDecodeErrorZ*)untag_ptr(orig);
28239         LDKCResult_OutPointDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_OutPointDecodeErrorZ), "LDKCResult_OutPointDecodeErrorZ");
28240         *ret_conv = CResult_OutPointDecodeErrorZ_clone(orig_conv);
28241         return tag_ptr(ret_conv, true);
28242 }
28243
28244 uint64_t  __attribute__((export_name("TS_CResult_BigSizeDecodeErrorZ_ok"))) TS_CResult_BigSizeDecodeErrorZ_ok(uint64_t o) {
28245         LDKBigSize o_conv;
28246         o_conv.inner = untag_ptr(o);
28247         o_conv.is_owned = ptr_is_owned(o);
28248         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
28249         o_conv = BigSize_clone(&o_conv);
28250         LDKCResult_BigSizeDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_BigSizeDecodeErrorZ), "LDKCResult_BigSizeDecodeErrorZ");
28251         *ret_conv = CResult_BigSizeDecodeErrorZ_ok(o_conv);
28252         return tag_ptr(ret_conv, true);
28253 }
28254
28255 uint64_t  __attribute__((export_name("TS_CResult_BigSizeDecodeErrorZ_err"))) TS_CResult_BigSizeDecodeErrorZ_err(uint64_t e) {
28256         void* e_ptr = untag_ptr(e);
28257         CHECK_ACCESS(e_ptr);
28258         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
28259         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
28260         LDKCResult_BigSizeDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_BigSizeDecodeErrorZ), "LDKCResult_BigSizeDecodeErrorZ");
28261         *ret_conv = CResult_BigSizeDecodeErrorZ_err(e_conv);
28262         return tag_ptr(ret_conv, true);
28263 }
28264
28265 jboolean  __attribute__((export_name("TS_CResult_BigSizeDecodeErrorZ_is_ok"))) TS_CResult_BigSizeDecodeErrorZ_is_ok(uint64_t o) {
28266         LDKCResult_BigSizeDecodeErrorZ* o_conv = (LDKCResult_BigSizeDecodeErrorZ*)untag_ptr(o);
28267         jboolean ret_conv = CResult_BigSizeDecodeErrorZ_is_ok(o_conv);
28268         return ret_conv;
28269 }
28270
28271 void  __attribute__((export_name("TS_CResult_BigSizeDecodeErrorZ_free"))) TS_CResult_BigSizeDecodeErrorZ_free(uint64_t _res) {
28272         if (!ptr_is_owned(_res)) return;
28273         void* _res_ptr = untag_ptr(_res);
28274         CHECK_ACCESS(_res_ptr);
28275         LDKCResult_BigSizeDecodeErrorZ _res_conv = *(LDKCResult_BigSizeDecodeErrorZ*)(_res_ptr);
28276         FREE(untag_ptr(_res));
28277         CResult_BigSizeDecodeErrorZ_free(_res_conv);
28278 }
28279
28280 static inline uint64_t CResult_BigSizeDecodeErrorZ_clone_ptr(LDKCResult_BigSizeDecodeErrorZ *NONNULL_PTR arg) {
28281         LDKCResult_BigSizeDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_BigSizeDecodeErrorZ), "LDKCResult_BigSizeDecodeErrorZ");
28282         *ret_conv = CResult_BigSizeDecodeErrorZ_clone(arg);
28283         return tag_ptr(ret_conv, true);
28284 }
28285 int64_t  __attribute__((export_name("TS_CResult_BigSizeDecodeErrorZ_clone_ptr"))) TS_CResult_BigSizeDecodeErrorZ_clone_ptr(uint64_t arg) {
28286         LDKCResult_BigSizeDecodeErrorZ* arg_conv = (LDKCResult_BigSizeDecodeErrorZ*)untag_ptr(arg);
28287         int64_t ret_conv = CResult_BigSizeDecodeErrorZ_clone_ptr(arg_conv);
28288         return ret_conv;
28289 }
28290
28291 uint64_t  __attribute__((export_name("TS_CResult_BigSizeDecodeErrorZ_clone"))) TS_CResult_BigSizeDecodeErrorZ_clone(uint64_t orig) {
28292         LDKCResult_BigSizeDecodeErrorZ* orig_conv = (LDKCResult_BigSizeDecodeErrorZ*)untag_ptr(orig);
28293         LDKCResult_BigSizeDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_BigSizeDecodeErrorZ), "LDKCResult_BigSizeDecodeErrorZ");
28294         *ret_conv = CResult_BigSizeDecodeErrorZ_clone(orig_conv);
28295         return tag_ptr(ret_conv, true);
28296 }
28297
28298 uint64_t  __attribute__((export_name("TS_CResult_HostnameDecodeErrorZ_ok"))) TS_CResult_HostnameDecodeErrorZ_ok(uint64_t o) {
28299         LDKHostname o_conv;
28300         o_conv.inner = untag_ptr(o);
28301         o_conv.is_owned = ptr_is_owned(o);
28302         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
28303         o_conv = Hostname_clone(&o_conv);
28304         LDKCResult_HostnameDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_HostnameDecodeErrorZ), "LDKCResult_HostnameDecodeErrorZ");
28305         *ret_conv = CResult_HostnameDecodeErrorZ_ok(o_conv);
28306         return tag_ptr(ret_conv, true);
28307 }
28308
28309 uint64_t  __attribute__((export_name("TS_CResult_HostnameDecodeErrorZ_err"))) TS_CResult_HostnameDecodeErrorZ_err(uint64_t e) {
28310         void* e_ptr = untag_ptr(e);
28311         CHECK_ACCESS(e_ptr);
28312         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
28313         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
28314         LDKCResult_HostnameDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_HostnameDecodeErrorZ), "LDKCResult_HostnameDecodeErrorZ");
28315         *ret_conv = CResult_HostnameDecodeErrorZ_err(e_conv);
28316         return tag_ptr(ret_conv, true);
28317 }
28318
28319 jboolean  __attribute__((export_name("TS_CResult_HostnameDecodeErrorZ_is_ok"))) TS_CResult_HostnameDecodeErrorZ_is_ok(uint64_t o) {
28320         LDKCResult_HostnameDecodeErrorZ* o_conv = (LDKCResult_HostnameDecodeErrorZ*)untag_ptr(o);
28321         jboolean ret_conv = CResult_HostnameDecodeErrorZ_is_ok(o_conv);
28322         return ret_conv;
28323 }
28324
28325 void  __attribute__((export_name("TS_CResult_HostnameDecodeErrorZ_free"))) TS_CResult_HostnameDecodeErrorZ_free(uint64_t _res) {
28326         if (!ptr_is_owned(_res)) return;
28327         void* _res_ptr = untag_ptr(_res);
28328         CHECK_ACCESS(_res_ptr);
28329         LDKCResult_HostnameDecodeErrorZ _res_conv = *(LDKCResult_HostnameDecodeErrorZ*)(_res_ptr);
28330         FREE(untag_ptr(_res));
28331         CResult_HostnameDecodeErrorZ_free(_res_conv);
28332 }
28333
28334 static inline uint64_t CResult_HostnameDecodeErrorZ_clone_ptr(LDKCResult_HostnameDecodeErrorZ *NONNULL_PTR arg) {
28335         LDKCResult_HostnameDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_HostnameDecodeErrorZ), "LDKCResult_HostnameDecodeErrorZ");
28336         *ret_conv = CResult_HostnameDecodeErrorZ_clone(arg);
28337         return tag_ptr(ret_conv, true);
28338 }
28339 int64_t  __attribute__((export_name("TS_CResult_HostnameDecodeErrorZ_clone_ptr"))) TS_CResult_HostnameDecodeErrorZ_clone_ptr(uint64_t arg) {
28340         LDKCResult_HostnameDecodeErrorZ* arg_conv = (LDKCResult_HostnameDecodeErrorZ*)untag_ptr(arg);
28341         int64_t ret_conv = CResult_HostnameDecodeErrorZ_clone_ptr(arg_conv);
28342         return ret_conv;
28343 }
28344
28345 uint64_t  __attribute__((export_name("TS_CResult_HostnameDecodeErrorZ_clone"))) TS_CResult_HostnameDecodeErrorZ_clone(uint64_t orig) {
28346         LDKCResult_HostnameDecodeErrorZ* orig_conv = (LDKCResult_HostnameDecodeErrorZ*)untag_ptr(orig);
28347         LDKCResult_HostnameDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_HostnameDecodeErrorZ), "LDKCResult_HostnameDecodeErrorZ");
28348         *ret_conv = CResult_HostnameDecodeErrorZ_clone(orig_conv);
28349         return tag_ptr(ret_conv, true);
28350 }
28351
28352 uint64_t  __attribute__((export_name("TS_CResult_TransactionU16LenLimitedNoneZ_ok"))) TS_CResult_TransactionU16LenLimitedNoneZ_ok(uint64_t o) {
28353         LDKTransactionU16LenLimited o_conv;
28354         o_conv.inner = untag_ptr(o);
28355         o_conv.is_owned = ptr_is_owned(o);
28356         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
28357         o_conv = TransactionU16LenLimited_clone(&o_conv);
28358         LDKCResult_TransactionU16LenLimitedNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_TransactionU16LenLimitedNoneZ), "LDKCResult_TransactionU16LenLimitedNoneZ");
28359         *ret_conv = CResult_TransactionU16LenLimitedNoneZ_ok(o_conv);
28360         return tag_ptr(ret_conv, true);
28361 }
28362
28363 uint64_t  __attribute__((export_name("TS_CResult_TransactionU16LenLimitedNoneZ_err"))) TS_CResult_TransactionU16LenLimitedNoneZ_err() {
28364         LDKCResult_TransactionU16LenLimitedNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_TransactionU16LenLimitedNoneZ), "LDKCResult_TransactionU16LenLimitedNoneZ");
28365         *ret_conv = CResult_TransactionU16LenLimitedNoneZ_err();
28366         return tag_ptr(ret_conv, true);
28367 }
28368
28369 jboolean  __attribute__((export_name("TS_CResult_TransactionU16LenLimitedNoneZ_is_ok"))) TS_CResult_TransactionU16LenLimitedNoneZ_is_ok(uint64_t o) {
28370         LDKCResult_TransactionU16LenLimitedNoneZ* o_conv = (LDKCResult_TransactionU16LenLimitedNoneZ*)untag_ptr(o);
28371         jboolean ret_conv = CResult_TransactionU16LenLimitedNoneZ_is_ok(o_conv);
28372         return ret_conv;
28373 }
28374
28375 void  __attribute__((export_name("TS_CResult_TransactionU16LenLimitedNoneZ_free"))) TS_CResult_TransactionU16LenLimitedNoneZ_free(uint64_t _res) {
28376         if (!ptr_is_owned(_res)) return;
28377         void* _res_ptr = untag_ptr(_res);
28378         CHECK_ACCESS(_res_ptr);
28379         LDKCResult_TransactionU16LenLimitedNoneZ _res_conv = *(LDKCResult_TransactionU16LenLimitedNoneZ*)(_res_ptr);
28380         FREE(untag_ptr(_res));
28381         CResult_TransactionU16LenLimitedNoneZ_free(_res_conv);
28382 }
28383
28384 static inline uint64_t CResult_TransactionU16LenLimitedNoneZ_clone_ptr(LDKCResult_TransactionU16LenLimitedNoneZ *NONNULL_PTR arg) {
28385         LDKCResult_TransactionU16LenLimitedNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_TransactionU16LenLimitedNoneZ), "LDKCResult_TransactionU16LenLimitedNoneZ");
28386         *ret_conv = CResult_TransactionU16LenLimitedNoneZ_clone(arg);
28387         return tag_ptr(ret_conv, true);
28388 }
28389 int64_t  __attribute__((export_name("TS_CResult_TransactionU16LenLimitedNoneZ_clone_ptr"))) TS_CResult_TransactionU16LenLimitedNoneZ_clone_ptr(uint64_t arg) {
28390         LDKCResult_TransactionU16LenLimitedNoneZ* arg_conv = (LDKCResult_TransactionU16LenLimitedNoneZ*)untag_ptr(arg);
28391         int64_t ret_conv = CResult_TransactionU16LenLimitedNoneZ_clone_ptr(arg_conv);
28392         return ret_conv;
28393 }
28394
28395 uint64_t  __attribute__((export_name("TS_CResult_TransactionU16LenLimitedNoneZ_clone"))) TS_CResult_TransactionU16LenLimitedNoneZ_clone(uint64_t orig) {
28396         LDKCResult_TransactionU16LenLimitedNoneZ* orig_conv = (LDKCResult_TransactionU16LenLimitedNoneZ*)untag_ptr(orig);
28397         LDKCResult_TransactionU16LenLimitedNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_TransactionU16LenLimitedNoneZ), "LDKCResult_TransactionU16LenLimitedNoneZ");
28398         *ret_conv = CResult_TransactionU16LenLimitedNoneZ_clone(orig_conv);
28399         return tag_ptr(ret_conv, true);
28400 }
28401
28402 uint64_t  __attribute__((export_name("TS_CResult_TransactionU16LenLimitedDecodeErrorZ_ok"))) TS_CResult_TransactionU16LenLimitedDecodeErrorZ_ok(uint64_t o) {
28403         LDKTransactionU16LenLimited o_conv;
28404         o_conv.inner = untag_ptr(o);
28405         o_conv.is_owned = ptr_is_owned(o);
28406         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
28407         o_conv = TransactionU16LenLimited_clone(&o_conv);
28408         LDKCResult_TransactionU16LenLimitedDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TransactionU16LenLimitedDecodeErrorZ), "LDKCResult_TransactionU16LenLimitedDecodeErrorZ");
28409         *ret_conv = CResult_TransactionU16LenLimitedDecodeErrorZ_ok(o_conv);
28410         return tag_ptr(ret_conv, true);
28411 }
28412
28413 uint64_t  __attribute__((export_name("TS_CResult_TransactionU16LenLimitedDecodeErrorZ_err"))) TS_CResult_TransactionU16LenLimitedDecodeErrorZ_err(uint64_t e) {
28414         void* e_ptr = untag_ptr(e);
28415         CHECK_ACCESS(e_ptr);
28416         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
28417         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
28418         LDKCResult_TransactionU16LenLimitedDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TransactionU16LenLimitedDecodeErrorZ), "LDKCResult_TransactionU16LenLimitedDecodeErrorZ");
28419         *ret_conv = CResult_TransactionU16LenLimitedDecodeErrorZ_err(e_conv);
28420         return tag_ptr(ret_conv, true);
28421 }
28422
28423 jboolean  __attribute__((export_name("TS_CResult_TransactionU16LenLimitedDecodeErrorZ_is_ok"))) TS_CResult_TransactionU16LenLimitedDecodeErrorZ_is_ok(uint64_t o) {
28424         LDKCResult_TransactionU16LenLimitedDecodeErrorZ* o_conv = (LDKCResult_TransactionU16LenLimitedDecodeErrorZ*)untag_ptr(o);
28425         jboolean ret_conv = CResult_TransactionU16LenLimitedDecodeErrorZ_is_ok(o_conv);
28426         return ret_conv;
28427 }
28428
28429 void  __attribute__((export_name("TS_CResult_TransactionU16LenLimitedDecodeErrorZ_free"))) TS_CResult_TransactionU16LenLimitedDecodeErrorZ_free(uint64_t _res) {
28430         if (!ptr_is_owned(_res)) return;
28431         void* _res_ptr = untag_ptr(_res);
28432         CHECK_ACCESS(_res_ptr);
28433         LDKCResult_TransactionU16LenLimitedDecodeErrorZ _res_conv = *(LDKCResult_TransactionU16LenLimitedDecodeErrorZ*)(_res_ptr);
28434         FREE(untag_ptr(_res));
28435         CResult_TransactionU16LenLimitedDecodeErrorZ_free(_res_conv);
28436 }
28437
28438 static inline uint64_t CResult_TransactionU16LenLimitedDecodeErrorZ_clone_ptr(LDKCResult_TransactionU16LenLimitedDecodeErrorZ *NONNULL_PTR arg) {
28439         LDKCResult_TransactionU16LenLimitedDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TransactionU16LenLimitedDecodeErrorZ), "LDKCResult_TransactionU16LenLimitedDecodeErrorZ");
28440         *ret_conv = CResult_TransactionU16LenLimitedDecodeErrorZ_clone(arg);
28441         return tag_ptr(ret_conv, true);
28442 }
28443 int64_t  __attribute__((export_name("TS_CResult_TransactionU16LenLimitedDecodeErrorZ_clone_ptr"))) TS_CResult_TransactionU16LenLimitedDecodeErrorZ_clone_ptr(uint64_t arg) {
28444         LDKCResult_TransactionU16LenLimitedDecodeErrorZ* arg_conv = (LDKCResult_TransactionU16LenLimitedDecodeErrorZ*)untag_ptr(arg);
28445         int64_t ret_conv = CResult_TransactionU16LenLimitedDecodeErrorZ_clone_ptr(arg_conv);
28446         return ret_conv;
28447 }
28448
28449 uint64_t  __attribute__((export_name("TS_CResult_TransactionU16LenLimitedDecodeErrorZ_clone"))) TS_CResult_TransactionU16LenLimitedDecodeErrorZ_clone(uint64_t orig) {
28450         LDKCResult_TransactionU16LenLimitedDecodeErrorZ* orig_conv = (LDKCResult_TransactionU16LenLimitedDecodeErrorZ*)untag_ptr(orig);
28451         LDKCResult_TransactionU16LenLimitedDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TransactionU16LenLimitedDecodeErrorZ), "LDKCResult_TransactionU16LenLimitedDecodeErrorZ");
28452         *ret_conv = CResult_TransactionU16LenLimitedDecodeErrorZ_clone(orig_conv);
28453         return tag_ptr(ret_conv, true);
28454 }
28455
28456 uint64_t  __attribute__((export_name("TS_CResult_UntrustedStringDecodeErrorZ_ok"))) TS_CResult_UntrustedStringDecodeErrorZ_ok(uint64_t o) {
28457         LDKUntrustedString o_conv;
28458         o_conv.inner = untag_ptr(o);
28459         o_conv.is_owned = ptr_is_owned(o);
28460         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
28461         o_conv = UntrustedString_clone(&o_conv);
28462         LDKCResult_UntrustedStringDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UntrustedStringDecodeErrorZ), "LDKCResult_UntrustedStringDecodeErrorZ");
28463         *ret_conv = CResult_UntrustedStringDecodeErrorZ_ok(o_conv);
28464         return tag_ptr(ret_conv, true);
28465 }
28466
28467 uint64_t  __attribute__((export_name("TS_CResult_UntrustedStringDecodeErrorZ_err"))) TS_CResult_UntrustedStringDecodeErrorZ_err(uint64_t e) {
28468         void* e_ptr = untag_ptr(e);
28469         CHECK_ACCESS(e_ptr);
28470         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
28471         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
28472         LDKCResult_UntrustedStringDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UntrustedStringDecodeErrorZ), "LDKCResult_UntrustedStringDecodeErrorZ");
28473         *ret_conv = CResult_UntrustedStringDecodeErrorZ_err(e_conv);
28474         return tag_ptr(ret_conv, true);
28475 }
28476
28477 jboolean  __attribute__((export_name("TS_CResult_UntrustedStringDecodeErrorZ_is_ok"))) TS_CResult_UntrustedStringDecodeErrorZ_is_ok(uint64_t o) {
28478         LDKCResult_UntrustedStringDecodeErrorZ* o_conv = (LDKCResult_UntrustedStringDecodeErrorZ*)untag_ptr(o);
28479         jboolean ret_conv = CResult_UntrustedStringDecodeErrorZ_is_ok(o_conv);
28480         return ret_conv;
28481 }
28482
28483 void  __attribute__((export_name("TS_CResult_UntrustedStringDecodeErrorZ_free"))) TS_CResult_UntrustedStringDecodeErrorZ_free(uint64_t _res) {
28484         if (!ptr_is_owned(_res)) return;
28485         void* _res_ptr = untag_ptr(_res);
28486         CHECK_ACCESS(_res_ptr);
28487         LDKCResult_UntrustedStringDecodeErrorZ _res_conv = *(LDKCResult_UntrustedStringDecodeErrorZ*)(_res_ptr);
28488         FREE(untag_ptr(_res));
28489         CResult_UntrustedStringDecodeErrorZ_free(_res_conv);
28490 }
28491
28492 static inline uint64_t CResult_UntrustedStringDecodeErrorZ_clone_ptr(LDKCResult_UntrustedStringDecodeErrorZ *NONNULL_PTR arg) {
28493         LDKCResult_UntrustedStringDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UntrustedStringDecodeErrorZ), "LDKCResult_UntrustedStringDecodeErrorZ");
28494         *ret_conv = CResult_UntrustedStringDecodeErrorZ_clone(arg);
28495         return tag_ptr(ret_conv, true);
28496 }
28497 int64_t  __attribute__((export_name("TS_CResult_UntrustedStringDecodeErrorZ_clone_ptr"))) TS_CResult_UntrustedStringDecodeErrorZ_clone_ptr(uint64_t arg) {
28498         LDKCResult_UntrustedStringDecodeErrorZ* arg_conv = (LDKCResult_UntrustedStringDecodeErrorZ*)untag_ptr(arg);
28499         int64_t ret_conv = CResult_UntrustedStringDecodeErrorZ_clone_ptr(arg_conv);
28500         return ret_conv;
28501 }
28502
28503 uint64_t  __attribute__((export_name("TS_CResult_UntrustedStringDecodeErrorZ_clone"))) TS_CResult_UntrustedStringDecodeErrorZ_clone(uint64_t orig) {
28504         LDKCResult_UntrustedStringDecodeErrorZ* orig_conv = (LDKCResult_UntrustedStringDecodeErrorZ*)untag_ptr(orig);
28505         LDKCResult_UntrustedStringDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UntrustedStringDecodeErrorZ), "LDKCResult_UntrustedStringDecodeErrorZ");
28506         *ret_conv = CResult_UntrustedStringDecodeErrorZ_clone(orig_conv);
28507         return tag_ptr(ret_conv, true);
28508 }
28509
28510 uint64_t  __attribute__((export_name("TS_CResult_ReceiveTlvsDecodeErrorZ_ok"))) TS_CResult_ReceiveTlvsDecodeErrorZ_ok(uint64_t o) {
28511         LDKReceiveTlvs o_conv;
28512         o_conv.inner = untag_ptr(o);
28513         o_conv.is_owned = ptr_is_owned(o);
28514         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
28515         o_conv = ReceiveTlvs_clone(&o_conv);
28516         LDKCResult_ReceiveTlvsDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ReceiveTlvsDecodeErrorZ), "LDKCResult_ReceiveTlvsDecodeErrorZ");
28517         *ret_conv = CResult_ReceiveTlvsDecodeErrorZ_ok(o_conv);
28518         return tag_ptr(ret_conv, true);
28519 }
28520
28521 uint64_t  __attribute__((export_name("TS_CResult_ReceiveTlvsDecodeErrorZ_err"))) TS_CResult_ReceiveTlvsDecodeErrorZ_err(uint64_t e) {
28522         void* e_ptr = untag_ptr(e);
28523         CHECK_ACCESS(e_ptr);
28524         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
28525         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
28526         LDKCResult_ReceiveTlvsDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ReceiveTlvsDecodeErrorZ), "LDKCResult_ReceiveTlvsDecodeErrorZ");
28527         *ret_conv = CResult_ReceiveTlvsDecodeErrorZ_err(e_conv);
28528         return tag_ptr(ret_conv, true);
28529 }
28530
28531 jboolean  __attribute__((export_name("TS_CResult_ReceiveTlvsDecodeErrorZ_is_ok"))) TS_CResult_ReceiveTlvsDecodeErrorZ_is_ok(uint64_t o) {
28532         LDKCResult_ReceiveTlvsDecodeErrorZ* o_conv = (LDKCResult_ReceiveTlvsDecodeErrorZ*)untag_ptr(o);
28533         jboolean ret_conv = CResult_ReceiveTlvsDecodeErrorZ_is_ok(o_conv);
28534         return ret_conv;
28535 }
28536
28537 void  __attribute__((export_name("TS_CResult_ReceiveTlvsDecodeErrorZ_free"))) TS_CResult_ReceiveTlvsDecodeErrorZ_free(uint64_t _res) {
28538         if (!ptr_is_owned(_res)) return;
28539         void* _res_ptr = untag_ptr(_res);
28540         CHECK_ACCESS(_res_ptr);
28541         LDKCResult_ReceiveTlvsDecodeErrorZ _res_conv = *(LDKCResult_ReceiveTlvsDecodeErrorZ*)(_res_ptr);
28542         FREE(untag_ptr(_res));
28543         CResult_ReceiveTlvsDecodeErrorZ_free(_res_conv);
28544 }
28545
28546 static inline uint64_t CResult_ReceiveTlvsDecodeErrorZ_clone_ptr(LDKCResult_ReceiveTlvsDecodeErrorZ *NONNULL_PTR arg) {
28547         LDKCResult_ReceiveTlvsDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ReceiveTlvsDecodeErrorZ), "LDKCResult_ReceiveTlvsDecodeErrorZ");
28548         *ret_conv = CResult_ReceiveTlvsDecodeErrorZ_clone(arg);
28549         return tag_ptr(ret_conv, true);
28550 }
28551 int64_t  __attribute__((export_name("TS_CResult_ReceiveTlvsDecodeErrorZ_clone_ptr"))) TS_CResult_ReceiveTlvsDecodeErrorZ_clone_ptr(uint64_t arg) {
28552         LDKCResult_ReceiveTlvsDecodeErrorZ* arg_conv = (LDKCResult_ReceiveTlvsDecodeErrorZ*)untag_ptr(arg);
28553         int64_t ret_conv = CResult_ReceiveTlvsDecodeErrorZ_clone_ptr(arg_conv);
28554         return ret_conv;
28555 }
28556
28557 uint64_t  __attribute__((export_name("TS_CResult_ReceiveTlvsDecodeErrorZ_clone"))) TS_CResult_ReceiveTlvsDecodeErrorZ_clone(uint64_t orig) {
28558         LDKCResult_ReceiveTlvsDecodeErrorZ* orig_conv = (LDKCResult_ReceiveTlvsDecodeErrorZ*)untag_ptr(orig);
28559         LDKCResult_ReceiveTlvsDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ReceiveTlvsDecodeErrorZ), "LDKCResult_ReceiveTlvsDecodeErrorZ");
28560         *ret_conv = CResult_ReceiveTlvsDecodeErrorZ_clone(orig_conv);
28561         return tag_ptr(ret_conv, true);
28562 }
28563
28564 uint64_t  __attribute__((export_name("TS_CResult_PaymentRelayDecodeErrorZ_ok"))) TS_CResult_PaymentRelayDecodeErrorZ_ok(uint64_t o) {
28565         LDKPaymentRelay o_conv;
28566         o_conv.inner = untag_ptr(o);
28567         o_conv.is_owned = ptr_is_owned(o);
28568         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
28569         o_conv = PaymentRelay_clone(&o_conv);
28570         LDKCResult_PaymentRelayDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PaymentRelayDecodeErrorZ), "LDKCResult_PaymentRelayDecodeErrorZ");
28571         *ret_conv = CResult_PaymentRelayDecodeErrorZ_ok(o_conv);
28572         return tag_ptr(ret_conv, true);
28573 }
28574
28575 uint64_t  __attribute__((export_name("TS_CResult_PaymentRelayDecodeErrorZ_err"))) TS_CResult_PaymentRelayDecodeErrorZ_err(uint64_t e) {
28576         void* e_ptr = untag_ptr(e);
28577         CHECK_ACCESS(e_ptr);
28578         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
28579         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
28580         LDKCResult_PaymentRelayDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PaymentRelayDecodeErrorZ), "LDKCResult_PaymentRelayDecodeErrorZ");
28581         *ret_conv = CResult_PaymentRelayDecodeErrorZ_err(e_conv);
28582         return tag_ptr(ret_conv, true);
28583 }
28584
28585 jboolean  __attribute__((export_name("TS_CResult_PaymentRelayDecodeErrorZ_is_ok"))) TS_CResult_PaymentRelayDecodeErrorZ_is_ok(uint64_t o) {
28586         LDKCResult_PaymentRelayDecodeErrorZ* o_conv = (LDKCResult_PaymentRelayDecodeErrorZ*)untag_ptr(o);
28587         jboolean ret_conv = CResult_PaymentRelayDecodeErrorZ_is_ok(o_conv);
28588         return ret_conv;
28589 }
28590
28591 void  __attribute__((export_name("TS_CResult_PaymentRelayDecodeErrorZ_free"))) TS_CResult_PaymentRelayDecodeErrorZ_free(uint64_t _res) {
28592         if (!ptr_is_owned(_res)) return;
28593         void* _res_ptr = untag_ptr(_res);
28594         CHECK_ACCESS(_res_ptr);
28595         LDKCResult_PaymentRelayDecodeErrorZ _res_conv = *(LDKCResult_PaymentRelayDecodeErrorZ*)(_res_ptr);
28596         FREE(untag_ptr(_res));
28597         CResult_PaymentRelayDecodeErrorZ_free(_res_conv);
28598 }
28599
28600 static inline uint64_t CResult_PaymentRelayDecodeErrorZ_clone_ptr(LDKCResult_PaymentRelayDecodeErrorZ *NONNULL_PTR arg) {
28601         LDKCResult_PaymentRelayDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PaymentRelayDecodeErrorZ), "LDKCResult_PaymentRelayDecodeErrorZ");
28602         *ret_conv = CResult_PaymentRelayDecodeErrorZ_clone(arg);
28603         return tag_ptr(ret_conv, true);
28604 }
28605 int64_t  __attribute__((export_name("TS_CResult_PaymentRelayDecodeErrorZ_clone_ptr"))) TS_CResult_PaymentRelayDecodeErrorZ_clone_ptr(uint64_t arg) {
28606         LDKCResult_PaymentRelayDecodeErrorZ* arg_conv = (LDKCResult_PaymentRelayDecodeErrorZ*)untag_ptr(arg);
28607         int64_t ret_conv = CResult_PaymentRelayDecodeErrorZ_clone_ptr(arg_conv);
28608         return ret_conv;
28609 }
28610
28611 uint64_t  __attribute__((export_name("TS_CResult_PaymentRelayDecodeErrorZ_clone"))) TS_CResult_PaymentRelayDecodeErrorZ_clone(uint64_t orig) {
28612         LDKCResult_PaymentRelayDecodeErrorZ* orig_conv = (LDKCResult_PaymentRelayDecodeErrorZ*)untag_ptr(orig);
28613         LDKCResult_PaymentRelayDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PaymentRelayDecodeErrorZ), "LDKCResult_PaymentRelayDecodeErrorZ");
28614         *ret_conv = CResult_PaymentRelayDecodeErrorZ_clone(orig_conv);
28615         return tag_ptr(ret_conv, true);
28616 }
28617
28618 uint64_t  __attribute__((export_name("TS_CResult_PaymentConstraintsDecodeErrorZ_ok"))) TS_CResult_PaymentConstraintsDecodeErrorZ_ok(uint64_t o) {
28619         LDKPaymentConstraints o_conv;
28620         o_conv.inner = untag_ptr(o);
28621         o_conv.is_owned = ptr_is_owned(o);
28622         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
28623         o_conv = PaymentConstraints_clone(&o_conv);
28624         LDKCResult_PaymentConstraintsDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PaymentConstraintsDecodeErrorZ), "LDKCResult_PaymentConstraintsDecodeErrorZ");
28625         *ret_conv = CResult_PaymentConstraintsDecodeErrorZ_ok(o_conv);
28626         return tag_ptr(ret_conv, true);
28627 }
28628
28629 uint64_t  __attribute__((export_name("TS_CResult_PaymentConstraintsDecodeErrorZ_err"))) TS_CResult_PaymentConstraintsDecodeErrorZ_err(uint64_t e) {
28630         void* e_ptr = untag_ptr(e);
28631         CHECK_ACCESS(e_ptr);
28632         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
28633         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
28634         LDKCResult_PaymentConstraintsDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PaymentConstraintsDecodeErrorZ), "LDKCResult_PaymentConstraintsDecodeErrorZ");
28635         *ret_conv = CResult_PaymentConstraintsDecodeErrorZ_err(e_conv);
28636         return tag_ptr(ret_conv, true);
28637 }
28638
28639 jboolean  __attribute__((export_name("TS_CResult_PaymentConstraintsDecodeErrorZ_is_ok"))) TS_CResult_PaymentConstraintsDecodeErrorZ_is_ok(uint64_t o) {
28640         LDKCResult_PaymentConstraintsDecodeErrorZ* o_conv = (LDKCResult_PaymentConstraintsDecodeErrorZ*)untag_ptr(o);
28641         jboolean ret_conv = CResult_PaymentConstraintsDecodeErrorZ_is_ok(o_conv);
28642         return ret_conv;
28643 }
28644
28645 void  __attribute__((export_name("TS_CResult_PaymentConstraintsDecodeErrorZ_free"))) TS_CResult_PaymentConstraintsDecodeErrorZ_free(uint64_t _res) {
28646         if (!ptr_is_owned(_res)) return;
28647         void* _res_ptr = untag_ptr(_res);
28648         CHECK_ACCESS(_res_ptr);
28649         LDKCResult_PaymentConstraintsDecodeErrorZ _res_conv = *(LDKCResult_PaymentConstraintsDecodeErrorZ*)(_res_ptr);
28650         FREE(untag_ptr(_res));
28651         CResult_PaymentConstraintsDecodeErrorZ_free(_res_conv);
28652 }
28653
28654 static inline uint64_t CResult_PaymentConstraintsDecodeErrorZ_clone_ptr(LDKCResult_PaymentConstraintsDecodeErrorZ *NONNULL_PTR arg) {
28655         LDKCResult_PaymentConstraintsDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PaymentConstraintsDecodeErrorZ), "LDKCResult_PaymentConstraintsDecodeErrorZ");
28656         *ret_conv = CResult_PaymentConstraintsDecodeErrorZ_clone(arg);
28657         return tag_ptr(ret_conv, true);
28658 }
28659 int64_t  __attribute__((export_name("TS_CResult_PaymentConstraintsDecodeErrorZ_clone_ptr"))) TS_CResult_PaymentConstraintsDecodeErrorZ_clone_ptr(uint64_t arg) {
28660         LDKCResult_PaymentConstraintsDecodeErrorZ* arg_conv = (LDKCResult_PaymentConstraintsDecodeErrorZ*)untag_ptr(arg);
28661         int64_t ret_conv = CResult_PaymentConstraintsDecodeErrorZ_clone_ptr(arg_conv);
28662         return ret_conv;
28663 }
28664
28665 uint64_t  __attribute__((export_name("TS_CResult_PaymentConstraintsDecodeErrorZ_clone"))) TS_CResult_PaymentConstraintsDecodeErrorZ_clone(uint64_t orig) {
28666         LDKCResult_PaymentConstraintsDecodeErrorZ* orig_conv = (LDKCResult_PaymentConstraintsDecodeErrorZ*)untag_ptr(orig);
28667         LDKCResult_PaymentConstraintsDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PaymentConstraintsDecodeErrorZ), "LDKCResult_PaymentConstraintsDecodeErrorZ");
28668         *ret_conv = CResult_PaymentConstraintsDecodeErrorZ_clone(orig_conv);
28669         return tag_ptr(ret_conv, true);
28670 }
28671
28672 uint64_t  __attribute__((export_name("TS_CResult_ThirtyTwoBytesPaymentErrorZ_ok"))) TS_CResult_ThirtyTwoBytesPaymentErrorZ_ok(int8_tArray o) {
28673         LDKThirtyTwoBytes o_ref;
28674         CHECK(o->arr_len == 32);
28675         memcpy(o_ref.data, o->elems, 32); FREE(o);
28676         LDKCResult_ThirtyTwoBytesPaymentErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ThirtyTwoBytesPaymentErrorZ), "LDKCResult_ThirtyTwoBytesPaymentErrorZ");
28677         *ret_conv = CResult_ThirtyTwoBytesPaymentErrorZ_ok(o_ref);
28678         return tag_ptr(ret_conv, true);
28679 }
28680
28681 uint64_t  __attribute__((export_name("TS_CResult_ThirtyTwoBytesPaymentErrorZ_err"))) TS_CResult_ThirtyTwoBytesPaymentErrorZ_err(uint64_t e) {
28682         void* e_ptr = untag_ptr(e);
28683         CHECK_ACCESS(e_ptr);
28684         LDKPaymentError e_conv = *(LDKPaymentError*)(e_ptr);
28685         e_conv = PaymentError_clone((LDKPaymentError*)untag_ptr(e));
28686         LDKCResult_ThirtyTwoBytesPaymentErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ThirtyTwoBytesPaymentErrorZ), "LDKCResult_ThirtyTwoBytesPaymentErrorZ");
28687         *ret_conv = CResult_ThirtyTwoBytesPaymentErrorZ_err(e_conv);
28688         return tag_ptr(ret_conv, true);
28689 }
28690
28691 jboolean  __attribute__((export_name("TS_CResult_ThirtyTwoBytesPaymentErrorZ_is_ok"))) TS_CResult_ThirtyTwoBytesPaymentErrorZ_is_ok(uint64_t o) {
28692         LDKCResult_ThirtyTwoBytesPaymentErrorZ* o_conv = (LDKCResult_ThirtyTwoBytesPaymentErrorZ*)untag_ptr(o);
28693         jboolean ret_conv = CResult_ThirtyTwoBytesPaymentErrorZ_is_ok(o_conv);
28694         return ret_conv;
28695 }
28696
28697 void  __attribute__((export_name("TS_CResult_ThirtyTwoBytesPaymentErrorZ_free"))) TS_CResult_ThirtyTwoBytesPaymentErrorZ_free(uint64_t _res) {
28698         if (!ptr_is_owned(_res)) return;
28699         void* _res_ptr = untag_ptr(_res);
28700         CHECK_ACCESS(_res_ptr);
28701         LDKCResult_ThirtyTwoBytesPaymentErrorZ _res_conv = *(LDKCResult_ThirtyTwoBytesPaymentErrorZ*)(_res_ptr);
28702         FREE(untag_ptr(_res));
28703         CResult_ThirtyTwoBytesPaymentErrorZ_free(_res_conv);
28704 }
28705
28706 static inline uint64_t CResult_ThirtyTwoBytesPaymentErrorZ_clone_ptr(LDKCResult_ThirtyTwoBytesPaymentErrorZ *NONNULL_PTR arg) {
28707         LDKCResult_ThirtyTwoBytesPaymentErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ThirtyTwoBytesPaymentErrorZ), "LDKCResult_ThirtyTwoBytesPaymentErrorZ");
28708         *ret_conv = CResult_ThirtyTwoBytesPaymentErrorZ_clone(arg);
28709         return tag_ptr(ret_conv, true);
28710 }
28711 int64_t  __attribute__((export_name("TS_CResult_ThirtyTwoBytesPaymentErrorZ_clone_ptr"))) TS_CResult_ThirtyTwoBytesPaymentErrorZ_clone_ptr(uint64_t arg) {
28712         LDKCResult_ThirtyTwoBytesPaymentErrorZ* arg_conv = (LDKCResult_ThirtyTwoBytesPaymentErrorZ*)untag_ptr(arg);
28713         int64_t ret_conv = CResult_ThirtyTwoBytesPaymentErrorZ_clone_ptr(arg_conv);
28714         return ret_conv;
28715 }
28716
28717 uint64_t  __attribute__((export_name("TS_CResult_ThirtyTwoBytesPaymentErrorZ_clone"))) TS_CResult_ThirtyTwoBytesPaymentErrorZ_clone(uint64_t orig) {
28718         LDKCResult_ThirtyTwoBytesPaymentErrorZ* orig_conv = (LDKCResult_ThirtyTwoBytesPaymentErrorZ*)untag_ptr(orig);
28719         LDKCResult_ThirtyTwoBytesPaymentErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ThirtyTwoBytesPaymentErrorZ), "LDKCResult_ThirtyTwoBytesPaymentErrorZ");
28720         *ret_conv = CResult_ThirtyTwoBytesPaymentErrorZ_clone(orig_conv);
28721         return tag_ptr(ret_conv, true);
28722 }
28723
28724 uint64_t  __attribute__((export_name("TS_CResult_NonePaymentErrorZ_ok"))) TS_CResult_NonePaymentErrorZ_ok() {
28725         LDKCResult_NonePaymentErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NonePaymentErrorZ), "LDKCResult_NonePaymentErrorZ");
28726         *ret_conv = CResult_NonePaymentErrorZ_ok();
28727         return tag_ptr(ret_conv, true);
28728 }
28729
28730 uint64_t  __attribute__((export_name("TS_CResult_NonePaymentErrorZ_err"))) TS_CResult_NonePaymentErrorZ_err(uint64_t e) {
28731         void* e_ptr = untag_ptr(e);
28732         CHECK_ACCESS(e_ptr);
28733         LDKPaymentError e_conv = *(LDKPaymentError*)(e_ptr);
28734         e_conv = PaymentError_clone((LDKPaymentError*)untag_ptr(e));
28735         LDKCResult_NonePaymentErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NonePaymentErrorZ), "LDKCResult_NonePaymentErrorZ");
28736         *ret_conv = CResult_NonePaymentErrorZ_err(e_conv);
28737         return tag_ptr(ret_conv, true);
28738 }
28739
28740 jboolean  __attribute__((export_name("TS_CResult_NonePaymentErrorZ_is_ok"))) TS_CResult_NonePaymentErrorZ_is_ok(uint64_t o) {
28741         LDKCResult_NonePaymentErrorZ* o_conv = (LDKCResult_NonePaymentErrorZ*)untag_ptr(o);
28742         jboolean ret_conv = CResult_NonePaymentErrorZ_is_ok(o_conv);
28743         return ret_conv;
28744 }
28745
28746 void  __attribute__((export_name("TS_CResult_NonePaymentErrorZ_free"))) TS_CResult_NonePaymentErrorZ_free(uint64_t _res) {
28747         if (!ptr_is_owned(_res)) return;
28748         void* _res_ptr = untag_ptr(_res);
28749         CHECK_ACCESS(_res_ptr);
28750         LDKCResult_NonePaymentErrorZ _res_conv = *(LDKCResult_NonePaymentErrorZ*)(_res_ptr);
28751         FREE(untag_ptr(_res));
28752         CResult_NonePaymentErrorZ_free(_res_conv);
28753 }
28754
28755 static inline uint64_t CResult_NonePaymentErrorZ_clone_ptr(LDKCResult_NonePaymentErrorZ *NONNULL_PTR arg) {
28756         LDKCResult_NonePaymentErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NonePaymentErrorZ), "LDKCResult_NonePaymentErrorZ");
28757         *ret_conv = CResult_NonePaymentErrorZ_clone(arg);
28758         return tag_ptr(ret_conv, true);
28759 }
28760 int64_t  __attribute__((export_name("TS_CResult_NonePaymentErrorZ_clone_ptr"))) TS_CResult_NonePaymentErrorZ_clone_ptr(uint64_t arg) {
28761         LDKCResult_NonePaymentErrorZ* arg_conv = (LDKCResult_NonePaymentErrorZ*)untag_ptr(arg);
28762         int64_t ret_conv = CResult_NonePaymentErrorZ_clone_ptr(arg_conv);
28763         return ret_conv;
28764 }
28765
28766 uint64_t  __attribute__((export_name("TS_CResult_NonePaymentErrorZ_clone"))) TS_CResult_NonePaymentErrorZ_clone(uint64_t orig) {
28767         LDKCResult_NonePaymentErrorZ* orig_conv = (LDKCResult_NonePaymentErrorZ*)untag_ptr(orig);
28768         LDKCResult_NonePaymentErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NonePaymentErrorZ), "LDKCResult_NonePaymentErrorZ");
28769         *ret_conv = CResult_NonePaymentErrorZ_clone(orig_conv);
28770         return tag_ptr(ret_conv, true);
28771 }
28772
28773 uint64_t  __attribute__((export_name("TS_CResult_CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZProbingErrorZ_ok"))) TS_CResult_CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZProbingErrorZ_ok(uint64_tArray o) {
28774         LDKCVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZ o_constr;
28775         o_constr.datalen = o->arr_len;
28776         if (o_constr.datalen > 0)
28777                 o_constr.data = MALLOC(o_constr.datalen * sizeof(LDKC2Tuple_ThirtyTwoBytesThirtyTwoBytesZ), "LDKCVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZ Elements");
28778         else
28779                 o_constr.data = NULL;
28780         uint64_t* o_vals = o->elems;
28781         for (size_t o = 0; o < o_constr.datalen; o++) {
28782                 uint64_t o_conv_40 = o_vals[o];
28783                 void* o_conv_40_ptr = untag_ptr(o_conv_40);
28784                 CHECK_ACCESS(o_conv_40_ptr);
28785                 LDKC2Tuple_ThirtyTwoBytesThirtyTwoBytesZ o_conv_40_conv = *(LDKC2Tuple_ThirtyTwoBytesThirtyTwoBytesZ*)(o_conv_40_ptr);
28786                 o_conv_40_conv = C2Tuple_ThirtyTwoBytesThirtyTwoBytesZ_clone((LDKC2Tuple_ThirtyTwoBytesThirtyTwoBytesZ*)untag_ptr(o_conv_40));
28787                 o_constr.data[o] = o_conv_40_conv;
28788         }
28789         FREE(o);
28790         LDKCResult_CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZProbingErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZProbingErrorZ), "LDKCResult_CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZProbingErrorZ");
28791         *ret_conv = CResult_CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZProbingErrorZ_ok(o_constr);
28792         return tag_ptr(ret_conv, true);
28793 }
28794
28795 uint64_t  __attribute__((export_name("TS_CResult_CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZProbingErrorZ_err"))) TS_CResult_CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZProbingErrorZ_err(uint64_t e) {
28796         void* e_ptr = untag_ptr(e);
28797         CHECK_ACCESS(e_ptr);
28798         LDKProbingError e_conv = *(LDKProbingError*)(e_ptr);
28799         e_conv = ProbingError_clone((LDKProbingError*)untag_ptr(e));
28800         LDKCResult_CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZProbingErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZProbingErrorZ), "LDKCResult_CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZProbingErrorZ");
28801         *ret_conv = CResult_CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZProbingErrorZ_err(e_conv);
28802         return tag_ptr(ret_conv, true);
28803 }
28804
28805 jboolean  __attribute__((export_name("TS_CResult_CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZProbingErrorZ_is_ok"))) TS_CResult_CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZProbingErrorZ_is_ok(uint64_t o) {
28806         LDKCResult_CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZProbingErrorZ* o_conv = (LDKCResult_CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZProbingErrorZ*)untag_ptr(o);
28807         jboolean ret_conv = CResult_CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZProbingErrorZ_is_ok(o_conv);
28808         return ret_conv;
28809 }
28810
28811 void  __attribute__((export_name("TS_CResult_CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZProbingErrorZ_free"))) TS_CResult_CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZProbingErrorZ_free(uint64_t _res) {
28812         if (!ptr_is_owned(_res)) return;
28813         void* _res_ptr = untag_ptr(_res);
28814         CHECK_ACCESS(_res_ptr);
28815         LDKCResult_CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZProbingErrorZ _res_conv = *(LDKCResult_CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZProbingErrorZ*)(_res_ptr);
28816         FREE(untag_ptr(_res));
28817         CResult_CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZProbingErrorZ_free(_res_conv);
28818 }
28819
28820 static inline uint64_t CResult_CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZProbingErrorZ_clone_ptr(LDKCResult_CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZProbingErrorZ *NONNULL_PTR arg) {
28821         LDKCResult_CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZProbingErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZProbingErrorZ), "LDKCResult_CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZProbingErrorZ");
28822         *ret_conv = CResult_CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZProbingErrorZ_clone(arg);
28823         return tag_ptr(ret_conv, true);
28824 }
28825 int64_t  __attribute__((export_name("TS_CResult_CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZProbingErrorZ_clone_ptr"))) TS_CResult_CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZProbingErrorZ_clone_ptr(uint64_t arg) {
28826         LDKCResult_CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZProbingErrorZ* arg_conv = (LDKCResult_CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZProbingErrorZ*)untag_ptr(arg);
28827         int64_t ret_conv = CResult_CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZProbingErrorZ_clone_ptr(arg_conv);
28828         return ret_conv;
28829 }
28830
28831 uint64_t  __attribute__((export_name("TS_CResult_CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZProbingErrorZ_clone"))) TS_CResult_CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZProbingErrorZ_clone(uint64_t orig) {
28832         LDKCResult_CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZProbingErrorZ* orig_conv = (LDKCResult_CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZProbingErrorZ*)untag_ptr(orig);
28833         LDKCResult_CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZProbingErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZProbingErrorZ), "LDKCResult_CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZProbingErrorZ");
28834         *ret_conv = CResult_CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZProbingErrorZ_clone(orig_conv);
28835         return tag_ptr(ret_conv, true);
28836 }
28837
28838 uint64_t  __attribute__((export_name("TS_CResult_StrSecp256k1ErrorZ_ok"))) TS_CResult_StrSecp256k1ErrorZ_ok(jstring o) {
28839         LDKStr o_conv = str_ref_to_owned_c(o);
28840         LDKCResult_StrSecp256k1ErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_StrSecp256k1ErrorZ), "LDKCResult_StrSecp256k1ErrorZ");
28841         *ret_conv = CResult_StrSecp256k1ErrorZ_ok(o_conv);
28842         return tag_ptr(ret_conv, true);
28843 }
28844
28845 uint64_t  __attribute__((export_name("TS_CResult_StrSecp256k1ErrorZ_err"))) TS_CResult_StrSecp256k1ErrorZ_err(uint32_t e) {
28846         LDKSecp256k1Error e_conv = LDKSecp256k1Error_from_js(e);
28847         LDKCResult_StrSecp256k1ErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_StrSecp256k1ErrorZ), "LDKCResult_StrSecp256k1ErrorZ");
28848         *ret_conv = CResult_StrSecp256k1ErrorZ_err(e_conv);
28849         return tag_ptr(ret_conv, true);
28850 }
28851
28852 jboolean  __attribute__((export_name("TS_CResult_StrSecp256k1ErrorZ_is_ok"))) TS_CResult_StrSecp256k1ErrorZ_is_ok(uint64_t o) {
28853         LDKCResult_StrSecp256k1ErrorZ* o_conv = (LDKCResult_StrSecp256k1ErrorZ*)untag_ptr(o);
28854         jboolean ret_conv = CResult_StrSecp256k1ErrorZ_is_ok(o_conv);
28855         return ret_conv;
28856 }
28857
28858 void  __attribute__((export_name("TS_CResult_StrSecp256k1ErrorZ_free"))) TS_CResult_StrSecp256k1ErrorZ_free(uint64_t _res) {
28859         if (!ptr_is_owned(_res)) return;
28860         void* _res_ptr = untag_ptr(_res);
28861         CHECK_ACCESS(_res_ptr);
28862         LDKCResult_StrSecp256k1ErrorZ _res_conv = *(LDKCResult_StrSecp256k1ErrorZ*)(_res_ptr);
28863         FREE(untag_ptr(_res));
28864         CResult_StrSecp256k1ErrorZ_free(_res_conv);
28865 }
28866
28867 static inline uint64_t CResult_StrSecp256k1ErrorZ_clone_ptr(LDKCResult_StrSecp256k1ErrorZ *NONNULL_PTR arg) {
28868         LDKCResult_StrSecp256k1ErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_StrSecp256k1ErrorZ), "LDKCResult_StrSecp256k1ErrorZ");
28869         *ret_conv = CResult_StrSecp256k1ErrorZ_clone(arg);
28870         return tag_ptr(ret_conv, true);
28871 }
28872 int64_t  __attribute__((export_name("TS_CResult_StrSecp256k1ErrorZ_clone_ptr"))) TS_CResult_StrSecp256k1ErrorZ_clone_ptr(uint64_t arg) {
28873         LDKCResult_StrSecp256k1ErrorZ* arg_conv = (LDKCResult_StrSecp256k1ErrorZ*)untag_ptr(arg);
28874         int64_t ret_conv = CResult_StrSecp256k1ErrorZ_clone_ptr(arg_conv);
28875         return ret_conv;
28876 }
28877
28878 uint64_t  __attribute__((export_name("TS_CResult_StrSecp256k1ErrorZ_clone"))) TS_CResult_StrSecp256k1ErrorZ_clone(uint64_t orig) {
28879         LDKCResult_StrSecp256k1ErrorZ* orig_conv = (LDKCResult_StrSecp256k1ErrorZ*)untag_ptr(orig);
28880         LDKCResult_StrSecp256k1ErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_StrSecp256k1ErrorZ), "LDKCResult_StrSecp256k1ErrorZ");
28881         *ret_conv = CResult_StrSecp256k1ErrorZ_clone(orig_conv);
28882         return tag_ptr(ret_conv, true);
28883 }
28884
28885 uint64_t  __attribute__((export_name("TS_CResult_TxOutUtxoLookupErrorZ_ok"))) TS_CResult_TxOutUtxoLookupErrorZ_ok(uint64_t o) {
28886         void* o_ptr = untag_ptr(o);
28887         CHECK_ACCESS(o_ptr);
28888         LDKTxOut o_conv = *(LDKTxOut*)(o_ptr);
28889         o_conv = TxOut_clone((LDKTxOut*)untag_ptr(o));
28890         LDKCResult_TxOutUtxoLookupErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TxOutUtxoLookupErrorZ), "LDKCResult_TxOutUtxoLookupErrorZ");
28891         *ret_conv = CResult_TxOutUtxoLookupErrorZ_ok(o_conv);
28892         return tag_ptr(ret_conv, true);
28893 }
28894
28895 uint64_t  __attribute__((export_name("TS_CResult_TxOutUtxoLookupErrorZ_err"))) TS_CResult_TxOutUtxoLookupErrorZ_err(uint32_t e) {
28896         LDKUtxoLookupError e_conv = LDKUtxoLookupError_from_js(e);
28897         LDKCResult_TxOutUtxoLookupErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TxOutUtxoLookupErrorZ), "LDKCResult_TxOutUtxoLookupErrorZ");
28898         *ret_conv = CResult_TxOutUtxoLookupErrorZ_err(e_conv);
28899         return tag_ptr(ret_conv, true);
28900 }
28901
28902 jboolean  __attribute__((export_name("TS_CResult_TxOutUtxoLookupErrorZ_is_ok"))) TS_CResult_TxOutUtxoLookupErrorZ_is_ok(uint64_t o) {
28903         LDKCResult_TxOutUtxoLookupErrorZ* o_conv = (LDKCResult_TxOutUtxoLookupErrorZ*)untag_ptr(o);
28904         jboolean ret_conv = CResult_TxOutUtxoLookupErrorZ_is_ok(o_conv);
28905         return ret_conv;
28906 }
28907
28908 void  __attribute__((export_name("TS_CResult_TxOutUtxoLookupErrorZ_free"))) TS_CResult_TxOutUtxoLookupErrorZ_free(uint64_t _res) {
28909         if (!ptr_is_owned(_res)) return;
28910         void* _res_ptr = untag_ptr(_res);
28911         CHECK_ACCESS(_res_ptr);
28912         LDKCResult_TxOutUtxoLookupErrorZ _res_conv = *(LDKCResult_TxOutUtxoLookupErrorZ*)(_res_ptr);
28913         FREE(untag_ptr(_res));
28914         CResult_TxOutUtxoLookupErrorZ_free(_res_conv);
28915 }
28916
28917 static inline uint64_t CResult_TxOutUtxoLookupErrorZ_clone_ptr(LDKCResult_TxOutUtxoLookupErrorZ *NONNULL_PTR arg) {
28918         LDKCResult_TxOutUtxoLookupErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TxOutUtxoLookupErrorZ), "LDKCResult_TxOutUtxoLookupErrorZ");
28919         *ret_conv = CResult_TxOutUtxoLookupErrorZ_clone(arg);
28920         return tag_ptr(ret_conv, true);
28921 }
28922 int64_t  __attribute__((export_name("TS_CResult_TxOutUtxoLookupErrorZ_clone_ptr"))) TS_CResult_TxOutUtxoLookupErrorZ_clone_ptr(uint64_t arg) {
28923         LDKCResult_TxOutUtxoLookupErrorZ* arg_conv = (LDKCResult_TxOutUtxoLookupErrorZ*)untag_ptr(arg);
28924         int64_t ret_conv = CResult_TxOutUtxoLookupErrorZ_clone_ptr(arg_conv);
28925         return ret_conv;
28926 }
28927
28928 uint64_t  __attribute__((export_name("TS_CResult_TxOutUtxoLookupErrorZ_clone"))) TS_CResult_TxOutUtxoLookupErrorZ_clone(uint64_t orig) {
28929         LDKCResult_TxOutUtxoLookupErrorZ* orig_conv = (LDKCResult_TxOutUtxoLookupErrorZ*)untag_ptr(orig);
28930         LDKCResult_TxOutUtxoLookupErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TxOutUtxoLookupErrorZ), "LDKCResult_TxOutUtxoLookupErrorZ");
28931         *ret_conv = CResult_TxOutUtxoLookupErrorZ_clone(orig_conv);
28932         return tag_ptr(ret_conv, true);
28933 }
28934
28935 uint64_t  __attribute__((export_name("TS_CResult_OnionMessagePathNoneZ_ok"))) TS_CResult_OnionMessagePathNoneZ_ok(uint64_t o) {
28936         LDKOnionMessagePath o_conv;
28937         o_conv.inner = untag_ptr(o);
28938         o_conv.is_owned = ptr_is_owned(o);
28939         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
28940         o_conv = OnionMessagePath_clone(&o_conv);
28941         LDKCResult_OnionMessagePathNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_OnionMessagePathNoneZ), "LDKCResult_OnionMessagePathNoneZ");
28942         *ret_conv = CResult_OnionMessagePathNoneZ_ok(o_conv);
28943         return tag_ptr(ret_conv, true);
28944 }
28945
28946 uint64_t  __attribute__((export_name("TS_CResult_OnionMessagePathNoneZ_err"))) TS_CResult_OnionMessagePathNoneZ_err() {
28947         LDKCResult_OnionMessagePathNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_OnionMessagePathNoneZ), "LDKCResult_OnionMessagePathNoneZ");
28948         *ret_conv = CResult_OnionMessagePathNoneZ_err();
28949         return tag_ptr(ret_conv, true);
28950 }
28951
28952 jboolean  __attribute__((export_name("TS_CResult_OnionMessagePathNoneZ_is_ok"))) TS_CResult_OnionMessagePathNoneZ_is_ok(uint64_t o) {
28953         LDKCResult_OnionMessagePathNoneZ* o_conv = (LDKCResult_OnionMessagePathNoneZ*)untag_ptr(o);
28954         jboolean ret_conv = CResult_OnionMessagePathNoneZ_is_ok(o_conv);
28955         return ret_conv;
28956 }
28957
28958 void  __attribute__((export_name("TS_CResult_OnionMessagePathNoneZ_free"))) TS_CResult_OnionMessagePathNoneZ_free(uint64_t _res) {
28959         if (!ptr_is_owned(_res)) return;
28960         void* _res_ptr = untag_ptr(_res);
28961         CHECK_ACCESS(_res_ptr);
28962         LDKCResult_OnionMessagePathNoneZ _res_conv = *(LDKCResult_OnionMessagePathNoneZ*)(_res_ptr);
28963         FREE(untag_ptr(_res));
28964         CResult_OnionMessagePathNoneZ_free(_res_conv);
28965 }
28966
28967 static inline uint64_t CResult_OnionMessagePathNoneZ_clone_ptr(LDKCResult_OnionMessagePathNoneZ *NONNULL_PTR arg) {
28968         LDKCResult_OnionMessagePathNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_OnionMessagePathNoneZ), "LDKCResult_OnionMessagePathNoneZ");
28969         *ret_conv = CResult_OnionMessagePathNoneZ_clone(arg);
28970         return tag_ptr(ret_conv, true);
28971 }
28972 int64_t  __attribute__((export_name("TS_CResult_OnionMessagePathNoneZ_clone_ptr"))) TS_CResult_OnionMessagePathNoneZ_clone_ptr(uint64_t arg) {
28973         LDKCResult_OnionMessagePathNoneZ* arg_conv = (LDKCResult_OnionMessagePathNoneZ*)untag_ptr(arg);
28974         int64_t ret_conv = CResult_OnionMessagePathNoneZ_clone_ptr(arg_conv);
28975         return ret_conv;
28976 }
28977
28978 uint64_t  __attribute__((export_name("TS_CResult_OnionMessagePathNoneZ_clone"))) TS_CResult_OnionMessagePathNoneZ_clone(uint64_t orig) {
28979         LDKCResult_OnionMessagePathNoneZ* orig_conv = (LDKCResult_OnionMessagePathNoneZ*)untag_ptr(orig);
28980         LDKCResult_OnionMessagePathNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_OnionMessagePathNoneZ), "LDKCResult_OnionMessagePathNoneZ");
28981         *ret_conv = CResult_OnionMessagePathNoneZ_clone(orig_conv);
28982         return tag_ptr(ret_conv, true);
28983 }
28984
28985 static inline uint64_t C2Tuple_PublicKeyOnionMessageZ_clone_ptr(LDKC2Tuple_PublicKeyOnionMessageZ *NONNULL_PTR arg) {
28986         LDKC2Tuple_PublicKeyOnionMessageZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_PublicKeyOnionMessageZ), "LDKC2Tuple_PublicKeyOnionMessageZ");
28987         *ret_conv = C2Tuple_PublicKeyOnionMessageZ_clone(arg);
28988         return tag_ptr(ret_conv, true);
28989 }
28990 int64_t  __attribute__((export_name("TS_C2Tuple_PublicKeyOnionMessageZ_clone_ptr"))) TS_C2Tuple_PublicKeyOnionMessageZ_clone_ptr(uint64_t arg) {
28991         LDKC2Tuple_PublicKeyOnionMessageZ* arg_conv = (LDKC2Tuple_PublicKeyOnionMessageZ*)untag_ptr(arg);
28992         int64_t ret_conv = C2Tuple_PublicKeyOnionMessageZ_clone_ptr(arg_conv);
28993         return ret_conv;
28994 }
28995
28996 uint64_t  __attribute__((export_name("TS_C2Tuple_PublicKeyOnionMessageZ_clone"))) TS_C2Tuple_PublicKeyOnionMessageZ_clone(uint64_t orig) {
28997         LDKC2Tuple_PublicKeyOnionMessageZ* orig_conv = (LDKC2Tuple_PublicKeyOnionMessageZ*)untag_ptr(orig);
28998         LDKC2Tuple_PublicKeyOnionMessageZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_PublicKeyOnionMessageZ), "LDKC2Tuple_PublicKeyOnionMessageZ");
28999         *ret_conv = C2Tuple_PublicKeyOnionMessageZ_clone(orig_conv);
29000         return tag_ptr(ret_conv, true);
29001 }
29002
29003 uint64_t  __attribute__((export_name("TS_C2Tuple_PublicKeyOnionMessageZ_new"))) TS_C2Tuple_PublicKeyOnionMessageZ_new(int8_tArray a, uint64_t b) {
29004         LDKPublicKey a_ref;
29005         CHECK(a->arr_len == 33);
29006         memcpy(a_ref.compressed_form, a->elems, 33); FREE(a);
29007         LDKOnionMessage b_conv;
29008         b_conv.inner = untag_ptr(b);
29009         b_conv.is_owned = ptr_is_owned(b);
29010         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
29011         b_conv = OnionMessage_clone(&b_conv);
29012         LDKC2Tuple_PublicKeyOnionMessageZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_PublicKeyOnionMessageZ), "LDKC2Tuple_PublicKeyOnionMessageZ");
29013         *ret_conv = C2Tuple_PublicKeyOnionMessageZ_new(a_ref, b_conv);
29014         return tag_ptr(ret_conv, true);
29015 }
29016
29017 void  __attribute__((export_name("TS_C2Tuple_PublicKeyOnionMessageZ_free"))) TS_C2Tuple_PublicKeyOnionMessageZ_free(uint64_t _res) {
29018         if (!ptr_is_owned(_res)) return;
29019         void* _res_ptr = untag_ptr(_res);
29020         CHECK_ACCESS(_res_ptr);
29021         LDKC2Tuple_PublicKeyOnionMessageZ _res_conv = *(LDKC2Tuple_PublicKeyOnionMessageZ*)(_res_ptr);
29022         FREE(untag_ptr(_res));
29023         C2Tuple_PublicKeyOnionMessageZ_free(_res_conv);
29024 }
29025
29026 uint64_t  __attribute__((export_name("TS_CResult_C2Tuple_PublicKeyOnionMessageZSendErrorZ_ok"))) TS_CResult_C2Tuple_PublicKeyOnionMessageZSendErrorZ_ok(uint64_t o) {
29027         void* o_ptr = untag_ptr(o);
29028         CHECK_ACCESS(o_ptr);
29029         LDKC2Tuple_PublicKeyOnionMessageZ o_conv = *(LDKC2Tuple_PublicKeyOnionMessageZ*)(o_ptr);
29030         o_conv = C2Tuple_PublicKeyOnionMessageZ_clone((LDKC2Tuple_PublicKeyOnionMessageZ*)untag_ptr(o));
29031         LDKCResult_C2Tuple_PublicKeyOnionMessageZSendErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_PublicKeyOnionMessageZSendErrorZ), "LDKCResult_C2Tuple_PublicKeyOnionMessageZSendErrorZ");
29032         *ret_conv = CResult_C2Tuple_PublicKeyOnionMessageZSendErrorZ_ok(o_conv);
29033         return tag_ptr(ret_conv, true);
29034 }
29035
29036 uint64_t  __attribute__((export_name("TS_CResult_C2Tuple_PublicKeyOnionMessageZSendErrorZ_err"))) TS_CResult_C2Tuple_PublicKeyOnionMessageZSendErrorZ_err(uint64_t e) {
29037         void* e_ptr = untag_ptr(e);
29038         CHECK_ACCESS(e_ptr);
29039         LDKSendError e_conv = *(LDKSendError*)(e_ptr);
29040         e_conv = SendError_clone((LDKSendError*)untag_ptr(e));
29041         LDKCResult_C2Tuple_PublicKeyOnionMessageZSendErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_PublicKeyOnionMessageZSendErrorZ), "LDKCResult_C2Tuple_PublicKeyOnionMessageZSendErrorZ");
29042         *ret_conv = CResult_C2Tuple_PublicKeyOnionMessageZSendErrorZ_err(e_conv);
29043         return tag_ptr(ret_conv, true);
29044 }
29045
29046 jboolean  __attribute__((export_name("TS_CResult_C2Tuple_PublicKeyOnionMessageZSendErrorZ_is_ok"))) TS_CResult_C2Tuple_PublicKeyOnionMessageZSendErrorZ_is_ok(uint64_t o) {
29047         LDKCResult_C2Tuple_PublicKeyOnionMessageZSendErrorZ* o_conv = (LDKCResult_C2Tuple_PublicKeyOnionMessageZSendErrorZ*)untag_ptr(o);
29048         jboolean ret_conv = CResult_C2Tuple_PublicKeyOnionMessageZSendErrorZ_is_ok(o_conv);
29049         return ret_conv;
29050 }
29051
29052 void  __attribute__((export_name("TS_CResult_C2Tuple_PublicKeyOnionMessageZSendErrorZ_free"))) TS_CResult_C2Tuple_PublicKeyOnionMessageZSendErrorZ_free(uint64_t _res) {
29053         if (!ptr_is_owned(_res)) return;
29054         void* _res_ptr = untag_ptr(_res);
29055         CHECK_ACCESS(_res_ptr);
29056         LDKCResult_C2Tuple_PublicKeyOnionMessageZSendErrorZ _res_conv = *(LDKCResult_C2Tuple_PublicKeyOnionMessageZSendErrorZ*)(_res_ptr);
29057         FREE(untag_ptr(_res));
29058         CResult_C2Tuple_PublicKeyOnionMessageZSendErrorZ_free(_res_conv);
29059 }
29060
29061 uint64_t  __attribute__((export_name("TS_CResult_PeeledOnionNoneZ_ok"))) TS_CResult_PeeledOnionNoneZ_ok(uint64_t o) {
29062         void* o_ptr = untag_ptr(o);
29063         CHECK_ACCESS(o_ptr);
29064         LDKPeeledOnion o_conv = *(LDKPeeledOnion*)(o_ptr);
29065         o_conv = PeeledOnion_clone((LDKPeeledOnion*)untag_ptr(o));
29066         LDKCResult_PeeledOnionNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_PeeledOnionNoneZ), "LDKCResult_PeeledOnionNoneZ");
29067         *ret_conv = CResult_PeeledOnionNoneZ_ok(o_conv);
29068         return tag_ptr(ret_conv, true);
29069 }
29070
29071 uint64_t  __attribute__((export_name("TS_CResult_PeeledOnionNoneZ_err"))) TS_CResult_PeeledOnionNoneZ_err() {
29072         LDKCResult_PeeledOnionNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_PeeledOnionNoneZ), "LDKCResult_PeeledOnionNoneZ");
29073         *ret_conv = CResult_PeeledOnionNoneZ_err();
29074         return tag_ptr(ret_conv, true);
29075 }
29076
29077 jboolean  __attribute__((export_name("TS_CResult_PeeledOnionNoneZ_is_ok"))) TS_CResult_PeeledOnionNoneZ_is_ok(uint64_t o) {
29078         LDKCResult_PeeledOnionNoneZ* o_conv = (LDKCResult_PeeledOnionNoneZ*)untag_ptr(o);
29079         jboolean ret_conv = CResult_PeeledOnionNoneZ_is_ok(o_conv);
29080         return ret_conv;
29081 }
29082
29083 void  __attribute__((export_name("TS_CResult_PeeledOnionNoneZ_free"))) TS_CResult_PeeledOnionNoneZ_free(uint64_t _res) {
29084         if (!ptr_is_owned(_res)) return;
29085         void* _res_ptr = untag_ptr(_res);
29086         CHECK_ACCESS(_res_ptr);
29087         LDKCResult_PeeledOnionNoneZ _res_conv = *(LDKCResult_PeeledOnionNoneZ*)(_res_ptr);
29088         FREE(untag_ptr(_res));
29089         CResult_PeeledOnionNoneZ_free(_res_conv);
29090 }
29091
29092 uint64_t  __attribute__((export_name("TS_CResult_NoneSendErrorZ_ok"))) TS_CResult_NoneSendErrorZ_ok() {
29093         LDKCResult_NoneSendErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneSendErrorZ), "LDKCResult_NoneSendErrorZ");
29094         *ret_conv = CResult_NoneSendErrorZ_ok();
29095         return tag_ptr(ret_conv, true);
29096 }
29097
29098 uint64_t  __attribute__((export_name("TS_CResult_NoneSendErrorZ_err"))) TS_CResult_NoneSendErrorZ_err(uint64_t e) {
29099         void* e_ptr = untag_ptr(e);
29100         CHECK_ACCESS(e_ptr);
29101         LDKSendError e_conv = *(LDKSendError*)(e_ptr);
29102         e_conv = SendError_clone((LDKSendError*)untag_ptr(e));
29103         LDKCResult_NoneSendErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneSendErrorZ), "LDKCResult_NoneSendErrorZ");
29104         *ret_conv = CResult_NoneSendErrorZ_err(e_conv);
29105         return tag_ptr(ret_conv, true);
29106 }
29107
29108 jboolean  __attribute__((export_name("TS_CResult_NoneSendErrorZ_is_ok"))) TS_CResult_NoneSendErrorZ_is_ok(uint64_t o) {
29109         LDKCResult_NoneSendErrorZ* o_conv = (LDKCResult_NoneSendErrorZ*)untag_ptr(o);
29110         jboolean ret_conv = CResult_NoneSendErrorZ_is_ok(o_conv);
29111         return ret_conv;
29112 }
29113
29114 void  __attribute__((export_name("TS_CResult_NoneSendErrorZ_free"))) TS_CResult_NoneSendErrorZ_free(uint64_t _res) {
29115         if (!ptr_is_owned(_res)) return;
29116         void* _res_ptr = untag_ptr(_res);
29117         CHECK_ACCESS(_res_ptr);
29118         LDKCResult_NoneSendErrorZ _res_conv = *(LDKCResult_NoneSendErrorZ*)(_res_ptr);
29119         FREE(untag_ptr(_res));
29120         CResult_NoneSendErrorZ_free(_res_conv);
29121 }
29122
29123 uint64_t  __attribute__((export_name("TS_CResult_BlindedPathNoneZ_ok"))) TS_CResult_BlindedPathNoneZ_ok(uint64_t o) {
29124         LDKBlindedPath o_conv;
29125         o_conv.inner = untag_ptr(o);
29126         o_conv.is_owned = ptr_is_owned(o);
29127         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
29128         o_conv = BlindedPath_clone(&o_conv);
29129         LDKCResult_BlindedPathNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_BlindedPathNoneZ), "LDKCResult_BlindedPathNoneZ");
29130         *ret_conv = CResult_BlindedPathNoneZ_ok(o_conv);
29131         return tag_ptr(ret_conv, true);
29132 }
29133
29134 uint64_t  __attribute__((export_name("TS_CResult_BlindedPathNoneZ_err"))) TS_CResult_BlindedPathNoneZ_err() {
29135         LDKCResult_BlindedPathNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_BlindedPathNoneZ), "LDKCResult_BlindedPathNoneZ");
29136         *ret_conv = CResult_BlindedPathNoneZ_err();
29137         return tag_ptr(ret_conv, true);
29138 }
29139
29140 jboolean  __attribute__((export_name("TS_CResult_BlindedPathNoneZ_is_ok"))) TS_CResult_BlindedPathNoneZ_is_ok(uint64_t o) {
29141         LDKCResult_BlindedPathNoneZ* o_conv = (LDKCResult_BlindedPathNoneZ*)untag_ptr(o);
29142         jboolean ret_conv = CResult_BlindedPathNoneZ_is_ok(o_conv);
29143         return ret_conv;
29144 }
29145
29146 void  __attribute__((export_name("TS_CResult_BlindedPathNoneZ_free"))) TS_CResult_BlindedPathNoneZ_free(uint64_t _res) {
29147         if (!ptr_is_owned(_res)) return;
29148         void* _res_ptr = untag_ptr(_res);
29149         CHECK_ACCESS(_res_ptr);
29150         LDKCResult_BlindedPathNoneZ _res_conv = *(LDKCResult_BlindedPathNoneZ*)(_res_ptr);
29151         FREE(untag_ptr(_res));
29152         CResult_BlindedPathNoneZ_free(_res_conv);
29153 }
29154
29155 static inline uint64_t CResult_BlindedPathNoneZ_clone_ptr(LDKCResult_BlindedPathNoneZ *NONNULL_PTR arg) {
29156         LDKCResult_BlindedPathNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_BlindedPathNoneZ), "LDKCResult_BlindedPathNoneZ");
29157         *ret_conv = CResult_BlindedPathNoneZ_clone(arg);
29158         return tag_ptr(ret_conv, true);
29159 }
29160 int64_t  __attribute__((export_name("TS_CResult_BlindedPathNoneZ_clone_ptr"))) TS_CResult_BlindedPathNoneZ_clone_ptr(uint64_t arg) {
29161         LDKCResult_BlindedPathNoneZ* arg_conv = (LDKCResult_BlindedPathNoneZ*)untag_ptr(arg);
29162         int64_t ret_conv = CResult_BlindedPathNoneZ_clone_ptr(arg_conv);
29163         return ret_conv;
29164 }
29165
29166 uint64_t  __attribute__((export_name("TS_CResult_BlindedPathNoneZ_clone"))) TS_CResult_BlindedPathNoneZ_clone(uint64_t orig) {
29167         LDKCResult_BlindedPathNoneZ* orig_conv = (LDKCResult_BlindedPathNoneZ*)untag_ptr(orig);
29168         LDKCResult_BlindedPathNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_BlindedPathNoneZ), "LDKCResult_BlindedPathNoneZ");
29169         *ret_conv = CResult_BlindedPathNoneZ_clone(orig_conv);
29170         return tag_ptr(ret_conv, true);
29171 }
29172
29173 uint64_t  __attribute__((export_name("TS_CResult_C2Tuple_BlindedPayInfoBlindedPathZNoneZ_ok"))) TS_CResult_C2Tuple_BlindedPayInfoBlindedPathZNoneZ_ok(uint64_t o) {
29174         void* o_ptr = untag_ptr(o);
29175         CHECK_ACCESS(o_ptr);
29176         LDKC2Tuple_BlindedPayInfoBlindedPathZ o_conv = *(LDKC2Tuple_BlindedPayInfoBlindedPathZ*)(o_ptr);
29177         o_conv = C2Tuple_BlindedPayInfoBlindedPathZ_clone((LDKC2Tuple_BlindedPayInfoBlindedPathZ*)untag_ptr(o));
29178         LDKCResult_C2Tuple_BlindedPayInfoBlindedPathZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_BlindedPayInfoBlindedPathZNoneZ), "LDKCResult_C2Tuple_BlindedPayInfoBlindedPathZNoneZ");
29179         *ret_conv = CResult_C2Tuple_BlindedPayInfoBlindedPathZNoneZ_ok(o_conv);
29180         return tag_ptr(ret_conv, true);
29181 }
29182
29183 uint64_t  __attribute__((export_name("TS_CResult_C2Tuple_BlindedPayInfoBlindedPathZNoneZ_err"))) TS_CResult_C2Tuple_BlindedPayInfoBlindedPathZNoneZ_err() {
29184         LDKCResult_C2Tuple_BlindedPayInfoBlindedPathZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_BlindedPayInfoBlindedPathZNoneZ), "LDKCResult_C2Tuple_BlindedPayInfoBlindedPathZNoneZ");
29185         *ret_conv = CResult_C2Tuple_BlindedPayInfoBlindedPathZNoneZ_err();
29186         return tag_ptr(ret_conv, true);
29187 }
29188
29189 jboolean  __attribute__((export_name("TS_CResult_C2Tuple_BlindedPayInfoBlindedPathZNoneZ_is_ok"))) TS_CResult_C2Tuple_BlindedPayInfoBlindedPathZNoneZ_is_ok(uint64_t o) {
29190         LDKCResult_C2Tuple_BlindedPayInfoBlindedPathZNoneZ* o_conv = (LDKCResult_C2Tuple_BlindedPayInfoBlindedPathZNoneZ*)untag_ptr(o);
29191         jboolean ret_conv = CResult_C2Tuple_BlindedPayInfoBlindedPathZNoneZ_is_ok(o_conv);
29192         return ret_conv;
29193 }
29194
29195 void  __attribute__((export_name("TS_CResult_C2Tuple_BlindedPayInfoBlindedPathZNoneZ_free"))) TS_CResult_C2Tuple_BlindedPayInfoBlindedPathZNoneZ_free(uint64_t _res) {
29196         if (!ptr_is_owned(_res)) return;
29197         void* _res_ptr = untag_ptr(_res);
29198         CHECK_ACCESS(_res_ptr);
29199         LDKCResult_C2Tuple_BlindedPayInfoBlindedPathZNoneZ _res_conv = *(LDKCResult_C2Tuple_BlindedPayInfoBlindedPathZNoneZ*)(_res_ptr);
29200         FREE(untag_ptr(_res));
29201         CResult_C2Tuple_BlindedPayInfoBlindedPathZNoneZ_free(_res_conv);
29202 }
29203
29204 static inline uint64_t CResult_C2Tuple_BlindedPayInfoBlindedPathZNoneZ_clone_ptr(LDKCResult_C2Tuple_BlindedPayInfoBlindedPathZNoneZ *NONNULL_PTR arg) {
29205         LDKCResult_C2Tuple_BlindedPayInfoBlindedPathZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_BlindedPayInfoBlindedPathZNoneZ), "LDKCResult_C2Tuple_BlindedPayInfoBlindedPathZNoneZ");
29206         *ret_conv = CResult_C2Tuple_BlindedPayInfoBlindedPathZNoneZ_clone(arg);
29207         return tag_ptr(ret_conv, true);
29208 }
29209 int64_t  __attribute__((export_name("TS_CResult_C2Tuple_BlindedPayInfoBlindedPathZNoneZ_clone_ptr"))) TS_CResult_C2Tuple_BlindedPayInfoBlindedPathZNoneZ_clone_ptr(uint64_t arg) {
29210         LDKCResult_C2Tuple_BlindedPayInfoBlindedPathZNoneZ* arg_conv = (LDKCResult_C2Tuple_BlindedPayInfoBlindedPathZNoneZ*)untag_ptr(arg);
29211         int64_t ret_conv = CResult_C2Tuple_BlindedPayInfoBlindedPathZNoneZ_clone_ptr(arg_conv);
29212         return ret_conv;
29213 }
29214
29215 uint64_t  __attribute__((export_name("TS_CResult_C2Tuple_BlindedPayInfoBlindedPathZNoneZ_clone"))) TS_CResult_C2Tuple_BlindedPayInfoBlindedPathZNoneZ_clone(uint64_t orig) {
29216         LDKCResult_C2Tuple_BlindedPayInfoBlindedPathZNoneZ* orig_conv = (LDKCResult_C2Tuple_BlindedPayInfoBlindedPathZNoneZ*)untag_ptr(orig);
29217         LDKCResult_C2Tuple_BlindedPayInfoBlindedPathZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_BlindedPayInfoBlindedPathZNoneZ), "LDKCResult_C2Tuple_BlindedPayInfoBlindedPathZNoneZ");
29218         *ret_conv = CResult_C2Tuple_BlindedPayInfoBlindedPathZNoneZ_clone(orig_conv);
29219         return tag_ptr(ret_conv, true);
29220 }
29221
29222 uint64_t  __attribute__((export_name("TS_CResult_BlindedPathDecodeErrorZ_ok"))) TS_CResult_BlindedPathDecodeErrorZ_ok(uint64_t o) {
29223         LDKBlindedPath o_conv;
29224         o_conv.inner = untag_ptr(o);
29225         o_conv.is_owned = ptr_is_owned(o);
29226         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
29227         o_conv = BlindedPath_clone(&o_conv);
29228         LDKCResult_BlindedPathDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_BlindedPathDecodeErrorZ), "LDKCResult_BlindedPathDecodeErrorZ");
29229         *ret_conv = CResult_BlindedPathDecodeErrorZ_ok(o_conv);
29230         return tag_ptr(ret_conv, true);
29231 }
29232
29233 uint64_t  __attribute__((export_name("TS_CResult_BlindedPathDecodeErrorZ_err"))) TS_CResult_BlindedPathDecodeErrorZ_err(uint64_t e) {
29234         void* e_ptr = untag_ptr(e);
29235         CHECK_ACCESS(e_ptr);
29236         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
29237         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
29238         LDKCResult_BlindedPathDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_BlindedPathDecodeErrorZ), "LDKCResult_BlindedPathDecodeErrorZ");
29239         *ret_conv = CResult_BlindedPathDecodeErrorZ_err(e_conv);
29240         return tag_ptr(ret_conv, true);
29241 }
29242
29243 jboolean  __attribute__((export_name("TS_CResult_BlindedPathDecodeErrorZ_is_ok"))) TS_CResult_BlindedPathDecodeErrorZ_is_ok(uint64_t o) {
29244         LDKCResult_BlindedPathDecodeErrorZ* o_conv = (LDKCResult_BlindedPathDecodeErrorZ*)untag_ptr(o);
29245         jboolean ret_conv = CResult_BlindedPathDecodeErrorZ_is_ok(o_conv);
29246         return ret_conv;
29247 }
29248
29249 void  __attribute__((export_name("TS_CResult_BlindedPathDecodeErrorZ_free"))) TS_CResult_BlindedPathDecodeErrorZ_free(uint64_t _res) {
29250         if (!ptr_is_owned(_res)) return;
29251         void* _res_ptr = untag_ptr(_res);
29252         CHECK_ACCESS(_res_ptr);
29253         LDKCResult_BlindedPathDecodeErrorZ _res_conv = *(LDKCResult_BlindedPathDecodeErrorZ*)(_res_ptr);
29254         FREE(untag_ptr(_res));
29255         CResult_BlindedPathDecodeErrorZ_free(_res_conv);
29256 }
29257
29258 static inline uint64_t CResult_BlindedPathDecodeErrorZ_clone_ptr(LDKCResult_BlindedPathDecodeErrorZ *NONNULL_PTR arg) {
29259         LDKCResult_BlindedPathDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_BlindedPathDecodeErrorZ), "LDKCResult_BlindedPathDecodeErrorZ");
29260         *ret_conv = CResult_BlindedPathDecodeErrorZ_clone(arg);
29261         return tag_ptr(ret_conv, true);
29262 }
29263 int64_t  __attribute__((export_name("TS_CResult_BlindedPathDecodeErrorZ_clone_ptr"))) TS_CResult_BlindedPathDecodeErrorZ_clone_ptr(uint64_t arg) {
29264         LDKCResult_BlindedPathDecodeErrorZ* arg_conv = (LDKCResult_BlindedPathDecodeErrorZ*)untag_ptr(arg);
29265         int64_t ret_conv = CResult_BlindedPathDecodeErrorZ_clone_ptr(arg_conv);
29266         return ret_conv;
29267 }
29268
29269 uint64_t  __attribute__((export_name("TS_CResult_BlindedPathDecodeErrorZ_clone"))) TS_CResult_BlindedPathDecodeErrorZ_clone(uint64_t orig) {
29270         LDKCResult_BlindedPathDecodeErrorZ* orig_conv = (LDKCResult_BlindedPathDecodeErrorZ*)untag_ptr(orig);
29271         LDKCResult_BlindedPathDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_BlindedPathDecodeErrorZ), "LDKCResult_BlindedPathDecodeErrorZ");
29272         *ret_conv = CResult_BlindedPathDecodeErrorZ_clone(orig_conv);
29273         return tag_ptr(ret_conv, true);
29274 }
29275
29276 uint64_t  __attribute__((export_name("TS_CResult_BlindedHopDecodeErrorZ_ok"))) TS_CResult_BlindedHopDecodeErrorZ_ok(uint64_t o) {
29277         LDKBlindedHop o_conv;
29278         o_conv.inner = untag_ptr(o);
29279         o_conv.is_owned = ptr_is_owned(o);
29280         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
29281         o_conv = BlindedHop_clone(&o_conv);
29282         LDKCResult_BlindedHopDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_BlindedHopDecodeErrorZ), "LDKCResult_BlindedHopDecodeErrorZ");
29283         *ret_conv = CResult_BlindedHopDecodeErrorZ_ok(o_conv);
29284         return tag_ptr(ret_conv, true);
29285 }
29286
29287 uint64_t  __attribute__((export_name("TS_CResult_BlindedHopDecodeErrorZ_err"))) TS_CResult_BlindedHopDecodeErrorZ_err(uint64_t e) {
29288         void* e_ptr = untag_ptr(e);
29289         CHECK_ACCESS(e_ptr);
29290         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
29291         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
29292         LDKCResult_BlindedHopDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_BlindedHopDecodeErrorZ), "LDKCResult_BlindedHopDecodeErrorZ");
29293         *ret_conv = CResult_BlindedHopDecodeErrorZ_err(e_conv);
29294         return tag_ptr(ret_conv, true);
29295 }
29296
29297 jboolean  __attribute__((export_name("TS_CResult_BlindedHopDecodeErrorZ_is_ok"))) TS_CResult_BlindedHopDecodeErrorZ_is_ok(uint64_t o) {
29298         LDKCResult_BlindedHopDecodeErrorZ* o_conv = (LDKCResult_BlindedHopDecodeErrorZ*)untag_ptr(o);
29299         jboolean ret_conv = CResult_BlindedHopDecodeErrorZ_is_ok(o_conv);
29300         return ret_conv;
29301 }
29302
29303 void  __attribute__((export_name("TS_CResult_BlindedHopDecodeErrorZ_free"))) TS_CResult_BlindedHopDecodeErrorZ_free(uint64_t _res) {
29304         if (!ptr_is_owned(_res)) return;
29305         void* _res_ptr = untag_ptr(_res);
29306         CHECK_ACCESS(_res_ptr);
29307         LDKCResult_BlindedHopDecodeErrorZ _res_conv = *(LDKCResult_BlindedHopDecodeErrorZ*)(_res_ptr);
29308         FREE(untag_ptr(_res));
29309         CResult_BlindedHopDecodeErrorZ_free(_res_conv);
29310 }
29311
29312 static inline uint64_t CResult_BlindedHopDecodeErrorZ_clone_ptr(LDKCResult_BlindedHopDecodeErrorZ *NONNULL_PTR arg) {
29313         LDKCResult_BlindedHopDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_BlindedHopDecodeErrorZ), "LDKCResult_BlindedHopDecodeErrorZ");
29314         *ret_conv = CResult_BlindedHopDecodeErrorZ_clone(arg);
29315         return tag_ptr(ret_conv, true);
29316 }
29317 int64_t  __attribute__((export_name("TS_CResult_BlindedHopDecodeErrorZ_clone_ptr"))) TS_CResult_BlindedHopDecodeErrorZ_clone_ptr(uint64_t arg) {
29318         LDKCResult_BlindedHopDecodeErrorZ* arg_conv = (LDKCResult_BlindedHopDecodeErrorZ*)untag_ptr(arg);
29319         int64_t ret_conv = CResult_BlindedHopDecodeErrorZ_clone_ptr(arg_conv);
29320         return ret_conv;
29321 }
29322
29323 uint64_t  __attribute__((export_name("TS_CResult_BlindedHopDecodeErrorZ_clone"))) TS_CResult_BlindedHopDecodeErrorZ_clone(uint64_t orig) {
29324         LDKCResult_BlindedHopDecodeErrorZ* orig_conv = (LDKCResult_BlindedHopDecodeErrorZ*)untag_ptr(orig);
29325         LDKCResult_BlindedHopDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_BlindedHopDecodeErrorZ), "LDKCResult_BlindedHopDecodeErrorZ");
29326         *ret_conv = CResult_BlindedHopDecodeErrorZ_clone(orig_conv);
29327         return tag_ptr(ret_conv, true);
29328 }
29329
29330 uint64_t  __attribute__((export_name("TS_CResult_InvoiceErrorDecodeErrorZ_ok"))) TS_CResult_InvoiceErrorDecodeErrorZ_ok(uint64_t o) {
29331         LDKInvoiceError o_conv;
29332         o_conv.inner = untag_ptr(o);
29333         o_conv.is_owned = ptr_is_owned(o);
29334         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
29335         o_conv = InvoiceError_clone(&o_conv);
29336         LDKCResult_InvoiceErrorDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InvoiceErrorDecodeErrorZ), "LDKCResult_InvoiceErrorDecodeErrorZ");
29337         *ret_conv = CResult_InvoiceErrorDecodeErrorZ_ok(o_conv);
29338         return tag_ptr(ret_conv, true);
29339 }
29340
29341 uint64_t  __attribute__((export_name("TS_CResult_InvoiceErrorDecodeErrorZ_err"))) TS_CResult_InvoiceErrorDecodeErrorZ_err(uint64_t e) {
29342         void* e_ptr = untag_ptr(e);
29343         CHECK_ACCESS(e_ptr);
29344         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
29345         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
29346         LDKCResult_InvoiceErrorDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InvoiceErrorDecodeErrorZ), "LDKCResult_InvoiceErrorDecodeErrorZ");
29347         *ret_conv = CResult_InvoiceErrorDecodeErrorZ_err(e_conv);
29348         return tag_ptr(ret_conv, true);
29349 }
29350
29351 jboolean  __attribute__((export_name("TS_CResult_InvoiceErrorDecodeErrorZ_is_ok"))) TS_CResult_InvoiceErrorDecodeErrorZ_is_ok(uint64_t o) {
29352         LDKCResult_InvoiceErrorDecodeErrorZ* o_conv = (LDKCResult_InvoiceErrorDecodeErrorZ*)untag_ptr(o);
29353         jboolean ret_conv = CResult_InvoiceErrorDecodeErrorZ_is_ok(o_conv);
29354         return ret_conv;
29355 }
29356
29357 void  __attribute__((export_name("TS_CResult_InvoiceErrorDecodeErrorZ_free"))) TS_CResult_InvoiceErrorDecodeErrorZ_free(uint64_t _res) {
29358         if (!ptr_is_owned(_res)) return;
29359         void* _res_ptr = untag_ptr(_res);
29360         CHECK_ACCESS(_res_ptr);
29361         LDKCResult_InvoiceErrorDecodeErrorZ _res_conv = *(LDKCResult_InvoiceErrorDecodeErrorZ*)(_res_ptr);
29362         FREE(untag_ptr(_res));
29363         CResult_InvoiceErrorDecodeErrorZ_free(_res_conv);
29364 }
29365
29366 static inline uint64_t CResult_InvoiceErrorDecodeErrorZ_clone_ptr(LDKCResult_InvoiceErrorDecodeErrorZ *NONNULL_PTR arg) {
29367         LDKCResult_InvoiceErrorDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InvoiceErrorDecodeErrorZ), "LDKCResult_InvoiceErrorDecodeErrorZ");
29368         *ret_conv = CResult_InvoiceErrorDecodeErrorZ_clone(arg);
29369         return tag_ptr(ret_conv, true);
29370 }
29371 int64_t  __attribute__((export_name("TS_CResult_InvoiceErrorDecodeErrorZ_clone_ptr"))) TS_CResult_InvoiceErrorDecodeErrorZ_clone_ptr(uint64_t arg) {
29372         LDKCResult_InvoiceErrorDecodeErrorZ* arg_conv = (LDKCResult_InvoiceErrorDecodeErrorZ*)untag_ptr(arg);
29373         int64_t ret_conv = CResult_InvoiceErrorDecodeErrorZ_clone_ptr(arg_conv);
29374         return ret_conv;
29375 }
29376
29377 uint64_t  __attribute__((export_name("TS_CResult_InvoiceErrorDecodeErrorZ_clone"))) TS_CResult_InvoiceErrorDecodeErrorZ_clone(uint64_t orig) {
29378         LDKCResult_InvoiceErrorDecodeErrorZ* orig_conv = (LDKCResult_InvoiceErrorDecodeErrorZ*)untag_ptr(orig);
29379         LDKCResult_InvoiceErrorDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InvoiceErrorDecodeErrorZ), "LDKCResult_InvoiceErrorDecodeErrorZ");
29380         *ret_conv = CResult_InvoiceErrorDecodeErrorZ_clone(orig_conv);
29381         return tag_ptr(ret_conv, true);
29382 }
29383
29384 uint64_t  __attribute__((export_name("TS_COption_FilterZ_some"))) TS_COption_FilterZ_some(uint64_t o) {
29385         void* o_ptr = untag_ptr(o);
29386         CHECK_ACCESS(o_ptr);
29387         LDKFilter o_conv = *(LDKFilter*)(o_ptr);
29388         if (o_conv.free == LDKFilter_JCalls_free) {
29389                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
29390                 LDKFilter_JCalls_cloned(&o_conv);
29391         }
29392         LDKCOption_FilterZ *ret_copy = MALLOC(sizeof(LDKCOption_FilterZ), "LDKCOption_FilterZ");
29393         *ret_copy = COption_FilterZ_some(o_conv);
29394         uint64_t ret_ref = tag_ptr(ret_copy, true);
29395         return ret_ref;
29396 }
29397
29398 uint64_t  __attribute__((export_name("TS_COption_FilterZ_none"))) TS_COption_FilterZ_none() {
29399         LDKCOption_FilterZ *ret_copy = MALLOC(sizeof(LDKCOption_FilterZ), "LDKCOption_FilterZ");
29400         *ret_copy = COption_FilterZ_none();
29401         uint64_t ret_ref = tag_ptr(ret_copy, true);
29402         return ret_ref;
29403 }
29404
29405 void  __attribute__((export_name("TS_COption_FilterZ_free"))) TS_COption_FilterZ_free(uint64_t _res) {
29406         if (!ptr_is_owned(_res)) return;
29407         void* _res_ptr = untag_ptr(_res);
29408         CHECK_ACCESS(_res_ptr);
29409         LDKCOption_FilterZ _res_conv = *(LDKCOption_FilterZ*)(_res_ptr);
29410         FREE(untag_ptr(_res));
29411         COption_FilterZ_free(_res_conv);
29412 }
29413
29414 uint64_t  __attribute__((export_name("TS_CResult_LockedChannelMonitorNoneZ_ok"))) TS_CResult_LockedChannelMonitorNoneZ_ok(uint64_t o) {
29415         LDKLockedChannelMonitor o_conv;
29416         o_conv.inner = untag_ptr(o);
29417         o_conv.is_owned = ptr_is_owned(o);
29418         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
29419         // WARNING: we need a move here but no clone is available for LDKLockedChannelMonitor
29420         
29421         LDKCResult_LockedChannelMonitorNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_LockedChannelMonitorNoneZ), "LDKCResult_LockedChannelMonitorNoneZ");
29422         *ret_conv = CResult_LockedChannelMonitorNoneZ_ok(o_conv);
29423         return tag_ptr(ret_conv, true);
29424 }
29425
29426 uint64_t  __attribute__((export_name("TS_CResult_LockedChannelMonitorNoneZ_err"))) TS_CResult_LockedChannelMonitorNoneZ_err() {
29427         LDKCResult_LockedChannelMonitorNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_LockedChannelMonitorNoneZ), "LDKCResult_LockedChannelMonitorNoneZ");
29428         *ret_conv = CResult_LockedChannelMonitorNoneZ_err();
29429         return tag_ptr(ret_conv, true);
29430 }
29431
29432 jboolean  __attribute__((export_name("TS_CResult_LockedChannelMonitorNoneZ_is_ok"))) TS_CResult_LockedChannelMonitorNoneZ_is_ok(uint64_t o) {
29433         LDKCResult_LockedChannelMonitorNoneZ* o_conv = (LDKCResult_LockedChannelMonitorNoneZ*)untag_ptr(o);
29434         jboolean ret_conv = CResult_LockedChannelMonitorNoneZ_is_ok(o_conv);
29435         return ret_conv;
29436 }
29437
29438 void  __attribute__((export_name("TS_CResult_LockedChannelMonitorNoneZ_free"))) TS_CResult_LockedChannelMonitorNoneZ_free(uint64_t _res) {
29439         if (!ptr_is_owned(_res)) return;
29440         void* _res_ptr = untag_ptr(_res);
29441         CHECK_ACCESS(_res_ptr);
29442         LDKCResult_LockedChannelMonitorNoneZ _res_conv = *(LDKCResult_LockedChannelMonitorNoneZ*)(_res_ptr);
29443         FREE(untag_ptr(_res));
29444         CResult_LockedChannelMonitorNoneZ_free(_res_conv);
29445 }
29446
29447 void  __attribute__((export_name("TS_CVec_OutPointZ_free"))) TS_CVec_OutPointZ_free(uint64_tArray _res) {
29448         LDKCVec_OutPointZ _res_constr;
29449         _res_constr.datalen = _res->arr_len;
29450         if (_res_constr.datalen > 0)
29451                 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKOutPoint), "LDKCVec_OutPointZ Elements");
29452         else
29453                 _res_constr.data = NULL;
29454         uint64_t* _res_vals = _res->elems;
29455         for (size_t k = 0; k < _res_constr.datalen; k++) {
29456                 uint64_t _res_conv_10 = _res_vals[k];
29457                 LDKOutPoint _res_conv_10_conv;
29458                 _res_conv_10_conv.inner = untag_ptr(_res_conv_10);
29459                 _res_conv_10_conv.is_owned = ptr_is_owned(_res_conv_10);
29460                 CHECK_INNER_FIELD_ACCESS_OR_NULL(_res_conv_10_conv);
29461                 _res_constr.data[k] = _res_conv_10_conv;
29462         }
29463         FREE(_res);
29464         CVec_OutPointZ_free(_res_constr);
29465 }
29466
29467 void  __attribute__((export_name("TS_CVec_MonitorUpdateIdZ_free"))) TS_CVec_MonitorUpdateIdZ_free(uint64_tArray _res) {
29468         LDKCVec_MonitorUpdateIdZ _res_constr;
29469         _res_constr.datalen = _res->arr_len;
29470         if (_res_constr.datalen > 0)
29471                 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKMonitorUpdateId), "LDKCVec_MonitorUpdateIdZ Elements");
29472         else
29473                 _res_constr.data = NULL;
29474         uint64_t* _res_vals = _res->elems;
29475         for (size_t r = 0; r < _res_constr.datalen; r++) {
29476                 uint64_t _res_conv_17 = _res_vals[r];
29477                 LDKMonitorUpdateId _res_conv_17_conv;
29478                 _res_conv_17_conv.inner = untag_ptr(_res_conv_17);
29479                 _res_conv_17_conv.is_owned = ptr_is_owned(_res_conv_17);
29480                 CHECK_INNER_FIELD_ACCESS_OR_NULL(_res_conv_17_conv);
29481                 _res_constr.data[r] = _res_conv_17_conv;
29482         }
29483         FREE(_res);
29484         CVec_MonitorUpdateIdZ_free(_res_constr);
29485 }
29486
29487 static inline uint64_t C2Tuple_OutPointCVec_MonitorUpdateIdZZ_clone_ptr(LDKC2Tuple_OutPointCVec_MonitorUpdateIdZZ *NONNULL_PTR arg) {
29488         LDKC2Tuple_OutPointCVec_MonitorUpdateIdZZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_OutPointCVec_MonitorUpdateIdZZ), "LDKC2Tuple_OutPointCVec_MonitorUpdateIdZZ");
29489         *ret_conv = C2Tuple_OutPointCVec_MonitorUpdateIdZZ_clone(arg);
29490         return tag_ptr(ret_conv, true);
29491 }
29492 int64_t  __attribute__((export_name("TS_C2Tuple_OutPointCVec_MonitorUpdateIdZZ_clone_ptr"))) TS_C2Tuple_OutPointCVec_MonitorUpdateIdZZ_clone_ptr(uint64_t arg) {
29493         LDKC2Tuple_OutPointCVec_MonitorUpdateIdZZ* arg_conv = (LDKC2Tuple_OutPointCVec_MonitorUpdateIdZZ*)untag_ptr(arg);
29494         int64_t ret_conv = C2Tuple_OutPointCVec_MonitorUpdateIdZZ_clone_ptr(arg_conv);
29495         return ret_conv;
29496 }
29497
29498 uint64_t  __attribute__((export_name("TS_C2Tuple_OutPointCVec_MonitorUpdateIdZZ_clone"))) TS_C2Tuple_OutPointCVec_MonitorUpdateIdZZ_clone(uint64_t orig) {
29499         LDKC2Tuple_OutPointCVec_MonitorUpdateIdZZ* orig_conv = (LDKC2Tuple_OutPointCVec_MonitorUpdateIdZZ*)untag_ptr(orig);
29500         LDKC2Tuple_OutPointCVec_MonitorUpdateIdZZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_OutPointCVec_MonitorUpdateIdZZ), "LDKC2Tuple_OutPointCVec_MonitorUpdateIdZZ");
29501         *ret_conv = C2Tuple_OutPointCVec_MonitorUpdateIdZZ_clone(orig_conv);
29502         return tag_ptr(ret_conv, true);
29503 }
29504
29505 uint64_t  __attribute__((export_name("TS_C2Tuple_OutPointCVec_MonitorUpdateIdZZ_new"))) TS_C2Tuple_OutPointCVec_MonitorUpdateIdZZ_new(uint64_t a, uint64_tArray b) {
29506         LDKOutPoint a_conv;
29507         a_conv.inner = untag_ptr(a);
29508         a_conv.is_owned = ptr_is_owned(a);
29509         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
29510         a_conv = OutPoint_clone(&a_conv);
29511         LDKCVec_MonitorUpdateIdZ b_constr;
29512         b_constr.datalen = b->arr_len;
29513         if (b_constr.datalen > 0)
29514                 b_constr.data = MALLOC(b_constr.datalen * sizeof(LDKMonitorUpdateId), "LDKCVec_MonitorUpdateIdZ Elements");
29515         else
29516                 b_constr.data = NULL;
29517         uint64_t* b_vals = b->elems;
29518         for (size_t r = 0; r < b_constr.datalen; r++) {
29519                 uint64_t b_conv_17 = b_vals[r];
29520                 LDKMonitorUpdateId b_conv_17_conv;
29521                 b_conv_17_conv.inner = untag_ptr(b_conv_17);
29522                 b_conv_17_conv.is_owned = ptr_is_owned(b_conv_17);
29523                 CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv_17_conv);
29524                 b_conv_17_conv = MonitorUpdateId_clone(&b_conv_17_conv);
29525                 b_constr.data[r] = b_conv_17_conv;
29526         }
29527         FREE(b);
29528         LDKC2Tuple_OutPointCVec_MonitorUpdateIdZZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_OutPointCVec_MonitorUpdateIdZZ), "LDKC2Tuple_OutPointCVec_MonitorUpdateIdZZ");
29529         *ret_conv = C2Tuple_OutPointCVec_MonitorUpdateIdZZ_new(a_conv, b_constr);
29530         return tag_ptr(ret_conv, true);
29531 }
29532
29533 void  __attribute__((export_name("TS_C2Tuple_OutPointCVec_MonitorUpdateIdZZ_free"))) TS_C2Tuple_OutPointCVec_MonitorUpdateIdZZ_free(uint64_t _res) {
29534         if (!ptr_is_owned(_res)) return;
29535         void* _res_ptr = untag_ptr(_res);
29536         CHECK_ACCESS(_res_ptr);
29537         LDKC2Tuple_OutPointCVec_MonitorUpdateIdZZ _res_conv = *(LDKC2Tuple_OutPointCVec_MonitorUpdateIdZZ*)(_res_ptr);
29538         FREE(untag_ptr(_res));
29539         C2Tuple_OutPointCVec_MonitorUpdateIdZZ_free(_res_conv);
29540 }
29541
29542 void  __attribute__((export_name("TS_CVec_C2Tuple_OutPointCVec_MonitorUpdateIdZZZ_free"))) TS_CVec_C2Tuple_OutPointCVec_MonitorUpdateIdZZZ_free(uint64_tArray _res) {
29543         LDKCVec_C2Tuple_OutPointCVec_MonitorUpdateIdZZZ _res_constr;
29544         _res_constr.datalen = _res->arr_len;
29545         if (_res_constr.datalen > 0)
29546                 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKC2Tuple_OutPointCVec_MonitorUpdateIdZZ), "LDKCVec_C2Tuple_OutPointCVec_MonitorUpdateIdZZZ Elements");
29547         else
29548                 _res_constr.data = NULL;
29549         uint64_t* _res_vals = _res->elems;
29550         for (size_t p = 0; p < _res_constr.datalen; p++) {
29551                 uint64_t _res_conv_41 = _res_vals[p];
29552                 void* _res_conv_41_ptr = untag_ptr(_res_conv_41);
29553                 CHECK_ACCESS(_res_conv_41_ptr);
29554                 LDKC2Tuple_OutPointCVec_MonitorUpdateIdZZ _res_conv_41_conv = *(LDKC2Tuple_OutPointCVec_MonitorUpdateIdZZ*)(_res_conv_41_ptr);
29555                 FREE(untag_ptr(_res_conv_41));
29556                 _res_constr.data[p] = _res_conv_41_conv;
29557         }
29558         FREE(_res);
29559         CVec_C2Tuple_OutPointCVec_MonitorUpdateIdZZZ_free(_res_constr);
29560 }
29561
29562 void  __attribute__((export_name("TS_APIError_free"))) TS_APIError_free(uint64_t this_ptr) {
29563         if (!ptr_is_owned(this_ptr)) return;
29564         void* this_ptr_ptr = untag_ptr(this_ptr);
29565         CHECK_ACCESS(this_ptr_ptr);
29566         LDKAPIError this_ptr_conv = *(LDKAPIError*)(this_ptr_ptr);
29567         FREE(untag_ptr(this_ptr));
29568         APIError_free(this_ptr_conv);
29569 }
29570
29571 static inline uint64_t APIError_clone_ptr(LDKAPIError *NONNULL_PTR arg) {
29572         LDKAPIError *ret_copy = MALLOC(sizeof(LDKAPIError), "LDKAPIError");
29573         *ret_copy = APIError_clone(arg);
29574         uint64_t ret_ref = tag_ptr(ret_copy, true);
29575         return ret_ref;
29576 }
29577 int64_t  __attribute__((export_name("TS_APIError_clone_ptr"))) TS_APIError_clone_ptr(uint64_t arg) {
29578         LDKAPIError* arg_conv = (LDKAPIError*)untag_ptr(arg);
29579         int64_t ret_conv = APIError_clone_ptr(arg_conv);
29580         return ret_conv;
29581 }
29582
29583 uint64_t  __attribute__((export_name("TS_APIError_clone"))) TS_APIError_clone(uint64_t orig) {
29584         LDKAPIError* orig_conv = (LDKAPIError*)untag_ptr(orig);
29585         LDKAPIError *ret_copy = MALLOC(sizeof(LDKAPIError), "LDKAPIError");
29586         *ret_copy = APIError_clone(orig_conv);
29587         uint64_t ret_ref = tag_ptr(ret_copy, true);
29588         return ret_ref;
29589 }
29590
29591 uint64_t  __attribute__((export_name("TS_APIError_apimisuse_error"))) TS_APIError_apimisuse_error(jstring err) {
29592         LDKStr err_conv = str_ref_to_owned_c(err);
29593         LDKAPIError *ret_copy = MALLOC(sizeof(LDKAPIError), "LDKAPIError");
29594         *ret_copy = APIError_apimisuse_error(err_conv);
29595         uint64_t ret_ref = tag_ptr(ret_copy, true);
29596         return ret_ref;
29597 }
29598
29599 uint64_t  __attribute__((export_name("TS_APIError_fee_rate_too_high"))) TS_APIError_fee_rate_too_high(jstring err, int32_t feerate) {
29600         LDKStr err_conv = str_ref_to_owned_c(err);
29601         LDKAPIError *ret_copy = MALLOC(sizeof(LDKAPIError), "LDKAPIError");
29602         *ret_copy = APIError_fee_rate_too_high(err_conv, feerate);
29603         uint64_t ret_ref = tag_ptr(ret_copy, true);
29604         return ret_ref;
29605 }
29606
29607 uint64_t  __attribute__((export_name("TS_APIError_invalid_route"))) TS_APIError_invalid_route(jstring err) {
29608         LDKStr err_conv = str_ref_to_owned_c(err);
29609         LDKAPIError *ret_copy = MALLOC(sizeof(LDKAPIError), "LDKAPIError");
29610         *ret_copy = APIError_invalid_route(err_conv);
29611         uint64_t ret_ref = tag_ptr(ret_copy, true);
29612         return ret_ref;
29613 }
29614
29615 uint64_t  __attribute__((export_name("TS_APIError_channel_unavailable"))) TS_APIError_channel_unavailable(jstring err) {
29616         LDKStr err_conv = str_ref_to_owned_c(err);
29617         LDKAPIError *ret_copy = MALLOC(sizeof(LDKAPIError), "LDKAPIError");
29618         *ret_copy = APIError_channel_unavailable(err_conv);
29619         uint64_t ret_ref = tag_ptr(ret_copy, true);
29620         return ret_ref;
29621 }
29622
29623 uint64_t  __attribute__((export_name("TS_APIError_monitor_update_in_progress"))) TS_APIError_monitor_update_in_progress() {
29624         LDKAPIError *ret_copy = MALLOC(sizeof(LDKAPIError), "LDKAPIError");
29625         *ret_copy = APIError_monitor_update_in_progress();
29626         uint64_t ret_ref = tag_ptr(ret_copy, true);
29627         return ret_ref;
29628 }
29629
29630 uint64_t  __attribute__((export_name("TS_APIError_incompatible_shutdown_script"))) TS_APIError_incompatible_shutdown_script(uint64_t script) {
29631         LDKShutdownScript script_conv;
29632         script_conv.inner = untag_ptr(script);
29633         script_conv.is_owned = ptr_is_owned(script);
29634         CHECK_INNER_FIELD_ACCESS_OR_NULL(script_conv);
29635         script_conv = ShutdownScript_clone(&script_conv);
29636         LDKAPIError *ret_copy = MALLOC(sizeof(LDKAPIError), "LDKAPIError");
29637         *ret_copy = APIError_incompatible_shutdown_script(script_conv);
29638         uint64_t ret_ref = tag_ptr(ret_copy, true);
29639         return ret_ref;
29640 }
29641
29642 jboolean  __attribute__((export_name("TS_APIError_eq"))) TS_APIError_eq(uint64_t a, uint64_t b) {
29643         LDKAPIError* a_conv = (LDKAPIError*)untag_ptr(a);
29644         LDKAPIError* b_conv = (LDKAPIError*)untag_ptr(b);
29645         jboolean ret_conv = APIError_eq(a_conv, b_conv);
29646         return ret_conv;
29647 }
29648
29649 int8_tArray  __attribute__((export_name("TS_APIError_write"))) TS_APIError_write(uint64_t obj) {
29650         LDKAPIError* obj_conv = (LDKAPIError*)untag_ptr(obj);
29651         LDKCVec_u8Z ret_var = APIError_write(obj_conv);
29652         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
29653         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
29654         CVec_u8Z_free(ret_var);
29655         return ret_arr;
29656 }
29657
29658 uint64_t  __attribute__((export_name("TS_APIError_read"))) TS_APIError_read(int8_tArray ser) {
29659         LDKu8slice ser_ref;
29660         ser_ref.datalen = ser->arr_len;
29661         ser_ref.data = ser->elems;
29662         LDKCResult_COption_APIErrorZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_COption_APIErrorZDecodeErrorZ), "LDKCResult_COption_APIErrorZDecodeErrorZ");
29663         *ret_conv = APIError_read(ser_ref);
29664         FREE(ser);
29665         return tag_ptr(ret_conv, true);
29666 }
29667
29668 void  __attribute__((export_name("TS_BigSize_free"))) TS_BigSize_free(uint64_t this_obj) {
29669         LDKBigSize this_obj_conv;
29670         this_obj_conv.inner = untag_ptr(this_obj);
29671         this_obj_conv.is_owned = ptr_is_owned(this_obj);
29672         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
29673         BigSize_free(this_obj_conv);
29674 }
29675
29676 int64_t  __attribute__((export_name("TS_BigSize_get_a"))) TS_BigSize_get_a(uint64_t this_ptr) {
29677         LDKBigSize this_ptr_conv;
29678         this_ptr_conv.inner = untag_ptr(this_ptr);
29679         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
29680         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
29681         this_ptr_conv.is_owned = false;
29682         int64_t ret_conv = BigSize_get_a(&this_ptr_conv);
29683         return ret_conv;
29684 }
29685
29686 void  __attribute__((export_name("TS_BigSize_set_a"))) TS_BigSize_set_a(uint64_t this_ptr, int64_t val) {
29687         LDKBigSize this_ptr_conv;
29688         this_ptr_conv.inner = untag_ptr(this_ptr);
29689         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
29690         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
29691         this_ptr_conv.is_owned = false;
29692         BigSize_set_a(&this_ptr_conv, val);
29693 }
29694
29695 uint64_t  __attribute__((export_name("TS_BigSize_new"))) TS_BigSize_new(int64_t a_arg) {
29696         LDKBigSize ret_var = BigSize_new(a_arg);
29697         uint64_t ret_ref = 0;
29698         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
29699         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
29700         return ret_ref;
29701 }
29702
29703 static inline uint64_t BigSize_clone_ptr(LDKBigSize *NONNULL_PTR arg) {
29704         LDKBigSize ret_var = BigSize_clone(arg);
29705         uint64_t ret_ref = 0;
29706         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
29707         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
29708         return ret_ref;
29709 }
29710 int64_t  __attribute__((export_name("TS_BigSize_clone_ptr"))) TS_BigSize_clone_ptr(uint64_t arg) {
29711         LDKBigSize arg_conv;
29712         arg_conv.inner = untag_ptr(arg);
29713         arg_conv.is_owned = ptr_is_owned(arg);
29714         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
29715         arg_conv.is_owned = false;
29716         int64_t ret_conv = BigSize_clone_ptr(&arg_conv);
29717         return ret_conv;
29718 }
29719
29720 uint64_t  __attribute__((export_name("TS_BigSize_clone"))) TS_BigSize_clone(uint64_t orig) {
29721         LDKBigSize orig_conv;
29722         orig_conv.inner = untag_ptr(orig);
29723         orig_conv.is_owned = ptr_is_owned(orig);
29724         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
29725         orig_conv.is_owned = false;
29726         LDKBigSize ret_var = BigSize_clone(&orig_conv);
29727         uint64_t ret_ref = 0;
29728         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
29729         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
29730         return ret_ref;
29731 }
29732
29733 int64_t  __attribute__((export_name("TS_BigSize_hash"))) TS_BigSize_hash(uint64_t o) {
29734         LDKBigSize o_conv;
29735         o_conv.inner = untag_ptr(o);
29736         o_conv.is_owned = ptr_is_owned(o);
29737         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
29738         o_conv.is_owned = false;
29739         int64_t ret_conv = BigSize_hash(&o_conv);
29740         return ret_conv;
29741 }
29742
29743 jboolean  __attribute__((export_name("TS_BigSize_eq"))) TS_BigSize_eq(uint64_t a, uint64_t b) {
29744         LDKBigSize a_conv;
29745         a_conv.inner = untag_ptr(a);
29746         a_conv.is_owned = ptr_is_owned(a);
29747         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
29748         a_conv.is_owned = false;
29749         LDKBigSize b_conv;
29750         b_conv.inner = untag_ptr(b);
29751         b_conv.is_owned = ptr_is_owned(b);
29752         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
29753         b_conv.is_owned = false;
29754         jboolean ret_conv = BigSize_eq(&a_conv, &b_conv);
29755         return ret_conv;
29756 }
29757
29758 int8_tArray  __attribute__((export_name("TS_BigSize_write"))) TS_BigSize_write(uint64_t obj) {
29759         LDKBigSize 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 = BigSize_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_BigSize_read"))) TS_BigSize_read(int8_tArray ser) {
29772         LDKu8slice ser_ref;
29773         ser_ref.datalen = ser->arr_len;
29774         ser_ref.data = ser->elems;
29775         LDKCResult_BigSizeDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_BigSizeDecodeErrorZ), "LDKCResult_BigSizeDecodeErrorZ");
29776         *ret_conv = BigSize_read(ser_ref);
29777         FREE(ser);
29778         return tag_ptr(ret_conv, true);
29779 }
29780
29781 void  __attribute__((export_name("TS_Hostname_free"))) TS_Hostname_free(uint64_t this_obj) {
29782         LDKHostname this_obj_conv;
29783         this_obj_conv.inner = untag_ptr(this_obj);
29784         this_obj_conv.is_owned = ptr_is_owned(this_obj);
29785         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
29786         Hostname_free(this_obj_conv);
29787 }
29788
29789 static inline uint64_t Hostname_clone_ptr(LDKHostname *NONNULL_PTR arg) {
29790         LDKHostname ret_var = Hostname_clone(arg);
29791         uint64_t ret_ref = 0;
29792         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
29793         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
29794         return ret_ref;
29795 }
29796 int64_t  __attribute__((export_name("TS_Hostname_clone_ptr"))) TS_Hostname_clone_ptr(uint64_t arg) {
29797         LDKHostname arg_conv;
29798         arg_conv.inner = untag_ptr(arg);
29799         arg_conv.is_owned = ptr_is_owned(arg);
29800         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
29801         arg_conv.is_owned = false;
29802         int64_t ret_conv = Hostname_clone_ptr(&arg_conv);
29803         return ret_conv;
29804 }
29805
29806 uint64_t  __attribute__((export_name("TS_Hostname_clone"))) TS_Hostname_clone(uint64_t orig) {
29807         LDKHostname orig_conv;
29808         orig_conv.inner = untag_ptr(orig);
29809         orig_conv.is_owned = ptr_is_owned(orig);
29810         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
29811         orig_conv.is_owned = false;
29812         LDKHostname ret_var = Hostname_clone(&orig_conv);
29813         uint64_t ret_ref = 0;
29814         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
29815         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
29816         return ret_ref;
29817 }
29818
29819 jboolean  __attribute__((export_name("TS_Hostname_eq"))) TS_Hostname_eq(uint64_t a, uint64_t b) {
29820         LDKHostname a_conv;
29821         a_conv.inner = untag_ptr(a);
29822         a_conv.is_owned = ptr_is_owned(a);
29823         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
29824         a_conv.is_owned = false;
29825         LDKHostname b_conv;
29826         b_conv.inner = untag_ptr(b);
29827         b_conv.is_owned = ptr_is_owned(b);
29828         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
29829         b_conv.is_owned = false;
29830         jboolean ret_conv = Hostname_eq(&a_conv, &b_conv);
29831         return ret_conv;
29832 }
29833
29834 int8_t  __attribute__((export_name("TS_Hostname_len"))) TS_Hostname_len(uint64_t this_arg) {
29835         LDKHostname this_arg_conv;
29836         this_arg_conv.inner = untag_ptr(this_arg);
29837         this_arg_conv.is_owned = ptr_is_owned(this_arg);
29838         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
29839         this_arg_conv.is_owned = false;
29840         int8_t ret_conv = Hostname_len(&this_arg_conv);
29841         return ret_conv;
29842 }
29843
29844 int8_tArray  __attribute__((export_name("TS_Hostname_write"))) TS_Hostname_write(uint64_t obj) {
29845         LDKHostname obj_conv;
29846         obj_conv.inner = untag_ptr(obj);
29847         obj_conv.is_owned = ptr_is_owned(obj);
29848         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
29849         obj_conv.is_owned = false;
29850         LDKCVec_u8Z ret_var = Hostname_write(&obj_conv);
29851         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
29852         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
29853         CVec_u8Z_free(ret_var);
29854         return ret_arr;
29855 }
29856
29857 uint64_t  __attribute__((export_name("TS_Hostname_read"))) TS_Hostname_read(int8_tArray ser) {
29858         LDKu8slice ser_ref;
29859         ser_ref.datalen = ser->arr_len;
29860         ser_ref.data = ser->elems;
29861         LDKCResult_HostnameDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_HostnameDecodeErrorZ), "LDKCResult_HostnameDecodeErrorZ");
29862         *ret_conv = Hostname_read(ser_ref);
29863         FREE(ser);
29864         return tag_ptr(ret_conv, true);
29865 }
29866
29867 void  __attribute__((export_name("TS_TransactionU16LenLimited_free"))) TS_TransactionU16LenLimited_free(uint64_t this_obj) {
29868         LDKTransactionU16LenLimited this_obj_conv;
29869         this_obj_conv.inner = untag_ptr(this_obj);
29870         this_obj_conv.is_owned = ptr_is_owned(this_obj);
29871         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
29872         TransactionU16LenLimited_free(this_obj_conv);
29873 }
29874
29875 static inline uint64_t TransactionU16LenLimited_clone_ptr(LDKTransactionU16LenLimited *NONNULL_PTR arg) {
29876         LDKTransactionU16LenLimited ret_var = TransactionU16LenLimited_clone(arg);
29877         uint64_t ret_ref = 0;
29878         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
29879         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
29880         return ret_ref;
29881 }
29882 int64_t  __attribute__((export_name("TS_TransactionU16LenLimited_clone_ptr"))) TS_TransactionU16LenLimited_clone_ptr(uint64_t arg) {
29883         LDKTransactionU16LenLimited arg_conv;
29884         arg_conv.inner = untag_ptr(arg);
29885         arg_conv.is_owned = ptr_is_owned(arg);
29886         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
29887         arg_conv.is_owned = false;
29888         int64_t ret_conv = TransactionU16LenLimited_clone_ptr(&arg_conv);
29889         return ret_conv;
29890 }
29891
29892 uint64_t  __attribute__((export_name("TS_TransactionU16LenLimited_clone"))) TS_TransactionU16LenLimited_clone(uint64_t orig) {
29893         LDKTransactionU16LenLimited orig_conv;
29894         orig_conv.inner = untag_ptr(orig);
29895         orig_conv.is_owned = ptr_is_owned(orig);
29896         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
29897         orig_conv.is_owned = false;
29898         LDKTransactionU16LenLimited ret_var = TransactionU16LenLimited_clone(&orig_conv);
29899         uint64_t ret_ref = 0;
29900         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
29901         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
29902         return ret_ref;
29903 }
29904
29905 jboolean  __attribute__((export_name("TS_TransactionU16LenLimited_eq"))) TS_TransactionU16LenLimited_eq(uint64_t a, uint64_t b) {
29906         LDKTransactionU16LenLimited a_conv;
29907         a_conv.inner = untag_ptr(a);
29908         a_conv.is_owned = ptr_is_owned(a);
29909         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
29910         a_conv.is_owned = false;
29911         LDKTransactionU16LenLimited b_conv;
29912         b_conv.inner = untag_ptr(b);
29913         b_conv.is_owned = ptr_is_owned(b);
29914         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
29915         b_conv.is_owned = false;
29916         jboolean ret_conv = TransactionU16LenLimited_eq(&a_conv, &b_conv);
29917         return ret_conv;
29918 }
29919
29920 uint64_t  __attribute__((export_name("TS_TransactionU16LenLimited_new"))) TS_TransactionU16LenLimited_new(int8_tArray transaction) {
29921         LDKTransaction transaction_ref;
29922         transaction_ref.datalen = transaction->arr_len;
29923         transaction_ref.data = MALLOC(transaction_ref.datalen, "LDKTransaction Bytes");
29924         memcpy(transaction_ref.data, transaction->elems, transaction_ref.datalen); FREE(transaction);
29925         transaction_ref.data_is_owned = true;
29926         LDKCResult_TransactionU16LenLimitedNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_TransactionU16LenLimitedNoneZ), "LDKCResult_TransactionU16LenLimitedNoneZ");
29927         *ret_conv = TransactionU16LenLimited_new(transaction_ref);
29928         return tag_ptr(ret_conv, true);
29929 }
29930
29931 int8_tArray  __attribute__((export_name("TS_TransactionU16LenLimited_into_transaction"))) TS_TransactionU16LenLimited_into_transaction(uint64_t this_arg) {
29932         LDKTransactionU16LenLimited this_arg_conv;
29933         this_arg_conv.inner = untag_ptr(this_arg);
29934         this_arg_conv.is_owned = ptr_is_owned(this_arg);
29935         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
29936         this_arg_conv = TransactionU16LenLimited_clone(&this_arg_conv);
29937         LDKTransaction ret_var = TransactionU16LenLimited_into_transaction(this_arg_conv);
29938         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
29939         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
29940         Transaction_free(ret_var);
29941         return ret_arr;
29942 }
29943
29944 int8_tArray  __attribute__((export_name("TS_TransactionU16LenLimited_write"))) TS_TransactionU16LenLimited_write(uint64_t obj) {
29945         LDKTransactionU16LenLimited obj_conv;
29946         obj_conv.inner = untag_ptr(obj);
29947         obj_conv.is_owned = ptr_is_owned(obj);
29948         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
29949         obj_conv.is_owned = false;
29950         LDKCVec_u8Z ret_var = TransactionU16LenLimited_write(&obj_conv);
29951         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
29952         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
29953         CVec_u8Z_free(ret_var);
29954         return ret_arr;
29955 }
29956
29957 uint64_t  __attribute__((export_name("TS_TransactionU16LenLimited_read"))) TS_TransactionU16LenLimited_read(int8_tArray ser) {
29958         LDKu8slice ser_ref;
29959         ser_ref.datalen = ser->arr_len;
29960         ser_ref.data = ser->elems;
29961         LDKCResult_TransactionU16LenLimitedDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TransactionU16LenLimitedDecodeErrorZ), "LDKCResult_TransactionU16LenLimitedDecodeErrorZ");
29962         *ret_conv = TransactionU16LenLimited_read(ser_ref);
29963         FREE(ser);
29964         return tag_ptr(ret_conv, true);
29965 }
29966
29967 uint64_t  __attribute__((export_name("TS_sign"))) TS_sign(int8_tArray msg, int8_tArray sk) {
29968         LDKu8slice msg_ref;
29969         msg_ref.datalen = msg->arr_len;
29970         msg_ref.data = msg->elems;
29971         uint8_t sk_arr[32];
29972         CHECK(sk->arr_len == 32);
29973         memcpy(sk_arr, sk->elems, 32); FREE(sk);
29974         uint8_t (*sk_ref)[32] = &sk_arr;
29975         LDKCResult_StrSecp256k1ErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_StrSecp256k1ErrorZ), "LDKCResult_StrSecp256k1ErrorZ");
29976         *ret_conv = sign(msg_ref, sk_ref);
29977         FREE(msg);
29978         return tag_ptr(ret_conv, true);
29979 }
29980
29981 uint64_t  __attribute__((export_name("TS_recover_pk"))) TS_recover_pk(int8_tArray msg, jstring sig) {
29982         LDKu8slice msg_ref;
29983         msg_ref.datalen = msg->arr_len;
29984         msg_ref.data = msg->elems;
29985         LDKStr sig_conv = str_ref_to_owned_c(sig);
29986         LDKCResult_PublicKeySecp256k1ErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PublicKeySecp256k1ErrorZ), "LDKCResult_PublicKeySecp256k1ErrorZ");
29987         *ret_conv = recover_pk(msg_ref, sig_conv);
29988         FREE(msg);
29989         return tag_ptr(ret_conv, true);
29990 }
29991
29992 jboolean  __attribute__((export_name("TS_verify"))) TS_verify(int8_tArray msg, jstring sig, int8_tArray pk) {
29993         LDKu8slice msg_ref;
29994         msg_ref.datalen = msg->arr_len;
29995         msg_ref.data = msg->elems;
29996         LDKStr sig_conv = str_ref_to_owned_c(sig);
29997         LDKPublicKey pk_ref;
29998         CHECK(pk->arr_len == 33);
29999         memcpy(pk_ref.compressed_form, pk->elems, 33); FREE(pk);
30000         jboolean ret_conv = verify(msg_ref, sig_conv, pk_ref);
30001         FREE(msg);
30002         return ret_conv;
30003 }
30004
30005 int8_tArray  __attribute__((export_name("TS_construct_invoice_preimage"))) TS_construct_invoice_preimage(int8_tArray hrp_bytes, ptrArray data_without_signature) {
30006         LDKu8slice hrp_bytes_ref;
30007         hrp_bytes_ref.datalen = hrp_bytes->arr_len;
30008         hrp_bytes_ref.data = hrp_bytes->elems;
30009         LDKCVec_U5Z data_without_signature_constr;
30010         data_without_signature_constr.datalen = data_without_signature->arr_len;
30011         if (data_without_signature_constr.datalen > 0)
30012                 data_without_signature_constr.data = MALLOC(data_without_signature_constr.datalen * sizeof(LDKU5), "LDKCVec_U5Z Elements");
30013         else
30014                 data_without_signature_constr.data = NULL;
30015         int8_t* data_without_signature_vals = (void*) data_without_signature->elems;
30016         for (size_t h = 0; h < data_without_signature_constr.datalen; h++) {
30017                 int8_t data_without_signature_conv_7 = data_without_signature_vals[h];
30018                 
30019                 data_without_signature_constr.data[h] = (LDKU5){ ._0 = data_without_signature_conv_7 };
30020         }
30021         FREE(data_without_signature);
30022         LDKCVec_u8Z ret_var = construct_invoice_preimage(hrp_bytes_ref, data_without_signature_constr);
30023         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
30024         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
30025         CVec_u8Z_free(ret_var);
30026         FREE(hrp_bytes);
30027         return ret_arr;
30028 }
30029
30030 void  __attribute__((export_name("TS_KVStore_free"))) TS_KVStore_free(uint64_t this_ptr) {
30031         if (!ptr_is_owned(this_ptr)) return;
30032         void* this_ptr_ptr = untag_ptr(this_ptr);
30033         CHECK_ACCESS(this_ptr_ptr);
30034         LDKKVStore this_ptr_conv = *(LDKKVStore*)(this_ptr_ptr);
30035         FREE(untag_ptr(this_ptr));
30036         KVStore_free(this_ptr_conv);
30037 }
30038
30039 void  __attribute__((export_name("TS_Persister_free"))) TS_Persister_free(uint64_t this_ptr) {
30040         if (!ptr_is_owned(this_ptr)) return;
30041         void* this_ptr_ptr = untag_ptr(this_ptr);
30042         CHECK_ACCESS(this_ptr_ptr);
30043         LDKPersister this_ptr_conv = *(LDKPersister*)(this_ptr_ptr);
30044         FREE(untag_ptr(this_ptr));
30045         Persister_free(this_ptr_conv);
30046 }
30047
30048 uint64_t  __attribute__((export_name("TS_read_channel_monitors"))) TS_read_channel_monitors(uint64_t kv_store, uint64_t entropy_source, uint64_t signer_provider) {
30049         void* kv_store_ptr = untag_ptr(kv_store);
30050         CHECK_ACCESS(kv_store_ptr);
30051         LDKKVStore kv_store_conv = *(LDKKVStore*)(kv_store_ptr);
30052         if (kv_store_conv.free == LDKKVStore_JCalls_free) {
30053                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
30054                 LDKKVStore_JCalls_cloned(&kv_store_conv);
30055         }
30056         void* entropy_source_ptr = untag_ptr(entropy_source);
30057         CHECK_ACCESS(entropy_source_ptr);
30058         LDKEntropySource entropy_source_conv = *(LDKEntropySource*)(entropy_source_ptr);
30059         if (entropy_source_conv.free == LDKEntropySource_JCalls_free) {
30060                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
30061                 LDKEntropySource_JCalls_cloned(&entropy_source_conv);
30062         }
30063         void* signer_provider_ptr = untag_ptr(signer_provider);
30064         CHECK_ACCESS(signer_provider_ptr);
30065         LDKSignerProvider signer_provider_conv = *(LDKSignerProvider*)(signer_provider_ptr);
30066         if (signer_provider_conv.free == LDKSignerProvider_JCalls_free) {
30067                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
30068                 LDKSignerProvider_JCalls_cloned(&signer_provider_conv);
30069         }
30070         LDKCResult_CVec_C2Tuple_ThirtyTwoBytesChannelMonitorZZIOErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_C2Tuple_ThirtyTwoBytesChannelMonitorZZIOErrorZ), "LDKCResult_CVec_C2Tuple_ThirtyTwoBytesChannelMonitorZZIOErrorZ");
30071         *ret_conv = read_channel_monitors(kv_store_conv, entropy_source_conv, signer_provider_conv);
30072         return tag_ptr(ret_conv, true);
30073 }
30074
30075 void  __attribute__((export_name("TS_MonitorUpdatingPersister_free"))) TS_MonitorUpdatingPersister_free(uint64_t this_obj) {
30076         LDKMonitorUpdatingPersister this_obj_conv;
30077         this_obj_conv.inner = untag_ptr(this_obj);
30078         this_obj_conv.is_owned = ptr_is_owned(this_obj);
30079         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
30080         MonitorUpdatingPersister_free(this_obj_conv);
30081 }
30082
30083 uint64_t  __attribute__((export_name("TS_MonitorUpdatingPersister_new"))) TS_MonitorUpdatingPersister_new(uint64_t kv_store, uint64_t logger, int64_t maximum_pending_updates, uint64_t entropy_source, uint64_t signer_provider) {
30084         void* kv_store_ptr = untag_ptr(kv_store);
30085         CHECK_ACCESS(kv_store_ptr);
30086         LDKKVStore kv_store_conv = *(LDKKVStore*)(kv_store_ptr);
30087         if (kv_store_conv.free == LDKKVStore_JCalls_free) {
30088                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
30089                 LDKKVStore_JCalls_cloned(&kv_store_conv);
30090         }
30091         void* logger_ptr = untag_ptr(logger);
30092         CHECK_ACCESS(logger_ptr);
30093         LDKLogger logger_conv = *(LDKLogger*)(logger_ptr);
30094         if (logger_conv.free == LDKLogger_JCalls_free) {
30095                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
30096                 LDKLogger_JCalls_cloned(&logger_conv);
30097         }
30098         void* entropy_source_ptr = untag_ptr(entropy_source);
30099         CHECK_ACCESS(entropy_source_ptr);
30100         LDKEntropySource entropy_source_conv = *(LDKEntropySource*)(entropy_source_ptr);
30101         if (entropy_source_conv.free == LDKEntropySource_JCalls_free) {
30102                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
30103                 LDKEntropySource_JCalls_cloned(&entropy_source_conv);
30104         }
30105         void* signer_provider_ptr = untag_ptr(signer_provider);
30106         CHECK_ACCESS(signer_provider_ptr);
30107         LDKSignerProvider signer_provider_conv = *(LDKSignerProvider*)(signer_provider_ptr);
30108         if (signer_provider_conv.free == LDKSignerProvider_JCalls_free) {
30109                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
30110                 LDKSignerProvider_JCalls_cloned(&signer_provider_conv);
30111         }
30112         LDKMonitorUpdatingPersister ret_var = MonitorUpdatingPersister_new(kv_store_conv, logger_conv, maximum_pending_updates, entropy_source_conv, signer_provider_conv);
30113         uint64_t ret_ref = 0;
30114         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
30115         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
30116         return ret_ref;
30117 }
30118
30119 uint64_t  __attribute__((export_name("TS_MonitorUpdatingPersister_read_all_channel_monitors_with_updates"))) TS_MonitorUpdatingPersister_read_all_channel_monitors_with_updates(uint64_t this_arg, uint64_t broadcaster, uint64_t fee_estimator) {
30120         LDKMonitorUpdatingPersister this_arg_conv;
30121         this_arg_conv.inner = untag_ptr(this_arg);
30122         this_arg_conv.is_owned = ptr_is_owned(this_arg);
30123         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
30124         this_arg_conv.is_owned = false;
30125         void* broadcaster_ptr = untag_ptr(broadcaster);
30126         if (ptr_is_owned(broadcaster)) { CHECK_ACCESS(broadcaster_ptr); }
30127         LDKBroadcasterInterface* broadcaster_conv = (LDKBroadcasterInterface*)broadcaster_ptr;
30128         void* fee_estimator_ptr = untag_ptr(fee_estimator);
30129         if (ptr_is_owned(fee_estimator)) { CHECK_ACCESS(fee_estimator_ptr); }
30130         LDKFeeEstimator* fee_estimator_conv = (LDKFeeEstimator*)fee_estimator_ptr;
30131         LDKCResult_CVec_C2Tuple_ThirtyTwoBytesChannelMonitorZZIOErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_C2Tuple_ThirtyTwoBytesChannelMonitorZZIOErrorZ), "LDKCResult_CVec_C2Tuple_ThirtyTwoBytesChannelMonitorZZIOErrorZ");
30132         *ret_conv = MonitorUpdatingPersister_read_all_channel_monitors_with_updates(&this_arg_conv, broadcaster_conv, fee_estimator_conv);
30133         return tag_ptr(ret_conv, true);
30134 }
30135
30136 uint64_t  __attribute__((export_name("TS_MonitorUpdatingPersister_read_channel_monitor_with_updates"))) TS_MonitorUpdatingPersister_read_channel_monitor_with_updates(uint64_t this_arg, uint64_t broadcaster, uint64_t fee_estimator, jstring monitor_key) {
30137         LDKMonitorUpdatingPersister this_arg_conv;
30138         this_arg_conv.inner = untag_ptr(this_arg);
30139         this_arg_conv.is_owned = ptr_is_owned(this_arg);
30140         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
30141         this_arg_conv.is_owned = false;
30142         void* broadcaster_ptr = untag_ptr(broadcaster);
30143         if (ptr_is_owned(broadcaster)) { CHECK_ACCESS(broadcaster_ptr); }
30144         LDKBroadcasterInterface* broadcaster_conv = (LDKBroadcasterInterface*)broadcaster_ptr;
30145         void* fee_estimator_ptr = untag_ptr(fee_estimator);
30146         if (ptr_is_owned(fee_estimator)) { CHECK_ACCESS(fee_estimator_ptr); }
30147         LDKFeeEstimator* fee_estimator_conv = (LDKFeeEstimator*)fee_estimator_ptr;
30148         LDKStr monitor_key_conv = str_ref_to_owned_c(monitor_key);
30149         LDKCResult_C2Tuple_ThirtyTwoBytesChannelMonitorZIOErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_ThirtyTwoBytesChannelMonitorZIOErrorZ), "LDKCResult_C2Tuple_ThirtyTwoBytesChannelMonitorZIOErrorZ");
30150         *ret_conv = MonitorUpdatingPersister_read_channel_monitor_with_updates(&this_arg_conv, broadcaster_conv, fee_estimator_conv, monitor_key_conv);
30151         return tag_ptr(ret_conv, true);
30152 }
30153
30154 uint64_t  __attribute__((export_name("TS_MonitorUpdatingPersister_cleanup_stale_updates"))) TS_MonitorUpdatingPersister_cleanup_stale_updates(uint64_t this_arg, jboolean lazy) {
30155         LDKMonitorUpdatingPersister this_arg_conv;
30156         this_arg_conv.inner = untag_ptr(this_arg);
30157         this_arg_conv.is_owned = ptr_is_owned(this_arg);
30158         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
30159         this_arg_conv.is_owned = false;
30160         LDKCResult_NoneIOErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneIOErrorZ), "LDKCResult_NoneIOErrorZ");
30161         *ret_conv = MonitorUpdatingPersister_cleanup_stale_updates(&this_arg_conv, lazy);
30162         return tag_ptr(ret_conv, true);
30163 }
30164
30165 uint64_t  __attribute__((export_name("TS_MonitorUpdatingPersister_as_Persist"))) TS_MonitorUpdatingPersister_as_Persist(uint64_t this_arg) {
30166         LDKMonitorUpdatingPersister this_arg_conv;
30167         this_arg_conv.inner = untag_ptr(this_arg);
30168         this_arg_conv.is_owned = ptr_is_owned(this_arg);
30169         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
30170         this_arg_conv.is_owned = false;
30171         LDKPersist* ret_ret = MALLOC(sizeof(LDKPersist), "LDKPersist");
30172         *ret_ret = MonitorUpdatingPersister_as_Persist(&this_arg_conv);
30173         return tag_ptr(ret_ret, true);
30174 }
30175
30176 void  __attribute__((export_name("TS_UntrustedString_free"))) TS_UntrustedString_free(uint64_t this_obj) {
30177         LDKUntrustedString this_obj_conv;
30178         this_obj_conv.inner = untag_ptr(this_obj);
30179         this_obj_conv.is_owned = ptr_is_owned(this_obj);
30180         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
30181         UntrustedString_free(this_obj_conv);
30182 }
30183
30184 jstring  __attribute__((export_name("TS_UntrustedString_get_a"))) TS_UntrustedString_get_a(uint64_t this_ptr) {
30185         LDKUntrustedString this_ptr_conv;
30186         this_ptr_conv.inner = untag_ptr(this_ptr);
30187         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
30188         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
30189         this_ptr_conv.is_owned = false;
30190         LDKStr ret_str = UntrustedString_get_a(&this_ptr_conv);
30191         jstring ret_conv = str_ref_to_ts(ret_str.chars, ret_str.len);
30192         Str_free(ret_str);
30193         return ret_conv;
30194 }
30195
30196 void  __attribute__((export_name("TS_UntrustedString_set_a"))) TS_UntrustedString_set_a(uint64_t this_ptr, jstring val) {
30197         LDKUntrustedString this_ptr_conv;
30198         this_ptr_conv.inner = untag_ptr(this_ptr);
30199         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
30200         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
30201         this_ptr_conv.is_owned = false;
30202         LDKStr val_conv = str_ref_to_owned_c(val);
30203         UntrustedString_set_a(&this_ptr_conv, val_conv);
30204 }
30205
30206 uint64_t  __attribute__((export_name("TS_UntrustedString_new"))) TS_UntrustedString_new(jstring a_arg) {
30207         LDKStr a_arg_conv = str_ref_to_owned_c(a_arg);
30208         LDKUntrustedString ret_var = UntrustedString_new(a_arg_conv);
30209         uint64_t ret_ref = 0;
30210         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
30211         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
30212         return ret_ref;
30213 }
30214
30215 static inline uint64_t UntrustedString_clone_ptr(LDKUntrustedString *NONNULL_PTR arg) {
30216         LDKUntrustedString ret_var = UntrustedString_clone(arg);
30217         uint64_t ret_ref = 0;
30218         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
30219         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
30220         return ret_ref;
30221 }
30222 int64_t  __attribute__((export_name("TS_UntrustedString_clone_ptr"))) TS_UntrustedString_clone_ptr(uint64_t arg) {
30223         LDKUntrustedString arg_conv;
30224         arg_conv.inner = untag_ptr(arg);
30225         arg_conv.is_owned = ptr_is_owned(arg);
30226         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
30227         arg_conv.is_owned = false;
30228         int64_t ret_conv = UntrustedString_clone_ptr(&arg_conv);
30229         return ret_conv;
30230 }
30231
30232 uint64_t  __attribute__((export_name("TS_UntrustedString_clone"))) TS_UntrustedString_clone(uint64_t orig) {
30233         LDKUntrustedString orig_conv;
30234         orig_conv.inner = untag_ptr(orig);
30235         orig_conv.is_owned = ptr_is_owned(orig);
30236         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
30237         orig_conv.is_owned = false;
30238         LDKUntrustedString ret_var = UntrustedString_clone(&orig_conv);
30239         uint64_t ret_ref = 0;
30240         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
30241         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
30242         return ret_ref;
30243 }
30244
30245 jboolean  __attribute__((export_name("TS_UntrustedString_eq"))) TS_UntrustedString_eq(uint64_t a, uint64_t b) {
30246         LDKUntrustedString a_conv;
30247         a_conv.inner = untag_ptr(a);
30248         a_conv.is_owned = ptr_is_owned(a);
30249         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
30250         a_conv.is_owned = false;
30251         LDKUntrustedString b_conv;
30252         b_conv.inner = untag_ptr(b);
30253         b_conv.is_owned = ptr_is_owned(b);
30254         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
30255         b_conv.is_owned = false;
30256         jboolean ret_conv = UntrustedString_eq(&a_conv, &b_conv);
30257         return ret_conv;
30258 }
30259
30260 int8_tArray  __attribute__((export_name("TS_UntrustedString_write"))) TS_UntrustedString_write(uint64_t obj) {
30261         LDKUntrustedString obj_conv;
30262         obj_conv.inner = untag_ptr(obj);
30263         obj_conv.is_owned = ptr_is_owned(obj);
30264         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
30265         obj_conv.is_owned = false;
30266         LDKCVec_u8Z ret_var = UntrustedString_write(&obj_conv);
30267         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
30268         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
30269         CVec_u8Z_free(ret_var);
30270         return ret_arr;
30271 }
30272
30273 uint64_t  __attribute__((export_name("TS_UntrustedString_read"))) TS_UntrustedString_read(int8_tArray ser) {
30274         LDKu8slice ser_ref;
30275         ser_ref.datalen = ser->arr_len;
30276         ser_ref.data = ser->elems;
30277         LDKCResult_UntrustedStringDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UntrustedStringDecodeErrorZ), "LDKCResult_UntrustedStringDecodeErrorZ");
30278         *ret_conv = UntrustedString_read(ser_ref);
30279         FREE(ser);
30280         return tag_ptr(ret_conv, true);
30281 }
30282
30283 void  __attribute__((export_name("TS_PrintableString_free"))) TS_PrintableString_free(uint64_t this_obj) {
30284         LDKPrintableString this_obj_conv;
30285         this_obj_conv.inner = untag_ptr(this_obj);
30286         this_obj_conv.is_owned = ptr_is_owned(this_obj);
30287         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
30288         PrintableString_free(this_obj_conv);
30289 }
30290
30291 jstring  __attribute__((export_name("TS_PrintableString_get_a"))) TS_PrintableString_get_a(uint64_t this_ptr) {
30292         LDKPrintableString this_ptr_conv;
30293         this_ptr_conv.inner = untag_ptr(this_ptr);
30294         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
30295         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
30296         this_ptr_conv.is_owned = false;
30297         LDKStr ret_str = PrintableString_get_a(&this_ptr_conv);
30298         jstring ret_conv = str_ref_to_ts(ret_str.chars, ret_str.len);
30299         Str_free(ret_str);
30300         return ret_conv;
30301 }
30302
30303 void  __attribute__((export_name("TS_PrintableString_set_a"))) TS_PrintableString_set_a(uint64_t this_ptr, jstring val) {
30304         LDKPrintableString this_ptr_conv;
30305         this_ptr_conv.inner = untag_ptr(this_ptr);
30306         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
30307         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
30308         this_ptr_conv.is_owned = false;
30309         LDKStr val_conv = str_ref_to_owned_c(val);
30310         PrintableString_set_a(&this_ptr_conv, val_conv);
30311 }
30312
30313 uint64_t  __attribute__((export_name("TS_PrintableString_new"))) TS_PrintableString_new(jstring a_arg) {
30314         LDKStr a_arg_conv = str_ref_to_owned_c(a_arg);
30315         LDKPrintableString ret_var = PrintableString_new(a_arg_conv);
30316         uint64_t ret_ref = 0;
30317         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
30318         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
30319         return ret_ref;
30320 }
30321
30322 void  __attribute__((export_name("TS_FutureCallback_free"))) TS_FutureCallback_free(uint64_t this_ptr) {
30323         if (!ptr_is_owned(this_ptr)) return;
30324         void* this_ptr_ptr = untag_ptr(this_ptr);
30325         CHECK_ACCESS(this_ptr_ptr);
30326         LDKFutureCallback this_ptr_conv = *(LDKFutureCallback*)(this_ptr_ptr);
30327         FREE(untag_ptr(this_ptr));
30328         FutureCallback_free(this_ptr_conv);
30329 }
30330
30331 void  __attribute__((export_name("TS_Future_free"))) TS_Future_free(uint64_t this_obj) {
30332         LDKFuture this_obj_conv;
30333         this_obj_conv.inner = untag_ptr(this_obj);
30334         this_obj_conv.is_owned = ptr_is_owned(this_obj);
30335         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
30336         Future_free(this_obj_conv);
30337 }
30338
30339 static inline uint64_t Future_clone_ptr(LDKFuture *NONNULL_PTR arg) {
30340         LDKFuture ret_var = Future_clone(arg);
30341         uint64_t ret_ref = 0;
30342         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
30343         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
30344         return ret_ref;
30345 }
30346 int64_t  __attribute__((export_name("TS_Future_clone_ptr"))) TS_Future_clone_ptr(uint64_t arg) {
30347         LDKFuture arg_conv;
30348         arg_conv.inner = untag_ptr(arg);
30349         arg_conv.is_owned = ptr_is_owned(arg);
30350         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
30351         arg_conv.is_owned = false;
30352         int64_t ret_conv = Future_clone_ptr(&arg_conv);
30353         return ret_conv;
30354 }
30355
30356 uint64_t  __attribute__((export_name("TS_Future_clone"))) TS_Future_clone(uint64_t orig) {
30357         LDKFuture orig_conv;
30358         orig_conv.inner = untag_ptr(orig);
30359         orig_conv.is_owned = ptr_is_owned(orig);
30360         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
30361         orig_conv.is_owned = false;
30362         LDKFuture ret_var = Future_clone(&orig_conv);
30363         uint64_t ret_ref = 0;
30364         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
30365         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
30366         return ret_ref;
30367 }
30368
30369 void  __attribute__((export_name("TS_Future_register_callback_fn"))) TS_Future_register_callback_fn(uint64_t this_arg, uint64_t callback) {
30370         LDKFuture this_arg_conv;
30371         this_arg_conv.inner = untag_ptr(this_arg);
30372         this_arg_conv.is_owned = ptr_is_owned(this_arg);
30373         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
30374         this_arg_conv.is_owned = false;
30375         void* callback_ptr = untag_ptr(callback);
30376         CHECK_ACCESS(callback_ptr);
30377         LDKFutureCallback callback_conv = *(LDKFutureCallback*)(callback_ptr);
30378         if (callback_conv.free == LDKFutureCallback_JCalls_free) {
30379                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
30380                 LDKFutureCallback_JCalls_cloned(&callback_conv);
30381         }
30382         Future_register_callback_fn(&this_arg_conv, callback_conv);
30383 }
30384
30385 uint32_t  __attribute__((export_name("TS_Level_clone"))) TS_Level_clone(uint64_t orig) {
30386         LDKLevel* orig_conv = (LDKLevel*)untag_ptr(orig);
30387         uint32_t ret_conv = LDKLevel_to_js(Level_clone(orig_conv));
30388         return ret_conv;
30389 }
30390
30391 uint32_t  __attribute__((export_name("TS_Level_gossip"))) TS_Level_gossip() {
30392         uint32_t ret_conv = LDKLevel_to_js(Level_gossip());
30393         return ret_conv;
30394 }
30395
30396 uint32_t  __attribute__((export_name("TS_Level_trace"))) TS_Level_trace() {
30397         uint32_t ret_conv = LDKLevel_to_js(Level_trace());
30398         return ret_conv;
30399 }
30400
30401 uint32_t  __attribute__((export_name("TS_Level_debug"))) TS_Level_debug() {
30402         uint32_t ret_conv = LDKLevel_to_js(Level_debug());
30403         return ret_conv;
30404 }
30405
30406 uint32_t  __attribute__((export_name("TS_Level_info"))) TS_Level_info() {
30407         uint32_t ret_conv = LDKLevel_to_js(Level_info());
30408         return ret_conv;
30409 }
30410
30411 uint32_t  __attribute__((export_name("TS_Level_warn"))) TS_Level_warn() {
30412         uint32_t ret_conv = LDKLevel_to_js(Level_warn());
30413         return ret_conv;
30414 }
30415
30416 uint32_t  __attribute__((export_name("TS_Level_error"))) TS_Level_error() {
30417         uint32_t ret_conv = LDKLevel_to_js(Level_error());
30418         return ret_conv;
30419 }
30420
30421 jboolean  __attribute__((export_name("TS_Level_eq"))) TS_Level_eq(uint64_t a, uint64_t b) {
30422         LDKLevel* a_conv = (LDKLevel*)untag_ptr(a);
30423         LDKLevel* b_conv = (LDKLevel*)untag_ptr(b);
30424         jboolean ret_conv = Level_eq(a_conv, b_conv);
30425         return ret_conv;
30426 }
30427
30428 int64_t  __attribute__((export_name("TS_Level_hash"))) TS_Level_hash(uint64_t o) {
30429         LDKLevel* o_conv = (LDKLevel*)untag_ptr(o);
30430         int64_t ret_conv = Level_hash(o_conv);
30431         return ret_conv;
30432 }
30433
30434 uint32_t  __attribute__((export_name("TS_Level_max"))) TS_Level_max() {
30435         uint32_t ret_conv = LDKLevel_to_js(Level_max());
30436         return ret_conv;
30437 }
30438
30439 void  __attribute__((export_name("TS_Record_free"))) TS_Record_free(uint64_t this_obj) {
30440         LDKRecord this_obj_conv;
30441         this_obj_conv.inner = untag_ptr(this_obj);
30442         this_obj_conv.is_owned = ptr_is_owned(this_obj);
30443         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
30444         Record_free(this_obj_conv);
30445 }
30446
30447 uint32_t  __attribute__((export_name("TS_Record_get_level"))) TS_Record_get_level(uint64_t this_ptr) {
30448         LDKRecord this_ptr_conv;
30449         this_ptr_conv.inner = untag_ptr(this_ptr);
30450         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
30451         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
30452         this_ptr_conv.is_owned = false;
30453         uint32_t ret_conv = LDKLevel_to_js(Record_get_level(&this_ptr_conv));
30454         return ret_conv;
30455 }
30456
30457 void  __attribute__((export_name("TS_Record_set_level"))) TS_Record_set_level(uint64_t this_ptr, uint32_t val) {
30458         LDKRecord this_ptr_conv;
30459         this_ptr_conv.inner = untag_ptr(this_ptr);
30460         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
30461         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
30462         this_ptr_conv.is_owned = false;
30463         LDKLevel val_conv = LDKLevel_from_js(val);
30464         Record_set_level(&this_ptr_conv, val_conv);
30465 }
30466
30467 jstring  __attribute__((export_name("TS_Record_get_args"))) TS_Record_get_args(uint64_t this_ptr) {
30468         LDKRecord this_ptr_conv;
30469         this_ptr_conv.inner = untag_ptr(this_ptr);
30470         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
30471         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
30472         this_ptr_conv.is_owned = false;
30473         LDKStr ret_str = Record_get_args(&this_ptr_conv);
30474         jstring ret_conv = str_ref_to_ts(ret_str.chars, ret_str.len);
30475         Str_free(ret_str);
30476         return ret_conv;
30477 }
30478
30479 void  __attribute__((export_name("TS_Record_set_args"))) TS_Record_set_args(uint64_t this_ptr, jstring val) {
30480         LDKRecord this_ptr_conv;
30481         this_ptr_conv.inner = untag_ptr(this_ptr);
30482         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
30483         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
30484         this_ptr_conv.is_owned = false;
30485         LDKStr val_conv = str_ref_to_owned_c(val);
30486         Record_set_args(&this_ptr_conv, val_conv);
30487 }
30488
30489 jstring  __attribute__((export_name("TS_Record_get_module_path"))) TS_Record_get_module_path(uint64_t this_ptr) {
30490         LDKRecord this_ptr_conv;
30491         this_ptr_conv.inner = untag_ptr(this_ptr);
30492         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
30493         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
30494         this_ptr_conv.is_owned = false;
30495         LDKStr ret_str = Record_get_module_path(&this_ptr_conv);
30496         jstring ret_conv = str_ref_to_ts(ret_str.chars, ret_str.len);
30497         Str_free(ret_str);
30498         return ret_conv;
30499 }
30500
30501 void  __attribute__((export_name("TS_Record_set_module_path"))) TS_Record_set_module_path(uint64_t this_ptr, jstring val) {
30502         LDKRecord this_ptr_conv;
30503         this_ptr_conv.inner = untag_ptr(this_ptr);
30504         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
30505         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
30506         this_ptr_conv.is_owned = false;
30507         LDKStr val_conv = str_ref_to_owned_c(val);
30508         Record_set_module_path(&this_ptr_conv, val_conv);
30509 }
30510
30511 jstring  __attribute__((export_name("TS_Record_get_file"))) TS_Record_get_file(uint64_t this_ptr) {
30512         LDKRecord this_ptr_conv;
30513         this_ptr_conv.inner = untag_ptr(this_ptr);
30514         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
30515         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
30516         this_ptr_conv.is_owned = false;
30517         LDKStr ret_str = Record_get_file(&this_ptr_conv);
30518         jstring ret_conv = str_ref_to_ts(ret_str.chars, ret_str.len);
30519         Str_free(ret_str);
30520         return ret_conv;
30521 }
30522
30523 void  __attribute__((export_name("TS_Record_set_file"))) TS_Record_set_file(uint64_t this_ptr, jstring val) {
30524         LDKRecord this_ptr_conv;
30525         this_ptr_conv.inner = untag_ptr(this_ptr);
30526         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
30527         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
30528         this_ptr_conv.is_owned = false;
30529         LDKStr val_conv = str_ref_to_owned_c(val);
30530         Record_set_file(&this_ptr_conv, val_conv);
30531 }
30532
30533 int32_t  __attribute__((export_name("TS_Record_get_line"))) TS_Record_get_line(uint64_t this_ptr) {
30534         LDKRecord this_ptr_conv;
30535         this_ptr_conv.inner = untag_ptr(this_ptr);
30536         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
30537         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
30538         this_ptr_conv.is_owned = false;
30539         int32_t ret_conv = Record_get_line(&this_ptr_conv);
30540         return ret_conv;
30541 }
30542
30543 void  __attribute__((export_name("TS_Record_set_line"))) TS_Record_set_line(uint64_t this_ptr, int32_t val) {
30544         LDKRecord this_ptr_conv;
30545         this_ptr_conv.inner = untag_ptr(this_ptr);
30546         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
30547         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
30548         this_ptr_conv.is_owned = false;
30549         Record_set_line(&this_ptr_conv, val);
30550 }
30551
30552 static inline uint64_t Record_clone_ptr(LDKRecord *NONNULL_PTR arg) {
30553         LDKRecord ret_var = Record_clone(arg);
30554         uint64_t ret_ref = 0;
30555         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
30556         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
30557         return ret_ref;
30558 }
30559 int64_t  __attribute__((export_name("TS_Record_clone_ptr"))) TS_Record_clone_ptr(uint64_t arg) {
30560         LDKRecord arg_conv;
30561         arg_conv.inner = untag_ptr(arg);
30562         arg_conv.is_owned = ptr_is_owned(arg);
30563         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
30564         arg_conv.is_owned = false;
30565         int64_t ret_conv = Record_clone_ptr(&arg_conv);
30566         return ret_conv;
30567 }
30568
30569 uint64_t  __attribute__((export_name("TS_Record_clone"))) TS_Record_clone(uint64_t orig) {
30570         LDKRecord orig_conv;
30571         orig_conv.inner = untag_ptr(orig);
30572         orig_conv.is_owned = ptr_is_owned(orig);
30573         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
30574         orig_conv.is_owned = false;
30575         LDKRecord ret_var = Record_clone(&orig_conv);
30576         uint64_t ret_ref = 0;
30577         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
30578         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
30579         return ret_ref;
30580 }
30581
30582 void  __attribute__((export_name("TS_Logger_free"))) TS_Logger_free(uint64_t this_ptr) {
30583         if (!ptr_is_owned(this_ptr)) return;
30584         void* this_ptr_ptr = untag_ptr(this_ptr);
30585         CHECK_ACCESS(this_ptr_ptr);
30586         LDKLogger this_ptr_conv = *(LDKLogger*)(this_ptr_ptr);
30587         FREE(untag_ptr(this_ptr));
30588         Logger_free(this_ptr_conv);
30589 }
30590
30591 void  __attribute__((export_name("TS_ChannelHandshakeConfig_free"))) TS_ChannelHandshakeConfig_free(uint64_t this_obj) {
30592         LDKChannelHandshakeConfig this_obj_conv;
30593         this_obj_conv.inner = untag_ptr(this_obj);
30594         this_obj_conv.is_owned = ptr_is_owned(this_obj);
30595         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
30596         ChannelHandshakeConfig_free(this_obj_conv);
30597 }
30598
30599 int32_t  __attribute__((export_name("TS_ChannelHandshakeConfig_get_minimum_depth"))) TS_ChannelHandshakeConfig_get_minimum_depth(uint64_t this_ptr) {
30600         LDKChannelHandshakeConfig this_ptr_conv;
30601         this_ptr_conv.inner = untag_ptr(this_ptr);
30602         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
30603         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
30604         this_ptr_conv.is_owned = false;
30605         int32_t ret_conv = ChannelHandshakeConfig_get_minimum_depth(&this_ptr_conv);
30606         return ret_conv;
30607 }
30608
30609 void  __attribute__((export_name("TS_ChannelHandshakeConfig_set_minimum_depth"))) TS_ChannelHandshakeConfig_set_minimum_depth(uint64_t this_ptr, int32_t val) {
30610         LDKChannelHandshakeConfig this_ptr_conv;
30611         this_ptr_conv.inner = untag_ptr(this_ptr);
30612         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
30613         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
30614         this_ptr_conv.is_owned = false;
30615         ChannelHandshakeConfig_set_minimum_depth(&this_ptr_conv, val);
30616 }
30617
30618 int16_t  __attribute__((export_name("TS_ChannelHandshakeConfig_get_our_to_self_delay"))) TS_ChannelHandshakeConfig_get_our_to_self_delay(uint64_t this_ptr) {
30619         LDKChannelHandshakeConfig this_ptr_conv;
30620         this_ptr_conv.inner = untag_ptr(this_ptr);
30621         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
30622         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
30623         this_ptr_conv.is_owned = false;
30624         int16_t ret_conv = ChannelHandshakeConfig_get_our_to_self_delay(&this_ptr_conv);
30625         return ret_conv;
30626 }
30627
30628 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) {
30629         LDKChannelHandshakeConfig this_ptr_conv;
30630         this_ptr_conv.inner = untag_ptr(this_ptr);
30631         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
30632         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
30633         this_ptr_conv.is_owned = false;
30634         ChannelHandshakeConfig_set_our_to_self_delay(&this_ptr_conv, val);
30635 }
30636
30637 int64_t  __attribute__((export_name("TS_ChannelHandshakeConfig_get_our_htlc_minimum_msat"))) TS_ChannelHandshakeConfig_get_our_htlc_minimum_msat(uint64_t this_ptr) {
30638         LDKChannelHandshakeConfig this_ptr_conv;
30639         this_ptr_conv.inner = untag_ptr(this_ptr);
30640         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
30641         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
30642         this_ptr_conv.is_owned = false;
30643         int64_t ret_conv = ChannelHandshakeConfig_get_our_htlc_minimum_msat(&this_ptr_conv);
30644         return ret_conv;
30645 }
30646
30647 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) {
30648         LDKChannelHandshakeConfig this_ptr_conv;
30649         this_ptr_conv.inner = untag_ptr(this_ptr);
30650         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
30651         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
30652         this_ptr_conv.is_owned = false;
30653         ChannelHandshakeConfig_set_our_htlc_minimum_msat(&this_ptr_conv, val);
30654 }
30655
30656 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) {
30657         LDKChannelHandshakeConfig this_ptr_conv;
30658         this_ptr_conv.inner = untag_ptr(this_ptr);
30659         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
30660         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
30661         this_ptr_conv.is_owned = false;
30662         int8_t ret_conv = ChannelHandshakeConfig_get_max_inbound_htlc_value_in_flight_percent_of_channel(&this_ptr_conv);
30663         return ret_conv;
30664 }
30665
30666 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) {
30667         LDKChannelHandshakeConfig this_ptr_conv;
30668         this_ptr_conv.inner = untag_ptr(this_ptr);
30669         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
30670         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
30671         this_ptr_conv.is_owned = false;
30672         ChannelHandshakeConfig_set_max_inbound_htlc_value_in_flight_percent_of_channel(&this_ptr_conv, val);
30673 }
30674
30675 jboolean  __attribute__((export_name("TS_ChannelHandshakeConfig_get_negotiate_scid_privacy"))) TS_ChannelHandshakeConfig_get_negotiate_scid_privacy(uint64_t this_ptr) {
30676         LDKChannelHandshakeConfig this_ptr_conv;
30677         this_ptr_conv.inner = untag_ptr(this_ptr);
30678         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
30679         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
30680         this_ptr_conv.is_owned = false;
30681         jboolean ret_conv = ChannelHandshakeConfig_get_negotiate_scid_privacy(&this_ptr_conv);
30682         return ret_conv;
30683 }
30684
30685 void  __attribute__((export_name("TS_ChannelHandshakeConfig_set_negotiate_scid_privacy"))) TS_ChannelHandshakeConfig_set_negotiate_scid_privacy(uint64_t this_ptr, jboolean val) {
30686         LDKChannelHandshakeConfig this_ptr_conv;
30687         this_ptr_conv.inner = untag_ptr(this_ptr);
30688         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
30689         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
30690         this_ptr_conv.is_owned = false;
30691         ChannelHandshakeConfig_set_negotiate_scid_privacy(&this_ptr_conv, val);
30692 }
30693
30694 jboolean  __attribute__((export_name("TS_ChannelHandshakeConfig_get_announced_channel"))) TS_ChannelHandshakeConfig_get_announced_channel(uint64_t this_ptr) {
30695         LDKChannelHandshakeConfig this_ptr_conv;
30696         this_ptr_conv.inner = untag_ptr(this_ptr);
30697         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
30698         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
30699         this_ptr_conv.is_owned = false;
30700         jboolean ret_conv = ChannelHandshakeConfig_get_announced_channel(&this_ptr_conv);
30701         return ret_conv;
30702 }
30703
30704 void  __attribute__((export_name("TS_ChannelHandshakeConfig_set_announced_channel"))) TS_ChannelHandshakeConfig_set_announced_channel(uint64_t this_ptr, jboolean val) {
30705         LDKChannelHandshakeConfig this_ptr_conv;
30706         this_ptr_conv.inner = untag_ptr(this_ptr);
30707         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
30708         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
30709         this_ptr_conv.is_owned = false;
30710         ChannelHandshakeConfig_set_announced_channel(&this_ptr_conv, val);
30711 }
30712
30713 jboolean  __attribute__((export_name("TS_ChannelHandshakeConfig_get_commit_upfront_shutdown_pubkey"))) TS_ChannelHandshakeConfig_get_commit_upfront_shutdown_pubkey(uint64_t this_ptr) {
30714         LDKChannelHandshakeConfig this_ptr_conv;
30715         this_ptr_conv.inner = untag_ptr(this_ptr);
30716         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
30717         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
30718         this_ptr_conv.is_owned = false;
30719         jboolean ret_conv = ChannelHandshakeConfig_get_commit_upfront_shutdown_pubkey(&this_ptr_conv);
30720         return ret_conv;
30721 }
30722
30723 void  __attribute__((export_name("TS_ChannelHandshakeConfig_set_commit_upfront_shutdown_pubkey"))) TS_ChannelHandshakeConfig_set_commit_upfront_shutdown_pubkey(uint64_t this_ptr, jboolean val) {
30724         LDKChannelHandshakeConfig this_ptr_conv;
30725         this_ptr_conv.inner = untag_ptr(this_ptr);
30726         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
30727         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
30728         this_ptr_conv.is_owned = false;
30729         ChannelHandshakeConfig_set_commit_upfront_shutdown_pubkey(&this_ptr_conv, val);
30730 }
30731
30732 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) {
30733         LDKChannelHandshakeConfig this_ptr_conv;
30734         this_ptr_conv.inner = untag_ptr(this_ptr);
30735         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
30736         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
30737         this_ptr_conv.is_owned = false;
30738         int32_t ret_conv = ChannelHandshakeConfig_get_their_channel_reserve_proportional_millionths(&this_ptr_conv);
30739         return ret_conv;
30740 }
30741
30742 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) {
30743         LDKChannelHandshakeConfig this_ptr_conv;
30744         this_ptr_conv.inner = untag_ptr(this_ptr);
30745         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
30746         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
30747         this_ptr_conv.is_owned = false;
30748         ChannelHandshakeConfig_set_their_channel_reserve_proportional_millionths(&this_ptr_conv, val);
30749 }
30750
30751 jboolean  __attribute__((export_name("TS_ChannelHandshakeConfig_get_negotiate_anchors_zero_fee_htlc_tx"))) TS_ChannelHandshakeConfig_get_negotiate_anchors_zero_fee_htlc_tx(uint64_t this_ptr) {
30752         LDKChannelHandshakeConfig this_ptr_conv;
30753         this_ptr_conv.inner = untag_ptr(this_ptr);
30754         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
30755         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
30756         this_ptr_conv.is_owned = false;
30757         jboolean ret_conv = ChannelHandshakeConfig_get_negotiate_anchors_zero_fee_htlc_tx(&this_ptr_conv);
30758         return ret_conv;
30759 }
30760
30761 void  __attribute__((export_name("TS_ChannelHandshakeConfig_set_negotiate_anchors_zero_fee_htlc_tx"))) TS_ChannelHandshakeConfig_set_negotiate_anchors_zero_fee_htlc_tx(uint64_t this_ptr, jboolean val) {
30762         LDKChannelHandshakeConfig this_ptr_conv;
30763         this_ptr_conv.inner = untag_ptr(this_ptr);
30764         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
30765         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
30766         this_ptr_conv.is_owned = false;
30767         ChannelHandshakeConfig_set_negotiate_anchors_zero_fee_htlc_tx(&this_ptr_conv, val);
30768 }
30769
30770 int16_t  __attribute__((export_name("TS_ChannelHandshakeConfig_get_our_max_accepted_htlcs"))) TS_ChannelHandshakeConfig_get_our_max_accepted_htlcs(uint64_t this_ptr) {
30771         LDKChannelHandshakeConfig this_ptr_conv;
30772         this_ptr_conv.inner = untag_ptr(this_ptr);
30773         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
30774         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
30775         this_ptr_conv.is_owned = false;
30776         int16_t ret_conv = ChannelHandshakeConfig_get_our_max_accepted_htlcs(&this_ptr_conv);
30777         return ret_conv;
30778 }
30779
30780 void  __attribute__((export_name("TS_ChannelHandshakeConfig_set_our_max_accepted_htlcs"))) TS_ChannelHandshakeConfig_set_our_max_accepted_htlcs(uint64_t this_ptr, int16_t val) {
30781         LDKChannelHandshakeConfig this_ptr_conv;
30782         this_ptr_conv.inner = untag_ptr(this_ptr);
30783         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
30784         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
30785         this_ptr_conv.is_owned = false;
30786         ChannelHandshakeConfig_set_our_max_accepted_htlcs(&this_ptr_conv, val);
30787 }
30788
30789 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, jboolean negotiate_anchors_zero_fee_htlc_tx_arg, int16_t our_max_accepted_htlcs_arg) {
30790         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, negotiate_anchors_zero_fee_htlc_tx_arg, our_max_accepted_htlcs_arg);
30791         uint64_t ret_ref = 0;
30792         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
30793         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
30794         return ret_ref;
30795 }
30796
30797 static inline uint64_t ChannelHandshakeConfig_clone_ptr(LDKChannelHandshakeConfig *NONNULL_PTR arg) {
30798         LDKChannelHandshakeConfig ret_var = ChannelHandshakeConfig_clone(arg);
30799         uint64_t ret_ref = 0;
30800         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
30801         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
30802         return ret_ref;
30803 }
30804 int64_t  __attribute__((export_name("TS_ChannelHandshakeConfig_clone_ptr"))) TS_ChannelHandshakeConfig_clone_ptr(uint64_t arg) {
30805         LDKChannelHandshakeConfig arg_conv;
30806         arg_conv.inner = untag_ptr(arg);
30807         arg_conv.is_owned = ptr_is_owned(arg);
30808         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
30809         arg_conv.is_owned = false;
30810         int64_t ret_conv = ChannelHandshakeConfig_clone_ptr(&arg_conv);
30811         return ret_conv;
30812 }
30813
30814 uint64_t  __attribute__((export_name("TS_ChannelHandshakeConfig_clone"))) TS_ChannelHandshakeConfig_clone(uint64_t orig) {
30815         LDKChannelHandshakeConfig orig_conv;
30816         orig_conv.inner = untag_ptr(orig);
30817         orig_conv.is_owned = ptr_is_owned(orig);
30818         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
30819         orig_conv.is_owned = false;
30820         LDKChannelHandshakeConfig ret_var = ChannelHandshakeConfig_clone(&orig_conv);
30821         uint64_t ret_ref = 0;
30822         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
30823         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
30824         return ret_ref;
30825 }
30826
30827 uint64_t  __attribute__((export_name("TS_ChannelHandshakeConfig_default"))) TS_ChannelHandshakeConfig_default() {
30828         LDKChannelHandshakeConfig ret_var = ChannelHandshakeConfig_default();
30829         uint64_t ret_ref = 0;
30830         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
30831         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
30832         return ret_ref;
30833 }
30834
30835 void  __attribute__((export_name("TS_ChannelHandshakeLimits_free"))) TS_ChannelHandshakeLimits_free(uint64_t this_obj) {
30836         LDKChannelHandshakeLimits this_obj_conv;
30837         this_obj_conv.inner = untag_ptr(this_obj);
30838         this_obj_conv.is_owned = ptr_is_owned(this_obj);
30839         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
30840         ChannelHandshakeLimits_free(this_obj_conv);
30841 }
30842
30843 int64_t  __attribute__((export_name("TS_ChannelHandshakeLimits_get_min_funding_satoshis"))) TS_ChannelHandshakeLimits_get_min_funding_satoshis(uint64_t this_ptr) {
30844         LDKChannelHandshakeLimits this_ptr_conv;
30845         this_ptr_conv.inner = untag_ptr(this_ptr);
30846         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
30847         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
30848         this_ptr_conv.is_owned = false;
30849         int64_t ret_conv = ChannelHandshakeLimits_get_min_funding_satoshis(&this_ptr_conv);
30850         return ret_conv;
30851 }
30852
30853 void  __attribute__((export_name("TS_ChannelHandshakeLimits_set_min_funding_satoshis"))) TS_ChannelHandshakeLimits_set_min_funding_satoshis(uint64_t this_ptr, int64_t val) {
30854         LDKChannelHandshakeLimits this_ptr_conv;
30855         this_ptr_conv.inner = untag_ptr(this_ptr);
30856         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
30857         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
30858         this_ptr_conv.is_owned = false;
30859         ChannelHandshakeLimits_set_min_funding_satoshis(&this_ptr_conv, val);
30860 }
30861
30862 int64_t  __attribute__((export_name("TS_ChannelHandshakeLimits_get_max_funding_satoshis"))) TS_ChannelHandshakeLimits_get_max_funding_satoshis(uint64_t this_ptr) {
30863         LDKChannelHandshakeLimits this_ptr_conv;
30864         this_ptr_conv.inner = untag_ptr(this_ptr);
30865         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
30866         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
30867         this_ptr_conv.is_owned = false;
30868         int64_t ret_conv = ChannelHandshakeLimits_get_max_funding_satoshis(&this_ptr_conv);
30869         return ret_conv;
30870 }
30871
30872 void  __attribute__((export_name("TS_ChannelHandshakeLimits_set_max_funding_satoshis"))) TS_ChannelHandshakeLimits_set_max_funding_satoshis(uint64_t this_ptr, int64_t val) {
30873         LDKChannelHandshakeLimits this_ptr_conv;
30874         this_ptr_conv.inner = untag_ptr(this_ptr);
30875         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
30876         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
30877         this_ptr_conv.is_owned = false;
30878         ChannelHandshakeLimits_set_max_funding_satoshis(&this_ptr_conv, val);
30879 }
30880
30881 int64_t  __attribute__((export_name("TS_ChannelHandshakeLimits_get_max_htlc_minimum_msat"))) TS_ChannelHandshakeLimits_get_max_htlc_minimum_msat(uint64_t this_ptr) {
30882         LDKChannelHandshakeLimits this_ptr_conv;
30883         this_ptr_conv.inner = untag_ptr(this_ptr);
30884         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
30885         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
30886         this_ptr_conv.is_owned = false;
30887         int64_t ret_conv = ChannelHandshakeLimits_get_max_htlc_minimum_msat(&this_ptr_conv);
30888         return ret_conv;
30889 }
30890
30891 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) {
30892         LDKChannelHandshakeLimits this_ptr_conv;
30893         this_ptr_conv.inner = untag_ptr(this_ptr);
30894         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
30895         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
30896         this_ptr_conv.is_owned = false;
30897         ChannelHandshakeLimits_set_max_htlc_minimum_msat(&this_ptr_conv, val);
30898 }
30899
30900 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) {
30901         LDKChannelHandshakeLimits this_ptr_conv;
30902         this_ptr_conv.inner = untag_ptr(this_ptr);
30903         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
30904         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
30905         this_ptr_conv.is_owned = false;
30906         int64_t ret_conv = ChannelHandshakeLimits_get_min_max_htlc_value_in_flight_msat(&this_ptr_conv);
30907         return ret_conv;
30908 }
30909
30910 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) {
30911         LDKChannelHandshakeLimits this_ptr_conv;
30912         this_ptr_conv.inner = untag_ptr(this_ptr);
30913         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
30914         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
30915         this_ptr_conv.is_owned = false;
30916         ChannelHandshakeLimits_set_min_max_htlc_value_in_flight_msat(&this_ptr_conv, val);
30917 }
30918
30919 int64_t  __attribute__((export_name("TS_ChannelHandshakeLimits_get_max_channel_reserve_satoshis"))) TS_ChannelHandshakeLimits_get_max_channel_reserve_satoshis(uint64_t this_ptr) {
30920         LDKChannelHandshakeLimits this_ptr_conv;
30921         this_ptr_conv.inner = untag_ptr(this_ptr);
30922         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
30923         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
30924         this_ptr_conv.is_owned = false;
30925         int64_t ret_conv = ChannelHandshakeLimits_get_max_channel_reserve_satoshis(&this_ptr_conv);
30926         return ret_conv;
30927 }
30928
30929 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) {
30930         LDKChannelHandshakeLimits this_ptr_conv;
30931         this_ptr_conv.inner = untag_ptr(this_ptr);
30932         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
30933         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
30934         this_ptr_conv.is_owned = false;
30935         ChannelHandshakeLimits_set_max_channel_reserve_satoshis(&this_ptr_conv, val);
30936 }
30937
30938 int16_t  __attribute__((export_name("TS_ChannelHandshakeLimits_get_min_max_accepted_htlcs"))) TS_ChannelHandshakeLimits_get_min_max_accepted_htlcs(uint64_t this_ptr) {
30939         LDKChannelHandshakeLimits this_ptr_conv;
30940         this_ptr_conv.inner = untag_ptr(this_ptr);
30941         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
30942         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
30943         this_ptr_conv.is_owned = false;
30944         int16_t ret_conv = ChannelHandshakeLimits_get_min_max_accepted_htlcs(&this_ptr_conv);
30945         return ret_conv;
30946 }
30947
30948 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) {
30949         LDKChannelHandshakeLimits this_ptr_conv;
30950         this_ptr_conv.inner = untag_ptr(this_ptr);
30951         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
30952         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
30953         this_ptr_conv.is_owned = false;
30954         ChannelHandshakeLimits_set_min_max_accepted_htlcs(&this_ptr_conv, val);
30955 }
30956
30957 int32_t  __attribute__((export_name("TS_ChannelHandshakeLimits_get_max_minimum_depth"))) TS_ChannelHandshakeLimits_get_max_minimum_depth(uint64_t this_ptr) {
30958         LDKChannelHandshakeLimits this_ptr_conv;
30959         this_ptr_conv.inner = untag_ptr(this_ptr);
30960         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
30961         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
30962         this_ptr_conv.is_owned = false;
30963         int32_t ret_conv = ChannelHandshakeLimits_get_max_minimum_depth(&this_ptr_conv);
30964         return ret_conv;
30965 }
30966
30967 void  __attribute__((export_name("TS_ChannelHandshakeLimits_set_max_minimum_depth"))) TS_ChannelHandshakeLimits_set_max_minimum_depth(uint64_t this_ptr, int32_t val) {
30968         LDKChannelHandshakeLimits this_ptr_conv;
30969         this_ptr_conv.inner = untag_ptr(this_ptr);
30970         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
30971         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
30972         this_ptr_conv.is_owned = false;
30973         ChannelHandshakeLimits_set_max_minimum_depth(&this_ptr_conv, val);
30974 }
30975
30976 jboolean  __attribute__((export_name("TS_ChannelHandshakeLimits_get_trust_own_funding_0conf"))) TS_ChannelHandshakeLimits_get_trust_own_funding_0conf(uint64_t this_ptr) {
30977         LDKChannelHandshakeLimits this_ptr_conv;
30978         this_ptr_conv.inner = untag_ptr(this_ptr);
30979         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
30980         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
30981         this_ptr_conv.is_owned = false;
30982         jboolean ret_conv = ChannelHandshakeLimits_get_trust_own_funding_0conf(&this_ptr_conv);
30983         return ret_conv;
30984 }
30985
30986 void  __attribute__((export_name("TS_ChannelHandshakeLimits_set_trust_own_funding_0conf"))) TS_ChannelHandshakeLimits_set_trust_own_funding_0conf(uint64_t this_ptr, jboolean val) {
30987         LDKChannelHandshakeLimits this_ptr_conv;
30988         this_ptr_conv.inner = untag_ptr(this_ptr);
30989         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
30990         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
30991         this_ptr_conv.is_owned = false;
30992         ChannelHandshakeLimits_set_trust_own_funding_0conf(&this_ptr_conv, val);
30993 }
30994
30995 jboolean  __attribute__((export_name("TS_ChannelHandshakeLimits_get_force_announced_channel_preference"))) TS_ChannelHandshakeLimits_get_force_announced_channel_preference(uint64_t this_ptr) {
30996         LDKChannelHandshakeLimits this_ptr_conv;
30997         this_ptr_conv.inner = untag_ptr(this_ptr);
30998         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
30999         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
31000         this_ptr_conv.is_owned = false;
31001         jboolean ret_conv = ChannelHandshakeLimits_get_force_announced_channel_preference(&this_ptr_conv);
31002         return ret_conv;
31003 }
31004
31005 void  __attribute__((export_name("TS_ChannelHandshakeLimits_set_force_announced_channel_preference"))) TS_ChannelHandshakeLimits_set_force_announced_channel_preference(uint64_t this_ptr, jboolean val) {
31006         LDKChannelHandshakeLimits this_ptr_conv;
31007         this_ptr_conv.inner = untag_ptr(this_ptr);
31008         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
31009         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
31010         this_ptr_conv.is_owned = false;
31011         ChannelHandshakeLimits_set_force_announced_channel_preference(&this_ptr_conv, val);
31012 }
31013
31014 int16_t  __attribute__((export_name("TS_ChannelHandshakeLimits_get_their_to_self_delay"))) TS_ChannelHandshakeLimits_get_their_to_self_delay(uint64_t this_ptr) {
31015         LDKChannelHandshakeLimits this_ptr_conv;
31016         this_ptr_conv.inner = untag_ptr(this_ptr);
31017         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
31018         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
31019         this_ptr_conv.is_owned = false;
31020         int16_t ret_conv = ChannelHandshakeLimits_get_their_to_self_delay(&this_ptr_conv);
31021         return ret_conv;
31022 }
31023
31024 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) {
31025         LDKChannelHandshakeLimits this_ptr_conv;
31026         this_ptr_conv.inner = untag_ptr(this_ptr);
31027         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
31028         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
31029         this_ptr_conv.is_owned = false;
31030         ChannelHandshakeLimits_set_their_to_self_delay(&this_ptr_conv, val);
31031 }
31032
31033 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) {
31034         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);
31035         uint64_t ret_ref = 0;
31036         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
31037         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
31038         return ret_ref;
31039 }
31040
31041 static inline uint64_t ChannelHandshakeLimits_clone_ptr(LDKChannelHandshakeLimits *NONNULL_PTR arg) {
31042         LDKChannelHandshakeLimits ret_var = ChannelHandshakeLimits_clone(arg);
31043         uint64_t ret_ref = 0;
31044         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
31045         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
31046         return ret_ref;
31047 }
31048 int64_t  __attribute__((export_name("TS_ChannelHandshakeLimits_clone_ptr"))) TS_ChannelHandshakeLimits_clone_ptr(uint64_t arg) {
31049         LDKChannelHandshakeLimits arg_conv;
31050         arg_conv.inner = untag_ptr(arg);
31051         arg_conv.is_owned = ptr_is_owned(arg);
31052         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
31053         arg_conv.is_owned = false;
31054         int64_t ret_conv = ChannelHandshakeLimits_clone_ptr(&arg_conv);
31055         return ret_conv;
31056 }
31057
31058 uint64_t  __attribute__((export_name("TS_ChannelHandshakeLimits_clone"))) TS_ChannelHandshakeLimits_clone(uint64_t orig) {
31059         LDKChannelHandshakeLimits orig_conv;
31060         orig_conv.inner = untag_ptr(orig);
31061         orig_conv.is_owned = ptr_is_owned(orig);
31062         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
31063         orig_conv.is_owned = false;
31064         LDKChannelHandshakeLimits ret_var = ChannelHandshakeLimits_clone(&orig_conv);
31065         uint64_t ret_ref = 0;
31066         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
31067         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
31068         return ret_ref;
31069 }
31070
31071 uint64_t  __attribute__((export_name("TS_ChannelHandshakeLimits_default"))) TS_ChannelHandshakeLimits_default() {
31072         LDKChannelHandshakeLimits ret_var = ChannelHandshakeLimits_default();
31073         uint64_t ret_ref = 0;
31074         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
31075         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
31076         return ret_ref;
31077 }
31078
31079 void  __attribute__((export_name("TS_MaxDustHTLCExposure_free"))) TS_MaxDustHTLCExposure_free(uint64_t this_ptr) {
31080         if (!ptr_is_owned(this_ptr)) return;
31081         void* this_ptr_ptr = untag_ptr(this_ptr);
31082         CHECK_ACCESS(this_ptr_ptr);
31083         LDKMaxDustHTLCExposure this_ptr_conv = *(LDKMaxDustHTLCExposure*)(this_ptr_ptr);
31084         FREE(untag_ptr(this_ptr));
31085         MaxDustHTLCExposure_free(this_ptr_conv);
31086 }
31087
31088 static inline uint64_t MaxDustHTLCExposure_clone_ptr(LDKMaxDustHTLCExposure *NONNULL_PTR arg) {
31089         LDKMaxDustHTLCExposure *ret_copy = MALLOC(sizeof(LDKMaxDustHTLCExposure), "LDKMaxDustHTLCExposure");
31090         *ret_copy = MaxDustHTLCExposure_clone(arg);
31091         uint64_t ret_ref = tag_ptr(ret_copy, true);
31092         return ret_ref;
31093 }
31094 int64_t  __attribute__((export_name("TS_MaxDustHTLCExposure_clone_ptr"))) TS_MaxDustHTLCExposure_clone_ptr(uint64_t arg) {
31095         LDKMaxDustHTLCExposure* arg_conv = (LDKMaxDustHTLCExposure*)untag_ptr(arg);
31096         int64_t ret_conv = MaxDustHTLCExposure_clone_ptr(arg_conv);
31097         return ret_conv;
31098 }
31099
31100 uint64_t  __attribute__((export_name("TS_MaxDustHTLCExposure_clone"))) TS_MaxDustHTLCExposure_clone(uint64_t orig) {
31101         LDKMaxDustHTLCExposure* orig_conv = (LDKMaxDustHTLCExposure*)untag_ptr(orig);
31102         LDKMaxDustHTLCExposure *ret_copy = MALLOC(sizeof(LDKMaxDustHTLCExposure), "LDKMaxDustHTLCExposure");
31103         *ret_copy = MaxDustHTLCExposure_clone(orig_conv);
31104         uint64_t ret_ref = tag_ptr(ret_copy, true);
31105         return ret_ref;
31106 }
31107
31108 uint64_t  __attribute__((export_name("TS_MaxDustHTLCExposure_fixed_limit_msat"))) TS_MaxDustHTLCExposure_fixed_limit_msat(int64_t a) {
31109         LDKMaxDustHTLCExposure *ret_copy = MALLOC(sizeof(LDKMaxDustHTLCExposure), "LDKMaxDustHTLCExposure");
31110         *ret_copy = MaxDustHTLCExposure_fixed_limit_msat(a);
31111         uint64_t ret_ref = tag_ptr(ret_copy, true);
31112         return ret_ref;
31113 }
31114
31115 uint64_t  __attribute__((export_name("TS_MaxDustHTLCExposure_fee_rate_multiplier"))) TS_MaxDustHTLCExposure_fee_rate_multiplier(int64_t a) {
31116         LDKMaxDustHTLCExposure *ret_copy = MALLOC(sizeof(LDKMaxDustHTLCExposure), "LDKMaxDustHTLCExposure");
31117         *ret_copy = MaxDustHTLCExposure_fee_rate_multiplier(a);
31118         uint64_t ret_ref = tag_ptr(ret_copy, true);
31119         return ret_ref;
31120 }
31121
31122 jboolean  __attribute__((export_name("TS_MaxDustHTLCExposure_eq"))) TS_MaxDustHTLCExposure_eq(uint64_t a, uint64_t b) {
31123         LDKMaxDustHTLCExposure* a_conv = (LDKMaxDustHTLCExposure*)untag_ptr(a);
31124         LDKMaxDustHTLCExposure* b_conv = (LDKMaxDustHTLCExposure*)untag_ptr(b);
31125         jboolean ret_conv = MaxDustHTLCExposure_eq(a_conv, b_conv);
31126         return ret_conv;
31127 }
31128
31129 int8_tArray  __attribute__((export_name("TS_MaxDustHTLCExposure_write"))) TS_MaxDustHTLCExposure_write(uint64_t obj) {
31130         LDKMaxDustHTLCExposure* obj_conv = (LDKMaxDustHTLCExposure*)untag_ptr(obj);
31131         LDKCVec_u8Z ret_var = MaxDustHTLCExposure_write(obj_conv);
31132         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
31133         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
31134         CVec_u8Z_free(ret_var);
31135         return ret_arr;
31136 }
31137
31138 uint64_t  __attribute__((export_name("TS_MaxDustHTLCExposure_read"))) TS_MaxDustHTLCExposure_read(int8_tArray ser) {
31139         LDKu8slice ser_ref;
31140         ser_ref.datalen = ser->arr_len;
31141         ser_ref.data = ser->elems;
31142         LDKCResult_MaxDustHTLCExposureDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_MaxDustHTLCExposureDecodeErrorZ), "LDKCResult_MaxDustHTLCExposureDecodeErrorZ");
31143         *ret_conv = MaxDustHTLCExposure_read(ser_ref);
31144         FREE(ser);
31145         return tag_ptr(ret_conv, true);
31146 }
31147
31148 void  __attribute__((export_name("TS_ChannelConfig_free"))) TS_ChannelConfig_free(uint64_t this_obj) {
31149         LDKChannelConfig this_obj_conv;
31150         this_obj_conv.inner = untag_ptr(this_obj);
31151         this_obj_conv.is_owned = ptr_is_owned(this_obj);
31152         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
31153         ChannelConfig_free(this_obj_conv);
31154 }
31155
31156 int32_t  __attribute__((export_name("TS_ChannelConfig_get_forwarding_fee_proportional_millionths"))) TS_ChannelConfig_get_forwarding_fee_proportional_millionths(uint64_t this_ptr) {
31157         LDKChannelConfig this_ptr_conv;
31158         this_ptr_conv.inner = untag_ptr(this_ptr);
31159         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
31160         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
31161         this_ptr_conv.is_owned = false;
31162         int32_t ret_conv = ChannelConfig_get_forwarding_fee_proportional_millionths(&this_ptr_conv);
31163         return ret_conv;
31164 }
31165
31166 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) {
31167         LDKChannelConfig this_ptr_conv;
31168         this_ptr_conv.inner = untag_ptr(this_ptr);
31169         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
31170         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
31171         this_ptr_conv.is_owned = false;
31172         ChannelConfig_set_forwarding_fee_proportional_millionths(&this_ptr_conv, val);
31173 }
31174
31175 int32_t  __attribute__((export_name("TS_ChannelConfig_get_forwarding_fee_base_msat"))) TS_ChannelConfig_get_forwarding_fee_base_msat(uint64_t this_ptr) {
31176         LDKChannelConfig this_ptr_conv;
31177         this_ptr_conv.inner = untag_ptr(this_ptr);
31178         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
31179         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
31180         this_ptr_conv.is_owned = false;
31181         int32_t ret_conv = ChannelConfig_get_forwarding_fee_base_msat(&this_ptr_conv);
31182         return ret_conv;
31183 }
31184
31185 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) {
31186         LDKChannelConfig this_ptr_conv;
31187         this_ptr_conv.inner = untag_ptr(this_ptr);
31188         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
31189         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
31190         this_ptr_conv.is_owned = false;
31191         ChannelConfig_set_forwarding_fee_base_msat(&this_ptr_conv, val);
31192 }
31193
31194 int16_t  __attribute__((export_name("TS_ChannelConfig_get_cltv_expiry_delta"))) TS_ChannelConfig_get_cltv_expiry_delta(uint64_t this_ptr) {
31195         LDKChannelConfig this_ptr_conv;
31196         this_ptr_conv.inner = untag_ptr(this_ptr);
31197         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
31198         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
31199         this_ptr_conv.is_owned = false;
31200         int16_t ret_conv = ChannelConfig_get_cltv_expiry_delta(&this_ptr_conv);
31201         return ret_conv;
31202 }
31203
31204 void  __attribute__((export_name("TS_ChannelConfig_set_cltv_expiry_delta"))) TS_ChannelConfig_set_cltv_expiry_delta(uint64_t this_ptr, int16_t val) {
31205         LDKChannelConfig this_ptr_conv;
31206         this_ptr_conv.inner = untag_ptr(this_ptr);
31207         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
31208         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
31209         this_ptr_conv.is_owned = false;
31210         ChannelConfig_set_cltv_expiry_delta(&this_ptr_conv, val);
31211 }
31212
31213 uint64_t  __attribute__((export_name("TS_ChannelConfig_get_max_dust_htlc_exposure"))) TS_ChannelConfig_get_max_dust_htlc_exposure(uint64_t this_ptr) {
31214         LDKChannelConfig 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         LDKMaxDustHTLCExposure *ret_copy = MALLOC(sizeof(LDKMaxDustHTLCExposure), "LDKMaxDustHTLCExposure");
31220         *ret_copy = ChannelConfig_get_max_dust_htlc_exposure(&this_ptr_conv);
31221         uint64_t ret_ref = tag_ptr(ret_copy, true);
31222         return ret_ref;
31223 }
31224
31225 void  __attribute__((export_name("TS_ChannelConfig_set_max_dust_htlc_exposure"))) TS_ChannelConfig_set_max_dust_htlc_exposure(uint64_t this_ptr, uint64_t val) {
31226         LDKChannelConfig this_ptr_conv;
31227         this_ptr_conv.inner = untag_ptr(this_ptr);
31228         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
31229         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
31230         this_ptr_conv.is_owned = false;
31231         void* val_ptr = untag_ptr(val);
31232         CHECK_ACCESS(val_ptr);
31233         LDKMaxDustHTLCExposure val_conv = *(LDKMaxDustHTLCExposure*)(val_ptr);
31234         val_conv = MaxDustHTLCExposure_clone((LDKMaxDustHTLCExposure*)untag_ptr(val));
31235         ChannelConfig_set_max_dust_htlc_exposure(&this_ptr_conv, val_conv);
31236 }
31237
31238 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) {
31239         LDKChannelConfig this_ptr_conv;
31240         this_ptr_conv.inner = untag_ptr(this_ptr);
31241         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
31242         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
31243         this_ptr_conv.is_owned = false;
31244         int64_t ret_conv = ChannelConfig_get_force_close_avoidance_max_fee_satoshis(&this_ptr_conv);
31245         return ret_conv;
31246 }
31247
31248 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) {
31249         LDKChannelConfig this_ptr_conv;
31250         this_ptr_conv.inner = untag_ptr(this_ptr);
31251         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
31252         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
31253         this_ptr_conv.is_owned = false;
31254         ChannelConfig_set_force_close_avoidance_max_fee_satoshis(&this_ptr_conv, val);
31255 }
31256
31257 jboolean  __attribute__((export_name("TS_ChannelConfig_get_accept_underpaying_htlcs"))) TS_ChannelConfig_get_accept_underpaying_htlcs(uint64_t this_ptr) {
31258         LDKChannelConfig this_ptr_conv;
31259         this_ptr_conv.inner = untag_ptr(this_ptr);
31260         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
31261         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
31262         this_ptr_conv.is_owned = false;
31263         jboolean ret_conv = ChannelConfig_get_accept_underpaying_htlcs(&this_ptr_conv);
31264         return ret_conv;
31265 }
31266
31267 void  __attribute__((export_name("TS_ChannelConfig_set_accept_underpaying_htlcs"))) TS_ChannelConfig_set_accept_underpaying_htlcs(uint64_t this_ptr, jboolean val) {
31268         LDKChannelConfig this_ptr_conv;
31269         this_ptr_conv.inner = untag_ptr(this_ptr);
31270         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
31271         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
31272         this_ptr_conv.is_owned = false;
31273         ChannelConfig_set_accept_underpaying_htlcs(&this_ptr_conv, val);
31274 }
31275
31276 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, uint64_t max_dust_htlc_exposure_arg, int64_t force_close_avoidance_max_fee_satoshis_arg, jboolean accept_underpaying_htlcs_arg) {
31277         void* max_dust_htlc_exposure_arg_ptr = untag_ptr(max_dust_htlc_exposure_arg);
31278         CHECK_ACCESS(max_dust_htlc_exposure_arg_ptr);
31279         LDKMaxDustHTLCExposure max_dust_htlc_exposure_arg_conv = *(LDKMaxDustHTLCExposure*)(max_dust_htlc_exposure_arg_ptr);
31280         max_dust_htlc_exposure_arg_conv = MaxDustHTLCExposure_clone((LDKMaxDustHTLCExposure*)untag_ptr(max_dust_htlc_exposure_arg));
31281         LDKChannelConfig ret_var = ChannelConfig_new(forwarding_fee_proportional_millionths_arg, forwarding_fee_base_msat_arg, cltv_expiry_delta_arg, max_dust_htlc_exposure_arg_conv, force_close_avoidance_max_fee_satoshis_arg, accept_underpaying_htlcs_arg);
31282         uint64_t ret_ref = 0;
31283         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
31284         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
31285         return ret_ref;
31286 }
31287
31288 static inline uint64_t ChannelConfig_clone_ptr(LDKChannelConfig *NONNULL_PTR arg) {
31289         LDKChannelConfig ret_var = ChannelConfig_clone(arg);
31290         uint64_t ret_ref = 0;
31291         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
31292         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
31293         return ret_ref;
31294 }
31295 int64_t  __attribute__((export_name("TS_ChannelConfig_clone_ptr"))) TS_ChannelConfig_clone_ptr(uint64_t arg) {
31296         LDKChannelConfig arg_conv;
31297         arg_conv.inner = untag_ptr(arg);
31298         arg_conv.is_owned = ptr_is_owned(arg);
31299         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
31300         arg_conv.is_owned = false;
31301         int64_t ret_conv = ChannelConfig_clone_ptr(&arg_conv);
31302         return ret_conv;
31303 }
31304
31305 uint64_t  __attribute__((export_name("TS_ChannelConfig_clone"))) TS_ChannelConfig_clone(uint64_t orig) {
31306         LDKChannelConfig orig_conv;
31307         orig_conv.inner = untag_ptr(orig);
31308         orig_conv.is_owned = ptr_is_owned(orig);
31309         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
31310         orig_conv.is_owned = false;
31311         LDKChannelConfig ret_var = ChannelConfig_clone(&orig_conv);
31312         uint64_t ret_ref = 0;
31313         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
31314         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
31315         return ret_ref;
31316 }
31317
31318 jboolean  __attribute__((export_name("TS_ChannelConfig_eq"))) TS_ChannelConfig_eq(uint64_t a, uint64_t b) {
31319         LDKChannelConfig a_conv;
31320         a_conv.inner = untag_ptr(a);
31321         a_conv.is_owned = ptr_is_owned(a);
31322         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
31323         a_conv.is_owned = false;
31324         LDKChannelConfig b_conv;
31325         b_conv.inner = untag_ptr(b);
31326         b_conv.is_owned = ptr_is_owned(b);
31327         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
31328         b_conv.is_owned = false;
31329         jboolean ret_conv = ChannelConfig_eq(&a_conv, &b_conv);
31330         return ret_conv;
31331 }
31332
31333 void  __attribute__((export_name("TS_ChannelConfig_apply"))) TS_ChannelConfig_apply(uint64_t this_arg, uint64_t update) {
31334         LDKChannelConfig this_arg_conv;
31335         this_arg_conv.inner = untag_ptr(this_arg);
31336         this_arg_conv.is_owned = ptr_is_owned(this_arg);
31337         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
31338         this_arg_conv.is_owned = false;
31339         LDKChannelConfigUpdate update_conv;
31340         update_conv.inner = untag_ptr(update);
31341         update_conv.is_owned = ptr_is_owned(update);
31342         CHECK_INNER_FIELD_ACCESS_OR_NULL(update_conv);
31343         update_conv.is_owned = false;
31344         ChannelConfig_apply(&this_arg_conv, &update_conv);
31345 }
31346
31347 uint64_t  __attribute__((export_name("TS_ChannelConfig_default"))) TS_ChannelConfig_default() {
31348         LDKChannelConfig ret_var = ChannelConfig_default();
31349         uint64_t ret_ref = 0;
31350         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
31351         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
31352         return ret_ref;
31353 }
31354
31355 int8_tArray  __attribute__((export_name("TS_ChannelConfig_write"))) TS_ChannelConfig_write(uint64_t obj) {
31356         LDKChannelConfig obj_conv;
31357         obj_conv.inner = untag_ptr(obj);
31358         obj_conv.is_owned = ptr_is_owned(obj);
31359         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
31360         obj_conv.is_owned = false;
31361         LDKCVec_u8Z ret_var = ChannelConfig_write(&obj_conv);
31362         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
31363         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
31364         CVec_u8Z_free(ret_var);
31365         return ret_arr;
31366 }
31367
31368 uint64_t  __attribute__((export_name("TS_ChannelConfig_read"))) TS_ChannelConfig_read(int8_tArray ser) {
31369         LDKu8slice ser_ref;
31370         ser_ref.datalen = ser->arr_len;
31371         ser_ref.data = ser->elems;
31372         LDKCResult_ChannelConfigDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelConfigDecodeErrorZ), "LDKCResult_ChannelConfigDecodeErrorZ");
31373         *ret_conv = ChannelConfig_read(ser_ref);
31374         FREE(ser);
31375         return tag_ptr(ret_conv, true);
31376 }
31377
31378 void  __attribute__((export_name("TS_ChannelConfigUpdate_free"))) TS_ChannelConfigUpdate_free(uint64_t this_obj) {
31379         LDKChannelConfigUpdate this_obj_conv;
31380         this_obj_conv.inner = untag_ptr(this_obj);
31381         this_obj_conv.is_owned = ptr_is_owned(this_obj);
31382         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
31383         ChannelConfigUpdate_free(this_obj_conv);
31384 }
31385
31386 uint64_t  __attribute__((export_name("TS_ChannelConfigUpdate_get_forwarding_fee_proportional_millionths"))) TS_ChannelConfigUpdate_get_forwarding_fee_proportional_millionths(uint64_t this_ptr) {
31387         LDKChannelConfigUpdate this_ptr_conv;
31388         this_ptr_conv.inner = untag_ptr(this_ptr);
31389         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
31390         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
31391         this_ptr_conv.is_owned = false;
31392         LDKCOption_u32Z *ret_copy = MALLOC(sizeof(LDKCOption_u32Z), "LDKCOption_u32Z");
31393         *ret_copy = ChannelConfigUpdate_get_forwarding_fee_proportional_millionths(&this_ptr_conv);
31394         uint64_t ret_ref = tag_ptr(ret_copy, true);
31395         return ret_ref;
31396 }
31397
31398 void  __attribute__((export_name("TS_ChannelConfigUpdate_set_forwarding_fee_proportional_millionths"))) TS_ChannelConfigUpdate_set_forwarding_fee_proportional_millionths(uint64_t this_ptr, uint64_t val) {
31399         LDKChannelConfigUpdate this_ptr_conv;
31400         this_ptr_conv.inner = untag_ptr(this_ptr);
31401         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
31402         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
31403         this_ptr_conv.is_owned = false;
31404         void* val_ptr = untag_ptr(val);
31405         CHECK_ACCESS(val_ptr);
31406         LDKCOption_u32Z val_conv = *(LDKCOption_u32Z*)(val_ptr);
31407         val_conv = COption_u32Z_clone((LDKCOption_u32Z*)untag_ptr(val));
31408         ChannelConfigUpdate_set_forwarding_fee_proportional_millionths(&this_ptr_conv, val_conv);
31409 }
31410
31411 uint64_t  __attribute__((export_name("TS_ChannelConfigUpdate_get_forwarding_fee_base_msat"))) TS_ChannelConfigUpdate_get_forwarding_fee_base_msat(uint64_t this_ptr) {
31412         LDKChannelConfigUpdate 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         LDKCOption_u32Z *ret_copy = MALLOC(sizeof(LDKCOption_u32Z), "LDKCOption_u32Z");
31418         *ret_copy = ChannelConfigUpdate_get_forwarding_fee_base_msat(&this_ptr_conv);
31419         uint64_t ret_ref = tag_ptr(ret_copy, true);
31420         return ret_ref;
31421 }
31422
31423 void  __attribute__((export_name("TS_ChannelConfigUpdate_set_forwarding_fee_base_msat"))) TS_ChannelConfigUpdate_set_forwarding_fee_base_msat(uint64_t this_ptr, uint64_t val) {
31424         LDKChannelConfigUpdate this_ptr_conv;
31425         this_ptr_conv.inner = untag_ptr(this_ptr);
31426         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
31427         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
31428         this_ptr_conv.is_owned = false;
31429         void* val_ptr = untag_ptr(val);
31430         CHECK_ACCESS(val_ptr);
31431         LDKCOption_u32Z val_conv = *(LDKCOption_u32Z*)(val_ptr);
31432         val_conv = COption_u32Z_clone((LDKCOption_u32Z*)untag_ptr(val));
31433         ChannelConfigUpdate_set_forwarding_fee_base_msat(&this_ptr_conv, val_conv);
31434 }
31435
31436 uint64_t  __attribute__((export_name("TS_ChannelConfigUpdate_get_cltv_expiry_delta"))) TS_ChannelConfigUpdate_get_cltv_expiry_delta(uint64_t this_ptr) {
31437         LDKChannelConfigUpdate this_ptr_conv;
31438         this_ptr_conv.inner = untag_ptr(this_ptr);
31439         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
31440         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
31441         this_ptr_conv.is_owned = false;
31442         LDKCOption_u16Z *ret_copy = MALLOC(sizeof(LDKCOption_u16Z), "LDKCOption_u16Z");
31443         *ret_copy = ChannelConfigUpdate_get_cltv_expiry_delta(&this_ptr_conv);
31444         uint64_t ret_ref = tag_ptr(ret_copy, true);
31445         return ret_ref;
31446 }
31447
31448 void  __attribute__((export_name("TS_ChannelConfigUpdate_set_cltv_expiry_delta"))) TS_ChannelConfigUpdate_set_cltv_expiry_delta(uint64_t this_ptr, uint64_t val) {
31449         LDKChannelConfigUpdate this_ptr_conv;
31450         this_ptr_conv.inner = untag_ptr(this_ptr);
31451         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
31452         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
31453         this_ptr_conv.is_owned = false;
31454         void* val_ptr = untag_ptr(val);
31455         CHECK_ACCESS(val_ptr);
31456         LDKCOption_u16Z val_conv = *(LDKCOption_u16Z*)(val_ptr);
31457         val_conv = COption_u16Z_clone((LDKCOption_u16Z*)untag_ptr(val));
31458         ChannelConfigUpdate_set_cltv_expiry_delta(&this_ptr_conv, val_conv);
31459 }
31460
31461 uint64_t  __attribute__((export_name("TS_ChannelConfigUpdate_get_max_dust_htlc_exposure_msat"))) TS_ChannelConfigUpdate_get_max_dust_htlc_exposure_msat(uint64_t this_ptr) {
31462         LDKChannelConfigUpdate this_ptr_conv;
31463         this_ptr_conv.inner = untag_ptr(this_ptr);
31464         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
31465         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
31466         this_ptr_conv.is_owned = false;
31467         LDKCOption_MaxDustHTLCExposureZ *ret_copy = MALLOC(sizeof(LDKCOption_MaxDustHTLCExposureZ), "LDKCOption_MaxDustHTLCExposureZ");
31468         *ret_copy = ChannelConfigUpdate_get_max_dust_htlc_exposure_msat(&this_ptr_conv);
31469         uint64_t ret_ref = tag_ptr(ret_copy, true);
31470         return ret_ref;
31471 }
31472
31473 void  __attribute__((export_name("TS_ChannelConfigUpdate_set_max_dust_htlc_exposure_msat"))) TS_ChannelConfigUpdate_set_max_dust_htlc_exposure_msat(uint64_t this_ptr, uint64_t val) {
31474         LDKChannelConfigUpdate this_ptr_conv;
31475         this_ptr_conv.inner = untag_ptr(this_ptr);
31476         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
31477         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
31478         this_ptr_conv.is_owned = false;
31479         void* val_ptr = untag_ptr(val);
31480         CHECK_ACCESS(val_ptr);
31481         LDKCOption_MaxDustHTLCExposureZ val_conv = *(LDKCOption_MaxDustHTLCExposureZ*)(val_ptr);
31482         val_conv = COption_MaxDustHTLCExposureZ_clone((LDKCOption_MaxDustHTLCExposureZ*)untag_ptr(val));
31483         ChannelConfigUpdate_set_max_dust_htlc_exposure_msat(&this_ptr_conv, val_conv);
31484 }
31485
31486 uint64_t  __attribute__((export_name("TS_ChannelConfigUpdate_get_force_close_avoidance_max_fee_satoshis"))) TS_ChannelConfigUpdate_get_force_close_avoidance_max_fee_satoshis(uint64_t this_ptr) {
31487         LDKChannelConfigUpdate this_ptr_conv;
31488         this_ptr_conv.inner = untag_ptr(this_ptr);
31489         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
31490         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
31491         this_ptr_conv.is_owned = false;
31492         LDKCOption_u64Z *ret_copy = MALLOC(sizeof(LDKCOption_u64Z), "LDKCOption_u64Z");
31493         *ret_copy = ChannelConfigUpdate_get_force_close_avoidance_max_fee_satoshis(&this_ptr_conv);
31494         uint64_t ret_ref = tag_ptr(ret_copy, true);
31495         return ret_ref;
31496 }
31497
31498 void  __attribute__((export_name("TS_ChannelConfigUpdate_set_force_close_avoidance_max_fee_satoshis"))) TS_ChannelConfigUpdate_set_force_close_avoidance_max_fee_satoshis(uint64_t this_ptr, uint64_t val) {
31499         LDKChannelConfigUpdate this_ptr_conv;
31500         this_ptr_conv.inner = untag_ptr(this_ptr);
31501         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
31502         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
31503         this_ptr_conv.is_owned = false;
31504         void* val_ptr = untag_ptr(val);
31505         CHECK_ACCESS(val_ptr);
31506         LDKCOption_u64Z val_conv = *(LDKCOption_u64Z*)(val_ptr);
31507         val_conv = COption_u64Z_clone((LDKCOption_u64Z*)untag_ptr(val));
31508         ChannelConfigUpdate_set_force_close_avoidance_max_fee_satoshis(&this_ptr_conv, val_conv);
31509 }
31510
31511 uint64_t  __attribute__((export_name("TS_ChannelConfigUpdate_new"))) TS_ChannelConfigUpdate_new(uint64_t forwarding_fee_proportional_millionths_arg, uint64_t forwarding_fee_base_msat_arg, uint64_t cltv_expiry_delta_arg, uint64_t max_dust_htlc_exposure_msat_arg, uint64_t force_close_avoidance_max_fee_satoshis_arg) {
31512         void* forwarding_fee_proportional_millionths_arg_ptr = untag_ptr(forwarding_fee_proportional_millionths_arg);
31513         CHECK_ACCESS(forwarding_fee_proportional_millionths_arg_ptr);
31514         LDKCOption_u32Z forwarding_fee_proportional_millionths_arg_conv = *(LDKCOption_u32Z*)(forwarding_fee_proportional_millionths_arg_ptr);
31515         forwarding_fee_proportional_millionths_arg_conv = COption_u32Z_clone((LDKCOption_u32Z*)untag_ptr(forwarding_fee_proportional_millionths_arg));
31516         void* forwarding_fee_base_msat_arg_ptr = untag_ptr(forwarding_fee_base_msat_arg);
31517         CHECK_ACCESS(forwarding_fee_base_msat_arg_ptr);
31518         LDKCOption_u32Z forwarding_fee_base_msat_arg_conv = *(LDKCOption_u32Z*)(forwarding_fee_base_msat_arg_ptr);
31519         forwarding_fee_base_msat_arg_conv = COption_u32Z_clone((LDKCOption_u32Z*)untag_ptr(forwarding_fee_base_msat_arg));
31520         void* cltv_expiry_delta_arg_ptr = untag_ptr(cltv_expiry_delta_arg);
31521         CHECK_ACCESS(cltv_expiry_delta_arg_ptr);
31522         LDKCOption_u16Z cltv_expiry_delta_arg_conv = *(LDKCOption_u16Z*)(cltv_expiry_delta_arg_ptr);
31523         cltv_expiry_delta_arg_conv = COption_u16Z_clone((LDKCOption_u16Z*)untag_ptr(cltv_expiry_delta_arg));
31524         void* max_dust_htlc_exposure_msat_arg_ptr = untag_ptr(max_dust_htlc_exposure_msat_arg);
31525         CHECK_ACCESS(max_dust_htlc_exposure_msat_arg_ptr);
31526         LDKCOption_MaxDustHTLCExposureZ max_dust_htlc_exposure_msat_arg_conv = *(LDKCOption_MaxDustHTLCExposureZ*)(max_dust_htlc_exposure_msat_arg_ptr);
31527         max_dust_htlc_exposure_msat_arg_conv = COption_MaxDustHTLCExposureZ_clone((LDKCOption_MaxDustHTLCExposureZ*)untag_ptr(max_dust_htlc_exposure_msat_arg));
31528         void* force_close_avoidance_max_fee_satoshis_arg_ptr = untag_ptr(force_close_avoidance_max_fee_satoshis_arg);
31529         CHECK_ACCESS(force_close_avoidance_max_fee_satoshis_arg_ptr);
31530         LDKCOption_u64Z force_close_avoidance_max_fee_satoshis_arg_conv = *(LDKCOption_u64Z*)(force_close_avoidance_max_fee_satoshis_arg_ptr);
31531         force_close_avoidance_max_fee_satoshis_arg_conv = COption_u64Z_clone((LDKCOption_u64Z*)untag_ptr(force_close_avoidance_max_fee_satoshis_arg));
31532         LDKChannelConfigUpdate ret_var = ChannelConfigUpdate_new(forwarding_fee_proportional_millionths_arg_conv, forwarding_fee_base_msat_arg_conv, cltv_expiry_delta_arg_conv, max_dust_htlc_exposure_msat_arg_conv, force_close_avoidance_max_fee_satoshis_arg_conv);
31533         uint64_t ret_ref = 0;
31534         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
31535         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
31536         return ret_ref;
31537 }
31538
31539 uint64_t  __attribute__((export_name("TS_ChannelConfigUpdate_default"))) TS_ChannelConfigUpdate_default() {
31540         LDKChannelConfigUpdate ret_var = ChannelConfigUpdate_default();
31541         uint64_t ret_ref = 0;
31542         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
31543         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
31544         return ret_ref;
31545 }
31546
31547 void  __attribute__((export_name("TS_UserConfig_free"))) TS_UserConfig_free(uint64_t this_obj) {
31548         LDKUserConfig this_obj_conv;
31549         this_obj_conv.inner = untag_ptr(this_obj);
31550         this_obj_conv.is_owned = ptr_is_owned(this_obj);
31551         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
31552         UserConfig_free(this_obj_conv);
31553 }
31554
31555 uint64_t  __attribute__((export_name("TS_UserConfig_get_channel_handshake_config"))) TS_UserConfig_get_channel_handshake_config(uint64_t this_ptr) {
31556         LDKUserConfig this_ptr_conv;
31557         this_ptr_conv.inner = untag_ptr(this_ptr);
31558         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
31559         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
31560         this_ptr_conv.is_owned = false;
31561         LDKChannelHandshakeConfig ret_var = UserConfig_get_channel_handshake_config(&this_ptr_conv);
31562         uint64_t ret_ref = 0;
31563         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
31564         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
31565         return ret_ref;
31566 }
31567
31568 void  __attribute__((export_name("TS_UserConfig_set_channel_handshake_config"))) TS_UserConfig_set_channel_handshake_config(uint64_t this_ptr, uint64_t val) {
31569         LDKUserConfig this_ptr_conv;
31570         this_ptr_conv.inner = untag_ptr(this_ptr);
31571         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
31572         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
31573         this_ptr_conv.is_owned = false;
31574         LDKChannelHandshakeConfig val_conv;
31575         val_conv.inner = untag_ptr(val);
31576         val_conv.is_owned = ptr_is_owned(val);
31577         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
31578         val_conv = ChannelHandshakeConfig_clone(&val_conv);
31579         UserConfig_set_channel_handshake_config(&this_ptr_conv, val_conv);
31580 }
31581
31582 uint64_t  __attribute__((export_name("TS_UserConfig_get_channel_handshake_limits"))) TS_UserConfig_get_channel_handshake_limits(uint64_t this_ptr) {
31583         LDKUserConfig this_ptr_conv;
31584         this_ptr_conv.inner = untag_ptr(this_ptr);
31585         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
31586         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
31587         this_ptr_conv.is_owned = false;
31588         LDKChannelHandshakeLimits ret_var = UserConfig_get_channel_handshake_limits(&this_ptr_conv);
31589         uint64_t ret_ref = 0;
31590         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
31591         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
31592         return ret_ref;
31593 }
31594
31595 void  __attribute__((export_name("TS_UserConfig_set_channel_handshake_limits"))) TS_UserConfig_set_channel_handshake_limits(uint64_t this_ptr, uint64_t val) {
31596         LDKUserConfig this_ptr_conv;
31597         this_ptr_conv.inner = untag_ptr(this_ptr);
31598         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
31599         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
31600         this_ptr_conv.is_owned = false;
31601         LDKChannelHandshakeLimits val_conv;
31602         val_conv.inner = untag_ptr(val);
31603         val_conv.is_owned = ptr_is_owned(val);
31604         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
31605         val_conv = ChannelHandshakeLimits_clone(&val_conv);
31606         UserConfig_set_channel_handshake_limits(&this_ptr_conv, val_conv);
31607 }
31608
31609 uint64_t  __attribute__((export_name("TS_UserConfig_get_channel_config"))) TS_UserConfig_get_channel_config(uint64_t this_ptr) {
31610         LDKUserConfig 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         LDKChannelConfig ret_var = UserConfig_get_channel_config(&this_ptr_conv);
31616         uint64_t ret_ref = 0;
31617         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
31618         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
31619         return ret_ref;
31620 }
31621
31622 void  __attribute__((export_name("TS_UserConfig_set_channel_config"))) TS_UserConfig_set_channel_config(uint64_t this_ptr, uint64_t val) {
31623         LDKUserConfig this_ptr_conv;
31624         this_ptr_conv.inner = untag_ptr(this_ptr);
31625         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
31626         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
31627         this_ptr_conv.is_owned = false;
31628         LDKChannelConfig val_conv;
31629         val_conv.inner = untag_ptr(val);
31630         val_conv.is_owned = ptr_is_owned(val);
31631         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
31632         val_conv = ChannelConfig_clone(&val_conv);
31633         UserConfig_set_channel_config(&this_ptr_conv, val_conv);
31634 }
31635
31636 jboolean  __attribute__((export_name("TS_UserConfig_get_accept_forwards_to_priv_channels"))) TS_UserConfig_get_accept_forwards_to_priv_channels(uint64_t this_ptr) {
31637         LDKUserConfig this_ptr_conv;
31638         this_ptr_conv.inner = untag_ptr(this_ptr);
31639         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
31640         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
31641         this_ptr_conv.is_owned = false;
31642         jboolean ret_conv = UserConfig_get_accept_forwards_to_priv_channels(&this_ptr_conv);
31643         return ret_conv;
31644 }
31645
31646 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) {
31647         LDKUserConfig this_ptr_conv;
31648         this_ptr_conv.inner = untag_ptr(this_ptr);
31649         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
31650         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
31651         this_ptr_conv.is_owned = false;
31652         UserConfig_set_accept_forwards_to_priv_channels(&this_ptr_conv, val);
31653 }
31654
31655 jboolean  __attribute__((export_name("TS_UserConfig_get_accept_inbound_channels"))) TS_UserConfig_get_accept_inbound_channels(uint64_t this_ptr) {
31656         LDKUserConfig this_ptr_conv;
31657         this_ptr_conv.inner = untag_ptr(this_ptr);
31658         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
31659         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
31660         this_ptr_conv.is_owned = false;
31661         jboolean ret_conv = UserConfig_get_accept_inbound_channels(&this_ptr_conv);
31662         return ret_conv;
31663 }
31664
31665 void  __attribute__((export_name("TS_UserConfig_set_accept_inbound_channels"))) TS_UserConfig_set_accept_inbound_channels(uint64_t this_ptr, jboolean val) {
31666         LDKUserConfig this_ptr_conv;
31667         this_ptr_conv.inner = untag_ptr(this_ptr);
31668         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
31669         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
31670         this_ptr_conv.is_owned = false;
31671         UserConfig_set_accept_inbound_channels(&this_ptr_conv, val);
31672 }
31673
31674 jboolean  __attribute__((export_name("TS_UserConfig_get_manually_accept_inbound_channels"))) TS_UserConfig_get_manually_accept_inbound_channels(uint64_t this_ptr) {
31675         LDKUserConfig this_ptr_conv;
31676         this_ptr_conv.inner = untag_ptr(this_ptr);
31677         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
31678         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
31679         this_ptr_conv.is_owned = false;
31680         jboolean ret_conv = UserConfig_get_manually_accept_inbound_channels(&this_ptr_conv);
31681         return ret_conv;
31682 }
31683
31684 void  __attribute__((export_name("TS_UserConfig_set_manually_accept_inbound_channels"))) TS_UserConfig_set_manually_accept_inbound_channels(uint64_t this_ptr, jboolean val) {
31685         LDKUserConfig this_ptr_conv;
31686         this_ptr_conv.inner = untag_ptr(this_ptr);
31687         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
31688         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
31689         this_ptr_conv.is_owned = false;
31690         UserConfig_set_manually_accept_inbound_channels(&this_ptr_conv, val);
31691 }
31692
31693 jboolean  __attribute__((export_name("TS_UserConfig_get_accept_intercept_htlcs"))) TS_UserConfig_get_accept_intercept_htlcs(uint64_t this_ptr) {
31694         LDKUserConfig this_ptr_conv;
31695         this_ptr_conv.inner = untag_ptr(this_ptr);
31696         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
31697         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
31698         this_ptr_conv.is_owned = false;
31699         jboolean ret_conv = UserConfig_get_accept_intercept_htlcs(&this_ptr_conv);
31700         return ret_conv;
31701 }
31702
31703 void  __attribute__((export_name("TS_UserConfig_set_accept_intercept_htlcs"))) TS_UserConfig_set_accept_intercept_htlcs(uint64_t this_ptr, jboolean val) {
31704         LDKUserConfig this_ptr_conv;
31705         this_ptr_conv.inner = untag_ptr(this_ptr);
31706         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
31707         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
31708         this_ptr_conv.is_owned = false;
31709         UserConfig_set_accept_intercept_htlcs(&this_ptr_conv, val);
31710 }
31711
31712 jboolean  __attribute__((export_name("TS_UserConfig_get_accept_mpp_keysend"))) TS_UserConfig_get_accept_mpp_keysend(uint64_t this_ptr) {
31713         LDKUserConfig this_ptr_conv;
31714         this_ptr_conv.inner = untag_ptr(this_ptr);
31715         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
31716         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
31717         this_ptr_conv.is_owned = false;
31718         jboolean ret_conv = UserConfig_get_accept_mpp_keysend(&this_ptr_conv);
31719         return ret_conv;
31720 }
31721
31722 void  __attribute__((export_name("TS_UserConfig_set_accept_mpp_keysend"))) TS_UserConfig_set_accept_mpp_keysend(uint64_t this_ptr, jboolean val) {
31723         LDKUserConfig 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         UserConfig_set_accept_mpp_keysend(&this_ptr_conv, val);
31729 }
31730
31731 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, jboolean accept_mpp_keysend_arg) {
31732         LDKChannelHandshakeConfig channel_handshake_config_arg_conv;
31733         channel_handshake_config_arg_conv.inner = untag_ptr(channel_handshake_config_arg);
31734         channel_handshake_config_arg_conv.is_owned = ptr_is_owned(channel_handshake_config_arg);
31735         CHECK_INNER_FIELD_ACCESS_OR_NULL(channel_handshake_config_arg_conv);
31736         channel_handshake_config_arg_conv = ChannelHandshakeConfig_clone(&channel_handshake_config_arg_conv);
31737         LDKChannelHandshakeLimits channel_handshake_limits_arg_conv;
31738         channel_handshake_limits_arg_conv.inner = untag_ptr(channel_handshake_limits_arg);
31739         channel_handshake_limits_arg_conv.is_owned = ptr_is_owned(channel_handshake_limits_arg);
31740         CHECK_INNER_FIELD_ACCESS_OR_NULL(channel_handshake_limits_arg_conv);
31741         channel_handshake_limits_arg_conv = ChannelHandshakeLimits_clone(&channel_handshake_limits_arg_conv);
31742         LDKChannelConfig channel_config_arg_conv;
31743         channel_config_arg_conv.inner = untag_ptr(channel_config_arg);
31744         channel_config_arg_conv.is_owned = ptr_is_owned(channel_config_arg);
31745         CHECK_INNER_FIELD_ACCESS_OR_NULL(channel_config_arg_conv);
31746         channel_config_arg_conv = ChannelConfig_clone(&channel_config_arg_conv);
31747         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, accept_mpp_keysend_arg);
31748         uint64_t ret_ref = 0;
31749         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
31750         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
31751         return ret_ref;
31752 }
31753
31754 static inline uint64_t UserConfig_clone_ptr(LDKUserConfig *NONNULL_PTR arg) {
31755         LDKUserConfig ret_var = UserConfig_clone(arg);
31756         uint64_t ret_ref = 0;
31757         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
31758         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
31759         return ret_ref;
31760 }
31761 int64_t  __attribute__((export_name("TS_UserConfig_clone_ptr"))) TS_UserConfig_clone_ptr(uint64_t arg) {
31762         LDKUserConfig arg_conv;
31763         arg_conv.inner = untag_ptr(arg);
31764         arg_conv.is_owned = ptr_is_owned(arg);
31765         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
31766         arg_conv.is_owned = false;
31767         int64_t ret_conv = UserConfig_clone_ptr(&arg_conv);
31768         return ret_conv;
31769 }
31770
31771 uint64_t  __attribute__((export_name("TS_UserConfig_clone"))) TS_UserConfig_clone(uint64_t orig) {
31772         LDKUserConfig orig_conv;
31773         orig_conv.inner = untag_ptr(orig);
31774         orig_conv.is_owned = ptr_is_owned(orig);
31775         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
31776         orig_conv.is_owned = false;
31777         LDKUserConfig ret_var = UserConfig_clone(&orig_conv);
31778         uint64_t ret_ref = 0;
31779         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
31780         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
31781         return ret_ref;
31782 }
31783
31784 uint64_t  __attribute__((export_name("TS_UserConfig_default"))) TS_UserConfig_default() {
31785         LDKUserConfig ret_var = UserConfig_default();
31786         uint64_t ret_ref = 0;
31787         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
31788         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
31789         return ret_ref;
31790 }
31791
31792 void  __attribute__((export_name("TS_BestBlock_free"))) TS_BestBlock_free(uint64_t this_obj) {
31793         LDKBestBlock this_obj_conv;
31794         this_obj_conv.inner = untag_ptr(this_obj);
31795         this_obj_conv.is_owned = ptr_is_owned(this_obj);
31796         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
31797         BestBlock_free(this_obj_conv);
31798 }
31799
31800 static inline uint64_t BestBlock_clone_ptr(LDKBestBlock *NONNULL_PTR arg) {
31801         LDKBestBlock ret_var = BestBlock_clone(arg);
31802         uint64_t ret_ref = 0;
31803         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
31804         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
31805         return ret_ref;
31806 }
31807 int64_t  __attribute__((export_name("TS_BestBlock_clone_ptr"))) TS_BestBlock_clone_ptr(uint64_t arg) {
31808         LDKBestBlock arg_conv;
31809         arg_conv.inner = untag_ptr(arg);
31810         arg_conv.is_owned = ptr_is_owned(arg);
31811         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
31812         arg_conv.is_owned = false;
31813         int64_t ret_conv = BestBlock_clone_ptr(&arg_conv);
31814         return ret_conv;
31815 }
31816
31817 uint64_t  __attribute__((export_name("TS_BestBlock_clone"))) TS_BestBlock_clone(uint64_t orig) {
31818         LDKBestBlock orig_conv;
31819         orig_conv.inner = untag_ptr(orig);
31820         orig_conv.is_owned = ptr_is_owned(orig);
31821         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
31822         orig_conv.is_owned = false;
31823         LDKBestBlock ret_var = BestBlock_clone(&orig_conv);
31824         uint64_t ret_ref = 0;
31825         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
31826         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
31827         return ret_ref;
31828 }
31829
31830 jboolean  __attribute__((export_name("TS_BestBlock_eq"))) TS_BestBlock_eq(uint64_t a, uint64_t b) {
31831         LDKBestBlock a_conv;
31832         a_conv.inner = untag_ptr(a);
31833         a_conv.is_owned = ptr_is_owned(a);
31834         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
31835         a_conv.is_owned = false;
31836         LDKBestBlock b_conv;
31837         b_conv.inner = untag_ptr(b);
31838         b_conv.is_owned = ptr_is_owned(b);
31839         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
31840         b_conv.is_owned = false;
31841         jboolean ret_conv = BestBlock_eq(&a_conv, &b_conv);
31842         return ret_conv;
31843 }
31844
31845 uint64_t  __attribute__((export_name("TS_BestBlock_from_network"))) TS_BestBlock_from_network(uint32_t network) {
31846         LDKNetwork network_conv = LDKNetwork_from_js(network);
31847         LDKBestBlock ret_var = BestBlock_from_network(network_conv);
31848         uint64_t ret_ref = 0;
31849         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
31850         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
31851         return ret_ref;
31852 }
31853
31854 uint64_t  __attribute__((export_name("TS_BestBlock_new"))) TS_BestBlock_new(int8_tArray block_hash, int32_t height) {
31855         LDKThirtyTwoBytes block_hash_ref;
31856         CHECK(block_hash->arr_len == 32);
31857         memcpy(block_hash_ref.data, block_hash->elems, 32); FREE(block_hash);
31858         LDKBestBlock ret_var = BestBlock_new(block_hash_ref, height);
31859         uint64_t ret_ref = 0;
31860         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
31861         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
31862         return ret_ref;
31863 }
31864
31865 int8_tArray  __attribute__((export_name("TS_BestBlock_block_hash"))) TS_BestBlock_block_hash(uint64_t this_arg) {
31866         LDKBestBlock this_arg_conv;
31867         this_arg_conv.inner = untag_ptr(this_arg);
31868         this_arg_conv.is_owned = ptr_is_owned(this_arg);
31869         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
31870         this_arg_conv.is_owned = false;
31871         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
31872         memcpy(ret_arr->elems, BestBlock_block_hash(&this_arg_conv).data, 32);
31873         return ret_arr;
31874 }
31875
31876 int32_t  __attribute__((export_name("TS_BestBlock_height"))) TS_BestBlock_height(uint64_t this_arg) {
31877         LDKBestBlock this_arg_conv;
31878         this_arg_conv.inner = untag_ptr(this_arg);
31879         this_arg_conv.is_owned = ptr_is_owned(this_arg);
31880         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
31881         this_arg_conv.is_owned = false;
31882         int32_t ret_conv = BestBlock_height(&this_arg_conv);
31883         return ret_conv;
31884 }
31885
31886 void  __attribute__((export_name("TS_Listen_free"))) TS_Listen_free(uint64_t this_ptr) {
31887         if (!ptr_is_owned(this_ptr)) return;
31888         void* this_ptr_ptr = untag_ptr(this_ptr);
31889         CHECK_ACCESS(this_ptr_ptr);
31890         LDKListen this_ptr_conv = *(LDKListen*)(this_ptr_ptr);
31891         FREE(untag_ptr(this_ptr));
31892         Listen_free(this_ptr_conv);
31893 }
31894
31895 void  __attribute__((export_name("TS_Confirm_free"))) TS_Confirm_free(uint64_t this_ptr) {
31896         if (!ptr_is_owned(this_ptr)) return;
31897         void* this_ptr_ptr = untag_ptr(this_ptr);
31898         CHECK_ACCESS(this_ptr_ptr);
31899         LDKConfirm this_ptr_conv = *(LDKConfirm*)(this_ptr_ptr);
31900         FREE(untag_ptr(this_ptr));
31901         Confirm_free(this_ptr_conv);
31902 }
31903
31904 uint32_t  __attribute__((export_name("TS_ChannelMonitorUpdateStatus_clone"))) TS_ChannelMonitorUpdateStatus_clone(uint64_t orig) {
31905         LDKChannelMonitorUpdateStatus* orig_conv = (LDKChannelMonitorUpdateStatus*)untag_ptr(orig);
31906         uint32_t ret_conv = LDKChannelMonitorUpdateStatus_to_js(ChannelMonitorUpdateStatus_clone(orig_conv));
31907         return ret_conv;
31908 }
31909
31910 uint32_t  __attribute__((export_name("TS_ChannelMonitorUpdateStatus_completed"))) TS_ChannelMonitorUpdateStatus_completed() {
31911         uint32_t ret_conv = LDKChannelMonitorUpdateStatus_to_js(ChannelMonitorUpdateStatus_completed());
31912         return ret_conv;
31913 }
31914
31915 uint32_t  __attribute__((export_name("TS_ChannelMonitorUpdateStatus_in_progress"))) TS_ChannelMonitorUpdateStatus_in_progress() {
31916         uint32_t ret_conv = LDKChannelMonitorUpdateStatus_to_js(ChannelMonitorUpdateStatus_in_progress());
31917         return ret_conv;
31918 }
31919
31920 uint32_t  __attribute__((export_name("TS_ChannelMonitorUpdateStatus_unrecoverable_error"))) TS_ChannelMonitorUpdateStatus_unrecoverable_error() {
31921         uint32_t ret_conv = LDKChannelMonitorUpdateStatus_to_js(ChannelMonitorUpdateStatus_unrecoverable_error());
31922         return ret_conv;
31923 }
31924
31925 jboolean  __attribute__((export_name("TS_ChannelMonitorUpdateStatus_eq"))) TS_ChannelMonitorUpdateStatus_eq(uint64_t a, uint64_t b) {
31926         LDKChannelMonitorUpdateStatus* a_conv = (LDKChannelMonitorUpdateStatus*)untag_ptr(a);
31927         LDKChannelMonitorUpdateStatus* b_conv = (LDKChannelMonitorUpdateStatus*)untag_ptr(b);
31928         jboolean ret_conv = ChannelMonitorUpdateStatus_eq(a_conv, b_conv);
31929         return ret_conv;
31930 }
31931
31932 void  __attribute__((export_name("TS_Watch_free"))) TS_Watch_free(uint64_t this_ptr) {
31933         if (!ptr_is_owned(this_ptr)) return;
31934         void* this_ptr_ptr = untag_ptr(this_ptr);
31935         CHECK_ACCESS(this_ptr_ptr);
31936         LDKWatch this_ptr_conv = *(LDKWatch*)(this_ptr_ptr);
31937         FREE(untag_ptr(this_ptr));
31938         Watch_free(this_ptr_conv);
31939 }
31940
31941 void  __attribute__((export_name("TS_Filter_free"))) TS_Filter_free(uint64_t this_ptr) {
31942         if (!ptr_is_owned(this_ptr)) return;
31943         void* this_ptr_ptr = untag_ptr(this_ptr);
31944         CHECK_ACCESS(this_ptr_ptr);
31945         LDKFilter this_ptr_conv = *(LDKFilter*)(this_ptr_ptr);
31946         FREE(untag_ptr(this_ptr));
31947         Filter_free(this_ptr_conv);
31948 }
31949
31950 void  __attribute__((export_name("TS_WatchedOutput_free"))) TS_WatchedOutput_free(uint64_t this_obj) {
31951         LDKWatchedOutput this_obj_conv;
31952         this_obj_conv.inner = untag_ptr(this_obj);
31953         this_obj_conv.is_owned = ptr_is_owned(this_obj);
31954         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
31955         WatchedOutput_free(this_obj_conv);
31956 }
31957
31958 uint64_t  __attribute__((export_name("TS_WatchedOutput_get_block_hash"))) TS_WatchedOutput_get_block_hash(uint64_t this_ptr) {
31959         LDKWatchedOutput 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         LDKCOption_ThirtyTwoBytesZ *ret_copy = MALLOC(sizeof(LDKCOption_ThirtyTwoBytesZ), "LDKCOption_ThirtyTwoBytesZ");
31965         *ret_copy = WatchedOutput_get_block_hash(&this_ptr_conv);
31966         uint64_t ret_ref = tag_ptr(ret_copy, true);
31967         return ret_ref;
31968 }
31969
31970 void  __attribute__((export_name("TS_WatchedOutput_set_block_hash"))) TS_WatchedOutput_set_block_hash(uint64_t this_ptr, uint64_t val) {
31971         LDKWatchedOutput 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         void* val_ptr = untag_ptr(val);
31977         CHECK_ACCESS(val_ptr);
31978         LDKCOption_ThirtyTwoBytesZ val_conv = *(LDKCOption_ThirtyTwoBytesZ*)(val_ptr);
31979         val_conv = COption_ThirtyTwoBytesZ_clone((LDKCOption_ThirtyTwoBytesZ*)untag_ptr(val));
31980         WatchedOutput_set_block_hash(&this_ptr_conv, val_conv);
31981 }
31982
31983 uint64_t  __attribute__((export_name("TS_WatchedOutput_get_outpoint"))) TS_WatchedOutput_get_outpoint(uint64_t this_ptr) {
31984         LDKWatchedOutput this_ptr_conv;
31985         this_ptr_conv.inner = untag_ptr(this_ptr);
31986         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
31987         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
31988         this_ptr_conv.is_owned = false;
31989         LDKOutPoint ret_var = WatchedOutput_get_outpoint(&this_ptr_conv);
31990         uint64_t ret_ref = 0;
31991         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
31992         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
31993         return ret_ref;
31994 }
31995
31996 void  __attribute__((export_name("TS_WatchedOutput_set_outpoint"))) TS_WatchedOutput_set_outpoint(uint64_t this_ptr, uint64_t val) {
31997         LDKWatchedOutput this_ptr_conv;
31998         this_ptr_conv.inner = untag_ptr(this_ptr);
31999         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
32000         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
32001         this_ptr_conv.is_owned = false;
32002         LDKOutPoint val_conv;
32003         val_conv.inner = untag_ptr(val);
32004         val_conv.is_owned = ptr_is_owned(val);
32005         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
32006         val_conv = OutPoint_clone(&val_conv);
32007         WatchedOutput_set_outpoint(&this_ptr_conv, val_conv);
32008 }
32009
32010 int8_tArray  __attribute__((export_name("TS_WatchedOutput_get_script_pubkey"))) TS_WatchedOutput_get_script_pubkey(uint64_t this_ptr) {
32011         LDKWatchedOutput this_ptr_conv;
32012         this_ptr_conv.inner = untag_ptr(this_ptr);
32013         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
32014         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
32015         this_ptr_conv.is_owned = false;
32016         LDKu8slice ret_var = WatchedOutput_get_script_pubkey(&this_ptr_conv);
32017         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
32018         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
32019         return ret_arr;
32020 }
32021
32022 void  __attribute__((export_name("TS_WatchedOutput_set_script_pubkey"))) TS_WatchedOutput_set_script_pubkey(uint64_t this_ptr, int8_tArray val) {
32023         LDKWatchedOutput this_ptr_conv;
32024         this_ptr_conv.inner = untag_ptr(this_ptr);
32025         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
32026         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
32027         this_ptr_conv.is_owned = false;
32028         LDKCVec_u8Z val_ref;
32029         val_ref.datalen = val->arr_len;
32030         val_ref.data = MALLOC(val_ref.datalen, "LDKCVec_u8Z Bytes");
32031         memcpy(val_ref.data, val->elems, val_ref.datalen); FREE(val);
32032         WatchedOutput_set_script_pubkey(&this_ptr_conv, val_ref);
32033 }
32034
32035 uint64_t  __attribute__((export_name("TS_WatchedOutput_new"))) TS_WatchedOutput_new(uint64_t block_hash_arg, uint64_t outpoint_arg, int8_tArray script_pubkey_arg) {
32036         void* block_hash_arg_ptr = untag_ptr(block_hash_arg);
32037         CHECK_ACCESS(block_hash_arg_ptr);
32038         LDKCOption_ThirtyTwoBytesZ block_hash_arg_conv = *(LDKCOption_ThirtyTwoBytesZ*)(block_hash_arg_ptr);
32039         block_hash_arg_conv = COption_ThirtyTwoBytesZ_clone((LDKCOption_ThirtyTwoBytesZ*)untag_ptr(block_hash_arg));
32040         LDKOutPoint outpoint_arg_conv;
32041         outpoint_arg_conv.inner = untag_ptr(outpoint_arg);
32042         outpoint_arg_conv.is_owned = ptr_is_owned(outpoint_arg);
32043         CHECK_INNER_FIELD_ACCESS_OR_NULL(outpoint_arg_conv);
32044         outpoint_arg_conv = OutPoint_clone(&outpoint_arg_conv);
32045         LDKCVec_u8Z script_pubkey_arg_ref;
32046         script_pubkey_arg_ref.datalen = script_pubkey_arg->arr_len;
32047         script_pubkey_arg_ref.data = MALLOC(script_pubkey_arg_ref.datalen, "LDKCVec_u8Z Bytes");
32048         memcpy(script_pubkey_arg_ref.data, script_pubkey_arg->elems, script_pubkey_arg_ref.datalen); FREE(script_pubkey_arg);
32049         LDKWatchedOutput ret_var = WatchedOutput_new(block_hash_arg_conv, outpoint_arg_conv, script_pubkey_arg_ref);
32050         uint64_t ret_ref = 0;
32051         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
32052         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
32053         return ret_ref;
32054 }
32055
32056 static inline uint64_t WatchedOutput_clone_ptr(LDKWatchedOutput *NONNULL_PTR arg) {
32057         LDKWatchedOutput ret_var = WatchedOutput_clone(arg);
32058         uint64_t ret_ref = 0;
32059         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
32060         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
32061         return ret_ref;
32062 }
32063 int64_t  __attribute__((export_name("TS_WatchedOutput_clone_ptr"))) TS_WatchedOutput_clone_ptr(uint64_t arg) {
32064         LDKWatchedOutput arg_conv;
32065         arg_conv.inner = untag_ptr(arg);
32066         arg_conv.is_owned = ptr_is_owned(arg);
32067         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
32068         arg_conv.is_owned = false;
32069         int64_t ret_conv = WatchedOutput_clone_ptr(&arg_conv);
32070         return ret_conv;
32071 }
32072
32073 uint64_t  __attribute__((export_name("TS_WatchedOutput_clone"))) TS_WatchedOutput_clone(uint64_t orig) {
32074         LDKWatchedOutput orig_conv;
32075         orig_conv.inner = untag_ptr(orig);
32076         orig_conv.is_owned = ptr_is_owned(orig);
32077         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
32078         orig_conv.is_owned = false;
32079         LDKWatchedOutput ret_var = WatchedOutput_clone(&orig_conv);
32080         uint64_t ret_ref = 0;
32081         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
32082         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
32083         return ret_ref;
32084 }
32085
32086 jboolean  __attribute__((export_name("TS_WatchedOutput_eq"))) TS_WatchedOutput_eq(uint64_t a, uint64_t b) {
32087         LDKWatchedOutput a_conv;
32088         a_conv.inner = untag_ptr(a);
32089         a_conv.is_owned = ptr_is_owned(a);
32090         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
32091         a_conv.is_owned = false;
32092         LDKWatchedOutput b_conv;
32093         b_conv.inner = untag_ptr(b);
32094         b_conv.is_owned = ptr_is_owned(b);
32095         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
32096         b_conv.is_owned = false;
32097         jboolean ret_conv = WatchedOutput_eq(&a_conv, &b_conv);
32098         return ret_conv;
32099 }
32100
32101 int64_t  __attribute__((export_name("TS_WatchedOutput_hash"))) TS_WatchedOutput_hash(uint64_t o) {
32102         LDKWatchedOutput o_conv;
32103         o_conv.inner = untag_ptr(o);
32104         o_conv.is_owned = ptr_is_owned(o);
32105         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
32106         o_conv.is_owned = false;
32107         int64_t ret_conv = WatchedOutput_hash(&o_conv);
32108         return ret_conv;
32109 }
32110
32111 void  __attribute__((export_name("TS_BroadcasterInterface_free"))) TS_BroadcasterInterface_free(uint64_t this_ptr) {
32112         if (!ptr_is_owned(this_ptr)) return;
32113         void* this_ptr_ptr = untag_ptr(this_ptr);
32114         CHECK_ACCESS(this_ptr_ptr);
32115         LDKBroadcasterInterface this_ptr_conv = *(LDKBroadcasterInterface*)(this_ptr_ptr);
32116         FREE(untag_ptr(this_ptr));
32117         BroadcasterInterface_free(this_ptr_conv);
32118 }
32119
32120 uint32_t  __attribute__((export_name("TS_ConfirmationTarget_clone"))) TS_ConfirmationTarget_clone(uint64_t orig) {
32121         LDKConfirmationTarget* orig_conv = (LDKConfirmationTarget*)untag_ptr(orig);
32122         uint32_t ret_conv = LDKConfirmationTarget_to_js(ConfirmationTarget_clone(orig_conv));
32123         return ret_conv;
32124 }
32125
32126 uint32_t  __attribute__((export_name("TS_ConfirmationTarget_on_chain_sweep"))) TS_ConfirmationTarget_on_chain_sweep() {
32127         uint32_t ret_conv = LDKConfirmationTarget_to_js(ConfirmationTarget_on_chain_sweep());
32128         return ret_conv;
32129 }
32130
32131 uint32_t  __attribute__((export_name("TS_ConfirmationTarget_max_allowed_non_anchor_channel_remote_fee"))) TS_ConfirmationTarget_max_allowed_non_anchor_channel_remote_fee() {
32132         uint32_t ret_conv = LDKConfirmationTarget_to_js(ConfirmationTarget_max_allowed_non_anchor_channel_remote_fee());
32133         return ret_conv;
32134 }
32135
32136 uint32_t  __attribute__((export_name("TS_ConfirmationTarget_min_allowed_anchor_channel_remote_fee"))) TS_ConfirmationTarget_min_allowed_anchor_channel_remote_fee() {
32137         uint32_t ret_conv = LDKConfirmationTarget_to_js(ConfirmationTarget_min_allowed_anchor_channel_remote_fee());
32138         return ret_conv;
32139 }
32140
32141 uint32_t  __attribute__((export_name("TS_ConfirmationTarget_min_allowed_non_anchor_channel_remote_fee"))) TS_ConfirmationTarget_min_allowed_non_anchor_channel_remote_fee() {
32142         uint32_t ret_conv = LDKConfirmationTarget_to_js(ConfirmationTarget_min_allowed_non_anchor_channel_remote_fee());
32143         return ret_conv;
32144 }
32145
32146 uint32_t  __attribute__((export_name("TS_ConfirmationTarget_anchor_channel_fee"))) TS_ConfirmationTarget_anchor_channel_fee() {
32147         uint32_t ret_conv = LDKConfirmationTarget_to_js(ConfirmationTarget_anchor_channel_fee());
32148         return ret_conv;
32149 }
32150
32151 uint32_t  __attribute__((export_name("TS_ConfirmationTarget_non_anchor_channel_fee"))) TS_ConfirmationTarget_non_anchor_channel_fee() {
32152         uint32_t ret_conv = LDKConfirmationTarget_to_js(ConfirmationTarget_non_anchor_channel_fee());
32153         return ret_conv;
32154 }
32155
32156 uint32_t  __attribute__((export_name("TS_ConfirmationTarget_channel_close_minimum"))) TS_ConfirmationTarget_channel_close_minimum() {
32157         uint32_t ret_conv = LDKConfirmationTarget_to_js(ConfirmationTarget_channel_close_minimum());
32158         return ret_conv;
32159 }
32160
32161 int64_t  __attribute__((export_name("TS_ConfirmationTarget_hash"))) TS_ConfirmationTarget_hash(uint64_t o) {
32162         LDKConfirmationTarget* o_conv = (LDKConfirmationTarget*)untag_ptr(o);
32163         int64_t ret_conv = ConfirmationTarget_hash(o_conv);
32164         return ret_conv;
32165 }
32166
32167 jboolean  __attribute__((export_name("TS_ConfirmationTarget_eq"))) TS_ConfirmationTarget_eq(uint64_t a, uint64_t b) {
32168         LDKConfirmationTarget* a_conv = (LDKConfirmationTarget*)untag_ptr(a);
32169         LDKConfirmationTarget* b_conv = (LDKConfirmationTarget*)untag_ptr(b);
32170         jboolean ret_conv = ConfirmationTarget_eq(a_conv, b_conv);
32171         return ret_conv;
32172 }
32173
32174 void  __attribute__((export_name("TS_FeeEstimator_free"))) TS_FeeEstimator_free(uint64_t this_ptr) {
32175         if (!ptr_is_owned(this_ptr)) return;
32176         void* this_ptr_ptr = untag_ptr(this_ptr);
32177         CHECK_ACCESS(this_ptr_ptr);
32178         LDKFeeEstimator this_ptr_conv = *(LDKFeeEstimator*)(this_ptr_ptr);
32179         FREE(untag_ptr(this_ptr));
32180         FeeEstimator_free(this_ptr_conv);
32181 }
32182
32183 void  __attribute__((export_name("TS_MonitorUpdateId_free"))) TS_MonitorUpdateId_free(uint64_t this_obj) {
32184         LDKMonitorUpdateId this_obj_conv;
32185         this_obj_conv.inner = untag_ptr(this_obj);
32186         this_obj_conv.is_owned = ptr_is_owned(this_obj);
32187         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
32188         MonitorUpdateId_free(this_obj_conv);
32189 }
32190
32191 static inline uint64_t MonitorUpdateId_clone_ptr(LDKMonitorUpdateId *NONNULL_PTR arg) {
32192         LDKMonitorUpdateId ret_var = MonitorUpdateId_clone(arg);
32193         uint64_t ret_ref = 0;
32194         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
32195         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
32196         return ret_ref;
32197 }
32198 int64_t  __attribute__((export_name("TS_MonitorUpdateId_clone_ptr"))) TS_MonitorUpdateId_clone_ptr(uint64_t arg) {
32199         LDKMonitorUpdateId arg_conv;
32200         arg_conv.inner = untag_ptr(arg);
32201         arg_conv.is_owned = ptr_is_owned(arg);
32202         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
32203         arg_conv.is_owned = false;
32204         int64_t ret_conv = MonitorUpdateId_clone_ptr(&arg_conv);
32205         return ret_conv;
32206 }
32207
32208 uint64_t  __attribute__((export_name("TS_MonitorUpdateId_clone"))) TS_MonitorUpdateId_clone(uint64_t orig) {
32209         LDKMonitorUpdateId orig_conv;
32210         orig_conv.inner = untag_ptr(orig);
32211         orig_conv.is_owned = ptr_is_owned(orig);
32212         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
32213         orig_conv.is_owned = false;
32214         LDKMonitorUpdateId ret_var = MonitorUpdateId_clone(&orig_conv);
32215         uint64_t ret_ref = 0;
32216         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
32217         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
32218         return ret_ref;
32219 }
32220
32221 int64_t  __attribute__((export_name("TS_MonitorUpdateId_hash"))) TS_MonitorUpdateId_hash(uint64_t o) {
32222         LDKMonitorUpdateId o_conv;
32223         o_conv.inner = untag_ptr(o);
32224         o_conv.is_owned = ptr_is_owned(o);
32225         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
32226         o_conv.is_owned = false;
32227         int64_t ret_conv = MonitorUpdateId_hash(&o_conv);
32228         return ret_conv;
32229 }
32230
32231 jboolean  __attribute__((export_name("TS_MonitorUpdateId_eq"))) TS_MonitorUpdateId_eq(uint64_t a, uint64_t b) {
32232         LDKMonitorUpdateId a_conv;
32233         a_conv.inner = untag_ptr(a);
32234         a_conv.is_owned = ptr_is_owned(a);
32235         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
32236         a_conv.is_owned = false;
32237         LDKMonitorUpdateId b_conv;
32238         b_conv.inner = untag_ptr(b);
32239         b_conv.is_owned = ptr_is_owned(b);
32240         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
32241         b_conv.is_owned = false;
32242         jboolean ret_conv = MonitorUpdateId_eq(&a_conv, &b_conv);
32243         return ret_conv;
32244 }
32245
32246 void  __attribute__((export_name("TS_Persist_free"))) TS_Persist_free(uint64_t this_ptr) {
32247         if (!ptr_is_owned(this_ptr)) return;
32248         void* this_ptr_ptr = untag_ptr(this_ptr);
32249         CHECK_ACCESS(this_ptr_ptr);
32250         LDKPersist this_ptr_conv = *(LDKPersist*)(this_ptr_ptr);
32251         FREE(untag_ptr(this_ptr));
32252         Persist_free(this_ptr_conv);
32253 }
32254
32255 void  __attribute__((export_name("TS_LockedChannelMonitor_free"))) TS_LockedChannelMonitor_free(uint64_t this_obj) {
32256         LDKLockedChannelMonitor this_obj_conv;
32257         this_obj_conv.inner = untag_ptr(this_obj);
32258         this_obj_conv.is_owned = ptr_is_owned(this_obj);
32259         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
32260         LockedChannelMonitor_free(this_obj_conv);
32261 }
32262
32263 void  __attribute__((export_name("TS_ChainMonitor_free"))) TS_ChainMonitor_free(uint64_t this_obj) {
32264         LDKChainMonitor this_obj_conv;
32265         this_obj_conv.inner = untag_ptr(this_obj);
32266         this_obj_conv.is_owned = ptr_is_owned(this_obj);
32267         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
32268         ChainMonitor_free(this_obj_conv);
32269 }
32270
32271 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) {
32272         void* chain_source_ptr = untag_ptr(chain_source);
32273         CHECK_ACCESS(chain_source_ptr);
32274         LDKCOption_FilterZ chain_source_conv = *(LDKCOption_FilterZ*)(chain_source_ptr);
32275         // WARNING: we may need a move here but no clone is available for LDKCOption_FilterZ
32276         if (chain_source_conv.tag == LDKCOption_FilterZ_Some) {
32277                 // Manually implement clone for Java trait instances
32278                 if (chain_source_conv.some.free == LDKFilter_JCalls_free) {
32279                         // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
32280                         LDKFilter_JCalls_cloned(&chain_source_conv.some);
32281                 }
32282         }
32283         void* broadcaster_ptr = untag_ptr(broadcaster);
32284         CHECK_ACCESS(broadcaster_ptr);
32285         LDKBroadcasterInterface broadcaster_conv = *(LDKBroadcasterInterface*)(broadcaster_ptr);
32286         if (broadcaster_conv.free == LDKBroadcasterInterface_JCalls_free) {
32287                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
32288                 LDKBroadcasterInterface_JCalls_cloned(&broadcaster_conv);
32289         }
32290         void* logger_ptr = untag_ptr(logger);
32291         CHECK_ACCESS(logger_ptr);
32292         LDKLogger logger_conv = *(LDKLogger*)(logger_ptr);
32293         if (logger_conv.free == LDKLogger_JCalls_free) {
32294                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
32295                 LDKLogger_JCalls_cloned(&logger_conv);
32296         }
32297         void* feeest_ptr = untag_ptr(feeest);
32298         CHECK_ACCESS(feeest_ptr);
32299         LDKFeeEstimator feeest_conv = *(LDKFeeEstimator*)(feeest_ptr);
32300         if (feeest_conv.free == LDKFeeEstimator_JCalls_free) {
32301                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
32302                 LDKFeeEstimator_JCalls_cloned(&feeest_conv);
32303         }
32304         void* persister_ptr = untag_ptr(persister);
32305         CHECK_ACCESS(persister_ptr);
32306         LDKPersist persister_conv = *(LDKPersist*)(persister_ptr);
32307         if (persister_conv.free == LDKPersist_JCalls_free) {
32308                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
32309                 LDKPersist_JCalls_cloned(&persister_conv);
32310         }
32311         LDKChainMonitor ret_var = ChainMonitor_new(chain_source_conv, broadcaster_conv, logger_conv, feeest_conv, persister_conv);
32312         uint64_t ret_ref = 0;
32313         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
32314         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
32315         return ret_ref;
32316 }
32317
32318 uint64_tArray  __attribute__((export_name("TS_ChainMonitor_get_claimable_balances"))) TS_ChainMonitor_get_claimable_balances(uint64_t this_arg, uint64_tArray ignored_channels) {
32319         LDKChainMonitor this_arg_conv;
32320         this_arg_conv.inner = untag_ptr(this_arg);
32321         this_arg_conv.is_owned = ptr_is_owned(this_arg);
32322         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
32323         this_arg_conv.is_owned = false;
32324         LDKCVec_ChannelDetailsZ ignored_channels_constr;
32325         ignored_channels_constr.datalen = ignored_channels->arr_len;
32326         if (ignored_channels_constr.datalen > 0)
32327                 ignored_channels_constr.data = MALLOC(ignored_channels_constr.datalen * sizeof(LDKChannelDetails), "LDKCVec_ChannelDetailsZ Elements");
32328         else
32329                 ignored_channels_constr.data = NULL;
32330         uint64_t* ignored_channels_vals = ignored_channels->elems;
32331         for (size_t q = 0; q < ignored_channels_constr.datalen; q++) {
32332                 uint64_t ignored_channels_conv_16 = ignored_channels_vals[q];
32333                 LDKChannelDetails ignored_channels_conv_16_conv;
32334                 ignored_channels_conv_16_conv.inner = untag_ptr(ignored_channels_conv_16);
32335                 ignored_channels_conv_16_conv.is_owned = ptr_is_owned(ignored_channels_conv_16);
32336                 CHECK_INNER_FIELD_ACCESS_OR_NULL(ignored_channels_conv_16_conv);
32337                 ignored_channels_conv_16_conv = ChannelDetails_clone(&ignored_channels_conv_16_conv);
32338                 ignored_channels_constr.data[q] = ignored_channels_conv_16_conv;
32339         }
32340         FREE(ignored_channels);
32341         LDKCVec_BalanceZ ret_var = ChainMonitor_get_claimable_balances(&this_arg_conv, ignored_channels_constr);
32342         uint64_tArray ret_arr = NULL;
32343         ret_arr = init_uint64_tArray(ret_var.datalen, __LINE__);
32344         uint64_t *ret_arr_ptr = (uint64_t*)(((uint8_t*)ret_arr) + 8);
32345         for (size_t j = 0; j < ret_var.datalen; j++) {
32346                 LDKBalance *ret_conv_9_copy = MALLOC(sizeof(LDKBalance), "LDKBalance");
32347                 *ret_conv_9_copy = ret_var.data[j];
32348                 uint64_t ret_conv_9_ref = tag_ptr(ret_conv_9_copy, true);
32349                 ret_arr_ptr[j] = ret_conv_9_ref;
32350         }
32351         
32352         FREE(ret_var.data);
32353         return ret_arr;
32354 }
32355
32356 uint64_t  __attribute__((export_name("TS_ChainMonitor_get_monitor"))) TS_ChainMonitor_get_monitor(uint64_t this_arg, uint64_t funding_txo) {
32357         LDKChainMonitor this_arg_conv;
32358         this_arg_conv.inner = untag_ptr(this_arg);
32359         this_arg_conv.is_owned = ptr_is_owned(this_arg);
32360         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
32361         this_arg_conv.is_owned = false;
32362         LDKOutPoint funding_txo_conv;
32363         funding_txo_conv.inner = untag_ptr(funding_txo);
32364         funding_txo_conv.is_owned = ptr_is_owned(funding_txo);
32365         CHECK_INNER_FIELD_ACCESS_OR_NULL(funding_txo_conv);
32366         funding_txo_conv = OutPoint_clone(&funding_txo_conv);
32367         LDKCResult_LockedChannelMonitorNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_LockedChannelMonitorNoneZ), "LDKCResult_LockedChannelMonitorNoneZ");
32368         *ret_conv = ChainMonitor_get_monitor(&this_arg_conv, funding_txo_conv);
32369         return tag_ptr(ret_conv, true);
32370 }
32371
32372 uint64_tArray  __attribute__((export_name("TS_ChainMonitor_list_monitors"))) TS_ChainMonitor_list_monitors(uint64_t this_arg) {
32373         LDKChainMonitor this_arg_conv;
32374         this_arg_conv.inner = untag_ptr(this_arg);
32375         this_arg_conv.is_owned = ptr_is_owned(this_arg);
32376         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
32377         this_arg_conv.is_owned = false;
32378         LDKCVec_OutPointZ ret_var = ChainMonitor_list_monitors(&this_arg_conv);
32379         uint64_tArray ret_arr = NULL;
32380         ret_arr = init_uint64_tArray(ret_var.datalen, __LINE__);
32381         uint64_t *ret_arr_ptr = (uint64_t*)(((uint8_t*)ret_arr) + 8);
32382         for (size_t k = 0; k < ret_var.datalen; k++) {
32383                 LDKOutPoint ret_conv_10_var = ret_var.data[k];
32384                 uint64_t ret_conv_10_ref = 0;
32385                 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_conv_10_var);
32386                 ret_conv_10_ref = tag_ptr(ret_conv_10_var.inner, ret_conv_10_var.is_owned);
32387                 ret_arr_ptr[k] = ret_conv_10_ref;
32388         }
32389         
32390         FREE(ret_var.data);
32391         return ret_arr;
32392 }
32393
32394 uint64_tArray  __attribute__((export_name("TS_ChainMonitor_list_pending_monitor_updates"))) TS_ChainMonitor_list_pending_monitor_updates(uint64_t this_arg) {
32395         LDKChainMonitor this_arg_conv;
32396         this_arg_conv.inner = untag_ptr(this_arg);
32397         this_arg_conv.is_owned = ptr_is_owned(this_arg);
32398         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
32399         this_arg_conv.is_owned = false;
32400         LDKCVec_C2Tuple_OutPointCVec_MonitorUpdateIdZZZ ret_var = ChainMonitor_list_pending_monitor_updates(&this_arg_conv);
32401         uint64_tArray ret_arr = NULL;
32402         ret_arr = init_uint64_tArray(ret_var.datalen, __LINE__);
32403         uint64_t *ret_arr_ptr = (uint64_t*)(((uint8_t*)ret_arr) + 8);
32404         for (size_t p = 0; p < ret_var.datalen; p++) {
32405                 LDKC2Tuple_OutPointCVec_MonitorUpdateIdZZ* ret_conv_41_conv = MALLOC(sizeof(LDKC2Tuple_OutPointCVec_MonitorUpdateIdZZ), "LDKC2Tuple_OutPointCVec_MonitorUpdateIdZZ");
32406                 *ret_conv_41_conv = ret_var.data[p];
32407                 ret_arr_ptr[p] = tag_ptr(ret_conv_41_conv, true);
32408         }
32409         
32410         FREE(ret_var.data);
32411         return ret_arr;
32412 }
32413
32414 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) {
32415         LDKChainMonitor this_arg_conv;
32416         this_arg_conv.inner = untag_ptr(this_arg);
32417         this_arg_conv.is_owned = ptr_is_owned(this_arg);
32418         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
32419         this_arg_conv.is_owned = false;
32420         LDKOutPoint funding_txo_conv;
32421         funding_txo_conv.inner = untag_ptr(funding_txo);
32422         funding_txo_conv.is_owned = ptr_is_owned(funding_txo);
32423         CHECK_INNER_FIELD_ACCESS_OR_NULL(funding_txo_conv);
32424         funding_txo_conv = OutPoint_clone(&funding_txo_conv);
32425         LDKMonitorUpdateId completed_update_id_conv;
32426         completed_update_id_conv.inner = untag_ptr(completed_update_id);
32427         completed_update_id_conv.is_owned = ptr_is_owned(completed_update_id);
32428         CHECK_INNER_FIELD_ACCESS_OR_NULL(completed_update_id_conv);
32429         completed_update_id_conv = MonitorUpdateId_clone(&completed_update_id_conv);
32430         LDKCResult_NoneAPIErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneAPIErrorZ), "LDKCResult_NoneAPIErrorZ");
32431         *ret_conv = ChainMonitor_channel_monitor_updated(&this_arg_conv, funding_txo_conv, completed_update_id_conv);
32432         return tag_ptr(ret_conv, true);
32433 }
32434
32435 uint64_t  __attribute__((export_name("TS_ChainMonitor_get_update_future"))) TS_ChainMonitor_get_update_future(uint64_t this_arg) {
32436         LDKChainMonitor this_arg_conv;
32437         this_arg_conv.inner = untag_ptr(this_arg);
32438         this_arg_conv.is_owned = ptr_is_owned(this_arg);
32439         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
32440         this_arg_conv.is_owned = false;
32441         LDKFuture ret_var = ChainMonitor_get_update_future(&this_arg_conv);
32442         uint64_t ret_ref = 0;
32443         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
32444         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
32445         return ret_ref;
32446 }
32447
32448 void  __attribute__((export_name("TS_ChainMonitor_rebroadcast_pending_claims"))) TS_ChainMonitor_rebroadcast_pending_claims(uint64_t this_arg) {
32449         LDKChainMonitor this_arg_conv;
32450         this_arg_conv.inner = untag_ptr(this_arg);
32451         this_arg_conv.is_owned = ptr_is_owned(this_arg);
32452         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
32453         this_arg_conv.is_owned = false;
32454         ChainMonitor_rebroadcast_pending_claims(&this_arg_conv);
32455 }
32456
32457 uint64_t  __attribute__((export_name("TS_ChainMonitor_as_Listen"))) TS_ChainMonitor_as_Listen(uint64_t this_arg) {
32458         LDKChainMonitor this_arg_conv;
32459         this_arg_conv.inner = untag_ptr(this_arg);
32460         this_arg_conv.is_owned = ptr_is_owned(this_arg);
32461         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
32462         this_arg_conv.is_owned = false;
32463         LDKListen* ret_ret = MALLOC(sizeof(LDKListen), "LDKListen");
32464         *ret_ret = ChainMonitor_as_Listen(&this_arg_conv);
32465         return tag_ptr(ret_ret, true);
32466 }
32467
32468 uint64_t  __attribute__((export_name("TS_ChainMonitor_as_Confirm"))) TS_ChainMonitor_as_Confirm(uint64_t this_arg) {
32469         LDKChainMonitor this_arg_conv;
32470         this_arg_conv.inner = untag_ptr(this_arg);
32471         this_arg_conv.is_owned = ptr_is_owned(this_arg);
32472         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
32473         this_arg_conv.is_owned = false;
32474         LDKConfirm* ret_ret = MALLOC(sizeof(LDKConfirm), "LDKConfirm");
32475         *ret_ret = ChainMonitor_as_Confirm(&this_arg_conv);
32476         return tag_ptr(ret_ret, true);
32477 }
32478
32479 uint64_t  __attribute__((export_name("TS_ChainMonitor_as_Watch"))) TS_ChainMonitor_as_Watch(uint64_t this_arg) {
32480         LDKChainMonitor this_arg_conv;
32481         this_arg_conv.inner = untag_ptr(this_arg);
32482         this_arg_conv.is_owned = ptr_is_owned(this_arg);
32483         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
32484         this_arg_conv.is_owned = false;
32485         LDKWatch* ret_ret = MALLOC(sizeof(LDKWatch), "LDKWatch");
32486         *ret_ret = ChainMonitor_as_Watch(&this_arg_conv);
32487         return tag_ptr(ret_ret, true);
32488 }
32489
32490 uint64_t  __attribute__((export_name("TS_ChainMonitor_as_EventsProvider"))) TS_ChainMonitor_as_EventsProvider(uint64_t this_arg) {
32491         LDKChainMonitor this_arg_conv;
32492         this_arg_conv.inner = untag_ptr(this_arg);
32493         this_arg_conv.is_owned = ptr_is_owned(this_arg);
32494         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
32495         this_arg_conv.is_owned = false;
32496         LDKEventsProvider* ret_ret = MALLOC(sizeof(LDKEventsProvider), "LDKEventsProvider");
32497         *ret_ret = ChainMonitor_as_EventsProvider(&this_arg_conv);
32498         return tag_ptr(ret_ret, true);
32499 }
32500
32501 void  __attribute__((export_name("TS_ChannelMonitorUpdate_free"))) TS_ChannelMonitorUpdate_free(uint64_t this_obj) {
32502         LDKChannelMonitorUpdate this_obj_conv;
32503         this_obj_conv.inner = untag_ptr(this_obj);
32504         this_obj_conv.is_owned = ptr_is_owned(this_obj);
32505         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
32506         ChannelMonitorUpdate_free(this_obj_conv);
32507 }
32508
32509 int64_t  __attribute__((export_name("TS_ChannelMonitorUpdate_get_update_id"))) TS_ChannelMonitorUpdate_get_update_id(uint64_t this_ptr) {
32510         LDKChannelMonitorUpdate this_ptr_conv;
32511         this_ptr_conv.inner = untag_ptr(this_ptr);
32512         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
32513         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
32514         this_ptr_conv.is_owned = false;
32515         int64_t ret_conv = ChannelMonitorUpdate_get_update_id(&this_ptr_conv);
32516         return ret_conv;
32517 }
32518
32519 void  __attribute__((export_name("TS_ChannelMonitorUpdate_set_update_id"))) TS_ChannelMonitorUpdate_set_update_id(uint64_t this_ptr, int64_t val) {
32520         LDKChannelMonitorUpdate this_ptr_conv;
32521         this_ptr_conv.inner = untag_ptr(this_ptr);
32522         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
32523         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
32524         this_ptr_conv.is_owned = false;
32525         ChannelMonitorUpdate_set_update_id(&this_ptr_conv, val);
32526 }
32527
32528 static inline uint64_t ChannelMonitorUpdate_clone_ptr(LDKChannelMonitorUpdate *NONNULL_PTR arg) {
32529         LDKChannelMonitorUpdate ret_var = ChannelMonitorUpdate_clone(arg);
32530         uint64_t ret_ref = 0;
32531         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
32532         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
32533         return ret_ref;
32534 }
32535 int64_t  __attribute__((export_name("TS_ChannelMonitorUpdate_clone_ptr"))) TS_ChannelMonitorUpdate_clone_ptr(uint64_t arg) {
32536         LDKChannelMonitorUpdate arg_conv;
32537         arg_conv.inner = untag_ptr(arg);
32538         arg_conv.is_owned = ptr_is_owned(arg);
32539         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
32540         arg_conv.is_owned = false;
32541         int64_t ret_conv = ChannelMonitorUpdate_clone_ptr(&arg_conv);
32542         return ret_conv;
32543 }
32544
32545 uint64_t  __attribute__((export_name("TS_ChannelMonitorUpdate_clone"))) TS_ChannelMonitorUpdate_clone(uint64_t orig) {
32546         LDKChannelMonitorUpdate orig_conv;
32547         orig_conv.inner = untag_ptr(orig);
32548         orig_conv.is_owned = ptr_is_owned(orig);
32549         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
32550         orig_conv.is_owned = false;
32551         LDKChannelMonitorUpdate ret_var = ChannelMonitorUpdate_clone(&orig_conv);
32552         uint64_t ret_ref = 0;
32553         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
32554         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
32555         return ret_ref;
32556 }
32557
32558 jboolean  __attribute__((export_name("TS_ChannelMonitorUpdate_eq"))) TS_ChannelMonitorUpdate_eq(uint64_t a, uint64_t b) {
32559         LDKChannelMonitorUpdate a_conv;
32560         a_conv.inner = untag_ptr(a);
32561         a_conv.is_owned = ptr_is_owned(a);
32562         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
32563         a_conv.is_owned = false;
32564         LDKChannelMonitorUpdate b_conv;
32565         b_conv.inner = untag_ptr(b);
32566         b_conv.is_owned = ptr_is_owned(b);
32567         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
32568         b_conv.is_owned = false;
32569         jboolean ret_conv = ChannelMonitorUpdate_eq(&a_conv, &b_conv);
32570         return ret_conv;
32571 }
32572
32573 int8_tArray  __attribute__((export_name("TS_ChannelMonitorUpdate_write"))) TS_ChannelMonitorUpdate_write(uint64_t obj) {
32574         LDKChannelMonitorUpdate obj_conv;
32575         obj_conv.inner = untag_ptr(obj);
32576         obj_conv.is_owned = ptr_is_owned(obj);
32577         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
32578         obj_conv.is_owned = false;
32579         LDKCVec_u8Z ret_var = ChannelMonitorUpdate_write(&obj_conv);
32580         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
32581         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
32582         CVec_u8Z_free(ret_var);
32583         return ret_arr;
32584 }
32585
32586 uint64_t  __attribute__((export_name("TS_ChannelMonitorUpdate_read"))) TS_ChannelMonitorUpdate_read(int8_tArray ser) {
32587         LDKu8slice ser_ref;
32588         ser_ref.datalen = ser->arr_len;
32589         ser_ref.data = ser->elems;
32590         LDKCResult_ChannelMonitorUpdateDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelMonitorUpdateDecodeErrorZ), "LDKCResult_ChannelMonitorUpdateDecodeErrorZ");
32591         *ret_conv = ChannelMonitorUpdate_read(ser_ref);
32592         FREE(ser);
32593         return tag_ptr(ret_conv, true);
32594 }
32595
32596 void  __attribute__((export_name("TS_MonitorEvent_free"))) TS_MonitorEvent_free(uint64_t this_ptr) {
32597         if (!ptr_is_owned(this_ptr)) return;
32598         void* this_ptr_ptr = untag_ptr(this_ptr);
32599         CHECK_ACCESS(this_ptr_ptr);
32600         LDKMonitorEvent this_ptr_conv = *(LDKMonitorEvent*)(this_ptr_ptr);
32601         FREE(untag_ptr(this_ptr));
32602         MonitorEvent_free(this_ptr_conv);
32603 }
32604
32605 static inline uint64_t MonitorEvent_clone_ptr(LDKMonitorEvent *NONNULL_PTR arg) {
32606         LDKMonitorEvent *ret_copy = MALLOC(sizeof(LDKMonitorEvent), "LDKMonitorEvent");
32607         *ret_copy = MonitorEvent_clone(arg);
32608         uint64_t ret_ref = tag_ptr(ret_copy, true);
32609         return ret_ref;
32610 }
32611 int64_t  __attribute__((export_name("TS_MonitorEvent_clone_ptr"))) TS_MonitorEvent_clone_ptr(uint64_t arg) {
32612         LDKMonitorEvent* arg_conv = (LDKMonitorEvent*)untag_ptr(arg);
32613         int64_t ret_conv = MonitorEvent_clone_ptr(arg_conv);
32614         return ret_conv;
32615 }
32616
32617 uint64_t  __attribute__((export_name("TS_MonitorEvent_clone"))) TS_MonitorEvent_clone(uint64_t orig) {
32618         LDKMonitorEvent* orig_conv = (LDKMonitorEvent*)untag_ptr(orig);
32619         LDKMonitorEvent *ret_copy = MALLOC(sizeof(LDKMonitorEvent), "LDKMonitorEvent");
32620         *ret_copy = MonitorEvent_clone(orig_conv);
32621         uint64_t ret_ref = tag_ptr(ret_copy, true);
32622         return ret_ref;
32623 }
32624
32625 uint64_t  __attribute__((export_name("TS_MonitorEvent_htlcevent"))) TS_MonitorEvent_htlcevent(uint64_t a) {
32626         LDKHTLCUpdate a_conv;
32627         a_conv.inner = untag_ptr(a);
32628         a_conv.is_owned = ptr_is_owned(a);
32629         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
32630         a_conv = HTLCUpdate_clone(&a_conv);
32631         LDKMonitorEvent *ret_copy = MALLOC(sizeof(LDKMonitorEvent), "LDKMonitorEvent");
32632         *ret_copy = MonitorEvent_htlcevent(a_conv);
32633         uint64_t ret_ref = tag_ptr(ret_copy, true);
32634         return ret_ref;
32635 }
32636
32637 uint64_t  __attribute__((export_name("TS_MonitorEvent_holder_force_closed"))) TS_MonitorEvent_holder_force_closed(uint64_t a) {
32638         LDKOutPoint a_conv;
32639         a_conv.inner = untag_ptr(a);
32640         a_conv.is_owned = ptr_is_owned(a);
32641         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
32642         a_conv = OutPoint_clone(&a_conv);
32643         LDKMonitorEvent *ret_copy = MALLOC(sizeof(LDKMonitorEvent), "LDKMonitorEvent");
32644         *ret_copy = MonitorEvent_holder_force_closed(a_conv);
32645         uint64_t ret_ref = tag_ptr(ret_copy, true);
32646         return ret_ref;
32647 }
32648
32649 uint64_t  __attribute__((export_name("TS_MonitorEvent_completed"))) TS_MonitorEvent_completed(uint64_t funding_txo, int64_t monitor_update_id) {
32650         LDKOutPoint funding_txo_conv;
32651         funding_txo_conv.inner = untag_ptr(funding_txo);
32652         funding_txo_conv.is_owned = ptr_is_owned(funding_txo);
32653         CHECK_INNER_FIELD_ACCESS_OR_NULL(funding_txo_conv);
32654         funding_txo_conv = OutPoint_clone(&funding_txo_conv);
32655         LDKMonitorEvent *ret_copy = MALLOC(sizeof(LDKMonitorEvent), "LDKMonitorEvent");
32656         *ret_copy = MonitorEvent_completed(funding_txo_conv, monitor_update_id);
32657         uint64_t ret_ref = tag_ptr(ret_copy, true);
32658         return ret_ref;
32659 }
32660
32661 jboolean  __attribute__((export_name("TS_MonitorEvent_eq"))) TS_MonitorEvent_eq(uint64_t a, uint64_t b) {
32662         LDKMonitorEvent* a_conv = (LDKMonitorEvent*)untag_ptr(a);
32663         LDKMonitorEvent* b_conv = (LDKMonitorEvent*)untag_ptr(b);
32664         jboolean ret_conv = MonitorEvent_eq(a_conv, b_conv);
32665         return ret_conv;
32666 }
32667
32668 int8_tArray  __attribute__((export_name("TS_MonitorEvent_write"))) TS_MonitorEvent_write(uint64_t obj) {
32669         LDKMonitorEvent* obj_conv = (LDKMonitorEvent*)untag_ptr(obj);
32670         LDKCVec_u8Z ret_var = MonitorEvent_write(obj_conv);
32671         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
32672         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
32673         CVec_u8Z_free(ret_var);
32674         return ret_arr;
32675 }
32676
32677 uint64_t  __attribute__((export_name("TS_MonitorEvent_read"))) TS_MonitorEvent_read(int8_tArray ser) {
32678         LDKu8slice ser_ref;
32679         ser_ref.datalen = ser->arr_len;
32680         ser_ref.data = ser->elems;
32681         LDKCResult_COption_MonitorEventZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_COption_MonitorEventZDecodeErrorZ), "LDKCResult_COption_MonitorEventZDecodeErrorZ");
32682         *ret_conv = MonitorEvent_read(ser_ref);
32683         FREE(ser);
32684         return tag_ptr(ret_conv, true);
32685 }
32686
32687 void  __attribute__((export_name("TS_HTLCUpdate_free"))) TS_HTLCUpdate_free(uint64_t this_obj) {
32688         LDKHTLCUpdate this_obj_conv;
32689         this_obj_conv.inner = untag_ptr(this_obj);
32690         this_obj_conv.is_owned = ptr_is_owned(this_obj);
32691         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
32692         HTLCUpdate_free(this_obj_conv);
32693 }
32694
32695 static inline uint64_t HTLCUpdate_clone_ptr(LDKHTLCUpdate *NONNULL_PTR arg) {
32696         LDKHTLCUpdate ret_var = HTLCUpdate_clone(arg);
32697         uint64_t ret_ref = 0;
32698         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
32699         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
32700         return ret_ref;
32701 }
32702 int64_t  __attribute__((export_name("TS_HTLCUpdate_clone_ptr"))) TS_HTLCUpdate_clone_ptr(uint64_t arg) {
32703         LDKHTLCUpdate arg_conv;
32704         arg_conv.inner = untag_ptr(arg);
32705         arg_conv.is_owned = ptr_is_owned(arg);
32706         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
32707         arg_conv.is_owned = false;
32708         int64_t ret_conv = HTLCUpdate_clone_ptr(&arg_conv);
32709         return ret_conv;
32710 }
32711
32712 uint64_t  __attribute__((export_name("TS_HTLCUpdate_clone"))) TS_HTLCUpdate_clone(uint64_t orig) {
32713         LDKHTLCUpdate orig_conv;
32714         orig_conv.inner = untag_ptr(orig);
32715         orig_conv.is_owned = ptr_is_owned(orig);
32716         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
32717         orig_conv.is_owned = false;
32718         LDKHTLCUpdate ret_var = HTLCUpdate_clone(&orig_conv);
32719         uint64_t ret_ref = 0;
32720         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
32721         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
32722         return ret_ref;
32723 }
32724
32725 jboolean  __attribute__((export_name("TS_HTLCUpdate_eq"))) TS_HTLCUpdate_eq(uint64_t a, uint64_t b) {
32726         LDKHTLCUpdate a_conv;
32727         a_conv.inner = untag_ptr(a);
32728         a_conv.is_owned = ptr_is_owned(a);
32729         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
32730         a_conv.is_owned = false;
32731         LDKHTLCUpdate b_conv;
32732         b_conv.inner = untag_ptr(b);
32733         b_conv.is_owned = ptr_is_owned(b);
32734         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
32735         b_conv.is_owned = false;
32736         jboolean ret_conv = HTLCUpdate_eq(&a_conv, &b_conv);
32737         return ret_conv;
32738 }
32739
32740 int8_tArray  __attribute__((export_name("TS_HTLCUpdate_write"))) TS_HTLCUpdate_write(uint64_t obj) {
32741         LDKHTLCUpdate obj_conv;
32742         obj_conv.inner = untag_ptr(obj);
32743         obj_conv.is_owned = ptr_is_owned(obj);
32744         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
32745         obj_conv.is_owned = false;
32746         LDKCVec_u8Z ret_var = HTLCUpdate_write(&obj_conv);
32747         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
32748         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
32749         CVec_u8Z_free(ret_var);
32750         return ret_arr;
32751 }
32752
32753 uint64_t  __attribute__((export_name("TS_HTLCUpdate_read"))) TS_HTLCUpdate_read(int8_tArray ser) {
32754         LDKu8slice ser_ref;
32755         ser_ref.datalen = ser->arr_len;
32756         ser_ref.data = ser->elems;
32757         LDKCResult_HTLCUpdateDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_HTLCUpdateDecodeErrorZ), "LDKCResult_HTLCUpdateDecodeErrorZ");
32758         *ret_conv = HTLCUpdate_read(ser_ref);
32759         FREE(ser);
32760         return tag_ptr(ret_conv, true);
32761 }
32762
32763 void  __attribute__((export_name("TS_Balance_free"))) TS_Balance_free(uint64_t this_ptr) {
32764         if (!ptr_is_owned(this_ptr)) return;
32765         void* this_ptr_ptr = untag_ptr(this_ptr);
32766         CHECK_ACCESS(this_ptr_ptr);
32767         LDKBalance this_ptr_conv = *(LDKBalance*)(this_ptr_ptr);
32768         FREE(untag_ptr(this_ptr));
32769         Balance_free(this_ptr_conv);
32770 }
32771
32772 static inline uint64_t Balance_clone_ptr(LDKBalance *NONNULL_PTR arg) {
32773         LDKBalance *ret_copy = MALLOC(sizeof(LDKBalance), "LDKBalance");
32774         *ret_copy = Balance_clone(arg);
32775         uint64_t ret_ref = tag_ptr(ret_copy, true);
32776         return ret_ref;
32777 }
32778 int64_t  __attribute__((export_name("TS_Balance_clone_ptr"))) TS_Balance_clone_ptr(uint64_t arg) {
32779         LDKBalance* arg_conv = (LDKBalance*)untag_ptr(arg);
32780         int64_t ret_conv = Balance_clone_ptr(arg_conv);
32781         return ret_conv;
32782 }
32783
32784 uint64_t  __attribute__((export_name("TS_Balance_clone"))) TS_Balance_clone(uint64_t orig) {
32785         LDKBalance* orig_conv = (LDKBalance*)untag_ptr(orig);
32786         LDKBalance *ret_copy = MALLOC(sizeof(LDKBalance), "LDKBalance");
32787         *ret_copy = Balance_clone(orig_conv);
32788         uint64_t ret_ref = tag_ptr(ret_copy, true);
32789         return ret_ref;
32790 }
32791
32792 uint64_t  __attribute__((export_name("TS_Balance_claimable_on_channel_close"))) TS_Balance_claimable_on_channel_close(int64_t amount_satoshis) {
32793         LDKBalance *ret_copy = MALLOC(sizeof(LDKBalance), "LDKBalance");
32794         *ret_copy = Balance_claimable_on_channel_close(amount_satoshis);
32795         uint64_t ret_ref = tag_ptr(ret_copy, true);
32796         return ret_ref;
32797 }
32798
32799 uint64_t  __attribute__((export_name("TS_Balance_claimable_awaiting_confirmations"))) TS_Balance_claimable_awaiting_confirmations(int64_t amount_satoshis, int32_t confirmation_height) {
32800         LDKBalance *ret_copy = MALLOC(sizeof(LDKBalance), "LDKBalance");
32801         *ret_copy = Balance_claimable_awaiting_confirmations(amount_satoshis, confirmation_height);
32802         uint64_t ret_ref = tag_ptr(ret_copy, true);
32803         return ret_ref;
32804 }
32805
32806 uint64_t  __attribute__((export_name("TS_Balance_contentious_claimable"))) TS_Balance_contentious_claimable(int64_t amount_satoshis, int32_t timeout_height, int8_tArray payment_hash, int8_tArray payment_preimage) {
32807         LDKThirtyTwoBytes payment_hash_ref;
32808         CHECK(payment_hash->arr_len == 32);
32809         memcpy(payment_hash_ref.data, payment_hash->elems, 32); FREE(payment_hash);
32810         LDKThirtyTwoBytes payment_preimage_ref;
32811         CHECK(payment_preimage->arr_len == 32);
32812         memcpy(payment_preimage_ref.data, payment_preimage->elems, 32); FREE(payment_preimage);
32813         LDKBalance *ret_copy = MALLOC(sizeof(LDKBalance), "LDKBalance");
32814         *ret_copy = Balance_contentious_claimable(amount_satoshis, timeout_height, payment_hash_ref, payment_preimage_ref);
32815         uint64_t ret_ref = tag_ptr(ret_copy, true);
32816         return ret_ref;
32817 }
32818
32819 uint64_t  __attribute__((export_name("TS_Balance_maybe_timeout_claimable_htlc"))) TS_Balance_maybe_timeout_claimable_htlc(int64_t amount_satoshis, int32_t claimable_height, int8_tArray payment_hash) {
32820         LDKThirtyTwoBytes payment_hash_ref;
32821         CHECK(payment_hash->arr_len == 32);
32822         memcpy(payment_hash_ref.data, payment_hash->elems, 32); FREE(payment_hash);
32823         LDKBalance *ret_copy = MALLOC(sizeof(LDKBalance), "LDKBalance");
32824         *ret_copy = Balance_maybe_timeout_claimable_htlc(amount_satoshis, claimable_height, payment_hash_ref);
32825         uint64_t ret_ref = tag_ptr(ret_copy, true);
32826         return ret_ref;
32827 }
32828
32829 uint64_t  __attribute__((export_name("TS_Balance_maybe_preimage_claimable_htlc"))) TS_Balance_maybe_preimage_claimable_htlc(int64_t amount_satoshis, int32_t expiry_height, int8_tArray payment_hash) {
32830         LDKThirtyTwoBytes payment_hash_ref;
32831         CHECK(payment_hash->arr_len == 32);
32832         memcpy(payment_hash_ref.data, payment_hash->elems, 32); FREE(payment_hash);
32833         LDKBalance *ret_copy = MALLOC(sizeof(LDKBalance), "LDKBalance");
32834         *ret_copy = Balance_maybe_preimage_claimable_htlc(amount_satoshis, expiry_height, payment_hash_ref);
32835         uint64_t ret_ref = tag_ptr(ret_copy, true);
32836         return ret_ref;
32837 }
32838
32839 uint64_t  __attribute__((export_name("TS_Balance_counterparty_revoked_output_claimable"))) TS_Balance_counterparty_revoked_output_claimable(int64_t amount_satoshis) {
32840         LDKBalance *ret_copy = MALLOC(sizeof(LDKBalance), "LDKBalance");
32841         *ret_copy = Balance_counterparty_revoked_output_claimable(amount_satoshis);
32842         uint64_t ret_ref = tag_ptr(ret_copy, true);
32843         return ret_ref;
32844 }
32845
32846 jboolean  __attribute__((export_name("TS_Balance_eq"))) TS_Balance_eq(uint64_t a, uint64_t b) {
32847         LDKBalance* a_conv = (LDKBalance*)untag_ptr(a);
32848         LDKBalance* b_conv = (LDKBalance*)untag_ptr(b);
32849         jboolean ret_conv = Balance_eq(a_conv, b_conv);
32850         return ret_conv;
32851 }
32852
32853 int64_t  __attribute__((export_name("TS_Balance_claimable_amount_satoshis"))) TS_Balance_claimable_amount_satoshis(uint64_t this_arg) {
32854         LDKBalance* this_arg_conv = (LDKBalance*)untag_ptr(this_arg);
32855         int64_t ret_conv = Balance_claimable_amount_satoshis(this_arg_conv);
32856         return ret_conv;
32857 }
32858
32859 void  __attribute__((export_name("TS_ChannelMonitor_free"))) TS_ChannelMonitor_free(uint64_t this_obj) {
32860         LDKChannelMonitor this_obj_conv;
32861         this_obj_conv.inner = untag_ptr(this_obj);
32862         this_obj_conv.is_owned = ptr_is_owned(this_obj);
32863         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
32864         ChannelMonitor_free(this_obj_conv);
32865 }
32866
32867 static inline uint64_t ChannelMonitor_clone_ptr(LDKChannelMonitor *NONNULL_PTR arg) {
32868         LDKChannelMonitor ret_var = ChannelMonitor_clone(arg);
32869         uint64_t ret_ref = 0;
32870         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
32871         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
32872         return ret_ref;
32873 }
32874 int64_t  __attribute__((export_name("TS_ChannelMonitor_clone_ptr"))) TS_ChannelMonitor_clone_ptr(uint64_t arg) {
32875         LDKChannelMonitor arg_conv;
32876         arg_conv.inner = untag_ptr(arg);
32877         arg_conv.is_owned = ptr_is_owned(arg);
32878         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
32879         arg_conv.is_owned = false;
32880         int64_t ret_conv = ChannelMonitor_clone_ptr(&arg_conv);
32881         return ret_conv;
32882 }
32883
32884 uint64_t  __attribute__((export_name("TS_ChannelMonitor_clone"))) TS_ChannelMonitor_clone(uint64_t orig) {
32885         LDKChannelMonitor orig_conv;
32886         orig_conv.inner = untag_ptr(orig);
32887         orig_conv.is_owned = ptr_is_owned(orig);
32888         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
32889         orig_conv.is_owned = false;
32890         LDKChannelMonitor ret_var = ChannelMonitor_clone(&orig_conv);
32891         uint64_t ret_ref = 0;
32892         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
32893         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
32894         return ret_ref;
32895 }
32896
32897 int8_tArray  __attribute__((export_name("TS_ChannelMonitor_write"))) TS_ChannelMonitor_write(uint64_t obj) {
32898         LDKChannelMonitor obj_conv;
32899         obj_conv.inner = untag_ptr(obj);
32900         obj_conv.is_owned = ptr_is_owned(obj);
32901         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
32902         obj_conv.is_owned = false;
32903         LDKCVec_u8Z ret_var = ChannelMonitor_write(&obj_conv);
32904         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
32905         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
32906         CVec_u8Z_free(ret_var);
32907         return ret_arr;
32908 }
32909
32910 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) {
32911         LDKChannelMonitor this_arg_conv;
32912         this_arg_conv.inner = untag_ptr(this_arg);
32913         this_arg_conv.is_owned = ptr_is_owned(this_arg);
32914         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
32915         this_arg_conv.is_owned = false;
32916         LDKChannelMonitorUpdate updates_conv;
32917         updates_conv.inner = untag_ptr(updates);
32918         updates_conv.is_owned = ptr_is_owned(updates);
32919         CHECK_INNER_FIELD_ACCESS_OR_NULL(updates_conv);
32920         updates_conv.is_owned = false;
32921         void* broadcaster_ptr = untag_ptr(broadcaster);
32922         if (ptr_is_owned(broadcaster)) { CHECK_ACCESS(broadcaster_ptr); }
32923         LDKBroadcasterInterface* broadcaster_conv = (LDKBroadcasterInterface*)broadcaster_ptr;
32924         void* fee_estimator_ptr = untag_ptr(fee_estimator);
32925         if (ptr_is_owned(fee_estimator)) { CHECK_ACCESS(fee_estimator_ptr); }
32926         LDKFeeEstimator* fee_estimator_conv = (LDKFeeEstimator*)fee_estimator_ptr;
32927         void* logger_ptr = untag_ptr(logger);
32928         if (ptr_is_owned(logger)) { CHECK_ACCESS(logger_ptr); }
32929         LDKLogger* logger_conv = (LDKLogger*)logger_ptr;
32930         LDKCResult_NoneNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneNoneZ), "LDKCResult_NoneNoneZ");
32931         *ret_conv = ChannelMonitor_update_monitor(&this_arg_conv, &updates_conv, broadcaster_conv, fee_estimator_conv, logger_conv);
32932         return tag_ptr(ret_conv, true);
32933 }
32934
32935 int64_t  __attribute__((export_name("TS_ChannelMonitor_get_latest_update_id"))) TS_ChannelMonitor_get_latest_update_id(uint64_t this_arg) {
32936         LDKChannelMonitor this_arg_conv;
32937         this_arg_conv.inner = untag_ptr(this_arg);
32938         this_arg_conv.is_owned = ptr_is_owned(this_arg);
32939         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
32940         this_arg_conv.is_owned = false;
32941         int64_t ret_conv = ChannelMonitor_get_latest_update_id(&this_arg_conv);
32942         return ret_conv;
32943 }
32944
32945 uint64_t  __attribute__((export_name("TS_ChannelMonitor_get_funding_txo"))) TS_ChannelMonitor_get_funding_txo(uint64_t this_arg) {
32946         LDKChannelMonitor this_arg_conv;
32947         this_arg_conv.inner = untag_ptr(this_arg);
32948         this_arg_conv.is_owned = ptr_is_owned(this_arg);
32949         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
32950         this_arg_conv.is_owned = false;
32951         LDKC2Tuple_OutPointCVec_u8ZZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_OutPointCVec_u8ZZ), "LDKC2Tuple_OutPointCVec_u8ZZ");
32952         *ret_conv = ChannelMonitor_get_funding_txo(&this_arg_conv);
32953         return tag_ptr(ret_conv, true);
32954 }
32955
32956 uint64_tArray  __attribute__((export_name("TS_ChannelMonitor_get_outputs_to_watch"))) TS_ChannelMonitor_get_outputs_to_watch(uint64_t this_arg) {
32957         LDKChannelMonitor this_arg_conv;
32958         this_arg_conv.inner = untag_ptr(this_arg);
32959         this_arg_conv.is_owned = ptr_is_owned(this_arg);
32960         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
32961         this_arg_conv.is_owned = false;
32962         LDKCVec_C2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32CVec_u8ZZZZZ ret_var = ChannelMonitor_get_outputs_to_watch(&this_arg_conv);
32963         uint64_tArray ret_arr = NULL;
32964         ret_arr = init_uint64_tArray(ret_var.datalen, __LINE__);
32965         uint64_t *ret_arr_ptr = (uint64_t*)(((uint8_t*)ret_arr) + 8);
32966         for (size_t a = 0; a < ret_var.datalen; a++) {
32967                 LDKC2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32CVec_u8ZZZZ* ret_conv_52_conv = MALLOC(sizeof(LDKC2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32CVec_u8ZZZZ), "LDKC2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32CVec_u8ZZZZ");
32968                 *ret_conv_52_conv = ret_var.data[a];
32969                 ret_arr_ptr[a] = tag_ptr(ret_conv_52_conv, true);
32970         }
32971         
32972         FREE(ret_var.data);
32973         return ret_arr;
32974 }
32975
32976 void  __attribute__((export_name("TS_ChannelMonitor_load_outputs_to_watch"))) TS_ChannelMonitor_load_outputs_to_watch(uint64_t this_arg, uint64_t filter) {
32977         LDKChannelMonitor this_arg_conv;
32978         this_arg_conv.inner = untag_ptr(this_arg);
32979         this_arg_conv.is_owned = ptr_is_owned(this_arg);
32980         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
32981         this_arg_conv.is_owned = false;
32982         void* filter_ptr = untag_ptr(filter);
32983         if (ptr_is_owned(filter)) { CHECK_ACCESS(filter_ptr); }
32984         LDKFilter* filter_conv = (LDKFilter*)filter_ptr;
32985         ChannelMonitor_load_outputs_to_watch(&this_arg_conv, filter_conv);
32986 }
32987
32988 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) {
32989         LDKChannelMonitor this_arg_conv;
32990         this_arg_conv.inner = untag_ptr(this_arg);
32991         this_arg_conv.is_owned = ptr_is_owned(this_arg);
32992         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
32993         this_arg_conv.is_owned = false;
32994         LDKCVec_MonitorEventZ ret_var = ChannelMonitor_get_and_clear_pending_monitor_events(&this_arg_conv);
32995         uint64_tArray ret_arr = NULL;
32996         ret_arr = init_uint64_tArray(ret_var.datalen, __LINE__);
32997         uint64_t *ret_arr_ptr = (uint64_t*)(((uint8_t*)ret_arr) + 8);
32998         for (size_t o = 0; o < ret_var.datalen; o++) {
32999                 LDKMonitorEvent *ret_conv_14_copy = MALLOC(sizeof(LDKMonitorEvent), "LDKMonitorEvent");
33000                 *ret_conv_14_copy = ret_var.data[o];
33001                 uint64_t ret_conv_14_ref = tag_ptr(ret_conv_14_copy, true);
33002                 ret_arr_ptr[o] = ret_conv_14_ref;
33003         }
33004         
33005         FREE(ret_var.data);
33006         return ret_arr;
33007 }
33008
33009 void  __attribute__((export_name("TS_ChannelMonitor_process_pending_events"))) TS_ChannelMonitor_process_pending_events(uint64_t this_arg, uint64_t handler) {
33010         LDKChannelMonitor this_arg_conv;
33011         this_arg_conv.inner = untag_ptr(this_arg);
33012         this_arg_conv.is_owned = ptr_is_owned(this_arg);
33013         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
33014         this_arg_conv.is_owned = false;
33015         void* handler_ptr = untag_ptr(handler);
33016         if (ptr_is_owned(handler)) { CHECK_ACCESS(handler_ptr); }
33017         LDKEventHandler* handler_conv = (LDKEventHandler*)handler_ptr;
33018         ChannelMonitor_process_pending_events(&this_arg_conv, handler_conv);
33019 }
33020
33021 uint64_t  __attribute__((export_name("TS_ChannelMonitor_initial_counterparty_commitment_tx"))) TS_ChannelMonitor_initial_counterparty_commitment_tx(uint64_t this_arg) {
33022         LDKChannelMonitor this_arg_conv;
33023         this_arg_conv.inner = untag_ptr(this_arg);
33024         this_arg_conv.is_owned = ptr_is_owned(this_arg);
33025         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
33026         this_arg_conv.is_owned = false;
33027         LDKCommitmentTransaction ret_var = ChannelMonitor_initial_counterparty_commitment_tx(&this_arg_conv);
33028         uint64_t ret_ref = 0;
33029         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
33030         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
33031         return ret_ref;
33032 }
33033
33034 uint64_tArray  __attribute__((export_name("TS_ChannelMonitor_counterparty_commitment_txs_from_update"))) TS_ChannelMonitor_counterparty_commitment_txs_from_update(uint64_t this_arg, uint64_t update) {
33035         LDKChannelMonitor this_arg_conv;
33036         this_arg_conv.inner = untag_ptr(this_arg);
33037         this_arg_conv.is_owned = ptr_is_owned(this_arg);
33038         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
33039         this_arg_conv.is_owned = false;
33040         LDKChannelMonitorUpdate update_conv;
33041         update_conv.inner = untag_ptr(update);
33042         update_conv.is_owned = ptr_is_owned(update);
33043         CHECK_INNER_FIELD_ACCESS_OR_NULL(update_conv);
33044         update_conv.is_owned = false;
33045         LDKCVec_CommitmentTransactionZ ret_var = ChannelMonitor_counterparty_commitment_txs_from_update(&this_arg_conv, &update_conv);
33046         uint64_tArray ret_arr = NULL;
33047         ret_arr = init_uint64_tArray(ret_var.datalen, __LINE__);
33048         uint64_t *ret_arr_ptr = (uint64_t*)(((uint8_t*)ret_arr) + 8);
33049         for (size_t x = 0; x < ret_var.datalen; x++) {
33050                 LDKCommitmentTransaction ret_conv_23_var = ret_var.data[x];
33051                 uint64_t ret_conv_23_ref = 0;
33052                 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_conv_23_var);
33053                 ret_conv_23_ref = tag_ptr(ret_conv_23_var.inner, ret_conv_23_var.is_owned);
33054                 ret_arr_ptr[x] = ret_conv_23_ref;
33055         }
33056         
33057         FREE(ret_var.data);
33058         return ret_arr;
33059 }
33060
33061 uint64_t  __attribute__((export_name("TS_ChannelMonitor_sign_to_local_justice_tx"))) TS_ChannelMonitor_sign_to_local_justice_tx(uint64_t this_arg, int8_tArray justice_tx, uint32_t input_idx, int64_t value, int64_t commitment_number) {
33062         LDKChannelMonitor this_arg_conv;
33063         this_arg_conv.inner = untag_ptr(this_arg);
33064         this_arg_conv.is_owned = ptr_is_owned(this_arg);
33065         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
33066         this_arg_conv.is_owned = false;
33067         LDKTransaction justice_tx_ref;
33068         justice_tx_ref.datalen = justice_tx->arr_len;
33069         justice_tx_ref.data = MALLOC(justice_tx_ref.datalen, "LDKTransaction Bytes");
33070         memcpy(justice_tx_ref.data, justice_tx->elems, justice_tx_ref.datalen); FREE(justice_tx);
33071         justice_tx_ref.data_is_owned = true;
33072         LDKCResult_TransactionNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_TransactionNoneZ), "LDKCResult_TransactionNoneZ");
33073         *ret_conv = ChannelMonitor_sign_to_local_justice_tx(&this_arg_conv, justice_tx_ref, input_idx, value, commitment_number);
33074         return tag_ptr(ret_conv, true);
33075 }
33076
33077 int8_tArray  __attribute__((export_name("TS_ChannelMonitor_get_counterparty_node_id"))) TS_ChannelMonitor_get_counterparty_node_id(uint64_t this_arg) {
33078         LDKChannelMonitor this_arg_conv;
33079         this_arg_conv.inner = untag_ptr(this_arg);
33080         this_arg_conv.is_owned = ptr_is_owned(this_arg);
33081         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
33082         this_arg_conv.is_owned = false;
33083         int8_tArray ret_arr = init_int8_tArray(33, __LINE__);
33084         memcpy(ret_arr->elems, ChannelMonitor_get_counterparty_node_id(&this_arg_conv).compressed_form, 33);
33085         return ret_arr;
33086 }
33087
33088 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) {
33089         LDKChannelMonitor this_arg_conv;
33090         this_arg_conv.inner = untag_ptr(this_arg);
33091         this_arg_conv.is_owned = ptr_is_owned(this_arg);
33092         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
33093         this_arg_conv.is_owned = false;
33094         void* logger_ptr = untag_ptr(logger);
33095         if (ptr_is_owned(logger)) { CHECK_ACCESS(logger_ptr); }
33096         LDKLogger* logger_conv = (LDKLogger*)logger_ptr;
33097         LDKCVec_TransactionZ ret_var = ChannelMonitor_get_latest_holder_commitment_txn(&this_arg_conv, logger_conv);
33098         ptrArray ret_arr = NULL;
33099         ret_arr = init_ptrArray(ret_var.datalen, __LINE__);
33100         int8_tArray *ret_arr_ptr = (int8_tArray*)(((uint8_t*)ret_arr) + 8);
33101         for (size_t m = 0; m < ret_var.datalen; m++) {
33102                 LDKTransaction ret_conv_12_var = ret_var.data[m];
33103                 int8_tArray ret_conv_12_arr = init_int8_tArray(ret_conv_12_var.datalen, __LINE__);
33104                 memcpy(ret_conv_12_arr->elems, ret_conv_12_var.data, ret_conv_12_var.datalen);
33105                 Transaction_free(ret_conv_12_var);
33106                 ret_arr_ptr[m] = ret_conv_12_arr;
33107         }
33108         
33109         FREE(ret_var.data);
33110         return ret_arr;
33111 }
33112
33113 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) {
33114         LDKChannelMonitor this_arg_conv;
33115         this_arg_conv.inner = untag_ptr(this_arg);
33116         this_arg_conv.is_owned = ptr_is_owned(this_arg);
33117         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
33118         this_arg_conv.is_owned = false;
33119         uint8_t header_arr[80];
33120         CHECK(header->arr_len == 80);
33121         memcpy(header_arr, header->elems, 80); FREE(header);
33122         uint8_t (*header_ref)[80] = &header_arr;
33123         LDKCVec_C2Tuple_usizeTransactionZZ txdata_constr;
33124         txdata_constr.datalen = txdata->arr_len;
33125         if (txdata_constr.datalen > 0)
33126                 txdata_constr.data = MALLOC(txdata_constr.datalen * sizeof(LDKC2Tuple_usizeTransactionZ), "LDKCVec_C2Tuple_usizeTransactionZZ Elements");
33127         else
33128                 txdata_constr.data = NULL;
33129         uint64_t* txdata_vals = txdata->elems;
33130         for (size_t c = 0; c < txdata_constr.datalen; c++) {
33131                 uint64_t txdata_conv_28 = txdata_vals[c];
33132                 void* txdata_conv_28_ptr = untag_ptr(txdata_conv_28);
33133                 CHECK_ACCESS(txdata_conv_28_ptr);
33134                 LDKC2Tuple_usizeTransactionZ txdata_conv_28_conv = *(LDKC2Tuple_usizeTransactionZ*)(txdata_conv_28_ptr);
33135                 txdata_conv_28_conv = C2Tuple_usizeTransactionZ_clone((LDKC2Tuple_usizeTransactionZ*)untag_ptr(txdata_conv_28));
33136                 txdata_constr.data[c] = txdata_conv_28_conv;
33137         }
33138         FREE(txdata);
33139         void* broadcaster_ptr = untag_ptr(broadcaster);
33140         CHECK_ACCESS(broadcaster_ptr);
33141         LDKBroadcasterInterface broadcaster_conv = *(LDKBroadcasterInterface*)(broadcaster_ptr);
33142         if (broadcaster_conv.free == LDKBroadcasterInterface_JCalls_free) {
33143                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
33144                 LDKBroadcasterInterface_JCalls_cloned(&broadcaster_conv);
33145         }
33146         void* fee_estimator_ptr = untag_ptr(fee_estimator);
33147         CHECK_ACCESS(fee_estimator_ptr);
33148         LDKFeeEstimator fee_estimator_conv = *(LDKFeeEstimator*)(fee_estimator_ptr);
33149         if (fee_estimator_conv.free == LDKFeeEstimator_JCalls_free) {
33150                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
33151                 LDKFeeEstimator_JCalls_cloned(&fee_estimator_conv);
33152         }
33153         void* logger_ptr = untag_ptr(logger);
33154         CHECK_ACCESS(logger_ptr);
33155         LDKLogger logger_conv = *(LDKLogger*)(logger_ptr);
33156         if (logger_conv.free == LDKLogger_JCalls_free) {
33157                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
33158                 LDKLogger_JCalls_cloned(&logger_conv);
33159         }
33160         LDKCVec_C2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32TxOutZZZZ ret_var = ChannelMonitor_block_connected(&this_arg_conv, header_ref, txdata_constr, height, broadcaster_conv, fee_estimator_conv, logger_conv);
33161         uint64_tArray ret_arr = NULL;
33162         ret_arr = init_uint64_tArray(ret_var.datalen, __LINE__);
33163         uint64_t *ret_arr_ptr = (uint64_t*)(((uint8_t*)ret_arr) + 8);
33164         for (size_t x = 0; x < ret_var.datalen; x++) {
33165                 LDKC2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32TxOutZZZ* ret_conv_49_conv = MALLOC(sizeof(LDKC2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32TxOutZZZ), "LDKC2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32TxOutZZZ");
33166                 *ret_conv_49_conv = ret_var.data[x];
33167                 ret_arr_ptr[x] = tag_ptr(ret_conv_49_conv, true);
33168         }
33169         
33170         FREE(ret_var.data);
33171         return ret_arr;
33172 }
33173
33174 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) {
33175         LDKChannelMonitor this_arg_conv;
33176         this_arg_conv.inner = untag_ptr(this_arg);
33177         this_arg_conv.is_owned = ptr_is_owned(this_arg);
33178         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
33179         this_arg_conv.is_owned = false;
33180         uint8_t header_arr[80];
33181         CHECK(header->arr_len == 80);
33182         memcpy(header_arr, header->elems, 80); FREE(header);
33183         uint8_t (*header_ref)[80] = &header_arr;
33184         void* broadcaster_ptr = untag_ptr(broadcaster);
33185         CHECK_ACCESS(broadcaster_ptr);
33186         LDKBroadcasterInterface broadcaster_conv = *(LDKBroadcasterInterface*)(broadcaster_ptr);
33187         if (broadcaster_conv.free == LDKBroadcasterInterface_JCalls_free) {
33188                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
33189                 LDKBroadcasterInterface_JCalls_cloned(&broadcaster_conv);
33190         }
33191         void* fee_estimator_ptr = untag_ptr(fee_estimator);
33192         CHECK_ACCESS(fee_estimator_ptr);
33193         LDKFeeEstimator fee_estimator_conv = *(LDKFeeEstimator*)(fee_estimator_ptr);
33194         if (fee_estimator_conv.free == LDKFeeEstimator_JCalls_free) {
33195                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
33196                 LDKFeeEstimator_JCalls_cloned(&fee_estimator_conv);
33197         }
33198         void* logger_ptr = untag_ptr(logger);
33199         CHECK_ACCESS(logger_ptr);
33200         LDKLogger logger_conv = *(LDKLogger*)(logger_ptr);
33201         if (logger_conv.free == LDKLogger_JCalls_free) {
33202                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
33203                 LDKLogger_JCalls_cloned(&logger_conv);
33204         }
33205         ChannelMonitor_block_disconnected(&this_arg_conv, header_ref, height, broadcaster_conv, fee_estimator_conv, logger_conv);
33206 }
33207
33208 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) {
33209         LDKChannelMonitor this_arg_conv;
33210         this_arg_conv.inner = untag_ptr(this_arg);
33211         this_arg_conv.is_owned = ptr_is_owned(this_arg);
33212         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
33213         this_arg_conv.is_owned = false;
33214         uint8_t header_arr[80];
33215         CHECK(header->arr_len == 80);
33216         memcpy(header_arr, header->elems, 80); FREE(header);
33217         uint8_t (*header_ref)[80] = &header_arr;
33218         LDKCVec_C2Tuple_usizeTransactionZZ txdata_constr;
33219         txdata_constr.datalen = txdata->arr_len;
33220         if (txdata_constr.datalen > 0)
33221                 txdata_constr.data = MALLOC(txdata_constr.datalen * sizeof(LDKC2Tuple_usizeTransactionZ), "LDKCVec_C2Tuple_usizeTransactionZZ Elements");
33222         else
33223                 txdata_constr.data = NULL;
33224         uint64_t* txdata_vals = txdata->elems;
33225         for (size_t c = 0; c < txdata_constr.datalen; c++) {
33226                 uint64_t txdata_conv_28 = txdata_vals[c];
33227                 void* txdata_conv_28_ptr = untag_ptr(txdata_conv_28);
33228                 CHECK_ACCESS(txdata_conv_28_ptr);
33229                 LDKC2Tuple_usizeTransactionZ txdata_conv_28_conv = *(LDKC2Tuple_usizeTransactionZ*)(txdata_conv_28_ptr);
33230                 txdata_conv_28_conv = C2Tuple_usizeTransactionZ_clone((LDKC2Tuple_usizeTransactionZ*)untag_ptr(txdata_conv_28));
33231                 txdata_constr.data[c] = txdata_conv_28_conv;
33232         }
33233         FREE(txdata);
33234         void* broadcaster_ptr = untag_ptr(broadcaster);
33235         CHECK_ACCESS(broadcaster_ptr);
33236         LDKBroadcasterInterface broadcaster_conv = *(LDKBroadcasterInterface*)(broadcaster_ptr);
33237         if (broadcaster_conv.free == LDKBroadcasterInterface_JCalls_free) {
33238                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
33239                 LDKBroadcasterInterface_JCalls_cloned(&broadcaster_conv);
33240         }
33241         void* fee_estimator_ptr = untag_ptr(fee_estimator);
33242         CHECK_ACCESS(fee_estimator_ptr);
33243         LDKFeeEstimator fee_estimator_conv = *(LDKFeeEstimator*)(fee_estimator_ptr);
33244         if (fee_estimator_conv.free == LDKFeeEstimator_JCalls_free) {
33245                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
33246                 LDKFeeEstimator_JCalls_cloned(&fee_estimator_conv);
33247         }
33248         void* logger_ptr = untag_ptr(logger);
33249         CHECK_ACCESS(logger_ptr);
33250         LDKLogger logger_conv = *(LDKLogger*)(logger_ptr);
33251         if (logger_conv.free == LDKLogger_JCalls_free) {
33252                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
33253                 LDKLogger_JCalls_cloned(&logger_conv);
33254         }
33255         LDKCVec_C2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32TxOutZZZZ ret_var = ChannelMonitor_transactions_confirmed(&this_arg_conv, header_ref, txdata_constr, height, broadcaster_conv, fee_estimator_conv, logger_conv);
33256         uint64_tArray ret_arr = NULL;
33257         ret_arr = init_uint64_tArray(ret_var.datalen, __LINE__);
33258         uint64_t *ret_arr_ptr = (uint64_t*)(((uint8_t*)ret_arr) + 8);
33259         for (size_t x = 0; x < ret_var.datalen; x++) {
33260                 LDKC2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32TxOutZZZ* ret_conv_49_conv = MALLOC(sizeof(LDKC2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32TxOutZZZ), "LDKC2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32TxOutZZZ");
33261                 *ret_conv_49_conv = ret_var.data[x];
33262                 ret_arr_ptr[x] = tag_ptr(ret_conv_49_conv, true);
33263         }
33264         
33265         FREE(ret_var.data);
33266         return ret_arr;
33267 }
33268
33269 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) {
33270         LDKChannelMonitor this_arg_conv;
33271         this_arg_conv.inner = untag_ptr(this_arg);
33272         this_arg_conv.is_owned = ptr_is_owned(this_arg);
33273         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
33274         this_arg_conv.is_owned = false;
33275         uint8_t txid_arr[32];
33276         CHECK(txid->arr_len == 32);
33277         memcpy(txid_arr, txid->elems, 32); FREE(txid);
33278         uint8_t (*txid_ref)[32] = &txid_arr;
33279         void* broadcaster_ptr = untag_ptr(broadcaster);
33280         CHECK_ACCESS(broadcaster_ptr);
33281         LDKBroadcasterInterface broadcaster_conv = *(LDKBroadcasterInterface*)(broadcaster_ptr);
33282         if (broadcaster_conv.free == LDKBroadcasterInterface_JCalls_free) {
33283                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
33284                 LDKBroadcasterInterface_JCalls_cloned(&broadcaster_conv);
33285         }
33286         void* fee_estimator_ptr = untag_ptr(fee_estimator);
33287         CHECK_ACCESS(fee_estimator_ptr);
33288         LDKFeeEstimator fee_estimator_conv = *(LDKFeeEstimator*)(fee_estimator_ptr);
33289         if (fee_estimator_conv.free == LDKFeeEstimator_JCalls_free) {
33290                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
33291                 LDKFeeEstimator_JCalls_cloned(&fee_estimator_conv);
33292         }
33293         void* logger_ptr = untag_ptr(logger);
33294         CHECK_ACCESS(logger_ptr);
33295         LDKLogger logger_conv = *(LDKLogger*)(logger_ptr);
33296         if (logger_conv.free == LDKLogger_JCalls_free) {
33297                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
33298                 LDKLogger_JCalls_cloned(&logger_conv);
33299         }
33300         ChannelMonitor_transaction_unconfirmed(&this_arg_conv, txid_ref, broadcaster_conv, fee_estimator_conv, logger_conv);
33301 }
33302
33303 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) {
33304         LDKChannelMonitor this_arg_conv;
33305         this_arg_conv.inner = untag_ptr(this_arg);
33306         this_arg_conv.is_owned = ptr_is_owned(this_arg);
33307         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
33308         this_arg_conv.is_owned = false;
33309         uint8_t header_arr[80];
33310         CHECK(header->arr_len == 80);
33311         memcpy(header_arr, header->elems, 80); FREE(header);
33312         uint8_t (*header_ref)[80] = &header_arr;
33313         void* broadcaster_ptr = untag_ptr(broadcaster);
33314         CHECK_ACCESS(broadcaster_ptr);
33315         LDKBroadcasterInterface broadcaster_conv = *(LDKBroadcasterInterface*)(broadcaster_ptr);
33316         if (broadcaster_conv.free == LDKBroadcasterInterface_JCalls_free) {
33317                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
33318                 LDKBroadcasterInterface_JCalls_cloned(&broadcaster_conv);
33319         }
33320         void* fee_estimator_ptr = untag_ptr(fee_estimator);
33321         CHECK_ACCESS(fee_estimator_ptr);
33322         LDKFeeEstimator fee_estimator_conv = *(LDKFeeEstimator*)(fee_estimator_ptr);
33323         if (fee_estimator_conv.free == LDKFeeEstimator_JCalls_free) {
33324                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
33325                 LDKFeeEstimator_JCalls_cloned(&fee_estimator_conv);
33326         }
33327         void* logger_ptr = untag_ptr(logger);
33328         CHECK_ACCESS(logger_ptr);
33329         LDKLogger logger_conv = *(LDKLogger*)(logger_ptr);
33330         if (logger_conv.free == LDKLogger_JCalls_free) {
33331                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
33332                 LDKLogger_JCalls_cloned(&logger_conv);
33333         }
33334         LDKCVec_C2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32TxOutZZZZ ret_var = ChannelMonitor_best_block_updated(&this_arg_conv, header_ref, height, broadcaster_conv, fee_estimator_conv, logger_conv);
33335         uint64_tArray ret_arr = NULL;
33336         ret_arr = init_uint64_tArray(ret_var.datalen, __LINE__);
33337         uint64_t *ret_arr_ptr = (uint64_t*)(((uint8_t*)ret_arr) + 8);
33338         for (size_t x = 0; x < ret_var.datalen; x++) {
33339                 LDKC2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32TxOutZZZ* ret_conv_49_conv = MALLOC(sizeof(LDKC2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32TxOutZZZ), "LDKC2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32TxOutZZZ");
33340                 *ret_conv_49_conv = ret_var.data[x];
33341                 ret_arr_ptr[x] = tag_ptr(ret_conv_49_conv, true);
33342         }
33343         
33344         FREE(ret_var.data);
33345         return ret_arr;
33346 }
33347
33348 uint64_tArray  __attribute__((export_name("TS_ChannelMonitor_get_relevant_txids"))) TS_ChannelMonitor_get_relevant_txids(uint64_t this_arg) {
33349         LDKChannelMonitor this_arg_conv;
33350         this_arg_conv.inner = untag_ptr(this_arg);
33351         this_arg_conv.is_owned = ptr_is_owned(this_arg);
33352         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
33353         this_arg_conv.is_owned = false;
33354         LDKCVec_C2Tuple_ThirtyTwoBytesCOption_ThirtyTwoBytesZZZ ret_var = ChannelMonitor_get_relevant_txids(&this_arg_conv);
33355         uint64_tArray ret_arr = NULL;
33356         ret_arr = init_uint64_tArray(ret_var.datalen, __LINE__);
33357         uint64_t *ret_arr_ptr = (uint64_t*)(((uint8_t*)ret_arr) + 8);
33358         for (size_t x = 0; x < ret_var.datalen; x++) {
33359                 LDKC2Tuple_ThirtyTwoBytesCOption_ThirtyTwoBytesZZ* ret_conv_49_conv = MALLOC(sizeof(LDKC2Tuple_ThirtyTwoBytesCOption_ThirtyTwoBytesZZ), "LDKC2Tuple_ThirtyTwoBytesCOption_ThirtyTwoBytesZZ");
33360                 *ret_conv_49_conv = ret_var.data[x];
33361                 ret_arr_ptr[x] = tag_ptr(ret_conv_49_conv, true);
33362         }
33363         
33364         FREE(ret_var.data);
33365         return ret_arr;
33366 }
33367
33368 uint64_t  __attribute__((export_name("TS_ChannelMonitor_current_best_block"))) TS_ChannelMonitor_current_best_block(uint64_t this_arg) {
33369         LDKChannelMonitor this_arg_conv;
33370         this_arg_conv.inner = untag_ptr(this_arg);
33371         this_arg_conv.is_owned = ptr_is_owned(this_arg);
33372         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
33373         this_arg_conv.is_owned = false;
33374         LDKBestBlock ret_var = ChannelMonitor_current_best_block(&this_arg_conv);
33375         uint64_t ret_ref = 0;
33376         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
33377         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
33378         return ret_ref;
33379 }
33380
33381 void  __attribute__((export_name("TS_ChannelMonitor_rebroadcast_pending_claims"))) TS_ChannelMonitor_rebroadcast_pending_claims(uint64_t this_arg, uint64_t broadcaster, uint64_t fee_estimator, uint64_t logger) {
33382         LDKChannelMonitor this_arg_conv;
33383         this_arg_conv.inner = untag_ptr(this_arg);
33384         this_arg_conv.is_owned = ptr_is_owned(this_arg);
33385         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
33386         this_arg_conv.is_owned = false;
33387         void* broadcaster_ptr = untag_ptr(broadcaster);
33388         CHECK_ACCESS(broadcaster_ptr);
33389         LDKBroadcasterInterface broadcaster_conv = *(LDKBroadcasterInterface*)(broadcaster_ptr);
33390         if (broadcaster_conv.free == LDKBroadcasterInterface_JCalls_free) {
33391                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
33392                 LDKBroadcasterInterface_JCalls_cloned(&broadcaster_conv);
33393         }
33394         void* fee_estimator_ptr = untag_ptr(fee_estimator);
33395         CHECK_ACCESS(fee_estimator_ptr);
33396         LDKFeeEstimator fee_estimator_conv = *(LDKFeeEstimator*)(fee_estimator_ptr);
33397         if (fee_estimator_conv.free == LDKFeeEstimator_JCalls_free) {
33398                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
33399                 LDKFeeEstimator_JCalls_cloned(&fee_estimator_conv);
33400         }
33401         void* logger_ptr = untag_ptr(logger);
33402         CHECK_ACCESS(logger_ptr);
33403         LDKLogger logger_conv = *(LDKLogger*)(logger_ptr);
33404         if (logger_conv.free == LDKLogger_JCalls_free) {
33405                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
33406                 LDKLogger_JCalls_cloned(&logger_conv);
33407         }
33408         ChannelMonitor_rebroadcast_pending_claims(&this_arg_conv, broadcaster_conv, fee_estimator_conv, logger_conv);
33409 }
33410
33411 uint64_tArray  __attribute__((export_name("TS_ChannelMonitor_get_spendable_outputs"))) TS_ChannelMonitor_get_spendable_outputs(uint64_t this_arg, int8_tArray tx, int32_t confirmation_height) {
33412         LDKChannelMonitor this_arg_conv;
33413         this_arg_conv.inner = untag_ptr(this_arg);
33414         this_arg_conv.is_owned = ptr_is_owned(this_arg);
33415         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
33416         this_arg_conv.is_owned = false;
33417         LDKTransaction tx_ref;
33418         tx_ref.datalen = tx->arr_len;
33419         tx_ref.data = MALLOC(tx_ref.datalen, "LDKTransaction Bytes");
33420         memcpy(tx_ref.data, tx->elems, tx_ref.datalen); FREE(tx);
33421         tx_ref.data_is_owned = true;
33422         LDKCVec_SpendableOutputDescriptorZ ret_var = ChannelMonitor_get_spendable_outputs(&this_arg_conv, tx_ref, confirmation_height);
33423         uint64_tArray ret_arr = NULL;
33424         ret_arr = init_uint64_tArray(ret_var.datalen, __LINE__);
33425         uint64_t *ret_arr_ptr = (uint64_t*)(((uint8_t*)ret_arr) + 8);
33426         for (size_t b = 0; b < ret_var.datalen; b++) {
33427                 LDKSpendableOutputDescriptor *ret_conv_27_copy = MALLOC(sizeof(LDKSpendableOutputDescriptor), "LDKSpendableOutputDescriptor");
33428                 *ret_conv_27_copy = ret_var.data[b];
33429                 uint64_t ret_conv_27_ref = tag_ptr(ret_conv_27_copy, true);
33430                 ret_arr_ptr[b] = ret_conv_27_ref;
33431         }
33432         
33433         FREE(ret_var.data);
33434         return ret_arr;
33435 }
33436
33437 uint64_tArray  __attribute__((export_name("TS_ChannelMonitor_get_claimable_balances"))) TS_ChannelMonitor_get_claimable_balances(uint64_t this_arg) {
33438         LDKChannelMonitor this_arg_conv;
33439         this_arg_conv.inner = untag_ptr(this_arg);
33440         this_arg_conv.is_owned = ptr_is_owned(this_arg);
33441         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
33442         this_arg_conv.is_owned = false;
33443         LDKCVec_BalanceZ ret_var = ChannelMonitor_get_claimable_balances(&this_arg_conv);
33444         uint64_tArray ret_arr = NULL;
33445         ret_arr = init_uint64_tArray(ret_var.datalen, __LINE__);
33446         uint64_t *ret_arr_ptr = (uint64_t*)(((uint8_t*)ret_arr) + 8);
33447         for (size_t j = 0; j < ret_var.datalen; j++) {
33448                 LDKBalance *ret_conv_9_copy = MALLOC(sizeof(LDKBalance), "LDKBalance");
33449                 *ret_conv_9_copy = ret_var.data[j];
33450                 uint64_t ret_conv_9_ref = tag_ptr(ret_conv_9_copy, true);
33451                 ret_arr_ptr[j] = ret_conv_9_ref;
33452         }
33453         
33454         FREE(ret_var.data);
33455         return ret_arr;
33456 }
33457
33458 uint64_t  __attribute__((export_name("TS_C2Tuple_ThirtyTwoBytesChannelMonitorZ_read"))) TS_C2Tuple_ThirtyTwoBytesChannelMonitorZ_read(int8_tArray ser, uint64_t arg_a, uint64_t arg_b) {
33459         LDKu8slice ser_ref;
33460         ser_ref.datalen = ser->arr_len;
33461         ser_ref.data = ser->elems;
33462         void* arg_a_ptr = untag_ptr(arg_a);
33463         if (ptr_is_owned(arg_a)) { CHECK_ACCESS(arg_a_ptr); }
33464         LDKEntropySource* arg_a_conv = (LDKEntropySource*)arg_a_ptr;
33465         void* arg_b_ptr = untag_ptr(arg_b);
33466         if (ptr_is_owned(arg_b)) { CHECK_ACCESS(arg_b_ptr); }
33467         LDKSignerProvider* arg_b_conv = (LDKSignerProvider*)arg_b_ptr;
33468         LDKCResult_C2Tuple_ThirtyTwoBytesChannelMonitorZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_ThirtyTwoBytesChannelMonitorZDecodeErrorZ), "LDKCResult_C2Tuple_ThirtyTwoBytesChannelMonitorZDecodeErrorZ");
33469         *ret_conv = C2Tuple_ThirtyTwoBytesChannelMonitorZ_read(ser_ref, arg_a_conv, arg_b_conv);
33470         FREE(ser);
33471         return tag_ptr(ret_conv, true);
33472 }
33473
33474 void  __attribute__((export_name("TS_OutPoint_free"))) TS_OutPoint_free(uint64_t this_obj) {
33475         LDKOutPoint this_obj_conv;
33476         this_obj_conv.inner = untag_ptr(this_obj);
33477         this_obj_conv.is_owned = ptr_is_owned(this_obj);
33478         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
33479         OutPoint_free(this_obj_conv);
33480 }
33481
33482 int8_tArray  __attribute__((export_name("TS_OutPoint_get_txid"))) TS_OutPoint_get_txid(uint64_t this_ptr) {
33483         LDKOutPoint this_ptr_conv;
33484         this_ptr_conv.inner = untag_ptr(this_ptr);
33485         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
33486         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
33487         this_ptr_conv.is_owned = false;
33488         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
33489         memcpy(ret_arr->elems, *OutPoint_get_txid(&this_ptr_conv), 32);
33490         return ret_arr;
33491 }
33492
33493 void  __attribute__((export_name("TS_OutPoint_set_txid"))) TS_OutPoint_set_txid(uint64_t this_ptr, int8_tArray val) {
33494         LDKOutPoint this_ptr_conv;
33495         this_ptr_conv.inner = untag_ptr(this_ptr);
33496         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
33497         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
33498         this_ptr_conv.is_owned = false;
33499         LDKThirtyTwoBytes val_ref;
33500         CHECK(val->arr_len == 32);
33501         memcpy(val_ref.data, val->elems, 32); FREE(val);
33502         OutPoint_set_txid(&this_ptr_conv, val_ref);
33503 }
33504
33505 int16_t  __attribute__((export_name("TS_OutPoint_get_index"))) TS_OutPoint_get_index(uint64_t this_ptr) {
33506         LDKOutPoint this_ptr_conv;
33507         this_ptr_conv.inner = untag_ptr(this_ptr);
33508         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
33509         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
33510         this_ptr_conv.is_owned = false;
33511         int16_t ret_conv = OutPoint_get_index(&this_ptr_conv);
33512         return ret_conv;
33513 }
33514
33515 void  __attribute__((export_name("TS_OutPoint_set_index"))) TS_OutPoint_set_index(uint64_t this_ptr, int16_t val) {
33516         LDKOutPoint this_ptr_conv;
33517         this_ptr_conv.inner = untag_ptr(this_ptr);
33518         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
33519         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
33520         this_ptr_conv.is_owned = false;
33521         OutPoint_set_index(&this_ptr_conv, val);
33522 }
33523
33524 uint64_t  __attribute__((export_name("TS_OutPoint_new"))) TS_OutPoint_new(int8_tArray txid_arg, int16_t index_arg) {
33525         LDKThirtyTwoBytes txid_arg_ref;
33526         CHECK(txid_arg->arr_len == 32);
33527         memcpy(txid_arg_ref.data, txid_arg->elems, 32); FREE(txid_arg);
33528         LDKOutPoint ret_var = OutPoint_new(txid_arg_ref, index_arg);
33529         uint64_t ret_ref = 0;
33530         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
33531         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
33532         return ret_ref;
33533 }
33534
33535 static inline uint64_t OutPoint_clone_ptr(LDKOutPoint *NONNULL_PTR arg) {
33536         LDKOutPoint ret_var = OutPoint_clone(arg);
33537         uint64_t ret_ref = 0;
33538         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
33539         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
33540         return ret_ref;
33541 }
33542 int64_t  __attribute__((export_name("TS_OutPoint_clone_ptr"))) TS_OutPoint_clone_ptr(uint64_t arg) {
33543         LDKOutPoint arg_conv;
33544         arg_conv.inner = untag_ptr(arg);
33545         arg_conv.is_owned = ptr_is_owned(arg);
33546         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
33547         arg_conv.is_owned = false;
33548         int64_t ret_conv = OutPoint_clone_ptr(&arg_conv);
33549         return ret_conv;
33550 }
33551
33552 uint64_t  __attribute__((export_name("TS_OutPoint_clone"))) TS_OutPoint_clone(uint64_t orig) {
33553         LDKOutPoint orig_conv;
33554         orig_conv.inner = untag_ptr(orig);
33555         orig_conv.is_owned = ptr_is_owned(orig);
33556         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
33557         orig_conv.is_owned = false;
33558         LDKOutPoint ret_var = OutPoint_clone(&orig_conv);
33559         uint64_t ret_ref = 0;
33560         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
33561         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
33562         return ret_ref;
33563 }
33564
33565 jboolean  __attribute__((export_name("TS_OutPoint_eq"))) TS_OutPoint_eq(uint64_t a, uint64_t b) {
33566         LDKOutPoint a_conv;
33567         a_conv.inner = untag_ptr(a);
33568         a_conv.is_owned = ptr_is_owned(a);
33569         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
33570         a_conv.is_owned = false;
33571         LDKOutPoint b_conv;
33572         b_conv.inner = untag_ptr(b);
33573         b_conv.is_owned = ptr_is_owned(b);
33574         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
33575         b_conv.is_owned = false;
33576         jboolean ret_conv = OutPoint_eq(&a_conv, &b_conv);
33577         return ret_conv;
33578 }
33579
33580 int64_t  __attribute__((export_name("TS_OutPoint_hash"))) TS_OutPoint_hash(uint64_t o) {
33581         LDKOutPoint o_conv;
33582         o_conv.inner = untag_ptr(o);
33583         o_conv.is_owned = ptr_is_owned(o);
33584         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
33585         o_conv.is_owned = false;
33586         int64_t ret_conv = OutPoint_hash(&o_conv);
33587         return ret_conv;
33588 }
33589
33590 int8_tArray  __attribute__((export_name("TS_OutPoint_to_channel_id"))) TS_OutPoint_to_channel_id(uint64_t this_arg) {
33591         LDKOutPoint this_arg_conv;
33592         this_arg_conv.inner = untag_ptr(this_arg);
33593         this_arg_conv.is_owned = ptr_is_owned(this_arg);
33594         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
33595         this_arg_conv.is_owned = false;
33596         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
33597         memcpy(ret_arr->elems, OutPoint_to_channel_id(&this_arg_conv).data, 32);
33598         return ret_arr;
33599 }
33600
33601 int8_tArray  __attribute__((export_name("TS_OutPoint_write"))) TS_OutPoint_write(uint64_t obj) {
33602         LDKOutPoint obj_conv;
33603         obj_conv.inner = untag_ptr(obj);
33604         obj_conv.is_owned = ptr_is_owned(obj);
33605         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
33606         obj_conv.is_owned = false;
33607         LDKCVec_u8Z ret_var = OutPoint_write(&obj_conv);
33608         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
33609         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
33610         CVec_u8Z_free(ret_var);
33611         return ret_arr;
33612 }
33613
33614 uint64_t  __attribute__((export_name("TS_OutPoint_read"))) TS_OutPoint_read(int8_tArray ser) {
33615         LDKu8slice ser_ref;
33616         ser_ref.datalen = ser->arr_len;
33617         ser_ref.data = ser->elems;
33618         LDKCResult_OutPointDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_OutPointDecodeErrorZ), "LDKCResult_OutPointDecodeErrorZ");
33619         *ret_conv = OutPoint_read(ser_ref);
33620         FREE(ser);
33621         return tag_ptr(ret_conv, true);
33622 }
33623
33624 void  __attribute__((export_name("TS_FailureCode_free"))) TS_FailureCode_free(uint64_t this_ptr) {
33625         if (!ptr_is_owned(this_ptr)) return;
33626         void* this_ptr_ptr = untag_ptr(this_ptr);
33627         CHECK_ACCESS(this_ptr_ptr);
33628         LDKFailureCode this_ptr_conv = *(LDKFailureCode*)(this_ptr_ptr);
33629         FREE(untag_ptr(this_ptr));
33630         FailureCode_free(this_ptr_conv);
33631 }
33632
33633 static inline uint64_t FailureCode_clone_ptr(LDKFailureCode *NONNULL_PTR arg) {
33634         LDKFailureCode *ret_copy = MALLOC(sizeof(LDKFailureCode), "LDKFailureCode");
33635         *ret_copy = FailureCode_clone(arg);
33636         uint64_t ret_ref = tag_ptr(ret_copy, true);
33637         return ret_ref;
33638 }
33639 int64_t  __attribute__((export_name("TS_FailureCode_clone_ptr"))) TS_FailureCode_clone_ptr(uint64_t arg) {
33640         LDKFailureCode* arg_conv = (LDKFailureCode*)untag_ptr(arg);
33641         int64_t ret_conv = FailureCode_clone_ptr(arg_conv);
33642         return ret_conv;
33643 }
33644
33645 uint64_t  __attribute__((export_name("TS_FailureCode_clone"))) TS_FailureCode_clone(uint64_t orig) {
33646         LDKFailureCode* orig_conv = (LDKFailureCode*)untag_ptr(orig);
33647         LDKFailureCode *ret_copy = MALLOC(sizeof(LDKFailureCode), "LDKFailureCode");
33648         *ret_copy = FailureCode_clone(orig_conv);
33649         uint64_t ret_ref = tag_ptr(ret_copy, true);
33650         return ret_ref;
33651 }
33652
33653 uint64_t  __attribute__((export_name("TS_FailureCode_temporary_node_failure"))) TS_FailureCode_temporary_node_failure() {
33654         LDKFailureCode *ret_copy = MALLOC(sizeof(LDKFailureCode), "LDKFailureCode");
33655         *ret_copy = FailureCode_temporary_node_failure();
33656         uint64_t ret_ref = tag_ptr(ret_copy, true);
33657         return ret_ref;
33658 }
33659
33660 uint64_t  __attribute__((export_name("TS_FailureCode_required_node_feature_missing"))) TS_FailureCode_required_node_feature_missing() {
33661         LDKFailureCode *ret_copy = MALLOC(sizeof(LDKFailureCode), "LDKFailureCode");
33662         *ret_copy = FailureCode_required_node_feature_missing();
33663         uint64_t ret_ref = tag_ptr(ret_copy, true);
33664         return ret_ref;
33665 }
33666
33667 uint64_t  __attribute__((export_name("TS_FailureCode_incorrect_or_unknown_payment_details"))) TS_FailureCode_incorrect_or_unknown_payment_details() {
33668         LDKFailureCode *ret_copy = MALLOC(sizeof(LDKFailureCode), "LDKFailureCode");
33669         *ret_copy = FailureCode_incorrect_or_unknown_payment_details();
33670         uint64_t ret_ref = tag_ptr(ret_copy, true);
33671         return ret_ref;
33672 }
33673
33674 uint64_t  __attribute__((export_name("TS_FailureCode_invalid_onion_payload"))) TS_FailureCode_invalid_onion_payload(uint64_t a) {
33675         void* a_ptr = untag_ptr(a);
33676         CHECK_ACCESS(a_ptr);
33677         LDKCOption_C2Tuple_u64u16ZZ a_conv = *(LDKCOption_C2Tuple_u64u16ZZ*)(a_ptr);
33678         a_conv = COption_C2Tuple_u64u16ZZ_clone((LDKCOption_C2Tuple_u64u16ZZ*)untag_ptr(a));
33679         LDKFailureCode *ret_copy = MALLOC(sizeof(LDKFailureCode), "LDKFailureCode");
33680         *ret_copy = FailureCode_invalid_onion_payload(a_conv);
33681         uint64_t ret_ref = tag_ptr(ret_copy, true);
33682         return ret_ref;
33683 }
33684
33685 void  __attribute__((export_name("TS_ChannelManager_free"))) TS_ChannelManager_free(uint64_t this_obj) {
33686         LDKChannelManager this_obj_conv;
33687         this_obj_conv.inner = untag_ptr(this_obj);
33688         this_obj_conv.is_owned = ptr_is_owned(this_obj);
33689         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
33690         ChannelManager_free(this_obj_conv);
33691 }
33692
33693 void  __attribute__((export_name("TS_ChainParameters_free"))) TS_ChainParameters_free(uint64_t this_obj) {
33694         LDKChainParameters this_obj_conv;
33695         this_obj_conv.inner = untag_ptr(this_obj);
33696         this_obj_conv.is_owned = ptr_is_owned(this_obj);
33697         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
33698         ChainParameters_free(this_obj_conv);
33699 }
33700
33701 uint32_t  __attribute__((export_name("TS_ChainParameters_get_network"))) TS_ChainParameters_get_network(uint64_t this_ptr) {
33702         LDKChainParameters this_ptr_conv;
33703         this_ptr_conv.inner = untag_ptr(this_ptr);
33704         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
33705         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
33706         this_ptr_conv.is_owned = false;
33707         uint32_t ret_conv = LDKNetwork_to_js(ChainParameters_get_network(&this_ptr_conv));
33708         return ret_conv;
33709 }
33710
33711 void  __attribute__((export_name("TS_ChainParameters_set_network"))) TS_ChainParameters_set_network(uint64_t this_ptr, uint32_t val) {
33712         LDKChainParameters this_ptr_conv;
33713         this_ptr_conv.inner = untag_ptr(this_ptr);
33714         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
33715         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
33716         this_ptr_conv.is_owned = false;
33717         LDKNetwork val_conv = LDKNetwork_from_js(val);
33718         ChainParameters_set_network(&this_ptr_conv, val_conv);
33719 }
33720
33721 uint64_t  __attribute__((export_name("TS_ChainParameters_get_best_block"))) TS_ChainParameters_get_best_block(uint64_t this_ptr) {
33722         LDKChainParameters this_ptr_conv;
33723         this_ptr_conv.inner = untag_ptr(this_ptr);
33724         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
33725         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
33726         this_ptr_conv.is_owned = false;
33727         LDKBestBlock ret_var = ChainParameters_get_best_block(&this_ptr_conv);
33728         uint64_t ret_ref = 0;
33729         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
33730         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
33731         return ret_ref;
33732 }
33733
33734 void  __attribute__((export_name("TS_ChainParameters_set_best_block"))) TS_ChainParameters_set_best_block(uint64_t this_ptr, uint64_t val) {
33735         LDKChainParameters this_ptr_conv;
33736         this_ptr_conv.inner = untag_ptr(this_ptr);
33737         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
33738         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
33739         this_ptr_conv.is_owned = false;
33740         LDKBestBlock val_conv;
33741         val_conv.inner = untag_ptr(val);
33742         val_conv.is_owned = ptr_is_owned(val);
33743         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
33744         val_conv = BestBlock_clone(&val_conv);
33745         ChainParameters_set_best_block(&this_ptr_conv, val_conv);
33746 }
33747
33748 uint64_t  __attribute__((export_name("TS_ChainParameters_new"))) TS_ChainParameters_new(uint32_t network_arg, uint64_t best_block_arg) {
33749         LDKNetwork network_arg_conv = LDKNetwork_from_js(network_arg);
33750         LDKBestBlock best_block_arg_conv;
33751         best_block_arg_conv.inner = untag_ptr(best_block_arg);
33752         best_block_arg_conv.is_owned = ptr_is_owned(best_block_arg);
33753         CHECK_INNER_FIELD_ACCESS_OR_NULL(best_block_arg_conv);
33754         best_block_arg_conv = BestBlock_clone(&best_block_arg_conv);
33755         LDKChainParameters ret_var = ChainParameters_new(network_arg_conv, best_block_arg_conv);
33756         uint64_t ret_ref = 0;
33757         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
33758         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
33759         return ret_ref;
33760 }
33761
33762 static inline uint64_t ChainParameters_clone_ptr(LDKChainParameters *NONNULL_PTR arg) {
33763         LDKChainParameters ret_var = ChainParameters_clone(arg);
33764         uint64_t ret_ref = 0;
33765         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
33766         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
33767         return ret_ref;
33768 }
33769 int64_t  __attribute__((export_name("TS_ChainParameters_clone_ptr"))) TS_ChainParameters_clone_ptr(uint64_t arg) {
33770         LDKChainParameters arg_conv;
33771         arg_conv.inner = untag_ptr(arg);
33772         arg_conv.is_owned = ptr_is_owned(arg);
33773         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
33774         arg_conv.is_owned = false;
33775         int64_t ret_conv = ChainParameters_clone_ptr(&arg_conv);
33776         return ret_conv;
33777 }
33778
33779 uint64_t  __attribute__((export_name("TS_ChainParameters_clone"))) TS_ChainParameters_clone(uint64_t orig) {
33780         LDKChainParameters orig_conv;
33781         orig_conv.inner = untag_ptr(orig);
33782         orig_conv.is_owned = ptr_is_owned(orig);
33783         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
33784         orig_conv.is_owned = false;
33785         LDKChainParameters ret_var = ChainParameters_clone(&orig_conv);
33786         uint64_t ret_ref = 0;
33787         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
33788         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
33789         return ret_ref;
33790 }
33791
33792 void  __attribute__((export_name("TS_CounterpartyForwardingInfo_free"))) TS_CounterpartyForwardingInfo_free(uint64_t this_obj) {
33793         LDKCounterpartyForwardingInfo this_obj_conv;
33794         this_obj_conv.inner = untag_ptr(this_obj);
33795         this_obj_conv.is_owned = ptr_is_owned(this_obj);
33796         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
33797         CounterpartyForwardingInfo_free(this_obj_conv);
33798 }
33799
33800 int32_t  __attribute__((export_name("TS_CounterpartyForwardingInfo_get_fee_base_msat"))) TS_CounterpartyForwardingInfo_get_fee_base_msat(uint64_t this_ptr) {
33801         LDKCounterpartyForwardingInfo this_ptr_conv;
33802         this_ptr_conv.inner = untag_ptr(this_ptr);
33803         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
33804         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
33805         this_ptr_conv.is_owned = false;
33806         int32_t ret_conv = CounterpartyForwardingInfo_get_fee_base_msat(&this_ptr_conv);
33807         return ret_conv;
33808 }
33809
33810 void  __attribute__((export_name("TS_CounterpartyForwardingInfo_set_fee_base_msat"))) TS_CounterpartyForwardingInfo_set_fee_base_msat(uint64_t this_ptr, int32_t val) {
33811         LDKCounterpartyForwardingInfo this_ptr_conv;
33812         this_ptr_conv.inner = untag_ptr(this_ptr);
33813         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
33814         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
33815         this_ptr_conv.is_owned = false;
33816         CounterpartyForwardingInfo_set_fee_base_msat(&this_ptr_conv, val);
33817 }
33818
33819 int32_t  __attribute__((export_name("TS_CounterpartyForwardingInfo_get_fee_proportional_millionths"))) TS_CounterpartyForwardingInfo_get_fee_proportional_millionths(uint64_t this_ptr) {
33820         LDKCounterpartyForwardingInfo this_ptr_conv;
33821         this_ptr_conv.inner = untag_ptr(this_ptr);
33822         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
33823         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
33824         this_ptr_conv.is_owned = false;
33825         int32_t ret_conv = CounterpartyForwardingInfo_get_fee_proportional_millionths(&this_ptr_conv);
33826         return ret_conv;
33827 }
33828
33829 void  __attribute__((export_name("TS_CounterpartyForwardingInfo_set_fee_proportional_millionths"))) TS_CounterpartyForwardingInfo_set_fee_proportional_millionths(uint64_t this_ptr, int32_t val) {
33830         LDKCounterpartyForwardingInfo this_ptr_conv;
33831         this_ptr_conv.inner = untag_ptr(this_ptr);
33832         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
33833         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
33834         this_ptr_conv.is_owned = false;
33835         CounterpartyForwardingInfo_set_fee_proportional_millionths(&this_ptr_conv, val);
33836 }
33837
33838 int16_t  __attribute__((export_name("TS_CounterpartyForwardingInfo_get_cltv_expiry_delta"))) TS_CounterpartyForwardingInfo_get_cltv_expiry_delta(uint64_t this_ptr) {
33839         LDKCounterpartyForwardingInfo this_ptr_conv;
33840         this_ptr_conv.inner = untag_ptr(this_ptr);
33841         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
33842         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
33843         this_ptr_conv.is_owned = false;
33844         int16_t ret_conv = CounterpartyForwardingInfo_get_cltv_expiry_delta(&this_ptr_conv);
33845         return ret_conv;
33846 }
33847
33848 void  __attribute__((export_name("TS_CounterpartyForwardingInfo_set_cltv_expiry_delta"))) TS_CounterpartyForwardingInfo_set_cltv_expiry_delta(uint64_t this_ptr, int16_t val) {
33849         LDKCounterpartyForwardingInfo this_ptr_conv;
33850         this_ptr_conv.inner = untag_ptr(this_ptr);
33851         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
33852         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
33853         this_ptr_conv.is_owned = false;
33854         CounterpartyForwardingInfo_set_cltv_expiry_delta(&this_ptr_conv, val);
33855 }
33856
33857 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) {
33858         LDKCounterpartyForwardingInfo ret_var = CounterpartyForwardingInfo_new(fee_base_msat_arg, fee_proportional_millionths_arg, cltv_expiry_delta_arg);
33859         uint64_t ret_ref = 0;
33860         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
33861         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
33862         return ret_ref;
33863 }
33864
33865 static inline uint64_t CounterpartyForwardingInfo_clone_ptr(LDKCounterpartyForwardingInfo *NONNULL_PTR arg) {
33866         LDKCounterpartyForwardingInfo ret_var = CounterpartyForwardingInfo_clone(arg);
33867         uint64_t ret_ref = 0;
33868         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
33869         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
33870         return ret_ref;
33871 }
33872 int64_t  __attribute__((export_name("TS_CounterpartyForwardingInfo_clone_ptr"))) TS_CounterpartyForwardingInfo_clone_ptr(uint64_t arg) {
33873         LDKCounterpartyForwardingInfo arg_conv;
33874         arg_conv.inner = untag_ptr(arg);
33875         arg_conv.is_owned = ptr_is_owned(arg);
33876         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
33877         arg_conv.is_owned = false;
33878         int64_t ret_conv = CounterpartyForwardingInfo_clone_ptr(&arg_conv);
33879         return ret_conv;
33880 }
33881
33882 uint64_t  __attribute__((export_name("TS_CounterpartyForwardingInfo_clone"))) TS_CounterpartyForwardingInfo_clone(uint64_t orig) {
33883         LDKCounterpartyForwardingInfo orig_conv;
33884         orig_conv.inner = untag_ptr(orig);
33885         orig_conv.is_owned = ptr_is_owned(orig);
33886         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
33887         orig_conv.is_owned = false;
33888         LDKCounterpartyForwardingInfo ret_var = CounterpartyForwardingInfo_clone(&orig_conv);
33889         uint64_t ret_ref = 0;
33890         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
33891         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
33892         return ret_ref;
33893 }
33894
33895 void  __attribute__((export_name("TS_ChannelCounterparty_free"))) TS_ChannelCounterparty_free(uint64_t this_obj) {
33896         LDKChannelCounterparty this_obj_conv;
33897         this_obj_conv.inner = untag_ptr(this_obj);
33898         this_obj_conv.is_owned = ptr_is_owned(this_obj);
33899         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
33900         ChannelCounterparty_free(this_obj_conv);
33901 }
33902
33903 int8_tArray  __attribute__((export_name("TS_ChannelCounterparty_get_node_id"))) TS_ChannelCounterparty_get_node_id(uint64_t this_ptr) {
33904         LDKChannelCounterparty this_ptr_conv;
33905         this_ptr_conv.inner = untag_ptr(this_ptr);
33906         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
33907         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
33908         this_ptr_conv.is_owned = false;
33909         int8_tArray ret_arr = init_int8_tArray(33, __LINE__);
33910         memcpy(ret_arr->elems, ChannelCounterparty_get_node_id(&this_ptr_conv).compressed_form, 33);
33911         return ret_arr;
33912 }
33913
33914 void  __attribute__((export_name("TS_ChannelCounterparty_set_node_id"))) TS_ChannelCounterparty_set_node_id(uint64_t this_ptr, int8_tArray val) {
33915         LDKChannelCounterparty this_ptr_conv;
33916         this_ptr_conv.inner = untag_ptr(this_ptr);
33917         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
33918         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
33919         this_ptr_conv.is_owned = false;
33920         LDKPublicKey val_ref;
33921         CHECK(val->arr_len == 33);
33922         memcpy(val_ref.compressed_form, val->elems, 33); FREE(val);
33923         ChannelCounterparty_set_node_id(&this_ptr_conv, val_ref);
33924 }
33925
33926 uint64_t  __attribute__((export_name("TS_ChannelCounterparty_get_features"))) TS_ChannelCounterparty_get_features(uint64_t this_ptr) {
33927         LDKChannelCounterparty this_ptr_conv;
33928         this_ptr_conv.inner = untag_ptr(this_ptr);
33929         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
33930         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
33931         this_ptr_conv.is_owned = false;
33932         LDKInitFeatures ret_var = ChannelCounterparty_get_features(&this_ptr_conv);
33933         uint64_t ret_ref = 0;
33934         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
33935         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
33936         return ret_ref;
33937 }
33938
33939 void  __attribute__((export_name("TS_ChannelCounterparty_set_features"))) TS_ChannelCounterparty_set_features(uint64_t this_ptr, uint64_t val) {
33940         LDKChannelCounterparty this_ptr_conv;
33941         this_ptr_conv.inner = untag_ptr(this_ptr);
33942         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
33943         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
33944         this_ptr_conv.is_owned = false;
33945         LDKInitFeatures val_conv;
33946         val_conv.inner = untag_ptr(val);
33947         val_conv.is_owned = ptr_is_owned(val);
33948         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
33949         val_conv = InitFeatures_clone(&val_conv);
33950         ChannelCounterparty_set_features(&this_ptr_conv, val_conv);
33951 }
33952
33953 int64_t  __attribute__((export_name("TS_ChannelCounterparty_get_unspendable_punishment_reserve"))) TS_ChannelCounterparty_get_unspendable_punishment_reserve(uint64_t this_ptr) {
33954         LDKChannelCounterparty this_ptr_conv;
33955         this_ptr_conv.inner = untag_ptr(this_ptr);
33956         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
33957         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
33958         this_ptr_conv.is_owned = false;
33959         int64_t ret_conv = ChannelCounterparty_get_unspendable_punishment_reserve(&this_ptr_conv);
33960         return ret_conv;
33961 }
33962
33963 void  __attribute__((export_name("TS_ChannelCounterparty_set_unspendable_punishment_reserve"))) TS_ChannelCounterparty_set_unspendable_punishment_reserve(uint64_t this_ptr, int64_t val) {
33964         LDKChannelCounterparty this_ptr_conv;
33965         this_ptr_conv.inner = untag_ptr(this_ptr);
33966         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
33967         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
33968         this_ptr_conv.is_owned = false;
33969         ChannelCounterparty_set_unspendable_punishment_reserve(&this_ptr_conv, val);
33970 }
33971
33972 uint64_t  __attribute__((export_name("TS_ChannelCounterparty_get_forwarding_info"))) TS_ChannelCounterparty_get_forwarding_info(uint64_t this_ptr) {
33973         LDKChannelCounterparty this_ptr_conv;
33974         this_ptr_conv.inner = untag_ptr(this_ptr);
33975         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
33976         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
33977         this_ptr_conv.is_owned = false;
33978         LDKCounterpartyForwardingInfo ret_var = ChannelCounterparty_get_forwarding_info(&this_ptr_conv);
33979         uint64_t ret_ref = 0;
33980         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
33981         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
33982         return ret_ref;
33983 }
33984
33985 void  __attribute__((export_name("TS_ChannelCounterparty_set_forwarding_info"))) TS_ChannelCounterparty_set_forwarding_info(uint64_t this_ptr, uint64_t val) {
33986         LDKChannelCounterparty this_ptr_conv;
33987         this_ptr_conv.inner = untag_ptr(this_ptr);
33988         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
33989         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
33990         this_ptr_conv.is_owned = false;
33991         LDKCounterpartyForwardingInfo val_conv;
33992         val_conv.inner = untag_ptr(val);
33993         val_conv.is_owned = ptr_is_owned(val);
33994         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
33995         val_conv = CounterpartyForwardingInfo_clone(&val_conv);
33996         ChannelCounterparty_set_forwarding_info(&this_ptr_conv, val_conv);
33997 }
33998
33999 uint64_t  __attribute__((export_name("TS_ChannelCounterparty_get_outbound_htlc_minimum_msat"))) TS_ChannelCounterparty_get_outbound_htlc_minimum_msat(uint64_t this_ptr) {
34000         LDKChannelCounterparty this_ptr_conv;
34001         this_ptr_conv.inner = untag_ptr(this_ptr);
34002         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
34003         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
34004         this_ptr_conv.is_owned = false;
34005         LDKCOption_u64Z *ret_copy = MALLOC(sizeof(LDKCOption_u64Z), "LDKCOption_u64Z");
34006         *ret_copy = ChannelCounterparty_get_outbound_htlc_minimum_msat(&this_ptr_conv);
34007         uint64_t ret_ref = tag_ptr(ret_copy, true);
34008         return ret_ref;
34009 }
34010
34011 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) {
34012         LDKChannelCounterparty this_ptr_conv;
34013         this_ptr_conv.inner = untag_ptr(this_ptr);
34014         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
34015         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
34016         this_ptr_conv.is_owned = false;
34017         void* val_ptr = untag_ptr(val);
34018         CHECK_ACCESS(val_ptr);
34019         LDKCOption_u64Z val_conv = *(LDKCOption_u64Z*)(val_ptr);
34020         val_conv = COption_u64Z_clone((LDKCOption_u64Z*)untag_ptr(val));
34021         ChannelCounterparty_set_outbound_htlc_minimum_msat(&this_ptr_conv, val_conv);
34022 }
34023
34024 uint64_t  __attribute__((export_name("TS_ChannelCounterparty_get_outbound_htlc_maximum_msat"))) TS_ChannelCounterparty_get_outbound_htlc_maximum_msat(uint64_t this_ptr) {
34025         LDKChannelCounterparty 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         LDKCOption_u64Z *ret_copy = MALLOC(sizeof(LDKCOption_u64Z), "LDKCOption_u64Z");
34031         *ret_copy = ChannelCounterparty_get_outbound_htlc_maximum_msat(&this_ptr_conv);
34032         uint64_t ret_ref = tag_ptr(ret_copy, true);
34033         return ret_ref;
34034 }
34035
34036 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) {
34037         LDKChannelCounterparty this_ptr_conv;
34038         this_ptr_conv.inner = untag_ptr(this_ptr);
34039         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
34040         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
34041         this_ptr_conv.is_owned = false;
34042         void* val_ptr = untag_ptr(val);
34043         CHECK_ACCESS(val_ptr);
34044         LDKCOption_u64Z val_conv = *(LDKCOption_u64Z*)(val_ptr);
34045         val_conv = COption_u64Z_clone((LDKCOption_u64Z*)untag_ptr(val));
34046         ChannelCounterparty_set_outbound_htlc_maximum_msat(&this_ptr_conv, val_conv);
34047 }
34048
34049 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) {
34050         LDKPublicKey node_id_arg_ref;
34051         CHECK(node_id_arg->arr_len == 33);
34052         memcpy(node_id_arg_ref.compressed_form, node_id_arg->elems, 33); FREE(node_id_arg);
34053         LDKInitFeatures features_arg_conv;
34054         features_arg_conv.inner = untag_ptr(features_arg);
34055         features_arg_conv.is_owned = ptr_is_owned(features_arg);
34056         CHECK_INNER_FIELD_ACCESS_OR_NULL(features_arg_conv);
34057         features_arg_conv = InitFeatures_clone(&features_arg_conv);
34058         LDKCounterpartyForwardingInfo forwarding_info_arg_conv;
34059         forwarding_info_arg_conv.inner = untag_ptr(forwarding_info_arg);
34060         forwarding_info_arg_conv.is_owned = ptr_is_owned(forwarding_info_arg);
34061         CHECK_INNER_FIELD_ACCESS_OR_NULL(forwarding_info_arg_conv);
34062         forwarding_info_arg_conv = CounterpartyForwardingInfo_clone(&forwarding_info_arg_conv);
34063         void* outbound_htlc_minimum_msat_arg_ptr = untag_ptr(outbound_htlc_minimum_msat_arg);
34064         CHECK_ACCESS(outbound_htlc_minimum_msat_arg_ptr);
34065         LDKCOption_u64Z outbound_htlc_minimum_msat_arg_conv = *(LDKCOption_u64Z*)(outbound_htlc_minimum_msat_arg_ptr);
34066         outbound_htlc_minimum_msat_arg_conv = COption_u64Z_clone((LDKCOption_u64Z*)untag_ptr(outbound_htlc_minimum_msat_arg));
34067         void* outbound_htlc_maximum_msat_arg_ptr = untag_ptr(outbound_htlc_maximum_msat_arg);
34068         CHECK_ACCESS(outbound_htlc_maximum_msat_arg_ptr);
34069         LDKCOption_u64Z outbound_htlc_maximum_msat_arg_conv = *(LDKCOption_u64Z*)(outbound_htlc_maximum_msat_arg_ptr);
34070         outbound_htlc_maximum_msat_arg_conv = COption_u64Z_clone((LDKCOption_u64Z*)untag_ptr(outbound_htlc_maximum_msat_arg));
34071         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);
34072         uint64_t ret_ref = 0;
34073         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
34074         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
34075         return ret_ref;
34076 }
34077
34078 static inline uint64_t ChannelCounterparty_clone_ptr(LDKChannelCounterparty *NONNULL_PTR arg) {
34079         LDKChannelCounterparty ret_var = ChannelCounterparty_clone(arg);
34080         uint64_t ret_ref = 0;
34081         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
34082         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
34083         return ret_ref;
34084 }
34085 int64_t  __attribute__((export_name("TS_ChannelCounterparty_clone_ptr"))) TS_ChannelCounterparty_clone_ptr(uint64_t arg) {
34086         LDKChannelCounterparty arg_conv;
34087         arg_conv.inner = untag_ptr(arg);
34088         arg_conv.is_owned = ptr_is_owned(arg);
34089         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
34090         arg_conv.is_owned = false;
34091         int64_t ret_conv = ChannelCounterparty_clone_ptr(&arg_conv);
34092         return ret_conv;
34093 }
34094
34095 uint64_t  __attribute__((export_name("TS_ChannelCounterparty_clone"))) TS_ChannelCounterparty_clone(uint64_t orig) {
34096         LDKChannelCounterparty orig_conv;
34097         orig_conv.inner = untag_ptr(orig);
34098         orig_conv.is_owned = ptr_is_owned(orig);
34099         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
34100         orig_conv.is_owned = false;
34101         LDKChannelCounterparty ret_var = ChannelCounterparty_clone(&orig_conv);
34102         uint64_t ret_ref = 0;
34103         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
34104         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
34105         return ret_ref;
34106 }
34107
34108 void  __attribute__((export_name("TS_ChannelDetails_free"))) TS_ChannelDetails_free(uint64_t this_obj) {
34109         LDKChannelDetails this_obj_conv;
34110         this_obj_conv.inner = untag_ptr(this_obj);
34111         this_obj_conv.is_owned = ptr_is_owned(this_obj);
34112         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
34113         ChannelDetails_free(this_obj_conv);
34114 }
34115
34116 int8_tArray  __attribute__((export_name("TS_ChannelDetails_get_channel_id"))) TS_ChannelDetails_get_channel_id(uint64_t this_ptr) {
34117         LDKChannelDetails this_ptr_conv;
34118         this_ptr_conv.inner = untag_ptr(this_ptr);
34119         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
34120         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
34121         this_ptr_conv.is_owned = false;
34122         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
34123         memcpy(ret_arr->elems, *ChannelDetails_get_channel_id(&this_ptr_conv), 32);
34124         return ret_arr;
34125 }
34126
34127 void  __attribute__((export_name("TS_ChannelDetails_set_channel_id"))) TS_ChannelDetails_set_channel_id(uint64_t this_ptr, int8_tArray val) {
34128         LDKChannelDetails this_ptr_conv;
34129         this_ptr_conv.inner = untag_ptr(this_ptr);
34130         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
34131         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
34132         this_ptr_conv.is_owned = false;
34133         LDKThirtyTwoBytes val_ref;
34134         CHECK(val->arr_len == 32);
34135         memcpy(val_ref.data, val->elems, 32); FREE(val);
34136         ChannelDetails_set_channel_id(&this_ptr_conv, val_ref);
34137 }
34138
34139 uint64_t  __attribute__((export_name("TS_ChannelDetails_get_counterparty"))) TS_ChannelDetails_get_counterparty(uint64_t this_ptr) {
34140         LDKChannelDetails this_ptr_conv;
34141         this_ptr_conv.inner = untag_ptr(this_ptr);
34142         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
34143         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
34144         this_ptr_conv.is_owned = false;
34145         LDKChannelCounterparty ret_var = ChannelDetails_get_counterparty(&this_ptr_conv);
34146         uint64_t ret_ref = 0;
34147         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
34148         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
34149         return ret_ref;
34150 }
34151
34152 void  __attribute__((export_name("TS_ChannelDetails_set_counterparty"))) TS_ChannelDetails_set_counterparty(uint64_t this_ptr, uint64_t val) {
34153         LDKChannelDetails this_ptr_conv;
34154         this_ptr_conv.inner = untag_ptr(this_ptr);
34155         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
34156         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
34157         this_ptr_conv.is_owned = false;
34158         LDKChannelCounterparty val_conv;
34159         val_conv.inner = untag_ptr(val);
34160         val_conv.is_owned = ptr_is_owned(val);
34161         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
34162         val_conv = ChannelCounterparty_clone(&val_conv);
34163         ChannelDetails_set_counterparty(&this_ptr_conv, val_conv);
34164 }
34165
34166 uint64_t  __attribute__((export_name("TS_ChannelDetails_get_funding_txo"))) TS_ChannelDetails_get_funding_txo(uint64_t this_ptr) {
34167         LDKChannelDetails this_ptr_conv;
34168         this_ptr_conv.inner = untag_ptr(this_ptr);
34169         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
34170         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
34171         this_ptr_conv.is_owned = false;
34172         LDKOutPoint ret_var = ChannelDetails_get_funding_txo(&this_ptr_conv);
34173         uint64_t ret_ref = 0;
34174         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
34175         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
34176         return ret_ref;
34177 }
34178
34179 void  __attribute__((export_name("TS_ChannelDetails_set_funding_txo"))) TS_ChannelDetails_set_funding_txo(uint64_t this_ptr, uint64_t val) {
34180         LDKChannelDetails this_ptr_conv;
34181         this_ptr_conv.inner = untag_ptr(this_ptr);
34182         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
34183         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
34184         this_ptr_conv.is_owned = false;
34185         LDKOutPoint val_conv;
34186         val_conv.inner = untag_ptr(val);
34187         val_conv.is_owned = ptr_is_owned(val);
34188         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
34189         val_conv = OutPoint_clone(&val_conv);
34190         ChannelDetails_set_funding_txo(&this_ptr_conv, val_conv);
34191 }
34192
34193 uint64_t  __attribute__((export_name("TS_ChannelDetails_get_channel_type"))) TS_ChannelDetails_get_channel_type(uint64_t this_ptr) {
34194         LDKChannelDetails this_ptr_conv;
34195         this_ptr_conv.inner = untag_ptr(this_ptr);
34196         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
34197         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
34198         this_ptr_conv.is_owned = false;
34199         LDKChannelTypeFeatures ret_var = ChannelDetails_get_channel_type(&this_ptr_conv);
34200         uint64_t ret_ref = 0;
34201         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
34202         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
34203         return ret_ref;
34204 }
34205
34206 void  __attribute__((export_name("TS_ChannelDetails_set_channel_type"))) TS_ChannelDetails_set_channel_type(uint64_t this_ptr, uint64_t val) {
34207         LDKChannelDetails this_ptr_conv;
34208         this_ptr_conv.inner = untag_ptr(this_ptr);
34209         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
34210         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
34211         this_ptr_conv.is_owned = false;
34212         LDKChannelTypeFeatures val_conv;
34213         val_conv.inner = untag_ptr(val);
34214         val_conv.is_owned = ptr_is_owned(val);
34215         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
34216         val_conv = ChannelTypeFeatures_clone(&val_conv);
34217         ChannelDetails_set_channel_type(&this_ptr_conv, val_conv);
34218 }
34219
34220 uint64_t  __attribute__((export_name("TS_ChannelDetails_get_short_channel_id"))) TS_ChannelDetails_get_short_channel_id(uint64_t this_ptr) {
34221         LDKChannelDetails this_ptr_conv;
34222         this_ptr_conv.inner = untag_ptr(this_ptr);
34223         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
34224         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
34225         this_ptr_conv.is_owned = false;
34226         LDKCOption_u64Z *ret_copy = MALLOC(sizeof(LDKCOption_u64Z), "LDKCOption_u64Z");
34227         *ret_copy = ChannelDetails_get_short_channel_id(&this_ptr_conv);
34228         uint64_t ret_ref = tag_ptr(ret_copy, true);
34229         return ret_ref;
34230 }
34231
34232 void  __attribute__((export_name("TS_ChannelDetails_set_short_channel_id"))) TS_ChannelDetails_set_short_channel_id(uint64_t this_ptr, uint64_t val) {
34233         LDKChannelDetails this_ptr_conv;
34234         this_ptr_conv.inner = untag_ptr(this_ptr);
34235         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
34236         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
34237         this_ptr_conv.is_owned = false;
34238         void* val_ptr = untag_ptr(val);
34239         CHECK_ACCESS(val_ptr);
34240         LDKCOption_u64Z val_conv = *(LDKCOption_u64Z*)(val_ptr);
34241         val_conv = COption_u64Z_clone((LDKCOption_u64Z*)untag_ptr(val));
34242         ChannelDetails_set_short_channel_id(&this_ptr_conv, val_conv);
34243 }
34244
34245 uint64_t  __attribute__((export_name("TS_ChannelDetails_get_outbound_scid_alias"))) TS_ChannelDetails_get_outbound_scid_alias(uint64_t this_ptr) {
34246         LDKChannelDetails this_ptr_conv;
34247         this_ptr_conv.inner = untag_ptr(this_ptr);
34248         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
34249         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
34250         this_ptr_conv.is_owned = false;
34251         LDKCOption_u64Z *ret_copy = MALLOC(sizeof(LDKCOption_u64Z), "LDKCOption_u64Z");
34252         *ret_copy = ChannelDetails_get_outbound_scid_alias(&this_ptr_conv);
34253         uint64_t ret_ref = tag_ptr(ret_copy, true);
34254         return ret_ref;
34255 }
34256
34257 void  __attribute__((export_name("TS_ChannelDetails_set_outbound_scid_alias"))) TS_ChannelDetails_set_outbound_scid_alias(uint64_t this_ptr, uint64_t val) {
34258         LDKChannelDetails this_ptr_conv;
34259         this_ptr_conv.inner = untag_ptr(this_ptr);
34260         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
34261         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
34262         this_ptr_conv.is_owned = false;
34263         void* val_ptr = untag_ptr(val);
34264         CHECK_ACCESS(val_ptr);
34265         LDKCOption_u64Z val_conv = *(LDKCOption_u64Z*)(val_ptr);
34266         val_conv = COption_u64Z_clone((LDKCOption_u64Z*)untag_ptr(val));
34267         ChannelDetails_set_outbound_scid_alias(&this_ptr_conv, val_conv);
34268 }
34269
34270 uint64_t  __attribute__((export_name("TS_ChannelDetails_get_inbound_scid_alias"))) TS_ChannelDetails_get_inbound_scid_alias(uint64_t this_ptr) {
34271         LDKChannelDetails this_ptr_conv;
34272         this_ptr_conv.inner = untag_ptr(this_ptr);
34273         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
34274         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
34275         this_ptr_conv.is_owned = false;
34276         LDKCOption_u64Z *ret_copy = MALLOC(sizeof(LDKCOption_u64Z), "LDKCOption_u64Z");
34277         *ret_copy = ChannelDetails_get_inbound_scid_alias(&this_ptr_conv);
34278         uint64_t ret_ref = tag_ptr(ret_copy, true);
34279         return ret_ref;
34280 }
34281
34282 void  __attribute__((export_name("TS_ChannelDetails_set_inbound_scid_alias"))) TS_ChannelDetails_set_inbound_scid_alias(uint64_t this_ptr, uint64_t val) {
34283         LDKChannelDetails this_ptr_conv;
34284         this_ptr_conv.inner = untag_ptr(this_ptr);
34285         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
34286         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
34287         this_ptr_conv.is_owned = false;
34288         void* val_ptr = untag_ptr(val);
34289         CHECK_ACCESS(val_ptr);
34290         LDKCOption_u64Z val_conv = *(LDKCOption_u64Z*)(val_ptr);
34291         val_conv = COption_u64Z_clone((LDKCOption_u64Z*)untag_ptr(val));
34292         ChannelDetails_set_inbound_scid_alias(&this_ptr_conv, val_conv);
34293 }
34294
34295 int64_t  __attribute__((export_name("TS_ChannelDetails_get_channel_value_satoshis"))) TS_ChannelDetails_get_channel_value_satoshis(uint64_t this_ptr) {
34296         LDKChannelDetails this_ptr_conv;
34297         this_ptr_conv.inner = untag_ptr(this_ptr);
34298         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
34299         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
34300         this_ptr_conv.is_owned = false;
34301         int64_t ret_conv = ChannelDetails_get_channel_value_satoshis(&this_ptr_conv);
34302         return ret_conv;
34303 }
34304
34305 void  __attribute__((export_name("TS_ChannelDetails_set_channel_value_satoshis"))) TS_ChannelDetails_set_channel_value_satoshis(uint64_t this_ptr, int64_t val) {
34306         LDKChannelDetails this_ptr_conv;
34307         this_ptr_conv.inner = untag_ptr(this_ptr);
34308         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
34309         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
34310         this_ptr_conv.is_owned = false;
34311         ChannelDetails_set_channel_value_satoshis(&this_ptr_conv, val);
34312 }
34313
34314 uint64_t  __attribute__((export_name("TS_ChannelDetails_get_unspendable_punishment_reserve"))) TS_ChannelDetails_get_unspendable_punishment_reserve(uint64_t this_ptr) {
34315         LDKChannelDetails this_ptr_conv;
34316         this_ptr_conv.inner = untag_ptr(this_ptr);
34317         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
34318         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
34319         this_ptr_conv.is_owned = false;
34320         LDKCOption_u64Z *ret_copy = MALLOC(sizeof(LDKCOption_u64Z), "LDKCOption_u64Z");
34321         *ret_copy = ChannelDetails_get_unspendable_punishment_reserve(&this_ptr_conv);
34322         uint64_t ret_ref = tag_ptr(ret_copy, true);
34323         return ret_ref;
34324 }
34325
34326 void  __attribute__((export_name("TS_ChannelDetails_set_unspendable_punishment_reserve"))) TS_ChannelDetails_set_unspendable_punishment_reserve(uint64_t this_ptr, uint64_t val) {
34327         LDKChannelDetails this_ptr_conv;
34328         this_ptr_conv.inner = untag_ptr(this_ptr);
34329         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
34330         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
34331         this_ptr_conv.is_owned = false;
34332         void* val_ptr = untag_ptr(val);
34333         CHECK_ACCESS(val_ptr);
34334         LDKCOption_u64Z val_conv = *(LDKCOption_u64Z*)(val_ptr);
34335         val_conv = COption_u64Z_clone((LDKCOption_u64Z*)untag_ptr(val));
34336         ChannelDetails_set_unspendable_punishment_reserve(&this_ptr_conv, val_conv);
34337 }
34338
34339 int8_tArray  __attribute__((export_name("TS_ChannelDetails_get_user_channel_id"))) TS_ChannelDetails_get_user_channel_id(uint64_t this_ptr) {
34340         LDKChannelDetails this_ptr_conv;
34341         this_ptr_conv.inner = untag_ptr(this_ptr);
34342         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
34343         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
34344         this_ptr_conv.is_owned = false;
34345         int8_tArray ret_arr = init_int8_tArray(16, __LINE__);
34346         memcpy(ret_arr->elems, ChannelDetails_get_user_channel_id(&this_ptr_conv).le_bytes, 16);
34347         return ret_arr;
34348 }
34349
34350 void  __attribute__((export_name("TS_ChannelDetails_set_user_channel_id"))) TS_ChannelDetails_set_user_channel_id(uint64_t this_ptr, int8_tArray val) {
34351         LDKChannelDetails this_ptr_conv;
34352         this_ptr_conv.inner = untag_ptr(this_ptr);
34353         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
34354         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
34355         this_ptr_conv.is_owned = false;
34356         LDKU128 val_ref;
34357         CHECK(val->arr_len == 16);
34358         memcpy(val_ref.le_bytes, val->elems, 16); FREE(val);
34359         ChannelDetails_set_user_channel_id(&this_ptr_conv, val_ref);
34360 }
34361
34362 uint64_t  __attribute__((export_name("TS_ChannelDetails_get_feerate_sat_per_1000_weight"))) TS_ChannelDetails_get_feerate_sat_per_1000_weight(uint64_t this_ptr) {
34363         LDKChannelDetails this_ptr_conv;
34364         this_ptr_conv.inner = untag_ptr(this_ptr);
34365         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
34366         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
34367         this_ptr_conv.is_owned = false;
34368         LDKCOption_u32Z *ret_copy = MALLOC(sizeof(LDKCOption_u32Z), "LDKCOption_u32Z");
34369         *ret_copy = ChannelDetails_get_feerate_sat_per_1000_weight(&this_ptr_conv);
34370         uint64_t ret_ref = tag_ptr(ret_copy, true);
34371         return ret_ref;
34372 }
34373
34374 void  __attribute__((export_name("TS_ChannelDetails_set_feerate_sat_per_1000_weight"))) TS_ChannelDetails_set_feerate_sat_per_1000_weight(uint64_t this_ptr, uint64_t val) {
34375         LDKChannelDetails 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         void* val_ptr = untag_ptr(val);
34381         CHECK_ACCESS(val_ptr);
34382         LDKCOption_u32Z val_conv = *(LDKCOption_u32Z*)(val_ptr);
34383         val_conv = COption_u32Z_clone((LDKCOption_u32Z*)untag_ptr(val));
34384         ChannelDetails_set_feerate_sat_per_1000_weight(&this_ptr_conv, val_conv);
34385 }
34386
34387 int64_t  __attribute__((export_name("TS_ChannelDetails_get_balance_msat"))) TS_ChannelDetails_get_balance_msat(uint64_t this_ptr) {
34388         LDKChannelDetails this_ptr_conv;
34389         this_ptr_conv.inner = untag_ptr(this_ptr);
34390         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
34391         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
34392         this_ptr_conv.is_owned = false;
34393         int64_t ret_conv = ChannelDetails_get_balance_msat(&this_ptr_conv);
34394         return ret_conv;
34395 }
34396
34397 void  __attribute__((export_name("TS_ChannelDetails_set_balance_msat"))) TS_ChannelDetails_set_balance_msat(uint64_t this_ptr, int64_t val) {
34398         LDKChannelDetails this_ptr_conv;
34399         this_ptr_conv.inner = untag_ptr(this_ptr);
34400         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
34401         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
34402         this_ptr_conv.is_owned = false;
34403         ChannelDetails_set_balance_msat(&this_ptr_conv, val);
34404 }
34405
34406 int64_t  __attribute__((export_name("TS_ChannelDetails_get_outbound_capacity_msat"))) TS_ChannelDetails_get_outbound_capacity_msat(uint64_t this_ptr) {
34407         LDKChannelDetails this_ptr_conv;
34408         this_ptr_conv.inner = untag_ptr(this_ptr);
34409         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
34410         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
34411         this_ptr_conv.is_owned = false;
34412         int64_t ret_conv = ChannelDetails_get_outbound_capacity_msat(&this_ptr_conv);
34413         return ret_conv;
34414 }
34415
34416 void  __attribute__((export_name("TS_ChannelDetails_set_outbound_capacity_msat"))) TS_ChannelDetails_set_outbound_capacity_msat(uint64_t this_ptr, int64_t val) {
34417         LDKChannelDetails this_ptr_conv;
34418         this_ptr_conv.inner = untag_ptr(this_ptr);
34419         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
34420         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
34421         this_ptr_conv.is_owned = false;
34422         ChannelDetails_set_outbound_capacity_msat(&this_ptr_conv, val);
34423 }
34424
34425 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) {
34426         LDKChannelDetails this_ptr_conv;
34427         this_ptr_conv.inner = untag_ptr(this_ptr);
34428         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
34429         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
34430         this_ptr_conv.is_owned = false;
34431         int64_t ret_conv = ChannelDetails_get_next_outbound_htlc_limit_msat(&this_ptr_conv);
34432         return ret_conv;
34433 }
34434
34435 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) {
34436         LDKChannelDetails this_ptr_conv;
34437         this_ptr_conv.inner = untag_ptr(this_ptr);
34438         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
34439         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
34440         this_ptr_conv.is_owned = false;
34441         ChannelDetails_set_next_outbound_htlc_limit_msat(&this_ptr_conv, val);
34442 }
34443
34444 int64_t  __attribute__((export_name("TS_ChannelDetails_get_next_outbound_htlc_minimum_msat"))) TS_ChannelDetails_get_next_outbound_htlc_minimum_msat(uint64_t this_ptr) {
34445         LDKChannelDetails this_ptr_conv;
34446         this_ptr_conv.inner = untag_ptr(this_ptr);
34447         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
34448         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
34449         this_ptr_conv.is_owned = false;
34450         int64_t ret_conv = ChannelDetails_get_next_outbound_htlc_minimum_msat(&this_ptr_conv);
34451         return ret_conv;
34452 }
34453
34454 void  __attribute__((export_name("TS_ChannelDetails_set_next_outbound_htlc_minimum_msat"))) TS_ChannelDetails_set_next_outbound_htlc_minimum_msat(uint64_t this_ptr, int64_t val) {
34455         LDKChannelDetails this_ptr_conv;
34456         this_ptr_conv.inner = untag_ptr(this_ptr);
34457         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
34458         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
34459         this_ptr_conv.is_owned = false;
34460         ChannelDetails_set_next_outbound_htlc_minimum_msat(&this_ptr_conv, val);
34461 }
34462
34463 int64_t  __attribute__((export_name("TS_ChannelDetails_get_inbound_capacity_msat"))) TS_ChannelDetails_get_inbound_capacity_msat(uint64_t this_ptr) {
34464         LDKChannelDetails this_ptr_conv;
34465         this_ptr_conv.inner = untag_ptr(this_ptr);
34466         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
34467         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
34468         this_ptr_conv.is_owned = false;
34469         int64_t ret_conv = ChannelDetails_get_inbound_capacity_msat(&this_ptr_conv);
34470         return ret_conv;
34471 }
34472
34473 void  __attribute__((export_name("TS_ChannelDetails_set_inbound_capacity_msat"))) TS_ChannelDetails_set_inbound_capacity_msat(uint64_t this_ptr, int64_t val) {
34474         LDKChannelDetails this_ptr_conv;
34475         this_ptr_conv.inner = untag_ptr(this_ptr);
34476         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
34477         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
34478         this_ptr_conv.is_owned = false;
34479         ChannelDetails_set_inbound_capacity_msat(&this_ptr_conv, val);
34480 }
34481
34482 uint64_t  __attribute__((export_name("TS_ChannelDetails_get_confirmations_required"))) TS_ChannelDetails_get_confirmations_required(uint64_t this_ptr) {
34483         LDKChannelDetails this_ptr_conv;
34484         this_ptr_conv.inner = untag_ptr(this_ptr);
34485         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
34486         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
34487         this_ptr_conv.is_owned = false;
34488         LDKCOption_u32Z *ret_copy = MALLOC(sizeof(LDKCOption_u32Z), "LDKCOption_u32Z");
34489         *ret_copy = ChannelDetails_get_confirmations_required(&this_ptr_conv);
34490         uint64_t ret_ref = tag_ptr(ret_copy, true);
34491         return ret_ref;
34492 }
34493
34494 void  __attribute__((export_name("TS_ChannelDetails_set_confirmations_required"))) TS_ChannelDetails_set_confirmations_required(uint64_t this_ptr, uint64_t val) {
34495         LDKChannelDetails this_ptr_conv;
34496         this_ptr_conv.inner = untag_ptr(this_ptr);
34497         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
34498         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
34499         this_ptr_conv.is_owned = false;
34500         void* val_ptr = untag_ptr(val);
34501         CHECK_ACCESS(val_ptr);
34502         LDKCOption_u32Z val_conv = *(LDKCOption_u32Z*)(val_ptr);
34503         val_conv = COption_u32Z_clone((LDKCOption_u32Z*)untag_ptr(val));
34504         ChannelDetails_set_confirmations_required(&this_ptr_conv, val_conv);
34505 }
34506
34507 uint64_t  __attribute__((export_name("TS_ChannelDetails_get_confirmations"))) TS_ChannelDetails_get_confirmations(uint64_t this_ptr) {
34508         LDKChannelDetails this_ptr_conv;
34509         this_ptr_conv.inner = untag_ptr(this_ptr);
34510         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
34511         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
34512         this_ptr_conv.is_owned = false;
34513         LDKCOption_u32Z *ret_copy = MALLOC(sizeof(LDKCOption_u32Z), "LDKCOption_u32Z");
34514         *ret_copy = ChannelDetails_get_confirmations(&this_ptr_conv);
34515         uint64_t ret_ref = tag_ptr(ret_copy, true);
34516         return ret_ref;
34517 }
34518
34519 void  __attribute__((export_name("TS_ChannelDetails_set_confirmations"))) TS_ChannelDetails_set_confirmations(uint64_t this_ptr, uint64_t val) {
34520         LDKChannelDetails this_ptr_conv;
34521         this_ptr_conv.inner = untag_ptr(this_ptr);
34522         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
34523         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
34524         this_ptr_conv.is_owned = false;
34525         void* val_ptr = untag_ptr(val);
34526         CHECK_ACCESS(val_ptr);
34527         LDKCOption_u32Z val_conv = *(LDKCOption_u32Z*)(val_ptr);
34528         val_conv = COption_u32Z_clone((LDKCOption_u32Z*)untag_ptr(val));
34529         ChannelDetails_set_confirmations(&this_ptr_conv, val_conv);
34530 }
34531
34532 uint64_t  __attribute__((export_name("TS_ChannelDetails_get_force_close_spend_delay"))) TS_ChannelDetails_get_force_close_spend_delay(uint64_t this_ptr) {
34533         LDKChannelDetails this_ptr_conv;
34534         this_ptr_conv.inner = untag_ptr(this_ptr);
34535         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
34536         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
34537         this_ptr_conv.is_owned = false;
34538         LDKCOption_u16Z *ret_copy = MALLOC(sizeof(LDKCOption_u16Z), "LDKCOption_u16Z");
34539         *ret_copy = ChannelDetails_get_force_close_spend_delay(&this_ptr_conv);
34540         uint64_t ret_ref = tag_ptr(ret_copy, true);
34541         return ret_ref;
34542 }
34543
34544 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) {
34545         LDKChannelDetails this_ptr_conv;
34546         this_ptr_conv.inner = untag_ptr(this_ptr);
34547         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
34548         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
34549         this_ptr_conv.is_owned = false;
34550         void* val_ptr = untag_ptr(val);
34551         CHECK_ACCESS(val_ptr);
34552         LDKCOption_u16Z val_conv = *(LDKCOption_u16Z*)(val_ptr);
34553         val_conv = COption_u16Z_clone((LDKCOption_u16Z*)untag_ptr(val));
34554         ChannelDetails_set_force_close_spend_delay(&this_ptr_conv, val_conv);
34555 }
34556
34557 jboolean  __attribute__((export_name("TS_ChannelDetails_get_is_outbound"))) TS_ChannelDetails_get_is_outbound(uint64_t this_ptr) {
34558         LDKChannelDetails this_ptr_conv;
34559         this_ptr_conv.inner = untag_ptr(this_ptr);
34560         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
34561         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
34562         this_ptr_conv.is_owned = false;
34563         jboolean ret_conv = ChannelDetails_get_is_outbound(&this_ptr_conv);
34564         return ret_conv;
34565 }
34566
34567 void  __attribute__((export_name("TS_ChannelDetails_set_is_outbound"))) TS_ChannelDetails_set_is_outbound(uint64_t this_ptr, jboolean val) {
34568         LDKChannelDetails this_ptr_conv;
34569         this_ptr_conv.inner = untag_ptr(this_ptr);
34570         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
34571         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
34572         this_ptr_conv.is_owned = false;
34573         ChannelDetails_set_is_outbound(&this_ptr_conv, val);
34574 }
34575
34576 jboolean  __attribute__((export_name("TS_ChannelDetails_get_is_channel_ready"))) TS_ChannelDetails_get_is_channel_ready(uint64_t this_ptr) {
34577         LDKChannelDetails this_ptr_conv;
34578         this_ptr_conv.inner = untag_ptr(this_ptr);
34579         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
34580         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
34581         this_ptr_conv.is_owned = false;
34582         jboolean ret_conv = ChannelDetails_get_is_channel_ready(&this_ptr_conv);
34583         return ret_conv;
34584 }
34585
34586 void  __attribute__((export_name("TS_ChannelDetails_set_is_channel_ready"))) TS_ChannelDetails_set_is_channel_ready(uint64_t this_ptr, jboolean val) {
34587         LDKChannelDetails this_ptr_conv;
34588         this_ptr_conv.inner = untag_ptr(this_ptr);
34589         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
34590         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
34591         this_ptr_conv.is_owned = false;
34592         ChannelDetails_set_is_channel_ready(&this_ptr_conv, val);
34593 }
34594
34595 uint64_t  __attribute__((export_name("TS_ChannelDetails_get_channel_shutdown_state"))) TS_ChannelDetails_get_channel_shutdown_state(uint64_t this_ptr) {
34596         LDKChannelDetails this_ptr_conv;
34597         this_ptr_conv.inner = untag_ptr(this_ptr);
34598         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
34599         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
34600         this_ptr_conv.is_owned = false;
34601         LDKCOption_ChannelShutdownStateZ *ret_copy = MALLOC(sizeof(LDKCOption_ChannelShutdownStateZ), "LDKCOption_ChannelShutdownStateZ");
34602         *ret_copy = ChannelDetails_get_channel_shutdown_state(&this_ptr_conv);
34603         uint64_t ret_ref = tag_ptr(ret_copy, true);
34604         return ret_ref;
34605 }
34606
34607 void  __attribute__((export_name("TS_ChannelDetails_set_channel_shutdown_state"))) TS_ChannelDetails_set_channel_shutdown_state(uint64_t this_ptr, uint64_t val) {
34608         LDKChannelDetails this_ptr_conv;
34609         this_ptr_conv.inner = untag_ptr(this_ptr);
34610         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
34611         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
34612         this_ptr_conv.is_owned = false;
34613         void* val_ptr = untag_ptr(val);
34614         CHECK_ACCESS(val_ptr);
34615         LDKCOption_ChannelShutdownStateZ val_conv = *(LDKCOption_ChannelShutdownStateZ*)(val_ptr);
34616         val_conv = COption_ChannelShutdownStateZ_clone((LDKCOption_ChannelShutdownStateZ*)untag_ptr(val));
34617         ChannelDetails_set_channel_shutdown_state(&this_ptr_conv, val_conv);
34618 }
34619
34620 jboolean  __attribute__((export_name("TS_ChannelDetails_get_is_usable"))) TS_ChannelDetails_get_is_usable(uint64_t this_ptr) {
34621         LDKChannelDetails this_ptr_conv;
34622         this_ptr_conv.inner = untag_ptr(this_ptr);
34623         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
34624         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
34625         this_ptr_conv.is_owned = false;
34626         jboolean ret_conv = ChannelDetails_get_is_usable(&this_ptr_conv);
34627         return ret_conv;
34628 }
34629
34630 void  __attribute__((export_name("TS_ChannelDetails_set_is_usable"))) TS_ChannelDetails_set_is_usable(uint64_t this_ptr, jboolean val) {
34631         LDKChannelDetails this_ptr_conv;
34632         this_ptr_conv.inner = untag_ptr(this_ptr);
34633         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
34634         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
34635         this_ptr_conv.is_owned = false;
34636         ChannelDetails_set_is_usable(&this_ptr_conv, val);
34637 }
34638
34639 jboolean  __attribute__((export_name("TS_ChannelDetails_get_is_public"))) TS_ChannelDetails_get_is_public(uint64_t this_ptr) {
34640         LDKChannelDetails this_ptr_conv;
34641         this_ptr_conv.inner = untag_ptr(this_ptr);
34642         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
34643         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
34644         this_ptr_conv.is_owned = false;
34645         jboolean ret_conv = ChannelDetails_get_is_public(&this_ptr_conv);
34646         return ret_conv;
34647 }
34648
34649 void  __attribute__((export_name("TS_ChannelDetails_set_is_public"))) TS_ChannelDetails_set_is_public(uint64_t this_ptr, jboolean val) {
34650         LDKChannelDetails this_ptr_conv;
34651         this_ptr_conv.inner = untag_ptr(this_ptr);
34652         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
34653         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
34654         this_ptr_conv.is_owned = false;
34655         ChannelDetails_set_is_public(&this_ptr_conv, val);
34656 }
34657
34658 uint64_t  __attribute__((export_name("TS_ChannelDetails_get_inbound_htlc_minimum_msat"))) TS_ChannelDetails_get_inbound_htlc_minimum_msat(uint64_t this_ptr) {
34659         LDKChannelDetails this_ptr_conv;
34660         this_ptr_conv.inner = untag_ptr(this_ptr);
34661         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
34662         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
34663         this_ptr_conv.is_owned = false;
34664         LDKCOption_u64Z *ret_copy = MALLOC(sizeof(LDKCOption_u64Z), "LDKCOption_u64Z");
34665         *ret_copy = ChannelDetails_get_inbound_htlc_minimum_msat(&this_ptr_conv);
34666         uint64_t ret_ref = tag_ptr(ret_copy, true);
34667         return ret_ref;
34668 }
34669
34670 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) {
34671         LDKChannelDetails this_ptr_conv;
34672         this_ptr_conv.inner = untag_ptr(this_ptr);
34673         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
34674         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
34675         this_ptr_conv.is_owned = false;
34676         void* val_ptr = untag_ptr(val);
34677         CHECK_ACCESS(val_ptr);
34678         LDKCOption_u64Z val_conv = *(LDKCOption_u64Z*)(val_ptr);
34679         val_conv = COption_u64Z_clone((LDKCOption_u64Z*)untag_ptr(val));
34680         ChannelDetails_set_inbound_htlc_minimum_msat(&this_ptr_conv, val_conv);
34681 }
34682
34683 uint64_t  __attribute__((export_name("TS_ChannelDetails_get_inbound_htlc_maximum_msat"))) TS_ChannelDetails_get_inbound_htlc_maximum_msat(uint64_t this_ptr) {
34684         LDKChannelDetails 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         LDKCOption_u64Z *ret_copy = MALLOC(sizeof(LDKCOption_u64Z), "LDKCOption_u64Z");
34690         *ret_copy = ChannelDetails_get_inbound_htlc_maximum_msat(&this_ptr_conv);
34691         uint64_t ret_ref = tag_ptr(ret_copy, true);
34692         return ret_ref;
34693 }
34694
34695 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) {
34696         LDKChannelDetails this_ptr_conv;
34697         this_ptr_conv.inner = untag_ptr(this_ptr);
34698         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
34699         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
34700         this_ptr_conv.is_owned = false;
34701         void* val_ptr = untag_ptr(val);
34702         CHECK_ACCESS(val_ptr);
34703         LDKCOption_u64Z val_conv = *(LDKCOption_u64Z*)(val_ptr);
34704         val_conv = COption_u64Z_clone((LDKCOption_u64Z*)untag_ptr(val));
34705         ChannelDetails_set_inbound_htlc_maximum_msat(&this_ptr_conv, val_conv);
34706 }
34707
34708 uint64_t  __attribute__((export_name("TS_ChannelDetails_get_config"))) TS_ChannelDetails_get_config(uint64_t this_ptr) {
34709         LDKChannelDetails this_ptr_conv;
34710         this_ptr_conv.inner = untag_ptr(this_ptr);
34711         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
34712         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
34713         this_ptr_conv.is_owned = false;
34714         LDKChannelConfig ret_var = ChannelDetails_get_config(&this_ptr_conv);
34715         uint64_t ret_ref = 0;
34716         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
34717         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
34718         return ret_ref;
34719 }
34720
34721 void  __attribute__((export_name("TS_ChannelDetails_set_config"))) TS_ChannelDetails_set_config(uint64_t this_ptr, uint64_t val) {
34722         LDKChannelDetails this_ptr_conv;
34723         this_ptr_conv.inner = untag_ptr(this_ptr);
34724         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
34725         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
34726         this_ptr_conv.is_owned = false;
34727         LDKChannelConfig val_conv;
34728         val_conv.inner = untag_ptr(val);
34729         val_conv.is_owned = ptr_is_owned(val);
34730         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
34731         val_conv = ChannelConfig_clone(&val_conv);
34732         ChannelDetails_set_config(&this_ptr_conv, val_conv);
34733 }
34734
34735 uint64_t  __attribute__((export_name("TS_ChannelDetails_new"))) TS_ChannelDetails_new(int8_tArray channel_id_arg, uint64_t counterparty_arg, uint64_t funding_txo_arg, uint64_t channel_type_arg, uint64_t short_channel_id_arg, uint64_t outbound_scid_alias_arg, uint64_t inbound_scid_alias_arg, int64_t channel_value_satoshis_arg, uint64_t unspendable_punishment_reserve_arg, int8_tArray user_channel_id_arg, uint64_t feerate_sat_per_1000_weight_arg, int64_t balance_msat_arg, int64_t outbound_capacity_msat_arg, int64_t next_outbound_htlc_limit_msat_arg, int64_t next_outbound_htlc_minimum_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, uint64_t channel_shutdown_state_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) {
34736         LDKThirtyTwoBytes channel_id_arg_ref;
34737         CHECK(channel_id_arg->arr_len == 32);
34738         memcpy(channel_id_arg_ref.data, channel_id_arg->elems, 32); FREE(channel_id_arg);
34739         LDKChannelCounterparty counterparty_arg_conv;
34740         counterparty_arg_conv.inner = untag_ptr(counterparty_arg);
34741         counterparty_arg_conv.is_owned = ptr_is_owned(counterparty_arg);
34742         CHECK_INNER_FIELD_ACCESS_OR_NULL(counterparty_arg_conv);
34743         counterparty_arg_conv = ChannelCounterparty_clone(&counterparty_arg_conv);
34744         LDKOutPoint funding_txo_arg_conv;
34745         funding_txo_arg_conv.inner = untag_ptr(funding_txo_arg);
34746         funding_txo_arg_conv.is_owned = ptr_is_owned(funding_txo_arg);
34747         CHECK_INNER_FIELD_ACCESS_OR_NULL(funding_txo_arg_conv);
34748         funding_txo_arg_conv = OutPoint_clone(&funding_txo_arg_conv);
34749         LDKChannelTypeFeatures channel_type_arg_conv;
34750         channel_type_arg_conv.inner = untag_ptr(channel_type_arg);
34751         channel_type_arg_conv.is_owned = ptr_is_owned(channel_type_arg);
34752         CHECK_INNER_FIELD_ACCESS_OR_NULL(channel_type_arg_conv);
34753         channel_type_arg_conv = ChannelTypeFeatures_clone(&channel_type_arg_conv);
34754         void* short_channel_id_arg_ptr = untag_ptr(short_channel_id_arg);
34755         CHECK_ACCESS(short_channel_id_arg_ptr);
34756         LDKCOption_u64Z short_channel_id_arg_conv = *(LDKCOption_u64Z*)(short_channel_id_arg_ptr);
34757         short_channel_id_arg_conv = COption_u64Z_clone((LDKCOption_u64Z*)untag_ptr(short_channel_id_arg));
34758         void* outbound_scid_alias_arg_ptr = untag_ptr(outbound_scid_alias_arg);
34759         CHECK_ACCESS(outbound_scid_alias_arg_ptr);
34760         LDKCOption_u64Z outbound_scid_alias_arg_conv = *(LDKCOption_u64Z*)(outbound_scid_alias_arg_ptr);
34761         outbound_scid_alias_arg_conv = COption_u64Z_clone((LDKCOption_u64Z*)untag_ptr(outbound_scid_alias_arg));
34762         void* inbound_scid_alias_arg_ptr = untag_ptr(inbound_scid_alias_arg);
34763         CHECK_ACCESS(inbound_scid_alias_arg_ptr);
34764         LDKCOption_u64Z inbound_scid_alias_arg_conv = *(LDKCOption_u64Z*)(inbound_scid_alias_arg_ptr);
34765         inbound_scid_alias_arg_conv = COption_u64Z_clone((LDKCOption_u64Z*)untag_ptr(inbound_scid_alias_arg));
34766         void* unspendable_punishment_reserve_arg_ptr = untag_ptr(unspendable_punishment_reserve_arg);
34767         CHECK_ACCESS(unspendable_punishment_reserve_arg_ptr);
34768         LDKCOption_u64Z unspendable_punishment_reserve_arg_conv = *(LDKCOption_u64Z*)(unspendable_punishment_reserve_arg_ptr);
34769         LDKU128 user_channel_id_arg_ref;
34770         CHECK(user_channel_id_arg->arr_len == 16);
34771         memcpy(user_channel_id_arg_ref.le_bytes, user_channel_id_arg->elems, 16); FREE(user_channel_id_arg);
34772         void* feerate_sat_per_1000_weight_arg_ptr = untag_ptr(feerate_sat_per_1000_weight_arg);
34773         CHECK_ACCESS(feerate_sat_per_1000_weight_arg_ptr);
34774         LDKCOption_u32Z feerate_sat_per_1000_weight_arg_conv = *(LDKCOption_u32Z*)(feerate_sat_per_1000_weight_arg_ptr);
34775         feerate_sat_per_1000_weight_arg_conv = COption_u32Z_clone((LDKCOption_u32Z*)untag_ptr(feerate_sat_per_1000_weight_arg));
34776         void* confirmations_required_arg_ptr = untag_ptr(confirmations_required_arg);
34777         CHECK_ACCESS(confirmations_required_arg_ptr);
34778         LDKCOption_u32Z confirmations_required_arg_conv = *(LDKCOption_u32Z*)(confirmations_required_arg_ptr);
34779         confirmations_required_arg_conv = COption_u32Z_clone((LDKCOption_u32Z*)untag_ptr(confirmations_required_arg));
34780         void* confirmations_arg_ptr = untag_ptr(confirmations_arg);
34781         CHECK_ACCESS(confirmations_arg_ptr);
34782         LDKCOption_u32Z confirmations_arg_conv = *(LDKCOption_u32Z*)(confirmations_arg_ptr);
34783         confirmations_arg_conv = COption_u32Z_clone((LDKCOption_u32Z*)untag_ptr(confirmations_arg));
34784         void* force_close_spend_delay_arg_ptr = untag_ptr(force_close_spend_delay_arg);
34785         CHECK_ACCESS(force_close_spend_delay_arg_ptr);
34786         LDKCOption_u16Z force_close_spend_delay_arg_conv = *(LDKCOption_u16Z*)(force_close_spend_delay_arg_ptr);
34787         force_close_spend_delay_arg_conv = COption_u16Z_clone((LDKCOption_u16Z*)untag_ptr(force_close_spend_delay_arg));
34788         void* channel_shutdown_state_arg_ptr = untag_ptr(channel_shutdown_state_arg);
34789         CHECK_ACCESS(channel_shutdown_state_arg_ptr);
34790         LDKCOption_ChannelShutdownStateZ channel_shutdown_state_arg_conv = *(LDKCOption_ChannelShutdownStateZ*)(channel_shutdown_state_arg_ptr);
34791         channel_shutdown_state_arg_conv = COption_ChannelShutdownStateZ_clone((LDKCOption_ChannelShutdownStateZ*)untag_ptr(channel_shutdown_state_arg));
34792         void* inbound_htlc_minimum_msat_arg_ptr = untag_ptr(inbound_htlc_minimum_msat_arg);
34793         CHECK_ACCESS(inbound_htlc_minimum_msat_arg_ptr);
34794         LDKCOption_u64Z inbound_htlc_minimum_msat_arg_conv = *(LDKCOption_u64Z*)(inbound_htlc_minimum_msat_arg_ptr);
34795         inbound_htlc_minimum_msat_arg_conv = COption_u64Z_clone((LDKCOption_u64Z*)untag_ptr(inbound_htlc_minimum_msat_arg));
34796         void* inbound_htlc_maximum_msat_arg_ptr = untag_ptr(inbound_htlc_maximum_msat_arg);
34797         CHECK_ACCESS(inbound_htlc_maximum_msat_arg_ptr);
34798         LDKCOption_u64Z inbound_htlc_maximum_msat_arg_conv = *(LDKCOption_u64Z*)(inbound_htlc_maximum_msat_arg_ptr);
34799         inbound_htlc_maximum_msat_arg_conv = COption_u64Z_clone((LDKCOption_u64Z*)untag_ptr(inbound_htlc_maximum_msat_arg));
34800         LDKChannelConfig config_arg_conv;
34801         config_arg_conv.inner = untag_ptr(config_arg);
34802         config_arg_conv.is_owned = ptr_is_owned(config_arg);
34803         CHECK_INNER_FIELD_ACCESS_OR_NULL(config_arg_conv);
34804         config_arg_conv = ChannelConfig_clone(&config_arg_conv);
34805         LDKChannelDetails ret_var = ChannelDetails_new(channel_id_arg_ref, counterparty_arg_conv, funding_txo_arg_conv, channel_type_arg_conv, short_channel_id_arg_conv, outbound_scid_alias_arg_conv, inbound_scid_alias_arg_conv, channel_value_satoshis_arg, unspendable_punishment_reserve_arg_conv, user_channel_id_arg_ref, feerate_sat_per_1000_weight_arg_conv, balance_msat_arg, outbound_capacity_msat_arg, next_outbound_htlc_limit_msat_arg, next_outbound_htlc_minimum_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, channel_shutdown_state_arg_conv, is_usable_arg, is_public_arg, inbound_htlc_minimum_msat_arg_conv, inbound_htlc_maximum_msat_arg_conv, config_arg_conv);
34806         uint64_t ret_ref = 0;
34807         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
34808         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
34809         return ret_ref;
34810 }
34811
34812 static inline uint64_t ChannelDetails_clone_ptr(LDKChannelDetails *NONNULL_PTR arg) {
34813         LDKChannelDetails ret_var = ChannelDetails_clone(arg);
34814         uint64_t ret_ref = 0;
34815         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
34816         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
34817         return ret_ref;
34818 }
34819 int64_t  __attribute__((export_name("TS_ChannelDetails_clone_ptr"))) TS_ChannelDetails_clone_ptr(uint64_t arg) {
34820         LDKChannelDetails arg_conv;
34821         arg_conv.inner = untag_ptr(arg);
34822         arg_conv.is_owned = ptr_is_owned(arg);
34823         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
34824         arg_conv.is_owned = false;
34825         int64_t ret_conv = ChannelDetails_clone_ptr(&arg_conv);
34826         return ret_conv;
34827 }
34828
34829 uint64_t  __attribute__((export_name("TS_ChannelDetails_clone"))) TS_ChannelDetails_clone(uint64_t orig) {
34830         LDKChannelDetails orig_conv;
34831         orig_conv.inner = untag_ptr(orig);
34832         orig_conv.is_owned = ptr_is_owned(orig);
34833         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
34834         orig_conv.is_owned = false;
34835         LDKChannelDetails ret_var = ChannelDetails_clone(&orig_conv);
34836         uint64_t ret_ref = 0;
34837         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
34838         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
34839         return ret_ref;
34840 }
34841
34842 uint64_t  __attribute__((export_name("TS_ChannelDetails_get_inbound_payment_scid"))) TS_ChannelDetails_get_inbound_payment_scid(uint64_t this_arg) {
34843         LDKChannelDetails this_arg_conv;
34844         this_arg_conv.inner = untag_ptr(this_arg);
34845         this_arg_conv.is_owned = ptr_is_owned(this_arg);
34846         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
34847         this_arg_conv.is_owned = false;
34848         LDKCOption_u64Z *ret_copy = MALLOC(sizeof(LDKCOption_u64Z), "LDKCOption_u64Z");
34849         *ret_copy = ChannelDetails_get_inbound_payment_scid(&this_arg_conv);
34850         uint64_t ret_ref = tag_ptr(ret_copy, true);
34851         return ret_ref;
34852 }
34853
34854 uint64_t  __attribute__((export_name("TS_ChannelDetails_get_outbound_payment_scid"))) TS_ChannelDetails_get_outbound_payment_scid(uint64_t this_arg) {
34855         LDKChannelDetails this_arg_conv;
34856         this_arg_conv.inner = untag_ptr(this_arg);
34857         this_arg_conv.is_owned = ptr_is_owned(this_arg);
34858         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
34859         this_arg_conv.is_owned = false;
34860         LDKCOption_u64Z *ret_copy = MALLOC(sizeof(LDKCOption_u64Z), "LDKCOption_u64Z");
34861         *ret_copy = ChannelDetails_get_outbound_payment_scid(&this_arg_conv);
34862         uint64_t ret_ref = tag_ptr(ret_copy, true);
34863         return ret_ref;
34864 }
34865
34866 uint32_t  __attribute__((export_name("TS_ChannelShutdownState_clone"))) TS_ChannelShutdownState_clone(uint64_t orig) {
34867         LDKChannelShutdownState* orig_conv = (LDKChannelShutdownState*)untag_ptr(orig);
34868         uint32_t ret_conv = LDKChannelShutdownState_to_js(ChannelShutdownState_clone(orig_conv));
34869         return ret_conv;
34870 }
34871
34872 uint32_t  __attribute__((export_name("TS_ChannelShutdownState_not_shutting_down"))) TS_ChannelShutdownState_not_shutting_down() {
34873         uint32_t ret_conv = LDKChannelShutdownState_to_js(ChannelShutdownState_not_shutting_down());
34874         return ret_conv;
34875 }
34876
34877 uint32_t  __attribute__((export_name("TS_ChannelShutdownState_shutdown_initiated"))) TS_ChannelShutdownState_shutdown_initiated() {
34878         uint32_t ret_conv = LDKChannelShutdownState_to_js(ChannelShutdownState_shutdown_initiated());
34879         return ret_conv;
34880 }
34881
34882 uint32_t  __attribute__((export_name("TS_ChannelShutdownState_resolving_htlcs"))) TS_ChannelShutdownState_resolving_htlcs() {
34883         uint32_t ret_conv = LDKChannelShutdownState_to_js(ChannelShutdownState_resolving_htlcs());
34884         return ret_conv;
34885 }
34886
34887 uint32_t  __attribute__((export_name("TS_ChannelShutdownState_negotiating_closing_fee"))) TS_ChannelShutdownState_negotiating_closing_fee() {
34888         uint32_t ret_conv = LDKChannelShutdownState_to_js(ChannelShutdownState_negotiating_closing_fee());
34889         return ret_conv;
34890 }
34891
34892 uint32_t  __attribute__((export_name("TS_ChannelShutdownState_shutdown_complete"))) TS_ChannelShutdownState_shutdown_complete() {
34893         uint32_t ret_conv = LDKChannelShutdownState_to_js(ChannelShutdownState_shutdown_complete());
34894         return ret_conv;
34895 }
34896
34897 jboolean  __attribute__((export_name("TS_ChannelShutdownState_eq"))) TS_ChannelShutdownState_eq(uint64_t a, uint64_t b) {
34898         LDKChannelShutdownState* a_conv = (LDKChannelShutdownState*)untag_ptr(a);
34899         LDKChannelShutdownState* b_conv = (LDKChannelShutdownState*)untag_ptr(b);
34900         jboolean ret_conv = ChannelShutdownState_eq(a_conv, b_conv);
34901         return ret_conv;
34902 }
34903
34904 void  __attribute__((export_name("TS_RecentPaymentDetails_free"))) TS_RecentPaymentDetails_free(uint64_t this_ptr) {
34905         if (!ptr_is_owned(this_ptr)) return;
34906         void* this_ptr_ptr = untag_ptr(this_ptr);
34907         CHECK_ACCESS(this_ptr_ptr);
34908         LDKRecentPaymentDetails this_ptr_conv = *(LDKRecentPaymentDetails*)(this_ptr_ptr);
34909         FREE(untag_ptr(this_ptr));
34910         RecentPaymentDetails_free(this_ptr_conv);
34911 }
34912
34913 static inline uint64_t RecentPaymentDetails_clone_ptr(LDKRecentPaymentDetails *NONNULL_PTR arg) {
34914         LDKRecentPaymentDetails *ret_copy = MALLOC(sizeof(LDKRecentPaymentDetails), "LDKRecentPaymentDetails");
34915         *ret_copy = RecentPaymentDetails_clone(arg);
34916         uint64_t ret_ref = tag_ptr(ret_copy, true);
34917         return ret_ref;
34918 }
34919 int64_t  __attribute__((export_name("TS_RecentPaymentDetails_clone_ptr"))) TS_RecentPaymentDetails_clone_ptr(uint64_t arg) {
34920         LDKRecentPaymentDetails* arg_conv = (LDKRecentPaymentDetails*)untag_ptr(arg);
34921         int64_t ret_conv = RecentPaymentDetails_clone_ptr(arg_conv);
34922         return ret_conv;
34923 }
34924
34925 uint64_t  __attribute__((export_name("TS_RecentPaymentDetails_clone"))) TS_RecentPaymentDetails_clone(uint64_t orig) {
34926         LDKRecentPaymentDetails* orig_conv = (LDKRecentPaymentDetails*)untag_ptr(orig);
34927         LDKRecentPaymentDetails *ret_copy = MALLOC(sizeof(LDKRecentPaymentDetails), "LDKRecentPaymentDetails");
34928         *ret_copy = RecentPaymentDetails_clone(orig_conv);
34929         uint64_t ret_ref = tag_ptr(ret_copy, true);
34930         return ret_ref;
34931 }
34932
34933 uint64_t  __attribute__((export_name("TS_RecentPaymentDetails_awaiting_invoice"))) TS_RecentPaymentDetails_awaiting_invoice(int8_tArray payment_id) {
34934         LDKThirtyTwoBytes payment_id_ref;
34935         CHECK(payment_id->arr_len == 32);
34936         memcpy(payment_id_ref.data, payment_id->elems, 32); FREE(payment_id);
34937         LDKRecentPaymentDetails *ret_copy = MALLOC(sizeof(LDKRecentPaymentDetails), "LDKRecentPaymentDetails");
34938         *ret_copy = RecentPaymentDetails_awaiting_invoice(payment_id_ref);
34939         uint64_t ret_ref = tag_ptr(ret_copy, true);
34940         return ret_ref;
34941 }
34942
34943 uint64_t  __attribute__((export_name("TS_RecentPaymentDetails_pending"))) TS_RecentPaymentDetails_pending(int8_tArray payment_id, int8_tArray payment_hash, int64_t total_msat) {
34944         LDKThirtyTwoBytes payment_id_ref;
34945         CHECK(payment_id->arr_len == 32);
34946         memcpy(payment_id_ref.data, payment_id->elems, 32); FREE(payment_id);
34947         LDKThirtyTwoBytes payment_hash_ref;
34948         CHECK(payment_hash->arr_len == 32);
34949         memcpy(payment_hash_ref.data, payment_hash->elems, 32); FREE(payment_hash);
34950         LDKRecentPaymentDetails *ret_copy = MALLOC(sizeof(LDKRecentPaymentDetails), "LDKRecentPaymentDetails");
34951         *ret_copy = RecentPaymentDetails_pending(payment_id_ref, payment_hash_ref, total_msat);
34952         uint64_t ret_ref = tag_ptr(ret_copy, true);
34953         return ret_ref;
34954 }
34955
34956 uint64_t  __attribute__((export_name("TS_RecentPaymentDetails_fulfilled"))) TS_RecentPaymentDetails_fulfilled(int8_tArray payment_id, uint64_t payment_hash) {
34957         LDKThirtyTwoBytes payment_id_ref;
34958         CHECK(payment_id->arr_len == 32);
34959         memcpy(payment_id_ref.data, payment_id->elems, 32); FREE(payment_id);
34960         void* payment_hash_ptr = untag_ptr(payment_hash);
34961         CHECK_ACCESS(payment_hash_ptr);
34962         LDKCOption_ThirtyTwoBytesZ payment_hash_conv = *(LDKCOption_ThirtyTwoBytesZ*)(payment_hash_ptr);
34963         payment_hash_conv = COption_ThirtyTwoBytesZ_clone((LDKCOption_ThirtyTwoBytesZ*)untag_ptr(payment_hash));
34964         LDKRecentPaymentDetails *ret_copy = MALLOC(sizeof(LDKRecentPaymentDetails), "LDKRecentPaymentDetails");
34965         *ret_copy = RecentPaymentDetails_fulfilled(payment_id_ref, payment_hash_conv);
34966         uint64_t ret_ref = tag_ptr(ret_copy, true);
34967         return ret_ref;
34968 }
34969
34970 uint64_t  __attribute__((export_name("TS_RecentPaymentDetails_abandoned"))) TS_RecentPaymentDetails_abandoned(int8_tArray payment_id, int8_tArray payment_hash) {
34971         LDKThirtyTwoBytes payment_id_ref;
34972         CHECK(payment_id->arr_len == 32);
34973         memcpy(payment_id_ref.data, payment_id->elems, 32); FREE(payment_id);
34974         LDKThirtyTwoBytes payment_hash_ref;
34975         CHECK(payment_hash->arr_len == 32);
34976         memcpy(payment_hash_ref.data, payment_hash->elems, 32); FREE(payment_hash);
34977         LDKRecentPaymentDetails *ret_copy = MALLOC(sizeof(LDKRecentPaymentDetails), "LDKRecentPaymentDetails");
34978         *ret_copy = RecentPaymentDetails_abandoned(payment_id_ref, payment_hash_ref);
34979         uint64_t ret_ref = tag_ptr(ret_copy, true);
34980         return ret_ref;
34981 }
34982
34983 void  __attribute__((export_name("TS_PhantomRouteHints_free"))) TS_PhantomRouteHints_free(uint64_t this_obj) {
34984         LDKPhantomRouteHints this_obj_conv;
34985         this_obj_conv.inner = untag_ptr(this_obj);
34986         this_obj_conv.is_owned = ptr_is_owned(this_obj);
34987         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
34988         PhantomRouteHints_free(this_obj_conv);
34989 }
34990
34991 uint64_tArray  __attribute__((export_name("TS_PhantomRouteHints_get_channels"))) TS_PhantomRouteHints_get_channels(uint64_t this_ptr) {
34992         LDKPhantomRouteHints this_ptr_conv;
34993         this_ptr_conv.inner = untag_ptr(this_ptr);
34994         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
34995         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
34996         this_ptr_conv.is_owned = false;
34997         LDKCVec_ChannelDetailsZ ret_var = PhantomRouteHints_get_channels(&this_ptr_conv);
34998         uint64_tArray ret_arr = NULL;
34999         ret_arr = init_uint64_tArray(ret_var.datalen, __LINE__);
35000         uint64_t *ret_arr_ptr = (uint64_t*)(((uint8_t*)ret_arr) + 8);
35001         for (size_t q = 0; q < ret_var.datalen; q++) {
35002                 LDKChannelDetails ret_conv_16_var = ret_var.data[q];
35003                 uint64_t ret_conv_16_ref = 0;
35004                 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_conv_16_var);
35005                 ret_conv_16_ref = tag_ptr(ret_conv_16_var.inner, ret_conv_16_var.is_owned);
35006                 ret_arr_ptr[q] = ret_conv_16_ref;
35007         }
35008         
35009         FREE(ret_var.data);
35010         return ret_arr;
35011 }
35012
35013 void  __attribute__((export_name("TS_PhantomRouteHints_set_channels"))) TS_PhantomRouteHints_set_channels(uint64_t this_ptr, uint64_tArray val) {
35014         LDKPhantomRouteHints this_ptr_conv;
35015         this_ptr_conv.inner = untag_ptr(this_ptr);
35016         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
35017         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
35018         this_ptr_conv.is_owned = false;
35019         LDKCVec_ChannelDetailsZ val_constr;
35020         val_constr.datalen = val->arr_len;
35021         if (val_constr.datalen > 0)
35022                 val_constr.data = MALLOC(val_constr.datalen * sizeof(LDKChannelDetails), "LDKCVec_ChannelDetailsZ Elements");
35023         else
35024                 val_constr.data = NULL;
35025         uint64_t* val_vals = val->elems;
35026         for (size_t q = 0; q < val_constr.datalen; q++) {
35027                 uint64_t val_conv_16 = val_vals[q];
35028                 LDKChannelDetails val_conv_16_conv;
35029                 val_conv_16_conv.inner = untag_ptr(val_conv_16);
35030                 val_conv_16_conv.is_owned = ptr_is_owned(val_conv_16);
35031                 CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv_16_conv);
35032                 val_conv_16_conv = ChannelDetails_clone(&val_conv_16_conv);
35033                 val_constr.data[q] = val_conv_16_conv;
35034         }
35035         FREE(val);
35036         PhantomRouteHints_set_channels(&this_ptr_conv, val_constr);
35037 }
35038
35039 int64_t  __attribute__((export_name("TS_PhantomRouteHints_get_phantom_scid"))) TS_PhantomRouteHints_get_phantom_scid(uint64_t this_ptr) {
35040         LDKPhantomRouteHints this_ptr_conv;
35041         this_ptr_conv.inner = untag_ptr(this_ptr);
35042         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
35043         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
35044         this_ptr_conv.is_owned = false;
35045         int64_t ret_conv = PhantomRouteHints_get_phantom_scid(&this_ptr_conv);
35046         return ret_conv;
35047 }
35048
35049 void  __attribute__((export_name("TS_PhantomRouteHints_set_phantom_scid"))) TS_PhantomRouteHints_set_phantom_scid(uint64_t this_ptr, int64_t val) {
35050         LDKPhantomRouteHints this_ptr_conv;
35051         this_ptr_conv.inner = untag_ptr(this_ptr);
35052         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
35053         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
35054         this_ptr_conv.is_owned = false;
35055         PhantomRouteHints_set_phantom_scid(&this_ptr_conv, val);
35056 }
35057
35058 int8_tArray  __attribute__((export_name("TS_PhantomRouteHints_get_real_node_pubkey"))) TS_PhantomRouteHints_get_real_node_pubkey(uint64_t this_ptr) {
35059         LDKPhantomRouteHints this_ptr_conv;
35060         this_ptr_conv.inner = untag_ptr(this_ptr);
35061         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
35062         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
35063         this_ptr_conv.is_owned = false;
35064         int8_tArray ret_arr = init_int8_tArray(33, __LINE__);
35065         memcpy(ret_arr->elems, PhantomRouteHints_get_real_node_pubkey(&this_ptr_conv).compressed_form, 33);
35066         return ret_arr;
35067 }
35068
35069 void  __attribute__((export_name("TS_PhantomRouteHints_set_real_node_pubkey"))) TS_PhantomRouteHints_set_real_node_pubkey(uint64_t this_ptr, int8_tArray val) {
35070         LDKPhantomRouteHints this_ptr_conv;
35071         this_ptr_conv.inner = untag_ptr(this_ptr);
35072         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
35073         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
35074         this_ptr_conv.is_owned = false;
35075         LDKPublicKey val_ref;
35076         CHECK(val->arr_len == 33);
35077         memcpy(val_ref.compressed_form, val->elems, 33); FREE(val);
35078         PhantomRouteHints_set_real_node_pubkey(&this_ptr_conv, val_ref);
35079 }
35080
35081 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) {
35082         LDKCVec_ChannelDetailsZ channels_arg_constr;
35083         channels_arg_constr.datalen = channels_arg->arr_len;
35084         if (channels_arg_constr.datalen > 0)
35085                 channels_arg_constr.data = MALLOC(channels_arg_constr.datalen * sizeof(LDKChannelDetails), "LDKCVec_ChannelDetailsZ Elements");
35086         else
35087                 channels_arg_constr.data = NULL;
35088         uint64_t* channels_arg_vals = channels_arg->elems;
35089         for (size_t q = 0; q < channels_arg_constr.datalen; q++) {
35090                 uint64_t channels_arg_conv_16 = channels_arg_vals[q];
35091                 LDKChannelDetails channels_arg_conv_16_conv;
35092                 channels_arg_conv_16_conv.inner = untag_ptr(channels_arg_conv_16);
35093                 channels_arg_conv_16_conv.is_owned = ptr_is_owned(channels_arg_conv_16);
35094                 CHECK_INNER_FIELD_ACCESS_OR_NULL(channels_arg_conv_16_conv);
35095                 channels_arg_conv_16_conv = ChannelDetails_clone(&channels_arg_conv_16_conv);
35096                 channels_arg_constr.data[q] = channels_arg_conv_16_conv;
35097         }
35098         FREE(channels_arg);
35099         LDKPublicKey real_node_pubkey_arg_ref;
35100         CHECK(real_node_pubkey_arg->arr_len == 33);
35101         memcpy(real_node_pubkey_arg_ref.compressed_form, real_node_pubkey_arg->elems, 33); FREE(real_node_pubkey_arg);
35102         LDKPhantomRouteHints ret_var = PhantomRouteHints_new(channels_arg_constr, phantom_scid_arg, real_node_pubkey_arg_ref);
35103         uint64_t ret_ref = 0;
35104         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
35105         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
35106         return ret_ref;
35107 }
35108
35109 static inline uint64_t PhantomRouteHints_clone_ptr(LDKPhantomRouteHints *NONNULL_PTR arg) {
35110         LDKPhantomRouteHints ret_var = PhantomRouteHints_clone(arg);
35111         uint64_t ret_ref = 0;
35112         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
35113         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
35114         return ret_ref;
35115 }
35116 int64_t  __attribute__((export_name("TS_PhantomRouteHints_clone_ptr"))) TS_PhantomRouteHints_clone_ptr(uint64_t arg) {
35117         LDKPhantomRouteHints arg_conv;
35118         arg_conv.inner = untag_ptr(arg);
35119         arg_conv.is_owned = ptr_is_owned(arg);
35120         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
35121         arg_conv.is_owned = false;
35122         int64_t ret_conv = PhantomRouteHints_clone_ptr(&arg_conv);
35123         return ret_conv;
35124 }
35125
35126 uint64_t  __attribute__((export_name("TS_PhantomRouteHints_clone"))) TS_PhantomRouteHints_clone(uint64_t orig) {
35127         LDKPhantomRouteHints orig_conv;
35128         orig_conv.inner = untag_ptr(orig);
35129         orig_conv.is_owned = ptr_is_owned(orig);
35130         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
35131         orig_conv.is_owned = false;
35132         LDKPhantomRouteHints ret_var = PhantomRouteHints_clone(&orig_conv);
35133         uint64_t ret_ref = 0;
35134         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
35135         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
35136         return ret_ref;
35137 }
35138
35139 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, int32_t current_timestamp) {
35140         void* fee_est_ptr = untag_ptr(fee_est);
35141         CHECK_ACCESS(fee_est_ptr);
35142         LDKFeeEstimator fee_est_conv = *(LDKFeeEstimator*)(fee_est_ptr);
35143         if (fee_est_conv.free == LDKFeeEstimator_JCalls_free) {
35144                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
35145                 LDKFeeEstimator_JCalls_cloned(&fee_est_conv);
35146         }
35147         void* chain_monitor_ptr = untag_ptr(chain_monitor);
35148         CHECK_ACCESS(chain_monitor_ptr);
35149         LDKWatch chain_monitor_conv = *(LDKWatch*)(chain_monitor_ptr);
35150         if (chain_monitor_conv.free == LDKWatch_JCalls_free) {
35151                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
35152                 LDKWatch_JCalls_cloned(&chain_monitor_conv);
35153         }
35154         void* tx_broadcaster_ptr = untag_ptr(tx_broadcaster);
35155         CHECK_ACCESS(tx_broadcaster_ptr);
35156         LDKBroadcasterInterface tx_broadcaster_conv = *(LDKBroadcasterInterface*)(tx_broadcaster_ptr);
35157         if (tx_broadcaster_conv.free == LDKBroadcasterInterface_JCalls_free) {
35158                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
35159                 LDKBroadcasterInterface_JCalls_cloned(&tx_broadcaster_conv);
35160         }
35161         void* router_ptr = untag_ptr(router);
35162         CHECK_ACCESS(router_ptr);
35163         LDKRouter router_conv = *(LDKRouter*)(router_ptr);
35164         if (router_conv.free == LDKRouter_JCalls_free) {
35165                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
35166                 LDKRouter_JCalls_cloned(&router_conv);
35167         }
35168         void* logger_ptr = untag_ptr(logger);
35169         CHECK_ACCESS(logger_ptr);
35170         LDKLogger logger_conv = *(LDKLogger*)(logger_ptr);
35171         if (logger_conv.free == LDKLogger_JCalls_free) {
35172                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
35173                 LDKLogger_JCalls_cloned(&logger_conv);
35174         }
35175         void* entropy_source_ptr = untag_ptr(entropy_source);
35176         CHECK_ACCESS(entropy_source_ptr);
35177         LDKEntropySource entropy_source_conv = *(LDKEntropySource*)(entropy_source_ptr);
35178         if (entropy_source_conv.free == LDKEntropySource_JCalls_free) {
35179                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
35180                 LDKEntropySource_JCalls_cloned(&entropy_source_conv);
35181         }
35182         void* node_signer_ptr = untag_ptr(node_signer);
35183         CHECK_ACCESS(node_signer_ptr);
35184         LDKNodeSigner node_signer_conv = *(LDKNodeSigner*)(node_signer_ptr);
35185         if (node_signer_conv.free == LDKNodeSigner_JCalls_free) {
35186                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
35187                 LDKNodeSigner_JCalls_cloned(&node_signer_conv);
35188         }
35189         void* signer_provider_ptr = untag_ptr(signer_provider);
35190         CHECK_ACCESS(signer_provider_ptr);
35191         LDKSignerProvider signer_provider_conv = *(LDKSignerProvider*)(signer_provider_ptr);
35192         if (signer_provider_conv.free == LDKSignerProvider_JCalls_free) {
35193                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
35194                 LDKSignerProvider_JCalls_cloned(&signer_provider_conv);
35195         }
35196         LDKUserConfig config_conv;
35197         config_conv.inner = untag_ptr(config);
35198         config_conv.is_owned = ptr_is_owned(config);
35199         CHECK_INNER_FIELD_ACCESS_OR_NULL(config_conv);
35200         config_conv = UserConfig_clone(&config_conv);
35201         LDKChainParameters params_conv;
35202         params_conv.inner = untag_ptr(params);
35203         params_conv.is_owned = ptr_is_owned(params);
35204         CHECK_INNER_FIELD_ACCESS_OR_NULL(params_conv);
35205         params_conv = ChainParameters_clone(&params_conv);
35206         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, current_timestamp);
35207         uint64_t ret_ref = 0;
35208         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
35209         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
35210         return ret_ref;
35211 }
35212
35213 uint64_t  __attribute__((export_name("TS_ChannelManager_get_current_default_configuration"))) TS_ChannelManager_get_current_default_configuration(uint64_t this_arg) {
35214         LDKChannelManager this_arg_conv;
35215         this_arg_conv.inner = untag_ptr(this_arg);
35216         this_arg_conv.is_owned = ptr_is_owned(this_arg);
35217         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
35218         this_arg_conv.is_owned = false;
35219         LDKUserConfig ret_var = ChannelManager_get_current_default_configuration(&this_arg_conv);
35220         uint64_t ret_ref = 0;
35221         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
35222         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
35223         return ret_ref;
35224 }
35225
35226 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) {
35227         LDKChannelManager this_arg_conv;
35228         this_arg_conv.inner = untag_ptr(this_arg);
35229         this_arg_conv.is_owned = ptr_is_owned(this_arg);
35230         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
35231         this_arg_conv.is_owned = false;
35232         LDKPublicKey their_network_key_ref;
35233         CHECK(their_network_key->arr_len == 33);
35234         memcpy(their_network_key_ref.compressed_form, their_network_key->elems, 33); FREE(their_network_key);
35235         LDKU128 user_channel_id_ref;
35236         CHECK(user_channel_id->arr_len == 16);
35237         memcpy(user_channel_id_ref.le_bytes, user_channel_id->elems, 16); FREE(user_channel_id);
35238         LDKUserConfig override_config_conv;
35239         override_config_conv.inner = untag_ptr(override_config);
35240         override_config_conv.is_owned = ptr_is_owned(override_config);
35241         CHECK_INNER_FIELD_ACCESS_OR_NULL(override_config_conv);
35242         override_config_conv = UserConfig_clone(&override_config_conv);
35243         LDKCResult_ThirtyTwoBytesAPIErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ThirtyTwoBytesAPIErrorZ), "LDKCResult_ThirtyTwoBytesAPIErrorZ");
35244         *ret_conv = ChannelManager_create_channel(&this_arg_conv, their_network_key_ref, channel_value_satoshis, push_msat, user_channel_id_ref, override_config_conv);
35245         return tag_ptr(ret_conv, true);
35246 }
35247
35248 uint64_tArray  __attribute__((export_name("TS_ChannelManager_list_channels"))) TS_ChannelManager_list_channels(uint64_t this_arg) {
35249         LDKChannelManager this_arg_conv;
35250         this_arg_conv.inner = untag_ptr(this_arg);
35251         this_arg_conv.is_owned = ptr_is_owned(this_arg);
35252         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
35253         this_arg_conv.is_owned = false;
35254         LDKCVec_ChannelDetailsZ ret_var = ChannelManager_list_channels(&this_arg_conv);
35255         uint64_tArray ret_arr = NULL;
35256         ret_arr = init_uint64_tArray(ret_var.datalen, __LINE__);
35257         uint64_t *ret_arr_ptr = (uint64_t*)(((uint8_t*)ret_arr) + 8);
35258         for (size_t q = 0; q < ret_var.datalen; q++) {
35259                 LDKChannelDetails ret_conv_16_var = ret_var.data[q];
35260                 uint64_t ret_conv_16_ref = 0;
35261                 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_conv_16_var);
35262                 ret_conv_16_ref = tag_ptr(ret_conv_16_var.inner, ret_conv_16_var.is_owned);
35263                 ret_arr_ptr[q] = ret_conv_16_ref;
35264         }
35265         
35266         FREE(ret_var.data);
35267         return ret_arr;
35268 }
35269
35270 uint64_tArray  __attribute__((export_name("TS_ChannelManager_list_usable_channels"))) TS_ChannelManager_list_usable_channels(uint64_t this_arg) {
35271         LDKChannelManager this_arg_conv;
35272         this_arg_conv.inner = untag_ptr(this_arg);
35273         this_arg_conv.is_owned = ptr_is_owned(this_arg);
35274         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
35275         this_arg_conv.is_owned = false;
35276         LDKCVec_ChannelDetailsZ ret_var = ChannelManager_list_usable_channels(&this_arg_conv);
35277         uint64_tArray ret_arr = NULL;
35278         ret_arr = init_uint64_tArray(ret_var.datalen, __LINE__);
35279         uint64_t *ret_arr_ptr = (uint64_t*)(((uint8_t*)ret_arr) + 8);
35280         for (size_t q = 0; q < ret_var.datalen; q++) {
35281                 LDKChannelDetails ret_conv_16_var = ret_var.data[q];
35282                 uint64_t ret_conv_16_ref = 0;
35283                 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_conv_16_var);
35284                 ret_conv_16_ref = tag_ptr(ret_conv_16_var.inner, ret_conv_16_var.is_owned);
35285                 ret_arr_ptr[q] = ret_conv_16_ref;
35286         }
35287         
35288         FREE(ret_var.data);
35289         return ret_arr;
35290 }
35291
35292 uint64_tArray  __attribute__((export_name("TS_ChannelManager_list_channels_with_counterparty"))) TS_ChannelManager_list_channels_with_counterparty(uint64_t this_arg, int8_tArray counterparty_node_id) {
35293         LDKChannelManager this_arg_conv;
35294         this_arg_conv.inner = untag_ptr(this_arg);
35295         this_arg_conv.is_owned = ptr_is_owned(this_arg);
35296         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
35297         this_arg_conv.is_owned = false;
35298         LDKPublicKey counterparty_node_id_ref;
35299         CHECK(counterparty_node_id->arr_len == 33);
35300         memcpy(counterparty_node_id_ref.compressed_form, counterparty_node_id->elems, 33); FREE(counterparty_node_id);
35301         LDKCVec_ChannelDetailsZ ret_var = ChannelManager_list_channels_with_counterparty(&this_arg_conv, counterparty_node_id_ref);
35302         uint64_tArray ret_arr = NULL;
35303         ret_arr = init_uint64_tArray(ret_var.datalen, __LINE__);
35304         uint64_t *ret_arr_ptr = (uint64_t*)(((uint8_t*)ret_arr) + 8);
35305         for (size_t q = 0; q < ret_var.datalen; q++) {
35306                 LDKChannelDetails ret_conv_16_var = ret_var.data[q];
35307                 uint64_t ret_conv_16_ref = 0;
35308                 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_conv_16_var);
35309                 ret_conv_16_ref = tag_ptr(ret_conv_16_var.inner, ret_conv_16_var.is_owned);
35310                 ret_arr_ptr[q] = ret_conv_16_ref;
35311         }
35312         
35313         FREE(ret_var.data);
35314         return ret_arr;
35315 }
35316
35317 uint64_tArray  __attribute__((export_name("TS_ChannelManager_list_recent_payments"))) TS_ChannelManager_list_recent_payments(uint64_t this_arg) {
35318         LDKChannelManager this_arg_conv;
35319         this_arg_conv.inner = untag_ptr(this_arg);
35320         this_arg_conv.is_owned = ptr_is_owned(this_arg);
35321         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
35322         this_arg_conv.is_owned = false;
35323         LDKCVec_RecentPaymentDetailsZ ret_var = ChannelManager_list_recent_payments(&this_arg_conv);
35324         uint64_tArray ret_arr = NULL;
35325         ret_arr = init_uint64_tArray(ret_var.datalen, __LINE__);
35326         uint64_t *ret_arr_ptr = (uint64_t*)(((uint8_t*)ret_arr) + 8);
35327         for (size_t w = 0; w < ret_var.datalen; w++) {
35328                 LDKRecentPaymentDetails *ret_conv_22_copy = MALLOC(sizeof(LDKRecentPaymentDetails), "LDKRecentPaymentDetails");
35329                 *ret_conv_22_copy = ret_var.data[w];
35330                 uint64_t ret_conv_22_ref = tag_ptr(ret_conv_22_copy, true);
35331                 ret_arr_ptr[w] = ret_conv_22_ref;
35332         }
35333         
35334         FREE(ret_var.data);
35335         return ret_arr;
35336 }
35337
35338 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) {
35339         LDKChannelManager this_arg_conv;
35340         this_arg_conv.inner = untag_ptr(this_arg);
35341         this_arg_conv.is_owned = ptr_is_owned(this_arg);
35342         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
35343         this_arg_conv.is_owned = false;
35344         uint8_t channel_id_arr[32];
35345         CHECK(channel_id->arr_len == 32);
35346         memcpy(channel_id_arr, channel_id->elems, 32); FREE(channel_id);
35347         uint8_t (*channel_id_ref)[32] = &channel_id_arr;
35348         LDKPublicKey counterparty_node_id_ref;
35349         CHECK(counterparty_node_id->arr_len == 33);
35350         memcpy(counterparty_node_id_ref.compressed_form, counterparty_node_id->elems, 33); FREE(counterparty_node_id);
35351         LDKCResult_NoneAPIErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneAPIErrorZ), "LDKCResult_NoneAPIErrorZ");
35352         *ret_conv = ChannelManager_close_channel(&this_arg_conv, channel_id_ref, counterparty_node_id_ref);
35353         return tag_ptr(ret_conv, true);
35354 }
35355
35356 uint64_t  __attribute__((export_name("TS_ChannelManager_close_channel_with_feerate_and_script"))) TS_ChannelManager_close_channel_with_feerate_and_script(uint64_t this_arg, int8_tArray channel_id, int8_tArray counterparty_node_id, uint64_t target_feerate_sats_per_1000_weight, uint64_t shutdown_script) {
35357         LDKChannelManager this_arg_conv;
35358         this_arg_conv.inner = untag_ptr(this_arg);
35359         this_arg_conv.is_owned = ptr_is_owned(this_arg);
35360         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
35361         this_arg_conv.is_owned = false;
35362         uint8_t channel_id_arr[32];
35363         CHECK(channel_id->arr_len == 32);
35364         memcpy(channel_id_arr, channel_id->elems, 32); FREE(channel_id);
35365         uint8_t (*channel_id_ref)[32] = &channel_id_arr;
35366         LDKPublicKey counterparty_node_id_ref;
35367         CHECK(counterparty_node_id->arr_len == 33);
35368         memcpy(counterparty_node_id_ref.compressed_form, counterparty_node_id->elems, 33); FREE(counterparty_node_id);
35369         void* target_feerate_sats_per_1000_weight_ptr = untag_ptr(target_feerate_sats_per_1000_weight);
35370         CHECK_ACCESS(target_feerate_sats_per_1000_weight_ptr);
35371         LDKCOption_u32Z target_feerate_sats_per_1000_weight_conv = *(LDKCOption_u32Z*)(target_feerate_sats_per_1000_weight_ptr);
35372         target_feerate_sats_per_1000_weight_conv = COption_u32Z_clone((LDKCOption_u32Z*)untag_ptr(target_feerate_sats_per_1000_weight));
35373         LDKShutdownScript shutdown_script_conv;
35374         shutdown_script_conv.inner = untag_ptr(shutdown_script);
35375         shutdown_script_conv.is_owned = ptr_is_owned(shutdown_script);
35376         CHECK_INNER_FIELD_ACCESS_OR_NULL(shutdown_script_conv);
35377         shutdown_script_conv = ShutdownScript_clone(&shutdown_script_conv);
35378         LDKCResult_NoneAPIErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneAPIErrorZ), "LDKCResult_NoneAPIErrorZ");
35379         *ret_conv = ChannelManager_close_channel_with_feerate_and_script(&this_arg_conv, channel_id_ref, counterparty_node_id_ref, target_feerate_sats_per_1000_weight_conv, shutdown_script_conv);
35380         return tag_ptr(ret_conv, true);
35381 }
35382
35383 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) {
35384         LDKChannelManager this_arg_conv;
35385         this_arg_conv.inner = untag_ptr(this_arg);
35386         this_arg_conv.is_owned = ptr_is_owned(this_arg);
35387         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
35388         this_arg_conv.is_owned = false;
35389         uint8_t channel_id_arr[32];
35390         CHECK(channel_id->arr_len == 32);
35391         memcpy(channel_id_arr, channel_id->elems, 32); FREE(channel_id);
35392         uint8_t (*channel_id_ref)[32] = &channel_id_arr;
35393         LDKPublicKey counterparty_node_id_ref;
35394         CHECK(counterparty_node_id->arr_len == 33);
35395         memcpy(counterparty_node_id_ref.compressed_form, counterparty_node_id->elems, 33); FREE(counterparty_node_id);
35396         LDKCResult_NoneAPIErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneAPIErrorZ), "LDKCResult_NoneAPIErrorZ");
35397         *ret_conv = ChannelManager_force_close_broadcasting_latest_txn(&this_arg_conv, channel_id_ref, counterparty_node_id_ref);
35398         return tag_ptr(ret_conv, true);
35399 }
35400
35401 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) {
35402         LDKChannelManager this_arg_conv;
35403         this_arg_conv.inner = untag_ptr(this_arg);
35404         this_arg_conv.is_owned = ptr_is_owned(this_arg);
35405         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
35406         this_arg_conv.is_owned = false;
35407         uint8_t channel_id_arr[32];
35408         CHECK(channel_id->arr_len == 32);
35409         memcpy(channel_id_arr, channel_id->elems, 32); FREE(channel_id);
35410         uint8_t (*channel_id_ref)[32] = &channel_id_arr;
35411         LDKPublicKey counterparty_node_id_ref;
35412         CHECK(counterparty_node_id->arr_len == 33);
35413         memcpy(counterparty_node_id_ref.compressed_form, counterparty_node_id->elems, 33); FREE(counterparty_node_id);
35414         LDKCResult_NoneAPIErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneAPIErrorZ), "LDKCResult_NoneAPIErrorZ");
35415         *ret_conv = ChannelManager_force_close_without_broadcasting_txn(&this_arg_conv, channel_id_ref, counterparty_node_id_ref);
35416         return tag_ptr(ret_conv, true);
35417 }
35418
35419 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) {
35420         LDKChannelManager this_arg_conv;
35421         this_arg_conv.inner = untag_ptr(this_arg);
35422         this_arg_conv.is_owned = ptr_is_owned(this_arg);
35423         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
35424         this_arg_conv.is_owned = false;
35425         ChannelManager_force_close_all_channels_broadcasting_latest_txn(&this_arg_conv);
35426 }
35427
35428 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) {
35429         LDKChannelManager this_arg_conv;
35430         this_arg_conv.inner = untag_ptr(this_arg);
35431         this_arg_conv.is_owned = ptr_is_owned(this_arg);
35432         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
35433         this_arg_conv.is_owned = false;
35434         ChannelManager_force_close_all_channels_without_broadcasting_txn(&this_arg_conv);
35435 }
35436
35437 uint64_t  __attribute__((export_name("TS_ChannelManager_send_payment_with_route"))) TS_ChannelManager_send_payment_with_route(uint64_t this_arg, uint64_t route, int8_tArray payment_hash, uint64_t recipient_onion, int8_tArray payment_id) {
35438         LDKChannelManager this_arg_conv;
35439         this_arg_conv.inner = untag_ptr(this_arg);
35440         this_arg_conv.is_owned = ptr_is_owned(this_arg);
35441         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
35442         this_arg_conv.is_owned = false;
35443         LDKRoute route_conv;
35444         route_conv.inner = untag_ptr(route);
35445         route_conv.is_owned = ptr_is_owned(route);
35446         CHECK_INNER_FIELD_ACCESS_OR_NULL(route_conv);
35447         route_conv.is_owned = false;
35448         LDKThirtyTwoBytes payment_hash_ref;
35449         CHECK(payment_hash->arr_len == 32);
35450         memcpy(payment_hash_ref.data, payment_hash->elems, 32); FREE(payment_hash);
35451         LDKRecipientOnionFields recipient_onion_conv;
35452         recipient_onion_conv.inner = untag_ptr(recipient_onion);
35453         recipient_onion_conv.is_owned = ptr_is_owned(recipient_onion);
35454         CHECK_INNER_FIELD_ACCESS_OR_NULL(recipient_onion_conv);
35455         recipient_onion_conv = RecipientOnionFields_clone(&recipient_onion_conv);
35456         LDKThirtyTwoBytes payment_id_ref;
35457         CHECK(payment_id->arr_len == 32);
35458         memcpy(payment_id_ref.data, payment_id->elems, 32); FREE(payment_id);
35459         LDKCResult_NonePaymentSendFailureZ* ret_conv = MALLOC(sizeof(LDKCResult_NonePaymentSendFailureZ), "LDKCResult_NonePaymentSendFailureZ");
35460         *ret_conv = ChannelManager_send_payment_with_route(&this_arg_conv, &route_conv, payment_hash_ref, recipient_onion_conv, payment_id_ref);
35461         return tag_ptr(ret_conv, true);
35462 }
35463
35464 uint64_t  __attribute__((export_name("TS_ChannelManager_send_payment"))) TS_ChannelManager_send_payment(uint64_t this_arg, int8_tArray payment_hash, uint64_t recipient_onion, int8_tArray payment_id, uint64_t route_params, uint64_t retry_strategy) {
35465         LDKChannelManager this_arg_conv;
35466         this_arg_conv.inner = untag_ptr(this_arg);
35467         this_arg_conv.is_owned = ptr_is_owned(this_arg);
35468         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
35469         this_arg_conv.is_owned = false;
35470         LDKThirtyTwoBytes payment_hash_ref;
35471         CHECK(payment_hash->arr_len == 32);
35472         memcpy(payment_hash_ref.data, payment_hash->elems, 32); FREE(payment_hash);
35473         LDKRecipientOnionFields recipient_onion_conv;
35474         recipient_onion_conv.inner = untag_ptr(recipient_onion);
35475         recipient_onion_conv.is_owned = ptr_is_owned(recipient_onion);
35476         CHECK_INNER_FIELD_ACCESS_OR_NULL(recipient_onion_conv);
35477         recipient_onion_conv = RecipientOnionFields_clone(&recipient_onion_conv);
35478         LDKThirtyTwoBytes payment_id_ref;
35479         CHECK(payment_id->arr_len == 32);
35480         memcpy(payment_id_ref.data, payment_id->elems, 32); FREE(payment_id);
35481         LDKRouteParameters route_params_conv;
35482         route_params_conv.inner = untag_ptr(route_params);
35483         route_params_conv.is_owned = ptr_is_owned(route_params);
35484         CHECK_INNER_FIELD_ACCESS_OR_NULL(route_params_conv);
35485         route_params_conv = RouteParameters_clone(&route_params_conv);
35486         void* retry_strategy_ptr = untag_ptr(retry_strategy);
35487         CHECK_ACCESS(retry_strategy_ptr);
35488         LDKRetry retry_strategy_conv = *(LDKRetry*)(retry_strategy_ptr);
35489         retry_strategy_conv = Retry_clone((LDKRetry*)untag_ptr(retry_strategy));
35490         LDKCResult_NoneRetryableSendFailureZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneRetryableSendFailureZ), "LDKCResult_NoneRetryableSendFailureZ");
35491         *ret_conv = ChannelManager_send_payment(&this_arg_conv, payment_hash_ref, recipient_onion_conv, payment_id_ref, route_params_conv, retry_strategy_conv);
35492         return tag_ptr(ret_conv, true);
35493 }
35494
35495 void  __attribute__((export_name("TS_ChannelManager_abandon_payment"))) TS_ChannelManager_abandon_payment(uint64_t this_arg, int8_tArray payment_id) {
35496         LDKChannelManager this_arg_conv;
35497         this_arg_conv.inner = untag_ptr(this_arg);
35498         this_arg_conv.is_owned = ptr_is_owned(this_arg);
35499         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
35500         this_arg_conv.is_owned = false;
35501         LDKThirtyTwoBytes payment_id_ref;
35502         CHECK(payment_id->arr_len == 32);
35503         memcpy(payment_id_ref.data, payment_id->elems, 32); FREE(payment_id);
35504         ChannelManager_abandon_payment(&this_arg_conv, payment_id_ref);
35505 }
35506
35507 uint64_t  __attribute__((export_name("TS_ChannelManager_send_spontaneous_payment"))) TS_ChannelManager_send_spontaneous_payment(uint64_t this_arg, uint64_t route, uint64_t payment_preimage, uint64_t recipient_onion, int8_tArray payment_id) {
35508         LDKChannelManager this_arg_conv;
35509         this_arg_conv.inner = untag_ptr(this_arg);
35510         this_arg_conv.is_owned = ptr_is_owned(this_arg);
35511         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
35512         this_arg_conv.is_owned = false;
35513         LDKRoute route_conv;
35514         route_conv.inner = untag_ptr(route);
35515         route_conv.is_owned = ptr_is_owned(route);
35516         CHECK_INNER_FIELD_ACCESS_OR_NULL(route_conv);
35517         route_conv.is_owned = false;
35518         void* payment_preimage_ptr = untag_ptr(payment_preimage);
35519         CHECK_ACCESS(payment_preimage_ptr);
35520         LDKCOption_ThirtyTwoBytesZ payment_preimage_conv = *(LDKCOption_ThirtyTwoBytesZ*)(payment_preimage_ptr);
35521         payment_preimage_conv = COption_ThirtyTwoBytesZ_clone((LDKCOption_ThirtyTwoBytesZ*)untag_ptr(payment_preimage));
35522         LDKRecipientOnionFields recipient_onion_conv;
35523         recipient_onion_conv.inner = untag_ptr(recipient_onion);
35524         recipient_onion_conv.is_owned = ptr_is_owned(recipient_onion);
35525         CHECK_INNER_FIELD_ACCESS_OR_NULL(recipient_onion_conv);
35526         recipient_onion_conv = RecipientOnionFields_clone(&recipient_onion_conv);
35527         LDKThirtyTwoBytes payment_id_ref;
35528         CHECK(payment_id->arr_len == 32);
35529         memcpy(payment_id_ref.data, payment_id->elems, 32); FREE(payment_id);
35530         LDKCResult_ThirtyTwoBytesPaymentSendFailureZ* ret_conv = MALLOC(sizeof(LDKCResult_ThirtyTwoBytesPaymentSendFailureZ), "LDKCResult_ThirtyTwoBytesPaymentSendFailureZ");
35531         *ret_conv = ChannelManager_send_spontaneous_payment(&this_arg_conv, &route_conv, payment_preimage_conv, recipient_onion_conv, payment_id_ref);
35532         return tag_ptr(ret_conv, true);
35533 }
35534
35535 uint64_t  __attribute__((export_name("TS_ChannelManager_send_spontaneous_payment_with_retry"))) TS_ChannelManager_send_spontaneous_payment_with_retry(uint64_t this_arg, uint64_t payment_preimage, uint64_t recipient_onion, int8_tArray payment_id, uint64_t route_params, uint64_t retry_strategy) {
35536         LDKChannelManager this_arg_conv;
35537         this_arg_conv.inner = untag_ptr(this_arg);
35538         this_arg_conv.is_owned = ptr_is_owned(this_arg);
35539         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
35540         this_arg_conv.is_owned = false;
35541         void* payment_preimage_ptr = untag_ptr(payment_preimage);
35542         CHECK_ACCESS(payment_preimage_ptr);
35543         LDKCOption_ThirtyTwoBytesZ payment_preimage_conv = *(LDKCOption_ThirtyTwoBytesZ*)(payment_preimage_ptr);
35544         payment_preimage_conv = COption_ThirtyTwoBytesZ_clone((LDKCOption_ThirtyTwoBytesZ*)untag_ptr(payment_preimage));
35545         LDKRecipientOnionFields recipient_onion_conv;
35546         recipient_onion_conv.inner = untag_ptr(recipient_onion);
35547         recipient_onion_conv.is_owned = ptr_is_owned(recipient_onion);
35548         CHECK_INNER_FIELD_ACCESS_OR_NULL(recipient_onion_conv);
35549         recipient_onion_conv = RecipientOnionFields_clone(&recipient_onion_conv);
35550         LDKThirtyTwoBytes payment_id_ref;
35551         CHECK(payment_id->arr_len == 32);
35552         memcpy(payment_id_ref.data, payment_id->elems, 32); FREE(payment_id);
35553         LDKRouteParameters route_params_conv;
35554         route_params_conv.inner = untag_ptr(route_params);
35555         route_params_conv.is_owned = ptr_is_owned(route_params);
35556         CHECK_INNER_FIELD_ACCESS_OR_NULL(route_params_conv);
35557         route_params_conv = RouteParameters_clone(&route_params_conv);
35558         void* retry_strategy_ptr = untag_ptr(retry_strategy);
35559         CHECK_ACCESS(retry_strategy_ptr);
35560         LDKRetry retry_strategy_conv = *(LDKRetry*)(retry_strategy_ptr);
35561         retry_strategy_conv = Retry_clone((LDKRetry*)untag_ptr(retry_strategy));
35562         LDKCResult_ThirtyTwoBytesRetryableSendFailureZ* ret_conv = MALLOC(sizeof(LDKCResult_ThirtyTwoBytesRetryableSendFailureZ), "LDKCResult_ThirtyTwoBytesRetryableSendFailureZ");
35563         *ret_conv = ChannelManager_send_spontaneous_payment_with_retry(&this_arg_conv, payment_preimage_conv, recipient_onion_conv, payment_id_ref, route_params_conv, retry_strategy_conv);
35564         return tag_ptr(ret_conv, true);
35565 }
35566
35567 uint64_t  __attribute__((export_name("TS_ChannelManager_send_probe"))) TS_ChannelManager_send_probe(uint64_t this_arg, uint64_t path) {
35568         LDKChannelManager this_arg_conv;
35569         this_arg_conv.inner = untag_ptr(this_arg);
35570         this_arg_conv.is_owned = ptr_is_owned(this_arg);
35571         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
35572         this_arg_conv.is_owned = false;
35573         LDKPath path_conv;
35574         path_conv.inner = untag_ptr(path);
35575         path_conv.is_owned = ptr_is_owned(path);
35576         CHECK_INNER_FIELD_ACCESS_OR_NULL(path_conv);
35577         path_conv = Path_clone(&path_conv);
35578         LDKCResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZPaymentSendFailureZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZPaymentSendFailureZ), "LDKCResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZPaymentSendFailureZ");
35579         *ret_conv = ChannelManager_send_probe(&this_arg_conv, path_conv);
35580         return tag_ptr(ret_conv, true);
35581 }
35582
35583 uint64_t  __attribute__((export_name("TS_ChannelManager_send_spontaneous_preflight_probes"))) TS_ChannelManager_send_spontaneous_preflight_probes(uint64_t this_arg, int8_tArray node_id, int64_t amount_msat, int32_t final_cltv_expiry_delta, uint64_t liquidity_limit_multiplier) {
35584         LDKChannelManager this_arg_conv;
35585         this_arg_conv.inner = untag_ptr(this_arg);
35586         this_arg_conv.is_owned = ptr_is_owned(this_arg);
35587         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
35588         this_arg_conv.is_owned = false;
35589         LDKPublicKey node_id_ref;
35590         CHECK(node_id->arr_len == 33);
35591         memcpy(node_id_ref.compressed_form, node_id->elems, 33); FREE(node_id);
35592         void* liquidity_limit_multiplier_ptr = untag_ptr(liquidity_limit_multiplier);
35593         CHECK_ACCESS(liquidity_limit_multiplier_ptr);
35594         LDKCOption_u64Z liquidity_limit_multiplier_conv = *(LDKCOption_u64Z*)(liquidity_limit_multiplier_ptr);
35595         liquidity_limit_multiplier_conv = COption_u64Z_clone((LDKCOption_u64Z*)untag_ptr(liquidity_limit_multiplier));
35596         LDKCResult_CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZProbeSendFailureZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZProbeSendFailureZ), "LDKCResult_CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZProbeSendFailureZ");
35597         *ret_conv = ChannelManager_send_spontaneous_preflight_probes(&this_arg_conv, node_id_ref, amount_msat, final_cltv_expiry_delta, liquidity_limit_multiplier_conv);
35598         return tag_ptr(ret_conv, true);
35599 }
35600
35601 uint64_t  __attribute__((export_name("TS_ChannelManager_send_preflight_probes"))) TS_ChannelManager_send_preflight_probes(uint64_t this_arg, uint64_t route_params, uint64_t liquidity_limit_multiplier) {
35602         LDKChannelManager this_arg_conv;
35603         this_arg_conv.inner = untag_ptr(this_arg);
35604         this_arg_conv.is_owned = ptr_is_owned(this_arg);
35605         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
35606         this_arg_conv.is_owned = false;
35607         LDKRouteParameters route_params_conv;
35608         route_params_conv.inner = untag_ptr(route_params);
35609         route_params_conv.is_owned = ptr_is_owned(route_params);
35610         CHECK_INNER_FIELD_ACCESS_OR_NULL(route_params_conv);
35611         route_params_conv = RouteParameters_clone(&route_params_conv);
35612         void* liquidity_limit_multiplier_ptr = untag_ptr(liquidity_limit_multiplier);
35613         CHECK_ACCESS(liquidity_limit_multiplier_ptr);
35614         LDKCOption_u64Z liquidity_limit_multiplier_conv = *(LDKCOption_u64Z*)(liquidity_limit_multiplier_ptr);
35615         liquidity_limit_multiplier_conv = COption_u64Z_clone((LDKCOption_u64Z*)untag_ptr(liquidity_limit_multiplier));
35616         LDKCResult_CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZProbeSendFailureZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZProbeSendFailureZ), "LDKCResult_CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZProbeSendFailureZ");
35617         *ret_conv = ChannelManager_send_preflight_probes(&this_arg_conv, route_params_conv, liquidity_limit_multiplier_conv);
35618         return tag_ptr(ret_conv, true);
35619 }
35620
35621 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) {
35622         LDKChannelManager this_arg_conv;
35623         this_arg_conv.inner = untag_ptr(this_arg);
35624         this_arg_conv.is_owned = ptr_is_owned(this_arg);
35625         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
35626         this_arg_conv.is_owned = false;
35627         uint8_t temporary_channel_id_arr[32];
35628         CHECK(temporary_channel_id->arr_len == 32);
35629         memcpy(temporary_channel_id_arr, temporary_channel_id->elems, 32); FREE(temporary_channel_id);
35630         uint8_t (*temporary_channel_id_ref)[32] = &temporary_channel_id_arr;
35631         LDKPublicKey counterparty_node_id_ref;
35632         CHECK(counterparty_node_id->arr_len == 33);
35633         memcpy(counterparty_node_id_ref.compressed_form, counterparty_node_id->elems, 33); FREE(counterparty_node_id);
35634         LDKTransaction funding_transaction_ref;
35635         funding_transaction_ref.datalen = funding_transaction->arr_len;
35636         funding_transaction_ref.data = MALLOC(funding_transaction_ref.datalen, "LDKTransaction Bytes");
35637         memcpy(funding_transaction_ref.data, funding_transaction->elems, funding_transaction_ref.datalen); FREE(funding_transaction);
35638         funding_transaction_ref.data_is_owned = true;
35639         LDKCResult_NoneAPIErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneAPIErrorZ), "LDKCResult_NoneAPIErrorZ");
35640         *ret_conv = ChannelManager_funding_transaction_generated(&this_arg_conv, temporary_channel_id_ref, counterparty_node_id_ref, funding_transaction_ref);
35641         return tag_ptr(ret_conv, true);
35642 }
35643
35644 uint64_t  __attribute__((export_name("TS_ChannelManager_batch_funding_transaction_generated"))) TS_ChannelManager_batch_funding_transaction_generated(uint64_t this_arg, uint64_tArray temporary_channels, int8_tArray funding_transaction) {
35645         LDKChannelManager this_arg_conv;
35646         this_arg_conv.inner = untag_ptr(this_arg);
35647         this_arg_conv.is_owned = ptr_is_owned(this_arg);
35648         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
35649         this_arg_conv.is_owned = false;
35650         LDKCVec_C2Tuple_ThirtyTwoBytesPublicKeyZZ temporary_channels_constr;
35651         temporary_channels_constr.datalen = temporary_channels->arr_len;
35652         if (temporary_channels_constr.datalen > 0)
35653                 temporary_channels_constr.data = MALLOC(temporary_channels_constr.datalen * sizeof(LDKC2Tuple_ThirtyTwoBytesPublicKeyZ), "LDKCVec_C2Tuple_ThirtyTwoBytesPublicKeyZZ Elements");
35654         else
35655                 temporary_channels_constr.data = NULL;
35656         uint64_t* temporary_channels_vals = temporary_channels->elems;
35657         for (size_t j = 0; j < temporary_channels_constr.datalen; j++) {
35658                 uint64_t temporary_channels_conv_35 = temporary_channels_vals[j];
35659                 void* temporary_channels_conv_35_ptr = untag_ptr(temporary_channels_conv_35);
35660                 CHECK_ACCESS(temporary_channels_conv_35_ptr);
35661                 LDKC2Tuple_ThirtyTwoBytesPublicKeyZ temporary_channels_conv_35_conv = *(LDKC2Tuple_ThirtyTwoBytesPublicKeyZ*)(temporary_channels_conv_35_ptr);
35662                 temporary_channels_conv_35_conv = C2Tuple_ThirtyTwoBytesPublicKeyZ_clone((LDKC2Tuple_ThirtyTwoBytesPublicKeyZ*)untag_ptr(temporary_channels_conv_35));
35663                 temporary_channels_constr.data[j] = temporary_channels_conv_35_conv;
35664         }
35665         FREE(temporary_channels);
35666         LDKTransaction funding_transaction_ref;
35667         funding_transaction_ref.datalen = funding_transaction->arr_len;
35668         funding_transaction_ref.data = MALLOC(funding_transaction_ref.datalen, "LDKTransaction Bytes");
35669         memcpy(funding_transaction_ref.data, funding_transaction->elems, funding_transaction_ref.datalen); FREE(funding_transaction);
35670         funding_transaction_ref.data_is_owned = true;
35671         LDKCResult_NoneAPIErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneAPIErrorZ), "LDKCResult_NoneAPIErrorZ");
35672         *ret_conv = ChannelManager_batch_funding_transaction_generated(&this_arg_conv, temporary_channels_constr, funding_transaction_ref);
35673         return tag_ptr(ret_conv, true);
35674 }
35675
35676 uint64_t  __attribute__((export_name("TS_ChannelManager_update_partial_channel_config"))) TS_ChannelManager_update_partial_channel_config(uint64_t this_arg, int8_tArray counterparty_node_id, ptrArray channel_ids, uint64_t config_update) {
35677         LDKChannelManager this_arg_conv;
35678         this_arg_conv.inner = untag_ptr(this_arg);
35679         this_arg_conv.is_owned = ptr_is_owned(this_arg);
35680         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
35681         this_arg_conv.is_owned = false;
35682         LDKPublicKey counterparty_node_id_ref;
35683         CHECK(counterparty_node_id->arr_len == 33);
35684         memcpy(counterparty_node_id_ref.compressed_form, counterparty_node_id->elems, 33); FREE(counterparty_node_id);
35685         LDKCVec_ThirtyTwoBytesZ channel_ids_constr;
35686         channel_ids_constr.datalen = channel_ids->arr_len;
35687         if (channel_ids_constr.datalen > 0)
35688                 channel_ids_constr.data = MALLOC(channel_ids_constr.datalen * sizeof(LDKThirtyTwoBytes), "LDKCVec_ThirtyTwoBytesZ Elements");
35689         else
35690                 channel_ids_constr.data = NULL;
35691         int8_tArray* channel_ids_vals = (void*) channel_ids->elems;
35692         for (size_t m = 0; m < channel_ids_constr.datalen; m++) {
35693                 int8_tArray channel_ids_conv_12 = channel_ids_vals[m];
35694                 LDKThirtyTwoBytes channel_ids_conv_12_ref;
35695                 CHECK(channel_ids_conv_12->arr_len == 32);
35696                 memcpy(channel_ids_conv_12_ref.data, channel_ids_conv_12->elems, 32); FREE(channel_ids_conv_12);
35697                 channel_ids_constr.data[m] = channel_ids_conv_12_ref;
35698         }
35699         FREE(channel_ids);
35700         LDKChannelConfigUpdate config_update_conv;
35701         config_update_conv.inner = untag_ptr(config_update);
35702         config_update_conv.is_owned = ptr_is_owned(config_update);
35703         CHECK_INNER_FIELD_ACCESS_OR_NULL(config_update_conv);
35704         config_update_conv.is_owned = false;
35705         LDKCResult_NoneAPIErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneAPIErrorZ), "LDKCResult_NoneAPIErrorZ");
35706         *ret_conv = ChannelManager_update_partial_channel_config(&this_arg_conv, counterparty_node_id_ref, channel_ids_constr, &config_update_conv);
35707         return tag_ptr(ret_conv, true);
35708 }
35709
35710 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) {
35711         LDKChannelManager this_arg_conv;
35712         this_arg_conv.inner = untag_ptr(this_arg);
35713         this_arg_conv.is_owned = ptr_is_owned(this_arg);
35714         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
35715         this_arg_conv.is_owned = false;
35716         LDKPublicKey counterparty_node_id_ref;
35717         CHECK(counterparty_node_id->arr_len == 33);
35718         memcpy(counterparty_node_id_ref.compressed_form, counterparty_node_id->elems, 33); FREE(counterparty_node_id);
35719         LDKCVec_ThirtyTwoBytesZ channel_ids_constr;
35720         channel_ids_constr.datalen = channel_ids->arr_len;
35721         if (channel_ids_constr.datalen > 0)
35722                 channel_ids_constr.data = MALLOC(channel_ids_constr.datalen * sizeof(LDKThirtyTwoBytes), "LDKCVec_ThirtyTwoBytesZ Elements");
35723         else
35724                 channel_ids_constr.data = NULL;
35725         int8_tArray* channel_ids_vals = (void*) channel_ids->elems;
35726         for (size_t m = 0; m < channel_ids_constr.datalen; m++) {
35727                 int8_tArray channel_ids_conv_12 = channel_ids_vals[m];
35728                 LDKThirtyTwoBytes channel_ids_conv_12_ref;
35729                 CHECK(channel_ids_conv_12->arr_len == 32);
35730                 memcpy(channel_ids_conv_12_ref.data, channel_ids_conv_12->elems, 32); FREE(channel_ids_conv_12);
35731                 channel_ids_constr.data[m] = channel_ids_conv_12_ref;
35732         }
35733         FREE(channel_ids);
35734         LDKChannelConfig config_conv;
35735         config_conv.inner = untag_ptr(config);
35736         config_conv.is_owned = ptr_is_owned(config);
35737         CHECK_INNER_FIELD_ACCESS_OR_NULL(config_conv);
35738         config_conv.is_owned = false;
35739         LDKCResult_NoneAPIErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneAPIErrorZ), "LDKCResult_NoneAPIErrorZ");
35740         *ret_conv = ChannelManager_update_channel_config(&this_arg_conv, counterparty_node_id_ref, channel_ids_constr, &config_conv);
35741         return tag_ptr(ret_conv, true);
35742 }
35743
35744 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) {
35745         LDKChannelManager this_arg_conv;
35746         this_arg_conv.inner = untag_ptr(this_arg);
35747         this_arg_conv.is_owned = ptr_is_owned(this_arg);
35748         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
35749         this_arg_conv.is_owned = false;
35750         LDKThirtyTwoBytes intercept_id_ref;
35751         CHECK(intercept_id->arr_len == 32);
35752         memcpy(intercept_id_ref.data, intercept_id->elems, 32); FREE(intercept_id);
35753         uint8_t next_hop_channel_id_arr[32];
35754         CHECK(next_hop_channel_id->arr_len == 32);
35755         memcpy(next_hop_channel_id_arr, next_hop_channel_id->elems, 32); FREE(next_hop_channel_id);
35756         uint8_t (*next_hop_channel_id_ref)[32] = &next_hop_channel_id_arr;
35757         LDKPublicKey next_node_id_ref;
35758         CHECK(next_node_id->arr_len == 33);
35759         memcpy(next_node_id_ref.compressed_form, next_node_id->elems, 33); FREE(next_node_id);
35760         LDKCResult_NoneAPIErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneAPIErrorZ), "LDKCResult_NoneAPIErrorZ");
35761         *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);
35762         return tag_ptr(ret_conv, true);
35763 }
35764
35765 uint64_t  __attribute__((export_name("TS_ChannelManager_fail_intercepted_htlc"))) TS_ChannelManager_fail_intercepted_htlc(uint64_t this_arg, int8_tArray intercept_id) {
35766         LDKChannelManager this_arg_conv;
35767         this_arg_conv.inner = untag_ptr(this_arg);
35768         this_arg_conv.is_owned = ptr_is_owned(this_arg);
35769         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
35770         this_arg_conv.is_owned = false;
35771         LDKThirtyTwoBytes intercept_id_ref;
35772         CHECK(intercept_id->arr_len == 32);
35773         memcpy(intercept_id_ref.data, intercept_id->elems, 32); FREE(intercept_id);
35774         LDKCResult_NoneAPIErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneAPIErrorZ), "LDKCResult_NoneAPIErrorZ");
35775         *ret_conv = ChannelManager_fail_intercepted_htlc(&this_arg_conv, intercept_id_ref);
35776         return tag_ptr(ret_conv, true);
35777 }
35778
35779 void  __attribute__((export_name("TS_ChannelManager_process_pending_htlc_forwards"))) TS_ChannelManager_process_pending_htlc_forwards(uint64_t this_arg) {
35780         LDKChannelManager this_arg_conv;
35781         this_arg_conv.inner = untag_ptr(this_arg);
35782         this_arg_conv.is_owned = ptr_is_owned(this_arg);
35783         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
35784         this_arg_conv.is_owned = false;
35785         ChannelManager_process_pending_htlc_forwards(&this_arg_conv);
35786 }
35787
35788 void  __attribute__((export_name("TS_ChannelManager_timer_tick_occurred"))) TS_ChannelManager_timer_tick_occurred(uint64_t this_arg) {
35789         LDKChannelManager this_arg_conv;
35790         this_arg_conv.inner = untag_ptr(this_arg);
35791         this_arg_conv.is_owned = ptr_is_owned(this_arg);
35792         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
35793         this_arg_conv.is_owned = false;
35794         ChannelManager_timer_tick_occurred(&this_arg_conv);
35795 }
35796
35797 void  __attribute__((export_name("TS_ChannelManager_fail_htlc_backwards"))) TS_ChannelManager_fail_htlc_backwards(uint64_t this_arg, int8_tArray payment_hash) {
35798         LDKChannelManager this_arg_conv;
35799         this_arg_conv.inner = untag_ptr(this_arg);
35800         this_arg_conv.is_owned = ptr_is_owned(this_arg);
35801         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
35802         this_arg_conv.is_owned = false;
35803         uint8_t payment_hash_arr[32];
35804         CHECK(payment_hash->arr_len == 32);
35805         memcpy(payment_hash_arr, payment_hash->elems, 32); FREE(payment_hash);
35806         uint8_t (*payment_hash_ref)[32] = &payment_hash_arr;
35807         ChannelManager_fail_htlc_backwards(&this_arg_conv, payment_hash_ref);
35808 }
35809
35810 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, uint64_t failure_code) {
35811         LDKChannelManager this_arg_conv;
35812         this_arg_conv.inner = untag_ptr(this_arg);
35813         this_arg_conv.is_owned = ptr_is_owned(this_arg);
35814         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
35815         this_arg_conv.is_owned = false;
35816         uint8_t payment_hash_arr[32];
35817         CHECK(payment_hash->arr_len == 32);
35818         memcpy(payment_hash_arr, payment_hash->elems, 32); FREE(payment_hash);
35819         uint8_t (*payment_hash_ref)[32] = &payment_hash_arr;
35820         void* failure_code_ptr = untag_ptr(failure_code);
35821         CHECK_ACCESS(failure_code_ptr);
35822         LDKFailureCode failure_code_conv = *(LDKFailureCode*)(failure_code_ptr);
35823         failure_code_conv = FailureCode_clone((LDKFailureCode*)untag_ptr(failure_code));
35824         ChannelManager_fail_htlc_backwards_with_reason(&this_arg_conv, payment_hash_ref, failure_code_conv);
35825 }
35826
35827 void  __attribute__((export_name("TS_ChannelManager_claim_funds"))) TS_ChannelManager_claim_funds(uint64_t this_arg, int8_tArray payment_preimage) {
35828         LDKChannelManager this_arg_conv;
35829         this_arg_conv.inner = untag_ptr(this_arg);
35830         this_arg_conv.is_owned = ptr_is_owned(this_arg);
35831         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
35832         this_arg_conv.is_owned = false;
35833         LDKThirtyTwoBytes payment_preimage_ref;
35834         CHECK(payment_preimage->arr_len == 32);
35835         memcpy(payment_preimage_ref.data, payment_preimage->elems, 32); FREE(payment_preimage);
35836         ChannelManager_claim_funds(&this_arg_conv, payment_preimage_ref);
35837 }
35838
35839 void  __attribute__((export_name("TS_ChannelManager_claim_funds_with_known_custom_tlvs"))) TS_ChannelManager_claim_funds_with_known_custom_tlvs(uint64_t this_arg, int8_tArray payment_preimage) {
35840         LDKChannelManager this_arg_conv;
35841         this_arg_conv.inner = untag_ptr(this_arg);
35842         this_arg_conv.is_owned = ptr_is_owned(this_arg);
35843         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
35844         this_arg_conv.is_owned = false;
35845         LDKThirtyTwoBytes payment_preimage_ref;
35846         CHECK(payment_preimage->arr_len == 32);
35847         memcpy(payment_preimage_ref.data, payment_preimage->elems, 32); FREE(payment_preimage);
35848         ChannelManager_claim_funds_with_known_custom_tlvs(&this_arg_conv, payment_preimage_ref);
35849 }
35850
35851 int8_tArray  __attribute__((export_name("TS_ChannelManager_get_our_node_id"))) TS_ChannelManager_get_our_node_id(uint64_t this_arg) {
35852         LDKChannelManager this_arg_conv;
35853         this_arg_conv.inner = untag_ptr(this_arg);
35854         this_arg_conv.is_owned = ptr_is_owned(this_arg);
35855         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
35856         this_arg_conv.is_owned = false;
35857         int8_tArray ret_arr = init_int8_tArray(33, __LINE__);
35858         memcpy(ret_arr->elems, ChannelManager_get_our_node_id(&this_arg_conv).compressed_form, 33);
35859         return ret_arr;
35860 }
35861
35862 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) {
35863         LDKChannelManager this_arg_conv;
35864         this_arg_conv.inner = untag_ptr(this_arg);
35865         this_arg_conv.is_owned = ptr_is_owned(this_arg);
35866         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
35867         this_arg_conv.is_owned = false;
35868         uint8_t temporary_channel_id_arr[32];
35869         CHECK(temporary_channel_id->arr_len == 32);
35870         memcpy(temporary_channel_id_arr, temporary_channel_id->elems, 32); FREE(temporary_channel_id);
35871         uint8_t (*temporary_channel_id_ref)[32] = &temporary_channel_id_arr;
35872         LDKPublicKey counterparty_node_id_ref;
35873         CHECK(counterparty_node_id->arr_len == 33);
35874         memcpy(counterparty_node_id_ref.compressed_form, counterparty_node_id->elems, 33); FREE(counterparty_node_id);
35875         LDKU128 user_channel_id_ref;
35876         CHECK(user_channel_id->arr_len == 16);
35877         memcpy(user_channel_id_ref.le_bytes, user_channel_id->elems, 16); FREE(user_channel_id);
35878         LDKCResult_NoneAPIErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneAPIErrorZ), "LDKCResult_NoneAPIErrorZ");
35879         *ret_conv = ChannelManager_accept_inbound_channel(&this_arg_conv, temporary_channel_id_ref, counterparty_node_id_ref, user_channel_id_ref);
35880         return tag_ptr(ret_conv, true);
35881 }
35882
35883 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) {
35884         LDKChannelManager this_arg_conv;
35885         this_arg_conv.inner = untag_ptr(this_arg);
35886         this_arg_conv.is_owned = ptr_is_owned(this_arg);
35887         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
35888         this_arg_conv.is_owned = false;
35889         uint8_t temporary_channel_id_arr[32];
35890         CHECK(temporary_channel_id->arr_len == 32);
35891         memcpy(temporary_channel_id_arr, temporary_channel_id->elems, 32); FREE(temporary_channel_id);
35892         uint8_t (*temporary_channel_id_ref)[32] = &temporary_channel_id_arr;
35893         LDKPublicKey counterparty_node_id_ref;
35894         CHECK(counterparty_node_id->arr_len == 33);
35895         memcpy(counterparty_node_id_ref.compressed_form, counterparty_node_id->elems, 33); FREE(counterparty_node_id);
35896         LDKU128 user_channel_id_ref;
35897         CHECK(user_channel_id->arr_len == 16);
35898         memcpy(user_channel_id_ref.le_bytes, user_channel_id->elems, 16); FREE(user_channel_id);
35899         LDKCResult_NoneAPIErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneAPIErrorZ), "LDKCResult_NoneAPIErrorZ");
35900         *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);
35901         return tag_ptr(ret_conv, true);
35902 }
35903
35904 uint64_t  __attribute__((export_name("TS_ChannelManager_pay_for_offer"))) TS_ChannelManager_pay_for_offer(uint64_t this_arg, uint64_t offer, uint64_t quantity, uint64_t amount_msats, uint64_t payer_note, int8_tArray payment_id, uint64_t retry_strategy, uint64_t max_total_routing_fee_msat) {
35905         LDKChannelManager this_arg_conv;
35906         this_arg_conv.inner = untag_ptr(this_arg);
35907         this_arg_conv.is_owned = ptr_is_owned(this_arg);
35908         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
35909         this_arg_conv.is_owned = false;
35910         LDKOffer offer_conv;
35911         offer_conv.inner = untag_ptr(offer);
35912         offer_conv.is_owned = ptr_is_owned(offer);
35913         CHECK_INNER_FIELD_ACCESS_OR_NULL(offer_conv);
35914         offer_conv.is_owned = false;
35915         void* quantity_ptr = untag_ptr(quantity);
35916         CHECK_ACCESS(quantity_ptr);
35917         LDKCOption_u64Z quantity_conv = *(LDKCOption_u64Z*)(quantity_ptr);
35918         quantity_conv = COption_u64Z_clone((LDKCOption_u64Z*)untag_ptr(quantity));
35919         void* amount_msats_ptr = untag_ptr(amount_msats);
35920         CHECK_ACCESS(amount_msats_ptr);
35921         LDKCOption_u64Z amount_msats_conv = *(LDKCOption_u64Z*)(amount_msats_ptr);
35922         amount_msats_conv = COption_u64Z_clone((LDKCOption_u64Z*)untag_ptr(amount_msats));
35923         void* payer_note_ptr = untag_ptr(payer_note);
35924         CHECK_ACCESS(payer_note_ptr);
35925         LDKCOption_StrZ payer_note_conv = *(LDKCOption_StrZ*)(payer_note_ptr);
35926         payer_note_conv = COption_StrZ_clone((LDKCOption_StrZ*)untag_ptr(payer_note));
35927         LDKThirtyTwoBytes payment_id_ref;
35928         CHECK(payment_id->arr_len == 32);
35929         memcpy(payment_id_ref.data, payment_id->elems, 32); FREE(payment_id);
35930         void* retry_strategy_ptr = untag_ptr(retry_strategy);
35931         CHECK_ACCESS(retry_strategy_ptr);
35932         LDKRetry retry_strategy_conv = *(LDKRetry*)(retry_strategy_ptr);
35933         retry_strategy_conv = Retry_clone((LDKRetry*)untag_ptr(retry_strategy));
35934         void* max_total_routing_fee_msat_ptr = untag_ptr(max_total_routing_fee_msat);
35935         CHECK_ACCESS(max_total_routing_fee_msat_ptr);
35936         LDKCOption_u64Z max_total_routing_fee_msat_conv = *(LDKCOption_u64Z*)(max_total_routing_fee_msat_ptr);
35937         max_total_routing_fee_msat_conv = COption_u64Z_clone((LDKCOption_u64Z*)untag_ptr(max_total_routing_fee_msat));
35938         LDKCResult_NoneBolt12SemanticErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneBolt12SemanticErrorZ), "LDKCResult_NoneBolt12SemanticErrorZ");
35939         *ret_conv = ChannelManager_pay_for_offer(&this_arg_conv, &offer_conv, quantity_conv, amount_msats_conv, payer_note_conv, payment_id_ref, retry_strategy_conv, max_total_routing_fee_msat_conv);
35940         return tag_ptr(ret_conv, true);
35941 }
35942
35943 uint64_t  __attribute__((export_name("TS_ChannelManager_request_refund_payment"))) TS_ChannelManager_request_refund_payment(uint64_t this_arg, uint64_t refund) {
35944         LDKChannelManager this_arg_conv;
35945         this_arg_conv.inner = untag_ptr(this_arg);
35946         this_arg_conv.is_owned = ptr_is_owned(this_arg);
35947         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
35948         this_arg_conv.is_owned = false;
35949         LDKRefund refund_conv;
35950         refund_conv.inner = untag_ptr(refund);
35951         refund_conv.is_owned = ptr_is_owned(refund);
35952         CHECK_INNER_FIELD_ACCESS_OR_NULL(refund_conv);
35953         refund_conv.is_owned = false;
35954         LDKCResult_NoneBolt12SemanticErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneBolt12SemanticErrorZ), "LDKCResult_NoneBolt12SemanticErrorZ");
35955         *ret_conv = ChannelManager_request_refund_payment(&this_arg_conv, &refund_conv);
35956         return tag_ptr(ret_conv, true);
35957 }
35958
35959 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) {
35960         LDKChannelManager this_arg_conv;
35961         this_arg_conv.inner = untag_ptr(this_arg);
35962         this_arg_conv.is_owned = ptr_is_owned(this_arg);
35963         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
35964         this_arg_conv.is_owned = false;
35965         void* min_value_msat_ptr = untag_ptr(min_value_msat);
35966         CHECK_ACCESS(min_value_msat_ptr);
35967         LDKCOption_u64Z min_value_msat_conv = *(LDKCOption_u64Z*)(min_value_msat_ptr);
35968         min_value_msat_conv = COption_u64Z_clone((LDKCOption_u64Z*)untag_ptr(min_value_msat));
35969         void* min_final_cltv_expiry_delta_ptr = untag_ptr(min_final_cltv_expiry_delta);
35970         CHECK_ACCESS(min_final_cltv_expiry_delta_ptr);
35971         LDKCOption_u16Z min_final_cltv_expiry_delta_conv = *(LDKCOption_u16Z*)(min_final_cltv_expiry_delta_ptr);
35972         min_final_cltv_expiry_delta_conv = COption_u16Z_clone((LDKCOption_u16Z*)untag_ptr(min_final_cltv_expiry_delta));
35973         LDKCResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZNoneZ), "LDKCResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZNoneZ");
35974         *ret_conv = ChannelManager_create_inbound_payment(&this_arg_conv, min_value_msat_conv, invoice_expiry_delta_secs, min_final_cltv_expiry_delta_conv);
35975         return tag_ptr(ret_conv, true);
35976 }
35977
35978 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) {
35979         LDKChannelManager this_arg_conv;
35980         this_arg_conv.inner = untag_ptr(this_arg);
35981         this_arg_conv.is_owned = ptr_is_owned(this_arg);
35982         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
35983         this_arg_conv.is_owned = false;
35984         LDKThirtyTwoBytes payment_hash_ref;
35985         CHECK(payment_hash->arr_len == 32);
35986         memcpy(payment_hash_ref.data, payment_hash->elems, 32); FREE(payment_hash);
35987         void* min_value_msat_ptr = untag_ptr(min_value_msat);
35988         CHECK_ACCESS(min_value_msat_ptr);
35989         LDKCOption_u64Z min_value_msat_conv = *(LDKCOption_u64Z*)(min_value_msat_ptr);
35990         min_value_msat_conv = COption_u64Z_clone((LDKCOption_u64Z*)untag_ptr(min_value_msat));
35991         void* min_final_cltv_expiry_ptr = untag_ptr(min_final_cltv_expiry);
35992         CHECK_ACCESS(min_final_cltv_expiry_ptr);
35993         LDKCOption_u16Z min_final_cltv_expiry_conv = *(LDKCOption_u16Z*)(min_final_cltv_expiry_ptr);
35994         min_final_cltv_expiry_conv = COption_u16Z_clone((LDKCOption_u16Z*)untag_ptr(min_final_cltv_expiry));
35995         LDKCResult_ThirtyTwoBytesNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_ThirtyTwoBytesNoneZ), "LDKCResult_ThirtyTwoBytesNoneZ");
35996         *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);
35997         return tag_ptr(ret_conv, true);
35998 }
35999
36000 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) {
36001         LDKChannelManager this_arg_conv;
36002         this_arg_conv.inner = untag_ptr(this_arg);
36003         this_arg_conv.is_owned = ptr_is_owned(this_arg);
36004         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
36005         this_arg_conv.is_owned = false;
36006         LDKThirtyTwoBytes payment_hash_ref;
36007         CHECK(payment_hash->arr_len == 32);
36008         memcpy(payment_hash_ref.data, payment_hash->elems, 32); FREE(payment_hash);
36009         LDKThirtyTwoBytes payment_secret_ref;
36010         CHECK(payment_secret->arr_len == 32);
36011         memcpy(payment_secret_ref.data, payment_secret->elems, 32); FREE(payment_secret);
36012         LDKCResult_ThirtyTwoBytesAPIErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ThirtyTwoBytesAPIErrorZ), "LDKCResult_ThirtyTwoBytesAPIErrorZ");
36013         *ret_conv = ChannelManager_get_payment_preimage(&this_arg_conv, payment_hash_ref, payment_secret_ref);
36014         return tag_ptr(ret_conv, true);
36015 }
36016
36017 int64_t  __attribute__((export_name("TS_ChannelManager_get_phantom_scid"))) TS_ChannelManager_get_phantom_scid(uint64_t this_arg) {
36018         LDKChannelManager this_arg_conv;
36019         this_arg_conv.inner = untag_ptr(this_arg);
36020         this_arg_conv.is_owned = ptr_is_owned(this_arg);
36021         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
36022         this_arg_conv.is_owned = false;
36023         int64_t ret_conv = ChannelManager_get_phantom_scid(&this_arg_conv);
36024         return ret_conv;
36025 }
36026
36027 uint64_t  __attribute__((export_name("TS_ChannelManager_get_phantom_route_hints"))) TS_ChannelManager_get_phantom_route_hints(uint64_t this_arg) {
36028         LDKChannelManager this_arg_conv;
36029         this_arg_conv.inner = untag_ptr(this_arg);
36030         this_arg_conv.is_owned = ptr_is_owned(this_arg);
36031         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
36032         this_arg_conv.is_owned = false;
36033         LDKPhantomRouteHints ret_var = ChannelManager_get_phantom_route_hints(&this_arg_conv);
36034         uint64_t ret_ref = 0;
36035         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
36036         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
36037         return ret_ref;
36038 }
36039
36040 int64_t  __attribute__((export_name("TS_ChannelManager_get_intercept_scid"))) TS_ChannelManager_get_intercept_scid(uint64_t this_arg) {
36041         LDKChannelManager this_arg_conv;
36042         this_arg_conv.inner = untag_ptr(this_arg);
36043         this_arg_conv.is_owned = ptr_is_owned(this_arg);
36044         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
36045         this_arg_conv.is_owned = false;
36046         int64_t ret_conv = ChannelManager_get_intercept_scid(&this_arg_conv);
36047         return ret_conv;
36048 }
36049
36050 uint64_t  __attribute__((export_name("TS_ChannelManager_compute_inflight_htlcs"))) TS_ChannelManager_compute_inflight_htlcs(uint64_t this_arg) {
36051         LDKChannelManager this_arg_conv;
36052         this_arg_conv.inner = untag_ptr(this_arg);
36053         this_arg_conv.is_owned = ptr_is_owned(this_arg);
36054         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
36055         this_arg_conv.is_owned = false;
36056         LDKInFlightHtlcs ret_var = ChannelManager_compute_inflight_htlcs(&this_arg_conv);
36057         uint64_t ret_ref = 0;
36058         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
36059         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
36060         return ret_ref;
36061 }
36062
36063 uint64_t  __attribute__((export_name("TS_ChannelManager_as_MessageSendEventsProvider"))) TS_ChannelManager_as_MessageSendEventsProvider(uint64_t this_arg) {
36064         LDKChannelManager this_arg_conv;
36065         this_arg_conv.inner = untag_ptr(this_arg);
36066         this_arg_conv.is_owned = ptr_is_owned(this_arg);
36067         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
36068         this_arg_conv.is_owned = false;
36069         LDKMessageSendEventsProvider* ret_ret = MALLOC(sizeof(LDKMessageSendEventsProvider), "LDKMessageSendEventsProvider");
36070         *ret_ret = ChannelManager_as_MessageSendEventsProvider(&this_arg_conv);
36071         return tag_ptr(ret_ret, true);
36072 }
36073
36074 uint64_t  __attribute__((export_name("TS_ChannelManager_as_EventsProvider"))) TS_ChannelManager_as_EventsProvider(uint64_t this_arg) {
36075         LDKChannelManager this_arg_conv;
36076         this_arg_conv.inner = untag_ptr(this_arg);
36077         this_arg_conv.is_owned = ptr_is_owned(this_arg);
36078         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
36079         this_arg_conv.is_owned = false;
36080         LDKEventsProvider* ret_ret = MALLOC(sizeof(LDKEventsProvider), "LDKEventsProvider");
36081         *ret_ret = ChannelManager_as_EventsProvider(&this_arg_conv);
36082         return tag_ptr(ret_ret, true);
36083 }
36084
36085 uint64_t  __attribute__((export_name("TS_ChannelManager_as_Listen"))) TS_ChannelManager_as_Listen(uint64_t this_arg) {
36086         LDKChannelManager this_arg_conv;
36087         this_arg_conv.inner = untag_ptr(this_arg);
36088         this_arg_conv.is_owned = ptr_is_owned(this_arg);
36089         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
36090         this_arg_conv.is_owned = false;
36091         LDKListen* ret_ret = MALLOC(sizeof(LDKListen), "LDKListen");
36092         *ret_ret = ChannelManager_as_Listen(&this_arg_conv);
36093         return tag_ptr(ret_ret, true);
36094 }
36095
36096 uint64_t  __attribute__((export_name("TS_ChannelManager_as_Confirm"))) TS_ChannelManager_as_Confirm(uint64_t this_arg) {
36097         LDKChannelManager this_arg_conv;
36098         this_arg_conv.inner = untag_ptr(this_arg);
36099         this_arg_conv.is_owned = ptr_is_owned(this_arg);
36100         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
36101         this_arg_conv.is_owned = false;
36102         LDKConfirm* ret_ret = MALLOC(sizeof(LDKConfirm), "LDKConfirm");
36103         *ret_ret = ChannelManager_as_Confirm(&this_arg_conv);
36104         return tag_ptr(ret_ret, true);
36105 }
36106
36107 uint64_t  __attribute__((export_name("TS_ChannelManager_get_event_or_persistence_needed_future"))) TS_ChannelManager_get_event_or_persistence_needed_future(uint64_t this_arg) {
36108         LDKChannelManager this_arg_conv;
36109         this_arg_conv.inner = untag_ptr(this_arg);
36110         this_arg_conv.is_owned = ptr_is_owned(this_arg);
36111         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
36112         this_arg_conv.is_owned = false;
36113         LDKFuture ret_var = ChannelManager_get_event_or_persistence_needed_future(&this_arg_conv);
36114         uint64_t ret_ref = 0;
36115         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
36116         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
36117         return ret_ref;
36118 }
36119
36120 jboolean  __attribute__((export_name("TS_ChannelManager_get_and_clear_needs_persistence"))) TS_ChannelManager_get_and_clear_needs_persistence(uint64_t this_arg) {
36121         LDKChannelManager this_arg_conv;
36122         this_arg_conv.inner = untag_ptr(this_arg);
36123         this_arg_conv.is_owned = ptr_is_owned(this_arg);
36124         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
36125         this_arg_conv.is_owned = false;
36126         jboolean ret_conv = ChannelManager_get_and_clear_needs_persistence(&this_arg_conv);
36127         return ret_conv;
36128 }
36129
36130 uint64_t  __attribute__((export_name("TS_ChannelManager_current_best_block"))) TS_ChannelManager_current_best_block(uint64_t this_arg) {
36131         LDKChannelManager this_arg_conv;
36132         this_arg_conv.inner = untag_ptr(this_arg);
36133         this_arg_conv.is_owned = ptr_is_owned(this_arg);
36134         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
36135         this_arg_conv.is_owned = false;
36136         LDKBestBlock ret_var = ChannelManager_current_best_block(&this_arg_conv);
36137         uint64_t ret_ref = 0;
36138         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
36139         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
36140         return ret_ref;
36141 }
36142
36143 uint64_t  __attribute__((export_name("TS_ChannelManager_node_features"))) TS_ChannelManager_node_features(uint64_t this_arg) {
36144         LDKChannelManager this_arg_conv;
36145         this_arg_conv.inner = untag_ptr(this_arg);
36146         this_arg_conv.is_owned = ptr_is_owned(this_arg);
36147         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
36148         this_arg_conv.is_owned = false;
36149         LDKNodeFeatures ret_var = ChannelManager_node_features(&this_arg_conv);
36150         uint64_t ret_ref = 0;
36151         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
36152         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
36153         return ret_ref;
36154 }
36155
36156 uint64_t  __attribute__((export_name("TS_ChannelManager_channel_features"))) TS_ChannelManager_channel_features(uint64_t this_arg) {
36157         LDKChannelManager this_arg_conv;
36158         this_arg_conv.inner = untag_ptr(this_arg);
36159         this_arg_conv.is_owned = ptr_is_owned(this_arg);
36160         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
36161         this_arg_conv.is_owned = false;
36162         LDKChannelFeatures ret_var = ChannelManager_channel_features(&this_arg_conv);
36163         uint64_t ret_ref = 0;
36164         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
36165         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
36166         return ret_ref;
36167 }
36168
36169 uint64_t  __attribute__((export_name("TS_ChannelManager_channel_type_features"))) TS_ChannelManager_channel_type_features(uint64_t this_arg) {
36170         LDKChannelManager this_arg_conv;
36171         this_arg_conv.inner = untag_ptr(this_arg);
36172         this_arg_conv.is_owned = ptr_is_owned(this_arg);
36173         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
36174         this_arg_conv.is_owned = false;
36175         LDKChannelTypeFeatures ret_var = ChannelManager_channel_type_features(&this_arg_conv);
36176         uint64_t ret_ref = 0;
36177         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
36178         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
36179         return ret_ref;
36180 }
36181
36182 uint64_t  __attribute__((export_name("TS_ChannelManager_init_features"))) TS_ChannelManager_init_features(uint64_t this_arg) {
36183         LDKChannelManager this_arg_conv;
36184         this_arg_conv.inner = untag_ptr(this_arg);
36185         this_arg_conv.is_owned = ptr_is_owned(this_arg);
36186         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
36187         this_arg_conv.is_owned = false;
36188         LDKInitFeatures ret_var = ChannelManager_init_features(&this_arg_conv);
36189         uint64_t ret_ref = 0;
36190         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
36191         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
36192         return ret_ref;
36193 }
36194
36195 uint64_t  __attribute__((export_name("TS_ChannelManager_as_ChannelMessageHandler"))) TS_ChannelManager_as_ChannelMessageHandler(uint64_t this_arg) {
36196         LDKChannelManager this_arg_conv;
36197         this_arg_conv.inner = untag_ptr(this_arg);
36198         this_arg_conv.is_owned = ptr_is_owned(this_arg);
36199         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
36200         this_arg_conv.is_owned = false;
36201         LDKChannelMessageHandler* ret_ret = MALLOC(sizeof(LDKChannelMessageHandler), "LDKChannelMessageHandler");
36202         *ret_ret = ChannelManager_as_ChannelMessageHandler(&this_arg_conv);
36203         return tag_ptr(ret_ret, true);
36204 }
36205
36206 uint64_t  __attribute__((export_name("TS_ChannelManager_as_OffersMessageHandler"))) TS_ChannelManager_as_OffersMessageHandler(uint64_t this_arg) {
36207         LDKChannelManager this_arg_conv;
36208         this_arg_conv.inner = untag_ptr(this_arg);
36209         this_arg_conv.is_owned = ptr_is_owned(this_arg);
36210         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
36211         this_arg_conv.is_owned = false;
36212         LDKOffersMessageHandler* ret_ret = MALLOC(sizeof(LDKOffersMessageHandler), "LDKOffersMessageHandler");
36213         *ret_ret = ChannelManager_as_OffersMessageHandler(&this_arg_conv);
36214         return tag_ptr(ret_ret, true);
36215 }
36216
36217 uint64_t  __attribute__((export_name("TS_provided_init_features"))) TS_provided_init_features(uint64_t config) {
36218         LDKUserConfig config_conv;
36219         config_conv.inner = untag_ptr(config);
36220         config_conv.is_owned = ptr_is_owned(config);
36221         CHECK_INNER_FIELD_ACCESS_OR_NULL(config_conv);
36222         config_conv.is_owned = false;
36223         LDKInitFeatures ret_var = provided_init_features(&config_conv);
36224         uint64_t ret_ref = 0;
36225         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
36226         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
36227         return ret_ref;
36228 }
36229
36230 int8_tArray  __attribute__((export_name("TS_CounterpartyForwardingInfo_write"))) TS_CounterpartyForwardingInfo_write(uint64_t obj) {
36231         LDKCounterpartyForwardingInfo obj_conv;
36232         obj_conv.inner = untag_ptr(obj);
36233         obj_conv.is_owned = ptr_is_owned(obj);
36234         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
36235         obj_conv.is_owned = false;
36236         LDKCVec_u8Z ret_var = CounterpartyForwardingInfo_write(&obj_conv);
36237         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
36238         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
36239         CVec_u8Z_free(ret_var);
36240         return ret_arr;
36241 }
36242
36243 uint64_t  __attribute__((export_name("TS_CounterpartyForwardingInfo_read"))) TS_CounterpartyForwardingInfo_read(int8_tArray ser) {
36244         LDKu8slice ser_ref;
36245         ser_ref.datalen = ser->arr_len;
36246         ser_ref.data = ser->elems;
36247         LDKCResult_CounterpartyForwardingInfoDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CounterpartyForwardingInfoDecodeErrorZ), "LDKCResult_CounterpartyForwardingInfoDecodeErrorZ");
36248         *ret_conv = CounterpartyForwardingInfo_read(ser_ref);
36249         FREE(ser);
36250         return tag_ptr(ret_conv, true);
36251 }
36252
36253 int8_tArray  __attribute__((export_name("TS_ChannelCounterparty_write"))) TS_ChannelCounterparty_write(uint64_t obj) {
36254         LDKChannelCounterparty obj_conv;
36255         obj_conv.inner = untag_ptr(obj);
36256         obj_conv.is_owned = ptr_is_owned(obj);
36257         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
36258         obj_conv.is_owned = false;
36259         LDKCVec_u8Z ret_var = ChannelCounterparty_write(&obj_conv);
36260         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
36261         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
36262         CVec_u8Z_free(ret_var);
36263         return ret_arr;
36264 }
36265
36266 uint64_t  __attribute__((export_name("TS_ChannelCounterparty_read"))) TS_ChannelCounterparty_read(int8_tArray ser) {
36267         LDKu8slice ser_ref;
36268         ser_ref.datalen = ser->arr_len;
36269         ser_ref.data = ser->elems;
36270         LDKCResult_ChannelCounterpartyDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelCounterpartyDecodeErrorZ), "LDKCResult_ChannelCounterpartyDecodeErrorZ");
36271         *ret_conv = ChannelCounterparty_read(ser_ref);
36272         FREE(ser);
36273         return tag_ptr(ret_conv, true);
36274 }
36275
36276 int8_tArray  __attribute__((export_name("TS_ChannelDetails_write"))) TS_ChannelDetails_write(uint64_t obj) {
36277         LDKChannelDetails obj_conv;
36278         obj_conv.inner = untag_ptr(obj);
36279         obj_conv.is_owned = ptr_is_owned(obj);
36280         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
36281         obj_conv.is_owned = false;
36282         LDKCVec_u8Z ret_var = ChannelDetails_write(&obj_conv);
36283         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
36284         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
36285         CVec_u8Z_free(ret_var);
36286         return ret_arr;
36287 }
36288
36289 uint64_t  __attribute__((export_name("TS_ChannelDetails_read"))) TS_ChannelDetails_read(int8_tArray ser) {
36290         LDKu8slice ser_ref;
36291         ser_ref.datalen = ser->arr_len;
36292         ser_ref.data = ser->elems;
36293         LDKCResult_ChannelDetailsDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelDetailsDecodeErrorZ), "LDKCResult_ChannelDetailsDecodeErrorZ");
36294         *ret_conv = ChannelDetails_read(ser_ref);
36295         FREE(ser);
36296         return tag_ptr(ret_conv, true);
36297 }
36298
36299 int8_tArray  __attribute__((export_name("TS_PhantomRouteHints_write"))) TS_PhantomRouteHints_write(uint64_t obj) {
36300         LDKPhantomRouteHints obj_conv;
36301         obj_conv.inner = untag_ptr(obj);
36302         obj_conv.is_owned = ptr_is_owned(obj);
36303         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
36304         obj_conv.is_owned = false;
36305         LDKCVec_u8Z ret_var = PhantomRouteHints_write(&obj_conv);
36306         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
36307         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
36308         CVec_u8Z_free(ret_var);
36309         return ret_arr;
36310 }
36311
36312 uint64_t  __attribute__((export_name("TS_PhantomRouteHints_read"))) TS_PhantomRouteHints_read(int8_tArray ser) {
36313         LDKu8slice ser_ref;
36314         ser_ref.datalen = ser->arr_len;
36315         ser_ref.data = ser->elems;
36316         LDKCResult_PhantomRouteHintsDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PhantomRouteHintsDecodeErrorZ), "LDKCResult_PhantomRouteHintsDecodeErrorZ");
36317         *ret_conv = PhantomRouteHints_read(ser_ref);
36318         FREE(ser);
36319         return tag_ptr(ret_conv, true);
36320 }
36321
36322 int8_tArray  __attribute__((export_name("TS_ChannelManager_write"))) TS_ChannelManager_write(uint64_t obj) {
36323         LDKChannelManager obj_conv;
36324         obj_conv.inner = untag_ptr(obj);
36325         obj_conv.is_owned = ptr_is_owned(obj);
36326         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
36327         obj_conv.is_owned = false;
36328         LDKCVec_u8Z ret_var = ChannelManager_write(&obj_conv);
36329         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
36330         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
36331         CVec_u8Z_free(ret_var);
36332         return ret_arr;
36333 }
36334
36335 int8_tArray  __attribute__((export_name("TS_ChannelShutdownState_write"))) TS_ChannelShutdownState_write(uint64_t obj) {
36336         LDKChannelShutdownState* obj_conv = (LDKChannelShutdownState*)untag_ptr(obj);
36337         LDKCVec_u8Z ret_var = ChannelShutdownState_write(obj_conv);
36338         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
36339         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
36340         CVec_u8Z_free(ret_var);
36341         return ret_arr;
36342 }
36343
36344 uint64_t  __attribute__((export_name("TS_ChannelShutdownState_read"))) TS_ChannelShutdownState_read(int8_tArray ser) {
36345         LDKu8slice ser_ref;
36346         ser_ref.datalen = ser->arr_len;
36347         ser_ref.data = ser->elems;
36348         LDKCResult_ChannelShutdownStateDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelShutdownStateDecodeErrorZ), "LDKCResult_ChannelShutdownStateDecodeErrorZ");
36349         *ret_conv = ChannelShutdownState_read(ser_ref);
36350         FREE(ser);
36351         return tag_ptr(ret_conv, true);
36352 }
36353
36354 void  __attribute__((export_name("TS_ChannelManagerReadArgs_free"))) TS_ChannelManagerReadArgs_free(uint64_t this_obj) {
36355         LDKChannelManagerReadArgs this_obj_conv;
36356         this_obj_conv.inner = untag_ptr(this_obj);
36357         this_obj_conv.is_owned = ptr_is_owned(this_obj);
36358         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
36359         ChannelManagerReadArgs_free(this_obj_conv);
36360 }
36361
36362 uint64_t  __attribute__((export_name("TS_ChannelManagerReadArgs_get_entropy_source"))) TS_ChannelManagerReadArgs_get_entropy_source(uint64_t this_ptr) {
36363         LDKChannelManagerReadArgs this_ptr_conv;
36364         this_ptr_conv.inner = untag_ptr(this_ptr);
36365         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
36366         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
36367         this_ptr_conv.is_owned = false;
36368         // WARNING: This object doesn't live past this scope, needs clone!
36369         uint64_t ret_ret = tag_ptr(ChannelManagerReadArgs_get_entropy_source(&this_ptr_conv), false);
36370         return ret_ret;
36371 }
36372
36373 void  __attribute__((export_name("TS_ChannelManagerReadArgs_set_entropy_source"))) TS_ChannelManagerReadArgs_set_entropy_source(uint64_t this_ptr, uint64_t val) {
36374         LDKChannelManagerReadArgs this_ptr_conv;
36375         this_ptr_conv.inner = untag_ptr(this_ptr);
36376         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
36377         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
36378         this_ptr_conv.is_owned = false;
36379         void* val_ptr = untag_ptr(val);
36380         CHECK_ACCESS(val_ptr);
36381         LDKEntropySource val_conv = *(LDKEntropySource*)(val_ptr);
36382         if (val_conv.free == LDKEntropySource_JCalls_free) {
36383                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
36384                 LDKEntropySource_JCalls_cloned(&val_conv);
36385         }
36386         ChannelManagerReadArgs_set_entropy_source(&this_ptr_conv, val_conv);
36387 }
36388
36389 uint64_t  __attribute__((export_name("TS_ChannelManagerReadArgs_get_node_signer"))) TS_ChannelManagerReadArgs_get_node_signer(uint64_t this_ptr) {
36390         LDKChannelManagerReadArgs this_ptr_conv;
36391         this_ptr_conv.inner = untag_ptr(this_ptr);
36392         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
36393         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
36394         this_ptr_conv.is_owned = false;
36395         // WARNING: This object doesn't live past this scope, needs clone!
36396         uint64_t ret_ret = tag_ptr(ChannelManagerReadArgs_get_node_signer(&this_ptr_conv), false);
36397         return ret_ret;
36398 }
36399
36400 void  __attribute__((export_name("TS_ChannelManagerReadArgs_set_node_signer"))) TS_ChannelManagerReadArgs_set_node_signer(uint64_t this_ptr, uint64_t val) {
36401         LDKChannelManagerReadArgs this_ptr_conv;
36402         this_ptr_conv.inner = untag_ptr(this_ptr);
36403         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
36404         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
36405         this_ptr_conv.is_owned = false;
36406         void* val_ptr = untag_ptr(val);
36407         CHECK_ACCESS(val_ptr);
36408         LDKNodeSigner val_conv = *(LDKNodeSigner*)(val_ptr);
36409         if (val_conv.free == LDKNodeSigner_JCalls_free) {
36410                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
36411                 LDKNodeSigner_JCalls_cloned(&val_conv);
36412         }
36413         ChannelManagerReadArgs_set_node_signer(&this_ptr_conv, val_conv);
36414 }
36415
36416 uint64_t  __attribute__((export_name("TS_ChannelManagerReadArgs_get_signer_provider"))) TS_ChannelManagerReadArgs_get_signer_provider(uint64_t this_ptr) {
36417         LDKChannelManagerReadArgs this_ptr_conv;
36418         this_ptr_conv.inner = untag_ptr(this_ptr);
36419         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
36420         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
36421         this_ptr_conv.is_owned = false;
36422         // WARNING: This object doesn't live past this scope, needs clone!
36423         uint64_t ret_ret = tag_ptr(ChannelManagerReadArgs_get_signer_provider(&this_ptr_conv), false);
36424         return ret_ret;
36425 }
36426
36427 void  __attribute__((export_name("TS_ChannelManagerReadArgs_set_signer_provider"))) TS_ChannelManagerReadArgs_set_signer_provider(uint64_t this_ptr, uint64_t val) {
36428         LDKChannelManagerReadArgs this_ptr_conv;
36429         this_ptr_conv.inner = untag_ptr(this_ptr);
36430         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
36431         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
36432         this_ptr_conv.is_owned = false;
36433         void* val_ptr = untag_ptr(val);
36434         CHECK_ACCESS(val_ptr);
36435         LDKSignerProvider val_conv = *(LDKSignerProvider*)(val_ptr);
36436         if (val_conv.free == LDKSignerProvider_JCalls_free) {
36437                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
36438                 LDKSignerProvider_JCalls_cloned(&val_conv);
36439         }
36440         ChannelManagerReadArgs_set_signer_provider(&this_ptr_conv, val_conv);
36441 }
36442
36443 uint64_t  __attribute__((export_name("TS_ChannelManagerReadArgs_get_fee_estimator"))) TS_ChannelManagerReadArgs_get_fee_estimator(uint64_t this_ptr) {
36444         LDKChannelManagerReadArgs this_ptr_conv;
36445         this_ptr_conv.inner = untag_ptr(this_ptr);
36446         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
36447         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
36448         this_ptr_conv.is_owned = false;
36449         // WARNING: This object doesn't live past this scope, needs clone!
36450         uint64_t ret_ret = tag_ptr(ChannelManagerReadArgs_get_fee_estimator(&this_ptr_conv), false);
36451         return ret_ret;
36452 }
36453
36454 void  __attribute__((export_name("TS_ChannelManagerReadArgs_set_fee_estimator"))) TS_ChannelManagerReadArgs_set_fee_estimator(uint64_t this_ptr, uint64_t val) {
36455         LDKChannelManagerReadArgs this_ptr_conv;
36456         this_ptr_conv.inner = untag_ptr(this_ptr);
36457         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
36458         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
36459         this_ptr_conv.is_owned = false;
36460         void* val_ptr = untag_ptr(val);
36461         CHECK_ACCESS(val_ptr);
36462         LDKFeeEstimator val_conv = *(LDKFeeEstimator*)(val_ptr);
36463         if (val_conv.free == LDKFeeEstimator_JCalls_free) {
36464                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
36465                 LDKFeeEstimator_JCalls_cloned(&val_conv);
36466         }
36467         ChannelManagerReadArgs_set_fee_estimator(&this_ptr_conv, val_conv);
36468 }
36469
36470 uint64_t  __attribute__((export_name("TS_ChannelManagerReadArgs_get_chain_monitor"))) TS_ChannelManagerReadArgs_get_chain_monitor(uint64_t this_ptr) {
36471         LDKChannelManagerReadArgs this_ptr_conv;
36472         this_ptr_conv.inner = untag_ptr(this_ptr);
36473         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
36474         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
36475         this_ptr_conv.is_owned = false;
36476         // WARNING: This object doesn't live past this scope, needs clone!
36477         uint64_t ret_ret = tag_ptr(ChannelManagerReadArgs_get_chain_monitor(&this_ptr_conv), false);
36478         return ret_ret;
36479 }
36480
36481 void  __attribute__((export_name("TS_ChannelManagerReadArgs_set_chain_monitor"))) TS_ChannelManagerReadArgs_set_chain_monitor(uint64_t this_ptr, uint64_t val) {
36482         LDKChannelManagerReadArgs this_ptr_conv;
36483         this_ptr_conv.inner = untag_ptr(this_ptr);
36484         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
36485         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
36486         this_ptr_conv.is_owned = false;
36487         void* val_ptr = untag_ptr(val);
36488         CHECK_ACCESS(val_ptr);
36489         LDKWatch val_conv = *(LDKWatch*)(val_ptr);
36490         if (val_conv.free == LDKWatch_JCalls_free) {
36491                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
36492                 LDKWatch_JCalls_cloned(&val_conv);
36493         }
36494         ChannelManagerReadArgs_set_chain_monitor(&this_ptr_conv, val_conv);
36495 }
36496
36497 uint64_t  __attribute__((export_name("TS_ChannelManagerReadArgs_get_tx_broadcaster"))) TS_ChannelManagerReadArgs_get_tx_broadcaster(uint64_t this_ptr) {
36498         LDKChannelManagerReadArgs this_ptr_conv;
36499         this_ptr_conv.inner = untag_ptr(this_ptr);
36500         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
36501         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
36502         this_ptr_conv.is_owned = false;
36503         // WARNING: This object doesn't live past this scope, needs clone!
36504         uint64_t ret_ret = tag_ptr(ChannelManagerReadArgs_get_tx_broadcaster(&this_ptr_conv), false);
36505         return ret_ret;
36506 }
36507
36508 void  __attribute__((export_name("TS_ChannelManagerReadArgs_set_tx_broadcaster"))) TS_ChannelManagerReadArgs_set_tx_broadcaster(uint64_t this_ptr, uint64_t val) {
36509         LDKChannelManagerReadArgs this_ptr_conv;
36510         this_ptr_conv.inner = untag_ptr(this_ptr);
36511         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
36512         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
36513         this_ptr_conv.is_owned = false;
36514         void* val_ptr = untag_ptr(val);
36515         CHECK_ACCESS(val_ptr);
36516         LDKBroadcasterInterface val_conv = *(LDKBroadcasterInterface*)(val_ptr);
36517         if (val_conv.free == LDKBroadcasterInterface_JCalls_free) {
36518                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
36519                 LDKBroadcasterInterface_JCalls_cloned(&val_conv);
36520         }
36521         ChannelManagerReadArgs_set_tx_broadcaster(&this_ptr_conv, val_conv);
36522 }
36523
36524 uint64_t  __attribute__((export_name("TS_ChannelManagerReadArgs_get_router"))) TS_ChannelManagerReadArgs_get_router(uint64_t this_ptr) {
36525         LDKChannelManagerReadArgs this_ptr_conv;
36526         this_ptr_conv.inner = untag_ptr(this_ptr);
36527         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
36528         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
36529         this_ptr_conv.is_owned = false;
36530         // WARNING: This object doesn't live past this scope, needs clone!
36531         uint64_t ret_ret = tag_ptr(ChannelManagerReadArgs_get_router(&this_ptr_conv), false);
36532         return ret_ret;
36533 }
36534
36535 void  __attribute__((export_name("TS_ChannelManagerReadArgs_set_router"))) TS_ChannelManagerReadArgs_set_router(uint64_t this_ptr, uint64_t val) {
36536         LDKChannelManagerReadArgs this_ptr_conv;
36537         this_ptr_conv.inner = untag_ptr(this_ptr);
36538         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
36539         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
36540         this_ptr_conv.is_owned = false;
36541         void* val_ptr = untag_ptr(val);
36542         CHECK_ACCESS(val_ptr);
36543         LDKRouter val_conv = *(LDKRouter*)(val_ptr);
36544         if (val_conv.free == LDKRouter_JCalls_free) {
36545                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
36546                 LDKRouter_JCalls_cloned(&val_conv);
36547         }
36548         ChannelManagerReadArgs_set_router(&this_ptr_conv, val_conv);
36549 }
36550
36551 uint64_t  __attribute__((export_name("TS_ChannelManagerReadArgs_get_logger"))) TS_ChannelManagerReadArgs_get_logger(uint64_t this_ptr) {
36552         LDKChannelManagerReadArgs this_ptr_conv;
36553         this_ptr_conv.inner = untag_ptr(this_ptr);
36554         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
36555         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
36556         this_ptr_conv.is_owned = false;
36557         // WARNING: This object doesn't live past this scope, needs clone!
36558         uint64_t ret_ret = tag_ptr(ChannelManagerReadArgs_get_logger(&this_ptr_conv), false);
36559         return ret_ret;
36560 }
36561
36562 void  __attribute__((export_name("TS_ChannelManagerReadArgs_set_logger"))) TS_ChannelManagerReadArgs_set_logger(uint64_t this_ptr, uint64_t val) {
36563         LDKChannelManagerReadArgs this_ptr_conv;
36564         this_ptr_conv.inner = untag_ptr(this_ptr);
36565         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
36566         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
36567         this_ptr_conv.is_owned = false;
36568         void* val_ptr = untag_ptr(val);
36569         CHECK_ACCESS(val_ptr);
36570         LDKLogger val_conv = *(LDKLogger*)(val_ptr);
36571         if (val_conv.free == LDKLogger_JCalls_free) {
36572                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
36573                 LDKLogger_JCalls_cloned(&val_conv);
36574         }
36575         ChannelManagerReadArgs_set_logger(&this_ptr_conv, val_conv);
36576 }
36577
36578 uint64_t  __attribute__((export_name("TS_ChannelManagerReadArgs_get_default_config"))) TS_ChannelManagerReadArgs_get_default_config(uint64_t this_ptr) {
36579         LDKChannelManagerReadArgs this_ptr_conv;
36580         this_ptr_conv.inner = untag_ptr(this_ptr);
36581         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
36582         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
36583         this_ptr_conv.is_owned = false;
36584         LDKUserConfig ret_var = ChannelManagerReadArgs_get_default_config(&this_ptr_conv);
36585         uint64_t ret_ref = 0;
36586         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
36587         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
36588         return ret_ref;
36589 }
36590
36591 void  __attribute__((export_name("TS_ChannelManagerReadArgs_set_default_config"))) TS_ChannelManagerReadArgs_set_default_config(uint64_t this_ptr, uint64_t val) {
36592         LDKChannelManagerReadArgs this_ptr_conv;
36593         this_ptr_conv.inner = untag_ptr(this_ptr);
36594         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
36595         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
36596         this_ptr_conv.is_owned = false;
36597         LDKUserConfig val_conv;
36598         val_conv.inner = untag_ptr(val);
36599         val_conv.is_owned = ptr_is_owned(val);
36600         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
36601         val_conv = UserConfig_clone(&val_conv);
36602         ChannelManagerReadArgs_set_default_config(&this_ptr_conv, val_conv);
36603 }
36604
36605 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) {
36606         void* entropy_source_ptr = untag_ptr(entropy_source);
36607         CHECK_ACCESS(entropy_source_ptr);
36608         LDKEntropySource entropy_source_conv = *(LDKEntropySource*)(entropy_source_ptr);
36609         if (entropy_source_conv.free == LDKEntropySource_JCalls_free) {
36610                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
36611                 LDKEntropySource_JCalls_cloned(&entropy_source_conv);
36612         }
36613         void* node_signer_ptr = untag_ptr(node_signer);
36614         CHECK_ACCESS(node_signer_ptr);
36615         LDKNodeSigner node_signer_conv = *(LDKNodeSigner*)(node_signer_ptr);
36616         if (node_signer_conv.free == LDKNodeSigner_JCalls_free) {
36617                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
36618                 LDKNodeSigner_JCalls_cloned(&node_signer_conv);
36619         }
36620         void* signer_provider_ptr = untag_ptr(signer_provider);
36621         CHECK_ACCESS(signer_provider_ptr);
36622         LDKSignerProvider signer_provider_conv = *(LDKSignerProvider*)(signer_provider_ptr);
36623         if (signer_provider_conv.free == LDKSignerProvider_JCalls_free) {
36624                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
36625                 LDKSignerProvider_JCalls_cloned(&signer_provider_conv);
36626         }
36627         void* fee_estimator_ptr = untag_ptr(fee_estimator);
36628         CHECK_ACCESS(fee_estimator_ptr);
36629         LDKFeeEstimator fee_estimator_conv = *(LDKFeeEstimator*)(fee_estimator_ptr);
36630         if (fee_estimator_conv.free == LDKFeeEstimator_JCalls_free) {
36631                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
36632                 LDKFeeEstimator_JCalls_cloned(&fee_estimator_conv);
36633         }
36634         void* chain_monitor_ptr = untag_ptr(chain_monitor);
36635         CHECK_ACCESS(chain_monitor_ptr);
36636         LDKWatch chain_monitor_conv = *(LDKWatch*)(chain_monitor_ptr);
36637         if (chain_monitor_conv.free == LDKWatch_JCalls_free) {
36638                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
36639                 LDKWatch_JCalls_cloned(&chain_monitor_conv);
36640         }
36641         void* tx_broadcaster_ptr = untag_ptr(tx_broadcaster);
36642         CHECK_ACCESS(tx_broadcaster_ptr);
36643         LDKBroadcasterInterface tx_broadcaster_conv = *(LDKBroadcasterInterface*)(tx_broadcaster_ptr);
36644         if (tx_broadcaster_conv.free == LDKBroadcasterInterface_JCalls_free) {
36645                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
36646                 LDKBroadcasterInterface_JCalls_cloned(&tx_broadcaster_conv);
36647         }
36648         void* router_ptr = untag_ptr(router);
36649         CHECK_ACCESS(router_ptr);
36650         LDKRouter router_conv = *(LDKRouter*)(router_ptr);
36651         if (router_conv.free == LDKRouter_JCalls_free) {
36652                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
36653                 LDKRouter_JCalls_cloned(&router_conv);
36654         }
36655         void* logger_ptr = untag_ptr(logger);
36656         CHECK_ACCESS(logger_ptr);
36657         LDKLogger logger_conv = *(LDKLogger*)(logger_ptr);
36658         if (logger_conv.free == LDKLogger_JCalls_free) {
36659                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
36660                 LDKLogger_JCalls_cloned(&logger_conv);
36661         }
36662         LDKUserConfig default_config_conv;
36663         default_config_conv.inner = untag_ptr(default_config);
36664         default_config_conv.is_owned = ptr_is_owned(default_config);
36665         CHECK_INNER_FIELD_ACCESS_OR_NULL(default_config_conv);
36666         default_config_conv = UserConfig_clone(&default_config_conv);
36667         LDKCVec_ChannelMonitorZ channel_monitors_constr;
36668         channel_monitors_constr.datalen = channel_monitors->arr_len;
36669         if (channel_monitors_constr.datalen > 0)
36670                 channel_monitors_constr.data = MALLOC(channel_monitors_constr.datalen * sizeof(LDKChannelMonitor), "LDKCVec_ChannelMonitorZ Elements");
36671         else
36672                 channel_monitors_constr.data = NULL;
36673         uint64_t* channel_monitors_vals = channel_monitors->elems;
36674         for (size_t q = 0; q < channel_monitors_constr.datalen; q++) {
36675                 uint64_t channel_monitors_conv_16 = channel_monitors_vals[q];
36676                 LDKChannelMonitor channel_monitors_conv_16_conv;
36677                 channel_monitors_conv_16_conv.inner = untag_ptr(channel_monitors_conv_16);
36678                 channel_monitors_conv_16_conv.is_owned = ptr_is_owned(channel_monitors_conv_16);
36679                 CHECK_INNER_FIELD_ACCESS_OR_NULL(channel_monitors_conv_16_conv);
36680                 channel_monitors_conv_16_conv.is_owned = false;
36681                 channel_monitors_constr.data[q] = channel_monitors_conv_16_conv;
36682         }
36683         FREE(channel_monitors);
36684         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);
36685         uint64_t ret_ref = 0;
36686         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
36687         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
36688         return ret_ref;
36689 }
36690
36691 uint64_t  __attribute__((export_name("TS_C2Tuple_ThirtyTwoBytesChannelManagerZ_read"))) TS_C2Tuple_ThirtyTwoBytesChannelManagerZ_read(int8_tArray ser, uint64_t arg) {
36692         LDKu8slice ser_ref;
36693         ser_ref.datalen = ser->arr_len;
36694         ser_ref.data = ser->elems;
36695         LDKChannelManagerReadArgs arg_conv;
36696         arg_conv.inner = untag_ptr(arg);
36697         arg_conv.is_owned = ptr_is_owned(arg);
36698         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
36699         // WARNING: we need a move here but no clone is available for LDKChannelManagerReadArgs
36700         
36701         LDKCResult_C2Tuple_ThirtyTwoBytesChannelManagerZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_ThirtyTwoBytesChannelManagerZDecodeErrorZ), "LDKCResult_C2Tuple_ThirtyTwoBytesChannelManagerZDecodeErrorZ");
36702         *ret_conv = C2Tuple_ThirtyTwoBytesChannelManagerZ_read(ser_ref, arg_conv);
36703         FREE(ser);
36704         return tag_ptr(ret_conv, true);
36705 }
36706
36707 void  __attribute__((export_name("TS_ExpandedKey_free"))) TS_ExpandedKey_free(uint64_t this_obj) {
36708         LDKExpandedKey this_obj_conv;
36709         this_obj_conv.inner = untag_ptr(this_obj);
36710         this_obj_conv.is_owned = ptr_is_owned(this_obj);
36711         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
36712         ExpandedKey_free(this_obj_conv);
36713 }
36714
36715 uint64_t  __attribute__((export_name("TS_ExpandedKey_new"))) TS_ExpandedKey_new(int8_tArray key_material) {
36716         uint8_t key_material_arr[32];
36717         CHECK(key_material->arr_len == 32);
36718         memcpy(key_material_arr, key_material->elems, 32); FREE(key_material);
36719         uint8_t (*key_material_ref)[32] = &key_material_arr;
36720         LDKExpandedKey ret_var = ExpandedKey_new(key_material_ref);
36721         uint64_t ret_ref = 0;
36722         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
36723         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
36724         return ret_ref;
36725 }
36726
36727 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) {
36728         LDKExpandedKey keys_conv;
36729         keys_conv.inner = untag_ptr(keys);
36730         keys_conv.is_owned = ptr_is_owned(keys);
36731         CHECK_INNER_FIELD_ACCESS_OR_NULL(keys_conv);
36732         keys_conv.is_owned = false;
36733         void* min_value_msat_ptr = untag_ptr(min_value_msat);
36734         CHECK_ACCESS(min_value_msat_ptr);
36735         LDKCOption_u64Z min_value_msat_conv = *(LDKCOption_u64Z*)(min_value_msat_ptr);
36736         min_value_msat_conv = COption_u64Z_clone((LDKCOption_u64Z*)untag_ptr(min_value_msat));
36737         void* entropy_source_ptr = untag_ptr(entropy_source);
36738         if (ptr_is_owned(entropy_source)) { CHECK_ACCESS(entropy_source_ptr); }
36739         LDKEntropySource* entropy_source_conv = (LDKEntropySource*)entropy_source_ptr;
36740         void* min_final_cltv_expiry_delta_ptr = untag_ptr(min_final_cltv_expiry_delta);
36741         CHECK_ACCESS(min_final_cltv_expiry_delta_ptr);
36742         LDKCOption_u16Z min_final_cltv_expiry_delta_conv = *(LDKCOption_u16Z*)(min_final_cltv_expiry_delta_ptr);
36743         min_final_cltv_expiry_delta_conv = COption_u16Z_clone((LDKCOption_u16Z*)untag_ptr(min_final_cltv_expiry_delta));
36744         LDKCResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZNoneZ), "LDKCResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZNoneZ");
36745         *ret_conv = create(&keys_conv, min_value_msat_conv, invoice_expiry_delta_secs, entropy_source_conv, current_time, min_final_cltv_expiry_delta_conv);
36746         return tag_ptr(ret_conv, true);
36747 }
36748
36749 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) {
36750         LDKExpandedKey keys_conv;
36751         keys_conv.inner = untag_ptr(keys);
36752         keys_conv.is_owned = ptr_is_owned(keys);
36753         CHECK_INNER_FIELD_ACCESS_OR_NULL(keys_conv);
36754         keys_conv.is_owned = false;
36755         void* min_value_msat_ptr = untag_ptr(min_value_msat);
36756         CHECK_ACCESS(min_value_msat_ptr);
36757         LDKCOption_u64Z min_value_msat_conv = *(LDKCOption_u64Z*)(min_value_msat_ptr);
36758         min_value_msat_conv = COption_u64Z_clone((LDKCOption_u64Z*)untag_ptr(min_value_msat));
36759         LDKThirtyTwoBytes payment_hash_ref;
36760         CHECK(payment_hash->arr_len == 32);
36761         memcpy(payment_hash_ref.data, payment_hash->elems, 32); FREE(payment_hash);
36762         void* min_final_cltv_expiry_delta_ptr = untag_ptr(min_final_cltv_expiry_delta);
36763         CHECK_ACCESS(min_final_cltv_expiry_delta_ptr);
36764         LDKCOption_u16Z min_final_cltv_expiry_delta_conv = *(LDKCOption_u16Z*)(min_final_cltv_expiry_delta_ptr);
36765         min_final_cltv_expiry_delta_conv = COption_u16Z_clone((LDKCOption_u16Z*)untag_ptr(min_final_cltv_expiry_delta));
36766         LDKCResult_ThirtyTwoBytesNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_ThirtyTwoBytesNoneZ), "LDKCResult_ThirtyTwoBytesNoneZ");
36767         *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);
36768         return tag_ptr(ret_conv, true);
36769 }
36770
36771 void  __attribute__((export_name("TS_DecodeError_free"))) TS_DecodeError_free(uint64_t this_ptr) {
36772         if (!ptr_is_owned(this_ptr)) return;
36773         void* this_ptr_ptr = untag_ptr(this_ptr);
36774         CHECK_ACCESS(this_ptr_ptr);
36775         LDKDecodeError this_ptr_conv = *(LDKDecodeError*)(this_ptr_ptr);
36776         FREE(untag_ptr(this_ptr));
36777         DecodeError_free(this_ptr_conv);
36778 }
36779
36780 static inline uint64_t DecodeError_clone_ptr(LDKDecodeError *NONNULL_PTR arg) {
36781         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
36782         *ret_copy = DecodeError_clone(arg);
36783         uint64_t ret_ref = tag_ptr(ret_copy, true);
36784         return ret_ref;
36785 }
36786 int64_t  __attribute__((export_name("TS_DecodeError_clone_ptr"))) TS_DecodeError_clone_ptr(uint64_t arg) {
36787         LDKDecodeError* arg_conv = (LDKDecodeError*)untag_ptr(arg);
36788         int64_t ret_conv = DecodeError_clone_ptr(arg_conv);
36789         return ret_conv;
36790 }
36791
36792 uint64_t  __attribute__((export_name("TS_DecodeError_clone"))) TS_DecodeError_clone(uint64_t orig) {
36793         LDKDecodeError* orig_conv = (LDKDecodeError*)untag_ptr(orig);
36794         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
36795         *ret_copy = DecodeError_clone(orig_conv);
36796         uint64_t ret_ref = tag_ptr(ret_copy, true);
36797         return ret_ref;
36798 }
36799
36800 uint64_t  __attribute__((export_name("TS_DecodeError_unknown_version"))) TS_DecodeError_unknown_version() {
36801         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
36802         *ret_copy = DecodeError_unknown_version();
36803         uint64_t ret_ref = tag_ptr(ret_copy, true);
36804         return ret_ref;
36805 }
36806
36807 uint64_t  __attribute__((export_name("TS_DecodeError_unknown_required_feature"))) TS_DecodeError_unknown_required_feature() {
36808         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
36809         *ret_copy = DecodeError_unknown_required_feature();
36810         uint64_t ret_ref = tag_ptr(ret_copy, true);
36811         return ret_ref;
36812 }
36813
36814 uint64_t  __attribute__((export_name("TS_DecodeError_invalid_value"))) TS_DecodeError_invalid_value() {
36815         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
36816         *ret_copy = DecodeError_invalid_value();
36817         uint64_t ret_ref = tag_ptr(ret_copy, true);
36818         return ret_ref;
36819 }
36820
36821 uint64_t  __attribute__((export_name("TS_DecodeError_short_read"))) TS_DecodeError_short_read() {
36822         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
36823         *ret_copy = DecodeError_short_read();
36824         uint64_t ret_ref = tag_ptr(ret_copy, true);
36825         return ret_ref;
36826 }
36827
36828 uint64_t  __attribute__((export_name("TS_DecodeError_bad_length_descriptor"))) TS_DecodeError_bad_length_descriptor() {
36829         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
36830         *ret_copy = DecodeError_bad_length_descriptor();
36831         uint64_t ret_ref = tag_ptr(ret_copy, true);
36832         return ret_ref;
36833 }
36834
36835 uint64_t  __attribute__((export_name("TS_DecodeError_io"))) TS_DecodeError_io(uint32_t a) {
36836         LDKIOError a_conv = LDKIOError_from_js(a);
36837         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
36838         *ret_copy = DecodeError_io(a_conv);
36839         uint64_t ret_ref = tag_ptr(ret_copy, true);
36840         return ret_ref;
36841 }
36842
36843 uint64_t  __attribute__((export_name("TS_DecodeError_unsupported_compression"))) TS_DecodeError_unsupported_compression() {
36844         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
36845         *ret_copy = DecodeError_unsupported_compression();
36846         uint64_t ret_ref = tag_ptr(ret_copy, true);
36847         return ret_ref;
36848 }
36849
36850 jboolean  __attribute__((export_name("TS_DecodeError_eq"))) TS_DecodeError_eq(uint64_t a, uint64_t b) {
36851         LDKDecodeError* a_conv = (LDKDecodeError*)untag_ptr(a);
36852         LDKDecodeError* b_conv = (LDKDecodeError*)untag_ptr(b);
36853         jboolean ret_conv = DecodeError_eq(a_conv, b_conv);
36854         return ret_conv;
36855 }
36856
36857 void  __attribute__((export_name("TS_Init_free"))) TS_Init_free(uint64_t this_obj) {
36858         LDKInit this_obj_conv;
36859         this_obj_conv.inner = untag_ptr(this_obj);
36860         this_obj_conv.is_owned = ptr_is_owned(this_obj);
36861         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
36862         Init_free(this_obj_conv);
36863 }
36864
36865 uint64_t  __attribute__((export_name("TS_Init_get_features"))) TS_Init_get_features(uint64_t this_ptr) {
36866         LDKInit this_ptr_conv;
36867         this_ptr_conv.inner = untag_ptr(this_ptr);
36868         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
36869         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
36870         this_ptr_conv.is_owned = false;
36871         LDKInitFeatures ret_var = Init_get_features(&this_ptr_conv);
36872         uint64_t ret_ref = 0;
36873         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
36874         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
36875         return ret_ref;
36876 }
36877
36878 void  __attribute__((export_name("TS_Init_set_features"))) TS_Init_set_features(uint64_t this_ptr, uint64_t val) {
36879         LDKInit this_ptr_conv;
36880         this_ptr_conv.inner = untag_ptr(this_ptr);
36881         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
36882         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
36883         this_ptr_conv.is_owned = false;
36884         LDKInitFeatures val_conv;
36885         val_conv.inner = untag_ptr(val);
36886         val_conv.is_owned = ptr_is_owned(val);
36887         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
36888         val_conv = InitFeatures_clone(&val_conv);
36889         Init_set_features(&this_ptr_conv, val_conv);
36890 }
36891
36892 uint64_t  __attribute__((export_name("TS_Init_get_networks"))) TS_Init_get_networks(uint64_t this_ptr) {
36893         LDKInit this_ptr_conv;
36894         this_ptr_conv.inner = untag_ptr(this_ptr);
36895         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
36896         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
36897         this_ptr_conv.is_owned = false;
36898         LDKCOption_CVec_ThirtyTwoBytesZZ *ret_copy = MALLOC(sizeof(LDKCOption_CVec_ThirtyTwoBytesZZ), "LDKCOption_CVec_ThirtyTwoBytesZZ");
36899         *ret_copy = Init_get_networks(&this_ptr_conv);
36900         uint64_t ret_ref = tag_ptr(ret_copy, true);
36901         return ret_ref;
36902 }
36903
36904 void  __attribute__((export_name("TS_Init_set_networks"))) TS_Init_set_networks(uint64_t this_ptr, uint64_t val) {
36905         LDKInit this_ptr_conv;
36906         this_ptr_conv.inner = untag_ptr(this_ptr);
36907         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
36908         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
36909         this_ptr_conv.is_owned = false;
36910         void* val_ptr = untag_ptr(val);
36911         CHECK_ACCESS(val_ptr);
36912         LDKCOption_CVec_ThirtyTwoBytesZZ val_conv = *(LDKCOption_CVec_ThirtyTwoBytesZZ*)(val_ptr);
36913         val_conv = COption_CVec_ThirtyTwoBytesZZ_clone((LDKCOption_CVec_ThirtyTwoBytesZZ*)untag_ptr(val));
36914         Init_set_networks(&this_ptr_conv, val_conv);
36915 }
36916
36917 uint64_t  __attribute__((export_name("TS_Init_get_remote_network_address"))) TS_Init_get_remote_network_address(uint64_t this_ptr) {
36918         LDKInit this_ptr_conv;
36919         this_ptr_conv.inner = untag_ptr(this_ptr);
36920         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
36921         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
36922         this_ptr_conv.is_owned = false;
36923         LDKCOption_SocketAddressZ *ret_copy = MALLOC(sizeof(LDKCOption_SocketAddressZ), "LDKCOption_SocketAddressZ");
36924         *ret_copy = Init_get_remote_network_address(&this_ptr_conv);
36925         uint64_t ret_ref = tag_ptr(ret_copy, true);
36926         return ret_ref;
36927 }
36928
36929 void  __attribute__((export_name("TS_Init_set_remote_network_address"))) TS_Init_set_remote_network_address(uint64_t this_ptr, uint64_t val) {
36930         LDKInit this_ptr_conv;
36931         this_ptr_conv.inner = untag_ptr(this_ptr);
36932         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
36933         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
36934         this_ptr_conv.is_owned = false;
36935         void* val_ptr = untag_ptr(val);
36936         CHECK_ACCESS(val_ptr);
36937         LDKCOption_SocketAddressZ val_conv = *(LDKCOption_SocketAddressZ*)(val_ptr);
36938         val_conv = COption_SocketAddressZ_clone((LDKCOption_SocketAddressZ*)untag_ptr(val));
36939         Init_set_remote_network_address(&this_ptr_conv, val_conv);
36940 }
36941
36942 uint64_t  __attribute__((export_name("TS_Init_new"))) TS_Init_new(uint64_t features_arg, uint64_t networks_arg, uint64_t remote_network_address_arg) {
36943         LDKInitFeatures features_arg_conv;
36944         features_arg_conv.inner = untag_ptr(features_arg);
36945         features_arg_conv.is_owned = ptr_is_owned(features_arg);
36946         CHECK_INNER_FIELD_ACCESS_OR_NULL(features_arg_conv);
36947         features_arg_conv = InitFeatures_clone(&features_arg_conv);
36948         void* networks_arg_ptr = untag_ptr(networks_arg);
36949         CHECK_ACCESS(networks_arg_ptr);
36950         LDKCOption_CVec_ThirtyTwoBytesZZ networks_arg_conv = *(LDKCOption_CVec_ThirtyTwoBytesZZ*)(networks_arg_ptr);
36951         networks_arg_conv = COption_CVec_ThirtyTwoBytesZZ_clone((LDKCOption_CVec_ThirtyTwoBytesZZ*)untag_ptr(networks_arg));
36952         void* remote_network_address_arg_ptr = untag_ptr(remote_network_address_arg);
36953         CHECK_ACCESS(remote_network_address_arg_ptr);
36954         LDKCOption_SocketAddressZ remote_network_address_arg_conv = *(LDKCOption_SocketAddressZ*)(remote_network_address_arg_ptr);
36955         LDKInit ret_var = Init_new(features_arg_conv, networks_arg_conv, remote_network_address_arg_conv);
36956         uint64_t ret_ref = 0;
36957         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
36958         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
36959         return ret_ref;
36960 }
36961
36962 static inline uint64_t Init_clone_ptr(LDKInit *NONNULL_PTR arg) {
36963         LDKInit ret_var = Init_clone(arg);
36964         uint64_t ret_ref = 0;
36965         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
36966         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
36967         return ret_ref;
36968 }
36969 int64_t  __attribute__((export_name("TS_Init_clone_ptr"))) TS_Init_clone_ptr(uint64_t arg) {
36970         LDKInit arg_conv;
36971         arg_conv.inner = untag_ptr(arg);
36972         arg_conv.is_owned = ptr_is_owned(arg);
36973         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
36974         arg_conv.is_owned = false;
36975         int64_t ret_conv = Init_clone_ptr(&arg_conv);
36976         return ret_conv;
36977 }
36978
36979 uint64_t  __attribute__((export_name("TS_Init_clone"))) TS_Init_clone(uint64_t orig) {
36980         LDKInit orig_conv;
36981         orig_conv.inner = untag_ptr(orig);
36982         orig_conv.is_owned = ptr_is_owned(orig);
36983         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
36984         orig_conv.is_owned = false;
36985         LDKInit ret_var = Init_clone(&orig_conv);
36986         uint64_t ret_ref = 0;
36987         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
36988         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
36989         return ret_ref;
36990 }
36991
36992 jboolean  __attribute__((export_name("TS_Init_eq"))) TS_Init_eq(uint64_t a, uint64_t b) {
36993         LDKInit a_conv;
36994         a_conv.inner = untag_ptr(a);
36995         a_conv.is_owned = ptr_is_owned(a);
36996         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
36997         a_conv.is_owned = false;
36998         LDKInit b_conv;
36999         b_conv.inner = untag_ptr(b);
37000         b_conv.is_owned = ptr_is_owned(b);
37001         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
37002         b_conv.is_owned = false;
37003         jboolean ret_conv = Init_eq(&a_conv, &b_conv);
37004         return ret_conv;
37005 }
37006
37007 void  __attribute__((export_name("TS_ErrorMessage_free"))) TS_ErrorMessage_free(uint64_t this_obj) {
37008         LDKErrorMessage this_obj_conv;
37009         this_obj_conv.inner = untag_ptr(this_obj);
37010         this_obj_conv.is_owned = ptr_is_owned(this_obj);
37011         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
37012         ErrorMessage_free(this_obj_conv);
37013 }
37014
37015 int8_tArray  __attribute__((export_name("TS_ErrorMessage_get_channel_id"))) TS_ErrorMessage_get_channel_id(uint64_t this_ptr) {
37016         LDKErrorMessage this_ptr_conv;
37017         this_ptr_conv.inner = untag_ptr(this_ptr);
37018         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
37019         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
37020         this_ptr_conv.is_owned = false;
37021         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
37022         memcpy(ret_arr->elems, *ErrorMessage_get_channel_id(&this_ptr_conv), 32);
37023         return ret_arr;
37024 }
37025
37026 void  __attribute__((export_name("TS_ErrorMessage_set_channel_id"))) TS_ErrorMessage_set_channel_id(uint64_t this_ptr, int8_tArray val) {
37027         LDKErrorMessage this_ptr_conv;
37028         this_ptr_conv.inner = untag_ptr(this_ptr);
37029         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
37030         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
37031         this_ptr_conv.is_owned = false;
37032         LDKThirtyTwoBytes val_ref;
37033         CHECK(val->arr_len == 32);
37034         memcpy(val_ref.data, val->elems, 32); FREE(val);
37035         ErrorMessage_set_channel_id(&this_ptr_conv, val_ref);
37036 }
37037
37038 jstring  __attribute__((export_name("TS_ErrorMessage_get_data"))) TS_ErrorMessage_get_data(uint64_t this_ptr) {
37039         LDKErrorMessage this_ptr_conv;
37040         this_ptr_conv.inner = untag_ptr(this_ptr);
37041         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
37042         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
37043         this_ptr_conv.is_owned = false;
37044         LDKStr ret_str = ErrorMessage_get_data(&this_ptr_conv);
37045         jstring ret_conv = str_ref_to_ts(ret_str.chars, ret_str.len);
37046         Str_free(ret_str);
37047         return ret_conv;
37048 }
37049
37050 void  __attribute__((export_name("TS_ErrorMessage_set_data"))) TS_ErrorMessage_set_data(uint64_t this_ptr, jstring val) {
37051         LDKErrorMessage this_ptr_conv;
37052         this_ptr_conv.inner = untag_ptr(this_ptr);
37053         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
37054         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
37055         this_ptr_conv.is_owned = false;
37056         LDKStr val_conv = str_ref_to_owned_c(val);
37057         ErrorMessage_set_data(&this_ptr_conv, val_conv);
37058 }
37059
37060 uint64_t  __attribute__((export_name("TS_ErrorMessage_new"))) TS_ErrorMessage_new(int8_tArray channel_id_arg, jstring data_arg) {
37061         LDKThirtyTwoBytes channel_id_arg_ref;
37062         CHECK(channel_id_arg->arr_len == 32);
37063         memcpy(channel_id_arg_ref.data, channel_id_arg->elems, 32); FREE(channel_id_arg);
37064         LDKStr data_arg_conv = str_ref_to_owned_c(data_arg);
37065         LDKErrorMessage ret_var = ErrorMessage_new(channel_id_arg_ref, data_arg_conv);
37066         uint64_t ret_ref = 0;
37067         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
37068         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
37069         return ret_ref;
37070 }
37071
37072 static inline uint64_t ErrorMessage_clone_ptr(LDKErrorMessage *NONNULL_PTR arg) {
37073         LDKErrorMessage ret_var = ErrorMessage_clone(arg);
37074         uint64_t ret_ref = 0;
37075         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
37076         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
37077         return ret_ref;
37078 }
37079 int64_t  __attribute__((export_name("TS_ErrorMessage_clone_ptr"))) TS_ErrorMessage_clone_ptr(uint64_t arg) {
37080         LDKErrorMessage arg_conv;
37081         arg_conv.inner = untag_ptr(arg);
37082         arg_conv.is_owned = ptr_is_owned(arg);
37083         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
37084         arg_conv.is_owned = false;
37085         int64_t ret_conv = ErrorMessage_clone_ptr(&arg_conv);
37086         return ret_conv;
37087 }
37088
37089 uint64_t  __attribute__((export_name("TS_ErrorMessage_clone"))) TS_ErrorMessage_clone(uint64_t orig) {
37090         LDKErrorMessage orig_conv;
37091         orig_conv.inner = untag_ptr(orig);
37092         orig_conv.is_owned = ptr_is_owned(orig);
37093         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
37094         orig_conv.is_owned = false;
37095         LDKErrorMessage ret_var = ErrorMessage_clone(&orig_conv);
37096         uint64_t ret_ref = 0;
37097         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
37098         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
37099         return ret_ref;
37100 }
37101
37102 jboolean  __attribute__((export_name("TS_ErrorMessage_eq"))) TS_ErrorMessage_eq(uint64_t a, uint64_t b) {
37103         LDKErrorMessage a_conv;
37104         a_conv.inner = untag_ptr(a);
37105         a_conv.is_owned = ptr_is_owned(a);
37106         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
37107         a_conv.is_owned = false;
37108         LDKErrorMessage b_conv;
37109         b_conv.inner = untag_ptr(b);
37110         b_conv.is_owned = ptr_is_owned(b);
37111         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
37112         b_conv.is_owned = false;
37113         jboolean ret_conv = ErrorMessage_eq(&a_conv, &b_conv);
37114         return ret_conv;
37115 }
37116
37117 void  __attribute__((export_name("TS_WarningMessage_free"))) TS_WarningMessage_free(uint64_t this_obj) {
37118         LDKWarningMessage this_obj_conv;
37119         this_obj_conv.inner = untag_ptr(this_obj);
37120         this_obj_conv.is_owned = ptr_is_owned(this_obj);
37121         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
37122         WarningMessage_free(this_obj_conv);
37123 }
37124
37125 int8_tArray  __attribute__((export_name("TS_WarningMessage_get_channel_id"))) TS_WarningMessage_get_channel_id(uint64_t this_ptr) {
37126         LDKWarningMessage this_ptr_conv;
37127         this_ptr_conv.inner = untag_ptr(this_ptr);
37128         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
37129         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
37130         this_ptr_conv.is_owned = false;
37131         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
37132         memcpy(ret_arr->elems, *WarningMessage_get_channel_id(&this_ptr_conv), 32);
37133         return ret_arr;
37134 }
37135
37136 void  __attribute__((export_name("TS_WarningMessage_set_channel_id"))) TS_WarningMessage_set_channel_id(uint64_t this_ptr, int8_tArray val) {
37137         LDKWarningMessage this_ptr_conv;
37138         this_ptr_conv.inner = untag_ptr(this_ptr);
37139         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
37140         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
37141         this_ptr_conv.is_owned = false;
37142         LDKThirtyTwoBytes val_ref;
37143         CHECK(val->arr_len == 32);
37144         memcpy(val_ref.data, val->elems, 32); FREE(val);
37145         WarningMessage_set_channel_id(&this_ptr_conv, val_ref);
37146 }
37147
37148 jstring  __attribute__((export_name("TS_WarningMessage_get_data"))) TS_WarningMessage_get_data(uint64_t this_ptr) {
37149         LDKWarningMessage this_ptr_conv;
37150         this_ptr_conv.inner = untag_ptr(this_ptr);
37151         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
37152         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
37153         this_ptr_conv.is_owned = false;
37154         LDKStr ret_str = WarningMessage_get_data(&this_ptr_conv);
37155         jstring ret_conv = str_ref_to_ts(ret_str.chars, ret_str.len);
37156         Str_free(ret_str);
37157         return ret_conv;
37158 }
37159
37160 void  __attribute__((export_name("TS_WarningMessage_set_data"))) TS_WarningMessage_set_data(uint64_t this_ptr, jstring val) {
37161         LDKWarningMessage this_ptr_conv;
37162         this_ptr_conv.inner = untag_ptr(this_ptr);
37163         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
37164         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
37165         this_ptr_conv.is_owned = false;
37166         LDKStr val_conv = str_ref_to_owned_c(val);
37167         WarningMessage_set_data(&this_ptr_conv, val_conv);
37168 }
37169
37170 uint64_t  __attribute__((export_name("TS_WarningMessage_new"))) TS_WarningMessage_new(int8_tArray channel_id_arg, jstring data_arg) {
37171         LDKThirtyTwoBytes channel_id_arg_ref;
37172         CHECK(channel_id_arg->arr_len == 32);
37173         memcpy(channel_id_arg_ref.data, channel_id_arg->elems, 32); FREE(channel_id_arg);
37174         LDKStr data_arg_conv = str_ref_to_owned_c(data_arg);
37175         LDKWarningMessage ret_var = WarningMessage_new(channel_id_arg_ref, data_arg_conv);
37176         uint64_t ret_ref = 0;
37177         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
37178         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
37179         return ret_ref;
37180 }
37181
37182 static inline uint64_t WarningMessage_clone_ptr(LDKWarningMessage *NONNULL_PTR arg) {
37183         LDKWarningMessage ret_var = WarningMessage_clone(arg);
37184         uint64_t ret_ref = 0;
37185         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
37186         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
37187         return ret_ref;
37188 }
37189 int64_t  __attribute__((export_name("TS_WarningMessage_clone_ptr"))) TS_WarningMessage_clone_ptr(uint64_t arg) {
37190         LDKWarningMessage arg_conv;
37191         arg_conv.inner = untag_ptr(arg);
37192         arg_conv.is_owned = ptr_is_owned(arg);
37193         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
37194         arg_conv.is_owned = false;
37195         int64_t ret_conv = WarningMessage_clone_ptr(&arg_conv);
37196         return ret_conv;
37197 }
37198
37199 uint64_t  __attribute__((export_name("TS_WarningMessage_clone"))) TS_WarningMessage_clone(uint64_t orig) {
37200         LDKWarningMessage orig_conv;
37201         orig_conv.inner = untag_ptr(orig);
37202         orig_conv.is_owned = ptr_is_owned(orig);
37203         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
37204         orig_conv.is_owned = false;
37205         LDKWarningMessage ret_var = WarningMessage_clone(&orig_conv);
37206         uint64_t ret_ref = 0;
37207         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
37208         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
37209         return ret_ref;
37210 }
37211
37212 jboolean  __attribute__((export_name("TS_WarningMessage_eq"))) TS_WarningMessage_eq(uint64_t a, uint64_t b) {
37213         LDKWarningMessage a_conv;
37214         a_conv.inner = untag_ptr(a);
37215         a_conv.is_owned = ptr_is_owned(a);
37216         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
37217         a_conv.is_owned = false;
37218         LDKWarningMessage b_conv;
37219         b_conv.inner = untag_ptr(b);
37220         b_conv.is_owned = ptr_is_owned(b);
37221         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
37222         b_conv.is_owned = false;
37223         jboolean ret_conv = WarningMessage_eq(&a_conv, &b_conv);
37224         return ret_conv;
37225 }
37226
37227 void  __attribute__((export_name("TS_Ping_free"))) TS_Ping_free(uint64_t this_obj) {
37228         LDKPing this_obj_conv;
37229         this_obj_conv.inner = untag_ptr(this_obj);
37230         this_obj_conv.is_owned = ptr_is_owned(this_obj);
37231         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
37232         Ping_free(this_obj_conv);
37233 }
37234
37235 int16_t  __attribute__((export_name("TS_Ping_get_ponglen"))) TS_Ping_get_ponglen(uint64_t this_ptr) {
37236         LDKPing this_ptr_conv;
37237         this_ptr_conv.inner = untag_ptr(this_ptr);
37238         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
37239         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
37240         this_ptr_conv.is_owned = false;
37241         int16_t ret_conv = Ping_get_ponglen(&this_ptr_conv);
37242         return ret_conv;
37243 }
37244
37245 void  __attribute__((export_name("TS_Ping_set_ponglen"))) TS_Ping_set_ponglen(uint64_t this_ptr, int16_t val) {
37246         LDKPing this_ptr_conv;
37247         this_ptr_conv.inner = untag_ptr(this_ptr);
37248         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
37249         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
37250         this_ptr_conv.is_owned = false;
37251         Ping_set_ponglen(&this_ptr_conv, val);
37252 }
37253
37254 int16_t  __attribute__((export_name("TS_Ping_get_byteslen"))) TS_Ping_get_byteslen(uint64_t this_ptr) {
37255         LDKPing this_ptr_conv;
37256         this_ptr_conv.inner = untag_ptr(this_ptr);
37257         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
37258         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
37259         this_ptr_conv.is_owned = false;
37260         int16_t ret_conv = Ping_get_byteslen(&this_ptr_conv);
37261         return ret_conv;
37262 }
37263
37264 void  __attribute__((export_name("TS_Ping_set_byteslen"))) TS_Ping_set_byteslen(uint64_t this_ptr, int16_t val) {
37265         LDKPing this_ptr_conv;
37266         this_ptr_conv.inner = untag_ptr(this_ptr);
37267         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
37268         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
37269         this_ptr_conv.is_owned = false;
37270         Ping_set_byteslen(&this_ptr_conv, val);
37271 }
37272
37273 uint64_t  __attribute__((export_name("TS_Ping_new"))) TS_Ping_new(int16_t ponglen_arg, int16_t byteslen_arg) {
37274         LDKPing ret_var = Ping_new(ponglen_arg, byteslen_arg);
37275         uint64_t ret_ref = 0;
37276         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
37277         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
37278         return ret_ref;
37279 }
37280
37281 static inline uint64_t Ping_clone_ptr(LDKPing *NONNULL_PTR arg) {
37282         LDKPing ret_var = Ping_clone(arg);
37283         uint64_t ret_ref = 0;
37284         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
37285         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
37286         return ret_ref;
37287 }
37288 int64_t  __attribute__((export_name("TS_Ping_clone_ptr"))) TS_Ping_clone_ptr(uint64_t arg) {
37289         LDKPing arg_conv;
37290         arg_conv.inner = untag_ptr(arg);
37291         arg_conv.is_owned = ptr_is_owned(arg);
37292         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
37293         arg_conv.is_owned = false;
37294         int64_t ret_conv = Ping_clone_ptr(&arg_conv);
37295         return ret_conv;
37296 }
37297
37298 uint64_t  __attribute__((export_name("TS_Ping_clone"))) TS_Ping_clone(uint64_t orig) {
37299         LDKPing orig_conv;
37300         orig_conv.inner = untag_ptr(orig);
37301         orig_conv.is_owned = ptr_is_owned(orig);
37302         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
37303         orig_conv.is_owned = false;
37304         LDKPing ret_var = Ping_clone(&orig_conv);
37305         uint64_t ret_ref = 0;
37306         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
37307         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
37308         return ret_ref;
37309 }
37310
37311 jboolean  __attribute__((export_name("TS_Ping_eq"))) TS_Ping_eq(uint64_t a, uint64_t b) {
37312         LDKPing a_conv;
37313         a_conv.inner = untag_ptr(a);
37314         a_conv.is_owned = ptr_is_owned(a);
37315         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
37316         a_conv.is_owned = false;
37317         LDKPing b_conv;
37318         b_conv.inner = untag_ptr(b);
37319         b_conv.is_owned = ptr_is_owned(b);
37320         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
37321         b_conv.is_owned = false;
37322         jboolean ret_conv = Ping_eq(&a_conv, &b_conv);
37323         return ret_conv;
37324 }
37325
37326 void  __attribute__((export_name("TS_Pong_free"))) TS_Pong_free(uint64_t this_obj) {
37327         LDKPong this_obj_conv;
37328         this_obj_conv.inner = untag_ptr(this_obj);
37329         this_obj_conv.is_owned = ptr_is_owned(this_obj);
37330         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
37331         Pong_free(this_obj_conv);
37332 }
37333
37334 int16_t  __attribute__((export_name("TS_Pong_get_byteslen"))) TS_Pong_get_byteslen(uint64_t this_ptr) {
37335         LDKPong this_ptr_conv;
37336         this_ptr_conv.inner = untag_ptr(this_ptr);
37337         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
37338         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
37339         this_ptr_conv.is_owned = false;
37340         int16_t ret_conv = Pong_get_byteslen(&this_ptr_conv);
37341         return ret_conv;
37342 }
37343
37344 void  __attribute__((export_name("TS_Pong_set_byteslen"))) TS_Pong_set_byteslen(uint64_t this_ptr, int16_t val) {
37345         LDKPong this_ptr_conv;
37346         this_ptr_conv.inner = untag_ptr(this_ptr);
37347         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
37348         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
37349         this_ptr_conv.is_owned = false;
37350         Pong_set_byteslen(&this_ptr_conv, val);
37351 }
37352
37353 uint64_t  __attribute__((export_name("TS_Pong_new"))) TS_Pong_new(int16_t byteslen_arg) {
37354         LDKPong ret_var = Pong_new(byteslen_arg);
37355         uint64_t ret_ref = 0;
37356         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
37357         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
37358         return ret_ref;
37359 }
37360
37361 static inline uint64_t Pong_clone_ptr(LDKPong *NONNULL_PTR arg) {
37362         LDKPong ret_var = Pong_clone(arg);
37363         uint64_t ret_ref = 0;
37364         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
37365         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
37366         return ret_ref;
37367 }
37368 int64_t  __attribute__((export_name("TS_Pong_clone_ptr"))) TS_Pong_clone_ptr(uint64_t arg) {
37369         LDKPong arg_conv;
37370         arg_conv.inner = untag_ptr(arg);
37371         arg_conv.is_owned = ptr_is_owned(arg);
37372         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
37373         arg_conv.is_owned = false;
37374         int64_t ret_conv = Pong_clone_ptr(&arg_conv);
37375         return ret_conv;
37376 }
37377
37378 uint64_t  __attribute__((export_name("TS_Pong_clone"))) TS_Pong_clone(uint64_t orig) {
37379         LDKPong orig_conv;
37380         orig_conv.inner = untag_ptr(orig);
37381         orig_conv.is_owned = ptr_is_owned(orig);
37382         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
37383         orig_conv.is_owned = false;
37384         LDKPong ret_var = Pong_clone(&orig_conv);
37385         uint64_t ret_ref = 0;
37386         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
37387         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
37388         return ret_ref;
37389 }
37390
37391 jboolean  __attribute__((export_name("TS_Pong_eq"))) TS_Pong_eq(uint64_t a, uint64_t b) {
37392         LDKPong a_conv;
37393         a_conv.inner = untag_ptr(a);
37394         a_conv.is_owned = ptr_is_owned(a);
37395         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
37396         a_conv.is_owned = false;
37397         LDKPong b_conv;
37398         b_conv.inner = untag_ptr(b);
37399         b_conv.is_owned = ptr_is_owned(b);
37400         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
37401         b_conv.is_owned = false;
37402         jboolean ret_conv = Pong_eq(&a_conv, &b_conv);
37403         return ret_conv;
37404 }
37405
37406 void  __attribute__((export_name("TS_OpenChannel_free"))) TS_OpenChannel_free(uint64_t this_obj) {
37407         LDKOpenChannel this_obj_conv;
37408         this_obj_conv.inner = untag_ptr(this_obj);
37409         this_obj_conv.is_owned = ptr_is_owned(this_obj);
37410         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
37411         OpenChannel_free(this_obj_conv);
37412 }
37413
37414 int8_tArray  __attribute__((export_name("TS_OpenChannel_get_chain_hash"))) TS_OpenChannel_get_chain_hash(uint64_t this_ptr) {
37415         LDKOpenChannel this_ptr_conv;
37416         this_ptr_conv.inner = untag_ptr(this_ptr);
37417         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
37418         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
37419         this_ptr_conv.is_owned = false;
37420         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
37421         memcpy(ret_arr->elems, *OpenChannel_get_chain_hash(&this_ptr_conv), 32);
37422         return ret_arr;
37423 }
37424
37425 void  __attribute__((export_name("TS_OpenChannel_set_chain_hash"))) TS_OpenChannel_set_chain_hash(uint64_t this_ptr, int8_tArray val) {
37426         LDKOpenChannel this_ptr_conv;
37427         this_ptr_conv.inner = untag_ptr(this_ptr);
37428         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
37429         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
37430         this_ptr_conv.is_owned = false;
37431         LDKThirtyTwoBytes val_ref;
37432         CHECK(val->arr_len == 32);
37433         memcpy(val_ref.data, val->elems, 32); FREE(val);
37434         OpenChannel_set_chain_hash(&this_ptr_conv, val_ref);
37435 }
37436
37437 int8_tArray  __attribute__((export_name("TS_OpenChannel_get_temporary_channel_id"))) TS_OpenChannel_get_temporary_channel_id(uint64_t this_ptr) {
37438         LDKOpenChannel this_ptr_conv;
37439         this_ptr_conv.inner = untag_ptr(this_ptr);
37440         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
37441         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
37442         this_ptr_conv.is_owned = false;
37443         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
37444         memcpy(ret_arr->elems, *OpenChannel_get_temporary_channel_id(&this_ptr_conv), 32);
37445         return ret_arr;
37446 }
37447
37448 void  __attribute__((export_name("TS_OpenChannel_set_temporary_channel_id"))) TS_OpenChannel_set_temporary_channel_id(uint64_t this_ptr, int8_tArray val) {
37449         LDKOpenChannel this_ptr_conv;
37450         this_ptr_conv.inner = untag_ptr(this_ptr);
37451         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
37452         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
37453         this_ptr_conv.is_owned = false;
37454         LDKThirtyTwoBytes val_ref;
37455         CHECK(val->arr_len == 32);
37456         memcpy(val_ref.data, val->elems, 32); FREE(val);
37457         OpenChannel_set_temporary_channel_id(&this_ptr_conv, val_ref);
37458 }
37459
37460 int64_t  __attribute__((export_name("TS_OpenChannel_get_funding_satoshis"))) TS_OpenChannel_get_funding_satoshis(uint64_t this_ptr) {
37461         LDKOpenChannel this_ptr_conv;
37462         this_ptr_conv.inner = untag_ptr(this_ptr);
37463         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
37464         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
37465         this_ptr_conv.is_owned = false;
37466         int64_t ret_conv = OpenChannel_get_funding_satoshis(&this_ptr_conv);
37467         return ret_conv;
37468 }
37469
37470 void  __attribute__((export_name("TS_OpenChannel_set_funding_satoshis"))) TS_OpenChannel_set_funding_satoshis(uint64_t this_ptr, int64_t val) {
37471         LDKOpenChannel this_ptr_conv;
37472         this_ptr_conv.inner = untag_ptr(this_ptr);
37473         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
37474         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
37475         this_ptr_conv.is_owned = false;
37476         OpenChannel_set_funding_satoshis(&this_ptr_conv, val);
37477 }
37478
37479 int64_t  __attribute__((export_name("TS_OpenChannel_get_push_msat"))) TS_OpenChannel_get_push_msat(uint64_t this_ptr) {
37480         LDKOpenChannel this_ptr_conv;
37481         this_ptr_conv.inner = untag_ptr(this_ptr);
37482         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
37483         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
37484         this_ptr_conv.is_owned = false;
37485         int64_t ret_conv = OpenChannel_get_push_msat(&this_ptr_conv);
37486         return ret_conv;
37487 }
37488
37489 void  __attribute__((export_name("TS_OpenChannel_set_push_msat"))) TS_OpenChannel_set_push_msat(uint64_t this_ptr, int64_t val) {
37490         LDKOpenChannel this_ptr_conv;
37491         this_ptr_conv.inner = untag_ptr(this_ptr);
37492         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
37493         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
37494         this_ptr_conv.is_owned = false;
37495         OpenChannel_set_push_msat(&this_ptr_conv, val);
37496 }
37497
37498 int64_t  __attribute__((export_name("TS_OpenChannel_get_dust_limit_satoshis"))) TS_OpenChannel_get_dust_limit_satoshis(uint64_t this_ptr) {
37499         LDKOpenChannel this_ptr_conv;
37500         this_ptr_conv.inner = untag_ptr(this_ptr);
37501         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
37502         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
37503         this_ptr_conv.is_owned = false;
37504         int64_t ret_conv = OpenChannel_get_dust_limit_satoshis(&this_ptr_conv);
37505         return ret_conv;
37506 }
37507
37508 void  __attribute__((export_name("TS_OpenChannel_set_dust_limit_satoshis"))) TS_OpenChannel_set_dust_limit_satoshis(uint64_t this_ptr, int64_t val) {
37509         LDKOpenChannel this_ptr_conv;
37510         this_ptr_conv.inner = untag_ptr(this_ptr);
37511         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
37512         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
37513         this_ptr_conv.is_owned = false;
37514         OpenChannel_set_dust_limit_satoshis(&this_ptr_conv, val);
37515 }
37516
37517 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) {
37518         LDKOpenChannel this_ptr_conv;
37519         this_ptr_conv.inner = untag_ptr(this_ptr);
37520         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
37521         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
37522         this_ptr_conv.is_owned = false;
37523         int64_t ret_conv = OpenChannel_get_max_htlc_value_in_flight_msat(&this_ptr_conv);
37524         return ret_conv;
37525 }
37526
37527 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) {
37528         LDKOpenChannel this_ptr_conv;
37529         this_ptr_conv.inner = untag_ptr(this_ptr);
37530         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
37531         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
37532         this_ptr_conv.is_owned = false;
37533         OpenChannel_set_max_htlc_value_in_flight_msat(&this_ptr_conv, val);
37534 }
37535
37536 int64_t  __attribute__((export_name("TS_OpenChannel_get_channel_reserve_satoshis"))) TS_OpenChannel_get_channel_reserve_satoshis(uint64_t this_ptr) {
37537         LDKOpenChannel this_ptr_conv;
37538         this_ptr_conv.inner = untag_ptr(this_ptr);
37539         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
37540         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
37541         this_ptr_conv.is_owned = false;
37542         int64_t ret_conv = OpenChannel_get_channel_reserve_satoshis(&this_ptr_conv);
37543         return ret_conv;
37544 }
37545
37546 void  __attribute__((export_name("TS_OpenChannel_set_channel_reserve_satoshis"))) TS_OpenChannel_set_channel_reserve_satoshis(uint64_t this_ptr, int64_t val) {
37547         LDKOpenChannel this_ptr_conv;
37548         this_ptr_conv.inner = untag_ptr(this_ptr);
37549         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
37550         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
37551         this_ptr_conv.is_owned = false;
37552         OpenChannel_set_channel_reserve_satoshis(&this_ptr_conv, val);
37553 }
37554
37555 int64_t  __attribute__((export_name("TS_OpenChannel_get_htlc_minimum_msat"))) TS_OpenChannel_get_htlc_minimum_msat(uint64_t this_ptr) {
37556         LDKOpenChannel this_ptr_conv;
37557         this_ptr_conv.inner = untag_ptr(this_ptr);
37558         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
37559         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
37560         this_ptr_conv.is_owned = false;
37561         int64_t ret_conv = OpenChannel_get_htlc_minimum_msat(&this_ptr_conv);
37562         return ret_conv;
37563 }
37564
37565 void  __attribute__((export_name("TS_OpenChannel_set_htlc_minimum_msat"))) TS_OpenChannel_set_htlc_minimum_msat(uint64_t this_ptr, int64_t val) {
37566         LDKOpenChannel this_ptr_conv;
37567         this_ptr_conv.inner = untag_ptr(this_ptr);
37568         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
37569         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
37570         this_ptr_conv.is_owned = false;
37571         OpenChannel_set_htlc_minimum_msat(&this_ptr_conv, val);
37572 }
37573
37574 int32_t  __attribute__((export_name("TS_OpenChannel_get_feerate_per_kw"))) TS_OpenChannel_get_feerate_per_kw(uint64_t this_ptr) {
37575         LDKOpenChannel this_ptr_conv;
37576         this_ptr_conv.inner = untag_ptr(this_ptr);
37577         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
37578         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
37579         this_ptr_conv.is_owned = false;
37580         int32_t ret_conv = OpenChannel_get_feerate_per_kw(&this_ptr_conv);
37581         return ret_conv;
37582 }
37583
37584 void  __attribute__((export_name("TS_OpenChannel_set_feerate_per_kw"))) TS_OpenChannel_set_feerate_per_kw(uint64_t this_ptr, int32_t val) {
37585         LDKOpenChannel this_ptr_conv;
37586         this_ptr_conv.inner = untag_ptr(this_ptr);
37587         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
37588         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
37589         this_ptr_conv.is_owned = false;
37590         OpenChannel_set_feerate_per_kw(&this_ptr_conv, val);
37591 }
37592
37593 int16_t  __attribute__((export_name("TS_OpenChannel_get_to_self_delay"))) TS_OpenChannel_get_to_self_delay(uint64_t this_ptr) {
37594         LDKOpenChannel this_ptr_conv;
37595         this_ptr_conv.inner = untag_ptr(this_ptr);
37596         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
37597         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
37598         this_ptr_conv.is_owned = false;
37599         int16_t ret_conv = OpenChannel_get_to_self_delay(&this_ptr_conv);
37600         return ret_conv;
37601 }
37602
37603 void  __attribute__((export_name("TS_OpenChannel_set_to_self_delay"))) TS_OpenChannel_set_to_self_delay(uint64_t this_ptr, int16_t val) {
37604         LDKOpenChannel this_ptr_conv;
37605         this_ptr_conv.inner = untag_ptr(this_ptr);
37606         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
37607         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
37608         this_ptr_conv.is_owned = false;
37609         OpenChannel_set_to_self_delay(&this_ptr_conv, val);
37610 }
37611
37612 int16_t  __attribute__((export_name("TS_OpenChannel_get_max_accepted_htlcs"))) TS_OpenChannel_get_max_accepted_htlcs(uint64_t this_ptr) {
37613         LDKOpenChannel this_ptr_conv;
37614         this_ptr_conv.inner = untag_ptr(this_ptr);
37615         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
37616         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
37617         this_ptr_conv.is_owned = false;
37618         int16_t ret_conv = OpenChannel_get_max_accepted_htlcs(&this_ptr_conv);
37619         return ret_conv;
37620 }
37621
37622 void  __attribute__((export_name("TS_OpenChannel_set_max_accepted_htlcs"))) TS_OpenChannel_set_max_accepted_htlcs(uint64_t this_ptr, int16_t val) {
37623         LDKOpenChannel this_ptr_conv;
37624         this_ptr_conv.inner = untag_ptr(this_ptr);
37625         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
37626         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
37627         this_ptr_conv.is_owned = false;
37628         OpenChannel_set_max_accepted_htlcs(&this_ptr_conv, val);
37629 }
37630
37631 int8_tArray  __attribute__((export_name("TS_OpenChannel_get_funding_pubkey"))) TS_OpenChannel_get_funding_pubkey(uint64_t this_ptr) {
37632         LDKOpenChannel this_ptr_conv;
37633         this_ptr_conv.inner = untag_ptr(this_ptr);
37634         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
37635         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
37636         this_ptr_conv.is_owned = false;
37637         int8_tArray ret_arr = init_int8_tArray(33, __LINE__);
37638         memcpy(ret_arr->elems, OpenChannel_get_funding_pubkey(&this_ptr_conv).compressed_form, 33);
37639         return ret_arr;
37640 }
37641
37642 void  __attribute__((export_name("TS_OpenChannel_set_funding_pubkey"))) TS_OpenChannel_set_funding_pubkey(uint64_t this_ptr, int8_tArray val) {
37643         LDKOpenChannel this_ptr_conv;
37644         this_ptr_conv.inner = untag_ptr(this_ptr);
37645         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
37646         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
37647         this_ptr_conv.is_owned = false;
37648         LDKPublicKey val_ref;
37649         CHECK(val->arr_len == 33);
37650         memcpy(val_ref.compressed_form, val->elems, 33); FREE(val);
37651         OpenChannel_set_funding_pubkey(&this_ptr_conv, val_ref);
37652 }
37653
37654 int8_tArray  __attribute__((export_name("TS_OpenChannel_get_revocation_basepoint"))) TS_OpenChannel_get_revocation_basepoint(uint64_t this_ptr) {
37655         LDKOpenChannel this_ptr_conv;
37656         this_ptr_conv.inner = untag_ptr(this_ptr);
37657         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
37658         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
37659         this_ptr_conv.is_owned = false;
37660         int8_tArray ret_arr = init_int8_tArray(33, __LINE__);
37661         memcpy(ret_arr->elems, OpenChannel_get_revocation_basepoint(&this_ptr_conv).compressed_form, 33);
37662         return ret_arr;
37663 }
37664
37665 void  __attribute__((export_name("TS_OpenChannel_set_revocation_basepoint"))) TS_OpenChannel_set_revocation_basepoint(uint64_t this_ptr, int8_tArray val) {
37666         LDKOpenChannel this_ptr_conv;
37667         this_ptr_conv.inner = untag_ptr(this_ptr);
37668         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
37669         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
37670         this_ptr_conv.is_owned = false;
37671         LDKPublicKey val_ref;
37672         CHECK(val->arr_len == 33);
37673         memcpy(val_ref.compressed_form, val->elems, 33); FREE(val);
37674         OpenChannel_set_revocation_basepoint(&this_ptr_conv, val_ref);
37675 }
37676
37677 int8_tArray  __attribute__((export_name("TS_OpenChannel_get_payment_point"))) TS_OpenChannel_get_payment_point(uint64_t this_ptr) {
37678         LDKOpenChannel this_ptr_conv;
37679         this_ptr_conv.inner = untag_ptr(this_ptr);
37680         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
37681         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
37682         this_ptr_conv.is_owned = false;
37683         int8_tArray ret_arr = init_int8_tArray(33, __LINE__);
37684         memcpy(ret_arr->elems, OpenChannel_get_payment_point(&this_ptr_conv).compressed_form, 33);
37685         return ret_arr;
37686 }
37687
37688 void  __attribute__((export_name("TS_OpenChannel_set_payment_point"))) TS_OpenChannel_set_payment_point(uint64_t this_ptr, int8_tArray val) {
37689         LDKOpenChannel this_ptr_conv;
37690         this_ptr_conv.inner = untag_ptr(this_ptr);
37691         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
37692         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
37693         this_ptr_conv.is_owned = false;
37694         LDKPublicKey val_ref;
37695         CHECK(val->arr_len == 33);
37696         memcpy(val_ref.compressed_form, val->elems, 33); FREE(val);
37697         OpenChannel_set_payment_point(&this_ptr_conv, val_ref);
37698 }
37699
37700 int8_tArray  __attribute__((export_name("TS_OpenChannel_get_delayed_payment_basepoint"))) TS_OpenChannel_get_delayed_payment_basepoint(uint64_t this_ptr) {
37701         LDKOpenChannel this_ptr_conv;
37702         this_ptr_conv.inner = untag_ptr(this_ptr);
37703         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
37704         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
37705         this_ptr_conv.is_owned = false;
37706         int8_tArray ret_arr = init_int8_tArray(33, __LINE__);
37707         memcpy(ret_arr->elems, OpenChannel_get_delayed_payment_basepoint(&this_ptr_conv).compressed_form, 33);
37708         return ret_arr;
37709 }
37710
37711 void  __attribute__((export_name("TS_OpenChannel_set_delayed_payment_basepoint"))) TS_OpenChannel_set_delayed_payment_basepoint(uint64_t this_ptr, int8_tArray val) {
37712         LDKOpenChannel this_ptr_conv;
37713         this_ptr_conv.inner = untag_ptr(this_ptr);
37714         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
37715         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
37716         this_ptr_conv.is_owned = false;
37717         LDKPublicKey val_ref;
37718         CHECK(val->arr_len == 33);
37719         memcpy(val_ref.compressed_form, val->elems, 33); FREE(val);
37720         OpenChannel_set_delayed_payment_basepoint(&this_ptr_conv, val_ref);
37721 }
37722
37723 int8_tArray  __attribute__((export_name("TS_OpenChannel_get_htlc_basepoint"))) TS_OpenChannel_get_htlc_basepoint(uint64_t this_ptr) {
37724         LDKOpenChannel this_ptr_conv;
37725         this_ptr_conv.inner = untag_ptr(this_ptr);
37726         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
37727         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
37728         this_ptr_conv.is_owned = false;
37729         int8_tArray ret_arr = init_int8_tArray(33, __LINE__);
37730         memcpy(ret_arr->elems, OpenChannel_get_htlc_basepoint(&this_ptr_conv).compressed_form, 33);
37731         return ret_arr;
37732 }
37733
37734 void  __attribute__((export_name("TS_OpenChannel_set_htlc_basepoint"))) TS_OpenChannel_set_htlc_basepoint(uint64_t this_ptr, int8_tArray val) {
37735         LDKOpenChannel this_ptr_conv;
37736         this_ptr_conv.inner = untag_ptr(this_ptr);
37737         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
37738         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
37739         this_ptr_conv.is_owned = false;
37740         LDKPublicKey val_ref;
37741         CHECK(val->arr_len == 33);
37742         memcpy(val_ref.compressed_form, val->elems, 33); FREE(val);
37743         OpenChannel_set_htlc_basepoint(&this_ptr_conv, val_ref);
37744 }
37745
37746 int8_tArray  __attribute__((export_name("TS_OpenChannel_get_first_per_commitment_point"))) TS_OpenChannel_get_first_per_commitment_point(uint64_t this_ptr) {
37747         LDKOpenChannel this_ptr_conv;
37748         this_ptr_conv.inner = untag_ptr(this_ptr);
37749         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
37750         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
37751         this_ptr_conv.is_owned = false;
37752         int8_tArray ret_arr = init_int8_tArray(33, __LINE__);
37753         memcpy(ret_arr->elems, OpenChannel_get_first_per_commitment_point(&this_ptr_conv).compressed_form, 33);
37754         return ret_arr;
37755 }
37756
37757 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) {
37758         LDKOpenChannel this_ptr_conv;
37759         this_ptr_conv.inner = untag_ptr(this_ptr);
37760         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
37761         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
37762         this_ptr_conv.is_owned = false;
37763         LDKPublicKey val_ref;
37764         CHECK(val->arr_len == 33);
37765         memcpy(val_ref.compressed_form, val->elems, 33); FREE(val);
37766         OpenChannel_set_first_per_commitment_point(&this_ptr_conv, val_ref);
37767 }
37768
37769 int8_t  __attribute__((export_name("TS_OpenChannel_get_channel_flags"))) TS_OpenChannel_get_channel_flags(uint64_t this_ptr) {
37770         LDKOpenChannel this_ptr_conv;
37771         this_ptr_conv.inner = untag_ptr(this_ptr);
37772         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
37773         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
37774         this_ptr_conv.is_owned = false;
37775         int8_t ret_conv = OpenChannel_get_channel_flags(&this_ptr_conv);
37776         return ret_conv;
37777 }
37778
37779 void  __attribute__((export_name("TS_OpenChannel_set_channel_flags"))) TS_OpenChannel_set_channel_flags(uint64_t this_ptr, int8_t val) {
37780         LDKOpenChannel this_ptr_conv;
37781         this_ptr_conv.inner = untag_ptr(this_ptr);
37782         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
37783         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
37784         this_ptr_conv.is_owned = false;
37785         OpenChannel_set_channel_flags(&this_ptr_conv, val);
37786 }
37787
37788 uint64_t  __attribute__((export_name("TS_OpenChannel_get_shutdown_scriptpubkey"))) TS_OpenChannel_get_shutdown_scriptpubkey(uint64_t this_ptr) {
37789         LDKOpenChannel this_ptr_conv;
37790         this_ptr_conv.inner = untag_ptr(this_ptr);
37791         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
37792         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
37793         this_ptr_conv.is_owned = false;
37794         LDKCOption_CVec_u8ZZ *ret_copy = MALLOC(sizeof(LDKCOption_CVec_u8ZZ), "LDKCOption_CVec_u8ZZ");
37795         *ret_copy = OpenChannel_get_shutdown_scriptpubkey(&this_ptr_conv);
37796         uint64_t ret_ref = tag_ptr(ret_copy, true);
37797         return ret_ref;
37798 }
37799
37800 void  __attribute__((export_name("TS_OpenChannel_set_shutdown_scriptpubkey"))) TS_OpenChannel_set_shutdown_scriptpubkey(uint64_t this_ptr, uint64_t val) {
37801         LDKOpenChannel this_ptr_conv;
37802         this_ptr_conv.inner = untag_ptr(this_ptr);
37803         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
37804         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
37805         this_ptr_conv.is_owned = false;
37806         void* val_ptr = untag_ptr(val);
37807         CHECK_ACCESS(val_ptr);
37808         LDKCOption_CVec_u8ZZ val_conv = *(LDKCOption_CVec_u8ZZ*)(val_ptr);
37809         val_conv = COption_CVec_u8ZZ_clone((LDKCOption_CVec_u8ZZ*)untag_ptr(val));
37810         OpenChannel_set_shutdown_scriptpubkey(&this_ptr_conv, val_conv);
37811 }
37812
37813 uint64_t  __attribute__((export_name("TS_OpenChannel_get_channel_type"))) TS_OpenChannel_get_channel_type(uint64_t this_ptr) {
37814         LDKOpenChannel this_ptr_conv;
37815         this_ptr_conv.inner = untag_ptr(this_ptr);
37816         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
37817         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
37818         this_ptr_conv.is_owned = false;
37819         LDKChannelTypeFeatures ret_var = OpenChannel_get_channel_type(&this_ptr_conv);
37820         uint64_t ret_ref = 0;
37821         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
37822         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
37823         return ret_ref;
37824 }
37825
37826 void  __attribute__((export_name("TS_OpenChannel_set_channel_type"))) TS_OpenChannel_set_channel_type(uint64_t this_ptr, uint64_t val) {
37827         LDKOpenChannel this_ptr_conv;
37828         this_ptr_conv.inner = untag_ptr(this_ptr);
37829         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
37830         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
37831         this_ptr_conv.is_owned = false;
37832         LDKChannelTypeFeatures val_conv;
37833         val_conv.inner = untag_ptr(val);
37834         val_conv.is_owned = ptr_is_owned(val);
37835         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
37836         val_conv = ChannelTypeFeatures_clone(&val_conv);
37837         OpenChannel_set_channel_type(&this_ptr_conv, val_conv);
37838 }
37839
37840 uint64_t  __attribute__((export_name("TS_OpenChannel_new"))) TS_OpenChannel_new(int8_tArray chain_hash_arg, int8_tArray temporary_channel_id_arg, int64_t funding_satoshis_arg, int64_t push_msat_arg, int64_t dust_limit_satoshis_arg, int64_t max_htlc_value_in_flight_msat_arg, int64_t channel_reserve_satoshis_arg, int64_t htlc_minimum_msat_arg, int32_t feerate_per_kw_arg, int16_t to_self_delay_arg, int16_t max_accepted_htlcs_arg, 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, int8_tArray first_per_commitment_point_arg, int8_t channel_flags_arg, uint64_t shutdown_scriptpubkey_arg, uint64_t channel_type_arg) {
37841         LDKThirtyTwoBytes chain_hash_arg_ref;
37842         CHECK(chain_hash_arg->arr_len == 32);
37843         memcpy(chain_hash_arg_ref.data, chain_hash_arg->elems, 32); FREE(chain_hash_arg);
37844         LDKThirtyTwoBytes temporary_channel_id_arg_ref;
37845         CHECK(temporary_channel_id_arg->arr_len == 32);
37846         memcpy(temporary_channel_id_arg_ref.data, temporary_channel_id_arg->elems, 32); FREE(temporary_channel_id_arg);
37847         LDKPublicKey funding_pubkey_arg_ref;
37848         CHECK(funding_pubkey_arg->arr_len == 33);
37849         memcpy(funding_pubkey_arg_ref.compressed_form, funding_pubkey_arg->elems, 33); FREE(funding_pubkey_arg);
37850         LDKPublicKey revocation_basepoint_arg_ref;
37851         CHECK(revocation_basepoint_arg->arr_len == 33);
37852         memcpy(revocation_basepoint_arg_ref.compressed_form, revocation_basepoint_arg->elems, 33); FREE(revocation_basepoint_arg);
37853         LDKPublicKey payment_point_arg_ref;
37854         CHECK(payment_point_arg->arr_len == 33);
37855         memcpy(payment_point_arg_ref.compressed_form, payment_point_arg->elems, 33); FREE(payment_point_arg);
37856         LDKPublicKey delayed_payment_basepoint_arg_ref;
37857         CHECK(delayed_payment_basepoint_arg->arr_len == 33);
37858         memcpy(delayed_payment_basepoint_arg_ref.compressed_form, delayed_payment_basepoint_arg->elems, 33); FREE(delayed_payment_basepoint_arg);
37859         LDKPublicKey htlc_basepoint_arg_ref;
37860         CHECK(htlc_basepoint_arg->arr_len == 33);
37861         memcpy(htlc_basepoint_arg_ref.compressed_form, htlc_basepoint_arg->elems, 33); FREE(htlc_basepoint_arg);
37862         LDKPublicKey first_per_commitment_point_arg_ref;
37863         CHECK(first_per_commitment_point_arg->arr_len == 33);
37864         memcpy(first_per_commitment_point_arg_ref.compressed_form, first_per_commitment_point_arg->elems, 33); FREE(first_per_commitment_point_arg);
37865         void* shutdown_scriptpubkey_arg_ptr = untag_ptr(shutdown_scriptpubkey_arg);
37866         CHECK_ACCESS(shutdown_scriptpubkey_arg_ptr);
37867         LDKCOption_CVec_u8ZZ shutdown_scriptpubkey_arg_conv = *(LDKCOption_CVec_u8ZZ*)(shutdown_scriptpubkey_arg_ptr);
37868         shutdown_scriptpubkey_arg_conv = COption_CVec_u8ZZ_clone((LDKCOption_CVec_u8ZZ*)untag_ptr(shutdown_scriptpubkey_arg));
37869         LDKChannelTypeFeatures channel_type_arg_conv;
37870         channel_type_arg_conv.inner = untag_ptr(channel_type_arg);
37871         channel_type_arg_conv.is_owned = ptr_is_owned(channel_type_arg);
37872         CHECK_INNER_FIELD_ACCESS_OR_NULL(channel_type_arg_conv);
37873         channel_type_arg_conv = ChannelTypeFeatures_clone(&channel_type_arg_conv);
37874         LDKOpenChannel ret_var = OpenChannel_new(chain_hash_arg_ref, temporary_channel_id_arg_ref, funding_satoshis_arg, push_msat_arg, dust_limit_satoshis_arg, max_htlc_value_in_flight_msat_arg, channel_reserve_satoshis_arg, htlc_minimum_msat_arg, feerate_per_kw_arg, to_self_delay_arg, max_accepted_htlcs_arg, funding_pubkey_arg_ref, revocation_basepoint_arg_ref, payment_point_arg_ref, delayed_payment_basepoint_arg_ref, htlc_basepoint_arg_ref, first_per_commitment_point_arg_ref, channel_flags_arg, shutdown_scriptpubkey_arg_conv, channel_type_arg_conv);
37875         uint64_t ret_ref = 0;
37876         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
37877         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
37878         return ret_ref;
37879 }
37880
37881 static inline uint64_t OpenChannel_clone_ptr(LDKOpenChannel *NONNULL_PTR arg) {
37882         LDKOpenChannel ret_var = OpenChannel_clone(arg);
37883         uint64_t ret_ref = 0;
37884         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
37885         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
37886         return ret_ref;
37887 }
37888 int64_t  __attribute__((export_name("TS_OpenChannel_clone_ptr"))) TS_OpenChannel_clone_ptr(uint64_t arg) {
37889         LDKOpenChannel arg_conv;
37890         arg_conv.inner = untag_ptr(arg);
37891         arg_conv.is_owned = ptr_is_owned(arg);
37892         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
37893         arg_conv.is_owned = false;
37894         int64_t ret_conv = OpenChannel_clone_ptr(&arg_conv);
37895         return ret_conv;
37896 }
37897
37898 uint64_t  __attribute__((export_name("TS_OpenChannel_clone"))) TS_OpenChannel_clone(uint64_t orig) {
37899         LDKOpenChannel orig_conv;
37900         orig_conv.inner = untag_ptr(orig);
37901         orig_conv.is_owned = ptr_is_owned(orig);
37902         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
37903         orig_conv.is_owned = false;
37904         LDKOpenChannel ret_var = OpenChannel_clone(&orig_conv);
37905         uint64_t ret_ref = 0;
37906         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
37907         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
37908         return ret_ref;
37909 }
37910
37911 jboolean  __attribute__((export_name("TS_OpenChannel_eq"))) TS_OpenChannel_eq(uint64_t a, uint64_t b) {
37912         LDKOpenChannel a_conv;
37913         a_conv.inner = untag_ptr(a);
37914         a_conv.is_owned = ptr_is_owned(a);
37915         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
37916         a_conv.is_owned = false;
37917         LDKOpenChannel b_conv;
37918         b_conv.inner = untag_ptr(b);
37919         b_conv.is_owned = ptr_is_owned(b);
37920         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
37921         b_conv.is_owned = false;
37922         jboolean ret_conv = OpenChannel_eq(&a_conv, &b_conv);
37923         return ret_conv;
37924 }
37925
37926 void  __attribute__((export_name("TS_OpenChannelV2_free"))) TS_OpenChannelV2_free(uint64_t this_obj) {
37927         LDKOpenChannelV2 this_obj_conv;
37928         this_obj_conv.inner = untag_ptr(this_obj);
37929         this_obj_conv.is_owned = ptr_is_owned(this_obj);
37930         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
37931         OpenChannelV2_free(this_obj_conv);
37932 }
37933
37934 int8_tArray  __attribute__((export_name("TS_OpenChannelV2_get_chain_hash"))) TS_OpenChannelV2_get_chain_hash(uint64_t this_ptr) {
37935         LDKOpenChannelV2 this_ptr_conv;
37936         this_ptr_conv.inner = untag_ptr(this_ptr);
37937         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
37938         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
37939         this_ptr_conv.is_owned = false;
37940         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
37941         memcpy(ret_arr->elems, *OpenChannelV2_get_chain_hash(&this_ptr_conv), 32);
37942         return ret_arr;
37943 }
37944
37945 void  __attribute__((export_name("TS_OpenChannelV2_set_chain_hash"))) TS_OpenChannelV2_set_chain_hash(uint64_t this_ptr, int8_tArray val) {
37946         LDKOpenChannelV2 this_ptr_conv;
37947         this_ptr_conv.inner = untag_ptr(this_ptr);
37948         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
37949         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
37950         this_ptr_conv.is_owned = false;
37951         LDKThirtyTwoBytes val_ref;
37952         CHECK(val->arr_len == 32);
37953         memcpy(val_ref.data, val->elems, 32); FREE(val);
37954         OpenChannelV2_set_chain_hash(&this_ptr_conv, val_ref);
37955 }
37956
37957 int8_tArray  __attribute__((export_name("TS_OpenChannelV2_get_temporary_channel_id"))) TS_OpenChannelV2_get_temporary_channel_id(uint64_t this_ptr) {
37958         LDKOpenChannelV2 this_ptr_conv;
37959         this_ptr_conv.inner = untag_ptr(this_ptr);
37960         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
37961         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
37962         this_ptr_conv.is_owned = false;
37963         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
37964         memcpy(ret_arr->elems, *OpenChannelV2_get_temporary_channel_id(&this_ptr_conv), 32);
37965         return ret_arr;
37966 }
37967
37968 void  __attribute__((export_name("TS_OpenChannelV2_set_temporary_channel_id"))) TS_OpenChannelV2_set_temporary_channel_id(uint64_t this_ptr, int8_tArray val) {
37969         LDKOpenChannelV2 this_ptr_conv;
37970         this_ptr_conv.inner = untag_ptr(this_ptr);
37971         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
37972         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
37973         this_ptr_conv.is_owned = false;
37974         LDKThirtyTwoBytes val_ref;
37975         CHECK(val->arr_len == 32);
37976         memcpy(val_ref.data, val->elems, 32); FREE(val);
37977         OpenChannelV2_set_temporary_channel_id(&this_ptr_conv, val_ref);
37978 }
37979
37980 int32_t  __attribute__((export_name("TS_OpenChannelV2_get_funding_feerate_sat_per_1000_weight"))) TS_OpenChannelV2_get_funding_feerate_sat_per_1000_weight(uint64_t this_ptr) {
37981         LDKOpenChannelV2 this_ptr_conv;
37982         this_ptr_conv.inner = untag_ptr(this_ptr);
37983         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
37984         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
37985         this_ptr_conv.is_owned = false;
37986         int32_t ret_conv = OpenChannelV2_get_funding_feerate_sat_per_1000_weight(&this_ptr_conv);
37987         return ret_conv;
37988 }
37989
37990 void  __attribute__((export_name("TS_OpenChannelV2_set_funding_feerate_sat_per_1000_weight"))) TS_OpenChannelV2_set_funding_feerate_sat_per_1000_weight(uint64_t this_ptr, int32_t val) {
37991         LDKOpenChannelV2 this_ptr_conv;
37992         this_ptr_conv.inner = untag_ptr(this_ptr);
37993         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
37994         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
37995         this_ptr_conv.is_owned = false;
37996         OpenChannelV2_set_funding_feerate_sat_per_1000_weight(&this_ptr_conv, val);
37997 }
37998
37999 int32_t  __attribute__((export_name("TS_OpenChannelV2_get_commitment_feerate_sat_per_1000_weight"))) TS_OpenChannelV2_get_commitment_feerate_sat_per_1000_weight(uint64_t this_ptr) {
38000         LDKOpenChannelV2 this_ptr_conv;
38001         this_ptr_conv.inner = untag_ptr(this_ptr);
38002         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
38003         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
38004         this_ptr_conv.is_owned = false;
38005         int32_t ret_conv = OpenChannelV2_get_commitment_feerate_sat_per_1000_weight(&this_ptr_conv);
38006         return ret_conv;
38007 }
38008
38009 void  __attribute__((export_name("TS_OpenChannelV2_set_commitment_feerate_sat_per_1000_weight"))) TS_OpenChannelV2_set_commitment_feerate_sat_per_1000_weight(uint64_t this_ptr, int32_t val) {
38010         LDKOpenChannelV2 this_ptr_conv;
38011         this_ptr_conv.inner = untag_ptr(this_ptr);
38012         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
38013         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
38014         this_ptr_conv.is_owned = false;
38015         OpenChannelV2_set_commitment_feerate_sat_per_1000_weight(&this_ptr_conv, val);
38016 }
38017
38018 int64_t  __attribute__((export_name("TS_OpenChannelV2_get_funding_satoshis"))) TS_OpenChannelV2_get_funding_satoshis(uint64_t this_ptr) {
38019         LDKOpenChannelV2 this_ptr_conv;
38020         this_ptr_conv.inner = untag_ptr(this_ptr);
38021         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
38022         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
38023         this_ptr_conv.is_owned = false;
38024         int64_t ret_conv = OpenChannelV2_get_funding_satoshis(&this_ptr_conv);
38025         return ret_conv;
38026 }
38027
38028 void  __attribute__((export_name("TS_OpenChannelV2_set_funding_satoshis"))) TS_OpenChannelV2_set_funding_satoshis(uint64_t this_ptr, int64_t val) {
38029         LDKOpenChannelV2 this_ptr_conv;
38030         this_ptr_conv.inner = untag_ptr(this_ptr);
38031         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
38032         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
38033         this_ptr_conv.is_owned = false;
38034         OpenChannelV2_set_funding_satoshis(&this_ptr_conv, val);
38035 }
38036
38037 int64_t  __attribute__((export_name("TS_OpenChannelV2_get_dust_limit_satoshis"))) TS_OpenChannelV2_get_dust_limit_satoshis(uint64_t this_ptr) {
38038         LDKOpenChannelV2 this_ptr_conv;
38039         this_ptr_conv.inner = untag_ptr(this_ptr);
38040         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
38041         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
38042         this_ptr_conv.is_owned = false;
38043         int64_t ret_conv = OpenChannelV2_get_dust_limit_satoshis(&this_ptr_conv);
38044         return ret_conv;
38045 }
38046
38047 void  __attribute__((export_name("TS_OpenChannelV2_set_dust_limit_satoshis"))) TS_OpenChannelV2_set_dust_limit_satoshis(uint64_t this_ptr, int64_t val) {
38048         LDKOpenChannelV2 this_ptr_conv;
38049         this_ptr_conv.inner = untag_ptr(this_ptr);
38050         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
38051         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
38052         this_ptr_conv.is_owned = false;
38053         OpenChannelV2_set_dust_limit_satoshis(&this_ptr_conv, val);
38054 }
38055
38056 int64_t  __attribute__((export_name("TS_OpenChannelV2_get_max_htlc_value_in_flight_msat"))) TS_OpenChannelV2_get_max_htlc_value_in_flight_msat(uint64_t this_ptr) {
38057         LDKOpenChannelV2 this_ptr_conv;
38058         this_ptr_conv.inner = untag_ptr(this_ptr);
38059         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
38060         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
38061         this_ptr_conv.is_owned = false;
38062         int64_t ret_conv = OpenChannelV2_get_max_htlc_value_in_flight_msat(&this_ptr_conv);
38063         return ret_conv;
38064 }
38065
38066 void  __attribute__((export_name("TS_OpenChannelV2_set_max_htlc_value_in_flight_msat"))) TS_OpenChannelV2_set_max_htlc_value_in_flight_msat(uint64_t this_ptr, int64_t val) {
38067         LDKOpenChannelV2 this_ptr_conv;
38068         this_ptr_conv.inner = untag_ptr(this_ptr);
38069         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
38070         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
38071         this_ptr_conv.is_owned = false;
38072         OpenChannelV2_set_max_htlc_value_in_flight_msat(&this_ptr_conv, val);
38073 }
38074
38075 int64_t  __attribute__((export_name("TS_OpenChannelV2_get_htlc_minimum_msat"))) TS_OpenChannelV2_get_htlc_minimum_msat(uint64_t this_ptr) {
38076         LDKOpenChannelV2 this_ptr_conv;
38077         this_ptr_conv.inner = untag_ptr(this_ptr);
38078         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
38079         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
38080         this_ptr_conv.is_owned = false;
38081         int64_t ret_conv = OpenChannelV2_get_htlc_minimum_msat(&this_ptr_conv);
38082         return ret_conv;
38083 }
38084
38085 void  __attribute__((export_name("TS_OpenChannelV2_set_htlc_minimum_msat"))) TS_OpenChannelV2_set_htlc_minimum_msat(uint64_t this_ptr, int64_t val) {
38086         LDKOpenChannelV2 this_ptr_conv;
38087         this_ptr_conv.inner = untag_ptr(this_ptr);
38088         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
38089         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
38090         this_ptr_conv.is_owned = false;
38091         OpenChannelV2_set_htlc_minimum_msat(&this_ptr_conv, val);
38092 }
38093
38094 int16_t  __attribute__((export_name("TS_OpenChannelV2_get_to_self_delay"))) TS_OpenChannelV2_get_to_self_delay(uint64_t this_ptr) {
38095         LDKOpenChannelV2 this_ptr_conv;
38096         this_ptr_conv.inner = untag_ptr(this_ptr);
38097         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
38098         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
38099         this_ptr_conv.is_owned = false;
38100         int16_t ret_conv = OpenChannelV2_get_to_self_delay(&this_ptr_conv);
38101         return ret_conv;
38102 }
38103
38104 void  __attribute__((export_name("TS_OpenChannelV2_set_to_self_delay"))) TS_OpenChannelV2_set_to_self_delay(uint64_t this_ptr, int16_t val) {
38105         LDKOpenChannelV2 this_ptr_conv;
38106         this_ptr_conv.inner = untag_ptr(this_ptr);
38107         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
38108         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
38109         this_ptr_conv.is_owned = false;
38110         OpenChannelV2_set_to_self_delay(&this_ptr_conv, val);
38111 }
38112
38113 int16_t  __attribute__((export_name("TS_OpenChannelV2_get_max_accepted_htlcs"))) TS_OpenChannelV2_get_max_accepted_htlcs(uint64_t this_ptr) {
38114         LDKOpenChannelV2 this_ptr_conv;
38115         this_ptr_conv.inner = untag_ptr(this_ptr);
38116         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
38117         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
38118         this_ptr_conv.is_owned = false;
38119         int16_t ret_conv = OpenChannelV2_get_max_accepted_htlcs(&this_ptr_conv);
38120         return ret_conv;
38121 }
38122
38123 void  __attribute__((export_name("TS_OpenChannelV2_set_max_accepted_htlcs"))) TS_OpenChannelV2_set_max_accepted_htlcs(uint64_t this_ptr, int16_t val) {
38124         LDKOpenChannelV2 this_ptr_conv;
38125         this_ptr_conv.inner = untag_ptr(this_ptr);
38126         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
38127         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
38128         this_ptr_conv.is_owned = false;
38129         OpenChannelV2_set_max_accepted_htlcs(&this_ptr_conv, val);
38130 }
38131
38132 int32_t  __attribute__((export_name("TS_OpenChannelV2_get_locktime"))) TS_OpenChannelV2_get_locktime(uint64_t this_ptr) {
38133         LDKOpenChannelV2 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         int32_t ret_conv = OpenChannelV2_get_locktime(&this_ptr_conv);
38139         return ret_conv;
38140 }
38141
38142 void  __attribute__((export_name("TS_OpenChannelV2_set_locktime"))) TS_OpenChannelV2_set_locktime(uint64_t this_ptr, int32_t val) {
38143         LDKOpenChannelV2 this_ptr_conv;
38144         this_ptr_conv.inner = untag_ptr(this_ptr);
38145         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
38146         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
38147         this_ptr_conv.is_owned = false;
38148         OpenChannelV2_set_locktime(&this_ptr_conv, val);
38149 }
38150
38151 int8_tArray  __attribute__((export_name("TS_OpenChannelV2_get_funding_pubkey"))) TS_OpenChannelV2_get_funding_pubkey(uint64_t this_ptr) {
38152         LDKOpenChannelV2 this_ptr_conv;
38153         this_ptr_conv.inner = untag_ptr(this_ptr);
38154         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
38155         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
38156         this_ptr_conv.is_owned = false;
38157         int8_tArray ret_arr = init_int8_tArray(33, __LINE__);
38158         memcpy(ret_arr->elems, OpenChannelV2_get_funding_pubkey(&this_ptr_conv).compressed_form, 33);
38159         return ret_arr;
38160 }
38161
38162 void  __attribute__((export_name("TS_OpenChannelV2_set_funding_pubkey"))) TS_OpenChannelV2_set_funding_pubkey(uint64_t this_ptr, int8_tArray val) {
38163         LDKOpenChannelV2 this_ptr_conv;
38164         this_ptr_conv.inner = untag_ptr(this_ptr);
38165         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
38166         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
38167         this_ptr_conv.is_owned = false;
38168         LDKPublicKey val_ref;
38169         CHECK(val->arr_len == 33);
38170         memcpy(val_ref.compressed_form, val->elems, 33); FREE(val);
38171         OpenChannelV2_set_funding_pubkey(&this_ptr_conv, val_ref);
38172 }
38173
38174 int8_tArray  __attribute__((export_name("TS_OpenChannelV2_get_revocation_basepoint"))) TS_OpenChannelV2_get_revocation_basepoint(uint64_t this_ptr) {
38175         LDKOpenChannelV2 this_ptr_conv;
38176         this_ptr_conv.inner = untag_ptr(this_ptr);
38177         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
38178         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
38179         this_ptr_conv.is_owned = false;
38180         int8_tArray ret_arr = init_int8_tArray(33, __LINE__);
38181         memcpy(ret_arr->elems, OpenChannelV2_get_revocation_basepoint(&this_ptr_conv).compressed_form, 33);
38182         return ret_arr;
38183 }
38184
38185 void  __attribute__((export_name("TS_OpenChannelV2_set_revocation_basepoint"))) TS_OpenChannelV2_set_revocation_basepoint(uint64_t this_ptr, int8_tArray val) {
38186         LDKOpenChannelV2 this_ptr_conv;
38187         this_ptr_conv.inner = untag_ptr(this_ptr);
38188         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
38189         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
38190         this_ptr_conv.is_owned = false;
38191         LDKPublicKey val_ref;
38192         CHECK(val->arr_len == 33);
38193         memcpy(val_ref.compressed_form, val->elems, 33); FREE(val);
38194         OpenChannelV2_set_revocation_basepoint(&this_ptr_conv, val_ref);
38195 }
38196
38197 int8_tArray  __attribute__((export_name("TS_OpenChannelV2_get_payment_basepoint"))) TS_OpenChannelV2_get_payment_basepoint(uint64_t this_ptr) {
38198         LDKOpenChannelV2 this_ptr_conv;
38199         this_ptr_conv.inner = untag_ptr(this_ptr);
38200         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
38201         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
38202         this_ptr_conv.is_owned = false;
38203         int8_tArray ret_arr = init_int8_tArray(33, __LINE__);
38204         memcpy(ret_arr->elems, OpenChannelV2_get_payment_basepoint(&this_ptr_conv).compressed_form, 33);
38205         return ret_arr;
38206 }
38207
38208 void  __attribute__((export_name("TS_OpenChannelV2_set_payment_basepoint"))) TS_OpenChannelV2_set_payment_basepoint(uint64_t this_ptr, int8_tArray val) {
38209         LDKOpenChannelV2 this_ptr_conv;
38210         this_ptr_conv.inner = untag_ptr(this_ptr);
38211         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
38212         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
38213         this_ptr_conv.is_owned = false;
38214         LDKPublicKey val_ref;
38215         CHECK(val->arr_len == 33);
38216         memcpy(val_ref.compressed_form, val->elems, 33); FREE(val);
38217         OpenChannelV2_set_payment_basepoint(&this_ptr_conv, val_ref);
38218 }
38219
38220 int8_tArray  __attribute__((export_name("TS_OpenChannelV2_get_delayed_payment_basepoint"))) TS_OpenChannelV2_get_delayed_payment_basepoint(uint64_t this_ptr) {
38221         LDKOpenChannelV2 this_ptr_conv;
38222         this_ptr_conv.inner = untag_ptr(this_ptr);
38223         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
38224         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
38225         this_ptr_conv.is_owned = false;
38226         int8_tArray ret_arr = init_int8_tArray(33, __LINE__);
38227         memcpy(ret_arr->elems, OpenChannelV2_get_delayed_payment_basepoint(&this_ptr_conv).compressed_form, 33);
38228         return ret_arr;
38229 }
38230
38231 void  __attribute__((export_name("TS_OpenChannelV2_set_delayed_payment_basepoint"))) TS_OpenChannelV2_set_delayed_payment_basepoint(uint64_t this_ptr, int8_tArray val) {
38232         LDKOpenChannelV2 this_ptr_conv;
38233         this_ptr_conv.inner = untag_ptr(this_ptr);
38234         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
38235         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
38236         this_ptr_conv.is_owned = false;
38237         LDKPublicKey val_ref;
38238         CHECK(val->arr_len == 33);
38239         memcpy(val_ref.compressed_form, val->elems, 33); FREE(val);
38240         OpenChannelV2_set_delayed_payment_basepoint(&this_ptr_conv, val_ref);
38241 }
38242
38243 int8_tArray  __attribute__((export_name("TS_OpenChannelV2_get_htlc_basepoint"))) TS_OpenChannelV2_get_htlc_basepoint(uint64_t this_ptr) {
38244         LDKOpenChannelV2 this_ptr_conv;
38245         this_ptr_conv.inner = untag_ptr(this_ptr);
38246         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
38247         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
38248         this_ptr_conv.is_owned = false;
38249         int8_tArray ret_arr = init_int8_tArray(33, __LINE__);
38250         memcpy(ret_arr->elems, OpenChannelV2_get_htlc_basepoint(&this_ptr_conv).compressed_form, 33);
38251         return ret_arr;
38252 }
38253
38254 void  __attribute__((export_name("TS_OpenChannelV2_set_htlc_basepoint"))) TS_OpenChannelV2_set_htlc_basepoint(uint64_t this_ptr, int8_tArray val) {
38255         LDKOpenChannelV2 this_ptr_conv;
38256         this_ptr_conv.inner = untag_ptr(this_ptr);
38257         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
38258         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
38259         this_ptr_conv.is_owned = false;
38260         LDKPublicKey val_ref;
38261         CHECK(val->arr_len == 33);
38262         memcpy(val_ref.compressed_form, val->elems, 33); FREE(val);
38263         OpenChannelV2_set_htlc_basepoint(&this_ptr_conv, val_ref);
38264 }
38265
38266 int8_tArray  __attribute__((export_name("TS_OpenChannelV2_get_first_per_commitment_point"))) TS_OpenChannelV2_get_first_per_commitment_point(uint64_t this_ptr) {
38267         LDKOpenChannelV2 this_ptr_conv;
38268         this_ptr_conv.inner = untag_ptr(this_ptr);
38269         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
38270         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
38271         this_ptr_conv.is_owned = false;
38272         int8_tArray ret_arr = init_int8_tArray(33, __LINE__);
38273         memcpy(ret_arr->elems, OpenChannelV2_get_first_per_commitment_point(&this_ptr_conv).compressed_form, 33);
38274         return ret_arr;
38275 }
38276
38277 void  __attribute__((export_name("TS_OpenChannelV2_set_first_per_commitment_point"))) TS_OpenChannelV2_set_first_per_commitment_point(uint64_t this_ptr, int8_tArray val) {
38278         LDKOpenChannelV2 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         LDKPublicKey val_ref;
38284         CHECK(val->arr_len == 33);
38285         memcpy(val_ref.compressed_form, val->elems, 33); FREE(val);
38286         OpenChannelV2_set_first_per_commitment_point(&this_ptr_conv, val_ref);
38287 }
38288
38289 int8_tArray  __attribute__((export_name("TS_OpenChannelV2_get_second_per_commitment_point"))) TS_OpenChannelV2_get_second_per_commitment_point(uint64_t this_ptr) {
38290         LDKOpenChannelV2 this_ptr_conv;
38291         this_ptr_conv.inner = untag_ptr(this_ptr);
38292         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
38293         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
38294         this_ptr_conv.is_owned = false;
38295         int8_tArray ret_arr = init_int8_tArray(33, __LINE__);
38296         memcpy(ret_arr->elems, OpenChannelV2_get_second_per_commitment_point(&this_ptr_conv).compressed_form, 33);
38297         return ret_arr;
38298 }
38299
38300 void  __attribute__((export_name("TS_OpenChannelV2_set_second_per_commitment_point"))) TS_OpenChannelV2_set_second_per_commitment_point(uint64_t this_ptr, int8_tArray val) {
38301         LDKOpenChannelV2 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         LDKPublicKey val_ref;
38307         CHECK(val->arr_len == 33);
38308         memcpy(val_ref.compressed_form, val->elems, 33); FREE(val);
38309         OpenChannelV2_set_second_per_commitment_point(&this_ptr_conv, val_ref);
38310 }
38311
38312 int8_t  __attribute__((export_name("TS_OpenChannelV2_get_channel_flags"))) TS_OpenChannelV2_get_channel_flags(uint64_t this_ptr) {
38313         LDKOpenChannelV2 this_ptr_conv;
38314         this_ptr_conv.inner = untag_ptr(this_ptr);
38315         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
38316         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
38317         this_ptr_conv.is_owned = false;
38318         int8_t ret_conv = OpenChannelV2_get_channel_flags(&this_ptr_conv);
38319         return ret_conv;
38320 }
38321
38322 void  __attribute__((export_name("TS_OpenChannelV2_set_channel_flags"))) TS_OpenChannelV2_set_channel_flags(uint64_t this_ptr, int8_t val) {
38323         LDKOpenChannelV2 this_ptr_conv;
38324         this_ptr_conv.inner = untag_ptr(this_ptr);
38325         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
38326         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
38327         this_ptr_conv.is_owned = false;
38328         OpenChannelV2_set_channel_flags(&this_ptr_conv, val);
38329 }
38330
38331 uint64_t  __attribute__((export_name("TS_OpenChannelV2_get_shutdown_scriptpubkey"))) TS_OpenChannelV2_get_shutdown_scriptpubkey(uint64_t this_ptr) {
38332         LDKOpenChannelV2 this_ptr_conv;
38333         this_ptr_conv.inner = untag_ptr(this_ptr);
38334         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
38335         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
38336         this_ptr_conv.is_owned = false;
38337         LDKCOption_CVec_u8ZZ *ret_copy = MALLOC(sizeof(LDKCOption_CVec_u8ZZ), "LDKCOption_CVec_u8ZZ");
38338         *ret_copy = OpenChannelV2_get_shutdown_scriptpubkey(&this_ptr_conv);
38339         uint64_t ret_ref = tag_ptr(ret_copy, true);
38340         return ret_ref;
38341 }
38342
38343 void  __attribute__((export_name("TS_OpenChannelV2_set_shutdown_scriptpubkey"))) TS_OpenChannelV2_set_shutdown_scriptpubkey(uint64_t this_ptr, uint64_t val) {
38344         LDKOpenChannelV2 this_ptr_conv;
38345         this_ptr_conv.inner = untag_ptr(this_ptr);
38346         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
38347         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
38348         this_ptr_conv.is_owned = false;
38349         void* val_ptr = untag_ptr(val);
38350         CHECK_ACCESS(val_ptr);
38351         LDKCOption_CVec_u8ZZ val_conv = *(LDKCOption_CVec_u8ZZ*)(val_ptr);
38352         val_conv = COption_CVec_u8ZZ_clone((LDKCOption_CVec_u8ZZ*)untag_ptr(val));
38353         OpenChannelV2_set_shutdown_scriptpubkey(&this_ptr_conv, val_conv);
38354 }
38355
38356 uint64_t  __attribute__((export_name("TS_OpenChannelV2_get_channel_type"))) TS_OpenChannelV2_get_channel_type(uint64_t this_ptr) {
38357         LDKOpenChannelV2 this_ptr_conv;
38358         this_ptr_conv.inner = untag_ptr(this_ptr);
38359         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
38360         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
38361         this_ptr_conv.is_owned = false;
38362         LDKChannelTypeFeatures ret_var = OpenChannelV2_get_channel_type(&this_ptr_conv);
38363         uint64_t ret_ref = 0;
38364         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
38365         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
38366         return ret_ref;
38367 }
38368
38369 void  __attribute__((export_name("TS_OpenChannelV2_set_channel_type"))) TS_OpenChannelV2_set_channel_type(uint64_t this_ptr, uint64_t val) {
38370         LDKOpenChannelV2 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         LDKChannelTypeFeatures val_conv;
38376         val_conv.inner = untag_ptr(val);
38377         val_conv.is_owned = ptr_is_owned(val);
38378         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
38379         val_conv = ChannelTypeFeatures_clone(&val_conv);
38380         OpenChannelV2_set_channel_type(&this_ptr_conv, val_conv);
38381 }
38382
38383 uint32_t  __attribute__((export_name("TS_OpenChannelV2_get_require_confirmed_inputs"))) TS_OpenChannelV2_get_require_confirmed_inputs(uint64_t this_ptr) {
38384         LDKOpenChannelV2 this_ptr_conv;
38385         this_ptr_conv.inner = untag_ptr(this_ptr);
38386         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
38387         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
38388         this_ptr_conv.is_owned = false;
38389         uint32_t ret_conv = LDKCOption_NoneZ_to_js(OpenChannelV2_get_require_confirmed_inputs(&this_ptr_conv));
38390         return ret_conv;
38391 }
38392
38393 void  __attribute__((export_name("TS_OpenChannelV2_set_require_confirmed_inputs"))) TS_OpenChannelV2_set_require_confirmed_inputs(uint64_t this_ptr, uint32_t val) {
38394         LDKOpenChannelV2 this_ptr_conv;
38395         this_ptr_conv.inner = untag_ptr(this_ptr);
38396         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
38397         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
38398         this_ptr_conv.is_owned = false;
38399         LDKCOption_NoneZ val_conv = LDKCOption_NoneZ_from_js(val);
38400         OpenChannelV2_set_require_confirmed_inputs(&this_ptr_conv, val_conv);
38401 }
38402
38403 uint64_t  __attribute__((export_name("TS_OpenChannelV2_new"))) TS_OpenChannelV2_new(int8_tArray chain_hash_arg, int8_tArray temporary_channel_id_arg, int32_t funding_feerate_sat_per_1000_weight_arg, int32_t commitment_feerate_sat_per_1000_weight_arg, int64_t funding_satoshis_arg, int64_t dust_limit_satoshis_arg, int64_t max_htlc_value_in_flight_msat_arg, int64_t htlc_minimum_msat_arg, int16_t to_self_delay_arg, int16_t max_accepted_htlcs_arg, int32_t locktime_arg, int8_tArray funding_pubkey_arg, int8_tArray revocation_basepoint_arg, int8_tArray payment_basepoint_arg, int8_tArray delayed_payment_basepoint_arg, int8_tArray htlc_basepoint_arg, int8_tArray first_per_commitment_point_arg, int8_tArray second_per_commitment_point_arg, int8_t channel_flags_arg, uint64_t shutdown_scriptpubkey_arg, uint64_t channel_type_arg, uint32_t require_confirmed_inputs_arg) {
38404         LDKThirtyTwoBytes chain_hash_arg_ref;
38405         CHECK(chain_hash_arg->arr_len == 32);
38406         memcpy(chain_hash_arg_ref.data, chain_hash_arg->elems, 32); FREE(chain_hash_arg);
38407         LDKThirtyTwoBytes temporary_channel_id_arg_ref;
38408         CHECK(temporary_channel_id_arg->arr_len == 32);
38409         memcpy(temporary_channel_id_arg_ref.data, temporary_channel_id_arg->elems, 32); FREE(temporary_channel_id_arg);
38410         LDKPublicKey funding_pubkey_arg_ref;
38411         CHECK(funding_pubkey_arg->arr_len == 33);
38412         memcpy(funding_pubkey_arg_ref.compressed_form, funding_pubkey_arg->elems, 33); FREE(funding_pubkey_arg);
38413         LDKPublicKey revocation_basepoint_arg_ref;
38414         CHECK(revocation_basepoint_arg->arr_len == 33);
38415         memcpy(revocation_basepoint_arg_ref.compressed_form, revocation_basepoint_arg->elems, 33); FREE(revocation_basepoint_arg);
38416         LDKPublicKey payment_basepoint_arg_ref;
38417         CHECK(payment_basepoint_arg->arr_len == 33);
38418         memcpy(payment_basepoint_arg_ref.compressed_form, payment_basepoint_arg->elems, 33); FREE(payment_basepoint_arg);
38419         LDKPublicKey delayed_payment_basepoint_arg_ref;
38420         CHECK(delayed_payment_basepoint_arg->arr_len == 33);
38421         memcpy(delayed_payment_basepoint_arg_ref.compressed_form, delayed_payment_basepoint_arg->elems, 33); FREE(delayed_payment_basepoint_arg);
38422         LDKPublicKey htlc_basepoint_arg_ref;
38423         CHECK(htlc_basepoint_arg->arr_len == 33);
38424         memcpy(htlc_basepoint_arg_ref.compressed_form, htlc_basepoint_arg->elems, 33); FREE(htlc_basepoint_arg);
38425         LDKPublicKey first_per_commitment_point_arg_ref;
38426         CHECK(first_per_commitment_point_arg->arr_len == 33);
38427         memcpy(first_per_commitment_point_arg_ref.compressed_form, first_per_commitment_point_arg->elems, 33); FREE(first_per_commitment_point_arg);
38428         LDKPublicKey second_per_commitment_point_arg_ref;
38429         CHECK(second_per_commitment_point_arg->arr_len == 33);
38430         memcpy(second_per_commitment_point_arg_ref.compressed_form, second_per_commitment_point_arg->elems, 33); FREE(second_per_commitment_point_arg);
38431         void* shutdown_scriptpubkey_arg_ptr = untag_ptr(shutdown_scriptpubkey_arg);
38432         CHECK_ACCESS(shutdown_scriptpubkey_arg_ptr);
38433         LDKCOption_CVec_u8ZZ shutdown_scriptpubkey_arg_conv = *(LDKCOption_CVec_u8ZZ*)(shutdown_scriptpubkey_arg_ptr);
38434         shutdown_scriptpubkey_arg_conv = COption_CVec_u8ZZ_clone((LDKCOption_CVec_u8ZZ*)untag_ptr(shutdown_scriptpubkey_arg));
38435         LDKChannelTypeFeatures channel_type_arg_conv;
38436         channel_type_arg_conv.inner = untag_ptr(channel_type_arg);
38437         channel_type_arg_conv.is_owned = ptr_is_owned(channel_type_arg);
38438         CHECK_INNER_FIELD_ACCESS_OR_NULL(channel_type_arg_conv);
38439         channel_type_arg_conv = ChannelTypeFeatures_clone(&channel_type_arg_conv);
38440         LDKCOption_NoneZ require_confirmed_inputs_arg_conv = LDKCOption_NoneZ_from_js(require_confirmed_inputs_arg);
38441         LDKOpenChannelV2 ret_var = OpenChannelV2_new(chain_hash_arg_ref, temporary_channel_id_arg_ref, funding_feerate_sat_per_1000_weight_arg, commitment_feerate_sat_per_1000_weight_arg, funding_satoshis_arg, dust_limit_satoshis_arg, max_htlc_value_in_flight_msat_arg, htlc_minimum_msat_arg, to_self_delay_arg, max_accepted_htlcs_arg, locktime_arg, funding_pubkey_arg_ref, revocation_basepoint_arg_ref, payment_basepoint_arg_ref, delayed_payment_basepoint_arg_ref, htlc_basepoint_arg_ref, first_per_commitment_point_arg_ref, second_per_commitment_point_arg_ref, channel_flags_arg, shutdown_scriptpubkey_arg_conv, channel_type_arg_conv, require_confirmed_inputs_arg_conv);
38442         uint64_t ret_ref = 0;
38443         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
38444         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
38445         return ret_ref;
38446 }
38447
38448 static inline uint64_t OpenChannelV2_clone_ptr(LDKOpenChannelV2 *NONNULL_PTR arg) {
38449         LDKOpenChannelV2 ret_var = OpenChannelV2_clone(arg);
38450         uint64_t ret_ref = 0;
38451         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
38452         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
38453         return ret_ref;
38454 }
38455 int64_t  __attribute__((export_name("TS_OpenChannelV2_clone_ptr"))) TS_OpenChannelV2_clone_ptr(uint64_t arg) {
38456         LDKOpenChannelV2 arg_conv;
38457         arg_conv.inner = untag_ptr(arg);
38458         arg_conv.is_owned = ptr_is_owned(arg);
38459         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
38460         arg_conv.is_owned = false;
38461         int64_t ret_conv = OpenChannelV2_clone_ptr(&arg_conv);
38462         return ret_conv;
38463 }
38464
38465 uint64_t  __attribute__((export_name("TS_OpenChannelV2_clone"))) TS_OpenChannelV2_clone(uint64_t orig) {
38466         LDKOpenChannelV2 orig_conv;
38467         orig_conv.inner = untag_ptr(orig);
38468         orig_conv.is_owned = ptr_is_owned(orig);
38469         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
38470         orig_conv.is_owned = false;
38471         LDKOpenChannelV2 ret_var = OpenChannelV2_clone(&orig_conv);
38472         uint64_t ret_ref = 0;
38473         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
38474         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
38475         return ret_ref;
38476 }
38477
38478 jboolean  __attribute__((export_name("TS_OpenChannelV2_eq"))) TS_OpenChannelV2_eq(uint64_t a, uint64_t b) {
38479         LDKOpenChannelV2 a_conv;
38480         a_conv.inner = untag_ptr(a);
38481         a_conv.is_owned = ptr_is_owned(a);
38482         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
38483         a_conv.is_owned = false;
38484         LDKOpenChannelV2 b_conv;
38485         b_conv.inner = untag_ptr(b);
38486         b_conv.is_owned = ptr_is_owned(b);
38487         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
38488         b_conv.is_owned = false;
38489         jboolean ret_conv = OpenChannelV2_eq(&a_conv, &b_conv);
38490         return ret_conv;
38491 }
38492
38493 void  __attribute__((export_name("TS_AcceptChannel_free"))) TS_AcceptChannel_free(uint64_t this_obj) {
38494         LDKAcceptChannel this_obj_conv;
38495         this_obj_conv.inner = untag_ptr(this_obj);
38496         this_obj_conv.is_owned = ptr_is_owned(this_obj);
38497         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
38498         AcceptChannel_free(this_obj_conv);
38499 }
38500
38501 int8_tArray  __attribute__((export_name("TS_AcceptChannel_get_temporary_channel_id"))) TS_AcceptChannel_get_temporary_channel_id(uint64_t this_ptr) {
38502         LDKAcceptChannel this_ptr_conv;
38503         this_ptr_conv.inner = untag_ptr(this_ptr);
38504         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
38505         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
38506         this_ptr_conv.is_owned = false;
38507         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
38508         memcpy(ret_arr->elems, *AcceptChannel_get_temporary_channel_id(&this_ptr_conv), 32);
38509         return ret_arr;
38510 }
38511
38512 void  __attribute__((export_name("TS_AcceptChannel_set_temporary_channel_id"))) TS_AcceptChannel_set_temporary_channel_id(uint64_t this_ptr, int8_tArray val) {
38513         LDKAcceptChannel this_ptr_conv;
38514         this_ptr_conv.inner = untag_ptr(this_ptr);
38515         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
38516         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
38517         this_ptr_conv.is_owned = false;
38518         LDKThirtyTwoBytes val_ref;
38519         CHECK(val->arr_len == 32);
38520         memcpy(val_ref.data, val->elems, 32); FREE(val);
38521         AcceptChannel_set_temporary_channel_id(&this_ptr_conv, val_ref);
38522 }
38523
38524 int64_t  __attribute__((export_name("TS_AcceptChannel_get_dust_limit_satoshis"))) TS_AcceptChannel_get_dust_limit_satoshis(uint64_t this_ptr) {
38525         LDKAcceptChannel this_ptr_conv;
38526         this_ptr_conv.inner = untag_ptr(this_ptr);
38527         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
38528         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
38529         this_ptr_conv.is_owned = false;
38530         int64_t ret_conv = AcceptChannel_get_dust_limit_satoshis(&this_ptr_conv);
38531         return ret_conv;
38532 }
38533
38534 void  __attribute__((export_name("TS_AcceptChannel_set_dust_limit_satoshis"))) TS_AcceptChannel_set_dust_limit_satoshis(uint64_t this_ptr, int64_t val) {
38535         LDKAcceptChannel this_ptr_conv;
38536         this_ptr_conv.inner = untag_ptr(this_ptr);
38537         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
38538         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
38539         this_ptr_conv.is_owned = false;
38540         AcceptChannel_set_dust_limit_satoshis(&this_ptr_conv, val);
38541 }
38542
38543 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) {
38544         LDKAcceptChannel this_ptr_conv;
38545         this_ptr_conv.inner = untag_ptr(this_ptr);
38546         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
38547         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
38548         this_ptr_conv.is_owned = false;
38549         int64_t ret_conv = AcceptChannel_get_max_htlc_value_in_flight_msat(&this_ptr_conv);
38550         return ret_conv;
38551 }
38552
38553 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) {
38554         LDKAcceptChannel this_ptr_conv;
38555         this_ptr_conv.inner = untag_ptr(this_ptr);
38556         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
38557         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
38558         this_ptr_conv.is_owned = false;
38559         AcceptChannel_set_max_htlc_value_in_flight_msat(&this_ptr_conv, val);
38560 }
38561
38562 int64_t  __attribute__((export_name("TS_AcceptChannel_get_channel_reserve_satoshis"))) TS_AcceptChannel_get_channel_reserve_satoshis(uint64_t this_ptr) {
38563         LDKAcceptChannel this_ptr_conv;
38564         this_ptr_conv.inner = untag_ptr(this_ptr);
38565         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
38566         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
38567         this_ptr_conv.is_owned = false;
38568         int64_t ret_conv = AcceptChannel_get_channel_reserve_satoshis(&this_ptr_conv);
38569         return ret_conv;
38570 }
38571
38572 void  __attribute__((export_name("TS_AcceptChannel_set_channel_reserve_satoshis"))) TS_AcceptChannel_set_channel_reserve_satoshis(uint64_t this_ptr, int64_t val) {
38573         LDKAcceptChannel this_ptr_conv;
38574         this_ptr_conv.inner = untag_ptr(this_ptr);
38575         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
38576         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
38577         this_ptr_conv.is_owned = false;
38578         AcceptChannel_set_channel_reserve_satoshis(&this_ptr_conv, val);
38579 }
38580
38581 int64_t  __attribute__((export_name("TS_AcceptChannel_get_htlc_minimum_msat"))) TS_AcceptChannel_get_htlc_minimum_msat(uint64_t this_ptr) {
38582         LDKAcceptChannel this_ptr_conv;
38583         this_ptr_conv.inner = untag_ptr(this_ptr);
38584         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
38585         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
38586         this_ptr_conv.is_owned = false;
38587         int64_t ret_conv = AcceptChannel_get_htlc_minimum_msat(&this_ptr_conv);
38588         return ret_conv;
38589 }
38590
38591 void  __attribute__((export_name("TS_AcceptChannel_set_htlc_minimum_msat"))) TS_AcceptChannel_set_htlc_minimum_msat(uint64_t this_ptr, int64_t val) {
38592         LDKAcceptChannel this_ptr_conv;
38593         this_ptr_conv.inner = untag_ptr(this_ptr);
38594         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
38595         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
38596         this_ptr_conv.is_owned = false;
38597         AcceptChannel_set_htlc_minimum_msat(&this_ptr_conv, val);
38598 }
38599
38600 int32_t  __attribute__((export_name("TS_AcceptChannel_get_minimum_depth"))) TS_AcceptChannel_get_minimum_depth(uint64_t this_ptr) {
38601         LDKAcceptChannel this_ptr_conv;
38602         this_ptr_conv.inner = untag_ptr(this_ptr);
38603         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
38604         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
38605         this_ptr_conv.is_owned = false;
38606         int32_t ret_conv = AcceptChannel_get_minimum_depth(&this_ptr_conv);
38607         return ret_conv;
38608 }
38609
38610 void  __attribute__((export_name("TS_AcceptChannel_set_minimum_depth"))) TS_AcceptChannel_set_minimum_depth(uint64_t this_ptr, int32_t val) {
38611         LDKAcceptChannel this_ptr_conv;
38612         this_ptr_conv.inner = untag_ptr(this_ptr);
38613         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
38614         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
38615         this_ptr_conv.is_owned = false;
38616         AcceptChannel_set_minimum_depth(&this_ptr_conv, val);
38617 }
38618
38619 int16_t  __attribute__((export_name("TS_AcceptChannel_get_to_self_delay"))) TS_AcceptChannel_get_to_self_delay(uint64_t this_ptr) {
38620         LDKAcceptChannel this_ptr_conv;
38621         this_ptr_conv.inner = untag_ptr(this_ptr);
38622         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
38623         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
38624         this_ptr_conv.is_owned = false;
38625         int16_t ret_conv = AcceptChannel_get_to_self_delay(&this_ptr_conv);
38626         return ret_conv;
38627 }
38628
38629 void  __attribute__((export_name("TS_AcceptChannel_set_to_self_delay"))) TS_AcceptChannel_set_to_self_delay(uint64_t this_ptr, int16_t val) {
38630         LDKAcceptChannel 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         AcceptChannel_set_to_self_delay(&this_ptr_conv, val);
38636 }
38637
38638 int16_t  __attribute__((export_name("TS_AcceptChannel_get_max_accepted_htlcs"))) TS_AcceptChannel_get_max_accepted_htlcs(uint64_t this_ptr) {
38639         LDKAcceptChannel this_ptr_conv;
38640         this_ptr_conv.inner = untag_ptr(this_ptr);
38641         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
38642         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
38643         this_ptr_conv.is_owned = false;
38644         int16_t ret_conv = AcceptChannel_get_max_accepted_htlcs(&this_ptr_conv);
38645         return ret_conv;
38646 }
38647
38648 void  __attribute__((export_name("TS_AcceptChannel_set_max_accepted_htlcs"))) TS_AcceptChannel_set_max_accepted_htlcs(uint64_t this_ptr, int16_t val) {
38649         LDKAcceptChannel this_ptr_conv;
38650         this_ptr_conv.inner = untag_ptr(this_ptr);
38651         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
38652         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
38653         this_ptr_conv.is_owned = false;
38654         AcceptChannel_set_max_accepted_htlcs(&this_ptr_conv, val);
38655 }
38656
38657 int8_tArray  __attribute__((export_name("TS_AcceptChannel_get_funding_pubkey"))) TS_AcceptChannel_get_funding_pubkey(uint64_t this_ptr) {
38658         LDKAcceptChannel this_ptr_conv;
38659         this_ptr_conv.inner = untag_ptr(this_ptr);
38660         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
38661         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
38662         this_ptr_conv.is_owned = false;
38663         int8_tArray ret_arr = init_int8_tArray(33, __LINE__);
38664         memcpy(ret_arr->elems, AcceptChannel_get_funding_pubkey(&this_ptr_conv).compressed_form, 33);
38665         return ret_arr;
38666 }
38667
38668 void  __attribute__((export_name("TS_AcceptChannel_set_funding_pubkey"))) TS_AcceptChannel_set_funding_pubkey(uint64_t this_ptr, int8_tArray val) {
38669         LDKAcceptChannel this_ptr_conv;
38670         this_ptr_conv.inner = untag_ptr(this_ptr);
38671         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
38672         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
38673         this_ptr_conv.is_owned = false;
38674         LDKPublicKey val_ref;
38675         CHECK(val->arr_len == 33);
38676         memcpy(val_ref.compressed_form, val->elems, 33); FREE(val);
38677         AcceptChannel_set_funding_pubkey(&this_ptr_conv, val_ref);
38678 }
38679
38680 int8_tArray  __attribute__((export_name("TS_AcceptChannel_get_revocation_basepoint"))) TS_AcceptChannel_get_revocation_basepoint(uint64_t this_ptr) {
38681         LDKAcceptChannel this_ptr_conv;
38682         this_ptr_conv.inner = untag_ptr(this_ptr);
38683         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
38684         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
38685         this_ptr_conv.is_owned = false;
38686         int8_tArray ret_arr = init_int8_tArray(33, __LINE__);
38687         memcpy(ret_arr->elems, AcceptChannel_get_revocation_basepoint(&this_ptr_conv).compressed_form, 33);
38688         return ret_arr;
38689 }
38690
38691 void  __attribute__((export_name("TS_AcceptChannel_set_revocation_basepoint"))) TS_AcceptChannel_set_revocation_basepoint(uint64_t this_ptr, int8_tArray val) {
38692         LDKAcceptChannel this_ptr_conv;
38693         this_ptr_conv.inner = untag_ptr(this_ptr);
38694         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
38695         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
38696         this_ptr_conv.is_owned = false;
38697         LDKPublicKey val_ref;
38698         CHECK(val->arr_len == 33);
38699         memcpy(val_ref.compressed_form, val->elems, 33); FREE(val);
38700         AcceptChannel_set_revocation_basepoint(&this_ptr_conv, val_ref);
38701 }
38702
38703 int8_tArray  __attribute__((export_name("TS_AcceptChannel_get_payment_point"))) TS_AcceptChannel_get_payment_point(uint64_t this_ptr) {
38704         LDKAcceptChannel this_ptr_conv;
38705         this_ptr_conv.inner = untag_ptr(this_ptr);
38706         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
38707         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
38708         this_ptr_conv.is_owned = false;
38709         int8_tArray ret_arr = init_int8_tArray(33, __LINE__);
38710         memcpy(ret_arr->elems, AcceptChannel_get_payment_point(&this_ptr_conv).compressed_form, 33);
38711         return ret_arr;
38712 }
38713
38714 void  __attribute__((export_name("TS_AcceptChannel_set_payment_point"))) TS_AcceptChannel_set_payment_point(uint64_t this_ptr, int8_tArray val) {
38715         LDKAcceptChannel this_ptr_conv;
38716         this_ptr_conv.inner = untag_ptr(this_ptr);
38717         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
38718         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
38719         this_ptr_conv.is_owned = false;
38720         LDKPublicKey val_ref;
38721         CHECK(val->arr_len == 33);
38722         memcpy(val_ref.compressed_form, val->elems, 33); FREE(val);
38723         AcceptChannel_set_payment_point(&this_ptr_conv, val_ref);
38724 }
38725
38726 int8_tArray  __attribute__((export_name("TS_AcceptChannel_get_delayed_payment_basepoint"))) TS_AcceptChannel_get_delayed_payment_basepoint(uint64_t this_ptr) {
38727         LDKAcceptChannel this_ptr_conv;
38728         this_ptr_conv.inner = untag_ptr(this_ptr);
38729         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
38730         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
38731         this_ptr_conv.is_owned = false;
38732         int8_tArray ret_arr = init_int8_tArray(33, __LINE__);
38733         memcpy(ret_arr->elems, AcceptChannel_get_delayed_payment_basepoint(&this_ptr_conv).compressed_form, 33);
38734         return ret_arr;
38735 }
38736
38737 void  __attribute__((export_name("TS_AcceptChannel_set_delayed_payment_basepoint"))) TS_AcceptChannel_set_delayed_payment_basepoint(uint64_t this_ptr, int8_tArray val) {
38738         LDKAcceptChannel this_ptr_conv;
38739         this_ptr_conv.inner = untag_ptr(this_ptr);
38740         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
38741         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
38742         this_ptr_conv.is_owned = false;
38743         LDKPublicKey val_ref;
38744         CHECK(val->arr_len == 33);
38745         memcpy(val_ref.compressed_form, val->elems, 33); FREE(val);
38746         AcceptChannel_set_delayed_payment_basepoint(&this_ptr_conv, val_ref);
38747 }
38748
38749 int8_tArray  __attribute__((export_name("TS_AcceptChannel_get_htlc_basepoint"))) TS_AcceptChannel_get_htlc_basepoint(uint64_t this_ptr) {
38750         LDKAcceptChannel this_ptr_conv;
38751         this_ptr_conv.inner = untag_ptr(this_ptr);
38752         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
38753         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
38754         this_ptr_conv.is_owned = false;
38755         int8_tArray ret_arr = init_int8_tArray(33, __LINE__);
38756         memcpy(ret_arr->elems, AcceptChannel_get_htlc_basepoint(&this_ptr_conv).compressed_form, 33);
38757         return ret_arr;
38758 }
38759
38760 void  __attribute__((export_name("TS_AcceptChannel_set_htlc_basepoint"))) TS_AcceptChannel_set_htlc_basepoint(uint64_t this_ptr, int8_tArray val) {
38761         LDKAcceptChannel this_ptr_conv;
38762         this_ptr_conv.inner = untag_ptr(this_ptr);
38763         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
38764         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
38765         this_ptr_conv.is_owned = false;
38766         LDKPublicKey val_ref;
38767         CHECK(val->arr_len == 33);
38768         memcpy(val_ref.compressed_form, val->elems, 33); FREE(val);
38769         AcceptChannel_set_htlc_basepoint(&this_ptr_conv, val_ref);
38770 }
38771
38772 int8_tArray  __attribute__((export_name("TS_AcceptChannel_get_first_per_commitment_point"))) TS_AcceptChannel_get_first_per_commitment_point(uint64_t this_ptr) {
38773         LDKAcceptChannel this_ptr_conv;
38774         this_ptr_conv.inner = untag_ptr(this_ptr);
38775         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
38776         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
38777         this_ptr_conv.is_owned = false;
38778         int8_tArray ret_arr = init_int8_tArray(33, __LINE__);
38779         memcpy(ret_arr->elems, AcceptChannel_get_first_per_commitment_point(&this_ptr_conv).compressed_form, 33);
38780         return ret_arr;
38781 }
38782
38783 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) {
38784         LDKAcceptChannel this_ptr_conv;
38785         this_ptr_conv.inner = untag_ptr(this_ptr);
38786         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
38787         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
38788         this_ptr_conv.is_owned = false;
38789         LDKPublicKey val_ref;
38790         CHECK(val->arr_len == 33);
38791         memcpy(val_ref.compressed_form, val->elems, 33); FREE(val);
38792         AcceptChannel_set_first_per_commitment_point(&this_ptr_conv, val_ref);
38793 }
38794
38795 uint64_t  __attribute__((export_name("TS_AcceptChannel_get_shutdown_scriptpubkey"))) TS_AcceptChannel_get_shutdown_scriptpubkey(uint64_t this_ptr) {
38796         LDKAcceptChannel this_ptr_conv;
38797         this_ptr_conv.inner = untag_ptr(this_ptr);
38798         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
38799         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
38800         this_ptr_conv.is_owned = false;
38801         LDKCOption_CVec_u8ZZ *ret_copy = MALLOC(sizeof(LDKCOption_CVec_u8ZZ), "LDKCOption_CVec_u8ZZ");
38802         *ret_copy = AcceptChannel_get_shutdown_scriptpubkey(&this_ptr_conv);
38803         uint64_t ret_ref = tag_ptr(ret_copy, true);
38804         return ret_ref;
38805 }
38806
38807 void  __attribute__((export_name("TS_AcceptChannel_set_shutdown_scriptpubkey"))) TS_AcceptChannel_set_shutdown_scriptpubkey(uint64_t this_ptr, uint64_t val) {
38808         LDKAcceptChannel this_ptr_conv;
38809         this_ptr_conv.inner = untag_ptr(this_ptr);
38810         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
38811         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
38812         this_ptr_conv.is_owned = false;
38813         void* val_ptr = untag_ptr(val);
38814         CHECK_ACCESS(val_ptr);
38815         LDKCOption_CVec_u8ZZ val_conv = *(LDKCOption_CVec_u8ZZ*)(val_ptr);
38816         val_conv = COption_CVec_u8ZZ_clone((LDKCOption_CVec_u8ZZ*)untag_ptr(val));
38817         AcceptChannel_set_shutdown_scriptpubkey(&this_ptr_conv, val_conv);
38818 }
38819
38820 uint64_t  __attribute__((export_name("TS_AcceptChannel_get_channel_type"))) TS_AcceptChannel_get_channel_type(uint64_t this_ptr) {
38821         LDKAcceptChannel this_ptr_conv;
38822         this_ptr_conv.inner = untag_ptr(this_ptr);
38823         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
38824         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
38825         this_ptr_conv.is_owned = false;
38826         LDKChannelTypeFeatures ret_var = AcceptChannel_get_channel_type(&this_ptr_conv);
38827         uint64_t ret_ref = 0;
38828         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
38829         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
38830         return ret_ref;
38831 }
38832
38833 void  __attribute__((export_name("TS_AcceptChannel_set_channel_type"))) TS_AcceptChannel_set_channel_type(uint64_t this_ptr, uint64_t val) {
38834         LDKAcceptChannel this_ptr_conv;
38835         this_ptr_conv.inner = untag_ptr(this_ptr);
38836         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
38837         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
38838         this_ptr_conv.is_owned = false;
38839         LDKChannelTypeFeatures val_conv;
38840         val_conv.inner = untag_ptr(val);
38841         val_conv.is_owned = ptr_is_owned(val);
38842         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
38843         val_conv = ChannelTypeFeatures_clone(&val_conv);
38844         AcceptChannel_set_channel_type(&this_ptr_conv, val_conv);
38845 }
38846
38847 uint64_t  __attribute__((export_name("TS_AcceptChannel_new"))) TS_AcceptChannel_new(int8_tArray temporary_channel_id_arg, int64_t dust_limit_satoshis_arg, int64_t max_htlc_value_in_flight_msat_arg, int64_t channel_reserve_satoshis_arg, int64_t htlc_minimum_msat_arg, int32_t minimum_depth_arg, int16_t to_self_delay_arg, int16_t max_accepted_htlcs_arg, 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, int8_tArray first_per_commitment_point_arg, uint64_t shutdown_scriptpubkey_arg, uint64_t channel_type_arg) {
38848         LDKThirtyTwoBytes temporary_channel_id_arg_ref;
38849         CHECK(temporary_channel_id_arg->arr_len == 32);
38850         memcpy(temporary_channel_id_arg_ref.data, temporary_channel_id_arg->elems, 32); FREE(temporary_channel_id_arg);
38851         LDKPublicKey funding_pubkey_arg_ref;
38852         CHECK(funding_pubkey_arg->arr_len == 33);
38853         memcpy(funding_pubkey_arg_ref.compressed_form, funding_pubkey_arg->elems, 33); FREE(funding_pubkey_arg);
38854         LDKPublicKey revocation_basepoint_arg_ref;
38855         CHECK(revocation_basepoint_arg->arr_len == 33);
38856         memcpy(revocation_basepoint_arg_ref.compressed_form, revocation_basepoint_arg->elems, 33); FREE(revocation_basepoint_arg);
38857         LDKPublicKey payment_point_arg_ref;
38858         CHECK(payment_point_arg->arr_len == 33);
38859         memcpy(payment_point_arg_ref.compressed_form, payment_point_arg->elems, 33); FREE(payment_point_arg);
38860         LDKPublicKey delayed_payment_basepoint_arg_ref;
38861         CHECK(delayed_payment_basepoint_arg->arr_len == 33);
38862         memcpy(delayed_payment_basepoint_arg_ref.compressed_form, delayed_payment_basepoint_arg->elems, 33); FREE(delayed_payment_basepoint_arg);
38863         LDKPublicKey htlc_basepoint_arg_ref;
38864         CHECK(htlc_basepoint_arg->arr_len == 33);
38865         memcpy(htlc_basepoint_arg_ref.compressed_form, htlc_basepoint_arg->elems, 33); FREE(htlc_basepoint_arg);
38866         LDKPublicKey first_per_commitment_point_arg_ref;
38867         CHECK(first_per_commitment_point_arg->arr_len == 33);
38868         memcpy(first_per_commitment_point_arg_ref.compressed_form, first_per_commitment_point_arg->elems, 33); FREE(first_per_commitment_point_arg);
38869         void* shutdown_scriptpubkey_arg_ptr = untag_ptr(shutdown_scriptpubkey_arg);
38870         CHECK_ACCESS(shutdown_scriptpubkey_arg_ptr);
38871         LDKCOption_CVec_u8ZZ shutdown_scriptpubkey_arg_conv = *(LDKCOption_CVec_u8ZZ*)(shutdown_scriptpubkey_arg_ptr);
38872         shutdown_scriptpubkey_arg_conv = COption_CVec_u8ZZ_clone((LDKCOption_CVec_u8ZZ*)untag_ptr(shutdown_scriptpubkey_arg));
38873         LDKChannelTypeFeatures channel_type_arg_conv;
38874         channel_type_arg_conv.inner = untag_ptr(channel_type_arg);
38875         channel_type_arg_conv.is_owned = ptr_is_owned(channel_type_arg);
38876         CHECK_INNER_FIELD_ACCESS_OR_NULL(channel_type_arg_conv);
38877         channel_type_arg_conv = ChannelTypeFeatures_clone(&channel_type_arg_conv);
38878         LDKAcceptChannel ret_var = AcceptChannel_new(temporary_channel_id_arg_ref, dust_limit_satoshis_arg, max_htlc_value_in_flight_msat_arg, channel_reserve_satoshis_arg, htlc_minimum_msat_arg, minimum_depth_arg, to_self_delay_arg, max_accepted_htlcs_arg, funding_pubkey_arg_ref, revocation_basepoint_arg_ref, payment_point_arg_ref, delayed_payment_basepoint_arg_ref, htlc_basepoint_arg_ref, first_per_commitment_point_arg_ref, shutdown_scriptpubkey_arg_conv, channel_type_arg_conv);
38879         uint64_t ret_ref = 0;
38880         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
38881         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
38882         return ret_ref;
38883 }
38884
38885 static inline uint64_t AcceptChannel_clone_ptr(LDKAcceptChannel *NONNULL_PTR arg) {
38886         LDKAcceptChannel ret_var = AcceptChannel_clone(arg);
38887         uint64_t ret_ref = 0;
38888         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
38889         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
38890         return ret_ref;
38891 }
38892 int64_t  __attribute__((export_name("TS_AcceptChannel_clone_ptr"))) TS_AcceptChannel_clone_ptr(uint64_t arg) {
38893         LDKAcceptChannel arg_conv;
38894         arg_conv.inner = untag_ptr(arg);
38895         arg_conv.is_owned = ptr_is_owned(arg);
38896         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
38897         arg_conv.is_owned = false;
38898         int64_t ret_conv = AcceptChannel_clone_ptr(&arg_conv);
38899         return ret_conv;
38900 }
38901
38902 uint64_t  __attribute__((export_name("TS_AcceptChannel_clone"))) TS_AcceptChannel_clone(uint64_t orig) {
38903         LDKAcceptChannel orig_conv;
38904         orig_conv.inner = untag_ptr(orig);
38905         orig_conv.is_owned = ptr_is_owned(orig);
38906         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
38907         orig_conv.is_owned = false;
38908         LDKAcceptChannel ret_var = AcceptChannel_clone(&orig_conv);
38909         uint64_t ret_ref = 0;
38910         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
38911         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
38912         return ret_ref;
38913 }
38914
38915 jboolean  __attribute__((export_name("TS_AcceptChannel_eq"))) TS_AcceptChannel_eq(uint64_t a, uint64_t b) {
38916         LDKAcceptChannel a_conv;
38917         a_conv.inner = untag_ptr(a);
38918         a_conv.is_owned = ptr_is_owned(a);
38919         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
38920         a_conv.is_owned = false;
38921         LDKAcceptChannel b_conv;
38922         b_conv.inner = untag_ptr(b);
38923         b_conv.is_owned = ptr_is_owned(b);
38924         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
38925         b_conv.is_owned = false;
38926         jboolean ret_conv = AcceptChannel_eq(&a_conv, &b_conv);
38927         return ret_conv;
38928 }
38929
38930 void  __attribute__((export_name("TS_AcceptChannelV2_free"))) TS_AcceptChannelV2_free(uint64_t this_obj) {
38931         LDKAcceptChannelV2 this_obj_conv;
38932         this_obj_conv.inner = untag_ptr(this_obj);
38933         this_obj_conv.is_owned = ptr_is_owned(this_obj);
38934         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
38935         AcceptChannelV2_free(this_obj_conv);
38936 }
38937
38938 int8_tArray  __attribute__((export_name("TS_AcceptChannelV2_get_temporary_channel_id"))) TS_AcceptChannelV2_get_temporary_channel_id(uint64_t this_ptr) {
38939         LDKAcceptChannelV2 this_ptr_conv;
38940         this_ptr_conv.inner = untag_ptr(this_ptr);
38941         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
38942         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
38943         this_ptr_conv.is_owned = false;
38944         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
38945         memcpy(ret_arr->elems, *AcceptChannelV2_get_temporary_channel_id(&this_ptr_conv), 32);
38946         return ret_arr;
38947 }
38948
38949 void  __attribute__((export_name("TS_AcceptChannelV2_set_temporary_channel_id"))) TS_AcceptChannelV2_set_temporary_channel_id(uint64_t this_ptr, int8_tArray val) {
38950         LDKAcceptChannelV2 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         LDKThirtyTwoBytes val_ref;
38956         CHECK(val->arr_len == 32);
38957         memcpy(val_ref.data, val->elems, 32); FREE(val);
38958         AcceptChannelV2_set_temporary_channel_id(&this_ptr_conv, val_ref);
38959 }
38960
38961 int64_t  __attribute__((export_name("TS_AcceptChannelV2_get_funding_satoshis"))) TS_AcceptChannelV2_get_funding_satoshis(uint64_t this_ptr) {
38962         LDKAcceptChannelV2 this_ptr_conv;
38963         this_ptr_conv.inner = untag_ptr(this_ptr);
38964         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
38965         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
38966         this_ptr_conv.is_owned = false;
38967         int64_t ret_conv = AcceptChannelV2_get_funding_satoshis(&this_ptr_conv);
38968         return ret_conv;
38969 }
38970
38971 void  __attribute__((export_name("TS_AcceptChannelV2_set_funding_satoshis"))) TS_AcceptChannelV2_set_funding_satoshis(uint64_t this_ptr, int64_t val) {
38972         LDKAcceptChannelV2 this_ptr_conv;
38973         this_ptr_conv.inner = untag_ptr(this_ptr);
38974         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
38975         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
38976         this_ptr_conv.is_owned = false;
38977         AcceptChannelV2_set_funding_satoshis(&this_ptr_conv, val);
38978 }
38979
38980 int64_t  __attribute__((export_name("TS_AcceptChannelV2_get_dust_limit_satoshis"))) TS_AcceptChannelV2_get_dust_limit_satoshis(uint64_t this_ptr) {
38981         LDKAcceptChannelV2 this_ptr_conv;
38982         this_ptr_conv.inner = untag_ptr(this_ptr);
38983         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
38984         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
38985         this_ptr_conv.is_owned = false;
38986         int64_t ret_conv = AcceptChannelV2_get_dust_limit_satoshis(&this_ptr_conv);
38987         return ret_conv;
38988 }
38989
38990 void  __attribute__((export_name("TS_AcceptChannelV2_set_dust_limit_satoshis"))) TS_AcceptChannelV2_set_dust_limit_satoshis(uint64_t this_ptr, int64_t val) {
38991         LDKAcceptChannelV2 this_ptr_conv;
38992         this_ptr_conv.inner = untag_ptr(this_ptr);
38993         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
38994         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
38995         this_ptr_conv.is_owned = false;
38996         AcceptChannelV2_set_dust_limit_satoshis(&this_ptr_conv, val);
38997 }
38998
38999 int64_t  __attribute__((export_name("TS_AcceptChannelV2_get_max_htlc_value_in_flight_msat"))) TS_AcceptChannelV2_get_max_htlc_value_in_flight_msat(uint64_t this_ptr) {
39000         LDKAcceptChannelV2 this_ptr_conv;
39001         this_ptr_conv.inner = untag_ptr(this_ptr);
39002         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
39003         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
39004         this_ptr_conv.is_owned = false;
39005         int64_t ret_conv = AcceptChannelV2_get_max_htlc_value_in_flight_msat(&this_ptr_conv);
39006         return ret_conv;
39007 }
39008
39009 void  __attribute__((export_name("TS_AcceptChannelV2_set_max_htlc_value_in_flight_msat"))) TS_AcceptChannelV2_set_max_htlc_value_in_flight_msat(uint64_t this_ptr, int64_t val) {
39010         LDKAcceptChannelV2 this_ptr_conv;
39011         this_ptr_conv.inner = untag_ptr(this_ptr);
39012         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
39013         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
39014         this_ptr_conv.is_owned = false;
39015         AcceptChannelV2_set_max_htlc_value_in_flight_msat(&this_ptr_conv, val);
39016 }
39017
39018 int64_t  __attribute__((export_name("TS_AcceptChannelV2_get_htlc_minimum_msat"))) TS_AcceptChannelV2_get_htlc_minimum_msat(uint64_t this_ptr) {
39019         LDKAcceptChannelV2 this_ptr_conv;
39020         this_ptr_conv.inner = untag_ptr(this_ptr);
39021         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
39022         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
39023         this_ptr_conv.is_owned = false;
39024         int64_t ret_conv = AcceptChannelV2_get_htlc_minimum_msat(&this_ptr_conv);
39025         return ret_conv;
39026 }
39027
39028 void  __attribute__((export_name("TS_AcceptChannelV2_set_htlc_minimum_msat"))) TS_AcceptChannelV2_set_htlc_minimum_msat(uint64_t this_ptr, int64_t val) {
39029         LDKAcceptChannelV2 this_ptr_conv;
39030         this_ptr_conv.inner = untag_ptr(this_ptr);
39031         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
39032         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
39033         this_ptr_conv.is_owned = false;
39034         AcceptChannelV2_set_htlc_minimum_msat(&this_ptr_conv, val);
39035 }
39036
39037 int32_t  __attribute__((export_name("TS_AcceptChannelV2_get_minimum_depth"))) TS_AcceptChannelV2_get_minimum_depth(uint64_t this_ptr) {
39038         LDKAcceptChannelV2 this_ptr_conv;
39039         this_ptr_conv.inner = untag_ptr(this_ptr);
39040         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
39041         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
39042         this_ptr_conv.is_owned = false;
39043         int32_t ret_conv = AcceptChannelV2_get_minimum_depth(&this_ptr_conv);
39044         return ret_conv;
39045 }
39046
39047 void  __attribute__((export_name("TS_AcceptChannelV2_set_minimum_depth"))) TS_AcceptChannelV2_set_minimum_depth(uint64_t this_ptr, int32_t val) {
39048         LDKAcceptChannelV2 this_ptr_conv;
39049         this_ptr_conv.inner = untag_ptr(this_ptr);
39050         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
39051         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
39052         this_ptr_conv.is_owned = false;
39053         AcceptChannelV2_set_minimum_depth(&this_ptr_conv, val);
39054 }
39055
39056 int16_t  __attribute__((export_name("TS_AcceptChannelV2_get_to_self_delay"))) TS_AcceptChannelV2_get_to_self_delay(uint64_t this_ptr) {
39057         LDKAcceptChannelV2 this_ptr_conv;
39058         this_ptr_conv.inner = untag_ptr(this_ptr);
39059         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
39060         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
39061         this_ptr_conv.is_owned = false;
39062         int16_t ret_conv = AcceptChannelV2_get_to_self_delay(&this_ptr_conv);
39063         return ret_conv;
39064 }
39065
39066 void  __attribute__((export_name("TS_AcceptChannelV2_set_to_self_delay"))) TS_AcceptChannelV2_set_to_self_delay(uint64_t this_ptr, int16_t val) {
39067         LDKAcceptChannelV2 this_ptr_conv;
39068         this_ptr_conv.inner = untag_ptr(this_ptr);
39069         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
39070         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
39071         this_ptr_conv.is_owned = false;
39072         AcceptChannelV2_set_to_self_delay(&this_ptr_conv, val);
39073 }
39074
39075 int16_t  __attribute__((export_name("TS_AcceptChannelV2_get_max_accepted_htlcs"))) TS_AcceptChannelV2_get_max_accepted_htlcs(uint64_t this_ptr) {
39076         LDKAcceptChannelV2 this_ptr_conv;
39077         this_ptr_conv.inner = untag_ptr(this_ptr);
39078         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
39079         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
39080         this_ptr_conv.is_owned = false;
39081         int16_t ret_conv = AcceptChannelV2_get_max_accepted_htlcs(&this_ptr_conv);
39082         return ret_conv;
39083 }
39084
39085 void  __attribute__((export_name("TS_AcceptChannelV2_set_max_accepted_htlcs"))) TS_AcceptChannelV2_set_max_accepted_htlcs(uint64_t this_ptr, int16_t val) {
39086         LDKAcceptChannelV2 this_ptr_conv;
39087         this_ptr_conv.inner = untag_ptr(this_ptr);
39088         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
39089         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
39090         this_ptr_conv.is_owned = false;
39091         AcceptChannelV2_set_max_accepted_htlcs(&this_ptr_conv, val);
39092 }
39093
39094 int8_tArray  __attribute__((export_name("TS_AcceptChannelV2_get_funding_pubkey"))) TS_AcceptChannelV2_get_funding_pubkey(uint64_t this_ptr) {
39095         LDKAcceptChannelV2 this_ptr_conv;
39096         this_ptr_conv.inner = untag_ptr(this_ptr);
39097         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
39098         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
39099         this_ptr_conv.is_owned = false;
39100         int8_tArray ret_arr = init_int8_tArray(33, __LINE__);
39101         memcpy(ret_arr->elems, AcceptChannelV2_get_funding_pubkey(&this_ptr_conv).compressed_form, 33);
39102         return ret_arr;
39103 }
39104
39105 void  __attribute__((export_name("TS_AcceptChannelV2_set_funding_pubkey"))) TS_AcceptChannelV2_set_funding_pubkey(uint64_t this_ptr, int8_tArray val) {
39106         LDKAcceptChannelV2 this_ptr_conv;
39107         this_ptr_conv.inner = untag_ptr(this_ptr);
39108         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
39109         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
39110         this_ptr_conv.is_owned = false;
39111         LDKPublicKey val_ref;
39112         CHECK(val->arr_len == 33);
39113         memcpy(val_ref.compressed_form, val->elems, 33); FREE(val);
39114         AcceptChannelV2_set_funding_pubkey(&this_ptr_conv, val_ref);
39115 }
39116
39117 int8_tArray  __attribute__((export_name("TS_AcceptChannelV2_get_revocation_basepoint"))) TS_AcceptChannelV2_get_revocation_basepoint(uint64_t this_ptr) {
39118         LDKAcceptChannelV2 this_ptr_conv;
39119         this_ptr_conv.inner = untag_ptr(this_ptr);
39120         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
39121         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
39122         this_ptr_conv.is_owned = false;
39123         int8_tArray ret_arr = init_int8_tArray(33, __LINE__);
39124         memcpy(ret_arr->elems, AcceptChannelV2_get_revocation_basepoint(&this_ptr_conv).compressed_form, 33);
39125         return ret_arr;
39126 }
39127
39128 void  __attribute__((export_name("TS_AcceptChannelV2_set_revocation_basepoint"))) TS_AcceptChannelV2_set_revocation_basepoint(uint64_t this_ptr, int8_tArray val) {
39129         LDKAcceptChannelV2 this_ptr_conv;
39130         this_ptr_conv.inner = untag_ptr(this_ptr);
39131         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
39132         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
39133         this_ptr_conv.is_owned = false;
39134         LDKPublicKey val_ref;
39135         CHECK(val->arr_len == 33);
39136         memcpy(val_ref.compressed_form, val->elems, 33); FREE(val);
39137         AcceptChannelV2_set_revocation_basepoint(&this_ptr_conv, val_ref);
39138 }
39139
39140 int8_tArray  __attribute__((export_name("TS_AcceptChannelV2_get_payment_basepoint"))) TS_AcceptChannelV2_get_payment_basepoint(uint64_t this_ptr) {
39141         LDKAcceptChannelV2 this_ptr_conv;
39142         this_ptr_conv.inner = untag_ptr(this_ptr);
39143         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
39144         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
39145         this_ptr_conv.is_owned = false;
39146         int8_tArray ret_arr = init_int8_tArray(33, __LINE__);
39147         memcpy(ret_arr->elems, AcceptChannelV2_get_payment_basepoint(&this_ptr_conv).compressed_form, 33);
39148         return ret_arr;
39149 }
39150
39151 void  __attribute__((export_name("TS_AcceptChannelV2_set_payment_basepoint"))) TS_AcceptChannelV2_set_payment_basepoint(uint64_t this_ptr, int8_tArray val) {
39152         LDKAcceptChannelV2 this_ptr_conv;
39153         this_ptr_conv.inner = untag_ptr(this_ptr);
39154         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
39155         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
39156         this_ptr_conv.is_owned = false;
39157         LDKPublicKey val_ref;
39158         CHECK(val->arr_len == 33);
39159         memcpy(val_ref.compressed_form, val->elems, 33); FREE(val);
39160         AcceptChannelV2_set_payment_basepoint(&this_ptr_conv, val_ref);
39161 }
39162
39163 int8_tArray  __attribute__((export_name("TS_AcceptChannelV2_get_delayed_payment_basepoint"))) TS_AcceptChannelV2_get_delayed_payment_basepoint(uint64_t this_ptr) {
39164         LDKAcceptChannelV2 this_ptr_conv;
39165         this_ptr_conv.inner = untag_ptr(this_ptr);
39166         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
39167         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
39168         this_ptr_conv.is_owned = false;
39169         int8_tArray ret_arr = init_int8_tArray(33, __LINE__);
39170         memcpy(ret_arr->elems, AcceptChannelV2_get_delayed_payment_basepoint(&this_ptr_conv).compressed_form, 33);
39171         return ret_arr;
39172 }
39173
39174 void  __attribute__((export_name("TS_AcceptChannelV2_set_delayed_payment_basepoint"))) TS_AcceptChannelV2_set_delayed_payment_basepoint(uint64_t this_ptr, int8_tArray val) {
39175         LDKAcceptChannelV2 this_ptr_conv;
39176         this_ptr_conv.inner = untag_ptr(this_ptr);
39177         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
39178         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
39179         this_ptr_conv.is_owned = false;
39180         LDKPublicKey val_ref;
39181         CHECK(val->arr_len == 33);
39182         memcpy(val_ref.compressed_form, val->elems, 33); FREE(val);
39183         AcceptChannelV2_set_delayed_payment_basepoint(&this_ptr_conv, val_ref);
39184 }
39185
39186 int8_tArray  __attribute__((export_name("TS_AcceptChannelV2_get_htlc_basepoint"))) TS_AcceptChannelV2_get_htlc_basepoint(uint64_t this_ptr) {
39187         LDKAcceptChannelV2 this_ptr_conv;
39188         this_ptr_conv.inner = untag_ptr(this_ptr);
39189         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
39190         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
39191         this_ptr_conv.is_owned = false;
39192         int8_tArray ret_arr = init_int8_tArray(33, __LINE__);
39193         memcpy(ret_arr->elems, AcceptChannelV2_get_htlc_basepoint(&this_ptr_conv).compressed_form, 33);
39194         return ret_arr;
39195 }
39196
39197 void  __attribute__((export_name("TS_AcceptChannelV2_set_htlc_basepoint"))) TS_AcceptChannelV2_set_htlc_basepoint(uint64_t this_ptr, int8_tArray val) {
39198         LDKAcceptChannelV2 this_ptr_conv;
39199         this_ptr_conv.inner = untag_ptr(this_ptr);
39200         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
39201         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
39202         this_ptr_conv.is_owned = false;
39203         LDKPublicKey val_ref;
39204         CHECK(val->arr_len == 33);
39205         memcpy(val_ref.compressed_form, val->elems, 33); FREE(val);
39206         AcceptChannelV2_set_htlc_basepoint(&this_ptr_conv, val_ref);
39207 }
39208
39209 int8_tArray  __attribute__((export_name("TS_AcceptChannelV2_get_first_per_commitment_point"))) TS_AcceptChannelV2_get_first_per_commitment_point(uint64_t this_ptr) {
39210         LDKAcceptChannelV2 this_ptr_conv;
39211         this_ptr_conv.inner = untag_ptr(this_ptr);
39212         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
39213         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
39214         this_ptr_conv.is_owned = false;
39215         int8_tArray ret_arr = init_int8_tArray(33, __LINE__);
39216         memcpy(ret_arr->elems, AcceptChannelV2_get_first_per_commitment_point(&this_ptr_conv).compressed_form, 33);
39217         return ret_arr;
39218 }
39219
39220 void  __attribute__((export_name("TS_AcceptChannelV2_set_first_per_commitment_point"))) TS_AcceptChannelV2_set_first_per_commitment_point(uint64_t this_ptr, int8_tArray val) {
39221         LDKAcceptChannelV2 this_ptr_conv;
39222         this_ptr_conv.inner = untag_ptr(this_ptr);
39223         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
39224         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
39225         this_ptr_conv.is_owned = false;
39226         LDKPublicKey val_ref;
39227         CHECK(val->arr_len == 33);
39228         memcpy(val_ref.compressed_form, val->elems, 33); FREE(val);
39229         AcceptChannelV2_set_first_per_commitment_point(&this_ptr_conv, val_ref);
39230 }
39231
39232 int8_tArray  __attribute__((export_name("TS_AcceptChannelV2_get_second_per_commitment_point"))) TS_AcceptChannelV2_get_second_per_commitment_point(uint64_t this_ptr) {
39233         LDKAcceptChannelV2 this_ptr_conv;
39234         this_ptr_conv.inner = untag_ptr(this_ptr);
39235         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
39236         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
39237         this_ptr_conv.is_owned = false;
39238         int8_tArray ret_arr = init_int8_tArray(33, __LINE__);
39239         memcpy(ret_arr->elems, AcceptChannelV2_get_second_per_commitment_point(&this_ptr_conv).compressed_form, 33);
39240         return ret_arr;
39241 }
39242
39243 void  __attribute__((export_name("TS_AcceptChannelV2_set_second_per_commitment_point"))) TS_AcceptChannelV2_set_second_per_commitment_point(uint64_t this_ptr, int8_tArray val) {
39244         LDKAcceptChannelV2 this_ptr_conv;
39245         this_ptr_conv.inner = untag_ptr(this_ptr);
39246         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
39247         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
39248         this_ptr_conv.is_owned = false;
39249         LDKPublicKey val_ref;
39250         CHECK(val->arr_len == 33);
39251         memcpy(val_ref.compressed_form, val->elems, 33); FREE(val);
39252         AcceptChannelV2_set_second_per_commitment_point(&this_ptr_conv, val_ref);
39253 }
39254
39255 uint64_t  __attribute__((export_name("TS_AcceptChannelV2_get_shutdown_scriptpubkey"))) TS_AcceptChannelV2_get_shutdown_scriptpubkey(uint64_t this_ptr) {
39256         LDKAcceptChannelV2 this_ptr_conv;
39257         this_ptr_conv.inner = untag_ptr(this_ptr);
39258         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
39259         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
39260         this_ptr_conv.is_owned = false;
39261         LDKCOption_CVec_u8ZZ *ret_copy = MALLOC(sizeof(LDKCOption_CVec_u8ZZ), "LDKCOption_CVec_u8ZZ");
39262         *ret_copy = AcceptChannelV2_get_shutdown_scriptpubkey(&this_ptr_conv);
39263         uint64_t ret_ref = tag_ptr(ret_copy, true);
39264         return ret_ref;
39265 }
39266
39267 void  __attribute__((export_name("TS_AcceptChannelV2_set_shutdown_scriptpubkey"))) TS_AcceptChannelV2_set_shutdown_scriptpubkey(uint64_t this_ptr, uint64_t val) {
39268         LDKAcceptChannelV2 this_ptr_conv;
39269         this_ptr_conv.inner = untag_ptr(this_ptr);
39270         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
39271         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
39272         this_ptr_conv.is_owned = false;
39273         void* val_ptr = untag_ptr(val);
39274         CHECK_ACCESS(val_ptr);
39275         LDKCOption_CVec_u8ZZ val_conv = *(LDKCOption_CVec_u8ZZ*)(val_ptr);
39276         val_conv = COption_CVec_u8ZZ_clone((LDKCOption_CVec_u8ZZ*)untag_ptr(val));
39277         AcceptChannelV2_set_shutdown_scriptpubkey(&this_ptr_conv, val_conv);
39278 }
39279
39280 uint64_t  __attribute__((export_name("TS_AcceptChannelV2_get_channel_type"))) TS_AcceptChannelV2_get_channel_type(uint64_t this_ptr) {
39281         LDKAcceptChannelV2 this_ptr_conv;
39282         this_ptr_conv.inner = untag_ptr(this_ptr);
39283         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
39284         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
39285         this_ptr_conv.is_owned = false;
39286         LDKChannelTypeFeatures ret_var = AcceptChannelV2_get_channel_type(&this_ptr_conv);
39287         uint64_t ret_ref = 0;
39288         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
39289         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
39290         return ret_ref;
39291 }
39292
39293 void  __attribute__((export_name("TS_AcceptChannelV2_set_channel_type"))) TS_AcceptChannelV2_set_channel_type(uint64_t this_ptr, uint64_t val) {
39294         LDKAcceptChannelV2 this_ptr_conv;
39295         this_ptr_conv.inner = untag_ptr(this_ptr);
39296         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
39297         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
39298         this_ptr_conv.is_owned = false;
39299         LDKChannelTypeFeatures val_conv;
39300         val_conv.inner = untag_ptr(val);
39301         val_conv.is_owned = ptr_is_owned(val);
39302         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
39303         val_conv = ChannelTypeFeatures_clone(&val_conv);
39304         AcceptChannelV2_set_channel_type(&this_ptr_conv, val_conv);
39305 }
39306
39307 uint32_t  __attribute__((export_name("TS_AcceptChannelV2_get_require_confirmed_inputs"))) TS_AcceptChannelV2_get_require_confirmed_inputs(uint64_t this_ptr) {
39308         LDKAcceptChannelV2 this_ptr_conv;
39309         this_ptr_conv.inner = untag_ptr(this_ptr);
39310         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
39311         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
39312         this_ptr_conv.is_owned = false;
39313         uint32_t ret_conv = LDKCOption_NoneZ_to_js(AcceptChannelV2_get_require_confirmed_inputs(&this_ptr_conv));
39314         return ret_conv;
39315 }
39316
39317 void  __attribute__((export_name("TS_AcceptChannelV2_set_require_confirmed_inputs"))) TS_AcceptChannelV2_set_require_confirmed_inputs(uint64_t this_ptr, uint32_t val) {
39318         LDKAcceptChannelV2 this_ptr_conv;
39319         this_ptr_conv.inner = untag_ptr(this_ptr);
39320         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
39321         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
39322         this_ptr_conv.is_owned = false;
39323         LDKCOption_NoneZ val_conv = LDKCOption_NoneZ_from_js(val);
39324         AcceptChannelV2_set_require_confirmed_inputs(&this_ptr_conv, val_conv);
39325 }
39326
39327 uint64_t  __attribute__((export_name("TS_AcceptChannelV2_new"))) TS_AcceptChannelV2_new(int8_tArray temporary_channel_id_arg, int64_t funding_satoshis_arg, int64_t dust_limit_satoshis_arg, int64_t max_htlc_value_in_flight_msat_arg, int64_t htlc_minimum_msat_arg, int32_t minimum_depth_arg, int16_t to_self_delay_arg, int16_t max_accepted_htlcs_arg, int8_tArray funding_pubkey_arg, int8_tArray revocation_basepoint_arg, int8_tArray payment_basepoint_arg, int8_tArray delayed_payment_basepoint_arg, int8_tArray htlc_basepoint_arg, int8_tArray first_per_commitment_point_arg, int8_tArray second_per_commitment_point_arg, uint64_t shutdown_scriptpubkey_arg, uint64_t channel_type_arg, uint32_t require_confirmed_inputs_arg) {
39328         LDKThirtyTwoBytes temporary_channel_id_arg_ref;
39329         CHECK(temporary_channel_id_arg->arr_len == 32);
39330         memcpy(temporary_channel_id_arg_ref.data, temporary_channel_id_arg->elems, 32); FREE(temporary_channel_id_arg);
39331         LDKPublicKey funding_pubkey_arg_ref;
39332         CHECK(funding_pubkey_arg->arr_len == 33);
39333         memcpy(funding_pubkey_arg_ref.compressed_form, funding_pubkey_arg->elems, 33); FREE(funding_pubkey_arg);
39334         LDKPublicKey revocation_basepoint_arg_ref;
39335         CHECK(revocation_basepoint_arg->arr_len == 33);
39336         memcpy(revocation_basepoint_arg_ref.compressed_form, revocation_basepoint_arg->elems, 33); FREE(revocation_basepoint_arg);
39337         LDKPublicKey payment_basepoint_arg_ref;
39338         CHECK(payment_basepoint_arg->arr_len == 33);
39339         memcpy(payment_basepoint_arg_ref.compressed_form, payment_basepoint_arg->elems, 33); FREE(payment_basepoint_arg);
39340         LDKPublicKey delayed_payment_basepoint_arg_ref;
39341         CHECK(delayed_payment_basepoint_arg->arr_len == 33);
39342         memcpy(delayed_payment_basepoint_arg_ref.compressed_form, delayed_payment_basepoint_arg->elems, 33); FREE(delayed_payment_basepoint_arg);
39343         LDKPublicKey htlc_basepoint_arg_ref;
39344         CHECK(htlc_basepoint_arg->arr_len == 33);
39345         memcpy(htlc_basepoint_arg_ref.compressed_form, htlc_basepoint_arg->elems, 33); FREE(htlc_basepoint_arg);
39346         LDKPublicKey first_per_commitment_point_arg_ref;
39347         CHECK(first_per_commitment_point_arg->arr_len == 33);
39348         memcpy(first_per_commitment_point_arg_ref.compressed_form, first_per_commitment_point_arg->elems, 33); FREE(first_per_commitment_point_arg);
39349         LDKPublicKey second_per_commitment_point_arg_ref;
39350         CHECK(second_per_commitment_point_arg->arr_len == 33);
39351         memcpy(second_per_commitment_point_arg_ref.compressed_form, second_per_commitment_point_arg->elems, 33); FREE(second_per_commitment_point_arg);
39352         void* shutdown_scriptpubkey_arg_ptr = untag_ptr(shutdown_scriptpubkey_arg);
39353         CHECK_ACCESS(shutdown_scriptpubkey_arg_ptr);
39354         LDKCOption_CVec_u8ZZ shutdown_scriptpubkey_arg_conv = *(LDKCOption_CVec_u8ZZ*)(shutdown_scriptpubkey_arg_ptr);
39355         shutdown_scriptpubkey_arg_conv = COption_CVec_u8ZZ_clone((LDKCOption_CVec_u8ZZ*)untag_ptr(shutdown_scriptpubkey_arg));
39356         LDKChannelTypeFeatures channel_type_arg_conv;
39357         channel_type_arg_conv.inner = untag_ptr(channel_type_arg);
39358         channel_type_arg_conv.is_owned = ptr_is_owned(channel_type_arg);
39359         CHECK_INNER_FIELD_ACCESS_OR_NULL(channel_type_arg_conv);
39360         channel_type_arg_conv = ChannelTypeFeatures_clone(&channel_type_arg_conv);
39361         LDKCOption_NoneZ require_confirmed_inputs_arg_conv = LDKCOption_NoneZ_from_js(require_confirmed_inputs_arg);
39362         LDKAcceptChannelV2 ret_var = AcceptChannelV2_new(temporary_channel_id_arg_ref, funding_satoshis_arg, dust_limit_satoshis_arg, max_htlc_value_in_flight_msat_arg, htlc_minimum_msat_arg, minimum_depth_arg, to_self_delay_arg, max_accepted_htlcs_arg, funding_pubkey_arg_ref, revocation_basepoint_arg_ref, payment_basepoint_arg_ref, delayed_payment_basepoint_arg_ref, htlc_basepoint_arg_ref, first_per_commitment_point_arg_ref, second_per_commitment_point_arg_ref, shutdown_scriptpubkey_arg_conv, channel_type_arg_conv, require_confirmed_inputs_arg_conv);
39363         uint64_t ret_ref = 0;
39364         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
39365         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
39366         return ret_ref;
39367 }
39368
39369 static inline uint64_t AcceptChannelV2_clone_ptr(LDKAcceptChannelV2 *NONNULL_PTR arg) {
39370         LDKAcceptChannelV2 ret_var = AcceptChannelV2_clone(arg);
39371         uint64_t ret_ref = 0;
39372         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
39373         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
39374         return ret_ref;
39375 }
39376 int64_t  __attribute__((export_name("TS_AcceptChannelV2_clone_ptr"))) TS_AcceptChannelV2_clone_ptr(uint64_t arg) {
39377         LDKAcceptChannelV2 arg_conv;
39378         arg_conv.inner = untag_ptr(arg);
39379         arg_conv.is_owned = ptr_is_owned(arg);
39380         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
39381         arg_conv.is_owned = false;
39382         int64_t ret_conv = AcceptChannelV2_clone_ptr(&arg_conv);
39383         return ret_conv;
39384 }
39385
39386 uint64_t  __attribute__((export_name("TS_AcceptChannelV2_clone"))) TS_AcceptChannelV2_clone(uint64_t orig) {
39387         LDKAcceptChannelV2 orig_conv;
39388         orig_conv.inner = untag_ptr(orig);
39389         orig_conv.is_owned = ptr_is_owned(orig);
39390         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
39391         orig_conv.is_owned = false;
39392         LDKAcceptChannelV2 ret_var = AcceptChannelV2_clone(&orig_conv);
39393         uint64_t ret_ref = 0;
39394         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
39395         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
39396         return ret_ref;
39397 }
39398
39399 jboolean  __attribute__((export_name("TS_AcceptChannelV2_eq"))) TS_AcceptChannelV2_eq(uint64_t a, uint64_t b) {
39400         LDKAcceptChannelV2 a_conv;
39401         a_conv.inner = untag_ptr(a);
39402         a_conv.is_owned = ptr_is_owned(a);
39403         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
39404         a_conv.is_owned = false;
39405         LDKAcceptChannelV2 b_conv;
39406         b_conv.inner = untag_ptr(b);
39407         b_conv.is_owned = ptr_is_owned(b);
39408         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
39409         b_conv.is_owned = false;
39410         jboolean ret_conv = AcceptChannelV2_eq(&a_conv, &b_conv);
39411         return ret_conv;
39412 }
39413
39414 void  __attribute__((export_name("TS_FundingCreated_free"))) TS_FundingCreated_free(uint64_t this_obj) {
39415         LDKFundingCreated this_obj_conv;
39416         this_obj_conv.inner = untag_ptr(this_obj);
39417         this_obj_conv.is_owned = ptr_is_owned(this_obj);
39418         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
39419         FundingCreated_free(this_obj_conv);
39420 }
39421
39422 int8_tArray  __attribute__((export_name("TS_FundingCreated_get_temporary_channel_id"))) TS_FundingCreated_get_temporary_channel_id(uint64_t this_ptr) {
39423         LDKFundingCreated this_ptr_conv;
39424         this_ptr_conv.inner = untag_ptr(this_ptr);
39425         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
39426         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
39427         this_ptr_conv.is_owned = false;
39428         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
39429         memcpy(ret_arr->elems, *FundingCreated_get_temporary_channel_id(&this_ptr_conv), 32);
39430         return ret_arr;
39431 }
39432
39433 void  __attribute__((export_name("TS_FundingCreated_set_temporary_channel_id"))) TS_FundingCreated_set_temporary_channel_id(uint64_t this_ptr, int8_tArray val) {
39434         LDKFundingCreated this_ptr_conv;
39435         this_ptr_conv.inner = untag_ptr(this_ptr);
39436         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
39437         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
39438         this_ptr_conv.is_owned = false;
39439         LDKThirtyTwoBytes val_ref;
39440         CHECK(val->arr_len == 32);
39441         memcpy(val_ref.data, val->elems, 32); FREE(val);
39442         FundingCreated_set_temporary_channel_id(&this_ptr_conv, val_ref);
39443 }
39444
39445 int8_tArray  __attribute__((export_name("TS_FundingCreated_get_funding_txid"))) TS_FundingCreated_get_funding_txid(uint64_t this_ptr) {
39446         LDKFundingCreated this_ptr_conv;
39447         this_ptr_conv.inner = untag_ptr(this_ptr);
39448         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
39449         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
39450         this_ptr_conv.is_owned = false;
39451         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
39452         memcpy(ret_arr->elems, *FundingCreated_get_funding_txid(&this_ptr_conv), 32);
39453         return ret_arr;
39454 }
39455
39456 void  __attribute__((export_name("TS_FundingCreated_set_funding_txid"))) TS_FundingCreated_set_funding_txid(uint64_t this_ptr, int8_tArray val) {
39457         LDKFundingCreated this_ptr_conv;
39458         this_ptr_conv.inner = untag_ptr(this_ptr);
39459         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
39460         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
39461         this_ptr_conv.is_owned = false;
39462         LDKThirtyTwoBytes val_ref;
39463         CHECK(val->arr_len == 32);
39464         memcpy(val_ref.data, val->elems, 32); FREE(val);
39465         FundingCreated_set_funding_txid(&this_ptr_conv, val_ref);
39466 }
39467
39468 int16_t  __attribute__((export_name("TS_FundingCreated_get_funding_output_index"))) TS_FundingCreated_get_funding_output_index(uint64_t this_ptr) {
39469         LDKFundingCreated this_ptr_conv;
39470         this_ptr_conv.inner = untag_ptr(this_ptr);
39471         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
39472         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
39473         this_ptr_conv.is_owned = false;
39474         int16_t ret_conv = FundingCreated_get_funding_output_index(&this_ptr_conv);
39475         return ret_conv;
39476 }
39477
39478 void  __attribute__((export_name("TS_FundingCreated_set_funding_output_index"))) TS_FundingCreated_set_funding_output_index(uint64_t this_ptr, int16_t val) {
39479         LDKFundingCreated this_ptr_conv;
39480         this_ptr_conv.inner = untag_ptr(this_ptr);
39481         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
39482         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
39483         this_ptr_conv.is_owned = false;
39484         FundingCreated_set_funding_output_index(&this_ptr_conv, val);
39485 }
39486
39487 int8_tArray  __attribute__((export_name("TS_FundingCreated_get_signature"))) TS_FundingCreated_get_signature(uint64_t this_ptr) {
39488         LDKFundingCreated this_ptr_conv;
39489         this_ptr_conv.inner = untag_ptr(this_ptr);
39490         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
39491         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
39492         this_ptr_conv.is_owned = false;
39493         int8_tArray ret_arr = init_int8_tArray(64, __LINE__);
39494         memcpy(ret_arr->elems, FundingCreated_get_signature(&this_ptr_conv).compact_form, 64);
39495         return ret_arr;
39496 }
39497
39498 void  __attribute__((export_name("TS_FundingCreated_set_signature"))) TS_FundingCreated_set_signature(uint64_t this_ptr, int8_tArray val) {
39499         LDKFundingCreated this_ptr_conv;
39500         this_ptr_conv.inner = untag_ptr(this_ptr);
39501         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
39502         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
39503         this_ptr_conv.is_owned = false;
39504         LDKECDSASignature val_ref;
39505         CHECK(val->arr_len == 64);
39506         memcpy(val_ref.compact_form, val->elems, 64); FREE(val);
39507         FundingCreated_set_signature(&this_ptr_conv, val_ref);
39508 }
39509
39510 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) {
39511         LDKThirtyTwoBytes temporary_channel_id_arg_ref;
39512         CHECK(temporary_channel_id_arg->arr_len == 32);
39513         memcpy(temporary_channel_id_arg_ref.data, temporary_channel_id_arg->elems, 32); FREE(temporary_channel_id_arg);
39514         LDKThirtyTwoBytes funding_txid_arg_ref;
39515         CHECK(funding_txid_arg->arr_len == 32);
39516         memcpy(funding_txid_arg_ref.data, funding_txid_arg->elems, 32); FREE(funding_txid_arg);
39517         LDKECDSASignature signature_arg_ref;
39518         CHECK(signature_arg->arr_len == 64);
39519         memcpy(signature_arg_ref.compact_form, signature_arg->elems, 64); FREE(signature_arg);
39520         LDKFundingCreated ret_var = FundingCreated_new(temporary_channel_id_arg_ref, funding_txid_arg_ref, funding_output_index_arg, signature_arg_ref);
39521         uint64_t ret_ref = 0;
39522         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
39523         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
39524         return ret_ref;
39525 }
39526
39527 static inline uint64_t FundingCreated_clone_ptr(LDKFundingCreated *NONNULL_PTR arg) {
39528         LDKFundingCreated ret_var = FundingCreated_clone(arg);
39529         uint64_t ret_ref = 0;
39530         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
39531         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
39532         return ret_ref;
39533 }
39534 int64_t  __attribute__((export_name("TS_FundingCreated_clone_ptr"))) TS_FundingCreated_clone_ptr(uint64_t arg) {
39535         LDKFundingCreated arg_conv;
39536         arg_conv.inner = untag_ptr(arg);
39537         arg_conv.is_owned = ptr_is_owned(arg);
39538         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
39539         arg_conv.is_owned = false;
39540         int64_t ret_conv = FundingCreated_clone_ptr(&arg_conv);
39541         return ret_conv;
39542 }
39543
39544 uint64_t  __attribute__((export_name("TS_FundingCreated_clone"))) TS_FundingCreated_clone(uint64_t orig) {
39545         LDKFundingCreated orig_conv;
39546         orig_conv.inner = untag_ptr(orig);
39547         orig_conv.is_owned = ptr_is_owned(orig);
39548         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
39549         orig_conv.is_owned = false;
39550         LDKFundingCreated ret_var = FundingCreated_clone(&orig_conv);
39551         uint64_t ret_ref = 0;
39552         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
39553         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
39554         return ret_ref;
39555 }
39556
39557 jboolean  __attribute__((export_name("TS_FundingCreated_eq"))) TS_FundingCreated_eq(uint64_t a, uint64_t b) {
39558         LDKFundingCreated a_conv;
39559         a_conv.inner = untag_ptr(a);
39560         a_conv.is_owned = ptr_is_owned(a);
39561         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
39562         a_conv.is_owned = false;
39563         LDKFundingCreated b_conv;
39564         b_conv.inner = untag_ptr(b);
39565         b_conv.is_owned = ptr_is_owned(b);
39566         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
39567         b_conv.is_owned = false;
39568         jboolean ret_conv = FundingCreated_eq(&a_conv, &b_conv);
39569         return ret_conv;
39570 }
39571
39572 void  __attribute__((export_name("TS_FundingSigned_free"))) TS_FundingSigned_free(uint64_t this_obj) {
39573         LDKFundingSigned this_obj_conv;
39574         this_obj_conv.inner = untag_ptr(this_obj);
39575         this_obj_conv.is_owned = ptr_is_owned(this_obj);
39576         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
39577         FundingSigned_free(this_obj_conv);
39578 }
39579
39580 int8_tArray  __attribute__((export_name("TS_FundingSigned_get_channel_id"))) TS_FundingSigned_get_channel_id(uint64_t this_ptr) {
39581         LDKFundingSigned this_ptr_conv;
39582         this_ptr_conv.inner = untag_ptr(this_ptr);
39583         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
39584         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
39585         this_ptr_conv.is_owned = false;
39586         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
39587         memcpy(ret_arr->elems, *FundingSigned_get_channel_id(&this_ptr_conv), 32);
39588         return ret_arr;
39589 }
39590
39591 void  __attribute__((export_name("TS_FundingSigned_set_channel_id"))) TS_FundingSigned_set_channel_id(uint64_t this_ptr, int8_tArray val) {
39592         LDKFundingSigned this_ptr_conv;
39593         this_ptr_conv.inner = untag_ptr(this_ptr);
39594         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
39595         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
39596         this_ptr_conv.is_owned = false;
39597         LDKThirtyTwoBytes val_ref;
39598         CHECK(val->arr_len == 32);
39599         memcpy(val_ref.data, val->elems, 32); FREE(val);
39600         FundingSigned_set_channel_id(&this_ptr_conv, val_ref);
39601 }
39602
39603 int8_tArray  __attribute__((export_name("TS_FundingSigned_get_signature"))) TS_FundingSigned_get_signature(uint64_t this_ptr) {
39604         LDKFundingSigned this_ptr_conv;
39605         this_ptr_conv.inner = untag_ptr(this_ptr);
39606         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
39607         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
39608         this_ptr_conv.is_owned = false;
39609         int8_tArray ret_arr = init_int8_tArray(64, __LINE__);
39610         memcpy(ret_arr->elems, FundingSigned_get_signature(&this_ptr_conv).compact_form, 64);
39611         return ret_arr;
39612 }
39613
39614 void  __attribute__((export_name("TS_FundingSigned_set_signature"))) TS_FundingSigned_set_signature(uint64_t this_ptr, int8_tArray val) {
39615         LDKFundingSigned this_ptr_conv;
39616         this_ptr_conv.inner = untag_ptr(this_ptr);
39617         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
39618         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
39619         this_ptr_conv.is_owned = false;
39620         LDKECDSASignature val_ref;
39621         CHECK(val->arr_len == 64);
39622         memcpy(val_ref.compact_form, val->elems, 64); FREE(val);
39623         FundingSigned_set_signature(&this_ptr_conv, val_ref);
39624 }
39625
39626 uint64_t  __attribute__((export_name("TS_FundingSigned_new"))) TS_FundingSigned_new(int8_tArray channel_id_arg, int8_tArray signature_arg) {
39627         LDKThirtyTwoBytes channel_id_arg_ref;
39628         CHECK(channel_id_arg->arr_len == 32);
39629         memcpy(channel_id_arg_ref.data, channel_id_arg->elems, 32); FREE(channel_id_arg);
39630         LDKECDSASignature signature_arg_ref;
39631         CHECK(signature_arg->arr_len == 64);
39632         memcpy(signature_arg_ref.compact_form, signature_arg->elems, 64); FREE(signature_arg);
39633         LDKFundingSigned ret_var = FundingSigned_new(channel_id_arg_ref, signature_arg_ref);
39634         uint64_t ret_ref = 0;
39635         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
39636         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
39637         return ret_ref;
39638 }
39639
39640 static inline uint64_t FundingSigned_clone_ptr(LDKFundingSigned *NONNULL_PTR arg) {
39641         LDKFundingSigned ret_var = FundingSigned_clone(arg);
39642         uint64_t ret_ref = 0;
39643         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
39644         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
39645         return ret_ref;
39646 }
39647 int64_t  __attribute__((export_name("TS_FundingSigned_clone_ptr"))) TS_FundingSigned_clone_ptr(uint64_t arg) {
39648         LDKFundingSigned arg_conv;
39649         arg_conv.inner = untag_ptr(arg);
39650         arg_conv.is_owned = ptr_is_owned(arg);
39651         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
39652         arg_conv.is_owned = false;
39653         int64_t ret_conv = FundingSigned_clone_ptr(&arg_conv);
39654         return ret_conv;
39655 }
39656
39657 uint64_t  __attribute__((export_name("TS_FundingSigned_clone"))) TS_FundingSigned_clone(uint64_t orig) {
39658         LDKFundingSigned orig_conv;
39659         orig_conv.inner = untag_ptr(orig);
39660         orig_conv.is_owned = ptr_is_owned(orig);
39661         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
39662         orig_conv.is_owned = false;
39663         LDKFundingSigned ret_var = FundingSigned_clone(&orig_conv);
39664         uint64_t ret_ref = 0;
39665         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
39666         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
39667         return ret_ref;
39668 }
39669
39670 jboolean  __attribute__((export_name("TS_FundingSigned_eq"))) TS_FundingSigned_eq(uint64_t a, uint64_t b) {
39671         LDKFundingSigned a_conv;
39672         a_conv.inner = untag_ptr(a);
39673         a_conv.is_owned = ptr_is_owned(a);
39674         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
39675         a_conv.is_owned = false;
39676         LDKFundingSigned b_conv;
39677         b_conv.inner = untag_ptr(b);
39678         b_conv.is_owned = ptr_is_owned(b);
39679         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
39680         b_conv.is_owned = false;
39681         jboolean ret_conv = FundingSigned_eq(&a_conv, &b_conv);
39682         return ret_conv;
39683 }
39684
39685 void  __attribute__((export_name("TS_ChannelReady_free"))) TS_ChannelReady_free(uint64_t this_obj) {
39686         LDKChannelReady this_obj_conv;
39687         this_obj_conv.inner = untag_ptr(this_obj);
39688         this_obj_conv.is_owned = ptr_is_owned(this_obj);
39689         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
39690         ChannelReady_free(this_obj_conv);
39691 }
39692
39693 int8_tArray  __attribute__((export_name("TS_ChannelReady_get_channel_id"))) TS_ChannelReady_get_channel_id(uint64_t this_ptr) {
39694         LDKChannelReady this_ptr_conv;
39695         this_ptr_conv.inner = untag_ptr(this_ptr);
39696         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
39697         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
39698         this_ptr_conv.is_owned = false;
39699         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
39700         memcpy(ret_arr->elems, *ChannelReady_get_channel_id(&this_ptr_conv), 32);
39701         return ret_arr;
39702 }
39703
39704 void  __attribute__((export_name("TS_ChannelReady_set_channel_id"))) TS_ChannelReady_set_channel_id(uint64_t this_ptr, int8_tArray val) {
39705         LDKChannelReady this_ptr_conv;
39706         this_ptr_conv.inner = untag_ptr(this_ptr);
39707         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
39708         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
39709         this_ptr_conv.is_owned = false;
39710         LDKThirtyTwoBytes val_ref;
39711         CHECK(val->arr_len == 32);
39712         memcpy(val_ref.data, val->elems, 32); FREE(val);
39713         ChannelReady_set_channel_id(&this_ptr_conv, val_ref);
39714 }
39715
39716 int8_tArray  __attribute__((export_name("TS_ChannelReady_get_next_per_commitment_point"))) TS_ChannelReady_get_next_per_commitment_point(uint64_t this_ptr) {
39717         LDKChannelReady this_ptr_conv;
39718         this_ptr_conv.inner = untag_ptr(this_ptr);
39719         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
39720         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
39721         this_ptr_conv.is_owned = false;
39722         int8_tArray ret_arr = init_int8_tArray(33, __LINE__);
39723         memcpy(ret_arr->elems, ChannelReady_get_next_per_commitment_point(&this_ptr_conv).compressed_form, 33);
39724         return ret_arr;
39725 }
39726
39727 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) {
39728         LDKChannelReady this_ptr_conv;
39729         this_ptr_conv.inner = untag_ptr(this_ptr);
39730         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
39731         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
39732         this_ptr_conv.is_owned = false;
39733         LDKPublicKey val_ref;
39734         CHECK(val->arr_len == 33);
39735         memcpy(val_ref.compressed_form, val->elems, 33); FREE(val);
39736         ChannelReady_set_next_per_commitment_point(&this_ptr_conv, val_ref);
39737 }
39738
39739 uint64_t  __attribute__((export_name("TS_ChannelReady_get_short_channel_id_alias"))) TS_ChannelReady_get_short_channel_id_alias(uint64_t this_ptr) {
39740         LDKChannelReady this_ptr_conv;
39741         this_ptr_conv.inner = untag_ptr(this_ptr);
39742         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
39743         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
39744         this_ptr_conv.is_owned = false;
39745         LDKCOption_u64Z *ret_copy = MALLOC(sizeof(LDKCOption_u64Z), "LDKCOption_u64Z");
39746         *ret_copy = ChannelReady_get_short_channel_id_alias(&this_ptr_conv);
39747         uint64_t ret_ref = tag_ptr(ret_copy, true);
39748         return ret_ref;
39749 }
39750
39751 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) {
39752         LDKChannelReady this_ptr_conv;
39753         this_ptr_conv.inner = untag_ptr(this_ptr);
39754         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
39755         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
39756         this_ptr_conv.is_owned = false;
39757         void* val_ptr = untag_ptr(val);
39758         CHECK_ACCESS(val_ptr);
39759         LDKCOption_u64Z val_conv = *(LDKCOption_u64Z*)(val_ptr);
39760         val_conv = COption_u64Z_clone((LDKCOption_u64Z*)untag_ptr(val));
39761         ChannelReady_set_short_channel_id_alias(&this_ptr_conv, val_conv);
39762 }
39763
39764 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) {
39765         LDKThirtyTwoBytes channel_id_arg_ref;
39766         CHECK(channel_id_arg->arr_len == 32);
39767         memcpy(channel_id_arg_ref.data, channel_id_arg->elems, 32); FREE(channel_id_arg);
39768         LDKPublicKey next_per_commitment_point_arg_ref;
39769         CHECK(next_per_commitment_point_arg->arr_len == 33);
39770         memcpy(next_per_commitment_point_arg_ref.compressed_form, next_per_commitment_point_arg->elems, 33); FREE(next_per_commitment_point_arg);
39771         void* short_channel_id_alias_arg_ptr = untag_ptr(short_channel_id_alias_arg);
39772         CHECK_ACCESS(short_channel_id_alias_arg_ptr);
39773         LDKCOption_u64Z short_channel_id_alias_arg_conv = *(LDKCOption_u64Z*)(short_channel_id_alias_arg_ptr);
39774         short_channel_id_alias_arg_conv = COption_u64Z_clone((LDKCOption_u64Z*)untag_ptr(short_channel_id_alias_arg));
39775         LDKChannelReady ret_var = ChannelReady_new(channel_id_arg_ref, next_per_commitment_point_arg_ref, short_channel_id_alias_arg_conv);
39776         uint64_t ret_ref = 0;
39777         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
39778         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
39779         return ret_ref;
39780 }
39781
39782 static inline uint64_t ChannelReady_clone_ptr(LDKChannelReady *NONNULL_PTR arg) {
39783         LDKChannelReady ret_var = ChannelReady_clone(arg);
39784         uint64_t ret_ref = 0;
39785         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
39786         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
39787         return ret_ref;
39788 }
39789 int64_t  __attribute__((export_name("TS_ChannelReady_clone_ptr"))) TS_ChannelReady_clone_ptr(uint64_t arg) {
39790         LDKChannelReady arg_conv;
39791         arg_conv.inner = untag_ptr(arg);
39792         arg_conv.is_owned = ptr_is_owned(arg);
39793         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
39794         arg_conv.is_owned = false;
39795         int64_t ret_conv = ChannelReady_clone_ptr(&arg_conv);
39796         return ret_conv;
39797 }
39798
39799 uint64_t  __attribute__((export_name("TS_ChannelReady_clone"))) TS_ChannelReady_clone(uint64_t orig) {
39800         LDKChannelReady orig_conv;
39801         orig_conv.inner = untag_ptr(orig);
39802         orig_conv.is_owned = ptr_is_owned(orig);
39803         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
39804         orig_conv.is_owned = false;
39805         LDKChannelReady ret_var = ChannelReady_clone(&orig_conv);
39806         uint64_t ret_ref = 0;
39807         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
39808         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
39809         return ret_ref;
39810 }
39811
39812 jboolean  __attribute__((export_name("TS_ChannelReady_eq"))) TS_ChannelReady_eq(uint64_t a, uint64_t b) {
39813         LDKChannelReady a_conv;
39814         a_conv.inner = untag_ptr(a);
39815         a_conv.is_owned = ptr_is_owned(a);
39816         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
39817         a_conv.is_owned = false;
39818         LDKChannelReady b_conv;
39819         b_conv.inner = untag_ptr(b);
39820         b_conv.is_owned = ptr_is_owned(b);
39821         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
39822         b_conv.is_owned = false;
39823         jboolean ret_conv = ChannelReady_eq(&a_conv, &b_conv);
39824         return ret_conv;
39825 }
39826
39827 void  __attribute__((export_name("TS_TxAddInput_free"))) TS_TxAddInput_free(uint64_t this_obj) {
39828         LDKTxAddInput this_obj_conv;
39829         this_obj_conv.inner = untag_ptr(this_obj);
39830         this_obj_conv.is_owned = ptr_is_owned(this_obj);
39831         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
39832         TxAddInput_free(this_obj_conv);
39833 }
39834
39835 int8_tArray  __attribute__((export_name("TS_TxAddInput_get_channel_id"))) TS_TxAddInput_get_channel_id(uint64_t this_ptr) {
39836         LDKTxAddInput this_ptr_conv;
39837         this_ptr_conv.inner = untag_ptr(this_ptr);
39838         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
39839         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
39840         this_ptr_conv.is_owned = false;
39841         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
39842         memcpy(ret_arr->elems, *TxAddInput_get_channel_id(&this_ptr_conv), 32);
39843         return ret_arr;
39844 }
39845
39846 void  __attribute__((export_name("TS_TxAddInput_set_channel_id"))) TS_TxAddInput_set_channel_id(uint64_t this_ptr, int8_tArray val) {
39847         LDKTxAddInput this_ptr_conv;
39848         this_ptr_conv.inner = untag_ptr(this_ptr);
39849         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
39850         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
39851         this_ptr_conv.is_owned = false;
39852         LDKThirtyTwoBytes val_ref;
39853         CHECK(val->arr_len == 32);
39854         memcpy(val_ref.data, val->elems, 32); FREE(val);
39855         TxAddInput_set_channel_id(&this_ptr_conv, val_ref);
39856 }
39857
39858 int64_t  __attribute__((export_name("TS_TxAddInput_get_serial_id"))) TS_TxAddInput_get_serial_id(uint64_t this_ptr) {
39859         LDKTxAddInput this_ptr_conv;
39860         this_ptr_conv.inner = untag_ptr(this_ptr);
39861         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
39862         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
39863         this_ptr_conv.is_owned = false;
39864         int64_t ret_conv = TxAddInput_get_serial_id(&this_ptr_conv);
39865         return ret_conv;
39866 }
39867
39868 void  __attribute__((export_name("TS_TxAddInput_set_serial_id"))) TS_TxAddInput_set_serial_id(uint64_t this_ptr, int64_t val) {
39869         LDKTxAddInput this_ptr_conv;
39870         this_ptr_conv.inner = untag_ptr(this_ptr);
39871         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
39872         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
39873         this_ptr_conv.is_owned = false;
39874         TxAddInput_set_serial_id(&this_ptr_conv, val);
39875 }
39876
39877 uint64_t  __attribute__((export_name("TS_TxAddInput_get_prevtx"))) TS_TxAddInput_get_prevtx(uint64_t this_ptr) {
39878         LDKTxAddInput this_ptr_conv;
39879         this_ptr_conv.inner = untag_ptr(this_ptr);
39880         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
39881         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
39882         this_ptr_conv.is_owned = false;
39883         LDKTransactionU16LenLimited ret_var = TxAddInput_get_prevtx(&this_ptr_conv);
39884         uint64_t ret_ref = 0;
39885         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
39886         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
39887         return ret_ref;
39888 }
39889
39890 void  __attribute__((export_name("TS_TxAddInput_set_prevtx"))) TS_TxAddInput_set_prevtx(uint64_t this_ptr, uint64_t val) {
39891         LDKTxAddInput this_ptr_conv;
39892         this_ptr_conv.inner = untag_ptr(this_ptr);
39893         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
39894         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
39895         this_ptr_conv.is_owned = false;
39896         LDKTransactionU16LenLimited val_conv;
39897         val_conv.inner = untag_ptr(val);
39898         val_conv.is_owned = ptr_is_owned(val);
39899         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
39900         val_conv = TransactionU16LenLimited_clone(&val_conv);
39901         TxAddInput_set_prevtx(&this_ptr_conv, val_conv);
39902 }
39903
39904 int32_t  __attribute__((export_name("TS_TxAddInput_get_prevtx_out"))) TS_TxAddInput_get_prevtx_out(uint64_t this_ptr) {
39905         LDKTxAddInput this_ptr_conv;
39906         this_ptr_conv.inner = untag_ptr(this_ptr);
39907         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
39908         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
39909         this_ptr_conv.is_owned = false;
39910         int32_t ret_conv = TxAddInput_get_prevtx_out(&this_ptr_conv);
39911         return ret_conv;
39912 }
39913
39914 void  __attribute__((export_name("TS_TxAddInput_set_prevtx_out"))) TS_TxAddInput_set_prevtx_out(uint64_t this_ptr, int32_t val) {
39915         LDKTxAddInput this_ptr_conv;
39916         this_ptr_conv.inner = untag_ptr(this_ptr);
39917         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
39918         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
39919         this_ptr_conv.is_owned = false;
39920         TxAddInput_set_prevtx_out(&this_ptr_conv, val);
39921 }
39922
39923 int32_t  __attribute__((export_name("TS_TxAddInput_get_sequence"))) TS_TxAddInput_get_sequence(uint64_t this_ptr) {
39924         LDKTxAddInput this_ptr_conv;
39925         this_ptr_conv.inner = untag_ptr(this_ptr);
39926         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
39927         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
39928         this_ptr_conv.is_owned = false;
39929         int32_t ret_conv = TxAddInput_get_sequence(&this_ptr_conv);
39930         return ret_conv;
39931 }
39932
39933 void  __attribute__((export_name("TS_TxAddInput_set_sequence"))) TS_TxAddInput_set_sequence(uint64_t this_ptr, int32_t val) {
39934         LDKTxAddInput this_ptr_conv;
39935         this_ptr_conv.inner = untag_ptr(this_ptr);
39936         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
39937         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
39938         this_ptr_conv.is_owned = false;
39939         TxAddInput_set_sequence(&this_ptr_conv, val);
39940 }
39941
39942 uint64_t  __attribute__((export_name("TS_TxAddInput_new"))) TS_TxAddInput_new(int8_tArray channel_id_arg, int64_t serial_id_arg, uint64_t prevtx_arg, int32_t prevtx_out_arg, int32_t sequence_arg) {
39943         LDKThirtyTwoBytes channel_id_arg_ref;
39944         CHECK(channel_id_arg->arr_len == 32);
39945         memcpy(channel_id_arg_ref.data, channel_id_arg->elems, 32); FREE(channel_id_arg);
39946         LDKTransactionU16LenLimited prevtx_arg_conv;
39947         prevtx_arg_conv.inner = untag_ptr(prevtx_arg);
39948         prevtx_arg_conv.is_owned = ptr_is_owned(prevtx_arg);
39949         CHECK_INNER_FIELD_ACCESS_OR_NULL(prevtx_arg_conv);
39950         prevtx_arg_conv = TransactionU16LenLimited_clone(&prevtx_arg_conv);
39951         LDKTxAddInput ret_var = TxAddInput_new(channel_id_arg_ref, serial_id_arg, prevtx_arg_conv, prevtx_out_arg, sequence_arg);
39952         uint64_t ret_ref = 0;
39953         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
39954         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
39955         return ret_ref;
39956 }
39957
39958 static inline uint64_t TxAddInput_clone_ptr(LDKTxAddInput *NONNULL_PTR arg) {
39959         LDKTxAddInput ret_var = TxAddInput_clone(arg);
39960         uint64_t ret_ref = 0;
39961         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
39962         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
39963         return ret_ref;
39964 }
39965 int64_t  __attribute__((export_name("TS_TxAddInput_clone_ptr"))) TS_TxAddInput_clone_ptr(uint64_t arg) {
39966         LDKTxAddInput arg_conv;
39967         arg_conv.inner = untag_ptr(arg);
39968         arg_conv.is_owned = ptr_is_owned(arg);
39969         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
39970         arg_conv.is_owned = false;
39971         int64_t ret_conv = TxAddInput_clone_ptr(&arg_conv);
39972         return ret_conv;
39973 }
39974
39975 uint64_t  __attribute__((export_name("TS_TxAddInput_clone"))) TS_TxAddInput_clone(uint64_t orig) {
39976         LDKTxAddInput orig_conv;
39977         orig_conv.inner = untag_ptr(orig);
39978         orig_conv.is_owned = ptr_is_owned(orig);
39979         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
39980         orig_conv.is_owned = false;
39981         LDKTxAddInput ret_var = TxAddInput_clone(&orig_conv);
39982         uint64_t ret_ref = 0;
39983         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
39984         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
39985         return ret_ref;
39986 }
39987
39988 jboolean  __attribute__((export_name("TS_TxAddInput_eq"))) TS_TxAddInput_eq(uint64_t a, uint64_t b) {
39989         LDKTxAddInput a_conv;
39990         a_conv.inner = untag_ptr(a);
39991         a_conv.is_owned = ptr_is_owned(a);
39992         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
39993         a_conv.is_owned = false;
39994         LDKTxAddInput b_conv;
39995         b_conv.inner = untag_ptr(b);
39996         b_conv.is_owned = ptr_is_owned(b);
39997         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
39998         b_conv.is_owned = false;
39999         jboolean ret_conv = TxAddInput_eq(&a_conv, &b_conv);
40000         return ret_conv;
40001 }
40002
40003 void  __attribute__((export_name("TS_TxAddOutput_free"))) TS_TxAddOutput_free(uint64_t this_obj) {
40004         LDKTxAddOutput this_obj_conv;
40005         this_obj_conv.inner = untag_ptr(this_obj);
40006         this_obj_conv.is_owned = ptr_is_owned(this_obj);
40007         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
40008         TxAddOutput_free(this_obj_conv);
40009 }
40010
40011 int8_tArray  __attribute__((export_name("TS_TxAddOutput_get_channel_id"))) TS_TxAddOutput_get_channel_id(uint64_t this_ptr) {
40012         LDKTxAddOutput this_ptr_conv;
40013         this_ptr_conv.inner = untag_ptr(this_ptr);
40014         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
40015         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
40016         this_ptr_conv.is_owned = false;
40017         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
40018         memcpy(ret_arr->elems, *TxAddOutput_get_channel_id(&this_ptr_conv), 32);
40019         return ret_arr;
40020 }
40021
40022 void  __attribute__((export_name("TS_TxAddOutput_set_channel_id"))) TS_TxAddOutput_set_channel_id(uint64_t this_ptr, int8_tArray val) {
40023         LDKTxAddOutput this_ptr_conv;
40024         this_ptr_conv.inner = untag_ptr(this_ptr);
40025         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
40026         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
40027         this_ptr_conv.is_owned = false;
40028         LDKThirtyTwoBytes val_ref;
40029         CHECK(val->arr_len == 32);
40030         memcpy(val_ref.data, val->elems, 32); FREE(val);
40031         TxAddOutput_set_channel_id(&this_ptr_conv, val_ref);
40032 }
40033
40034 int64_t  __attribute__((export_name("TS_TxAddOutput_get_serial_id"))) TS_TxAddOutput_get_serial_id(uint64_t this_ptr) {
40035         LDKTxAddOutput this_ptr_conv;
40036         this_ptr_conv.inner = untag_ptr(this_ptr);
40037         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
40038         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
40039         this_ptr_conv.is_owned = false;
40040         int64_t ret_conv = TxAddOutput_get_serial_id(&this_ptr_conv);
40041         return ret_conv;
40042 }
40043
40044 void  __attribute__((export_name("TS_TxAddOutput_set_serial_id"))) TS_TxAddOutput_set_serial_id(uint64_t this_ptr, int64_t val) {
40045         LDKTxAddOutput this_ptr_conv;
40046         this_ptr_conv.inner = untag_ptr(this_ptr);
40047         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
40048         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
40049         this_ptr_conv.is_owned = false;
40050         TxAddOutput_set_serial_id(&this_ptr_conv, val);
40051 }
40052
40053 int64_t  __attribute__((export_name("TS_TxAddOutput_get_sats"))) TS_TxAddOutput_get_sats(uint64_t this_ptr) {
40054         LDKTxAddOutput this_ptr_conv;
40055         this_ptr_conv.inner = untag_ptr(this_ptr);
40056         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
40057         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
40058         this_ptr_conv.is_owned = false;
40059         int64_t ret_conv = TxAddOutput_get_sats(&this_ptr_conv);
40060         return ret_conv;
40061 }
40062
40063 void  __attribute__((export_name("TS_TxAddOutput_set_sats"))) TS_TxAddOutput_set_sats(uint64_t this_ptr, int64_t val) {
40064         LDKTxAddOutput this_ptr_conv;
40065         this_ptr_conv.inner = untag_ptr(this_ptr);
40066         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
40067         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
40068         this_ptr_conv.is_owned = false;
40069         TxAddOutput_set_sats(&this_ptr_conv, val);
40070 }
40071
40072 int8_tArray  __attribute__((export_name("TS_TxAddOutput_get_script"))) TS_TxAddOutput_get_script(uint64_t this_ptr) {
40073         LDKTxAddOutput this_ptr_conv;
40074         this_ptr_conv.inner = untag_ptr(this_ptr);
40075         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
40076         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
40077         this_ptr_conv.is_owned = false;
40078         LDKu8slice ret_var = TxAddOutput_get_script(&this_ptr_conv);
40079         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
40080         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
40081         return ret_arr;
40082 }
40083
40084 void  __attribute__((export_name("TS_TxAddOutput_set_script"))) TS_TxAddOutput_set_script(uint64_t this_ptr, int8_tArray val) {
40085         LDKTxAddOutput this_ptr_conv;
40086         this_ptr_conv.inner = untag_ptr(this_ptr);
40087         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
40088         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
40089         this_ptr_conv.is_owned = false;
40090         LDKCVec_u8Z val_ref;
40091         val_ref.datalen = val->arr_len;
40092         val_ref.data = MALLOC(val_ref.datalen, "LDKCVec_u8Z Bytes");
40093         memcpy(val_ref.data, val->elems, val_ref.datalen); FREE(val);
40094         TxAddOutput_set_script(&this_ptr_conv, val_ref);
40095 }
40096
40097 uint64_t  __attribute__((export_name("TS_TxAddOutput_new"))) TS_TxAddOutput_new(int8_tArray channel_id_arg, int64_t serial_id_arg, int64_t sats_arg, int8_tArray script_arg) {
40098         LDKThirtyTwoBytes channel_id_arg_ref;
40099         CHECK(channel_id_arg->arr_len == 32);
40100         memcpy(channel_id_arg_ref.data, channel_id_arg->elems, 32); FREE(channel_id_arg);
40101         LDKCVec_u8Z script_arg_ref;
40102         script_arg_ref.datalen = script_arg->arr_len;
40103         script_arg_ref.data = MALLOC(script_arg_ref.datalen, "LDKCVec_u8Z Bytes");
40104         memcpy(script_arg_ref.data, script_arg->elems, script_arg_ref.datalen); FREE(script_arg);
40105         LDKTxAddOutput ret_var = TxAddOutput_new(channel_id_arg_ref, serial_id_arg, sats_arg, script_arg_ref);
40106         uint64_t ret_ref = 0;
40107         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
40108         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
40109         return ret_ref;
40110 }
40111
40112 static inline uint64_t TxAddOutput_clone_ptr(LDKTxAddOutput *NONNULL_PTR arg) {
40113         LDKTxAddOutput ret_var = TxAddOutput_clone(arg);
40114         uint64_t ret_ref = 0;
40115         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
40116         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
40117         return ret_ref;
40118 }
40119 int64_t  __attribute__((export_name("TS_TxAddOutput_clone_ptr"))) TS_TxAddOutput_clone_ptr(uint64_t arg) {
40120         LDKTxAddOutput arg_conv;
40121         arg_conv.inner = untag_ptr(arg);
40122         arg_conv.is_owned = ptr_is_owned(arg);
40123         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
40124         arg_conv.is_owned = false;
40125         int64_t ret_conv = TxAddOutput_clone_ptr(&arg_conv);
40126         return ret_conv;
40127 }
40128
40129 uint64_t  __attribute__((export_name("TS_TxAddOutput_clone"))) TS_TxAddOutput_clone(uint64_t orig) {
40130         LDKTxAddOutput orig_conv;
40131         orig_conv.inner = untag_ptr(orig);
40132         orig_conv.is_owned = ptr_is_owned(orig);
40133         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
40134         orig_conv.is_owned = false;
40135         LDKTxAddOutput ret_var = TxAddOutput_clone(&orig_conv);
40136         uint64_t ret_ref = 0;
40137         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
40138         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
40139         return ret_ref;
40140 }
40141
40142 jboolean  __attribute__((export_name("TS_TxAddOutput_eq"))) TS_TxAddOutput_eq(uint64_t a, uint64_t b) {
40143         LDKTxAddOutput a_conv;
40144         a_conv.inner = untag_ptr(a);
40145         a_conv.is_owned = ptr_is_owned(a);
40146         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
40147         a_conv.is_owned = false;
40148         LDKTxAddOutput b_conv;
40149         b_conv.inner = untag_ptr(b);
40150         b_conv.is_owned = ptr_is_owned(b);
40151         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
40152         b_conv.is_owned = false;
40153         jboolean ret_conv = TxAddOutput_eq(&a_conv, &b_conv);
40154         return ret_conv;
40155 }
40156
40157 void  __attribute__((export_name("TS_TxRemoveInput_free"))) TS_TxRemoveInput_free(uint64_t this_obj) {
40158         LDKTxRemoveInput this_obj_conv;
40159         this_obj_conv.inner = untag_ptr(this_obj);
40160         this_obj_conv.is_owned = ptr_is_owned(this_obj);
40161         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
40162         TxRemoveInput_free(this_obj_conv);
40163 }
40164
40165 int8_tArray  __attribute__((export_name("TS_TxRemoveInput_get_channel_id"))) TS_TxRemoveInput_get_channel_id(uint64_t this_ptr) {
40166         LDKTxRemoveInput this_ptr_conv;
40167         this_ptr_conv.inner = untag_ptr(this_ptr);
40168         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
40169         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
40170         this_ptr_conv.is_owned = false;
40171         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
40172         memcpy(ret_arr->elems, *TxRemoveInput_get_channel_id(&this_ptr_conv), 32);
40173         return ret_arr;
40174 }
40175
40176 void  __attribute__((export_name("TS_TxRemoveInput_set_channel_id"))) TS_TxRemoveInput_set_channel_id(uint64_t this_ptr, int8_tArray val) {
40177         LDKTxRemoveInput this_ptr_conv;
40178         this_ptr_conv.inner = untag_ptr(this_ptr);
40179         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
40180         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
40181         this_ptr_conv.is_owned = false;
40182         LDKThirtyTwoBytes val_ref;
40183         CHECK(val->arr_len == 32);
40184         memcpy(val_ref.data, val->elems, 32); FREE(val);
40185         TxRemoveInput_set_channel_id(&this_ptr_conv, val_ref);
40186 }
40187
40188 int64_t  __attribute__((export_name("TS_TxRemoveInput_get_serial_id"))) TS_TxRemoveInput_get_serial_id(uint64_t this_ptr) {
40189         LDKTxRemoveInput this_ptr_conv;
40190         this_ptr_conv.inner = untag_ptr(this_ptr);
40191         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
40192         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
40193         this_ptr_conv.is_owned = false;
40194         int64_t ret_conv = TxRemoveInput_get_serial_id(&this_ptr_conv);
40195         return ret_conv;
40196 }
40197
40198 void  __attribute__((export_name("TS_TxRemoveInput_set_serial_id"))) TS_TxRemoveInput_set_serial_id(uint64_t this_ptr, int64_t val) {
40199         LDKTxRemoveInput this_ptr_conv;
40200         this_ptr_conv.inner = untag_ptr(this_ptr);
40201         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
40202         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
40203         this_ptr_conv.is_owned = false;
40204         TxRemoveInput_set_serial_id(&this_ptr_conv, val);
40205 }
40206
40207 uint64_t  __attribute__((export_name("TS_TxRemoveInput_new"))) TS_TxRemoveInput_new(int8_tArray channel_id_arg, int64_t serial_id_arg) {
40208         LDKThirtyTwoBytes channel_id_arg_ref;
40209         CHECK(channel_id_arg->arr_len == 32);
40210         memcpy(channel_id_arg_ref.data, channel_id_arg->elems, 32); FREE(channel_id_arg);
40211         LDKTxRemoveInput ret_var = TxRemoveInput_new(channel_id_arg_ref, serial_id_arg);
40212         uint64_t ret_ref = 0;
40213         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
40214         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
40215         return ret_ref;
40216 }
40217
40218 static inline uint64_t TxRemoveInput_clone_ptr(LDKTxRemoveInput *NONNULL_PTR arg) {
40219         LDKTxRemoveInput ret_var = TxRemoveInput_clone(arg);
40220         uint64_t ret_ref = 0;
40221         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
40222         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
40223         return ret_ref;
40224 }
40225 int64_t  __attribute__((export_name("TS_TxRemoveInput_clone_ptr"))) TS_TxRemoveInput_clone_ptr(uint64_t arg) {
40226         LDKTxRemoveInput arg_conv;
40227         arg_conv.inner = untag_ptr(arg);
40228         arg_conv.is_owned = ptr_is_owned(arg);
40229         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
40230         arg_conv.is_owned = false;
40231         int64_t ret_conv = TxRemoveInput_clone_ptr(&arg_conv);
40232         return ret_conv;
40233 }
40234
40235 uint64_t  __attribute__((export_name("TS_TxRemoveInput_clone"))) TS_TxRemoveInput_clone(uint64_t orig) {
40236         LDKTxRemoveInput orig_conv;
40237         orig_conv.inner = untag_ptr(orig);
40238         orig_conv.is_owned = ptr_is_owned(orig);
40239         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
40240         orig_conv.is_owned = false;
40241         LDKTxRemoveInput ret_var = TxRemoveInput_clone(&orig_conv);
40242         uint64_t ret_ref = 0;
40243         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
40244         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
40245         return ret_ref;
40246 }
40247
40248 jboolean  __attribute__((export_name("TS_TxRemoveInput_eq"))) TS_TxRemoveInput_eq(uint64_t a, uint64_t b) {
40249         LDKTxRemoveInput a_conv;
40250         a_conv.inner = untag_ptr(a);
40251         a_conv.is_owned = ptr_is_owned(a);
40252         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
40253         a_conv.is_owned = false;
40254         LDKTxRemoveInput b_conv;
40255         b_conv.inner = untag_ptr(b);
40256         b_conv.is_owned = ptr_is_owned(b);
40257         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
40258         b_conv.is_owned = false;
40259         jboolean ret_conv = TxRemoveInput_eq(&a_conv, &b_conv);
40260         return ret_conv;
40261 }
40262
40263 void  __attribute__((export_name("TS_TxRemoveOutput_free"))) TS_TxRemoveOutput_free(uint64_t this_obj) {
40264         LDKTxRemoveOutput this_obj_conv;
40265         this_obj_conv.inner = untag_ptr(this_obj);
40266         this_obj_conv.is_owned = ptr_is_owned(this_obj);
40267         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
40268         TxRemoveOutput_free(this_obj_conv);
40269 }
40270
40271 int8_tArray  __attribute__((export_name("TS_TxRemoveOutput_get_channel_id"))) TS_TxRemoveOutput_get_channel_id(uint64_t this_ptr) {
40272         LDKTxRemoveOutput this_ptr_conv;
40273         this_ptr_conv.inner = untag_ptr(this_ptr);
40274         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
40275         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
40276         this_ptr_conv.is_owned = false;
40277         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
40278         memcpy(ret_arr->elems, *TxRemoveOutput_get_channel_id(&this_ptr_conv), 32);
40279         return ret_arr;
40280 }
40281
40282 void  __attribute__((export_name("TS_TxRemoveOutput_set_channel_id"))) TS_TxRemoveOutput_set_channel_id(uint64_t this_ptr, int8_tArray val) {
40283         LDKTxRemoveOutput this_ptr_conv;
40284         this_ptr_conv.inner = untag_ptr(this_ptr);
40285         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
40286         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
40287         this_ptr_conv.is_owned = false;
40288         LDKThirtyTwoBytes val_ref;
40289         CHECK(val->arr_len == 32);
40290         memcpy(val_ref.data, val->elems, 32); FREE(val);
40291         TxRemoveOutput_set_channel_id(&this_ptr_conv, val_ref);
40292 }
40293
40294 int64_t  __attribute__((export_name("TS_TxRemoveOutput_get_serial_id"))) TS_TxRemoveOutput_get_serial_id(uint64_t this_ptr) {
40295         LDKTxRemoveOutput this_ptr_conv;
40296         this_ptr_conv.inner = untag_ptr(this_ptr);
40297         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
40298         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
40299         this_ptr_conv.is_owned = false;
40300         int64_t ret_conv = TxRemoveOutput_get_serial_id(&this_ptr_conv);
40301         return ret_conv;
40302 }
40303
40304 void  __attribute__((export_name("TS_TxRemoveOutput_set_serial_id"))) TS_TxRemoveOutput_set_serial_id(uint64_t this_ptr, int64_t val) {
40305         LDKTxRemoveOutput this_ptr_conv;
40306         this_ptr_conv.inner = untag_ptr(this_ptr);
40307         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
40308         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
40309         this_ptr_conv.is_owned = false;
40310         TxRemoveOutput_set_serial_id(&this_ptr_conv, val);
40311 }
40312
40313 uint64_t  __attribute__((export_name("TS_TxRemoveOutput_new"))) TS_TxRemoveOutput_new(int8_tArray channel_id_arg, int64_t serial_id_arg) {
40314         LDKThirtyTwoBytes channel_id_arg_ref;
40315         CHECK(channel_id_arg->arr_len == 32);
40316         memcpy(channel_id_arg_ref.data, channel_id_arg->elems, 32); FREE(channel_id_arg);
40317         LDKTxRemoveOutput ret_var = TxRemoveOutput_new(channel_id_arg_ref, serial_id_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
40324 static inline uint64_t TxRemoveOutput_clone_ptr(LDKTxRemoveOutput *NONNULL_PTR arg) {
40325         LDKTxRemoveOutput ret_var = TxRemoveOutput_clone(arg);
40326         uint64_t ret_ref = 0;
40327         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
40328         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
40329         return ret_ref;
40330 }
40331 int64_t  __attribute__((export_name("TS_TxRemoveOutput_clone_ptr"))) TS_TxRemoveOutput_clone_ptr(uint64_t arg) {
40332         LDKTxRemoveOutput arg_conv;
40333         arg_conv.inner = untag_ptr(arg);
40334         arg_conv.is_owned = ptr_is_owned(arg);
40335         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
40336         arg_conv.is_owned = false;
40337         int64_t ret_conv = TxRemoveOutput_clone_ptr(&arg_conv);
40338         return ret_conv;
40339 }
40340
40341 uint64_t  __attribute__((export_name("TS_TxRemoveOutput_clone"))) TS_TxRemoveOutput_clone(uint64_t orig) {
40342         LDKTxRemoveOutput orig_conv;
40343         orig_conv.inner = untag_ptr(orig);
40344         orig_conv.is_owned = ptr_is_owned(orig);
40345         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
40346         orig_conv.is_owned = false;
40347         LDKTxRemoveOutput ret_var = TxRemoveOutput_clone(&orig_conv);
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
40354 jboolean  __attribute__((export_name("TS_TxRemoveOutput_eq"))) TS_TxRemoveOutput_eq(uint64_t a, uint64_t b) {
40355         LDKTxRemoveOutput a_conv;
40356         a_conv.inner = untag_ptr(a);
40357         a_conv.is_owned = ptr_is_owned(a);
40358         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
40359         a_conv.is_owned = false;
40360         LDKTxRemoveOutput b_conv;
40361         b_conv.inner = untag_ptr(b);
40362         b_conv.is_owned = ptr_is_owned(b);
40363         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
40364         b_conv.is_owned = false;
40365         jboolean ret_conv = TxRemoveOutput_eq(&a_conv, &b_conv);
40366         return ret_conv;
40367 }
40368
40369 void  __attribute__((export_name("TS_TxComplete_free"))) TS_TxComplete_free(uint64_t this_obj) {
40370         LDKTxComplete this_obj_conv;
40371         this_obj_conv.inner = untag_ptr(this_obj);
40372         this_obj_conv.is_owned = ptr_is_owned(this_obj);
40373         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
40374         TxComplete_free(this_obj_conv);
40375 }
40376
40377 int8_tArray  __attribute__((export_name("TS_TxComplete_get_channel_id"))) TS_TxComplete_get_channel_id(uint64_t this_ptr) {
40378         LDKTxComplete this_ptr_conv;
40379         this_ptr_conv.inner = untag_ptr(this_ptr);
40380         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
40381         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
40382         this_ptr_conv.is_owned = false;
40383         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
40384         memcpy(ret_arr->elems, *TxComplete_get_channel_id(&this_ptr_conv), 32);
40385         return ret_arr;
40386 }
40387
40388 void  __attribute__((export_name("TS_TxComplete_set_channel_id"))) TS_TxComplete_set_channel_id(uint64_t this_ptr, int8_tArray val) {
40389         LDKTxComplete this_ptr_conv;
40390         this_ptr_conv.inner = untag_ptr(this_ptr);
40391         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
40392         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
40393         this_ptr_conv.is_owned = false;
40394         LDKThirtyTwoBytes val_ref;
40395         CHECK(val->arr_len == 32);
40396         memcpy(val_ref.data, val->elems, 32); FREE(val);
40397         TxComplete_set_channel_id(&this_ptr_conv, val_ref);
40398 }
40399
40400 uint64_t  __attribute__((export_name("TS_TxComplete_new"))) TS_TxComplete_new(int8_tArray channel_id_arg) {
40401         LDKThirtyTwoBytes channel_id_arg_ref;
40402         CHECK(channel_id_arg->arr_len == 32);
40403         memcpy(channel_id_arg_ref.data, channel_id_arg->elems, 32); FREE(channel_id_arg);
40404         LDKTxComplete ret_var = TxComplete_new(channel_id_arg_ref);
40405         uint64_t ret_ref = 0;
40406         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
40407         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
40408         return ret_ref;
40409 }
40410
40411 static inline uint64_t TxComplete_clone_ptr(LDKTxComplete *NONNULL_PTR arg) {
40412         LDKTxComplete ret_var = TxComplete_clone(arg);
40413         uint64_t ret_ref = 0;
40414         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
40415         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
40416         return ret_ref;
40417 }
40418 int64_t  __attribute__((export_name("TS_TxComplete_clone_ptr"))) TS_TxComplete_clone_ptr(uint64_t arg) {
40419         LDKTxComplete arg_conv;
40420         arg_conv.inner = untag_ptr(arg);
40421         arg_conv.is_owned = ptr_is_owned(arg);
40422         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
40423         arg_conv.is_owned = false;
40424         int64_t ret_conv = TxComplete_clone_ptr(&arg_conv);
40425         return ret_conv;
40426 }
40427
40428 uint64_t  __attribute__((export_name("TS_TxComplete_clone"))) TS_TxComplete_clone(uint64_t orig) {
40429         LDKTxComplete orig_conv;
40430         orig_conv.inner = untag_ptr(orig);
40431         orig_conv.is_owned = ptr_is_owned(orig);
40432         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
40433         orig_conv.is_owned = false;
40434         LDKTxComplete ret_var = TxComplete_clone(&orig_conv);
40435         uint64_t ret_ref = 0;
40436         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
40437         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
40438         return ret_ref;
40439 }
40440
40441 jboolean  __attribute__((export_name("TS_TxComplete_eq"))) TS_TxComplete_eq(uint64_t a, uint64_t b) {
40442         LDKTxComplete a_conv;
40443         a_conv.inner = untag_ptr(a);
40444         a_conv.is_owned = ptr_is_owned(a);
40445         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
40446         a_conv.is_owned = false;
40447         LDKTxComplete b_conv;
40448         b_conv.inner = untag_ptr(b);
40449         b_conv.is_owned = ptr_is_owned(b);
40450         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
40451         b_conv.is_owned = false;
40452         jboolean ret_conv = TxComplete_eq(&a_conv, &b_conv);
40453         return ret_conv;
40454 }
40455
40456 void  __attribute__((export_name("TS_TxSignatures_free"))) TS_TxSignatures_free(uint64_t this_obj) {
40457         LDKTxSignatures this_obj_conv;
40458         this_obj_conv.inner = untag_ptr(this_obj);
40459         this_obj_conv.is_owned = ptr_is_owned(this_obj);
40460         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
40461         TxSignatures_free(this_obj_conv);
40462 }
40463
40464 int8_tArray  __attribute__((export_name("TS_TxSignatures_get_channel_id"))) TS_TxSignatures_get_channel_id(uint64_t this_ptr) {
40465         LDKTxSignatures this_ptr_conv;
40466         this_ptr_conv.inner = untag_ptr(this_ptr);
40467         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
40468         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
40469         this_ptr_conv.is_owned = false;
40470         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
40471         memcpy(ret_arr->elems, *TxSignatures_get_channel_id(&this_ptr_conv), 32);
40472         return ret_arr;
40473 }
40474
40475 void  __attribute__((export_name("TS_TxSignatures_set_channel_id"))) TS_TxSignatures_set_channel_id(uint64_t this_ptr, int8_tArray val) {
40476         LDKTxSignatures this_ptr_conv;
40477         this_ptr_conv.inner = untag_ptr(this_ptr);
40478         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
40479         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
40480         this_ptr_conv.is_owned = false;
40481         LDKThirtyTwoBytes val_ref;
40482         CHECK(val->arr_len == 32);
40483         memcpy(val_ref.data, val->elems, 32); FREE(val);
40484         TxSignatures_set_channel_id(&this_ptr_conv, val_ref);
40485 }
40486
40487 int8_tArray  __attribute__((export_name("TS_TxSignatures_get_tx_hash"))) TS_TxSignatures_get_tx_hash(uint64_t this_ptr) {
40488         LDKTxSignatures this_ptr_conv;
40489         this_ptr_conv.inner = untag_ptr(this_ptr);
40490         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
40491         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
40492         this_ptr_conv.is_owned = false;
40493         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
40494         memcpy(ret_arr->elems, *TxSignatures_get_tx_hash(&this_ptr_conv), 32);
40495         return ret_arr;
40496 }
40497
40498 void  __attribute__((export_name("TS_TxSignatures_set_tx_hash"))) TS_TxSignatures_set_tx_hash(uint64_t this_ptr, int8_tArray val) {
40499         LDKTxSignatures this_ptr_conv;
40500         this_ptr_conv.inner = untag_ptr(this_ptr);
40501         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
40502         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
40503         this_ptr_conv.is_owned = false;
40504         LDKThirtyTwoBytes val_ref;
40505         CHECK(val->arr_len == 32);
40506         memcpy(val_ref.data, val->elems, 32); FREE(val);
40507         TxSignatures_set_tx_hash(&this_ptr_conv, val_ref);
40508 }
40509
40510 ptrArray  __attribute__((export_name("TS_TxSignatures_get_witnesses"))) TS_TxSignatures_get_witnesses(uint64_t this_ptr) {
40511         LDKTxSignatures this_ptr_conv;
40512         this_ptr_conv.inner = untag_ptr(this_ptr);
40513         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
40514         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
40515         this_ptr_conv.is_owned = false;
40516         LDKCVec_WitnessZ ret_var = TxSignatures_get_witnesses(&this_ptr_conv);
40517         ptrArray ret_arr = NULL;
40518         ret_arr = init_ptrArray(ret_var.datalen, __LINE__);
40519         int8_tArray *ret_arr_ptr = (int8_tArray*)(((uint8_t*)ret_arr) + 8);
40520         for (size_t m = 0; m < ret_var.datalen; m++) {
40521                 LDKWitness ret_conv_12_var = ret_var.data[m];
40522                 int8_tArray ret_conv_12_arr = init_int8_tArray(ret_conv_12_var.datalen, __LINE__);
40523                 memcpy(ret_conv_12_arr->elems, ret_conv_12_var.data, ret_conv_12_var.datalen);
40524                 Witness_free(ret_conv_12_var);
40525                 ret_arr_ptr[m] = ret_conv_12_arr;
40526         }
40527         
40528         FREE(ret_var.data);
40529         return ret_arr;
40530 }
40531
40532 void  __attribute__((export_name("TS_TxSignatures_set_witnesses"))) TS_TxSignatures_set_witnesses(uint64_t this_ptr, ptrArray val) {
40533         LDKTxSignatures this_ptr_conv;
40534         this_ptr_conv.inner = untag_ptr(this_ptr);
40535         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
40536         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
40537         this_ptr_conv.is_owned = false;
40538         LDKCVec_WitnessZ val_constr;
40539         val_constr.datalen = val->arr_len;
40540         if (val_constr.datalen > 0)
40541                 val_constr.data = MALLOC(val_constr.datalen * sizeof(LDKWitness), "LDKCVec_WitnessZ Elements");
40542         else
40543                 val_constr.data = NULL;
40544         int8_tArray* val_vals = (void*) val->elems;
40545         for (size_t m = 0; m < val_constr.datalen; m++) {
40546                 int8_tArray val_conv_12 = val_vals[m];
40547                 LDKWitness val_conv_12_ref;
40548                 val_conv_12_ref.datalen = val_conv_12->arr_len;
40549                 val_conv_12_ref.data = MALLOC(val_conv_12_ref.datalen, "LDKWitness Bytes");
40550                 memcpy(val_conv_12_ref.data, val_conv_12->elems, val_conv_12_ref.datalen); FREE(val_conv_12);
40551                 val_conv_12_ref.data_is_owned = true;
40552                 val_constr.data[m] = val_conv_12_ref;
40553         }
40554         FREE(val);
40555         TxSignatures_set_witnesses(&this_ptr_conv, val_constr);
40556 }
40557
40558 uint64_t  __attribute__((export_name("TS_TxSignatures_new"))) TS_TxSignatures_new(int8_tArray channel_id_arg, int8_tArray tx_hash_arg, ptrArray witnesses_arg) {
40559         LDKThirtyTwoBytes channel_id_arg_ref;
40560         CHECK(channel_id_arg->arr_len == 32);
40561         memcpy(channel_id_arg_ref.data, channel_id_arg->elems, 32); FREE(channel_id_arg);
40562         LDKThirtyTwoBytes tx_hash_arg_ref;
40563         CHECK(tx_hash_arg->arr_len == 32);
40564         memcpy(tx_hash_arg_ref.data, tx_hash_arg->elems, 32); FREE(tx_hash_arg);
40565         LDKCVec_WitnessZ witnesses_arg_constr;
40566         witnesses_arg_constr.datalen = witnesses_arg->arr_len;
40567         if (witnesses_arg_constr.datalen > 0)
40568                 witnesses_arg_constr.data = MALLOC(witnesses_arg_constr.datalen * sizeof(LDKWitness), "LDKCVec_WitnessZ Elements");
40569         else
40570                 witnesses_arg_constr.data = NULL;
40571         int8_tArray* witnesses_arg_vals = (void*) witnesses_arg->elems;
40572         for (size_t m = 0; m < witnesses_arg_constr.datalen; m++) {
40573                 int8_tArray witnesses_arg_conv_12 = witnesses_arg_vals[m];
40574                 LDKWitness witnesses_arg_conv_12_ref;
40575                 witnesses_arg_conv_12_ref.datalen = witnesses_arg_conv_12->arr_len;
40576                 witnesses_arg_conv_12_ref.data = MALLOC(witnesses_arg_conv_12_ref.datalen, "LDKWitness Bytes");
40577                 memcpy(witnesses_arg_conv_12_ref.data, witnesses_arg_conv_12->elems, witnesses_arg_conv_12_ref.datalen); FREE(witnesses_arg_conv_12);
40578                 witnesses_arg_conv_12_ref.data_is_owned = true;
40579                 witnesses_arg_constr.data[m] = witnesses_arg_conv_12_ref;
40580         }
40581         FREE(witnesses_arg);
40582         LDKTxSignatures ret_var = TxSignatures_new(channel_id_arg_ref, tx_hash_arg_ref, witnesses_arg_constr);
40583         uint64_t ret_ref = 0;
40584         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
40585         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
40586         return ret_ref;
40587 }
40588
40589 static inline uint64_t TxSignatures_clone_ptr(LDKTxSignatures *NONNULL_PTR arg) {
40590         LDKTxSignatures ret_var = TxSignatures_clone(arg);
40591         uint64_t ret_ref = 0;
40592         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
40593         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
40594         return ret_ref;
40595 }
40596 int64_t  __attribute__((export_name("TS_TxSignatures_clone_ptr"))) TS_TxSignatures_clone_ptr(uint64_t arg) {
40597         LDKTxSignatures arg_conv;
40598         arg_conv.inner = untag_ptr(arg);
40599         arg_conv.is_owned = ptr_is_owned(arg);
40600         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
40601         arg_conv.is_owned = false;
40602         int64_t ret_conv = TxSignatures_clone_ptr(&arg_conv);
40603         return ret_conv;
40604 }
40605
40606 uint64_t  __attribute__((export_name("TS_TxSignatures_clone"))) TS_TxSignatures_clone(uint64_t orig) {
40607         LDKTxSignatures orig_conv;
40608         orig_conv.inner = untag_ptr(orig);
40609         orig_conv.is_owned = ptr_is_owned(orig);
40610         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
40611         orig_conv.is_owned = false;
40612         LDKTxSignatures ret_var = TxSignatures_clone(&orig_conv);
40613         uint64_t ret_ref = 0;
40614         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
40615         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
40616         return ret_ref;
40617 }
40618
40619 jboolean  __attribute__((export_name("TS_TxSignatures_eq"))) TS_TxSignatures_eq(uint64_t a, uint64_t b) {
40620         LDKTxSignatures a_conv;
40621         a_conv.inner = untag_ptr(a);
40622         a_conv.is_owned = ptr_is_owned(a);
40623         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
40624         a_conv.is_owned = false;
40625         LDKTxSignatures b_conv;
40626         b_conv.inner = untag_ptr(b);
40627         b_conv.is_owned = ptr_is_owned(b);
40628         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
40629         b_conv.is_owned = false;
40630         jboolean ret_conv = TxSignatures_eq(&a_conv, &b_conv);
40631         return ret_conv;
40632 }
40633
40634 void  __attribute__((export_name("TS_TxInitRbf_free"))) TS_TxInitRbf_free(uint64_t this_obj) {
40635         LDKTxInitRbf this_obj_conv;
40636         this_obj_conv.inner = untag_ptr(this_obj);
40637         this_obj_conv.is_owned = ptr_is_owned(this_obj);
40638         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
40639         TxInitRbf_free(this_obj_conv);
40640 }
40641
40642 int8_tArray  __attribute__((export_name("TS_TxInitRbf_get_channel_id"))) TS_TxInitRbf_get_channel_id(uint64_t this_ptr) {
40643         LDKTxInitRbf this_ptr_conv;
40644         this_ptr_conv.inner = untag_ptr(this_ptr);
40645         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
40646         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
40647         this_ptr_conv.is_owned = false;
40648         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
40649         memcpy(ret_arr->elems, *TxInitRbf_get_channel_id(&this_ptr_conv), 32);
40650         return ret_arr;
40651 }
40652
40653 void  __attribute__((export_name("TS_TxInitRbf_set_channel_id"))) TS_TxInitRbf_set_channel_id(uint64_t this_ptr, int8_tArray val) {
40654         LDKTxInitRbf this_ptr_conv;
40655         this_ptr_conv.inner = untag_ptr(this_ptr);
40656         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
40657         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
40658         this_ptr_conv.is_owned = false;
40659         LDKThirtyTwoBytes val_ref;
40660         CHECK(val->arr_len == 32);
40661         memcpy(val_ref.data, val->elems, 32); FREE(val);
40662         TxInitRbf_set_channel_id(&this_ptr_conv, val_ref);
40663 }
40664
40665 int32_t  __attribute__((export_name("TS_TxInitRbf_get_locktime"))) TS_TxInitRbf_get_locktime(uint64_t this_ptr) {
40666         LDKTxInitRbf this_ptr_conv;
40667         this_ptr_conv.inner = untag_ptr(this_ptr);
40668         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
40669         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
40670         this_ptr_conv.is_owned = false;
40671         int32_t ret_conv = TxInitRbf_get_locktime(&this_ptr_conv);
40672         return ret_conv;
40673 }
40674
40675 void  __attribute__((export_name("TS_TxInitRbf_set_locktime"))) TS_TxInitRbf_set_locktime(uint64_t this_ptr, int32_t val) {
40676         LDKTxInitRbf this_ptr_conv;
40677         this_ptr_conv.inner = untag_ptr(this_ptr);
40678         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
40679         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
40680         this_ptr_conv.is_owned = false;
40681         TxInitRbf_set_locktime(&this_ptr_conv, val);
40682 }
40683
40684 int32_t  __attribute__((export_name("TS_TxInitRbf_get_feerate_sat_per_1000_weight"))) TS_TxInitRbf_get_feerate_sat_per_1000_weight(uint64_t this_ptr) {
40685         LDKTxInitRbf this_ptr_conv;
40686         this_ptr_conv.inner = untag_ptr(this_ptr);
40687         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
40688         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
40689         this_ptr_conv.is_owned = false;
40690         int32_t ret_conv = TxInitRbf_get_feerate_sat_per_1000_weight(&this_ptr_conv);
40691         return ret_conv;
40692 }
40693
40694 void  __attribute__((export_name("TS_TxInitRbf_set_feerate_sat_per_1000_weight"))) TS_TxInitRbf_set_feerate_sat_per_1000_weight(uint64_t this_ptr, int32_t val) {
40695         LDKTxInitRbf this_ptr_conv;
40696         this_ptr_conv.inner = untag_ptr(this_ptr);
40697         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
40698         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
40699         this_ptr_conv.is_owned = false;
40700         TxInitRbf_set_feerate_sat_per_1000_weight(&this_ptr_conv, val);
40701 }
40702
40703 uint64_t  __attribute__((export_name("TS_TxInitRbf_get_funding_output_contribution"))) TS_TxInitRbf_get_funding_output_contribution(uint64_t this_ptr) {
40704         LDKTxInitRbf this_ptr_conv;
40705         this_ptr_conv.inner = untag_ptr(this_ptr);
40706         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
40707         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
40708         this_ptr_conv.is_owned = false;
40709         LDKCOption_i64Z *ret_copy = MALLOC(sizeof(LDKCOption_i64Z), "LDKCOption_i64Z");
40710         *ret_copy = TxInitRbf_get_funding_output_contribution(&this_ptr_conv);
40711         uint64_t ret_ref = tag_ptr(ret_copy, true);
40712         return ret_ref;
40713 }
40714
40715 void  __attribute__((export_name("TS_TxInitRbf_set_funding_output_contribution"))) TS_TxInitRbf_set_funding_output_contribution(uint64_t this_ptr, uint64_t val) {
40716         LDKTxInitRbf this_ptr_conv;
40717         this_ptr_conv.inner = untag_ptr(this_ptr);
40718         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
40719         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
40720         this_ptr_conv.is_owned = false;
40721         void* val_ptr = untag_ptr(val);
40722         CHECK_ACCESS(val_ptr);
40723         LDKCOption_i64Z val_conv = *(LDKCOption_i64Z*)(val_ptr);
40724         val_conv = COption_i64Z_clone((LDKCOption_i64Z*)untag_ptr(val));
40725         TxInitRbf_set_funding_output_contribution(&this_ptr_conv, val_conv);
40726 }
40727
40728 uint64_t  __attribute__((export_name("TS_TxInitRbf_new"))) TS_TxInitRbf_new(int8_tArray channel_id_arg, int32_t locktime_arg, int32_t feerate_sat_per_1000_weight_arg, uint64_t funding_output_contribution_arg) {
40729         LDKThirtyTwoBytes channel_id_arg_ref;
40730         CHECK(channel_id_arg->arr_len == 32);
40731         memcpy(channel_id_arg_ref.data, channel_id_arg->elems, 32); FREE(channel_id_arg);
40732         void* funding_output_contribution_arg_ptr = untag_ptr(funding_output_contribution_arg);
40733         CHECK_ACCESS(funding_output_contribution_arg_ptr);
40734         LDKCOption_i64Z funding_output_contribution_arg_conv = *(LDKCOption_i64Z*)(funding_output_contribution_arg_ptr);
40735         funding_output_contribution_arg_conv = COption_i64Z_clone((LDKCOption_i64Z*)untag_ptr(funding_output_contribution_arg));
40736         LDKTxInitRbf ret_var = TxInitRbf_new(channel_id_arg_ref, locktime_arg, feerate_sat_per_1000_weight_arg, funding_output_contribution_arg_conv);
40737         uint64_t ret_ref = 0;
40738         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
40739         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
40740         return ret_ref;
40741 }
40742
40743 static inline uint64_t TxInitRbf_clone_ptr(LDKTxInitRbf *NONNULL_PTR arg) {
40744         LDKTxInitRbf ret_var = TxInitRbf_clone(arg);
40745         uint64_t ret_ref = 0;
40746         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
40747         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
40748         return ret_ref;
40749 }
40750 int64_t  __attribute__((export_name("TS_TxInitRbf_clone_ptr"))) TS_TxInitRbf_clone_ptr(uint64_t arg) {
40751         LDKTxInitRbf arg_conv;
40752         arg_conv.inner = untag_ptr(arg);
40753         arg_conv.is_owned = ptr_is_owned(arg);
40754         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
40755         arg_conv.is_owned = false;
40756         int64_t ret_conv = TxInitRbf_clone_ptr(&arg_conv);
40757         return ret_conv;
40758 }
40759
40760 uint64_t  __attribute__((export_name("TS_TxInitRbf_clone"))) TS_TxInitRbf_clone(uint64_t orig) {
40761         LDKTxInitRbf orig_conv;
40762         orig_conv.inner = untag_ptr(orig);
40763         orig_conv.is_owned = ptr_is_owned(orig);
40764         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
40765         orig_conv.is_owned = false;
40766         LDKTxInitRbf ret_var = TxInitRbf_clone(&orig_conv);
40767         uint64_t ret_ref = 0;
40768         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
40769         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
40770         return ret_ref;
40771 }
40772
40773 jboolean  __attribute__((export_name("TS_TxInitRbf_eq"))) TS_TxInitRbf_eq(uint64_t a, uint64_t b) {
40774         LDKTxInitRbf a_conv;
40775         a_conv.inner = untag_ptr(a);
40776         a_conv.is_owned = ptr_is_owned(a);
40777         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
40778         a_conv.is_owned = false;
40779         LDKTxInitRbf b_conv;
40780         b_conv.inner = untag_ptr(b);
40781         b_conv.is_owned = ptr_is_owned(b);
40782         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
40783         b_conv.is_owned = false;
40784         jboolean ret_conv = TxInitRbf_eq(&a_conv, &b_conv);
40785         return ret_conv;
40786 }
40787
40788 void  __attribute__((export_name("TS_TxAckRbf_free"))) TS_TxAckRbf_free(uint64_t this_obj) {
40789         LDKTxAckRbf this_obj_conv;
40790         this_obj_conv.inner = untag_ptr(this_obj);
40791         this_obj_conv.is_owned = ptr_is_owned(this_obj);
40792         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
40793         TxAckRbf_free(this_obj_conv);
40794 }
40795
40796 int8_tArray  __attribute__((export_name("TS_TxAckRbf_get_channel_id"))) TS_TxAckRbf_get_channel_id(uint64_t this_ptr) {
40797         LDKTxAckRbf this_ptr_conv;
40798         this_ptr_conv.inner = untag_ptr(this_ptr);
40799         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
40800         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
40801         this_ptr_conv.is_owned = false;
40802         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
40803         memcpy(ret_arr->elems, *TxAckRbf_get_channel_id(&this_ptr_conv), 32);
40804         return ret_arr;
40805 }
40806
40807 void  __attribute__((export_name("TS_TxAckRbf_set_channel_id"))) TS_TxAckRbf_set_channel_id(uint64_t this_ptr, int8_tArray val) {
40808         LDKTxAckRbf this_ptr_conv;
40809         this_ptr_conv.inner = untag_ptr(this_ptr);
40810         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
40811         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
40812         this_ptr_conv.is_owned = false;
40813         LDKThirtyTwoBytes val_ref;
40814         CHECK(val->arr_len == 32);
40815         memcpy(val_ref.data, val->elems, 32); FREE(val);
40816         TxAckRbf_set_channel_id(&this_ptr_conv, val_ref);
40817 }
40818
40819 uint64_t  __attribute__((export_name("TS_TxAckRbf_get_funding_output_contribution"))) TS_TxAckRbf_get_funding_output_contribution(uint64_t this_ptr) {
40820         LDKTxAckRbf this_ptr_conv;
40821         this_ptr_conv.inner = untag_ptr(this_ptr);
40822         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
40823         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
40824         this_ptr_conv.is_owned = false;
40825         LDKCOption_i64Z *ret_copy = MALLOC(sizeof(LDKCOption_i64Z), "LDKCOption_i64Z");
40826         *ret_copy = TxAckRbf_get_funding_output_contribution(&this_ptr_conv);
40827         uint64_t ret_ref = tag_ptr(ret_copy, true);
40828         return ret_ref;
40829 }
40830
40831 void  __attribute__((export_name("TS_TxAckRbf_set_funding_output_contribution"))) TS_TxAckRbf_set_funding_output_contribution(uint64_t this_ptr, uint64_t val) {
40832         LDKTxAckRbf this_ptr_conv;
40833         this_ptr_conv.inner = untag_ptr(this_ptr);
40834         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
40835         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
40836         this_ptr_conv.is_owned = false;
40837         void* val_ptr = untag_ptr(val);
40838         CHECK_ACCESS(val_ptr);
40839         LDKCOption_i64Z val_conv = *(LDKCOption_i64Z*)(val_ptr);
40840         val_conv = COption_i64Z_clone((LDKCOption_i64Z*)untag_ptr(val));
40841         TxAckRbf_set_funding_output_contribution(&this_ptr_conv, val_conv);
40842 }
40843
40844 uint64_t  __attribute__((export_name("TS_TxAckRbf_new"))) TS_TxAckRbf_new(int8_tArray channel_id_arg, uint64_t funding_output_contribution_arg) {
40845         LDKThirtyTwoBytes channel_id_arg_ref;
40846         CHECK(channel_id_arg->arr_len == 32);
40847         memcpy(channel_id_arg_ref.data, channel_id_arg->elems, 32); FREE(channel_id_arg);
40848         void* funding_output_contribution_arg_ptr = untag_ptr(funding_output_contribution_arg);
40849         CHECK_ACCESS(funding_output_contribution_arg_ptr);
40850         LDKCOption_i64Z funding_output_contribution_arg_conv = *(LDKCOption_i64Z*)(funding_output_contribution_arg_ptr);
40851         funding_output_contribution_arg_conv = COption_i64Z_clone((LDKCOption_i64Z*)untag_ptr(funding_output_contribution_arg));
40852         LDKTxAckRbf ret_var = TxAckRbf_new(channel_id_arg_ref, funding_output_contribution_arg_conv);
40853         uint64_t ret_ref = 0;
40854         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
40855         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
40856         return ret_ref;
40857 }
40858
40859 static inline uint64_t TxAckRbf_clone_ptr(LDKTxAckRbf *NONNULL_PTR arg) {
40860         LDKTxAckRbf ret_var = TxAckRbf_clone(arg);
40861         uint64_t ret_ref = 0;
40862         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
40863         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
40864         return ret_ref;
40865 }
40866 int64_t  __attribute__((export_name("TS_TxAckRbf_clone_ptr"))) TS_TxAckRbf_clone_ptr(uint64_t arg) {
40867         LDKTxAckRbf arg_conv;
40868         arg_conv.inner = untag_ptr(arg);
40869         arg_conv.is_owned = ptr_is_owned(arg);
40870         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
40871         arg_conv.is_owned = false;
40872         int64_t ret_conv = TxAckRbf_clone_ptr(&arg_conv);
40873         return ret_conv;
40874 }
40875
40876 uint64_t  __attribute__((export_name("TS_TxAckRbf_clone"))) TS_TxAckRbf_clone(uint64_t orig) {
40877         LDKTxAckRbf orig_conv;
40878         orig_conv.inner = untag_ptr(orig);
40879         orig_conv.is_owned = ptr_is_owned(orig);
40880         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
40881         orig_conv.is_owned = false;
40882         LDKTxAckRbf ret_var = TxAckRbf_clone(&orig_conv);
40883         uint64_t ret_ref = 0;
40884         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
40885         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
40886         return ret_ref;
40887 }
40888
40889 jboolean  __attribute__((export_name("TS_TxAckRbf_eq"))) TS_TxAckRbf_eq(uint64_t a, uint64_t b) {
40890         LDKTxAckRbf a_conv;
40891         a_conv.inner = untag_ptr(a);
40892         a_conv.is_owned = ptr_is_owned(a);
40893         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
40894         a_conv.is_owned = false;
40895         LDKTxAckRbf b_conv;
40896         b_conv.inner = untag_ptr(b);
40897         b_conv.is_owned = ptr_is_owned(b);
40898         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
40899         b_conv.is_owned = false;
40900         jboolean ret_conv = TxAckRbf_eq(&a_conv, &b_conv);
40901         return ret_conv;
40902 }
40903
40904 void  __attribute__((export_name("TS_TxAbort_free"))) TS_TxAbort_free(uint64_t this_obj) {
40905         LDKTxAbort this_obj_conv;
40906         this_obj_conv.inner = untag_ptr(this_obj);
40907         this_obj_conv.is_owned = ptr_is_owned(this_obj);
40908         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
40909         TxAbort_free(this_obj_conv);
40910 }
40911
40912 int8_tArray  __attribute__((export_name("TS_TxAbort_get_channel_id"))) TS_TxAbort_get_channel_id(uint64_t this_ptr) {
40913         LDKTxAbort this_ptr_conv;
40914         this_ptr_conv.inner = untag_ptr(this_ptr);
40915         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
40916         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
40917         this_ptr_conv.is_owned = false;
40918         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
40919         memcpy(ret_arr->elems, *TxAbort_get_channel_id(&this_ptr_conv), 32);
40920         return ret_arr;
40921 }
40922
40923 void  __attribute__((export_name("TS_TxAbort_set_channel_id"))) TS_TxAbort_set_channel_id(uint64_t this_ptr, int8_tArray val) {
40924         LDKTxAbort this_ptr_conv;
40925         this_ptr_conv.inner = untag_ptr(this_ptr);
40926         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
40927         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
40928         this_ptr_conv.is_owned = false;
40929         LDKThirtyTwoBytes val_ref;
40930         CHECK(val->arr_len == 32);
40931         memcpy(val_ref.data, val->elems, 32); FREE(val);
40932         TxAbort_set_channel_id(&this_ptr_conv, val_ref);
40933 }
40934
40935 int8_tArray  __attribute__((export_name("TS_TxAbort_get_data"))) TS_TxAbort_get_data(uint64_t this_ptr) {
40936         LDKTxAbort this_ptr_conv;
40937         this_ptr_conv.inner = untag_ptr(this_ptr);
40938         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
40939         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
40940         this_ptr_conv.is_owned = false;
40941         LDKCVec_u8Z ret_var = TxAbort_get_data(&this_ptr_conv);
40942         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
40943         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
40944         CVec_u8Z_free(ret_var);
40945         return ret_arr;
40946 }
40947
40948 void  __attribute__((export_name("TS_TxAbort_set_data"))) TS_TxAbort_set_data(uint64_t this_ptr, int8_tArray val) {
40949         LDKTxAbort this_ptr_conv;
40950         this_ptr_conv.inner = untag_ptr(this_ptr);
40951         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
40952         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
40953         this_ptr_conv.is_owned = false;
40954         LDKCVec_u8Z val_ref;
40955         val_ref.datalen = val->arr_len;
40956         val_ref.data = MALLOC(val_ref.datalen, "LDKCVec_u8Z Bytes");
40957         memcpy(val_ref.data, val->elems, val_ref.datalen); FREE(val);
40958         TxAbort_set_data(&this_ptr_conv, val_ref);
40959 }
40960
40961 uint64_t  __attribute__((export_name("TS_TxAbort_new"))) TS_TxAbort_new(int8_tArray channel_id_arg, int8_tArray data_arg) {
40962         LDKThirtyTwoBytes channel_id_arg_ref;
40963         CHECK(channel_id_arg->arr_len == 32);
40964         memcpy(channel_id_arg_ref.data, channel_id_arg->elems, 32); FREE(channel_id_arg);
40965         LDKCVec_u8Z data_arg_ref;
40966         data_arg_ref.datalen = data_arg->arr_len;
40967         data_arg_ref.data = MALLOC(data_arg_ref.datalen, "LDKCVec_u8Z Bytes");
40968         memcpy(data_arg_ref.data, data_arg->elems, data_arg_ref.datalen); FREE(data_arg);
40969         LDKTxAbort ret_var = TxAbort_new(channel_id_arg_ref, data_arg_ref);
40970         uint64_t ret_ref = 0;
40971         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
40972         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
40973         return ret_ref;
40974 }
40975
40976 static inline uint64_t TxAbort_clone_ptr(LDKTxAbort *NONNULL_PTR arg) {
40977         LDKTxAbort ret_var = TxAbort_clone(arg);
40978         uint64_t ret_ref = 0;
40979         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
40980         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
40981         return ret_ref;
40982 }
40983 int64_t  __attribute__((export_name("TS_TxAbort_clone_ptr"))) TS_TxAbort_clone_ptr(uint64_t arg) {
40984         LDKTxAbort arg_conv;
40985         arg_conv.inner = untag_ptr(arg);
40986         arg_conv.is_owned = ptr_is_owned(arg);
40987         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
40988         arg_conv.is_owned = false;
40989         int64_t ret_conv = TxAbort_clone_ptr(&arg_conv);
40990         return ret_conv;
40991 }
40992
40993 uint64_t  __attribute__((export_name("TS_TxAbort_clone"))) TS_TxAbort_clone(uint64_t orig) {
40994         LDKTxAbort orig_conv;
40995         orig_conv.inner = untag_ptr(orig);
40996         orig_conv.is_owned = ptr_is_owned(orig);
40997         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
40998         orig_conv.is_owned = false;
40999         LDKTxAbort ret_var = TxAbort_clone(&orig_conv);
41000         uint64_t ret_ref = 0;
41001         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
41002         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
41003         return ret_ref;
41004 }
41005
41006 jboolean  __attribute__((export_name("TS_TxAbort_eq"))) TS_TxAbort_eq(uint64_t a, uint64_t b) {
41007         LDKTxAbort a_conv;
41008         a_conv.inner = untag_ptr(a);
41009         a_conv.is_owned = ptr_is_owned(a);
41010         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
41011         a_conv.is_owned = false;
41012         LDKTxAbort b_conv;
41013         b_conv.inner = untag_ptr(b);
41014         b_conv.is_owned = ptr_is_owned(b);
41015         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
41016         b_conv.is_owned = false;
41017         jboolean ret_conv = TxAbort_eq(&a_conv, &b_conv);
41018         return ret_conv;
41019 }
41020
41021 void  __attribute__((export_name("TS_Shutdown_free"))) TS_Shutdown_free(uint64_t this_obj) {
41022         LDKShutdown this_obj_conv;
41023         this_obj_conv.inner = untag_ptr(this_obj);
41024         this_obj_conv.is_owned = ptr_is_owned(this_obj);
41025         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
41026         Shutdown_free(this_obj_conv);
41027 }
41028
41029 int8_tArray  __attribute__((export_name("TS_Shutdown_get_channel_id"))) TS_Shutdown_get_channel_id(uint64_t this_ptr) {
41030         LDKShutdown this_ptr_conv;
41031         this_ptr_conv.inner = untag_ptr(this_ptr);
41032         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
41033         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
41034         this_ptr_conv.is_owned = false;
41035         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
41036         memcpy(ret_arr->elems, *Shutdown_get_channel_id(&this_ptr_conv), 32);
41037         return ret_arr;
41038 }
41039
41040 void  __attribute__((export_name("TS_Shutdown_set_channel_id"))) TS_Shutdown_set_channel_id(uint64_t this_ptr, int8_tArray val) {
41041         LDKShutdown this_ptr_conv;
41042         this_ptr_conv.inner = untag_ptr(this_ptr);
41043         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
41044         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
41045         this_ptr_conv.is_owned = false;
41046         LDKThirtyTwoBytes val_ref;
41047         CHECK(val->arr_len == 32);
41048         memcpy(val_ref.data, val->elems, 32); FREE(val);
41049         Shutdown_set_channel_id(&this_ptr_conv, val_ref);
41050 }
41051
41052 int8_tArray  __attribute__((export_name("TS_Shutdown_get_scriptpubkey"))) TS_Shutdown_get_scriptpubkey(uint64_t this_ptr) {
41053         LDKShutdown this_ptr_conv;
41054         this_ptr_conv.inner = untag_ptr(this_ptr);
41055         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
41056         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
41057         this_ptr_conv.is_owned = false;
41058         LDKu8slice ret_var = Shutdown_get_scriptpubkey(&this_ptr_conv);
41059         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
41060         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
41061         return ret_arr;
41062 }
41063
41064 void  __attribute__((export_name("TS_Shutdown_set_scriptpubkey"))) TS_Shutdown_set_scriptpubkey(uint64_t this_ptr, int8_tArray val) {
41065         LDKShutdown this_ptr_conv;
41066         this_ptr_conv.inner = untag_ptr(this_ptr);
41067         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
41068         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
41069         this_ptr_conv.is_owned = false;
41070         LDKCVec_u8Z val_ref;
41071         val_ref.datalen = val->arr_len;
41072         val_ref.data = MALLOC(val_ref.datalen, "LDKCVec_u8Z Bytes");
41073         memcpy(val_ref.data, val->elems, val_ref.datalen); FREE(val);
41074         Shutdown_set_scriptpubkey(&this_ptr_conv, val_ref);
41075 }
41076
41077 uint64_t  __attribute__((export_name("TS_Shutdown_new"))) TS_Shutdown_new(int8_tArray channel_id_arg, int8_tArray scriptpubkey_arg) {
41078         LDKThirtyTwoBytes channel_id_arg_ref;
41079         CHECK(channel_id_arg->arr_len == 32);
41080         memcpy(channel_id_arg_ref.data, channel_id_arg->elems, 32); FREE(channel_id_arg);
41081         LDKCVec_u8Z scriptpubkey_arg_ref;
41082         scriptpubkey_arg_ref.datalen = scriptpubkey_arg->arr_len;
41083         scriptpubkey_arg_ref.data = MALLOC(scriptpubkey_arg_ref.datalen, "LDKCVec_u8Z Bytes");
41084         memcpy(scriptpubkey_arg_ref.data, scriptpubkey_arg->elems, scriptpubkey_arg_ref.datalen); FREE(scriptpubkey_arg);
41085         LDKShutdown ret_var = Shutdown_new(channel_id_arg_ref, scriptpubkey_arg_ref);
41086         uint64_t ret_ref = 0;
41087         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
41088         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
41089         return ret_ref;
41090 }
41091
41092 static inline uint64_t Shutdown_clone_ptr(LDKShutdown *NONNULL_PTR arg) {
41093         LDKShutdown ret_var = Shutdown_clone(arg);
41094         uint64_t ret_ref = 0;
41095         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
41096         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
41097         return ret_ref;
41098 }
41099 int64_t  __attribute__((export_name("TS_Shutdown_clone_ptr"))) TS_Shutdown_clone_ptr(uint64_t arg) {
41100         LDKShutdown arg_conv;
41101         arg_conv.inner = untag_ptr(arg);
41102         arg_conv.is_owned = ptr_is_owned(arg);
41103         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
41104         arg_conv.is_owned = false;
41105         int64_t ret_conv = Shutdown_clone_ptr(&arg_conv);
41106         return ret_conv;
41107 }
41108
41109 uint64_t  __attribute__((export_name("TS_Shutdown_clone"))) TS_Shutdown_clone(uint64_t orig) {
41110         LDKShutdown orig_conv;
41111         orig_conv.inner = untag_ptr(orig);
41112         orig_conv.is_owned = ptr_is_owned(orig);
41113         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
41114         orig_conv.is_owned = false;
41115         LDKShutdown ret_var = Shutdown_clone(&orig_conv);
41116         uint64_t ret_ref = 0;
41117         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
41118         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
41119         return ret_ref;
41120 }
41121
41122 jboolean  __attribute__((export_name("TS_Shutdown_eq"))) TS_Shutdown_eq(uint64_t a, uint64_t b) {
41123         LDKShutdown a_conv;
41124         a_conv.inner = untag_ptr(a);
41125         a_conv.is_owned = ptr_is_owned(a);
41126         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
41127         a_conv.is_owned = false;
41128         LDKShutdown b_conv;
41129         b_conv.inner = untag_ptr(b);
41130         b_conv.is_owned = ptr_is_owned(b);
41131         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
41132         b_conv.is_owned = false;
41133         jboolean ret_conv = Shutdown_eq(&a_conv, &b_conv);
41134         return ret_conv;
41135 }
41136
41137 void  __attribute__((export_name("TS_ClosingSignedFeeRange_free"))) TS_ClosingSignedFeeRange_free(uint64_t this_obj) {
41138         LDKClosingSignedFeeRange this_obj_conv;
41139         this_obj_conv.inner = untag_ptr(this_obj);
41140         this_obj_conv.is_owned = ptr_is_owned(this_obj);
41141         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
41142         ClosingSignedFeeRange_free(this_obj_conv);
41143 }
41144
41145 int64_t  __attribute__((export_name("TS_ClosingSignedFeeRange_get_min_fee_satoshis"))) TS_ClosingSignedFeeRange_get_min_fee_satoshis(uint64_t this_ptr) {
41146         LDKClosingSignedFeeRange this_ptr_conv;
41147         this_ptr_conv.inner = untag_ptr(this_ptr);
41148         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
41149         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
41150         this_ptr_conv.is_owned = false;
41151         int64_t ret_conv = ClosingSignedFeeRange_get_min_fee_satoshis(&this_ptr_conv);
41152         return ret_conv;
41153 }
41154
41155 void  __attribute__((export_name("TS_ClosingSignedFeeRange_set_min_fee_satoshis"))) TS_ClosingSignedFeeRange_set_min_fee_satoshis(uint64_t this_ptr, int64_t val) {
41156         LDKClosingSignedFeeRange this_ptr_conv;
41157         this_ptr_conv.inner = untag_ptr(this_ptr);
41158         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
41159         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
41160         this_ptr_conv.is_owned = false;
41161         ClosingSignedFeeRange_set_min_fee_satoshis(&this_ptr_conv, val);
41162 }
41163
41164 int64_t  __attribute__((export_name("TS_ClosingSignedFeeRange_get_max_fee_satoshis"))) TS_ClosingSignedFeeRange_get_max_fee_satoshis(uint64_t this_ptr) {
41165         LDKClosingSignedFeeRange this_ptr_conv;
41166         this_ptr_conv.inner = untag_ptr(this_ptr);
41167         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
41168         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
41169         this_ptr_conv.is_owned = false;
41170         int64_t ret_conv = ClosingSignedFeeRange_get_max_fee_satoshis(&this_ptr_conv);
41171         return ret_conv;
41172 }
41173
41174 void  __attribute__((export_name("TS_ClosingSignedFeeRange_set_max_fee_satoshis"))) TS_ClosingSignedFeeRange_set_max_fee_satoshis(uint64_t this_ptr, int64_t val) {
41175         LDKClosingSignedFeeRange this_ptr_conv;
41176         this_ptr_conv.inner = untag_ptr(this_ptr);
41177         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
41178         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
41179         this_ptr_conv.is_owned = false;
41180         ClosingSignedFeeRange_set_max_fee_satoshis(&this_ptr_conv, val);
41181 }
41182
41183 uint64_t  __attribute__((export_name("TS_ClosingSignedFeeRange_new"))) TS_ClosingSignedFeeRange_new(int64_t min_fee_satoshis_arg, int64_t max_fee_satoshis_arg) {
41184         LDKClosingSignedFeeRange ret_var = ClosingSignedFeeRange_new(min_fee_satoshis_arg, max_fee_satoshis_arg);
41185         uint64_t ret_ref = 0;
41186         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
41187         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
41188         return ret_ref;
41189 }
41190
41191 static inline uint64_t ClosingSignedFeeRange_clone_ptr(LDKClosingSignedFeeRange *NONNULL_PTR arg) {
41192         LDKClosingSignedFeeRange ret_var = ClosingSignedFeeRange_clone(arg);
41193         uint64_t ret_ref = 0;
41194         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
41195         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
41196         return ret_ref;
41197 }
41198 int64_t  __attribute__((export_name("TS_ClosingSignedFeeRange_clone_ptr"))) TS_ClosingSignedFeeRange_clone_ptr(uint64_t arg) {
41199         LDKClosingSignedFeeRange arg_conv;
41200         arg_conv.inner = untag_ptr(arg);
41201         arg_conv.is_owned = ptr_is_owned(arg);
41202         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
41203         arg_conv.is_owned = false;
41204         int64_t ret_conv = ClosingSignedFeeRange_clone_ptr(&arg_conv);
41205         return ret_conv;
41206 }
41207
41208 uint64_t  __attribute__((export_name("TS_ClosingSignedFeeRange_clone"))) TS_ClosingSignedFeeRange_clone(uint64_t orig) {
41209         LDKClosingSignedFeeRange orig_conv;
41210         orig_conv.inner = untag_ptr(orig);
41211         orig_conv.is_owned = ptr_is_owned(orig);
41212         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
41213         orig_conv.is_owned = false;
41214         LDKClosingSignedFeeRange ret_var = ClosingSignedFeeRange_clone(&orig_conv);
41215         uint64_t ret_ref = 0;
41216         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
41217         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
41218         return ret_ref;
41219 }
41220
41221 jboolean  __attribute__((export_name("TS_ClosingSignedFeeRange_eq"))) TS_ClosingSignedFeeRange_eq(uint64_t a, uint64_t b) {
41222         LDKClosingSignedFeeRange a_conv;
41223         a_conv.inner = untag_ptr(a);
41224         a_conv.is_owned = ptr_is_owned(a);
41225         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
41226         a_conv.is_owned = false;
41227         LDKClosingSignedFeeRange b_conv;
41228         b_conv.inner = untag_ptr(b);
41229         b_conv.is_owned = ptr_is_owned(b);
41230         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
41231         b_conv.is_owned = false;
41232         jboolean ret_conv = ClosingSignedFeeRange_eq(&a_conv, &b_conv);
41233         return ret_conv;
41234 }
41235
41236 void  __attribute__((export_name("TS_ClosingSigned_free"))) TS_ClosingSigned_free(uint64_t this_obj) {
41237         LDKClosingSigned this_obj_conv;
41238         this_obj_conv.inner = untag_ptr(this_obj);
41239         this_obj_conv.is_owned = ptr_is_owned(this_obj);
41240         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
41241         ClosingSigned_free(this_obj_conv);
41242 }
41243
41244 int8_tArray  __attribute__((export_name("TS_ClosingSigned_get_channel_id"))) TS_ClosingSigned_get_channel_id(uint64_t this_ptr) {
41245         LDKClosingSigned this_ptr_conv;
41246         this_ptr_conv.inner = untag_ptr(this_ptr);
41247         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
41248         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
41249         this_ptr_conv.is_owned = false;
41250         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
41251         memcpy(ret_arr->elems, *ClosingSigned_get_channel_id(&this_ptr_conv), 32);
41252         return ret_arr;
41253 }
41254
41255 void  __attribute__((export_name("TS_ClosingSigned_set_channel_id"))) TS_ClosingSigned_set_channel_id(uint64_t this_ptr, int8_tArray val) {
41256         LDKClosingSigned this_ptr_conv;
41257         this_ptr_conv.inner = untag_ptr(this_ptr);
41258         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
41259         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
41260         this_ptr_conv.is_owned = false;
41261         LDKThirtyTwoBytes val_ref;
41262         CHECK(val->arr_len == 32);
41263         memcpy(val_ref.data, val->elems, 32); FREE(val);
41264         ClosingSigned_set_channel_id(&this_ptr_conv, val_ref);
41265 }
41266
41267 int64_t  __attribute__((export_name("TS_ClosingSigned_get_fee_satoshis"))) TS_ClosingSigned_get_fee_satoshis(uint64_t this_ptr) {
41268         LDKClosingSigned this_ptr_conv;
41269         this_ptr_conv.inner = untag_ptr(this_ptr);
41270         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
41271         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
41272         this_ptr_conv.is_owned = false;
41273         int64_t ret_conv = ClosingSigned_get_fee_satoshis(&this_ptr_conv);
41274         return ret_conv;
41275 }
41276
41277 void  __attribute__((export_name("TS_ClosingSigned_set_fee_satoshis"))) TS_ClosingSigned_set_fee_satoshis(uint64_t this_ptr, int64_t val) {
41278         LDKClosingSigned this_ptr_conv;
41279         this_ptr_conv.inner = untag_ptr(this_ptr);
41280         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
41281         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
41282         this_ptr_conv.is_owned = false;
41283         ClosingSigned_set_fee_satoshis(&this_ptr_conv, val);
41284 }
41285
41286 int8_tArray  __attribute__((export_name("TS_ClosingSigned_get_signature"))) TS_ClosingSigned_get_signature(uint64_t this_ptr) {
41287         LDKClosingSigned this_ptr_conv;
41288         this_ptr_conv.inner = untag_ptr(this_ptr);
41289         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
41290         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
41291         this_ptr_conv.is_owned = false;
41292         int8_tArray ret_arr = init_int8_tArray(64, __LINE__);
41293         memcpy(ret_arr->elems, ClosingSigned_get_signature(&this_ptr_conv).compact_form, 64);
41294         return ret_arr;
41295 }
41296
41297 void  __attribute__((export_name("TS_ClosingSigned_set_signature"))) TS_ClosingSigned_set_signature(uint64_t this_ptr, int8_tArray val) {
41298         LDKClosingSigned this_ptr_conv;
41299         this_ptr_conv.inner = untag_ptr(this_ptr);
41300         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
41301         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
41302         this_ptr_conv.is_owned = false;
41303         LDKECDSASignature val_ref;
41304         CHECK(val->arr_len == 64);
41305         memcpy(val_ref.compact_form, val->elems, 64); FREE(val);
41306         ClosingSigned_set_signature(&this_ptr_conv, val_ref);
41307 }
41308
41309 uint64_t  __attribute__((export_name("TS_ClosingSigned_get_fee_range"))) TS_ClosingSigned_get_fee_range(uint64_t this_ptr) {
41310         LDKClosingSigned this_ptr_conv;
41311         this_ptr_conv.inner = untag_ptr(this_ptr);
41312         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
41313         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
41314         this_ptr_conv.is_owned = false;
41315         LDKClosingSignedFeeRange ret_var = ClosingSigned_get_fee_range(&this_ptr_conv);
41316         uint64_t ret_ref = 0;
41317         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
41318         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
41319         return ret_ref;
41320 }
41321
41322 void  __attribute__((export_name("TS_ClosingSigned_set_fee_range"))) TS_ClosingSigned_set_fee_range(uint64_t this_ptr, uint64_t val) {
41323         LDKClosingSigned this_ptr_conv;
41324         this_ptr_conv.inner = untag_ptr(this_ptr);
41325         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
41326         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
41327         this_ptr_conv.is_owned = false;
41328         LDKClosingSignedFeeRange val_conv;
41329         val_conv.inner = untag_ptr(val);
41330         val_conv.is_owned = ptr_is_owned(val);
41331         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
41332         val_conv = ClosingSignedFeeRange_clone(&val_conv);
41333         ClosingSigned_set_fee_range(&this_ptr_conv, val_conv);
41334 }
41335
41336 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) {
41337         LDKThirtyTwoBytes channel_id_arg_ref;
41338         CHECK(channel_id_arg->arr_len == 32);
41339         memcpy(channel_id_arg_ref.data, channel_id_arg->elems, 32); FREE(channel_id_arg);
41340         LDKECDSASignature signature_arg_ref;
41341         CHECK(signature_arg->arr_len == 64);
41342         memcpy(signature_arg_ref.compact_form, signature_arg->elems, 64); FREE(signature_arg);
41343         LDKClosingSignedFeeRange fee_range_arg_conv;
41344         fee_range_arg_conv.inner = untag_ptr(fee_range_arg);
41345         fee_range_arg_conv.is_owned = ptr_is_owned(fee_range_arg);
41346         CHECK_INNER_FIELD_ACCESS_OR_NULL(fee_range_arg_conv);
41347         fee_range_arg_conv = ClosingSignedFeeRange_clone(&fee_range_arg_conv);
41348         LDKClosingSigned ret_var = ClosingSigned_new(channel_id_arg_ref, fee_satoshis_arg, signature_arg_ref, fee_range_arg_conv);
41349         uint64_t ret_ref = 0;
41350         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
41351         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
41352         return ret_ref;
41353 }
41354
41355 static inline uint64_t ClosingSigned_clone_ptr(LDKClosingSigned *NONNULL_PTR arg) {
41356         LDKClosingSigned ret_var = ClosingSigned_clone(arg);
41357         uint64_t ret_ref = 0;
41358         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
41359         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
41360         return ret_ref;
41361 }
41362 int64_t  __attribute__((export_name("TS_ClosingSigned_clone_ptr"))) TS_ClosingSigned_clone_ptr(uint64_t arg) {
41363         LDKClosingSigned arg_conv;
41364         arg_conv.inner = untag_ptr(arg);
41365         arg_conv.is_owned = ptr_is_owned(arg);
41366         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
41367         arg_conv.is_owned = false;
41368         int64_t ret_conv = ClosingSigned_clone_ptr(&arg_conv);
41369         return ret_conv;
41370 }
41371
41372 uint64_t  __attribute__((export_name("TS_ClosingSigned_clone"))) TS_ClosingSigned_clone(uint64_t orig) {
41373         LDKClosingSigned orig_conv;
41374         orig_conv.inner = untag_ptr(orig);
41375         orig_conv.is_owned = ptr_is_owned(orig);
41376         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
41377         orig_conv.is_owned = false;
41378         LDKClosingSigned ret_var = ClosingSigned_clone(&orig_conv);
41379         uint64_t ret_ref = 0;
41380         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
41381         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
41382         return ret_ref;
41383 }
41384
41385 jboolean  __attribute__((export_name("TS_ClosingSigned_eq"))) TS_ClosingSigned_eq(uint64_t a, uint64_t b) {
41386         LDKClosingSigned a_conv;
41387         a_conv.inner = untag_ptr(a);
41388         a_conv.is_owned = ptr_is_owned(a);
41389         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
41390         a_conv.is_owned = false;
41391         LDKClosingSigned b_conv;
41392         b_conv.inner = untag_ptr(b);
41393         b_conv.is_owned = ptr_is_owned(b);
41394         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
41395         b_conv.is_owned = false;
41396         jboolean ret_conv = ClosingSigned_eq(&a_conv, &b_conv);
41397         return ret_conv;
41398 }
41399
41400 void  __attribute__((export_name("TS_UpdateAddHTLC_free"))) TS_UpdateAddHTLC_free(uint64_t this_obj) {
41401         LDKUpdateAddHTLC this_obj_conv;
41402         this_obj_conv.inner = untag_ptr(this_obj);
41403         this_obj_conv.is_owned = ptr_is_owned(this_obj);
41404         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
41405         UpdateAddHTLC_free(this_obj_conv);
41406 }
41407
41408 int8_tArray  __attribute__((export_name("TS_UpdateAddHTLC_get_channel_id"))) TS_UpdateAddHTLC_get_channel_id(uint64_t this_ptr) {
41409         LDKUpdateAddHTLC this_ptr_conv;
41410         this_ptr_conv.inner = untag_ptr(this_ptr);
41411         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
41412         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
41413         this_ptr_conv.is_owned = false;
41414         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
41415         memcpy(ret_arr->elems, *UpdateAddHTLC_get_channel_id(&this_ptr_conv), 32);
41416         return ret_arr;
41417 }
41418
41419 void  __attribute__((export_name("TS_UpdateAddHTLC_set_channel_id"))) TS_UpdateAddHTLC_set_channel_id(uint64_t this_ptr, int8_tArray val) {
41420         LDKUpdateAddHTLC this_ptr_conv;
41421         this_ptr_conv.inner = untag_ptr(this_ptr);
41422         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
41423         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
41424         this_ptr_conv.is_owned = false;
41425         LDKThirtyTwoBytes val_ref;
41426         CHECK(val->arr_len == 32);
41427         memcpy(val_ref.data, val->elems, 32); FREE(val);
41428         UpdateAddHTLC_set_channel_id(&this_ptr_conv, val_ref);
41429 }
41430
41431 int64_t  __attribute__((export_name("TS_UpdateAddHTLC_get_htlc_id"))) TS_UpdateAddHTLC_get_htlc_id(uint64_t this_ptr) {
41432         LDKUpdateAddHTLC this_ptr_conv;
41433         this_ptr_conv.inner = untag_ptr(this_ptr);
41434         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
41435         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
41436         this_ptr_conv.is_owned = false;
41437         int64_t ret_conv = UpdateAddHTLC_get_htlc_id(&this_ptr_conv);
41438         return ret_conv;
41439 }
41440
41441 void  __attribute__((export_name("TS_UpdateAddHTLC_set_htlc_id"))) TS_UpdateAddHTLC_set_htlc_id(uint64_t this_ptr, int64_t val) {
41442         LDKUpdateAddHTLC this_ptr_conv;
41443         this_ptr_conv.inner = untag_ptr(this_ptr);
41444         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
41445         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
41446         this_ptr_conv.is_owned = false;
41447         UpdateAddHTLC_set_htlc_id(&this_ptr_conv, val);
41448 }
41449
41450 int64_t  __attribute__((export_name("TS_UpdateAddHTLC_get_amount_msat"))) TS_UpdateAddHTLC_get_amount_msat(uint64_t this_ptr) {
41451         LDKUpdateAddHTLC this_ptr_conv;
41452         this_ptr_conv.inner = untag_ptr(this_ptr);
41453         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
41454         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
41455         this_ptr_conv.is_owned = false;
41456         int64_t ret_conv = UpdateAddHTLC_get_amount_msat(&this_ptr_conv);
41457         return ret_conv;
41458 }
41459
41460 void  __attribute__((export_name("TS_UpdateAddHTLC_set_amount_msat"))) TS_UpdateAddHTLC_set_amount_msat(uint64_t this_ptr, int64_t val) {
41461         LDKUpdateAddHTLC this_ptr_conv;
41462         this_ptr_conv.inner = untag_ptr(this_ptr);
41463         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
41464         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
41465         this_ptr_conv.is_owned = false;
41466         UpdateAddHTLC_set_amount_msat(&this_ptr_conv, val);
41467 }
41468
41469 int8_tArray  __attribute__((export_name("TS_UpdateAddHTLC_get_payment_hash"))) TS_UpdateAddHTLC_get_payment_hash(uint64_t this_ptr) {
41470         LDKUpdateAddHTLC this_ptr_conv;
41471         this_ptr_conv.inner = untag_ptr(this_ptr);
41472         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
41473         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
41474         this_ptr_conv.is_owned = false;
41475         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
41476         memcpy(ret_arr->elems, *UpdateAddHTLC_get_payment_hash(&this_ptr_conv), 32);
41477         return ret_arr;
41478 }
41479
41480 void  __attribute__((export_name("TS_UpdateAddHTLC_set_payment_hash"))) TS_UpdateAddHTLC_set_payment_hash(uint64_t this_ptr, int8_tArray val) {
41481         LDKUpdateAddHTLC this_ptr_conv;
41482         this_ptr_conv.inner = untag_ptr(this_ptr);
41483         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
41484         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
41485         this_ptr_conv.is_owned = false;
41486         LDKThirtyTwoBytes val_ref;
41487         CHECK(val->arr_len == 32);
41488         memcpy(val_ref.data, val->elems, 32); FREE(val);
41489         UpdateAddHTLC_set_payment_hash(&this_ptr_conv, val_ref);
41490 }
41491
41492 int32_t  __attribute__((export_name("TS_UpdateAddHTLC_get_cltv_expiry"))) TS_UpdateAddHTLC_get_cltv_expiry(uint64_t this_ptr) {
41493         LDKUpdateAddHTLC this_ptr_conv;
41494         this_ptr_conv.inner = untag_ptr(this_ptr);
41495         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
41496         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
41497         this_ptr_conv.is_owned = false;
41498         int32_t ret_conv = UpdateAddHTLC_get_cltv_expiry(&this_ptr_conv);
41499         return ret_conv;
41500 }
41501
41502 void  __attribute__((export_name("TS_UpdateAddHTLC_set_cltv_expiry"))) TS_UpdateAddHTLC_set_cltv_expiry(uint64_t this_ptr, int32_t val) {
41503         LDKUpdateAddHTLC this_ptr_conv;
41504         this_ptr_conv.inner = untag_ptr(this_ptr);
41505         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
41506         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
41507         this_ptr_conv.is_owned = false;
41508         UpdateAddHTLC_set_cltv_expiry(&this_ptr_conv, val);
41509 }
41510
41511 uint64_t  __attribute__((export_name("TS_UpdateAddHTLC_get_skimmed_fee_msat"))) TS_UpdateAddHTLC_get_skimmed_fee_msat(uint64_t this_ptr) {
41512         LDKUpdateAddHTLC this_ptr_conv;
41513         this_ptr_conv.inner = untag_ptr(this_ptr);
41514         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
41515         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
41516         this_ptr_conv.is_owned = false;
41517         LDKCOption_u64Z *ret_copy = MALLOC(sizeof(LDKCOption_u64Z), "LDKCOption_u64Z");
41518         *ret_copy = UpdateAddHTLC_get_skimmed_fee_msat(&this_ptr_conv);
41519         uint64_t ret_ref = tag_ptr(ret_copy, true);
41520         return ret_ref;
41521 }
41522
41523 void  __attribute__((export_name("TS_UpdateAddHTLC_set_skimmed_fee_msat"))) TS_UpdateAddHTLC_set_skimmed_fee_msat(uint64_t this_ptr, uint64_t val) {
41524         LDKUpdateAddHTLC this_ptr_conv;
41525         this_ptr_conv.inner = untag_ptr(this_ptr);
41526         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
41527         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
41528         this_ptr_conv.is_owned = false;
41529         void* val_ptr = untag_ptr(val);
41530         CHECK_ACCESS(val_ptr);
41531         LDKCOption_u64Z val_conv = *(LDKCOption_u64Z*)(val_ptr);
41532         val_conv = COption_u64Z_clone((LDKCOption_u64Z*)untag_ptr(val));
41533         UpdateAddHTLC_set_skimmed_fee_msat(&this_ptr_conv, val_conv);
41534 }
41535
41536 static inline uint64_t UpdateAddHTLC_clone_ptr(LDKUpdateAddHTLC *NONNULL_PTR arg) {
41537         LDKUpdateAddHTLC ret_var = UpdateAddHTLC_clone(arg);
41538         uint64_t ret_ref = 0;
41539         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
41540         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
41541         return ret_ref;
41542 }
41543 int64_t  __attribute__((export_name("TS_UpdateAddHTLC_clone_ptr"))) TS_UpdateAddHTLC_clone_ptr(uint64_t arg) {
41544         LDKUpdateAddHTLC arg_conv;
41545         arg_conv.inner = untag_ptr(arg);
41546         arg_conv.is_owned = ptr_is_owned(arg);
41547         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
41548         arg_conv.is_owned = false;
41549         int64_t ret_conv = UpdateAddHTLC_clone_ptr(&arg_conv);
41550         return ret_conv;
41551 }
41552
41553 uint64_t  __attribute__((export_name("TS_UpdateAddHTLC_clone"))) TS_UpdateAddHTLC_clone(uint64_t orig) {
41554         LDKUpdateAddHTLC orig_conv;
41555         orig_conv.inner = untag_ptr(orig);
41556         orig_conv.is_owned = ptr_is_owned(orig);
41557         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
41558         orig_conv.is_owned = false;
41559         LDKUpdateAddHTLC ret_var = UpdateAddHTLC_clone(&orig_conv);
41560         uint64_t ret_ref = 0;
41561         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
41562         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
41563         return ret_ref;
41564 }
41565
41566 jboolean  __attribute__((export_name("TS_UpdateAddHTLC_eq"))) TS_UpdateAddHTLC_eq(uint64_t a, uint64_t b) {
41567         LDKUpdateAddHTLC a_conv;
41568         a_conv.inner = untag_ptr(a);
41569         a_conv.is_owned = ptr_is_owned(a);
41570         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
41571         a_conv.is_owned = false;
41572         LDKUpdateAddHTLC b_conv;
41573         b_conv.inner = untag_ptr(b);
41574         b_conv.is_owned = ptr_is_owned(b);
41575         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
41576         b_conv.is_owned = false;
41577         jboolean ret_conv = UpdateAddHTLC_eq(&a_conv, &b_conv);
41578         return ret_conv;
41579 }
41580
41581 void  __attribute__((export_name("TS_OnionMessage_free"))) TS_OnionMessage_free(uint64_t this_obj) {
41582         LDKOnionMessage this_obj_conv;
41583         this_obj_conv.inner = untag_ptr(this_obj);
41584         this_obj_conv.is_owned = ptr_is_owned(this_obj);
41585         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
41586         OnionMessage_free(this_obj_conv);
41587 }
41588
41589 int8_tArray  __attribute__((export_name("TS_OnionMessage_get_blinding_point"))) TS_OnionMessage_get_blinding_point(uint64_t this_ptr) {
41590         LDKOnionMessage this_ptr_conv;
41591         this_ptr_conv.inner = untag_ptr(this_ptr);
41592         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
41593         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
41594         this_ptr_conv.is_owned = false;
41595         int8_tArray ret_arr = init_int8_tArray(33, __LINE__);
41596         memcpy(ret_arr->elems, OnionMessage_get_blinding_point(&this_ptr_conv).compressed_form, 33);
41597         return ret_arr;
41598 }
41599
41600 void  __attribute__((export_name("TS_OnionMessage_set_blinding_point"))) TS_OnionMessage_set_blinding_point(uint64_t this_ptr, int8_tArray val) {
41601         LDKOnionMessage this_ptr_conv;
41602         this_ptr_conv.inner = untag_ptr(this_ptr);
41603         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
41604         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
41605         this_ptr_conv.is_owned = false;
41606         LDKPublicKey val_ref;
41607         CHECK(val->arr_len == 33);
41608         memcpy(val_ref.compressed_form, val->elems, 33); FREE(val);
41609         OnionMessage_set_blinding_point(&this_ptr_conv, val_ref);
41610 }
41611
41612 uint64_t  __attribute__((export_name("TS_OnionMessage_get_onion_routing_packet"))) TS_OnionMessage_get_onion_routing_packet(uint64_t this_ptr) {
41613         LDKOnionMessage this_ptr_conv;
41614         this_ptr_conv.inner = untag_ptr(this_ptr);
41615         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
41616         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
41617         this_ptr_conv.is_owned = false;
41618         LDKPacket ret_var = OnionMessage_get_onion_routing_packet(&this_ptr_conv);
41619         uint64_t ret_ref = 0;
41620         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
41621         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
41622         return ret_ref;
41623 }
41624
41625 void  __attribute__((export_name("TS_OnionMessage_set_onion_routing_packet"))) TS_OnionMessage_set_onion_routing_packet(uint64_t this_ptr, uint64_t val) {
41626         LDKOnionMessage this_ptr_conv;
41627         this_ptr_conv.inner = untag_ptr(this_ptr);
41628         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
41629         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
41630         this_ptr_conv.is_owned = false;
41631         LDKPacket val_conv;
41632         val_conv.inner = untag_ptr(val);
41633         val_conv.is_owned = ptr_is_owned(val);
41634         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
41635         val_conv = Packet_clone(&val_conv);
41636         OnionMessage_set_onion_routing_packet(&this_ptr_conv, val_conv);
41637 }
41638
41639 uint64_t  __attribute__((export_name("TS_OnionMessage_new"))) TS_OnionMessage_new(int8_tArray blinding_point_arg, uint64_t onion_routing_packet_arg) {
41640         LDKPublicKey blinding_point_arg_ref;
41641         CHECK(blinding_point_arg->arr_len == 33);
41642         memcpy(blinding_point_arg_ref.compressed_form, blinding_point_arg->elems, 33); FREE(blinding_point_arg);
41643         LDKPacket onion_routing_packet_arg_conv;
41644         onion_routing_packet_arg_conv.inner = untag_ptr(onion_routing_packet_arg);
41645         onion_routing_packet_arg_conv.is_owned = ptr_is_owned(onion_routing_packet_arg);
41646         CHECK_INNER_FIELD_ACCESS_OR_NULL(onion_routing_packet_arg_conv);
41647         onion_routing_packet_arg_conv = Packet_clone(&onion_routing_packet_arg_conv);
41648         LDKOnionMessage ret_var = OnionMessage_new(blinding_point_arg_ref, onion_routing_packet_arg_conv);
41649         uint64_t ret_ref = 0;
41650         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
41651         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
41652         return ret_ref;
41653 }
41654
41655 static inline uint64_t OnionMessage_clone_ptr(LDKOnionMessage *NONNULL_PTR arg) {
41656         LDKOnionMessage ret_var = OnionMessage_clone(arg);
41657         uint64_t ret_ref = 0;
41658         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
41659         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
41660         return ret_ref;
41661 }
41662 int64_t  __attribute__((export_name("TS_OnionMessage_clone_ptr"))) TS_OnionMessage_clone_ptr(uint64_t arg) {
41663         LDKOnionMessage arg_conv;
41664         arg_conv.inner = untag_ptr(arg);
41665         arg_conv.is_owned = ptr_is_owned(arg);
41666         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
41667         arg_conv.is_owned = false;
41668         int64_t ret_conv = OnionMessage_clone_ptr(&arg_conv);
41669         return ret_conv;
41670 }
41671
41672 uint64_t  __attribute__((export_name("TS_OnionMessage_clone"))) TS_OnionMessage_clone(uint64_t orig) {
41673         LDKOnionMessage orig_conv;
41674         orig_conv.inner = untag_ptr(orig);
41675         orig_conv.is_owned = ptr_is_owned(orig);
41676         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
41677         orig_conv.is_owned = false;
41678         LDKOnionMessage ret_var = OnionMessage_clone(&orig_conv);
41679         uint64_t ret_ref = 0;
41680         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
41681         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
41682         return ret_ref;
41683 }
41684
41685 jboolean  __attribute__((export_name("TS_OnionMessage_eq"))) TS_OnionMessage_eq(uint64_t a, uint64_t b) {
41686         LDKOnionMessage a_conv;
41687         a_conv.inner = untag_ptr(a);
41688         a_conv.is_owned = ptr_is_owned(a);
41689         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
41690         a_conv.is_owned = false;
41691         LDKOnionMessage b_conv;
41692         b_conv.inner = untag_ptr(b);
41693         b_conv.is_owned = ptr_is_owned(b);
41694         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
41695         b_conv.is_owned = false;
41696         jboolean ret_conv = OnionMessage_eq(&a_conv, &b_conv);
41697         return ret_conv;
41698 }
41699
41700 void  __attribute__((export_name("TS_UpdateFulfillHTLC_free"))) TS_UpdateFulfillHTLC_free(uint64_t this_obj) {
41701         LDKUpdateFulfillHTLC this_obj_conv;
41702         this_obj_conv.inner = untag_ptr(this_obj);
41703         this_obj_conv.is_owned = ptr_is_owned(this_obj);
41704         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
41705         UpdateFulfillHTLC_free(this_obj_conv);
41706 }
41707
41708 int8_tArray  __attribute__((export_name("TS_UpdateFulfillHTLC_get_channel_id"))) TS_UpdateFulfillHTLC_get_channel_id(uint64_t this_ptr) {
41709         LDKUpdateFulfillHTLC this_ptr_conv;
41710         this_ptr_conv.inner = untag_ptr(this_ptr);
41711         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
41712         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
41713         this_ptr_conv.is_owned = false;
41714         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
41715         memcpy(ret_arr->elems, *UpdateFulfillHTLC_get_channel_id(&this_ptr_conv), 32);
41716         return ret_arr;
41717 }
41718
41719 void  __attribute__((export_name("TS_UpdateFulfillHTLC_set_channel_id"))) TS_UpdateFulfillHTLC_set_channel_id(uint64_t this_ptr, int8_tArray val) {
41720         LDKUpdateFulfillHTLC this_ptr_conv;
41721         this_ptr_conv.inner = untag_ptr(this_ptr);
41722         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
41723         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
41724         this_ptr_conv.is_owned = false;
41725         LDKThirtyTwoBytes val_ref;
41726         CHECK(val->arr_len == 32);
41727         memcpy(val_ref.data, val->elems, 32); FREE(val);
41728         UpdateFulfillHTLC_set_channel_id(&this_ptr_conv, val_ref);
41729 }
41730
41731 int64_t  __attribute__((export_name("TS_UpdateFulfillHTLC_get_htlc_id"))) TS_UpdateFulfillHTLC_get_htlc_id(uint64_t this_ptr) {
41732         LDKUpdateFulfillHTLC this_ptr_conv;
41733         this_ptr_conv.inner = untag_ptr(this_ptr);
41734         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
41735         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
41736         this_ptr_conv.is_owned = false;
41737         int64_t ret_conv = UpdateFulfillHTLC_get_htlc_id(&this_ptr_conv);
41738         return ret_conv;
41739 }
41740
41741 void  __attribute__((export_name("TS_UpdateFulfillHTLC_set_htlc_id"))) TS_UpdateFulfillHTLC_set_htlc_id(uint64_t this_ptr, int64_t val) {
41742         LDKUpdateFulfillHTLC this_ptr_conv;
41743         this_ptr_conv.inner = untag_ptr(this_ptr);
41744         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
41745         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
41746         this_ptr_conv.is_owned = false;
41747         UpdateFulfillHTLC_set_htlc_id(&this_ptr_conv, val);
41748 }
41749
41750 int8_tArray  __attribute__((export_name("TS_UpdateFulfillHTLC_get_payment_preimage"))) TS_UpdateFulfillHTLC_get_payment_preimage(uint64_t this_ptr) {
41751         LDKUpdateFulfillHTLC this_ptr_conv;
41752         this_ptr_conv.inner = untag_ptr(this_ptr);
41753         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
41754         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
41755         this_ptr_conv.is_owned = false;
41756         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
41757         memcpy(ret_arr->elems, *UpdateFulfillHTLC_get_payment_preimage(&this_ptr_conv), 32);
41758         return ret_arr;
41759 }
41760
41761 void  __attribute__((export_name("TS_UpdateFulfillHTLC_set_payment_preimage"))) TS_UpdateFulfillHTLC_set_payment_preimage(uint64_t this_ptr, int8_tArray val) {
41762         LDKUpdateFulfillHTLC this_ptr_conv;
41763         this_ptr_conv.inner = untag_ptr(this_ptr);
41764         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
41765         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
41766         this_ptr_conv.is_owned = false;
41767         LDKThirtyTwoBytes val_ref;
41768         CHECK(val->arr_len == 32);
41769         memcpy(val_ref.data, val->elems, 32); FREE(val);
41770         UpdateFulfillHTLC_set_payment_preimage(&this_ptr_conv, val_ref);
41771 }
41772
41773 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) {
41774         LDKThirtyTwoBytes channel_id_arg_ref;
41775         CHECK(channel_id_arg->arr_len == 32);
41776         memcpy(channel_id_arg_ref.data, channel_id_arg->elems, 32); FREE(channel_id_arg);
41777         LDKThirtyTwoBytes payment_preimage_arg_ref;
41778         CHECK(payment_preimage_arg->arr_len == 32);
41779         memcpy(payment_preimage_arg_ref.data, payment_preimage_arg->elems, 32); FREE(payment_preimage_arg);
41780         LDKUpdateFulfillHTLC ret_var = UpdateFulfillHTLC_new(channel_id_arg_ref, htlc_id_arg, payment_preimage_arg_ref);
41781         uint64_t ret_ref = 0;
41782         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
41783         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
41784         return ret_ref;
41785 }
41786
41787 static inline uint64_t UpdateFulfillHTLC_clone_ptr(LDKUpdateFulfillHTLC *NONNULL_PTR arg) {
41788         LDKUpdateFulfillHTLC ret_var = UpdateFulfillHTLC_clone(arg);
41789         uint64_t ret_ref = 0;
41790         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
41791         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
41792         return ret_ref;
41793 }
41794 int64_t  __attribute__((export_name("TS_UpdateFulfillHTLC_clone_ptr"))) TS_UpdateFulfillHTLC_clone_ptr(uint64_t arg) {
41795         LDKUpdateFulfillHTLC arg_conv;
41796         arg_conv.inner = untag_ptr(arg);
41797         arg_conv.is_owned = ptr_is_owned(arg);
41798         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
41799         arg_conv.is_owned = false;
41800         int64_t ret_conv = UpdateFulfillHTLC_clone_ptr(&arg_conv);
41801         return ret_conv;
41802 }
41803
41804 uint64_t  __attribute__((export_name("TS_UpdateFulfillHTLC_clone"))) TS_UpdateFulfillHTLC_clone(uint64_t orig) {
41805         LDKUpdateFulfillHTLC orig_conv;
41806         orig_conv.inner = untag_ptr(orig);
41807         orig_conv.is_owned = ptr_is_owned(orig);
41808         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
41809         orig_conv.is_owned = false;
41810         LDKUpdateFulfillHTLC ret_var = UpdateFulfillHTLC_clone(&orig_conv);
41811         uint64_t ret_ref = 0;
41812         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
41813         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
41814         return ret_ref;
41815 }
41816
41817 jboolean  __attribute__((export_name("TS_UpdateFulfillHTLC_eq"))) TS_UpdateFulfillHTLC_eq(uint64_t a, uint64_t b) {
41818         LDKUpdateFulfillHTLC a_conv;
41819         a_conv.inner = untag_ptr(a);
41820         a_conv.is_owned = ptr_is_owned(a);
41821         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
41822         a_conv.is_owned = false;
41823         LDKUpdateFulfillHTLC b_conv;
41824         b_conv.inner = untag_ptr(b);
41825         b_conv.is_owned = ptr_is_owned(b);
41826         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
41827         b_conv.is_owned = false;
41828         jboolean ret_conv = UpdateFulfillHTLC_eq(&a_conv, &b_conv);
41829         return ret_conv;
41830 }
41831
41832 void  __attribute__((export_name("TS_UpdateFailHTLC_free"))) TS_UpdateFailHTLC_free(uint64_t this_obj) {
41833         LDKUpdateFailHTLC this_obj_conv;
41834         this_obj_conv.inner = untag_ptr(this_obj);
41835         this_obj_conv.is_owned = ptr_is_owned(this_obj);
41836         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
41837         UpdateFailHTLC_free(this_obj_conv);
41838 }
41839
41840 int8_tArray  __attribute__((export_name("TS_UpdateFailHTLC_get_channel_id"))) TS_UpdateFailHTLC_get_channel_id(uint64_t this_ptr) {
41841         LDKUpdateFailHTLC this_ptr_conv;
41842         this_ptr_conv.inner = untag_ptr(this_ptr);
41843         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
41844         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
41845         this_ptr_conv.is_owned = false;
41846         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
41847         memcpy(ret_arr->elems, *UpdateFailHTLC_get_channel_id(&this_ptr_conv), 32);
41848         return ret_arr;
41849 }
41850
41851 void  __attribute__((export_name("TS_UpdateFailHTLC_set_channel_id"))) TS_UpdateFailHTLC_set_channel_id(uint64_t this_ptr, int8_tArray val) {
41852         LDKUpdateFailHTLC this_ptr_conv;
41853         this_ptr_conv.inner = untag_ptr(this_ptr);
41854         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
41855         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
41856         this_ptr_conv.is_owned = false;
41857         LDKThirtyTwoBytes val_ref;
41858         CHECK(val->arr_len == 32);
41859         memcpy(val_ref.data, val->elems, 32); FREE(val);
41860         UpdateFailHTLC_set_channel_id(&this_ptr_conv, val_ref);
41861 }
41862
41863 int64_t  __attribute__((export_name("TS_UpdateFailHTLC_get_htlc_id"))) TS_UpdateFailHTLC_get_htlc_id(uint64_t this_ptr) {
41864         LDKUpdateFailHTLC this_ptr_conv;
41865         this_ptr_conv.inner = untag_ptr(this_ptr);
41866         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
41867         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
41868         this_ptr_conv.is_owned = false;
41869         int64_t ret_conv = UpdateFailHTLC_get_htlc_id(&this_ptr_conv);
41870         return ret_conv;
41871 }
41872
41873 void  __attribute__((export_name("TS_UpdateFailHTLC_set_htlc_id"))) TS_UpdateFailHTLC_set_htlc_id(uint64_t this_ptr, int64_t val) {
41874         LDKUpdateFailHTLC this_ptr_conv;
41875         this_ptr_conv.inner = untag_ptr(this_ptr);
41876         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
41877         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
41878         this_ptr_conv.is_owned = false;
41879         UpdateFailHTLC_set_htlc_id(&this_ptr_conv, val);
41880 }
41881
41882 static inline uint64_t UpdateFailHTLC_clone_ptr(LDKUpdateFailHTLC *NONNULL_PTR arg) {
41883         LDKUpdateFailHTLC ret_var = UpdateFailHTLC_clone(arg);
41884         uint64_t ret_ref = 0;
41885         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
41886         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
41887         return ret_ref;
41888 }
41889 int64_t  __attribute__((export_name("TS_UpdateFailHTLC_clone_ptr"))) TS_UpdateFailHTLC_clone_ptr(uint64_t arg) {
41890         LDKUpdateFailHTLC arg_conv;
41891         arg_conv.inner = untag_ptr(arg);
41892         arg_conv.is_owned = ptr_is_owned(arg);
41893         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
41894         arg_conv.is_owned = false;
41895         int64_t ret_conv = UpdateFailHTLC_clone_ptr(&arg_conv);
41896         return ret_conv;
41897 }
41898
41899 uint64_t  __attribute__((export_name("TS_UpdateFailHTLC_clone"))) TS_UpdateFailHTLC_clone(uint64_t orig) {
41900         LDKUpdateFailHTLC orig_conv;
41901         orig_conv.inner = untag_ptr(orig);
41902         orig_conv.is_owned = ptr_is_owned(orig);
41903         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
41904         orig_conv.is_owned = false;
41905         LDKUpdateFailHTLC ret_var = UpdateFailHTLC_clone(&orig_conv);
41906         uint64_t ret_ref = 0;
41907         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
41908         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
41909         return ret_ref;
41910 }
41911
41912 jboolean  __attribute__((export_name("TS_UpdateFailHTLC_eq"))) TS_UpdateFailHTLC_eq(uint64_t a, uint64_t b) {
41913         LDKUpdateFailHTLC a_conv;
41914         a_conv.inner = untag_ptr(a);
41915         a_conv.is_owned = ptr_is_owned(a);
41916         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
41917         a_conv.is_owned = false;
41918         LDKUpdateFailHTLC b_conv;
41919         b_conv.inner = untag_ptr(b);
41920         b_conv.is_owned = ptr_is_owned(b);
41921         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
41922         b_conv.is_owned = false;
41923         jboolean ret_conv = UpdateFailHTLC_eq(&a_conv, &b_conv);
41924         return ret_conv;
41925 }
41926
41927 void  __attribute__((export_name("TS_UpdateFailMalformedHTLC_free"))) TS_UpdateFailMalformedHTLC_free(uint64_t this_obj) {
41928         LDKUpdateFailMalformedHTLC this_obj_conv;
41929         this_obj_conv.inner = untag_ptr(this_obj);
41930         this_obj_conv.is_owned = ptr_is_owned(this_obj);
41931         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
41932         UpdateFailMalformedHTLC_free(this_obj_conv);
41933 }
41934
41935 int8_tArray  __attribute__((export_name("TS_UpdateFailMalformedHTLC_get_channel_id"))) TS_UpdateFailMalformedHTLC_get_channel_id(uint64_t this_ptr) {
41936         LDKUpdateFailMalformedHTLC this_ptr_conv;
41937         this_ptr_conv.inner = untag_ptr(this_ptr);
41938         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
41939         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
41940         this_ptr_conv.is_owned = false;
41941         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
41942         memcpy(ret_arr->elems, *UpdateFailMalformedHTLC_get_channel_id(&this_ptr_conv), 32);
41943         return ret_arr;
41944 }
41945
41946 void  __attribute__((export_name("TS_UpdateFailMalformedHTLC_set_channel_id"))) TS_UpdateFailMalformedHTLC_set_channel_id(uint64_t this_ptr, int8_tArray val) {
41947         LDKUpdateFailMalformedHTLC this_ptr_conv;
41948         this_ptr_conv.inner = untag_ptr(this_ptr);
41949         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
41950         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
41951         this_ptr_conv.is_owned = false;
41952         LDKThirtyTwoBytes val_ref;
41953         CHECK(val->arr_len == 32);
41954         memcpy(val_ref.data, val->elems, 32); FREE(val);
41955         UpdateFailMalformedHTLC_set_channel_id(&this_ptr_conv, val_ref);
41956 }
41957
41958 int64_t  __attribute__((export_name("TS_UpdateFailMalformedHTLC_get_htlc_id"))) TS_UpdateFailMalformedHTLC_get_htlc_id(uint64_t this_ptr) {
41959         LDKUpdateFailMalformedHTLC this_ptr_conv;
41960         this_ptr_conv.inner = untag_ptr(this_ptr);
41961         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
41962         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
41963         this_ptr_conv.is_owned = false;
41964         int64_t ret_conv = UpdateFailMalformedHTLC_get_htlc_id(&this_ptr_conv);
41965         return ret_conv;
41966 }
41967
41968 void  __attribute__((export_name("TS_UpdateFailMalformedHTLC_set_htlc_id"))) TS_UpdateFailMalformedHTLC_set_htlc_id(uint64_t this_ptr, int64_t val) {
41969         LDKUpdateFailMalformedHTLC this_ptr_conv;
41970         this_ptr_conv.inner = untag_ptr(this_ptr);
41971         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
41972         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
41973         this_ptr_conv.is_owned = false;
41974         UpdateFailMalformedHTLC_set_htlc_id(&this_ptr_conv, val);
41975 }
41976
41977 int16_t  __attribute__((export_name("TS_UpdateFailMalformedHTLC_get_failure_code"))) TS_UpdateFailMalformedHTLC_get_failure_code(uint64_t this_ptr) {
41978         LDKUpdateFailMalformedHTLC this_ptr_conv;
41979         this_ptr_conv.inner = untag_ptr(this_ptr);
41980         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
41981         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
41982         this_ptr_conv.is_owned = false;
41983         int16_t ret_conv = UpdateFailMalformedHTLC_get_failure_code(&this_ptr_conv);
41984         return ret_conv;
41985 }
41986
41987 void  __attribute__((export_name("TS_UpdateFailMalformedHTLC_set_failure_code"))) TS_UpdateFailMalformedHTLC_set_failure_code(uint64_t this_ptr, int16_t val) {
41988         LDKUpdateFailMalformedHTLC this_ptr_conv;
41989         this_ptr_conv.inner = untag_ptr(this_ptr);
41990         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
41991         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
41992         this_ptr_conv.is_owned = false;
41993         UpdateFailMalformedHTLC_set_failure_code(&this_ptr_conv, val);
41994 }
41995
41996 static inline uint64_t UpdateFailMalformedHTLC_clone_ptr(LDKUpdateFailMalformedHTLC *NONNULL_PTR arg) {
41997         LDKUpdateFailMalformedHTLC ret_var = UpdateFailMalformedHTLC_clone(arg);
41998         uint64_t ret_ref = 0;
41999         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
42000         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
42001         return ret_ref;
42002 }
42003 int64_t  __attribute__((export_name("TS_UpdateFailMalformedHTLC_clone_ptr"))) TS_UpdateFailMalformedHTLC_clone_ptr(uint64_t arg) {
42004         LDKUpdateFailMalformedHTLC arg_conv;
42005         arg_conv.inner = untag_ptr(arg);
42006         arg_conv.is_owned = ptr_is_owned(arg);
42007         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
42008         arg_conv.is_owned = false;
42009         int64_t ret_conv = UpdateFailMalformedHTLC_clone_ptr(&arg_conv);
42010         return ret_conv;
42011 }
42012
42013 uint64_t  __attribute__((export_name("TS_UpdateFailMalformedHTLC_clone"))) TS_UpdateFailMalformedHTLC_clone(uint64_t orig) {
42014         LDKUpdateFailMalformedHTLC orig_conv;
42015         orig_conv.inner = untag_ptr(orig);
42016         orig_conv.is_owned = ptr_is_owned(orig);
42017         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
42018         orig_conv.is_owned = false;
42019         LDKUpdateFailMalformedHTLC ret_var = UpdateFailMalformedHTLC_clone(&orig_conv);
42020         uint64_t ret_ref = 0;
42021         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
42022         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
42023         return ret_ref;
42024 }
42025
42026 jboolean  __attribute__((export_name("TS_UpdateFailMalformedHTLC_eq"))) TS_UpdateFailMalformedHTLC_eq(uint64_t a, uint64_t b) {
42027         LDKUpdateFailMalformedHTLC a_conv;
42028         a_conv.inner = untag_ptr(a);
42029         a_conv.is_owned = ptr_is_owned(a);
42030         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
42031         a_conv.is_owned = false;
42032         LDKUpdateFailMalformedHTLC b_conv;
42033         b_conv.inner = untag_ptr(b);
42034         b_conv.is_owned = ptr_is_owned(b);
42035         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
42036         b_conv.is_owned = false;
42037         jboolean ret_conv = UpdateFailMalformedHTLC_eq(&a_conv, &b_conv);
42038         return ret_conv;
42039 }
42040
42041 void  __attribute__((export_name("TS_CommitmentSigned_free"))) TS_CommitmentSigned_free(uint64_t this_obj) {
42042         LDKCommitmentSigned this_obj_conv;
42043         this_obj_conv.inner = untag_ptr(this_obj);
42044         this_obj_conv.is_owned = ptr_is_owned(this_obj);
42045         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
42046         CommitmentSigned_free(this_obj_conv);
42047 }
42048
42049 int8_tArray  __attribute__((export_name("TS_CommitmentSigned_get_channel_id"))) TS_CommitmentSigned_get_channel_id(uint64_t this_ptr) {
42050         LDKCommitmentSigned this_ptr_conv;
42051         this_ptr_conv.inner = untag_ptr(this_ptr);
42052         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
42053         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
42054         this_ptr_conv.is_owned = false;
42055         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
42056         memcpy(ret_arr->elems, *CommitmentSigned_get_channel_id(&this_ptr_conv), 32);
42057         return ret_arr;
42058 }
42059
42060 void  __attribute__((export_name("TS_CommitmentSigned_set_channel_id"))) TS_CommitmentSigned_set_channel_id(uint64_t this_ptr, int8_tArray val) {
42061         LDKCommitmentSigned this_ptr_conv;
42062         this_ptr_conv.inner = untag_ptr(this_ptr);
42063         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
42064         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
42065         this_ptr_conv.is_owned = false;
42066         LDKThirtyTwoBytes val_ref;
42067         CHECK(val->arr_len == 32);
42068         memcpy(val_ref.data, val->elems, 32); FREE(val);
42069         CommitmentSigned_set_channel_id(&this_ptr_conv, val_ref);
42070 }
42071
42072 int8_tArray  __attribute__((export_name("TS_CommitmentSigned_get_signature"))) TS_CommitmentSigned_get_signature(uint64_t this_ptr) {
42073         LDKCommitmentSigned this_ptr_conv;
42074         this_ptr_conv.inner = untag_ptr(this_ptr);
42075         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
42076         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
42077         this_ptr_conv.is_owned = false;
42078         int8_tArray ret_arr = init_int8_tArray(64, __LINE__);
42079         memcpy(ret_arr->elems, CommitmentSigned_get_signature(&this_ptr_conv).compact_form, 64);
42080         return ret_arr;
42081 }
42082
42083 void  __attribute__((export_name("TS_CommitmentSigned_set_signature"))) TS_CommitmentSigned_set_signature(uint64_t this_ptr, int8_tArray val) {
42084         LDKCommitmentSigned this_ptr_conv;
42085         this_ptr_conv.inner = untag_ptr(this_ptr);
42086         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
42087         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
42088         this_ptr_conv.is_owned = false;
42089         LDKECDSASignature val_ref;
42090         CHECK(val->arr_len == 64);
42091         memcpy(val_ref.compact_form, val->elems, 64); FREE(val);
42092         CommitmentSigned_set_signature(&this_ptr_conv, val_ref);
42093 }
42094
42095 ptrArray  __attribute__((export_name("TS_CommitmentSigned_get_htlc_signatures"))) TS_CommitmentSigned_get_htlc_signatures(uint64_t this_ptr) {
42096         LDKCommitmentSigned this_ptr_conv;
42097         this_ptr_conv.inner = untag_ptr(this_ptr);
42098         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
42099         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
42100         this_ptr_conv.is_owned = false;
42101         LDKCVec_ECDSASignatureZ ret_var = CommitmentSigned_get_htlc_signatures(&this_ptr_conv);
42102         ptrArray ret_arr = NULL;
42103         ret_arr = init_ptrArray(ret_var.datalen, __LINE__);
42104         int8_tArray *ret_arr_ptr = (int8_tArray*)(((uint8_t*)ret_arr) + 8);
42105         for (size_t m = 0; m < ret_var.datalen; m++) {
42106                 int8_tArray ret_conv_12_arr = init_int8_tArray(64, __LINE__);
42107                 memcpy(ret_conv_12_arr->elems, ret_var.data[m].compact_form, 64);
42108                 ret_arr_ptr[m] = ret_conv_12_arr;
42109         }
42110         
42111         FREE(ret_var.data);
42112         return ret_arr;
42113 }
42114
42115 void  __attribute__((export_name("TS_CommitmentSigned_set_htlc_signatures"))) TS_CommitmentSigned_set_htlc_signatures(uint64_t this_ptr, ptrArray val) {
42116         LDKCommitmentSigned this_ptr_conv;
42117         this_ptr_conv.inner = untag_ptr(this_ptr);
42118         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
42119         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
42120         this_ptr_conv.is_owned = false;
42121         LDKCVec_ECDSASignatureZ val_constr;
42122         val_constr.datalen = val->arr_len;
42123         if (val_constr.datalen > 0)
42124                 val_constr.data = MALLOC(val_constr.datalen * sizeof(LDKECDSASignature), "LDKCVec_ECDSASignatureZ Elements");
42125         else
42126                 val_constr.data = NULL;
42127         int8_tArray* val_vals = (void*) val->elems;
42128         for (size_t m = 0; m < val_constr.datalen; m++) {
42129                 int8_tArray val_conv_12 = val_vals[m];
42130                 LDKECDSASignature val_conv_12_ref;
42131                 CHECK(val_conv_12->arr_len == 64);
42132                 memcpy(val_conv_12_ref.compact_form, val_conv_12->elems, 64); FREE(val_conv_12);
42133                 val_constr.data[m] = val_conv_12_ref;
42134         }
42135         FREE(val);
42136         CommitmentSigned_set_htlc_signatures(&this_ptr_conv, val_constr);
42137 }
42138
42139 uint64_t  __attribute__((export_name("TS_CommitmentSigned_new"))) TS_CommitmentSigned_new(int8_tArray channel_id_arg, int8_tArray signature_arg, ptrArray htlc_signatures_arg) {
42140         LDKThirtyTwoBytes channel_id_arg_ref;
42141         CHECK(channel_id_arg->arr_len == 32);
42142         memcpy(channel_id_arg_ref.data, channel_id_arg->elems, 32); FREE(channel_id_arg);
42143         LDKECDSASignature signature_arg_ref;
42144         CHECK(signature_arg->arr_len == 64);
42145         memcpy(signature_arg_ref.compact_form, signature_arg->elems, 64); FREE(signature_arg);
42146         LDKCVec_ECDSASignatureZ htlc_signatures_arg_constr;
42147         htlc_signatures_arg_constr.datalen = htlc_signatures_arg->arr_len;
42148         if (htlc_signatures_arg_constr.datalen > 0)
42149                 htlc_signatures_arg_constr.data = MALLOC(htlc_signatures_arg_constr.datalen * sizeof(LDKECDSASignature), "LDKCVec_ECDSASignatureZ Elements");
42150         else
42151                 htlc_signatures_arg_constr.data = NULL;
42152         int8_tArray* htlc_signatures_arg_vals = (void*) htlc_signatures_arg->elems;
42153         for (size_t m = 0; m < htlc_signatures_arg_constr.datalen; m++) {
42154                 int8_tArray htlc_signatures_arg_conv_12 = htlc_signatures_arg_vals[m];
42155                 LDKECDSASignature htlc_signatures_arg_conv_12_ref;
42156                 CHECK(htlc_signatures_arg_conv_12->arr_len == 64);
42157                 memcpy(htlc_signatures_arg_conv_12_ref.compact_form, htlc_signatures_arg_conv_12->elems, 64); FREE(htlc_signatures_arg_conv_12);
42158                 htlc_signatures_arg_constr.data[m] = htlc_signatures_arg_conv_12_ref;
42159         }
42160         FREE(htlc_signatures_arg);
42161         LDKCommitmentSigned ret_var = CommitmentSigned_new(channel_id_arg_ref, signature_arg_ref, htlc_signatures_arg_constr);
42162         uint64_t ret_ref = 0;
42163         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
42164         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
42165         return ret_ref;
42166 }
42167
42168 static inline uint64_t CommitmentSigned_clone_ptr(LDKCommitmentSigned *NONNULL_PTR arg) {
42169         LDKCommitmentSigned ret_var = CommitmentSigned_clone(arg);
42170         uint64_t ret_ref = 0;
42171         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
42172         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
42173         return ret_ref;
42174 }
42175 int64_t  __attribute__((export_name("TS_CommitmentSigned_clone_ptr"))) TS_CommitmentSigned_clone_ptr(uint64_t arg) {
42176         LDKCommitmentSigned arg_conv;
42177         arg_conv.inner = untag_ptr(arg);
42178         arg_conv.is_owned = ptr_is_owned(arg);
42179         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
42180         arg_conv.is_owned = false;
42181         int64_t ret_conv = CommitmentSigned_clone_ptr(&arg_conv);
42182         return ret_conv;
42183 }
42184
42185 uint64_t  __attribute__((export_name("TS_CommitmentSigned_clone"))) TS_CommitmentSigned_clone(uint64_t orig) {
42186         LDKCommitmentSigned orig_conv;
42187         orig_conv.inner = untag_ptr(orig);
42188         orig_conv.is_owned = ptr_is_owned(orig);
42189         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
42190         orig_conv.is_owned = false;
42191         LDKCommitmentSigned ret_var = CommitmentSigned_clone(&orig_conv);
42192         uint64_t ret_ref = 0;
42193         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
42194         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
42195         return ret_ref;
42196 }
42197
42198 jboolean  __attribute__((export_name("TS_CommitmentSigned_eq"))) TS_CommitmentSigned_eq(uint64_t a, uint64_t b) {
42199         LDKCommitmentSigned a_conv;
42200         a_conv.inner = untag_ptr(a);
42201         a_conv.is_owned = ptr_is_owned(a);
42202         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
42203         a_conv.is_owned = false;
42204         LDKCommitmentSigned b_conv;
42205         b_conv.inner = untag_ptr(b);
42206         b_conv.is_owned = ptr_is_owned(b);
42207         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
42208         b_conv.is_owned = false;
42209         jboolean ret_conv = CommitmentSigned_eq(&a_conv, &b_conv);
42210         return ret_conv;
42211 }
42212
42213 void  __attribute__((export_name("TS_RevokeAndACK_free"))) TS_RevokeAndACK_free(uint64_t this_obj) {
42214         LDKRevokeAndACK this_obj_conv;
42215         this_obj_conv.inner = untag_ptr(this_obj);
42216         this_obj_conv.is_owned = ptr_is_owned(this_obj);
42217         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
42218         RevokeAndACK_free(this_obj_conv);
42219 }
42220
42221 int8_tArray  __attribute__((export_name("TS_RevokeAndACK_get_channel_id"))) TS_RevokeAndACK_get_channel_id(uint64_t this_ptr) {
42222         LDKRevokeAndACK this_ptr_conv;
42223         this_ptr_conv.inner = untag_ptr(this_ptr);
42224         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
42225         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
42226         this_ptr_conv.is_owned = false;
42227         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
42228         memcpy(ret_arr->elems, *RevokeAndACK_get_channel_id(&this_ptr_conv), 32);
42229         return ret_arr;
42230 }
42231
42232 void  __attribute__((export_name("TS_RevokeAndACK_set_channel_id"))) TS_RevokeAndACK_set_channel_id(uint64_t this_ptr, int8_tArray val) {
42233         LDKRevokeAndACK this_ptr_conv;
42234         this_ptr_conv.inner = untag_ptr(this_ptr);
42235         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
42236         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
42237         this_ptr_conv.is_owned = false;
42238         LDKThirtyTwoBytes val_ref;
42239         CHECK(val->arr_len == 32);
42240         memcpy(val_ref.data, val->elems, 32); FREE(val);
42241         RevokeAndACK_set_channel_id(&this_ptr_conv, val_ref);
42242 }
42243
42244 int8_tArray  __attribute__((export_name("TS_RevokeAndACK_get_per_commitment_secret"))) TS_RevokeAndACK_get_per_commitment_secret(uint64_t this_ptr) {
42245         LDKRevokeAndACK this_ptr_conv;
42246         this_ptr_conv.inner = untag_ptr(this_ptr);
42247         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
42248         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
42249         this_ptr_conv.is_owned = false;
42250         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
42251         memcpy(ret_arr->elems, *RevokeAndACK_get_per_commitment_secret(&this_ptr_conv), 32);
42252         return ret_arr;
42253 }
42254
42255 void  __attribute__((export_name("TS_RevokeAndACK_set_per_commitment_secret"))) TS_RevokeAndACK_set_per_commitment_secret(uint64_t this_ptr, int8_tArray val) {
42256         LDKRevokeAndACK this_ptr_conv;
42257         this_ptr_conv.inner = untag_ptr(this_ptr);
42258         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
42259         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
42260         this_ptr_conv.is_owned = false;
42261         LDKThirtyTwoBytes val_ref;
42262         CHECK(val->arr_len == 32);
42263         memcpy(val_ref.data, val->elems, 32); FREE(val);
42264         RevokeAndACK_set_per_commitment_secret(&this_ptr_conv, val_ref);
42265 }
42266
42267 int8_tArray  __attribute__((export_name("TS_RevokeAndACK_get_next_per_commitment_point"))) TS_RevokeAndACK_get_next_per_commitment_point(uint64_t this_ptr) {
42268         LDKRevokeAndACK this_ptr_conv;
42269         this_ptr_conv.inner = untag_ptr(this_ptr);
42270         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
42271         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
42272         this_ptr_conv.is_owned = false;
42273         int8_tArray ret_arr = init_int8_tArray(33, __LINE__);
42274         memcpy(ret_arr->elems, RevokeAndACK_get_next_per_commitment_point(&this_ptr_conv).compressed_form, 33);
42275         return ret_arr;
42276 }
42277
42278 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) {
42279         LDKRevokeAndACK this_ptr_conv;
42280         this_ptr_conv.inner = untag_ptr(this_ptr);
42281         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
42282         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
42283         this_ptr_conv.is_owned = false;
42284         LDKPublicKey val_ref;
42285         CHECK(val->arr_len == 33);
42286         memcpy(val_ref.compressed_form, val->elems, 33); FREE(val);
42287         RevokeAndACK_set_next_per_commitment_point(&this_ptr_conv, val_ref);
42288 }
42289
42290 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) {
42291         LDKThirtyTwoBytes channel_id_arg_ref;
42292         CHECK(channel_id_arg->arr_len == 32);
42293         memcpy(channel_id_arg_ref.data, channel_id_arg->elems, 32); FREE(channel_id_arg);
42294         LDKThirtyTwoBytes per_commitment_secret_arg_ref;
42295         CHECK(per_commitment_secret_arg->arr_len == 32);
42296         memcpy(per_commitment_secret_arg_ref.data, per_commitment_secret_arg->elems, 32); FREE(per_commitment_secret_arg);
42297         LDKPublicKey next_per_commitment_point_arg_ref;
42298         CHECK(next_per_commitment_point_arg->arr_len == 33);
42299         memcpy(next_per_commitment_point_arg_ref.compressed_form, next_per_commitment_point_arg->elems, 33); FREE(next_per_commitment_point_arg);
42300         LDKRevokeAndACK ret_var = RevokeAndACK_new(channel_id_arg_ref, per_commitment_secret_arg_ref, next_per_commitment_point_arg_ref);
42301         uint64_t ret_ref = 0;
42302         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
42303         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
42304         return ret_ref;
42305 }
42306
42307 static inline uint64_t RevokeAndACK_clone_ptr(LDKRevokeAndACK *NONNULL_PTR arg) {
42308         LDKRevokeAndACK ret_var = RevokeAndACK_clone(arg);
42309         uint64_t ret_ref = 0;
42310         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
42311         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
42312         return ret_ref;
42313 }
42314 int64_t  __attribute__((export_name("TS_RevokeAndACK_clone_ptr"))) TS_RevokeAndACK_clone_ptr(uint64_t arg) {
42315         LDKRevokeAndACK arg_conv;
42316         arg_conv.inner = untag_ptr(arg);
42317         arg_conv.is_owned = ptr_is_owned(arg);
42318         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
42319         arg_conv.is_owned = false;
42320         int64_t ret_conv = RevokeAndACK_clone_ptr(&arg_conv);
42321         return ret_conv;
42322 }
42323
42324 uint64_t  __attribute__((export_name("TS_RevokeAndACK_clone"))) TS_RevokeAndACK_clone(uint64_t orig) {
42325         LDKRevokeAndACK orig_conv;
42326         orig_conv.inner = untag_ptr(orig);
42327         orig_conv.is_owned = ptr_is_owned(orig);
42328         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
42329         orig_conv.is_owned = false;
42330         LDKRevokeAndACK ret_var = RevokeAndACK_clone(&orig_conv);
42331         uint64_t ret_ref = 0;
42332         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
42333         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
42334         return ret_ref;
42335 }
42336
42337 jboolean  __attribute__((export_name("TS_RevokeAndACK_eq"))) TS_RevokeAndACK_eq(uint64_t a, uint64_t b) {
42338         LDKRevokeAndACK a_conv;
42339         a_conv.inner = untag_ptr(a);
42340         a_conv.is_owned = ptr_is_owned(a);
42341         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
42342         a_conv.is_owned = false;
42343         LDKRevokeAndACK b_conv;
42344         b_conv.inner = untag_ptr(b);
42345         b_conv.is_owned = ptr_is_owned(b);
42346         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
42347         b_conv.is_owned = false;
42348         jboolean ret_conv = RevokeAndACK_eq(&a_conv, &b_conv);
42349         return ret_conv;
42350 }
42351
42352 void  __attribute__((export_name("TS_UpdateFee_free"))) TS_UpdateFee_free(uint64_t this_obj) {
42353         LDKUpdateFee this_obj_conv;
42354         this_obj_conv.inner = untag_ptr(this_obj);
42355         this_obj_conv.is_owned = ptr_is_owned(this_obj);
42356         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
42357         UpdateFee_free(this_obj_conv);
42358 }
42359
42360 int8_tArray  __attribute__((export_name("TS_UpdateFee_get_channel_id"))) TS_UpdateFee_get_channel_id(uint64_t this_ptr) {
42361         LDKUpdateFee this_ptr_conv;
42362         this_ptr_conv.inner = untag_ptr(this_ptr);
42363         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
42364         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
42365         this_ptr_conv.is_owned = false;
42366         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
42367         memcpy(ret_arr->elems, *UpdateFee_get_channel_id(&this_ptr_conv), 32);
42368         return ret_arr;
42369 }
42370
42371 void  __attribute__((export_name("TS_UpdateFee_set_channel_id"))) TS_UpdateFee_set_channel_id(uint64_t this_ptr, int8_tArray val) {
42372         LDKUpdateFee this_ptr_conv;
42373         this_ptr_conv.inner = untag_ptr(this_ptr);
42374         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
42375         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
42376         this_ptr_conv.is_owned = false;
42377         LDKThirtyTwoBytes val_ref;
42378         CHECK(val->arr_len == 32);
42379         memcpy(val_ref.data, val->elems, 32); FREE(val);
42380         UpdateFee_set_channel_id(&this_ptr_conv, val_ref);
42381 }
42382
42383 int32_t  __attribute__((export_name("TS_UpdateFee_get_feerate_per_kw"))) TS_UpdateFee_get_feerate_per_kw(uint64_t this_ptr) {
42384         LDKUpdateFee this_ptr_conv;
42385         this_ptr_conv.inner = untag_ptr(this_ptr);
42386         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
42387         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
42388         this_ptr_conv.is_owned = false;
42389         int32_t ret_conv = UpdateFee_get_feerate_per_kw(&this_ptr_conv);
42390         return ret_conv;
42391 }
42392
42393 void  __attribute__((export_name("TS_UpdateFee_set_feerate_per_kw"))) TS_UpdateFee_set_feerate_per_kw(uint64_t this_ptr, int32_t val) {
42394         LDKUpdateFee this_ptr_conv;
42395         this_ptr_conv.inner = untag_ptr(this_ptr);
42396         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
42397         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
42398         this_ptr_conv.is_owned = false;
42399         UpdateFee_set_feerate_per_kw(&this_ptr_conv, val);
42400 }
42401
42402 uint64_t  __attribute__((export_name("TS_UpdateFee_new"))) TS_UpdateFee_new(int8_tArray channel_id_arg, int32_t feerate_per_kw_arg) {
42403         LDKThirtyTwoBytes channel_id_arg_ref;
42404         CHECK(channel_id_arg->arr_len == 32);
42405         memcpy(channel_id_arg_ref.data, channel_id_arg->elems, 32); FREE(channel_id_arg);
42406         LDKUpdateFee ret_var = UpdateFee_new(channel_id_arg_ref, feerate_per_kw_arg);
42407         uint64_t ret_ref = 0;
42408         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
42409         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
42410         return ret_ref;
42411 }
42412
42413 static inline uint64_t UpdateFee_clone_ptr(LDKUpdateFee *NONNULL_PTR arg) {
42414         LDKUpdateFee ret_var = UpdateFee_clone(arg);
42415         uint64_t ret_ref = 0;
42416         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
42417         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
42418         return ret_ref;
42419 }
42420 int64_t  __attribute__((export_name("TS_UpdateFee_clone_ptr"))) TS_UpdateFee_clone_ptr(uint64_t arg) {
42421         LDKUpdateFee arg_conv;
42422         arg_conv.inner = untag_ptr(arg);
42423         arg_conv.is_owned = ptr_is_owned(arg);
42424         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
42425         arg_conv.is_owned = false;
42426         int64_t ret_conv = UpdateFee_clone_ptr(&arg_conv);
42427         return ret_conv;
42428 }
42429
42430 uint64_t  __attribute__((export_name("TS_UpdateFee_clone"))) TS_UpdateFee_clone(uint64_t orig) {
42431         LDKUpdateFee orig_conv;
42432         orig_conv.inner = untag_ptr(orig);
42433         orig_conv.is_owned = ptr_is_owned(orig);
42434         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
42435         orig_conv.is_owned = false;
42436         LDKUpdateFee ret_var = UpdateFee_clone(&orig_conv);
42437         uint64_t ret_ref = 0;
42438         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
42439         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
42440         return ret_ref;
42441 }
42442
42443 jboolean  __attribute__((export_name("TS_UpdateFee_eq"))) TS_UpdateFee_eq(uint64_t a, uint64_t b) {
42444         LDKUpdateFee a_conv;
42445         a_conv.inner = untag_ptr(a);
42446         a_conv.is_owned = ptr_is_owned(a);
42447         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
42448         a_conv.is_owned = false;
42449         LDKUpdateFee b_conv;
42450         b_conv.inner = untag_ptr(b);
42451         b_conv.is_owned = ptr_is_owned(b);
42452         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
42453         b_conv.is_owned = false;
42454         jboolean ret_conv = UpdateFee_eq(&a_conv, &b_conv);
42455         return ret_conv;
42456 }
42457
42458 void  __attribute__((export_name("TS_ChannelReestablish_free"))) TS_ChannelReestablish_free(uint64_t this_obj) {
42459         LDKChannelReestablish this_obj_conv;
42460         this_obj_conv.inner = untag_ptr(this_obj);
42461         this_obj_conv.is_owned = ptr_is_owned(this_obj);
42462         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
42463         ChannelReestablish_free(this_obj_conv);
42464 }
42465
42466 int8_tArray  __attribute__((export_name("TS_ChannelReestablish_get_channel_id"))) TS_ChannelReestablish_get_channel_id(uint64_t this_ptr) {
42467         LDKChannelReestablish this_ptr_conv;
42468         this_ptr_conv.inner = untag_ptr(this_ptr);
42469         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
42470         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
42471         this_ptr_conv.is_owned = false;
42472         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
42473         memcpy(ret_arr->elems, *ChannelReestablish_get_channel_id(&this_ptr_conv), 32);
42474         return ret_arr;
42475 }
42476
42477 void  __attribute__((export_name("TS_ChannelReestablish_set_channel_id"))) TS_ChannelReestablish_set_channel_id(uint64_t this_ptr, int8_tArray val) {
42478         LDKChannelReestablish this_ptr_conv;
42479         this_ptr_conv.inner = untag_ptr(this_ptr);
42480         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
42481         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
42482         this_ptr_conv.is_owned = false;
42483         LDKThirtyTwoBytes val_ref;
42484         CHECK(val->arr_len == 32);
42485         memcpy(val_ref.data, val->elems, 32); FREE(val);
42486         ChannelReestablish_set_channel_id(&this_ptr_conv, val_ref);
42487 }
42488
42489 int64_t  __attribute__((export_name("TS_ChannelReestablish_get_next_local_commitment_number"))) TS_ChannelReestablish_get_next_local_commitment_number(uint64_t this_ptr) {
42490         LDKChannelReestablish this_ptr_conv;
42491         this_ptr_conv.inner = untag_ptr(this_ptr);
42492         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
42493         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
42494         this_ptr_conv.is_owned = false;
42495         int64_t ret_conv = ChannelReestablish_get_next_local_commitment_number(&this_ptr_conv);
42496         return ret_conv;
42497 }
42498
42499 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) {
42500         LDKChannelReestablish this_ptr_conv;
42501         this_ptr_conv.inner = untag_ptr(this_ptr);
42502         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
42503         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
42504         this_ptr_conv.is_owned = false;
42505         ChannelReestablish_set_next_local_commitment_number(&this_ptr_conv, val);
42506 }
42507
42508 int64_t  __attribute__((export_name("TS_ChannelReestablish_get_next_remote_commitment_number"))) TS_ChannelReestablish_get_next_remote_commitment_number(uint64_t this_ptr) {
42509         LDKChannelReestablish this_ptr_conv;
42510         this_ptr_conv.inner = untag_ptr(this_ptr);
42511         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
42512         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
42513         this_ptr_conv.is_owned = false;
42514         int64_t ret_conv = ChannelReestablish_get_next_remote_commitment_number(&this_ptr_conv);
42515         return ret_conv;
42516 }
42517
42518 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) {
42519         LDKChannelReestablish this_ptr_conv;
42520         this_ptr_conv.inner = untag_ptr(this_ptr);
42521         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
42522         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
42523         this_ptr_conv.is_owned = false;
42524         ChannelReestablish_set_next_remote_commitment_number(&this_ptr_conv, val);
42525 }
42526
42527 int8_tArray  __attribute__((export_name("TS_ChannelReestablish_get_your_last_per_commitment_secret"))) TS_ChannelReestablish_get_your_last_per_commitment_secret(uint64_t this_ptr) {
42528         LDKChannelReestablish this_ptr_conv;
42529         this_ptr_conv.inner = untag_ptr(this_ptr);
42530         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
42531         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
42532         this_ptr_conv.is_owned = false;
42533         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
42534         memcpy(ret_arr->elems, *ChannelReestablish_get_your_last_per_commitment_secret(&this_ptr_conv), 32);
42535         return ret_arr;
42536 }
42537
42538 void  __attribute__((export_name("TS_ChannelReestablish_set_your_last_per_commitment_secret"))) TS_ChannelReestablish_set_your_last_per_commitment_secret(uint64_t this_ptr, int8_tArray val) {
42539         LDKChannelReestablish this_ptr_conv;
42540         this_ptr_conv.inner = untag_ptr(this_ptr);
42541         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
42542         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
42543         this_ptr_conv.is_owned = false;
42544         LDKThirtyTwoBytes val_ref;
42545         CHECK(val->arr_len == 32);
42546         memcpy(val_ref.data, val->elems, 32); FREE(val);
42547         ChannelReestablish_set_your_last_per_commitment_secret(&this_ptr_conv, val_ref);
42548 }
42549
42550 int8_tArray  __attribute__((export_name("TS_ChannelReestablish_get_my_current_per_commitment_point"))) TS_ChannelReestablish_get_my_current_per_commitment_point(uint64_t this_ptr) {
42551         LDKChannelReestablish this_ptr_conv;
42552         this_ptr_conv.inner = untag_ptr(this_ptr);
42553         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
42554         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
42555         this_ptr_conv.is_owned = false;
42556         int8_tArray ret_arr = init_int8_tArray(33, __LINE__);
42557         memcpy(ret_arr->elems, ChannelReestablish_get_my_current_per_commitment_point(&this_ptr_conv).compressed_form, 33);
42558         return ret_arr;
42559 }
42560
42561 void  __attribute__((export_name("TS_ChannelReestablish_set_my_current_per_commitment_point"))) TS_ChannelReestablish_set_my_current_per_commitment_point(uint64_t this_ptr, int8_tArray val) {
42562         LDKChannelReestablish this_ptr_conv;
42563         this_ptr_conv.inner = untag_ptr(this_ptr);
42564         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
42565         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
42566         this_ptr_conv.is_owned = false;
42567         LDKPublicKey val_ref;
42568         CHECK(val->arr_len == 33);
42569         memcpy(val_ref.compressed_form, val->elems, 33); FREE(val);
42570         ChannelReestablish_set_my_current_per_commitment_point(&this_ptr_conv, val_ref);
42571 }
42572
42573 uint64_t  __attribute__((export_name("TS_ChannelReestablish_get_next_funding_txid"))) TS_ChannelReestablish_get_next_funding_txid(uint64_t this_ptr) {
42574         LDKChannelReestablish this_ptr_conv;
42575         this_ptr_conv.inner = untag_ptr(this_ptr);
42576         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
42577         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
42578         this_ptr_conv.is_owned = false;
42579         LDKCOption_ThirtyTwoBytesZ *ret_copy = MALLOC(sizeof(LDKCOption_ThirtyTwoBytesZ), "LDKCOption_ThirtyTwoBytesZ");
42580         *ret_copy = ChannelReestablish_get_next_funding_txid(&this_ptr_conv);
42581         uint64_t ret_ref = tag_ptr(ret_copy, true);
42582         return ret_ref;
42583 }
42584
42585 void  __attribute__((export_name("TS_ChannelReestablish_set_next_funding_txid"))) TS_ChannelReestablish_set_next_funding_txid(uint64_t this_ptr, uint64_t val) {
42586         LDKChannelReestablish this_ptr_conv;
42587         this_ptr_conv.inner = untag_ptr(this_ptr);
42588         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
42589         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
42590         this_ptr_conv.is_owned = false;
42591         void* val_ptr = untag_ptr(val);
42592         CHECK_ACCESS(val_ptr);
42593         LDKCOption_ThirtyTwoBytesZ val_conv = *(LDKCOption_ThirtyTwoBytesZ*)(val_ptr);
42594         val_conv = COption_ThirtyTwoBytesZ_clone((LDKCOption_ThirtyTwoBytesZ*)untag_ptr(val));
42595         ChannelReestablish_set_next_funding_txid(&this_ptr_conv, val_conv);
42596 }
42597
42598 uint64_t  __attribute__((export_name("TS_ChannelReestablish_new"))) TS_ChannelReestablish_new(int8_tArray channel_id_arg, int64_t next_local_commitment_number_arg, int64_t next_remote_commitment_number_arg, int8_tArray your_last_per_commitment_secret_arg, int8_tArray my_current_per_commitment_point_arg, uint64_t next_funding_txid_arg) {
42599         LDKThirtyTwoBytes channel_id_arg_ref;
42600         CHECK(channel_id_arg->arr_len == 32);
42601         memcpy(channel_id_arg_ref.data, channel_id_arg->elems, 32); FREE(channel_id_arg);
42602         LDKThirtyTwoBytes your_last_per_commitment_secret_arg_ref;
42603         CHECK(your_last_per_commitment_secret_arg->arr_len == 32);
42604         memcpy(your_last_per_commitment_secret_arg_ref.data, your_last_per_commitment_secret_arg->elems, 32); FREE(your_last_per_commitment_secret_arg);
42605         LDKPublicKey my_current_per_commitment_point_arg_ref;
42606         CHECK(my_current_per_commitment_point_arg->arr_len == 33);
42607         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);
42608         void* next_funding_txid_arg_ptr = untag_ptr(next_funding_txid_arg);
42609         CHECK_ACCESS(next_funding_txid_arg_ptr);
42610         LDKCOption_ThirtyTwoBytesZ next_funding_txid_arg_conv = *(LDKCOption_ThirtyTwoBytesZ*)(next_funding_txid_arg_ptr);
42611         next_funding_txid_arg_conv = COption_ThirtyTwoBytesZ_clone((LDKCOption_ThirtyTwoBytesZ*)untag_ptr(next_funding_txid_arg));
42612         LDKChannelReestablish ret_var = ChannelReestablish_new(channel_id_arg_ref, next_local_commitment_number_arg, next_remote_commitment_number_arg, your_last_per_commitment_secret_arg_ref, my_current_per_commitment_point_arg_ref, next_funding_txid_arg_conv);
42613         uint64_t ret_ref = 0;
42614         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
42615         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
42616         return ret_ref;
42617 }
42618
42619 static inline uint64_t ChannelReestablish_clone_ptr(LDKChannelReestablish *NONNULL_PTR arg) {
42620         LDKChannelReestablish ret_var = ChannelReestablish_clone(arg);
42621         uint64_t ret_ref = 0;
42622         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
42623         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
42624         return ret_ref;
42625 }
42626 int64_t  __attribute__((export_name("TS_ChannelReestablish_clone_ptr"))) TS_ChannelReestablish_clone_ptr(uint64_t arg) {
42627         LDKChannelReestablish arg_conv;
42628         arg_conv.inner = untag_ptr(arg);
42629         arg_conv.is_owned = ptr_is_owned(arg);
42630         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
42631         arg_conv.is_owned = false;
42632         int64_t ret_conv = ChannelReestablish_clone_ptr(&arg_conv);
42633         return ret_conv;
42634 }
42635
42636 uint64_t  __attribute__((export_name("TS_ChannelReestablish_clone"))) TS_ChannelReestablish_clone(uint64_t orig) {
42637         LDKChannelReestablish orig_conv;
42638         orig_conv.inner = untag_ptr(orig);
42639         orig_conv.is_owned = ptr_is_owned(orig);
42640         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
42641         orig_conv.is_owned = false;
42642         LDKChannelReestablish ret_var = ChannelReestablish_clone(&orig_conv);
42643         uint64_t ret_ref = 0;
42644         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
42645         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
42646         return ret_ref;
42647 }
42648
42649 jboolean  __attribute__((export_name("TS_ChannelReestablish_eq"))) TS_ChannelReestablish_eq(uint64_t a, uint64_t b) {
42650         LDKChannelReestablish a_conv;
42651         a_conv.inner = untag_ptr(a);
42652         a_conv.is_owned = ptr_is_owned(a);
42653         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
42654         a_conv.is_owned = false;
42655         LDKChannelReestablish b_conv;
42656         b_conv.inner = untag_ptr(b);
42657         b_conv.is_owned = ptr_is_owned(b);
42658         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
42659         b_conv.is_owned = false;
42660         jboolean ret_conv = ChannelReestablish_eq(&a_conv, &b_conv);
42661         return ret_conv;
42662 }
42663
42664 void  __attribute__((export_name("TS_AnnouncementSignatures_free"))) TS_AnnouncementSignatures_free(uint64_t this_obj) {
42665         LDKAnnouncementSignatures this_obj_conv;
42666         this_obj_conv.inner = untag_ptr(this_obj);
42667         this_obj_conv.is_owned = ptr_is_owned(this_obj);
42668         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
42669         AnnouncementSignatures_free(this_obj_conv);
42670 }
42671
42672 int8_tArray  __attribute__((export_name("TS_AnnouncementSignatures_get_channel_id"))) TS_AnnouncementSignatures_get_channel_id(uint64_t this_ptr) {
42673         LDKAnnouncementSignatures this_ptr_conv;
42674         this_ptr_conv.inner = untag_ptr(this_ptr);
42675         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
42676         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
42677         this_ptr_conv.is_owned = false;
42678         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
42679         memcpy(ret_arr->elems, *AnnouncementSignatures_get_channel_id(&this_ptr_conv), 32);
42680         return ret_arr;
42681 }
42682
42683 void  __attribute__((export_name("TS_AnnouncementSignatures_set_channel_id"))) TS_AnnouncementSignatures_set_channel_id(uint64_t this_ptr, int8_tArray val) {
42684         LDKAnnouncementSignatures this_ptr_conv;
42685         this_ptr_conv.inner = untag_ptr(this_ptr);
42686         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
42687         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
42688         this_ptr_conv.is_owned = false;
42689         LDKThirtyTwoBytes val_ref;
42690         CHECK(val->arr_len == 32);
42691         memcpy(val_ref.data, val->elems, 32); FREE(val);
42692         AnnouncementSignatures_set_channel_id(&this_ptr_conv, val_ref);
42693 }
42694
42695 int64_t  __attribute__((export_name("TS_AnnouncementSignatures_get_short_channel_id"))) TS_AnnouncementSignatures_get_short_channel_id(uint64_t this_ptr) {
42696         LDKAnnouncementSignatures this_ptr_conv;
42697         this_ptr_conv.inner = untag_ptr(this_ptr);
42698         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
42699         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
42700         this_ptr_conv.is_owned = false;
42701         int64_t ret_conv = AnnouncementSignatures_get_short_channel_id(&this_ptr_conv);
42702         return ret_conv;
42703 }
42704
42705 void  __attribute__((export_name("TS_AnnouncementSignatures_set_short_channel_id"))) TS_AnnouncementSignatures_set_short_channel_id(uint64_t this_ptr, int64_t val) {
42706         LDKAnnouncementSignatures this_ptr_conv;
42707         this_ptr_conv.inner = untag_ptr(this_ptr);
42708         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
42709         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
42710         this_ptr_conv.is_owned = false;
42711         AnnouncementSignatures_set_short_channel_id(&this_ptr_conv, val);
42712 }
42713
42714 int8_tArray  __attribute__((export_name("TS_AnnouncementSignatures_get_node_signature"))) TS_AnnouncementSignatures_get_node_signature(uint64_t this_ptr) {
42715         LDKAnnouncementSignatures this_ptr_conv;
42716         this_ptr_conv.inner = untag_ptr(this_ptr);
42717         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
42718         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
42719         this_ptr_conv.is_owned = false;
42720         int8_tArray ret_arr = init_int8_tArray(64, __LINE__);
42721         memcpy(ret_arr->elems, AnnouncementSignatures_get_node_signature(&this_ptr_conv).compact_form, 64);
42722         return ret_arr;
42723 }
42724
42725 void  __attribute__((export_name("TS_AnnouncementSignatures_set_node_signature"))) TS_AnnouncementSignatures_set_node_signature(uint64_t this_ptr, int8_tArray val) {
42726         LDKAnnouncementSignatures this_ptr_conv;
42727         this_ptr_conv.inner = untag_ptr(this_ptr);
42728         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
42729         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
42730         this_ptr_conv.is_owned = false;
42731         LDKECDSASignature val_ref;
42732         CHECK(val->arr_len == 64);
42733         memcpy(val_ref.compact_form, val->elems, 64); FREE(val);
42734         AnnouncementSignatures_set_node_signature(&this_ptr_conv, val_ref);
42735 }
42736
42737 int8_tArray  __attribute__((export_name("TS_AnnouncementSignatures_get_bitcoin_signature"))) TS_AnnouncementSignatures_get_bitcoin_signature(uint64_t this_ptr) {
42738         LDKAnnouncementSignatures this_ptr_conv;
42739         this_ptr_conv.inner = untag_ptr(this_ptr);
42740         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
42741         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
42742         this_ptr_conv.is_owned = false;
42743         int8_tArray ret_arr = init_int8_tArray(64, __LINE__);
42744         memcpy(ret_arr->elems, AnnouncementSignatures_get_bitcoin_signature(&this_ptr_conv).compact_form, 64);
42745         return ret_arr;
42746 }
42747
42748 void  __attribute__((export_name("TS_AnnouncementSignatures_set_bitcoin_signature"))) TS_AnnouncementSignatures_set_bitcoin_signature(uint64_t this_ptr, int8_tArray val) {
42749         LDKAnnouncementSignatures this_ptr_conv;
42750         this_ptr_conv.inner = untag_ptr(this_ptr);
42751         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
42752         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
42753         this_ptr_conv.is_owned = false;
42754         LDKECDSASignature val_ref;
42755         CHECK(val->arr_len == 64);
42756         memcpy(val_ref.compact_form, val->elems, 64); FREE(val);
42757         AnnouncementSignatures_set_bitcoin_signature(&this_ptr_conv, val_ref);
42758 }
42759
42760 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) {
42761         LDKThirtyTwoBytes channel_id_arg_ref;
42762         CHECK(channel_id_arg->arr_len == 32);
42763         memcpy(channel_id_arg_ref.data, channel_id_arg->elems, 32); FREE(channel_id_arg);
42764         LDKECDSASignature node_signature_arg_ref;
42765         CHECK(node_signature_arg->arr_len == 64);
42766         memcpy(node_signature_arg_ref.compact_form, node_signature_arg->elems, 64); FREE(node_signature_arg);
42767         LDKECDSASignature bitcoin_signature_arg_ref;
42768         CHECK(bitcoin_signature_arg->arr_len == 64);
42769         memcpy(bitcoin_signature_arg_ref.compact_form, bitcoin_signature_arg->elems, 64); FREE(bitcoin_signature_arg);
42770         LDKAnnouncementSignatures ret_var = AnnouncementSignatures_new(channel_id_arg_ref, short_channel_id_arg, node_signature_arg_ref, bitcoin_signature_arg_ref);
42771         uint64_t ret_ref = 0;
42772         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
42773         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
42774         return ret_ref;
42775 }
42776
42777 static inline uint64_t AnnouncementSignatures_clone_ptr(LDKAnnouncementSignatures *NONNULL_PTR arg) {
42778         LDKAnnouncementSignatures ret_var = AnnouncementSignatures_clone(arg);
42779         uint64_t ret_ref = 0;
42780         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
42781         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
42782         return ret_ref;
42783 }
42784 int64_t  __attribute__((export_name("TS_AnnouncementSignatures_clone_ptr"))) TS_AnnouncementSignatures_clone_ptr(uint64_t arg) {
42785         LDKAnnouncementSignatures arg_conv;
42786         arg_conv.inner = untag_ptr(arg);
42787         arg_conv.is_owned = ptr_is_owned(arg);
42788         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
42789         arg_conv.is_owned = false;
42790         int64_t ret_conv = AnnouncementSignatures_clone_ptr(&arg_conv);
42791         return ret_conv;
42792 }
42793
42794 uint64_t  __attribute__((export_name("TS_AnnouncementSignatures_clone"))) TS_AnnouncementSignatures_clone(uint64_t orig) {
42795         LDKAnnouncementSignatures orig_conv;
42796         orig_conv.inner = untag_ptr(orig);
42797         orig_conv.is_owned = ptr_is_owned(orig);
42798         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
42799         orig_conv.is_owned = false;
42800         LDKAnnouncementSignatures ret_var = AnnouncementSignatures_clone(&orig_conv);
42801         uint64_t ret_ref = 0;
42802         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
42803         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
42804         return ret_ref;
42805 }
42806
42807 jboolean  __attribute__((export_name("TS_AnnouncementSignatures_eq"))) TS_AnnouncementSignatures_eq(uint64_t a, uint64_t b) {
42808         LDKAnnouncementSignatures a_conv;
42809         a_conv.inner = untag_ptr(a);
42810         a_conv.is_owned = ptr_is_owned(a);
42811         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
42812         a_conv.is_owned = false;
42813         LDKAnnouncementSignatures b_conv;
42814         b_conv.inner = untag_ptr(b);
42815         b_conv.is_owned = ptr_is_owned(b);
42816         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
42817         b_conv.is_owned = false;
42818         jboolean ret_conv = AnnouncementSignatures_eq(&a_conv, &b_conv);
42819         return ret_conv;
42820 }
42821
42822 void  __attribute__((export_name("TS_SocketAddress_free"))) TS_SocketAddress_free(uint64_t this_ptr) {
42823         if (!ptr_is_owned(this_ptr)) return;
42824         void* this_ptr_ptr = untag_ptr(this_ptr);
42825         CHECK_ACCESS(this_ptr_ptr);
42826         LDKSocketAddress this_ptr_conv = *(LDKSocketAddress*)(this_ptr_ptr);
42827         FREE(untag_ptr(this_ptr));
42828         SocketAddress_free(this_ptr_conv);
42829 }
42830
42831 static inline uint64_t SocketAddress_clone_ptr(LDKSocketAddress *NONNULL_PTR arg) {
42832         LDKSocketAddress *ret_copy = MALLOC(sizeof(LDKSocketAddress), "LDKSocketAddress");
42833         *ret_copy = SocketAddress_clone(arg);
42834         uint64_t ret_ref = tag_ptr(ret_copy, true);
42835         return ret_ref;
42836 }
42837 int64_t  __attribute__((export_name("TS_SocketAddress_clone_ptr"))) TS_SocketAddress_clone_ptr(uint64_t arg) {
42838         LDKSocketAddress* arg_conv = (LDKSocketAddress*)untag_ptr(arg);
42839         int64_t ret_conv = SocketAddress_clone_ptr(arg_conv);
42840         return ret_conv;
42841 }
42842
42843 uint64_t  __attribute__((export_name("TS_SocketAddress_clone"))) TS_SocketAddress_clone(uint64_t orig) {
42844         LDKSocketAddress* orig_conv = (LDKSocketAddress*)untag_ptr(orig);
42845         LDKSocketAddress *ret_copy = MALLOC(sizeof(LDKSocketAddress), "LDKSocketAddress");
42846         *ret_copy = SocketAddress_clone(orig_conv);
42847         uint64_t ret_ref = tag_ptr(ret_copy, true);
42848         return ret_ref;
42849 }
42850
42851 uint64_t  __attribute__((export_name("TS_SocketAddress_tcp_ip_v4"))) TS_SocketAddress_tcp_ip_v4(int8_tArray addr, int16_t port) {
42852         LDKFourBytes addr_ref;
42853         CHECK(addr->arr_len == 4);
42854         memcpy(addr_ref.data, addr->elems, 4); FREE(addr);
42855         LDKSocketAddress *ret_copy = MALLOC(sizeof(LDKSocketAddress), "LDKSocketAddress");
42856         *ret_copy = SocketAddress_tcp_ip_v4(addr_ref, port);
42857         uint64_t ret_ref = tag_ptr(ret_copy, true);
42858         return ret_ref;
42859 }
42860
42861 uint64_t  __attribute__((export_name("TS_SocketAddress_tcp_ip_v6"))) TS_SocketAddress_tcp_ip_v6(int8_tArray addr, int16_t port) {
42862         LDKSixteenBytes addr_ref;
42863         CHECK(addr->arr_len == 16);
42864         memcpy(addr_ref.data, addr->elems, 16); FREE(addr);
42865         LDKSocketAddress *ret_copy = MALLOC(sizeof(LDKSocketAddress), "LDKSocketAddress");
42866         *ret_copy = SocketAddress_tcp_ip_v6(addr_ref, port);
42867         uint64_t ret_ref = tag_ptr(ret_copy, true);
42868         return ret_ref;
42869 }
42870
42871 uint64_t  __attribute__((export_name("TS_SocketAddress_onion_v2"))) TS_SocketAddress_onion_v2(int8_tArray a) {
42872         LDKTwelveBytes a_ref;
42873         CHECK(a->arr_len == 12);
42874         memcpy(a_ref.data, a->elems, 12); FREE(a);
42875         LDKSocketAddress *ret_copy = MALLOC(sizeof(LDKSocketAddress), "LDKSocketAddress");
42876         *ret_copy = SocketAddress_onion_v2(a_ref);
42877         uint64_t ret_ref = tag_ptr(ret_copy, true);
42878         return ret_ref;
42879 }
42880
42881 uint64_t  __attribute__((export_name("TS_SocketAddress_onion_v3"))) TS_SocketAddress_onion_v3(int8_tArray ed25519_pubkey, int16_t checksum, int8_t version, int16_t port) {
42882         LDKThirtyTwoBytes ed25519_pubkey_ref;
42883         CHECK(ed25519_pubkey->arr_len == 32);
42884         memcpy(ed25519_pubkey_ref.data, ed25519_pubkey->elems, 32); FREE(ed25519_pubkey);
42885         LDKSocketAddress *ret_copy = MALLOC(sizeof(LDKSocketAddress), "LDKSocketAddress");
42886         *ret_copy = SocketAddress_onion_v3(ed25519_pubkey_ref, checksum, version, port);
42887         uint64_t ret_ref = tag_ptr(ret_copy, true);
42888         return ret_ref;
42889 }
42890
42891 uint64_t  __attribute__((export_name("TS_SocketAddress_hostname"))) TS_SocketAddress_hostname(uint64_t hostname, int16_t port) {
42892         LDKHostname hostname_conv;
42893         hostname_conv.inner = untag_ptr(hostname);
42894         hostname_conv.is_owned = ptr_is_owned(hostname);
42895         CHECK_INNER_FIELD_ACCESS_OR_NULL(hostname_conv);
42896         hostname_conv = Hostname_clone(&hostname_conv);
42897         LDKSocketAddress *ret_copy = MALLOC(sizeof(LDKSocketAddress), "LDKSocketAddress");
42898         *ret_copy = SocketAddress_hostname(hostname_conv, port);
42899         uint64_t ret_ref = tag_ptr(ret_copy, true);
42900         return ret_ref;
42901 }
42902
42903 jboolean  __attribute__((export_name("TS_SocketAddress_eq"))) TS_SocketAddress_eq(uint64_t a, uint64_t b) {
42904         LDKSocketAddress* a_conv = (LDKSocketAddress*)untag_ptr(a);
42905         LDKSocketAddress* b_conv = (LDKSocketAddress*)untag_ptr(b);
42906         jboolean ret_conv = SocketAddress_eq(a_conv, b_conv);
42907         return ret_conv;
42908 }
42909
42910 int8_tArray  __attribute__((export_name("TS_SocketAddress_write"))) TS_SocketAddress_write(uint64_t obj) {
42911         LDKSocketAddress* obj_conv = (LDKSocketAddress*)untag_ptr(obj);
42912         LDKCVec_u8Z ret_var = SocketAddress_write(obj_conv);
42913         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
42914         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
42915         CVec_u8Z_free(ret_var);
42916         return ret_arr;
42917 }
42918
42919 uint64_t  __attribute__((export_name("TS_SocketAddress_read"))) TS_SocketAddress_read(int8_tArray ser) {
42920         LDKu8slice ser_ref;
42921         ser_ref.datalen = ser->arr_len;
42922         ser_ref.data = ser->elems;
42923         LDKCResult_SocketAddressDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_SocketAddressDecodeErrorZ), "LDKCResult_SocketAddressDecodeErrorZ");
42924         *ret_conv = SocketAddress_read(ser_ref);
42925         FREE(ser);
42926         return tag_ptr(ret_conv, true);
42927 }
42928
42929 uint32_t  __attribute__((export_name("TS_SocketAddressParseError_clone"))) TS_SocketAddressParseError_clone(uint64_t orig) {
42930         LDKSocketAddressParseError* orig_conv = (LDKSocketAddressParseError*)untag_ptr(orig);
42931         uint32_t ret_conv = LDKSocketAddressParseError_to_js(SocketAddressParseError_clone(orig_conv));
42932         return ret_conv;
42933 }
42934
42935 uint32_t  __attribute__((export_name("TS_SocketAddressParseError_socket_addr_parse"))) TS_SocketAddressParseError_socket_addr_parse() {
42936         uint32_t ret_conv = LDKSocketAddressParseError_to_js(SocketAddressParseError_socket_addr_parse());
42937         return ret_conv;
42938 }
42939
42940 uint32_t  __attribute__((export_name("TS_SocketAddressParseError_invalid_input"))) TS_SocketAddressParseError_invalid_input() {
42941         uint32_t ret_conv = LDKSocketAddressParseError_to_js(SocketAddressParseError_invalid_input());
42942         return ret_conv;
42943 }
42944
42945 uint32_t  __attribute__((export_name("TS_SocketAddressParseError_invalid_port"))) TS_SocketAddressParseError_invalid_port() {
42946         uint32_t ret_conv = LDKSocketAddressParseError_to_js(SocketAddressParseError_invalid_port());
42947         return ret_conv;
42948 }
42949
42950 uint32_t  __attribute__((export_name("TS_SocketAddressParseError_invalid_onion_v3"))) TS_SocketAddressParseError_invalid_onion_v3() {
42951         uint32_t ret_conv = LDKSocketAddressParseError_to_js(SocketAddressParseError_invalid_onion_v3());
42952         return ret_conv;
42953 }
42954
42955 jboolean  __attribute__((export_name("TS_SocketAddressParseError_eq"))) TS_SocketAddressParseError_eq(uint64_t a, uint64_t b) {
42956         LDKSocketAddressParseError* a_conv = (LDKSocketAddressParseError*)untag_ptr(a);
42957         LDKSocketAddressParseError* b_conv = (LDKSocketAddressParseError*)untag_ptr(b);
42958         jboolean ret_conv = SocketAddressParseError_eq(a_conv, b_conv);
42959         return ret_conv;
42960 }
42961
42962 uint64_t  __attribute__((export_name("TS_parse_onion_address"))) TS_parse_onion_address(jstring host, int16_t port) {
42963         LDKStr host_conv = str_ref_to_owned_c(host);
42964         LDKCResult_SocketAddressSocketAddressParseErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_SocketAddressSocketAddressParseErrorZ), "LDKCResult_SocketAddressSocketAddressParseErrorZ");
42965         *ret_conv = parse_onion_address(host_conv, port);
42966         return tag_ptr(ret_conv, true);
42967 }
42968
42969 jstring  __attribute__((export_name("TS_SocketAddress_to_str"))) TS_SocketAddress_to_str(uint64_t o) {
42970         LDKSocketAddress* o_conv = (LDKSocketAddress*)untag_ptr(o);
42971         LDKStr ret_str = SocketAddress_to_str(o_conv);
42972         jstring ret_conv = str_ref_to_ts(ret_str.chars, ret_str.len);
42973         Str_free(ret_str);
42974         return ret_conv;
42975 }
42976
42977 void  __attribute__((export_name("TS_UnsignedGossipMessage_free"))) TS_UnsignedGossipMessage_free(uint64_t this_ptr) {
42978         if (!ptr_is_owned(this_ptr)) return;
42979         void* this_ptr_ptr = untag_ptr(this_ptr);
42980         CHECK_ACCESS(this_ptr_ptr);
42981         LDKUnsignedGossipMessage this_ptr_conv = *(LDKUnsignedGossipMessage*)(this_ptr_ptr);
42982         FREE(untag_ptr(this_ptr));
42983         UnsignedGossipMessage_free(this_ptr_conv);
42984 }
42985
42986 static inline uint64_t UnsignedGossipMessage_clone_ptr(LDKUnsignedGossipMessage *NONNULL_PTR arg) {
42987         LDKUnsignedGossipMessage *ret_copy = MALLOC(sizeof(LDKUnsignedGossipMessage), "LDKUnsignedGossipMessage");
42988         *ret_copy = UnsignedGossipMessage_clone(arg);
42989         uint64_t ret_ref = tag_ptr(ret_copy, true);
42990         return ret_ref;
42991 }
42992 int64_t  __attribute__((export_name("TS_UnsignedGossipMessage_clone_ptr"))) TS_UnsignedGossipMessage_clone_ptr(uint64_t arg) {
42993         LDKUnsignedGossipMessage* arg_conv = (LDKUnsignedGossipMessage*)untag_ptr(arg);
42994         int64_t ret_conv = UnsignedGossipMessage_clone_ptr(arg_conv);
42995         return ret_conv;
42996 }
42997
42998 uint64_t  __attribute__((export_name("TS_UnsignedGossipMessage_clone"))) TS_UnsignedGossipMessage_clone(uint64_t orig) {
42999         LDKUnsignedGossipMessage* orig_conv = (LDKUnsignedGossipMessage*)untag_ptr(orig);
43000         LDKUnsignedGossipMessage *ret_copy = MALLOC(sizeof(LDKUnsignedGossipMessage), "LDKUnsignedGossipMessage");
43001         *ret_copy = UnsignedGossipMessage_clone(orig_conv);
43002         uint64_t ret_ref = tag_ptr(ret_copy, true);
43003         return ret_ref;
43004 }
43005
43006 uint64_t  __attribute__((export_name("TS_UnsignedGossipMessage_channel_announcement"))) TS_UnsignedGossipMessage_channel_announcement(uint64_t a) {
43007         LDKUnsignedChannelAnnouncement a_conv;
43008         a_conv.inner = untag_ptr(a);
43009         a_conv.is_owned = ptr_is_owned(a);
43010         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
43011         a_conv = UnsignedChannelAnnouncement_clone(&a_conv);
43012         LDKUnsignedGossipMessage *ret_copy = MALLOC(sizeof(LDKUnsignedGossipMessage), "LDKUnsignedGossipMessage");
43013         *ret_copy = UnsignedGossipMessage_channel_announcement(a_conv);
43014         uint64_t ret_ref = tag_ptr(ret_copy, true);
43015         return ret_ref;
43016 }
43017
43018 uint64_t  __attribute__((export_name("TS_UnsignedGossipMessage_channel_update"))) TS_UnsignedGossipMessage_channel_update(uint64_t a) {
43019         LDKUnsignedChannelUpdate a_conv;
43020         a_conv.inner = untag_ptr(a);
43021         a_conv.is_owned = ptr_is_owned(a);
43022         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
43023         a_conv = UnsignedChannelUpdate_clone(&a_conv);
43024         LDKUnsignedGossipMessage *ret_copy = MALLOC(sizeof(LDKUnsignedGossipMessage), "LDKUnsignedGossipMessage");
43025         *ret_copy = UnsignedGossipMessage_channel_update(a_conv);
43026         uint64_t ret_ref = tag_ptr(ret_copy, true);
43027         return ret_ref;
43028 }
43029
43030 uint64_t  __attribute__((export_name("TS_UnsignedGossipMessage_node_announcement"))) TS_UnsignedGossipMessage_node_announcement(uint64_t a) {
43031         LDKUnsignedNodeAnnouncement a_conv;
43032         a_conv.inner = untag_ptr(a);
43033         a_conv.is_owned = ptr_is_owned(a);
43034         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
43035         a_conv = UnsignedNodeAnnouncement_clone(&a_conv);
43036         LDKUnsignedGossipMessage *ret_copy = MALLOC(sizeof(LDKUnsignedGossipMessage), "LDKUnsignedGossipMessage");
43037         *ret_copy = UnsignedGossipMessage_node_announcement(a_conv);
43038         uint64_t ret_ref = tag_ptr(ret_copy, true);
43039         return ret_ref;
43040 }
43041
43042 int8_tArray  __attribute__((export_name("TS_UnsignedGossipMessage_write"))) TS_UnsignedGossipMessage_write(uint64_t obj) {
43043         LDKUnsignedGossipMessage* obj_conv = (LDKUnsignedGossipMessage*)untag_ptr(obj);
43044         LDKCVec_u8Z ret_var = UnsignedGossipMessage_write(obj_conv);
43045         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
43046         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
43047         CVec_u8Z_free(ret_var);
43048         return ret_arr;
43049 }
43050
43051 void  __attribute__((export_name("TS_UnsignedNodeAnnouncement_free"))) TS_UnsignedNodeAnnouncement_free(uint64_t this_obj) {
43052         LDKUnsignedNodeAnnouncement this_obj_conv;
43053         this_obj_conv.inner = untag_ptr(this_obj);
43054         this_obj_conv.is_owned = ptr_is_owned(this_obj);
43055         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
43056         UnsignedNodeAnnouncement_free(this_obj_conv);
43057 }
43058
43059 uint64_t  __attribute__((export_name("TS_UnsignedNodeAnnouncement_get_features"))) TS_UnsignedNodeAnnouncement_get_features(uint64_t this_ptr) {
43060         LDKUnsignedNodeAnnouncement this_ptr_conv;
43061         this_ptr_conv.inner = untag_ptr(this_ptr);
43062         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
43063         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
43064         this_ptr_conv.is_owned = false;
43065         LDKNodeFeatures ret_var = UnsignedNodeAnnouncement_get_features(&this_ptr_conv);
43066         uint64_t ret_ref = 0;
43067         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
43068         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
43069         return ret_ref;
43070 }
43071
43072 void  __attribute__((export_name("TS_UnsignedNodeAnnouncement_set_features"))) TS_UnsignedNodeAnnouncement_set_features(uint64_t this_ptr, uint64_t val) {
43073         LDKUnsignedNodeAnnouncement this_ptr_conv;
43074         this_ptr_conv.inner = untag_ptr(this_ptr);
43075         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
43076         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
43077         this_ptr_conv.is_owned = false;
43078         LDKNodeFeatures val_conv;
43079         val_conv.inner = untag_ptr(val);
43080         val_conv.is_owned = ptr_is_owned(val);
43081         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
43082         val_conv = NodeFeatures_clone(&val_conv);
43083         UnsignedNodeAnnouncement_set_features(&this_ptr_conv, val_conv);
43084 }
43085
43086 int32_t  __attribute__((export_name("TS_UnsignedNodeAnnouncement_get_timestamp"))) TS_UnsignedNodeAnnouncement_get_timestamp(uint64_t this_ptr) {
43087         LDKUnsignedNodeAnnouncement this_ptr_conv;
43088         this_ptr_conv.inner = untag_ptr(this_ptr);
43089         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
43090         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
43091         this_ptr_conv.is_owned = false;
43092         int32_t ret_conv = UnsignedNodeAnnouncement_get_timestamp(&this_ptr_conv);
43093         return ret_conv;
43094 }
43095
43096 void  __attribute__((export_name("TS_UnsignedNodeAnnouncement_set_timestamp"))) TS_UnsignedNodeAnnouncement_set_timestamp(uint64_t this_ptr, int32_t val) {
43097         LDKUnsignedNodeAnnouncement this_ptr_conv;
43098         this_ptr_conv.inner = untag_ptr(this_ptr);
43099         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
43100         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
43101         this_ptr_conv.is_owned = false;
43102         UnsignedNodeAnnouncement_set_timestamp(&this_ptr_conv, val);
43103 }
43104
43105 uint64_t  __attribute__((export_name("TS_UnsignedNodeAnnouncement_get_node_id"))) TS_UnsignedNodeAnnouncement_get_node_id(uint64_t this_ptr) {
43106         LDKUnsignedNodeAnnouncement this_ptr_conv;
43107         this_ptr_conv.inner = untag_ptr(this_ptr);
43108         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
43109         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
43110         this_ptr_conv.is_owned = false;
43111         LDKNodeId ret_var = UnsignedNodeAnnouncement_get_node_id(&this_ptr_conv);
43112         uint64_t ret_ref = 0;
43113         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
43114         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
43115         return ret_ref;
43116 }
43117
43118 void  __attribute__((export_name("TS_UnsignedNodeAnnouncement_set_node_id"))) TS_UnsignedNodeAnnouncement_set_node_id(uint64_t this_ptr, uint64_t val) {
43119         LDKUnsignedNodeAnnouncement this_ptr_conv;
43120         this_ptr_conv.inner = untag_ptr(this_ptr);
43121         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
43122         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
43123         this_ptr_conv.is_owned = false;
43124         LDKNodeId val_conv;
43125         val_conv.inner = untag_ptr(val);
43126         val_conv.is_owned = ptr_is_owned(val);
43127         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
43128         val_conv = NodeId_clone(&val_conv);
43129         UnsignedNodeAnnouncement_set_node_id(&this_ptr_conv, val_conv);
43130 }
43131
43132 int8_tArray  __attribute__((export_name("TS_UnsignedNodeAnnouncement_get_rgb"))) TS_UnsignedNodeAnnouncement_get_rgb(uint64_t this_ptr) {
43133         LDKUnsignedNodeAnnouncement this_ptr_conv;
43134         this_ptr_conv.inner = untag_ptr(this_ptr);
43135         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
43136         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
43137         this_ptr_conv.is_owned = false;
43138         int8_tArray ret_arr = init_int8_tArray(3, __LINE__);
43139         memcpy(ret_arr->elems, *UnsignedNodeAnnouncement_get_rgb(&this_ptr_conv), 3);
43140         return ret_arr;
43141 }
43142
43143 void  __attribute__((export_name("TS_UnsignedNodeAnnouncement_set_rgb"))) TS_UnsignedNodeAnnouncement_set_rgb(uint64_t this_ptr, int8_tArray val) {
43144         LDKUnsignedNodeAnnouncement this_ptr_conv;
43145         this_ptr_conv.inner = untag_ptr(this_ptr);
43146         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
43147         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
43148         this_ptr_conv.is_owned = false;
43149         LDKThreeBytes val_ref;
43150         CHECK(val->arr_len == 3);
43151         memcpy(val_ref.data, val->elems, 3); FREE(val);
43152         UnsignedNodeAnnouncement_set_rgb(&this_ptr_conv, val_ref);
43153 }
43154
43155 uint64_t  __attribute__((export_name("TS_UnsignedNodeAnnouncement_get_alias"))) TS_UnsignedNodeAnnouncement_get_alias(uint64_t this_ptr) {
43156         LDKUnsignedNodeAnnouncement this_ptr_conv;
43157         this_ptr_conv.inner = untag_ptr(this_ptr);
43158         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
43159         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
43160         this_ptr_conv.is_owned = false;
43161         LDKNodeAlias ret_var = UnsignedNodeAnnouncement_get_alias(&this_ptr_conv);
43162         uint64_t ret_ref = 0;
43163         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
43164         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
43165         return ret_ref;
43166 }
43167
43168 void  __attribute__((export_name("TS_UnsignedNodeAnnouncement_set_alias"))) TS_UnsignedNodeAnnouncement_set_alias(uint64_t this_ptr, uint64_t val) {
43169         LDKUnsignedNodeAnnouncement this_ptr_conv;
43170         this_ptr_conv.inner = untag_ptr(this_ptr);
43171         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
43172         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
43173         this_ptr_conv.is_owned = false;
43174         LDKNodeAlias val_conv;
43175         val_conv.inner = untag_ptr(val);
43176         val_conv.is_owned = ptr_is_owned(val);
43177         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
43178         val_conv = NodeAlias_clone(&val_conv);
43179         UnsignedNodeAnnouncement_set_alias(&this_ptr_conv, val_conv);
43180 }
43181
43182 uint64_tArray  __attribute__((export_name("TS_UnsignedNodeAnnouncement_get_addresses"))) TS_UnsignedNodeAnnouncement_get_addresses(uint64_t this_ptr) {
43183         LDKUnsignedNodeAnnouncement this_ptr_conv;
43184         this_ptr_conv.inner = untag_ptr(this_ptr);
43185         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
43186         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
43187         this_ptr_conv.is_owned = false;
43188         LDKCVec_SocketAddressZ ret_var = UnsignedNodeAnnouncement_get_addresses(&this_ptr_conv);
43189         uint64_tArray ret_arr = NULL;
43190         ret_arr = init_uint64_tArray(ret_var.datalen, __LINE__);
43191         uint64_t *ret_arr_ptr = (uint64_t*)(((uint8_t*)ret_arr) + 8);
43192         for (size_t p = 0; p < ret_var.datalen; p++) {
43193                 LDKSocketAddress *ret_conv_15_copy = MALLOC(sizeof(LDKSocketAddress), "LDKSocketAddress");
43194                 *ret_conv_15_copy = ret_var.data[p];
43195                 uint64_t ret_conv_15_ref = tag_ptr(ret_conv_15_copy, true);
43196                 ret_arr_ptr[p] = ret_conv_15_ref;
43197         }
43198         
43199         FREE(ret_var.data);
43200         return ret_arr;
43201 }
43202
43203 void  __attribute__((export_name("TS_UnsignedNodeAnnouncement_set_addresses"))) TS_UnsignedNodeAnnouncement_set_addresses(uint64_t this_ptr, uint64_tArray val) {
43204         LDKUnsignedNodeAnnouncement this_ptr_conv;
43205         this_ptr_conv.inner = untag_ptr(this_ptr);
43206         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
43207         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
43208         this_ptr_conv.is_owned = false;
43209         LDKCVec_SocketAddressZ val_constr;
43210         val_constr.datalen = val->arr_len;
43211         if (val_constr.datalen > 0)
43212                 val_constr.data = MALLOC(val_constr.datalen * sizeof(LDKSocketAddress), "LDKCVec_SocketAddressZ Elements");
43213         else
43214                 val_constr.data = NULL;
43215         uint64_t* val_vals = val->elems;
43216         for (size_t p = 0; p < val_constr.datalen; p++) {
43217                 uint64_t val_conv_15 = val_vals[p];
43218                 void* val_conv_15_ptr = untag_ptr(val_conv_15);
43219                 CHECK_ACCESS(val_conv_15_ptr);
43220                 LDKSocketAddress val_conv_15_conv = *(LDKSocketAddress*)(val_conv_15_ptr);
43221                 val_conv_15_conv = SocketAddress_clone((LDKSocketAddress*)untag_ptr(val_conv_15));
43222                 val_constr.data[p] = val_conv_15_conv;
43223         }
43224         FREE(val);
43225         UnsignedNodeAnnouncement_set_addresses(&this_ptr_conv, val_constr);
43226 }
43227
43228 static inline uint64_t UnsignedNodeAnnouncement_clone_ptr(LDKUnsignedNodeAnnouncement *NONNULL_PTR arg) {
43229         LDKUnsignedNodeAnnouncement ret_var = UnsignedNodeAnnouncement_clone(arg);
43230         uint64_t ret_ref = 0;
43231         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
43232         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
43233         return ret_ref;
43234 }
43235 int64_t  __attribute__((export_name("TS_UnsignedNodeAnnouncement_clone_ptr"))) TS_UnsignedNodeAnnouncement_clone_ptr(uint64_t arg) {
43236         LDKUnsignedNodeAnnouncement arg_conv;
43237         arg_conv.inner = untag_ptr(arg);
43238         arg_conv.is_owned = ptr_is_owned(arg);
43239         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
43240         arg_conv.is_owned = false;
43241         int64_t ret_conv = UnsignedNodeAnnouncement_clone_ptr(&arg_conv);
43242         return ret_conv;
43243 }
43244
43245 uint64_t  __attribute__((export_name("TS_UnsignedNodeAnnouncement_clone"))) TS_UnsignedNodeAnnouncement_clone(uint64_t orig) {
43246         LDKUnsignedNodeAnnouncement orig_conv;
43247         orig_conv.inner = untag_ptr(orig);
43248         orig_conv.is_owned = ptr_is_owned(orig);
43249         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
43250         orig_conv.is_owned = false;
43251         LDKUnsignedNodeAnnouncement ret_var = UnsignedNodeAnnouncement_clone(&orig_conv);
43252         uint64_t ret_ref = 0;
43253         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
43254         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
43255         return ret_ref;
43256 }
43257
43258 jboolean  __attribute__((export_name("TS_UnsignedNodeAnnouncement_eq"))) TS_UnsignedNodeAnnouncement_eq(uint64_t a, uint64_t b) {
43259         LDKUnsignedNodeAnnouncement a_conv;
43260         a_conv.inner = untag_ptr(a);
43261         a_conv.is_owned = ptr_is_owned(a);
43262         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
43263         a_conv.is_owned = false;
43264         LDKUnsignedNodeAnnouncement b_conv;
43265         b_conv.inner = untag_ptr(b);
43266         b_conv.is_owned = ptr_is_owned(b);
43267         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
43268         b_conv.is_owned = false;
43269         jboolean ret_conv = UnsignedNodeAnnouncement_eq(&a_conv, &b_conv);
43270         return ret_conv;
43271 }
43272
43273 void  __attribute__((export_name("TS_NodeAnnouncement_free"))) TS_NodeAnnouncement_free(uint64_t this_obj) {
43274         LDKNodeAnnouncement this_obj_conv;
43275         this_obj_conv.inner = untag_ptr(this_obj);
43276         this_obj_conv.is_owned = ptr_is_owned(this_obj);
43277         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
43278         NodeAnnouncement_free(this_obj_conv);
43279 }
43280
43281 int8_tArray  __attribute__((export_name("TS_NodeAnnouncement_get_signature"))) TS_NodeAnnouncement_get_signature(uint64_t this_ptr) {
43282         LDKNodeAnnouncement this_ptr_conv;
43283         this_ptr_conv.inner = untag_ptr(this_ptr);
43284         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
43285         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
43286         this_ptr_conv.is_owned = false;
43287         int8_tArray ret_arr = init_int8_tArray(64, __LINE__);
43288         memcpy(ret_arr->elems, NodeAnnouncement_get_signature(&this_ptr_conv).compact_form, 64);
43289         return ret_arr;
43290 }
43291
43292 void  __attribute__((export_name("TS_NodeAnnouncement_set_signature"))) TS_NodeAnnouncement_set_signature(uint64_t this_ptr, int8_tArray val) {
43293         LDKNodeAnnouncement this_ptr_conv;
43294         this_ptr_conv.inner = untag_ptr(this_ptr);
43295         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
43296         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
43297         this_ptr_conv.is_owned = false;
43298         LDKECDSASignature val_ref;
43299         CHECK(val->arr_len == 64);
43300         memcpy(val_ref.compact_form, val->elems, 64); FREE(val);
43301         NodeAnnouncement_set_signature(&this_ptr_conv, val_ref);
43302 }
43303
43304 uint64_t  __attribute__((export_name("TS_NodeAnnouncement_get_contents"))) TS_NodeAnnouncement_get_contents(uint64_t this_ptr) {
43305         LDKNodeAnnouncement this_ptr_conv;
43306         this_ptr_conv.inner = untag_ptr(this_ptr);
43307         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
43308         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
43309         this_ptr_conv.is_owned = false;
43310         LDKUnsignedNodeAnnouncement ret_var = NodeAnnouncement_get_contents(&this_ptr_conv);
43311         uint64_t ret_ref = 0;
43312         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
43313         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
43314         return ret_ref;
43315 }
43316
43317 void  __attribute__((export_name("TS_NodeAnnouncement_set_contents"))) TS_NodeAnnouncement_set_contents(uint64_t this_ptr, uint64_t val) {
43318         LDKNodeAnnouncement this_ptr_conv;
43319         this_ptr_conv.inner = untag_ptr(this_ptr);
43320         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
43321         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
43322         this_ptr_conv.is_owned = false;
43323         LDKUnsignedNodeAnnouncement val_conv;
43324         val_conv.inner = untag_ptr(val);
43325         val_conv.is_owned = ptr_is_owned(val);
43326         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
43327         val_conv = UnsignedNodeAnnouncement_clone(&val_conv);
43328         NodeAnnouncement_set_contents(&this_ptr_conv, val_conv);
43329 }
43330
43331 uint64_t  __attribute__((export_name("TS_NodeAnnouncement_new"))) TS_NodeAnnouncement_new(int8_tArray signature_arg, uint64_t contents_arg) {
43332         LDKECDSASignature signature_arg_ref;
43333         CHECK(signature_arg->arr_len == 64);
43334         memcpy(signature_arg_ref.compact_form, signature_arg->elems, 64); FREE(signature_arg);
43335         LDKUnsignedNodeAnnouncement contents_arg_conv;
43336         contents_arg_conv.inner = untag_ptr(contents_arg);
43337         contents_arg_conv.is_owned = ptr_is_owned(contents_arg);
43338         CHECK_INNER_FIELD_ACCESS_OR_NULL(contents_arg_conv);
43339         contents_arg_conv = UnsignedNodeAnnouncement_clone(&contents_arg_conv);
43340         LDKNodeAnnouncement ret_var = NodeAnnouncement_new(signature_arg_ref, contents_arg_conv);
43341         uint64_t ret_ref = 0;
43342         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
43343         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
43344         return ret_ref;
43345 }
43346
43347 static inline uint64_t NodeAnnouncement_clone_ptr(LDKNodeAnnouncement *NONNULL_PTR arg) {
43348         LDKNodeAnnouncement ret_var = NodeAnnouncement_clone(arg);
43349         uint64_t ret_ref = 0;
43350         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
43351         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
43352         return ret_ref;
43353 }
43354 int64_t  __attribute__((export_name("TS_NodeAnnouncement_clone_ptr"))) TS_NodeAnnouncement_clone_ptr(uint64_t arg) {
43355         LDKNodeAnnouncement arg_conv;
43356         arg_conv.inner = untag_ptr(arg);
43357         arg_conv.is_owned = ptr_is_owned(arg);
43358         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
43359         arg_conv.is_owned = false;
43360         int64_t ret_conv = NodeAnnouncement_clone_ptr(&arg_conv);
43361         return ret_conv;
43362 }
43363
43364 uint64_t  __attribute__((export_name("TS_NodeAnnouncement_clone"))) TS_NodeAnnouncement_clone(uint64_t orig) {
43365         LDKNodeAnnouncement orig_conv;
43366         orig_conv.inner = untag_ptr(orig);
43367         orig_conv.is_owned = ptr_is_owned(orig);
43368         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
43369         orig_conv.is_owned = false;
43370         LDKNodeAnnouncement ret_var = NodeAnnouncement_clone(&orig_conv);
43371         uint64_t ret_ref = 0;
43372         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
43373         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
43374         return ret_ref;
43375 }
43376
43377 jboolean  __attribute__((export_name("TS_NodeAnnouncement_eq"))) TS_NodeAnnouncement_eq(uint64_t a, uint64_t b) {
43378         LDKNodeAnnouncement a_conv;
43379         a_conv.inner = untag_ptr(a);
43380         a_conv.is_owned = ptr_is_owned(a);
43381         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
43382         a_conv.is_owned = false;
43383         LDKNodeAnnouncement b_conv;
43384         b_conv.inner = untag_ptr(b);
43385         b_conv.is_owned = ptr_is_owned(b);
43386         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
43387         b_conv.is_owned = false;
43388         jboolean ret_conv = NodeAnnouncement_eq(&a_conv, &b_conv);
43389         return ret_conv;
43390 }
43391
43392 void  __attribute__((export_name("TS_UnsignedChannelAnnouncement_free"))) TS_UnsignedChannelAnnouncement_free(uint64_t this_obj) {
43393         LDKUnsignedChannelAnnouncement this_obj_conv;
43394         this_obj_conv.inner = untag_ptr(this_obj);
43395         this_obj_conv.is_owned = ptr_is_owned(this_obj);
43396         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
43397         UnsignedChannelAnnouncement_free(this_obj_conv);
43398 }
43399
43400 uint64_t  __attribute__((export_name("TS_UnsignedChannelAnnouncement_get_features"))) TS_UnsignedChannelAnnouncement_get_features(uint64_t this_ptr) {
43401         LDKUnsignedChannelAnnouncement this_ptr_conv;
43402         this_ptr_conv.inner = untag_ptr(this_ptr);
43403         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
43404         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
43405         this_ptr_conv.is_owned = false;
43406         LDKChannelFeatures ret_var = UnsignedChannelAnnouncement_get_features(&this_ptr_conv);
43407         uint64_t ret_ref = 0;
43408         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
43409         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
43410         return ret_ref;
43411 }
43412
43413 void  __attribute__((export_name("TS_UnsignedChannelAnnouncement_set_features"))) TS_UnsignedChannelAnnouncement_set_features(uint64_t this_ptr, uint64_t val) {
43414         LDKUnsignedChannelAnnouncement this_ptr_conv;
43415         this_ptr_conv.inner = untag_ptr(this_ptr);
43416         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
43417         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
43418         this_ptr_conv.is_owned = false;
43419         LDKChannelFeatures val_conv;
43420         val_conv.inner = untag_ptr(val);
43421         val_conv.is_owned = ptr_is_owned(val);
43422         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
43423         val_conv = ChannelFeatures_clone(&val_conv);
43424         UnsignedChannelAnnouncement_set_features(&this_ptr_conv, val_conv);
43425 }
43426
43427 int8_tArray  __attribute__((export_name("TS_UnsignedChannelAnnouncement_get_chain_hash"))) TS_UnsignedChannelAnnouncement_get_chain_hash(uint64_t this_ptr) {
43428         LDKUnsignedChannelAnnouncement this_ptr_conv;
43429         this_ptr_conv.inner = untag_ptr(this_ptr);
43430         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
43431         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
43432         this_ptr_conv.is_owned = false;
43433         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
43434         memcpy(ret_arr->elems, *UnsignedChannelAnnouncement_get_chain_hash(&this_ptr_conv), 32);
43435         return ret_arr;
43436 }
43437
43438 void  __attribute__((export_name("TS_UnsignedChannelAnnouncement_set_chain_hash"))) TS_UnsignedChannelAnnouncement_set_chain_hash(uint64_t this_ptr, int8_tArray val) {
43439         LDKUnsignedChannelAnnouncement this_ptr_conv;
43440         this_ptr_conv.inner = untag_ptr(this_ptr);
43441         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
43442         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
43443         this_ptr_conv.is_owned = false;
43444         LDKThirtyTwoBytes val_ref;
43445         CHECK(val->arr_len == 32);
43446         memcpy(val_ref.data, val->elems, 32); FREE(val);
43447         UnsignedChannelAnnouncement_set_chain_hash(&this_ptr_conv, val_ref);
43448 }
43449
43450 int64_t  __attribute__((export_name("TS_UnsignedChannelAnnouncement_get_short_channel_id"))) TS_UnsignedChannelAnnouncement_get_short_channel_id(uint64_t this_ptr) {
43451         LDKUnsignedChannelAnnouncement this_ptr_conv;
43452         this_ptr_conv.inner = untag_ptr(this_ptr);
43453         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
43454         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
43455         this_ptr_conv.is_owned = false;
43456         int64_t ret_conv = UnsignedChannelAnnouncement_get_short_channel_id(&this_ptr_conv);
43457         return ret_conv;
43458 }
43459
43460 void  __attribute__((export_name("TS_UnsignedChannelAnnouncement_set_short_channel_id"))) TS_UnsignedChannelAnnouncement_set_short_channel_id(uint64_t this_ptr, int64_t val) {
43461         LDKUnsignedChannelAnnouncement this_ptr_conv;
43462         this_ptr_conv.inner = untag_ptr(this_ptr);
43463         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
43464         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
43465         this_ptr_conv.is_owned = false;
43466         UnsignedChannelAnnouncement_set_short_channel_id(&this_ptr_conv, val);
43467 }
43468
43469 uint64_t  __attribute__((export_name("TS_UnsignedChannelAnnouncement_get_node_id_1"))) TS_UnsignedChannelAnnouncement_get_node_id_1(uint64_t this_ptr) {
43470         LDKUnsignedChannelAnnouncement this_ptr_conv;
43471         this_ptr_conv.inner = untag_ptr(this_ptr);
43472         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
43473         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
43474         this_ptr_conv.is_owned = false;
43475         LDKNodeId ret_var = UnsignedChannelAnnouncement_get_node_id_1(&this_ptr_conv);
43476         uint64_t ret_ref = 0;
43477         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
43478         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
43479         return ret_ref;
43480 }
43481
43482 void  __attribute__((export_name("TS_UnsignedChannelAnnouncement_set_node_id_1"))) TS_UnsignedChannelAnnouncement_set_node_id_1(uint64_t this_ptr, uint64_t val) {
43483         LDKUnsignedChannelAnnouncement this_ptr_conv;
43484         this_ptr_conv.inner = untag_ptr(this_ptr);
43485         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
43486         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
43487         this_ptr_conv.is_owned = false;
43488         LDKNodeId val_conv;
43489         val_conv.inner = untag_ptr(val);
43490         val_conv.is_owned = ptr_is_owned(val);
43491         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
43492         val_conv = NodeId_clone(&val_conv);
43493         UnsignedChannelAnnouncement_set_node_id_1(&this_ptr_conv, val_conv);
43494 }
43495
43496 uint64_t  __attribute__((export_name("TS_UnsignedChannelAnnouncement_get_node_id_2"))) TS_UnsignedChannelAnnouncement_get_node_id_2(uint64_t this_ptr) {
43497         LDKUnsignedChannelAnnouncement this_ptr_conv;
43498         this_ptr_conv.inner = untag_ptr(this_ptr);
43499         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
43500         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
43501         this_ptr_conv.is_owned = false;
43502         LDKNodeId ret_var = UnsignedChannelAnnouncement_get_node_id_2(&this_ptr_conv);
43503         uint64_t ret_ref = 0;
43504         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
43505         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
43506         return ret_ref;
43507 }
43508
43509 void  __attribute__((export_name("TS_UnsignedChannelAnnouncement_set_node_id_2"))) TS_UnsignedChannelAnnouncement_set_node_id_2(uint64_t this_ptr, uint64_t val) {
43510         LDKUnsignedChannelAnnouncement this_ptr_conv;
43511         this_ptr_conv.inner = untag_ptr(this_ptr);
43512         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
43513         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
43514         this_ptr_conv.is_owned = false;
43515         LDKNodeId val_conv;
43516         val_conv.inner = untag_ptr(val);
43517         val_conv.is_owned = ptr_is_owned(val);
43518         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
43519         val_conv = NodeId_clone(&val_conv);
43520         UnsignedChannelAnnouncement_set_node_id_2(&this_ptr_conv, val_conv);
43521 }
43522
43523 uint64_t  __attribute__((export_name("TS_UnsignedChannelAnnouncement_get_bitcoin_key_1"))) TS_UnsignedChannelAnnouncement_get_bitcoin_key_1(uint64_t this_ptr) {
43524         LDKUnsignedChannelAnnouncement this_ptr_conv;
43525         this_ptr_conv.inner = untag_ptr(this_ptr);
43526         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
43527         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
43528         this_ptr_conv.is_owned = false;
43529         LDKNodeId ret_var = UnsignedChannelAnnouncement_get_bitcoin_key_1(&this_ptr_conv);
43530         uint64_t ret_ref = 0;
43531         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
43532         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
43533         return ret_ref;
43534 }
43535
43536 void  __attribute__((export_name("TS_UnsignedChannelAnnouncement_set_bitcoin_key_1"))) TS_UnsignedChannelAnnouncement_set_bitcoin_key_1(uint64_t this_ptr, uint64_t val) {
43537         LDKUnsignedChannelAnnouncement this_ptr_conv;
43538         this_ptr_conv.inner = untag_ptr(this_ptr);
43539         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
43540         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
43541         this_ptr_conv.is_owned = false;
43542         LDKNodeId val_conv;
43543         val_conv.inner = untag_ptr(val);
43544         val_conv.is_owned = ptr_is_owned(val);
43545         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
43546         val_conv = NodeId_clone(&val_conv);
43547         UnsignedChannelAnnouncement_set_bitcoin_key_1(&this_ptr_conv, val_conv);
43548 }
43549
43550 uint64_t  __attribute__((export_name("TS_UnsignedChannelAnnouncement_get_bitcoin_key_2"))) TS_UnsignedChannelAnnouncement_get_bitcoin_key_2(uint64_t this_ptr) {
43551         LDKUnsignedChannelAnnouncement this_ptr_conv;
43552         this_ptr_conv.inner = untag_ptr(this_ptr);
43553         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
43554         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
43555         this_ptr_conv.is_owned = false;
43556         LDKNodeId ret_var = UnsignedChannelAnnouncement_get_bitcoin_key_2(&this_ptr_conv);
43557         uint64_t ret_ref = 0;
43558         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
43559         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
43560         return ret_ref;
43561 }
43562
43563 void  __attribute__((export_name("TS_UnsignedChannelAnnouncement_set_bitcoin_key_2"))) TS_UnsignedChannelAnnouncement_set_bitcoin_key_2(uint64_t this_ptr, uint64_t val) {
43564         LDKUnsignedChannelAnnouncement this_ptr_conv;
43565         this_ptr_conv.inner = untag_ptr(this_ptr);
43566         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
43567         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
43568         this_ptr_conv.is_owned = false;
43569         LDKNodeId val_conv;
43570         val_conv.inner = untag_ptr(val);
43571         val_conv.is_owned = ptr_is_owned(val);
43572         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
43573         val_conv = NodeId_clone(&val_conv);
43574         UnsignedChannelAnnouncement_set_bitcoin_key_2(&this_ptr_conv, val_conv);
43575 }
43576
43577 int8_tArray  __attribute__((export_name("TS_UnsignedChannelAnnouncement_get_excess_data"))) TS_UnsignedChannelAnnouncement_get_excess_data(uint64_t this_ptr) {
43578         LDKUnsignedChannelAnnouncement this_ptr_conv;
43579         this_ptr_conv.inner = untag_ptr(this_ptr);
43580         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
43581         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
43582         this_ptr_conv.is_owned = false;
43583         LDKCVec_u8Z ret_var = UnsignedChannelAnnouncement_get_excess_data(&this_ptr_conv);
43584         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
43585         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
43586         CVec_u8Z_free(ret_var);
43587         return ret_arr;
43588 }
43589
43590 void  __attribute__((export_name("TS_UnsignedChannelAnnouncement_set_excess_data"))) TS_UnsignedChannelAnnouncement_set_excess_data(uint64_t this_ptr, int8_tArray val) {
43591         LDKUnsignedChannelAnnouncement this_ptr_conv;
43592         this_ptr_conv.inner = untag_ptr(this_ptr);
43593         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
43594         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
43595         this_ptr_conv.is_owned = false;
43596         LDKCVec_u8Z val_ref;
43597         val_ref.datalen = val->arr_len;
43598         val_ref.data = MALLOC(val_ref.datalen, "LDKCVec_u8Z Bytes");
43599         memcpy(val_ref.data, val->elems, val_ref.datalen); FREE(val);
43600         UnsignedChannelAnnouncement_set_excess_data(&this_ptr_conv, val_ref);
43601 }
43602
43603 uint64_t  __attribute__((export_name("TS_UnsignedChannelAnnouncement_new"))) TS_UnsignedChannelAnnouncement_new(uint64_t features_arg, int8_tArray chain_hash_arg, int64_t short_channel_id_arg, uint64_t node_id_1_arg, uint64_t node_id_2_arg, uint64_t bitcoin_key_1_arg, uint64_t bitcoin_key_2_arg, int8_tArray excess_data_arg) {
43604         LDKChannelFeatures features_arg_conv;
43605         features_arg_conv.inner = untag_ptr(features_arg);
43606         features_arg_conv.is_owned = ptr_is_owned(features_arg);
43607         CHECK_INNER_FIELD_ACCESS_OR_NULL(features_arg_conv);
43608         features_arg_conv = ChannelFeatures_clone(&features_arg_conv);
43609         LDKThirtyTwoBytes chain_hash_arg_ref;
43610         CHECK(chain_hash_arg->arr_len == 32);
43611         memcpy(chain_hash_arg_ref.data, chain_hash_arg->elems, 32); FREE(chain_hash_arg);
43612         LDKNodeId node_id_1_arg_conv;
43613         node_id_1_arg_conv.inner = untag_ptr(node_id_1_arg);
43614         node_id_1_arg_conv.is_owned = ptr_is_owned(node_id_1_arg);
43615         CHECK_INNER_FIELD_ACCESS_OR_NULL(node_id_1_arg_conv);
43616         node_id_1_arg_conv = NodeId_clone(&node_id_1_arg_conv);
43617         LDKNodeId node_id_2_arg_conv;
43618         node_id_2_arg_conv.inner = untag_ptr(node_id_2_arg);
43619         node_id_2_arg_conv.is_owned = ptr_is_owned(node_id_2_arg);
43620         CHECK_INNER_FIELD_ACCESS_OR_NULL(node_id_2_arg_conv);
43621         node_id_2_arg_conv = NodeId_clone(&node_id_2_arg_conv);
43622         LDKNodeId bitcoin_key_1_arg_conv;
43623         bitcoin_key_1_arg_conv.inner = untag_ptr(bitcoin_key_1_arg);
43624         bitcoin_key_1_arg_conv.is_owned = ptr_is_owned(bitcoin_key_1_arg);
43625         CHECK_INNER_FIELD_ACCESS_OR_NULL(bitcoin_key_1_arg_conv);
43626         bitcoin_key_1_arg_conv = NodeId_clone(&bitcoin_key_1_arg_conv);
43627         LDKNodeId bitcoin_key_2_arg_conv;
43628         bitcoin_key_2_arg_conv.inner = untag_ptr(bitcoin_key_2_arg);
43629         bitcoin_key_2_arg_conv.is_owned = ptr_is_owned(bitcoin_key_2_arg);
43630         CHECK_INNER_FIELD_ACCESS_OR_NULL(bitcoin_key_2_arg_conv);
43631         bitcoin_key_2_arg_conv = NodeId_clone(&bitcoin_key_2_arg_conv);
43632         LDKCVec_u8Z excess_data_arg_ref;
43633         excess_data_arg_ref.datalen = excess_data_arg->arr_len;
43634         excess_data_arg_ref.data = MALLOC(excess_data_arg_ref.datalen, "LDKCVec_u8Z Bytes");
43635         memcpy(excess_data_arg_ref.data, excess_data_arg->elems, excess_data_arg_ref.datalen); FREE(excess_data_arg);
43636         LDKUnsignedChannelAnnouncement ret_var = UnsignedChannelAnnouncement_new(features_arg_conv, chain_hash_arg_ref, short_channel_id_arg, node_id_1_arg_conv, node_id_2_arg_conv, bitcoin_key_1_arg_conv, bitcoin_key_2_arg_conv, excess_data_arg_ref);
43637         uint64_t ret_ref = 0;
43638         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
43639         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
43640         return ret_ref;
43641 }
43642
43643 static inline uint64_t UnsignedChannelAnnouncement_clone_ptr(LDKUnsignedChannelAnnouncement *NONNULL_PTR arg) {
43644         LDKUnsignedChannelAnnouncement ret_var = UnsignedChannelAnnouncement_clone(arg);
43645         uint64_t ret_ref = 0;
43646         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
43647         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
43648         return ret_ref;
43649 }
43650 int64_t  __attribute__((export_name("TS_UnsignedChannelAnnouncement_clone_ptr"))) TS_UnsignedChannelAnnouncement_clone_ptr(uint64_t arg) {
43651         LDKUnsignedChannelAnnouncement arg_conv;
43652         arg_conv.inner = untag_ptr(arg);
43653         arg_conv.is_owned = ptr_is_owned(arg);
43654         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
43655         arg_conv.is_owned = false;
43656         int64_t ret_conv = UnsignedChannelAnnouncement_clone_ptr(&arg_conv);
43657         return ret_conv;
43658 }
43659
43660 uint64_t  __attribute__((export_name("TS_UnsignedChannelAnnouncement_clone"))) TS_UnsignedChannelAnnouncement_clone(uint64_t orig) {
43661         LDKUnsignedChannelAnnouncement orig_conv;
43662         orig_conv.inner = untag_ptr(orig);
43663         orig_conv.is_owned = ptr_is_owned(orig);
43664         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
43665         orig_conv.is_owned = false;
43666         LDKUnsignedChannelAnnouncement ret_var = UnsignedChannelAnnouncement_clone(&orig_conv);
43667         uint64_t ret_ref = 0;
43668         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
43669         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
43670         return ret_ref;
43671 }
43672
43673 jboolean  __attribute__((export_name("TS_UnsignedChannelAnnouncement_eq"))) TS_UnsignedChannelAnnouncement_eq(uint64_t a, uint64_t b) {
43674         LDKUnsignedChannelAnnouncement a_conv;
43675         a_conv.inner = untag_ptr(a);
43676         a_conv.is_owned = ptr_is_owned(a);
43677         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
43678         a_conv.is_owned = false;
43679         LDKUnsignedChannelAnnouncement b_conv;
43680         b_conv.inner = untag_ptr(b);
43681         b_conv.is_owned = ptr_is_owned(b);
43682         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
43683         b_conv.is_owned = false;
43684         jboolean ret_conv = UnsignedChannelAnnouncement_eq(&a_conv, &b_conv);
43685         return ret_conv;
43686 }
43687
43688 void  __attribute__((export_name("TS_ChannelAnnouncement_free"))) TS_ChannelAnnouncement_free(uint64_t this_obj) {
43689         LDKChannelAnnouncement this_obj_conv;
43690         this_obj_conv.inner = untag_ptr(this_obj);
43691         this_obj_conv.is_owned = ptr_is_owned(this_obj);
43692         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
43693         ChannelAnnouncement_free(this_obj_conv);
43694 }
43695
43696 int8_tArray  __attribute__((export_name("TS_ChannelAnnouncement_get_node_signature_1"))) TS_ChannelAnnouncement_get_node_signature_1(uint64_t this_ptr) {
43697         LDKChannelAnnouncement this_ptr_conv;
43698         this_ptr_conv.inner = untag_ptr(this_ptr);
43699         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
43700         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
43701         this_ptr_conv.is_owned = false;
43702         int8_tArray ret_arr = init_int8_tArray(64, __LINE__);
43703         memcpy(ret_arr->elems, ChannelAnnouncement_get_node_signature_1(&this_ptr_conv).compact_form, 64);
43704         return ret_arr;
43705 }
43706
43707 void  __attribute__((export_name("TS_ChannelAnnouncement_set_node_signature_1"))) TS_ChannelAnnouncement_set_node_signature_1(uint64_t this_ptr, int8_tArray val) {
43708         LDKChannelAnnouncement this_ptr_conv;
43709         this_ptr_conv.inner = untag_ptr(this_ptr);
43710         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
43711         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
43712         this_ptr_conv.is_owned = false;
43713         LDKECDSASignature val_ref;
43714         CHECK(val->arr_len == 64);
43715         memcpy(val_ref.compact_form, val->elems, 64); FREE(val);
43716         ChannelAnnouncement_set_node_signature_1(&this_ptr_conv, val_ref);
43717 }
43718
43719 int8_tArray  __attribute__((export_name("TS_ChannelAnnouncement_get_node_signature_2"))) TS_ChannelAnnouncement_get_node_signature_2(uint64_t this_ptr) {
43720         LDKChannelAnnouncement this_ptr_conv;
43721         this_ptr_conv.inner = untag_ptr(this_ptr);
43722         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
43723         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
43724         this_ptr_conv.is_owned = false;
43725         int8_tArray ret_arr = init_int8_tArray(64, __LINE__);
43726         memcpy(ret_arr->elems, ChannelAnnouncement_get_node_signature_2(&this_ptr_conv).compact_form, 64);
43727         return ret_arr;
43728 }
43729
43730 void  __attribute__((export_name("TS_ChannelAnnouncement_set_node_signature_2"))) TS_ChannelAnnouncement_set_node_signature_2(uint64_t this_ptr, int8_tArray val) {
43731         LDKChannelAnnouncement this_ptr_conv;
43732         this_ptr_conv.inner = untag_ptr(this_ptr);
43733         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
43734         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
43735         this_ptr_conv.is_owned = false;
43736         LDKECDSASignature val_ref;
43737         CHECK(val->arr_len == 64);
43738         memcpy(val_ref.compact_form, val->elems, 64); FREE(val);
43739         ChannelAnnouncement_set_node_signature_2(&this_ptr_conv, val_ref);
43740 }
43741
43742 int8_tArray  __attribute__((export_name("TS_ChannelAnnouncement_get_bitcoin_signature_1"))) TS_ChannelAnnouncement_get_bitcoin_signature_1(uint64_t this_ptr) {
43743         LDKChannelAnnouncement this_ptr_conv;
43744         this_ptr_conv.inner = untag_ptr(this_ptr);
43745         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
43746         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
43747         this_ptr_conv.is_owned = false;
43748         int8_tArray ret_arr = init_int8_tArray(64, __LINE__);
43749         memcpy(ret_arr->elems, ChannelAnnouncement_get_bitcoin_signature_1(&this_ptr_conv).compact_form, 64);
43750         return ret_arr;
43751 }
43752
43753 void  __attribute__((export_name("TS_ChannelAnnouncement_set_bitcoin_signature_1"))) TS_ChannelAnnouncement_set_bitcoin_signature_1(uint64_t this_ptr, int8_tArray val) {
43754         LDKChannelAnnouncement this_ptr_conv;
43755         this_ptr_conv.inner = untag_ptr(this_ptr);
43756         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
43757         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
43758         this_ptr_conv.is_owned = false;
43759         LDKECDSASignature val_ref;
43760         CHECK(val->arr_len == 64);
43761         memcpy(val_ref.compact_form, val->elems, 64); FREE(val);
43762         ChannelAnnouncement_set_bitcoin_signature_1(&this_ptr_conv, val_ref);
43763 }
43764
43765 int8_tArray  __attribute__((export_name("TS_ChannelAnnouncement_get_bitcoin_signature_2"))) TS_ChannelAnnouncement_get_bitcoin_signature_2(uint64_t this_ptr) {
43766         LDKChannelAnnouncement this_ptr_conv;
43767         this_ptr_conv.inner = untag_ptr(this_ptr);
43768         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
43769         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
43770         this_ptr_conv.is_owned = false;
43771         int8_tArray ret_arr = init_int8_tArray(64, __LINE__);
43772         memcpy(ret_arr->elems, ChannelAnnouncement_get_bitcoin_signature_2(&this_ptr_conv).compact_form, 64);
43773         return ret_arr;
43774 }
43775
43776 void  __attribute__((export_name("TS_ChannelAnnouncement_set_bitcoin_signature_2"))) TS_ChannelAnnouncement_set_bitcoin_signature_2(uint64_t this_ptr, int8_tArray val) {
43777         LDKChannelAnnouncement this_ptr_conv;
43778         this_ptr_conv.inner = untag_ptr(this_ptr);
43779         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
43780         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
43781         this_ptr_conv.is_owned = false;
43782         LDKECDSASignature val_ref;
43783         CHECK(val->arr_len == 64);
43784         memcpy(val_ref.compact_form, val->elems, 64); FREE(val);
43785         ChannelAnnouncement_set_bitcoin_signature_2(&this_ptr_conv, val_ref);
43786 }
43787
43788 uint64_t  __attribute__((export_name("TS_ChannelAnnouncement_get_contents"))) TS_ChannelAnnouncement_get_contents(uint64_t this_ptr) {
43789         LDKChannelAnnouncement this_ptr_conv;
43790         this_ptr_conv.inner = untag_ptr(this_ptr);
43791         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
43792         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
43793         this_ptr_conv.is_owned = false;
43794         LDKUnsignedChannelAnnouncement ret_var = ChannelAnnouncement_get_contents(&this_ptr_conv);
43795         uint64_t ret_ref = 0;
43796         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
43797         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
43798         return ret_ref;
43799 }
43800
43801 void  __attribute__((export_name("TS_ChannelAnnouncement_set_contents"))) TS_ChannelAnnouncement_set_contents(uint64_t this_ptr, uint64_t val) {
43802         LDKChannelAnnouncement this_ptr_conv;
43803         this_ptr_conv.inner = untag_ptr(this_ptr);
43804         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
43805         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
43806         this_ptr_conv.is_owned = false;
43807         LDKUnsignedChannelAnnouncement val_conv;
43808         val_conv.inner = untag_ptr(val);
43809         val_conv.is_owned = ptr_is_owned(val);
43810         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
43811         val_conv = UnsignedChannelAnnouncement_clone(&val_conv);
43812         ChannelAnnouncement_set_contents(&this_ptr_conv, val_conv);
43813 }
43814
43815 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) {
43816         LDKECDSASignature node_signature_1_arg_ref;
43817         CHECK(node_signature_1_arg->arr_len == 64);
43818         memcpy(node_signature_1_arg_ref.compact_form, node_signature_1_arg->elems, 64); FREE(node_signature_1_arg);
43819         LDKECDSASignature node_signature_2_arg_ref;
43820         CHECK(node_signature_2_arg->arr_len == 64);
43821         memcpy(node_signature_2_arg_ref.compact_form, node_signature_2_arg->elems, 64); FREE(node_signature_2_arg);
43822         LDKECDSASignature bitcoin_signature_1_arg_ref;
43823         CHECK(bitcoin_signature_1_arg->arr_len == 64);
43824         memcpy(bitcoin_signature_1_arg_ref.compact_form, bitcoin_signature_1_arg->elems, 64); FREE(bitcoin_signature_1_arg);
43825         LDKECDSASignature bitcoin_signature_2_arg_ref;
43826         CHECK(bitcoin_signature_2_arg->arr_len == 64);
43827         memcpy(bitcoin_signature_2_arg_ref.compact_form, bitcoin_signature_2_arg->elems, 64); FREE(bitcoin_signature_2_arg);
43828         LDKUnsignedChannelAnnouncement contents_arg_conv;
43829         contents_arg_conv.inner = untag_ptr(contents_arg);
43830         contents_arg_conv.is_owned = ptr_is_owned(contents_arg);
43831         CHECK_INNER_FIELD_ACCESS_OR_NULL(contents_arg_conv);
43832         contents_arg_conv = UnsignedChannelAnnouncement_clone(&contents_arg_conv);
43833         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);
43834         uint64_t ret_ref = 0;
43835         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
43836         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
43837         return ret_ref;
43838 }
43839
43840 static inline uint64_t ChannelAnnouncement_clone_ptr(LDKChannelAnnouncement *NONNULL_PTR arg) {
43841         LDKChannelAnnouncement ret_var = ChannelAnnouncement_clone(arg);
43842         uint64_t ret_ref = 0;
43843         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
43844         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
43845         return ret_ref;
43846 }
43847 int64_t  __attribute__((export_name("TS_ChannelAnnouncement_clone_ptr"))) TS_ChannelAnnouncement_clone_ptr(uint64_t arg) {
43848         LDKChannelAnnouncement arg_conv;
43849         arg_conv.inner = untag_ptr(arg);
43850         arg_conv.is_owned = ptr_is_owned(arg);
43851         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
43852         arg_conv.is_owned = false;
43853         int64_t ret_conv = ChannelAnnouncement_clone_ptr(&arg_conv);
43854         return ret_conv;
43855 }
43856
43857 uint64_t  __attribute__((export_name("TS_ChannelAnnouncement_clone"))) TS_ChannelAnnouncement_clone(uint64_t orig) {
43858         LDKChannelAnnouncement orig_conv;
43859         orig_conv.inner = untag_ptr(orig);
43860         orig_conv.is_owned = ptr_is_owned(orig);
43861         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
43862         orig_conv.is_owned = false;
43863         LDKChannelAnnouncement ret_var = ChannelAnnouncement_clone(&orig_conv);
43864         uint64_t ret_ref = 0;
43865         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
43866         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
43867         return ret_ref;
43868 }
43869
43870 jboolean  __attribute__((export_name("TS_ChannelAnnouncement_eq"))) TS_ChannelAnnouncement_eq(uint64_t a, uint64_t b) {
43871         LDKChannelAnnouncement a_conv;
43872         a_conv.inner = untag_ptr(a);
43873         a_conv.is_owned = ptr_is_owned(a);
43874         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
43875         a_conv.is_owned = false;
43876         LDKChannelAnnouncement b_conv;
43877         b_conv.inner = untag_ptr(b);
43878         b_conv.is_owned = ptr_is_owned(b);
43879         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
43880         b_conv.is_owned = false;
43881         jboolean ret_conv = ChannelAnnouncement_eq(&a_conv, &b_conv);
43882         return ret_conv;
43883 }
43884
43885 void  __attribute__((export_name("TS_UnsignedChannelUpdate_free"))) TS_UnsignedChannelUpdate_free(uint64_t this_obj) {
43886         LDKUnsignedChannelUpdate this_obj_conv;
43887         this_obj_conv.inner = untag_ptr(this_obj);
43888         this_obj_conv.is_owned = ptr_is_owned(this_obj);
43889         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
43890         UnsignedChannelUpdate_free(this_obj_conv);
43891 }
43892
43893 int8_tArray  __attribute__((export_name("TS_UnsignedChannelUpdate_get_chain_hash"))) TS_UnsignedChannelUpdate_get_chain_hash(uint64_t this_ptr) {
43894         LDKUnsignedChannelUpdate this_ptr_conv;
43895         this_ptr_conv.inner = untag_ptr(this_ptr);
43896         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
43897         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
43898         this_ptr_conv.is_owned = false;
43899         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
43900         memcpy(ret_arr->elems, *UnsignedChannelUpdate_get_chain_hash(&this_ptr_conv), 32);
43901         return ret_arr;
43902 }
43903
43904 void  __attribute__((export_name("TS_UnsignedChannelUpdate_set_chain_hash"))) TS_UnsignedChannelUpdate_set_chain_hash(uint64_t this_ptr, int8_tArray val) {
43905         LDKUnsignedChannelUpdate this_ptr_conv;
43906         this_ptr_conv.inner = untag_ptr(this_ptr);
43907         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
43908         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
43909         this_ptr_conv.is_owned = false;
43910         LDKThirtyTwoBytes val_ref;
43911         CHECK(val->arr_len == 32);
43912         memcpy(val_ref.data, val->elems, 32); FREE(val);
43913         UnsignedChannelUpdate_set_chain_hash(&this_ptr_conv, val_ref);
43914 }
43915
43916 int64_t  __attribute__((export_name("TS_UnsignedChannelUpdate_get_short_channel_id"))) TS_UnsignedChannelUpdate_get_short_channel_id(uint64_t this_ptr) {
43917         LDKUnsignedChannelUpdate this_ptr_conv;
43918         this_ptr_conv.inner = untag_ptr(this_ptr);
43919         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
43920         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
43921         this_ptr_conv.is_owned = false;
43922         int64_t ret_conv = UnsignedChannelUpdate_get_short_channel_id(&this_ptr_conv);
43923         return ret_conv;
43924 }
43925
43926 void  __attribute__((export_name("TS_UnsignedChannelUpdate_set_short_channel_id"))) TS_UnsignedChannelUpdate_set_short_channel_id(uint64_t this_ptr, int64_t val) {
43927         LDKUnsignedChannelUpdate this_ptr_conv;
43928         this_ptr_conv.inner = untag_ptr(this_ptr);
43929         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
43930         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
43931         this_ptr_conv.is_owned = false;
43932         UnsignedChannelUpdate_set_short_channel_id(&this_ptr_conv, val);
43933 }
43934
43935 int32_t  __attribute__((export_name("TS_UnsignedChannelUpdate_get_timestamp"))) TS_UnsignedChannelUpdate_get_timestamp(uint64_t this_ptr) {
43936         LDKUnsignedChannelUpdate this_ptr_conv;
43937         this_ptr_conv.inner = untag_ptr(this_ptr);
43938         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
43939         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
43940         this_ptr_conv.is_owned = false;
43941         int32_t ret_conv = UnsignedChannelUpdate_get_timestamp(&this_ptr_conv);
43942         return ret_conv;
43943 }
43944
43945 void  __attribute__((export_name("TS_UnsignedChannelUpdate_set_timestamp"))) TS_UnsignedChannelUpdate_set_timestamp(uint64_t this_ptr, int32_t val) {
43946         LDKUnsignedChannelUpdate this_ptr_conv;
43947         this_ptr_conv.inner = untag_ptr(this_ptr);
43948         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
43949         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
43950         this_ptr_conv.is_owned = false;
43951         UnsignedChannelUpdate_set_timestamp(&this_ptr_conv, val);
43952 }
43953
43954 int8_t  __attribute__((export_name("TS_UnsignedChannelUpdate_get_flags"))) TS_UnsignedChannelUpdate_get_flags(uint64_t this_ptr) {
43955         LDKUnsignedChannelUpdate this_ptr_conv;
43956         this_ptr_conv.inner = untag_ptr(this_ptr);
43957         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
43958         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
43959         this_ptr_conv.is_owned = false;
43960         int8_t ret_conv = UnsignedChannelUpdate_get_flags(&this_ptr_conv);
43961         return ret_conv;
43962 }
43963
43964 void  __attribute__((export_name("TS_UnsignedChannelUpdate_set_flags"))) TS_UnsignedChannelUpdate_set_flags(uint64_t this_ptr, int8_t val) {
43965         LDKUnsignedChannelUpdate this_ptr_conv;
43966         this_ptr_conv.inner = untag_ptr(this_ptr);
43967         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
43968         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
43969         this_ptr_conv.is_owned = false;
43970         UnsignedChannelUpdate_set_flags(&this_ptr_conv, val);
43971 }
43972
43973 int16_t  __attribute__((export_name("TS_UnsignedChannelUpdate_get_cltv_expiry_delta"))) TS_UnsignedChannelUpdate_get_cltv_expiry_delta(uint64_t this_ptr) {
43974         LDKUnsignedChannelUpdate this_ptr_conv;
43975         this_ptr_conv.inner = untag_ptr(this_ptr);
43976         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
43977         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
43978         this_ptr_conv.is_owned = false;
43979         int16_t ret_conv = UnsignedChannelUpdate_get_cltv_expiry_delta(&this_ptr_conv);
43980         return ret_conv;
43981 }
43982
43983 void  __attribute__((export_name("TS_UnsignedChannelUpdate_set_cltv_expiry_delta"))) TS_UnsignedChannelUpdate_set_cltv_expiry_delta(uint64_t this_ptr, int16_t val) {
43984         LDKUnsignedChannelUpdate this_ptr_conv;
43985         this_ptr_conv.inner = untag_ptr(this_ptr);
43986         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
43987         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
43988         this_ptr_conv.is_owned = false;
43989         UnsignedChannelUpdate_set_cltv_expiry_delta(&this_ptr_conv, val);
43990 }
43991
43992 int64_t  __attribute__((export_name("TS_UnsignedChannelUpdate_get_htlc_minimum_msat"))) TS_UnsignedChannelUpdate_get_htlc_minimum_msat(uint64_t this_ptr) {
43993         LDKUnsignedChannelUpdate this_ptr_conv;
43994         this_ptr_conv.inner = untag_ptr(this_ptr);
43995         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
43996         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
43997         this_ptr_conv.is_owned = false;
43998         int64_t ret_conv = UnsignedChannelUpdate_get_htlc_minimum_msat(&this_ptr_conv);
43999         return ret_conv;
44000 }
44001
44002 void  __attribute__((export_name("TS_UnsignedChannelUpdate_set_htlc_minimum_msat"))) TS_UnsignedChannelUpdate_set_htlc_minimum_msat(uint64_t this_ptr, int64_t val) {
44003         LDKUnsignedChannelUpdate this_ptr_conv;
44004         this_ptr_conv.inner = untag_ptr(this_ptr);
44005         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
44006         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
44007         this_ptr_conv.is_owned = false;
44008         UnsignedChannelUpdate_set_htlc_minimum_msat(&this_ptr_conv, val);
44009 }
44010
44011 int64_t  __attribute__((export_name("TS_UnsignedChannelUpdate_get_htlc_maximum_msat"))) TS_UnsignedChannelUpdate_get_htlc_maximum_msat(uint64_t this_ptr) {
44012         LDKUnsignedChannelUpdate this_ptr_conv;
44013         this_ptr_conv.inner = untag_ptr(this_ptr);
44014         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
44015         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
44016         this_ptr_conv.is_owned = false;
44017         int64_t ret_conv = UnsignedChannelUpdate_get_htlc_maximum_msat(&this_ptr_conv);
44018         return ret_conv;
44019 }
44020
44021 void  __attribute__((export_name("TS_UnsignedChannelUpdate_set_htlc_maximum_msat"))) TS_UnsignedChannelUpdate_set_htlc_maximum_msat(uint64_t this_ptr, int64_t val) {
44022         LDKUnsignedChannelUpdate this_ptr_conv;
44023         this_ptr_conv.inner = untag_ptr(this_ptr);
44024         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
44025         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
44026         this_ptr_conv.is_owned = false;
44027         UnsignedChannelUpdate_set_htlc_maximum_msat(&this_ptr_conv, val);
44028 }
44029
44030 int32_t  __attribute__((export_name("TS_UnsignedChannelUpdate_get_fee_base_msat"))) TS_UnsignedChannelUpdate_get_fee_base_msat(uint64_t this_ptr) {
44031         LDKUnsignedChannelUpdate this_ptr_conv;
44032         this_ptr_conv.inner = untag_ptr(this_ptr);
44033         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
44034         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
44035         this_ptr_conv.is_owned = false;
44036         int32_t ret_conv = UnsignedChannelUpdate_get_fee_base_msat(&this_ptr_conv);
44037         return ret_conv;
44038 }
44039
44040 void  __attribute__((export_name("TS_UnsignedChannelUpdate_set_fee_base_msat"))) TS_UnsignedChannelUpdate_set_fee_base_msat(uint64_t this_ptr, int32_t val) {
44041         LDKUnsignedChannelUpdate this_ptr_conv;
44042         this_ptr_conv.inner = untag_ptr(this_ptr);
44043         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
44044         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
44045         this_ptr_conv.is_owned = false;
44046         UnsignedChannelUpdate_set_fee_base_msat(&this_ptr_conv, val);
44047 }
44048
44049 int32_t  __attribute__((export_name("TS_UnsignedChannelUpdate_get_fee_proportional_millionths"))) TS_UnsignedChannelUpdate_get_fee_proportional_millionths(uint64_t this_ptr) {
44050         LDKUnsignedChannelUpdate this_ptr_conv;
44051         this_ptr_conv.inner = untag_ptr(this_ptr);
44052         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
44053         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
44054         this_ptr_conv.is_owned = false;
44055         int32_t ret_conv = UnsignedChannelUpdate_get_fee_proportional_millionths(&this_ptr_conv);
44056         return ret_conv;
44057 }
44058
44059 void  __attribute__((export_name("TS_UnsignedChannelUpdate_set_fee_proportional_millionths"))) TS_UnsignedChannelUpdate_set_fee_proportional_millionths(uint64_t this_ptr, int32_t val) {
44060         LDKUnsignedChannelUpdate this_ptr_conv;
44061         this_ptr_conv.inner = untag_ptr(this_ptr);
44062         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
44063         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
44064         this_ptr_conv.is_owned = false;
44065         UnsignedChannelUpdate_set_fee_proportional_millionths(&this_ptr_conv, val);
44066 }
44067
44068 int8_tArray  __attribute__((export_name("TS_UnsignedChannelUpdate_get_excess_data"))) TS_UnsignedChannelUpdate_get_excess_data(uint64_t this_ptr) {
44069         LDKUnsignedChannelUpdate this_ptr_conv;
44070         this_ptr_conv.inner = untag_ptr(this_ptr);
44071         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
44072         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
44073         this_ptr_conv.is_owned = false;
44074         LDKCVec_u8Z ret_var = UnsignedChannelUpdate_get_excess_data(&this_ptr_conv);
44075         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
44076         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
44077         CVec_u8Z_free(ret_var);
44078         return ret_arr;
44079 }
44080
44081 void  __attribute__((export_name("TS_UnsignedChannelUpdate_set_excess_data"))) TS_UnsignedChannelUpdate_set_excess_data(uint64_t this_ptr, int8_tArray val) {
44082         LDKUnsignedChannelUpdate this_ptr_conv;
44083         this_ptr_conv.inner = untag_ptr(this_ptr);
44084         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
44085         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
44086         this_ptr_conv.is_owned = false;
44087         LDKCVec_u8Z val_ref;
44088         val_ref.datalen = val->arr_len;
44089         val_ref.data = MALLOC(val_ref.datalen, "LDKCVec_u8Z Bytes");
44090         memcpy(val_ref.data, val->elems, val_ref.datalen); FREE(val);
44091         UnsignedChannelUpdate_set_excess_data(&this_ptr_conv, val_ref);
44092 }
44093
44094 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) {
44095         LDKThirtyTwoBytes chain_hash_arg_ref;
44096         CHECK(chain_hash_arg->arr_len == 32);
44097         memcpy(chain_hash_arg_ref.data, chain_hash_arg->elems, 32); FREE(chain_hash_arg);
44098         LDKCVec_u8Z excess_data_arg_ref;
44099         excess_data_arg_ref.datalen = excess_data_arg->arr_len;
44100         excess_data_arg_ref.data = MALLOC(excess_data_arg_ref.datalen, "LDKCVec_u8Z Bytes");
44101         memcpy(excess_data_arg_ref.data, excess_data_arg->elems, excess_data_arg_ref.datalen); FREE(excess_data_arg);
44102         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);
44103         uint64_t ret_ref = 0;
44104         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
44105         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
44106         return ret_ref;
44107 }
44108
44109 static inline uint64_t UnsignedChannelUpdate_clone_ptr(LDKUnsignedChannelUpdate *NONNULL_PTR arg) {
44110         LDKUnsignedChannelUpdate ret_var = UnsignedChannelUpdate_clone(arg);
44111         uint64_t ret_ref = 0;
44112         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
44113         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
44114         return ret_ref;
44115 }
44116 int64_t  __attribute__((export_name("TS_UnsignedChannelUpdate_clone_ptr"))) TS_UnsignedChannelUpdate_clone_ptr(uint64_t arg) {
44117         LDKUnsignedChannelUpdate arg_conv;
44118         arg_conv.inner = untag_ptr(arg);
44119         arg_conv.is_owned = ptr_is_owned(arg);
44120         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
44121         arg_conv.is_owned = false;
44122         int64_t ret_conv = UnsignedChannelUpdate_clone_ptr(&arg_conv);
44123         return ret_conv;
44124 }
44125
44126 uint64_t  __attribute__((export_name("TS_UnsignedChannelUpdate_clone"))) TS_UnsignedChannelUpdate_clone(uint64_t orig) {
44127         LDKUnsignedChannelUpdate orig_conv;
44128         orig_conv.inner = untag_ptr(orig);
44129         orig_conv.is_owned = ptr_is_owned(orig);
44130         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
44131         orig_conv.is_owned = false;
44132         LDKUnsignedChannelUpdate ret_var = UnsignedChannelUpdate_clone(&orig_conv);
44133         uint64_t ret_ref = 0;
44134         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
44135         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
44136         return ret_ref;
44137 }
44138
44139 jboolean  __attribute__((export_name("TS_UnsignedChannelUpdate_eq"))) TS_UnsignedChannelUpdate_eq(uint64_t a, uint64_t b) {
44140         LDKUnsignedChannelUpdate a_conv;
44141         a_conv.inner = untag_ptr(a);
44142         a_conv.is_owned = ptr_is_owned(a);
44143         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
44144         a_conv.is_owned = false;
44145         LDKUnsignedChannelUpdate b_conv;
44146         b_conv.inner = untag_ptr(b);
44147         b_conv.is_owned = ptr_is_owned(b);
44148         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
44149         b_conv.is_owned = false;
44150         jboolean ret_conv = UnsignedChannelUpdate_eq(&a_conv, &b_conv);
44151         return ret_conv;
44152 }
44153
44154 void  __attribute__((export_name("TS_ChannelUpdate_free"))) TS_ChannelUpdate_free(uint64_t this_obj) {
44155         LDKChannelUpdate this_obj_conv;
44156         this_obj_conv.inner = untag_ptr(this_obj);
44157         this_obj_conv.is_owned = ptr_is_owned(this_obj);
44158         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
44159         ChannelUpdate_free(this_obj_conv);
44160 }
44161
44162 int8_tArray  __attribute__((export_name("TS_ChannelUpdate_get_signature"))) TS_ChannelUpdate_get_signature(uint64_t this_ptr) {
44163         LDKChannelUpdate this_ptr_conv;
44164         this_ptr_conv.inner = untag_ptr(this_ptr);
44165         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
44166         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
44167         this_ptr_conv.is_owned = false;
44168         int8_tArray ret_arr = init_int8_tArray(64, __LINE__);
44169         memcpy(ret_arr->elems, ChannelUpdate_get_signature(&this_ptr_conv).compact_form, 64);
44170         return ret_arr;
44171 }
44172
44173 void  __attribute__((export_name("TS_ChannelUpdate_set_signature"))) TS_ChannelUpdate_set_signature(uint64_t this_ptr, int8_tArray val) {
44174         LDKChannelUpdate this_ptr_conv;
44175         this_ptr_conv.inner = untag_ptr(this_ptr);
44176         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
44177         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
44178         this_ptr_conv.is_owned = false;
44179         LDKECDSASignature val_ref;
44180         CHECK(val->arr_len == 64);
44181         memcpy(val_ref.compact_form, val->elems, 64); FREE(val);
44182         ChannelUpdate_set_signature(&this_ptr_conv, val_ref);
44183 }
44184
44185 uint64_t  __attribute__((export_name("TS_ChannelUpdate_get_contents"))) TS_ChannelUpdate_get_contents(uint64_t this_ptr) {
44186         LDKChannelUpdate this_ptr_conv;
44187         this_ptr_conv.inner = untag_ptr(this_ptr);
44188         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
44189         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
44190         this_ptr_conv.is_owned = false;
44191         LDKUnsignedChannelUpdate ret_var = ChannelUpdate_get_contents(&this_ptr_conv);
44192         uint64_t ret_ref = 0;
44193         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
44194         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
44195         return ret_ref;
44196 }
44197
44198 void  __attribute__((export_name("TS_ChannelUpdate_set_contents"))) TS_ChannelUpdate_set_contents(uint64_t this_ptr, uint64_t val) {
44199         LDKChannelUpdate this_ptr_conv;
44200         this_ptr_conv.inner = untag_ptr(this_ptr);
44201         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
44202         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
44203         this_ptr_conv.is_owned = false;
44204         LDKUnsignedChannelUpdate val_conv;
44205         val_conv.inner = untag_ptr(val);
44206         val_conv.is_owned = ptr_is_owned(val);
44207         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
44208         val_conv = UnsignedChannelUpdate_clone(&val_conv);
44209         ChannelUpdate_set_contents(&this_ptr_conv, val_conv);
44210 }
44211
44212 uint64_t  __attribute__((export_name("TS_ChannelUpdate_new"))) TS_ChannelUpdate_new(int8_tArray signature_arg, uint64_t contents_arg) {
44213         LDKECDSASignature signature_arg_ref;
44214         CHECK(signature_arg->arr_len == 64);
44215         memcpy(signature_arg_ref.compact_form, signature_arg->elems, 64); FREE(signature_arg);
44216         LDKUnsignedChannelUpdate contents_arg_conv;
44217         contents_arg_conv.inner = untag_ptr(contents_arg);
44218         contents_arg_conv.is_owned = ptr_is_owned(contents_arg);
44219         CHECK_INNER_FIELD_ACCESS_OR_NULL(contents_arg_conv);
44220         contents_arg_conv = UnsignedChannelUpdate_clone(&contents_arg_conv);
44221         LDKChannelUpdate ret_var = ChannelUpdate_new(signature_arg_ref, contents_arg_conv);
44222         uint64_t ret_ref = 0;
44223         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
44224         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
44225         return ret_ref;
44226 }
44227
44228 static inline uint64_t ChannelUpdate_clone_ptr(LDKChannelUpdate *NONNULL_PTR arg) {
44229         LDKChannelUpdate ret_var = ChannelUpdate_clone(arg);
44230         uint64_t ret_ref = 0;
44231         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
44232         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
44233         return ret_ref;
44234 }
44235 int64_t  __attribute__((export_name("TS_ChannelUpdate_clone_ptr"))) TS_ChannelUpdate_clone_ptr(uint64_t arg) {
44236         LDKChannelUpdate arg_conv;
44237         arg_conv.inner = untag_ptr(arg);
44238         arg_conv.is_owned = ptr_is_owned(arg);
44239         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
44240         arg_conv.is_owned = false;
44241         int64_t ret_conv = ChannelUpdate_clone_ptr(&arg_conv);
44242         return ret_conv;
44243 }
44244
44245 uint64_t  __attribute__((export_name("TS_ChannelUpdate_clone"))) TS_ChannelUpdate_clone(uint64_t orig) {
44246         LDKChannelUpdate orig_conv;
44247         orig_conv.inner = untag_ptr(orig);
44248         orig_conv.is_owned = ptr_is_owned(orig);
44249         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
44250         orig_conv.is_owned = false;
44251         LDKChannelUpdate ret_var = ChannelUpdate_clone(&orig_conv);
44252         uint64_t ret_ref = 0;
44253         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
44254         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
44255         return ret_ref;
44256 }
44257
44258 jboolean  __attribute__((export_name("TS_ChannelUpdate_eq"))) TS_ChannelUpdate_eq(uint64_t a, uint64_t b) {
44259         LDKChannelUpdate a_conv;
44260         a_conv.inner = untag_ptr(a);
44261         a_conv.is_owned = ptr_is_owned(a);
44262         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
44263         a_conv.is_owned = false;
44264         LDKChannelUpdate b_conv;
44265         b_conv.inner = untag_ptr(b);
44266         b_conv.is_owned = ptr_is_owned(b);
44267         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
44268         b_conv.is_owned = false;
44269         jboolean ret_conv = ChannelUpdate_eq(&a_conv, &b_conv);
44270         return ret_conv;
44271 }
44272
44273 void  __attribute__((export_name("TS_QueryChannelRange_free"))) TS_QueryChannelRange_free(uint64_t this_obj) {
44274         LDKQueryChannelRange this_obj_conv;
44275         this_obj_conv.inner = untag_ptr(this_obj);
44276         this_obj_conv.is_owned = ptr_is_owned(this_obj);
44277         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
44278         QueryChannelRange_free(this_obj_conv);
44279 }
44280
44281 int8_tArray  __attribute__((export_name("TS_QueryChannelRange_get_chain_hash"))) TS_QueryChannelRange_get_chain_hash(uint64_t this_ptr) {
44282         LDKQueryChannelRange this_ptr_conv;
44283         this_ptr_conv.inner = untag_ptr(this_ptr);
44284         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
44285         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
44286         this_ptr_conv.is_owned = false;
44287         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
44288         memcpy(ret_arr->elems, *QueryChannelRange_get_chain_hash(&this_ptr_conv), 32);
44289         return ret_arr;
44290 }
44291
44292 void  __attribute__((export_name("TS_QueryChannelRange_set_chain_hash"))) TS_QueryChannelRange_set_chain_hash(uint64_t this_ptr, int8_tArray val) {
44293         LDKQueryChannelRange this_ptr_conv;
44294         this_ptr_conv.inner = untag_ptr(this_ptr);
44295         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
44296         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
44297         this_ptr_conv.is_owned = false;
44298         LDKThirtyTwoBytes val_ref;
44299         CHECK(val->arr_len == 32);
44300         memcpy(val_ref.data, val->elems, 32); FREE(val);
44301         QueryChannelRange_set_chain_hash(&this_ptr_conv, val_ref);
44302 }
44303
44304 int32_t  __attribute__((export_name("TS_QueryChannelRange_get_first_blocknum"))) TS_QueryChannelRange_get_first_blocknum(uint64_t this_ptr) {
44305         LDKQueryChannelRange this_ptr_conv;
44306         this_ptr_conv.inner = untag_ptr(this_ptr);
44307         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
44308         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
44309         this_ptr_conv.is_owned = false;
44310         int32_t ret_conv = QueryChannelRange_get_first_blocknum(&this_ptr_conv);
44311         return ret_conv;
44312 }
44313
44314 void  __attribute__((export_name("TS_QueryChannelRange_set_first_blocknum"))) TS_QueryChannelRange_set_first_blocknum(uint64_t this_ptr, int32_t val) {
44315         LDKQueryChannelRange this_ptr_conv;
44316         this_ptr_conv.inner = untag_ptr(this_ptr);
44317         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
44318         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
44319         this_ptr_conv.is_owned = false;
44320         QueryChannelRange_set_first_blocknum(&this_ptr_conv, val);
44321 }
44322
44323 int32_t  __attribute__((export_name("TS_QueryChannelRange_get_number_of_blocks"))) TS_QueryChannelRange_get_number_of_blocks(uint64_t this_ptr) {
44324         LDKQueryChannelRange this_ptr_conv;
44325         this_ptr_conv.inner = untag_ptr(this_ptr);
44326         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
44327         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
44328         this_ptr_conv.is_owned = false;
44329         int32_t ret_conv = QueryChannelRange_get_number_of_blocks(&this_ptr_conv);
44330         return ret_conv;
44331 }
44332
44333 void  __attribute__((export_name("TS_QueryChannelRange_set_number_of_blocks"))) TS_QueryChannelRange_set_number_of_blocks(uint64_t this_ptr, int32_t val) {
44334         LDKQueryChannelRange this_ptr_conv;
44335         this_ptr_conv.inner = untag_ptr(this_ptr);
44336         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
44337         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
44338         this_ptr_conv.is_owned = false;
44339         QueryChannelRange_set_number_of_blocks(&this_ptr_conv, val);
44340 }
44341
44342 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) {
44343         LDKThirtyTwoBytes chain_hash_arg_ref;
44344         CHECK(chain_hash_arg->arr_len == 32);
44345         memcpy(chain_hash_arg_ref.data, chain_hash_arg->elems, 32); FREE(chain_hash_arg);
44346         LDKQueryChannelRange ret_var = QueryChannelRange_new(chain_hash_arg_ref, first_blocknum_arg, number_of_blocks_arg);
44347         uint64_t ret_ref = 0;
44348         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
44349         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
44350         return ret_ref;
44351 }
44352
44353 static inline uint64_t QueryChannelRange_clone_ptr(LDKQueryChannelRange *NONNULL_PTR arg) {
44354         LDKQueryChannelRange ret_var = QueryChannelRange_clone(arg);
44355         uint64_t ret_ref = 0;
44356         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
44357         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
44358         return ret_ref;
44359 }
44360 int64_t  __attribute__((export_name("TS_QueryChannelRange_clone_ptr"))) TS_QueryChannelRange_clone_ptr(uint64_t arg) {
44361         LDKQueryChannelRange arg_conv;
44362         arg_conv.inner = untag_ptr(arg);
44363         arg_conv.is_owned = ptr_is_owned(arg);
44364         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
44365         arg_conv.is_owned = false;
44366         int64_t ret_conv = QueryChannelRange_clone_ptr(&arg_conv);
44367         return ret_conv;
44368 }
44369
44370 uint64_t  __attribute__((export_name("TS_QueryChannelRange_clone"))) TS_QueryChannelRange_clone(uint64_t orig) {
44371         LDKQueryChannelRange orig_conv;
44372         orig_conv.inner = untag_ptr(orig);
44373         orig_conv.is_owned = ptr_is_owned(orig);
44374         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
44375         orig_conv.is_owned = false;
44376         LDKQueryChannelRange ret_var = QueryChannelRange_clone(&orig_conv);
44377         uint64_t ret_ref = 0;
44378         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
44379         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
44380         return ret_ref;
44381 }
44382
44383 jboolean  __attribute__((export_name("TS_QueryChannelRange_eq"))) TS_QueryChannelRange_eq(uint64_t a, uint64_t b) {
44384         LDKQueryChannelRange a_conv;
44385         a_conv.inner = untag_ptr(a);
44386         a_conv.is_owned = ptr_is_owned(a);
44387         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
44388         a_conv.is_owned = false;
44389         LDKQueryChannelRange b_conv;
44390         b_conv.inner = untag_ptr(b);
44391         b_conv.is_owned = ptr_is_owned(b);
44392         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
44393         b_conv.is_owned = false;
44394         jboolean ret_conv = QueryChannelRange_eq(&a_conv, &b_conv);
44395         return ret_conv;
44396 }
44397
44398 void  __attribute__((export_name("TS_ReplyChannelRange_free"))) TS_ReplyChannelRange_free(uint64_t this_obj) {
44399         LDKReplyChannelRange this_obj_conv;
44400         this_obj_conv.inner = untag_ptr(this_obj);
44401         this_obj_conv.is_owned = ptr_is_owned(this_obj);
44402         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
44403         ReplyChannelRange_free(this_obj_conv);
44404 }
44405
44406 int8_tArray  __attribute__((export_name("TS_ReplyChannelRange_get_chain_hash"))) TS_ReplyChannelRange_get_chain_hash(uint64_t this_ptr) {
44407         LDKReplyChannelRange this_ptr_conv;
44408         this_ptr_conv.inner = untag_ptr(this_ptr);
44409         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
44410         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
44411         this_ptr_conv.is_owned = false;
44412         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
44413         memcpy(ret_arr->elems, *ReplyChannelRange_get_chain_hash(&this_ptr_conv), 32);
44414         return ret_arr;
44415 }
44416
44417 void  __attribute__((export_name("TS_ReplyChannelRange_set_chain_hash"))) TS_ReplyChannelRange_set_chain_hash(uint64_t this_ptr, int8_tArray val) {
44418         LDKReplyChannelRange this_ptr_conv;
44419         this_ptr_conv.inner = untag_ptr(this_ptr);
44420         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
44421         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
44422         this_ptr_conv.is_owned = false;
44423         LDKThirtyTwoBytes val_ref;
44424         CHECK(val->arr_len == 32);
44425         memcpy(val_ref.data, val->elems, 32); FREE(val);
44426         ReplyChannelRange_set_chain_hash(&this_ptr_conv, val_ref);
44427 }
44428
44429 int32_t  __attribute__((export_name("TS_ReplyChannelRange_get_first_blocknum"))) TS_ReplyChannelRange_get_first_blocknum(uint64_t this_ptr) {
44430         LDKReplyChannelRange this_ptr_conv;
44431         this_ptr_conv.inner = untag_ptr(this_ptr);
44432         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
44433         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
44434         this_ptr_conv.is_owned = false;
44435         int32_t ret_conv = ReplyChannelRange_get_first_blocknum(&this_ptr_conv);
44436         return ret_conv;
44437 }
44438
44439 void  __attribute__((export_name("TS_ReplyChannelRange_set_first_blocknum"))) TS_ReplyChannelRange_set_first_blocknum(uint64_t this_ptr, int32_t val) {
44440         LDKReplyChannelRange this_ptr_conv;
44441         this_ptr_conv.inner = untag_ptr(this_ptr);
44442         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
44443         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
44444         this_ptr_conv.is_owned = false;
44445         ReplyChannelRange_set_first_blocknum(&this_ptr_conv, val);
44446 }
44447
44448 int32_t  __attribute__((export_name("TS_ReplyChannelRange_get_number_of_blocks"))) TS_ReplyChannelRange_get_number_of_blocks(uint64_t this_ptr) {
44449         LDKReplyChannelRange this_ptr_conv;
44450         this_ptr_conv.inner = untag_ptr(this_ptr);
44451         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
44452         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
44453         this_ptr_conv.is_owned = false;
44454         int32_t ret_conv = ReplyChannelRange_get_number_of_blocks(&this_ptr_conv);
44455         return ret_conv;
44456 }
44457
44458 void  __attribute__((export_name("TS_ReplyChannelRange_set_number_of_blocks"))) TS_ReplyChannelRange_set_number_of_blocks(uint64_t this_ptr, int32_t val) {
44459         LDKReplyChannelRange 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         ReplyChannelRange_set_number_of_blocks(&this_ptr_conv, val);
44465 }
44466
44467 jboolean  __attribute__((export_name("TS_ReplyChannelRange_get_sync_complete"))) TS_ReplyChannelRange_get_sync_complete(uint64_t this_ptr) {
44468         LDKReplyChannelRange this_ptr_conv;
44469         this_ptr_conv.inner = untag_ptr(this_ptr);
44470         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
44471         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
44472         this_ptr_conv.is_owned = false;
44473         jboolean ret_conv = ReplyChannelRange_get_sync_complete(&this_ptr_conv);
44474         return ret_conv;
44475 }
44476
44477 void  __attribute__((export_name("TS_ReplyChannelRange_set_sync_complete"))) TS_ReplyChannelRange_set_sync_complete(uint64_t this_ptr, jboolean val) {
44478         LDKReplyChannelRange this_ptr_conv;
44479         this_ptr_conv.inner = untag_ptr(this_ptr);
44480         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
44481         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
44482         this_ptr_conv.is_owned = false;
44483         ReplyChannelRange_set_sync_complete(&this_ptr_conv, val);
44484 }
44485
44486 int64_tArray  __attribute__((export_name("TS_ReplyChannelRange_get_short_channel_ids"))) TS_ReplyChannelRange_get_short_channel_ids(uint64_t this_ptr) {
44487         LDKReplyChannelRange this_ptr_conv;
44488         this_ptr_conv.inner = untag_ptr(this_ptr);
44489         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
44490         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
44491         this_ptr_conv.is_owned = false;
44492         LDKCVec_u64Z ret_var = ReplyChannelRange_get_short_channel_ids(&this_ptr_conv);
44493         int64_tArray ret_arr = NULL;
44494         ret_arr = init_int64_tArray(ret_var.datalen, __LINE__);
44495         int64_t *ret_arr_ptr = (int64_t*)(((uint8_t*)ret_arr) + 8);
44496         for (size_t i = 0; i < ret_var.datalen; i++) {
44497                 int64_t ret_conv_8_conv = ret_var.data[i];
44498                 ret_arr_ptr[i] = ret_conv_8_conv;
44499         }
44500         
44501         FREE(ret_var.data);
44502         return ret_arr;
44503 }
44504
44505 void  __attribute__((export_name("TS_ReplyChannelRange_set_short_channel_ids"))) TS_ReplyChannelRange_set_short_channel_ids(uint64_t this_ptr, int64_tArray val) {
44506         LDKReplyChannelRange this_ptr_conv;
44507         this_ptr_conv.inner = untag_ptr(this_ptr);
44508         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
44509         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
44510         this_ptr_conv.is_owned = false;
44511         LDKCVec_u64Z val_constr;
44512         val_constr.datalen = val->arr_len;
44513         if (val_constr.datalen > 0)
44514                 val_constr.data = MALLOC(val_constr.datalen * sizeof(int64_t), "LDKCVec_u64Z Elements");
44515         else
44516                 val_constr.data = NULL;
44517         int64_t* val_vals = val->elems;
44518         for (size_t i = 0; i < val_constr.datalen; i++) {
44519                 int64_t val_conv_8 = val_vals[i];
44520                 val_constr.data[i] = val_conv_8;
44521         }
44522         FREE(val);
44523         ReplyChannelRange_set_short_channel_ids(&this_ptr_conv, val_constr);
44524 }
44525
44526 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) {
44527         LDKThirtyTwoBytes chain_hash_arg_ref;
44528         CHECK(chain_hash_arg->arr_len == 32);
44529         memcpy(chain_hash_arg_ref.data, chain_hash_arg->elems, 32); FREE(chain_hash_arg);
44530         LDKCVec_u64Z short_channel_ids_arg_constr;
44531         short_channel_ids_arg_constr.datalen = short_channel_ids_arg->arr_len;
44532         if (short_channel_ids_arg_constr.datalen > 0)
44533                 short_channel_ids_arg_constr.data = MALLOC(short_channel_ids_arg_constr.datalen * sizeof(int64_t), "LDKCVec_u64Z Elements");
44534         else
44535                 short_channel_ids_arg_constr.data = NULL;
44536         int64_t* short_channel_ids_arg_vals = short_channel_ids_arg->elems;
44537         for (size_t i = 0; i < short_channel_ids_arg_constr.datalen; i++) {
44538                 int64_t short_channel_ids_arg_conv_8 = short_channel_ids_arg_vals[i];
44539                 short_channel_ids_arg_constr.data[i] = short_channel_ids_arg_conv_8;
44540         }
44541         FREE(short_channel_ids_arg);
44542         LDKReplyChannelRange ret_var = ReplyChannelRange_new(chain_hash_arg_ref, first_blocknum_arg, number_of_blocks_arg, sync_complete_arg, short_channel_ids_arg_constr);
44543         uint64_t ret_ref = 0;
44544         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
44545         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
44546         return ret_ref;
44547 }
44548
44549 static inline uint64_t ReplyChannelRange_clone_ptr(LDKReplyChannelRange *NONNULL_PTR arg) {
44550         LDKReplyChannelRange ret_var = ReplyChannelRange_clone(arg);
44551         uint64_t ret_ref = 0;
44552         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
44553         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
44554         return ret_ref;
44555 }
44556 int64_t  __attribute__((export_name("TS_ReplyChannelRange_clone_ptr"))) TS_ReplyChannelRange_clone_ptr(uint64_t arg) {
44557         LDKReplyChannelRange arg_conv;
44558         arg_conv.inner = untag_ptr(arg);
44559         arg_conv.is_owned = ptr_is_owned(arg);
44560         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
44561         arg_conv.is_owned = false;
44562         int64_t ret_conv = ReplyChannelRange_clone_ptr(&arg_conv);
44563         return ret_conv;
44564 }
44565
44566 uint64_t  __attribute__((export_name("TS_ReplyChannelRange_clone"))) TS_ReplyChannelRange_clone(uint64_t orig) {
44567         LDKReplyChannelRange orig_conv;
44568         orig_conv.inner = untag_ptr(orig);
44569         orig_conv.is_owned = ptr_is_owned(orig);
44570         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
44571         orig_conv.is_owned = false;
44572         LDKReplyChannelRange ret_var = ReplyChannelRange_clone(&orig_conv);
44573         uint64_t ret_ref = 0;
44574         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
44575         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
44576         return ret_ref;
44577 }
44578
44579 jboolean  __attribute__((export_name("TS_ReplyChannelRange_eq"))) TS_ReplyChannelRange_eq(uint64_t a, uint64_t b) {
44580         LDKReplyChannelRange a_conv;
44581         a_conv.inner = untag_ptr(a);
44582         a_conv.is_owned = ptr_is_owned(a);
44583         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
44584         a_conv.is_owned = false;
44585         LDKReplyChannelRange b_conv;
44586         b_conv.inner = untag_ptr(b);
44587         b_conv.is_owned = ptr_is_owned(b);
44588         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
44589         b_conv.is_owned = false;
44590         jboolean ret_conv = ReplyChannelRange_eq(&a_conv, &b_conv);
44591         return ret_conv;
44592 }
44593
44594 void  __attribute__((export_name("TS_QueryShortChannelIds_free"))) TS_QueryShortChannelIds_free(uint64_t this_obj) {
44595         LDKQueryShortChannelIds this_obj_conv;
44596         this_obj_conv.inner = untag_ptr(this_obj);
44597         this_obj_conv.is_owned = ptr_is_owned(this_obj);
44598         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
44599         QueryShortChannelIds_free(this_obj_conv);
44600 }
44601
44602 int8_tArray  __attribute__((export_name("TS_QueryShortChannelIds_get_chain_hash"))) TS_QueryShortChannelIds_get_chain_hash(uint64_t this_ptr) {
44603         LDKQueryShortChannelIds this_ptr_conv;
44604         this_ptr_conv.inner = untag_ptr(this_ptr);
44605         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
44606         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
44607         this_ptr_conv.is_owned = false;
44608         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
44609         memcpy(ret_arr->elems, *QueryShortChannelIds_get_chain_hash(&this_ptr_conv), 32);
44610         return ret_arr;
44611 }
44612
44613 void  __attribute__((export_name("TS_QueryShortChannelIds_set_chain_hash"))) TS_QueryShortChannelIds_set_chain_hash(uint64_t this_ptr, int8_tArray val) {
44614         LDKQueryShortChannelIds this_ptr_conv;
44615         this_ptr_conv.inner = untag_ptr(this_ptr);
44616         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
44617         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
44618         this_ptr_conv.is_owned = false;
44619         LDKThirtyTwoBytes val_ref;
44620         CHECK(val->arr_len == 32);
44621         memcpy(val_ref.data, val->elems, 32); FREE(val);
44622         QueryShortChannelIds_set_chain_hash(&this_ptr_conv, val_ref);
44623 }
44624
44625 int64_tArray  __attribute__((export_name("TS_QueryShortChannelIds_get_short_channel_ids"))) TS_QueryShortChannelIds_get_short_channel_ids(uint64_t this_ptr) {
44626         LDKQueryShortChannelIds this_ptr_conv;
44627         this_ptr_conv.inner = untag_ptr(this_ptr);
44628         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
44629         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
44630         this_ptr_conv.is_owned = false;
44631         LDKCVec_u64Z ret_var = QueryShortChannelIds_get_short_channel_ids(&this_ptr_conv);
44632         int64_tArray ret_arr = NULL;
44633         ret_arr = init_int64_tArray(ret_var.datalen, __LINE__);
44634         int64_t *ret_arr_ptr = (int64_t*)(((uint8_t*)ret_arr) + 8);
44635         for (size_t i = 0; i < ret_var.datalen; i++) {
44636                 int64_t ret_conv_8_conv = ret_var.data[i];
44637                 ret_arr_ptr[i] = ret_conv_8_conv;
44638         }
44639         
44640         FREE(ret_var.data);
44641         return ret_arr;
44642 }
44643
44644 void  __attribute__((export_name("TS_QueryShortChannelIds_set_short_channel_ids"))) TS_QueryShortChannelIds_set_short_channel_ids(uint64_t this_ptr, int64_tArray val) {
44645         LDKQueryShortChannelIds this_ptr_conv;
44646         this_ptr_conv.inner = untag_ptr(this_ptr);
44647         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
44648         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
44649         this_ptr_conv.is_owned = false;
44650         LDKCVec_u64Z val_constr;
44651         val_constr.datalen = val->arr_len;
44652         if (val_constr.datalen > 0)
44653                 val_constr.data = MALLOC(val_constr.datalen * sizeof(int64_t), "LDKCVec_u64Z Elements");
44654         else
44655                 val_constr.data = NULL;
44656         int64_t* val_vals = val->elems;
44657         for (size_t i = 0; i < val_constr.datalen; i++) {
44658                 int64_t val_conv_8 = val_vals[i];
44659                 val_constr.data[i] = val_conv_8;
44660         }
44661         FREE(val);
44662         QueryShortChannelIds_set_short_channel_ids(&this_ptr_conv, val_constr);
44663 }
44664
44665 uint64_t  __attribute__((export_name("TS_QueryShortChannelIds_new"))) TS_QueryShortChannelIds_new(int8_tArray chain_hash_arg, int64_tArray short_channel_ids_arg) {
44666         LDKThirtyTwoBytes chain_hash_arg_ref;
44667         CHECK(chain_hash_arg->arr_len == 32);
44668         memcpy(chain_hash_arg_ref.data, chain_hash_arg->elems, 32); FREE(chain_hash_arg);
44669         LDKCVec_u64Z short_channel_ids_arg_constr;
44670         short_channel_ids_arg_constr.datalen = short_channel_ids_arg->arr_len;
44671         if (short_channel_ids_arg_constr.datalen > 0)
44672                 short_channel_ids_arg_constr.data = MALLOC(short_channel_ids_arg_constr.datalen * sizeof(int64_t), "LDKCVec_u64Z Elements");
44673         else
44674                 short_channel_ids_arg_constr.data = NULL;
44675         int64_t* short_channel_ids_arg_vals = short_channel_ids_arg->elems;
44676         for (size_t i = 0; i < short_channel_ids_arg_constr.datalen; i++) {
44677                 int64_t short_channel_ids_arg_conv_8 = short_channel_ids_arg_vals[i];
44678                 short_channel_ids_arg_constr.data[i] = short_channel_ids_arg_conv_8;
44679         }
44680         FREE(short_channel_ids_arg);
44681         LDKQueryShortChannelIds ret_var = QueryShortChannelIds_new(chain_hash_arg_ref, short_channel_ids_arg_constr);
44682         uint64_t ret_ref = 0;
44683         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
44684         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
44685         return ret_ref;
44686 }
44687
44688 static inline uint64_t QueryShortChannelIds_clone_ptr(LDKQueryShortChannelIds *NONNULL_PTR arg) {
44689         LDKQueryShortChannelIds ret_var = QueryShortChannelIds_clone(arg);
44690         uint64_t ret_ref = 0;
44691         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
44692         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
44693         return ret_ref;
44694 }
44695 int64_t  __attribute__((export_name("TS_QueryShortChannelIds_clone_ptr"))) TS_QueryShortChannelIds_clone_ptr(uint64_t arg) {
44696         LDKQueryShortChannelIds arg_conv;
44697         arg_conv.inner = untag_ptr(arg);
44698         arg_conv.is_owned = ptr_is_owned(arg);
44699         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
44700         arg_conv.is_owned = false;
44701         int64_t ret_conv = QueryShortChannelIds_clone_ptr(&arg_conv);
44702         return ret_conv;
44703 }
44704
44705 uint64_t  __attribute__((export_name("TS_QueryShortChannelIds_clone"))) TS_QueryShortChannelIds_clone(uint64_t orig) {
44706         LDKQueryShortChannelIds orig_conv;
44707         orig_conv.inner = untag_ptr(orig);
44708         orig_conv.is_owned = ptr_is_owned(orig);
44709         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
44710         orig_conv.is_owned = false;
44711         LDKQueryShortChannelIds ret_var = QueryShortChannelIds_clone(&orig_conv);
44712         uint64_t ret_ref = 0;
44713         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
44714         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
44715         return ret_ref;
44716 }
44717
44718 jboolean  __attribute__((export_name("TS_QueryShortChannelIds_eq"))) TS_QueryShortChannelIds_eq(uint64_t a, uint64_t b) {
44719         LDKQueryShortChannelIds a_conv;
44720         a_conv.inner = untag_ptr(a);
44721         a_conv.is_owned = ptr_is_owned(a);
44722         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
44723         a_conv.is_owned = false;
44724         LDKQueryShortChannelIds b_conv;
44725         b_conv.inner = untag_ptr(b);
44726         b_conv.is_owned = ptr_is_owned(b);
44727         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
44728         b_conv.is_owned = false;
44729         jboolean ret_conv = QueryShortChannelIds_eq(&a_conv, &b_conv);
44730         return ret_conv;
44731 }
44732
44733 void  __attribute__((export_name("TS_ReplyShortChannelIdsEnd_free"))) TS_ReplyShortChannelIdsEnd_free(uint64_t this_obj) {
44734         LDKReplyShortChannelIdsEnd this_obj_conv;
44735         this_obj_conv.inner = untag_ptr(this_obj);
44736         this_obj_conv.is_owned = ptr_is_owned(this_obj);
44737         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
44738         ReplyShortChannelIdsEnd_free(this_obj_conv);
44739 }
44740
44741 int8_tArray  __attribute__((export_name("TS_ReplyShortChannelIdsEnd_get_chain_hash"))) TS_ReplyShortChannelIdsEnd_get_chain_hash(uint64_t this_ptr) {
44742         LDKReplyShortChannelIdsEnd this_ptr_conv;
44743         this_ptr_conv.inner = untag_ptr(this_ptr);
44744         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
44745         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
44746         this_ptr_conv.is_owned = false;
44747         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
44748         memcpy(ret_arr->elems, *ReplyShortChannelIdsEnd_get_chain_hash(&this_ptr_conv), 32);
44749         return ret_arr;
44750 }
44751
44752 void  __attribute__((export_name("TS_ReplyShortChannelIdsEnd_set_chain_hash"))) TS_ReplyShortChannelIdsEnd_set_chain_hash(uint64_t this_ptr, int8_tArray val) {
44753         LDKReplyShortChannelIdsEnd this_ptr_conv;
44754         this_ptr_conv.inner = untag_ptr(this_ptr);
44755         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
44756         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
44757         this_ptr_conv.is_owned = false;
44758         LDKThirtyTwoBytes val_ref;
44759         CHECK(val->arr_len == 32);
44760         memcpy(val_ref.data, val->elems, 32); FREE(val);
44761         ReplyShortChannelIdsEnd_set_chain_hash(&this_ptr_conv, val_ref);
44762 }
44763
44764 jboolean  __attribute__((export_name("TS_ReplyShortChannelIdsEnd_get_full_information"))) TS_ReplyShortChannelIdsEnd_get_full_information(uint64_t this_ptr) {
44765         LDKReplyShortChannelIdsEnd this_ptr_conv;
44766         this_ptr_conv.inner = untag_ptr(this_ptr);
44767         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
44768         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
44769         this_ptr_conv.is_owned = false;
44770         jboolean ret_conv = ReplyShortChannelIdsEnd_get_full_information(&this_ptr_conv);
44771         return ret_conv;
44772 }
44773
44774 void  __attribute__((export_name("TS_ReplyShortChannelIdsEnd_set_full_information"))) TS_ReplyShortChannelIdsEnd_set_full_information(uint64_t this_ptr, jboolean val) {
44775         LDKReplyShortChannelIdsEnd this_ptr_conv;
44776         this_ptr_conv.inner = untag_ptr(this_ptr);
44777         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
44778         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
44779         this_ptr_conv.is_owned = false;
44780         ReplyShortChannelIdsEnd_set_full_information(&this_ptr_conv, val);
44781 }
44782
44783 uint64_t  __attribute__((export_name("TS_ReplyShortChannelIdsEnd_new"))) TS_ReplyShortChannelIdsEnd_new(int8_tArray chain_hash_arg, jboolean full_information_arg) {
44784         LDKThirtyTwoBytes chain_hash_arg_ref;
44785         CHECK(chain_hash_arg->arr_len == 32);
44786         memcpy(chain_hash_arg_ref.data, chain_hash_arg->elems, 32); FREE(chain_hash_arg);
44787         LDKReplyShortChannelIdsEnd ret_var = ReplyShortChannelIdsEnd_new(chain_hash_arg_ref, full_information_arg);
44788         uint64_t ret_ref = 0;
44789         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
44790         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
44791         return ret_ref;
44792 }
44793
44794 static inline uint64_t ReplyShortChannelIdsEnd_clone_ptr(LDKReplyShortChannelIdsEnd *NONNULL_PTR arg) {
44795         LDKReplyShortChannelIdsEnd ret_var = ReplyShortChannelIdsEnd_clone(arg);
44796         uint64_t ret_ref = 0;
44797         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
44798         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
44799         return ret_ref;
44800 }
44801 int64_t  __attribute__((export_name("TS_ReplyShortChannelIdsEnd_clone_ptr"))) TS_ReplyShortChannelIdsEnd_clone_ptr(uint64_t arg) {
44802         LDKReplyShortChannelIdsEnd arg_conv;
44803         arg_conv.inner = untag_ptr(arg);
44804         arg_conv.is_owned = ptr_is_owned(arg);
44805         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
44806         arg_conv.is_owned = false;
44807         int64_t ret_conv = ReplyShortChannelIdsEnd_clone_ptr(&arg_conv);
44808         return ret_conv;
44809 }
44810
44811 uint64_t  __attribute__((export_name("TS_ReplyShortChannelIdsEnd_clone"))) TS_ReplyShortChannelIdsEnd_clone(uint64_t orig) {
44812         LDKReplyShortChannelIdsEnd orig_conv;
44813         orig_conv.inner = untag_ptr(orig);
44814         orig_conv.is_owned = ptr_is_owned(orig);
44815         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
44816         orig_conv.is_owned = false;
44817         LDKReplyShortChannelIdsEnd ret_var = ReplyShortChannelIdsEnd_clone(&orig_conv);
44818         uint64_t ret_ref = 0;
44819         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
44820         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
44821         return ret_ref;
44822 }
44823
44824 jboolean  __attribute__((export_name("TS_ReplyShortChannelIdsEnd_eq"))) TS_ReplyShortChannelIdsEnd_eq(uint64_t a, uint64_t b) {
44825         LDKReplyShortChannelIdsEnd a_conv;
44826         a_conv.inner = untag_ptr(a);
44827         a_conv.is_owned = ptr_is_owned(a);
44828         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
44829         a_conv.is_owned = false;
44830         LDKReplyShortChannelIdsEnd b_conv;
44831         b_conv.inner = untag_ptr(b);
44832         b_conv.is_owned = ptr_is_owned(b);
44833         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
44834         b_conv.is_owned = false;
44835         jboolean ret_conv = ReplyShortChannelIdsEnd_eq(&a_conv, &b_conv);
44836         return ret_conv;
44837 }
44838
44839 void  __attribute__((export_name("TS_GossipTimestampFilter_free"))) TS_GossipTimestampFilter_free(uint64_t this_obj) {
44840         LDKGossipTimestampFilter this_obj_conv;
44841         this_obj_conv.inner = untag_ptr(this_obj);
44842         this_obj_conv.is_owned = ptr_is_owned(this_obj);
44843         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
44844         GossipTimestampFilter_free(this_obj_conv);
44845 }
44846
44847 int8_tArray  __attribute__((export_name("TS_GossipTimestampFilter_get_chain_hash"))) TS_GossipTimestampFilter_get_chain_hash(uint64_t this_ptr) {
44848         LDKGossipTimestampFilter this_ptr_conv;
44849         this_ptr_conv.inner = untag_ptr(this_ptr);
44850         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
44851         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
44852         this_ptr_conv.is_owned = false;
44853         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
44854         memcpy(ret_arr->elems, *GossipTimestampFilter_get_chain_hash(&this_ptr_conv), 32);
44855         return ret_arr;
44856 }
44857
44858 void  __attribute__((export_name("TS_GossipTimestampFilter_set_chain_hash"))) TS_GossipTimestampFilter_set_chain_hash(uint64_t this_ptr, int8_tArray val) {
44859         LDKGossipTimestampFilter this_ptr_conv;
44860         this_ptr_conv.inner = untag_ptr(this_ptr);
44861         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
44862         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
44863         this_ptr_conv.is_owned = false;
44864         LDKThirtyTwoBytes val_ref;
44865         CHECK(val->arr_len == 32);
44866         memcpy(val_ref.data, val->elems, 32); FREE(val);
44867         GossipTimestampFilter_set_chain_hash(&this_ptr_conv, val_ref);
44868 }
44869
44870 int32_t  __attribute__((export_name("TS_GossipTimestampFilter_get_first_timestamp"))) TS_GossipTimestampFilter_get_first_timestamp(uint64_t this_ptr) {
44871         LDKGossipTimestampFilter this_ptr_conv;
44872         this_ptr_conv.inner = untag_ptr(this_ptr);
44873         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
44874         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
44875         this_ptr_conv.is_owned = false;
44876         int32_t ret_conv = GossipTimestampFilter_get_first_timestamp(&this_ptr_conv);
44877         return ret_conv;
44878 }
44879
44880 void  __attribute__((export_name("TS_GossipTimestampFilter_set_first_timestamp"))) TS_GossipTimestampFilter_set_first_timestamp(uint64_t this_ptr, int32_t val) {
44881         LDKGossipTimestampFilter this_ptr_conv;
44882         this_ptr_conv.inner = untag_ptr(this_ptr);
44883         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
44884         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
44885         this_ptr_conv.is_owned = false;
44886         GossipTimestampFilter_set_first_timestamp(&this_ptr_conv, val);
44887 }
44888
44889 int32_t  __attribute__((export_name("TS_GossipTimestampFilter_get_timestamp_range"))) TS_GossipTimestampFilter_get_timestamp_range(uint64_t this_ptr) {
44890         LDKGossipTimestampFilter this_ptr_conv;
44891         this_ptr_conv.inner = untag_ptr(this_ptr);
44892         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
44893         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
44894         this_ptr_conv.is_owned = false;
44895         int32_t ret_conv = GossipTimestampFilter_get_timestamp_range(&this_ptr_conv);
44896         return ret_conv;
44897 }
44898
44899 void  __attribute__((export_name("TS_GossipTimestampFilter_set_timestamp_range"))) TS_GossipTimestampFilter_set_timestamp_range(uint64_t this_ptr, int32_t val) {
44900         LDKGossipTimestampFilter this_ptr_conv;
44901         this_ptr_conv.inner = untag_ptr(this_ptr);
44902         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
44903         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
44904         this_ptr_conv.is_owned = false;
44905         GossipTimestampFilter_set_timestamp_range(&this_ptr_conv, val);
44906 }
44907
44908 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) {
44909         LDKThirtyTwoBytes chain_hash_arg_ref;
44910         CHECK(chain_hash_arg->arr_len == 32);
44911         memcpy(chain_hash_arg_ref.data, chain_hash_arg->elems, 32); FREE(chain_hash_arg);
44912         LDKGossipTimestampFilter ret_var = GossipTimestampFilter_new(chain_hash_arg_ref, first_timestamp_arg, timestamp_range_arg);
44913         uint64_t ret_ref = 0;
44914         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
44915         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
44916         return ret_ref;
44917 }
44918
44919 static inline uint64_t GossipTimestampFilter_clone_ptr(LDKGossipTimestampFilter *NONNULL_PTR arg) {
44920         LDKGossipTimestampFilter ret_var = GossipTimestampFilter_clone(arg);
44921         uint64_t ret_ref = 0;
44922         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
44923         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
44924         return ret_ref;
44925 }
44926 int64_t  __attribute__((export_name("TS_GossipTimestampFilter_clone_ptr"))) TS_GossipTimestampFilter_clone_ptr(uint64_t arg) {
44927         LDKGossipTimestampFilter arg_conv;
44928         arg_conv.inner = untag_ptr(arg);
44929         arg_conv.is_owned = ptr_is_owned(arg);
44930         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
44931         arg_conv.is_owned = false;
44932         int64_t ret_conv = GossipTimestampFilter_clone_ptr(&arg_conv);
44933         return ret_conv;
44934 }
44935
44936 uint64_t  __attribute__((export_name("TS_GossipTimestampFilter_clone"))) TS_GossipTimestampFilter_clone(uint64_t orig) {
44937         LDKGossipTimestampFilter orig_conv;
44938         orig_conv.inner = untag_ptr(orig);
44939         orig_conv.is_owned = ptr_is_owned(orig);
44940         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
44941         orig_conv.is_owned = false;
44942         LDKGossipTimestampFilter ret_var = GossipTimestampFilter_clone(&orig_conv);
44943         uint64_t ret_ref = 0;
44944         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
44945         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
44946         return ret_ref;
44947 }
44948
44949 jboolean  __attribute__((export_name("TS_GossipTimestampFilter_eq"))) TS_GossipTimestampFilter_eq(uint64_t a, uint64_t b) {
44950         LDKGossipTimestampFilter a_conv;
44951         a_conv.inner = untag_ptr(a);
44952         a_conv.is_owned = ptr_is_owned(a);
44953         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
44954         a_conv.is_owned = false;
44955         LDKGossipTimestampFilter b_conv;
44956         b_conv.inner = untag_ptr(b);
44957         b_conv.is_owned = ptr_is_owned(b);
44958         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
44959         b_conv.is_owned = false;
44960         jboolean ret_conv = GossipTimestampFilter_eq(&a_conv, &b_conv);
44961         return ret_conv;
44962 }
44963
44964 void  __attribute__((export_name("TS_ErrorAction_free"))) TS_ErrorAction_free(uint64_t this_ptr) {
44965         if (!ptr_is_owned(this_ptr)) return;
44966         void* this_ptr_ptr = untag_ptr(this_ptr);
44967         CHECK_ACCESS(this_ptr_ptr);
44968         LDKErrorAction this_ptr_conv = *(LDKErrorAction*)(this_ptr_ptr);
44969         FREE(untag_ptr(this_ptr));
44970         ErrorAction_free(this_ptr_conv);
44971 }
44972
44973 static inline uint64_t ErrorAction_clone_ptr(LDKErrorAction *NONNULL_PTR arg) {
44974         LDKErrorAction *ret_copy = MALLOC(sizeof(LDKErrorAction), "LDKErrorAction");
44975         *ret_copy = ErrorAction_clone(arg);
44976         uint64_t ret_ref = tag_ptr(ret_copy, true);
44977         return ret_ref;
44978 }
44979 int64_t  __attribute__((export_name("TS_ErrorAction_clone_ptr"))) TS_ErrorAction_clone_ptr(uint64_t arg) {
44980         LDKErrorAction* arg_conv = (LDKErrorAction*)untag_ptr(arg);
44981         int64_t ret_conv = ErrorAction_clone_ptr(arg_conv);
44982         return ret_conv;
44983 }
44984
44985 uint64_t  __attribute__((export_name("TS_ErrorAction_clone"))) TS_ErrorAction_clone(uint64_t orig) {
44986         LDKErrorAction* orig_conv = (LDKErrorAction*)untag_ptr(orig);
44987         LDKErrorAction *ret_copy = MALLOC(sizeof(LDKErrorAction), "LDKErrorAction");
44988         *ret_copy = ErrorAction_clone(orig_conv);
44989         uint64_t ret_ref = tag_ptr(ret_copy, true);
44990         return ret_ref;
44991 }
44992
44993 uint64_t  __attribute__((export_name("TS_ErrorAction_disconnect_peer"))) TS_ErrorAction_disconnect_peer(uint64_t msg) {
44994         LDKErrorMessage msg_conv;
44995         msg_conv.inner = untag_ptr(msg);
44996         msg_conv.is_owned = ptr_is_owned(msg);
44997         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
44998         msg_conv = ErrorMessage_clone(&msg_conv);
44999         LDKErrorAction *ret_copy = MALLOC(sizeof(LDKErrorAction), "LDKErrorAction");
45000         *ret_copy = ErrorAction_disconnect_peer(msg_conv);
45001         uint64_t ret_ref = tag_ptr(ret_copy, true);
45002         return ret_ref;
45003 }
45004
45005 uint64_t  __attribute__((export_name("TS_ErrorAction_disconnect_peer_with_warning"))) TS_ErrorAction_disconnect_peer_with_warning(uint64_t msg) {
45006         LDKWarningMessage msg_conv;
45007         msg_conv.inner = untag_ptr(msg);
45008         msg_conv.is_owned = ptr_is_owned(msg);
45009         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
45010         msg_conv = WarningMessage_clone(&msg_conv);
45011         LDKErrorAction *ret_copy = MALLOC(sizeof(LDKErrorAction), "LDKErrorAction");
45012         *ret_copy = ErrorAction_disconnect_peer_with_warning(msg_conv);
45013         uint64_t ret_ref = tag_ptr(ret_copy, true);
45014         return ret_ref;
45015 }
45016
45017 uint64_t  __attribute__((export_name("TS_ErrorAction_ignore_error"))) TS_ErrorAction_ignore_error() {
45018         LDKErrorAction *ret_copy = MALLOC(sizeof(LDKErrorAction), "LDKErrorAction");
45019         *ret_copy = ErrorAction_ignore_error();
45020         uint64_t ret_ref = tag_ptr(ret_copy, true);
45021         return ret_ref;
45022 }
45023
45024 uint64_t  __attribute__((export_name("TS_ErrorAction_ignore_and_log"))) TS_ErrorAction_ignore_and_log(uint32_t a) {
45025         LDKLevel a_conv = LDKLevel_from_js(a);
45026         LDKErrorAction *ret_copy = MALLOC(sizeof(LDKErrorAction), "LDKErrorAction");
45027         *ret_copy = ErrorAction_ignore_and_log(a_conv);
45028         uint64_t ret_ref = tag_ptr(ret_copy, true);
45029         return ret_ref;
45030 }
45031
45032 uint64_t  __attribute__((export_name("TS_ErrorAction_ignore_duplicate_gossip"))) TS_ErrorAction_ignore_duplicate_gossip() {
45033         LDKErrorAction *ret_copy = MALLOC(sizeof(LDKErrorAction), "LDKErrorAction");
45034         *ret_copy = ErrorAction_ignore_duplicate_gossip();
45035         uint64_t ret_ref = tag_ptr(ret_copy, true);
45036         return ret_ref;
45037 }
45038
45039 uint64_t  __attribute__((export_name("TS_ErrorAction_send_error_message"))) TS_ErrorAction_send_error_message(uint64_t msg) {
45040         LDKErrorMessage msg_conv;
45041         msg_conv.inner = untag_ptr(msg);
45042         msg_conv.is_owned = ptr_is_owned(msg);
45043         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
45044         msg_conv = ErrorMessage_clone(&msg_conv);
45045         LDKErrorAction *ret_copy = MALLOC(sizeof(LDKErrorAction), "LDKErrorAction");
45046         *ret_copy = ErrorAction_send_error_message(msg_conv);
45047         uint64_t ret_ref = tag_ptr(ret_copy, true);
45048         return ret_ref;
45049 }
45050
45051 uint64_t  __attribute__((export_name("TS_ErrorAction_send_warning_message"))) TS_ErrorAction_send_warning_message(uint64_t msg, uint32_t log_level) {
45052         LDKWarningMessage msg_conv;
45053         msg_conv.inner = untag_ptr(msg);
45054         msg_conv.is_owned = ptr_is_owned(msg);
45055         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
45056         msg_conv = WarningMessage_clone(&msg_conv);
45057         LDKLevel log_level_conv = LDKLevel_from_js(log_level);
45058         LDKErrorAction *ret_copy = MALLOC(sizeof(LDKErrorAction), "LDKErrorAction");
45059         *ret_copy = ErrorAction_send_warning_message(msg_conv, log_level_conv);
45060         uint64_t ret_ref = tag_ptr(ret_copy, true);
45061         return ret_ref;
45062 }
45063
45064 void  __attribute__((export_name("TS_LightningError_free"))) TS_LightningError_free(uint64_t this_obj) {
45065         LDKLightningError this_obj_conv;
45066         this_obj_conv.inner = untag_ptr(this_obj);
45067         this_obj_conv.is_owned = ptr_is_owned(this_obj);
45068         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
45069         LightningError_free(this_obj_conv);
45070 }
45071
45072 jstring  __attribute__((export_name("TS_LightningError_get_err"))) TS_LightningError_get_err(uint64_t this_ptr) {
45073         LDKLightningError this_ptr_conv;
45074         this_ptr_conv.inner = untag_ptr(this_ptr);
45075         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
45076         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
45077         this_ptr_conv.is_owned = false;
45078         LDKStr ret_str = LightningError_get_err(&this_ptr_conv);
45079         jstring ret_conv = str_ref_to_ts(ret_str.chars, ret_str.len);
45080         Str_free(ret_str);
45081         return ret_conv;
45082 }
45083
45084 void  __attribute__((export_name("TS_LightningError_set_err"))) TS_LightningError_set_err(uint64_t this_ptr, jstring val) {
45085         LDKLightningError this_ptr_conv;
45086         this_ptr_conv.inner = untag_ptr(this_ptr);
45087         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
45088         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
45089         this_ptr_conv.is_owned = false;
45090         LDKStr val_conv = str_ref_to_owned_c(val);
45091         LightningError_set_err(&this_ptr_conv, val_conv);
45092 }
45093
45094 uint64_t  __attribute__((export_name("TS_LightningError_get_action"))) TS_LightningError_get_action(uint64_t this_ptr) {
45095         LDKLightningError this_ptr_conv;
45096         this_ptr_conv.inner = untag_ptr(this_ptr);
45097         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
45098         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
45099         this_ptr_conv.is_owned = false;
45100         LDKErrorAction *ret_copy = MALLOC(sizeof(LDKErrorAction), "LDKErrorAction");
45101         *ret_copy = LightningError_get_action(&this_ptr_conv);
45102         uint64_t ret_ref = tag_ptr(ret_copy, true);
45103         return ret_ref;
45104 }
45105
45106 void  __attribute__((export_name("TS_LightningError_set_action"))) TS_LightningError_set_action(uint64_t this_ptr, uint64_t val) {
45107         LDKLightningError this_ptr_conv;
45108         this_ptr_conv.inner = untag_ptr(this_ptr);
45109         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
45110         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
45111         this_ptr_conv.is_owned = false;
45112         void* val_ptr = untag_ptr(val);
45113         CHECK_ACCESS(val_ptr);
45114         LDKErrorAction val_conv = *(LDKErrorAction*)(val_ptr);
45115         val_conv = ErrorAction_clone((LDKErrorAction*)untag_ptr(val));
45116         LightningError_set_action(&this_ptr_conv, val_conv);
45117 }
45118
45119 uint64_t  __attribute__((export_name("TS_LightningError_new"))) TS_LightningError_new(jstring err_arg, uint64_t action_arg) {
45120         LDKStr err_arg_conv = str_ref_to_owned_c(err_arg);
45121         void* action_arg_ptr = untag_ptr(action_arg);
45122         CHECK_ACCESS(action_arg_ptr);
45123         LDKErrorAction action_arg_conv = *(LDKErrorAction*)(action_arg_ptr);
45124         action_arg_conv = ErrorAction_clone((LDKErrorAction*)untag_ptr(action_arg));
45125         LDKLightningError ret_var = LightningError_new(err_arg_conv, action_arg_conv);
45126         uint64_t ret_ref = 0;
45127         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
45128         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
45129         return ret_ref;
45130 }
45131
45132 static inline uint64_t LightningError_clone_ptr(LDKLightningError *NONNULL_PTR arg) {
45133         LDKLightningError ret_var = LightningError_clone(arg);
45134         uint64_t ret_ref = 0;
45135         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
45136         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
45137         return ret_ref;
45138 }
45139 int64_t  __attribute__((export_name("TS_LightningError_clone_ptr"))) TS_LightningError_clone_ptr(uint64_t arg) {
45140         LDKLightningError arg_conv;
45141         arg_conv.inner = untag_ptr(arg);
45142         arg_conv.is_owned = ptr_is_owned(arg);
45143         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
45144         arg_conv.is_owned = false;
45145         int64_t ret_conv = LightningError_clone_ptr(&arg_conv);
45146         return ret_conv;
45147 }
45148
45149 uint64_t  __attribute__((export_name("TS_LightningError_clone"))) TS_LightningError_clone(uint64_t orig) {
45150         LDKLightningError orig_conv;
45151         orig_conv.inner = untag_ptr(orig);
45152         orig_conv.is_owned = ptr_is_owned(orig);
45153         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
45154         orig_conv.is_owned = false;
45155         LDKLightningError ret_var = LightningError_clone(&orig_conv);
45156         uint64_t ret_ref = 0;
45157         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
45158         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
45159         return ret_ref;
45160 }
45161
45162 void  __attribute__((export_name("TS_CommitmentUpdate_free"))) TS_CommitmentUpdate_free(uint64_t this_obj) {
45163         LDKCommitmentUpdate this_obj_conv;
45164         this_obj_conv.inner = untag_ptr(this_obj);
45165         this_obj_conv.is_owned = ptr_is_owned(this_obj);
45166         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
45167         CommitmentUpdate_free(this_obj_conv);
45168 }
45169
45170 uint64_tArray  __attribute__((export_name("TS_CommitmentUpdate_get_update_add_htlcs"))) TS_CommitmentUpdate_get_update_add_htlcs(uint64_t this_ptr) {
45171         LDKCommitmentUpdate this_ptr_conv;
45172         this_ptr_conv.inner = untag_ptr(this_ptr);
45173         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
45174         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
45175         this_ptr_conv.is_owned = false;
45176         LDKCVec_UpdateAddHTLCZ ret_var = CommitmentUpdate_get_update_add_htlcs(&this_ptr_conv);
45177         uint64_tArray ret_arr = NULL;
45178         ret_arr = init_uint64_tArray(ret_var.datalen, __LINE__);
45179         uint64_t *ret_arr_ptr = (uint64_t*)(((uint8_t*)ret_arr) + 8);
45180         for (size_t p = 0; p < ret_var.datalen; p++) {
45181                 LDKUpdateAddHTLC ret_conv_15_var = ret_var.data[p];
45182                 uint64_t ret_conv_15_ref = 0;
45183                 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_conv_15_var);
45184                 ret_conv_15_ref = tag_ptr(ret_conv_15_var.inner, ret_conv_15_var.is_owned);
45185                 ret_arr_ptr[p] = ret_conv_15_ref;
45186         }
45187         
45188         FREE(ret_var.data);
45189         return ret_arr;
45190 }
45191
45192 void  __attribute__((export_name("TS_CommitmentUpdate_set_update_add_htlcs"))) TS_CommitmentUpdate_set_update_add_htlcs(uint64_t this_ptr, uint64_tArray val) {
45193         LDKCommitmentUpdate this_ptr_conv;
45194         this_ptr_conv.inner = untag_ptr(this_ptr);
45195         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
45196         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
45197         this_ptr_conv.is_owned = false;
45198         LDKCVec_UpdateAddHTLCZ val_constr;
45199         val_constr.datalen = val->arr_len;
45200         if (val_constr.datalen > 0)
45201                 val_constr.data = MALLOC(val_constr.datalen * sizeof(LDKUpdateAddHTLC), "LDKCVec_UpdateAddHTLCZ Elements");
45202         else
45203                 val_constr.data = NULL;
45204         uint64_t* val_vals = val->elems;
45205         for (size_t p = 0; p < val_constr.datalen; p++) {
45206                 uint64_t val_conv_15 = val_vals[p];
45207                 LDKUpdateAddHTLC val_conv_15_conv;
45208                 val_conv_15_conv.inner = untag_ptr(val_conv_15);
45209                 val_conv_15_conv.is_owned = ptr_is_owned(val_conv_15);
45210                 CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv_15_conv);
45211                 val_conv_15_conv = UpdateAddHTLC_clone(&val_conv_15_conv);
45212                 val_constr.data[p] = val_conv_15_conv;
45213         }
45214         FREE(val);
45215         CommitmentUpdate_set_update_add_htlcs(&this_ptr_conv, val_constr);
45216 }
45217
45218 uint64_tArray  __attribute__((export_name("TS_CommitmentUpdate_get_update_fulfill_htlcs"))) TS_CommitmentUpdate_get_update_fulfill_htlcs(uint64_t this_ptr) {
45219         LDKCommitmentUpdate this_ptr_conv;
45220         this_ptr_conv.inner = untag_ptr(this_ptr);
45221         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
45222         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
45223         this_ptr_conv.is_owned = false;
45224         LDKCVec_UpdateFulfillHTLCZ ret_var = CommitmentUpdate_get_update_fulfill_htlcs(&this_ptr_conv);
45225         uint64_tArray ret_arr = NULL;
45226         ret_arr = init_uint64_tArray(ret_var.datalen, __LINE__);
45227         uint64_t *ret_arr_ptr = (uint64_t*)(((uint8_t*)ret_arr) + 8);
45228         for (size_t t = 0; t < ret_var.datalen; t++) {
45229                 LDKUpdateFulfillHTLC ret_conv_19_var = ret_var.data[t];
45230                 uint64_t ret_conv_19_ref = 0;
45231                 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_conv_19_var);
45232                 ret_conv_19_ref = tag_ptr(ret_conv_19_var.inner, ret_conv_19_var.is_owned);
45233                 ret_arr_ptr[t] = ret_conv_19_ref;
45234         }
45235         
45236         FREE(ret_var.data);
45237         return ret_arr;
45238 }
45239
45240 void  __attribute__((export_name("TS_CommitmentUpdate_set_update_fulfill_htlcs"))) TS_CommitmentUpdate_set_update_fulfill_htlcs(uint64_t this_ptr, uint64_tArray val) {
45241         LDKCommitmentUpdate this_ptr_conv;
45242         this_ptr_conv.inner = untag_ptr(this_ptr);
45243         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
45244         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
45245         this_ptr_conv.is_owned = false;
45246         LDKCVec_UpdateFulfillHTLCZ val_constr;
45247         val_constr.datalen = val->arr_len;
45248         if (val_constr.datalen > 0)
45249                 val_constr.data = MALLOC(val_constr.datalen * sizeof(LDKUpdateFulfillHTLC), "LDKCVec_UpdateFulfillHTLCZ Elements");
45250         else
45251                 val_constr.data = NULL;
45252         uint64_t* val_vals = val->elems;
45253         for (size_t t = 0; t < val_constr.datalen; t++) {
45254                 uint64_t val_conv_19 = val_vals[t];
45255                 LDKUpdateFulfillHTLC val_conv_19_conv;
45256                 val_conv_19_conv.inner = untag_ptr(val_conv_19);
45257                 val_conv_19_conv.is_owned = ptr_is_owned(val_conv_19);
45258                 CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv_19_conv);
45259                 val_conv_19_conv = UpdateFulfillHTLC_clone(&val_conv_19_conv);
45260                 val_constr.data[t] = val_conv_19_conv;
45261         }
45262         FREE(val);
45263         CommitmentUpdate_set_update_fulfill_htlcs(&this_ptr_conv, val_constr);
45264 }
45265
45266 uint64_tArray  __attribute__((export_name("TS_CommitmentUpdate_get_update_fail_htlcs"))) TS_CommitmentUpdate_get_update_fail_htlcs(uint64_t this_ptr) {
45267         LDKCommitmentUpdate this_ptr_conv;
45268         this_ptr_conv.inner = untag_ptr(this_ptr);
45269         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
45270         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
45271         this_ptr_conv.is_owned = false;
45272         LDKCVec_UpdateFailHTLCZ ret_var = CommitmentUpdate_get_update_fail_htlcs(&this_ptr_conv);
45273         uint64_tArray ret_arr = NULL;
45274         ret_arr = init_uint64_tArray(ret_var.datalen, __LINE__);
45275         uint64_t *ret_arr_ptr = (uint64_t*)(((uint8_t*)ret_arr) + 8);
45276         for (size_t q = 0; q < ret_var.datalen; q++) {
45277                 LDKUpdateFailHTLC ret_conv_16_var = ret_var.data[q];
45278                 uint64_t ret_conv_16_ref = 0;
45279                 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_conv_16_var);
45280                 ret_conv_16_ref = tag_ptr(ret_conv_16_var.inner, ret_conv_16_var.is_owned);
45281                 ret_arr_ptr[q] = ret_conv_16_ref;
45282         }
45283         
45284         FREE(ret_var.data);
45285         return ret_arr;
45286 }
45287
45288 void  __attribute__((export_name("TS_CommitmentUpdate_set_update_fail_htlcs"))) TS_CommitmentUpdate_set_update_fail_htlcs(uint64_t this_ptr, uint64_tArray val) {
45289         LDKCommitmentUpdate this_ptr_conv;
45290         this_ptr_conv.inner = untag_ptr(this_ptr);
45291         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
45292         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
45293         this_ptr_conv.is_owned = false;
45294         LDKCVec_UpdateFailHTLCZ val_constr;
45295         val_constr.datalen = val->arr_len;
45296         if (val_constr.datalen > 0)
45297                 val_constr.data = MALLOC(val_constr.datalen * sizeof(LDKUpdateFailHTLC), "LDKCVec_UpdateFailHTLCZ Elements");
45298         else
45299                 val_constr.data = NULL;
45300         uint64_t* val_vals = val->elems;
45301         for (size_t q = 0; q < val_constr.datalen; q++) {
45302                 uint64_t val_conv_16 = val_vals[q];
45303                 LDKUpdateFailHTLC val_conv_16_conv;
45304                 val_conv_16_conv.inner = untag_ptr(val_conv_16);
45305                 val_conv_16_conv.is_owned = ptr_is_owned(val_conv_16);
45306                 CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv_16_conv);
45307                 val_conv_16_conv = UpdateFailHTLC_clone(&val_conv_16_conv);
45308                 val_constr.data[q] = val_conv_16_conv;
45309         }
45310         FREE(val);
45311         CommitmentUpdate_set_update_fail_htlcs(&this_ptr_conv, val_constr);
45312 }
45313
45314 uint64_tArray  __attribute__((export_name("TS_CommitmentUpdate_get_update_fail_malformed_htlcs"))) TS_CommitmentUpdate_get_update_fail_malformed_htlcs(uint64_t this_ptr) {
45315         LDKCommitmentUpdate this_ptr_conv;
45316         this_ptr_conv.inner = untag_ptr(this_ptr);
45317         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
45318         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
45319         this_ptr_conv.is_owned = false;
45320         LDKCVec_UpdateFailMalformedHTLCZ ret_var = CommitmentUpdate_get_update_fail_malformed_htlcs(&this_ptr_conv);
45321         uint64_tArray ret_arr = NULL;
45322         ret_arr = init_uint64_tArray(ret_var.datalen, __LINE__);
45323         uint64_t *ret_arr_ptr = (uint64_t*)(((uint8_t*)ret_arr) + 8);
45324         for (size_t z = 0; z < ret_var.datalen; z++) {
45325                 LDKUpdateFailMalformedHTLC ret_conv_25_var = ret_var.data[z];
45326                 uint64_t ret_conv_25_ref = 0;
45327                 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_conv_25_var);
45328                 ret_conv_25_ref = tag_ptr(ret_conv_25_var.inner, ret_conv_25_var.is_owned);
45329                 ret_arr_ptr[z] = ret_conv_25_ref;
45330         }
45331         
45332         FREE(ret_var.data);
45333         return ret_arr;
45334 }
45335
45336 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) {
45337         LDKCommitmentUpdate this_ptr_conv;
45338         this_ptr_conv.inner = untag_ptr(this_ptr);
45339         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
45340         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
45341         this_ptr_conv.is_owned = false;
45342         LDKCVec_UpdateFailMalformedHTLCZ val_constr;
45343         val_constr.datalen = val->arr_len;
45344         if (val_constr.datalen > 0)
45345                 val_constr.data = MALLOC(val_constr.datalen * sizeof(LDKUpdateFailMalformedHTLC), "LDKCVec_UpdateFailMalformedHTLCZ Elements");
45346         else
45347                 val_constr.data = NULL;
45348         uint64_t* val_vals = val->elems;
45349         for (size_t z = 0; z < val_constr.datalen; z++) {
45350                 uint64_t val_conv_25 = val_vals[z];
45351                 LDKUpdateFailMalformedHTLC val_conv_25_conv;
45352                 val_conv_25_conv.inner = untag_ptr(val_conv_25);
45353                 val_conv_25_conv.is_owned = ptr_is_owned(val_conv_25);
45354                 CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv_25_conv);
45355                 val_conv_25_conv = UpdateFailMalformedHTLC_clone(&val_conv_25_conv);
45356                 val_constr.data[z] = val_conv_25_conv;
45357         }
45358         FREE(val);
45359         CommitmentUpdate_set_update_fail_malformed_htlcs(&this_ptr_conv, val_constr);
45360 }
45361
45362 uint64_t  __attribute__((export_name("TS_CommitmentUpdate_get_update_fee"))) TS_CommitmentUpdate_get_update_fee(uint64_t this_ptr) {
45363         LDKCommitmentUpdate this_ptr_conv;
45364         this_ptr_conv.inner = untag_ptr(this_ptr);
45365         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
45366         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
45367         this_ptr_conv.is_owned = false;
45368         LDKUpdateFee ret_var = CommitmentUpdate_get_update_fee(&this_ptr_conv);
45369         uint64_t ret_ref = 0;
45370         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
45371         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
45372         return ret_ref;
45373 }
45374
45375 void  __attribute__((export_name("TS_CommitmentUpdate_set_update_fee"))) TS_CommitmentUpdate_set_update_fee(uint64_t this_ptr, uint64_t val) {
45376         LDKCommitmentUpdate this_ptr_conv;
45377         this_ptr_conv.inner = untag_ptr(this_ptr);
45378         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
45379         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
45380         this_ptr_conv.is_owned = false;
45381         LDKUpdateFee val_conv;
45382         val_conv.inner = untag_ptr(val);
45383         val_conv.is_owned = ptr_is_owned(val);
45384         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
45385         val_conv = UpdateFee_clone(&val_conv);
45386         CommitmentUpdate_set_update_fee(&this_ptr_conv, val_conv);
45387 }
45388
45389 uint64_t  __attribute__((export_name("TS_CommitmentUpdate_get_commitment_signed"))) TS_CommitmentUpdate_get_commitment_signed(uint64_t this_ptr) {
45390         LDKCommitmentUpdate this_ptr_conv;
45391         this_ptr_conv.inner = untag_ptr(this_ptr);
45392         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
45393         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
45394         this_ptr_conv.is_owned = false;
45395         LDKCommitmentSigned ret_var = CommitmentUpdate_get_commitment_signed(&this_ptr_conv);
45396         uint64_t ret_ref = 0;
45397         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
45398         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
45399         return ret_ref;
45400 }
45401
45402 void  __attribute__((export_name("TS_CommitmentUpdate_set_commitment_signed"))) TS_CommitmentUpdate_set_commitment_signed(uint64_t this_ptr, uint64_t val) {
45403         LDKCommitmentUpdate this_ptr_conv;
45404         this_ptr_conv.inner = untag_ptr(this_ptr);
45405         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
45406         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
45407         this_ptr_conv.is_owned = false;
45408         LDKCommitmentSigned val_conv;
45409         val_conv.inner = untag_ptr(val);
45410         val_conv.is_owned = ptr_is_owned(val);
45411         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
45412         val_conv = CommitmentSigned_clone(&val_conv);
45413         CommitmentUpdate_set_commitment_signed(&this_ptr_conv, val_conv);
45414 }
45415
45416 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) {
45417         LDKCVec_UpdateAddHTLCZ update_add_htlcs_arg_constr;
45418         update_add_htlcs_arg_constr.datalen = update_add_htlcs_arg->arr_len;
45419         if (update_add_htlcs_arg_constr.datalen > 0)
45420                 update_add_htlcs_arg_constr.data = MALLOC(update_add_htlcs_arg_constr.datalen * sizeof(LDKUpdateAddHTLC), "LDKCVec_UpdateAddHTLCZ Elements");
45421         else
45422                 update_add_htlcs_arg_constr.data = NULL;
45423         uint64_t* update_add_htlcs_arg_vals = update_add_htlcs_arg->elems;
45424         for (size_t p = 0; p < update_add_htlcs_arg_constr.datalen; p++) {
45425                 uint64_t update_add_htlcs_arg_conv_15 = update_add_htlcs_arg_vals[p];
45426                 LDKUpdateAddHTLC update_add_htlcs_arg_conv_15_conv;
45427                 update_add_htlcs_arg_conv_15_conv.inner = untag_ptr(update_add_htlcs_arg_conv_15);
45428                 update_add_htlcs_arg_conv_15_conv.is_owned = ptr_is_owned(update_add_htlcs_arg_conv_15);
45429                 CHECK_INNER_FIELD_ACCESS_OR_NULL(update_add_htlcs_arg_conv_15_conv);
45430                 update_add_htlcs_arg_conv_15_conv = UpdateAddHTLC_clone(&update_add_htlcs_arg_conv_15_conv);
45431                 update_add_htlcs_arg_constr.data[p] = update_add_htlcs_arg_conv_15_conv;
45432         }
45433         FREE(update_add_htlcs_arg);
45434         LDKCVec_UpdateFulfillHTLCZ update_fulfill_htlcs_arg_constr;
45435         update_fulfill_htlcs_arg_constr.datalen = update_fulfill_htlcs_arg->arr_len;
45436         if (update_fulfill_htlcs_arg_constr.datalen > 0)
45437                 update_fulfill_htlcs_arg_constr.data = MALLOC(update_fulfill_htlcs_arg_constr.datalen * sizeof(LDKUpdateFulfillHTLC), "LDKCVec_UpdateFulfillHTLCZ Elements");
45438         else
45439                 update_fulfill_htlcs_arg_constr.data = NULL;
45440         uint64_t* update_fulfill_htlcs_arg_vals = update_fulfill_htlcs_arg->elems;
45441         for (size_t t = 0; t < update_fulfill_htlcs_arg_constr.datalen; t++) {
45442                 uint64_t update_fulfill_htlcs_arg_conv_19 = update_fulfill_htlcs_arg_vals[t];
45443                 LDKUpdateFulfillHTLC update_fulfill_htlcs_arg_conv_19_conv;
45444                 update_fulfill_htlcs_arg_conv_19_conv.inner = untag_ptr(update_fulfill_htlcs_arg_conv_19);
45445                 update_fulfill_htlcs_arg_conv_19_conv.is_owned = ptr_is_owned(update_fulfill_htlcs_arg_conv_19);
45446                 CHECK_INNER_FIELD_ACCESS_OR_NULL(update_fulfill_htlcs_arg_conv_19_conv);
45447                 update_fulfill_htlcs_arg_conv_19_conv = UpdateFulfillHTLC_clone(&update_fulfill_htlcs_arg_conv_19_conv);
45448                 update_fulfill_htlcs_arg_constr.data[t] = update_fulfill_htlcs_arg_conv_19_conv;
45449         }
45450         FREE(update_fulfill_htlcs_arg);
45451         LDKCVec_UpdateFailHTLCZ update_fail_htlcs_arg_constr;
45452         update_fail_htlcs_arg_constr.datalen = update_fail_htlcs_arg->arr_len;
45453         if (update_fail_htlcs_arg_constr.datalen > 0)
45454                 update_fail_htlcs_arg_constr.data = MALLOC(update_fail_htlcs_arg_constr.datalen * sizeof(LDKUpdateFailHTLC), "LDKCVec_UpdateFailHTLCZ Elements");
45455         else
45456                 update_fail_htlcs_arg_constr.data = NULL;
45457         uint64_t* update_fail_htlcs_arg_vals = update_fail_htlcs_arg->elems;
45458         for (size_t q = 0; q < update_fail_htlcs_arg_constr.datalen; q++) {
45459                 uint64_t update_fail_htlcs_arg_conv_16 = update_fail_htlcs_arg_vals[q];
45460                 LDKUpdateFailHTLC update_fail_htlcs_arg_conv_16_conv;
45461                 update_fail_htlcs_arg_conv_16_conv.inner = untag_ptr(update_fail_htlcs_arg_conv_16);
45462                 update_fail_htlcs_arg_conv_16_conv.is_owned = ptr_is_owned(update_fail_htlcs_arg_conv_16);
45463                 CHECK_INNER_FIELD_ACCESS_OR_NULL(update_fail_htlcs_arg_conv_16_conv);
45464                 update_fail_htlcs_arg_conv_16_conv = UpdateFailHTLC_clone(&update_fail_htlcs_arg_conv_16_conv);
45465                 update_fail_htlcs_arg_constr.data[q] = update_fail_htlcs_arg_conv_16_conv;
45466         }
45467         FREE(update_fail_htlcs_arg);
45468         LDKCVec_UpdateFailMalformedHTLCZ update_fail_malformed_htlcs_arg_constr;
45469         update_fail_malformed_htlcs_arg_constr.datalen = update_fail_malformed_htlcs_arg->arr_len;
45470         if (update_fail_malformed_htlcs_arg_constr.datalen > 0)
45471                 update_fail_malformed_htlcs_arg_constr.data = MALLOC(update_fail_malformed_htlcs_arg_constr.datalen * sizeof(LDKUpdateFailMalformedHTLC), "LDKCVec_UpdateFailMalformedHTLCZ Elements");
45472         else
45473                 update_fail_malformed_htlcs_arg_constr.data = NULL;
45474         uint64_t* update_fail_malformed_htlcs_arg_vals = update_fail_malformed_htlcs_arg->elems;
45475         for (size_t z = 0; z < update_fail_malformed_htlcs_arg_constr.datalen; z++) {
45476                 uint64_t update_fail_malformed_htlcs_arg_conv_25 = update_fail_malformed_htlcs_arg_vals[z];
45477                 LDKUpdateFailMalformedHTLC update_fail_malformed_htlcs_arg_conv_25_conv;
45478                 update_fail_malformed_htlcs_arg_conv_25_conv.inner = untag_ptr(update_fail_malformed_htlcs_arg_conv_25);
45479                 update_fail_malformed_htlcs_arg_conv_25_conv.is_owned = ptr_is_owned(update_fail_malformed_htlcs_arg_conv_25);
45480                 CHECK_INNER_FIELD_ACCESS_OR_NULL(update_fail_malformed_htlcs_arg_conv_25_conv);
45481                 update_fail_malformed_htlcs_arg_conv_25_conv = UpdateFailMalformedHTLC_clone(&update_fail_malformed_htlcs_arg_conv_25_conv);
45482                 update_fail_malformed_htlcs_arg_constr.data[z] = update_fail_malformed_htlcs_arg_conv_25_conv;
45483         }
45484         FREE(update_fail_malformed_htlcs_arg);
45485         LDKUpdateFee update_fee_arg_conv;
45486         update_fee_arg_conv.inner = untag_ptr(update_fee_arg);
45487         update_fee_arg_conv.is_owned = ptr_is_owned(update_fee_arg);
45488         CHECK_INNER_FIELD_ACCESS_OR_NULL(update_fee_arg_conv);
45489         update_fee_arg_conv = UpdateFee_clone(&update_fee_arg_conv);
45490         LDKCommitmentSigned commitment_signed_arg_conv;
45491         commitment_signed_arg_conv.inner = untag_ptr(commitment_signed_arg);
45492         commitment_signed_arg_conv.is_owned = ptr_is_owned(commitment_signed_arg);
45493         CHECK_INNER_FIELD_ACCESS_OR_NULL(commitment_signed_arg_conv);
45494         commitment_signed_arg_conv = CommitmentSigned_clone(&commitment_signed_arg_conv);
45495         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);
45496         uint64_t ret_ref = 0;
45497         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
45498         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
45499         return ret_ref;
45500 }
45501
45502 static inline uint64_t CommitmentUpdate_clone_ptr(LDKCommitmentUpdate *NONNULL_PTR arg) {
45503         LDKCommitmentUpdate ret_var = CommitmentUpdate_clone(arg);
45504         uint64_t ret_ref = 0;
45505         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
45506         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
45507         return ret_ref;
45508 }
45509 int64_t  __attribute__((export_name("TS_CommitmentUpdate_clone_ptr"))) TS_CommitmentUpdate_clone_ptr(uint64_t arg) {
45510         LDKCommitmentUpdate arg_conv;
45511         arg_conv.inner = untag_ptr(arg);
45512         arg_conv.is_owned = ptr_is_owned(arg);
45513         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
45514         arg_conv.is_owned = false;
45515         int64_t ret_conv = CommitmentUpdate_clone_ptr(&arg_conv);
45516         return ret_conv;
45517 }
45518
45519 uint64_t  __attribute__((export_name("TS_CommitmentUpdate_clone"))) TS_CommitmentUpdate_clone(uint64_t orig) {
45520         LDKCommitmentUpdate orig_conv;
45521         orig_conv.inner = untag_ptr(orig);
45522         orig_conv.is_owned = ptr_is_owned(orig);
45523         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
45524         orig_conv.is_owned = false;
45525         LDKCommitmentUpdate ret_var = CommitmentUpdate_clone(&orig_conv);
45526         uint64_t ret_ref = 0;
45527         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
45528         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
45529         return ret_ref;
45530 }
45531
45532 jboolean  __attribute__((export_name("TS_CommitmentUpdate_eq"))) TS_CommitmentUpdate_eq(uint64_t a, uint64_t b) {
45533         LDKCommitmentUpdate a_conv;
45534         a_conv.inner = untag_ptr(a);
45535         a_conv.is_owned = ptr_is_owned(a);
45536         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
45537         a_conv.is_owned = false;
45538         LDKCommitmentUpdate b_conv;
45539         b_conv.inner = untag_ptr(b);
45540         b_conv.is_owned = ptr_is_owned(b);
45541         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
45542         b_conv.is_owned = false;
45543         jboolean ret_conv = CommitmentUpdate_eq(&a_conv, &b_conv);
45544         return ret_conv;
45545 }
45546
45547 void  __attribute__((export_name("TS_ChannelMessageHandler_free"))) TS_ChannelMessageHandler_free(uint64_t this_ptr) {
45548         if (!ptr_is_owned(this_ptr)) return;
45549         void* this_ptr_ptr = untag_ptr(this_ptr);
45550         CHECK_ACCESS(this_ptr_ptr);
45551         LDKChannelMessageHandler this_ptr_conv = *(LDKChannelMessageHandler*)(this_ptr_ptr);
45552         FREE(untag_ptr(this_ptr));
45553         ChannelMessageHandler_free(this_ptr_conv);
45554 }
45555
45556 void  __attribute__((export_name("TS_RoutingMessageHandler_free"))) TS_RoutingMessageHandler_free(uint64_t this_ptr) {
45557         if (!ptr_is_owned(this_ptr)) return;
45558         void* this_ptr_ptr = untag_ptr(this_ptr);
45559         CHECK_ACCESS(this_ptr_ptr);
45560         LDKRoutingMessageHandler this_ptr_conv = *(LDKRoutingMessageHandler*)(this_ptr_ptr);
45561         FREE(untag_ptr(this_ptr));
45562         RoutingMessageHandler_free(this_ptr_conv);
45563 }
45564
45565 void  __attribute__((export_name("TS_OnionMessageHandler_free"))) TS_OnionMessageHandler_free(uint64_t this_ptr) {
45566         if (!ptr_is_owned(this_ptr)) return;
45567         void* this_ptr_ptr = untag_ptr(this_ptr);
45568         CHECK_ACCESS(this_ptr_ptr);
45569         LDKOnionMessageHandler this_ptr_conv = *(LDKOnionMessageHandler*)(this_ptr_ptr);
45570         FREE(untag_ptr(this_ptr));
45571         OnionMessageHandler_free(this_ptr_conv);
45572 }
45573
45574 int8_tArray  __attribute__((export_name("TS_AcceptChannel_write"))) TS_AcceptChannel_write(uint64_t obj) {
45575         LDKAcceptChannel obj_conv;
45576         obj_conv.inner = untag_ptr(obj);
45577         obj_conv.is_owned = ptr_is_owned(obj);
45578         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
45579         obj_conv.is_owned = false;
45580         LDKCVec_u8Z ret_var = AcceptChannel_write(&obj_conv);
45581         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
45582         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
45583         CVec_u8Z_free(ret_var);
45584         return ret_arr;
45585 }
45586
45587 uint64_t  __attribute__((export_name("TS_AcceptChannel_read"))) TS_AcceptChannel_read(int8_tArray ser) {
45588         LDKu8slice ser_ref;
45589         ser_ref.datalen = ser->arr_len;
45590         ser_ref.data = ser->elems;
45591         LDKCResult_AcceptChannelDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_AcceptChannelDecodeErrorZ), "LDKCResult_AcceptChannelDecodeErrorZ");
45592         *ret_conv = AcceptChannel_read(ser_ref);
45593         FREE(ser);
45594         return tag_ptr(ret_conv, true);
45595 }
45596
45597 int8_tArray  __attribute__((export_name("TS_AcceptChannelV2_write"))) TS_AcceptChannelV2_write(uint64_t obj) {
45598         LDKAcceptChannelV2 obj_conv;
45599         obj_conv.inner = untag_ptr(obj);
45600         obj_conv.is_owned = ptr_is_owned(obj);
45601         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
45602         obj_conv.is_owned = false;
45603         LDKCVec_u8Z ret_var = AcceptChannelV2_write(&obj_conv);
45604         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
45605         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
45606         CVec_u8Z_free(ret_var);
45607         return ret_arr;
45608 }
45609
45610 uint64_t  __attribute__((export_name("TS_AcceptChannelV2_read"))) TS_AcceptChannelV2_read(int8_tArray ser) {
45611         LDKu8slice ser_ref;
45612         ser_ref.datalen = ser->arr_len;
45613         ser_ref.data = ser->elems;
45614         LDKCResult_AcceptChannelV2DecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_AcceptChannelV2DecodeErrorZ), "LDKCResult_AcceptChannelV2DecodeErrorZ");
45615         *ret_conv = AcceptChannelV2_read(ser_ref);
45616         FREE(ser);
45617         return tag_ptr(ret_conv, true);
45618 }
45619
45620 int8_tArray  __attribute__((export_name("TS_TxAddInput_write"))) TS_TxAddInput_write(uint64_t obj) {
45621         LDKTxAddInput obj_conv;
45622         obj_conv.inner = untag_ptr(obj);
45623         obj_conv.is_owned = ptr_is_owned(obj);
45624         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
45625         obj_conv.is_owned = false;
45626         LDKCVec_u8Z ret_var = TxAddInput_write(&obj_conv);
45627         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
45628         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
45629         CVec_u8Z_free(ret_var);
45630         return ret_arr;
45631 }
45632
45633 uint64_t  __attribute__((export_name("TS_TxAddInput_read"))) TS_TxAddInput_read(int8_tArray ser) {
45634         LDKu8slice ser_ref;
45635         ser_ref.datalen = ser->arr_len;
45636         ser_ref.data = ser->elems;
45637         LDKCResult_TxAddInputDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TxAddInputDecodeErrorZ), "LDKCResult_TxAddInputDecodeErrorZ");
45638         *ret_conv = TxAddInput_read(ser_ref);
45639         FREE(ser);
45640         return tag_ptr(ret_conv, true);
45641 }
45642
45643 int8_tArray  __attribute__((export_name("TS_TxAddOutput_write"))) TS_TxAddOutput_write(uint64_t obj) {
45644         LDKTxAddOutput obj_conv;
45645         obj_conv.inner = untag_ptr(obj);
45646         obj_conv.is_owned = ptr_is_owned(obj);
45647         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
45648         obj_conv.is_owned = false;
45649         LDKCVec_u8Z ret_var = TxAddOutput_write(&obj_conv);
45650         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
45651         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
45652         CVec_u8Z_free(ret_var);
45653         return ret_arr;
45654 }
45655
45656 uint64_t  __attribute__((export_name("TS_TxAddOutput_read"))) TS_TxAddOutput_read(int8_tArray ser) {
45657         LDKu8slice ser_ref;
45658         ser_ref.datalen = ser->arr_len;
45659         ser_ref.data = ser->elems;
45660         LDKCResult_TxAddOutputDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TxAddOutputDecodeErrorZ), "LDKCResult_TxAddOutputDecodeErrorZ");
45661         *ret_conv = TxAddOutput_read(ser_ref);
45662         FREE(ser);
45663         return tag_ptr(ret_conv, true);
45664 }
45665
45666 int8_tArray  __attribute__((export_name("TS_TxRemoveInput_write"))) TS_TxRemoveInput_write(uint64_t obj) {
45667         LDKTxRemoveInput obj_conv;
45668         obj_conv.inner = untag_ptr(obj);
45669         obj_conv.is_owned = ptr_is_owned(obj);
45670         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
45671         obj_conv.is_owned = false;
45672         LDKCVec_u8Z ret_var = TxRemoveInput_write(&obj_conv);
45673         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
45674         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
45675         CVec_u8Z_free(ret_var);
45676         return ret_arr;
45677 }
45678
45679 uint64_t  __attribute__((export_name("TS_TxRemoveInput_read"))) TS_TxRemoveInput_read(int8_tArray ser) {
45680         LDKu8slice ser_ref;
45681         ser_ref.datalen = ser->arr_len;
45682         ser_ref.data = ser->elems;
45683         LDKCResult_TxRemoveInputDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TxRemoveInputDecodeErrorZ), "LDKCResult_TxRemoveInputDecodeErrorZ");
45684         *ret_conv = TxRemoveInput_read(ser_ref);
45685         FREE(ser);
45686         return tag_ptr(ret_conv, true);
45687 }
45688
45689 int8_tArray  __attribute__((export_name("TS_TxRemoveOutput_write"))) TS_TxRemoveOutput_write(uint64_t obj) {
45690         LDKTxRemoveOutput obj_conv;
45691         obj_conv.inner = untag_ptr(obj);
45692         obj_conv.is_owned = ptr_is_owned(obj);
45693         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
45694         obj_conv.is_owned = false;
45695         LDKCVec_u8Z ret_var = TxRemoveOutput_write(&obj_conv);
45696         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
45697         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
45698         CVec_u8Z_free(ret_var);
45699         return ret_arr;
45700 }
45701
45702 uint64_t  __attribute__((export_name("TS_TxRemoveOutput_read"))) TS_TxRemoveOutput_read(int8_tArray ser) {
45703         LDKu8slice ser_ref;
45704         ser_ref.datalen = ser->arr_len;
45705         ser_ref.data = ser->elems;
45706         LDKCResult_TxRemoveOutputDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TxRemoveOutputDecodeErrorZ), "LDKCResult_TxRemoveOutputDecodeErrorZ");
45707         *ret_conv = TxRemoveOutput_read(ser_ref);
45708         FREE(ser);
45709         return tag_ptr(ret_conv, true);
45710 }
45711
45712 int8_tArray  __attribute__((export_name("TS_TxComplete_write"))) TS_TxComplete_write(uint64_t obj) {
45713         LDKTxComplete obj_conv;
45714         obj_conv.inner = untag_ptr(obj);
45715         obj_conv.is_owned = ptr_is_owned(obj);
45716         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
45717         obj_conv.is_owned = false;
45718         LDKCVec_u8Z ret_var = TxComplete_write(&obj_conv);
45719         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
45720         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
45721         CVec_u8Z_free(ret_var);
45722         return ret_arr;
45723 }
45724
45725 uint64_t  __attribute__((export_name("TS_TxComplete_read"))) TS_TxComplete_read(int8_tArray ser) {
45726         LDKu8slice ser_ref;
45727         ser_ref.datalen = ser->arr_len;
45728         ser_ref.data = ser->elems;
45729         LDKCResult_TxCompleteDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TxCompleteDecodeErrorZ), "LDKCResult_TxCompleteDecodeErrorZ");
45730         *ret_conv = TxComplete_read(ser_ref);
45731         FREE(ser);
45732         return tag_ptr(ret_conv, true);
45733 }
45734
45735 int8_tArray  __attribute__((export_name("TS_TxSignatures_write"))) TS_TxSignatures_write(uint64_t obj) {
45736         LDKTxSignatures obj_conv;
45737         obj_conv.inner = untag_ptr(obj);
45738         obj_conv.is_owned = ptr_is_owned(obj);
45739         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
45740         obj_conv.is_owned = false;
45741         LDKCVec_u8Z ret_var = TxSignatures_write(&obj_conv);
45742         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
45743         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
45744         CVec_u8Z_free(ret_var);
45745         return ret_arr;
45746 }
45747
45748 uint64_t  __attribute__((export_name("TS_TxSignatures_read"))) TS_TxSignatures_read(int8_tArray ser) {
45749         LDKu8slice ser_ref;
45750         ser_ref.datalen = ser->arr_len;
45751         ser_ref.data = ser->elems;
45752         LDKCResult_TxSignaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TxSignaturesDecodeErrorZ), "LDKCResult_TxSignaturesDecodeErrorZ");
45753         *ret_conv = TxSignatures_read(ser_ref);
45754         FREE(ser);
45755         return tag_ptr(ret_conv, true);
45756 }
45757
45758 int8_tArray  __attribute__((export_name("TS_TxInitRbf_write"))) TS_TxInitRbf_write(uint64_t obj) {
45759         LDKTxInitRbf obj_conv;
45760         obj_conv.inner = untag_ptr(obj);
45761         obj_conv.is_owned = ptr_is_owned(obj);
45762         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
45763         obj_conv.is_owned = false;
45764         LDKCVec_u8Z ret_var = TxInitRbf_write(&obj_conv);
45765         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
45766         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
45767         CVec_u8Z_free(ret_var);
45768         return ret_arr;
45769 }
45770
45771 uint64_t  __attribute__((export_name("TS_TxInitRbf_read"))) TS_TxInitRbf_read(int8_tArray ser) {
45772         LDKu8slice ser_ref;
45773         ser_ref.datalen = ser->arr_len;
45774         ser_ref.data = ser->elems;
45775         LDKCResult_TxInitRbfDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TxInitRbfDecodeErrorZ), "LDKCResult_TxInitRbfDecodeErrorZ");
45776         *ret_conv = TxInitRbf_read(ser_ref);
45777         FREE(ser);
45778         return tag_ptr(ret_conv, true);
45779 }
45780
45781 int8_tArray  __attribute__((export_name("TS_TxAckRbf_write"))) TS_TxAckRbf_write(uint64_t obj) {
45782         LDKTxAckRbf obj_conv;
45783         obj_conv.inner = untag_ptr(obj);
45784         obj_conv.is_owned = ptr_is_owned(obj);
45785         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
45786         obj_conv.is_owned = false;
45787         LDKCVec_u8Z ret_var = TxAckRbf_write(&obj_conv);
45788         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
45789         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
45790         CVec_u8Z_free(ret_var);
45791         return ret_arr;
45792 }
45793
45794 uint64_t  __attribute__((export_name("TS_TxAckRbf_read"))) TS_TxAckRbf_read(int8_tArray ser) {
45795         LDKu8slice ser_ref;
45796         ser_ref.datalen = ser->arr_len;
45797         ser_ref.data = ser->elems;
45798         LDKCResult_TxAckRbfDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TxAckRbfDecodeErrorZ), "LDKCResult_TxAckRbfDecodeErrorZ");
45799         *ret_conv = TxAckRbf_read(ser_ref);
45800         FREE(ser);
45801         return tag_ptr(ret_conv, true);
45802 }
45803
45804 int8_tArray  __attribute__((export_name("TS_TxAbort_write"))) TS_TxAbort_write(uint64_t obj) {
45805         LDKTxAbort obj_conv;
45806         obj_conv.inner = untag_ptr(obj);
45807         obj_conv.is_owned = ptr_is_owned(obj);
45808         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
45809         obj_conv.is_owned = false;
45810         LDKCVec_u8Z ret_var = TxAbort_write(&obj_conv);
45811         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
45812         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
45813         CVec_u8Z_free(ret_var);
45814         return ret_arr;
45815 }
45816
45817 uint64_t  __attribute__((export_name("TS_TxAbort_read"))) TS_TxAbort_read(int8_tArray ser) {
45818         LDKu8slice ser_ref;
45819         ser_ref.datalen = ser->arr_len;
45820         ser_ref.data = ser->elems;
45821         LDKCResult_TxAbortDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TxAbortDecodeErrorZ), "LDKCResult_TxAbortDecodeErrorZ");
45822         *ret_conv = TxAbort_read(ser_ref);
45823         FREE(ser);
45824         return tag_ptr(ret_conv, true);
45825 }
45826
45827 int8_tArray  __attribute__((export_name("TS_AnnouncementSignatures_write"))) TS_AnnouncementSignatures_write(uint64_t obj) {
45828         LDKAnnouncementSignatures obj_conv;
45829         obj_conv.inner = untag_ptr(obj);
45830         obj_conv.is_owned = ptr_is_owned(obj);
45831         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
45832         obj_conv.is_owned = false;
45833         LDKCVec_u8Z ret_var = AnnouncementSignatures_write(&obj_conv);
45834         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
45835         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
45836         CVec_u8Z_free(ret_var);
45837         return ret_arr;
45838 }
45839
45840 uint64_t  __attribute__((export_name("TS_AnnouncementSignatures_read"))) TS_AnnouncementSignatures_read(int8_tArray ser) {
45841         LDKu8slice ser_ref;
45842         ser_ref.datalen = ser->arr_len;
45843         ser_ref.data = ser->elems;
45844         LDKCResult_AnnouncementSignaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_AnnouncementSignaturesDecodeErrorZ), "LDKCResult_AnnouncementSignaturesDecodeErrorZ");
45845         *ret_conv = AnnouncementSignatures_read(ser_ref);
45846         FREE(ser);
45847         return tag_ptr(ret_conv, true);
45848 }
45849
45850 int8_tArray  __attribute__((export_name("TS_ChannelReestablish_write"))) TS_ChannelReestablish_write(uint64_t obj) {
45851         LDKChannelReestablish obj_conv;
45852         obj_conv.inner = untag_ptr(obj);
45853         obj_conv.is_owned = ptr_is_owned(obj);
45854         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
45855         obj_conv.is_owned = false;
45856         LDKCVec_u8Z ret_var = ChannelReestablish_write(&obj_conv);
45857         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
45858         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
45859         CVec_u8Z_free(ret_var);
45860         return ret_arr;
45861 }
45862
45863 uint64_t  __attribute__((export_name("TS_ChannelReestablish_read"))) TS_ChannelReestablish_read(int8_tArray ser) {
45864         LDKu8slice ser_ref;
45865         ser_ref.datalen = ser->arr_len;
45866         ser_ref.data = ser->elems;
45867         LDKCResult_ChannelReestablishDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelReestablishDecodeErrorZ), "LDKCResult_ChannelReestablishDecodeErrorZ");
45868         *ret_conv = ChannelReestablish_read(ser_ref);
45869         FREE(ser);
45870         return tag_ptr(ret_conv, true);
45871 }
45872
45873 int8_tArray  __attribute__((export_name("TS_ClosingSigned_write"))) TS_ClosingSigned_write(uint64_t obj) {
45874         LDKClosingSigned obj_conv;
45875         obj_conv.inner = untag_ptr(obj);
45876         obj_conv.is_owned = ptr_is_owned(obj);
45877         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
45878         obj_conv.is_owned = false;
45879         LDKCVec_u8Z ret_var = ClosingSigned_write(&obj_conv);
45880         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
45881         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
45882         CVec_u8Z_free(ret_var);
45883         return ret_arr;
45884 }
45885
45886 uint64_t  __attribute__((export_name("TS_ClosingSigned_read"))) TS_ClosingSigned_read(int8_tArray ser) {
45887         LDKu8slice ser_ref;
45888         ser_ref.datalen = ser->arr_len;
45889         ser_ref.data = ser->elems;
45890         LDKCResult_ClosingSignedDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ClosingSignedDecodeErrorZ), "LDKCResult_ClosingSignedDecodeErrorZ");
45891         *ret_conv = ClosingSigned_read(ser_ref);
45892         FREE(ser);
45893         return tag_ptr(ret_conv, true);
45894 }
45895
45896 int8_tArray  __attribute__((export_name("TS_ClosingSignedFeeRange_write"))) TS_ClosingSignedFeeRange_write(uint64_t obj) {
45897         LDKClosingSignedFeeRange obj_conv;
45898         obj_conv.inner = untag_ptr(obj);
45899         obj_conv.is_owned = ptr_is_owned(obj);
45900         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
45901         obj_conv.is_owned = false;
45902         LDKCVec_u8Z ret_var = ClosingSignedFeeRange_write(&obj_conv);
45903         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
45904         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
45905         CVec_u8Z_free(ret_var);
45906         return ret_arr;
45907 }
45908
45909 uint64_t  __attribute__((export_name("TS_ClosingSignedFeeRange_read"))) TS_ClosingSignedFeeRange_read(int8_tArray ser) {
45910         LDKu8slice ser_ref;
45911         ser_ref.datalen = ser->arr_len;
45912         ser_ref.data = ser->elems;
45913         LDKCResult_ClosingSignedFeeRangeDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ClosingSignedFeeRangeDecodeErrorZ), "LDKCResult_ClosingSignedFeeRangeDecodeErrorZ");
45914         *ret_conv = ClosingSignedFeeRange_read(ser_ref);
45915         FREE(ser);
45916         return tag_ptr(ret_conv, true);
45917 }
45918
45919 int8_tArray  __attribute__((export_name("TS_CommitmentSigned_write"))) TS_CommitmentSigned_write(uint64_t obj) {
45920         LDKCommitmentSigned obj_conv;
45921         obj_conv.inner = untag_ptr(obj);
45922         obj_conv.is_owned = ptr_is_owned(obj);
45923         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
45924         obj_conv.is_owned = false;
45925         LDKCVec_u8Z ret_var = CommitmentSigned_write(&obj_conv);
45926         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
45927         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
45928         CVec_u8Z_free(ret_var);
45929         return ret_arr;
45930 }
45931
45932 uint64_t  __attribute__((export_name("TS_CommitmentSigned_read"))) TS_CommitmentSigned_read(int8_tArray ser) {
45933         LDKu8slice ser_ref;
45934         ser_ref.datalen = ser->arr_len;
45935         ser_ref.data = ser->elems;
45936         LDKCResult_CommitmentSignedDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CommitmentSignedDecodeErrorZ), "LDKCResult_CommitmentSignedDecodeErrorZ");
45937         *ret_conv = CommitmentSigned_read(ser_ref);
45938         FREE(ser);
45939         return tag_ptr(ret_conv, true);
45940 }
45941
45942 int8_tArray  __attribute__((export_name("TS_FundingCreated_write"))) TS_FundingCreated_write(uint64_t obj) {
45943         LDKFundingCreated obj_conv;
45944         obj_conv.inner = untag_ptr(obj);
45945         obj_conv.is_owned = ptr_is_owned(obj);
45946         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
45947         obj_conv.is_owned = false;
45948         LDKCVec_u8Z ret_var = FundingCreated_write(&obj_conv);
45949         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
45950         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
45951         CVec_u8Z_free(ret_var);
45952         return ret_arr;
45953 }
45954
45955 uint64_t  __attribute__((export_name("TS_FundingCreated_read"))) TS_FundingCreated_read(int8_tArray ser) {
45956         LDKu8slice ser_ref;
45957         ser_ref.datalen = ser->arr_len;
45958         ser_ref.data = ser->elems;
45959         LDKCResult_FundingCreatedDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_FundingCreatedDecodeErrorZ), "LDKCResult_FundingCreatedDecodeErrorZ");
45960         *ret_conv = FundingCreated_read(ser_ref);
45961         FREE(ser);
45962         return tag_ptr(ret_conv, true);
45963 }
45964
45965 int8_tArray  __attribute__((export_name("TS_FundingSigned_write"))) TS_FundingSigned_write(uint64_t obj) {
45966         LDKFundingSigned obj_conv;
45967         obj_conv.inner = untag_ptr(obj);
45968         obj_conv.is_owned = ptr_is_owned(obj);
45969         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
45970         obj_conv.is_owned = false;
45971         LDKCVec_u8Z ret_var = FundingSigned_write(&obj_conv);
45972         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
45973         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
45974         CVec_u8Z_free(ret_var);
45975         return ret_arr;
45976 }
45977
45978 uint64_t  __attribute__((export_name("TS_FundingSigned_read"))) TS_FundingSigned_read(int8_tArray ser) {
45979         LDKu8slice ser_ref;
45980         ser_ref.datalen = ser->arr_len;
45981         ser_ref.data = ser->elems;
45982         LDKCResult_FundingSignedDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_FundingSignedDecodeErrorZ), "LDKCResult_FundingSignedDecodeErrorZ");
45983         *ret_conv = FundingSigned_read(ser_ref);
45984         FREE(ser);
45985         return tag_ptr(ret_conv, true);
45986 }
45987
45988 int8_tArray  __attribute__((export_name("TS_ChannelReady_write"))) TS_ChannelReady_write(uint64_t obj) {
45989         LDKChannelReady obj_conv;
45990         obj_conv.inner = untag_ptr(obj);
45991         obj_conv.is_owned = ptr_is_owned(obj);
45992         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
45993         obj_conv.is_owned = false;
45994         LDKCVec_u8Z ret_var = ChannelReady_write(&obj_conv);
45995         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
45996         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
45997         CVec_u8Z_free(ret_var);
45998         return ret_arr;
45999 }
46000
46001 uint64_t  __attribute__((export_name("TS_ChannelReady_read"))) TS_ChannelReady_read(int8_tArray ser) {
46002         LDKu8slice ser_ref;
46003         ser_ref.datalen = ser->arr_len;
46004         ser_ref.data = ser->elems;
46005         LDKCResult_ChannelReadyDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelReadyDecodeErrorZ), "LDKCResult_ChannelReadyDecodeErrorZ");
46006         *ret_conv = ChannelReady_read(ser_ref);
46007         FREE(ser);
46008         return tag_ptr(ret_conv, true);
46009 }
46010
46011 int8_tArray  __attribute__((export_name("TS_Init_write"))) TS_Init_write(uint64_t obj) {
46012         LDKInit obj_conv;
46013         obj_conv.inner = untag_ptr(obj);
46014         obj_conv.is_owned = ptr_is_owned(obj);
46015         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
46016         obj_conv.is_owned = false;
46017         LDKCVec_u8Z ret_var = Init_write(&obj_conv);
46018         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
46019         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
46020         CVec_u8Z_free(ret_var);
46021         return ret_arr;
46022 }
46023
46024 uint64_t  __attribute__((export_name("TS_Init_read"))) TS_Init_read(int8_tArray ser) {
46025         LDKu8slice ser_ref;
46026         ser_ref.datalen = ser->arr_len;
46027         ser_ref.data = ser->elems;
46028         LDKCResult_InitDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InitDecodeErrorZ), "LDKCResult_InitDecodeErrorZ");
46029         *ret_conv = Init_read(ser_ref);
46030         FREE(ser);
46031         return tag_ptr(ret_conv, true);
46032 }
46033
46034 int8_tArray  __attribute__((export_name("TS_OpenChannel_write"))) TS_OpenChannel_write(uint64_t obj) {
46035         LDKOpenChannel obj_conv;
46036         obj_conv.inner = untag_ptr(obj);
46037         obj_conv.is_owned = ptr_is_owned(obj);
46038         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
46039         obj_conv.is_owned = false;
46040         LDKCVec_u8Z ret_var = OpenChannel_write(&obj_conv);
46041         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
46042         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
46043         CVec_u8Z_free(ret_var);
46044         return ret_arr;
46045 }
46046
46047 uint64_t  __attribute__((export_name("TS_OpenChannel_read"))) TS_OpenChannel_read(int8_tArray ser) {
46048         LDKu8slice ser_ref;
46049         ser_ref.datalen = ser->arr_len;
46050         ser_ref.data = ser->elems;
46051         LDKCResult_OpenChannelDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_OpenChannelDecodeErrorZ), "LDKCResult_OpenChannelDecodeErrorZ");
46052         *ret_conv = OpenChannel_read(ser_ref);
46053         FREE(ser);
46054         return tag_ptr(ret_conv, true);
46055 }
46056
46057 int8_tArray  __attribute__((export_name("TS_OpenChannelV2_write"))) TS_OpenChannelV2_write(uint64_t obj) {
46058         LDKOpenChannelV2 obj_conv;
46059         obj_conv.inner = untag_ptr(obj);
46060         obj_conv.is_owned = ptr_is_owned(obj);
46061         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
46062         obj_conv.is_owned = false;
46063         LDKCVec_u8Z ret_var = OpenChannelV2_write(&obj_conv);
46064         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
46065         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
46066         CVec_u8Z_free(ret_var);
46067         return ret_arr;
46068 }
46069
46070 uint64_t  __attribute__((export_name("TS_OpenChannelV2_read"))) TS_OpenChannelV2_read(int8_tArray ser) {
46071         LDKu8slice ser_ref;
46072         ser_ref.datalen = ser->arr_len;
46073         ser_ref.data = ser->elems;
46074         LDKCResult_OpenChannelV2DecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_OpenChannelV2DecodeErrorZ), "LDKCResult_OpenChannelV2DecodeErrorZ");
46075         *ret_conv = OpenChannelV2_read(ser_ref);
46076         FREE(ser);
46077         return tag_ptr(ret_conv, true);
46078 }
46079
46080 int8_tArray  __attribute__((export_name("TS_RevokeAndACK_write"))) TS_RevokeAndACK_write(uint64_t obj) {
46081         LDKRevokeAndACK obj_conv;
46082         obj_conv.inner = untag_ptr(obj);
46083         obj_conv.is_owned = ptr_is_owned(obj);
46084         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
46085         obj_conv.is_owned = false;
46086         LDKCVec_u8Z ret_var = RevokeAndACK_write(&obj_conv);
46087         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
46088         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
46089         CVec_u8Z_free(ret_var);
46090         return ret_arr;
46091 }
46092
46093 uint64_t  __attribute__((export_name("TS_RevokeAndACK_read"))) TS_RevokeAndACK_read(int8_tArray ser) {
46094         LDKu8slice ser_ref;
46095         ser_ref.datalen = ser->arr_len;
46096         ser_ref.data = ser->elems;
46097         LDKCResult_RevokeAndACKDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RevokeAndACKDecodeErrorZ), "LDKCResult_RevokeAndACKDecodeErrorZ");
46098         *ret_conv = RevokeAndACK_read(ser_ref);
46099         FREE(ser);
46100         return tag_ptr(ret_conv, true);
46101 }
46102
46103 int8_tArray  __attribute__((export_name("TS_Shutdown_write"))) TS_Shutdown_write(uint64_t obj) {
46104         LDKShutdown obj_conv;
46105         obj_conv.inner = untag_ptr(obj);
46106         obj_conv.is_owned = ptr_is_owned(obj);
46107         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
46108         obj_conv.is_owned = false;
46109         LDKCVec_u8Z ret_var = Shutdown_write(&obj_conv);
46110         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
46111         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
46112         CVec_u8Z_free(ret_var);
46113         return ret_arr;
46114 }
46115
46116 uint64_t  __attribute__((export_name("TS_Shutdown_read"))) TS_Shutdown_read(int8_tArray ser) {
46117         LDKu8slice ser_ref;
46118         ser_ref.datalen = ser->arr_len;
46119         ser_ref.data = ser->elems;
46120         LDKCResult_ShutdownDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ShutdownDecodeErrorZ), "LDKCResult_ShutdownDecodeErrorZ");
46121         *ret_conv = Shutdown_read(ser_ref);
46122         FREE(ser);
46123         return tag_ptr(ret_conv, true);
46124 }
46125
46126 int8_tArray  __attribute__((export_name("TS_UpdateFailHTLC_write"))) TS_UpdateFailHTLC_write(uint64_t obj) {
46127         LDKUpdateFailHTLC obj_conv;
46128         obj_conv.inner = untag_ptr(obj);
46129         obj_conv.is_owned = ptr_is_owned(obj);
46130         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
46131         obj_conv.is_owned = false;
46132         LDKCVec_u8Z ret_var = UpdateFailHTLC_write(&obj_conv);
46133         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
46134         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
46135         CVec_u8Z_free(ret_var);
46136         return ret_arr;
46137 }
46138
46139 uint64_t  __attribute__((export_name("TS_UpdateFailHTLC_read"))) TS_UpdateFailHTLC_read(int8_tArray ser) {
46140         LDKu8slice ser_ref;
46141         ser_ref.datalen = ser->arr_len;
46142         ser_ref.data = ser->elems;
46143         LDKCResult_UpdateFailHTLCDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UpdateFailHTLCDecodeErrorZ), "LDKCResult_UpdateFailHTLCDecodeErrorZ");
46144         *ret_conv = UpdateFailHTLC_read(ser_ref);
46145         FREE(ser);
46146         return tag_ptr(ret_conv, true);
46147 }
46148
46149 int8_tArray  __attribute__((export_name("TS_UpdateFailMalformedHTLC_write"))) TS_UpdateFailMalformedHTLC_write(uint64_t obj) {
46150         LDKUpdateFailMalformedHTLC obj_conv;
46151         obj_conv.inner = untag_ptr(obj);
46152         obj_conv.is_owned = ptr_is_owned(obj);
46153         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
46154         obj_conv.is_owned = false;
46155         LDKCVec_u8Z ret_var = UpdateFailMalformedHTLC_write(&obj_conv);
46156         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
46157         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
46158         CVec_u8Z_free(ret_var);
46159         return ret_arr;
46160 }
46161
46162 uint64_t  __attribute__((export_name("TS_UpdateFailMalformedHTLC_read"))) TS_UpdateFailMalformedHTLC_read(int8_tArray ser) {
46163         LDKu8slice ser_ref;
46164         ser_ref.datalen = ser->arr_len;
46165         ser_ref.data = ser->elems;
46166         LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ), "LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ");
46167         *ret_conv = UpdateFailMalformedHTLC_read(ser_ref);
46168         FREE(ser);
46169         return tag_ptr(ret_conv, true);
46170 }
46171
46172 int8_tArray  __attribute__((export_name("TS_UpdateFee_write"))) TS_UpdateFee_write(uint64_t obj) {
46173         LDKUpdateFee obj_conv;
46174         obj_conv.inner = untag_ptr(obj);
46175         obj_conv.is_owned = ptr_is_owned(obj);
46176         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
46177         obj_conv.is_owned = false;
46178         LDKCVec_u8Z ret_var = UpdateFee_write(&obj_conv);
46179         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
46180         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
46181         CVec_u8Z_free(ret_var);
46182         return ret_arr;
46183 }
46184
46185 uint64_t  __attribute__((export_name("TS_UpdateFee_read"))) TS_UpdateFee_read(int8_tArray ser) {
46186         LDKu8slice ser_ref;
46187         ser_ref.datalen = ser->arr_len;
46188         ser_ref.data = ser->elems;
46189         LDKCResult_UpdateFeeDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UpdateFeeDecodeErrorZ), "LDKCResult_UpdateFeeDecodeErrorZ");
46190         *ret_conv = UpdateFee_read(ser_ref);
46191         FREE(ser);
46192         return tag_ptr(ret_conv, true);
46193 }
46194
46195 int8_tArray  __attribute__((export_name("TS_UpdateFulfillHTLC_write"))) TS_UpdateFulfillHTLC_write(uint64_t obj) {
46196         LDKUpdateFulfillHTLC obj_conv;
46197         obj_conv.inner = untag_ptr(obj);
46198         obj_conv.is_owned = ptr_is_owned(obj);
46199         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
46200         obj_conv.is_owned = false;
46201         LDKCVec_u8Z ret_var = UpdateFulfillHTLC_write(&obj_conv);
46202         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
46203         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
46204         CVec_u8Z_free(ret_var);
46205         return ret_arr;
46206 }
46207
46208 uint64_t  __attribute__((export_name("TS_UpdateFulfillHTLC_read"))) TS_UpdateFulfillHTLC_read(int8_tArray ser) {
46209         LDKu8slice ser_ref;
46210         ser_ref.datalen = ser->arr_len;
46211         ser_ref.data = ser->elems;
46212         LDKCResult_UpdateFulfillHTLCDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UpdateFulfillHTLCDecodeErrorZ), "LDKCResult_UpdateFulfillHTLCDecodeErrorZ");
46213         *ret_conv = UpdateFulfillHTLC_read(ser_ref);
46214         FREE(ser);
46215         return tag_ptr(ret_conv, true);
46216 }
46217
46218 int8_tArray  __attribute__((export_name("TS_UpdateAddHTLC_write"))) TS_UpdateAddHTLC_write(uint64_t obj) {
46219         LDKUpdateAddHTLC obj_conv;
46220         obj_conv.inner = untag_ptr(obj);
46221         obj_conv.is_owned = ptr_is_owned(obj);
46222         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
46223         obj_conv.is_owned = false;
46224         LDKCVec_u8Z ret_var = UpdateAddHTLC_write(&obj_conv);
46225         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
46226         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
46227         CVec_u8Z_free(ret_var);
46228         return ret_arr;
46229 }
46230
46231 uint64_t  __attribute__((export_name("TS_UpdateAddHTLC_read"))) TS_UpdateAddHTLC_read(int8_tArray ser) {
46232         LDKu8slice ser_ref;
46233         ser_ref.datalen = ser->arr_len;
46234         ser_ref.data = ser->elems;
46235         LDKCResult_UpdateAddHTLCDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UpdateAddHTLCDecodeErrorZ), "LDKCResult_UpdateAddHTLCDecodeErrorZ");
46236         *ret_conv = UpdateAddHTLC_read(ser_ref);
46237         FREE(ser);
46238         return tag_ptr(ret_conv, true);
46239 }
46240
46241 uint64_t  __attribute__((export_name("TS_OnionMessage_read"))) TS_OnionMessage_read(int8_tArray ser) {
46242         LDKu8slice ser_ref;
46243         ser_ref.datalen = ser->arr_len;
46244         ser_ref.data = ser->elems;
46245         LDKCResult_OnionMessageDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_OnionMessageDecodeErrorZ), "LDKCResult_OnionMessageDecodeErrorZ");
46246         *ret_conv = OnionMessage_read(ser_ref);
46247         FREE(ser);
46248         return tag_ptr(ret_conv, true);
46249 }
46250
46251 int8_tArray  __attribute__((export_name("TS_OnionMessage_write"))) TS_OnionMessage_write(uint64_t obj) {
46252         LDKOnionMessage obj_conv;
46253         obj_conv.inner = untag_ptr(obj);
46254         obj_conv.is_owned = ptr_is_owned(obj);
46255         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
46256         obj_conv.is_owned = false;
46257         LDKCVec_u8Z ret_var = OnionMessage_write(&obj_conv);
46258         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
46259         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
46260         CVec_u8Z_free(ret_var);
46261         return ret_arr;
46262 }
46263
46264 int8_tArray  __attribute__((export_name("TS_Ping_write"))) TS_Ping_write(uint64_t obj) {
46265         LDKPing obj_conv;
46266         obj_conv.inner = untag_ptr(obj);
46267         obj_conv.is_owned = ptr_is_owned(obj);
46268         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
46269         obj_conv.is_owned = false;
46270         LDKCVec_u8Z ret_var = Ping_write(&obj_conv);
46271         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
46272         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
46273         CVec_u8Z_free(ret_var);
46274         return ret_arr;
46275 }
46276
46277 uint64_t  __attribute__((export_name("TS_Ping_read"))) TS_Ping_read(int8_tArray ser) {
46278         LDKu8slice ser_ref;
46279         ser_ref.datalen = ser->arr_len;
46280         ser_ref.data = ser->elems;
46281         LDKCResult_PingDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PingDecodeErrorZ), "LDKCResult_PingDecodeErrorZ");
46282         *ret_conv = Ping_read(ser_ref);
46283         FREE(ser);
46284         return tag_ptr(ret_conv, true);
46285 }
46286
46287 int8_tArray  __attribute__((export_name("TS_Pong_write"))) TS_Pong_write(uint64_t obj) {
46288         LDKPong obj_conv;
46289         obj_conv.inner = untag_ptr(obj);
46290         obj_conv.is_owned = ptr_is_owned(obj);
46291         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
46292         obj_conv.is_owned = false;
46293         LDKCVec_u8Z ret_var = Pong_write(&obj_conv);
46294         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
46295         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
46296         CVec_u8Z_free(ret_var);
46297         return ret_arr;
46298 }
46299
46300 uint64_t  __attribute__((export_name("TS_Pong_read"))) TS_Pong_read(int8_tArray ser) {
46301         LDKu8slice ser_ref;
46302         ser_ref.datalen = ser->arr_len;
46303         ser_ref.data = ser->elems;
46304         LDKCResult_PongDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PongDecodeErrorZ), "LDKCResult_PongDecodeErrorZ");
46305         *ret_conv = Pong_read(ser_ref);
46306         FREE(ser);
46307         return tag_ptr(ret_conv, true);
46308 }
46309
46310 int8_tArray  __attribute__((export_name("TS_UnsignedChannelAnnouncement_write"))) TS_UnsignedChannelAnnouncement_write(uint64_t obj) {
46311         LDKUnsignedChannelAnnouncement obj_conv;
46312         obj_conv.inner = untag_ptr(obj);
46313         obj_conv.is_owned = ptr_is_owned(obj);
46314         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
46315         obj_conv.is_owned = false;
46316         LDKCVec_u8Z ret_var = UnsignedChannelAnnouncement_write(&obj_conv);
46317         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
46318         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
46319         CVec_u8Z_free(ret_var);
46320         return ret_arr;
46321 }
46322
46323 uint64_t  __attribute__((export_name("TS_UnsignedChannelAnnouncement_read"))) TS_UnsignedChannelAnnouncement_read(int8_tArray ser) {
46324         LDKu8slice ser_ref;
46325         ser_ref.datalen = ser->arr_len;
46326         ser_ref.data = ser->elems;
46327         LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ), "LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ");
46328         *ret_conv = UnsignedChannelAnnouncement_read(ser_ref);
46329         FREE(ser);
46330         return tag_ptr(ret_conv, true);
46331 }
46332
46333 int8_tArray  __attribute__((export_name("TS_ChannelAnnouncement_write"))) TS_ChannelAnnouncement_write(uint64_t obj) {
46334         LDKChannelAnnouncement obj_conv;
46335         obj_conv.inner = untag_ptr(obj);
46336         obj_conv.is_owned = ptr_is_owned(obj);
46337         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
46338         obj_conv.is_owned = false;
46339         LDKCVec_u8Z ret_var = ChannelAnnouncement_write(&obj_conv);
46340         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
46341         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
46342         CVec_u8Z_free(ret_var);
46343         return ret_arr;
46344 }
46345
46346 uint64_t  __attribute__((export_name("TS_ChannelAnnouncement_read"))) TS_ChannelAnnouncement_read(int8_tArray ser) {
46347         LDKu8slice ser_ref;
46348         ser_ref.datalen = ser->arr_len;
46349         ser_ref.data = ser->elems;
46350         LDKCResult_ChannelAnnouncementDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelAnnouncementDecodeErrorZ), "LDKCResult_ChannelAnnouncementDecodeErrorZ");
46351         *ret_conv = ChannelAnnouncement_read(ser_ref);
46352         FREE(ser);
46353         return tag_ptr(ret_conv, true);
46354 }
46355
46356 int8_tArray  __attribute__((export_name("TS_UnsignedChannelUpdate_write"))) TS_UnsignedChannelUpdate_write(uint64_t obj) {
46357         LDKUnsignedChannelUpdate obj_conv;
46358         obj_conv.inner = untag_ptr(obj);
46359         obj_conv.is_owned = ptr_is_owned(obj);
46360         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
46361         obj_conv.is_owned = false;
46362         LDKCVec_u8Z ret_var = UnsignedChannelUpdate_write(&obj_conv);
46363         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
46364         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
46365         CVec_u8Z_free(ret_var);
46366         return ret_arr;
46367 }
46368
46369 uint64_t  __attribute__((export_name("TS_UnsignedChannelUpdate_read"))) TS_UnsignedChannelUpdate_read(int8_tArray ser) {
46370         LDKu8slice ser_ref;
46371         ser_ref.datalen = ser->arr_len;
46372         ser_ref.data = ser->elems;
46373         LDKCResult_UnsignedChannelUpdateDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UnsignedChannelUpdateDecodeErrorZ), "LDKCResult_UnsignedChannelUpdateDecodeErrorZ");
46374         *ret_conv = UnsignedChannelUpdate_read(ser_ref);
46375         FREE(ser);
46376         return tag_ptr(ret_conv, true);
46377 }
46378
46379 int8_tArray  __attribute__((export_name("TS_ChannelUpdate_write"))) TS_ChannelUpdate_write(uint64_t obj) {
46380         LDKChannelUpdate obj_conv;
46381         obj_conv.inner = untag_ptr(obj);
46382         obj_conv.is_owned = ptr_is_owned(obj);
46383         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
46384         obj_conv.is_owned = false;
46385         LDKCVec_u8Z ret_var = ChannelUpdate_write(&obj_conv);
46386         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
46387         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
46388         CVec_u8Z_free(ret_var);
46389         return ret_arr;
46390 }
46391
46392 uint64_t  __attribute__((export_name("TS_ChannelUpdate_read"))) TS_ChannelUpdate_read(int8_tArray ser) {
46393         LDKu8slice ser_ref;
46394         ser_ref.datalen = ser->arr_len;
46395         ser_ref.data = ser->elems;
46396         LDKCResult_ChannelUpdateDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelUpdateDecodeErrorZ), "LDKCResult_ChannelUpdateDecodeErrorZ");
46397         *ret_conv = ChannelUpdate_read(ser_ref);
46398         FREE(ser);
46399         return tag_ptr(ret_conv, true);
46400 }
46401
46402 int8_tArray  __attribute__((export_name("TS_ErrorMessage_write"))) TS_ErrorMessage_write(uint64_t obj) {
46403         LDKErrorMessage obj_conv;
46404         obj_conv.inner = untag_ptr(obj);
46405         obj_conv.is_owned = ptr_is_owned(obj);
46406         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
46407         obj_conv.is_owned = false;
46408         LDKCVec_u8Z ret_var = ErrorMessage_write(&obj_conv);
46409         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
46410         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
46411         CVec_u8Z_free(ret_var);
46412         return ret_arr;
46413 }
46414
46415 uint64_t  __attribute__((export_name("TS_ErrorMessage_read"))) TS_ErrorMessage_read(int8_tArray ser) {
46416         LDKu8slice ser_ref;
46417         ser_ref.datalen = ser->arr_len;
46418         ser_ref.data = ser->elems;
46419         LDKCResult_ErrorMessageDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ErrorMessageDecodeErrorZ), "LDKCResult_ErrorMessageDecodeErrorZ");
46420         *ret_conv = ErrorMessage_read(ser_ref);
46421         FREE(ser);
46422         return tag_ptr(ret_conv, true);
46423 }
46424
46425 int8_tArray  __attribute__((export_name("TS_WarningMessage_write"))) TS_WarningMessage_write(uint64_t obj) {
46426         LDKWarningMessage obj_conv;
46427         obj_conv.inner = untag_ptr(obj);
46428         obj_conv.is_owned = ptr_is_owned(obj);
46429         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
46430         obj_conv.is_owned = false;
46431         LDKCVec_u8Z ret_var = WarningMessage_write(&obj_conv);
46432         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
46433         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
46434         CVec_u8Z_free(ret_var);
46435         return ret_arr;
46436 }
46437
46438 uint64_t  __attribute__((export_name("TS_WarningMessage_read"))) TS_WarningMessage_read(int8_tArray ser) {
46439         LDKu8slice ser_ref;
46440         ser_ref.datalen = ser->arr_len;
46441         ser_ref.data = ser->elems;
46442         LDKCResult_WarningMessageDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_WarningMessageDecodeErrorZ), "LDKCResult_WarningMessageDecodeErrorZ");
46443         *ret_conv = WarningMessage_read(ser_ref);
46444         FREE(ser);
46445         return tag_ptr(ret_conv, true);
46446 }
46447
46448 int8_tArray  __attribute__((export_name("TS_UnsignedNodeAnnouncement_write"))) TS_UnsignedNodeAnnouncement_write(uint64_t obj) {
46449         LDKUnsignedNodeAnnouncement obj_conv;
46450         obj_conv.inner = untag_ptr(obj);
46451         obj_conv.is_owned = ptr_is_owned(obj);
46452         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
46453         obj_conv.is_owned = false;
46454         LDKCVec_u8Z ret_var = UnsignedNodeAnnouncement_write(&obj_conv);
46455         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
46456         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
46457         CVec_u8Z_free(ret_var);
46458         return ret_arr;
46459 }
46460
46461 uint64_t  __attribute__((export_name("TS_UnsignedNodeAnnouncement_read"))) TS_UnsignedNodeAnnouncement_read(int8_tArray ser) {
46462         LDKu8slice ser_ref;
46463         ser_ref.datalen = ser->arr_len;
46464         ser_ref.data = ser->elems;
46465         LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ), "LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ");
46466         *ret_conv = UnsignedNodeAnnouncement_read(ser_ref);
46467         FREE(ser);
46468         return tag_ptr(ret_conv, true);
46469 }
46470
46471 int8_tArray  __attribute__((export_name("TS_NodeAnnouncement_write"))) TS_NodeAnnouncement_write(uint64_t obj) {
46472         LDKNodeAnnouncement obj_conv;
46473         obj_conv.inner = untag_ptr(obj);
46474         obj_conv.is_owned = ptr_is_owned(obj);
46475         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
46476         obj_conv.is_owned = false;
46477         LDKCVec_u8Z ret_var = NodeAnnouncement_write(&obj_conv);
46478         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
46479         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
46480         CVec_u8Z_free(ret_var);
46481         return ret_arr;
46482 }
46483
46484 uint64_t  __attribute__((export_name("TS_NodeAnnouncement_read"))) TS_NodeAnnouncement_read(int8_tArray ser) {
46485         LDKu8slice ser_ref;
46486         ser_ref.datalen = ser->arr_len;
46487         ser_ref.data = ser->elems;
46488         LDKCResult_NodeAnnouncementDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NodeAnnouncementDecodeErrorZ), "LDKCResult_NodeAnnouncementDecodeErrorZ");
46489         *ret_conv = NodeAnnouncement_read(ser_ref);
46490         FREE(ser);
46491         return tag_ptr(ret_conv, true);
46492 }
46493
46494 uint64_t  __attribute__((export_name("TS_QueryShortChannelIds_read"))) TS_QueryShortChannelIds_read(int8_tArray ser) {
46495         LDKu8slice ser_ref;
46496         ser_ref.datalen = ser->arr_len;
46497         ser_ref.data = ser->elems;
46498         LDKCResult_QueryShortChannelIdsDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_QueryShortChannelIdsDecodeErrorZ), "LDKCResult_QueryShortChannelIdsDecodeErrorZ");
46499         *ret_conv = QueryShortChannelIds_read(ser_ref);
46500         FREE(ser);
46501         return tag_ptr(ret_conv, true);
46502 }
46503
46504 int8_tArray  __attribute__((export_name("TS_QueryShortChannelIds_write"))) TS_QueryShortChannelIds_write(uint64_t obj) {
46505         LDKQueryShortChannelIds obj_conv;
46506         obj_conv.inner = untag_ptr(obj);
46507         obj_conv.is_owned = ptr_is_owned(obj);
46508         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
46509         obj_conv.is_owned = false;
46510         LDKCVec_u8Z ret_var = QueryShortChannelIds_write(&obj_conv);
46511         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
46512         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
46513         CVec_u8Z_free(ret_var);
46514         return ret_arr;
46515 }
46516
46517 int8_tArray  __attribute__((export_name("TS_ReplyShortChannelIdsEnd_write"))) TS_ReplyShortChannelIdsEnd_write(uint64_t obj) {
46518         LDKReplyShortChannelIdsEnd obj_conv;
46519         obj_conv.inner = untag_ptr(obj);
46520         obj_conv.is_owned = ptr_is_owned(obj);
46521         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
46522         obj_conv.is_owned = false;
46523         LDKCVec_u8Z ret_var = ReplyShortChannelIdsEnd_write(&obj_conv);
46524         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
46525         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
46526         CVec_u8Z_free(ret_var);
46527         return ret_arr;
46528 }
46529
46530 uint64_t  __attribute__((export_name("TS_ReplyShortChannelIdsEnd_read"))) TS_ReplyShortChannelIdsEnd_read(int8_tArray ser) {
46531         LDKu8slice ser_ref;
46532         ser_ref.datalen = ser->arr_len;
46533         ser_ref.data = ser->elems;
46534         LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ), "LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ");
46535         *ret_conv = ReplyShortChannelIdsEnd_read(ser_ref);
46536         FREE(ser);
46537         return tag_ptr(ret_conv, true);
46538 }
46539
46540 int32_t  __attribute__((export_name("TS_QueryChannelRange_end_blocknum"))) TS_QueryChannelRange_end_blocknum(uint64_t this_arg) {
46541         LDKQueryChannelRange this_arg_conv;
46542         this_arg_conv.inner = untag_ptr(this_arg);
46543         this_arg_conv.is_owned = ptr_is_owned(this_arg);
46544         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
46545         this_arg_conv.is_owned = false;
46546         int32_t ret_conv = QueryChannelRange_end_blocknum(&this_arg_conv);
46547         return ret_conv;
46548 }
46549
46550 int8_tArray  __attribute__((export_name("TS_QueryChannelRange_write"))) TS_QueryChannelRange_write(uint64_t obj) {
46551         LDKQueryChannelRange obj_conv;
46552         obj_conv.inner = untag_ptr(obj);
46553         obj_conv.is_owned = ptr_is_owned(obj);
46554         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
46555         obj_conv.is_owned = false;
46556         LDKCVec_u8Z ret_var = QueryChannelRange_write(&obj_conv);
46557         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
46558         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
46559         CVec_u8Z_free(ret_var);
46560         return ret_arr;
46561 }
46562
46563 uint64_t  __attribute__((export_name("TS_QueryChannelRange_read"))) TS_QueryChannelRange_read(int8_tArray ser) {
46564         LDKu8slice ser_ref;
46565         ser_ref.datalen = ser->arr_len;
46566         ser_ref.data = ser->elems;
46567         LDKCResult_QueryChannelRangeDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_QueryChannelRangeDecodeErrorZ), "LDKCResult_QueryChannelRangeDecodeErrorZ");
46568         *ret_conv = QueryChannelRange_read(ser_ref);
46569         FREE(ser);
46570         return tag_ptr(ret_conv, true);
46571 }
46572
46573 uint64_t  __attribute__((export_name("TS_ReplyChannelRange_read"))) TS_ReplyChannelRange_read(int8_tArray ser) {
46574         LDKu8slice ser_ref;
46575         ser_ref.datalen = ser->arr_len;
46576         ser_ref.data = ser->elems;
46577         LDKCResult_ReplyChannelRangeDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ReplyChannelRangeDecodeErrorZ), "LDKCResult_ReplyChannelRangeDecodeErrorZ");
46578         *ret_conv = ReplyChannelRange_read(ser_ref);
46579         FREE(ser);
46580         return tag_ptr(ret_conv, true);
46581 }
46582
46583 int8_tArray  __attribute__((export_name("TS_ReplyChannelRange_write"))) TS_ReplyChannelRange_write(uint64_t obj) {
46584         LDKReplyChannelRange obj_conv;
46585         obj_conv.inner = untag_ptr(obj);
46586         obj_conv.is_owned = ptr_is_owned(obj);
46587         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
46588         obj_conv.is_owned = false;
46589         LDKCVec_u8Z ret_var = ReplyChannelRange_write(&obj_conv);
46590         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
46591         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
46592         CVec_u8Z_free(ret_var);
46593         return ret_arr;
46594 }
46595
46596 int8_tArray  __attribute__((export_name("TS_GossipTimestampFilter_write"))) TS_GossipTimestampFilter_write(uint64_t obj) {
46597         LDKGossipTimestampFilter obj_conv;
46598         obj_conv.inner = untag_ptr(obj);
46599         obj_conv.is_owned = ptr_is_owned(obj);
46600         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
46601         obj_conv.is_owned = false;
46602         LDKCVec_u8Z ret_var = GossipTimestampFilter_write(&obj_conv);
46603         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
46604         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
46605         CVec_u8Z_free(ret_var);
46606         return ret_arr;
46607 }
46608
46609 uint64_t  __attribute__((export_name("TS_GossipTimestampFilter_read"))) TS_GossipTimestampFilter_read(int8_tArray ser) {
46610         LDKu8slice ser_ref;
46611         ser_ref.datalen = ser->arr_len;
46612         ser_ref.data = ser->elems;
46613         LDKCResult_GossipTimestampFilterDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_GossipTimestampFilterDecodeErrorZ), "LDKCResult_GossipTimestampFilterDecodeErrorZ");
46614         *ret_conv = GossipTimestampFilter_read(ser_ref);
46615         FREE(ser);
46616         return tag_ptr(ret_conv, true);
46617 }
46618
46619 void  __attribute__((export_name("TS_CustomMessageHandler_free"))) TS_CustomMessageHandler_free(uint64_t this_ptr) {
46620         if (!ptr_is_owned(this_ptr)) return;
46621         void* this_ptr_ptr = untag_ptr(this_ptr);
46622         CHECK_ACCESS(this_ptr_ptr);
46623         LDKCustomMessageHandler this_ptr_conv = *(LDKCustomMessageHandler*)(this_ptr_ptr);
46624         FREE(untag_ptr(this_ptr));
46625         CustomMessageHandler_free(this_ptr_conv);
46626 }
46627
46628 void  __attribute__((export_name("TS_IgnoringMessageHandler_free"))) TS_IgnoringMessageHandler_free(uint64_t this_obj) {
46629         LDKIgnoringMessageHandler this_obj_conv;
46630         this_obj_conv.inner = untag_ptr(this_obj);
46631         this_obj_conv.is_owned = ptr_is_owned(this_obj);
46632         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
46633         IgnoringMessageHandler_free(this_obj_conv);
46634 }
46635
46636 uint64_t  __attribute__((export_name("TS_IgnoringMessageHandler_new"))) TS_IgnoringMessageHandler_new() {
46637         LDKIgnoringMessageHandler ret_var = IgnoringMessageHandler_new();
46638         uint64_t ret_ref = 0;
46639         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
46640         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
46641         return ret_ref;
46642 }
46643
46644 uint64_t  __attribute__((export_name("TS_IgnoringMessageHandler_as_MessageSendEventsProvider"))) TS_IgnoringMessageHandler_as_MessageSendEventsProvider(uint64_t this_arg) {
46645         LDKIgnoringMessageHandler this_arg_conv;
46646         this_arg_conv.inner = untag_ptr(this_arg);
46647         this_arg_conv.is_owned = ptr_is_owned(this_arg);
46648         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
46649         this_arg_conv.is_owned = false;
46650         LDKMessageSendEventsProvider* ret_ret = MALLOC(sizeof(LDKMessageSendEventsProvider), "LDKMessageSendEventsProvider");
46651         *ret_ret = IgnoringMessageHandler_as_MessageSendEventsProvider(&this_arg_conv);
46652         return tag_ptr(ret_ret, true);
46653 }
46654
46655 uint64_t  __attribute__((export_name("TS_IgnoringMessageHandler_as_RoutingMessageHandler"))) TS_IgnoringMessageHandler_as_RoutingMessageHandler(uint64_t this_arg) {
46656         LDKIgnoringMessageHandler this_arg_conv;
46657         this_arg_conv.inner = untag_ptr(this_arg);
46658         this_arg_conv.is_owned = ptr_is_owned(this_arg);
46659         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
46660         this_arg_conv.is_owned = false;
46661         LDKRoutingMessageHandler* ret_ret = MALLOC(sizeof(LDKRoutingMessageHandler), "LDKRoutingMessageHandler");
46662         *ret_ret = IgnoringMessageHandler_as_RoutingMessageHandler(&this_arg_conv);
46663         return tag_ptr(ret_ret, true);
46664 }
46665
46666 uint64_t  __attribute__((export_name("TS_IgnoringMessageHandler_as_OnionMessageHandler"))) TS_IgnoringMessageHandler_as_OnionMessageHandler(uint64_t this_arg) {
46667         LDKIgnoringMessageHandler this_arg_conv;
46668         this_arg_conv.inner = untag_ptr(this_arg);
46669         this_arg_conv.is_owned = ptr_is_owned(this_arg);
46670         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
46671         this_arg_conv.is_owned = false;
46672         LDKOnionMessageHandler* ret_ret = MALLOC(sizeof(LDKOnionMessageHandler), "LDKOnionMessageHandler");
46673         *ret_ret = IgnoringMessageHandler_as_OnionMessageHandler(&this_arg_conv);
46674         return tag_ptr(ret_ret, true);
46675 }
46676
46677 uint64_t  __attribute__((export_name("TS_IgnoringMessageHandler_as_OffersMessageHandler"))) TS_IgnoringMessageHandler_as_OffersMessageHandler(uint64_t this_arg) {
46678         LDKIgnoringMessageHandler this_arg_conv;
46679         this_arg_conv.inner = untag_ptr(this_arg);
46680         this_arg_conv.is_owned = ptr_is_owned(this_arg);
46681         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
46682         this_arg_conv.is_owned = false;
46683         LDKOffersMessageHandler* ret_ret = MALLOC(sizeof(LDKOffersMessageHandler), "LDKOffersMessageHandler");
46684         *ret_ret = IgnoringMessageHandler_as_OffersMessageHandler(&this_arg_conv);
46685         return tag_ptr(ret_ret, true);
46686 }
46687
46688 uint64_t  __attribute__((export_name("TS_IgnoringMessageHandler_as_CustomOnionMessageHandler"))) TS_IgnoringMessageHandler_as_CustomOnionMessageHandler(uint64_t this_arg) {
46689         LDKIgnoringMessageHandler this_arg_conv;
46690         this_arg_conv.inner = untag_ptr(this_arg);
46691         this_arg_conv.is_owned = ptr_is_owned(this_arg);
46692         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
46693         this_arg_conv.is_owned = false;
46694         LDKCustomOnionMessageHandler* ret_ret = MALLOC(sizeof(LDKCustomOnionMessageHandler), "LDKCustomOnionMessageHandler");
46695         *ret_ret = IgnoringMessageHandler_as_CustomOnionMessageHandler(&this_arg_conv);
46696         return tag_ptr(ret_ret, true);
46697 }
46698
46699 uint64_t  __attribute__((export_name("TS_IgnoringMessageHandler_as_CustomMessageReader"))) TS_IgnoringMessageHandler_as_CustomMessageReader(uint64_t this_arg) {
46700         LDKIgnoringMessageHandler this_arg_conv;
46701         this_arg_conv.inner = untag_ptr(this_arg);
46702         this_arg_conv.is_owned = ptr_is_owned(this_arg);
46703         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
46704         this_arg_conv.is_owned = false;
46705         LDKCustomMessageReader* ret_ret = MALLOC(sizeof(LDKCustomMessageReader), "LDKCustomMessageReader");
46706         *ret_ret = IgnoringMessageHandler_as_CustomMessageReader(&this_arg_conv);
46707         return tag_ptr(ret_ret, true);
46708 }
46709
46710 uint64_t  __attribute__((export_name("TS_IgnoringMessageHandler_as_CustomMessageHandler"))) TS_IgnoringMessageHandler_as_CustomMessageHandler(uint64_t this_arg) {
46711         LDKIgnoringMessageHandler this_arg_conv;
46712         this_arg_conv.inner = untag_ptr(this_arg);
46713         this_arg_conv.is_owned = ptr_is_owned(this_arg);
46714         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
46715         this_arg_conv.is_owned = false;
46716         LDKCustomMessageHandler* ret_ret = MALLOC(sizeof(LDKCustomMessageHandler), "LDKCustomMessageHandler");
46717         *ret_ret = IgnoringMessageHandler_as_CustomMessageHandler(&this_arg_conv);
46718         return tag_ptr(ret_ret, true);
46719 }
46720
46721 void  __attribute__((export_name("TS_ErroringMessageHandler_free"))) TS_ErroringMessageHandler_free(uint64_t this_obj) {
46722         LDKErroringMessageHandler this_obj_conv;
46723         this_obj_conv.inner = untag_ptr(this_obj);
46724         this_obj_conv.is_owned = ptr_is_owned(this_obj);
46725         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
46726         ErroringMessageHandler_free(this_obj_conv);
46727 }
46728
46729 uint64_t  __attribute__((export_name("TS_ErroringMessageHandler_new"))) TS_ErroringMessageHandler_new() {
46730         LDKErroringMessageHandler ret_var = ErroringMessageHandler_new();
46731         uint64_t ret_ref = 0;
46732         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
46733         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
46734         return ret_ref;
46735 }
46736
46737 uint64_t  __attribute__((export_name("TS_ErroringMessageHandler_as_MessageSendEventsProvider"))) TS_ErroringMessageHandler_as_MessageSendEventsProvider(uint64_t this_arg) {
46738         LDKErroringMessageHandler this_arg_conv;
46739         this_arg_conv.inner = untag_ptr(this_arg);
46740         this_arg_conv.is_owned = ptr_is_owned(this_arg);
46741         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
46742         this_arg_conv.is_owned = false;
46743         LDKMessageSendEventsProvider* ret_ret = MALLOC(sizeof(LDKMessageSendEventsProvider), "LDKMessageSendEventsProvider");
46744         *ret_ret = ErroringMessageHandler_as_MessageSendEventsProvider(&this_arg_conv);
46745         return tag_ptr(ret_ret, true);
46746 }
46747
46748 uint64_t  __attribute__((export_name("TS_ErroringMessageHandler_as_ChannelMessageHandler"))) TS_ErroringMessageHandler_as_ChannelMessageHandler(uint64_t this_arg) {
46749         LDKErroringMessageHandler this_arg_conv;
46750         this_arg_conv.inner = untag_ptr(this_arg);
46751         this_arg_conv.is_owned = ptr_is_owned(this_arg);
46752         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
46753         this_arg_conv.is_owned = false;
46754         LDKChannelMessageHandler* ret_ret = MALLOC(sizeof(LDKChannelMessageHandler), "LDKChannelMessageHandler");
46755         *ret_ret = ErroringMessageHandler_as_ChannelMessageHandler(&this_arg_conv);
46756         return tag_ptr(ret_ret, true);
46757 }
46758
46759 void  __attribute__((export_name("TS_MessageHandler_free"))) TS_MessageHandler_free(uint64_t this_obj) {
46760         LDKMessageHandler this_obj_conv;
46761         this_obj_conv.inner = untag_ptr(this_obj);
46762         this_obj_conv.is_owned = ptr_is_owned(this_obj);
46763         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
46764         MessageHandler_free(this_obj_conv);
46765 }
46766
46767 uint64_t  __attribute__((export_name("TS_MessageHandler_get_chan_handler"))) TS_MessageHandler_get_chan_handler(uint64_t this_ptr) {
46768         LDKMessageHandler this_ptr_conv;
46769         this_ptr_conv.inner = untag_ptr(this_ptr);
46770         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
46771         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
46772         this_ptr_conv.is_owned = false;
46773         // WARNING: This object doesn't live past this scope, needs clone!
46774         uint64_t ret_ret = tag_ptr(MessageHandler_get_chan_handler(&this_ptr_conv), false);
46775         return ret_ret;
46776 }
46777
46778 void  __attribute__((export_name("TS_MessageHandler_set_chan_handler"))) TS_MessageHandler_set_chan_handler(uint64_t this_ptr, uint64_t val) {
46779         LDKMessageHandler this_ptr_conv;
46780         this_ptr_conv.inner = untag_ptr(this_ptr);
46781         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
46782         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
46783         this_ptr_conv.is_owned = false;
46784         void* val_ptr = untag_ptr(val);
46785         CHECK_ACCESS(val_ptr);
46786         LDKChannelMessageHandler val_conv = *(LDKChannelMessageHandler*)(val_ptr);
46787         if (val_conv.free == LDKChannelMessageHandler_JCalls_free) {
46788                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
46789                 LDKChannelMessageHandler_JCalls_cloned(&val_conv);
46790         }
46791         MessageHandler_set_chan_handler(&this_ptr_conv, val_conv);
46792 }
46793
46794 uint64_t  __attribute__((export_name("TS_MessageHandler_get_route_handler"))) TS_MessageHandler_get_route_handler(uint64_t this_ptr) {
46795         LDKMessageHandler this_ptr_conv;
46796         this_ptr_conv.inner = untag_ptr(this_ptr);
46797         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
46798         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
46799         this_ptr_conv.is_owned = false;
46800         // WARNING: This object doesn't live past this scope, needs clone!
46801         uint64_t ret_ret = tag_ptr(MessageHandler_get_route_handler(&this_ptr_conv), false);
46802         return ret_ret;
46803 }
46804
46805 void  __attribute__((export_name("TS_MessageHandler_set_route_handler"))) TS_MessageHandler_set_route_handler(uint64_t this_ptr, uint64_t val) {
46806         LDKMessageHandler this_ptr_conv;
46807         this_ptr_conv.inner = untag_ptr(this_ptr);
46808         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
46809         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
46810         this_ptr_conv.is_owned = false;
46811         void* val_ptr = untag_ptr(val);
46812         CHECK_ACCESS(val_ptr);
46813         LDKRoutingMessageHandler val_conv = *(LDKRoutingMessageHandler*)(val_ptr);
46814         if (val_conv.free == LDKRoutingMessageHandler_JCalls_free) {
46815                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
46816                 LDKRoutingMessageHandler_JCalls_cloned(&val_conv);
46817         }
46818         MessageHandler_set_route_handler(&this_ptr_conv, val_conv);
46819 }
46820
46821 uint64_t  __attribute__((export_name("TS_MessageHandler_get_onion_message_handler"))) TS_MessageHandler_get_onion_message_handler(uint64_t this_ptr) {
46822         LDKMessageHandler this_ptr_conv;
46823         this_ptr_conv.inner = untag_ptr(this_ptr);
46824         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
46825         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
46826         this_ptr_conv.is_owned = false;
46827         // WARNING: This object doesn't live past this scope, needs clone!
46828         uint64_t ret_ret = tag_ptr(MessageHandler_get_onion_message_handler(&this_ptr_conv), false);
46829         return ret_ret;
46830 }
46831
46832 void  __attribute__((export_name("TS_MessageHandler_set_onion_message_handler"))) TS_MessageHandler_set_onion_message_handler(uint64_t this_ptr, uint64_t val) {
46833         LDKMessageHandler this_ptr_conv;
46834         this_ptr_conv.inner = untag_ptr(this_ptr);
46835         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
46836         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
46837         this_ptr_conv.is_owned = false;
46838         void* val_ptr = untag_ptr(val);
46839         CHECK_ACCESS(val_ptr);
46840         LDKOnionMessageHandler val_conv = *(LDKOnionMessageHandler*)(val_ptr);
46841         if (val_conv.free == LDKOnionMessageHandler_JCalls_free) {
46842                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
46843                 LDKOnionMessageHandler_JCalls_cloned(&val_conv);
46844         }
46845         MessageHandler_set_onion_message_handler(&this_ptr_conv, val_conv);
46846 }
46847
46848 uint64_t  __attribute__((export_name("TS_MessageHandler_get_custom_message_handler"))) TS_MessageHandler_get_custom_message_handler(uint64_t this_ptr) {
46849         LDKMessageHandler this_ptr_conv;
46850         this_ptr_conv.inner = untag_ptr(this_ptr);
46851         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
46852         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
46853         this_ptr_conv.is_owned = false;
46854         // WARNING: This object doesn't live past this scope, needs clone!
46855         uint64_t ret_ret = tag_ptr(MessageHandler_get_custom_message_handler(&this_ptr_conv), false);
46856         return ret_ret;
46857 }
46858
46859 void  __attribute__((export_name("TS_MessageHandler_set_custom_message_handler"))) TS_MessageHandler_set_custom_message_handler(uint64_t this_ptr, uint64_t val) {
46860         LDKMessageHandler this_ptr_conv;
46861         this_ptr_conv.inner = untag_ptr(this_ptr);
46862         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
46863         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
46864         this_ptr_conv.is_owned = false;
46865         void* val_ptr = untag_ptr(val);
46866         CHECK_ACCESS(val_ptr);
46867         LDKCustomMessageHandler val_conv = *(LDKCustomMessageHandler*)(val_ptr);
46868         if (val_conv.free == LDKCustomMessageHandler_JCalls_free) {
46869                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
46870                 LDKCustomMessageHandler_JCalls_cloned(&val_conv);
46871         }
46872         MessageHandler_set_custom_message_handler(&this_ptr_conv, val_conv);
46873 }
46874
46875 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, uint64_t custom_message_handler_arg) {
46876         void* chan_handler_arg_ptr = untag_ptr(chan_handler_arg);
46877         CHECK_ACCESS(chan_handler_arg_ptr);
46878         LDKChannelMessageHandler chan_handler_arg_conv = *(LDKChannelMessageHandler*)(chan_handler_arg_ptr);
46879         if (chan_handler_arg_conv.free == LDKChannelMessageHandler_JCalls_free) {
46880                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
46881                 LDKChannelMessageHandler_JCalls_cloned(&chan_handler_arg_conv);
46882         }
46883         void* route_handler_arg_ptr = untag_ptr(route_handler_arg);
46884         CHECK_ACCESS(route_handler_arg_ptr);
46885         LDKRoutingMessageHandler route_handler_arg_conv = *(LDKRoutingMessageHandler*)(route_handler_arg_ptr);
46886         if (route_handler_arg_conv.free == LDKRoutingMessageHandler_JCalls_free) {
46887                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
46888                 LDKRoutingMessageHandler_JCalls_cloned(&route_handler_arg_conv);
46889         }
46890         void* onion_message_handler_arg_ptr = untag_ptr(onion_message_handler_arg);
46891         CHECK_ACCESS(onion_message_handler_arg_ptr);
46892         LDKOnionMessageHandler onion_message_handler_arg_conv = *(LDKOnionMessageHandler*)(onion_message_handler_arg_ptr);
46893         if (onion_message_handler_arg_conv.free == LDKOnionMessageHandler_JCalls_free) {
46894                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
46895                 LDKOnionMessageHandler_JCalls_cloned(&onion_message_handler_arg_conv);
46896         }
46897         void* custom_message_handler_arg_ptr = untag_ptr(custom_message_handler_arg);
46898         CHECK_ACCESS(custom_message_handler_arg_ptr);
46899         LDKCustomMessageHandler custom_message_handler_arg_conv = *(LDKCustomMessageHandler*)(custom_message_handler_arg_ptr);
46900         if (custom_message_handler_arg_conv.free == LDKCustomMessageHandler_JCalls_free) {
46901                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
46902                 LDKCustomMessageHandler_JCalls_cloned(&custom_message_handler_arg_conv);
46903         }
46904         LDKMessageHandler ret_var = MessageHandler_new(chan_handler_arg_conv, route_handler_arg_conv, onion_message_handler_arg_conv, custom_message_handler_arg_conv);
46905         uint64_t ret_ref = 0;
46906         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
46907         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
46908         return ret_ref;
46909 }
46910
46911 static inline uint64_t SocketDescriptor_clone_ptr(LDKSocketDescriptor *NONNULL_PTR arg) {
46912         LDKSocketDescriptor* ret_ret = MALLOC(sizeof(LDKSocketDescriptor), "LDKSocketDescriptor");
46913         *ret_ret = SocketDescriptor_clone(arg);
46914         return tag_ptr(ret_ret, true);
46915 }
46916 int64_t  __attribute__((export_name("TS_SocketDescriptor_clone_ptr"))) TS_SocketDescriptor_clone_ptr(uint64_t arg) {
46917         void* arg_ptr = untag_ptr(arg);
46918         if (ptr_is_owned(arg)) { CHECK_ACCESS(arg_ptr); }
46919         LDKSocketDescriptor* arg_conv = (LDKSocketDescriptor*)arg_ptr;
46920         int64_t ret_conv = SocketDescriptor_clone_ptr(arg_conv);
46921         return ret_conv;
46922 }
46923
46924 uint64_t  __attribute__((export_name("TS_SocketDescriptor_clone"))) TS_SocketDescriptor_clone(uint64_t orig) {
46925         void* orig_ptr = untag_ptr(orig);
46926         if (ptr_is_owned(orig)) { CHECK_ACCESS(orig_ptr); }
46927         LDKSocketDescriptor* orig_conv = (LDKSocketDescriptor*)orig_ptr;
46928         LDKSocketDescriptor* ret_ret = MALLOC(sizeof(LDKSocketDescriptor), "LDKSocketDescriptor");
46929         *ret_ret = SocketDescriptor_clone(orig_conv);
46930         return tag_ptr(ret_ret, true);
46931 }
46932
46933 void  __attribute__((export_name("TS_SocketDescriptor_free"))) TS_SocketDescriptor_free(uint64_t this_ptr) {
46934         if (!ptr_is_owned(this_ptr)) return;
46935         void* this_ptr_ptr = untag_ptr(this_ptr);
46936         CHECK_ACCESS(this_ptr_ptr);
46937         LDKSocketDescriptor this_ptr_conv = *(LDKSocketDescriptor*)(this_ptr_ptr);
46938         FREE(untag_ptr(this_ptr));
46939         SocketDescriptor_free(this_ptr_conv);
46940 }
46941
46942 void  __attribute__((export_name("TS_PeerHandleError_free"))) TS_PeerHandleError_free(uint64_t this_obj) {
46943         LDKPeerHandleError this_obj_conv;
46944         this_obj_conv.inner = untag_ptr(this_obj);
46945         this_obj_conv.is_owned = ptr_is_owned(this_obj);
46946         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
46947         PeerHandleError_free(this_obj_conv);
46948 }
46949
46950 uint64_t  __attribute__((export_name("TS_PeerHandleError_new"))) TS_PeerHandleError_new() {
46951         LDKPeerHandleError ret_var = PeerHandleError_new();
46952         uint64_t ret_ref = 0;
46953         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
46954         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
46955         return ret_ref;
46956 }
46957
46958 static inline uint64_t PeerHandleError_clone_ptr(LDKPeerHandleError *NONNULL_PTR arg) {
46959         LDKPeerHandleError ret_var = PeerHandleError_clone(arg);
46960         uint64_t ret_ref = 0;
46961         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
46962         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
46963         return ret_ref;
46964 }
46965 int64_t  __attribute__((export_name("TS_PeerHandleError_clone_ptr"))) TS_PeerHandleError_clone_ptr(uint64_t arg) {
46966         LDKPeerHandleError arg_conv;
46967         arg_conv.inner = untag_ptr(arg);
46968         arg_conv.is_owned = ptr_is_owned(arg);
46969         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
46970         arg_conv.is_owned = false;
46971         int64_t ret_conv = PeerHandleError_clone_ptr(&arg_conv);
46972         return ret_conv;
46973 }
46974
46975 uint64_t  __attribute__((export_name("TS_PeerHandleError_clone"))) TS_PeerHandleError_clone(uint64_t orig) {
46976         LDKPeerHandleError orig_conv;
46977         orig_conv.inner = untag_ptr(orig);
46978         orig_conv.is_owned = ptr_is_owned(orig);
46979         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
46980         orig_conv.is_owned = false;
46981         LDKPeerHandleError ret_var = PeerHandleError_clone(&orig_conv);
46982         uint64_t ret_ref = 0;
46983         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
46984         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
46985         return ret_ref;
46986 }
46987
46988 void  __attribute__((export_name("TS_PeerManager_free"))) TS_PeerManager_free(uint64_t this_obj) {
46989         LDKPeerManager this_obj_conv;
46990         this_obj_conv.inner = untag_ptr(this_obj);
46991         this_obj_conv.is_owned = ptr_is_owned(this_obj);
46992         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
46993         PeerManager_free(this_obj_conv);
46994 }
46995
46996 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 node_signer) {
46997         LDKMessageHandler message_handler_conv;
46998         message_handler_conv.inner = untag_ptr(message_handler);
46999         message_handler_conv.is_owned = ptr_is_owned(message_handler);
47000         CHECK_INNER_FIELD_ACCESS_OR_NULL(message_handler_conv);
47001         // WARNING: we need a move here but no clone is available for LDKMessageHandler
47002         
47003         uint8_t ephemeral_random_data_arr[32];
47004         CHECK(ephemeral_random_data->arr_len == 32);
47005         memcpy(ephemeral_random_data_arr, ephemeral_random_data->elems, 32); FREE(ephemeral_random_data);
47006         uint8_t (*ephemeral_random_data_ref)[32] = &ephemeral_random_data_arr;
47007         void* logger_ptr = untag_ptr(logger);
47008         CHECK_ACCESS(logger_ptr);
47009         LDKLogger logger_conv = *(LDKLogger*)(logger_ptr);
47010         if (logger_conv.free == LDKLogger_JCalls_free) {
47011                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
47012                 LDKLogger_JCalls_cloned(&logger_conv);
47013         }
47014         void* node_signer_ptr = untag_ptr(node_signer);
47015         CHECK_ACCESS(node_signer_ptr);
47016         LDKNodeSigner node_signer_conv = *(LDKNodeSigner*)(node_signer_ptr);
47017         if (node_signer_conv.free == LDKNodeSigner_JCalls_free) {
47018                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
47019                 LDKNodeSigner_JCalls_cloned(&node_signer_conv);
47020         }
47021         LDKPeerManager ret_var = PeerManager_new(message_handler_conv, current_time, ephemeral_random_data_ref, logger_conv, node_signer_conv);
47022         uint64_t ret_ref = 0;
47023         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
47024         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
47025         return ret_ref;
47026 }
47027
47028 uint64_tArray  __attribute__((export_name("TS_PeerManager_get_peer_node_ids"))) TS_PeerManager_get_peer_node_ids(uint64_t this_arg) {
47029         LDKPeerManager this_arg_conv;
47030         this_arg_conv.inner = untag_ptr(this_arg);
47031         this_arg_conv.is_owned = ptr_is_owned(this_arg);
47032         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
47033         this_arg_conv.is_owned = false;
47034         LDKCVec_C2Tuple_PublicKeyCOption_SocketAddressZZZ ret_var = PeerManager_get_peer_node_ids(&this_arg_conv);
47035         uint64_tArray ret_arr = NULL;
47036         ret_arr = init_uint64_tArray(ret_var.datalen, __LINE__);
47037         uint64_t *ret_arr_ptr = (uint64_t*)(((uint8_t*)ret_arr) + 8);
47038         for (size_t r = 0; r < ret_var.datalen; r++) {
47039                 LDKC2Tuple_PublicKeyCOption_SocketAddressZZ* ret_conv_43_conv = MALLOC(sizeof(LDKC2Tuple_PublicKeyCOption_SocketAddressZZ), "LDKC2Tuple_PublicKeyCOption_SocketAddressZZ");
47040                 *ret_conv_43_conv = ret_var.data[r];
47041                 ret_arr_ptr[r] = tag_ptr(ret_conv_43_conv, true);
47042         }
47043         
47044         FREE(ret_var.data);
47045         return ret_arr;
47046 }
47047
47048 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) {
47049         LDKPeerManager this_arg_conv;
47050         this_arg_conv.inner = untag_ptr(this_arg);
47051         this_arg_conv.is_owned = ptr_is_owned(this_arg);
47052         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
47053         this_arg_conv.is_owned = false;
47054         LDKPublicKey their_node_id_ref;
47055         CHECK(their_node_id->arr_len == 33);
47056         memcpy(their_node_id_ref.compressed_form, their_node_id->elems, 33); FREE(their_node_id);
47057         void* descriptor_ptr = untag_ptr(descriptor);
47058         CHECK_ACCESS(descriptor_ptr);
47059         LDKSocketDescriptor descriptor_conv = *(LDKSocketDescriptor*)(descriptor_ptr);
47060         if (descriptor_conv.free == LDKSocketDescriptor_JCalls_free) {
47061                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
47062                 LDKSocketDescriptor_JCalls_cloned(&descriptor_conv);
47063         }
47064         void* remote_network_address_ptr = untag_ptr(remote_network_address);
47065         CHECK_ACCESS(remote_network_address_ptr);
47066         LDKCOption_SocketAddressZ remote_network_address_conv = *(LDKCOption_SocketAddressZ*)(remote_network_address_ptr);
47067         LDKCResult_CVec_u8ZPeerHandleErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_u8ZPeerHandleErrorZ), "LDKCResult_CVec_u8ZPeerHandleErrorZ");
47068         *ret_conv = PeerManager_new_outbound_connection(&this_arg_conv, their_node_id_ref, descriptor_conv, remote_network_address_conv);
47069         return tag_ptr(ret_conv, true);
47070 }
47071
47072 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) {
47073         LDKPeerManager this_arg_conv;
47074         this_arg_conv.inner = untag_ptr(this_arg);
47075         this_arg_conv.is_owned = ptr_is_owned(this_arg);
47076         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
47077         this_arg_conv.is_owned = false;
47078         void* descriptor_ptr = untag_ptr(descriptor);
47079         CHECK_ACCESS(descriptor_ptr);
47080         LDKSocketDescriptor descriptor_conv = *(LDKSocketDescriptor*)(descriptor_ptr);
47081         if (descriptor_conv.free == LDKSocketDescriptor_JCalls_free) {
47082                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
47083                 LDKSocketDescriptor_JCalls_cloned(&descriptor_conv);
47084         }
47085         void* remote_network_address_ptr = untag_ptr(remote_network_address);
47086         CHECK_ACCESS(remote_network_address_ptr);
47087         LDKCOption_SocketAddressZ remote_network_address_conv = *(LDKCOption_SocketAddressZ*)(remote_network_address_ptr);
47088         LDKCResult_NonePeerHandleErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NonePeerHandleErrorZ), "LDKCResult_NonePeerHandleErrorZ");
47089         *ret_conv = PeerManager_new_inbound_connection(&this_arg_conv, descriptor_conv, remote_network_address_conv);
47090         return tag_ptr(ret_conv, true);
47091 }
47092
47093 uint64_t  __attribute__((export_name("TS_PeerManager_write_buffer_space_avail"))) TS_PeerManager_write_buffer_space_avail(uint64_t this_arg, uint64_t descriptor) {
47094         LDKPeerManager this_arg_conv;
47095         this_arg_conv.inner = untag_ptr(this_arg);
47096         this_arg_conv.is_owned = ptr_is_owned(this_arg);
47097         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
47098         this_arg_conv.is_owned = false;
47099         void* descriptor_ptr = untag_ptr(descriptor);
47100         if (ptr_is_owned(descriptor)) { CHECK_ACCESS(descriptor_ptr); }
47101         LDKSocketDescriptor* descriptor_conv = (LDKSocketDescriptor*)descriptor_ptr;
47102         LDKCResult_NonePeerHandleErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NonePeerHandleErrorZ), "LDKCResult_NonePeerHandleErrorZ");
47103         *ret_conv = PeerManager_write_buffer_space_avail(&this_arg_conv, descriptor_conv);
47104         return tag_ptr(ret_conv, true);
47105 }
47106
47107 uint64_t  __attribute__((export_name("TS_PeerManager_read_event"))) TS_PeerManager_read_event(uint64_t this_arg, uint64_t peer_descriptor, int8_tArray data) {
47108         LDKPeerManager this_arg_conv;
47109         this_arg_conv.inner = untag_ptr(this_arg);
47110         this_arg_conv.is_owned = ptr_is_owned(this_arg);
47111         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
47112         this_arg_conv.is_owned = false;
47113         void* peer_descriptor_ptr = untag_ptr(peer_descriptor);
47114         if (ptr_is_owned(peer_descriptor)) { CHECK_ACCESS(peer_descriptor_ptr); }
47115         LDKSocketDescriptor* peer_descriptor_conv = (LDKSocketDescriptor*)peer_descriptor_ptr;
47116         LDKu8slice data_ref;
47117         data_ref.datalen = data->arr_len;
47118         data_ref.data = data->elems;
47119         LDKCResult_boolPeerHandleErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_boolPeerHandleErrorZ), "LDKCResult_boolPeerHandleErrorZ");
47120         *ret_conv = PeerManager_read_event(&this_arg_conv, peer_descriptor_conv, data_ref);
47121         FREE(data);
47122         return tag_ptr(ret_conv, true);
47123 }
47124
47125 void  __attribute__((export_name("TS_PeerManager_process_events"))) TS_PeerManager_process_events(uint64_t this_arg) {
47126         LDKPeerManager this_arg_conv;
47127         this_arg_conv.inner = untag_ptr(this_arg);
47128         this_arg_conv.is_owned = ptr_is_owned(this_arg);
47129         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
47130         this_arg_conv.is_owned = false;
47131         PeerManager_process_events(&this_arg_conv);
47132 }
47133
47134 void  __attribute__((export_name("TS_PeerManager_socket_disconnected"))) TS_PeerManager_socket_disconnected(uint64_t this_arg, uint64_t descriptor) {
47135         LDKPeerManager this_arg_conv;
47136         this_arg_conv.inner = untag_ptr(this_arg);
47137         this_arg_conv.is_owned = ptr_is_owned(this_arg);
47138         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
47139         this_arg_conv.is_owned = false;
47140         void* descriptor_ptr = untag_ptr(descriptor);
47141         if (ptr_is_owned(descriptor)) { CHECK_ACCESS(descriptor_ptr); }
47142         LDKSocketDescriptor* descriptor_conv = (LDKSocketDescriptor*)descriptor_ptr;
47143         PeerManager_socket_disconnected(&this_arg_conv, descriptor_conv);
47144 }
47145
47146 void  __attribute__((export_name("TS_PeerManager_disconnect_by_node_id"))) TS_PeerManager_disconnect_by_node_id(uint64_t this_arg, int8_tArray node_id) {
47147         LDKPeerManager this_arg_conv;
47148         this_arg_conv.inner = untag_ptr(this_arg);
47149         this_arg_conv.is_owned = ptr_is_owned(this_arg);
47150         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
47151         this_arg_conv.is_owned = false;
47152         LDKPublicKey node_id_ref;
47153         CHECK(node_id->arr_len == 33);
47154         memcpy(node_id_ref.compressed_form, node_id->elems, 33); FREE(node_id);
47155         PeerManager_disconnect_by_node_id(&this_arg_conv, node_id_ref);
47156 }
47157
47158 void  __attribute__((export_name("TS_PeerManager_disconnect_all_peers"))) TS_PeerManager_disconnect_all_peers(uint64_t this_arg) {
47159         LDKPeerManager this_arg_conv;
47160         this_arg_conv.inner = untag_ptr(this_arg);
47161         this_arg_conv.is_owned = ptr_is_owned(this_arg);
47162         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
47163         this_arg_conv.is_owned = false;
47164         PeerManager_disconnect_all_peers(&this_arg_conv);
47165 }
47166
47167 void  __attribute__((export_name("TS_PeerManager_timer_tick_occurred"))) TS_PeerManager_timer_tick_occurred(uint64_t this_arg) {
47168         LDKPeerManager this_arg_conv;
47169         this_arg_conv.inner = untag_ptr(this_arg);
47170         this_arg_conv.is_owned = ptr_is_owned(this_arg);
47171         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
47172         this_arg_conv.is_owned = false;
47173         PeerManager_timer_tick_occurred(&this_arg_conv);
47174 }
47175
47176 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) {
47177         LDKPeerManager this_arg_conv;
47178         this_arg_conv.inner = untag_ptr(this_arg);
47179         this_arg_conv.is_owned = ptr_is_owned(this_arg);
47180         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
47181         this_arg_conv.is_owned = false;
47182         LDKThreeBytes rgb_ref;
47183         CHECK(rgb->arr_len == 3);
47184         memcpy(rgb_ref.data, rgb->elems, 3); FREE(rgb);
47185         LDKThirtyTwoBytes alias_ref;
47186         CHECK(alias->arr_len == 32);
47187         memcpy(alias_ref.data, alias->elems, 32); FREE(alias);
47188         LDKCVec_SocketAddressZ addresses_constr;
47189         addresses_constr.datalen = addresses->arr_len;
47190         if (addresses_constr.datalen > 0)
47191                 addresses_constr.data = MALLOC(addresses_constr.datalen * sizeof(LDKSocketAddress), "LDKCVec_SocketAddressZ Elements");
47192         else
47193                 addresses_constr.data = NULL;
47194         uint64_t* addresses_vals = addresses->elems;
47195         for (size_t p = 0; p < addresses_constr.datalen; p++) {
47196                 uint64_t addresses_conv_15 = addresses_vals[p];
47197                 void* addresses_conv_15_ptr = untag_ptr(addresses_conv_15);
47198                 CHECK_ACCESS(addresses_conv_15_ptr);
47199                 LDKSocketAddress addresses_conv_15_conv = *(LDKSocketAddress*)(addresses_conv_15_ptr);
47200                 addresses_constr.data[p] = addresses_conv_15_conv;
47201         }
47202         FREE(addresses);
47203         PeerManager_broadcast_node_announcement(&this_arg_conv, rgb_ref, alias_ref, addresses_constr);
47204 }
47205
47206 int64_t  __attribute__((export_name("TS_htlc_success_tx_weight"))) TS_htlc_success_tx_weight(uint64_t channel_type_features) {
47207         LDKChannelTypeFeatures channel_type_features_conv;
47208         channel_type_features_conv.inner = untag_ptr(channel_type_features);
47209         channel_type_features_conv.is_owned = ptr_is_owned(channel_type_features);
47210         CHECK_INNER_FIELD_ACCESS_OR_NULL(channel_type_features_conv);
47211         channel_type_features_conv.is_owned = false;
47212         int64_t ret_conv = htlc_success_tx_weight(&channel_type_features_conv);
47213         return ret_conv;
47214 }
47215
47216 int64_t  __attribute__((export_name("TS_htlc_timeout_tx_weight"))) TS_htlc_timeout_tx_weight(uint64_t channel_type_features) {
47217         LDKChannelTypeFeatures channel_type_features_conv;
47218         channel_type_features_conv.inner = untag_ptr(channel_type_features);
47219         channel_type_features_conv.is_owned = ptr_is_owned(channel_type_features);
47220         CHECK_INNER_FIELD_ACCESS_OR_NULL(channel_type_features_conv);
47221         channel_type_features_conv.is_owned = false;
47222         int64_t ret_conv = htlc_timeout_tx_weight(&channel_type_features_conv);
47223         return ret_conv;
47224 }
47225
47226 uint32_t  __attribute__((export_name("TS_HTLCClaim_clone"))) TS_HTLCClaim_clone(uint64_t orig) {
47227         LDKHTLCClaim* orig_conv = (LDKHTLCClaim*)untag_ptr(orig);
47228         uint32_t ret_conv = LDKHTLCClaim_to_js(HTLCClaim_clone(orig_conv));
47229         return ret_conv;
47230 }
47231
47232 uint32_t  __attribute__((export_name("TS_HTLCClaim_offered_timeout"))) TS_HTLCClaim_offered_timeout() {
47233         uint32_t ret_conv = LDKHTLCClaim_to_js(HTLCClaim_offered_timeout());
47234         return ret_conv;
47235 }
47236
47237 uint32_t  __attribute__((export_name("TS_HTLCClaim_offered_preimage"))) TS_HTLCClaim_offered_preimage() {
47238         uint32_t ret_conv = LDKHTLCClaim_to_js(HTLCClaim_offered_preimage());
47239         return ret_conv;
47240 }
47241
47242 uint32_t  __attribute__((export_name("TS_HTLCClaim_accepted_timeout"))) TS_HTLCClaim_accepted_timeout() {
47243         uint32_t ret_conv = LDKHTLCClaim_to_js(HTLCClaim_accepted_timeout());
47244         return ret_conv;
47245 }
47246
47247 uint32_t  __attribute__((export_name("TS_HTLCClaim_accepted_preimage"))) TS_HTLCClaim_accepted_preimage() {
47248         uint32_t ret_conv = LDKHTLCClaim_to_js(HTLCClaim_accepted_preimage());
47249         return ret_conv;
47250 }
47251
47252 uint32_t  __attribute__((export_name("TS_HTLCClaim_revocation"))) TS_HTLCClaim_revocation() {
47253         uint32_t ret_conv = LDKHTLCClaim_to_js(HTLCClaim_revocation());
47254         return ret_conv;
47255 }
47256
47257 jboolean  __attribute__((export_name("TS_HTLCClaim_eq"))) TS_HTLCClaim_eq(uint64_t a, uint64_t b) {
47258         LDKHTLCClaim* a_conv = (LDKHTLCClaim*)untag_ptr(a);
47259         LDKHTLCClaim* b_conv = (LDKHTLCClaim*)untag_ptr(b);
47260         jboolean ret_conv = HTLCClaim_eq(a_conv, b_conv);
47261         return ret_conv;
47262 }
47263
47264 uint64_t  __attribute__((export_name("TS_HTLCClaim_from_witness"))) TS_HTLCClaim_from_witness(int8_tArray witness) {
47265         LDKWitness witness_ref;
47266         witness_ref.datalen = witness->arr_len;
47267         witness_ref.data = MALLOC(witness_ref.datalen, "LDKWitness Bytes");
47268         memcpy(witness_ref.data, witness->elems, witness_ref.datalen); FREE(witness);
47269         witness_ref.data_is_owned = true;
47270         LDKCOption_HTLCClaimZ *ret_copy = MALLOC(sizeof(LDKCOption_HTLCClaimZ), "LDKCOption_HTLCClaimZ");
47271         *ret_copy = HTLCClaim_from_witness(witness_ref);
47272         uint64_t ret_ref = tag_ptr(ret_copy, true);
47273         return ret_ref;
47274 }
47275
47276 int8_tArray  __attribute__((export_name("TS_build_commitment_secret"))) TS_build_commitment_secret(int8_tArray commitment_seed, int64_t idx) {
47277         uint8_t commitment_seed_arr[32];
47278         CHECK(commitment_seed->arr_len == 32);
47279         memcpy(commitment_seed_arr, commitment_seed->elems, 32); FREE(commitment_seed);
47280         uint8_t (*commitment_seed_ref)[32] = &commitment_seed_arr;
47281         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
47282         memcpy(ret_arr->elems, build_commitment_secret(commitment_seed_ref, idx).data, 32);
47283         return ret_arr;
47284 }
47285
47286 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) {
47287         LDKCVec_u8Z to_holder_script_ref;
47288         to_holder_script_ref.datalen = to_holder_script->arr_len;
47289         to_holder_script_ref.data = MALLOC(to_holder_script_ref.datalen, "LDKCVec_u8Z Bytes");
47290         memcpy(to_holder_script_ref.data, to_holder_script->elems, to_holder_script_ref.datalen); FREE(to_holder_script);
47291         LDKCVec_u8Z to_counterparty_script_ref;
47292         to_counterparty_script_ref.datalen = to_counterparty_script->arr_len;
47293         to_counterparty_script_ref.data = MALLOC(to_counterparty_script_ref.datalen, "LDKCVec_u8Z Bytes");
47294         memcpy(to_counterparty_script_ref.data, to_counterparty_script->elems, to_counterparty_script_ref.datalen); FREE(to_counterparty_script);
47295         LDKOutPoint funding_outpoint_conv;
47296         funding_outpoint_conv.inner = untag_ptr(funding_outpoint);
47297         funding_outpoint_conv.is_owned = ptr_is_owned(funding_outpoint);
47298         CHECK_INNER_FIELD_ACCESS_OR_NULL(funding_outpoint_conv);
47299         funding_outpoint_conv = OutPoint_clone(&funding_outpoint_conv);
47300         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);
47301         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
47302         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
47303         Transaction_free(ret_var);
47304         return ret_arr;
47305 }
47306
47307 void  __attribute__((export_name("TS_CounterpartyCommitmentSecrets_free"))) TS_CounterpartyCommitmentSecrets_free(uint64_t this_obj) {
47308         LDKCounterpartyCommitmentSecrets this_obj_conv;
47309         this_obj_conv.inner = untag_ptr(this_obj);
47310         this_obj_conv.is_owned = ptr_is_owned(this_obj);
47311         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
47312         CounterpartyCommitmentSecrets_free(this_obj_conv);
47313 }
47314
47315 static inline uint64_t CounterpartyCommitmentSecrets_clone_ptr(LDKCounterpartyCommitmentSecrets *NONNULL_PTR arg) {
47316         LDKCounterpartyCommitmentSecrets ret_var = CounterpartyCommitmentSecrets_clone(arg);
47317         uint64_t ret_ref = 0;
47318         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
47319         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
47320         return ret_ref;
47321 }
47322 int64_t  __attribute__((export_name("TS_CounterpartyCommitmentSecrets_clone_ptr"))) TS_CounterpartyCommitmentSecrets_clone_ptr(uint64_t arg) {
47323         LDKCounterpartyCommitmentSecrets arg_conv;
47324         arg_conv.inner = untag_ptr(arg);
47325         arg_conv.is_owned = ptr_is_owned(arg);
47326         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
47327         arg_conv.is_owned = false;
47328         int64_t ret_conv = CounterpartyCommitmentSecrets_clone_ptr(&arg_conv);
47329         return ret_conv;
47330 }
47331
47332 uint64_t  __attribute__((export_name("TS_CounterpartyCommitmentSecrets_clone"))) TS_CounterpartyCommitmentSecrets_clone(uint64_t orig) {
47333         LDKCounterpartyCommitmentSecrets orig_conv;
47334         orig_conv.inner = untag_ptr(orig);
47335         orig_conv.is_owned = ptr_is_owned(orig);
47336         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
47337         orig_conv.is_owned = false;
47338         LDKCounterpartyCommitmentSecrets ret_var = CounterpartyCommitmentSecrets_clone(&orig_conv);
47339         uint64_t ret_ref = 0;
47340         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
47341         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
47342         return ret_ref;
47343 }
47344
47345 uint64_t  __attribute__((export_name("TS_CounterpartyCommitmentSecrets_new"))) TS_CounterpartyCommitmentSecrets_new() {
47346         LDKCounterpartyCommitmentSecrets ret_var = CounterpartyCommitmentSecrets_new();
47347         uint64_t ret_ref = 0;
47348         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
47349         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
47350         return ret_ref;
47351 }
47352
47353 int64_t  __attribute__((export_name("TS_CounterpartyCommitmentSecrets_get_min_seen_secret"))) TS_CounterpartyCommitmentSecrets_get_min_seen_secret(uint64_t this_arg) {
47354         LDKCounterpartyCommitmentSecrets this_arg_conv;
47355         this_arg_conv.inner = untag_ptr(this_arg);
47356         this_arg_conv.is_owned = ptr_is_owned(this_arg);
47357         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
47358         this_arg_conv.is_owned = false;
47359         int64_t ret_conv = CounterpartyCommitmentSecrets_get_min_seen_secret(&this_arg_conv);
47360         return ret_conv;
47361 }
47362
47363 uint64_t  __attribute__((export_name("TS_CounterpartyCommitmentSecrets_provide_secret"))) TS_CounterpartyCommitmentSecrets_provide_secret(uint64_t this_arg, int64_t idx, int8_tArray secret) {
47364         LDKCounterpartyCommitmentSecrets this_arg_conv;
47365         this_arg_conv.inner = untag_ptr(this_arg);
47366         this_arg_conv.is_owned = ptr_is_owned(this_arg);
47367         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
47368         this_arg_conv.is_owned = false;
47369         LDKThirtyTwoBytes secret_ref;
47370         CHECK(secret->arr_len == 32);
47371         memcpy(secret_ref.data, secret->elems, 32); FREE(secret);
47372         LDKCResult_NoneNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneNoneZ), "LDKCResult_NoneNoneZ");
47373         *ret_conv = CounterpartyCommitmentSecrets_provide_secret(&this_arg_conv, idx, secret_ref);
47374         return tag_ptr(ret_conv, true);
47375 }
47376
47377 int8_tArray  __attribute__((export_name("TS_CounterpartyCommitmentSecrets_get_secret"))) TS_CounterpartyCommitmentSecrets_get_secret(uint64_t this_arg, int64_t idx) {
47378         LDKCounterpartyCommitmentSecrets this_arg_conv;
47379         this_arg_conv.inner = untag_ptr(this_arg);
47380         this_arg_conv.is_owned = ptr_is_owned(this_arg);
47381         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
47382         this_arg_conv.is_owned = false;
47383         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
47384         memcpy(ret_arr->elems, CounterpartyCommitmentSecrets_get_secret(&this_arg_conv, idx).data, 32);
47385         return ret_arr;
47386 }
47387
47388 int8_tArray  __attribute__((export_name("TS_CounterpartyCommitmentSecrets_write"))) TS_CounterpartyCommitmentSecrets_write(uint64_t obj) {
47389         LDKCounterpartyCommitmentSecrets obj_conv;
47390         obj_conv.inner = untag_ptr(obj);
47391         obj_conv.is_owned = ptr_is_owned(obj);
47392         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
47393         obj_conv.is_owned = false;
47394         LDKCVec_u8Z ret_var = CounterpartyCommitmentSecrets_write(&obj_conv);
47395         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
47396         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
47397         CVec_u8Z_free(ret_var);
47398         return ret_arr;
47399 }
47400
47401 uint64_t  __attribute__((export_name("TS_CounterpartyCommitmentSecrets_read"))) TS_CounterpartyCommitmentSecrets_read(int8_tArray ser) {
47402         LDKu8slice ser_ref;
47403         ser_ref.datalen = ser->arr_len;
47404         ser_ref.data = ser->elems;
47405         LDKCResult_CounterpartyCommitmentSecretsDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CounterpartyCommitmentSecretsDecodeErrorZ), "LDKCResult_CounterpartyCommitmentSecretsDecodeErrorZ");
47406         *ret_conv = CounterpartyCommitmentSecrets_read(ser_ref);
47407         FREE(ser);
47408         return tag_ptr(ret_conv, true);
47409 }
47410
47411 int8_tArray  __attribute__((export_name("TS_derive_private_key"))) TS_derive_private_key(int8_tArray per_commitment_point, int8_tArray base_secret) {
47412         LDKPublicKey per_commitment_point_ref;
47413         CHECK(per_commitment_point->arr_len == 33);
47414         memcpy(per_commitment_point_ref.compressed_form, per_commitment_point->elems, 33); FREE(per_commitment_point);
47415         uint8_t base_secret_arr[32];
47416         CHECK(base_secret->arr_len == 32);
47417         memcpy(base_secret_arr, base_secret->elems, 32); FREE(base_secret);
47418         uint8_t (*base_secret_ref)[32] = &base_secret_arr;
47419         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
47420         memcpy(ret_arr->elems, derive_private_key(per_commitment_point_ref, base_secret_ref).bytes, 32);
47421         return ret_arr;
47422 }
47423
47424 int8_tArray  __attribute__((export_name("TS_derive_public_key"))) TS_derive_public_key(int8_tArray per_commitment_point, int8_tArray base_point) {
47425         LDKPublicKey per_commitment_point_ref;
47426         CHECK(per_commitment_point->arr_len == 33);
47427         memcpy(per_commitment_point_ref.compressed_form, per_commitment_point->elems, 33); FREE(per_commitment_point);
47428         LDKPublicKey base_point_ref;
47429         CHECK(base_point->arr_len == 33);
47430         memcpy(base_point_ref.compressed_form, base_point->elems, 33); FREE(base_point);
47431         int8_tArray ret_arr = init_int8_tArray(33, __LINE__);
47432         memcpy(ret_arr->elems, derive_public_key(per_commitment_point_ref, base_point_ref).compressed_form, 33);
47433         return ret_arr;
47434 }
47435
47436 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) {
47437         uint8_t per_commitment_secret_arr[32];
47438         CHECK(per_commitment_secret->arr_len == 32);
47439         memcpy(per_commitment_secret_arr, per_commitment_secret->elems, 32); FREE(per_commitment_secret);
47440         uint8_t (*per_commitment_secret_ref)[32] = &per_commitment_secret_arr;
47441         uint8_t countersignatory_revocation_base_secret_arr[32];
47442         CHECK(countersignatory_revocation_base_secret->arr_len == 32);
47443         memcpy(countersignatory_revocation_base_secret_arr, countersignatory_revocation_base_secret->elems, 32); FREE(countersignatory_revocation_base_secret);
47444         uint8_t (*countersignatory_revocation_base_secret_ref)[32] = &countersignatory_revocation_base_secret_arr;
47445         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
47446         memcpy(ret_arr->elems, derive_private_revocation_key(per_commitment_secret_ref, countersignatory_revocation_base_secret_ref).bytes, 32);
47447         return ret_arr;
47448 }
47449
47450 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) {
47451         LDKPublicKey per_commitment_point_ref;
47452         CHECK(per_commitment_point->arr_len == 33);
47453         memcpy(per_commitment_point_ref.compressed_form, per_commitment_point->elems, 33); FREE(per_commitment_point);
47454         LDKPublicKey countersignatory_revocation_base_point_ref;
47455         CHECK(countersignatory_revocation_base_point->arr_len == 33);
47456         memcpy(countersignatory_revocation_base_point_ref.compressed_form, countersignatory_revocation_base_point->elems, 33); FREE(countersignatory_revocation_base_point);
47457         int8_tArray ret_arr = init_int8_tArray(33, __LINE__);
47458         memcpy(ret_arr->elems, derive_public_revocation_key(per_commitment_point_ref, countersignatory_revocation_base_point_ref).compressed_form, 33);
47459         return ret_arr;
47460 }
47461
47462 void  __attribute__((export_name("TS_TxCreationKeys_free"))) TS_TxCreationKeys_free(uint64_t this_obj) {
47463         LDKTxCreationKeys this_obj_conv;
47464         this_obj_conv.inner = untag_ptr(this_obj);
47465         this_obj_conv.is_owned = ptr_is_owned(this_obj);
47466         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
47467         TxCreationKeys_free(this_obj_conv);
47468 }
47469
47470 int8_tArray  __attribute__((export_name("TS_TxCreationKeys_get_per_commitment_point"))) TS_TxCreationKeys_get_per_commitment_point(uint64_t this_ptr) {
47471         LDKTxCreationKeys this_ptr_conv;
47472         this_ptr_conv.inner = untag_ptr(this_ptr);
47473         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
47474         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
47475         this_ptr_conv.is_owned = false;
47476         int8_tArray ret_arr = init_int8_tArray(33, __LINE__);
47477         memcpy(ret_arr->elems, TxCreationKeys_get_per_commitment_point(&this_ptr_conv).compressed_form, 33);
47478         return ret_arr;
47479 }
47480
47481 void  __attribute__((export_name("TS_TxCreationKeys_set_per_commitment_point"))) TS_TxCreationKeys_set_per_commitment_point(uint64_t this_ptr, int8_tArray val) {
47482         LDKTxCreationKeys this_ptr_conv;
47483         this_ptr_conv.inner = untag_ptr(this_ptr);
47484         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
47485         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
47486         this_ptr_conv.is_owned = false;
47487         LDKPublicKey val_ref;
47488         CHECK(val->arr_len == 33);
47489         memcpy(val_ref.compressed_form, val->elems, 33); FREE(val);
47490         TxCreationKeys_set_per_commitment_point(&this_ptr_conv, val_ref);
47491 }
47492
47493 int8_tArray  __attribute__((export_name("TS_TxCreationKeys_get_revocation_key"))) TS_TxCreationKeys_get_revocation_key(uint64_t this_ptr) {
47494         LDKTxCreationKeys this_ptr_conv;
47495         this_ptr_conv.inner = untag_ptr(this_ptr);
47496         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
47497         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
47498         this_ptr_conv.is_owned = false;
47499         int8_tArray ret_arr = init_int8_tArray(33, __LINE__);
47500         memcpy(ret_arr->elems, TxCreationKeys_get_revocation_key(&this_ptr_conv).compressed_form, 33);
47501         return ret_arr;
47502 }
47503
47504 void  __attribute__((export_name("TS_TxCreationKeys_set_revocation_key"))) TS_TxCreationKeys_set_revocation_key(uint64_t this_ptr, int8_tArray val) {
47505         LDKTxCreationKeys this_ptr_conv;
47506         this_ptr_conv.inner = untag_ptr(this_ptr);
47507         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
47508         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
47509         this_ptr_conv.is_owned = false;
47510         LDKPublicKey val_ref;
47511         CHECK(val->arr_len == 33);
47512         memcpy(val_ref.compressed_form, val->elems, 33); FREE(val);
47513         TxCreationKeys_set_revocation_key(&this_ptr_conv, val_ref);
47514 }
47515
47516 int8_tArray  __attribute__((export_name("TS_TxCreationKeys_get_broadcaster_htlc_key"))) TS_TxCreationKeys_get_broadcaster_htlc_key(uint64_t this_ptr) {
47517         LDKTxCreationKeys this_ptr_conv;
47518         this_ptr_conv.inner = untag_ptr(this_ptr);
47519         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
47520         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
47521         this_ptr_conv.is_owned = false;
47522         int8_tArray ret_arr = init_int8_tArray(33, __LINE__);
47523         memcpy(ret_arr->elems, TxCreationKeys_get_broadcaster_htlc_key(&this_ptr_conv).compressed_form, 33);
47524         return ret_arr;
47525 }
47526
47527 void  __attribute__((export_name("TS_TxCreationKeys_set_broadcaster_htlc_key"))) TS_TxCreationKeys_set_broadcaster_htlc_key(uint64_t this_ptr, int8_tArray val) {
47528         LDKTxCreationKeys this_ptr_conv;
47529         this_ptr_conv.inner = untag_ptr(this_ptr);
47530         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
47531         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
47532         this_ptr_conv.is_owned = false;
47533         LDKPublicKey val_ref;
47534         CHECK(val->arr_len == 33);
47535         memcpy(val_ref.compressed_form, val->elems, 33); FREE(val);
47536         TxCreationKeys_set_broadcaster_htlc_key(&this_ptr_conv, val_ref);
47537 }
47538
47539 int8_tArray  __attribute__((export_name("TS_TxCreationKeys_get_countersignatory_htlc_key"))) TS_TxCreationKeys_get_countersignatory_htlc_key(uint64_t this_ptr) {
47540         LDKTxCreationKeys this_ptr_conv;
47541         this_ptr_conv.inner = untag_ptr(this_ptr);
47542         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
47543         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
47544         this_ptr_conv.is_owned = false;
47545         int8_tArray ret_arr = init_int8_tArray(33, __LINE__);
47546         memcpy(ret_arr->elems, TxCreationKeys_get_countersignatory_htlc_key(&this_ptr_conv).compressed_form, 33);
47547         return ret_arr;
47548 }
47549
47550 void  __attribute__((export_name("TS_TxCreationKeys_set_countersignatory_htlc_key"))) TS_TxCreationKeys_set_countersignatory_htlc_key(uint64_t this_ptr, int8_tArray val) {
47551         LDKTxCreationKeys this_ptr_conv;
47552         this_ptr_conv.inner = untag_ptr(this_ptr);
47553         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
47554         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
47555         this_ptr_conv.is_owned = false;
47556         LDKPublicKey val_ref;
47557         CHECK(val->arr_len == 33);
47558         memcpy(val_ref.compressed_form, val->elems, 33); FREE(val);
47559         TxCreationKeys_set_countersignatory_htlc_key(&this_ptr_conv, val_ref);
47560 }
47561
47562 int8_tArray  __attribute__((export_name("TS_TxCreationKeys_get_broadcaster_delayed_payment_key"))) TS_TxCreationKeys_get_broadcaster_delayed_payment_key(uint64_t this_ptr) {
47563         LDKTxCreationKeys this_ptr_conv;
47564         this_ptr_conv.inner = untag_ptr(this_ptr);
47565         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
47566         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
47567         this_ptr_conv.is_owned = false;
47568         int8_tArray ret_arr = init_int8_tArray(33, __LINE__);
47569         memcpy(ret_arr->elems, TxCreationKeys_get_broadcaster_delayed_payment_key(&this_ptr_conv).compressed_form, 33);
47570         return ret_arr;
47571 }
47572
47573 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) {
47574         LDKTxCreationKeys this_ptr_conv;
47575         this_ptr_conv.inner = untag_ptr(this_ptr);
47576         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
47577         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
47578         this_ptr_conv.is_owned = false;
47579         LDKPublicKey val_ref;
47580         CHECK(val->arr_len == 33);
47581         memcpy(val_ref.compressed_form, val->elems, 33); FREE(val);
47582         TxCreationKeys_set_broadcaster_delayed_payment_key(&this_ptr_conv, val_ref);
47583 }
47584
47585 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) {
47586         LDKPublicKey per_commitment_point_arg_ref;
47587         CHECK(per_commitment_point_arg->arr_len == 33);
47588         memcpy(per_commitment_point_arg_ref.compressed_form, per_commitment_point_arg->elems, 33); FREE(per_commitment_point_arg);
47589         LDKPublicKey revocation_key_arg_ref;
47590         CHECK(revocation_key_arg->arr_len == 33);
47591         memcpy(revocation_key_arg_ref.compressed_form, revocation_key_arg->elems, 33); FREE(revocation_key_arg);
47592         LDKPublicKey broadcaster_htlc_key_arg_ref;
47593         CHECK(broadcaster_htlc_key_arg->arr_len == 33);
47594         memcpy(broadcaster_htlc_key_arg_ref.compressed_form, broadcaster_htlc_key_arg->elems, 33); FREE(broadcaster_htlc_key_arg);
47595         LDKPublicKey countersignatory_htlc_key_arg_ref;
47596         CHECK(countersignatory_htlc_key_arg->arr_len == 33);
47597         memcpy(countersignatory_htlc_key_arg_ref.compressed_form, countersignatory_htlc_key_arg->elems, 33); FREE(countersignatory_htlc_key_arg);
47598         LDKPublicKey broadcaster_delayed_payment_key_arg_ref;
47599         CHECK(broadcaster_delayed_payment_key_arg->arr_len == 33);
47600         memcpy(broadcaster_delayed_payment_key_arg_ref.compressed_form, broadcaster_delayed_payment_key_arg->elems, 33); FREE(broadcaster_delayed_payment_key_arg);
47601         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);
47602         uint64_t ret_ref = 0;
47603         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
47604         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
47605         return ret_ref;
47606 }
47607
47608 jboolean  __attribute__((export_name("TS_TxCreationKeys_eq"))) TS_TxCreationKeys_eq(uint64_t a, uint64_t b) {
47609         LDKTxCreationKeys a_conv;
47610         a_conv.inner = untag_ptr(a);
47611         a_conv.is_owned = ptr_is_owned(a);
47612         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
47613         a_conv.is_owned = false;
47614         LDKTxCreationKeys b_conv;
47615         b_conv.inner = untag_ptr(b);
47616         b_conv.is_owned = ptr_is_owned(b);
47617         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
47618         b_conv.is_owned = false;
47619         jboolean ret_conv = TxCreationKeys_eq(&a_conv, &b_conv);
47620         return ret_conv;
47621 }
47622
47623 static inline uint64_t TxCreationKeys_clone_ptr(LDKTxCreationKeys *NONNULL_PTR arg) {
47624         LDKTxCreationKeys ret_var = TxCreationKeys_clone(arg);
47625         uint64_t ret_ref = 0;
47626         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
47627         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
47628         return ret_ref;
47629 }
47630 int64_t  __attribute__((export_name("TS_TxCreationKeys_clone_ptr"))) TS_TxCreationKeys_clone_ptr(uint64_t arg) {
47631         LDKTxCreationKeys arg_conv;
47632         arg_conv.inner = untag_ptr(arg);
47633         arg_conv.is_owned = ptr_is_owned(arg);
47634         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
47635         arg_conv.is_owned = false;
47636         int64_t ret_conv = TxCreationKeys_clone_ptr(&arg_conv);
47637         return ret_conv;
47638 }
47639
47640 uint64_t  __attribute__((export_name("TS_TxCreationKeys_clone"))) TS_TxCreationKeys_clone(uint64_t orig) {
47641         LDKTxCreationKeys orig_conv;
47642         orig_conv.inner = untag_ptr(orig);
47643         orig_conv.is_owned = ptr_is_owned(orig);
47644         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
47645         orig_conv.is_owned = false;
47646         LDKTxCreationKeys ret_var = TxCreationKeys_clone(&orig_conv);
47647         uint64_t ret_ref = 0;
47648         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
47649         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
47650         return ret_ref;
47651 }
47652
47653 int8_tArray  __attribute__((export_name("TS_TxCreationKeys_write"))) TS_TxCreationKeys_write(uint64_t obj) {
47654         LDKTxCreationKeys obj_conv;
47655         obj_conv.inner = untag_ptr(obj);
47656         obj_conv.is_owned = ptr_is_owned(obj);
47657         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
47658         obj_conv.is_owned = false;
47659         LDKCVec_u8Z ret_var = TxCreationKeys_write(&obj_conv);
47660         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
47661         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
47662         CVec_u8Z_free(ret_var);
47663         return ret_arr;
47664 }
47665
47666 uint64_t  __attribute__((export_name("TS_TxCreationKeys_read"))) TS_TxCreationKeys_read(int8_tArray ser) {
47667         LDKu8slice ser_ref;
47668         ser_ref.datalen = ser->arr_len;
47669         ser_ref.data = ser->elems;
47670         LDKCResult_TxCreationKeysDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TxCreationKeysDecodeErrorZ), "LDKCResult_TxCreationKeysDecodeErrorZ");
47671         *ret_conv = TxCreationKeys_read(ser_ref);
47672         FREE(ser);
47673         return tag_ptr(ret_conv, true);
47674 }
47675
47676 void  __attribute__((export_name("TS_ChannelPublicKeys_free"))) TS_ChannelPublicKeys_free(uint64_t this_obj) {
47677         LDKChannelPublicKeys this_obj_conv;
47678         this_obj_conv.inner = untag_ptr(this_obj);
47679         this_obj_conv.is_owned = ptr_is_owned(this_obj);
47680         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
47681         ChannelPublicKeys_free(this_obj_conv);
47682 }
47683
47684 int8_tArray  __attribute__((export_name("TS_ChannelPublicKeys_get_funding_pubkey"))) TS_ChannelPublicKeys_get_funding_pubkey(uint64_t this_ptr) {
47685         LDKChannelPublicKeys this_ptr_conv;
47686         this_ptr_conv.inner = untag_ptr(this_ptr);
47687         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
47688         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
47689         this_ptr_conv.is_owned = false;
47690         int8_tArray ret_arr = init_int8_tArray(33, __LINE__);
47691         memcpy(ret_arr->elems, ChannelPublicKeys_get_funding_pubkey(&this_ptr_conv).compressed_form, 33);
47692         return ret_arr;
47693 }
47694
47695 void  __attribute__((export_name("TS_ChannelPublicKeys_set_funding_pubkey"))) TS_ChannelPublicKeys_set_funding_pubkey(uint64_t this_ptr, int8_tArray val) {
47696         LDKChannelPublicKeys this_ptr_conv;
47697         this_ptr_conv.inner = untag_ptr(this_ptr);
47698         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
47699         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
47700         this_ptr_conv.is_owned = false;
47701         LDKPublicKey val_ref;
47702         CHECK(val->arr_len == 33);
47703         memcpy(val_ref.compressed_form, val->elems, 33); FREE(val);
47704         ChannelPublicKeys_set_funding_pubkey(&this_ptr_conv, val_ref);
47705 }
47706
47707 int8_tArray  __attribute__((export_name("TS_ChannelPublicKeys_get_revocation_basepoint"))) TS_ChannelPublicKeys_get_revocation_basepoint(uint64_t this_ptr) {
47708         LDKChannelPublicKeys this_ptr_conv;
47709         this_ptr_conv.inner = untag_ptr(this_ptr);
47710         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
47711         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
47712         this_ptr_conv.is_owned = false;
47713         int8_tArray ret_arr = init_int8_tArray(33, __LINE__);
47714         memcpy(ret_arr->elems, ChannelPublicKeys_get_revocation_basepoint(&this_ptr_conv).compressed_form, 33);
47715         return ret_arr;
47716 }
47717
47718 void  __attribute__((export_name("TS_ChannelPublicKeys_set_revocation_basepoint"))) TS_ChannelPublicKeys_set_revocation_basepoint(uint64_t this_ptr, int8_tArray val) {
47719         LDKChannelPublicKeys this_ptr_conv;
47720         this_ptr_conv.inner = untag_ptr(this_ptr);
47721         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
47722         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
47723         this_ptr_conv.is_owned = false;
47724         LDKPublicKey val_ref;
47725         CHECK(val->arr_len == 33);
47726         memcpy(val_ref.compressed_form, val->elems, 33); FREE(val);
47727         ChannelPublicKeys_set_revocation_basepoint(&this_ptr_conv, val_ref);
47728 }
47729
47730 int8_tArray  __attribute__((export_name("TS_ChannelPublicKeys_get_payment_point"))) TS_ChannelPublicKeys_get_payment_point(uint64_t this_ptr) {
47731         LDKChannelPublicKeys this_ptr_conv;
47732         this_ptr_conv.inner = untag_ptr(this_ptr);
47733         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
47734         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
47735         this_ptr_conv.is_owned = false;
47736         int8_tArray ret_arr = init_int8_tArray(33, __LINE__);
47737         memcpy(ret_arr->elems, ChannelPublicKeys_get_payment_point(&this_ptr_conv).compressed_form, 33);
47738         return ret_arr;
47739 }
47740
47741 void  __attribute__((export_name("TS_ChannelPublicKeys_set_payment_point"))) TS_ChannelPublicKeys_set_payment_point(uint64_t this_ptr, int8_tArray val) {
47742         LDKChannelPublicKeys this_ptr_conv;
47743         this_ptr_conv.inner = untag_ptr(this_ptr);
47744         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
47745         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
47746         this_ptr_conv.is_owned = false;
47747         LDKPublicKey val_ref;
47748         CHECK(val->arr_len == 33);
47749         memcpy(val_ref.compressed_form, val->elems, 33); FREE(val);
47750         ChannelPublicKeys_set_payment_point(&this_ptr_conv, val_ref);
47751 }
47752
47753 int8_tArray  __attribute__((export_name("TS_ChannelPublicKeys_get_delayed_payment_basepoint"))) TS_ChannelPublicKeys_get_delayed_payment_basepoint(uint64_t this_ptr) {
47754         LDKChannelPublicKeys this_ptr_conv;
47755         this_ptr_conv.inner = untag_ptr(this_ptr);
47756         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
47757         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
47758         this_ptr_conv.is_owned = false;
47759         int8_tArray ret_arr = init_int8_tArray(33, __LINE__);
47760         memcpy(ret_arr->elems, ChannelPublicKeys_get_delayed_payment_basepoint(&this_ptr_conv).compressed_form, 33);
47761         return ret_arr;
47762 }
47763
47764 void  __attribute__((export_name("TS_ChannelPublicKeys_set_delayed_payment_basepoint"))) TS_ChannelPublicKeys_set_delayed_payment_basepoint(uint64_t this_ptr, int8_tArray val) {
47765         LDKChannelPublicKeys this_ptr_conv;
47766         this_ptr_conv.inner = untag_ptr(this_ptr);
47767         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
47768         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
47769         this_ptr_conv.is_owned = false;
47770         LDKPublicKey val_ref;
47771         CHECK(val->arr_len == 33);
47772         memcpy(val_ref.compressed_form, val->elems, 33); FREE(val);
47773         ChannelPublicKeys_set_delayed_payment_basepoint(&this_ptr_conv, val_ref);
47774 }
47775
47776 int8_tArray  __attribute__((export_name("TS_ChannelPublicKeys_get_htlc_basepoint"))) TS_ChannelPublicKeys_get_htlc_basepoint(uint64_t this_ptr) {
47777         LDKChannelPublicKeys this_ptr_conv;
47778         this_ptr_conv.inner = untag_ptr(this_ptr);
47779         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
47780         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
47781         this_ptr_conv.is_owned = false;
47782         int8_tArray ret_arr = init_int8_tArray(33, __LINE__);
47783         memcpy(ret_arr->elems, ChannelPublicKeys_get_htlc_basepoint(&this_ptr_conv).compressed_form, 33);
47784         return ret_arr;
47785 }
47786
47787 void  __attribute__((export_name("TS_ChannelPublicKeys_set_htlc_basepoint"))) TS_ChannelPublicKeys_set_htlc_basepoint(uint64_t this_ptr, int8_tArray val) {
47788         LDKChannelPublicKeys this_ptr_conv;
47789         this_ptr_conv.inner = untag_ptr(this_ptr);
47790         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
47791         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
47792         this_ptr_conv.is_owned = false;
47793         LDKPublicKey val_ref;
47794         CHECK(val->arr_len == 33);
47795         memcpy(val_ref.compressed_form, val->elems, 33); FREE(val);
47796         ChannelPublicKeys_set_htlc_basepoint(&this_ptr_conv, val_ref);
47797 }
47798
47799 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) {
47800         LDKPublicKey funding_pubkey_arg_ref;
47801         CHECK(funding_pubkey_arg->arr_len == 33);
47802         memcpy(funding_pubkey_arg_ref.compressed_form, funding_pubkey_arg->elems, 33); FREE(funding_pubkey_arg);
47803         LDKPublicKey revocation_basepoint_arg_ref;
47804         CHECK(revocation_basepoint_arg->arr_len == 33);
47805         memcpy(revocation_basepoint_arg_ref.compressed_form, revocation_basepoint_arg->elems, 33); FREE(revocation_basepoint_arg);
47806         LDKPublicKey payment_point_arg_ref;
47807         CHECK(payment_point_arg->arr_len == 33);
47808         memcpy(payment_point_arg_ref.compressed_form, payment_point_arg->elems, 33); FREE(payment_point_arg);
47809         LDKPublicKey delayed_payment_basepoint_arg_ref;
47810         CHECK(delayed_payment_basepoint_arg->arr_len == 33);
47811         memcpy(delayed_payment_basepoint_arg_ref.compressed_form, delayed_payment_basepoint_arg->elems, 33); FREE(delayed_payment_basepoint_arg);
47812         LDKPublicKey htlc_basepoint_arg_ref;
47813         CHECK(htlc_basepoint_arg->arr_len == 33);
47814         memcpy(htlc_basepoint_arg_ref.compressed_form, htlc_basepoint_arg->elems, 33); FREE(htlc_basepoint_arg);
47815         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);
47816         uint64_t ret_ref = 0;
47817         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
47818         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
47819         return ret_ref;
47820 }
47821
47822 static inline uint64_t ChannelPublicKeys_clone_ptr(LDKChannelPublicKeys *NONNULL_PTR arg) {
47823         LDKChannelPublicKeys ret_var = ChannelPublicKeys_clone(arg);
47824         uint64_t ret_ref = 0;
47825         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
47826         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
47827         return ret_ref;
47828 }
47829 int64_t  __attribute__((export_name("TS_ChannelPublicKeys_clone_ptr"))) TS_ChannelPublicKeys_clone_ptr(uint64_t arg) {
47830         LDKChannelPublicKeys arg_conv;
47831         arg_conv.inner = untag_ptr(arg);
47832         arg_conv.is_owned = ptr_is_owned(arg);
47833         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
47834         arg_conv.is_owned = false;
47835         int64_t ret_conv = ChannelPublicKeys_clone_ptr(&arg_conv);
47836         return ret_conv;
47837 }
47838
47839 uint64_t  __attribute__((export_name("TS_ChannelPublicKeys_clone"))) TS_ChannelPublicKeys_clone(uint64_t orig) {
47840         LDKChannelPublicKeys orig_conv;
47841         orig_conv.inner = untag_ptr(orig);
47842         orig_conv.is_owned = ptr_is_owned(orig);
47843         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
47844         orig_conv.is_owned = false;
47845         LDKChannelPublicKeys ret_var = ChannelPublicKeys_clone(&orig_conv);
47846         uint64_t ret_ref = 0;
47847         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
47848         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
47849         return ret_ref;
47850 }
47851
47852 int64_t  __attribute__((export_name("TS_ChannelPublicKeys_hash"))) TS_ChannelPublicKeys_hash(uint64_t o) {
47853         LDKChannelPublicKeys o_conv;
47854         o_conv.inner = untag_ptr(o);
47855         o_conv.is_owned = ptr_is_owned(o);
47856         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
47857         o_conv.is_owned = false;
47858         int64_t ret_conv = ChannelPublicKeys_hash(&o_conv);
47859         return ret_conv;
47860 }
47861
47862 jboolean  __attribute__((export_name("TS_ChannelPublicKeys_eq"))) TS_ChannelPublicKeys_eq(uint64_t a, uint64_t b) {
47863         LDKChannelPublicKeys a_conv;
47864         a_conv.inner = untag_ptr(a);
47865         a_conv.is_owned = ptr_is_owned(a);
47866         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
47867         a_conv.is_owned = false;
47868         LDKChannelPublicKeys b_conv;
47869         b_conv.inner = untag_ptr(b);
47870         b_conv.is_owned = ptr_is_owned(b);
47871         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
47872         b_conv.is_owned = false;
47873         jboolean ret_conv = ChannelPublicKeys_eq(&a_conv, &b_conv);
47874         return ret_conv;
47875 }
47876
47877 int8_tArray  __attribute__((export_name("TS_ChannelPublicKeys_write"))) TS_ChannelPublicKeys_write(uint64_t obj) {
47878         LDKChannelPublicKeys obj_conv;
47879         obj_conv.inner = untag_ptr(obj);
47880         obj_conv.is_owned = ptr_is_owned(obj);
47881         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
47882         obj_conv.is_owned = false;
47883         LDKCVec_u8Z ret_var = ChannelPublicKeys_write(&obj_conv);
47884         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
47885         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
47886         CVec_u8Z_free(ret_var);
47887         return ret_arr;
47888 }
47889
47890 uint64_t  __attribute__((export_name("TS_ChannelPublicKeys_read"))) TS_ChannelPublicKeys_read(int8_tArray ser) {
47891         LDKu8slice ser_ref;
47892         ser_ref.datalen = ser->arr_len;
47893         ser_ref.data = ser->elems;
47894         LDKCResult_ChannelPublicKeysDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelPublicKeysDecodeErrorZ), "LDKCResult_ChannelPublicKeysDecodeErrorZ");
47895         *ret_conv = ChannelPublicKeys_read(ser_ref);
47896         FREE(ser);
47897         return tag_ptr(ret_conv, true);
47898 }
47899
47900 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) {
47901         LDKPublicKey per_commitment_point_ref;
47902         CHECK(per_commitment_point->arr_len == 33);
47903         memcpy(per_commitment_point_ref.compressed_form, per_commitment_point->elems, 33); FREE(per_commitment_point);
47904         LDKPublicKey broadcaster_delayed_payment_base_ref;
47905         CHECK(broadcaster_delayed_payment_base->arr_len == 33);
47906         memcpy(broadcaster_delayed_payment_base_ref.compressed_form, broadcaster_delayed_payment_base->elems, 33); FREE(broadcaster_delayed_payment_base);
47907         LDKPublicKey broadcaster_htlc_base_ref;
47908         CHECK(broadcaster_htlc_base->arr_len == 33);
47909         memcpy(broadcaster_htlc_base_ref.compressed_form, broadcaster_htlc_base->elems, 33); FREE(broadcaster_htlc_base);
47910         LDKPublicKey countersignatory_revocation_base_ref;
47911         CHECK(countersignatory_revocation_base->arr_len == 33);
47912         memcpy(countersignatory_revocation_base_ref.compressed_form, countersignatory_revocation_base->elems, 33); FREE(countersignatory_revocation_base);
47913         LDKPublicKey countersignatory_htlc_base_ref;
47914         CHECK(countersignatory_htlc_base->arr_len == 33);
47915         memcpy(countersignatory_htlc_base_ref.compressed_form, countersignatory_htlc_base->elems, 33); FREE(countersignatory_htlc_base);
47916         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);
47917         uint64_t ret_ref = 0;
47918         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
47919         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
47920         return ret_ref;
47921 }
47922
47923 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) {
47924         LDKPublicKey per_commitment_point_ref;
47925         CHECK(per_commitment_point->arr_len == 33);
47926         memcpy(per_commitment_point_ref.compressed_form, per_commitment_point->elems, 33); FREE(per_commitment_point);
47927         LDKChannelPublicKeys broadcaster_keys_conv;
47928         broadcaster_keys_conv.inner = untag_ptr(broadcaster_keys);
47929         broadcaster_keys_conv.is_owned = ptr_is_owned(broadcaster_keys);
47930         CHECK_INNER_FIELD_ACCESS_OR_NULL(broadcaster_keys_conv);
47931         broadcaster_keys_conv.is_owned = false;
47932         LDKChannelPublicKeys countersignatory_keys_conv;
47933         countersignatory_keys_conv.inner = untag_ptr(countersignatory_keys);
47934         countersignatory_keys_conv.is_owned = ptr_is_owned(countersignatory_keys);
47935         CHECK_INNER_FIELD_ACCESS_OR_NULL(countersignatory_keys_conv);
47936         countersignatory_keys_conv.is_owned = false;
47937         LDKTxCreationKeys ret_var = TxCreationKeys_from_channel_static_keys(per_commitment_point_ref, &broadcaster_keys_conv, &countersignatory_keys_conv);
47938         uint64_t ret_ref = 0;
47939         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
47940         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
47941         return ret_ref;
47942 }
47943
47944 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) {
47945         LDKPublicKey revocation_key_ref;
47946         CHECK(revocation_key->arr_len == 33);
47947         memcpy(revocation_key_ref.compressed_form, revocation_key->elems, 33); FREE(revocation_key);
47948         LDKPublicKey broadcaster_delayed_payment_key_ref;
47949         CHECK(broadcaster_delayed_payment_key->arr_len == 33);
47950         memcpy(broadcaster_delayed_payment_key_ref.compressed_form, broadcaster_delayed_payment_key->elems, 33); FREE(broadcaster_delayed_payment_key);
47951         LDKCVec_u8Z ret_var = get_revokeable_redeemscript(revocation_key_ref, contest_delay, broadcaster_delayed_payment_key_ref);
47952         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
47953         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
47954         CVec_u8Z_free(ret_var);
47955         return ret_arr;
47956 }
47957
47958 int8_tArray  __attribute__((export_name("TS_get_counterparty_payment_script"))) TS_get_counterparty_payment_script(uint64_t channel_type_features, int8_tArray payment_key) {
47959         LDKChannelTypeFeatures channel_type_features_conv;
47960         channel_type_features_conv.inner = untag_ptr(channel_type_features);
47961         channel_type_features_conv.is_owned = ptr_is_owned(channel_type_features);
47962         CHECK_INNER_FIELD_ACCESS_OR_NULL(channel_type_features_conv);
47963         channel_type_features_conv.is_owned = false;
47964         LDKPublicKey payment_key_ref;
47965         CHECK(payment_key->arr_len == 33);
47966         memcpy(payment_key_ref.compressed_form, payment_key->elems, 33); FREE(payment_key);
47967         LDKCVec_u8Z ret_var = get_counterparty_payment_script(&channel_type_features_conv, payment_key_ref);
47968         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
47969         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
47970         CVec_u8Z_free(ret_var);
47971         return ret_arr;
47972 }
47973
47974 void  __attribute__((export_name("TS_HTLCOutputInCommitment_free"))) TS_HTLCOutputInCommitment_free(uint64_t this_obj) {
47975         LDKHTLCOutputInCommitment this_obj_conv;
47976         this_obj_conv.inner = untag_ptr(this_obj);
47977         this_obj_conv.is_owned = ptr_is_owned(this_obj);
47978         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
47979         HTLCOutputInCommitment_free(this_obj_conv);
47980 }
47981
47982 jboolean  __attribute__((export_name("TS_HTLCOutputInCommitment_get_offered"))) TS_HTLCOutputInCommitment_get_offered(uint64_t this_ptr) {
47983         LDKHTLCOutputInCommitment this_ptr_conv;
47984         this_ptr_conv.inner = untag_ptr(this_ptr);
47985         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
47986         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
47987         this_ptr_conv.is_owned = false;
47988         jboolean ret_conv = HTLCOutputInCommitment_get_offered(&this_ptr_conv);
47989         return ret_conv;
47990 }
47991
47992 void  __attribute__((export_name("TS_HTLCOutputInCommitment_set_offered"))) TS_HTLCOutputInCommitment_set_offered(uint64_t this_ptr, jboolean val) {
47993         LDKHTLCOutputInCommitment this_ptr_conv;
47994         this_ptr_conv.inner = untag_ptr(this_ptr);
47995         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
47996         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
47997         this_ptr_conv.is_owned = false;
47998         HTLCOutputInCommitment_set_offered(&this_ptr_conv, val);
47999 }
48000
48001 int64_t  __attribute__((export_name("TS_HTLCOutputInCommitment_get_amount_msat"))) TS_HTLCOutputInCommitment_get_amount_msat(uint64_t this_ptr) {
48002         LDKHTLCOutputInCommitment this_ptr_conv;
48003         this_ptr_conv.inner = untag_ptr(this_ptr);
48004         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
48005         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
48006         this_ptr_conv.is_owned = false;
48007         int64_t ret_conv = HTLCOutputInCommitment_get_amount_msat(&this_ptr_conv);
48008         return ret_conv;
48009 }
48010
48011 void  __attribute__((export_name("TS_HTLCOutputInCommitment_set_amount_msat"))) TS_HTLCOutputInCommitment_set_amount_msat(uint64_t this_ptr, int64_t val) {
48012         LDKHTLCOutputInCommitment this_ptr_conv;
48013         this_ptr_conv.inner = untag_ptr(this_ptr);
48014         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
48015         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
48016         this_ptr_conv.is_owned = false;
48017         HTLCOutputInCommitment_set_amount_msat(&this_ptr_conv, val);
48018 }
48019
48020 int32_t  __attribute__((export_name("TS_HTLCOutputInCommitment_get_cltv_expiry"))) TS_HTLCOutputInCommitment_get_cltv_expiry(uint64_t this_ptr) {
48021         LDKHTLCOutputInCommitment this_ptr_conv;
48022         this_ptr_conv.inner = untag_ptr(this_ptr);
48023         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
48024         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
48025         this_ptr_conv.is_owned = false;
48026         int32_t ret_conv = HTLCOutputInCommitment_get_cltv_expiry(&this_ptr_conv);
48027         return ret_conv;
48028 }
48029
48030 void  __attribute__((export_name("TS_HTLCOutputInCommitment_set_cltv_expiry"))) TS_HTLCOutputInCommitment_set_cltv_expiry(uint64_t this_ptr, int32_t val) {
48031         LDKHTLCOutputInCommitment this_ptr_conv;
48032         this_ptr_conv.inner = untag_ptr(this_ptr);
48033         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
48034         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
48035         this_ptr_conv.is_owned = false;
48036         HTLCOutputInCommitment_set_cltv_expiry(&this_ptr_conv, val);
48037 }
48038
48039 int8_tArray  __attribute__((export_name("TS_HTLCOutputInCommitment_get_payment_hash"))) TS_HTLCOutputInCommitment_get_payment_hash(uint64_t this_ptr) {
48040         LDKHTLCOutputInCommitment this_ptr_conv;
48041         this_ptr_conv.inner = untag_ptr(this_ptr);
48042         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
48043         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
48044         this_ptr_conv.is_owned = false;
48045         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
48046         memcpy(ret_arr->elems, *HTLCOutputInCommitment_get_payment_hash(&this_ptr_conv), 32);
48047         return ret_arr;
48048 }
48049
48050 void  __attribute__((export_name("TS_HTLCOutputInCommitment_set_payment_hash"))) TS_HTLCOutputInCommitment_set_payment_hash(uint64_t this_ptr, int8_tArray val) {
48051         LDKHTLCOutputInCommitment this_ptr_conv;
48052         this_ptr_conv.inner = untag_ptr(this_ptr);
48053         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
48054         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
48055         this_ptr_conv.is_owned = false;
48056         LDKThirtyTwoBytes val_ref;
48057         CHECK(val->arr_len == 32);
48058         memcpy(val_ref.data, val->elems, 32); FREE(val);
48059         HTLCOutputInCommitment_set_payment_hash(&this_ptr_conv, val_ref);
48060 }
48061
48062 uint64_t  __attribute__((export_name("TS_HTLCOutputInCommitment_get_transaction_output_index"))) TS_HTLCOutputInCommitment_get_transaction_output_index(uint64_t this_ptr) {
48063         LDKHTLCOutputInCommitment this_ptr_conv;
48064         this_ptr_conv.inner = untag_ptr(this_ptr);
48065         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
48066         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
48067         this_ptr_conv.is_owned = false;
48068         LDKCOption_u32Z *ret_copy = MALLOC(sizeof(LDKCOption_u32Z), "LDKCOption_u32Z");
48069         *ret_copy = HTLCOutputInCommitment_get_transaction_output_index(&this_ptr_conv);
48070         uint64_t ret_ref = tag_ptr(ret_copy, true);
48071         return ret_ref;
48072 }
48073
48074 void  __attribute__((export_name("TS_HTLCOutputInCommitment_set_transaction_output_index"))) TS_HTLCOutputInCommitment_set_transaction_output_index(uint64_t this_ptr, uint64_t val) {
48075         LDKHTLCOutputInCommitment this_ptr_conv;
48076         this_ptr_conv.inner = untag_ptr(this_ptr);
48077         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
48078         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
48079         this_ptr_conv.is_owned = false;
48080         void* val_ptr = untag_ptr(val);
48081         CHECK_ACCESS(val_ptr);
48082         LDKCOption_u32Z val_conv = *(LDKCOption_u32Z*)(val_ptr);
48083         val_conv = COption_u32Z_clone((LDKCOption_u32Z*)untag_ptr(val));
48084         HTLCOutputInCommitment_set_transaction_output_index(&this_ptr_conv, val_conv);
48085 }
48086
48087 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) {
48088         LDKThirtyTwoBytes payment_hash_arg_ref;
48089         CHECK(payment_hash_arg->arr_len == 32);
48090         memcpy(payment_hash_arg_ref.data, payment_hash_arg->elems, 32); FREE(payment_hash_arg);
48091         void* transaction_output_index_arg_ptr = untag_ptr(transaction_output_index_arg);
48092         CHECK_ACCESS(transaction_output_index_arg_ptr);
48093         LDKCOption_u32Z transaction_output_index_arg_conv = *(LDKCOption_u32Z*)(transaction_output_index_arg_ptr);
48094         transaction_output_index_arg_conv = COption_u32Z_clone((LDKCOption_u32Z*)untag_ptr(transaction_output_index_arg));
48095         LDKHTLCOutputInCommitment ret_var = HTLCOutputInCommitment_new(offered_arg, amount_msat_arg, cltv_expiry_arg, payment_hash_arg_ref, transaction_output_index_arg_conv);
48096         uint64_t ret_ref = 0;
48097         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
48098         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
48099         return ret_ref;
48100 }
48101
48102 static inline uint64_t HTLCOutputInCommitment_clone_ptr(LDKHTLCOutputInCommitment *NONNULL_PTR arg) {
48103         LDKHTLCOutputInCommitment ret_var = HTLCOutputInCommitment_clone(arg);
48104         uint64_t ret_ref = 0;
48105         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
48106         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
48107         return ret_ref;
48108 }
48109 int64_t  __attribute__((export_name("TS_HTLCOutputInCommitment_clone_ptr"))) TS_HTLCOutputInCommitment_clone_ptr(uint64_t arg) {
48110         LDKHTLCOutputInCommitment arg_conv;
48111         arg_conv.inner = untag_ptr(arg);
48112         arg_conv.is_owned = ptr_is_owned(arg);
48113         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
48114         arg_conv.is_owned = false;
48115         int64_t ret_conv = HTLCOutputInCommitment_clone_ptr(&arg_conv);
48116         return ret_conv;
48117 }
48118
48119 uint64_t  __attribute__((export_name("TS_HTLCOutputInCommitment_clone"))) TS_HTLCOutputInCommitment_clone(uint64_t orig) {
48120         LDKHTLCOutputInCommitment orig_conv;
48121         orig_conv.inner = untag_ptr(orig);
48122         orig_conv.is_owned = ptr_is_owned(orig);
48123         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
48124         orig_conv.is_owned = false;
48125         LDKHTLCOutputInCommitment ret_var = HTLCOutputInCommitment_clone(&orig_conv);
48126         uint64_t ret_ref = 0;
48127         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
48128         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
48129         return ret_ref;
48130 }
48131
48132 jboolean  __attribute__((export_name("TS_HTLCOutputInCommitment_eq"))) TS_HTLCOutputInCommitment_eq(uint64_t a, uint64_t b) {
48133         LDKHTLCOutputInCommitment a_conv;
48134         a_conv.inner = untag_ptr(a);
48135         a_conv.is_owned = ptr_is_owned(a);
48136         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
48137         a_conv.is_owned = false;
48138         LDKHTLCOutputInCommitment b_conv;
48139         b_conv.inner = untag_ptr(b);
48140         b_conv.is_owned = ptr_is_owned(b);
48141         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
48142         b_conv.is_owned = false;
48143         jboolean ret_conv = HTLCOutputInCommitment_eq(&a_conv, &b_conv);
48144         return ret_conv;
48145 }
48146
48147 int8_tArray  __attribute__((export_name("TS_HTLCOutputInCommitment_write"))) TS_HTLCOutputInCommitment_write(uint64_t obj) {
48148         LDKHTLCOutputInCommitment obj_conv;
48149         obj_conv.inner = untag_ptr(obj);
48150         obj_conv.is_owned = ptr_is_owned(obj);
48151         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
48152         obj_conv.is_owned = false;
48153         LDKCVec_u8Z ret_var = HTLCOutputInCommitment_write(&obj_conv);
48154         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
48155         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
48156         CVec_u8Z_free(ret_var);
48157         return ret_arr;
48158 }
48159
48160 uint64_t  __attribute__((export_name("TS_HTLCOutputInCommitment_read"))) TS_HTLCOutputInCommitment_read(int8_tArray ser) {
48161         LDKu8slice ser_ref;
48162         ser_ref.datalen = ser->arr_len;
48163         ser_ref.data = ser->elems;
48164         LDKCResult_HTLCOutputInCommitmentDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_HTLCOutputInCommitmentDecodeErrorZ), "LDKCResult_HTLCOutputInCommitmentDecodeErrorZ");
48165         *ret_conv = HTLCOutputInCommitment_read(ser_ref);
48166         FREE(ser);
48167         return tag_ptr(ret_conv, true);
48168 }
48169
48170 int8_tArray  __attribute__((export_name("TS_get_htlc_redeemscript"))) TS_get_htlc_redeemscript(uint64_t htlc, uint64_t channel_type_features, uint64_t keys) {
48171         LDKHTLCOutputInCommitment htlc_conv;
48172         htlc_conv.inner = untag_ptr(htlc);
48173         htlc_conv.is_owned = ptr_is_owned(htlc);
48174         CHECK_INNER_FIELD_ACCESS_OR_NULL(htlc_conv);
48175         htlc_conv.is_owned = false;
48176         LDKChannelTypeFeatures channel_type_features_conv;
48177         channel_type_features_conv.inner = untag_ptr(channel_type_features);
48178         channel_type_features_conv.is_owned = ptr_is_owned(channel_type_features);
48179         CHECK_INNER_FIELD_ACCESS_OR_NULL(channel_type_features_conv);
48180         channel_type_features_conv.is_owned = false;
48181         LDKTxCreationKeys keys_conv;
48182         keys_conv.inner = untag_ptr(keys);
48183         keys_conv.is_owned = ptr_is_owned(keys);
48184         CHECK_INNER_FIELD_ACCESS_OR_NULL(keys_conv);
48185         keys_conv.is_owned = false;
48186         LDKCVec_u8Z ret_var = get_htlc_redeemscript(&htlc_conv, &channel_type_features_conv, &keys_conv);
48187         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
48188         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
48189         CVec_u8Z_free(ret_var);
48190         return ret_arr;
48191 }
48192
48193 int8_tArray  __attribute__((export_name("TS_make_funding_redeemscript"))) TS_make_funding_redeemscript(int8_tArray broadcaster, int8_tArray countersignatory) {
48194         LDKPublicKey broadcaster_ref;
48195         CHECK(broadcaster->arr_len == 33);
48196         memcpy(broadcaster_ref.compressed_form, broadcaster->elems, 33); FREE(broadcaster);
48197         LDKPublicKey countersignatory_ref;
48198         CHECK(countersignatory->arr_len == 33);
48199         memcpy(countersignatory_ref.compressed_form, countersignatory->elems, 33); FREE(countersignatory);
48200         LDKCVec_u8Z ret_var = make_funding_redeemscript(broadcaster_ref, countersignatory_ref);
48201         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
48202         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
48203         CVec_u8Z_free(ret_var);
48204         return ret_arr;
48205 }
48206
48207 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, uint64_t channel_type_features, int8_tArray broadcaster_delayed_payment_key, int8_tArray revocation_key) {
48208         uint8_t commitment_txid_arr[32];
48209         CHECK(commitment_txid->arr_len == 32);
48210         memcpy(commitment_txid_arr, commitment_txid->elems, 32); FREE(commitment_txid);
48211         uint8_t (*commitment_txid_ref)[32] = &commitment_txid_arr;
48212         LDKHTLCOutputInCommitment htlc_conv;
48213         htlc_conv.inner = untag_ptr(htlc);
48214         htlc_conv.is_owned = ptr_is_owned(htlc);
48215         CHECK_INNER_FIELD_ACCESS_OR_NULL(htlc_conv);
48216         htlc_conv.is_owned = false;
48217         LDKChannelTypeFeatures channel_type_features_conv;
48218         channel_type_features_conv.inner = untag_ptr(channel_type_features);
48219         channel_type_features_conv.is_owned = ptr_is_owned(channel_type_features);
48220         CHECK_INNER_FIELD_ACCESS_OR_NULL(channel_type_features_conv);
48221         channel_type_features_conv.is_owned = false;
48222         LDKPublicKey broadcaster_delayed_payment_key_ref;
48223         CHECK(broadcaster_delayed_payment_key->arr_len == 33);
48224         memcpy(broadcaster_delayed_payment_key_ref.compressed_form, broadcaster_delayed_payment_key->elems, 33); FREE(broadcaster_delayed_payment_key);
48225         LDKPublicKey revocation_key_ref;
48226         CHECK(revocation_key->arr_len == 33);
48227         memcpy(revocation_key_ref.compressed_form, revocation_key->elems, 33); FREE(revocation_key);
48228         LDKTransaction ret_var = build_htlc_transaction(commitment_txid_ref, feerate_per_kw, contest_delay, &htlc_conv, &channel_type_features_conv, broadcaster_delayed_payment_key_ref, revocation_key_ref);
48229         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
48230         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
48231         Transaction_free(ret_var);
48232         return ret_arr;
48233 }
48234
48235 int8_tArray  __attribute__((export_name("TS_build_htlc_input_witness"))) TS_build_htlc_input_witness(int8_tArray local_sig, int8_tArray remote_sig, uint64_t preimage, int8_tArray redeem_script, uint64_t channel_type_features) {
48236         LDKECDSASignature local_sig_ref;
48237         CHECK(local_sig->arr_len == 64);
48238         memcpy(local_sig_ref.compact_form, local_sig->elems, 64); FREE(local_sig);
48239         LDKECDSASignature remote_sig_ref;
48240         CHECK(remote_sig->arr_len == 64);
48241         memcpy(remote_sig_ref.compact_form, remote_sig->elems, 64); FREE(remote_sig);
48242         void* preimage_ptr = untag_ptr(preimage);
48243         CHECK_ACCESS(preimage_ptr);
48244         LDKCOption_ThirtyTwoBytesZ preimage_conv = *(LDKCOption_ThirtyTwoBytesZ*)(preimage_ptr);
48245         preimage_conv = COption_ThirtyTwoBytesZ_clone((LDKCOption_ThirtyTwoBytesZ*)untag_ptr(preimage));
48246         LDKu8slice redeem_script_ref;
48247         redeem_script_ref.datalen = redeem_script->arr_len;
48248         redeem_script_ref.data = redeem_script->elems;
48249         LDKChannelTypeFeatures channel_type_features_conv;
48250         channel_type_features_conv.inner = untag_ptr(channel_type_features);
48251         channel_type_features_conv.is_owned = ptr_is_owned(channel_type_features);
48252         CHECK_INNER_FIELD_ACCESS_OR_NULL(channel_type_features_conv);
48253         channel_type_features_conv.is_owned = false;
48254         LDKWitness ret_var = build_htlc_input_witness(local_sig_ref, remote_sig_ref, preimage_conv, redeem_script_ref, &channel_type_features_conv);
48255         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
48256         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
48257         Witness_free(ret_var);
48258         FREE(redeem_script);
48259         return ret_arr;
48260 }
48261
48262 int8_tArray  __attribute__((export_name("TS_get_to_countersignatory_with_anchors_redeemscript"))) TS_get_to_countersignatory_with_anchors_redeemscript(int8_tArray payment_point) {
48263         LDKPublicKey payment_point_ref;
48264         CHECK(payment_point->arr_len == 33);
48265         memcpy(payment_point_ref.compressed_form, payment_point->elems, 33); FREE(payment_point);
48266         LDKCVec_u8Z ret_var = get_to_countersignatory_with_anchors_redeemscript(payment_point_ref);
48267         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
48268         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
48269         CVec_u8Z_free(ret_var);
48270         return ret_arr;
48271 }
48272
48273 int8_tArray  __attribute__((export_name("TS_get_anchor_redeemscript"))) TS_get_anchor_redeemscript(int8_tArray funding_pubkey) {
48274         LDKPublicKey funding_pubkey_ref;
48275         CHECK(funding_pubkey->arr_len == 33);
48276         memcpy(funding_pubkey_ref.compressed_form, funding_pubkey->elems, 33); FREE(funding_pubkey);
48277         LDKCVec_u8Z ret_var = get_anchor_redeemscript(funding_pubkey_ref);
48278         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
48279         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
48280         CVec_u8Z_free(ret_var);
48281         return ret_arr;
48282 }
48283
48284 int8_tArray  __attribute__((export_name("TS_build_anchor_input_witness"))) TS_build_anchor_input_witness(int8_tArray funding_key, int8_tArray funding_sig) {
48285         LDKPublicKey funding_key_ref;
48286         CHECK(funding_key->arr_len == 33);
48287         memcpy(funding_key_ref.compressed_form, funding_key->elems, 33); FREE(funding_key);
48288         LDKECDSASignature funding_sig_ref;
48289         CHECK(funding_sig->arr_len == 64);
48290         memcpy(funding_sig_ref.compact_form, funding_sig->elems, 64); FREE(funding_sig);
48291         LDKWitness ret_var = build_anchor_input_witness(funding_key_ref, funding_sig_ref);
48292         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
48293         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
48294         Witness_free(ret_var);
48295         return ret_arr;
48296 }
48297
48298 void  __attribute__((export_name("TS_ChannelTransactionParameters_free"))) TS_ChannelTransactionParameters_free(uint64_t this_obj) {
48299         LDKChannelTransactionParameters this_obj_conv;
48300         this_obj_conv.inner = untag_ptr(this_obj);
48301         this_obj_conv.is_owned = ptr_is_owned(this_obj);
48302         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
48303         ChannelTransactionParameters_free(this_obj_conv);
48304 }
48305
48306 uint64_t  __attribute__((export_name("TS_ChannelTransactionParameters_get_holder_pubkeys"))) TS_ChannelTransactionParameters_get_holder_pubkeys(uint64_t this_ptr) {
48307         LDKChannelTransactionParameters this_ptr_conv;
48308         this_ptr_conv.inner = untag_ptr(this_ptr);
48309         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
48310         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
48311         this_ptr_conv.is_owned = false;
48312         LDKChannelPublicKeys ret_var = ChannelTransactionParameters_get_holder_pubkeys(&this_ptr_conv);
48313         uint64_t ret_ref = 0;
48314         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
48315         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
48316         return ret_ref;
48317 }
48318
48319 void  __attribute__((export_name("TS_ChannelTransactionParameters_set_holder_pubkeys"))) TS_ChannelTransactionParameters_set_holder_pubkeys(uint64_t this_ptr, uint64_t val) {
48320         LDKChannelTransactionParameters this_ptr_conv;
48321         this_ptr_conv.inner = untag_ptr(this_ptr);
48322         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
48323         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
48324         this_ptr_conv.is_owned = false;
48325         LDKChannelPublicKeys val_conv;
48326         val_conv.inner = untag_ptr(val);
48327         val_conv.is_owned = ptr_is_owned(val);
48328         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
48329         val_conv = ChannelPublicKeys_clone(&val_conv);
48330         ChannelTransactionParameters_set_holder_pubkeys(&this_ptr_conv, val_conv);
48331 }
48332
48333 int16_t  __attribute__((export_name("TS_ChannelTransactionParameters_get_holder_selected_contest_delay"))) TS_ChannelTransactionParameters_get_holder_selected_contest_delay(uint64_t this_ptr) {
48334         LDKChannelTransactionParameters this_ptr_conv;
48335         this_ptr_conv.inner = untag_ptr(this_ptr);
48336         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
48337         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
48338         this_ptr_conv.is_owned = false;
48339         int16_t ret_conv = ChannelTransactionParameters_get_holder_selected_contest_delay(&this_ptr_conv);
48340         return ret_conv;
48341 }
48342
48343 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) {
48344         LDKChannelTransactionParameters this_ptr_conv;
48345         this_ptr_conv.inner = untag_ptr(this_ptr);
48346         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
48347         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
48348         this_ptr_conv.is_owned = false;
48349         ChannelTransactionParameters_set_holder_selected_contest_delay(&this_ptr_conv, val);
48350 }
48351
48352 jboolean  __attribute__((export_name("TS_ChannelTransactionParameters_get_is_outbound_from_holder"))) TS_ChannelTransactionParameters_get_is_outbound_from_holder(uint64_t this_ptr) {
48353         LDKChannelTransactionParameters this_ptr_conv;
48354         this_ptr_conv.inner = untag_ptr(this_ptr);
48355         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
48356         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
48357         this_ptr_conv.is_owned = false;
48358         jboolean ret_conv = ChannelTransactionParameters_get_is_outbound_from_holder(&this_ptr_conv);
48359         return ret_conv;
48360 }
48361
48362 void  __attribute__((export_name("TS_ChannelTransactionParameters_set_is_outbound_from_holder"))) TS_ChannelTransactionParameters_set_is_outbound_from_holder(uint64_t this_ptr, jboolean val) {
48363         LDKChannelTransactionParameters this_ptr_conv;
48364         this_ptr_conv.inner = untag_ptr(this_ptr);
48365         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
48366         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
48367         this_ptr_conv.is_owned = false;
48368         ChannelTransactionParameters_set_is_outbound_from_holder(&this_ptr_conv, val);
48369 }
48370
48371 uint64_t  __attribute__((export_name("TS_ChannelTransactionParameters_get_counterparty_parameters"))) TS_ChannelTransactionParameters_get_counterparty_parameters(uint64_t this_ptr) {
48372         LDKChannelTransactionParameters this_ptr_conv;
48373         this_ptr_conv.inner = untag_ptr(this_ptr);
48374         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
48375         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
48376         this_ptr_conv.is_owned = false;
48377         LDKCounterpartyChannelTransactionParameters ret_var = ChannelTransactionParameters_get_counterparty_parameters(&this_ptr_conv);
48378         uint64_t ret_ref = 0;
48379         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
48380         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
48381         return ret_ref;
48382 }
48383
48384 void  __attribute__((export_name("TS_ChannelTransactionParameters_set_counterparty_parameters"))) TS_ChannelTransactionParameters_set_counterparty_parameters(uint64_t this_ptr, uint64_t val) {
48385         LDKChannelTransactionParameters this_ptr_conv;
48386         this_ptr_conv.inner = untag_ptr(this_ptr);
48387         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
48388         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
48389         this_ptr_conv.is_owned = false;
48390         LDKCounterpartyChannelTransactionParameters val_conv;
48391         val_conv.inner = untag_ptr(val);
48392         val_conv.is_owned = ptr_is_owned(val);
48393         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
48394         val_conv = CounterpartyChannelTransactionParameters_clone(&val_conv);
48395         ChannelTransactionParameters_set_counterparty_parameters(&this_ptr_conv, val_conv);
48396 }
48397
48398 uint64_t  __attribute__((export_name("TS_ChannelTransactionParameters_get_funding_outpoint"))) TS_ChannelTransactionParameters_get_funding_outpoint(uint64_t this_ptr) {
48399         LDKChannelTransactionParameters this_ptr_conv;
48400         this_ptr_conv.inner = untag_ptr(this_ptr);
48401         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
48402         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
48403         this_ptr_conv.is_owned = false;
48404         LDKOutPoint ret_var = ChannelTransactionParameters_get_funding_outpoint(&this_ptr_conv);
48405         uint64_t ret_ref = 0;
48406         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
48407         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
48408         return ret_ref;
48409 }
48410
48411 void  __attribute__((export_name("TS_ChannelTransactionParameters_set_funding_outpoint"))) TS_ChannelTransactionParameters_set_funding_outpoint(uint64_t this_ptr, uint64_t val) {
48412         LDKChannelTransactionParameters this_ptr_conv;
48413         this_ptr_conv.inner = untag_ptr(this_ptr);
48414         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
48415         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
48416         this_ptr_conv.is_owned = false;
48417         LDKOutPoint val_conv;
48418         val_conv.inner = untag_ptr(val);
48419         val_conv.is_owned = ptr_is_owned(val);
48420         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
48421         val_conv = OutPoint_clone(&val_conv);
48422         ChannelTransactionParameters_set_funding_outpoint(&this_ptr_conv, val_conv);
48423 }
48424
48425 uint64_t  __attribute__((export_name("TS_ChannelTransactionParameters_get_channel_type_features"))) TS_ChannelTransactionParameters_get_channel_type_features(uint64_t this_ptr) {
48426         LDKChannelTransactionParameters this_ptr_conv;
48427         this_ptr_conv.inner = untag_ptr(this_ptr);
48428         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
48429         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
48430         this_ptr_conv.is_owned = false;
48431         LDKChannelTypeFeatures ret_var = ChannelTransactionParameters_get_channel_type_features(&this_ptr_conv);
48432         uint64_t ret_ref = 0;
48433         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
48434         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
48435         return ret_ref;
48436 }
48437
48438 void  __attribute__((export_name("TS_ChannelTransactionParameters_set_channel_type_features"))) TS_ChannelTransactionParameters_set_channel_type_features(uint64_t this_ptr, uint64_t val) {
48439         LDKChannelTransactionParameters this_ptr_conv;
48440         this_ptr_conv.inner = untag_ptr(this_ptr);
48441         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
48442         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
48443         this_ptr_conv.is_owned = false;
48444         LDKChannelTypeFeatures val_conv;
48445         val_conv.inner = untag_ptr(val);
48446         val_conv.is_owned = ptr_is_owned(val);
48447         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
48448         val_conv = ChannelTypeFeatures_clone(&val_conv);
48449         ChannelTransactionParameters_set_channel_type_features(&this_ptr_conv, val_conv);
48450 }
48451
48452 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, uint64_t channel_type_features_arg) {
48453         LDKChannelPublicKeys holder_pubkeys_arg_conv;
48454         holder_pubkeys_arg_conv.inner = untag_ptr(holder_pubkeys_arg);
48455         holder_pubkeys_arg_conv.is_owned = ptr_is_owned(holder_pubkeys_arg);
48456         CHECK_INNER_FIELD_ACCESS_OR_NULL(holder_pubkeys_arg_conv);
48457         holder_pubkeys_arg_conv = ChannelPublicKeys_clone(&holder_pubkeys_arg_conv);
48458         LDKCounterpartyChannelTransactionParameters counterparty_parameters_arg_conv;
48459         counterparty_parameters_arg_conv.inner = untag_ptr(counterparty_parameters_arg);
48460         counterparty_parameters_arg_conv.is_owned = ptr_is_owned(counterparty_parameters_arg);
48461         CHECK_INNER_FIELD_ACCESS_OR_NULL(counterparty_parameters_arg_conv);
48462         counterparty_parameters_arg_conv = CounterpartyChannelTransactionParameters_clone(&counterparty_parameters_arg_conv);
48463         LDKOutPoint funding_outpoint_arg_conv;
48464         funding_outpoint_arg_conv.inner = untag_ptr(funding_outpoint_arg);
48465         funding_outpoint_arg_conv.is_owned = ptr_is_owned(funding_outpoint_arg);
48466         CHECK_INNER_FIELD_ACCESS_OR_NULL(funding_outpoint_arg_conv);
48467         funding_outpoint_arg_conv = OutPoint_clone(&funding_outpoint_arg_conv);
48468         LDKChannelTypeFeatures channel_type_features_arg_conv;
48469         channel_type_features_arg_conv.inner = untag_ptr(channel_type_features_arg);
48470         channel_type_features_arg_conv.is_owned = ptr_is_owned(channel_type_features_arg);
48471         CHECK_INNER_FIELD_ACCESS_OR_NULL(channel_type_features_arg_conv);
48472         channel_type_features_arg_conv = ChannelTypeFeatures_clone(&channel_type_features_arg_conv);
48473         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, channel_type_features_arg_conv);
48474         uint64_t ret_ref = 0;
48475         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
48476         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
48477         return ret_ref;
48478 }
48479
48480 static inline uint64_t ChannelTransactionParameters_clone_ptr(LDKChannelTransactionParameters *NONNULL_PTR arg) {
48481         LDKChannelTransactionParameters ret_var = ChannelTransactionParameters_clone(arg);
48482         uint64_t ret_ref = 0;
48483         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
48484         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
48485         return ret_ref;
48486 }
48487 int64_t  __attribute__((export_name("TS_ChannelTransactionParameters_clone_ptr"))) TS_ChannelTransactionParameters_clone_ptr(uint64_t arg) {
48488         LDKChannelTransactionParameters arg_conv;
48489         arg_conv.inner = untag_ptr(arg);
48490         arg_conv.is_owned = ptr_is_owned(arg);
48491         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
48492         arg_conv.is_owned = false;
48493         int64_t ret_conv = ChannelTransactionParameters_clone_ptr(&arg_conv);
48494         return ret_conv;
48495 }
48496
48497 uint64_t  __attribute__((export_name("TS_ChannelTransactionParameters_clone"))) TS_ChannelTransactionParameters_clone(uint64_t orig) {
48498         LDKChannelTransactionParameters orig_conv;
48499         orig_conv.inner = untag_ptr(orig);
48500         orig_conv.is_owned = ptr_is_owned(orig);
48501         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
48502         orig_conv.is_owned = false;
48503         LDKChannelTransactionParameters ret_var = ChannelTransactionParameters_clone(&orig_conv);
48504         uint64_t ret_ref = 0;
48505         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
48506         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
48507         return ret_ref;
48508 }
48509
48510 int64_t  __attribute__((export_name("TS_ChannelTransactionParameters_hash"))) TS_ChannelTransactionParameters_hash(uint64_t o) {
48511         LDKChannelTransactionParameters o_conv;
48512         o_conv.inner = untag_ptr(o);
48513         o_conv.is_owned = ptr_is_owned(o);
48514         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
48515         o_conv.is_owned = false;
48516         int64_t ret_conv = ChannelTransactionParameters_hash(&o_conv);
48517         return ret_conv;
48518 }
48519
48520 jboolean  __attribute__((export_name("TS_ChannelTransactionParameters_eq"))) TS_ChannelTransactionParameters_eq(uint64_t a, uint64_t b) {
48521         LDKChannelTransactionParameters a_conv;
48522         a_conv.inner = untag_ptr(a);
48523         a_conv.is_owned = ptr_is_owned(a);
48524         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
48525         a_conv.is_owned = false;
48526         LDKChannelTransactionParameters b_conv;
48527         b_conv.inner = untag_ptr(b);
48528         b_conv.is_owned = ptr_is_owned(b);
48529         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
48530         b_conv.is_owned = false;
48531         jboolean ret_conv = ChannelTransactionParameters_eq(&a_conv, &b_conv);
48532         return ret_conv;
48533 }
48534
48535 void  __attribute__((export_name("TS_CounterpartyChannelTransactionParameters_free"))) TS_CounterpartyChannelTransactionParameters_free(uint64_t this_obj) {
48536         LDKCounterpartyChannelTransactionParameters this_obj_conv;
48537         this_obj_conv.inner = untag_ptr(this_obj);
48538         this_obj_conv.is_owned = ptr_is_owned(this_obj);
48539         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
48540         CounterpartyChannelTransactionParameters_free(this_obj_conv);
48541 }
48542
48543 uint64_t  __attribute__((export_name("TS_CounterpartyChannelTransactionParameters_get_pubkeys"))) TS_CounterpartyChannelTransactionParameters_get_pubkeys(uint64_t this_ptr) {
48544         LDKCounterpartyChannelTransactionParameters this_ptr_conv;
48545         this_ptr_conv.inner = untag_ptr(this_ptr);
48546         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
48547         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
48548         this_ptr_conv.is_owned = false;
48549         LDKChannelPublicKeys ret_var = CounterpartyChannelTransactionParameters_get_pubkeys(&this_ptr_conv);
48550         uint64_t ret_ref = 0;
48551         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
48552         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
48553         return ret_ref;
48554 }
48555
48556 void  __attribute__((export_name("TS_CounterpartyChannelTransactionParameters_set_pubkeys"))) TS_CounterpartyChannelTransactionParameters_set_pubkeys(uint64_t this_ptr, uint64_t val) {
48557         LDKCounterpartyChannelTransactionParameters this_ptr_conv;
48558         this_ptr_conv.inner = untag_ptr(this_ptr);
48559         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
48560         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
48561         this_ptr_conv.is_owned = false;
48562         LDKChannelPublicKeys val_conv;
48563         val_conv.inner = untag_ptr(val);
48564         val_conv.is_owned = ptr_is_owned(val);
48565         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
48566         val_conv = ChannelPublicKeys_clone(&val_conv);
48567         CounterpartyChannelTransactionParameters_set_pubkeys(&this_ptr_conv, val_conv);
48568 }
48569
48570 int16_t  __attribute__((export_name("TS_CounterpartyChannelTransactionParameters_get_selected_contest_delay"))) TS_CounterpartyChannelTransactionParameters_get_selected_contest_delay(uint64_t this_ptr) {
48571         LDKCounterpartyChannelTransactionParameters this_ptr_conv;
48572         this_ptr_conv.inner = untag_ptr(this_ptr);
48573         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
48574         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
48575         this_ptr_conv.is_owned = false;
48576         int16_t ret_conv = CounterpartyChannelTransactionParameters_get_selected_contest_delay(&this_ptr_conv);
48577         return ret_conv;
48578 }
48579
48580 void  __attribute__((export_name("TS_CounterpartyChannelTransactionParameters_set_selected_contest_delay"))) TS_CounterpartyChannelTransactionParameters_set_selected_contest_delay(uint64_t this_ptr, int16_t val) {
48581         LDKCounterpartyChannelTransactionParameters this_ptr_conv;
48582         this_ptr_conv.inner = untag_ptr(this_ptr);
48583         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
48584         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
48585         this_ptr_conv.is_owned = false;
48586         CounterpartyChannelTransactionParameters_set_selected_contest_delay(&this_ptr_conv, val);
48587 }
48588
48589 uint64_t  __attribute__((export_name("TS_CounterpartyChannelTransactionParameters_new"))) TS_CounterpartyChannelTransactionParameters_new(uint64_t pubkeys_arg, int16_t selected_contest_delay_arg) {
48590         LDKChannelPublicKeys pubkeys_arg_conv;
48591         pubkeys_arg_conv.inner = untag_ptr(pubkeys_arg);
48592         pubkeys_arg_conv.is_owned = ptr_is_owned(pubkeys_arg);
48593         CHECK_INNER_FIELD_ACCESS_OR_NULL(pubkeys_arg_conv);
48594         pubkeys_arg_conv = ChannelPublicKeys_clone(&pubkeys_arg_conv);
48595         LDKCounterpartyChannelTransactionParameters ret_var = CounterpartyChannelTransactionParameters_new(pubkeys_arg_conv, selected_contest_delay_arg);
48596         uint64_t ret_ref = 0;
48597         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
48598         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
48599         return ret_ref;
48600 }
48601
48602 static inline uint64_t CounterpartyChannelTransactionParameters_clone_ptr(LDKCounterpartyChannelTransactionParameters *NONNULL_PTR arg) {
48603         LDKCounterpartyChannelTransactionParameters ret_var = CounterpartyChannelTransactionParameters_clone(arg);
48604         uint64_t ret_ref = 0;
48605         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
48606         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
48607         return ret_ref;
48608 }
48609 int64_t  __attribute__((export_name("TS_CounterpartyChannelTransactionParameters_clone_ptr"))) TS_CounterpartyChannelTransactionParameters_clone_ptr(uint64_t arg) {
48610         LDKCounterpartyChannelTransactionParameters arg_conv;
48611         arg_conv.inner = untag_ptr(arg);
48612         arg_conv.is_owned = ptr_is_owned(arg);
48613         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
48614         arg_conv.is_owned = false;
48615         int64_t ret_conv = CounterpartyChannelTransactionParameters_clone_ptr(&arg_conv);
48616         return ret_conv;
48617 }
48618
48619 uint64_t  __attribute__((export_name("TS_CounterpartyChannelTransactionParameters_clone"))) TS_CounterpartyChannelTransactionParameters_clone(uint64_t orig) {
48620         LDKCounterpartyChannelTransactionParameters orig_conv;
48621         orig_conv.inner = untag_ptr(orig);
48622         orig_conv.is_owned = ptr_is_owned(orig);
48623         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
48624         orig_conv.is_owned = false;
48625         LDKCounterpartyChannelTransactionParameters ret_var = CounterpartyChannelTransactionParameters_clone(&orig_conv);
48626         uint64_t ret_ref = 0;
48627         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
48628         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
48629         return ret_ref;
48630 }
48631
48632 int64_t  __attribute__((export_name("TS_CounterpartyChannelTransactionParameters_hash"))) TS_CounterpartyChannelTransactionParameters_hash(uint64_t o) {
48633         LDKCounterpartyChannelTransactionParameters o_conv;
48634         o_conv.inner = untag_ptr(o);
48635         o_conv.is_owned = ptr_is_owned(o);
48636         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
48637         o_conv.is_owned = false;
48638         int64_t ret_conv = CounterpartyChannelTransactionParameters_hash(&o_conv);
48639         return ret_conv;
48640 }
48641
48642 jboolean  __attribute__((export_name("TS_CounterpartyChannelTransactionParameters_eq"))) TS_CounterpartyChannelTransactionParameters_eq(uint64_t a, uint64_t b) {
48643         LDKCounterpartyChannelTransactionParameters a_conv;
48644         a_conv.inner = untag_ptr(a);
48645         a_conv.is_owned = ptr_is_owned(a);
48646         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
48647         a_conv.is_owned = false;
48648         LDKCounterpartyChannelTransactionParameters b_conv;
48649         b_conv.inner = untag_ptr(b);
48650         b_conv.is_owned = ptr_is_owned(b);
48651         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
48652         b_conv.is_owned = false;
48653         jboolean ret_conv = CounterpartyChannelTransactionParameters_eq(&a_conv, &b_conv);
48654         return ret_conv;
48655 }
48656
48657 jboolean  __attribute__((export_name("TS_ChannelTransactionParameters_is_populated"))) TS_ChannelTransactionParameters_is_populated(uint64_t this_arg) {
48658         LDKChannelTransactionParameters this_arg_conv;
48659         this_arg_conv.inner = untag_ptr(this_arg);
48660         this_arg_conv.is_owned = ptr_is_owned(this_arg);
48661         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
48662         this_arg_conv.is_owned = false;
48663         jboolean ret_conv = ChannelTransactionParameters_is_populated(&this_arg_conv);
48664         return ret_conv;
48665 }
48666
48667 uint64_t  __attribute__((export_name("TS_ChannelTransactionParameters_as_holder_broadcastable"))) TS_ChannelTransactionParameters_as_holder_broadcastable(uint64_t this_arg) {
48668         LDKChannelTransactionParameters this_arg_conv;
48669         this_arg_conv.inner = untag_ptr(this_arg);
48670         this_arg_conv.is_owned = ptr_is_owned(this_arg);
48671         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
48672         this_arg_conv.is_owned = false;
48673         LDKDirectedChannelTransactionParameters ret_var = ChannelTransactionParameters_as_holder_broadcastable(&this_arg_conv);
48674         uint64_t ret_ref = 0;
48675         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
48676         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
48677         return ret_ref;
48678 }
48679
48680 uint64_t  __attribute__((export_name("TS_ChannelTransactionParameters_as_counterparty_broadcastable"))) TS_ChannelTransactionParameters_as_counterparty_broadcastable(uint64_t this_arg) {
48681         LDKChannelTransactionParameters this_arg_conv;
48682         this_arg_conv.inner = untag_ptr(this_arg);
48683         this_arg_conv.is_owned = ptr_is_owned(this_arg);
48684         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
48685         this_arg_conv.is_owned = false;
48686         LDKDirectedChannelTransactionParameters ret_var = ChannelTransactionParameters_as_counterparty_broadcastable(&this_arg_conv);
48687         uint64_t ret_ref = 0;
48688         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
48689         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
48690         return ret_ref;
48691 }
48692
48693 int8_tArray  __attribute__((export_name("TS_CounterpartyChannelTransactionParameters_write"))) TS_CounterpartyChannelTransactionParameters_write(uint64_t obj) {
48694         LDKCounterpartyChannelTransactionParameters obj_conv;
48695         obj_conv.inner = untag_ptr(obj);
48696         obj_conv.is_owned = ptr_is_owned(obj);
48697         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
48698         obj_conv.is_owned = false;
48699         LDKCVec_u8Z ret_var = CounterpartyChannelTransactionParameters_write(&obj_conv);
48700         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
48701         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
48702         CVec_u8Z_free(ret_var);
48703         return ret_arr;
48704 }
48705
48706 uint64_t  __attribute__((export_name("TS_CounterpartyChannelTransactionParameters_read"))) TS_CounterpartyChannelTransactionParameters_read(int8_tArray ser) {
48707         LDKu8slice ser_ref;
48708         ser_ref.datalen = ser->arr_len;
48709         ser_ref.data = ser->elems;
48710         LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ), "LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ");
48711         *ret_conv = CounterpartyChannelTransactionParameters_read(ser_ref);
48712         FREE(ser);
48713         return tag_ptr(ret_conv, true);
48714 }
48715
48716 int8_tArray  __attribute__((export_name("TS_ChannelTransactionParameters_write"))) TS_ChannelTransactionParameters_write(uint64_t obj) {
48717         LDKChannelTransactionParameters obj_conv;
48718         obj_conv.inner = untag_ptr(obj);
48719         obj_conv.is_owned = ptr_is_owned(obj);
48720         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
48721         obj_conv.is_owned = false;
48722         LDKCVec_u8Z ret_var = ChannelTransactionParameters_write(&obj_conv);
48723         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
48724         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
48725         CVec_u8Z_free(ret_var);
48726         return ret_arr;
48727 }
48728
48729 uint64_t  __attribute__((export_name("TS_ChannelTransactionParameters_read"))) TS_ChannelTransactionParameters_read(int8_tArray ser) {
48730         LDKu8slice ser_ref;
48731         ser_ref.datalen = ser->arr_len;
48732         ser_ref.data = ser->elems;
48733         LDKCResult_ChannelTransactionParametersDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelTransactionParametersDecodeErrorZ), "LDKCResult_ChannelTransactionParametersDecodeErrorZ");
48734         *ret_conv = ChannelTransactionParameters_read(ser_ref);
48735         FREE(ser);
48736         return tag_ptr(ret_conv, true);
48737 }
48738
48739 void  __attribute__((export_name("TS_DirectedChannelTransactionParameters_free"))) TS_DirectedChannelTransactionParameters_free(uint64_t this_obj) {
48740         LDKDirectedChannelTransactionParameters this_obj_conv;
48741         this_obj_conv.inner = untag_ptr(this_obj);
48742         this_obj_conv.is_owned = ptr_is_owned(this_obj);
48743         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
48744         DirectedChannelTransactionParameters_free(this_obj_conv);
48745 }
48746
48747 uint64_t  __attribute__((export_name("TS_DirectedChannelTransactionParameters_broadcaster_pubkeys"))) TS_DirectedChannelTransactionParameters_broadcaster_pubkeys(uint64_t this_arg) {
48748         LDKDirectedChannelTransactionParameters this_arg_conv;
48749         this_arg_conv.inner = untag_ptr(this_arg);
48750         this_arg_conv.is_owned = ptr_is_owned(this_arg);
48751         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
48752         this_arg_conv.is_owned = false;
48753         LDKChannelPublicKeys ret_var = DirectedChannelTransactionParameters_broadcaster_pubkeys(&this_arg_conv);
48754         uint64_t ret_ref = 0;
48755         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
48756         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
48757         return ret_ref;
48758 }
48759
48760 uint64_t  __attribute__((export_name("TS_DirectedChannelTransactionParameters_countersignatory_pubkeys"))) TS_DirectedChannelTransactionParameters_countersignatory_pubkeys(uint64_t this_arg) {
48761         LDKDirectedChannelTransactionParameters this_arg_conv;
48762         this_arg_conv.inner = untag_ptr(this_arg);
48763         this_arg_conv.is_owned = ptr_is_owned(this_arg);
48764         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
48765         this_arg_conv.is_owned = false;
48766         LDKChannelPublicKeys ret_var = DirectedChannelTransactionParameters_countersignatory_pubkeys(&this_arg_conv);
48767         uint64_t ret_ref = 0;
48768         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
48769         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
48770         return ret_ref;
48771 }
48772
48773 int16_t  __attribute__((export_name("TS_DirectedChannelTransactionParameters_contest_delay"))) TS_DirectedChannelTransactionParameters_contest_delay(uint64_t this_arg) {
48774         LDKDirectedChannelTransactionParameters this_arg_conv;
48775         this_arg_conv.inner = untag_ptr(this_arg);
48776         this_arg_conv.is_owned = ptr_is_owned(this_arg);
48777         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
48778         this_arg_conv.is_owned = false;
48779         int16_t ret_conv = DirectedChannelTransactionParameters_contest_delay(&this_arg_conv);
48780         return ret_conv;
48781 }
48782
48783 jboolean  __attribute__((export_name("TS_DirectedChannelTransactionParameters_is_outbound"))) TS_DirectedChannelTransactionParameters_is_outbound(uint64_t this_arg) {
48784         LDKDirectedChannelTransactionParameters this_arg_conv;
48785         this_arg_conv.inner = untag_ptr(this_arg);
48786         this_arg_conv.is_owned = ptr_is_owned(this_arg);
48787         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
48788         this_arg_conv.is_owned = false;
48789         jboolean ret_conv = DirectedChannelTransactionParameters_is_outbound(&this_arg_conv);
48790         return ret_conv;
48791 }
48792
48793 uint64_t  __attribute__((export_name("TS_DirectedChannelTransactionParameters_funding_outpoint"))) TS_DirectedChannelTransactionParameters_funding_outpoint(uint64_t this_arg) {
48794         LDKDirectedChannelTransactionParameters this_arg_conv;
48795         this_arg_conv.inner = untag_ptr(this_arg);
48796         this_arg_conv.is_owned = ptr_is_owned(this_arg);
48797         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
48798         this_arg_conv.is_owned = false;
48799         LDKOutPoint ret_var = DirectedChannelTransactionParameters_funding_outpoint(&this_arg_conv);
48800         uint64_t ret_ref = 0;
48801         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
48802         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
48803         return ret_ref;
48804 }
48805
48806 uint64_t  __attribute__((export_name("TS_DirectedChannelTransactionParameters_channel_type_features"))) TS_DirectedChannelTransactionParameters_channel_type_features(uint64_t this_arg) {
48807         LDKDirectedChannelTransactionParameters this_arg_conv;
48808         this_arg_conv.inner = untag_ptr(this_arg);
48809         this_arg_conv.is_owned = ptr_is_owned(this_arg);
48810         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
48811         this_arg_conv.is_owned = false;
48812         LDKChannelTypeFeatures ret_var = DirectedChannelTransactionParameters_channel_type_features(&this_arg_conv);
48813         uint64_t ret_ref = 0;
48814         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
48815         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
48816         return ret_ref;
48817 }
48818
48819 void  __attribute__((export_name("TS_HolderCommitmentTransaction_free"))) TS_HolderCommitmentTransaction_free(uint64_t this_obj) {
48820         LDKHolderCommitmentTransaction this_obj_conv;
48821         this_obj_conv.inner = untag_ptr(this_obj);
48822         this_obj_conv.is_owned = ptr_is_owned(this_obj);
48823         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
48824         HolderCommitmentTransaction_free(this_obj_conv);
48825 }
48826
48827 int8_tArray  __attribute__((export_name("TS_HolderCommitmentTransaction_get_counterparty_sig"))) TS_HolderCommitmentTransaction_get_counterparty_sig(uint64_t this_ptr) {
48828         LDKHolderCommitmentTransaction this_ptr_conv;
48829         this_ptr_conv.inner = untag_ptr(this_ptr);
48830         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
48831         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
48832         this_ptr_conv.is_owned = false;
48833         int8_tArray ret_arr = init_int8_tArray(64, __LINE__);
48834         memcpy(ret_arr->elems, HolderCommitmentTransaction_get_counterparty_sig(&this_ptr_conv).compact_form, 64);
48835         return ret_arr;
48836 }
48837
48838 void  __attribute__((export_name("TS_HolderCommitmentTransaction_set_counterparty_sig"))) TS_HolderCommitmentTransaction_set_counterparty_sig(uint64_t this_ptr, int8_tArray val) {
48839         LDKHolderCommitmentTransaction this_ptr_conv;
48840         this_ptr_conv.inner = untag_ptr(this_ptr);
48841         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
48842         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
48843         this_ptr_conv.is_owned = false;
48844         LDKECDSASignature val_ref;
48845         CHECK(val->arr_len == 64);
48846         memcpy(val_ref.compact_form, val->elems, 64); FREE(val);
48847         HolderCommitmentTransaction_set_counterparty_sig(&this_ptr_conv, val_ref);
48848 }
48849
48850 ptrArray  __attribute__((export_name("TS_HolderCommitmentTransaction_get_counterparty_htlc_sigs"))) TS_HolderCommitmentTransaction_get_counterparty_htlc_sigs(uint64_t this_ptr) {
48851         LDKHolderCommitmentTransaction this_ptr_conv;
48852         this_ptr_conv.inner = untag_ptr(this_ptr);
48853         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
48854         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
48855         this_ptr_conv.is_owned = false;
48856         LDKCVec_ECDSASignatureZ ret_var = HolderCommitmentTransaction_get_counterparty_htlc_sigs(&this_ptr_conv);
48857         ptrArray ret_arr = NULL;
48858         ret_arr = init_ptrArray(ret_var.datalen, __LINE__);
48859         int8_tArray *ret_arr_ptr = (int8_tArray*)(((uint8_t*)ret_arr) + 8);
48860         for (size_t m = 0; m < ret_var.datalen; m++) {
48861                 int8_tArray ret_conv_12_arr = init_int8_tArray(64, __LINE__);
48862                 memcpy(ret_conv_12_arr->elems, ret_var.data[m].compact_form, 64);
48863                 ret_arr_ptr[m] = ret_conv_12_arr;
48864         }
48865         
48866         FREE(ret_var.data);
48867         return ret_arr;
48868 }
48869
48870 void  __attribute__((export_name("TS_HolderCommitmentTransaction_set_counterparty_htlc_sigs"))) TS_HolderCommitmentTransaction_set_counterparty_htlc_sigs(uint64_t this_ptr, ptrArray val) {
48871         LDKHolderCommitmentTransaction this_ptr_conv;
48872         this_ptr_conv.inner = untag_ptr(this_ptr);
48873         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
48874         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
48875         this_ptr_conv.is_owned = false;
48876         LDKCVec_ECDSASignatureZ val_constr;
48877         val_constr.datalen = val->arr_len;
48878         if (val_constr.datalen > 0)
48879                 val_constr.data = MALLOC(val_constr.datalen * sizeof(LDKECDSASignature), "LDKCVec_ECDSASignatureZ Elements");
48880         else
48881                 val_constr.data = NULL;
48882         int8_tArray* val_vals = (void*) val->elems;
48883         for (size_t m = 0; m < val_constr.datalen; m++) {
48884                 int8_tArray val_conv_12 = val_vals[m];
48885                 LDKECDSASignature val_conv_12_ref;
48886                 CHECK(val_conv_12->arr_len == 64);
48887                 memcpy(val_conv_12_ref.compact_form, val_conv_12->elems, 64); FREE(val_conv_12);
48888                 val_constr.data[m] = val_conv_12_ref;
48889         }
48890         FREE(val);
48891         HolderCommitmentTransaction_set_counterparty_htlc_sigs(&this_ptr_conv, val_constr);
48892 }
48893
48894 static inline uint64_t HolderCommitmentTransaction_clone_ptr(LDKHolderCommitmentTransaction *NONNULL_PTR arg) {
48895         LDKHolderCommitmentTransaction ret_var = HolderCommitmentTransaction_clone(arg);
48896         uint64_t ret_ref = 0;
48897         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
48898         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
48899         return ret_ref;
48900 }
48901 int64_t  __attribute__((export_name("TS_HolderCommitmentTransaction_clone_ptr"))) TS_HolderCommitmentTransaction_clone_ptr(uint64_t arg) {
48902         LDKHolderCommitmentTransaction arg_conv;
48903         arg_conv.inner = untag_ptr(arg);
48904         arg_conv.is_owned = ptr_is_owned(arg);
48905         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
48906         arg_conv.is_owned = false;
48907         int64_t ret_conv = HolderCommitmentTransaction_clone_ptr(&arg_conv);
48908         return ret_conv;
48909 }
48910
48911 uint64_t  __attribute__((export_name("TS_HolderCommitmentTransaction_clone"))) TS_HolderCommitmentTransaction_clone(uint64_t orig) {
48912         LDKHolderCommitmentTransaction orig_conv;
48913         orig_conv.inner = untag_ptr(orig);
48914         orig_conv.is_owned = ptr_is_owned(orig);
48915         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
48916         orig_conv.is_owned = false;
48917         LDKHolderCommitmentTransaction ret_var = HolderCommitmentTransaction_clone(&orig_conv);
48918         uint64_t ret_ref = 0;
48919         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
48920         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
48921         return ret_ref;
48922 }
48923
48924 int8_tArray  __attribute__((export_name("TS_HolderCommitmentTransaction_write"))) TS_HolderCommitmentTransaction_write(uint64_t obj) {
48925         LDKHolderCommitmentTransaction obj_conv;
48926         obj_conv.inner = untag_ptr(obj);
48927         obj_conv.is_owned = ptr_is_owned(obj);
48928         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
48929         obj_conv.is_owned = false;
48930         LDKCVec_u8Z ret_var = HolderCommitmentTransaction_write(&obj_conv);
48931         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
48932         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
48933         CVec_u8Z_free(ret_var);
48934         return ret_arr;
48935 }
48936
48937 uint64_t  __attribute__((export_name("TS_HolderCommitmentTransaction_read"))) TS_HolderCommitmentTransaction_read(int8_tArray ser) {
48938         LDKu8slice ser_ref;
48939         ser_ref.datalen = ser->arr_len;
48940         ser_ref.data = ser->elems;
48941         LDKCResult_HolderCommitmentTransactionDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_HolderCommitmentTransactionDecodeErrorZ), "LDKCResult_HolderCommitmentTransactionDecodeErrorZ");
48942         *ret_conv = HolderCommitmentTransaction_read(ser_ref);
48943         FREE(ser);
48944         return tag_ptr(ret_conv, true);
48945 }
48946
48947 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) {
48948         LDKCommitmentTransaction commitment_tx_conv;
48949         commitment_tx_conv.inner = untag_ptr(commitment_tx);
48950         commitment_tx_conv.is_owned = ptr_is_owned(commitment_tx);
48951         CHECK_INNER_FIELD_ACCESS_OR_NULL(commitment_tx_conv);
48952         commitment_tx_conv = CommitmentTransaction_clone(&commitment_tx_conv);
48953         LDKECDSASignature counterparty_sig_ref;
48954         CHECK(counterparty_sig->arr_len == 64);
48955         memcpy(counterparty_sig_ref.compact_form, counterparty_sig->elems, 64); FREE(counterparty_sig);
48956         LDKCVec_ECDSASignatureZ counterparty_htlc_sigs_constr;
48957         counterparty_htlc_sigs_constr.datalen = counterparty_htlc_sigs->arr_len;
48958         if (counterparty_htlc_sigs_constr.datalen > 0)
48959                 counterparty_htlc_sigs_constr.data = MALLOC(counterparty_htlc_sigs_constr.datalen * sizeof(LDKECDSASignature), "LDKCVec_ECDSASignatureZ Elements");
48960         else
48961                 counterparty_htlc_sigs_constr.data = NULL;
48962         int8_tArray* counterparty_htlc_sigs_vals = (void*) counterparty_htlc_sigs->elems;
48963         for (size_t m = 0; m < counterparty_htlc_sigs_constr.datalen; m++) {
48964                 int8_tArray counterparty_htlc_sigs_conv_12 = counterparty_htlc_sigs_vals[m];
48965                 LDKECDSASignature counterparty_htlc_sigs_conv_12_ref;
48966                 CHECK(counterparty_htlc_sigs_conv_12->arr_len == 64);
48967                 memcpy(counterparty_htlc_sigs_conv_12_ref.compact_form, counterparty_htlc_sigs_conv_12->elems, 64); FREE(counterparty_htlc_sigs_conv_12);
48968                 counterparty_htlc_sigs_constr.data[m] = counterparty_htlc_sigs_conv_12_ref;
48969         }
48970         FREE(counterparty_htlc_sigs);
48971         LDKPublicKey holder_funding_key_ref;
48972         CHECK(holder_funding_key->arr_len == 33);
48973         memcpy(holder_funding_key_ref.compressed_form, holder_funding_key->elems, 33); FREE(holder_funding_key);
48974         LDKPublicKey counterparty_funding_key_ref;
48975         CHECK(counterparty_funding_key->arr_len == 33);
48976         memcpy(counterparty_funding_key_ref.compressed_form, counterparty_funding_key->elems, 33); FREE(counterparty_funding_key);
48977         LDKHolderCommitmentTransaction ret_var = HolderCommitmentTransaction_new(commitment_tx_conv, counterparty_sig_ref, counterparty_htlc_sigs_constr, holder_funding_key_ref, counterparty_funding_key_ref);
48978         uint64_t ret_ref = 0;
48979         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
48980         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
48981         return ret_ref;
48982 }
48983
48984 void  __attribute__((export_name("TS_BuiltCommitmentTransaction_free"))) TS_BuiltCommitmentTransaction_free(uint64_t this_obj) {
48985         LDKBuiltCommitmentTransaction this_obj_conv;
48986         this_obj_conv.inner = untag_ptr(this_obj);
48987         this_obj_conv.is_owned = ptr_is_owned(this_obj);
48988         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
48989         BuiltCommitmentTransaction_free(this_obj_conv);
48990 }
48991
48992 int8_tArray  __attribute__((export_name("TS_BuiltCommitmentTransaction_get_transaction"))) TS_BuiltCommitmentTransaction_get_transaction(uint64_t this_ptr) {
48993         LDKBuiltCommitmentTransaction this_ptr_conv;
48994         this_ptr_conv.inner = untag_ptr(this_ptr);
48995         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
48996         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
48997         this_ptr_conv.is_owned = false;
48998         LDKTransaction ret_var = BuiltCommitmentTransaction_get_transaction(&this_ptr_conv);
48999         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
49000         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
49001         Transaction_free(ret_var);
49002         return ret_arr;
49003 }
49004
49005 void  __attribute__((export_name("TS_BuiltCommitmentTransaction_set_transaction"))) TS_BuiltCommitmentTransaction_set_transaction(uint64_t this_ptr, int8_tArray val) {
49006         LDKBuiltCommitmentTransaction this_ptr_conv;
49007         this_ptr_conv.inner = untag_ptr(this_ptr);
49008         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
49009         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
49010         this_ptr_conv.is_owned = false;
49011         LDKTransaction val_ref;
49012         val_ref.datalen = val->arr_len;
49013         val_ref.data = MALLOC(val_ref.datalen, "LDKTransaction Bytes");
49014         memcpy(val_ref.data, val->elems, val_ref.datalen); FREE(val);
49015         val_ref.data_is_owned = true;
49016         BuiltCommitmentTransaction_set_transaction(&this_ptr_conv, val_ref);
49017 }
49018
49019 int8_tArray  __attribute__((export_name("TS_BuiltCommitmentTransaction_get_txid"))) TS_BuiltCommitmentTransaction_get_txid(uint64_t this_ptr) {
49020         LDKBuiltCommitmentTransaction 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         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
49026         memcpy(ret_arr->elems, *BuiltCommitmentTransaction_get_txid(&this_ptr_conv), 32);
49027         return ret_arr;
49028 }
49029
49030 void  __attribute__((export_name("TS_BuiltCommitmentTransaction_set_txid"))) TS_BuiltCommitmentTransaction_set_txid(uint64_t this_ptr, int8_tArray val) {
49031         LDKBuiltCommitmentTransaction this_ptr_conv;
49032         this_ptr_conv.inner = untag_ptr(this_ptr);
49033         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
49034         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
49035         this_ptr_conv.is_owned = false;
49036         LDKThirtyTwoBytes val_ref;
49037         CHECK(val->arr_len == 32);
49038         memcpy(val_ref.data, val->elems, 32); FREE(val);
49039         BuiltCommitmentTransaction_set_txid(&this_ptr_conv, val_ref);
49040 }
49041
49042 uint64_t  __attribute__((export_name("TS_BuiltCommitmentTransaction_new"))) TS_BuiltCommitmentTransaction_new(int8_tArray transaction_arg, int8_tArray txid_arg) {
49043         LDKTransaction transaction_arg_ref;
49044         transaction_arg_ref.datalen = transaction_arg->arr_len;
49045         transaction_arg_ref.data = MALLOC(transaction_arg_ref.datalen, "LDKTransaction Bytes");
49046         memcpy(transaction_arg_ref.data, transaction_arg->elems, transaction_arg_ref.datalen); FREE(transaction_arg);
49047         transaction_arg_ref.data_is_owned = true;
49048         LDKThirtyTwoBytes txid_arg_ref;
49049         CHECK(txid_arg->arr_len == 32);
49050         memcpy(txid_arg_ref.data, txid_arg->elems, 32); FREE(txid_arg);
49051         LDKBuiltCommitmentTransaction ret_var = BuiltCommitmentTransaction_new(transaction_arg_ref, txid_arg_ref);
49052         uint64_t ret_ref = 0;
49053         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
49054         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
49055         return ret_ref;
49056 }
49057
49058 static inline uint64_t BuiltCommitmentTransaction_clone_ptr(LDKBuiltCommitmentTransaction *NONNULL_PTR arg) {
49059         LDKBuiltCommitmentTransaction ret_var = BuiltCommitmentTransaction_clone(arg);
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 int64_t  __attribute__((export_name("TS_BuiltCommitmentTransaction_clone_ptr"))) TS_BuiltCommitmentTransaction_clone_ptr(uint64_t arg) {
49066         LDKBuiltCommitmentTransaction arg_conv;
49067         arg_conv.inner = untag_ptr(arg);
49068         arg_conv.is_owned = ptr_is_owned(arg);
49069         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
49070         arg_conv.is_owned = false;
49071         int64_t ret_conv = BuiltCommitmentTransaction_clone_ptr(&arg_conv);
49072         return ret_conv;
49073 }
49074
49075 uint64_t  __attribute__((export_name("TS_BuiltCommitmentTransaction_clone"))) TS_BuiltCommitmentTransaction_clone(uint64_t orig) {
49076         LDKBuiltCommitmentTransaction orig_conv;
49077         orig_conv.inner = untag_ptr(orig);
49078         orig_conv.is_owned = ptr_is_owned(orig);
49079         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
49080         orig_conv.is_owned = false;
49081         LDKBuiltCommitmentTransaction ret_var = BuiltCommitmentTransaction_clone(&orig_conv);
49082         uint64_t ret_ref = 0;
49083         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
49084         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
49085         return ret_ref;
49086 }
49087
49088 int8_tArray  __attribute__((export_name("TS_BuiltCommitmentTransaction_write"))) TS_BuiltCommitmentTransaction_write(uint64_t obj) {
49089         LDKBuiltCommitmentTransaction obj_conv;
49090         obj_conv.inner = untag_ptr(obj);
49091         obj_conv.is_owned = ptr_is_owned(obj);
49092         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
49093         obj_conv.is_owned = false;
49094         LDKCVec_u8Z ret_var = BuiltCommitmentTransaction_write(&obj_conv);
49095         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
49096         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
49097         CVec_u8Z_free(ret_var);
49098         return ret_arr;
49099 }
49100
49101 uint64_t  __attribute__((export_name("TS_BuiltCommitmentTransaction_read"))) TS_BuiltCommitmentTransaction_read(int8_tArray ser) {
49102         LDKu8slice ser_ref;
49103         ser_ref.datalen = ser->arr_len;
49104         ser_ref.data = ser->elems;
49105         LDKCResult_BuiltCommitmentTransactionDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_BuiltCommitmentTransactionDecodeErrorZ), "LDKCResult_BuiltCommitmentTransactionDecodeErrorZ");
49106         *ret_conv = BuiltCommitmentTransaction_read(ser_ref);
49107         FREE(ser);
49108         return tag_ptr(ret_conv, true);
49109 }
49110
49111 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) {
49112         LDKBuiltCommitmentTransaction this_arg_conv;
49113         this_arg_conv.inner = untag_ptr(this_arg);
49114         this_arg_conv.is_owned = ptr_is_owned(this_arg);
49115         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
49116         this_arg_conv.is_owned = false;
49117         LDKu8slice funding_redeemscript_ref;
49118         funding_redeemscript_ref.datalen = funding_redeemscript->arr_len;
49119         funding_redeemscript_ref.data = funding_redeemscript->elems;
49120         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
49121         memcpy(ret_arr->elems, BuiltCommitmentTransaction_get_sighash_all(&this_arg_conv, funding_redeemscript_ref, channel_value_satoshis).data, 32);
49122         FREE(funding_redeemscript);
49123         return ret_arr;
49124 }
49125
49126 int8_tArray  __attribute__((export_name("TS_BuiltCommitmentTransaction_sign_counterparty_commitment"))) TS_BuiltCommitmentTransaction_sign_counterparty_commitment(uint64_t this_arg, int8_tArray funding_key, int8_tArray funding_redeemscript, int64_t channel_value_satoshis) {
49127         LDKBuiltCommitmentTransaction this_arg_conv;
49128         this_arg_conv.inner = untag_ptr(this_arg);
49129         this_arg_conv.is_owned = ptr_is_owned(this_arg);
49130         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
49131         this_arg_conv.is_owned = false;
49132         uint8_t funding_key_arr[32];
49133         CHECK(funding_key->arr_len == 32);
49134         memcpy(funding_key_arr, funding_key->elems, 32); FREE(funding_key);
49135         uint8_t (*funding_key_ref)[32] = &funding_key_arr;
49136         LDKu8slice funding_redeemscript_ref;
49137         funding_redeemscript_ref.datalen = funding_redeemscript->arr_len;
49138         funding_redeemscript_ref.data = funding_redeemscript->elems;
49139         int8_tArray ret_arr = init_int8_tArray(64, __LINE__);
49140         memcpy(ret_arr->elems, BuiltCommitmentTransaction_sign_counterparty_commitment(&this_arg_conv, funding_key_ref, funding_redeemscript_ref, channel_value_satoshis).compact_form, 64);
49141         FREE(funding_redeemscript);
49142         return ret_arr;
49143 }
49144
49145 int8_tArray  __attribute__((export_name("TS_BuiltCommitmentTransaction_sign_holder_commitment"))) TS_BuiltCommitmentTransaction_sign_holder_commitment(uint64_t this_arg, int8_tArray funding_key, int8_tArray funding_redeemscript, int64_t channel_value_satoshis, uint64_t entropy_source) {
49146         LDKBuiltCommitmentTransaction this_arg_conv;
49147         this_arg_conv.inner = untag_ptr(this_arg);
49148         this_arg_conv.is_owned = ptr_is_owned(this_arg);
49149         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
49150         this_arg_conv.is_owned = false;
49151         uint8_t funding_key_arr[32];
49152         CHECK(funding_key->arr_len == 32);
49153         memcpy(funding_key_arr, funding_key->elems, 32); FREE(funding_key);
49154         uint8_t (*funding_key_ref)[32] = &funding_key_arr;
49155         LDKu8slice funding_redeemscript_ref;
49156         funding_redeemscript_ref.datalen = funding_redeemscript->arr_len;
49157         funding_redeemscript_ref.data = funding_redeemscript->elems;
49158         void* entropy_source_ptr = untag_ptr(entropy_source);
49159         if (ptr_is_owned(entropy_source)) { CHECK_ACCESS(entropy_source_ptr); }
49160         LDKEntropySource* entropy_source_conv = (LDKEntropySource*)entropy_source_ptr;
49161         int8_tArray ret_arr = init_int8_tArray(64, __LINE__);
49162         memcpy(ret_arr->elems, BuiltCommitmentTransaction_sign_holder_commitment(&this_arg_conv, funding_key_ref, funding_redeemscript_ref, channel_value_satoshis, entropy_source_conv).compact_form, 64);
49163         FREE(funding_redeemscript);
49164         return ret_arr;
49165 }
49166
49167 void  __attribute__((export_name("TS_ClosingTransaction_free"))) TS_ClosingTransaction_free(uint64_t this_obj) {
49168         LDKClosingTransaction this_obj_conv;
49169         this_obj_conv.inner = untag_ptr(this_obj);
49170         this_obj_conv.is_owned = ptr_is_owned(this_obj);
49171         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
49172         ClosingTransaction_free(this_obj_conv);
49173 }
49174
49175 static inline uint64_t ClosingTransaction_clone_ptr(LDKClosingTransaction *NONNULL_PTR arg) {
49176         LDKClosingTransaction ret_var = ClosingTransaction_clone(arg);
49177         uint64_t ret_ref = 0;
49178         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
49179         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
49180         return ret_ref;
49181 }
49182 int64_t  __attribute__((export_name("TS_ClosingTransaction_clone_ptr"))) TS_ClosingTransaction_clone_ptr(uint64_t arg) {
49183         LDKClosingTransaction arg_conv;
49184         arg_conv.inner = untag_ptr(arg);
49185         arg_conv.is_owned = ptr_is_owned(arg);
49186         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
49187         arg_conv.is_owned = false;
49188         int64_t ret_conv = ClosingTransaction_clone_ptr(&arg_conv);
49189         return ret_conv;
49190 }
49191
49192 uint64_t  __attribute__((export_name("TS_ClosingTransaction_clone"))) TS_ClosingTransaction_clone(uint64_t orig) {
49193         LDKClosingTransaction orig_conv;
49194         orig_conv.inner = untag_ptr(orig);
49195         orig_conv.is_owned = ptr_is_owned(orig);
49196         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
49197         orig_conv.is_owned = false;
49198         LDKClosingTransaction ret_var = ClosingTransaction_clone(&orig_conv);
49199         uint64_t ret_ref = 0;
49200         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
49201         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
49202         return ret_ref;
49203 }
49204
49205 int64_t  __attribute__((export_name("TS_ClosingTransaction_hash"))) TS_ClosingTransaction_hash(uint64_t o) {
49206         LDKClosingTransaction o_conv;
49207         o_conv.inner = untag_ptr(o);
49208         o_conv.is_owned = ptr_is_owned(o);
49209         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
49210         o_conv.is_owned = false;
49211         int64_t ret_conv = ClosingTransaction_hash(&o_conv);
49212         return ret_conv;
49213 }
49214
49215 jboolean  __attribute__((export_name("TS_ClosingTransaction_eq"))) TS_ClosingTransaction_eq(uint64_t a, uint64_t b) {
49216         LDKClosingTransaction a_conv;
49217         a_conv.inner = untag_ptr(a);
49218         a_conv.is_owned = ptr_is_owned(a);
49219         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
49220         a_conv.is_owned = false;
49221         LDKClosingTransaction b_conv;
49222         b_conv.inner = untag_ptr(b);
49223         b_conv.is_owned = ptr_is_owned(b);
49224         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
49225         b_conv.is_owned = false;
49226         jboolean ret_conv = ClosingTransaction_eq(&a_conv, &b_conv);
49227         return ret_conv;
49228 }
49229
49230 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) {
49231         LDKCVec_u8Z to_holder_script_ref;
49232         to_holder_script_ref.datalen = to_holder_script->arr_len;
49233         to_holder_script_ref.data = MALLOC(to_holder_script_ref.datalen, "LDKCVec_u8Z Bytes");
49234         memcpy(to_holder_script_ref.data, to_holder_script->elems, to_holder_script_ref.datalen); FREE(to_holder_script);
49235         LDKCVec_u8Z to_counterparty_script_ref;
49236         to_counterparty_script_ref.datalen = to_counterparty_script->arr_len;
49237         to_counterparty_script_ref.data = MALLOC(to_counterparty_script_ref.datalen, "LDKCVec_u8Z Bytes");
49238         memcpy(to_counterparty_script_ref.data, to_counterparty_script->elems, to_counterparty_script_ref.datalen); FREE(to_counterparty_script);
49239         LDKOutPoint funding_outpoint_conv;
49240         funding_outpoint_conv.inner = untag_ptr(funding_outpoint);
49241         funding_outpoint_conv.is_owned = ptr_is_owned(funding_outpoint);
49242         CHECK_INNER_FIELD_ACCESS_OR_NULL(funding_outpoint_conv);
49243         funding_outpoint_conv = OutPoint_clone(&funding_outpoint_conv);
49244         LDKClosingTransaction ret_var = ClosingTransaction_new(to_holder_value_sat, to_counterparty_value_sat, to_holder_script_ref, to_counterparty_script_ref, funding_outpoint_conv);
49245         uint64_t ret_ref = 0;
49246         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
49247         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
49248         return ret_ref;
49249 }
49250
49251 uint64_t  __attribute__((export_name("TS_ClosingTransaction_trust"))) TS_ClosingTransaction_trust(uint64_t this_arg) {
49252         LDKClosingTransaction this_arg_conv;
49253         this_arg_conv.inner = untag_ptr(this_arg);
49254         this_arg_conv.is_owned = ptr_is_owned(this_arg);
49255         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
49256         this_arg_conv.is_owned = false;
49257         LDKTrustedClosingTransaction ret_var = ClosingTransaction_trust(&this_arg_conv);
49258         uint64_t ret_ref = 0;
49259         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
49260         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
49261         return ret_ref;
49262 }
49263
49264 uint64_t  __attribute__((export_name("TS_ClosingTransaction_verify"))) TS_ClosingTransaction_verify(uint64_t this_arg, uint64_t funding_outpoint) {
49265         LDKClosingTransaction this_arg_conv;
49266         this_arg_conv.inner = untag_ptr(this_arg);
49267         this_arg_conv.is_owned = ptr_is_owned(this_arg);
49268         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
49269         this_arg_conv.is_owned = false;
49270         LDKOutPoint funding_outpoint_conv;
49271         funding_outpoint_conv.inner = untag_ptr(funding_outpoint);
49272         funding_outpoint_conv.is_owned = ptr_is_owned(funding_outpoint);
49273         CHECK_INNER_FIELD_ACCESS_OR_NULL(funding_outpoint_conv);
49274         funding_outpoint_conv = OutPoint_clone(&funding_outpoint_conv);
49275         LDKCResult_TrustedClosingTransactionNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_TrustedClosingTransactionNoneZ), "LDKCResult_TrustedClosingTransactionNoneZ");
49276         *ret_conv = ClosingTransaction_verify(&this_arg_conv, funding_outpoint_conv);
49277         return tag_ptr(ret_conv, true);
49278 }
49279
49280 int64_t  __attribute__((export_name("TS_ClosingTransaction_to_holder_value_sat"))) TS_ClosingTransaction_to_holder_value_sat(uint64_t this_arg) {
49281         LDKClosingTransaction this_arg_conv;
49282         this_arg_conv.inner = untag_ptr(this_arg);
49283         this_arg_conv.is_owned = ptr_is_owned(this_arg);
49284         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
49285         this_arg_conv.is_owned = false;
49286         int64_t ret_conv = ClosingTransaction_to_holder_value_sat(&this_arg_conv);
49287         return ret_conv;
49288 }
49289
49290 int64_t  __attribute__((export_name("TS_ClosingTransaction_to_counterparty_value_sat"))) TS_ClosingTransaction_to_counterparty_value_sat(uint64_t this_arg) {
49291         LDKClosingTransaction this_arg_conv;
49292         this_arg_conv.inner = untag_ptr(this_arg);
49293         this_arg_conv.is_owned = ptr_is_owned(this_arg);
49294         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
49295         this_arg_conv.is_owned = false;
49296         int64_t ret_conv = ClosingTransaction_to_counterparty_value_sat(&this_arg_conv);
49297         return ret_conv;
49298 }
49299
49300 int8_tArray  __attribute__((export_name("TS_ClosingTransaction_to_holder_script"))) TS_ClosingTransaction_to_holder_script(uint64_t this_arg) {
49301         LDKClosingTransaction this_arg_conv;
49302         this_arg_conv.inner = untag_ptr(this_arg);
49303         this_arg_conv.is_owned = ptr_is_owned(this_arg);
49304         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
49305         this_arg_conv.is_owned = false;
49306         LDKu8slice ret_var = ClosingTransaction_to_holder_script(&this_arg_conv);
49307         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
49308         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
49309         return ret_arr;
49310 }
49311
49312 int8_tArray  __attribute__((export_name("TS_ClosingTransaction_to_counterparty_script"))) TS_ClosingTransaction_to_counterparty_script(uint64_t this_arg) {
49313         LDKClosingTransaction this_arg_conv;
49314         this_arg_conv.inner = untag_ptr(this_arg);
49315         this_arg_conv.is_owned = ptr_is_owned(this_arg);
49316         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
49317         this_arg_conv.is_owned = false;
49318         LDKu8slice ret_var = ClosingTransaction_to_counterparty_script(&this_arg_conv);
49319         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
49320         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
49321         return ret_arr;
49322 }
49323
49324 void  __attribute__((export_name("TS_TrustedClosingTransaction_free"))) TS_TrustedClosingTransaction_free(uint64_t this_obj) {
49325         LDKTrustedClosingTransaction this_obj_conv;
49326         this_obj_conv.inner = untag_ptr(this_obj);
49327         this_obj_conv.is_owned = ptr_is_owned(this_obj);
49328         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
49329         TrustedClosingTransaction_free(this_obj_conv);
49330 }
49331
49332 int8_tArray  __attribute__((export_name("TS_TrustedClosingTransaction_built_transaction"))) TS_TrustedClosingTransaction_built_transaction(uint64_t this_arg) {
49333         LDKTrustedClosingTransaction this_arg_conv;
49334         this_arg_conv.inner = untag_ptr(this_arg);
49335         this_arg_conv.is_owned = ptr_is_owned(this_arg);
49336         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
49337         this_arg_conv.is_owned = false;
49338         LDKTransaction ret_var = TrustedClosingTransaction_built_transaction(&this_arg_conv);
49339         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
49340         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
49341         Transaction_free(ret_var);
49342         return ret_arr;
49343 }
49344
49345 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) {
49346         LDKTrustedClosingTransaction this_arg_conv;
49347         this_arg_conv.inner = untag_ptr(this_arg);
49348         this_arg_conv.is_owned = ptr_is_owned(this_arg);
49349         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
49350         this_arg_conv.is_owned = false;
49351         LDKu8slice funding_redeemscript_ref;
49352         funding_redeemscript_ref.datalen = funding_redeemscript->arr_len;
49353         funding_redeemscript_ref.data = funding_redeemscript->elems;
49354         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
49355         memcpy(ret_arr->elems, TrustedClosingTransaction_get_sighash_all(&this_arg_conv, funding_redeemscript_ref, channel_value_satoshis).data, 32);
49356         FREE(funding_redeemscript);
49357         return ret_arr;
49358 }
49359
49360 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) {
49361         LDKTrustedClosingTransaction 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         uint8_t funding_key_arr[32];
49367         CHECK(funding_key->arr_len == 32);
49368         memcpy(funding_key_arr, funding_key->elems, 32); FREE(funding_key);
49369         uint8_t (*funding_key_ref)[32] = &funding_key_arr;
49370         LDKu8slice funding_redeemscript_ref;
49371         funding_redeemscript_ref.datalen = funding_redeemscript->arr_len;
49372         funding_redeemscript_ref.data = funding_redeemscript->elems;
49373         int8_tArray ret_arr = init_int8_tArray(64, __LINE__);
49374         memcpy(ret_arr->elems, TrustedClosingTransaction_sign(&this_arg_conv, funding_key_ref, funding_redeemscript_ref, channel_value_satoshis).compact_form, 64);
49375         FREE(funding_redeemscript);
49376         return ret_arr;
49377 }
49378
49379 void  __attribute__((export_name("TS_CommitmentTransaction_free"))) TS_CommitmentTransaction_free(uint64_t this_obj) {
49380         LDKCommitmentTransaction this_obj_conv;
49381         this_obj_conv.inner = untag_ptr(this_obj);
49382         this_obj_conv.is_owned = ptr_is_owned(this_obj);
49383         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
49384         CommitmentTransaction_free(this_obj_conv);
49385 }
49386
49387 static inline uint64_t CommitmentTransaction_clone_ptr(LDKCommitmentTransaction *NONNULL_PTR arg) {
49388         LDKCommitmentTransaction ret_var = CommitmentTransaction_clone(arg);
49389         uint64_t ret_ref = 0;
49390         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
49391         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
49392         return ret_ref;
49393 }
49394 int64_t  __attribute__((export_name("TS_CommitmentTransaction_clone_ptr"))) TS_CommitmentTransaction_clone_ptr(uint64_t arg) {
49395         LDKCommitmentTransaction arg_conv;
49396         arg_conv.inner = untag_ptr(arg);
49397         arg_conv.is_owned = ptr_is_owned(arg);
49398         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
49399         arg_conv.is_owned = false;
49400         int64_t ret_conv = CommitmentTransaction_clone_ptr(&arg_conv);
49401         return ret_conv;
49402 }
49403
49404 uint64_t  __attribute__((export_name("TS_CommitmentTransaction_clone"))) TS_CommitmentTransaction_clone(uint64_t orig) {
49405         LDKCommitmentTransaction orig_conv;
49406         orig_conv.inner = untag_ptr(orig);
49407         orig_conv.is_owned = ptr_is_owned(orig);
49408         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
49409         orig_conv.is_owned = false;
49410         LDKCommitmentTransaction ret_var = CommitmentTransaction_clone(&orig_conv);
49411         uint64_t ret_ref = 0;
49412         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
49413         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
49414         return ret_ref;
49415 }
49416
49417 int8_tArray  __attribute__((export_name("TS_CommitmentTransaction_write"))) TS_CommitmentTransaction_write(uint64_t obj) {
49418         LDKCommitmentTransaction obj_conv;
49419         obj_conv.inner = untag_ptr(obj);
49420         obj_conv.is_owned = ptr_is_owned(obj);
49421         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
49422         obj_conv.is_owned = false;
49423         LDKCVec_u8Z ret_var = CommitmentTransaction_write(&obj_conv);
49424         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
49425         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
49426         CVec_u8Z_free(ret_var);
49427         return ret_arr;
49428 }
49429
49430 uint64_t  __attribute__((export_name("TS_CommitmentTransaction_read"))) TS_CommitmentTransaction_read(int8_tArray ser) {
49431         LDKu8slice ser_ref;
49432         ser_ref.datalen = ser->arr_len;
49433         ser_ref.data = ser->elems;
49434         LDKCResult_CommitmentTransactionDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CommitmentTransactionDecodeErrorZ), "LDKCResult_CommitmentTransactionDecodeErrorZ");
49435         *ret_conv = CommitmentTransaction_read(ser_ref);
49436         FREE(ser);
49437         return tag_ptr(ret_conv, true);
49438 }
49439
49440 int64_t  __attribute__((export_name("TS_CommitmentTransaction_commitment_number"))) TS_CommitmentTransaction_commitment_number(uint64_t this_arg) {
49441         LDKCommitmentTransaction this_arg_conv;
49442         this_arg_conv.inner = untag_ptr(this_arg);
49443         this_arg_conv.is_owned = ptr_is_owned(this_arg);
49444         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
49445         this_arg_conv.is_owned = false;
49446         int64_t ret_conv = CommitmentTransaction_commitment_number(&this_arg_conv);
49447         return ret_conv;
49448 }
49449
49450 int8_tArray  __attribute__((export_name("TS_CommitmentTransaction_per_commitment_point"))) TS_CommitmentTransaction_per_commitment_point(uint64_t this_arg) {
49451         LDKCommitmentTransaction this_arg_conv;
49452         this_arg_conv.inner = untag_ptr(this_arg);
49453         this_arg_conv.is_owned = ptr_is_owned(this_arg);
49454         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
49455         this_arg_conv.is_owned = false;
49456         int8_tArray ret_arr = init_int8_tArray(33, __LINE__);
49457         memcpy(ret_arr->elems, CommitmentTransaction_per_commitment_point(&this_arg_conv).compressed_form, 33);
49458         return ret_arr;
49459 }
49460
49461 int64_t  __attribute__((export_name("TS_CommitmentTransaction_to_broadcaster_value_sat"))) TS_CommitmentTransaction_to_broadcaster_value_sat(uint64_t this_arg) {
49462         LDKCommitmentTransaction this_arg_conv;
49463         this_arg_conv.inner = untag_ptr(this_arg);
49464         this_arg_conv.is_owned = ptr_is_owned(this_arg);
49465         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
49466         this_arg_conv.is_owned = false;
49467         int64_t ret_conv = CommitmentTransaction_to_broadcaster_value_sat(&this_arg_conv);
49468         return ret_conv;
49469 }
49470
49471 int64_t  __attribute__((export_name("TS_CommitmentTransaction_to_countersignatory_value_sat"))) TS_CommitmentTransaction_to_countersignatory_value_sat(uint64_t this_arg) {
49472         LDKCommitmentTransaction this_arg_conv;
49473         this_arg_conv.inner = untag_ptr(this_arg);
49474         this_arg_conv.is_owned = ptr_is_owned(this_arg);
49475         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
49476         this_arg_conv.is_owned = false;
49477         int64_t ret_conv = CommitmentTransaction_to_countersignatory_value_sat(&this_arg_conv);
49478         return ret_conv;
49479 }
49480
49481 int32_t  __attribute__((export_name("TS_CommitmentTransaction_feerate_per_kw"))) TS_CommitmentTransaction_feerate_per_kw(uint64_t this_arg) {
49482         LDKCommitmentTransaction this_arg_conv;
49483         this_arg_conv.inner = untag_ptr(this_arg);
49484         this_arg_conv.is_owned = ptr_is_owned(this_arg);
49485         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
49486         this_arg_conv.is_owned = false;
49487         int32_t ret_conv = CommitmentTransaction_feerate_per_kw(&this_arg_conv);
49488         return ret_conv;
49489 }
49490
49491 uint64_t  __attribute__((export_name("TS_CommitmentTransaction_trust"))) TS_CommitmentTransaction_trust(uint64_t this_arg) {
49492         LDKCommitmentTransaction this_arg_conv;
49493         this_arg_conv.inner = untag_ptr(this_arg);
49494         this_arg_conv.is_owned = ptr_is_owned(this_arg);
49495         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
49496         this_arg_conv.is_owned = false;
49497         LDKTrustedCommitmentTransaction ret_var = CommitmentTransaction_trust(&this_arg_conv);
49498         uint64_t ret_ref = 0;
49499         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
49500         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
49501         return ret_ref;
49502 }
49503
49504 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) {
49505         LDKCommitmentTransaction this_arg_conv;
49506         this_arg_conv.inner = untag_ptr(this_arg);
49507         this_arg_conv.is_owned = ptr_is_owned(this_arg);
49508         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
49509         this_arg_conv.is_owned = false;
49510         LDKDirectedChannelTransactionParameters channel_parameters_conv;
49511         channel_parameters_conv.inner = untag_ptr(channel_parameters);
49512         channel_parameters_conv.is_owned = ptr_is_owned(channel_parameters);
49513         CHECK_INNER_FIELD_ACCESS_OR_NULL(channel_parameters_conv);
49514         channel_parameters_conv.is_owned = false;
49515         LDKChannelPublicKeys broadcaster_keys_conv;
49516         broadcaster_keys_conv.inner = untag_ptr(broadcaster_keys);
49517         broadcaster_keys_conv.is_owned = ptr_is_owned(broadcaster_keys);
49518         CHECK_INNER_FIELD_ACCESS_OR_NULL(broadcaster_keys_conv);
49519         broadcaster_keys_conv.is_owned = false;
49520         LDKChannelPublicKeys countersignatory_keys_conv;
49521         countersignatory_keys_conv.inner = untag_ptr(countersignatory_keys);
49522         countersignatory_keys_conv.is_owned = ptr_is_owned(countersignatory_keys);
49523         CHECK_INNER_FIELD_ACCESS_OR_NULL(countersignatory_keys_conv);
49524         countersignatory_keys_conv.is_owned = false;
49525         LDKCResult_TrustedCommitmentTransactionNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_TrustedCommitmentTransactionNoneZ), "LDKCResult_TrustedCommitmentTransactionNoneZ");
49526         *ret_conv = CommitmentTransaction_verify(&this_arg_conv, &channel_parameters_conv, &broadcaster_keys_conv, &countersignatory_keys_conv);
49527         return tag_ptr(ret_conv, true);
49528 }
49529
49530 void  __attribute__((export_name("TS_TrustedCommitmentTransaction_free"))) TS_TrustedCommitmentTransaction_free(uint64_t this_obj) {
49531         LDKTrustedCommitmentTransaction this_obj_conv;
49532         this_obj_conv.inner = untag_ptr(this_obj);
49533         this_obj_conv.is_owned = ptr_is_owned(this_obj);
49534         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
49535         TrustedCommitmentTransaction_free(this_obj_conv);
49536 }
49537
49538 int8_tArray  __attribute__((export_name("TS_TrustedCommitmentTransaction_txid"))) TS_TrustedCommitmentTransaction_txid(uint64_t this_arg) {
49539         LDKTrustedCommitmentTransaction this_arg_conv;
49540         this_arg_conv.inner = untag_ptr(this_arg);
49541         this_arg_conv.is_owned = ptr_is_owned(this_arg);
49542         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
49543         this_arg_conv.is_owned = false;
49544         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
49545         memcpy(ret_arr->elems, TrustedCommitmentTransaction_txid(&this_arg_conv).data, 32);
49546         return ret_arr;
49547 }
49548
49549 uint64_t  __attribute__((export_name("TS_TrustedCommitmentTransaction_built_transaction"))) TS_TrustedCommitmentTransaction_built_transaction(uint64_t this_arg) {
49550         LDKTrustedCommitmentTransaction 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.is_owned = false;
49555         LDKBuiltCommitmentTransaction ret_var = TrustedCommitmentTransaction_built_transaction(&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_TrustedCommitmentTransaction_keys"))) TS_TrustedCommitmentTransaction_keys(uint64_t this_arg) {
49563         LDKTrustedCommitmentTransaction 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         LDKTxCreationKeys ret_var = TrustedCommitmentTransaction_keys(&this_arg_conv);
49569         uint64_t ret_ref = 0;
49570         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
49571         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
49572         return ret_ref;
49573 }
49574
49575 uint64_t  __attribute__((export_name("TS_TrustedCommitmentTransaction_channel_type_features"))) TS_TrustedCommitmentTransaction_channel_type_features(uint64_t this_arg) {
49576         LDKTrustedCommitmentTransaction this_arg_conv;
49577         this_arg_conv.inner = untag_ptr(this_arg);
49578         this_arg_conv.is_owned = ptr_is_owned(this_arg);
49579         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
49580         this_arg_conv.is_owned = false;
49581         LDKChannelTypeFeatures ret_var = TrustedCommitmentTransaction_channel_type_features(&this_arg_conv);
49582         uint64_t ret_ref = 0;
49583         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
49584         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
49585         return ret_ref;
49586 }
49587
49588 uint64_t  __attribute__((export_name("TS_TrustedCommitmentTransaction_get_htlc_sigs"))) TS_TrustedCommitmentTransaction_get_htlc_sigs(uint64_t this_arg, int8_tArray htlc_base_key, uint64_t channel_parameters, uint64_t entropy_source) {
49589         LDKTrustedCommitmentTransaction this_arg_conv;
49590         this_arg_conv.inner = untag_ptr(this_arg);
49591         this_arg_conv.is_owned = ptr_is_owned(this_arg);
49592         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
49593         this_arg_conv.is_owned = false;
49594         uint8_t htlc_base_key_arr[32];
49595         CHECK(htlc_base_key->arr_len == 32);
49596         memcpy(htlc_base_key_arr, htlc_base_key->elems, 32); FREE(htlc_base_key);
49597         uint8_t (*htlc_base_key_ref)[32] = &htlc_base_key_arr;
49598         LDKDirectedChannelTransactionParameters channel_parameters_conv;
49599         channel_parameters_conv.inner = untag_ptr(channel_parameters);
49600         channel_parameters_conv.is_owned = ptr_is_owned(channel_parameters);
49601         CHECK_INNER_FIELD_ACCESS_OR_NULL(channel_parameters_conv);
49602         channel_parameters_conv.is_owned = false;
49603         void* entropy_source_ptr = untag_ptr(entropy_source);
49604         if (ptr_is_owned(entropy_source)) { CHECK_ACCESS(entropy_source_ptr); }
49605         LDKEntropySource* entropy_source_conv = (LDKEntropySource*)entropy_source_ptr;
49606         LDKCResult_CVec_ECDSASignatureZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_ECDSASignatureZNoneZ), "LDKCResult_CVec_ECDSASignatureZNoneZ");
49607         *ret_conv = TrustedCommitmentTransaction_get_htlc_sigs(&this_arg_conv, htlc_base_key_ref, &channel_parameters_conv, entropy_source_conv);
49608         return tag_ptr(ret_conv, true);
49609 }
49610
49611 uint64_t  __attribute__((export_name("TS_TrustedCommitmentTransaction_revokeable_output_index"))) TS_TrustedCommitmentTransaction_revokeable_output_index(uint64_t this_arg) {
49612         LDKTrustedCommitmentTransaction this_arg_conv;
49613         this_arg_conv.inner = untag_ptr(this_arg);
49614         this_arg_conv.is_owned = ptr_is_owned(this_arg);
49615         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
49616         this_arg_conv.is_owned = false;
49617         LDKCOption_usizeZ *ret_copy = MALLOC(sizeof(LDKCOption_usizeZ), "LDKCOption_usizeZ");
49618         *ret_copy = TrustedCommitmentTransaction_revokeable_output_index(&this_arg_conv);
49619         uint64_t ret_ref = tag_ptr(ret_copy, true);
49620         return ret_ref;
49621 }
49622
49623 uint64_t  __attribute__((export_name("TS_TrustedCommitmentTransaction_build_to_local_justice_tx"))) TS_TrustedCommitmentTransaction_build_to_local_justice_tx(uint64_t this_arg, int64_t feerate_per_kw, int8_tArray destination_script) {
49624         LDKTrustedCommitmentTransaction this_arg_conv;
49625         this_arg_conv.inner = untag_ptr(this_arg);
49626         this_arg_conv.is_owned = ptr_is_owned(this_arg);
49627         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
49628         this_arg_conv.is_owned = false;
49629         LDKCVec_u8Z destination_script_ref;
49630         destination_script_ref.datalen = destination_script->arr_len;
49631         destination_script_ref.data = MALLOC(destination_script_ref.datalen, "LDKCVec_u8Z Bytes");
49632         memcpy(destination_script_ref.data, destination_script->elems, destination_script_ref.datalen); FREE(destination_script);
49633         LDKCResult_TransactionNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_TransactionNoneZ), "LDKCResult_TransactionNoneZ");
49634         *ret_conv = TrustedCommitmentTransaction_build_to_local_justice_tx(&this_arg_conv, feerate_per_kw, destination_script_ref);
49635         return tag_ptr(ret_conv, true);
49636 }
49637
49638 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) {
49639         LDKPublicKey broadcaster_payment_basepoint_ref;
49640         CHECK(broadcaster_payment_basepoint->arr_len == 33);
49641         memcpy(broadcaster_payment_basepoint_ref.compressed_form, broadcaster_payment_basepoint->elems, 33); FREE(broadcaster_payment_basepoint);
49642         LDKPublicKey countersignatory_payment_basepoint_ref;
49643         CHECK(countersignatory_payment_basepoint->arr_len == 33);
49644         memcpy(countersignatory_payment_basepoint_ref.compressed_form, countersignatory_payment_basepoint->elems, 33); FREE(countersignatory_payment_basepoint);
49645         int64_t ret_conv = get_commitment_transaction_number_obscure_factor(broadcaster_payment_basepoint_ref, countersignatory_payment_basepoint_ref, outbound_from_broadcaster);
49646         return ret_conv;
49647 }
49648
49649 jboolean  __attribute__((export_name("TS_InitFeatures_eq"))) TS_InitFeatures_eq(uint64_t a, uint64_t b) {
49650         LDKInitFeatures a_conv;
49651         a_conv.inner = untag_ptr(a);
49652         a_conv.is_owned = ptr_is_owned(a);
49653         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
49654         a_conv.is_owned = false;
49655         LDKInitFeatures b_conv;
49656         b_conv.inner = untag_ptr(b);
49657         b_conv.is_owned = ptr_is_owned(b);
49658         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
49659         b_conv.is_owned = false;
49660         jboolean ret_conv = InitFeatures_eq(&a_conv, &b_conv);
49661         return ret_conv;
49662 }
49663
49664 jboolean  __attribute__((export_name("TS_NodeFeatures_eq"))) TS_NodeFeatures_eq(uint64_t a, uint64_t b) {
49665         LDKNodeFeatures a_conv;
49666         a_conv.inner = untag_ptr(a);
49667         a_conv.is_owned = ptr_is_owned(a);
49668         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
49669         a_conv.is_owned = false;
49670         LDKNodeFeatures b_conv;
49671         b_conv.inner = untag_ptr(b);
49672         b_conv.is_owned = ptr_is_owned(b);
49673         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
49674         b_conv.is_owned = false;
49675         jboolean ret_conv = NodeFeatures_eq(&a_conv, &b_conv);
49676         return ret_conv;
49677 }
49678
49679 jboolean  __attribute__((export_name("TS_ChannelFeatures_eq"))) TS_ChannelFeatures_eq(uint64_t a, uint64_t b) {
49680         LDKChannelFeatures a_conv;
49681         a_conv.inner = untag_ptr(a);
49682         a_conv.is_owned = ptr_is_owned(a);
49683         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
49684         a_conv.is_owned = false;
49685         LDKChannelFeatures b_conv;
49686         b_conv.inner = untag_ptr(b);
49687         b_conv.is_owned = ptr_is_owned(b);
49688         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
49689         b_conv.is_owned = false;
49690         jboolean ret_conv = ChannelFeatures_eq(&a_conv, &b_conv);
49691         return ret_conv;
49692 }
49693
49694 jboolean  __attribute__((export_name("TS_Bolt11InvoiceFeatures_eq"))) TS_Bolt11InvoiceFeatures_eq(uint64_t a, uint64_t b) {
49695         LDKBolt11InvoiceFeatures a_conv;
49696         a_conv.inner = untag_ptr(a);
49697         a_conv.is_owned = ptr_is_owned(a);
49698         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
49699         a_conv.is_owned = false;
49700         LDKBolt11InvoiceFeatures b_conv;
49701         b_conv.inner = untag_ptr(b);
49702         b_conv.is_owned = ptr_is_owned(b);
49703         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
49704         b_conv.is_owned = false;
49705         jboolean ret_conv = Bolt11InvoiceFeatures_eq(&a_conv, &b_conv);
49706         return ret_conv;
49707 }
49708
49709 jboolean  __attribute__((export_name("TS_OfferFeatures_eq"))) TS_OfferFeatures_eq(uint64_t a, uint64_t b) {
49710         LDKOfferFeatures a_conv;
49711         a_conv.inner = untag_ptr(a);
49712         a_conv.is_owned = ptr_is_owned(a);
49713         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
49714         a_conv.is_owned = false;
49715         LDKOfferFeatures b_conv;
49716         b_conv.inner = untag_ptr(b);
49717         b_conv.is_owned = ptr_is_owned(b);
49718         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
49719         b_conv.is_owned = false;
49720         jboolean ret_conv = OfferFeatures_eq(&a_conv, &b_conv);
49721         return ret_conv;
49722 }
49723
49724 jboolean  __attribute__((export_name("TS_InvoiceRequestFeatures_eq"))) TS_InvoiceRequestFeatures_eq(uint64_t a, uint64_t b) {
49725         LDKInvoiceRequestFeatures a_conv;
49726         a_conv.inner = untag_ptr(a);
49727         a_conv.is_owned = ptr_is_owned(a);
49728         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
49729         a_conv.is_owned = false;
49730         LDKInvoiceRequestFeatures b_conv;
49731         b_conv.inner = untag_ptr(b);
49732         b_conv.is_owned = ptr_is_owned(b);
49733         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
49734         b_conv.is_owned = false;
49735         jboolean ret_conv = InvoiceRequestFeatures_eq(&a_conv, &b_conv);
49736         return ret_conv;
49737 }
49738
49739 jboolean  __attribute__((export_name("TS_Bolt12InvoiceFeatures_eq"))) TS_Bolt12InvoiceFeatures_eq(uint64_t a, uint64_t b) {
49740         LDKBolt12InvoiceFeatures a_conv;
49741         a_conv.inner = untag_ptr(a);
49742         a_conv.is_owned = ptr_is_owned(a);
49743         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
49744         a_conv.is_owned = false;
49745         LDKBolt12InvoiceFeatures b_conv;
49746         b_conv.inner = untag_ptr(b);
49747         b_conv.is_owned = ptr_is_owned(b);
49748         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
49749         b_conv.is_owned = false;
49750         jboolean ret_conv = Bolt12InvoiceFeatures_eq(&a_conv, &b_conv);
49751         return ret_conv;
49752 }
49753
49754 jboolean  __attribute__((export_name("TS_BlindedHopFeatures_eq"))) TS_BlindedHopFeatures_eq(uint64_t a, uint64_t b) {
49755         LDKBlindedHopFeatures a_conv;
49756         a_conv.inner = untag_ptr(a);
49757         a_conv.is_owned = ptr_is_owned(a);
49758         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
49759         a_conv.is_owned = false;
49760         LDKBlindedHopFeatures b_conv;
49761         b_conv.inner = untag_ptr(b);
49762         b_conv.is_owned = ptr_is_owned(b);
49763         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
49764         b_conv.is_owned = false;
49765         jboolean ret_conv = BlindedHopFeatures_eq(&a_conv, &b_conv);
49766         return ret_conv;
49767 }
49768
49769 jboolean  __attribute__((export_name("TS_ChannelTypeFeatures_eq"))) TS_ChannelTypeFeatures_eq(uint64_t a, uint64_t b) {
49770         LDKChannelTypeFeatures a_conv;
49771         a_conv.inner = untag_ptr(a);
49772         a_conv.is_owned = ptr_is_owned(a);
49773         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
49774         a_conv.is_owned = false;
49775         LDKChannelTypeFeatures b_conv;
49776         b_conv.inner = untag_ptr(b);
49777         b_conv.is_owned = ptr_is_owned(b);
49778         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
49779         b_conv.is_owned = false;
49780         jboolean ret_conv = ChannelTypeFeatures_eq(&a_conv, &b_conv);
49781         return ret_conv;
49782 }
49783
49784 static inline uint64_t InitFeatures_clone_ptr(LDKInitFeatures *NONNULL_PTR arg) {
49785         LDKInitFeatures ret_var = InitFeatures_clone(arg);
49786         uint64_t ret_ref = 0;
49787         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
49788         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
49789         return ret_ref;
49790 }
49791 int64_t  __attribute__((export_name("TS_InitFeatures_clone_ptr"))) TS_InitFeatures_clone_ptr(uint64_t arg) {
49792         LDKInitFeatures arg_conv;
49793         arg_conv.inner = untag_ptr(arg);
49794         arg_conv.is_owned = ptr_is_owned(arg);
49795         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
49796         arg_conv.is_owned = false;
49797         int64_t ret_conv = InitFeatures_clone_ptr(&arg_conv);
49798         return ret_conv;
49799 }
49800
49801 uint64_t  __attribute__((export_name("TS_InitFeatures_clone"))) TS_InitFeatures_clone(uint64_t orig) {
49802         LDKInitFeatures orig_conv;
49803         orig_conv.inner = untag_ptr(orig);
49804         orig_conv.is_owned = ptr_is_owned(orig);
49805         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
49806         orig_conv.is_owned = false;
49807         LDKInitFeatures ret_var = InitFeatures_clone(&orig_conv);
49808         uint64_t ret_ref = 0;
49809         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
49810         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
49811         return ret_ref;
49812 }
49813
49814 static inline uint64_t NodeFeatures_clone_ptr(LDKNodeFeatures *NONNULL_PTR arg) {
49815         LDKNodeFeatures ret_var = NodeFeatures_clone(arg);
49816         uint64_t ret_ref = 0;
49817         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
49818         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
49819         return ret_ref;
49820 }
49821 int64_t  __attribute__((export_name("TS_NodeFeatures_clone_ptr"))) TS_NodeFeatures_clone_ptr(uint64_t arg) {
49822         LDKNodeFeatures arg_conv;
49823         arg_conv.inner = untag_ptr(arg);
49824         arg_conv.is_owned = ptr_is_owned(arg);
49825         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
49826         arg_conv.is_owned = false;
49827         int64_t ret_conv = NodeFeatures_clone_ptr(&arg_conv);
49828         return ret_conv;
49829 }
49830
49831 uint64_t  __attribute__((export_name("TS_NodeFeatures_clone"))) TS_NodeFeatures_clone(uint64_t orig) {
49832         LDKNodeFeatures orig_conv;
49833         orig_conv.inner = untag_ptr(orig);
49834         orig_conv.is_owned = ptr_is_owned(orig);
49835         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
49836         orig_conv.is_owned = false;
49837         LDKNodeFeatures ret_var = NodeFeatures_clone(&orig_conv);
49838         uint64_t ret_ref = 0;
49839         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
49840         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
49841         return ret_ref;
49842 }
49843
49844 static inline uint64_t ChannelFeatures_clone_ptr(LDKChannelFeatures *NONNULL_PTR arg) {
49845         LDKChannelFeatures ret_var = ChannelFeatures_clone(arg);
49846         uint64_t ret_ref = 0;
49847         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
49848         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
49849         return ret_ref;
49850 }
49851 int64_t  __attribute__((export_name("TS_ChannelFeatures_clone_ptr"))) TS_ChannelFeatures_clone_ptr(uint64_t arg) {
49852         LDKChannelFeatures arg_conv;
49853         arg_conv.inner = untag_ptr(arg);
49854         arg_conv.is_owned = ptr_is_owned(arg);
49855         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
49856         arg_conv.is_owned = false;
49857         int64_t ret_conv = ChannelFeatures_clone_ptr(&arg_conv);
49858         return ret_conv;
49859 }
49860
49861 uint64_t  __attribute__((export_name("TS_ChannelFeatures_clone"))) TS_ChannelFeatures_clone(uint64_t orig) {
49862         LDKChannelFeatures orig_conv;
49863         orig_conv.inner = untag_ptr(orig);
49864         orig_conv.is_owned = ptr_is_owned(orig);
49865         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
49866         orig_conv.is_owned = false;
49867         LDKChannelFeatures ret_var = ChannelFeatures_clone(&orig_conv);
49868         uint64_t ret_ref = 0;
49869         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
49870         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
49871         return ret_ref;
49872 }
49873
49874 static inline uint64_t Bolt11InvoiceFeatures_clone_ptr(LDKBolt11InvoiceFeatures *NONNULL_PTR arg) {
49875         LDKBolt11InvoiceFeatures ret_var = Bolt11InvoiceFeatures_clone(arg);
49876         uint64_t ret_ref = 0;
49877         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
49878         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
49879         return ret_ref;
49880 }
49881 int64_t  __attribute__((export_name("TS_Bolt11InvoiceFeatures_clone_ptr"))) TS_Bolt11InvoiceFeatures_clone_ptr(uint64_t arg) {
49882         LDKBolt11InvoiceFeatures arg_conv;
49883         arg_conv.inner = untag_ptr(arg);
49884         arg_conv.is_owned = ptr_is_owned(arg);
49885         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
49886         arg_conv.is_owned = false;
49887         int64_t ret_conv = Bolt11InvoiceFeatures_clone_ptr(&arg_conv);
49888         return ret_conv;
49889 }
49890
49891 uint64_t  __attribute__((export_name("TS_Bolt11InvoiceFeatures_clone"))) TS_Bolt11InvoiceFeatures_clone(uint64_t orig) {
49892         LDKBolt11InvoiceFeatures orig_conv;
49893         orig_conv.inner = untag_ptr(orig);
49894         orig_conv.is_owned = ptr_is_owned(orig);
49895         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
49896         orig_conv.is_owned = false;
49897         LDKBolt11InvoiceFeatures ret_var = Bolt11InvoiceFeatures_clone(&orig_conv);
49898         uint64_t ret_ref = 0;
49899         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
49900         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
49901         return ret_ref;
49902 }
49903
49904 static inline uint64_t OfferFeatures_clone_ptr(LDKOfferFeatures *NONNULL_PTR arg) {
49905         LDKOfferFeatures ret_var = OfferFeatures_clone(arg);
49906         uint64_t ret_ref = 0;
49907         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
49908         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
49909         return ret_ref;
49910 }
49911 int64_t  __attribute__((export_name("TS_OfferFeatures_clone_ptr"))) TS_OfferFeatures_clone_ptr(uint64_t arg) {
49912         LDKOfferFeatures arg_conv;
49913         arg_conv.inner = untag_ptr(arg);
49914         arg_conv.is_owned = ptr_is_owned(arg);
49915         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
49916         arg_conv.is_owned = false;
49917         int64_t ret_conv = OfferFeatures_clone_ptr(&arg_conv);
49918         return ret_conv;
49919 }
49920
49921 uint64_t  __attribute__((export_name("TS_OfferFeatures_clone"))) TS_OfferFeatures_clone(uint64_t orig) {
49922         LDKOfferFeatures orig_conv;
49923         orig_conv.inner = untag_ptr(orig);
49924         orig_conv.is_owned = ptr_is_owned(orig);
49925         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
49926         orig_conv.is_owned = false;
49927         LDKOfferFeatures ret_var = OfferFeatures_clone(&orig_conv);
49928         uint64_t ret_ref = 0;
49929         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
49930         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
49931         return ret_ref;
49932 }
49933
49934 static inline uint64_t InvoiceRequestFeatures_clone_ptr(LDKInvoiceRequestFeatures *NONNULL_PTR arg) {
49935         LDKInvoiceRequestFeatures ret_var = InvoiceRequestFeatures_clone(arg);
49936         uint64_t ret_ref = 0;
49937         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
49938         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
49939         return ret_ref;
49940 }
49941 int64_t  __attribute__((export_name("TS_InvoiceRequestFeatures_clone_ptr"))) TS_InvoiceRequestFeatures_clone_ptr(uint64_t arg) {
49942         LDKInvoiceRequestFeatures arg_conv;
49943         arg_conv.inner = untag_ptr(arg);
49944         arg_conv.is_owned = ptr_is_owned(arg);
49945         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
49946         arg_conv.is_owned = false;
49947         int64_t ret_conv = InvoiceRequestFeatures_clone_ptr(&arg_conv);
49948         return ret_conv;
49949 }
49950
49951 uint64_t  __attribute__((export_name("TS_InvoiceRequestFeatures_clone"))) TS_InvoiceRequestFeatures_clone(uint64_t orig) {
49952         LDKInvoiceRequestFeatures orig_conv;
49953         orig_conv.inner = untag_ptr(orig);
49954         orig_conv.is_owned = ptr_is_owned(orig);
49955         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
49956         orig_conv.is_owned = false;
49957         LDKInvoiceRequestFeatures ret_var = InvoiceRequestFeatures_clone(&orig_conv);
49958         uint64_t ret_ref = 0;
49959         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
49960         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
49961         return ret_ref;
49962 }
49963
49964 static inline uint64_t Bolt12InvoiceFeatures_clone_ptr(LDKBolt12InvoiceFeatures *NONNULL_PTR arg) {
49965         LDKBolt12InvoiceFeatures ret_var = Bolt12InvoiceFeatures_clone(arg);
49966         uint64_t ret_ref = 0;
49967         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
49968         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
49969         return ret_ref;
49970 }
49971 int64_t  __attribute__((export_name("TS_Bolt12InvoiceFeatures_clone_ptr"))) TS_Bolt12InvoiceFeatures_clone_ptr(uint64_t arg) {
49972         LDKBolt12InvoiceFeatures arg_conv;
49973         arg_conv.inner = untag_ptr(arg);
49974         arg_conv.is_owned = ptr_is_owned(arg);
49975         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
49976         arg_conv.is_owned = false;
49977         int64_t ret_conv = Bolt12InvoiceFeatures_clone_ptr(&arg_conv);
49978         return ret_conv;
49979 }
49980
49981 uint64_t  __attribute__((export_name("TS_Bolt12InvoiceFeatures_clone"))) TS_Bolt12InvoiceFeatures_clone(uint64_t orig) {
49982         LDKBolt12InvoiceFeatures orig_conv;
49983         orig_conv.inner = untag_ptr(orig);
49984         orig_conv.is_owned = ptr_is_owned(orig);
49985         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
49986         orig_conv.is_owned = false;
49987         LDKBolt12InvoiceFeatures ret_var = Bolt12InvoiceFeatures_clone(&orig_conv);
49988         uint64_t ret_ref = 0;
49989         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
49990         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
49991         return ret_ref;
49992 }
49993
49994 static inline uint64_t BlindedHopFeatures_clone_ptr(LDKBlindedHopFeatures *NONNULL_PTR arg) {
49995         LDKBlindedHopFeatures ret_var = BlindedHopFeatures_clone(arg);
49996         uint64_t ret_ref = 0;
49997         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
49998         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
49999         return ret_ref;
50000 }
50001 int64_t  __attribute__((export_name("TS_BlindedHopFeatures_clone_ptr"))) TS_BlindedHopFeatures_clone_ptr(uint64_t arg) {
50002         LDKBlindedHopFeatures arg_conv;
50003         arg_conv.inner = untag_ptr(arg);
50004         arg_conv.is_owned = ptr_is_owned(arg);
50005         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
50006         arg_conv.is_owned = false;
50007         int64_t ret_conv = BlindedHopFeatures_clone_ptr(&arg_conv);
50008         return ret_conv;
50009 }
50010
50011 uint64_t  __attribute__((export_name("TS_BlindedHopFeatures_clone"))) TS_BlindedHopFeatures_clone(uint64_t orig) {
50012         LDKBlindedHopFeatures orig_conv;
50013         orig_conv.inner = untag_ptr(orig);
50014         orig_conv.is_owned = ptr_is_owned(orig);
50015         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
50016         orig_conv.is_owned = false;
50017         LDKBlindedHopFeatures ret_var = BlindedHopFeatures_clone(&orig_conv);
50018         uint64_t ret_ref = 0;
50019         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
50020         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
50021         return ret_ref;
50022 }
50023
50024 static inline uint64_t ChannelTypeFeatures_clone_ptr(LDKChannelTypeFeatures *NONNULL_PTR arg) {
50025         LDKChannelTypeFeatures ret_var = ChannelTypeFeatures_clone(arg);
50026         uint64_t ret_ref = 0;
50027         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
50028         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
50029         return ret_ref;
50030 }
50031 int64_t  __attribute__((export_name("TS_ChannelTypeFeatures_clone_ptr"))) TS_ChannelTypeFeatures_clone_ptr(uint64_t arg) {
50032         LDKChannelTypeFeatures arg_conv;
50033         arg_conv.inner = untag_ptr(arg);
50034         arg_conv.is_owned = ptr_is_owned(arg);
50035         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
50036         arg_conv.is_owned = false;
50037         int64_t ret_conv = ChannelTypeFeatures_clone_ptr(&arg_conv);
50038         return ret_conv;
50039 }
50040
50041 uint64_t  __attribute__((export_name("TS_ChannelTypeFeatures_clone"))) TS_ChannelTypeFeatures_clone(uint64_t orig) {
50042         LDKChannelTypeFeatures orig_conv;
50043         orig_conv.inner = untag_ptr(orig);
50044         orig_conv.is_owned = ptr_is_owned(orig);
50045         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
50046         orig_conv.is_owned = false;
50047         LDKChannelTypeFeatures ret_var = ChannelTypeFeatures_clone(&orig_conv);
50048         uint64_t ret_ref = 0;
50049         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
50050         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
50051         return ret_ref;
50052 }
50053
50054 void  __attribute__((export_name("TS_InitFeatures_free"))) TS_InitFeatures_free(uint64_t this_obj) {
50055         LDKInitFeatures this_obj_conv;
50056         this_obj_conv.inner = untag_ptr(this_obj);
50057         this_obj_conv.is_owned = ptr_is_owned(this_obj);
50058         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
50059         InitFeatures_free(this_obj_conv);
50060 }
50061
50062 void  __attribute__((export_name("TS_NodeFeatures_free"))) TS_NodeFeatures_free(uint64_t this_obj) {
50063         LDKNodeFeatures this_obj_conv;
50064         this_obj_conv.inner = untag_ptr(this_obj);
50065         this_obj_conv.is_owned = ptr_is_owned(this_obj);
50066         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
50067         NodeFeatures_free(this_obj_conv);
50068 }
50069
50070 void  __attribute__((export_name("TS_ChannelFeatures_free"))) TS_ChannelFeatures_free(uint64_t this_obj) {
50071         LDKChannelFeatures this_obj_conv;
50072         this_obj_conv.inner = untag_ptr(this_obj);
50073         this_obj_conv.is_owned = ptr_is_owned(this_obj);
50074         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
50075         ChannelFeatures_free(this_obj_conv);
50076 }
50077
50078 void  __attribute__((export_name("TS_Bolt11InvoiceFeatures_free"))) TS_Bolt11InvoiceFeatures_free(uint64_t this_obj) {
50079         LDKBolt11InvoiceFeatures this_obj_conv;
50080         this_obj_conv.inner = untag_ptr(this_obj);
50081         this_obj_conv.is_owned = ptr_is_owned(this_obj);
50082         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
50083         Bolt11InvoiceFeatures_free(this_obj_conv);
50084 }
50085
50086 void  __attribute__((export_name("TS_OfferFeatures_free"))) TS_OfferFeatures_free(uint64_t this_obj) {
50087         LDKOfferFeatures this_obj_conv;
50088         this_obj_conv.inner = untag_ptr(this_obj);
50089         this_obj_conv.is_owned = ptr_is_owned(this_obj);
50090         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
50091         OfferFeatures_free(this_obj_conv);
50092 }
50093
50094 void  __attribute__((export_name("TS_InvoiceRequestFeatures_free"))) TS_InvoiceRequestFeatures_free(uint64_t this_obj) {
50095         LDKInvoiceRequestFeatures this_obj_conv;
50096         this_obj_conv.inner = untag_ptr(this_obj);
50097         this_obj_conv.is_owned = ptr_is_owned(this_obj);
50098         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
50099         InvoiceRequestFeatures_free(this_obj_conv);
50100 }
50101
50102 void  __attribute__((export_name("TS_Bolt12InvoiceFeatures_free"))) TS_Bolt12InvoiceFeatures_free(uint64_t this_obj) {
50103         LDKBolt12InvoiceFeatures this_obj_conv;
50104         this_obj_conv.inner = untag_ptr(this_obj);
50105         this_obj_conv.is_owned = ptr_is_owned(this_obj);
50106         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
50107         Bolt12InvoiceFeatures_free(this_obj_conv);
50108 }
50109
50110 void  __attribute__((export_name("TS_BlindedHopFeatures_free"))) TS_BlindedHopFeatures_free(uint64_t this_obj) {
50111         LDKBlindedHopFeatures this_obj_conv;
50112         this_obj_conv.inner = untag_ptr(this_obj);
50113         this_obj_conv.is_owned = ptr_is_owned(this_obj);
50114         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
50115         BlindedHopFeatures_free(this_obj_conv);
50116 }
50117
50118 void  __attribute__((export_name("TS_ChannelTypeFeatures_free"))) TS_ChannelTypeFeatures_free(uint64_t this_obj) {
50119         LDKChannelTypeFeatures this_obj_conv;
50120         this_obj_conv.inner = untag_ptr(this_obj);
50121         this_obj_conv.is_owned = ptr_is_owned(this_obj);
50122         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
50123         ChannelTypeFeatures_free(this_obj_conv);
50124 }
50125
50126 uint64_t  __attribute__((export_name("TS_InitFeatures_empty"))) TS_InitFeatures_empty() {
50127         LDKInitFeatures ret_var = InitFeatures_empty();
50128         uint64_t ret_ref = 0;
50129         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
50130         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
50131         return ret_ref;
50132 }
50133
50134 jboolean  __attribute__((export_name("TS_InitFeatures_requires_unknown_bits_from"))) TS_InitFeatures_requires_unknown_bits_from(uint64_t this_arg, uint64_t other) {
50135         LDKInitFeatures this_arg_conv;
50136         this_arg_conv.inner = untag_ptr(this_arg);
50137         this_arg_conv.is_owned = ptr_is_owned(this_arg);
50138         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
50139         this_arg_conv.is_owned = false;
50140         LDKInitFeatures other_conv;
50141         other_conv.inner = untag_ptr(other);
50142         other_conv.is_owned = ptr_is_owned(other);
50143         CHECK_INNER_FIELD_ACCESS_OR_NULL(other_conv);
50144         other_conv.is_owned = false;
50145         jboolean ret_conv = InitFeatures_requires_unknown_bits_from(&this_arg_conv, &other_conv);
50146         return ret_conv;
50147 }
50148
50149 jboolean  __attribute__((export_name("TS_InitFeatures_requires_unknown_bits"))) TS_InitFeatures_requires_unknown_bits(uint64_t this_arg) {
50150         LDKInitFeatures this_arg_conv;
50151         this_arg_conv.inner = untag_ptr(this_arg);
50152         this_arg_conv.is_owned = ptr_is_owned(this_arg);
50153         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
50154         this_arg_conv.is_owned = false;
50155         jboolean ret_conv = InitFeatures_requires_unknown_bits(&this_arg_conv);
50156         return ret_conv;
50157 }
50158
50159 uint64_t  __attribute__((export_name("TS_InitFeatures_set_required_feature_bit"))) TS_InitFeatures_set_required_feature_bit(uint64_t this_arg, uint32_t bit) {
50160         LDKInitFeatures this_arg_conv;
50161         this_arg_conv.inner = untag_ptr(this_arg);
50162         this_arg_conv.is_owned = ptr_is_owned(this_arg);
50163         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
50164         this_arg_conv.is_owned = false;
50165         LDKCResult_NoneNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneNoneZ), "LDKCResult_NoneNoneZ");
50166         *ret_conv = InitFeatures_set_required_feature_bit(&this_arg_conv, bit);
50167         return tag_ptr(ret_conv, true);
50168 }
50169
50170 uint64_t  __attribute__((export_name("TS_InitFeatures_set_optional_feature_bit"))) TS_InitFeatures_set_optional_feature_bit(uint64_t this_arg, uint32_t bit) {
50171         LDKInitFeatures this_arg_conv;
50172         this_arg_conv.inner = untag_ptr(this_arg);
50173         this_arg_conv.is_owned = ptr_is_owned(this_arg);
50174         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
50175         this_arg_conv.is_owned = false;
50176         LDKCResult_NoneNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneNoneZ), "LDKCResult_NoneNoneZ");
50177         *ret_conv = InitFeatures_set_optional_feature_bit(&this_arg_conv, bit);
50178         return tag_ptr(ret_conv, true);
50179 }
50180
50181 uint64_t  __attribute__((export_name("TS_InitFeatures_set_required_custom_bit"))) TS_InitFeatures_set_required_custom_bit(uint64_t this_arg, uint32_t bit) {
50182         LDKInitFeatures this_arg_conv;
50183         this_arg_conv.inner = untag_ptr(this_arg);
50184         this_arg_conv.is_owned = ptr_is_owned(this_arg);
50185         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
50186         this_arg_conv.is_owned = false;
50187         LDKCResult_NoneNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneNoneZ), "LDKCResult_NoneNoneZ");
50188         *ret_conv = InitFeatures_set_required_custom_bit(&this_arg_conv, bit);
50189         return tag_ptr(ret_conv, true);
50190 }
50191
50192 uint64_t  __attribute__((export_name("TS_InitFeatures_set_optional_custom_bit"))) TS_InitFeatures_set_optional_custom_bit(uint64_t this_arg, uint32_t bit) {
50193         LDKInitFeatures this_arg_conv;
50194         this_arg_conv.inner = untag_ptr(this_arg);
50195         this_arg_conv.is_owned = ptr_is_owned(this_arg);
50196         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
50197         this_arg_conv.is_owned = false;
50198         LDKCResult_NoneNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneNoneZ), "LDKCResult_NoneNoneZ");
50199         *ret_conv = InitFeatures_set_optional_custom_bit(&this_arg_conv, bit);
50200         return tag_ptr(ret_conv, true);
50201 }
50202
50203 uint64_t  __attribute__((export_name("TS_NodeFeatures_empty"))) TS_NodeFeatures_empty() {
50204         LDKNodeFeatures ret_var = NodeFeatures_empty();
50205         uint64_t ret_ref = 0;
50206         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
50207         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
50208         return ret_ref;
50209 }
50210
50211 jboolean  __attribute__((export_name("TS_NodeFeatures_requires_unknown_bits_from"))) TS_NodeFeatures_requires_unknown_bits_from(uint64_t this_arg, uint64_t other) {
50212         LDKNodeFeatures this_arg_conv;
50213         this_arg_conv.inner = untag_ptr(this_arg);
50214         this_arg_conv.is_owned = ptr_is_owned(this_arg);
50215         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
50216         this_arg_conv.is_owned = false;
50217         LDKNodeFeatures other_conv;
50218         other_conv.inner = untag_ptr(other);
50219         other_conv.is_owned = ptr_is_owned(other);
50220         CHECK_INNER_FIELD_ACCESS_OR_NULL(other_conv);
50221         other_conv.is_owned = false;
50222         jboolean ret_conv = NodeFeatures_requires_unknown_bits_from(&this_arg_conv, &other_conv);
50223         return ret_conv;
50224 }
50225
50226 jboolean  __attribute__((export_name("TS_NodeFeatures_requires_unknown_bits"))) TS_NodeFeatures_requires_unknown_bits(uint64_t this_arg) {
50227         LDKNodeFeatures this_arg_conv;
50228         this_arg_conv.inner = untag_ptr(this_arg);
50229         this_arg_conv.is_owned = ptr_is_owned(this_arg);
50230         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
50231         this_arg_conv.is_owned = false;
50232         jboolean ret_conv = NodeFeatures_requires_unknown_bits(&this_arg_conv);
50233         return ret_conv;
50234 }
50235
50236 uint64_t  __attribute__((export_name("TS_NodeFeatures_set_required_feature_bit"))) TS_NodeFeatures_set_required_feature_bit(uint64_t this_arg, uint32_t bit) {
50237         LDKNodeFeatures this_arg_conv;
50238         this_arg_conv.inner = untag_ptr(this_arg);
50239         this_arg_conv.is_owned = ptr_is_owned(this_arg);
50240         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
50241         this_arg_conv.is_owned = false;
50242         LDKCResult_NoneNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneNoneZ), "LDKCResult_NoneNoneZ");
50243         *ret_conv = NodeFeatures_set_required_feature_bit(&this_arg_conv, bit);
50244         return tag_ptr(ret_conv, true);
50245 }
50246
50247 uint64_t  __attribute__((export_name("TS_NodeFeatures_set_optional_feature_bit"))) TS_NodeFeatures_set_optional_feature_bit(uint64_t this_arg, uint32_t bit) {
50248         LDKNodeFeatures this_arg_conv;
50249         this_arg_conv.inner = untag_ptr(this_arg);
50250         this_arg_conv.is_owned = ptr_is_owned(this_arg);
50251         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
50252         this_arg_conv.is_owned = false;
50253         LDKCResult_NoneNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneNoneZ), "LDKCResult_NoneNoneZ");
50254         *ret_conv = NodeFeatures_set_optional_feature_bit(&this_arg_conv, bit);
50255         return tag_ptr(ret_conv, true);
50256 }
50257
50258 uint64_t  __attribute__((export_name("TS_NodeFeatures_set_required_custom_bit"))) TS_NodeFeatures_set_required_custom_bit(uint64_t this_arg, uint32_t bit) {
50259         LDKNodeFeatures this_arg_conv;
50260         this_arg_conv.inner = untag_ptr(this_arg);
50261         this_arg_conv.is_owned = ptr_is_owned(this_arg);
50262         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
50263         this_arg_conv.is_owned = false;
50264         LDKCResult_NoneNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneNoneZ), "LDKCResult_NoneNoneZ");
50265         *ret_conv = NodeFeatures_set_required_custom_bit(&this_arg_conv, bit);
50266         return tag_ptr(ret_conv, true);
50267 }
50268
50269 uint64_t  __attribute__((export_name("TS_NodeFeatures_set_optional_custom_bit"))) TS_NodeFeatures_set_optional_custom_bit(uint64_t this_arg, uint32_t bit) {
50270         LDKNodeFeatures this_arg_conv;
50271         this_arg_conv.inner = untag_ptr(this_arg);
50272         this_arg_conv.is_owned = ptr_is_owned(this_arg);
50273         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
50274         this_arg_conv.is_owned = false;
50275         LDKCResult_NoneNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneNoneZ), "LDKCResult_NoneNoneZ");
50276         *ret_conv = NodeFeatures_set_optional_custom_bit(&this_arg_conv, bit);
50277         return tag_ptr(ret_conv, true);
50278 }
50279
50280 uint64_t  __attribute__((export_name("TS_ChannelFeatures_empty"))) TS_ChannelFeatures_empty() {
50281         LDKChannelFeatures ret_var = ChannelFeatures_empty();
50282         uint64_t ret_ref = 0;
50283         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
50284         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
50285         return ret_ref;
50286 }
50287
50288 jboolean  __attribute__((export_name("TS_ChannelFeatures_requires_unknown_bits_from"))) TS_ChannelFeatures_requires_unknown_bits_from(uint64_t this_arg, uint64_t other) {
50289         LDKChannelFeatures this_arg_conv;
50290         this_arg_conv.inner = untag_ptr(this_arg);
50291         this_arg_conv.is_owned = ptr_is_owned(this_arg);
50292         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
50293         this_arg_conv.is_owned = false;
50294         LDKChannelFeatures other_conv;
50295         other_conv.inner = untag_ptr(other);
50296         other_conv.is_owned = ptr_is_owned(other);
50297         CHECK_INNER_FIELD_ACCESS_OR_NULL(other_conv);
50298         other_conv.is_owned = false;
50299         jboolean ret_conv = ChannelFeatures_requires_unknown_bits_from(&this_arg_conv, &other_conv);
50300         return ret_conv;
50301 }
50302
50303 jboolean  __attribute__((export_name("TS_ChannelFeatures_requires_unknown_bits"))) TS_ChannelFeatures_requires_unknown_bits(uint64_t this_arg) {
50304         LDKChannelFeatures this_arg_conv;
50305         this_arg_conv.inner = untag_ptr(this_arg);
50306         this_arg_conv.is_owned = ptr_is_owned(this_arg);
50307         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
50308         this_arg_conv.is_owned = false;
50309         jboolean ret_conv = ChannelFeatures_requires_unknown_bits(&this_arg_conv);
50310         return ret_conv;
50311 }
50312
50313 uint64_t  __attribute__((export_name("TS_ChannelFeatures_set_required_feature_bit"))) TS_ChannelFeatures_set_required_feature_bit(uint64_t this_arg, uint32_t bit) {
50314         LDKChannelFeatures this_arg_conv;
50315         this_arg_conv.inner = untag_ptr(this_arg);
50316         this_arg_conv.is_owned = ptr_is_owned(this_arg);
50317         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
50318         this_arg_conv.is_owned = false;
50319         LDKCResult_NoneNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneNoneZ), "LDKCResult_NoneNoneZ");
50320         *ret_conv = ChannelFeatures_set_required_feature_bit(&this_arg_conv, bit);
50321         return tag_ptr(ret_conv, true);
50322 }
50323
50324 uint64_t  __attribute__((export_name("TS_ChannelFeatures_set_optional_feature_bit"))) TS_ChannelFeatures_set_optional_feature_bit(uint64_t this_arg, uint32_t bit) {
50325         LDKChannelFeatures this_arg_conv;
50326         this_arg_conv.inner = untag_ptr(this_arg);
50327         this_arg_conv.is_owned = ptr_is_owned(this_arg);
50328         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
50329         this_arg_conv.is_owned = false;
50330         LDKCResult_NoneNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneNoneZ), "LDKCResult_NoneNoneZ");
50331         *ret_conv = ChannelFeatures_set_optional_feature_bit(&this_arg_conv, bit);
50332         return tag_ptr(ret_conv, true);
50333 }
50334
50335 uint64_t  __attribute__((export_name("TS_ChannelFeatures_set_required_custom_bit"))) TS_ChannelFeatures_set_required_custom_bit(uint64_t this_arg, uint32_t bit) {
50336         LDKChannelFeatures this_arg_conv;
50337         this_arg_conv.inner = untag_ptr(this_arg);
50338         this_arg_conv.is_owned = ptr_is_owned(this_arg);
50339         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
50340         this_arg_conv.is_owned = false;
50341         LDKCResult_NoneNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneNoneZ), "LDKCResult_NoneNoneZ");
50342         *ret_conv = ChannelFeatures_set_required_custom_bit(&this_arg_conv, bit);
50343         return tag_ptr(ret_conv, true);
50344 }
50345
50346 uint64_t  __attribute__((export_name("TS_ChannelFeatures_set_optional_custom_bit"))) TS_ChannelFeatures_set_optional_custom_bit(uint64_t this_arg, uint32_t bit) {
50347         LDKChannelFeatures this_arg_conv;
50348         this_arg_conv.inner = untag_ptr(this_arg);
50349         this_arg_conv.is_owned = ptr_is_owned(this_arg);
50350         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
50351         this_arg_conv.is_owned = false;
50352         LDKCResult_NoneNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneNoneZ), "LDKCResult_NoneNoneZ");
50353         *ret_conv = ChannelFeatures_set_optional_custom_bit(&this_arg_conv, bit);
50354         return tag_ptr(ret_conv, true);
50355 }
50356
50357 uint64_t  __attribute__((export_name("TS_Bolt11InvoiceFeatures_empty"))) TS_Bolt11InvoiceFeatures_empty() {
50358         LDKBolt11InvoiceFeatures ret_var = Bolt11InvoiceFeatures_empty();
50359         uint64_t ret_ref = 0;
50360         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
50361         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
50362         return ret_ref;
50363 }
50364
50365 jboolean  __attribute__((export_name("TS_Bolt11InvoiceFeatures_requires_unknown_bits_from"))) TS_Bolt11InvoiceFeatures_requires_unknown_bits_from(uint64_t this_arg, uint64_t other) {
50366         LDKBolt11InvoiceFeatures this_arg_conv;
50367         this_arg_conv.inner = untag_ptr(this_arg);
50368         this_arg_conv.is_owned = ptr_is_owned(this_arg);
50369         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
50370         this_arg_conv.is_owned = false;
50371         LDKBolt11InvoiceFeatures other_conv;
50372         other_conv.inner = untag_ptr(other);
50373         other_conv.is_owned = ptr_is_owned(other);
50374         CHECK_INNER_FIELD_ACCESS_OR_NULL(other_conv);
50375         other_conv.is_owned = false;
50376         jboolean ret_conv = Bolt11InvoiceFeatures_requires_unknown_bits_from(&this_arg_conv, &other_conv);
50377         return ret_conv;
50378 }
50379
50380 jboolean  __attribute__((export_name("TS_Bolt11InvoiceFeatures_requires_unknown_bits"))) TS_Bolt11InvoiceFeatures_requires_unknown_bits(uint64_t this_arg) {
50381         LDKBolt11InvoiceFeatures this_arg_conv;
50382         this_arg_conv.inner = untag_ptr(this_arg);
50383         this_arg_conv.is_owned = ptr_is_owned(this_arg);
50384         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
50385         this_arg_conv.is_owned = false;
50386         jboolean ret_conv = Bolt11InvoiceFeatures_requires_unknown_bits(&this_arg_conv);
50387         return ret_conv;
50388 }
50389
50390 uint64_t  __attribute__((export_name("TS_Bolt11InvoiceFeatures_set_required_feature_bit"))) TS_Bolt11InvoiceFeatures_set_required_feature_bit(uint64_t this_arg, uint32_t bit) {
50391         LDKBolt11InvoiceFeatures this_arg_conv;
50392         this_arg_conv.inner = untag_ptr(this_arg);
50393         this_arg_conv.is_owned = ptr_is_owned(this_arg);
50394         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
50395         this_arg_conv.is_owned = false;
50396         LDKCResult_NoneNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneNoneZ), "LDKCResult_NoneNoneZ");
50397         *ret_conv = Bolt11InvoiceFeatures_set_required_feature_bit(&this_arg_conv, bit);
50398         return tag_ptr(ret_conv, true);
50399 }
50400
50401 uint64_t  __attribute__((export_name("TS_Bolt11InvoiceFeatures_set_optional_feature_bit"))) TS_Bolt11InvoiceFeatures_set_optional_feature_bit(uint64_t this_arg, uint32_t bit) {
50402         LDKBolt11InvoiceFeatures this_arg_conv;
50403         this_arg_conv.inner = untag_ptr(this_arg);
50404         this_arg_conv.is_owned = ptr_is_owned(this_arg);
50405         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
50406         this_arg_conv.is_owned = false;
50407         LDKCResult_NoneNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneNoneZ), "LDKCResult_NoneNoneZ");
50408         *ret_conv = Bolt11InvoiceFeatures_set_optional_feature_bit(&this_arg_conv, bit);
50409         return tag_ptr(ret_conv, true);
50410 }
50411
50412 uint64_t  __attribute__((export_name("TS_Bolt11InvoiceFeatures_set_required_custom_bit"))) TS_Bolt11InvoiceFeatures_set_required_custom_bit(uint64_t this_arg, uint32_t bit) {
50413         LDKBolt11InvoiceFeatures this_arg_conv;
50414         this_arg_conv.inner = untag_ptr(this_arg);
50415         this_arg_conv.is_owned = ptr_is_owned(this_arg);
50416         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
50417         this_arg_conv.is_owned = false;
50418         LDKCResult_NoneNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneNoneZ), "LDKCResult_NoneNoneZ");
50419         *ret_conv = Bolt11InvoiceFeatures_set_required_custom_bit(&this_arg_conv, bit);
50420         return tag_ptr(ret_conv, true);
50421 }
50422
50423 uint64_t  __attribute__((export_name("TS_Bolt11InvoiceFeatures_set_optional_custom_bit"))) TS_Bolt11InvoiceFeatures_set_optional_custom_bit(uint64_t this_arg, uint32_t bit) {
50424         LDKBolt11InvoiceFeatures this_arg_conv;
50425         this_arg_conv.inner = untag_ptr(this_arg);
50426         this_arg_conv.is_owned = ptr_is_owned(this_arg);
50427         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
50428         this_arg_conv.is_owned = false;
50429         LDKCResult_NoneNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneNoneZ), "LDKCResult_NoneNoneZ");
50430         *ret_conv = Bolt11InvoiceFeatures_set_optional_custom_bit(&this_arg_conv, bit);
50431         return tag_ptr(ret_conv, true);
50432 }
50433
50434 uint64_t  __attribute__((export_name("TS_OfferFeatures_empty"))) TS_OfferFeatures_empty() {
50435         LDKOfferFeatures ret_var = OfferFeatures_empty();
50436         uint64_t ret_ref = 0;
50437         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
50438         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
50439         return ret_ref;
50440 }
50441
50442 jboolean  __attribute__((export_name("TS_OfferFeatures_requires_unknown_bits_from"))) TS_OfferFeatures_requires_unknown_bits_from(uint64_t this_arg, uint64_t other) {
50443         LDKOfferFeatures this_arg_conv;
50444         this_arg_conv.inner = untag_ptr(this_arg);
50445         this_arg_conv.is_owned = ptr_is_owned(this_arg);
50446         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
50447         this_arg_conv.is_owned = false;
50448         LDKOfferFeatures other_conv;
50449         other_conv.inner = untag_ptr(other);
50450         other_conv.is_owned = ptr_is_owned(other);
50451         CHECK_INNER_FIELD_ACCESS_OR_NULL(other_conv);
50452         other_conv.is_owned = false;
50453         jboolean ret_conv = OfferFeatures_requires_unknown_bits_from(&this_arg_conv, &other_conv);
50454         return ret_conv;
50455 }
50456
50457 jboolean  __attribute__((export_name("TS_OfferFeatures_requires_unknown_bits"))) TS_OfferFeatures_requires_unknown_bits(uint64_t this_arg) {
50458         LDKOfferFeatures this_arg_conv;
50459         this_arg_conv.inner = untag_ptr(this_arg);
50460         this_arg_conv.is_owned = ptr_is_owned(this_arg);
50461         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
50462         this_arg_conv.is_owned = false;
50463         jboolean ret_conv = OfferFeatures_requires_unknown_bits(&this_arg_conv);
50464         return ret_conv;
50465 }
50466
50467 uint64_t  __attribute__((export_name("TS_OfferFeatures_set_required_feature_bit"))) TS_OfferFeatures_set_required_feature_bit(uint64_t this_arg, uint32_t bit) {
50468         LDKOfferFeatures this_arg_conv;
50469         this_arg_conv.inner = untag_ptr(this_arg);
50470         this_arg_conv.is_owned = ptr_is_owned(this_arg);
50471         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
50472         this_arg_conv.is_owned = false;
50473         LDKCResult_NoneNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneNoneZ), "LDKCResult_NoneNoneZ");
50474         *ret_conv = OfferFeatures_set_required_feature_bit(&this_arg_conv, bit);
50475         return tag_ptr(ret_conv, true);
50476 }
50477
50478 uint64_t  __attribute__((export_name("TS_OfferFeatures_set_optional_feature_bit"))) TS_OfferFeatures_set_optional_feature_bit(uint64_t this_arg, uint32_t bit) {
50479         LDKOfferFeatures this_arg_conv;
50480         this_arg_conv.inner = untag_ptr(this_arg);
50481         this_arg_conv.is_owned = ptr_is_owned(this_arg);
50482         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
50483         this_arg_conv.is_owned = false;
50484         LDKCResult_NoneNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneNoneZ), "LDKCResult_NoneNoneZ");
50485         *ret_conv = OfferFeatures_set_optional_feature_bit(&this_arg_conv, bit);
50486         return tag_ptr(ret_conv, true);
50487 }
50488
50489 uint64_t  __attribute__((export_name("TS_OfferFeatures_set_required_custom_bit"))) TS_OfferFeatures_set_required_custom_bit(uint64_t this_arg, uint32_t bit) {
50490         LDKOfferFeatures this_arg_conv;
50491         this_arg_conv.inner = untag_ptr(this_arg);
50492         this_arg_conv.is_owned = ptr_is_owned(this_arg);
50493         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
50494         this_arg_conv.is_owned = false;
50495         LDKCResult_NoneNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneNoneZ), "LDKCResult_NoneNoneZ");
50496         *ret_conv = OfferFeatures_set_required_custom_bit(&this_arg_conv, bit);
50497         return tag_ptr(ret_conv, true);
50498 }
50499
50500 uint64_t  __attribute__((export_name("TS_OfferFeatures_set_optional_custom_bit"))) TS_OfferFeatures_set_optional_custom_bit(uint64_t this_arg, uint32_t bit) {
50501         LDKOfferFeatures this_arg_conv;
50502         this_arg_conv.inner = untag_ptr(this_arg);
50503         this_arg_conv.is_owned = ptr_is_owned(this_arg);
50504         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
50505         this_arg_conv.is_owned = false;
50506         LDKCResult_NoneNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneNoneZ), "LDKCResult_NoneNoneZ");
50507         *ret_conv = OfferFeatures_set_optional_custom_bit(&this_arg_conv, bit);
50508         return tag_ptr(ret_conv, true);
50509 }
50510
50511 uint64_t  __attribute__((export_name("TS_InvoiceRequestFeatures_empty"))) TS_InvoiceRequestFeatures_empty() {
50512         LDKInvoiceRequestFeatures ret_var = InvoiceRequestFeatures_empty();
50513         uint64_t ret_ref = 0;
50514         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
50515         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
50516         return ret_ref;
50517 }
50518
50519 jboolean  __attribute__((export_name("TS_InvoiceRequestFeatures_requires_unknown_bits_from"))) TS_InvoiceRequestFeatures_requires_unknown_bits_from(uint64_t this_arg, uint64_t other) {
50520         LDKInvoiceRequestFeatures this_arg_conv;
50521         this_arg_conv.inner = untag_ptr(this_arg);
50522         this_arg_conv.is_owned = ptr_is_owned(this_arg);
50523         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
50524         this_arg_conv.is_owned = false;
50525         LDKInvoiceRequestFeatures other_conv;
50526         other_conv.inner = untag_ptr(other);
50527         other_conv.is_owned = ptr_is_owned(other);
50528         CHECK_INNER_FIELD_ACCESS_OR_NULL(other_conv);
50529         other_conv.is_owned = false;
50530         jboolean ret_conv = InvoiceRequestFeatures_requires_unknown_bits_from(&this_arg_conv, &other_conv);
50531         return ret_conv;
50532 }
50533
50534 jboolean  __attribute__((export_name("TS_InvoiceRequestFeatures_requires_unknown_bits"))) TS_InvoiceRequestFeatures_requires_unknown_bits(uint64_t this_arg) {
50535         LDKInvoiceRequestFeatures this_arg_conv;
50536         this_arg_conv.inner = untag_ptr(this_arg);
50537         this_arg_conv.is_owned = ptr_is_owned(this_arg);
50538         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
50539         this_arg_conv.is_owned = false;
50540         jboolean ret_conv = InvoiceRequestFeatures_requires_unknown_bits(&this_arg_conv);
50541         return ret_conv;
50542 }
50543
50544 uint64_t  __attribute__((export_name("TS_InvoiceRequestFeatures_set_required_feature_bit"))) TS_InvoiceRequestFeatures_set_required_feature_bit(uint64_t this_arg, uint32_t bit) {
50545         LDKInvoiceRequestFeatures this_arg_conv;
50546         this_arg_conv.inner = untag_ptr(this_arg);
50547         this_arg_conv.is_owned = ptr_is_owned(this_arg);
50548         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
50549         this_arg_conv.is_owned = false;
50550         LDKCResult_NoneNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneNoneZ), "LDKCResult_NoneNoneZ");
50551         *ret_conv = InvoiceRequestFeatures_set_required_feature_bit(&this_arg_conv, bit);
50552         return tag_ptr(ret_conv, true);
50553 }
50554
50555 uint64_t  __attribute__((export_name("TS_InvoiceRequestFeatures_set_optional_feature_bit"))) TS_InvoiceRequestFeatures_set_optional_feature_bit(uint64_t this_arg, uint32_t bit) {
50556         LDKInvoiceRequestFeatures this_arg_conv;
50557         this_arg_conv.inner = untag_ptr(this_arg);
50558         this_arg_conv.is_owned = ptr_is_owned(this_arg);
50559         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
50560         this_arg_conv.is_owned = false;
50561         LDKCResult_NoneNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneNoneZ), "LDKCResult_NoneNoneZ");
50562         *ret_conv = InvoiceRequestFeatures_set_optional_feature_bit(&this_arg_conv, bit);
50563         return tag_ptr(ret_conv, true);
50564 }
50565
50566 uint64_t  __attribute__((export_name("TS_InvoiceRequestFeatures_set_required_custom_bit"))) TS_InvoiceRequestFeatures_set_required_custom_bit(uint64_t this_arg, uint32_t bit) {
50567         LDKInvoiceRequestFeatures this_arg_conv;
50568         this_arg_conv.inner = untag_ptr(this_arg);
50569         this_arg_conv.is_owned = ptr_is_owned(this_arg);
50570         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
50571         this_arg_conv.is_owned = false;
50572         LDKCResult_NoneNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneNoneZ), "LDKCResult_NoneNoneZ");
50573         *ret_conv = InvoiceRequestFeatures_set_required_custom_bit(&this_arg_conv, bit);
50574         return tag_ptr(ret_conv, true);
50575 }
50576
50577 uint64_t  __attribute__((export_name("TS_InvoiceRequestFeatures_set_optional_custom_bit"))) TS_InvoiceRequestFeatures_set_optional_custom_bit(uint64_t this_arg, uint32_t bit) {
50578         LDKInvoiceRequestFeatures this_arg_conv;
50579         this_arg_conv.inner = untag_ptr(this_arg);
50580         this_arg_conv.is_owned = ptr_is_owned(this_arg);
50581         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
50582         this_arg_conv.is_owned = false;
50583         LDKCResult_NoneNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneNoneZ), "LDKCResult_NoneNoneZ");
50584         *ret_conv = InvoiceRequestFeatures_set_optional_custom_bit(&this_arg_conv, bit);
50585         return tag_ptr(ret_conv, true);
50586 }
50587
50588 uint64_t  __attribute__((export_name("TS_Bolt12InvoiceFeatures_empty"))) TS_Bolt12InvoiceFeatures_empty() {
50589         LDKBolt12InvoiceFeatures ret_var = Bolt12InvoiceFeatures_empty();
50590         uint64_t ret_ref = 0;
50591         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
50592         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
50593         return ret_ref;
50594 }
50595
50596 jboolean  __attribute__((export_name("TS_Bolt12InvoiceFeatures_requires_unknown_bits_from"))) TS_Bolt12InvoiceFeatures_requires_unknown_bits_from(uint64_t this_arg, uint64_t other) {
50597         LDKBolt12InvoiceFeatures this_arg_conv;
50598         this_arg_conv.inner = untag_ptr(this_arg);
50599         this_arg_conv.is_owned = ptr_is_owned(this_arg);
50600         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
50601         this_arg_conv.is_owned = false;
50602         LDKBolt12InvoiceFeatures other_conv;
50603         other_conv.inner = untag_ptr(other);
50604         other_conv.is_owned = ptr_is_owned(other);
50605         CHECK_INNER_FIELD_ACCESS_OR_NULL(other_conv);
50606         other_conv.is_owned = false;
50607         jboolean ret_conv = Bolt12InvoiceFeatures_requires_unknown_bits_from(&this_arg_conv, &other_conv);
50608         return ret_conv;
50609 }
50610
50611 jboolean  __attribute__((export_name("TS_Bolt12InvoiceFeatures_requires_unknown_bits"))) TS_Bolt12InvoiceFeatures_requires_unknown_bits(uint64_t this_arg) {
50612         LDKBolt12InvoiceFeatures this_arg_conv;
50613         this_arg_conv.inner = untag_ptr(this_arg);
50614         this_arg_conv.is_owned = ptr_is_owned(this_arg);
50615         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
50616         this_arg_conv.is_owned = false;
50617         jboolean ret_conv = Bolt12InvoiceFeatures_requires_unknown_bits(&this_arg_conv);
50618         return ret_conv;
50619 }
50620
50621 uint64_t  __attribute__((export_name("TS_Bolt12InvoiceFeatures_set_required_feature_bit"))) TS_Bolt12InvoiceFeatures_set_required_feature_bit(uint64_t this_arg, uint32_t bit) {
50622         LDKBolt12InvoiceFeatures this_arg_conv;
50623         this_arg_conv.inner = untag_ptr(this_arg);
50624         this_arg_conv.is_owned = ptr_is_owned(this_arg);
50625         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
50626         this_arg_conv.is_owned = false;
50627         LDKCResult_NoneNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneNoneZ), "LDKCResult_NoneNoneZ");
50628         *ret_conv = Bolt12InvoiceFeatures_set_required_feature_bit(&this_arg_conv, bit);
50629         return tag_ptr(ret_conv, true);
50630 }
50631
50632 uint64_t  __attribute__((export_name("TS_Bolt12InvoiceFeatures_set_optional_feature_bit"))) TS_Bolt12InvoiceFeatures_set_optional_feature_bit(uint64_t this_arg, uint32_t bit) {
50633         LDKBolt12InvoiceFeatures this_arg_conv;
50634         this_arg_conv.inner = untag_ptr(this_arg);
50635         this_arg_conv.is_owned = ptr_is_owned(this_arg);
50636         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
50637         this_arg_conv.is_owned = false;
50638         LDKCResult_NoneNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneNoneZ), "LDKCResult_NoneNoneZ");
50639         *ret_conv = Bolt12InvoiceFeatures_set_optional_feature_bit(&this_arg_conv, bit);
50640         return tag_ptr(ret_conv, true);
50641 }
50642
50643 uint64_t  __attribute__((export_name("TS_Bolt12InvoiceFeatures_set_required_custom_bit"))) TS_Bolt12InvoiceFeatures_set_required_custom_bit(uint64_t this_arg, uint32_t bit) {
50644         LDKBolt12InvoiceFeatures this_arg_conv;
50645         this_arg_conv.inner = untag_ptr(this_arg);
50646         this_arg_conv.is_owned = ptr_is_owned(this_arg);
50647         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
50648         this_arg_conv.is_owned = false;
50649         LDKCResult_NoneNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneNoneZ), "LDKCResult_NoneNoneZ");
50650         *ret_conv = Bolt12InvoiceFeatures_set_required_custom_bit(&this_arg_conv, bit);
50651         return tag_ptr(ret_conv, true);
50652 }
50653
50654 uint64_t  __attribute__((export_name("TS_Bolt12InvoiceFeatures_set_optional_custom_bit"))) TS_Bolt12InvoiceFeatures_set_optional_custom_bit(uint64_t this_arg, uint32_t bit) {
50655         LDKBolt12InvoiceFeatures this_arg_conv;
50656         this_arg_conv.inner = untag_ptr(this_arg);
50657         this_arg_conv.is_owned = ptr_is_owned(this_arg);
50658         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
50659         this_arg_conv.is_owned = false;
50660         LDKCResult_NoneNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneNoneZ), "LDKCResult_NoneNoneZ");
50661         *ret_conv = Bolt12InvoiceFeatures_set_optional_custom_bit(&this_arg_conv, bit);
50662         return tag_ptr(ret_conv, true);
50663 }
50664
50665 uint64_t  __attribute__((export_name("TS_BlindedHopFeatures_empty"))) TS_BlindedHopFeatures_empty() {
50666         LDKBlindedHopFeatures ret_var = BlindedHopFeatures_empty();
50667         uint64_t ret_ref = 0;
50668         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
50669         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
50670         return ret_ref;
50671 }
50672
50673 jboolean  __attribute__((export_name("TS_BlindedHopFeatures_requires_unknown_bits_from"))) TS_BlindedHopFeatures_requires_unknown_bits_from(uint64_t this_arg, uint64_t other) {
50674         LDKBlindedHopFeatures this_arg_conv;
50675         this_arg_conv.inner = untag_ptr(this_arg);
50676         this_arg_conv.is_owned = ptr_is_owned(this_arg);
50677         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
50678         this_arg_conv.is_owned = false;
50679         LDKBlindedHopFeatures other_conv;
50680         other_conv.inner = untag_ptr(other);
50681         other_conv.is_owned = ptr_is_owned(other);
50682         CHECK_INNER_FIELD_ACCESS_OR_NULL(other_conv);
50683         other_conv.is_owned = false;
50684         jboolean ret_conv = BlindedHopFeatures_requires_unknown_bits_from(&this_arg_conv, &other_conv);
50685         return ret_conv;
50686 }
50687
50688 jboolean  __attribute__((export_name("TS_BlindedHopFeatures_requires_unknown_bits"))) TS_BlindedHopFeatures_requires_unknown_bits(uint64_t this_arg) {
50689         LDKBlindedHopFeatures this_arg_conv;
50690         this_arg_conv.inner = untag_ptr(this_arg);
50691         this_arg_conv.is_owned = ptr_is_owned(this_arg);
50692         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
50693         this_arg_conv.is_owned = false;
50694         jboolean ret_conv = BlindedHopFeatures_requires_unknown_bits(&this_arg_conv);
50695         return ret_conv;
50696 }
50697
50698 uint64_t  __attribute__((export_name("TS_BlindedHopFeatures_set_required_feature_bit"))) TS_BlindedHopFeatures_set_required_feature_bit(uint64_t this_arg, uint32_t bit) {
50699         LDKBlindedHopFeatures this_arg_conv;
50700         this_arg_conv.inner = untag_ptr(this_arg);
50701         this_arg_conv.is_owned = ptr_is_owned(this_arg);
50702         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
50703         this_arg_conv.is_owned = false;
50704         LDKCResult_NoneNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneNoneZ), "LDKCResult_NoneNoneZ");
50705         *ret_conv = BlindedHopFeatures_set_required_feature_bit(&this_arg_conv, bit);
50706         return tag_ptr(ret_conv, true);
50707 }
50708
50709 uint64_t  __attribute__((export_name("TS_BlindedHopFeatures_set_optional_feature_bit"))) TS_BlindedHopFeatures_set_optional_feature_bit(uint64_t this_arg, uint32_t bit) {
50710         LDKBlindedHopFeatures this_arg_conv;
50711         this_arg_conv.inner = untag_ptr(this_arg);
50712         this_arg_conv.is_owned = ptr_is_owned(this_arg);
50713         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
50714         this_arg_conv.is_owned = false;
50715         LDKCResult_NoneNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneNoneZ), "LDKCResult_NoneNoneZ");
50716         *ret_conv = BlindedHopFeatures_set_optional_feature_bit(&this_arg_conv, bit);
50717         return tag_ptr(ret_conv, true);
50718 }
50719
50720 uint64_t  __attribute__((export_name("TS_BlindedHopFeatures_set_required_custom_bit"))) TS_BlindedHopFeatures_set_required_custom_bit(uint64_t this_arg, uint32_t bit) {
50721         LDKBlindedHopFeatures this_arg_conv;
50722         this_arg_conv.inner = untag_ptr(this_arg);
50723         this_arg_conv.is_owned = ptr_is_owned(this_arg);
50724         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
50725         this_arg_conv.is_owned = false;
50726         LDKCResult_NoneNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneNoneZ), "LDKCResult_NoneNoneZ");
50727         *ret_conv = BlindedHopFeatures_set_required_custom_bit(&this_arg_conv, bit);
50728         return tag_ptr(ret_conv, true);
50729 }
50730
50731 uint64_t  __attribute__((export_name("TS_BlindedHopFeatures_set_optional_custom_bit"))) TS_BlindedHopFeatures_set_optional_custom_bit(uint64_t this_arg, uint32_t bit) {
50732         LDKBlindedHopFeatures this_arg_conv;
50733         this_arg_conv.inner = untag_ptr(this_arg);
50734         this_arg_conv.is_owned = ptr_is_owned(this_arg);
50735         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
50736         this_arg_conv.is_owned = false;
50737         LDKCResult_NoneNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneNoneZ), "LDKCResult_NoneNoneZ");
50738         *ret_conv = BlindedHopFeatures_set_optional_custom_bit(&this_arg_conv, bit);
50739         return tag_ptr(ret_conv, true);
50740 }
50741
50742 uint64_t  __attribute__((export_name("TS_ChannelTypeFeatures_empty"))) TS_ChannelTypeFeatures_empty() {
50743         LDKChannelTypeFeatures ret_var = ChannelTypeFeatures_empty();
50744         uint64_t ret_ref = 0;
50745         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
50746         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
50747         return ret_ref;
50748 }
50749
50750 jboolean  __attribute__((export_name("TS_ChannelTypeFeatures_requires_unknown_bits_from"))) TS_ChannelTypeFeatures_requires_unknown_bits_from(uint64_t this_arg, uint64_t other) {
50751         LDKChannelTypeFeatures this_arg_conv;
50752         this_arg_conv.inner = untag_ptr(this_arg);
50753         this_arg_conv.is_owned = ptr_is_owned(this_arg);
50754         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
50755         this_arg_conv.is_owned = false;
50756         LDKChannelTypeFeatures other_conv;
50757         other_conv.inner = untag_ptr(other);
50758         other_conv.is_owned = ptr_is_owned(other);
50759         CHECK_INNER_FIELD_ACCESS_OR_NULL(other_conv);
50760         other_conv.is_owned = false;
50761         jboolean ret_conv = ChannelTypeFeatures_requires_unknown_bits_from(&this_arg_conv, &other_conv);
50762         return ret_conv;
50763 }
50764
50765 jboolean  __attribute__((export_name("TS_ChannelTypeFeatures_requires_unknown_bits"))) TS_ChannelTypeFeatures_requires_unknown_bits(uint64_t this_arg) {
50766         LDKChannelTypeFeatures this_arg_conv;
50767         this_arg_conv.inner = untag_ptr(this_arg);
50768         this_arg_conv.is_owned = ptr_is_owned(this_arg);
50769         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
50770         this_arg_conv.is_owned = false;
50771         jboolean ret_conv = ChannelTypeFeatures_requires_unknown_bits(&this_arg_conv);
50772         return ret_conv;
50773 }
50774
50775 uint64_t  __attribute__((export_name("TS_ChannelTypeFeatures_set_required_feature_bit"))) TS_ChannelTypeFeatures_set_required_feature_bit(uint64_t this_arg, uint32_t bit) {
50776         LDKChannelTypeFeatures this_arg_conv;
50777         this_arg_conv.inner = untag_ptr(this_arg);
50778         this_arg_conv.is_owned = ptr_is_owned(this_arg);
50779         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
50780         this_arg_conv.is_owned = false;
50781         LDKCResult_NoneNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneNoneZ), "LDKCResult_NoneNoneZ");
50782         *ret_conv = ChannelTypeFeatures_set_required_feature_bit(&this_arg_conv, bit);
50783         return tag_ptr(ret_conv, true);
50784 }
50785
50786 uint64_t  __attribute__((export_name("TS_ChannelTypeFeatures_set_optional_feature_bit"))) TS_ChannelTypeFeatures_set_optional_feature_bit(uint64_t this_arg, uint32_t bit) {
50787         LDKChannelTypeFeatures this_arg_conv;
50788         this_arg_conv.inner = untag_ptr(this_arg);
50789         this_arg_conv.is_owned = ptr_is_owned(this_arg);
50790         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
50791         this_arg_conv.is_owned = false;
50792         LDKCResult_NoneNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneNoneZ), "LDKCResult_NoneNoneZ");
50793         *ret_conv = ChannelTypeFeatures_set_optional_feature_bit(&this_arg_conv, bit);
50794         return tag_ptr(ret_conv, true);
50795 }
50796
50797 uint64_t  __attribute__((export_name("TS_ChannelTypeFeatures_set_required_custom_bit"))) TS_ChannelTypeFeatures_set_required_custom_bit(uint64_t this_arg, uint32_t bit) {
50798         LDKChannelTypeFeatures this_arg_conv;
50799         this_arg_conv.inner = untag_ptr(this_arg);
50800         this_arg_conv.is_owned = ptr_is_owned(this_arg);
50801         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
50802         this_arg_conv.is_owned = false;
50803         LDKCResult_NoneNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneNoneZ), "LDKCResult_NoneNoneZ");
50804         *ret_conv = ChannelTypeFeatures_set_required_custom_bit(&this_arg_conv, bit);
50805         return tag_ptr(ret_conv, true);
50806 }
50807
50808 uint64_t  __attribute__((export_name("TS_ChannelTypeFeatures_set_optional_custom_bit"))) TS_ChannelTypeFeatures_set_optional_custom_bit(uint64_t this_arg, uint32_t bit) {
50809         LDKChannelTypeFeatures this_arg_conv;
50810         this_arg_conv.inner = untag_ptr(this_arg);
50811         this_arg_conv.is_owned = ptr_is_owned(this_arg);
50812         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
50813         this_arg_conv.is_owned = false;
50814         LDKCResult_NoneNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneNoneZ), "LDKCResult_NoneNoneZ");
50815         *ret_conv = ChannelTypeFeatures_set_optional_custom_bit(&this_arg_conv, bit);
50816         return tag_ptr(ret_conv, true);
50817 }
50818
50819 int8_tArray  __attribute__((export_name("TS_InitFeatures_write"))) TS_InitFeatures_write(uint64_t obj) {
50820         LDKInitFeatures obj_conv;
50821         obj_conv.inner = untag_ptr(obj);
50822         obj_conv.is_owned = ptr_is_owned(obj);
50823         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
50824         obj_conv.is_owned = false;
50825         LDKCVec_u8Z ret_var = InitFeatures_write(&obj_conv);
50826         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
50827         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
50828         CVec_u8Z_free(ret_var);
50829         return ret_arr;
50830 }
50831
50832 uint64_t  __attribute__((export_name("TS_InitFeatures_read"))) TS_InitFeatures_read(int8_tArray ser) {
50833         LDKu8slice ser_ref;
50834         ser_ref.datalen = ser->arr_len;
50835         ser_ref.data = ser->elems;
50836         LDKCResult_InitFeaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InitFeaturesDecodeErrorZ), "LDKCResult_InitFeaturesDecodeErrorZ");
50837         *ret_conv = InitFeatures_read(ser_ref);
50838         FREE(ser);
50839         return tag_ptr(ret_conv, true);
50840 }
50841
50842 int8_tArray  __attribute__((export_name("TS_ChannelFeatures_write"))) TS_ChannelFeatures_write(uint64_t obj) {
50843         LDKChannelFeatures obj_conv;
50844         obj_conv.inner = untag_ptr(obj);
50845         obj_conv.is_owned = ptr_is_owned(obj);
50846         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
50847         obj_conv.is_owned = false;
50848         LDKCVec_u8Z ret_var = ChannelFeatures_write(&obj_conv);
50849         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
50850         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
50851         CVec_u8Z_free(ret_var);
50852         return ret_arr;
50853 }
50854
50855 uint64_t  __attribute__((export_name("TS_ChannelFeatures_read"))) TS_ChannelFeatures_read(int8_tArray ser) {
50856         LDKu8slice ser_ref;
50857         ser_ref.datalen = ser->arr_len;
50858         ser_ref.data = ser->elems;
50859         LDKCResult_ChannelFeaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelFeaturesDecodeErrorZ), "LDKCResult_ChannelFeaturesDecodeErrorZ");
50860         *ret_conv = ChannelFeatures_read(ser_ref);
50861         FREE(ser);
50862         return tag_ptr(ret_conv, true);
50863 }
50864
50865 int8_tArray  __attribute__((export_name("TS_NodeFeatures_write"))) TS_NodeFeatures_write(uint64_t obj) {
50866         LDKNodeFeatures obj_conv;
50867         obj_conv.inner = untag_ptr(obj);
50868         obj_conv.is_owned = ptr_is_owned(obj);
50869         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
50870         obj_conv.is_owned = false;
50871         LDKCVec_u8Z ret_var = NodeFeatures_write(&obj_conv);
50872         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
50873         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
50874         CVec_u8Z_free(ret_var);
50875         return ret_arr;
50876 }
50877
50878 uint64_t  __attribute__((export_name("TS_NodeFeatures_read"))) TS_NodeFeatures_read(int8_tArray ser) {
50879         LDKu8slice ser_ref;
50880         ser_ref.datalen = ser->arr_len;
50881         ser_ref.data = ser->elems;
50882         LDKCResult_NodeFeaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NodeFeaturesDecodeErrorZ), "LDKCResult_NodeFeaturesDecodeErrorZ");
50883         *ret_conv = NodeFeatures_read(ser_ref);
50884         FREE(ser);
50885         return tag_ptr(ret_conv, true);
50886 }
50887
50888 int8_tArray  __attribute__((export_name("TS_Bolt11InvoiceFeatures_write"))) TS_Bolt11InvoiceFeatures_write(uint64_t obj) {
50889         LDKBolt11InvoiceFeatures obj_conv;
50890         obj_conv.inner = untag_ptr(obj);
50891         obj_conv.is_owned = ptr_is_owned(obj);
50892         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
50893         obj_conv.is_owned = false;
50894         LDKCVec_u8Z ret_var = Bolt11InvoiceFeatures_write(&obj_conv);
50895         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
50896         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
50897         CVec_u8Z_free(ret_var);
50898         return ret_arr;
50899 }
50900
50901 uint64_t  __attribute__((export_name("TS_Bolt11InvoiceFeatures_read"))) TS_Bolt11InvoiceFeatures_read(int8_tArray ser) {
50902         LDKu8slice ser_ref;
50903         ser_ref.datalen = ser->arr_len;
50904         ser_ref.data = ser->elems;
50905         LDKCResult_Bolt11InvoiceFeaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_Bolt11InvoiceFeaturesDecodeErrorZ), "LDKCResult_Bolt11InvoiceFeaturesDecodeErrorZ");
50906         *ret_conv = Bolt11InvoiceFeatures_read(ser_ref);
50907         FREE(ser);
50908         return tag_ptr(ret_conv, true);
50909 }
50910
50911 int8_tArray  __attribute__((export_name("TS_Bolt12InvoiceFeatures_write"))) TS_Bolt12InvoiceFeatures_write(uint64_t obj) {
50912         LDKBolt12InvoiceFeatures obj_conv;
50913         obj_conv.inner = untag_ptr(obj);
50914         obj_conv.is_owned = ptr_is_owned(obj);
50915         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
50916         obj_conv.is_owned = false;
50917         LDKCVec_u8Z ret_var = Bolt12InvoiceFeatures_write(&obj_conv);
50918         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
50919         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
50920         CVec_u8Z_free(ret_var);
50921         return ret_arr;
50922 }
50923
50924 uint64_t  __attribute__((export_name("TS_Bolt12InvoiceFeatures_read"))) TS_Bolt12InvoiceFeatures_read(int8_tArray ser) {
50925         LDKu8slice ser_ref;
50926         ser_ref.datalen = ser->arr_len;
50927         ser_ref.data = ser->elems;
50928         LDKCResult_Bolt12InvoiceFeaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_Bolt12InvoiceFeaturesDecodeErrorZ), "LDKCResult_Bolt12InvoiceFeaturesDecodeErrorZ");
50929         *ret_conv = Bolt12InvoiceFeatures_read(ser_ref);
50930         FREE(ser);
50931         return tag_ptr(ret_conv, true);
50932 }
50933
50934 int8_tArray  __attribute__((export_name("TS_BlindedHopFeatures_write"))) TS_BlindedHopFeatures_write(uint64_t obj) {
50935         LDKBlindedHopFeatures obj_conv;
50936         obj_conv.inner = untag_ptr(obj);
50937         obj_conv.is_owned = ptr_is_owned(obj);
50938         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
50939         obj_conv.is_owned = false;
50940         LDKCVec_u8Z ret_var = BlindedHopFeatures_write(&obj_conv);
50941         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
50942         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
50943         CVec_u8Z_free(ret_var);
50944         return ret_arr;
50945 }
50946
50947 uint64_t  __attribute__((export_name("TS_BlindedHopFeatures_read"))) TS_BlindedHopFeatures_read(int8_tArray ser) {
50948         LDKu8slice ser_ref;
50949         ser_ref.datalen = ser->arr_len;
50950         ser_ref.data = ser->elems;
50951         LDKCResult_BlindedHopFeaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_BlindedHopFeaturesDecodeErrorZ), "LDKCResult_BlindedHopFeaturesDecodeErrorZ");
50952         *ret_conv = BlindedHopFeatures_read(ser_ref);
50953         FREE(ser);
50954         return tag_ptr(ret_conv, true);
50955 }
50956
50957 int8_tArray  __attribute__((export_name("TS_ChannelTypeFeatures_write"))) TS_ChannelTypeFeatures_write(uint64_t obj) {
50958         LDKChannelTypeFeatures obj_conv;
50959         obj_conv.inner = untag_ptr(obj);
50960         obj_conv.is_owned = ptr_is_owned(obj);
50961         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
50962         obj_conv.is_owned = false;
50963         LDKCVec_u8Z ret_var = ChannelTypeFeatures_write(&obj_conv);
50964         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
50965         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
50966         CVec_u8Z_free(ret_var);
50967         return ret_arr;
50968 }
50969
50970 uint64_t  __attribute__((export_name("TS_ChannelTypeFeatures_read"))) TS_ChannelTypeFeatures_read(int8_tArray ser) {
50971         LDKu8slice ser_ref;
50972         ser_ref.datalen = ser->arr_len;
50973         ser_ref.data = ser->elems;
50974         LDKCResult_ChannelTypeFeaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelTypeFeaturesDecodeErrorZ), "LDKCResult_ChannelTypeFeaturesDecodeErrorZ");
50975         *ret_conv = ChannelTypeFeatures_read(ser_ref);
50976         FREE(ser);
50977         return tag_ptr(ret_conv, true);
50978 }
50979
50980 void  __attribute__((export_name("TS_InitFeatures_set_data_loss_protect_optional"))) TS_InitFeatures_set_data_loss_protect_optional(uint64_t this_arg) {
50981         LDKInitFeatures this_arg_conv;
50982         this_arg_conv.inner = untag_ptr(this_arg);
50983         this_arg_conv.is_owned = ptr_is_owned(this_arg);
50984         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
50985         this_arg_conv.is_owned = false;
50986         InitFeatures_set_data_loss_protect_optional(&this_arg_conv);
50987 }
50988
50989 void  __attribute__((export_name("TS_InitFeatures_set_data_loss_protect_required"))) TS_InitFeatures_set_data_loss_protect_required(uint64_t this_arg) {
50990         LDKInitFeatures this_arg_conv;
50991         this_arg_conv.inner = untag_ptr(this_arg);
50992         this_arg_conv.is_owned = ptr_is_owned(this_arg);
50993         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
50994         this_arg_conv.is_owned = false;
50995         InitFeatures_set_data_loss_protect_required(&this_arg_conv);
50996 }
50997
50998 jboolean  __attribute__((export_name("TS_InitFeatures_supports_data_loss_protect"))) TS_InitFeatures_supports_data_loss_protect(uint64_t this_arg) {
50999         LDKInitFeatures this_arg_conv;
51000         this_arg_conv.inner = untag_ptr(this_arg);
51001         this_arg_conv.is_owned = ptr_is_owned(this_arg);
51002         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
51003         this_arg_conv.is_owned = false;
51004         jboolean ret_conv = InitFeatures_supports_data_loss_protect(&this_arg_conv);
51005         return ret_conv;
51006 }
51007
51008 void  __attribute__((export_name("TS_NodeFeatures_set_data_loss_protect_optional"))) TS_NodeFeatures_set_data_loss_protect_optional(uint64_t this_arg) {
51009         LDKNodeFeatures this_arg_conv;
51010         this_arg_conv.inner = untag_ptr(this_arg);
51011         this_arg_conv.is_owned = ptr_is_owned(this_arg);
51012         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
51013         this_arg_conv.is_owned = false;
51014         NodeFeatures_set_data_loss_protect_optional(&this_arg_conv);
51015 }
51016
51017 void  __attribute__((export_name("TS_NodeFeatures_set_data_loss_protect_required"))) TS_NodeFeatures_set_data_loss_protect_required(uint64_t this_arg) {
51018         LDKNodeFeatures this_arg_conv;
51019         this_arg_conv.inner = untag_ptr(this_arg);
51020         this_arg_conv.is_owned = ptr_is_owned(this_arg);
51021         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
51022         this_arg_conv.is_owned = false;
51023         NodeFeatures_set_data_loss_protect_required(&this_arg_conv);
51024 }
51025
51026 jboolean  __attribute__((export_name("TS_NodeFeatures_supports_data_loss_protect"))) TS_NodeFeatures_supports_data_loss_protect(uint64_t this_arg) {
51027         LDKNodeFeatures this_arg_conv;
51028         this_arg_conv.inner = untag_ptr(this_arg);
51029         this_arg_conv.is_owned = ptr_is_owned(this_arg);
51030         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
51031         this_arg_conv.is_owned = false;
51032         jboolean ret_conv = NodeFeatures_supports_data_loss_protect(&this_arg_conv);
51033         return ret_conv;
51034 }
51035
51036 jboolean  __attribute__((export_name("TS_InitFeatures_requires_data_loss_protect"))) TS_InitFeatures_requires_data_loss_protect(uint64_t this_arg) {
51037         LDKInitFeatures this_arg_conv;
51038         this_arg_conv.inner = untag_ptr(this_arg);
51039         this_arg_conv.is_owned = ptr_is_owned(this_arg);
51040         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
51041         this_arg_conv.is_owned = false;
51042         jboolean ret_conv = InitFeatures_requires_data_loss_protect(&this_arg_conv);
51043         return ret_conv;
51044 }
51045
51046 jboolean  __attribute__((export_name("TS_NodeFeatures_requires_data_loss_protect"))) TS_NodeFeatures_requires_data_loss_protect(uint64_t this_arg) {
51047         LDKNodeFeatures this_arg_conv;
51048         this_arg_conv.inner = untag_ptr(this_arg);
51049         this_arg_conv.is_owned = ptr_is_owned(this_arg);
51050         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
51051         this_arg_conv.is_owned = false;
51052         jboolean ret_conv = NodeFeatures_requires_data_loss_protect(&this_arg_conv);
51053         return ret_conv;
51054 }
51055
51056 void  __attribute__((export_name("TS_InitFeatures_set_initial_routing_sync_optional"))) TS_InitFeatures_set_initial_routing_sync_optional(uint64_t this_arg) {
51057         LDKInitFeatures this_arg_conv;
51058         this_arg_conv.inner = untag_ptr(this_arg);
51059         this_arg_conv.is_owned = ptr_is_owned(this_arg);
51060         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
51061         this_arg_conv.is_owned = false;
51062         InitFeatures_set_initial_routing_sync_optional(&this_arg_conv);
51063 }
51064
51065 void  __attribute__((export_name("TS_InitFeatures_set_initial_routing_sync_required"))) TS_InitFeatures_set_initial_routing_sync_required(uint64_t this_arg) {
51066         LDKInitFeatures this_arg_conv;
51067         this_arg_conv.inner = untag_ptr(this_arg);
51068         this_arg_conv.is_owned = ptr_is_owned(this_arg);
51069         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
51070         this_arg_conv.is_owned = false;
51071         InitFeatures_set_initial_routing_sync_required(&this_arg_conv);
51072 }
51073
51074 jboolean  __attribute__((export_name("TS_InitFeatures_initial_routing_sync"))) TS_InitFeatures_initial_routing_sync(uint64_t this_arg) {
51075         LDKInitFeatures this_arg_conv;
51076         this_arg_conv.inner = untag_ptr(this_arg);
51077         this_arg_conv.is_owned = ptr_is_owned(this_arg);
51078         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
51079         this_arg_conv.is_owned = false;
51080         jboolean ret_conv = InitFeatures_initial_routing_sync(&this_arg_conv);
51081         return ret_conv;
51082 }
51083
51084 void  __attribute__((export_name("TS_InitFeatures_set_upfront_shutdown_script_optional"))) TS_InitFeatures_set_upfront_shutdown_script_optional(uint64_t this_arg) {
51085         LDKInitFeatures this_arg_conv;
51086         this_arg_conv.inner = untag_ptr(this_arg);
51087         this_arg_conv.is_owned = ptr_is_owned(this_arg);
51088         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
51089         this_arg_conv.is_owned = false;
51090         InitFeatures_set_upfront_shutdown_script_optional(&this_arg_conv);
51091 }
51092
51093 void  __attribute__((export_name("TS_InitFeatures_set_upfront_shutdown_script_required"))) TS_InitFeatures_set_upfront_shutdown_script_required(uint64_t this_arg) {
51094         LDKInitFeatures this_arg_conv;
51095         this_arg_conv.inner = untag_ptr(this_arg);
51096         this_arg_conv.is_owned = ptr_is_owned(this_arg);
51097         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
51098         this_arg_conv.is_owned = false;
51099         InitFeatures_set_upfront_shutdown_script_required(&this_arg_conv);
51100 }
51101
51102 jboolean  __attribute__((export_name("TS_InitFeatures_supports_upfront_shutdown_script"))) TS_InitFeatures_supports_upfront_shutdown_script(uint64_t this_arg) {
51103         LDKInitFeatures this_arg_conv;
51104         this_arg_conv.inner = untag_ptr(this_arg);
51105         this_arg_conv.is_owned = ptr_is_owned(this_arg);
51106         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
51107         this_arg_conv.is_owned = false;
51108         jboolean ret_conv = InitFeatures_supports_upfront_shutdown_script(&this_arg_conv);
51109         return ret_conv;
51110 }
51111
51112 void  __attribute__((export_name("TS_NodeFeatures_set_upfront_shutdown_script_optional"))) TS_NodeFeatures_set_upfront_shutdown_script_optional(uint64_t this_arg) {
51113         LDKNodeFeatures this_arg_conv;
51114         this_arg_conv.inner = untag_ptr(this_arg);
51115         this_arg_conv.is_owned = ptr_is_owned(this_arg);
51116         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
51117         this_arg_conv.is_owned = false;
51118         NodeFeatures_set_upfront_shutdown_script_optional(&this_arg_conv);
51119 }
51120
51121 void  __attribute__((export_name("TS_NodeFeatures_set_upfront_shutdown_script_required"))) TS_NodeFeatures_set_upfront_shutdown_script_required(uint64_t this_arg) {
51122         LDKNodeFeatures this_arg_conv;
51123         this_arg_conv.inner = untag_ptr(this_arg);
51124         this_arg_conv.is_owned = ptr_is_owned(this_arg);
51125         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
51126         this_arg_conv.is_owned = false;
51127         NodeFeatures_set_upfront_shutdown_script_required(&this_arg_conv);
51128 }
51129
51130 jboolean  __attribute__((export_name("TS_NodeFeatures_supports_upfront_shutdown_script"))) TS_NodeFeatures_supports_upfront_shutdown_script(uint64_t this_arg) {
51131         LDKNodeFeatures this_arg_conv;
51132         this_arg_conv.inner = untag_ptr(this_arg);
51133         this_arg_conv.is_owned = ptr_is_owned(this_arg);
51134         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
51135         this_arg_conv.is_owned = false;
51136         jboolean ret_conv = NodeFeatures_supports_upfront_shutdown_script(&this_arg_conv);
51137         return ret_conv;
51138 }
51139
51140 jboolean  __attribute__((export_name("TS_InitFeatures_requires_upfront_shutdown_script"))) TS_InitFeatures_requires_upfront_shutdown_script(uint64_t this_arg) {
51141         LDKInitFeatures this_arg_conv;
51142         this_arg_conv.inner = untag_ptr(this_arg);
51143         this_arg_conv.is_owned = ptr_is_owned(this_arg);
51144         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
51145         this_arg_conv.is_owned = false;
51146         jboolean ret_conv = InitFeatures_requires_upfront_shutdown_script(&this_arg_conv);
51147         return ret_conv;
51148 }
51149
51150 jboolean  __attribute__((export_name("TS_NodeFeatures_requires_upfront_shutdown_script"))) TS_NodeFeatures_requires_upfront_shutdown_script(uint64_t this_arg) {
51151         LDKNodeFeatures this_arg_conv;
51152         this_arg_conv.inner = untag_ptr(this_arg);
51153         this_arg_conv.is_owned = ptr_is_owned(this_arg);
51154         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
51155         this_arg_conv.is_owned = false;
51156         jboolean ret_conv = NodeFeatures_requires_upfront_shutdown_script(&this_arg_conv);
51157         return ret_conv;
51158 }
51159
51160 void  __attribute__((export_name("TS_InitFeatures_set_gossip_queries_optional"))) TS_InitFeatures_set_gossip_queries_optional(uint64_t this_arg) {
51161         LDKInitFeatures this_arg_conv;
51162         this_arg_conv.inner = untag_ptr(this_arg);
51163         this_arg_conv.is_owned = ptr_is_owned(this_arg);
51164         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
51165         this_arg_conv.is_owned = false;
51166         InitFeatures_set_gossip_queries_optional(&this_arg_conv);
51167 }
51168
51169 void  __attribute__((export_name("TS_InitFeatures_set_gossip_queries_required"))) TS_InitFeatures_set_gossip_queries_required(uint64_t this_arg) {
51170         LDKInitFeatures this_arg_conv;
51171         this_arg_conv.inner = untag_ptr(this_arg);
51172         this_arg_conv.is_owned = ptr_is_owned(this_arg);
51173         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
51174         this_arg_conv.is_owned = false;
51175         InitFeatures_set_gossip_queries_required(&this_arg_conv);
51176 }
51177
51178 jboolean  __attribute__((export_name("TS_InitFeatures_supports_gossip_queries"))) TS_InitFeatures_supports_gossip_queries(uint64_t this_arg) {
51179         LDKInitFeatures this_arg_conv;
51180         this_arg_conv.inner = untag_ptr(this_arg);
51181         this_arg_conv.is_owned = ptr_is_owned(this_arg);
51182         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
51183         this_arg_conv.is_owned = false;
51184         jboolean ret_conv = InitFeatures_supports_gossip_queries(&this_arg_conv);
51185         return ret_conv;
51186 }
51187
51188 void  __attribute__((export_name("TS_NodeFeatures_set_gossip_queries_optional"))) TS_NodeFeatures_set_gossip_queries_optional(uint64_t this_arg) {
51189         LDKNodeFeatures this_arg_conv;
51190         this_arg_conv.inner = untag_ptr(this_arg);
51191         this_arg_conv.is_owned = ptr_is_owned(this_arg);
51192         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
51193         this_arg_conv.is_owned = false;
51194         NodeFeatures_set_gossip_queries_optional(&this_arg_conv);
51195 }
51196
51197 void  __attribute__((export_name("TS_NodeFeatures_set_gossip_queries_required"))) TS_NodeFeatures_set_gossip_queries_required(uint64_t this_arg) {
51198         LDKNodeFeatures this_arg_conv;
51199         this_arg_conv.inner = untag_ptr(this_arg);
51200         this_arg_conv.is_owned = ptr_is_owned(this_arg);
51201         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
51202         this_arg_conv.is_owned = false;
51203         NodeFeatures_set_gossip_queries_required(&this_arg_conv);
51204 }
51205
51206 jboolean  __attribute__((export_name("TS_NodeFeatures_supports_gossip_queries"))) TS_NodeFeatures_supports_gossip_queries(uint64_t this_arg) {
51207         LDKNodeFeatures this_arg_conv;
51208         this_arg_conv.inner = untag_ptr(this_arg);
51209         this_arg_conv.is_owned = ptr_is_owned(this_arg);
51210         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
51211         this_arg_conv.is_owned = false;
51212         jboolean ret_conv = NodeFeatures_supports_gossip_queries(&this_arg_conv);
51213         return ret_conv;
51214 }
51215
51216 jboolean  __attribute__((export_name("TS_InitFeatures_requires_gossip_queries"))) TS_InitFeatures_requires_gossip_queries(uint64_t this_arg) {
51217         LDKInitFeatures this_arg_conv;
51218         this_arg_conv.inner = untag_ptr(this_arg);
51219         this_arg_conv.is_owned = ptr_is_owned(this_arg);
51220         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
51221         this_arg_conv.is_owned = false;
51222         jboolean ret_conv = InitFeatures_requires_gossip_queries(&this_arg_conv);
51223         return ret_conv;
51224 }
51225
51226 jboolean  __attribute__((export_name("TS_NodeFeatures_requires_gossip_queries"))) TS_NodeFeatures_requires_gossip_queries(uint64_t this_arg) {
51227         LDKNodeFeatures this_arg_conv;
51228         this_arg_conv.inner = untag_ptr(this_arg);
51229         this_arg_conv.is_owned = ptr_is_owned(this_arg);
51230         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
51231         this_arg_conv.is_owned = false;
51232         jboolean ret_conv = NodeFeatures_requires_gossip_queries(&this_arg_conv);
51233         return ret_conv;
51234 }
51235
51236 void  __attribute__((export_name("TS_InitFeatures_set_variable_length_onion_optional"))) TS_InitFeatures_set_variable_length_onion_optional(uint64_t this_arg) {
51237         LDKInitFeatures this_arg_conv;
51238         this_arg_conv.inner = untag_ptr(this_arg);
51239         this_arg_conv.is_owned = ptr_is_owned(this_arg);
51240         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
51241         this_arg_conv.is_owned = false;
51242         InitFeatures_set_variable_length_onion_optional(&this_arg_conv);
51243 }
51244
51245 void  __attribute__((export_name("TS_InitFeatures_set_variable_length_onion_required"))) TS_InitFeatures_set_variable_length_onion_required(uint64_t this_arg) {
51246         LDKInitFeatures this_arg_conv;
51247         this_arg_conv.inner = untag_ptr(this_arg);
51248         this_arg_conv.is_owned = ptr_is_owned(this_arg);
51249         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
51250         this_arg_conv.is_owned = false;
51251         InitFeatures_set_variable_length_onion_required(&this_arg_conv);
51252 }
51253
51254 jboolean  __attribute__((export_name("TS_InitFeatures_supports_variable_length_onion"))) TS_InitFeatures_supports_variable_length_onion(uint64_t this_arg) {
51255         LDKInitFeatures this_arg_conv;
51256         this_arg_conv.inner = untag_ptr(this_arg);
51257         this_arg_conv.is_owned = ptr_is_owned(this_arg);
51258         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
51259         this_arg_conv.is_owned = false;
51260         jboolean ret_conv = InitFeatures_supports_variable_length_onion(&this_arg_conv);
51261         return ret_conv;
51262 }
51263
51264 void  __attribute__((export_name("TS_NodeFeatures_set_variable_length_onion_optional"))) TS_NodeFeatures_set_variable_length_onion_optional(uint64_t this_arg) {
51265         LDKNodeFeatures this_arg_conv;
51266         this_arg_conv.inner = untag_ptr(this_arg);
51267         this_arg_conv.is_owned = ptr_is_owned(this_arg);
51268         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
51269         this_arg_conv.is_owned = false;
51270         NodeFeatures_set_variable_length_onion_optional(&this_arg_conv);
51271 }
51272
51273 void  __attribute__((export_name("TS_NodeFeatures_set_variable_length_onion_required"))) TS_NodeFeatures_set_variable_length_onion_required(uint64_t this_arg) {
51274         LDKNodeFeatures this_arg_conv;
51275         this_arg_conv.inner = untag_ptr(this_arg);
51276         this_arg_conv.is_owned = ptr_is_owned(this_arg);
51277         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
51278         this_arg_conv.is_owned = false;
51279         NodeFeatures_set_variable_length_onion_required(&this_arg_conv);
51280 }
51281
51282 jboolean  __attribute__((export_name("TS_NodeFeatures_supports_variable_length_onion"))) TS_NodeFeatures_supports_variable_length_onion(uint64_t this_arg) {
51283         LDKNodeFeatures this_arg_conv;
51284         this_arg_conv.inner = untag_ptr(this_arg);
51285         this_arg_conv.is_owned = ptr_is_owned(this_arg);
51286         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
51287         this_arg_conv.is_owned = false;
51288         jboolean ret_conv = NodeFeatures_supports_variable_length_onion(&this_arg_conv);
51289         return ret_conv;
51290 }
51291
51292 void  __attribute__((export_name("TS_Bolt11InvoiceFeatures_set_variable_length_onion_optional"))) TS_Bolt11InvoiceFeatures_set_variable_length_onion_optional(uint64_t this_arg) {
51293         LDKBolt11InvoiceFeatures this_arg_conv;
51294         this_arg_conv.inner = untag_ptr(this_arg);
51295         this_arg_conv.is_owned = ptr_is_owned(this_arg);
51296         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
51297         this_arg_conv.is_owned = false;
51298         Bolt11InvoiceFeatures_set_variable_length_onion_optional(&this_arg_conv);
51299 }
51300
51301 void  __attribute__((export_name("TS_Bolt11InvoiceFeatures_set_variable_length_onion_required"))) TS_Bolt11InvoiceFeatures_set_variable_length_onion_required(uint64_t this_arg) {
51302         LDKBolt11InvoiceFeatures this_arg_conv;
51303         this_arg_conv.inner = untag_ptr(this_arg);
51304         this_arg_conv.is_owned = ptr_is_owned(this_arg);
51305         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
51306         this_arg_conv.is_owned = false;
51307         Bolt11InvoiceFeatures_set_variable_length_onion_required(&this_arg_conv);
51308 }
51309
51310 jboolean  __attribute__((export_name("TS_Bolt11InvoiceFeatures_supports_variable_length_onion"))) TS_Bolt11InvoiceFeatures_supports_variable_length_onion(uint64_t this_arg) {
51311         LDKBolt11InvoiceFeatures this_arg_conv;
51312         this_arg_conv.inner = untag_ptr(this_arg);
51313         this_arg_conv.is_owned = ptr_is_owned(this_arg);
51314         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
51315         this_arg_conv.is_owned = false;
51316         jboolean ret_conv = Bolt11InvoiceFeatures_supports_variable_length_onion(&this_arg_conv);
51317         return ret_conv;
51318 }
51319
51320 jboolean  __attribute__((export_name("TS_InitFeatures_requires_variable_length_onion"))) TS_InitFeatures_requires_variable_length_onion(uint64_t this_arg) {
51321         LDKInitFeatures this_arg_conv;
51322         this_arg_conv.inner = untag_ptr(this_arg);
51323         this_arg_conv.is_owned = ptr_is_owned(this_arg);
51324         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
51325         this_arg_conv.is_owned = false;
51326         jboolean ret_conv = InitFeatures_requires_variable_length_onion(&this_arg_conv);
51327         return ret_conv;
51328 }
51329
51330 jboolean  __attribute__((export_name("TS_NodeFeatures_requires_variable_length_onion"))) TS_NodeFeatures_requires_variable_length_onion(uint64_t this_arg) {
51331         LDKNodeFeatures this_arg_conv;
51332         this_arg_conv.inner = untag_ptr(this_arg);
51333         this_arg_conv.is_owned = ptr_is_owned(this_arg);
51334         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
51335         this_arg_conv.is_owned = false;
51336         jboolean ret_conv = NodeFeatures_requires_variable_length_onion(&this_arg_conv);
51337         return ret_conv;
51338 }
51339
51340 jboolean  __attribute__((export_name("TS_Bolt11InvoiceFeatures_requires_variable_length_onion"))) TS_Bolt11InvoiceFeatures_requires_variable_length_onion(uint64_t this_arg) {
51341         LDKBolt11InvoiceFeatures this_arg_conv;
51342         this_arg_conv.inner = untag_ptr(this_arg);
51343         this_arg_conv.is_owned = ptr_is_owned(this_arg);
51344         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
51345         this_arg_conv.is_owned = false;
51346         jboolean ret_conv = Bolt11InvoiceFeatures_requires_variable_length_onion(&this_arg_conv);
51347         return ret_conv;
51348 }
51349
51350 void  __attribute__((export_name("TS_InitFeatures_set_static_remote_key_optional"))) TS_InitFeatures_set_static_remote_key_optional(uint64_t this_arg) {
51351         LDKInitFeatures this_arg_conv;
51352         this_arg_conv.inner = untag_ptr(this_arg);
51353         this_arg_conv.is_owned = ptr_is_owned(this_arg);
51354         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
51355         this_arg_conv.is_owned = false;
51356         InitFeatures_set_static_remote_key_optional(&this_arg_conv);
51357 }
51358
51359 void  __attribute__((export_name("TS_InitFeatures_set_static_remote_key_required"))) TS_InitFeatures_set_static_remote_key_required(uint64_t this_arg) {
51360         LDKInitFeatures this_arg_conv;
51361         this_arg_conv.inner = untag_ptr(this_arg);
51362         this_arg_conv.is_owned = ptr_is_owned(this_arg);
51363         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
51364         this_arg_conv.is_owned = false;
51365         InitFeatures_set_static_remote_key_required(&this_arg_conv);
51366 }
51367
51368 jboolean  __attribute__((export_name("TS_InitFeatures_supports_static_remote_key"))) TS_InitFeatures_supports_static_remote_key(uint64_t this_arg) {
51369         LDKInitFeatures this_arg_conv;
51370         this_arg_conv.inner = untag_ptr(this_arg);
51371         this_arg_conv.is_owned = ptr_is_owned(this_arg);
51372         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
51373         this_arg_conv.is_owned = false;
51374         jboolean ret_conv = InitFeatures_supports_static_remote_key(&this_arg_conv);
51375         return ret_conv;
51376 }
51377
51378 void  __attribute__((export_name("TS_NodeFeatures_set_static_remote_key_optional"))) TS_NodeFeatures_set_static_remote_key_optional(uint64_t this_arg) {
51379         LDKNodeFeatures this_arg_conv;
51380         this_arg_conv.inner = untag_ptr(this_arg);
51381         this_arg_conv.is_owned = ptr_is_owned(this_arg);
51382         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
51383         this_arg_conv.is_owned = false;
51384         NodeFeatures_set_static_remote_key_optional(&this_arg_conv);
51385 }
51386
51387 void  __attribute__((export_name("TS_NodeFeatures_set_static_remote_key_required"))) TS_NodeFeatures_set_static_remote_key_required(uint64_t this_arg) {
51388         LDKNodeFeatures this_arg_conv;
51389         this_arg_conv.inner = untag_ptr(this_arg);
51390         this_arg_conv.is_owned = ptr_is_owned(this_arg);
51391         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
51392         this_arg_conv.is_owned = false;
51393         NodeFeatures_set_static_remote_key_required(&this_arg_conv);
51394 }
51395
51396 jboolean  __attribute__((export_name("TS_NodeFeatures_supports_static_remote_key"))) TS_NodeFeatures_supports_static_remote_key(uint64_t this_arg) {
51397         LDKNodeFeatures this_arg_conv;
51398         this_arg_conv.inner = untag_ptr(this_arg);
51399         this_arg_conv.is_owned = ptr_is_owned(this_arg);
51400         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
51401         this_arg_conv.is_owned = false;
51402         jboolean ret_conv = NodeFeatures_supports_static_remote_key(&this_arg_conv);
51403         return ret_conv;
51404 }
51405
51406 void  __attribute__((export_name("TS_ChannelTypeFeatures_set_static_remote_key_optional"))) TS_ChannelTypeFeatures_set_static_remote_key_optional(uint64_t this_arg) {
51407         LDKChannelTypeFeatures this_arg_conv;
51408         this_arg_conv.inner = untag_ptr(this_arg);
51409         this_arg_conv.is_owned = ptr_is_owned(this_arg);
51410         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
51411         this_arg_conv.is_owned = false;
51412         ChannelTypeFeatures_set_static_remote_key_optional(&this_arg_conv);
51413 }
51414
51415 void  __attribute__((export_name("TS_ChannelTypeFeatures_set_static_remote_key_required"))) TS_ChannelTypeFeatures_set_static_remote_key_required(uint64_t this_arg) {
51416         LDKChannelTypeFeatures this_arg_conv;
51417         this_arg_conv.inner = untag_ptr(this_arg);
51418         this_arg_conv.is_owned = ptr_is_owned(this_arg);
51419         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
51420         this_arg_conv.is_owned = false;
51421         ChannelTypeFeatures_set_static_remote_key_required(&this_arg_conv);
51422 }
51423
51424 jboolean  __attribute__((export_name("TS_ChannelTypeFeatures_supports_static_remote_key"))) TS_ChannelTypeFeatures_supports_static_remote_key(uint64_t this_arg) {
51425         LDKChannelTypeFeatures this_arg_conv;
51426         this_arg_conv.inner = untag_ptr(this_arg);
51427         this_arg_conv.is_owned = ptr_is_owned(this_arg);
51428         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
51429         this_arg_conv.is_owned = false;
51430         jboolean ret_conv = ChannelTypeFeatures_supports_static_remote_key(&this_arg_conv);
51431         return ret_conv;
51432 }
51433
51434 jboolean  __attribute__((export_name("TS_InitFeatures_requires_static_remote_key"))) TS_InitFeatures_requires_static_remote_key(uint64_t this_arg) {
51435         LDKInitFeatures this_arg_conv;
51436         this_arg_conv.inner = untag_ptr(this_arg);
51437         this_arg_conv.is_owned = ptr_is_owned(this_arg);
51438         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
51439         this_arg_conv.is_owned = false;
51440         jboolean ret_conv = InitFeatures_requires_static_remote_key(&this_arg_conv);
51441         return ret_conv;
51442 }
51443
51444 jboolean  __attribute__((export_name("TS_NodeFeatures_requires_static_remote_key"))) TS_NodeFeatures_requires_static_remote_key(uint64_t this_arg) {
51445         LDKNodeFeatures this_arg_conv;
51446         this_arg_conv.inner = untag_ptr(this_arg);
51447         this_arg_conv.is_owned = ptr_is_owned(this_arg);
51448         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
51449         this_arg_conv.is_owned = false;
51450         jboolean ret_conv = NodeFeatures_requires_static_remote_key(&this_arg_conv);
51451         return ret_conv;
51452 }
51453
51454 jboolean  __attribute__((export_name("TS_ChannelTypeFeatures_requires_static_remote_key"))) TS_ChannelTypeFeatures_requires_static_remote_key(uint64_t this_arg) {
51455         LDKChannelTypeFeatures this_arg_conv;
51456         this_arg_conv.inner = untag_ptr(this_arg);
51457         this_arg_conv.is_owned = ptr_is_owned(this_arg);
51458         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
51459         this_arg_conv.is_owned = false;
51460         jboolean ret_conv = ChannelTypeFeatures_requires_static_remote_key(&this_arg_conv);
51461         return ret_conv;
51462 }
51463
51464 void  __attribute__((export_name("TS_InitFeatures_set_payment_secret_optional"))) TS_InitFeatures_set_payment_secret_optional(uint64_t this_arg) {
51465         LDKInitFeatures this_arg_conv;
51466         this_arg_conv.inner = untag_ptr(this_arg);
51467         this_arg_conv.is_owned = ptr_is_owned(this_arg);
51468         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
51469         this_arg_conv.is_owned = false;
51470         InitFeatures_set_payment_secret_optional(&this_arg_conv);
51471 }
51472
51473 void  __attribute__((export_name("TS_InitFeatures_set_payment_secret_required"))) TS_InitFeatures_set_payment_secret_required(uint64_t this_arg) {
51474         LDKInitFeatures this_arg_conv;
51475         this_arg_conv.inner = untag_ptr(this_arg);
51476         this_arg_conv.is_owned = ptr_is_owned(this_arg);
51477         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
51478         this_arg_conv.is_owned = false;
51479         InitFeatures_set_payment_secret_required(&this_arg_conv);
51480 }
51481
51482 jboolean  __attribute__((export_name("TS_InitFeatures_supports_payment_secret"))) TS_InitFeatures_supports_payment_secret(uint64_t this_arg) {
51483         LDKInitFeatures this_arg_conv;
51484         this_arg_conv.inner = untag_ptr(this_arg);
51485         this_arg_conv.is_owned = ptr_is_owned(this_arg);
51486         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
51487         this_arg_conv.is_owned = false;
51488         jboolean ret_conv = InitFeatures_supports_payment_secret(&this_arg_conv);
51489         return ret_conv;
51490 }
51491
51492 void  __attribute__((export_name("TS_NodeFeatures_set_payment_secret_optional"))) TS_NodeFeatures_set_payment_secret_optional(uint64_t this_arg) {
51493         LDKNodeFeatures this_arg_conv;
51494         this_arg_conv.inner = untag_ptr(this_arg);
51495         this_arg_conv.is_owned = ptr_is_owned(this_arg);
51496         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
51497         this_arg_conv.is_owned = false;
51498         NodeFeatures_set_payment_secret_optional(&this_arg_conv);
51499 }
51500
51501 void  __attribute__((export_name("TS_NodeFeatures_set_payment_secret_required"))) TS_NodeFeatures_set_payment_secret_required(uint64_t this_arg) {
51502         LDKNodeFeatures this_arg_conv;
51503         this_arg_conv.inner = untag_ptr(this_arg);
51504         this_arg_conv.is_owned = ptr_is_owned(this_arg);
51505         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
51506         this_arg_conv.is_owned = false;
51507         NodeFeatures_set_payment_secret_required(&this_arg_conv);
51508 }
51509
51510 jboolean  __attribute__((export_name("TS_NodeFeatures_supports_payment_secret"))) TS_NodeFeatures_supports_payment_secret(uint64_t this_arg) {
51511         LDKNodeFeatures this_arg_conv;
51512         this_arg_conv.inner = untag_ptr(this_arg);
51513         this_arg_conv.is_owned = ptr_is_owned(this_arg);
51514         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
51515         this_arg_conv.is_owned = false;
51516         jboolean ret_conv = NodeFeatures_supports_payment_secret(&this_arg_conv);
51517         return ret_conv;
51518 }
51519
51520 void  __attribute__((export_name("TS_Bolt11InvoiceFeatures_set_payment_secret_optional"))) TS_Bolt11InvoiceFeatures_set_payment_secret_optional(uint64_t this_arg) {
51521         LDKBolt11InvoiceFeatures this_arg_conv;
51522         this_arg_conv.inner = untag_ptr(this_arg);
51523         this_arg_conv.is_owned = ptr_is_owned(this_arg);
51524         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
51525         this_arg_conv.is_owned = false;
51526         Bolt11InvoiceFeatures_set_payment_secret_optional(&this_arg_conv);
51527 }
51528
51529 void  __attribute__((export_name("TS_Bolt11InvoiceFeatures_set_payment_secret_required"))) TS_Bolt11InvoiceFeatures_set_payment_secret_required(uint64_t this_arg) {
51530         LDKBolt11InvoiceFeatures this_arg_conv;
51531         this_arg_conv.inner = untag_ptr(this_arg);
51532         this_arg_conv.is_owned = ptr_is_owned(this_arg);
51533         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
51534         this_arg_conv.is_owned = false;
51535         Bolt11InvoiceFeatures_set_payment_secret_required(&this_arg_conv);
51536 }
51537
51538 jboolean  __attribute__((export_name("TS_Bolt11InvoiceFeatures_supports_payment_secret"))) TS_Bolt11InvoiceFeatures_supports_payment_secret(uint64_t this_arg) {
51539         LDKBolt11InvoiceFeatures this_arg_conv;
51540         this_arg_conv.inner = untag_ptr(this_arg);
51541         this_arg_conv.is_owned = ptr_is_owned(this_arg);
51542         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
51543         this_arg_conv.is_owned = false;
51544         jboolean ret_conv = Bolt11InvoiceFeatures_supports_payment_secret(&this_arg_conv);
51545         return ret_conv;
51546 }
51547
51548 jboolean  __attribute__((export_name("TS_InitFeatures_requires_payment_secret"))) TS_InitFeatures_requires_payment_secret(uint64_t this_arg) {
51549         LDKInitFeatures this_arg_conv;
51550         this_arg_conv.inner = untag_ptr(this_arg);
51551         this_arg_conv.is_owned = ptr_is_owned(this_arg);
51552         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
51553         this_arg_conv.is_owned = false;
51554         jboolean ret_conv = InitFeatures_requires_payment_secret(&this_arg_conv);
51555         return ret_conv;
51556 }
51557
51558 jboolean  __attribute__((export_name("TS_NodeFeatures_requires_payment_secret"))) TS_NodeFeatures_requires_payment_secret(uint64_t this_arg) {
51559         LDKNodeFeatures this_arg_conv;
51560         this_arg_conv.inner = untag_ptr(this_arg);
51561         this_arg_conv.is_owned = ptr_is_owned(this_arg);
51562         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
51563         this_arg_conv.is_owned = false;
51564         jboolean ret_conv = NodeFeatures_requires_payment_secret(&this_arg_conv);
51565         return ret_conv;
51566 }
51567
51568 jboolean  __attribute__((export_name("TS_Bolt11InvoiceFeatures_requires_payment_secret"))) TS_Bolt11InvoiceFeatures_requires_payment_secret(uint64_t this_arg) {
51569         LDKBolt11InvoiceFeatures this_arg_conv;
51570         this_arg_conv.inner = untag_ptr(this_arg);
51571         this_arg_conv.is_owned = ptr_is_owned(this_arg);
51572         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
51573         this_arg_conv.is_owned = false;
51574         jboolean ret_conv = Bolt11InvoiceFeatures_requires_payment_secret(&this_arg_conv);
51575         return ret_conv;
51576 }
51577
51578 void  __attribute__((export_name("TS_InitFeatures_set_basic_mpp_optional"))) TS_InitFeatures_set_basic_mpp_optional(uint64_t this_arg) {
51579         LDKInitFeatures this_arg_conv;
51580         this_arg_conv.inner = untag_ptr(this_arg);
51581         this_arg_conv.is_owned = ptr_is_owned(this_arg);
51582         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
51583         this_arg_conv.is_owned = false;
51584         InitFeatures_set_basic_mpp_optional(&this_arg_conv);
51585 }
51586
51587 void  __attribute__((export_name("TS_InitFeatures_set_basic_mpp_required"))) TS_InitFeatures_set_basic_mpp_required(uint64_t this_arg) {
51588         LDKInitFeatures this_arg_conv;
51589         this_arg_conv.inner = untag_ptr(this_arg);
51590         this_arg_conv.is_owned = ptr_is_owned(this_arg);
51591         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
51592         this_arg_conv.is_owned = false;
51593         InitFeatures_set_basic_mpp_required(&this_arg_conv);
51594 }
51595
51596 jboolean  __attribute__((export_name("TS_InitFeatures_supports_basic_mpp"))) TS_InitFeatures_supports_basic_mpp(uint64_t this_arg) {
51597         LDKInitFeatures this_arg_conv;
51598         this_arg_conv.inner = untag_ptr(this_arg);
51599         this_arg_conv.is_owned = ptr_is_owned(this_arg);
51600         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
51601         this_arg_conv.is_owned = false;
51602         jboolean ret_conv = InitFeatures_supports_basic_mpp(&this_arg_conv);
51603         return ret_conv;
51604 }
51605
51606 void  __attribute__((export_name("TS_NodeFeatures_set_basic_mpp_optional"))) TS_NodeFeatures_set_basic_mpp_optional(uint64_t this_arg) {
51607         LDKNodeFeatures this_arg_conv;
51608         this_arg_conv.inner = untag_ptr(this_arg);
51609         this_arg_conv.is_owned = ptr_is_owned(this_arg);
51610         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
51611         this_arg_conv.is_owned = false;
51612         NodeFeatures_set_basic_mpp_optional(&this_arg_conv);
51613 }
51614
51615 void  __attribute__((export_name("TS_NodeFeatures_set_basic_mpp_required"))) TS_NodeFeatures_set_basic_mpp_required(uint64_t this_arg) {
51616         LDKNodeFeatures this_arg_conv;
51617         this_arg_conv.inner = untag_ptr(this_arg);
51618         this_arg_conv.is_owned = ptr_is_owned(this_arg);
51619         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
51620         this_arg_conv.is_owned = false;
51621         NodeFeatures_set_basic_mpp_required(&this_arg_conv);
51622 }
51623
51624 jboolean  __attribute__((export_name("TS_NodeFeatures_supports_basic_mpp"))) TS_NodeFeatures_supports_basic_mpp(uint64_t this_arg) {
51625         LDKNodeFeatures this_arg_conv;
51626         this_arg_conv.inner = untag_ptr(this_arg);
51627         this_arg_conv.is_owned = ptr_is_owned(this_arg);
51628         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
51629         this_arg_conv.is_owned = false;
51630         jboolean ret_conv = NodeFeatures_supports_basic_mpp(&this_arg_conv);
51631         return ret_conv;
51632 }
51633
51634 void  __attribute__((export_name("TS_Bolt11InvoiceFeatures_set_basic_mpp_optional"))) TS_Bolt11InvoiceFeatures_set_basic_mpp_optional(uint64_t this_arg) {
51635         LDKBolt11InvoiceFeatures this_arg_conv;
51636         this_arg_conv.inner = untag_ptr(this_arg);
51637         this_arg_conv.is_owned = ptr_is_owned(this_arg);
51638         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
51639         this_arg_conv.is_owned = false;
51640         Bolt11InvoiceFeatures_set_basic_mpp_optional(&this_arg_conv);
51641 }
51642
51643 void  __attribute__((export_name("TS_Bolt11InvoiceFeatures_set_basic_mpp_required"))) TS_Bolt11InvoiceFeatures_set_basic_mpp_required(uint64_t this_arg) {
51644         LDKBolt11InvoiceFeatures this_arg_conv;
51645         this_arg_conv.inner = untag_ptr(this_arg);
51646         this_arg_conv.is_owned = ptr_is_owned(this_arg);
51647         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
51648         this_arg_conv.is_owned = false;
51649         Bolt11InvoiceFeatures_set_basic_mpp_required(&this_arg_conv);
51650 }
51651
51652 jboolean  __attribute__((export_name("TS_Bolt11InvoiceFeatures_supports_basic_mpp"))) TS_Bolt11InvoiceFeatures_supports_basic_mpp(uint64_t this_arg) {
51653         LDKBolt11InvoiceFeatures this_arg_conv;
51654         this_arg_conv.inner = untag_ptr(this_arg);
51655         this_arg_conv.is_owned = ptr_is_owned(this_arg);
51656         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
51657         this_arg_conv.is_owned = false;
51658         jboolean ret_conv = Bolt11InvoiceFeatures_supports_basic_mpp(&this_arg_conv);
51659         return ret_conv;
51660 }
51661
51662 void  __attribute__((export_name("TS_Bolt12InvoiceFeatures_set_basic_mpp_optional"))) TS_Bolt12InvoiceFeatures_set_basic_mpp_optional(uint64_t this_arg) {
51663         LDKBolt12InvoiceFeatures this_arg_conv;
51664         this_arg_conv.inner = untag_ptr(this_arg);
51665         this_arg_conv.is_owned = ptr_is_owned(this_arg);
51666         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
51667         this_arg_conv.is_owned = false;
51668         Bolt12InvoiceFeatures_set_basic_mpp_optional(&this_arg_conv);
51669 }
51670
51671 void  __attribute__((export_name("TS_Bolt12InvoiceFeatures_set_basic_mpp_required"))) TS_Bolt12InvoiceFeatures_set_basic_mpp_required(uint64_t this_arg) {
51672         LDKBolt12InvoiceFeatures this_arg_conv;
51673         this_arg_conv.inner = untag_ptr(this_arg);
51674         this_arg_conv.is_owned = ptr_is_owned(this_arg);
51675         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
51676         this_arg_conv.is_owned = false;
51677         Bolt12InvoiceFeatures_set_basic_mpp_required(&this_arg_conv);
51678 }
51679
51680 jboolean  __attribute__((export_name("TS_Bolt12InvoiceFeatures_supports_basic_mpp"))) TS_Bolt12InvoiceFeatures_supports_basic_mpp(uint64_t this_arg) {
51681         LDKBolt12InvoiceFeatures this_arg_conv;
51682         this_arg_conv.inner = untag_ptr(this_arg);
51683         this_arg_conv.is_owned = ptr_is_owned(this_arg);
51684         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
51685         this_arg_conv.is_owned = false;
51686         jboolean ret_conv = Bolt12InvoiceFeatures_supports_basic_mpp(&this_arg_conv);
51687         return ret_conv;
51688 }
51689
51690 jboolean  __attribute__((export_name("TS_InitFeatures_requires_basic_mpp"))) TS_InitFeatures_requires_basic_mpp(uint64_t this_arg) {
51691         LDKInitFeatures this_arg_conv;
51692         this_arg_conv.inner = untag_ptr(this_arg);
51693         this_arg_conv.is_owned = ptr_is_owned(this_arg);
51694         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
51695         this_arg_conv.is_owned = false;
51696         jboolean ret_conv = InitFeatures_requires_basic_mpp(&this_arg_conv);
51697         return ret_conv;
51698 }
51699
51700 jboolean  __attribute__((export_name("TS_NodeFeatures_requires_basic_mpp"))) TS_NodeFeatures_requires_basic_mpp(uint64_t this_arg) {
51701         LDKNodeFeatures this_arg_conv;
51702         this_arg_conv.inner = untag_ptr(this_arg);
51703         this_arg_conv.is_owned = ptr_is_owned(this_arg);
51704         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
51705         this_arg_conv.is_owned = false;
51706         jboolean ret_conv = NodeFeatures_requires_basic_mpp(&this_arg_conv);
51707         return ret_conv;
51708 }
51709
51710 jboolean  __attribute__((export_name("TS_Bolt11InvoiceFeatures_requires_basic_mpp"))) TS_Bolt11InvoiceFeatures_requires_basic_mpp(uint64_t this_arg) {
51711         LDKBolt11InvoiceFeatures this_arg_conv;
51712         this_arg_conv.inner = untag_ptr(this_arg);
51713         this_arg_conv.is_owned = ptr_is_owned(this_arg);
51714         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
51715         this_arg_conv.is_owned = false;
51716         jboolean ret_conv = Bolt11InvoiceFeatures_requires_basic_mpp(&this_arg_conv);
51717         return ret_conv;
51718 }
51719
51720 jboolean  __attribute__((export_name("TS_Bolt12InvoiceFeatures_requires_basic_mpp"))) TS_Bolt12InvoiceFeatures_requires_basic_mpp(uint64_t this_arg) {
51721         LDKBolt12InvoiceFeatures this_arg_conv;
51722         this_arg_conv.inner = untag_ptr(this_arg);
51723         this_arg_conv.is_owned = ptr_is_owned(this_arg);
51724         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
51725         this_arg_conv.is_owned = false;
51726         jboolean ret_conv = Bolt12InvoiceFeatures_requires_basic_mpp(&this_arg_conv);
51727         return ret_conv;
51728 }
51729
51730 void  __attribute__((export_name("TS_InitFeatures_set_wumbo_optional"))) TS_InitFeatures_set_wumbo_optional(uint64_t this_arg) {
51731         LDKInitFeatures this_arg_conv;
51732         this_arg_conv.inner = untag_ptr(this_arg);
51733         this_arg_conv.is_owned = ptr_is_owned(this_arg);
51734         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
51735         this_arg_conv.is_owned = false;
51736         InitFeatures_set_wumbo_optional(&this_arg_conv);
51737 }
51738
51739 void  __attribute__((export_name("TS_InitFeatures_set_wumbo_required"))) TS_InitFeatures_set_wumbo_required(uint64_t this_arg) {
51740         LDKInitFeatures this_arg_conv;
51741         this_arg_conv.inner = untag_ptr(this_arg);
51742         this_arg_conv.is_owned = ptr_is_owned(this_arg);
51743         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
51744         this_arg_conv.is_owned = false;
51745         InitFeatures_set_wumbo_required(&this_arg_conv);
51746 }
51747
51748 jboolean  __attribute__((export_name("TS_InitFeatures_supports_wumbo"))) TS_InitFeatures_supports_wumbo(uint64_t this_arg) {
51749         LDKInitFeatures this_arg_conv;
51750         this_arg_conv.inner = untag_ptr(this_arg);
51751         this_arg_conv.is_owned = ptr_is_owned(this_arg);
51752         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
51753         this_arg_conv.is_owned = false;
51754         jboolean ret_conv = InitFeatures_supports_wumbo(&this_arg_conv);
51755         return ret_conv;
51756 }
51757
51758 void  __attribute__((export_name("TS_NodeFeatures_set_wumbo_optional"))) TS_NodeFeatures_set_wumbo_optional(uint64_t this_arg) {
51759         LDKNodeFeatures this_arg_conv;
51760         this_arg_conv.inner = untag_ptr(this_arg);
51761         this_arg_conv.is_owned = ptr_is_owned(this_arg);
51762         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
51763         this_arg_conv.is_owned = false;
51764         NodeFeatures_set_wumbo_optional(&this_arg_conv);
51765 }
51766
51767 void  __attribute__((export_name("TS_NodeFeatures_set_wumbo_required"))) TS_NodeFeatures_set_wumbo_required(uint64_t this_arg) {
51768         LDKNodeFeatures this_arg_conv;
51769         this_arg_conv.inner = untag_ptr(this_arg);
51770         this_arg_conv.is_owned = ptr_is_owned(this_arg);
51771         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
51772         this_arg_conv.is_owned = false;
51773         NodeFeatures_set_wumbo_required(&this_arg_conv);
51774 }
51775
51776 jboolean  __attribute__((export_name("TS_NodeFeatures_supports_wumbo"))) TS_NodeFeatures_supports_wumbo(uint64_t this_arg) {
51777         LDKNodeFeatures this_arg_conv;
51778         this_arg_conv.inner = untag_ptr(this_arg);
51779         this_arg_conv.is_owned = ptr_is_owned(this_arg);
51780         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
51781         this_arg_conv.is_owned = false;
51782         jboolean ret_conv = NodeFeatures_supports_wumbo(&this_arg_conv);
51783         return ret_conv;
51784 }
51785
51786 jboolean  __attribute__((export_name("TS_InitFeatures_requires_wumbo"))) TS_InitFeatures_requires_wumbo(uint64_t this_arg) {
51787         LDKInitFeatures this_arg_conv;
51788         this_arg_conv.inner = untag_ptr(this_arg);
51789         this_arg_conv.is_owned = ptr_is_owned(this_arg);
51790         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
51791         this_arg_conv.is_owned = false;
51792         jboolean ret_conv = InitFeatures_requires_wumbo(&this_arg_conv);
51793         return ret_conv;
51794 }
51795
51796 jboolean  __attribute__((export_name("TS_NodeFeatures_requires_wumbo"))) TS_NodeFeatures_requires_wumbo(uint64_t this_arg) {
51797         LDKNodeFeatures this_arg_conv;
51798         this_arg_conv.inner = untag_ptr(this_arg);
51799         this_arg_conv.is_owned = ptr_is_owned(this_arg);
51800         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
51801         this_arg_conv.is_owned = false;
51802         jboolean ret_conv = NodeFeatures_requires_wumbo(&this_arg_conv);
51803         return ret_conv;
51804 }
51805
51806 void  __attribute__((export_name("TS_InitFeatures_set_anchors_nonzero_fee_htlc_tx_optional"))) TS_InitFeatures_set_anchors_nonzero_fee_htlc_tx_optional(uint64_t this_arg) {
51807         LDKInitFeatures this_arg_conv;
51808         this_arg_conv.inner = untag_ptr(this_arg);
51809         this_arg_conv.is_owned = ptr_is_owned(this_arg);
51810         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
51811         this_arg_conv.is_owned = false;
51812         InitFeatures_set_anchors_nonzero_fee_htlc_tx_optional(&this_arg_conv);
51813 }
51814
51815 void  __attribute__((export_name("TS_InitFeatures_set_anchors_nonzero_fee_htlc_tx_required"))) TS_InitFeatures_set_anchors_nonzero_fee_htlc_tx_required(uint64_t this_arg) {
51816         LDKInitFeatures this_arg_conv;
51817         this_arg_conv.inner = untag_ptr(this_arg);
51818         this_arg_conv.is_owned = ptr_is_owned(this_arg);
51819         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
51820         this_arg_conv.is_owned = false;
51821         InitFeatures_set_anchors_nonzero_fee_htlc_tx_required(&this_arg_conv);
51822 }
51823
51824 jboolean  __attribute__((export_name("TS_InitFeatures_supports_anchors_nonzero_fee_htlc_tx"))) TS_InitFeatures_supports_anchors_nonzero_fee_htlc_tx(uint64_t this_arg) {
51825         LDKInitFeatures this_arg_conv;
51826         this_arg_conv.inner = untag_ptr(this_arg);
51827         this_arg_conv.is_owned = ptr_is_owned(this_arg);
51828         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
51829         this_arg_conv.is_owned = false;
51830         jboolean ret_conv = InitFeatures_supports_anchors_nonzero_fee_htlc_tx(&this_arg_conv);
51831         return ret_conv;
51832 }
51833
51834 void  __attribute__((export_name("TS_NodeFeatures_set_anchors_nonzero_fee_htlc_tx_optional"))) TS_NodeFeatures_set_anchors_nonzero_fee_htlc_tx_optional(uint64_t this_arg) {
51835         LDKNodeFeatures this_arg_conv;
51836         this_arg_conv.inner = untag_ptr(this_arg);
51837         this_arg_conv.is_owned = ptr_is_owned(this_arg);
51838         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
51839         this_arg_conv.is_owned = false;
51840         NodeFeatures_set_anchors_nonzero_fee_htlc_tx_optional(&this_arg_conv);
51841 }
51842
51843 void  __attribute__((export_name("TS_NodeFeatures_set_anchors_nonzero_fee_htlc_tx_required"))) TS_NodeFeatures_set_anchors_nonzero_fee_htlc_tx_required(uint64_t this_arg) {
51844         LDKNodeFeatures this_arg_conv;
51845         this_arg_conv.inner = untag_ptr(this_arg);
51846         this_arg_conv.is_owned = ptr_is_owned(this_arg);
51847         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
51848         this_arg_conv.is_owned = false;
51849         NodeFeatures_set_anchors_nonzero_fee_htlc_tx_required(&this_arg_conv);
51850 }
51851
51852 jboolean  __attribute__((export_name("TS_NodeFeatures_supports_anchors_nonzero_fee_htlc_tx"))) TS_NodeFeatures_supports_anchors_nonzero_fee_htlc_tx(uint64_t this_arg) {
51853         LDKNodeFeatures this_arg_conv;
51854         this_arg_conv.inner = untag_ptr(this_arg);
51855         this_arg_conv.is_owned = ptr_is_owned(this_arg);
51856         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
51857         this_arg_conv.is_owned = false;
51858         jboolean ret_conv = NodeFeatures_supports_anchors_nonzero_fee_htlc_tx(&this_arg_conv);
51859         return ret_conv;
51860 }
51861
51862 void  __attribute__((export_name("TS_ChannelTypeFeatures_set_anchors_nonzero_fee_htlc_tx_optional"))) TS_ChannelTypeFeatures_set_anchors_nonzero_fee_htlc_tx_optional(uint64_t this_arg) {
51863         LDKChannelTypeFeatures this_arg_conv;
51864         this_arg_conv.inner = untag_ptr(this_arg);
51865         this_arg_conv.is_owned = ptr_is_owned(this_arg);
51866         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
51867         this_arg_conv.is_owned = false;
51868         ChannelTypeFeatures_set_anchors_nonzero_fee_htlc_tx_optional(&this_arg_conv);
51869 }
51870
51871 void  __attribute__((export_name("TS_ChannelTypeFeatures_set_anchors_nonzero_fee_htlc_tx_required"))) TS_ChannelTypeFeatures_set_anchors_nonzero_fee_htlc_tx_required(uint64_t this_arg) {
51872         LDKChannelTypeFeatures this_arg_conv;
51873         this_arg_conv.inner = untag_ptr(this_arg);
51874         this_arg_conv.is_owned = ptr_is_owned(this_arg);
51875         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
51876         this_arg_conv.is_owned = false;
51877         ChannelTypeFeatures_set_anchors_nonzero_fee_htlc_tx_required(&this_arg_conv);
51878 }
51879
51880 jboolean  __attribute__((export_name("TS_ChannelTypeFeatures_supports_anchors_nonzero_fee_htlc_tx"))) TS_ChannelTypeFeatures_supports_anchors_nonzero_fee_htlc_tx(uint64_t this_arg) {
51881         LDKChannelTypeFeatures this_arg_conv;
51882         this_arg_conv.inner = untag_ptr(this_arg);
51883         this_arg_conv.is_owned = ptr_is_owned(this_arg);
51884         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
51885         this_arg_conv.is_owned = false;
51886         jboolean ret_conv = ChannelTypeFeatures_supports_anchors_nonzero_fee_htlc_tx(&this_arg_conv);
51887         return ret_conv;
51888 }
51889
51890 jboolean  __attribute__((export_name("TS_InitFeatures_requires_anchors_nonzero_fee_htlc_tx"))) TS_InitFeatures_requires_anchors_nonzero_fee_htlc_tx(uint64_t this_arg) {
51891         LDKInitFeatures this_arg_conv;
51892         this_arg_conv.inner = untag_ptr(this_arg);
51893         this_arg_conv.is_owned = ptr_is_owned(this_arg);
51894         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
51895         this_arg_conv.is_owned = false;
51896         jboolean ret_conv = InitFeatures_requires_anchors_nonzero_fee_htlc_tx(&this_arg_conv);
51897         return ret_conv;
51898 }
51899
51900 jboolean  __attribute__((export_name("TS_NodeFeatures_requires_anchors_nonzero_fee_htlc_tx"))) TS_NodeFeatures_requires_anchors_nonzero_fee_htlc_tx(uint64_t this_arg) {
51901         LDKNodeFeatures this_arg_conv;
51902         this_arg_conv.inner = untag_ptr(this_arg);
51903         this_arg_conv.is_owned = ptr_is_owned(this_arg);
51904         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
51905         this_arg_conv.is_owned = false;
51906         jboolean ret_conv = NodeFeatures_requires_anchors_nonzero_fee_htlc_tx(&this_arg_conv);
51907         return ret_conv;
51908 }
51909
51910 jboolean  __attribute__((export_name("TS_ChannelTypeFeatures_requires_anchors_nonzero_fee_htlc_tx"))) TS_ChannelTypeFeatures_requires_anchors_nonzero_fee_htlc_tx(uint64_t this_arg) {
51911         LDKChannelTypeFeatures this_arg_conv;
51912         this_arg_conv.inner = untag_ptr(this_arg);
51913         this_arg_conv.is_owned = ptr_is_owned(this_arg);
51914         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
51915         this_arg_conv.is_owned = false;
51916         jboolean ret_conv = ChannelTypeFeatures_requires_anchors_nonzero_fee_htlc_tx(&this_arg_conv);
51917         return ret_conv;
51918 }
51919
51920 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) {
51921         LDKInitFeatures this_arg_conv;
51922         this_arg_conv.inner = untag_ptr(this_arg);
51923         this_arg_conv.is_owned = ptr_is_owned(this_arg);
51924         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
51925         this_arg_conv.is_owned = false;
51926         InitFeatures_set_anchors_zero_fee_htlc_tx_optional(&this_arg_conv);
51927 }
51928
51929 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) {
51930         LDKInitFeatures this_arg_conv;
51931         this_arg_conv.inner = untag_ptr(this_arg);
51932         this_arg_conv.is_owned = ptr_is_owned(this_arg);
51933         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
51934         this_arg_conv.is_owned = false;
51935         InitFeatures_set_anchors_zero_fee_htlc_tx_required(&this_arg_conv);
51936 }
51937
51938 jboolean  __attribute__((export_name("TS_InitFeatures_supports_anchors_zero_fee_htlc_tx"))) TS_InitFeatures_supports_anchors_zero_fee_htlc_tx(uint64_t this_arg) {
51939         LDKInitFeatures this_arg_conv;
51940         this_arg_conv.inner = untag_ptr(this_arg);
51941         this_arg_conv.is_owned = ptr_is_owned(this_arg);
51942         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
51943         this_arg_conv.is_owned = false;
51944         jboolean ret_conv = InitFeatures_supports_anchors_zero_fee_htlc_tx(&this_arg_conv);
51945         return ret_conv;
51946 }
51947
51948 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) {
51949         LDKNodeFeatures this_arg_conv;
51950         this_arg_conv.inner = untag_ptr(this_arg);
51951         this_arg_conv.is_owned = ptr_is_owned(this_arg);
51952         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
51953         this_arg_conv.is_owned = false;
51954         NodeFeatures_set_anchors_zero_fee_htlc_tx_optional(&this_arg_conv);
51955 }
51956
51957 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) {
51958         LDKNodeFeatures this_arg_conv;
51959         this_arg_conv.inner = untag_ptr(this_arg);
51960         this_arg_conv.is_owned = ptr_is_owned(this_arg);
51961         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
51962         this_arg_conv.is_owned = false;
51963         NodeFeatures_set_anchors_zero_fee_htlc_tx_required(&this_arg_conv);
51964 }
51965
51966 jboolean  __attribute__((export_name("TS_NodeFeatures_supports_anchors_zero_fee_htlc_tx"))) TS_NodeFeatures_supports_anchors_zero_fee_htlc_tx(uint64_t this_arg) {
51967         LDKNodeFeatures this_arg_conv;
51968         this_arg_conv.inner = untag_ptr(this_arg);
51969         this_arg_conv.is_owned = ptr_is_owned(this_arg);
51970         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
51971         this_arg_conv.is_owned = false;
51972         jboolean ret_conv = NodeFeatures_supports_anchors_zero_fee_htlc_tx(&this_arg_conv);
51973         return ret_conv;
51974 }
51975
51976 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) {
51977         LDKChannelTypeFeatures this_arg_conv;
51978         this_arg_conv.inner = untag_ptr(this_arg);
51979         this_arg_conv.is_owned = ptr_is_owned(this_arg);
51980         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
51981         this_arg_conv.is_owned = false;
51982         ChannelTypeFeatures_set_anchors_zero_fee_htlc_tx_optional(&this_arg_conv);
51983 }
51984
51985 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) {
51986         LDKChannelTypeFeatures this_arg_conv;
51987         this_arg_conv.inner = untag_ptr(this_arg);
51988         this_arg_conv.is_owned = ptr_is_owned(this_arg);
51989         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
51990         this_arg_conv.is_owned = false;
51991         ChannelTypeFeatures_set_anchors_zero_fee_htlc_tx_required(&this_arg_conv);
51992 }
51993
51994 jboolean  __attribute__((export_name("TS_ChannelTypeFeatures_supports_anchors_zero_fee_htlc_tx"))) TS_ChannelTypeFeatures_supports_anchors_zero_fee_htlc_tx(uint64_t this_arg) {
51995         LDKChannelTypeFeatures this_arg_conv;
51996         this_arg_conv.inner = untag_ptr(this_arg);
51997         this_arg_conv.is_owned = ptr_is_owned(this_arg);
51998         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
51999         this_arg_conv.is_owned = false;
52000         jboolean ret_conv = ChannelTypeFeatures_supports_anchors_zero_fee_htlc_tx(&this_arg_conv);
52001         return ret_conv;
52002 }
52003
52004 jboolean  __attribute__((export_name("TS_InitFeatures_requires_anchors_zero_fee_htlc_tx"))) TS_InitFeatures_requires_anchors_zero_fee_htlc_tx(uint64_t this_arg) {
52005         LDKInitFeatures this_arg_conv;
52006         this_arg_conv.inner = untag_ptr(this_arg);
52007         this_arg_conv.is_owned = ptr_is_owned(this_arg);
52008         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
52009         this_arg_conv.is_owned = false;
52010         jboolean ret_conv = InitFeatures_requires_anchors_zero_fee_htlc_tx(&this_arg_conv);
52011         return ret_conv;
52012 }
52013
52014 jboolean  __attribute__((export_name("TS_NodeFeatures_requires_anchors_zero_fee_htlc_tx"))) TS_NodeFeatures_requires_anchors_zero_fee_htlc_tx(uint64_t this_arg) {
52015         LDKNodeFeatures this_arg_conv;
52016         this_arg_conv.inner = untag_ptr(this_arg);
52017         this_arg_conv.is_owned = ptr_is_owned(this_arg);
52018         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
52019         this_arg_conv.is_owned = false;
52020         jboolean ret_conv = NodeFeatures_requires_anchors_zero_fee_htlc_tx(&this_arg_conv);
52021         return ret_conv;
52022 }
52023
52024 jboolean  __attribute__((export_name("TS_ChannelTypeFeatures_requires_anchors_zero_fee_htlc_tx"))) TS_ChannelTypeFeatures_requires_anchors_zero_fee_htlc_tx(uint64_t this_arg) {
52025         LDKChannelTypeFeatures this_arg_conv;
52026         this_arg_conv.inner = untag_ptr(this_arg);
52027         this_arg_conv.is_owned = ptr_is_owned(this_arg);
52028         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
52029         this_arg_conv.is_owned = false;
52030         jboolean ret_conv = ChannelTypeFeatures_requires_anchors_zero_fee_htlc_tx(&this_arg_conv);
52031         return ret_conv;
52032 }
52033
52034 void  __attribute__((export_name("TS_InitFeatures_set_shutdown_any_segwit_optional"))) TS_InitFeatures_set_shutdown_any_segwit_optional(uint64_t this_arg) {
52035         LDKInitFeatures this_arg_conv;
52036         this_arg_conv.inner = untag_ptr(this_arg);
52037         this_arg_conv.is_owned = ptr_is_owned(this_arg);
52038         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
52039         this_arg_conv.is_owned = false;
52040         InitFeatures_set_shutdown_any_segwit_optional(&this_arg_conv);
52041 }
52042
52043 void  __attribute__((export_name("TS_InitFeatures_set_shutdown_any_segwit_required"))) TS_InitFeatures_set_shutdown_any_segwit_required(uint64_t this_arg) {
52044         LDKInitFeatures this_arg_conv;
52045         this_arg_conv.inner = untag_ptr(this_arg);
52046         this_arg_conv.is_owned = ptr_is_owned(this_arg);
52047         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
52048         this_arg_conv.is_owned = false;
52049         InitFeatures_set_shutdown_any_segwit_required(&this_arg_conv);
52050 }
52051
52052 jboolean  __attribute__((export_name("TS_InitFeatures_supports_shutdown_anysegwit"))) TS_InitFeatures_supports_shutdown_anysegwit(uint64_t this_arg) {
52053         LDKInitFeatures this_arg_conv;
52054         this_arg_conv.inner = untag_ptr(this_arg);
52055         this_arg_conv.is_owned = ptr_is_owned(this_arg);
52056         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
52057         this_arg_conv.is_owned = false;
52058         jboolean ret_conv = InitFeatures_supports_shutdown_anysegwit(&this_arg_conv);
52059         return ret_conv;
52060 }
52061
52062 void  __attribute__((export_name("TS_NodeFeatures_set_shutdown_any_segwit_optional"))) TS_NodeFeatures_set_shutdown_any_segwit_optional(uint64_t this_arg) {
52063         LDKNodeFeatures this_arg_conv;
52064         this_arg_conv.inner = untag_ptr(this_arg);
52065         this_arg_conv.is_owned = ptr_is_owned(this_arg);
52066         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
52067         this_arg_conv.is_owned = false;
52068         NodeFeatures_set_shutdown_any_segwit_optional(&this_arg_conv);
52069 }
52070
52071 void  __attribute__((export_name("TS_NodeFeatures_set_shutdown_any_segwit_required"))) TS_NodeFeatures_set_shutdown_any_segwit_required(uint64_t this_arg) {
52072         LDKNodeFeatures this_arg_conv;
52073         this_arg_conv.inner = untag_ptr(this_arg);
52074         this_arg_conv.is_owned = ptr_is_owned(this_arg);
52075         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
52076         this_arg_conv.is_owned = false;
52077         NodeFeatures_set_shutdown_any_segwit_required(&this_arg_conv);
52078 }
52079
52080 jboolean  __attribute__((export_name("TS_NodeFeatures_supports_shutdown_anysegwit"))) TS_NodeFeatures_supports_shutdown_anysegwit(uint64_t this_arg) {
52081         LDKNodeFeatures this_arg_conv;
52082         this_arg_conv.inner = untag_ptr(this_arg);
52083         this_arg_conv.is_owned = ptr_is_owned(this_arg);
52084         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
52085         this_arg_conv.is_owned = false;
52086         jboolean ret_conv = NodeFeatures_supports_shutdown_anysegwit(&this_arg_conv);
52087         return ret_conv;
52088 }
52089
52090 jboolean  __attribute__((export_name("TS_InitFeatures_requires_shutdown_anysegwit"))) TS_InitFeatures_requires_shutdown_anysegwit(uint64_t this_arg) {
52091         LDKInitFeatures this_arg_conv;
52092         this_arg_conv.inner = untag_ptr(this_arg);
52093         this_arg_conv.is_owned = ptr_is_owned(this_arg);
52094         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
52095         this_arg_conv.is_owned = false;
52096         jboolean ret_conv = InitFeatures_requires_shutdown_anysegwit(&this_arg_conv);
52097         return ret_conv;
52098 }
52099
52100 jboolean  __attribute__((export_name("TS_NodeFeatures_requires_shutdown_anysegwit"))) TS_NodeFeatures_requires_shutdown_anysegwit(uint64_t this_arg) {
52101         LDKNodeFeatures this_arg_conv;
52102         this_arg_conv.inner = untag_ptr(this_arg);
52103         this_arg_conv.is_owned = ptr_is_owned(this_arg);
52104         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
52105         this_arg_conv.is_owned = false;
52106         jboolean ret_conv = NodeFeatures_requires_shutdown_anysegwit(&this_arg_conv);
52107         return ret_conv;
52108 }
52109
52110 void  __attribute__((export_name("TS_InitFeatures_set_taproot_optional"))) TS_InitFeatures_set_taproot_optional(uint64_t this_arg) {
52111         LDKInitFeatures this_arg_conv;
52112         this_arg_conv.inner = untag_ptr(this_arg);
52113         this_arg_conv.is_owned = ptr_is_owned(this_arg);
52114         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
52115         this_arg_conv.is_owned = false;
52116         InitFeatures_set_taproot_optional(&this_arg_conv);
52117 }
52118
52119 void  __attribute__((export_name("TS_InitFeatures_set_taproot_required"))) TS_InitFeatures_set_taproot_required(uint64_t this_arg) {
52120         LDKInitFeatures this_arg_conv;
52121         this_arg_conv.inner = untag_ptr(this_arg);
52122         this_arg_conv.is_owned = ptr_is_owned(this_arg);
52123         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
52124         this_arg_conv.is_owned = false;
52125         InitFeatures_set_taproot_required(&this_arg_conv);
52126 }
52127
52128 jboolean  __attribute__((export_name("TS_InitFeatures_supports_taproot"))) TS_InitFeatures_supports_taproot(uint64_t this_arg) {
52129         LDKInitFeatures this_arg_conv;
52130         this_arg_conv.inner = untag_ptr(this_arg);
52131         this_arg_conv.is_owned = ptr_is_owned(this_arg);
52132         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
52133         this_arg_conv.is_owned = false;
52134         jboolean ret_conv = InitFeatures_supports_taproot(&this_arg_conv);
52135         return ret_conv;
52136 }
52137
52138 void  __attribute__((export_name("TS_NodeFeatures_set_taproot_optional"))) TS_NodeFeatures_set_taproot_optional(uint64_t this_arg) {
52139         LDKNodeFeatures this_arg_conv;
52140         this_arg_conv.inner = untag_ptr(this_arg);
52141         this_arg_conv.is_owned = ptr_is_owned(this_arg);
52142         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
52143         this_arg_conv.is_owned = false;
52144         NodeFeatures_set_taproot_optional(&this_arg_conv);
52145 }
52146
52147 void  __attribute__((export_name("TS_NodeFeatures_set_taproot_required"))) TS_NodeFeatures_set_taproot_required(uint64_t this_arg) {
52148         LDKNodeFeatures this_arg_conv;
52149         this_arg_conv.inner = untag_ptr(this_arg);
52150         this_arg_conv.is_owned = ptr_is_owned(this_arg);
52151         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
52152         this_arg_conv.is_owned = false;
52153         NodeFeatures_set_taproot_required(&this_arg_conv);
52154 }
52155
52156 jboolean  __attribute__((export_name("TS_NodeFeatures_supports_taproot"))) TS_NodeFeatures_supports_taproot(uint64_t this_arg) {
52157         LDKNodeFeatures this_arg_conv;
52158         this_arg_conv.inner = untag_ptr(this_arg);
52159         this_arg_conv.is_owned = ptr_is_owned(this_arg);
52160         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
52161         this_arg_conv.is_owned = false;
52162         jboolean ret_conv = NodeFeatures_supports_taproot(&this_arg_conv);
52163         return ret_conv;
52164 }
52165
52166 void  __attribute__((export_name("TS_ChannelTypeFeatures_set_taproot_optional"))) TS_ChannelTypeFeatures_set_taproot_optional(uint64_t this_arg) {
52167         LDKChannelTypeFeatures this_arg_conv;
52168         this_arg_conv.inner = untag_ptr(this_arg);
52169         this_arg_conv.is_owned = ptr_is_owned(this_arg);
52170         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
52171         this_arg_conv.is_owned = false;
52172         ChannelTypeFeatures_set_taproot_optional(&this_arg_conv);
52173 }
52174
52175 void  __attribute__((export_name("TS_ChannelTypeFeatures_set_taproot_required"))) TS_ChannelTypeFeatures_set_taproot_required(uint64_t this_arg) {
52176         LDKChannelTypeFeatures this_arg_conv;
52177         this_arg_conv.inner = untag_ptr(this_arg);
52178         this_arg_conv.is_owned = ptr_is_owned(this_arg);
52179         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
52180         this_arg_conv.is_owned = false;
52181         ChannelTypeFeatures_set_taproot_required(&this_arg_conv);
52182 }
52183
52184 jboolean  __attribute__((export_name("TS_ChannelTypeFeatures_supports_taproot"))) TS_ChannelTypeFeatures_supports_taproot(uint64_t this_arg) {
52185         LDKChannelTypeFeatures this_arg_conv;
52186         this_arg_conv.inner = untag_ptr(this_arg);
52187         this_arg_conv.is_owned = ptr_is_owned(this_arg);
52188         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
52189         this_arg_conv.is_owned = false;
52190         jboolean ret_conv = ChannelTypeFeatures_supports_taproot(&this_arg_conv);
52191         return ret_conv;
52192 }
52193
52194 jboolean  __attribute__((export_name("TS_InitFeatures_requires_taproot"))) TS_InitFeatures_requires_taproot(uint64_t this_arg) {
52195         LDKInitFeatures this_arg_conv;
52196         this_arg_conv.inner = untag_ptr(this_arg);
52197         this_arg_conv.is_owned = ptr_is_owned(this_arg);
52198         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
52199         this_arg_conv.is_owned = false;
52200         jboolean ret_conv = InitFeatures_requires_taproot(&this_arg_conv);
52201         return ret_conv;
52202 }
52203
52204 jboolean  __attribute__((export_name("TS_NodeFeatures_requires_taproot"))) TS_NodeFeatures_requires_taproot(uint64_t this_arg) {
52205         LDKNodeFeatures this_arg_conv;
52206         this_arg_conv.inner = untag_ptr(this_arg);
52207         this_arg_conv.is_owned = ptr_is_owned(this_arg);
52208         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
52209         this_arg_conv.is_owned = false;
52210         jboolean ret_conv = NodeFeatures_requires_taproot(&this_arg_conv);
52211         return ret_conv;
52212 }
52213
52214 jboolean  __attribute__((export_name("TS_ChannelTypeFeatures_requires_taproot"))) TS_ChannelTypeFeatures_requires_taproot(uint64_t this_arg) {
52215         LDKChannelTypeFeatures this_arg_conv;
52216         this_arg_conv.inner = untag_ptr(this_arg);
52217         this_arg_conv.is_owned = ptr_is_owned(this_arg);
52218         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
52219         this_arg_conv.is_owned = false;
52220         jboolean ret_conv = ChannelTypeFeatures_requires_taproot(&this_arg_conv);
52221         return ret_conv;
52222 }
52223
52224 void  __attribute__((export_name("TS_InitFeatures_set_onion_messages_optional"))) TS_InitFeatures_set_onion_messages_optional(uint64_t this_arg) {
52225         LDKInitFeatures this_arg_conv;
52226         this_arg_conv.inner = untag_ptr(this_arg);
52227         this_arg_conv.is_owned = ptr_is_owned(this_arg);
52228         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
52229         this_arg_conv.is_owned = false;
52230         InitFeatures_set_onion_messages_optional(&this_arg_conv);
52231 }
52232
52233 void  __attribute__((export_name("TS_InitFeatures_set_onion_messages_required"))) TS_InitFeatures_set_onion_messages_required(uint64_t this_arg) {
52234         LDKInitFeatures this_arg_conv;
52235         this_arg_conv.inner = untag_ptr(this_arg);
52236         this_arg_conv.is_owned = ptr_is_owned(this_arg);
52237         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
52238         this_arg_conv.is_owned = false;
52239         InitFeatures_set_onion_messages_required(&this_arg_conv);
52240 }
52241
52242 jboolean  __attribute__((export_name("TS_InitFeatures_supports_onion_messages"))) TS_InitFeatures_supports_onion_messages(uint64_t this_arg) {
52243         LDKInitFeatures this_arg_conv;
52244         this_arg_conv.inner = untag_ptr(this_arg);
52245         this_arg_conv.is_owned = ptr_is_owned(this_arg);
52246         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
52247         this_arg_conv.is_owned = false;
52248         jboolean ret_conv = InitFeatures_supports_onion_messages(&this_arg_conv);
52249         return ret_conv;
52250 }
52251
52252 void  __attribute__((export_name("TS_NodeFeatures_set_onion_messages_optional"))) TS_NodeFeatures_set_onion_messages_optional(uint64_t this_arg) {
52253         LDKNodeFeatures this_arg_conv;
52254         this_arg_conv.inner = untag_ptr(this_arg);
52255         this_arg_conv.is_owned = ptr_is_owned(this_arg);
52256         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
52257         this_arg_conv.is_owned = false;
52258         NodeFeatures_set_onion_messages_optional(&this_arg_conv);
52259 }
52260
52261 void  __attribute__((export_name("TS_NodeFeatures_set_onion_messages_required"))) TS_NodeFeatures_set_onion_messages_required(uint64_t this_arg) {
52262         LDKNodeFeatures this_arg_conv;
52263         this_arg_conv.inner = untag_ptr(this_arg);
52264         this_arg_conv.is_owned = ptr_is_owned(this_arg);
52265         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
52266         this_arg_conv.is_owned = false;
52267         NodeFeatures_set_onion_messages_required(&this_arg_conv);
52268 }
52269
52270 jboolean  __attribute__((export_name("TS_NodeFeatures_supports_onion_messages"))) TS_NodeFeatures_supports_onion_messages(uint64_t this_arg) {
52271         LDKNodeFeatures this_arg_conv;
52272         this_arg_conv.inner = untag_ptr(this_arg);
52273         this_arg_conv.is_owned = ptr_is_owned(this_arg);
52274         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
52275         this_arg_conv.is_owned = false;
52276         jboolean ret_conv = NodeFeatures_supports_onion_messages(&this_arg_conv);
52277         return ret_conv;
52278 }
52279
52280 jboolean  __attribute__((export_name("TS_InitFeatures_requires_onion_messages"))) TS_InitFeatures_requires_onion_messages(uint64_t this_arg) {
52281         LDKInitFeatures this_arg_conv;
52282         this_arg_conv.inner = untag_ptr(this_arg);
52283         this_arg_conv.is_owned = ptr_is_owned(this_arg);
52284         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
52285         this_arg_conv.is_owned = false;
52286         jboolean ret_conv = InitFeatures_requires_onion_messages(&this_arg_conv);
52287         return ret_conv;
52288 }
52289
52290 jboolean  __attribute__((export_name("TS_NodeFeatures_requires_onion_messages"))) TS_NodeFeatures_requires_onion_messages(uint64_t this_arg) {
52291         LDKNodeFeatures this_arg_conv;
52292         this_arg_conv.inner = untag_ptr(this_arg);
52293         this_arg_conv.is_owned = ptr_is_owned(this_arg);
52294         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
52295         this_arg_conv.is_owned = false;
52296         jboolean ret_conv = NodeFeatures_requires_onion_messages(&this_arg_conv);
52297         return ret_conv;
52298 }
52299
52300 void  __attribute__((export_name("TS_InitFeatures_set_channel_type_optional"))) TS_InitFeatures_set_channel_type_optional(uint64_t this_arg) {
52301         LDKInitFeatures this_arg_conv;
52302         this_arg_conv.inner = untag_ptr(this_arg);
52303         this_arg_conv.is_owned = ptr_is_owned(this_arg);
52304         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
52305         this_arg_conv.is_owned = false;
52306         InitFeatures_set_channel_type_optional(&this_arg_conv);
52307 }
52308
52309 void  __attribute__((export_name("TS_InitFeatures_set_channel_type_required"))) TS_InitFeatures_set_channel_type_required(uint64_t this_arg) {
52310         LDKInitFeatures this_arg_conv;
52311         this_arg_conv.inner = untag_ptr(this_arg);
52312         this_arg_conv.is_owned = ptr_is_owned(this_arg);
52313         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
52314         this_arg_conv.is_owned = false;
52315         InitFeatures_set_channel_type_required(&this_arg_conv);
52316 }
52317
52318 jboolean  __attribute__((export_name("TS_InitFeatures_supports_channel_type"))) TS_InitFeatures_supports_channel_type(uint64_t this_arg) {
52319         LDKInitFeatures this_arg_conv;
52320         this_arg_conv.inner = untag_ptr(this_arg);
52321         this_arg_conv.is_owned = ptr_is_owned(this_arg);
52322         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
52323         this_arg_conv.is_owned = false;
52324         jboolean ret_conv = InitFeatures_supports_channel_type(&this_arg_conv);
52325         return ret_conv;
52326 }
52327
52328 void  __attribute__((export_name("TS_NodeFeatures_set_channel_type_optional"))) TS_NodeFeatures_set_channel_type_optional(uint64_t this_arg) {
52329         LDKNodeFeatures this_arg_conv;
52330         this_arg_conv.inner = untag_ptr(this_arg);
52331         this_arg_conv.is_owned = ptr_is_owned(this_arg);
52332         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
52333         this_arg_conv.is_owned = false;
52334         NodeFeatures_set_channel_type_optional(&this_arg_conv);
52335 }
52336
52337 void  __attribute__((export_name("TS_NodeFeatures_set_channel_type_required"))) TS_NodeFeatures_set_channel_type_required(uint64_t this_arg) {
52338         LDKNodeFeatures this_arg_conv;
52339         this_arg_conv.inner = untag_ptr(this_arg);
52340         this_arg_conv.is_owned = ptr_is_owned(this_arg);
52341         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
52342         this_arg_conv.is_owned = false;
52343         NodeFeatures_set_channel_type_required(&this_arg_conv);
52344 }
52345
52346 jboolean  __attribute__((export_name("TS_NodeFeatures_supports_channel_type"))) TS_NodeFeatures_supports_channel_type(uint64_t this_arg) {
52347         LDKNodeFeatures this_arg_conv;
52348         this_arg_conv.inner = untag_ptr(this_arg);
52349         this_arg_conv.is_owned = ptr_is_owned(this_arg);
52350         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
52351         this_arg_conv.is_owned = false;
52352         jboolean ret_conv = NodeFeatures_supports_channel_type(&this_arg_conv);
52353         return ret_conv;
52354 }
52355
52356 jboolean  __attribute__((export_name("TS_InitFeatures_requires_channel_type"))) TS_InitFeatures_requires_channel_type(uint64_t this_arg) {
52357         LDKInitFeatures this_arg_conv;
52358         this_arg_conv.inner = untag_ptr(this_arg);
52359         this_arg_conv.is_owned = ptr_is_owned(this_arg);
52360         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
52361         this_arg_conv.is_owned = false;
52362         jboolean ret_conv = InitFeatures_requires_channel_type(&this_arg_conv);
52363         return ret_conv;
52364 }
52365
52366 jboolean  __attribute__((export_name("TS_NodeFeatures_requires_channel_type"))) TS_NodeFeatures_requires_channel_type(uint64_t this_arg) {
52367         LDKNodeFeatures this_arg_conv;
52368         this_arg_conv.inner = untag_ptr(this_arg);
52369         this_arg_conv.is_owned = ptr_is_owned(this_arg);
52370         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
52371         this_arg_conv.is_owned = false;
52372         jboolean ret_conv = NodeFeatures_requires_channel_type(&this_arg_conv);
52373         return ret_conv;
52374 }
52375
52376 void  __attribute__((export_name("TS_InitFeatures_set_scid_privacy_optional"))) TS_InitFeatures_set_scid_privacy_optional(uint64_t this_arg) {
52377         LDKInitFeatures this_arg_conv;
52378         this_arg_conv.inner = untag_ptr(this_arg);
52379         this_arg_conv.is_owned = ptr_is_owned(this_arg);
52380         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
52381         this_arg_conv.is_owned = false;
52382         InitFeatures_set_scid_privacy_optional(&this_arg_conv);
52383 }
52384
52385 void  __attribute__((export_name("TS_InitFeatures_set_scid_privacy_required"))) TS_InitFeatures_set_scid_privacy_required(uint64_t this_arg) {
52386         LDKInitFeatures this_arg_conv;
52387         this_arg_conv.inner = untag_ptr(this_arg);
52388         this_arg_conv.is_owned = ptr_is_owned(this_arg);
52389         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
52390         this_arg_conv.is_owned = false;
52391         InitFeatures_set_scid_privacy_required(&this_arg_conv);
52392 }
52393
52394 jboolean  __attribute__((export_name("TS_InitFeatures_supports_scid_privacy"))) TS_InitFeatures_supports_scid_privacy(uint64_t this_arg) {
52395         LDKInitFeatures this_arg_conv;
52396         this_arg_conv.inner = untag_ptr(this_arg);
52397         this_arg_conv.is_owned = ptr_is_owned(this_arg);
52398         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
52399         this_arg_conv.is_owned = false;
52400         jboolean ret_conv = InitFeatures_supports_scid_privacy(&this_arg_conv);
52401         return ret_conv;
52402 }
52403
52404 void  __attribute__((export_name("TS_NodeFeatures_set_scid_privacy_optional"))) TS_NodeFeatures_set_scid_privacy_optional(uint64_t this_arg) {
52405         LDKNodeFeatures this_arg_conv;
52406         this_arg_conv.inner = untag_ptr(this_arg);
52407         this_arg_conv.is_owned = ptr_is_owned(this_arg);
52408         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
52409         this_arg_conv.is_owned = false;
52410         NodeFeatures_set_scid_privacy_optional(&this_arg_conv);
52411 }
52412
52413 void  __attribute__((export_name("TS_NodeFeatures_set_scid_privacy_required"))) TS_NodeFeatures_set_scid_privacy_required(uint64_t this_arg) {
52414         LDKNodeFeatures this_arg_conv;
52415         this_arg_conv.inner = untag_ptr(this_arg);
52416         this_arg_conv.is_owned = ptr_is_owned(this_arg);
52417         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
52418         this_arg_conv.is_owned = false;
52419         NodeFeatures_set_scid_privacy_required(&this_arg_conv);
52420 }
52421
52422 jboolean  __attribute__((export_name("TS_NodeFeatures_supports_scid_privacy"))) TS_NodeFeatures_supports_scid_privacy(uint64_t this_arg) {
52423         LDKNodeFeatures this_arg_conv;
52424         this_arg_conv.inner = untag_ptr(this_arg);
52425         this_arg_conv.is_owned = ptr_is_owned(this_arg);
52426         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
52427         this_arg_conv.is_owned = false;
52428         jboolean ret_conv = NodeFeatures_supports_scid_privacy(&this_arg_conv);
52429         return ret_conv;
52430 }
52431
52432 void  __attribute__((export_name("TS_ChannelTypeFeatures_set_scid_privacy_optional"))) TS_ChannelTypeFeatures_set_scid_privacy_optional(uint64_t this_arg) {
52433         LDKChannelTypeFeatures this_arg_conv;
52434         this_arg_conv.inner = untag_ptr(this_arg);
52435         this_arg_conv.is_owned = ptr_is_owned(this_arg);
52436         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
52437         this_arg_conv.is_owned = false;
52438         ChannelTypeFeatures_set_scid_privacy_optional(&this_arg_conv);
52439 }
52440
52441 void  __attribute__((export_name("TS_ChannelTypeFeatures_set_scid_privacy_required"))) TS_ChannelTypeFeatures_set_scid_privacy_required(uint64_t this_arg) {
52442         LDKChannelTypeFeatures this_arg_conv;
52443         this_arg_conv.inner = untag_ptr(this_arg);
52444         this_arg_conv.is_owned = ptr_is_owned(this_arg);
52445         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
52446         this_arg_conv.is_owned = false;
52447         ChannelTypeFeatures_set_scid_privacy_required(&this_arg_conv);
52448 }
52449
52450 jboolean  __attribute__((export_name("TS_ChannelTypeFeatures_supports_scid_privacy"))) TS_ChannelTypeFeatures_supports_scid_privacy(uint64_t this_arg) {
52451         LDKChannelTypeFeatures this_arg_conv;
52452         this_arg_conv.inner = untag_ptr(this_arg);
52453         this_arg_conv.is_owned = ptr_is_owned(this_arg);
52454         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
52455         this_arg_conv.is_owned = false;
52456         jboolean ret_conv = ChannelTypeFeatures_supports_scid_privacy(&this_arg_conv);
52457         return ret_conv;
52458 }
52459
52460 jboolean  __attribute__((export_name("TS_InitFeatures_requires_scid_privacy"))) TS_InitFeatures_requires_scid_privacy(uint64_t this_arg) {
52461         LDKInitFeatures this_arg_conv;
52462         this_arg_conv.inner = untag_ptr(this_arg);
52463         this_arg_conv.is_owned = ptr_is_owned(this_arg);
52464         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
52465         this_arg_conv.is_owned = false;
52466         jboolean ret_conv = InitFeatures_requires_scid_privacy(&this_arg_conv);
52467         return ret_conv;
52468 }
52469
52470 jboolean  __attribute__((export_name("TS_NodeFeatures_requires_scid_privacy"))) TS_NodeFeatures_requires_scid_privacy(uint64_t this_arg) {
52471         LDKNodeFeatures this_arg_conv;
52472         this_arg_conv.inner = untag_ptr(this_arg);
52473         this_arg_conv.is_owned = ptr_is_owned(this_arg);
52474         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
52475         this_arg_conv.is_owned = false;
52476         jboolean ret_conv = NodeFeatures_requires_scid_privacy(&this_arg_conv);
52477         return ret_conv;
52478 }
52479
52480 jboolean  __attribute__((export_name("TS_ChannelTypeFeatures_requires_scid_privacy"))) TS_ChannelTypeFeatures_requires_scid_privacy(uint64_t this_arg) {
52481         LDKChannelTypeFeatures this_arg_conv;
52482         this_arg_conv.inner = untag_ptr(this_arg);
52483         this_arg_conv.is_owned = ptr_is_owned(this_arg);
52484         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
52485         this_arg_conv.is_owned = false;
52486         jboolean ret_conv = ChannelTypeFeatures_requires_scid_privacy(&this_arg_conv);
52487         return ret_conv;
52488 }
52489
52490 void  __attribute__((export_name("TS_Bolt11InvoiceFeatures_set_payment_metadata_optional"))) TS_Bolt11InvoiceFeatures_set_payment_metadata_optional(uint64_t this_arg) {
52491         LDKBolt11InvoiceFeatures this_arg_conv;
52492         this_arg_conv.inner = untag_ptr(this_arg);
52493         this_arg_conv.is_owned = ptr_is_owned(this_arg);
52494         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
52495         this_arg_conv.is_owned = false;
52496         Bolt11InvoiceFeatures_set_payment_metadata_optional(&this_arg_conv);
52497 }
52498
52499 void  __attribute__((export_name("TS_Bolt11InvoiceFeatures_set_payment_metadata_required"))) TS_Bolt11InvoiceFeatures_set_payment_metadata_required(uint64_t this_arg) {
52500         LDKBolt11InvoiceFeatures this_arg_conv;
52501         this_arg_conv.inner = untag_ptr(this_arg);
52502         this_arg_conv.is_owned = ptr_is_owned(this_arg);
52503         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
52504         this_arg_conv.is_owned = false;
52505         Bolt11InvoiceFeatures_set_payment_metadata_required(&this_arg_conv);
52506 }
52507
52508 jboolean  __attribute__((export_name("TS_Bolt11InvoiceFeatures_supports_payment_metadata"))) TS_Bolt11InvoiceFeatures_supports_payment_metadata(uint64_t this_arg) {
52509         LDKBolt11InvoiceFeatures this_arg_conv;
52510         this_arg_conv.inner = untag_ptr(this_arg);
52511         this_arg_conv.is_owned = ptr_is_owned(this_arg);
52512         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
52513         this_arg_conv.is_owned = false;
52514         jboolean ret_conv = Bolt11InvoiceFeatures_supports_payment_metadata(&this_arg_conv);
52515         return ret_conv;
52516 }
52517
52518 jboolean  __attribute__((export_name("TS_Bolt11InvoiceFeatures_requires_payment_metadata"))) TS_Bolt11InvoiceFeatures_requires_payment_metadata(uint64_t this_arg) {
52519         LDKBolt11InvoiceFeatures this_arg_conv;
52520         this_arg_conv.inner = untag_ptr(this_arg);
52521         this_arg_conv.is_owned = ptr_is_owned(this_arg);
52522         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
52523         this_arg_conv.is_owned = false;
52524         jboolean ret_conv = Bolt11InvoiceFeatures_requires_payment_metadata(&this_arg_conv);
52525         return ret_conv;
52526 }
52527
52528 void  __attribute__((export_name("TS_InitFeatures_set_zero_conf_optional"))) TS_InitFeatures_set_zero_conf_optional(uint64_t this_arg) {
52529         LDKInitFeatures this_arg_conv;
52530         this_arg_conv.inner = untag_ptr(this_arg);
52531         this_arg_conv.is_owned = ptr_is_owned(this_arg);
52532         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
52533         this_arg_conv.is_owned = false;
52534         InitFeatures_set_zero_conf_optional(&this_arg_conv);
52535 }
52536
52537 void  __attribute__((export_name("TS_InitFeatures_set_zero_conf_required"))) TS_InitFeatures_set_zero_conf_required(uint64_t this_arg) {
52538         LDKInitFeatures this_arg_conv;
52539         this_arg_conv.inner = untag_ptr(this_arg);
52540         this_arg_conv.is_owned = ptr_is_owned(this_arg);
52541         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
52542         this_arg_conv.is_owned = false;
52543         InitFeatures_set_zero_conf_required(&this_arg_conv);
52544 }
52545
52546 jboolean  __attribute__((export_name("TS_InitFeatures_supports_zero_conf"))) TS_InitFeatures_supports_zero_conf(uint64_t this_arg) {
52547         LDKInitFeatures this_arg_conv;
52548         this_arg_conv.inner = untag_ptr(this_arg);
52549         this_arg_conv.is_owned = ptr_is_owned(this_arg);
52550         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
52551         this_arg_conv.is_owned = false;
52552         jboolean ret_conv = InitFeatures_supports_zero_conf(&this_arg_conv);
52553         return ret_conv;
52554 }
52555
52556 void  __attribute__((export_name("TS_NodeFeatures_set_zero_conf_optional"))) TS_NodeFeatures_set_zero_conf_optional(uint64_t this_arg) {
52557         LDKNodeFeatures this_arg_conv;
52558         this_arg_conv.inner = untag_ptr(this_arg);
52559         this_arg_conv.is_owned = ptr_is_owned(this_arg);
52560         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
52561         this_arg_conv.is_owned = false;
52562         NodeFeatures_set_zero_conf_optional(&this_arg_conv);
52563 }
52564
52565 void  __attribute__((export_name("TS_NodeFeatures_set_zero_conf_required"))) TS_NodeFeatures_set_zero_conf_required(uint64_t this_arg) {
52566         LDKNodeFeatures this_arg_conv;
52567         this_arg_conv.inner = untag_ptr(this_arg);
52568         this_arg_conv.is_owned = ptr_is_owned(this_arg);
52569         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
52570         this_arg_conv.is_owned = false;
52571         NodeFeatures_set_zero_conf_required(&this_arg_conv);
52572 }
52573
52574 jboolean  __attribute__((export_name("TS_NodeFeatures_supports_zero_conf"))) TS_NodeFeatures_supports_zero_conf(uint64_t this_arg) {
52575         LDKNodeFeatures this_arg_conv;
52576         this_arg_conv.inner = untag_ptr(this_arg);
52577         this_arg_conv.is_owned = ptr_is_owned(this_arg);
52578         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
52579         this_arg_conv.is_owned = false;
52580         jboolean ret_conv = NodeFeatures_supports_zero_conf(&this_arg_conv);
52581         return ret_conv;
52582 }
52583
52584 void  __attribute__((export_name("TS_ChannelTypeFeatures_set_zero_conf_optional"))) TS_ChannelTypeFeatures_set_zero_conf_optional(uint64_t this_arg) {
52585         LDKChannelTypeFeatures this_arg_conv;
52586         this_arg_conv.inner = untag_ptr(this_arg);
52587         this_arg_conv.is_owned = ptr_is_owned(this_arg);
52588         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
52589         this_arg_conv.is_owned = false;
52590         ChannelTypeFeatures_set_zero_conf_optional(&this_arg_conv);
52591 }
52592
52593 void  __attribute__((export_name("TS_ChannelTypeFeatures_set_zero_conf_required"))) TS_ChannelTypeFeatures_set_zero_conf_required(uint64_t this_arg) {
52594         LDKChannelTypeFeatures this_arg_conv;
52595         this_arg_conv.inner = untag_ptr(this_arg);
52596         this_arg_conv.is_owned = ptr_is_owned(this_arg);
52597         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
52598         this_arg_conv.is_owned = false;
52599         ChannelTypeFeatures_set_zero_conf_required(&this_arg_conv);
52600 }
52601
52602 jboolean  __attribute__((export_name("TS_ChannelTypeFeatures_supports_zero_conf"))) TS_ChannelTypeFeatures_supports_zero_conf(uint64_t this_arg) {
52603         LDKChannelTypeFeatures this_arg_conv;
52604         this_arg_conv.inner = untag_ptr(this_arg);
52605         this_arg_conv.is_owned = ptr_is_owned(this_arg);
52606         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
52607         this_arg_conv.is_owned = false;
52608         jboolean ret_conv = ChannelTypeFeatures_supports_zero_conf(&this_arg_conv);
52609         return ret_conv;
52610 }
52611
52612 jboolean  __attribute__((export_name("TS_InitFeatures_requires_zero_conf"))) TS_InitFeatures_requires_zero_conf(uint64_t this_arg) {
52613         LDKInitFeatures this_arg_conv;
52614         this_arg_conv.inner = untag_ptr(this_arg);
52615         this_arg_conv.is_owned = ptr_is_owned(this_arg);
52616         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
52617         this_arg_conv.is_owned = false;
52618         jboolean ret_conv = InitFeatures_requires_zero_conf(&this_arg_conv);
52619         return ret_conv;
52620 }
52621
52622 jboolean  __attribute__((export_name("TS_NodeFeatures_requires_zero_conf"))) TS_NodeFeatures_requires_zero_conf(uint64_t this_arg) {
52623         LDKNodeFeatures this_arg_conv;
52624         this_arg_conv.inner = untag_ptr(this_arg);
52625         this_arg_conv.is_owned = ptr_is_owned(this_arg);
52626         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
52627         this_arg_conv.is_owned = false;
52628         jboolean ret_conv = NodeFeatures_requires_zero_conf(&this_arg_conv);
52629         return ret_conv;
52630 }
52631
52632 jboolean  __attribute__((export_name("TS_ChannelTypeFeatures_requires_zero_conf"))) TS_ChannelTypeFeatures_requires_zero_conf(uint64_t this_arg) {
52633         LDKChannelTypeFeatures this_arg_conv;
52634         this_arg_conv.inner = untag_ptr(this_arg);
52635         this_arg_conv.is_owned = ptr_is_owned(this_arg);
52636         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
52637         this_arg_conv.is_owned = false;
52638         jboolean ret_conv = ChannelTypeFeatures_requires_zero_conf(&this_arg_conv);
52639         return ret_conv;
52640 }
52641
52642 void  __attribute__((export_name("TS_NodeFeatures_set_keysend_optional"))) TS_NodeFeatures_set_keysend_optional(uint64_t this_arg) {
52643         LDKNodeFeatures this_arg_conv;
52644         this_arg_conv.inner = untag_ptr(this_arg);
52645         this_arg_conv.is_owned = ptr_is_owned(this_arg);
52646         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
52647         this_arg_conv.is_owned = false;
52648         NodeFeatures_set_keysend_optional(&this_arg_conv);
52649 }
52650
52651 void  __attribute__((export_name("TS_NodeFeatures_set_keysend_required"))) TS_NodeFeatures_set_keysend_required(uint64_t this_arg) {
52652         LDKNodeFeatures this_arg_conv;
52653         this_arg_conv.inner = untag_ptr(this_arg);
52654         this_arg_conv.is_owned = ptr_is_owned(this_arg);
52655         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
52656         this_arg_conv.is_owned = false;
52657         NodeFeatures_set_keysend_required(&this_arg_conv);
52658 }
52659
52660 jboolean  __attribute__((export_name("TS_NodeFeatures_supports_keysend"))) TS_NodeFeatures_supports_keysend(uint64_t this_arg) {
52661         LDKNodeFeatures this_arg_conv;
52662         this_arg_conv.inner = untag_ptr(this_arg);
52663         this_arg_conv.is_owned = ptr_is_owned(this_arg);
52664         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
52665         this_arg_conv.is_owned = false;
52666         jboolean ret_conv = NodeFeatures_supports_keysend(&this_arg_conv);
52667         return ret_conv;
52668 }
52669
52670 jboolean  __attribute__((export_name("TS_NodeFeatures_requires_keysend"))) TS_NodeFeatures_requires_keysend(uint64_t this_arg) {
52671         LDKNodeFeatures this_arg_conv;
52672         this_arg_conv.inner = untag_ptr(this_arg);
52673         this_arg_conv.is_owned = ptr_is_owned(this_arg);
52674         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
52675         this_arg_conv.is_owned = false;
52676         jboolean ret_conv = NodeFeatures_requires_keysend(&this_arg_conv);
52677         return ret_conv;
52678 }
52679
52680 void  __attribute__((export_name("TS_ShutdownScript_free"))) TS_ShutdownScript_free(uint64_t this_obj) {
52681         LDKShutdownScript this_obj_conv;
52682         this_obj_conv.inner = untag_ptr(this_obj);
52683         this_obj_conv.is_owned = ptr_is_owned(this_obj);
52684         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
52685         ShutdownScript_free(this_obj_conv);
52686 }
52687
52688 static inline uint64_t ShutdownScript_clone_ptr(LDKShutdownScript *NONNULL_PTR arg) {
52689         LDKShutdownScript ret_var = ShutdownScript_clone(arg);
52690         uint64_t ret_ref = 0;
52691         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
52692         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
52693         return ret_ref;
52694 }
52695 int64_t  __attribute__((export_name("TS_ShutdownScript_clone_ptr"))) TS_ShutdownScript_clone_ptr(uint64_t arg) {
52696         LDKShutdownScript arg_conv;
52697         arg_conv.inner = untag_ptr(arg);
52698         arg_conv.is_owned = ptr_is_owned(arg);
52699         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
52700         arg_conv.is_owned = false;
52701         int64_t ret_conv = ShutdownScript_clone_ptr(&arg_conv);
52702         return ret_conv;
52703 }
52704
52705 uint64_t  __attribute__((export_name("TS_ShutdownScript_clone"))) TS_ShutdownScript_clone(uint64_t orig) {
52706         LDKShutdownScript orig_conv;
52707         orig_conv.inner = untag_ptr(orig);
52708         orig_conv.is_owned = ptr_is_owned(orig);
52709         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
52710         orig_conv.is_owned = false;
52711         LDKShutdownScript ret_var = ShutdownScript_clone(&orig_conv);
52712         uint64_t ret_ref = 0;
52713         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
52714         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
52715         return ret_ref;
52716 }
52717
52718 jboolean  __attribute__((export_name("TS_ShutdownScript_eq"))) TS_ShutdownScript_eq(uint64_t a, uint64_t b) {
52719         LDKShutdownScript a_conv;
52720         a_conv.inner = untag_ptr(a);
52721         a_conv.is_owned = ptr_is_owned(a);
52722         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
52723         a_conv.is_owned = false;
52724         LDKShutdownScript b_conv;
52725         b_conv.inner = untag_ptr(b);
52726         b_conv.is_owned = ptr_is_owned(b);
52727         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
52728         b_conv.is_owned = false;
52729         jboolean ret_conv = ShutdownScript_eq(&a_conv, &b_conv);
52730         return ret_conv;
52731 }
52732
52733 void  __attribute__((export_name("TS_InvalidShutdownScript_free"))) TS_InvalidShutdownScript_free(uint64_t this_obj) {
52734         LDKInvalidShutdownScript this_obj_conv;
52735         this_obj_conv.inner = untag_ptr(this_obj);
52736         this_obj_conv.is_owned = ptr_is_owned(this_obj);
52737         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
52738         InvalidShutdownScript_free(this_obj_conv);
52739 }
52740
52741 int8_tArray  __attribute__((export_name("TS_InvalidShutdownScript_get_script"))) TS_InvalidShutdownScript_get_script(uint64_t this_ptr) {
52742         LDKInvalidShutdownScript this_ptr_conv;
52743         this_ptr_conv.inner = untag_ptr(this_ptr);
52744         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
52745         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
52746         this_ptr_conv.is_owned = false;
52747         LDKu8slice ret_var = InvalidShutdownScript_get_script(&this_ptr_conv);
52748         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
52749         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
52750         return ret_arr;
52751 }
52752
52753 void  __attribute__((export_name("TS_InvalidShutdownScript_set_script"))) TS_InvalidShutdownScript_set_script(uint64_t this_ptr, int8_tArray val) {
52754         LDKInvalidShutdownScript this_ptr_conv;
52755         this_ptr_conv.inner = untag_ptr(this_ptr);
52756         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
52757         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
52758         this_ptr_conv.is_owned = false;
52759         LDKCVec_u8Z val_ref;
52760         val_ref.datalen = val->arr_len;
52761         val_ref.data = MALLOC(val_ref.datalen, "LDKCVec_u8Z Bytes");
52762         memcpy(val_ref.data, val->elems, val_ref.datalen); FREE(val);
52763         InvalidShutdownScript_set_script(&this_ptr_conv, val_ref);
52764 }
52765
52766 uint64_t  __attribute__((export_name("TS_InvalidShutdownScript_new"))) TS_InvalidShutdownScript_new(int8_tArray script_arg) {
52767         LDKCVec_u8Z script_arg_ref;
52768         script_arg_ref.datalen = script_arg->arr_len;
52769         script_arg_ref.data = MALLOC(script_arg_ref.datalen, "LDKCVec_u8Z Bytes");
52770         memcpy(script_arg_ref.data, script_arg->elems, script_arg_ref.datalen); FREE(script_arg);
52771         LDKInvalidShutdownScript ret_var = InvalidShutdownScript_new(script_arg_ref);
52772         uint64_t ret_ref = 0;
52773         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
52774         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
52775         return ret_ref;
52776 }
52777
52778 static inline uint64_t InvalidShutdownScript_clone_ptr(LDKInvalidShutdownScript *NONNULL_PTR arg) {
52779         LDKInvalidShutdownScript ret_var = InvalidShutdownScript_clone(arg);
52780         uint64_t ret_ref = 0;
52781         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
52782         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
52783         return ret_ref;
52784 }
52785 int64_t  __attribute__((export_name("TS_InvalidShutdownScript_clone_ptr"))) TS_InvalidShutdownScript_clone_ptr(uint64_t arg) {
52786         LDKInvalidShutdownScript arg_conv;
52787         arg_conv.inner = untag_ptr(arg);
52788         arg_conv.is_owned = ptr_is_owned(arg);
52789         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
52790         arg_conv.is_owned = false;
52791         int64_t ret_conv = InvalidShutdownScript_clone_ptr(&arg_conv);
52792         return ret_conv;
52793 }
52794
52795 uint64_t  __attribute__((export_name("TS_InvalidShutdownScript_clone"))) TS_InvalidShutdownScript_clone(uint64_t orig) {
52796         LDKInvalidShutdownScript orig_conv;
52797         orig_conv.inner = untag_ptr(orig);
52798         orig_conv.is_owned = ptr_is_owned(orig);
52799         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
52800         orig_conv.is_owned = false;
52801         LDKInvalidShutdownScript ret_var = InvalidShutdownScript_clone(&orig_conv);
52802         uint64_t ret_ref = 0;
52803         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
52804         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
52805         return ret_ref;
52806 }
52807
52808 int8_tArray  __attribute__((export_name("TS_ShutdownScript_write"))) TS_ShutdownScript_write(uint64_t obj) {
52809         LDKShutdownScript obj_conv;
52810         obj_conv.inner = untag_ptr(obj);
52811         obj_conv.is_owned = ptr_is_owned(obj);
52812         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
52813         obj_conv.is_owned = false;
52814         LDKCVec_u8Z ret_var = ShutdownScript_write(&obj_conv);
52815         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
52816         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
52817         CVec_u8Z_free(ret_var);
52818         return ret_arr;
52819 }
52820
52821 uint64_t  __attribute__((export_name("TS_ShutdownScript_read"))) TS_ShutdownScript_read(int8_tArray ser) {
52822         LDKu8slice ser_ref;
52823         ser_ref.datalen = ser->arr_len;
52824         ser_ref.data = ser->elems;
52825         LDKCResult_ShutdownScriptDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ShutdownScriptDecodeErrorZ), "LDKCResult_ShutdownScriptDecodeErrorZ");
52826         *ret_conv = ShutdownScript_read(ser_ref);
52827         FREE(ser);
52828         return tag_ptr(ret_conv, true);
52829 }
52830
52831 uint64_t  __attribute__((export_name("TS_ShutdownScript_new_p2wpkh"))) TS_ShutdownScript_new_p2wpkh(int8_tArray pubkey_hash) {
52832         uint8_t pubkey_hash_arr[20];
52833         CHECK(pubkey_hash->arr_len == 20);
52834         memcpy(pubkey_hash_arr, pubkey_hash->elems, 20); FREE(pubkey_hash);
52835         uint8_t (*pubkey_hash_ref)[20] = &pubkey_hash_arr;
52836         LDKShutdownScript ret_var = ShutdownScript_new_p2wpkh(pubkey_hash_ref);
52837         uint64_t ret_ref = 0;
52838         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
52839         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
52840         return ret_ref;
52841 }
52842
52843 uint64_t  __attribute__((export_name("TS_ShutdownScript_new_p2wsh"))) TS_ShutdownScript_new_p2wsh(int8_tArray script_hash) {
52844         uint8_t script_hash_arr[32];
52845         CHECK(script_hash->arr_len == 32);
52846         memcpy(script_hash_arr, script_hash->elems, 32); FREE(script_hash);
52847         uint8_t (*script_hash_ref)[32] = &script_hash_arr;
52848         LDKShutdownScript ret_var = ShutdownScript_new_p2wsh(script_hash_ref);
52849         uint64_t ret_ref = 0;
52850         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
52851         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
52852         return ret_ref;
52853 }
52854
52855 uint64_t  __attribute__((export_name("TS_ShutdownScript_new_witness_program"))) TS_ShutdownScript_new_witness_program(int8_t version, int8_tArray program) {
52856         
52857         LDKu8slice program_ref;
52858         program_ref.datalen = program->arr_len;
52859         program_ref.data = program->elems;
52860         LDKCResult_ShutdownScriptInvalidShutdownScriptZ* ret_conv = MALLOC(sizeof(LDKCResult_ShutdownScriptInvalidShutdownScriptZ), "LDKCResult_ShutdownScriptInvalidShutdownScriptZ");
52861         *ret_conv = ShutdownScript_new_witness_program((LDKWitnessVersion){ ._0 = version }, program_ref);
52862         FREE(program);
52863         return tag_ptr(ret_conv, true);
52864 }
52865
52866 int8_tArray  __attribute__((export_name("TS_ShutdownScript_into_inner"))) TS_ShutdownScript_into_inner(uint64_t this_arg) {
52867         LDKShutdownScript this_arg_conv;
52868         this_arg_conv.inner = untag_ptr(this_arg);
52869         this_arg_conv.is_owned = ptr_is_owned(this_arg);
52870         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
52871         this_arg_conv = ShutdownScript_clone(&this_arg_conv);
52872         LDKCVec_u8Z ret_var = ShutdownScript_into_inner(this_arg_conv);
52873         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
52874         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
52875         CVec_u8Z_free(ret_var);
52876         return ret_arr;
52877 }
52878
52879 int8_tArray  __attribute__((export_name("TS_ShutdownScript_as_legacy_pubkey"))) TS_ShutdownScript_as_legacy_pubkey(uint64_t this_arg) {
52880         LDKShutdownScript this_arg_conv;
52881         this_arg_conv.inner = untag_ptr(this_arg);
52882         this_arg_conv.is_owned = ptr_is_owned(this_arg);
52883         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
52884         this_arg_conv.is_owned = false;
52885         int8_tArray ret_arr = init_int8_tArray(33, __LINE__);
52886         memcpy(ret_arr->elems, ShutdownScript_as_legacy_pubkey(&this_arg_conv).compressed_form, 33);
52887         return ret_arr;
52888 }
52889
52890 jboolean  __attribute__((export_name("TS_ShutdownScript_is_compatible"))) TS_ShutdownScript_is_compatible(uint64_t this_arg, uint64_t features) {
52891         LDKShutdownScript this_arg_conv;
52892         this_arg_conv.inner = untag_ptr(this_arg);
52893         this_arg_conv.is_owned = ptr_is_owned(this_arg);
52894         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
52895         this_arg_conv.is_owned = false;
52896         LDKInitFeatures features_conv;
52897         features_conv.inner = untag_ptr(features);
52898         features_conv.is_owned = ptr_is_owned(features);
52899         CHECK_INNER_FIELD_ACCESS_OR_NULL(features_conv);
52900         features_conv.is_owned = false;
52901         jboolean ret_conv = ShutdownScript_is_compatible(&this_arg_conv, &features_conv);
52902         return ret_conv;
52903 }
52904
52905 void  __attribute__((export_name("TS_Retry_free"))) TS_Retry_free(uint64_t this_ptr) {
52906         if (!ptr_is_owned(this_ptr)) return;
52907         void* this_ptr_ptr = untag_ptr(this_ptr);
52908         CHECK_ACCESS(this_ptr_ptr);
52909         LDKRetry this_ptr_conv = *(LDKRetry*)(this_ptr_ptr);
52910         FREE(untag_ptr(this_ptr));
52911         Retry_free(this_ptr_conv);
52912 }
52913
52914 static inline uint64_t Retry_clone_ptr(LDKRetry *NONNULL_PTR arg) {
52915         LDKRetry *ret_copy = MALLOC(sizeof(LDKRetry), "LDKRetry");
52916         *ret_copy = Retry_clone(arg);
52917         uint64_t ret_ref = tag_ptr(ret_copy, true);
52918         return ret_ref;
52919 }
52920 int64_t  __attribute__((export_name("TS_Retry_clone_ptr"))) TS_Retry_clone_ptr(uint64_t arg) {
52921         LDKRetry* arg_conv = (LDKRetry*)untag_ptr(arg);
52922         int64_t ret_conv = Retry_clone_ptr(arg_conv);
52923         return ret_conv;
52924 }
52925
52926 uint64_t  __attribute__((export_name("TS_Retry_clone"))) TS_Retry_clone(uint64_t orig) {
52927         LDKRetry* orig_conv = (LDKRetry*)untag_ptr(orig);
52928         LDKRetry *ret_copy = MALLOC(sizeof(LDKRetry), "LDKRetry");
52929         *ret_copy = Retry_clone(orig_conv);
52930         uint64_t ret_ref = tag_ptr(ret_copy, true);
52931         return ret_ref;
52932 }
52933
52934 uint64_t  __attribute__((export_name("TS_Retry_attempts"))) TS_Retry_attempts(int32_t a) {
52935         LDKRetry *ret_copy = MALLOC(sizeof(LDKRetry), "LDKRetry");
52936         *ret_copy = Retry_attempts(a);
52937         uint64_t ret_ref = tag_ptr(ret_copy, true);
52938         return ret_ref;
52939 }
52940
52941 jboolean  __attribute__((export_name("TS_Retry_eq"))) TS_Retry_eq(uint64_t a, uint64_t b) {
52942         LDKRetry* a_conv = (LDKRetry*)untag_ptr(a);
52943         LDKRetry* b_conv = (LDKRetry*)untag_ptr(b);
52944         jboolean ret_conv = Retry_eq(a_conv, b_conv);
52945         return ret_conv;
52946 }
52947
52948 int64_t  __attribute__((export_name("TS_Retry_hash"))) TS_Retry_hash(uint64_t o) {
52949         LDKRetry* o_conv = (LDKRetry*)untag_ptr(o);
52950         int64_t ret_conv = Retry_hash(o_conv);
52951         return ret_conv;
52952 }
52953
52954 int8_tArray  __attribute__((export_name("TS_Retry_write"))) TS_Retry_write(uint64_t obj) {
52955         LDKRetry* obj_conv = (LDKRetry*)untag_ptr(obj);
52956         LDKCVec_u8Z ret_var = Retry_write(obj_conv);
52957         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
52958         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
52959         CVec_u8Z_free(ret_var);
52960         return ret_arr;
52961 }
52962
52963 uint64_t  __attribute__((export_name("TS_Retry_read"))) TS_Retry_read(int8_tArray ser) {
52964         LDKu8slice ser_ref;
52965         ser_ref.datalen = ser->arr_len;
52966         ser_ref.data = ser->elems;
52967         LDKCResult_RetryDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RetryDecodeErrorZ), "LDKCResult_RetryDecodeErrorZ");
52968         *ret_conv = Retry_read(ser_ref);
52969         FREE(ser);
52970         return tag_ptr(ret_conv, true);
52971 }
52972
52973 uint32_t  __attribute__((export_name("TS_RetryableSendFailure_clone"))) TS_RetryableSendFailure_clone(uint64_t orig) {
52974         LDKRetryableSendFailure* orig_conv = (LDKRetryableSendFailure*)untag_ptr(orig);
52975         uint32_t ret_conv = LDKRetryableSendFailure_to_js(RetryableSendFailure_clone(orig_conv));
52976         return ret_conv;
52977 }
52978
52979 uint32_t  __attribute__((export_name("TS_RetryableSendFailure_payment_expired"))) TS_RetryableSendFailure_payment_expired() {
52980         uint32_t ret_conv = LDKRetryableSendFailure_to_js(RetryableSendFailure_payment_expired());
52981         return ret_conv;
52982 }
52983
52984 uint32_t  __attribute__((export_name("TS_RetryableSendFailure_route_not_found"))) TS_RetryableSendFailure_route_not_found() {
52985         uint32_t ret_conv = LDKRetryableSendFailure_to_js(RetryableSendFailure_route_not_found());
52986         return ret_conv;
52987 }
52988
52989 uint32_t  __attribute__((export_name("TS_RetryableSendFailure_duplicate_payment"))) TS_RetryableSendFailure_duplicate_payment() {
52990         uint32_t ret_conv = LDKRetryableSendFailure_to_js(RetryableSendFailure_duplicate_payment());
52991         return ret_conv;
52992 }
52993
52994 jboolean  __attribute__((export_name("TS_RetryableSendFailure_eq"))) TS_RetryableSendFailure_eq(uint64_t a, uint64_t b) {
52995         LDKRetryableSendFailure* a_conv = (LDKRetryableSendFailure*)untag_ptr(a);
52996         LDKRetryableSendFailure* b_conv = (LDKRetryableSendFailure*)untag_ptr(b);
52997         jboolean ret_conv = RetryableSendFailure_eq(a_conv, b_conv);
52998         return ret_conv;
52999 }
53000
53001 void  __attribute__((export_name("TS_PaymentSendFailure_free"))) TS_PaymentSendFailure_free(uint64_t this_ptr) {
53002         if (!ptr_is_owned(this_ptr)) return;
53003         void* this_ptr_ptr = untag_ptr(this_ptr);
53004         CHECK_ACCESS(this_ptr_ptr);
53005         LDKPaymentSendFailure this_ptr_conv = *(LDKPaymentSendFailure*)(this_ptr_ptr);
53006         FREE(untag_ptr(this_ptr));
53007         PaymentSendFailure_free(this_ptr_conv);
53008 }
53009
53010 static inline uint64_t PaymentSendFailure_clone_ptr(LDKPaymentSendFailure *NONNULL_PTR arg) {
53011         LDKPaymentSendFailure *ret_copy = MALLOC(sizeof(LDKPaymentSendFailure), "LDKPaymentSendFailure");
53012         *ret_copy = PaymentSendFailure_clone(arg);
53013         uint64_t ret_ref = tag_ptr(ret_copy, true);
53014         return ret_ref;
53015 }
53016 int64_t  __attribute__((export_name("TS_PaymentSendFailure_clone_ptr"))) TS_PaymentSendFailure_clone_ptr(uint64_t arg) {
53017         LDKPaymentSendFailure* arg_conv = (LDKPaymentSendFailure*)untag_ptr(arg);
53018         int64_t ret_conv = PaymentSendFailure_clone_ptr(arg_conv);
53019         return ret_conv;
53020 }
53021
53022 uint64_t  __attribute__((export_name("TS_PaymentSendFailure_clone"))) TS_PaymentSendFailure_clone(uint64_t orig) {
53023         LDKPaymentSendFailure* orig_conv = (LDKPaymentSendFailure*)untag_ptr(orig);
53024         LDKPaymentSendFailure *ret_copy = MALLOC(sizeof(LDKPaymentSendFailure), "LDKPaymentSendFailure");
53025         *ret_copy = PaymentSendFailure_clone(orig_conv);
53026         uint64_t ret_ref = tag_ptr(ret_copy, true);
53027         return ret_ref;
53028 }
53029
53030 uint64_t  __attribute__((export_name("TS_PaymentSendFailure_parameter_error"))) TS_PaymentSendFailure_parameter_error(uint64_t a) {
53031         void* a_ptr = untag_ptr(a);
53032         CHECK_ACCESS(a_ptr);
53033         LDKAPIError a_conv = *(LDKAPIError*)(a_ptr);
53034         a_conv = APIError_clone((LDKAPIError*)untag_ptr(a));
53035         LDKPaymentSendFailure *ret_copy = MALLOC(sizeof(LDKPaymentSendFailure), "LDKPaymentSendFailure");
53036         *ret_copy = PaymentSendFailure_parameter_error(a_conv);
53037         uint64_t ret_ref = tag_ptr(ret_copy, true);
53038         return ret_ref;
53039 }
53040
53041 uint64_t  __attribute__((export_name("TS_PaymentSendFailure_path_parameter_error"))) TS_PaymentSendFailure_path_parameter_error(uint64_tArray a) {
53042         LDKCVec_CResult_NoneAPIErrorZZ a_constr;
53043         a_constr.datalen = a->arr_len;
53044         if (a_constr.datalen > 0)
53045                 a_constr.data = MALLOC(a_constr.datalen * sizeof(LDKCResult_NoneAPIErrorZ), "LDKCVec_CResult_NoneAPIErrorZZ Elements");
53046         else
53047                 a_constr.data = NULL;
53048         uint64_t* a_vals = a->elems;
53049         for (size_t w = 0; w < a_constr.datalen; w++) {
53050                 uint64_t a_conv_22 = a_vals[w];
53051                 void* a_conv_22_ptr = untag_ptr(a_conv_22);
53052                 CHECK_ACCESS(a_conv_22_ptr);
53053                 LDKCResult_NoneAPIErrorZ a_conv_22_conv = *(LDKCResult_NoneAPIErrorZ*)(a_conv_22_ptr);
53054                 a_conv_22_conv = CResult_NoneAPIErrorZ_clone((LDKCResult_NoneAPIErrorZ*)untag_ptr(a_conv_22));
53055                 a_constr.data[w] = a_conv_22_conv;
53056         }
53057         FREE(a);
53058         LDKPaymentSendFailure *ret_copy = MALLOC(sizeof(LDKPaymentSendFailure), "LDKPaymentSendFailure");
53059         *ret_copy = PaymentSendFailure_path_parameter_error(a_constr);
53060         uint64_t ret_ref = tag_ptr(ret_copy, true);
53061         return ret_ref;
53062 }
53063
53064 uint64_t  __attribute__((export_name("TS_PaymentSendFailure_all_failed_resend_safe"))) TS_PaymentSendFailure_all_failed_resend_safe(uint64_tArray a) {
53065         LDKCVec_APIErrorZ a_constr;
53066         a_constr.datalen = a->arr_len;
53067         if (a_constr.datalen > 0)
53068                 a_constr.data = MALLOC(a_constr.datalen * sizeof(LDKAPIError), "LDKCVec_APIErrorZ Elements");
53069         else
53070                 a_constr.data = NULL;
53071         uint64_t* a_vals = a->elems;
53072         for (size_t k = 0; k < a_constr.datalen; k++) {
53073                 uint64_t a_conv_10 = a_vals[k];
53074                 void* a_conv_10_ptr = untag_ptr(a_conv_10);
53075                 CHECK_ACCESS(a_conv_10_ptr);
53076                 LDKAPIError a_conv_10_conv = *(LDKAPIError*)(a_conv_10_ptr);
53077                 a_conv_10_conv = APIError_clone((LDKAPIError*)untag_ptr(a_conv_10));
53078                 a_constr.data[k] = a_conv_10_conv;
53079         }
53080         FREE(a);
53081         LDKPaymentSendFailure *ret_copy = MALLOC(sizeof(LDKPaymentSendFailure), "LDKPaymentSendFailure");
53082         *ret_copy = PaymentSendFailure_all_failed_resend_safe(a_constr);
53083         uint64_t ret_ref = tag_ptr(ret_copy, true);
53084         return ret_ref;
53085 }
53086
53087 uint64_t  __attribute__((export_name("TS_PaymentSendFailure_duplicate_payment"))) TS_PaymentSendFailure_duplicate_payment() {
53088         LDKPaymentSendFailure *ret_copy = MALLOC(sizeof(LDKPaymentSendFailure), "LDKPaymentSendFailure");
53089         *ret_copy = PaymentSendFailure_duplicate_payment();
53090         uint64_t ret_ref = tag_ptr(ret_copy, true);
53091         return ret_ref;
53092 }
53093
53094 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) {
53095         LDKCVec_CResult_NoneAPIErrorZZ results_constr;
53096         results_constr.datalen = results->arr_len;
53097         if (results_constr.datalen > 0)
53098                 results_constr.data = MALLOC(results_constr.datalen * sizeof(LDKCResult_NoneAPIErrorZ), "LDKCVec_CResult_NoneAPIErrorZZ Elements");
53099         else
53100                 results_constr.data = NULL;
53101         uint64_t* results_vals = results->elems;
53102         for (size_t w = 0; w < results_constr.datalen; w++) {
53103                 uint64_t results_conv_22 = results_vals[w];
53104                 void* results_conv_22_ptr = untag_ptr(results_conv_22);
53105                 CHECK_ACCESS(results_conv_22_ptr);
53106                 LDKCResult_NoneAPIErrorZ results_conv_22_conv = *(LDKCResult_NoneAPIErrorZ*)(results_conv_22_ptr);
53107                 results_constr.data[w] = results_conv_22_conv;
53108         }
53109         FREE(results);
53110         LDKRouteParameters failed_paths_retry_conv;
53111         failed_paths_retry_conv.inner = untag_ptr(failed_paths_retry);
53112         failed_paths_retry_conv.is_owned = ptr_is_owned(failed_paths_retry);
53113         CHECK_INNER_FIELD_ACCESS_OR_NULL(failed_paths_retry_conv);
53114         failed_paths_retry_conv = RouteParameters_clone(&failed_paths_retry_conv);
53115         LDKThirtyTwoBytes payment_id_ref;
53116         CHECK(payment_id->arr_len == 32);
53117         memcpy(payment_id_ref.data, payment_id->elems, 32); FREE(payment_id);
53118         LDKPaymentSendFailure *ret_copy = MALLOC(sizeof(LDKPaymentSendFailure), "LDKPaymentSendFailure");
53119         *ret_copy = PaymentSendFailure_partial_failure(results_constr, failed_paths_retry_conv, payment_id_ref);
53120         uint64_t ret_ref = tag_ptr(ret_copy, true);
53121         return ret_ref;
53122 }
53123
53124 jboolean  __attribute__((export_name("TS_PaymentSendFailure_eq"))) TS_PaymentSendFailure_eq(uint64_t a, uint64_t b) {
53125         LDKPaymentSendFailure* a_conv = (LDKPaymentSendFailure*)untag_ptr(a);
53126         LDKPaymentSendFailure* b_conv = (LDKPaymentSendFailure*)untag_ptr(b);
53127         jboolean ret_conv = PaymentSendFailure_eq(a_conv, b_conv);
53128         return ret_conv;
53129 }
53130
53131 void  __attribute__((export_name("TS_ProbeSendFailure_free"))) TS_ProbeSendFailure_free(uint64_t this_ptr) {
53132         if (!ptr_is_owned(this_ptr)) return;
53133         void* this_ptr_ptr = untag_ptr(this_ptr);
53134         CHECK_ACCESS(this_ptr_ptr);
53135         LDKProbeSendFailure this_ptr_conv = *(LDKProbeSendFailure*)(this_ptr_ptr);
53136         FREE(untag_ptr(this_ptr));
53137         ProbeSendFailure_free(this_ptr_conv);
53138 }
53139
53140 static inline uint64_t ProbeSendFailure_clone_ptr(LDKProbeSendFailure *NONNULL_PTR arg) {
53141         LDKProbeSendFailure *ret_copy = MALLOC(sizeof(LDKProbeSendFailure), "LDKProbeSendFailure");
53142         *ret_copy = ProbeSendFailure_clone(arg);
53143         uint64_t ret_ref = tag_ptr(ret_copy, true);
53144         return ret_ref;
53145 }
53146 int64_t  __attribute__((export_name("TS_ProbeSendFailure_clone_ptr"))) TS_ProbeSendFailure_clone_ptr(uint64_t arg) {
53147         LDKProbeSendFailure* arg_conv = (LDKProbeSendFailure*)untag_ptr(arg);
53148         int64_t ret_conv = ProbeSendFailure_clone_ptr(arg_conv);
53149         return ret_conv;
53150 }
53151
53152 uint64_t  __attribute__((export_name("TS_ProbeSendFailure_clone"))) TS_ProbeSendFailure_clone(uint64_t orig) {
53153         LDKProbeSendFailure* orig_conv = (LDKProbeSendFailure*)untag_ptr(orig);
53154         LDKProbeSendFailure *ret_copy = MALLOC(sizeof(LDKProbeSendFailure), "LDKProbeSendFailure");
53155         *ret_copy = ProbeSendFailure_clone(orig_conv);
53156         uint64_t ret_ref = tag_ptr(ret_copy, true);
53157         return ret_ref;
53158 }
53159
53160 uint64_t  __attribute__((export_name("TS_ProbeSendFailure_route_not_found"))) TS_ProbeSendFailure_route_not_found() {
53161         LDKProbeSendFailure *ret_copy = MALLOC(sizeof(LDKProbeSendFailure), "LDKProbeSendFailure");
53162         *ret_copy = ProbeSendFailure_route_not_found();
53163         uint64_t ret_ref = tag_ptr(ret_copy, true);
53164         return ret_ref;
53165 }
53166
53167 uint64_t  __attribute__((export_name("TS_ProbeSendFailure_sending_failed"))) TS_ProbeSendFailure_sending_failed(uint64_t a) {
53168         void* a_ptr = untag_ptr(a);
53169         CHECK_ACCESS(a_ptr);
53170         LDKPaymentSendFailure a_conv = *(LDKPaymentSendFailure*)(a_ptr);
53171         a_conv = PaymentSendFailure_clone((LDKPaymentSendFailure*)untag_ptr(a));
53172         LDKProbeSendFailure *ret_copy = MALLOC(sizeof(LDKProbeSendFailure), "LDKProbeSendFailure");
53173         *ret_copy = ProbeSendFailure_sending_failed(a_conv);
53174         uint64_t ret_ref = tag_ptr(ret_copy, true);
53175         return ret_ref;
53176 }
53177
53178 jboolean  __attribute__((export_name("TS_ProbeSendFailure_eq"))) TS_ProbeSendFailure_eq(uint64_t a, uint64_t b) {
53179         LDKProbeSendFailure* a_conv = (LDKProbeSendFailure*)untag_ptr(a);
53180         LDKProbeSendFailure* b_conv = (LDKProbeSendFailure*)untag_ptr(b);
53181         jboolean ret_conv = ProbeSendFailure_eq(a_conv, b_conv);
53182         return ret_conv;
53183 }
53184
53185 void  __attribute__((export_name("TS_RecipientOnionFields_free"))) TS_RecipientOnionFields_free(uint64_t this_obj) {
53186         LDKRecipientOnionFields this_obj_conv;
53187         this_obj_conv.inner = untag_ptr(this_obj);
53188         this_obj_conv.is_owned = ptr_is_owned(this_obj);
53189         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
53190         RecipientOnionFields_free(this_obj_conv);
53191 }
53192
53193 uint64_t  __attribute__((export_name("TS_RecipientOnionFields_get_payment_secret"))) TS_RecipientOnionFields_get_payment_secret(uint64_t this_ptr) {
53194         LDKRecipientOnionFields this_ptr_conv;
53195         this_ptr_conv.inner = untag_ptr(this_ptr);
53196         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
53197         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
53198         this_ptr_conv.is_owned = false;
53199         LDKCOption_ThirtyTwoBytesZ *ret_copy = MALLOC(sizeof(LDKCOption_ThirtyTwoBytesZ), "LDKCOption_ThirtyTwoBytesZ");
53200         *ret_copy = RecipientOnionFields_get_payment_secret(&this_ptr_conv);
53201         uint64_t ret_ref = tag_ptr(ret_copy, true);
53202         return ret_ref;
53203 }
53204
53205 void  __attribute__((export_name("TS_RecipientOnionFields_set_payment_secret"))) TS_RecipientOnionFields_set_payment_secret(uint64_t this_ptr, uint64_t val) {
53206         LDKRecipientOnionFields this_ptr_conv;
53207         this_ptr_conv.inner = untag_ptr(this_ptr);
53208         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
53209         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
53210         this_ptr_conv.is_owned = false;
53211         void* val_ptr = untag_ptr(val);
53212         CHECK_ACCESS(val_ptr);
53213         LDKCOption_ThirtyTwoBytesZ val_conv = *(LDKCOption_ThirtyTwoBytesZ*)(val_ptr);
53214         val_conv = COption_ThirtyTwoBytesZ_clone((LDKCOption_ThirtyTwoBytesZ*)untag_ptr(val));
53215         RecipientOnionFields_set_payment_secret(&this_ptr_conv, val_conv);
53216 }
53217
53218 uint64_t  __attribute__((export_name("TS_RecipientOnionFields_get_payment_metadata"))) TS_RecipientOnionFields_get_payment_metadata(uint64_t this_ptr) {
53219         LDKRecipientOnionFields this_ptr_conv;
53220         this_ptr_conv.inner = untag_ptr(this_ptr);
53221         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
53222         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
53223         this_ptr_conv.is_owned = false;
53224         LDKCOption_CVec_u8ZZ *ret_copy = MALLOC(sizeof(LDKCOption_CVec_u8ZZ), "LDKCOption_CVec_u8ZZ");
53225         *ret_copy = RecipientOnionFields_get_payment_metadata(&this_ptr_conv);
53226         uint64_t ret_ref = tag_ptr(ret_copy, true);
53227         return ret_ref;
53228 }
53229
53230 void  __attribute__((export_name("TS_RecipientOnionFields_set_payment_metadata"))) TS_RecipientOnionFields_set_payment_metadata(uint64_t this_ptr, uint64_t val) {
53231         LDKRecipientOnionFields this_ptr_conv;
53232         this_ptr_conv.inner = untag_ptr(this_ptr);
53233         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
53234         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
53235         this_ptr_conv.is_owned = false;
53236         void* val_ptr = untag_ptr(val);
53237         CHECK_ACCESS(val_ptr);
53238         LDKCOption_CVec_u8ZZ val_conv = *(LDKCOption_CVec_u8ZZ*)(val_ptr);
53239         val_conv = COption_CVec_u8ZZ_clone((LDKCOption_CVec_u8ZZ*)untag_ptr(val));
53240         RecipientOnionFields_set_payment_metadata(&this_ptr_conv, val_conv);
53241 }
53242
53243 static inline uint64_t RecipientOnionFields_clone_ptr(LDKRecipientOnionFields *NONNULL_PTR arg) {
53244         LDKRecipientOnionFields ret_var = RecipientOnionFields_clone(arg);
53245         uint64_t ret_ref = 0;
53246         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
53247         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
53248         return ret_ref;
53249 }
53250 int64_t  __attribute__((export_name("TS_RecipientOnionFields_clone_ptr"))) TS_RecipientOnionFields_clone_ptr(uint64_t arg) {
53251         LDKRecipientOnionFields arg_conv;
53252         arg_conv.inner = untag_ptr(arg);
53253         arg_conv.is_owned = ptr_is_owned(arg);
53254         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
53255         arg_conv.is_owned = false;
53256         int64_t ret_conv = RecipientOnionFields_clone_ptr(&arg_conv);
53257         return ret_conv;
53258 }
53259
53260 uint64_t  __attribute__((export_name("TS_RecipientOnionFields_clone"))) TS_RecipientOnionFields_clone(uint64_t orig) {
53261         LDKRecipientOnionFields orig_conv;
53262         orig_conv.inner = untag_ptr(orig);
53263         orig_conv.is_owned = ptr_is_owned(orig);
53264         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
53265         orig_conv.is_owned = false;
53266         LDKRecipientOnionFields ret_var = RecipientOnionFields_clone(&orig_conv);
53267         uint64_t ret_ref = 0;
53268         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
53269         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
53270         return ret_ref;
53271 }
53272
53273 jboolean  __attribute__((export_name("TS_RecipientOnionFields_eq"))) TS_RecipientOnionFields_eq(uint64_t a, uint64_t b) {
53274         LDKRecipientOnionFields a_conv;
53275         a_conv.inner = untag_ptr(a);
53276         a_conv.is_owned = ptr_is_owned(a);
53277         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
53278         a_conv.is_owned = false;
53279         LDKRecipientOnionFields b_conv;
53280         b_conv.inner = untag_ptr(b);
53281         b_conv.is_owned = ptr_is_owned(b);
53282         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
53283         b_conv.is_owned = false;
53284         jboolean ret_conv = RecipientOnionFields_eq(&a_conv, &b_conv);
53285         return ret_conv;
53286 }
53287
53288 int8_tArray  __attribute__((export_name("TS_RecipientOnionFields_write"))) TS_RecipientOnionFields_write(uint64_t obj) {
53289         LDKRecipientOnionFields obj_conv;
53290         obj_conv.inner = untag_ptr(obj);
53291         obj_conv.is_owned = ptr_is_owned(obj);
53292         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
53293         obj_conv.is_owned = false;
53294         LDKCVec_u8Z ret_var = RecipientOnionFields_write(&obj_conv);
53295         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
53296         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
53297         CVec_u8Z_free(ret_var);
53298         return ret_arr;
53299 }
53300
53301 uint64_t  __attribute__((export_name("TS_RecipientOnionFields_read"))) TS_RecipientOnionFields_read(int8_tArray ser) {
53302         LDKu8slice ser_ref;
53303         ser_ref.datalen = ser->arr_len;
53304         ser_ref.data = ser->elems;
53305         LDKCResult_RecipientOnionFieldsDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RecipientOnionFieldsDecodeErrorZ), "LDKCResult_RecipientOnionFieldsDecodeErrorZ");
53306         *ret_conv = RecipientOnionFields_read(ser_ref);
53307         FREE(ser);
53308         return tag_ptr(ret_conv, true);
53309 }
53310
53311 uint64_t  __attribute__((export_name("TS_RecipientOnionFields_secret_only"))) TS_RecipientOnionFields_secret_only(int8_tArray payment_secret) {
53312         LDKThirtyTwoBytes payment_secret_ref;
53313         CHECK(payment_secret->arr_len == 32);
53314         memcpy(payment_secret_ref.data, payment_secret->elems, 32); FREE(payment_secret);
53315         LDKRecipientOnionFields ret_var = RecipientOnionFields_secret_only(payment_secret_ref);
53316         uint64_t ret_ref = 0;
53317         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
53318         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
53319         return ret_ref;
53320 }
53321
53322 uint64_t  __attribute__((export_name("TS_RecipientOnionFields_spontaneous_empty"))) TS_RecipientOnionFields_spontaneous_empty() {
53323         LDKRecipientOnionFields ret_var = RecipientOnionFields_spontaneous_empty();
53324         uint64_t ret_ref = 0;
53325         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
53326         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
53327         return ret_ref;
53328 }
53329
53330 uint64_t  __attribute__((export_name("TS_RecipientOnionFields_with_custom_tlvs"))) TS_RecipientOnionFields_with_custom_tlvs(uint64_t this_arg, uint64_tArray custom_tlvs) {
53331         LDKRecipientOnionFields this_arg_conv;
53332         this_arg_conv.inner = untag_ptr(this_arg);
53333         this_arg_conv.is_owned = ptr_is_owned(this_arg);
53334         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
53335         this_arg_conv = RecipientOnionFields_clone(&this_arg_conv);
53336         LDKCVec_C2Tuple_u64CVec_u8ZZZ custom_tlvs_constr;
53337         custom_tlvs_constr.datalen = custom_tlvs->arr_len;
53338         if (custom_tlvs_constr.datalen > 0)
53339                 custom_tlvs_constr.data = MALLOC(custom_tlvs_constr.datalen * sizeof(LDKC2Tuple_u64CVec_u8ZZ), "LDKCVec_C2Tuple_u64CVec_u8ZZZ Elements");
53340         else
53341                 custom_tlvs_constr.data = NULL;
53342         uint64_t* custom_tlvs_vals = custom_tlvs->elems;
53343         for (size_t x = 0; x < custom_tlvs_constr.datalen; x++) {
53344                 uint64_t custom_tlvs_conv_23 = custom_tlvs_vals[x];
53345                 void* custom_tlvs_conv_23_ptr = untag_ptr(custom_tlvs_conv_23);
53346                 CHECK_ACCESS(custom_tlvs_conv_23_ptr);
53347                 LDKC2Tuple_u64CVec_u8ZZ custom_tlvs_conv_23_conv = *(LDKC2Tuple_u64CVec_u8ZZ*)(custom_tlvs_conv_23_ptr);
53348                 custom_tlvs_conv_23_conv = C2Tuple_u64CVec_u8ZZ_clone((LDKC2Tuple_u64CVec_u8ZZ*)untag_ptr(custom_tlvs_conv_23));
53349                 custom_tlvs_constr.data[x] = custom_tlvs_conv_23_conv;
53350         }
53351         FREE(custom_tlvs);
53352         LDKCResult_RecipientOnionFieldsNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_RecipientOnionFieldsNoneZ), "LDKCResult_RecipientOnionFieldsNoneZ");
53353         *ret_conv = RecipientOnionFields_with_custom_tlvs(this_arg_conv, custom_tlvs_constr);
53354         return tag_ptr(ret_conv, true);
53355 }
53356
53357 uint64_tArray  __attribute__((export_name("TS_RecipientOnionFields_custom_tlvs"))) TS_RecipientOnionFields_custom_tlvs(uint64_t this_arg) {
53358         LDKRecipientOnionFields this_arg_conv;
53359         this_arg_conv.inner = untag_ptr(this_arg);
53360         this_arg_conv.is_owned = ptr_is_owned(this_arg);
53361         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
53362         this_arg_conv.is_owned = false;
53363         LDKCVec_C2Tuple_u64CVec_u8ZZZ ret_var = RecipientOnionFields_custom_tlvs(&this_arg_conv);
53364         uint64_tArray ret_arr = NULL;
53365         ret_arr = init_uint64_tArray(ret_var.datalen, __LINE__);
53366         uint64_t *ret_arr_ptr = (uint64_t*)(((uint8_t*)ret_arr) + 8);
53367         for (size_t x = 0; x < ret_var.datalen; x++) {
53368                 LDKC2Tuple_u64CVec_u8ZZ* ret_conv_23_conv = MALLOC(sizeof(LDKC2Tuple_u64CVec_u8ZZ), "LDKC2Tuple_u64CVec_u8ZZ");
53369                 *ret_conv_23_conv = ret_var.data[x];
53370                 ret_arr_ptr[x] = tag_ptr(ret_conv_23_conv, true);
53371         }
53372         
53373         FREE(ret_var.data);
53374         return ret_arr;
53375 }
53376
53377 void  __attribute__((export_name("TS_CustomMessageReader_free"))) TS_CustomMessageReader_free(uint64_t this_ptr) {
53378         if (!ptr_is_owned(this_ptr)) return;
53379         void* this_ptr_ptr = untag_ptr(this_ptr);
53380         CHECK_ACCESS(this_ptr_ptr);
53381         LDKCustomMessageReader this_ptr_conv = *(LDKCustomMessageReader*)(this_ptr_ptr);
53382         FREE(untag_ptr(this_ptr));
53383         CustomMessageReader_free(this_ptr_conv);
53384 }
53385
53386 static inline uint64_t Type_clone_ptr(LDKType *NONNULL_PTR arg) {
53387         LDKType* ret_ret = MALLOC(sizeof(LDKType), "LDKType");
53388         *ret_ret = Type_clone(arg);
53389         return tag_ptr(ret_ret, true);
53390 }
53391 int64_t  __attribute__((export_name("TS_Type_clone_ptr"))) TS_Type_clone_ptr(uint64_t arg) {
53392         void* arg_ptr = untag_ptr(arg);
53393         if (ptr_is_owned(arg)) { CHECK_ACCESS(arg_ptr); }
53394         LDKType* arg_conv = (LDKType*)arg_ptr;
53395         int64_t ret_conv = Type_clone_ptr(arg_conv);
53396         return ret_conv;
53397 }
53398
53399 uint64_t  __attribute__((export_name("TS_Type_clone"))) TS_Type_clone(uint64_t orig) {
53400         void* orig_ptr = untag_ptr(orig);
53401         if (ptr_is_owned(orig)) { CHECK_ACCESS(orig_ptr); }
53402         LDKType* orig_conv = (LDKType*)orig_ptr;
53403         LDKType* ret_ret = MALLOC(sizeof(LDKType), "LDKType");
53404         *ret_ret = Type_clone(orig_conv);
53405         return tag_ptr(ret_ret, true);
53406 }
53407
53408 void  __attribute__((export_name("TS_Type_free"))) TS_Type_free(uint64_t this_ptr) {
53409         if (!ptr_is_owned(this_ptr)) return;
53410         void* this_ptr_ptr = untag_ptr(this_ptr);
53411         CHECK_ACCESS(this_ptr_ptr);
53412         LDKType this_ptr_conv = *(LDKType*)(this_ptr_ptr);
53413         FREE(untag_ptr(this_ptr));
53414         Type_free(this_ptr_conv);
53415 }
53416
53417 void  __attribute__((export_name("TS_Offer_free"))) TS_Offer_free(uint64_t this_obj) {
53418         LDKOffer this_obj_conv;
53419         this_obj_conv.inner = untag_ptr(this_obj);
53420         this_obj_conv.is_owned = ptr_is_owned(this_obj);
53421         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
53422         Offer_free(this_obj_conv);
53423 }
53424
53425 static inline uint64_t Offer_clone_ptr(LDKOffer *NONNULL_PTR arg) {
53426         LDKOffer ret_var = Offer_clone(arg);
53427         uint64_t ret_ref = 0;
53428         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
53429         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
53430         return ret_ref;
53431 }
53432 int64_t  __attribute__((export_name("TS_Offer_clone_ptr"))) TS_Offer_clone_ptr(uint64_t arg) {
53433         LDKOffer arg_conv;
53434         arg_conv.inner = untag_ptr(arg);
53435         arg_conv.is_owned = ptr_is_owned(arg);
53436         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
53437         arg_conv.is_owned = false;
53438         int64_t ret_conv = Offer_clone_ptr(&arg_conv);
53439         return ret_conv;
53440 }
53441
53442 uint64_t  __attribute__((export_name("TS_Offer_clone"))) TS_Offer_clone(uint64_t orig) {
53443         LDKOffer orig_conv;
53444         orig_conv.inner = untag_ptr(orig);
53445         orig_conv.is_owned = ptr_is_owned(orig);
53446         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
53447         orig_conv.is_owned = false;
53448         LDKOffer ret_var = Offer_clone(&orig_conv);
53449         uint64_t ret_ref = 0;
53450         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
53451         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
53452         return ret_ref;
53453 }
53454
53455 ptrArray  __attribute__((export_name("TS_Offer_chains"))) TS_Offer_chains(uint64_t this_arg) {
53456         LDKOffer this_arg_conv;
53457         this_arg_conv.inner = untag_ptr(this_arg);
53458         this_arg_conv.is_owned = ptr_is_owned(this_arg);
53459         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
53460         this_arg_conv.is_owned = false;
53461         LDKCVec_ThirtyTwoBytesZ ret_var = Offer_chains(&this_arg_conv);
53462         ptrArray ret_arr = NULL;
53463         ret_arr = init_ptrArray(ret_var.datalen, __LINE__);
53464         int8_tArray *ret_arr_ptr = (int8_tArray*)(((uint8_t*)ret_arr) + 8);
53465         for (size_t m = 0; m < ret_var.datalen; m++) {
53466                 int8_tArray ret_conv_12_arr = init_int8_tArray(32, __LINE__);
53467                 memcpy(ret_conv_12_arr->elems, ret_var.data[m].data, 32);
53468                 ret_arr_ptr[m] = ret_conv_12_arr;
53469         }
53470         
53471         FREE(ret_var.data);
53472         return ret_arr;
53473 }
53474
53475 uint64_t  __attribute__((export_name("TS_Offer_metadata"))) TS_Offer_metadata(uint64_t this_arg) {
53476         LDKOffer this_arg_conv;
53477         this_arg_conv.inner = untag_ptr(this_arg);
53478         this_arg_conv.is_owned = ptr_is_owned(this_arg);
53479         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
53480         this_arg_conv.is_owned = false;
53481         LDKCOption_CVec_u8ZZ *ret_copy = MALLOC(sizeof(LDKCOption_CVec_u8ZZ), "LDKCOption_CVec_u8ZZ");
53482         *ret_copy = Offer_metadata(&this_arg_conv);
53483         uint64_t ret_ref = tag_ptr(ret_copy, true);
53484         return ret_ref;
53485 }
53486
53487 uint64_t  __attribute__((export_name("TS_Offer_amount"))) TS_Offer_amount(uint64_t this_arg) {
53488         LDKOffer this_arg_conv;
53489         this_arg_conv.inner = untag_ptr(this_arg);
53490         this_arg_conv.is_owned = ptr_is_owned(this_arg);
53491         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
53492         this_arg_conv.is_owned = false;
53493         LDKAmount ret_var = Offer_amount(&this_arg_conv);
53494         uint64_t ret_ref = 0;
53495         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
53496         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
53497         return ret_ref;
53498 }
53499
53500 uint64_t  __attribute__((export_name("TS_Offer_description"))) TS_Offer_description(uint64_t this_arg) {
53501         LDKOffer this_arg_conv;
53502         this_arg_conv.inner = untag_ptr(this_arg);
53503         this_arg_conv.is_owned = ptr_is_owned(this_arg);
53504         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
53505         this_arg_conv.is_owned = false;
53506         LDKPrintableString ret_var = Offer_description(&this_arg_conv);
53507         uint64_t ret_ref = 0;
53508         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
53509         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
53510         return ret_ref;
53511 }
53512
53513 uint64_t  __attribute__((export_name("TS_Offer_offer_features"))) TS_Offer_offer_features(uint64_t this_arg) {
53514         LDKOffer this_arg_conv;
53515         this_arg_conv.inner = untag_ptr(this_arg);
53516         this_arg_conv.is_owned = ptr_is_owned(this_arg);
53517         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
53518         this_arg_conv.is_owned = false;
53519         LDKOfferFeatures ret_var = Offer_offer_features(&this_arg_conv);
53520         uint64_t ret_ref = 0;
53521         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
53522         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
53523         return ret_ref;
53524 }
53525
53526 uint64_t  __attribute__((export_name("TS_Offer_absolute_expiry"))) TS_Offer_absolute_expiry(uint64_t this_arg) {
53527         LDKOffer this_arg_conv;
53528         this_arg_conv.inner = untag_ptr(this_arg);
53529         this_arg_conv.is_owned = ptr_is_owned(this_arg);
53530         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
53531         this_arg_conv.is_owned = false;
53532         LDKCOption_u64Z *ret_copy = MALLOC(sizeof(LDKCOption_u64Z), "LDKCOption_u64Z");
53533         *ret_copy = Offer_absolute_expiry(&this_arg_conv);
53534         uint64_t ret_ref = tag_ptr(ret_copy, true);
53535         return ret_ref;
53536 }
53537
53538 uint64_t  __attribute__((export_name("TS_Offer_issuer"))) TS_Offer_issuer(uint64_t this_arg) {
53539         LDKOffer this_arg_conv;
53540         this_arg_conv.inner = untag_ptr(this_arg);
53541         this_arg_conv.is_owned = ptr_is_owned(this_arg);
53542         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
53543         this_arg_conv.is_owned = false;
53544         LDKPrintableString ret_var = Offer_issuer(&this_arg_conv);
53545         uint64_t ret_ref = 0;
53546         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
53547         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
53548         return ret_ref;
53549 }
53550
53551 uint64_tArray  __attribute__((export_name("TS_Offer_paths"))) TS_Offer_paths(uint64_t this_arg) {
53552         LDKOffer this_arg_conv;
53553         this_arg_conv.inner = untag_ptr(this_arg);
53554         this_arg_conv.is_owned = ptr_is_owned(this_arg);
53555         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
53556         this_arg_conv.is_owned = false;
53557         LDKCVec_BlindedPathZ ret_var = Offer_paths(&this_arg_conv);
53558         uint64_tArray ret_arr = NULL;
53559         ret_arr = init_uint64_tArray(ret_var.datalen, __LINE__);
53560         uint64_t *ret_arr_ptr = (uint64_t*)(((uint8_t*)ret_arr) + 8);
53561         for (size_t n = 0; n < ret_var.datalen; n++) {
53562                 LDKBlindedPath ret_conv_13_var = ret_var.data[n];
53563                 uint64_t ret_conv_13_ref = 0;
53564                 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_conv_13_var);
53565                 ret_conv_13_ref = tag_ptr(ret_conv_13_var.inner, ret_conv_13_var.is_owned);
53566                 ret_arr_ptr[n] = ret_conv_13_ref;
53567         }
53568         
53569         FREE(ret_var.data);
53570         return ret_arr;
53571 }
53572
53573 uint64_t  __attribute__((export_name("TS_Offer_supported_quantity"))) TS_Offer_supported_quantity(uint64_t this_arg) {
53574         LDKOffer this_arg_conv;
53575         this_arg_conv.inner = untag_ptr(this_arg);
53576         this_arg_conv.is_owned = ptr_is_owned(this_arg);
53577         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
53578         this_arg_conv.is_owned = false;
53579         LDKQuantity ret_var = Offer_supported_quantity(&this_arg_conv);
53580         uint64_t ret_ref = 0;
53581         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
53582         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
53583         return ret_ref;
53584 }
53585
53586 int8_tArray  __attribute__((export_name("TS_Offer_signing_pubkey"))) TS_Offer_signing_pubkey(uint64_t this_arg) {
53587         LDKOffer this_arg_conv;
53588         this_arg_conv.inner = untag_ptr(this_arg);
53589         this_arg_conv.is_owned = ptr_is_owned(this_arg);
53590         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
53591         this_arg_conv.is_owned = false;
53592         int8_tArray ret_arr = init_int8_tArray(33, __LINE__);
53593         memcpy(ret_arr->elems, Offer_signing_pubkey(&this_arg_conv).compressed_form, 33);
53594         return ret_arr;
53595 }
53596
53597 jboolean  __attribute__((export_name("TS_Offer_supports_chain"))) TS_Offer_supports_chain(uint64_t this_arg, int8_tArray chain) {
53598         LDKOffer this_arg_conv;
53599         this_arg_conv.inner = untag_ptr(this_arg);
53600         this_arg_conv.is_owned = ptr_is_owned(this_arg);
53601         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
53602         this_arg_conv.is_owned = false;
53603         LDKThirtyTwoBytes chain_ref;
53604         CHECK(chain->arr_len == 32);
53605         memcpy(chain_ref.data, chain->elems, 32); FREE(chain);
53606         jboolean ret_conv = Offer_supports_chain(&this_arg_conv, chain_ref);
53607         return ret_conv;
53608 }
53609
53610 jboolean  __attribute__((export_name("TS_Offer_is_valid_quantity"))) TS_Offer_is_valid_quantity(uint64_t this_arg, int64_t quantity) {
53611         LDKOffer this_arg_conv;
53612         this_arg_conv.inner = untag_ptr(this_arg);
53613         this_arg_conv.is_owned = ptr_is_owned(this_arg);
53614         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
53615         this_arg_conv.is_owned = false;
53616         jboolean ret_conv = Offer_is_valid_quantity(&this_arg_conv, quantity);
53617         return ret_conv;
53618 }
53619
53620 jboolean  __attribute__((export_name("TS_Offer_expects_quantity"))) TS_Offer_expects_quantity(uint64_t this_arg) {
53621         LDKOffer this_arg_conv;
53622         this_arg_conv.inner = untag_ptr(this_arg);
53623         this_arg_conv.is_owned = ptr_is_owned(this_arg);
53624         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
53625         this_arg_conv.is_owned = false;
53626         jboolean ret_conv = Offer_expects_quantity(&this_arg_conv);
53627         return ret_conv;
53628 }
53629
53630 int8_tArray  __attribute__((export_name("TS_Offer_write"))) TS_Offer_write(uint64_t obj) {
53631         LDKOffer obj_conv;
53632         obj_conv.inner = untag_ptr(obj);
53633         obj_conv.is_owned = ptr_is_owned(obj);
53634         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
53635         obj_conv.is_owned = false;
53636         LDKCVec_u8Z ret_var = Offer_write(&obj_conv);
53637         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
53638         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
53639         CVec_u8Z_free(ret_var);
53640         return ret_arr;
53641 }
53642
53643 void  __attribute__((export_name("TS_Amount_free"))) TS_Amount_free(uint64_t this_obj) {
53644         LDKAmount this_obj_conv;
53645         this_obj_conv.inner = untag_ptr(this_obj);
53646         this_obj_conv.is_owned = ptr_is_owned(this_obj);
53647         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
53648         Amount_free(this_obj_conv);
53649 }
53650
53651 static inline uint64_t Amount_clone_ptr(LDKAmount *NONNULL_PTR arg) {
53652         LDKAmount ret_var = Amount_clone(arg);
53653         uint64_t ret_ref = 0;
53654         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
53655         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
53656         return ret_ref;
53657 }
53658 int64_t  __attribute__((export_name("TS_Amount_clone_ptr"))) TS_Amount_clone_ptr(uint64_t arg) {
53659         LDKAmount arg_conv;
53660         arg_conv.inner = untag_ptr(arg);
53661         arg_conv.is_owned = ptr_is_owned(arg);
53662         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
53663         arg_conv.is_owned = false;
53664         int64_t ret_conv = Amount_clone_ptr(&arg_conv);
53665         return ret_conv;
53666 }
53667
53668 uint64_t  __attribute__((export_name("TS_Amount_clone"))) TS_Amount_clone(uint64_t orig) {
53669         LDKAmount orig_conv;
53670         orig_conv.inner = untag_ptr(orig);
53671         orig_conv.is_owned = ptr_is_owned(orig);
53672         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
53673         orig_conv.is_owned = false;
53674         LDKAmount ret_var = Amount_clone(&orig_conv);
53675         uint64_t ret_ref = 0;
53676         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
53677         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
53678         return ret_ref;
53679 }
53680
53681 void  __attribute__((export_name("TS_Quantity_free"))) TS_Quantity_free(uint64_t this_obj) {
53682         LDKQuantity this_obj_conv;
53683         this_obj_conv.inner = untag_ptr(this_obj);
53684         this_obj_conv.is_owned = ptr_is_owned(this_obj);
53685         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
53686         Quantity_free(this_obj_conv);
53687 }
53688
53689 static inline uint64_t Quantity_clone_ptr(LDKQuantity *NONNULL_PTR arg) {
53690         LDKQuantity ret_var = Quantity_clone(arg);
53691         uint64_t ret_ref = 0;
53692         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
53693         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
53694         return ret_ref;
53695 }
53696 int64_t  __attribute__((export_name("TS_Quantity_clone_ptr"))) TS_Quantity_clone_ptr(uint64_t arg) {
53697         LDKQuantity arg_conv;
53698         arg_conv.inner = untag_ptr(arg);
53699         arg_conv.is_owned = ptr_is_owned(arg);
53700         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
53701         arg_conv.is_owned = false;
53702         int64_t ret_conv = Quantity_clone_ptr(&arg_conv);
53703         return ret_conv;
53704 }
53705
53706 uint64_t  __attribute__((export_name("TS_Quantity_clone"))) TS_Quantity_clone(uint64_t orig) {
53707         LDKQuantity orig_conv;
53708         orig_conv.inner = untag_ptr(orig);
53709         orig_conv.is_owned = ptr_is_owned(orig);
53710         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
53711         orig_conv.is_owned = false;
53712         LDKQuantity ret_var = Quantity_clone(&orig_conv);
53713         uint64_t ret_ref = 0;
53714         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
53715         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
53716         return ret_ref;
53717 }
53718
53719 uint64_t  __attribute__((export_name("TS_Offer_from_str"))) TS_Offer_from_str(jstring s) {
53720         LDKStr s_conv = str_ref_to_owned_c(s);
53721         LDKCResult_OfferBolt12ParseErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_OfferBolt12ParseErrorZ), "LDKCResult_OfferBolt12ParseErrorZ");
53722         *ret_conv = Offer_from_str(s_conv);
53723         return tag_ptr(ret_conv, true);
53724 }
53725
53726 void  __attribute__((export_name("TS_UnsignedBolt12Invoice_free"))) TS_UnsignedBolt12Invoice_free(uint64_t this_obj) {
53727         LDKUnsignedBolt12Invoice this_obj_conv;
53728         this_obj_conv.inner = untag_ptr(this_obj);
53729         this_obj_conv.is_owned = ptr_is_owned(this_obj);
53730         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
53731         UnsignedBolt12Invoice_free(this_obj_conv);
53732 }
53733
53734 uint64_t  __attribute__((export_name("TS_UnsignedBolt12Invoice_tagged_hash"))) TS_UnsignedBolt12Invoice_tagged_hash(uint64_t this_arg) {
53735         LDKUnsignedBolt12Invoice this_arg_conv;
53736         this_arg_conv.inner = untag_ptr(this_arg);
53737         this_arg_conv.is_owned = ptr_is_owned(this_arg);
53738         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
53739         this_arg_conv.is_owned = false;
53740         LDKTaggedHash ret_var = UnsignedBolt12Invoice_tagged_hash(&this_arg_conv);
53741         uint64_t ret_ref = 0;
53742         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
53743         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
53744         return ret_ref;
53745 }
53746
53747 void  __attribute__((export_name("TS_Bolt12Invoice_free"))) TS_Bolt12Invoice_free(uint64_t this_obj) {
53748         LDKBolt12Invoice this_obj_conv;
53749         this_obj_conv.inner = untag_ptr(this_obj);
53750         this_obj_conv.is_owned = ptr_is_owned(this_obj);
53751         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
53752         Bolt12Invoice_free(this_obj_conv);
53753 }
53754
53755 static inline uint64_t Bolt12Invoice_clone_ptr(LDKBolt12Invoice *NONNULL_PTR arg) {
53756         LDKBolt12Invoice ret_var = Bolt12Invoice_clone(arg);
53757         uint64_t ret_ref = 0;
53758         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
53759         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
53760         return ret_ref;
53761 }
53762 int64_t  __attribute__((export_name("TS_Bolt12Invoice_clone_ptr"))) TS_Bolt12Invoice_clone_ptr(uint64_t arg) {
53763         LDKBolt12Invoice arg_conv;
53764         arg_conv.inner = untag_ptr(arg);
53765         arg_conv.is_owned = ptr_is_owned(arg);
53766         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
53767         arg_conv.is_owned = false;
53768         int64_t ret_conv = Bolt12Invoice_clone_ptr(&arg_conv);
53769         return ret_conv;
53770 }
53771
53772 uint64_t  __attribute__((export_name("TS_Bolt12Invoice_clone"))) TS_Bolt12Invoice_clone(uint64_t orig) {
53773         LDKBolt12Invoice orig_conv;
53774         orig_conv.inner = untag_ptr(orig);
53775         orig_conv.is_owned = ptr_is_owned(orig);
53776         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
53777         orig_conv.is_owned = false;
53778         LDKBolt12Invoice ret_var = Bolt12Invoice_clone(&orig_conv);
53779         uint64_t ret_ref = 0;
53780         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
53781         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
53782         return ret_ref;
53783 }
53784
53785 uint64_t  __attribute__((export_name("TS_UnsignedBolt12Invoice_offer_chains"))) TS_UnsignedBolt12Invoice_offer_chains(uint64_t this_arg) {
53786         LDKUnsignedBolt12Invoice this_arg_conv;
53787         this_arg_conv.inner = untag_ptr(this_arg);
53788         this_arg_conv.is_owned = ptr_is_owned(this_arg);
53789         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
53790         this_arg_conv.is_owned = false;
53791         LDKCOption_CVec_ThirtyTwoBytesZZ *ret_copy = MALLOC(sizeof(LDKCOption_CVec_ThirtyTwoBytesZZ), "LDKCOption_CVec_ThirtyTwoBytesZZ");
53792         *ret_copy = UnsignedBolt12Invoice_offer_chains(&this_arg_conv);
53793         uint64_t ret_ref = tag_ptr(ret_copy, true);
53794         return ret_ref;
53795 }
53796
53797 int8_tArray  __attribute__((export_name("TS_UnsignedBolt12Invoice_chain"))) TS_UnsignedBolt12Invoice_chain(uint64_t this_arg) {
53798         LDKUnsignedBolt12Invoice this_arg_conv;
53799         this_arg_conv.inner = untag_ptr(this_arg);
53800         this_arg_conv.is_owned = ptr_is_owned(this_arg);
53801         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
53802         this_arg_conv.is_owned = false;
53803         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
53804         memcpy(ret_arr->elems, UnsignedBolt12Invoice_chain(&this_arg_conv).data, 32);
53805         return ret_arr;
53806 }
53807
53808 uint64_t  __attribute__((export_name("TS_UnsignedBolt12Invoice_metadata"))) TS_UnsignedBolt12Invoice_metadata(uint64_t this_arg) {
53809         LDKUnsignedBolt12Invoice this_arg_conv;
53810         this_arg_conv.inner = untag_ptr(this_arg);
53811         this_arg_conv.is_owned = ptr_is_owned(this_arg);
53812         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
53813         this_arg_conv.is_owned = false;
53814         LDKCOption_CVec_u8ZZ *ret_copy = MALLOC(sizeof(LDKCOption_CVec_u8ZZ), "LDKCOption_CVec_u8ZZ");
53815         *ret_copy = UnsignedBolt12Invoice_metadata(&this_arg_conv);
53816         uint64_t ret_ref = tag_ptr(ret_copy, true);
53817         return ret_ref;
53818 }
53819
53820 uint64_t  __attribute__((export_name("TS_UnsignedBolt12Invoice_amount"))) TS_UnsignedBolt12Invoice_amount(uint64_t this_arg) {
53821         LDKUnsignedBolt12Invoice this_arg_conv;
53822         this_arg_conv.inner = untag_ptr(this_arg);
53823         this_arg_conv.is_owned = ptr_is_owned(this_arg);
53824         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
53825         this_arg_conv.is_owned = false;
53826         LDKAmount ret_var = UnsignedBolt12Invoice_amount(&this_arg_conv);
53827         uint64_t ret_ref = 0;
53828         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
53829         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
53830         return ret_ref;
53831 }
53832
53833 uint64_t  __attribute__((export_name("TS_UnsignedBolt12Invoice_offer_features"))) TS_UnsignedBolt12Invoice_offer_features(uint64_t this_arg) {
53834         LDKUnsignedBolt12Invoice this_arg_conv;
53835         this_arg_conv.inner = untag_ptr(this_arg);
53836         this_arg_conv.is_owned = ptr_is_owned(this_arg);
53837         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
53838         this_arg_conv.is_owned = false;
53839         LDKOfferFeatures ret_var = UnsignedBolt12Invoice_offer_features(&this_arg_conv);
53840         uint64_t ret_ref = 0;
53841         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
53842         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
53843         return ret_ref;
53844 }
53845
53846 uint64_t  __attribute__((export_name("TS_UnsignedBolt12Invoice_description"))) TS_UnsignedBolt12Invoice_description(uint64_t this_arg) {
53847         LDKUnsignedBolt12Invoice this_arg_conv;
53848         this_arg_conv.inner = untag_ptr(this_arg);
53849         this_arg_conv.is_owned = ptr_is_owned(this_arg);
53850         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
53851         this_arg_conv.is_owned = false;
53852         LDKPrintableString ret_var = UnsignedBolt12Invoice_description(&this_arg_conv);
53853         uint64_t ret_ref = 0;
53854         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
53855         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
53856         return ret_ref;
53857 }
53858
53859 uint64_t  __attribute__((export_name("TS_UnsignedBolt12Invoice_absolute_expiry"))) TS_UnsignedBolt12Invoice_absolute_expiry(uint64_t this_arg) {
53860         LDKUnsignedBolt12Invoice this_arg_conv;
53861         this_arg_conv.inner = untag_ptr(this_arg);
53862         this_arg_conv.is_owned = ptr_is_owned(this_arg);
53863         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
53864         this_arg_conv.is_owned = false;
53865         LDKCOption_u64Z *ret_copy = MALLOC(sizeof(LDKCOption_u64Z), "LDKCOption_u64Z");
53866         *ret_copy = UnsignedBolt12Invoice_absolute_expiry(&this_arg_conv);
53867         uint64_t ret_ref = tag_ptr(ret_copy, true);
53868         return ret_ref;
53869 }
53870
53871 uint64_t  __attribute__((export_name("TS_UnsignedBolt12Invoice_issuer"))) TS_UnsignedBolt12Invoice_issuer(uint64_t this_arg) {
53872         LDKUnsignedBolt12Invoice this_arg_conv;
53873         this_arg_conv.inner = untag_ptr(this_arg);
53874         this_arg_conv.is_owned = ptr_is_owned(this_arg);
53875         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
53876         this_arg_conv.is_owned = false;
53877         LDKPrintableString ret_var = UnsignedBolt12Invoice_issuer(&this_arg_conv);
53878         uint64_t ret_ref = 0;
53879         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
53880         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
53881         return ret_ref;
53882 }
53883
53884 uint64_tArray  __attribute__((export_name("TS_UnsignedBolt12Invoice_message_paths"))) TS_UnsignedBolt12Invoice_message_paths(uint64_t this_arg) {
53885         LDKUnsignedBolt12Invoice this_arg_conv;
53886         this_arg_conv.inner = untag_ptr(this_arg);
53887         this_arg_conv.is_owned = ptr_is_owned(this_arg);
53888         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
53889         this_arg_conv.is_owned = false;
53890         LDKCVec_BlindedPathZ ret_var = UnsignedBolt12Invoice_message_paths(&this_arg_conv);
53891         uint64_tArray ret_arr = NULL;
53892         ret_arr = init_uint64_tArray(ret_var.datalen, __LINE__);
53893         uint64_t *ret_arr_ptr = (uint64_t*)(((uint8_t*)ret_arr) + 8);
53894         for (size_t n = 0; n < ret_var.datalen; n++) {
53895                 LDKBlindedPath ret_conv_13_var = ret_var.data[n];
53896                 uint64_t ret_conv_13_ref = 0;
53897                 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_conv_13_var);
53898                 ret_conv_13_ref = tag_ptr(ret_conv_13_var.inner, ret_conv_13_var.is_owned);
53899                 ret_arr_ptr[n] = ret_conv_13_ref;
53900         }
53901         
53902         FREE(ret_var.data);
53903         return ret_arr;
53904 }
53905
53906 uint64_t  __attribute__((export_name("TS_UnsignedBolt12Invoice_supported_quantity"))) TS_UnsignedBolt12Invoice_supported_quantity(uint64_t this_arg) {
53907         LDKUnsignedBolt12Invoice this_arg_conv;
53908         this_arg_conv.inner = untag_ptr(this_arg);
53909         this_arg_conv.is_owned = ptr_is_owned(this_arg);
53910         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
53911         this_arg_conv.is_owned = false;
53912         LDKQuantity ret_var = UnsignedBolt12Invoice_supported_quantity(&this_arg_conv);
53913         uint64_t ret_ref = 0;
53914         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
53915         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
53916         return ret_ref;
53917 }
53918
53919 int8_tArray  __attribute__((export_name("TS_UnsignedBolt12Invoice_payer_metadata"))) TS_UnsignedBolt12Invoice_payer_metadata(uint64_t this_arg) {
53920         LDKUnsignedBolt12Invoice this_arg_conv;
53921         this_arg_conv.inner = untag_ptr(this_arg);
53922         this_arg_conv.is_owned = ptr_is_owned(this_arg);
53923         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
53924         this_arg_conv.is_owned = false;
53925         LDKu8slice ret_var = UnsignedBolt12Invoice_payer_metadata(&this_arg_conv);
53926         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
53927         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
53928         return ret_arr;
53929 }
53930
53931 uint64_t  __attribute__((export_name("TS_UnsignedBolt12Invoice_invoice_request_features"))) TS_UnsignedBolt12Invoice_invoice_request_features(uint64_t this_arg) {
53932         LDKUnsignedBolt12Invoice this_arg_conv;
53933         this_arg_conv.inner = untag_ptr(this_arg);
53934         this_arg_conv.is_owned = ptr_is_owned(this_arg);
53935         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
53936         this_arg_conv.is_owned = false;
53937         LDKInvoiceRequestFeatures ret_var = UnsignedBolt12Invoice_invoice_request_features(&this_arg_conv);
53938         uint64_t ret_ref = 0;
53939         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
53940         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
53941         return ret_ref;
53942 }
53943
53944 uint64_t  __attribute__((export_name("TS_UnsignedBolt12Invoice_quantity"))) TS_UnsignedBolt12Invoice_quantity(uint64_t this_arg) {
53945         LDKUnsignedBolt12Invoice this_arg_conv;
53946         this_arg_conv.inner = untag_ptr(this_arg);
53947         this_arg_conv.is_owned = ptr_is_owned(this_arg);
53948         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
53949         this_arg_conv.is_owned = false;
53950         LDKCOption_u64Z *ret_copy = MALLOC(sizeof(LDKCOption_u64Z), "LDKCOption_u64Z");
53951         *ret_copy = UnsignedBolt12Invoice_quantity(&this_arg_conv);
53952         uint64_t ret_ref = tag_ptr(ret_copy, true);
53953         return ret_ref;
53954 }
53955
53956 int8_tArray  __attribute__((export_name("TS_UnsignedBolt12Invoice_payer_id"))) TS_UnsignedBolt12Invoice_payer_id(uint64_t this_arg) {
53957         LDKUnsignedBolt12Invoice this_arg_conv;
53958         this_arg_conv.inner = untag_ptr(this_arg);
53959         this_arg_conv.is_owned = ptr_is_owned(this_arg);
53960         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
53961         this_arg_conv.is_owned = false;
53962         int8_tArray ret_arr = init_int8_tArray(33, __LINE__);
53963         memcpy(ret_arr->elems, UnsignedBolt12Invoice_payer_id(&this_arg_conv).compressed_form, 33);
53964         return ret_arr;
53965 }
53966
53967 uint64_t  __attribute__((export_name("TS_UnsignedBolt12Invoice_payer_note"))) TS_UnsignedBolt12Invoice_payer_note(uint64_t this_arg) {
53968         LDKUnsignedBolt12Invoice this_arg_conv;
53969         this_arg_conv.inner = untag_ptr(this_arg);
53970         this_arg_conv.is_owned = ptr_is_owned(this_arg);
53971         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
53972         this_arg_conv.is_owned = false;
53973         LDKPrintableString ret_var = UnsignedBolt12Invoice_payer_note(&this_arg_conv);
53974         uint64_t ret_ref = 0;
53975         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
53976         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
53977         return ret_ref;
53978 }
53979
53980 int64_t  __attribute__((export_name("TS_UnsignedBolt12Invoice_created_at"))) TS_UnsignedBolt12Invoice_created_at(uint64_t this_arg) {
53981         LDKUnsignedBolt12Invoice this_arg_conv;
53982         this_arg_conv.inner = untag_ptr(this_arg);
53983         this_arg_conv.is_owned = ptr_is_owned(this_arg);
53984         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
53985         this_arg_conv.is_owned = false;
53986         int64_t ret_conv = UnsignedBolt12Invoice_created_at(&this_arg_conv);
53987         return ret_conv;
53988 }
53989
53990 int64_t  __attribute__((export_name("TS_UnsignedBolt12Invoice_relative_expiry"))) TS_UnsignedBolt12Invoice_relative_expiry(uint64_t this_arg) {
53991         LDKUnsignedBolt12Invoice this_arg_conv;
53992         this_arg_conv.inner = untag_ptr(this_arg);
53993         this_arg_conv.is_owned = ptr_is_owned(this_arg);
53994         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
53995         this_arg_conv.is_owned = false;
53996         int64_t ret_conv = UnsignedBolt12Invoice_relative_expiry(&this_arg_conv);
53997         return ret_conv;
53998 }
53999
54000 int8_tArray  __attribute__((export_name("TS_UnsignedBolt12Invoice_payment_hash"))) TS_UnsignedBolt12Invoice_payment_hash(uint64_t this_arg) {
54001         LDKUnsignedBolt12Invoice this_arg_conv;
54002         this_arg_conv.inner = untag_ptr(this_arg);
54003         this_arg_conv.is_owned = ptr_is_owned(this_arg);
54004         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
54005         this_arg_conv.is_owned = false;
54006         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
54007         memcpy(ret_arr->elems, UnsignedBolt12Invoice_payment_hash(&this_arg_conv).data, 32);
54008         return ret_arr;
54009 }
54010
54011 int64_t  __attribute__((export_name("TS_UnsignedBolt12Invoice_amount_msats"))) TS_UnsignedBolt12Invoice_amount_msats(uint64_t this_arg) {
54012         LDKUnsignedBolt12Invoice this_arg_conv;
54013         this_arg_conv.inner = untag_ptr(this_arg);
54014         this_arg_conv.is_owned = ptr_is_owned(this_arg);
54015         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
54016         this_arg_conv.is_owned = false;
54017         int64_t ret_conv = UnsignedBolt12Invoice_amount_msats(&this_arg_conv);
54018         return ret_conv;
54019 }
54020
54021 uint64_t  __attribute__((export_name("TS_UnsignedBolt12Invoice_invoice_features"))) TS_UnsignedBolt12Invoice_invoice_features(uint64_t this_arg) {
54022         LDKUnsignedBolt12Invoice this_arg_conv;
54023         this_arg_conv.inner = untag_ptr(this_arg);
54024         this_arg_conv.is_owned = ptr_is_owned(this_arg);
54025         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
54026         this_arg_conv.is_owned = false;
54027         LDKBolt12InvoiceFeatures ret_var = UnsignedBolt12Invoice_invoice_features(&this_arg_conv);
54028         uint64_t ret_ref = 0;
54029         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
54030         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
54031         return ret_ref;
54032 }
54033
54034 int8_tArray  __attribute__((export_name("TS_UnsignedBolt12Invoice_signing_pubkey"))) TS_UnsignedBolt12Invoice_signing_pubkey(uint64_t this_arg) {
54035         LDKUnsignedBolt12Invoice this_arg_conv;
54036         this_arg_conv.inner = untag_ptr(this_arg);
54037         this_arg_conv.is_owned = ptr_is_owned(this_arg);
54038         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
54039         this_arg_conv.is_owned = false;
54040         int8_tArray ret_arr = init_int8_tArray(33, __LINE__);
54041         memcpy(ret_arr->elems, UnsignedBolt12Invoice_signing_pubkey(&this_arg_conv).compressed_form, 33);
54042         return ret_arr;
54043 }
54044
54045 uint64_t  __attribute__((export_name("TS_Bolt12Invoice_offer_chains"))) TS_Bolt12Invoice_offer_chains(uint64_t this_arg) {
54046         LDKBolt12Invoice this_arg_conv;
54047         this_arg_conv.inner = untag_ptr(this_arg);
54048         this_arg_conv.is_owned = ptr_is_owned(this_arg);
54049         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
54050         this_arg_conv.is_owned = false;
54051         LDKCOption_CVec_ThirtyTwoBytesZZ *ret_copy = MALLOC(sizeof(LDKCOption_CVec_ThirtyTwoBytesZZ), "LDKCOption_CVec_ThirtyTwoBytesZZ");
54052         *ret_copy = Bolt12Invoice_offer_chains(&this_arg_conv);
54053         uint64_t ret_ref = tag_ptr(ret_copy, true);
54054         return ret_ref;
54055 }
54056
54057 int8_tArray  __attribute__((export_name("TS_Bolt12Invoice_chain"))) TS_Bolt12Invoice_chain(uint64_t this_arg) {
54058         LDKBolt12Invoice this_arg_conv;
54059         this_arg_conv.inner = untag_ptr(this_arg);
54060         this_arg_conv.is_owned = ptr_is_owned(this_arg);
54061         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
54062         this_arg_conv.is_owned = false;
54063         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
54064         memcpy(ret_arr->elems, Bolt12Invoice_chain(&this_arg_conv).data, 32);
54065         return ret_arr;
54066 }
54067
54068 uint64_t  __attribute__((export_name("TS_Bolt12Invoice_metadata"))) TS_Bolt12Invoice_metadata(uint64_t this_arg) {
54069         LDKBolt12Invoice this_arg_conv;
54070         this_arg_conv.inner = untag_ptr(this_arg);
54071         this_arg_conv.is_owned = ptr_is_owned(this_arg);
54072         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
54073         this_arg_conv.is_owned = false;
54074         LDKCOption_CVec_u8ZZ *ret_copy = MALLOC(sizeof(LDKCOption_CVec_u8ZZ), "LDKCOption_CVec_u8ZZ");
54075         *ret_copy = Bolt12Invoice_metadata(&this_arg_conv);
54076         uint64_t ret_ref = tag_ptr(ret_copy, true);
54077         return ret_ref;
54078 }
54079
54080 uint64_t  __attribute__((export_name("TS_Bolt12Invoice_amount"))) TS_Bolt12Invoice_amount(uint64_t this_arg) {
54081         LDKBolt12Invoice this_arg_conv;
54082         this_arg_conv.inner = untag_ptr(this_arg);
54083         this_arg_conv.is_owned = ptr_is_owned(this_arg);
54084         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
54085         this_arg_conv.is_owned = false;
54086         LDKAmount ret_var = Bolt12Invoice_amount(&this_arg_conv);
54087         uint64_t ret_ref = 0;
54088         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
54089         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
54090         return ret_ref;
54091 }
54092
54093 uint64_t  __attribute__((export_name("TS_Bolt12Invoice_offer_features"))) TS_Bolt12Invoice_offer_features(uint64_t this_arg) {
54094         LDKBolt12Invoice this_arg_conv;
54095         this_arg_conv.inner = untag_ptr(this_arg);
54096         this_arg_conv.is_owned = ptr_is_owned(this_arg);
54097         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
54098         this_arg_conv.is_owned = false;
54099         LDKOfferFeatures ret_var = Bolt12Invoice_offer_features(&this_arg_conv);
54100         uint64_t ret_ref = 0;
54101         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
54102         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
54103         return ret_ref;
54104 }
54105
54106 uint64_t  __attribute__((export_name("TS_Bolt12Invoice_description"))) TS_Bolt12Invoice_description(uint64_t this_arg) {
54107         LDKBolt12Invoice this_arg_conv;
54108         this_arg_conv.inner = untag_ptr(this_arg);
54109         this_arg_conv.is_owned = ptr_is_owned(this_arg);
54110         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
54111         this_arg_conv.is_owned = false;
54112         LDKPrintableString ret_var = Bolt12Invoice_description(&this_arg_conv);
54113         uint64_t ret_ref = 0;
54114         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
54115         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
54116         return ret_ref;
54117 }
54118
54119 uint64_t  __attribute__((export_name("TS_Bolt12Invoice_absolute_expiry"))) TS_Bolt12Invoice_absolute_expiry(uint64_t this_arg) {
54120         LDKBolt12Invoice this_arg_conv;
54121         this_arg_conv.inner = untag_ptr(this_arg);
54122         this_arg_conv.is_owned = ptr_is_owned(this_arg);
54123         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
54124         this_arg_conv.is_owned = false;
54125         LDKCOption_u64Z *ret_copy = MALLOC(sizeof(LDKCOption_u64Z), "LDKCOption_u64Z");
54126         *ret_copy = Bolt12Invoice_absolute_expiry(&this_arg_conv);
54127         uint64_t ret_ref = tag_ptr(ret_copy, true);
54128         return ret_ref;
54129 }
54130
54131 uint64_t  __attribute__((export_name("TS_Bolt12Invoice_issuer"))) TS_Bolt12Invoice_issuer(uint64_t this_arg) {
54132         LDKBolt12Invoice this_arg_conv;
54133         this_arg_conv.inner = untag_ptr(this_arg);
54134         this_arg_conv.is_owned = ptr_is_owned(this_arg);
54135         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
54136         this_arg_conv.is_owned = false;
54137         LDKPrintableString ret_var = Bolt12Invoice_issuer(&this_arg_conv);
54138         uint64_t ret_ref = 0;
54139         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
54140         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
54141         return ret_ref;
54142 }
54143
54144 uint64_tArray  __attribute__((export_name("TS_Bolt12Invoice_message_paths"))) TS_Bolt12Invoice_message_paths(uint64_t this_arg) {
54145         LDKBolt12Invoice this_arg_conv;
54146         this_arg_conv.inner = untag_ptr(this_arg);
54147         this_arg_conv.is_owned = ptr_is_owned(this_arg);
54148         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
54149         this_arg_conv.is_owned = false;
54150         LDKCVec_BlindedPathZ ret_var = Bolt12Invoice_message_paths(&this_arg_conv);
54151         uint64_tArray ret_arr = NULL;
54152         ret_arr = init_uint64_tArray(ret_var.datalen, __LINE__);
54153         uint64_t *ret_arr_ptr = (uint64_t*)(((uint8_t*)ret_arr) + 8);
54154         for (size_t n = 0; n < ret_var.datalen; n++) {
54155                 LDKBlindedPath ret_conv_13_var = ret_var.data[n];
54156                 uint64_t ret_conv_13_ref = 0;
54157                 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_conv_13_var);
54158                 ret_conv_13_ref = tag_ptr(ret_conv_13_var.inner, ret_conv_13_var.is_owned);
54159                 ret_arr_ptr[n] = ret_conv_13_ref;
54160         }
54161         
54162         FREE(ret_var.data);
54163         return ret_arr;
54164 }
54165
54166 uint64_t  __attribute__((export_name("TS_Bolt12Invoice_supported_quantity"))) TS_Bolt12Invoice_supported_quantity(uint64_t this_arg) {
54167         LDKBolt12Invoice this_arg_conv;
54168         this_arg_conv.inner = untag_ptr(this_arg);
54169         this_arg_conv.is_owned = ptr_is_owned(this_arg);
54170         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
54171         this_arg_conv.is_owned = false;
54172         LDKQuantity ret_var = Bolt12Invoice_supported_quantity(&this_arg_conv);
54173         uint64_t ret_ref = 0;
54174         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
54175         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
54176         return ret_ref;
54177 }
54178
54179 int8_tArray  __attribute__((export_name("TS_Bolt12Invoice_payer_metadata"))) TS_Bolt12Invoice_payer_metadata(uint64_t this_arg) {
54180         LDKBolt12Invoice this_arg_conv;
54181         this_arg_conv.inner = untag_ptr(this_arg);
54182         this_arg_conv.is_owned = ptr_is_owned(this_arg);
54183         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
54184         this_arg_conv.is_owned = false;
54185         LDKu8slice ret_var = Bolt12Invoice_payer_metadata(&this_arg_conv);
54186         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
54187         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
54188         return ret_arr;
54189 }
54190
54191 uint64_t  __attribute__((export_name("TS_Bolt12Invoice_invoice_request_features"))) TS_Bolt12Invoice_invoice_request_features(uint64_t this_arg) {
54192         LDKBolt12Invoice this_arg_conv;
54193         this_arg_conv.inner = untag_ptr(this_arg);
54194         this_arg_conv.is_owned = ptr_is_owned(this_arg);
54195         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
54196         this_arg_conv.is_owned = false;
54197         LDKInvoiceRequestFeatures ret_var = Bolt12Invoice_invoice_request_features(&this_arg_conv);
54198         uint64_t ret_ref = 0;
54199         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
54200         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
54201         return ret_ref;
54202 }
54203
54204 uint64_t  __attribute__((export_name("TS_Bolt12Invoice_quantity"))) TS_Bolt12Invoice_quantity(uint64_t this_arg) {
54205         LDKBolt12Invoice this_arg_conv;
54206         this_arg_conv.inner = untag_ptr(this_arg);
54207         this_arg_conv.is_owned = ptr_is_owned(this_arg);
54208         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
54209         this_arg_conv.is_owned = false;
54210         LDKCOption_u64Z *ret_copy = MALLOC(sizeof(LDKCOption_u64Z), "LDKCOption_u64Z");
54211         *ret_copy = Bolt12Invoice_quantity(&this_arg_conv);
54212         uint64_t ret_ref = tag_ptr(ret_copy, true);
54213         return ret_ref;
54214 }
54215
54216 int8_tArray  __attribute__((export_name("TS_Bolt12Invoice_payer_id"))) TS_Bolt12Invoice_payer_id(uint64_t this_arg) {
54217         LDKBolt12Invoice this_arg_conv;
54218         this_arg_conv.inner = untag_ptr(this_arg);
54219         this_arg_conv.is_owned = ptr_is_owned(this_arg);
54220         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
54221         this_arg_conv.is_owned = false;
54222         int8_tArray ret_arr = init_int8_tArray(33, __LINE__);
54223         memcpy(ret_arr->elems, Bolt12Invoice_payer_id(&this_arg_conv).compressed_form, 33);
54224         return ret_arr;
54225 }
54226
54227 uint64_t  __attribute__((export_name("TS_Bolt12Invoice_payer_note"))) TS_Bolt12Invoice_payer_note(uint64_t this_arg) {
54228         LDKBolt12Invoice this_arg_conv;
54229         this_arg_conv.inner = untag_ptr(this_arg);
54230         this_arg_conv.is_owned = ptr_is_owned(this_arg);
54231         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
54232         this_arg_conv.is_owned = false;
54233         LDKPrintableString ret_var = Bolt12Invoice_payer_note(&this_arg_conv);
54234         uint64_t ret_ref = 0;
54235         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
54236         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
54237         return ret_ref;
54238 }
54239
54240 int64_t  __attribute__((export_name("TS_Bolt12Invoice_created_at"))) TS_Bolt12Invoice_created_at(uint64_t this_arg) {
54241         LDKBolt12Invoice this_arg_conv;
54242         this_arg_conv.inner = untag_ptr(this_arg);
54243         this_arg_conv.is_owned = ptr_is_owned(this_arg);
54244         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
54245         this_arg_conv.is_owned = false;
54246         int64_t ret_conv = Bolt12Invoice_created_at(&this_arg_conv);
54247         return ret_conv;
54248 }
54249
54250 int64_t  __attribute__((export_name("TS_Bolt12Invoice_relative_expiry"))) TS_Bolt12Invoice_relative_expiry(uint64_t this_arg) {
54251         LDKBolt12Invoice this_arg_conv;
54252         this_arg_conv.inner = untag_ptr(this_arg);
54253         this_arg_conv.is_owned = ptr_is_owned(this_arg);
54254         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
54255         this_arg_conv.is_owned = false;
54256         int64_t ret_conv = Bolt12Invoice_relative_expiry(&this_arg_conv);
54257         return ret_conv;
54258 }
54259
54260 int8_tArray  __attribute__((export_name("TS_Bolt12Invoice_payment_hash"))) TS_Bolt12Invoice_payment_hash(uint64_t this_arg) {
54261         LDKBolt12Invoice this_arg_conv;
54262         this_arg_conv.inner = untag_ptr(this_arg);
54263         this_arg_conv.is_owned = ptr_is_owned(this_arg);
54264         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
54265         this_arg_conv.is_owned = false;
54266         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
54267         memcpy(ret_arr->elems, Bolt12Invoice_payment_hash(&this_arg_conv).data, 32);
54268         return ret_arr;
54269 }
54270
54271 int64_t  __attribute__((export_name("TS_Bolt12Invoice_amount_msats"))) TS_Bolt12Invoice_amount_msats(uint64_t this_arg) {
54272         LDKBolt12Invoice this_arg_conv;
54273         this_arg_conv.inner = untag_ptr(this_arg);
54274         this_arg_conv.is_owned = ptr_is_owned(this_arg);
54275         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
54276         this_arg_conv.is_owned = false;
54277         int64_t ret_conv = Bolt12Invoice_amount_msats(&this_arg_conv);
54278         return ret_conv;
54279 }
54280
54281 uint64_t  __attribute__((export_name("TS_Bolt12Invoice_invoice_features"))) TS_Bolt12Invoice_invoice_features(uint64_t this_arg) {
54282         LDKBolt12Invoice this_arg_conv;
54283         this_arg_conv.inner = untag_ptr(this_arg);
54284         this_arg_conv.is_owned = ptr_is_owned(this_arg);
54285         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
54286         this_arg_conv.is_owned = false;
54287         LDKBolt12InvoiceFeatures ret_var = Bolt12Invoice_invoice_features(&this_arg_conv);
54288         uint64_t ret_ref = 0;
54289         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
54290         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
54291         return ret_ref;
54292 }
54293
54294 int8_tArray  __attribute__((export_name("TS_Bolt12Invoice_signing_pubkey"))) TS_Bolt12Invoice_signing_pubkey(uint64_t this_arg) {
54295         LDKBolt12Invoice this_arg_conv;
54296         this_arg_conv.inner = untag_ptr(this_arg);
54297         this_arg_conv.is_owned = ptr_is_owned(this_arg);
54298         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
54299         this_arg_conv.is_owned = false;
54300         int8_tArray ret_arr = init_int8_tArray(33, __LINE__);
54301         memcpy(ret_arr->elems, Bolt12Invoice_signing_pubkey(&this_arg_conv).compressed_form, 33);
54302         return ret_arr;
54303 }
54304
54305 int8_tArray  __attribute__((export_name("TS_Bolt12Invoice_signature"))) TS_Bolt12Invoice_signature(uint64_t this_arg) {
54306         LDKBolt12Invoice this_arg_conv;
54307         this_arg_conv.inner = untag_ptr(this_arg);
54308         this_arg_conv.is_owned = ptr_is_owned(this_arg);
54309         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
54310         this_arg_conv.is_owned = false;
54311         int8_tArray ret_arr = init_int8_tArray(64, __LINE__);
54312         memcpy(ret_arr->elems, Bolt12Invoice_signature(&this_arg_conv).compact_form, 64);
54313         return ret_arr;
54314 }
54315
54316 int8_tArray  __attribute__((export_name("TS_Bolt12Invoice_signable_hash"))) TS_Bolt12Invoice_signable_hash(uint64_t this_arg) {
54317         LDKBolt12Invoice this_arg_conv;
54318         this_arg_conv.inner = untag_ptr(this_arg);
54319         this_arg_conv.is_owned = ptr_is_owned(this_arg);
54320         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
54321         this_arg_conv.is_owned = false;
54322         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
54323         memcpy(ret_arr->elems, Bolt12Invoice_signable_hash(&this_arg_conv).data, 32);
54324         return ret_arr;
54325 }
54326
54327 uint64_t  __attribute__((export_name("TS_Bolt12Invoice_verify"))) TS_Bolt12Invoice_verify(uint64_t this_arg, uint64_t key) {
54328         LDKBolt12Invoice this_arg_conv;
54329         this_arg_conv.inner = untag_ptr(this_arg);
54330         this_arg_conv.is_owned = ptr_is_owned(this_arg);
54331         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
54332         this_arg_conv.is_owned = false;
54333         LDKExpandedKey key_conv;
54334         key_conv.inner = untag_ptr(key);
54335         key_conv.is_owned = ptr_is_owned(key);
54336         CHECK_INNER_FIELD_ACCESS_OR_NULL(key_conv);
54337         key_conv.is_owned = false;
54338         LDKCResult_ThirtyTwoBytesNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_ThirtyTwoBytesNoneZ), "LDKCResult_ThirtyTwoBytesNoneZ");
54339         *ret_conv = Bolt12Invoice_verify(&this_arg_conv, &key_conv);
54340         return tag_ptr(ret_conv, true);
54341 }
54342
54343 int8_tArray  __attribute__((export_name("TS_UnsignedBolt12Invoice_write"))) TS_UnsignedBolt12Invoice_write(uint64_t obj) {
54344         LDKUnsignedBolt12Invoice obj_conv;
54345         obj_conv.inner = untag_ptr(obj);
54346         obj_conv.is_owned = ptr_is_owned(obj);
54347         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
54348         obj_conv.is_owned = false;
54349         LDKCVec_u8Z ret_var = UnsignedBolt12Invoice_write(&obj_conv);
54350         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
54351         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
54352         CVec_u8Z_free(ret_var);
54353         return ret_arr;
54354 }
54355
54356 int8_tArray  __attribute__((export_name("TS_Bolt12Invoice_write"))) TS_Bolt12Invoice_write(uint64_t obj) {
54357         LDKBolt12Invoice obj_conv;
54358         obj_conv.inner = untag_ptr(obj);
54359         obj_conv.is_owned = ptr_is_owned(obj);
54360         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
54361         obj_conv.is_owned = false;
54362         LDKCVec_u8Z ret_var = Bolt12Invoice_write(&obj_conv);
54363         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
54364         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
54365         CVec_u8Z_free(ret_var);
54366         return ret_arr;
54367 }
54368
54369 void  __attribute__((export_name("TS_BlindedPayInfo_free"))) TS_BlindedPayInfo_free(uint64_t this_obj) {
54370         LDKBlindedPayInfo this_obj_conv;
54371         this_obj_conv.inner = untag_ptr(this_obj);
54372         this_obj_conv.is_owned = ptr_is_owned(this_obj);
54373         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
54374         BlindedPayInfo_free(this_obj_conv);
54375 }
54376
54377 int32_t  __attribute__((export_name("TS_BlindedPayInfo_get_fee_base_msat"))) TS_BlindedPayInfo_get_fee_base_msat(uint64_t this_ptr) {
54378         LDKBlindedPayInfo this_ptr_conv;
54379         this_ptr_conv.inner = untag_ptr(this_ptr);
54380         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
54381         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
54382         this_ptr_conv.is_owned = false;
54383         int32_t ret_conv = BlindedPayInfo_get_fee_base_msat(&this_ptr_conv);
54384         return ret_conv;
54385 }
54386
54387 void  __attribute__((export_name("TS_BlindedPayInfo_set_fee_base_msat"))) TS_BlindedPayInfo_set_fee_base_msat(uint64_t this_ptr, int32_t val) {
54388         LDKBlindedPayInfo this_ptr_conv;
54389         this_ptr_conv.inner = untag_ptr(this_ptr);
54390         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
54391         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
54392         this_ptr_conv.is_owned = false;
54393         BlindedPayInfo_set_fee_base_msat(&this_ptr_conv, val);
54394 }
54395
54396 int32_t  __attribute__((export_name("TS_BlindedPayInfo_get_fee_proportional_millionths"))) TS_BlindedPayInfo_get_fee_proportional_millionths(uint64_t this_ptr) {
54397         LDKBlindedPayInfo this_ptr_conv;
54398         this_ptr_conv.inner = untag_ptr(this_ptr);
54399         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
54400         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
54401         this_ptr_conv.is_owned = false;
54402         int32_t ret_conv = BlindedPayInfo_get_fee_proportional_millionths(&this_ptr_conv);
54403         return ret_conv;
54404 }
54405
54406 void  __attribute__((export_name("TS_BlindedPayInfo_set_fee_proportional_millionths"))) TS_BlindedPayInfo_set_fee_proportional_millionths(uint64_t this_ptr, int32_t val) {
54407         LDKBlindedPayInfo this_ptr_conv;
54408         this_ptr_conv.inner = untag_ptr(this_ptr);
54409         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
54410         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
54411         this_ptr_conv.is_owned = false;
54412         BlindedPayInfo_set_fee_proportional_millionths(&this_ptr_conv, val);
54413 }
54414
54415 int16_t  __attribute__((export_name("TS_BlindedPayInfo_get_cltv_expiry_delta"))) TS_BlindedPayInfo_get_cltv_expiry_delta(uint64_t this_ptr) {
54416         LDKBlindedPayInfo this_ptr_conv;
54417         this_ptr_conv.inner = untag_ptr(this_ptr);
54418         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
54419         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
54420         this_ptr_conv.is_owned = false;
54421         int16_t ret_conv = BlindedPayInfo_get_cltv_expiry_delta(&this_ptr_conv);
54422         return ret_conv;
54423 }
54424
54425 void  __attribute__((export_name("TS_BlindedPayInfo_set_cltv_expiry_delta"))) TS_BlindedPayInfo_set_cltv_expiry_delta(uint64_t this_ptr, int16_t val) {
54426         LDKBlindedPayInfo this_ptr_conv;
54427         this_ptr_conv.inner = untag_ptr(this_ptr);
54428         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
54429         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
54430         this_ptr_conv.is_owned = false;
54431         BlindedPayInfo_set_cltv_expiry_delta(&this_ptr_conv, val);
54432 }
54433
54434 int64_t  __attribute__((export_name("TS_BlindedPayInfo_get_htlc_minimum_msat"))) TS_BlindedPayInfo_get_htlc_minimum_msat(uint64_t this_ptr) {
54435         LDKBlindedPayInfo this_ptr_conv;
54436         this_ptr_conv.inner = untag_ptr(this_ptr);
54437         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
54438         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
54439         this_ptr_conv.is_owned = false;
54440         int64_t ret_conv = BlindedPayInfo_get_htlc_minimum_msat(&this_ptr_conv);
54441         return ret_conv;
54442 }
54443
54444 void  __attribute__((export_name("TS_BlindedPayInfo_set_htlc_minimum_msat"))) TS_BlindedPayInfo_set_htlc_minimum_msat(uint64_t this_ptr, int64_t val) {
54445         LDKBlindedPayInfo this_ptr_conv;
54446         this_ptr_conv.inner = untag_ptr(this_ptr);
54447         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
54448         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
54449         this_ptr_conv.is_owned = false;
54450         BlindedPayInfo_set_htlc_minimum_msat(&this_ptr_conv, val);
54451 }
54452
54453 int64_t  __attribute__((export_name("TS_BlindedPayInfo_get_htlc_maximum_msat"))) TS_BlindedPayInfo_get_htlc_maximum_msat(uint64_t this_ptr) {
54454         LDKBlindedPayInfo this_ptr_conv;
54455         this_ptr_conv.inner = untag_ptr(this_ptr);
54456         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
54457         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
54458         this_ptr_conv.is_owned = false;
54459         int64_t ret_conv = BlindedPayInfo_get_htlc_maximum_msat(&this_ptr_conv);
54460         return ret_conv;
54461 }
54462
54463 void  __attribute__((export_name("TS_BlindedPayInfo_set_htlc_maximum_msat"))) TS_BlindedPayInfo_set_htlc_maximum_msat(uint64_t this_ptr, int64_t val) {
54464         LDKBlindedPayInfo this_ptr_conv;
54465         this_ptr_conv.inner = untag_ptr(this_ptr);
54466         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
54467         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
54468         this_ptr_conv.is_owned = false;
54469         BlindedPayInfo_set_htlc_maximum_msat(&this_ptr_conv, val);
54470 }
54471
54472 uint64_t  __attribute__((export_name("TS_BlindedPayInfo_get_features"))) TS_BlindedPayInfo_get_features(uint64_t this_ptr) {
54473         LDKBlindedPayInfo this_ptr_conv;
54474         this_ptr_conv.inner = untag_ptr(this_ptr);
54475         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
54476         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
54477         this_ptr_conv.is_owned = false;
54478         LDKBlindedHopFeatures ret_var = BlindedPayInfo_get_features(&this_ptr_conv);
54479         uint64_t ret_ref = 0;
54480         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
54481         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
54482         return ret_ref;
54483 }
54484
54485 void  __attribute__((export_name("TS_BlindedPayInfo_set_features"))) TS_BlindedPayInfo_set_features(uint64_t this_ptr, uint64_t val) {
54486         LDKBlindedPayInfo this_ptr_conv;
54487         this_ptr_conv.inner = untag_ptr(this_ptr);
54488         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
54489         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
54490         this_ptr_conv.is_owned = false;
54491         LDKBlindedHopFeatures val_conv;
54492         val_conv.inner = untag_ptr(val);
54493         val_conv.is_owned = ptr_is_owned(val);
54494         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
54495         val_conv = BlindedHopFeatures_clone(&val_conv);
54496         BlindedPayInfo_set_features(&this_ptr_conv, val_conv);
54497 }
54498
54499 uint64_t  __attribute__((export_name("TS_BlindedPayInfo_new"))) TS_BlindedPayInfo_new(int32_t fee_base_msat_arg, int32_t fee_proportional_millionths_arg, int16_t cltv_expiry_delta_arg, int64_t htlc_minimum_msat_arg, int64_t htlc_maximum_msat_arg, uint64_t features_arg) {
54500         LDKBlindedHopFeatures features_arg_conv;
54501         features_arg_conv.inner = untag_ptr(features_arg);
54502         features_arg_conv.is_owned = ptr_is_owned(features_arg);
54503         CHECK_INNER_FIELD_ACCESS_OR_NULL(features_arg_conv);
54504         features_arg_conv = BlindedHopFeatures_clone(&features_arg_conv);
54505         LDKBlindedPayInfo ret_var = BlindedPayInfo_new(fee_base_msat_arg, fee_proportional_millionths_arg, cltv_expiry_delta_arg, htlc_minimum_msat_arg, htlc_maximum_msat_arg, features_arg_conv);
54506         uint64_t ret_ref = 0;
54507         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
54508         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
54509         return ret_ref;
54510 }
54511
54512 static inline uint64_t BlindedPayInfo_clone_ptr(LDKBlindedPayInfo *NONNULL_PTR arg) {
54513         LDKBlindedPayInfo ret_var = BlindedPayInfo_clone(arg);
54514         uint64_t ret_ref = 0;
54515         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
54516         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
54517         return ret_ref;
54518 }
54519 int64_t  __attribute__((export_name("TS_BlindedPayInfo_clone_ptr"))) TS_BlindedPayInfo_clone_ptr(uint64_t arg) {
54520         LDKBlindedPayInfo arg_conv;
54521         arg_conv.inner = untag_ptr(arg);
54522         arg_conv.is_owned = ptr_is_owned(arg);
54523         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
54524         arg_conv.is_owned = false;
54525         int64_t ret_conv = BlindedPayInfo_clone_ptr(&arg_conv);
54526         return ret_conv;
54527 }
54528
54529 uint64_t  __attribute__((export_name("TS_BlindedPayInfo_clone"))) TS_BlindedPayInfo_clone(uint64_t orig) {
54530         LDKBlindedPayInfo orig_conv;
54531         orig_conv.inner = untag_ptr(orig);
54532         orig_conv.is_owned = ptr_is_owned(orig);
54533         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
54534         orig_conv.is_owned = false;
54535         LDKBlindedPayInfo ret_var = BlindedPayInfo_clone(&orig_conv);
54536         uint64_t ret_ref = 0;
54537         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
54538         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
54539         return ret_ref;
54540 }
54541
54542 int64_t  __attribute__((export_name("TS_BlindedPayInfo_hash"))) TS_BlindedPayInfo_hash(uint64_t o) {
54543         LDKBlindedPayInfo o_conv;
54544         o_conv.inner = untag_ptr(o);
54545         o_conv.is_owned = ptr_is_owned(o);
54546         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
54547         o_conv.is_owned = false;
54548         int64_t ret_conv = BlindedPayInfo_hash(&o_conv);
54549         return ret_conv;
54550 }
54551
54552 jboolean  __attribute__((export_name("TS_BlindedPayInfo_eq"))) TS_BlindedPayInfo_eq(uint64_t a, uint64_t b) {
54553         LDKBlindedPayInfo a_conv;
54554         a_conv.inner = untag_ptr(a);
54555         a_conv.is_owned = ptr_is_owned(a);
54556         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
54557         a_conv.is_owned = false;
54558         LDKBlindedPayInfo b_conv;
54559         b_conv.inner = untag_ptr(b);
54560         b_conv.is_owned = ptr_is_owned(b);
54561         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
54562         b_conv.is_owned = false;
54563         jboolean ret_conv = BlindedPayInfo_eq(&a_conv, &b_conv);
54564         return ret_conv;
54565 }
54566
54567 int8_tArray  __attribute__((export_name("TS_BlindedPayInfo_write"))) TS_BlindedPayInfo_write(uint64_t obj) {
54568         LDKBlindedPayInfo obj_conv;
54569         obj_conv.inner = untag_ptr(obj);
54570         obj_conv.is_owned = ptr_is_owned(obj);
54571         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
54572         obj_conv.is_owned = false;
54573         LDKCVec_u8Z ret_var = BlindedPayInfo_write(&obj_conv);
54574         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
54575         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
54576         CVec_u8Z_free(ret_var);
54577         return ret_arr;
54578 }
54579
54580 uint64_t  __attribute__((export_name("TS_BlindedPayInfo_read"))) TS_BlindedPayInfo_read(int8_tArray ser) {
54581         LDKu8slice ser_ref;
54582         ser_ref.datalen = ser->arr_len;
54583         ser_ref.data = ser->elems;
54584         LDKCResult_BlindedPayInfoDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_BlindedPayInfoDecodeErrorZ), "LDKCResult_BlindedPayInfoDecodeErrorZ");
54585         *ret_conv = BlindedPayInfo_read(ser_ref);
54586         FREE(ser);
54587         return tag_ptr(ret_conv, true);
54588 }
54589
54590 void  __attribute__((export_name("TS_InvoiceError_free"))) TS_InvoiceError_free(uint64_t this_obj) {
54591         LDKInvoiceError this_obj_conv;
54592         this_obj_conv.inner = untag_ptr(this_obj);
54593         this_obj_conv.is_owned = ptr_is_owned(this_obj);
54594         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
54595         InvoiceError_free(this_obj_conv);
54596 }
54597
54598 uint64_t  __attribute__((export_name("TS_InvoiceError_get_erroneous_field"))) TS_InvoiceError_get_erroneous_field(uint64_t this_ptr) {
54599         LDKInvoiceError this_ptr_conv;
54600         this_ptr_conv.inner = untag_ptr(this_ptr);
54601         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
54602         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
54603         this_ptr_conv.is_owned = false;
54604         LDKErroneousField ret_var = InvoiceError_get_erroneous_field(&this_ptr_conv);
54605         uint64_t ret_ref = 0;
54606         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
54607         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
54608         return ret_ref;
54609 }
54610
54611 void  __attribute__((export_name("TS_InvoiceError_set_erroneous_field"))) TS_InvoiceError_set_erroneous_field(uint64_t this_ptr, uint64_t val) {
54612         LDKInvoiceError this_ptr_conv;
54613         this_ptr_conv.inner = untag_ptr(this_ptr);
54614         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
54615         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
54616         this_ptr_conv.is_owned = false;
54617         LDKErroneousField val_conv;
54618         val_conv.inner = untag_ptr(val);
54619         val_conv.is_owned = ptr_is_owned(val);
54620         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
54621         val_conv = ErroneousField_clone(&val_conv);
54622         InvoiceError_set_erroneous_field(&this_ptr_conv, val_conv);
54623 }
54624
54625 uint64_t  __attribute__((export_name("TS_InvoiceError_get_message"))) TS_InvoiceError_get_message(uint64_t this_ptr) {
54626         LDKInvoiceError this_ptr_conv;
54627         this_ptr_conv.inner = untag_ptr(this_ptr);
54628         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
54629         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
54630         this_ptr_conv.is_owned = false;
54631         LDKUntrustedString ret_var = InvoiceError_get_message(&this_ptr_conv);
54632         uint64_t ret_ref = 0;
54633         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
54634         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
54635         return ret_ref;
54636 }
54637
54638 void  __attribute__((export_name("TS_InvoiceError_set_message"))) TS_InvoiceError_set_message(uint64_t this_ptr, uint64_t val) {
54639         LDKInvoiceError this_ptr_conv;
54640         this_ptr_conv.inner = untag_ptr(this_ptr);
54641         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
54642         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
54643         this_ptr_conv.is_owned = false;
54644         LDKUntrustedString val_conv;
54645         val_conv.inner = untag_ptr(val);
54646         val_conv.is_owned = ptr_is_owned(val);
54647         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
54648         val_conv = UntrustedString_clone(&val_conv);
54649         InvoiceError_set_message(&this_ptr_conv, val_conv);
54650 }
54651
54652 uint64_t  __attribute__((export_name("TS_InvoiceError_new"))) TS_InvoiceError_new(uint64_t erroneous_field_arg, uint64_t message_arg) {
54653         LDKErroneousField erroneous_field_arg_conv;
54654         erroneous_field_arg_conv.inner = untag_ptr(erroneous_field_arg);
54655         erroneous_field_arg_conv.is_owned = ptr_is_owned(erroneous_field_arg);
54656         CHECK_INNER_FIELD_ACCESS_OR_NULL(erroneous_field_arg_conv);
54657         erroneous_field_arg_conv = ErroneousField_clone(&erroneous_field_arg_conv);
54658         LDKUntrustedString message_arg_conv;
54659         message_arg_conv.inner = untag_ptr(message_arg);
54660         message_arg_conv.is_owned = ptr_is_owned(message_arg);
54661         CHECK_INNER_FIELD_ACCESS_OR_NULL(message_arg_conv);
54662         message_arg_conv = UntrustedString_clone(&message_arg_conv);
54663         LDKInvoiceError ret_var = InvoiceError_new(erroneous_field_arg_conv, message_arg_conv);
54664         uint64_t ret_ref = 0;
54665         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
54666         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
54667         return ret_ref;
54668 }
54669
54670 static inline uint64_t InvoiceError_clone_ptr(LDKInvoiceError *NONNULL_PTR arg) {
54671         LDKInvoiceError ret_var = InvoiceError_clone(arg);
54672         uint64_t ret_ref = 0;
54673         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
54674         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
54675         return ret_ref;
54676 }
54677 int64_t  __attribute__((export_name("TS_InvoiceError_clone_ptr"))) TS_InvoiceError_clone_ptr(uint64_t arg) {
54678         LDKInvoiceError arg_conv;
54679         arg_conv.inner = untag_ptr(arg);
54680         arg_conv.is_owned = ptr_is_owned(arg);
54681         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
54682         arg_conv.is_owned = false;
54683         int64_t ret_conv = InvoiceError_clone_ptr(&arg_conv);
54684         return ret_conv;
54685 }
54686
54687 uint64_t  __attribute__((export_name("TS_InvoiceError_clone"))) TS_InvoiceError_clone(uint64_t orig) {
54688         LDKInvoiceError orig_conv;
54689         orig_conv.inner = untag_ptr(orig);
54690         orig_conv.is_owned = ptr_is_owned(orig);
54691         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
54692         orig_conv.is_owned = false;
54693         LDKInvoiceError ret_var = InvoiceError_clone(&orig_conv);
54694         uint64_t ret_ref = 0;
54695         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
54696         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
54697         return ret_ref;
54698 }
54699
54700 void  __attribute__((export_name("TS_ErroneousField_free"))) TS_ErroneousField_free(uint64_t this_obj) {
54701         LDKErroneousField this_obj_conv;
54702         this_obj_conv.inner = untag_ptr(this_obj);
54703         this_obj_conv.is_owned = ptr_is_owned(this_obj);
54704         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
54705         ErroneousField_free(this_obj_conv);
54706 }
54707
54708 int64_t  __attribute__((export_name("TS_ErroneousField_get_tlv_fieldnum"))) TS_ErroneousField_get_tlv_fieldnum(uint64_t this_ptr) {
54709         LDKErroneousField this_ptr_conv;
54710         this_ptr_conv.inner = untag_ptr(this_ptr);
54711         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
54712         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
54713         this_ptr_conv.is_owned = false;
54714         int64_t ret_conv = ErroneousField_get_tlv_fieldnum(&this_ptr_conv);
54715         return ret_conv;
54716 }
54717
54718 void  __attribute__((export_name("TS_ErroneousField_set_tlv_fieldnum"))) TS_ErroneousField_set_tlv_fieldnum(uint64_t this_ptr, int64_t val) {
54719         LDKErroneousField this_ptr_conv;
54720         this_ptr_conv.inner = untag_ptr(this_ptr);
54721         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
54722         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
54723         this_ptr_conv.is_owned = false;
54724         ErroneousField_set_tlv_fieldnum(&this_ptr_conv, val);
54725 }
54726
54727 uint64_t  __attribute__((export_name("TS_ErroneousField_get_suggested_value"))) TS_ErroneousField_get_suggested_value(uint64_t this_ptr) {
54728         LDKErroneousField this_ptr_conv;
54729         this_ptr_conv.inner = untag_ptr(this_ptr);
54730         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
54731         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
54732         this_ptr_conv.is_owned = false;
54733         LDKCOption_CVec_u8ZZ *ret_copy = MALLOC(sizeof(LDKCOption_CVec_u8ZZ), "LDKCOption_CVec_u8ZZ");
54734         *ret_copy = ErroneousField_get_suggested_value(&this_ptr_conv);
54735         uint64_t ret_ref = tag_ptr(ret_copy, true);
54736         return ret_ref;
54737 }
54738
54739 void  __attribute__((export_name("TS_ErroneousField_set_suggested_value"))) TS_ErroneousField_set_suggested_value(uint64_t this_ptr, uint64_t val) {
54740         LDKErroneousField this_ptr_conv;
54741         this_ptr_conv.inner = untag_ptr(this_ptr);
54742         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
54743         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
54744         this_ptr_conv.is_owned = false;
54745         void* val_ptr = untag_ptr(val);
54746         CHECK_ACCESS(val_ptr);
54747         LDKCOption_CVec_u8ZZ val_conv = *(LDKCOption_CVec_u8ZZ*)(val_ptr);
54748         val_conv = COption_CVec_u8ZZ_clone((LDKCOption_CVec_u8ZZ*)untag_ptr(val));
54749         ErroneousField_set_suggested_value(&this_ptr_conv, val_conv);
54750 }
54751
54752 uint64_t  __attribute__((export_name("TS_ErroneousField_new"))) TS_ErroneousField_new(int64_t tlv_fieldnum_arg, uint64_t suggested_value_arg) {
54753         void* suggested_value_arg_ptr = untag_ptr(suggested_value_arg);
54754         CHECK_ACCESS(suggested_value_arg_ptr);
54755         LDKCOption_CVec_u8ZZ suggested_value_arg_conv = *(LDKCOption_CVec_u8ZZ*)(suggested_value_arg_ptr);
54756         suggested_value_arg_conv = COption_CVec_u8ZZ_clone((LDKCOption_CVec_u8ZZ*)untag_ptr(suggested_value_arg));
54757         LDKErroneousField ret_var = ErroneousField_new(tlv_fieldnum_arg, suggested_value_arg_conv);
54758         uint64_t ret_ref = 0;
54759         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
54760         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
54761         return ret_ref;
54762 }
54763
54764 static inline uint64_t ErroneousField_clone_ptr(LDKErroneousField *NONNULL_PTR arg) {
54765         LDKErroneousField ret_var = ErroneousField_clone(arg);
54766         uint64_t ret_ref = 0;
54767         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
54768         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
54769         return ret_ref;
54770 }
54771 int64_t  __attribute__((export_name("TS_ErroneousField_clone_ptr"))) TS_ErroneousField_clone_ptr(uint64_t arg) {
54772         LDKErroneousField arg_conv;
54773         arg_conv.inner = untag_ptr(arg);
54774         arg_conv.is_owned = ptr_is_owned(arg);
54775         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
54776         arg_conv.is_owned = false;
54777         int64_t ret_conv = ErroneousField_clone_ptr(&arg_conv);
54778         return ret_conv;
54779 }
54780
54781 uint64_t  __attribute__((export_name("TS_ErroneousField_clone"))) TS_ErroneousField_clone(uint64_t orig) {
54782         LDKErroneousField orig_conv;
54783         orig_conv.inner = untag_ptr(orig);
54784         orig_conv.is_owned = ptr_is_owned(orig);
54785         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
54786         orig_conv.is_owned = false;
54787         LDKErroneousField ret_var = ErroneousField_clone(&orig_conv);
54788         uint64_t ret_ref = 0;
54789         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
54790         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
54791         return ret_ref;
54792 }
54793
54794 uint64_t  __attribute__((export_name("TS_InvoiceError_from_string"))) TS_InvoiceError_from_string(jstring s) {
54795         LDKStr s_conv = str_ref_to_owned_c(s);
54796         LDKInvoiceError ret_var = InvoiceError_from_string(s_conv);
54797         uint64_t ret_ref = 0;
54798         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
54799         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
54800         return ret_ref;
54801 }
54802
54803 int8_tArray  __attribute__((export_name("TS_InvoiceError_write"))) TS_InvoiceError_write(uint64_t obj) {
54804         LDKInvoiceError obj_conv;
54805         obj_conv.inner = untag_ptr(obj);
54806         obj_conv.is_owned = ptr_is_owned(obj);
54807         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
54808         obj_conv.is_owned = false;
54809         LDKCVec_u8Z ret_var = InvoiceError_write(&obj_conv);
54810         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
54811         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
54812         CVec_u8Z_free(ret_var);
54813         return ret_arr;
54814 }
54815
54816 uint64_t  __attribute__((export_name("TS_InvoiceError_read"))) TS_InvoiceError_read(int8_tArray ser) {
54817         LDKu8slice ser_ref;
54818         ser_ref.datalen = ser->arr_len;
54819         ser_ref.data = ser->elems;
54820         LDKCResult_InvoiceErrorDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InvoiceErrorDecodeErrorZ), "LDKCResult_InvoiceErrorDecodeErrorZ");
54821         *ret_conv = InvoiceError_read(ser_ref);
54822         FREE(ser);
54823         return tag_ptr(ret_conv, true);
54824 }
54825
54826 void  __attribute__((export_name("TS_UnsignedInvoiceRequest_free"))) TS_UnsignedInvoiceRequest_free(uint64_t this_obj) {
54827         LDKUnsignedInvoiceRequest this_obj_conv;
54828         this_obj_conv.inner = untag_ptr(this_obj);
54829         this_obj_conv.is_owned = ptr_is_owned(this_obj);
54830         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
54831         UnsignedInvoiceRequest_free(this_obj_conv);
54832 }
54833
54834 uint64_t  __attribute__((export_name("TS_UnsignedInvoiceRequest_tagged_hash"))) TS_UnsignedInvoiceRequest_tagged_hash(uint64_t this_arg) {
54835         LDKUnsignedInvoiceRequest this_arg_conv;
54836         this_arg_conv.inner = untag_ptr(this_arg);
54837         this_arg_conv.is_owned = ptr_is_owned(this_arg);
54838         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
54839         this_arg_conv.is_owned = false;
54840         LDKTaggedHash ret_var = UnsignedInvoiceRequest_tagged_hash(&this_arg_conv);
54841         uint64_t ret_ref = 0;
54842         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
54843         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
54844         return ret_ref;
54845 }
54846
54847 void  __attribute__((export_name("TS_InvoiceRequest_free"))) TS_InvoiceRequest_free(uint64_t this_obj) {
54848         LDKInvoiceRequest this_obj_conv;
54849         this_obj_conv.inner = untag_ptr(this_obj);
54850         this_obj_conv.is_owned = ptr_is_owned(this_obj);
54851         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
54852         InvoiceRequest_free(this_obj_conv);
54853 }
54854
54855 static inline uint64_t InvoiceRequest_clone_ptr(LDKInvoiceRequest *NONNULL_PTR arg) {
54856         LDKInvoiceRequest ret_var = InvoiceRequest_clone(arg);
54857         uint64_t ret_ref = 0;
54858         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
54859         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
54860         return ret_ref;
54861 }
54862 int64_t  __attribute__((export_name("TS_InvoiceRequest_clone_ptr"))) TS_InvoiceRequest_clone_ptr(uint64_t arg) {
54863         LDKInvoiceRequest arg_conv;
54864         arg_conv.inner = untag_ptr(arg);
54865         arg_conv.is_owned = ptr_is_owned(arg);
54866         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
54867         arg_conv.is_owned = false;
54868         int64_t ret_conv = InvoiceRequest_clone_ptr(&arg_conv);
54869         return ret_conv;
54870 }
54871
54872 uint64_t  __attribute__((export_name("TS_InvoiceRequest_clone"))) TS_InvoiceRequest_clone(uint64_t orig) {
54873         LDKInvoiceRequest orig_conv;
54874         orig_conv.inner = untag_ptr(orig);
54875         orig_conv.is_owned = ptr_is_owned(orig);
54876         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
54877         orig_conv.is_owned = false;
54878         LDKInvoiceRequest ret_var = InvoiceRequest_clone(&orig_conv);
54879         uint64_t ret_ref = 0;
54880         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
54881         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
54882         return ret_ref;
54883 }
54884
54885 void  __attribute__((export_name("TS_VerifiedInvoiceRequest_free"))) TS_VerifiedInvoiceRequest_free(uint64_t this_obj) {
54886         LDKVerifiedInvoiceRequest this_obj_conv;
54887         this_obj_conv.inner = untag_ptr(this_obj);
54888         this_obj_conv.is_owned = ptr_is_owned(this_obj);
54889         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
54890         VerifiedInvoiceRequest_free(this_obj_conv);
54891 }
54892
54893 uint64_t  __attribute__((export_name("TS_VerifiedInvoiceRequest_get_keys"))) TS_VerifiedInvoiceRequest_get_keys(uint64_t this_ptr) {
54894         LDKVerifiedInvoiceRequest this_ptr_conv;
54895         this_ptr_conv.inner = untag_ptr(this_ptr);
54896         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
54897         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
54898         this_ptr_conv.is_owned = false;
54899         LDKCOption_SecretKeyZ *ret_copy = MALLOC(sizeof(LDKCOption_SecretKeyZ), "LDKCOption_SecretKeyZ");
54900         *ret_copy = VerifiedInvoiceRequest_get_keys(&this_ptr_conv);
54901         uint64_t ret_ref = tag_ptr(ret_copy, true);
54902         return ret_ref;
54903 }
54904
54905 void  __attribute__((export_name("TS_VerifiedInvoiceRequest_set_keys"))) TS_VerifiedInvoiceRequest_set_keys(uint64_t this_ptr, uint64_t val) {
54906         LDKVerifiedInvoiceRequest this_ptr_conv;
54907         this_ptr_conv.inner = untag_ptr(this_ptr);
54908         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
54909         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
54910         this_ptr_conv.is_owned = false;
54911         void* val_ptr = untag_ptr(val);
54912         CHECK_ACCESS(val_ptr);
54913         LDKCOption_SecretKeyZ val_conv = *(LDKCOption_SecretKeyZ*)(val_ptr);
54914         val_conv = COption_SecretKeyZ_clone((LDKCOption_SecretKeyZ*)untag_ptr(val));
54915         VerifiedInvoiceRequest_set_keys(&this_ptr_conv, val_conv);
54916 }
54917
54918 static inline uint64_t VerifiedInvoiceRequest_clone_ptr(LDKVerifiedInvoiceRequest *NONNULL_PTR arg) {
54919         LDKVerifiedInvoiceRequest ret_var = VerifiedInvoiceRequest_clone(arg);
54920         uint64_t ret_ref = 0;
54921         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
54922         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
54923         return ret_ref;
54924 }
54925 int64_t  __attribute__((export_name("TS_VerifiedInvoiceRequest_clone_ptr"))) TS_VerifiedInvoiceRequest_clone_ptr(uint64_t arg) {
54926         LDKVerifiedInvoiceRequest arg_conv;
54927         arg_conv.inner = untag_ptr(arg);
54928         arg_conv.is_owned = ptr_is_owned(arg);
54929         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
54930         arg_conv.is_owned = false;
54931         int64_t ret_conv = VerifiedInvoiceRequest_clone_ptr(&arg_conv);
54932         return ret_conv;
54933 }
54934
54935 uint64_t  __attribute__((export_name("TS_VerifiedInvoiceRequest_clone"))) TS_VerifiedInvoiceRequest_clone(uint64_t orig) {
54936         LDKVerifiedInvoiceRequest orig_conv;
54937         orig_conv.inner = untag_ptr(orig);
54938         orig_conv.is_owned = ptr_is_owned(orig);
54939         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
54940         orig_conv.is_owned = false;
54941         LDKVerifiedInvoiceRequest ret_var = VerifiedInvoiceRequest_clone(&orig_conv);
54942         uint64_t ret_ref = 0;
54943         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
54944         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
54945         return ret_ref;
54946 }
54947
54948 ptrArray  __attribute__((export_name("TS_UnsignedInvoiceRequest_chains"))) TS_UnsignedInvoiceRequest_chains(uint64_t this_arg) {
54949         LDKUnsignedInvoiceRequest this_arg_conv;
54950         this_arg_conv.inner = untag_ptr(this_arg);
54951         this_arg_conv.is_owned = ptr_is_owned(this_arg);
54952         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
54953         this_arg_conv.is_owned = false;
54954         LDKCVec_ThirtyTwoBytesZ ret_var = UnsignedInvoiceRequest_chains(&this_arg_conv);
54955         ptrArray ret_arr = NULL;
54956         ret_arr = init_ptrArray(ret_var.datalen, __LINE__);
54957         int8_tArray *ret_arr_ptr = (int8_tArray*)(((uint8_t*)ret_arr) + 8);
54958         for (size_t m = 0; m < ret_var.datalen; m++) {
54959                 int8_tArray ret_conv_12_arr = init_int8_tArray(32, __LINE__);
54960                 memcpy(ret_conv_12_arr->elems, ret_var.data[m].data, 32);
54961                 ret_arr_ptr[m] = ret_conv_12_arr;
54962         }
54963         
54964         FREE(ret_var.data);
54965         return ret_arr;
54966 }
54967
54968 uint64_t  __attribute__((export_name("TS_UnsignedInvoiceRequest_metadata"))) TS_UnsignedInvoiceRequest_metadata(uint64_t this_arg) {
54969         LDKUnsignedInvoiceRequest this_arg_conv;
54970         this_arg_conv.inner = untag_ptr(this_arg);
54971         this_arg_conv.is_owned = ptr_is_owned(this_arg);
54972         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
54973         this_arg_conv.is_owned = false;
54974         LDKCOption_CVec_u8ZZ *ret_copy = MALLOC(sizeof(LDKCOption_CVec_u8ZZ), "LDKCOption_CVec_u8ZZ");
54975         *ret_copy = UnsignedInvoiceRequest_metadata(&this_arg_conv);
54976         uint64_t ret_ref = tag_ptr(ret_copy, true);
54977         return ret_ref;
54978 }
54979
54980 uint64_t  __attribute__((export_name("TS_UnsignedInvoiceRequest_amount"))) TS_UnsignedInvoiceRequest_amount(uint64_t this_arg) {
54981         LDKUnsignedInvoiceRequest this_arg_conv;
54982         this_arg_conv.inner = untag_ptr(this_arg);
54983         this_arg_conv.is_owned = ptr_is_owned(this_arg);
54984         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
54985         this_arg_conv.is_owned = false;
54986         LDKAmount ret_var = UnsignedInvoiceRequest_amount(&this_arg_conv);
54987         uint64_t ret_ref = 0;
54988         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
54989         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
54990         return ret_ref;
54991 }
54992
54993 uint64_t  __attribute__((export_name("TS_UnsignedInvoiceRequest_description"))) TS_UnsignedInvoiceRequest_description(uint64_t this_arg) {
54994         LDKUnsignedInvoiceRequest this_arg_conv;
54995         this_arg_conv.inner = untag_ptr(this_arg);
54996         this_arg_conv.is_owned = ptr_is_owned(this_arg);
54997         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
54998         this_arg_conv.is_owned = false;
54999         LDKPrintableString ret_var = UnsignedInvoiceRequest_description(&this_arg_conv);
55000         uint64_t ret_ref = 0;
55001         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
55002         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
55003         return ret_ref;
55004 }
55005
55006 uint64_t  __attribute__((export_name("TS_UnsignedInvoiceRequest_offer_features"))) TS_UnsignedInvoiceRequest_offer_features(uint64_t this_arg) {
55007         LDKUnsignedInvoiceRequest this_arg_conv;
55008         this_arg_conv.inner = untag_ptr(this_arg);
55009         this_arg_conv.is_owned = ptr_is_owned(this_arg);
55010         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
55011         this_arg_conv.is_owned = false;
55012         LDKOfferFeatures ret_var = UnsignedInvoiceRequest_offer_features(&this_arg_conv);
55013         uint64_t ret_ref = 0;
55014         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
55015         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
55016         return ret_ref;
55017 }
55018
55019 uint64_t  __attribute__((export_name("TS_UnsignedInvoiceRequest_absolute_expiry"))) TS_UnsignedInvoiceRequest_absolute_expiry(uint64_t this_arg) {
55020         LDKUnsignedInvoiceRequest this_arg_conv;
55021         this_arg_conv.inner = untag_ptr(this_arg);
55022         this_arg_conv.is_owned = ptr_is_owned(this_arg);
55023         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
55024         this_arg_conv.is_owned = false;
55025         LDKCOption_u64Z *ret_copy = MALLOC(sizeof(LDKCOption_u64Z), "LDKCOption_u64Z");
55026         *ret_copy = UnsignedInvoiceRequest_absolute_expiry(&this_arg_conv);
55027         uint64_t ret_ref = tag_ptr(ret_copy, true);
55028         return ret_ref;
55029 }
55030
55031 uint64_t  __attribute__((export_name("TS_UnsignedInvoiceRequest_issuer"))) TS_UnsignedInvoiceRequest_issuer(uint64_t this_arg) {
55032         LDKUnsignedInvoiceRequest this_arg_conv;
55033         this_arg_conv.inner = untag_ptr(this_arg);
55034         this_arg_conv.is_owned = ptr_is_owned(this_arg);
55035         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
55036         this_arg_conv.is_owned = false;
55037         LDKPrintableString ret_var = UnsignedInvoiceRequest_issuer(&this_arg_conv);
55038         uint64_t ret_ref = 0;
55039         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
55040         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
55041         return ret_ref;
55042 }
55043
55044 uint64_tArray  __attribute__((export_name("TS_UnsignedInvoiceRequest_paths"))) TS_UnsignedInvoiceRequest_paths(uint64_t this_arg) {
55045         LDKUnsignedInvoiceRequest this_arg_conv;
55046         this_arg_conv.inner = untag_ptr(this_arg);
55047         this_arg_conv.is_owned = ptr_is_owned(this_arg);
55048         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
55049         this_arg_conv.is_owned = false;
55050         LDKCVec_BlindedPathZ ret_var = UnsignedInvoiceRequest_paths(&this_arg_conv);
55051         uint64_tArray ret_arr = NULL;
55052         ret_arr = init_uint64_tArray(ret_var.datalen, __LINE__);
55053         uint64_t *ret_arr_ptr = (uint64_t*)(((uint8_t*)ret_arr) + 8);
55054         for (size_t n = 0; n < ret_var.datalen; n++) {
55055                 LDKBlindedPath ret_conv_13_var = ret_var.data[n];
55056                 uint64_t ret_conv_13_ref = 0;
55057                 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_conv_13_var);
55058                 ret_conv_13_ref = tag_ptr(ret_conv_13_var.inner, ret_conv_13_var.is_owned);
55059                 ret_arr_ptr[n] = ret_conv_13_ref;
55060         }
55061         
55062         FREE(ret_var.data);
55063         return ret_arr;
55064 }
55065
55066 uint64_t  __attribute__((export_name("TS_UnsignedInvoiceRequest_supported_quantity"))) TS_UnsignedInvoiceRequest_supported_quantity(uint64_t this_arg) {
55067         LDKUnsignedInvoiceRequest this_arg_conv;
55068         this_arg_conv.inner = untag_ptr(this_arg);
55069         this_arg_conv.is_owned = ptr_is_owned(this_arg);
55070         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
55071         this_arg_conv.is_owned = false;
55072         LDKQuantity ret_var = UnsignedInvoiceRequest_supported_quantity(&this_arg_conv);
55073         uint64_t ret_ref = 0;
55074         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
55075         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
55076         return ret_ref;
55077 }
55078
55079 int8_tArray  __attribute__((export_name("TS_UnsignedInvoiceRequest_signing_pubkey"))) TS_UnsignedInvoiceRequest_signing_pubkey(uint64_t this_arg) {
55080         LDKUnsignedInvoiceRequest this_arg_conv;
55081         this_arg_conv.inner = untag_ptr(this_arg);
55082         this_arg_conv.is_owned = ptr_is_owned(this_arg);
55083         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
55084         this_arg_conv.is_owned = false;
55085         int8_tArray ret_arr = init_int8_tArray(33, __LINE__);
55086         memcpy(ret_arr->elems, UnsignedInvoiceRequest_signing_pubkey(&this_arg_conv).compressed_form, 33);
55087         return ret_arr;
55088 }
55089
55090 int8_tArray  __attribute__((export_name("TS_UnsignedInvoiceRequest_payer_metadata"))) TS_UnsignedInvoiceRequest_payer_metadata(uint64_t this_arg) {
55091         LDKUnsignedInvoiceRequest this_arg_conv;
55092         this_arg_conv.inner = untag_ptr(this_arg);
55093         this_arg_conv.is_owned = ptr_is_owned(this_arg);
55094         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
55095         this_arg_conv.is_owned = false;
55096         LDKu8slice ret_var = UnsignedInvoiceRequest_payer_metadata(&this_arg_conv);
55097         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
55098         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
55099         return ret_arr;
55100 }
55101
55102 int8_tArray  __attribute__((export_name("TS_UnsignedInvoiceRequest_chain"))) TS_UnsignedInvoiceRequest_chain(uint64_t this_arg) {
55103         LDKUnsignedInvoiceRequest this_arg_conv;
55104         this_arg_conv.inner = untag_ptr(this_arg);
55105         this_arg_conv.is_owned = ptr_is_owned(this_arg);
55106         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
55107         this_arg_conv.is_owned = false;
55108         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
55109         memcpy(ret_arr->elems, UnsignedInvoiceRequest_chain(&this_arg_conv).data, 32);
55110         return ret_arr;
55111 }
55112
55113 uint64_t  __attribute__((export_name("TS_UnsignedInvoiceRequest_amount_msats"))) TS_UnsignedInvoiceRequest_amount_msats(uint64_t this_arg) {
55114         LDKUnsignedInvoiceRequest this_arg_conv;
55115         this_arg_conv.inner = untag_ptr(this_arg);
55116         this_arg_conv.is_owned = ptr_is_owned(this_arg);
55117         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
55118         this_arg_conv.is_owned = false;
55119         LDKCOption_u64Z *ret_copy = MALLOC(sizeof(LDKCOption_u64Z), "LDKCOption_u64Z");
55120         *ret_copy = UnsignedInvoiceRequest_amount_msats(&this_arg_conv);
55121         uint64_t ret_ref = tag_ptr(ret_copy, true);
55122         return ret_ref;
55123 }
55124
55125 uint64_t  __attribute__((export_name("TS_UnsignedInvoiceRequest_invoice_request_features"))) TS_UnsignedInvoiceRequest_invoice_request_features(uint64_t this_arg) {
55126         LDKUnsignedInvoiceRequest this_arg_conv;
55127         this_arg_conv.inner = untag_ptr(this_arg);
55128         this_arg_conv.is_owned = ptr_is_owned(this_arg);
55129         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
55130         this_arg_conv.is_owned = false;
55131         LDKInvoiceRequestFeatures ret_var = UnsignedInvoiceRequest_invoice_request_features(&this_arg_conv);
55132         uint64_t ret_ref = 0;
55133         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
55134         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
55135         return ret_ref;
55136 }
55137
55138 uint64_t  __attribute__((export_name("TS_UnsignedInvoiceRequest_quantity"))) TS_UnsignedInvoiceRequest_quantity(uint64_t this_arg) {
55139         LDKUnsignedInvoiceRequest this_arg_conv;
55140         this_arg_conv.inner = untag_ptr(this_arg);
55141         this_arg_conv.is_owned = ptr_is_owned(this_arg);
55142         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
55143         this_arg_conv.is_owned = false;
55144         LDKCOption_u64Z *ret_copy = MALLOC(sizeof(LDKCOption_u64Z), "LDKCOption_u64Z");
55145         *ret_copy = UnsignedInvoiceRequest_quantity(&this_arg_conv);
55146         uint64_t ret_ref = tag_ptr(ret_copy, true);
55147         return ret_ref;
55148 }
55149
55150 int8_tArray  __attribute__((export_name("TS_UnsignedInvoiceRequest_payer_id"))) TS_UnsignedInvoiceRequest_payer_id(uint64_t this_arg) {
55151         LDKUnsignedInvoiceRequest this_arg_conv;
55152         this_arg_conv.inner = untag_ptr(this_arg);
55153         this_arg_conv.is_owned = ptr_is_owned(this_arg);
55154         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
55155         this_arg_conv.is_owned = false;
55156         int8_tArray ret_arr = init_int8_tArray(33, __LINE__);
55157         memcpy(ret_arr->elems, UnsignedInvoiceRequest_payer_id(&this_arg_conv).compressed_form, 33);
55158         return ret_arr;
55159 }
55160
55161 uint64_t  __attribute__((export_name("TS_UnsignedInvoiceRequest_payer_note"))) TS_UnsignedInvoiceRequest_payer_note(uint64_t this_arg) {
55162         LDKUnsignedInvoiceRequest this_arg_conv;
55163         this_arg_conv.inner = untag_ptr(this_arg);
55164         this_arg_conv.is_owned = ptr_is_owned(this_arg);
55165         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
55166         this_arg_conv.is_owned = false;
55167         LDKPrintableString ret_var = UnsignedInvoiceRequest_payer_note(&this_arg_conv);
55168         uint64_t ret_ref = 0;
55169         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
55170         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
55171         return ret_ref;
55172 }
55173
55174 ptrArray  __attribute__((export_name("TS_InvoiceRequest_chains"))) TS_InvoiceRequest_chains(uint64_t this_arg) {
55175         LDKInvoiceRequest this_arg_conv;
55176         this_arg_conv.inner = untag_ptr(this_arg);
55177         this_arg_conv.is_owned = ptr_is_owned(this_arg);
55178         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
55179         this_arg_conv.is_owned = false;
55180         LDKCVec_ThirtyTwoBytesZ ret_var = InvoiceRequest_chains(&this_arg_conv);
55181         ptrArray ret_arr = NULL;
55182         ret_arr = init_ptrArray(ret_var.datalen, __LINE__);
55183         int8_tArray *ret_arr_ptr = (int8_tArray*)(((uint8_t*)ret_arr) + 8);
55184         for (size_t m = 0; m < ret_var.datalen; m++) {
55185                 int8_tArray ret_conv_12_arr = init_int8_tArray(32, __LINE__);
55186                 memcpy(ret_conv_12_arr->elems, ret_var.data[m].data, 32);
55187                 ret_arr_ptr[m] = ret_conv_12_arr;
55188         }
55189         
55190         FREE(ret_var.data);
55191         return ret_arr;
55192 }
55193
55194 uint64_t  __attribute__((export_name("TS_InvoiceRequest_metadata"))) TS_InvoiceRequest_metadata(uint64_t this_arg) {
55195         LDKInvoiceRequest this_arg_conv;
55196         this_arg_conv.inner = untag_ptr(this_arg);
55197         this_arg_conv.is_owned = ptr_is_owned(this_arg);
55198         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
55199         this_arg_conv.is_owned = false;
55200         LDKCOption_CVec_u8ZZ *ret_copy = MALLOC(sizeof(LDKCOption_CVec_u8ZZ), "LDKCOption_CVec_u8ZZ");
55201         *ret_copy = InvoiceRequest_metadata(&this_arg_conv);
55202         uint64_t ret_ref = tag_ptr(ret_copy, true);
55203         return ret_ref;
55204 }
55205
55206 uint64_t  __attribute__((export_name("TS_InvoiceRequest_amount"))) TS_InvoiceRequest_amount(uint64_t this_arg) {
55207         LDKInvoiceRequest this_arg_conv;
55208         this_arg_conv.inner = untag_ptr(this_arg);
55209         this_arg_conv.is_owned = ptr_is_owned(this_arg);
55210         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
55211         this_arg_conv.is_owned = false;
55212         LDKAmount ret_var = InvoiceRequest_amount(&this_arg_conv);
55213         uint64_t ret_ref = 0;
55214         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
55215         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
55216         return ret_ref;
55217 }
55218
55219 uint64_t  __attribute__((export_name("TS_InvoiceRequest_description"))) TS_InvoiceRequest_description(uint64_t this_arg) {
55220         LDKInvoiceRequest this_arg_conv;
55221         this_arg_conv.inner = untag_ptr(this_arg);
55222         this_arg_conv.is_owned = ptr_is_owned(this_arg);
55223         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
55224         this_arg_conv.is_owned = false;
55225         LDKPrintableString ret_var = InvoiceRequest_description(&this_arg_conv);
55226         uint64_t ret_ref = 0;
55227         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
55228         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
55229         return ret_ref;
55230 }
55231
55232 uint64_t  __attribute__((export_name("TS_InvoiceRequest_offer_features"))) TS_InvoiceRequest_offer_features(uint64_t this_arg) {
55233         LDKInvoiceRequest this_arg_conv;
55234         this_arg_conv.inner = untag_ptr(this_arg);
55235         this_arg_conv.is_owned = ptr_is_owned(this_arg);
55236         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
55237         this_arg_conv.is_owned = false;
55238         LDKOfferFeatures ret_var = InvoiceRequest_offer_features(&this_arg_conv);
55239         uint64_t ret_ref = 0;
55240         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
55241         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
55242         return ret_ref;
55243 }
55244
55245 uint64_t  __attribute__((export_name("TS_InvoiceRequest_absolute_expiry"))) TS_InvoiceRequest_absolute_expiry(uint64_t this_arg) {
55246         LDKInvoiceRequest this_arg_conv;
55247         this_arg_conv.inner = untag_ptr(this_arg);
55248         this_arg_conv.is_owned = ptr_is_owned(this_arg);
55249         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
55250         this_arg_conv.is_owned = false;
55251         LDKCOption_u64Z *ret_copy = MALLOC(sizeof(LDKCOption_u64Z), "LDKCOption_u64Z");
55252         *ret_copy = InvoiceRequest_absolute_expiry(&this_arg_conv);
55253         uint64_t ret_ref = tag_ptr(ret_copy, true);
55254         return ret_ref;
55255 }
55256
55257 uint64_t  __attribute__((export_name("TS_InvoiceRequest_issuer"))) TS_InvoiceRequest_issuer(uint64_t this_arg) {
55258         LDKInvoiceRequest this_arg_conv;
55259         this_arg_conv.inner = untag_ptr(this_arg);
55260         this_arg_conv.is_owned = ptr_is_owned(this_arg);
55261         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
55262         this_arg_conv.is_owned = false;
55263         LDKPrintableString ret_var = InvoiceRequest_issuer(&this_arg_conv);
55264         uint64_t ret_ref = 0;
55265         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
55266         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
55267         return ret_ref;
55268 }
55269
55270 uint64_tArray  __attribute__((export_name("TS_InvoiceRequest_paths"))) TS_InvoiceRequest_paths(uint64_t this_arg) {
55271         LDKInvoiceRequest this_arg_conv;
55272         this_arg_conv.inner = untag_ptr(this_arg);
55273         this_arg_conv.is_owned = ptr_is_owned(this_arg);
55274         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
55275         this_arg_conv.is_owned = false;
55276         LDKCVec_BlindedPathZ ret_var = InvoiceRequest_paths(&this_arg_conv);
55277         uint64_tArray ret_arr = NULL;
55278         ret_arr = init_uint64_tArray(ret_var.datalen, __LINE__);
55279         uint64_t *ret_arr_ptr = (uint64_t*)(((uint8_t*)ret_arr) + 8);
55280         for (size_t n = 0; n < ret_var.datalen; n++) {
55281                 LDKBlindedPath ret_conv_13_var = ret_var.data[n];
55282                 uint64_t ret_conv_13_ref = 0;
55283                 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_conv_13_var);
55284                 ret_conv_13_ref = tag_ptr(ret_conv_13_var.inner, ret_conv_13_var.is_owned);
55285                 ret_arr_ptr[n] = ret_conv_13_ref;
55286         }
55287         
55288         FREE(ret_var.data);
55289         return ret_arr;
55290 }
55291
55292 uint64_t  __attribute__((export_name("TS_InvoiceRequest_supported_quantity"))) TS_InvoiceRequest_supported_quantity(uint64_t this_arg) {
55293         LDKInvoiceRequest this_arg_conv;
55294         this_arg_conv.inner = untag_ptr(this_arg);
55295         this_arg_conv.is_owned = ptr_is_owned(this_arg);
55296         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
55297         this_arg_conv.is_owned = false;
55298         LDKQuantity ret_var = InvoiceRequest_supported_quantity(&this_arg_conv);
55299         uint64_t ret_ref = 0;
55300         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
55301         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
55302         return ret_ref;
55303 }
55304
55305 int8_tArray  __attribute__((export_name("TS_InvoiceRequest_signing_pubkey"))) TS_InvoiceRequest_signing_pubkey(uint64_t this_arg) {
55306         LDKInvoiceRequest this_arg_conv;
55307         this_arg_conv.inner = untag_ptr(this_arg);
55308         this_arg_conv.is_owned = ptr_is_owned(this_arg);
55309         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
55310         this_arg_conv.is_owned = false;
55311         int8_tArray ret_arr = init_int8_tArray(33, __LINE__);
55312         memcpy(ret_arr->elems, InvoiceRequest_signing_pubkey(&this_arg_conv).compressed_form, 33);
55313         return ret_arr;
55314 }
55315
55316 int8_tArray  __attribute__((export_name("TS_InvoiceRequest_payer_metadata"))) TS_InvoiceRequest_payer_metadata(uint64_t this_arg) {
55317         LDKInvoiceRequest this_arg_conv;
55318         this_arg_conv.inner = untag_ptr(this_arg);
55319         this_arg_conv.is_owned = ptr_is_owned(this_arg);
55320         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
55321         this_arg_conv.is_owned = false;
55322         LDKu8slice ret_var = InvoiceRequest_payer_metadata(&this_arg_conv);
55323         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
55324         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
55325         return ret_arr;
55326 }
55327
55328 int8_tArray  __attribute__((export_name("TS_InvoiceRequest_chain"))) TS_InvoiceRequest_chain(uint64_t this_arg) {
55329         LDKInvoiceRequest this_arg_conv;
55330         this_arg_conv.inner = untag_ptr(this_arg);
55331         this_arg_conv.is_owned = ptr_is_owned(this_arg);
55332         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
55333         this_arg_conv.is_owned = false;
55334         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
55335         memcpy(ret_arr->elems, InvoiceRequest_chain(&this_arg_conv).data, 32);
55336         return ret_arr;
55337 }
55338
55339 uint64_t  __attribute__((export_name("TS_InvoiceRequest_amount_msats"))) TS_InvoiceRequest_amount_msats(uint64_t this_arg) {
55340         LDKInvoiceRequest this_arg_conv;
55341         this_arg_conv.inner = untag_ptr(this_arg);
55342         this_arg_conv.is_owned = ptr_is_owned(this_arg);
55343         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
55344         this_arg_conv.is_owned = false;
55345         LDKCOption_u64Z *ret_copy = MALLOC(sizeof(LDKCOption_u64Z), "LDKCOption_u64Z");
55346         *ret_copy = InvoiceRequest_amount_msats(&this_arg_conv);
55347         uint64_t ret_ref = tag_ptr(ret_copy, true);
55348         return ret_ref;
55349 }
55350
55351 uint64_t  __attribute__((export_name("TS_InvoiceRequest_invoice_request_features"))) TS_InvoiceRequest_invoice_request_features(uint64_t this_arg) {
55352         LDKInvoiceRequest this_arg_conv;
55353         this_arg_conv.inner = untag_ptr(this_arg);
55354         this_arg_conv.is_owned = ptr_is_owned(this_arg);
55355         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
55356         this_arg_conv.is_owned = false;
55357         LDKInvoiceRequestFeatures ret_var = InvoiceRequest_invoice_request_features(&this_arg_conv);
55358         uint64_t ret_ref = 0;
55359         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
55360         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
55361         return ret_ref;
55362 }
55363
55364 uint64_t  __attribute__((export_name("TS_InvoiceRequest_quantity"))) TS_InvoiceRequest_quantity(uint64_t this_arg) {
55365         LDKInvoiceRequest this_arg_conv;
55366         this_arg_conv.inner = untag_ptr(this_arg);
55367         this_arg_conv.is_owned = ptr_is_owned(this_arg);
55368         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
55369         this_arg_conv.is_owned = false;
55370         LDKCOption_u64Z *ret_copy = MALLOC(sizeof(LDKCOption_u64Z), "LDKCOption_u64Z");
55371         *ret_copy = InvoiceRequest_quantity(&this_arg_conv);
55372         uint64_t ret_ref = tag_ptr(ret_copy, true);
55373         return ret_ref;
55374 }
55375
55376 int8_tArray  __attribute__((export_name("TS_InvoiceRequest_payer_id"))) TS_InvoiceRequest_payer_id(uint64_t this_arg) {
55377         LDKInvoiceRequest this_arg_conv;
55378         this_arg_conv.inner = untag_ptr(this_arg);
55379         this_arg_conv.is_owned = ptr_is_owned(this_arg);
55380         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
55381         this_arg_conv.is_owned = false;
55382         int8_tArray ret_arr = init_int8_tArray(33, __LINE__);
55383         memcpy(ret_arr->elems, InvoiceRequest_payer_id(&this_arg_conv).compressed_form, 33);
55384         return ret_arr;
55385 }
55386
55387 uint64_t  __attribute__((export_name("TS_InvoiceRequest_payer_note"))) TS_InvoiceRequest_payer_note(uint64_t this_arg) {
55388         LDKInvoiceRequest this_arg_conv;
55389         this_arg_conv.inner = untag_ptr(this_arg);
55390         this_arg_conv.is_owned = ptr_is_owned(this_arg);
55391         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
55392         this_arg_conv.is_owned = false;
55393         LDKPrintableString ret_var = InvoiceRequest_payer_note(&this_arg_conv);
55394         uint64_t ret_ref = 0;
55395         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
55396         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
55397         return ret_ref;
55398 }
55399
55400 int8_tArray  __attribute__((export_name("TS_InvoiceRequest_signature"))) TS_InvoiceRequest_signature(uint64_t this_arg) {
55401         LDKInvoiceRequest this_arg_conv;
55402         this_arg_conv.inner = untag_ptr(this_arg);
55403         this_arg_conv.is_owned = ptr_is_owned(this_arg);
55404         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
55405         this_arg_conv.is_owned = false;
55406         int8_tArray ret_arr = init_int8_tArray(64, __LINE__);
55407         memcpy(ret_arr->elems, InvoiceRequest_signature(&this_arg_conv).compact_form, 64);
55408         return ret_arr;
55409 }
55410
55411 uint64_t  __attribute__((export_name("TS_InvoiceRequest_verify"))) TS_InvoiceRequest_verify(uint64_t this_arg, uint64_t key) {
55412         LDKInvoiceRequest this_arg_conv;
55413         this_arg_conv.inner = untag_ptr(this_arg);
55414         this_arg_conv.is_owned = ptr_is_owned(this_arg);
55415         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
55416         this_arg_conv = InvoiceRequest_clone(&this_arg_conv);
55417         LDKExpandedKey key_conv;
55418         key_conv.inner = untag_ptr(key);
55419         key_conv.is_owned = ptr_is_owned(key);
55420         CHECK_INNER_FIELD_ACCESS_OR_NULL(key_conv);
55421         key_conv.is_owned = false;
55422         LDKCResult_VerifiedInvoiceRequestNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_VerifiedInvoiceRequestNoneZ), "LDKCResult_VerifiedInvoiceRequestNoneZ");
55423         *ret_conv = InvoiceRequest_verify(this_arg_conv, &key_conv);
55424         return tag_ptr(ret_conv, true);
55425 }
55426
55427 ptrArray  __attribute__((export_name("TS_VerifiedInvoiceRequest_chains"))) TS_VerifiedInvoiceRequest_chains(uint64_t this_arg) {
55428         LDKVerifiedInvoiceRequest this_arg_conv;
55429         this_arg_conv.inner = untag_ptr(this_arg);
55430         this_arg_conv.is_owned = ptr_is_owned(this_arg);
55431         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
55432         this_arg_conv.is_owned = false;
55433         LDKCVec_ThirtyTwoBytesZ ret_var = VerifiedInvoiceRequest_chains(&this_arg_conv);
55434         ptrArray ret_arr = NULL;
55435         ret_arr = init_ptrArray(ret_var.datalen, __LINE__);
55436         int8_tArray *ret_arr_ptr = (int8_tArray*)(((uint8_t*)ret_arr) + 8);
55437         for (size_t m = 0; m < ret_var.datalen; m++) {
55438                 int8_tArray ret_conv_12_arr = init_int8_tArray(32, __LINE__);
55439                 memcpy(ret_conv_12_arr->elems, ret_var.data[m].data, 32);
55440                 ret_arr_ptr[m] = ret_conv_12_arr;
55441         }
55442         
55443         FREE(ret_var.data);
55444         return ret_arr;
55445 }
55446
55447 uint64_t  __attribute__((export_name("TS_VerifiedInvoiceRequest_metadata"))) TS_VerifiedInvoiceRequest_metadata(uint64_t this_arg) {
55448         LDKVerifiedInvoiceRequest this_arg_conv;
55449         this_arg_conv.inner = untag_ptr(this_arg);
55450         this_arg_conv.is_owned = ptr_is_owned(this_arg);
55451         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
55452         this_arg_conv.is_owned = false;
55453         LDKCOption_CVec_u8ZZ *ret_copy = MALLOC(sizeof(LDKCOption_CVec_u8ZZ), "LDKCOption_CVec_u8ZZ");
55454         *ret_copy = VerifiedInvoiceRequest_metadata(&this_arg_conv);
55455         uint64_t ret_ref = tag_ptr(ret_copy, true);
55456         return ret_ref;
55457 }
55458
55459 uint64_t  __attribute__((export_name("TS_VerifiedInvoiceRequest_amount"))) TS_VerifiedInvoiceRequest_amount(uint64_t this_arg) {
55460         LDKVerifiedInvoiceRequest this_arg_conv;
55461         this_arg_conv.inner = untag_ptr(this_arg);
55462         this_arg_conv.is_owned = ptr_is_owned(this_arg);
55463         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
55464         this_arg_conv.is_owned = false;
55465         LDKAmount ret_var = VerifiedInvoiceRequest_amount(&this_arg_conv);
55466         uint64_t ret_ref = 0;
55467         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
55468         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
55469         return ret_ref;
55470 }
55471
55472 uint64_t  __attribute__((export_name("TS_VerifiedInvoiceRequest_description"))) TS_VerifiedInvoiceRequest_description(uint64_t this_arg) {
55473         LDKVerifiedInvoiceRequest this_arg_conv;
55474         this_arg_conv.inner = untag_ptr(this_arg);
55475         this_arg_conv.is_owned = ptr_is_owned(this_arg);
55476         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
55477         this_arg_conv.is_owned = false;
55478         LDKPrintableString ret_var = VerifiedInvoiceRequest_description(&this_arg_conv);
55479         uint64_t ret_ref = 0;
55480         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
55481         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
55482         return ret_ref;
55483 }
55484
55485 uint64_t  __attribute__((export_name("TS_VerifiedInvoiceRequest_offer_features"))) TS_VerifiedInvoiceRequest_offer_features(uint64_t this_arg) {
55486         LDKVerifiedInvoiceRequest this_arg_conv;
55487         this_arg_conv.inner = untag_ptr(this_arg);
55488         this_arg_conv.is_owned = ptr_is_owned(this_arg);
55489         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
55490         this_arg_conv.is_owned = false;
55491         LDKOfferFeatures ret_var = VerifiedInvoiceRequest_offer_features(&this_arg_conv);
55492         uint64_t ret_ref = 0;
55493         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
55494         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
55495         return ret_ref;
55496 }
55497
55498 uint64_t  __attribute__((export_name("TS_VerifiedInvoiceRequest_absolute_expiry"))) TS_VerifiedInvoiceRequest_absolute_expiry(uint64_t this_arg) {
55499         LDKVerifiedInvoiceRequest this_arg_conv;
55500         this_arg_conv.inner = untag_ptr(this_arg);
55501         this_arg_conv.is_owned = ptr_is_owned(this_arg);
55502         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
55503         this_arg_conv.is_owned = false;
55504         LDKCOption_u64Z *ret_copy = MALLOC(sizeof(LDKCOption_u64Z), "LDKCOption_u64Z");
55505         *ret_copy = VerifiedInvoiceRequest_absolute_expiry(&this_arg_conv);
55506         uint64_t ret_ref = tag_ptr(ret_copy, true);
55507         return ret_ref;
55508 }
55509
55510 uint64_t  __attribute__((export_name("TS_VerifiedInvoiceRequest_issuer"))) TS_VerifiedInvoiceRequest_issuer(uint64_t this_arg) {
55511         LDKVerifiedInvoiceRequest this_arg_conv;
55512         this_arg_conv.inner = untag_ptr(this_arg);
55513         this_arg_conv.is_owned = ptr_is_owned(this_arg);
55514         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
55515         this_arg_conv.is_owned = false;
55516         LDKPrintableString ret_var = VerifiedInvoiceRequest_issuer(&this_arg_conv);
55517         uint64_t ret_ref = 0;
55518         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
55519         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
55520         return ret_ref;
55521 }
55522
55523 uint64_tArray  __attribute__((export_name("TS_VerifiedInvoiceRequest_paths"))) TS_VerifiedInvoiceRequest_paths(uint64_t this_arg) {
55524         LDKVerifiedInvoiceRequest this_arg_conv;
55525         this_arg_conv.inner = untag_ptr(this_arg);
55526         this_arg_conv.is_owned = ptr_is_owned(this_arg);
55527         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
55528         this_arg_conv.is_owned = false;
55529         LDKCVec_BlindedPathZ ret_var = VerifiedInvoiceRequest_paths(&this_arg_conv);
55530         uint64_tArray ret_arr = NULL;
55531         ret_arr = init_uint64_tArray(ret_var.datalen, __LINE__);
55532         uint64_t *ret_arr_ptr = (uint64_t*)(((uint8_t*)ret_arr) + 8);
55533         for (size_t n = 0; n < ret_var.datalen; n++) {
55534                 LDKBlindedPath ret_conv_13_var = ret_var.data[n];
55535                 uint64_t ret_conv_13_ref = 0;
55536                 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_conv_13_var);
55537                 ret_conv_13_ref = tag_ptr(ret_conv_13_var.inner, ret_conv_13_var.is_owned);
55538                 ret_arr_ptr[n] = ret_conv_13_ref;
55539         }
55540         
55541         FREE(ret_var.data);
55542         return ret_arr;
55543 }
55544
55545 uint64_t  __attribute__((export_name("TS_VerifiedInvoiceRequest_supported_quantity"))) TS_VerifiedInvoiceRequest_supported_quantity(uint64_t this_arg) {
55546         LDKVerifiedInvoiceRequest this_arg_conv;
55547         this_arg_conv.inner = untag_ptr(this_arg);
55548         this_arg_conv.is_owned = ptr_is_owned(this_arg);
55549         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
55550         this_arg_conv.is_owned = false;
55551         LDKQuantity ret_var = VerifiedInvoiceRequest_supported_quantity(&this_arg_conv);
55552         uint64_t ret_ref = 0;
55553         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
55554         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
55555         return ret_ref;
55556 }
55557
55558 int8_tArray  __attribute__((export_name("TS_VerifiedInvoiceRequest_signing_pubkey"))) TS_VerifiedInvoiceRequest_signing_pubkey(uint64_t this_arg) {
55559         LDKVerifiedInvoiceRequest this_arg_conv;
55560         this_arg_conv.inner = untag_ptr(this_arg);
55561         this_arg_conv.is_owned = ptr_is_owned(this_arg);
55562         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
55563         this_arg_conv.is_owned = false;
55564         int8_tArray ret_arr = init_int8_tArray(33, __LINE__);
55565         memcpy(ret_arr->elems, VerifiedInvoiceRequest_signing_pubkey(&this_arg_conv).compressed_form, 33);
55566         return ret_arr;
55567 }
55568
55569 int8_tArray  __attribute__((export_name("TS_VerifiedInvoiceRequest_payer_metadata"))) TS_VerifiedInvoiceRequest_payer_metadata(uint64_t this_arg) {
55570         LDKVerifiedInvoiceRequest this_arg_conv;
55571         this_arg_conv.inner = untag_ptr(this_arg);
55572         this_arg_conv.is_owned = ptr_is_owned(this_arg);
55573         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
55574         this_arg_conv.is_owned = false;
55575         LDKu8slice ret_var = VerifiedInvoiceRequest_payer_metadata(&this_arg_conv);
55576         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
55577         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
55578         return ret_arr;
55579 }
55580
55581 int8_tArray  __attribute__((export_name("TS_VerifiedInvoiceRequest_chain"))) TS_VerifiedInvoiceRequest_chain(uint64_t this_arg) {
55582         LDKVerifiedInvoiceRequest this_arg_conv;
55583         this_arg_conv.inner = untag_ptr(this_arg);
55584         this_arg_conv.is_owned = ptr_is_owned(this_arg);
55585         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
55586         this_arg_conv.is_owned = false;
55587         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
55588         memcpy(ret_arr->elems, VerifiedInvoiceRequest_chain(&this_arg_conv).data, 32);
55589         return ret_arr;
55590 }
55591
55592 uint64_t  __attribute__((export_name("TS_VerifiedInvoiceRequest_amount_msats"))) TS_VerifiedInvoiceRequest_amount_msats(uint64_t this_arg) {
55593         LDKVerifiedInvoiceRequest this_arg_conv;
55594         this_arg_conv.inner = untag_ptr(this_arg);
55595         this_arg_conv.is_owned = ptr_is_owned(this_arg);
55596         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
55597         this_arg_conv.is_owned = false;
55598         LDKCOption_u64Z *ret_copy = MALLOC(sizeof(LDKCOption_u64Z), "LDKCOption_u64Z");
55599         *ret_copy = VerifiedInvoiceRequest_amount_msats(&this_arg_conv);
55600         uint64_t ret_ref = tag_ptr(ret_copy, true);
55601         return ret_ref;
55602 }
55603
55604 uint64_t  __attribute__((export_name("TS_VerifiedInvoiceRequest_invoice_request_features"))) TS_VerifiedInvoiceRequest_invoice_request_features(uint64_t this_arg) {
55605         LDKVerifiedInvoiceRequest this_arg_conv;
55606         this_arg_conv.inner = untag_ptr(this_arg);
55607         this_arg_conv.is_owned = ptr_is_owned(this_arg);
55608         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
55609         this_arg_conv.is_owned = false;
55610         LDKInvoiceRequestFeatures ret_var = VerifiedInvoiceRequest_invoice_request_features(&this_arg_conv);
55611         uint64_t ret_ref = 0;
55612         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
55613         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
55614         return ret_ref;
55615 }
55616
55617 uint64_t  __attribute__((export_name("TS_VerifiedInvoiceRequest_quantity"))) TS_VerifiedInvoiceRequest_quantity(uint64_t this_arg) {
55618         LDKVerifiedInvoiceRequest this_arg_conv;
55619         this_arg_conv.inner = untag_ptr(this_arg);
55620         this_arg_conv.is_owned = ptr_is_owned(this_arg);
55621         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
55622         this_arg_conv.is_owned = false;
55623         LDKCOption_u64Z *ret_copy = MALLOC(sizeof(LDKCOption_u64Z), "LDKCOption_u64Z");
55624         *ret_copy = VerifiedInvoiceRequest_quantity(&this_arg_conv);
55625         uint64_t ret_ref = tag_ptr(ret_copy, true);
55626         return ret_ref;
55627 }
55628
55629 int8_tArray  __attribute__((export_name("TS_VerifiedInvoiceRequest_payer_id"))) TS_VerifiedInvoiceRequest_payer_id(uint64_t this_arg) {
55630         LDKVerifiedInvoiceRequest this_arg_conv;
55631         this_arg_conv.inner = untag_ptr(this_arg);
55632         this_arg_conv.is_owned = ptr_is_owned(this_arg);
55633         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
55634         this_arg_conv.is_owned = false;
55635         int8_tArray ret_arr = init_int8_tArray(33, __LINE__);
55636         memcpy(ret_arr->elems, VerifiedInvoiceRequest_payer_id(&this_arg_conv).compressed_form, 33);
55637         return ret_arr;
55638 }
55639
55640 uint64_t  __attribute__((export_name("TS_VerifiedInvoiceRequest_payer_note"))) TS_VerifiedInvoiceRequest_payer_note(uint64_t this_arg) {
55641         LDKVerifiedInvoiceRequest this_arg_conv;
55642         this_arg_conv.inner = untag_ptr(this_arg);
55643         this_arg_conv.is_owned = ptr_is_owned(this_arg);
55644         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
55645         this_arg_conv.is_owned = false;
55646         LDKPrintableString ret_var = VerifiedInvoiceRequest_payer_note(&this_arg_conv);
55647         uint64_t ret_ref = 0;
55648         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
55649         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
55650         return ret_ref;
55651 }
55652
55653 int8_tArray  __attribute__((export_name("TS_UnsignedInvoiceRequest_write"))) TS_UnsignedInvoiceRequest_write(uint64_t obj) {
55654         LDKUnsignedInvoiceRequest obj_conv;
55655         obj_conv.inner = untag_ptr(obj);
55656         obj_conv.is_owned = ptr_is_owned(obj);
55657         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
55658         obj_conv.is_owned = false;
55659         LDKCVec_u8Z ret_var = UnsignedInvoiceRequest_write(&obj_conv);
55660         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
55661         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
55662         CVec_u8Z_free(ret_var);
55663         return ret_arr;
55664 }
55665
55666 int8_tArray  __attribute__((export_name("TS_InvoiceRequest_write"))) TS_InvoiceRequest_write(uint64_t obj) {
55667         LDKInvoiceRequest obj_conv;
55668         obj_conv.inner = untag_ptr(obj);
55669         obj_conv.is_owned = ptr_is_owned(obj);
55670         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
55671         obj_conv.is_owned = false;
55672         LDKCVec_u8Z ret_var = InvoiceRequest_write(&obj_conv);
55673         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
55674         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
55675         CVec_u8Z_free(ret_var);
55676         return ret_arr;
55677 }
55678
55679 void  __attribute__((export_name("TS_TaggedHash_free"))) TS_TaggedHash_free(uint64_t this_obj) {
55680         LDKTaggedHash this_obj_conv;
55681         this_obj_conv.inner = untag_ptr(this_obj);
55682         this_obj_conv.is_owned = ptr_is_owned(this_obj);
55683         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
55684         TaggedHash_free(this_obj_conv);
55685 }
55686
55687 void  __attribute__((export_name("TS_Bolt12ParseError_free"))) TS_Bolt12ParseError_free(uint64_t this_obj) {
55688         LDKBolt12ParseError this_obj_conv;
55689         this_obj_conv.inner = untag_ptr(this_obj);
55690         this_obj_conv.is_owned = ptr_is_owned(this_obj);
55691         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
55692         Bolt12ParseError_free(this_obj_conv);
55693 }
55694
55695 static inline uint64_t Bolt12ParseError_clone_ptr(LDKBolt12ParseError *NONNULL_PTR arg) {
55696         LDKBolt12ParseError ret_var = Bolt12ParseError_clone(arg);
55697         uint64_t ret_ref = 0;
55698         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
55699         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
55700         return ret_ref;
55701 }
55702 int64_t  __attribute__((export_name("TS_Bolt12ParseError_clone_ptr"))) TS_Bolt12ParseError_clone_ptr(uint64_t arg) {
55703         LDKBolt12ParseError arg_conv;
55704         arg_conv.inner = untag_ptr(arg);
55705         arg_conv.is_owned = ptr_is_owned(arg);
55706         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
55707         arg_conv.is_owned = false;
55708         int64_t ret_conv = Bolt12ParseError_clone_ptr(&arg_conv);
55709         return ret_conv;
55710 }
55711
55712 uint64_t  __attribute__((export_name("TS_Bolt12ParseError_clone"))) TS_Bolt12ParseError_clone(uint64_t orig) {
55713         LDKBolt12ParseError orig_conv;
55714         orig_conv.inner = untag_ptr(orig);
55715         orig_conv.is_owned = ptr_is_owned(orig);
55716         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
55717         orig_conv.is_owned = false;
55718         LDKBolt12ParseError ret_var = Bolt12ParseError_clone(&orig_conv);
55719         uint64_t ret_ref = 0;
55720         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
55721         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
55722         return ret_ref;
55723 }
55724
55725 uint32_t  __attribute__((export_name("TS_Bolt12SemanticError_clone"))) TS_Bolt12SemanticError_clone(uint64_t orig) {
55726         LDKBolt12SemanticError* orig_conv = (LDKBolt12SemanticError*)untag_ptr(orig);
55727         uint32_t ret_conv = LDKBolt12SemanticError_to_js(Bolt12SemanticError_clone(orig_conv));
55728         return ret_conv;
55729 }
55730
55731 uint32_t  __attribute__((export_name("TS_Bolt12SemanticError_already_expired"))) TS_Bolt12SemanticError_already_expired() {
55732         uint32_t ret_conv = LDKBolt12SemanticError_to_js(Bolt12SemanticError_already_expired());
55733         return ret_conv;
55734 }
55735
55736 uint32_t  __attribute__((export_name("TS_Bolt12SemanticError_unsupported_chain"))) TS_Bolt12SemanticError_unsupported_chain() {
55737         uint32_t ret_conv = LDKBolt12SemanticError_to_js(Bolt12SemanticError_unsupported_chain());
55738         return ret_conv;
55739 }
55740
55741 uint32_t  __attribute__((export_name("TS_Bolt12SemanticError_unexpected_chain"))) TS_Bolt12SemanticError_unexpected_chain() {
55742         uint32_t ret_conv = LDKBolt12SemanticError_to_js(Bolt12SemanticError_unexpected_chain());
55743         return ret_conv;
55744 }
55745
55746 uint32_t  __attribute__((export_name("TS_Bolt12SemanticError_missing_amount"))) TS_Bolt12SemanticError_missing_amount() {
55747         uint32_t ret_conv = LDKBolt12SemanticError_to_js(Bolt12SemanticError_missing_amount());
55748         return ret_conv;
55749 }
55750
55751 uint32_t  __attribute__((export_name("TS_Bolt12SemanticError_invalid_amount"))) TS_Bolt12SemanticError_invalid_amount() {
55752         uint32_t ret_conv = LDKBolt12SemanticError_to_js(Bolt12SemanticError_invalid_amount());
55753         return ret_conv;
55754 }
55755
55756 uint32_t  __attribute__((export_name("TS_Bolt12SemanticError_insufficient_amount"))) TS_Bolt12SemanticError_insufficient_amount() {
55757         uint32_t ret_conv = LDKBolt12SemanticError_to_js(Bolt12SemanticError_insufficient_amount());
55758         return ret_conv;
55759 }
55760
55761 uint32_t  __attribute__((export_name("TS_Bolt12SemanticError_unexpected_amount"))) TS_Bolt12SemanticError_unexpected_amount() {
55762         uint32_t ret_conv = LDKBolt12SemanticError_to_js(Bolt12SemanticError_unexpected_amount());
55763         return ret_conv;
55764 }
55765
55766 uint32_t  __attribute__((export_name("TS_Bolt12SemanticError_unsupported_currency"))) TS_Bolt12SemanticError_unsupported_currency() {
55767         uint32_t ret_conv = LDKBolt12SemanticError_to_js(Bolt12SemanticError_unsupported_currency());
55768         return ret_conv;
55769 }
55770
55771 uint32_t  __attribute__((export_name("TS_Bolt12SemanticError_unknown_required_features"))) TS_Bolt12SemanticError_unknown_required_features() {
55772         uint32_t ret_conv = LDKBolt12SemanticError_to_js(Bolt12SemanticError_unknown_required_features());
55773         return ret_conv;
55774 }
55775
55776 uint32_t  __attribute__((export_name("TS_Bolt12SemanticError_unexpected_features"))) TS_Bolt12SemanticError_unexpected_features() {
55777         uint32_t ret_conv = LDKBolt12SemanticError_to_js(Bolt12SemanticError_unexpected_features());
55778         return ret_conv;
55779 }
55780
55781 uint32_t  __attribute__((export_name("TS_Bolt12SemanticError_missing_description"))) TS_Bolt12SemanticError_missing_description() {
55782         uint32_t ret_conv = LDKBolt12SemanticError_to_js(Bolt12SemanticError_missing_description());
55783         return ret_conv;
55784 }
55785
55786 uint32_t  __attribute__((export_name("TS_Bolt12SemanticError_missing_signing_pubkey"))) TS_Bolt12SemanticError_missing_signing_pubkey() {
55787         uint32_t ret_conv = LDKBolt12SemanticError_to_js(Bolt12SemanticError_missing_signing_pubkey());
55788         return ret_conv;
55789 }
55790
55791 uint32_t  __attribute__((export_name("TS_Bolt12SemanticError_invalid_signing_pubkey"))) TS_Bolt12SemanticError_invalid_signing_pubkey() {
55792         uint32_t ret_conv = LDKBolt12SemanticError_to_js(Bolt12SemanticError_invalid_signing_pubkey());
55793         return ret_conv;
55794 }
55795
55796 uint32_t  __attribute__((export_name("TS_Bolt12SemanticError_unexpected_signing_pubkey"))) TS_Bolt12SemanticError_unexpected_signing_pubkey() {
55797         uint32_t ret_conv = LDKBolt12SemanticError_to_js(Bolt12SemanticError_unexpected_signing_pubkey());
55798         return ret_conv;
55799 }
55800
55801 uint32_t  __attribute__((export_name("TS_Bolt12SemanticError_missing_quantity"))) TS_Bolt12SemanticError_missing_quantity() {
55802         uint32_t ret_conv = LDKBolt12SemanticError_to_js(Bolt12SemanticError_missing_quantity());
55803         return ret_conv;
55804 }
55805
55806 uint32_t  __attribute__((export_name("TS_Bolt12SemanticError_invalid_quantity"))) TS_Bolt12SemanticError_invalid_quantity() {
55807         uint32_t ret_conv = LDKBolt12SemanticError_to_js(Bolt12SemanticError_invalid_quantity());
55808         return ret_conv;
55809 }
55810
55811 uint32_t  __attribute__((export_name("TS_Bolt12SemanticError_unexpected_quantity"))) TS_Bolt12SemanticError_unexpected_quantity() {
55812         uint32_t ret_conv = LDKBolt12SemanticError_to_js(Bolt12SemanticError_unexpected_quantity());
55813         return ret_conv;
55814 }
55815
55816 uint32_t  __attribute__((export_name("TS_Bolt12SemanticError_invalid_metadata"))) TS_Bolt12SemanticError_invalid_metadata() {
55817         uint32_t ret_conv = LDKBolt12SemanticError_to_js(Bolt12SemanticError_invalid_metadata());
55818         return ret_conv;
55819 }
55820
55821 uint32_t  __attribute__((export_name("TS_Bolt12SemanticError_unexpected_metadata"))) TS_Bolt12SemanticError_unexpected_metadata() {
55822         uint32_t ret_conv = LDKBolt12SemanticError_to_js(Bolt12SemanticError_unexpected_metadata());
55823         return ret_conv;
55824 }
55825
55826 uint32_t  __attribute__((export_name("TS_Bolt12SemanticError_missing_payer_metadata"))) TS_Bolt12SemanticError_missing_payer_metadata() {
55827         uint32_t ret_conv = LDKBolt12SemanticError_to_js(Bolt12SemanticError_missing_payer_metadata());
55828         return ret_conv;
55829 }
55830
55831 uint32_t  __attribute__((export_name("TS_Bolt12SemanticError_missing_payer_id"))) TS_Bolt12SemanticError_missing_payer_id() {
55832         uint32_t ret_conv = LDKBolt12SemanticError_to_js(Bolt12SemanticError_missing_payer_id());
55833         return ret_conv;
55834 }
55835
55836 uint32_t  __attribute__((export_name("TS_Bolt12SemanticError_duplicate_payment_id"))) TS_Bolt12SemanticError_duplicate_payment_id() {
55837         uint32_t ret_conv = LDKBolt12SemanticError_to_js(Bolt12SemanticError_duplicate_payment_id());
55838         return ret_conv;
55839 }
55840
55841 uint32_t  __attribute__((export_name("TS_Bolt12SemanticError_missing_paths"))) TS_Bolt12SemanticError_missing_paths() {
55842         uint32_t ret_conv = LDKBolt12SemanticError_to_js(Bolt12SemanticError_missing_paths());
55843         return ret_conv;
55844 }
55845
55846 uint32_t  __attribute__((export_name("TS_Bolt12SemanticError_invalid_pay_info"))) TS_Bolt12SemanticError_invalid_pay_info() {
55847         uint32_t ret_conv = LDKBolt12SemanticError_to_js(Bolt12SemanticError_invalid_pay_info());
55848         return ret_conv;
55849 }
55850
55851 uint32_t  __attribute__((export_name("TS_Bolt12SemanticError_missing_creation_time"))) TS_Bolt12SemanticError_missing_creation_time() {
55852         uint32_t ret_conv = LDKBolt12SemanticError_to_js(Bolt12SemanticError_missing_creation_time());
55853         return ret_conv;
55854 }
55855
55856 uint32_t  __attribute__((export_name("TS_Bolt12SemanticError_missing_payment_hash"))) TS_Bolt12SemanticError_missing_payment_hash() {
55857         uint32_t ret_conv = LDKBolt12SemanticError_to_js(Bolt12SemanticError_missing_payment_hash());
55858         return ret_conv;
55859 }
55860
55861 uint32_t  __attribute__((export_name("TS_Bolt12SemanticError_missing_signature"))) TS_Bolt12SemanticError_missing_signature() {
55862         uint32_t ret_conv = LDKBolt12SemanticError_to_js(Bolt12SemanticError_missing_signature());
55863         return ret_conv;
55864 }
55865
55866 void  __attribute__((export_name("TS_Refund_free"))) TS_Refund_free(uint64_t this_obj) {
55867         LDKRefund this_obj_conv;
55868         this_obj_conv.inner = untag_ptr(this_obj);
55869         this_obj_conv.is_owned = ptr_is_owned(this_obj);
55870         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
55871         Refund_free(this_obj_conv);
55872 }
55873
55874 static inline uint64_t Refund_clone_ptr(LDKRefund *NONNULL_PTR arg) {
55875         LDKRefund ret_var = Refund_clone(arg);
55876         uint64_t ret_ref = 0;
55877         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
55878         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
55879         return ret_ref;
55880 }
55881 int64_t  __attribute__((export_name("TS_Refund_clone_ptr"))) TS_Refund_clone_ptr(uint64_t arg) {
55882         LDKRefund arg_conv;
55883         arg_conv.inner = untag_ptr(arg);
55884         arg_conv.is_owned = ptr_is_owned(arg);
55885         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
55886         arg_conv.is_owned = false;
55887         int64_t ret_conv = Refund_clone_ptr(&arg_conv);
55888         return ret_conv;
55889 }
55890
55891 uint64_t  __attribute__((export_name("TS_Refund_clone"))) TS_Refund_clone(uint64_t orig) {
55892         LDKRefund orig_conv;
55893         orig_conv.inner = untag_ptr(orig);
55894         orig_conv.is_owned = ptr_is_owned(orig);
55895         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
55896         orig_conv.is_owned = false;
55897         LDKRefund ret_var = Refund_clone(&orig_conv);
55898         uint64_t ret_ref = 0;
55899         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
55900         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
55901         return ret_ref;
55902 }
55903
55904 uint64_t  __attribute__((export_name("TS_Refund_description"))) TS_Refund_description(uint64_t this_arg) {
55905         LDKRefund this_arg_conv;
55906         this_arg_conv.inner = untag_ptr(this_arg);
55907         this_arg_conv.is_owned = ptr_is_owned(this_arg);
55908         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
55909         this_arg_conv.is_owned = false;
55910         LDKPrintableString ret_var = Refund_description(&this_arg_conv);
55911         uint64_t ret_ref = 0;
55912         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
55913         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
55914         return ret_ref;
55915 }
55916
55917 uint64_t  __attribute__((export_name("TS_Refund_absolute_expiry"))) TS_Refund_absolute_expiry(uint64_t this_arg) {
55918         LDKRefund this_arg_conv;
55919         this_arg_conv.inner = untag_ptr(this_arg);
55920         this_arg_conv.is_owned = ptr_is_owned(this_arg);
55921         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
55922         this_arg_conv.is_owned = false;
55923         LDKCOption_u64Z *ret_copy = MALLOC(sizeof(LDKCOption_u64Z), "LDKCOption_u64Z");
55924         *ret_copy = Refund_absolute_expiry(&this_arg_conv);
55925         uint64_t ret_ref = tag_ptr(ret_copy, true);
55926         return ret_ref;
55927 }
55928
55929 uint64_t  __attribute__((export_name("TS_Refund_issuer"))) TS_Refund_issuer(uint64_t this_arg) {
55930         LDKRefund this_arg_conv;
55931         this_arg_conv.inner = untag_ptr(this_arg);
55932         this_arg_conv.is_owned = ptr_is_owned(this_arg);
55933         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
55934         this_arg_conv.is_owned = false;
55935         LDKPrintableString ret_var = Refund_issuer(&this_arg_conv);
55936         uint64_t ret_ref = 0;
55937         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
55938         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
55939         return ret_ref;
55940 }
55941
55942 uint64_tArray  __attribute__((export_name("TS_Refund_paths"))) TS_Refund_paths(uint64_t this_arg) {
55943         LDKRefund this_arg_conv;
55944         this_arg_conv.inner = untag_ptr(this_arg);
55945         this_arg_conv.is_owned = ptr_is_owned(this_arg);
55946         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
55947         this_arg_conv.is_owned = false;
55948         LDKCVec_BlindedPathZ ret_var = Refund_paths(&this_arg_conv);
55949         uint64_tArray ret_arr = NULL;
55950         ret_arr = init_uint64_tArray(ret_var.datalen, __LINE__);
55951         uint64_t *ret_arr_ptr = (uint64_t*)(((uint8_t*)ret_arr) + 8);
55952         for (size_t n = 0; n < ret_var.datalen; n++) {
55953                 LDKBlindedPath ret_conv_13_var = ret_var.data[n];
55954                 uint64_t ret_conv_13_ref = 0;
55955                 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_conv_13_var);
55956                 ret_conv_13_ref = tag_ptr(ret_conv_13_var.inner, ret_conv_13_var.is_owned);
55957                 ret_arr_ptr[n] = ret_conv_13_ref;
55958         }
55959         
55960         FREE(ret_var.data);
55961         return ret_arr;
55962 }
55963
55964 int8_tArray  __attribute__((export_name("TS_Refund_payer_metadata"))) TS_Refund_payer_metadata(uint64_t this_arg) {
55965         LDKRefund this_arg_conv;
55966         this_arg_conv.inner = untag_ptr(this_arg);
55967         this_arg_conv.is_owned = ptr_is_owned(this_arg);
55968         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
55969         this_arg_conv.is_owned = false;
55970         LDKu8slice ret_var = Refund_payer_metadata(&this_arg_conv);
55971         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
55972         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
55973         return ret_arr;
55974 }
55975
55976 int8_tArray  __attribute__((export_name("TS_Refund_chain"))) TS_Refund_chain(uint64_t this_arg) {
55977         LDKRefund this_arg_conv;
55978         this_arg_conv.inner = untag_ptr(this_arg);
55979         this_arg_conv.is_owned = ptr_is_owned(this_arg);
55980         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
55981         this_arg_conv.is_owned = false;
55982         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
55983         memcpy(ret_arr->elems, Refund_chain(&this_arg_conv).data, 32);
55984         return ret_arr;
55985 }
55986
55987 int64_t  __attribute__((export_name("TS_Refund_amount_msats"))) TS_Refund_amount_msats(uint64_t this_arg) {
55988         LDKRefund this_arg_conv;
55989         this_arg_conv.inner = untag_ptr(this_arg);
55990         this_arg_conv.is_owned = ptr_is_owned(this_arg);
55991         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
55992         this_arg_conv.is_owned = false;
55993         int64_t ret_conv = Refund_amount_msats(&this_arg_conv);
55994         return ret_conv;
55995 }
55996
55997 uint64_t  __attribute__((export_name("TS_Refund_features"))) TS_Refund_features(uint64_t this_arg) {
55998         LDKRefund this_arg_conv;
55999         this_arg_conv.inner = untag_ptr(this_arg);
56000         this_arg_conv.is_owned = ptr_is_owned(this_arg);
56001         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
56002         this_arg_conv.is_owned = false;
56003         LDKInvoiceRequestFeatures ret_var = Refund_features(&this_arg_conv);
56004         uint64_t ret_ref = 0;
56005         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
56006         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
56007         return ret_ref;
56008 }
56009
56010 uint64_t  __attribute__((export_name("TS_Refund_quantity"))) TS_Refund_quantity(uint64_t this_arg) {
56011         LDKRefund this_arg_conv;
56012         this_arg_conv.inner = untag_ptr(this_arg);
56013         this_arg_conv.is_owned = ptr_is_owned(this_arg);
56014         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
56015         this_arg_conv.is_owned = false;
56016         LDKCOption_u64Z *ret_copy = MALLOC(sizeof(LDKCOption_u64Z), "LDKCOption_u64Z");
56017         *ret_copy = Refund_quantity(&this_arg_conv);
56018         uint64_t ret_ref = tag_ptr(ret_copy, true);
56019         return ret_ref;
56020 }
56021
56022 int8_tArray  __attribute__((export_name("TS_Refund_payer_id"))) TS_Refund_payer_id(uint64_t this_arg) {
56023         LDKRefund this_arg_conv;
56024         this_arg_conv.inner = untag_ptr(this_arg);
56025         this_arg_conv.is_owned = ptr_is_owned(this_arg);
56026         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
56027         this_arg_conv.is_owned = false;
56028         int8_tArray ret_arr = init_int8_tArray(33, __LINE__);
56029         memcpy(ret_arr->elems, Refund_payer_id(&this_arg_conv).compressed_form, 33);
56030         return ret_arr;
56031 }
56032
56033 uint64_t  __attribute__((export_name("TS_Refund_payer_note"))) TS_Refund_payer_note(uint64_t this_arg) {
56034         LDKRefund this_arg_conv;
56035         this_arg_conv.inner = untag_ptr(this_arg);
56036         this_arg_conv.is_owned = ptr_is_owned(this_arg);
56037         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
56038         this_arg_conv.is_owned = false;
56039         LDKPrintableString ret_var = Refund_payer_note(&this_arg_conv);
56040         uint64_t ret_ref = 0;
56041         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
56042         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
56043         return ret_ref;
56044 }
56045
56046 int8_tArray  __attribute__((export_name("TS_Refund_write"))) TS_Refund_write(uint64_t obj) {
56047         LDKRefund obj_conv;
56048         obj_conv.inner = untag_ptr(obj);
56049         obj_conv.is_owned = ptr_is_owned(obj);
56050         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
56051         obj_conv.is_owned = false;
56052         LDKCVec_u8Z ret_var = Refund_write(&obj_conv);
56053         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
56054         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
56055         CVec_u8Z_free(ret_var);
56056         return ret_arr;
56057 }
56058
56059 uint64_t  __attribute__((export_name("TS_Refund_from_str"))) TS_Refund_from_str(jstring s) {
56060         LDKStr s_conv = str_ref_to_owned_c(s);
56061         LDKCResult_RefundBolt12ParseErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RefundBolt12ParseErrorZ), "LDKCResult_RefundBolt12ParseErrorZ");
56062         *ret_conv = Refund_from_str(s_conv);
56063         return tag_ptr(ret_conv, true);
56064 }
56065
56066 uint32_t  __attribute__((export_name("TS_UtxoLookupError_clone"))) TS_UtxoLookupError_clone(uint64_t orig) {
56067         LDKUtxoLookupError* orig_conv = (LDKUtxoLookupError*)untag_ptr(orig);
56068         uint32_t ret_conv = LDKUtxoLookupError_to_js(UtxoLookupError_clone(orig_conv));
56069         return ret_conv;
56070 }
56071
56072 uint32_t  __attribute__((export_name("TS_UtxoLookupError_unknown_chain"))) TS_UtxoLookupError_unknown_chain() {
56073         uint32_t ret_conv = LDKUtxoLookupError_to_js(UtxoLookupError_unknown_chain());
56074         return ret_conv;
56075 }
56076
56077 uint32_t  __attribute__((export_name("TS_UtxoLookupError_unknown_tx"))) TS_UtxoLookupError_unknown_tx() {
56078         uint32_t ret_conv = LDKUtxoLookupError_to_js(UtxoLookupError_unknown_tx());
56079         return ret_conv;
56080 }
56081
56082 void  __attribute__((export_name("TS_UtxoResult_free"))) TS_UtxoResult_free(uint64_t this_ptr) {
56083         if (!ptr_is_owned(this_ptr)) return;
56084         void* this_ptr_ptr = untag_ptr(this_ptr);
56085         CHECK_ACCESS(this_ptr_ptr);
56086         LDKUtxoResult this_ptr_conv = *(LDKUtxoResult*)(this_ptr_ptr);
56087         FREE(untag_ptr(this_ptr));
56088         UtxoResult_free(this_ptr_conv);
56089 }
56090
56091 static inline uint64_t UtxoResult_clone_ptr(LDKUtxoResult *NONNULL_PTR arg) {
56092         LDKUtxoResult *ret_copy = MALLOC(sizeof(LDKUtxoResult), "LDKUtxoResult");
56093         *ret_copy = UtxoResult_clone(arg);
56094         uint64_t ret_ref = tag_ptr(ret_copy, true);
56095         return ret_ref;
56096 }
56097 int64_t  __attribute__((export_name("TS_UtxoResult_clone_ptr"))) TS_UtxoResult_clone_ptr(uint64_t arg) {
56098         LDKUtxoResult* arg_conv = (LDKUtxoResult*)untag_ptr(arg);
56099         int64_t ret_conv = UtxoResult_clone_ptr(arg_conv);
56100         return ret_conv;
56101 }
56102
56103 uint64_t  __attribute__((export_name("TS_UtxoResult_clone"))) TS_UtxoResult_clone(uint64_t orig) {
56104         LDKUtxoResult* orig_conv = (LDKUtxoResult*)untag_ptr(orig);
56105         LDKUtxoResult *ret_copy = MALLOC(sizeof(LDKUtxoResult), "LDKUtxoResult");
56106         *ret_copy = UtxoResult_clone(orig_conv);
56107         uint64_t ret_ref = tag_ptr(ret_copy, true);
56108         return ret_ref;
56109 }
56110
56111 uint64_t  __attribute__((export_name("TS_UtxoResult_sync"))) TS_UtxoResult_sync(uint64_t a) {
56112         void* a_ptr = untag_ptr(a);
56113         CHECK_ACCESS(a_ptr);
56114         LDKCResult_TxOutUtxoLookupErrorZ a_conv = *(LDKCResult_TxOutUtxoLookupErrorZ*)(a_ptr);
56115         a_conv = CResult_TxOutUtxoLookupErrorZ_clone((LDKCResult_TxOutUtxoLookupErrorZ*)untag_ptr(a));
56116         LDKUtxoResult *ret_copy = MALLOC(sizeof(LDKUtxoResult), "LDKUtxoResult");
56117         *ret_copy = UtxoResult_sync(a_conv);
56118         uint64_t ret_ref = tag_ptr(ret_copy, true);
56119         return ret_ref;
56120 }
56121
56122 uint64_t  __attribute__((export_name("TS_UtxoResult_async"))) TS_UtxoResult_async(uint64_t a) {
56123         LDKUtxoFuture a_conv;
56124         a_conv.inner = untag_ptr(a);
56125         a_conv.is_owned = ptr_is_owned(a);
56126         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
56127         a_conv = UtxoFuture_clone(&a_conv);
56128         LDKUtxoResult *ret_copy = MALLOC(sizeof(LDKUtxoResult), "LDKUtxoResult");
56129         *ret_copy = UtxoResult_async(a_conv);
56130         uint64_t ret_ref = tag_ptr(ret_copy, true);
56131         return ret_ref;
56132 }
56133
56134 void  __attribute__((export_name("TS_UtxoLookup_free"))) TS_UtxoLookup_free(uint64_t this_ptr) {
56135         if (!ptr_is_owned(this_ptr)) return;
56136         void* this_ptr_ptr = untag_ptr(this_ptr);
56137         CHECK_ACCESS(this_ptr_ptr);
56138         LDKUtxoLookup this_ptr_conv = *(LDKUtxoLookup*)(this_ptr_ptr);
56139         FREE(untag_ptr(this_ptr));
56140         UtxoLookup_free(this_ptr_conv);
56141 }
56142
56143 void  __attribute__((export_name("TS_UtxoFuture_free"))) TS_UtxoFuture_free(uint64_t this_obj) {
56144         LDKUtxoFuture this_obj_conv;
56145         this_obj_conv.inner = untag_ptr(this_obj);
56146         this_obj_conv.is_owned = ptr_is_owned(this_obj);
56147         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
56148         UtxoFuture_free(this_obj_conv);
56149 }
56150
56151 static inline uint64_t UtxoFuture_clone_ptr(LDKUtxoFuture *NONNULL_PTR arg) {
56152         LDKUtxoFuture ret_var = UtxoFuture_clone(arg);
56153         uint64_t ret_ref = 0;
56154         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
56155         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
56156         return ret_ref;
56157 }
56158 int64_t  __attribute__((export_name("TS_UtxoFuture_clone_ptr"))) TS_UtxoFuture_clone_ptr(uint64_t arg) {
56159         LDKUtxoFuture arg_conv;
56160         arg_conv.inner = untag_ptr(arg);
56161         arg_conv.is_owned = ptr_is_owned(arg);
56162         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
56163         arg_conv.is_owned = false;
56164         int64_t ret_conv = UtxoFuture_clone_ptr(&arg_conv);
56165         return ret_conv;
56166 }
56167
56168 uint64_t  __attribute__((export_name("TS_UtxoFuture_clone"))) TS_UtxoFuture_clone(uint64_t orig) {
56169         LDKUtxoFuture orig_conv;
56170         orig_conv.inner = untag_ptr(orig);
56171         orig_conv.is_owned = ptr_is_owned(orig);
56172         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
56173         orig_conv.is_owned = false;
56174         LDKUtxoFuture ret_var = UtxoFuture_clone(&orig_conv);
56175         uint64_t ret_ref = 0;
56176         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
56177         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
56178         return ret_ref;
56179 }
56180
56181 uint64_t  __attribute__((export_name("TS_UtxoFuture_new"))) TS_UtxoFuture_new() {
56182         LDKUtxoFuture ret_var = UtxoFuture_new();
56183         uint64_t ret_ref = 0;
56184         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
56185         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
56186         return ret_ref;
56187 }
56188
56189 void  __attribute__((export_name("TS_UtxoFuture_resolve_without_forwarding"))) TS_UtxoFuture_resolve_without_forwarding(uint64_t this_arg, uint64_t graph, uint64_t result) {
56190         LDKUtxoFuture this_arg_conv;
56191         this_arg_conv.inner = untag_ptr(this_arg);
56192         this_arg_conv.is_owned = ptr_is_owned(this_arg);
56193         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
56194         this_arg_conv.is_owned = false;
56195         LDKNetworkGraph graph_conv;
56196         graph_conv.inner = untag_ptr(graph);
56197         graph_conv.is_owned = ptr_is_owned(graph);
56198         CHECK_INNER_FIELD_ACCESS_OR_NULL(graph_conv);
56199         graph_conv.is_owned = false;
56200         void* result_ptr = untag_ptr(result);
56201         CHECK_ACCESS(result_ptr);
56202         LDKCResult_TxOutUtxoLookupErrorZ result_conv = *(LDKCResult_TxOutUtxoLookupErrorZ*)(result_ptr);
56203         UtxoFuture_resolve_without_forwarding(&this_arg_conv, &graph_conv, result_conv);
56204 }
56205
56206 void  __attribute__((export_name("TS_UtxoFuture_resolve"))) TS_UtxoFuture_resolve(uint64_t this_arg, uint64_t graph, uint64_t gossip, uint64_t result) {
56207         LDKUtxoFuture this_arg_conv;
56208         this_arg_conv.inner = untag_ptr(this_arg);
56209         this_arg_conv.is_owned = ptr_is_owned(this_arg);
56210         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
56211         this_arg_conv.is_owned = false;
56212         LDKNetworkGraph graph_conv;
56213         graph_conv.inner = untag_ptr(graph);
56214         graph_conv.is_owned = ptr_is_owned(graph);
56215         CHECK_INNER_FIELD_ACCESS_OR_NULL(graph_conv);
56216         graph_conv.is_owned = false;
56217         LDKP2PGossipSync gossip_conv;
56218         gossip_conv.inner = untag_ptr(gossip);
56219         gossip_conv.is_owned = ptr_is_owned(gossip);
56220         CHECK_INNER_FIELD_ACCESS_OR_NULL(gossip_conv);
56221         gossip_conv.is_owned = false;
56222         void* result_ptr = untag_ptr(result);
56223         CHECK_ACCESS(result_ptr);
56224         LDKCResult_TxOutUtxoLookupErrorZ result_conv = *(LDKCResult_TxOutUtxoLookupErrorZ*)(result_ptr);
56225         UtxoFuture_resolve(&this_arg_conv, &graph_conv, &gossip_conv, result_conv);
56226 }
56227
56228 void  __attribute__((export_name("TS_NodeId_free"))) TS_NodeId_free(uint64_t this_obj) {
56229         LDKNodeId this_obj_conv;
56230         this_obj_conv.inner = untag_ptr(this_obj);
56231         this_obj_conv.is_owned = ptr_is_owned(this_obj);
56232         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
56233         NodeId_free(this_obj_conv);
56234 }
56235
56236 static inline uint64_t NodeId_clone_ptr(LDKNodeId *NONNULL_PTR arg) {
56237         LDKNodeId ret_var = NodeId_clone(arg);
56238         uint64_t ret_ref = 0;
56239         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
56240         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
56241         return ret_ref;
56242 }
56243 int64_t  __attribute__((export_name("TS_NodeId_clone_ptr"))) TS_NodeId_clone_ptr(uint64_t arg) {
56244         LDKNodeId arg_conv;
56245         arg_conv.inner = untag_ptr(arg);
56246         arg_conv.is_owned = ptr_is_owned(arg);
56247         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
56248         arg_conv.is_owned = false;
56249         int64_t ret_conv = NodeId_clone_ptr(&arg_conv);
56250         return ret_conv;
56251 }
56252
56253 uint64_t  __attribute__((export_name("TS_NodeId_clone"))) TS_NodeId_clone(uint64_t orig) {
56254         LDKNodeId orig_conv;
56255         orig_conv.inner = untag_ptr(orig);
56256         orig_conv.is_owned = ptr_is_owned(orig);
56257         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
56258         orig_conv.is_owned = false;
56259         LDKNodeId ret_var = NodeId_clone(&orig_conv);
56260         uint64_t ret_ref = 0;
56261         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
56262         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
56263         return ret_ref;
56264 }
56265
56266 uint64_t  __attribute__((export_name("TS_NodeId_from_pubkey"))) TS_NodeId_from_pubkey(int8_tArray pubkey) {
56267         LDKPublicKey pubkey_ref;
56268         CHECK(pubkey->arr_len == 33);
56269         memcpy(pubkey_ref.compressed_form, pubkey->elems, 33); FREE(pubkey);
56270         LDKNodeId ret_var = NodeId_from_pubkey(pubkey_ref);
56271         uint64_t ret_ref = 0;
56272         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
56273         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
56274         return ret_ref;
56275 }
56276
56277 int8_tArray  __attribute__((export_name("TS_NodeId_as_slice"))) TS_NodeId_as_slice(uint64_t this_arg) {
56278         LDKNodeId this_arg_conv;
56279         this_arg_conv.inner = untag_ptr(this_arg);
56280         this_arg_conv.is_owned = ptr_is_owned(this_arg);
56281         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
56282         this_arg_conv.is_owned = false;
56283         LDKu8slice ret_var = NodeId_as_slice(&this_arg_conv);
56284         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
56285         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
56286         return ret_arr;
56287 }
56288
56289 uint64_t  __attribute__((export_name("TS_NodeId_as_pubkey"))) TS_NodeId_as_pubkey(uint64_t this_arg) {
56290         LDKNodeId this_arg_conv;
56291         this_arg_conv.inner = untag_ptr(this_arg);
56292         this_arg_conv.is_owned = ptr_is_owned(this_arg);
56293         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
56294         this_arg_conv.is_owned = false;
56295         LDKCResult_PublicKeySecp256k1ErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PublicKeySecp256k1ErrorZ), "LDKCResult_PublicKeySecp256k1ErrorZ");
56296         *ret_conv = NodeId_as_pubkey(&this_arg_conv);
56297         return tag_ptr(ret_conv, true);
56298 }
56299
56300 int64_t  __attribute__((export_name("TS_NodeId_hash"))) TS_NodeId_hash(uint64_t o) {
56301         LDKNodeId o_conv;
56302         o_conv.inner = untag_ptr(o);
56303         o_conv.is_owned = ptr_is_owned(o);
56304         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
56305         o_conv.is_owned = false;
56306         int64_t ret_conv = NodeId_hash(&o_conv);
56307         return ret_conv;
56308 }
56309
56310 int8_tArray  __attribute__((export_name("TS_NodeId_write"))) TS_NodeId_write(uint64_t obj) {
56311         LDKNodeId obj_conv;
56312         obj_conv.inner = untag_ptr(obj);
56313         obj_conv.is_owned = ptr_is_owned(obj);
56314         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
56315         obj_conv.is_owned = false;
56316         LDKCVec_u8Z ret_var = NodeId_write(&obj_conv);
56317         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
56318         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
56319         CVec_u8Z_free(ret_var);
56320         return ret_arr;
56321 }
56322
56323 uint64_t  __attribute__((export_name("TS_NodeId_read"))) TS_NodeId_read(int8_tArray ser) {
56324         LDKu8slice ser_ref;
56325         ser_ref.datalen = ser->arr_len;
56326         ser_ref.data = ser->elems;
56327         LDKCResult_NodeIdDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NodeIdDecodeErrorZ), "LDKCResult_NodeIdDecodeErrorZ");
56328         *ret_conv = NodeId_read(ser_ref);
56329         FREE(ser);
56330         return tag_ptr(ret_conv, true);
56331 }
56332
56333 void  __attribute__((export_name("TS_NetworkGraph_free"))) TS_NetworkGraph_free(uint64_t this_obj) {
56334         LDKNetworkGraph this_obj_conv;
56335         this_obj_conv.inner = untag_ptr(this_obj);
56336         this_obj_conv.is_owned = ptr_is_owned(this_obj);
56337         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
56338         NetworkGraph_free(this_obj_conv);
56339 }
56340
56341 void  __attribute__((export_name("TS_ReadOnlyNetworkGraph_free"))) TS_ReadOnlyNetworkGraph_free(uint64_t this_obj) {
56342         LDKReadOnlyNetworkGraph this_obj_conv;
56343         this_obj_conv.inner = untag_ptr(this_obj);
56344         this_obj_conv.is_owned = ptr_is_owned(this_obj);
56345         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
56346         ReadOnlyNetworkGraph_free(this_obj_conv);
56347 }
56348
56349 void  __attribute__((export_name("TS_NetworkUpdate_free"))) TS_NetworkUpdate_free(uint64_t this_ptr) {
56350         if (!ptr_is_owned(this_ptr)) return;
56351         void* this_ptr_ptr = untag_ptr(this_ptr);
56352         CHECK_ACCESS(this_ptr_ptr);
56353         LDKNetworkUpdate this_ptr_conv = *(LDKNetworkUpdate*)(this_ptr_ptr);
56354         FREE(untag_ptr(this_ptr));
56355         NetworkUpdate_free(this_ptr_conv);
56356 }
56357
56358 static inline uint64_t NetworkUpdate_clone_ptr(LDKNetworkUpdate *NONNULL_PTR arg) {
56359         LDKNetworkUpdate *ret_copy = MALLOC(sizeof(LDKNetworkUpdate), "LDKNetworkUpdate");
56360         *ret_copy = NetworkUpdate_clone(arg);
56361         uint64_t ret_ref = tag_ptr(ret_copy, true);
56362         return ret_ref;
56363 }
56364 int64_t  __attribute__((export_name("TS_NetworkUpdate_clone_ptr"))) TS_NetworkUpdate_clone_ptr(uint64_t arg) {
56365         LDKNetworkUpdate* arg_conv = (LDKNetworkUpdate*)untag_ptr(arg);
56366         int64_t ret_conv = NetworkUpdate_clone_ptr(arg_conv);
56367         return ret_conv;
56368 }
56369
56370 uint64_t  __attribute__((export_name("TS_NetworkUpdate_clone"))) TS_NetworkUpdate_clone(uint64_t orig) {
56371         LDKNetworkUpdate* orig_conv = (LDKNetworkUpdate*)untag_ptr(orig);
56372         LDKNetworkUpdate *ret_copy = MALLOC(sizeof(LDKNetworkUpdate), "LDKNetworkUpdate");
56373         *ret_copy = NetworkUpdate_clone(orig_conv);
56374         uint64_t ret_ref = tag_ptr(ret_copy, true);
56375         return ret_ref;
56376 }
56377
56378 uint64_t  __attribute__((export_name("TS_NetworkUpdate_channel_update_message"))) TS_NetworkUpdate_channel_update_message(uint64_t msg) {
56379         LDKChannelUpdate msg_conv;
56380         msg_conv.inner = untag_ptr(msg);
56381         msg_conv.is_owned = ptr_is_owned(msg);
56382         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
56383         msg_conv = ChannelUpdate_clone(&msg_conv);
56384         LDKNetworkUpdate *ret_copy = MALLOC(sizeof(LDKNetworkUpdate), "LDKNetworkUpdate");
56385         *ret_copy = NetworkUpdate_channel_update_message(msg_conv);
56386         uint64_t ret_ref = tag_ptr(ret_copy, true);
56387         return ret_ref;
56388 }
56389
56390 uint64_t  __attribute__((export_name("TS_NetworkUpdate_channel_failure"))) TS_NetworkUpdate_channel_failure(int64_t short_channel_id, jboolean is_permanent) {
56391         LDKNetworkUpdate *ret_copy = MALLOC(sizeof(LDKNetworkUpdate), "LDKNetworkUpdate");
56392         *ret_copy = NetworkUpdate_channel_failure(short_channel_id, is_permanent);
56393         uint64_t ret_ref = tag_ptr(ret_copy, true);
56394         return ret_ref;
56395 }
56396
56397 uint64_t  __attribute__((export_name("TS_NetworkUpdate_node_failure"))) TS_NetworkUpdate_node_failure(int8_tArray node_id, jboolean is_permanent) {
56398         LDKPublicKey node_id_ref;
56399         CHECK(node_id->arr_len == 33);
56400         memcpy(node_id_ref.compressed_form, node_id->elems, 33); FREE(node_id);
56401         LDKNetworkUpdate *ret_copy = MALLOC(sizeof(LDKNetworkUpdate), "LDKNetworkUpdate");
56402         *ret_copy = NetworkUpdate_node_failure(node_id_ref, is_permanent);
56403         uint64_t ret_ref = tag_ptr(ret_copy, true);
56404         return ret_ref;
56405 }
56406
56407 jboolean  __attribute__((export_name("TS_NetworkUpdate_eq"))) TS_NetworkUpdate_eq(uint64_t a, uint64_t b) {
56408         LDKNetworkUpdate* a_conv = (LDKNetworkUpdate*)untag_ptr(a);
56409         LDKNetworkUpdate* b_conv = (LDKNetworkUpdate*)untag_ptr(b);
56410         jboolean ret_conv = NetworkUpdate_eq(a_conv, b_conv);
56411         return ret_conv;
56412 }
56413
56414 int8_tArray  __attribute__((export_name("TS_NetworkUpdate_write"))) TS_NetworkUpdate_write(uint64_t obj) {
56415         LDKNetworkUpdate* obj_conv = (LDKNetworkUpdate*)untag_ptr(obj);
56416         LDKCVec_u8Z ret_var = NetworkUpdate_write(obj_conv);
56417         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
56418         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
56419         CVec_u8Z_free(ret_var);
56420         return ret_arr;
56421 }
56422
56423 uint64_t  __attribute__((export_name("TS_NetworkUpdate_read"))) TS_NetworkUpdate_read(int8_tArray ser) {
56424         LDKu8slice ser_ref;
56425         ser_ref.datalen = ser->arr_len;
56426         ser_ref.data = ser->elems;
56427         LDKCResult_COption_NetworkUpdateZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_COption_NetworkUpdateZDecodeErrorZ), "LDKCResult_COption_NetworkUpdateZDecodeErrorZ");
56428         *ret_conv = NetworkUpdate_read(ser_ref);
56429         FREE(ser);
56430         return tag_ptr(ret_conv, true);
56431 }
56432
56433 void  __attribute__((export_name("TS_P2PGossipSync_free"))) TS_P2PGossipSync_free(uint64_t this_obj) {
56434         LDKP2PGossipSync this_obj_conv;
56435         this_obj_conv.inner = untag_ptr(this_obj);
56436         this_obj_conv.is_owned = ptr_is_owned(this_obj);
56437         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
56438         P2PGossipSync_free(this_obj_conv);
56439 }
56440
56441 uint64_t  __attribute__((export_name("TS_P2PGossipSync_new"))) TS_P2PGossipSync_new(uint64_t network_graph, uint64_t utxo_lookup, uint64_t logger) {
56442         LDKNetworkGraph network_graph_conv;
56443         network_graph_conv.inner = untag_ptr(network_graph);
56444         network_graph_conv.is_owned = ptr_is_owned(network_graph);
56445         CHECK_INNER_FIELD_ACCESS_OR_NULL(network_graph_conv);
56446         network_graph_conv.is_owned = false;
56447         void* utxo_lookup_ptr = untag_ptr(utxo_lookup);
56448         CHECK_ACCESS(utxo_lookup_ptr);
56449         LDKCOption_UtxoLookupZ utxo_lookup_conv = *(LDKCOption_UtxoLookupZ*)(utxo_lookup_ptr);
56450         // WARNING: we may need a move here but no clone is available for LDKCOption_UtxoLookupZ
56451         if (utxo_lookup_conv.tag == LDKCOption_UtxoLookupZ_Some) {
56452                 // Manually implement clone for Java trait instances
56453                 if (utxo_lookup_conv.some.free == LDKUtxoLookup_JCalls_free) {
56454                         // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
56455                         LDKUtxoLookup_JCalls_cloned(&utxo_lookup_conv.some);
56456                 }
56457         }
56458         void* logger_ptr = untag_ptr(logger);
56459         CHECK_ACCESS(logger_ptr);
56460         LDKLogger logger_conv = *(LDKLogger*)(logger_ptr);
56461         if (logger_conv.free == LDKLogger_JCalls_free) {
56462                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
56463                 LDKLogger_JCalls_cloned(&logger_conv);
56464         }
56465         LDKP2PGossipSync ret_var = P2PGossipSync_new(&network_graph_conv, utxo_lookup_conv, logger_conv);
56466         uint64_t ret_ref = 0;
56467         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
56468         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
56469         return ret_ref;
56470 }
56471
56472 void  __attribute__((export_name("TS_P2PGossipSync_add_utxo_lookup"))) TS_P2PGossipSync_add_utxo_lookup(uint64_t this_arg, uint64_t utxo_lookup) {
56473         LDKP2PGossipSync this_arg_conv;
56474         this_arg_conv.inner = untag_ptr(this_arg);
56475         this_arg_conv.is_owned = ptr_is_owned(this_arg);
56476         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
56477         this_arg_conv.is_owned = false;
56478         void* utxo_lookup_ptr = untag_ptr(utxo_lookup);
56479         CHECK_ACCESS(utxo_lookup_ptr);
56480         LDKCOption_UtxoLookupZ utxo_lookup_conv = *(LDKCOption_UtxoLookupZ*)(utxo_lookup_ptr);
56481         // WARNING: we may need a move here but no clone is available for LDKCOption_UtxoLookupZ
56482         if (utxo_lookup_conv.tag == LDKCOption_UtxoLookupZ_Some) {
56483                 // Manually implement clone for Java trait instances
56484                 if (utxo_lookup_conv.some.free == LDKUtxoLookup_JCalls_free) {
56485                         // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
56486                         LDKUtxoLookup_JCalls_cloned(&utxo_lookup_conv.some);
56487                 }
56488         }
56489         P2PGossipSync_add_utxo_lookup(&this_arg_conv, utxo_lookup_conv);
56490 }
56491
56492 void  __attribute__((export_name("TS_NetworkGraph_handle_network_update"))) TS_NetworkGraph_handle_network_update(uint64_t this_arg, uint64_t network_update) {
56493         LDKNetworkGraph this_arg_conv;
56494         this_arg_conv.inner = untag_ptr(this_arg);
56495         this_arg_conv.is_owned = ptr_is_owned(this_arg);
56496         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
56497         this_arg_conv.is_owned = false;
56498         LDKNetworkUpdate* network_update_conv = (LDKNetworkUpdate*)untag_ptr(network_update);
56499         NetworkGraph_handle_network_update(&this_arg_conv, network_update_conv);
56500 }
56501
56502 int8_tArray  __attribute__((export_name("TS_NetworkGraph_get_chain_hash"))) TS_NetworkGraph_get_chain_hash(uint64_t this_arg) {
56503         LDKNetworkGraph this_arg_conv;
56504         this_arg_conv.inner = untag_ptr(this_arg);
56505         this_arg_conv.is_owned = ptr_is_owned(this_arg);
56506         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
56507         this_arg_conv.is_owned = false;
56508         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
56509         memcpy(ret_arr->elems, NetworkGraph_get_chain_hash(&this_arg_conv).data, 32);
56510         return ret_arr;
56511 }
56512
56513 uint64_t  __attribute__((export_name("TS_verify_node_announcement"))) TS_verify_node_announcement(uint64_t msg) {
56514         LDKNodeAnnouncement msg_conv;
56515         msg_conv.inner = untag_ptr(msg);
56516         msg_conv.is_owned = ptr_is_owned(msg);
56517         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
56518         msg_conv.is_owned = false;
56519         LDKCResult_NoneLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneLightningErrorZ), "LDKCResult_NoneLightningErrorZ");
56520         *ret_conv = verify_node_announcement(&msg_conv);
56521         return tag_ptr(ret_conv, true);
56522 }
56523
56524 uint64_t  __attribute__((export_name("TS_verify_channel_announcement"))) TS_verify_channel_announcement(uint64_t msg) {
56525         LDKChannelAnnouncement msg_conv;
56526         msg_conv.inner = untag_ptr(msg);
56527         msg_conv.is_owned = ptr_is_owned(msg);
56528         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
56529         msg_conv.is_owned = false;
56530         LDKCResult_NoneLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneLightningErrorZ), "LDKCResult_NoneLightningErrorZ");
56531         *ret_conv = verify_channel_announcement(&msg_conv);
56532         return tag_ptr(ret_conv, true);
56533 }
56534
56535 uint64_t  __attribute__((export_name("TS_P2PGossipSync_as_RoutingMessageHandler"))) TS_P2PGossipSync_as_RoutingMessageHandler(uint64_t this_arg) {
56536         LDKP2PGossipSync this_arg_conv;
56537         this_arg_conv.inner = untag_ptr(this_arg);
56538         this_arg_conv.is_owned = ptr_is_owned(this_arg);
56539         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
56540         this_arg_conv.is_owned = false;
56541         LDKRoutingMessageHandler* ret_ret = MALLOC(sizeof(LDKRoutingMessageHandler), "LDKRoutingMessageHandler");
56542         *ret_ret = P2PGossipSync_as_RoutingMessageHandler(&this_arg_conv);
56543         return tag_ptr(ret_ret, true);
56544 }
56545
56546 uint64_t  __attribute__((export_name("TS_P2PGossipSync_as_MessageSendEventsProvider"))) TS_P2PGossipSync_as_MessageSendEventsProvider(uint64_t this_arg) {
56547         LDKP2PGossipSync this_arg_conv;
56548         this_arg_conv.inner = untag_ptr(this_arg);
56549         this_arg_conv.is_owned = ptr_is_owned(this_arg);
56550         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
56551         this_arg_conv.is_owned = false;
56552         LDKMessageSendEventsProvider* ret_ret = MALLOC(sizeof(LDKMessageSendEventsProvider), "LDKMessageSendEventsProvider");
56553         *ret_ret = P2PGossipSync_as_MessageSendEventsProvider(&this_arg_conv);
56554         return tag_ptr(ret_ret, true);
56555 }
56556
56557 void  __attribute__((export_name("TS_ChannelUpdateInfo_free"))) TS_ChannelUpdateInfo_free(uint64_t this_obj) {
56558         LDKChannelUpdateInfo this_obj_conv;
56559         this_obj_conv.inner = untag_ptr(this_obj);
56560         this_obj_conv.is_owned = ptr_is_owned(this_obj);
56561         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
56562         ChannelUpdateInfo_free(this_obj_conv);
56563 }
56564
56565 int32_t  __attribute__((export_name("TS_ChannelUpdateInfo_get_last_update"))) TS_ChannelUpdateInfo_get_last_update(uint64_t this_ptr) {
56566         LDKChannelUpdateInfo this_ptr_conv;
56567         this_ptr_conv.inner = untag_ptr(this_ptr);
56568         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
56569         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
56570         this_ptr_conv.is_owned = false;
56571         int32_t ret_conv = ChannelUpdateInfo_get_last_update(&this_ptr_conv);
56572         return ret_conv;
56573 }
56574
56575 void  __attribute__((export_name("TS_ChannelUpdateInfo_set_last_update"))) TS_ChannelUpdateInfo_set_last_update(uint64_t this_ptr, int32_t val) {
56576         LDKChannelUpdateInfo this_ptr_conv;
56577         this_ptr_conv.inner = untag_ptr(this_ptr);
56578         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
56579         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
56580         this_ptr_conv.is_owned = false;
56581         ChannelUpdateInfo_set_last_update(&this_ptr_conv, val);
56582 }
56583
56584 jboolean  __attribute__((export_name("TS_ChannelUpdateInfo_get_enabled"))) TS_ChannelUpdateInfo_get_enabled(uint64_t this_ptr) {
56585         LDKChannelUpdateInfo this_ptr_conv;
56586         this_ptr_conv.inner = untag_ptr(this_ptr);
56587         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
56588         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
56589         this_ptr_conv.is_owned = false;
56590         jboolean ret_conv = ChannelUpdateInfo_get_enabled(&this_ptr_conv);
56591         return ret_conv;
56592 }
56593
56594 void  __attribute__((export_name("TS_ChannelUpdateInfo_set_enabled"))) TS_ChannelUpdateInfo_set_enabled(uint64_t this_ptr, jboolean val) {
56595         LDKChannelUpdateInfo this_ptr_conv;
56596         this_ptr_conv.inner = untag_ptr(this_ptr);
56597         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
56598         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
56599         this_ptr_conv.is_owned = false;
56600         ChannelUpdateInfo_set_enabled(&this_ptr_conv, val);
56601 }
56602
56603 int16_t  __attribute__((export_name("TS_ChannelUpdateInfo_get_cltv_expiry_delta"))) TS_ChannelUpdateInfo_get_cltv_expiry_delta(uint64_t this_ptr) {
56604         LDKChannelUpdateInfo this_ptr_conv;
56605         this_ptr_conv.inner = untag_ptr(this_ptr);
56606         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
56607         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
56608         this_ptr_conv.is_owned = false;
56609         int16_t ret_conv = ChannelUpdateInfo_get_cltv_expiry_delta(&this_ptr_conv);
56610         return ret_conv;
56611 }
56612
56613 void  __attribute__((export_name("TS_ChannelUpdateInfo_set_cltv_expiry_delta"))) TS_ChannelUpdateInfo_set_cltv_expiry_delta(uint64_t this_ptr, int16_t val) {
56614         LDKChannelUpdateInfo this_ptr_conv;
56615         this_ptr_conv.inner = untag_ptr(this_ptr);
56616         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
56617         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
56618         this_ptr_conv.is_owned = false;
56619         ChannelUpdateInfo_set_cltv_expiry_delta(&this_ptr_conv, val);
56620 }
56621
56622 int64_t  __attribute__((export_name("TS_ChannelUpdateInfo_get_htlc_minimum_msat"))) TS_ChannelUpdateInfo_get_htlc_minimum_msat(uint64_t this_ptr) {
56623         LDKChannelUpdateInfo this_ptr_conv;
56624         this_ptr_conv.inner = untag_ptr(this_ptr);
56625         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
56626         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
56627         this_ptr_conv.is_owned = false;
56628         int64_t ret_conv = ChannelUpdateInfo_get_htlc_minimum_msat(&this_ptr_conv);
56629         return ret_conv;
56630 }
56631
56632 void  __attribute__((export_name("TS_ChannelUpdateInfo_set_htlc_minimum_msat"))) TS_ChannelUpdateInfo_set_htlc_minimum_msat(uint64_t this_ptr, int64_t val) {
56633         LDKChannelUpdateInfo this_ptr_conv;
56634         this_ptr_conv.inner = untag_ptr(this_ptr);
56635         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
56636         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
56637         this_ptr_conv.is_owned = false;
56638         ChannelUpdateInfo_set_htlc_minimum_msat(&this_ptr_conv, val);
56639 }
56640
56641 int64_t  __attribute__((export_name("TS_ChannelUpdateInfo_get_htlc_maximum_msat"))) TS_ChannelUpdateInfo_get_htlc_maximum_msat(uint64_t this_ptr) {
56642         LDKChannelUpdateInfo this_ptr_conv;
56643         this_ptr_conv.inner = untag_ptr(this_ptr);
56644         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
56645         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
56646         this_ptr_conv.is_owned = false;
56647         int64_t ret_conv = ChannelUpdateInfo_get_htlc_maximum_msat(&this_ptr_conv);
56648         return ret_conv;
56649 }
56650
56651 void  __attribute__((export_name("TS_ChannelUpdateInfo_set_htlc_maximum_msat"))) TS_ChannelUpdateInfo_set_htlc_maximum_msat(uint64_t this_ptr, int64_t val) {
56652         LDKChannelUpdateInfo this_ptr_conv;
56653         this_ptr_conv.inner = untag_ptr(this_ptr);
56654         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
56655         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
56656         this_ptr_conv.is_owned = false;
56657         ChannelUpdateInfo_set_htlc_maximum_msat(&this_ptr_conv, val);
56658 }
56659
56660 uint64_t  __attribute__((export_name("TS_ChannelUpdateInfo_get_fees"))) TS_ChannelUpdateInfo_get_fees(uint64_t this_ptr) {
56661         LDKChannelUpdateInfo this_ptr_conv;
56662         this_ptr_conv.inner = untag_ptr(this_ptr);
56663         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
56664         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
56665         this_ptr_conv.is_owned = false;
56666         LDKRoutingFees ret_var = ChannelUpdateInfo_get_fees(&this_ptr_conv);
56667         uint64_t ret_ref = 0;
56668         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
56669         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
56670         return ret_ref;
56671 }
56672
56673 void  __attribute__((export_name("TS_ChannelUpdateInfo_set_fees"))) TS_ChannelUpdateInfo_set_fees(uint64_t this_ptr, uint64_t val) {
56674         LDKChannelUpdateInfo this_ptr_conv;
56675         this_ptr_conv.inner = untag_ptr(this_ptr);
56676         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
56677         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
56678         this_ptr_conv.is_owned = false;
56679         LDKRoutingFees val_conv;
56680         val_conv.inner = untag_ptr(val);
56681         val_conv.is_owned = ptr_is_owned(val);
56682         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
56683         val_conv = RoutingFees_clone(&val_conv);
56684         ChannelUpdateInfo_set_fees(&this_ptr_conv, val_conv);
56685 }
56686
56687 uint64_t  __attribute__((export_name("TS_ChannelUpdateInfo_get_last_update_message"))) TS_ChannelUpdateInfo_get_last_update_message(uint64_t this_ptr) {
56688         LDKChannelUpdateInfo this_ptr_conv;
56689         this_ptr_conv.inner = untag_ptr(this_ptr);
56690         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
56691         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
56692         this_ptr_conv.is_owned = false;
56693         LDKChannelUpdate ret_var = ChannelUpdateInfo_get_last_update_message(&this_ptr_conv);
56694         uint64_t ret_ref = 0;
56695         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
56696         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
56697         return ret_ref;
56698 }
56699
56700 void  __attribute__((export_name("TS_ChannelUpdateInfo_set_last_update_message"))) TS_ChannelUpdateInfo_set_last_update_message(uint64_t this_ptr, uint64_t val) {
56701         LDKChannelUpdateInfo this_ptr_conv;
56702         this_ptr_conv.inner = untag_ptr(this_ptr);
56703         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
56704         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
56705         this_ptr_conv.is_owned = false;
56706         LDKChannelUpdate val_conv;
56707         val_conv.inner = untag_ptr(val);
56708         val_conv.is_owned = ptr_is_owned(val);
56709         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
56710         val_conv = ChannelUpdate_clone(&val_conv);
56711         ChannelUpdateInfo_set_last_update_message(&this_ptr_conv, val_conv);
56712 }
56713
56714 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) {
56715         LDKRoutingFees fees_arg_conv;
56716         fees_arg_conv.inner = untag_ptr(fees_arg);
56717         fees_arg_conv.is_owned = ptr_is_owned(fees_arg);
56718         CHECK_INNER_FIELD_ACCESS_OR_NULL(fees_arg_conv);
56719         fees_arg_conv = RoutingFees_clone(&fees_arg_conv);
56720         LDKChannelUpdate last_update_message_arg_conv;
56721         last_update_message_arg_conv.inner = untag_ptr(last_update_message_arg);
56722         last_update_message_arg_conv.is_owned = ptr_is_owned(last_update_message_arg);
56723         CHECK_INNER_FIELD_ACCESS_OR_NULL(last_update_message_arg_conv);
56724         last_update_message_arg_conv = ChannelUpdate_clone(&last_update_message_arg_conv);
56725         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);
56726         uint64_t ret_ref = 0;
56727         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
56728         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
56729         return ret_ref;
56730 }
56731
56732 static inline uint64_t ChannelUpdateInfo_clone_ptr(LDKChannelUpdateInfo *NONNULL_PTR arg) {
56733         LDKChannelUpdateInfo ret_var = ChannelUpdateInfo_clone(arg);
56734         uint64_t ret_ref = 0;
56735         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
56736         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
56737         return ret_ref;
56738 }
56739 int64_t  __attribute__((export_name("TS_ChannelUpdateInfo_clone_ptr"))) TS_ChannelUpdateInfo_clone_ptr(uint64_t arg) {
56740         LDKChannelUpdateInfo arg_conv;
56741         arg_conv.inner = untag_ptr(arg);
56742         arg_conv.is_owned = ptr_is_owned(arg);
56743         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
56744         arg_conv.is_owned = false;
56745         int64_t ret_conv = ChannelUpdateInfo_clone_ptr(&arg_conv);
56746         return ret_conv;
56747 }
56748
56749 uint64_t  __attribute__((export_name("TS_ChannelUpdateInfo_clone"))) TS_ChannelUpdateInfo_clone(uint64_t orig) {
56750         LDKChannelUpdateInfo orig_conv;
56751         orig_conv.inner = untag_ptr(orig);
56752         orig_conv.is_owned = ptr_is_owned(orig);
56753         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
56754         orig_conv.is_owned = false;
56755         LDKChannelUpdateInfo ret_var = ChannelUpdateInfo_clone(&orig_conv);
56756         uint64_t ret_ref = 0;
56757         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
56758         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
56759         return ret_ref;
56760 }
56761
56762 jboolean  __attribute__((export_name("TS_ChannelUpdateInfo_eq"))) TS_ChannelUpdateInfo_eq(uint64_t a, uint64_t b) {
56763         LDKChannelUpdateInfo a_conv;
56764         a_conv.inner = untag_ptr(a);
56765         a_conv.is_owned = ptr_is_owned(a);
56766         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
56767         a_conv.is_owned = false;
56768         LDKChannelUpdateInfo b_conv;
56769         b_conv.inner = untag_ptr(b);
56770         b_conv.is_owned = ptr_is_owned(b);
56771         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
56772         b_conv.is_owned = false;
56773         jboolean ret_conv = ChannelUpdateInfo_eq(&a_conv, &b_conv);
56774         return ret_conv;
56775 }
56776
56777 int8_tArray  __attribute__((export_name("TS_ChannelUpdateInfo_write"))) TS_ChannelUpdateInfo_write(uint64_t obj) {
56778         LDKChannelUpdateInfo obj_conv;
56779         obj_conv.inner = untag_ptr(obj);
56780         obj_conv.is_owned = ptr_is_owned(obj);
56781         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
56782         obj_conv.is_owned = false;
56783         LDKCVec_u8Z ret_var = ChannelUpdateInfo_write(&obj_conv);
56784         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
56785         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
56786         CVec_u8Z_free(ret_var);
56787         return ret_arr;
56788 }
56789
56790 uint64_t  __attribute__((export_name("TS_ChannelUpdateInfo_read"))) TS_ChannelUpdateInfo_read(int8_tArray ser) {
56791         LDKu8slice ser_ref;
56792         ser_ref.datalen = ser->arr_len;
56793         ser_ref.data = ser->elems;
56794         LDKCResult_ChannelUpdateInfoDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelUpdateInfoDecodeErrorZ), "LDKCResult_ChannelUpdateInfoDecodeErrorZ");
56795         *ret_conv = ChannelUpdateInfo_read(ser_ref);
56796         FREE(ser);
56797         return tag_ptr(ret_conv, true);
56798 }
56799
56800 void  __attribute__((export_name("TS_ChannelInfo_free"))) TS_ChannelInfo_free(uint64_t this_obj) {
56801         LDKChannelInfo this_obj_conv;
56802         this_obj_conv.inner = untag_ptr(this_obj);
56803         this_obj_conv.is_owned = ptr_is_owned(this_obj);
56804         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
56805         ChannelInfo_free(this_obj_conv);
56806 }
56807
56808 uint64_t  __attribute__((export_name("TS_ChannelInfo_get_features"))) TS_ChannelInfo_get_features(uint64_t this_ptr) {
56809         LDKChannelInfo this_ptr_conv;
56810         this_ptr_conv.inner = untag_ptr(this_ptr);
56811         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
56812         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
56813         this_ptr_conv.is_owned = false;
56814         LDKChannelFeatures ret_var = ChannelInfo_get_features(&this_ptr_conv);
56815         uint64_t ret_ref = 0;
56816         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
56817         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
56818         return ret_ref;
56819 }
56820
56821 void  __attribute__((export_name("TS_ChannelInfo_set_features"))) TS_ChannelInfo_set_features(uint64_t this_ptr, uint64_t val) {
56822         LDKChannelInfo this_ptr_conv;
56823         this_ptr_conv.inner = untag_ptr(this_ptr);
56824         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
56825         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
56826         this_ptr_conv.is_owned = false;
56827         LDKChannelFeatures val_conv;
56828         val_conv.inner = untag_ptr(val);
56829         val_conv.is_owned = ptr_is_owned(val);
56830         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
56831         val_conv = ChannelFeatures_clone(&val_conv);
56832         ChannelInfo_set_features(&this_ptr_conv, val_conv);
56833 }
56834
56835 uint64_t  __attribute__((export_name("TS_ChannelInfo_get_node_one"))) TS_ChannelInfo_get_node_one(uint64_t this_ptr) {
56836         LDKChannelInfo this_ptr_conv;
56837         this_ptr_conv.inner = untag_ptr(this_ptr);
56838         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
56839         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
56840         this_ptr_conv.is_owned = false;
56841         LDKNodeId ret_var = ChannelInfo_get_node_one(&this_ptr_conv);
56842         uint64_t ret_ref = 0;
56843         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
56844         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
56845         return ret_ref;
56846 }
56847
56848 void  __attribute__((export_name("TS_ChannelInfo_set_node_one"))) TS_ChannelInfo_set_node_one(uint64_t this_ptr, uint64_t val) {
56849         LDKChannelInfo this_ptr_conv;
56850         this_ptr_conv.inner = untag_ptr(this_ptr);
56851         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
56852         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
56853         this_ptr_conv.is_owned = false;
56854         LDKNodeId val_conv;
56855         val_conv.inner = untag_ptr(val);
56856         val_conv.is_owned = ptr_is_owned(val);
56857         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
56858         val_conv = NodeId_clone(&val_conv);
56859         ChannelInfo_set_node_one(&this_ptr_conv, val_conv);
56860 }
56861
56862 uint64_t  __attribute__((export_name("TS_ChannelInfo_get_one_to_two"))) TS_ChannelInfo_get_one_to_two(uint64_t this_ptr) {
56863         LDKChannelInfo this_ptr_conv;
56864         this_ptr_conv.inner = untag_ptr(this_ptr);
56865         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
56866         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
56867         this_ptr_conv.is_owned = false;
56868         LDKChannelUpdateInfo ret_var = ChannelInfo_get_one_to_two(&this_ptr_conv);
56869         uint64_t ret_ref = 0;
56870         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
56871         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
56872         return ret_ref;
56873 }
56874
56875 void  __attribute__((export_name("TS_ChannelInfo_set_one_to_two"))) TS_ChannelInfo_set_one_to_two(uint64_t this_ptr, uint64_t val) {
56876         LDKChannelInfo this_ptr_conv;
56877         this_ptr_conv.inner = untag_ptr(this_ptr);
56878         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
56879         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
56880         this_ptr_conv.is_owned = false;
56881         LDKChannelUpdateInfo val_conv;
56882         val_conv.inner = untag_ptr(val);
56883         val_conv.is_owned = ptr_is_owned(val);
56884         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
56885         val_conv = ChannelUpdateInfo_clone(&val_conv);
56886         ChannelInfo_set_one_to_two(&this_ptr_conv, val_conv);
56887 }
56888
56889 uint64_t  __attribute__((export_name("TS_ChannelInfo_get_node_two"))) TS_ChannelInfo_get_node_two(uint64_t this_ptr) {
56890         LDKChannelInfo this_ptr_conv;
56891         this_ptr_conv.inner = untag_ptr(this_ptr);
56892         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
56893         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
56894         this_ptr_conv.is_owned = false;
56895         LDKNodeId ret_var = ChannelInfo_get_node_two(&this_ptr_conv);
56896         uint64_t ret_ref = 0;
56897         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
56898         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
56899         return ret_ref;
56900 }
56901
56902 void  __attribute__((export_name("TS_ChannelInfo_set_node_two"))) TS_ChannelInfo_set_node_two(uint64_t this_ptr, uint64_t val) {
56903         LDKChannelInfo this_ptr_conv;
56904         this_ptr_conv.inner = untag_ptr(this_ptr);
56905         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
56906         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
56907         this_ptr_conv.is_owned = false;
56908         LDKNodeId val_conv;
56909         val_conv.inner = untag_ptr(val);
56910         val_conv.is_owned = ptr_is_owned(val);
56911         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
56912         val_conv = NodeId_clone(&val_conv);
56913         ChannelInfo_set_node_two(&this_ptr_conv, val_conv);
56914 }
56915
56916 uint64_t  __attribute__((export_name("TS_ChannelInfo_get_two_to_one"))) TS_ChannelInfo_get_two_to_one(uint64_t this_ptr) {
56917         LDKChannelInfo this_ptr_conv;
56918         this_ptr_conv.inner = untag_ptr(this_ptr);
56919         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
56920         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
56921         this_ptr_conv.is_owned = false;
56922         LDKChannelUpdateInfo ret_var = ChannelInfo_get_two_to_one(&this_ptr_conv);
56923         uint64_t ret_ref = 0;
56924         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
56925         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
56926         return ret_ref;
56927 }
56928
56929 void  __attribute__((export_name("TS_ChannelInfo_set_two_to_one"))) TS_ChannelInfo_set_two_to_one(uint64_t this_ptr, uint64_t val) {
56930         LDKChannelInfo this_ptr_conv;
56931         this_ptr_conv.inner = untag_ptr(this_ptr);
56932         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
56933         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
56934         this_ptr_conv.is_owned = false;
56935         LDKChannelUpdateInfo val_conv;
56936         val_conv.inner = untag_ptr(val);
56937         val_conv.is_owned = ptr_is_owned(val);
56938         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
56939         val_conv = ChannelUpdateInfo_clone(&val_conv);
56940         ChannelInfo_set_two_to_one(&this_ptr_conv, val_conv);
56941 }
56942
56943 uint64_t  __attribute__((export_name("TS_ChannelInfo_get_capacity_sats"))) TS_ChannelInfo_get_capacity_sats(uint64_t this_ptr) {
56944         LDKChannelInfo this_ptr_conv;
56945         this_ptr_conv.inner = untag_ptr(this_ptr);
56946         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
56947         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
56948         this_ptr_conv.is_owned = false;
56949         LDKCOption_u64Z *ret_copy = MALLOC(sizeof(LDKCOption_u64Z), "LDKCOption_u64Z");
56950         *ret_copy = ChannelInfo_get_capacity_sats(&this_ptr_conv);
56951         uint64_t ret_ref = tag_ptr(ret_copy, true);
56952         return ret_ref;
56953 }
56954
56955 void  __attribute__((export_name("TS_ChannelInfo_set_capacity_sats"))) TS_ChannelInfo_set_capacity_sats(uint64_t this_ptr, uint64_t val) {
56956         LDKChannelInfo this_ptr_conv;
56957         this_ptr_conv.inner = untag_ptr(this_ptr);
56958         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
56959         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
56960         this_ptr_conv.is_owned = false;
56961         void* val_ptr = untag_ptr(val);
56962         CHECK_ACCESS(val_ptr);
56963         LDKCOption_u64Z val_conv = *(LDKCOption_u64Z*)(val_ptr);
56964         val_conv = COption_u64Z_clone((LDKCOption_u64Z*)untag_ptr(val));
56965         ChannelInfo_set_capacity_sats(&this_ptr_conv, val_conv);
56966 }
56967
56968 uint64_t  __attribute__((export_name("TS_ChannelInfo_get_announcement_message"))) TS_ChannelInfo_get_announcement_message(uint64_t this_ptr) {
56969         LDKChannelInfo this_ptr_conv;
56970         this_ptr_conv.inner = untag_ptr(this_ptr);
56971         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
56972         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
56973         this_ptr_conv.is_owned = false;
56974         LDKChannelAnnouncement ret_var = ChannelInfo_get_announcement_message(&this_ptr_conv);
56975         uint64_t ret_ref = 0;
56976         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
56977         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
56978         return ret_ref;
56979 }
56980
56981 void  __attribute__((export_name("TS_ChannelInfo_set_announcement_message"))) TS_ChannelInfo_set_announcement_message(uint64_t this_ptr, uint64_t val) {
56982         LDKChannelInfo this_ptr_conv;
56983         this_ptr_conv.inner = untag_ptr(this_ptr);
56984         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
56985         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
56986         this_ptr_conv.is_owned = false;
56987         LDKChannelAnnouncement val_conv;
56988         val_conv.inner = untag_ptr(val);
56989         val_conv.is_owned = ptr_is_owned(val);
56990         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
56991         val_conv = ChannelAnnouncement_clone(&val_conv);
56992         ChannelInfo_set_announcement_message(&this_ptr_conv, val_conv);
56993 }
56994
56995 static inline uint64_t ChannelInfo_clone_ptr(LDKChannelInfo *NONNULL_PTR arg) {
56996         LDKChannelInfo ret_var = ChannelInfo_clone(arg);
56997         uint64_t ret_ref = 0;
56998         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
56999         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
57000         return ret_ref;
57001 }
57002 int64_t  __attribute__((export_name("TS_ChannelInfo_clone_ptr"))) TS_ChannelInfo_clone_ptr(uint64_t arg) {
57003         LDKChannelInfo arg_conv;
57004         arg_conv.inner = untag_ptr(arg);
57005         arg_conv.is_owned = ptr_is_owned(arg);
57006         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
57007         arg_conv.is_owned = false;
57008         int64_t ret_conv = ChannelInfo_clone_ptr(&arg_conv);
57009         return ret_conv;
57010 }
57011
57012 uint64_t  __attribute__((export_name("TS_ChannelInfo_clone"))) TS_ChannelInfo_clone(uint64_t orig) {
57013         LDKChannelInfo orig_conv;
57014         orig_conv.inner = untag_ptr(orig);
57015         orig_conv.is_owned = ptr_is_owned(orig);
57016         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
57017         orig_conv.is_owned = false;
57018         LDKChannelInfo ret_var = ChannelInfo_clone(&orig_conv);
57019         uint64_t ret_ref = 0;
57020         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
57021         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
57022         return ret_ref;
57023 }
57024
57025 jboolean  __attribute__((export_name("TS_ChannelInfo_eq"))) TS_ChannelInfo_eq(uint64_t a, uint64_t b) {
57026         LDKChannelInfo a_conv;
57027         a_conv.inner = untag_ptr(a);
57028         a_conv.is_owned = ptr_is_owned(a);
57029         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
57030         a_conv.is_owned = false;
57031         LDKChannelInfo b_conv;
57032         b_conv.inner = untag_ptr(b);
57033         b_conv.is_owned = ptr_is_owned(b);
57034         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
57035         b_conv.is_owned = false;
57036         jboolean ret_conv = ChannelInfo_eq(&a_conv, &b_conv);
57037         return ret_conv;
57038 }
57039
57040 uint64_t  __attribute__((export_name("TS_ChannelInfo_get_directional_info"))) TS_ChannelInfo_get_directional_info(uint64_t this_arg, int8_t channel_flags) {
57041         LDKChannelInfo this_arg_conv;
57042         this_arg_conv.inner = untag_ptr(this_arg);
57043         this_arg_conv.is_owned = ptr_is_owned(this_arg);
57044         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
57045         this_arg_conv.is_owned = false;
57046         LDKChannelUpdateInfo ret_var = ChannelInfo_get_directional_info(&this_arg_conv, channel_flags);
57047         uint64_t ret_ref = 0;
57048         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
57049         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
57050         return ret_ref;
57051 }
57052
57053 int8_tArray  __attribute__((export_name("TS_ChannelInfo_write"))) TS_ChannelInfo_write(uint64_t obj) {
57054         LDKChannelInfo obj_conv;
57055         obj_conv.inner = untag_ptr(obj);
57056         obj_conv.is_owned = ptr_is_owned(obj);
57057         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
57058         obj_conv.is_owned = false;
57059         LDKCVec_u8Z ret_var = ChannelInfo_write(&obj_conv);
57060         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
57061         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
57062         CVec_u8Z_free(ret_var);
57063         return ret_arr;
57064 }
57065
57066 uint64_t  __attribute__((export_name("TS_ChannelInfo_read"))) TS_ChannelInfo_read(int8_tArray ser) {
57067         LDKu8slice ser_ref;
57068         ser_ref.datalen = ser->arr_len;
57069         ser_ref.data = ser->elems;
57070         LDKCResult_ChannelInfoDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelInfoDecodeErrorZ), "LDKCResult_ChannelInfoDecodeErrorZ");
57071         *ret_conv = ChannelInfo_read(ser_ref);
57072         FREE(ser);
57073         return tag_ptr(ret_conv, true);
57074 }
57075
57076 void  __attribute__((export_name("TS_DirectedChannelInfo_free"))) TS_DirectedChannelInfo_free(uint64_t this_obj) {
57077         LDKDirectedChannelInfo this_obj_conv;
57078         this_obj_conv.inner = untag_ptr(this_obj);
57079         this_obj_conv.is_owned = ptr_is_owned(this_obj);
57080         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
57081         DirectedChannelInfo_free(this_obj_conv);
57082 }
57083
57084 static inline uint64_t DirectedChannelInfo_clone_ptr(LDKDirectedChannelInfo *NONNULL_PTR arg) {
57085         LDKDirectedChannelInfo ret_var = DirectedChannelInfo_clone(arg);
57086         uint64_t ret_ref = 0;
57087         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
57088         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
57089         return ret_ref;
57090 }
57091 int64_t  __attribute__((export_name("TS_DirectedChannelInfo_clone_ptr"))) TS_DirectedChannelInfo_clone_ptr(uint64_t arg) {
57092         LDKDirectedChannelInfo arg_conv;
57093         arg_conv.inner = untag_ptr(arg);
57094         arg_conv.is_owned = ptr_is_owned(arg);
57095         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
57096         arg_conv.is_owned = false;
57097         int64_t ret_conv = DirectedChannelInfo_clone_ptr(&arg_conv);
57098         return ret_conv;
57099 }
57100
57101 uint64_t  __attribute__((export_name("TS_DirectedChannelInfo_clone"))) TS_DirectedChannelInfo_clone(uint64_t orig) {
57102         LDKDirectedChannelInfo orig_conv;
57103         orig_conv.inner = untag_ptr(orig);
57104         orig_conv.is_owned = ptr_is_owned(orig);
57105         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
57106         orig_conv.is_owned = false;
57107         LDKDirectedChannelInfo ret_var = DirectedChannelInfo_clone(&orig_conv);
57108         uint64_t ret_ref = 0;
57109         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
57110         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
57111         return ret_ref;
57112 }
57113
57114 uint64_t  __attribute__((export_name("TS_DirectedChannelInfo_channel"))) TS_DirectedChannelInfo_channel(uint64_t this_arg) {
57115         LDKDirectedChannelInfo this_arg_conv;
57116         this_arg_conv.inner = untag_ptr(this_arg);
57117         this_arg_conv.is_owned = ptr_is_owned(this_arg);
57118         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
57119         this_arg_conv.is_owned = false;
57120         LDKChannelInfo ret_var = DirectedChannelInfo_channel(&this_arg_conv);
57121         uint64_t ret_ref = 0;
57122         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
57123         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
57124         return ret_ref;
57125 }
57126
57127 int64_t  __attribute__((export_name("TS_DirectedChannelInfo_htlc_maximum_msat"))) TS_DirectedChannelInfo_htlc_maximum_msat(uint64_t this_arg) {
57128         LDKDirectedChannelInfo this_arg_conv;
57129         this_arg_conv.inner = untag_ptr(this_arg);
57130         this_arg_conv.is_owned = ptr_is_owned(this_arg);
57131         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
57132         this_arg_conv.is_owned = false;
57133         int64_t ret_conv = DirectedChannelInfo_htlc_maximum_msat(&this_arg_conv);
57134         return ret_conv;
57135 }
57136
57137 uint64_t  __attribute__((export_name("TS_DirectedChannelInfo_effective_capacity"))) TS_DirectedChannelInfo_effective_capacity(uint64_t this_arg) {
57138         LDKDirectedChannelInfo this_arg_conv;
57139         this_arg_conv.inner = untag_ptr(this_arg);
57140         this_arg_conv.is_owned = ptr_is_owned(this_arg);
57141         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
57142         this_arg_conv.is_owned = false;
57143         LDKEffectiveCapacity *ret_copy = MALLOC(sizeof(LDKEffectiveCapacity), "LDKEffectiveCapacity");
57144         *ret_copy = DirectedChannelInfo_effective_capacity(&this_arg_conv);
57145         uint64_t ret_ref = tag_ptr(ret_copy, true);
57146         return ret_ref;
57147 }
57148
57149 void  __attribute__((export_name("TS_EffectiveCapacity_free"))) TS_EffectiveCapacity_free(uint64_t this_ptr) {
57150         if (!ptr_is_owned(this_ptr)) return;
57151         void* this_ptr_ptr = untag_ptr(this_ptr);
57152         CHECK_ACCESS(this_ptr_ptr);
57153         LDKEffectiveCapacity this_ptr_conv = *(LDKEffectiveCapacity*)(this_ptr_ptr);
57154         FREE(untag_ptr(this_ptr));
57155         EffectiveCapacity_free(this_ptr_conv);
57156 }
57157
57158 static inline uint64_t EffectiveCapacity_clone_ptr(LDKEffectiveCapacity *NONNULL_PTR arg) {
57159         LDKEffectiveCapacity *ret_copy = MALLOC(sizeof(LDKEffectiveCapacity), "LDKEffectiveCapacity");
57160         *ret_copy = EffectiveCapacity_clone(arg);
57161         uint64_t ret_ref = tag_ptr(ret_copy, true);
57162         return ret_ref;
57163 }
57164 int64_t  __attribute__((export_name("TS_EffectiveCapacity_clone_ptr"))) TS_EffectiveCapacity_clone_ptr(uint64_t arg) {
57165         LDKEffectiveCapacity* arg_conv = (LDKEffectiveCapacity*)untag_ptr(arg);
57166         int64_t ret_conv = EffectiveCapacity_clone_ptr(arg_conv);
57167         return ret_conv;
57168 }
57169
57170 uint64_t  __attribute__((export_name("TS_EffectiveCapacity_clone"))) TS_EffectiveCapacity_clone(uint64_t orig) {
57171         LDKEffectiveCapacity* orig_conv = (LDKEffectiveCapacity*)untag_ptr(orig);
57172         LDKEffectiveCapacity *ret_copy = MALLOC(sizeof(LDKEffectiveCapacity), "LDKEffectiveCapacity");
57173         *ret_copy = EffectiveCapacity_clone(orig_conv);
57174         uint64_t ret_ref = tag_ptr(ret_copy, true);
57175         return ret_ref;
57176 }
57177
57178 uint64_t  __attribute__((export_name("TS_EffectiveCapacity_exact_liquidity"))) TS_EffectiveCapacity_exact_liquidity(int64_t liquidity_msat) {
57179         LDKEffectiveCapacity *ret_copy = MALLOC(sizeof(LDKEffectiveCapacity), "LDKEffectiveCapacity");
57180         *ret_copy = EffectiveCapacity_exact_liquidity(liquidity_msat);
57181         uint64_t ret_ref = tag_ptr(ret_copy, true);
57182         return ret_ref;
57183 }
57184
57185 uint64_t  __attribute__((export_name("TS_EffectiveCapacity_advertised_max_htlc"))) TS_EffectiveCapacity_advertised_max_htlc(int64_t amount_msat) {
57186         LDKEffectiveCapacity *ret_copy = MALLOC(sizeof(LDKEffectiveCapacity), "LDKEffectiveCapacity");
57187         *ret_copy = EffectiveCapacity_advertised_max_htlc(amount_msat);
57188         uint64_t ret_ref = tag_ptr(ret_copy, true);
57189         return ret_ref;
57190 }
57191
57192 uint64_t  __attribute__((export_name("TS_EffectiveCapacity_total"))) TS_EffectiveCapacity_total(int64_t capacity_msat, int64_t htlc_maximum_msat) {
57193         LDKEffectiveCapacity *ret_copy = MALLOC(sizeof(LDKEffectiveCapacity), "LDKEffectiveCapacity");
57194         *ret_copy = EffectiveCapacity_total(capacity_msat, htlc_maximum_msat);
57195         uint64_t ret_ref = tag_ptr(ret_copy, true);
57196         return ret_ref;
57197 }
57198
57199 uint64_t  __attribute__((export_name("TS_EffectiveCapacity_infinite"))) TS_EffectiveCapacity_infinite() {
57200         LDKEffectiveCapacity *ret_copy = MALLOC(sizeof(LDKEffectiveCapacity), "LDKEffectiveCapacity");
57201         *ret_copy = EffectiveCapacity_infinite();
57202         uint64_t ret_ref = tag_ptr(ret_copy, true);
57203         return ret_ref;
57204 }
57205
57206 uint64_t  __attribute__((export_name("TS_EffectiveCapacity_hint_max_htlc"))) TS_EffectiveCapacity_hint_max_htlc(int64_t amount_msat) {
57207         LDKEffectiveCapacity *ret_copy = MALLOC(sizeof(LDKEffectiveCapacity), "LDKEffectiveCapacity");
57208         *ret_copy = EffectiveCapacity_hint_max_htlc(amount_msat);
57209         uint64_t ret_ref = tag_ptr(ret_copy, true);
57210         return ret_ref;
57211 }
57212
57213 uint64_t  __attribute__((export_name("TS_EffectiveCapacity_unknown"))) TS_EffectiveCapacity_unknown() {
57214         LDKEffectiveCapacity *ret_copy = MALLOC(sizeof(LDKEffectiveCapacity), "LDKEffectiveCapacity");
57215         *ret_copy = EffectiveCapacity_unknown();
57216         uint64_t ret_ref = tag_ptr(ret_copy, true);
57217         return ret_ref;
57218 }
57219
57220 int64_t  __attribute__((export_name("TS_EffectiveCapacity_as_msat"))) TS_EffectiveCapacity_as_msat(uint64_t this_arg) {
57221         LDKEffectiveCapacity* this_arg_conv = (LDKEffectiveCapacity*)untag_ptr(this_arg);
57222         int64_t ret_conv = EffectiveCapacity_as_msat(this_arg_conv);
57223         return ret_conv;
57224 }
57225
57226 void  __attribute__((export_name("TS_RoutingFees_free"))) TS_RoutingFees_free(uint64_t this_obj) {
57227         LDKRoutingFees this_obj_conv;
57228         this_obj_conv.inner = untag_ptr(this_obj);
57229         this_obj_conv.is_owned = ptr_is_owned(this_obj);
57230         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
57231         RoutingFees_free(this_obj_conv);
57232 }
57233
57234 int32_t  __attribute__((export_name("TS_RoutingFees_get_base_msat"))) TS_RoutingFees_get_base_msat(uint64_t this_ptr) {
57235         LDKRoutingFees this_ptr_conv;
57236         this_ptr_conv.inner = untag_ptr(this_ptr);
57237         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
57238         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
57239         this_ptr_conv.is_owned = false;
57240         int32_t ret_conv = RoutingFees_get_base_msat(&this_ptr_conv);
57241         return ret_conv;
57242 }
57243
57244 void  __attribute__((export_name("TS_RoutingFees_set_base_msat"))) TS_RoutingFees_set_base_msat(uint64_t this_ptr, int32_t val) {
57245         LDKRoutingFees this_ptr_conv;
57246         this_ptr_conv.inner = untag_ptr(this_ptr);
57247         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
57248         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
57249         this_ptr_conv.is_owned = false;
57250         RoutingFees_set_base_msat(&this_ptr_conv, val);
57251 }
57252
57253 int32_t  __attribute__((export_name("TS_RoutingFees_get_proportional_millionths"))) TS_RoutingFees_get_proportional_millionths(uint64_t this_ptr) {
57254         LDKRoutingFees this_ptr_conv;
57255         this_ptr_conv.inner = untag_ptr(this_ptr);
57256         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
57257         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
57258         this_ptr_conv.is_owned = false;
57259         int32_t ret_conv = RoutingFees_get_proportional_millionths(&this_ptr_conv);
57260         return ret_conv;
57261 }
57262
57263 void  __attribute__((export_name("TS_RoutingFees_set_proportional_millionths"))) TS_RoutingFees_set_proportional_millionths(uint64_t this_ptr, int32_t val) {
57264         LDKRoutingFees this_ptr_conv;
57265         this_ptr_conv.inner = untag_ptr(this_ptr);
57266         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
57267         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
57268         this_ptr_conv.is_owned = false;
57269         RoutingFees_set_proportional_millionths(&this_ptr_conv, val);
57270 }
57271
57272 uint64_t  __attribute__((export_name("TS_RoutingFees_new"))) TS_RoutingFees_new(int32_t base_msat_arg, int32_t proportional_millionths_arg) {
57273         LDKRoutingFees ret_var = RoutingFees_new(base_msat_arg, proportional_millionths_arg);
57274         uint64_t ret_ref = 0;
57275         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
57276         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
57277         return ret_ref;
57278 }
57279
57280 jboolean  __attribute__((export_name("TS_RoutingFees_eq"))) TS_RoutingFees_eq(uint64_t a, uint64_t b) {
57281         LDKRoutingFees a_conv;
57282         a_conv.inner = untag_ptr(a);
57283         a_conv.is_owned = ptr_is_owned(a);
57284         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
57285         a_conv.is_owned = false;
57286         LDKRoutingFees b_conv;
57287         b_conv.inner = untag_ptr(b);
57288         b_conv.is_owned = ptr_is_owned(b);
57289         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
57290         b_conv.is_owned = false;
57291         jboolean ret_conv = RoutingFees_eq(&a_conv, &b_conv);
57292         return ret_conv;
57293 }
57294
57295 static inline uint64_t RoutingFees_clone_ptr(LDKRoutingFees *NONNULL_PTR arg) {
57296         LDKRoutingFees ret_var = RoutingFees_clone(arg);
57297         uint64_t ret_ref = 0;
57298         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
57299         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
57300         return ret_ref;
57301 }
57302 int64_t  __attribute__((export_name("TS_RoutingFees_clone_ptr"))) TS_RoutingFees_clone_ptr(uint64_t arg) {
57303         LDKRoutingFees arg_conv;
57304         arg_conv.inner = untag_ptr(arg);
57305         arg_conv.is_owned = ptr_is_owned(arg);
57306         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
57307         arg_conv.is_owned = false;
57308         int64_t ret_conv = RoutingFees_clone_ptr(&arg_conv);
57309         return ret_conv;
57310 }
57311
57312 uint64_t  __attribute__((export_name("TS_RoutingFees_clone"))) TS_RoutingFees_clone(uint64_t orig) {
57313         LDKRoutingFees orig_conv;
57314         orig_conv.inner = untag_ptr(orig);
57315         orig_conv.is_owned = ptr_is_owned(orig);
57316         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
57317         orig_conv.is_owned = false;
57318         LDKRoutingFees ret_var = RoutingFees_clone(&orig_conv);
57319         uint64_t ret_ref = 0;
57320         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
57321         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
57322         return ret_ref;
57323 }
57324
57325 int64_t  __attribute__((export_name("TS_RoutingFees_hash"))) TS_RoutingFees_hash(uint64_t o) {
57326         LDKRoutingFees o_conv;
57327         o_conv.inner = untag_ptr(o);
57328         o_conv.is_owned = ptr_is_owned(o);
57329         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
57330         o_conv.is_owned = false;
57331         int64_t ret_conv = RoutingFees_hash(&o_conv);
57332         return ret_conv;
57333 }
57334
57335 int8_tArray  __attribute__((export_name("TS_RoutingFees_write"))) TS_RoutingFees_write(uint64_t obj) {
57336         LDKRoutingFees obj_conv;
57337         obj_conv.inner = untag_ptr(obj);
57338         obj_conv.is_owned = ptr_is_owned(obj);
57339         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
57340         obj_conv.is_owned = false;
57341         LDKCVec_u8Z ret_var = RoutingFees_write(&obj_conv);
57342         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
57343         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
57344         CVec_u8Z_free(ret_var);
57345         return ret_arr;
57346 }
57347
57348 uint64_t  __attribute__((export_name("TS_RoutingFees_read"))) TS_RoutingFees_read(int8_tArray ser) {
57349         LDKu8slice ser_ref;
57350         ser_ref.datalen = ser->arr_len;
57351         ser_ref.data = ser->elems;
57352         LDKCResult_RoutingFeesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RoutingFeesDecodeErrorZ), "LDKCResult_RoutingFeesDecodeErrorZ");
57353         *ret_conv = RoutingFees_read(ser_ref);
57354         FREE(ser);
57355         return tag_ptr(ret_conv, true);
57356 }
57357
57358 void  __attribute__((export_name("TS_NodeAnnouncementInfo_free"))) TS_NodeAnnouncementInfo_free(uint64_t this_obj) {
57359         LDKNodeAnnouncementInfo this_obj_conv;
57360         this_obj_conv.inner = untag_ptr(this_obj);
57361         this_obj_conv.is_owned = ptr_is_owned(this_obj);
57362         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
57363         NodeAnnouncementInfo_free(this_obj_conv);
57364 }
57365
57366 uint64_t  __attribute__((export_name("TS_NodeAnnouncementInfo_get_features"))) TS_NodeAnnouncementInfo_get_features(uint64_t this_ptr) {
57367         LDKNodeAnnouncementInfo this_ptr_conv;
57368         this_ptr_conv.inner = untag_ptr(this_ptr);
57369         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
57370         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
57371         this_ptr_conv.is_owned = false;
57372         LDKNodeFeatures ret_var = NodeAnnouncementInfo_get_features(&this_ptr_conv);
57373         uint64_t ret_ref = 0;
57374         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
57375         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
57376         return ret_ref;
57377 }
57378
57379 void  __attribute__((export_name("TS_NodeAnnouncementInfo_set_features"))) TS_NodeAnnouncementInfo_set_features(uint64_t this_ptr, uint64_t val) {
57380         LDKNodeAnnouncementInfo this_ptr_conv;
57381         this_ptr_conv.inner = untag_ptr(this_ptr);
57382         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
57383         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
57384         this_ptr_conv.is_owned = false;
57385         LDKNodeFeatures val_conv;
57386         val_conv.inner = untag_ptr(val);
57387         val_conv.is_owned = ptr_is_owned(val);
57388         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
57389         val_conv = NodeFeatures_clone(&val_conv);
57390         NodeAnnouncementInfo_set_features(&this_ptr_conv, val_conv);
57391 }
57392
57393 int32_t  __attribute__((export_name("TS_NodeAnnouncementInfo_get_last_update"))) TS_NodeAnnouncementInfo_get_last_update(uint64_t this_ptr) {
57394         LDKNodeAnnouncementInfo this_ptr_conv;
57395         this_ptr_conv.inner = untag_ptr(this_ptr);
57396         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
57397         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
57398         this_ptr_conv.is_owned = false;
57399         int32_t ret_conv = NodeAnnouncementInfo_get_last_update(&this_ptr_conv);
57400         return ret_conv;
57401 }
57402
57403 void  __attribute__((export_name("TS_NodeAnnouncementInfo_set_last_update"))) TS_NodeAnnouncementInfo_set_last_update(uint64_t this_ptr, int32_t val) {
57404         LDKNodeAnnouncementInfo this_ptr_conv;
57405         this_ptr_conv.inner = untag_ptr(this_ptr);
57406         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
57407         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
57408         this_ptr_conv.is_owned = false;
57409         NodeAnnouncementInfo_set_last_update(&this_ptr_conv, val);
57410 }
57411
57412 int8_tArray  __attribute__((export_name("TS_NodeAnnouncementInfo_get_rgb"))) TS_NodeAnnouncementInfo_get_rgb(uint64_t this_ptr) {
57413         LDKNodeAnnouncementInfo this_ptr_conv;
57414         this_ptr_conv.inner = untag_ptr(this_ptr);
57415         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
57416         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
57417         this_ptr_conv.is_owned = false;
57418         int8_tArray ret_arr = init_int8_tArray(3, __LINE__);
57419         memcpy(ret_arr->elems, *NodeAnnouncementInfo_get_rgb(&this_ptr_conv), 3);
57420         return ret_arr;
57421 }
57422
57423 void  __attribute__((export_name("TS_NodeAnnouncementInfo_set_rgb"))) TS_NodeAnnouncementInfo_set_rgb(uint64_t this_ptr, int8_tArray val) {
57424         LDKNodeAnnouncementInfo this_ptr_conv;
57425         this_ptr_conv.inner = untag_ptr(this_ptr);
57426         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
57427         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
57428         this_ptr_conv.is_owned = false;
57429         LDKThreeBytes val_ref;
57430         CHECK(val->arr_len == 3);
57431         memcpy(val_ref.data, val->elems, 3); FREE(val);
57432         NodeAnnouncementInfo_set_rgb(&this_ptr_conv, val_ref);
57433 }
57434
57435 uint64_t  __attribute__((export_name("TS_NodeAnnouncementInfo_get_alias"))) TS_NodeAnnouncementInfo_get_alias(uint64_t this_ptr) {
57436         LDKNodeAnnouncementInfo this_ptr_conv;
57437         this_ptr_conv.inner = untag_ptr(this_ptr);
57438         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
57439         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
57440         this_ptr_conv.is_owned = false;
57441         LDKNodeAlias ret_var = NodeAnnouncementInfo_get_alias(&this_ptr_conv);
57442         uint64_t ret_ref = 0;
57443         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
57444         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
57445         return ret_ref;
57446 }
57447
57448 void  __attribute__((export_name("TS_NodeAnnouncementInfo_set_alias"))) TS_NodeAnnouncementInfo_set_alias(uint64_t this_ptr, uint64_t val) {
57449         LDKNodeAnnouncementInfo this_ptr_conv;
57450         this_ptr_conv.inner = untag_ptr(this_ptr);
57451         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
57452         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
57453         this_ptr_conv.is_owned = false;
57454         LDKNodeAlias val_conv;
57455         val_conv.inner = untag_ptr(val);
57456         val_conv.is_owned = ptr_is_owned(val);
57457         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
57458         val_conv = NodeAlias_clone(&val_conv);
57459         NodeAnnouncementInfo_set_alias(&this_ptr_conv, val_conv);
57460 }
57461
57462 uint64_t  __attribute__((export_name("TS_NodeAnnouncementInfo_get_announcement_message"))) TS_NodeAnnouncementInfo_get_announcement_message(uint64_t this_ptr) {
57463         LDKNodeAnnouncementInfo this_ptr_conv;
57464         this_ptr_conv.inner = untag_ptr(this_ptr);
57465         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
57466         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
57467         this_ptr_conv.is_owned = false;
57468         LDKNodeAnnouncement ret_var = NodeAnnouncementInfo_get_announcement_message(&this_ptr_conv);
57469         uint64_t ret_ref = 0;
57470         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
57471         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
57472         return ret_ref;
57473 }
57474
57475 void  __attribute__((export_name("TS_NodeAnnouncementInfo_set_announcement_message"))) TS_NodeAnnouncementInfo_set_announcement_message(uint64_t this_ptr, uint64_t val) {
57476         LDKNodeAnnouncementInfo this_ptr_conv;
57477         this_ptr_conv.inner = untag_ptr(this_ptr);
57478         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
57479         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
57480         this_ptr_conv.is_owned = false;
57481         LDKNodeAnnouncement val_conv;
57482         val_conv.inner = untag_ptr(val);
57483         val_conv.is_owned = ptr_is_owned(val);
57484         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
57485         val_conv = NodeAnnouncement_clone(&val_conv);
57486         NodeAnnouncementInfo_set_announcement_message(&this_ptr_conv, val_conv);
57487 }
57488
57489 uint64_t  __attribute__((export_name("TS_NodeAnnouncementInfo_new"))) TS_NodeAnnouncementInfo_new(uint64_t features_arg, int32_t last_update_arg, int8_tArray rgb_arg, uint64_t alias_arg, uint64_t announcement_message_arg) {
57490         LDKNodeFeatures features_arg_conv;
57491         features_arg_conv.inner = untag_ptr(features_arg);
57492         features_arg_conv.is_owned = ptr_is_owned(features_arg);
57493         CHECK_INNER_FIELD_ACCESS_OR_NULL(features_arg_conv);
57494         features_arg_conv = NodeFeatures_clone(&features_arg_conv);
57495         LDKThreeBytes rgb_arg_ref;
57496         CHECK(rgb_arg->arr_len == 3);
57497         memcpy(rgb_arg_ref.data, rgb_arg->elems, 3); FREE(rgb_arg);
57498         LDKNodeAlias alias_arg_conv;
57499         alias_arg_conv.inner = untag_ptr(alias_arg);
57500         alias_arg_conv.is_owned = ptr_is_owned(alias_arg);
57501         CHECK_INNER_FIELD_ACCESS_OR_NULL(alias_arg_conv);
57502         alias_arg_conv = NodeAlias_clone(&alias_arg_conv);
57503         LDKNodeAnnouncement announcement_message_arg_conv;
57504         announcement_message_arg_conv.inner = untag_ptr(announcement_message_arg);
57505         announcement_message_arg_conv.is_owned = ptr_is_owned(announcement_message_arg);
57506         CHECK_INNER_FIELD_ACCESS_OR_NULL(announcement_message_arg_conv);
57507         announcement_message_arg_conv = NodeAnnouncement_clone(&announcement_message_arg_conv);
57508         LDKNodeAnnouncementInfo ret_var = NodeAnnouncementInfo_new(features_arg_conv, last_update_arg, rgb_arg_ref, alias_arg_conv, announcement_message_arg_conv);
57509         uint64_t ret_ref = 0;
57510         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
57511         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
57512         return ret_ref;
57513 }
57514
57515 static inline uint64_t NodeAnnouncementInfo_clone_ptr(LDKNodeAnnouncementInfo *NONNULL_PTR arg) {
57516         LDKNodeAnnouncementInfo ret_var = NodeAnnouncementInfo_clone(arg);
57517         uint64_t ret_ref = 0;
57518         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
57519         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
57520         return ret_ref;
57521 }
57522 int64_t  __attribute__((export_name("TS_NodeAnnouncementInfo_clone_ptr"))) TS_NodeAnnouncementInfo_clone_ptr(uint64_t arg) {
57523         LDKNodeAnnouncementInfo arg_conv;
57524         arg_conv.inner = untag_ptr(arg);
57525         arg_conv.is_owned = ptr_is_owned(arg);
57526         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
57527         arg_conv.is_owned = false;
57528         int64_t ret_conv = NodeAnnouncementInfo_clone_ptr(&arg_conv);
57529         return ret_conv;
57530 }
57531
57532 uint64_t  __attribute__((export_name("TS_NodeAnnouncementInfo_clone"))) TS_NodeAnnouncementInfo_clone(uint64_t orig) {
57533         LDKNodeAnnouncementInfo orig_conv;
57534         orig_conv.inner = untag_ptr(orig);
57535         orig_conv.is_owned = ptr_is_owned(orig);
57536         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
57537         orig_conv.is_owned = false;
57538         LDKNodeAnnouncementInfo ret_var = NodeAnnouncementInfo_clone(&orig_conv);
57539         uint64_t ret_ref = 0;
57540         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
57541         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
57542         return ret_ref;
57543 }
57544
57545 jboolean  __attribute__((export_name("TS_NodeAnnouncementInfo_eq"))) TS_NodeAnnouncementInfo_eq(uint64_t a, uint64_t b) {
57546         LDKNodeAnnouncementInfo a_conv;
57547         a_conv.inner = untag_ptr(a);
57548         a_conv.is_owned = ptr_is_owned(a);
57549         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
57550         a_conv.is_owned = false;
57551         LDKNodeAnnouncementInfo b_conv;
57552         b_conv.inner = untag_ptr(b);
57553         b_conv.is_owned = ptr_is_owned(b);
57554         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
57555         b_conv.is_owned = false;
57556         jboolean ret_conv = NodeAnnouncementInfo_eq(&a_conv, &b_conv);
57557         return ret_conv;
57558 }
57559
57560 uint64_tArray  __attribute__((export_name("TS_NodeAnnouncementInfo_addresses"))) TS_NodeAnnouncementInfo_addresses(uint64_t this_arg) {
57561         LDKNodeAnnouncementInfo this_arg_conv;
57562         this_arg_conv.inner = untag_ptr(this_arg);
57563         this_arg_conv.is_owned = ptr_is_owned(this_arg);
57564         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
57565         this_arg_conv.is_owned = false;
57566         LDKCVec_SocketAddressZ ret_var = NodeAnnouncementInfo_addresses(&this_arg_conv);
57567         uint64_tArray ret_arr = NULL;
57568         ret_arr = init_uint64_tArray(ret_var.datalen, __LINE__);
57569         uint64_t *ret_arr_ptr = (uint64_t*)(((uint8_t*)ret_arr) + 8);
57570         for (size_t p = 0; p < ret_var.datalen; p++) {
57571                 LDKSocketAddress *ret_conv_15_copy = MALLOC(sizeof(LDKSocketAddress), "LDKSocketAddress");
57572                 *ret_conv_15_copy = ret_var.data[p];
57573                 uint64_t ret_conv_15_ref = tag_ptr(ret_conv_15_copy, true);
57574                 ret_arr_ptr[p] = ret_conv_15_ref;
57575         }
57576         
57577         FREE(ret_var.data);
57578         return ret_arr;
57579 }
57580
57581 int8_tArray  __attribute__((export_name("TS_NodeAnnouncementInfo_write"))) TS_NodeAnnouncementInfo_write(uint64_t obj) {
57582         LDKNodeAnnouncementInfo obj_conv;
57583         obj_conv.inner = untag_ptr(obj);
57584         obj_conv.is_owned = ptr_is_owned(obj);
57585         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
57586         obj_conv.is_owned = false;
57587         LDKCVec_u8Z ret_var = NodeAnnouncementInfo_write(&obj_conv);
57588         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
57589         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
57590         CVec_u8Z_free(ret_var);
57591         return ret_arr;
57592 }
57593
57594 uint64_t  __attribute__((export_name("TS_NodeAnnouncementInfo_read"))) TS_NodeAnnouncementInfo_read(int8_tArray ser) {
57595         LDKu8slice ser_ref;
57596         ser_ref.datalen = ser->arr_len;
57597         ser_ref.data = ser->elems;
57598         LDKCResult_NodeAnnouncementInfoDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NodeAnnouncementInfoDecodeErrorZ), "LDKCResult_NodeAnnouncementInfoDecodeErrorZ");
57599         *ret_conv = NodeAnnouncementInfo_read(ser_ref);
57600         FREE(ser);
57601         return tag_ptr(ret_conv, true);
57602 }
57603
57604 void  __attribute__((export_name("TS_NodeAlias_free"))) TS_NodeAlias_free(uint64_t this_obj) {
57605         LDKNodeAlias this_obj_conv;
57606         this_obj_conv.inner = untag_ptr(this_obj);
57607         this_obj_conv.is_owned = ptr_is_owned(this_obj);
57608         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
57609         NodeAlias_free(this_obj_conv);
57610 }
57611
57612 int8_tArray  __attribute__((export_name("TS_NodeAlias_get_a"))) TS_NodeAlias_get_a(uint64_t this_ptr) {
57613         LDKNodeAlias this_ptr_conv;
57614         this_ptr_conv.inner = untag_ptr(this_ptr);
57615         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
57616         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
57617         this_ptr_conv.is_owned = false;
57618         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
57619         memcpy(ret_arr->elems, *NodeAlias_get_a(&this_ptr_conv), 32);
57620         return ret_arr;
57621 }
57622
57623 void  __attribute__((export_name("TS_NodeAlias_set_a"))) TS_NodeAlias_set_a(uint64_t this_ptr, int8_tArray val) {
57624         LDKNodeAlias this_ptr_conv;
57625         this_ptr_conv.inner = untag_ptr(this_ptr);
57626         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
57627         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
57628         this_ptr_conv.is_owned = false;
57629         LDKThirtyTwoBytes val_ref;
57630         CHECK(val->arr_len == 32);
57631         memcpy(val_ref.data, val->elems, 32); FREE(val);
57632         NodeAlias_set_a(&this_ptr_conv, val_ref);
57633 }
57634
57635 uint64_t  __attribute__((export_name("TS_NodeAlias_new"))) TS_NodeAlias_new(int8_tArray a_arg) {
57636         LDKThirtyTwoBytes a_arg_ref;
57637         CHECK(a_arg->arr_len == 32);
57638         memcpy(a_arg_ref.data, a_arg->elems, 32); FREE(a_arg);
57639         LDKNodeAlias ret_var = NodeAlias_new(a_arg_ref);
57640         uint64_t ret_ref = 0;
57641         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
57642         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
57643         return ret_ref;
57644 }
57645
57646 static inline uint64_t NodeAlias_clone_ptr(LDKNodeAlias *NONNULL_PTR arg) {
57647         LDKNodeAlias ret_var = NodeAlias_clone(arg);
57648         uint64_t ret_ref = 0;
57649         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
57650         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
57651         return ret_ref;
57652 }
57653 int64_t  __attribute__((export_name("TS_NodeAlias_clone_ptr"))) TS_NodeAlias_clone_ptr(uint64_t arg) {
57654         LDKNodeAlias arg_conv;
57655         arg_conv.inner = untag_ptr(arg);
57656         arg_conv.is_owned = ptr_is_owned(arg);
57657         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
57658         arg_conv.is_owned = false;
57659         int64_t ret_conv = NodeAlias_clone_ptr(&arg_conv);
57660         return ret_conv;
57661 }
57662
57663 uint64_t  __attribute__((export_name("TS_NodeAlias_clone"))) TS_NodeAlias_clone(uint64_t orig) {
57664         LDKNodeAlias orig_conv;
57665         orig_conv.inner = untag_ptr(orig);
57666         orig_conv.is_owned = ptr_is_owned(orig);
57667         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
57668         orig_conv.is_owned = false;
57669         LDKNodeAlias ret_var = NodeAlias_clone(&orig_conv);
57670         uint64_t ret_ref = 0;
57671         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
57672         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
57673         return ret_ref;
57674 }
57675
57676 jboolean  __attribute__((export_name("TS_NodeAlias_eq"))) TS_NodeAlias_eq(uint64_t a, uint64_t b) {
57677         LDKNodeAlias a_conv;
57678         a_conv.inner = untag_ptr(a);
57679         a_conv.is_owned = ptr_is_owned(a);
57680         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
57681         a_conv.is_owned = false;
57682         LDKNodeAlias b_conv;
57683         b_conv.inner = untag_ptr(b);
57684         b_conv.is_owned = ptr_is_owned(b);
57685         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
57686         b_conv.is_owned = false;
57687         jboolean ret_conv = NodeAlias_eq(&a_conv, &b_conv);
57688         return ret_conv;
57689 }
57690
57691 int8_tArray  __attribute__((export_name("TS_NodeAlias_write"))) TS_NodeAlias_write(uint64_t obj) {
57692         LDKNodeAlias obj_conv;
57693         obj_conv.inner = untag_ptr(obj);
57694         obj_conv.is_owned = ptr_is_owned(obj);
57695         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
57696         obj_conv.is_owned = false;
57697         LDKCVec_u8Z ret_var = NodeAlias_write(&obj_conv);
57698         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
57699         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
57700         CVec_u8Z_free(ret_var);
57701         return ret_arr;
57702 }
57703
57704 uint64_t  __attribute__((export_name("TS_NodeAlias_read"))) TS_NodeAlias_read(int8_tArray ser) {
57705         LDKu8slice ser_ref;
57706         ser_ref.datalen = ser->arr_len;
57707         ser_ref.data = ser->elems;
57708         LDKCResult_NodeAliasDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NodeAliasDecodeErrorZ), "LDKCResult_NodeAliasDecodeErrorZ");
57709         *ret_conv = NodeAlias_read(ser_ref);
57710         FREE(ser);
57711         return tag_ptr(ret_conv, true);
57712 }
57713
57714 void  __attribute__((export_name("TS_NodeInfo_free"))) TS_NodeInfo_free(uint64_t this_obj) {
57715         LDKNodeInfo this_obj_conv;
57716         this_obj_conv.inner = untag_ptr(this_obj);
57717         this_obj_conv.is_owned = ptr_is_owned(this_obj);
57718         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
57719         NodeInfo_free(this_obj_conv);
57720 }
57721
57722 int64_tArray  __attribute__((export_name("TS_NodeInfo_get_channels"))) TS_NodeInfo_get_channels(uint64_t this_ptr) {
57723         LDKNodeInfo this_ptr_conv;
57724         this_ptr_conv.inner = untag_ptr(this_ptr);
57725         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
57726         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
57727         this_ptr_conv.is_owned = false;
57728         LDKCVec_u64Z ret_var = NodeInfo_get_channels(&this_ptr_conv);
57729         int64_tArray ret_arr = NULL;
57730         ret_arr = init_int64_tArray(ret_var.datalen, __LINE__);
57731         int64_t *ret_arr_ptr = (int64_t*)(((uint8_t*)ret_arr) + 8);
57732         for (size_t i = 0; i < ret_var.datalen; i++) {
57733                 int64_t ret_conv_8_conv = ret_var.data[i];
57734                 ret_arr_ptr[i] = ret_conv_8_conv;
57735         }
57736         
57737         FREE(ret_var.data);
57738         return ret_arr;
57739 }
57740
57741 void  __attribute__((export_name("TS_NodeInfo_set_channels"))) TS_NodeInfo_set_channels(uint64_t this_ptr, int64_tArray val) {
57742         LDKNodeInfo this_ptr_conv;
57743         this_ptr_conv.inner = untag_ptr(this_ptr);
57744         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
57745         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
57746         this_ptr_conv.is_owned = false;
57747         LDKCVec_u64Z val_constr;
57748         val_constr.datalen = val->arr_len;
57749         if (val_constr.datalen > 0)
57750                 val_constr.data = MALLOC(val_constr.datalen * sizeof(int64_t), "LDKCVec_u64Z Elements");
57751         else
57752                 val_constr.data = NULL;
57753         int64_t* val_vals = val->elems;
57754         for (size_t i = 0; i < val_constr.datalen; i++) {
57755                 int64_t val_conv_8 = val_vals[i];
57756                 val_constr.data[i] = val_conv_8;
57757         }
57758         FREE(val);
57759         NodeInfo_set_channels(&this_ptr_conv, val_constr);
57760 }
57761
57762 uint64_t  __attribute__((export_name("TS_NodeInfo_get_announcement_info"))) TS_NodeInfo_get_announcement_info(uint64_t this_ptr) {
57763         LDKNodeInfo this_ptr_conv;
57764         this_ptr_conv.inner = untag_ptr(this_ptr);
57765         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
57766         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
57767         this_ptr_conv.is_owned = false;
57768         LDKNodeAnnouncementInfo ret_var = NodeInfo_get_announcement_info(&this_ptr_conv);
57769         uint64_t ret_ref = 0;
57770         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
57771         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
57772         return ret_ref;
57773 }
57774
57775 void  __attribute__((export_name("TS_NodeInfo_set_announcement_info"))) TS_NodeInfo_set_announcement_info(uint64_t this_ptr, uint64_t val) {
57776         LDKNodeInfo this_ptr_conv;
57777         this_ptr_conv.inner = untag_ptr(this_ptr);
57778         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
57779         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
57780         this_ptr_conv.is_owned = false;
57781         LDKNodeAnnouncementInfo val_conv;
57782         val_conv.inner = untag_ptr(val);
57783         val_conv.is_owned = ptr_is_owned(val);
57784         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
57785         val_conv = NodeAnnouncementInfo_clone(&val_conv);
57786         NodeInfo_set_announcement_info(&this_ptr_conv, val_conv);
57787 }
57788
57789 uint64_t  __attribute__((export_name("TS_NodeInfo_new"))) TS_NodeInfo_new(int64_tArray channels_arg, uint64_t announcement_info_arg) {
57790         LDKCVec_u64Z channels_arg_constr;
57791         channels_arg_constr.datalen = channels_arg->arr_len;
57792         if (channels_arg_constr.datalen > 0)
57793                 channels_arg_constr.data = MALLOC(channels_arg_constr.datalen * sizeof(int64_t), "LDKCVec_u64Z Elements");
57794         else
57795                 channels_arg_constr.data = NULL;
57796         int64_t* channels_arg_vals = channels_arg->elems;
57797         for (size_t i = 0; i < channels_arg_constr.datalen; i++) {
57798                 int64_t channels_arg_conv_8 = channels_arg_vals[i];
57799                 channels_arg_constr.data[i] = channels_arg_conv_8;
57800         }
57801         FREE(channels_arg);
57802         LDKNodeAnnouncementInfo announcement_info_arg_conv;
57803         announcement_info_arg_conv.inner = untag_ptr(announcement_info_arg);
57804         announcement_info_arg_conv.is_owned = ptr_is_owned(announcement_info_arg);
57805         CHECK_INNER_FIELD_ACCESS_OR_NULL(announcement_info_arg_conv);
57806         announcement_info_arg_conv = NodeAnnouncementInfo_clone(&announcement_info_arg_conv);
57807         LDKNodeInfo ret_var = NodeInfo_new(channels_arg_constr, announcement_info_arg_conv);
57808         uint64_t ret_ref = 0;
57809         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
57810         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
57811         return ret_ref;
57812 }
57813
57814 static inline uint64_t NodeInfo_clone_ptr(LDKNodeInfo *NONNULL_PTR arg) {
57815         LDKNodeInfo ret_var = NodeInfo_clone(arg);
57816         uint64_t ret_ref = 0;
57817         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
57818         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
57819         return ret_ref;
57820 }
57821 int64_t  __attribute__((export_name("TS_NodeInfo_clone_ptr"))) TS_NodeInfo_clone_ptr(uint64_t arg) {
57822         LDKNodeInfo arg_conv;
57823         arg_conv.inner = untag_ptr(arg);
57824         arg_conv.is_owned = ptr_is_owned(arg);
57825         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
57826         arg_conv.is_owned = false;
57827         int64_t ret_conv = NodeInfo_clone_ptr(&arg_conv);
57828         return ret_conv;
57829 }
57830
57831 uint64_t  __attribute__((export_name("TS_NodeInfo_clone"))) TS_NodeInfo_clone(uint64_t orig) {
57832         LDKNodeInfo orig_conv;
57833         orig_conv.inner = untag_ptr(orig);
57834         orig_conv.is_owned = ptr_is_owned(orig);
57835         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
57836         orig_conv.is_owned = false;
57837         LDKNodeInfo ret_var = NodeInfo_clone(&orig_conv);
57838         uint64_t ret_ref = 0;
57839         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
57840         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
57841         return ret_ref;
57842 }
57843
57844 jboolean  __attribute__((export_name("TS_NodeInfo_eq"))) TS_NodeInfo_eq(uint64_t a, uint64_t b) {
57845         LDKNodeInfo a_conv;
57846         a_conv.inner = untag_ptr(a);
57847         a_conv.is_owned = ptr_is_owned(a);
57848         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
57849         a_conv.is_owned = false;
57850         LDKNodeInfo b_conv;
57851         b_conv.inner = untag_ptr(b);
57852         b_conv.is_owned = ptr_is_owned(b);
57853         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
57854         b_conv.is_owned = false;
57855         jboolean ret_conv = NodeInfo_eq(&a_conv, &b_conv);
57856         return ret_conv;
57857 }
57858
57859 int8_tArray  __attribute__((export_name("TS_NodeInfo_write"))) TS_NodeInfo_write(uint64_t obj) {
57860         LDKNodeInfo obj_conv;
57861         obj_conv.inner = untag_ptr(obj);
57862         obj_conv.is_owned = ptr_is_owned(obj);
57863         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
57864         obj_conv.is_owned = false;
57865         LDKCVec_u8Z ret_var = NodeInfo_write(&obj_conv);
57866         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
57867         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
57868         CVec_u8Z_free(ret_var);
57869         return ret_arr;
57870 }
57871
57872 uint64_t  __attribute__((export_name("TS_NodeInfo_read"))) TS_NodeInfo_read(int8_tArray ser) {
57873         LDKu8slice ser_ref;
57874         ser_ref.datalen = ser->arr_len;
57875         ser_ref.data = ser->elems;
57876         LDKCResult_NodeInfoDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NodeInfoDecodeErrorZ), "LDKCResult_NodeInfoDecodeErrorZ");
57877         *ret_conv = NodeInfo_read(ser_ref);
57878         FREE(ser);
57879         return tag_ptr(ret_conv, true);
57880 }
57881
57882 int8_tArray  __attribute__((export_name("TS_NetworkGraph_write"))) TS_NetworkGraph_write(uint64_t obj) {
57883         LDKNetworkGraph obj_conv;
57884         obj_conv.inner = untag_ptr(obj);
57885         obj_conv.is_owned = ptr_is_owned(obj);
57886         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
57887         obj_conv.is_owned = false;
57888         LDKCVec_u8Z ret_var = NetworkGraph_write(&obj_conv);
57889         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
57890         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
57891         CVec_u8Z_free(ret_var);
57892         return ret_arr;
57893 }
57894
57895 uint64_t  __attribute__((export_name("TS_NetworkGraph_read"))) TS_NetworkGraph_read(int8_tArray ser, uint64_t arg) {
57896         LDKu8slice ser_ref;
57897         ser_ref.datalen = ser->arr_len;
57898         ser_ref.data = ser->elems;
57899         void* arg_ptr = untag_ptr(arg);
57900         CHECK_ACCESS(arg_ptr);
57901         LDKLogger arg_conv = *(LDKLogger*)(arg_ptr);
57902         if (arg_conv.free == LDKLogger_JCalls_free) {
57903                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
57904                 LDKLogger_JCalls_cloned(&arg_conv);
57905         }
57906         LDKCResult_NetworkGraphDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NetworkGraphDecodeErrorZ), "LDKCResult_NetworkGraphDecodeErrorZ");
57907         *ret_conv = NetworkGraph_read(ser_ref, arg_conv);
57908         FREE(ser);
57909         return tag_ptr(ret_conv, true);
57910 }
57911
57912 uint64_t  __attribute__((export_name("TS_NetworkGraph_new"))) TS_NetworkGraph_new(uint32_t network, uint64_t logger) {
57913         LDKNetwork network_conv = LDKNetwork_from_js(network);
57914         void* logger_ptr = untag_ptr(logger);
57915         CHECK_ACCESS(logger_ptr);
57916         LDKLogger logger_conv = *(LDKLogger*)(logger_ptr);
57917         if (logger_conv.free == LDKLogger_JCalls_free) {
57918                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
57919                 LDKLogger_JCalls_cloned(&logger_conv);
57920         }
57921         LDKNetworkGraph ret_var = NetworkGraph_new(network_conv, logger_conv);
57922         uint64_t ret_ref = 0;
57923         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
57924         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
57925         return ret_ref;
57926 }
57927
57928 uint64_t  __attribute__((export_name("TS_NetworkGraph_read_only"))) TS_NetworkGraph_read_only(uint64_t this_arg) {
57929         LDKNetworkGraph this_arg_conv;
57930         this_arg_conv.inner = untag_ptr(this_arg);
57931         this_arg_conv.is_owned = ptr_is_owned(this_arg);
57932         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
57933         this_arg_conv.is_owned = false;
57934         LDKReadOnlyNetworkGraph ret_var = NetworkGraph_read_only(&this_arg_conv);
57935         uint64_t ret_ref = 0;
57936         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
57937         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
57938         return ret_ref;
57939 }
57940
57941 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) {
57942         LDKNetworkGraph this_arg_conv;
57943         this_arg_conv.inner = untag_ptr(this_arg);
57944         this_arg_conv.is_owned = ptr_is_owned(this_arg);
57945         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
57946         this_arg_conv.is_owned = false;
57947         LDKCOption_u32Z *ret_copy = MALLOC(sizeof(LDKCOption_u32Z), "LDKCOption_u32Z");
57948         *ret_copy = NetworkGraph_get_last_rapid_gossip_sync_timestamp(&this_arg_conv);
57949         uint64_t ret_ref = tag_ptr(ret_copy, true);
57950         return ret_ref;
57951 }
57952
57953 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) {
57954         LDKNetworkGraph this_arg_conv;
57955         this_arg_conv.inner = untag_ptr(this_arg);
57956         this_arg_conv.is_owned = ptr_is_owned(this_arg);
57957         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
57958         this_arg_conv.is_owned = false;
57959         NetworkGraph_set_last_rapid_gossip_sync_timestamp(&this_arg_conv, last_rapid_gossip_sync_timestamp);
57960 }
57961
57962 uint64_t  __attribute__((export_name("TS_NetworkGraph_update_node_from_announcement"))) TS_NetworkGraph_update_node_from_announcement(uint64_t this_arg, uint64_t msg) {
57963         LDKNetworkGraph this_arg_conv;
57964         this_arg_conv.inner = untag_ptr(this_arg);
57965         this_arg_conv.is_owned = ptr_is_owned(this_arg);
57966         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
57967         this_arg_conv.is_owned = false;
57968         LDKNodeAnnouncement msg_conv;
57969         msg_conv.inner = untag_ptr(msg);
57970         msg_conv.is_owned = ptr_is_owned(msg);
57971         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
57972         msg_conv.is_owned = false;
57973         LDKCResult_NoneLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneLightningErrorZ), "LDKCResult_NoneLightningErrorZ");
57974         *ret_conv = NetworkGraph_update_node_from_announcement(&this_arg_conv, &msg_conv);
57975         return tag_ptr(ret_conv, true);
57976 }
57977
57978 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) {
57979         LDKNetworkGraph this_arg_conv;
57980         this_arg_conv.inner = untag_ptr(this_arg);
57981         this_arg_conv.is_owned = ptr_is_owned(this_arg);
57982         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
57983         this_arg_conv.is_owned = false;
57984         LDKUnsignedNodeAnnouncement msg_conv;
57985         msg_conv.inner = untag_ptr(msg);
57986         msg_conv.is_owned = ptr_is_owned(msg);
57987         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
57988         msg_conv.is_owned = false;
57989         LDKCResult_NoneLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneLightningErrorZ), "LDKCResult_NoneLightningErrorZ");
57990         *ret_conv = NetworkGraph_update_node_from_unsigned_announcement(&this_arg_conv, &msg_conv);
57991         return tag_ptr(ret_conv, true);
57992 }
57993
57994 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) {
57995         LDKNetworkGraph this_arg_conv;
57996         this_arg_conv.inner = untag_ptr(this_arg);
57997         this_arg_conv.is_owned = ptr_is_owned(this_arg);
57998         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
57999         this_arg_conv.is_owned = false;
58000         LDKChannelAnnouncement msg_conv;
58001         msg_conv.inner = untag_ptr(msg);
58002         msg_conv.is_owned = ptr_is_owned(msg);
58003         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
58004         msg_conv.is_owned = false;
58005         void* utxo_lookup_ptr = untag_ptr(utxo_lookup);
58006         CHECK_ACCESS(utxo_lookup_ptr);
58007         LDKCOption_UtxoLookupZ utxo_lookup_conv = *(LDKCOption_UtxoLookupZ*)(utxo_lookup_ptr);
58008         // WARNING: we may need a move here but no clone is available for LDKCOption_UtxoLookupZ
58009         if (utxo_lookup_conv.tag == LDKCOption_UtxoLookupZ_Some) {
58010                 // Manually implement clone for Java trait instances
58011                 if (utxo_lookup_conv.some.free == LDKUtxoLookup_JCalls_free) {
58012                         // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
58013                         LDKUtxoLookup_JCalls_cloned(&utxo_lookup_conv.some);
58014                 }
58015         }
58016         LDKCResult_NoneLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneLightningErrorZ), "LDKCResult_NoneLightningErrorZ");
58017         *ret_conv = NetworkGraph_update_channel_from_announcement(&this_arg_conv, &msg_conv, utxo_lookup_conv);
58018         return tag_ptr(ret_conv, true);
58019 }
58020
58021 uint64_t  __attribute__((export_name("TS_NetworkGraph_update_channel_from_announcement_no_lookup"))) TS_NetworkGraph_update_channel_from_announcement_no_lookup(uint64_t this_arg, uint64_t msg) {
58022         LDKNetworkGraph this_arg_conv;
58023         this_arg_conv.inner = untag_ptr(this_arg);
58024         this_arg_conv.is_owned = ptr_is_owned(this_arg);
58025         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
58026         this_arg_conv.is_owned = false;
58027         LDKChannelAnnouncement msg_conv;
58028         msg_conv.inner = untag_ptr(msg);
58029         msg_conv.is_owned = ptr_is_owned(msg);
58030         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
58031         msg_conv.is_owned = false;
58032         LDKCResult_NoneLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneLightningErrorZ), "LDKCResult_NoneLightningErrorZ");
58033         *ret_conv = NetworkGraph_update_channel_from_announcement_no_lookup(&this_arg_conv, &msg_conv);
58034         return tag_ptr(ret_conv, true);
58035 }
58036
58037 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) {
58038         LDKNetworkGraph this_arg_conv;
58039         this_arg_conv.inner = untag_ptr(this_arg);
58040         this_arg_conv.is_owned = ptr_is_owned(this_arg);
58041         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
58042         this_arg_conv.is_owned = false;
58043         LDKUnsignedChannelAnnouncement msg_conv;
58044         msg_conv.inner = untag_ptr(msg);
58045         msg_conv.is_owned = ptr_is_owned(msg);
58046         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
58047         msg_conv.is_owned = false;
58048         void* utxo_lookup_ptr = untag_ptr(utxo_lookup);
58049         CHECK_ACCESS(utxo_lookup_ptr);
58050         LDKCOption_UtxoLookupZ utxo_lookup_conv = *(LDKCOption_UtxoLookupZ*)(utxo_lookup_ptr);
58051         // WARNING: we may need a move here but no clone is available for LDKCOption_UtxoLookupZ
58052         if (utxo_lookup_conv.tag == LDKCOption_UtxoLookupZ_Some) {
58053                 // Manually implement clone for Java trait instances
58054                 if (utxo_lookup_conv.some.free == LDKUtxoLookup_JCalls_free) {
58055                         // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
58056                         LDKUtxoLookup_JCalls_cloned(&utxo_lookup_conv.some);
58057                 }
58058         }
58059         LDKCResult_NoneLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneLightningErrorZ), "LDKCResult_NoneLightningErrorZ");
58060         *ret_conv = NetworkGraph_update_channel_from_unsigned_announcement(&this_arg_conv, &msg_conv, utxo_lookup_conv);
58061         return tag_ptr(ret_conv, true);
58062 }
58063
58064 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) {
58065         LDKNetworkGraph this_arg_conv;
58066         this_arg_conv.inner = untag_ptr(this_arg);
58067         this_arg_conv.is_owned = ptr_is_owned(this_arg);
58068         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
58069         this_arg_conv.is_owned = false;
58070         LDKChannelFeatures features_conv;
58071         features_conv.inner = untag_ptr(features);
58072         features_conv.is_owned = ptr_is_owned(features);
58073         CHECK_INNER_FIELD_ACCESS_OR_NULL(features_conv);
58074         features_conv = ChannelFeatures_clone(&features_conv);
58075         LDKPublicKey node_id_1_ref;
58076         CHECK(node_id_1->arr_len == 33);
58077         memcpy(node_id_1_ref.compressed_form, node_id_1->elems, 33); FREE(node_id_1);
58078         LDKPublicKey node_id_2_ref;
58079         CHECK(node_id_2->arr_len == 33);
58080         memcpy(node_id_2_ref.compressed_form, node_id_2->elems, 33); FREE(node_id_2);
58081         LDKCResult_NoneLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneLightningErrorZ), "LDKCResult_NoneLightningErrorZ");
58082         *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);
58083         return tag_ptr(ret_conv, true);
58084 }
58085
58086 void  __attribute__((export_name("TS_NetworkGraph_channel_failed_permanent"))) TS_NetworkGraph_channel_failed_permanent(uint64_t this_arg, int64_t short_channel_id) {
58087         LDKNetworkGraph this_arg_conv;
58088         this_arg_conv.inner = untag_ptr(this_arg);
58089         this_arg_conv.is_owned = ptr_is_owned(this_arg);
58090         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
58091         this_arg_conv.is_owned = false;
58092         NetworkGraph_channel_failed_permanent(&this_arg_conv, short_channel_id);
58093 }
58094
58095 void  __attribute__((export_name("TS_NetworkGraph_node_failed_permanent"))) TS_NetworkGraph_node_failed_permanent(uint64_t this_arg, int8_tArray node_id) {
58096         LDKNetworkGraph this_arg_conv;
58097         this_arg_conv.inner = untag_ptr(this_arg);
58098         this_arg_conv.is_owned = ptr_is_owned(this_arg);
58099         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
58100         this_arg_conv.is_owned = false;
58101         LDKPublicKey node_id_ref;
58102         CHECK(node_id->arr_len == 33);
58103         memcpy(node_id_ref.compressed_form, node_id->elems, 33); FREE(node_id);
58104         NetworkGraph_node_failed_permanent(&this_arg_conv, node_id_ref);
58105 }
58106
58107 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) {
58108         LDKNetworkGraph this_arg_conv;
58109         this_arg_conv.inner = untag_ptr(this_arg);
58110         this_arg_conv.is_owned = ptr_is_owned(this_arg);
58111         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
58112         this_arg_conv.is_owned = false;
58113         NetworkGraph_remove_stale_channels_and_tracking_with_time(&this_arg_conv, current_time_unix);
58114 }
58115
58116 uint64_t  __attribute__((export_name("TS_NetworkGraph_update_channel"))) TS_NetworkGraph_update_channel(uint64_t this_arg, uint64_t msg) {
58117         LDKNetworkGraph this_arg_conv;
58118         this_arg_conv.inner = untag_ptr(this_arg);
58119         this_arg_conv.is_owned = ptr_is_owned(this_arg);
58120         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
58121         this_arg_conv.is_owned = false;
58122         LDKChannelUpdate msg_conv;
58123         msg_conv.inner = untag_ptr(msg);
58124         msg_conv.is_owned = ptr_is_owned(msg);
58125         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
58126         msg_conv.is_owned = false;
58127         LDKCResult_NoneLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneLightningErrorZ), "LDKCResult_NoneLightningErrorZ");
58128         *ret_conv = NetworkGraph_update_channel(&this_arg_conv, &msg_conv);
58129         return tag_ptr(ret_conv, true);
58130 }
58131
58132 uint64_t  __attribute__((export_name("TS_NetworkGraph_update_channel_unsigned"))) TS_NetworkGraph_update_channel_unsigned(uint64_t this_arg, uint64_t msg) {
58133         LDKNetworkGraph this_arg_conv;
58134         this_arg_conv.inner = untag_ptr(this_arg);
58135         this_arg_conv.is_owned = ptr_is_owned(this_arg);
58136         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
58137         this_arg_conv.is_owned = false;
58138         LDKUnsignedChannelUpdate msg_conv;
58139         msg_conv.inner = untag_ptr(msg);
58140         msg_conv.is_owned = ptr_is_owned(msg);
58141         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
58142         msg_conv.is_owned = false;
58143         LDKCResult_NoneLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneLightningErrorZ), "LDKCResult_NoneLightningErrorZ");
58144         *ret_conv = NetworkGraph_update_channel_unsigned(&this_arg_conv, &msg_conv);
58145         return tag_ptr(ret_conv, true);
58146 }
58147
58148 uint64_t  __attribute__((export_name("TS_NetworkGraph_verify_channel_update"))) TS_NetworkGraph_verify_channel_update(uint64_t this_arg, uint64_t msg) {
58149         LDKNetworkGraph this_arg_conv;
58150         this_arg_conv.inner = untag_ptr(this_arg);
58151         this_arg_conv.is_owned = ptr_is_owned(this_arg);
58152         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
58153         this_arg_conv.is_owned = false;
58154         LDKChannelUpdate msg_conv;
58155         msg_conv.inner = untag_ptr(msg);
58156         msg_conv.is_owned = ptr_is_owned(msg);
58157         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
58158         msg_conv.is_owned = false;
58159         LDKCResult_NoneLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneLightningErrorZ), "LDKCResult_NoneLightningErrorZ");
58160         *ret_conv = NetworkGraph_verify_channel_update(&this_arg_conv, &msg_conv);
58161         return tag_ptr(ret_conv, true);
58162 }
58163
58164 uint64_t  __attribute__((export_name("TS_ReadOnlyNetworkGraph_channel"))) TS_ReadOnlyNetworkGraph_channel(uint64_t this_arg, int64_t short_channel_id) {
58165         LDKReadOnlyNetworkGraph this_arg_conv;
58166         this_arg_conv.inner = untag_ptr(this_arg);
58167         this_arg_conv.is_owned = ptr_is_owned(this_arg);
58168         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
58169         this_arg_conv.is_owned = false;
58170         LDKChannelInfo ret_var = ReadOnlyNetworkGraph_channel(&this_arg_conv, short_channel_id);
58171         uint64_t ret_ref = 0;
58172         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
58173         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
58174         return ret_ref;
58175 }
58176
58177 int64_tArray  __attribute__((export_name("TS_ReadOnlyNetworkGraph_list_channels"))) TS_ReadOnlyNetworkGraph_list_channels(uint64_t this_arg) {
58178         LDKReadOnlyNetworkGraph this_arg_conv;
58179         this_arg_conv.inner = untag_ptr(this_arg);
58180         this_arg_conv.is_owned = ptr_is_owned(this_arg);
58181         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
58182         this_arg_conv.is_owned = false;
58183         LDKCVec_u64Z ret_var = ReadOnlyNetworkGraph_list_channels(&this_arg_conv);
58184         int64_tArray ret_arr = NULL;
58185         ret_arr = init_int64_tArray(ret_var.datalen, __LINE__);
58186         int64_t *ret_arr_ptr = (int64_t*)(((uint8_t*)ret_arr) + 8);
58187         for (size_t i = 0; i < ret_var.datalen; i++) {
58188                 int64_t ret_conv_8_conv = ret_var.data[i];
58189                 ret_arr_ptr[i] = ret_conv_8_conv;
58190         }
58191         
58192         FREE(ret_var.data);
58193         return ret_arr;
58194 }
58195
58196 uint64_t  __attribute__((export_name("TS_ReadOnlyNetworkGraph_node"))) TS_ReadOnlyNetworkGraph_node(uint64_t this_arg, uint64_t node_id) {
58197         LDKReadOnlyNetworkGraph this_arg_conv;
58198         this_arg_conv.inner = untag_ptr(this_arg);
58199         this_arg_conv.is_owned = ptr_is_owned(this_arg);
58200         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
58201         this_arg_conv.is_owned = false;
58202         LDKNodeId node_id_conv;
58203         node_id_conv.inner = untag_ptr(node_id);
58204         node_id_conv.is_owned = ptr_is_owned(node_id);
58205         CHECK_INNER_FIELD_ACCESS_OR_NULL(node_id_conv);
58206         node_id_conv.is_owned = false;
58207         LDKNodeInfo ret_var = ReadOnlyNetworkGraph_node(&this_arg_conv, &node_id_conv);
58208         uint64_t ret_ref = 0;
58209         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
58210         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
58211         return ret_ref;
58212 }
58213
58214 uint64_tArray  __attribute__((export_name("TS_ReadOnlyNetworkGraph_list_nodes"))) TS_ReadOnlyNetworkGraph_list_nodes(uint64_t this_arg) {
58215         LDKReadOnlyNetworkGraph this_arg_conv;
58216         this_arg_conv.inner = untag_ptr(this_arg);
58217         this_arg_conv.is_owned = ptr_is_owned(this_arg);
58218         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
58219         this_arg_conv.is_owned = false;
58220         LDKCVec_NodeIdZ ret_var = ReadOnlyNetworkGraph_list_nodes(&this_arg_conv);
58221         uint64_tArray ret_arr = NULL;
58222         ret_arr = init_uint64_tArray(ret_var.datalen, __LINE__);
58223         uint64_t *ret_arr_ptr = (uint64_t*)(((uint8_t*)ret_arr) + 8);
58224         for (size_t i = 0; i < ret_var.datalen; i++) {
58225                 LDKNodeId ret_conv_8_var = ret_var.data[i];
58226                 uint64_t ret_conv_8_ref = 0;
58227                 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_conv_8_var);
58228                 ret_conv_8_ref = tag_ptr(ret_conv_8_var.inner, ret_conv_8_var.is_owned);
58229                 ret_arr_ptr[i] = ret_conv_8_ref;
58230         }
58231         
58232         FREE(ret_var.data);
58233         return ret_arr;
58234 }
58235
58236 uint64_t  __attribute__((export_name("TS_ReadOnlyNetworkGraph_get_addresses"))) TS_ReadOnlyNetworkGraph_get_addresses(uint64_t this_arg, int8_tArray pubkey) {
58237         LDKReadOnlyNetworkGraph this_arg_conv;
58238         this_arg_conv.inner = untag_ptr(this_arg);
58239         this_arg_conv.is_owned = ptr_is_owned(this_arg);
58240         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
58241         this_arg_conv.is_owned = false;
58242         LDKPublicKey pubkey_ref;
58243         CHECK(pubkey->arr_len == 33);
58244         memcpy(pubkey_ref.compressed_form, pubkey->elems, 33); FREE(pubkey);
58245         LDKCOption_CVec_SocketAddressZZ *ret_copy = MALLOC(sizeof(LDKCOption_CVec_SocketAddressZZ), "LDKCOption_CVec_SocketAddressZZ");
58246         *ret_copy = ReadOnlyNetworkGraph_get_addresses(&this_arg_conv, pubkey_ref);
58247         uint64_t ret_ref = tag_ptr(ret_copy, true);
58248         return ret_ref;
58249 }
58250
58251 void  __attribute__((export_name("TS_DefaultRouter_free"))) TS_DefaultRouter_free(uint64_t this_obj) {
58252         LDKDefaultRouter this_obj_conv;
58253         this_obj_conv.inner = untag_ptr(this_obj);
58254         this_obj_conv.is_owned = ptr_is_owned(this_obj);
58255         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
58256         DefaultRouter_free(this_obj_conv);
58257 }
58258
58259 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, uint64_t score_params) {
58260         LDKNetworkGraph network_graph_conv;
58261         network_graph_conv.inner = untag_ptr(network_graph);
58262         network_graph_conv.is_owned = ptr_is_owned(network_graph);
58263         CHECK_INNER_FIELD_ACCESS_OR_NULL(network_graph_conv);
58264         network_graph_conv.is_owned = false;
58265         void* logger_ptr = untag_ptr(logger);
58266         CHECK_ACCESS(logger_ptr);
58267         LDKLogger logger_conv = *(LDKLogger*)(logger_ptr);
58268         if (logger_conv.free == LDKLogger_JCalls_free) {
58269                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
58270                 LDKLogger_JCalls_cloned(&logger_conv);
58271         }
58272         LDKThirtyTwoBytes random_seed_bytes_ref;
58273         CHECK(random_seed_bytes->arr_len == 32);
58274         memcpy(random_seed_bytes_ref.data, random_seed_bytes->elems, 32); FREE(random_seed_bytes);
58275         void* scorer_ptr = untag_ptr(scorer);
58276         CHECK_ACCESS(scorer_ptr);
58277         LDKLockableScore scorer_conv = *(LDKLockableScore*)(scorer_ptr);
58278         if (scorer_conv.free == LDKLockableScore_JCalls_free) {
58279                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
58280                 LDKLockableScore_JCalls_cloned(&scorer_conv);
58281         }
58282         LDKProbabilisticScoringFeeParameters score_params_conv;
58283         score_params_conv.inner = untag_ptr(score_params);
58284         score_params_conv.is_owned = ptr_is_owned(score_params);
58285         CHECK_INNER_FIELD_ACCESS_OR_NULL(score_params_conv);
58286         score_params_conv = ProbabilisticScoringFeeParameters_clone(&score_params_conv);
58287         LDKDefaultRouter ret_var = DefaultRouter_new(&network_graph_conv, logger_conv, random_seed_bytes_ref, scorer_conv, score_params_conv);
58288         uint64_t ret_ref = 0;
58289         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
58290         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
58291         return ret_ref;
58292 }
58293
58294 uint64_t  __attribute__((export_name("TS_DefaultRouter_as_Router"))) TS_DefaultRouter_as_Router(uint64_t this_arg) {
58295         LDKDefaultRouter this_arg_conv;
58296         this_arg_conv.inner = untag_ptr(this_arg);
58297         this_arg_conv.is_owned = ptr_is_owned(this_arg);
58298         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
58299         this_arg_conv.is_owned = false;
58300         LDKRouter* ret_ret = MALLOC(sizeof(LDKRouter), "LDKRouter");
58301         *ret_ret = DefaultRouter_as_Router(&this_arg_conv);
58302         return tag_ptr(ret_ret, true);
58303 }
58304
58305 void  __attribute__((export_name("TS_Router_free"))) TS_Router_free(uint64_t this_ptr) {
58306         if (!ptr_is_owned(this_ptr)) return;
58307         void* this_ptr_ptr = untag_ptr(this_ptr);
58308         CHECK_ACCESS(this_ptr_ptr);
58309         LDKRouter this_ptr_conv = *(LDKRouter*)(this_ptr_ptr);
58310         FREE(untag_ptr(this_ptr));
58311         Router_free(this_ptr_conv);
58312 }
58313
58314 void  __attribute__((export_name("TS_ScorerAccountingForInFlightHtlcs_free"))) TS_ScorerAccountingForInFlightHtlcs_free(uint64_t this_obj) {
58315         LDKScorerAccountingForInFlightHtlcs this_obj_conv;
58316         this_obj_conv.inner = untag_ptr(this_obj);
58317         this_obj_conv.is_owned = ptr_is_owned(this_obj);
58318         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
58319         ScorerAccountingForInFlightHtlcs_free(this_obj_conv);
58320 }
58321
58322 uint64_t  __attribute__((export_name("TS_ScorerAccountingForInFlightHtlcs_new"))) TS_ScorerAccountingForInFlightHtlcs_new(uint64_t scorer, uint64_t inflight_htlcs) {
58323         void* scorer_ptr = untag_ptr(scorer);
58324         CHECK_ACCESS(scorer_ptr);
58325         LDKScoreLookUp scorer_conv = *(LDKScoreLookUp*)(scorer_ptr);
58326         if (scorer_conv.free == LDKScoreLookUp_JCalls_free) {
58327                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
58328                 LDKScoreLookUp_JCalls_cloned(&scorer_conv);
58329         }
58330         LDKInFlightHtlcs inflight_htlcs_conv;
58331         inflight_htlcs_conv.inner = untag_ptr(inflight_htlcs);
58332         inflight_htlcs_conv.is_owned = ptr_is_owned(inflight_htlcs);
58333         CHECK_INNER_FIELD_ACCESS_OR_NULL(inflight_htlcs_conv);
58334         inflight_htlcs_conv.is_owned = false;
58335         LDKScorerAccountingForInFlightHtlcs ret_var = ScorerAccountingForInFlightHtlcs_new(scorer_conv, &inflight_htlcs_conv);
58336         uint64_t ret_ref = 0;
58337         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
58338         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
58339         return ret_ref;
58340 }
58341
58342 uint64_t  __attribute__((export_name("TS_ScorerAccountingForInFlightHtlcs_as_ScoreLookUp"))) TS_ScorerAccountingForInFlightHtlcs_as_ScoreLookUp(uint64_t this_arg) {
58343         LDKScorerAccountingForInFlightHtlcs this_arg_conv;
58344         this_arg_conv.inner = untag_ptr(this_arg);
58345         this_arg_conv.is_owned = ptr_is_owned(this_arg);
58346         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
58347         this_arg_conv.is_owned = false;
58348         LDKScoreLookUp* ret_ret = MALLOC(sizeof(LDKScoreLookUp), "LDKScoreLookUp");
58349         *ret_ret = ScorerAccountingForInFlightHtlcs_as_ScoreLookUp(&this_arg_conv);
58350         return tag_ptr(ret_ret, true);
58351 }
58352
58353 void  __attribute__((export_name("TS_InFlightHtlcs_free"))) TS_InFlightHtlcs_free(uint64_t this_obj) {
58354         LDKInFlightHtlcs this_obj_conv;
58355         this_obj_conv.inner = untag_ptr(this_obj);
58356         this_obj_conv.is_owned = ptr_is_owned(this_obj);
58357         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
58358         InFlightHtlcs_free(this_obj_conv);
58359 }
58360
58361 static inline uint64_t InFlightHtlcs_clone_ptr(LDKInFlightHtlcs *NONNULL_PTR arg) {
58362         LDKInFlightHtlcs ret_var = InFlightHtlcs_clone(arg);
58363         uint64_t ret_ref = 0;
58364         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
58365         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
58366         return ret_ref;
58367 }
58368 int64_t  __attribute__((export_name("TS_InFlightHtlcs_clone_ptr"))) TS_InFlightHtlcs_clone_ptr(uint64_t arg) {
58369         LDKInFlightHtlcs arg_conv;
58370         arg_conv.inner = untag_ptr(arg);
58371         arg_conv.is_owned = ptr_is_owned(arg);
58372         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
58373         arg_conv.is_owned = false;
58374         int64_t ret_conv = InFlightHtlcs_clone_ptr(&arg_conv);
58375         return ret_conv;
58376 }
58377
58378 uint64_t  __attribute__((export_name("TS_InFlightHtlcs_clone"))) TS_InFlightHtlcs_clone(uint64_t orig) {
58379         LDKInFlightHtlcs orig_conv;
58380         orig_conv.inner = untag_ptr(orig);
58381         orig_conv.is_owned = ptr_is_owned(orig);
58382         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
58383         orig_conv.is_owned = false;
58384         LDKInFlightHtlcs ret_var = InFlightHtlcs_clone(&orig_conv);
58385         uint64_t ret_ref = 0;
58386         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
58387         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
58388         return ret_ref;
58389 }
58390
58391 uint64_t  __attribute__((export_name("TS_InFlightHtlcs_new"))) TS_InFlightHtlcs_new() {
58392         LDKInFlightHtlcs ret_var = InFlightHtlcs_new();
58393         uint64_t ret_ref = 0;
58394         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
58395         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
58396         return ret_ref;
58397 }
58398
58399 void  __attribute__((export_name("TS_InFlightHtlcs_process_path"))) TS_InFlightHtlcs_process_path(uint64_t this_arg, uint64_t path, int8_tArray payer_node_id) {
58400         LDKInFlightHtlcs this_arg_conv;
58401         this_arg_conv.inner = untag_ptr(this_arg);
58402         this_arg_conv.is_owned = ptr_is_owned(this_arg);
58403         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
58404         this_arg_conv.is_owned = false;
58405         LDKPath path_conv;
58406         path_conv.inner = untag_ptr(path);
58407         path_conv.is_owned = ptr_is_owned(path);
58408         CHECK_INNER_FIELD_ACCESS_OR_NULL(path_conv);
58409         path_conv.is_owned = false;
58410         LDKPublicKey payer_node_id_ref;
58411         CHECK(payer_node_id->arr_len == 33);
58412         memcpy(payer_node_id_ref.compressed_form, payer_node_id->elems, 33); FREE(payer_node_id);
58413         InFlightHtlcs_process_path(&this_arg_conv, &path_conv, payer_node_id_ref);
58414 }
58415
58416 void  __attribute__((export_name("TS_InFlightHtlcs_add_inflight_htlc"))) TS_InFlightHtlcs_add_inflight_htlc(uint64_t this_arg, uint64_t source, uint64_t target, int64_t channel_scid, int64_t used_msat) {
58417         LDKInFlightHtlcs this_arg_conv;
58418         this_arg_conv.inner = untag_ptr(this_arg);
58419         this_arg_conv.is_owned = ptr_is_owned(this_arg);
58420         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
58421         this_arg_conv.is_owned = false;
58422         LDKNodeId source_conv;
58423         source_conv.inner = untag_ptr(source);
58424         source_conv.is_owned = ptr_is_owned(source);
58425         CHECK_INNER_FIELD_ACCESS_OR_NULL(source_conv);
58426         source_conv.is_owned = false;
58427         LDKNodeId target_conv;
58428         target_conv.inner = untag_ptr(target);
58429         target_conv.is_owned = ptr_is_owned(target);
58430         CHECK_INNER_FIELD_ACCESS_OR_NULL(target_conv);
58431         target_conv.is_owned = false;
58432         InFlightHtlcs_add_inflight_htlc(&this_arg_conv, &source_conv, &target_conv, channel_scid, used_msat);
58433 }
58434
58435 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) {
58436         LDKInFlightHtlcs this_arg_conv;
58437         this_arg_conv.inner = untag_ptr(this_arg);
58438         this_arg_conv.is_owned = ptr_is_owned(this_arg);
58439         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
58440         this_arg_conv.is_owned = false;
58441         LDKNodeId source_conv;
58442         source_conv.inner = untag_ptr(source);
58443         source_conv.is_owned = ptr_is_owned(source);
58444         CHECK_INNER_FIELD_ACCESS_OR_NULL(source_conv);
58445         source_conv.is_owned = false;
58446         LDKNodeId target_conv;
58447         target_conv.inner = untag_ptr(target);
58448         target_conv.is_owned = ptr_is_owned(target);
58449         CHECK_INNER_FIELD_ACCESS_OR_NULL(target_conv);
58450         target_conv.is_owned = false;
58451         LDKCOption_u64Z *ret_copy = MALLOC(sizeof(LDKCOption_u64Z), "LDKCOption_u64Z");
58452         *ret_copy = InFlightHtlcs_used_liquidity_msat(&this_arg_conv, &source_conv, &target_conv, channel_scid);
58453         uint64_t ret_ref = tag_ptr(ret_copy, true);
58454         return ret_ref;
58455 }
58456
58457 int8_tArray  __attribute__((export_name("TS_InFlightHtlcs_write"))) TS_InFlightHtlcs_write(uint64_t obj) {
58458         LDKInFlightHtlcs obj_conv;
58459         obj_conv.inner = untag_ptr(obj);
58460         obj_conv.is_owned = ptr_is_owned(obj);
58461         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
58462         obj_conv.is_owned = false;
58463         LDKCVec_u8Z ret_var = InFlightHtlcs_write(&obj_conv);
58464         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
58465         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
58466         CVec_u8Z_free(ret_var);
58467         return ret_arr;
58468 }
58469
58470 uint64_t  __attribute__((export_name("TS_InFlightHtlcs_read"))) TS_InFlightHtlcs_read(int8_tArray ser) {
58471         LDKu8slice ser_ref;
58472         ser_ref.datalen = ser->arr_len;
58473         ser_ref.data = ser->elems;
58474         LDKCResult_InFlightHtlcsDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InFlightHtlcsDecodeErrorZ), "LDKCResult_InFlightHtlcsDecodeErrorZ");
58475         *ret_conv = InFlightHtlcs_read(ser_ref);
58476         FREE(ser);
58477         return tag_ptr(ret_conv, true);
58478 }
58479
58480 void  __attribute__((export_name("TS_RouteHop_free"))) TS_RouteHop_free(uint64_t this_obj) {
58481         LDKRouteHop this_obj_conv;
58482         this_obj_conv.inner = untag_ptr(this_obj);
58483         this_obj_conv.is_owned = ptr_is_owned(this_obj);
58484         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
58485         RouteHop_free(this_obj_conv);
58486 }
58487
58488 int8_tArray  __attribute__((export_name("TS_RouteHop_get_pubkey"))) TS_RouteHop_get_pubkey(uint64_t this_ptr) {
58489         LDKRouteHop this_ptr_conv;
58490         this_ptr_conv.inner = untag_ptr(this_ptr);
58491         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
58492         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
58493         this_ptr_conv.is_owned = false;
58494         int8_tArray ret_arr = init_int8_tArray(33, __LINE__);
58495         memcpy(ret_arr->elems, RouteHop_get_pubkey(&this_ptr_conv).compressed_form, 33);
58496         return ret_arr;
58497 }
58498
58499 void  __attribute__((export_name("TS_RouteHop_set_pubkey"))) TS_RouteHop_set_pubkey(uint64_t this_ptr, int8_tArray val) {
58500         LDKRouteHop this_ptr_conv;
58501         this_ptr_conv.inner = untag_ptr(this_ptr);
58502         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
58503         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
58504         this_ptr_conv.is_owned = false;
58505         LDKPublicKey val_ref;
58506         CHECK(val->arr_len == 33);
58507         memcpy(val_ref.compressed_form, val->elems, 33); FREE(val);
58508         RouteHop_set_pubkey(&this_ptr_conv, val_ref);
58509 }
58510
58511 uint64_t  __attribute__((export_name("TS_RouteHop_get_node_features"))) TS_RouteHop_get_node_features(uint64_t this_ptr) {
58512         LDKRouteHop this_ptr_conv;
58513         this_ptr_conv.inner = untag_ptr(this_ptr);
58514         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
58515         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
58516         this_ptr_conv.is_owned = false;
58517         LDKNodeFeatures ret_var = RouteHop_get_node_features(&this_ptr_conv);
58518         uint64_t ret_ref = 0;
58519         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
58520         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
58521         return ret_ref;
58522 }
58523
58524 void  __attribute__((export_name("TS_RouteHop_set_node_features"))) TS_RouteHop_set_node_features(uint64_t this_ptr, uint64_t val) {
58525         LDKRouteHop this_ptr_conv;
58526         this_ptr_conv.inner = untag_ptr(this_ptr);
58527         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
58528         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
58529         this_ptr_conv.is_owned = false;
58530         LDKNodeFeatures val_conv;
58531         val_conv.inner = untag_ptr(val);
58532         val_conv.is_owned = ptr_is_owned(val);
58533         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
58534         val_conv = NodeFeatures_clone(&val_conv);
58535         RouteHop_set_node_features(&this_ptr_conv, val_conv);
58536 }
58537
58538 int64_t  __attribute__((export_name("TS_RouteHop_get_short_channel_id"))) TS_RouteHop_get_short_channel_id(uint64_t this_ptr) {
58539         LDKRouteHop this_ptr_conv;
58540         this_ptr_conv.inner = untag_ptr(this_ptr);
58541         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
58542         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
58543         this_ptr_conv.is_owned = false;
58544         int64_t ret_conv = RouteHop_get_short_channel_id(&this_ptr_conv);
58545         return ret_conv;
58546 }
58547
58548 void  __attribute__((export_name("TS_RouteHop_set_short_channel_id"))) TS_RouteHop_set_short_channel_id(uint64_t this_ptr, int64_t val) {
58549         LDKRouteHop this_ptr_conv;
58550         this_ptr_conv.inner = untag_ptr(this_ptr);
58551         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
58552         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
58553         this_ptr_conv.is_owned = false;
58554         RouteHop_set_short_channel_id(&this_ptr_conv, val);
58555 }
58556
58557 uint64_t  __attribute__((export_name("TS_RouteHop_get_channel_features"))) TS_RouteHop_get_channel_features(uint64_t this_ptr) {
58558         LDKRouteHop this_ptr_conv;
58559         this_ptr_conv.inner = untag_ptr(this_ptr);
58560         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
58561         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
58562         this_ptr_conv.is_owned = false;
58563         LDKChannelFeatures ret_var = RouteHop_get_channel_features(&this_ptr_conv);
58564         uint64_t ret_ref = 0;
58565         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
58566         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
58567         return ret_ref;
58568 }
58569
58570 void  __attribute__((export_name("TS_RouteHop_set_channel_features"))) TS_RouteHop_set_channel_features(uint64_t this_ptr, uint64_t val) {
58571         LDKRouteHop this_ptr_conv;
58572         this_ptr_conv.inner = untag_ptr(this_ptr);
58573         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
58574         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
58575         this_ptr_conv.is_owned = false;
58576         LDKChannelFeatures val_conv;
58577         val_conv.inner = untag_ptr(val);
58578         val_conv.is_owned = ptr_is_owned(val);
58579         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
58580         val_conv = ChannelFeatures_clone(&val_conv);
58581         RouteHop_set_channel_features(&this_ptr_conv, val_conv);
58582 }
58583
58584 int64_t  __attribute__((export_name("TS_RouteHop_get_fee_msat"))) TS_RouteHop_get_fee_msat(uint64_t this_ptr) {
58585         LDKRouteHop this_ptr_conv;
58586         this_ptr_conv.inner = untag_ptr(this_ptr);
58587         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
58588         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
58589         this_ptr_conv.is_owned = false;
58590         int64_t ret_conv = RouteHop_get_fee_msat(&this_ptr_conv);
58591         return ret_conv;
58592 }
58593
58594 void  __attribute__((export_name("TS_RouteHop_set_fee_msat"))) TS_RouteHop_set_fee_msat(uint64_t this_ptr, int64_t val) {
58595         LDKRouteHop this_ptr_conv;
58596         this_ptr_conv.inner = untag_ptr(this_ptr);
58597         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
58598         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
58599         this_ptr_conv.is_owned = false;
58600         RouteHop_set_fee_msat(&this_ptr_conv, val);
58601 }
58602
58603 int32_t  __attribute__((export_name("TS_RouteHop_get_cltv_expiry_delta"))) TS_RouteHop_get_cltv_expiry_delta(uint64_t this_ptr) {
58604         LDKRouteHop this_ptr_conv;
58605         this_ptr_conv.inner = untag_ptr(this_ptr);
58606         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
58607         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
58608         this_ptr_conv.is_owned = false;
58609         int32_t ret_conv = RouteHop_get_cltv_expiry_delta(&this_ptr_conv);
58610         return ret_conv;
58611 }
58612
58613 void  __attribute__((export_name("TS_RouteHop_set_cltv_expiry_delta"))) TS_RouteHop_set_cltv_expiry_delta(uint64_t this_ptr, int32_t val) {
58614         LDKRouteHop this_ptr_conv;
58615         this_ptr_conv.inner = untag_ptr(this_ptr);
58616         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
58617         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
58618         this_ptr_conv.is_owned = false;
58619         RouteHop_set_cltv_expiry_delta(&this_ptr_conv, val);
58620 }
58621
58622 jboolean  __attribute__((export_name("TS_RouteHop_get_maybe_announced_channel"))) TS_RouteHop_get_maybe_announced_channel(uint64_t this_ptr) {
58623         LDKRouteHop this_ptr_conv;
58624         this_ptr_conv.inner = untag_ptr(this_ptr);
58625         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
58626         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
58627         this_ptr_conv.is_owned = false;
58628         jboolean ret_conv = RouteHop_get_maybe_announced_channel(&this_ptr_conv);
58629         return ret_conv;
58630 }
58631
58632 void  __attribute__((export_name("TS_RouteHop_set_maybe_announced_channel"))) TS_RouteHop_set_maybe_announced_channel(uint64_t this_ptr, jboolean val) {
58633         LDKRouteHop this_ptr_conv;
58634         this_ptr_conv.inner = untag_ptr(this_ptr);
58635         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
58636         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
58637         this_ptr_conv.is_owned = false;
58638         RouteHop_set_maybe_announced_channel(&this_ptr_conv, val);
58639 }
58640
58641 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, jboolean maybe_announced_channel_arg) {
58642         LDKPublicKey pubkey_arg_ref;
58643         CHECK(pubkey_arg->arr_len == 33);
58644         memcpy(pubkey_arg_ref.compressed_form, pubkey_arg->elems, 33); FREE(pubkey_arg);
58645         LDKNodeFeatures node_features_arg_conv;
58646         node_features_arg_conv.inner = untag_ptr(node_features_arg);
58647         node_features_arg_conv.is_owned = ptr_is_owned(node_features_arg);
58648         CHECK_INNER_FIELD_ACCESS_OR_NULL(node_features_arg_conv);
58649         node_features_arg_conv = NodeFeatures_clone(&node_features_arg_conv);
58650         LDKChannelFeatures channel_features_arg_conv;
58651         channel_features_arg_conv.inner = untag_ptr(channel_features_arg);
58652         channel_features_arg_conv.is_owned = ptr_is_owned(channel_features_arg);
58653         CHECK_INNER_FIELD_ACCESS_OR_NULL(channel_features_arg_conv);
58654         channel_features_arg_conv = ChannelFeatures_clone(&channel_features_arg_conv);
58655         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, maybe_announced_channel_arg);
58656         uint64_t ret_ref = 0;
58657         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
58658         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
58659         return ret_ref;
58660 }
58661
58662 static inline uint64_t RouteHop_clone_ptr(LDKRouteHop *NONNULL_PTR arg) {
58663         LDKRouteHop ret_var = RouteHop_clone(arg);
58664         uint64_t ret_ref = 0;
58665         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
58666         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
58667         return ret_ref;
58668 }
58669 int64_t  __attribute__((export_name("TS_RouteHop_clone_ptr"))) TS_RouteHop_clone_ptr(uint64_t arg) {
58670         LDKRouteHop arg_conv;
58671         arg_conv.inner = untag_ptr(arg);
58672         arg_conv.is_owned = ptr_is_owned(arg);
58673         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
58674         arg_conv.is_owned = false;
58675         int64_t ret_conv = RouteHop_clone_ptr(&arg_conv);
58676         return ret_conv;
58677 }
58678
58679 uint64_t  __attribute__((export_name("TS_RouteHop_clone"))) TS_RouteHop_clone(uint64_t orig) {
58680         LDKRouteHop orig_conv;
58681         orig_conv.inner = untag_ptr(orig);
58682         orig_conv.is_owned = ptr_is_owned(orig);
58683         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
58684         orig_conv.is_owned = false;
58685         LDKRouteHop ret_var = RouteHop_clone(&orig_conv);
58686         uint64_t ret_ref = 0;
58687         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
58688         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
58689         return ret_ref;
58690 }
58691
58692 int64_t  __attribute__((export_name("TS_RouteHop_hash"))) TS_RouteHop_hash(uint64_t o) {
58693         LDKRouteHop o_conv;
58694         o_conv.inner = untag_ptr(o);
58695         o_conv.is_owned = ptr_is_owned(o);
58696         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
58697         o_conv.is_owned = false;
58698         int64_t ret_conv = RouteHop_hash(&o_conv);
58699         return ret_conv;
58700 }
58701
58702 jboolean  __attribute__((export_name("TS_RouteHop_eq"))) TS_RouteHop_eq(uint64_t a, uint64_t b) {
58703         LDKRouteHop a_conv;
58704         a_conv.inner = untag_ptr(a);
58705         a_conv.is_owned = ptr_is_owned(a);
58706         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
58707         a_conv.is_owned = false;
58708         LDKRouteHop b_conv;
58709         b_conv.inner = untag_ptr(b);
58710         b_conv.is_owned = ptr_is_owned(b);
58711         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
58712         b_conv.is_owned = false;
58713         jboolean ret_conv = RouteHop_eq(&a_conv, &b_conv);
58714         return ret_conv;
58715 }
58716
58717 int8_tArray  __attribute__((export_name("TS_RouteHop_write"))) TS_RouteHop_write(uint64_t obj) {
58718         LDKRouteHop obj_conv;
58719         obj_conv.inner = untag_ptr(obj);
58720         obj_conv.is_owned = ptr_is_owned(obj);
58721         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
58722         obj_conv.is_owned = false;
58723         LDKCVec_u8Z ret_var = RouteHop_write(&obj_conv);
58724         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
58725         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
58726         CVec_u8Z_free(ret_var);
58727         return ret_arr;
58728 }
58729
58730 uint64_t  __attribute__((export_name("TS_RouteHop_read"))) TS_RouteHop_read(int8_tArray ser) {
58731         LDKu8slice ser_ref;
58732         ser_ref.datalen = ser->arr_len;
58733         ser_ref.data = ser->elems;
58734         LDKCResult_RouteHopDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteHopDecodeErrorZ), "LDKCResult_RouteHopDecodeErrorZ");
58735         *ret_conv = RouteHop_read(ser_ref);
58736         FREE(ser);
58737         return tag_ptr(ret_conv, true);
58738 }
58739
58740 void  __attribute__((export_name("TS_BlindedTail_free"))) TS_BlindedTail_free(uint64_t this_obj) {
58741         LDKBlindedTail this_obj_conv;
58742         this_obj_conv.inner = untag_ptr(this_obj);
58743         this_obj_conv.is_owned = ptr_is_owned(this_obj);
58744         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
58745         BlindedTail_free(this_obj_conv);
58746 }
58747
58748 uint64_tArray  __attribute__((export_name("TS_BlindedTail_get_hops"))) TS_BlindedTail_get_hops(uint64_t this_ptr) {
58749         LDKBlindedTail this_ptr_conv;
58750         this_ptr_conv.inner = untag_ptr(this_ptr);
58751         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
58752         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
58753         this_ptr_conv.is_owned = false;
58754         LDKCVec_BlindedHopZ ret_var = BlindedTail_get_hops(&this_ptr_conv);
58755         uint64_tArray ret_arr = NULL;
58756         ret_arr = init_uint64_tArray(ret_var.datalen, __LINE__);
58757         uint64_t *ret_arr_ptr = (uint64_t*)(((uint8_t*)ret_arr) + 8);
58758         for (size_t m = 0; m < ret_var.datalen; m++) {
58759                 LDKBlindedHop ret_conv_12_var = ret_var.data[m];
58760                 uint64_t ret_conv_12_ref = 0;
58761                 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_conv_12_var);
58762                 ret_conv_12_ref = tag_ptr(ret_conv_12_var.inner, ret_conv_12_var.is_owned);
58763                 ret_arr_ptr[m] = ret_conv_12_ref;
58764         }
58765         
58766         FREE(ret_var.data);
58767         return ret_arr;
58768 }
58769
58770 void  __attribute__((export_name("TS_BlindedTail_set_hops"))) TS_BlindedTail_set_hops(uint64_t this_ptr, uint64_tArray val) {
58771         LDKBlindedTail this_ptr_conv;
58772         this_ptr_conv.inner = untag_ptr(this_ptr);
58773         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
58774         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
58775         this_ptr_conv.is_owned = false;
58776         LDKCVec_BlindedHopZ val_constr;
58777         val_constr.datalen = val->arr_len;
58778         if (val_constr.datalen > 0)
58779                 val_constr.data = MALLOC(val_constr.datalen * sizeof(LDKBlindedHop), "LDKCVec_BlindedHopZ Elements");
58780         else
58781                 val_constr.data = NULL;
58782         uint64_t* val_vals = val->elems;
58783         for (size_t m = 0; m < val_constr.datalen; m++) {
58784                 uint64_t val_conv_12 = val_vals[m];
58785                 LDKBlindedHop val_conv_12_conv;
58786                 val_conv_12_conv.inner = untag_ptr(val_conv_12);
58787                 val_conv_12_conv.is_owned = ptr_is_owned(val_conv_12);
58788                 CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv_12_conv);
58789                 val_conv_12_conv = BlindedHop_clone(&val_conv_12_conv);
58790                 val_constr.data[m] = val_conv_12_conv;
58791         }
58792         FREE(val);
58793         BlindedTail_set_hops(&this_ptr_conv, val_constr);
58794 }
58795
58796 int8_tArray  __attribute__((export_name("TS_BlindedTail_get_blinding_point"))) TS_BlindedTail_get_blinding_point(uint64_t this_ptr) {
58797         LDKBlindedTail this_ptr_conv;
58798         this_ptr_conv.inner = untag_ptr(this_ptr);
58799         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
58800         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
58801         this_ptr_conv.is_owned = false;
58802         int8_tArray ret_arr = init_int8_tArray(33, __LINE__);
58803         memcpy(ret_arr->elems, BlindedTail_get_blinding_point(&this_ptr_conv).compressed_form, 33);
58804         return ret_arr;
58805 }
58806
58807 void  __attribute__((export_name("TS_BlindedTail_set_blinding_point"))) TS_BlindedTail_set_blinding_point(uint64_t this_ptr, int8_tArray val) {
58808         LDKBlindedTail this_ptr_conv;
58809         this_ptr_conv.inner = untag_ptr(this_ptr);
58810         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
58811         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
58812         this_ptr_conv.is_owned = false;
58813         LDKPublicKey val_ref;
58814         CHECK(val->arr_len == 33);
58815         memcpy(val_ref.compressed_form, val->elems, 33); FREE(val);
58816         BlindedTail_set_blinding_point(&this_ptr_conv, val_ref);
58817 }
58818
58819 int32_t  __attribute__((export_name("TS_BlindedTail_get_excess_final_cltv_expiry_delta"))) TS_BlindedTail_get_excess_final_cltv_expiry_delta(uint64_t this_ptr) {
58820         LDKBlindedTail this_ptr_conv;
58821         this_ptr_conv.inner = untag_ptr(this_ptr);
58822         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
58823         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
58824         this_ptr_conv.is_owned = false;
58825         int32_t ret_conv = BlindedTail_get_excess_final_cltv_expiry_delta(&this_ptr_conv);
58826         return ret_conv;
58827 }
58828
58829 void  __attribute__((export_name("TS_BlindedTail_set_excess_final_cltv_expiry_delta"))) TS_BlindedTail_set_excess_final_cltv_expiry_delta(uint64_t this_ptr, int32_t val) {
58830         LDKBlindedTail this_ptr_conv;
58831         this_ptr_conv.inner = untag_ptr(this_ptr);
58832         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
58833         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
58834         this_ptr_conv.is_owned = false;
58835         BlindedTail_set_excess_final_cltv_expiry_delta(&this_ptr_conv, val);
58836 }
58837
58838 int64_t  __attribute__((export_name("TS_BlindedTail_get_final_value_msat"))) TS_BlindedTail_get_final_value_msat(uint64_t this_ptr) {
58839         LDKBlindedTail this_ptr_conv;
58840         this_ptr_conv.inner = untag_ptr(this_ptr);
58841         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
58842         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
58843         this_ptr_conv.is_owned = false;
58844         int64_t ret_conv = BlindedTail_get_final_value_msat(&this_ptr_conv);
58845         return ret_conv;
58846 }
58847
58848 void  __attribute__((export_name("TS_BlindedTail_set_final_value_msat"))) TS_BlindedTail_set_final_value_msat(uint64_t this_ptr, int64_t val) {
58849         LDKBlindedTail this_ptr_conv;
58850         this_ptr_conv.inner = untag_ptr(this_ptr);
58851         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
58852         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
58853         this_ptr_conv.is_owned = false;
58854         BlindedTail_set_final_value_msat(&this_ptr_conv, val);
58855 }
58856
58857 uint64_t  __attribute__((export_name("TS_BlindedTail_new"))) TS_BlindedTail_new(uint64_tArray hops_arg, int8_tArray blinding_point_arg, int32_t excess_final_cltv_expiry_delta_arg, int64_t final_value_msat_arg) {
58858         LDKCVec_BlindedHopZ hops_arg_constr;
58859         hops_arg_constr.datalen = hops_arg->arr_len;
58860         if (hops_arg_constr.datalen > 0)
58861                 hops_arg_constr.data = MALLOC(hops_arg_constr.datalen * sizeof(LDKBlindedHop), "LDKCVec_BlindedHopZ Elements");
58862         else
58863                 hops_arg_constr.data = NULL;
58864         uint64_t* hops_arg_vals = hops_arg->elems;
58865         for (size_t m = 0; m < hops_arg_constr.datalen; m++) {
58866                 uint64_t hops_arg_conv_12 = hops_arg_vals[m];
58867                 LDKBlindedHop hops_arg_conv_12_conv;
58868                 hops_arg_conv_12_conv.inner = untag_ptr(hops_arg_conv_12);
58869                 hops_arg_conv_12_conv.is_owned = ptr_is_owned(hops_arg_conv_12);
58870                 CHECK_INNER_FIELD_ACCESS_OR_NULL(hops_arg_conv_12_conv);
58871                 hops_arg_conv_12_conv = BlindedHop_clone(&hops_arg_conv_12_conv);
58872                 hops_arg_constr.data[m] = hops_arg_conv_12_conv;
58873         }
58874         FREE(hops_arg);
58875         LDKPublicKey blinding_point_arg_ref;
58876         CHECK(blinding_point_arg->arr_len == 33);
58877         memcpy(blinding_point_arg_ref.compressed_form, blinding_point_arg->elems, 33); FREE(blinding_point_arg);
58878         LDKBlindedTail ret_var = BlindedTail_new(hops_arg_constr, blinding_point_arg_ref, excess_final_cltv_expiry_delta_arg, final_value_msat_arg);
58879         uint64_t ret_ref = 0;
58880         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
58881         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
58882         return ret_ref;
58883 }
58884
58885 static inline uint64_t BlindedTail_clone_ptr(LDKBlindedTail *NONNULL_PTR arg) {
58886         LDKBlindedTail ret_var = BlindedTail_clone(arg);
58887         uint64_t ret_ref = 0;
58888         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
58889         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
58890         return ret_ref;
58891 }
58892 int64_t  __attribute__((export_name("TS_BlindedTail_clone_ptr"))) TS_BlindedTail_clone_ptr(uint64_t arg) {
58893         LDKBlindedTail arg_conv;
58894         arg_conv.inner = untag_ptr(arg);
58895         arg_conv.is_owned = ptr_is_owned(arg);
58896         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
58897         arg_conv.is_owned = false;
58898         int64_t ret_conv = BlindedTail_clone_ptr(&arg_conv);
58899         return ret_conv;
58900 }
58901
58902 uint64_t  __attribute__((export_name("TS_BlindedTail_clone"))) TS_BlindedTail_clone(uint64_t orig) {
58903         LDKBlindedTail orig_conv;
58904         orig_conv.inner = untag_ptr(orig);
58905         orig_conv.is_owned = ptr_is_owned(orig);
58906         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
58907         orig_conv.is_owned = false;
58908         LDKBlindedTail ret_var = BlindedTail_clone(&orig_conv);
58909         uint64_t ret_ref = 0;
58910         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
58911         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
58912         return ret_ref;
58913 }
58914
58915 int64_t  __attribute__((export_name("TS_BlindedTail_hash"))) TS_BlindedTail_hash(uint64_t o) {
58916         LDKBlindedTail o_conv;
58917         o_conv.inner = untag_ptr(o);
58918         o_conv.is_owned = ptr_is_owned(o);
58919         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
58920         o_conv.is_owned = false;
58921         int64_t ret_conv = BlindedTail_hash(&o_conv);
58922         return ret_conv;
58923 }
58924
58925 jboolean  __attribute__((export_name("TS_BlindedTail_eq"))) TS_BlindedTail_eq(uint64_t a, uint64_t b) {
58926         LDKBlindedTail a_conv;
58927         a_conv.inner = untag_ptr(a);
58928         a_conv.is_owned = ptr_is_owned(a);
58929         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
58930         a_conv.is_owned = false;
58931         LDKBlindedTail b_conv;
58932         b_conv.inner = untag_ptr(b);
58933         b_conv.is_owned = ptr_is_owned(b);
58934         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
58935         b_conv.is_owned = false;
58936         jboolean ret_conv = BlindedTail_eq(&a_conv, &b_conv);
58937         return ret_conv;
58938 }
58939
58940 int8_tArray  __attribute__((export_name("TS_BlindedTail_write"))) TS_BlindedTail_write(uint64_t obj) {
58941         LDKBlindedTail obj_conv;
58942         obj_conv.inner = untag_ptr(obj);
58943         obj_conv.is_owned = ptr_is_owned(obj);
58944         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
58945         obj_conv.is_owned = false;
58946         LDKCVec_u8Z ret_var = BlindedTail_write(&obj_conv);
58947         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
58948         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
58949         CVec_u8Z_free(ret_var);
58950         return ret_arr;
58951 }
58952
58953 uint64_t  __attribute__((export_name("TS_BlindedTail_read"))) TS_BlindedTail_read(int8_tArray ser) {
58954         LDKu8slice ser_ref;
58955         ser_ref.datalen = ser->arr_len;
58956         ser_ref.data = ser->elems;
58957         LDKCResult_BlindedTailDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_BlindedTailDecodeErrorZ), "LDKCResult_BlindedTailDecodeErrorZ");
58958         *ret_conv = BlindedTail_read(ser_ref);
58959         FREE(ser);
58960         return tag_ptr(ret_conv, true);
58961 }
58962
58963 void  __attribute__((export_name("TS_Path_free"))) TS_Path_free(uint64_t this_obj) {
58964         LDKPath this_obj_conv;
58965         this_obj_conv.inner = untag_ptr(this_obj);
58966         this_obj_conv.is_owned = ptr_is_owned(this_obj);
58967         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
58968         Path_free(this_obj_conv);
58969 }
58970
58971 uint64_tArray  __attribute__((export_name("TS_Path_get_hops"))) TS_Path_get_hops(uint64_t this_ptr) {
58972         LDKPath this_ptr_conv;
58973         this_ptr_conv.inner = untag_ptr(this_ptr);
58974         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
58975         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
58976         this_ptr_conv.is_owned = false;
58977         LDKCVec_RouteHopZ ret_var = Path_get_hops(&this_ptr_conv);
58978         uint64_tArray ret_arr = NULL;
58979         ret_arr = init_uint64_tArray(ret_var.datalen, __LINE__);
58980         uint64_t *ret_arr_ptr = (uint64_t*)(((uint8_t*)ret_arr) + 8);
58981         for (size_t k = 0; k < ret_var.datalen; k++) {
58982                 LDKRouteHop ret_conv_10_var = ret_var.data[k];
58983                 uint64_t ret_conv_10_ref = 0;
58984                 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_conv_10_var);
58985                 ret_conv_10_ref = tag_ptr(ret_conv_10_var.inner, ret_conv_10_var.is_owned);
58986                 ret_arr_ptr[k] = ret_conv_10_ref;
58987         }
58988         
58989         FREE(ret_var.data);
58990         return ret_arr;
58991 }
58992
58993 void  __attribute__((export_name("TS_Path_set_hops"))) TS_Path_set_hops(uint64_t this_ptr, uint64_tArray val) {
58994         LDKPath this_ptr_conv;
58995         this_ptr_conv.inner = untag_ptr(this_ptr);
58996         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
58997         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
58998         this_ptr_conv.is_owned = false;
58999         LDKCVec_RouteHopZ val_constr;
59000         val_constr.datalen = val->arr_len;
59001         if (val_constr.datalen > 0)
59002                 val_constr.data = MALLOC(val_constr.datalen * sizeof(LDKRouteHop), "LDKCVec_RouteHopZ Elements");
59003         else
59004                 val_constr.data = NULL;
59005         uint64_t* val_vals = val->elems;
59006         for (size_t k = 0; k < val_constr.datalen; k++) {
59007                 uint64_t val_conv_10 = val_vals[k];
59008                 LDKRouteHop val_conv_10_conv;
59009                 val_conv_10_conv.inner = untag_ptr(val_conv_10);
59010                 val_conv_10_conv.is_owned = ptr_is_owned(val_conv_10);
59011                 CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv_10_conv);
59012                 val_conv_10_conv = RouteHop_clone(&val_conv_10_conv);
59013                 val_constr.data[k] = val_conv_10_conv;
59014         }
59015         FREE(val);
59016         Path_set_hops(&this_ptr_conv, val_constr);
59017 }
59018
59019 uint64_t  __attribute__((export_name("TS_Path_get_blinded_tail"))) TS_Path_get_blinded_tail(uint64_t this_ptr) {
59020         LDKPath this_ptr_conv;
59021         this_ptr_conv.inner = untag_ptr(this_ptr);
59022         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
59023         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
59024         this_ptr_conv.is_owned = false;
59025         LDKBlindedTail ret_var = Path_get_blinded_tail(&this_ptr_conv);
59026         uint64_t ret_ref = 0;
59027         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
59028         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
59029         return ret_ref;
59030 }
59031
59032 void  __attribute__((export_name("TS_Path_set_blinded_tail"))) TS_Path_set_blinded_tail(uint64_t this_ptr, uint64_t val) {
59033         LDKPath this_ptr_conv;
59034         this_ptr_conv.inner = untag_ptr(this_ptr);
59035         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
59036         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
59037         this_ptr_conv.is_owned = false;
59038         LDKBlindedTail val_conv;
59039         val_conv.inner = untag_ptr(val);
59040         val_conv.is_owned = ptr_is_owned(val);
59041         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
59042         val_conv = BlindedTail_clone(&val_conv);
59043         Path_set_blinded_tail(&this_ptr_conv, val_conv);
59044 }
59045
59046 uint64_t  __attribute__((export_name("TS_Path_new"))) TS_Path_new(uint64_tArray hops_arg, uint64_t blinded_tail_arg) {
59047         LDKCVec_RouteHopZ hops_arg_constr;
59048         hops_arg_constr.datalen = hops_arg->arr_len;
59049         if (hops_arg_constr.datalen > 0)
59050                 hops_arg_constr.data = MALLOC(hops_arg_constr.datalen * sizeof(LDKRouteHop), "LDKCVec_RouteHopZ Elements");
59051         else
59052                 hops_arg_constr.data = NULL;
59053         uint64_t* hops_arg_vals = hops_arg->elems;
59054         for (size_t k = 0; k < hops_arg_constr.datalen; k++) {
59055                 uint64_t hops_arg_conv_10 = hops_arg_vals[k];
59056                 LDKRouteHop hops_arg_conv_10_conv;
59057                 hops_arg_conv_10_conv.inner = untag_ptr(hops_arg_conv_10);
59058                 hops_arg_conv_10_conv.is_owned = ptr_is_owned(hops_arg_conv_10);
59059                 CHECK_INNER_FIELD_ACCESS_OR_NULL(hops_arg_conv_10_conv);
59060                 hops_arg_conv_10_conv = RouteHop_clone(&hops_arg_conv_10_conv);
59061                 hops_arg_constr.data[k] = hops_arg_conv_10_conv;
59062         }
59063         FREE(hops_arg);
59064         LDKBlindedTail blinded_tail_arg_conv;
59065         blinded_tail_arg_conv.inner = untag_ptr(blinded_tail_arg);
59066         blinded_tail_arg_conv.is_owned = ptr_is_owned(blinded_tail_arg);
59067         CHECK_INNER_FIELD_ACCESS_OR_NULL(blinded_tail_arg_conv);
59068         blinded_tail_arg_conv = BlindedTail_clone(&blinded_tail_arg_conv);
59069         LDKPath ret_var = Path_new(hops_arg_constr, blinded_tail_arg_conv);
59070         uint64_t ret_ref = 0;
59071         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
59072         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
59073         return ret_ref;
59074 }
59075
59076 static inline uint64_t Path_clone_ptr(LDKPath *NONNULL_PTR arg) {
59077         LDKPath ret_var = Path_clone(arg);
59078         uint64_t ret_ref = 0;
59079         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
59080         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
59081         return ret_ref;
59082 }
59083 int64_t  __attribute__((export_name("TS_Path_clone_ptr"))) TS_Path_clone_ptr(uint64_t arg) {
59084         LDKPath arg_conv;
59085         arg_conv.inner = untag_ptr(arg);
59086         arg_conv.is_owned = ptr_is_owned(arg);
59087         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
59088         arg_conv.is_owned = false;
59089         int64_t ret_conv = Path_clone_ptr(&arg_conv);
59090         return ret_conv;
59091 }
59092
59093 uint64_t  __attribute__((export_name("TS_Path_clone"))) TS_Path_clone(uint64_t orig) {
59094         LDKPath orig_conv;
59095         orig_conv.inner = untag_ptr(orig);
59096         orig_conv.is_owned = ptr_is_owned(orig);
59097         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
59098         orig_conv.is_owned = false;
59099         LDKPath ret_var = Path_clone(&orig_conv);
59100         uint64_t ret_ref = 0;
59101         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
59102         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
59103         return ret_ref;
59104 }
59105
59106 int64_t  __attribute__((export_name("TS_Path_hash"))) TS_Path_hash(uint64_t o) {
59107         LDKPath o_conv;
59108         o_conv.inner = untag_ptr(o);
59109         o_conv.is_owned = ptr_is_owned(o);
59110         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
59111         o_conv.is_owned = false;
59112         int64_t ret_conv = Path_hash(&o_conv);
59113         return ret_conv;
59114 }
59115
59116 jboolean  __attribute__((export_name("TS_Path_eq"))) TS_Path_eq(uint64_t a, uint64_t b) {
59117         LDKPath a_conv;
59118         a_conv.inner = untag_ptr(a);
59119         a_conv.is_owned = ptr_is_owned(a);
59120         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
59121         a_conv.is_owned = false;
59122         LDKPath b_conv;
59123         b_conv.inner = untag_ptr(b);
59124         b_conv.is_owned = ptr_is_owned(b);
59125         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
59126         b_conv.is_owned = false;
59127         jboolean ret_conv = Path_eq(&a_conv, &b_conv);
59128         return ret_conv;
59129 }
59130
59131 int64_t  __attribute__((export_name("TS_Path_fee_msat"))) TS_Path_fee_msat(uint64_t this_arg) {
59132         LDKPath this_arg_conv;
59133         this_arg_conv.inner = untag_ptr(this_arg);
59134         this_arg_conv.is_owned = ptr_is_owned(this_arg);
59135         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
59136         this_arg_conv.is_owned = false;
59137         int64_t ret_conv = Path_fee_msat(&this_arg_conv);
59138         return ret_conv;
59139 }
59140
59141 int64_t  __attribute__((export_name("TS_Path_final_value_msat"))) TS_Path_final_value_msat(uint64_t this_arg) {
59142         LDKPath this_arg_conv;
59143         this_arg_conv.inner = untag_ptr(this_arg);
59144         this_arg_conv.is_owned = ptr_is_owned(this_arg);
59145         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
59146         this_arg_conv.is_owned = false;
59147         int64_t ret_conv = Path_final_value_msat(&this_arg_conv);
59148         return ret_conv;
59149 }
59150
59151 uint64_t  __attribute__((export_name("TS_Path_final_cltv_expiry_delta"))) TS_Path_final_cltv_expiry_delta(uint64_t this_arg) {
59152         LDKPath this_arg_conv;
59153         this_arg_conv.inner = untag_ptr(this_arg);
59154         this_arg_conv.is_owned = ptr_is_owned(this_arg);
59155         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
59156         this_arg_conv.is_owned = false;
59157         LDKCOption_u32Z *ret_copy = MALLOC(sizeof(LDKCOption_u32Z), "LDKCOption_u32Z");
59158         *ret_copy = Path_final_cltv_expiry_delta(&this_arg_conv);
59159         uint64_t ret_ref = tag_ptr(ret_copy, true);
59160         return ret_ref;
59161 }
59162
59163 void  __attribute__((export_name("TS_Route_free"))) TS_Route_free(uint64_t this_obj) {
59164         LDKRoute this_obj_conv;
59165         this_obj_conv.inner = untag_ptr(this_obj);
59166         this_obj_conv.is_owned = ptr_is_owned(this_obj);
59167         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
59168         Route_free(this_obj_conv);
59169 }
59170
59171 uint64_tArray  __attribute__((export_name("TS_Route_get_paths"))) TS_Route_get_paths(uint64_t this_ptr) {
59172         LDKRoute this_ptr_conv;
59173         this_ptr_conv.inner = untag_ptr(this_ptr);
59174         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
59175         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
59176         this_ptr_conv.is_owned = false;
59177         LDKCVec_PathZ ret_var = Route_get_paths(&this_ptr_conv);
59178         uint64_tArray ret_arr = NULL;
59179         ret_arr = init_uint64_tArray(ret_var.datalen, __LINE__);
59180         uint64_t *ret_arr_ptr = (uint64_t*)(((uint8_t*)ret_arr) + 8);
59181         for (size_t g = 0; g < ret_var.datalen; g++) {
59182                 LDKPath ret_conv_6_var = ret_var.data[g];
59183                 uint64_t ret_conv_6_ref = 0;
59184                 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_conv_6_var);
59185                 ret_conv_6_ref = tag_ptr(ret_conv_6_var.inner, ret_conv_6_var.is_owned);
59186                 ret_arr_ptr[g] = ret_conv_6_ref;
59187         }
59188         
59189         FREE(ret_var.data);
59190         return ret_arr;
59191 }
59192
59193 void  __attribute__((export_name("TS_Route_set_paths"))) TS_Route_set_paths(uint64_t this_ptr, uint64_tArray val) {
59194         LDKRoute this_ptr_conv;
59195         this_ptr_conv.inner = untag_ptr(this_ptr);
59196         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
59197         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
59198         this_ptr_conv.is_owned = false;
59199         LDKCVec_PathZ val_constr;
59200         val_constr.datalen = val->arr_len;
59201         if (val_constr.datalen > 0)
59202                 val_constr.data = MALLOC(val_constr.datalen * sizeof(LDKPath), "LDKCVec_PathZ Elements");
59203         else
59204                 val_constr.data = NULL;
59205         uint64_t* val_vals = val->elems;
59206         for (size_t g = 0; g < val_constr.datalen; g++) {
59207                 uint64_t val_conv_6 = val_vals[g];
59208                 LDKPath val_conv_6_conv;
59209                 val_conv_6_conv.inner = untag_ptr(val_conv_6);
59210                 val_conv_6_conv.is_owned = ptr_is_owned(val_conv_6);
59211                 CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv_6_conv);
59212                 val_conv_6_conv = Path_clone(&val_conv_6_conv);
59213                 val_constr.data[g] = val_conv_6_conv;
59214         }
59215         FREE(val);
59216         Route_set_paths(&this_ptr_conv, val_constr);
59217 }
59218
59219 uint64_t  __attribute__((export_name("TS_Route_get_route_params"))) TS_Route_get_route_params(uint64_t this_ptr) {
59220         LDKRoute this_ptr_conv;
59221         this_ptr_conv.inner = untag_ptr(this_ptr);
59222         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
59223         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
59224         this_ptr_conv.is_owned = false;
59225         LDKRouteParameters ret_var = Route_get_route_params(&this_ptr_conv);
59226         uint64_t ret_ref = 0;
59227         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
59228         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
59229         return ret_ref;
59230 }
59231
59232 void  __attribute__((export_name("TS_Route_set_route_params"))) TS_Route_set_route_params(uint64_t this_ptr, uint64_t val) {
59233         LDKRoute this_ptr_conv;
59234         this_ptr_conv.inner = untag_ptr(this_ptr);
59235         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
59236         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
59237         this_ptr_conv.is_owned = false;
59238         LDKRouteParameters val_conv;
59239         val_conv.inner = untag_ptr(val);
59240         val_conv.is_owned = ptr_is_owned(val);
59241         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
59242         val_conv = RouteParameters_clone(&val_conv);
59243         Route_set_route_params(&this_ptr_conv, val_conv);
59244 }
59245
59246 uint64_t  __attribute__((export_name("TS_Route_new"))) TS_Route_new(uint64_tArray paths_arg, uint64_t route_params_arg) {
59247         LDKCVec_PathZ paths_arg_constr;
59248         paths_arg_constr.datalen = paths_arg->arr_len;
59249         if (paths_arg_constr.datalen > 0)
59250                 paths_arg_constr.data = MALLOC(paths_arg_constr.datalen * sizeof(LDKPath), "LDKCVec_PathZ Elements");
59251         else
59252                 paths_arg_constr.data = NULL;
59253         uint64_t* paths_arg_vals = paths_arg->elems;
59254         for (size_t g = 0; g < paths_arg_constr.datalen; g++) {
59255                 uint64_t paths_arg_conv_6 = paths_arg_vals[g];
59256                 LDKPath paths_arg_conv_6_conv;
59257                 paths_arg_conv_6_conv.inner = untag_ptr(paths_arg_conv_6);
59258                 paths_arg_conv_6_conv.is_owned = ptr_is_owned(paths_arg_conv_6);
59259                 CHECK_INNER_FIELD_ACCESS_OR_NULL(paths_arg_conv_6_conv);
59260                 paths_arg_conv_6_conv = Path_clone(&paths_arg_conv_6_conv);
59261                 paths_arg_constr.data[g] = paths_arg_conv_6_conv;
59262         }
59263         FREE(paths_arg);
59264         LDKRouteParameters route_params_arg_conv;
59265         route_params_arg_conv.inner = untag_ptr(route_params_arg);
59266         route_params_arg_conv.is_owned = ptr_is_owned(route_params_arg);
59267         CHECK_INNER_FIELD_ACCESS_OR_NULL(route_params_arg_conv);
59268         route_params_arg_conv = RouteParameters_clone(&route_params_arg_conv);
59269         LDKRoute ret_var = Route_new(paths_arg_constr, route_params_arg_conv);
59270         uint64_t ret_ref = 0;
59271         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
59272         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
59273         return ret_ref;
59274 }
59275
59276 static inline uint64_t Route_clone_ptr(LDKRoute *NONNULL_PTR arg) {
59277         LDKRoute ret_var = Route_clone(arg);
59278         uint64_t ret_ref = 0;
59279         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
59280         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
59281         return ret_ref;
59282 }
59283 int64_t  __attribute__((export_name("TS_Route_clone_ptr"))) TS_Route_clone_ptr(uint64_t arg) {
59284         LDKRoute arg_conv;
59285         arg_conv.inner = untag_ptr(arg);
59286         arg_conv.is_owned = ptr_is_owned(arg);
59287         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
59288         arg_conv.is_owned = false;
59289         int64_t ret_conv = Route_clone_ptr(&arg_conv);
59290         return ret_conv;
59291 }
59292
59293 uint64_t  __attribute__((export_name("TS_Route_clone"))) TS_Route_clone(uint64_t orig) {
59294         LDKRoute orig_conv;
59295         orig_conv.inner = untag_ptr(orig);
59296         orig_conv.is_owned = ptr_is_owned(orig);
59297         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
59298         orig_conv.is_owned = false;
59299         LDKRoute ret_var = Route_clone(&orig_conv);
59300         uint64_t ret_ref = 0;
59301         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
59302         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
59303         return ret_ref;
59304 }
59305
59306 int64_t  __attribute__((export_name("TS_Route_hash"))) TS_Route_hash(uint64_t o) {
59307         LDKRoute o_conv;
59308         o_conv.inner = untag_ptr(o);
59309         o_conv.is_owned = ptr_is_owned(o);
59310         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
59311         o_conv.is_owned = false;
59312         int64_t ret_conv = Route_hash(&o_conv);
59313         return ret_conv;
59314 }
59315
59316 jboolean  __attribute__((export_name("TS_Route_eq"))) TS_Route_eq(uint64_t a, uint64_t b) {
59317         LDKRoute a_conv;
59318         a_conv.inner = untag_ptr(a);
59319         a_conv.is_owned = ptr_is_owned(a);
59320         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
59321         a_conv.is_owned = false;
59322         LDKRoute b_conv;
59323         b_conv.inner = untag_ptr(b);
59324         b_conv.is_owned = ptr_is_owned(b);
59325         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
59326         b_conv.is_owned = false;
59327         jboolean ret_conv = Route_eq(&a_conv, &b_conv);
59328         return ret_conv;
59329 }
59330
59331 int64_t  __attribute__((export_name("TS_Route_get_total_fees"))) TS_Route_get_total_fees(uint64_t this_arg) {
59332         LDKRoute this_arg_conv;
59333         this_arg_conv.inner = untag_ptr(this_arg);
59334         this_arg_conv.is_owned = ptr_is_owned(this_arg);
59335         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
59336         this_arg_conv.is_owned = false;
59337         int64_t ret_conv = Route_get_total_fees(&this_arg_conv);
59338         return ret_conv;
59339 }
59340
59341 int64_t  __attribute__((export_name("TS_Route_get_total_amount"))) TS_Route_get_total_amount(uint64_t this_arg) {
59342         LDKRoute this_arg_conv;
59343         this_arg_conv.inner = untag_ptr(this_arg);
59344         this_arg_conv.is_owned = ptr_is_owned(this_arg);
59345         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
59346         this_arg_conv.is_owned = false;
59347         int64_t ret_conv = Route_get_total_amount(&this_arg_conv);
59348         return ret_conv;
59349 }
59350
59351 int8_tArray  __attribute__((export_name("TS_Route_write"))) TS_Route_write(uint64_t obj) {
59352         LDKRoute obj_conv;
59353         obj_conv.inner = untag_ptr(obj);
59354         obj_conv.is_owned = ptr_is_owned(obj);
59355         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
59356         obj_conv.is_owned = false;
59357         LDKCVec_u8Z ret_var = Route_write(&obj_conv);
59358         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
59359         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
59360         CVec_u8Z_free(ret_var);
59361         return ret_arr;
59362 }
59363
59364 uint64_t  __attribute__((export_name("TS_Route_read"))) TS_Route_read(int8_tArray ser) {
59365         LDKu8slice ser_ref;
59366         ser_ref.datalen = ser->arr_len;
59367         ser_ref.data = ser->elems;
59368         LDKCResult_RouteDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteDecodeErrorZ), "LDKCResult_RouteDecodeErrorZ");
59369         *ret_conv = Route_read(ser_ref);
59370         FREE(ser);
59371         return tag_ptr(ret_conv, true);
59372 }
59373
59374 void  __attribute__((export_name("TS_RouteParameters_free"))) TS_RouteParameters_free(uint64_t this_obj) {
59375         LDKRouteParameters this_obj_conv;
59376         this_obj_conv.inner = untag_ptr(this_obj);
59377         this_obj_conv.is_owned = ptr_is_owned(this_obj);
59378         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
59379         RouteParameters_free(this_obj_conv);
59380 }
59381
59382 uint64_t  __attribute__((export_name("TS_RouteParameters_get_payment_params"))) TS_RouteParameters_get_payment_params(uint64_t this_ptr) {
59383         LDKRouteParameters this_ptr_conv;
59384         this_ptr_conv.inner = untag_ptr(this_ptr);
59385         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
59386         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
59387         this_ptr_conv.is_owned = false;
59388         LDKPaymentParameters ret_var = RouteParameters_get_payment_params(&this_ptr_conv);
59389         uint64_t ret_ref = 0;
59390         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
59391         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
59392         return ret_ref;
59393 }
59394
59395 void  __attribute__((export_name("TS_RouteParameters_set_payment_params"))) TS_RouteParameters_set_payment_params(uint64_t this_ptr, uint64_t val) {
59396         LDKRouteParameters this_ptr_conv;
59397         this_ptr_conv.inner = untag_ptr(this_ptr);
59398         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
59399         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
59400         this_ptr_conv.is_owned = false;
59401         LDKPaymentParameters val_conv;
59402         val_conv.inner = untag_ptr(val);
59403         val_conv.is_owned = ptr_is_owned(val);
59404         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
59405         val_conv = PaymentParameters_clone(&val_conv);
59406         RouteParameters_set_payment_params(&this_ptr_conv, val_conv);
59407 }
59408
59409 int64_t  __attribute__((export_name("TS_RouteParameters_get_final_value_msat"))) TS_RouteParameters_get_final_value_msat(uint64_t this_ptr) {
59410         LDKRouteParameters this_ptr_conv;
59411         this_ptr_conv.inner = untag_ptr(this_ptr);
59412         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
59413         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
59414         this_ptr_conv.is_owned = false;
59415         int64_t ret_conv = RouteParameters_get_final_value_msat(&this_ptr_conv);
59416         return ret_conv;
59417 }
59418
59419 void  __attribute__((export_name("TS_RouteParameters_set_final_value_msat"))) TS_RouteParameters_set_final_value_msat(uint64_t this_ptr, int64_t val) {
59420         LDKRouteParameters this_ptr_conv;
59421         this_ptr_conv.inner = untag_ptr(this_ptr);
59422         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
59423         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
59424         this_ptr_conv.is_owned = false;
59425         RouteParameters_set_final_value_msat(&this_ptr_conv, val);
59426 }
59427
59428 uint64_t  __attribute__((export_name("TS_RouteParameters_get_max_total_routing_fee_msat"))) TS_RouteParameters_get_max_total_routing_fee_msat(uint64_t this_ptr) {
59429         LDKRouteParameters this_ptr_conv;
59430         this_ptr_conv.inner = untag_ptr(this_ptr);
59431         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
59432         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
59433         this_ptr_conv.is_owned = false;
59434         LDKCOption_u64Z *ret_copy = MALLOC(sizeof(LDKCOption_u64Z), "LDKCOption_u64Z");
59435         *ret_copy = RouteParameters_get_max_total_routing_fee_msat(&this_ptr_conv);
59436         uint64_t ret_ref = tag_ptr(ret_copy, true);
59437         return ret_ref;
59438 }
59439
59440 void  __attribute__((export_name("TS_RouteParameters_set_max_total_routing_fee_msat"))) TS_RouteParameters_set_max_total_routing_fee_msat(uint64_t this_ptr, uint64_t val) {
59441         LDKRouteParameters this_ptr_conv;
59442         this_ptr_conv.inner = untag_ptr(this_ptr);
59443         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
59444         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
59445         this_ptr_conv.is_owned = false;
59446         void* val_ptr = untag_ptr(val);
59447         CHECK_ACCESS(val_ptr);
59448         LDKCOption_u64Z val_conv = *(LDKCOption_u64Z*)(val_ptr);
59449         val_conv = COption_u64Z_clone((LDKCOption_u64Z*)untag_ptr(val));
59450         RouteParameters_set_max_total_routing_fee_msat(&this_ptr_conv, val_conv);
59451 }
59452
59453 uint64_t  __attribute__((export_name("TS_RouteParameters_new"))) TS_RouteParameters_new(uint64_t payment_params_arg, int64_t final_value_msat_arg, uint64_t max_total_routing_fee_msat_arg) {
59454         LDKPaymentParameters payment_params_arg_conv;
59455         payment_params_arg_conv.inner = untag_ptr(payment_params_arg);
59456         payment_params_arg_conv.is_owned = ptr_is_owned(payment_params_arg);
59457         CHECK_INNER_FIELD_ACCESS_OR_NULL(payment_params_arg_conv);
59458         payment_params_arg_conv = PaymentParameters_clone(&payment_params_arg_conv);
59459         void* max_total_routing_fee_msat_arg_ptr = untag_ptr(max_total_routing_fee_msat_arg);
59460         CHECK_ACCESS(max_total_routing_fee_msat_arg_ptr);
59461         LDKCOption_u64Z max_total_routing_fee_msat_arg_conv = *(LDKCOption_u64Z*)(max_total_routing_fee_msat_arg_ptr);
59462         max_total_routing_fee_msat_arg_conv = COption_u64Z_clone((LDKCOption_u64Z*)untag_ptr(max_total_routing_fee_msat_arg));
59463         LDKRouteParameters ret_var = RouteParameters_new(payment_params_arg_conv, final_value_msat_arg, max_total_routing_fee_msat_arg_conv);
59464         uint64_t ret_ref = 0;
59465         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
59466         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
59467         return ret_ref;
59468 }
59469
59470 static inline uint64_t RouteParameters_clone_ptr(LDKRouteParameters *NONNULL_PTR arg) {
59471         LDKRouteParameters ret_var = RouteParameters_clone(arg);
59472         uint64_t ret_ref = 0;
59473         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
59474         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
59475         return ret_ref;
59476 }
59477 int64_t  __attribute__((export_name("TS_RouteParameters_clone_ptr"))) TS_RouteParameters_clone_ptr(uint64_t arg) {
59478         LDKRouteParameters arg_conv;
59479         arg_conv.inner = untag_ptr(arg);
59480         arg_conv.is_owned = ptr_is_owned(arg);
59481         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
59482         arg_conv.is_owned = false;
59483         int64_t ret_conv = RouteParameters_clone_ptr(&arg_conv);
59484         return ret_conv;
59485 }
59486
59487 uint64_t  __attribute__((export_name("TS_RouteParameters_clone"))) TS_RouteParameters_clone(uint64_t orig) {
59488         LDKRouteParameters orig_conv;
59489         orig_conv.inner = untag_ptr(orig);
59490         orig_conv.is_owned = ptr_is_owned(orig);
59491         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
59492         orig_conv.is_owned = false;
59493         LDKRouteParameters ret_var = RouteParameters_clone(&orig_conv);
59494         uint64_t ret_ref = 0;
59495         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
59496         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
59497         return ret_ref;
59498 }
59499
59500 int64_t  __attribute__((export_name("TS_RouteParameters_hash"))) TS_RouteParameters_hash(uint64_t o) {
59501         LDKRouteParameters o_conv;
59502         o_conv.inner = untag_ptr(o);
59503         o_conv.is_owned = ptr_is_owned(o);
59504         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
59505         o_conv.is_owned = false;
59506         int64_t ret_conv = RouteParameters_hash(&o_conv);
59507         return ret_conv;
59508 }
59509
59510 jboolean  __attribute__((export_name("TS_RouteParameters_eq"))) TS_RouteParameters_eq(uint64_t a, uint64_t b) {
59511         LDKRouteParameters a_conv;
59512         a_conv.inner = untag_ptr(a);
59513         a_conv.is_owned = ptr_is_owned(a);
59514         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
59515         a_conv.is_owned = false;
59516         LDKRouteParameters b_conv;
59517         b_conv.inner = untag_ptr(b);
59518         b_conv.is_owned = ptr_is_owned(b);
59519         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
59520         b_conv.is_owned = false;
59521         jboolean ret_conv = RouteParameters_eq(&a_conv, &b_conv);
59522         return ret_conv;
59523 }
59524
59525 uint64_t  __attribute__((export_name("TS_RouteParameters_from_payment_params_and_value"))) TS_RouteParameters_from_payment_params_and_value(uint64_t payment_params, int64_t final_value_msat) {
59526         LDKPaymentParameters payment_params_conv;
59527         payment_params_conv.inner = untag_ptr(payment_params);
59528         payment_params_conv.is_owned = ptr_is_owned(payment_params);
59529         CHECK_INNER_FIELD_ACCESS_OR_NULL(payment_params_conv);
59530         payment_params_conv = PaymentParameters_clone(&payment_params_conv);
59531         LDKRouteParameters ret_var = RouteParameters_from_payment_params_and_value(payment_params_conv, final_value_msat);
59532         uint64_t ret_ref = 0;
59533         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
59534         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
59535         return ret_ref;
59536 }
59537
59538 int8_tArray  __attribute__((export_name("TS_RouteParameters_write"))) TS_RouteParameters_write(uint64_t obj) {
59539         LDKRouteParameters obj_conv;
59540         obj_conv.inner = untag_ptr(obj);
59541         obj_conv.is_owned = ptr_is_owned(obj);
59542         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
59543         obj_conv.is_owned = false;
59544         LDKCVec_u8Z ret_var = RouteParameters_write(&obj_conv);
59545         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
59546         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
59547         CVec_u8Z_free(ret_var);
59548         return ret_arr;
59549 }
59550
59551 uint64_t  __attribute__((export_name("TS_RouteParameters_read"))) TS_RouteParameters_read(int8_tArray ser) {
59552         LDKu8slice ser_ref;
59553         ser_ref.datalen = ser->arr_len;
59554         ser_ref.data = ser->elems;
59555         LDKCResult_RouteParametersDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteParametersDecodeErrorZ), "LDKCResult_RouteParametersDecodeErrorZ");
59556         *ret_conv = RouteParameters_read(ser_ref);
59557         FREE(ser);
59558         return tag_ptr(ret_conv, true);
59559 }
59560
59561 void  __attribute__((export_name("TS_PaymentParameters_free"))) TS_PaymentParameters_free(uint64_t this_obj) {
59562         LDKPaymentParameters this_obj_conv;
59563         this_obj_conv.inner = untag_ptr(this_obj);
59564         this_obj_conv.is_owned = ptr_is_owned(this_obj);
59565         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
59566         PaymentParameters_free(this_obj_conv);
59567 }
59568
59569 uint64_t  __attribute__((export_name("TS_PaymentParameters_get_payee"))) TS_PaymentParameters_get_payee(uint64_t this_ptr) {
59570         LDKPaymentParameters this_ptr_conv;
59571         this_ptr_conv.inner = untag_ptr(this_ptr);
59572         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
59573         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
59574         this_ptr_conv.is_owned = false;
59575         LDKPayee *ret_copy = MALLOC(sizeof(LDKPayee), "LDKPayee");
59576         *ret_copy = PaymentParameters_get_payee(&this_ptr_conv);
59577         uint64_t ret_ref = tag_ptr(ret_copy, true);
59578         return ret_ref;
59579 }
59580
59581 void  __attribute__((export_name("TS_PaymentParameters_set_payee"))) TS_PaymentParameters_set_payee(uint64_t this_ptr, uint64_t val) {
59582         LDKPaymentParameters this_ptr_conv;
59583         this_ptr_conv.inner = untag_ptr(this_ptr);
59584         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
59585         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
59586         this_ptr_conv.is_owned = false;
59587         void* val_ptr = untag_ptr(val);
59588         CHECK_ACCESS(val_ptr);
59589         LDKPayee val_conv = *(LDKPayee*)(val_ptr);
59590         val_conv = Payee_clone((LDKPayee*)untag_ptr(val));
59591         PaymentParameters_set_payee(&this_ptr_conv, val_conv);
59592 }
59593
59594 uint64_t  __attribute__((export_name("TS_PaymentParameters_get_expiry_time"))) TS_PaymentParameters_get_expiry_time(uint64_t this_ptr) {
59595         LDKPaymentParameters this_ptr_conv;
59596         this_ptr_conv.inner = untag_ptr(this_ptr);
59597         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
59598         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
59599         this_ptr_conv.is_owned = false;
59600         LDKCOption_u64Z *ret_copy = MALLOC(sizeof(LDKCOption_u64Z), "LDKCOption_u64Z");
59601         *ret_copy = PaymentParameters_get_expiry_time(&this_ptr_conv);
59602         uint64_t ret_ref = tag_ptr(ret_copy, true);
59603         return ret_ref;
59604 }
59605
59606 void  __attribute__((export_name("TS_PaymentParameters_set_expiry_time"))) TS_PaymentParameters_set_expiry_time(uint64_t this_ptr, uint64_t val) {
59607         LDKPaymentParameters this_ptr_conv;
59608         this_ptr_conv.inner = untag_ptr(this_ptr);
59609         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
59610         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
59611         this_ptr_conv.is_owned = false;
59612         void* val_ptr = untag_ptr(val);
59613         CHECK_ACCESS(val_ptr);
59614         LDKCOption_u64Z val_conv = *(LDKCOption_u64Z*)(val_ptr);
59615         val_conv = COption_u64Z_clone((LDKCOption_u64Z*)untag_ptr(val));
59616         PaymentParameters_set_expiry_time(&this_ptr_conv, val_conv);
59617 }
59618
59619 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) {
59620         LDKPaymentParameters this_ptr_conv;
59621         this_ptr_conv.inner = untag_ptr(this_ptr);
59622         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
59623         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
59624         this_ptr_conv.is_owned = false;
59625         int32_t ret_conv = PaymentParameters_get_max_total_cltv_expiry_delta(&this_ptr_conv);
59626         return ret_conv;
59627 }
59628
59629 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) {
59630         LDKPaymentParameters this_ptr_conv;
59631         this_ptr_conv.inner = untag_ptr(this_ptr);
59632         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
59633         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
59634         this_ptr_conv.is_owned = false;
59635         PaymentParameters_set_max_total_cltv_expiry_delta(&this_ptr_conv, val);
59636 }
59637
59638 int8_t  __attribute__((export_name("TS_PaymentParameters_get_max_path_count"))) TS_PaymentParameters_get_max_path_count(uint64_t this_ptr) {
59639         LDKPaymentParameters this_ptr_conv;
59640         this_ptr_conv.inner = untag_ptr(this_ptr);
59641         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
59642         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
59643         this_ptr_conv.is_owned = false;
59644         int8_t ret_conv = PaymentParameters_get_max_path_count(&this_ptr_conv);
59645         return ret_conv;
59646 }
59647
59648 void  __attribute__((export_name("TS_PaymentParameters_set_max_path_count"))) TS_PaymentParameters_set_max_path_count(uint64_t this_ptr, int8_t val) {
59649         LDKPaymentParameters this_ptr_conv;
59650         this_ptr_conv.inner = untag_ptr(this_ptr);
59651         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
59652         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
59653         this_ptr_conv.is_owned = false;
59654         PaymentParameters_set_max_path_count(&this_ptr_conv, val);
59655 }
59656
59657 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) {
59658         LDKPaymentParameters this_ptr_conv;
59659         this_ptr_conv.inner = untag_ptr(this_ptr);
59660         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
59661         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
59662         this_ptr_conv.is_owned = false;
59663         int8_t ret_conv = PaymentParameters_get_max_channel_saturation_power_of_half(&this_ptr_conv);
59664         return ret_conv;
59665 }
59666
59667 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) {
59668         LDKPaymentParameters this_ptr_conv;
59669         this_ptr_conv.inner = untag_ptr(this_ptr);
59670         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
59671         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
59672         this_ptr_conv.is_owned = false;
59673         PaymentParameters_set_max_channel_saturation_power_of_half(&this_ptr_conv, val);
59674 }
59675
59676 int64_tArray  __attribute__((export_name("TS_PaymentParameters_get_previously_failed_channels"))) TS_PaymentParameters_get_previously_failed_channels(uint64_t this_ptr) {
59677         LDKPaymentParameters this_ptr_conv;
59678         this_ptr_conv.inner = untag_ptr(this_ptr);
59679         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
59680         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
59681         this_ptr_conv.is_owned = false;
59682         LDKCVec_u64Z ret_var = PaymentParameters_get_previously_failed_channels(&this_ptr_conv);
59683         int64_tArray ret_arr = NULL;
59684         ret_arr = init_int64_tArray(ret_var.datalen, __LINE__);
59685         int64_t *ret_arr_ptr = (int64_t*)(((uint8_t*)ret_arr) + 8);
59686         for (size_t i = 0; i < ret_var.datalen; i++) {
59687                 int64_t ret_conv_8_conv = ret_var.data[i];
59688                 ret_arr_ptr[i] = ret_conv_8_conv;
59689         }
59690         
59691         FREE(ret_var.data);
59692         return ret_arr;
59693 }
59694
59695 void  __attribute__((export_name("TS_PaymentParameters_set_previously_failed_channels"))) TS_PaymentParameters_set_previously_failed_channels(uint64_t this_ptr, int64_tArray val) {
59696         LDKPaymentParameters this_ptr_conv;
59697         this_ptr_conv.inner = untag_ptr(this_ptr);
59698         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
59699         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
59700         this_ptr_conv.is_owned = false;
59701         LDKCVec_u64Z val_constr;
59702         val_constr.datalen = val->arr_len;
59703         if (val_constr.datalen > 0)
59704                 val_constr.data = MALLOC(val_constr.datalen * sizeof(int64_t), "LDKCVec_u64Z Elements");
59705         else
59706                 val_constr.data = NULL;
59707         int64_t* val_vals = val->elems;
59708         for (size_t i = 0; i < val_constr.datalen; i++) {
59709                 int64_t val_conv_8 = val_vals[i];
59710                 val_constr.data[i] = val_conv_8;
59711         }
59712         FREE(val);
59713         PaymentParameters_set_previously_failed_channels(&this_ptr_conv, val_constr);
59714 }
59715
59716 uint64_t  __attribute__((export_name("TS_PaymentParameters_new"))) TS_PaymentParameters_new(uint64_t payee_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) {
59717         void* payee_arg_ptr = untag_ptr(payee_arg);
59718         CHECK_ACCESS(payee_arg_ptr);
59719         LDKPayee payee_arg_conv = *(LDKPayee*)(payee_arg_ptr);
59720         payee_arg_conv = Payee_clone((LDKPayee*)untag_ptr(payee_arg));
59721         void* expiry_time_arg_ptr = untag_ptr(expiry_time_arg);
59722         CHECK_ACCESS(expiry_time_arg_ptr);
59723         LDKCOption_u64Z expiry_time_arg_conv = *(LDKCOption_u64Z*)(expiry_time_arg_ptr);
59724         expiry_time_arg_conv = COption_u64Z_clone((LDKCOption_u64Z*)untag_ptr(expiry_time_arg));
59725         LDKCVec_u64Z previously_failed_channels_arg_constr;
59726         previously_failed_channels_arg_constr.datalen = previously_failed_channels_arg->arr_len;
59727         if (previously_failed_channels_arg_constr.datalen > 0)
59728                 previously_failed_channels_arg_constr.data = MALLOC(previously_failed_channels_arg_constr.datalen * sizeof(int64_t), "LDKCVec_u64Z Elements");
59729         else
59730                 previously_failed_channels_arg_constr.data = NULL;
59731         int64_t* previously_failed_channels_arg_vals = previously_failed_channels_arg->elems;
59732         for (size_t i = 0; i < previously_failed_channels_arg_constr.datalen; i++) {
59733                 int64_t previously_failed_channels_arg_conv_8 = previously_failed_channels_arg_vals[i];
59734                 previously_failed_channels_arg_constr.data[i] = previously_failed_channels_arg_conv_8;
59735         }
59736         FREE(previously_failed_channels_arg);
59737         LDKPaymentParameters ret_var = PaymentParameters_new(payee_arg_conv, expiry_time_arg_conv, max_total_cltv_expiry_delta_arg, max_path_count_arg, max_channel_saturation_power_of_half_arg, previously_failed_channels_arg_constr);
59738         uint64_t ret_ref = 0;
59739         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
59740         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
59741         return ret_ref;
59742 }
59743
59744 static inline uint64_t PaymentParameters_clone_ptr(LDKPaymentParameters *NONNULL_PTR arg) {
59745         LDKPaymentParameters ret_var = PaymentParameters_clone(arg);
59746         uint64_t ret_ref = 0;
59747         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
59748         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
59749         return ret_ref;
59750 }
59751 int64_t  __attribute__((export_name("TS_PaymentParameters_clone_ptr"))) TS_PaymentParameters_clone_ptr(uint64_t arg) {
59752         LDKPaymentParameters arg_conv;
59753         arg_conv.inner = untag_ptr(arg);
59754         arg_conv.is_owned = ptr_is_owned(arg);
59755         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
59756         arg_conv.is_owned = false;
59757         int64_t ret_conv = PaymentParameters_clone_ptr(&arg_conv);
59758         return ret_conv;
59759 }
59760
59761 uint64_t  __attribute__((export_name("TS_PaymentParameters_clone"))) TS_PaymentParameters_clone(uint64_t orig) {
59762         LDKPaymentParameters orig_conv;
59763         orig_conv.inner = untag_ptr(orig);
59764         orig_conv.is_owned = ptr_is_owned(orig);
59765         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
59766         orig_conv.is_owned = false;
59767         LDKPaymentParameters ret_var = PaymentParameters_clone(&orig_conv);
59768         uint64_t ret_ref = 0;
59769         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
59770         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
59771         return ret_ref;
59772 }
59773
59774 int64_t  __attribute__((export_name("TS_PaymentParameters_hash"))) TS_PaymentParameters_hash(uint64_t o) {
59775         LDKPaymentParameters o_conv;
59776         o_conv.inner = untag_ptr(o);
59777         o_conv.is_owned = ptr_is_owned(o);
59778         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
59779         o_conv.is_owned = false;
59780         int64_t ret_conv = PaymentParameters_hash(&o_conv);
59781         return ret_conv;
59782 }
59783
59784 jboolean  __attribute__((export_name("TS_PaymentParameters_eq"))) TS_PaymentParameters_eq(uint64_t a, uint64_t b) {
59785         LDKPaymentParameters a_conv;
59786         a_conv.inner = untag_ptr(a);
59787         a_conv.is_owned = ptr_is_owned(a);
59788         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
59789         a_conv.is_owned = false;
59790         LDKPaymentParameters b_conv;
59791         b_conv.inner = untag_ptr(b);
59792         b_conv.is_owned = ptr_is_owned(b);
59793         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
59794         b_conv.is_owned = false;
59795         jboolean ret_conv = PaymentParameters_eq(&a_conv, &b_conv);
59796         return ret_conv;
59797 }
59798
59799 int8_tArray  __attribute__((export_name("TS_PaymentParameters_write"))) TS_PaymentParameters_write(uint64_t obj) {
59800         LDKPaymentParameters obj_conv;
59801         obj_conv.inner = untag_ptr(obj);
59802         obj_conv.is_owned = ptr_is_owned(obj);
59803         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
59804         obj_conv.is_owned = false;
59805         LDKCVec_u8Z ret_var = PaymentParameters_write(&obj_conv);
59806         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
59807         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
59808         CVec_u8Z_free(ret_var);
59809         return ret_arr;
59810 }
59811
59812 uint64_t  __attribute__((export_name("TS_PaymentParameters_read"))) TS_PaymentParameters_read(int8_tArray ser, int32_t arg) {
59813         LDKu8slice ser_ref;
59814         ser_ref.datalen = ser->arr_len;
59815         ser_ref.data = ser->elems;
59816         LDKCResult_PaymentParametersDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PaymentParametersDecodeErrorZ), "LDKCResult_PaymentParametersDecodeErrorZ");
59817         *ret_conv = PaymentParameters_read(ser_ref, arg);
59818         FREE(ser);
59819         return tag_ptr(ret_conv, true);
59820 }
59821
59822 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) {
59823         LDKPublicKey payee_pubkey_ref;
59824         CHECK(payee_pubkey->arr_len == 33);
59825         memcpy(payee_pubkey_ref.compressed_form, payee_pubkey->elems, 33); FREE(payee_pubkey);
59826         LDKPaymentParameters ret_var = PaymentParameters_from_node_id(payee_pubkey_ref, final_cltv_expiry_delta);
59827         uint64_t ret_ref = 0;
59828         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
59829         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
59830         return ret_ref;
59831 }
59832
59833 uint64_t  __attribute__((export_name("TS_PaymentParameters_for_keysend"))) TS_PaymentParameters_for_keysend(int8_tArray payee_pubkey, int32_t final_cltv_expiry_delta, jboolean allow_mpp) {
59834         LDKPublicKey payee_pubkey_ref;
59835         CHECK(payee_pubkey->arr_len == 33);
59836         memcpy(payee_pubkey_ref.compressed_form, payee_pubkey->elems, 33); FREE(payee_pubkey);
59837         LDKPaymentParameters ret_var = PaymentParameters_for_keysend(payee_pubkey_ref, final_cltv_expiry_delta, allow_mpp);
59838         uint64_t ret_ref = 0;
59839         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
59840         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
59841         return ret_ref;
59842 }
59843
59844 uint64_t  __attribute__((export_name("TS_PaymentParameters_from_bolt12_invoice"))) TS_PaymentParameters_from_bolt12_invoice(uint64_t invoice) {
59845         LDKBolt12Invoice invoice_conv;
59846         invoice_conv.inner = untag_ptr(invoice);
59847         invoice_conv.is_owned = ptr_is_owned(invoice);
59848         CHECK_INNER_FIELD_ACCESS_OR_NULL(invoice_conv);
59849         invoice_conv.is_owned = false;
59850         LDKPaymentParameters ret_var = PaymentParameters_from_bolt12_invoice(&invoice_conv);
59851         uint64_t ret_ref = 0;
59852         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
59853         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
59854         return ret_ref;
59855 }
59856
59857 uint64_t  __attribute__((export_name("TS_PaymentParameters_blinded"))) TS_PaymentParameters_blinded(uint64_tArray blinded_route_hints) {
59858         LDKCVec_C2Tuple_BlindedPayInfoBlindedPathZZ blinded_route_hints_constr;
59859         blinded_route_hints_constr.datalen = blinded_route_hints->arr_len;
59860         if (blinded_route_hints_constr.datalen > 0)
59861                 blinded_route_hints_constr.data = MALLOC(blinded_route_hints_constr.datalen * sizeof(LDKC2Tuple_BlindedPayInfoBlindedPathZ), "LDKCVec_C2Tuple_BlindedPayInfoBlindedPathZZ Elements");
59862         else
59863                 blinded_route_hints_constr.data = NULL;
59864         uint64_t* blinded_route_hints_vals = blinded_route_hints->elems;
59865         for (size_t l = 0; l < blinded_route_hints_constr.datalen; l++) {
59866                 uint64_t blinded_route_hints_conv_37 = blinded_route_hints_vals[l];
59867                 void* blinded_route_hints_conv_37_ptr = untag_ptr(blinded_route_hints_conv_37);
59868                 CHECK_ACCESS(blinded_route_hints_conv_37_ptr);
59869                 LDKC2Tuple_BlindedPayInfoBlindedPathZ blinded_route_hints_conv_37_conv = *(LDKC2Tuple_BlindedPayInfoBlindedPathZ*)(blinded_route_hints_conv_37_ptr);
59870                 blinded_route_hints_conv_37_conv = C2Tuple_BlindedPayInfoBlindedPathZ_clone((LDKC2Tuple_BlindedPayInfoBlindedPathZ*)untag_ptr(blinded_route_hints_conv_37));
59871                 blinded_route_hints_constr.data[l] = blinded_route_hints_conv_37_conv;
59872         }
59873         FREE(blinded_route_hints);
59874         LDKPaymentParameters ret_var = PaymentParameters_blinded(blinded_route_hints_constr);
59875         uint64_t ret_ref = 0;
59876         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
59877         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
59878         return ret_ref;
59879 }
59880
59881 void  __attribute__((export_name("TS_Payee_free"))) TS_Payee_free(uint64_t this_ptr) {
59882         if (!ptr_is_owned(this_ptr)) return;
59883         void* this_ptr_ptr = untag_ptr(this_ptr);
59884         CHECK_ACCESS(this_ptr_ptr);
59885         LDKPayee this_ptr_conv = *(LDKPayee*)(this_ptr_ptr);
59886         FREE(untag_ptr(this_ptr));
59887         Payee_free(this_ptr_conv);
59888 }
59889
59890 static inline uint64_t Payee_clone_ptr(LDKPayee *NONNULL_PTR arg) {
59891         LDKPayee *ret_copy = MALLOC(sizeof(LDKPayee), "LDKPayee");
59892         *ret_copy = Payee_clone(arg);
59893         uint64_t ret_ref = tag_ptr(ret_copy, true);
59894         return ret_ref;
59895 }
59896 int64_t  __attribute__((export_name("TS_Payee_clone_ptr"))) TS_Payee_clone_ptr(uint64_t arg) {
59897         LDKPayee* arg_conv = (LDKPayee*)untag_ptr(arg);
59898         int64_t ret_conv = Payee_clone_ptr(arg_conv);
59899         return ret_conv;
59900 }
59901
59902 uint64_t  __attribute__((export_name("TS_Payee_clone"))) TS_Payee_clone(uint64_t orig) {
59903         LDKPayee* orig_conv = (LDKPayee*)untag_ptr(orig);
59904         LDKPayee *ret_copy = MALLOC(sizeof(LDKPayee), "LDKPayee");
59905         *ret_copy = Payee_clone(orig_conv);
59906         uint64_t ret_ref = tag_ptr(ret_copy, true);
59907         return ret_ref;
59908 }
59909
59910 uint64_t  __attribute__((export_name("TS_Payee_blinded"))) TS_Payee_blinded(uint64_tArray route_hints, uint64_t features) {
59911         LDKCVec_C2Tuple_BlindedPayInfoBlindedPathZZ route_hints_constr;
59912         route_hints_constr.datalen = route_hints->arr_len;
59913         if (route_hints_constr.datalen > 0)
59914                 route_hints_constr.data = MALLOC(route_hints_constr.datalen * sizeof(LDKC2Tuple_BlindedPayInfoBlindedPathZ), "LDKCVec_C2Tuple_BlindedPayInfoBlindedPathZZ Elements");
59915         else
59916                 route_hints_constr.data = NULL;
59917         uint64_t* route_hints_vals = route_hints->elems;
59918         for (size_t l = 0; l < route_hints_constr.datalen; l++) {
59919                 uint64_t route_hints_conv_37 = route_hints_vals[l];
59920                 void* route_hints_conv_37_ptr = untag_ptr(route_hints_conv_37);
59921                 CHECK_ACCESS(route_hints_conv_37_ptr);
59922                 LDKC2Tuple_BlindedPayInfoBlindedPathZ route_hints_conv_37_conv = *(LDKC2Tuple_BlindedPayInfoBlindedPathZ*)(route_hints_conv_37_ptr);
59923                 route_hints_conv_37_conv = C2Tuple_BlindedPayInfoBlindedPathZ_clone((LDKC2Tuple_BlindedPayInfoBlindedPathZ*)untag_ptr(route_hints_conv_37));
59924                 route_hints_constr.data[l] = route_hints_conv_37_conv;
59925         }
59926         FREE(route_hints);
59927         LDKBolt12InvoiceFeatures features_conv;
59928         features_conv.inner = untag_ptr(features);
59929         features_conv.is_owned = ptr_is_owned(features);
59930         CHECK_INNER_FIELD_ACCESS_OR_NULL(features_conv);
59931         features_conv = Bolt12InvoiceFeatures_clone(&features_conv);
59932         LDKPayee *ret_copy = MALLOC(sizeof(LDKPayee), "LDKPayee");
59933         *ret_copy = Payee_blinded(route_hints_constr, features_conv);
59934         uint64_t ret_ref = tag_ptr(ret_copy, true);
59935         return ret_ref;
59936 }
59937
59938 uint64_t  __attribute__((export_name("TS_Payee_clear"))) TS_Payee_clear(int8_tArray node_id, uint64_tArray route_hints, uint64_t features, int32_t final_cltv_expiry_delta) {
59939         LDKPublicKey node_id_ref;
59940         CHECK(node_id->arr_len == 33);
59941         memcpy(node_id_ref.compressed_form, node_id->elems, 33); FREE(node_id);
59942         LDKCVec_RouteHintZ route_hints_constr;
59943         route_hints_constr.datalen = route_hints->arr_len;
59944         if (route_hints_constr.datalen > 0)
59945                 route_hints_constr.data = MALLOC(route_hints_constr.datalen * sizeof(LDKRouteHint), "LDKCVec_RouteHintZ Elements");
59946         else
59947                 route_hints_constr.data = NULL;
59948         uint64_t* route_hints_vals = route_hints->elems;
59949         for (size_t l = 0; l < route_hints_constr.datalen; l++) {
59950                 uint64_t route_hints_conv_11 = route_hints_vals[l];
59951                 LDKRouteHint route_hints_conv_11_conv;
59952                 route_hints_conv_11_conv.inner = untag_ptr(route_hints_conv_11);
59953                 route_hints_conv_11_conv.is_owned = ptr_is_owned(route_hints_conv_11);
59954                 CHECK_INNER_FIELD_ACCESS_OR_NULL(route_hints_conv_11_conv);
59955                 route_hints_conv_11_conv = RouteHint_clone(&route_hints_conv_11_conv);
59956                 route_hints_constr.data[l] = route_hints_conv_11_conv;
59957         }
59958         FREE(route_hints);
59959         LDKBolt11InvoiceFeatures features_conv;
59960         features_conv.inner = untag_ptr(features);
59961         features_conv.is_owned = ptr_is_owned(features);
59962         CHECK_INNER_FIELD_ACCESS_OR_NULL(features_conv);
59963         features_conv = Bolt11InvoiceFeatures_clone(&features_conv);
59964         LDKPayee *ret_copy = MALLOC(sizeof(LDKPayee), "LDKPayee");
59965         *ret_copy = Payee_clear(node_id_ref, route_hints_constr, features_conv, final_cltv_expiry_delta);
59966         uint64_t ret_ref = tag_ptr(ret_copy, true);
59967         return ret_ref;
59968 }
59969
59970 int64_t  __attribute__((export_name("TS_Payee_hash"))) TS_Payee_hash(uint64_t o) {
59971         LDKPayee* o_conv = (LDKPayee*)untag_ptr(o);
59972         int64_t ret_conv = Payee_hash(o_conv);
59973         return ret_conv;
59974 }
59975
59976 jboolean  __attribute__((export_name("TS_Payee_eq"))) TS_Payee_eq(uint64_t a, uint64_t b) {
59977         LDKPayee* a_conv = (LDKPayee*)untag_ptr(a);
59978         LDKPayee* b_conv = (LDKPayee*)untag_ptr(b);
59979         jboolean ret_conv = Payee_eq(a_conv, b_conv);
59980         return ret_conv;
59981 }
59982
59983 void  __attribute__((export_name("TS_RouteHint_free"))) TS_RouteHint_free(uint64_t this_obj) {
59984         LDKRouteHint this_obj_conv;
59985         this_obj_conv.inner = untag_ptr(this_obj);
59986         this_obj_conv.is_owned = ptr_is_owned(this_obj);
59987         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
59988         RouteHint_free(this_obj_conv);
59989 }
59990
59991 uint64_tArray  __attribute__((export_name("TS_RouteHint_get_a"))) TS_RouteHint_get_a(uint64_t this_ptr) {
59992         LDKRouteHint this_ptr_conv;
59993         this_ptr_conv.inner = untag_ptr(this_ptr);
59994         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
59995         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
59996         this_ptr_conv.is_owned = false;
59997         LDKCVec_RouteHintHopZ ret_var = RouteHint_get_a(&this_ptr_conv);
59998         uint64_tArray ret_arr = NULL;
59999         ret_arr = init_uint64_tArray(ret_var.datalen, __LINE__);
60000         uint64_t *ret_arr_ptr = (uint64_t*)(((uint8_t*)ret_arr) + 8);
60001         for (size_t o = 0; o < ret_var.datalen; o++) {
60002                 LDKRouteHintHop ret_conv_14_var = ret_var.data[o];
60003                 uint64_t ret_conv_14_ref = 0;
60004                 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_conv_14_var);
60005                 ret_conv_14_ref = tag_ptr(ret_conv_14_var.inner, ret_conv_14_var.is_owned);
60006                 ret_arr_ptr[o] = ret_conv_14_ref;
60007         }
60008         
60009         FREE(ret_var.data);
60010         return ret_arr;
60011 }
60012
60013 void  __attribute__((export_name("TS_RouteHint_set_a"))) TS_RouteHint_set_a(uint64_t this_ptr, uint64_tArray val) {
60014         LDKRouteHint this_ptr_conv;
60015         this_ptr_conv.inner = untag_ptr(this_ptr);
60016         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
60017         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
60018         this_ptr_conv.is_owned = false;
60019         LDKCVec_RouteHintHopZ val_constr;
60020         val_constr.datalen = val->arr_len;
60021         if (val_constr.datalen > 0)
60022                 val_constr.data = MALLOC(val_constr.datalen * sizeof(LDKRouteHintHop), "LDKCVec_RouteHintHopZ Elements");
60023         else
60024                 val_constr.data = NULL;
60025         uint64_t* val_vals = val->elems;
60026         for (size_t o = 0; o < val_constr.datalen; o++) {
60027                 uint64_t val_conv_14 = val_vals[o];
60028                 LDKRouteHintHop val_conv_14_conv;
60029                 val_conv_14_conv.inner = untag_ptr(val_conv_14);
60030                 val_conv_14_conv.is_owned = ptr_is_owned(val_conv_14);
60031                 CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv_14_conv);
60032                 val_conv_14_conv = RouteHintHop_clone(&val_conv_14_conv);
60033                 val_constr.data[o] = val_conv_14_conv;
60034         }
60035         FREE(val);
60036         RouteHint_set_a(&this_ptr_conv, val_constr);
60037 }
60038
60039 uint64_t  __attribute__((export_name("TS_RouteHint_new"))) TS_RouteHint_new(uint64_tArray a_arg) {
60040         LDKCVec_RouteHintHopZ a_arg_constr;
60041         a_arg_constr.datalen = a_arg->arr_len;
60042         if (a_arg_constr.datalen > 0)
60043                 a_arg_constr.data = MALLOC(a_arg_constr.datalen * sizeof(LDKRouteHintHop), "LDKCVec_RouteHintHopZ Elements");
60044         else
60045                 a_arg_constr.data = NULL;
60046         uint64_t* a_arg_vals = a_arg->elems;
60047         for (size_t o = 0; o < a_arg_constr.datalen; o++) {
60048                 uint64_t a_arg_conv_14 = a_arg_vals[o];
60049                 LDKRouteHintHop a_arg_conv_14_conv;
60050                 a_arg_conv_14_conv.inner = untag_ptr(a_arg_conv_14);
60051                 a_arg_conv_14_conv.is_owned = ptr_is_owned(a_arg_conv_14);
60052                 CHECK_INNER_FIELD_ACCESS_OR_NULL(a_arg_conv_14_conv);
60053                 a_arg_conv_14_conv = RouteHintHop_clone(&a_arg_conv_14_conv);
60054                 a_arg_constr.data[o] = a_arg_conv_14_conv;
60055         }
60056         FREE(a_arg);
60057         LDKRouteHint ret_var = RouteHint_new(a_arg_constr);
60058         uint64_t ret_ref = 0;
60059         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
60060         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
60061         return ret_ref;
60062 }
60063
60064 static inline uint64_t RouteHint_clone_ptr(LDKRouteHint *NONNULL_PTR arg) {
60065         LDKRouteHint ret_var = RouteHint_clone(arg);
60066         uint64_t ret_ref = 0;
60067         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
60068         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
60069         return ret_ref;
60070 }
60071 int64_t  __attribute__((export_name("TS_RouteHint_clone_ptr"))) TS_RouteHint_clone_ptr(uint64_t arg) {
60072         LDKRouteHint arg_conv;
60073         arg_conv.inner = untag_ptr(arg);
60074         arg_conv.is_owned = ptr_is_owned(arg);
60075         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
60076         arg_conv.is_owned = false;
60077         int64_t ret_conv = RouteHint_clone_ptr(&arg_conv);
60078         return ret_conv;
60079 }
60080
60081 uint64_t  __attribute__((export_name("TS_RouteHint_clone"))) TS_RouteHint_clone(uint64_t orig) {
60082         LDKRouteHint orig_conv;
60083         orig_conv.inner = untag_ptr(orig);
60084         orig_conv.is_owned = ptr_is_owned(orig);
60085         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
60086         orig_conv.is_owned = false;
60087         LDKRouteHint ret_var = RouteHint_clone(&orig_conv);
60088         uint64_t ret_ref = 0;
60089         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
60090         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
60091         return ret_ref;
60092 }
60093
60094 int64_t  __attribute__((export_name("TS_RouteHint_hash"))) TS_RouteHint_hash(uint64_t o) {
60095         LDKRouteHint o_conv;
60096         o_conv.inner = untag_ptr(o);
60097         o_conv.is_owned = ptr_is_owned(o);
60098         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
60099         o_conv.is_owned = false;
60100         int64_t ret_conv = RouteHint_hash(&o_conv);
60101         return ret_conv;
60102 }
60103
60104 jboolean  __attribute__((export_name("TS_RouteHint_eq"))) TS_RouteHint_eq(uint64_t a, uint64_t b) {
60105         LDKRouteHint a_conv;
60106         a_conv.inner = untag_ptr(a);
60107         a_conv.is_owned = ptr_is_owned(a);
60108         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
60109         a_conv.is_owned = false;
60110         LDKRouteHint b_conv;
60111         b_conv.inner = untag_ptr(b);
60112         b_conv.is_owned = ptr_is_owned(b);
60113         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
60114         b_conv.is_owned = false;
60115         jboolean ret_conv = RouteHint_eq(&a_conv, &b_conv);
60116         return ret_conv;
60117 }
60118
60119 int8_tArray  __attribute__((export_name("TS_RouteHint_write"))) TS_RouteHint_write(uint64_t obj) {
60120         LDKRouteHint obj_conv;
60121         obj_conv.inner = untag_ptr(obj);
60122         obj_conv.is_owned = ptr_is_owned(obj);
60123         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
60124         obj_conv.is_owned = false;
60125         LDKCVec_u8Z ret_var = RouteHint_write(&obj_conv);
60126         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
60127         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
60128         CVec_u8Z_free(ret_var);
60129         return ret_arr;
60130 }
60131
60132 uint64_t  __attribute__((export_name("TS_RouteHint_read"))) TS_RouteHint_read(int8_tArray ser) {
60133         LDKu8slice ser_ref;
60134         ser_ref.datalen = ser->arr_len;
60135         ser_ref.data = ser->elems;
60136         LDKCResult_RouteHintDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteHintDecodeErrorZ), "LDKCResult_RouteHintDecodeErrorZ");
60137         *ret_conv = RouteHint_read(ser_ref);
60138         FREE(ser);
60139         return tag_ptr(ret_conv, true);
60140 }
60141
60142 void  __attribute__((export_name("TS_RouteHintHop_free"))) TS_RouteHintHop_free(uint64_t this_obj) {
60143         LDKRouteHintHop this_obj_conv;
60144         this_obj_conv.inner = untag_ptr(this_obj);
60145         this_obj_conv.is_owned = ptr_is_owned(this_obj);
60146         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
60147         RouteHintHop_free(this_obj_conv);
60148 }
60149
60150 int8_tArray  __attribute__((export_name("TS_RouteHintHop_get_src_node_id"))) TS_RouteHintHop_get_src_node_id(uint64_t this_ptr) {
60151         LDKRouteHintHop this_ptr_conv;
60152         this_ptr_conv.inner = untag_ptr(this_ptr);
60153         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
60154         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
60155         this_ptr_conv.is_owned = false;
60156         int8_tArray ret_arr = init_int8_tArray(33, __LINE__);
60157         memcpy(ret_arr->elems, RouteHintHop_get_src_node_id(&this_ptr_conv).compressed_form, 33);
60158         return ret_arr;
60159 }
60160
60161 void  __attribute__((export_name("TS_RouteHintHop_set_src_node_id"))) TS_RouteHintHop_set_src_node_id(uint64_t this_ptr, int8_tArray val) {
60162         LDKRouteHintHop this_ptr_conv;
60163         this_ptr_conv.inner = untag_ptr(this_ptr);
60164         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
60165         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
60166         this_ptr_conv.is_owned = false;
60167         LDKPublicKey val_ref;
60168         CHECK(val->arr_len == 33);
60169         memcpy(val_ref.compressed_form, val->elems, 33); FREE(val);
60170         RouteHintHop_set_src_node_id(&this_ptr_conv, val_ref);
60171 }
60172
60173 int64_t  __attribute__((export_name("TS_RouteHintHop_get_short_channel_id"))) TS_RouteHintHop_get_short_channel_id(uint64_t this_ptr) {
60174         LDKRouteHintHop this_ptr_conv;
60175         this_ptr_conv.inner = untag_ptr(this_ptr);
60176         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
60177         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
60178         this_ptr_conv.is_owned = false;
60179         int64_t ret_conv = RouteHintHop_get_short_channel_id(&this_ptr_conv);
60180         return ret_conv;
60181 }
60182
60183 void  __attribute__((export_name("TS_RouteHintHop_set_short_channel_id"))) TS_RouteHintHop_set_short_channel_id(uint64_t this_ptr, int64_t val) {
60184         LDKRouteHintHop this_ptr_conv;
60185         this_ptr_conv.inner = untag_ptr(this_ptr);
60186         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
60187         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
60188         this_ptr_conv.is_owned = false;
60189         RouteHintHop_set_short_channel_id(&this_ptr_conv, val);
60190 }
60191
60192 uint64_t  __attribute__((export_name("TS_RouteHintHop_get_fees"))) TS_RouteHintHop_get_fees(uint64_t this_ptr) {
60193         LDKRouteHintHop this_ptr_conv;
60194         this_ptr_conv.inner = untag_ptr(this_ptr);
60195         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
60196         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
60197         this_ptr_conv.is_owned = false;
60198         LDKRoutingFees ret_var = RouteHintHop_get_fees(&this_ptr_conv);
60199         uint64_t ret_ref = 0;
60200         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
60201         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
60202         return ret_ref;
60203 }
60204
60205 void  __attribute__((export_name("TS_RouteHintHop_set_fees"))) TS_RouteHintHop_set_fees(uint64_t this_ptr, uint64_t val) {
60206         LDKRouteHintHop this_ptr_conv;
60207         this_ptr_conv.inner = untag_ptr(this_ptr);
60208         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
60209         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
60210         this_ptr_conv.is_owned = false;
60211         LDKRoutingFees val_conv;
60212         val_conv.inner = untag_ptr(val);
60213         val_conv.is_owned = ptr_is_owned(val);
60214         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
60215         val_conv = RoutingFees_clone(&val_conv);
60216         RouteHintHop_set_fees(&this_ptr_conv, val_conv);
60217 }
60218
60219 int16_t  __attribute__((export_name("TS_RouteHintHop_get_cltv_expiry_delta"))) TS_RouteHintHop_get_cltv_expiry_delta(uint64_t this_ptr) {
60220         LDKRouteHintHop this_ptr_conv;
60221         this_ptr_conv.inner = untag_ptr(this_ptr);
60222         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
60223         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
60224         this_ptr_conv.is_owned = false;
60225         int16_t ret_conv = RouteHintHop_get_cltv_expiry_delta(&this_ptr_conv);
60226         return ret_conv;
60227 }
60228
60229 void  __attribute__((export_name("TS_RouteHintHop_set_cltv_expiry_delta"))) TS_RouteHintHop_set_cltv_expiry_delta(uint64_t this_ptr, int16_t val) {
60230         LDKRouteHintHop this_ptr_conv;
60231         this_ptr_conv.inner = untag_ptr(this_ptr);
60232         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
60233         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
60234         this_ptr_conv.is_owned = false;
60235         RouteHintHop_set_cltv_expiry_delta(&this_ptr_conv, val);
60236 }
60237
60238 uint64_t  __attribute__((export_name("TS_RouteHintHop_get_htlc_minimum_msat"))) TS_RouteHintHop_get_htlc_minimum_msat(uint64_t this_ptr) {
60239         LDKRouteHintHop this_ptr_conv;
60240         this_ptr_conv.inner = untag_ptr(this_ptr);
60241         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
60242         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
60243         this_ptr_conv.is_owned = false;
60244         LDKCOption_u64Z *ret_copy = MALLOC(sizeof(LDKCOption_u64Z), "LDKCOption_u64Z");
60245         *ret_copy = RouteHintHop_get_htlc_minimum_msat(&this_ptr_conv);
60246         uint64_t ret_ref = tag_ptr(ret_copy, true);
60247         return ret_ref;
60248 }
60249
60250 void  __attribute__((export_name("TS_RouteHintHop_set_htlc_minimum_msat"))) TS_RouteHintHop_set_htlc_minimum_msat(uint64_t this_ptr, uint64_t val) {
60251         LDKRouteHintHop this_ptr_conv;
60252         this_ptr_conv.inner = untag_ptr(this_ptr);
60253         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
60254         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
60255         this_ptr_conv.is_owned = false;
60256         void* val_ptr = untag_ptr(val);
60257         CHECK_ACCESS(val_ptr);
60258         LDKCOption_u64Z val_conv = *(LDKCOption_u64Z*)(val_ptr);
60259         val_conv = COption_u64Z_clone((LDKCOption_u64Z*)untag_ptr(val));
60260         RouteHintHop_set_htlc_minimum_msat(&this_ptr_conv, val_conv);
60261 }
60262
60263 uint64_t  __attribute__((export_name("TS_RouteHintHop_get_htlc_maximum_msat"))) TS_RouteHintHop_get_htlc_maximum_msat(uint64_t this_ptr) {
60264         LDKRouteHintHop this_ptr_conv;
60265         this_ptr_conv.inner = untag_ptr(this_ptr);
60266         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
60267         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
60268         this_ptr_conv.is_owned = false;
60269         LDKCOption_u64Z *ret_copy = MALLOC(sizeof(LDKCOption_u64Z), "LDKCOption_u64Z");
60270         *ret_copy = RouteHintHop_get_htlc_maximum_msat(&this_ptr_conv);
60271         uint64_t ret_ref = tag_ptr(ret_copy, true);
60272         return ret_ref;
60273 }
60274
60275 void  __attribute__((export_name("TS_RouteHintHop_set_htlc_maximum_msat"))) TS_RouteHintHop_set_htlc_maximum_msat(uint64_t this_ptr, uint64_t val) {
60276         LDKRouteHintHop this_ptr_conv;
60277         this_ptr_conv.inner = untag_ptr(this_ptr);
60278         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
60279         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
60280         this_ptr_conv.is_owned = false;
60281         void* val_ptr = untag_ptr(val);
60282         CHECK_ACCESS(val_ptr);
60283         LDKCOption_u64Z val_conv = *(LDKCOption_u64Z*)(val_ptr);
60284         val_conv = COption_u64Z_clone((LDKCOption_u64Z*)untag_ptr(val));
60285         RouteHintHop_set_htlc_maximum_msat(&this_ptr_conv, val_conv);
60286 }
60287
60288 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) {
60289         LDKPublicKey src_node_id_arg_ref;
60290         CHECK(src_node_id_arg->arr_len == 33);
60291         memcpy(src_node_id_arg_ref.compressed_form, src_node_id_arg->elems, 33); FREE(src_node_id_arg);
60292         LDKRoutingFees fees_arg_conv;
60293         fees_arg_conv.inner = untag_ptr(fees_arg);
60294         fees_arg_conv.is_owned = ptr_is_owned(fees_arg);
60295         CHECK_INNER_FIELD_ACCESS_OR_NULL(fees_arg_conv);
60296         fees_arg_conv = RoutingFees_clone(&fees_arg_conv);
60297         void* htlc_minimum_msat_arg_ptr = untag_ptr(htlc_minimum_msat_arg);
60298         CHECK_ACCESS(htlc_minimum_msat_arg_ptr);
60299         LDKCOption_u64Z htlc_minimum_msat_arg_conv = *(LDKCOption_u64Z*)(htlc_minimum_msat_arg_ptr);
60300         htlc_minimum_msat_arg_conv = COption_u64Z_clone((LDKCOption_u64Z*)untag_ptr(htlc_minimum_msat_arg));
60301         void* htlc_maximum_msat_arg_ptr = untag_ptr(htlc_maximum_msat_arg);
60302         CHECK_ACCESS(htlc_maximum_msat_arg_ptr);
60303         LDKCOption_u64Z htlc_maximum_msat_arg_conv = *(LDKCOption_u64Z*)(htlc_maximum_msat_arg_ptr);
60304         htlc_maximum_msat_arg_conv = COption_u64Z_clone((LDKCOption_u64Z*)untag_ptr(htlc_maximum_msat_arg));
60305         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);
60306         uint64_t ret_ref = 0;
60307         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
60308         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
60309         return ret_ref;
60310 }
60311
60312 static inline uint64_t RouteHintHop_clone_ptr(LDKRouteHintHop *NONNULL_PTR arg) {
60313         LDKRouteHintHop ret_var = RouteHintHop_clone(arg);
60314         uint64_t ret_ref = 0;
60315         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
60316         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
60317         return ret_ref;
60318 }
60319 int64_t  __attribute__((export_name("TS_RouteHintHop_clone_ptr"))) TS_RouteHintHop_clone_ptr(uint64_t arg) {
60320         LDKRouteHintHop arg_conv;
60321         arg_conv.inner = untag_ptr(arg);
60322         arg_conv.is_owned = ptr_is_owned(arg);
60323         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
60324         arg_conv.is_owned = false;
60325         int64_t ret_conv = RouteHintHop_clone_ptr(&arg_conv);
60326         return ret_conv;
60327 }
60328
60329 uint64_t  __attribute__((export_name("TS_RouteHintHop_clone"))) TS_RouteHintHop_clone(uint64_t orig) {
60330         LDKRouteHintHop orig_conv;
60331         orig_conv.inner = untag_ptr(orig);
60332         orig_conv.is_owned = ptr_is_owned(orig);
60333         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
60334         orig_conv.is_owned = false;
60335         LDKRouteHintHop ret_var = RouteHintHop_clone(&orig_conv);
60336         uint64_t ret_ref = 0;
60337         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
60338         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
60339         return ret_ref;
60340 }
60341
60342 int64_t  __attribute__((export_name("TS_RouteHintHop_hash"))) TS_RouteHintHop_hash(uint64_t o) {
60343         LDKRouteHintHop o_conv;
60344         o_conv.inner = untag_ptr(o);
60345         o_conv.is_owned = ptr_is_owned(o);
60346         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
60347         o_conv.is_owned = false;
60348         int64_t ret_conv = RouteHintHop_hash(&o_conv);
60349         return ret_conv;
60350 }
60351
60352 jboolean  __attribute__((export_name("TS_RouteHintHop_eq"))) TS_RouteHintHop_eq(uint64_t a, uint64_t b) {
60353         LDKRouteHintHop a_conv;
60354         a_conv.inner = untag_ptr(a);
60355         a_conv.is_owned = ptr_is_owned(a);
60356         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
60357         a_conv.is_owned = false;
60358         LDKRouteHintHop b_conv;
60359         b_conv.inner = untag_ptr(b);
60360         b_conv.is_owned = ptr_is_owned(b);
60361         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
60362         b_conv.is_owned = false;
60363         jboolean ret_conv = RouteHintHop_eq(&a_conv, &b_conv);
60364         return ret_conv;
60365 }
60366
60367 int8_tArray  __attribute__((export_name("TS_RouteHintHop_write"))) TS_RouteHintHop_write(uint64_t obj) {
60368         LDKRouteHintHop obj_conv;
60369         obj_conv.inner = untag_ptr(obj);
60370         obj_conv.is_owned = ptr_is_owned(obj);
60371         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
60372         obj_conv.is_owned = false;
60373         LDKCVec_u8Z ret_var = RouteHintHop_write(&obj_conv);
60374         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
60375         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
60376         CVec_u8Z_free(ret_var);
60377         return ret_arr;
60378 }
60379
60380 uint64_t  __attribute__((export_name("TS_RouteHintHop_read"))) TS_RouteHintHop_read(int8_tArray ser) {
60381         LDKu8slice ser_ref;
60382         ser_ref.datalen = ser->arr_len;
60383         ser_ref.data = ser->elems;
60384         LDKCResult_RouteHintHopDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteHintHopDecodeErrorZ), "LDKCResult_RouteHintHopDecodeErrorZ");
60385         *ret_conv = RouteHintHop_read(ser_ref);
60386         FREE(ser);
60387         return tag_ptr(ret_conv, true);
60388 }
60389
60390 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, uint64_t score_params, int8_tArray random_seed_bytes) {
60391         LDKPublicKey our_node_pubkey_ref;
60392         CHECK(our_node_pubkey->arr_len == 33);
60393         memcpy(our_node_pubkey_ref.compressed_form, our_node_pubkey->elems, 33); FREE(our_node_pubkey);
60394         LDKRouteParameters route_params_conv;
60395         route_params_conv.inner = untag_ptr(route_params);
60396         route_params_conv.is_owned = ptr_is_owned(route_params);
60397         CHECK_INNER_FIELD_ACCESS_OR_NULL(route_params_conv);
60398         route_params_conv.is_owned = false;
60399         LDKNetworkGraph network_graph_conv;
60400         network_graph_conv.inner = untag_ptr(network_graph);
60401         network_graph_conv.is_owned = ptr_is_owned(network_graph);
60402         CHECK_INNER_FIELD_ACCESS_OR_NULL(network_graph_conv);
60403         network_graph_conv.is_owned = false;
60404         LDKCVec_ChannelDetailsZ first_hops_constr;
60405         LDKCVec_ChannelDetailsZ *first_hops_ptr = NULL;
60406         if (first_hops != 0) {
60407                 first_hops_constr.datalen = first_hops->arr_len;
60408                 if (first_hops_constr.datalen > 0)
60409                         first_hops_constr.data = MALLOC(first_hops_constr.datalen * sizeof(LDKChannelDetails), "LDKCVec_ChannelDetailsZ Elements");
60410                 else
60411                         first_hops_constr.data = NULL;
60412                 uint64_t* first_hops_vals = first_hops->elems;
60413                 for (size_t q = 0; q < first_hops_constr.datalen; q++) {
60414                         uint64_t first_hops_conv_16 = first_hops_vals[q];
60415                         LDKChannelDetails first_hops_conv_16_conv;
60416                         first_hops_conv_16_conv.inner = untag_ptr(first_hops_conv_16);
60417                         first_hops_conv_16_conv.is_owned = ptr_is_owned(first_hops_conv_16);
60418                         CHECK_INNER_FIELD_ACCESS_OR_NULL(first_hops_conv_16_conv);
60419                         first_hops_conv_16_conv.is_owned = false;
60420                         first_hops_constr.data[q] = first_hops_conv_16_conv;
60421                 }
60422                 FREE(first_hops);
60423                 first_hops_ptr = &first_hops_constr;
60424         }
60425         void* logger_ptr = untag_ptr(logger);
60426         CHECK_ACCESS(logger_ptr);
60427         LDKLogger logger_conv = *(LDKLogger*)(logger_ptr);
60428         if (logger_conv.free == LDKLogger_JCalls_free) {
60429                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
60430                 LDKLogger_JCalls_cloned(&logger_conv);
60431         }
60432         void* scorer_ptr = untag_ptr(scorer);
60433         if (ptr_is_owned(scorer)) { CHECK_ACCESS(scorer_ptr); }
60434         LDKScoreLookUp* scorer_conv = (LDKScoreLookUp*)scorer_ptr;
60435         LDKProbabilisticScoringFeeParameters score_params_conv;
60436         score_params_conv.inner = untag_ptr(score_params);
60437         score_params_conv.is_owned = ptr_is_owned(score_params);
60438         CHECK_INNER_FIELD_ACCESS_OR_NULL(score_params_conv);
60439         score_params_conv.is_owned = false;
60440         uint8_t random_seed_bytes_arr[32];
60441         CHECK(random_seed_bytes->arr_len == 32);
60442         memcpy(random_seed_bytes_arr, random_seed_bytes->elems, 32); FREE(random_seed_bytes);
60443         uint8_t (*random_seed_bytes_ref)[32] = &random_seed_bytes_arr;
60444         LDKCResult_RouteLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteLightningErrorZ), "LDKCResult_RouteLightningErrorZ");
60445         *ret_conv = find_route(our_node_pubkey_ref, &route_params_conv, &network_graph_conv, first_hops_ptr, logger_conv, scorer_conv, &score_params_conv, random_seed_bytes_ref);
60446         if (first_hops_ptr != NULL) { FREE(first_hops_constr.data); }
60447         return tag_ptr(ret_conv, true);
60448 }
60449
60450 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) {
60451         LDKPublicKey our_node_pubkey_ref;
60452         CHECK(our_node_pubkey->arr_len == 33);
60453         memcpy(our_node_pubkey_ref.compressed_form, our_node_pubkey->elems, 33); FREE(our_node_pubkey);
60454         LDKCVec_PublicKeyZ hops_constr;
60455         hops_constr.datalen = hops->arr_len;
60456         if (hops_constr.datalen > 0)
60457                 hops_constr.data = MALLOC(hops_constr.datalen * sizeof(LDKPublicKey), "LDKCVec_PublicKeyZ Elements");
60458         else
60459                 hops_constr.data = NULL;
60460         int8_tArray* hops_vals = (void*) hops->elems;
60461         for (size_t m = 0; m < hops_constr.datalen; m++) {
60462                 int8_tArray hops_conv_12 = hops_vals[m];
60463                 LDKPublicKey hops_conv_12_ref;
60464                 CHECK(hops_conv_12->arr_len == 33);
60465                 memcpy(hops_conv_12_ref.compressed_form, hops_conv_12->elems, 33); FREE(hops_conv_12);
60466                 hops_constr.data[m] = hops_conv_12_ref;
60467         }
60468         FREE(hops);
60469         LDKRouteParameters route_params_conv;
60470         route_params_conv.inner = untag_ptr(route_params);
60471         route_params_conv.is_owned = ptr_is_owned(route_params);
60472         CHECK_INNER_FIELD_ACCESS_OR_NULL(route_params_conv);
60473         route_params_conv.is_owned = false;
60474         LDKNetworkGraph network_graph_conv;
60475         network_graph_conv.inner = untag_ptr(network_graph);
60476         network_graph_conv.is_owned = ptr_is_owned(network_graph);
60477         CHECK_INNER_FIELD_ACCESS_OR_NULL(network_graph_conv);
60478         network_graph_conv.is_owned = false;
60479         void* logger_ptr = untag_ptr(logger);
60480         CHECK_ACCESS(logger_ptr);
60481         LDKLogger logger_conv = *(LDKLogger*)(logger_ptr);
60482         if (logger_conv.free == LDKLogger_JCalls_free) {
60483                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
60484                 LDKLogger_JCalls_cloned(&logger_conv);
60485         }
60486         uint8_t random_seed_bytes_arr[32];
60487         CHECK(random_seed_bytes->arr_len == 32);
60488         memcpy(random_seed_bytes_arr, random_seed_bytes->elems, 32); FREE(random_seed_bytes);
60489         uint8_t (*random_seed_bytes_ref)[32] = &random_seed_bytes_arr;
60490         LDKCResult_RouteLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteLightningErrorZ), "LDKCResult_RouteLightningErrorZ");
60491         *ret_conv = build_route_from_hops(our_node_pubkey_ref, hops_constr, &route_params_conv, &network_graph_conv, logger_conv, random_seed_bytes_ref);
60492         return tag_ptr(ret_conv, true);
60493 }
60494
60495 void  __attribute__((export_name("TS_ScoreLookUp_free"))) TS_ScoreLookUp_free(uint64_t this_ptr) {
60496         if (!ptr_is_owned(this_ptr)) return;
60497         void* this_ptr_ptr = untag_ptr(this_ptr);
60498         CHECK_ACCESS(this_ptr_ptr);
60499         LDKScoreLookUp this_ptr_conv = *(LDKScoreLookUp*)(this_ptr_ptr);
60500         FREE(untag_ptr(this_ptr));
60501         ScoreLookUp_free(this_ptr_conv);
60502 }
60503
60504 void  __attribute__((export_name("TS_ScoreUpdate_free"))) TS_ScoreUpdate_free(uint64_t this_ptr) {
60505         if (!ptr_is_owned(this_ptr)) return;
60506         void* this_ptr_ptr = untag_ptr(this_ptr);
60507         CHECK_ACCESS(this_ptr_ptr);
60508         LDKScoreUpdate this_ptr_conv = *(LDKScoreUpdate*)(this_ptr_ptr);
60509         FREE(untag_ptr(this_ptr));
60510         ScoreUpdate_free(this_ptr_conv);
60511 }
60512
60513 void  __attribute__((export_name("TS_Score_free"))) TS_Score_free(uint64_t this_ptr) {
60514         if (!ptr_is_owned(this_ptr)) return;
60515         void* this_ptr_ptr = untag_ptr(this_ptr);
60516         CHECK_ACCESS(this_ptr_ptr);
60517         LDKScore this_ptr_conv = *(LDKScore*)(this_ptr_ptr);
60518         FREE(untag_ptr(this_ptr));
60519         Score_free(this_ptr_conv);
60520 }
60521
60522 void  __attribute__((export_name("TS_LockableScore_free"))) TS_LockableScore_free(uint64_t this_ptr) {
60523         if (!ptr_is_owned(this_ptr)) return;
60524         void* this_ptr_ptr = untag_ptr(this_ptr);
60525         CHECK_ACCESS(this_ptr_ptr);
60526         LDKLockableScore this_ptr_conv = *(LDKLockableScore*)(this_ptr_ptr);
60527         FREE(untag_ptr(this_ptr));
60528         LockableScore_free(this_ptr_conv);
60529 }
60530
60531 void  __attribute__((export_name("TS_WriteableScore_free"))) TS_WriteableScore_free(uint64_t this_ptr) {
60532         if (!ptr_is_owned(this_ptr)) return;
60533         void* this_ptr_ptr = untag_ptr(this_ptr);
60534         CHECK_ACCESS(this_ptr_ptr);
60535         LDKWriteableScore this_ptr_conv = *(LDKWriteableScore*)(this_ptr_ptr);
60536         FREE(untag_ptr(this_ptr));
60537         WriteableScore_free(this_ptr_conv);
60538 }
60539
60540 void  __attribute__((export_name("TS_MultiThreadedLockableScore_free"))) TS_MultiThreadedLockableScore_free(uint64_t this_obj) {
60541         LDKMultiThreadedLockableScore this_obj_conv;
60542         this_obj_conv.inner = untag_ptr(this_obj);
60543         this_obj_conv.is_owned = ptr_is_owned(this_obj);
60544         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
60545         MultiThreadedLockableScore_free(this_obj_conv);
60546 }
60547
60548 uint64_t  __attribute__((export_name("TS_MultiThreadedLockableScore_as_LockableScore"))) TS_MultiThreadedLockableScore_as_LockableScore(uint64_t this_arg) {
60549         LDKMultiThreadedLockableScore this_arg_conv;
60550         this_arg_conv.inner = untag_ptr(this_arg);
60551         this_arg_conv.is_owned = ptr_is_owned(this_arg);
60552         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
60553         this_arg_conv.is_owned = false;
60554         LDKLockableScore* ret_ret = MALLOC(sizeof(LDKLockableScore), "LDKLockableScore");
60555         *ret_ret = MultiThreadedLockableScore_as_LockableScore(&this_arg_conv);
60556         return tag_ptr(ret_ret, true);
60557 }
60558
60559 int8_tArray  __attribute__((export_name("TS_MultiThreadedLockableScore_write"))) TS_MultiThreadedLockableScore_write(uint64_t obj) {
60560         LDKMultiThreadedLockableScore obj_conv;
60561         obj_conv.inner = untag_ptr(obj);
60562         obj_conv.is_owned = ptr_is_owned(obj);
60563         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
60564         obj_conv.is_owned = false;
60565         LDKCVec_u8Z ret_var = MultiThreadedLockableScore_write(&obj_conv);
60566         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
60567         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
60568         CVec_u8Z_free(ret_var);
60569         return ret_arr;
60570 }
60571
60572 uint64_t  __attribute__((export_name("TS_MultiThreadedLockableScore_as_WriteableScore"))) TS_MultiThreadedLockableScore_as_WriteableScore(uint64_t this_arg) {
60573         LDKMultiThreadedLockableScore this_arg_conv;
60574         this_arg_conv.inner = untag_ptr(this_arg);
60575         this_arg_conv.is_owned = ptr_is_owned(this_arg);
60576         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
60577         this_arg_conv.is_owned = false;
60578         LDKWriteableScore* ret_ret = MALLOC(sizeof(LDKWriteableScore), "LDKWriteableScore");
60579         *ret_ret = MultiThreadedLockableScore_as_WriteableScore(&this_arg_conv);
60580         return tag_ptr(ret_ret, true);
60581 }
60582
60583 uint64_t  __attribute__((export_name("TS_MultiThreadedLockableScore_new"))) TS_MultiThreadedLockableScore_new(uint64_t score) {
60584         void* score_ptr = untag_ptr(score);
60585         CHECK_ACCESS(score_ptr);
60586         LDKScore score_conv = *(LDKScore*)(score_ptr);
60587         if (score_conv.free == LDKScore_JCalls_free) {
60588                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
60589                 LDKScore_JCalls_cloned(&score_conv);
60590         }
60591         LDKMultiThreadedLockableScore ret_var = MultiThreadedLockableScore_new(score_conv);
60592         uint64_t ret_ref = 0;
60593         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
60594         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
60595         return ret_ref;
60596 }
60597
60598 void  __attribute__((export_name("TS_MultiThreadedScoreLockRead_free"))) TS_MultiThreadedScoreLockRead_free(uint64_t this_obj) {
60599         LDKMultiThreadedScoreLockRead this_obj_conv;
60600         this_obj_conv.inner = untag_ptr(this_obj);
60601         this_obj_conv.is_owned = ptr_is_owned(this_obj);
60602         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
60603         MultiThreadedScoreLockRead_free(this_obj_conv);
60604 }
60605
60606 void  __attribute__((export_name("TS_MultiThreadedScoreLockWrite_free"))) TS_MultiThreadedScoreLockWrite_free(uint64_t this_obj) {
60607         LDKMultiThreadedScoreLockWrite this_obj_conv;
60608         this_obj_conv.inner = untag_ptr(this_obj);
60609         this_obj_conv.is_owned = ptr_is_owned(this_obj);
60610         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
60611         MultiThreadedScoreLockWrite_free(this_obj_conv);
60612 }
60613
60614 uint64_t  __attribute__((export_name("TS_MultiThreadedScoreLockRead_as_ScoreLookUp"))) TS_MultiThreadedScoreLockRead_as_ScoreLookUp(uint64_t this_arg) {
60615         LDKMultiThreadedScoreLockRead this_arg_conv;
60616         this_arg_conv.inner = untag_ptr(this_arg);
60617         this_arg_conv.is_owned = ptr_is_owned(this_arg);
60618         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
60619         this_arg_conv.is_owned = false;
60620         LDKScoreLookUp* ret_ret = MALLOC(sizeof(LDKScoreLookUp), "LDKScoreLookUp");
60621         *ret_ret = MultiThreadedScoreLockRead_as_ScoreLookUp(&this_arg_conv);
60622         return tag_ptr(ret_ret, true);
60623 }
60624
60625 int8_tArray  __attribute__((export_name("TS_MultiThreadedScoreLockWrite_write"))) TS_MultiThreadedScoreLockWrite_write(uint64_t obj) {
60626         LDKMultiThreadedScoreLockWrite obj_conv;
60627         obj_conv.inner = untag_ptr(obj);
60628         obj_conv.is_owned = ptr_is_owned(obj);
60629         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
60630         obj_conv.is_owned = false;
60631         LDKCVec_u8Z ret_var = MultiThreadedScoreLockWrite_write(&obj_conv);
60632         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
60633         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
60634         CVec_u8Z_free(ret_var);
60635         return ret_arr;
60636 }
60637
60638 uint64_t  __attribute__((export_name("TS_MultiThreadedScoreLockWrite_as_ScoreUpdate"))) TS_MultiThreadedScoreLockWrite_as_ScoreUpdate(uint64_t this_arg) {
60639         LDKMultiThreadedScoreLockWrite this_arg_conv;
60640         this_arg_conv.inner = untag_ptr(this_arg);
60641         this_arg_conv.is_owned = ptr_is_owned(this_arg);
60642         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
60643         this_arg_conv.is_owned = false;
60644         LDKScoreUpdate* ret_ret = MALLOC(sizeof(LDKScoreUpdate), "LDKScoreUpdate");
60645         *ret_ret = MultiThreadedScoreLockWrite_as_ScoreUpdate(&this_arg_conv);
60646         return tag_ptr(ret_ret, true);
60647 }
60648
60649 void  __attribute__((export_name("TS_ChannelUsage_free"))) TS_ChannelUsage_free(uint64_t this_obj) {
60650         LDKChannelUsage this_obj_conv;
60651         this_obj_conv.inner = untag_ptr(this_obj);
60652         this_obj_conv.is_owned = ptr_is_owned(this_obj);
60653         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
60654         ChannelUsage_free(this_obj_conv);
60655 }
60656
60657 int64_t  __attribute__((export_name("TS_ChannelUsage_get_amount_msat"))) TS_ChannelUsage_get_amount_msat(uint64_t this_ptr) {
60658         LDKChannelUsage this_ptr_conv;
60659         this_ptr_conv.inner = untag_ptr(this_ptr);
60660         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
60661         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
60662         this_ptr_conv.is_owned = false;
60663         int64_t ret_conv = ChannelUsage_get_amount_msat(&this_ptr_conv);
60664         return ret_conv;
60665 }
60666
60667 void  __attribute__((export_name("TS_ChannelUsage_set_amount_msat"))) TS_ChannelUsage_set_amount_msat(uint64_t this_ptr, int64_t val) {
60668         LDKChannelUsage this_ptr_conv;
60669         this_ptr_conv.inner = untag_ptr(this_ptr);
60670         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
60671         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
60672         this_ptr_conv.is_owned = false;
60673         ChannelUsage_set_amount_msat(&this_ptr_conv, val);
60674 }
60675
60676 int64_t  __attribute__((export_name("TS_ChannelUsage_get_inflight_htlc_msat"))) TS_ChannelUsage_get_inflight_htlc_msat(uint64_t this_ptr) {
60677         LDKChannelUsage this_ptr_conv;
60678         this_ptr_conv.inner = untag_ptr(this_ptr);
60679         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
60680         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
60681         this_ptr_conv.is_owned = false;
60682         int64_t ret_conv = ChannelUsage_get_inflight_htlc_msat(&this_ptr_conv);
60683         return ret_conv;
60684 }
60685
60686 void  __attribute__((export_name("TS_ChannelUsage_set_inflight_htlc_msat"))) TS_ChannelUsage_set_inflight_htlc_msat(uint64_t this_ptr, int64_t val) {
60687         LDKChannelUsage this_ptr_conv;
60688         this_ptr_conv.inner = untag_ptr(this_ptr);
60689         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
60690         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
60691         this_ptr_conv.is_owned = false;
60692         ChannelUsage_set_inflight_htlc_msat(&this_ptr_conv, val);
60693 }
60694
60695 uint64_t  __attribute__((export_name("TS_ChannelUsage_get_effective_capacity"))) TS_ChannelUsage_get_effective_capacity(uint64_t this_ptr) {
60696         LDKChannelUsage this_ptr_conv;
60697         this_ptr_conv.inner = untag_ptr(this_ptr);
60698         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
60699         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
60700         this_ptr_conv.is_owned = false;
60701         LDKEffectiveCapacity *ret_copy = MALLOC(sizeof(LDKEffectiveCapacity), "LDKEffectiveCapacity");
60702         *ret_copy = ChannelUsage_get_effective_capacity(&this_ptr_conv);
60703         uint64_t ret_ref = tag_ptr(ret_copy, true);
60704         return ret_ref;
60705 }
60706
60707 void  __attribute__((export_name("TS_ChannelUsage_set_effective_capacity"))) TS_ChannelUsage_set_effective_capacity(uint64_t this_ptr, uint64_t val) {
60708         LDKChannelUsage this_ptr_conv;
60709         this_ptr_conv.inner = untag_ptr(this_ptr);
60710         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
60711         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
60712         this_ptr_conv.is_owned = false;
60713         void* val_ptr = untag_ptr(val);
60714         CHECK_ACCESS(val_ptr);
60715         LDKEffectiveCapacity val_conv = *(LDKEffectiveCapacity*)(val_ptr);
60716         val_conv = EffectiveCapacity_clone((LDKEffectiveCapacity*)untag_ptr(val));
60717         ChannelUsage_set_effective_capacity(&this_ptr_conv, val_conv);
60718 }
60719
60720 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) {
60721         void* effective_capacity_arg_ptr = untag_ptr(effective_capacity_arg);
60722         CHECK_ACCESS(effective_capacity_arg_ptr);
60723         LDKEffectiveCapacity effective_capacity_arg_conv = *(LDKEffectiveCapacity*)(effective_capacity_arg_ptr);
60724         effective_capacity_arg_conv = EffectiveCapacity_clone((LDKEffectiveCapacity*)untag_ptr(effective_capacity_arg));
60725         LDKChannelUsage ret_var = ChannelUsage_new(amount_msat_arg, inflight_htlc_msat_arg, effective_capacity_arg_conv);
60726         uint64_t ret_ref = 0;
60727         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
60728         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
60729         return ret_ref;
60730 }
60731
60732 static inline uint64_t ChannelUsage_clone_ptr(LDKChannelUsage *NONNULL_PTR arg) {
60733         LDKChannelUsage ret_var = ChannelUsage_clone(arg);
60734         uint64_t ret_ref = 0;
60735         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
60736         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
60737         return ret_ref;
60738 }
60739 int64_t  __attribute__((export_name("TS_ChannelUsage_clone_ptr"))) TS_ChannelUsage_clone_ptr(uint64_t arg) {
60740         LDKChannelUsage arg_conv;
60741         arg_conv.inner = untag_ptr(arg);
60742         arg_conv.is_owned = ptr_is_owned(arg);
60743         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
60744         arg_conv.is_owned = false;
60745         int64_t ret_conv = ChannelUsage_clone_ptr(&arg_conv);
60746         return ret_conv;
60747 }
60748
60749 uint64_t  __attribute__((export_name("TS_ChannelUsage_clone"))) TS_ChannelUsage_clone(uint64_t orig) {
60750         LDKChannelUsage orig_conv;
60751         orig_conv.inner = untag_ptr(orig);
60752         orig_conv.is_owned = ptr_is_owned(orig);
60753         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
60754         orig_conv.is_owned = false;
60755         LDKChannelUsage ret_var = ChannelUsage_clone(&orig_conv);
60756         uint64_t ret_ref = 0;
60757         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
60758         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
60759         return ret_ref;
60760 }
60761
60762 void  __attribute__((export_name("TS_FixedPenaltyScorer_free"))) TS_FixedPenaltyScorer_free(uint64_t this_obj) {
60763         LDKFixedPenaltyScorer this_obj_conv;
60764         this_obj_conv.inner = untag_ptr(this_obj);
60765         this_obj_conv.is_owned = ptr_is_owned(this_obj);
60766         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
60767         FixedPenaltyScorer_free(this_obj_conv);
60768 }
60769
60770 static inline uint64_t FixedPenaltyScorer_clone_ptr(LDKFixedPenaltyScorer *NONNULL_PTR arg) {
60771         LDKFixedPenaltyScorer ret_var = FixedPenaltyScorer_clone(arg);
60772         uint64_t ret_ref = 0;
60773         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
60774         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
60775         return ret_ref;
60776 }
60777 int64_t  __attribute__((export_name("TS_FixedPenaltyScorer_clone_ptr"))) TS_FixedPenaltyScorer_clone_ptr(uint64_t arg) {
60778         LDKFixedPenaltyScorer arg_conv;
60779         arg_conv.inner = untag_ptr(arg);
60780         arg_conv.is_owned = ptr_is_owned(arg);
60781         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
60782         arg_conv.is_owned = false;
60783         int64_t ret_conv = FixedPenaltyScorer_clone_ptr(&arg_conv);
60784         return ret_conv;
60785 }
60786
60787 uint64_t  __attribute__((export_name("TS_FixedPenaltyScorer_clone"))) TS_FixedPenaltyScorer_clone(uint64_t orig) {
60788         LDKFixedPenaltyScorer orig_conv;
60789         orig_conv.inner = untag_ptr(orig);
60790         orig_conv.is_owned = ptr_is_owned(orig);
60791         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
60792         orig_conv.is_owned = false;
60793         LDKFixedPenaltyScorer ret_var = FixedPenaltyScorer_clone(&orig_conv);
60794         uint64_t ret_ref = 0;
60795         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
60796         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
60797         return ret_ref;
60798 }
60799
60800 uint64_t  __attribute__((export_name("TS_FixedPenaltyScorer_with_penalty"))) TS_FixedPenaltyScorer_with_penalty(int64_t penalty_msat) {
60801         LDKFixedPenaltyScorer ret_var = FixedPenaltyScorer_with_penalty(penalty_msat);
60802         uint64_t ret_ref = 0;
60803         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
60804         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
60805         return ret_ref;
60806 }
60807
60808 uint64_t  __attribute__((export_name("TS_FixedPenaltyScorer_as_ScoreLookUp"))) TS_FixedPenaltyScorer_as_ScoreLookUp(uint64_t this_arg) {
60809         LDKFixedPenaltyScorer this_arg_conv;
60810         this_arg_conv.inner = untag_ptr(this_arg);
60811         this_arg_conv.is_owned = ptr_is_owned(this_arg);
60812         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
60813         this_arg_conv.is_owned = false;
60814         LDKScoreLookUp* ret_ret = MALLOC(sizeof(LDKScoreLookUp), "LDKScoreLookUp");
60815         *ret_ret = FixedPenaltyScorer_as_ScoreLookUp(&this_arg_conv);
60816         return tag_ptr(ret_ret, true);
60817 }
60818
60819 uint64_t  __attribute__((export_name("TS_FixedPenaltyScorer_as_ScoreUpdate"))) TS_FixedPenaltyScorer_as_ScoreUpdate(uint64_t this_arg) {
60820         LDKFixedPenaltyScorer this_arg_conv;
60821         this_arg_conv.inner = untag_ptr(this_arg);
60822         this_arg_conv.is_owned = ptr_is_owned(this_arg);
60823         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
60824         this_arg_conv.is_owned = false;
60825         LDKScoreUpdate* ret_ret = MALLOC(sizeof(LDKScoreUpdate), "LDKScoreUpdate");
60826         *ret_ret = FixedPenaltyScorer_as_ScoreUpdate(&this_arg_conv);
60827         return tag_ptr(ret_ret, true);
60828 }
60829
60830 int8_tArray  __attribute__((export_name("TS_FixedPenaltyScorer_write"))) TS_FixedPenaltyScorer_write(uint64_t obj) {
60831         LDKFixedPenaltyScorer obj_conv;
60832         obj_conv.inner = untag_ptr(obj);
60833         obj_conv.is_owned = ptr_is_owned(obj);
60834         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
60835         obj_conv.is_owned = false;
60836         LDKCVec_u8Z ret_var = FixedPenaltyScorer_write(&obj_conv);
60837         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
60838         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
60839         CVec_u8Z_free(ret_var);
60840         return ret_arr;
60841 }
60842
60843 uint64_t  __attribute__((export_name("TS_FixedPenaltyScorer_read"))) TS_FixedPenaltyScorer_read(int8_tArray ser, int64_t arg) {
60844         LDKu8slice ser_ref;
60845         ser_ref.datalen = ser->arr_len;
60846         ser_ref.data = ser->elems;
60847         LDKCResult_FixedPenaltyScorerDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_FixedPenaltyScorerDecodeErrorZ), "LDKCResult_FixedPenaltyScorerDecodeErrorZ");
60848         *ret_conv = FixedPenaltyScorer_read(ser_ref, arg);
60849         FREE(ser);
60850         return tag_ptr(ret_conv, true);
60851 }
60852
60853 void  __attribute__((export_name("TS_ProbabilisticScorer_free"))) TS_ProbabilisticScorer_free(uint64_t this_obj) {
60854         LDKProbabilisticScorer this_obj_conv;
60855         this_obj_conv.inner = untag_ptr(this_obj);
60856         this_obj_conv.is_owned = ptr_is_owned(this_obj);
60857         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
60858         ProbabilisticScorer_free(this_obj_conv);
60859 }
60860
60861 void  __attribute__((export_name("TS_ProbabilisticScoringFeeParameters_free"))) TS_ProbabilisticScoringFeeParameters_free(uint64_t this_obj) {
60862         LDKProbabilisticScoringFeeParameters this_obj_conv;
60863         this_obj_conv.inner = untag_ptr(this_obj);
60864         this_obj_conv.is_owned = ptr_is_owned(this_obj);
60865         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
60866         ProbabilisticScoringFeeParameters_free(this_obj_conv);
60867 }
60868
60869 int64_t  __attribute__((export_name("TS_ProbabilisticScoringFeeParameters_get_base_penalty_msat"))) TS_ProbabilisticScoringFeeParameters_get_base_penalty_msat(uint64_t this_ptr) {
60870         LDKProbabilisticScoringFeeParameters this_ptr_conv;
60871         this_ptr_conv.inner = untag_ptr(this_ptr);
60872         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
60873         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
60874         this_ptr_conv.is_owned = false;
60875         int64_t ret_conv = ProbabilisticScoringFeeParameters_get_base_penalty_msat(&this_ptr_conv);
60876         return ret_conv;
60877 }
60878
60879 void  __attribute__((export_name("TS_ProbabilisticScoringFeeParameters_set_base_penalty_msat"))) TS_ProbabilisticScoringFeeParameters_set_base_penalty_msat(uint64_t this_ptr, int64_t val) {
60880         LDKProbabilisticScoringFeeParameters this_ptr_conv;
60881         this_ptr_conv.inner = untag_ptr(this_ptr);
60882         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
60883         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
60884         this_ptr_conv.is_owned = false;
60885         ProbabilisticScoringFeeParameters_set_base_penalty_msat(&this_ptr_conv, val);
60886 }
60887
60888 int64_t  __attribute__((export_name("TS_ProbabilisticScoringFeeParameters_get_base_penalty_amount_multiplier_msat"))) TS_ProbabilisticScoringFeeParameters_get_base_penalty_amount_multiplier_msat(uint64_t this_ptr) {
60889         LDKProbabilisticScoringFeeParameters this_ptr_conv;
60890         this_ptr_conv.inner = untag_ptr(this_ptr);
60891         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
60892         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
60893         this_ptr_conv.is_owned = false;
60894         int64_t ret_conv = ProbabilisticScoringFeeParameters_get_base_penalty_amount_multiplier_msat(&this_ptr_conv);
60895         return ret_conv;
60896 }
60897
60898 void  __attribute__((export_name("TS_ProbabilisticScoringFeeParameters_set_base_penalty_amount_multiplier_msat"))) TS_ProbabilisticScoringFeeParameters_set_base_penalty_amount_multiplier_msat(uint64_t this_ptr, int64_t val) {
60899         LDKProbabilisticScoringFeeParameters this_ptr_conv;
60900         this_ptr_conv.inner = untag_ptr(this_ptr);
60901         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
60902         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
60903         this_ptr_conv.is_owned = false;
60904         ProbabilisticScoringFeeParameters_set_base_penalty_amount_multiplier_msat(&this_ptr_conv, val);
60905 }
60906
60907 int64_t  __attribute__((export_name("TS_ProbabilisticScoringFeeParameters_get_liquidity_penalty_multiplier_msat"))) TS_ProbabilisticScoringFeeParameters_get_liquidity_penalty_multiplier_msat(uint64_t this_ptr) {
60908         LDKProbabilisticScoringFeeParameters this_ptr_conv;
60909         this_ptr_conv.inner = untag_ptr(this_ptr);
60910         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
60911         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
60912         this_ptr_conv.is_owned = false;
60913         int64_t ret_conv = ProbabilisticScoringFeeParameters_get_liquidity_penalty_multiplier_msat(&this_ptr_conv);
60914         return ret_conv;
60915 }
60916
60917 void  __attribute__((export_name("TS_ProbabilisticScoringFeeParameters_set_liquidity_penalty_multiplier_msat"))) TS_ProbabilisticScoringFeeParameters_set_liquidity_penalty_multiplier_msat(uint64_t this_ptr, int64_t val) {
60918         LDKProbabilisticScoringFeeParameters this_ptr_conv;
60919         this_ptr_conv.inner = untag_ptr(this_ptr);
60920         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
60921         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
60922         this_ptr_conv.is_owned = false;
60923         ProbabilisticScoringFeeParameters_set_liquidity_penalty_multiplier_msat(&this_ptr_conv, val);
60924 }
60925
60926 int64_t  __attribute__((export_name("TS_ProbabilisticScoringFeeParameters_get_liquidity_penalty_amount_multiplier_msat"))) TS_ProbabilisticScoringFeeParameters_get_liquidity_penalty_amount_multiplier_msat(uint64_t this_ptr) {
60927         LDKProbabilisticScoringFeeParameters this_ptr_conv;
60928         this_ptr_conv.inner = untag_ptr(this_ptr);
60929         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
60930         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
60931         this_ptr_conv.is_owned = false;
60932         int64_t ret_conv = ProbabilisticScoringFeeParameters_get_liquidity_penalty_amount_multiplier_msat(&this_ptr_conv);
60933         return ret_conv;
60934 }
60935
60936 void  __attribute__((export_name("TS_ProbabilisticScoringFeeParameters_set_liquidity_penalty_amount_multiplier_msat"))) TS_ProbabilisticScoringFeeParameters_set_liquidity_penalty_amount_multiplier_msat(uint64_t this_ptr, int64_t val) {
60937         LDKProbabilisticScoringFeeParameters this_ptr_conv;
60938         this_ptr_conv.inner = untag_ptr(this_ptr);
60939         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
60940         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
60941         this_ptr_conv.is_owned = false;
60942         ProbabilisticScoringFeeParameters_set_liquidity_penalty_amount_multiplier_msat(&this_ptr_conv, val);
60943 }
60944
60945 int64_t  __attribute__((export_name("TS_ProbabilisticScoringFeeParameters_get_historical_liquidity_penalty_multiplier_msat"))) TS_ProbabilisticScoringFeeParameters_get_historical_liquidity_penalty_multiplier_msat(uint64_t this_ptr) {
60946         LDKProbabilisticScoringFeeParameters this_ptr_conv;
60947         this_ptr_conv.inner = untag_ptr(this_ptr);
60948         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
60949         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
60950         this_ptr_conv.is_owned = false;
60951         int64_t ret_conv = ProbabilisticScoringFeeParameters_get_historical_liquidity_penalty_multiplier_msat(&this_ptr_conv);
60952         return ret_conv;
60953 }
60954
60955 void  __attribute__((export_name("TS_ProbabilisticScoringFeeParameters_set_historical_liquidity_penalty_multiplier_msat"))) TS_ProbabilisticScoringFeeParameters_set_historical_liquidity_penalty_multiplier_msat(uint64_t this_ptr, int64_t val) {
60956         LDKProbabilisticScoringFeeParameters this_ptr_conv;
60957         this_ptr_conv.inner = untag_ptr(this_ptr);
60958         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
60959         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
60960         this_ptr_conv.is_owned = false;
60961         ProbabilisticScoringFeeParameters_set_historical_liquidity_penalty_multiplier_msat(&this_ptr_conv, val);
60962 }
60963
60964 int64_t  __attribute__((export_name("TS_ProbabilisticScoringFeeParameters_get_historical_liquidity_penalty_amount_multiplier_msat"))) TS_ProbabilisticScoringFeeParameters_get_historical_liquidity_penalty_amount_multiplier_msat(uint64_t this_ptr) {
60965         LDKProbabilisticScoringFeeParameters this_ptr_conv;
60966         this_ptr_conv.inner = untag_ptr(this_ptr);
60967         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
60968         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
60969         this_ptr_conv.is_owned = false;
60970         int64_t ret_conv = ProbabilisticScoringFeeParameters_get_historical_liquidity_penalty_amount_multiplier_msat(&this_ptr_conv);
60971         return ret_conv;
60972 }
60973
60974 void  __attribute__((export_name("TS_ProbabilisticScoringFeeParameters_set_historical_liquidity_penalty_amount_multiplier_msat"))) TS_ProbabilisticScoringFeeParameters_set_historical_liquidity_penalty_amount_multiplier_msat(uint64_t this_ptr, int64_t val) {
60975         LDKProbabilisticScoringFeeParameters this_ptr_conv;
60976         this_ptr_conv.inner = untag_ptr(this_ptr);
60977         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
60978         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
60979         this_ptr_conv.is_owned = false;
60980         ProbabilisticScoringFeeParameters_set_historical_liquidity_penalty_amount_multiplier_msat(&this_ptr_conv, val);
60981 }
60982
60983 int64_t  __attribute__((export_name("TS_ProbabilisticScoringFeeParameters_get_anti_probing_penalty_msat"))) TS_ProbabilisticScoringFeeParameters_get_anti_probing_penalty_msat(uint64_t this_ptr) {
60984         LDKProbabilisticScoringFeeParameters this_ptr_conv;
60985         this_ptr_conv.inner = untag_ptr(this_ptr);
60986         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
60987         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
60988         this_ptr_conv.is_owned = false;
60989         int64_t ret_conv = ProbabilisticScoringFeeParameters_get_anti_probing_penalty_msat(&this_ptr_conv);
60990         return ret_conv;
60991 }
60992
60993 void  __attribute__((export_name("TS_ProbabilisticScoringFeeParameters_set_anti_probing_penalty_msat"))) TS_ProbabilisticScoringFeeParameters_set_anti_probing_penalty_msat(uint64_t this_ptr, int64_t val) {
60994         LDKProbabilisticScoringFeeParameters this_ptr_conv;
60995         this_ptr_conv.inner = untag_ptr(this_ptr);
60996         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
60997         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
60998         this_ptr_conv.is_owned = false;
60999         ProbabilisticScoringFeeParameters_set_anti_probing_penalty_msat(&this_ptr_conv, val);
61000 }
61001
61002 int64_t  __attribute__((export_name("TS_ProbabilisticScoringFeeParameters_get_considered_impossible_penalty_msat"))) TS_ProbabilisticScoringFeeParameters_get_considered_impossible_penalty_msat(uint64_t this_ptr) {
61003         LDKProbabilisticScoringFeeParameters this_ptr_conv;
61004         this_ptr_conv.inner = untag_ptr(this_ptr);
61005         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
61006         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
61007         this_ptr_conv.is_owned = false;
61008         int64_t ret_conv = ProbabilisticScoringFeeParameters_get_considered_impossible_penalty_msat(&this_ptr_conv);
61009         return ret_conv;
61010 }
61011
61012 void  __attribute__((export_name("TS_ProbabilisticScoringFeeParameters_set_considered_impossible_penalty_msat"))) TS_ProbabilisticScoringFeeParameters_set_considered_impossible_penalty_msat(uint64_t this_ptr, int64_t val) {
61013         LDKProbabilisticScoringFeeParameters this_ptr_conv;
61014         this_ptr_conv.inner = untag_ptr(this_ptr);
61015         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
61016         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
61017         this_ptr_conv.is_owned = false;
61018         ProbabilisticScoringFeeParameters_set_considered_impossible_penalty_msat(&this_ptr_conv, val);
61019 }
61020
61021 jboolean  __attribute__((export_name("TS_ProbabilisticScoringFeeParameters_get_linear_success_probability"))) TS_ProbabilisticScoringFeeParameters_get_linear_success_probability(uint64_t this_ptr) {
61022         LDKProbabilisticScoringFeeParameters this_ptr_conv;
61023         this_ptr_conv.inner = untag_ptr(this_ptr);
61024         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
61025         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
61026         this_ptr_conv.is_owned = false;
61027         jboolean ret_conv = ProbabilisticScoringFeeParameters_get_linear_success_probability(&this_ptr_conv);
61028         return ret_conv;
61029 }
61030
61031 void  __attribute__((export_name("TS_ProbabilisticScoringFeeParameters_set_linear_success_probability"))) TS_ProbabilisticScoringFeeParameters_set_linear_success_probability(uint64_t this_ptr, jboolean val) {
61032         LDKProbabilisticScoringFeeParameters this_ptr_conv;
61033         this_ptr_conv.inner = untag_ptr(this_ptr);
61034         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
61035         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
61036         this_ptr_conv.is_owned = false;
61037         ProbabilisticScoringFeeParameters_set_linear_success_probability(&this_ptr_conv, val);
61038 }
61039
61040 static inline uint64_t ProbabilisticScoringFeeParameters_clone_ptr(LDKProbabilisticScoringFeeParameters *NONNULL_PTR arg) {
61041         LDKProbabilisticScoringFeeParameters ret_var = ProbabilisticScoringFeeParameters_clone(arg);
61042         uint64_t ret_ref = 0;
61043         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
61044         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
61045         return ret_ref;
61046 }
61047 int64_t  __attribute__((export_name("TS_ProbabilisticScoringFeeParameters_clone_ptr"))) TS_ProbabilisticScoringFeeParameters_clone_ptr(uint64_t arg) {
61048         LDKProbabilisticScoringFeeParameters arg_conv;
61049         arg_conv.inner = untag_ptr(arg);
61050         arg_conv.is_owned = ptr_is_owned(arg);
61051         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
61052         arg_conv.is_owned = false;
61053         int64_t ret_conv = ProbabilisticScoringFeeParameters_clone_ptr(&arg_conv);
61054         return ret_conv;
61055 }
61056
61057 uint64_t  __attribute__((export_name("TS_ProbabilisticScoringFeeParameters_clone"))) TS_ProbabilisticScoringFeeParameters_clone(uint64_t orig) {
61058         LDKProbabilisticScoringFeeParameters orig_conv;
61059         orig_conv.inner = untag_ptr(orig);
61060         orig_conv.is_owned = ptr_is_owned(orig);
61061         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
61062         orig_conv.is_owned = false;
61063         LDKProbabilisticScoringFeeParameters ret_var = ProbabilisticScoringFeeParameters_clone(&orig_conv);
61064         uint64_t ret_ref = 0;
61065         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
61066         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
61067         return ret_ref;
61068 }
61069
61070 uint64_t  __attribute__((export_name("TS_ProbabilisticScoringFeeParameters_default"))) TS_ProbabilisticScoringFeeParameters_default() {
61071         LDKProbabilisticScoringFeeParameters ret_var = ProbabilisticScoringFeeParameters_default();
61072         uint64_t ret_ref = 0;
61073         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
61074         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
61075         return ret_ref;
61076 }
61077
61078 void  __attribute__((export_name("TS_ProbabilisticScoringFeeParameters_add_banned"))) TS_ProbabilisticScoringFeeParameters_add_banned(uint64_t this_arg, uint64_t node_id) {
61079         LDKProbabilisticScoringFeeParameters this_arg_conv;
61080         this_arg_conv.inner = untag_ptr(this_arg);
61081         this_arg_conv.is_owned = ptr_is_owned(this_arg);
61082         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
61083         this_arg_conv.is_owned = false;
61084         LDKNodeId node_id_conv;
61085         node_id_conv.inner = untag_ptr(node_id);
61086         node_id_conv.is_owned = ptr_is_owned(node_id);
61087         CHECK_INNER_FIELD_ACCESS_OR_NULL(node_id_conv);
61088         node_id_conv.is_owned = false;
61089         ProbabilisticScoringFeeParameters_add_banned(&this_arg_conv, &node_id_conv);
61090 }
61091
61092 void  __attribute__((export_name("TS_ProbabilisticScoringFeeParameters_add_banned_from_list"))) TS_ProbabilisticScoringFeeParameters_add_banned_from_list(uint64_t this_arg, uint64_tArray node_ids) {
61093         LDKProbabilisticScoringFeeParameters this_arg_conv;
61094         this_arg_conv.inner = untag_ptr(this_arg);
61095         this_arg_conv.is_owned = ptr_is_owned(this_arg);
61096         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
61097         this_arg_conv.is_owned = false;
61098         LDKCVec_NodeIdZ node_ids_constr;
61099         node_ids_constr.datalen = node_ids->arr_len;
61100         if (node_ids_constr.datalen > 0)
61101                 node_ids_constr.data = MALLOC(node_ids_constr.datalen * sizeof(LDKNodeId), "LDKCVec_NodeIdZ Elements");
61102         else
61103                 node_ids_constr.data = NULL;
61104         uint64_t* node_ids_vals = node_ids->elems;
61105         for (size_t i = 0; i < node_ids_constr.datalen; i++) {
61106                 uint64_t node_ids_conv_8 = node_ids_vals[i];
61107                 LDKNodeId node_ids_conv_8_conv;
61108                 node_ids_conv_8_conv.inner = untag_ptr(node_ids_conv_8);
61109                 node_ids_conv_8_conv.is_owned = ptr_is_owned(node_ids_conv_8);
61110                 CHECK_INNER_FIELD_ACCESS_OR_NULL(node_ids_conv_8_conv);
61111                 node_ids_conv_8_conv = NodeId_clone(&node_ids_conv_8_conv);
61112                 node_ids_constr.data[i] = node_ids_conv_8_conv;
61113         }
61114         FREE(node_ids);
61115         ProbabilisticScoringFeeParameters_add_banned_from_list(&this_arg_conv, node_ids_constr);
61116 }
61117
61118 void  __attribute__((export_name("TS_ProbabilisticScoringFeeParameters_remove_banned"))) TS_ProbabilisticScoringFeeParameters_remove_banned(uint64_t this_arg, uint64_t node_id) {
61119         LDKProbabilisticScoringFeeParameters this_arg_conv;
61120         this_arg_conv.inner = untag_ptr(this_arg);
61121         this_arg_conv.is_owned = ptr_is_owned(this_arg);
61122         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
61123         this_arg_conv.is_owned = false;
61124         LDKNodeId node_id_conv;
61125         node_id_conv.inner = untag_ptr(node_id);
61126         node_id_conv.is_owned = ptr_is_owned(node_id);
61127         CHECK_INNER_FIELD_ACCESS_OR_NULL(node_id_conv);
61128         node_id_conv.is_owned = false;
61129         ProbabilisticScoringFeeParameters_remove_banned(&this_arg_conv, &node_id_conv);
61130 }
61131
61132 void  __attribute__((export_name("TS_ProbabilisticScoringFeeParameters_set_manual_penalty"))) TS_ProbabilisticScoringFeeParameters_set_manual_penalty(uint64_t this_arg, uint64_t node_id, int64_t penalty) {
61133         LDKProbabilisticScoringFeeParameters this_arg_conv;
61134         this_arg_conv.inner = untag_ptr(this_arg);
61135         this_arg_conv.is_owned = ptr_is_owned(this_arg);
61136         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
61137         this_arg_conv.is_owned = false;
61138         LDKNodeId node_id_conv;
61139         node_id_conv.inner = untag_ptr(node_id);
61140         node_id_conv.is_owned = ptr_is_owned(node_id);
61141         CHECK_INNER_FIELD_ACCESS_OR_NULL(node_id_conv);
61142         node_id_conv.is_owned = false;
61143         ProbabilisticScoringFeeParameters_set_manual_penalty(&this_arg_conv, &node_id_conv, penalty);
61144 }
61145
61146 void  __attribute__((export_name("TS_ProbabilisticScoringFeeParameters_remove_manual_penalty"))) TS_ProbabilisticScoringFeeParameters_remove_manual_penalty(uint64_t this_arg, uint64_t node_id) {
61147         LDKProbabilisticScoringFeeParameters this_arg_conv;
61148         this_arg_conv.inner = untag_ptr(this_arg);
61149         this_arg_conv.is_owned = ptr_is_owned(this_arg);
61150         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
61151         this_arg_conv.is_owned = false;
61152         LDKNodeId node_id_conv;
61153         node_id_conv.inner = untag_ptr(node_id);
61154         node_id_conv.is_owned = ptr_is_owned(node_id);
61155         CHECK_INNER_FIELD_ACCESS_OR_NULL(node_id_conv);
61156         node_id_conv.is_owned = false;
61157         ProbabilisticScoringFeeParameters_remove_manual_penalty(&this_arg_conv, &node_id_conv);
61158 }
61159
61160 void  __attribute__((export_name("TS_ProbabilisticScoringFeeParameters_clear_manual_penalties"))) TS_ProbabilisticScoringFeeParameters_clear_manual_penalties(uint64_t this_arg) {
61161         LDKProbabilisticScoringFeeParameters this_arg_conv;
61162         this_arg_conv.inner = untag_ptr(this_arg);
61163         this_arg_conv.is_owned = ptr_is_owned(this_arg);
61164         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
61165         this_arg_conv.is_owned = false;
61166         ProbabilisticScoringFeeParameters_clear_manual_penalties(&this_arg_conv);
61167 }
61168
61169 void  __attribute__((export_name("TS_ProbabilisticScoringDecayParameters_free"))) TS_ProbabilisticScoringDecayParameters_free(uint64_t this_obj) {
61170         LDKProbabilisticScoringDecayParameters this_obj_conv;
61171         this_obj_conv.inner = untag_ptr(this_obj);
61172         this_obj_conv.is_owned = ptr_is_owned(this_obj);
61173         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
61174         ProbabilisticScoringDecayParameters_free(this_obj_conv);
61175 }
61176
61177 int64_t  __attribute__((export_name("TS_ProbabilisticScoringDecayParameters_get_historical_no_updates_half_life"))) TS_ProbabilisticScoringDecayParameters_get_historical_no_updates_half_life(uint64_t this_ptr) {
61178         LDKProbabilisticScoringDecayParameters this_ptr_conv;
61179         this_ptr_conv.inner = untag_ptr(this_ptr);
61180         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
61181         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
61182         this_ptr_conv.is_owned = false;
61183         int64_t ret_conv = ProbabilisticScoringDecayParameters_get_historical_no_updates_half_life(&this_ptr_conv);
61184         return ret_conv;
61185 }
61186
61187 void  __attribute__((export_name("TS_ProbabilisticScoringDecayParameters_set_historical_no_updates_half_life"))) TS_ProbabilisticScoringDecayParameters_set_historical_no_updates_half_life(uint64_t this_ptr, int64_t val) {
61188         LDKProbabilisticScoringDecayParameters this_ptr_conv;
61189         this_ptr_conv.inner = untag_ptr(this_ptr);
61190         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
61191         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
61192         this_ptr_conv.is_owned = false;
61193         ProbabilisticScoringDecayParameters_set_historical_no_updates_half_life(&this_ptr_conv, val);
61194 }
61195
61196 int64_t  __attribute__((export_name("TS_ProbabilisticScoringDecayParameters_get_liquidity_offset_half_life"))) TS_ProbabilisticScoringDecayParameters_get_liquidity_offset_half_life(uint64_t this_ptr) {
61197         LDKProbabilisticScoringDecayParameters this_ptr_conv;
61198         this_ptr_conv.inner = untag_ptr(this_ptr);
61199         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
61200         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
61201         this_ptr_conv.is_owned = false;
61202         int64_t ret_conv = ProbabilisticScoringDecayParameters_get_liquidity_offset_half_life(&this_ptr_conv);
61203         return ret_conv;
61204 }
61205
61206 void  __attribute__((export_name("TS_ProbabilisticScoringDecayParameters_set_liquidity_offset_half_life"))) TS_ProbabilisticScoringDecayParameters_set_liquidity_offset_half_life(uint64_t this_ptr, int64_t val) {
61207         LDKProbabilisticScoringDecayParameters this_ptr_conv;
61208         this_ptr_conv.inner = untag_ptr(this_ptr);
61209         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
61210         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
61211         this_ptr_conv.is_owned = false;
61212         ProbabilisticScoringDecayParameters_set_liquidity_offset_half_life(&this_ptr_conv, val);
61213 }
61214
61215 uint64_t  __attribute__((export_name("TS_ProbabilisticScoringDecayParameters_new"))) TS_ProbabilisticScoringDecayParameters_new(int64_t historical_no_updates_half_life_arg, int64_t liquidity_offset_half_life_arg) {
61216         LDKProbabilisticScoringDecayParameters ret_var = ProbabilisticScoringDecayParameters_new(historical_no_updates_half_life_arg, liquidity_offset_half_life_arg);
61217         uint64_t ret_ref = 0;
61218         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
61219         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
61220         return ret_ref;
61221 }
61222
61223 static inline uint64_t ProbabilisticScoringDecayParameters_clone_ptr(LDKProbabilisticScoringDecayParameters *NONNULL_PTR arg) {
61224         LDKProbabilisticScoringDecayParameters ret_var = ProbabilisticScoringDecayParameters_clone(arg);
61225         uint64_t ret_ref = 0;
61226         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
61227         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
61228         return ret_ref;
61229 }
61230 int64_t  __attribute__((export_name("TS_ProbabilisticScoringDecayParameters_clone_ptr"))) TS_ProbabilisticScoringDecayParameters_clone_ptr(uint64_t arg) {
61231         LDKProbabilisticScoringDecayParameters arg_conv;
61232         arg_conv.inner = untag_ptr(arg);
61233         arg_conv.is_owned = ptr_is_owned(arg);
61234         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
61235         arg_conv.is_owned = false;
61236         int64_t ret_conv = ProbabilisticScoringDecayParameters_clone_ptr(&arg_conv);
61237         return ret_conv;
61238 }
61239
61240 uint64_t  __attribute__((export_name("TS_ProbabilisticScoringDecayParameters_clone"))) TS_ProbabilisticScoringDecayParameters_clone(uint64_t orig) {
61241         LDKProbabilisticScoringDecayParameters orig_conv;
61242         orig_conv.inner = untag_ptr(orig);
61243         orig_conv.is_owned = ptr_is_owned(orig);
61244         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
61245         orig_conv.is_owned = false;
61246         LDKProbabilisticScoringDecayParameters ret_var = ProbabilisticScoringDecayParameters_clone(&orig_conv);
61247         uint64_t ret_ref = 0;
61248         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
61249         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
61250         return ret_ref;
61251 }
61252
61253 uint64_t  __attribute__((export_name("TS_ProbabilisticScoringDecayParameters_default"))) TS_ProbabilisticScoringDecayParameters_default() {
61254         LDKProbabilisticScoringDecayParameters ret_var = ProbabilisticScoringDecayParameters_default();
61255         uint64_t ret_ref = 0;
61256         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
61257         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
61258         return ret_ref;
61259 }
61260
61261 uint64_t  __attribute__((export_name("TS_ProbabilisticScorer_new"))) TS_ProbabilisticScorer_new(uint64_t decay_params, uint64_t network_graph, uint64_t logger) {
61262         LDKProbabilisticScoringDecayParameters decay_params_conv;
61263         decay_params_conv.inner = untag_ptr(decay_params);
61264         decay_params_conv.is_owned = ptr_is_owned(decay_params);
61265         CHECK_INNER_FIELD_ACCESS_OR_NULL(decay_params_conv);
61266         decay_params_conv = ProbabilisticScoringDecayParameters_clone(&decay_params_conv);
61267         LDKNetworkGraph network_graph_conv;
61268         network_graph_conv.inner = untag_ptr(network_graph);
61269         network_graph_conv.is_owned = ptr_is_owned(network_graph);
61270         CHECK_INNER_FIELD_ACCESS_OR_NULL(network_graph_conv);
61271         network_graph_conv.is_owned = false;
61272         void* logger_ptr = untag_ptr(logger);
61273         CHECK_ACCESS(logger_ptr);
61274         LDKLogger logger_conv = *(LDKLogger*)(logger_ptr);
61275         if (logger_conv.free == LDKLogger_JCalls_free) {
61276                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
61277                 LDKLogger_JCalls_cloned(&logger_conv);
61278         }
61279         LDKProbabilisticScorer ret_var = ProbabilisticScorer_new(decay_params_conv, &network_graph_conv, logger_conv);
61280         uint64_t ret_ref = 0;
61281         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
61282         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
61283         return ret_ref;
61284 }
61285
61286 void  __attribute__((export_name("TS_ProbabilisticScorer_debug_log_liquidity_stats"))) TS_ProbabilisticScorer_debug_log_liquidity_stats(uint64_t this_arg) {
61287         LDKProbabilisticScorer this_arg_conv;
61288         this_arg_conv.inner = untag_ptr(this_arg);
61289         this_arg_conv.is_owned = ptr_is_owned(this_arg);
61290         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
61291         this_arg_conv.is_owned = false;
61292         ProbabilisticScorer_debug_log_liquidity_stats(&this_arg_conv);
61293 }
61294
61295 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) {
61296         LDKProbabilisticScorer this_arg_conv;
61297         this_arg_conv.inner = untag_ptr(this_arg);
61298         this_arg_conv.is_owned = ptr_is_owned(this_arg);
61299         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
61300         this_arg_conv.is_owned = false;
61301         LDKNodeId target_conv;
61302         target_conv.inner = untag_ptr(target);
61303         target_conv.is_owned = ptr_is_owned(target);
61304         CHECK_INNER_FIELD_ACCESS_OR_NULL(target_conv);
61305         target_conv.is_owned = false;
61306         LDKCOption_C2Tuple_u64u64ZZ *ret_copy = MALLOC(sizeof(LDKCOption_C2Tuple_u64u64ZZ), "LDKCOption_C2Tuple_u64u64ZZ");
61307         *ret_copy = ProbabilisticScorer_estimated_channel_liquidity_range(&this_arg_conv, scid, &target_conv);
61308         uint64_t ret_ref = tag_ptr(ret_copy, true);
61309         return ret_ref;
61310 }
61311
61312 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) {
61313         LDKProbabilisticScorer this_arg_conv;
61314         this_arg_conv.inner = untag_ptr(this_arg);
61315         this_arg_conv.is_owned = ptr_is_owned(this_arg);
61316         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
61317         this_arg_conv.is_owned = false;
61318         LDKNodeId target_conv;
61319         target_conv.inner = untag_ptr(target);
61320         target_conv.is_owned = ptr_is_owned(target);
61321         CHECK_INNER_FIELD_ACCESS_OR_NULL(target_conv);
61322         target_conv.is_owned = false;
61323         LDKCOption_C2Tuple_ThirtyTwoU16sThirtyTwoU16sZZ *ret_copy = MALLOC(sizeof(LDKCOption_C2Tuple_ThirtyTwoU16sThirtyTwoU16sZZ), "LDKCOption_C2Tuple_ThirtyTwoU16sThirtyTwoU16sZZ");
61324         *ret_copy = ProbabilisticScorer_historical_estimated_channel_liquidity_probabilities(&this_arg_conv, scid, &target_conv);
61325         uint64_t ret_ref = tag_ptr(ret_copy, true);
61326         return ret_ref;
61327 }
61328
61329 uint64_t  __attribute__((export_name("TS_ProbabilisticScorer_historical_estimated_payment_success_probability"))) TS_ProbabilisticScorer_historical_estimated_payment_success_probability(uint64_t this_arg, int64_t scid, uint64_t target, int64_t amount_msat, uint64_t params) {
61330         LDKProbabilisticScorer this_arg_conv;
61331         this_arg_conv.inner = untag_ptr(this_arg);
61332         this_arg_conv.is_owned = ptr_is_owned(this_arg);
61333         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
61334         this_arg_conv.is_owned = false;
61335         LDKNodeId target_conv;
61336         target_conv.inner = untag_ptr(target);
61337         target_conv.is_owned = ptr_is_owned(target);
61338         CHECK_INNER_FIELD_ACCESS_OR_NULL(target_conv);
61339         target_conv.is_owned = false;
61340         LDKProbabilisticScoringFeeParameters params_conv;
61341         params_conv.inner = untag_ptr(params);
61342         params_conv.is_owned = ptr_is_owned(params);
61343         CHECK_INNER_FIELD_ACCESS_OR_NULL(params_conv);
61344         params_conv.is_owned = false;
61345         LDKCOption_f64Z *ret_copy = MALLOC(sizeof(LDKCOption_f64Z), "LDKCOption_f64Z");
61346         *ret_copy = ProbabilisticScorer_historical_estimated_payment_success_probability(&this_arg_conv, scid, &target_conv, amount_msat, &params_conv);
61347         uint64_t ret_ref = tag_ptr(ret_copy, true);
61348         return ret_ref;
61349 }
61350
61351 uint64_t  __attribute__((export_name("TS_ProbabilisticScorer_as_ScoreLookUp"))) TS_ProbabilisticScorer_as_ScoreLookUp(uint64_t this_arg) {
61352         LDKProbabilisticScorer this_arg_conv;
61353         this_arg_conv.inner = untag_ptr(this_arg);
61354         this_arg_conv.is_owned = ptr_is_owned(this_arg);
61355         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
61356         this_arg_conv.is_owned = false;
61357         LDKScoreLookUp* ret_ret = MALLOC(sizeof(LDKScoreLookUp), "LDKScoreLookUp");
61358         *ret_ret = ProbabilisticScorer_as_ScoreLookUp(&this_arg_conv);
61359         return tag_ptr(ret_ret, true);
61360 }
61361
61362 uint64_t  __attribute__((export_name("TS_ProbabilisticScorer_as_ScoreUpdate"))) TS_ProbabilisticScorer_as_ScoreUpdate(uint64_t this_arg) {
61363         LDKProbabilisticScorer this_arg_conv;
61364         this_arg_conv.inner = untag_ptr(this_arg);
61365         this_arg_conv.is_owned = ptr_is_owned(this_arg);
61366         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
61367         this_arg_conv.is_owned = false;
61368         LDKScoreUpdate* ret_ret = MALLOC(sizeof(LDKScoreUpdate), "LDKScoreUpdate");
61369         *ret_ret = ProbabilisticScorer_as_ScoreUpdate(&this_arg_conv);
61370         return tag_ptr(ret_ret, true);
61371 }
61372
61373 uint64_t  __attribute__((export_name("TS_ProbabilisticScorer_as_Score"))) TS_ProbabilisticScorer_as_Score(uint64_t this_arg) {
61374         LDKProbabilisticScorer this_arg_conv;
61375         this_arg_conv.inner = untag_ptr(this_arg);
61376         this_arg_conv.is_owned = ptr_is_owned(this_arg);
61377         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
61378         this_arg_conv.is_owned = false;
61379         LDKScore* ret_ret = MALLOC(sizeof(LDKScore), "LDKScore");
61380         *ret_ret = ProbabilisticScorer_as_Score(&this_arg_conv);
61381         return tag_ptr(ret_ret, true);
61382 }
61383
61384 int8_tArray  __attribute__((export_name("TS_ProbabilisticScorer_write"))) TS_ProbabilisticScorer_write(uint64_t obj) {
61385         LDKProbabilisticScorer obj_conv;
61386         obj_conv.inner = untag_ptr(obj);
61387         obj_conv.is_owned = ptr_is_owned(obj);
61388         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
61389         obj_conv.is_owned = false;
61390         LDKCVec_u8Z ret_var = ProbabilisticScorer_write(&obj_conv);
61391         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
61392         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
61393         CVec_u8Z_free(ret_var);
61394         return ret_arr;
61395 }
61396
61397 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) {
61398         LDKu8slice ser_ref;
61399         ser_ref.datalen = ser->arr_len;
61400         ser_ref.data = ser->elems;
61401         LDKProbabilisticScoringDecayParameters arg_a_conv;
61402         arg_a_conv.inner = untag_ptr(arg_a);
61403         arg_a_conv.is_owned = ptr_is_owned(arg_a);
61404         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_a_conv);
61405         arg_a_conv = ProbabilisticScoringDecayParameters_clone(&arg_a_conv);
61406         LDKNetworkGraph arg_b_conv;
61407         arg_b_conv.inner = untag_ptr(arg_b);
61408         arg_b_conv.is_owned = ptr_is_owned(arg_b);
61409         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_b_conv);
61410         arg_b_conv.is_owned = false;
61411         void* arg_c_ptr = untag_ptr(arg_c);
61412         CHECK_ACCESS(arg_c_ptr);
61413         LDKLogger arg_c_conv = *(LDKLogger*)(arg_c_ptr);
61414         if (arg_c_conv.free == LDKLogger_JCalls_free) {
61415                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
61416                 LDKLogger_JCalls_cloned(&arg_c_conv);
61417         }
61418         LDKCResult_ProbabilisticScorerDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ProbabilisticScorerDecodeErrorZ), "LDKCResult_ProbabilisticScorerDecodeErrorZ");
61419         *ret_conv = ProbabilisticScorer_read(ser_ref, arg_a_conv, &arg_b_conv, arg_c_conv);
61420         FREE(ser);
61421         return tag_ptr(ret_conv, true);
61422 }
61423
61424 void  __attribute__((export_name("TS_DelayedPaymentOutputDescriptor_free"))) TS_DelayedPaymentOutputDescriptor_free(uint64_t this_obj) {
61425         LDKDelayedPaymentOutputDescriptor this_obj_conv;
61426         this_obj_conv.inner = untag_ptr(this_obj);
61427         this_obj_conv.is_owned = ptr_is_owned(this_obj);
61428         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
61429         DelayedPaymentOutputDescriptor_free(this_obj_conv);
61430 }
61431
61432 uint64_t  __attribute__((export_name("TS_DelayedPaymentOutputDescriptor_get_outpoint"))) TS_DelayedPaymentOutputDescriptor_get_outpoint(uint64_t this_ptr) {
61433         LDKDelayedPaymentOutputDescriptor this_ptr_conv;
61434         this_ptr_conv.inner = untag_ptr(this_ptr);
61435         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
61436         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
61437         this_ptr_conv.is_owned = false;
61438         LDKOutPoint ret_var = DelayedPaymentOutputDescriptor_get_outpoint(&this_ptr_conv);
61439         uint64_t ret_ref = 0;
61440         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
61441         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
61442         return ret_ref;
61443 }
61444
61445 void  __attribute__((export_name("TS_DelayedPaymentOutputDescriptor_set_outpoint"))) TS_DelayedPaymentOutputDescriptor_set_outpoint(uint64_t this_ptr, uint64_t val) {
61446         LDKDelayedPaymentOutputDescriptor this_ptr_conv;
61447         this_ptr_conv.inner = untag_ptr(this_ptr);
61448         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
61449         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
61450         this_ptr_conv.is_owned = false;
61451         LDKOutPoint val_conv;
61452         val_conv.inner = untag_ptr(val);
61453         val_conv.is_owned = ptr_is_owned(val);
61454         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
61455         val_conv = OutPoint_clone(&val_conv);
61456         DelayedPaymentOutputDescriptor_set_outpoint(&this_ptr_conv, val_conv);
61457 }
61458
61459 int8_tArray  __attribute__((export_name("TS_DelayedPaymentOutputDescriptor_get_per_commitment_point"))) TS_DelayedPaymentOutputDescriptor_get_per_commitment_point(uint64_t this_ptr) {
61460         LDKDelayedPaymentOutputDescriptor this_ptr_conv;
61461         this_ptr_conv.inner = untag_ptr(this_ptr);
61462         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
61463         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
61464         this_ptr_conv.is_owned = false;
61465         int8_tArray ret_arr = init_int8_tArray(33, __LINE__);
61466         memcpy(ret_arr->elems, DelayedPaymentOutputDescriptor_get_per_commitment_point(&this_ptr_conv).compressed_form, 33);
61467         return ret_arr;
61468 }
61469
61470 void  __attribute__((export_name("TS_DelayedPaymentOutputDescriptor_set_per_commitment_point"))) TS_DelayedPaymentOutputDescriptor_set_per_commitment_point(uint64_t this_ptr, int8_tArray val) {
61471         LDKDelayedPaymentOutputDescriptor this_ptr_conv;
61472         this_ptr_conv.inner = untag_ptr(this_ptr);
61473         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
61474         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
61475         this_ptr_conv.is_owned = false;
61476         LDKPublicKey val_ref;
61477         CHECK(val->arr_len == 33);
61478         memcpy(val_ref.compressed_form, val->elems, 33); FREE(val);
61479         DelayedPaymentOutputDescriptor_set_per_commitment_point(&this_ptr_conv, val_ref);
61480 }
61481
61482 int16_t  __attribute__((export_name("TS_DelayedPaymentOutputDescriptor_get_to_self_delay"))) TS_DelayedPaymentOutputDescriptor_get_to_self_delay(uint64_t this_ptr) {
61483         LDKDelayedPaymentOutputDescriptor this_ptr_conv;
61484         this_ptr_conv.inner = untag_ptr(this_ptr);
61485         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
61486         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
61487         this_ptr_conv.is_owned = false;
61488         int16_t ret_conv = DelayedPaymentOutputDescriptor_get_to_self_delay(&this_ptr_conv);
61489         return ret_conv;
61490 }
61491
61492 void  __attribute__((export_name("TS_DelayedPaymentOutputDescriptor_set_to_self_delay"))) TS_DelayedPaymentOutputDescriptor_set_to_self_delay(uint64_t this_ptr, int16_t val) {
61493         LDKDelayedPaymentOutputDescriptor this_ptr_conv;
61494         this_ptr_conv.inner = untag_ptr(this_ptr);
61495         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
61496         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
61497         this_ptr_conv.is_owned = false;
61498         DelayedPaymentOutputDescriptor_set_to_self_delay(&this_ptr_conv, val);
61499 }
61500
61501 uint64_t  __attribute__((export_name("TS_DelayedPaymentOutputDescriptor_get_output"))) TS_DelayedPaymentOutputDescriptor_get_output(uint64_t this_ptr) {
61502         LDKDelayedPaymentOutputDescriptor this_ptr_conv;
61503         this_ptr_conv.inner = untag_ptr(this_ptr);
61504         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
61505         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
61506         this_ptr_conv.is_owned = false;
61507         LDKTxOut* ret_ref = MALLOC(sizeof(LDKTxOut), "LDKTxOut");
61508         *ret_ref = DelayedPaymentOutputDescriptor_get_output(&this_ptr_conv);
61509         return tag_ptr(ret_ref, true);
61510 }
61511
61512 void  __attribute__((export_name("TS_DelayedPaymentOutputDescriptor_set_output"))) TS_DelayedPaymentOutputDescriptor_set_output(uint64_t this_ptr, uint64_t val) {
61513         LDKDelayedPaymentOutputDescriptor this_ptr_conv;
61514         this_ptr_conv.inner = untag_ptr(this_ptr);
61515         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
61516         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
61517         this_ptr_conv.is_owned = false;
61518         void* val_ptr = untag_ptr(val);
61519         CHECK_ACCESS(val_ptr);
61520         LDKTxOut val_conv = *(LDKTxOut*)(val_ptr);
61521         val_conv = TxOut_clone((LDKTxOut*)untag_ptr(val));
61522         DelayedPaymentOutputDescriptor_set_output(&this_ptr_conv, val_conv);
61523 }
61524
61525 int8_tArray  __attribute__((export_name("TS_DelayedPaymentOutputDescriptor_get_revocation_pubkey"))) TS_DelayedPaymentOutputDescriptor_get_revocation_pubkey(uint64_t this_ptr) {
61526         LDKDelayedPaymentOutputDescriptor this_ptr_conv;
61527         this_ptr_conv.inner = untag_ptr(this_ptr);
61528         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
61529         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
61530         this_ptr_conv.is_owned = false;
61531         int8_tArray ret_arr = init_int8_tArray(33, __LINE__);
61532         memcpy(ret_arr->elems, DelayedPaymentOutputDescriptor_get_revocation_pubkey(&this_ptr_conv).compressed_form, 33);
61533         return ret_arr;
61534 }
61535
61536 void  __attribute__((export_name("TS_DelayedPaymentOutputDescriptor_set_revocation_pubkey"))) TS_DelayedPaymentOutputDescriptor_set_revocation_pubkey(uint64_t this_ptr, int8_tArray val) {
61537         LDKDelayedPaymentOutputDescriptor this_ptr_conv;
61538         this_ptr_conv.inner = untag_ptr(this_ptr);
61539         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
61540         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
61541         this_ptr_conv.is_owned = false;
61542         LDKPublicKey val_ref;
61543         CHECK(val->arr_len == 33);
61544         memcpy(val_ref.compressed_form, val->elems, 33); FREE(val);
61545         DelayedPaymentOutputDescriptor_set_revocation_pubkey(&this_ptr_conv, val_ref);
61546 }
61547
61548 int8_tArray  __attribute__((export_name("TS_DelayedPaymentOutputDescriptor_get_channel_keys_id"))) TS_DelayedPaymentOutputDescriptor_get_channel_keys_id(uint64_t this_ptr) {
61549         LDKDelayedPaymentOutputDescriptor this_ptr_conv;
61550         this_ptr_conv.inner = untag_ptr(this_ptr);
61551         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
61552         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
61553         this_ptr_conv.is_owned = false;
61554         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
61555         memcpy(ret_arr->elems, *DelayedPaymentOutputDescriptor_get_channel_keys_id(&this_ptr_conv), 32);
61556         return ret_arr;
61557 }
61558
61559 void  __attribute__((export_name("TS_DelayedPaymentOutputDescriptor_set_channel_keys_id"))) TS_DelayedPaymentOutputDescriptor_set_channel_keys_id(uint64_t this_ptr, int8_tArray val) {
61560         LDKDelayedPaymentOutputDescriptor this_ptr_conv;
61561         this_ptr_conv.inner = untag_ptr(this_ptr);
61562         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
61563         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
61564         this_ptr_conv.is_owned = false;
61565         LDKThirtyTwoBytes val_ref;
61566         CHECK(val->arr_len == 32);
61567         memcpy(val_ref.data, val->elems, 32); FREE(val);
61568         DelayedPaymentOutputDescriptor_set_channel_keys_id(&this_ptr_conv, val_ref);
61569 }
61570
61571 int64_t  __attribute__((export_name("TS_DelayedPaymentOutputDescriptor_get_channel_value_satoshis"))) TS_DelayedPaymentOutputDescriptor_get_channel_value_satoshis(uint64_t this_ptr) {
61572         LDKDelayedPaymentOutputDescriptor this_ptr_conv;
61573         this_ptr_conv.inner = untag_ptr(this_ptr);
61574         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
61575         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
61576         this_ptr_conv.is_owned = false;
61577         int64_t ret_conv = DelayedPaymentOutputDescriptor_get_channel_value_satoshis(&this_ptr_conv);
61578         return ret_conv;
61579 }
61580
61581 void  __attribute__((export_name("TS_DelayedPaymentOutputDescriptor_set_channel_value_satoshis"))) TS_DelayedPaymentOutputDescriptor_set_channel_value_satoshis(uint64_t this_ptr, int64_t val) {
61582         LDKDelayedPaymentOutputDescriptor this_ptr_conv;
61583         this_ptr_conv.inner = untag_ptr(this_ptr);
61584         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
61585         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
61586         this_ptr_conv.is_owned = false;
61587         DelayedPaymentOutputDescriptor_set_channel_value_satoshis(&this_ptr_conv, val);
61588 }
61589
61590 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) {
61591         LDKOutPoint outpoint_arg_conv;
61592         outpoint_arg_conv.inner = untag_ptr(outpoint_arg);
61593         outpoint_arg_conv.is_owned = ptr_is_owned(outpoint_arg);
61594         CHECK_INNER_FIELD_ACCESS_OR_NULL(outpoint_arg_conv);
61595         outpoint_arg_conv = OutPoint_clone(&outpoint_arg_conv);
61596         LDKPublicKey per_commitment_point_arg_ref;
61597         CHECK(per_commitment_point_arg->arr_len == 33);
61598         memcpy(per_commitment_point_arg_ref.compressed_form, per_commitment_point_arg->elems, 33); FREE(per_commitment_point_arg);
61599         void* output_arg_ptr = untag_ptr(output_arg);
61600         CHECK_ACCESS(output_arg_ptr);
61601         LDKTxOut output_arg_conv = *(LDKTxOut*)(output_arg_ptr);
61602         output_arg_conv = TxOut_clone((LDKTxOut*)untag_ptr(output_arg));
61603         LDKPublicKey revocation_pubkey_arg_ref;
61604         CHECK(revocation_pubkey_arg->arr_len == 33);
61605         memcpy(revocation_pubkey_arg_ref.compressed_form, revocation_pubkey_arg->elems, 33); FREE(revocation_pubkey_arg);
61606         LDKThirtyTwoBytes channel_keys_id_arg_ref;
61607         CHECK(channel_keys_id_arg->arr_len == 32);
61608         memcpy(channel_keys_id_arg_ref.data, channel_keys_id_arg->elems, 32); FREE(channel_keys_id_arg);
61609         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);
61610         uint64_t ret_ref = 0;
61611         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
61612         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
61613         return ret_ref;
61614 }
61615
61616 static inline uint64_t DelayedPaymentOutputDescriptor_clone_ptr(LDKDelayedPaymentOutputDescriptor *NONNULL_PTR arg) {
61617         LDKDelayedPaymentOutputDescriptor ret_var = DelayedPaymentOutputDescriptor_clone(arg);
61618         uint64_t ret_ref = 0;
61619         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
61620         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
61621         return ret_ref;
61622 }
61623 int64_t  __attribute__((export_name("TS_DelayedPaymentOutputDescriptor_clone_ptr"))) TS_DelayedPaymentOutputDescriptor_clone_ptr(uint64_t arg) {
61624         LDKDelayedPaymentOutputDescriptor arg_conv;
61625         arg_conv.inner = untag_ptr(arg);
61626         arg_conv.is_owned = ptr_is_owned(arg);
61627         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
61628         arg_conv.is_owned = false;
61629         int64_t ret_conv = DelayedPaymentOutputDescriptor_clone_ptr(&arg_conv);
61630         return ret_conv;
61631 }
61632
61633 uint64_t  __attribute__((export_name("TS_DelayedPaymentOutputDescriptor_clone"))) TS_DelayedPaymentOutputDescriptor_clone(uint64_t orig) {
61634         LDKDelayedPaymentOutputDescriptor orig_conv;
61635         orig_conv.inner = untag_ptr(orig);
61636         orig_conv.is_owned = ptr_is_owned(orig);
61637         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
61638         orig_conv.is_owned = false;
61639         LDKDelayedPaymentOutputDescriptor ret_var = DelayedPaymentOutputDescriptor_clone(&orig_conv);
61640         uint64_t ret_ref = 0;
61641         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
61642         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
61643         return ret_ref;
61644 }
61645
61646 int64_t  __attribute__((export_name("TS_DelayedPaymentOutputDescriptor_hash"))) TS_DelayedPaymentOutputDescriptor_hash(uint64_t o) {
61647         LDKDelayedPaymentOutputDescriptor o_conv;
61648         o_conv.inner = untag_ptr(o);
61649         o_conv.is_owned = ptr_is_owned(o);
61650         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
61651         o_conv.is_owned = false;
61652         int64_t ret_conv = DelayedPaymentOutputDescriptor_hash(&o_conv);
61653         return ret_conv;
61654 }
61655
61656 jboolean  __attribute__((export_name("TS_DelayedPaymentOutputDescriptor_eq"))) TS_DelayedPaymentOutputDescriptor_eq(uint64_t a, uint64_t b) {
61657         LDKDelayedPaymentOutputDescriptor a_conv;
61658         a_conv.inner = untag_ptr(a);
61659         a_conv.is_owned = ptr_is_owned(a);
61660         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
61661         a_conv.is_owned = false;
61662         LDKDelayedPaymentOutputDescriptor b_conv;
61663         b_conv.inner = untag_ptr(b);
61664         b_conv.is_owned = ptr_is_owned(b);
61665         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
61666         b_conv.is_owned = false;
61667         jboolean ret_conv = DelayedPaymentOutputDescriptor_eq(&a_conv, &b_conv);
61668         return ret_conv;
61669 }
61670
61671 int8_tArray  __attribute__((export_name("TS_DelayedPaymentOutputDescriptor_write"))) TS_DelayedPaymentOutputDescriptor_write(uint64_t obj) {
61672         LDKDelayedPaymentOutputDescriptor obj_conv;
61673         obj_conv.inner = untag_ptr(obj);
61674         obj_conv.is_owned = ptr_is_owned(obj);
61675         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
61676         obj_conv.is_owned = false;
61677         LDKCVec_u8Z ret_var = DelayedPaymentOutputDescriptor_write(&obj_conv);
61678         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
61679         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
61680         CVec_u8Z_free(ret_var);
61681         return ret_arr;
61682 }
61683
61684 uint64_t  __attribute__((export_name("TS_DelayedPaymentOutputDescriptor_read"))) TS_DelayedPaymentOutputDescriptor_read(int8_tArray ser) {
61685         LDKu8slice ser_ref;
61686         ser_ref.datalen = ser->arr_len;
61687         ser_ref.data = ser->elems;
61688         LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ), "LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ");
61689         *ret_conv = DelayedPaymentOutputDescriptor_read(ser_ref);
61690         FREE(ser);
61691         return tag_ptr(ret_conv, true);
61692 }
61693
61694 void  __attribute__((export_name("TS_StaticPaymentOutputDescriptor_free"))) TS_StaticPaymentOutputDescriptor_free(uint64_t this_obj) {
61695         LDKStaticPaymentOutputDescriptor this_obj_conv;
61696         this_obj_conv.inner = untag_ptr(this_obj);
61697         this_obj_conv.is_owned = ptr_is_owned(this_obj);
61698         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
61699         StaticPaymentOutputDescriptor_free(this_obj_conv);
61700 }
61701
61702 uint64_t  __attribute__((export_name("TS_StaticPaymentOutputDescriptor_get_outpoint"))) TS_StaticPaymentOutputDescriptor_get_outpoint(uint64_t this_ptr) {
61703         LDKStaticPaymentOutputDescriptor this_ptr_conv;
61704         this_ptr_conv.inner = untag_ptr(this_ptr);
61705         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
61706         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
61707         this_ptr_conv.is_owned = false;
61708         LDKOutPoint ret_var = StaticPaymentOutputDescriptor_get_outpoint(&this_ptr_conv);
61709         uint64_t ret_ref = 0;
61710         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
61711         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
61712         return ret_ref;
61713 }
61714
61715 void  __attribute__((export_name("TS_StaticPaymentOutputDescriptor_set_outpoint"))) TS_StaticPaymentOutputDescriptor_set_outpoint(uint64_t this_ptr, uint64_t val) {
61716         LDKStaticPaymentOutputDescriptor this_ptr_conv;
61717         this_ptr_conv.inner = untag_ptr(this_ptr);
61718         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
61719         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
61720         this_ptr_conv.is_owned = false;
61721         LDKOutPoint val_conv;
61722         val_conv.inner = untag_ptr(val);
61723         val_conv.is_owned = ptr_is_owned(val);
61724         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
61725         val_conv = OutPoint_clone(&val_conv);
61726         StaticPaymentOutputDescriptor_set_outpoint(&this_ptr_conv, val_conv);
61727 }
61728
61729 uint64_t  __attribute__((export_name("TS_StaticPaymentOutputDescriptor_get_output"))) TS_StaticPaymentOutputDescriptor_get_output(uint64_t this_ptr) {
61730         LDKStaticPaymentOutputDescriptor this_ptr_conv;
61731         this_ptr_conv.inner = untag_ptr(this_ptr);
61732         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
61733         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
61734         this_ptr_conv.is_owned = false;
61735         LDKTxOut* ret_ref = MALLOC(sizeof(LDKTxOut), "LDKTxOut");
61736         *ret_ref = StaticPaymentOutputDescriptor_get_output(&this_ptr_conv);
61737         return tag_ptr(ret_ref, true);
61738 }
61739
61740 void  __attribute__((export_name("TS_StaticPaymentOutputDescriptor_set_output"))) TS_StaticPaymentOutputDescriptor_set_output(uint64_t this_ptr, uint64_t val) {
61741         LDKStaticPaymentOutputDescriptor this_ptr_conv;
61742         this_ptr_conv.inner = untag_ptr(this_ptr);
61743         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
61744         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
61745         this_ptr_conv.is_owned = false;
61746         void* val_ptr = untag_ptr(val);
61747         CHECK_ACCESS(val_ptr);
61748         LDKTxOut val_conv = *(LDKTxOut*)(val_ptr);
61749         val_conv = TxOut_clone((LDKTxOut*)untag_ptr(val));
61750         StaticPaymentOutputDescriptor_set_output(&this_ptr_conv, val_conv);
61751 }
61752
61753 int8_tArray  __attribute__((export_name("TS_StaticPaymentOutputDescriptor_get_channel_keys_id"))) TS_StaticPaymentOutputDescriptor_get_channel_keys_id(uint64_t this_ptr) {
61754         LDKStaticPaymentOutputDescriptor this_ptr_conv;
61755         this_ptr_conv.inner = untag_ptr(this_ptr);
61756         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
61757         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
61758         this_ptr_conv.is_owned = false;
61759         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
61760         memcpy(ret_arr->elems, *StaticPaymentOutputDescriptor_get_channel_keys_id(&this_ptr_conv), 32);
61761         return ret_arr;
61762 }
61763
61764 void  __attribute__((export_name("TS_StaticPaymentOutputDescriptor_set_channel_keys_id"))) TS_StaticPaymentOutputDescriptor_set_channel_keys_id(uint64_t this_ptr, int8_tArray val) {
61765         LDKStaticPaymentOutputDescriptor this_ptr_conv;
61766         this_ptr_conv.inner = untag_ptr(this_ptr);
61767         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
61768         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
61769         this_ptr_conv.is_owned = false;
61770         LDKThirtyTwoBytes val_ref;
61771         CHECK(val->arr_len == 32);
61772         memcpy(val_ref.data, val->elems, 32); FREE(val);
61773         StaticPaymentOutputDescriptor_set_channel_keys_id(&this_ptr_conv, val_ref);
61774 }
61775
61776 int64_t  __attribute__((export_name("TS_StaticPaymentOutputDescriptor_get_channel_value_satoshis"))) TS_StaticPaymentOutputDescriptor_get_channel_value_satoshis(uint64_t this_ptr) {
61777         LDKStaticPaymentOutputDescriptor this_ptr_conv;
61778         this_ptr_conv.inner = untag_ptr(this_ptr);
61779         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
61780         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
61781         this_ptr_conv.is_owned = false;
61782         int64_t ret_conv = StaticPaymentOutputDescriptor_get_channel_value_satoshis(&this_ptr_conv);
61783         return ret_conv;
61784 }
61785
61786 void  __attribute__((export_name("TS_StaticPaymentOutputDescriptor_set_channel_value_satoshis"))) TS_StaticPaymentOutputDescriptor_set_channel_value_satoshis(uint64_t this_ptr, int64_t val) {
61787         LDKStaticPaymentOutputDescriptor this_ptr_conv;
61788         this_ptr_conv.inner = untag_ptr(this_ptr);
61789         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
61790         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
61791         this_ptr_conv.is_owned = false;
61792         StaticPaymentOutputDescriptor_set_channel_value_satoshis(&this_ptr_conv, val);
61793 }
61794
61795 uint64_t  __attribute__((export_name("TS_StaticPaymentOutputDescriptor_get_channel_transaction_parameters"))) TS_StaticPaymentOutputDescriptor_get_channel_transaction_parameters(uint64_t this_ptr) {
61796         LDKStaticPaymentOutputDescriptor this_ptr_conv;
61797         this_ptr_conv.inner = untag_ptr(this_ptr);
61798         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
61799         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
61800         this_ptr_conv.is_owned = false;
61801         LDKChannelTransactionParameters ret_var = StaticPaymentOutputDescriptor_get_channel_transaction_parameters(&this_ptr_conv);
61802         uint64_t ret_ref = 0;
61803         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
61804         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
61805         return ret_ref;
61806 }
61807
61808 void  __attribute__((export_name("TS_StaticPaymentOutputDescriptor_set_channel_transaction_parameters"))) TS_StaticPaymentOutputDescriptor_set_channel_transaction_parameters(uint64_t this_ptr, uint64_t val) {
61809         LDKStaticPaymentOutputDescriptor this_ptr_conv;
61810         this_ptr_conv.inner = untag_ptr(this_ptr);
61811         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
61812         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
61813         this_ptr_conv.is_owned = false;
61814         LDKChannelTransactionParameters val_conv;
61815         val_conv.inner = untag_ptr(val);
61816         val_conv.is_owned = ptr_is_owned(val);
61817         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
61818         val_conv = ChannelTransactionParameters_clone(&val_conv);
61819         StaticPaymentOutputDescriptor_set_channel_transaction_parameters(&this_ptr_conv, val_conv);
61820 }
61821
61822 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, uint64_t channel_transaction_parameters_arg) {
61823         LDKOutPoint outpoint_arg_conv;
61824         outpoint_arg_conv.inner = untag_ptr(outpoint_arg);
61825         outpoint_arg_conv.is_owned = ptr_is_owned(outpoint_arg);
61826         CHECK_INNER_FIELD_ACCESS_OR_NULL(outpoint_arg_conv);
61827         outpoint_arg_conv = OutPoint_clone(&outpoint_arg_conv);
61828         void* output_arg_ptr = untag_ptr(output_arg);
61829         CHECK_ACCESS(output_arg_ptr);
61830         LDKTxOut output_arg_conv = *(LDKTxOut*)(output_arg_ptr);
61831         output_arg_conv = TxOut_clone((LDKTxOut*)untag_ptr(output_arg));
61832         LDKThirtyTwoBytes channel_keys_id_arg_ref;
61833         CHECK(channel_keys_id_arg->arr_len == 32);
61834         memcpy(channel_keys_id_arg_ref.data, channel_keys_id_arg->elems, 32); FREE(channel_keys_id_arg);
61835         LDKChannelTransactionParameters channel_transaction_parameters_arg_conv;
61836         channel_transaction_parameters_arg_conv.inner = untag_ptr(channel_transaction_parameters_arg);
61837         channel_transaction_parameters_arg_conv.is_owned = ptr_is_owned(channel_transaction_parameters_arg);
61838         CHECK_INNER_FIELD_ACCESS_OR_NULL(channel_transaction_parameters_arg_conv);
61839         channel_transaction_parameters_arg_conv = ChannelTransactionParameters_clone(&channel_transaction_parameters_arg_conv);
61840         LDKStaticPaymentOutputDescriptor ret_var = StaticPaymentOutputDescriptor_new(outpoint_arg_conv, output_arg_conv, channel_keys_id_arg_ref, channel_value_satoshis_arg, channel_transaction_parameters_arg_conv);
61841         uint64_t ret_ref = 0;
61842         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
61843         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
61844         return ret_ref;
61845 }
61846
61847 static inline uint64_t StaticPaymentOutputDescriptor_clone_ptr(LDKStaticPaymentOutputDescriptor *NONNULL_PTR arg) {
61848         LDKStaticPaymentOutputDescriptor ret_var = StaticPaymentOutputDescriptor_clone(arg);
61849         uint64_t ret_ref = 0;
61850         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
61851         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
61852         return ret_ref;
61853 }
61854 int64_t  __attribute__((export_name("TS_StaticPaymentOutputDescriptor_clone_ptr"))) TS_StaticPaymentOutputDescriptor_clone_ptr(uint64_t arg) {
61855         LDKStaticPaymentOutputDescriptor arg_conv;
61856         arg_conv.inner = untag_ptr(arg);
61857         arg_conv.is_owned = ptr_is_owned(arg);
61858         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
61859         arg_conv.is_owned = false;
61860         int64_t ret_conv = StaticPaymentOutputDescriptor_clone_ptr(&arg_conv);
61861         return ret_conv;
61862 }
61863
61864 uint64_t  __attribute__((export_name("TS_StaticPaymentOutputDescriptor_clone"))) TS_StaticPaymentOutputDescriptor_clone(uint64_t orig) {
61865         LDKStaticPaymentOutputDescriptor orig_conv;
61866         orig_conv.inner = untag_ptr(orig);
61867         orig_conv.is_owned = ptr_is_owned(orig);
61868         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
61869         orig_conv.is_owned = false;
61870         LDKStaticPaymentOutputDescriptor ret_var = StaticPaymentOutputDescriptor_clone(&orig_conv);
61871         uint64_t ret_ref = 0;
61872         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
61873         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
61874         return ret_ref;
61875 }
61876
61877 int64_t  __attribute__((export_name("TS_StaticPaymentOutputDescriptor_hash"))) TS_StaticPaymentOutputDescriptor_hash(uint64_t o) {
61878         LDKStaticPaymentOutputDescriptor o_conv;
61879         o_conv.inner = untag_ptr(o);
61880         o_conv.is_owned = ptr_is_owned(o);
61881         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
61882         o_conv.is_owned = false;
61883         int64_t ret_conv = StaticPaymentOutputDescriptor_hash(&o_conv);
61884         return ret_conv;
61885 }
61886
61887 jboolean  __attribute__((export_name("TS_StaticPaymentOutputDescriptor_eq"))) TS_StaticPaymentOutputDescriptor_eq(uint64_t a, uint64_t b) {
61888         LDKStaticPaymentOutputDescriptor a_conv;
61889         a_conv.inner = untag_ptr(a);
61890         a_conv.is_owned = ptr_is_owned(a);
61891         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
61892         a_conv.is_owned = false;
61893         LDKStaticPaymentOutputDescriptor b_conv;
61894         b_conv.inner = untag_ptr(b);
61895         b_conv.is_owned = ptr_is_owned(b);
61896         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
61897         b_conv.is_owned = false;
61898         jboolean ret_conv = StaticPaymentOutputDescriptor_eq(&a_conv, &b_conv);
61899         return ret_conv;
61900 }
61901
61902 uint64_t  __attribute__((export_name("TS_StaticPaymentOutputDescriptor_witness_script"))) TS_StaticPaymentOutputDescriptor_witness_script(uint64_t this_arg) {
61903         LDKStaticPaymentOutputDescriptor this_arg_conv;
61904         this_arg_conv.inner = untag_ptr(this_arg);
61905         this_arg_conv.is_owned = ptr_is_owned(this_arg);
61906         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
61907         this_arg_conv.is_owned = false;
61908         LDKCOption_CVec_u8ZZ *ret_copy = MALLOC(sizeof(LDKCOption_CVec_u8ZZ), "LDKCOption_CVec_u8ZZ");
61909         *ret_copy = StaticPaymentOutputDescriptor_witness_script(&this_arg_conv);
61910         uint64_t ret_ref = tag_ptr(ret_copy, true);
61911         return ret_ref;
61912 }
61913
61914 uint32_t  __attribute__((export_name("TS_StaticPaymentOutputDescriptor_max_witness_length"))) TS_StaticPaymentOutputDescriptor_max_witness_length(uint64_t this_arg) {
61915         LDKStaticPaymentOutputDescriptor this_arg_conv;
61916         this_arg_conv.inner = untag_ptr(this_arg);
61917         this_arg_conv.is_owned = ptr_is_owned(this_arg);
61918         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
61919         this_arg_conv.is_owned = false;
61920         uint32_t ret_conv = StaticPaymentOutputDescriptor_max_witness_length(&this_arg_conv);
61921         return ret_conv;
61922 }
61923
61924 int8_tArray  __attribute__((export_name("TS_StaticPaymentOutputDescriptor_write"))) TS_StaticPaymentOutputDescriptor_write(uint64_t obj) {
61925         LDKStaticPaymentOutputDescriptor obj_conv;
61926         obj_conv.inner = untag_ptr(obj);
61927         obj_conv.is_owned = ptr_is_owned(obj);
61928         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
61929         obj_conv.is_owned = false;
61930         LDKCVec_u8Z ret_var = StaticPaymentOutputDescriptor_write(&obj_conv);
61931         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
61932         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
61933         CVec_u8Z_free(ret_var);
61934         return ret_arr;
61935 }
61936
61937 uint64_t  __attribute__((export_name("TS_StaticPaymentOutputDescriptor_read"))) TS_StaticPaymentOutputDescriptor_read(int8_tArray ser) {
61938         LDKu8slice ser_ref;
61939         ser_ref.datalen = ser->arr_len;
61940         ser_ref.data = ser->elems;
61941         LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ), "LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ");
61942         *ret_conv = StaticPaymentOutputDescriptor_read(ser_ref);
61943         FREE(ser);
61944         return tag_ptr(ret_conv, true);
61945 }
61946
61947 void  __attribute__((export_name("TS_SpendableOutputDescriptor_free"))) TS_SpendableOutputDescriptor_free(uint64_t this_ptr) {
61948         if (!ptr_is_owned(this_ptr)) return;
61949         void* this_ptr_ptr = untag_ptr(this_ptr);
61950         CHECK_ACCESS(this_ptr_ptr);
61951         LDKSpendableOutputDescriptor this_ptr_conv = *(LDKSpendableOutputDescriptor*)(this_ptr_ptr);
61952         FREE(untag_ptr(this_ptr));
61953         SpendableOutputDescriptor_free(this_ptr_conv);
61954 }
61955
61956 static inline uint64_t SpendableOutputDescriptor_clone_ptr(LDKSpendableOutputDescriptor *NONNULL_PTR arg) {
61957         LDKSpendableOutputDescriptor *ret_copy = MALLOC(sizeof(LDKSpendableOutputDescriptor), "LDKSpendableOutputDescriptor");
61958         *ret_copy = SpendableOutputDescriptor_clone(arg);
61959         uint64_t ret_ref = tag_ptr(ret_copy, true);
61960         return ret_ref;
61961 }
61962 int64_t  __attribute__((export_name("TS_SpendableOutputDescriptor_clone_ptr"))) TS_SpendableOutputDescriptor_clone_ptr(uint64_t arg) {
61963         LDKSpendableOutputDescriptor* arg_conv = (LDKSpendableOutputDescriptor*)untag_ptr(arg);
61964         int64_t ret_conv = SpendableOutputDescriptor_clone_ptr(arg_conv);
61965         return ret_conv;
61966 }
61967
61968 uint64_t  __attribute__((export_name("TS_SpendableOutputDescriptor_clone"))) TS_SpendableOutputDescriptor_clone(uint64_t orig) {
61969         LDKSpendableOutputDescriptor* orig_conv = (LDKSpendableOutputDescriptor*)untag_ptr(orig);
61970         LDKSpendableOutputDescriptor *ret_copy = MALLOC(sizeof(LDKSpendableOutputDescriptor), "LDKSpendableOutputDescriptor");
61971         *ret_copy = SpendableOutputDescriptor_clone(orig_conv);
61972         uint64_t ret_ref = tag_ptr(ret_copy, true);
61973         return ret_ref;
61974 }
61975
61976 uint64_t  __attribute__((export_name("TS_SpendableOutputDescriptor_static_output"))) TS_SpendableOutputDescriptor_static_output(uint64_t outpoint, uint64_t output) {
61977         LDKOutPoint outpoint_conv;
61978         outpoint_conv.inner = untag_ptr(outpoint);
61979         outpoint_conv.is_owned = ptr_is_owned(outpoint);
61980         CHECK_INNER_FIELD_ACCESS_OR_NULL(outpoint_conv);
61981         outpoint_conv = OutPoint_clone(&outpoint_conv);
61982         void* output_ptr = untag_ptr(output);
61983         CHECK_ACCESS(output_ptr);
61984         LDKTxOut output_conv = *(LDKTxOut*)(output_ptr);
61985         output_conv = TxOut_clone((LDKTxOut*)untag_ptr(output));
61986         LDKSpendableOutputDescriptor *ret_copy = MALLOC(sizeof(LDKSpendableOutputDescriptor), "LDKSpendableOutputDescriptor");
61987         *ret_copy = SpendableOutputDescriptor_static_output(outpoint_conv, output_conv);
61988         uint64_t ret_ref = tag_ptr(ret_copy, true);
61989         return ret_ref;
61990 }
61991
61992 uint64_t  __attribute__((export_name("TS_SpendableOutputDescriptor_delayed_payment_output"))) TS_SpendableOutputDescriptor_delayed_payment_output(uint64_t a) {
61993         LDKDelayedPaymentOutputDescriptor a_conv;
61994         a_conv.inner = untag_ptr(a);
61995         a_conv.is_owned = ptr_is_owned(a);
61996         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
61997         a_conv = DelayedPaymentOutputDescriptor_clone(&a_conv);
61998         LDKSpendableOutputDescriptor *ret_copy = MALLOC(sizeof(LDKSpendableOutputDescriptor), "LDKSpendableOutputDescriptor");
61999         *ret_copy = SpendableOutputDescriptor_delayed_payment_output(a_conv);
62000         uint64_t ret_ref = tag_ptr(ret_copy, true);
62001         return ret_ref;
62002 }
62003
62004 uint64_t  __attribute__((export_name("TS_SpendableOutputDescriptor_static_payment_output"))) TS_SpendableOutputDescriptor_static_payment_output(uint64_t a) {
62005         LDKStaticPaymentOutputDescriptor a_conv;
62006         a_conv.inner = untag_ptr(a);
62007         a_conv.is_owned = ptr_is_owned(a);
62008         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
62009         a_conv = StaticPaymentOutputDescriptor_clone(&a_conv);
62010         LDKSpendableOutputDescriptor *ret_copy = MALLOC(sizeof(LDKSpendableOutputDescriptor), "LDKSpendableOutputDescriptor");
62011         *ret_copy = SpendableOutputDescriptor_static_payment_output(a_conv);
62012         uint64_t ret_ref = tag_ptr(ret_copy, true);
62013         return ret_ref;
62014 }
62015
62016 int64_t  __attribute__((export_name("TS_SpendableOutputDescriptor_hash"))) TS_SpendableOutputDescriptor_hash(uint64_t o) {
62017         LDKSpendableOutputDescriptor* o_conv = (LDKSpendableOutputDescriptor*)untag_ptr(o);
62018         int64_t ret_conv = SpendableOutputDescriptor_hash(o_conv);
62019         return ret_conv;
62020 }
62021
62022 jboolean  __attribute__((export_name("TS_SpendableOutputDescriptor_eq"))) TS_SpendableOutputDescriptor_eq(uint64_t a, uint64_t b) {
62023         LDKSpendableOutputDescriptor* a_conv = (LDKSpendableOutputDescriptor*)untag_ptr(a);
62024         LDKSpendableOutputDescriptor* b_conv = (LDKSpendableOutputDescriptor*)untag_ptr(b);
62025         jboolean ret_conv = SpendableOutputDescriptor_eq(a_conv, b_conv);
62026         return ret_conv;
62027 }
62028
62029 int8_tArray  __attribute__((export_name("TS_SpendableOutputDescriptor_write"))) TS_SpendableOutputDescriptor_write(uint64_t obj) {
62030         LDKSpendableOutputDescriptor* obj_conv = (LDKSpendableOutputDescriptor*)untag_ptr(obj);
62031         LDKCVec_u8Z ret_var = SpendableOutputDescriptor_write(obj_conv);
62032         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
62033         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
62034         CVec_u8Z_free(ret_var);
62035         return ret_arr;
62036 }
62037
62038 uint64_t  __attribute__((export_name("TS_SpendableOutputDescriptor_read"))) TS_SpendableOutputDescriptor_read(int8_tArray ser) {
62039         LDKu8slice ser_ref;
62040         ser_ref.datalen = ser->arr_len;
62041         ser_ref.data = ser->elems;
62042         LDKCResult_SpendableOutputDescriptorDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_SpendableOutputDescriptorDecodeErrorZ), "LDKCResult_SpendableOutputDescriptorDecodeErrorZ");
62043         *ret_conv = SpendableOutputDescriptor_read(ser_ref);
62044         FREE(ser);
62045         return tag_ptr(ret_conv, true);
62046 }
62047
62048 uint64_t  __attribute__((export_name("TS_SpendableOutputDescriptor_create_spendable_outputs_psbt"))) TS_SpendableOutputDescriptor_create_spendable_outputs_psbt(uint64_tArray descriptors, uint64_tArray outputs, int8_tArray change_destination_script, int32_t feerate_sat_per_1000_weight, uint64_t locktime) {
62049         LDKCVec_SpendableOutputDescriptorZ descriptors_constr;
62050         descriptors_constr.datalen = descriptors->arr_len;
62051         if (descriptors_constr.datalen > 0)
62052                 descriptors_constr.data = MALLOC(descriptors_constr.datalen * sizeof(LDKSpendableOutputDescriptor), "LDKCVec_SpendableOutputDescriptorZ Elements");
62053         else
62054                 descriptors_constr.data = NULL;
62055         uint64_t* descriptors_vals = descriptors->elems;
62056         for (size_t b = 0; b < descriptors_constr.datalen; b++) {
62057                 uint64_t descriptors_conv_27 = descriptors_vals[b];
62058                 void* descriptors_conv_27_ptr = untag_ptr(descriptors_conv_27);
62059                 CHECK_ACCESS(descriptors_conv_27_ptr);
62060                 LDKSpendableOutputDescriptor descriptors_conv_27_conv = *(LDKSpendableOutputDescriptor*)(descriptors_conv_27_ptr);
62061                 descriptors_conv_27_conv = SpendableOutputDescriptor_clone((LDKSpendableOutputDescriptor*)untag_ptr(descriptors_conv_27));
62062                 descriptors_constr.data[b] = descriptors_conv_27_conv;
62063         }
62064         FREE(descriptors);
62065         LDKCVec_TxOutZ outputs_constr;
62066         outputs_constr.datalen = outputs->arr_len;
62067         if (outputs_constr.datalen > 0)
62068                 outputs_constr.data = MALLOC(outputs_constr.datalen * sizeof(LDKTxOut), "LDKCVec_TxOutZ Elements");
62069         else
62070                 outputs_constr.data = NULL;
62071         uint64_t* outputs_vals = outputs->elems;
62072         for (size_t h = 0; h < outputs_constr.datalen; h++) {
62073                 uint64_t outputs_conv_7 = outputs_vals[h];
62074                 void* outputs_conv_7_ptr = untag_ptr(outputs_conv_7);
62075                 CHECK_ACCESS(outputs_conv_7_ptr);
62076                 LDKTxOut outputs_conv_7_conv = *(LDKTxOut*)(outputs_conv_7_ptr);
62077                 outputs_conv_7_conv = TxOut_clone((LDKTxOut*)untag_ptr(outputs_conv_7));
62078                 outputs_constr.data[h] = outputs_conv_7_conv;
62079         }
62080         FREE(outputs);
62081         LDKCVec_u8Z change_destination_script_ref;
62082         change_destination_script_ref.datalen = change_destination_script->arr_len;
62083         change_destination_script_ref.data = MALLOC(change_destination_script_ref.datalen, "LDKCVec_u8Z Bytes");
62084         memcpy(change_destination_script_ref.data, change_destination_script->elems, change_destination_script_ref.datalen); FREE(change_destination_script);
62085         void* locktime_ptr = untag_ptr(locktime);
62086         CHECK_ACCESS(locktime_ptr);
62087         LDKCOption_u32Z locktime_conv = *(LDKCOption_u32Z*)(locktime_ptr);
62088         locktime_conv = COption_u32Z_clone((LDKCOption_u32Z*)untag_ptr(locktime));
62089         LDKCResult_C2Tuple_CVec_u8ZusizeZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_CVec_u8ZusizeZNoneZ), "LDKCResult_C2Tuple_CVec_u8ZusizeZNoneZ");
62090         *ret_conv = SpendableOutputDescriptor_create_spendable_outputs_psbt(descriptors_constr, outputs_constr, change_destination_script_ref, feerate_sat_per_1000_weight, locktime_conv);
62091         return tag_ptr(ret_conv, true);
62092 }
62093
62094 void  __attribute__((export_name("TS_ChannelDerivationParameters_free"))) TS_ChannelDerivationParameters_free(uint64_t this_obj) {
62095         LDKChannelDerivationParameters this_obj_conv;
62096         this_obj_conv.inner = untag_ptr(this_obj);
62097         this_obj_conv.is_owned = ptr_is_owned(this_obj);
62098         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
62099         ChannelDerivationParameters_free(this_obj_conv);
62100 }
62101
62102 int64_t  __attribute__((export_name("TS_ChannelDerivationParameters_get_value_satoshis"))) TS_ChannelDerivationParameters_get_value_satoshis(uint64_t this_ptr) {
62103         LDKChannelDerivationParameters this_ptr_conv;
62104         this_ptr_conv.inner = untag_ptr(this_ptr);
62105         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
62106         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
62107         this_ptr_conv.is_owned = false;
62108         int64_t ret_conv = ChannelDerivationParameters_get_value_satoshis(&this_ptr_conv);
62109         return ret_conv;
62110 }
62111
62112 void  __attribute__((export_name("TS_ChannelDerivationParameters_set_value_satoshis"))) TS_ChannelDerivationParameters_set_value_satoshis(uint64_t this_ptr, int64_t val) {
62113         LDKChannelDerivationParameters this_ptr_conv;
62114         this_ptr_conv.inner = untag_ptr(this_ptr);
62115         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
62116         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
62117         this_ptr_conv.is_owned = false;
62118         ChannelDerivationParameters_set_value_satoshis(&this_ptr_conv, val);
62119 }
62120
62121 int8_tArray  __attribute__((export_name("TS_ChannelDerivationParameters_get_keys_id"))) TS_ChannelDerivationParameters_get_keys_id(uint64_t this_ptr) {
62122         LDKChannelDerivationParameters this_ptr_conv;
62123         this_ptr_conv.inner = untag_ptr(this_ptr);
62124         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
62125         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
62126         this_ptr_conv.is_owned = false;
62127         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
62128         memcpy(ret_arr->elems, *ChannelDerivationParameters_get_keys_id(&this_ptr_conv), 32);
62129         return ret_arr;
62130 }
62131
62132 void  __attribute__((export_name("TS_ChannelDerivationParameters_set_keys_id"))) TS_ChannelDerivationParameters_set_keys_id(uint64_t this_ptr, int8_tArray val) {
62133         LDKChannelDerivationParameters this_ptr_conv;
62134         this_ptr_conv.inner = untag_ptr(this_ptr);
62135         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
62136         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
62137         this_ptr_conv.is_owned = false;
62138         LDKThirtyTwoBytes val_ref;
62139         CHECK(val->arr_len == 32);
62140         memcpy(val_ref.data, val->elems, 32); FREE(val);
62141         ChannelDerivationParameters_set_keys_id(&this_ptr_conv, val_ref);
62142 }
62143
62144 uint64_t  __attribute__((export_name("TS_ChannelDerivationParameters_get_transaction_parameters"))) TS_ChannelDerivationParameters_get_transaction_parameters(uint64_t this_ptr) {
62145         LDKChannelDerivationParameters this_ptr_conv;
62146         this_ptr_conv.inner = untag_ptr(this_ptr);
62147         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
62148         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
62149         this_ptr_conv.is_owned = false;
62150         LDKChannelTransactionParameters ret_var = ChannelDerivationParameters_get_transaction_parameters(&this_ptr_conv);
62151         uint64_t ret_ref = 0;
62152         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
62153         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
62154         return ret_ref;
62155 }
62156
62157 void  __attribute__((export_name("TS_ChannelDerivationParameters_set_transaction_parameters"))) TS_ChannelDerivationParameters_set_transaction_parameters(uint64_t this_ptr, uint64_t val) {
62158         LDKChannelDerivationParameters this_ptr_conv;
62159         this_ptr_conv.inner = untag_ptr(this_ptr);
62160         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
62161         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
62162         this_ptr_conv.is_owned = false;
62163         LDKChannelTransactionParameters val_conv;
62164         val_conv.inner = untag_ptr(val);
62165         val_conv.is_owned = ptr_is_owned(val);
62166         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
62167         val_conv = ChannelTransactionParameters_clone(&val_conv);
62168         ChannelDerivationParameters_set_transaction_parameters(&this_ptr_conv, val_conv);
62169 }
62170
62171 uint64_t  __attribute__((export_name("TS_ChannelDerivationParameters_new"))) TS_ChannelDerivationParameters_new(int64_t value_satoshis_arg, int8_tArray keys_id_arg, uint64_t transaction_parameters_arg) {
62172         LDKThirtyTwoBytes keys_id_arg_ref;
62173         CHECK(keys_id_arg->arr_len == 32);
62174         memcpy(keys_id_arg_ref.data, keys_id_arg->elems, 32); FREE(keys_id_arg);
62175         LDKChannelTransactionParameters transaction_parameters_arg_conv;
62176         transaction_parameters_arg_conv.inner = untag_ptr(transaction_parameters_arg);
62177         transaction_parameters_arg_conv.is_owned = ptr_is_owned(transaction_parameters_arg);
62178         CHECK_INNER_FIELD_ACCESS_OR_NULL(transaction_parameters_arg_conv);
62179         transaction_parameters_arg_conv = ChannelTransactionParameters_clone(&transaction_parameters_arg_conv);
62180         LDKChannelDerivationParameters ret_var = ChannelDerivationParameters_new(value_satoshis_arg, keys_id_arg_ref, transaction_parameters_arg_conv);
62181         uint64_t ret_ref = 0;
62182         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
62183         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
62184         return ret_ref;
62185 }
62186
62187 static inline uint64_t ChannelDerivationParameters_clone_ptr(LDKChannelDerivationParameters *NONNULL_PTR arg) {
62188         LDKChannelDerivationParameters ret_var = ChannelDerivationParameters_clone(arg);
62189         uint64_t ret_ref = 0;
62190         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
62191         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
62192         return ret_ref;
62193 }
62194 int64_t  __attribute__((export_name("TS_ChannelDerivationParameters_clone_ptr"))) TS_ChannelDerivationParameters_clone_ptr(uint64_t arg) {
62195         LDKChannelDerivationParameters arg_conv;
62196         arg_conv.inner = untag_ptr(arg);
62197         arg_conv.is_owned = ptr_is_owned(arg);
62198         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
62199         arg_conv.is_owned = false;
62200         int64_t ret_conv = ChannelDerivationParameters_clone_ptr(&arg_conv);
62201         return ret_conv;
62202 }
62203
62204 uint64_t  __attribute__((export_name("TS_ChannelDerivationParameters_clone"))) TS_ChannelDerivationParameters_clone(uint64_t orig) {
62205         LDKChannelDerivationParameters orig_conv;
62206         orig_conv.inner = untag_ptr(orig);
62207         orig_conv.is_owned = ptr_is_owned(orig);
62208         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
62209         orig_conv.is_owned = false;
62210         LDKChannelDerivationParameters ret_var = ChannelDerivationParameters_clone(&orig_conv);
62211         uint64_t ret_ref = 0;
62212         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
62213         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
62214         return ret_ref;
62215 }
62216
62217 jboolean  __attribute__((export_name("TS_ChannelDerivationParameters_eq"))) TS_ChannelDerivationParameters_eq(uint64_t a, uint64_t b) {
62218         LDKChannelDerivationParameters a_conv;
62219         a_conv.inner = untag_ptr(a);
62220         a_conv.is_owned = ptr_is_owned(a);
62221         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
62222         a_conv.is_owned = false;
62223         LDKChannelDerivationParameters b_conv;
62224         b_conv.inner = untag_ptr(b);
62225         b_conv.is_owned = ptr_is_owned(b);
62226         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
62227         b_conv.is_owned = false;
62228         jboolean ret_conv = ChannelDerivationParameters_eq(&a_conv, &b_conv);
62229         return ret_conv;
62230 }
62231
62232 int8_tArray  __attribute__((export_name("TS_ChannelDerivationParameters_write"))) TS_ChannelDerivationParameters_write(uint64_t obj) {
62233         LDKChannelDerivationParameters obj_conv;
62234         obj_conv.inner = untag_ptr(obj);
62235         obj_conv.is_owned = ptr_is_owned(obj);
62236         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
62237         obj_conv.is_owned = false;
62238         LDKCVec_u8Z ret_var = ChannelDerivationParameters_write(&obj_conv);
62239         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
62240         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
62241         CVec_u8Z_free(ret_var);
62242         return ret_arr;
62243 }
62244
62245 uint64_t  __attribute__((export_name("TS_ChannelDerivationParameters_read"))) TS_ChannelDerivationParameters_read(int8_tArray ser) {
62246         LDKu8slice ser_ref;
62247         ser_ref.datalen = ser->arr_len;
62248         ser_ref.data = ser->elems;
62249         LDKCResult_ChannelDerivationParametersDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelDerivationParametersDecodeErrorZ), "LDKCResult_ChannelDerivationParametersDecodeErrorZ");
62250         *ret_conv = ChannelDerivationParameters_read(ser_ref);
62251         FREE(ser);
62252         return tag_ptr(ret_conv, true);
62253 }
62254
62255 void  __attribute__((export_name("TS_HTLCDescriptor_free"))) TS_HTLCDescriptor_free(uint64_t this_obj) {
62256         LDKHTLCDescriptor this_obj_conv;
62257         this_obj_conv.inner = untag_ptr(this_obj);
62258         this_obj_conv.is_owned = ptr_is_owned(this_obj);
62259         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
62260         HTLCDescriptor_free(this_obj_conv);
62261 }
62262
62263 uint64_t  __attribute__((export_name("TS_HTLCDescriptor_get_channel_derivation_parameters"))) TS_HTLCDescriptor_get_channel_derivation_parameters(uint64_t this_ptr) {
62264         LDKHTLCDescriptor this_ptr_conv;
62265         this_ptr_conv.inner = untag_ptr(this_ptr);
62266         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
62267         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
62268         this_ptr_conv.is_owned = false;
62269         LDKChannelDerivationParameters ret_var = HTLCDescriptor_get_channel_derivation_parameters(&this_ptr_conv);
62270         uint64_t ret_ref = 0;
62271         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
62272         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
62273         return ret_ref;
62274 }
62275
62276 void  __attribute__((export_name("TS_HTLCDescriptor_set_channel_derivation_parameters"))) TS_HTLCDescriptor_set_channel_derivation_parameters(uint64_t this_ptr, uint64_t val) {
62277         LDKHTLCDescriptor this_ptr_conv;
62278         this_ptr_conv.inner = untag_ptr(this_ptr);
62279         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
62280         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
62281         this_ptr_conv.is_owned = false;
62282         LDKChannelDerivationParameters val_conv;
62283         val_conv.inner = untag_ptr(val);
62284         val_conv.is_owned = ptr_is_owned(val);
62285         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
62286         val_conv = ChannelDerivationParameters_clone(&val_conv);
62287         HTLCDescriptor_set_channel_derivation_parameters(&this_ptr_conv, val_conv);
62288 }
62289
62290 int64_t  __attribute__((export_name("TS_HTLCDescriptor_get_per_commitment_number"))) TS_HTLCDescriptor_get_per_commitment_number(uint64_t this_ptr) {
62291         LDKHTLCDescriptor this_ptr_conv;
62292         this_ptr_conv.inner = untag_ptr(this_ptr);
62293         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
62294         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
62295         this_ptr_conv.is_owned = false;
62296         int64_t ret_conv = HTLCDescriptor_get_per_commitment_number(&this_ptr_conv);
62297         return ret_conv;
62298 }
62299
62300 void  __attribute__((export_name("TS_HTLCDescriptor_set_per_commitment_number"))) TS_HTLCDescriptor_set_per_commitment_number(uint64_t this_ptr, int64_t val) {
62301         LDKHTLCDescriptor this_ptr_conv;
62302         this_ptr_conv.inner = untag_ptr(this_ptr);
62303         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
62304         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
62305         this_ptr_conv.is_owned = false;
62306         HTLCDescriptor_set_per_commitment_number(&this_ptr_conv, val);
62307 }
62308
62309 int8_tArray  __attribute__((export_name("TS_HTLCDescriptor_get_per_commitment_point"))) TS_HTLCDescriptor_get_per_commitment_point(uint64_t this_ptr) {
62310         LDKHTLCDescriptor this_ptr_conv;
62311         this_ptr_conv.inner = untag_ptr(this_ptr);
62312         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
62313         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
62314         this_ptr_conv.is_owned = false;
62315         int8_tArray ret_arr = init_int8_tArray(33, __LINE__);
62316         memcpy(ret_arr->elems, HTLCDescriptor_get_per_commitment_point(&this_ptr_conv).compressed_form, 33);
62317         return ret_arr;
62318 }
62319
62320 void  __attribute__((export_name("TS_HTLCDescriptor_set_per_commitment_point"))) TS_HTLCDescriptor_set_per_commitment_point(uint64_t this_ptr, int8_tArray val) {
62321         LDKHTLCDescriptor this_ptr_conv;
62322         this_ptr_conv.inner = untag_ptr(this_ptr);
62323         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
62324         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
62325         this_ptr_conv.is_owned = false;
62326         LDKPublicKey val_ref;
62327         CHECK(val->arr_len == 33);
62328         memcpy(val_ref.compressed_form, val->elems, 33); FREE(val);
62329         HTLCDescriptor_set_per_commitment_point(&this_ptr_conv, val_ref);
62330 }
62331
62332 int32_t  __attribute__((export_name("TS_HTLCDescriptor_get_feerate_per_kw"))) TS_HTLCDescriptor_get_feerate_per_kw(uint64_t this_ptr) {
62333         LDKHTLCDescriptor this_ptr_conv;
62334         this_ptr_conv.inner = untag_ptr(this_ptr);
62335         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
62336         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
62337         this_ptr_conv.is_owned = false;
62338         int32_t ret_conv = HTLCDescriptor_get_feerate_per_kw(&this_ptr_conv);
62339         return ret_conv;
62340 }
62341
62342 void  __attribute__((export_name("TS_HTLCDescriptor_set_feerate_per_kw"))) TS_HTLCDescriptor_set_feerate_per_kw(uint64_t this_ptr, int32_t val) {
62343         LDKHTLCDescriptor this_ptr_conv;
62344         this_ptr_conv.inner = untag_ptr(this_ptr);
62345         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
62346         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
62347         this_ptr_conv.is_owned = false;
62348         HTLCDescriptor_set_feerate_per_kw(&this_ptr_conv, val);
62349 }
62350
62351 uint64_t  __attribute__((export_name("TS_HTLCDescriptor_get_htlc"))) TS_HTLCDescriptor_get_htlc(uint64_t this_ptr) {
62352         LDKHTLCDescriptor this_ptr_conv;
62353         this_ptr_conv.inner = untag_ptr(this_ptr);
62354         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
62355         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
62356         this_ptr_conv.is_owned = false;
62357         LDKHTLCOutputInCommitment ret_var = HTLCDescriptor_get_htlc(&this_ptr_conv);
62358         uint64_t ret_ref = 0;
62359         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
62360         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
62361         return ret_ref;
62362 }
62363
62364 void  __attribute__((export_name("TS_HTLCDescriptor_set_htlc"))) TS_HTLCDescriptor_set_htlc(uint64_t this_ptr, uint64_t val) {
62365         LDKHTLCDescriptor this_ptr_conv;
62366         this_ptr_conv.inner = untag_ptr(this_ptr);
62367         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
62368         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
62369         this_ptr_conv.is_owned = false;
62370         LDKHTLCOutputInCommitment val_conv;
62371         val_conv.inner = untag_ptr(val);
62372         val_conv.is_owned = ptr_is_owned(val);
62373         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
62374         val_conv = HTLCOutputInCommitment_clone(&val_conv);
62375         HTLCDescriptor_set_htlc(&this_ptr_conv, val_conv);
62376 }
62377
62378 uint64_t  __attribute__((export_name("TS_HTLCDescriptor_get_preimage"))) TS_HTLCDescriptor_get_preimage(uint64_t this_ptr) {
62379         LDKHTLCDescriptor this_ptr_conv;
62380         this_ptr_conv.inner = untag_ptr(this_ptr);
62381         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
62382         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
62383         this_ptr_conv.is_owned = false;
62384         LDKCOption_ThirtyTwoBytesZ *ret_copy = MALLOC(sizeof(LDKCOption_ThirtyTwoBytesZ), "LDKCOption_ThirtyTwoBytesZ");
62385         *ret_copy = HTLCDescriptor_get_preimage(&this_ptr_conv);
62386         uint64_t ret_ref = tag_ptr(ret_copy, true);
62387         return ret_ref;
62388 }
62389
62390 void  __attribute__((export_name("TS_HTLCDescriptor_set_preimage"))) TS_HTLCDescriptor_set_preimage(uint64_t this_ptr, uint64_t val) {
62391         LDKHTLCDescriptor this_ptr_conv;
62392         this_ptr_conv.inner = untag_ptr(this_ptr);
62393         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
62394         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
62395         this_ptr_conv.is_owned = false;
62396         void* val_ptr = untag_ptr(val);
62397         CHECK_ACCESS(val_ptr);
62398         LDKCOption_ThirtyTwoBytesZ val_conv = *(LDKCOption_ThirtyTwoBytesZ*)(val_ptr);
62399         val_conv = COption_ThirtyTwoBytesZ_clone((LDKCOption_ThirtyTwoBytesZ*)untag_ptr(val));
62400         HTLCDescriptor_set_preimage(&this_ptr_conv, val_conv);
62401 }
62402
62403 int8_tArray  __attribute__((export_name("TS_HTLCDescriptor_get_counterparty_sig"))) TS_HTLCDescriptor_get_counterparty_sig(uint64_t this_ptr) {
62404         LDKHTLCDescriptor this_ptr_conv;
62405         this_ptr_conv.inner = untag_ptr(this_ptr);
62406         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
62407         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
62408         this_ptr_conv.is_owned = false;
62409         int8_tArray ret_arr = init_int8_tArray(64, __LINE__);
62410         memcpy(ret_arr->elems, HTLCDescriptor_get_counterparty_sig(&this_ptr_conv).compact_form, 64);
62411         return ret_arr;
62412 }
62413
62414 void  __attribute__((export_name("TS_HTLCDescriptor_set_counterparty_sig"))) TS_HTLCDescriptor_set_counterparty_sig(uint64_t this_ptr, int8_tArray val) {
62415         LDKHTLCDescriptor this_ptr_conv;
62416         this_ptr_conv.inner = untag_ptr(this_ptr);
62417         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
62418         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
62419         this_ptr_conv.is_owned = false;
62420         LDKECDSASignature val_ref;
62421         CHECK(val->arr_len == 64);
62422         memcpy(val_ref.compact_form, val->elems, 64); FREE(val);
62423         HTLCDescriptor_set_counterparty_sig(&this_ptr_conv, val_ref);
62424 }
62425
62426 static inline uint64_t HTLCDescriptor_clone_ptr(LDKHTLCDescriptor *NONNULL_PTR arg) {
62427         LDKHTLCDescriptor ret_var = HTLCDescriptor_clone(arg);
62428         uint64_t ret_ref = 0;
62429         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
62430         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
62431         return ret_ref;
62432 }
62433 int64_t  __attribute__((export_name("TS_HTLCDescriptor_clone_ptr"))) TS_HTLCDescriptor_clone_ptr(uint64_t arg) {
62434         LDKHTLCDescriptor arg_conv;
62435         arg_conv.inner = untag_ptr(arg);
62436         arg_conv.is_owned = ptr_is_owned(arg);
62437         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
62438         arg_conv.is_owned = false;
62439         int64_t ret_conv = HTLCDescriptor_clone_ptr(&arg_conv);
62440         return ret_conv;
62441 }
62442
62443 uint64_t  __attribute__((export_name("TS_HTLCDescriptor_clone"))) TS_HTLCDescriptor_clone(uint64_t orig) {
62444         LDKHTLCDescriptor orig_conv;
62445         orig_conv.inner = untag_ptr(orig);
62446         orig_conv.is_owned = ptr_is_owned(orig);
62447         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
62448         orig_conv.is_owned = false;
62449         LDKHTLCDescriptor ret_var = HTLCDescriptor_clone(&orig_conv);
62450         uint64_t ret_ref = 0;
62451         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
62452         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
62453         return ret_ref;
62454 }
62455
62456 jboolean  __attribute__((export_name("TS_HTLCDescriptor_eq"))) TS_HTLCDescriptor_eq(uint64_t a, uint64_t b) {
62457         LDKHTLCDescriptor a_conv;
62458         a_conv.inner = untag_ptr(a);
62459         a_conv.is_owned = ptr_is_owned(a);
62460         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
62461         a_conv.is_owned = false;
62462         LDKHTLCDescriptor b_conv;
62463         b_conv.inner = untag_ptr(b);
62464         b_conv.is_owned = ptr_is_owned(b);
62465         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
62466         b_conv.is_owned = false;
62467         jboolean ret_conv = HTLCDescriptor_eq(&a_conv, &b_conv);
62468         return ret_conv;
62469 }
62470
62471 int8_tArray  __attribute__((export_name("TS_HTLCDescriptor_write"))) TS_HTLCDescriptor_write(uint64_t obj) {
62472         LDKHTLCDescriptor obj_conv;
62473         obj_conv.inner = untag_ptr(obj);
62474         obj_conv.is_owned = ptr_is_owned(obj);
62475         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
62476         obj_conv.is_owned = false;
62477         LDKCVec_u8Z ret_var = HTLCDescriptor_write(&obj_conv);
62478         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
62479         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
62480         CVec_u8Z_free(ret_var);
62481         return ret_arr;
62482 }
62483
62484 uint64_t  __attribute__((export_name("TS_HTLCDescriptor_read"))) TS_HTLCDescriptor_read(int8_tArray ser) {
62485         LDKu8slice ser_ref;
62486         ser_ref.datalen = ser->arr_len;
62487         ser_ref.data = ser->elems;
62488         LDKCResult_HTLCDescriptorDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_HTLCDescriptorDecodeErrorZ), "LDKCResult_HTLCDescriptorDecodeErrorZ");
62489         *ret_conv = HTLCDescriptor_read(ser_ref);
62490         FREE(ser);
62491         return tag_ptr(ret_conv, true);
62492 }
62493
62494 uint64_t  __attribute__((export_name("TS_HTLCDescriptor_outpoint"))) TS_HTLCDescriptor_outpoint(uint64_t this_arg) {
62495         LDKHTLCDescriptor this_arg_conv;
62496         this_arg_conv.inner = untag_ptr(this_arg);
62497         this_arg_conv.is_owned = ptr_is_owned(this_arg);
62498         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
62499         this_arg_conv.is_owned = false;
62500         LDKOutPoint ret_var = HTLCDescriptor_outpoint(&this_arg_conv);
62501         uint64_t ret_ref = 0;
62502         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
62503         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
62504         return ret_ref;
62505 }
62506
62507 uint64_t  __attribute__((export_name("TS_HTLCDescriptor_previous_utxo"))) TS_HTLCDescriptor_previous_utxo(uint64_t this_arg) {
62508         LDKHTLCDescriptor this_arg_conv;
62509         this_arg_conv.inner = untag_ptr(this_arg);
62510         this_arg_conv.is_owned = ptr_is_owned(this_arg);
62511         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
62512         this_arg_conv.is_owned = false;
62513         LDKTxOut* ret_ref = MALLOC(sizeof(LDKTxOut), "LDKTxOut");
62514         *ret_ref = HTLCDescriptor_previous_utxo(&this_arg_conv);
62515         return tag_ptr(ret_ref, true);
62516 }
62517
62518 uint64_t  __attribute__((export_name("TS_HTLCDescriptor_unsigned_tx_input"))) TS_HTLCDescriptor_unsigned_tx_input(uint64_t this_arg) {
62519         LDKHTLCDescriptor this_arg_conv;
62520         this_arg_conv.inner = untag_ptr(this_arg);
62521         this_arg_conv.is_owned = ptr_is_owned(this_arg);
62522         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
62523         this_arg_conv.is_owned = false;
62524         LDKTxIn* ret_ref = MALLOC(sizeof(LDKTxIn), "LDKTxIn");
62525         *ret_ref = HTLCDescriptor_unsigned_tx_input(&this_arg_conv);
62526         return tag_ptr(ret_ref, true);
62527 }
62528
62529 uint64_t  __attribute__((export_name("TS_HTLCDescriptor_tx_output"))) TS_HTLCDescriptor_tx_output(uint64_t this_arg) {
62530         LDKHTLCDescriptor this_arg_conv;
62531         this_arg_conv.inner = untag_ptr(this_arg);
62532         this_arg_conv.is_owned = ptr_is_owned(this_arg);
62533         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
62534         this_arg_conv.is_owned = false;
62535         LDKTxOut* ret_ref = MALLOC(sizeof(LDKTxOut), "LDKTxOut");
62536         *ret_ref = HTLCDescriptor_tx_output(&this_arg_conv);
62537         return tag_ptr(ret_ref, true);
62538 }
62539
62540 int8_tArray  __attribute__((export_name("TS_HTLCDescriptor_witness_script"))) TS_HTLCDescriptor_witness_script(uint64_t this_arg) {
62541         LDKHTLCDescriptor this_arg_conv;
62542         this_arg_conv.inner = untag_ptr(this_arg);
62543         this_arg_conv.is_owned = ptr_is_owned(this_arg);
62544         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
62545         this_arg_conv.is_owned = false;
62546         LDKCVec_u8Z ret_var = HTLCDescriptor_witness_script(&this_arg_conv);
62547         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
62548         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
62549         CVec_u8Z_free(ret_var);
62550         return ret_arr;
62551 }
62552
62553 int8_tArray  __attribute__((export_name("TS_HTLCDescriptor_tx_input_witness"))) TS_HTLCDescriptor_tx_input_witness(uint64_t this_arg, int8_tArray signature, int8_tArray witness_script) {
62554         LDKHTLCDescriptor this_arg_conv;
62555         this_arg_conv.inner = untag_ptr(this_arg);
62556         this_arg_conv.is_owned = ptr_is_owned(this_arg);
62557         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
62558         this_arg_conv.is_owned = false;
62559         LDKECDSASignature signature_ref;
62560         CHECK(signature->arr_len == 64);
62561         memcpy(signature_ref.compact_form, signature->elems, 64); FREE(signature);
62562         LDKu8slice witness_script_ref;
62563         witness_script_ref.datalen = witness_script->arr_len;
62564         witness_script_ref.data = witness_script->elems;
62565         LDKWitness ret_var = HTLCDescriptor_tx_input_witness(&this_arg_conv, signature_ref, witness_script_ref);
62566         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
62567         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
62568         Witness_free(ret_var);
62569         FREE(witness_script);
62570         return ret_arr;
62571 }
62572
62573 uint64_t  __attribute__((export_name("TS_HTLCDescriptor_derive_channel_signer"))) TS_HTLCDescriptor_derive_channel_signer(uint64_t this_arg, uint64_t signer_provider) {
62574         LDKHTLCDescriptor this_arg_conv;
62575         this_arg_conv.inner = untag_ptr(this_arg);
62576         this_arg_conv.is_owned = ptr_is_owned(this_arg);
62577         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
62578         this_arg_conv.is_owned = false;
62579         void* signer_provider_ptr = untag_ptr(signer_provider);
62580         if (ptr_is_owned(signer_provider)) { CHECK_ACCESS(signer_provider_ptr); }
62581         LDKSignerProvider* signer_provider_conv = (LDKSignerProvider*)signer_provider_ptr;
62582         LDKWriteableEcdsaChannelSigner* ret_ret = MALLOC(sizeof(LDKWriteableEcdsaChannelSigner), "LDKWriteableEcdsaChannelSigner");
62583         *ret_ret = HTLCDescriptor_derive_channel_signer(&this_arg_conv, signer_provider_conv);
62584         return tag_ptr(ret_ret, true);
62585 }
62586
62587 void  __attribute__((export_name("TS_ChannelSigner_free"))) TS_ChannelSigner_free(uint64_t this_ptr) {
62588         if (!ptr_is_owned(this_ptr)) return;
62589         void* this_ptr_ptr = untag_ptr(this_ptr);
62590         CHECK_ACCESS(this_ptr_ptr);
62591         LDKChannelSigner this_ptr_conv = *(LDKChannelSigner*)(this_ptr_ptr);
62592         FREE(untag_ptr(this_ptr));
62593         ChannelSigner_free(this_ptr_conv);
62594 }
62595
62596 void  __attribute__((export_name("TS_EcdsaChannelSigner_free"))) TS_EcdsaChannelSigner_free(uint64_t this_ptr) {
62597         if (!ptr_is_owned(this_ptr)) return;
62598         void* this_ptr_ptr = untag_ptr(this_ptr);
62599         CHECK_ACCESS(this_ptr_ptr);
62600         LDKEcdsaChannelSigner this_ptr_conv = *(LDKEcdsaChannelSigner*)(this_ptr_ptr);
62601         FREE(untag_ptr(this_ptr));
62602         EcdsaChannelSigner_free(this_ptr_conv);
62603 }
62604
62605 static inline uint64_t WriteableEcdsaChannelSigner_clone_ptr(LDKWriteableEcdsaChannelSigner *NONNULL_PTR arg) {
62606         LDKWriteableEcdsaChannelSigner* ret_ret = MALLOC(sizeof(LDKWriteableEcdsaChannelSigner), "LDKWriteableEcdsaChannelSigner");
62607         *ret_ret = WriteableEcdsaChannelSigner_clone(arg);
62608         return tag_ptr(ret_ret, true);
62609 }
62610 int64_t  __attribute__((export_name("TS_WriteableEcdsaChannelSigner_clone_ptr"))) TS_WriteableEcdsaChannelSigner_clone_ptr(uint64_t arg) {
62611         void* arg_ptr = untag_ptr(arg);
62612         if (ptr_is_owned(arg)) { CHECK_ACCESS(arg_ptr); }
62613         LDKWriteableEcdsaChannelSigner* arg_conv = (LDKWriteableEcdsaChannelSigner*)arg_ptr;
62614         int64_t ret_conv = WriteableEcdsaChannelSigner_clone_ptr(arg_conv);
62615         return ret_conv;
62616 }
62617
62618 uint64_t  __attribute__((export_name("TS_WriteableEcdsaChannelSigner_clone"))) TS_WriteableEcdsaChannelSigner_clone(uint64_t orig) {
62619         void* orig_ptr = untag_ptr(orig);
62620         if (ptr_is_owned(orig)) { CHECK_ACCESS(orig_ptr); }
62621         LDKWriteableEcdsaChannelSigner* orig_conv = (LDKWriteableEcdsaChannelSigner*)orig_ptr;
62622         LDKWriteableEcdsaChannelSigner* ret_ret = MALLOC(sizeof(LDKWriteableEcdsaChannelSigner), "LDKWriteableEcdsaChannelSigner");
62623         *ret_ret = WriteableEcdsaChannelSigner_clone(orig_conv);
62624         return tag_ptr(ret_ret, true);
62625 }
62626
62627 void  __attribute__((export_name("TS_WriteableEcdsaChannelSigner_free"))) TS_WriteableEcdsaChannelSigner_free(uint64_t this_ptr) {
62628         if (!ptr_is_owned(this_ptr)) return;
62629         void* this_ptr_ptr = untag_ptr(this_ptr);
62630         CHECK_ACCESS(this_ptr_ptr);
62631         LDKWriteableEcdsaChannelSigner this_ptr_conv = *(LDKWriteableEcdsaChannelSigner*)(this_ptr_ptr);
62632         FREE(untag_ptr(this_ptr));
62633         WriteableEcdsaChannelSigner_free(this_ptr_conv);
62634 }
62635
62636 uint32_t  __attribute__((export_name("TS_Recipient_clone"))) TS_Recipient_clone(uint64_t orig) {
62637         LDKRecipient* orig_conv = (LDKRecipient*)untag_ptr(orig);
62638         uint32_t ret_conv = LDKRecipient_to_js(Recipient_clone(orig_conv));
62639         return ret_conv;
62640 }
62641
62642 uint32_t  __attribute__((export_name("TS_Recipient_node"))) TS_Recipient_node() {
62643         uint32_t ret_conv = LDKRecipient_to_js(Recipient_node());
62644         return ret_conv;
62645 }
62646
62647 uint32_t  __attribute__((export_name("TS_Recipient_phantom_node"))) TS_Recipient_phantom_node() {
62648         uint32_t ret_conv = LDKRecipient_to_js(Recipient_phantom_node());
62649         return ret_conv;
62650 }
62651
62652 void  __attribute__((export_name("TS_EntropySource_free"))) TS_EntropySource_free(uint64_t this_ptr) {
62653         if (!ptr_is_owned(this_ptr)) return;
62654         void* this_ptr_ptr = untag_ptr(this_ptr);
62655         CHECK_ACCESS(this_ptr_ptr);
62656         LDKEntropySource this_ptr_conv = *(LDKEntropySource*)(this_ptr_ptr);
62657         FREE(untag_ptr(this_ptr));
62658         EntropySource_free(this_ptr_conv);
62659 }
62660
62661 void  __attribute__((export_name("TS_NodeSigner_free"))) TS_NodeSigner_free(uint64_t this_ptr) {
62662         if (!ptr_is_owned(this_ptr)) return;
62663         void* this_ptr_ptr = untag_ptr(this_ptr);
62664         CHECK_ACCESS(this_ptr_ptr);
62665         LDKNodeSigner this_ptr_conv = *(LDKNodeSigner*)(this_ptr_ptr);
62666         FREE(untag_ptr(this_ptr));
62667         NodeSigner_free(this_ptr_conv);
62668 }
62669
62670 void  __attribute__((export_name("TS_SignerProvider_free"))) TS_SignerProvider_free(uint64_t this_ptr) {
62671         if (!ptr_is_owned(this_ptr)) return;
62672         void* this_ptr_ptr = untag_ptr(this_ptr);
62673         CHECK_ACCESS(this_ptr_ptr);
62674         LDKSignerProvider this_ptr_conv = *(LDKSignerProvider*)(this_ptr_ptr);
62675         FREE(untag_ptr(this_ptr));
62676         SignerProvider_free(this_ptr_conv);
62677 }
62678
62679 void  __attribute__((export_name("TS_InMemorySigner_free"))) TS_InMemorySigner_free(uint64_t this_obj) {
62680         LDKInMemorySigner this_obj_conv;
62681         this_obj_conv.inner = untag_ptr(this_obj);
62682         this_obj_conv.is_owned = ptr_is_owned(this_obj);
62683         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
62684         InMemorySigner_free(this_obj_conv);
62685 }
62686
62687 int8_tArray  __attribute__((export_name("TS_InMemorySigner_get_funding_key"))) TS_InMemorySigner_get_funding_key(uint64_t this_ptr) {
62688         LDKInMemorySigner this_ptr_conv;
62689         this_ptr_conv.inner = untag_ptr(this_ptr);
62690         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
62691         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
62692         this_ptr_conv.is_owned = false;
62693         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
62694         memcpy(ret_arr->elems, *InMemorySigner_get_funding_key(&this_ptr_conv), 32);
62695         return ret_arr;
62696 }
62697
62698 void  __attribute__((export_name("TS_InMemorySigner_set_funding_key"))) TS_InMemorySigner_set_funding_key(uint64_t this_ptr, int8_tArray val) {
62699         LDKInMemorySigner this_ptr_conv;
62700         this_ptr_conv.inner = untag_ptr(this_ptr);
62701         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
62702         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
62703         this_ptr_conv.is_owned = false;
62704         LDKSecretKey val_ref;
62705         CHECK(val->arr_len == 32);
62706         memcpy(val_ref.bytes, val->elems, 32); FREE(val);
62707         InMemorySigner_set_funding_key(&this_ptr_conv, val_ref);
62708 }
62709
62710 int8_tArray  __attribute__((export_name("TS_InMemorySigner_get_revocation_base_key"))) TS_InMemorySigner_get_revocation_base_key(uint64_t this_ptr) {
62711         LDKInMemorySigner this_ptr_conv;
62712         this_ptr_conv.inner = untag_ptr(this_ptr);
62713         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
62714         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
62715         this_ptr_conv.is_owned = false;
62716         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
62717         memcpy(ret_arr->elems, *InMemorySigner_get_revocation_base_key(&this_ptr_conv), 32);
62718         return ret_arr;
62719 }
62720
62721 void  __attribute__((export_name("TS_InMemorySigner_set_revocation_base_key"))) TS_InMemorySigner_set_revocation_base_key(uint64_t this_ptr, int8_tArray val) {
62722         LDKInMemorySigner this_ptr_conv;
62723         this_ptr_conv.inner = untag_ptr(this_ptr);
62724         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
62725         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
62726         this_ptr_conv.is_owned = false;
62727         LDKSecretKey val_ref;
62728         CHECK(val->arr_len == 32);
62729         memcpy(val_ref.bytes, val->elems, 32); FREE(val);
62730         InMemorySigner_set_revocation_base_key(&this_ptr_conv, val_ref);
62731 }
62732
62733 int8_tArray  __attribute__((export_name("TS_InMemorySigner_get_payment_key"))) TS_InMemorySigner_get_payment_key(uint64_t this_ptr) {
62734         LDKInMemorySigner this_ptr_conv;
62735         this_ptr_conv.inner = untag_ptr(this_ptr);
62736         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
62737         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
62738         this_ptr_conv.is_owned = false;
62739         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
62740         memcpy(ret_arr->elems, *InMemorySigner_get_payment_key(&this_ptr_conv), 32);
62741         return ret_arr;
62742 }
62743
62744 void  __attribute__((export_name("TS_InMemorySigner_set_payment_key"))) TS_InMemorySigner_set_payment_key(uint64_t this_ptr, int8_tArray val) {
62745         LDKInMemorySigner this_ptr_conv;
62746         this_ptr_conv.inner = untag_ptr(this_ptr);
62747         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
62748         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
62749         this_ptr_conv.is_owned = false;
62750         LDKSecretKey val_ref;
62751         CHECK(val->arr_len == 32);
62752         memcpy(val_ref.bytes, val->elems, 32); FREE(val);
62753         InMemorySigner_set_payment_key(&this_ptr_conv, val_ref);
62754 }
62755
62756 int8_tArray  __attribute__((export_name("TS_InMemorySigner_get_delayed_payment_base_key"))) TS_InMemorySigner_get_delayed_payment_base_key(uint64_t this_ptr) {
62757         LDKInMemorySigner this_ptr_conv;
62758         this_ptr_conv.inner = untag_ptr(this_ptr);
62759         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
62760         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
62761         this_ptr_conv.is_owned = false;
62762         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
62763         memcpy(ret_arr->elems, *InMemorySigner_get_delayed_payment_base_key(&this_ptr_conv), 32);
62764         return ret_arr;
62765 }
62766
62767 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) {
62768         LDKInMemorySigner this_ptr_conv;
62769         this_ptr_conv.inner = untag_ptr(this_ptr);
62770         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
62771         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
62772         this_ptr_conv.is_owned = false;
62773         LDKSecretKey val_ref;
62774         CHECK(val->arr_len == 32);
62775         memcpy(val_ref.bytes, val->elems, 32); FREE(val);
62776         InMemorySigner_set_delayed_payment_base_key(&this_ptr_conv, val_ref);
62777 }
62778
62779 int8_tArray  __attribute__((export_name("TS_InMemorySigner_get_htlc_base_key"))) TS_InMemorySigner_get_htlc_base_key(uint64_t this_ptr) {
62780         LDKInMemorySigner this_ptr_conv;
62781         this_ptr_conv.inner = untag_ptr(this_ptr);
62782         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
62783         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
62784         this_ptr_conv.is_owned = false;
62785         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
62786         memcpy(ret_arr->elems, *InMemorySigner_get_htlc_base_key(&this_ptr_conv), 32);
62787         return ret_arr;
62788 }
62789
62790 void  __attribute__((export_name("TS_InMemorySigner_set_htlc_base_key"))) TS_InMemorySigner_set_htlc_base_key(uint64_t this_ptr, int8_tArray val) {
62791         LDKInMemorySigner this_ptr_conv;
62792         this_ptr_conv.inner = untag_ptr(this_ptr);
62793         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
62794         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
62795         this_ptr_conv.is_owned = false;
62796         LDKSecretKey val_ref;
62797         CHECK(val->arr_len == 32);
62798         memcpy(val_ref.bytes, val->elems, 32); FREE(val);
62799         InMemorySigner_set_htlc_base_key(&this_ptr_conv, val_ref);
62800 }
62801
62802 int8_tArray  __attribute__((export_name("TS_InMemorySigner_get_commitment_seed"))) TS_InMemorySigner_get_commitment_seed(uint64_t this_ptr) {
62803         LDKInMemorySigner this_ptr_conv;
62804         this_ptr_conv.inner = untag_ptr(this_ptr);
62805         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
62806         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
62807         this_ptr_conv.is_owned = false;
62808         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
62809         memcpy(ret_arr->elems, *InMemorySigner_get_commitment_seed(&this_ptr_conv), 32);
62810         return ret_arr;
62811 }
62812
62813 void  __attribute__((export_name("TS_InMemorySigner_set_commitment_seed"))) TS_InMemorySigner_set_commitment_seed(uint64_t this_ptr, int8_tArray val) {
62814         LDKInMemorySigner this_ptr_conv;
62815         this_ptr_conv.inner = untag_ptr(this_ptr);
62816         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
62817         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
62818         this_ptr_conv.is_owned = false;
62819         LDKThirtyTwoBytes val_ref;
62820         CHECK(val->arr_len == 32);
62821         memcpy(val_ref.data, val->elems, 32); FREE(val);
62822         InMemorySigner_set_commitment_seed(&this_ptr_conv, val_ref);
62823 }
62824
62825 static inline uint64_t InMemorySigner_clone_ptr(LDKInMemorySigner *NONNULL_PTR arg) {
62826         LDKInMemorySigner ret_var = InMemorySigner_clone(arg);
62827         uint64_t ret_ref = 0;
62828         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
62829         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
62830         return ret_ref;
62831 }
62832 int64_t  __attribute__((export_name("TS_InMemorySigner_clone_ptr"))) TS_InMemorySigner_clone_ptr(uint64_t arg) {
62833         LDKInMemorySigner arg_conv;
62834         arg_conv.inner = untag_ptr(arg);
62835         arg_conv.is_owned = ptr_is_owned(arg);
62836         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
62837         arg_conv.is_owned = false;
62838         int64_t ret_conv = InMemorySigner_clone_ptr(&arg_conv);
62839         return ret_conv;
62840 }
62841
62842 uint64_t  __attribute__((export_name("TS_InMemorySigner_clone"))) TS_InMemorySigner_clone(uint64_t orig) {
62843         LDKInMemorySigner orig_conv;
62844         orig_conv.inner = untag_ptr(orig);
62845         orig_conv.is_owned = ptr_is_owned(orig);
62846         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
62847         orig_conv.is_owned = false;
62848         LDKInMemorySigner ret_var = InMemorySigner_clone(&orig_conv);
62849         uint64_t ret_ref = 0;
62850         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
62851         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
62852         return ret_ref;
62853 }
62854
62855 uint64_t  __attribute__((export_name("TS_InMemorySigner_new"))) TS_InMemorySigner_new(int8_tArray funding_key, int8_tArray revocation_base_key, int8_tArray payment_key, int8_tArray delayed_payment_base_key, int8_tArray htlc_base_key, int8_tArray commitment_seed, int64_t channel_value_satoshis, int8_tArray channel_keys_id, int8_tArray rand_bytes_unique_start) {
62856         LDKSecretKey funding_key_ref;
62857         CHECK(funding_key->arr_len == 32);
62858         memcpy(funding_key_ref.bytes, funding_key->elems, 32); FREE(funding_key);
62859         LDKSecretKey revocation_base_key_ref;
62860         CHECK(revocation_base_key->arr_len == 32);
62861         memcpy(revocation_base_key_ref.bytes, revocation_base_key->elems, 32); FREE(revocation_base_key);
62862         LDKSecretKey payment_key_ref;
62863         CHECK(payment_key->arr_len == 32);
62864         memcpy(payment_key_ref.bytes, payment_key->elems, 32); FREE(payment_key);
62865         LDKSecretKey delayed_payment_base_key_ref;
62866         CHECK(delayed_payment_base_key->arr_len == 32);
62867         memcpy(delayed_payment_base_key_ref.bytes, delayed_payment_base_key->elems, 32); FREE(delayed_payment_base_key);
62868         LDKSecretKey htlc_base_key_ref;
62869         CHECK(htlc_base_key->arr_len == 32);
62870         memcpy(htlc_base_key_ref.bytes, htlc_base_key->elems, 32); FREE(htlc_base_key);
62871         LDKThirtyTwoBytes commitment_seed_ref;
62872         CHECK(commitment_seed->arr_len == 32);
62873         memcpy(commitment_seed_ref.data, commitment_seed->elems, 32); FREE(commitment_seed);
62874         LDKThirtyTwoBytes channel_keys_id_ref;
62875         CHECK(channel_keys_id->arr_len == 32);
62876         memcpy(channel_keys_id_ref.data, channel_keys_id->elems, 32); FREE(channel_keys_id);
62877         LDKThirtyTwoBytes rand_bytes_unique_start_ref;
62878         CHECK(rand_bytes_unique_start->arr_len == 32);
62879         memcpy(rand_bytes_unique_start_ref.data, rand_bytes_unique_start->elems, 32); FREE(rand_bytes_unique_start);
62880         LDKInMemorySigner ret_var = InMemorySigner_new(funding_key_ref, revocation_base_key_ref, payment_key_ref, delayed_payment_base_key_ref, htlc_base_key_ref, commitment_seed_ref, channel_value_satoshis, channel_keys_id_ref, rand_bytes_unique_start_ref);
62881         uint64_t ret_ref = 0;
62882         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
62883         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
62884         return ret_ref;
62885 }
62886
62887 uint64_t  __attribute__((export_name("TS_InMemorySigner_counterparty_pubkeys"))) TS_InMemorySigner_counterparty_pubkeys(uint64_t this_arg) {
62888         LDKInMemorySigner this_arg_conv;
62889         this_arg_conv.inner = untag_ptr(this_arg);
62890         this_arg_conv.is_owned = ptr_is_owned(this_arg);
62891         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
62892         this_arg_conv.is_owned = false;
62893         LDKChannelPublicKeys ret_var = InMemorySigner_counterparty_pubkeys(&this_arg_conv);
62894         uint64_t ret_ref = 0;
62895         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
62896         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
62897         return ret_ref;
62898 }
62899
62900 uint64_t  __attribute__((export_name("TS_InMemorySigner_counterparty_selected_contest_delay"))) TS_InMemorySigner_counterparty_selected_contest_delay(uint64_t this_arg) {
62901         LDKInMemorySigner this_arg_conv;
62902         this_arg_conv.inner = untag_ptr(this_arg);
62903         this_arg_conv.is_owned = ptr_is_owned(this_arg);
62904         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
62905         this_arg_conv.is_owned = false;
62906         LDKCOption_u16Z *ret_copy = MALLOC(sizeof(LDKCOption_u16Z), "LDKCOption_u16Z");
62907         *ret_copy = InMemorySigner_counterparty_selected_contest_delay(&this_arg_conv);
62908         uint64_t ret_ref = tag_ptr(ret_copy, true);
62909         return ret_ref;
62910 }
62911
62912 uint64_t  __attribute__((export_name("TS_InMemorySigner_holder_selected_contest_delay"))) TS_InMemorySigner_holder_selected_contest_delay(uint64_t this_arg) {
62913         LDKInMemorySigner this_arg_conv;
62914         this_arg_conv.inner = untag_ptr(this_arg);
62915         this_arg_conv.is_owned = ptr_is_owned(this_arg);
62916         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
62917         this_arg_conv.is_owned = false;
62918         LDKCOption_u16Z *ret_copy = MALLOC(sizeof(LDKCOption_u16Z), "LDKCOption_u16Z");
62919         *ret_copy = InMemorySigner_holder_selected_contest_delay(&this_arg_conv);
62920         uint64_t ret_ref = tag_ptr(ret_copy, true);
62921         return ret_ref;
62922 }
62923
62924 uint64_t  __attribute__((export_name("TS_InMemorySigner_is_outbound"))) TS_InMemorySigner_is_outbound(uint64_t this_arg) {
62925         LDKInMemorySigner this_arg_conv;
62926         this_arg_conv.inner = untag_ptr(this_arg);
62927         this_arg_conv.is_owned = ptr_is_owned(this_arg);
62928         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
62929         this_arg_conv.is_owned = false;
62930         LDKCOption_boolZ *ret_copy = MALLOC(sizeof(LDKCOption_boolZ), "LDKCOption_boolZ");
62931         *ret_copy = InMemorySigner_is_outbound(&this_arg_conv);
62932         uint64_t ret_ref = tag_ptr(ret_copy, true);
62933         return ret_ref;
62934 }
62935
62936 uint64_t  __attribute__((export_name("TS_InMemorySigner_funding_outpoint"))) TS_InMemorySigner_funding_outpoint(uint64_t this_arg) {
62937         LDKInMemorySigner this_arg_conv;
62938         this_arg_conv.inner = untag_ptr(this_arg);
62939         this_arg_conv.is_owned = ptr_is_owned(this_arg);
62940         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
62941         this_arg_conv.is_owned = false;
62942         LDKOutPoint ret_var = InMemorySigner_funding_outpoint(&this_arg_conv);
62943         uint64_t ret_ref = 0;
62944         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
62945         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
62946         return ret_ref;
62947 }
62948
62949 uint64_t  __attribute__((export_name("TS_InMemorySigner_get_channel_parameters"))) TS_InMemorySigner_get_channel_parameters(uint64_t this_arg) {
62950         LDKInMemorySigner this_arg_conv;
62951         this_arg_conv.inner = untag_ptr(this_arg);
62952         this_arg_conv.is_owned = ptr_is_owned(this_arg);
62953         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
62954         this_arg_conv.is_owned = false;
62955         LDKChannelTransactionParameters ret_var = InMemorySigner_get_channel_parameters(&this_arg_conv);
62956         uint64_t ret_ref = 0;
62957         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
62958         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
62959         return ret_ref;
62960 }
62961
62962 uint64_t  __attribute__((export_name("TS_InMemorySigner_channel_type_features"))) TS_InMemorySigner_channel_type_features(uint64_t this_arg) {
62963         LDKInMemorySigner this_arg_conv;
62964         this_arg_conv.inner = untag_ptr(this_arg);
62965         this_arg_conv.is_owned = ptr_is_owned(this_arg);
62966         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
62967         this_arg_conv.is_owned = false;
62968         LDKChannelTypeFeatures ret_var = InMemorySigner_channel_type_features(&this_arg_conv);
62969         uint64_t ret_ref = 0;
62970         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
62971         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
62972         return ret_ref;
62973 }
62974
62975 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) {
62976         LDKInMemorySigner this_arg_conv;
62977         this_arg_conv.inner = untag_ptr(this_arg);
62978         this_arg_conv.is_owned = ptr_is_owned(this_arg);
62979         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
62980         this_arg_conv.is_owned = false;
62981         LDKTransaction spend_tx_ref;
62982         spend_tx_ref.datalen = spend_tx->arr_len;
62983         spend_tx_ref.data = MALLOC(spend_tx_ref.datalen, "LDKTransaction Bytes");
62984         memcpy(spend_tx_ref.data, spend_tx->elems, spend_tx_ref.datalen); FREE(spend_tx);
62985         spend_tx_ref.data_is_owned = true;
62986         LDKStaticPaymentOutputDescriptor descriptor_conv;
62987         descriptor_conv.inner = untag_ptr(descriptor);
62988         descriptor_conv.is_owned = ptr_is_owned(descriptor);
62989         CHECK_INNER_FIELD_ACCESS_OR_NULL(descriptor_conv);
62990         descriptor_conv.is_owned = false;
62991         LDKCResult_CVec_CVec_u8ZZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_CVec_u8ZZNoneZ), "LDKCResult_CVec_CVec_u8ZZNoneZ");
62992         *ret_conv = InMemorySigner_sign_counterparty_payment_input(&this_arg_conv, spend_tx_ref, input_idx, &descriptor_conv);
62993         return tag_ptr(ret_conv, true);
62994 }
62995
62996 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) {
62997         LDKInMemorySigner this_arg_conv;
62998         this_arg_conv.inner = untag_ptr(this_arg);
62999         this_arg_conv.is_owned = ptr_is_owned(this_arg);
63000         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
63001         this_arg_conv.is_owned = false;
63002         LDKTransaction spend_tx_ref;
63003         spend_tx_ref.datalen = spend_tx->arr_len;
63004         spend_tx_ref.data = MALLOC(spend_tx_ref.datalen, "LDKTransaction Bytes");
63005         memcpy(spend_tx_ref.data, spend_tx->elems, spend_tx_ref.datalen); FREE(spend_tx);
63006         spend_tx_ref.data_is_owned = true;
63007         LDKDelayedPaymentOutputDescriptor descriptor_conv;
63008         descriptor_conv.inner = untag_ptr(descriptor);
63009         descriptor_conv.is_owned = ptr_is_owned(descriptor);
63010         CHECK_INNER_FIELD_ACCESS_OR_NULL(descriptor_conv);
63011         descriptor_conv.is_owned = false;
63012         LDKCResult_CVec_CVec_u8ZZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_CVec_u8ZZNoneZ), "LDKCResult_CVec_CVec_u8ZZNoneZ");
63013         *ret_conv = InMemorySigner_sign_dynamic_p2wsh_input(&this_arg_conv, spend_tx_ref, input_idx, &descriptor_conv);
63014         return tag_ptr(ret_conv, true);
63015 }
63016
63017 uint64_t  __attribute__((export_name("TS_InMemorySigner_as_EntropySource"))) TS_InMemorySigner_as_EntropySource(uint64_t this_arg) {
63018         LDKInMemorySigner this_arg_conv;
63019         this_arg_conv.inner = untag_ptr(this_arg);
63020         this_arg_conv.is_owned = ptr_is_owned(this_arg);
63021         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
63022         this_arg_conv.is_owned = false;
63023         LDKEntropySource* ret_ret = MALLOC(sizeof(LDKEntropySource), "LDKEntropySource");
63024         *ret_ret = InMemorySigner_as_EntropySource(&this_arg_conv);
63025         return tag_ptr(ret_ret, true);
63026 }
63027
63028 uint64_t  __attribute__((export_name("TS_InMemorySigner_as_ChannelSigner"))) TS_InMemorySigner_as_ChannelSigner(uint64_t this_arg) {
63029         LDKInMemorySigner this_arg_conv;
63030         this_arg_conv.inner = untag_ptr(this_arg);
63031         this_arg_conv.is_owned = ptr_is_owned(this_arg);
63032         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
63033         this_arg_conv.is_owned = false;
63034         LDKChannelSigner* ret_ret = MALLOC(sizeof(LDKChannelSigner), "LDKChannelSigner");
63035         *ret_ret = InMemorySigner_as_ChannelSigner(&this_arg_conv);
63036         return tag_ptr(ret_ret, true);
63037 }
63038
63039 uint64_t  __attribute__((export_name("TS_InMemorySigner_as_EcdsaChannelSigner"))) TS_InMemorySigner_as_EcdsaChannelSigner(uint64_t this_arg) {
63040         LDKInMemorySigner this_arg_conv;
63041         this_arg_conv.inner = untag_ptr(this_arg);
63042         this_arg_conv.is_owned = ptr_is_owned(this_arg);
63043         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
63044         this_arg_conv.is_owned = false;
63045         LDKEcdsaChannelSigner* ret_ret = MALLOC(sizeof(LDKEcdsaChannelSigner), "LDKEcdsaChannelSigner");
63046         *ret_ret = InMemorySigner_as_EcdsaChannelSigner(&this_arg_conv);
63047         return tag_ptr(ret_ret, true);
63048 }
63049
63050 uint64_t  __attribute__((export_name("TS_InMemorySigner_as_WriteableEcdsaChannelSigner"))) TS_InMemorySigner_as_WriteableEcdsaChannelSigner(uint64_t this_arg) {
63051         LDKInMemorySigner this_arg_conv;
63052         this_arg_conv.inner = untag_ptr(this_arg);
63053         this_arg_conv.is_owned = ptr_is_owned(this_arg);
63054         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
63055         this_arg_conv.is_owned = false;
63056         LDKWriteableEcdsaChannelSigner* ret_ret = MALLOC(sizeof(LDKWriteableEcdsaChannelSigner), "LDKWriteableEcdsaChannelSigner");
63057         *ret_ret = InMemorySigner_as_WriteableEcdsaChannelSigner(&this_arg_conv);
63058         return tag_ptr(ret_ret, true);
63059 }
63060
63061 int8_tArray  __attribute__((export_name("TS_InMemorySigner_write"))) TS_InMemorySigner_write(uint64_t obj) {
63062         LDKInMemorySigner obj_conv;
63063         obj_conv.inner = untag_ptr(obj);
63064         obj_conv.is_owned = ptr_is_owned(obj);
63065         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
63066         obj_conv.is_owned = false;
63067         LDKCVec_u8Z ret_var = InMemorySigner_write(&obj_conv);
63068         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
63069         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
63070         CVec_u8Z_free(ret_var);
63071         return ret_arr;
63072 }
63073
63074 uint64_t  __attribute__((export_name("TS_InMemorySigner_read"))) TS_InMemorySigner_read(int8_tArray ser, uint64_t arg) {
63075         LDKu8slice ser_ref;
63076         ser_ref.datalen = ser->arr_len;
63077         ser_ref.data = ser->elems;
63078         void* arg_ptr = untag_ptr(arg);
63079         CHECK_ACCESS(arg_ptr);
63080         LDKEntropySource arg_conv = *(LDKEntropySource*)(arg_ptr);
63081         if (arg_conv.free == LDKEntropySource_JCalls_free) {
63082                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
63083                 LDKEntropySource_JCalls_cloned(&arg_conv);
63084         }
63085         LDKCResult_InMemorySignerDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InMemorySignerDecodeErrorZ), "LDKCResult_InMemorySignerDecodeErrorZ");
63086         *ret_conv = InMemorySigner_read(ser_ref, arg_conv);
63087         FREE(ser);
63088         return tag_ptr(ret_conv, true);
63089 }
63090
63091 void  __attribute__((export_name("TS_KeysManager_free"))) TS_KeysManager_free(uint64_t this_obj) {
63092         LDKKeysManager this_obj_conv;
63093         this_obj_conv.inner = untag_ptr(this_obj);
63094         this_obj_conv.is_owned = ptr_is_owned(this_obj);
63095         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
63096         KeysManager_free(this_obj_conv);
63097 }
63098
63099 uint64_t  __attribute__((export_name("TS_KeysManager_new"))) TS_KeysManager_new(int8_tArray seed, int64_t starting_time_secs, int32_t starting_time_nanos) {
63100         uint8_t seed_arr[32];
63101         CHECK(seed->arr_len == 32);
63102         memcpy(seed_arr, seed->elems, 32); FREE(seed);
63103         uint8_t (*seed_ref)[32] = &seed_arr;
63104         LDKKeysManager ret_var = KeysManager_new(seed_ref, starting_time_secs, starting_time_nanos);
63105         uint64_t ret_ref = 0;
63106         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
63107         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
63108         return ret_ref;
63109 }
63110
63111 int8_tArray  __attribute__((export_name("TS_KeysManager_get_node_secret_key"))) TS_KeysManager_get_node_secret_key(uint64_t this_arg) {
63112         LDKKeysManager this_arg_conv;
63113         this_arg_conv.inner = untag_ptr(this_arg);
63114         this_arg_conv.is_owned = ptr_is_owned(this_arg);
63115         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
63116         this_arg_conv.is_owned = false;
63117         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
63118         memcpy(ret_arr->elems, KeysManager_get_node_secret_key(&this_arg_conv).bytes, 32);
63119         return ret_arr;
63120 }
63121
63122 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) {
63123         LDKKeysManager this_arg_conv;
63124         this_arg_conv.inner = untag_ptr(this_arg);
63125         this_arg_conv.is_owned = ptr_is_owned(this_arg);
63126         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
63127         this_arg_conv.is_owned = false;
63128         uint8_t params_arr[32];
63129         CHECK(params->arr_len == 32);
63130         memcpy(params_arr, params->elems, 32); FREE(params);
63131         uint8_t (*params_ref)[32] = &params_arr;
63132         LDKInMemorySigner ret_var = KeysManager_derive_channel_keys(&this_arg_conv, channel_value_satoshis, params_ref);
63133         uint64_t ret_ref = 0;
63134         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
63135         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
63136         return ret_ref;
63137 }
63138
63139 uint64_t  __attribute__((export_name("TS_KeysManager_sign_spendable_outputs_psbt"))) TS_KeysManager_sign_spendable_outputs_psbt(uint64_t this_arg, uint64_tArray descriptors, int8_tArray psbt) {
63140         LDKKeysManager this_arg_conv;
63141         this_arg_conv.inner = untag_ptr(this_arg);
63142         this_arg_conv.is_owned = ptr_is_owned(this_arg);
63143         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
63144         this_arg_conv.is_owned = false;
63145         LDKCVec_SpendableOutputDescriptorZ descriptors_constr;
63146         descriptors_constr.datalen = descriptors->arr_len;
63147         if (descriptors_constr.datalen > 0)
63148                 descriptors_constr.data = MALLOC(descriptors_constr.datalen * sizeof(LDKSpendableOutputDescriptor), "LDKCVec_SpendableOutputDescriptorZ Elements");
63149         else
63150                 descriptors_constr.data = NULL;
63151         uint64_t* descriptors_vals = descriptors->elems;
63152         for (size_t b = 0; b < descriptors_constr.datalen; b++) {
63153                 uint64_t descriptors_conv_27 = descriptors_vals[b];
63154                 void* descriptors_conv_27_ptr = untag_ptr(descriptors_conv_27);
63155                 CHECK_ACCESS(descriptors_conv_27_ptr);
63156                 LDKSpendableOutputDescriptor descriptors_conv_27_conv = *(LDKSpendableOutputDescriptor*)(descriptors_conv_27_ptr);
63157                 descriptors_conv_27_conv = SpendableOutputDescriptor_clone((LDKSpendableOutputDescriptor*)untag_ptr(descriptors_conv_27));
63158                 descriptors_constr.data[b] = descriptors_conv_27_conv;
63159         }
63160         FREE(descriptors);
63161         LDKCVec_u8Z psbt_ref;
63162         psbt_ref.datalen = psbt->arr_len;
63163         psbt_ref.data = MALLOC(psbt_ref.datalen, "LDKCVec_u8Z Bytes");
63164         memcpy(psbt_ref.data, psbt->elems, psbt_ref.datalen); FREE(psbt);
63165         LDKCResult_CVec_u8ZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_u8ZNoneZ), "LDKCResult_CVec_u8ZNoneZ");
63166         *ret_conv = KeysManager_sign_spendable_outputs_psbt(&this_arg_conv, descriptors_constr, psbt_ref);
63167         return tag_ptr(ret_conv, true);
63168 }
63169
63170 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, uint64_t locktime) {
63171         LDKKeysManager this_arg_conv;
63172         this_arg_conv.inner = untag_ptr(this_arg);
63173         this_arg_conv.is_owned = ptr_is_owned(this_arg);
63174         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
63175         this_arg_conv.is_owned = false;
63176         LDKCVec_SpendableOutputDescriptorZ descriptors_constr;
63177         descriptors_constr.datalen = descriptors->arr_len;
63178         if (descriptors_constr.datalen > 0)
63179                 descriptors_constr.data = MALLOC(descriptors_constr.datalen * sizeof(LDKSpendableOutputDescriptor), "LDKCVec_SpendableOutputDescriptorZ Elements");
63180         else
63181                 descriptors_constr.data = NULL;
63182         uint64_t* descriptors_vals = descriptors->elems;
63183         for (size_t b = 0; b < descriptors_constr.datalen; b++) {
63184                 uint64_t descriptors_conv_27 = descriptors_vals[b];
63185                 void* descriptors_conv_27_ptr = untag_ptr(descriptors_conv_27);
63186                 CHECK_ACCESS(descriptors_conv_27_ptr);
63187                 LDKSpendableOutputDescriptor descriptors_conv_27_conv = *(LDKSpendableOutputDescriptor*)(descriptors_conv_27_ptr);
63188                 descriptors_conv_27_conv = SpendableOutputDescriptor_clone((LDKSpendableOutputDescriptor*)untag_ptr(descriptors_conv_27));
63189                 descriptors_constr.data[b] = descriptors_conv_27_conv;
63190         }
63191         FREE(descriptors);
63192         LDKCVec_TxOutZ outputs_constr;
63193         outputs_constr.datalen = outputs->arr_len;
63194         if (outputs_constr.datalen > 0)
63195                 outputs_constr.data = MALLOC(outputs_constr.datalen * sizeof(LDKTxOut), "LDKCVec_TxOutZ Elements");
63196         else
63197                 outputs_constr.data = NULL;
63198         uint64_t* outputs_vals = outputs->elems;
63199         for (size_t h = 0; h < outputs_constr.datalen; h++) {
63200                 uint64_t outputs_conv_7 = outputs_vals[h];
63201                 void* outputs_conv_7_ptr = untag_ptr(outputs_conv_7);
63202                 CHECK_ACCESS(outputs_conv_7_ptr);
63203                 LDKTxOut outputs_conv_7_conv = *(LDKTxOut*)(outputs_conv_7_ptr);
63204                 outputs_conv_7_conv = TxOut_clone((LDKTxOut*)untag_ptr(outputs_conv_7));
63205                 outputs_constr.data[h] = outputs_conv_7_conv;
63206         }
63207         FREE(outputs);
63208         LDKCVec_u8Z change_destination_script_ref;
63209         change_destination_script_ref.datalen = change_destination_script->arr_len;
63210         change_destination_script_ref.data = MALLOC(change_destination_script_ref.datalen, "LDKCVec_u8Z Bytes");
63211         memcpy(change_destination_script_ref.data, change_destination_script->elems, change_destination_script_ref.datalen); FREE(change_destination_script);
63212         void* locktime_ptr = untag_ptr(locktime);
63213         CHECK_ACCESS(locktime_ptr);
63214         LDKCOption_u32Z locktime_conv = *(LDKCOption_u32Z*)(locktime_ptr);
63215         locktime_conv = COption_u32Z_clone((LDKCOption_u32Z*)untag_ptr(locktime));
63216         LDKCResult_TransactionNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_TransactionNoneZ), "LDKCResult_TransactionNoneZ");
63217         *ret_conv = KeysManager_spend_spendable_outputs(&this_arg_conv, descriptors_constr, outputs_constr, change_destination_script_ref, feerate_sat_per_1000_weight, locktime_conv);
63218         return tag_ptr(ret_conv, true);
63219 }
63220
63221 uint64_t  __attribute__((export_name("TS_KeysManager_as_EntropySource"))) TS_KeysManager_as_EntropySource(uint64_t this_arg) {
63222         LDKKeysManager this_arg_conv;
63223         this_arg_conv.inner = untag_ptr(this_arg);
63224         this_arg_conv.is_owned = ptr_is_owned(this_arg);
63225         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
63226         this_arg_conv.is_owned = false;
63227         LDKEntropySource* ret_ret = MALLOC(sizeof(LDKEntropySource), "LDKEntropySource");
63228         *ret_ret = KeysManager_as_EntropySource(&this_arg_conv);
63229         return tag_ptr(ret_ret, true);
63230 }
63231
63232 uint64_t  __attribute__((export_name("TS_KeysManager_as_NodeSigner"))) TS_KeysManager_as_NodeSigner(uint64_t this_arg) {
63233         LDKKeysManager this_arg_conv;
63234         this_arg_conv.inner = untag_ptr(this_arg);
63235         this_arg_conv.is_owned = ptr_is_owned(this_arg);
63236         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
63237         this_arg_conv.is_owned = false;
63238         LDKNodeSigner* ret_ret = MALLOC(sizeof(LDKNodeSigner), "LDKNodeSigner");
63239         *ret_ret = KeysManager_as_NodeSigner(&this_arg_conv);
63240         return tag_ptr(ret_ret, true);
63241 }
63242
63243 uint64_t  __attribute__((export_name("TS_KeysManager_as_SignerProvider"))) TS_KeysManager_as_SignerProvider(uint64_t this_arg) {
63244         LDKKeysManager this_arg_conv;
63245         this_arg_conv.inner = untag_ptr(this_arg);
63246         this_arg_conv.is_owned = ptr_is_owned(this_arg);
63247         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
63248         this_arg_conv.is_owned = false;
63249         LDKSignerProvider* ret_ret = MALLOC(sizeof(LDKSignerProvider), "LDKSignerProvider");
63250         *ret_ret = KeysManager_as_SignerProvider(&this_arg_conv);
63251         return tag_ptr(ret_ret, true);
63252 }
63253
63254 void  __attribute__((export_name("TS_PhantomKeysManager_free"))) TS_PhantomKeysManager_free(uint64_t this_obj) {
63255         LDKPhantomKeysManager this_obj_conv;
63256         this_obj_conv.inner = untag_ptr(this_obj);
63257         this_obj_conv.is_owned = ptr_is_owned(this_obj);
63258         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
63259         PhantomKeysManager_free(this_obj_conv);
63260 }
63261
63262 uint64_t  __attribute__((export_name("TS_PhantomKeysManager_as_EntropySource"))) TS_PhantomKeysManager_as_EntropySource(uint64_t this_arg) {
63263         LDKPhantomKeysManager this_arg_conv;
63264         this_arg_conv.inner = untag_ptr(this_arg);
63265         this_arg_conv.is_owned = ptr_is_owned(this_arg);
63266         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
63267         this_arg_conv.is_owned = false;
63268         LDKEntropySource* ret_ret = MALLOC(sizeof(LDKEntropySource), "LDKEntropySource");
63269         *ret_ret = PhantomKeysManager_as_EntropySource(&this_arg_conv);
63270         return tag_ptr(ret_ret, true);
63271 }
63272
63273 uint64_t  __attribute__((export_name("TS_PhantomKeysManager_as_NodeSigner"))) TS_PhantomKeysManager_as_NodeSigner(uint64_t this_arg) {
63274         LDKPhantomKeysManager this_arg_conv;
63275         this_arg_conv.inner = untag_ptr(this_arg);
63276         this_arg_conv.is_owned = ptr_is_owned(this_arg);
63277         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
63278         this_arg_conv.is_owned = false;
63279         LDKNodeSigner* ret_ret = MALLOC(sizeof(LDKNodeSigner), "LDKNodeSigner");
63280         *ret_ret = PhantomKeysManager_as_NodeSigner(&this_arg_conv);
63281         return tag_ptr(ret_ret, true);
63282 }
63283
63284 uint64_t  __attribute__((export_name("TS_PhantomKeysManager_as_SignerProvider"))) TS_PhantomKeysManager_as_SignerProvider(uint64_t this_arg) {
63285         LDKPhantomKeysManager this_arg_conv;
63286         this_arg_conv.inner = untag_ptr(this_arg);
63287         this_arg_conv.is_owned = ptr_is_owned(this_arg);
63288         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
63289         this_arg_conv.is_owned = false;
63290         LDKSignerProvider* ret_ret = MALLOC(sizeof(LDKSignerProvider), "LDKSignerProvider");
63291         *ret_ret = PhantomKeysManager_as_SignerProvider(&this_arg_conv);
63292         return tag_ptr(ret_ret, true);
63293 }
63294
63295 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) {
63296         uint8_t seed_arr[32];
63297         CHECK(seed->arr_len == 32);
63298         memcpy(seed_arr, seed->elems, 32); FREE(seed);
63299         uint8_t (*seed_ref)[32] = &seed_arr;
63300         uint8_t cross_node_seed_arr[32];
63301         CHECK(cross_node_seed->arr_len == 32);
63302         memcpy(cross_node_seed_arr, cross_node_seed->elems, 32); FREE(cross_node_seed);
63303         uint8_t (*cross_node_seed_ref)[32] = &cross_node_seed_arr;
63304         LDKPhantomKeysManager ret_var = PhantomKeysManager_new(seed_ref, starting_time_secs, starting_time_nanos, cross_node_seed_ref);
63305         uint64_t ret_ref = 0;
63306         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
63307         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
63308         return ret_ref;
63309 }
63310
63311 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, uint64_t locktime) {
63312         LDKPhantomKeysManager this_arg_conv;
63313         this_arg_conv.inner = untag_ptr(this_arg);
63314         this_arg_conv.is_owned = ptr_is_owned(this_arg);
63315         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
63316         this_arg_conv.is_owned = false;
63317         LDKCVec_SpendableOutputDescriptorZ descriptors_constr;
63318         descriptors_constr.datalen = descriptors->arr_len;
63319         if (descriptors_constr.datalen > 0)
63320                 descriptors_constr.data = MALLOC(descriptors_constr.datalen * sizeof(LDKSpendableOutputDescriptor), "LDKCVec_SpendableOutputDescriptorZ Elements");
63321         else
63322                 descriptors_constr.data = NULL;
63323         uint64_t* descriptors_vals = descriptors->elems;
63324         for (size_t b = 0; b < descriptors_constr.datalen; b++) {
63325                 uint64_t descriptors_conv_27 = descriptors_vals[b];
63326                 void* descriptors_conv_27_ptr = untag_ptr(descriptors_conv_27);
63327                 CHECK_ACCESS(descriptors_conv_27_ptr);
63328                 LDKSpendableOutputDescriptor descriptors_conv_27_conv = *(LDKSpendableOutputDescriptor*)(descriptors_conv_27_ptr);
63329                 descriptors_conv_27_conv = SpendableOutputDescriptor_clone((LDKSpendableOutputDescriptor*)untag_ptr(descriptors_conv_27));
63330                 descriptors_constr.data[b] = descriptors_conv_27_conv;
63331         }
63332         FREE(descriptors);
63333         LDKCVec_TxOutZ outputs_constr;
63334         outputs_constr.datalen = outputs->arr_len;
63335         if (outputs_constr.datalen > 0)
63336                 outputs_constr.data = MALLOC(outputs_constr.datalen * sizeof(LDKTxOut), "LDKCVec_TxOutZ Elements");
63337         else
63338                 outputs_constr.data = NULL;
63339         uint64_t* outputs_vals = outputs->elems;
63340         for (size_t h = 0; h < outputs_constr.datalen; h++) {
63341                 uint64_t outputs_conv_7 = outputs_vals[h];
63342                 void* outputs_conv_7_ptr = untag_ptr(outputs_conv_7);
63343                 CHECK_ACCESS(outputs_conv_7_ptr);
63344                 LDKTxOut outputs_conv_7_conv = *(LDKTxOut*)(outputs_conv_7_ptr);
63345                 outputs_conv_7_conv = TxOut_clone((LDKTxOut*)untag_ptr(outputs_conv_7));
63346                 outputs_constr.data[h] = outputs_conv_7_conv;
63347         }
63348         FREE(outputs);
63349         LDKCVec_u8Z change_destination_script_ref;
63350         change_destination_script_ref.datalen = change_destination_script->arr_len;
63351         change_destination_script_ref.data = MALLOC(change_destination_script_ref.datalen, "LDKCVec_u8Z Bytes");
63352         memcpy(change_destination_script_ref.data, change_destination_script->elems, change_destination_script_ref.datalen); FREE(change_destination_script);
63353         void* locktime_ptr = untag_ptr(locktime);
63354         CHECK_ACCESS(locktime_ptr);
63355         LDKCOption_u32Z locktime_conv = *(LDKCOption_u32Z*)(locktime_ptr);
63356         locktime_conv = COption_u32Z_clone((LDKCOption_u32Z*)untag_ptr(locktime));
63357         LDKCResult_TransactionNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_TransactionNoneZ), "LDKCResult_TransactionNoneZ");
63358         *ret_conv = PhantomKeysManager_spend_spendable_outputs(&this_arg_conv, descriptors_constr, outputs_constr, change_destination_script_ref, feerate_sat_per_1000_weight, locktime_conv);
63359         return tag_ptr(ret_conv, true);
63360 }
63361
63362 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) {
63363         LDKPhantomKeysManager this_arg_conv;
63364         this_arg_conv.inner = untag_ptr(this_arg);
63365         this_arg_conv.is_owned = ptr_is_owned(this_arg);
63366         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
63367         this_arg_conv.is_owned = false;
63368         uint8_t params_arr[32];
63369         CHECK(params->arr_len == 32);
63370         memcpy(params_arr, params->elems, 32); FREE(params);
63371         uint8_t (*params_ref)[32] = &params_arr;
63372         LDKInMemorySigner ret_var = PhantomKeysManager_derive_channel_keys(&this_arg_conv, channel_value_satoshis, params_ref);
63373         uint64_t ret_ref = 0;
63374         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
63375         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
63376         return ret_ref;
63377 }
63378
63379 int8_tArray  __attribute__((export_name("TS_PhantomKeysManager_get_node_secret_key"))) TS_PhantomKeysManager_get_node_secret_key(uint64_t this_arg) {
63380         LDKPhantomKeysManager this_arg_conv;
63381         this_arg_conv.inner = untag_ptr(this_arg);
63382         this_arg_conv.is_owned = ptr_is_owned(this_arg);
63383         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
63384         this_arg_conv.is_owned = false;
63385         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
63386         memcpy(ret_arr->elems, PhantomKeysManager_get_node_secret_key(&this_arg_conv).bytes, 32);
63387         return ret_arr;
63388 }
63389
63390 int8_tArray  __attribute__((export_name("TS_PhantomKeysManager_get_phantom_node_secret_key"))) TS_PhantomKeysManager_get_phantom_node_secret_key(uint64_t this_arg) {
63391         LDKPhantomKeysManager this_arg_conv;
63392         this_arg_conv.inner = untag_ptr(this_arg);
63393         this_arg_conv.is_owned = ptr_is_owned(this_arg);
63394         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
63395         this_arg_conv.is_owned = false;
63396         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
63397         memcpy(ret_arr->elems, PhantomKeysManager_get_phantom_node_secret_key(&this_arg_conv).bytes, 32);
63398         return ret_arr;
63399 }
63400
63401 void  __attribute__((export_name("TS_OnionMessenger_free"))) TS_OnionMessenger_free(uint64_t this_obj) {
63402         LDKOnionMessenger this_obj_conv;
63403         this_obj_conv.inner = untag_ptr(this_obj);
63404         this_obj_conv.is_owned = ptr_is_owned(this_obj);
63405         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
63406         OnionMessenger_free(this_obj_conv);
63407 }
63408
63409 void  __attribute__((export_name("TS_MessageRouter_free"))) TS_MessageRouter_free(uint64_t this_ptr) {
63410         if (!ptr_is_owned(this_ptr)) return;
63411         void* this_ptr_ptr = untag_ptr(this_ptr);
63412         CHECK_ACCESS(this_ptr_ptr);
63413         LDKMessageRouter this_ptr_conv = *(LDKMessageRouter*)(this_ptr_ptr);
63414         FREE(untag_ptr(this_ptr));
63415         MessageRouter_free(this_ptr_conv);
63416 }
63417
63418 void  __attribute__((export_name("TS_DefaultMessageRouter_free"))) TS_DefaultMessageRouter_free(uint64_t this_obj) {
63419         LDKDefaultMessageRouter this_obj_conv;
63420         this_obj_conv.inner = untag_ptr(this_obj);
63421         this_obj_conv.is_owned = ptr_is_owned(this_obj);
63422         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
63423         DefaultMessageRouter_free(this_obj_conv);
63424 }
63425
63426 uint64_t  __attribute__((export_name("TS_DefaultMessageRouter_new"))) TS_DefaultMessageRouter_new() {
63427         LDKDefaultMessageRouter ret_var = DefaultMessageRouter_new();
63428         uint64_t ret_ref = 0;
63429         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
63430         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
63431         return ret_ref;
63432 }
63433
63434 uint64_t  __attribute__((export_name("TS_DefaultMessageRouter_as_MessageRouter"))) TS_DefaultMessageRouter_as_MessageRouter(uint64_t this_arg) {
63435         LDKDefaultMessageRouter this_arg_conv;
63436         this_arg_conv.inner = untag_ptr(this_arg);
63437         this_arg_conv.is_owned = ptr_is_owned(this_arg);
63438         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
63439         this_arg_conv.is_owned = false;
63440         LDKMessageRouter* ret_ret = MALLOC(sizeof(LDKMessageRouter), "LDKMessageRouter");
63441         *ret_ret = DefaultMessageRouter_as_MessageRouter(&this_arg_conv);
63442         return tag_ptr(ret_ret, true);
63443 }
63444
63445 void  __attribute__((export_name("TS_OnionMessagePath_free"))) TS_OnionMessagePath_free(uint64_t this_obj) {
63446         LDKOnionMessagePath this_obj_conv;
63447         this_obj_conv.inner = untag_ptr(this_obj);
63448         this_obj_conv.is_owned = ptr_is_owned(this_obj);
63449         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
63450         OnionMessagePath_free(this_obj_conv);
63451 }
63452
63453 ptrArray  __attribute__((export_name("TS_OnionMessagePath_get_intermediate_nodes"))) TS_OnionMessagePath_get_intermediate_nodes(uint64_t this_ptr) {
63454         LDKOnionMessagePath this_ptr_conv;
63455         this_ptr_conv.inner = untag_ptr(this_ptr);
63456         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
63457         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
63458         this_ptr_conv.is_owned = false;
63459         LDKCVec_PublicKeyZ ret_var = OnionMessagePath_get_intermediate_nodes(&this_ptr_conv);
63460         ptrArray ret_arr = NULL;
63461         ret_arr = init_ptrArray(ret_var.datalen, __LINE__);
63462         int8_tArray *ret_arr_ptr = (int8_tArray*)(((uint8_t*)ret_arr) + 8);
63463         for (size_t m = 0; m < ret_var.datalen; m++) {
63464                 int8_tArray ret_conv_12_arr = init_int8_tArray(33, __LINE__);
63465                 memcpy(ret_conv_12_arr->elems, ret_var.data[m].compressed_form, 33);
63466                 ret_arr_ptr[m] = ret_conv_12_arr;
63467         }
63468         
63469         FREE(ret_var.data);
63470         return ret_arr;
63471 }
63472
63473 void  __attribute__((export_name("TS_OnionMessagePath_set_intermediate_nodes"))) TS_OnionMessagePath_set_intermediate_nodes(uint64_t this_ptr, ptrArray val) {
63474         LDKOnionMessagePath this_ptr_conv;
63475         this_ptr_conv.inner = untag_ptr(this_ptr);
63476         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
63477         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
63478         this_ptr_conv.is_owned = false;
63479         LDKCVec_PublicKeyZ val_constr;
63480         val_constr.datalen = val->arr_len;
63481         if (val_constr.datalen > 0)
63482                 val_constr.data = MALLOC(val_constr.datalen * sizeof(LDKPublicKey), "LDKCVec_PublicKeyZ Elements");
63483         else
63484                 val_constr.data = NULL;
63485         int8_tArray* val_vals = (void*) val->elems;
63486         for (size_t m = 0; m < val_constr.datalen; m++) {
63487                 int8_tArray val_conv_12 = val_vals[m];
63488                 LDKPublicKey val_conv_12_ref;
63489                 CHECK(val_conv_12->arr_len == 33);
63490                 memcpy(val_conv_12_ref.compressed_form, val_conv_12->elems, 33); FREE(val_conv_12);
63491                 val_constr.data[m] = val_conv_12_ref;
63492         }
63493         FREE(val);
63494         OnionMessagePath_set_intermediate_nodes(&this_ptr_conv, val_constr);
63495 }
63496
63497 uint64_t  __attribute__((export_name("TS_OnionMessagePath_get_destination"))) TS_OnionMessagePath_get_destination(uint64_t this_ptr) {
63498         LDKOnionMessagePath this_ptr_conv;
63499         this_ptr_conv.inner = untag_ptr(this_ptr);
63500         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
63501         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
63502         this_ptr_conv.is_owned = false;
63503         LDKDestination *ret_copy = MALLOC(sizeof(LDKDestination), "LDKDestination");
63504         *ret_copy = OnionMessagePath_get_destination(&this_ptr_conv);
63505         uint64_t ret_ref = tag_ptr(ret_copy, true);
63506         return ret_ref;
63507 }
63508
63509 void  __attribute__((export_name("TS_OnionMessagePath_set_destination"))) TS_OnionMessagePath_set_destination(uint64_t this_ptr, uint64_t val) {
63510         LDKOnionMessagePath this_ptr_conv;
63511         this_ptr_conv.inner = untag_ptr(this_ptr);
63512         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
63513         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
63514         this_ptr_conv.is_owned = false;
63515         void* val_ptr = untag_ptr(val);
63516         CHECK_ACCESS(val_ptr);
63517         LDKDestination val_conv = *(LDKDestination*)(val_ptr);
63518         val_conv = Destination_clone((LDKDestination*)untag_ptr(val));
63519         OnionMessagePath_set_destination(&this_ptr_conv, val_conv);
63520 }
63521
63522 uint64_t  __attribute__((export_name("TS_OnionMessagePath_new"))) TS_OnionMessagePath_new(ptrArray intermediate_nodes_arg, uint64_t destination_arg) {
63523         LDKCVec_PublicKeyZ intermediate_nodes_arg_constr;
63524         intermediate_nodes_arg_constr.datalen = intermediate_nodes_arg->arr_len;
63525         if (intermediate_nodes_arg_constr.datalen > 0)
63526                 intermediate_nodes_arg_constr.data = MALLOC(intermediate_nodes_arg_constr.datalen * sizeof(LDKPublicKey), "LDKCVec_PublicKeyZ Elements");
63527         else
63528                 intermediate_nodes_arg_constr.data = NULL;
63529         int8_tArray* intermediate_nodes_arg_vals = (void*) intermediate_nodes_arg->elems;
63530         for (size_t m = 0; m < intermediate_nodes_arg_constr.datalen; m++) {
63531                 int8_tArray intermediate_nodes_arg_conv_12 = intermediate_nodes_arg_vals[m];
63532                 LDKPublicKey intermediate_nodes_arg_conv_12_ref;
63533                 CHECK(intermediate_nodes_arg_conv_12->arr_len == 33);
63534                 memcpy(intermediate_nodes_arg_conv_12_ref.compressed_form, intermediate_nodes_arg_conv_12->elems, 33); FREE(intermediate_nodes_arg_conv_12);
63535                 intermediate_nodes_arg_constr.data[m] = intermediate_nodes_arg_conv_12_ref;
63536         }
63537         FREE(intermediate_nodes_arg);
63538         void* destination_arg_ptr = untag_ptr(destination_arg);
63539         CHECK_ACCESS(destination_arg_ptr);
63540         LDKDestination destination_arg_conv = *(LDKDestination*)(destination_arg_ptr);
63541         destination_arg_conv = Destination_clone((LDKDestination*)untag_ptr(destination_arg));
63542         LDKOnionMessagePath ret_var = OnionMessagePath_new(intermediate_nodes_arg_constr, destination_arg_conv);
63543         uint64_t ret_ref = 0;
63544         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
63545         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
63546         return ret_ref;
63547 }
63548
63549 static inline uint64_t OnionMessagePath_clone_ptr(LDKOnionMessagePath *NONNULL_PTR arg) {
63550         LDKOnionMessagePath ret_var = OnionMessagePath_clone(arg);
63551         uint64_t ret_ref = 0;
63552         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
63553         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
63554         return ret_ref;
63555 }
63556 int64_t  __attribute__((export_name("TS_OnionMessagePath_clone_ptr"))) TS_OnionMessagePath_clone_ptr(uint64_t arg) {
63557         LDKOnionMessagePath arg_conv;
63558         arg_conv.inner = untag_ptr(arg);
63559         arg_conv.is_owned = ptr_is_owned(arg);
63560         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
63561         arg_conv.is_owned = false;
63562         int64_t ret_conv = OnionMessagePath_clone_ptr(&arg_conv);
63563         return ret_conv;
63564 }
63565
63566 uint64_t  __attribute__((export_name("TS_OnionMessagePath_clone"))) TS_OnionMessagePath_clone(uint64_t orig) {
63567         LDKOnionMessagePath orig_conv;
63568         orig_conv.inner = untag_ptr(orig);
63569         orig_conv.is_owned = ptr_is_owned(orig);
63570         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
63571         orig_conv.is_owned = false;
63572         LDKOnionMessagePath ret_var = OnionMessagePath_clone(&orig_conv);
63573         uint64_t ret_ref = 0;
63574         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
63575         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
63576         return ret_ref;
63577 }
63578
63579 void  __attribute__((export_name("TS_Destination_free"))) TS_Destination_free(uint64_t this_ptr) {
63580         if (!ptr_is_owned(this_ptr)) return;
63581         void* this_ptr_ptr = untag_ptr(this_ptr);
63582         CHECK_ACCESS(this_ptr_ptr);
63583         LDKDestination this_ptr_conv = *(LDKDestination*)(this_ptr_ptr);
63584         FREE(untag_ptr(this_ptr));
63585         Destination_free(this_ptr_conv);
63586 }
63587
63588 static inline uint64_t Destination_clone_ptr(LDKDestination *NONNULL_PTR arg) {
63589         LDKDestination *ret_copy = MALLOC(sizeof(LDKDestination), "LDKDestination");
63590         *ret_copy = Destination_clone(arg);
63591         uint64_t ret_ref = tag_ptr(ret_copy, true);
63592         return ret_ref;
63593 }
63594 int64_t  __attribute__((export_name("TS_Destination_clone_ptr"))) TS_Destination_clone_ptr(uint64_t arg) {
63595         LDKDestination* arg_conv = (LDKDestination*)untag_ptr(arg);
63596         int64_t ret_conv = Destination_clone_ptr(arg_conv);
63597         return ret_conv;
63598 }
63599
63600 uint64_t  __attribute__((export_name("TS_Destination_clone"))) TS_Destination_clone(uint64_t orig) {
63601         LDKDestination* orig_conv = (LDKDestination*)untag_ptr(orig);
63602         LDKDestination *ret_copy = MALLOC(sizeof(LDKDestination), "LDKDestination");
63603         *ret_copy = Destination_clone(orig_conv);
63604         uint64_t ret_ref = tag_ptr(ret_copy, true);
63605         return ret_ref;
63606 }
63607
63608 uint64_t  __attribute__((export_name("TS_Destination_node"))) TS_Destination_node(int8_tArray a) {
63609         LDKPublicKey a_ref;
63610         CHECK(a->arr_len == 33);
63611         memcpy(a_ref.compressed_form, a->elems, 33); FREE(a);
63612         LDKDestination *ret_copy = MALLOC(sizeof(LDKDestination), "LDKDestination");
63613         *ret_copy = Destination_node(a_ref);
63614         uint64_t ret_ref = tag_ptr(ret_copy, true);
63615         return ret_ref;
63616 }
63617
63618 uint64_t  __attribute__((export_name("TS_Destination_blinded_path"))) TS_Destination_blinded_path(uint64_t a) {
63619         LDKBlindedPath a_conv;
63620         a_conv.inner = untag_ptr(a);
63621         a_conv.is_owned = ptr_is_owned(a);
63622         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
63623         a_conv = BlindedPath_clone(&a_conv);
63624         LDKDestination *ret_copy = MALLOC(sizeof(LDKDestination), "LDKDestination");
63625         *ret_copy = Destination_blinded_path(a_conv);
63626         uint64_t ret_ref = tag_ptr(ret_copy, true);
63627         return ret_ref;
63628 }
63629
63630 void  __attribute__((export_name("TS_SendError_free"))) TS_SendError_free(uint64_t this_ptr) {
63631         if (!ptr_is_owned(this_ptr)) return;
63632         void* this_ptr_ptr = untag_ptr(this_ptr);
63633         CHECK_ACCESS(this_ptr_ptr);
63634         LDKSendError this_ptr_conv = *(LDKSendError*)(this_ptr_ptr);
63635         FREE(untag_ptr(this_ptr));
63636         SendError_free(this_ptr_conv);
63637 }
63638
63639 static inline uint64_t SendError_clone_ptr(LDKSendError *NONNULL_PTR arg) {
63640         LDKSendError *ret_copy = MALLOC(sizeof(LDKSendError), "LDKSendError");
63641         *ret_copy = SendError_clone(arg);
63642         uint64_t ret_ref = tag_ptr(ret_copy, true);
63643         return ret_ref;
63644 }
63645 int64_t  __attribute__((export_name("TS_SendError_clone_ptr"))) TS_SendError_clone_ptr(uint64_t arg) {
63646         LDKSendError* arg_conv = (LDKSendError*)untag_ptr(arg);
63647         int64_t ret_conv = SendError_clone_ptr(arg_conv);
63648         return ret_conv;
63649 }
63650
63651 uint64_t  __attribute__((export_name("TS_SendError_clone"))) TS_SendError_clone(uint64_t orig) {
63652         LDKSendError* orig_conv = (LDKSendError*)untag_ptr(orig);
63653         LDKSendError *ret_copy = MALLOC(sizeof(LDKSendError), "LDKSendError");
63654         *ret_copy = SendError_clone(orig_conv);
63655         uint64_t ret_ref = tag_ptr(ret_copy, true);
63656         return ret_ref;
63657 }
63658
63659 uint64_t  __attribute__((export_name("TS_SendError_secp256k1"))) TS_SendError_secp256k1(uint32_t a) {
63660         LDKSecp256k1Error a_conv = LDKSecp256k1Error_from_js(a);
63661         LDKSendError *ret_copy = MALLOC(sizeof(LDKSendError), "LDKSendError");
63662         *ret_copy = SendError_secp256k1(a_conv);
63663         uint64_t ret_ref = tag_ptr(ret_copy, true);
63664         return ret_ref;
63665 }
63666
63667 uint64_t  __attribute__((export_name("TS_SendError_too_big_packet"))) TS_SendError_too_big_packet() {
63668         LDKSendError *ret_copy = MALLOC(sizeof(LDKSendError), "LDKSendError");
63669         *ret_copy = SendError_too_big_packet();
63670         uint64_t ret_ref = tag_ptr(ret_copy, true);
63671         return ret_ref;
63672 }
63673
63674 uint64_t  __attribute__((export_name("TS_SendError_too_few_blinded_hops"))) TS_SendError_too_few_blinded_hops() {
63675         LDKSendError *ret_copy = MALLOC(sizeof(LDKSendError), "LDKSendError");
63676         *ret_copy = SendError_too_few_blinded_hops();
63677         uint64_t ret_ref = tag_ptr(ret_copy, true);
63678         return ret_ref;
63679 }
63680
63681 uint64_t  __attribute__((export_name("TS_SendError_invalid_first_hop"))) TS_SendError_invalid_first_hop() {
63682         LDKSendError *ret_copy = MALLOC(sizeof(LDKSendError), "LDKSendError");
63683         *ret_copy = SendError_invalid_first_hop();
63684         uint64_t ret_ref = tag_ptr(ret_copy, true);
63685         return ret_ref;
63686 }
63687
63688 uint64_t  __attribute__((export_name("TS_SendError_invalid_message"))) TS_SendError_invalid_message() {
63689         LDKSendError *ret_copy = MALLOC(sizeof(LDKSendError), "LDKSendError");
63690         *ret_copy = SendError_invalid_message();
63691         uint64_t ret_ref = tag_ptr(ret_copy, true);
63692         return ret_ref;
63693 }
63694
63695 uint64_t  __attribute__((export_name("TS_SendError_buffer_full"))) TS_SendError_buffer_full() {
63696         LDKSendError *ret_copy = MALLOC(sizeof(LDKSendError), "LDKSendError");
63697         *ret_copy = SendError_buffer_full();
63698         uint64_t ret_ref = tag_ptr(ret_copy, true);
63699         return ret_ref;
63700 }
63701
63702 uint64_t  __attribute__((export_name("TS_SendError_get_node_id_failed"))) TS_SendError_get_node_id_failed() {
63703         LDKSendError *ret_copy = MALLOC(sizeof(LDKSendError), "LDKSendError");
63704         *ret_copy = SendError_get_node_id_failed();
63705         uint64_t ret_ref = tag_ptr(ret_copy, true);
63706         return ret_ref;
63707 }
63708
63709 uint64_t  __attribute__((export_name("TS_SendError_blinded_path_advance_failed"))) TS_SendError_blinded_path_advance_failed() {
63710         LDKSendError *ret_copy = MALLOC(sizeof(LDKSendError), "LDKSendError");
63711         *ret_copy = SendError_blinded_path_advance_failed();
63712         uint64_t ret_ref = tag_ptr(ret_copy, true);
63713         return ret_ref;
63714 }
63715
63716 jboolean  __attribute__((export_name("TS_SendError_eq"))) TS_SendError_eq(uint64_t a, uint64_t b) {
63717         LDKSendError* a_conv = (LDKSendError*)untag_ptr(a);
63718         LDKSendError* b_conv = (LDKSendError*)untag_ptr(b);
63719         jboolean ret_conv = SendError_eq(a_conv, b_conv);
63720         return ret_conv;
63721 }
63722
63723 void  __attribute__((export_name("TS_CustomOnionMessageHandler_free"))) TS_CustomOnionMessageHandler_free(uint64_t this_ptr) {
63724         if (!ptr_is_owned(this_ptr)) return;
63725         void* this_ptr_ptr = untag_ptr(this_ptr);
63726         CHECK_ACCESS(this_ptr_ptr);
63727         LDKCustomOnionMessageHandler this_ptr_conv = *(LDKCustomOnionMessageHandler*)(this_ptr_ptr);
63728         FREE(untag_ptr(this_ptr));
63729         CustomOnionMessageHandler_free(this_ptr_conv);
63730 }
63731
63732 void  __attribute__((export_name("TS_PeeledOnion_free"))) TS_PeeledOnion_free(uint64_t this_ptr) {
63733         if (!ptr_is_owned(this_ptr)) return;
63734         void* this_ptr_ptr = untag_ptr(this_ptr);
63735         CHECK_ACCESS(this_ptr_ptr);
63736         LDKPeeledOnion this_ptr_conv = *(LDKPeeledOnion*)(this_ptr_ptr);
63737         FREE(untag_ptr(this_ptr));
63738         PeeledOnion_free(this_ptr_conv);
63739 }
63740
63741 static inline uint64_t PeeledOnion_clone_ptr(LDKPeeledOnion *NONNULL_PTR arg) {
63742         LDKPeeledOnion *ret_copy = MALLOC(sizeof(LDKPeeledOnion), "LDKPeeledOnion");
63743         *ret_copy = PeeledOnion_clone(arg);
63744         uint64_t ret_ref = tag_ptr(ret_copy, true);
63745         return ret_ref;
63746 }
63747 int64_t  __attribute__((export_name("TS_PeeledOnion_clone_ptr"))) TS_PeeledOnion_clone_ptr(uint64_t arg) {
63748         LDKPeeledOnion* arg_conv = (LDKPeeledOnion*)untag_ptr(arg);
63749         int64_t ret_conv = PeeledOnion_clone_ptr(arg_conv);
63750         return ret_conv;
63751 }
63752
63753 uint64_t  __attribute__((export_name("TS_PeeledOnion_clone"))) TS_PeeledOnion_clone(uint64_t orig) {
63754         LDKPeeledOnion* orig_conv = (LDKPeeledOnion*)untag_ptr(orig);
63755         LDKPeeledOnion *ret_copy = MALLOC(sizeof(LDKPeeledOnion), "LDKPeeledOnion");
63756         *ret_copy = PeeledOnion_clone(orig_conv);
63757         uint64_t ret_ref = tag_ptr(ret_copy, true);
63758         return ret_ref;
63759 }
63760
63761 uint64_t  __attribute__((export_name("TS_PeeledOnion_forward"))) TS_PeeledOnion_forward(int8_tArray a, uint64_t b) {
63762         LDKPublicKey a_ref;
63763         CHECK(a->arr_len == 33);
63764         memcpy(a_ref.compressed_form, a->elems, 33); FREE(a);
63765         LDKOnionMessage b_conv;
63766         b_conv.inner = untag_ptr(b);
63767         b_conv.is_owned = ptr_is_owned(b);
63768         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
63769         b_conv = OnionMessage_clone(&b_conv);
63770         LDKPeeledOnion *ret_copy = MALLOC(sizeof(LDKPeeledOnion), "LDKPeeledOnion");
63771         *ret_copy = PeeledOnion_forward(a_ref, b_conv);
63772         uint64_t ret_ref = tag_ptr(ret_copy, true);
63773         return ret_ref;
63774 }
63775
63776 uint64_t  __attribute__((export_name("TS_PeeledOnion_receive"))) TS_PeeledOnion_receive(uint64_t a, int8_tArray b, uint64_t c) {
63777         void* a_ptr = untag_ptr(a);
63778         CHECK_ACCESS(a_ptr);
63779         LDKParsedOnionMessageContents a_conv = *(LDKParsedOnionMessageContents*)(a_ptr);
63780         a_conv = ParsedOnionMessageContents_clone((LDKParsedOnionMessageContents*)untag_ptr(a));
63781         LDKThirtyTwoBytes b_ref;
63782         CHECK(b->arr_len == 32);
63783         memcpy(b_ref.data, b->elems, 32); FREE(b);
63784         LDKBlindedPath c_conv;
63785         c_conv.inner = untag_ptr(c);
63786         c_conv.is_owned = ptr_is_owned(c);
63787         CHECK_INNER_FIELD_ACCESS_OR_NULL(c_conv);
63788         c_conv = BlindedPath_clone(&c_conv);
63789         LDKPeeledOnion *ret_copy = MALLOC(sizeof(LDKPeeledOnion), "LDKPeeledOnion");
63790         *ret_copy = PeeledOnion_receive(a_conv, b_ref, c_conv);
63791         uint64_t ret_ref = tag_ptr(ret_copy, true);
63792         return ret_ref;
63793 }
63794
63795 uint64_t  __attribute__((export_name("TS_create_onion_message"))) TS_create_onion_message(uint64_t entropy_source, uint64_t node_signer, uint64_t path, uint64_t contents, uint64_t reply_path) {
63796         void* entropy_source_ptr = untag_ptr(entropy_source);
63797         if (ptr_is_owned(entropy_source)) { CHECK_ACCESS(entropy_source_ptr); }
63798         LDKEntropySource* entropy_source_conv = (LDKEntropySource*)entropy_source_ptr;
63799         void* node_signer_ptr = untag_ptr(node_signer);
63800         if (ptr_is_owned(node_signer)) { CHECK_ACCESS(node_signer_ptr); }
63801         LDKNodeSigner* node_signer_conv = (LDKNodeSigner*)node_signer_ptr;
63802         LDKOnionMessagePath path_conv;
63803         path_conv.inner = untag_ptr(path);
63804         path_conv.is_owned = ptr_is_owned(path);
63805         CHECK_INNER_FIELD_ACCESS_OR_NULL(path_conv);
63806         path_conv = OnionMessagePath_clone(&path_conv);
63807         void* contents_ptr = untag_ptr(contents);
63808         CHECK_ACCESS(contents_ptr);
63809         LDKOnionMessageContents contents_conv = *(LDKOnionMessageContents*)(contents_ptr);
63810         if (contents_conv.free == LDKOnionMessageContents_JCalls_free) {
63811                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
63812                 LDKOnionMessageContents_JCalls_cloned(&contents_conv);
63813         }
63814         LDKBlindedPath reply_path_conv;
63815         reply_path_conv.inner = untag_ptr(reply_path);
63816         reply_path_conv.is_owned = ptr_is_owned(reply_path);
63817         CHECK_INNER_FIELD_ACCESS_OR_NULL(reply_path_conv);
63818         reply_path_conv = BlindedPath_clone(&reply_path_conv);
63819         LDKCResult_C2Tuple_PublicKeyOnionMessageZSendErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_PublicKeyOnionMessageZSendErrorZ), "LDKCResult_C2Tuple_PublicKeyOnionMessageZSendErrorZ");
63820         *ret_conv = create_onion_message(entropy_source_conv, node_signer_conv, path_conv, contents_conv, reply_path_conv);
63821         return tag_ptr(ret_conv, true);
63822 }
63823
63824 uint64_t  __attribute__((export_name("TS_peel_onion_message"))) TS_peel_onion_message(uint64_t msg, uint64_t node_signer, uint64_t logger, uint64_t custom_handler) {
63825         LDKOnionMessage msg_conv;
63826         msg_conv.inner = untag_ptr(msg);
63827         msg_conv.is_owned = ptr_is_owned(msg);
63828         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
63829         msg_conv.is_owned = false;
63830         void* node_signer_ptr = untag_ptr(node_signer);
63831         CHECK_ACCESS(node_signer_ptr);
63832         LDKNodeSigner node_signer_conv = *(LDKNodeSigner*)(node_signer_ptr);
63833         if (node_signer_conv.free == LDKNodeSigner_JCalls_free) {
63834                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
63835                 LDKNodeSigner_JCalls_cloned(&node_signer_conv);
63836         }
63837         void* logger_ptr = untag_ptr(logger);
63838         CHECK_ACCESS(logger_ptr);
63839         LDKLogger logger_conv = *(LDKLogger*)(logger_ptr);
63840         if (logger_conv.free == LDKLogger_JCalls_free) {
63841                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
63842                 LDKLogger_JCalls_cloned(&logger_conv);
63843         }
63844         void* custom_handler_ptr = untag_ptr(custom_handler);
63845         CHECK_ACCESS(custom_handler_ptr);
63846         LDKCustomOnionMessageHandler custom_handler_conv = *(LDKCustomOnionMessageHandler*)(custom_handler_ptr);
63847         if (custom_handler_conv.free == LDKCustomOnionMessageHandler_JCalls_free) {
63848                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
63849                 LDKCustomOnionMessageHandler_JCalls_cloned(&custom_handler_conv);
63850         }
63851         LDKCResult_PeeledOnionNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_PeeledOnionNoneZ), "LDKCResult_PeeledOnionNoneZ");
63852         *ret_conv = peel_onion_message(&msg_conv, node_signer_conv, logger_conv, custom_handler_conv);
63853         return tag_ptr(ret_conv, true);
63854 }
63855
63856 uint64_t  __attribute__((export_name("TS_OnionMessenger_new"))) TS_OnionMessenger_new(uint64_t entropy_source, uint64_t node_signer, uint64_t logger, uint64_t message_router, uint64_t offers_handler, uint64_t custom_handler) {
63857         void* entropy_source_ptr = untag_ptr(entropy_source);
63858         CHECK_ACCESS(entropy_source_ptr);
63859         LDKEntropySource entropy_source_conv = *(LDKEntropySource*)(entropy_source_ptr);
63860         if (entropy_source_conv.free == LDKEntropySource_JCalls_free) {
63861                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
63862                 LDKEntropySource_JCalls_cloned(&entropy_source_conv);
63863         }
63864         void* node_signer_ptr = untag_ptr(node_signer);
63865         CHECK_ACCESS(node_signer_ptr);
63866         LDKNodeSigner node_signer_conv = *(LDKNodeSigner*)(node_signer_ptr);
63867         if (node_signer_conv.free == LDKNodeSigner_JCalls_free) {
63868                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
63869                 LDKNodeSigner_JCalls_cloned(&node_signer_conv);
63870         }
63871         void* logger_ptr = untag_ptr(logger);
63872         CHECK_ACCESS(logger_ptr);
63873         LDKLogger logger_conv = *(LDKLogger*)(logger_ptr);
63874         if (logger_conv.free == LDKLogger_JCalls_free) {
63875                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
63876                 LDKLogger_JCalls_cloned(&logger_conv);
63877         }
63878         void* message_router_ptr = untag_ptr(message_router);
63879         CHECK_ACCESS(message_router_ptr);
63880         LDKMessageRouter message_router_conv = *(LDKMessageRouter*)(message_router_ptr);
63881         if (message_router_conv.free == LDKMessageRouter_JCalls_free) {
63882                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
63883                 LDKMessageRouter_JCalls_cloned(&message_router_conv);
63884         }
63885         void* offers_handler_ptr = untag_ptr(offers_handler);
63886         CHECK_ACCESS(offers_handler_ptr);
63887         LDKOffersMessageHandler offers_handler_conv = *(LDKOffersMessageHandler*)(offers_handler_ptr);
63888         if (offers_handler_conv.free == LDKOffersMessageHandler_JCalls_free) {
63889                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
63890                 LDKOffersMessageHandler_JCalls_cloned(&offers_handler_conv);
63891         }
63892         void* custom_handler_ptr = untag_ptr(custom_handler);
63893         CHECK_ACCESS(custom_handler_ptr);
63894         LDKCustomOnionMessageHandler custom_handler_conv = *(LDKCustomOnionMessageHandler*)(custom_handler_ptr);
63895         if (custom_handler_conv.free == LDKCustomOnionMessageHandler_JCalls_free) {
63896                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
63897                 LDKCustomOnionMessageHandler_JCalls_cloned(&custom_handler_conv);
63898         }
63899         LDKOnionMessenger ret_var = OnionMessenger_new(entropy_source_conv, node_signer_conv, logger_conv, message_router_conv, offers_handler_conv, custom_handler_conv);
63900         uint64_t ret_ref = 0;
63901         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
63902         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
63903         return ret_ref;
63904 }
63905
63906 uint64_t  __attribute__((export_name("TS_OnionMessenger_send_onion_message"))) TS_OnionMessenger_send_onion_message(uint64_t this_arg, uint64_t path, uint64_t contents, uint64_t reply_path) {
63907         LDKOnionMessenger this_arg_conv;
63908         this_arg_conv.inner = untag_ptr(this_arg);
63909         this_arg_conv.is_owned = ptr_is_owned(this_arg);
63910         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
63911         this_arg_conv.is_owned = false;
63912         LDKOnionMessagePath path_conv;
63913         path_conv.inner = untag_ptr(path);
63914         path_conv.is_owned = ptr_is_owned(path);
63915         CHECK_INNER_FIELD_ACCESS_OR_NULL(path_conv);
63916         path_conv = OnionMessagePath_clone(&path_conv);
63917         void* contents_ptr = untag_ptr(contents);
63918         CHECK_ACCESS(contents_ptr);
63919         LDKOnionMessageContents contents_conv = *(LDKOnionMessageContents*)(contents_ptr);
63920         if (contents_conv.free == LDKOnionMessageContents_JCalls_free) {
63921                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
63922                 LDKOnionMessageContents_JCalls_cloned(&contents_conv);
63923         }
63924         LDKBlindedPath reply_path_conv;
63925         reply_path_conv.inner = untag_ptr(reply_path);
63926         reply_path_conv.is_owned = ptr_is_owned(reply_path);
63927         CHECK_INNER_FIELD_ACCESS_OR_NULL(reply_path_conv);
63928         reply_path_conv = BlindedPath_clone(&reply_path_conv);
63929         LDKCResult_NoneSendErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneSendErrorZ), "LDKCResult_NoneSendErrorZ");
63930         *ret_conv = OnionMessenger_send_onion_message(&this_arg_conv, path_conv, contents_conv, reply_path_conv);
63931         return tag_ptr(ret_conv, true);
63932 }
63933
63934 uint64_t  __attribute__((export_name("TS_OnionMessenger_as_OnionMessageHandler"))) TS_OnionMessenger_as_OnionMessageHandler(uint64_t this_arg) {
63935         LDKOnionMessenger this_arg_conv;
63936         this_arg_conv.inner = untag_ptr(this_arg);
63937         this_arg_conv.is_owned = ptr_is_owned(this_arg);
63938         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
63939         this_arg_conv.is_owned = false;
63940         LDKOnionMessageHandler* ret_ret = MALLOC(sizeof(LDKOnionMessageHandler), "LDKOnionMessageHandler");
63941         *ret_ret = OnionMessenger_as_OnionMessageHandler(&this_arg_conv);
63942         return tag_ptr(ret_ret, true);
63943 }
63944
63945 void  __attribute__((export_name("TS_OffersMessageHandler_free"))) TS_OffersMessageHandler_free(uint64_t this_ptr) {
63946         if (!ptr_is_owned(this_ptr)) return;
63947         void* this_ptr_ptr = untag_ptr(this_ptr);
63948         CHECK_ACCESS(this_ptr_ptr);
63949         LDKOffersMessageHandler this_ptr_conv = *(LDKOffersMessageHandler*)(this_ptr_ptr);
63950         FREE(untag_ptr(this_ptr));
63951         OffersMessageHandler_free(this_ptr_conv);
63952 }
63953
63954 void  __attribute__((export_name("TS_OffersMessage_free"))) TS_OffersMessage_free(uint64_t this_ptr) {
63955         if (!ptr_is_owned(this_ptr)) return;
63956         void* this_ptr_ptr = untag_ptr(this_ptr);
63957         CHECK_ACCESS(this_ptr_ptr);
63958         LDKOffersMessage this_ptr_conv = *(LDKOffersMessage*)(this_ptr_ptr);
63959         FREE(untag_ptr(this_ptr));
63960         OffersMessage_free(this_ptr_conv);
63961 }
63962
63963 static inline uint64_t OffersMessage_clone_ptr(LDKOffersMessage *NONNULL_PTR arg) {
63964         LDKOffersMessage *ret_copy = MALLOC(sizeof(LDKOffersMessage), "LDKOffersMessage");
63965         *ret_copy = OffersMessage_clone(arg);
63966         uint64_t ret_ref = tag_ptr(ret_copy, true);
63967         return ret_ref;
63968 }
63969 int64_t  __attribute__((export_name("TS_OffersMessage_clone_ptr"))) TS_OffersMessage_clone_ptr(uint64_t arg) {
63970         LDKOffersMessage* arg_conv = (LDKOffersMessage*)untag_ptr(arg);
63971         int64_t ret_conv = OffersMessage_clone_ptr(arg_conv);
63972         return ret_conv;
63973 }
63974
63975 uint64_t  __attribute__((export_name("TS_OffersMessage_clone"))) TS_OffersMessage_clone(uint64_t orig) {
63976         LDKOffersMessage* orig_conv = (LDKOffersMessage*)untag_ptr(orig);
63977         LDKOffersMessage *ret_copy = MALLOC(sizeof(LDKOffersMessage), "LDKOffersMessage");
63978         *ret_copy = OffersMessage_clone(orig_conv);
63979         uint64_t ret_ref = tag_ptr(ret_copy, true);
63980         return ret_ref;
63981 }
63982
63983 uint64_t  __attribute__((export_name("TS_OffersMessage_invoice_request"))) TS_OffersMessage_invoice_request(uint64_t a) {
63984         LDKInvoiceRequest a_conv;
63985         a_conv.inner = untag_ptr(a);
63986         a_conv.is_owned = ptr_is_owned(a);
63987         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
63988         a_conv = InvoiceRequest_clone(&a_conv);
63989         LDKOffersMessage *ret_copy = MALLOC(sizeof(LDKOffersMessage), "LDKOffersMessage");
63990         *ret_copy = OffersMessage_invoice_request(a_conv);
63991         uint64_t ret_ref = tag_ptr(ret_copy, true);
63992         return ret_ref;
63993 }
63994
63995 uint64_t  __attribute__((export_name("TS_OffersMessage_invoice"))) TS_OffersMessage_invoice(uint64_t a) {
63996         LDKBolt12Invoice a_conv;
63997         a_conv.inner = untag_ptr(a);
63998         a_conv.is_owned = ptr_is_owned(a);
63999         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
64000         a_conv = Bolt12Invoice_clone(&a_conv);
64001         LDKOffersMessage *ret_copy = MALLOC(sizeof(LDKOffersMessage), "LDKOffersMessage");
64002         *ret_copy = OffersMessage_invoice(a_conv);
64003         uint64_t ret_ref = tag_ptr(ret_copy, true);
64004         return ret_ref;
64005 }
64006
64007 uint64_t  __attribute__((export_name("TS_OffersMessage_invoice_error"))) TS_OffersMessage_invoice_error(uint64_t a) {
64008         LDKInvoiceError a_conv;
64009         a_conv.inner = untag_ptr(a);
64010         a_conv.is_owned = ptr_is_owned(a);
64011         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
64012         a_conv = InvoiceError_clone(&a_conv);
64013         LDKOffersMessage *ret_copy = MALLOC(sizeof(LDKOffersMessage), "LDKOffersMessage");
64014         *ret_copy = OffersMessage_invoice_error(a_conv);
64015         uint64_t ret_ref = tag_ptr(ret_copy, true);
64016         return ret_ref;
64017 }
64018
64019 jboolean  __attribute__((export_name("TS_OffersMessage_is_known_type"))) TS_OffersMessage_is_known_type(int64_t tlv_type) {
64020         jboolean ret_conv = OffersMessage_is_known_type(tlv_type);
64021         return ret_conv;
64022 }
64023
64024 int8_tArray  __attribute__((export_name("TS_OffersMessage_write"))) TS_OffersMessage_write(uint64_t obj) {
64025         LDKOffersMessage* obj_conv = (LDKOffersMessage*)untag_ptr(obj);
64026         LDKCVec_u8Z ret_var = OffersMessage_write(obj_conv);
64027         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
64028         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
64029         CVec_u8Z_free(ret_var);
64030         return ret_arr;
64031 }
64032
64033 uint64_t  __attribute__((export_name("TS_OffersMessage_read"))) TS_OffersMessage_read(int8_tArray ser, int64_t arg_a, uint64_t arg_b) {
64034         LDKu8slice ser_ref;
64035         ser_ref.datalen = ser->arr_len;
64036         ser_ref.data = ser->elems;
64037         void* arg_b_ptr = untag_ptr(arg_b);
64038         if (ptr_is_owned(arg_b)) { CHECK_ACCESS(arg_b_ptr); }
64039         LDKLogger* arg_b_conv = (LDKLogger*)arg_b_ptr;
64040         LDKCResult_OffersMessageDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_OffersMessageDecodeErrorZ), "LDKCResult_OffersMessageDecodeErrorZ");
64041         *ret_conv = OffersMessage_read(ser_ref, arg_a, arg_b_conv);
64042         FREE(ser);
64043         return tag_ptr(ret_conv, true);
64044 }
64045
64046 void  __attribute__((export_name("TS_Packet_free"))) TS_Packet_free(uint64_t this_obj) {
64047         LDKPacket this_obj_conv;
64048         this_obj_conv.inner = untag_ptr(this_obj);
64049         this_obj_conv.is_owned = ptr_is_owned(this_obj);
64050         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
64051         Packet_free(this_obj_conv);
64052 }
64053
64054 int8_t  __attribute__((export_name("TS_Packet_get_version"))) TS_Packet_get_version(uint64_t this_ptr) {
64055         LDKPacket this_ptr_conv;
64056         this_ptr_conv.inner = untag_ptr(this_ptr);
64057         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
64058         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
64059         this_ptr_conv.is_owned = false;
64060         int8_t ret_conv = Packet_get_version(&this_ptr_conv);
64061         return ret_conv;
64062 }
64063
64064 void  __attribute__((export_name("TS_Packet_set_version"))) TS_Packet_set_version(uint64_t this_ptr, int8_t val) {
64065         LDKPacket this_ptr_conv;
64066         this_ptr_conv.inner = untag_ptr(this_ptr);
64067         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
64068         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
64069         this_ptr_conv.is_owned = false;
64070         Packet_set_version(&this_ptr_conv, val);
64071 }
64072
64073 int8_tArray  __attribute__((export_name("TS_Packet_get_public_key"))) TS_Packet_get_public_key(uint64_t this_ptr) {
64074         LDKPacket this_ptr_conv;
64075         this_ptr_conv.inner = untag_ptr(this_ptr);
64076         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
64077         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
64078         this_ptr_conv.is_owned = false;
64079         int8_tArray ret_arr = init_int8_tArray(33, __LINE__);
64080         memcpy(ret_arr->elems, Packet_get_public_key(&this_ptr_conv).compressed_form, 33);
64081         return ret_arr;
64082 }
64083
64084 void  __attribute__((export_name("TS_Packet_set_public_key"))) TS_Packet_set_public_key(uint64_t this_ptr, int8_tArray val) {
64085         LDKPacket this_ptr_conv;
64086         this_ptr_conv.inner = untag_ptr(this_ptr);
64087         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
64088         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
64089         this_ptr_conv.is_owned = false;
64090         LDKPublicKey val_ref;
64091         CHECK(val->arr_len == 33);
64092         memcpy(val_ref.compressed_form, val->elems, 33); FREE(val);
64093         Packet_set_public_key(&this_ptr_conv, val_ref);
64094 }
64095
64096 int8_tArray  __attribute__((export_name("TS_Packet_get_hop_data"))) TS_Packet_get_hop_data(uint64_t this_ptr) {
64097         LDKPacket this_ptr_conv;
64098         this_ptr_conv.inner = untag_ptr(this_ptr);
64099         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
64100         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
64101         this_ptr_conv.is_owned = false;
64102         LDKCVec_u8Z ret_var = Packet_get_hop_data(&this_ptr_conv);
64103         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
64104         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
64105         CVec_u8Z_free(ret_var);
64106         return ret_arr;
64107 }
64108
64109 void  __attribute__((export_name("TS_Packet_set_hop_data"))) TS_Packet_set_hop_data(uint64_t this_ptr, int8_tArray val) {
64110         LDKPacket this_ptr_conv;
64111         this_ptr_conv.inner = untag_ptr(this_ptr);
64112         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
64113         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
64114         this_ptr_conv.is_owned = false;
64115         LDKCVec_u8Z val_ref;
64116         val_ref.datalen = val->arr_len;
64117         val_ref.data = MALLOC(val_ref.datalen, "LDKCVec_u8Z Bytes");
64118         memcpy(val_ref.data, val->elems, val_ref.datalen); FREE(val);
64119         Packet_set_hop_data(&this_ptr_conv, val_ref);
64120 }
64121
64122 int8_tArray  __attribute__((export_name("TS_Packet_get_hmac"))) TS_Packet_get_hmac(uint64_t this_ptr) {
64123         LDKPacket this_ptr_conv;
64124         this_ptr_conv.inner = untag_ptr(this_ptr);
64125         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
64126         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
64127         this_ptr_conv.is_owned = false;
64128         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
64129         memcpy(ret_arr->elems, *Packet_get_hmac(&this_ptr_conv), 32);
64130         return ret_arr;
64131 }
64132
64133 void  __attribute__((export_name("TS_Packet_set_hmac"))) TS_Packet_set_hmac(uint64_t this_ptr, int8_tArray val) {
64134         LDKPacket this_ptr_conv;
64135         this_ptr_conv.inner = untag_ptr(this_ptr);
64136         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
64137         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
64138         this_ptr_conv.is_owned = false;
64139         LDKThirtyTwoBytes val_ref;
64140         CHECK(val->arr_len == 32);
64141         memcpy(val_ref.data, val->elems, 32); FREE(val);
64142         Packet_set_hmac(&this_ptr_conv, val_ref);
64143 }
64144
64145 uint64_t  __attribute__((export_name("TS_Packet_new"))) TS_Packet_new(int8_t version_arg, int8_tArray public_key_arg, int8_tArray hop_data_arg, int8_tArray hmac_arg) {
64146         LDKPublicKey public_key_arg_ref;
64147         CHECK(public_key_arg->arr_len == 33);
64148         memcpy(public_key_arg_ref.compressed_form, public_key_arg->elems, 33); FREE(public_key_arg);
64149         LDKCVec_u8Z hop_data_arg_ref;
64150         hop_data_arg_ref.datalen = hop_data_arg->arr_len;
64151         hop_data_arg_ref.data = MALLOC(hop_data_arg_ref.datalen, "LDKCVec_u8Z Bytes");
64152         memcpy(hop_data_arg_ref.data, hop_data_arg->elems, hop_data_arg_ref.datalen); FREE(hop_data_arg);
64153         LDKThirtyTwoBytes hmac_arg_ref;
64154         CHECK(hmac_arg->arr_len == 32);
64155         memcpy(hmac_arg_ref.data, hmac_arg->elems, 32); FREE(hmac_arg);
64156         LDKPacket ret_var = Packet_new(version_arg, public_key_arg_ref, hop_data_arg_ref, hmac_arg_ref);
64157         uint64_t ret_ref = 0;
64158         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
64159         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
64160         return ret_ref;
64161 }
64162
64163 static inline uint64_t Packet_clone_ptr(LDKPacket *NONNULL_PTR arg) {
64164         LDKPacket ret_var = Packet_clone(arg);
64165         uint64_t ret_ref = 0;
64166         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
64167         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
64168         return ret_ref;
64169 }
64170 int64_t  __attribute__((export_name("TS_Packet_clone_ptr"))) TS_Packet_clone_ptr(uint64_t arg) {
64171         LDKPacket arg_conv;
64172         arg_conv.inner = untag_ptr(arg);
64173         arg_conv.is_owned = ptr_is_owned(arg);
64174         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
64175         arg_conv.is_owned = false;
64176         int64_t ret_conv = Packet_clone_ptr(&arg_conv);
64177         return ret_conv;
64178 }
64179
64180 uint64_t  __attribute__((export_name("TS_Packet_clone"))) TS_Packet_clone(uint64_t orig) {
64181         LDKPacket orig_conv;
64182         orig_conv.inner = untag_ptr(orig);
64183         orig_conv.is_owned = ptr_is_owned(orig);
64184         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
64185         orig_conv.is_owned = false;
64186         LDKPacket ret_var = Packet_clone(&orig_conv);
64187         uint64_t ret_ref = 0;
64188         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
64189         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
64190         return ret_ref;
64191 }
64192
64193 jboolean  __attribute__((export_name("TS_Packet_eq"))) TS_Packet_eq(uint64_t a, uint64_t b) {
64194         LDKPacket a_conv;
64195         a_conv.inner = untag_ptr(a);
64196         a_conv.is_owned = ptr_is_owned(a);
64197         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
64198         a_conv.is_owned = false;
64199         LDKPacket b_conv;
64200         b_conv.inner = untag_ptr(b);
64201         b_conv.is_owned = ptr_is_owned(b);
64202         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
64203         b_conv.is_owned = false;
64204         jboolean ret_conv = Packet_eq(&a_conv, &b_conv);
64205         return ret_conv;
64206 }
64207
64208 int8_tArray  __attribute__((export_name("TS_Packet_write"))) TS_Packet_write(uint64_t obj) {
64209         LDKPacket obj_conv;
64210         obj_conv.inner = untag_ptr(obj);
64211         obj_conv.is_owned = ptr_is_owned(obj);
64212         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
64213         obj_conv.is_owned = false;
64214         LDKCVec_u8Z ret_var = Packet_write(&obj_conv);
64215         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
64216         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
64217         CVec_u8Z_free(ret_var);
64218         return ret_arr;
64219 }
64220
64221 void  __attribute__((export_name("TS_ParsedOnionMessageContents_free"))) TS_ParsedOnionMessageContents_free(uint64_t this_ptr) {
64222         if (!ptr_is_owned(this_ptr)) return;
64223         void* this_ptr_ptr = untag_ptr(this_ptr);
64224         CHECK_ACCESS(this_ptr_ptr);
64225         LDKParsedOnionMessageContents this_ptr_conv = *(LDKParsedOnionMessageContents*)(this_ptr_ptr);
64226         FREE(untag_ptr(this_ptr));
64227         ParsedOnionMessageContents_free(this_ptr_conv);
64228 }
64229
64230 static inline uint64_t ParsedOnionMessageContents_clone_ptr(LDKParsedOnionMessageContents *NONNULL_PTR arg) {
64231         LDKParsedOnionMessageContents *ret_copy = MALLOC(sizeof(LDKParsedOnionMessageContents), "LDKParsedOnionMessageContents");
64232         *ret_copy = ParsedOnionMessageContents_clone(arg);
64233         uint64_t ret_ref = tag_ptr(ret_copy, true);
64234         return ret_ref;
64235 }
64236 int64_t  __attribute__((export_name("TS_ParsedOnionMessageContents_clone_ptr"))) TS_ParsedOnionMessageContents_clone_ptr(uint64_t arg) {
64237         LDKParsedOnionMessageContents* arg_conv = (LDKParsedOnionMessageContents*)untag_ptr(arg);
64238         int64_t ret_conv = ParsedOnionMessageContents_clone_ptr(arg_conv);
64239         return ret_conv;
64240 }
64241
64242 uint64_t  __attribute__((export_name("TS_ParsedOnionMessageContents_clone"))) TS_ParsedOnionMessageContents_clone(uint64_t orig) {
64243         LDKParsedOnionMessageContents* orig_conv = (LDKParsedOnionMessageContents*)untag_ptr(orig);
64244         LDKParsedOnionMessageContents *ret_copy = MALLOC(sizeof(LDKParsedOnionMessageContents), "LDKParsedOnionMessageContents");
64245         *ret_copy = ParsedOnionMessageContents_clone(orig_conv);
64246         uint64_t ret_ref = tag_ptr(ret_copy, true);
64247         return ret_ref;
64248 }
64249
64250 uint64_t  __attribute__((export_name("TS_ParsedOnionMessageContents_offers"))) TS_ParsedOnionMessageContents_offers(uint64_t a) {
64251         void* a_ptr = untag_ptr(a);
64252         CHECK_ACCESS(a_ptr);
64253         LDKOffersMessage a_conv = *(LDKOffersMessage*)(a_ptr);
64254         a_conv = OffersMessage_clone((LDKOffersMessage*)untag_ptr(a));
64255         LDKParsedOnionMessageContents *ret_copy = MALLOC(sizeof(LDKParsedOnionMessageContents), "LDKParsedOnionMessageContents");
64256         *ret_copy = ParsedOnionMessageContents_offers(a_conv);
64257         uint64_t ret_ref = tag_ptr(ret_copy, true);
64258         return ret_ref;
64259 }
64260
64261 uint64_t  __attribute__((export_name("TS_ParsedOnionMessageContents_custom"))) TS_ParsedOnionMessageContents_custom(uint64_t a) {
64262         void* a_ptr = untag_ptr(a);
64263         CHECK_ACCESS(a_ptr);
64264         LDKOnionMessageContents a_conv = *(LDKOnionMessageContents*)(a_ptr);
64265         if (a_conv.free == LDKOnionMessageContents_JCalls_free) {
64266                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
64267                 LDKOnionMessageContents_JCalls_cloned(&a_conv);
64268         }
64269         LDKParsedOnionMessageContents *ret_copy = MALLOC(sizeof(LDKParsedOnionMessageContents), "LDKParsedOnionMessageContents");
64270         *ret_copy = ParsedOnionMessageContents_custom(a_conv);
64271         uint64_t ret_ref = tag_ptr(ret_copy, true);
64272         return ret_ref;
64273 }
64274
64275 uint64_t  __attribute__((export_name("TS_ParsedOnionMessageContents_as_OnionMessageContents"))) TS_ParsedOnionMessageContents_as_OnionMessageContents(uint64_t this_arg) {
64276         LDKParsedOnionMessageContents* this_arg_conv = (LDKParsedOnionMessageContents*)untag_ptr(this_arg);
64277         LDKOnionMessageContents* ret_ret = MALLOC(sizeof(LDKOnionMessageContents), "LDKOnionMessageContents");
64278         *ret_ret = ParsedOnionMessageContents_as_OnionMessageContents(this_arg_conv);
64279         return tag_ptr(ret_ret, true);
64280 }
64281
64282 int8_tArray  __attribute__((export_name("TS_ParsedOnionMessageContents_write"))) TS_ParsedOnionMessageContents_write(uint64_t obj) {
64283         LDKParsedOnionMessageContents* obj_conv = (LDKParsedOnionMessageContents*)untag_ptr(obj);
64284         LDKCVec_u8Z ret_var = ParsedOnionMessageContents_write(obj_conv);
64285         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
64286         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
64287         CVec_u8Z_free(ret_var);
64288         return ret_arr;
64289 }
64290
64291 static inline uint64_t OnionMessageContents_clone_ptr(LDKOnionMessageContents *NONNULL_PTR arg) {
64292         LDKOnionMessageContents* ret_ret = MALLOC(sizeof(LDKOnionMessageContents), "LDKOnionMessageContents");
64293         *ret_ret = OnionMessageContents_clone(arg);
64294         return tag_ptr(ret_ret, true);
64295 }
64296 int64_t  __attribute__((export_name("TS_OnionMessageContents_clone_ptr"))) TS_OnionMessageContents_clone_ptr(uint64_t arg) {
64297         void* arg_ptr = untag_ptr(arg);
64298         if (ptr_is_owned(arg)) { CHECK_ACCESS(arg_ptr); }
64299         LDKOnionMessageContents* arg_conv = (LDKOnionMessageContents*)arg_ptr;
64300         int64_t ret_conv = OnionMessageContents_clone_ptr(arg_conv);
64301         return ret_conv;
64302 }
64303
64304 uint64_t  __attribute__((export_name("TS_OnionMessageContents_clone"))) TS_OnionMessageContents_clone(uint64_t orig) {
64305         void* orig_ptr = untag_ptr(orig);
64306         if (ptr_is_owned(orig)) { CHECK_ACCESS(orig_ptr); }
64307         LDKOnionMessageContents* orig_conv = (LDKOnionMessageContents*)orig_ptr;
64308         LDKOnionMessageContents* ret_ret = MALLOC(sizeof(LDKOnionMessageContents), "LDKOnionMessageContents");
64309         *ret_ret = OnionMessageContents_clone(orig_conv);
64310         return tag_ptr(ret_ret, true);
64311 }
64312
64313 void  __attribute__((export_name("TS_OnionMessageContents_free"))) TS_OnionMessageContents_free(uint64_t this_ptr) {
64314         if (!ptr_is_owned(this_ptr)) return;
64315         void* this_ptr_ptr = untag_ptr(this_ptr);
64316         CHECK_ACCESS(this_ptr_ptr);
64317         LDKOnionMessageContents this_ptr_conv = *(LDKOnionMessageContents*)(this_ptr_ptr);
64318         FREE(untag_ptr(this_ptr));
64319         OnionMessageContents_free(this_ptr_conv);
64320 }
64321
64322 void  __attribute__((export_name("TS_BlindedPath_free"))) TS_BlindedPath_free(uint64_t this_obj) {
64323         LDKBlindedPath this_obj_conv;
64324         this_obj_conv.inner = untag_ptr(this_obj);
64325         this_obj_conv.is_owned = ptr_is_owned(this_obj);
64326         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
64327         BlindedPath_free(this_obj_conv);
64328 }
64329
64330 int8_tArray  __attribute__((export_name("TS_BlindedPath_get_introduction_node_id"))) TS_BlindedPath_get_introduction_node_id(uint64_t this_ptr) {
64331         LDKBlindedPath this_ptr_conv;
64332         this_ptr_conv.inner = untag_ptr(this_ptr);
64333         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
64334         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
64335         this_ptr_conv.is_owned = false;
64336         int8_tArray ret_arr = init_int8_tArray(33, __LINE__);
64337         memcpy(ret_arr->elems, BlindedPath_get_introduction_node_id(&this_ptr_conv).compressed_form, 33);
64338         return ret_arr;
64339 }
64340
64341 void  __attribute__((export_name("TS_BlindedPath_set_introduction_node_id"))) TS_BlindedPath_set_introduction_node_id(uint64_t this_ptr, int8_tArray val) {
64342         LDKBlindedPath this_ptr_conv;
64343         this_ptr_conv.inner = untag_ptr(this_ptr);
64344         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
64345         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
64346         this_ptr_conv.is_owned = false;
64347         LDKPublicKey val_ref;
64348         CHECK(val->arr_len == 33);
64349         memcpy(val_ref.compressed_form, val->elems, 33); FREE(val);
64350         BlindedPath_set_introduction_node_id(&this_ptr_conv, val_ref);
64351 }
64352
64353 int8_tArray  __attribute__((export_name("TS_BlindedPath_get_blinding_point"))) TS_BlindedPath_get_blinding_point(uint64_t this_ptr) {
64354         LDKBlindedPath this_ptr_conv;
64355         this_ptr_conv.inner = untag_ptr(this_ptr);
64356         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
64357         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
64358         this_ptr_conv.is_owned = false;
64359         int8_tArray ret_arr = init_int8_tArray(33, __LINE__);
64360         memcpy(ret_arr->elems, BlindedPath_get_blinding_point(&this_ptr_conv).compressed_form, 33);
64361         return ret_arr;
64362 }
64363
64364 void  __attribute__((export_name("TS_BlindedPath_set_blinding_point"))) TS_BlindedPath_set_blinding_point(uint64_t this_ptr, int8_tArray val) {
64365         LDKBlindedPath this_ptr_conv;
64366         this_ptr_conv.inner = untag_ptr(this_ptr);
64367         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
64368         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
64369         this_ptr_conv.is_owned = false;
64370         LDKPublicKey val_ref;
64371         CHECK(val->arr_len == 33);
64372         memcpy(val_ref.compressed_form, val->elems, 33); FREE(val);
64373         BlindedPath_set_blinding_point(&this_ptr_conv, val_ref);
64374 }
64375
64376 uint64_tArray  __attribute__((export_name("TS_BlindedPath_get_blinded_hops"))) TS_BlindedPath_get_blinded_hops(uint64_t this_ptr) {
64377         LDKBlindedPath this_ptr_conv;
64378         this_ptr_conv.inner = untag_ptr(this_ptr);
64379         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
64380         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
64381         this_ptr_conv.is_owned = false;
64382         LDKCVec_BlindedHopZ ret_var = BlindedPath_get_blinded_hops(&this_ptr_conv);
64383         uint64_tArray ret_arr = NULL;
64384         ret_arr = init_uint64_tArray(ret_var.datalen, __LINE__);
64385         uint64_t *ret_arr_ptr = (uint64_t*)(((uint8_t*)ret_arr) + 8);
64386         for (size_t m = 0; m < ret_var.datalen; m++) {
64387                 LDKBlindedHop ret_conv_12_var = ret_var.data[m];
64388                 uint64_t ret_conv_12_ref = 0;
64389                 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_conv_12_var);
64390                 ret_conv_12_ref = tag_ptr(ret_conv_12_var.inner, ret_conv_12_var.is_owned);
64391                 ret_arr_ptr[m] = ret_conv_12_ref;
64392         }
64393         
64394         FREE(ret_var.data);
64395         return ret_arr;
64396 }
64397
64398 void  __attribute__((export_name("TS_BlindedPath_set_blinded_hops"))) TS_BlindedPath_set_blinded_hops(uint64_t this_ptr, uint64_tArray val) {
64399         LDKBlindedPath this_ptr_conv;
64400         this_ptr_conv.inner = untag_ptr(this_ptr);
64401         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
64402         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
64403         this_ptr_conv.is_owned = false;
64404         LDKCVec_BlindedHopZ val_constr;
64405         val_constr.datalen = val->arr_len;
64406         if (val_constr.datalen > 0)
64407                 val_constr.data = MALLOC(val_constr.datalen * sizeof(LDKBlindedHop), "LDKCVec_BlindedHopZ Elements");
64408         else
64409                 val_constr.data = NULL;
64410         uint64_t* val_vals = val->elems;
64411         for (size_t m = 0; m < val_constr.datalen; m++) {
64412                 uint64_t val_conv_12 = val_vals[m];
64413                 LDKBlindedHop val_conv_12_conv;
64414                 val_conv_12_conv.inner = untag_ptr(val_conv_12);
64415                 val_conv_12_conv.is_owned = ptr_is_owned(val_conv_12);
64416                 CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv_12_conv);
64417                 val_conv_12_conv = BlindedHop_clone(&val_conv_12_conv);
64418                 val_constr.data[m] = val_conv_12_conv;
64419         }
64420         FREE(val);
64421         BlindedPath_set_blinded_hops(&this_ptr_conv, val_constr);
64422 }
64423
64424 uint64_t  __attribute__((export_name("TS_BlindedPath_new"))) TS_BlindedPath_new(int8_tArray introduction_node_id_arg, int8_tArray blinding_point_arg, uint64_tArray blinded_hops_arg) {
64425         LDKPublicKey introduction_node_id_arg_ref;
64426         CHECK(introduction_node_id_arg->arr_len == 33);
64427         memcpy(introduction_node_id_arg_ref.compressed_form, introduction_node_id_arg->elems, 33); FREE(introduction_node_id_arg);
64428         LDKPublicKey blinding_point_arg_ref;
64429         CHECK(blinding_point_arg->arr_len == 33);
64430         memcpy(blinding_point_arg_ref.compressed_form, blinding_point_arg->elems, 33); FREE(blinding_point_arg);
64431         LDKCVec_BlindedHopZ blinded_hops_arg_constr;
64432         blinded_hops_arg_constr.datalen = blinded_hops_arg->arr_len;
64433         if (blinded_hops_arg_constr.datalen > 0)
64434                 blinded_hops_arg_constr.data = MALLOC(blinded_hops_arg_constr.datalen * sizeof(LDKBlindedHop), "LDKCVec_BlindedHopZ Elements");
64435         else
64436                 blinded_hops_arg_constr.data = NULL;
64437         uint64_t* blinded_hops_arg_vals = blinded_hops_arg->elems;
64438         for (size_t m = 0; m < blinded_hops_arg_constr.datalen; m++) {
64439                 uint64_t blinded_hops_arg_conv_12 = blinded_hops_arg_vals[m];
64440                 LDKBlindedHop blinded_hops_arg_conv_12_conv;
64441                 blinded_hops_arg_conv_12_conv.inner = untag_ptr(blinded_hops_arg_conv_12);
64442                 blinded_hops_arg_conv_12_conv.is_owned = ptr_is_owned(blinded_hops_arg_conv_12);
64443                 CHECK_INNER_FIELD_ACCESS_OR_NULL(blinded_hops_arg_conv_12_conv);
64444                 blinded_hops_arg_conv_12_conv = BlindedHop_clone(&blinded_hops_arg_conv_12_conv);
64445                 blinded_hops_arg_constr.data[m] = blinded_hops_arg_conv_12_conv;
64446         }
64447         FREE(blinded_hops_arg);
64448         LDKBlindedPath ret_var = BlindedPath_new(introduction_node_id_arg_ref, blinding_point_arg_ref, blinded_hops_arg_constr);
64449         uint64_t ret_ref = 0;
64450         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
64451         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
64452         return ret_ref;
64453 }
64454
64455 static inline uint64_t BlindedPath_clone_ptr(LDKBlindedPath *NONNULL_PTR arg) {
64456         LDKBlindedPath ret_var = BlindedPath_clone(arg);
64457         uint64_t ret_ref = 0;
64458         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
64459         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
64460         return ret_ref;
64461 }
64462 int64_t  __attribute__((export_name("TS_BlindedPath_clone_ptr"))) TS_BlindedPath_clone_ptr(uint64_t arg) {
64463         LDKBlindedPath arg_conv;
64464         arg_conv.inner = untag_ptr(arg);
64465         arg_conv.is_owned = ptr_is_owned(arg);
64466         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
64467         arg_conv.is_owned = false;
64468         int64_t ret_conv = BlindedPath_clone_ptr(&arg_conv);
64469         return ret_conv;
64470 }
64471
64472 uint64_t  __attribute__((export_name("TS_BlindedPath_clone"))) TS_BlindedPath_clone(uint64_t orig) {
64473         LDKBlindedPath orig_conv;
64474         orig_conv.inner = untag_ptr(orig);
64475         orig_conv.is_owned = ptr_is_owned(orig);
64476         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
64477         orig_conv.is_owned = false;
64478         LDKBlindedPath ret_var = BlindedPath_clone(&orig_conv);
64479         uint64_t ret_ref = 0;
64480         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
64481         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
64482         return ret_ref;
64483 }
64484
64485 int64_t  __attribute__((export_name("TS_BlindedPath_hash"))) TS_BlindedPath_hash(uint64_t o) {
64486         LDKBlindedPath o_conv;
64487         o_conv.inner = untag_ptr(o);
64488         o_conv.is_owned = ptr_is_owned(o);
64489         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
64490         o_conv.is_owned = false;
64491         int64_t ret_conv = BlindedPath_hash(&o_conv);
64492         return ret_conv;
64493 }
64494
64495 jboolean  __attribute__((export_name("TS_BlindedPath_eq"))) TS_BlindedPath_eq(uint64_t a, uint64_t b) {
64496         LDKBlindedPath a_conv;
64497         a_conv.inner = untag_ptr(a);
64498         a_conv.is_owned = ptr_is_owned(a);
64499         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
64500         a_conv.is_owned = false;
64501         LDKBlindedPath b_conv;
64502         b_conv.inner = untag_ptr(b);
64503         b_conv.is_owned = ptr_is_owned(b);
64504         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
64505         b_conv.is_owned = false;
64506         jboolean ret_conv = BlindedPath_eq(&a_conv, &b_conv);
64507         return ret_conv;
64508 }
64509
64510 void  __attribute__((export_name("TS_BlindedHop_free"))) TS_BlindedHop_free(uint64_t this_obj) {
64511         LDKBlindedHop this_obj_conv;
64512         this_obj_conv.inner = untag_ptr(this_obj);
64513         this_obj_conv.is_owned = ptr_is_owned(this_obj);
64514         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
64515         BlindedHop_free(this_obj_conv);
64516 }
64517
64518 int8_tArray  __attribute__((export_name("TS_BlindedHop_get_blinded_node_id"))) TS_BlindedHop_get_blinded_node_id(uint64_t this_ptr) {
64519         LDKBlindedHop this_ptr_conv;
64520         this_ptr_conv.inner = untag_ptr(this_ptr);
64521         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
64522         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
64523         this_ptr_conv.is_owned = false;
64524         int8_tArray ret_arr = init_int8_tArray(33, __LINE__);
64525         memcpy(ret_arr->elems, BlindedHop_get_blinded_node_id(&this_ptr_conv).compressed_form, 33);
64526         return ret_arr;
64527 }
64528
64529 void  __attribute__((export_name("TS_BlindedHop_set_blinded_node_id"))) TS_BlindedHop_set_blinded_node_id(uint64_t this_ptr, int8_tArray val) {
64530         LDKBlindedHop this_ptr_conv;
64531         this_ptr_conv.inner = untag_ptr(this_ptr);
64532         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
64533         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
64534         this_ptr_conv.is_owned = false;
64535         LDKPublicKey val_ref;
64536         CHECK(val->arr_len == 33);
64537         memcpy(val_ref.compressed_form, val->elems, 33); FREE(val);
64538         BlindedHop_set_blinded_node_id(&this_ptr_conv, val_ref);
64539 }
64540
64541 int8_tArray  __attribute__((export_name("TS_BlindedHop_get_encrypted_payload"))) TS_BlindedHop_get_encrypted_payload(uint64_t this_ptr) {
64542         LDKBlindedHop this_ptr_conv;
64543         this_ptr_conv.inner = untag_ptr(this_ptr);
64544         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
64545         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
64546         this_ptr_conv.is_owned = false;
64547         LDKCVec_u8Z ret_var = BlindedHop_get_encrypted_payload(&this_ptr_conv);
64548         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
64549         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
64550         CVec_u8Z_free(ret_var);
64551         return ret_arr;
64552 }
64553
64554 void  __attribute__((export_name("TS_BlindedHop_set_encrypted_payload"))) TS_BlindedHop_set_encrypted_payload(uint64_t this_ptr, int8_tArray val) {
64555         LDKBlindedHop this_ptr_conv;
64556         this_ptr_conv.inner = untag_ptr(this_ptr);
64557         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
64558         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
64559         this_ptr_conv.is_owned = false;
64560         LDKCVec_u8Z val_ref;
64561         val_ref.datalen = val->arr_len;
64562         val_ref.data = MALLOC(val_ref.datalen, "LDKCVec_u8Z Bytes");
64563         memcpy(val_ref.data, val->elems, val_ref.datalen); FREE(val);
64564         BlindedHop_set_encrypted_payload(&this_ptr_conv, val_ref);
64565 }
64566
64567 uint64_t  __attribute__((export_name("TS_BlindedHop_new"))) TS_BlindedHop_new(int8_tArray blinded_node_id_arg, int8_tArray encrypted_payload_arg) {
64568         LDKPublicKey blinded_node_id_arg_ref;
64569         CHECK(blinded_node_id_arg->arr_len == 33);
64570         memcpy(blinded_node_id_arg_ref.compressed_form, blinded_node_id_arg->elems, 33); FREE(blinded_node_id_arg);
64571         LDKCVec_u8Z encrypted_payload_arg_ref;
64572         encrypted_payload_arg_ref.datalen = encrypted_payload_arg->arr_len;
64573         encrypted_payload_arg_ref.data = MALLOC(encrypted_payload_arg_ref.datalen, "LDKCVec_u8Z Bytes");
64574         memcpy(encrypted_payload_arg_ref.data, encrypted_payload_arg->elems, encrypted_payload_arg_ref.datalen); FREE(encrypted_payload_arg);
64575         LDKBlindedHop ret_var = BlindedHop_new(blinded_node_id_arg_ref, encrypted_payload_arg_ref);
64576         uint64_t ret_ref = 0;
64577         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
64578         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
64579         return ret_ref;
64580 }
64581
64582 static inline uint64_t BlindedHop_clone_ptr(LDKBlindedHop *NONNULL_PTR arg) {
64583         LDKBlindedHop ret_var = BlindedHop_clone(arg);
64584         uint64_t ret_ref = 0;
64585         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
64586         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
64587         return ret_ref;
64588 }
64589 int64_t  __attribute__((export_name("TS_BlindedHop_clone_ptr"))) TS_BlindedHop_clone_ptr(uint64_t arg) {
64590         LDKBlindedHop arg_conv;
64591         arg_conv.inner = untag_ptr(arg);
64592         arg_conv.is_owned = ptr_is_owned(arg);
64593         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
64594         arg_conv.is_owned = false;
64595         int64_t ret_conv = BlindedHop_clone_ptr(&arg_conv);
64596         return ret_conv;
64597 }
64598
64599 uint64_t  __attribute__((export_name("TS_BlindedHop_clone"))) TS_BlindedHop_clone(uint64_t orig) {
64600         LDKBlindedHop orig_conv;
64601         orig_conv.inner = untag_ptr(orig);
64602         orig_conv.is_owned = ptr_is_owned(orig);
64603         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
64604         orig_conv.is_owned = false;
64605         LDKBlindedHop ret_var = BlindedHop_clone(&orig_conv);
64606         uint64_t ret_ref = 0;
64607         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
64608         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
64609         return ret_ref;
64610 }
64611
64612 int64_t  __attribute__((export_name("TS_BlindedHop_hash"))) TS_BlindedHop_hash(uint64_t o) {
64613         LDKBlindedHop o_conv;
64614         o_conv.inner = untag_ptr(o);
64615         o_conv.is_owned = ptr_is_owned(o);
64616         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
64617         o_conv.is_owned = false;
64618         int64_t ret_conv = BlindedHop_hash(&o_conv);
64619         return ret_conv;
64620 }
64621
64622 jboolean  __attribute__((export_name("TS_BlindedHop_eq"))) TS_BlindedHop_eq(uint64_t a, uint64_t b) {
64623         LDKBlindedHop a_conv;
64624         a_conv.inner = untag_ptr(a);
64625         a_conv.is_owned = ptr_is_owned(a);
64626         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
64627         a_conv.is_owned = false;
64628         LDKBlindedHop b_conv;
64629         b_conv.inner = untag_ptr(b);
64630         b_conv.is_owned = ptr_is_owned(b);
64631         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
64632         b_conv.is_owned = false;
64633         jboolean ret_conv = BlindedHop_eq(&a_conv, &b_conv);
64634         return ret_conv;
64635 }
64636
64637 uint64_t  __attribute__((export_name("TS_BlindedPath_one_hop_for_message"))) TS_BlindedPath_one_hop_for_message(int8_tArray recipient_node_id, uint64_t entropy_source) {
64638         LDKPublicKey recipient_node_id_ref;
64639         CHECK(recipient_node_id->arr_len == 33);
64640         memcpy(recipient_node_id_ref.compressed_form, recipient_node_id->elems, 33); FREE(recipient_node_id);
64641         void* entropy_source_ptr = untag_ptr(entropy_source);
64642         if (ptr_is_owned(entropy_source)) { CHECK_ACCESS(entropy_source_ptr); }
64643         LDKEntropySource* entropy_source_conv = (LDKEntropySource*)entropy_source_ptr;
64644         LDKCResult_BlindedPathNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_BlindedPathNoneZ), "LDKCResult_BlindedPathNoneZ");
64645         *ret_conv = BlindedPath_one_hop_for_message(recipient_node_id_ref, entropy_source_conv);
64646         return tag_ptr(ret_conv, true);
64647 }
64648
64649 uint64_t  __attribute__((export_name("TS_BlindedPath_new_for_message"))) TS_BlindedPath_new_for_message(ptrArray node_pks, uint64_t entropy_source) {
64650         LDKCVec_PublicKeyZ node_pks_constr;
64651         node_pks_constr.datalen = node_pks->arr_len;
64652         if (node_pks_constr.datalen > 0)
64653                 node_pks_constr.data = MALLOC(node_pks_constr.datalen * sizeof(LDKPublicKey), "LDKCVec_PublicKeyZ Elements");
64654         else
64655                 node_pks_constr.data = NULL;
64656         int8_tArray* node_pks_vals = (void*) node_pks->elems;
64657         for (size_t m = 0; m < node_pks_constr.datalen; m++) {
64658                 int8_tArray node_pks_conv_12 = node_pks_vals[m];
64659                 LDKPublicKey node_pks_conv_12_ref;
64660                 CHECK(node_pks_conv_12->arr_len == 33);
64661                 memcpy(node_pks_conv_12_ref.compressed_form, node_pks_conv_12->elems, 33); FREE(node_pks_conv_12);
64662                 node_pks_constr.data[m] = node_pks_conv_12_ref;
64663         }
64664         FREE(node_pks);
64665         void* entropy_source_ptr = untag_ptr(entropy_source);
64666         if (ptr_is_owned(entropy_source)) { CHECK_ACCESS(entropy_source_ptr); }
64667         LDKEntropySource* entropy_source_conv = (LDKEntropySource*)entropy_source_ptr;
64668         LDKCResult_BlindedPathNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_BlindedPathNoneZ), "LDKCResult_BlindedPathNoneZ");
64669         *ret_conv = BlindedPath_new_for_message(node_pks_constr, entropy_source_conv);
64670         return tag_ptr(ret_conv, true);
64671 }
64672
64673 uint64_t  __attribute__((export_name("TS_BlindedPath_one_hop_for_payment"))) TS_BlindedPath_one_hop_for_payment(int8_tArray payee_node_id, uint64_t payee_tlvs, uint64_t entropy_source) {
64674         LDKPublicKey payee_node_id_ref;
64675         CHECK(payee_node_id->arr_len == 33);
64676         memcpy(payee_node_id_ref.compressed_form, payee_node_id->elems, 33); FREE(payee_node_id);
64677         LDKReceiveTlvs payee_tlvs_conv;
64678         payee_tlvs_conv.inner = untag_ptr(payee_tlvs);
64679         payee_tlvs_conv.is_owned = ptr_is_owned(payee_tlvs);
64680         CHECK_INNER_FIELD_ACCESS_OR_NULL(payee_tlvs_conv);
64681         payee_tlvs_conv = ReceiveTlvs_clone(&payee_tlvs_conv);
64682         void* entropy_source_ptr = untag_ptr(entropy_source);
64683         if (ptr_is_owned(entropy_source)) { CHECK_ACCESS(entropy_source_ptr); }
64684         LDKEntropySource* entropy_source_conv = (LDKEntropySource*)entropy_source_ptr;
64685         LDKCResult_C2Tuple_BlindedPayInfoBlindedPathZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_BlindedPayInfoBlindedPathZNoneZ), "LDKCResult_C2Tuple_BlindedPayInfoBlindedPathZNoneZ");
64686         *ret_conv = BlindedPath_one_hop_for_payment(payee_node_id_ref, payee_tlvs_conv, entropy_source_conv);
64687         return tag_ptr(ret_conv, true);
64688 }
64689
64690 int8_tArray  __attribute__((export_name("TS_BlindedPath_write"))) TS_BlindedPath_write(uint64_t obj) {
64691         LDKBlindedPath obj_conv;
64692         obj_conv.inner = untag_ptr(obj);
64693         obj_conv.is_owned = ptr_is_owned(obj);
64694         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
64695         obj_conv.is_owned = false;
64696         LDKCVec_u8Z ret_var = BlindedPath_write(&obj_conv);
64697         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
64698         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
64699         CVec_u8Z_free(ret_var);
64700         return ret_arr;
64701 }
64702
64703 uint64_t  __attribute__((export_name("TS_BlindedPath_read"))) TS_BlindedPath_read(int8_tArray ser) {
64704         LDKu8slice ser_ref;
64705         ser_ref.datalen = ser->arr_len;
64706         ser_ref.data = ser->elems;
64707         LDKCResult_BlindedPathDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_BlindedPathDecodeErrorZ), "LDKCResult_BlindedPathDecodeErrorZ");
64708         *ret_conv = BlindedPath_read(ser_ref);
64709         FREE(ser);
64710         return tag_ptr(ret_conv, true);
64711 }
64712
64713 int8_tArray  __attribute__((export_name("TS_BlindedHop_write"))) TS_BlindedHop_write(uint64_t obj) {
64714         LDKBlindedHop obj_conv;
64715         obj_conv.inner = untag_ptr(obj);
64716         obj_conv.is_owned = ptr_is_owned(obj);
64717         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
64718         obj_conv.is_owned = false;
64719         LDKCVec_u8Z ret_var = BlindedHop_write(&obj_conv);
64720         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
64721         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
64722         CVec_u8Z_free(ret_var);
64723         return ret_arr;
64724 }
64725
64726 uint64_t  __attribute__((export_name("TS_BlindedHop_read"))) TS_BlindedHop_read(int8_tArray ser) {
64727         LDKu8slice ser_ref;
64728         ser_ref.datalen = ser->arr_len;
64729         ser_ref.data = ser->elems;
64730         LDKCResult_BlindedHopDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_BlindedHopDecodeErrorZ), "LDKCResult_BlindedHopDecodeErrorZ");
64731         *ret_conv = BlindedHop_read(ser_ref);
64732         FREE(ser);
64733         return tag_ptr(ret_conv, true);
64734 }
64735
64736 void  __attribute__((export_name("TS_ForwardNode_free"))) TS_ForwardNode_free(uint64_t this_obj) {
64737         LDKForwardNode this_obj_conv;
64738         this_obj_conv.inner = untag_ptr(this_obj);
64739         this_obj_conv.is_owned = ptr_is_owned(this_obj);
64740         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
64741         ForwardNode_free(this_obj_conv);
64742 }
64743
64744 uint64_t  __attribute__((export_name("TS_ForwardNode_get_tlvs"))) TS_ForwardNode_get_tlvs(uint64_t this_ptr) {
64745         LDKForwardNode this_ptr_conv;
64746         this_ptr_conv.inner = untag_ptr(this_ptr);
64747         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
64748         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
64749         this_ptr_conv.is_owned = false;
64750         LDKForwardTlvs ret_var = ForwardNode_get_tlvs(&this_ptr_conv);
64751         uint64_t ret_ref = 0;
64752         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
64753         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
64754         return ret_ref;
64755 }
64756
64757 void  __attribute__((export_name("TS_ForwardNode_set_tlvs"))) TS_ForwardNode_set_tlvs(uint64_t this_ptr, uint64_t val) {
64758         LDKForwardNode this_ptr_conv;
64759         this_ptr_conv.inner = untag_ptr(this_ptr);
64760         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
64761         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
64762         this_ptr_conv.is_owned = false;
64763         LDKForwardTlvs val_conv;
64764         val_conv.inner = untag_ptr(val);
64765         val_conv.is_owned = ptr_is_owned(val);
64766         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
64767         val_conv = ForwardTlvs_clone(&val_conv);
64768         ForwardNode_set_tlvs(&this_ptr_conv, val_conv);
64769 }
64770
64771 int8_tArray  __attribute__((export_name("TS_ForwardNode_get_node_id"))) TS_ForwardNode_get_node_id(uint64_t this_ptr) {
64772         LDKForwardNode this_ptr_conv;
64773         this_ptr_conv.inner = untag_ptr(this_ptr);
64774         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
64775         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
64776         this_ptr_conv.is_owned = false;
64777         int8_tArray ret_arr = init_int8_tArray(33, __LINE__);
64778         memcpy(ret_arr->elems, ForwardNode_get_node_id(&this_ptr_conv).compressed_form, 33);
64779         return ret_arr;
64780 }
64781
64782 void  __attribute__((export_name("TS_ForwardNode_set_node_id"))) TS_ForwardNode_set_node_id(uint64_t this_ptr, int8_tArray val) {
64783         LDKForwardNode this_ptr_conv;
64784         this_ptr_conv.inner = untag_ptr(this_ptr);
64785         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
64786         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
64787         this_ptr_conv.is_owned = false;
64788         LDKPublicKey val_ref;
64789         CHECK(val->arr_len == 33);
64790         memcpy(val_ref.compressed_form, val->elems, 33); FREE(val);
64791         ForwardNode_set_node_id(&this_ptr_conv, val_ref);
64792 }
64793
64794 int64_t  __attribute__((export_name("TS_ForwardNode_get_htlc_maximum_msat"))) TS_ForwardNode_get_htlc_maximum_msat(uint64_t this_ptr) {
64795         LDKForwardNode this_ptr_conv;
64796         this_ptr_conv.inner = untag_ptr(this_ptr);
64797         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
64798         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
64799         this_ptr_conv.is_owned = false;
64800         int64_t ret_conv = ForwardNode_get_htlc_maximum_msat(&this_ptr_conv);
64801         return ret_conv;
64802 }
64803
64804 void  __attribute__((export_name("TS_ForwardNode_set_htlc_maximum_msat"))) TS_ForwardNode_set_htlc_maximum_msat(uint64_t this_ptr, int64_t val) {
64805         LDKForwardNode this_ptr_conv;
64806         this_ptr_conv.inner = untag_ptr(this_ptr);
64807         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
64808         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
64809         this_ptr_conv.is_owned = false;
64810         ForwardNode_set_htlc_maximum_msat(&this_ptr_conv, val);
64811 }
64812
64813 uint64_t  __attribute__((export_name("TS_ForwardNode_new"))) TS_ForwardNode_new(uint64_t tlvs_arg, int8_tArray node_id_arg, int64_t htlc_maximum_msat_arg) {
64814         LDKForwardTlvs tlvs_arg_conv;
64815         tlvs_arg_conv.inner = untag_ptr(tlvs_arg);
64816         tlvs_arg_conv.is_owned = ptr_is_owned(tlvs_arg);
64817         CHECK_INNER_FIELD_ACCESS_OR_NULL(tlvs_arg_conv);
64818         tlvs_arg_conv = ForwardTlvs_clone(&tlvs_arg_conv);
64819         LDKPublicKey node_id_arg_ref;
64820         CHECK(node_id_arg->arr_len == 33);
64821         memcpy(node_id_arg_ref.compressed_form, node_id_arg->elems, 33); FREE(node_id_arg);
64822         LDKForwardNode ret_var = ForwardNode_new(tlvs_arg_conv, node_id_arg_ref, htlc_maximum_msat_arg);
64823         uint64_t ret_ref = 0;
64824         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
64825         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
64826         return ret_ref;
64827 }
64828
64829 static inline uint64_t ForwardNode_clone_ptr(LDKForwardNode *NONNULL_PTR arg) {
64830         LDKForwardNode ret_var = ForwardNode_clone(arg);
64831         uint64_t ret_ref = 0;
64832         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
64833         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
64834         return ret_ref;
64835 }
64836 int64_t  __attribute__((export_name("TS_ForwardNode_clone_ptr"))) TS_ForwardNode_clone_ptr(uint64_t arg) {
64837         LDKForwardNode arg_conv;
64838         arg_conv.inner = untag_ptr(arg);
64839         arg_conv.is_owned = ptr_is_owned(arg);
64840         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
64841         arg_conv.is_owned = false;
64842         int64_t ret_conv = ForwardNode_clone_ptr(&arg_conv);
64843         return ret_conv;
64844 }
64845
64846 uint64_t  __attribute__((export_name("TS_ForwardNode_clone"))) TS_ForwardNode_clone(uint64_t orig) {
64847         LDKForwardNode orig_conv;
64848         orig_conv.inner = untag_ptr(orig);
64849         orig_conv.is_owned = ptr_is_owned(orig);
64850         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
64851         orig_conv.is_owned = false;
64852         LDKForwardNode ret_var = ForwardNode_clone(&orig_conv);
64853         uint64_t ret_ref = 0;
64854         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
64855         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
64856         return ret_ref;
64857 }
64858
64859 void  __attribute__((export_name("TS_ForwardTlvs_free"))) TS_ForwardTlvs_free(uint64_t this_obj) {
64860         LDKForwardTlvs this_obj_conv;
64861         this_obj_conv.inner = untag_ptr(this_obj);
64862         this_obj_conv.is_owned = ptr_is_owned(this_obj);
64863         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
64864         ForwardTlvs_free(this_obj_conv);
64865 }
64866
64867 int64_t  __attribute__((export_name("TS_ForwardTlvs_get_short_channel_id"))) TS_ForwardTlvs_get_short_channel_id(uint64_t this_ptr) {
64868         LDKForwardTlvs this_ptr_conv;
64869         this_ptr_conv.inner = untag_ptr(this_ptr);
64870         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
64871         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
64872         this_ptr_conv.is_owned = false;
64873         int64_t ret_conv = ForwardTlvs_get_short_channel_id(&this_ptr_conv);
64874         return ret_conv;
64875 }
64876
64877 void  __attribute__((export_name("TS_ForwardTlvs_set_short_channel_id"))) TS_ForwardTlvs_set_short_channel_id(uint64_t this_ptr, int64_t val) {
64878         LDKForwardTlvs this_ptr_conv;
64879         this_ptr_conv.inner = untag_ptr(this_ptr);
64880         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
64881         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
64882         this_ptr_conv.is_owned = false;
64883         ForwardTlvs_set_short_channel_id(&this_ptr_conv, val);
64884 }
64885
64886 uint64_t  __attribute__((export_name("TS_ForwardTlvs_get_payment_relay"))) TS_ForwardTlvs_get_payment_relay(uint64_t this_ptr) {
64887         LDKForwardTlvs this_ptr_conv;
64888         this_ptr_conv.inner = untag_ptr(this_ptr);
64889         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
64890         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
64891         this_ptr_conv.is_owned = false;
64892         LDKPaymentRelay ret_var = ForwardTlvs_get_payment_relay(&this_ptr_conv);
64893         uint64_t ret_ref = 0;
64894         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
64895         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
64896         return ret_ref;
64897 }
64898
64899 void  __attribute__((export_name("TS_ForwardTlvs_set_payment_relay"))) TS_ForwardTlvs_set_payment_relay(uint64_t this_ptr, uint64_t val) {
64900         LDKForwardTlvs this_ptr_conv;
64901         this_ptr_conv.inner = untag_ptr(this_ptr);
64902         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
64903         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
64904         this_ptr_conv.is_owned = false;
64905         LDKPaymentRelay val_conv;
64906         val_conv.inner = untag_ptr(val);
64907         val_conv.is_owned = ptr_is_owned(val);
64908         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
64909         val_conv = PaymentRelay_clone(&val_conv);
64910         ForwardTlvs_set_payment_relay(&this_ptr_conv, val_conv);
64911 }
64912
64913 uint64_t  __attribute__((export_name("TS_ForwardTlvs_get_payment_constraints"))) TS_ForwardTlvs_get_payment_constraints(uint64_t this_ptr) {
64914         LDKForwardTlvs this_ptr_conv;
64915         this_ptr_conv.inner = untag_ptr(this_ptr);
64916         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
64917         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
64918         this_ptr_conv.is_owned = false;
64919         LDKPaymentConstraints ret_var = ForwardTlvs_get_payment_constraints(&this_ptr_conv);
64920         uint64_t ret_ref = 0;
64921         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
64922         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
64923         return ret_ref;
64924 }
64925
64926 void  __attribute__((export_name("TS_ForwardTlvs_set_payment_constraints"))) TS_ForwardTlvs_set_payment_constraints(uint64_t this_ptr, uint64_t val) {
64927         LDKForwardTlvs this_ptr_conv;
64928         this_ptr_conv.inner = untag_ptr(this_ptr);
64929         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
64930         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
64931         this_ptr_conv.is_owned = false;
64932         LDKPaymentConstraints val_conv;
64933         val_conv.inner = untag_ptr(val);
64934         val_conv.is_owned = ptr_is_owned(val);
64935         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
64936         val_conv = PaymentConstraints_clone(&val_conv);
64937         ForwardTlvs_set_payment_constraints(&this_ptr_conv, val_conv);
64938 }
64939
64940 uint64_t  __attribute__((export_name("TS_ForwardTlvs_get_features"))) TS_ForwardTlvs_get_features(uint64_t this_ptr) {
64941         LDKForwardTlvs this_ptr_conv;
64942         this_ptr_conv.inner = untag_ptr(this_ptr);
64943         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
64944         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
64945         this_ptr_conv.is_owned = false;
64946         LDKBlindedHopFeatures ret_var = ForwardTlvs_get_features(&this_ptr_conv);
64947         uint64_t ret_ref = 0;
64948         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
64949         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
64950         return ret_ref;
64951 }
64952
64953 void  __attribute__((export_name("TS_ForwardTlvs_set_features"))) TS_ForwardTlvs_set_features(uint64_t this_ptr, uint64_t val) {
64954         LDKForwardTlvs this_ptr_conv;
64955         this_ptr_conv.inner = untag_ptr(this_ptr);
64956         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
64957         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
64958         this_ptr_conv.is_owned = false;
64959         LDKBlindedHopFeatures val_conv;
64960         val_conv.inner = untag_ptr(val);
64961         val_conv.is_owned = ptr_is_owned(val);
64962         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
64963         val_conv = BlindedHopFeatures_clone(&val_conv);
64964         ForwardTlvs_set_features(&this_ptr_conv, val_conv);
64965 }
64966
64967 uint64_t  __attribute__((export_name("TS_ForwardTlvs_new"))) TS_ForwardTlvs_new(int64_t short_channel_id_arg, uint64_t payment_relay_arg, uint64_t payment_constraints_arg, uint64_t features_arg) {
64968         LDKPaymentRelay payment_relay_arg_conv;
64969         payment_relay_arg_conv.inner = untag_ptr(payment_relay_arg);
64970         payment_relay_arg_conv.is_owned = ptr_is_owned(payment_relay_arg);
64971         CHECK_INNER_FIELD_ACCESS_OR_NULL(payment_relay_arg_conv);
64972         payment_relay_arg_conv = PaymentRelay_clone(&payment_relay_arg_conv);
64973         LDKPaymentConstraints payment_constraints_arg_conv;
64974         payment_constraints_arg_conv.inner = untag_ptr(payment_constraints_arg);
64975         payment_constraints_arg_conv.is_owned = ptr_is_owned(payment_constraints_arg);
64976         CHECK_INNER_FIELD_ACCESS_OR_NULL(payment_constraints_arg_conv);
64977         payment_constraints_arg_conv = PaymentConstraints_clone(&payment_constraints_arg_conv);
64978         LDKBlindedHopFeatures features_arg_conv;
64979         features_arg_conv.inner = untag_ptr(features_arg);
64980         features_arg_conv.is_owned = ptr_is_owned(features_arg);
64981         CHECK_INNER_FIELD_ACCESS_OR_NULL(features_arg_conv);
64982         features_arg_conv = BlindedHopFeatures_clone(&features_arg_conv);
64983         LDKForwardTlvs ret_var = ForwardTlvs_new(short_channel_id_arg, payment_relay_arg_conv, payment_constraints_arg_conv, features_arg_conv);
64984         uint64_t ret_ref = 0;
64985         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
64986         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
64987         return ret_ref;
64988 }
64989
64990 static inline uint64_t ForwardTlvs_clone_ptr(LDKForwardTlvs *NONNULL_PTR arg) {
64991         LDKForwardTlvs ret_var = ForwardTlvs_clone(arg);
64992         uint64_t ret_ref = 0;
64993         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
64994         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
64995         return ret_ref;
64996 }
64997 int64_t  __attribute__((export_name("TS_ForwardTlvs_clone_ptr"))) TS_ForwardTlvs_clone_ptr(uint64_t arg) {
64998         LDKForwardTlvs arg_conv;
64999         arg_conv.inner = untag_ptr(arg);
65000         arg_conv.is_owned = ptr_is_owned(arg);
65001         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
65002         arg_conv.is_owned = false;
65003         int64_t ret_conv = ForwardTlvs_clone_ptr(&arg_conv);
65004         return ret_conv;
65005 }
65006
65007 uint64_t  __attribute__((export_name("TS_ForwardTlvs_clone"))) TS_ForwardTlvs_clone(uint64_t orig) {
65008         LDKForwardTlvs orig_conv;
65009         orig_conv.inner = untag_ptr(orig);
65010         orig_conv.is_owned = ptr_is_owned(orig);
65011         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
65012         orig_conv.is_owned = false;
65013         LDKForwardTlvs ret_var = ForwardTlvs_clone(&orig_conv);
65014         uint64_t ret_ref = 0;
65015         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
65016         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
65017         return ret_ref;
65018 }
65019
65020 void  __attribute__((export_name("TS_ReceiveTlvs_free"))) TS_ReceiveTlvs_free(uint64_t this_obj) {
65021         LDKReceiveTlvs this_obj_conv;
65022         this_obj_conv.inner = untag_ptr(this_obj);
65023         this_obj_conv.is_owned = ptr_is_owned(this_obj);
65024         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
65025         ReceiveTlvs_free(this_obj_conv);
65026 }
65027
65028 int8_tArray  __attribute__((export_name("TS_ReceiveTlvs_get_payment_secret"))) TS_ReceiveTlvs_get_payment_secret(uint64_t this_ptr) {
65029         LDKReceiveTlvs this_ptr_conv;
65030         this_ptr_conv.inner = untag_ptr(this_ptr);
65031         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
65032         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
65033         this_ptr_conv.is_owned = false;
65034         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
65035         memcpy(ret_arr->elems, *ReceiveTlvs_get_payment_secret(&this_ptr_conv), 32);
65036         return ret_arr;
65037 }
65038
65039 void  __attribute__((export_name("TS_ReceiveTlvs_set_payment_secret"))) TS_ReceiveTlvs_set_payment_secret(uint64_t this_ptr, int8_tArray val) {
65040         LDKReceiveTlvs this_ptr_conv;
65041         this_ptr_conv.inner = untag_ptr(this_ptr);
65042         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
65043         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
65044         this_ptr_conv.is_owned = false;
65045         LDKThirtyTwoBytes val_ref;
65046         CHECK(val->arr_len == 32);
65047         memcpy(val_ref.data, val->elems, 32); FREE(val);
65048         ReceiveTlvs_set_payment_secret(&this_ptr_conv, val_ref);
65049 }
65050
65051 uint64_t  __attribute__((export_name("TS_ReceiveTlvs_get_payment_constraints"))) TS_ReceiveTlvs_get_payment_constraints(uint64_t this_ptr) {
65052         LDKReceiveTlvs this_ptr_conv;
65053         this_ptr_conv.inner = untag_ptr(this_ptr);
65054         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
65055         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
65056         this_ptr_conv.is_owned = false;
65057         LDKPaymentConstraints ret_var = ReceiveTlvs_get_payment_constraints(&this_ptr_conv);
65058         uint64_t ret_ref = 0;
65059         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
65060         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
65061         return ret_ref;
65062 }
65063
65064 void  __attribute__((export_name("TS_ReceiveTlvs_set_payment_constraints"))) TS_ReceiveTlvs_set_payment_constraints(uint64_t this_ptr, uint64_t val) {
65065         LDKReceiveTlvs this_ptr_conv;
65066         this_ptr_conv.inner = untag_ptr(this_ptr);
65067         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
65068         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
65069         this_ptr_conv.is_owned = false;
65070         LDKPaymentConstraints val_conv;
65071         val_conv.inner = untag_ptr(val);
65072         val_conv.is_owned = ptr_is_owned(val);
65073         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
65074         val_conv = PaymentConstraints_clone(&val_conv);
65075         ReceiveTlvs_set_payment_constraints(&this_ptr_conv, val_conv);
65076 }
65077
65078 uint64_t  __attribute__((export_name("TS_ReceiveTlvs_new"))) TS_ReceiveTlvs_new(int8_tArray payment_secret_arg, uint64_t payment_constraints_arg) {
65079         LDKThirtyTwoBytes payment_secret_arg_ref;
65080         CHECK(payment_secret_arg->arr_len == 32);
65081         memcpy(payment_secret_arg_ref.data, payment_secret_arg->elems, 32); FREE(payment_secret_arg);
65082         LDKPaymentConstraints payment_constraints_arg_conv;
65083         payment_constraints_arg_conv.inner = untag_ptr(payment_constraints_arg);
65084         payment_constraints_arg_conv.is_owned = ptr_is_owned(payment_constraints_arg);
65085         CHECK_INNER_FIELD_ACCESS_OR_NULL(payment_constraints_arg_conv);
65086         payment_constraints_arg_conv = PaymentConstraints_clone(&payment_constraints_arg_conv);
65087         LDKReceiveTlvs ret_var = ReceiveTlvs_new(payment_secret_arg_ref, payment_constraints_arg_conv);
65088         uint64_t ret_ref = 0;
65089         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
65090         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
65091         return ret_ref;
65092 }
65093
65094 static inline uint64_t ReceiveTlvs_clone_ptr(LDKReceiveTlvs *NONNULL_PTR arg) {
65095         LDKReceiveTlvs ret_var = ReceiveTlvs_clone(arg);
65096         uint64_t ret_ref = 0;
65097         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
65098         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
65099         return ret_ref;
65100 }
65101 int64_t  __attribute__((export_name("TS_ReceiveTlvs_clone_ptr"))) TS_ReceiveTlvs_clone_ptr(uint64_t arg) {
65102         LDKReceiveTlvs arg_conv;
65103         arg_conv.inner = untag_ptr(arg);
65104         arg_conv.is_owned = ptr_is_owned(arg);
65105         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
65106         arg_conv.is_owned = false;
65107         int64_t ret_conv = ReceiveTlvs_clone_ptr(&arg_conv);
65108         return ret_conv;
65109 }
65110
65111 uint64_t  __attribute__((export_name("TS_ReceiveTlvs_clone"))) TS_ReceiveTlvs_clone(uint64_t orig) {
65112         LDKReceiveTlvs orig_conv;
65113         orig_conv.inner = untag_ptr(orig);
65114         orig_conv.is_owned = ptr_is_owned(orig);
65115         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
65116         orig_conv.is_owned = false;
65117         LDKReceiveTlvs ret_var = ReceiveTlvs_clone(&orig_conv);
65118         uint64_t ret_ref = 0;
65119         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
65120         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
65121         return ret_ref;
65122 }
65123
65124 void  __attribute__((export_name("TS_PaymentRelay_free"))) TS_PaymentRelay_free(uint64_t this_obj) {
65125         LDKPaymentRelay this_obj_conv;
65126         this_obj_conv.inner = untag_ptr(this_obj);
65127         this_obj_conv.is_owned = ptr_is_owned(this_obj);
65128         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
65129         PaymentRelay_free(this_obj_conv);
65130 }
65131
65132 int16_t  __attribute__((export_name("TS_PaymentRelay_get_cltv_expiry_delta"))) TS_PaymentRelay_get_cltv_expiry_delta(uint64_t this_ptr) {
65133         LDKPaymentRelay this_ptr_conv;
65134         this_ptr_conv.inner = untag_ptr(this_ptr);
65135         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
65136         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
65137         this_ptr_conv.is_owned = false;
65138         int16_t ret_conv = PaymentRelay_get_cltv_expiry_delta(&this_ptr_conv);
65139         return ret_conv;
65140 }
65141
65142 void  __attribute__((export_name("TS_PaymentRelay_set_cltv_expiry_delta"))) TS_PaymentRelay_set_cltv_expiry_delta(uint64_t this_ptr, int16_t val) {
65143         LDKPaymentRelay this_ptr_conv;
65144         this_ptr_conv.inner = untag_ptr(this_ptr);
65145         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
65146         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
65147         this_ptr_conv.is_owned = false;
65148         PaymentRelay_set_cltv_expiry_delta(&this_ptr_conv, val);
65149 }
65150
65151 int32_t  __attribute__((export_name("TS_PaymentRelay_get_fee_proportional_millionths"))) TS_PaymentRelay_get_fee_proportional_millionths(uint64_t this_ptr) {
65152         LDKPaymentRelay this_ptr_conv;
65153         this_ptr_conv.inner = untag_ptr(this_ptr);
65154         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
65155         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
65156         this_ptr_conv.is_owned = false;
65157         int32_t ret_conv = PaymentRelay_get_fee_proportional_millionths(&this_ptr_conv);
65158         return ret_conv;
65159 }
65160
65161 void  __attribute__((export_name("TS_PaymentRelay_set_fee_proportional_millionths"))) TS_PaymentRelay_set_fee_proportional_millionths(uint64_t this_ptr, int32_t val) {
65162         LDKPaymentRelay this_ptr_conv;
65163         this_ptr_conv.inner = untag_ptr(this_ptr);
65164         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
65165         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
65166         this_ptr_conv.is_owned = false;
65167         PaymentRelay_set_fee_proportional_millionths(&this_ptr_conv, val);
65168 }
65169
65170 int32_t  __attribute__((export_name("TS_PaymentRelay_get_fee_base_msat"))) TS_PaymentRelay_get_fee_base_msat(uint64_t this_ptr) {
65171         LDKPaymentRelay this_ptr_conv;
65172         this_ptr_conv.inner = untag_ptr(this_ptr);
65173         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
65174         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
65175         this_ptr_conv.is_owned = false;
65176         int32_t ret_conv = PaymentRelay_get_fee_base_msat(&this_ptr_conv);
65177         return ret_conv;
65178 }
65179
65180 void  __attribute__((export_name("TS_PaymentRelay_set_fee_base_msat"))) TS_PaymentRelay_set_fee_base_msat(uint64_t this_ptr, int32_t val) {
65181         LDKPaymentRelay this_ptr_conv;
65182         this_ptr_conv.inner = untag_ptr(this_ptr);
65183         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
65184         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
65185         this_ptr_conv.is_owned = false;
65186         PaymentRelay_set_fee_base_msat(&this_ptr_conv, val);
65187 }
65188
65189 uint64_t  __attribute__((export_name("TS_PaymentRelay_new"))) TS_PaymentRelay_new(int16_t cltv_expiry_delta_arg, int32_t fee_proportional_millionths_arg, int32_t fee_base_msat_arg) {
65190         LDKPaymentRelay ret_var = PaymentRelay_new(cltv_expiry_delta_arg, fee_proportional_millionths_arg, fee_base_msat_arg);
65191         uint64_t ret_ref = 0;
65192         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
65193         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
65194         return ret_ref;
65195 }
65196
65197 static inline uint64_t PaymentRelay_clone_ptr(LDKPaymentRelay *NONNULL_PTR arg) {
65198         LDKPaymentRelay ret_var = PaymentRelay_clone(arg);
65199         uint64_t ret_ref = 0;
65200         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
65201         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
65202         return ret_ref;
65203 }
65204 int64_t  __attribute__((export_name("TS_PaymentRelay_clone_ptr"))) TS_PaymentRelay_clone_ptr(uint64_t arg) {
65205         LDKPaymentRelay arg_conv;
65206         arg_conv.inner = untag_ptr(arg);
65207         arg_conv.is_owned = ptr_is_owned(arg);
65208         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
65209         arg_conv.is_owned = false;
65210         int64_t ret_conv = PaymentRelay_clone_ptr(&arg_conv);
65211         return ret_conv;
65212 }
65213
65214 uint64_t  __attribute__((export_name("TS_PaymentRelay_clone"))) TS_PaymentRelay_clone(uint64_t orig) {
65215         LDKPaymentRelay orig_conv;
65216         orig_conv.inner = untag_ptr(orig);
65217         orig_conv.is_owned = ptr_is_owned(orig);
65218         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
65219         orig_conv.is_owned = false;
65220         LDKPaymentRelay ret_var = PaymentRelay_clone(&orig_conv);
65221         uint64_t ret_ref = 0;
65222         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
65223         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
65224         return ret_ref;
65225 }
65226
65227 void  __attribute__((export_name("TS_PaymentConstraints_free"))) TS_PaymentConstraints_free(uint64_t this_obj) {
65228         LDKPaymentConstraints this_obj_conv;
65229         this_obj_conv.inner = untag_ptr(this_obj);
65230         this_obj_conv.is_owned = ptr_is_owned(this_obj);
65231         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
65232         PaymentConstraints_free(this_obj_conv);
65233 }
65234
65235 int32_t  __attribute__((export_name("TS_PaymentConstraints_get_max_cltv_expiry"))) TS_PaymentConstraints_get_max_cltv_expiry(uint64_t this_ptr) {
65236         LDKPaymentConstraints this_ptr_conv;
65237         this_ptr_conv.inner = untag_ptr(this_ptr);
65238         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
65239         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
65240         this_ptr_conv.is_owned = false;
65241         int32_t ret_conv = PaymentConstraints_get_max_cltv_expiry(&this_ptr_conv);
65242         return ret_conv;
65243 }
65244
65245 void  __attribute__((export_name("TS_PaymentConstraints_set_max_cltv_expiry"))) TS_PaymentConstraints_set_max_cltv_expiry(uint64_t this_ptr, int32_t val) {
65246         LDKPaymentConstraints this_ptr_conv;
65247         this_ptr_conv.inner = untag_ptr(this_ptr);
65248         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
65249         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
65250         this_ptr_conv.is_owned = false;
65251         PaymentConstraints_set_max_cltv_expiry(&this_ptr_conv, val);
65252 }
65253
65254 int64_t  __attribute__((export_name("TS_PaymentConstraints_get_htlc_minimum_msat"))) TS_PaymentConstraints_get_htlc_minimum_msat(uint64_t this_ptr) {
65255         LDKPaymentConstraints this_ptr_conv;
65256         this_ptr_conv.inner = untag_ptr(this_ptr);
65257         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
65258         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
65259         this_ptr_conv.is_owned = false;
65260         int64_t ret_conv = PaymentConstraints_get_htlc_minimum_msat(&this_ptr_conv);
65261         return ret_conv;
65262 }
65263
65264 void  __attribute__((export_name("TS_PaymentConstraints_set_htlc_minimum_msat"))) TS_PaymentConstraints_set_htlc_minimum_msat(uint64_t this_ptr, int64_t val) {
65265         LDKPaymentConstraints this_ptr_conv;
65266         this_ptr_conv.inner = untag_ptr(this_ptr);
65267         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
65268         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
65269         this_ptr_conv.is_owned = false;
65270         PaymentConstraints_set_htlc_minimum_msat(&this_ptr_conv, val);
65271 }
65272
65273 uint64_t  __attribute__((export_name("TS_PaymentConstraints_new"))) TS_PaymentConstraints_new(int32_t max_cltv_expiry_arg, int64_t htlc_minimum_msat_arg) {
65274         LDKPaymentConstraints ret_var = PaymentConstraints_new(max_cltv_expiry_arg, htlc_minimum_msat_arg);
65275         uint64_t ret_ref = 0;
65276         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
65277         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
65278         return ret_ref;
65279 }
65280
65281 static inline uint64_t PaymentConstraints_clone_ptr(LDKPaymentConstraints *NONNULL_PTR arg) {
65282         LDKPaymentConstraints ret_var = PaymentConstraints_clone(arg);
65283         uint64_t ret_ref = 0;
65284         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
65285         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
65286         return ret_ref;
65287 }
65288 int64_t  __attribute__((export_name("TS_PaymentConstraints_clone_ptr"))) TS_PaymentConstraints_clone_ptr(uint64_t arg) {
65289         LDKPaymentConstraints arg_conv;
65290         arg_conv.inner = untag_ptr(arg);
65291         arg_conv.is_owned = ptr_is_owned(arg);
65292         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
65293         arg_conv.is_owned = false;
65294         int64_t ret_conv = PaymentConstraints_clone_ptr(&arg_conv);
65295         return ret_conv;
65296 }
65297
65298 uint64_t  __attribute__((export_name("TS_PaymentConstraints_clone"))) TS_PaymentConstraints_clone(uint64_t orig) {
65299         LDKPaymentConstraints orig_conv;
65300         orig_conv.inner = untag_ptr(orig);
65301         orig_conv.is_owned = ptr_is_owned(orig);
65302         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
65303         orig_conv.is_owned = false;
65304         LDKPaymentConstraints ret_var = PaymentConstraints_clone(&orig_conv);
65305         uint64_t ret_ref = 0;
65306         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
65307         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
65308         return ret_ref;
65309 }
65310
65311 int8_tArray  __attribute__((export_name("TS_ForwardTlvs_write"))) TS_ForwardTlvs_write(uint64_t obj) {
65312         LDKForwardTlvs obj_conv;
65313         obj_conv.inner = untag_ptr(obj);
65314         obj_conv.is_owned = ptr_is_owned(obj);
65315         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
65316         obj_conv.is_owned = false;
65317         LDKCVec_u8Z ret_var = ForwardTlvs_write(&obj_conv);
65318         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
65319         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
65320         CVec_u8Z_free(ret_var);
65321         return ret_arr;
65322 }
65323
65324 int8_tArray  __attribute__((export_name("TS_ReceiveTlvs_write"))) TS_ReceiveTlvs_write(uint64_t obj) {
65325         LDKReceiveTlvs obj_conv;
65326         obj_conv.inner = untag_ptr(obj);
65327         obj_conv.is_owned = ptr_is_owned(obj);
65328         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
65329         obj_conv.is_owned = false;
65330         LDKCVec_u8Z ret_var = ReceiveTlvs_write(&obj_conv);
65331         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
65332         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
65333         CVec_u8Z_free(ret_var);
65334         return ret_arr;
65335 }
65336
65337 uint64_t  __attribute__((export_name("TS_ReceiveTlvs_read"))) TS_ReceiveTlvs_read(int8_tArray ser) {
65338         LDKu8slice ser_ref;
65339         ser_ref.datalen = ser->arr_len;
65340         ser_ref.data = ser->elems;
65341         LDKCResult_ReceiveTlvsDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ReceiveTlvsDecodeErrorZ), "LDKCResult_ReceiveTlvsDecodeErrorZ");
65342         *ret_conv = ReceiveTlvs_read(ser_ref);
65343         FREE(ser);
65344         return tag_ptr(ret_conv, true);
65345 }
65346
65347 int8_tArray  __attribute__((export_name("TS_PaymentRelay_write"))) TS_PaymentRelay_write(uint64_t obj) {
65348         LDKPaymentRelay obj_conv;
65349         obj_conv.inner = untag_ptr(obj);
65350         obj_conv.is_owned = ptr_is_owned(obj);
65351         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
65352         obj_conv.is_owned = false;
65353         LDKCVec_u8Z ret_var = PaymentRelay_write(&obj_conv);
65354         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
65355         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
65356         CVec_u8Z_free(ret_var);
65357         return ret_arr;
65358 }
65359
65360 uint64_t  __attribute__((export_name("TS_PaymentRelay_read"))) TS_PaymentRelay_read(int8_tArray ser) {
65361         LDKu8slice ser_ref;
65362         ser_ref.datalen = ser->arr_len;
65363         ser_ref.data = ser->elems;
65364         LDKCResult_PaymentRelayDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PaymentRelayDecodeErrorZ), "LDKCResult_PaymentRelayDecodeErrorZ");
65365         *ret_conv = PaymentRelay_read(ser_ref);
65366         FREE(ser);
65367         return tag_ptr(ret_conv, true);
65368 }
65369
65370 int8_tArray  __attribute__((export_name("TS_PaymentConstraints_write"))) TS_PaymentConstraints_write(uint64_t obj) {
65371         LDKPaymentConstraints obj_conv;
65372         obj_conv.inner = untag_ptr(obj);
65373         obj_conv.is_owned = ptr_is_owned(obj);
65374         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
65375         obj_conv.is_owned = false;
65376         LDKCVec_u8Z ret_var = PaymentConstraints_write(&obj_conv);
65377         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
65378         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
65379         CVec_u8Z_free(ret_var);
65380         return ret_arr;
65381 }
65382
65383 uint64_t  __attribute__((export_name("TS_PaymentConstraints_read"))) TS_PaymentConstraints_read(int8_tArray ser) {
65384         LDKu8slice ser_ref;
65385         ser_ref.datalen = ser->arr_len;
65386         ser_ref.data = ser->elems;
65387         LDKCResult_PaymentConstraintsDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PaymentConstraintsDecodeErrorZ), "LDKCResult_PaymentConstraintsDecodeErrorZ");
65388         *ret_conv = PaymentConstraints_read(ser_ref);
65389         FREE(ser);
65390         return tag_ptr(ret_conv, true);
65391 }
65392
65393 void  __attribute__((export_name("TS_PaymentPurpose_free"))) TS_PaymentPurpose_free(uint64_t this_ptr) {
65394         if (!ptr_is_owned(this_ptr)) return;
65395         void* this_ptr_ptr = untag_ptr(this_ptr);
65396         CHECK_ACCESS(this_ptr_ptr);
65397         LDKPaymentPurpose this_ptr_conv = *(LDKPaymentPurpose*)(this_ptr_ptr);
65398         FREE(untag_ptr(this_ptr));
65399         PaymentPurpose_free(this_ptr_conv);
65400 }
65401
65402 static inline uint64_t PaymentPurpose_clone_ptr(LDKPaymentPurpose *NONNULL_PTR arg) {
65403         LDKPaymentPurpose *ret_copy = MALLOC(sizeof(LDKPaymentPurpose), "LDKPaymentPurpose");
65404         *ret_copy = PaymentPurpose_clone(arg);
65405         uint64_t ret_ref = tag_ptr(ret_copy, true);
65406         return ret_ref;
65407 }
65408 int64_t  __attribute__((export_name("TS_PaymentPurpose_clone_ptr"))) TS_PaymentPurpose_clone_ptr(uint64_t arg) {
65409         LDKPaymentPurpose* arg_conv = (LDKPaymentPurpose*)untag_ptr(arg);
65410         int64_t ret_conv = PaymentPurpose_clone_ptr(arg_conv);
65411         return ret_conv;
65412 }
65413
65414 uint64_t  __attribute__((export_name("TS_PaymentPurpose_clone"))) TS_PaymentPurpose_clone(uint64_t orig) {
65415         LDKPaymentPurpose* orig_conv = (LDKPaymentPurpose*)untag_ptr(orig);
65416         LDKPaymentPurpose *ret_copy = MALLOC(sizeof(LDKPaymentPurpose), "LDKPaymentPurpose");
65417         *ret_copy = PaymentPurpose_clone(orig_conv);
65418         uint64_t ret_ref = tag_ptr(ret_copy, true);
65419         return ret_ref;
65420 }
65421
65422 uint64_t  __attribute__((export_name("TS_PaymentPurpose_invoice_payment"))) TS_PaymentPurpose_invoice_payment(uint64_t payment_preimage, int8_tArray payment_secret) {
65423         void* payment_preimage_ptr = untag_ptr(payment_preimage);
65424         CHECK_ACCESS(payment_preimage_ptr);
65425         LDKCOption_ThirtyTwoBytesZ payment_preimage_conv = *(LDKCOption_ThirtyTwoBytesZ*)(payment_preimage_ptr);
65426         payment_preimage_conv = COption_ThirtyTwoBytesZ_clone((LDKCOption_ThirtyTwoBytesZ*)untag_ptr(payment_preimage));
65427         LDKThirtyTwoBytes payment_secret_ref;
65428         CHECK(payment_secret->arr_len == 32);
65429         memcpy(payment_secret_ref.data, payment_secret->elems, 32); FREE(payment_secret);
65430         LDKPaymentPurpose *ret_copy = MALLOC(sizeof(LDKPaymentPurpose), "LDKPaymentPurpose");
65431         *ret_copy = PaymentPurpose_invoice_payment(payment_preimage_conv, payment_secret_ref);
65432         uint64_t ret_ref = tag_ptr(ret_copy, true);
65433         return ret_ref;
65434 }
65435
65436 uint64_t  __attribute__((export_name("TS_PaymentPurpose_spontaneous_payment"))) TS_PaymentPurpose_spontaneous_payment(int8_tArray a) {
65437         LDKThirtyTwoBytes a_ref;
65438         CHECK(a->arr_len == 32);
65439         memcpy(a_ref.data, a->elems, 32); FREE(a);
65440         LDKPaymentPurpose *ret_copy = MALLOC(sizeof(LDKPaymentPurpose), "LDKPaymentPurpose");
65441         *ret_copy = PaymentPurpose_spontaneous_payment(a_ref);
65442         uint64_t ret_ref = tag_ptr(ret_copy, true);
65443         return ret_ref;
65444 }
65445
65446 jboolean  __attribute__((export_name("TS_PaymentPurpose_eq"))) TS_PaymentPurpose_eq(uint64_t a, uint64_t b) {
65447         LDKPaymentPurpose* a_conv = (LDKPaymentPurpose*)untag_ptr(a);
65448         LDKPaymentPurpose* b_conv = (LDKPaymentPurpose*)untag_ptr(b);
65449         jboolean ret_conv = PaymentPurpose_eq(a_conv, b_conv);
65450         return ret_conv;
65451 }
65452
65453 int8_tArray  __attribute__((export_name("TS_PaymentPurpose_write"))) TS_PaymentPurpose_write(uint64_t obj) {
65454         LDKPaymentPurpose* obj_conv = (LDKPaymentPurpose*)untag_ptr(obj);
65455         LDKCVec_u8Z ret_var = PaymentPurpose_write(obj_conv);
65456         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
65457         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
65458         CVec_u8Z_free(ret_var);
65459         return ret_arr;
65460 }
65461
65462 uint64_t  __attribute__((export_name("TS_PaymentPurpose_read"))) TS_PaymentPurpose_read(int8_tArray ser) {
65463         LDKu8slice ser_ref;
65464         ser_ref.datalen = ser->arr_len;
65465         ser_ref.data = ser->elems;
65466         LDKCResult_PaymentPurposeDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PaymentPurposeDecodeErrorZ), "LDKCResult_PaymentPurposeDecodeErrorZ");
65467         *ret_conv = PaymentPurpose_read(ser_ref);
65468         FREE(ser);
65469         return tag_ptr(ret_conv, true);
65470 }
65471
65472 void  __attribute__((export_name("TS_ClaimedHTLC_free"))) TS_ClaimedHTLC_free(uint64_t this_obj) {
65473         LDKClaimedHTLC this_obj_conv;
65474         this_obj_conv.inner = untag_ptr(this_obj);
65475         this_obj_conv.is_owned = ptr_is_owned(this_obj);
65476         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
65477         ClaimedHTLC_free(this_obj_conv);
65478 }
65479
65480 int8_tArray  __attribute__((export_name("TS_ClaimedHTLC_get_channel_id"))) TS_ClaimedHTLC_get_channel_id(uint64_t this_ptr) {
65481         LDKClaimedHTLC this_ptr_conv;
65482         this_ptr_conv.inner = untag_ptr(this_ptr);
65483         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
65484         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
65485         this_ptr_conv.is_owned = false;
65486         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
65487         memcpy(ret_arr->elems, *ClaimedHTLC_get_channel_id(&this_ptr_conv), 32);
65488         return ret_arr;
65489 }
65490
65491 void  __attribute__((export_name("TS_ClaimedHTLC_set_channel_id"))) TS_ClaimedHTLC_set_channel_id(uint64_t this_ptr, int8_tArray val) {
65492         LDKClaimedHTLC this_ptr_conv;
65493         this_ptr_conv.inner = untag_ptr(this_ptr);
65494         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
65495         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
65496         this_ptr_conv.is_owned = false;
65497         LDKThirtyTwoBytes val_ref;
65498         CHECK(val->arr_len == 32);
65499         memcpy(val_ref.data, val->elems, 32); FREE(val);
65500         ClaimedHTLC_set_channel_id(&this_ptr_conv, val_ref);
65501 }
65502
65503 int8_tArray  __attribute__((export_name("TS_ClaimedHTLC_get_user_channel_id"))) TS_ClaimedHTLC_get_user_channel_id(uint64_t this_ptr) {
65504         LDKClaimedHTLC this_ptr_conv;
65505         this_ptr_conv.inner = untag_ptr(this_ptr);
65506         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
65507         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
65508         this_ptr_conv.is_owned = false;
65509         int8_tArray ret_arr = init_int8_tArray(16, __LINE__);
65510         memcpy(ret_arr->elems, ClaimedHTLC_get_user_channel_id(&this_ptr_conv).le_bytes, 16);
65511         return ret_arr;
65512 }
65513
65514 void  __attribute__((export_name("TS_ClaimedHTLC_set_user_channel_id"))) TS_ClaimedHTLC_set_user_channel_id(uint64_t this_ptr, int8_tArray val) {
65515         LDKClaimedHTLC this_ptr_conv;
65516         this_ptr_conv.inner = untag_ptr(this_ptr);
65517         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
65518         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
65519         this_ptr_conv.is_owned = false;
65520         LDKU128 val_ref;
65521         CHECK(val->arr_len == 16);
65522         memcpy(val_ref.le_bytes, val->elems, 16); FREE(val);
65523         ClaimedHTLC_set_user_channel_id(&this_ptr_conv, val_ref);
65524 }
65525
65526 int32_t  __attribute__((export_name("TS_ClaimedHTLC_get_cltv_expiry"))) TS_ClaimedHTLC_get_cltv_expiry(uint64_t this_ptr) {
65527         LDKClaimedHTLC this_ptr_conv;
65528         this_ptr_conv.inner = untag_ptr(this_ptr);
65529         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
65530         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
65531         this_ptr_conv.is_owned = false;
65532         int32_t ret_conv = ClaimedHTLC_get_cltv_expiry(&this_ptr_conv);
65533         return ret_conv;
65534 }
65535
65536 void  __attribute__((export_name("TS_ClaimedHTLC_set_cltv_expiry"))) TS_ClaimedHTLC_set_cltv_expiry(uint64_t this_ptr, int32_t val) {
65537         LDKClaimedHTLC this_ptr_conv;
65538         this_ptr_conv.inner = untag_ptr(this_ptr);
65539         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
65540         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
65541         this_ptr_conv.is_owned = false;
65542         ClaimedHTLC_set_cltv_expiry(&this_ptr_conv, val);
65543 }
65544
65545 int64_t  __attribute__((export_name("TS_ClaimedHTLC_get_value_msat"))) TS_ClaimedHTLC_get_value_msat(uint64_t this_ptr) {
65546         LDKClaimedHTLC this_ptr_conv;
65547         this_ptr_conv.inner = untag_ptr(this_ptr);
65548         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
65549         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
65550         this_ptr_conv.is_owned = false;
65551         int64_t ret_conv = ClaimedHTLC_get_value_msat(&this_ptr_conv);
65552         return ret_conv;
65553 }
65554
65555 void  __attribute__((export_name("TS_ClaimedHTLC_set_value_msat"))) TS_ClaimedHTLC_set_value_msat(uint64_t this_ptr, int64_t val) {
65556         LDKClaimedHTLC this_ptr_conv;
65557         this_ptr_conv.inner = untag_ptr(this_ptr);
65558         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
65559         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
65560         this_ptr_conv.is_owned = false;
65561         ClaimedHTLC_set_value_msat(&this_ptr_conv, val);
65562 }
65563
65564 uint64_t  __attribute__((export_name("TS_ClaimedHTLC_new"))) TS_ClaimedHTLC_new(int8_tArray channel_id_arg, int8_tArray user_channel_id_arg, int32_t cltv_expiry_arg, int64_t value_msat_arg) {
65565         LDKThirtyTwoBytes channel_id_arg_ref;
65566         CHECK(channel_id_arg->arr_len == 32);
65567         memcpy(channel_id_arg_ref.data, channel_id_arg->elems, 32); FREE(channel_id_arg);
65568         LDKU128 user_channel_id_arg_ref;
65569         CHECK(user_channel_id_arg->arr_len == 16);
65570         memcpy(user_channel_id_arg_ref.le_bytes, user_channel_id_arg->elems, 16); FREE(user_channel_id_arg);
65571         LDKClaimedHTLC ret_var = ClaimedHTLC_new(channel_id_arg_ref, user_channel_id_arg_ref, cltv_expiry_arg, value_msat_arg);
65572         uint64_t ret_ref = 0;
65573         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
65574         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
65575         return ret_ref;
65576 }
65577
65578 static inline uint64_t ClaimedHTLC_clone_ptr(LDKClaimedHTLC *NONNULL_PTR arg) {
65579         LDKClaimedHTLC ret_var = ClaimedHTLC_clone(arg);
65580         uint64_t ret_ref = 0;
65581         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
65582         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
65583         return ret_ref;
65584 }
65585 int64_t  __attribute__((export_name("TS_ClaimedHTLC_clone_ptr"))) TS_ClaimedHTLC_clone_ptr(uint64_t arg) {
65586         LDKClaimedHTLC arg_conv;
65587         arg_conv.inner = untag_ptr(arg);
65588         arg_conv.is_owned = ptr_is_owned(arg);
65589         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
65590         arg_conv.is_owned = false;
65591         int64_t ret_conv = ClaimedHTLC_clone_ptr(&arg_conv);
65592         return ret_conv;
65593 }
65594
65595 uint64_t  __attribute__((export_name("TS_ClaimedHTLC_clone"))) TS_ClaimedHTLC_clone(uint64_t orig) {
65596         LDKClaimedHTLC orig_conv;
65597         orig_conv.inner = untag_ptr(orig);
65598         orig_conv.is_owned = ptr_is_owned(orig);
65599         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
65600         orig_conv.is_owned = false;
65601         LDKClaimedHTLC ret_var = ClaimedHTLC_clone(&orig_conv);
65602         uint64_t ret_ref = 0;
65603         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
65604         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
65605         return ret_ref;
65606 }
65607
65608 jboolean  __attribute__((export_name("TS_ClaimedHTLC_eq"))) TS_ClaimedHTLC_eq(uint64_t a, uint64_t b) {
65609         LDKClaimedHTLC a_conv;
65610         a_conv.inner = untag_ptr(a);
65611         a_conv.is_owned = ptr_is_owned(a);
65612         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
65613         a_conv.is_owned = false;
65614         LDKClaimedHTLC b_conv;
65615         b_conv.inner = untag_ptr(b);
65616         b_conv.is_owned = ptr_is_owned(b);
65617         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
65618         b_conv.is_owned = false;
65619         jboolean ret_conv = ClaimedHTLC_eq(&a_conv, &b_conv);
65620         return ret_conv;
65621 }
65622
65623 int8_tArray  __attribute__((export_name("TS_ClaimedHTLC_write"))) TS_ClaimedHTLC_write(uint64_t obj) {
65624         LDKClaimedHTLC obj_conv;
65625         obj_conv.inner = untag_ptr(obj);
65626         obj_conv.is_owned = ptr_is_owned(obj);
65627         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
65628         obj_conv.is_owned = false;
65629         LDKCVec_u8Z ret_var = ClaimedHTLC_write(&obj_conv);
65630         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
65631         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
65632         CVec_u8Z_free(ret_var);
65633         return ret_arr;
65634 }
65635
65636 uint64_t  __attribute__((export_name("TS_ClaimedHTLC_read"))) TS_ClaimedHTLC_read(int8_tArray ser) {
65637         LDKu8slice ser_ref;
65638         ser_ref.datalen = ser->arr_len;
65639         ser_ref.data = ser->elems;
65640         LDKCResult_ClaimedHTLCDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ClaimedHTLCDecodeErrorZ), "LDKCResult_ClaimedHTLCDecodeErrorZ");
65641         *ret_conv = ClaimedHTLC_read(ser_ref);
65642         FREE(ser);
65643         return tag_ptr(ret_conv, true);
65644 }
65645
65646 void  __attribute__((export_name("TS_PathFailure_free"))) TS_PathFailure_free(uint64_t this_ptr) {
65647         if (!ptr_is_owned(this_ptr)) return;
65648         void* this_ptr_ptr = untag_ptr(this_ptr);
65649         CHECK_ACCESS(this_ptr_ptr);
65650         LDKPathFailure this_ptr_conv = *(LDKPathFailure*)(this_ptr_ptr);
65651         FREE(untag_ptr(this_ptr));
65652         PathFailure_free(this_ptr_conv);
65653 }
65654
65655 static inline uint64_t PathFailure_clone_ptr(LDKPathFailure *NONNULL_PTR arg) {
65656         LDKPathFailure *ret_copy = MALLOC(sizeof(LDKPathFailure), "LDKPathFailure");
65657         *ret_copy = PathFailure_clone(arg);
65658         uint64_t ret_ref = tag_ptr(ret_copy, true);
65659         return ret_ref;
65660 }
65661 int64_t  __attribute__((export_name("TS_PathFailure_clone_ptr"))) TS_PathFailure_clone_ptr(uint64_t arg) {
65662         LDKPathFailure* arg_conv = (LDKPathFailure*)untag_ptr(arg);
65663         int64_t ret_conv = PathFailure_clone_ptr(arg_conv);
65664         return ret_conv;
65665 }
65666
65667 uint64_t  __attribute__((export_name("TS_PathFailure_clone"))) TS_PathFailure_clone(uint64_t orig) {
65668         LDKPathFailure* orig_conv = (LDKPathFailure*)untag_ptr(orig);
65669         LDKPathFailure *ret_copy = MALLOC(sizeof(LDKPathFailure), "LDKPathFailure");
65670         *ret_copy = PathFailure_clone(orig_conv);
65671         uint64_t ret_ref = tag_ptr(ret_copy, true);
65672         return ret_ref;
65673 }
65674
65675 uint64_t  __attribute__((export_name("TS_PathFailure_initial_send"))) TS_PathFailure_initial_send(uint64_t err) {
65676         void* err_ptr = untag_ptr(err);
65677         CHECK_ACCESS(err_ptr);
65678         LDKAPIError err_conv = *(LDKAPIError*)(err_ptr);
65679         err_conv = APIError_clone((LDKAPIError*)untag_ptr(err));
65680         LDKPathFailure *ret_copy = MALLOC(sizeof(LDKPathFailure), "LDKPathFailure");
65681         *ret_copy = PathFailure_initial_send(err_conv);
65682         uint64_t ret_ref = tag_ptr(ret_copy, true);
65683         return ret_ref;
65684 }
65685
65686 uint64_t  __attribute__((export_name("TS_PathFailure_on_path"))) TS_PathFailure_on_path(uint64_t network_update) {
65687         void* network_update_ptr = untag_ptr(network_update);
65688         CHECK_ACCESS(network_update_ptr);
65689         LDKCOption_NetworkUpdateZ network_update_conv = *(LDKCOption_NetworkUpdateZ*)(network_update_ptr);
65690         network_update_conv = COption_NetworkUpdateZ_clone((LDKCOption_NetworkUpdateZ*)untag_ptr(network_update));
65691         LDKPathFailure *ret_copy = MALLOC(sizeof(LDKPathFailure), "LDKPathFailure");
65692         *ret_copy = PathFailure_on_path(network_update_conv);
65693         uint64_t ret_ref = tag_ptr(ret_copy, true);
65694         return ret_ref;
65695 }
65696
65697 jboolean  __attribute__((export_name("TS_PathFailure_eq"))) TS_PathFailure_eq(uint64_t a, uint64_t b) {
65698         LDKPathFailure* a_conv = (LDKPathFailure*)untag_ptr(a);
65699         LDKPathFailure* b_conv = (LDKPathFailure*)untag_ptr(b);
65700         jboolean ret_conv = PathFailure_eq(a_conv, b_conv);
65701         return ret_conv;
65702 }
65703
65704 int8_tArray  __attribute__((export_name("TS_PathFailure_write"))) TS_PathFailure_write(uint64_t obj) {
65705         LDKPathFailure* obj_conv = (LDKPathFailure*)untag_ptr(obj);
65706         LDKCVec_u8Z ret_var = PathFailure_write(obj_conv);
65707         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
65708         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
65709         CVec_u8Z_free(ret_var);
65710         return ret_arr;
65711 }
65712
65713 uint64_t  __attribute__((export_name("TS_PathFailure_read"))) TS_PathFailure_read(int8_tArray ser) {
65714         LDKu8slice ser_ref;
65715         ser_ref.datalen = ser->arr_len;
65716         ser_ref.data = ser->elems;
65717         LDKCResult_COption_PathFailureZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_COption_PathFailureZDecodeErrorZ), "LDKCResult_COption_PathFailureZDecodeErrorZ");
65718         *ret_conv = PathFailure_read(ser_ref);
65719         FREE(ser);
65720         return tag_ptr(ret_conv, true);
65721 }
65722
65723 void  __attribute__((export_name("TS_ClosureReason_free"))) TS_ClosureReason_free(uint64_t this_ptr) {
65724         if (!ptr_is_owned(this_ptr)) return;
65725         void* this_ptr_ptr = untag_ptr(this_ptr);
65726         CHECK_ACCESS(this_ptr_ptr);
65727         LDKClosureReason this_ptr_conv = *(LDKClosureReason*)(this_ptr_ptr);
65728         FREE(untag_ptr(this_ptr));
65729         ClosureReason_free(this_ptr_conv);
65730 }
65731
65732 static inline uint64_t ClosureReason_clone_ptr(LDKClosureReason *NONNULL_PTR arg) {
65733         LDKClosureReason *ret_copy = MALLOC(sizeof(LDKClosureReason), "LDKClosureReason");
65734         *ret_copy = ClosureReason_clone(arg);
65735         uint64_t ret_ref = tag_ptr(ret_copy, true);
65736         return ret_ref;
65737 }
65738 int64_t  __attribute__((export_name("TS_ClosureReason_clone_ptr"))) TS_ClosureReason_clone_ptr(uint64_t arg) {
65739         LDKClosureReason* arg_conv = (LDKClosureReason*)untag_ptr(arg);
65740         int64_t ret_conv = ClosureReason_clone_ptr(arg_conv);
65741         return ret_conv;
65742 }
65743
65744 uint64_t  __attribute__((export_name("TS_ClosureReason_clone"))) TS_ClosureReason_clone(uint64_t orig) {
65745         LDKClosureReason* orig_conv = (LDKClosureReason*)untag_ptr(orig);
65746         LDKClosureReason *ret_copy = MALLOC(sizeof(LDKClosureReason), "LDKClosureReason");
65747         *ret_copy = ClosureReason_clone(orig_conv);
65748         uint64_t ret_ref = tag_ptr(ret_copy, true);
65749         return ret_ref;
65750 }
65751
65752 uint64_t  __attribute__((export_name("TS_ClosureReason_counterparty_force_closed"))) TS_ClosureReason_counterparty_force_closed(uint64_t peer_msg) {
65753         LDKUntrustedString peer_msg_conv;
65754         peer_msg_conv.inner = untag_ptr(peer_msg);
65755         peer_msg_conv.is_owned = ptr_is_owned(peer_msg);
65756         CHECK_INNER_FIELD_ACCESS_OR_NULL(peer_msg_conv);
65757         peer_msg_conv = UntrustedString_clone(&peer_msg_conv);
65758         LDKClosureReason *ret_copy = MALLOC(sizeof(LDKClosureReason), "LDKClosureReason");
65759         *ret_copy = ClosureReason_counterparty_force_closed(peer_msg_conv);
65760         uint64_t ret_ref = tag_ptr(ret_copy, true);
65761         return ret_ref;
65762 }
65763
65764 uint64_t  __attribute__((export_name("TS_ClosureReason_holder_force_closed"))) TS_ClosureReason_holder_force_closed() {
65765         LDKClosureReason *ret_copy = MALLOC(sizeof(LDKClosureReason), "LDKClosureReason");
65766         *ret_copy = ClosureReason_holder_force_closed();
65767         uint64_t ret_ref = tag_ptr(ret_copy, true);
65768         return ret_ref;
65769 }
65770
65771 uint64_t  __attribute__((export_name("TS_ClosureReason_cooperative_closure"))) TS_ClosureReason_cooperative_closure() {
65772         LDKClosureReason *ret_copy = MALLOC(sizeof(LDKClosureReason), "LDKClosureReason");
65773         *ret_copy = ClosureReason_cooperative_closure();
65774         uint64_t ret_ref = tag_ptr(ret_copy, true);
65775         return ret_ref;
65776 }
65777
65778 uint64_t  __attribute__((export_name("TS_ClosureReason_commitment_tx_confirmed"))) TS_ClosureReason_commitment_tx_confirmed() {
65779         LDKClosureReason *ret_copy = MALLOC(sizeof(LDKClosureReason), "LDKClosureReason");
65780         *ret_copy = ClosureReason_commitment_tx_confirmed();
65781         uint64_t ret_ref = tag_ptr(ret_copy, true);
65782         return ret_ref;
65783 }
65784
65785 uint64_t  __attribute__((export_name("TS_ClosureReason_funding_timed_out"))) TS_ClosureReason_funding_timed_out() {
65786         LDKClosureReason *ret_copy = MALLOC(sizeof(LDKClosureReason), "LDKClosureReason");
65787         *ret_copy = ClosureReason_funding_timed_out();
65788         uint64_t ret_ref = tag_ptr(ret_copy, true);
65789         return ret_ref;
65790 }
65791
65792 uint64_t  __attribute__((export_name("TS_ClosureReason_processing_error"))) TS_ClosureReason_processing_error(jstring err) {
65793         LDKStr err_conv = str_ref_to_owned_c(err);
65794         LDKClosureReason *ret_copy = MALLOC(sizeof(LDKClosureReason), "LDKClosureReason");
65795         *ret_copy = ClosureReason_processing_error(err_conv);
65796         uint64_t ret_ref = tag_ptr(ret_copy, true);
65797         return ret_ref;
65798 }
65799
65800 uint64_t  __attribute__((export_name("TS_ClosureReason_disconnected_peer"))) TS_ClosureReason_disconnected_peer() {
65801         LDKClosureReason *ret_copy = MALLOC(sizeof(LDKClosureReason), "LDKClosureReason");
65802         *ret_copy = ClosureReason_disconnected_peer();
65803         uint64_t ret_ref = tag_ptr(ret_copy, true);
65804         return ret_ref;
65805 }
65806
65807 uint64_t  __attribute__((export_name("TS_ClosureReason_outdated_channel_manager"))) TS_ClosureReason_outdated_channel_manager() {
65808         LDKClosureReason *ret_copy = MALLOC(sizeof(LDKClosureReason), "LDKClosureReason");
65809         *ret_copy = ClosureReason_outdated_channel_manager();
65810         uint64_t ret_ref = tag_ptr(ret_copy, true);
65811         return ret_ref;
65812 }
65813
65814 uint64_t  __attribute__((export_name("TS_ClosureReason_counterparty_coop_closed_unfunded_channel"))) TS_ClosureReason_counterparty_coop_closed_unfunded_channel() {
65815         LDKClosureReason *ret_copy = MALLOC(sizeof(LDKClosureReason), "LDKClosureReason");
65816         *ret_copy = ClosureReason_counterparty_coop_closed_unfunded_channel();
65817         uint64_t ret_ref = tag_ptr(ret_copy, true);
65818         return ret_ref;
65819 }
65820
65821 uint64_t  __attribute__((export_name("TS_ClosureReason_funding_batch_closure"))) TS_ClosureReason_funding_batch_closure() {
65822         LDKClosureReason *ret_copy = MALLOC(sizeof(LDKClosureReason), "LDKClosureReason");
65823         *ret_copy = ClosureReason_funding_batch_closure();
65824         uint64_t ret_ref = tag_ptr(ret_copy, true);
65825         return ret_ref;
65826 }
65827
65828 jboolean  __attribute__((export_name("TS_ClosureReason_eq"))) TS_ClosureReason_eq(uint64_t a, uint64_t b) {
65829         LDKClosureReason* a_conv = (LDKClosureReason*)untag_ptr(a);
65830         LDKClosureReason* b_conv = (LDKClosureReason*)untag_ptr(b);
65831         jboolean ret_conv = ClosureReason_eq(a_conv, b_conv);
65832         return ret_conv;
65833 }
65834
65835 int8_tArray  __attribute__((export_name("TS_ClosureReason_write"))) TS_ClosureReason_write(uint64_t obj) {
65836         LDKClosureReason* obj_conv = (LDKClosureReason*)untag_ptr(obj);
65837         LDKCVec_u8Z ret_var = ClosureReason_write(obj_conv);
65838         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
65839         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
65840         CVec_u8Z_free(ret_var);
65841         return ret_arr;
65842 }
65843
65844 uint64_t  __attribute__((export_name("TS_ClosureReason_read"))) TS_ClosureReason_read(int8_tArray ser) {
65845         LDKu8slice ser_ref;
65846         ser_ref.datalen = ser->arr_len;
65847         ser_ref.data = ser->elems;
65848         LDKCResult_COption_ClosureReasonZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_COption_ClosureReasonZDecodeErrorZ), "LDKCResult_COption_ClosureReasonZDecodeErrorZ");
65849         *ret_conv = ClosureReason_read(ser_ref);
65850         FREE(ser);
65851         return tag_ptr(ret_conv, true);
65852 }
65853
65854 void  __attribute__((export_name("TS_HTLCDestination_free"))) TS_HTLCDestination_free(uint64_t this_ptr) {
65855         if (!ptr_is_owned(this_ptr)) return;
65856         void* this_ptr_ptr = untag_ptr(this_ptr);
65857         CHECK_ACCESS(this_ptr_ptr);
65858         LDKHTLCDestination this_ptr_conv = *(LDKHTLCDestination*)(this_ptr_ptr);
65859         FREE(untag_ptr(this_ptr));
65860         HTLCDestination_free(this_ptr_conv);
65861 }
65862
65863 static inline uint64_t HTLCDestination_clone_ptr(LDKHTLCDestination *NONNULL_PTR arg) {
65864         LDKHTLCDestination *ret_copy = MALLOC(sizeof(LDKHTLCDestination), "LDKHTLCDestination");
65865         *ret_copy = HTLCDestination_clone(arg);
65866         uint64_t ret_ref = tag_ptr(ret_copy, true);
65867         return ret_ref;
65868 }
65869 int64_t  __attribute__((export_name("TS_HTLCDestination_clone_ptr"))) TS_HTLCDestination_clone_ptr(uint64_t arg) {
65870         LDKHTLCDestination* arg_conv = (LDKHTLCDestination*)untag_ptr(arg);
65871         int64_t ret_conv = HTLCDestination_clone_ptr(arg_conv);
65872         return ret_conv;
65873 }
65874
65875 uint64_t  __attribute__((export_name("TS_HTLCDestination_clone"))) TS_HTLCDestination_clone(uint64_t orig) {
65876         LDKHTLCDestination* orig_conv = (LDKHTLCDestination*)untag_ptr(orig);
65877         LDKHTLCDestination *ret_copy = MALLOC(sizeof(LDKHTLCDestination), "LDKHTLCDestination");
65878         *ret_copy = HTLCDestination_clone(orig_conv);
65879         uint64_t ret_ref = tag_ptr(ret_copy, true);
65880         return ret_ref;
65881 }
65882
65883 uint64_t  __attribute__((export_name("TS_HTLCDestination_next_hop_channel"))) TS_HTLCDestination_next_hop_channel(int8_tArray node_id, int8_tArray channel_id) {
65884         LDKPublicKey node_id_ref;
65885         CHECK(node_id->arr_len == 33);
65886         memcpy(node_id_ref.compressed_form, node_id->elems, 33); FREE(node_id);
65887         LDKThirtyTwoBytes channel_id_ref;
65888         CHECK(channel_id->arr_len == 32);
65889         memcpy(channel_id_ref.data, channel_id->elems, 32); FREE(channel_id);
65890         LDKHTLCDestination *ret_copy = MALLOC(sizeof(LDKHTLCDestination), "LDKHTLCDestination");
65891         *ret_copy = HTLCDestination_next_hop_channel(node_id_ref, channel_id_ref);
65892         uint64_t ret_ref = tag_ptr(ret_copy, true);
65893         return ret_ref;
65894 }
65895
65896 uint64_t  __attribute__((export_name("TS_HTLCDestination_unknown_next_hop"))) TS_HTLCDestination_unknown_next_hop(int64_t requested_forward_scid) {
65897         LDKHTLCDestination *ret_copy = MALLOC(sizeof(LDKHTLCDestination), "LDKHTLCDestination");
65898         *ret_copy = HTLCDestination_unknown_next_hop(requested_forward_scid);
65899         uint64_t ret_ref = tag_ptr(ret_copy, true);
65900         return ret_ref;
65901 }
65902
65903 uint64_t  __attribute__((export_name("TS_HTLCDestination_invalid_forward"))) TS_HTLCDestination_invalid_forward(int64_t requested_forward_scid) {
65904         LDKHTLCDestination *ret_copy = MALLOC(sizeof(LDKHTLCDestination), "LDKHTLCDestination");
65905         *ret_copy = HTLCDestination_invalid_forward(requested_forward_scid);
65906         uint64_t ret_ref = tag_ptr(ret_copy, true);
65907         return ret_ref;
65908 }
65909
65910 uint64_t  __attribute__((export_name("TS_HTLCDestination_failed_payment"))) TS_HTLCDestination_failed_payment(int8_tArray payment_hash) {
65911         LDKThirtyTwoBytes payment_hash_ref;
65912         CHECK(payment_hash->arr_len == 32);
65913         memcpy(payment_hash_ref.data, payment_hash->elems, 32); FREE(payment_hash);
65914         LDKHTLCDestination *ret_copy = MALLOC(sizeof(LDKHTLCDestination), "LDKHTLCDestination");
65915         *ret_copy = HTLCDestination_failed_payment(payment_hash_ref);
65916         uint64_t ret_ref = tag_ptr(ret_copy, true);
65917         return ret_ref;
65918 }
65919
65920 jboolean  __attribute__((export_name("TS_HTLCDestination_eq"))) TS_HTLCDestination_eq(uint64_t a, uint64_t b) {
65921         LDKHTLCDestination* a_conv = (LDKHTLCDestination*)untag_ptr(a);
65922         LDKHTLCDestination* b_conv = (LDKHTLCDestination*)untag_ptr(b);
65923         jboolean ret_conv = HTLCDestination_eq(a_conv, b_conv);
65924         return ret_conv;
65925 }
65926
65927 int8_tArray  __attribute__((export_name("TS_HTLCDestination_write"))) TS_HTLCDestination_write(uint64_t obj) {
65928         LDKHTLCDestination* obj_conv = (LDKHTLCDestination*)untag_ptr(obj);
65929         LDKCVec_u8Z ret_var = HTLCDestination_write(obj_conv);
65930         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
65931         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
65932         CVec_u8Z_free(ret_var);
65933         return ret_arr;
65934 }
65935
65936 uint64_t  __attribute__((export_name("TS_HTLCDestination_read"))) TS_HTLCDestination_read(int8_tArray ser) {
65937         LDKu8slice ser_ref;
65938         ser_ref.datalen = ser->arr_len;
65939         ser_ref.data = ser->elems;
65940         LDKCResult_COption_HTLCDestinationZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_COption_HTLCDestinationZDecodeErrorZ), "LDKCResult_COption_HTLCDestinationZDecodeErrorZ");
65941         *ret_conv = HTLCDestination_read(ser_ref);
65942         FREE(ser);
65943         return tag_ptr(ret_conv, true);
65944 }
65945
65946 uint32_t  __attribute__((export_name("TS_PaymentFailureReason_clone"))) TS_PaymentFailureReason_clone(uint64_t orig) {
65947         LDKPaymentFailureReason* orig_conv = (LDKPaymentFailureReason*)untag_ptr(orig);
65948         uint32_t ret_conv = LDKPaymentFailureReason_to_js(PaymentFailureReason_clone(orig_conv));
65949         return ret_conv;
65950 }
65951
65952 uint32_t  __attribute__((export_name("TS_PaymentFailureReason_recipient_rejected"))) TS_PaymentFailureReason_recipient_rejected() {
65953         uint32_t ret_conv = LDKPaymentFailureReason_to_js(PaymentFailureReason_recipient_rejected());
65954         return ret_conv;
65955 }
65956
65957 uint32_t  __attribute__((export_name("TS_PaymentFailureReason_user_abandoned"))) TS_PaymentFailureReason_user_abandoned() {
65958         uint32_t ret_conv = LDKPaymentFailureReason_to_js(PaymentFailureReason_user_abandoned());
65959         return ret_conv;
65960 }
65961
65962 uint32_t  __attribute__((export_name("TS_PaymentFailureReason_retries_exhausted"))) TS_PaymentFailureReason_retries_exhausted() {
65963         uint32_t ret_conv = LDKPaymentFailureReason_to_js(PaymentFailureReason_retries_exhausted());
65964         return ret_conv;
65965 }
65966
65967 uint32_t  __attribute__((export_name("TS_PaymentFailureReason_payment_expired"))) TS_PaymentFailureReason_payment_expired() {
65968         uint32_t ret_conv = LDKPaymentFailureReason_to_js(PaymentFailureReason_payment_expired());
65969         return ret_conv;
65970 }
65971
65972 uint32_t  __attribute__((export_name("TS_PaymentFailureReason_route_not_found"))) TS_PaymentFailureReason_route_not_found() {
65973         uint32_t ret_conv = LDKPaymentFailureReason_to_js(PaymentFailureReason_route_not_found());
65974         return ret_conv;
65975 }
65976
65977 uint32_t  __attribute__((export_name("TS_PaymentFailureReason_unexpected_error"))) TS_PaymentFailureReason_unexpected_error() {
65978         uint32_t ret_conv = LDKPaymentFailureReason_to_js(PaymentFailureReason_unexpected_error());
65979         return ret_conv;
65980 }
65981
65982 jboolean  __attribute__((export_name("TS_PaymentFailureReason_eq"))) TS_PaymentFailureReason_eq(uint64_t a, uint64_t b) {
65983         LDKPaymentFailureReason* a_conv = (LDKPaymentFailureReason*)untag_ptr(a);
65984         LDKPaymentFailureReason* b_conv = (LDKPaymentFailureReason*)untag_ptr(b);
65985         jboolean ret_conv = PaymentFailureReason_eq(a_conv, b_conv);
65986         return ret_conv;
65987 }
65988
65989 int8_tArray  __attribute__((export_name("TS_PaymentFailureReason_write"))) TS_PaymentFailureReason_write(uint64_t obj) {
65990         LDKPaymentFailureReason* obj_conv = (LDKPaymentFailureReason*)untag_ptr(obj);
65991         LDKCVec_u8Z ret_var = PaymentFailureReason_write(obj_conv);
65992         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
65993         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
65994         CVec_u8Z_free(ret_var);
65995         return ret_arr;
65996 }
65997
65998 uint64_t  __attribute__((export_name("TS_PaymentFailureReason_read"))) TS_PaymentFailureReason_read(int8_tArray ser) {
65999         LDKu8slice ser_ref;
66000         ser_ref.datalen = ser->arr_len;
66001         ser_ref.data = ser->elems;
66002         LDKCResult_PaymentFailureReasonDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PaymentFailureReasonDecodeErrorZ), "LDKCResult_PaymentFailureReasonDecodeErrorZ");
66003         *ret_conv = PaymentFailureReason_read(ser_ref);
66004         FREE(ser);
66005         return tag_ptr(ret_conv, true);
66006 }
66007
66008 void  __attribute__((export_name("TS_Event_free"))) TS_Event_free(uint64_t this_ptr) {
66009         if (!ptr_is_owned(this_ptr)) return;
66010         void* this_ptr_ptr = untag_ptr(this_ptr);
66011         CHECK_ACCESS(this_ptr_ptr);
66012         LDKEvent this_ptr_conv = *(LDKEvent*)(this_ptr_ptr);
66013         FREE(untag_ptr(this_ptr));
66014         Event_free(this_ptr_conv);
66015 }
66016
66017 static inline uint64_t Event_clone_ptr(LDKEvent *NONNULL_PTR arg) {
66018         LDKEvent *ret_copy = MALLOC(sizeof(LDKEvent), "LDKEvent");
66019         *ret_copy = Event_clone(arg);
66020         uint64_t ret_ref = tag_ptr(ret_copy, true);
66021         return ret_ref;
66022 }
66023 int64_t  __attribute__((export_name("TS_Event_clone_ptr"))) TS_Event_clone_ptr(uint64_t arg) {
66024         LDKEvent* arg_conv = (LDKEvent*)untag_ptr(arg);
66025         int64_t ret_conv = Event_clone_ptr(arg_conv);
66026         return ret_conv;
66027 }
66028
66029 uint64_t  __attribute__((export_name("TS_Event_clone"))) TS_Event_clone(uint64_t orig) {
66030         LDKEvent* orig_conv = (LDKEvent*)untag_ptr(orig);
66031         LDKEvent *ret_copy = MALLOC(sizeof(LDKEvent), "LDKEvent");
66032         *ret_copy = Event_clone(orig_conv);
66033         uint64_t ret_ref = tag_ptr(ret_copy, true);
66034         return ret_ref;
66035 }
66036
66037 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) {
66038         LDKThirtyTwoBytes temporary_channel_id_ref;
66039         CHECK(temporary_channel_id->arr_len == 32);
66040         memcpy(temporary_channel_id_ref.data, temporary_channel_id->elems, 32); FREE(temporary_channel_id);
66041         LDKPublicKey counterparty_node_id_ref;
66042         CHECK(counterparty_node_id->arr_len == 33);
66043         memcpy(counterparty_node_id_ref.compressed_form, counterparty_node_id->elems, 33); FREE(counterparty_node_id);
66044         LDKCVec_u8Z output_script_ref;
66045         output_script_ref.datalen = output_script->arr_len;
66046         output_script_ref.data = MALLOC(output_script_ref.datalen, "LDKCVec_u8Z Bytes");
66047         memcpy(output_script_ref.data, output_script->elems, output_script_ref.datalen); FREE(output_script);
66048         LDKU128 user_channel_id_ref;
66049         CHECK(user_channel_id->arr_len == 16);
66050         memcpy(user_channel_id_ref.le_bytes, user_channel_id->elems, 16); FREE(user_channel_id);
66051         LDKEvent *ret_copy = MALLOC(sizeof(LDKEvent), "LDKEvent");
66052         *ret_copy = Event_funding_generation_ready(temporary_channel_id_ref, counterparty_node_id_ref, channel_value_satoshis, output_script_ref, user_channel_id_ref);
66053         uint64_t ret_ref = tag_ptr(ret_copy, true);
66054         return ret_ref;
66055 }
66056
66057 uint64_t  __attribute__((export_name("TS_Event_payment_claimable"))) TS_Event_payment_claimable(int8_tArray receiver_node_id, int8_tArray payment_hash, uint64_t onion_fields, int64_t amount_msat, int64_t counterparty_skimmed_fee_msat, uint64_t purpose, uint64_t via_channel_id, uint64_t via_user_channel_id, uint64_t claim_deadline) {
66058         LDKPublicKey receiver_node_id_ref;
66059         CHECK(receiver_node_id->arr_len == 33);
66060         memcpy(receiver_node_id_ref.compressed_form, receiver_node_id->elems, 33); FREE(receiver_node_id);
66061         LDKThirtyTwoBytes payment_hash_ref;
66062         CHECK(payment_hash->arr_len == 32);
66063         memcpy(payment_hash_ref.data, payment_hash->elems, 32); FREE(payment_hash);
66064         LDKRecipientOnionFields onion_fields_conv;
66065         onion_fields_conv.inner = untag_ptr(onion_fields);
66066         onion_fields_conv.is_owned = ptr_is_owned(onion_fields);
66067         CHECK_INNER_FIELD_ACCESS_OR_NULL(onion_fields_conv);
66068         onion_fields_conv = RecipientOnionFields_clone(&onion_fields_conv);
66069         void* purpose_ptr = untag_ptr(purpose);
66070         CHECK_ACCESS(purpose_ptr);
66071         LDKPaymentPurpose purpose_conv = *(LDKPaymentPurpose*)(purpose_ptr);
66072         purpose_conv = PaymentPurpose_clone((LDKPaymentPurpose*)untag_ptr(purpose));
66073         void* via_channel_id_ptr = untag_ptr(via_channel_id);
66074         CHECK_ACCESS(via_channel_id_ptr);
66075         LDKCOption_ThirtyTwoBytesZ via_channel_id_conv = *(LDKCOption_ThirtyTwoBytesZ*)(via_channel_id_ptr);
66076         via_channel_id_conv = COption_ThirtyTwoBytesZ_clone((LDKCOption_ThirtyTwoBytesZ*)untag_ptr(via_channel_id));
66077         void* via_user_channel_id_ptr = untag_ptr(via_user_channel_id);
66078         CHECK_ACCESS(via_user_channel_id_ptr);
66079         LDKCOption_U128Z via_user_channel_id_conv = *(LDKCOption_U128Z*)(via_user_channel_id_ptr);
66080         via_user_channel_id_conv = COption_U128Z_clone((LDKCOption_U128Z*)untag_ptr(via_user_channel_id));
66081         void* claim_deadline_ptr = untag_ptr(claim_deadline);
66082         CHECK_ACCESS(claim_deadline_ptr);
66083         LDKCOption_u32Z claim_deadline_conv = *(LDKCOption_u32Z*)(claim_deadline_ptr);
66084         claim_deadline_conv = COption_u32Z_clone((LDKCOption_u32Z*)untag_ptr(claim_deadline));
66085         LDKEvent *ret_copy = MALLOC(sizeof(LDKEvent), "LDKEvent");
66086         *ret_copy = Event_payment_claimable(receiver_node_id_ref, payment_hash_ref, onion_fields_conv, amount_msat, counterparty_skimmed_fee_msat, purpose_conv, via_channel_id_conv, via_user_channel_id_conv, claim_deadline_conv);
66087         uint64_t ret_ref = tag_ptr(ret_copy, true);
66088         return ret_ref;
66089 }
66090
66091 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, uint64_tArray htlcs, uint64_t sender_intended_total_msat) {
66092         LDKPublicKey receiver_node_id_ref;
66093         CHECK(receiver_node_id->arr_len == 33);
66094         memcpy(receiver_node_id_ref.compressed_form, receiver_node_id->elems, 33); FREE(receiver_node_id);
66095         LDKThirtyTwoBytes payment_hash_ref;
66096         CHECK(payment_hash->arr_len == 32);
66097         memcpy(payment_hash_ref.data, payment_hash->elems, 32); FREE(payment_hash);
66098         void* purpose_ptr = untag_ptr(purpose);
66099         CHECK_ACCESS(purpose_ptr);
66100         LDKPaymentPurpose purpose_conv = *(LDKPaymentPurpose*)(purpose_ptr);
66101         purpose_conv = PaymentPurpose_clone((LDKPaymentPurpose*)untag_ptr(purpose));
66102         LDKCVec_ClaimedHTLCZ htlcs_constr;
66103         htlcs_constr.datalen = htlcs->arr_len;
66104         if (htlcs_constr.datalen > 0)
66105                 htlcs_constr.data = MALLOC(htlcs_constr.datalen * sizeof(LDKClaimedHTLC), "LDKCVec_ClaimedHTLCZ Elements");
66106         else
66107                 htlcs_constr.data = NULL;
66108         uint64_t* htlcs_vals = htlcs->elems;
66109         for (size_t n = 0; n < htlcs_constr.datalen; n++) {
66110                 uint64_t htlcs_conv_13 = htlcs_vals[n];
66111                 LDKClaimedHTLC htlcs_conv_13_conv;
66112                 htlcs_conv_13_conv.inner = untag_ptr(htlcs_conv_13);
66113                 htlcs_conv_13_conv.is_owned = ptr_is_owned(htlcs_conv_13);
66114                 CHECK_INNER_FIELD_ACCESS_OR_NULL(htlcs_conv_13_conv);
66115                 htlcs_conv_13_conv = ClaimedHTLC_clone(&htlcs_conv_13_conv);
66116                 htlcs_constr.data[n] = htlcs_conv_13_conv;
66117         }
66118         FREE(htlcs);
66119         void* sender_intended_total_msat_ptr = untag_ptr(sender_intended_total_msat);
66120         CHECK_ACCESS(sender_intended_total_msat_ptr);
66121         LDKCOption_u64Z sender_intended_total_msat_conv = *(LDKCOption_u64Z*)(sender_intended_total_msat_ptr);
66122         sender_intended_total_msat_conv = COption_u64Z_clone((LDKCOption_u64Z*)untag_ptr(sender_intended_total_msat));
66123         LDKEvent *ret_copy = MALLOC(sizeof(LDKEvent), "LDKEvent");
66124         *ret_copy = Event_payment_claimed(receiver_node_id_ref, payment_hash_ref, amount_msat, purpose_conv, htlcs_constr, sender_intended_total_msat_conv);
66125         uint64_t ret_ref = tag_ptr(ret_copy, true);
66126         return ret_ref;
66127 }
66128
66129 uint64_t  __attribute__((export_name("TS_Event_invoice_request_failed"))) TS_Event_invoice_request_failed(int8_tArray payment_id) {
66130         LDKThirtyTwoBytes payment_id_ref;
66131         CHECK(payment_id->arr_len == 32);
66132         memcpy(payment_id_ref.data, payment_id->elems, 32); FREE(payment_id);
66133         LDKEvent *ret_copy = MALLOC(sizeof(LDKEvent), "LDKEvent");
66134         *ret_copy = Event_invoice_request_failed(payment_id_ref);
66135         uint64_t ret_ref = tag_ptr(ret_copy, true);
66136         return ret_ref;
66137 }
66138
66139 uint64_t  __attribute__((export_name("TS_Event_payment_sent"))) TS_Event_payment_sent(uint64_t payment_id, int8_tArray payment_preimage, int8_tArray payment_hash, uint64_t fee_paid_msat) {
66140         void* payment_id_ptr = untag_ptr(payment_id);
66141         CHECK_ACCESS(payment_id_ptr);
66142         LDKCOption_ThirtyTwoBytesZ payment_id_conv = *(LDKCOption_ThirtyTwoBytesZ*)(payment_id_ptr);
66143         payment_id_conv = COption_ThirtyTwoBytesZ_clone((LDKCOption_ThirtyTwoBytesZ*)untag_ptr(payment_id));
66144         LDKThirtyTwoBytes payment_preimage_ref;
66145         CHECK(payment_preimage->arr_len == 32);
66146         memcpy(payment_preimage_ref.data, payment_preimage->elems, 32); FREE(payment_preimage);
66147         LDKThirtyTwoBytes payment_hash_ref;
66148         CHECK(payment_hash->arr_len == 32);
66149         memcpy(payment_hash_ref.data, payment_hash->elems, 32); FREE(payment_hash);
66150         void* fee_paid_msat_ptr = untag_ptr(fee_paid_msat);
66151         CHECK_ACCESS(fee_paid_msat_ptr);
66152         LDKCOption_u64Z fee_paid_msat_conv = *(LDKCOption_u64Z*)(fee_paid_msat_ptr);
66153         fee_paid_msat_conv = COption_u64Z_clone((LDKCOption_u64Z*)untag_ptr(fee_paid_msat));
66154         LDKEvent *ret_copy = MALLOC(sizeof(LDKEvent), "LDKEvent");
66155         *ret_copy = Event_payment_sent(payment_id_conv, payment_preimage_ref, payment_hash_ref, fee_paid_msat_conv);
66156         uint64_t ret_ref = tag_ptr(ret_copy, true);
66157         return ret_ref;
66158 }
66159
66160 uint64_t  __attribute__((export_name("TS_Event_payment_failed"))) TS_Event_payment_failed(int8_tArray payment_id, int8_tArray payment_hash, uint64_t reason) {
66161         LDKThirtyTwoBytes payment_id_ref;
66162         CHECK(payment_id->arr_len == 32);
66163         memcpy(payment_id_ref.data, payment_id->elems, 32); FREE(payment_id);
66164         LDKThirtyTwoBytes payment_hash_ref;
66165         CHECK(payment_hash->arr_len == 32);
66166         memcpy(payment_hash_ref.data, payment_hash->elems, 32); FREE(payment_hash);
66167         void* reason_ptr = untag_ptr(reason);
66168         CHECK_ACCESS(reason_ptr);
66169         LDKCOption_PaymentFailureReasonZ reason_conv = *(LDKCOption_PaymentFailureReasonZ*)(reason_ptr);
66170         reason_conv = COption_PaymentFailureReasonZ_clone((LDKCOption_PaymentFailureReasonZ*)untag_ptr(reason));
66171         LDKEvent *ret_copy = MALLOC(sizeof(LDKEvent), "LDKEvent");
66172         *ret_copy = Event_payment_failed(payment_id_ref, payment_hash_ref, reason_conv);
66173         uint64_t ret_ref = tag_ptr(ret_copy, true);
66174         return ret_ref;
66175 }
66176
66177 uint64_t  __attribute__((export_name("TS_Event_payment_path_successful"))) TS_Event_payment_path_successful(int8_tArray payment_id, uint64_t payment_hash, uint64_t path) {
66178         LDKThirtyTwoBytes payment_id_ref;
66179         CHECK(payment_id->arr_len == 32);
66180         memcpy(payment_id_ref.data, payment_id->elems, 32); FREE(payment_id);
66181         void* payment_hash_ptr = untag_ptr(payment_hash);
66182         CHECK_ACCESS(payment_hash_ptr);
66183         LDKCOption_ThirtyTwoBytesZ payment_hash_conv = *(LDKCOption_ThirtyTwoBytesZ*)(payment_hash_ptr);
66184         payment_hash_conv = COption_ThirtyTwoBytesZ_clone((LDKCOption_ThirtyTwoBytesZ*)untag_ptr(payment_hash));
66185         LDKPath path_conv;
66186         path_conv.inner = untag_ptr(path);
66187         path_conv.is_owned = ptr_is_owned(path);
66188         CHECK_INNER_FIELD_ACCESS_OR_NULL(path_conv);
66189         path_conv = Path_clone(&path_conv);
66190         LDKEvent *ret_copy = MALLOC(sizeof(LDKEvent), "LDKEvent");
66191         *ret_copy = Event_payment_path_successful(payment_id_ref, payment_hash_conv, path_conv);
66192         uint64_t ret_ref = tag_ptr(ret_copy, true);
66193         return ret_ref;
66194 }
66195
66196 uint64_t  __attribute__((export_name("TS_Event_payment_path_failed"))) TS_Event_payment_path_failed(uint64_t payment_id, int8_tArray payment_hash, jboolean payment_failed_permanently, uint64_t failure, uint64_t path, uint64_t short_channel_id) {
66197         void* payment_id_ptr = untag_ptr(payment_id);
66198         CHECK_ACCESS(payment_id_ptr);
66199         LDKCOption_ThirtyTwoBytesZ payment_id_conv = *(LDKCOption_ThirtyTwoBytesZ*)(payment_id_ptr);
66200         payment_id_conv = COption_ThirtyTwoBytesZ_clone((LDKCOption_ThirtyTwoBytesZ*)untag_ptr(payment_id));
66201         LDKThirtyTwoBytes payment_hash_ref;
66202         CHECK(payment_hash->arr_len == 32);
66203         memcpy(payment_hash_ref.data, payment_hash->elems, 32); FREE(payment_hash);
66204         void* failure_ptr = untag_ptr(failure);
66205         CHECK_ACCESS(failure_ptr);
66206         LDKPathFailure failure_conv = *(LDKPathFailure*)(failure_ptr);
66207         failure_conv = PathFailure_clone((LDKPathFailure*)untag_ptr(failure));
66208         LDKPath path_conv;
66209         path_conv.inner = untag_ptr(path);
66210         path_conv.is_owned = ptr_is_owned(path);
66211         CHECK_INNER_FIELD_ACCESS_OR_NULL(path_conv);
66212         path_conv = Path_clone(&path_conv);
66213         void* short_channel_id_ptr = untag_ptr(short_channel_id);
66214         CHECK_ACCESS(short_channel_id_ptr);
66215         LDKCOption_u64Z short_channel_id_conv = *(LDKCOption_u64Z*)(short_channel_id_ptr);
66216         short_channel_id_conv = COption_u64Z_clone((LDKCOption_u64Z*)untag_ptr(short_channel_id));
66217         LDKEvent *ret_copy = MALLOC(sizeof(LDKEvent), "LDKEvent");
66218         *ret_copy = Event_payment_path_failed(payment_id_conv, payment_hash_ref, payment_failed_permanently, failure_conv, path_conv, short_channel_id_conv);
66219         uint64_t ret_ref = tag_ptr(ret_copy, true);
66220         return ret_ref;
66221 }
66222
66223 uint64_t  __attribute__((export_name("TS_Event_probe_successful"))) TS_Event_probe_successful(int8_tArray payment_id, int8_tArray payment_hash, uint64_t path) {
66224         LDKThirtyTwoBytes payment_id_ref;
66225         CHECK(payment_id->arr_len == 32);
66226         memcpy(payment_id_ref.data, payment_id->elems, 32); FREE(payment_id);
66227         LDKThirtyTwoBytes payment_hash_ref;
66228         CHECK(payment_hash->arr_len == 32);
66229         memcpy(payment_hash_ref.data, payment_hash->elems, 32); FREE(payment_hash);
66230         LDKPath path_conv;
66231         path_conv.inner = untag_ptr(path);
66232         path_conv.is_owned = ptr_is_owned(path);
66233         CHECK_INNER_FIELD_ACCESS_OR_NULL(path_conv);
66234         path_conv = Path_clone(&path_conv);
66235         LDKEvent *ret_copy = MALLOC(sizeof(LDKEvent), "LDKEvent");
66236         *ret_copy = Event_probe_successful(payment_id_ref, payment_hash_ref, path_conv);
66237         uint64_t ret_ref = tag_ptr(ret_copy, true);
66238         return ret_ref;
66239 }
66240
66241 uint64_t  __attribute__((export_name("TS_Event_probe_failed"))) TS_Event_probe_failed(int8_tArray payment_id, int8_tArray payment_hash, uint64_t path, uint64_t short_channel_id) {
66242         LDKThirtyTwoBytes payment_id_ref;
66243         CHECK(payment_id->arr_len == 32);
66244         memcpy(payment_id_ref.data, payment_id->elems, 32); FREE(payment_id);
66245         LDKThirtyTwoBytes payment_hash_ref;
66246         CHECK(payment_hash->arr_len == 32);
66247         memcpy(payment_hash_ref.data, payment_hash->elems, 32); FREE(payment_hash);
66248         LDKPath path_conv;
66249         path_conv.inner = untag_ptr(path);
66250         path_conv.is_owned = ptr_is_owned(path);
66251         CHECK_INNER_FIELD_ACCESS_OR_NULL(path_conv);
66252         path_conv = Path_clone(&path_conv);
66253         void* short_channel_id_ptr = untag_ptr(short_channel_id);
66254         CHECK_ACCESS(short_channel_id_ptr);
66255         LDKCOption_u64Z short_channel_id_conv = *(LDKCOption_u64Z*)(short_channel_id_ptr);
66256         short_channel_id_conv = COption_u64Z_clone((LDKCOption_u64Z*)untag_ptr(short_channel_id));
66257         LDKEvent *ret_copy = MALLOC(sizeof(LDKEvent), "LDKEvent");
66258         *ret_copy = Event_probe_failed(payment_id_ref, payment_hash_ref, path_conv, short_channel_id_conv);
66259         uint64_t ret_ref = tag_ptr(ret_copy, true);
66260         return ret_ref;
66261 }
66262
66263 uint64_t  __attribute__((export_name("TS_Event_pending_htlcs_forwardable"))) TS_Event_pending_htlcs_forwardable(int64_t time_forwardable) {
66264         LDKEvent *ret_copy = MALLOC(sizeof(LDKEvent), "LDKEvent");
66265         *ret_copy = Event_pending_htlcs_forwardable(time_forwardable);
66266         uint64_t ret_ref = tag_ptr(ret_copy, true);
66267         return ret_ref;
66268 }
66269
66270 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) {
66271         LDKThirtyTwoBytes intercept_id_ref;
66272         CHECK(intercept_id->arr_len == 32);
66273         memcpy(intercept_id_ref.data, intercept_id->elems, 32); FREE(intercept_id);
66274         LDKThirtyTwoBytes payment_hash_ref;
66275         CHECK(payment_hash->arr_len == 32);
66276         memcpy(payment_hash_ref.data, payment_hash->elems, 32); FREE(payment_hash);
66277         LDKEvent *ret_copy = MALLOC(sizeof(LDKEvent), "LDKEvent");
66278         *ret_copy = Event_htlcintercepted(intercept_id_ref, requested_next_hop_scid, payment_hash_ref, inbound_amount_msat, expected_outbound_amount_msat);
66279         uint64_t ret_ref = tag_ptr(ret_copy, true);
66280         return ret_ref;
66281 }
66282
66283 uint64_t  __attribute__((export_name("TS_Event_spendable_outputs"))) TS_Event_spendable_outputs(uint64_tArray outputs, uint64_t channel_id) {
66284         LDKCVec_SpendableOutputDescriptorZ outputs_constr;
66285         outputs_constr.datalen = outputs->arr_len;
66286         if (outputs_constr.datalen > 0)
66287                 outputs_constr.data = MALLOC(outputs_constr.datalen * sizeof(LDKSpendableOutputDescriptor), "LDKCVec_SpendableOutputDescriptorZ Elements");
66288         else
66289                 outputs_constr.data = NULL;
66290         uint64_t* outputs_vals = outputs->elems;
66291         for (size_t b = 0; b < outputs_constr.datalen; b++) {
66292                 uint64_t outputs_conv_27 = outputs_vals[b];
66293                 void* outputs_conv_27_ptr = untag_ptr(outputs_conv_27);
66294                 CHECK_ACCESS(outputs_conv_27_ptr);
66295                 LDKSpendableOutputDescriptor outputs_conv_27_conv = *(LDKSpendableOutputDescriptor*)(outputs_conv_27_ptr);
66296                 outputs_conv_27_conv = SpendableOutputDescriptor_clone((LDKSpendableOutputDescriptor*)untag_ptr(outputs_conv_27));
66297                 outputs_constr.data[b] = outputs_conv_27_conv;
66298         }
66299         FREE(outputs);
66300         void* channel_id_ptr = untag_ptr(channel_id);
66301         CHECK_ACCESS(channel_id_ptr);
66302         LDKCOption_ThirtyTwoBytesZ channel_id_conv = *(LDKCOption_ThirtyTwoBytesZ*)(channel_id_ptr);
66303         channel_id_conv = COption_ThirtyTwoBytesZ_clone((LDKCOption_ThirtyTwoBytesZ*)untag_ptr(channel_id));
66304         LDKEvent *ret_copy = MALLOC(sizeof(LDKEvent), "LDKEvent");
66305         *ret_copy = Event_spendable_outputs(outputs_constr, channel_id_conv);
66306         uint64_t ret_ref = tag_ptr(ret_copy, true);
66307         return ret_ref;
66308 }
66309
66310 uint64_t  __attribute__((export_name("TS_Event_payment_forwarded"))) TS_Event_payment_forwarded(uint64_t prev_channel_id, uint64_t next_channel_id, uint64_t fee_earned_msat, jboolean claim_from_onchain_tx, uint64_t outbound_amount_forwarded_msat) {
66311         void* prev_channel_id_ptr = untag_ptr(prev_channel_id);
66312         CHECK_ACCESS(prev_channel_id_ptr);
66313         LDKCOption_ThirtyTwoBytesZ prev_channel_id_conv = *(LDKCOption_ThirtyTwoBytesZ*)(prev_channel_id_ptr);
66314         prev_channel_id_conv = COption_ThirtyTwoBytesZ_clone((LDKCOption_ThirtyTwoBytesZ*)untag_ptr(prev_channel_id));
66315         void* next_channel_id_ptr = untag_ptr(next_channel_id);
66316         CHECK_ACCESS(next_channel_id_ptr);
66317         LDKCOption_ThirtyTwoBytesZ next_channel_id_conv = *(LDKCOption_ThirtyTwoBytesZ*)(next_channel_id_ptr);
66318         next_channel_id_conv = COption_ThirtyTwoBytesZ_clone((LDKCOption_ThirtyTwoBytesZ*)untag_ptr(next_channel_id));
66319         void* fee_earned_msat_ptr = untag_ptr(fee_earned_msat);
66320         CHECK_ACCESS(fee_earned_msat_ptr);
66321         LDKCOption_u64Z fee_earned_msat_conv = *(LDKCOption_u64Z*)(fee_earned_msat_ptr);
66322         fee_earned_msat_conv = COption_u64Z_clone((LDKCOption_u64Z*)untag_ptr(fee_earned_msat));
66323         void* outbound_amount_forwarded_msat_ptr = untag_ptr(outbound_amount_forwarded_msat);
66324         CHECK_ACCESS(outbound_amount_forwarded_msat_ptr);
66325         LDKCOption_u64Z outbound_amount_forwarded_msat_conv = *(LDKCOption_u64Z*)(outbound_amount_forwarded_msat_ptr);
66326         outbound_amount_forwarded_msat_conv = COption_u64Z_clone((LDKCOption_u64Z*)untag_ptr(outbound_amount_forwarded_msat));
66327         LDKEvent *ret_copy = MALLOC(sizeof(LDKEvent), "LDKEvent");
66328         *ret_copy = Event_payment_forwarded(prev_channel_id_conv, next_channel_id_conv, fee_earned_msat_conv, claim_from_onchain_tx, outbound_amount_forwarded_msat_conv);
66329         uint64_t ret_ref = tag_ptr(ret_copy, true);
66330         return ret_ref;
66331 }
66332
66333 uint64_t  __attribute__((export_name("TS_Event_channel_pending"))) TS_Event_channel_pending(int8_tArray channel_id, int8_tArray user_channel_id, uint64_t former_temporary_channel_id, int8_tArray counterparty_node_id, uint64_t funding_txo) {
66334         LDKThirtyTwoBytes channel_id_ref;
66335         CHECK(channel_id->arr_len == 32);
66336         memcpy(channel_id_ref.data, channel_id->elems, 32); FREE(channel_id);
66337         LDKU128 user_channel_id_ref;
66338         CHECK(user_channel_id->arr_len == 16);
66339         memcpy(user_channel_id_ref.le_bytes, user_channel_id->elems, 16); FREE(user_channel_id);
66340         void* former_temporary_channel_id_ptr = untag_ptr(former_temporary_channel_id);
66341         CHECK_ACCESS(former_temporary_channel_id_ptr);
66342         LDKCOption_ThirtyTwoBytesZ former_temporary_channel_id_conv = *(LDKCOption_ThirtyTwoBytesZ*)(former_temporary_channel_id_ptr);
66343         former_temporary_channel_id_conv = COption_ThirtyTwoBytesZ_clone((LDKCOption_ThirtyTwoBytesZ*)untag_ptr(former_temporary_channel_id));
66344         LDKPublicKey counterparty_node_id_ref;
66345         CHECK(counterparty_node_id->arr_len == 33);
66346         memcpy(counterparty_node_id_ref.compressed_form, counterparty_node_id->elems, 33); FREE(counterparty_node_id);
66347         LDKOutPoint funding_txo_conv;
66348         funding_txo_conv.inner = untag_ptr(funding_txo);
66349         funding_txo_conv.is_owned = ptr_is_owned(funding_txo);
66350         CHECK_INNER_FIELD_ACCESS_OR_NULL(funding_txo_conv);
66351         funding_txo_conv = OutPoint_clone(&funding_txo_conv);
66352         LDKEvent *ret_copy = MALLOC(sizeof(LDKEvent), "LDKEvent");
66353         *ret_copy = Event_channel_pending(channel_id_ref, user_channel_id_ref, former_temporary_channel_id_conv, counterparty_node_id_ref, funding_txo_conv);
66354         uint64_t ret_ref = tag_ptr(ret_copy, true);
66355         return ret_ref;
66356 }
66357
66358 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) {
66359         LDKThirtyTwoBytes channel_id_ref;
66360         CHECK(channel_id->arr_len == 32);
66361         memcpy(channel_id_ref.data, channel_id->elems, 32); FREE(channel_id);
66362         LDKU128 user_channel_id_ref;
66363         CHECK(user_channel_id->arr_len == 16);
66364         memcpy(user_channel_id_ref.le_bytes, user_channel_id->elems, 16); FREE(user_channel_id);
66365         LDKPublicKey counterparty_node_id_ref;
66366         CHECK(counterparty_node_id->arr_len == 33);
66367         memcpy(counterparty_node_id_ref.compressed_form, counterparty_node_id->elems, 33); FREE(counterparty_node_id);
66368         LDKChannelTypeFeatures channel_type_conv;
66369         channel_type_conv.inner = untag_ptr(channel_type);
66370         channel_type_conv.is_owned = ptr_is_owned(channel_type);
66371         CHECK_INNER_FIELD_ACCESS_OR_NULL(channel_type_conv);
66372         channel_type_conv = ChannelTypeFeatures_clone(&channel_type_conv);
66373         LDKEvent *ret_copy = MALLOC(sizeof(LDKEvent), "LDKEvent");
66374         *ret_copy = Event_channel_ready(channel_id_ref, user_channel_id_ref, counterparty_node_id_ref, channel_type_conv);
66375         uint64_t ret_ref = tag_ptr(ret_copy, true);
66376         return ret_ref;
66377 }
66378
66379 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, int8_tArray counterparty_node_id, uint64_t channel_capacity_sats) {
66380         LDKThirtyTwoBytes channel_id_ref;
66381         CHECK(channel_id->arr_len == 32);
66382         memcpy(channel_id_ref.data, channel_id->elems, 32); FREE(channel_id);
66383         LDKU128 user_channel_id_ref;
66384         CHECK(user_channel_id->arr_len == 16);
66385         memcpy(user_channel_id_ref.le_bytes, user_channel_id->elems, 16); FREE(user_channel_id);
66386         void* reason_ptr = untag_ptr(reason);
66387         CHECK_ACCESS(reason_ptr);
66388         LDKClosureReason reason_conv = *(LDKClosureReason*)(reason_ptr);
66389         reason_conv = ClosureReason_clone((LDKClosureReason*)untag_ptr(reason));
66390         LDKPublicKey counterparty_node_id_ref;
66391         CHECK(counterparty_node_id->arr_len == 33);
66392         memcpy(counterparty_node_id_ref.compressed_form, counterparty_node_id->elems, 33); FREE(counterparty_node_id);
66393         void* channel_capacity_sats_ptr = untag_ptr(channel_capacity_sats);
66394         CHECK_ACCESS(channel_capacity_sats_ptr);
66395         LDKCOption_u64Z channel_capacity_sats_conv = *(LDKCOption_u64Z*)(channel_capacity_sats_ptr);
66396         channel_capacity_sats_conv = COption_u64Z_clone((LDKCOption_u64Z*)untag_ptr(channel_capacity_sats));
66397         LDKEvent *ret_copy = MALLOC(sizeof(LDKEvent), "LDKEvent");
66398         *ret_copy = Event_channel_closed(channel_id_ref, user_channel_id_ref, reason_conv, counterparty_node_id_ref, channel_capacity_sats_conv);
66399         uint64_t ret_ref = tag_ptr(ret_copy, true);
66400         return ret_ref;
66401 }
66402
66403 uint64_t  __attribute__((export_name("TS_Event_discard_funding"))) TS_Event_discard_funding(int8_tArray channel_id, int8_tArray transaction) {
66404         LDKThirtyTwoBytes channel_id_ref;
66405         CHECK(channel_id->arr_len == 32);
66406         memcpy(channel_id_ref.data, channel_id->elems, 32); FREE(channel_id);
66407         LDKTransaction transaction_ref;
66408         transaction_ref.datalen = transaction->arr_len;
66409         transaction_ref.data = MALLOC(transaction_ref.datalen, "LDKTransaction Bytes");
66410         memcpy(transaction_ref.data, transaction->elems, transaction_ref.datalen); FREE(transaction);
66411         transaction_ref.data_is_owned = true;
66412         LDKEvent *ret_copy = MALLOC(sizeof(LDKEvent), "LDKEvent");
66413         *ret_copy = Event_discard_funding(channel_id_ref, transaction_ref);
66414         uint64_t ret_ref = tag_ptr(ret_copy, true);
66415         return ret_ref;
66416 }
66417
66418 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) {
66419         LDKThirtyTwoBytes temporary_channel_id_ref;
66420         CHECK(temporary_channel_id->arr_len == 32);
66421         memcpy(temporary_channel_id_ref.data, temporary_channel_id->elems, 32); FREE(temporary_channel_id);
66422         LDKPublicKey counterparty_node_id_ref;
66423         CHECK(counterparty_node_id->arr_len == 33);
66424         memcpy(counterparty_node_id_ref.compressed_form, counterparty_node_id->elems, 33); FREE(counterparty_node_id);
66425         LDKChannelTypeFeatures channel_type_conv;
66426         channel_type_conv.inner = untag_ptr(channel_type);
66427         channel_type_conv.is_owned = ptr_is_owned(channel_type);
66428         CHECK_INNER_FIELD_ACCESS_OR_NULL(channel_type_conv);
66429         channel_type_conv = ChannelTypeFeatures_clone(&channel_type_conv);
66430         LDKEvent *ret_copy = MALLOC(sizeof(LDKEvent), "LDKEvent");
66431         *ret_copy = Event_open_channel_request(temporary_channel_id_ref, counterparty_node_id_ref, funding_satoshis, push_msat, channel_type_conv);
66432         uint64_t ret_ref = tag_ptr(ret_copy, true);
66433         return ret_ref;
66434 }
66435
66436 uint64_t  __attribute__((export_name("TS_Event_htlchandling_failed"))) TS_Event_htlchandling_failed(int8_tArray prev_channel_id, uint64_t failed_next_destination) {
66437         LDKThirtyTwoBytes prev_channel_id_ref;
66438         CHECK(prev_channel_id->arr_len == 32);
66439         memcpy(prev_channel_id_ref.data, prev_channel_id->elems, 32); FREE(prev_channel_id);
66440         void* failed_next_destination_ptr = untag_ptr(failed_next_destination);
66441         CHECK_ACCESS(failed_next_destination_ptr);
66442         LDKHTLCDestination failed_next_destination_conv = *(LDKHTLCDestination*)(failed_next_destination_ptr);
66443         failed_next_destination_conv = HTLCDestination_clone((LDKHTLCDestination*)untag_ptr(failed_next_destination));
66444         LDKEvent *ret_copy = MALLOC(sizeof(LDKEvent), "LDKEvent");
66445         *ret_copy = Event_htlchandling_failed(prev_channel_id_ref, failed_next_destination_conv);
66446         uint64_t ret_ref = tag_ptr(ret_copy, true);
66447         return ret_ref;
66448 }
66449
66450 uint64_t  __attribute__((export_name("TS_Event_bump_transaction"))) TS_Event_bump_transaction(uint64_t a) {
66451         void* a_ptr = untag_ptr(a);
66452         CHECK_ACCESS(a_ptr);
66453         LDKBumpTransactionEvent a_conv = *(LDKBumpTransactionEvent*)(a_ptr);
66454         a_conv = BumpTransactionEvent_clone((LDKBumpTransactionEvent*)untag_ptr(a));
66455         LDKEvent *ret_copy = MALLOC(sizeof(LDKEvent), "LDKEvent");
66456         *ret_copy = Event_bump_transaction(a_conv);
66457         uint64_t ret_ref = tag_ptr(ret_copy, true);
66458         return ret_ref;
66459 }
66460
66461 jboolean  __attribute__((export_name("TS_Event_eq"))) TS_Event_eq(uint64_t a, uint64_t b) {
66462         LDKEvent* a_conv = (LDKEvent*)untag_ptr(a);
66463         LDKEvent* b_conv = (LDKEvent*)untag_ptr(b);
66464         jboolean ret_conv = Event_eq(a_conv, b_conv);
66465         return ret_conv;
66466 }
66467
66468 int8_tArray  __attribute__((export_name("TS_Event_write"))) TS_Event_write(uint64_t obj) {
66469         LDKEvent* obj_conv = (LDKEvent*)untag_ptr(obj);
66470         LDKCVec_u8Z ret_var = Event_write(obj_conv);
66471         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
66472         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
66473         CVec_u8Z_free(ret_var);
66474         return ret_arr;
66475 }
66476
66477 uint64_t  __attribute__((export_name("TS_Event_read"))) TS_Event_read(int8_tArray ser) {
66478         LDKu8slice ser_ref;
66479         ser_ref.datalen = ser->arr_len;
66480         ser_ref.data = ser->elems;
66481         LDKCResult_COption_EventZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_COption_EventZDecodeErrorZ), "LDKCResult_COption_EventZDecodeErrorZ");
66482         *ret_conv = Event_read(ser_ref);
66483         FREE(ser);
66484         return tag_ptr(ret_conv, true);
66485 }
66486
66487 void  __attribute__((export_name("TS_MessageSendEvent_free"))) TS_MessageSendEvent_free(uint64_t this_ptr) {
66488         if (!ptr_is_owned(this_ptr)) return;
66489         void* this_ptr_ptr = untag_ptr(this_ptr);
66490         CHECK_ACCESS(this_ptr_ptr);
66491         LDKMessageSendEvent this_ptr_conv = *(LDKMessageSendEvent*)(this_ptr_ptr);
66492         FREE(untag_ptr(this_ptr));
66493         MessageSendEvent_free(this_ptr_conv);
66494 }
66495
66496 static inline uint64_t MessageSendEvent_clone_ptr(LDKMessageSendEvent *NONNULL_PTR arg) {
66497         LDKMessageSendEvent *ret_copy = MALLOC(sizeof(LDKMessageSendEvent), "LDKMessageSendEvent");
66498         *ret_copy = MessageSendEvent_clone(arg);
66499         uint64_t ret_ref = tag_ptr(ret_copy, true);
66500         return ret_ref;
66501 }
66502 int64_t  __attribute__((export_name("TS_MessageSendEvent_clone_ptr"))) TS_MessageSendEvent_clone_ptr(uint64_t arg) {
66503         LDKMessageSendEvent* arg_conv = (LDKMessageSendEvent*)untag_ptr(arg);
66504         int64_t ret_conv = MessageSendEvent_clone_ptr(arg_conv);
66505         return ret_conv;
66506 }
66507
66508 uint64_t  __attribute__((export_name("TS_MessageSendEvent_clone"))) TS_MessageSendEvent_clone(uint64_t orig) {
66509         LDKMessageSendEvent* orig_conv = (LDKMessageSendEvent*)untag_ptr(orig);
66510         LDKMessageSendEvent *ret_copy = MALLOC(sizeof(LDKMessageSendEvent), "LDKMessageSendEvent");
66511         *ret_copy = MessageSendEvent_clone(orig_conv);
66512         uint64_t ret_ref = tag_ptr(ret_copy, true);
66513         return ret_ref;
66514 }
66515
66516 uint64_t  __attribute__((export_name("TS_MessageSendEvent_send_accept_channel"))) TS_MessageSendEvent_send_accept_channel(int8_tArray node_id, uint64_t msg) {
66517         LDKPublicKey node_id_ref;
66518         CHECK(node_id->arr_len == 33);
66519         memcpy(node_id_ref.compressed_form, node_id->elems, 33); FREE(node_id);
66520         LDKAcceptChannel msg_conv;
66521         msg_conv.inner = untag_ptr(msg);
66522         msg_conv.is_owned = ptr_is_owned(msg);
66523         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
66524         msg_conv = AcceptChannel_clone(&msg_conv);
66525         LDKMessageSendEvent *ret_copy = MALLOC(sizeof(LDKMessageSendEvent), "LDKMessageSendEvent");
66526         *ret_copy = MessageSendEvent_send_accept_channel(node_id_ref, msg_conv);
66527         uint64_t ret_ref = tag_ptr(ret_copy, true);
66528         return ret_ref;
66529 }
66530
66531 uint64_t  __attribute__((export_name("TS_MessageSendEvent_send_accept_channel_v2"))) TS_MessageSendEvent_send_accept_channel_v2(int8_tArray node_id, uint64_t msg) {
66532         LDKPublicKey node_id_ref;
66533         CHECK(node_id->arr_len == 33);
66534         memcpy(node_id_ref.compressed_form, node_id->elems, 33); FREE(node_id);
66535         LDKAcceptChannelV2 msg_conv;
66536         msg_conv.inner = untag_ptr(msg);
66537         msg_conv.is_owned = ptr_is_owned(msg);
66538         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
66539         msg_conv = AcceptChannelV2_clone(&msg_conv);
66540         LDKMessageSendEvent *ret_copy = MALLOC(sizeof(LDKMessageSendEvent), "LDKMessageSendEvent");
66541         *ret_copy = MessageSendEvent_send_accept_channel_v2(node_id_ref, msg_conv);
66542         uint64_t ret_ref = tag_ptr(ret_copy, true);
66543         return ret_ref;
66544 }
66545
66546 uint64_t  __attribute__((export_name("TS_MessageSendEvent_send_open_channel"))) TS_MessageSendEvent_send_open_channel(int8_tArray node_id, uint64_t msg) {
66547         LDKPublicKey node_id_ref;
66548         CHECK(node_id->arr_len == 33);
66549         memcpy(node_id_ref.compressed_form, node_id->elems, 33); FREE(node_id);
66550         LDKOpenChannel msg_conv;
66551         msg_conv.inner = untag_ptr(msg);
66552         msg_conv.is_owned = ptr_is_owned(msg);
66553         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
66554         msg_conv = OpenChannel_clone(&msg_conv);
66555         LDKMessageSendEvent *ret_copy = MALLOC(sizeof(LDKMessageSendEvent), "LDKMessageSendEvent");
66556         *ret_copy = MessageSendEvent_send_open_channel(node_id_ref, msg_conv);
66557         uint64_t ret_ref = tag_ptr(ret_copy, true);
66558         return ret_ref;
66559 }
66560
66561 uint64_t  __attribute__((export_name("TS_MessageSendEvent_send_open_channel_v2"))) TS_MessageSendEvent_send_open_channel_v2(int8_tArray node_id, uint64_t msg) {
66562         LDKPublicKey node_id_ref;
66563         CHECK(node_id->arr_len == 33);
66564         memcpy(node_id_ref.compressed_form, node_id->elems, 33); FREE(node_id);
66565         LDKOpenChannelV2 msg_conv;
66566         msg_conv.inner = untag_ptr(msg);
66567         msg_conv.is_owned = ptr_is_owned(msg);
66568         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
66569         msg_conv = OpenChannelV2_clone(&msg_conv);
66570         LDKMessageSendEvent *ret_copy = MALLOC(sizeof(LDKMessageSendEvent), "LDKMessageSendEvent");
66571         *ret_copy = MessageSendEvent_send_open_channel_v2(node_id_ref, msg_conv);
66572         uint64_t ret_ref = tag_ptr(ret_copy, true);
66573         return ret_ref;
66574 }
66575
66576 uint64_t  __attribute__((export_name("TS_MessageSendEvent_send_funding_created"))) TS_MessageSendEvent_send_funding_created(int8_tArray node_id, uint64_t msg) {
66577         LDKPublicKey node_id_ref;
66578         CHECK(node_id->arr_len == 33);
66579         memcpy(node_id_ref.compressed_form, node_id->elems, 33); FREE(node_id);
66580         LDKFundingCreated msg_conv;
66581         msg_conv.inner = untag_ptr(msg);
66582         msg_conv.is_owned = ptr_is_owned(msg);
66583         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
66584         msg_conv = FundingCreated_clone(&msg_conv);
66585         LDKMessageSendEvent *ret_copy = MALLOC(sizeof(LDKMessageSendEvent), "LDKMessageSendEvent");
66586         *ret_copy = MessageSendEvent_send_funding_created(node_id_ref, msg_conv);
66587         uint64_t ret_ref = tag_ptr(ret_copy, true);
66588         return ret_ref;
66589 }
66590
66591 uint64_t  __attribute__((export_name("TS_MessageSendEvent_send_funding_signed"))) TS_MessageSendEvent_send_funding_signed(int8_tArray node_id, uint64_t msg) {
66592         LDKPublicKey node_id_ref;
66593         CHECK(node_id->arr_len == 33);
66594         memcpy(node_id_ref.compressed_form, node_id->elems, 33); FREE(node_id);
66595         LDKFundingSigned msg_conv;
66596         msg_conv.inner = untag_ptr(msg);
66597         msg_conv.is_owned = ptr_is_owned(msg);
66598         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
66599         msg_conv = FundingSigned_clone(&msg_conv);
66600         LDKMessageSendEvent *ret_copy = MALLOC(sizeof(LDKMessageSendEvent), "LDKMessageSendEvent");
66601         *ret_copy = MessageSendEvent_send_funding_signed(node_id_ref, msg_conv);
66602         uint64_t ret_ref = tag_ptr(ret_copy, true);
66603         return ret_ref;
66604 }
66605
66606 uint64_t  __attribute__((export_name("TS_MessageSendEvent_send_tx_add_input"))) TS_MessageSendEvent_send_tx_add_input(int8_tArray node_id, uint64_t msg) {
66607         LDKPublicKey node_id_ref;
66608         CHECK(node_id->arr_len == 33);
66609         memcpy(node_id_ref.compressed_form, node_id->elems, 33); FREE(node_id);
66610         LDKTxAddInput msg_conv;
66611         msg_conv.inner = untag_ptr(msg);
66612         msg_conv.is_owned = ptr_is_owned(msg);
66613         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
66614         msg_conv = TxAddInput_clone(&msg_conv);
66615         LDKMessageSendEvent *ret_copy = MALLOC(sizeof(LDKMessageSendEvent), "LDKMessageSendEvent");
66616         *ret_copy = MessageSendEvent_send_tx_add_input(node_id_ref, msg_conv);
66617         uint64_t ret_ref = tag_ptr(ret_copy, true);
66618         return ret_ref;
66619 }
66620
66621 uint64_t  __attribute__((export_name("TS_MessageSendEvent_send_tx_add_output"))) TS_MessageSendEvent_send_tx_add_output(int8_tArray node_id, uint64_t msg) {
66622         LDKPublicKey node_id_ref;
66623         CHECK(node_id->arr_len == 33);
66624         memcpy(node_id_ref.compressed_form, node_id->elems, 33); FREE(node_id);
66625         LDKTxAddOutput msg_conv;
66626         msg_conv.inner = untag_ptr(msg);
66627         msg_conv.is_owned = ptr_is_owned(msg);
66628         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
66629         msg_conv = TxAddOutput_clone(&msg_conv);
66630         LDKMessageSendEvent *ret_copy = MALLOC(sizeof(LDKMessageSendEvent), "LDKMessageSendEvent");
66631         *ret_copy = MessageSendEvent_send_tx_add_output(node_id_ref, msg_conv);
66632         uint64_t ret_ref = tag_ptr(ret_copy, true);
66633         return ret_ref;
66634 }
66635
66636 uint64_t  __attribute__((export_name("TS_MessageSendEvent_send_tx_remove_input"))) TS_MessageSendEvent_send_tx_remove_input(int8_tArray node_id, uint64_t msg) {
66637         LDKPublicKey node_id_ref;
66638         CHECK(node_id->arr_len == 33);
66639         memcpy(node_id_ref.compressed_form, node_id->elems, 33); FREE(node_id);
66640         LDKTxRemoveInput msg_conv;
66641         msg_conv.inner = untag_ptr(msg);
66642         msg_conv.is_owned = ptr_is_owned(msg);
66643         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
66644         msg_conv = TxRemoveInput_clone(&msg_conv);
66645         LDKMessageSendEvent *ret_copy = MALLOC(sizeof(LDKMessageSendEvent), "LDKMessageSendEvent");
66646         *ret_copy = MessageSendEvent_send_tx_remove_input(node_id_ref, msg_conv);
66647         uint64_t ret_ref = tag_ptr(ret_copy, true);
66648         return ret_ref;
66649 }
66650
66651 uint64_t  __attribute__((export_name("TS_MessageSendEvent_send_tx_remove_output"))) TS_MessageSendEvent_send_tx_remove_output(int8_tArray node_id, uint64_t msg) {
66652         LDKPublicKey node_id_ref;
66653         CHECK(node_id->arr_len == 33);
66654         memcpy(node_id_ref.compressed_form, node_id->elems, 33); FREE(node_id);
66655         LDKTxRemoveOutput msg_conv;
66656         msg_conv.inner = untag_ptr(msg);
66657         msg_conv.is_owned = ptr_is_owned(msg);
66658         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
66659         msg_conv = TxRemoveOutput_clone(&msg_conv);
66660         LDKMessageSendEvent *ret_copy = MALLOC(sizeof(LDKMessageSendEvent), "LDKMessageSendEvent");
66661         *ret_copy = MessageSendEvent_send_tx_remove_output(node_id_ref, msg_conv);
66662         uint64_t ret_ref = tag_ptr(ret_copy, true);
66663         return ret_ref;
66664 }
66665
66666 uint64_t  __attribute__((export_name("TS_MessageSendEvent_send_tx_complete"))) TS_MessageSendEvent_send_tx_complete(int8_tArray node_id, uint64_t msg) {
66667         LDKPublicKey node_id_ref;
66668         CHECK(node_id->arr_len == 33);
66669         memcpy(node_id_ref.compressed_form, node_id->elems, 33); FREE(node_id);
66670         LDKTxComplete msg_conv;
66671         msg_conv.inner = untag_ptr(msg);
66672         msg_conv.is_owned = ptr_is_owned(msg);
66673         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
66674         msg_conv = TxComplete_clone(&msg_conv);
66675         LDKMessageSendEvent *ret_copy = MALLOC(sizeof(LDKMessageSendEvent), "LDKMessageSendEvent");
66676         *ret_copy = MessageSendEvent_send_tx_complete(node_id_ref, msg_conv);
66677         uint64_t ret_ref = tag_ptr(ret_copy, true);
66678         return ret_ref;
66679 }
66680
66681 uint64_t  __attribute__((export_name("TS_MessageSendEvent_send_tx_signatures"))) TS_MessageSendEvent_send_tx_signatures(int8_tArray node_id, uint64_t msg) {
66682         LDKPublicKey node_id_ref;
66683         CHECK(node_id->arr_len == 33);
66684         memcpy(node_id_ref.compressed_form, node_id->elems, 33); FREE(node_id);
66685         LDKTxSignatures msg_conv;
66686         msg_conv.inner = untag_ptr(msg);
66687         msg_conv.is_owned = ptr_is_owned(msg);
66688         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
66689         msg_conv = TxSignatures_clone(&msg_conv);
66690         LDKMessageSendEvent *ret_copy = MALLOC(sizeof(LDKMessageSendEvent), "LDKMessageSendEvent");
66691         *ret_copy = MessageSendEvent_send_tx_signatures(node_id_ref, msg_conv);
66692         uint64_t ret_ref = tag_ptr(ret_copy, true);
66693         return ret_ref;
66694 }
66695
66696 uint64_t  __attribute__((export_name("TS_MessageSendEvent_send_tx_init_rbf"))) TS_MessageSendEvent_send_tx_init_rbf(int8_tArray node_id, uint64_t msg) {
66697         LDKPublicKey node_id_ref;
66698         CHECK(node_id->arr_len == 33);
66699         memcpy(node_id_ref.compressed_form, node_id->elems, 33); FREE(node_id);
66700         LDKTxInitRbf msg_conv;
66701         msg_conv.inner = untag_ptr(msg);
66702         msg_conv.is_owned = ptr_is_owned(msg);
66703         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
66704         msg_conv = TxInitRbf_clone(&msg_conv);
66705         LDKMessageSendEvent *ret_copy = MALLOC(sizeof(LDKMessageSendEvent), "LDKMessageSendEvent");
66706         *ret_copy = MessageSendEvent_send_tx_init_rbf(node_id_ref, msg_conv);
66707         uint64_t ret_ref = tag_ptr(ret_copy, true);
66708         return ret_ref;
66709 }
66710
66711 uint64_t  __attribute__((export_name("TS_MessageSendEvent_send_tx_ack_rbf"))) TS_MessageSendEvent_send_tx_ack_rbf(int8_tArray node_id, uint64_t msg) {
66712         LDKPublicKey node_id_ref;
66713         CHECK(node_id->arr_len == 33);
66714         memcpy(node_id_ref.compressed_form, node_id->elems, 33); FREE(node_id);
66715         LDKTxAckRbf msg_conv;
66716         msg_conv.inner = untag_ptr(msg);
66717         msg_conv.is_owned = ptr_is_owned(msg);
66718         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
66719         msg_conv = TxAckRbf_clone(&msg_conv);
66720         LDKMessageSendEvent *ret_copy = MALLOC(sizeof(LDKMessageSendEvent), "LDKMessageSendEvent");
66721         *ret_copy = MessageSendEvent_send_tx_ack_rbf(node_id_ref, msg_conv);
66722         uint64_t ret_ref = tag_ptr(ret_copy, true);
66723         return ret_ref;
66724 }
66725
66726 uint64_t  __attribute__((export_name("TS_MessageSendEvent_send_tx_abort"))) TS_MessageSendEvent_send_tx_abort(int8_tArray node_id, uint64_t msg) {
66727         LDKPublicKey node_id_ref;
66728         CHECK(node_id->arr_len == 33);
66729         memcpy(node_id_ref.compressed_form, node_id->elems, 33); FREE(node_id);
66730         LDKTxAbort msg_conv;
66731         msg_conv.inner = untag_ptr(msg);
66732         msg_conv.is_owned = ptr_is_owned(msg);
66733         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
66734         msg_conv = TxAbort_clone(&msg_conv);
66735         LDKMessageSendEvent *ret_copy = MALLOC(sizeof(LDKMessageSendEvent), "LDKMessageSendEvent");
66736         *ret_copy = MessageSendEvent_send_tx_abort(node_id_ref, msg_conv);
66737         uint64_t ret_ref = tag_ptr(ret_copy, true);
66738         return ret_ref;
66739 }
66740
66741 uint64_t  __attribute__((export_name("TS_MessageSendEvent_send_channel_ready"))) TS_MessageSendEvent_send_channel_ready(int8_tArray node_id, uint64_t msg) {
66742         LDKPublicKey node_id_ref;
66743         CHECK(node_id->arr_len == 33);
66744         memcpy(node_id_ref.compressed_form, node_id->elems, 33); FREE(node_id);
66745         LDKChannelReady msg_conv;
66746         msg_conv.inner = untag_ptr(msg);
66747         msg_conv.is_owned = ptr_is_owned(msg);
66748         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
66749         msg_conv = ChannelReady_clone(&msg_conv);
66750         LDKMessageSendEvent *ret_copy = MALLOC(sizeof(LDKMessageSendEvent), "LDKMessageSendEvent");
66751         *ret_copy = MessageSendEvent_send_channel_ready(node_id_ref, msg_conv);
66752         uint64_t ret_ref = tag_ptr(ret_copy, true);
66753         return ret_ref;
66754 }
66755
66756 uint64_t  __attribute__((export_name("TS_MessageSendEvent_send_announcement_signatures"))) TS_MessageSendEvent_send_announcement_signatures(int8_tArray node_id, uint64_t msg) {
66757         LDKPublicKey node_id_ref;
66758         CHECK(node_id->arr_len == 33);
66759         memcpy(node_id_ref.compressed_form, node_id->elems, 33); FREE(node_id);
66760         LDKAnnouncementSignatures msg_conv;
66761         msg_conv.inner = untag_ptr(msg);
66762         msg_conv.is_owned = ptr_is_owned(msg);
66763         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
66764         msg_conv = AnnouncementSignatures_clone(&msg_conv);
66765         LDKMessageSendEvent *ret_copy = MALLOC(sizeof(LDKMessageSendEvent), "LDKMessageSendEvent");
66766         *ret_copy = MessageSendEvent_send_announcement_signatures(node_id_ref, msg_conv);
66767         uint64_t ret_ref = tag_ptr(ret_copy, true);
66768         return ret_ref;
66769 }
66770
66771 uint64_t  __attribute__((export_name("TS_MessageSendEvent_update_htlcs"))) TS_MessageSendEvent_update_htlcs(int8_tArray node_id, uint64_t updates) {
66772         LDKPublicKey node_id_ref;
66773         CHECK(node_id->arr_len == 33);
66774         memcpy(node_id_ref.compressed_form, node_id->elems, 33); FREE(node_id);
66775         LDKCommitmentUpdate updates_conv;
66776         updates_conv.inner = untag_ptr(updates);
66777         updates_conv.is_owned = ptr_is_owned(updates);
66778         CHECK_INNER_FIELD_ACCESS_OR_NULL(updates_conv);
66779         updates_conv = CommitmentUpdate_clone(&updates_conv);
66780         LDKMessageSendEvent *ret_copy = MALLOC(sizeof(LDKMessageSendEvent), "LDKMessageSendEvent");
66781         *ret_copy = MessageSendEvent_update_htlcs(node_id_ref, updates_conv);
66782         uint64_t ret_ref = tag_ptr(ret_copy, true);
66783         return ret_ref;
66784 }
66785
66786 uint64_t  __attribute__((export_name("TS_MessageSendEvent_send_revoke_and_ack"))) TS_MessageSendEvent_send_revoke_and_ack(int8_tArray node_id, uint64_t msg) {
66787         LDKPublicKey node_id_ref;
66788         CHECK(node_id->arr_len == 33);
66789         memcpy(node_id_ref.compressed_form, node_id->elems, 33); FREE(node_id);
66790         LDKRevokeAndACK msg_conv;
66791         msg_conv.inner = untag_ptr(msg);
66792         msg_conv.is_owned = ptr_is_owned(msg);
66793         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
66794         msg_conv = RevokeAndACK_clone(&msg_conv);
66795         LDKMessageSendEvent *ret_copy = MALLOC(sizeof(LDKMessageSendEvent), "LDKMessageSendEvent");
66796         *ret_copy = MessageSendEvent_send_revoke_and_ack(node_id_ref, msg_conv);
66797         uint64_t ret_ref = tag_ptr(ret_copy, true);
66798         return ret_ref;
66799 }
66800
66801 uint64_t  __attribute__((export_name("TS_MessageSendEvent_send_closing_signed"))) TS_MessageSendEvent_send_closing_signed(int8_tArray node_id, uint64_t msg) {
66802         LDKPublicKey node_id_ref;
66803         CHECK(node_id->arr_len == 33);
66804         memcpy(node_id_ref.compressed_form, node_id->elems, 33); FREE(node_id);
66805         LDKClosingSigned msg_conv;
66806         msg_conv.inner = untag_ptr(msg);
66807         msg_conv.is_owned = ptr_is_owned(msg);
66808         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
66809         msg_conv = ClosingSigned_clone(&msg_conv);
66810         LDKMessageSendEvent *ret_copy = MALLOC(sizeof(LDKMessageSendEvent), "LDKMessageSendEvent");
66811         *ret_copy = MessageSendEvent_send_closing_signed(node_id_ref, msg_conv);
66812         uint64_t ret_ref = tag_ptr(ret_copy, true);
66813         return ret_ref;
66814 }
66815
66816 uint64_t  __attribute__((export_name("TS_MessageSendEvent_send_shutdown"))) TS_MessageSendEvent_send_shutdown(int8_tArray node_id, uint64_t msg) {
66817         LDKPublicKey node_id_ref;
66818         CHECK(node_id->arr_len == 33);
66819         memcpy(node_id_ref.compressed_form, node_id->elems, 33); FREE(node_id);
66820         LDKShutdown msg_conv;
66821         msg_conv.inner = untag_ptr(msg);
66822         msg_conv.is_owned = ptr_is_owned(msg);
66823         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
66824         msg_conv = Shutdown_clone(&msg_conv);
66825         LDKMessageSendEvent *ret_copy = MALLOC(sizeof(LDKMessageSendEvent), "LDKMessageSendEvent");
66826         *ret_copy = MessageSendEvent_send_shutdown(node_id_ref, msg_conv);
66827         uint64_t ret_ref = tag_ptr(ret_copy, true);
66828         return ret_ref;
66829 }
66830
66831 uint64_t  __attribute__((export_name("TS_MessageSendEvent_send_channel_reestablish"))) TS_MessageSendEvent_send_channel_reestablish(int8_tArray node_id, uint64_t msg) {
66832         LDKPublicKey node_id_ref;
66833         CHECK(node_id->arr_len == 33);
66834         memcpy(node_id_ref.compressed_form, node_id->elems, 33); FREE(node_id);
66835         LDKChannelReestablish msg_conv;
66836         msg_conv.inner = untag_ptr(msg);
66837         msg_conv.is_owned = ptr_is_owned(msg);
66838         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
66839         msg_conv = ChannelReestablish_clone(&msg_conv);
66840         LDKMessageSendEvent *ret_copy = MALLOC(sizeof(LDKMessageSendEvent), "LDKMessageSendEvent");
66841         *ret_copy = MessageSendEvent_send_channel_reestablish(node_id_ref, msg_conv);
66842         uint64_t ret_ref = tag_ptr(ret_copy, true);
66843         return ret_ref;
66844 }
66845
66846 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) {
66847         LDKPublicKey node_id_ref;
66848         CHECK(node_id->arr_len == 33);
66849         memcpy(node_id_ref.compressed_form, node_id->elems, 33); FREE(node_id);
66850         LDKChannelAnnouncement msg_conv;
66851         msg_conv.inner = untag_ptr(msg);
66852         msg_conv.is_owned = ptr_is_owned(msg);
66853         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
66854         msg_conv = ChannelAnnouncement_clone(&msg_conv);
66855         LDKChannelUpdate update_msg_conv;
66856         update_msg_conv.inner = untag_ptr(update_msg);
66857         update_msg_conv.is_owned = ptr_is_owned(update_msg);
66858         CHECK_INNER_FIELD_ACCESS_OR_NULL(update_msg_conv);
66859         update_msg_conv = ChannelUpdate_clone(&update_msg_conv);
66860         LDKMessageSendEvent *ret_copy = MALLOC(sizeof(LDKMessageSendEvent), "LDKMessageSendEvent");
66861         *ret_copy = MessageSendEvent_send_channel_announcement(node_id_ref, msg_conv, update_msg_conv);
66862         uint64_t ret_ref = tag_ptr(ret_copy, true);
66863         return ret_ref;
66864 }
66865
66866 uint64_t  __attribute__((export_name("TS_MessageSendEvent_broadcast_channel_announcement"))) TS_MessageSendEvent_broadcast_channel_announcement(uint64_t msg, uint64_t update_msg) {
66867         LDKChannelAnnouncement msg_conv;
66868         msg_conv.inner = untag_ptr(msg);
66869         msg_conv.is_owned = ptr_is_owned(msg);
66870         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
66871         msg_conv = ChannelAnnouncement_clone(&msg_conv);
66872         LDKChannelUpdate update_msg_conv;
66873         update_msg_conv.inner = untag_ptr(update_msg);
66874         update_msg_conv.is_owned = ptr_is_owned(update_msg);
66875         CHECK_INNER_FIELD_ACCESS_OR_NULL(update_msg_conv);
66876         update_msg_conv = ChannelUpdate_clone(&update_msg_conv);
66877         LDKMessageSendEvent *ret_copy = MALLOC(sizeof(LDKMessageSendEvent), "LDKMessageSendEvent");
66878         *ret_copy = MessageSendEvent_broadcast_channel_announcement(msg_conv, update_msg_conv);
66879         uint64_t ret_ref = tag_ptr(ret_copy, true);
66880         return ret_ref;
66881 }
66882
66883 uint64_t  __attribute__((export_name("TS_MessageSendEvent_broadcast_channel_update"))) TS_MessageSendEvent_broadcast_channel_update(uint64_t msg) {
66884         LDKChannelUpdate msg_conv;
66885         msg_conv.inner = untag_ptr(msg);
66886         msg_conv.is_owned = ptr_is_owned(msg);
66887         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
66888         msg_conv = ChannelUpdate_clone(&msg_conv);
66889         LDKMessageSendEvent *ret_copy = MALLOC(sizeof(LDKMessageSendEvent), "LDKMessageSendEvent");
66890         *ret_copy = MessageSendEvent_broadcast_channel_update(msg_conv);
66891         uint64_t ret_ref = tag_ptr(ret_copy, true);
66892         return ret_ref;
66893 }
66894
66895 uint64_t  __attribute__((export_name("TS_MessageSendEvent_broadcast_node_announcement"))) TS_MessageSendEvent_broadcast_node_announcement(uint64_t msg) {
66896         LDKNodeAnnouncement msg_conv;
66897         msg_conv.inner = untag_ptr(msg);
66898         msg_conv.is_owned = ptr_is_owned(msg);
66899         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
66900         msg_conv = NodeAnnouncement_clone(&msg_conv);
66901         LDKMessageSendEvent *ret_copy = MALLOC(sizeof(LDKMessageSendEvent), "LDKMessageSendEvent");
66902         *ret_copy = MessageSendEvent_broadcast_node_announcement(msg_conv);
66903         uint64_t ret_ref = tag_ptr(ret_copy, true);
66904         return ret_ref;
66905 }
66906
66907 uint64_t  __attribute__((export_name("TS_MessageSendEvent_send_channel_update"))) TS_MessageSendEvent_send_channel_update(int8_tArray node_id, uint64_t msg) {
66908         LDKPublicKey node_id_ref;
66909         CHECK(node_id->arr_len == 33);
66910         memcpy(node_id_ref.compressed_form, node_id->elems, 33); FREE(node_id);
66911         LDKChannelUpdate msg_conv;
66912         msg_conv.inner = untag_ptr(msg);
66913         msg_conv.is_owned = ptr_is_owned(msg);
66914         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
66915         msg_conv = ChannelUpdate_clone(&msg_conv);
66916         LDKMessageSendEvent *ret_copy = MALLOC(sizeof(LDKMessageSendEvent), "LDKMessageSendEvent");
66917         *ret_copy = MessageSendEvent_send_channel_update(node_id_ref, msg_conv);
66918         uint64_t ret_ref = tag_ptr(ret_copy, true);
66919         return ret_ref;
66920 }
66921
66922 uint64_t  __attribute__((export_name("TS_MessageSendEvent_handle_error"))) TS_MessageSendEvent_handle_error(int8_tArray node_id, uint64_t action) {
66923         LDKPublicKey node_id_ref;
66924         CHECK(node_id->arr_len == 33);
66925         memcpy(node_id_ref.compressed_form, node_id->elems, 33); FREE(node_id);
66926         void* action_ptr = untag_ptr(action);
66927         CHECK_ACCESS(action_ptr);
66928         LDKErrorAction action_conv = *(LDKErrorAction*)(action_ptr);
66929         action_conv = ErrorAction_clone((LDKErrorAction*)untag_ptr(action));
66930         LDKMessageSendEvent *ret_copy = MALLOC(sizeof(LDKMessageSendEvent), "LDKMessageSendEvent");
66931         *ret_copy = MessageSendEvent_handle_error(node_id_ref, action_conv);
66932         uint64_t ret_ref = tag_ptr(ret_copy, true);
66933         return ret_ref;
66934 }
66935
66936 uint64_t  __attribute__((export_name("TS_MessageSendEvent_send_channel_range_query"))) TS_MessageSendEvent_send_channel_range_query(int8_tArray node_id, uint64_t msg) {
66937         LDKPublicKey node_id_ref;
66938         CHECK(node_id->arr_len == 33);
66939         memcpy(node_id_ref.compressed_form, node_id->elems, 33); FREE(node_id);
66940         LDKQueryChannelRange msg_conv;
66941         msg_conv.inner = untag_ptr(msg);
66942         msg_conv.is_owned = ptr_is_owned(msg);
66943         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
66944         msg_conv = QueryChannelRange_clone(&msg_conv);
66945         LDKMessageSendEvent *ret_copy = MALLOC(sizeof(LDKMessageSendEvent), "LDKMessageSendEvent");
66946         *ret_copy = MessageSendEvent_send_channel_range_query(node_id_ref, msg_conv);
66947         uint64_t ret_ref = tag_ptr(ret_copy, true);
66948         return ret_ref;
66949 }
66950
66951 uint64_t  __attribute__((export_name("TS_MessageSendEvent_send_short_ids_query"))) TS_MessageSendEvent_send_short_ids_query(int8_tArray node_id, uint64_t msg) {
66952         LDKPublicKey node_id_ref;
66953         CHECK(node_id->arr_len == 33);
66954         memcpy(node_id_ref.compressed_form, node_id->elems, 33); FREE(node_id);
66955         LDKQueryShortChannelIds msg_conv;
66956         msg_conv.inner = untag_ptr(msg);
66957         msg_conv.is_owned = ptr_is_owned(msg);
66958         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
66959         msg_conv = QueryShortChannelIds_clone(&msg_conv);
66960         LDKMessageSendEvent *ret_copy = MALLOC(sizeof(LDKMessageSendEvent), "LDKMessageSendEvent");
66961         *ret_copy = MessageSendEvent_send_short_ids_query(node_id_ref, msg_conv);
66962         uint64_t ret_ref = tag_ptr(ret_copy, true);
66963         return ret_ref;
66964 }
66965
66966 uint64_t  __attribute__((export_name("TS_MessageSendEvent_send_reply_channel_range"))) TS_MessageSendEvent_send_reply_channel_range(int8_tArray node_id, uint64_t msg) {
66967         LDKPublicKey node_id_ref;
66968         CHECK(node_id->arr_len == 33);
66969         memcpy(node_id_ref.compressed_form, node_id->elems, 33); FREE(node_id);
66970         LDKReplyChannelRange msg_conv;
66971         msg_conv.inner = untag_ptr(msg);
66972         msg_conv.is_owned = ptr_is_owned(msg);
66973         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
66974         msg_conv = ReplyChannelRange_clone(&msg_conv);
66975         LDKMessageSendEvent *ret_copy = MALLOC(sizeof(LDKMessageSendEvent), "LDKMessageSendEvent");
66976         *ret_copy = MessageSendEvent_send_reply_channel_range(node_id_ref, msg_conv);
66977         uint64_t ret_ref = tag_ptr(ret_copy, true);
66978         return ret_ref;
66979 }
66980
66981 uint64_t  __attribute__((export_name("TS_MessageSendEvent_send_gossip_timestamp_filter"))) TS_MessageSendEvent_send_gossip_timestamp_filter(int8_tArray node_id, uint64_t msg) {
66982         LDKPublicKey node_id_ref;
66983         CHECK(node_id->arr_len == 33);
66984         memcpy(node_id_ref.compressed_form, node_id->elems, 33); FREE(node_id);
66985         LDKGossipTimestampFilter msg_conv;
66986         msg_conv.inner = untag_ptr(msg);
66987         msg_conv.is_owned = ptr_is_owned(msg);
66988         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
66989         msg_conv = GossipTimestampFilter_clone(&msg_conv);
66990         LDKMessageSendEvent *ret_copy = MALLOC(sizeof(LDKMessageSendEvent), "LDKMessageSendEvent");
66991         *ret_copy = MessageSendEvent_send_gossip_timestamp_filter(node_id_ref, msg_conv);
66992         uint64_t ret_ref = tag_ptr(ret_copy, true);
66993         return ret_ref;
66994 }
66995
66996 void  __attribute__((export_name("TS_MessageSendEventsProvider_free"))) TS_MessageSendEventsProvider_free(uint64_t this_ptr) {
66997         if (!ptr_is_owned(this_ptr)) return;
66998         void* this_ptr_ptr = untag_ptr(this_ptr);
66999         CHECK_ACCESS(this_ptr_ptr);
67000         LDKMessageSendEventsProvider this_ptr_conv = *(LDKMessageSendEventsProvider*)(this_ptr_ptr);
67001         FREE(untag_ptr(this_ptr));
67002         MessageSendEventsProvider_free(this_ptr_conv);
67003 }
67004
67005 void  __attribute__((export_name("TS_EventsProvider_free"))) TS_EventsProvider_free(uint64_t this_ptr) {
67006         if (!ptr_is_owned(this_ptr)) return;
67007         void* this_ptr_ptr = untag_ptr(this_ptr);
67008         CHECK_ACCESS(this_ptr_ptr);
67009         LDKEventsProvider this_ptr_conv = *(LDKEventsProvider*)(this_ptr_ptr);
67010         FREE(untag_ptr(this_ptr));
67011         EventsProvider_free(this_ptr_conv);
67012 }
67013
67014 void  __attribute__((export_name("TS_EventHandler_free"))) TS_EventHandler_free(uint64_t this_ptr) {
67015         if (!ptr_is_owned(this_ptr)) return;
67016         void* this_ptr_ptr = untag_ptr(this_ptr);
67017         CHECK_ACCESS(this_ptr_ptr);
67018         LDKEventHandler this_ptr_conv = *(LDKEventHandler*)(this_ptr_ptr);
67019         FREE(untag_ptr(this_ptr));
67020         EventHandler_free(this_ptr_conv);
67021 }
67022
67023 void  __attribute__((export_name("TS_AnchorDescriptor_free"))) TS_AnchorDescriptor_free(uint64_t this_obj) {
67024         LDKAnchorDescriptor this_obj_conv;
67025         this_obj_conv.inner = untag_ptr(this_obj);
67026         this_obj_conv.is_owned = ptr_is_owned(this_obj);
67027         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
67028         AnchorDescriptor_free(this_obj_conv);
67029 }
67030
67031 uint64_t  __attribute__((export_name("TS_AnchorDescriptor_get_channel_derivation_parameters"))) TS_AnchorDescriptor_get_channel_derivation_parameters(uint64_t this_ptr) {
67032         LDKAnchorDescriptor this_ptr_conv;
67033         this_ptr_conv.inner = untag_ptr(this_ptr);
67034         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
67035         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
67036         this_ptr_conv.is_owned = false;
67037         LDKChannelDerivationParameters ret_var = AnchorDescriptor_get_channel_derivation_parameters(&this_ptr_conv);
67038         uint64_t ret_ref = 0;
67039         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
67040         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
67041         return ret_ref;
67042 }
67043
67044 void  __attribute__((export_name("TS_AnchorDescriptor_set_channel_derivation_parameters"))) TS_AnchorDescriptor_set_channel_derivation_parameters(uint64_t this_ptr, uint64_t val) {
67045         LDKAnchorDescriptor this_ptr_conv;
67046         this_ptr_conv.inner = untag_ptr(this_ptr);
67047         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
67048         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
67049         this_ptr_conv.is_owned = false;
67050         LDKChannelDerivationParameters val_conv;
67051         val_conv.inner = untag_ptr(val);
67052         val_conv.is_owned = ptr_is_owned(val);
67053         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
67054         val_conv = ChannelDerivationParameters_clone(&val_conv);
67055         AnchorDescriptor_set_channel_derivation_parameters(&this_ptr_conv, val_conv);
67056 }
67057
67058 uint64_t  __attribute__((export_name("TS_AnchorDescriptor_get_outpoint"))) TS_AnchorDescriptor_get_outpoint(uint64_t this_ptr) {
67059         LDKAnchorDescriptor this_ptr_conv;
67060         this_ptr_conv.inner = untag_ptr(this_ptr);
67061         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
67062         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
67063         this_ptr_conv.is_owned = false;
67064         LDKOutPoint ret_var = AnchorDescriptor_get_outpoint(&this_ptr_conv);
67065         uint64_t ret_ref = 0;
67066         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
67067         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
67068         return ret_ref;
67069 }
67070
67071 void  __attribute__((export_name("TS_AnchorDescriptor_set_outpoint"))) TS_AnchorDescriptor_set_outpoint(uint64_t this_ptr, uint64_t val) {
67072         LDKAnchorDescriptor this_ptr_conv;
67073         this_ptr_conv.inner = untag_ptr(this_ptr);
67074         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
67075         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
67076         this_ptr_conv.is_owned = false;
67077         LDKOutPoint val_conv;
67078         val_conv.inner = untag_ptr(val);
67079         val_conv.is_owned = ptr_is_owned(val);
67080         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
67081         val_conv = OutPoint_clone(&val_conv);
67082         AnchorDescriptor_set_outpoint(&this_ptr_conv, val_conv);
67083 }
67084
67085 uint64_t  __attribute__((export_name("TS_AnchorDescriptor_new"))) TS_AnchorDescriptor_new(uint64_t channel_derivation_parameters_arg, uint64_t outpoint_arg) {
67086         LDKChannelDerivationParameters channel_derivation_parameters_arg_conv;
67087         channel_derivation_parameters_arg_conv.inner = untag_ptr(channel_derivation_parameters_arg);
67088         channel_derivation_parameters_arg_conv.is_owned = ptr_is_owned(channel_derivation_parameters_arg);
67089         CHECK_INNER_FIELD_ACCESS_OR_NULL(channel_derivation_parameters_arg_conv);
67090         channel_derivation_parameters_arg_conv = ChannelDerivationParameters_clone(&channel_derivation_parameters_arg_conv);
67091         LDKOutPoint outpoint_arg_conv;
67092         outpoint_arg_conv.inner = untag_ptr(outpoint_arg);
67093         outpoint_arg_conv.is_owned = ptr_is_owned(outpoint_arg);
67094         CHECK_INNER_FIELD_ACCESS_OR_NULL(outpoint_arg_conv);
67095         outpoint_arg_conv = OutPoint_clone(&outpoint_arg_conv);
67096         LDKAnchorDescriptor ret_var = AnchorDescriptor_new(channel_derivation_parameters_arg_conv, outpoint_arg_conv);
67097         uint64_t ret_ref = 0;
67098         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
67099         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
67100         return ret_ref;
67101 }
67102
67103 static inline uint64_t AnchorDescriptor_clone_ptr(LDKAnchorDescriptor *NONNULL_PTR arg) {
67104         LDKAnchorDescriptor ret_var = AnchorDescriptor_clone(arg);
67105         uint64_t ret_ref = 0;
67106         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
67107         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
67108         return ret_ref;
67109 }
67110 int64_t  __attribute__((export_name("TS_AnchorDescriptor_clone_ptr"))) TS_AnchorDescriptor_clone_ptr(uint64_t arg) {
67111         LDKAnchorDescriptor arg_conv;
67112         arg_conv.inner = untag_ptr(arg);
67113         arg_conv.is_owned = ptr_is_owned(arg);
67114         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
67115         arg_conv.is_owned = false;
67116         int64_t ret_conv = AnchorDescriptor_clone_ptr(&arg_conv);
67117         return ret_conv;
67118 }
67119
67120 uint64_t  __attribute__((export_name("TS_AnchorDescriptor_clone"))) TS_AnchorDescriptor_clone(uint64_t orig) {
67121         LDKAnchorDescriptor orig_conv;
67122         orig_conv.inner = untag_ptr(orig);
67123         orig_conv.is_owned = ptr_is_owned(orig);
67124         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
67125         orig_conv.is_owned = false;
67126         LDKAnchorDescriptor ret_var = AnchorDescriptor_clone(&orig_conv);
67127         uint64_t ret_ref = 0;
67128         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
67129         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
67130         return ret_ref;
67131 }
67132
67133 jboolean  __attribute__((export_name("TS_AnchorDescriptor_eq"))) TS_AnchorDescriptor_eq(uint64_t a, uint64_t b) {
67134         LDKAnchorDescriptor a_conv;
67135         a_conv.inner = untag_ptr(a);
67136         a_conv.is_owned = ptr_is_owned(a);
67137         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
67138         a_conv.is_owned = false;
67139         LDKAnchorDescriptor b_conv;
67140         b_conv.inner = untag_ptr(b);
67141         b_conv.is_owned = ptr_is_owned(b);
67142         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
67143         b_conv.is_owned = false;
67144         jboolean ret_conv = AnchorDescriptor_eq(&a_conv, &b_conv);
67145         return ret_conv;
67146 }
67147
67148 uint64_t  __attribute__((export_name("TS_AnchorDescriptor_previous_utxo"))) TS_AnchorDescriptor_previous_utxo(uint64_t this_arg) {
67149         LDKAnchorDescriptor this_arg_conv;
67150         this_arg_conv.inner = untag_ptr(this_arg);
67151         this_arg_conv.is_owned = ptr_is_owned(this_arg);
67152         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
67153         this_arg_conv.is_owned = false;
67154         LDKTxOut* ret_ref = MALLOC(sizeof(LDKTxOut), "LDKTxOut");
67155         *ret_ref = AnchorDescriptor_previous_utxo(&this_arg_conv);
67156         return tag_ptr(ret_ref, true);
67157 }
67158
67159 uint64_t  __attribute__((export_name("TS_AnchorDescriptor_unsigned_tx_input"))) TS_AnchorDescriptor_unsigned_tx_input(uint64_t this_arg) {
67160         LDKAnchorDescriptor this_arg_conv;
67161         this_arg_conv.inner = untag_ptr(this_arg);
67162         this_arg_conv.is_owned = ptr_is_owned(this_arg);
67163         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
67164         this_arg_conv.is_owned = false;
67165         LDKTxIn* ret_ref = MALLOC(sizeof(LDKTxIn), "LDKTxIn");
67166         *ret_ref = AnchorDescriptor_unsigned_tx_input(&this_arg_conv);
67167         return tag_ptr(ret_ref, true);
67168 }
67169
67170 int8_tArray  __attribute__((export_name("TS_AnchorDescriptor_witness_script"))) TS_AnchorDescriptor_witness_script(uint64_t this_arg) {
67171         LDKAnchorDescriptor this_arg_conv;
67172         this_arg_conv.inner = untag_ptr(this_arg);
67173         this_arg_conv.is_owned = ptr_is_owned(this_arg);
67174         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
67175         this_arg_conv.is_owned = false;
67176         LDKCVec_u8Z ret_var = AnchorDescriptor_witness_script(&this_arg_conv);
67177         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
67178         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
67179         CVec_u8Z_free(ret_var);
67180         return ret_arr;
67181 }
67182
67183 int8_tArray  __attribute__((export_name("TS_AnchorDescriptor_tx_input_witness"))) TS_AnchorDescriptor_tx_input_witness(uint64_t this_arg, int8_tArray signature) {
67184         LDKAnchorDescriptor this_arg_conv;
67185         this_arg_conv.inner = untag_ptr(this_arg);
67186         this_arg_conv.is_owned = ptr_is_owned(this_arg);
67187         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
67188         this_arg_conv.is_owned = false;
67189         LDKECDSASignature signature_ref;
67190         CHECK(signature->arr_len == 64);
67191         memcpy(signature_ref.compact_form, signature->elems, 64); FREE(signature);
67192         LDKWitness ret_var = AnchorDescriptor_tx_input_witness(&this_arg_conv, signature_ref);
67193         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
67194         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
67195         Witness_free(ret_var);
67196         return ret_arr;
67197 }
67198
67199 uint64_t  __attribute__((export_name("TS_AnchorDescriptor_derive_channel_signer"))) TS_AnchorDescriptor_derive_channel_signer(uint64_t this_arg, uint64_t signer_provider) {
67200         LDKAnchorDescriptor this_arg_conv;
67201         this_arg_conv.inner = untag_ptr(this_arg);
67202         this_arg_conv.is_owned = ptr_is_owned(this_arg);
67203         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
67204         this_arg_conv.is_owned = false;
67205         void* signer_provider_ptr = untag_ptr(signer_provider);
67206         if (ptr_is_owned(signer_provider)) { CHECK_ACCESS(signer_provider_ptr); }
67207         LDKSignerProvider* signer_provider_conv = (LDKSignerProvider*)signer_provider_ptr;
67208         LDKWriteableEcdsaChannelSigner* ret_ret = MALLOC(sizeof(LDKWriteableEcdsaChannelSigner), "LDKWriteableEcdsaChannelSigner");
67209         *ret_ret = AnchorDescriptor_derive_channel_signer(&this_arg_conv, signer_provider_conv);
67210         return tag_ptr(ret_ret, true);
67211 }
67212
67213 void  __attribute__((export_name("TS_BumpTransactionEvent_free"))) TS_BumpTransactionEvent_free(uint64_t this_ptr) {
67214         if (!ptr_is_owned(this_ptr)) return;
67215         void* this_ptr_ptr = untag_ptr(this_ptr);
67216         CHECK_ACCESS(this_ptr_ptr);
67217         LDKBumpTransactionEvent this_ptr_conv = *(LDKBumpTransactionEvent*)(this_ptr_ptr);
67218         FREE(untag_ptr(this_ptr));
67219         BumpTransactionEvent_free(this_ptr_conv);
67220 }
67221
67222 static inline uint64_t BumpTransactionEvent_clone_ptr(LDKBumpTransactionEvent *NONNULL_PTR arg) {
67223         LDKBumpTransactionEvent *ret_copy = MALLOC(sizeof(LDKBumpTransactionEvent), "LDKBumpTransactionEvent");
67224         *ret_copy = BumpTransactionEvent_clone(arg);
67225         uint64_t ret_ref = tag_ptr(ret_copy, true);
67226         return ret_ref;
67227 }
67228 int64_t  __attribute__((export_name("TS_BumpTransactionEvent_clone_ptr"))) TS_BumpTransactionEvent_clone_ptr(uint64_t arg) {
67229         LDKBumpTransactionEvent* arg_conv = (LDKBumpTransactionEvent*)untag_ptr(arg);
67230         int64_t ret_conv = BumpTransactionEvent_clone_ptr(arg_conv);
67231         return ret_conv;
67232 }
67233
67234 uint64_t  __attribute__((export_name("TS_BumpTransactionEvent_clone"))) TS_BumpTransactionEvent_clone(uint64_t orig) {
67235         LDKBumpTransactionEvent* orig_conv = (LDKBumpTransactionEvent*)untag_ptr(orig);
67236         LDKBumpTransactionEvent *ret_copy = MALLOC(sizeof(LDKBumpTransactionEvent), "LDKBumpTransactionEvent");
67237         *ret_copy = BumpTransactionEvent_clone(orig_conv);
67238         uint64_t ret_ref = tag_ptr(ret_copy, true);
67239         return ret_ref;
67240 }
67241
67242 uint64_t  __attribute__((export_name("TS_BumpTransactionEvent_channel_close"))) TS_BumpTransactionEvent_channel_close(int8_tArray claim_id, int32_t package_target_feerate_sat_per_1000_weight, int8_tArray commitment_tx, int64_t commitment_tx_fee_satoshis, uint64_t anchor_descriptor, uint64_tArray pending_htlcs) {
67243         LDKThirtyTwoBytes claim_id_ref;
67244         CHECK(claim_id->arr_len == 32);
67245         memcpy(claim_id_ref.data, claim_id->elems, 32); FREE(claim_id);
67246         LDKTransaction commitment_tx_ref;
67247         commitment_tx_ref.datalen = commitment_tx->arr_len;
67248         commitment_tx_ref.data = MALLOC(commitment_tx_ref.datalen, "LDKTransaction Bytes");
67249         memcpy(commitment_tx_ref.data, commitment_tx->elems, commitment_tx_ref.datalen); FREE(commitment_tx);
67250         commitment_tx_ref.data_is_owned = true;
67251         LDKAnchorDescriptor anchor_descriptor_conv;
67252         anchor_descriptor_conv.inner = untag_ptr(anchor_descriptor);
67253         anchor_descriptor_conv.is_owned = ptr_is_owned(anchor_descriptor);
67254         CHECK_INNER_FIELD_ACCESS_OR_NULL(anchor_descriptor_conv);
67255         anchor_descriptor_conv = AnchorDescriptor_clone(&anchor_descriptor_conv);
67256         LDKCVec_HTLCOutputInCommitmentZ pending_htlcs_constr;
67257         pending_htlcs_constr.datalen = pending_htlcs->arr_len;
67258         if (pending_htlcs_constr.datalen > 0)
67259                 pending_htlcs_constr.data = MALLOC(pending_htlcs_constr.datalen * sizeof(LDKHTLCOutputInCommitment), "LDKCVec_HTLCOutputInCommitmentZ Elements");
67260         else
67261                 pending_htlcs_constr.data = NULL;
67262         uint64_t* pending_htlcs_vals = pending_htlcs->elems;
67263         for (size_t y = 0; y < pending_htlcs_constr.datalen; y++) {
67264                 uint64_t pending_htlcs_conv_24 = pending_htlcs_vals[y];
67265                 LDKHTLCOutputInCommitment pending_htlcs_conv_24_conv;
67266                 pending_htlcs_conv_24_conv.inner = untag_ptr(pending_htlcs_conv_24);
67267                 pending_htlcs_conv_24_conv.is_owned = ptr_is_owned(pending_htlcs_conv_24);
67268                 CHECK_INNER_FIELD_ACCESS_OR_NULL(pending_htlcs_conv_24_conv);
67269                 pending_htlcs_conv_24_conv = HTLCOutputInCommitment_clone(&pending_htlcs_conv_24_conv);
67270                 pending_htlcs_constr.data[y] = pending_htlcs_conv_24_conv;
67271         }
67272         FREE(pending_htlcs);
67273         LDKBumpTransactionEvent *ret_copy = MALLOC(sizeof(LDKBumpTransactionEvent), "LDKBumpTransactionEvent");
67274         *ret_copy = BumpTransactionEvent_channel_close(claim_id_ref, package_target_feerate_sat_per_1000_weight, commitment_tx_ref, commitment_tx_fee_satoshis, anchor_descriptor_conv, pending_htlcs_constr);
67275         uint64_t ret_ref = tag_ptr(ret_copy, true);
67276         return ret_ref;
67277 }
67278
67279 uint64_t  __attribute__((export_name("TS_BumpTransactionEvent_htlcresolution"))) TS_BumpTransactionEvent_htlcresolution(int8_tArray claim_id, int32_t target_feerate_sat_per_1000_weight, uint64_tArray htlc_descriptors, int32_t tx_lock_time) {
67280         LDKThirtyTwoBytes claim_id_ref;
67281         CHECK(claim_id->arr_len == 32);
67282         memcpy(claim_id_ref.data, claim_id->elems, 32); FREE(claim_id);
67283         LDKCVec_HTLCDescriptorZ htlc_descriptors_constr;
67284         htlc_descriptors_constr.datalen = htlc_descriptors->arr_len;
67285         if (htlc_descriptors_constr.datalen > 0)
67286                 htlc_descriptors_constr.data = MALLOC(htlc_descriptors_constr.datalen * sizeof(LDKHTLCDescriptor), "LDKCVec_HTLCDescriptorZ Elements");
67287         else
67288                 htlc_descriptors_constr.data = NULL;
67289         uint64_t* htlc_descriptors_vals = htlc_descriptors->elems;
67290         for (size_t q = 0; q < htlc_descriptors_constr.datalen; q++) {
67291                 uint64_t htlc_descriptors_conv_16 = htlc_descriptors_vals[q];
67292                 LDKHTLCDescriptor htlc_descriptors_conv_16_conv;
67293                 htlc_descriptors_conv_16_conv.inner = untag_ptr(htlc_descriptors_conv_16);
67294                 htlc_descriptors_conv_16_conv.is_owned = ptr_is_owned(htlc_descriptors_conv_16);
67295                 CHECK_INNER_FIELD_ACCESS_OR_NULL(htlc_descriptors_conv_16_conv);
67296                 htlc_descriptors_conv_16_conv = HTLCDescriptor_clone(&htlc_descriptors_conv_16_conv);
67297                 htlc_descriptors_constr.data[q] = htlc_descriptors_conv_16_conv;
67298         }
67299         FREE(htlc_descriptors);
67300         LDKBumpTransactionEvent *ret_copy = MALLOC(sizeof(LDKBumpTransactionEvent), "LDKBumpTransactionEvent");
67301         *ret_copy = BumpTransactionEvent_htlcresolution(claim_id_ref, target_feerate_sat_per_1000_weight, htlc_descriptors_constr, tx_lock_time);
67302         uint64_t ret_ref = tag_ptr(ret_copy, true);
67303         return ret_ref;
67304 }
67305
67306 jboolean  __attribute__((export_name("TS_BumpTransactionEvent_eq"))) TS_BumpTransactionEvent_eq(uint64_t a, uint64_t b) {
67307         LDKBumpTransactionEvent* a_conv = (LDKBumpTransactionEvent*)untag_ptr(a);
67308         LDKBumpTransactionEvent* b_conv = (LDKBumpTransactionEvent*)untag_ptr(b);
67309         jboolean ret_conv = BumpTransactionEvent_eq(a_conv, b_conv);
67310         return ret_conv;
67311 }
67312
67313 void  __attribute__((export_name("TS_Input_free"))) TS_Input_free(uint64_t this_obj) {
67314         LDKInput this_obj_conv;
67315         this_obj_conv.inner = untag_ptr(this_obj);
67316         this_obj_conv.is_owned = ptr_is_owned(this_obj);
67317         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
67318         Input_free(this_obj_conv);
67319 }
67320
67321 uint64_t  __attribute__((export_name("TS_Input_get_outpoint"))) TS_Input_get_outpoint(uint64_t this_ptr) {
67322         LDKInput this_ptr_conv;
67323         this_ptr_conv.inner = untag_ptr(this_ptr);
67324         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
67325         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
67326         this_ptr_conv.is_owned = false;
67327         LDKOutPoint ret_var = Input_get_outpoint(&this_ptr_conv);
67328         uint64_t ret_ref = 0;
67329         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
67330         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
67331         return ret_ref;
67332 }
67333
67334 void  __attribute__((export_name("TS_Input_set_outpoint"))) TS_Input_set_outpoint(uint64_t this_ptr, uint64_t val) {
67335         LDKInput this_ptr_conv;
67336         this_ptr_conv.inner = untag_ptr(this_ptr);
67337         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
67338         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
67339         this_ptr_conv.is_owned = false;
67340         LDKOutPoint val_conv;
67341         val_conv.inner = untag_ptr(val);
67342         val_conv.is_owned = ptr_is_owned(val);
67343         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
67344         val_conv = OutPoint_clone(&val_conv);
67345         Input_set_outpoint(&this_ptr_conv, val_conv);
67346 }
67347
67348 uint64_t  __attribute__((export_name("TS_Input_get_previous_utxo"))) TS_Input_get_previous_utxo(uint64_t this_ptr) {
67349         LDKInput this_ptr_conv;
67350         this_ptr_conv.inner = untag_ptr(this_ptr);
67351         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
67352         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
67353         this_ptr_conv.is_owned = false;
67354         LDKTxOut* ret_ref = MALLOC(sizeof(LDKTxOut), "LDKTxOut");
67355         *ret_ref = Input_get_previous_utxo(&this_ptr_conv);
67356         return tag_ptr(ret_ref, true);
67357 }
67358
67359 void  __attribute__((export_name("TS_Input_set_previous_utxo"))) TS_Input_set_previous_utxo(uint64_t this_ptr, uint64_t val) {
67360         LDKInput this_ptr_conv;
67361         this_ptr_conv.inner = untag_ptr(this_ptr);
67362         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
67363         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
67364         this_ptr_conv.is_owned = false;
67365         void* val_ptr = untag_ptr(val);
67366         CHECK_ACCESS(val_ptr);
67367         LDKTxOut val_conv = *(LDKTxOut*)(val_ptr);
67368         val_conv = TxOut_clone((LDKTxOut*)untag_ptr(val));
67369         Input_set_previous_utxo(&this_ptr_conv, val_conv);
67370 }
67371
67372 int64_t  __attribute__((export_name("TS_Input_get_satisfaction_weight"))) TS_Input_get_satisfaction_weight(uint64_t this_ptr) {
67373         LDKInput this_ptr_conv;
67374         this_ptr_conv.inner = untag_ptr(this_ptr);
67375         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
67376         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
67377         this_ptr_conv.is_owned = false;
67378         int64_t ret_conv = Input_get_satisfaction_weight(&this_ptr_conv);
67379         return ret_conv;
67380 }
67381
67382 void  __attribute__((export_name("TS_Input_set_satisfaction_weight"))) TS_Input_set_satisfaction_weight(uint64_t this_ptr, int64_t val) {
67383         LDKInput this_ptr_conv;
67384         this_ptr_conv.inner = untag_ptr(this_ptr);
67385         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
67386         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
67387         this_ptr_conv.is_owned = false;
67388         Input_set_satisfaction_weight(&this_ptr_conv, val);
67389 }
67390
67391 uint64_t  __attribute__((export_name("TS_Input_new"))) TS_Input_new(uint64_t outpoint_arg, uint64_t previous_utxo_arg, int64_t satisfaction_weight_arg) {
67392         LDKOutPoint outpoint_arg_conv;
67393         outpoint_arg_conv.inner = untag_ptr(outpoint_arg);
67394         outpoint_arg_conv.is_owned = ptr_is_owned(outpoint_arg);
67395         CHECK_INNER_FIELD_ACCESS_OR_NULL(outpoint_arg_conv);
67396         outpoint_arg_conv = OutPoint_clone(&outpoint_arg_conv);
67397         void* previous_utxo_arg_ptr = untag_ptr(previous_utxo_arg);
67398         CHECK_ACCESS(previous_utxo_arg_ptr);
67399         LDKTxOut previous_utxo_arg_conv = *(LDKTxOut*)(previous_utxo_arg_ptr);
67400         previous_utxo_arg_conv = TxOut_clone((LDKTxOut*)untag_ptr(previous_utxo_arg));
67401         LDKInput ret_var = Input_new(outpoint_arg_conv, previous_utxo_arg_conv, satisfaction_weight_arg);
67402         uint64_t ret_ref = 0;
67403         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
67404         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
67405         return ret_ref;
67406 }
67407
67408 static inline uint64_t Input_clone_ptr(LDKInput *NONNULL_PTR arg) {
67409         LDKInput ret_var = Input_clone(arg);
67410         uint64_t ret_ref = 0;
67411         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
67412         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
67413         return ret_ref;
67414 }
67415 int64_t  __attribute__((export_name("TS_Input_clone_ptr"))) TS_Input_clone_ptr(uint64_t arg) {
67416         LDKInput arg_conv;
67417         arg_conv.inner = untag_ptr(arg);
67418         arg_conv.is_owned = ptr_is_owned(arg);
67419         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
67420         arg_conv.is_owned = false;
67421         int64_t ret_conv = Input_clone_ptr(&arg_conv);
67422         return ret_conv;
67423 }
67424
67425 uint64_t  __attribute__((export_name("TS_Input_clone"))) TS_Input_clone(uint64_t orig) {
67426         LDKInput orig_conv;
67427         orig_conv.inner = untag_ptr(orig);
67428         orig_conv.is_owned = ptr_is_owned(orig);
67429         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
67430         orig_conv.is_owned = false;
67431         LDKInput ret_var = Input_clone(&orig_conv);
67432         uint64_t ret_ref = 0;
67433         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
67434         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
67435         return ret_ref;
67436 }
67437
67438 int64_t  __attribute__((export_name("TS_Input_hash"))) TS_Input_hash(uint64_t o) {
67439         LDKInput o_conv;
67440         o_conv.inner = untag_ptr(o);
67441         o_conv.is_owned = ptr_is_owned(o);
67442         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
67443         o_conv.is_owned = false;
67444         int64_t ret_conv = Input_hash(&o_conv);
67445         return ret_conv;
67446 }
67447
67448 jboolean  __attribute__((export_name("TS_Input_eq"))) TS_Input_eq(uint64_t a, uint64_t b) {
67449         LDKInput a_conv;
67450         a_conv.inner = untag_ptr(a);
67451         a_conv.is_owned = ptr_is_owned(a);
67452         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
67453         a_conv.is_owned = false;
67454         LDKInput b_conv;
67455         b_conv.inner = untag_ptr(b);
67456         b_conv.is_owned = ptr_is_owned(b);
67457         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
67458         b_conv.is_owned = false;
67459         jboolean ret_conv = Input_eq(&a_conv, &b_conv);
67460         return ret_conv;
67461 }
67462
67463 void  __attribute__((export_name("TS_Utxo_free"))) TS_Utxo_free(uint64_t this_obj) {
67464         LDKUtxo this_obj_conv;
67465         this_obj_conv.inner = untag_ptr(this_obj);
67466         this_obj_conv.is_owned = ptr_is_owned(this_obj);
67467         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
67468         Utxo_free(this_obj_conv);
67469 }
67470
67471 uint64_t  __attribute__((export_name("TS_Utxo_get_outpoint"))) TS_Utxo_get_outpoint(uint64_t this_ptr) {
67472         LDKUtxo this_ptr_conv;
67473         this_ptr_conv.inner = untag_ptr(this_ptr);
67474         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
67475         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
67476         this_ptr_conv.is_owned = false;
67477         LDKOutPoint ret_var = Utxo_get_outpoint(&this_ptr_conv);
67478         uint64_t ret_ref = 0;
67479         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
67480         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
67481         return ret_ref;
67482 }
67483
67484 void  __attribute__((export_name("TS_Utxo_set_outpoint"))) TS_Utxo_set_outpoint(uint64_t this_ptr, uint64_t val) {
67485         LDKUtxo this_ptr_conv;
67486         this_ptr_conv.inner = untag_ptr(this_ptr);
67487         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
67488         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
67489         this_ptr_conv.is_owned = false;
67490         LDKOutPoint val_conv;
67491         val_conv.inner = untag_ptr(val);
67492         val_conv.is_owned = ptr_is_owned(val);
67493         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
67494         val_conv = OutPoint_clone(&val_conv);
67495         Utxo_set_outpoint(&this_ptr_conv, val_conv);
67496 }
67497
67498 uint64_t  __attribute__((export_name("TS_Utxo_get_output"))) TS_Utxo_get_output(uint64_t this_ptr) {
67499         LDKUtxo this_ptr_conv;
67500         this_ptr_conv.inner = untag_ptr(this_ptr);
67501         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
67502         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
67503         this_ptr_conv.is_owned = false;
67504         LDKTxOut* ret_ref = MALLOC(sizeof(LDKTxOut), "LDKTxOut");
67505         *ret_ref = Utxo_get_output(&this_ptr_conv);
67506         return tag_ptr(ret_ref, true);
67507 }
67508
67509 void  __attribute__((export_name("TS_Utxo_set_output"))) TS_Utxo_set_output(uint64_t this_ptr, uint64_t val) {
67510         LDKUtxo this_ptr_conv;
67511         this_ptr_conv.inner = untag_ptr(this_ptr);
67512         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
67513         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
67514         this_ptr_conv.is_owned = false;
67515         void* val_ptr = untag_ptr(val);
67516         CHECK_ACCESS(val_ptr);
67517         LDKTxOut val_conv = *(LDKTxOut*)(val_ptr);
67518         val_conv = TxOut_clone((LDKTxOut*)untag_ptr(val));
67519         Utxo_set_output(&this_ptr_conv, val_conv);
67520 }
67521
67522 int64_t  __attribute__((export_name("TS_Utxo_get_satisfaction_weight"))) TS_Utxo_get_satisfaction_weight(uint64_t this_ptr) {
67523         LDKUtxo this_ptr_conv;
67524         this_ptr_conv.inner = untag_ptr(this_ptr);
67525         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
67526         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
67527         this_ptr_conv.is_owned = false;
67528         int64_t ret_conv = Utxo_get_satisfaction_weight(&this_ptr_conv);
67529         return ret_conv;
67530 }
67531
67532 void  __attribute__((export_name("TS_Utxo_set_satisfaction_weight"))) TS_Utxo_set_satisfaction_weight(uint64_t this_ptr, int64_t val) {
67533         LDKUtxo this_ptr_conv;
67534         this_ptr_conv.inner = untag_ptr(this_ptr);
67535         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
67536         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
67537         this_ptr_conv.is_owned = false;
67538         Utxo_set_satisfaction_weight(&this_ptr_conv, val);
67539 }
67540
67541 uint64_t  __attribute__((export_name("TS_Utxo_new"))) TS_Utxo_new(uint64_t outpoint_arg, uint64_t output_arg, int64_t satisfaction_weight_arg) {
67542         LDKOutPoint outpoint_arg_conv;
67543         outpoint_arg_conv.inner = untag_ptr(outpoint_arg);
67544         outpoint_arg_conv.is_owned = ptr_is_owned(outpoint_arg);
67545         CHECK_INNER_FIELD_ACCESS_OR_NULL(outpoint_arg_conv);
67546         outpoint_arg_conv = OutPoint_clone(&outpoint_arg_conv);
67547         void* output_arg_ptr = untag_ptr(output_arg);
67548         CHECK_ACCESS(output_arg_ptr);
67549         LDKTxOut output_arg_conv = *(LDKTxOut*)(output_arg_ptr);
67550         output_arg_conv = TxOut_clone((LDKTxOut*)untag_ptr(output_arg));
67551         LDKUtxo ret_var = Utxo_new(outpoint_arg_conv, output_arg_conv, satisfaction_weight_arg);
67552         uint64_t ret_ref = 0;
67553         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
67554         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
67555         return ret_ref;
67556 }
67557
67558 static inline uint64_t Utxo_clone_ptr(LDKUtxo *NONNULL_PTR arg) {
67559         LDKUtxo ret_var = Utxo_clone(arg);
67560         uint64_t ret_ref = 0;
67561         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
67562         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
67563         return ret_ref;
67564 }
67565 int64_t  __attribute__((export_name("TS_Utxo_clone_ptr"))) TS_Utxo_clone_ptr(uint64_t arg) {
67566         LDKUtxo arg_conv;
67567         arg_conv.inner = untag_ptr(arg);
67568         arg_conv.is_owned = ptr_is_owned(arg);
67569         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
67570         arg_conv.is_owned = false;
67571         int64_t ret_conv = Utxo_clone_ptr(&arg_conv);
67572         return ret_conv;
67573 }
67574
67575 uint64_t  __attribute__((export_name("TS_Utxo_clone"))) TS_Utxo_clone(uint64_t orig) {
67576         LDKUtxo orig_conv;
67577         orig_conv.inner = untag_ptr(orig);
67578         orig_conv.is_owned = ptr_is_owned(orig);
67579         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
67580         orig_conv.is_owned = false;
67581         LDKUtxo ret_var = Utxo_clone(&orig_conv);
67582         uint64_t ret_ref = 0;
67583         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
67584         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
67585         return ret_ref;
67586 }
67587
67588 int64_t  __attribute__((export_name("TS_Utxo_hash"))) TS_Utxo_hash(uint64_t o) {
67589         LDKUtxo o_conv;
67590         o_conv.inner = untag_ptr(o);
67591         o_conv.is_owned = ptr_is_owned(o);
67592         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
67593         o_conv.is_owned = false;
67594         int64_t ret_conv = Utxo_hash(&o_conv);
67595         return ret_conv;
67596 }
67597
67598 jboolean  __attribute__((export_name("TS_Utxo_eq"))) TS_Utxo_eq(uint64_t a, uint64_t b) {
67599         LDKUtxo a_conv;
67600         a_conv.inner = untag_ptr(a);
67601         a_conv.is_owned = ptr_is_owned(a);
67602         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
67603         a_conv.is_owned = false;
67604         LDKUtxo b_conv;
67605         b_conv.inner = untag_ptr(b);
67606         b_conv.is_owned = ptr_is_owned(b);
67607         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
67608         b_conv.is_owned = false;
67609         jboolean ret_conv = Utxo_eq(&a_conv, &b_conv);
67610         return ret_conv;
67611 }
67612
67613 uint64_t  __attribute__((export_name("TS_Utxo_new_p2pkh"))) TS_Utxo_new_p2pkh(uint64_t outpoint, int64_t value, int8_tArray pubkey_hash) {
67614         LDKOutPoint outpoint_conv;
67615         outpoint_conv.inner = untag_ptr(outpoint);
67616         outpoint_conv.is_owned = ptr_is_owned(outpoint);
67617         CHECK_INNER_FIELD_ACCESS_OR_NULL(outpoint_conv);
67618         outpoint_conv = OutPoint_clone(&outpoint_conv);
67619         uint8_t pubkey_hash_arr[20];
67620         CHECK(pubkey_hash->arr_len == 20);
67621         memcpy(pubkey_hash_arr, pubkey_hash->elems, 20); FREE(pubkey_hash);
67622         uint8_t (*pubkey_hash_ref)[20] = &pubkey_hash_arr;
67623         LDKUtxo ret_var = Utxo_new_p2pkh(outpoint_conv, value, pubkey_hash_ref);
67624         uint64_t ret_ref = 0;
67625         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
67626         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
67627         return ret_ref;
67628 }
67629
67630 void  __attribute__((export_name("TS_CoinSelection_free"))) TS_CoinSelection_free(uint64_t this_obj) {
67631         LDKCoinSelection this_obj_conv;
67632         this_obj_conv.inner = untag_ptr(this_obj);
67633         this_obj_conv.is_owned = ptr_is_owned(this_obj);
67634         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
67635         CoinSelection_free(this_obj_conv);
67636 }
67637
67638 uint64_tArray  __attribute__((export_name("TS_CoinSelection_get_confirmed_utxos"))) TS_CoinSelection_get_confirmed_utxos(uint64_t this_ptr) {
67639         LDKCoinSelection this_ptr_conv;
67640         this_ptr_conv.inner = untag_ptr(this_ptr);
67641         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
67642         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
67643         this_ptr_conv.is_owned = false;
67644         LDKCVec_UtxoZ ret_var = CoinSelection_get_confirmed_utxos(&this_ptr_conv);
67645         uint64_tArray ret_arr = NULL;
67646         ret_arr = init_uint64_tArray(ret_var.datalen, __LINE__);
67647         uint64_t *ret_arr_ptr = (uint64_t*)(((uint8_t*)ret_arr) + 8);
67648         for (size_t g = 0; g < ret_var.datalen; g++) {
67649                 LDKUtxo ret_conv_6_var = ret_var.data[g];
67650                 uint64_t ret_conv_6_ref = 0;
67651                 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_conv_6_var);
67652                 ret_conv_6_ref = tag_ptr(ret_conv_6_var.inner, ret_conv_6_var.is_owned);
67653                 ret_arr_ptr[g] = ret_conv_6_ref;
67654         }
67655         
67656         FREE(ret_var.data);
67657         return ret_arr;
67658 }
67659
67660 void  __attribute__((export_name("TS_CoinSelection_set_confirmed_utxos"))) TS_CoinSelection_set_confirmed_utxos(uint64_t this_ptr, uint64_tArray val) {
67661         LDKCoinSelection this_ptr_conv;
67662         this_ptr_conv.inner = untag_ptr(this_ptr);
67663         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
67664         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
67665         this_ptr_conv.is_owned = false;
67666         LDKCVec_UtxoZ val_constr;
67667         val_constr.datalen = val->arr_len;
67668         if (val_constr.datalen > 0)
67669                 val_constr.data = MALLOC(val_constr.datalen * sizeof(LDKUtxo), "LDKCVec_UtxoZ Elements");
67670         else
67671                 val_constr.data = NULL;
67672         uint64_t* val_vals = val->elems;
67673         for (size_t g = 0; g < val_constr.datalen; g++) {
67674                 uint64_t val_conv_6 = val_vals[g];
67675                 LDKUtxo val_conv_6_conv;
67676                 val_conv_6_conv.inner = untag_ptr(val_conv_6);
67677                 val_conv_6_conv.is_owned = ptr_is_owned(val_conv_6);
67678                 CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv_6_conv);
67679                 val_conv_6_conv = Utxo_clone(&val_conv_6_conv);
67680                 val_constr.data[g] = val_conv_6_conv;
67681         }
67682         FREE(val);
67683         CoinSelection_set_confirmed_utxos(&this_ptr_conv, val_constr);
67684 }
67685
67686 uint64_t  __attribute__((export_name("TS_CoinSelection_get_change_output"))) TS_CoinSelection_get_change_output(uint64_t this_ptr) {
67687         LDKCoinSelection this_ptr_conv;
67688         this_ptr_conv.inner = untag_ptr(this_ptr);
67689         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
67690         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
67691         this_ptr_conv.is_owned = false;
67692         LDKCOption_TxOutZ *ret_copy = MALLOC(sizeof(LDKCOption_TxOutZ), "LDKCOption_TxOutZ");
67693         *ret_copy = CoinSelection_get_change_output(&this_ptr_conv);
67694         uint64_t ret_ref = tag_ptr(ret_copy, true);
67695         return ret_ref;
67696 }
67697
67698 void  __attribute__((export_name("TS_CoinSelection_set_change_output"))) TS_CoinSelection_set_change_output(uint64_t this_ptr, uint64_t val) {
67699         LDKCoinSelection this_ptr_conv;
67700         this_ptr_conv.inner = untag_ptr(this_ptr);
67701         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
67702         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
67703         this_ptr_conv.is_owned = false;
67704         void* val_ptr = untag_ptr(val);
67705         CHECK_ACCESS(val_ptr);
67706         LDKCOption_TxOutZ val_conv = *(LDKCOption_TxOutZ*)(val_ptr);
67707         val_conv = COption_TxOutZ_clone((LDKCOption_TxOutZ*)untag_ptr(val));
67708         CoinSelection_set_change_output(&this_ptr_conv, val_conv);
67709 }
67710
67711 uint64_t  __attribute__((export_name("TS_CoinSelection_new"))) TS_CoinSelection_new(uint64_tArray confirmed_utxos_arg, uint64_t change_output_arg) {
67712         LDKCVec_UtxoZ confirmed_utxos_arg_constr;
67713         confirmed_utxos_arg_constr.datalen = confirmed_utxos_arg->arr_len;
67714         if (confirmed_utxos_arg_constr.datalen > 0)
67715                 confirmed_utxos_arg_constr.data = MALLOC(confirmed_utxos_arg_constr.datalen * sizeof(LDKUtxo), "LDKCVec_UtxoZ Elements");
67716         else
67717                 confirmed_utxos_arg_constr.data = NULL;
67718         uint64_t* confirmed_utxos_arg_vals = confirmed_utxos_arg->elems;
67719         for (size_t g = 0; g < confirmed_utxos_arg_constr.datalen; g++) {
67720                 uint64_t confirmed_utxos_arg_conv_6 = confirmed_utxos_arg_vals[g];
67721                 LDKUtxo confirmed_utxos_arg_conv_6_conv;
67722                 confirmed_utxos_arg_conv_6_conv.inner = untag_ptr(confirmed_utxos_arg_conv_6);
67723                 confirmed_utxos_arg_conv_6_conv.is_owned = ptr_is_owned(confirmed_utxos_arg_conv_6);
67724                 CHECK_INNER_FIELD_ACCESS_OR_NULL(confirmed_utxos_arg_conv_6_conv);
67725                 confirmed_utxos_arg_conv_6_conv = Utxo_clone(&confirmed_utxos_arg_conv_6_conv);
67726                 confirmed_utxos_arg_constr.data[g] = confirmed_utxos_arg_conv_6_conv;
67727         }
67728         FREE(confirmed_utxos_arg);
67729         void* change_output_arg_ptr = untag_ptr(change_output_arg);
67730         CHECK_ACCESS(change_output_arg_ptr);
67731         LDKCOption_TxOutZ change_output_arg_conv = *(LDKCOption_TxOutZ*)(change_output_arg_ptr);
67732         change_output_arg_conv = COption_TxOutZ_clone((LDKCOption_TxOutZ*)untag_ptr(change_output_arg));
67733         LDKCoinSelection ret_var = CoinSelection_new(confirmed_utxos_arg_constr, change_output_arg_conv);
67734         uint64_t ret_ref = 0;
67735         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
67736         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
67737         return ret_ref;
67738 }
67739
67740 static inline uint64_t CoinSelection_clone_ptr(LDKCoinSelection *NONNULL_PTR arg) {
67741         LDKCoinSelection ret_var = CoinSelection_clone(arg);
67742         uint64_t ret_ref = 0;
67743         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
67744         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
67745         return ret_ref;
67746 }
67747 int64_t  __attribute__((export_name("TS_CoinSelection_clone_ptr"))) TS_CoinSelection_clone_ptr(uint64_t arg) {
67748         LDKCoinSelection arg_conv;
67749         arg_conv.inner = untag_ptr(arg);
67750         arg_conv.is_owned = ptr_is_owned(arg);
67751         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
67752         arg_conv.is_owned = false;
67753         int64_t ret_conv = CoinSelection_clone_ptr(&arg_conv);
67754         return ret_conv;
67755 }
67756
67757 uint64_t  __attribute__((export_name("TS_CoinSelection_clone"))) TS_CoinSelection_clone(uint64_t orig) {
67758         LDKCoinSelection orig_conv;
67759         orig_conv.inner = untag_ptr(orig);
67760         orig_conv.is_owned = ptr_is_owned(orig);
67761         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
67762         orig_conv.is_owned = false;
67763         LDKCoinSelection ret_var = CoinSelection_clone(&orig_conv);
67764         uint64_t ret_ref = 0;
67765         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
67766         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
67767         return ret_ref;
67768 }
67769
67770 void  __attribute__((export_name("TS_CoinSelectionSource_free"))) TS_CoinSelectionSource_free(uint64_t this_ptr) {
67771         if (!ptr_is_owned(this_ptr)) return;
67772         void* this_ptr_ptr = untag_ptr(this_ptr);
67773         CHECK_ACCESS(this_ptr_ptr);
67774         LDKCoinSelectionSource this_ptr_conv = *(LDKCoinSelectionSource*)(this_ptr_ptr);
67775         FREE(untag_ptr(this_ptr));
67776         CoinSelectionSource_free(this_ptr_conv);
67777 }
67778
67779 void  __attribute__((export_name("TS_WalletSource_free"))) TS_WalletSource_free(uint64_t this_ptr) {
67780         if (!ptr_is_owned(this_ptr)) return;
67781         void* this_ptr_ptr = untag_ptr(this_ptr);
67782         CHECK_ACCESS(this_ptr_ptr);
67783         LDKWalletSource this_ptr_conv = *(LDKWalletSource*)(this_ptr_ptr);
67784         FREE(untag_ptr(this_ptr));
67785         WalletSource_free(this_ptr_conv);
67786 }
67787
67788 void  __attribute__((export_name("TS_Wallet_free"))) TS_Wallet_free(uint64_t this_obj) {
67789         LDKWallet this_obj_conv;
67790         this_obj_conv.inner = untag_ptr(this_obj);
67791         this_obj_conv.is_owned = ptr_is_owned(this_obj);
67792         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
67793         Wallet_free(this_obj_conv);
67794 }
67795
67796 uint64_t  __attribute__((export_name("TS_Wallet_new"))) TS_Wallet_new(uint64_t source, uint64_t logger) {
67797         void* source_ptr = untag_ptr(source);
67798         CHECK_ACCESS(source_ptr);
67799         LDKWalletSource source_conv = *(LDKWalletSource*)(source_ptr);
67800         if (source_conv.free == LDKWalletSource_JCalls_free) {
67801                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
67802                 LDKWalletSource_JCalls_cloned(&source_conv);
67803         }
67804         void* logger_ptr = untag_ptr(logger);
67805         CHECK_ACCESS(logger_ptr);
67806         LDKLogger logger_conv = *(LDKLogger*)(logger_ptr);
67807         if (logger_conv.free == LDKLogger_JCalls_free) {
67808                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
67809                 LDKLogger_JCalls_cloned(&logger_conv);
67810         }
67811         LDKWallet ret_var = Wallet_new(source_conv, logger_conv);
67812         uint64_t ret_ref = 0;
67813         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
67814         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
67815         return ret_ref;
67816 }
67817
67818 uint64_t  __attribute__((export_name("TS_Wallet_as_CoinSelectionSource"))) TS_Wallet_as_CoinSelectionSource(uint64_t this_arg) {
67819         LDKWallet this_arg_conv;
67820         this_arg_conv.inner = untag_ptr(this_arg);
67821         this_arg_conv.is_owned = ptr_is_owned(this_arg);
67822         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
67823         this_arg_conv.is_owned = false;
67824         LDKCoinSelectionSource* ret_ret = MALLOC(sizeof(LDKCoinSelectionSource), "LDKCoinSelectionSource");
67825         *ret_ret = Wallet_as_CoinSelectionSource(&this_arg_conv);
67826         return tag_ptr(ret_ret, true);
67827 }
67828
67829 void  __attribute__((export_name("TS_BumpTransactionEventHandler_free"))) TS_BumpTransactionEventHandler_free(uint64_t this_obj) {
67830         LDKBumpTransactionEventHandler this_obj_conv;
67831         this_obj_conv.inner = untag_ptr(this_obj);
67832         this_obj_conv.is_owned = ptr_is_owned(this_obj);
67833         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
67834         BumpTransactionEventHandler_free(this_obj_conv);
67835 }
67836
67837 uint64_t  __attribute__((export_name("TS_BumpTransactionEventHandler_new"))) TS_BumpTransactionEventHandler_new(uint64_t broadcaster, uint64_t utxo_source, uint64_t signer_provider, uint64_t logger) {
67838         void* broadcaster_ptr = untag_ptr(broadcaster);
67839         CHECK_ACCESS(broadcaster_ptr);
67840         LDKBroadcasterInterface broadcaster_conv = *(LDKBroadcasterInterface*)(broadcaster_ptr);
67841         if (broadcaster_conv.free == LDKBroadcasterInterface_JCalls_free) {
67842                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
67843                 LDKBroadcasterInterface_JCalls_cloned(&broadcaster_conv);
67844         }
67845         void* utxo_source_ptr = untag_ptr(utxo_source);
67846         CHECK_ACCESS(utxo_source_ptr);
67847         LDKCoinSelectionSource utxo_source_conv = *(LDKCoinSelectionSource*)(utxo_source_ptr);
67848         if (utxo_source_conv.free == LDKCoinSelectionSource_JCalls_free) {
67849                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
67850                 LDKCoinSelectionSource_JCalls_cloned(&utxo_source_conv);
67851         }
67852         void* signer_provider_ptr = untag_ptr(signer_provider);
67853         CHECK_ACCESS(signer_provider_ptr);
67854         LDKSignerProvider signer_provider_conv = *(LDKSignerProvider*)(signer_provider_ptr);
67855         if (signer_provider_conv.free == LDKSignerProvider_JCalls_free) {
67856                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
67857                 LDKSignerProvider_JCalls_cloned(&signer_provider_conv);
67858         }
67859         void* logger_ptr = untag_ptr(logger);
67860         CHECK_ACCESS(logger_ptr);
67861         LDKLogger logger_conv = *(LDKLogger*)(logger_ptr);
67862         if (logger_conv.free == LDKLogger_JCalls_free) {
67863                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
67864                 LDKLogger_JCalls_cloned(&logger_conv);
67865         }
67866         LDKBumpTransactionEventHandler ret_var = BumpTransactionEventHandler_new(broadcaster_conv, utxo_source_conv, signer_provider_conv, logger_conv);
67867         uint64_t ret_ref = 0;
67868         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
67869         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
67870         return ret_ref;
67871 }
67872
67873 void  __attribute__((export_name("TS_BumpTransactionEventHandler_handle_event"))) TS_BumpTransactionEventHandler_handle_event(uint64_t this_arg, uint64_t event) {
67874         LDKBumpTransactionEventHandler this_arg_conv;
67875         this_arg_conv.inner = untag_ptr(this_arg);
67876         this_arg_conv.is_owned = ptr_is_owned(this_arg);
67877         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
67878         this_arg_conv.is_owned = false;
67879         LDKBumpTransactionEvent* event_conv = (LDKBumpTransactionEvent*)untag_ptr(event);
67880         BumpTransactionEventHandler_handle_event(&this_arg_conv, event_conv);
67881 }
67882
67883 void  __attribute__((export_name("TS_GossipSync_free"))) TS_GossipSync_free(uint64_t this_ptr) {
67884         if (!ptr_is_owned(this_ptr)) return;
67885         void* this_ptr_ptr = untag_ptr(this_ptr);
67886         CHECK_ACCESS(this_ptr_ptr);
67887         LDKGossipSync this_ptr_conv = *(LDKGossipSync*)(this_ptr_ptr);
67888         FREE(untag_ptr(this_ptr));
67889         GossipSync_free(this_ptr_conv);
67890 }
67891
67892 uint64_t  __attribute__((export_name("TS_GossipSync_p2_p"))) TS_GossipSync_p2_p(uint64_t a) {
67893         LDKP2PGossipSync a_conv;
67894         a_conv.inner = untag_ptr(a);
67895         a_conv.is_owned = ptr_is_owned(a);
67896         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
67897         a_conv.is_owned = false;
67898         LDKGossipSync *ret_copy = MALLOC(sizeof(LDKGossipSync), "LDKGossipSync");
67899         *ret_copy = GossipSync_p2_p(&a_conv);
67900         uint64_t ret_ref = tag_ptr(ret_copy, true);
67901         return ret_ref;
67902 }
67903
67904 uint64_t  __attribute__((export_name("TS_GossipSync_rapid"))) TS_GossipSync_rapid(uint64_t a) {
67905         LDKRapidGossipSync a_conv;
67906         a_conv.inner = untag_ptr(a);
67907         a_conv.is_owned = ptr_is_owned(a);
67908         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
67909         a_conv.is_owned = false;
67910         LDKGossipSync *ret_copy = MALLOC(sizeof(LDKGossipSync), "LDKGossipSync");
67911         *ret_copy = GossipSync_rapid(&a_conv);
67912         uint64_t ret_ref = tag_ptr(ret_copy, true);
67913         return ret_ref;
67914 }
67915
67916 uint64_t  __attribute__((export_name("TS_GossipSync_none"))) TS_GossipSync_none() {
67917         LDKGossipSync *ret_copy = MALLOC(sizeof(LDKGossipSync), "LDKGossipSync");
67918         *ret_copy = GossipSync_none();
67919         uint64_t ret_ref = tag_ptr(ret_copy, true);
67920         return ret_ref;
67921 }
67922
67923 void  __attribute__((export_name("TS_RapidGossipSync_free"))) TS_RapidGossipSync_free(uint64_t this_obj) {
67924         LDKRapidGossipSync this_obj_conv;
67925         this_obj_conv.inner = untag_ptr(this_obj);
67926         this_obj_conv.is_owned = ptr_is_owned(this_obj);
67927         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
67928         RapidGossipSync_free(this_obj_conv);
67929 }
67930
67931 uint64_t  __attribute__((export_name("TS_RapidGossipSync_new"))) TS_RapidGossipSync_new(uint64_t network_graph, uint64_t logger) {
67932         LDKNetworkGraph network_graph_conv;
67933         network_graph_conv.inner = untag_ptr(network_graph);
67934         network_graph_conv.is_owned = ptr_is_owned(network_graph);
67935         CHECK_INNER_FIELD_ACCESS_OR_NULL(network_graph_conv);
67936         network_graph_conv.is_owned = false;
67937         void* logger_ptr = untag_ptr(logger);
67938         CHECK_ACCESS(logger_ptr);
67939         LDKLogger logger_conv = *(LDKLogger*)(logger_ptr);
67940         if (logger_conv.free == LDKLogger_JCalls_free) {
67941                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
67942                 LDKLogger_JCalls_cloned(&logger_conv);
67943         }
67944         LDKRapidGossipSync ret_var = RapidGossipSync_new(&network_graph_conv, logger_conv);
67945         uint64_t ret_ref = 0;
67946         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
67947         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
67948         return ret_ref;
67949 }
67950
67951 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) {
67952         LDKRapidGossipSync this_arg_conv;
67953         this_arg_conv.inner = untag_ptr(this_arg);
67954         this_arg_conv.is_owned = ptr_is_owned(this_arg);
67955         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
67956         this_arg_conv.is_owned = false;
67957         LDKu8slice update_data_ref;
67958         update_data_ref.datalen = update_data->arr_len;
67959         update_data_ref.data = update_data->elems;
67960         void* current_time_unix_ptr = untag_ptr(current_time_unix);
67961         CHECK_ACCESS(current_time_unix_ptr);
67962         LDKCOption_u64Z current_time_unix_conv = *(LDKCOption_u64Z*)(current_time_unix_ptr);
67963         current_time_unix_conv = COption_u64Z_clone((LDKCOption_u64Z*)untag_ptr(current_time_unix));
67964         LDKCResult_u32GraphSyncErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_u32GraphSyncErrorZ), "LDKCResult_u32GraphSyncErrorZ");
67965         *ret_conv = RapidGossipSync_update_network_graph_no_std(&this_arg_conv, update_data_ref, current_time_unix_conv);
67966         FREE(update_data);
67967         return tag_ptr(ret_conv, true);
67968 }
67969
67970 jboolean  __attribute__((export_name("TS_RapidGossipSync_is_initial_sync_complete"))) TS_RapidGossipSync_is_initial_sync_complete(uint64_t this_arg) {
67971         LDKRapidGossipSync this_arg_conv;
67972         this_arg_conv.inner = untag_ptr(this_arg);
67973         this_arg_conv.is_owned = ptr_is_owned(this_arg);
67974         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
67975         this_arg_conv.is_owned = false;
67976         jboolean ret_conv = RapidGossipSync_is_initial_sync_complete(&this_arg_conv);
67977         return ret_conv;
67978 }
67979
67980 void  __attribute__((export_name("TS_GraphSyncError_free"))) TS_GraphSyncError_free(uint64_t this_ptr) {
67981         if (!ptr_is_owned(this_ptr)) return;
67982         void* this_ptr_ptr = untag_ptr(this_ptr);
67983         CHECK_ACCESS(this_ptr_ptr);
67984         LDKGraphSyncError this_ptr_conv = *(LDKGraphSyncError*)(this_ptr_ptr);
67985         FREE(untag_ptr(this_ptr));
67986         GraphSyncError_free(this_ptr_conv);
67987 }
67988
67989 static inline uint64_t GraphSyncError_clone_ptr(LDKGraphSyncError *NONNULL_PTR arg) {
67990         LDKGraphSyncError *ret_copy = MALLOC(sizeof(LDKGraphSyncError), "LDKGraphSyncError");
67991         *ret_copy = GraphSyncError_clone(arg);
67992         uint64_t ret_ref = tag_ptr(ret_copy, true);
67993         return ret_ref;
67994 }
67995 int64_t  __attribute__((export_name("TS_GraphSyncError_clone_ptr"))) TS_GraphSyncError_clone_ptr(uint64_t arg) {
67996         LDKGraphSyncError* arg_conv = (LDKGraphSyncError*)untag_ptr(arg);
67997         int64_t ret_conv = GraphSyncError_clone_ptr(arg_conv);
67998         return ret_conv;
67999 }
68000
68001 uint64_t  __attribute__((export_name("TS_GraphSyncError_clone"))) TS_GraphSyncError_clone(uint64_t orig) {
68002         LDKGraphSyncError* orig_conv = (LDKGraphSyncError*)untag_ptr(orig);
68003         LDKGraphSyncError *ret_copy = MALLOC(sizeof(LDKGraphSyncError), "LDKGraphSyncError");
68004         *ret_copy = GraphSyncError_clone(orig_conv);
68005         uint64_t ret_ref = tag_ptr(ret_copy, true);
68006         return ret_ref;
68007 }
68008
68009 uint64_t  __attribute__((export_name("TS_GraphSyncError_decode_error"))) TS_GraphSyncError_decode_error(uint64_t a) {
68010         void* a_ptr = untag_ptr(a);
68011         CHECK_ACCESS(a_ptr);
68012         LDKDecodeError a_conv = *(LDKDecodeError*)(a_ptr);
68013         a_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(a));
68014         LDKGraphSyncError *ret_copy = MALLOC(sizeof(LDKGraphSyncError), "LDKGraphSyncError");
68015         *ret_copy = GraphSyncError_decode_error(a_conv);
68016         uint64_t ret_ref = tag_ptr(ret_copy, true);
68017         return ret_ref;
68018 }
68019
68020 uint64_t  __attribute__((export_name("TS_GraphSyncError_lightning_error"))) TS_GraphSyncError_lightning_error(uint64_t a) {
68021         LDKLightningError a_conv;
68022         a_conv.inner = untag_ptr(a);
68023         a_conv.is_owned = ptr_is_owned(a);
68024         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
68025         a_conv = LightningError_clone(&a_conv);
68026         LDKGraphSyncError *ret_copy = MALLOC(sizeof(LDKGraphSyncError), "LDKGraphSyncError");
68027         *ret_copy = GraphSyncError_lightning_error(a_conv);
68028         uint64_t ret_ref = tag_ptr(ret_copy, true);
68029         return ret_ref;
68030 }
68031
68032 void  __attribute__((export_name("TS_Bolt11ParseError_free"))) TS_Bolt11ParseError_free(uint64_t this_ptr) {
68033         if (!ptr_is_owned(this_ptr)) return;
68034         void* this_ptr_ptr = untag_ptr(this_ptr);
68035         CHECK_ACCESS(this_ptr_ptr);
68036         LDKBolt11ParseError this_ptr_conv = *(LDKBolt11ParseError*)(this_ptr_ptr);
68037         FREE(untag_ptr(this_ptr));
68038         Bolt11ParseError_free(this_ptr_conv);
68039 }
68040
68041 static inline uint64_t Bolt11ParseError_clone_ptr(LDKBolt11ParseError *NONNULL_PTR arg) {
68042         LDKBolt11ParseError *ret_copy = MALLOC(sizeof(LDKBolt11ParseError), "LDKBolt11ParseError");
68043         *ret_copy = Bolt11ParseError_clone(arg);
68044         uint64_t ret_ref = tag_ptr(ret_copy, true);
68045         return ret_ref;
68046 }
68047 int64_t  __attribute__((export_name("TS_Bolt11ParseError_clone_ptr"))) TS_Bolt11ParseError_clone_ptr(uint64_t arg) {
68048         LDKBolt11ParseError* arg_conv = (LDKBolt11ParseError*)untag_ptr(arg);
68049         int64_t ret_conv = Bolt11ParseError_clone_ptr(arg_conv);
68050         return ret_conv;
68051 }
68052
68053 uint64_t  __attribute__((export_name("TS_Bolt11ParseError_clone"))) TS_Bolt11ParseError_clone(uint64_t orig) {
68054         LDKBolt11ParseError* orig_conv = (LDKBolt11ParseError*)untag_ptr(orig);
68055         LDKBolt11ParseError *ret_copy = MALLOC(sizeof(LDKBolt11ParseError), "LDKBolt11ParseError");
68056         *ret_copy = Bolt11ParseError_clone(orig_conv);
68057         uint64_t ret_ref = tag_ptr(ret_copy, true);
68058         return ret_ref;
68059 }
68060
68061 uint64_t  __attribute__((export_name("TS_Bolt11ParseError_bech32_error"))) TS_Bolt11ParseError_bech32_error(uint64_t a) {
68062         void* a_ptr = untag_ptr(a);
68063         CHECK_ACCESS(a_ptr);
68064         LDKBech32Error a_conv = *(LDKBech32Error*)(a_ptr);
68065         a_conv = Bech32Error_clone((LDKBech32Error*)untag_ptr(a));
68066         LDKBolt11ParseError *ret_copy = MALLOC(sizeof(LDKBolt11ParseError), "LDKBolt11ParseError");
68067         *ret_copy = Bolt11ParseError_bech32_error(a_conv);
68068         uint64_t ret_ref = tag_ptr(ret_copy, true);
68069         return ret_ref;
68070 }
68071
68072 uint64_t  __attribute__((export_name("TS_Bolt11ParseError_parse_amount_error"))) TS_Bolt11ParseError_parse_amount_error(int32_t a) {
68073         
68074         LDKBolt11ParseError *ret_copy = MALLOC(sizeof(LDKBolt11ParseError), "LDKBolt11ParseError");
68075         *ret_copy = Bolt11ParseError_parse_amount_error((LDKError){ ._dummy = 0 });
68076         uint64_t ret_ref = tag_ptr(ret_copy, true);
68077         return ret_ref;
68078 }
68079
68080 uint64_t  __attribute__((export_name("TS_Bolt11ParseError_malformed_signature"))) TS_Bolt11ParseError_malformed_signature(uint32_t a) {
68081         LDKSecp256k1Error a_conv = LDKSecp256k1Error_from_js(a);
68082         LDKBolt11ParseError *ret_copy = MALLOC(sizeof(LDKBolt11ParseError), "LDKBolt11ParseError");
68083         *ret_copy = Bolt11ParseError_malformed_signature(a_conv);
68084         uint64_t ret_ref = tag_ptr(ret_copy, true);
68085         return ret_ref;
68086 }
68087
68088 uint64_t  __attribute__((export_name("TS_Bolt11ParseError_bad_prefix"))) TS_Bolt11ParseError_bad_prefix() {
68089         LDKBolt11ParseError *ret_copy = MALLOC(sizeof(LDKBolt11ParseError), "LDKBolt11ParseError");
68090         *ret_copy = Bolt11ParseError_bad_prefix();
68091         uint64_t ret_ref = tag_ptr(ret_copy, true);
68092         return ret_ref;
68093 }
68094
68095 uint64_t  __attribute__((export_name("TS_Bolt11ParseError_unknown_currency"))) TS_Bolt11ParseError_unknown_currency() {
68096         LDKBolt11ParseError *ret_copy = MALLOC(sizeof(LDKBolt11ParseError), "LDKBolt11ParseError");
68097         *ret_copy = Bolt11ParseError_unknown_currency();
68098         uint64_t ret_ref = tag_ptr(ret_copy, true);
68099         return ret_ref;
68100 }
68101
68102 uint64_t  __attribute__((export_name("TS_Bolt11ParseError_unknown_si_prefix"))) TS_Bolt11ParseError_unknown_si_prefix() {
68103         LDKBolt11ParseError *ret_copy = MALLOC(sizeof(LDKBolt11ParseError), "LDKBolt11ParseError");
68104         *ret_copy = Bolt11ParseError_unknown_si_prefix();
68105         uint64_t ret_ref = tag_ptr(ret_copy, true);
68106         return ret_ref;
68107 }
68108
68109 uint64_t  __attribute__((export_name("TS_Bolt11ParseError_malformed_hrp"))) TS_Bolt11ParseError_malformed_hrp() {
68110         LDKBolt11ParseError *ret_copy = MALLOC(sizeof(LDKBolt11ParseError), "LDKBolt11ParseError");
68111         *ret_copy = Bolt11ParseError_malformed_hrp();
68112         uint64_t ret_ref = tag_ptr(ret_copy, true);
68113         return ret_ref;
68114 }
68115
68116 uint64_t  __attribute__((export_name("TS_Bolt11ParseError_too_short_data_part"))) TS_Bolt11ParseError_too_short_data_part() {
68117         LDKBolt11ParseError *ret_copy = MALLOC(sizeof(LDKBolt11ParseError), "LDKBolt11ParseError");
68118         *ret_copy = Bolt11ParseError_too_short_data_part();
68119         uint64_t ret_ref = tag_ptr(ret_copy, true);
68120         return ret_ref;
68121 }
68122
68123 uint64_t  __attribute__((export_name("TS_Bolt11ParseError_unexpected_end_of_tagged_fields"))) TS_Bolt11ParseError_unexpected_end_of_tagged_fields() {
68124         LDKBolt11ParseError *ret_copy = MALLOC(sizeof(LDKBolt11ParseError), "LDKBolt11ParseError");
68125         *ret_copy = Bolt11ParseError_unexpected_end_of_tagged_fields();
68126         uint64_t ret_ref = tag_ptr(ret_copy, true);
68127         return ret_ref;
68128 }
68129
68130 uint64_t  __attribute__((export_name("TS_Bolt11ParseError_description_decode_error"))) TS_Bolt11ParseError_description_decode_error(int32_t a) {
68131         
68132         LDKBolt11ParseError *ret_copy = MALLOC(sizeof(LDKBolt11ParseError), "LDKBolt11ParseError");
68133         *ret_copy = Bolt11ParseError_description_decode_error((LDKError){ ._dummy = 0 });
68134         uint64_t ret_ref = tag_ptr(ret_copy, true);
68135         return ret_ref;
68136 }
68137
68138 uint64_t  __attribute__((export_name("TS_Bolt11ParseError_padding_error"))) TS_Bolt11ParseError_padding_error() {
68139         LDKBolt11ParseError *ret_copy = MALLOC(sizeof(LDKBolt11ParseError), "LDKBolt11ParseError");
68140         *ret_copy = Bolt11ParseError_padding_error();
68141         uint64_t ret_ref = tag_ptr(ret_copy, true);
68142         return ret_ref;
68143 }
68144
68145 uint64_t  __attribute__((export_name("TS_Bolt11ParseError_integer_overflow_error"))) TS_Bolt11ParseError_integer_overflow_error() {
68146         LDKBolt11ParseError *ret_copy = MALLOC(sizeof(LDKBolt11ParseError), "LDKBolt11ParseError");
68147         *ret_copy = Bolt11ParseError_integer_overflow_error();
68148         uint64_t ret_ref = tag_ptr(ret_copy, true);
68149         return ret_ref;
68150 }
68151
68152 uint64_t  __attribute__((export_name("TS_Bolt11ParseError_invalid_seg_wit_program_length"))) TS_Bolt11ParseError_invalid_seg_wit_program_length() {
68153         LDKBolt11ParseError *ret_copy = MALLOC(sizeof(LDKBolt11ParseError), "LDKBolt11ParseError");
68154         *ret_copy = Bolt11ParseError_invalid_seg_wit_program_length();
68155         uint64_t ret_ref = tag_ptr(ret_copy, true);
68156         return ret_ref;
68157 }
68158
68159 uint64_t  __attribute__((export_name("TS_Bolt11ParseError_invalid_pub_key_hash_length"))) TS_Bolt11ParseError_invalid_pub_key_hash_length() {
68160         LDKBolt11ParseError *ret_copy = MALLOC(sizeof(LDKBolt11ParseError), "LDKBolt11ParseError");
68161         *ret_copy = Bolt11ParseError_invalid_pub_key_hash_length();
68162         uint64_t ret_ref = tag_ptr(ret_copy, true);
68163         return ret_ref;
68164 }
68165
68166 uint64_t  __attribute__((export_name("TS_Bolt11ParseError_invalid_script_hash_length"))) TS_Bolt11ParseError_invalid_script_hash_length() {
68167         LDKBolt11ParseError *ret_copy = MALLOC(sizeof(LDKBolt11ParseError), "LDKBolt11ParseError");
68168         *ret_copy = Bolt11ParseError_invalid_script_hash_length();
68169         uint64_t ret_ref = tag_ptr(ret_copy, true);
68170         return ret_ref;
68171 }
68172
68173 uint64_t  __attribute__((export_name("TS_Bolt11ParseError_invalid_recovery_id"))) TS_Bolt11ParseError_invalid_recovery_id() {
68174         LDKBolt11ParseError *ret_copy = MALLOC(sizeof(LDKBolt11ParseError), "LDKBolt11ParseError");
68175         *ret_copy = Bolt11ParseError_invalid_recovery_id();
68176         uint64_t ret_ref = tag_ptr(ret_copy, true);
68177         return ret_ref;
68178 }
68179
68180 uint64_t  __attribute__((export_name("TS_Bolt11ParseError_invalid_slice_length"))) TS_Bolt11ParseError_invalid_slice_length(jstring a) {
68181         LDKStr a_conv = str_ref_to_owned_c(a);
68182         LDKBolt11ParseError *ret_copy = MALLOC(sizeof(LDKBolt11ParseError), "LDKBolt11ParseError");
68183         *ret_copy = Bolt11ParseError_invalid_slice_length(a_conv);
68184         uint64_t ret_ref = tag_ptr(ret_copy, true);
68185         return ret_ref;
68186 }
68187
68188 uint64_t  __attribute__((export_name("TS_Bolt11ParseError_skip"))) TS_Bolt11ParseError_skip() {
68189         LDKBolt11ParseError *ret_copy = MALLOC(sizeof(LDKBolt11ParseError), "LDKBolt11ParseError");
68190         *ret_copy = Bolt11ParseError_skip();
68191         uint64_t ret_ref = tag_ptr(ret_copy, true);
68192         return ret_ref;
68193 }
68194
68195 jboolean  __attribute__((export_name("TS_Bolt11ParseError_eq"))) TS_Bolt11ParseError_eq(uint64_t a, uint64_t b) {
68196         LDKBolt11ParseError* a_conv = (LDKBolt11ParseError*)untag_ptr(a);
68197         LDKBolt11ParseError* b_conv = (LDKBolt11ParseError*)untag_ptr(b);
68198         jboolean ret_conv = Bolt11ParseError_eq(a_conv, b_conv);
68199         return ret_conv;
68200 }
68201
68202 void  __attribute__((export_name("TS_ParseOrSemanticError_free"))) TS_ParseOrSemanticError_free(uint64_t this_ptr) {
68203         if (!ptr_is_owned(this_ptr)) return;
68204         void* this_ptr_ptr = untag_ptr(this_ptr);
68205         CHECK_ACCESS(this_ptr_ptr);
68206         LDKParseOrSemanticError this_ptr_conv = *(LDKParseOrSemanticError*)(this_ptr_ptr);
68207         FREE(untag_ptr(this_ptr));
68208         ParseOrSemanticError_free(this_ptr_conv);
68209 }
68210
68211 static inline uint64_t ParseOrSemanticError_clone_ptr(LDKParseOrSemanticError *NONNULL_PTR arg) {
68212         LDKParseOrSemanticError *ret_copy = MALLOC(sizeof(LDKParseOrSemanticError), "LDKParseOrSemanticError");
68213         *ret_copy = ParseOrSemanticError_clone(arg);
68214         uint64_t ret_ref = tag_ptr(ret_copy, true);
68215         return ret_ref;
68216 }
68217 int64_t  __attribute__((export_name("TS_ParseOrSemanticError_clone_ptr"))) TS_ParseOrSemanticError_clone_ptr(uint64_t arg) {
68218         LDKParseOrSemanticError* arg_conv = (LDKParseOrSemanticError*)untag_ptr(arg);
68219         int64_t ret_conv = ParseOrSemanticError_clone_ptr(arg_conv);
68220         return ret_conv;
68221 }
68222
68223 uint64_t  __attribute__((export_name("TS_ParseOrSemanticError_clone"))) TS_ParseOrSemanticError_clone(uint64_t orig) {
68224         LDKParseOrSemanticError* orig_conv = (LDKParseOrSemanticError*)untag_ptr(orig);
68225         LDKParseOrSemanticError *ret_copy = MALLOC(sizeof(LDKParseOrSemanticError), "LDKParseOrSemanticError");
68226         *ret_copy = ParseOrSemanticError_clone(orig_conv);
68227         uint64_t ret_ref = tag_ptr(ret_copy, true);
68228         return ret_ref;
68229 }
68230
68231 uint64_t  __attribute__((export_name("TS_ParseOrSemanticError_parse_error"))) TS_ParseOrSemanticError_parse_error(uint64_t a) {
68232         void* a_ptr = untag_ptr(a);
68233         CHECK_ACCESS(a_ptr);
68234         LDKBolt11ParseError a_conv = *(LDKBolt11ParseError*)(a_ptr);
68235         a_conv = Bolt11ParseError_clone((LDKBolt11ParseError*)untag_ptr(a));
68236         LDKParseOrSemanticError *ret_copy = MALLOC(sizeof(LDKParseOrSemanticError), "LDKParseOrSemanticError");
68237         *ret_copy = ParseOrSemanticError_parse_error(a_conv);
68238         uint64_t ret_ref = tag_ptr(ret_copy, true);
68239         return ret_ref;
68240 }
68241
68242 uint64_t  __attribute__((export_name("TS_ParseOrSemanticError_semantic_error"))) TS_ParseOrSemanticError_semantic_error(uint32_t a) {
68243         LDKBolt11SemanticError a_conv = LDKBolt11SemanticError_from_js(a);
68244         LDKParseOrSemanticError *ret_copy = MALLOC(sizeof(LDKParseOrSemanticError), "LDKParseOrSemanticError");
68245         *ret_copy = ParseOrSemanticError_semantic_error(a_conv);
68246         uint64_t ret_ref = tag_ptr(ret_copy, true);
68247         return ret_ref;
68248 }
68249
68250 jboolean  __attribute__((export_name("TS_ParseOrSemanticError_eq"))) TS_ParseOrSemanticError_eq(uint64_t a, uint64_t b) {
68251         LDKParseOrSemanticError* a_conv = (LDKParseOrSemanticError*)untag_ptr(a);
68252         LDKParseOrSemanticError* b_conv = (LDKParseOrSemanticError*)untag_ptr(b);
68253         jboolean ret_conv = ParseOrSemanticError_eq(a_conv, b_conv);
68254         return ret_conv;
68255 }
68256
68257 void  __attribute__((export_name("TS_Bolt11Invoice_free"))) TS_Bolt11Invoice_free(uint64_t this_obj) {
68258         LDKBolt11Invoice this_obj_conv;
68259         this_obj_conv.inner = untag_ptr(this_obj);
68260         this_obj_conv.is_owned = ptr_is_owned(this_obj);
68261         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
68262         Bolt11Invoice_free(this_obj_conv);
68263 }
68264
68265 jboolean  __attribute__((export_name("TS_Bolt11Invoice_eq"))) TS_Bolt11Invoice_eq(uint64_t a, uint64_t b) {
68266         LDKBolt11Invoice a_conv;
68267         a_conv.inner = untag_ptr(a);
68268         a_conv.is_owned = ptr_is_owned(a);
68269         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
68270         a_conv.is_owned = false;
68271         LDKBolt11Invoice b_conv;
68272         b_conv.inner = untag_ptr(b);
68273         b_conv.is_owned = ptr_is_owned(b);
68274         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
68275         b_conv.is_owned = false;
68276         jboolean ret_conv = Bolt11Invoice_eq(&a_conv, &b_conv);
68277         return ret_conv;
68278 }
68279
68280 static inline uint64_t Bolt11Invoice_clone_ptr(LDKBolt11Invoice *NONNULL_PTR arg) {
68281         LDKBolt11Invoice ret_var = Bolt11Invoice_clone(arg);
68282         uint64_t ret_ref = 0;
68283         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
68284         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
68285         return ret_ref;
68286 }
68287 int64_t  __attribute__((export_name("TS_Bolt11Invoice_clone_ptr"))) TS_Bolt11Invoice_clone_ptr(uint64_t arg) {
68288         LDKBolt11Invoice arg_conv;
68289         arg_conv.inner = untag_ptr(arg);
68290         arg_conv.is_owned = ptr_is_owned(arg);
68291         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
68292         arg_conv.is_owned = false;
68293         int64_t ret_conv = Bolt11Invoice_clone_ptr(&arg_conv);
68294         return ret_conv;
68295 }
68296
68297 uint64_t  __attribute__((export_name("TS_Bolt11Invoice_clone"))) TS_Bolt11Invoice_clone(uint64_t orig) {
68298         LDKBolt11Invoice orig_conv;
68299         orig_conv.inner = untag_ptr(orig);
68300         orig_conv.is_owned = ptr_is_owned(orig);
68301         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
68302         orig_conv.is_owned = false;
68303         LDKBolt11Invoice ret_var = Bolt11Invoice_clone(&orig_conv);
68304         uint64_t ret_ref = 0;
68305         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
68306         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
68307         return ret_ref;
68308 }
68309
68310 int64_t  __attribute__((export_name("TS_Bolt11Invoice_hash"))) TS_Bolt11Invoice_hash(uint64_t o) {
68311         LDKBolt11Invoice o_conv;
68312         o_conv.inner = untag_ptr(o);
68313         o_conv.is_owned = ptr_is_owned(o);
68314         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
68315         o_conv.is_owned = false;
68316         int64_t ret_conv = Bolt11Invoice_hash(&o_conv);
68317         return ret_conv;
68318 }
68319
68320 void  __attribute__((export_name("TS_SignedRawBolt11Invoice_free"))) TS_SignedRawBolt11Invoice_free(uint64_t this_obj) {
68321         LDKSignedRawBolt11Invoice this_obj_conv;
68322         this_obj_conv.inner = untag_ptr(this_obj);
68323         this_obj_conv.is_owned = ptr_is_owned(this_obj);
68324         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
68325         SignedRawBolt11Invoice_free(this_obj_conv);
68326 }
68327
68328 jboolean  __attribute__((export_name("TS_SignedRawBolt11Invoice_eq"))) TS_SignedRawBolt11Invoice_eq(uint64_t a, uint64_t b) {
68329         LDKSignedRawBolt11Invoice a_conv;
68330         a_conv.inner = untag_ptr(a);
68331         a_conv.is_owned = ptr_is_owned(a);
68332         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
68333         a_conv.is_owned = false;
68334         LDKSignedRawBolt11Invoice b_conv;
68335         b_conv.inner = untag_ptr(b);
68336         b_conv.is_owned = ptr_is_owned(b);
68337         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
68338         b_conv.is_owned = false;
68339         jboolean ret_conv = SignedRawBolt11Invoice_eq(&a_conv, &b_conv);
68340         return ret_conv;
68341 }
68342
68343 static inline uint64_t SignedRawBolt11Invoice_clone_ptr(LDKSignedRawBolt11Invoice *NONNULL_PTR arg) {
68344         LDKSignedRawBolt11Invoice ret_var = SignedRawBolt11Invoice_clone(arg);
68345         uint64_t ret_ref = 0;
68346         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
68347         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
68348         return ret_ref;
68349 }
68350 int64_t  __attribute__((export_name("TS_SignedRawBolt11Invoice_clone_ptr"))) TS_SignedRawBolt11Invoice_clone_ptr(uint64_t arg) {
68351         LDKSignedRawBolt11Invoice arg_conv;
68352         arg_conv.inner = untag_ptr(arg);
68353         arg_conv.is_owned = ptr_is_owned(arg);
68354         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
68355         arg_conv.is_owned = false;
68356         int64_t ret_conv = SignedRawBolt11Invoice_clone_ptr(&arg_conv);
68357         return ret_conv;
68358 }
68359
68360 uint64_t  __attribute__((export_name("TS_SignedRawBolt11Invoice_clone"))) TS_SignedRawBolt11Invoice_clone(uint64_t orig) {
68361         LDKSignedRawBolt11Invoice orig_conv;
68362         orig_conv.inner = untag_ptr(orig);
68363         orig_conv.is_owned = ptr_is_owned(orig);
68364         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
68365         orig_conv.is_owned = false;
68366         LDKSignedRawBolt11Invoice ret_var = SignedRawBolt11Invoice_clone(&orig_conv);
68367         uint64_t ret_ref = 0;
68368         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
68369         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
68370         return ret_ref;
68371 }
68372
68373 int64_t  __attribute__((export_name("TS_SignedRawBolt11Invoice_hash"))) TS_SignedRawBolt11Invoice_hash(uint64_t o) {
68374         LDKSignedRawBolt11Invoice o_conv;
68375         o_conv.inner = untag_ptr(o);
68376         o_conv.is_owned = ptr_is_owned(o);
68377         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
68378         o_conv.is_owned = false;
68379         int64_t ret_conv = SignedRawBolt11Invoice_hash(&o_conv);
68380         return ret_conv;
68381 }
68382
68383 void  __attribute__((export_name("TS_RawBolt11Invoice_free"))) TS_RawBolt11Invoice_free(uint64_t this_obj) {
68384         LDKRawBolt11Invoice this_obj_conv;
68385         this_obj_conv.inner = untag_ptr(this_obj);
68386         this_obj_conv.is_owned = ptr_is_owned(this_obj);
68387         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
68388         RawBolt11Invoice_free(this_obj_conv);
68389 }
68390
68391 uint64_t  __attribute__((export_name("TS_RawBolt11Invoice_get_data"))) TS_RawBolt11Invoice_get_data(uint64_t this_ptr) {
68392         LDKRawBolt11Invoice this_ptr_conv;
68393         this_ptr_conv.inner = untag_ptr(this_ptr);
68394         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
68395         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
68396         this_ptr_conv.is_owned = false;
68397         LDKRawDataPart ret_var = RawBolt11Invoice_get_data(&this_ptr_conv);
68398         uint64_t ret_ref = 0;
68399         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
68400         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
68401         return ret_ref;
68402 }
68403
68404 void  __attribute__((export_name("TS_RawBolt11Invoice_set_data"))) TS_RawBolt11Invoice_set_data(uint64_t this_ptr, uint64_t val) {
68405         LDKRawBolt11Invoice this_ptr_conv;
68406         this_ptr_conv.inner = untag_ptr(this_ptr);
68407         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
68408         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
68409         this_ptr_conv.is_owned = false;
68410         LDKRawDataPart val_conv;
68411         val_conv.inner = untag_ptr(val);
68412         val_conv.is_owned = ptr_is_owned(val);
68413         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
68414         val_conv = RawDataPart_clone(&val_conv);
68415         RawBolt11Invoice_set_data(&this_ptr_conv, val_conv);
68416 }
68417
68418 jboolean  __attribute__((export_name("TS_RawBolt11Invoice_eq"))) TS_RawBolt11Invoice_eq(uint64_t a, uint64_t b) {
68419         LDKRawBolt11Invoice a_conv;
68420         a_conv.inner = untag_ptr(a);
68421         a_conv.is_owned = ptr_is_owned(a);
68422         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
68423         a_conv.is_owned = false;
68424         LDKRawBolt11Invoice b_conv;
68425         b_conv.inner = untag_ptr(b);
68426         b_conv.is_owned = ptr_is_owned(b);
68427         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
68428         b_conv.is_owned = false;
68429         jboolean ret_conv = RawBolt11Invoice_eq(&a_conv, &b_conv);
68430         return ret_conv;
68431 }
68432
68433 static inline uint64_t RawBolt11Invoice_clone_ptr(LDKRawBolt11Invoice *NONNULL_PTR arg) {
68434         LDKRawBolt11Invoice ret_var = RawBolt11Invoice_clone(arg);
68435         uint64_t ret_ref = 0;
68436         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
68437         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
68438         return ret_ref;
68439 }
68440 int64_t  __attribute__((export_name("TS_RawBolt11Invoice_clone_ptr"))) TS_RawBolt11Invoice_clone_ptr(uint64_t arg) {
68441         LDKRawBolt11Invoice arg_conv;
68442         arg_conv.inner = untag_ptr(arg);
68443         arg_conv.is_owned = ptr_is_owned(arg);
68444         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
68445         arg_conv.is_owned = false;
68446         int64_t ret_conv = RawBolt11Invoice_clone_ptr(&arg_conv);
68447         return ret_conv;
68448 }
68449
68450 uint64_t  __attribute__((export_name("TS_RawBolt11Invoice_clone"))) TS_RawBolt11Invoice_clone(uint64_t orig) {
68451         LDKRawBolt11Invoice orig_conv;
68452         orig_conv.inner = untag_ptr(orig);
68453         orig_conv.is_owned = ptr_is_owned(orig);
68454         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
68455         orig_conv.is_owned = false;
68456         LDKRawBolt11Invoice ret_var = RawBolt11Invoice_clone(&orig_conv);
68457         uint64_t ret_ref = 0;
68458         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
68459         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
68460         return ret_ref;
68461 }
68462
68463 int64_t  __attribute__((export_name("TS_RawBolt11Invoice_hash"))) TS_RawBolt11Invoice_hash(uint64_t o) {
68464         LDKRawBolt11Invoice o_conv;
68465         o_conv.inner = untag_ptr(o);
68466         o_conv.is_owned = ptr_is_owned(o);
68467         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
68468         o_conv.is_owned = false;
68469         int64_t ret_conv = RawBolt11Invoice_hash(&o_conv);
68470         return ret_conv;
68471 }
68472
68473 void  __attribute__((export_name("TS_RawDataPart_free"))) TS_RawDataPart_free(uint64_t this_obj) {
68474         LDKRawDataPart this_obj_conv;
68475         this_obj_conv.inner = untag_ptr(this_obj);
68476         this_obj_conv.is_owned = ptr_is_owned(this_obj);
68477         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
68478         RawDataPart_free(this_obj_conv);
68479 }
68480
68481 uint64_t  __attribute__((export_name("TS_RawDataPart_get_timestamp"))) TS_RawDataPart_get_timestamp(uint64_t this_ptr) {
68482         LDKRawDataPart this_ptr_conv;
68483         this_ptr_conv.inner = untag_ptr(this_ptr);
68484         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
68485         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
68486         this_ptr_conv.is_owned = false;
68487         LDKPositiveTimestamp ret_var = RawDataPart_get_timestamp(&this_ptr_conv);
68488         uint64_t ret_ref = 0;
68489         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
68490         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
68491         return ret_ref;
68492 }
68493
68494 void  __attribute__((export_name("TS_RawDataPart_set_timestamp"))) TS_RawDataPart_set_timestamp(uint64_t this_ptr, uint64_t val) {
68495         LDKRawDataPart this_ptr_conv;
68496         this_ptr_conv.inner = untag_ptr(this_ptr);
68497         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
68498         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
68499         this_ptr_conv.is_owned = false;
68500         LDKPositiveTimestamp val_conv;
68501         val_conv.inner = untag_ptr(val);
68502         val_conv.is_owned = ptr_is_owned(val);
68503         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
68504         val_conv = PositiveTimestamp_clone(&val_conv);
68505         RawDataPart_set_timestamp(&this_ptr_conv, val_conv);
68506 }
68507
68508 jboolean  __attribute__((export_name("TS_RawDataPart_eq"))) TS_RawDataPart_eq(uint64_t a, uint64_t b) {
68509         LDKRawDataPart a_conv;
68510         a_conv.inner = untag_ptr(a);
68511         a_conv.is_owned = ptr_is_owned(a);
68512         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
68513         a_conv.is_owned = false;
68514         LDKRawDataPart b_conv;
68515         b_conv.inner = untag_ptr(b);
68516         b_conv.is_owned = ptr_is_owned(b);
68517         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
68518         b_conv.is_owned = false;
68519         jboolean ret_conv = RawDataPart_eq(&a_conv, &b_conv);
68520         return ret_conv;
68521 }
68522
68523 static inline uint64_t RawDataPart_clone_ptr(LDKRawDataPart *NONNULL_PTR arg) {
68524         LDKRawDataPart ret_var = RawDataPart_clone(arg);
68525         uint64_t ret_ref = 0;
68526         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
68527         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
68528         return ret_ref;
68529 }
68530 int64_t  __attribute__((export_name("TS_RawDataPart_clone_ptr"))) TS_RawDataPart_clone_ptr(uint64_t arg) {
68531         LDKRawDataPart arg_conv;
68532         arg_conv.inner = untag_ptr(arg);
68533         arg_conv.is_owned = ptr_is_owned(arg);
68534         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
68535         arg_conv.is_owned = false;
68536         int64_t ret_conv = RawDataPart_clone_ptr(&arg_conv);
68537         return ret_conv;
68538 }
68539
68540 uint64_t  __attribute__((export_name("TS_RawDataPart_clone"))) TS_RawDataPart_clone(uint64_t orig) {
68541         LDKRawDataPart orig_conv;
68542         orig_conv.inner = untag_ptr(orig);
68543         orig_conv.is_owned = ptr_is_owned(orig);
68544         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
68545         orig_conv.is_owned = false;
68546         LDKRawDataPart ret_var = RawDataPart_clone(&orig_conv);
68547         uint64_t ret_ref = 0;
68548         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
68549         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
68550         return ret_ref;
68551 }
68552
68553 int64_t  __attribute__((export_name("TS_RawDataPart_hash"))) TS_RawDataPart_hash(uint64_t o) {
68554         LDKRawDataPart o_conv;
68555         o_conv.inner = untag_ptr(o);
68556         o_conv.is_owned = ptr_is_owned(o);
68557         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
68558         o_conv.is_owned = false;
68559         int64_t ret_conv = RawDataPart_hash(&o_conv);
68560         return ret_conv;
68561 }
68562
68563 void  __attribute__((export_name("TS_PositiveTimestamp_free"))) TS_PositiveTimestamp_free(uint64_t this_obj) {
68564         LDKPositiveTimestamp this_obj_conv;
68565         this_obj_conv.inner = untag_ptr(this_obj);
68566         this_obj_conv.is_owned = ptr_is_owned(this_obj);
68567         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
68568         PositiveTimestamp_free(this_obj_conv);
68569 }
68570
68571 jboolean  __attribute__((export_name("TS_PositiveTimestamp_eq"))) TS_PositiveTimestamp_eq(uint64_t a, uint64_t b) {
68572         LDKPositiveTimestamp a_conv;
68573         a_conv.inner = untag_ptr(a);
68574         a_conv.is_owned = ptr_is_owned(a);
68575         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
68576         a_conv.is_owned = false;
68577         LDKPositiveTimestamp b_conv;
68578         b_conv.inner = untag_ptr(b);
68579         b_conv.is_owned = ptr_is_owned(b);
68580         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
68581         b_conv.is_owned = false;
68582         jboolean ret_conv = PositiveTimestamp_eq(&a_conv, &b_conv);
68583         return ret_conv;
68584 }
68585
68586 static inline uint64_t PositiveTimestamp_clone_ptr(LDKPositiveTimestamp *NONNULL_PTR arg) {
68587         LDKPositiveTimestamp ret_var = PositiveTimestamp_clone(arg);
68588         uint64_t ret_ref = 0;
68589         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
68590         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
68591         return ret_ref;
68592 }
68593 int64_t  __attribute__((export_name("TS_PositiveTimestamp_clone_ptr"))) TS_PositiveTimestamp_clone_ptr(uint64_t arg) {
68594         LDKPositiveTimestamp arg_conv;
68595         arg_conv.inner = untag_ptr(arg);
68596         arg_conv.is_owned = ptr_is_owned(arg);
68597         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
68598         arg_conv.is_owned = false;
68599         int64_t ret_conv = PositiveTimestamp_clone_ptr(&arg_conv);
68600         return ret_conv;
68601 }
68602
68603 uint64_t  __attribute__((export_name("TS_PositiveTimestamp_clone"))) TS_PositiveTimestamp_clone(uint64_t orig) {
68604         LDKPositiveTimestamp orig_conv;
68605         orig_conv.inner = untag_ptr(orig);
68606         orig_conv.is_owned = ptr_is_owned(orig);
68607         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
68608         orig_conv.is_owned = false;
68609         LDKPositiveTimestamp ret_var = PositiveTimestamp_clone(&orig_conv);
68610         uint64_t ret_ref = 0;
68611         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
68612         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
68613         return ret_ref;
68614 }
68615
68616 int64_t  __attribute__((export_name("TS_PositiveTimestamp_hash"))) TS_PositiveTimestamp_hash(uint64_t o) {
68617         LDKPositiveTimestamp o_conv;
68618         o_conv.inner = untag_ptr(o);
68619         o_conv.is_owned = ptr_is_owned(o);
68620         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
68621         o_conv.is_owned = false;
68622         int64_t ret_conv = PositiveTimestamp_hash(&o_conv);
68623         return ret_conv;
68624 }
68625
68626 uint32_t  __attribute__((export_name("TS_SiPrefix_clone"))) TS_SiPrefix_clone(uint64_t orig) {
68627         LDKSiPrefix* orig_conv = (LDKSiPrefix*)untag_ptr(orig);
68628         uint32_t ret_conv = LDKSiPrefix_to_js(SiPrefix_clone(orig_conv));
68629         return ret_conv;
68630 }
68631
68632 uint32_t  __attribute__((export_name("TS_SiPrefix_milli"))) TS_SiPrefix_milli() {
68633         uint32_t ret_conv = LDKSiPrefix_to_js(SiPrefix_milli());
68634         return ret_conv;
68635 }
68636
68637 uint32_t  __attribute__((export_name("TS_SiPrefix_micro"))) TS_SiPrefix_micro() {
68638         uint32_t ret_conv = LDKSiPrefix_to_js(SiPrefix_micro());
68639         return ret_conv;
68640 }
68641
68642 uint32_t  __attribute__((export_name("TS_SiPrefix_nano"))) TS_SiPrefix_nano() {
68643         uint32_t ret_conv = LDKSiPrefix_to_js(SiPrefix_nano());
68644         return ret_conv;
68645 }
68646
68647 uint32_t  __attribute__((export_name("TS_SiPrefix_pico"))) TS_SiPrefix_pico() {
68648         uint32_t ret_conv = LDKSiPrefix_to_js(SiPrefix_pico());
68649         return ret_conv;
68650 }
68651
68652 jboolean  __attribute__((export_name("TS_SiPrefix_eq"))) TS_SiPrefix_eq(uint64_t a, uint64_t b) {
68653         LDKSiPrefix* a_conv = (LDKSiPrefix*)untag_ptr(a);
68654         LDKSiPrefix* b_conv = (LDKSiPrefix*)untag_ptr(b);
68655         jboolean ret_conv = SiPrefix_eq(a_conv, b_conv);
68656         return ret_conv;
68657 }
68658
68659 int64_t  __attribute__((export_name("TS_SiPrefix_hash"))) TS_SiPrefix_hash(uint64_t o) {
68660         LDKSiPrefix* o_conv = (LDKSiPrefix*)untag_ptr(o);
68661         int64_t ret_conv = SiPrefix_hash(o_conv);
68662         return ret_conv;
68663 }
68664
68665 int64_t  __attribute__((export_name("TS_SiPrefix_multiplier"))) TS_SiPrefix_multiplier(uint64_t this_arg) {
68666         LDKSiPrefix* this_arg_conv = (LDKSiPrefix*)untag_ptr(this_arg);
68667         int64_t ret_conv = SiPrefix_multiplier(this_arg_conv);
68668         return ret_conv;
68669 }
68670
68671 uint32_t  __attribute__((export_name("TS_Currency_clone"))) TS_Currency_clone(uint64_t orig) {
68672         LDKCurrency* orig_conv = (LDKCurrency*)untag_ptr(orig);
68673         uint32_t ret_conv = LDKCurrency_to_js(Currency_clone(orig_conv));
68674         return ret_conv;
68675 }
68676
68677 uint32_t  __attribute__((export_name("TS_Currency_bitcoin"))) TS_Currency_bitcoin() {
68678         uint32_t ret_conv = LDKCurrency_to_js(Currency_bitcoin());
68679         return ret_conv;
68680 }
68681
68682 uint32_t  __attribute__((export_name("TS_Currency_bitcoin_testnet"))) TS_Currency_bitcoin_testnet() {
68683         uint32_t ret_conv = LDKCurrency_to_js(Currency_bitcoin_testnet());
68684         return ret_conv;
68685 }
68686
68687 uint32_t  __attribute__((export_name("TS_Currency_regtest"))) TS_Currency_regtest() {
68688         uint32_t ret_conv = LDKCurrency_to_js(Currency_regtest());
68689         return ret_conv;
68690 }
68691
68692 uint32_t  __attribute__((export_name("TS_Currency_simnet"))) TS_Currency_simnet() {
68693         uint32_t ret_conv = LDKCurrency_to_js(Currency_simnet());
68694         return ret_conv;
68695 }
68696
68697 uint32_t  __attribute__((export_name("TS_Currency_signet"))) TS_Currency_signet() {
68698         uint32_t ret_conv = LDKCurrency_to_js(Currency_signet());
68699         return ret_conv;
68700 }
68701
68702 int64_t  __attribute__((export_name("TS_Currency_hash"))) TS_Currency_hash(uint64_t o) {
68703         LDKCurrency* o_conv = (LDKCurrency*)untag_ptr(o);
68704         int64_t ret_conv = Currency_hash(o_conv);
68705         return ret_conv;
68706 }
68707
68708 jboolean  __attribute__((export_name("TS_Currency_eq"))) TS_Currency_eq(uint64_t a, uint64_t b) {
68709         LDKCurrency* a_conv = (LDKCurrency*)untag_ptr(a);
68710         LDKCurrency* b_conv = (LDKCurrency*)untag_ptr(b);
68711         jboolean ret_conv = Currency_eq(a_conv, b_conv);
68712         return ret_conv;
68713 }
68714
68715 void  __attribute__((export_name("TS_Sha256_free"))) TS_Sha256_free(uint64_t this_obj) {
68716         LDKSha256 this_obj_conv;
68717         this_obj_conv.inner = untag_ptr(this_obj);
68718         this_obj_conv.is_owned = ptr_is_owned(this_obj);
68719         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
68720         Sha256_free(this_obj_conv);
68721 }
68722
68723 static inline uint64_t Sha256_clone_ptr(LDKSha256 *NONNULL_PTR arg) {
68724         LDKSha256 ret_var = Sha256_clone(arg);
68725         uint64_t ret_ref = 0;
68726         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
68727         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
68728         return ret_ref;
68729 }
68730 int64_t  __attribute__((export_name("TS_Sha256_clone_ptr"))) TS_Sha256_clone_ptr(uint64_t arg) {
68731         LDKSha256 arg_conv;
68732         arg_conv.inner = untag_ptr(arg);
68733         arg_conv.is_owned = ptr_is_owned(arg);
68734         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
68735         arg_conv.is_owned = false;
68736         int64_t ret_conv = Sha256_clone_ptr(&arg_conv);
68737         return ret_conv;
68738 }
68739
68740 uint64_t  __attribute__((export_name("TS_Sha256_clone"))) TS_Sha256_clone(uint64_t orig) {
68741         LDKSha256 orig_conv;
68742         orig_conv.inner = untag_ptr(orig);
68743         orig_conv.is_owned = ptr_is_owned(orig);
68744         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
68745         orig_conv.is_owned = false;
68746         LDKSha256 ret_var = Sha256_clone(&orig_conv);
68747         uint64_t ret_ref = 0;
68748         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
68749         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
68750         return ret_ref;
68751 }
68752
68753 int64_t  __attribute__((export_name("TS_Sha256_hash"))) TS_Sha256_hash(uint64_t o) {
68754         LDKSha256 o_conv;
68755         o_conv.inner = untag_ptr(o);
68756         o_conv.is_owned = ptr_is_owned(o);
68757         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
68758         o_conv.is_owned = false;
68759         int64_t ret_conv = Sha256_hash(&o_conv);
68760         return ret_conv;
68761 }
68762
68763 jboolean  __attribute__((export_name("TS_Sha256_eq"))) TS_Sha256_eq(uint64_t a, uint64_t b) {
68764         LDKSha256 a_conv;
68765         a_conv.inner = untag_ptr(a);
68766         a_conv.is_owned = ptr_is_owned(a);
68767         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
68768         a_conv.is_owned = false;
68769         LDKSha256 b_conv;
68770         b_conv.inner = untag_ptr(b);
68771         b_conv.is_owned = ptr_is_owned(b);
68772         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
68773         b_conv.is_owned = false;
68774         jboolean ret_conv = Sha256_eq(&a_conv, &b_conv);
68775         return ret_conv;
68776 }
68777
68778 uint64_t  __attribute__((export_name("TS_Sha256_from_bytes"))) TS_Sha256_from_bytes(int8_tArray bytes) {
68779         uint8_t bytes_arr[32];
68780         CHECK(bytes->arr_len == 32);
68781         memcpy(bytes_arr, bytes->elems, 32); FREE(bytes);
68782         uint8_t (*bytes_ref)[32] = &bytes_arr;
68783         LDKSha256 ret_var = Sha256_from_bytes(bytes_ref);
68784         uint64_t ret_ref = 0;
68785         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
68786         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
68787         return ret_ref;
68788 }
68789
68790 void  __attribute__((export_name("TS_Description_free"))) TS_Description_free(uint64_t this_obj) {
68791         LDKDescription this_obj_conv;
68792         this_obj_conv.inner = untag_ptr(this_obj);
68793         this_obj_conv.is_owned = ptr_is_owned(this_obj);
68794         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
68795         Description_free(this_obj_conv);
68796 }
68797
68798 static inline uint64_t Description_clone_ptr(LDKDescription *NONNULL_PTR arg) {
68799         LDKDescription ret_var = Description_clone(arg);
68800         uint64_t ret_ref = 0;
68801         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
68802         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
68803         return ret_ref;
68804 }
68805 int64_t  __attribute__((export_name("TS_Description_clone_ptr"))) TS_Description_clone_ptr(uint64_t arg) {
68806         LDKDescription arg_conv;
68807         arg_conv.inner = untag_ptr(arg);
68808         arg_conv.is_owned = ptr_is_owned(arg);
68809         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
68810         arg_conv.is_owned = false;
68811         int64_t ret_conv = Description_clone_ptr(&arg_conv);
68812         return ret_conv;
68813 }
68814
68815 uint64_t  __attribute__((export_name("TS_Description_clone"))) TS_Description_clone(uint64_t orig) {
68816         LDKDescription orig_conv;
68817         orig_conv.inner = untag_ptr(orig);
68818         orig_conv.is_owned = ptr_is_owned(orig);
68819         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
68820         orig_conv.is_owned = false;
68821         LDKDescription ret_var = Description_clone(&orig_conv);
68822         uint64_t ret_ref = 0;
68823         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
68824         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
68825         return ret_ref;
68826 }
68827
68828 int64_t  __attribute__((export_name("TS_Description_hash"))) TS_Description_hash(uint64_t o) {
68829         LDKDescription o_conv;
68830         o_conv.inner = untag_ptr(o);
68831         o_conv.is_owned = ptr_is_owned(o);
68832         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
68833         o_conv.is_owned = false;
68834         int64_t ret_conv = Description_hash(&o_conv);
68835         return ret_conv;
68836 }
68837
68838 jboolean  __attribute__((export_name("TS_Description_eq"))) TS_Description_eq(uint64_t a, uint64_t b) {
68839         LDKDescription a_conv;
68840         a_conv.inner = untag_ptr(a);
68841         a_conv.is_owned = ptr_is_owned(a);
68842         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
68843         a_conv.is_owned = false;
68844         LDKDescription b_conv;
68845         b_conv.inner = untag_ptr(b);
68846         b_conv.is_owned = ptr_is_owned(b);
68847         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
68848         b_conv.is_owned = false;
68849         jboolean ret_conv = Description_eq(&a_conv, &b_conv);
68850         return ret_conv;
68851 }
68852
68853 void  __attribute__((export_name("TS_PayeePubKey_free"))) TS_PayeePubKey_free(uint64_t this_obj) {
68854         LDKPayeePubKey this_obj_conv;
68855         this_obj_conv.inner = untag_ptr(this_obj);
68856         this_obj_conv.is_owned = ptr_is_owned(this_obj);
68857         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
68858         PayeePubKey_free(this_obj_conv);
68859 }
68860
68861 int8_tArray  __attribute__((export_name("TS_PayeePubKey_get_a"))) TS_PayeePubKey_get_a(uint64_t this_ptr) {
68862         LDKPayeePubKey this_ptr_conv;
68863         this_ptr_conv.inner = untag_ptr(this_ptr);
68864         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
68865         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
68866         this_ptr_conv.is_owned = false;
68867         int8_tArray ret_arr = init_int8_tArray(33, __LINE__);
68868         memcpy(ret_arr->elems, PayeePubKey_get_a(&this_ptr_conv).compressed_form, 33);
68869         return ret_arr;
68870 }
68871
68872 void  __attribute__((export_name("TS_PayeePubKey_set_a"))) TS_PayeePubKey_set_a(uint64_t this_ptr, int8_tArray val) {
68873         LDKPayeePubKey this_ptr_conv;
68874         this_ptr_conv.inner = untag_ptr(this_ptr);
68875         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
68876         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
68877         this_ptr_conv.is_owned = false;
68878         LDKPublicKey val_ref;
68879         CHECK(val->arr_len == 33);
68880         memcpy(val_ref.compressed_form, val->elems, 33); FREE(val);
68881         PayeePubKey_set_a(&this_ptr_conv, val_ref);
68882 }
68883
68884 uint64_t  __attribute__((export_name("TS_PayeePubKey_new"))) TS_PayeePubKey_new(int8_tArray a_arg) {
68885         LDKPublicKey a_arg_ref;
68886         CHECK(a_arg->arr_len == 33);
68887         memcpy(a_arg_ref.compressed_form, a_arg->elems, 33); FREE(a_arg);
68888         LDKPayeePubKey ret_var = PayeePubKey_new(a_arg_ref);
68889         uint64_t ret_ref = 0;
68890         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
68891         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
68892         return ret_ref;
68893 }
68894
68895 static inline uint64_t PayeePubKey_clone_ptr(LDKPayeePubKey *NONNULL_PTR arg) {
68896         LDKPayeePubKey ret_var = PayeePubKey_clone(arg);
68897         uint64_t ret_ref = 0;
68898         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
68899         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
68900         return ret_ref;
68901 }
68902 int64_t  __attribute__((export_name("TS_PayeePubKey_clone_ptr"))) TS_PayeePubKey_clone_ptr(uint64_t arg) {
68903         LDKPayeePubKey arg_conv;
68904         arg_conv.inner = untag_ptr(arg);
68905         arg_conv.is_owned = ptr_is_owned(arg);
68906         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
68907         arg_conv.is_owned = false;
68908         int64_t ret_conv = PayeePubKey_clone_ptr(&arg_conv);
68909         return ret_conv;
68910 }
68911
68912 uint64_t  __attribute__((export_name("TS_PayeePubKey_clone"))) TS_PayeePubKey_clone(uint64_t orig) {
68913         LDKPayeePubKey orig_conv;
68914         orig_conv.inner = untag_ptr(orig);
68915         orig_conv.is_owned = ptr_is_owned(orig);
68916         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
68917         orig_conv.is_owned = false;
68918         LDKPayeePubKey ret_var = PayeePubKey_clone(&orig_conv);
68919         uint64_t ret_ref = 0;
68920         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
68921         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
68922         return ret_ref;
68923 }
68924
68925 int64_t  __attribute__((export_name("TS_PayeePubKey_hash"))) TS_PayeePubKey_hash(uint64_t o) {
68926         LDKPayeePubKey o_conv;
68927         o_conv.inner = untag_ptr(o);
68928         o_conv.is_owned = ptr_is_owned(o);
68929         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
68930         o_conv.is_owned = false;
68931         int64_t ret_conv = PayeePubKey_hash(&o_conv);
68932         return ret_conv;
68933 }
68934
68935 jboolean  __attribute__((export_name("TS_PayeePubKey_eq"))) TS_PayeePubKey_eq(uint64_t a, uint64_t b) {
68936         LDKPayeePubKey a_conv;
68937         a_conv.inner = untag_ptr(a);
68938         a_conv.is_owned = ptr_is_owned(a);
68939         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
68940         a_conv.is_owned = false;
68941         LDKPayeePubKey b_conv;
68942         b_conv.inner = untag_ptr(b);
68943         b_conv.is_owned = ptr_is_owned(b);
68944         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
68945         b_conv.is_owned = false;
68946         jboolean ret_conv = PayeePubKey_eq(&a_conv, &b_conv);
68947         return ret_conv;
68948 }
68949
68950 void  __attribute__((export_name("TS_ExpiryTime_free"))) TS_ExpiryTime_free(uint64_t this_obj) {
68951         LDKExpiryTime this_obj_conv;
68952         this_obj_conv.inner = untag_ptr(this_obj);
68953         this_obj_conv.is_owned = ptr_is_owned(this_obj);
68954         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
68955         ExpiryTime_free(this_obj_conv);
68956 }
68957
68958 static inline uint64_t ExpiryTime_clone_ptr(LDKExpiryTime *NONNULL_PTR arg) {
68959         LDKExpiryTime ret_var = ExpiryTime_clone(arg);
68960         uint64_t ret_ref = 0;
68961         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
68962         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
68963         return ret_ref;
68964 }
68965 int64_t  __attribute__((export_name("TS_ExpiryTime_clone_ptr"))) TS_ExpiryTime_clone_ptr(uint64_t arg) {
68966         LDKExpiryTime arg_conv;
68967         arg_conv.inner = untag_ptr(arg);
68968         arg_conv.is_owned = ptr_is_owned(arg);
68969         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
68970         arg_conv.is_owned = false;
68971         int64_t ret_conv = ExpiryTime_clone_ptr(&arg_conv);
68972         return ret_conv;
68973 }
68974
68975 uint64_t  __attribute__((export_name("TS_ExpiryTime_clone"))) TS_ExpiryTime_clone(uint64_t orig) {
68976         LDKExpiryTime orig_conv;
68977         orig_conv.inner = untag_ptr(orig);
68978         orig_conv.is_owned = ptr_is_owned(orig);
68979         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
68980         orig_conv.is_owned = false;
68981         LDKExpiryTime ret_var = ExpiryTime_clone(&orig_conv);
68982         uint64_t ret_ref = 0;
68983         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
68984         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
68985         return ret_ref;
68986 }
68987
68988 int64_t  __attribute__((export_name("TS_ExpiryTime_hash"))) TS_ExpiryTime_hash(uint64_t o) {
68989         LDKExpiryTime o_conv;
68990         o_conv.inner = untag_ptr(o);
68991         o_conv.is_owned = ptr_is_owned(o);
68992         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
68993         o_conv.is_owned = false;
68994         int64_t ret_conv = ExpiryTime_hash(&o_conv);
68995         return ret_conv;
68996 }
68997
68998 jboolean  __attribute__((export_name("TS_ExpiryTime_eq"))) TS_ExpiryTime_eq(uint64_t a, uint64_t b) {
68999         LDKExpiryTime a_conv;
69000         a_conv.inner = untag_ptr(a);
69001         a_conv.is_owned = ptr_is_owned(a);
69002         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
69003         a_conv.is_owned = false;
69004         LDKExpiryTime b_conv;
69005         b_conv.inner = untag_ptr(b);
69006         b_conv.is_owned = ptr_is_owned(b);
69007         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
69008         b_conv.is_owned = false;
69009         jboolean ret_conv = ExpiryTime_eq(&a_conv, &b_conv);
69010         return ret_conv;
69011 }
69012
69013 void  __attribute__((export_name("TS_MinFinalCltvExpiryDelta_free"))) TS_MinFinalCltvExpiryDelta_free(uint64_t this_obj) {
69014         LDKMinFinalCltvExpiryDelta this_obj_conv;
69015         this_obj_conv.inner = untag_ptr(this_obj);
69016         this_obj_conv.is_owned = ptr_is_owned(this_obj);
69017         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
69018         MinFinalCltvExpiryDelta_free(this_obj_conv);
69019 }
69020
69021 int64_t  __attribute__((export_name("TS_MinFinalCltvExpiryDelta_get_a"))) TS_MinFinalCltvExpiryDelta_get_a(uint64_t this_ptr) {
69022         LDKMinFinalCltvExpiryDelta this_ptr_conv;
69023         this_ptr_conv.inner = untag_ptr(this_ptr);
69024         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
69025         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
69026         this_ptr_conv.is_owned = false;
69027         int64_t ret_conv = MinFinalCltvExpiryDelta_get_a(&this_ptr_conv);
69028         return ret_conv;
69029 }
69030
69031 void  __attribute__((export_name("TS_MinFinalCltvExpiryDelta_set_a"))) TS_MinFinalCltvExpiryDelta_set_a(uint64_t this_ptr, int64_t val) {
69032         LDKMinFinalCltvExpiryDelta this_ptr_conv;
69033         this_ptr_conv.inner = untag_ptr(this_ptr);
69034         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
69035         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
69036         this_ptr_conv.is_owned = false;
69037         MinFinalCltvExpiryDelta_set_a(&this_ptr_conv, val);
69038 }
69039
69040 uint64_t  __attribute__((export_name("TS_MinFinalCltvExpiryDelta_new"))) TS_MinFinalCltvExpiryDelta_new(int64_t a_arg) {
69041         LDKMinFinalCltvExpiryDelta ret_var = MinFinalCltvExpiryDelta_new(a_arg);
69042         uint64_t ret_ref = 0;
69043         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
69044         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
69045         return ret_ref;
69046 }
69047
69048 static inline uint64_t MinFinalCltvExpiryDelta_clone_ptr(LDKMinFinalCltvExpiryDelta *NONNULL_PTR arg) {
69049         LDKMinFinalCltvExpiryDelta ret_var = MinFinalCltvExpiryDelta_clone(arg);
69050         uint64_t ret_ref = 0;
69051         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
69052         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
69053         return ret_ref;
69054 }
69055 int64_t  __attribute__((export_name("TS_MinFinalCltvExpiryDelta_clone_ptr"))) TS_MinFinalCltvExpiryDelta_clone_ptr(uint64_t arg) {
69056         LDKMinFinalCltvExpiryDelta arg_conv;
69057         arg_conv.inner = untag_ptr(arg);
69058         arg_conv.is_owned = ptr_is_owned(arg);
69059         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
69060         arg_conv.is_owned = false;
69061         int64_t ret_conv = MinFinalCltvExpiryDelta_clone_ptr(&arg_conv);
69062         return ret_conv;
69063 }
69064
69065 uint64_t  __attribute__((export_name("TS_MinFinalCltvExpiryDelta_clone"))) TS_MinFinalCltvExpiryDelta_clone(uint64_t orig) {
69066         LDKMinFinalCltvExpiryDelta orig_conv;
69067         orig_conv.inner = untag_ptr(orig);
69068         orig_conv.is_owned = ptr_is_owned(orig);
69069         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
69070         orig_conv.is_owned = false;
69071         LDKMinFinalCltvExpiryDelta ret_var = MinFinalCltvExpiryDelta_clone(&orig_conv);
69072         uint64_t ret_ref = 0;
69073         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
69074         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
69075         return ret_ref;
69076 }
69077
69078 int64_t  __attribute__((export_name("TS_MinFinalCltvExpiryDelta_hash"))) TS_MinFinalCltvExpiryDelta_hash(uint64_t o) {
69079         LDKMinFinalCltvExpiryDelta o_conv;
69080         o_conv.inner = untag_ptr(o);
69081         o_conv.is_owned = ptr_is_owned(o);
69082         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
69083         o_conv.is_owned = false;
69084         int64_t ret_conv = MinFinalCltvExpiryDelta_hash(&o_conv);
69085         return ret_conv;
69086 }
69087
69088 jboolean  __attribute__((export_name("TS_MinFinalCltvExpiryDelta_eq"))) TS_MinFinalCltvExpiryDelta_eq(uint64_t a, uint64_t b) {
69089         LDKMinFinalCltvExpiryDelta a_conv;
69090         a_conv.inner = untag_ptr(a);
69091         a_conv.is_owned = ptr_is_owned(a);
69092         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
69093         a_conv.is_owned = false;
69094         LDKMinFinalCltvExpiryDelta b_conv;
69095         b_conv.inner = untag_ptr(b);
69096         b_conv.is_owned = ptr_is_owned(b);
69097         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
69098         b_conv.is_owned = false;
69099         jboolean ret_conv = MinFinalCltvExpiryDelta_eq(&a_conv, &b_conv);
69100         return ret_conv;
69101 }
69102
69103 void  __attribute__((export_name("TS_Fallback_free"))) TS_Fallback_free(uint64_t this_ptr) {
69104         if (!ptr_is_owned(this_ptr)) return;
69105         void* this_ptr_ptr = untag_ptr(this_ptr);
69106         CHECK_ACCESS(this_ptr_ptr);
69107         LDKFallback this_ptr_conv = *(LDKFallback*)(this_ptr_ptr);
69108         FREE(untag_ptr(this_ptr));
69109         Fallback_free(this_ptr_conv);
69110 }
69111
69112 static inline uint64_t Fallback_clone_ptr(LDKFallback *NONNULL_PTR arg) {
69113         LDKFallback *ret_copy = MALLOC(sizeof(LDKFallback), "LDKFallback");
69114         *ret_copy = Fallback_clone(arg);
69115         uint64_t ret_ref = tag_ptr(ret_copy, true);
69116         return ret_ref;
69117 }
69118 int64_t  __attribute__((export_name("TS_Fallback_clone_ptr"))) TS_Fallback_clone_ptr(uint64_t arg) {
69119         LDKFallback* arg_conv = (LDKFallback*)untag_ptr(arg);
69120         int64_t ret_conv = Fallback_clone_ptr(arg_conv);
69121         return ret_conv;
69122 }
69123
69124 uint64_t  __attribute__((export_name("TS_Fallback_clone"))) TS_Fallback_clone(uint64_t orig) {
69125         LDKFallback* orig_conv = (LDKFallback*)untag_ptr(orig);
69126         LDKFallback *ret_copy = MALLOC(sizeof(LDKFallback), "LDKFallback");
69127         *ret_copy = Fallback_clone(orig_conv);
69128         uint64_t ret_ref = tag_ptr(ret_copy, true);
69129         return ret_ref;
69130 }
69131
69132 uint64_t  __attribute__((export_name("TS_Fallback_seg_wit_program"))) TS_Fallback_seg_wit_program(int8_t version, int8_tArray program) {
69133         
69134         LDKCVec_u8Z program_ref;
69135         program_ref.datalen = program->arr_len;
69136         program_ref.data = MALLOC(program_ref.datalen, "LDKCVec_u8Z Bytes");
69137         memcpy(program_ref.data, program->elems, program_ref.datalen); FREE(program);
69138         LDKFallback *ret_copy = MALLOC(sizeof(LDKFallback), "LDKFallback");
69139         *ret_copy = Fallback_seg_wit_program((LDKWitnessVersion){ ._0 = version }, program_ref);
69140         uint64_t ret_ref = tag_ptr(ret_copy, true);
69141         return ret_ref;
69142 }
69143
69144 uint64_t  __attribute__((export_name("TS_Fallback_pub_key_hash"))) TS_Fallback_pub_key_hash(int8_tArray a) {
69145         LDKTwentyBytes a_ref;
69146         CHECK(a->arr_len == 20);
69147         memcpy(a_ref.data, a->elems, 20); FREE(a);
69148         LDKFallback *ret_copy = MALLOC(sizeof(LDKFallback), "LDKFallback");
69149         *ret_copy = Fallback_pub_key_hash(a_ref);
69150         uint64_t ret_ref = tag_ptr(ret_copy, true);
69151         return ret_ref;
69152 }
69153
69154 uint64_t  __attribute__((export_name("TS_Fallback_script_hash"))) TS_Fallback_script_hash(int8_tArray a) {
69155         LDKTwentyBytes a_ref;
69156         CHECK(a->arr_len == 20);
69157         memcpy(a_ref.data, a->elems, 20); FREE(a);
69158         LDKFallback *ret_copy = MALLOC(sizeof(LDKFallback), "LDKFallback");
69159         *ret_copy = Fallback_script_hash(a_ref);
69160         uint64_t ret_ref = tag_ptr(ret_copy, true);
69161         return ret_ref;
69162 }
69163
69164 int64_t  __attribute__((export_name("TS_Fallback_hash"))) TS_Fallback_hash(uint64_t o) {
69165         LDKFallback* o_conv = (LDKFallback*)untag_ptr(o);
69166         int64_t ret_conv = Fallback_hash(o_conv);
69167         return ret_conv;
69168 }
69169
69170 jboolean  __attribute__((export_name("TS_Fallback_eq"))) TS_Fallback_eq(uint64_t a, uint64_t b) {
69171         LDKFallback* a_conv = (LDKFallback*)untag_ptr(a);
69172         LDKFallback* b_conv = (LDKFallback*)untag_ptr(b);
69173         jboolean ret_conv = Fallback_eq(a_conv, b_conv);
69174         return ret_conv;
69175 }
69176
69177 void  __attribute__((export_name("TS_Bolt11InvoiceSignature_free"))) TS_Bolt11InvoiceSignature_free(uint64_t this_obj) {
69178         LDKBolt11InvoiceSignature this_obj_conv;
69179         this_obj_conv.inner = untag_ptr(this_obj);
69180         this_obj_conv.is_owned = ptr_is_owned(this_obj);
69181         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
69182         Bolt11InvoiceSignature_free(this_obj_conv);
69183 }
69184
69185 static inline uint64_t Bolt11InvoiceSignature_clone_ptr(LDKBolt11InvoiceSignature *NONNULL_PTR arg) {
69186         LDKBolt11InvoiceSignature ret_var = Bolt11InvoiceSignature_clone(arg);
69187         uint64_t ret_ref = 0;
69188         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
69189         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
69190         return ret_ref;
69191 }
69192 int64_t  __attribute__((export_name("TS_Bolt11InvoiceSignature_clone_ptr"))) TS_Bolt11InvoiceSignature_clone_ptr(uint64_t arg) {
69193         LDKBolt11InvoiceSignature arg_conv;
69194         arg_conv.inner = untag_ptr(arg);
69195         arg_conv.is_owned = ptr_is_owned(arg);
69196         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
69197         arg_conv.is_owned = false;
69198         int64_t ret_conv = Bolt11InvoiceSignature_clone_ptr(&arg_conv);
69199         return ret_conv;
69200 }
69201
69202 uint64_t  __attribute__((export_name("TS_Bolt11InvoiceSignature_clone"))) TS_Bolt11InvoiceSignature_clone(uint64_t orig) {
69203         LDKBolt11InvoiceSignature orig_conv;
69204         orig_conv.inner = untag_ptr(orig);
69205         orig_conv.is_owned = ptr_is_owned(orig);
69206         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
69207         orig_conv.is_owned = false;
69208         LDKBolt11InvoiceSignature ret_var = Bolt11InvoiceSignature_clone(&orig_conv);
69209         uint64_t ret_ref = 0;
69210         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
69211         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
69212         return ret_ref;
69213 }
69214
69215 int64_t  __attribute__((export_name("TS_Bolt11InvoiceSignature_hash"))) TS_Bolt11InvoiceSignature_hash(uint64_t o) {
69216         LDKBolt11InvoiceSignature o_conv;
69217         o_conv.inner = untag_ptr(o);
69218         o_conv.is_owned = ptr_is_owned(o);
69219         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
69220         o_conv.is_owned = false;
69221         int64_t ret_conv = Bolt11InvoiceSignature_hash(&o_conv);
69222         return ret_conv;
69223 }
69224
69225 jboolean  __attribute__((export_name("TS_Bolt11InvoiceSignature_eq"))) TS_Bolt11InvoiceSignature_eq(uint64_t a, uint64_t b) {
69226         LDKBolt11InvoiceSignature a_conv;
69227         a_conv.inner = untag_ptr(a);
69228         a_conv.is_owned = ptr_is_owned(a);
69229         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
69230         a_conv.is_owned = false;
69231         LDKBolt11InvoiceSignature b_conv;
69232         b_conv.inner = untag_ptr(b);
69233         b_conv.is_owned = ptr_is_owned(b);
69234         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
69235         b_conv.is_owned = false;
69236         jboolean ret_conv = Bolt11InvoiceSignature_eq(&a_conv, &b_conv);
69237         return ret_conv;
69238 }
69239
69240 void  __attribute__((export_name("TS_PrivateRoute_free"))) TS_PrivateRoute_free(uint64_t this_obj) {
69241         LDKPrivateRoute this_obj_conv;
69242         this_obj_conv.inner = untag_ptr(this_obj);
69243         this_obj_conv.is_owned = ptr_is_owned(this_obj);
69244         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
69245         PrivateRoute_free(this_obj_conv);
69246 }
69247
69248 static inline uint64_t PrivateRoute_clone_ptr(LDKPrivateRoute *NONNULL_PTR arg) {
69249         LDKPrivateRoute ret_var = PrivateRoute_clone(arg);
69250         uint64_t ret_ref = 0;
69251         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
69252         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
69253         return ret_ref;
69254 }
69255 int64_t  __attribute__((export_name("TS_PrivateRoute_clone_ptr"))) TS_PrivateRoute_clone_ptr(uint64_t arg) {
69256         LDKPrivateRoute arg_conv;
69257         arg_conv.inner = untag_ptr(arg);
69258         arg_conv.is_owned = ptr_is_owned(arg);
69259         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
69260         arg_conv.is_owned = false;
69261         int64_t ret_conv = PrivateRoute_clone_ptr(&arg_conv);
69262         return ret_conv;
69263 }
69264
69265 uint64_t  __attribute__((export_name("TS_PrivateRoute_clone"))) TS_PrivateRoute_clone(uint64_t orig) {
69266         LDKPrivateRoute orig_conv;
69267         orig_conv.inner = untag_ptr(orig);
69268         orig_conv.is_owned = ptr_is_owned(orig);
69269         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
69270         orig_conv.is_owned = false;
69271         LDKPrivateRoute ret_var = PrivateRoute_clone(&orig_conv);
69272         uint64_t ret_ref = 0;
69273         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
69274         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
69275         return ret_ref;
69276 }
69277
69278 int64_t  __attribute__((export_name("TS_PrivateRoute_hash"))) TS_PrivateRoute_hash(uint64_t o) {
69279         LDKPrivateRoute o_conv;
69280         o_conv.inner = untag_ptr(o);
69281         o_conv.is_owned = ptr_is_owned(o);
69282         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
69283         o_conv.is_owned = false;
69284         int64_t ret_conv = PrivateRoute_hash(&o_conv);
69285         return ret_conv;
69286 }
69287
69288 jboolean  __attribute__((export_name("TS_PrivateRoute_eq"))) TS_PrivateRoute_eq(uint64_t a, uint64_t b) {
69289         LDKPrivateRoute a_conv;
69290         a_conv.inner = untag_ptr(a);
69291         a_conv.is_owned = ptr_is_owned(a);
69292         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
69293         a_conv.is_owned = false;
69294         LDKPrivateRoute b_conv;
69295         b_conv.inner = untag_ptr(b);
69296         b_conv.is_owned = ptr_is_owned(b);
69297         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
69298         b_conv.is_owned = false;
69299         jboolean ret_conv = PrivateRoute_eq(&a_conv, &b_conv);
69300         return ret_conv;
69301 }
69302
69303 uint64_t  __attribute__((export_name("TS_SignedRawBolt11Invoice_into_parts"))) TS_SignedRawBolt11Invoice_into_parts(uint64_t this_arg) {
69304         LDKSignedRawBolt11Invoice this_arg_conv;
69305         this_arg_conv.inner = untag_ptr(this_arg);
69306         this_arg_conv.is_owned = ptr_is_owned(this_arg);
69307         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
69308         this_arg_conv = SignedRawBolt11Invoice_clone(&this_arg_conv);
69309         LDKC3Tuple_RawBolt11Invoice_u832Bolt11InvoiceSignatureZ* ret_conv = MALLOC(sizeof(LDKC3Tuple_RawBolt11Invoice_u832Bolt11InvoiceSignatureZ), "LDKC3Tuple_RawBolt11Invoice_u832Bolt11InvoiceSignatureZ");
69310         *ret_conv = SignedRawBolt11Invoice_into_parts(this_arg_conv);
69311         return tag_ptr(ret_conv, true);
69312 }
69313
69314 uint64_t  __attribute__((export_name("TS_SignedRawBolt11Invoice_raw_invoice"))) TS_SignedRawBolt11Invoice_raw_invoice(uint64_t this_arg) {
69315         LDKSignedRawBolt11Invoice this_arg_conv;
69316         this_arg_conv.inner = untag_ptr(this_arg);
69317         this_arg_conv.is_owned = ptr_is_owned(this_arg);
69318         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
69319         this_arg_conv.is_owned = false;
69320         LDKRawBolt11Invoice ret_var = SignedRawBolt11Invoice_raw_invoice(&this_arg_conv);
69321         uint64_t ret_ref = 0;
69322         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
69323         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
69324         return ret_ref;
69325 }
69326
69327 int8_tArray  __attribute__((export_name("TS_SignedRawBolt11Invoice_signable_hash"))) TS_SignedRawBolt11Invoice_signable_hash(uint64_t this_arg) {
69328         LDKSignedRawBolt11Invoice this_arg_conv;
69329         this_arg_conv.inner = untag_ptr(this_arg);
69330         this_arg_conv.is_owned = ptr_is_owned(this_arg);
69331         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
69332         this_arg_conv.is_owned = false;
69333         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
69334         memcpy(ret_arr->elems, *SignedRawBolt11Invoice_signable_hash(&this_arg_conv), 32);
69335         return ret_arr;
69336 }
69337
69338 uint64_t  __attribute__((export_name("TS_SignedRawBolt11Invoice_signature"))) TS_SignedRawBolt11Invoice_signature(uint64_t this_arg) {
69339         LDKSignedRawBolt11Invoice this_arg_conv;
69340         this_arg_conv.inner = untag_ptr(this_arg);
69341         this_arg_conv.is_owned = ptr_is_owned(this_arg);
69342         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
69343         this_arg_conv.is_owned = false;
69344         LDKBolt11InvoiceSignature ret_var = SignedRawBolt11Invoice_signature(&this_arg_conv);
69345         uint64_t ret_ref = 0;
69346         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
69347         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
69348         return ret_ref;
69349 }
69350
69351 uint64_t  __attribute__((export_name("TS_SignedRawBolt11Invoice_recover_payee_pub_key"))) TS_SignedRawBolt11Invoice_recover_payee_pub_key(uint64_t this_arg) {
69352         LDKSignedRawBolt11Invoice this_arg_conv;
69353         this_arg_conv.inner = untag_ptr(this_arg);
69354         this_arg_conv.is_owned = ptr_is_owned(this_arg);
69355         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
69356         this_arg_conv.is_owned = false;
69357         LDKCResult_PayeePubKeySecp256k1ErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PayeePubKeySecp256k1ErrorZ), "LDKCResult_PayeePubKeySecp256k1ErrorZ");
69358         *ret_conv = SignedRawBolt11Invoice_recover_payee_pub_key(&this_arg_conv);
69359         return tag_ptr(ret_conv, true);
69360 }
69361
69362 jboolean  __attribute__((export_name("TS_SignedRawBolt11Invoice_check_signature"))) TS_SignedRawBolt11Invoice_check_signature(uint64_t this_arg) {
69363         LDKSignedRawBolt11Invoice this_arg_conv;
69364         this_arg_conv.inner = untag_ptr(this_arg);
69365         this_arg_conv.is_owned = ptr_is_owned(this_arg);
69366         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
69367         this_arg_conv.is_owned = false;
69368         jboolean ret_conv = SignedRawBolt11Invoice_check_signature(&this_arg_conv);
69369         return ret_conv;
69370 }
69371
69372 int8_tArray  __attribute__((export_name("TS_RawBolt11Invoice_signable_hash"))) TS_RawBolt11Invoice_signable_hash(uint64_t this_arg) {
69373         LDKRawBolt11Invoice this_arg_conv;
69374         this_arg_conv.inner = untag_ptr(this_arg);
69375         this_arg_conv.is_owned = ptr_is_owned(this_arg);
69376         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
69377         this_arg_conv.is_owned = false;
69378         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
69379         memcpy(ret_arr->elems, RawBolt11Invoice_signable_hash(&this_arg_conv).data, 32);
69380         return ret_arr;
69381 }
69382
69383 uint64_t  __attribute__((export_name("TS_RawBolt11Invoice_payment_hash"))) TS_RawBolt11Invoice_payment_hash(uint64_t this_arg) {
69384         LDKRawBolt11Invoice this_arg_conv;
69385         this_arg_conv.inner = untag_ptr(this_arg);
69386         this_arg_conv.is_owned = ptr_is_owned(this_arg);
69387         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
69388         this_arg_conv.is_owned = false;
69389         LDKSha256 ret_var = RawBolt11Invoice_payment_hash(&this_arg_conv);
69390         uint64_t ret_ref = 0;
69391         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
69392         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
69393         return ret_ref;
69394 }
69395
69396 uint64_t  __attribute__((export_name("TS_RawBolt11Invoice_description"))) TS_RawBolt11Invoice_description(uint64_t this_arg) {
69397         LDKRawBolt11Invoice this_arg_conv;
69398         this_arg_conv.inner = untag_ptr(this_arg);
69399         this_arg_conv.is_owned = ptr_is_owned(this_arg);
69400         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
69401         this_arg_conv.is_owned = false;
69402         LDKDescription ret_var = RawBolt11Invoice_description(&this_arg_conv);
69403         uint64_t ret_ref = 0;
69404         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
69405         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
69406         return ret_ref;
69407 }
69408
69409 uint64_t  __attribute__((export_name("TS_RawBolt11Invoice_payee_pub_key"))) TS_RawBolt11Invoice_payee_pub_key(uint64_t this_arg) {
69410         LDKRawBolt11Invoice this_arg_conv;
69411         this_arg_conv.inner = untag_ptr(this_arg);
69412         this_arg_conv.is_owned = ptr_is_owned(this_arg);
69413         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
69414         this_arg_conv.is_owned = false;
69415         LDKPayeePubKey ret_var = RawBolt11Invoice_payee_pub_key(&this_arg_conv);
69416         uint64_t ret_ref = 0;
69417         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
69418         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
69419         return ret_ref;
69420 }
69421
69422 uint64_t  __attribute__((export_name("TS_RawBolt11Invoice_description_hash"))) TS_RawBolt11Invoice_description_hash(uint64_t this_arg) {
69423         LDKRawBolt11Invoice this_arg_conv;
69424         this_arg_conv.inner = untag_ptr(this_arg);
69425         this_arg_conv.is_owned = ptr_is_owned(this_arg);
69426         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
69427         this_arg_conv.is_owned = false;
69428         LDKSha256 ret_var = RawBolt11Invoice_description_hash(&this_arg_conv);
69429         uint64_t ret_ref = 0;
69430         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
69431         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
69432         return ret_ref;
69433 }
69434
69435 uint64_t  __attribute__((export_name("TS_RawBolt11Invoice_expiry_time"))) TS_RawBolt11Invoice_expiry_time(uint64_t this_arg) {
69436         LDKRawBolt11Invoice this_arg_conv;
69437         this_arg_conv.inner = untag_ptr(this_arg);
69438         this_arg_conv.is_owned = ptr_is_owned(this_arg);
69439         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
69440         this_arg_conv.is_owned = false;
69441         LDKExpiryTime ret_var = RawBolt11Invoice_expiry_time(&this_arg_conv);
69442         uint64_t ret_ref = 0;
69443         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
69444         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
69445         return ret_ref;
69446 }
69447
69448 uint64_t  __attribute__((export_name("TS_RawBolt11Invoice_min_final_cltv_expiry_delta"))) TS_RawBolt11Invoice_min_final_cltv_expiry_delta(uint64_t this_arg) {
69449         LDKRawBolt11Invoice this_arg_conv;
69450         this_arg_conv.inner = untag_ptr(this_arg);
69451         this_arg_conv.is_owned = ptr_is_owned(this_arg);
69452         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
69453         this_arg_conv.is_owned = false;
69454         LDKMinFinalCltvExpiryDelta ret_var = RawBolt11Invoice_min_final_cltv_expiry_delta(&this_arg_conv);
69455         uint64_t ret_ref = 0;
69456         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
69457         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
69458         return ret_ref;
69459 }
69460
69461 uint64_t  __attribute__((export_name("TS_RawBolt11Invoice_payment_secret"))) TS_RawBolt11Invoice_payment_secret(uint64_t this_arg) {
69462         LDKRawBolt11Invoice this_arg_conv;
69463         this_arg_conv.inner = untag_ptr(this_arg);
69464         this_arg_conv.is_owned = ptr_is_owned(this_arg);
69465         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
69466         this_arg_conv.is_owned = false;
69467         LDKCOption_ThirtyTwoBytesZ *ret_copy = MALLOC(sizeof(LDKCOption_ThirtyTwoBytesZ), "LDKCOption_ThirtyTwoBytesZ");
69468         *ret_copy = RawBolt11Invoice_payment_secret(&this_arg_conv);
69469         uint64_t ret_ref = tag_ptr(ret_copy, true);
69470         return ret_ref;
69471 }
69472
69473 uint64_t  __attribute__((export_name("TS_RawBolt11Invoice_payment_metadata"))) TS_RawBolt11Invoice_payment_metadata(uint64_t this_arg) {
69474         LDKRawBolt11Invoice this_arg_conv;
69475         this_arg_conv.inner = untag_ptr(this_arg);
69476         this_arg_conv.is_owned = ptr_is_owned(this_arg);
69477         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
69478         this_arg_conv.is_owned = false;
69479         LDKCOption_CVec_u8ZZ *ret_copy = MALLOC(sizeof(LDKCOption_CVec_u8ZZ), "LDKCOption_CVec_u8ZZ");
69480         *ret_copy = RawBolt11Invoice_payment_metadata(&this_arg_conv);
69481         uint64_t ret_ref = tag_ptr(ret_copy, true);
69482         return ret_ref;
69483 }
69484
69485 uint64_t  __attribute__((export_name("TS_RawBolt11Invoice_features"))) TS_RawBolt11Invoice_features(uint64_t this_arg) {
69486         LDKRawBolt11Invoice this_arg_conv;
69487         this_arg_conv.inner = untag_ptr(this_arg);
69488         this_arg_conv.is_owned = ptr_is_owned(this_arg);
69489         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
69490         this_arg_conv.is_owned = false;
69491         LDKBolt11InvoiceFeatures ret_var = RawBolt11Invoice_features(&this_arg_conv);
69492         uint64_t ret_ref = 0;
69493         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
69494         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
69495         return ret_ref;
69496 }
69497
69498 uint64_tArray  __attribute__((export_name("TS_RawBolt11Invoice_private_routes"))) TS_RawBolt11Invoice_private_routes(uint64_t this_arg) {
69499         LDKRawBolt11Invoice this_arg_conv;
69500         this_arg_conv.inner = untag_ptr(this_arg);
69501         this_arg_conv.is_owned = ptr_is_owned(this_arg);
69502         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
69503         this_arg_conv.is_owned = false;
69504         LDKCVec_PrivateRouteZ ret_var = RawBolt11Invoice_private_routes(&this_arg_conv);
69505         uint64_tArray ret_arr = NULL;
69506         ret_arr = init_uint64_tArray(ret_var.datalen, __LINE__);
69507         uint64_t *ret_arr_ptr = (uint64_t*)(((uint8_t*)ret_arr) + 8);
69508         for (size_t o = 0; o < ret_var.datalen; o++) {
69509                 LDKPrivateRoute ret_conv_14_var = ret_var.data[o];
69510                 uint64_t ret_conv_14_ref = 0;
69511                 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_conv_14_var);
69512                 ret_conv_14_ref = tag_ptr(ret_conv_14_var.inner, ret_conv_14_var.is_owned);
69513                 ret_arr_ptr[o] = ret_conv_14_ref;
69514         }
69515         
69516         FREE(ret_var.data);
69517         return ret_arr;
69518 }
69519
69520 uint64_t  __attribute__((export_name("TS_RawBolt11Invoice_amount_pico_btc"))) TS_RawBolt11Invoice_amount_pico_btc(uint64_t this_arg) {
69521         LDKRawBolt11Invoice this_arg_conv;
69522         this_arg_conv.inner = untag_ptr(this_arg);
69523         this_arg_conv.is_owned = ptr_is_owned(this_arg);
69524         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
69525         this_arg_conv.is_owned = false;
69526         LDKCOption_u64Z *ret_copy = MALLOC(sizeof(LDKCOption_u64Z), "LDKCOption_u64Z");
69527         *ret_copy = RawBolt11Invoice_amount_pico_btc(&this_arg_conv);
69528         uint64_t ret_ref = tag_ptr(ret_copy, true);
69529         return ret_ref;
69530 }
69531
69532 uint32_t  __attribute__((export_name("TS_RawBolt11Invoice_currency"))) TS_RawBolt11Invoice_currency(uint64_t this_arg) {
69533         LDKRawBolt11Invoice this_arg_conv;
69534         this_arg_conv.inner = untag_ptr(this_arg);
69535         this_arg_conv.is_owned = ptr_is_owned(this_arg);
69536         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
69537         this_arg_conv.is_owned = false;
69538         uint32_t ret_conv = LDKCurrency_to_js(RawBolt11Invoice_currency(&this_arg_conv));
69539         return ret_conv;
69540 }
69541
69542 uint64_t  __attribute__((export_name("TS_PositiveTimestamp_from_unix_timestamp"))) TS_PositiveTimestamp_from_unix_timestamp(int64_t unix_seconds) {
69543         LDKCResult_PositiveTimestampCreationErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PositiveTimestampCreationErrorZ), "LDKCResult_PositiveTimestampCreationErrorZ");
69544         *ret_conv = PositiveTimestamp_from_unix_timestamp(unix_seconds);
69545         return tag_ptr(ret_conv, true);
69546 }
69547
69548 uint64_t  __attribute__((export_name("TS_PositiveTimestamp_from_duration_since_epoch"))) TS_PositiveTimestamp_from_duration_since_epoch(int64_t duration) {
69549         LDKCResult_PositiveTimestampCreationErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PositiveTimestampCreationErrorZ), "LDKCResult_PositiveTimestampCreationErrorZ");
69550         *ret_conv = PositiveTimestamp_from_duration_since_epoch(duration);
69551         return tag_ptr(ret_conv, true);
69552 }
69553
69554 int64_t  __attribute__((export_name("TS_PositiveTimestamp_as_unix_timestamp"))) TS_PositiveTimestamp_as_unix_timestamp(uint64_t this_arg) {
69555         LDKPositiveTimestamp this_arg_conv;
69556         this_arg_conv.inner = untag_ptr(this_arg);
69557         this_arg_conv.is_owned = ptr_is_owned(this_arg);
69558         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
69559         this_arg_conv.is_owned = false;
69560         int64_t ret_conv = PositiveTimestamp_as_unix_timestamp(&this_arg_conv);
69561         return ret_conv;
69562 }
69563
69564 int64_t  __attribute__((export_name("TS_PositiveTimestamp_as_duration_since_epoch"))) TS_PositiveTimestamp_as_duration_since_epoch(uint64_t this_arg) {
69565         LDKPositiveTimestamp this_arg_conv;
69566         this_arg_conv.inner = untag_ptr(this_arg);
69567         this_arg_conv.is_owned = ptr_is_owned(this_arg);
69568         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
69569         this_arg_conv.is_owned = false;
69570         int64_t ret_conv = PositiveTimestamp_as_duration_since_epoch(&this_arg_conv);
69571         return ret_conv;
69572 }
69573
69574 int8_tArray  __attribute__((export_name("TS_Bolt11Invoice_signable_hash"))) TS_Bolt11Invoice_signable_hash(uint64_t this_arg) {
69575         LDKBolt11Invoice this_arg_conv;
69576         this_arg_conv.inner = untag_ptr(this_arg);
69577         this_arg_conv.is_owned = ptr_is_owned(this_arg);
69578         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
69579         this_arg_conv.is_owned = false;
69580         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
69581         memcpy(ret_arr->elems, Bolt11Invoice_signable_hash(&this_arg_conv).data, 32);
69582         return ret_arr;
69583 }
69584
69585 uint64_t  __attribute__((export_name("TS_Bolt11Invoice_into_signed_raw"))) TS_Bolt11Invoice_into_signed_raw(uint64_t this_arg) {
69586         LDKBolt11Invoice this_arg_conv;
69587         this_arg_conv.inner = untag_ptr(this_arg);
69588         this_arg_conv.is_owned = ptr_is_owned(this_arg);
69589         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
69590         this_arg_conv = Bolt11Invoice_clone(&this_arg_conv);
69591         LDKSignedRawBolt11Invoice ret_var = Bolt11Invoice_into_signed_raw(this_arg_conv);
69592         uint64_t ret_ref = 0;
69593         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
69594         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
69595         return ret_ref;
69596 }
69597
69598 uint64_t  __attribute__((export_name("TS_Bolt11Invoice_check_signature"))) TS_Bolt11Invoice_check_signature(uint64_t this_arg) {
69599         LDKBolt11Invoice this_arg_conv;
69600         this_arg_conv.inner = untag_ptr(this_arg);
69601         this_arg_conv.is_owned = ptr_is_owned(this_arg);
69602         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
69603         this_arg_conv.is_owned = false;
69604         LDKCResult_NoneBolt11SemanticErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneBolt11SemanticErrorZ), "LDKCResult_NoneBolt11SemanticErrorZ");
69605         *ret_conv = Bolt11Invoice_check_signature(&this_arg_conv);
69606         return tag_ptr(ret_conv, true);
69607 }
69608
69609 uint64_t  __attribute__((export_name("TS_Bolt11Invoice_from_signed"))) TS_Bolt11Invoice_from_signed(uint64_t signed_invoice) {
69610         LDKSignedRawBolt11Invoice signed_invoice_conv;
69611         signed_invoice_conv.inner = untag_ptr(signed_invoice);
69612         signed_invoice_conv.is_owned = ptr_is_owned(signed_invoice);
69613         CHECK_INNER_FIELD_ACCESS_OR_NULL(signed_invoice_conv);
69614         signed_invoice_conv = SignedRawBolt11Invoice_clone(&signed_invoice_conv);
69615         LDKCResult_Bolt11InvoiceBolt11SemanticErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_Bolt11InvoiceBolt11SemanticErrorZ), "LDKCResult_Bolt11InvoiceBolt11SemanticErrorZ");
69616         *ret_conv = Bolt11Invoice_from_signed(signed_invoice_conv);
69617         return tag_ptr(ret_conv, true);
69618 }
69619
69620 int64_t  __attribute__((export_name("TS_Bolt11Invoice_duration_since_epoch"))) TS_Bolt11Invoice_duration_since_epoch(uint64_t this_arg) {
69621         LDKBolt11Invoice this_arg_conv;
69622         this_arg_conv.inner = untag_ptr(this_arg);
69623         this_arg_conv.is_owned = ptr_is_owned(this_arg);
69624         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
69625         this_arg_conv.is_owned = false;
69626         int64_t ret_conv = Bolt11Invoice_duration_since_epoch(&this_arg_conv);
69627         return ret_conv;
69628 }
69629
69630 int8_tArray  __attribute__((export_name("TS_Bolt11Invoice_payment_hash"))) TS_Bolt11Invoice_payment_hash(uint64_t this_arg) {
69631         LDKBolt11Invoice this_arg_conv;
69632         this_arg_conv.inner = untag_ptr(this_arg);
69633         this_arg_conv.is_owned = ptr_is_owned(this_arg);
69634         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
69635         this_arg_conv.is_owned = false;
69636         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
69637         memcpy(ret_arr->elems, *Bolt11Invoice_payment_hash(&this_arg_conv), 32);
69638         return ret_arr;
69639 }
69640
69641 int8_tArray  __attribute__((export_name("TS_Bolt11Invoice_payee_pub_key"))) TS_Bolt11Invoice_payee_pub_key(uint64_t this_arg) {
69642         LDKBolt11Invoice this_arg_conv;
69643         this_arg_conv.inner = untag_ptr(this_arg);
69644         this_arg_conv.is_owned = ptr_is_owned(this_arg);
69645         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
69646         this_arg_conv.is_owned = false;
69647         int8_tArray ret_arr = init_int8_tArray(33, __LINE__);
69648         memcpy(ret_arr->elems, Bolt11Invoice_payee_pub_key(&this_arg_conv).compressed_form, 33);
69649         return ret_arr;
69650 }
69651
69652 int8_tArray  __attribute__((export_name("TS_Bolt11Invoice_payment_secret"))) TS_Bolt11Invoice_payment_secret(uint64_t this_arg) {
69653         LDKBolt11Invoice this_arg_conv;
69654         this_arg_conv.inner = untag_ptr(this_arg);
69655         this_arg_conv.is_owned = ptr_is_owned(this_arg);
69656         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
69657         this_arg_conv.is_owned = false;
69658         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
69659         memcpy(ret_arr->elems, *Bolt11Invoice_payment_secret(&this_arg_conv), 32);
69660         return ret_arr;
69661 }
69662
69663 uint64_t  __attribute__((export_name("TS_Bolt11Invoice_payment_metadata"))) TS_Bolt11Invoice_payment_metadata(uint64_t this_arg) {
69664         LDKBolt11Invoice this_arg_conv;
69665         this_arg_conv.inner = untag_ptr(this_arg);
69666         this_arg_conv.is_owned = ptr_is_owned(this_arg);
69667         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
69668         this_arg_conv.is_owned = false;
69669         LDKCOption_CVec_u8ZZ *ret_copy = MALLOC(sizeof(LDKCOption_CVec_u8ZZ), "LDKCOption_CVec_u8ZZ");
69670         *ret_copy = Bolt11Invoice_payment_metadata(&this_arg_conv);
69671         uint64_t ret_ref = tag_ptr(ret_copy, true);
69672         return ret_ref;
69673 }
69674
69675 uint64_t  __attribute__((export_name("TS_Bolt11Invoice_features"))) TS_Bolt11Invoice_features(uint64_t this_arg) {
69676         LDKBolt11Invoice this_arg_conv;
69677         this_arg_conv.inner = untag_ptr(this_arg);
69678         this_arg_conv.is_owned = ptr_is_owned(this_arg);
69679         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
69680         this_arg_conv.is_owned = false;
69681         LDKBolt11InvoiceFeatures ret_var = Bolt11Invoice_features(&this_arg_conv);
69682         uint64_t ret_ref = 0;
69683         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
69684         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
69685         return ret_ref;
69686 }
69687
69688 int8_tArray  __attribute__((export_name("TS_Bolt11Invoice_recover_payee_pub_key"))) TS_Bolt11Invoice_recover_payee_pub_key(uint64_t this_arg) {
69689         LDKBolt11Invoice this_arg_conv;
69690         this_arg_conv.inner = untag_ptr(this_arg);
69691         this_arg_conv.is_owned = ptr_is_owned(this_arg);
69692         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
69693         this_arg_conv.is_owned = false;
69694         int8_tArray ret_arr = init_int8_tArray(33, __LINE__);
69695         memcpy(ret_arr->elems, Bolt11Invoice_recover_payee_pub_key(&this_arg_conv).compressed_form, 33);
69696         return ret_arr;
69697 }
69698
69699 uint64_t  __attribute__((export_name("TS_Bolt11Invoice_expires_at"))) TS_Bolt11Invoice_expires_at(uint64_t this_arg) {
69700         LDKBolt11Invoice this_arg_conv;
69701         this_arg_conv.inner = untag_ptr(this_arg);
69702         this_arg_conv.is_owned = ptr_is_owned(this_arg);
69703         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
69704         this_arg_conv.is_owned = false;
69705         LDKCOption_u64Z *ret_copy = MALLOC(sizeof(LDKCOption_u64Z), "LDKCOption_u64Z");
69706         *ret_copy = Bolt11Invoice_expires_at(&this_arg_conv);
69707         uint64_t ret_ref = tag_ptr(ret_copy, true);
69708         return ret_ref;
69709 }
69710
69711 int64_t  __attribute__((export_name("TS_Bolt11Invoice_expiry_time"))) TS_Bolt11Invoice_expiry_time(uint64_t this_arg) {
69712         LDKBolt11Invoice this_arg_conv;
69713         this_arg_conv.inner = untag_ptr(this_arg);
69714         this_arg_conv.is_owned = ptr_is_owned(this_arg);
69715         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
69716         this_arg_conv.is_owned = false;
69717         int64_t ret_conv = Bolt11Invoice_expiry_time(&this_arg_conv);
69718         return ret_conv;
69719 }
69720
69721 int64_t  __attribute__((export_name("TS_Bolt11Invoice_expiration_remaining_from_epoch"))) TS_Bolt11Invoice_expiration_remaining_from_epoch(uint64_t this_arg, int64_t time) {
69722         LDKBolt11Invoice this_arg_conv;
69723         this_arg_conv.inner = untag_ptr(this_arg);
69724         this_arg_conv.is_owned = ptr_is_owned(this_arg);
69725         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
69726         this_arg_conv.is_owned = false;
69727         int64_t ret_conv = Bolt11Invoice_expiration_remaining_from_epoch(&this_arg_conv, time);
69728         return ret_conv;
69729 }
69730
69731 jboolean  __attribute__((export_name("TS_Bolt11Invoice_would_expire"))) TS_Bolt11Invoice_would_expire(uint64_t this_arg, int64_t at_time) {
69732         LDKBolt11Invoice this_arg_conv;
69733         this_arg_conv.inner = untag_ptr(this_arg);
69734         this_arg_conv.is_owned = ptr_is_owned(this_arg);
69735         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
69736         this_arg_conv.is_owned = false;
69737         jboolean ret_conv = Bolt11Invoice_would_expire(&this_arg_conv, at_time);
69738         return ret_conv;
69739 }
69740
69741 int64_t  __attribute__((export_name("TS_Bolt11Invoice_min_final_cltv_expiry_delta"))) TS_Bolt11Invoice_min_final_cltv_expiry_delta(uint64_t this_arg) {
69742         LDKBolt11Invoice this_arg_conv;
69743         this_arg_conv.inner = untag_ptr(this_arg);
69744         this_arg_conv.is_owned = ptr_is_owned(this_arg);
69745         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
69746         this_arg_conv.is_owned = false;
69747         int64_t ret_conv = Bolt11Invoice_min_final_cltv_expiry_delta(&this_arg_conv);
69748         return ret_conv;
69749 }
69750
69751 ptrArray  __attribute__((export_name("TS_Bolt11Invoice_fallback_addresses"))) TS_Bolt11Invoice_fallback_addresses(uint64_t this_arg) {
69752         LDKBolt11Invoice this_arg_conv;
69753         this_arg_conv.inner = untag_ptr(this_arg);
69754         this_arg_conv.is_owned = ptr_is_owned(this_arg);
69755         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
69756         this_arg_conv.is_owned = false;
69757         LDKCVec_StrZ ret_var = Bolt11Invoice_fallback_addresses(&this_arg_conv);
69758         ptrArray ret_arr = NULL;
69759         ret_arr = init_ptrArray(ret_var.datalen, __LINE__);
69760         jstring *ret_arr_ptr = (jstring*)(((uint8_t*)ret_arr) + 8);
69761         for (size_t i = 0; i < ret_var.datalen; i++) {
69762                 LDKStr ret_conv_8_str = ret_var.data[i];
69763                 jstring ret_conv_8_conv = str_ref_to_ts(ret_conv_8_str.chars, ret_conv_8_str.len);
69764                 Str_free(ret_conv_8_str);
69765                 ret_arr_ptr[i] = ret_conv_8_conv;
69766         }
69767         
69768         FREE(ret_var.data);
69769         return ret_arr;
69770 }
69771
69772 uint64_tArray  __attribute__((export_name("TS_Bolt11Invoice_private_routes"))) TS_Bolt11Invoice_private_routes(uint64_t this_arg) {
69773         LDKBolt11Invoice this_arg_conv;
69774         this_arg_conv.inner = untag_ptr(this_arg);
69775         this_arg_conv.is_owned = ptr_is_owned(this_arg);
69776         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
69777         this_arg_conv.is_owned = false;
69778         LDKCVec_PrivateRouteZ ret_var = Bolt11Invoice_private_routes(&this_arg_conv);
69779         uint64_tArray ret_arr = NULL;
69780         ret_arr = init_uint64_tArray(ret_var.datalen, __LINE__);
69781         uint64_t *ret_arr_ptr = (uint64_t*)(((uint8_t*)ret_arr) + 8);
69782         for (size_t o = 0; o < ret_var.datalen; o++) {
69783                 LDKPrivateRoute ret_conv_14_var = ret_var.data[o];
69784                 uint64_t ret_conv_14_ref = 0;
69785                 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_conv_14_var);
69786                 ret_conv_14_ref = tag_ptr(ret_conv_14_var.inner, ret_conv_14_var.is_owned);
69787                 ret_arr_ptr[o] = ret_conv_14_ref;
69788         }
69789         
69790         FREE(ret_var.data);
69791         return ret_arr;
69792 }
69793
69794 uint64_tArray  __attribute__((export_name("TS_Bolt11Invoice_route_hints"))) TS_Bolt11Invoice_route_hints(uint64_t this_arg) {
69795         LDKBolt11Invoice this_arg_conv;
69796         this_arg_conv.inner = untag_ptr(this_arg);
69797         this_arg_conv.is_owned = ptr_is_owned(this_arg);
69798         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
69799         this_arg_conv.is_owned = false;
69800         LDKCVec_RouteHintZ ret_var = Bolt11Invoice_route_hints(&this_arg_conv);
69801         uint64_tArray ret_arr = NULL;
69802         ret_arr = init_uint64_tArray(ret_var.datalen, __LINE__);
69803         uint64_t *ret_arr_ptr = (uint64_t*)(((uint8_t*)ret_arr) + 8);
69804         for (size_t l = 0; l < ret_var.datalen; l++) {
69805                 LDKRouteHint ret_conv_11_var = ret_var.data[l];
69806                 uint64_t ret_conv_11_ref = 0;
69807                 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_conv_11_var);
69808                 ret_conv_11_ref = tag_ptr(ret_conv_11_var.inner, ret_conv_11_var.is_owned);
69809                 ret_arr_ptr[l] = ret_conv_11_ref;
69810         }
69811         
69812         FREE(ret_var.data);
69813         return ret_arr;
69814 }
69815
69816 uint32_t  __attribute__((export_name("TS_Bolt11Invoice_currency"))) TS_Bolt11Invoice_currency(uint64_t this_arg) {
69817         LDKBolt11Invoice this_arg_conv;
69818         this_arg_conv.inner = untag_ptr(this_arg);
69819         this_arg_conv.is_owned = ptr_is_owned(this_arg);
69820         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
69821         this_arg_conv.is_owned = false;
69822         uint32_t ret_conv = LDKCurrency_to_js(Bolt11Invoice_currency(&this_arg_conv));
69823         return ret_conv;
69824 }
69825
69826 uint64_t  __attribute__((export_name("TS_Bolt11Invoice_amount_milli_satoshis"))) TS_Bolt11Invoice_amount_milli_satoshis(uint64_t this_arg) {
69827         LDKBolt11Invoice this_arg_conv;
69828         this_arg_conv.inner = untag_ptr(this_arg);
69829         this_arg_conv.is_owned = ptr_is_owned(this_arg);
69830         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
69831         this_arg_conv.is_owned = false;
69832         LDKCOption_u64Z *ret_copy = MALLOC(sizeof(LDKCOption_u64Z), "LDKCOption_u64Z");
69833         *ret_copy = Bolt11Invoice_amount_milli_satoshis(&this_arg_conv);
69834         uint64_t ret_ref = tag_ptr(ret_copy, true);
69835         return ret_ref;
69836 }
69837
69838 uint64_t  __attribute__((export_name("TS_Description_new"))) TS_Description_new(jstring description) {
69839         LDKStr description_conv = str_ref_to_owned_c(description);
69840         LDKCResult_DescriptionCreationErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_DescriptionCreationErrorZ), "LDKCResult_DescriptionCreationErrorZ");
69841         *ret_conv = Description_new(description_conv);
69842         return tag_ptr(ret_conv, true);
69843 }
69844
69845 jstring  __attribute__((export_name("TS_Description_into_inner"))) TS_Description_into_inner(uint64_t this_arg) {
69846         LDKDescription this_arg_conv;
69847         this_arg_conv.inner = untag_ptr(this_arg);
69848         this_arg_conv.is_owned = ptr_is_owned(this_arg);
69849         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
69850         this_arg_conv = Description_clone(&this_arg_conv);
69851         LDKStr ret_str = Description_into_inner(this_arg_conv);
69852         jstring ret_conv = str_ref_to_ts(ret_str.chars, ret_str.len);
69853         Str_free(ret_str);
69854         return ret_conv;
69855 }
69856
69857 uint64_t  __attribute__((export_name("TS_ExpiryTime_from_seconds"))) TS_ExpiryTime_from_seconds(int64_t seconds) {
69858         LDKExpiryTime ret_var = ExpiryTime_from_seconds(seconds);
69859         uint64_t ret_ref = 0;
69860         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
69861         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
69862         return ret_ref;
69863 }
69864
69865 uint64_t  __attribute__((export_name("TS_ExpiryTime_from_duration"))) TS_ExpiryTime_from_duration(int64_t duration) {
69866         LDKExpiryTime ret_var = ExpiryTime_from_duration(duration);
69867         uint64_t ret_ref = 0;
69868         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
69869         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
69870         return ret_ref;
69871 }
69872
69873 int64_t  __attribute__((export_name("TS_ExpiryTime_as_seconds"))) TS_ExpiryTime_as_seconds(uint64_t this_arg) {
69874         LDKExpiryTime this_arg_conv;
69875         this_arg_conv.inner = untag_ptr(this_arg);
69876         this_arg_conv.is_owned = ptr_is_owned(this_arg);
69877         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
69878         this_arg_conv.is_owned = false;
69879         int64_t ret_conv = ExpiryTime_as_seconds(&this_arg_conv);
69880         return ret_conv;
69881 }
69882
69883 int64_t  __attribute__((export_name("TS_ExpiryTime_as_duration"))) TS_ExpiryTime_as_duration(uint64_t this_arg) {
69884         LDKExpiryTime this_arg_conv;
69885         this_arg_conv.inner = untag_ptr(this_arg);
69886         this_arg_conv.is_owned = ptr_is_owned(this_arg);
69887         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
69888         this_arg_conv.is_owned = false;
69889         int64_t ret_conv = ExpiryTime_as_duration(&this_arg_conv);
69890         return ret_conv;
69891 }
69892
69893 uint64_t  __attribute__((export_name("TS_PrivateRoute_new"))) TS_PrivateRoute_new(uint64_t hops) {
69894         LDKRouteHint hops_conv;
69895         hops_conv.inner = untag_ptr(hops);
69896         hops_conv.is_owned = ptr_is_owned(hops);
69897         CHECK_INNER_FIELD_ACCESS_OR_NULL(hops_conv);
69898         hops_conv = RouteHint_clone(&hops_conv);
69899         LDKCResult_PrivateRouteCreationErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PrivateRouteCreationErrorZ), "LDKCResult_PrivateRouteCreationErrorZ");
69900         *ret_conv = PrivateRoute_new(hops_conv);
69901         return tag_ptr(ret_conv, true);
69902 }
69903
69904 uint64_t  __attribute__((export_name("TS_PrivateRoute_into_inner"))) TS_PrivateRoute_into_inner(uint64_t this_arg) {
69905         LDKPrivateRoute this_arg_conv;
69906         this_arg_conv.inner = untag_ptr(this_arg);
69907         this_arg_conv.is_owned = ptr_is_owned(this_arg);
69908         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
69909         this_arg_conv = PrivateRoute_clone(&this_arg_conv);
69910         LDKRouteHint ret_var = PrivateRoute_into_inner(this_arg_conv);
69911         uint64_t ret_ref = 0;
69912         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
69913         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
69914         return ret_ref;
69915 }
69916
69917 uint32_t  __attribute__((export_name("TS_CreationError_clone"))) TS_CreationError_clone(uint64_t orig) {
69918         LDKCreationError* orig_conv = (LDKCreationError*)untag_ptr(orig);
69919         uint32_t ret_conv = LDKCreationError_to_js(CreationError_clone(orig_conv));
69920         return ret_conv;
69921 }
69922
69923 uint32_t  __attribute__((export_name("TS_CreationError_description_too_long"))) TS_CreationError_description_too_long() {
69924         uint32_t ret_conv = LDKCreationError_to_js(CreationError_description_too_long());
69925         return ret_conv;
69926 }
69927
69928 uint32_t  __attribute__((export_name("TS_CreationError_route_too_long"))) TS_CreationError_route_too_long() {
69929         uint32_t ret_conv = LDKCreationError_to_js(CreationError_route_too_long());
69930         return ret_conv;
69931 }
69932
69933 uint32_t  __attribute__((export_name("TS_CreationError_timestamp_out_of_bounds"))) TS_CreationError_timestamp_out_of_bounds() {
69934         uint32_t ret_conv = LDKCreationError_to_js(CreationError_timestamp_out_of_bounds());
69935         return ret_conv;
69936 }
69937
69938 uint32_t  __attribute__((export_name("TS_CreationError_invalid_amount"))) TS_CreationError_invalid_amount() {
69939         uint32_t ret_conv = LDKCreationError_to_js(CreationError_invalid_amount());
69940         return ret_conv;
69941 }
69942
69943 uint32_t  __attribute__((export_name("TS_CreationError_missing_route_hints"))) TS_CreationError_missing_route_hints() {
69944         uint32_t ret_conv = LDKCreationError_to_js(CreationError_missing_route_hints());
69945         return ret_conv;
69946 }
69947
69948 uint32_t  __attribute__((export_name("TS_CreationError_min_final_cltv_expiry_delta_too_short"))) TS_CreationError_min_final_cltv_expiry_delta_too_short() {
69949         uint32_t ret_conv = LDKCreationError_to_js(CreationError_min_final_cltv_expiry_delta_too_short());
69950         return ret_conv;
69951 }
69952
69953 jboolean  __attribute__((export_name("TS_CreationError_eq"))) TS_CreationError_eq(uint64_t a, uint64_t b) {
69954         LDKCreationError* a_conv = (LDKCreationError*)untag_ptr(a);
69955         LDKCreationError* b_conv = (LDKCreationError*)untag_ptr(b);
69956         jboolean ret_conv = CreationError_eq(a_conv, b_conv);
69957         return ret_conv;
69958 }
69959
69960 jstring  __attribute__((export_name("TS_CreationError_to_str"))) TS_CreationError_to_str(uint64_t o) {
69961         LDKCreationError* o_conv = (LDKCreationError*)untag_ptr(o);
69962         LDKStr ret_str = CreationError_to_str(o_conv);
69963         jstring ret_conv = str_ref_to_ts(ret_str.chars, ret_str.len);
69964         Str_free(ret_str);
69965         return ret_conv;
69966 }
69967
69968 uint32_t  __attribute__((export_name("TS_Bolt11SemanticError_clone"))) TS_Bolt11SemanticError_clone(uint64_t orig) {
69969         LDKBolt11SemanticError* orig_conv = (LDKBolt11SemanticError*)untag_ptr(orig);
69970         uint32_t ret_conv = LDKBolt11SemanticError_to_js(Bolt11SemanticError_clone(orig_conv));
69971         return ret_conv;
69972 }
69973
69974 uint32_t  __attribute__((export_name("TS_Bolt11SemanticError_no_payment_hash"))) TS_Bolt11SemanticError_no_payment_hash() {
69975         uint32_t ret_conv = LDKBolt11SemanticError_to_js(Bolt11SemanticError_no_payment_hash());
69976         return ret_conv;
69977 }
69978
69979 uint32_t  __attribute__((export_name("TS_Bolt11SemanticError_multiple_payment_hashes"))) TS_Bolt11SemanticError_multiple_payment_hashes() {
69980         uint32_t ret_conv = LDKBolt11SemanticError_to_js(Bolt11SemanticError_multiple_payment_hashes());
69981         return ret_conv;
69982 }
69983
69984 uint32_t  __attribute__((export_name("TS_Bolt11SemanticError_no_description"))) TS_Bolt11SemanticError_no_description() {
69985         uint32_t ret_conv = LDKBolt11SemanticError_to_js(Bolt11SemanticError_no_description());
69986         return ret_conv;
69987 }
69988
69989 uint32_t  __attribute__((export_name("TS_Bolt11SemanticError_multiple_descriptions"))) TS_Bolt11SemanticError_multiple_descriptions() {
69990         uint32_t ret_conv = LDKBolt11SemanticError_to_js(Bolt11SemanticError_multiple_descriptions());
69991         return ret_conv;
69992 }
69993
69994 uint32_t  __attribute__((export_name("TS_Bolt11SemanticError_no_payment_secret"))) TS_Bolt11SemanticError_no_payment_secret() {
69995         uint32_t ret_conv = LDKBolt11SemanticError_to_js(Bolt11SemanticError_no_payment_secret());
69996         return ret_conv;
69997 }
69998
69999 uint32_t  __attribute__((export_name("TS_Bolt11SemanticError_multiple_payment_secrets"))) TS_Bolt11SemanticError_multiple_payment_secrets() {
70000         uint32_t ret_conv = LDKBolt11SemanticError_to_js(Bolt11SemanticError_multiple_payment_secrets());
70001         return ret_conv;
70002 }
70003
70004 uint32_t  __attribute__((export_name("TS_Bolt11SemanticError_invalid_features"))) TS_Bolt11SemanticError_invalid_features() {
70005         uint32_t ret_conv = LDKBolt11SemanticError_to_js(Bolt11SemanticError_invalid_features());
70006         return ret_conv;
70007 }
70008
70009 uint32_t  __attribute__((export_name("TS_Bolt11SemanticError_invalid_recovery_id"))) TS_Bolt11SemanticError_invalid_recovery_id() {
70010         uint32_t ret_conv = LDKBolt11SemanticError_to_js(Bolt11SemanticError_invalid_recovery_id());
70011         return ret_conv;
70012 }
70013
70014 uint32_t  __attribute__((export_name("TS_Bolt11SemanticError_invalid_signature"))) TS_Bolt11SemanticError_invalid_signature() {
70015         uint32_t ret_conv = LDKBolt11SemanticError_to_js(Bolt11SemanticError_invalid_signature());
70016         return ret_conv;
70017 }
70018
70019 uint32_t  __attribute__((export_name("TS_Bolt11SemanticError_imprecise_amount"))) TS_Bolt11SemanticError_imprecise_amount() {
70020         uint32_t ret_conv = LDKBolt11SemanticError_to_js(Bolt11SemanticError_imprecise_amount());
70021         return ret_conv;
70022 }
70023
70024 jboolean  __attribute__((export_name("TS_Bolt11SemanticError_eq"))) TS_Bolt11SemanticError_eq(uint64_t a, uint64_t b) {
70025         LDKBolt11SemanticError* a_conv = (LDKBolt11SemanticError*)untag_ptr(a);
70026         LDKBolt11SemanticError* b_conv = (LDKBolt11SemanticError*)untag_ptr(b);
70027         jboolean ret_conv = Bolt11SemanticError_eq(a_conv, b_conv);
70028         return ret_conv;
70029 }
70030
70031 jstring  __attribute__((export_name("TS_Bolt11SemanticError_to_str"))) TS_Bolt11SemanticError_to_str(uint64_t o) {
70032         LDKBolt11SemanticError* o_conv = (LDKBolt11SemanticError*)untag_ptr(o);
70033         LDKStr ret_str = Bolt11SemanticError_to_str(o_conv);
70034         jstring ret_conv = str_ref_to_ts(ret_str.chars, ret_str.len);
70035         Str_free(ret_str);
70036         return ret_conv;
70037 }
70038
70039 void  __attribute__((export_name("TS_SignOrCreationError_free"))) TS_SignOrCreationError_free(uint64_t this_ptr) {
70040         if (!ptr_is_owned(this_ptr)) return;
70041         void* this_ptr_ptr = untag_ptr(this_ptr);
70042         CHECK_ACCESS(this_ptr_ptr);
70043         LDKSignOrCreationError this_ptr_conv = *(LDKSignOrCreationError*)(this_ptr_ptr);
70044         FREE(untag_ptr(this_ptr));
70045         SignOrCreationError_free(this_ptr_conv);
70046 }
70047
70048 static inline uint64_t SignOrCreationError_clone_ptr(LDKSignOrCreationError *NONNULL_PTR arg) {
70049         LDKSignOrCreationError *ret_copy = MALLOC(sizeof(LDKSignOrCreationError), "LDKSignOrCreationError");
70050         *ret_copy = SignOrCreationError_clone(arg);
70051         uint64_t ret_ref = tag_ptr(ret_copy, true);
70052         return ret_ref;
70053 }
70054 int64_t  __attribute__((export_name("TS_SignOrCreationError_clone_ptr"))) TS_SignOrCreationError_clone_ptr(uint64_t arg) {
70055         LDKSignOrCreationError* arg_conv = (LDKSignOrCreationError*)untag_ptr(arg);
70056         int64_t ret_conv = SignOrCreationError_clone_ptr(arg_conv);
70057         return ret_conv;
70058 }
70059
70060 uint64_t  __attribute__((export_name("TS_SignOrCreationError_clone"))) TS_SignOrCreationError_clone(uint64_t orig) {
70061         LDKSignOrCreationError* orig_conv = (LDKSignOrCreationError*)untag_ptr(orig);
70062         LDKSignOrCreationError *ret_copy = MALLOC(sizeof(LDKSignOrCreationError), "LDKSignOrCreationError");
70063         *ret_copy = SignOrCreationError_clone(orig_conv);
70064         uint64_t ret_ref = tag_ptr(ret_copy, true);
70065         return ret_ref;
70066 }
70067
70068 uint64_t  __attribute__((export_name("TS_SignOrCreationError_sign_error"))) TS_SignOrCreationError_sign_error() {
70069         LDKSignOrCreationError *ret_copy = MALLOC(sizeof(LDKSignOrCreationError), "LDKSignOrCreationError");
70070         *ret_copy = SignOrCreationError_sign_error();
70071         uint64_t ret_ref = tag_ptr(ret_copy, true);
70072         return ret_ref;
70073 }
70074
70075 uint64_t  __attribute__((export_name("TS_SignOrCreationError_creation_error"))) TS_SignOrCreationError_creation_error(uint32_t a) {
70076         LDKCreationError a_conv = LDKCreationError_from_js(a);
70077         LDKSignOrCreationError *ret_copy = MALLOC(sizeof(LDKSignOrCreationError), "LDKSignOrCreationError");
70078         *ret_copy = SignOrCreationError_creation_error(a_conv);
70079         uint64_t ret_ref = tag_ptr(ret_copy, true);
70080         return ret_ref;
70081 }
70082
70083 jboolean  __attribute__((export_name("TS_SignOrCreationError_eq"))) TS_SignOrCreationError_eq(uint64_t a, uint64_t b) {
70084         LDKSignOrCreationError* a_conv = (LDKSignOrCreationError*)untag_ptr(a);
70085         LDKSignOrCreationError* b_conv = (LDKSignOrCreationError*)untag_ptr(b);
70086         jboolean ret_conv = SignOrCreationError_eq(a_conv, b_conv);
70087         return ret_conv;
70088 }
70089
70090 jstring  __attribute__((export_name("TS_SignOrCreationError_to_str"))) TS_SignOrCreationError_to_str(uint64_t o) {
70091         LDKSignOrCreationError* o_conv = (LDKSignOrCreationError*)untag_ptr(o);
70092         LDKStr ret_str = SignOrCreationError_to_str(o_conv);
70093         jstring ret_conv = str_ref_to_ts(ret_str.chars, ret_str.len);
70094         Str_free(ret_str);
70095         return ret_conv;
70096 }
70097
70098 uint64_t  __attribute__((export_name("TS_pay_invoice"))) TS_pay_invoice(uint64_t invoice, uint64_t retry_strategy, uint64_t channelmanager) {
70099         LDKBolt11Invoice invoice_conv;
70100         invoice_conv.inner = untag_ptr(invoice);
70101         invoice_conv.is_owned = ptr_is_owned(invoice);
70102         CHECK_INNER_FIELD_ACCESS_OR_NULL(invoice_conv);
70103         invoice_conv.is_owned = false;
70104         void* retry_strategy_ptr = untag_ptr(retry_strategy);
70105         CHECK_ACCESS(retry_strategy_ptr);
70106         LDKRetry retry_strategy_conv = *(LDKRetry*)(retry_strategy_ptr);
70107         retry_strategy_conv = Retry_clone((LDKRetry*)untag_ptr(retry_strategy));
70108         LDKChannelManager channelmanager_conv;
70109         channelmanager_conv.inner = untag_ptr(channelmanager);
70110         channelmanager_conv.is_owned = ptr_is_owned(channelmanager);
70111         CHECK_INNER_FIELD_ACCESS_OR_NULL(channelmanager_conv);
70112         channelmanager_conv.is_owned = false;
70113         LDKCResult_ThirtyTwoBytesPaymentErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ThirtyTwoBytesPaymentErrorZ), "LDKCResult_ThirtyTwoBytesPaymentErrorZ");
70114         *ret_conv = pay_invoice(&invoice_conv, retry_strategy_conv, &channelmanager_conv);
70115         return tag_ptr(ret_conv, true);
70116 }
70117
70118 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) {
70119         LDKBolt11Invoice invoice_conv;
70120         invoice_conv.inner = untag_ptr(invoice);
70121         invoice_conv.is_owned = ptr_is_owned(invoice);
70122         CHECK_INNER_FIELD_ACCESS_OR_NULL(invoice_conv);
70123         invoice_conv.is_owned = false;
70124         LDKThirtyTwoBytes payment_id_ref;
70125         CHECK(payment_id->arr_len == 32);
70126         memcpy(payment_id_ref.data, payment_id->elems, 32); FREE(payment_id);
70127         void* retry_strategy_ptr = untag_ptr(retry_strategy);
70128         CHECK_ACCESS(retry_strategy_ptr);
70129         LDKRetry retry_strategy_conv = *(LDKRetry*)(retry_strategy_ptr);
70130         retry_strategy_conv = Retry_clone((LDKRetry*)untag_ptr(retry_strategy));
70131         LDKChannelManager channelmanager_conv;
70132         channelmanager_conv.inner = untag_ptr(channelmanager);
70133         channelmanager_conv.is_owned = ptr_is_owned(channelmanager);
70134         CHECK_INNER_FIELD_ACCESS_OR_NULL(channelmanager_conv);
70135         channelmanager_conv.is_owned = false;
70136         LDKCResult_NonePaymentErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NonePaymentErrorZ), "LDKCResult_NonePaymentErrorZ");
70137         *ret_conv = pay_invoice_with_id(&invoice_conv, payment_id_ref, retry_strategy_conv, &channelmanager_conv);
70138         return tag_ptr(ret_conv, true);
70139 }
70140
70141 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) {
70142         LDKBolt11Invoice invoice_conv;
70143         invoice_conv.inner = untag_ptr(invoice);
70144         invoice_conv.is_owned = ptr_is_owned(invoice);
70145         CHECK_INNER_FIELD_ACCESS_OR_NULL(invoice_conv);
70146         invoice_conv.is_owned = false;
70147         void* retry_strategy_ptr = untag_ptr(retry_strategy);
70148         CHECK_ACCESS(retry_strategy_ptr);
70149         LDKRetry retry_strategy_conv = *(LDKRetry*)(retry_strategy_ptr);
70150         retry_strategy_conv = Retry_clone((LDKRetry*)untag_ptr(retry_strategy));
70151         LDKChannelManager channelmanager_conv;
70152         channelmanager_conv.inner = untag_ptr(channelmanager);
70153         channelmanager_conv.is_owned = ptr_is_owned(channelmanager);
70154         CHECK_INNER_FIELD_ACCESS_OR_NULL(channelmanager_conv);
70155         channelmanager_conv.is_owned = false;
70156         LDKCResult_ThirtyTwoBytesPaymentErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ThirtyTwoBytesPaymentErrorZ), "LDKCResult_ThirtyTwoBytesPaymentErrorZ");
70157         *ret_conv = pay_zero_value_invoice(&invoice_conv, amount_msats, retry_strategy_conv, &channelmanager_conv);
70158         return tag_ptr(ret_conv, true);
70159 }
70160
70161 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) {
70162         LDKBolt11Invoice invoice_conv;
70163         invoice_conv.inner = untag_ptr(invoice);
70164         invoice_conv.is_owned = ptr_is_owned(invoice);
70165         CHECK_INNER_FIELD_ACCESS_OR_NULL(invoice_conv);
70166         invoice_conv.is_owned = false;
70167         LDKThirtyTwoBytes payment_id_ref;
70168         CHECK(payment_id->arr_len == 32);
70169         memcpy(payment_id_ref.data, payment_id->elems, 32); FREE(payment_id);
70170         void* retry_strategy_ptr = untag_ptr(retry_strategy);
70171         CHECK_ACCESS(retry_strategy_ptr);
70172         LDKRetry retry_strategy_conv = *(LDKRetry*)(retry_strategy_ptr);
70173         retry_strategy_conv = Retry_clone((LDKRetry*)untag_ptr(retry_strategy));
70174         LDKChannelManager channelmanager_conv;
70175         channelmanager_conv.inner = untag_ptr(channelmanager);
70176         channelmanager_conv.is_owned = ptr_is_owned(channelmanager);
70177         CHECK_INNER_FIELD_ACCESS_OR_NULL(channelmanager_conv);
70178         channelmanager_conv.is_owned = false;
70179         LDKCResult_NonePaymentErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NonePaymentErrorZ), "LDKCResult_NonePaymentErrorZ");
70180         *ret_conv = pay_zero_value_invoice_with_id(&invoice_conv, amount_msats, payment_id_ref, retry_strategy_conv, &channelmanager_conv);
70181         return tag_ptr(ret_conv, true);
70182 }
70183
70184 uint64_t  __attribute__((export_name("TS_preflight_probe_invoice"))) TS_preflight_probe_invoice(uint64_t invoice, uint64_t channelmanager, uint64_t liquidity_limit_multiplier) {
70185         LDKBolt11Invoice invoice_conv;
70186         invoice_conv.inner = untag_ptr(invoice);
70187         invoice_conv.is_owned = ptr_is_owned(invoice);
70188         CHECK_INNER_FIELD_ACCESS_OR_NULL(invoice_conv);
70189         invoice_conv.is_owned = false;
70190         LDKChannelManager channelmanager_conv;
70191         channelmanager_conv.inner = untag_ptr(channelmanager);
70192         channelmanager_conv.is_owned = ptr_is_owned(channelmanager);
70193         CHECK_INNER_FIELD_ACCESS_OR_NULL(channelmanager_conv);
70194         channelmanager_conv.is_owned = false;
70195         void* liquidity_limit_multiplier_ptr = untag_ptr(liquidity_limit_multiplier);
70196         CHECK_ACCESS(liquidity_limit_multiplier_ptr);
70197         LDKCOption_u64Z liquidity_limit_multiplier_conv = *(LDKCOption_u64Z*)(liquidity_limit_multiplier_ptr);
70198         liquidity_limit_multiplier_conv = COption_u64Z_clone((LDKCOption_u64Z*)untag_ptr(liquidity_limit_multiplier));
70199         LDKCResult_CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZProbingErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZProbingErrorZ), "LDKCResult_CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZProbingErrorZ");
70200         *ret_conv = preflight_probe_invoice(&invoice_conv, &channelmanager_conv, liquidity_limit_multiplier_conv);
70201         return tag_ptr(ret_conv, true);
70202 }
70203
70204 uint64_t  __attribute__((export_name("TS_preflight_probe_zero_value_invoice"))) TS_preflight_probe_zero_value_invoice(uint64_t invoice, int64_t amount_msat, uint64_t channelmanager, uint64_t liquidity_limit_multiplier) {
70205         LDKBolt11Invoice invoice_conv;
70206         invoice_conv.inner = untag_ptr(invoice);
70207         invoice_conv.is_owned = ptr_is_owned(invoice);
70208         CHECK_INNER_FIELD_ACCESS_OR_NULL(invoice_conv);
70209         invoice_conv.is_owned = false;
70210         LDKChannelManager channelmanager_conv;
70211         channelmanager_conv.inner = untag_ptr(channelmanager);
70212         channelmanager_conv.is_owned = ptr_is_owned(channelmanager);
70213         CHECK_INNER_FIELD_ACCESS_OR_NULL(channelmanager_conv);
70214         channelmanager_conv.is_owned = false;
70215         void* liquidity_limit_multiplier_ptr = untag_ptr(liquidity_limit_multiplier);
70216         CHECK_ACCESS(liquidity_limit_multiplier_ptr);
70217         LDKCOption_u64Z liquidity_limit_multiplier_conv = *(LDKCOption_u64Z*)(liquidity_limit_multiplier_ptr);
70218         liquidity_limit_multiplier_conv = COption_u64Z_clone((LDKCOption_u64Z*)untag_ptr(liquidity_limit_multiplier));
70219         LDKCResult_CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZProbingErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZProbingErrorZ), "LDKCResult_CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZProbingErrorZ");
70220         *ret_conv = preflight_probe_zero_value_invoice(&invoice_conv, amount_msat, &channelmanager_conv, liquidity_limit_multiplier_conv);
70221         return tag_ptr(ret_conv, true);
70222 }
70223
70224 void  __attribute__((export_name("TS_PaymentError_free"))) TS_PaymentError_free(uint64_t this_ptr) {
70225         if (!ptr_is_owned(this_ptr)) return;
70226         void* this_ptr_ptr = untag_ptr(this_ptr);
70227         CHECK_ACCESS(this_ptr_ptr);
70228         LDKPaymentError this_ptr_conv = *(LDKPaymentError*)(this_ptr_ptr);
70229         FREE(untag_ptr(this_ptr));
70230         PaymentError_free(this_ptr_conv);
70231 }
70232
70233 static inline uint64_t PaymentError_clone_ptr(LDKPaymentError *NONNULL_PTR arg) {
70234         LDKPaymentError *ret_copy = MALLOC(sizeof(LDKPaymentError), "LDKPaymentError");
70235         *ret_copy = PaymentError_clone(arg);
70236         uint64_t ret_ref = tag_ptr(ret_copy, true);
70237         return ret_ref;
70238 }
70239 int64_t  __attribute__((export_name("TS_PaymentError_clone_ptr"))) TS_PaymentError_clone_ptr(uint64_t arg) {
70240         LDKPaymentError* arg_conv = (LDKPaymentError*)untag_ptr(arg);
70241         int64_t ret_conv = PaymentError_clone_ptr(arg_conv);
70242         return ret_conv;
70243 }
70244
70245 uint64_t  __attribute__((export_name("TS_PaymentError_clone"))) TS_PaymentError_clone(uint64_t orig) {
70246         LDKPaymentError* orig_conv = (LDKPaymentError*)untag_ptr(orig);
70247         LDKPaymentError *ret_copy = MALLOC(sizeof(LDKPaymentError), "LDKPaymentError");
70248         *ret_copy = PaymentError_clone(orig_conv);
70249         uint64_t ret_ref = tag_ptr(ret_copy, true);
70250         return ret_ref;
70251 }
70252
70253 uint64_t  __attribute__((export_name("TS_PaymentError_invoice"))) TS_PaymentError_invoice(jstring a) {
70254         LDKStr a_conv = str_ref_to_owned_c(a);
70255         LDKPaymentError *ret_copy = MALLOC(sizeof(LDKPaymentError), "LDKPaymentError");
70256         *ret_copy = PaymentError_invoice(a_conv);
70257         uint64_t ret_ref = tag_ptr(ret_copy, true);
70258         return ret_ref;
70259 }
70260
70261 uint64_t  __attribute__((export_name("TS_PaymentError_sending"))) TS_PaymentError_sending(uint32_t a) {
70262         LDKRetryableSendFailure a_conv = LDKRetryableSendFailure_from_js(a);
70263         LDKPaymentError *ret_copy = MALLOC(sizeof(LDKPaymentError), "LDKPaymentError");
70264         *ret_copy = PaymentError_sending(a_conv);
70265         uint64_t ret_ref = tag_ptr(ret_copy, true);
70266         return ret_ref;
70267 }
70268
70269 jboolean  __attribute__((export_name("TS_PaymentError_eq"))) TS_PaymentError_eq(uint64_t a, uint64_t b) {
70270         LDKPaymentError* a_conv = (LDKPaymentError*)untag_ptr(a);
70271         LDKPaymentError* b_conv = (LDKPaymentError*)untag_ptr(b);
70272         jboolean ret_conv = PaymentError_eq(a_conv, b_conv);
70273         return ret_conv;
70274 }
70275
70276 void  __attribute__((export_name("TS_ProbingError_free"))) TS_ProbingError_free(uint64_t this_ptr) {
70277         if (!ptr_is_owned(this_ptr)) return;
70278         void* this_ptr_ptr = untag_ptr(this_ptr);
70279         CHECK_ACCESS(this_ptr_ptr);
70280         LDKProbingError this_ptr_conv = *(LDKProbingError*)(this_ptr_ptr);
70281         FREE(untag_ptr(this_ptr));
70282         ProbingError_free(this_ptr_conv);
70283 }
70284
70285 static inline uint64_t ProbingError_clone_ptr(LDKProbingError *NONNULL_PTR arg) {
70286         LDKProbingError *ret_copy = MALLOC(sizeof(LDKProbingError), "LDKProbingError");
70287         *ret_copy = ProbingError_clone(arg);
70288         uint64_t ret_ref = tag_ptr(ret_copy, true);
70289         return ret_ref;
70290 }
70291 int64_t  __attribute__((export_name("TS_ProbingError_clone_ptr"))) TS_ProbingError_clone_ptr(uint64_t arg) {
70292         LDKProbingError* arg_conv = (LDKProbingError*)untag_ptr(arg);
70293         int64_t ret_conv = ProbingError_clone_ptr(arg_conv);
70294         return ret_conv;
70295 }
70296
70297 uint64_t  __attribute__((export_name("TS_ProbingError_clone"))) TS_ProbingError_clone(uint64_t orig) {
70298         LDKProbingError* orig_conv = (LDKProbingError*)untag_ptr(orig);
70299         LDKProbingError *ret_copy = MALLOC(sizeof(LDKProbingError), "LDKProbingError");
70300         *ret_copy = ProbingError_clone(orig_conv);
70301         uint64_t ret_ref = tag_ptr(ret_copy, true);
70302         return ret_ref;
70303 }
70304
70305 uint64_t  __attribute__((export_name("TS_ProbingError_invoice"))) TS_ProbingError_invoice(jstring a) {
70306         LDKStr a_conv = str_ref_to_owned_c(a);
70307         LDKProbingError *ret_copy = MALLOC(sizeof(LDKProbingError), "LDKProbingError");
70308         *ret_copy = ProbingError_invoice(a_conv);
70309         uint64_t ret_ref = tag_ptr(ret_copy, true);
70310         return ret_ref;
70311 }
70312
70313 uint64_t  __attribute__((export_name("TS_ProbingError_sending"))) TS_ProbingError_sending(uint64_t a) {
70314         void* a_ptr = untag_ptr(a);
70315         CHECK_ACCESS(a_ptr);
70316         LDKProbeSendFailure a_conv = *(LDKProbeSendFailure*)(a_ptr);
70317         a_conv = ProbeSendFailure_clone((LDKProbeSendFailure*)untag_ptr(a));
70318         LDKProbingError *ret_copy = MALLOC(sizeof(LDKProbingError), "LDKProbingError");
70319         *ret_copy = ProbingError_sending(a_conv);
70320         uint64_t ret_ref = tag_ptr(ret_copy, true);
70321         return ret_ref;
70322 }
70323
70324 jboolean  __attribute__((export_name("TS_ProbingError_eq"))) TS_ProbingError_eq(uint64_t a, uint64_t b) {
70325         LDKProbingError* a_conv = (LDKProbingError*)untag_ptr(a);
70326         LDKProbingError* b_conv = (LDKProbingError*)untag_ptr(b);
70327         jboolean ret_conv = ProbingError_eq(a_conv, b_conv);
70328         return ret_conv;
70329 }
70330
70331 uint64_t  __attribute__((export_name("TS_create_phantom_invoice"))) TS_create_phantom_invoice(uint64_t amt_msat, uint64_t 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) {
70332         void* amt_msat_ptr = untag_ptr(amt_msat);
70333         CHECK_ACCESS(amt_msat_ptr);
70334         LDKCOption_u64Z amt_msat_conv = *(LDKCOption_u64Z*)(amt_msat_ptr);
70335         amt_msat_conv = COption_u64Z_clone((LDKCOption_u64Z*)untag_ptr(amt_msat));
70336         void* payment_hash_ptr = untag_ptr(payment_hash);
70337         CHECK_ACCESS(payment_hash_ptr);
70338         LDKCOption_ThirtyTwoBytesZ payment_hash_conv = *(LDKCOption_ThirtyTwoBytesZ*)(payment_hash_ptr);
70339         payment_hash_conv = COption_ThirtyTwoBytesZ_clone((LDKCOption_ThirtyTwoBytesZ*)untag_ptr(payment_hash));
70340         LDKStr description_conv = str_ref_to_owned_c(description);
70341         LDKCVec_PhantomRouteHintsZ phantom_route_hints_constr;
70342         phantom_route_hints_constr.datalen = phantom_route_hints->arr_len;
70343         if (phantom_route_hints_constr.datalen > 0)
70344                 phantom_route_hints_constr.data = MALLOC(phantom_route_hints_constr.datalen * sizeof(LDKPhantomRouteHints), "LDKCVec_PhantomRouteHintsZ Elements");
70345         else
70346                 phantom_route_hints_constr.data = NULL;
70347         uint64_t* phantom_route_hints_vals = phantom_route_hints->elems;
70348         for (size_t t = 0; t < phantom_route_hints_constr.datalen; t++) {
70349                 uint64_t phantom_route_hints_conv_19 = phantom_route_hints_vals[t];
70350                 LDKPhantomRouteHints phantom_route_hints_conv_19_conv;
70351                 phantom_route_hints_conv_19_conv.inner = untag_ptr(phantom_route_hints_conv_19);
70352                 phantom_route_hints_conv_19_conv.is_owned = ptr_is_owned(phantom_route_hints_conv_19);
70353                 CHECK_INNER_FIELD_ACCESS_OR_NULL(phantom_route_hints_conv_19_conv);
70354                 phantom_route_hints_conv_19_conv = PhantomRouteHints_clone(&phantom_route_hints_conv_19_conv);
70355                 phantom_route_hints_constr.data[t] = phantom_route_hints_conv_19_conv;
70356         }
70357         FREE(phantom_route_hints);
70358         void* entropy_source_ptr = untag_ptr(entropy_source);
70359         CHECK_ACCESS(entropy_source_ptr);
70360         LDKEntropySource entropy_source_conv = *(LDKEntropySource*)(entropy_source_ptr);
70361         if (entropy_source_conv.free == LDKEntropySource_JCalls_free) {
70362                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
70363                 LDKEntropySource_JCalls_cloned(&entropy_source_conv);
70364         }
70365         void* node_signer_ptr = untag_ptr(node_signer);
70366         CHECK_ACCESS(node_signer_ptr);
70367         LDKNodeSigner node_signer_conv = *(LDKNodeSigner*)(node_signer_ptr);
70368         if (node_signer_conv.free == LDKNodeSigner_JCalls_free) {
70369                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
70370                 LDKNodeSigner_JCalls_cloned(&node_signer_conv);
70371         }
70372         void* logger_ptr = untag_ptr(logger);
70373         CHECK_ACCESS(logger_ptr);
70374         LDKLogger logger_conv = *(LDKLogger*)(logger_ptr);
70375         if (logger_conv.free == LDKLogger_JCalls_free) {
70376                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
70377                 LDKLogger_JCalls_cloned(&logger_conv);
70378         }
70379         LDKCurrency network_conv = LDKCurrency_from_js(network);
70380         void* min_final_cltv_expiry_delta_ptr = untag_ptr(min_final_cltv_expiry_delta);
70381         CHECK_ACCESS(min_final_cltv_expiry_delta_ptr);
70382         LDKCOption_u16Z min_final_cltv_expiry_delta_conv = *(LDKCOption_u16Z*)(min_final_cltv_expiry_delta_ptr);
70383         min_final_cltv_expiry_delta_conv = COption_u16Z_clone((LDKCOption_u16Z*)untag_ptr(min_final_cltv_expiry_delta));
70384         LDKCResult_Bolt11InvoiceSignOrCreationErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_Bolt11InvoiceSignOrCreationErrorZ), "LDKCResult_Bolt11InvoiceSignOrCreationErrorZ");
70385         *ret_conv = create_phantom_invoice(amt_msat_conv, payment_hash_conv, 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);
70386         return tag_ptr(ret_conv, true);
70387 }
70388
70389 uint64_t  __attribute__((export_name("TS_create_phantom_invoice_with_description_hash"))) TS_create_phantom_invoice_with_description_hash(uint64_t amt_msat, uint64_t 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) {
70390         void* amt_msat_ptr = untag_ptr(amt_msat);
70391         CHECK_ACCESS(amt_msat_ptr);
70392         LDKCOption_u64Z amt_msat_conv = *(LDKCOption_u64Z*)(amt_msat_ptr);
70393         amt_msat_conv = COption_u64Z_clone((LDKCOption_u64Z*)untag_ptr(amt_msat));
70394         void* payment_hash_ptr = untag_ptr(payment_hash);
70395         CHECK_ACCESS(payment_hash_ptr);
70396         LDKCOption_ThirtyTwoBytesZ payment_hash_conv = *(LDKCOption_ThirtyTwoBytesZ*)(payment_hash_ptr);
70397         payment_hash_conv = COption_ThirtyTwoBytesZ_clone((LDKCOption_ThirtyTwoBytesZ*)untag_ptr(payment_hash));
70398         LDKSha256 description_hash_conv;
70399         description_hash_conv.inner = untag_ptr(description_hash);
70400         description_hash_conv.is_owned = ptr_is_owned(description_hash);
70401         CHECK_INNER_FIELD_ACCESS_OR_NULL(description_hash_conv);
70402         description_hash_conv = Sha256_clone(&description_hash_conv);
70403         LDKCVec_PhantomRouteHintsZ phantom_route_hints_constr;
70404         phantom_route_hints_constr.datalen = phantom_route_hints->arr_len;
70405         if (phantom_route_hints_constr.datalen > 0)
70406                 phantom_route_hints_constr.data = MALLOC(phantom_route_hints_constr.datalen * sizeof(LDKPhantomRouteHints), "LDKCVec_PhantomRouteHintsZ Elements");
70407         else
70408                 phantom_route_hints_constr.data = NULL;
70409         uint64_t* phantom_route_hints_vals = phantom_route_hints->elems;
70410         for (size_t t = 0; t < phantom_route_hints_constr.datalen; t++) {
70411                 uint64_t phantom_route_hints_conv_19 = phantom_route_hints_vals[t];
70412                 LDKPhantomRouteHints phantom_route_hints_conv_19_conv;
70413                 phantom_route_hints_conv_19_conv.inner = untag_ptr(phantom_route_hints_conv_19);
70414                 phantom_route_hints_conv_19_conv.is_owned = ptr_is_owned(phantom_route_hints_conv_19);
70415                 CHECK_INNER_FIELD_ACCESS_OR_NULL(phantom_route_hints_conv_19_conv);
70416                 phantom_route_hints_conv_19_conv = PhantomRouteHints_clone(&phantom_route_hints_conv_19_conv);
70417                 phantom_route_hints_constr.data[t] = phantom_route_hints_conv_19_conv;
70418         }
70419         FREE(phantom_route_hints);
70420         void* entropy_source_ptr = untag_ptr(entropy_source);
70421         CHECK_ACCESS(entropy_source_ptr);
70422         LDKEntropySource entropy_source_conv = *(LDKEntropySource*)(entropy_source_ptr);
70423         if (entropy_source_conv.free == LDKEntropySource_JCalls_free) {
70424                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
70425                 LDKEntropySource_JCalls_cloned(&entropy_source_conv);
70426         }
70427         void* node_signer_ptr = untag_ptr(node_signer);
70428         CHECK_ACCESS(node_signer_ptr);
70429         LDKNodeSigner node_signer_conv = *(LDKNodeSigner*)(node_signer_ptr);
70430         if (node_signer_conv.free == LDKNodeSigner_JCalls_free) {
70431                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
70432                 LDKNodeSigner_JCalls_cloned(&node_signer_conv);
70433         }
70434         void* logger_ptr = untag_ptr(logger);
70435         CHECK_ACCESS(logger_ptr);
70436         LDKLogger logger_conv = *(LDKLogger*)(logger_ptr);
70437         if (logger_conv.free == LDKLogger_JCalls_free) {
70438                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
70439                 LDKLogger_JCalls_cloned(&logger_conv);
70440         }
70441         LDKCurrency network_conv = LDKCurrency_from_js(network);
70442         void* min_final_cltv_expiry_delta_ptr = untag_ptr(min_final_cltv_expiry_delta);
70443         CHECK_ACCESS(min_final_cltv_expiry_delta_ptr);
70444         LDKCOption_u16Z min_final_cltv_expiry_delta_conv = *(LDKCOption_u16Z*)(min_final_cltv_expiry_delta_ptr);
70445         min_final_cltv_expiry_delta_conv = COption_u16Z_clone((LDKCOption_u16Z*)untag_ptr(min_final_cltv_expiry_delta));
70446         LDKCResult_Bolt11InvoiceSignOrCreationErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_Bolt11InvoiceSignOrCreationErrorZ), "LDKCResult_Bolt11InvoiceSignOrCreationErrorZ");
70447         *ret_conv = create_phantom_invoice_with_description_hash(amt_msat_conv, payment_hash_conv, 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);
70448         return tag_ptr(ret_conv, true);
70449 }
70450
70451 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) {
70452         LDKChannelManager channelmanager_conv;
70453         channelmanager_conv.inner = untag_ptr(channelmanager);
70454         channelmanager_conv.is_owned = ptr_is_owned(channelmanager);
70455         CHECK_INNER_FIELD_ACCESS_OR_NULL(channelmanager_conv);
70456         channelmanager_conv.is_owned = false;
70457         void* node_signer_ptr = untag_ptr(node_signer);
70458         CHECK_ACCESS(node_signer_ptr);
70459         LDKNodeSigner node_signer_conv = *(LDKNodeSigner*)(node_signer_ptr);
70460         if (node_signer_conv.free == LDKNodeSigner_JCalls_free) {
70461                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
70462                 LDKNodeSigner_JCalls_cloned(&node_signer_conv);
70463         }
70464         void* logger_ptr = untag_ptr(logger);
70465         CHECK_ACCESS(logger_ptr);
70466         LDKLogger logger_conv = *(LDKLogger*)(logger_ptr);
70467         if (logger_conv.free == LDKLogger_JCalls_free) {
70468                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
70469                 LDKLogger_JCalls_cloned(&logger_conv);
70470         }
70471         LDKCurrency network_conv = LDKCurrency_from_js(network);
70472         void* amt_msat_ptr = untag_ptr(amt_msat);
70473         CHECK_ACCESS(amt_msat_ptr);
70474         LDKCOption_u64Z amt_msat_conv = *(LDKCOption_u64Z*)(amt_msat_ptr);
70475         amt_msat_conv = COption_u64Z_clone((LDKCOption_u64Z*)untag_ptr(amt_msat));
70476         LDKSha256 description_hash_conv;
70477         description_hash_conv.inner = untag_ptr(description_hash);
70478         description_hash_conv.is_owned = ptr_is_owned(description_hash);
70479         CHECK_INNER_FIELD_ACCESS_OR_NULL(description_hash_conv);
70480         description_hash_conv = Sha256_clone(&description_hash_conv);
70481         void* min_final_cltv_expiry_delta_ptr = untag_ptr(min_final_cltv_expiry_delta);
70482         CHECK_ACCESS(min_final_cltv_expiry_delta_ptr);
70483         LDKCOption_u16Z min_final_cltv_expiry_delta_conv = *(LDKCOption_u16Z*)(min_final_cltv_expiry_delta_ptr);
70484         min_final_cltv_expiry_delta_conv = COption_u16Z_clone((LDKCOption_u16Z*)untag_ptr(min_final_cltv_expiry_delta));
70485         LDKCResult_Bolt11InvoiceSignOrCreationErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_Bolt11InvoiceSignOrCreationErrorZ), "LDKCResult_Bolt11InvoiceSignOrCreationErrorZ");
70486         *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);
70487         return tag_ptr(ret_conv, true);
70488 }
70489
70490 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) {
70491         LDKChannelManager channelmanager_conv;
70492         channelmanager_conv.inner = untag_ptr(channelmanager);
70493         channelmanager_conv.is_owned = ptr_is_owned(channelmanager);
70494         CHECK_INNER_FIELD_ACCESS_OR_NULL(channelmanager_conv);
70495         channelmanager_conv.is_owned = false;
70496         void* node_signer_ptr = untag_ptr(node_signer);
70497         CHECK_ACCESS(node_signer_ptr);
70498         LDKNodeSigner node_signer_conv = *(LDKNodeSigner*)(node_signer_ptr);
70499         if (node_signer_conv.free == LDKNodeSigner_JCalls_free) {
70500                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
70501                 LDKNodeSigner_JCalls_cloned(&node_signer_conv);
70502         }
70503         void* logger_ptr = untag_ptr(logger);
70504         CHECK_ACCESS(logger_ptr);
70505         LDKLogger logger_conv = *(LDKLogger*)(logger_ptr);
70506         if (logger_conv.free == LDKLogger_JCalls_free) {
70507                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
70508                 LDKLogger_JCalls_cloned(&logger_conv);
70509         }
70510         LDKCurrency network_conv = LDKCurrency_from_js(network);
70511         void* amt_msat_ptr = untag_ptr(amt_msat);
70512         CHECK_ACCESS(amt_msat_ptr);
70513         LDKCOption_u64Z amt_msat_conv = *(LDKCOption_u64Z*)(amt_msat_ptr);
70514         amt_msat_conv = COption_u64Z_clone((LDKCOption_u64Z*)untag_ptr(amt_msat));
70515         LDKStr description_conv = str_ref_to_owned_c(description);
70516         void* min_final_cltv_expiry_delta_ptr = untag_ptr(min_final_cltv_expiry_delta);
70517         CHECK_ACCESS(min_final_cltv_expiry_delta_ptr);
70518         LDKCOption_u16Z min_final_cltv_expiry_delta_conv = *(LDKCOption_u16Z*)(min_final_cltv_expiry_delta_ptr);
70519         min_final_cltv_expiry_delta_conv = COption_u16Z_clone((LDKCOption_u16Z*)untag_ptr(min_final_cltv_expiry_delta));
70520         LDKCResult_Bolt11InvoiceSignOrCreationErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_Bolt11InvoiceSignOrCreationErrorZ), "LDKCResult_Bolt11InvoiceSignOrCreationErrorZ");
70521         *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);
70522         return tag_ptr(ret_conv, true);
70523 }
70524
70525 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) {
70526         LDKChannelManager channelmanager_conv;
70527         channelmanager_conv.inner = untag_ptr(channelmanager);
70528         channelmanager_conv.is_owned = ptr_is_owned(channelmanager);
70529         CHECK_INNER_FIELD_ACCESS_OR_NULL(channelmanager_conv);
70530         channelmanager_conv.is_owned = false;
70531         void* node_signer_ptr = untag_ptr(node_signer);
70532         CHECK_ACCESS(node_signer_ptr);
70533         LDKNodeSigner node_signer_conv = *(LDKNodeSigner*)(node_signer_ptr);
70534         if (node_signer_conv.free == LDKNodeSigner_JCalls_free) {
70535                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
70536                 LDKNodeSigner_JCalls_cloned(&node_signer_conv);
70537         }
70538         void* logger_ptr = untag_ptr(logger);
70539         CHECK_ACCESS(logger_ptr);
70540         LDKLogger logger_conv = *(LDKLogger*)(logger_ptr);
70541         if (logger_conv.free == LDKLogger_JCalls_free) {
70542                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
70543                 LDKLogger_JCalls_cloned(&logger_conv);
70544         }
70545         LDKCurrency network_conv = LDKCurrency_from_js(network);
70546         void* amt_msat_ptr = untag_ptr(amt_msat);
70547         CHECK_ACCESS(amt_msat_ptr);
70548         LDKCOption_u64Z amt_msat_conv = *(LDKCOption_u64Z*)(amt_msat_ptr);
70549         amt_msat_conv = COption_u64Z_clone((LDKCOption_u64Z*)untag_ptr(amt_msat));
70550         LDKStr description_conv = str_ref_to_owned_c(description);
70551         LDKThirtyTwoBytes payment_hash_ref;
70552         CHECK(payment_hash->arr_len == 32);
70553         memcpy(payment_hash_ref.data, payment_hash->elems, 32); FREE(payment_hash);
70554         void* min_final_cltv_expiry_delta_ptr = untag_ptr(min_final_cltv_expiry_delta);
70555         CHECK_ACCESS(min_final_cltv_expiry_delta_ptr);
70556         LDKCOption_u16Z min_final_cltv_expiry_delta_conv = *(LDKCOption_u16Z*)(min_final_cltv_expiry_delta_ptr);
70557         min_final_cltv_expiry_delta_conv = COption_u16Z_clone((LDKCOption_u16Z*)untag_ptr(min_final_cltv_expiry_delta));
70558         LDKCResult_Bolt11InvoiceSignOrCreationErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_Bolt11InvoiceSignOrCreationErrorZ), "LDKCResult_Bolt11InvoiceSignOrCreationErrorZ");
70559         *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);
70560         return tag_ptr(ret_conv, true);
70561 }
70562
70563 uint64_t  __attribute__((export_name("TS_SiPrefix_from_str"))) TS_SiPrefix_from_str(jstring s) {
70564         LDKStr s_conv = str_ref_to_owned_c(s);
70565         LDKCResult_SiPrefixBolt11ParseErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_SiPrefixBolt11ParseErrorZ), "LDKCResult_SiPrefixBolt11ParseErrorZ");
70566         *ret_conv = SiPrefix_from_str(s_conv);
70567         return tag_ptr(ret_conv, true);
70568 }
70569
70570 uint64_t  __attribute__((export_name("TS_Bolt11Invoice_from_str"))) TS_Bolt11Invoice_from_str(jstring s) {
70571         LDKStr s_conv = str_ref_to_owned_c(s);
70572         LDKCResult_Bolt11InvoiceParseOrSemanticErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_Bolt11InvoiceParseOrSemanticErrorZ), "LDKCResult_Bolt11InvoiceParseOrSemanticErrorZ");
70573         *ret_conv = Bolt11Invoice_from_str(s_conv);
70574         return tag_ptr(ret_conv, true);
70575 }
70576
70577 uint64_t  __attribute__((export_name("TS_SignedRawBolt11Invoice_from_str"))) TS_SignedRawBolt11Invoice_from_str(jstring s) {
70578         LDKStr s_conv = str_ref_to_owned_c(s);
70579         LDKCResult_SignedRawBolt11InvoiceBolt11ParseErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_SignedRawBolt11InvoiceBolt11ParseErrorZ), "LDKCResult_SignedRawBolt11InvoiceBolt11ParseErrorZ");
70580         *ret_conv = SignedRawBolt11Invoice_from_str(s_conv);
70581         return tag_ptr(ret_conv, true);
70582 }
70583
70584 jstring  __attribute__((export_name("TS_Bolt11ParseError_to_str"))) TS_Bolt11ParseError_to_str(uint64_t o) {
70585         LDKBolt11ParseError* o_conv = (LDKBolt11ParseError*)untag_ptr(o);
70586         LDKStr ret_str = Bolt11ParseError_to_str(o_conv);
70587         jstring ret_conv = str_ref_to_ts(ret_str.chars, ret_str.len);
70588         Str_free(ret_str);
70589         return ret_conv;
70590 }
70591
70592 jstring  __attribute__((export_name("TS_ParseOrSemanticError_to_str"))) TS_ParseOrSemanticError_to_str(uint64_t o) {
70593         LDKParseOrSemanticError* o_conv = (LDKParseOrSemanticError*)untag_ptr(o);
70594         LDKStr ret_str = ParseOrSemanticError_to_str(o_conv);
70595         jstring ret_conv = str_ref_to_ts(ret_str.chars, ret_str.len);
70596         Str_free(ret_str);
70597         return ret_conv;
70598 }
70599
70600 jstring  __attribute__((export_name("TS_Bolt11Invoice_to_str"))) TS_Bolt11Invoice_to_str(uint64_t o) {
70601         LDKBolt11Invoice o_conv;
70602         o_conv.inner = untag_ptr(o);
70603         o_conv.is_owned = ptr_is_owned(o);
70604         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
70605         o_conv.is_owned = false;
70606         LDKStr ret_str = Bolt11Invoice_to_str(&o_conv);
70607         jstring ret_conv = str_ref_to_ts(ret_str.chars, ret_str.len);
70608         Str_free(ret_str);
70609         return ret_conv;
70610 }
70611
70612 jstring  __attribute__((export_name("TS_SignedRawBolt11Invoice_to_str"))) TS_SignedRawBolt11Invoice_to_str(uint64_t o) {
70613         LDKSignedRawBolt11Invoice o_conv;
70614         o_conv.inner = untag_ptr(o);
70615         o_conv.is_owned = ptr_is_owned(o);
70616         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
70617         o_conv.is_owned = false;
70618         LDKStr ret_str = SignedRawBolt11Invoice_to_str(&o_conv);
70619         jstring ret_conv = str_ref_to_ts(ret_str.chars, ret_str.len);
70620         Str_free(ret_str);
70621         return ret_conv;
70622 }
70623
70624 jstring  __attribute__((export_name("TS_Currency_to_str"))) TS_Currency_to_str(uint64_t o) {
70625         LDKCurrency* o_conv = (LDKCurrency*)untag_ptr(o);
70626         LDKStr ret_str = Currency_to_str(o_conv);
70627         jstring ret_conv = str_ref_to_ts(ret_str.chars, ret_str.len);
70628         Str_free(ret_str);
70629         return ret_conv;
70630 }
70631
70632 jstring  __attribute__((export_name("TS_SiPrefix_to_str"))) TS_SiPrefix_to_str(uint64_t o) {
70633         LDKSiPrefix* o_conv = (LDKSiPrefix*)untag_ptr(o);
70634         LDKStr ret_str = SiPrefix_to_str(o_conv);
70635         jstring ret_conv = str_ref_to_ts(ret_str.chars, ret_str.len);
70636         Str_free(ret_str);
70637         return ret_conv;
70638 }
70639