[TS] Update auto-generated bindings to LDK 0.0.118
[ldk-java] / ts / bindings.c.body
1 #include "js-wasm.h"
2 #include <stdatomic.h>
3 #include <lightning.h>
4
5 // These should be provided...somehow...
6 void *memset(void *s, int c, size_t n);
7 void *memcpy(void *dest, const void *src, size_t n);
8 int memcmp(const void *s1, const void *s2, size_t n);
9
10 extern void __attribute__((noreturn)) abort(void);
11 static inline void assert(bool expression) {
12         if (!expression) { abort(); }
13 }
14
15 uint32_t __attribute__((export_name("test_bigint_pass_deadbeef0badf00d"))) test_bigint_pass_deadbeef0badf00d(uint64_t val) {
16         return val == 0xdeadbeef0badf00dULL;
17 }
18
19
20 void *malloc(size_t size);
21 void free(void *ptr);
22
23 #define MALLOC(a, _) malloc(a)
24 #define do_MALLOC(a, _b, _c) malloc(a)
25 #define FREE(p) if ((unsigned long)(p) > 4096) { free(p); }
26 #define DO_ASSERT(a) (void)(a)
27 #define CHECK(a)
28 #define CHECK_ACCESS(p)
29 #define CHECK_INNER_FIELD_ACCESS_OR_NULL(v)
30
31 // We assume that CVec_u8Z and u8slice are the same size and layout (and thus pointers to the two can be mixed)
32 _Static_assert(sizeof(LDKCVec_u8Z) == sizeof(LDKu8slice), "Vec<u8> and [u8] need to have been mapped identically");
33 _Static_assert(offsetof(LDKCVec_u8Z, data) == offsetof(LDKu8slice, data), "Vec<u8> and [u8] need to have been mapped identically");
34 _Static_assert(offsetof(LDKCVec_u8Z, datalen) == offsetof(LDKu8slice, datalen), "Vec<u8> and [u8] need to have been mapped identically");
35
36 _Static_assert(sizeof(void*) == 4, "Pointers mut be 32 bits");
37
38 #define DECL_ARR_TYPE(ty, name) \
39         struct name##array { \
40                 uint64_t arr_len; /* uint32_t would suffice but we want to align uint64_ts as well */ \
41                 ty elems[]; \
42         }; \
43         typedef struct name##array * name##Array; \
44         static inline name##Array init_##name##Array(size_t arr_len, int lineno) { \
45                 name##Array arr = (name##Array)do_MALLOC(arr_len * sizeof(ty) + sizeof(uint64_t), #name" array init", lineno); \
46                 arr->arr_len = arr_len; \
47                 return arr; \
48         }
49
50 DECL_ARR_TYPE(int64_t, int64_t);
51 DECL_ARR_TYPE(uint64_t, uint64_t);
52 DECL_ARR_TYPE(int8_t, int8_t);
53 DECL_ARR_TYPE(int16_t, int16_t);
54 DECL_ARR_TYPE(uint32_t, uint32_t);
55 DECL_ARR_TYPE(void*, ptr);
56 DECL_ARR_TYPE(char, char);
57 typedef charArray jstring;
58
59 static inline jstring str_ref_to_ts(const char* chars, size_t len) {
60         charArray arr = init_charArray(len, __LINE__);
61         memcpy(arr->elems, chars, len);
62         return arr;
63 }
64 static inline LDKStr str_ref_to_owned_c(const jstring str) {
65         char* newchars = MALLOC(str->arr_len + 1, "String chars");
66         memcpy(newchars, str->elems, str->arr_len);
67         newchars[str->arr_len] = 0;
68         LDKStr res = {
69                 .chars = newchars,
70                 .len = str->arr_len,
71                 .chars_is_owned = true
72         };
73         return res;
74 }
75
76 typedef bool jboolean;
77
78 uint32_t __attribute__((export_name("TS_malloc"))) TS_malloc(uint32_t size) {
79         return (uint32_t)MALLOC(size, "JS-Called malloc");
80 }
81 void __attribute__((export_name("TS_free"))) TS_free(uint32_t ptr) {
82         FREE((void*)ptr);
83 }
84
85 jstring __attribute__((export_name("TS_get_ldk_c_bindings_version"))) TS_get_ldk_c_bindings_version() {
86         const char *res = check_get_ldk_bindings_version();
87         if (res == NULL) return NULL;
88         return str_ref_to_ts(res, strlen(res));
89 }
90 jstring __attribute__((export_name("TS_get_ldk_version"))) get_ldk_version() {
91         const char *res = check_get_ldk_version();
92         if (res == NULL) return NULL;
93         return str_ref_to_ts(res, strlen(res));
94 }
95 #include "version.c"
96 static inline struct LDKThirtyTwoBytes ThirtyTwoBytes_clone(const struct LDKThirtyTwoBytes *orig) { struct LDKThirtyTwoBytes ret; memcpy(ret.data, orig->data, 32); return ret; }
97
98 static inline void* untag_ptr(uint64_t ptr) {
99         if (ptr < 4096) return (void*)ptr;
100         if (sizeof(void*) == 4) {
101                 // For 32-bit systems, store pointers as 64-bit ints and use the 31st bit
102                 return (void*)(uintptr_t)ptr;
103         } else {
104                 // For 64-bit systems, assume the top byte is used for tagging, then
105                 // use bit 9 ^ bit 10.
106                 uint64_t tenth_bit = (((uintptr_t)ptr) & (1ULL << 54)) >> 54;
107                 uintptr_t p = (ptr & ~(1ULL << 55)) | (tenth_bit << 55);
108 #ifdef LDK_DEBUG_BUILD
109                 // On debug builds we also use the 11th bit as a debug flag
110                 uintptr_t eleventh_bit = (((uintptr_t)ptr) & (1ULL << 53)) >> 53;
111                 CHECK(tenth_bit != eleventh_bit);
112                 p ^= 1ULL << 53;
113 #endif
114                 return (void*)p;
115         }
116 }
117 static inline bool ptr_is_owned(uint64_t ptr) {
118         if(ptr < 4096) return true;
119         if (sizeof(void*) == 4) {
120                 return ptr & (1ULL << 32);
121         } else {
122                 uintptr_t ninth_bit = (((uintptr_t)ptr) & (1ULL << 55)) >> 55;
123                 uintptr_t tenth_bit = (((uintptr_t)ptr) & (1ULL << 54)) >> 54;
124 #ifdef LDK_DEBUG_BUILD
125                 // On debug builds we also use the 11th bit as a debug flag
126                 uintptr_t eleventh_bit = (((uintptr_t)ptr) & (1ULL << 53)) >> 53;
127                 CHECK(tenth_bit != eleventh_bit);
128 #endif
129                 return (ninth_bit ^ tenth_bit) ? true : false;
130         }
131 }
132 static inline uint64_t tag_ptr(const void* ptr, bool is_owned) {
133         if ((uintptr_t)ptr < 4096) return (uint64_t)ptr;
134         if (sizeof(void*) == 4) {
135                 return (((uint64_t)ptr) | ((is_owned ? 1ULL : 0) << 32));
136         } else {
137                 CHECK(sizeof(uintptr_t) == 8);
138                 uintptr_t tenth_bit = (((uintptr_t)ptr) & (1ULL << 54)) >> 54;
139                 uintptr_t t = (((uintptr_t)ptr) | (((is_owned ? 1ULL : 0ULL) ^ tenth_bit) << 55));
140 #ifdef LDK_DEBUG_BUILD
141                 uintptr_t ninth_bit = (((uintptr_t)ptr) & (1ULL << 55)) >> 55;
142                 uintptr_t eleventh_bit = (((uintptr_t)ptr) & (1ULL << 53)) >> 53;
143                 CHECK(ninth_bit == tenth_bit);
144                 CHECK(ninth_bit == eleventh_bit);
145                 t ^= 1ULL << 53;
146 #endif
147                 CHECK(ptr_is_owned(t) == is_owned);
148                 CHECK(untag_ptr(t) == ptr);
149                 return t;
150         }
151 }
152
153 static inline LDKBolt11SemanticError LDKBolt11SemanticError_from_js(int32_t ord) {
154         switch (ord) {
155                 case 0: return LDKBolt11SemanticError_NoPaymentHash;
156                 case 1: return LDKBolt11SemanticError_MultiplePaymentHashes;
157                 case 2: return LDKBolt11SemanticError_NoDescription;
158                 case 3: return LDKBolt11SemanticError_MultipleDescriptions;
159                 case 4: return LDKBolt11SemanticError_NoPaymentSecret;
160                 case 5: return LDKBolt11SemanticError_MultiplePaymentSecrets;
161                 case 6: return LDKBolt11SemanticError_InvalidFeatures;
162                 case 7: return LDKBolt11SemanticError_InvalidRecoveryId;
163                 case 8: return LDKBolt11SemanticError_InvalidSignature;
164                 case 9: return LDKBolt11SemanticError_ImpreciseAmount;
165         }
166         abort();
167 }
168 static inline int32_t LDKBolt11SemanticError_to_js(LDKBolt11SemanticError val) {
169         switch (val) {
170                 case LDKBolt11SemanticError_NoPaymentHash: return 0;
171                 case LDKBolt11SemanticError_MultiplePaymentHashes: return 1;
172                 case LDKBolt11SemanticError_NoDescription: return 2;
173                 case LDKBolt11SemanticError_MultipleDescriptions: return 3;
174                 case LDKBolt11SemanticError_NoPaymentSecret: return 4;
175                 case LDKBolt11SemanticError_MultiplePaymentSecrets: return 5;
176                 case LDKBolt11SemanticError_InvalidFeatures: return 6;
177                 case LDKBolt11SemanticError_InvalidRecoveryId: return 7;
178                 case LDKBolt11SemanticError_InvalidSignature: return 8;
179                 case LDKBolt11SemanticError_ImpreciseAmount: return 9;
180                 default: abort();
181         }
182 }
183 static inline LDKBolt12SemanticError LDKBolt12SemanticError_from_js(int32_t ord) {
184         switch (ord) {
185                 case 0: return LDKBolt12SemanticError_AlreadyExpired;
186                 case 1: return LDKBolt12SemanticError_UnsupportedChain;
187                 case 2: return LDKBolt12SemanticError_UnexpectedChain;
188                 case 3: return LDKBolt12SemanticError_MissingAmount;
189                 case 4: return LDKBolt12SemanticError_InvalidAmount;
190                 case 5: return LDKBolt12SemanticError_InsufficientAmount;
191                 case 6: return LDKBolt12SemanticError_UnexpectedAmount;
192                 case 7: return LDKBolt12SemanticError_UnsupportedCurrency;
193                 case 8: return LDKBolt12SemanticError_UnknownRequiredFeatures;
194                 case 9: return LDKBolt12SemanticError_UnexpectedFeatures;
195                 case 10: return LDKBolt12SemanticError_MissingDescription;
196                 case 11: return LDKBolt12SemanticError_MissingSigningPubkey;
197                 case 12: return LDKBolt12SemanticError_InvalidSigningPubkey;
198                 case 13: return LDKBolt12SemanticError_UnexpectedSigningPubkey;
199                 case 14: return LDKBolt12SemanticError_MissingQuantity;
200                 case 15: return LDKBolt12SemanticError_InvalidQuantity;
201                 case 16: return LDKBolt12SemanticError_UnexpectedQuantity;
202                 case 17: return LDKBolt12SemanticError_InvalidMetadata;
203                 case 18: return LDKBolt12SemanticError_UnexpectedMetadata;
204                 case 19: return LDKBolt12SemanticError_MissingPayerMetadata;
205                 case 20: return LDKBolt12SemanticError_MissingPayerId;
206                 case 21: return LDKBolt12SemanticError_DuplicatePaymentId;
207                 case 22: return LDKBolt12SemanticError_MissingPaths;
208                 case 23: return LDKBolt12SemanticError_InvalidPayInfo;
209                 case 24: return LDKBolt12SemanticError_MissingCreationTime;
210                 case 25: return LDKBolt12SemanticError_MissingPaymentHash;
211                 case 26: return LDKBolt12SemanticError_MissingSignature;
212         }
213         abort();
214 }
215 static inline int32_t LDKBolt12SemanticError_to_js(LDKBolt12SemanticError val) {
216         switch (val) {
217                 case LDKBolt12SemanticError_AlreadyExpired: return 0;
218                 case LDKBolt12SemanticError_UnsupportedChain: return 1;
219                 case LDKBolt12SemanticError_UnexpectedChain: return 2;
220                 case LDKBolt12SemanticError_MissingAmount: return 3;
221                 case LDKBolt12SemanticError_InvalidAmount: return 4;
222                 case LDKBolt12SemanticError_InsufficientAmount: return 5;
223                 case LDKBolt12SemanticError_UnexpectedAmount: return 6;
224                 case LDKBolt12SemanticError_UnsupportedCurrency: return 7;
225                 case LDKBolt12SemanticError_UnknownRequiredFeatures: return 8;
226                 case LDKBolt12SemanticError_UnexpectedFeatures: return 9;
227                 case LDKBolt12SemanticError_MissingDescription: return 10;
228                 case LDKBolt12SemanticError_MissingSigningPubkey: return 11;
229                 case LDKBolt12SemanticError_InvalidSigningPubkey: return 12;
230                 case LDKBolt12SemanticError_UnexpectedSigningPubkey: return 13;
231                 case LDKBolt12SemanticError_MissingQuantity: return 14;
232                 case LDKBolt12SemanticError_InvalidQuantity: return 15;
233                 case LDKBolt12SemanticError_UnexpectedQuantity: return 16;
234                 case LDKBolt12SemanticError_InvalidMetadata: return 17;
235                 case LDKBolt12SemanticError_UnexpectedMetadata: return 18;
236                 case LDKBolt12SemanticError_MissingPayerMetadata: return 19;
237                 case LDKBolt12SemanticError_MissingPayerId: return 20;
238                 case LDKBolt12SemanticError_DuplicatePaymentId: return 21;
239                 case LDKBolt12SemanticError_MissingPaths: return 22;
240                 case LDKBolt12SemanticError_InvalidPayInfo: return 23;
241                 case LDKBolt12SemanticError_MissingCreationTime: return 24;
242                 case LDKBolt12SemanticError_MissingPaymentHash: return 25;
243                 case LDKBolt12SemanticError_MissingSignature: return 26;
244                 default: abort();
245         }
246 }
247 static inline LDKCOption_NoneZ LDKCOption_NoneZ_from_js(int32_t ord) {
248         switch (ord) {
249                 case 0: return LDKCOption_NoneZ_Some;
250                 case 1: return LDKCOption_NoneZ_None;
251         }
252         abort();
253 }
254 static inline int32_t LDKCOption_NoneZ_to_js(LDKCOption_NoneZ val) {
255         switch (val) {
256                 case LDKCOption_NoneZ_Some: return 0;
257                 case LDKCOption_NoneZ_None: return 1;
258                 default: abort();
259         }
260 }
261 static inline LDKChannelMonitorUpdateStatus LDKChannelMonitorUpdateStatus_from_js(int32_t ord) {
262         switch (ord) {
263                 case 0: return LDKChannelMonitorUpdateStatus_Completed;
264                 case 1: return LDKChannelMonitorUpdateStatus_InProgress;
265                 case 2: return LDKChannelMonitorUpdateStatus_UnrecoverableError;
266         }
267         abort();
268 }
269 static inline int32_t LDKChannelMonitorUpdateStatus_to_js(LDKChannelMonitorUpdateStatus val) {
270         switch (val) {
271                 case LDKChannelMonitorUpdateStatus_Completed: return 0;
272                 case LDKChannelMonitorUpdateStatus_InProgress: return 1;
273                 case LDKChannelMonitorUpdateStatus_UnrecoverableError: return 2;
274                 default: abort();
275         }
276 }
277 static inline LDKChannelShutdownState LDKChannelShutdownState_from_js(int32_t ord) {
278         switch (ord) {
279                 case 0: return LDKChannelShutdownState_NotShuttingDown;
280                 case 1: return LDKChannelShutdownState_ShutdownInitiated;
281                 case 2: return LDKChannelShutdownState_ResolvingHTLCs;
282                 case 3: return LDKChannelShutdownState_NegotiatingClosingFee;
283                 case 4: return LDKChannelShutdownState_ShutdownComplete;
284         }
285         abort();
286 }
287 static inline int32_t LDKChannelShutdownState_to_js(LDKChannelShutdownState val) {
288         switch (val) {
289                 case LDKChannelShutdownState_NotShuttingDown: return 0;
290                 case LDKChannelShutdownState_ShutdownInitiated: return 1;
291                 case LDKChannelShutdownState_ResolvingHTLCs: return 2;
292                 case LDKChannelShutdownState_NegotiatingClosingFee: return 3;
293                 case LDKChannelShutdownState_ShutdownComplete: return 4;
294                 default: abort();
295         }
296 }
297 static inline LDKConfirmationTarget LDKConfirmationTarget_from_js(int32_t ord) {
298         switch (ord) {
299                 case 0: return LDKConfirmationTarget_OnChainSweep;
300                 case 1: return LDKConfirmationTarget_MaxAllowedNonAnchorChannelRemoteFee;
301                 case 2: return LDKConfirmationTarget_MinAllowedAnchorChannelRemoteFee;
302                 case 3: return LDKConfirmationTarget_MinAllowedNonAnchorChannelRemoteFee;
303                 case 4: return LDKConfirmationTarget_AnchorChannelFee;
304                 case 5: return LDKConfirmationTarget_NonAnchorChannelFee;
305                 case 6: return LDKConfirmationTarget_ChannelCloseMinimum;
306         }
307         abort();
308 }
309 static inline int32_t LDKConfirmationTarget_to_js(LDKConfirmationTarget val) {
310         switch (val) {
311                 case LDKConfirmationTarget_OnChainSweep: return 0;
312                 case LDKConfirmationTarget_MaxAllowedNonAnchorChannelRemoteFee: return 1;
313                 case LDKConfirmationTarget_MinAllowedAnchorChannelRemoteFee: return 2;
314                 case LDKConfirmationTarget_MinAllowedNonAnchorChannelRemoteFee: return 3;
315                 case LDKConfirmationTarget_AnchorChannelFee: return 4;
316                 case LDKConfirmationTarget_NonAnchorChannelFee: return 5;
317                 case LDKConfirmationTarget_ChannelCloseMinimum: return 6;
318                 default: abort();
319         }
320 }
321 static inline LDKCreationError LDKCreationError_from_js(int32_t ord) {
322         switch (ord) {
323                 case 0: return LDKCreationError_DescriptionTooLong;
324                 case 1: return LDKCreationError_RouteTooLong;
325                 case 2: return LDKCreationError_TimestampOutOfBounds;
326                 case 3: return LDKCreationError_InvalidAmount;
327                 case 4: return LDKCreationError_MissingRouteHints;
328                 case 5: return LDKCreationError_MinFinalCltvExpiryDeltaTooShort;
329         }
330         abort();
331 }
332 static inline int32_t LDKCreationError_to_js(LDKCreationError val) {
333         switch (val) {
334                 case LDKCreationError_DescriptionTooLong: return 0;
335                 case LDKCreationError_RouteTooLong: return 1;
336                 case LDKCreationError_TimestampOutOfBounds: return 2;
337                 case LDKCreationError_InvalidAmount: return 3;
338                 case LDKCreationError_MissingRouteHints: return 4;
339                 case LDKCreationError_MinFinalCltvExpiryDeltaTooShort: return 5;
340                 default: abort();
341         }
342 }
343 static inline LDKCurrency LDKCurrency_from_js(int32_t ord) {
344         switch (ord) {
345                 case 0: return LDKCurrency_Bitcoin;
346                 case 1: return LDKCurrency_BitcoinTestnet;
347                 case 2: return LDKCurrency_Regtest;
348                 case 3: return LDKCurrency_Simnet;
349                 case 4: return LDKCurrency_Signet;
350         }
351         abort();
352 }
353 static inline int32_t LDKCurrency_to_js(LDKCurrency val) {
354         switch (val) {
355                 case LDKCurrency_Bitcoin: return 0;
356                 case LDKCurrency_BitcoinTestnet: return 1;
357                 case LDKCurrency_Regtest: return 2;
358                 case LDKCurrency_Simnet: return 3;
359                 case LDKCurrency_Signet: return 4;
360                 default: abort();
361         }
362 }
363 static inline LDKHTLCClaim LDKHTLCClaim_from_js(int32_t ord) {
364         switch (ord) {
365                 case 0: return LDKHTLCClaim_OfferedTimeout;
366                 case 1: return LDKHTLCClaim_OfferedPreimage;
367                 case 2: return LDKHTLCClaim_AcceptedTimeout;
368                 case 3: return LDKHTLCClaim_AcceptedPreimage;
369                 case 4: return LDKHTLCClaim_Revocation;
370         }
371         abort();
372 }
373 static inline int32_t LDKHTLCClaim_to_js(LDKHTLCClaim val) {
374         switch (val) {
375                 case LDKHTLCClaim_OfferedTimeout: return 0;
376                 case LDKHTLCClaim_OfferedPreimage: return 1;
377                 case LDKHTLCClaim_AcceptedTimeout: return 2;
378                 case LDKHTLCClaim_AcceptedPreimage: return 3;
379                 case LDKHTLCClaim_Revocation: return 4;
380                 default: abort();
381         }
382 }
383 static inline LDKIOError LDKIOError_from_js(int32_t ord) {
384         switch (ord) {
385                 case 0: return LDKIOError_NotFound;
386                 case 1: return LDKIOError_PermissionDenied;
387                 case 2: return LDKIOError_ConnectionRefused;
388                 case 3: return LDKIOError_ConnectionReset;
389                 case 4: return LDKIOError_ConnectionAborted;
390                 case 5: return LDKIOError_NotConnected;
391                 case 6: return LDKIOError_AddrInUse;
392                 case 7: return LDKIOError_AddrNotAvailable;
393                 case 8: return LDKIOError_BrokenPipe;
394                 case 9: return LDKIOError_AlreadyExists;
395                 case 10: return LDKIOError_WouldBlock;
396                 case 11: return LDKIOError_InvalidInput;
397                 case 12: return LDKIOError_InvalidData;
398                 case 13: return LDKIOError_TimedOut;
399                 case 14: return LDKIOError_WriteZero;
400                 case 15: return LDKIOError_Interrupted;
401                 case 16: return LDKIOError_Other;
402                 case 17: return LDKIOError_UnexpectedEof;
403         }
404         abort();
405 }
406 static inline int32_t LDKIOError_to_js(LDKIOError val) {
407         switch (val) {
408                 case LDKIOError_NotFound: return 0;
409                 case LDKIOError_PermissionDenied: return 1;
410                 case LDKIOError_ConnectionRefused: return 2;
411                 case LDKIOError_ConnectionReset: return 3;
412                 case LDKIOError_ConnectionAborted: return 4;
413                 case LDKIOError_NotConnected: return 5;
414                 case LDKIOError_AddrInUse: return 6;
415                 case LDKIOError_AddrNotAvailable: return 7;
416                 case LDKIOError_BrokenPipe: return 8;
417                 case LDKIOError_AlreadyExists: return 9;
418                 case LDKIOError_WouldBlock: return 10;
419                 case LDKIOError_InvalidInput: return 11;
420                 case LDKIOError_InvalidData: return 12;
421                 case LDKIOError_TimedOut: return 13;
422                 case LDKIOError_WriteZero: return 14;
423                 case LDKIOError_Interrupted: return 15;
424                 case LDKIOError_Other: return 16;
425                 case LDKIOError_UnexpectedEof: return 17;
426                 default: abort();
427         }
428 }
429 static inline LDKLevel LDKLevel_from_js(int32_t ord) {
430         switch (ord) {
431                 case 0: return LDKLevel_Gossip;
432                 case 1: return LDKLevel_Trace;
433                 case 2: return LDKLevel_Debug;
434                 case 3: return LDKLevel_Info;
435                 case 4: return LDKLevel_Warn;
436                 case 5: return LDKLevel_Error;
437         }
438         abort();
439 }
440 static inline int32_t LDKLevel_to_js(LDKLevel val) {
441         switch (val) {
442                 case LDKLevel_Gossip: return 0;
443                 case LDKLevel_Trace: return 1;
444                 case LDKLevel_Debug: return 2;
445                 case LDKLevel_Info: return 3;
446                 case LDKLevel_Warn: return 4;
447                 case LDKLevel_Error: return 5;
448                 default: abort();
449         }
450 }
451 static inline LDKNetwork LDKNetwork_from_js(int32_t ord) {
452         switch (ord) {
453                 case 0: return LDKNetwork_Bitcoin;
454                 case 1: return LDKNetwork_Testnet;
455                 case 2: return LDKNetwork_Regtest;
456                 case 3: return LDKNetwork_Signet;
457         }
458         abort();
459 }
460 static inline int32_t LDKNetwork_to_js(LDKNetwork val) {
461         switch (val) {
462                 case LDKNetwork_Bitcoin: return 0;
463                 case LDKNetwork_Testnet: return 1;
464                 case LDKNetwork_Regtest: return 2;
465                 case LDKNetwork_Signet: return 3;
466                 default: abort();
467         }
468 }
469 static inline LDKPaymentFailureReason LDKPaymentFailureReason_from_js(int32_t ord) {
470         switch (ord) {
471                 case 0: return LDKPaymentFailureReason_RecipientRejected;
472                 case 1: return LDKPaymentFailureReason_UserAbandoned;
473                 case 2: return LDKPaymentFailureReason_RetriesExhausted;
474                 case 3: return LDKPaymentFailureReason_PaymentExpired;
475                 case 4: return LDKPaymentFailureReason_RouteNotFound;
476                 case 5: return LDKPaymentFailureReason_UnexpectedError;
477         }
478         abort();
479 }
480 static inline int32_t LDKPaymentFailureReason_to_js(LDKPaymentFailureReason val) {
481         switch (val) {
482                 case LDKPaymentFailureReason_RecipientRejected: return 0;
483                 case LDKPaymentFailureReason_UserAbandoned: return 1;
484                 case LDKPaymentFailureReason_RetriesExhausted: return 2;
485                 case LDKPaymentFailureReason_PaymentExpired: return 3;
486                 case LDKPaymentFailureReason_RouteNotFound: return 4;
487                 case LDKPaymentFailureReason_UnexpectedError: return 5;
488                 default: abort();
489         }
490 }
491 static inline LDKRecipient LDKRecipient_from_js(int32_t ord) {
492         switch (ord) {
493                 case 0: return LDKRecipient_Node;
494                 case 1: return LDKRecipient_PhantomNode;
495         }
496         abort();
497 }
498 static inline int32_t LDKRecipient_to_js(LDKRecipient val) {
499         switch (val) {
500                 case LDKRecipient_Node: return 0;
501                 case LDKRecipient_PhantomNode: return 1;
502                 default: abort();
503         }
504 }
505 static inline LDKRetryableSendFailure LDKRetryableSendFailure_from_js(int32_t ord) {
506         switch (ord) {
507                 case 0: return LDKRetryableSendFailure_PaymentExpired;
508                 case 1: return LDKRetryableSendFailure_RouteNotFound;
509                 case 2: return LDKRetryableSendFailure_DuplicatePayment;
510         }
511         abort();
512 }
513 static inline int32_t LDKRetryableSendFailure_to_js(LDKRetryableSendFailure val) {
514         switch (val) {
515                 case LDKRetryableSendFailure_PaymentExpired: return 0;
516                 case LDKRetryableSendFailure_RouteNotFound: return 1;
517                 case LDKRetryableSendFailure_DuplicatePayment: return 2;
518                 default: abort();
519         }
520 }
521 static inline LDKSecp256k1Error LDKSecp256k1Error_from_js(int32_t ord) {
522         switch (ord) {
523                 case 0: return LDKSecp256k1Error_IncorrectSignature;
524                 case 1: return LDKSecp256k1Error_InvalidMessage;
525                 case 2: return LDKSecp256k1Error_InvalidPublicKey;
526                 case 3: return LDKSecp256k1Error_InvalidSignature;
527                 case 4: return LDKSecp256k1Error_InvalidSecretKey;
528                 case 5: return LDKSecp256k1Error_InvalidSharedSecret;
529                 case 6: return LDKSecp256k1Error_InvalidRecoveryId;
530                 case 7: return LDKSecp256k1Error_InvalidTweak;
531                 case 8: return LDKSecp256k1Error_NotEnoughMemory;
532                 case 9: return LDKSecp256k1Error_InvalidPublicKeySum;
533                 case 10: return LDKSecp256k1Error_InvalidParityValue;
534         }
535         abort();
536 }
537 static inline int32_t LDKSecp256k1Error_to_js(LDKSecp256k1Error val) {
538         switch (val) {
539                 case LDKSecp256k1Error_IncorrectSignature: return 0;
540                 case LDKSecp256k1Error_InvalidMessage: return 1;
541                 case LDKSecp256k1Error_InvalidPublicKey: return 2;
542                 case LDKSecp256k1Error_InvalidSignature: return 3;
543                 case LDKSecp256k1Error_InvalidSecretKey: return 4;
544                 case LDKSecp256k1Error_InvalidSharedSecret: return 5;
545                 case LDKSecp256k1Error_InvalidRecoveryId: return 6;
546                 case LDKSecp256k1Error_InvalidTweak: return 7;
547                 case LDKSecp256k1Error_NotEnoughMemory: return 8;
548                 case LDKSecp256k1Error_InvalidPublicKeySum: return 9;
549                 case LDKSecp256k1Error_InvalidParityValue: return 10;
550                 default: abort();
551         }
552 }
553 static inline LDKSiPrefix LDKSiPrefix_from_js(int32_t ord) {
554         switch (ord) {
555                 case 0: return LDKSiPrefix_Milli;
556                 case 1: return LDKSiPrefix_Micro;
557                 case 2: return LDKSiPrefix_Nano;
558                 case 3: return LDKSiPrefix_Pico;
559         }
560         abort();
561 }
562 static inline int32_t LDKSiPrefix_to_js(LDKSiPrefix val) {
563         switch (val) {
564                 case LDKSiPrefix_Milli: return 0;
565                 case LDKSiPrefix_Micro: return 1;
566                 case LDKSiPrefix_Nano: return 2;
567                 case LDKSiPrefix_Pico: return 3;
568                 default: abort();
569         }
570 }
571 static inline LDKSocketAddressParseError LDKSocketAddressParseError_from_js(int32_t ord) {
572         switch (ord) {
573                 case 0: return LDKSocketAddressParseError_SocketAddrParse;
574                 case 1: return LDKSocketAddressParseError_InvalidInput;
575                 case 2: return LDKSocketAddressParseError_InvalidPort;
576                 case 3: return LDKSocketAddressParseError_InvalidOnionV3;
577         }
578         abort();
579 }
580 static inline int32_t LDKSocketAddressParseError_to_js(LDKSocketAddressParseError val) {
581         switch (val) {
582                 case LDKSocketAddressParseError_SocketAddrParse: return 0;
583                 case LDKSocketAddressParseError_InvalidInput: return 1;
584                 case LDKSocketAddressParseError_InvalidPort: return 2;
585                 case LDKSocketAddressParseError_InvalidOnionV3: return 3;
586                 default: abort();
587         }
588 }
589 static inline LDKUtxoLookupError LDKUtxoLookupError_from_js(int32_t ord) {
590         switch (ord) {
591                 case 0: return LDKUtxoLookupError_UnknownChain;
592                 case 1: return LDKUtxoLookupError_UnknownTx;
593         }
594         abort();
595 }
596 static inline int32_t LDKUtxoLookupError_to_js(LDKUtxoLookupError val) {
597         switch (val) {
598                 case LDKUtxoLookupError_UnknownChain: return 0;
599                 case LDKUtxoLookupError_UnknownTx: return 1;
600                 default: abort();
601         }
602 }
603 struct LDKThirtyTwoBytes BigEndianScalar_get_bytes (struct LDKBigEndianScalar* thing) {
604         LDKThirtyTwoBytes ret = { .data = *thing->big_endian_bytes };
605         return ret;
606 }
607 int8_tArray  __attribute__((export_name("TS_BigEndianScalar_get_bytes"))) TS_BigEndianScalar_get_bytes(uint64_t thing) {
608         LDKBigEndianScalar* thing_conv = (LDKBigEndianScalar*)untag_ptr(thing);
609         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
610         memcpy(ret_arr->elems, BigEndianScalar_get_bytes(thing_conv).data, 32);
611         return ret_arr;
612 }
613
614 static void BigEndianScalar_free (struct LDKBigEndianScalar thing) {}
615 void  __attribute__((export_name("TS_BigEndianScalar_free"))) TS_BigEndianScalar_free(uint64_t thing) {
616         if (!ptr_is_owned(thing)) return;
617         void* thing_ptr = untag_ptr(thing);
618         CHECK_ACCESS(thing_ptr);
619         LDKBigEndianScalar thing_conv = *(LDKBigEndianScalar*)(thing_ptr);
620         FREE(untag_ptr(thing));
621         BigEndianScalar_free(thing_conv);
622 }
623
624 uint32_t __attribute__((export_name("TS_LDKBech32Error_ty_from_ptr"))) TS_LDKBech32Error_ty_from_ptr(uint64_t ptr) {
625         LDKBech32Error *obj = (LDKBech32Error*)untag_ptr(ptr);
626         switch(obj->tag) {
627                 case LDKBech32Error_MissingSeparator: return 0;
628                 case LDKBech32Error_InvalidChecksum: return 1;
629                 case LDKBech32Error_InvalidLength: return 2;
630                 case LDKBech32Error_InvalidChar: return 3;
631                 case LDKBech32Error_InvalidData: return 4;
632                 case LDKBech32Error_InvalidPadding: return 5;
633                 case LDKBech32Error_MixedCase: return 6;
634                 default: abort();
635         }
636 }
637 int32_t __attribute__((export_name("TS_LDKBech32Error_InvalidChar_get_invalid_char"))) TS_LDKBech32Error_InvalidChar_get_invalid_char(uint64_t ptr) {
638         LDKBech32Error *obj = (LDKBech32Error*)untag_ptr(ptr);
639         assert(obj->tag == LDKBech32Error_InvalidChar);
640         int32_t invalid_char_conv = obj->invalid_char;
641         return invalid_char_conv;
642 }
643 int8_t __attribute__((export_name("TS_LDKBech32Error_InvalidData_get_invalid_data"))) TS_LDKBech32Error_InvalidData_get_invalid_data(uint64_t ptr) {
644         LDKBech32Error *obj = (LDKBech32Error*)untag_ptr(ptr);
645         assert(obj->tag == LDKBech32Error_InvalidData);
646         int8_t invalid_data_conv = obj->invalid_data;
647         return invalid_data_conv;
648 }
649 static inline LDKCVec_u8Z CVec_u8Z_clone(const LDKCVec_u8Z *orig) {
650         LDKCVec_u8Z ret = { .data = MALLOC(sizeof(int8_t) * orig->datalen, "LDKCVec_u8Z clone bytes"), .datalen = orig->datalen };
651         memcpy(ret.data, orig->data, sizeof(int8_t) * ret.datalen);
652         return ret;
653 }
654 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) {
655         LDKTxIn* thing_conv = (LDKTxIn*)untag_ptr(thing);
656         LDKWitness ret_var = TxIn_get_witness(thing_conv);
657         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
658         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
659         Witness_free(ret_var);
660         return ret_arr;
661 }
662
663 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) {
664         LDKTxIn* thing_conv = (LDKTxIn*)untag_ptr(thing);
665         LDKCVec_u8Z ret_var = TxIn_get_script_sig(thing_conv);
666         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
667         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
668         CVec_u8Z_free(ret_var);
669         return ret_arr;
670 }
671
672 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) {
673         LDKTxIn* thing_conv = (LDKTxIn*)untag_ptr(thing);
674         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
675         memcpy(ret_arr->elems, TxIn_get_previous_txid(thing_conv).data, 32);
676         return ret_arr;
677 }
678
679 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) {
680         LDKTxIn* thing_conv = (LDKTxIn*)untag_ptr(thing);
681         int32_t ret_conv = TxIn_get_previous_vout(thing_conv);
682         return ret_conv;
683 }
684
685 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) {
686         LDKTxIn* thing_conv = (LDKTxIn*)untag_ptr(thing);
687         int32_t ret_conv = TxIn_get_sequence(thing_conv);
688         return ret_conv;
689 }
690
691 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) {
692         LDKTxOut* thing_conv = (LDKTxOut*)untag_ptr(thing);
693         LDKCVec_u8Z ret_var = TxOut_get_script_pubkey(thing_conv);
694         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
695         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
696         CVec_u8Z_free(ret_var);
697         return ret_arr;
698 }
699
700 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) {
701         LDKTxOut* thing_conv = (LDKTxOut*)untag_ptr(thing);
702         int64_t ret_conv = TxOut_get_value(thing_conv);
703         return ret_conv;
704 }
705
706 uint32_t __attribute__((export_name("TS_LDKCOption_u64Z_ty_from_ptr"))) TS_LDKCOption_u64Z_ty_from_ptr(uint64_t ptr) {
707         LDKCOption_u64Z *obj = (LDKCOption_u64Z*)untag_ptr(ptr);
708         switch(obj->tag) {
709                 case LDKCOption_u64Z_Some: return 0;
710                 case LDKCOption_u64Z_None: return 1;
711                 default: abort();
712         }
713 }
714 int64_t __attribute__((export_name("TS_LDKCOption_u64Z_Some_get_some"))) TS_LDKCOption_u64Z_Some_get_some(uint64_t ptr) {
715         LDKCOption_u64Z *obj = (LDKCOption_u64Z*)untag_ptr(ptr);
716         assert(obj->tag == LDKCOption_u64Z_Some);
717         int64_t some_conv = obj->some;
718         return some_conv;
719 }
720 static inline LDKCVec_BlindedPathZ CVec_BlindedPathZ_clone(const LDKCVec_BlindedPathZ *orig) {
721         LDKCVec_BlindedPathZ ret = { .data = MALLOC(sizeof(LDKBlindedPath) * orig->datalen, "LDKCVec_BlindedPathZ clone bytes"), .datalen = orig->datalen };
722         for (size_t i = 0; i < ret.datalen; i++) {
723                 ret.data[i] = BlindedPath_clone(&orig->data[i]);
724         }
725         return ret;
726 }
727 static inline struct LDKRefund CResult_RefundBolt12ParseErrorZ_get_ok(LDKCResult_RefundBolt12ParseErrorZ *NONNULL_PTR owner){
728         LDKRefund ret = *owner->contents.result;
729         ret.is_owned = false;
730         return ret;
731 }
732 uint64_t  __attribute__((export_name("TS_CResult_RefundBolt12ParseErrorZ_get_ok"))) TS_CResult_RefundBolt12ParseErrorZ_get_ok(uint64_t owner) {
733         LDKCResult_RefundBolt12ParseErrorZ* owner_conv = (LDKCResult_RefundBolt12ParseErrorZ*)untag_ptr(owner);
734         LDKRefund ret_var = CResult_RefundBolt12ParseErrorZ_get_ok(owner_conv);
735         uint64_t ret_ref = 0;
736         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
737         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
738         return ret_ref;
739 }
740
741 static inline struct LDKBolt12ParseError CResult_RefundBolt12ParseErrorZ_get_err(LDKCResult_RefundBolt12ParseErrorZ *NONNULL_PTR owner){
742         LDKBolt12ParseError ret = *owner->contents.err;
743         ret.is_owned = false;
744         return ret;
745 }
746 uint64_t  __attribute__((export_name("TS_CResult_RefundBolt12ParseErrorZ_get_err"))) TS_CResult_RefundBolt12ParseErrorZ_get_err(uint64_t owner) {
747         LDKCResult_RefundBolt12ParseErrorZ* owner_conv = (LDKCResult_RefundBolt12ParseErrorZ*)untag_ptr(owner);
748         LDKBolt12ParseError ret_var = CResult_RefundBolt12ParseErrorZ_get_err(owner_conv);
749         uint64_t ret_ref = 0;
750         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
751         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
752         return ret_ref;
753 }
754
755 uint32_t __attribute__((export_name("TS_LDKRetry_ty_from_ptr"))) TS_LDKRetry_ty_from_ptr(uint64_t ptr) {
756         LDKRetry *obj = (LDKRetry*)untag_ptr(ptr);
757         switch(obj->tag) {
758                 case LDKRetry_Attempts: return 0;
759                 default: abort();
760         }
761 }
762 int32_t __attribute__((export_name("TS_LDKRetry_Attempts_get_attempts"))) TS_LDKRetry_Attempts_get_attempts(uint64_t ptr) {
763         LDKRetry *obj = (LDKRetry*)untag_ptr(ptr);
764         assert(obj->tag == LDKRetry_Attempts);
765         int32_t attempts_conv = obj->attempts;
766         return attempts_conv;
767 }
768 uint32_t __attribute__((export_name("TS_LDKDecodeError_ty_from_ptr"))) TS_LDKDecodeError_ty_from_ptr(uint64_t ptr) {
769         LDKDecodeError *obj = (LDKDecodeError*)untag_ptr(ptr);
770         switch(obj->tag) {
771                 case LDKDecodeError_UnknownVersion: return 0;
772                 case LDKDecodeError_UnknownRequiredFeature: return 1;
773                 case LDKDecodeError_InvalidValue: return 2;
774                 case LDKDecodeError_ShortRead: return 3;
775                 case LDKDecodeError_BadLengthDescriptor: return 4;
776                 case LDKDecodeError_Io: return 5;
777                 case LDKDecodeError_UnsupportedCompression: return 6;
778                 default: abort();
779         }
780 }
781 uint32_t __attribute__((export_name("TS_LDKDecodeError_Io_get_io"))) TS_LDKDecodeError_Io_get_io(uint64_t ptr) {
782         LDKDecodeError *obj = (LDKDecodeError*)untag_ptr(ptr);
783         assert(obj->tag == LDKDecodeError_Io);
784         uint32_t io_conv = LDKIOError_to_js(obj->io);
785         return io_conv;
786 }
787 static inline struct LDKRetry CResult_RetryDecodeErrorZ_get_ok(LDKCResult_RetryDecodeErrorZ *NONNULL_PTR owner){
788 CHECK(owner->result_ok);
789         return Retry_clone(&*owner->contents.result);
790 }
791 uint64_t  __attribute__((export_name("TS_CResult_RetryDecodeErrorZ_get_ok"))) TS_CResult_RetryDecodeErrorZ_get_ok(uint64_t owner) {
792         LDKCResult_RetryDecodeErrorZ* owner_conv = (LDKCResult_RetryDecodeErrorZ*)untag_ptr(owner);
793         LDKRetry *ret_copy = MALLOC(sizeof(LDKRetry), "LDKRetry");
794         *ret_copy = CResult_RetryDecodeErrorZ_get_ok(owner_conv);
795         uint64_t ret_ref = tag_ptr(ret_copy, true);
796         return ret_ref;
797 }
798
799 static inline struct LDKDecodeError CResult_RetryDecodeErrorZ_get_err(LDKCResult_RetryDecodeErrorZ *NONNULL_PTR owner){
800 CHECK(!owner->result_ok);
801         return DecodeError_clone(&*owner->contents.err);
802 }
803 uint64_t  __attribute__((export_name("TS_CResult_RetryDecodeErrorZ_get_err"))) TS_CResult_RetryDecodeErrorZ_get_err(uint64_t owner) {
804         LDKCResult_RetryDecodeErrorZ* owner_conv = (LDKCResult_RetryDecodeErrorZ*)untag_ptr(owner);
805         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
806         *ret_copy = CResult_RetryDecodeErrorZ_get_err(owner_conv);
807         uint64_t ret_ref = tag_ptr(ret_copy, true);
808         return ret_ref;
809 }
810
811 uint32_t __attribute__((export_name("TS_LDKAPIError_ty_from_ptr"))) TS_LDKAPIError_ty_from_ptr(uint64_t ptr) {
812         LDKAPIError *obj = (LDKAPIError*)untag_ptr(ptr);
813         switch(obj->tag) {
814                 case LDKAPIError_APIMisuseError: return 0;
815                 case LDKAPIError_FeeRateTooHigh: return 1;
816                 case LDKAPIError_InvalidRoute: return 2;
817                 case LDKAPIError_ChannelUnavailable: return 3;
818                 case LDKAPIError_MonitorUpdateInProgress: return 4;
819                 case LDKAPIError_IncompatibleShutdownScript: return 5;
820                 default: abort();
821         }
822 }
823 jstring __attribute__((export_name("TS_LDKAPIError_APIMisuseError_get_err"))) TS_LDKAPIError_APIMisuseError_get_err(uint64_t ptr) {
824         LDKAPIError *obj = (LDKAPIError*)untag_ptr(ptr);
825         assert(obj->tag == LDKAPIError_APIMisuseError);
826         LDKStr err_str = obj->api_misuse_error.err;
827                         jstring err_conv = str_ref_to_ts(err_str.chars, err_str.len);
828         return err_conv;
829 }
830 jstring __attribute__((export_name("TS_LDKAPIError_FeeRateTooHigh_get_err"))) TS_LDKAPIError_FeeRateTooHigh_get_err(uint64_t ptr) {
831         LDKAPIError *obj = (LDKAPIError*)untag_ptr(ptr);
832         assert(obj->tag == LDKAPIError_FeeRateTooHigh);
833         LDKStr err_str = obj->fee_rate_too_high.err;
834                         jstring err_conv = str_ref_to_ts(err_str.chars, err_str.len);
835         return err_conv;
836 }
837 int32_t __attribute__((export_name("TS_LDKAPIError_FeeRateTooHigh_get_feerate"))) TS_LDKAPIError_FeeRateTooHigh_get_feerate(uint64_t ptr) {
838         LDKAPIError *obj = (LDKAPIError*)untag_ptr(ptr);
839         assert(obj->tag == LDKAPIError_FeeRateTooHigh);
840         int32_t feerate_conv = obj->fee_rate_too_high.feerate;
841         return feerate_conv;
842 }
843 jstring __attribute__((export_name("TS_LDKAPIError_InvalidRoute_get_err"))) TS_LDKAPIError_InvalidRoute_get_err(uint64_t ptr) {
844         LDKAPIError *obj = (LDKAPIError*)untag_ptr(ptr);
845         assert(obj->tag == LDKAPIError_InvalidRoute);
846         LDKStr err_str = obj->invalid_route.err;
847                         jstring err_conv = str_ref_to_ts(err_str.chars, err_str.len);
848         return err_conv;
849 }
850 jstring __attribute__((export_name("TS_LDKAPIError_ChannelUnavailable_get_err"))) TS_LDKAPIError_ChannelUnavailable_get_err(uint64_t ptr) {
851         LDKAPIError *obj = (LDKAPIError*)untag_ptr(ptr);
852         assert(obj->tag == LDKAPIError_ChannelUnavailable);
853         LDKStr err_str = obj->channel_unavailable.err;
854                         jstring err_conv = str_ref_to_ts(err_str.chars, err_str.len);
855         return err_conv;
856 }
857 uint64_t __attribute__((export_name("TS_LDKAPIError_IncompatibleShutdownScript_get_script"))) TS_LDKAPIError_IncompatibleShutdownScript_get_script(uint64_t ptr) {
858         LDKAPIError *obj = (LDKAPIError*)untag_ptr(ptr);
859         assert(obj->tag == LDKAPIError_IncompatibleShutdownScript);
860         LDKShutdownScript script_var = obj->incompatible_shutdown_script.script;
861                         uint64_t script_ref = 0;
862                         CHECK_INNER_FIELD_ACCESS_OR_NULL(script_var);
863                         script_ref = tag_ptr(script_var.inner, false);
864         return script_ref;
865 }
866 static inline void CResult_NoneAPIErrorZ_get_ok(LDKCResult_NoneAPIErrorZ *NONNULL_PTR owner){
867 CHECK(owner->result_ok);
868         return *owner->contents.result;
869 }
870 void  __attribute__((export_name("TS_CResult_NoneAPIErrorZ_get_ok"))) TS_CResult_NoneAPIErrorZ_get_ok(uint64_t owner) {
871         LDKCResult_NoneAPIErrorZ* owner_conv = (LDKCResult_NoneAPIErrorZ*)untag_ptr(owner);
872         CResult_NoneAPIErrorZ_get_ok(owner_conv);
873 }
874
875 static inline struct LDKAPIError CResult_NoneAPIErrorZ_get_err(LDKCResult_NoneAPIErrorZ *NONNULL_PTR owner){
876 CHECK(!owner->result_ok);
877         return APIError_clone(&*owner->contents.err);
878 }
879 uint64_t  __attribute__((export_name("TS_CResult_NoneAPIErrorZ_get_err"))) TS_CResult_NoneAPIErrorZ_get_err(uint64_t owner) {
880         LDKCResult_NoneAPIErrorZ* owner_conv = (LDKCResult_NoneAPIErrorZ*)untag_ptr(owner);
881         LDKAPIError *ret_copy = MALLOC(sizeof(LDKAPIError), "LDKAPIError");
882         *ret_copy = CResult_NoneAPIErrorZ_get_err(owner_conv);
883         uint64_t ret_ref = tag_ptr(ret_copy, true);
884         return ret_ref;
885 }
886
887 static inline LDKCVec_CResult_NoneAPIErrorZZ CVec_CResult_NoneAPIErrorZZ_clone(const LDKCVec_CResult_NoneAPIErrorZZ *orig) {
888         LDKCVec_CResult_NoneAPIErrorZZ ret = { .data = MALLOC(sizeof(LDKCResult_NoneAPIErrorZ) * orig->datalen, "LDKCVec_CResult_NoneAPIErrorZZ clone bytes"), .datalen = orig->datalen };
889         for (size_t i = 0; i < ret.datalen; i++) {
890                 ret.data[i] = CResult_NoneAPIErrorZ_clone(&orig->data[i]);
891         }
892         return ret;
893 }
894 static inline LDKCVec_APIErrorZ CVec_APIErrorZ_clone(const LDKCVec_APIErrorZ *orig) {
895         LDKCVec_APIErrorZ ret = { .data = MALLOC(sizeof(LDKAPIError) * orig->datalen, "LDKCVec_APIErrorZ clone bytes"), .datalen = orig->datalen };
896         for (size_t i = 0; i < ret.datalen; i++) {
897                 ret.data[i] = APIError_clone(&orig->data[i]);
898         }
899         return ret;
900 }
901 uint32_t __attribute__((export_name("TS_LDKCOption_ThirtyTwoBytesZ_ty_from_ptr"))) TS_LDKCOption_ThirtyTwoBytesZ_ty_from_ptr(uint64_t ptr) {
902         LDKCOption_ThirtyTwoBytesZ *obj = (LDKCOption_ThirtyTwoBytesZ*)untag_ptr(ptr);
903         switch(obj->tag) {
904                 case LDKCOption_ThirtyTwoBytesZ_Some: return 0;
905                 case LDKCOption_ThirtyTwoBytesZ_None: return 1;
906                 default: abort();
907         }
908 }
909 int8_tArray __attribute__((export_name("TS_LDKCOption_ThirtyTwoBytesZ_Some_get_some"))) TS_LDKCOption_ThirtyTwoBytesZ_Some_get_some(uint64_t ptr) {
910         LDKCOption_ThirtyTwoBytesZ *obj = (LDKCOption_ThirtyTwoBytesZ*)untag_ptr(ptr);
911         assert(obj->tag == LDKCOption_ThirtyTwoBytesZ_Some);
912         int8_tArray some_arr = init_int8_tArray(32, __LINE__);
913         memcpy(some_arr->elems, obj->some.data, 32);
914         return some_arr;
915 }
916 uint32_t __attribute__((export_name("TS_LDKCOption_CVec_u8ZZ_ty_from_ptr"))) TS_LDKCOption_CVec_u8ZZ_ty_from_ptr(uint64_t ptr) {
917         LDKCOption_CVec_u8ZZ *obj = (LDKCOption_CVec_u8ZZ*)untag_ptr(ptr);
918         switch(obj->tag) {
919                 case LDKCOption_CVec_u8ZZ_Some: return 0;
920                 case LDKCOption_CVec_u8ZZ_None: return 1;
921                 default: abort();
922         }
923 }
924 int8_tArray __attribute__((export_name("TS_LDKCOption_CVec_u8ZZ_Some_get_some"))) TS_LDKCOption_CVec_u8ZZ_Some_get_some(uint64_t ptr) {
925         LDKCOption_CVec_u8ZZ *obj = (LDKCOption_CVec_u8ZZ*)untag_ptr(ptr);
926         assert(obj->tag == LDKCOption_CVec_u8ZZ_Some);
927         LDKCVec_u8Z some_var = obj->some;
928                         int8_tArray some_arr = init_int8_tArray(some_var.datalen, __LINE__);
929                         memcpy(some_arr->elems, some_var.data, some_var.datalen);
930         return some_arr;
931 }
932 static inline struct LDKRecipientOnionFields CResult_RecipientOnionFieldsDecodeErrorZ_get_ok(LDKCResult_RecipientOnionFieldsDecodeErrorZ *NONNULL_PTR owner){
933         LDKRecipientOnionFields ret = *owner->contents.result;
934         ret.is_owned = false;
935         return ret;
936 }
937 uint64_t  __attribute__((export_name("TS_CResult_RecipientOnionFieldsDecodeErrorZ_get_ok"))) TS_CResult_RecipientOnionFieldsDecodeErrorZ_get_ok(uint64_t owner) {
938         LDKCResult_RecipientOnionFieldsDecodeErrorZ* owner_conv = (LDKCResult_RecipientOnionFieldsDecodeErrorZ*)untag_ptr(owner);
939         LDKRecipientOnionFields ret_var = CResult_RecipientOnionFieldsDecodeErrorZ_get_ok(owner_conv);
940         uint64_t ret_ref = 0;
941         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
942         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
943         return ret_ref;
944 }
945
946 static inline struct LDKDecodeError CResult_RecipientOnionFieldsDecodeErrorZ_get_err(LDKCResult_RecipientOnionFieldsDecodeErrorZ *NONNULL_PTR owner){
947 CHECK(!owner->result_ok);
948         return DecodeError_clone(&*owner->contents.err);
949 }
950 uint64_t  __attribute__((export_name("TS_CResult_RecipientOnionFieldsDecodeErrorZ_get_err"))) TS_CResult_RecipientOnionFieldsDecodeErrorZ_get_err(uint64_t owner) {
951         LDKCResult_RecipientOnionFieldsDecodeErrorZ* owner_conv = (LDKCResult_RecipientOnionFieldsDecodeErrorZ*)untag_ptr(owner);
952         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
953         *ret_copy = CResult_RecipientOnionFieldsDecodeErrorZ_get_err(owner_conv);
954         uint64_t ret_ref = tag_ptr(ret_copy, true);
955         return ret_ref;
956 }
957
958 static inline uint64_t C2Tuple_u64CVec_u8ZZ_get_a(LDKC2Tuple_u64CVec_u8ZZ *NONNULL_PTR owner){
959         return owner->a;
960 }
961 int64_t  __attribute__((export_name("TS_C2Tuple_u64CVec_u8ZZ_get_a"))) TS_C2Tuple_u64CVec_u8ZZ_get_a(uint64_t owner) {
962         LDKC2Tuple_u64CVec_u8ZZ* owner_conv = (LDKC2Tuple_u64CVec_u8ZZ*)untag_ptr(owner);
963         int64_t ret_conv = C2Tuple_u64CVec_u8ZZ_get_a(owner_conv);
964         return ret_conv;
965 }
966
967 static inline struct LDKCVec_u8Z C2Tuple_u64CVec_u8ZZ_get_b(LDKC2Tuple_u64CVec_u8ZZ *NONNULL_PTR owner){
968         return CVec_u8Z_clone(&owner->b);
969 }
970 int8_tArray  __attribute__((export_name("TS_C2Tuple_u64CVec_u8ZZ_get_b"))) TS_C2Tuple_u64CVec_u8ZZ_get_b(uint64_t owner) {
971         LDKC2Tuple_u64CVec_u8ZZ* owner_conv = (LDKC2Tuple_u64CVec_u8ZZ*)untag_ptr(owner);
972         LDKCVec_u8Z ret_var = C2Tuple_u64CVec_u8ZZ_get_b(owner_conv);
973         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
974         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
975         CVec_u8Z_free(ret_var);
976         return ret_arr;
977 }
978
979 static inline LDKCVec_C2Tuple_u64CVec_u8ZZZ CVec_C2Tuple_u64CVec_u8ZZZ_clone(const LDKCVec_C2Tuple_u64CVec_u8ZZZ *orig) {
980         LDKCVec_C2Tuple_u64CVec_u8ZZZ ret = { .data = MALLOC(sizeof(LDKC2Tuple_u64CVec_u8ZZ) * orig->datalen, "LDKCVec_C2Tuple_u64CVec_u8ZZZ clone bytes"), .datalen = orig->datalen };
981         for (size_t i = 0; i < ret.datalen; i++) {
982                 ret.data[i] = C2Tuple_u64CVec_u8ZZ_clone(&orig->data[i]);
983         }
984         return ret;
985 }
986 static inline struct LDKRecipientOnionFields CResult_RecipientOnionFieldsNoneZ_get_ok(LDKCResult_RecipientOnionFieldsNoneZ *NONNULL_PTR owner){
987         LDKRecipientOnionFields ret = *owner->contents.result;
988         ret.is_owned = false;
989         return ret;
990 }
991 uint64_t  __attribute__((export_name("TS_CResult_RecipientOnionFieldsNoneZ_get_ok"))) TS_CResult_RecipientOnionFieldsNoneZ_get_ok(uint64_t owner) {
992         LDKCResult_RecipientOnionFieldsNoneZ* owner_conv = (LDKCResult_RecipientOnionFieldsNoneZ*)untag_ptr(owner);
993         LDKRecipientOnionFields ret_var = CResult_RecipientOnionFieldsNoneZ_get_ok(owner_conv);
994         uint64_t ret_ref = 0;
995         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
996         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
997         return ret_ref;
998 }
999
1000 static inline void CResult_RecipientOnionFieldsNoneZ_get_err(LDKCResult_RecipientOnionFieldsNoneZ *NONNULL_PTR owner){
1001 CHECK(!owner->result_ok);
1002         return *owner->contents.err;
1003 }
1004 void  __attribute__((export_name("TS_CResult_RecipientOnionFieldsNoneZ_get_err"))) TS_CResult_RecipientOnionFieldsNoneZ_get_err(uint64_t owner) {
1005         LDKCResult_RecipientOnionFieldsNoneZ* owner_conv = (LDKCResult_RecipientOnionFieldsNoneZ*)untag_ptr(owner);
1006         CResult_RecipientOnionFieldsNoneZ_get_err(owner_conv);
1007 }
1008
1009 static inline LDKCVec_ThirtyTwoBytesZ CVec_ThirtyTwoBytesZ_clone(const LDKCVec_ThirtyTwoBytesZ *orig) {
1010         LDKCVec_ThirtyTwoBytesZ ret = { .data = MALLOC(sizeof(LDKThirtyTwoBytes) * orig->datalen, "LDKCVec_ThirtyTwoBytesZ clone bytes"), .datalen = orig->datalen };
1011         for (size_t i = 0; i < ret.datalen; i++) {
1012                 ret.data[i] = ThirtyTwoBytes_clone(&orig->data[i]);
1013         }
1014         return ret;
1015 }
1016 uint32_t __attribute__((export_name("TS_LDKCOption_CVec_ThirtyTwoBytesZZ_ty_from_ptr"))) TS_LDKCOption_CVec_ThirtyTwoBytesZZ_ty_from_ptr(uint64_t ptr) {
1017         LDKCOption_CVec_ThirtyTwoBytesZZ *obj = (LDKCOption_CVec_ThirtyTwoBytesZZ*)untag_ptr(ptr);
1018         switch(obj->tag) {
1019                 case LDKCOption_CVec_ThirtyTwoBytesZZ_Some: return 0;
1020                 case LDKCOption_CVec_ThirtyTwoBytesZZ_None: return 1;
1021                 default: abort();
1022         }
1023 }
1024 ptrArray __attribute__((export_name("TS_LDKCOption_CVec_ThirtyTwoBytesZZ_Some_get_some"))) TS_LDKCOption_CVec_ThirtyTwoBytesZZ_Some_get_some(uint64_t ptr) {
1025         LDKCOption_CVec_ThirtyTwoBytesZZ *obj = (LDKCOption_CVec_ThirtyTwoBytesZZ*)untag_ptr(ptr);
1026         assert(obj->tag == LDKCOption_CVec_ThirtyTwoBytesZZ_Some);
1027         LDKCVec_ThirtyTwoBytesZ some_var = obj->some;
1028                         ptrArray some_arr = NULL;
1029                         some_arr = init_ptrArray(some_var.datalen, __LINE__);
1030                         int8_tArray *some_arr_ptr = (int8_tArray*)(((uint8_t*)some_arr) + 8);
1031                         for (size_t m = 0; m < some_var.datalen; m++) {
1032                                 int8_tArray some_conv_12_arr = init_int8_tArray(32, __LINE__);
1033                                 memcpy(some_conv_12_arr->elems, some_var.data[m].data, 32);
1034                                 some_arr_ptr[m] = some_conv_12_arr;
1035                         }
1036                         
1037         return some_arr;
1038 }
1039 static inline struct LDKThirtyTwoBytes CResult_ThirtyTwoBytesNoneZ_get_ok(LDKCResult_ThirtyTwoBytesNoneZ *NONNULL_PTR owner){
1040 CHECK(owner->result_ok);
1041         return ThirtyTwoBytes_clone(&*owner->contents.result);
1042 }
1043 int8_tArray  __attribute__((export_name("TS_CResult_ThirtyTwoBytesNoneZ_get_ok"))) TS_CResult_ThirtyTwoBytesNoneZ_get_ok(uint64_t owner) {
1044         LDKCResult_ThirtyTwoBytesNoneZ* owner_conv = (LDKCResult_ThirtyTwoBytesNoneZ*)untag_ptr(owner);
1045         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
1046         memcpy(ret_arr->elems, CResult_ThirtyTwoBytesNoneZ_get_ok(owner_conv).data, 32);
1047         return ret_arr;
1048 }
1049
1050 static inline void CResult_ThirtyTwoBytesNoneZ_get_err(LDKCResult_ThirtyTwoBytesNoneZ *NONNULL_PTR owner){
1051 CHECK(!owner->result_ok);
1052         return *owner->contents.err;
1053 }
1054 void  __attribute__((export_name("TS_CResult_ThirtyTwoBytesNoneZ_get_err"))) TS_CResult_ThirtyTwoBytesNoneZ_get_err(uint64_t owner) {
1055         LDKCResult_ThirtyTwoBytesNoneZ* owner_conv = (LDKCResult_ThirtyTwoBytesNoneZ*)untag_ptr(owner);
1056         CResult_ThirtyTwoBytesNoneZ_get_err(owner_conv);
1057 }
1058
1059 static inline struct LDKBlindedPayInfo CResult_BlindedPayInfoDecodeErrorZ_get_ok(LDKCResult_BlindedPayInfoDecodeErrorZ *NONNULL_PTR owner){
1060         LDKBlindedPayInfo ret = *owner->contents.result;
1061         ret.is_owned = false;
1062         return ret;
1063 }
1064 uint64_t  __attribute__((export_name("TS_CResult_BlindedPayInfoDecodeErrorZ_get_ok"))) TS_CResult_BlindedPayInfoDecodeErrorZ_get_ok(uint64_t owner) {
1065         LDKCResult_BlindedPayInfoDecodeErrorZ* owner_conv = (LDKCResult_BlindedPayInfoDecodeErrorZ*)untag_ptr(owner);
1066         LDKBlindedPayInfo ret_var = CResult_BlindedPayInfoDecodeErrorZ_get_ok(owner_conv);
1067         uint64_t ret_ref = 0;
1068         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
1069         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
1070         return ret_ref;
1071 }
1072
1073 static inline struct LDKDecodeError CResult_BlindedPayInfoDecodeErrorZ_get_err(LDKCResult_BlindedPayInfoDecodeErrorZ *NONNULL_PTR owner){
1074 CHECK(!owner->result_ok);
1075         return DecodeError_clone(&*owner->contents.err);
1076 }
1077 uint64_t  __attribute__((export_name("TS_CResult_BlindedPayInfoDecodeErrorZ_get_err"))) TS_CResult_BlindedPayInfoDecodeErrorZ_get_err(uint64_t owner) {
1078         LDKCResult_BlindedPayInfoDecodeErrorZ* owner_conv = (LDKCResult_BlindedPayInfoDecodeErrorZ*)untag_ptr(owner);
1079         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
1080         *ret_copy = CResult_BlindedPayInfoDecodeErrorZ_get_err(owner_conv);
1081         uint64_t ret_ref = tag_ptr(ret_copy, true);
1082         return ret_ref;
1083 }
1084
1085 static inline struct LDKDelayedPaymentOutputDescriptor CResult_DelayedPaymentOutputDescriptorDecodeErrorZ_get_ok(LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ *NONNULL_PTR owner){
1086         LDKDelayedPaymentOutputDescriptor ret = *owner->contents.result;
1087         ret.is_owned = false;
1088         return ret;
1089 }
1090 uint64_t  __attribute__((export_name("TS_CResult_DelayedPaymentOutputDescriptorDecodeErrorZ_get_ok"))) TS_CResult_DelayedPaymentOutputDescriptorDecodeErrorZ_get_ok(uint64_t owner) {
1091         LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ* owner_conv = (LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ*)untag_ptr(owner);
1092         LDKDelayedPaymentOutputDescriptor ret_var = CResult_DelayedPaymentOutputDescriptorDecodeErrorZ_get_ok(owner_conv);
1093         uint64_t ret_ref = 0;
1094         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
1095         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
1096         return ret_ref;
1097 }
1098
1099 static inline struct LDKDecodeError CResult_DelayedPaymentOutputDescriptorDecodeErrorZ_get_err(LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ *NONNULL_PTR owner){
1100 CHECK(!owner->result_ok);
1101         return DecodeError_clone(&*owner->contents.err);
1102 }
1103 uint64_t  __attribute__((export_name("TS_CResult_DelayedPaymentOutputDescriptorDecodeErrorZ_get_err"))) TS_CResult_DelayedPaymentOutputDescriptorDecodeErrorZ_get_err(uint64_t owner) {
1104         LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ* owner_conv = (LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ*)untag_ptr(owner);
1105         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
1106         *ret_copy = CResult_DelayedPaymentOutputDescriptorDecodeErrorZ_get_err(owner_conv);
1107         uint64_t ret_ref = tag_ptr(ret_copy, true);
1108         return ret_ref;
1109 }
1110
1111 static inline struct LDKStaticPaymentOutputDescriptor CResult_StaticPaymentOutputDescriptorDecodeErrorZ_get_ok(LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ *NONNULL_PTR owner){
1112         LDKStaticPaymentOutputDescriptor ret = *owner->contents.result;
1113         ret.is_owned = false;
1114         return ret;
1115 }
1116 uint64_t  __attribute__((export_name("TS_CResult_StaticPaymentOutputDescriptorDecodeErrorZ_get_ok"))) TS_CResult_StaticPaymentOutputDescriptorDecodeErrorZ_get_ok(uint64_t owner) {
1117         LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ* owner_conv = (LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ*)untag_ptr(owner);
1118         LDKStaticPaymentOutputDescriptor ret_var = CResult_StaticPaymentOutputDescriptorDecodeErrorZ_get_ok(owner_conv);
1119         uint64_t ret_ref = 0;
1120         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
1121         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
1122         return ret_ref;
1123 }
1124
1125 static inline struct LDKDecodeError CResult_StaticPaymentOutputDescriptorDecodeErrorZ_get_err(LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ *NONNULL_PTR owner){
1126 CHECK(!owner->result_ok);
1127         return DecodeError_clone(&*owner->contents.err);
1128 }
1129 uint64_t  __attribute__((export_name("TS_CResult_StaticPaymentOutputDescriptorDecodeErrorZ_get_err"))) TS_CResult_StaticPaymentOutputDescriptorDecodeErrorZ_get_err(uint64_t owner) {
1130         LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ* owner_conv = (LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ*)untag_ptr(owner);
1131         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
1132         *ret_copy = CResult_StaticPaymentOutputDescriptorDecodeErrorZ_get_err(owner_conv);
1133         uint64_t ret_ref = tag_ptr(ret_copy, true);
1134         return ret_ref;
1135 }
1136
1137 uint32_t __attribute__((export_name("TS_LDKSpendableOutputDescriptor_ty_from_ptr"))) TS_LDKSpendableOutputDescriptor_ty_from_ptr(uint64_t ptr) {
1138         LDKSpendableOutputDescriptor *obj = (LDKSpendableOutputDescriptor*)untag_ptr(ptr);
1139         switch(obj->tag) {
1140                 case LDKSpendableOutputDescriptor_StaticOutput: return 0;
1141                 case LDKSpendableOutputDescriptor_DelayedPaymentOutput: return 1;
1142                 case LDKSpendableOutputDescriptor_StaticPaymentOutput: return 2;
1143                 default: abort();
1144         }
1145 }
1146 uint64_t __attribute__((export_name("TS_LDKSpendableOutputDescriptor_StaticOutput_get_outpoint"))) TS_LDKSpendableOutputDescriptor_StaticOutput_get_outpoint(uint64_t ptr) {
1147         LDKSpendableOutputDescriptor *obj = (LDKSpendableOutputDescriptor*)untag_ptr(ptr);
1148         assert(obj->tag == LDKSpendableOutputDescriptor_StaticOutput);
1149         LDKOutPoint outpoint_var = obj->static_output.outpoint;
1150                         uint64_t outpoint_ref = 0;
1151                         CHECK_INNER_FIELD_ACCESS_OR_NULL(outpoint_var);
1152                         outpoint_ref = tag_ptr(outpoint_var.inner, false);
1153         return outpoint_ref;
1154 }
1155 uint64_t __attribute__((export_name("TS_LDKSpendableOutputDescriptor_StaticOutput_get_output"))) TS_LDKSpendableOutputDescriptor_StaticOutput_get_output(uint64_t ptr) {
1156         LDKSpendableOutputDescriptor *obj = (LDKSpendableOutputDescriptor*)untag_ptr(ptr);
1157         assert(obj->tag == LDKSpendableOutputDescriptor_StaticOutput);
1158         LDKTxOut* output_ref = &obj->static_output.output;
1159         return tag_ptr(output_ref, false);
1160 }
1161 uint64_t __attribute__((export_name("TS_LDKSpendableOutputDescriptor_DelayedPaymentOutput_get_delayed_payment_output"))) TS_LDKSpendableOutputDescriptor_DelayedPaymentOutput_get_delayed_payment_output(uint64_t ptr) {
1162         LDKSpendableOutputDescriptor *obj = (LDKSpendableOutputDescriptor*)untag_ptr(ptr);
1163         assert(obj->tag == LDKSpendableOutputDescriptor_DelayedPaymentOutput);
1164         LDKDelayedPaymentOutputDescriptor delayed_payment_output_var = obj->delayed_payment_output;
1165                         uint64_t delayed_payment_output_ref = 0;
1166                         CHECK_INNER_FIELD_ACCESS_OR_NULL(delayed_payment_output_var);
1167                         delayed_payment_output_ref = tag_ptr(delayed_payment_output_var.inner, false);
1168         return delayed_payment_output_ref;
1169 }
1170 uint64_t __attribute__((export_name("TS_LDKSpendableOutputDescriptor_StaticPaymentOutput_get_static_payment_output"))) TS_LDKSpendableOutputDescriptor_StaticPaymentOutput_get_static_payment_output(uint64_t ptr) {
1171         LDKSpendableOutputDescriptor *obj = (LDKSpendableOutputDescriptor*)untag_ptr(ptr);
1172         assert(obj->tag == LDKSpendableOutputDescriptor_StaticPaymentOutput);
1173         LDKStaticPaymentOutputDescriptor static_payment_output_var = obj->static_payment_output;
1174                         uint64_t static_payment_output_ref = 0;
1175                         CHECK_INNER_FIELD_ACCESS_OR_NULL(static_payment_output_var);
1176                         static_payment_output_ref = tag_ptr(static_payment_output_var.inner, false);
1177         return static_payment_output_ref;
1178 }
1179 static inline struct LDKSpendableOutputDescriptor CResult_SpendableOutputDescriptorDecodeErrorZ_get_ok(LDKCResult_SpendableOutputDescriptorDecodeErrorZ *NONNULL_PTR owner){
1180 CHECK(owner->result_ok);
1181         return SpendableOutputDescriptor_clone(&*owner->contents.result);
1182 }
1183 uint64_t  __attribute__((export_name("TS_CResult_SpendableOutputDescriptorDecodeErrorZ_get_ok"))) TS_CResult_SpendableOutputDescriptorDecodeErrorZ_get_ok(uint64_t owner) {
1184         LDKCResult_SpendableOutputDescriptorDecodeErrorZ* owner_conv = (LDKCResult_SpendableOutputDescriptorDecodeErrorZ*)untag_ptr(owner);
1185         LDKSpendableOutputDescriptor *ret_copy = MALLOC(sizeof(LDKSpendableOutputDescriptor), "LDKSpendableOutputDescriptor");
1186         *ret_copy = CResult_SpendableOutputDescriptorDecodeErrorZ_get_ok(owner_conv);
1187         uint64_t ret_ref = tag_ptr(ret_copy, true);
1188         return ret_ref;
1189 }
1190
1191 static inline struct LDKDecodeError CResult_SpendableOutputDescriptorDecodeErrorZ_get_err(LDKCResult_SpendableOutputDescriptorDecodeErrorZ *NONNULL_PTR owner){
1192 CHECK(!owner->result_ok);
1193         return DecodeError_clone(&*owner->contents.err);
1194 }
1195 uint64_t  __attribute__((export_name("TS_CResult_SpendableOutputDescriptorDecodeErrorZ_get_err"))) TS_CResult_SpendableOutputDescriptorDecodeErrorZ_get_err(uint64_t owner) {
1196         LDKCResult_SpendableOutputDescriptorDecodeErrorZ* owner_conv = (LDKCResult_SpendableOutputDescriptorDecodeErrorZ*)untag_ptr(owner);
1197         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
1198         *ret_copy = CResult_SpendableOutputDescriptorDecodeErrorZ_get_err(owner_conv);
1199         uint64_t ret_ref = tag_ptr(ret_copy, true);
1200         return ret_ref;
1201 }
1202
1203 static inline LDKCVec_SpendableOutputDescriptorZ CVec_SpendableOutputDescriptorZ_clone(const LDKCVec_SpendableOutputDescriptorZ *orig) {
1204         LDKCVec_SpendableOutputDescriptorZ ret = { .data = MALLOC(sizeof(LDKSpendableOutputDescriptor) * orig->datalen, "LDKCVec_SpendableOutputDescriptorZ clone bytes"), .datalen = orig->datalen };
1205         for (size_t i = 0; i < ret.datalen; i++) {
1206                 ret.data[i] = SpendableOutputDescriptor_clone(&orig->data[i]);
1207         }
1208         return ret;
1209 }
1210 static inline LDKCVec_TxOutZ CVec_TxOutZ_clone(const LDKCVec_TxOutZ *orig) {
1211         LDKCVec_TxOutZ ret = { .data = MALLOC(sizeof(LDKTxOut) * orig->datalen, "LDKCVec_TxOutZ clone bytes"), .datalen = orig->datalen };
1212         for (size_t i = 0; i < ret.datalen; i++) {
1213                 ret.data[i] = TxOut_clone(&orig->data[i]);
1214         }
1215         return ret;
1216 }
1217 uint32_t __attribute__((export_name("TS_LDKCOption_u32Z_ty_from_ptr"))) TS_LDKCOption_u32Z_ty_from_ptr(uint64_t ptr) {
1218         LDKCOption_u32Z *obj = (LDKCOption_u32Z*)untag_ptr(ptr);
1219         switch(obj->tag) {
1220                 case LDKCOption_u32Z_Some: return 0;
1221                 case LDKCOption_u32Z_None: return 1;
1222                 default: abort();
1223         }
1224 }
1225 int32_t __attribute__((export_name("TS_LDKCOption_u32Z_Some_get_some"))) TS_LDKCOption_u32Z_Some_get_some(uint64_t ptr) {
1226         LDKCOption_u32Z *obj = (LDKCOption_u32Z*)untag_ptr(ptr);
1227         assert(obj->tag == LDKCOption_u32Z_Some);
1228         int32_t some_conv = obj->some;
1229         return some_conv;
1230 }
1231 static inline struct LDKCVec_u8Z C2Tuple_CVec_u8ZusizeZ_get_a(LDKC2Tuple_CVec_u8ZusizeZ *NONNULL_PTR owner){
1232         return CVec_u8Z_clone(&owner->a);
1233 }
1234 int8_tArray  __attribute__((export_name("TS_C2Tuple_CVec_u8ZusizeZ_get_a"))) TS_C2Tuple_CVec_u8ZusizeZ_get_a(uint64_t owner) {
1235         LDKC2Tuple_CVec_u8ZusizeZ* owner_conv = (LDKC2Tuple_CVec_u8ZusizeZ*)untag_ptr(owner);
1236         LDKCVec_u8Z ret_var = C2Tuple_CVec_u8ZusizeZ_get_a(owner_conv);
1237         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
1238         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
1239         CVec_u8Z_free(ret_var);
1240         return ret_arr;
1241 }
1242
1243 static inline uintptr_t C2Tuple_CVec_u8ZusizeZ_get_b(LDKC2Tuple_CVec_u8ZusizeZ *NONNULL_PTR owner){
1244         return owner->b;
1245 }
1246 uint32_t  __attribute__((export_name("TS_C2Tuple_CVec_u8ZusizeZ_get_b"))) TS_C2Tuple_CVec_u8ZusizeZ_get_b(uint64_t owner) {
1247         LDKC2Tuple_CVec_u8ZusizeZ* owner_conv = (LDKC2Tuple_CVec_u8ZusizeZ*)untag_ptr(owner);
1248         uint32_t ret_conv = C2Tuple_CVec_u8ZusizeZ_get_b(owner_conv);
1249         return ret_conv;
1250 }
1251
1252 static inline struct LDKC2Tuple_CVec_u8ZusizeZ CResult_C2Tuple_CVec_u8ZusizeZNoneZ_get_ok(LDKCResult_C2Tuple_CVec_u8ZusizeZNoneZ *NONNULL_PTR owner){
1253 CHECK(owner->result_ok);
1254         return C2Tuple_CVec_u8ZusizeZ_clone(&*owner->contents.result);
1255 }
1256 uint64_t  __attribute__((export_name("TS_CResult_C2Tuple_CVec_u8ZusizeZNoneZ_get_ok"))) TS_CResult_C2Tuple_CVec_u8ZusizeZNoneZ_get_ok(uint64_t owner) {
1257         LDKCResult_C2Tuple_CVec_u8ZusizeZNoneZ* owner_conv = (LDKCResult_C2Tuple_CVec_u8ZusizeZNoneZ*)untag_ptr(owner);
1258         LDKC2Tuple_CVec_u8ZusizeZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_CVec_u8ZusizeZ), "LDKC2Tuple_CVec_u8ZusizeZ");
1259         *ret_conv = CResult_C2Tuple_CVec_u8ZusizeZNoneZ_get_ok(owner_conv);
1260         return tag_ptr(ret_conv, true);
1261 }
1262
1263 static inline void CResult_C2Tuple_CVec_u8ZusizeZNoneZ_get_err(LDKCResult_C2Tuple_CVec_u8ZusizeZNoneZ *NONNULL_PTR owner){
1264 CHECK(!owner->result_ok);
1265         return *owner->contents.err;
1266 }
1267 void  __attribute__((export_name("TS_CResult_C2Tuple_CVec_u8ZusizeZNoneZ_get_err"))) TS_CResult_C2Tuple_CVec_u8ZusizeZNoneZ_get_err(uint64_t owner) {
1268         LDKCResult_C2Tuple_CVec_u8ZusizeZNoneZ* owner_conv = (LDKCResult_C2Tuple_CVec_u8ZusizeZNoneZ*)untag_ptr(owner);
1269         CResult_C2Tuple_CVec_u8ZusizeZNoneZ_get_err(owner_conv);
1270 }
1271
1272 static inline struct LDKChannelDerivationParameters CResult_ChannelDerivationParametersDecodeErrorZ_get_ok(LDKCResult_ChannelDerivationParametersDecodeErrorZ *NONNULL_PTR owner){
1273         LDKChannelDerivationParameters ret = *owner->contents.result;
1274         ret.is_owned = false;
1275         return ret;
1276 }
1277 uint64_t  __attribute__((export_name("TS_CResult_ChannelDerivationParametersDecodeErrorZ_get_ok"))) TS_CResult_ChannelDerivationParametersDecodeErrorZ_get_ok(uint64_t owner) {
1278         LDKCResult_ChannelDerivationParametersDecodeErrorZ* owner_conv = (LDKCResult_ChannelDerivationParametersDecodeErrorZ*)untag_ptr(owner);
1279         LDKChannelDerivationParameters ret_var = CResult_ChannelDerivationParametersDecodeErrorZ_get_ok(owner_conv);
1280         uint64_t ret_ref = 0;
1281         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
1282         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
1283         return ret_ref;
1284 }
1285
1286 static inline struct LDKDecodeError CResult_ChannelDerivationParametersDecodeErrorZ_get_err(LDKCResult_ChannelDerivationParametersDecodeErrorZ *NONNULL_PTR owner){
1287 CHECK(!owner->result_ok);
1288         return DecodeError_clone(&*owner->contents.err);
1289 }
1290 uint64_t  __attribute__((export_name("TS_CResult_ChannelDerivationParametersDecodeErrorZ_get_err"))) TS_CResult_ChannelDerivationParametersDecodeErrorZ_get_err(uint64_t owner) {
1291         LDKCResult_ChannelDerivationParametersDecodeErrorZ* owner_conv = (LDKCResult_ChannelDerivationParametersDecodeErrorZ*)untag_ptr(owner);
1292         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
1293         *ret_copy = CResult_ChannelDerivationParametersDecodeErrorZ_get_err(owner_conv);
1294         uint64_t ret_ref = tag_ptr(ret_copy, true);
1295         return ret_ref;
1296 }
1297
1298 static inline struct LDKHTLCDescriptor CResult_HTLCDescriptorDecodeErrorZ_get_ok(LDKCResult_HTLCDescriptorDecodeErrorZ *NONNULL_PTR owner){
1299         LDKHTLCDescriptor ret = *owner->contents.result;
1300         ret.is_owned = false;
1301         return ret;
1302 }
1303 uint64_t  __attribute__((export_name("TS_CResult_HTLCDescriptorDecodeErrorZ_get_ok"))) TS_CResult_HTLCDescriptorDecodeErrorZ_get_ok(uint64_t owner) {
1304         LDKCResult_HTLCDescriptorDecodeErrorZ* owner_conv = (LDKCResult_HTLCDescriptorDecodeErrorZ*)untag_ptr(owner);
1305         LDKHTLCDescriptor ret_var = CResult_HTLCDescriptorDecodeErrorZ_get_ok(owner_conv);
1306         uint64_t ret_ref = 0;
1307         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
1308         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
1309         return ret_ref;
1310 }
1311
1312 static inline struct LDKDecodeError CResult_HTLCDescriptorDecodeErrorZ_get_err(LDKCResult_HTLCDescriptorDecodeErrorZ *NONNULL_PTR owner){
1313 CHECK(!owner->result_ok);
1314         return DecodeError_clone(&*owner->contents.err);
1315 }
1316 uint64_t  __attribute__((export_name("TS_CResult_HTLCDescriptorDecodeErrorZ_get_err"))) TS_CResult_HTLCDescriptorDecodeErrorZ_get_err(uint64_t owner) {
1317         LDKCResult_HTLCDescriptorDecodeErrorZ* owner_conv = (LDKCResult_HTLCDescriptorDecodeErrorZ*)untag_ptr(owner);
1318         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
1319         *ret_copy = CResult_HTLCDescriptorDecodeErrorZ_get_err(owner_conv);
1320         uint64_t ret_ref = tag_ptr(ret_copy, true);
1321         return ret_ref;
1322 }
1323
1324 static inline void CResult_NoneNoneZ_get_ok(LDKCResult_NoneNoneZ *NONNULL_PTR owner){
1325 CHECK(owner->result_ok);
1326         return *owner->contents.result;
1327 }
1328 void  __attribute__((export_name("TS_CResult_NoneNoneZ_get_ok"))) TS_CResult_NoneNoneZ_get_ok(uint64_t owner) {
1329         LDKCResult_NoneNoneZ* owner_conv = (LDKCResult_NoneNoneZ*)untag_ptr(owner);
1330         CResult_NoneNoneZ_get_ok(owner_conv);
1331 }
1332
1333 static inline void CResult_NoneNoneZ_get_err(LDKCResult_NoneNoneZ *NONNULL_PTR owner){
1334 CHECK(!owner->result_ok);
1335         return *owner->contents.err;
1336 }
1337 void  __attribute__((export_name("TS_CResult_NoneNoneZ_get_err"))) TS_CResult_NoneNoneZ_get_err(uint64_t owner) {
1338         LDKCResult_NoneNoneZ* owner_conv = (LDKCResult_NoneNoneZ*)untag_ptr(owner);
1339         CResult_NoneNoneZ_get_err(owner_conv);
1340 }
1341
1342 static inline struct LDKECDSASignature C2Tuple_ECDSASignatureCVec_ECDSASignatureZZ_get_a(LDKC2Tuple_ECDSASignatureCVec_ECDSASignatureZZ *NONNULL_PTR owner){
1343         return owner->a;
1344 }
1345 int8_tArray  __attribute__((export_name("TS_C2Tuple_ECDSASignatureCVec_ECDSASignatureZZ_get_a"))) TS_C2Tuple_ECDSASignatureCVec_ECDSASignatureZZ_get_a(uint64_t owner) {
1346         LDKC2Tuple_ECDSASignatureCVec_ECDSASignatureZZ* owner_conv = (LDKC2Tuple_ECDSASignatureCVec_ECDSASignatureZZ*)untag_ptr(owner);
1347         int8_tArray ret_arr = init_int8_tArray(64, __LINE__);
1348         memcpy(ret_arr->elems, C2Tuple_ECDSASignatureCVec_ECDSASignatureZZ_get_a(owner_conv).compact_form, 64);
1349         return ret_arr;
1350 }
1351
1352 static inline struct LDKCVec_ECDSASignatureZ C2Tuple_ECDSASignatureCVec_ECDSASignatureZZ_get_b(LDKC2Tuple_ECDSASignatureCVec_ECDSASignatureZZ *NONNULL_PTR owner){
1353         return owner->b;
1354 }
1355 ptrArray  __attribute__((export_name("TS_C2Tuple_ECDSASignatureCVec_ECDSASignatureZZ_get_b"))) TS_C2Tuple_ECDSASignatureCVec_ECDSASignatureZZ_get_b(uint64_t owner) {
1356         LDKC2Tuple_ECDSASignatureCVec_ECDSASignatureZZ* owner_conv = (LDKC2Tuple_ECDSASignatureCVec_ECDSASignatureZZ*)untag_ptr(owner);
1357         LDKCVec_ECDSASignatureZ ret_var = C2Tuple_ECDSASignatureCVec_ECDSASignatureZZ_get_b(owner_conv);
1358         ptrArray ret_arr = NULL;
1359         ret_arr = init_ptrArray(ret_var.datalen, __LINE__);
1360         int8_tArray *ret_arr_ptr = (int8_tArray*)(((uint8_t*)ret_arr) + 8);
1361         for (size_t m = 0; m < ret_var.datalen; m++) {
1362                 int8_tArray ret_conv_12_arr = init_int8_tArray(64, __LINE__);
1363                 memcpy(ret_conv_12_arr->elems, ret_var.data[m].compact_form, 64);
1364                 ret_arr_ptr[m] = ret_conv_12_arr;
1365         }
1366         
1367         return ret_arr;
1368 }
1369
1370 static inline struct LDKC2Tuple_ECDSASignatureCVec_ECDSASignatureZZ CResult_C2Tuple_ECDSASignatureCVec_ECDSASignatureZZNoneZ_get_ok(LDKCResult_C2Tuple_ECDSASignatureCVec_ECDSASignatureZZNoneZ *NONNULL_PTR owner){
1371 CHECK(owner->result_ok);
1372         return C2Tuple_ECDSASignatureCVec_ECDSASignatureZZ_clone(&*owner->contents.result);
1373 }
1374 uint64_t  __attribute__((export_name("TS_CResult_C2Tuple_ECDSASignatureCVec_ECDSASignatureZZNoneZ_get_ok"))) TS_CResult_C2Tuple_ECDSASignatureCVec_ECDSASignatureZZNoneZ_get_ok(uint64_t owner) {
1375         LDKCResult_C2Tuple_ECDSASignatureCVec_ECDSASignatureZZNoneZ* owner_conv = (LDKCResult_C2Tuple_ECDSASignatureCVec_ECDSASignatureZZNoneZ*)untag_ptr(owner);
1376         LDKC2Tuple_ECDSASignatureCVec_ECDSASignatureZZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_ECDSASignatureCVec_ECDSASignatureZZ), "LDKC2Tuple_ECDSASignatureCVec_ECDSASignatureZZ");
1377         *ret_conv = CResult_C2Tuple_ECDSASignatureCVec_ECDSASignatureZZNoneZ_get_ok(owner_conv);
1378         return tag_ptr(ret_conv, true);
1379 }
1380
1381 static inline void CResult_C2Tuple_ECDSASignatureCVec_ECDSASignatureZZNoneZ_get_err(LDKCResult_C2Tuple_ECDSASignatureCVec_ECDSASignatureZZNoneZ *NONNULL_PTR owner){
1382 CHECK(!owner->result_ok);
1383         return *owner->contents.err;
1384 }
1385 void  __attribute__((export_name("TS_CResult_C2Tuple_ECDSASignatureCVec_ECDSASignatureZZNoneZ_get_err"))) TS_CResult_C2Tuple_ECDSASignatureCVec_ECDSASignatureZZNoneZ_get_err(uint64_t owner) {
1386         LDKCResult_C2Tuple_ECDSASignatureCVec_ECDSASignatureZZNoneZ* owner_conv = (LDKCResult_C2Tuple_ECDSASignatureCVec_ECDSASignatureZZNoneZ*)untag_ptr(owner);
1387         CResult_C2Tuple_ECDSASignatureCVec_ECDSASignatureZZNoneZ_get_err(owner_conv);
1388 }
1389
1390 static inline struct LDKECDSASignature CResult_ECDSASignatureNoneZ_get_ok(LDKCResult_ECDSASignatureNoneZ *NONNULL_PTR owner){
1391 CHECK(owner->result_ok);
1392         return *owner->contents.result;
1393 }
1394 int8_tArray  __attribute__((export_name("TS_CResult_ECDSASignatureNoneZ_get_ok"))) TS_CResult_ECDSASignatureNoneZ_get_ok(uint64_t owner) {
1395         LDKCResult_ECDSASignatureNoneZ* owner_conv = (LDKCResult_ECDSASignatureNoneZ*)untag_ptr(owner);
1396         int8_tArray ret_arr = init_int8_tArray(64, __LINE__);
1397         memcpy(ret_arr->elems, CResult_ECDSASignatureNoneZ_get_ok(owner_conv).compact_form, 64);
1398         return ret_arr;
1399 }
1400
1401 static inline void CResult_ECDSASignatureNoneZ_get_err(LDKCResult_ECDSASignatureNoneZ *NONNULL_PTR owner){
1402 CHECK(!owner->result_ok);
1403         return *owner->contents.err;
1404 }
1405 void  __attribute__((export_name("TS_CResult_ECDSASignatureNoneZ_get_err"))) TS_CResult_ECDSASignatureNoneZ_get_err(uint64_t owner) {
1406         LDKCResult_ECDSASignatureNoneZ* owner_conv = (LDKCResult_ECDSASignatureNoneZ*)untag_ptr(owner);
1407         CResult_ECDSASignatureNoneZ_get_err(owner_conv);
1408 }
1409
1410 static inline struct LDKPublicKey CResult_PublicKeyNoneZ_get_ok(LDKCResult_PublicKeyNoneZ *NONNULL_PTR owner){
1411 CHECK(owner->result_ok);
1412         return *owner->contents.result;
1413 }
1414 int8_tArray  __attribute__((export_name("TS_CResult_PublicKeyNoneZ_get_ok"))) TS_CResult_PublicKeyNoneZ_get_ok(uint64_t owner) {
1415         LDKCResult_PublicKeyNoneZ* owner_conv = (LDKCResult_PublicKeyNoneZ*)untag_ptr(owner);
1416         int8_tArray ret_arr = init_int8_tArray(33, __LINE__);
1417         memcpy(ret_arr->elems, CResult_PublicKeyNoneZ_get_ok(owner_conv).compressed_form, 33);
1418         return ret_arr;
1419 }
1420
1421 static inline void CResult_PublicKeyNoneZ_get_err(LDKCResult_PublicKeyNoneZ *NONNULL_PTR owner){
1422 CHECK(!owner->result_ok);
1423         return *owner->contents.err;
1424 }
1425 void  __attribute__((export_name("TS_CResult_PublicKeyNoneZ_get_err"))) TS_CResult_PublicKeyNoneZ_get_err(uint64_t owner) {
1426         LDKCResult_PublicKeyNoneZ* owner_conv = (LDKCResult_PublicKeyNoneZ*)untag_ptr(owner);
1427         CResult_PublicKeyNoneZ_get_err(owner_conv);
1428 }
1429
1430 uint32_t __attribute__((export_name("TS_LDKCOption_BigEndianScalarZ_ty_from_ptr"))) TS_LDKCOption_BigEndianScalarZ_ty_from_ptr(uint64_t ptr) {
1431         LDKCOption_BigEndianScalarZ *obj = (LDKCOption_BigEndianScalarZ*)untag_ptr(ptr);
1432         switch(obj->tag) {
1433                 case LDKCOption_BigEndianScalarZ_Some: return 0;
1434                 case LDKCOption_BigEndianScalarZ_None: return 1;
1435                 default: abort();
1436         }
1437 }
1438 uint64_t __attribute__((export_name("TS_LDKCOption_BigEndianScalarZ_Some_get_some"))) TS_LDKCOption_BigEndianScalarZ_Some_get_some(uint64_t ptr) {
1439         LDKCOption_BigEndianScalarZ *obj = (LDKCOption_BigEndianScalarZ*)untag_ptr(ptr);
1440         assert(obj->tag == LDKCOption_BigEndianScalarZ_Some);
1441         LDKBigEndianScalar* some_ref = &obj->some;
1442         return tag_ptr(some_ref, false);
1443 }
1444 static inline struct LDKRecoverableSignature CResult_RecoverableSignatureNoneZ_get_ok(LDKCResult_RecoverableSignatureNoneZ *NONNULL_PTR owner){
1445 CHECK(owner->result_ok);
1446         return *owner->contents.result;
1447 }
1448 int8_tArray  __attribute__((export_name("TS_CResult_RecoverableSignatureNoneZ_get_ok"))) TS_CResult_RecoverableSignatureNoneZ_get_ok(uint64_t owner) {
1449         LDKCResult_RecoverableSignatureNoneZ* owner_conv = (LDKCResult_RecoverableSignatureNoneZ*)untag_ptr(owner);
1450         int8_tArray ret_arr = init_int8_tArray(68, __LINE__);
1451         memcpy(ret_arr->elems, CResult_RecoverableSignatureNoneZ_get_ok(owner_conv).serialized_form, 68);
1452         return ret_arr;
1453 }
1454
1455 static inline void CResult_RecoverableSignatureNoneZ_get_err(LDKCResult_RecoverableSignatureNoneZ *NONNULL_PTR owner){
1456 CHECK(!owner->result_ok);
1457         return *owner->contents.err;
1458 }
1459 void  __attribute__((export_name("TS_CResult_RecoverableSignatureNoneZ_get_err"))) TS_CResult_RecoverableSignatureNoneZ_get_err(uint64_t owner) {
1460         LDKCResult_RecoverableSignatureNoneZ* owner_conv = (LDKCResult_RecoverableSignatureNoneZ*)untag_ptr(owner);
1461         CResult_RecoverableSignatureNoneZ_get_err(owner_conv);
1462 }
1463
1464 static inline struct LDKSchnorrSignature CResult_SchnorrSignatureNoneZ_get_ok(LDKCResult_SchnorrSignatureNoneZ *NONNULL_PTR owner){
1465 CHECK(owner->result_ok);
1466         return *owner->contents.result;
1467 }
1468 int8_tArray  __attribute__((export_name("TS_CResult_SchnorrSignatureNoneZ_get_ok"))) TS_CResult_SchnorrSignatureNoneZ_get_ok(uint64_t owner) {
1469         LDKCResult_SchnorrSignatureNoneZ* owner_conv = (LDKCResult_SchnorrSignatureNoneZ*)untag_ptr(owner);
1470         int8_tArray ret_arr = init_int8_tArray(64, __LINE__);
1471         memcpy(ret_arr->elems, CResult_SchnorrSignatureNoneZ_get_ok(owner_conv).compact_form, 64);
1472         return ret_arr;
1473 }
1474
1475 static inline void CResult_SchnorrSignatureNoneZ_get_err(LDKCResult_SchnorrSignatureNoneZ *NONNULL_PTR owner){
1476 CHECK(!owner->result_ok);
1477         return *owner->contents.err;
1478 }
1479 void  __attribute__((export_name("TS_CResult_SchnorrSignatureNoneZ_get_err"))) TS_CResult_SchnorrSignatureNoneZ_get_err(uint64_t owner) {
1480         LDKCResult_SchnorrSignatureNoneZ* owner_conv = (LDKCResult_SchnorrSignatureNoneZ*)untag_ptr(owner);
1481         CResult_SchnorrSignatureNoneZ_get_err(owner_conv);
1482 }
1483
1484 typedef struct LDKChannelSigner_JCalls {
1485         atomic_size_t refcnt;
1486         uint32_t instance_ptr;
1487 } LDKChannelSigner_JCalls;
1488 static void LDKChannelSigner_JCalls_free(void* this_arg) {
1489         LDKChannelSigner_JCalls *j_calls = (LDKChannelSigner_JCalls*) this_arg;
1490         if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
1491                 FREE(j_calls);
1492         }
1493 }
1494 LDKPublicKey get_per_commitment_point_LDKChannelSigner_jcall(const void* this_arg, uint64_t idx) {
1495         LDKChannelSigner_JCalls *j_calls = (LDKChannelSigner_JCalls*) this_arg;
1496         int64_t idx_conv = idx;
1497         int8_tArray ret = (int8_tArray)js_invoke_function_buuuuu(j_calls->instance_ptr, 0, idx_conv, 0, 0, 0, 0, 0);
1498         LDKPublicKey ret_ref;
1499         CHECK(ret->arr_len == 33);
1500         memcpy(ret_ref.compressed_form, ret->elems, 33); FREE(ret);
1501         return ret_ref;
1502 }
1503 LDKThirtyTwoBytes release_commitment_secret_LDKChannelSigner_jcall(const void* this_arg, uint64_t idx) {
1504         LDKChannelSigner_JCalls *j_calls = (LDKChannelSigner_JCalls*) this_arg;
1505         int64_t idx_conv = idx;
1506         int8_tArray ret = (int8_tArray)js_invoke_function_buuuuu(j_calls->instance_ptr, 1, idx_conv, 0, 0, 0, 0, 0);
1507         LDKThirtyTwoBytes ret_ref;
1508         CHECK(ret->arr_len == 32);
1509         memcpy(ret_ref.data, ret->elems, 32); FREE(ret);
1510         return ret_ref;
1511 }
1512 LDKCResult_NoneNoneZ validate_holder_commitment_LDKChannelSigner_jcall(const void* this_arg, const LDKHolderCommitmentTransaction * holder_tx, LDKCVec_ThirtyTwoBytesZ preimages) {
1513         LDKChannelSigner_JCalls *j_calls = (LDKChannelSigner_JCalls*) this_arg;
1514         LDKHolderCommitmentTransaction holder_tx_var = *holder_tx;
1515         uint64_t holder_tx_ref = 0;
1516         holder_tx_var = HolderCommitmentTransaction_clone(&holder_tx_var);
1517         CHECK_INNER_FIELD_ACCESS_OR_NULL(holder_tx_var);
1518         holder_tx_ref = tag_ptr(holder_tx_var.inner, holder_tx_var.is_owned);
1519         LDKCVec_ThirtyTwoBytesZ preimages_var = preimages;
1520         ptrArray preimages_arr = NULL;
1521         preimages_arr = init_ptrArray(preimages_var.datalen, __LINE__);
1522         int8_tArray *preimages_arr_ptr = (int8_tArray*)(((uint8_t*)preimages_arr) + 8);
1523         for (size_t m = 0; m < preimages_var.datalen; m++) {
1524                 int8_tArray preimages_conv_12_arr = init_int8_tArray(32, __LINE__);
1525                 memcpy(preimages_conv_12_arr->elems, preimages_var.data[m].data, 32);
1526                 preimages_arr_ptr[m] = preimages_conv_12_arr;
1527         }
1528         
1529         FREE(preimages_var.data);
1530         uint64_t ret = js_invoke_function_buuuuu(j_calls->instance_ptr, 2, holder_tx_ref, (uint32_t)preimages_arr, 0, 0, 0, 0);
1531         void* ret_ptr = untag_ptr(ret);
1532         CHECK_ACCESS(ret_ptr);
1533         LDKCResult_NoneNoneZ ret_conv = *(LDKCResult_NoneNoneZ*)(ret_ptr);
1534         FREE(untag_ptr(ret));
1535         return ret_conv;
1536 }
1537 LDKThirtyTwoBytes channel_keys_id_LDKChannelSigner_jcall(const void* this_arg) {
1538         LDKChannelSigner_JCalls *j_calls = (LDKChannelSigner_JCalls*) this_arg;
1539         int8_tArray ret = (int8_tArray)js_invoke_function_uuuuuu(j_calls->instance_ptr, 3, 0, 0, 0, 0, 0, 0);
1540         LDKThirtyTwoBytes ret_ref;
1541         CHECK(ret->arr_len == 32);
1542         memcpy(ret_ref.data, ret->elems, 32); FREE(ret);
1543         return ret_ref;
1544 }
1545 void provide_channel_parameters_LDKChannelSigner_jcall(void* this_arg, const LDKChannelTransactionParameters * channel_parameters) {
1546         LDKChannelSigner_JCalls *j_calls = (LDKChannelSigner_JCalls*) this_arg;
1547         LDKChannelTransactionParameters channel_parameters_var = *channel_parameters;
1548         uint64_t channel_parameters_ref = 0;
1549         channel_parameters_var = ChannelTransactionParameters_clone(&channel_parameters_var);
1550         CHECK_INNER_FIELD_ACCESS_OR_NULL(channel_parameters_var);
1551         channel_parameters_ref = tag_ptr(channel_parameters_var.inner, channel_parameters_var.is_owned);
1552         js_invoke_function_buuuuu(j_calls->instance_ptr, 4, channel_parameters_ref, 0, 0, 0, 0, 0);
1553 }
1554 static void LDKChannelSigner_JCalls_cloned(LDKChannelSigner* new_obj) {
1555         LDKChannelSigner_JCalls *j_calls = (LDKChannelSigner_JCalls*) new_obj->this_arg;
1556         atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
1557 }
1558 static inline LDKChannelSigner LDKChannelSigner_init (JSValue o, uint64_t pubkeys) {
1559         LDKChannelSigner_JCalls *calls = MALLOC(sizeof(LDKChannelSigner_JCalls), "LDKChannelSigner_JCalls");
1560         atomic_init(&calls->refcnt, 1);
1561         calls->instance_ptr = o;
1562
1563         LDKChannelPublicKeys pubkeys_conv;
1564         pubkeys_conv.inner = untag_ptr(pubkeys);
1565         pubkeys_conv.is_owned = ptr_is_owned(pubkeys);
1566         CHECK_INNER_FIELD_ACCESS_OR_NULL(pubkeys_conv);
1567
1568         LDKChannelSigner ret = {
1569                 .this_arg = (void*) calls,
1570                 .get_per_commitment_point = get_per_commitment_point_LDKChannelSigner_jcall,
1571                 .release_commitment_secret = release_commitment_secret_LDKChannelSigner_jcall,
1572                 .validate_holder_commitment = validate_holder_commitment_LDKChannelSigner_jcall,
1573                 .channel_keys_id = channel_keys_id_LDKChannelSigner_jcall,
1574                 .provide_channel_parameters = provide_channel_parameters_LDKChannelSigner_jcall,
1575                 .free = LDKChannelSigner_JCalls_free,
1576                 .pubkeys = pubkeys_conv,
1577                 .set_pubkeys = NULL,
1578         };
1579         return ret;
1580 }
1581 uint64_t  __attribute__((export_name("TS_LDKChannelSigner_new"))) TS_LDKChannelSigner_new(JSValue o, uint64_t pubkeys) {
1582         LDKChannelSigner *res_ptr = MALLOC(sizeof(LDKChannelSigner), "LDKChannelSigner");
1583         *res_ptr = LDKChannelSigner_init(o, pubkeys);
1584         return tag_ptr(res_ptr, true);
1585 }
1586 int8_tArray  __attribute__((export_name("TS_ChannelSigner_get_per_commitment_point"))) TS_ChannelSigner_get_per_commitment_point(uint64_t this_arg, int64_t idx) {
1587         void* this_arg_ptr = untag_ptr(this_arg);
1588         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
1589         LDKChannelSigner* this_arg_conv = (LDKChannelSigner*)this_arg_ptr;
1590         int8_tArray ret_arr = init_int8_tArray(33, __LINE__);
1591         memcpy(ret_arr->elems, (this_arg_conv->get_per_commitment_point)(this_arg_conv->this_arg, idx).compressed_form, 33);
1592         return ret_arr;
1593 }
1594
1595 int8_tArray  __attribute__((export_name("TS_ChannelSigner_release_commitment_secret"))) TS_ChannelSigner_release_commitment_secret(uint64_t this_arg, int64_t idx) {
1596         void* this_arg_ptr = untag_ptr(this_arg);
1597         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
1598         LDKChannelSigner* this_arg_conv = (LDKChannelSigner*)this_arg_ptr;
1599         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
1600         memcpy(ret_arr->elems, (this_arg_conv->release_commitment_secret)(this_arg_conv->this_arg, idx).data, 32);
1601         return ret_arr;
1602 }
1603
1604 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) {
1605         void* this_arg_ptr = untag_ptr(this_arg);
1606         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
1607         LDKChannelSigner* this_arg_conv = (LDKChannelSigner*)this_arg_ptr;
1608         LDKHolderCommitmentTransaction holder_tx_conv;
1609         holder_tx_conv.inner = untag_ptr(holder_tx);
1610         holder_tx_conv.is_owned = ptr_is_owned(holder_tx);
1611         CHECK_INNER_FIELD_ACCESS_OR_NULL(holder_tx_conv);
1612         holder_tx_conv.is_owned = false;
1613         LDKCVec_ThirtyTwoBytesZ preimages_constr;
1614         preimages_constr.datalen = preimages->arr_len;
1615         if (preimages_constr.datalen > 0)
1616                 preimages_constr.data = MALLOC(preimages_constr.datalen * sizeof(LDKThirtyTwoBytes), "LDKCVec_ThirtyTwoBytesZ Elements");
1617         else
1618                 preimages_constr.data = NULL;
1619         int8_tArray* preimages_vals = (void*) preimages->elems;
1620         for (size_t m = 0; m < preimages_constr.datalen; m++) {
1621                 int8_tArray preimages_conv_12 = preimages_vals[m];
1622                 LDKThirtyTwoBytes preimages_conv_12_ref;
1623                 CHECK(preimages_conv_12->arr_len == 32);
1624                 memcpy(preimages_conv_12_ref.data, preimages_conv_12->elems, 32); FREE(preimages_conv_12);
1625                 preimages_constr.data[m] = preimages_conv_12_ref;
1626         }
1627         FREE(preimages);
1628         LDKCResult_NoneNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneNoneZ), "LDKCResult_NoneNoneZ");
1629         *ret_conv = (this_arg_conv->validate_holder_commitment)(this_arg_conv->this_arg, &holder_tx_conv, preimages_constr);
1630         return tag_ptr(ret_conv, true);
1631 }
1632
1633 int8_tArray  __attribute__((export_name("TS_ChannelSigner_channel_keys_id"))) TS_ChannelSigner_channel_keys_id(uint64_t this_arg) {
1634         void* this_arg_ptr = untag_ptr(this_arg);
1635         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
1636         LDKChannelSigner* this_arg_conv = (LDKChannelSigner*)this_arg_ptr;
1637         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
1638         memcpy(ret_arr->elems, (this_arg_conv->channel_keys_id)(this_arg_conv->this_arg).data, 32);
1639         return ret_arr;
1640 }
1641
1642 void  __attribute__((export_name("TS_ChannelSigner_provide_channel_parameters"))) TS_ChannelSigner_provide_channel_parameters(uint64_t this_arg, uint64_t channel_parameters) {
1643         void* this_arg_ptr = untag_ptr(this_arg);
1644         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
1645         LDKChannelSigner* this_arg_conv = (LDKChannelSigner*)this_arg_ptr;
1646         LDKChannelTransactionParameters channel_parameters_conv;
1647         channel_parameters_conv.inner = untag_ptr(channel_parameters);
1648         channel_parameters_conv.is_owned = ptr_is_owned(channel_parameters);
1649         CHECK_INNER_FIELD_ACCESS_OR_NULL(channel_parameters_conv);
1650         channel_parameters_conv.is_owned = false;
1651         (this_arg_conv->provide_channel_parameters)(this_arg_conv->this_arg, &channel_parameters_conv);
1652 }
1653
1654 LDKChannelPublicKeys LDKChannelSigner_set_get_pubkeys(LDKChannelSigner* this_arg) {
1655         if (this_arg->set_pubkeys != NULL)
1656                 this_arg->set_pubkeys(this_arg);
1657         return this_arg->pubkeys;
1658 }
1659 uint64_t  __attribute__((export_name("TS_ChannelSigner_get_pubkeys"))) TS_ChannelSigner_get_pubkeys(uint64_t this_arg) {
1660         void* this_arg_ptr = untag_ptr(this_arg);
1661         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
1662         LDKChannelSigner* this_arg_conv = (LDKChannelSigner*)this_arg_ptr;
1663         LDKChannelPublicKeys ret_var = LDKChannelSigner_set_get_pubkeys(this_arg_conv);
1664         uint64_t ret_ref = 0;
1665         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
1666         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
1667         return ret_ref;
1668 }
1669
1670 typedef struct LDKEcdsaChannelSigner_JCalls {
1671         atomic_size_t refcnt;
1672         uint32_t instance_ptr;
1673         LDKChannelSigner_JCalls* ChannelSigner;
1674 } LDKEcdsaChannelSigner_JCalls;
1675 static void LDKEcdsaChannelSigner_JCalls_free(void* this_arg) {
1676         LDKEcdsaChannelSigner_JCalls *j_calls = (LDKEcdsaChannelSigner_JCalls*) this_arg;
1677         if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
1678                 FREE(j_calls);
1679         }
1680 }
1681 LDKCResult_C2Tuple_ECDSASignatureCVec_ECDSASignatureZZNoneZ sign_counterparty_commitment_LDKEcdsaChannelSigner_jcall(const void* this_arg, const LDKCommitmentTransaction * commitment_tx, LDKCVec_ThirtyTwoBytesZ preimages) {
1682         LDKEcdsaChannelSigner_JCalls *j_calls = (LDKEcdsaChannelSigner_JCalls*) this_arg;
1683         LDKCommitmentTransaction commitment_tx_var = *commitment_tx;
1684         uint64_t commitment_tx_ref = 0;
1685         commitment_tx_var = CommitmentTransaction_clone(&commitment_tx_var);
1686         CHECK_INNER_FIELD_ACCESS_OR_NULL(commitment_tx_var);
1687         commitment_tx_ref = tag_ptr(commitment_tx_var.inner, commitment_tx_var.is_owned);
1688         LDKCVec_ThirtyTwoBytesZ preimages_var = preimages;
1689         ptrArray preimages_arr = NULL;
1690         preimages_arr = init_ptrArray(preimages_var.datalen, __LINE__);
1691         int8_tArray *preimages_arr_ptr = (int8_tArray*)(((uint8_t*)preimages_arr) + 8);
1692         for (size_t m = 0; m < preimages_var.datalen; m++) {
1693                 int8_tArray preimages_conv_12_arr = init_int8_tArray(32, __LINE__);
1694                 memcpy(preimages_conv_12_arr->elems, preimages_var.data[m].data, 32);
1695                 preimages_arr_ptr[m] = preimages_conv_12_arr;
1696         }
1697         
1698         FREE(preimages_var.data);
1699         uint64_t ret = js_invoke_function_buuuuu(j_calls->instance_ptr, 5, commitment_tx_ref, (uint32_t)preimages_arr, 0, 0, 0, 0);
1700         void* ret_ptr = untag_ptr(ret);
1701         CHECK_ACCESS(ret_ptr);
1702         LDKCResult_C2Tuple_ECDSASignatureCVec_ECDSASignatureZZNoneZ ret_conv = *(LDKCResult_C2Tuple_ECDSASignatureCVec_ECDSASignatureZZNoneZ*)(ret_ptr);
1703         FREE(untag_ptr(ret));
1704         return ret_conv;
1705 }
1706 LDKCResult_NoneNoneZ validate_counterparty_revocation_LDKEcdsaChannelSigner_jcall(const void* this_arg, uint64_t idx, const uint8_t (* secret)[32]) {
1707         LDKEcdsaChannelSigner_JCalls *j_calls = (LDKEcdsaChannelSigner_JCalls*) this_arg;
1708         int64_t idx_conv = idx;
1709         int8_tArray secret_arr = init_int8_tArray(32, __LINE__);
1710         memcpy(secret_arr->elems, *secret, 32);
1711         uint64_t ret = js_invoke_function_buuuuu(j_calls->instance_ptr, 6, idx_conv, (uint32_t)secret_arr, 0, 0, 0, 0);
1712         void* ret_ptr = untag_ptr(ret);
1713         CHECK_ACCESS(ret_ptr);
1714         LDKCResult_NoneNoneZ ret_conv = *(LDKCResult_NoneNoneZ*)(ret_ptr);
1715         FREE(untag_ptr(ret));
1716         return ret_conv;
1717 }
1718 LDKCResult_ECDSASignatureNoneZ sign_holder_commitment_LDKEcdsaChannelSigner_jcall(const void* this_arg, const LDKHolderCommitmentTransaction * commitment_tx) {
1719         LDKEcdsaChannelSigner_JCalls *j_calls = (LDKEcdsaChannelSigner_JCalls*) this_arg;
1720         LDKHolderCommitmentTransaction commitment_tx_var = *commitment_tx;
1721         uint64_t commitment_tx_ref = 0;
1722         commitment_tx_var = HolderCommitmentTransaction_clone(&commitment_tx_var);
1723         CHECK_INNER_FIELD_ACCESS_OR_NULL(commitment_tx_var);
1724         commitment_tx_ref = tag_ptr(commitment_tx_var.inner, commitment_tx_var.is_owned);
1725         uint64_t ret = js_invoke_function_buuuuu(j_calls->instance_ptr, 7, commitment_tx_ref, 0, 0, 0, 0, 0);
1726         void* ret_ptr = untag_ptr(ret);
1727         CHECK_ACCESS(ret_ptr);
1728         LDKCResult_ECDSASignatureNoneZ ret_conv = *(LDKCResult_ECDSASignatureNoneZ*)(ret_ptr);
1729         FREE(untag_ptr(ret));
1730         return ret_conv;
1731 }
1732 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]) {
1733         LDKEcdsaChannelSigner_JCalls *j_calls = (LDKEcdsaChannelSigner_JCalls*) this_arg;
1734         LDKTransaction justice_tx_var = justice_tx;
1735         int8_tArray justice_tx_arr = init_int8_tArray(justice_tx_var.datalen, __LINE__);
1736         memcpy(justice_tx_arr->elems, justice_tx_var.data, justice_tx_var.datalen);
1737         Transaction_free(justice_tx_var);
1738         uint32_t input_conv = input;
1739         int64_t amount_conv = amount;
1740         int8_tArray per_commitment_key_arr = init_int8_tArray(32, __LINE__);
1741         memcpy(per_commitment_key_arr->elems, *per_commitment_key, 32);
1742         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);
1743         void* ret_ptr = untag_ptr(ret);
1744         CHECK_ACCESS(ret_ptr);
1745         LDKCResult_ECDSASignatureNoneZ ret_conv = *(LDKCResult_ECDSASignatureNoneZ*)(ret_ptr);
1746         FREE(untag_ptr(ret));
1747         return ret_conv;
1748 }
1749 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) {
1750         LDKEcdsaChannelSigner_JCalls *j_calls = (LDKEcdsaChannelSigner_JCalls*) this_arg;
1751         LDKTransaction justice_tx_var = justice_tx;
1752         int8_tArray justice_tx_arr = init_int8_tArray(justice_tx_var.datalen, __LINE__);
1753         memcpy(justice_tx_arr->elems, justice_tx_var.data, justice_tx_var.datalen);
1754         Transaction_free(justice_tx_var);
1755         uint32_t input_conv = input;
1756         int64_t amount_conv = amount;
1757         int8_tArray per_commitment_key_arr = init_int8_tArray(32, __LINE__);
1758         memcpy(per_commitment_key_arr->elems, *per_commitment_key, 32);
1759         LDKHTLCOutputInCommitment htlc_var = *htlc;
1760         uint64_t htlc_ref = 0;
1761         htlc_var = HTLCOutputInCommitment_clone(&htlc_var);
1762         CHECK_INNER_FIELD_ACCESS_OR_NULL(htlc_var);
1763         htlc_ref = tag_ptr(htlc_var.inner, htlc_var.is_owned);
1764         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);
1765         void* ret_ptr = untag_ptr(ret);
1766         CHECK_ACCESS(ret_ptr);
1767         LDKCResult_ECDSASignatureNoneZ ret_conv = *(LDKCResult_ECDSASignatureNoneZ*)(ret_ptr);
1768         FREE(untag_ptr(ret));
1769         return ret_conv;
1770 }
1771 LDKCResult_ECDSASignatureNoneZ sign_holder_htlc_transaction_LDKEcdsaChannelSigner_jcall(const void* this_arg, LDKTransaction htlc_tx, uintptr_t input, const LDKHTLCDescriptor * htlc_descriptor) {
1772         LDKEcdsaChannelSigner_JCalls *j_calls = (LDKEcdsaChannelSigner_JCalls*) this_arg;
1773         LDKTransaction htlc_tx_var = htlc_tx;
1774         int8_tArray htlc_tx_arr = init_int8_tArray(htlc_tx_var.datalen, __LINE__);
1775         memcpy(htlc_tx_arr->elems, htlc_tx_var.data, htlc_tx_var.datalen);
1776         Transaction_free(htlc_tx_var);
1777         uint32_t input_conv = input;
1778         LDKHTLCDescriptor htlc_descriptor_var = *htlc_descriptor;
1779         uint64_t htlc_descriptor_ref = 0;
1780         htlc_descriptor_var = HTLCDescriptor_clone(&htlc_descriptor_var);
1781         CHECK_INNER_FIELD_ACCESS_OR_NULL(htlc_descriptor_var);
1782         htlc_descriptor_ref = tag_ptr(htlc_descriptor_var.inner, htlc_descriptor_var.is_owned);
1783         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);
1784         void* ret_ptr = untag_ptr(ret);
1785         CHECK_ACCESS(ret_ptr);
1786         LDKCResult_ECDSASignatureNoneZ ret_conv = *(LDKCResult_ECDSASignatureNoneZ*)(ret_ptr);
1787         FREE(untag_ptr(ret));
1788         return ret_conv;
1789 }
1790 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) {
1791         LDKEcdsaChannelSigner_JCalls *j_calls = (LDKEcdsaChannelSigner_JCalls*) this_arg;
1792         LDKTransaction htlc_tx_var = htlc_tx;
1793         int8_tArray htlc_tx_arr = init_int8_tArray(htlc_tx_var.datalen, __LINE__);
1794         memcpy(htlc_tx_arr->elems, htlc_tx_var.data, htlc_tx_var.datalen);
1795         Transaction_free(htlc_tx_var);
1796         uint32_t input_conv = input;
1797         int64_t amount_conv = amount;
1798         int8_tArray per_commitment_point_arr = init_int8_tArray(33, __LINE__);
1799         memcpy(per_commitment_point_arr->elems, per_commitment_point.compressed_form, 33);
1800         LDKHTLCOutputInCommitment htlc_var = *htlc;
1801         uint64_t htlc_ref = 0;
1802         htlc_var = HTLCOutputInCommitment_clone(&htlc_var);
1803         CHECK_INNER_FIELD_ACCESS_OR_NULL(htlc_var);
1804         htlc_ref = tag_ptr(htlc_var.inner, htlc_var.is_owned);
1805         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);
1806         void* ret_ptr = untag_ptr(ret);
1807         CHECK_ACCESS(ret_ptr);
1808         LDKCResult_ECDSASignatureNoneZ ret_conv = *(LDKCResult_ECDSASignatureNoneZ*)(ret_ptr);
1809         FREE(untag_ptr(ret));
1810         return ret_conv;
1811 }
1812 LDKCResult_ECDSASignatureNoneZ sign_closing_transaction_LDKEcdsaChannelSigner_jcall(const void* this_arg, const LDKClosingTransaction * closing_tx) {
1813         LDKEcdsaChannelSigner_JCalls *j_calls = (LDKEcdsaChannelSigner_JCalls*) this_arg;
1814         LDKClosingTransaction closing_tx_var = *closing_tx;
1815         uint64_t closing_tx_ref = 0;
1816         closing_tx_var = ClosingTransaction_clone(&closing_tx_var);
1817         CHECK_INNER_FIELD_ACCESS_OR_NULL(closing_tx_var);
1818         closing_tx_ref = tag_ptr(closing_tx_var.inner, closing_tx_var.is_owned);
1819         uint64_t ret = js_invoke_function_buuuuu(j_calls->instance_ptr, 12, closing_tx_ref, 0, 0, 0, 0, 0);
1820         void* ret_ptr = untag_ptr(ret);
1821         CHECK_ACCESS(ret_ptr);
1822         LDKCResult_ECDSASignatureNoneZ ret_conv = *(LDKCResult_ECDSASignatureNoneZ*)(ret_ptr);
1823         FREE(untag_ptr(ret));
1824         return ret_conv;
1825 }
1826 LDKCResult_ECDSASignatureNoneZ sign_holder_anchor_input_LDKEcdsaChannelSigner_jcall(const void* this_arg, LDKTransaction anchor_tx, uintptr_t input) {
1827         LDKEcdsaChannelSigner_JCalls *j_calls = (LDKEcdsaChannelSigner_JCalls*) this_arg;
1828         LDKTransaction anchor_tx_var = anchor_tx;
1829         int8_tArray anchor_tx_arr = init_int8_tArray(anchor_tx_var.datalen, __LINE__);
1830         memcpy(anchor_tx_arr->elems, anchor_tx_var.data, anchor_tx_var.datalen);
1831         Transaction_free(anchor_tx_var);
1832         uint32_t input_conv = input;
1833         uint64_t ret = js_invoke_function_uuuuuu(j_calls->instance_ptr, 13, (uint32_t)anchor_tx_arr, input_conv, 0, 0, 0, 0);
1834         void* ret_ptr = untag_ptr(ret);
1835         CHECK_ACCESS(ret_ptr);
1836         LDKCResult_ECDSASignatureNoneZ ret_conv = *(LDKCResult_ECDSASignatureNoneZ*)(ret_ptr);
1837         FREE(untag_ptr(ret));
1838         return ret_conv;
1839 }
1840 LDKCResult_ECDSASignatureNoneZ sign_channel_announcement_with_funding_key_LDKEcdsaChannelSigner_jcall(const void* this_arg, const LDKUnsignedChannelAnnouncement * msg) {
1841         LDKEcdsaChannelSigner_JCalls *j_calls = (LDKEcdsaChannelSigner_JCalls*) this_arg;
1842         LDKUnsignedChannelAnnouncement msg_var = *msg;
1843         uint64_t msg_ref = 0;
1844         msg_var = UnsignedChannelAnnouncement_clone(&msg_var);
1845         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
1846         msg_ref = tag_ptr(msg_var.inner, msg_var.is_owned);
1847         uint64_t ret = js_invoke_function_buuuuu(j_calls->instance_ptr, 14, msg_ref, 0, 0, 0, 0, 0);
1848         void* ret_ptr = untag_ptr(ret);
1849         CHECK_ACCESS(ret_ptr);
1850         LDKCResult_ECDSASignatureNoneZ ret_conv = *(LDKCResult_ECDSASignatureNoneZ*)(ret_ptr);
1851         FREE(untag_ptr(ret));
1852         return ret_conv;
1853 }
1854 static void LDKEcdsaChannelSigner_JCalls_cloned(LDKEcdsaChannelSigner* new_obj) {
1855         LDKEcdsaChannelSigner_JCalls *j_calls = (LDKEcdsaChannelSigner_JCalls*) new_obj->this_arg;
1856         atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
1857         atomic_fetch_add_explicit(&j_calls->ChannelSigner->refcnt, 1, memory_order_release);
1858 }
1859 static inline LDKEcdsaChannelSigner LDKEcdsaChannelSigner_init (JSValue o, JSValue ChannelSigner, uint64_t pubkeys) {
1860         LDKEcdsaChannelSigner_JCalls *calls = MALLOC(sizeof(LDKEcdsaChannelSigner_JCalls), "LDKEcdsaChannelSigner_JCalls");
1861         atomic_init(&calls->refcnt, 1);
1862         calls->instance_ptr = o;
1863
1864         LDKChannelPublicKeys pubkeys_conv;
1865         pubkeys_conv.inner = untag_ptr(pubkeys);
1866         pubkeys_conv.is_owned = ptr_is_owned(pubkeys);
1867         CHECK_INNER_FIELD_ACCESS_OR_NULL(pubkeys_conv);
1868
1869         LDKEcdsaChannelSigner ret = {
1870                 .this_arg = (void*) calls,
1871                 .sign_counterparty_commitment = sign_counterparty_commitment_LDKEcdsaChannelSigner_jcall,
1872                 .validate_counterparty_revocation = validate_counterparty_revocation_LDKEcdsaChannelSigner_jcall,
1873                 .sign_holder_commitment = sign_holder_commitment_LDKEcdsaChannelSigner_jcall,
1874                 .sign_justice_revoked_output = sign_justice_revoked_output_LDKEcdsaChannelSigner_jcall,
1875                 .sign_justice_revoked_htlc = sign_justice_revoked_htlc_LDKEcdsaChannelSigner_jcall,
1876                 .sign_holder_htlc_transaction = sign_holder_htlc_transaction_LDKEcdsaChannelSigner_jcall,
1877                 .sign_counterparty_htlc_transaction = sign_counterparty_htlc_transaction_LDKEcdsaChannelSigner_jcall,
1878                 .sign_closing_transaction = sign_closing_transaction_LDKEcdsaChannelSigner_jcall,
1879                 .sign_holder_anchor_input = sign_holder_anchor_input_LDKEcdsaChannelSigner_jcall,
1880                 .sign_channel_announcement_with_funding_key = sign_channel_announcement_with_funding_key_LDKEcdsaChannelSigner_jcall,
1881                 .free = LDKEcdsaChannelSigner_JCalls_free,
1882                 .ChannelSigner = LDKChannelSigner_init(ChannelSigner, pubkeys),
1883         };
1884         calls->ChannelSigner = ret.ChannelSigner.this_arg;
1885         return ret;
1886 }
1887 uint64_t  __attribute__((export_name("TS_LDKEcdsaChannelSigner_new"))) TS_LDKEcdsaChannelSigner_new(JSValue o, JSValue ChannelSigner, uint64_t pubkeys) {
1888         LDKEcdsaChannelSigner *res_ptr = MALLOC(sizeof(LDKEcdsaChannelSigner), "LDKEcdsaChannelSigner");
1889         *res_ptr = LDKEcdsaChannelSigner_init(o, ChannelSigner, pubkeys);
1890         return tag_ptr(res_ptr, true);
1891 }
1892 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) {
1893         void* this_arg_ptr = untag_ptr(this_arg);
1894         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
1895         LDKEcdsaChannelSigner* this_arg_conv = (LDKEcdsaChannelSigner*)this_arg_ptr;
1896         LDKCommitmentTransaction commitment_tx_conv;
1897         commitment_tx_conv.inner = untag_ptr(commitment_tx);
1898         commitment_tx_conv.is_owned = ptr_is_owned(commitment_tx);
1899         CHECK_INNER_FIELD_ACCESS_OR_NULL(commitment_tx_conv);
1900         commitment_tx_conv.is_owned = false;
1901         LDKCVec_ThirtyTwoBytesZ preimages_constr;
1902         preimages_constr.datalen = preimages->arr_len;
1903         if (preimages_constr.datalen > 0)
1904                 preimages_constr.data = MALLOC(preimages_constr.datalen * sizeof(LDKThirtyTwoBytes), "LDKCVec_ThirtyTwoBytesZ Elements");
1905         else
1906                 preimages_constr.data = NULL;
1907         int8_tArray* preimages_vals = (void*) preimages->elems;
1908         for (size_t m = 0; m < preimages_constr.datalen; m++) {
1909                 int8_tArray preimages_conv_12 = preimages_vals[m];
1910                 LDKThirtyTwoBytes preimages_conv_12_ref;
1911                 CHECK(preimages_conv_12->arr_len == 32);
1912                 memcpy(preimages_conv_12_ref.data, preimages_conv_12->elems, 32); FREE(preimages_conv_12);
1913                 preimages_constr.data[m] = preimages_conv_12_ref;
1914         }
1915         FREE(preimages);
1916         LDKCResult_C2Tuple_ECDSASignatureCVec_ECDSASignatureZZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_ECDSASignatureCVec_ECDSASignatureZZNoneZ), "LDKCResult_C2Tuple_ECDSASignatureCVec_ECDSASignatureZZNoneZ");
1917         *ret_conv = (this_arg_conv->sign_counterparty_commitment)(this_arg_conv->this_arg, &commitment_tx_conv, preimages_constr);
1918         return tag_ptr(ret_conv, true);
1919 }
1920
1921 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) {
1922         void* this_arg_ptr = untag_ptr(this_arg);
1923         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
1924         LDKEcdsaChannelSigner* this_arg_conv = (LDKEcdsaChannelSigner*)this_arg_ptr;
1925         uint8_t secret_arr[32];
1926         CHECK(secret->arr_len == 32);
1927         memcpy(secret_arr, secret->elems, 32); FREE(secret);
1928         uint8_t (*secret_ref)[32] = &secret_arr;
1929         LDKCResult_NoneNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneNoneZ), "LDKCResult_NoneNoneZ");
1930         *ret_conv = (this_arg_conv->validate_counterparty_revocation)(this_arg_conv->this_arg, idx, secret_ref);
1931         return tag_ptr(ret_conv, true);
1932 }
1933
1934 uint64_t  __attribute__((export_name("TS_EcdsaChannelSigner_sign_holder_commitment"))) TS_EcdsaChannelSigner_sign_holder_commitment(uint64_t this_arg, uint64_t commitment_tx) {
1935         void* this_arg_ptr = untag_ptr(this_arg);
1936         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
1937         LDKEcdsaChannelSigner* this_arg_conv = (LDKEcdsaChannelSigner*)this_arg_ptr;
1938         LDKHolderCommitmentTransaction commitment_tx_conv;
1939         commitment_tx_conv.inner = untag_ptr(commitment_tx);
1940         commitment_tx_conv.is_owned = ptr_is_owned(commitment_tx);
1941         CHECK_INNER_FIELD_ACCESS_OR_NULL(commitment_tx_conv);
1942         commitment_tx_conv.is_owned = false;
1943         LDKCResult_ECDSASignatureNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_ECDSASignatureNoneZ), "LDKCResult_ECDSASignatureNoneZ");
1944         *ret_conv = (this_arg_conv->sign_holder_commitment)(this_arg_conv->this_arg, &commitment_tx_conv);
1945         return tag_ptr(ret_conv, true);
1946 }
1947
1948 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) {
1949         void* this_arg_ptr = untag_ptr(this_arg);
1950         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
1951         LDKEcdsaChannelSigner* this_arg_conv = (LDKEcdsaChannelSigner*)this_arg_ptr;
1952         LDKTransaction justice_tx_ref;
1953         justice_tx_ref.datalen = justice_tx->arr_len;
1954         justice_tx_ref.data = MALLOC(justice_tx_ref.datalen, "LDKTransaction Bytes");
1955         memcpy(justice_tx_ref.data, justice_tx->elems, justice_tx_ref.datalen); FREE(justice_tx);
1956         justice_tx_ref.data_is_owned = true;
1957         uint8_t per_commitment_key_arr[32];
1958         CHECK(per_commitment_key->arr_len == 32);
1959         memcpy(per_commitment_key_arr, per_commitment_key->elems, 32); FREE(per_commitment_key);
1960         uint8_t (*per_commitment_key_ref)[32] = &per_commitment_key_arr;
1961         LDKCResult_ECDSASignatureNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_ECDSASignatureNoneZ), "LDKCResult_ECDSASignatureNoneZ");
1962         *ret_conv = (this_arg_conv->sign_justice_revoked_output)(this_arg_conv->this_arg, justice_tx_ref, input, amount, per_commitment_key_ref);
1963         return tag_ptr(ret_conv, true);
1964 }
1965
1966 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) {
1967         void* this_arg_ptr = untag_ptr(this_arg);
1968         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
1969         LDKEcdsaChannelSigner* this_arg_conv = (LDKEcdsaChannelSigner*)this_arg_ptr;
1970         LDKTransaction justice_tx_ref;
1971         justice_tx_ref.datalen = justice_tx->arr_len;
1972         justice_tx_ref.data = MALLOC(justice_tx_ref.datalen, "LDKTransaction Bytes");
1973         memcpy(justice_tx_ref.data, justice_tx->elems, justice_tx_ref.datalen); FREE(justice_tx);
1974         justice_tx_ref.data_is_owned = true;
1975         uint8_t per_commitment_key_arr[32];
1976         CHECK(per_commitment_key->arr_len == 32);
1977         memcpy(per_commitment_key_arr, per_commitment_key->elems, 32); FREE(per_commitment_key);
1978         uint8_t (*per_commitment_key_ref)[32] = &per_commitment_key_arr;
1979         LDKHTLCOutputInCommitment htlc_conv;
1980         htlc_conv.inner = untag_ptr(htlc);
1981         htlc_conv.is_owned = ptr_is_owned(htlc);
1982         CHECK_INNER_FIELD_ACCESS_OR_NULL(htlc_conv);
1983         htlc_conv.is_owned = false;
1984         LDKCResult_ECDSASignatureNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_ECDSASignatureNoneZ), "LDKCResult_ECDSASignatureNoneZ");
1985         *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);
1986         return tag_ptr(ret_conv, true);
1987 }
1988
1989 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) {
1990         void* this_arg_ptr = untag_ptr(this_arg);
1991         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
1992         LDKEcdsaChannelSigner* this_arg_conv = (LDKEcdsaChannelSigner*)this_arg_ptr;
1993         LDKTransaction htlc_tx_ref;
1994         htlc_tx_ref.datalen = htlc_tx->arr_len;
1995         htlc_tx_ref.data = MALLOC(htlc_tx_ref.datalen, "LDKTransaction Bytes");
1996         memcpy(htlc_tx_ref.data, htlc_tx->elems, htlc_tx_ref.datalen); FREE(htlc_tx);
1997         htlc_tx_ref.data_is_owned = true;
1998         LDKHTLCDescriptor htlc_descriptor_conv;
1999         htlc_descriptor_conv.inner = untag_ptr(htlc_descriptor);
2000         htlc_descriptor_conv.is_owned = ptr_is_owned(htlc_descriptor);
2001         CHECK_INNER_FIELD_ACCESS_OR_NULL(htlc_descriptor_conv);
2002         htlc_descriptor_conv.is_owned = false;
2003         LDKCResult_ECDSASignatureNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_ECDSASignatureNoneZ), "LDKCResult_ECDSASignatureNoneZ");
2004         *ret_conv = (this_arg_conv->sign_holder_htlc_transaction)(this_arg_conv->this_arg, htlc_tx_ref, input, &htlc_descriptor_conv);
2005         return tag_ptr(ret_conv, true);
2006 }
2007
2008 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) {
2009         void* this_arg_ptr = untag_ptr(this_arg);
2010         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
2011         LDKEcdsaChannelSigner* this_arg_conv = (LDKEcdsaChannelSigner*)this_arg_ptr;
2012         LDKTransaction htlc_tx_ref;
2013         htlc_tx_ref.datalen = htlc_tx->arr_len;
2014         htlc_tx_ref.data = MALLOC(htlc_tx_ref.datalen, "LDKTransaction Bytes");
2015         memcpy(htlc_tx_ref.data, htlc_tx->elems, htlc_tx_ref.datalen); FREE(htlc_tx);
2016         htlc_tx_ref.data_is_owned = true;
2017         LDKPublicKey per_commitment_point_ref;
2018         CHECK(per_commitment_point->arr_len == 33);
2019         memcpy(per_commitment_point_ref.compressed_form, per_commitment_point->elems, 33); FREE(per_commitment_point);
2020         LDKHTLCOutputInCommitment htlc_conv;
2021         htlc_conv.inner = untag_ptr(htlc);
2022         htlc_conv.is_owned = ptr_is_owned(htlc);
2023         CHECK_INNER_FIELD_ACCESS_OR_NULL(htlc_conv);
2024         htlc_conv.is_owned = false;
2025         LDKCResult_ECDSASignatureNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_ECDSASignatureNoneZ), "LDKCResult_ECDSASignatureNoneZ");
2026         *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);
2027         return tag_ptr(ret_conv, true);
2028 }
2029
2030 uint64_t  __attribute__((export_name("TS_EcdsaChannelSigner_sign_closing_transaction"))) TS_EcdsaChannelSigner_sign_closing_transaction(uint64_t this_arg, uint64_t closing_tx) {
2031         void* this_arg_ptr = untag_ptr(this_arg);
2032         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
2033         LDKEcdsaChannelSigner* this_arg_conv = (LDKEcdsaChannelSigner*)this_arg_ptr;
2034         LDKClosingTransaction closing_tx_conv;
2035         closing_tx_conv.inner = untag_ptr(closing_tx);
2036         closing_tx_conv.is_owned = ptr_is_owned(closing_tx);
2037         CHECK_INNER_FIELD_ACCESS_OR_NULL(closing_tx_conv);
2038         closing_tx_conv.is_owned = false;
2039         LDKCResult_ECDSASignatureNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_ECDSASignatureNoneZ), "LDKCResult_ECDSASignatureNoneZ");
2040         *ret_conv = (this_arg_conv->sign_closing_transaction)(this_arg_conv->this_arg, &closing_tx_conv);
2041         return tag_ptr(ret_conv, true);
2042 }
2043
2044 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) {
2045         void* this_arg_ptr = untag_ptr(this_arg);
2046         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
2047         LDKEcdsaChannelSigner* this_arg_conv = (LDKEcdsaChannelSigner*)this_arg_ptr;
2048         LDKTransaction anchor_tx_ref;
2049         anchor_tx_ref.datalen = anchor_tx->arr_len;
2050         anchor_tx_ref.data = MALLOC(anchor_tx_ref.datalen, "LDKTransaction Bytes");
2051         memcpy(anchor_tx_ref.data, anchor_tx->elems, anchor_tx_ref.datalen); FREE(anchor_tx);
2052         anchor_tx_ref.data_is_owned = true;
2053         LDKCResult_ECDSASignatureNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_ECDSASignatureNoneZ), "LDKCResult_ECDSASignatureNoneZ");
2054         *ret_conv = (this_arg_conv->sign_holder_anchor_input)(this_arg_conv->this_arg, anchor_tx_ref, input);
2055         return tag_ptr(ret_conv, true);
2056 }
2057
2058 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) {
2059         void* this_arg_ptr = untag_ptr(this_arg);
2060         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
2061         LDKEcdsaChannelSigner* this_arg_conv = (LDKEcdsaChannelSigner*)this_arg_ptr;
2062         LDKUnsignedChannelAnnouncement msg_conv;
2063         msg_conv.inner = untag_ptr(msg);
2064         msg_conv.is_owned = ptr_is_owned(msg);
2065         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
2066         msg_conv.is_owned = false;
2067         LDKCResult_ECDSASignatureNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_ECDSASignatureNoneZ), "LDKCResult_ECDSASignatureNoneZ");
2068         *ret_conv = (this_arg_conv->sign_channel_announcement_with_funding_key)(this_arg_conv->this_arg, &msg_conv);
2069         return tag_ptr(ret_conv, true);
2070 }
2071
2072 typedef struct LDKWriteableEcdsaChannelSigner_JCalls {
2073         atomic_size_t refcnt;
2074         uint32_t instance_ptr;
2075         LDKEcdsaChannelSigner_JCalls* EcdsaChannelSigner;
2076         LDKChannelSigner_JCalls* ChannelSigner;
2077 } LDKWriteableEcdsaChannelSigner_JCalls;
2078 static void LDKWriteableEcdsaChannelSigner_JCalls_free(void* this_arg) {
2079         LDKWriteableEcdsaChannelSigner_JCalls *j_calls = (LDKWriteableEcdsaChannelSigner_JCalls*) this_arg;
2080         if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
2081                 FREE(j_calls);
2082         }
2083 }
2084 LDKCVec_u8Z write_LDKWriteableEcdsaChannelSigner_jcall(const void* this_arg) {
2085         LDKWriteableEcdsaChannelSigner_JCalls *j_calls = (LDKWriteableEcdsaChannelSigner_JCalls*) this_arg;
2086         int8_tArray ret = (int8_tArray)js_invoke_function_uuuuuu(j_calls->instance_ptr, 15, 0, 0, 0, 0, 0, 0);
2087         LDKCVec_u8Z ret_ref;
2088         ret_ref.datalen = ret->arr_len;
2089         ret_ref.data = MALLOC(ret_ref.datalen, "LDKCVec_u8Z Bytes");
2090         memcpy(ret_ref.data, ret->elems, ret_ref.datalen); FREE(ret);
2091         return ret_ref;
2092 }
2093 static void LDKWriteableEcdsaChannelSigner_JCalls_cloned(LDKWriteableEcdsaChannelSigner* new_obj) {
2094         LDKWriteableEcdsaChannelSigner_JCalls *j_calls = (LDKWriteableEcdsaChannelSigner_JCalls*) new_obj->this_arg;
2095         atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
2096         atomic_fetch_add_explicit(&j_calls->EcdsaChannelSigner->refcnt, 1, memory_order_release);
2097         atomic_fetch_add_explicit(&j_calls->EcdsaChannelSigner->ChannelSigner->refcnt, 1, memory_order_release);
2098 }
2099 static inline LDKWriteableEcdsaChannelSigner LDKWriteableEcdsaChannelSigner_init (JSValue o, JSValue EcdsaChannelSigner, JSValue ChannelSigner, uint64_t pubkeys) {
2100         LDKWriteableEcdsaChannelSigner_JCalls *calls = MALLOC(sizeof(LDKWriteableEcdsaChannelSigner_JCalls), "LDKWriteableEcdsaChannelSigner_JCalls");
2101         atomic_init(&calls->refcnt, 1);
2102         calls->instance_ptr = o;
2103
2104         LDKChannelPublicKeys pubkeys_conv;
2105         pubkeys_conv.inner = untag_ptr(pubkeys);
2106         pubkeys_conv.is_owned = ptr_is_owned(pubkeys);
2107         CHECK_INNER_FIELD_ACCESS_OR_NULL(pubkeys_conv);
2108
2109         LDKWriteableEcdsaChannelSigner ret = {
2110                 .this_arg = (void*) calls,
2111                 .write = write_LDKWriteableEcdsaChannelSigner_jcall,
2112                 .cloned = LDKWriteableEcdsaChannelSigner_JCalls_cloned,
2113                 .free = LDKWriteableEcdsaChannelSigner_JCalls_free,
2114                 .EcdsaChannelSigner = LDKEcdsaChannelSigner_init(EcdsaChannelSigner, ChannelSigner, pubkeys),
2115         };
2116         calls->EcdsaChannelSigner = ret.EcdsaChannelSigner.this_arg;
2117         calls->ChannelSigner = ret.EcdsaChannelSigner.ChannelSigner.this_arg;
2118         return ret;
2119 }
2120 uint64_t  __attribute__((export_name("TS_LDKWriteableEcdsaChannelSigner_new"))) TS_LDKWriteableEcdsaChannelSigner_new(JSValue o, JSValue EcdsaChannelSigner, JSValue ChannelSigner, uint64_t pubkeys) {
2121         LDKWriteableEcdsaChannelSigner *res_ptr = MALLOC(sizeof(LDKWriteableEcdsaChannelSigner), "LDKWriteableEcdsaChannelSigner");
2122         *res_ptr = LDKWriteableEcdsaChannelSigner_init(o, EcdsaChannelSigner, ChannelSigner, pubkeys);
2123         return tag_ptr(res_ptr, true);
2124 }
2125 int8_tArray  __attribute__((export_name("TS_WriteableEcdsaChannelSigner_write"))) TS_WriteableEcdsaChannelSigner_write(uint64_t this_arg) {
2126         void* this_arg_ptr = untag_ptr(this_arg);
2127         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
2128         LDKWriteableEcdsaChannelSigner* this_arg_conv = (LDKWriteableEcdsaChannelSigner*)this_arg_ptr;
2129         LDKCVec_u8Z ret_var = (this_arg_conv->write)(this_arg_conv->this_arg);
2130         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
2131         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
2132         CVec_u8Z_free(ret_var);
2133         return ret_arr;
2134 }
2135
2136 static inline struct LDKWriteableEcdsaChannelSigner CResult_WriteableEcdsaChannelSignerDecodeErrorZ_get_ok(LDKCResult_WriteableEcdsaChannelSignerDecodeErrorZ *NONNULL_PTR owner){
2137 CHECK(owner->result_ok);
2138         return WriteableEcdsaChannelSigner_clone(&*owner->contents.result);
2139 }
2140 uint64_t  __attribute__((export_name("TS_CResult_WriteableEcdsaChannelSignerDecodeErrorZ_get_ok"))) TS_CResult_WriteableEcdsaChannelSignerDecodeErrorZ_get_ok(uint64_t owner) {
2141         LDKCResult_WriteableEcdsaChannelSignerDecodeErrorZ* owner_conv = (LDKCResult_WriteableEcdsaChannelSignerDecodeErrorZ*)untag_ptr(owner);
2142         LDKWriteableEcdsaChannelSigner* ret_ret = MALLOC(sizeof(LDKWriteableEcdsaChannelSigner), "LDKWriteableEcdsaChannelSigner");
2143         *ret_ret = CResult_WriteableEcdsaChannelSignerDecodeErrorZ_get_ok(owner_conv);
2144         return tag_ptr(ret_ret, true);
2145 }
2146
2147 static inline struct LDKDecodeError CResult_WriteableEcdsaChannelSignerDecodeErrorZ_get_err(LDKCResult_WriteableEcdsaChannelSignerDecodeErrorZ *NONNULL_PTR owner){
2148 CHECK(!owner->result_ok);
2149         return DecodeError_clone(&*owner->contents.err);
2150 }
2151 uint64_t  __attribute__((export_name("TS_CResult_WriteableEcdsaChannelSignerDecodeErrorZ_get_err"))) TS_CResult_WriteableEcdsaChannelSignerDecodeErrorZ_get_err(uint64_t owner) {
2152         LDKCResult_WriteableEcdsaChannelSignerDecodeErrorZ* owner_conv = (LDKCResult_WriteableEcdsaChannelSignerDecodeErrorZ*)untag_ptr(owner);
2153         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
2154         *ret_copy = CResult_WriteableEcdsaChannelSignerDecodeErrorZ_get_err(owner_conv);
2155         uint64_t ret_ref = tag_ptr(ret_copy, true);
2156         return ret_ref;
2157 }
2158
2159 static inline struct LDKCVec_u8Z CResult_CVec_u8ZNoneZ_get_ok(LDKCResult_CVec_u8ZNoneZ *NONNULL_PTR owner){
2160 CHECK(owner->result_ok);
2161         return CVec_u8Z_clone(&*owner->contents.result);
2162 }
2163 int8_tArray  __attribute__((export_name("TS_CResult_CVec_u8ZNoneZ_get_ok"))) TS_CResult_CVec_u8ZNoneZ_get_ok(uint64_t owner) {
2164         LDKCResult_CVec_u8ZNoneZ* owner_conv = (LDKCResult_CVec_u8ZNoneZ*)untag_ptr(owner);
2165         LDKCVec_u8Z ret_var = CResult_CVec_u8ZNoneZ_get_ok(owner_conv);
2166         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
2167         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
2168         CVec_u8Z_free(ret_var);
2169         return ret_arr;
2170 }
2171
2172 static inline void CResult_CVec_u8ZNoneZ_get_err(LDKCResult_CVec_u8ZNoneZ *NONNULL_PTR owner){
2173 CHECK(!owner->result_ok);
2174         return *owner->contents.err;
2175 }
2176 void  __attribute__((export_name("TS_CResult_CVec_u8ZNoneZ_get_err"))) TS_CResult_CVec_u8ZNoneZ_get_err(uint64_t owner) {
2177         LDKCResult_CVec_u8ZNoneZ* owner_conv = (LDKCResult_CVec_u8ZNoneZ*)untag_ptr(owner);
2178         CResult_CVec_u8ZNoneZ_get_err(owner_conv);
2179 }
2180
2181 static inline struct LDKShutdownScript CResult_ShutdownScriptNoneZ_get_ok(LDKCResult_ShutdownScriptNoneZ *NONNULL_PTR owner){
2182         LDKShutdownScript ret = *owner->contents.result;
2183         ret.is_owned = false;
2184         return ret;
2185 }
2186 uint64_t  __attribute__((export_name("TS_CResult_ShutdownScriptNoneZ_get_ok"))) TS_CResult_ShutdownScriptNoneZ_get_ok(uint64_t owner) {
2187         LDKCResult_ShutdownScriptNoneZ* owner_conv = (LDKCResult_ShutdownScriptNoneZ*)untag_ptr(owner);
2188         LDKShutdownScript ret_var = CResult_ShutdownScriptNoneZ_get_ok(owner_conv);
2189         uint64_t ret_ref = 0;
2190         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
2191         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
2192         return ret_ref;
2193 }
2194
2195 static inline void CResult_ShutdownScriptNoneZ_get_err(LDKCResult_ShutdownScriptNoneZ *NONNULL_PTR owner){
2196 CHECK(!owner->result_ok);
2197         return *owner->contents.err;
2198 }
2199 void  __attribute__((export_name("TS_CResult_ShutdownScriptNoneZ_get_err"))) TS_CResult_ShutdownScriptNoneZ_get_err(uint64_t owner) {
2200         LDKCResult_ShutdownScriptNoneZ* owner_conv = (LDKCResult_ShutdownScriptNoneZ*)untag_ptr(owner);
2201         CResult_ShutdownScriptNoneZ_get_err(owner_conv);
2202 }
2203
2204 uint32_t __attribute__((export_name("TS_LDKCOption_u16Z_ty_from_ptr"))) TS_LDKCOption_u16Z_ty_from_ptr(uint64_t ptr) {
2205         LDKCOption_u16Z *obj = (LDKCOption_u16Z*)untag_ptr(ptr);
2206         switch(obj->tag) {
2207                 case LDKCOption_u16Z_Some: return 0;
2208                 case LDKCOption_u16Z_None: return 1;
2209                 default: abort();
2210         }
2211 }
2212 int16_t __attribute__((export_name("TS_LDKCOption_u16Z_Some_get_some"))) TS_LDKCOption_u16Z_Some_get_some(uint64_t ptr) {
2213         LDKCOption_u16Z *obj = (LDKCOption_u16Z*)untag_ptr(ptr);
2214         assert(obj->tag == LDKCOption_u16Z_Some);
2215         int16_t some_conv = obj->some;
2216         return some_conv;
2217 }
2218 uint32_t __attribute__((export_name("TS_LDKCOption_boolZ_ty_from_ptr"))) TS_LDKCOption_boolZ_ty_from_ptr(uint64_t ptr) {
2219         LDKCOption_boolZ *obj = (LDKCOption_boolZ*)untag_ptr(ptr);
2220         switch(obj->tag) {
2221                 case LDKCOption_boolZ_Some: return 0;
2222                 case LDKCOption_boolZ_None: return 1;
2223                 default: abort();
2224         }
2225 }
2226 jboolean __attribute__((export_name("TS_LDKCOption_boolZ_Some_get_some"))) TS_LDKCOption_boolZ_Some_get_some(uint64_t ptr) {
2227         LDKCOption_boolZ *obj = (LDKCOption_boolZ*)untag_ptr(ptr);
2228         assert(obj->tag == LDKCOption_boolZ_Some);
2229         jboolean some_conv = obj->some;
2230         return some_conv;
2231 }
2232 static inline LDKCVec_CVec_u8ZZ CVec_CVec_u8ZZ_clone(const LDKCVec_CVec_u8ZZ *orig) {
2233         LDKCVec_CVec_u8ZZ ret = { .data = MALLOC(sizeof(LDKCVec_u8Z) * orig->datalen, "LDKCVec_CVec_u8ZZ clone bytes"), .datalen = orig->datalen };
2234         for (size_t i = 0; i < ret.datalen; i++) {
2235                 ret.data[i] = CVec_u8Z_clone(&orig->data[i]);
2236         }
2237         return ret;
2238 }
2239 static inline struct LDKCVec_CVec_u8ZZ CResult_CVec_CVec_u8ZZNoneZ_get_ok(LDKCResult_CVec_CVec_u8ZZNoneZ *NONNULL_PTR owner){
2240 CHECK(owner->result_ok);
2241         return CVec_CVec_u8ZZ_clone(&*owner->contents.result);
2242 }
2243 ptrArray  __attribute__((export_name("TS_CResult_CVec_CVec_u8ZZNoneZ_get_ok"))) TS_CResult_CVec_CVec_u8ZZNoneZ_get_ok(uint64_t owner) {
2244         LDKCResult_CVec_CVec_u8ZZNoneZ* owner_conv = (LDKCResult_CVec_CVec_u8ZZNoneZ*)untag_ptr(owner);
2245         LDKCVec_CVec_u8ZZ ret_var = CResult_CVec_CVec_u8ZZNoneZ_get_ok(owner_conv);
2246         ptrArray ret_arr = NULL;
2247         ret_arr = init_ptrArray(ret_var.datalen, __LINE__);
2248         int8_tArray *ret_arr_ptr = (int8_tArray*)(((uint8_t*)ret_arr) + 8);
2249         for (size_t m = 0; m < ret_var.datalen; m++) {
2250                 LDKCVec_u8Z ret_conv_12_var = ret_var.data[m];
2251                 int8_tArray ret_conv_12_arr = init_int8_tArray(ret_conv_12_var.datalen, __LINE__);
2252                 memcpy(ret_conv_12_arr->elems, ret_conv_12_var.data, ret_conv_12_var.datalen);
2253                 CVec_u8Z_free(ret_conv_12_var);
2254                 ret_arr_ptr[m] = ret_conv_12_arr;
2255         }
2256         
2257         FREE(ret_var.data);
2258         return ret_arr;
2259 }
2260
2261 static inline void CResult_CVec_CVec_u8ZZNoneZ_get_err(LDKCResult_CVec_CVec_u8ZZNoneZ *NONNULL_PTR owner){
2262 CHECK(!owner->result_ok);
2263         return *owner->contents.err;
2264 }
2265 void  __attribute__((export_name("TS_CResult_CVec_CVec_u8ZZNoneZ_get_err"))) TS_CResult_CVec_CVec_u8ZZNoneZ_get_err(uint64_t owner) {
2266         LDKCResult_CVec_CVec_u8ZZNoneZ* owner_conv = (LDKCResult_CVec_CVec_u8ZZNoneZ*)untag_ptr(owner);
2267         CResult_CVec_CVec_u8ZZNoneZ_get_err(owner_conv);
2268 }
2269
2270 static inline struct LDKInMemorySigner CResult_InMemorySignerDecodeErrorZ_get_ok(LDKCResult_InMemorySignerDecodeErrorZ *NONNULL_PTR owner){
2271         LDKInMemorySigner ret = *owner->contents.result;
2272         ret.is_owned = false;
2273         return ret;
2274 }
2275 uint64_t  __attribute__((export_name("TS_CResult_InMemorySignerDecodeErrorZ_get_ok"))) TS_CResult_InMemorySignerDecodeErrorZ_get_ok(uint64_t owner) {
2276         LDKCResult_InMemorySignerDecodeErrorZ* owner_conv = (LDKCResult_InMemorySignerDecodeErrorZ*)untag_ptr(owner);
2277         LDKInMemorySigner ret_var = CResult_InMemorySignerDecodeErrorZ_get_ok(owner_conv);
2278         uint64_t ret_ref = 0;
2279         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
2280         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
2281         return ret_ref;
2282 }
2283
2284 static inline struct LDKDecodeError CResult_InMemorySignerDecodeErrorZ_get_err(LDKCResult_InMemorySignerDecodeErrorZ *NONNULL_PTR owner){
2285 CHECK(!owner->result_ok);
2286         return DecodeError_clone(&*owner->contents.err);
2287 }
2288 uint64_t  __attribute__((export_name("TS_CResult_InMemorySignerDecodeErrorZ_get_err"))) TS_CResult_InMemorySignerDecodeErrorZ_get_err(uint64_t owner) {
2289         LDKCResult_InMemorySignerDecodeErrorZ* owner_conv = (LDKCResult_InMemorySignerDecodeErrorZ*)untag_ptr(owner);
2290         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
2291         *ret_copy = CResult_InMemorySignerDecodeErrorZ_get_err(owner_conv);
2292         uint64_t ret_ref = tag_ptr(ret_copy, true);
2293         return ret_ref;
2294 }
2295
2296 static inline struct LDKTransaction CResult_TransactionNoneZ_get_ok(LDKCResult_TransactionNoneZ *NONNULL_PTR owner){
2297 CHECK(owner->result_ok);
2298         return *owner->contents.result;
2299 }
2300 int8_tArray  __attribute__((export_name("TS_CResult_TransactionNoneZ_get_ok"))) TS_CResult_TransactionNoneZ_get_ok(uint64_t owner) {
2301         LDKCResult_TransactionNoneZ* owner_conv = (LDKCResult_TransactionNoneZ*)untag_ptr(owner);
2302         LDKTransaction ret_var = CResult_TransactionNoneZ_get_ok(owner_conv);
2303         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
2304         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
2305         return ret_arr;
2306 }
2307
2308 static inline void CResult_TransactionNoneZ_get_err(LDKCResult_TransactionNoneZ *NONNULL_PTR owner){
2309 CHECK(!owner->result_ok);
2310         return *owner->contents.err;
2311 }
2312 void  __attribute__((export_name("TS_CResult_TransactionNoneZ_get_err"))) TS_CResult_TransactionNoneZ_get_err(uint64_t owner) {
2313         LDKCResult_TransactionNoneZ* owner_conv = (LDKCResult_TransactionNoneZ*)untag_ptr(owner);
2314         CResult_TransactionNoneZ_get_err(owner_conv);
2315 }
2316
2317 static inline LDKCVec_ChannelDetailsZ CVec_ChannelDetailsZ_clone(const LDKCVec_ChannelDetailsZ *orig) {
2318         LDKCVec_ChannelDetailsZ ret = { .data = MALLOC(sizeof(LDKChannelDetails) * orig->datalen, "LDKCVec_ChannelDetailsZ clone bytes"), .datalen = orig->datalen };
2319         for (size_t i = 0; i < ret.datalen; i++) {
2320                 ret.data[i] = ChannelDetails_clone(&orig->data[i]);
2321         }
2322         return ret;
2323 }
2324 static inline struct LDKRoute CResult_RouteLightningErrorZ_get_ok(LDKCResult_RouteLightningErrorZ *NONNULL_PTR owner){
2325         LDKRoute ret = *owner->contents.result;
2326         ret.is_owned = false;
2327         return ret;
2328 }
2329 uint64_t  __attribute__((export_name("TS_CResult_RouteLightningErrorZ_get_ok"))) TS_CResult_RouteLightningErrorZ_get_ok(uint64_t owner) {
2330         LDKCResult_RouteLightningErrorZ* owner_conv = (LDKCResult_RouteLightningErrorZ*)untag_ptr(owner);
2331         LDKRoute ret_var = CResult_RouteLightningErrorZ_get_ok(owner_conv);
2332         uint64_t ret_ref = 0;
2333         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
2334         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
2335         return ret_ref;
2336 }
2337
2338 static inline struct LDKLightningError CResult_RouteLightningErrorZ_get_err(LDKCResult_RouteLightningErrorZ *NONNULL_PTR owner){
2339         LDKLightningError ret = *owner->contents.err;
2340         ret.is_owned = false;
2341         return ret;
2342 }
2343 uint64_t  __attribute__((export_name("TS_CResult_RouteLightningErrorZ_get_err"))) TS_CResult_RouteLightningErrorZ_get_err(uint64_t owner) {
2344         LDKCResult_RouteLightningErrorZ* owner_conv = (LDKCResult_RouteLightningErrorZ*)untag_ptr(owner);
2345         LDKLightningError ret_var = CResult_RouteLightningErrorZ_get_err(owner_conv);
2346         uint64_t ret_ref = 0;
2347         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
2348         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
2349         return ret_ref;
2350 }
2351
2352 static inline struct LDKInFlightHtlcs CResult_InFlightHtlcsDecodeErrorZ_get_ok(LDKCResult_InFlightHtlcsDecodeErrorZ *NONNULL_PTR owner){
2353         LDKInFlightHtlcs ret = *owner->contents.result;
2354         ret.is_owned = false;
2355         return ret;
2356 }
2357 uint64_t  __attribute__((export_name("TS_CResult_InFlightHtlcsDecodeErrorZ_get_ok"))) TS_CResult_InFlightHtlcsDecodeErrorZ_get_ok(uint64_t owner) {
2358         LDKCResult_InFlightHtlcsDecodeErrorZ* owner_conv = (LDKCResult_InFlightHtlcsDecodeErrorZ*)untag_ptr(owner);
2359         LDKInFlightHtlcs ret_var = CResult_InFlightHtlcsDecodeErrorZ_get_ok(owner_conv);
2360         uint64_t ret_ref = 0;
2361         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
2362         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
2363         return ret_ref;
2364 }
2365
2366 static inline struct LDKDecodeError CResult_InFlightHtlcsDecodeErrorZ_get_err(LDKCResult_InFlightHtlcsDecodeErrorZ *NONNULL_PTR owner){
2367 CHECK(!owner->result_ok);
2368         return DecodeError_clone(&*owner->contents.err);
2369 }
2370 uint64_t  __attribute__((export_name("TS_CResult_InFlightHtlcsDecodeErrorZ_get_err"))) TS_CResult_InFlightHtlcsDecodeErrorZ_get_err(uint64_t owner) {
2371         LDKCResult_InFlightHtlcsDecodeErrorZ* owner_conv = (LDKCResult_InFlightHtlcsDecodeErrorZ*)untag_ptr(owner);
2372         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
2373         *ret_copy = CResult_InFlightHtlcsDecodeErrorZ_get_err(owner_conv);
2374         uint64_t ret_ref = tag_ptr(ret_copy, true);
2375         return ret_ref;
2376 }
2377
2378 static inline struct LDKRouteHop CResult_RouteHopDecodeErrorZ_get_ok(LDKCResult_RouteHopDecodeErrorZ *NONNULL_PTR owner){
2379         LDKRouteHop ret = *owner->contents.result;
2380         ret.is_owned = false;
2381         return ret;
2382 }
2383 uint64_t  __attribute__((export_name("TS_CResult_RouteHopDecodeErrorZ_get_ok"))) TS_CResult_RouteHopDecodeErrorZ_get_ok(uint64_t owner) {
2384         LDKCResult_RouteHopDecodeErrorZ* owner_conv = (LDKCResult_RouteHopDecodeErrorZ*)untag_ptr(owner);
2385         LDKRouteHop ret_var = CResult_RouteHopDecodeErrorZ_get_ok(owner_conv);
2386         uint64_t ret_ref = 0;
2387         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
2388         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
2389         return ret_ref;
2390 }
2391
2392 static inline struct LDKDecodeError CResult_RouteHopDecodeErrorZ_get_err(LDKCResult_RouteHopDecodeErrorZ *NONNULL_PTR owner){
2393 CHECK(!owner->result_ok);
2394         return DecodeError_clone(&*owner->contents.err);
2395 }
2396 uint64_t  __attribute__((export_name("TS_CResult_RouteHopDecodeErrorZ_get_err"))) TS_CResult_RouteHopDecodeErrorZ_get_err(uint64_t owner) {
2397         LDKCResult_RouteHopDecodeErrorZ* owner_conv = (LDKCResult_RouteHopDecodeErrorZ*)untag_ptr(owner);
2398         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
2399         *ret_copy = CResult_RouteHopDecodeErrorZ_get_err(owner_conv);
2400         uint64_t ret_ref = tag_ptr(ret_copy, true);
2401         return ret_ref;
2402 }
2403
2404 static inline LDKCVec_BlindedHopZ CVec_BlindedHopZ_clone(const LDKCVec_BlindedHopZ *orig) {
2405         LDKCVec_BlindedHopZ ret = { .data = MALLOC(sizeof(LDKBlindedHop) * orig->datalen, "LDKCVec_BlindedHopZ clone bytes"), .datalen = orig->datalen };
2406         for (size_t i = 0; i < ret.datalen; i++) {
2407                 ret.data[i] = BlindedHop_clone(&orig->data[i]);
2408         }
2409         return ret;
2410 }
2411 static inline struct LDKBlindedTail CResult_BlindedTailDecodeErrorZ_get_ok(LDKCResult_BlindedTailDecodeErrorZ *NONNULL_PTR owner){
2412         LDKBlindedTail ret = *owner->contents.result;
2413         ret.is_owned = false;
2414         return ret;
2415 }
2416 uint64_t  __attribute__((export_name("TS_CResult_BlindedTailDecodeErrorZ_get_ok"))) TS_CResult_BlindedTailDecodeErrorZ_get_ok(uint64_t owner) {
2417         LDKCResult_BlindedTailDecodeErrorZ* owner_conv = (LDKCResult_BlindedTailDecodeErrorZ*)untag_ptr(owner);
2418         LDKBlindedTail ret_var = CResult_BlindedTailDecodeErrorZ_get_ok(owner_conv);
2419         uint64_t ret_ref = 0;
2420         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
2421         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
2422         return ret_ref;
2423 }
2424
2425 static inline struct LDKDecodeError CResult_BlindedTailDecodeErrorZ_get_err(LDKCResult_BlindedTailDecodeErrorZ *NONNULL_PTR owner){
2426 CHECK(!owner->result_ok);
2427         return DecodeError_clone(&*owner->contents.err);
2428 }
2429 uint64_t  __attribute__((export_name("TS_CResult_BlindedTailDecodeErrorZ_get_err"))) TS_CResult_BlindedTailDecodeErrorZ_get_err(uint64_t owner) {
2430         LDKCResult_BlindedTailDecodeErrorZ* owner_conv = (LDKCResult_BlindedTailDecodeErrorZ*)untag_ptr(owner);
2431         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
2432         *ret_copy = CResult_BlindedTailDecodeErrorZ_get_err(owner_conv);
2433         uint64_t ret_ref = tag_ptr(ret_copy, true);
2434         return ret_ref;
2435 }
2436
2437 static inline LDKCVec_RouteHopZ CVec_RouteHopZ_clone(const LDKCVec_RouteHopZ *orig) {
2438         LDKCVec_RouteHopZ ret = { .data = MALLOC(sizeof(LDKRouteHop) * orig->datalen, "LDKCVec_RouteHopZ clone bytes"), .datalen = orig->datalen };
2439         for (size_t i = 0; i < ret.datalen; i++) {
2440                 ret.data[i] = RouteHop_clone(&orig->data[i]);
2441         }
2442         return ret;
2443 }
2444 static inline LDKCVec_PathZ CVec_PathZ_clone(const LDKCVec_PathZ *orig) {
2445         LDKCVec_PathZ ret = { .data = MALLOC(sizeof(LDKPath) * orig->datalen, "LDKCVec_PathZ clone bytes"), .datalen = orig->datalen };
2446         for (size_t i = 0; i < ret.datalen; i++) {
2447                 ret.data[i] = Path_clone(&orig->data[i]);
2448         }
2449         return ret;
2450 }
2451 static inline struct LDKRoute CResult_RouteDecodeErrorZ_get_ok(LDKCResult_RouteDecodeErrorZ *NONNULL_PTR owner){
2452         LDKRoute ret = *owner->contents.result;
2453         ret.is_owned = false;
2454         return ret;
2455 }
2456 uint64_t  __attribute__((export_name("TS_CResult_RouteDecodeErrorZ_get_ok"))) TS_CResult_RouteDecodeErrorZ_get_ok(uint64_t owner) {
2457         LDKCResult_RouteDecodeErrorZ* owner_conv = (LDKCResult_RouteDecodeErrorZ*)untag_ptr(owner);
2458         LDKRoute ret_var = CResult_RouteDecodeErrorZ_get_ok(owner_conv);
2459         uint64_t ret_ref = 0;
2460         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
2461         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
2462         return ret_ref;
2463 }
2464
2465 static inline struct LDKDecodeError CResult_RouteDecodeErrorZ_get_err(LDKCResult_RouteDecodeErrorZ *NONNULL_PTR owner){
2466 CHECK(!owner->result_ok);
2467         return DecodeError_clone(&*owner->contents.err);
2468 }
2469 uint64_t  __attribute__((export_name("TS_CResult_RouteDecodeErrorZ_get_err"))) TS_CResult_RouteDecodeErrorZ_get_err(uint64_t owner) {
2470         LDKCResult_RouteDecodeErrorZ* owner_conv = (LDKCResult_RouteDecodeErrorZ*)untag_ptr(owner);
2471         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
2472         *ret_copy = CResult_RouteDecodeErrorZ_get_err(owner_conv);
2473         uint64_t ret_ref = tag_ptr(ret_copy, true);
2474         return ret_ref;
2475 }
2476
2477 static inline struct LDKRouteParameters CResult_RouteParametersDecodeErrorZ_get_ok(LDKCResult_RouteParametersDecodeErrorZ *NONNULL_PTR owner){
2478         LDKRouteParameters ret = *owner->contents.result;
2479         ret.is_owned = false;
2480         return ret;
2481 }
2482 uint64_t  __attribute__((export_name("TS_CResult_RouteParametersDecodeErrorZ_get_ok"))) TS_CResult_RouteParametersDecodeErrorZ_get_ok(uint64_t owner) {
2483         LDKCResult_RouteParametersDecodeErrorZ* owner_conv = (LDKCResult_RouteParametersDecodeErrorZ*)untag_ptr(owner);
2484         LDKRouteParameters ret_var = CResult_RouteParametersDecodeErrorZ_get_ok(owner_conv);
2485         uint64_t ret_ref = 0;
2486         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
2487         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
2488         return ret_ref;
2489 }
2490
2491 static inline struct LDKDecodeError CResult_RouteParametersDecodeErrorZ_get_err(LDKCResult_RouteParametersDecodeErrorZ *NONNULL_PTR owner){
2492 CHECK(!owner->result_ok);
2493         return DecodeError_clone(&*owner->contents.err);
2494 }
2495 uint64_t  __attribute__((export_name("TS_CResult_RouteParametersDecodeErrorZ_get_err"))) TS_CResult_RouteParametersDecodeErrorZ_get_err(uint64_t owner) {
2496         LDKCResult_RouteParametersDecodeErrorZ* owner_conv = (LDKCResult_RouteParametersDecodeErrorZ*)untag_ptr(owner);
2497         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
2498         *ret_copy = CResult_RouteParametersDecodeErrorZ_get_err(owner_conv);
2499         uint64_t ret_ref = tag_ptr(ret_copy, true);
2500         return ret_ref;
2501 }
2502
2503 static inline LDKCVec_u64Z CVec_u64Z_clone(const LDKCVec_u64Z *orig) {
2504         LDKCVec_u64Z ret = { .data = MALLOC(sizeof(int64_t) * orig->datalen, "LDKCVec_u64Z clone bytes"), .datalen = orig->datalen };
2505         memcpy(ret.data, orig->data, sizeof(int64_t) * ret.datalen);
2506         return ret;
2507 }
2508 static inline struct LDKPaymentParameters CResult_PaymentParametersDecodeErrorZ_get_ok(LDKCResult_PaymentParametersDecodeErrorZ *NONNULL_PTR owner){
2509         LDKPaymentParameters ret = *owner->contents.result;
2510         ret.is_owned = false;
2511         return ret;
2512 }
2513 uint64_t  __attribute__((export_name("TS_CResult_PaymentParametersDecodeErrorZ_get_ok"))) TS_CResult_PaymentParametersDecodeErrorZ_get_ok(uint64_t owner) {
2514         LDKCResult_PaymentParametersDecodeErrorZ* owner_conv = (LDKCResult_PaymentParametersDecodeErrorZ*)untag_ptr(owner);
2515         LDKPaymentParameters ret_var = CResult_PaymentParametersDecodeErrorZ_get_ok(owner_conv);
2516         uint64_t ret_ref = 0;
2517         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
2518         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
2519         return ret_ref;
2520 }
2521
2522 static inline struct LDKDecodeError CResult_PaymentParametersDecodeErrorZ_get_err(LDKCResult_PaymentParametersDecodeErrorZ *NONNULL_PTR owner){
2523 CHECK(!owner->result_ok);
2524         return DecodeError_clone(&*owner->contents.err);
2525 }
2526 uint64_t  __attribute__((export_name("TS_CResult_PaymentParametersDecodeErrorZ_get_err"))) TS_CResult_PaymentParametersDecodeErrorZ_get_err(uint64_t owner) {
2527         LDKCResult_PaymentParametersDecodeErrorZ* owner_conv = (LDKCResult_PaymentParametersDecodeErrorZ*)untag_ptr(owner);
2528         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
2529         *ret_copy = CResult_PaymentParametersDecodeErrorZ_get_err(owner_conv);
2530         uint64_t ret_ref = tag_ptr(ret_copy, true);
2531         return ret_ref;
2532 }
2533
2534 static inline struct LDKBlindedPayInfo C2Tuple_BlindedPayInfoBlindedPathZ_get_a(LDKC2Tuple_BlindedPayInfoBlindedPathZ *NONNULL_PTR owner){
2535         LDKBlindedPayInfo ret = owner->a;
2536         ret.is_owned = false;
2537         return ret;
2538 }
2539 uint64_t  __attribute__((export_name("TS_C2Tuple_BlindedPayInfoBlindedPathZ_get_a"))) TS_C2Tuple_BlindedPayInfoBlindedPathZ_get_a(uint64_t owner) {
2540         LDKC2Tuple_BlindedPayInfoBlindedPathZ* owner_conv = (LDKC2Tuple_BlindedPayInfoBlindedPathZ*)untag_ptr(owner);
2541         LDKBlindedPayInfo ret_var = C2Tuple_BlindedPayInfoBlindedPathZ_get_a(owner_conv);
2542         uint64_t ret_ref = 0;
2543         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
2544         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
2545         return ret_ref;
2546 }
2547
2548 static inline struct LDKBlindedPath C2Tuple_BlindedPayInfoBlindedPathZ_get_b(LDKC2Tuple_BlindedPayInfoBlindedPathZ *NONNULL_PTR owner){
2549         LDKBlindedPath ret = owner->b;
2550         ret.is_owned = false;
2551         return ret;
2552 }
2553 uint64_t  __attribute__((export_name("TS_C2Tuple_BlindedPayInfoBlindedPathZ_get_b"))) TS_C2Tuple_BlindedPayInfoBlindedPathZ_get_b(uint64_t owner) {
2554         LDKC2Tuple_BlindedPayInfoBlindedPathZ* owner_conv = (LDKC2Tuple_BlindedPayInfoBlindedPathZ*)untag_ptr(owner);
2555         LDKBlindedPath ret_var = C2Tuple_BlindedPayInfoBlindedPathZ_get_b(owner_conv);
2556         uint64_t ret_ref = 0;
2557         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
2558         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
2559         return ret_ref;
2560 }
2561
2562 static inline LDKCVec_C2Tuple_BlindedPayInfoBlindedPathZZ CVec_C2Tuple_BlindedPayInfoBlindedPathZZ_clone(const LDKCVec_C2Tuple_BlindedPayInfoBlindedPathZZ *orig) {
2563         LDKCVec_C2Tuple_BlindedPayInfoBlindedPathZZ ret = { .data = MALLOC(sizeof(LDKC2Tuple_BlindedPayInfoBlindedPathZ) * orig->datalen, "LDKCVec_C2Tuple_BlindedPayInfoBlindedPathZZ clone bytes"), .datalen = orig->datalen };
2564         for (size_t i = 0; i < ret.datalen; i++) {
2565                 ret.data[i] = C2Tuple_BlindedPayInfoBlindedPathZ_clone(&orig->data[i]);
2566         }
2567         return ret;
2568 }
2569 static inline LDKCVec_RouteHintZ CVec_RouteHintZ_clone(const LDKCVec_RouteHintZ *orig) {
2570         LDKCVec_RouteHintZ ret = { .data = MALLOC(sizeof(LDKRouteHint) * orig->datalen, "LDKCVec_RouteHintZ clone bytes"), .datalen = orig->datalen };
2571         for (size_t i = 0; i < ret.datalen; i++) {
2572                 ret.data[i] = RouteHint_clone(&orig->data[i]);
2573         }
2574         return ret;
2575 }
2576 static inline LDKCVec_RouteHintHopZ CVec_RouteHintHopZ_clone(const LDKCVec_RouteHintHopZ *orig) {
2577         LDKCVec_RouteHintHopZ ret = { .data = MALLOC(sizeof(LDKRouteHintHop) * orig->datalen, "LDKCVec_RouteHintHopZ clone bytes"), .datalen = orig->datalen };
2578         for (size_t i = 0; i < ret.datalen; i++) {
2579                 ret.data[i] = RouteHintHop_clone(&orig->data[i]);
2580         }
2581         return ret;
2582 }
2583 static inline struct LDKRouteHint CResult_RouteHintDecodeErrorZ_get_ok(LDKCResult_RouteHintDecodeErrorZ *NONNULL_PTR owner){
2584         LDKRouteHint ret = *owner->contents.result;
2585         ret.is_owned = false;
2586         return ret;
2587 }
2588 uint64_t  __attribute__((export_name("TS_CResult_RouteHintDecodeErrorZ_get_ok"))) TS_CResult_RouteHintDecodeErrorZ_get_ok(uint64_t owner) {
2589         LDKCResult_RouteHintDecodeErrorZ* owner_conv = (LDKCResult_RouteHintDecodeErrorZ*)untag_ptr(owner);
2590         LDKRouteHint ret_var = CResult_RouteHintDecodeErrorZ_get_ok(owner_conv);
2591         uint64_t ret_ref = 0;
2592         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
2593         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
2594         return ret_ref;
2595 }
2596
2597 static inline struct LDKDecodeError CResult_RouteHintDecodeErrorZ_get_err(LDKCResult_RouteHintDecodeErrorZ *NONNULL_PTR owner){
2598 CHECK(!owner->result_ok);
2599         return DecodeError_clone(&*owner->contents.err);
2600 }
2601 uint64_t  __attribute__((export_name("TS_CResult_RouteHintDecodeErrorZ_get_err"))) TS_CResult_RouteHintDecodeErrorZ_get_err(uint64_t owner) {
2602         LDKCResult_RouteHintDecodeErrorZ* owner_conv = (LDKCResult_RouteHintDecodeErrorZ*)untag_ptr(owner);
2603         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
2604         *ret_copy = CResult_RouteHintDecodeErrorZ_get_err(owner_conv);
2605         uint64_t ret_ref = tag_ptr(ret_copy, true);
2606         return ret_ref;
2607 }
2608
2609 static inline struct LDKRouteHintHop CResult_RouteHintHopDecodeErrorZ_get_ok(LDKCResult_RouteHintHopDecodeErrorZ *NONNULL_PTR owner){
2610         LDKRouteHintHop ret = *owner->contents.result;
2611         ret.is_owned = false;
2612         return ret;
2613 }
2614 uint64_t  __attribute__((export_name("TS_CResult_RouteHintHopDecodeErrorZ_get_ok"))) TS_CResult_RouteHintHopDecodeErrorZ_get_ok(uint64_t owner) {
2615         LDKCResult_RouteHintHopDecodeErrorZ* owner_conv = (LDKCResult_RouteHintHopDecodeErrorZ*)untag_ptr(owner);
2616         LDKRouteHintHop ret_var = CResult_RouteHintHopDecodeErrorZ_get_ok(owner_conv);
2617         uint64_t ret_ref = 0;
2618         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
2619         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
2620         return ret_ref;
2621 }
2622
2623 static inline struct LDKDecodeError CResult_RouteHintHopDecodeErrorZ_get_err(LDKCResult_RouteHintHopDecodeErrorZ *NONNULL_PTR owner){
2624 CHECK(!owner->result_ok);
2625         return DecodeError_clone(&*owner->contents.err);
2626 }
2627 uint64_t  __attribute__((export_name("TS_CResult_RouteHintHopDecodeErrorZ_get_err"))) TS_CResult_RouteHintHopDecodeErrorZ_get_err(uint64_t owner) {
2628         LDKCResult_RouteHintHopDecodeErrorZ* owner_conv = (LDKCResult_RouteHintHopDecodeErrorZ*)untag_ptr(owner);
2629         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
2630         *ret_copy = CResult_RouteHintHopDecodeErrorZ_get_err(owner_conv);
2631         uint64_t ret_ref = tag_ptr(ret_copy, true);
2632         return ret_ref;
2633 }
2634
2635 static inline struct LDKFixedPenaltyScorer CResult_FixedPenaltyScorerDecodeErrorZ_get_ok(LDKCResult_FixedPenaltyScorerDecodeErrorZ *NONNULL_PTR owner){
2636         LDKFixedPenaltyScorer ret = *owner->contents.result;
2637         ret.is_owned = false;
2638         return ret;
2639 }
2640 uint64_t  __attribute__((export_name("TS_CResult_FixedPenaltyScorerDecodeErrorZ_get_ok"))) TS_CResult_FixedPenaltyScorerDecodeErrorZ_get_ok(uint64_t owner) {
2641         LDKCResult_FixedPenaltyScorerDecodeErrorZ* owner_conv = (LDKCResult_FixedPenaltyScorerDecodeErrorZ*)untag_ptr(owner);
2642         LDKFixedPenaltyScorer ret_var = CResult_FixedPenaltyScorerDecodeErrorZ_get_ok(owner_conv);
2643         uint64_t ret_ref = 0;
2644         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
2645         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
2646         return ret_ref;
2647 }
2648
2649 static inline struct LDKDecodeError CResult_FixedPenaltyScorerDecodeErrorZ_get_err(LDKCResult_FixedPenaltyScorerDecodeErrorZ *NONNULL_PTR owner){
2650 CHECK(!owner->result_ok);
2651         return DecodeError_clone(&*owner->contents.err);
2652 }
2653 uint64_t  __attribute__((export_name("TS_CResult_FixedPenaltyScorerDecodeErrorZ_get_err"))) TS_CResult_FixedPenaltyScorerDecodeErrorZ_get_err(uint64_t owner) {
2654         LDKCResult_FixedPenaltyScorerDecodeErrorZ* owner_conv = (LDKCResult_FixedPenaltyScorerDecodeErrorZ*)untag_ptr(owner);
2655         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
2656         *ret_copy = CResult_FixedPenaltyScorerDecodeErrorZ_get_err(owner_conv);
2657         uint64_t ret_ref = tag_ptr(ret_copy, true);
2658         return ret_ref;
2659 }
2660
2661 static inline LDKCVec_NodeIdZ CVec_NodeIdZ_clone(const LDKCVec_NodeIdZ *orig) {
2662         LDKCVec_NodeIdZ ret = { .data = MALLOC(sizeof(LDKNodeId) * orig->datalen, "LDKCVec_NodeIdZ clone bytes"), .datalen = orig->datalen };
2663         for (size_t i = 0; i < ret.datalen; i++) {
2664                 ret.data[i] = NodeId_clone(&orig->data[i]);
2665         }
2666         return ret;
2667 }
2668 static inline uint64_t C2Tuple_u64u64Z_get_a(LDKC2Tuple_u64u64Z *NONNULL_PTR owner){
2669         return owner->a;
2670 }
2671 int64_t  __attribute__((export_name("TS_C2Tuple_u64u64Z_get_a"))) TS_C2Tuple_u64u64Z_get_a(uint64_t owner) {
2672         LDKC2Tuple_u64u64Z* owner_conv = (LDKC2Tuple_u64u64Z*)untag_ptr(owner);
2673         int64_t ret_conv = C2Tuple_u64u64Z_get_a(owner_conv);
2674         return ret_conv;
2675 }
2676
2677 static inline uint64_t C2Tuple_u64u64Z_get_b(LDKC2Tuple_u64u64Z *NONNULL_PTR owner){
2678         return owner->b;
2679 }
2680 int64_t  __attribute__((export_name("TS_C2Tuple_u64u64Z_get_b"))) TS_C2Tuple_u64u64Z_get_b(uint64_t owner) {
2681         LDKC2Tuple_u64u64Z* owner_conv = (LDKC2Tuple_u64u64Z*)untag_ptr(owner);
2682         int64_t ret_conv = C2Tuple_u64u64Z_get_b(owner_conv);
2683         return ret_conv;
2684 }
2685
2686 uint32_t __attribute__((export_name("TS_LDKCOption_C2Tuple_u64u64ZZ_ty_from_ptr"))) TS_LDKCOption_C2Tuple_u64u64ZZ_ty_from_ptr(uint64_t ptr) {
2687         LDKCOption_C2Tuple_u64u64ZZ *obj = (LDKCOption_C2Tuple_u64u64ZZ*)untag_ptr(ptr);
2688         switch(obj->tag) {
2689                 case LDKCOption_C2Tuple_u64u64ZZ_Some: return 0;
2690                 case LDKCOption_C2Tuple_u64u64ZZ_None: return 1;
2691                 default: abort();
2692         }
2693 }
2694 uint64_t __attribute__((export_name("TS_LDKCOption_C2Tuple_u64u64ZZ_Some_get_some"))) TS_LDKCOption_C2Tuple_u64u64ZZ_Some_get_some(uint64_t ptr) {
2695         LDKCOption_C2Tuple_u64u64ZZ *obj = (LDKCOption_C2Tuple_u64u64ZZ*)untag_ptr(ptr);
2696         assert(obj->tag == LDKCOption_C2Tuple_u64u64ZZ_Some);
2697         LDKC2Tuple_u64u64Z* some_conv = MALLOC(sizeof(LDKC2Tuple_u64u64Z), "LDKC2Tuple_u64u64Z");
2698         *some_conv = obj->some;
2699                         *some_conv = C2Tuple_u64u64Z_clone(some_conv);
2700         return tag_ptr(some_conv, true);
2701 }
2702 static inline struct LDKThirtyTwoU16s C2Tuple_Z_get_a(LDKC2Tuple_Z *NONNULL_PTR owner){
2703         return owner->a;
2704 }
2705 int16_tArray  __attribute__((export_name("TS_C2Tuple_Z_get_a"))) TS_C2Tuple_Z_get_a(uint64_t owner) {
2706         LDKC2Tuple_Z* owner_conv = (LDKC2Tuple_Z*)untag_ptr(owner);
2707         int16_tArray ret_arr = init_int16_tArray(32, __LINE__);
2708         memcpy(ret_arr->elems, C2Tuple_Z_get_a(owner_conv).data, 32 * 2);
2709         return ret_arr;
2710 }
2711
2712 static inline struct LDKThirtyTwoU16s C2Tuple_Z_get_b(LDKC2Tuple_Z *NONNULL_PTR owner){
2713         return owner->b;
2714 }
2715 int16_tArray  __attribute__((export_name("TS_C2Tuple_Z_get_b"))) TS_C2Tuple_Z_get_b(uint64_t owner) {
2716         LDKC2Tuple_Z* owner_conv = (LDKC2Tuple_Z*)untag_ptr(owner);
2717         int16_tArray ret_arr = init_int16_tArray(32, __LINE__);
2718         memcpy(ret_arr->elems, C2Tuple_Z_get_b(owner_conv).data, 32 * 2);
2719         return ret_arr;
2720 }
2721
2722 static inline struct LDKThirtyTwoU16s C2Tuple__u1632_u1632Z_get_a(LDKC2Tuple__u1632_u1632Z *NONNULL_PTR owner){
2723         return owner->a;
2724 }
2725 int16_tArray  __attribute__((export_name("TS_C2Tuple__u1632_u1632Z_get_a"))) TS_C2Tuple__u1632_u1632Z_get_a(uint64_t owner) {
2726         LDKC2Tuple__u1632_u1632Z* owner_conv = (LDKC2Tuple__u1632_u1632Z*)untag_ptr(owner);
2727         int16_tArray ret_arr = init_int16_tArray(32, __LINE__);
2728         memcpy(ret_arr->elems, C2Tuple__u1632_u1632Z_get_a(owner_conv).data, 32 * 2);
2729         return ret_arr;
2730 }
2731
2732 static inline struct LDKThirtyTwoU16s C2Tuple__u1632_u1632Z_get_b(LDKC2Tuple__u1632_u1632Z *NONNULL_PTR owner){
2733         return owner->b;
2734 }
2735 int16_tArray  __attribute__((export_name("TS_C2Tuple__u1632_u1632Z_get_b"))) TS_C2Tuple__u1632_u1632Z_get_b(uint64_t owner) {
2736         LDKC2Tuple__u1632_u1632Z* owner_conv = (LDKC2Tuple__u1632_u1632Z*)untag_ptr(owner);
2737         int16_tArray ret_arr = init_int16_tArray(32, __LINE__);
2738         memcpy(ret_arr->elems, C2Tuple__u1632_u1632Z_get_b(owner_conv).data, 32 * 2);
2739         return ret_arr;
2740 }
2741
2742 uint32_t __attribute__((export_name("TS_LDKCOption_C2Tuple_ThirtyTwoU16sThirtyTwoU16sZZ_ty_from_ptr"))) TS_LDKCOption_C2Tuple_ThirtyTwoU16sThirtyTwoU16sZZ_ty_from_ptr(uint64_t ptr) {
2743         LDKCOption_C2Tuple_ThirtyTwoU16sThirtyTwoU16sZZ *obj = (LDKCOption_C2Tuple_ThirtyTwoU16sThirtyTwoU16sZZ*)untag_ptr(ptr);
2744         switch(obj->tag) {
2745                 case LDKCOption_C2Tuple_ThirtyTwoU16sThirtyTwoU16sZZ_Some: return 0;
2746                 case LDKCOption_C2Tuple_ThirtyTwoU16sThirtyTwoU16sZZ_None: return 1;
2747                 default: abort();
2748         }
2749 }
2750 uint64_t __attribute__((export_name("TS_LDKCOption_C2Tuple_ThirtyTwoU16sThirtyTwoU16sZZ_Some_get_some"))) TS_LDKCOption_C2Tuple_ThirtyTwoU16sThirtyTwoU16sZZ_Some_get_some(uint64_t ptr) {
2751         LDKCOption_C2Tuple_ThirtyTwoU16sThirtyTwoU16sZZ *obj = (LDKCOption_C2Tuple_ThirtyTwoU16sThirtyTwoU16sZZ*)untag_ptr(ptr);
2752         assert(obj->tag == LDKCOption_C2Tuple_ThirtyTwoU16sThirtyTwoU16sZZ_Some);
2753         LDKC2Tuple__u1632_u1632Z* some_conv = &obj->some;
2754                         // WARNING: we really need to clone here, but no clone is available for LDKC2Tuple__u1632_u1632Z
2755         return tag_ptr(some_conv, false);
2756 }
2757 uint32_t __attribute__((export_name("TS_LDKCOption_f64Z_ty_from_ptr"))) TS_LDKCOption_f64Z_ty_from_ptr(uint64_t ptr) {
2758         LDKCOption_f64Z *obj = (LDKCOption_f64Z*)untag_ptr(ptr);
2759         switch(obj->tag) {
2760                 case LDKCOption_f64Z_Some: return 0;
2761                 case LDKCOption_f64Z_None: return 1;
2762                 default: abort();
2763         }
2764 }
2765 double __attribute__((export_name("TS_LDKCOption_f64Z_Some_get_some"))) TS_LDKCOption_f64Z_Some_get_some(uint64_t ptr) {
2766         LDKCOption_f64Z *obj = (LDKCOption_f64Z*)untag_ptr(ptr);
2767         assert(obj->tag == LDKCOption_f64Z_Some);
2768         double some_conv = obj->some;
2769         return some_conv;
2770 }
2771 typedef struct LDKLogger_JCalls {
2772         atomic_size_t refcnt;
2773         uint32_t instance_ptr;
2774 } LDKLogger_JCalls;
2775 static void LDKLogger_JCalls_free(void* this_arg) {
2776         LDKLogger_JCalls *j_calls = (LDKLogger_JCalls*) this_arg;
2777         if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
2778                 FREE(j_calls);
2779         }
2780 }
2781 void log_LDKLogger_jcall(const void* this_arg, const LDKRecord * record) {
2782         LDKLogger_JCalls *j_calls = (LDKLogger_JCalls*) this_arg;
2783         LDKRecord record_var = *record;
2784         uint64_t record_ref = 0;
2785         record_var = Record_clone(&record_var);
2786         CHECK_INNER_FIELD_ACCESS_OR_NULL(record_var);
2787         record_ref = tag_ptr(record_var.inner, record_var.is_owned);
2788         js_invoke_function_buuuuu(j_calls->instance_ptr, 16, record_ref, 0, 0, 0, 0, 0);
2789 }
2790 static void LDKLogger_JCalls_cloned(LDKLogger* new_obj) {
2791         LDKLogger_JCalls *j_calls = (LDKLogger_JCalls*) new_obj->this_arg;
2792         atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
2793 }
2794 static inline LDKLogger LDKLogger_init (JSValue o) {
2795         LDKLogger_JCalls *calls = MALLOC(sizeof(LDKLogger_JCalls), "LDKLogger_JCalls");
2796         atomic_init(&calls->refcnt, 1);
2797         calls->instance_ptr = o;
2798
2799         LDKLogger ret = {
2800                 .this_arg = (void*) calls,
2801                 .log = log_LDKLogger_jcall,
2802                 .free = LDKLogger_JCalls_free,
2803         };
2804         return ret;
2805 }
2806 uint64_t  __attribute__((export_name("TS_LDKLogger_new"))) TS_LDKLogger_new(JSValue o) {
2807         LDKLogger *res_ptr = MALLOC(sizeof(LDKLogger), "LDKLogger");
2808         *res_ptr = LDKLogger_init(o);
2809         return tag_ptr(res_ptr, true);
2810 }
2811 static inline struct LDKProbabilisticScorer CResult_ProbabilisticScorerDecodeErrorZ_get_ok(LDKCResult_ProbabilisticScorerDecodeErrorZ *NONNULL_PTR owner){
2812         LDKProbabilisticScorer ret = *owner->contents.result;
2813         ret.is_owned = false;
2814         return ret;
2815 }
2816 uint64_t  __attribute__((export_name("TS_CResult_ProbabilisticScorerDecodeErrorZ_get_ok"))) TS_CResult_ProbabilisticScorerDecodeErrorZ_get_ok(uint64_t owner) {
2817         LDKCResult_ProbabilisticScorerDecodeErrorZ* owner_conv = (LDKCResult_ProbabilisticScorerDecodeErrorZ*)untag_ptr(owner);
2818         LDKProbabilisticScorer ret_var = CResult_ProbabilisticScorerDecodeErrorZ_get_ok(owner_conv);
2819         uint64_t ret_ref = 0;
2820         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
2821         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
2822         return ret_ref;
2823 }
2824
2825 static inline struct LDKDecodeError CResult_ProbabilisticScorerDecodeErrorZ_get_err(LDKCResult_ProbabilisticScorerDecodeErrorZ *NONNULL_PTR owner){
2826 CHECK(!owner->result_ok);
2827         return DecodeError_clone(&*owner->contents.err);
2828 }
2829 uint64_t  __attribute__((export_name("TS_CResult_ProbabilisticScorerDecodeErrorZ_get_err"))) TS_CResult_ProbabilisticScorerDecodeErrorZ_get_err(uint64_t owner) {
2830         LDKCResult_ProbabilisticScorerDecodeErrorZ* owner_conv = (LDKCResult_ProbabilisticScorerDecodeErrorZ*)untag_ptr(owner);
2831         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
2832         *ret_copy = CResult_ProbabilisticScorerDecodeErrorZ_get_err(owner_conv);
2833         uint64_t ret_ref = tag_ptr(ret_copy, true);
2834         return ret_ref;
2835 }
2836
2837 static inline uintptr_t C2Tuple_usizeTransactionZ_get_a(LDKC2Tuple_usizeTransactionZ *NONNULL_PTR owner){
2838         return owner->a;
2839 }
2840 uint32_t  __attribute__((export_name("TS_C2Tuple_usizeTransactionZ_get_a"))) TS_C2Tuple_usizeTransactionZ_get_a(uint64_t owner) {
2841         LDKC2Tuple_usizeTransactionZ* owner_conv = (LDKC2Tuple_usizeTransactionZ*)untag_ptr(owner);
2842         uint32_t ret_conv = C2Tuple_usizeTransactionZ_get_a(owner_conv);
2843         return ret_conv;
2844 }
2845
2846 static inline struct LDKTransaction C2Tuple_usizeTransactionZ_get_b(LDKC2Tuple_usizeTransactionZ *NONNULL_PTR owner){
2847         return owner->b;
2848 }
2849 int8_tArray  __attribute__((export_name("TS_C2Tuple_usizeTransactionZ_get_b"))) TS_C2Tuple_usizeTransactionZ_get_b(uint64_t owner) {
2850         LDKC2Tuple_usizeTransactionZ* owner_conv = (LDKC2Tuple_usizeTransactionZ*)untag_ptr(owner);
2851         LDKTransaction ret_var = C2Tuple_usizeTransactionZ_get_b(owner_conv);
2852         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
2853         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
2854         return ret_arr;
2855 }
2856
2857 static inline LDKCVec_C2Tuple_usizeTransactionZZ CVec_C2Tuple_usizeTransactionZZ_clone(const LDKCVec_C2Tuple_usizeTransactionZZ *orig) {
2858         LDKCVec_C2Tuple_usizeTransactionZZ ret = { .data = MALLOC(sizeof(LDKC2Tuple_usizeTransactionZ) * orig->datalen, "LDKCVec_C2Tuple_usizeTransactionZZ clone bytes"), .datalen = orig->datalen };
2859         for (size_t i = 0; i < ret.datalen; i++) {
2860                 ret.data[i] = C2Tuple_usizeTransactionZ_clone(&orig->data[i]);
2861         }
2862         return ret;
2863 }
2864 static inline struct LDKThirtyTwoBytes C2Tuple_ThirtyTwoBytesCOption_ThirtyTwoBytesZZ_get_a(LDKC2Tuple_ThirtyTwoBytesCOption_ThirtyTwoBytesZZ *NONNULL_PTR owner){
2865         return ThirtyTwoBytes_clone(&owner->a);
2866 }
2867 int8_tArray  __attribute__((export_name("TS_C2Tuple_ThirtyTwoBytesCOption_ThirtyTwoBytesZZ_get_a"))) TS_C2Tuple_ThirtyTwoBytesCOption_ThirtyTwoBytesZZ_get_a(uint64_t owner) {
2868         LDKC2Tuple_ThirtyTwoBytesCOption_ThirtyTwoBytesZZ* owner_conv = (LDKC2Tuple_ThirtyTwoBytesCOption_ThirtyTwoBytesZZ*)untag_ptr(owner);
2869         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
2870         memcpy(ret_arr->elems, C2Tuple_ThirtyTwoBytesCOption_ThirtyTwoBytesZZ_get_a(owner_conv).data, 32);
2871         return ret_arr;
2872 }
2873
2874 static inline struct LDKCOption_ThirtyTwoBytesZ C2Tuple_ThirtyTwoBytesCOption_ThirtyTwoBytesZZ_get_b(LDKC2Tuple_ThirtyTwoBytesCOption_ThirtyTwoBytesZZ *NONNULL_PTR owner){
2875         return COption_ThirtyTwoBytesZ_clone(&owner->b);
2876 }
2877 uint64_t  __attribute__((export_name("TS_C2Tuple_ThirtyTwoBytesCOption_ThirtyTwoBytesZZ_get_b"))) TS_C2Tuple_ThirtyTwoBytesCOption_ThirtyTwoBytesZZ_get_b(uint64_t owner) {
2878         LDKC2Tuple_ThirtyTwoBytesCOption_ThirtyTwoBytesZZ* owner_conv = (LDKC2Tuple_ThirtyTwoBytesCOption_ThirtyTwoBytesZZ*)untag_ptr(owner);
2879         LDKCOption_ThirtyTwoBytesZ *ret_copy = MALLOC(sizeof(LDKCOption_ThirtyTwoBytesZ), "LDKCOption_ThirtyTwoBytesZ");
2880         *ret_copy = C2Tuple_ThirtyTwoBytesCOption_ThirtyTwoBytesZZ_get_b(owner_conv);
2881         uint64_t ret_ref = tag_ptr(ret_copy, true);
2882         return ret_ref;
2883 }
2884
2885 static inline LDKCVec_C2Tuple_ThirtyTwoBytesCOption_ThirtyTwoBytesZZZ CVec_C2Tuple_ThirtyTwoBytesCOption_ThirtyTwoBytesZZZ_clone(const LDKCVec_C2Tuple_ThirtyTwoBytesCOption_ThirtyTwoBytesZZZ *orig) {
2886         LDKCVec_C2Tuple_ThirtyTwoBytesCOption_ThirtyTwoBytesZZZ ret = { .data = MALLOC(sizeof(LDKC2Tuple_ThirtyTwoBytesCOption_ThirtyTwoBytesZZ) * orig->datalen, "LDKCVec_C2Tuple_ThirtyTwoBytesCOption_ThirtyTwoBytesZZZ clone bytes"), .datalen = orig->datalen };
2887         for (size_t i = 0; i < ret.datalen; i++) {
2888                 ret.data[i] = C2Tuple_ThirtyTwoBytesCOption_ThirtyTwoBytesZZ_clone(&orig->data[i]);
2889         }
2890         return ret;
2891 }
2892 static inline enum LDKChannelMonitorUpdateStatus CResult_ChannelMonitorUpdateStatusNoneZ_get_ok(LDKCResult_ChannelMonitorUpdateStatusNoneZ *NONNULL_PTR owner){
2893 CHECK(owner->result_ok);
2894         return ChannelMonitorUpdateStatus_clone(&*owner->contents.result);
2895 }
2896 uint32_t  __attribute__((export_name("TS_CResult_ChannelMonitorUpdateStatusNoneZ_get_ok"))) TS_CResult_ChannelMonitorUpdateStatusNoneZ_get_ok(uint64_t owner) {
2897         LDKCResult_ChannelMonitorUpdateStatusNoneZ* owner_conv = (LDKCResult_ChannelMonitorUpdateStatusNoneZ*)untag_ptr(owner);
2898         uint32_t ret_conv = LDKChannelMonitorUpdateStatus_to_js(CResult_ChannelMonitorUpdateStatusNoneZ_get_ok(owner_conv));
2899         return ret_conv;
2900 }
2901
2902 static inline void CResult_ChannelMonitorUpdateStatusNoneZ_get_err(LDKCResult_ChannelMonitorUpdateStatusNoneZ *NONNULL_PTR owner){
2903 CHECK(!owner->result_ok);
2904         return *owner->contents.err;
2905 }
2906 void  __attribute__((export_name("TS_CResult_ChannelMonitorUpdateStatusNoneZ_get_err"))) TS_CResult_ChannelMonitorUpdateStatusNoneZ_get_err(uint64_t owner) {
2907         LDKCResult_ChannelMonitorUpdateStatusNoneZ* owner_conv = (LDKCResult_ChannelMonitorUpdateStatusNoneZ*)untag_ptr(owner);
2908         CResult_ChannelMonitorUpdateStatusNoneZ_get_err(owner_conv);
2909 }
2910
2911 uint32_t __attribute__((export_name("TS_LDKMonitorEvent_ty_from_ptr"))) TS_LDKMonitorEvent_ty_from_ptr(uint64_t ptr) {
2912         LDKMonitorEvent *obj = (LDKMonitorEvent*)untag_ptr(ptr);
2913         switch(obj->tag) {
2914                 case LDKMonitorEvent_HTLCEvent: return 0;
2915                 case LDKMonitorEvent_HolderForceClosed: return 1;
2916                 case LDKMonitorEvent_Completed: return 2;
2917                 default: abort();
2918         }
2919 }
2920 uint64_t __attribute__((export_name("TS_LDKMonitorEvent_HTLCEvent_get_htlc_event"))) TS_LDKMonitorEvent_HTLCEvent_get_htlc_event(uint64_t ptr) {
2921         LDKMonitorEvent *obj = (LDKMonitorEvent*)untag_ptr(ptr);
2922         assert(obj->tag == LDKMonitorEvent_HTLCEvent);
2923         LDKHTLCUpdate htlc_event_var = obj->htlc_event;
2924                         uint64_t htlc_event_ref = 0;
2925                         CHECK_INNER_FIELD_ACCESS_OR_NULL(htlc_event_var);
2926                         htlc_event_ref = tag_ptr(htlc_event_var.inner, false);
2927         return htlc_event_ref;
2928 }
2929 uint64_t __attribute__((export_name("TS_LDKMonitorEvent_HolderForceClosed_get_holder_force_closed"))) TS_LDKMonitorEvent_HolderForceClosed_get_holder_force_closed(uint64_t ptr) {
2930         LDKMonitorEvent *obj = (LDKMonitorEvent*)untag_ptr(ptr);
2931         assert(obj->tag == LDKMonitorEvent_HolderForceClosed);
2932         LDKOutPoint holder_force_closed_var = obj->holder_force_closed;
2933                         uint64_t holder_force_closed_ref = 0;
2934                         CHECK_INNER_FIELD_ACCESS_OR_NULL(holder_force_closed_var);
2935                         holder_force_closed_ref = tag_ptr(holder_force_closed_var.inner, false);
2936         return holder_force_closed_ref;
2937 }
2938 uint64_t __attribute__((export_name("TS_LDKMonitorEvent_Completed_get_funding_txo"))) TS_LDKMonitorEvent_Completed_get_funding_txo(uint64_t ptr) {
2939         LDKMonitorEvent *obj = (LDKMonitorEvent*)untag_ptr(ptr);
2940         assert(obj->tag == LDKMonitorEvent_Completed);
2941         LDKOutPoint funding_txo_var = obj->completed.funding_txo;
2942                         uint64_t funding_txo_ref = 0;
2943                         CHECK_INNER_FIELD_ACCESS_OR_NULL(funding_txo_var);
2944                         funding_txo_ref = tag_ptr(funding_txo_var.inner, false);
2945         return funding_txo_ref;
2946 }
2947 int64_t __attribute__((export_name("TS_LDKMonitorEvent_Completed_get_monitor_update_id"))) TS_LDKMonitorEvent_Completed_get_monitor_update_id(uint64_t ptr) {
2948         LDKMonitorEvent *obj = (LDKMonitorEvent*)untag_ptr(ptr);
2949         assert(obj->tag == LDKMonitorEvent_Completed);
2950         int64_t monitor_update_id_conv = obj->completed.monitor_update_id;
2951         return monitor_update_id_conv;
2952 }
2953 static inline LDKCVec_MonitorEventZ CVec_MonitorEventZ_clone(const LDKCVec_MonitorEventZ *orig) {
2954         LDKCVec_MonitorEventZ ret = { .data = MALLOC(sizeof(LDKMonitorEvent) * orig->datalen, "LDKCVec_MonitorEventZ clone bytes"), .datalen = orig->datalen };
2955         for (size_t i = 0; i < ret.datalen; i++) {
2956                 ret.data[i] = MonitorEvent_clone(&orig->data[i]);
2957         }
2958         return ret;
2959 }
2960 static inline struct LDKOutPoint C3Tuple_OutPointCVec_MonitorEventZPublicKeyZ_get_a(LDKC3Tuple_OutPointCVec_MonitorEventZPublicKeyZ *NONNULL_PTR owner){
2961         LDKOutPoint ret = owner->a;
2962         ret.is_owned = false;
2963         return ret;
2964 }
2965 uint64_t  __attribute__((export_name("TS_C3Tuple_OutPointCVec_MonitorEventZPublicKeyZ_get_a"))) TS_C3Tuple_OutPointCVec_MonitorEventZPublicKeyZ_get_a(uint64_t owner) {
2966         LDKC3Tuple_OutPointCVec_MonitorEventZPublicKeyZ* owner_conv = (LDKC3Tuple_OutPointCVec_MonitorEventZPublicKeyZ*)untag_ptr(owner);
2967         LDKOutPoint ret_var = C3Tuple_OutPointCVec_MonitorEventZPublicKeyZ_get_a(owner_conv);
2968         uint64_t ret_ref = 0;
2969         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
2970         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
2971         return ret_ref;
2972 }
2973
2974 static inline struct LDKCVec_MonitorEventZ C3Tuple_OutPointCVec_MonitorEventZPublicKeyZ_get_b(LDKC3Tuple_OutPointCVec_MonitorEventZPublicKeyZ *NONNULL_PTR owner){
2975         return CVec_MonitorEventZ_clone(&owner->b);
2976 }
2977 uint64_tArray  __attribute__((export_name("TS_C3Tuple_OutPointCVec_MonitorEventZPublicKeyZ_get_b"))) TS_C3Tuple_OutPointCVec_MonitorEventZPublicKeyZ_get_b(uint64_t owner) {
2978         LDKC3Tuple_OutPointCVec_MonitorEventZPublicKeyZ* owner_conv = (LDKC3Tuple_OutPointCVec_MonitorEventZPublicKeyZ*)untag_ptr(owner);
2979         LDKCVec_MonitorEventZ ret_var = C3Tuple_OutPointCVec_MonitorEventZPublicKeyZ_get_b(owner_conv);
2980         uint64_tArray ret_arr = NULL;
2981         ret_arr = init_uint64_tArray(ret_var.datalen, __LINE__);
2982         uint64_t *ret_arr_ptr = (uint64_t*)(((uint8_t*)ret_arr) + 8);
2983         for (size_t o = 0; o < ret_var.datalen; o++) {
2984                 LDKMonitorEvent *ret_conv_14_copy = MALLOC(sizeof(LDKMonitorEvent), "LDKMonitorEvent");
2985                 *ret_conv_14_copy = ret_var.data[o];
2986                 uint64_t ret_conv_14_ref = tag_ptr(ret_conv_14_copy, true);
2987                 ret_arr_ptr[o] = ret_conv_14_ref;
2988         }
2989         
2990         FREE(ret_var.data);
2991         return ret_arr;
2992 }
2993
2994 static inline struct LDKPublicKey C3Tuple_OutPointCVec_MonitorEventZPublicKeyZ_get_c(LDKC3Tuple_OutPointCVec_MonitorEventZPublicKeyZ *NONNULL_PTR owner){
2995         return owner->c;
2996 }
2997 int8_tArray  __attribute__((export_name("TS_C3Tuple_OutPointCVec_MonitorEventZPublicKeyZ_get_c"))) TS_C3Tuple_OutPointCVec_MonitorEventZPublicKeyZ_get_c(uint64_t owner) {
2998         LDKC3Tuple_OutPointCVec_MonitorEventZPublicKeyZ* owner_conv = (LDKC3Tuple_OutPointCVec_MonitorEventZPublicKeyZ*)untag_ptr(owner);
2999         int8_tArray ret_arr = init_int8_tArray(33, __LINE__);
3000         memcpy(ret_arr->elems, C3Tuple_OutPointCVec_MonitorEventZPublicKeyZ_get_c(owner_conv).compressed_form, 33);
3001         return ret_arr;
3002 }
3003
3004 static inline LDKCVec_C3Tuple_OutPointCVec_MonitorEventZPublicKeyZZ CVec_C3Tuple_OutPointCVec_MonitorEventZPublicKeyZZ_clone(const LDKCVec_C3Tuple_OutPointCVec_MonitorEventZPublicKeyZZ *orig) {
3005         LDKCVec_C3Tuple_OutPointCVec_MonitorEventZPublicKeyZZ ret = { .data = MALLOC(sizeof(LDKC3Tuple_OutPointCVec_MonitorEventZPublicKeyZ) * orig->datalen, "LDKCVec_C3Tuple_OutPointCVec_MonitorEventZPublicKeyZZ clone bytes"), .datalen = orig->datalen };
3006         for (size_t i = 0; i < ret.datalen; i++) {
3007                 ret.data[i] = C3Tuple_OutPointCVec_MonitorEventZPublicKeyZ_clone(&orig->data[i]);
3008         }
3009         return ret;
3010 }
3011 static inline struct LDKInitFeatures CResult_InitFeaturesDecodeErrorZ_get_ok(LDKCResult_InitFeaturesDecodeErrorZ *NONNULL_PTR owner){
3012         LDKInitFeatures ret = *owner->contents.result;
3013         ret.is_owned = false;
3014         return ret;
3015 }
3016 uint64_t  __attribute__((export_name("TS_CResult_InitFeaturesDecodeErrorZ_get_ok"))) TS_CResult_InitFeaturesDecodeErrorZ_get_ok(uint64_t owner) {
3017         LDKCResult_InitFeaturesDecodeErrorZ* owner_conv = (LDKCResult_InitFeaturesDecodeErrorZ*)untag_ptr(owner);
3018         LDKInitFeatures ret_var = CResult_InitFeaturesDecodeErrorZ_get_ok(owner_conv);
3019         uint64_t ret_ref = 0;
3020         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
3021         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
3022         return ret_ref;
3023 }
3024
3025 static inline struct LDKDecodeError CResult_InitFeaturesDecodeErrorZ_get_err(LDKCResult_InitFeaturesDecodeErrorZ *NONNULL_PTR owner){
3026 CHECK(!owner->result_ok);
3027         return DecodeError_clone(&*owner->contents.err);
3028 }
3029 uint64_t  __attribute__((export_name("TS_CResult_InitFeaturesDecodeErrorZ_get_err"))) TS_CResult_InitFeaturesDecodeErrorZ_get_err(uint64_t owner) {
3030         LDKCResult_InitFeaturesDecodeErrorZ* owner_conv = (LDKCResult_InitFeaturesDecodeErrorZ*)untag_ptr(owner);
3031         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
3032         *ret_copy = CResult_InitFeaturesDecodeErrorZ_get_err(owner_conv);
3033         uint64_t ret_ref = tag_ptr(ret_copy, true);
3034         return ret_ref;
3035 }
3036
3037 static inline struct LDKChannelFeatures CResult_ChannelFeaturesDecodeErrorZ_get_ok(LDKCResult_ChannelFeaturesDecodeErrorZ *NONNULL_PTR owner){
3038         LDKChannelFeatures ret = *owner->contents.result;
3039         ret.is_owned = false;
3040         return ret;
3041 }
3042 uint64_t  __attribute__((export_name("TS_CResult_ChannelFeaturesDecodeErrorZ_get_ok"))) TS_CResult_ChannelFeaturesDecodeErrorZ_get_ok(uint64_t owner) {
3043         LDKCResult_ChannelFeaturesDecodeErrorZ* owner_conv = (LDKCResult_ChannelFeaturesDecodeErrorZ*)untag_ptr(owner);
3044         LDKChannelFeatures ret_var = CResult_ChannelFeaturesDecodeErrorZ_get_ok(owner_conv);
3045         uint64_t ret_ref = 0;
3046         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
3047         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
3048         return ret_ref;
3049 }
3050
3051 static inline struct LDKDecodeError CResult_ChannelFeaturesDecodeErrorZ_get_err(LDKCResult_ChannelFeaturesDecodeErrorZ *NONNULL_PTR owner){
3052 CHECK(!owner->result_ok);
3053         return DecodeError_clone(&*owner->contents.err);
3054 }
3055 uint64_t  __attribute__((export_name("TS_CResult_ChannelFeaturesDecodeErrorZ_get_err"))) TS_CResult_ChannelFeaturesDecodeErrorZ_get_err(uint64_t owner) {
3056         LDKCResult_ChannelFeaturesDecodeErrorZ* owner_conv = (LDKCResult_ChannelFeaturesDecodeErrorZ*)untag_ptr(owner);
3057         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
3058         *ret_copy = CResult_ChannelFeaturesDecodeErrorZ_get_err(owner_conv);
3059         uint64_t ret_ref = tag_ptr(ret_copy, true);
3060         return ret_ref;
3061 }
3062
3063 static inline struct LDKNodeFeatures CResult_NodeFeaturesDecodeErrorZ_get_ok(LDKCResult_NodeFeaturesDecodeErrorZ *NONNULL_PTR owner){
3064         LDKNodeFeatures ret = *owner->contents.result;
3065         ret.is_owned = false;
3066         return ret;
3067 }
3068 uint64_t  __attribute__((export_name("TS_CResult_NodeFeaturesDecodeErrorZ_get_ok"))) TS_CResult_NodeFeaturesDecodeErrorZ_get_ok(uint64_t owner) {
3069         LDKCResult_NodeFeaturesDecodeErrorZ* owner_conv = (LDKCResult_NodeFeaturesDecodeErrorZ*)untag_ptr(owner);
3070         LDKNodeFeatures ret_var = CResult_NodeFeaturesDecodeErrorZ_get_ok(owner_conv);
3071         uint64_t ret_ref = 0;
3072         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
3073         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
3074         return ret_ref;
3075 }
3076
3077 static inline struct LDKDecodeError CResult_NodeFeaturesDecodeErrorZ_get_err(LDKCResult_NodeFeaturesDecodeErrorZ *NONNULL_PTR owner){
3078 CHECK(!owner->result_ok);
3079         return DecodeError_clone(&*owner->contents.err);
3080 }
3081 uint64_t  __attribute__((export_name("TS_CResult_NodeFeaturesDecodeErrorZ_get_err"))) TS_CResult_NodeFeaturesDecodeErrorZ_get_err(uint64_t owner) {
3082         LDKCResult_NodeFeaturesDecodeErrorZ* owner_conv = (LDKCResult_NodeFeaturesDecodeErrorZ*)untag_ptr(owner);
3083         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
3084         *ret_copy = CResult_NodeFeaturesDecodeErrorZ_get_err(owner_conv);
3085         uint64_t ret_ref = tag_ptr(ret_copy, true);
3086         return ret_ref;
3087 }
3088
3089 static inline struct LDKBolt11InvoiceFeatures CResult_Bolt11InvoiceFeaturesDecodeErrorZ_get_ok(LDKCResult_Bolt11InvoiceFeaturesDecodeErrorZ *NONNULL_PTR owner){
3090         LDKBolt11InvoiceFeatures ret = *owner->contents.result;
3091         ret.is_owned = false;
3092         return ret;
3093 }
3094 uint64_t  __attribute__((export_name("TS_CResult_Bolt11InvoiceFeaturesDecodeErrorZ_get_ok"))) TS_CResult_Bolt11InvoiceFeaturesDecodeErrorZ_get_ok(uint64_t owner) {
3095         LDKCResult_Bolt11InvoiceFeaturesDecodeErrorZ* owner_conv = (LDKCResult_Bolt11InvoiceFeaturesDecodeErrorZ*)untag_ptr(owner);
3096         LDKBolt11InvoiceFeatures ret_var = CResult_Bolt11InvoiceFeaturesDecodeErrorZ_get_ok(owner_conv);
3097         uint64_t ret_ref = 0;
3098         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
3099         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
3100         return ret_ref;
3101 }
3102
3103 static inline struct LDKDecodeError CResult_Bolt11InvoiceFeaturesDecodeErrorZ_get_err(LDKCResult_Bolt11InvoiceFeaturesDecodeErrorZ *NONNULL_PTR owner){
3104 CHECK(!owner->result_ok);
3105         return DecodeError_clone(&*owner->contents.err);
3106 }
3107 uint64_t  __attribute__((export_name("TS_CResult_Bolt11InvoiceFeaturesDecodeErrorZ_get_err"))) TS_CResult_Bolt11InvoiceFeaturesDecodeErrorZ_get_err(uint64_t owner) {
3108         LDKCResult_Bolt11InvoiceFeaturesDecodeErrorZ* owner_conv = (LDKCResult_Bolt11InvoiceFeaturesDecodeErrorZ*)untag_ptr(owner);
3109         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
3110         *ret_copy = CResult_Bolt11InvoiceFeaturesDecodeErrorZ_get_err(owner_conv);
3111         uint64_t ret_ref = tag_ptr(ret_copy, true);
3112         return ret_ref;
3113 }
3114
3115 static inline struct LDKBolt12InvoiceFeatures CResult_Bolt12InvoiceFeaturesDecodeErrorZ_get_ok(LDKCResult_Bolt12InvoiceFeaturesDecodeErrorZ *NONNULL_PTR owner){
3116         LDKBolt12InvoiceFeatures ret = *owner->contents.result;
3117         ret.is_owned = false;
3118         return ret;
3119 }
3120 uint64_t  __attribute__((export_name("TS_CResult_Bolt12InvoiceFeaturesDecodeErrorZ_get_ok"))) TS_CResult_Bolt12InvoiceFeaturesDecodeErrorZ_get_ok(uint64_t owner) {
3121         LDKCResult_Bolt12InvoiceFeaturesDecodeErrorZ* owner_conv = (LDKCResult_Bolt12InvoiceFeaturesDecodeErrorZ*)untag_ptr(owner);
3122         LDKBolt12InvoiceFeatures ret_var = CResult_Bolt12InvoiceFeaturesDecodeErrorZ_get_ok(owner_conv);
3123         uint64_t ret_ref = 0;
3124         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
3125         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
3126         return ret_ref;
3127 }
3128
3129 static inline struct LDKDecodeError CResult_Bolt12InvoiceFeaturesDecodeErrorZ_get_err(LDKCResult_Bolt12InvoiceFeaturesDecodeErrorZ *NONNULL_PTR owner){
3130 CHECK(!owner->result_ok);
3131         return DecodeError_clone(&*owner->contents.err);
3132 }
3133 uint64_t  __attribute__((export_name("TS_CResult_Bolt12InvoiceFeaturesDecodeErrorZ_get_err"))) TS_CResult_Bolt12InvoiceFeaturesDecodeErrorZ_get_err(uint64_t owner) {
3134         LDKCResult_Bolt12InvoiceFeaturesDecodeErrorZ* owner_conv = (LDKCResult_Bolt12InvoiceFeaturesDecodeErrorZ*)untag_ptr(owner);
3135         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
3136         *ret_copy = CResult_Bolt12InvoiceFeaturesDecodeErrorZ_get_err(owner_conv);
3137         uint64_t ret_ref = tag_ptr(ret_copy, true);
3138         return ret_ref;
3139 }
3140
3141 static inline struct LDKBlindedHopFeatures CResult_BlindedHopFeaturesDecodeErrorZ_get_ok(LDKCResult_BlindedHopFeaturesDecodeErrorZ *NONNULL_PTR owner){
3142         LDKBlindedHopFeatures ret = *owner->contents.result;
3143         ret.is_owned = false;
3144         return ret;
3145 }
3146 uint64_t  __attribute__((export_name("TS_CResult_BlindedHopFeaturesDecodeErrorZ_get_ok"))) TS_CResult_BlindedHopFeaturesDecodeErrorZ_get_ok(uint64_t owner) {
3147         LDKCResult_BlindedHopFeaturesDecodeErrorZ* owner_conv = (LDKCResult_BlindedHopFeaturesDecodeErrorZ*)untag_ptr(owner);
3148         LDKBlindedHopFeatures ret_var = CResult_BlindedHopFeaturesDecodeErrorZ_get_ok(owner_conv);
3149         uint64_t ret_ref = 0;
3150         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
3151         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
3152         return ret_ref;
3153 }
3154
3155 static inline struct LDKDecodeError CResult_BlindedHopFeaturesDecodeErrorZ_get_err(LDKCResult_BlindedHopFeaturesDecodeErrorZ *NONNULL_PTR owner){
3156 CHECK(!owner->result_ok);
3157         return DecodeError_clone(&*owner->contents.err);
3158 }
3159 uint64_t  __attribute__((export_name("TS_CResult_BlindedHopFeaturesDecodeErrorZ_get_err"))) TS_CResult_BlindedHopFeaturesDecodeErrorZ_get_err(uint64_t owner) {
3160         LDKCResult_BlindedHopFeaturesDecodeErrorZ* owner_conv = (LDKCResult_BlindedHopFeaturesDecodeErrorZ*)untag_ptr(owner);
3161         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
3162         *ret_copy = CResult_BlindedHopFeaturesDecodeErrorZ_get_err(owner_conv);
3163         uint64_t ret_ref = tag_ptr(ret_copy, true);
3164         return ret_ref;
3165 }
3166
3167 static inline struct LDKChannelTypeFeatures CResult_ChannelTypeFeaturesDecodeErrorZ_get_ok(LDKCResult_ChannelTypeFeaturesDecodeErrorZ *NONNULL_PTR owner){
3168         LDKChannelTypeFeatures ret = *owner->contents.result;
3169         ret.is_owned = false;
3170         return ret;
3171 }
3172 uint64_t  __attribute__((export_name("TS_CResult_ChannelTypeFeaturesDecodeErrorZ_get_ok"))) TS_CResult_ChannelTypeFeaturesDecodeErrorZ_get_ok(uint64_t owner) {
3173         LDKCResult_ChannelTypeFeaturesDecodeErrorZ* owner_conv = (LDKCResult_ChannelTypeFeaturesDecodeErrorZ*)untag_ptr(owner);
3174         LDKChannelTypeFeatures ret_var = CResult_ChannelTypeFeaturesDecodeErrorZ_get_ok(owner_conv);
3175         uint64_t ret_ref = 0;
3176         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
3177         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
3178         return ret_ref;
3179 }
3180
3181 static inline struct LDKDecodeError CResult_ChannelTypeFeaturesDecodeErrorZ_get_err(LDKCResult_ChannelTypeFeaturesDecodeErrorZ *NONNULL_PTR owner){
3182 CHECK(!owner->result_ok);
3183         return DecodeError_clone(&*owner->contents.err);
3184 }
3185 uint64_t  __attribute__((export_name("TS_CResult_ChannelTypeFeaturesDecodeErrorZ_get_err"))) TS_CResult_ChannelTypeFeaturesDecodeErrorZ_get_err(uint64_t owner) {
3186         LDKCResult_ChannelTypeFeaturesDecodeErrorZ* owner_conv = (LDKCResult_ChannelTypeFeaturesDecodeErrorZ*)untag_ptr(owner);
3187         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
3188         *ret_copy = CResult_ChannelTypeFeaturesDecodeErrorZ_get_err(owner_conv);
3189         uint64_t ret_ref = tag_ptr(ret_copy, true);
3190         return ret_ref;
3191 }
3192
3193 static inline struct LDKOffer CResult_OfferBolt12ParseErrorZ_get_ok(LDKCResult_OfferBolt12ParseErrorZ *NONNULL_PTR owner){
3194         LDKOffer ret = *owner->contents.result;
3195         ret.is_owned = false;
3196         return ret;
3197 }
3198 uint64_t  __attribute__((export_name("TS_CResult_OfferBolt12ParseErrorZ_get_ok"))) TS_CResult_OfferBolt12ParseErrorZ_get_ok(uint64_t owner) {
3199         LDKCResult_OfferBolt12ParseErrorZ* owner_conv = (LDKCResult_OfferBolt12ParseErrorZ*)untag_ptr(owner);
3200         LDKOffer ret_var = CResult_OfferBolt12ParseErrorZ_get_ok(owner_conv);
3201         uint64_t ret_ref = 0;
3202         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
3203         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
3204         return ret_ref;
3205 }
3206
3207 static inline struct LDKBolt12ParseError CResult_OfferBolt12ParseErrorZ_get_err(LDKCResult_OfferBolt12ParseErrorZ *NONNULL_PTR owner){
3208         LDKBolt12ParseError ret = *owner->contents.err;
3209         ret.is_owned = false;
3210         return ret;
3211 }
3212 uint64_t  __attribute__((export_name("TS_CResult_OfferBolt12ParseErrorZ_get_err"))) TS_CResult_OfferBolt12ParseErrorZ_get_err(uint64_t owner) {
3213         LDKCResult_OfferBolt12ParseErrorZ* owner_conv = (LDKCResult_OfferBolt12ParseErrorZ*)untag_ptr(owner);
3214         LDKBolt12ParseError ret_var = CResult_OfferBolt12ParseErrorZ_get_err(owner_conv);
3215         uint64_t ret_ref = 0;
3216         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
3217         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
3218         return ret_ref;
3219 }
3220
3221 static inline struct LDKPublicKey CResult_PublicKeySecp256k1ErrorZ_get_ok(LDKCResult_PublicKeySecp256k1ErrorZ *NONNULL_PTR owner){
3222 CHECK(owner->result_ok);
3223         return *owner->contents.result;
3224 }
3225 int8_tArray  __attribute__((export_name("TS_CResult_PublicKeySecp256k1ErrorZ_get_ok"))) TS_CResult_PublicKeySecp256k1ErrorZ_get_ok(uint64_t owner) {
3226         LDKCResult_PublicKeySecp256k1ErrorZ* owner_conv = (LDKCResult_PublicKeySecp256k1ErrorZ*)untag_ptr(owner);
3227         int8_tArray ret_arr = init_int8_tArray(33, __LINE__);
3228         memcpy(ret_arr->elems, CResult_PublicKeySecp256k1ErrorZ_get_ok(owner_conv).compressed_form, 33);
3229         return ret_arr;
3230 }
3231
3232 static inline enum LDKSecp256k1Error CResult_PublicKeySecp256k1ErrorZ_get_err(LDKCResult_PublicKeySecp256k1ErrorZ *NONNULL_PTR owner){
3233 CHECK(!owner->result_ok);
3234         return *owner->contents.err;
3235 }
3236 uint32_t  __attribute__((export_name("TS_CResult_PublicKeySecp256k1ErrorZ_get_err"))) TS_CResult_PublicKeySecp256k1ErrorZ_get_err(uint64_t owner) {
3237         LDKCResult_PublicKeySecp256k1ErrorZ* owner_conv = (LDKCResult_PublicKeySecp256k1ErrorZ*)untag_ptr(owner);
3238         uint32_t ret_conv = LDKSecp256k1Error_to_js(CResult_PublicKeySecp256k1ErrorZ_get_err(owner_conv));
3239         return ret_conv;
3240 }
3241
3242 static inline struct LDKNodeId CResult_NodeIdDecodeErrorZ_get_ok(LDKCResult_NodeIdDecodeErrorZ *NONNULL_PTR owner){
3243         LDKNodeId ret = *owner->contents.result;
3244         ret.is_owned = false;
3245         return ret;
3246 }
3247 uint64_t  __attribute__((export_name("TS_CResult_NodeIdDecodeErrorZ_get_ok"))) TS_CResult_NodeIdDecodeErrorZ_get_ok(uint64_t owner) {
3248         LDKCResult_NodeIdDecodeErrorZ* owner_conv = (LDKCResult_NodeIdDecodeErrorZ*)untag_ptr(owner);
3249         LDKNodeId ret_var = CResult_NodeIdDecodeErrorZ_get_ok(owner_conv);
3250         uint64_t ret_ref = 0;
3251         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
3252         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
3253         return ret_ref;
3254 }
3255
3256 static inline struct LDKDecodeError CResult_NodeIdDecodeErrorZ_get_err(LDKCResult_NodeIdDecodeErrorZ *NONNULL_PTR owner){
3257 CHECK(!owner->result_ok);
3258         return DecodeError_clone(&*owner->contents.err);
3259 }
3260 uint64_t  __attribute__((export_name("TS_CResult_NodeIdDecodeErrorZ_get_err"))) TS_CResult_NodeIdDecodeErrorZ_get_err(uint64_t owner) {
3261         LDKCResult_NodeIdDecodeErrorZ* owner_conv = (LDKCResult_NodeIdDecodeErrorZ*)untag_ptr(owner);
3262         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
3263         *ret_copy = CResult_NodeIdDecodeErrorZ_get_err(owner_conv);
3264         uint64_t ret_ref = tag_ptr(ret_copy, true);
3265         return ret_ref;
3266 }
3267
3268 uint32_t __attribute__((export_name("TS_LDKNetworkUpdate_ty_from_ptr"))) TS_LDKNetworkUpdate_ty_from_ptr(uint64_t ptr) {
3269         LDKNetworkUpdate *obj = (LDKNetworkUpdate*)untag_ptr(ptr);
3270         switch(obj->tag) {
3271                 case LDKNetworkUpdate_ChannelUpdateMessage: return 0;
3272                 case LDKNetworkUpdate_ChannelFailure: return 1;
3273                 case LDKNetworkUpdate_NodeFailure: return 2;
3274                 default: abort();
3275         }
3276 }
3277 uint64_t __attribute__((export_name("TS_LDKNetworkUpdate_ChannelUpdateMessage_get_msg"))) TS_LDKNetworkUpdate_ChannelUpdateMessage_get_msg(uint64_t ptr) {
3278         LDKNetworkUpdate *obj = (LDKNetworkUpdate*)untag_ptr(ptr);
3279         assert(obj->tag == LDKNetworkUpdate_ChannelUpdateMessage);
3280         LDKChannelUpdate msg_var = obj->channel_update_message.msg;
3281                         uint64_t msg_ref = 0;
3282                         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
3283                         msg_ref = tag_ptr(msg_var.inner, false);
3284         return msg_ref;
3285 }
3286 int64_t __attribute__((export_name("TS_LDKNetworkUpdate_ChannelFailure_get_short_channel_id"))) TS_LDKNetworkUpdate_ChannelFailure_get_short_channel_id(uint64_t ptr) {
3287         LDKNetworkUpdate *obj = (LDKNetworkUpdate*)untag_ptr(ptr);
3288         assert(obj->tag == LDKNetworkUpdate_ChannelFailure);
3289         int64_t short_channel_id_conv = obj->channel_failure.short_channel_id;
3290         return short_channel_id_conv;
3291 }
3292 jboolean __attribute__((export_name("TS_LDKNetworkUpdate_ChannelFailure_get_is_permanent"))) TS_LDKNetworkUpdate_ChannelFailure_get_is_permanent(uint64_t ptr) {
3293         LDKNetworkUpdate *obj = (LDKNetworkUpdate*)untag_ptr(ptr);
3294         assert(obj->tag == LDKNetworkUpdate_ChannelFailure);
3295         jboolean is_permanent_conv = obj->channel_failure.is_permanent;
3296         return is_permanent_conv;
3297 }
3298 int8_tArray __attribute__((export_name("TS_LDKNetworkUpdate_NodeFailure_get_node_id"))) TS_LDKNetworkUpdate_NodeFailure_get_node_id(uint64_t ptr) {
3299         LDKNetworkUpdate *obj = (LDKNetworkUpdate*)untag_ptr(ptr);
3300         assert(obj->tag == LDKNetworkUpdate_NodeFailure);
3301         int8_tArray node_id_arr = init_int8_tArray(33, __LINE__);
3302         memcpy(node_id_arr->elems, obj->node_failure.node_id.compressed_form, 33);
3303         return node_id_arr;
3304 }
3305 jboolean __attribute__((export_name("TS_LDKNetworkUpdate_NodeFailure_get_is_permanent"))) TS_LDKNetworkUpdate_NodeFailure_get_is_permanent(uint64_t ptr) {
3306         LDKNetworkUpdate *obj = (LDKNetworkUpdate*)untag_ptr(ptr);
3307         assert(obj->tag == LDKNetworkUpdate_NodeFailure);
3308         jboolean is_permanent_conv = obj->node_failure.is_permanent;
3309         return is_permanent_conv;
3310 }
3311 uint32_t __attribute__((export_name("TS_LDKCOption_NetworkUpdateZ_ty_from_ptr"))) TS_LDKCOption_NetworkUpdateZ_ty_from_ptr(uint64_t ptr) {
3312         LDKCOption_NetworkUpdateZ *obj = (LDKCOption_NetworkUpdateZ*)untag_ptr(ptr);
3313         switch(obj->tag) {
3314                 case LDKCOption_NetworkUpdateZ_Some: return 0;
3315                 case LDKCOption_NetworkUpdateZ_None: return 1;
3316                 default: abort();
3317         }
3318 }
3319 uint64_t __attribute__((export_name("TS_LDKCOption_NetworkUpdateZ_Some_get_some"))) TS_LDKCOption_NetworkUpdateZ_Some_get_some(uint64_t ptr) {
3320         LDKCOption_NetworkUpdateZ *obj = (LDKCOption_NetworkUpdateZ*)untag_ptr(ptr);
3321         assert(obj->tag == LDKCOption_NetworkUpdateZ_Some);
3322         uint64_t some_ref = tag_ptr(&obj->some, false);
3323         return some_ref;
3324 }
3325 static inline struct LDKCOption_NetworkUpdateZ CResult_COption_NetworkUpdateZDecodeErrorZ_get_ok(LDKCResult_COption_NetworkUpdateZDecodeErrorZ *NONNULL_PTR owner){
3326 CHECK(owner->result_ok);
3327         return COption_NetworkUpdateZ_clone(&*owner->contents.result);
3328 }
3329 uint64_t  __attribute__((export_name("TS_CResult_COption_NetworkUpdateZDecodeErrorZ_get_ok"))) TS_CResult_COption_NetworkUpdateZDecodeErrorZ_get_ok(uint64_t owner) {
3330         LDKCResult_COption_NetworkUpdateZDecodeErrorZ* owner_conv = (LDKCResult_COption_NetworkUpdateZDecodeErrorZ*)untag_ptr(owner);
3331         LDKCOption_NetworkUpdateZ *ret_copy = MALLOC(sizeof(LDKCOption_NetworkUpdateZ), "LDKCOption_NetworkUpdateZ");
3332         *ret_copy = CResult_COption_NetworkUpdateZDecodeErrorZ_get_ok(owner_conv);
3333         uint64_t ret_ref = tag_ptr(ret_copy, true);
3334         return ret_ref;
3335 }
3336
3337 static inline struct LDKDecodeError CResult_COption_NetworkUpdateZDecodeErrorZ_get_err(LDKCResult_COption_NetworkUpdateZDecodeErrorZ *NONNULL_PTR owner){
3338 CHECK(!owner->result_ok);
3339         return DecodeError_clone(&*owner->contents.err);
3340 }
3341 uint64_t  __attribute__((export_name("TS_CResult_COption_NetworkUpdateZDecodeErrorZ_get_err"))) TS_CResult_COption_NetworkUpdateZDecodeErrorZ_get_err(uint64_t owner) {
3342         LDKCResult_COption_NetworkUpdateZDecodeErrorZ* owner_conv = (LDKCResult_COption_NetworkUpdateZDecodeErrorZ*)untag_ptr(owner);
3343         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
3344         *ret_copy = CResult_COption_NetworkUpdateZDecodeErrorZ_get_err(owner_conv);
3345         uint64_t ret_ref = tag_ptr(ret_copy, true);
3346         return ret_ref;
3347 }
3348
3349 static inline struct LDKTxOut CResult_TxOutUtxoLookupErrorZ_get_ok(LDKCResult_TxOutUtxoLookupErrorZ *NONNULL_PTR owner){
3350 CHECK(owner->result_ok);
3351         return TxOut_clone(&*owner->contents.result);
3352 }
3353 uint64_t  __attribute__((export_name("TS_CResult_TxOutUtxoLookupErrorZ_get_ok"))) TS_CResult_TxOutUtxoLookupErrorZ_get_ok(uint64_t owner) {
3354         LDKCResult_TxOutUtxoLookupErrorZ* owner_conv = (LDKCResult_TxOutUtxoLookupErrorZ*)untag_ptr(owner);
3355         LDKTxOut* ret_ref = MALLOC(sizeof(LDKTxOut), "LDKTxOut");
3356         *ret_ref = CResult_TxOutUtxoLookupErrorZ_get_ok(owner_conv);
3357         return tag_ptr(ret_ref, true);
3358 }
3359
3360 static inline enum LDKUtxoLookupError CResult_TxOutUtxoLookupErrorZ_get_err(LDKCResult_TxOutUtxoLookupErrorZ *NONNULL_PTR owner){
3361 CHECK(!owner->result_ok);
3362         return UtxoLookupError_clone(&*owner->contents.err);
3363 }
3364 uint32_t  __attribute__((export_name("TS_CResult_TxOutUtxoLookupErrorZ_get_err"))) TS_CResult_TxOutUtxoLookupErrorZ_get_err(uint64_t owner) {
3365         LDKCResult_TxOutUtxoLookupErrorZ* owner_conv = (LDKCResult_TxOutUtxoLookupErrorZ*)untag_ptr(owner);
3366         uint32_t ret_conv = LDKUtxoLookupError_to_js(CResult_TxOutUtxoLookupErrorZ_get_err(owner_conv));
3367         return ret_conv;
3368 }
3369
3370 uint32_t __attribute__((export_name("TS_LDKUtxoResult_ty_from_ptr"))) TS_LDKUtxoResult_ty_from_ptr(uint64_t ptr) {
3371         LDKUtxoResult *obj = (LDKUtxoResult*)untag_ptr(ptr);
3372         switch(obj->tag) {
3373                 case LDKUtxoResult_Sync: return 0;
3374                 case LDKUtxoResult_Async: return 1;
3375                 default: abort();
3376         }
3377 }
3378 uint64_t __attribute__((export_name("TS_LDKUtxoResult_Sync_get_sync"))) TS_LDKUtxoResult_Sync_get_sync(uint64_t ptr) {
3379         LDKUtxoResult *obj = (LDKUtxoResult*)untag_ptr(ptr);
3380         assert(obj->tag == LDKUtxoResult_Sync);
3381         LDKCResult_TxOutUtxoLookupErrorZ* sync_conv = MALLOC(sizeof(LDKCResult_TxOutUtxoLookupErrorZ), "LDKCResult_TxOutUtxoLookupErrorZ");
3382         *sync_conv = obj->sync;
3383                         *sync_conv = CResult_TxOutUtxoLookupErrorZ_clone(sync_conv);
3384         return tag_ptr(sync_conv, true);
3385 }
3386 uint64_t __attribute__((export_name("TS_LDKUtxoResult_Async_get_async"))) TS_LDKUtxoResult_Async_get_async(uint64_t ptr) {
3387         LDKUtxoResult *obj = (LDKUtxoResult*)untag_ptr(ptr);
3388         assert(obj->tag == LDKUtxoResult_Async);
3389         LDKUtxoFuture async_var = obj->async;
3390                         uint64_t async_ref = 0;
3391                         CHECK_INNER_FIELD_ACCESS_OR_NULL(async_var);
3392                         async_ref = tag_ptr(async_var.inner, false);
3393         return async_ref;
3394 }
3395 typedef struct LDKUtxoLookup_JCalls {
3396         atomic_size_t refcnt;
3397         uint32_t instance_ptr;
3398 } LDKUtxoLookup_JCalls;
3399 static void LDKUtxoLookup_JCalls_free(void* this_arg) {
3400         LDKUtxoLookup_JCalls *j_calls = (LDKUtxoLookup_JCalls*) this_arg;
3401         if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
3402                 FREE(j_calls);
3403         }
3404 }
3405 LDKUtxoResult get_utxo_LDKUtxoLookup_jcall(const void* this_arg, const uint8_t (* chain_hash)[32], uint64_t short_channel_id) {
3406         LDKUtxoLookup_JCalls *j_calls = (LDKUtxoLookup_JCalls*) this_arg;
3407         int8_tArray chain_hash_arr = init_int8_tArray(32, __LINE__);
3408         memcpy(chain_hash_arr->elems, *chain_hash, 32);
3409         int64_t short_channel_id_conv = short_channel_id;
3410         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);
3411         void* ret_ptr = untag_ptr(ret);
3412         CHECK_ACCESS(ret_ptr);
3413         LDKUtxoResult ret_conv = *(LDKUtxoResult*)(ret_ptr);
3414         FREE(untag_ptr(ret));
3415         return ret_conv;
3416 }
3417 static void LDKUtxoLookup_JCalls_cloned(LDKUtxoLookup* new_obj) {
3418         LDKUtxoLookup_JCalls *j_calls = (LDKUtxoLookup_JCalls*) new_obj->this_arg;
3419         atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
3420 }
3421 static inline LDKUtxoLookup LDKUtxoLookup_init (JSValue o) {
3422         LDKUtxoLookup_JCalls *calls = MALLOC(sizeof(LDKUtxoLookup_JCalls), "LDKUtxoLookup_JCalls");
3423         atomic_init(&calls->refcnt, 1);
3424         calls->instance_ptr = o;
3425
3426         LDKUtxoLookup ret = {
3427                 .this_arg = (void*) calls,
3428                 .get_utxo = get_utxo_LDKUtxoLookup_jcall,
3429                 .free = LDKUtxoLookup_JCalls_free,
3430         };
3431         return ret;
3432 }
3433 uint64_t  __attribute__((export_name("TS_LDKUtxoLookup_new"))) TS_LDKUtxoLookup_new(JSValue o) {
3434         LDKUtxoLookup *res_ptr = MALLOC(sizeof(LDKUtxoLookup), "LDKUtxoLookup");
3435         *res_ptr = LDKUtxoLookup_init(o);
3436         return tag_ptr(res_ptr, true);
3437 }
3438 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) {
3439         void* this_arg_ptr = untag_ptr(this_arg);
3440         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
3441         LDKUtxoLookup* this_arg_conv = (LDKUtxoLookup*)this_arg_ptr;
3442         uint8_t chain_hash_arr[32];
3443         CHECK(chain_hash->arr_len == 32);
3444         memcpy(chain_hash_arr, chain_hash->elems, 32); FREE(chain_hash);
3445         uint8_t (*chain_hash_ref)[32] = &chain_hash_arr;
3446         LDKUtxoResult *ret_copy = MALLOC(sizeof(LDKUtxoResult), "LDKUtxoResult");
3447         *ret_copy = (this_arg_conv->get_utxo)(this_arg_conv->this_arg, chain_hash_ref, short_channel_id);
3448         uint64_t ret_ref = tag_ptr(ret_copy, true);
3449         return ret_ref;
3450 }
3451
3452 uint32_t __attribute__((export_name("TS_LDKCOption_UtxoLookupZ_ty_from_ptr"))) TS_LDKCOption_UtxoLookupZ_ty_from_ptr(uint64_t ptr) {
3453         LDKCOption_UtxoLookupZ *obj = (LDKCOption_UtxoLookupZ*)untag_ptr(ptr);
3454         switch(obj->tag) {
3455                 case LDKCOption_UtxoLookupZ_Some: return 0;
3456                 case LDKCOption_UtxoLookupZ_None: return 1;
3457                 default: abort();
3458         }
3459 }
3460 uint64_t __attribute__((export_name("TS_LDKCOption_UtxoLookupZ_Some_get_some"))) TS_LDKCOption_UtxoLookupZ_Some_get_some(uint64_t ptr) {
3461         LDKCOption_UtxoLookupZ *obj = (LDKCOption_UtxoLookupZ*)untag_ptr(ptr);
3462         assert(obj->tag == LDKCOption_UtxoLookupZ_Some);
3463         LDKUtxoLookup* some_ret = MALLOC(sizeof(LDKUtxoLookup), "LDKUtxoLookup");
3464         *some_ret = obj->some;
3465                         // WARNING: We likely need to clone here, but no clone is available, so we just do it for Java instances
3466                         if ((*some_ret).free == LDKUtxoLookup_JCalls_free) {
3467                                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
3468                                 LDKUtxoLookup_JCalls_cloned(&(*some_ret));
3469                         }
3470         return tag_ptr(some_ret, true);
3471 }
3472 static inline void CResult_NoneLightningErrorZ_get_ok(LDKCResult_NoneLightningErrorZ *NONNULL_PTR owner){
3473 CHECK(owner->result_ok);
3474         return *owner->contents.result;
3475 }
3476 void  __attribute__((export_name("TS_CResult_NoneLightningErrorZ_get_ok"))) TS_CResult_NoneLightningErrorZ_get_ok(uint64_t owner) {
3477         LDKCResult_NoneLightningErrorZ* owner_conv = (LDKCResult_NoneLightningErrorZ*)untag_ptr(owner);
3478         CResult_NoneLightningErrorZ_get_ok(owner_conv);
3479 }
3480
3481 static inline struct LDKLightningError CResult_NoneLightningErrorZ_get_err(LDKCResult_NoneLightningErrorZ *NONNULL_PTR owner){
3482         LDKLightningError ret = *owner->contents.err;
3483         ret.is_owned = false;
3484         return ret;
3485 }
3486 uint64_t  __attribute__((export_name("TS_CResult_NoneLightningErrorZ_get_err"))) TS_CResult_NoneLightningErrorZ_get_err(uint64_t owner) {
3487         LDKCResult_NoneLightningErrorZ* owner_conv = (LDKCResult_NoneLightningErrorZ*)untag_ptr(owner);
3488         LDKLightningError ret_var = CResult_NoneLightningErrorZ_get_err(owner_conv);
3489         uint64_t ret_ref = 0;
3490         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
3491         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
3492         return ret_ref;
3493 }
3494
3495 static inline bool CResult_boolLightningErrorZ_get_ok(LDKCResult_boolLightningErrorZ *NONNULL_PTR owner){
3496 CHECK(owner->result_ok);
3497         return *owner->contents.result;
3498 }
3499 jboolean  __attribute__((export_name("TS_CResult_boolLightningErrorZ_get_ok"))) TS_CResult_boolLightningErrorZ_get_ok(uint64_t owner) {
3500         LDKCResult_boolLightningErrorZ* owner_conv = (LDKCResult_boolLightningErrorZ*)untag_ptr(owner);
3501         jboolean ret_conv = CResult_boolLightningErrorZ_get_ok(owner_conv);
3502         return ret_conv;
3503 }
3504
3505 static inline struct LDKLightningError CResult_boolLightningErrorZ_get_err(LDKCResult_boolLightningErrorZ *NONNULL_PTR owner){
3506         LDKLightningError ret = *owner->contents.err;
3507         ret.is_owned = false;
3508         return ret;
3509 }
3510 uint64_t  __attribute__((export_name("TS_CResult_boolLightningErrorZ_get_err"))) TS_CResult_boolLightningErrorZ_get_err(uint64_t owner) {
3511         LDKCResult_boolLightningErrorZ* owner_conv = (LDKCResult_boolLightningErrorZ*)untag_ptr(owner);
3512         LDKLightningError ret_var = CResult_boolLightningErrorZ_get_err(owner_conv);
3513         uint64_t ret_ref = 0;
3514         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
3515         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
3516         return ret_ref;
3517 }
3518
3519 static inline struct LDKChannelAnnouncement C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ_get_a(LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ *NONNULL_PTR owner){
3520         LDKChannelAnnouncement ret = owner->a;
3521         ret.is_owned = false;
3522         return ret;
3523 }
3524 uint64_t  __attribute__((export_name("TS_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ_get_a"))) TS_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ_get_a(uint64_t owner) {
3525         LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ* owner_conv = (LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ*)untag_ptr(owner);
3526         LDKChannelAnnouncement ret_var = C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ_get_a(owner_conv);
3527         uint64_t ret_ref = 0;
3528         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
3529         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
3530         return ret_ref;
3531 }
3532
3533 static inline struct LDKChannelUpdate C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ_get_b(LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ *NONNULL_PTR owner){
3534         LDKChannelUpdate ret = owner->b;
3535         ret.is_owned = false;
3536         return ret;
3537 }
3538 uint64_t  __attribute__((export_name("TS_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ_get_b"))) TS_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ_get_b(uint64_t owner) {
3539         LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ* owner_conv = (LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ*)untag_ptr(owner);
3540         LDKChannelUpdate ret_var = C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ_get_b(owner_conv);
3541         uint64_t ret_ref = 0;
3542         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
3543         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
3544         return ret_ref;
3545 }
3546
3547 static inline struct LDKChannelUpdate C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ_get_c(LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ *NONNULL_PTR owner){
3548         LDKChannelUpdate ret = owner->c;
3549         ret.is_owned = false;
3550         return ret;
3551 }
3552 uint64_t  __attribute__((export_name("TS_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ_get_c"))) TS_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ_get_c(uint64_t owner) {
3553         LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ* owner_conv = (LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ*)untag_ptr(owner);
3554         LDKChannelUpdate ret_var = C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ_get_c(owner_conv);
3555         uint64_t ret_ref = 0;
3556         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
3557         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
3558         return ret_ref;
3559 }
3560
3561 uint32_t __attribute__((export_name("TS_LDKCOption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ_ty_from_ptr"))) TS_LDKCOption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ_ty_from_ptr(uint64_t ptr) {
3562         LDKCOption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ *obj = (LDKCOption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ*)untag_ptr(ptr);
3563         switch(obj->tag) {
3564                 case LDKCOption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ_Some: return 0;
3565                 case LDKCOption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ_None: return 1;
3566                 default: abort();
3567         }
3568 }
3569 uint64_t __attribute__((export_name("TS_LDKCOption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ_Some_get_some"))) TS_LDKCOption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ_Some_get_some(uint64_t ptr) {
3570         LDKCOption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ *obj = (LDKCOption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ*)untag_ptr(ptr);
3571         assert(obj->tag == LDKCOption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ_Some);
3572         LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ* some_conv = MALLOC(sizeof(LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ), "LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ");
3573         *some_conv = obj->some;
3574                         *some_conv = C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ_clone(some_conv);
3575         return tag_ptr(some_conv, true);
3576 }
3577 uint32_t __attribute__((export_name("TS_LDKErrorAction_ty_from_ptr"))) TS_LDKErrorAction_ty_from_ptr(uint64_t ptr) {
3578         LDKErrorAction *obj = (LDKErrorAction*)untag_ptr(ptr);
3579         switch(obj->tag) {
3580                 case LDKErrorAction_DisconnectPeer: return 0;
3581                 case LDKErrorAction_DisconnectPeerWithWarning: return 1;
3582                 case LDKErrorAction_IgnoreError: return 2;
3583                 case LDKErrorAction_IgnoreAndLog: return 3;
3584                 case LDKErrorAction_IgnoreDuplicateGossip: return 4;
3585                 case LDKErrorAction_SendErrorMessage: return 5;
3586                 case LDKErrorAction_SendWarningMessage: return 6;
3587                 default: abort();
3588         }
3589 }
3590 uint64_t __attribute__((export_name("TS_LDKErrorAction_DisconnectPeer_get_msg"))) TS_LDKErrorAction_DisconnectPeer_get_msg(uint64_t ptr) {
3591         LDKErrorAction *obj = (LDKErrorAction*)untag_ptr(ptr);
3592         assert(obj->tag == LDKErrorAction_DisconnectPeer);
3593         LDKErrorMessage msg_var = obj->disconnect_peer.msg;
3594                         uint64_t msg_ref = 0;
3595                         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
3596                         msg_ref = tag_ptr(msg_var.inner, false);
3597         return msg_ref;
3598 }
3599 uint64_t __attribute__((export_name("TS_LDKErrorAction_DisconnectPeerWithWarning_get_msg"))) TS_LDKErrorAction_DisconnectPeerWithWarning_get_msg(uint64_t ptr) {
3600         LDKErrorAction *obj = (LDKErrorAction*)untag_ptr(ptr);
3601         assert(obj->tag == LDKErrorAction_DisconnectPeerWithWarning);
3602         LDKWarningMessage msg_var = obj->disconnect_peer_with_warning.msg;
3603                         uint64_t msg_ref = 0;
3604                         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
3605                         msg_ref = tag_ptr(msg_var.inner, false);
3606         return msg_ref;
3607 }
3608 uint32_t __attribute__((export_name("TS_LDKErrorAction_IgnoreAndLog_get_ignore_and_log"))) TS_LDKErrorAction_IgnoreAndLog_get_ignore_and_log(uint64_t ptr) {
3609         LDKErrorAction *obj = (LDKErrorAction*)untag_ptr(ptr);
3610         assert(obj->tag == LDKErrorAction_IgnoreAndLog);
3611         uint32_t ignore_and_log_conv = LDKLevel_to_js(obj->ignore_and_log);
3612         return ignore_and_log_conv;
3613 }
3614 uint64_t __attribute__((export_name("TS_LDKErrorAction_SendErrorMessage_get_msg"))) TS_LDKErrorAction_SendErrorMessage_get_msg(uint64_t ptr) {
3615         LDKErrorAction *obj = (LDKErrorAction*)untag_ptr(ptr);
3616         assert(obj->tag == LDKErrorAction_SendErrorMessage);
3617         LDKErrorMessage msg_var = obj->send_error_message.msg;
3618                         uint64_t msg_ref = 0;
3619                         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
3620                         msg_ref = tag_ptr(msg_var.inner, false);
3621         return msg_ref;
3622 }
3623 uint64_t __attribute__((export_name("TS_LDKErrorAction_SendWarningMessage_get_msg"))) TS_LDKErrorAction_SendWarningMessage_get_msg(uint64_t ptr) {
3624         LDKErrorAction *obj = (LDKErrorAction*)untag_ptr(ptr);
3625         assert(obj->tag == LDKErrorAction_SendWarningMessage);
3626         LDKWarningMessage msg_var = obj->send_warning_message.msg;
3627                         uint64_t msg_ref = 0;
3628                         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
3629                         msg_ref = tag_ptr(msg_var.inner, false);
3630         return msg_ref;
3631 }
3632 uint32_t __attribute__((export_name("TS_LDKErrorAction_SendWarningMessage_get_log_level"))) TS_LDKErrorAction_SendWarningMessage_get_log_level(uint64_t ptr) {
3633         LDKErrorAction *obj = (LDKErrorAction*)untag_ptr(ptr);
3634         assert(obj->tag == LDKErrorAction_SendWarningMessage);
3635         uint32_t log_level_conv = LDKLevel_to_js(obj->send_warning_message.log_level);
3636         return log_level_conv;
3637 }
3638 uint32_t __attribute__((export_name("TS_LDKMessageSendEvent_ty_from_ptr"))) TS_LDKMessageSendEvent_ty_from_ptr(uint64_t ptr) {
3639         LDKMessageSendEvent *obj = (LDKMessageSendEvent*)untag_ptr(ptr);
3640         switch(obj->tag) {
3641                 case LDKMessageSendEvent_SendAcceptChannel: return 0;
3642                 case LDKMessageSendEvent_SendAcceptChannelV2: return 1;
3643                 case LDKMessageSendEvent_SendOpenChannel: return 2;
3644                 case LDKMessageSendEvent_SendOpenChannelV2: return 3;
3645                 case LDKMessageSendEvent_SendFundingCreated: return 4;
3646                 case LDKMessageSendEvent_SendFundingSigned: return 5;
3647                 case LDKMessageSendEvent_SendTxAddInput: return 6;
3648                 case LDKMessageSendEvent_SendTxAddOutput: return 7;
3649                 case LDKMessageSendEvent_SendTxRemoveInput: return 8;
3650                 case LDKMessageSendEvent_SendTxRemoveOutput: return 9;
3651                 case LDKMessageSendEvent_SendTxComplete: return 10;
3652                 case LDKMessageSendEvent_SendTxSignatures: return 11;
3653                 case LDKMessageSendEvent_SendTxInitRbf: return 12;
3654                 case LDKMessageSendEvent_SendTxAckRbf: return 13;
3655                 case LDKMessageSendEvent_SendTxAbort: return 14;
3656                 case LDKMessageSendEvent_SendChannelReady: return 15;
3657                 case LDKMessageSendEvent_SendAnnouncementSignatures: return 16;
3658                 case LDKMessageSendEvent_UpdateHTLCs: return 17;
3659                 case LDKMessageSendEvent_SendRevokeAndACK: return 18;
3660                 case LDKMessageSendEvent_SendClosingSigned: return 19;
3661                 case LDKMessageSendEvent_SendShutdown: return 20;
3662                 case LDKMessageSendEvent_SendChannelReestablish: return 21;
3663                 case LDKMessageSendEvent_SendChannelAnnouncement: return 22;
3664                 case LDKMessageSendEvent_BroadcastChannelAnnouncement: return 23;
3665                 case LDKMessageSendEvent_BroadcastChannelUpdate: return 24;
3666                 case LDKMessageSendEvent_BroadcastNodeAnnouncement: return 25;
3667                 case LDKMessageSendEvent_SendChannelUpdate: return 26;
3668                 case LDKMessageSendEvent_HandleError: return 27;
3669                 case LDKMessageSendEvent_SendChannelRangeQuery: return 28;
3670                 case LDKMessageSendEvent_SendShortIdsQuery: return 29;
3671                 case LDKMessageSendEvent_SendReplyChannelRange: return 30;
3672                 case LDKMessageSendEvent_SendGossipTimestampFilter: return 31;
3673                 default: abort();
3674         }
3675 }
3676 int8_tArray __attribute__((export_name("TS_LDKMessageSendEvent_SendAcceptChannel_get_node_id"))) TS_LDKMessageSendEvent_SendAcceptChannel_get_node_id(uint64_t ptr) {
3677         LDKMessageSendEvent *obj = (LDKMessageSendEvent*)untag_ptr(ptr);
3678         assert(obj->tag == LDKMessageSendEvent_SendAcceptChannel);
3679         int8_tArray node_id_arr = init_int8_tArray(33, __LINE__);
3680         memcpy(node_id_arr->elems, obj->send_accept_channel.node_id.compressed_form, 33);
3681         return node_id_arr;
3682 }
3683 uint64_t __attribute__((export_name("TS_LDKMessageSendEvent_SendAcceptChannel_get_msg"))) TS_LDKMessageSendEvent_SendAcceptChannel_get_msg(uint64_t ptr) {
3684         LDKMessageSendEvent *obj = (LDKMessageSendEvent*)untag_ptr(ptr);
3685         assert(obj->tag == LDKMessageSendEvent_SendAcceptChannel);
3686         LDKAcceptChannel msg_var = obj->send_accept_channel.msg;
3687                         uint64_t msg_ref = 0;
3688                         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
3689                         msg_ref = tag_ptr(msg_var.inner, false);
3690         return msg_ref;
3691 }
3692 int8_tArray __attribute__((export_name("TS_LDKMessageSendEvent_SendAcceptChannelV2_get_node_id"))) TS_LDKMessageSendEvent_SendAcceptChannelV2_get_node_id(uint64_t ptr) {
3693         LDKMessageSendEvent *obj = (LDKMessageSendEvent*)untag_ptr(ptr);
3694         assert(obj->tag == LDKMessageSendEvent_SendAcceptChannelV2);
3695         int8_tArray node_id_arr = init_int8_tArray(33, __LINE__);
3696         memcpy(node_id_arr->elems, obj->send_accept_channel_v2.node_id.compressed_form, 33);
3697         return node_id_arr;
3698 }
3699 uint64_t __attribute__((export_name("TS_LDKMessageSendEvent_SendAcceptChannelV2_get_msg"))) TS_LDKMessageSendEvent_SendAcceptChannelV2_get_msg(uint64_t ptr) {
3700         LDKMessageSendEvent *obj = (LDKMessageSendEvent*)untag_ptr(ptr);
3701         assert(obj->tag == LDKMessageSendEvent_SendAcceptChannelV2);
3702         LDKAcceptChannelV2 msg_var = obj->send_accept_channel_v2.msg;
3703                         uint64_t msg_ref = 0;
3704                         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
3705                         msg_ref = tag_ptr(msg_var.inner, false);
3706         return msg_ref;
3707 }
3708 int8_tArray __attribute__((export_name("TS_LDKMessageSendEvent_SendOpenChannel_get_node_id"))) TS_LDKMessageSendEvent_SendOpenChannel_get_node_id(uint64_t ptr) {
3709         LDKMessageSendEvent *obj = (LDKMessageSendEvent*)untag_ptr(ptr);
3710         assert(obj->tag == LDKMessageSendEvent_SendOpenChannel);
3711         int8_tArray node_id_arr = init_int8_tArray(33, __LINE__);
3712         memcpy(node_id_arr->elems, obj->send_open_channel.node_id.compressed_form, 33);
3713         return node_id_arr;
3714 }
3715 uint64_t __attribute__((export_name("TS_LDKMessageSendEvent_SendOpenChannel_get_msg"))) TS_LDKMessageSendEvent_SendOpenChannel_get_msg(uint64_t ptr) {
3716         LDKMessageSendEvent *obj = (LDKMessageSendEvent*)untag_ptr(ptr);
3717         assert(obj->tag == LDKMessageSendEvent_SendOpenChannel);
3718         LDKOpenChannel msg_var = obj->send_open_channel.msg;
3719                         uint64_t msg_ref = 0;
3720                         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
3721                         msg_ref = tag_ptr(msg_var.inner, false);
3722         return msg_ref;
3723 }
3724 int8_tArray __attribute__((export_name("TS_LDKMessageSendEvent_SendOpenChannelV2_get_node_id"))) TS_LDKMessageSendEvent_SendOpenChannelV2_get_node_id(uint64_t ptr) {
3725         LDKMessageSendEvent *obj = (LDKMessageSendEvent*)untag_ptr(ptr);
3726         assert(obj->tag == LDKMessageSendEvent_SendOpenChannelV2);
3727         int8_tArray node_id_arr = init_int8_tArray(33, __LINE__);
3728         memcpy(node_id_arr->elems, obj->send_open_channel_v2.node_id.compressed_form, 33);
3729         return node_id_arr;
3730 }
3731 uint64_t __attribute__((export_name("TS_LDKMessageSendEvent_SendOpenChannelV2_get_msg"))) TS_LDKMessageSendEvent_SendOpenChannelV2_get_msg(uint64_t ptr) {
3732         LDKMessageSendEvent *obj = (LDKMessageSendEvent*)untag_ptr(ptr);
3733         assert(obj->tag == LDKMessageSendEvent_SendOpenChannelV2);
3734         LDKOpenChannelV2 msg_var = obj->send_open_channel_v2.msg;
3735                         uint64_t msg_ref = 0;
3736                         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
3737                         msg_ref = tag_ptr(msg_var.inner, false);
3738         return msg_ref;
3739 }
3740 int8_tArray __attribute__((export_name("TS_LDKMessageSendEvent_SendFundingCreated_get_node_id"))) TS_LDKMessageSendEvent_SendFundingCreated_get_node_id(uint64_t ptr) {
3741         LDKMessageSendEvent *obj = (LDKMessageSendEvent*)untag_ptr(ptr);
3742         assert(obj->tag == LDKMessageSendEvent_SendFundingCreated);
3743         int8_tArray node_id_arr = init_int8_tArray(33, __LINE__);
3744         memcpy(node_id_arr->elems, obj->send_funding_created.node_id.compressed_form, 33);
3745         return node_id_arr;
3746 }
3747 uint64_t __attribute__((export_name("TS_LDKMessageSendEvent_SendFundingCreated_get_msg"))) TS_LDKMessageSendEvent_SendFundingCreated_get_msg(uint64_t ptr) {
3748         LDKMessageSendEvent *obj = (LDKMessageSendEvent*)untag_ptr(ptr);
3749         assert(obj->tag == LDKMessageSendEvent_SendFundingCreated);
3750         LDKFundingCreated msg_var = obj->send_funding_created.msg;
3751                         uint64_t msg_ref = 0;
3752                         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
3753                         msg_ref = tag_ptr(msg_var.inner, false);
3754         return msg_ref;
3755 }
3756 int8_tArray __attribute__((export_name("TS_LDKMessageSendEvent_SendFundingSigned_get_node_id"))) TS_LDKMessageSendEvent_SendFundingSigned_get_node_id(uint64_t ptr) {
3757         LDKMessageSendEvent *obj = (LDKMessageSendEvent*)untag_ptr(ptr);
3758         assert(obj->tag == LDKMessageSendEvent_SendFundingSigned);
3759         int8_tArray node_id_arr = init_int8_tArray(33, __LINE__);
3760         memcpy(node_id_arr->elems, obj->send_funding_signed.node_id.compressed_form, 33);
3761         return node_id_arr;
3762 }
3763 uint64_t __attribute__((export_name("TS_LDKMessageSendEvent_SendFundingSigned_get_msg"))) TS_LDKMessageSendEvent_SendFundingSigned_get_msg(uint64_t ptr) {
3764         LDKMessageSendEvent *obj = (LDKMessageSendEvent*)untag_ptr(ptr);
3765         assert(obj->tag == LDKMessageSendEvent_SendFundingSigned);
3766         LDKFundingSigned msg_var = obj->send_funding_signed.msg;
3767                         uint64_t msg_ref = 0;
3768                         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
3769                         msg_ref = tag_ptr(msg_var.inner, false);
3770         return msg_ref;
3771 }
3772 int8_tArray __attribute__((export_name("TS_LDKMessageSendEvent_SendTxAddInput_get_node_id"))) TS_LDKMessageSendEvent_SendTxAddInput_get_node_id(uint64_t ptr) {
3773         LDKMessageSendEvent *obj = (LDKMessageSendEvent*)untag_ptr(ptr);
3774         assert(obj->tag == LDKMessageSendEvent_SendTxAddInput);
3775         int8_tArray node_id_arr = init_int8_tArray(33, __LINE__);
3776         memcpy(node_id_arr->elems, obj->send_tx_add_input.node_id.compressed_form, 33);
3777         return node_id_arr;
3778 }
3779 uint64_t __attribute__((export_name("TS_LDKMessageSendEvent_SendTxAddInput_get_msg"))) TS_LDKMessageSendEvent_SendTxAddInput_get_msg(uint64_t ptr) {
3780         LDKMessageSendEvent *obj = (LDKMessageSendEvent*)untag_ptr(ptr);
3781         assert(obj->tag == LDKMessageSendEvent_SendTxAddInput);
3782         LDKTxAddInput msg_var = obj->send_tx_add_input.msg;
3783                         uint64_t msg_ref = 0;
3784                         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
3785                         msg_ref = tag_ptr(msg_var.inner, false);
3786         return msg_ref;
3787 }
3788 int8_tArray __attribute__((export_name("TS_LDKMessageSendEvent_SendTxAddOutput_get_node_id"))) TS_LDKMessageSendEvent_SendTxAddOutput_get_node_id(uint64_t ptr) {
3789         LDKMessageSendEvent *obj = (LDKMessageSendEvent*)untag_ptr(ptr);
3790         assert(obj->tag == LDKMessageSendEvent_SendTxAddOutput);
3791         int8_tArray node_id_arr = init_int8_tArray(33, __LINE__);
3792         memcpy(node_id_arr->elems, obj->send_tx_add_output.node_id.compressed_form, 33);
3793         return node_id_arr;
3794 }
3795 uint64_t __attribute__((export_name("TS_LDKMessageSendEvent_SendTxAddOutput_get_msg"))) TS_LDKMessageSendEvent_SendTxAddOutput_get_msg(uint64_t ptr) {
3796         LDKMessageSendEvent *obj = (LDKMessageSendEvent*)untag_ptr(ptr);
3797         assert(obj->tag == LDKMessageSendEvent_SendTxAddOutput);
3798         LDKTxAddOutput msg_var = obj->send_tx_add_output.msg;
3799                         uint64_t msg_ref = 0;
3800                         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
3801                         msg_ref = tag_ptr(msg_var.inner, false);
3802         return msg_ref;
3803 }
3804 int8_tArray __attribute__((export_name("TS_LDKMessageSendEvent_SendTxRemoveInput_get_node_id"))) TS_LDKMessageSendEvent_SendTxRemoveInput_get_node_id(uint64_t ptr) {
3805         LDKMessageSendEvent *obj = (LDKMessageSendEvent*)untag_ptr(ptr);
3806         assert(obj->tag == LDKMessageSendEvent_SendTxRemoveInput);
3807         int8_tArray node_id_arr = init_int8_tArray(33, __LINE__);
3808         memcpy(node_id_arr->elems, obj->send_tx_remove_input.node_id.compressed_form, 33);
3809         return node_id_arr;
3810 }
3811 uint64_t __attribute__((export_name("TS_LDKMessageSendEvent_SendTxRemoveInput_get_msg"))) TS_LDKMessageSendEvent_SendTxRemoveInput_get_msg(uint64_t ptr) {
3812         LDKMessageSendEvent *obj = (LDKMessageSendEvent*)untag_ptr(ptr);
3813         assert(obj->tag == LDKMessageSendEvent_SendTxRemoveInput);
3814         LDKTxRemoveInput msg_var = obj->send_tx_remove_input.msg;
3815                         uint64_t msg_ref = 0;
3816                         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
3817                         msg_ref = tag_ptr(msg_var.inner, false);
3818         return msg_ref;
3819 }
3820 int8_tArray __attribute__((export_name("TS_LDKMessageSendEvent_SendTxRemoveOutput_get_node_id"))) TS_LDKMessageSendEvent_SendTxRemoveOutput_get_node_id(uint64_t ptr) {
3821         LDKMessageSendEvent *obj = (LDKMessageSendEvent*)untag_ptr(ptr);
3822         assert(obj->tag == LDKMessageSendEvent_SendTxRemoveOutput);
3823         int8_tArray node_id_arr = init_int8_tArray(33, __LINE__);
3824         memcpy(node_id_arr->elems, obj->send_tx_remove_output.node_id.compressed_form, 33);
3825         return node_id_arr;
3826 }
3827 uint64_t __attribute__((export_name("TS_LDKMessageSendEvent_SendTxRemoveOutput_get_msg"))) TS_LDKMessageSendEvent_SendTxRemoveOutput_get_msg(uint64_t ptr) {
3828         LDKMessageSendEvent *obj = (LDKMessageSendEvent*)untag_ptr(ptr);
3829         assert(obj->tag == LDKMessageSendEvent_SendTxRemoveOutput);
3830         LDKTxRemoveOutput msg_var = obj->send_tx_remove_output.msg;
3831                         uint64_t msg_ref = 0;
3832                         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
3833                         msg_ref = tag_ptr(msg_var.inner, false);
3834         return msg_ref;
3835 }
3836 int8_tArray __attribute__((export_name("TS_LDKMessageSendEvent_SendTxComplete_get_node_id"))) TS_LDKMessageSendEvent_SendTxComplete_get_node_id(uint64_t ptr) {
3837         LDKMessageSendEvent *obj = (LDKMessageSendEvent*)untag_ptr(ptr);
3838         assert(obj->tag == LDKMessageSendEvent_SendTxComplete);
3839         int8_tArray node_id_arr = init_int8_tArray(33, __LINE__);
3840         memcpy(node_id_arr->elems, obj->send_tx_complete.node_id.compressed_form, 33);
3841         return node_id_arr;
3842 }
3843 uint64_t __attribute__((export_name("TS_LDKMessageSendEvent_SendTxComplete_get_msg"))) TS_LDKMessageSendEvent_SendTxComplete_get_msg(uint64_t ptr) {
3844         LDKMessageSendEvent *obj = (LDKMessageSendEvent*)untag_ptr(ptr);
3845         assert(obj->tag == LDKMessageSendEvent_SendTxComplete);
3846         LDKTxComplete msg_var = obj->send_tx_complete.msg;
3847                         uint64_t msg_ref = 0;
3848                         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
3849                         msg_ref = tag_ptr(msg_var.inner, false);
3850         return msg_ref;
3851 }
3852 int8_tArray __attribute__((export_name("TS_LDKMessageSendEvent_SendTxSignatures_get_node_id"))) TS_LDKMessageSendEvent_SendTxSignatures_get_node_id(uint64_t ptr) {
3853         LDKMessageSendEvent *obj = (LDKMessageSendEvent*)untag_ptr(ptr);
3854         assert(obj->tag == LDKMessageSendEvent_SendTxSignatures);
3855         int8_tArray node_id_arr = init_int8_tArray(33, __LINE__);
3856         memcpy(node_id_arr->elems, obj->send_tx_signatures.node_id.compressed_form, 33);
3857         return node_id_arr;
3858 }
3859 uint64_t __attribute__((export_name("TS_LDKMessageSendEvent_SendTxSignatures_get_msg"))) TS_LDKMessageSendEvent_SendTxSignatures_get_msg(uint64_t ptr) {
3860         LDKMessageSendEvent *obj = (LDKMessageSendEvent*)untag_ptr(ptr);
3861         assert(obj->tag == LDKMessageSendEvent_SendTxSignatures);
3862         LDKTxSignatures msg_var = obj->send_tx_signatures.msg;
3863                         uint64_t msg_ref = 0;
3864                         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
3865                         msg_ref = tag_ptr(msg_var.inner, false);
3866         return msg_ref;
3867 }
3868 int8_tArray __attribute__((export_name("TS_LDKMessageSendEvent_SendTxInitRbf_get_node_id"))) TS_LDKMessageSendEvent_SendTxInitRbf_get_node_id(uint64_t ptr) {
3869         LDKMessageSendEvent *obj = (LDKMessageSendEvent*)untag_ptr(ptr);
3870         assert(obj->tag == LDKMessageSendEvent_SendTxInitRbf);
3871         int8_tArray node_id_arr = init_int8_tArray(33, __LINE__);
3872         memcpy(node_id_arr->elems, obj->send_tx_init_rbf.node_id.compressed_form, 33);
3873         return node_id_arr;
3874 }
3875 uint64_t __attribute__((export_name("TS_LDKMessageSendEvent_SendTxInitRbf_get_msg"))) TS_LDKMessageSendEvent_SendTxInitRbf_get_msg(uint64_t ptr) {
3876         LDKMessageSendEvent *obj = (LDKMessageSendEvent*)untag_ptr(ptr);
3877         assert(obj->tag == LDKMessageSendEvent_SendTxInitRbf);
3878         LDKTxInitRbf msg_var = obj->send_tx_init_rbf.msg;
3879                         uint64_t msg_ref = 0;
3880                         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
3881                         msg_ref = tag_ptr(msg_var.inner, false);
3882         return msg_ref;
3883 }
3884 int8_tArray __attribute__((export_name("TS_LDKMessageSendEvent_SendTxAckRbf_get_node_id"))) TS_LDKMessageSendEvent_SendTxAckRbf_get_node_id(uint64_t ptr) {
3885         LDKMessageSendEvent *obj = (LDKMessageSendEvent*)untag_ptr(ptr);
3886         assert(obj->tag == LDKMessageSendEvent_SendTxAckRbf);
3887         int8_tArray node_id_arr = init_int8_tArray(33, __LINE__);
3888         memcpy(node_id_arr->elems, obj->send_tx_ack_rbf.node_id.compressed_form, 33);
3889         return node_id_arr;
3890 }
3891 uint64_t __attribute__((export_name("TS_LDKMessageSendEvent_SendTxAckRbf_get_msg"))) TS_LDKMessageSendEvent_SendTxAckRbf_get_msg(uint64_t ptr) {
3892         LDKMessageSendEvent *obj = (LDKMessageSendEvent*)untag_ptr(ptr);
3893         assert(obj->tag == LDKMessageSendEvent_SendTxAckRbf);
3894         LDKTxAckRbf msg_var = obj->send_tx_ack_rbf.msg;
3895                         uint64_t msg_ref = 0;
3896                         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
3897                         msg_ref = tag_ptr(msg_var.inner, false);
3898         return msg_ref;
3899 }
3900 int8_tArray __attribute__((export_name("TS_LDKMessageSendEvent_SendTxAbort_get_node_id"))) TS_LDKMessageSendEvent_SendTxAbort_get_node_id(uint64_t ptr) {
3901         LDKMessageSendEvent *obj = (LDKMessageSendEvent*)untag_ptr(ptr);
3902         assert(obj->tag == LDKMessageSendEvent_SendTxAbort);
3903         int8_tArray node_id_arr = init_int8_tArray(33, __LINE__);
3904         memcpy(node_id_arr->elems, obj->send_tx_abort.node_id.compressed_form, 33);
3905         return node_id_arr;
3906 }
3907 uint64_t __attribute__((export_name("TS_LDKMessageSendEvent_SendTxAbort_get_msg"))) TS_LDKMessageSendEvent_SendTxAbort_get_msg(uint64_t ptr) {
3908         LDKMessageSendEvent *obj = (LDKMessageSendEvent*)untag_ptr(ptr);
3909         assert(obj->tag == LDKMessageSendEvent_SendTxAbort);
3910         LDKTxAbort msg_var = obj->send_tx_abort.msg;
3911                         uint64_t msg_ref = 0;
3912                         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
3913                         msg_ref = tag_ptr(msg_var.inner, false);
3914         return msg_ref;
3915 }
3916 int8_tArray __attribute__((export_name("TS_LDKMessageSendEvent_SendChannelReady_get_node_id"))) TS_LDKMessageSendEvent_SendChannelReady_get_node_id(uint64_t ptr) {
3917         LDKMessageSendEvent *obj = (LDKMessageSendEvent*)untag_ptr(ptr);
3918         assert(obj->tag == LDKMessageSendEvent_SendChannelReady);
3919         int8_tArray node_id_arr = init_int8_tArray(33, __LINE__);
3920         memcpy(node_id_arr->elems, obj->send_channel_ready.node_id.compressed_form, 33);
3921         return node_id_arr;
3922 }
3923 uint64_t __attribute__((export_name("TS_LDKMessageSendEvent_SendChannelReady_get_msg"))) TS_LDKMessageSendEvent_SendChannelReady_get_msg(uint64_t ptr) {
3924         LDKMessageSendEvent *obj = (LDKMessageSendEvent*)untag_ptr(ptr);
3925         assert(obj->tag == LDKMessageSendEvent_SendChannelReady);
3926         LDKChannelReady msg_var = obj->send_channel_ready.msg;
3927                         uint64_t msg_ref = 0;
3928                         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
3929                         msg_ref = tag_ptr(msg_var.inner, false);
3930         return msg_ref;
3931 }
3932 int8_tArray __attribute__((export_name("TS_LDKMessageSendEvent_SendAnnouncementSignatures_get_node_id"))) TS_LDKMessageSendEvent_SendAnnouncementSignatures_get_node_id(uint64_t ptr) {
3933         LDKMessageSendEvent *obj = (LDKMessageSendEvent*)untag_ptr(ptr);
3934         assert(obj->tag == LDKMessageSendEvent_SendAnnouncementSignatures);
3935         int8_tArray node_id_arr = init_int8_tArray(33, __LINE__);
3936         memcpy(node_id_arr->elems, obj->send_announcement_signatures.node_id.compressed_form, 33);
3937         return node_id_arr;
3938 }
3939 uint64_t __attribute__((export_name("TS_LDKMessageSendEvent_SendAnnouncementSignatures_get_msg"))) TS_LDKMessageSendEvent_SendAnnouncementSignatures_get_msg(uint64_t ptr) {
3940         LDKMessageSendEvent *obj = (LDKMessageSendEvent*)untag_ptr(ptr);
3941         assert(obj->tag == LDKMessageSendEvent_SendAnnouncementSignatures);
3942         LDKAnnouncementSignatures msg_var = obj->send_announcement_signatures.msg;
3943                         uint64_t msg_ref = 0;
3944                         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
3945                         msg_ref = tag_ptr(msg_var.inner, false);
3946         return msg_ref;
3947 }
3948 int8_tArray __attribute__((export_name("TS_LDKMessageSendEvent_UpdateHTLCs_get_node_id"))) TS_LDKMessageSendEvent_UpdateHTLCs_get_node_id(uint64_t ptr) {
3949         LDKMessageSendEvent *obj = (LDKMessageSendEvent*)untag_ptr(ptr);
3950         assert(obj->tag == LDKMessageSendEvent_UpdateHTLCs);
3951         int8_tArray node_id_arr = init_int8_tArray(33, __LINE__);
3952         memcpy(node_id_arr->elems, obj->update_htl_cs.node_id.compressed_form, 33);
3953         return node_id_arr;
3954 }
3955 uint64_t __attribute__((export_name("TS_LDKMessageSendEvent_UpdateHTLCs_get_updates"))) TS_LDKMessageSendEvent_UpdateHTLCs_get_updates(uint64_t ptr) {
3956         LDKMessageSendEvent *obj = (LDKMessageSendEvent*)untag_ptr(ptr);
3957         assert(obj->tag == LDKMessageSendEvent_UpdateHTLCs);
3958         LDKCommitmentUpdate updates_var = obj->update_htl_cs.updates;
3959                         uint64_t updates_ref = 0;
3960                         CHECK_INNER_FIELD_ACCESS_OR_NULL(updates_var);
3961                         updates_ref = tag_ptr(updates_var.inner, false);
3962         return updates_ref;
3963 }
3964 int8_tArray __attribute__((export_name("TS_LDKMessageSendEvent_SendRevokeAndACK_get_node_id"))) TS_LDKMessageSendEvent_SendRevokeAndACK_get_node_id(uint64_t ptr) {
3965         LDKMessageSendEvent *obj = (LDKMessageSendEvent*)untag_ptr(ptr);
3966         assert(obj->tag == LDKMessageSendEvent_SendRevokeAndACK);
3967         int8_tArray node_id_arr = init_int8_tArray(33, __LINE__);
3968         memcpy(node_id_arr->elems, obj->send_revoke_and_ack.node_id.compressed_form, 33);
3969         return node_id_arr;
3970 }
3971 uint64_t __attribute__((export_name("TS_LDKMessageSendEvent_SendRevokeAndACK_get_msg"))) TS_LDKMessageSendEvent_SendRevokeAndACK_get_msg(uint64_t ptr) {
3972         LDKMessageSendEvent *obj = (LDKMessageSendEvent*)untag_ptr(ptr);
3973         assert(obj->tag == LDKMessageSendEvent_SendRevokeAndACK);
3974         LDKRevokeAndACK msg_var = obj->send_revoke_and_ack.msg;
3975                         uint64_t msg_ref = 0;
3976                         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
3977                         msg_ref = tag_ptr(msg_var.inner, false);
3978         return msg_ref;
3979 }
3980 int8_tArray __attribute__((export_name("TS_LDKMessageSendEvent_SendClosingSigned_get_node_id"))) TS_LDKMessageSendEvent_SendClosingSigned_get_node_id(uint64_t ptr) {
3981         LDKMessageSendEvent *obj = (LDKMessageSendEvent*)untag_ptr(ptr);
3982         assert(obj->tag == LDKMessageSendEvent_SendClosingSigned);
3983         int8_tArray node_id_arr = init_int8_tArray(33, __LINE__);
3984         memcpy(node_id_arr->elems, obj->send_closing_signed.node_id.compressed_form, 33);
3985         return node_id_arr;
3986 }
3987 uint64_t __attribute__((export_name("TS_LDKMessageSendEvent_SendClosingSigned_get_msg"))) TS_LDKMessageSendEvent_SendClosingSigned_get_msg(uint64_t ptr) {
3988         LDKMessageSendEvent *obj = (LDKMessageSendEvent*)untag_ptr(ptr);
3989         assert(obj->tag == LDKMessageSendEvent_SendClosingSigned);
3990         LDKClosingSigned msg_var = obj->send_closing_signed.msg;
3991                         uint64_t msg_ref = 0;
3992                         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
3993                         msg_ref = tag_ptr(msg_var.inner, false);
3994         return msg_ref;
3995 }
3996 int8_tArray __attribute__((export_name("TS_LDKMessageSendEvent_SendShutdown_get_node_id"))) TS_LDKMessageSendEvent_SendShutdown_get_node_id(uint64_t ptr) {
3997         LDKMessageSendEvent *obj = (LDKMessageSendEvent*)untag_ptr(ptr);
3998         assert(obj->tag == LDKMessageSendEvent_SendShutdown);
3999         int8_tArray node_id_arr = init_int8_tArray(33, __LINE__);
4000         memcpy(node_id_arr->elems, obj->send_shutdown.node_id.compressed_form, 33);
4001         return node_id_arr;
4002 }
4003 uint64_t __attribute__((export_name("TS_LDKMessageSendEvent_SendShutdown_get_msg"))) TS_LDKMessageSendEvent_SendShutdown_get_msg(uint64_t ptr) {
4004         LDKMessageSendEvent *obj = (LDKMessageSendEvent*)untag_ptr(ptr);
4005         assert(obj->tag == LDKMessageSendEvent_SendShutdown);
4006         LDKShutdown msg_var = obj->send_shutdown.msg;
4007                         uint64_t msg_ref = 0;
4008                         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
4009                         msg_ref = tag_ptr(msg_var.inner, false);
4010         return msg_ref;
4011 }
4012 int8_tArray __attribute__((export_name("TS_LDKMessageSendEvent_SendChannelReestablish_get_node_id"))) TS_LDKMessageSendEvent_SendChannelReestablish_get_node_id(uint64_t ptr) {
4013         LDKMessageSendEvent *obj = (LDKMessageSendEvent*)untag_ptr(ptr);
4014         assert(obj->tag == LDKMessageSendEvent_SendChannelReestablish);
4015         int8_tArray node_id_arr = init_int8_tArray(33, __LINE__);
4016         memcpy(node_id_arr->elems, obj->send_channel_reestablish.node_id.compressed_form, 33);
4017         return node_id_arr;
4018 }
4019 uint64_t __attribute__((export_name("TS_LDKMessageSendEvent_SendChannelReestablish_get_msg"))) TS_LDKMessageSendEvent_SendChannelReestablish_get_msg(uint64_t ptr) {
4020         LDKMessageSendEvent *obj = (LDKMessageSendEvent*)untag_ptr(ptr);
4021         assert(obj->tag == LDKMessageSendEvent_SendChannelReestablish);
4022         LDKChannelReestablish msg_var = obj->send_channel_reestablish.msg;
4023                         uint64_t msg_ref = 0;
4024                         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
4025                         msg_ref = tag_ptr(msg_var.inner, false);
4026         return msg_ref;
4027 }
4028 int8_tArray __attribute__((export_name("TS_LDKMessageSendEvent_SendChannelAnnouncement_get_node_id"))) TS_LDKMessageSendEvent_SendChannelAnnouncement_get_node_id(uint64_t ptr) {
4029         LDKMessageSendEvent *obj = (LDKMessageSendEvent*)untag_ptr(ptr);
4030         assert(obj->tag == LDKMessageSendEvent_SendChannelAnnouncement);
4031         int8_tArray node_id_arr = init_int8_tArray(33, __LINE__);
4032         memcpy(node_id_arr->elems, obj->send_channel_announcement.node_id.compressed_form, 33);
4033         return node_id_arr;
4034 }
4035 uint64_t __attribute__((export_name("TS_LDKMessageSendEvent_SendChannelAnnouncement_get_msg"))) TS_LDKMessageSendEvent_SendChannelAnnouncement_get_msg(uint64_t ptr) {
4036         LDKMessageSendEvent *obj = (LDKMessageSendEvent*)untag_ptr(ptr);
4037         assert(obj->tag == LDKMessageSendEvent_SendChannelAnnouncement);
4038         LDKChannelAnnouncement msg_var = obj->send_channel_announcement.msg;
4039                         uint64_t msg_ref = 0;
4040                         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
4041                         msg_ref = tag_ptr(msg_var.inner, false);
4042         return msg_ref;
4043 }
4044 uint64_t __attribute__((export_name("TS_LDKMessageSendEvent_SendChannelAnnouncement_get_update_msg"))) TS_LDKMessageSendEvent_SendChannelAnnouncement_get_update_msg(uint64_t ptr) {
4045         LDKMessageSendEvent *obj = (LDKMessageSendEvent*)untag_ptr(ptr);
4046         assert(obj->tag == LDKMessageSendEvent_SendChannelAnnouncement);
4047         LDKChannelUpdate update_msg_var = obj->send_channel_announcement.update_msg;
4048                         uint64_t update_msg_ref = 0;
4049                         CHECK_INNER_FIELD_ACCESS_OR_NULL(update_msg_var);
4050                         update_msg_ref = tag_ptr(update_msg_var.inner, false);
4051         return update_msg_ref;
4052 }
4053 uint64_t __attribute__((export_name("TS_LDKMessageSendEvent_BroadcastChannelAnnouncement_get_msg"))) TS_LDKMessageSendEvent_BroadcastChannelAnnouncement_get_msg(uint64_t ptr) {
4054         LDKMessageSendEvent *obj = (LDKMessageSendEvent*)untag_ptr(ptr);
4055         assert(obj->tag == LDKMessageSendEvent_BroadcastChannelAnnouncement);
4056         LDKChannelAnnouncement msg_var = obj->broadcast_channel_announcement.msg;
4057                         uint64_t msg_ref = 0;
4058                         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
4059                         msg_ref = tag_ptr(msg_var.inner, false);
4060         return msg_ref;
4061 }
4062 uint64_t __attribute__((export_name("TS_LDKMessageSendEvent_BroadcastChannelAnnouncement_get_update_msg"))) TS_LDKMessageSendEvent_BroadcastChannelAnnouncement_get_update_msg(uint64_t ptr) {
4063         LDKMessageSendEvent *obj = (LDKMessageSendEvent*)untag_ptr(ptr);
4064         assert(obj->tag == LDKMessageSendEvent_BroadcastChannelAnnouncement);
4065         LDKChannelUpdate update_msg_var = obj->broadcast_channel_announcement.update_msg;
4066                         uint64_t update_msg_ref = 0;
4067                         CHECK_INNER_FIELD_ACCESS_OR_NULL(update_msg_var);
4068                         update_msg_ref = tag_ptr(update_msg_var.inner, false);
4069         return update_msg_ref;
4070 }
4071 uint64_t __attribute__((export_name("TS_LDKMessageSendEvent_BroadcastChannelUpdate_get_msg"))) TS_LDKMessageSendEvent_BroadcastChannelUpdate_get_msg(uint64_t ptr) {
4072         LDKMessageSendEvent *obj = (LDKMessageSendEvent*)untag_ptr(ptr);
4073         assert(obj->tag == LDKMessageSendEvent_BroadcastChannelUpdate);
4074         LDKChannelUpdate msg_var = obj->broadcast_channel_update.msg;
4075                         uint64_t msg_ref = 0;
4076                         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
4077                         msg_ref = tag_ptr(msg_var.inner, false);
4078         return msg_ref;
4079 }
4080 uint64_t __attribute__((export_name("TS_LDKMessageSendEvent_BroadcastNodeAnnouncement_get_msg"))) TS_LDKMessageSendEvent_BroadcastNodeAnnouncement_get_msg(uint64_t ptr) {
4081         LDKMessageSendEvent *obj = (LDKMessageSendEvent*)untag_ptr(ptr);
4082         assert(obj->tag == LDKMessageSendEvent_BroadcastNodeAnnouncement);
4083         LDKNodeAnnouncement msg_var = obj->broadcast_node_announcement.msg;
4084                         uint64_t msg_ref = 0;
4085                         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
4086                         msg_ref = tag_ptr(msg_var.inner, false);
4087         return msg_ref;
4088 }
4089 int8_tArray __attribute__((export_name("TS_LDKMessageSendEvent_SendChannelUpdate_get_node_id"))) TS_LDKMessageSendEvent_SendChannelUpdate_get_node_id(uint64_t ptr) {
4090         LDKMessageSendEvent *obj = (LDKMessageSendEvent*)untag_ptr(ptr);
4091         assert(obj->tag == LDKMessageSendEvent_SendChannelUpdate);
4092         int8_tArray node_id_arr = init_int8_tArray(33, __LINE__);
4093         memcpy(node_id_arr->elems, obj->send_channel_update.node_id.compressed_form, 33);
4094         return node_id_arr;
4095 }
4096 uint64_t __attribute__((export_name("TS_LDKMessageSendEvent_SendChannelUpdate_get_msg"))) TS_LDKMessageSendEvent_SendChannelUpdate_get_msg(uint64_t ptr) {
4097         LDKMessageSendEvent *obj = (LDKMessageSendEvent*)untag_ptr(ptr);
4098         assert(obj->tag == LDKMessageSendEvent_SendChannelUpdate);
4099         LDKChannelUpdate msg_var = obj->send_channel_update.msg;
4100                         uint64_t msg_ref = 0;
4101                         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
4102                         msg_ref = tag_ptr(msg_var.inner, false);
4103         return msg_ref;
4104 }
4105 int8_tArray __attribute__((export_name("TS_LDKMessageSendEvent_HandleError_get_node_id"))) TS_LDKMessageSendEvent_HandleError_get_node_id(uint64_t ptr) {
4106         LDKMessageSendEvent *obj = (LDKMessageSendEvent*)untag_ptr(ptr);
4107         assert(obj->tag == LDKMessageSendEvent_HandleError);
4108         int8_tArray node_id_arr = init_int8_tArray(33, __LINE__);
4109         memcpy(node_id_arr->elems, obj->handle_error.node_id.compressed_form, 33);
4110         return node_id_arr;
4111 }
4112 uint64_t __attribute__((export_name("TS_LDKMessageSendEvent_HandleError_get_action"))) TS_LDKMessageSendEvent_HandleError_get_action(uint64_t ptr) {
4113         LDKMessageSendEvent *obj = (LDKMessageSendEvent*)untag_ptr(ptr);
4114         assert(obj->tag == LDKMessageSendEvent_HandleError);
4115         uint64_t action_ref = tag_ptr(&obj->handle_error.action, false);
4116         return action_ref;
4117 }
4118 int8_tArray __attribute__((export_name("TS_LDKMessageSendEvent_SendChannelRangeQuery_get_node_id"))) TS_LDKMessageSendEvent_SendChannelRangeQuery_get_node_id(uint64_t ptr) {
4119         LDKMessageSendEvent *obj = (LDKMessageSendEvent*)untag_ptr(ptr);
4120         assert(obj->tag == LDKMessageSendEvent_SendChannelRangeQuery);
4121         int8_tArray node_id_arr = init_int8_tArray(33, __LINE__);
4122         memcpy(node_id_arr->elems, obj->send_channel_range_query.node_id.compressed_form, 33);
4123         return node_id_arr;
4124 }
4125 uint64_t __attribute__((export_name("TS_LDKMessageSendEvent_SendChannelRangeQuery_get_msg"))) TS_LDKMessageSendEvent_SendChannelRangeQuery_get_msg(uint64_t ptr) {
4126         LDKMessageSendEvent *obj = (LDKMessageSendEvent*)untag_ptr(ptr);
4127         assert(obj->tag == LDKMessageSendEvent_SendChannelRangeQuery);
4128         LDKQueryChannelRange msg_var = obj->send_channel_range_query.msg;
4129                         uint64_t msg_ref = 0;
4130                         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
4131                         msg_ref = tag_ptr(msg_var.inner, false);
4132         return msg_ref;
4133 }
4134 int8_tArray __attribute__((export_name("TS_LDKMessageSendEvent_SendShortIdsQuery_get_node_id"))) TS_LDKMessageSendEvent_SendShortIdsQuery_get_node_id(uint64_t ptr) {
4135         LDKMessageSendEvent *obj = (LDKMessageSendEvent*)untag_ptr(ptr);
4136         assert(obj->tag == LDKMessageSendEvent_SendShortIdsQuery);
4137         int8_tArray node_id_arr = init_int8_tArray(33, __LINE__);
4138         memcpy(node_id_arr->elems, obj->send_short_ids_query.node_id.compressed_form, 33);
4139         return node_id_arr;
4140 }
4141 uint64_t __attribute__((export_name("TS_LDKMessageSendEvent_SendShortIdsQuery_get_msg"))) TS_LDKMessageSendEvent_SendShortIdsQuery_get_msg(uint64_t ptr) {
4142         LDKMessageSendEvent *obj = (LDKMessageSendEvent*)untag_ptr(ptr);
4143         assert(obj->tag == LDKMessageSendEvent_SendShortIdsQuery);
4144         LDKQueryShortChannelIds msg_var = obj->send_short_ids_query.msg;
4145                         uint64_t msg_ref = 0;
4146                         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
4147                         msg_ref = tag_ptr(msg_var.inner, false);
4148         return msg_ref;
4149 }
4150 int8_tArray __attribute__((export_name("TS_LDKMessageSendEvent_SendReplyChannelRange_get_node_id"))) TS_LDKMessageSendEvent_SendReplyChannelRange_get_node_id(uint64_t ptr) {
4151         LDKMessageSendEvent *obj = (LDKMessageSendEvent*)untag_ptr(ptr);
4152         assert(obj->tag == LDKMessageSendEvent_SendReplyChannelRange);
4153         int8_tArray node_id_arr = init_int8_tArray(33, __LINE__);
4154         memcpy(node_id_arr->elems, obj->send_reply_channel_range.node_id.compressed_form, 33);
4155         return node_id_arr;
4156 }
4157 uint64_t __attribute__((export_name("TS_LDKMessageSendEvent_SendReplyChannelRange_get_msg"))) TS_LDKMessageSendEvent_SendReplyChannelRange_get_msg(uint64_t ptr) {
4158         LDKMessageSendEvent *obj = (LDKMessageSendEvent*)untag_ptr(ptr);
4159         assert(obj->tag == LDKMessageSendEvent_SendReplyChannelRange);
4160         LDKReplyChannelRange msg_var = obj->send_reply_channel_range.msg;
4161                         uint64_t msg_ref = 0;
4162                         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
4163                         msg_ref = tag_ptr(msg_var.inner, false);
4164         return msg_ref;
4165 }
4166 int8_tArray __attribute__((export_name("TS_LDKMessageSendEvent_SendGossipTimestampFilter_get_node_id"))) TS_LDKMessageSendEvent_SendGossipTimestampFilter_get_node_id(uint64_t ptr) {
4167         LDKMessageSendEvent *obj = (LDKMessageSendEvent*)untag_ptr(ptr);
4168         assert(obj->tag == LDKMessageSendEvent_SendGossipTimestampFilter);
4169         int8_tArray node_id_arr = init_int8_tArray(33, __LINE__);
4170         memcpy(node_id_arr->elems, obj->send_gossip_timestamp_filter.node_id.compressed_form, 33);
4171         return node_id_arr;
4172 }
4173 uint64_t __attribute__((export_name("TS_LDKMessageSendEvent_SendGossipTimestampFilter_get_msg"))) TS_LDKMessageSendEvent_SendGossipTimestampFilter_get_msg(uint64_t ptr) {
4174         LDKMessageSendEvent *obj = (LDKMessageSendEvent*)untag_ptr(ptr);
4175         assert(obj->tag == LDKMessageSendEvent_SendGossipTimestampFilter);
4176         LDKGossipTimestampFilter msg_var = obj->send_gossip_timestamp_filter.msg;
4177                         uint64_t msg_ref = 0;
4178                         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
4179                         msg_ref = tag_ptr(msg_var.inner, false);
4180         return msg_ref;
4181 }
4182 static inline LDKCVec_MessageSendEventZ CVec_MessageSendEventZ_clone(const LDKCVec_MessageSendEventZ *orig) {
4183         LDKCVec_MessageSendEventZ ret = { .data = MALLOC(sizeof(LDKMessageSendEvent) * orig->datalen, "LDKCVec_MessageSendEventZ clone bytes"), .datalen = orig->datalen };
4184         for (size_t i = 0; i < ret.datalen; i++) {
4185                 ret.data[i] = MessageSendEvent_clone(&orig->data[i]);
4186         }
4187         return ret;
4188 }
4189 static inline struct LDKChannelUpdateInfo CResult_ChannelUpdateInfoDecodeErrorZ_get_ok(LDKCResult_ChannelUpdateInfoDecodeErrorZ *NONNULL_PTR owner){
4190         LDKChannelUpdateInfo ret = *owner->contents.result;
4191         ret.is_owned = false;
4192         return ret;
4193 }
4194 uint64_t  __attribute__((export_name("TS_CResult_ChannelUpdateInfoDecodeErrorZ_get_ok"))) TS_CResult_ChannelUpdateInfoDecodeErrorZ_get_ok(uint64_t owner) {
4195         LDKCResult_ChannelUpdateInfoDecodeErrorZ* owner_conv = (LDKCResult_ChannelUpdateInfoDecodeErrorZ*)untag_ptr(owner);
4196         LDKChannelUpdateInfo ret_var = CResult_ChannelUpdateInfoDecodeErrorZ_get_ok(owner_conv);
4197         uint64_t ret_ref = 0;
4198         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
4199         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
4200         return ret_ref;
4201 }
4202
4203 static inline struct LDKDecodeError CResult_ChannelUpdateInfoDecodeErrorZ_get_err(LDKCResult_ChannelUpdateInfoDecodeErrorZ *NONNULL_PTR owner){
4204 CHECK(!owner->result_ok);
4205         return DecodeError_clone(&*owner->contents.err);
4206 }
4207 uint64_t  __attribute__((export_name("TS_CResult_ChannelUpdateInfoDecodeErrorZ_get_err"))) TS_CResult_ChannelUpdateInfoDecodeErrorZ_get_err(uint64_t owner) {
4208         LDKCResult_ChannelUpdateInfoDecodeErrorZ* owner_conv = (LDKCResult_ChannelUpdateInfoDecodeErrorZ*)untag_ptr(owner);
4209         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
4210         *ret_copy = CResult_ChannelUpdateInfoDecodeErrorZ_get_err(owner_conv);
4211         uint64_t ret_ref = tag_ptr(ret_copy, true);
4212         return ret_ref;
4213 }
4214
4215 static inline struct LDKChannelInfo CResult_ChannelInfoDecodeErrorZ_get_ok(LDKCResult_ChannelInfoDecodeErrorZ *NONNULL_PTR owner){
4216         LDKChannelInfo ret = *owner->contents.result;
4217         ret.is_owned = false;
4218         return ret;
4219 }
4220 uint64_t  __attribute__((export_name("TS_CResult_ChannelInfoDecodeErrorZ_get_ok"))) TS_CResult_ChannelInfoDecodeErrorZ_get_ok(uint64_t owner) {
4221         LDKCResult_ChannelInfoDecodeErrorZ* owner_conv = (LDKCResult_ChannelInfoDecodeErrorZ*)untag_ptr(owner);
4222         LDKChannelInfo ret_var = CResult_ChannelInfoDecodeErrorZ_get_ok(owner_conv);
4223         uint64_t ret_ref = 0;
4224         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
4225         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
4226         return ret_ref;
4227 }
4228
4229 static inline struct LDKDecodeError CResult_ChannelInfoDecodeErrorZ_get_err(LDKCResult_ChannelInfoDecodeErrorZ *NONNULL_PTR owner){
4230 CHECK(!owner->result_ok);
4231         return DecodeError_clone(&*owner->contents.err);
4232 }
4233 uint64_t  __attribute__((export_name("TS_CResult_ChannelInfoDecodeErrorZ_get_err"))) TS_CResult_ChannelInfoDecodeErrorZ_get_err(uint64_t owner) {
4234         LDKCResult_ChannelInfoDecodeErrorZ* owner_conv = (LDKCResult_ChannelInfoDecodeErrorZ*)untag_ptr(owner);
4235         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
4236         *ret_copy = CResult_ChannelInfoDecodeErrorZ_get_err(owner_conv);
4237         uint64_t ret_ref = tag_ptr(ret_copy, true);
4238         return ret_ref;
4239 }
4240
4241 static inline struct LDKRoutingFees CResult_RoutingFeesDecodeErrorZ_get_ok(LDKCResult_RoutingFeesDecodeErrorZ *NONNULL_PTR owner){
4242         LDKRoutingFees ret = *owner->contents.result;
4243         ret.is_owned = false;
4244         return ret;
4245 }
4246 uint64_t  __attribute__((export_name("TS_CResult_RoutingFeesDecodeErrorZ_get_ok"))) TS_CResult_RoutingFeesDecodeErrorZ_get_ok(uint64_t owner) {
4247         LDKCResult_RoutingFeesDecodeErrorZ* owner_conv = (LDKCResult_RoutingFeesDecodeErrorZ*)untag_ptr(owner);
4248         LDKRoutingFees ret_var = CResult_RoutingFeesDecodeErrorZ_get_ok(owner_conv);
4249         uint64_t ret_ref = 0;
4250         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
4251         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
4252         return ret_ref;
4253 }
4254
4255 static inline struct LDKDecodeError CResult_RoutingFeesDecodeErrorZ_get_err(LDKCResult_RoutingFeesDecodeErrorZ *NONNULL_PTR owner){
4256 CHECK(!owner->result_ok);
4257         return DecodeError_clone(&*owner->contents.err);
4258 }
4259 uint64_t  __attribute__((export_name("TS_CResult_RoutingFeesDecodeErrorZ_get_err"))) TS_CResult_RoutingFeesDecodeErrorZ_get_err(uint64_t owner) {
4260         LDKCResult_RoutingFeesDecodeErrorZ* owner_conv = (LDKCResult_RoutingFeesDecodeErrorZ*)untag_ptr(owner);
4261         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
4262         *ret_copy = CResult_RoutingFeesDecodeErrorZ_get_err(owner_conv);
4263         uint64_t ret_ref = tag_ptr(ret_copy, true);
4264         return ret_ref;
4265 }
4266
4267 uint32_t __attribute__((export_name("TS_LDKSocketAddress_ty_from_ptr"))) TS_LDKSocketAddress_ty_from_ptr(uint64_t ptr) {
4268         LDKSocketAddress *obj = (LDKSocketAddress*)untag_ptr(ptr);
4269         switch(obj->tag) {
4270                 case LDKSocketAddress_TcpIpV4: return 0;
4271                 case LDKSocketAddress_TcpIpV6: return 1;
4272                 case LDKSocketAddress_OnionV2: return 2;
4273                 case LDKSocketAddress_OnionV3: return 3;
4274                 case LDKSocketAddress_Hostname: return 4;
4275                 default: abort();
4276         }
4277 }
4278 int8_tArray __attribute__((export_name("TS_LDKSocketAddress_TcpIpV4_get_addr"))) TS_LDKSocketAddress_TcpIpV4_get_addr(uint64_t ptr) {
4279         LDKSocketAddress *obj = (LDKSocketAddress*)untag_ptr(ptr);
4280         assert(obj->tag == LDKSocketAddress_TcpIpV4);
4281         int8_tArray addr_arr = init_int8_tArray(4, __LINE__);
4282         memcpy(addr_arr->elems, obj->tcp_ip_v4.addr.data, 4);
4283         return addr_arr;
4284 }
4285 int16_t __attribute__((export_name("TS_LDKSocketAddress_TcpIpV4_get_port"))) TS_LDKSocketAddress_TcpIpV4_get_port(uint64_t ptr) {
4286         LDKSocketAddress *obj = (LDKSocketAddress*)untag_ptr(ptr);
4287         assert(obj->tag == LDKSocketAddress_TcpIpV4);
4288         int16_t port_conv = obj->tcp_ip_v4.port;
4289         return port_conv;
4290 }
4291 int8_tArray __attribute__((export_name("TS_LDKSocketAddress_TcpIpV6_get_addr"))) TS_LDKSocketAddress_TcpIpV6_get_addr(uint64_t ptr) {
4292         LDKSocketAddress *obj = (LDKSocketAddress*)untag_ptr(ptr);
4293         assert(obj->tag == LDKSocketAddress_TcpIpV6);
4294         int8_tArray addr_arr = init_int8_tArray(16, __LINE__);
4295         memcpy(addr_arr->elems, obj->tcp_ip_v6.addr.data, 16);
4296         return addr_arr;
4297 }
4298 int16_t __attribute__((export_name("TS_LDKSocketAddress_TcpIpV6_get_port"))) TS_LDKSocketAddress_TcpIpV6_get_port(uint64_t ptr) {
4299         LDKSocketAddress *obj = (LDKSocketAddress*)untag_ptr(ptr);
4300         assert(obj->tag == LDKSocketAddress_TcpIpV6);
4301         int16_t port_conv = obj->tcp_ip_v6.port;
4302         return port_conv;
4303 }
4304 int8_tArray __attribute__((export_name("TS_LDKSocketAddress_OnionV2_get_onion_v2"))) TS_LDKSocketAddress_OnionV2_get_onion_v2(uint64_t ptr) {
4305         LDKSocketAddress *obj = (LDKSocketAddress*)untag_ptr(ptr);
4306         assert(obj->tag == LDKSocketAddress_OnionV2);
4307         int8_tArray onion_v2_arr = init_int8_tArray(12, __LINE__);
4308         memcpy(onion_v2_arr->elems, obj->onion_v2.data, 12);
4309         return onion_v2_arr;
4310 }
4311 int8_tArray __attribute__((export_name("TS_LDKSocketAddress_OnionV3_get_ed25519_pubkey"))) TS_LDKSocketAddress_OnionV3_get_ed25519_pubkey(uint64_t ptr) {
4312         LDKSocketAddress *obj = (LDKSocketAddress*)untag_ptr(ptr);
4313         assert(obj->tag == LDKSocketAddress_OnionV3);
4314         int8_tArray ed25519_pubkey_arr = init_int8_tArray(32, __LINE__);
4315         memcpy(ed25519_pubkey_arr->elems, obj->onion_v3.ed25519_pubkey.data, 32);
4316         return ed25519_pubkey_arr;
4317 }
4318 int16_t __attribute__((export_name("TS_LDKSocketAddress_OnionV3_get_checksum"))) TS_LDKSocketAddress_OnionV3_get_checksum(uint64_t ptr) {
4319         LDKSocketAddress *obj = (LDKSocketAddress*)untag_ptr(ptr);
4320         assert(obj->tag == LDKSocketAddress_OnionV3);
4321         int16_t checksum_conv = obj->onion_v3.checksum;
4322         return checksum_conv;
4323 }
4324 int8_t __attribute__((export_name("TS_LDKSocketAddress_OnionV3_get_version"))) TS_LDKSocketAddress_OnionV3_get_version(uint64_t ptr) {
4325         LDKSocketAddress *obj = (LDKSocketAddress*)untag_ptr(ptr);
4326         assert(obj->tag == LDKSocketAddress_OnionV3);
4327         int8_t version_conv = obj->onion_v3.version;
4328         return version_conv;
4329 }
4330 int16_t __attribute__((export_name("TS_LDKSocketAddress_OnionV3_get_port"))) TS_LDKSocketAddress_OnionV3_get_port(uint64_t ptr) {
4331         LDKSocketAddress *obj = (LDKSocketAddress*)untag_ptr(ptr);
4332         assert(obj->tag == LDKSocketAddress_OnionV3);
4333         int16_t port_conv = obj->onion_v3.port;
4334         return port_conv;
4335 }
4336 uint64_t __attribute__((export_name("TS_LDKSocketAddress_Hostname_get_hostname"))) TS_LDKSocketAddress_Hostname_get_hostname(uint64_t ptr) {
4337         LDKSocketAddress *obj = (LDKSocketAddress*)untag_ptr(ptr);
4338         assert(obj->tag == LDKSocketAddress_Hostname);
4339         LDKHostname hostname_var = obj->hostname.hostname;
4340                         uint64_t hostname_ref = 0;
4341                         CHECK_INNER_FIELD_ACCESS_OR_NULL(hostname_var);
4342                         hostname_ref = tag_ptr(hostname_var.inner, false);
4343         return hostname_ref;
4344 }
4345 int16_t __attribute__((export_name("TS_LDKSocketAddress_Hostname_get_port"))) TS_LDKSocketAddress_Hostname_get_port(uint64_t ptr) {
4346         LDKSocketAddress *obj = (LDKSocketAddress*)untag_ptr(ptr);
4347         assert(obj->tag == LDKSocketAddress_Hostname);
4348         int16_t port_conv = obj->hostname.port;
4349         return port_conv;
4350 }
4351 static inline LDKCVec_SocketAddressZ CVec_SocketAddressZ_clone(const LDKCVec_SocketAddressZ *orig) {
4352         LDKCVec_SocketAddressZ ret = { .data = MALLOC(sizeof(LDKSocketAddress) * orig->datalen, "LDKCVec_SocketAddressZ clone bytes"), .datalen = orig->datalen };
4353         for (size_t i = 0; i < ret.datalen; i++) {
4354                 ret.data[i] = SocketAddress_clone(&orig->data[i]);
4355         }
4356         return ret;
4357 }
4358 static inline struct LDKNodeAnnouncementInfo CResult_NodeAnnouncementInfoDecodeErrorZ_get_ok(LDKCResult_NodeAnnouncementInfoDecodeErrorZ *NONNULL_PTR owner){
4359         LDKNodeAnnouncementInfo ret = *owner->contents.result;
4360         ret.is_owned = false;
4361         return ret;
4362 }
4363 uint64_t  __attribute__((export_name("TS_CResult_NodeAnnouncementInfoDecodeErrorZ_get_ok"))) TS_CResult_NodeAnnouncementInfoDecodeErrorZ_get_ok(uint64_t owner) {
4364         LDKCResult_NodeAnnouncementInfoDecodeErrorZ* owner_conv = (LDKCResult_NodeAnnouncementInfoDecodeErrorZ*)untag_ptr(owner);
4365         LDKNodeAnnouncementInfo ret_var = CResult_NodeAnnouncementInfoDecodeErrorZ_get_ok(owner_conv);
4366         uint64_t ret_ref = 0;
4367         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
4368         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
4369         return ret_ref;
4370 }
4371
4372 static inline struct LDKDecodeError CResult_NodeAnnouncementInfoDecodeErrorZ_get_err(LDKCResult_NodeAnnouncementInfoDecodeErrorZ *NONNULL_PTR owner){
4373 CHECK(!owner->result_ok);
4374         return DecodeError_clone(&*owner->contents.err);
4375 }
4376 uint64_t  __attribute__((export_name("TS_CResult_NodeAnnouncementInfoDecodeErrorZ_get_err"))) TS_CResult_NodeAnnouncementInfoDecodeErrorZ_get_err(uint64_t owner) {
4377         LDKCResult_NodeAnnouncementInfoDecodeErrorZ* owner_conv = (LDKCResult_NodeAnnouncementInfoDecodeErrorZ*)untag_ptr(owner);
4378         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
4379         *ret_copy = CResult_NodeAnnouncementInfoDecodeErrorZ_get_err(owner_conv);
4380         uint64_t ret_ref = tag_ptr(ret_copy, true);
4381         return ret_ref;
4382 }
4383
4384 static inline struct LDKNodeAlias CResult_NodeAliasDecodeErrorZ_get_ok(LDKCResult_NodeAliasDecodeErrorZ *NONNULL_PTR owner){
4385         LDKNodeAlias ret = *owner->contents.result;
4386         ret.is_owned = false;
4387         return ret;
4388 }
4389 uint64_t  __attribute__((export_name("TS_CResult_NodeAliasDecodeErrorZ_get_ok"))) TS_CResult_NodeAliasDecodeErrorZ_get_ok(uint64_t owner) {
4390         LDKCResult_NodeAliasDecodeErrorZ* owner_conv = (LDKCResult_NodeAliasDecodeErrorZ*)untag_ptr(owner);
4391         LDKNodeAlias ret_var = CResult_NodeAliasDecodeErrorZ_get_ok(owner_conv);
4392         uint64_t ret_ref = 0;
4393         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
4394         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
4395         return ret_ref;
4396 }
4397
4398 static inline struct LDKDecodeError CResult_NodeAliasDecodeErrorZ_get_err(LDKCResult_NodeAliasDecodeErrorZ *NONNULL_PTR owner){
4399 CHECK(!owner->result_ok);
4400         return DecodeError_clone(&*owner->contents.err);
4401 }
4402 uint64_t  __attribute__((export_name("TS_CResult_NodeAliasDecodeErrorZ_get_err"))) TS_CResult_NodeAliasDecodeErrorZ_get_err(uint64_t owner) {
4403         LDKCResult_NodeAliasDecodeErrorZ* owner_conv = (LDKCResult_NodeAliasDecodeErrorZ*)untag_ptr(owner);
4404         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
4405         *ret_copy = CResult_NodeAliasDecodeErrorZ_get_err(owner_conv);
4406         uint64_t ret_ref = tag_ptr(ret_copy, true);
4407         return ret_ref;
4408 }
4409
4410 static inline struct LDKNodeInfo CResult_NodeInfoDecodeErrorZ_get_ok(LDKCResult_NodeInfoDecodeErrorZ *NONNULL_PTR owner){
4411         LDKNodeInfo ret = *owner->contents.result;
4412         ret.is_owned = false;
4413         return ret;
4414 }
4415 uint64_t  __attribute__((export_name("TS_CResult_NodeInfoDecodeErrorZ_get_ok"))) TS_CResult_NodeInfoDecodeErrorZ_get_ok(uint64_t owner) {
4416         LDKCResult_NodeInfoDecodeErrorZ* owner_conv = (LDKCResult_NodeInfoDecodeErrorZ*)untag_ptr(owner);
4417         LDKNodeInfo ret_var = CResult_NodeInfoDecodeErrorZ_get_ok(owner_conv);
4418         uint64_t ret_ref = 0;
4419         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
4420         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
4421         return ret_ref;
4422 }
4423
4424 static inline struct LDKDecodeError CResult_NodeInfoDecodeErrorZ_get_err(LDKCResult_NodeInfoDecodeErrorZ *NONNULL_PTR owner){
4425 CHECK(!owner->result_ok);
4426         return DecodeError_clone(&*owner->contents.err);
4427 }
4428 uint64_t  __attribute__((export_name("TS_CResult_NodeInfoDecodeErrorZ_get_err"))) TS_CResult_NodeInfoDecodeErrorZ_get_err(uint64_t owner) {
4429         LDKCResult_NodeInfoDecodeErrorZ* owner_conv = (LDKCResult_NodeInfoDecodeErrorZ*)untag_ptr(owner);
4430         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
4431         *ret_copy = CResult_NodeInfoDecodeErrorZ_get_err(owner_conv);
4432         uint64_t ret_ref = tag_ptr(ret_copy, true);
4433         return ret_ref;
4434 }
4435
4436 static inline struct LDKNetworkGraph CResult_NetworkGraphDecodeErrorZ_get_ok(LDKCResult_NetworkGraphDecodeErrorZ *NONNULL_PTR owner){
4437         LDKNetworkGraph ret = *owner->contents.result;
4438         ret.is_owned = false;
4439         return ret;
4440 }
4441 uint64_t  __attribute__((export_name("TS_CResult_NetworkGraphDecodeErrorZ_get_ok"))) TS_CResult_NetworkGraphDecodeErrorZ_get_ok(uint64_t owner) {
4442         LDKCResult_NetworkGraphDecodeErrorZ* owner_conv = (LDKCResult_NetworkGraphDecodeErrorZ*)untag_ptr(owner);
4443         LDKNetworkGraph ret_var = CResult_NetworkGraphDecodeErrorZ_get_ok(owner_conv);
4444         uint64_t ret_ref = 0;
4445         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
4446         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
4447         return ret_ref;
4448 }
4449
4450 static inline struct LDKDecodeError CResult_NetworkGraphDecodeErrorZ_get_err(LDKCResult_NetworkGraphDecodeErrorZ *NONNULL_PTR owner){
4451 CHECK(!owner->result_ok);
4452         return DecodeError_clone(&*owner->contents.err);
4453 }
4454 uint64_t  __attribute__((export_name("TS_CResult_NetworkGraphDecodeErrorZ_get_err"))) TS_CResult_NetworkGraphDecodeErrorZ_get_err(uint64_t owner) {
4455         LDKCResult_NetworkGraphDecodeErrorZ* owner_conv = (LDKCResult_NetworkGraphDecodeErrorZ*)untag_ptr(owner);
4456         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
4457         *ret_copy = CResult_NetworkGraphDecodeErrorZ_get_err(owner_conv);
4458         uint64_t ret_ref = tag_ptr(ret_copy, true);
4459         return ret_ref;
4460 }
4461
4462 uint32_t __attribute__((export_name("TS_LDKCOption_CVec_SocketAddressZZ_ty_from_ptr"))) TS_LDKCOption_CVec_SocketAddressZZ_ty_from_ptr(uint64_t ptr) {
4463         LDKCOption_CVec_SocketAddressZZ *obj = (LDKCOption_CVec_SocketAddressZZ*)untag_ptr(ptr);
4464         switch(obj->tag) {
4465                 case LDKCOption_CVec_SocketAddressZZ_Some: return 0;
4466                 case LDKCOption_CVec_SocketAddressZZ_None: return 1;
4467                 default: abort();
4468         }
4469 }
4470 uint64_tArray __attribute__((export_name("TS_LDKCOption_CVec_SocketAddressZZ_Some_get_some"))) TS_LDKCOption_CVec_SocketAddressZZ_Some_get_some(uint64_t ptr) {
4471         LDKCOption_CVec_SocketAddressZZ *obj = (LDKCOption_CVec_SocketAddressZZ*)untag_ptr(ptr);
4472         assert(obj->tag == LDKCOption_CVec_SocketAddressZZ_Some);
4473         LDKCVec_SocketAddressZ some_var = obj->some;
4474                         uint64_tArray some_arr = NULL;
4475                         some_arr = init_uint64_tArray(some_var.datalen, __LINE__);
4476                         uint64_t *some_arr_ptr = (uint64_t*)(((uint8_t*)some_arr) + 8);
4477                         for (size_t p = 0; p < some_var.datalen; p++) {
4478                                 uint64_t some_conv_15_ref = tag_ptr(&some_var.data[p], false);
4479                                 some_arr_ptr[p] = some_conv_15_ref;
4480                         }
4481                         
4482         return some_arr;
4483 }
4484 static inline LDKCVec_HTLCOutputInCommitmentZ CVec_HTLCOutputInCommitmentZ_clone(const LDKCVec_HTLCOutputInCommitmentZ *orig) {
4485         LDKCVec_HTLCOutputInCommitmentZ ret = { .data = MALLOC(sizeof(LDKHTLCOutputInCommitment) * orig->datalen, "LDKCVec_HTLCOutputInCommitmentZ clone bytes"), .datalen = orig->datalen };
4486         for (size_t i = 0; i < ret.datalen; i++) {
4487                 ret.data[i] = HTLCOutputInCommitment_clone(&orig->data[i]);
4488         }
4489         return ret;
4490 }
4491 static inline LDKCVec_HTLCDescriptorZ CVec_HTLCDescriptorZ_clone(const LDKCVec_HTLCDescriptorZ *orig) {
4492         LDKCVec_HTLCDescriptorZ ret = { .data = MALLOC(sizeof(LDKHTLCDescriptor) * orig->datalen, "LDKCVec_HTLCDescriptorZ clone bytes"), .datalen = orig->datalen };
4493         for (size_t i = 0; i < ret.datalen; i++) {
4494                 ret.data[i] = HTLCDescriptor_clone(&orig->data[i]);
4495         }
4496         return ret;
4497 }
4498 static inline LDKCVec_UtxoZ CVec_UtxoZ_clone(const LDKCVec_UtxoZ *orig) {
4499         LDKCVec_UtxoZ ret = { .data = MALLOC(sizeof(LDKUtxo) * orig->datalen, "LDKCVec_UtxoZ clone bytes"), .datalen = orig->datalen };
4500         for (size_t i = 0; i < ret.datalen; i++) {
4501                 ret.data[i] = Utxo_clone(&orig->data[i]);
4502         }
4503         return ret;
4504 }
4505 uint32_t __attribute__((export_name("TS_LDKCOption_TxOutZ_ty_from_ptr"))) TS_LDKCOption_TxOutZ_ty_from_ptr(uint64_t ptr) {
4506         LDKCOption_TxOutZ *obj = (LDKCOption_TxOutZ*)untag_ptr(ptr);
4507         switch(obj->tag) {
4508                 case LDKCOption_TxOutZ_Some: return 0;
4509                 case LDKCOption_TxOutZ_None: return 1;
4510                 default: abort();
4511         }
4512 }
4513 uint64_t __attribute__((export_name("TS_LDKCOption_TxOutZ_Some_get_some"))) TS_LDKCOption_TxOutZ_Some_get_some(uint64_t ptr) {
4514         LDKCOption_TxOutZ *obj = (LDKCOption_TxOutZ*)untag_ptr(ptr);
4515         assert(obj->tag == LDKCOption_TxOutZ_Some);
4516         LDKTxOut* some_ref = &obj->some;
4517         return tag_ptr(some_ref, false);
4518 }
4519 static inline LDKCVec_InputZ CVec_InputZ_clone(const LDKCVec_InputZ *orig) {
4520         LDKCVec_InputZ ret = { .data = MALLOC(sizeof(LDKInput) * orig->datalen, "LDKCVec_InputZ clone bytes"), .datalen = orig->datalen };
4521         for (size_t i = 0; i < ret.datalen; i++) {
4522                 ret.data[i] = Input_clone(&orig->data[i]);
4523         }
4524         return ret;
4525 }
4526 static inline struct LDKCoinSelection CResult_CoinSelectionNoneZ_get_ok(LDKCResult_CoinSelectionNoneZ *NONNULL_PTR owner){
4527         LDKCoinSelection ret = *owner->contents.result;
4528         ret.is_owned = false;
4529         return ret;
4530 }
4531 uint64_t  __attribute__((export_name("TS_CResult_CoinSelectionNoneZ_get_ok"))) TS_CResult_CoinSelectionNoneZ_get_ok(uint64_t owner) {
4532         LDKCResult_CoinSelectionNoneZ* owner_conv = (LDKCResult_CoinSelectionNoneZ*)untag_ptr(owner);
4533         LDKCoinSelection ret_var = CResult_CoinSelectionNoneZ_get_ok(owner_conv);
4534         uint64_t ret_ref = 0;
4535         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
4536         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
4537         return ret_ref;
4538 }
4539
4540 static inline void CResult_CoinSelectionNoneZ_get_err(LDKCResult_CoinSelectionNoneZ *NONNULL_PTR owner){
4541 CHECK(!owner->result_ok);
4542         return *owner->contents.err;
4543 }
4544 void  __attribute__((export_name("TS_CResult_CoinSelectionNoneZ_get_err"))) TS_CResult_CoinSelectionNoneZ_get_err(uint64_t owner) {
4545         LDKCResult_CoinSelectionNoneZ* owner_conv = (LDKCResult_CoinSelectionNoneZ*)untag_ptr(owner);
4546         CResult_CoinSelectionNoneZ_get_err(owner_conv);
4547 }
4548
4549 static inline struct LDKCVec_UtxoZ CResult_CVec_UtxoZNoneZ_get_ok(LDKCResult_CVec_UtxoZNoneZ *NONNULL_PTR owner){
4550 CHECK(owner->result_ok);
4551         return CVec_UtxoZ_clone(&*owner->contents.result);
4552 }
4553 uint64_tArray  __attribute__((export_name("TS_CResult_CVec_UtxoZNoneZ_get_ok"))) TS_CResult_CVec_UtxoZNoneZ_get_ok(uint64_t owner) {
4554         LDKCResult_CVec_UtxoZNoneZ* owner_conv = (LDKCResult_CVec_UtxoZNoneZ*)untag_ptr(owner);
4555         LDKCVec_UtxoZ ret_var = CResult_CVec_UtxoZNoneZ_get_ok(owner_conv);
4556         uint64_tArray ret_arr = NULL;
4557         ret_arr = init_uint64_tArray(ret_var.datalen, __LINE__);
4558         uint64_t *ret_arr_ptr = (uint64_t*)(((uint8_t*)ret_arr) + 8);
4559         for (size_t g = 0; g < ret_var.datalen; g++) {
4560                 LDKUtxo ret_conv_6_var = ret_var.data[g];
4561                 uint64_t ret_conv_6_ref = 0;
4562                 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_conv_6_var);
4563                 ret_conv_6_ref = tag_ptr(ret_conv_6_var.inner, ret_conv_6_var.is_owned);
4564                 ret_arr_ptr[g] = ret_conv_6_ref;
4565         }
4566         
4567         FREE(ret_var.data);
4568         return ret_arr;
4569 }
4570
4571 static inline void CResult_CVec_UtxoZNoneZ_get_err(LDKCResult_CVec_UtxoZNoneZ *NONNULL_PTR owner){
4572 CHECK(!owner->result_ok);
4573         return *owner->contents.err;
4574 }
4575 void  __attribute__((export_name("TS_CResult_CVec_UtxoZNoneZ_get_err"))) TS_CResult_CVec_UtxoZNoneZ_get_err(uint64_t owner) {
4576         LDKCResult_CVec_UtxoZNoneZ* owner_conv = (LDKCResult_CVec_UtxoZNoneZ*)untag_ptr(owner);
4577         CResult_CVec_UtxoZNoneZ_get_err(owner_conv);
4578 }
4579
4580 static inline uint64_t C2Tuple_u64u16Z_get_a(LDKC2Tuple_u64u16Z *NONNULL_PTR owner){
4581         return owner->a;
4582 }
4583 int64_t  __attribute__((export_name("TS_C2Tuple_u64u16Z_get_a"))) TS_C2Tuple_u64u16Z_get_a(uint64_t owner) {
4584         LDKC2Tuple_u64u16Z* owner_conv = (LDKC2Tuple_u64u16Z*)untag_ptr(owner);
4585         int64_t ret_conv = C2Tuple_u64u16Z_get_a(owner_conv);
4586         return ret_conv;
4587 }
4588
4589 static inline uint16_t C2Tuple_u64u16Z_get_b(LDKC2Tuple_u64u16Z *NONNULL_PTR owner){
4590         return owner->b;
4591 }
4592 int16_t  __attribute__((export_name("TS_C2Tuple_u64u16Z_get_b"))) TS_C2Tuple_u64u16Z_get_b(uint64_t owner) {
4593         LDKC2Tuple_u64u16Z* owner_conv = (LDKC2Tuple_u64u16Z*)untag_ptr(owner);
4594         int16_t ret_conv = C2Tuple_u64u16Z_get_b(owner_conv);
4595         return ret_conv;
4596 }
4597
4598 uint32_t __attribute__((export_name("TS_LDKCOption_C2Tuple_u64u16ZZ_ty_from_ptr"))) TS_LDKCOption_C2Tuple_u64u16ZZ_ty_from_ptr(uint64_t ptr) {
4599         LDKCOption_C2Tuple_u64u16ZZ *obj = (LDKCOption_C2Tuple_u64u16ZZ*)untag_ptr(ptr);
4600         switch(obj->tag) {
4601                 case LDKCOption_C2Tuple_u64u16ZZ_Some: return 0;
4602                 case LDKCOption_C2Tuple_u64u16ZZ_None: return 1;
4603                 default: abort();
4604         }
4605 }
4606 uint64_t __attribute__((export_name("TS_LDKCOption_C2Tuple_u64u16ZZ_Some_get_some"))) TS_LDKCOption_C2Tuple_u64u16ZZ_Some_get_some(uint64_t ptr) {
4607         LDKCOption_C2Tuple_u64u16ZZ *obj = (LDKCOption_C2Tuple_u64u16ZZ*)untag_ptr(ptr);
4608         assert(obj->tag == LDKCOption_C2Tuple_u64u16ZZ_Some);
4609         LDKC2Tuple_u64u16Z* some_conv = MALLOC(sizeof(LDKC2Tuple_u64u16Z), "LDKC2Tuple_u64u16Z");
4610         *some_conv = obj->some;
4611                         *some_conv = C2Tuple_u64u16Z_clone(some_conv);
4612         return tag_ptr(some_conv, true);
4613 }
4614 uint32_t __attribute__((export_name("TS_LDKCOption_ChannelShutdownStateZ_ty_from_ptr"))) TS_LDKCOption_ChannelShutdownStateZ_ty_from_ptr(uint64_t ptr) {
4615         LDKCOption_ChannelShutdownStateZ *obj = (LDKCOption_ChannelShutdownStateZ*)untag_ptr(ptr);
4616         switch(obj->tag) {
4617                 case LDKCOption_ChannelShutdownStateZ_Some: return 0;
4618                 case LDKCOption_ChannelShutdownStateZ_None: return 1;
4619                 default: abort();
4620         }
4621 }
4622 uint32_t __attribute__((export_name("TS_LDKCOption_ChannelShutdownStateZ_Some_get_some"))) TS_LDKCOption_ChannelShutdownStateZ_Some_get_some(uint64_t ptr) {
4623         LDKCOption_ChannelShutdownStateZ *obj = (LDKCOption_ChannelShutdownStateZ*)untag_ptr(ptr);
4624         assert(obj->tag == LDKCOption_ChannelShutdownStateZ_Some);
4625         uint32_t some_conv = LDKChannelShutdownState_to_js(obj->some);
4626         return some_conv;
4627 }
4628 static inline struct LDKThirtyTwoBytes CResult_ThirtyTwoBytesAPIErrorZ_get_ok(LDKCResult_ThirtyTwoBytesAPIErrorZ *NONNULL_PTR owner){
4629 CHECK(owner->result_ok);
4630         return ThirtyTwoBytes_clone(&*owner->contents.result);
4631 }
4632 int8_tArray  __attribute__((export_name("TS_CResult_ThirtyTwoBytesAPIErrorZ_get_ok"))) TS_CResult_ThirtyTwoBytesAPIErrorZ_get_ok(uint64_t owner) {
4633         LDKCResult_ThirtyTwoBytesAPIErrorZ* owner_conv = (LDKCResult_ThirtyTwoBytesAPIErrorZ*)untag_ptr(owner);
4634         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
4635         memcpy(ret_arr->elems, CResult_ThirtyTwoBytesAPIErrorZ_get_ok(owner_conv).data, 32);
4636         return ret_arr;
4637 }
4638
4639 static inline struct LDKAPIError CResult_ThirtyTwoBytesAPIErrorZ_get_err(LDKCResult_ThirtyTwoBytesAPIErrorZ *NONNULL_PTR owner){
4640 CHECK(!owner->result_ok);
4641         return APIError_clone(&*owner->contents.err);
4642 }
4643 uint64_t  __attribute__((export_name("TS_CResult_ThirtyTwoBytesAPIErrorZ_get_err"))) TS_CResult_ThirtyTwoBytesAPIErrorZ_get_err(uint64_t owner) {
4644         LDKCResult_ThirtyTwoBytesAPIErrorZ* owner_conv = (LDKCResult_ThirtyTwoBytesAPIErrorZ*)untag_ptr(owner);
4645         LDKAPIError *ret_copy = MALLOC(sizeof(LDKAPIError), "LDKAPIError");
4646         *ret_copy = CResult_ThirtyTwoBytesAPIErrorZ_get_err(owner_conv);
4647         uint64_t ret_ref = tag_ptr(ret_copy, true);
4648         return ret_ref;
4649 }
4650
4651 uint32_t __attribute__((export_name("TS_LDKRecentPaymentDetails_ty_from_ptr"))) TS_LDKRecentPaymentDetails_ty_from_ptr(uint64_t ptr) {
4652         LDKRecentPaymentDetails *obj = (LDKRecentPaymentDetails*)untag_ptr(ptr);
4653         switch(obj->tag) {
4654                 case LDKRecentPaymentDetails_AwaitingInvoice: return 0;
4655                 case LDKRecentPaymentDetails_Pending: return 1;
4656                 case LDKRecentPaymentDetails_Fulfilled: return 2;
4657                 case LDKRecentPaymentDetails_Abandoned: return 3;
4658                 default: abort();
4659         }
4660 }
4661 int8_tArray __attribute__((export_name("TS_LDKRecentPaymentDetails_AwaitingInvoice_get_payment_id"))) TS_LDKRecentPaymentDetails_AwaitingInvoice_get_payment_id(uint64_t ptr) {
4662         LDKRecentPaymentDetails *obj = (LDKRecentPaymentDetails*)untag_ptr(ptr);
4663         assert(obj->tag == LDKRecentPaymentDetails_AwaitingInvoice);
4664         int8_tArray payment_id_arr = init_int8_tArray(32, __LINE__);
4665         memcpy(payment_id_arr->elems, obj->awaiting_invoice.payment_id.data, 32);
4666         return payment_id_arr;
4667 }
4668 int8_tArray __attribute__((export_name("TS_LDKRecentPaymentDetails_Pending_get_payment_id"))) TS_LDKRecentPaymentDetails_Pending_get_payment_id(uint64_t ptr) {
4669         LDKRecentPaymentDetails *obj = (LDKRecentPaymentDetails*)untag_ptr(ptr);
4670         assert(obj->tag == LDKRecentPaymentDetails_Pending);
4671         int8_tArray payment_id_arr = init_int8_tArray(32, __LINE__);
4672         memcpy(payment_id_arr->elems, obj->pending.payment_id.data, 32);
4673         return payment_id_arr;
4674 }
4675 int8_tArray __attribute__((export_name("TS_LDKRecentPaymentDetails_Pending_get_payment_hash"))) TS_LDKRecentPaymentDetails_Pending_get_payment_hash(uint64_t ptr) {
4676         LDKRecentPaymentDetails *obj = (LDKRecentPaymentDetails*)untag_ptr(ptr);
4677         assert(obj->tag == LDKRecentPaymentDetails_Pending);
4678         int8_tArray payment_hash_arr = init_int8_tArray(32, __LINE__);
4679         memcpy(payment_hash_arr->elems, obj->pending.payment_hash.data, 32);
4680         return payment_hash_arr;
4681 }
4682 int64_t __attribute__((export_name("TS_LDKRecentPaymentDetails_Pending_get_total_msat"))) TS_LDKRecentPaymentDetails_Pending_get_total_msat(uint64_t ptr) {
4683         LDKRecentPaymentDetails *obj = (LDKRecentPaymentDetails*)untag_ptr(ptr);
4684         assert(obj->tag == LDKRecentPaymentDetails_Pending);
4685         int64_t total_msat_conv = obj->pending.total_msat;
4686         return total_msat_conv;
4687 }
4688 int8_tArray __attribute__((export_name("TS_LDKRecentPaymentDetails_Fulfilled_get_payment_id"))) TS_LDKRecentPaymentDetails_Fulfilled_get_payment_id(uint64_t ptr) {
4689         LDKRecentPaymentDetails *obj = (LDKRecentPaymentDetails*)untag_ptr(ptr);
4690         assert(obj->tag == LDKRecentPaymentDetails_Fulfilled);
4691         int8_tArray payment_id_arr = init_int8_tArray(32, __LINE__);
4692         memcpy(payment_id_arr->elems, obj->fulfilled.payment_id.data, 32);
4693         return payment_id_arr;
4694 }
4695 uint64_t __attribute__((export_name("TS_LDKRecentPaymentDetails_Fulfilled_get_payment_hash"))) TS_LDKRecentPaymentDetails_Fulfilled_get_payment_hash(uint64_t ptr) {
4696         LDKRecentPaymentDetails *obj = (LDKRecentPaymentDetails*)untag_ptr(ptr);
4697         assert(obj->tag == LDKRecentPaymentDetails_Fulfilled);
4698         uint64_t payment_hash_ref = tag_ptr(&obj->fulfilled.payment_hash, false);
4699         return payment_hash_ref;
4700 }
4701 int8_tArray __attribute__((export_name("TS_LDKRecentPaymentDetails_Abandoned_get_payment_id"))) TS_LDKRecentPaymentDetails_Abandoned_get_payment_id(uint64_t ptr) {
4702         LDKRecentPaymentDetails *obj = (LDKRecentPaymentDetails*)untag_ptr(ptr);
4703         assert(obj->tag == LDKRecentPaymentDetails_Abandoned);
4704         int8_tArray payment_id_arr = init_int8_tArray(32, __LINE__);
4705         memcpy(payment_id_arr->elems, obj->abandoned.payment_id.data, 32);
4706         return payment_id_arr;
4707 }
4708 int8_tArray __attribute__((export_name("TS_LDKRecentPaymentDetails_Abandoned_get_payment_hash"))) TS_LDKRecentPaymentDetails_Abandoned_get_payment_hash(uint64_t ptr) {
4709         LDKRecentPaymentDetails *obj = (LDKRecentPaymentDetails*)untag_ptr(ptr);
4710         assert(obj->tag == LDKRecentPaymentDetails_Abandoned);
4711         int8_tArray payment_hash_arr = init_int8_tArray(32, __LINE__);
4712         memcpy(payment_hash_arr->elems, obj->abandoned.payment_hash.data, 32);
4713         return payment_hash_arr;
4714 }
4715 static inline LDKCVec_RecentPaymentDetailsZ CVec_RecentPaymentDetailsZ_clone(const LDKCVec_RecentPaymentDetailsZ *orig) {
4716         LDKCVec_RecentPaymentDetailsZ ret = { .data = MALLOC(sizeof(LDKRecentPaymentDetails) * orig->datalen, "LDKCVec_RecentPaymentDetailsZ clone bytes"), .datalen = orig->datalen };
4717         for (size_t i = 0; i < ret.datalen; i++) {
4718                 ret.data[i] = RecentPaymentDetails_clone(&orig->data[i]);
4719         }
4720         return ret;
4721 }
4722 uint32_t __attribute__((export_name("TS_LDKPaymentSendFailure_ty_from_ptr"))) TS_LDKPaymentSendFailure_ty_from_ptr(uint64_t ptr) {
4723         LDKPaymentSendFailure *obj = (LDKPaymentSendFailure*)untag_ptr(ptr);
4724         switch(obj->tag) {
4725                 case LDKPaymentSendFailure_ParameterError: return 0;
4726                 case LDKPaymentSendFailure_PathParameterError: return 1;
4727                 case LDKPaymentSendFailure_AllFailedResendSafe: return 2;
4728                 case LDKPaymentSendFailure_DuplicatePayment: return 3;
4729                 case LDKPaymentSendFailure_PartialFailure: return 4;
4730                 default: abort();
4731         }
4732 }
4733 uint64_t __attribute__((export_name("TS_LDKPaymentSendFailure_ParameterError_get_parameter_error"))) TS_LDKPaymentSendFailure_ParameterError_get_parameter_error(uint64_t ptr) {
4734         LDKPaymentSendFailure *obj = (LDKPaymentSendFailure*)untag_ptr(ptr);
4735         assert(obj->tag == LDKPaymentSendFailure_ParameterError);
4736         uint64_t parameter_error_ref = tag_ptr(&obj->parameter_error, false);
4737         return parameter_error_ref;
4738 }
4739 uint64_tArray __attribute__((export_name("TS_LDKPaymentSendFailure_PathParameterError_get_path_parameter_error"))) TS_LDKPaymentSendFailure_PathParameterError_get_path_parameter_error(uint64_t ptr) {
4740         LDKPaymentSendFailure *obj = (LDKPaymentSendFailure*)untag_ptr(ptr);
4741         assert(obj->tag == LDKPaymentSendFailure_PathParameterError);
4742         LDKCVec_CResult_NoneAPIErrorZZ path_parameter_error_var = obj->path_parameter_error;
4743                         uint64_tArray path_parameter_error_arr = NULL;
4744                         path_parameter_error_arr = init_uint64_tArray(path_parameter_error_var.datalen, __LINE__);
4745                         uint64_t *path_parameter_error_arr_ptr = (uint64_t*)(((uint8_t*)path_parameter_error_arr) + 8);
4746                         for (size_t w = 0; w < path_parameter_error_var.datalen; w++) {
4747                                 LDKCResult_NoneAPIErrorZ* path_parameter_error_conv_22_conv = MALLOC(sizeof(LDKCResult_NoneAPIErrorZ), "LDKCResult_NoneAPIErrorZ");
4748                                 *path_parameter_error_conv_22_conv = path_parameter_error_var.data[w];
4749                                 *path_parameter_error_conv_22_conv = CResult_NoneAPIErrorZ_clone(path_parameter_error_conv_22_conv);
4750                                 path_parameter_error_arr_ptr[w] = tag_ptr(path_parameter_error_conv_22_conv, true);
4751                         }
4752                         
4753         return path_parameter_error_arr;
4754 }
4755 uint64_tArray __attribute__((export_name("TS_LDKPaymentSendFailure_AllFailedResendSafe_get_all_failed_resend_safe"))) TS_LDKPaymentSendFailure_AllFailedResendSafe_get_all_failed_resend_safe(uint64_t ptr) {
4756         LDKPaymentSendFailure *obj = (LDKPaymentSendFailure*)untag_ptr(ptr);
4757         assert(obj->tag == LDKPaymentSendFailure_AllFailedResendSafe);
4758         LDKCVec_APIErrorZ all_failed_resend_safe_var = obj->all_failed_resend_safe;
4759                         uint64_tArray all_failed_resend_safe_arr = NULL;
4760                         all_failed_resend_safe_arr = init_uint64_tArray(all_failed_resend_safe_var.datalen, __LINE__);
4761                         uint64_t *all_failed_resend_safe_arr_ptr = (uint64_t*)(((uint8_t*)all_failed_resend_safe_arr) + 8);
4762                         for (size_t k = 0; k < all_failed_resend_safe_var.datalen; k++) {
4763                                 uint64_t all_failed_resend_safe_conv_10_ref = tag_ptr(&all_failed_resend_safe_var.data[k], false);
4764                                 all_failed_resend_safe_arr_ptr[k] = all_failed_resend_safe_conv_10_ref;
4765                         }
4766                         
4767         return all_failed_resend_safe_arr;
4768 }
4769 uint64_tArray __attribute__((export_name("TS_LDKPaymentSendFailure_PartialFailure_get_results"))) TS_LDKPaymentSendFailure_PartialFailure_get_results(uint64_t ptr) {
4770         LDKPaymentSendFailure *obj = (LDKPaymentSendFailure*)untag_ptr(ptr);
4771         assert(obj->tag == LDKPaymentSendFailure_PartialFailure);
4772         LDKCVec_CResult_NoneAPIErrorZZ results_var = obj->partial_failure.results;
4773                         uint64_tArray results_arr = NULL;
4774                         results_arr = init_uint64_tArray(results_var.datalen, __LINE__);
4775                         uint64_t *results_arr_ptr = (uint64_t*)(((uint8_t*)results_arr) + 8);
4776                         for (size_t w = 0; w < results_var.datalen; w++) {
4777                                 LDKCResult_NoneAPIErrorZ* results_conv_22_conv = MALLOC(sizeof(LDKCResult_NoneAPIErrorZ), "LDKCResult_NoneAPIErrorZ");
4778                                 *results_conv_22_conv = results_var.data[w];
4779                                 *results_conv_22_conv = CResult_NoneAPIErrorZ_clone(results_conv_22_conv);
4780                                 results_arr_ptr[w] = tag_ptr(results_conv_22_conv, true);
4781                         }
4782                         
4783         return results_arr;
4784 }
4785 uint64_t __attribute__((export_name("TS_LDKPaymentSendFailure_PartialFailure_get_failed_paths_retry"))) TS_LDKPaymentSendFailure_PartialFailure_get_failed_paths_retry(uint64_t ptr) {
4786         LDKPaymentSendFailure *obj = (LDKPaymentSendFailure*)untag_ptr(ptr);
4787         assert(obj->tag == LDKPaymentSendFailure_PartialFailure);
4788         LDKRouteParameters failed_paths_retry_var = obj->partial_failure.failed_paths_retry;
4789                         uint64_t failed_paths_retry_ref = 0;
4790                         CHECK_INNER_FIELD_ACCESS_OR_NULL(failed_paths_retry_var);
4791                         failed_paths_retry_ref = tag_ptr(failed_paths_retry_var.inner, false);
4792         return failed_paths_retry_ref;
4793 }
4794 int8_tArray __attribute__((export_name("TS_LDKPaymentSendFailure_PartialFailure_get_payment_id"))) TS_LDKPaymentSendFailure_PartialFailure_get_payment_id(uint64_t ptr) {
4795         LDKPaymentSendFailure *obj = (LDKPaymentSendFailure*)untag_ptr(ptr);
4796         assert(obj->tag == LDKPaymentSendFailure_PartialFailure);
4797         int8_tArray payment_id_arr = init_int8_tArray(32, __LINE__);
4798         memcpy(payment_id_arr->elems, obj->partial_failure.payment_id.data, 32);
4799         return payment_id_arr;
4800 }
4801 static inline void CResult_NonePaymentSendFailureZ_get_ok(LDKCResult_NonePaymentSendFailureZ *NONNULL_PTR owner){
4802 CHECK(owner->result_ok);
4803         return *owner->contents.result;
4804 }
4805 void  __attribute__((export_name("TS_CResult_NonePaymentSendFailureZ_get_ok"))) TS_CResult_NonePaymentSendFailureZ_get_ok(uint64_t owner) {
4806         LDKCResult_NonePaymentSendFailureZ* owner_conv = (LDKCResult_NonePaymentSendFailureZ*)untag_ptr(owner);
4807         CResult_NonePaymentSendFailureZ_get_ok(owner_conv);
4808 }
4809
4810 static inline struct LDKPaymentSendFailure CResult_NonePaymentSendFailureZ_get_err(LDKCResult_NonePaymentSendFailureZ *NONNULL_PTR owner){
4811 CHECK(!owner->result_ok);
4812         return PaymentSendFailure_clone(&*owner->contents.err);
4813 }
4814 uint64_t  __attribute__((export_name("TS_CResult_NonePaymentSendFailureZ_get_err"))) TS_CResult_NonePaymentSendFailureZ_get_err(uint64_t owner) {
4815         LDKCResult_NonePaymentSendFailureZ* owner_conv = (LDKCResult_NonePaymentSendFailureZ*)untag_ptr(owner);
4816         LDKPaymentSendFailure *ret_copy = MALLOC(sizeof(LDKPaymentSendFailure), "LDKPaymentSendFailure");
4817         *ret_copy = CResult_NonePaymentSendFailureZ_get_err(owner_conv);
4818         uint64_t ret_ref = tag_ptr(ret_copy, true);
4819         return ret_ref;
4820 }
4821
4822 static inline void CResult_NoneRetryableSendFailureZ_get_ok(LDKCResult_NoneRetryableSendFailureZ *NONNULL_PTR owner){
4823 CHECK(owner->result_ok);
4824         return *owner->contents.result;
4825 }
4826 void  __attribute__((export_name("TS_CResult_NoneRetryableSendFailureZ_get_ok"))) TS_CResult_NoneRetryableSendFailureZ_get_ok(uint64_t owner) {
4827         LDKCResult_NoneRetryableSendFailureZ* owner_conv = (LDKCResult_NoneRetryableSendFailureZ*)untag_ptr(owner);
4828         CResult_NoneRetryableSendFailureZ_get_ok(owner_conv);
4829 }
4830
4831 static inline enum LDKRetryableSendFailure CResult_NoneRetryableSendFailureZ_get_err(LDKCResult_NoneRetryableSendFailureZ *NONNULL_PTR owner){
4832 CHECK(!owner->result_ok);
4833         return RetryableSendFailure_clone(&*owner->contents.err);
4834 }
4835 uint32_t  __attribute__((export_name("TS_CResult_NoneRetryableSendFailureZ_get_err"))) TS_CResult_NoneRetryableSendFailureZ_get_err(uint64_t owner) {
4836         LDKCResult_NoneRetryableSendFailureZ* owner_conv = (LDKCResult_NoneRetryableSendFailureZ*)untag_ptr(owner);
4837         uint32_t ret_conv = LDKRetryableSendFailure_to_js(CResult_NoneRetryableSendFailureZ_get_err(owner_conv));
4838         return ret_conv;
4839 }
4840
4841 static inline struct LDKThirtyTwoBytes CResult_ThirtyTwoBytesPaymentSendFailureZ_get_ok(LDKCResult_ThirtyTwoBytesPaymentSendFailureZ *NONNULL_PTR owner){
4842 CHECK(owner->result_ok);
4843         return ThirtyTwoBytes_clone(&*owner->contents.result);
4844 }
4845 int8_tArray  __attribute__((export_name("TS_CResult_ThirtyTwoBytesPaymentSendFailureZ_get_ok"))) TS_CResult_ThirtyTwoBytesPaymentSendFailureZ_get_ok(uint64_t owner) {
4846         LDKCResult_ThirtyTwoBytesPaymentSendFailureZ* owner_conv = (LDKCResult_ThirtyTwoBytesPaymentSendFailureZ*)untag_ptr(owner);
4847         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
4848         memcpy(ret_arr->elems, CResult_ThirtyTwoBytesPaymentSendFailureZ_get_ok(owner_conv).data, 32);
4849         return ret_arr;
4850 }
4851
4852 static inline struct LDKPaymentSendFailure CResult_ThirtyTwoBytesPaymentSendFailureZ_get_err(LDKCResult_ThirtyTwoBytesPaymentSendFailureZ *NONNULL_PTR owner){
4853 CHECK(!owner->result_ok);
4854         return PaymentSendFailure_clone(&*owner->contents.err);
4855 }
4856 uint64_t  __attribute__((export_name("TS_CResult_ThirtyTwoBytesPaymentSendFailureZ_get_err"))) TS_CResult_ThirtyTwoBytesPaymentSendFailureZ_get_err(uint64_t owner) {
4857         LDKCResult_ThirtyTwoBytesPaymentSendFailureZ* owner_conv = (LDKCResult_ThirtyTwoBytesPaymentSendFailureZ*)untag_ptr(owner);
4858         LDKPaymentSendFailure *ret_copy = MALLOC(sizeof(LDKPaymentSendFailure), "LDKPaymentSendFailure");
4859         *ret_copy = CResult_ThirtyTwoBytesPaymentSendFailureZ_get_err(owner_conv);
4860         uint64_t ret_ref = tag_ptr(ret_copy, true);
4861         return ret_ref;
4862 }
4863
4864 static inline struct LDKThirtyTwoBytes CResult_ThirtyTwoBytesRetryableSendFailureZ_get_ok(LDKCResult_ThirtyTwoBytesRetryableSendFailureZ *NONNULL_PTR owner){
4865 CHECK(owner->result_ok);
4866         return ThirtyTwoBytes_clone(&*owner->contents.result);
4867 }
4868 int8_tArray  __attribute__((export_name("TS_CResult_ThirtyTwoBytesRetryableSendFailureZ_get_ok"))) TS_CResult_ThirtyTwoBytesRetryableSendFailureZ_get_ok(uint64_t owner) {
4869         LDKCResult_ThirtyTwoBytesRetryableSendFailureZ* owner_conv = (LDKCResult_ThirtyTwoBytesRetryableSendFailureZ*)untag_ptr(owner);
4870         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
4871         memcpy(ret_arr->elems, CResult_ThirtyTwoBytesRetryableSendFailureZ_get_ok(owner_conv).data, 32);
4872         return ret_arr;
4873 }
4874
4875 static inline enum LDKRetryableSendFailure CResult_ThirtyTwoBytesRetryableSendFailureZ_get_err(LDKCResult_ThirtyTwoBytesRetryableSendFailureZ *NONNULL_PTR owner){
4876 CHECK(!owner->result_ok);
4877         return RetryableSendFailure_clone(&*owner->contents.err);
4878 }
4879 uint32_t  __attribute__((export_name("TS_CResult_ThirtyTwoBytesRetryableSendFailureZ_get_err"))) TS_CResult_ThirtyTwoBytesRetryableSendFailureZ_get_err(uint64_t owner) {
4880         LDKCResult_ThirtyTwoBytesRetryableSendFailureZ* owner_conv = (LDKCResult_ThirtyTwoBytesRetryableSendFailureZ*)untag_ptr(owner);
4881         uint32_t ret_conv = LDKRetryableSendFailure_to_js(CResult_ThirtyTwoBytesRetryableSendFailureZ_get_err(owner_conv));
4882         return ret_conv;
4883 }
4884
4885 static inline struct LDKThirtyTwoBytes C2Tuple_ThirtyTwoBytesThirtyTwoBytesZ_get_a(LDKC2Tuple_ThirtyTwoBytesThirtyTwoBytesZ *NONNULL_PTR owner){
4886         return ThirtyTwoBytes_clone(&owner->a);
4887 }
4888 int8_tArray  __attribute__((export_name("TS_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZ_get_a"))) TS_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZ_get_a(uint64_t owner) {
4889         LDKC2Tuple_ThirtyTwoBytesThirtyTwoBytesZ* owner_conv = (LDKC2Tuple_ThirtyTwoBytesThirtyTwoBytesZ*)untag_ptr(owner);
4890         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
4891         memcpy(ret_arr->elems, C2Tuple_ThirtyTwoBytesThirtyTwoBytesZ_get_a(owner_conv).data, 32);
4892         return ret_arr;
4893 }
4894
4895 static inline struct LDKThirtyTwoBytes C2Tuple_ThirtyTwoBytesThirtyTwoBytesZ_get_b(LDKC2Tuple_ThirtyTwoBytesThirtyTwoBytesZ *NONNULL_PTR owner){
4896         return ThirtyTwoBytes_clone(&owner->b);
4897 }
4898 int8_tArray  __attribute__((export_name("TS_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZ_get_b"))) TS_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZ_get_b(uint64_t owner) {
4899         LDKC2Tuple_ThirtyTwoBytesThirtyTwoBytesZ* owner_conv = (LDKC2Tuple_ThirtyTwoBytesThirtyTwoBytesZ*)untag_ptr(owner);
4900         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
4901         memcpy(ret_arr->elems, C2Tuple_ThirtyTwoBytesThirtyTwoBytesZ_get_b(owner_conv).data, 32);
4902         return ret_arr;
4903 }
4904
4905 static inline struct LDKC2Tuple_ThirtyTwoBytesThirtyTwoBytesZ CResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZPaymentSendFailureZ_get_ok(LDKCResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZPaymentSendFailureZ *NONNULL_PTR owner){
4906 CHECK(owner->result_ok);
4907         return C2Tuple_ThirtyTwoBytesThirtyTwoBytesZ_clone(&*owner->contents.result);
4908 }
4909 uint64_t  __attribute__((export_name("TS_CResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZPaymentSendFailureZ_get_ok"))) TS_CResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZPaymentSendFailureZ_get_ok(uint64_t owner) {
4910         LDKCResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZPaymentSendFailureZ* owner_conv = (LDKCResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZPaymentSendFailureZ*)untag_ptr(owner);
4911         LDKC2Tuple_ThirtyTwoBytesThirtyTwoBytesZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_ThirtyTwoBytesThirtyTwoBytesZ), "LDKC2Tuple_ThirtyTwoBytesThirtyTwoBytesZ");
4912         *ret_conv = CResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZPaymentSendFailureZ_get_ok(owner_conv);
4913         return tag_ptr(ret_conv, true);
4914 }
4915
4916 static inline struct LDKPaymentSendFailure CResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZPaymentSendFailureZ_get_err(LDKCResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZPaymentSendFailureZ *NONNULL_PTR owner){
4917 CHECK(!owner->result_ok);
4918         return PaymentSendFailure_clone(&*owner->contents.err);
4919 }
4920 uint64_t  __attribute__((export_name("TS_CResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZPaymentSendFailureZ_get_err"))) TS_CResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZPaymentSendFailureZ_get_err(uint64_t owner) {
4921         LDKCResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZPaymentSendFailureZ* owner_conv = (LDKCResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZPaymentSendFailureZ*)untag_ptr(owner);
4922         LDKPaymentSendFailure *ret_copy = MALLOC(sizeof(LDKPaymentSendFailure), "LDKPaymentSendFailure");
4923         *ret_copy = CResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZPaymentSendFailureZ_get_err(owner_conv);
4924         uint64_t ret_ref = tag_ptr(ret_copy, true);
4925         return ret_ref;
4926 }
4927
4928 static inline LDKCVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZ CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZ_clone(const LDKCVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZ *orig) {
4929         LDKCVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZ ret = { .data = MALLOC(sizeof(LDKC2Tuple_ThirtyTwoBytesThirtyTwoBytesZ) * orig->datalen, "LDKCVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZ clone bytes"), .datalen = orig->datalen };
4930         for (size_t i = 0; i < ret.datalen; i++) {
4931                 ret.data[i] = C2Tuple_ThirtyTwoBytesThirtyTwoBytesZ_clone(&orig->data[i]);
4932         }
4933         return ret;
4934 }
4935 uint32_t __attribute__((export_name("TS_LDKProbeSendFailure_ty_from_ptr"))) TS_LDKProbeSendFailure_ty_from_ptr(uint64_t ptr) {
4936         LDKProbeSendFailure *obj = (LDKProbeSendFailure*)untag_ptr(ptr);
4937         switch(obj->tag) {
4938                 case LDKProbeSendFailure_RouteNotFound: return 0;
4939                 case LDKProbeSendFailure_SendingFailed: return 1;
4940                 default: abort();
4941         }
4942 }
4943 uint64_t __attribute__((export_name("TS_LDKProbeSendFailure_SendingFailed_get_sending_failed"))) TS_LDKProbeSendFailure_SendingFailed_get_sending_failed(uint64_t ptr) {
4944         LDKProbeSendFailure *obj = (LDKProbeSendFailure*)untag_ptr(ptr);
4945         assert(obj->tag == LDKProbeSendFailure_SendingFailed);
4946         uint64_t sending_failed_ref = tag_ptr(&obj->sending_failed, false);
4947         return sending_failed_ref;
4948 }
4949 static inline struct LDKCVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZ CResult_CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZProbeSendFailureZ_get_ok(LDKCResult_CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZProbeSendFailureZ *NONNULL_PTR owner){
4950 CHECK(owner->result_ok);
4951         return CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZ_clone(&*owner->contents.result);
4952 }
4953 uint64_tArray  __attribute__((export_name("TS_CResult_CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZProbeSendFailureZ_get_ok"))) TS_CResult_CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZProbeSendFailureZ_get_ok(uint64_t owner) {
4954         LDKCResult_CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZProbeSendFailureZ* owner_conv = (LDKCResult_CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZProbeSendFailureZ*)untag_ptr(owner);
4955         LDKCVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZ ret_var = CResult_CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZProbeSendFailureZ_get_ok(owner_conv);
4956         uint64_tArray ret_arr = NULL;
4957         ret_arr = init_uint64_tArray(ret_var.datalen, __LINE__);
4958         uint64_t *ret_arr_ptr = (uint64_t*)(((uint8_t*)ret_arr) + 8);
4959         for (size_t o = 0; o < ret_var.datalen; o++) {
4960                 LDKC2Tuple_ThirtyTwoBytesThirtyTwoBytesZ* ret_conv_40_conv = MALLOC(sizeof(LDKC2Tuple_ThirtyTwoBytesThirtyTwoBytesZ), "LDKC2Tuple_ThirtyTwoBytesThirtyTwoBytesZ");
4961                 *ret_conv_40_conv = ret_var.data[o];
4962                 ret_arr_ptr[o] = tag_ptr(ret_conv_40_conv, true);
4963         }
4964         
4965         FREE(ret_var.data);
4966         return ret_arr;
4967 }
4968
4969 static inline struct LDKProbeSendFailure CResult_CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZProbeSendFailureZ_get_err(LDKCResult_CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZProbeSendFailureZ *NONNULL_PTR owner){
4970 CHECK(!owner->result_ok);
4971         return ProbeSendFailure_clone(&*owner->contents.err);
4972 }
4973 uint64_t  __attribute__((export_name("TS_CResult_CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZProbeSendFailureZ_get_err"))) TS_CResult_CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZProbeSendFailureZ_get_err(uint64_t owner) {
4974         LDKCResult_CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZProbeSendFailureZ* owner_conv = (LDKCResult_CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZProbeSendFailureZ*)untag_ptr(owner);
4975         LDKProbeSendFailure *ret_copy = MALLOC(sizeof(LDKProbeSendFailure), "LDKProbeSendFailure");
4976         *ret_copy = CResult_CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZProbeSendFailureZ_get_err(owner_conv);
4977         uint64_t ret_ref = tag_ptr(ret_copy, true);
4978         return ret_ref;
4979 }
4980
4981 static inline struct LDKThirtyTwoBytes C2Tuple_ThirtyTwoBytesPublicKeyZ_get_a(LDKC2Tuple_ThirtyTwoBytesPublicKeyZ *NONNULL_PTR owner){
4982         return ThirtyTwoBytes_clone(&owner->a);
4983 }
4984 int8_tArray  __attribute__((export_name("TS_C2Tuple_ThirtyTwoBytesPublicKeyZ_get_a"))) TS_C2Tuple_ThirtyTwoBytesPublicKeyZ_get_a(uint64_t owner) {
4985         LDKC2Tuple_ThirtyTwoBytesPublicKeyZ* owner_conv = (LDKC2Tuple_ThirtyTwoBytesPublicKeyZ*)untag_ptr(owner);
4986         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
4987         memcpy(ret_arr->elems, C2Tuple_ThirtyTwoBytesPublicKeyZ_get_a(owner_conv).data, 32);
4988         return ret_arr;
4989 }
4990
4991 static inline struct LDKPublicKey C2Tuple_ThirtyTwoBytesPublicKeyZ_get_b(LDKC2Tuple_ThirtyTwoBytesPublicKeyZ *NONNULL_PTR owner){
4992         return owner->b;
4993 }
4994 int8_tArray  __attribute__((export_name("TS_C2Tuple_ThirtyTwoBytesPublicKeyZ_get_b"))) TS_C2Tuple_ThirtyTwoBytesPublicKeyZ_get_b(uint64_t owner) {
4995         LDKC2Tuple_ThirtyTwoBytesPublicKeyZ* owner_conv = (LDKC2Tuple_ThirtyTwoBytesPublicKeyZ*)untag_ptr(owner);
4996         int8_tArray ret_arr = init_int8_tArray(33, __LINE__);
4997         memcpy(ret_arr->elems, C2Tuple_ThirtyTwoBytesPublicKeyZ_get_b(owner_conv).compressed_form, 33);
4998         return ret_arr;
4999 }
5000
5001 static inline LDKCVec_C2Tuple_ThirtyTwoBytesPublicKeyZZ CVec_C2Tuple_ThirtyTwoBytesPublicKeyZZ_clone(const LDKCVec_C2Tuple_ThirtyTwoBytesPublicKeyZZ *orig) {
5002         LDKCVec_C2Tuple_ThirtyTwoBytesPublicKeyZZ ret = { .data = MALLOC(sizeof(LDKC2Tuple_ThirtyTwoBytesPublicKeyZ) * orig->datalen, "LDKCVec_C2Tuple_ThirtyTwoBytesPublicKeyZZ clone bytes"), .datalen = orig->datalen };
5003         for (size_t i = 0; i < ret.datalen; i++) {
5004                 ret.data[i] = C2Tuple_ThirtyTwoBytesPublicKeyZ_clone(&orig->data[i]);
5005         }
5006         return ret;
5007 }
5008 uint32_t __attribute__((export_name("TS_LDKCOption_StrZ_ty_from_ptr"))) TS_LDKCOption_StrZ_ty_from_ptr(uint64_t ptr) {
5009         LDKCOption_StrZ *obj = (LDKCOption_StrZ*)untag_ptr(ptr);
5010         switch(obj->tag) {
5011                 case LDKCOption_StrZ_Some: return 0;
5012                 case LDKCOption_StrZ_None: return 1;
5013                 default: abort();
5014         }
5015 }
5016 jstring __attribute__((export_name("TS_LDKCOption_StrZ_Some_get_some"))) TS_LDKCOption_StrZ_Some_get_some(uint64_t ptr) {
5017         LDKCOption_StrZ *obj = (LDKCOption_StrZ*)untag_ptr(ptr);
5018         assert(obj->tag == LDKCOption_StrZ_Some);
5019         LDKStr some_str = obj->some;
5020                         jstring some_conv = str_ref_to_ts(some_str.chars, some_str.len);
5021         return some_conv;
5022 }
5023 static inline void CResult_NoneBolt12SemanticErrorZ_get_ok(LDKCResult_NoneBolt12SemanticErrorZ *NONNULL_PTR owner){
5024 CHECK(owner->result_ok);
5025         return *owner->contents.result;
5026 }
5027 void  __attribute__((export_name("TS_CResult_NoneBolt12SemanticErrorZ_get_ok"))) TS_CResult_NoneBolt12SemanticErrorZ_get_ok(uint64_t owner) {
5028         LDKCResult_NoneBolt12SemanticErrorZ* owner_conv = (LDKCResult_NoneBolt12SemanticErrorZ*)untag_ptr(owner);
5029         CResult_NoneBolt12SemanticErrorZ_get_ok(owner_conv);
5030 }
5031
5032 static inline enum LDKBolt12SemanticError CResult_NoneBolt12SemanticErrorZ_get_err(LDKCResult_NoneBolt12SemanticErrorZ *NONNULL_PTR owner){
5033 CHECK(!owner->result_ok);
5034         return Bolt12SemanticError_clone(&*owner->contents.err);
5035 }
5036 uint32_t  __attribute__((export_name("TS_CResult_NoneBolt12SemanticErrorZ_get_err"))) TS_CResult_NoneBolt12SemanticErrorZ_get_err(uint64_t owner) {
5037         LDKCResult_NoneBolt12SemanticErrorZ* owner_conv = (LDKCResult_NoneBolt12SemanticErrorZ*)untag_ptr(owner);
5038         uint32_t ret_conv = LDKBolt12SemanticError_to_js(CResult_NoneBolt12SemanticErrorZ_get_err(owner_conv));
5039         return ret_conv;
5040 }
5041
5042 static inline struct LDKC2Tuple_ThirtyTwoBytesThirtyTwoBytesZ CResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZNoneZ_get_ok(LDKCResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZNoneZ *NONNULL_PTR owner){
5043 CHECK(owner->result_ok);
5044         return C2Tuple_ThirtyTwoBytesThirtyTwoBytesZ_clone(&*owner->contents.result);
5045 }
5046 uint64_t  __attribute__((export_name("TS_CResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZNoneZ_get_ok"))) TS_CResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZNoneZ_get_ok(uint64_t owner) {
5047         LDKCResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZNoneZ* owner_conv = (LDKCResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZNoneZ*)untag_ptr(owner);
5048         LDKC2Tuple_ThirtyTwoBytesThirtyTwoBytesZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_ThirtyTwoBytesThirtyTwoBytesZ), "LDKC2Tuple_ThirtyTwoBytesThirtyTwoBytesZ");
5049         *ret_conv = CResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZNoneZ_get_ok(owner_conv);
5050         return tag_ptr(ret_conv, true);
5051 }
5052
5053 static inline void CResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZNoneZ_get_err(LDKCResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZNoneZ *NONNULL_PTR owner){
5054 CHECK(!owner->result_ok);
5055         return *owner->contents.err;
5056 }
5057 void  __attribute__((export_name("TS_CResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZNoneZ_get_err"))) TS_CResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZNoneZ_get_err(uint64_t owner) {
5058         LDKCResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZNoneZ* owner_conv = (LDKCResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZNoneZ*)untag_ptr(owner);
5059         CResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZNoneZ_get_err(owner_conv);
5060 }
5061
5062 uint32_t __attribute__((export_name("TS_LDKOffersMessage_ty_from_ptr"))) TS_LDKOffersMessage_ty_from_ptr(uint64_t ptr) {
5063         LDKOffersMessage *obj = (LDKOffersMessage*)untag_ptr(ptr);
5064         switch(obj->tag) {
5065                 case LDKOffersMessage_InvoiceRequest: return 0;
5066                 case LDKOffersMessage_Invoice: return 1;
5067                 case LDKOffersMessage_InvoiceError: return 2;
5068                 default: abort();
5069         }
5070 }
5071 uint64_t __attribute__((export_name("TS_LDKOffersMessage_InvoiceRequest_get_invoice_request"))) TS_LDKOffersMessage_InvoiceRequest_get_invoice_request(uint64_t ptr) {
5072         LDKOffersMessage *obj = (LDKOffersMessage*)untag_ptr(ptr);
5073         assert(obj->tag == LDKOffersMessage_InvoiceRequest);
5074         LDKInvoiceRequest invoice_request_var = obj->invoice_request;
5075                         uint64_t invoice_request_ref = 0;
5076                         CHECK_INNER_FIELD_ACCESS_OR_NULL(invoice_request_var);
5077                         invoice_request_ref = tag_ptr(invoice_request_var.inner, false);
5078         return invoice_request_ref;
5079 }
5080 uint64_t __attribute__((export_name("TS_LDKOffersMessage_Invoice_get_invoice"))) TS_LDKOffersMessage_Invoice_get_invoice(uint64_t ptr) {
5081         LDKOffersMessage *obj = (LDKOffersMessage*)untag_ptr(ptr);
5082         assert(obj->tag == LDKOffersMessage_Invoice);
5083         LDKBolt12Invoice invoice_var = obj->invoice;
5084                         uint64_t invoice_ref = 0;
5085                         CHECK_INNER_FIELD_ACCESS_OR_NULL(invoice_var);
5086                         invoice_ref = tag_ptr(invoice_var.inner, false);
5087         return invoice_ref;
5088 }
5089 uint64_t __attribute__((export_name("TS_LDKOffersMessage_InvoiceError_get_invoice_error"))) TS_LDKOffersMessage_InvoiceError_get_invoice_error(uint64_t ptr) {
5090         LDKOffersMessage *obj = (LDKOffersMessage*)untag_ptr(ptr);
5091         assert(obj->tag == LDKOffersMessage_InvoiceError);
5092         LDKInvoiceError invoice_error_var = obj->invoice_error;
5093                         uint64_t invoice_error_ref = 0;
5094                         CHECK_INNER_FIELD_ACCESS_OR_NULL(invoice_error_var);
5095                         invoice_error_ref = tag_ptr(invoice_error_var.inner, false);
5096         return invoice_error_ref;
5097 }
5098 uint32_t __attribute__((export_name("TS_LDKCOption_OffersMessageZ_ty_from_ptr"))) TS_LDKCOption_OffersMessageZ_ty_from_ptr(uint64_t ptr) {
5099         LDKCOption_OffersMessageZ *obj = (LDKCOption_OffersMessageZ*)untag_ptr(ptr);
5100         switch(obj->tag) {
5101                 case LDKCOption_OffersMessageZ_Some: return 0;
5102                 case LDKCOption_OffersMessageZ_None: return 1;
5103                 default: abort();
5104         }
5105 }
5106 uint64_t __attribute__((export_name("TS_LDKCOption_OffersMessageZ_Some_get_some"))) TS_LDKCOption_OffersMessageZ_Some_get_some(uint64_t ptr) {
5107         LDKCOption_OffersMessageZ *obj = (LDKCOption_OffersMessageZ*)untag_ptr(ptr);
5108         assert(obj->tag == LDKCOption_OffersMessageZ_Some);
5109         uint64_t some_ref = tag_ptr(&obj->some, false);
5110         return some_ref;
5111 }
5112 uint32_t __attribute__((export_name("TS_LDKDestination_ty_from_ptr"))) TS_LDKDestination_ty_from_ptr(uint64_t ptr) {
5113         LDKDestination *obj = (LDKDestination*)untag_ptr(ptr);
5114         switch(obj->tag) {
5115                 case LDKDestination_Node: return 0;
5116                 case LDKDestination_BlindedPath: return 1;
5117                 default: abort();
5118         }
5119 }
5120 int8_tArray __attribute__((export_name("TS_LDKDestination_Node_get_node"))) TS_LDKDestination_Node_get_node(uint64_t ptr) {
5121         LDKDestination *obj = (LDKDestination*)untag_ptr(ptr);
5122         assert(obj->tag == LDKDestination_Node);
5123         int8_tArray node_arr = init_int8_tArray(33, __LINE__);
5124         memcpy(node_arr->elems, obj->node.compressed_form, 33);
5125         return node_arr;
5126 }
5127 uint64_t __attribute__((export_name("TS_LDKDestination_BlindedPath_get_blinded_path"))) TS_LDKDestination_BlindedPath_get_blinded_path(uint64_t ptr) {
5128         LDKDestination *obj = (LDKDestination*)untag_ptr(ptr);
5129         assert(obj->tag == LDKDestination_BlindedPath);
5130         LDKBlindedPath blinded_path_var = obj->blinded_path;
5131                         uint64_t blinded_path_ref = 0;
5132                         CHECK_INNER_FIELD_ACCESS_OR_NULL(blinded_path_var);
5133                         blinded_path_ref = tag_ptr(blinded_path_var.inner, false);
5134         return blinded_path_ref;
5135 }
5136 static inline struct LDKOffersMessage C3Tuple_OffersMessageDestinationBlindedPathZ_get_a(LDKC3Tuple_OffersMessageDestinationBlindedPathZ *NONNULL_PTR owner){
5137         return OffersMessage_clone(&owner->a);
5138 }
5139 uint64_t  __attribute__((export_name("TS_C3Tuple_OffersMessageDestinationBlindedPathZ_get_a"))) TS_C3Tuple_OffersMessageDestinationBlindedPathZ_get_a(uint64_t owner) {
5140         LDKC3Tuple_OffersMessageDestinationBlindedPathZ* owner_conv = (LDKC3Tuple_OffersMessageDestinationBlindedPathZ*)untag_ptr(owner);
5141         LDKOffersMessage *ret_copy = MALLOC(sizeof(LDKOffersMessage), "LDKOffersMessage");
5142         *ret_copy = C3Tuple_OffersMessageDestinationBlindedPathZ_get_a(owner_conv);
5143         uint64_t ret_ref = tag_ptr(ret_copy, true);
5144         return ret_ref;
5145 }
5146
5147 static inline struct LDKDestination C3Tuple_OffersMessageDestinationBlindedPathZ_get_b(LDKC3Tuple_OffersMessageDestinationBlindedPathZ *NONNULL_PTR owner){
5148         return Destination_clone(&owner->b);
5149 }
5150 uint64_t  __attribute__((export_name("TS_C3Tuple_OffersMessageDestinationBlindedPathZ_get_b"))) TS_C3Tuple_OffersMessageDestinationBlindedPathZ_get_b(uint64_t owner) {
5151         LDKC3Tuple_OffersMessageDestinationBlindedPathZ* owner_conv = (LDKC3Tuple_OffersMessageDestinationBlindedPathZ*)untag_ptr(owner);
5152         LDKDestination *ret_copy = MALLOC(sizeof(LDKDestination), "LDKDestination");
5153         *ret_copy = C3Tuple_OffersMessageDestinationBlindedPathZ_get_b(owner_conv);
5154         uint64_t ret_ref = tag_ptr(ret_copy, true);
5155         return ret_ref;
5156 }
5157
5158 static inline struct LDKBlindedPath C3Tuple_OffersMessageDestinationBlindedPathZ_get_c(LDKC3Tuple_OffersMessageDestinationBlindedPathZ *NONNULL_PTR owner){
5159         LDKBlindedPath ret = owner->c;
5160         ret.is_owned = false;
5161         return ret;
5162 }
5163 uint64_t  __attribute__((export_name("TS_C3Tuple_OffersMessageDestinationBlindedPathZ_get_c"))) TS_C3Tuple_OffersMessageDestinationBlindedPathZ_get_c(uint64_t owner) {
5164         LDKC3Tuple_OffersMessageDestinationBlindedPathZ* owner_conv = (LDKC3Tuple_OffersMessageDestinationBlindedPathZ*)untag_ptr(owner);
5165         LDKBlindedPath ret_var = C3Tuple_OffersMessageDestinationBlindedPathZ_get_c(owner_conv);
5166         uint64_t ret_ref = 0;
5167         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
5168         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
5169         return ret_ref;
5170 }
5171
5172 static inline LDKCVec_C3Tuple_OffersMessageDestinationBlindedPathZZ CVec_C3Tuple_OffersMessageDestinationBlindedPathZZ_clone(const LDKCVec_C3Tuple_OffersMessageDestinationBlindedPathZZ *orig) {
5173         LDKCVec_C3Tuple_OffersMessageDestinationBlindedPathZZ ret = { .data = MALLOC(sizeof(LDKC3Tuple_OffersMessageDestinationBlindedPathZ) * orig->datalen, "LDKCVec_C3Tuple_OffersMessageDestinationBlindedPathZZ clone bytes"), .datalen = orig->datalen };
5174         for (size_t i = 0; i < ret.datalen; i++) {
5175                 ret.data[i] = C3Tuple_OffersMessageDestinationBlindedPathZ_clone(&orig->data[i]);
5176         }
5177         return ret;
5178 }
5179 static inline struct LDKCounterpartyForwardingInfo CResult_CounterpartyForwardingInfoDecodeErrorZ_get_ok(LDKCResult_CounterpartyForwardingInfoDecodeErrorZ *NONNULL_PTR owner){
5180         LDKCounterpartyForwardingInfo ret = *owner->contents.result;
5181         ret.is_owned = false;
5182         return ret;
5183 }
5184 uint64_t  __attribute__((export_name("TS_CResult_CounterpartyForwardingInfoDecodeErrorZ_get_ok"))) TS_CResult_CounterpartyForwardingInfoDecodeErrorZ_get_ok(uint64_t owner) {
5185         LDKCResult_CounterpartyForwardingInfoDecodeErrorZ* owner_conv = (LDKCResult_CounterpartyForwardingInfoDecodeErrorZ*)untag_ptr(owner);
5186         LDKCounterpartyForwardingInfo ret_var = CResult_CounterpartyForwardingInfoDecodeErrorZ_get_ok(owner_conv);
5187         uint64_t ret_ref = 0;
5188         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
5189         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
5190         return ret_ref;
5191 }
5192
5193 static inline struct LDKDecodeError CResult_CounterpartyForwardingInfoDecodeErrorZ_get_err(LDKCResult_CounterpartyForwardingInfoDecodeErrorZ *NONNULL_PTR owner){
5194 CHECK(!owner->result_ok);
5195         return DecodeError_clone(&*owner->contents.err);
5196 }
5197 uint64_t  __attribute__((export_name("TS_CResult_CounterpartyForwardingInfoDecodeErrorZ_get_err"))) TS_CResult_CounterpartyForwardingInfoDecodeErrorZ_get_err(uint64_t owner) {
5198         LDKCResult_CounterpartyForwardingInfoDecodeErrorZ* owner_conv = (LDKCResult_CounterpartyForwardingInfoDecodeErrorZ*)untag_ptr(owner);
5199         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
5200         *ret_copy = CResult_CounterpartyForwardingInfoDecodeErrorZ_get_err(owner_conv);
5201         uint64_t ret_ref = tag_ptr(ret_copy, true);
5202         return ret_ref;
5203 }
5204
5205 static inline struct LDKChannelCounterparty CResult_ChannelCounterpartyDecodeErrorZ_get_ok(LDKCResult_ChannelCounterpartyDecodeErrorZ *NONNULL_PTR owner){
5206         LDKChannelCounterparty ret = *owner->contents.result;
5207         ret.is_owned = false;
5208         return ret;
5209 }
5210 uint64_t  __attribute__((export_name("TS_CResult_ChannelCounterpartyDecodeErrorZ_get_ok"))) TS_CResult_ChannelCounterpartyDecodeErrorZ_get_ok(uint64_t owner) {
5211         LDKCResult_ChannelCounterpartyDecodeErrorZ* owner_conv = (LDKCResult_ChannelCounterpartyDecodeErrorZ*)untag_ptr(owner);
5212         LDKChannelCounterparty ret_var = CResult_ChannelCounterpartyDecodeErrorZ_get_ok(owner_conv);
5213         uint64_t ret_ref = 0;
5214         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
5215         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
5216         return ret_ref;
5217 }
5218
5219 static inline struct LDKDecodeError CResult_ChannelCounterpartyDecodeErrorZ_get_err(LDKCResult_ChannelCounterpartyDecodeErrorZ *NONNULL_PTR owner){
5220 CHECK(!owner->result_ok);
5221         return DecodeError_clone(&*owner->contents.err);
5222 }
5223 uint64_t  __attribute__((export_name("TS_CResult_ChannelCounterpartyDecodeErrorZ_get_err"))) TS_CResult_ChannelCounterpartyDecodeErrorZ_get_err(uint64_t owner) {
5224         LDKCResult_ChannelCounterpartyDecodeErrorZ* owner_conv = (LDKCResult_ChannelCounterpartyDecodeErrorZ*)untag_ptr(owner);
5225         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
5226         *ret_copy = CResult_ChannelCounterpartyDecodeErrorZ_get_err(owner_conv);
5227         uint64_t ret_ref = tag_ptr(ret_copy, true);
5228         return ret_ref;
5229 }
5230
5231 static inline struct LDKChannelDetails CResult_ChannelDetailsDecodeErrorZ_get_ok(LDKCResult_ChannelDetailsDecodeErrorZ *NONNULL_PTR owner){
5232         LDKChannelDetails ret = *owner->contents.result;
5233         ret.is_owned = false;
5234         return ret;
5235 }
5236 uint64_t  __attribute__((export_name("TS_CResult_ChannelDetailsDecodeErrorZ_get_ok"))) TS_CResult_ChannelDetailsDecodeErrorZ_get_ok(uint64_t owner) {
5237         LDKCResult_ChannelDetailsDecodeErrorZ* owner_conv = (LDKCResult_ChannelDetailsDecodeErrorZ*)untag_ptr(owner);
5238         LDKChannelDetails ret_var = CResult_ChannelDetailsDecodeErrorZ_get_ok(owner_conv);
5239         uint64_t ret_ref = 0;
5240         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
5241         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
5242         return ret_ref;
5243 }
5244
5245 static inline struct LDKDecodeError CResult_ChannelDetailsDecodeErrorZ_get_err(LDKCResult_ChannelDetailsDecodeErrorZ *NONNULL_PTR owner){
5246 CHECK(!owner->result_ok);
5247         return DecodeError_clone(&*owner->contents.err);
5248 }
5249 uint64_t  __attribute__((export_name("TS_CResult_ChannelDetailsDecodeErrorZ_get_err"))) TS_CResult_ChannelDetailsDecodeErrorZ_get_err(uint64_t owner) {
5250         LDKCResult_ChannelDetailsDecodeErrorZ* owner_conv = (LDKCResult_ChannelDetailsDecodeErrorZ*)untag_ptr(owner);
5251         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
5252         *ret_copy = CResult_ChannelDetailsDecodeErrorZ_get_err(owner_conv);
5253         uint64_t ret_ref = tag_ptr(ret_copy, true);
5254         return ret_ref;
5255 }
5256
5257 static inline struct LDKPhantomRouteHints CResult_PhantomRouteHintsDecodeErrorZ_get_ok(LDKCResult_PhantomRouteHintsDecodeErrorZ *NONNULL_PTR owner){
5258         LDKPhantomRouteHints ret = *owner->contents.result;
5259         ret.is_owned = false;
5260         return ret;
5261 }
5262 uint64_t  __attribute__((export_name("TS_CResult_PhantomRouteHintsDecodeErrorZ_get_ok"))) TS_CResult_PhantomRouteHintsDecodeErrorZ_get_ok(uint64_t owner) {
5263         LDKCResult_PhantomRouteHintsDecodeErrorZ* owner_conv = (LDKCResult_PhantomRouteHintsDecodeErrorZ*)untag_ptr(owner);
5264         LDKPhantomRouteHints ret_var = CResult_PhantomRouteHintsDecodeErrorZ_get_ok(owner_conv);
5265         uint64_t ret_ref = 0;
5266         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
5267         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
5268         return ret_ref;
5269 }
5270
5271 static inline struct LDKDecodeError CResult_PhantomRouteHintsDecodeErrorZ_get_err(LDKCResult_PhantomRouteHintsDecodeErrorZ *NONNULL_PTR owner){
5272 CHECK(!owner->result_ok);
5273         return DecodeError_clone(&*owner->contents.err);
5274 }
5275 uint64_t  __attribute__((export_name("TS_CResult_PhantomRouteHintsDecodeErrorZ_get_err"))) TS_CResult_PhantomRouteHintsDecodeErrorZ_get_err(uint64_t owner) {
5276         LDKCResult_PhantomRouteHintsDecodeErrorZ* owner_conv = (LDKCResult_PhantomRouteHintsDecodeErrorZ*)untag_ptr(owner);
5277         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
5278         *ret_copy = CResult_PhantomRouteHintsDecodeErrorZ_get_err(owner_conv);
5279         uint64_t ret_ref = tag_ptr(ret_copy, true);
5280         return ret_ref;
5281 }
5282
5283 static inline enum LDKChannelShutdownState CResult_ChannelShutdownStateDecodeErrorZ_get_ok(LDKCResult_ChannelShutdownStateDecodeErrorZ *NONNULL_PTR owner){
5284 CHECK(owner->result_ok);
5285         return ChannelShutdownState_clone(&*owner->contents.result);
5286 }
5287 uint32_t  __attribute__((export_name("TS_CResult_ChannelShutdownStateDecodeErrorZ_get_ok"))) TS_CResult_ChannelShutdownStateDecodeErrorZ_get_ok(uint64_t owner) {
5288         LDKCResult_ChannelShutdownStateDecodeErrorZ* owner_conv = (LDKCResult_ChannelShutdownStateDecodeErrorZ*)untag_ptr(owner);
5289         uint32_t ret_conv = LDKChannelShutdownState_to_js(CResult_ChannelShutdownStateDecodeErrorZ_get_ok(owner_conv));
5290         return ret_conv;
5291 }
5292
5293 static inline struct LDKDecodeError CResult_ChannelShutdownStateDecodeErrorZ_get_err(LDKCResult_ChannelShutdownStateDecodeErrorZ *NONNULL_PTR owner){
5294 CHECK(!owner->result_ok);
5295         return DecodeError_clone(&*owner->contents.err);
5296 }
5297 uint64_t  __attribute__((export_name("TS_CResult_ChannelShutdownStateDecodeErrorZ_get_err"))) TS_CResult_ChannelShutdownStateDecodeErrorZ_get_err(uint64_t owner) {
5298         LDKCResult_ChannelShutdownStateDecodeErrorZ* owner_conv = (LDKCResult_ChannelShutdownStateDecodeErrorZ*)untag_ptr(owner);
5299         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
5300         *ret_copy = CResult_ChannelShutdownStateDecodeErrorZ_get_err(owner_conv);
5301         uint64_t ret_ref = tag_ptr(ret_copy, true);
5302         return ret_ref;
5303 }
5304
5305 static inline LDKCVec_ChannelMonitorZ CVec_ChannelMonitorZ_clone(const LDKCVec_ChannelMonitorZ *orig) {
5306         LDKCVec_ChannelMonitorZ ret = { .data = MALLOC(sizeof(LDKChannelMonitor) * orig->datalen, "LDKCVec_ChannelMonitorZ clone bytes"), .datalen = orig->datalen };
5307         for (size_t i = 0; i < ret.datalen; i++) {
5308                 ret.data[i] = ChannelMonitor_clone(&orig->data[i]);
5309         }
5310         return ret;
5311 }
5312 typedef struct LDKWatch_JCalls {
5313         atomic_size_t refcnt;
5314         uint32_t instance_ptr;
5315 } LDKWatch_JCalls;
5316 static void LDKWatch_JCalls_free(void* this_arg) {
5317         LDKWatch_JCalls *j_calls = (LDKWatch_JCalls*) this_arg;
5318         if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
5319                 FREE(j_calls);
5320         }
5321 }
5322 LDKCResult_ChannelMonitorUpdateStatusNoneZ watch_channel_LDKWatch_jcall(const void* this_arg, LDKOutPoint funding_txo, LDKChannelMonitor monitor) {
5323         LDKWatch_JCalls *j_calls = (LDKWatch_JCalls*) this_arg;
5324         LDKOutPoint funding_txo_var = funding_txo;
5325         uint64_t funding_txo_ref = 0;
5326         CHECK_INNER_FIELD_ACCESS_OR_NULL(funding_txo_var);
5327         funding_txo_ref = tag_ptr(funding_txo_var.inner, funding_txo_var.is_owned);
5328         LDKChannelMonitor monitor_var = monitor;
5329         uint64_t monitor_ref = 0;
5330         CHECK_INNER_FIELD_ACCESS_OR_NULL(monitor_var);
5331         monitor_ref = tag_ptr(monitor_var.inner, monitor_var.is_owned);
5332         uint64_t ret = js_invoke_function_bbuuuu(j_calls->instance_ptr, 18, funding_txo_ref, monitor_ref, 0, 0, 0, 0);
5333         void* ret_ptr = untag_ptr(ret);
5334         CHECK_ACCESS(ret_ptr);
5335         LDKCResult_ChannelMonitorUpdateStatusNoneZ ret_conv = *(LDKCResult_ChannelMonitorUpdateStatusNoneZ*)(ret_ptr);
5336         FREE(untag_ptr(ret));
5337         return ret_conv;
5338 }
5339 LDKChannelMonitorUpdateStatus update_channel_LDKWatch_jcall(const void* this_arg, LDKOutPoint funding_txo, const LDKChannelMonitorUpdate * update) {
5340         LDKWatch_JCalls *j_calls = (LDKWatch_JCalls*) this_arg;
5341         LDKOutPoint funding_txo_var = funding_txo;
5342         uint64_t funding_txo_ref = 0;
5343         CHECK_INNER_FIELD_ACCESS_OR_NULL(funding_txo_var);
5344         funding_txo_ref = tag_ptr(funding_txo_var.inner, funding_txo_var.is_owned);
5345         LDKChannelMonitorUpdate update_var = *update;
5346         uint64_t update_ref = 0;
5347         update_var = ChannelMonitorUpdate_clone(&update_var);
5348         CHECK_INNER_FIELD_ACCESS_OR_NULL(update_var);
5349         update_ref = tag_ptr(update_var.inner, update_var.is_owned);
5350         uint64_t ret = js_invoke_function_bbuuuu(j_calls->instance_ptr, 19, funding_txo_ref, update_ref, 0, 0, 0, 0);
5351         LDKChannelMonitorUpdateStatus ret_conv = LDKChannelMonitorUpdateStatus_from_js(ret);
5352         return ret_conv;
5353 }
5354 LDKCVec_C3Tuple_OutPointCVec_MonitorEventZPublicKeyZZ release_pending_monitor_events_LDKWatch_jcall(const void* this_arg) {
5355         LDKWatch_JCalls *j_calls = (LDKWatch_JCalls*) this_arg;
5356         uint64_tArray ret = (uint64_tArray)js_invoke_function_uuuuuu(j_calls->instance_ptr, 20, 0, 0, 0, 0, 0, 0);
5357         LDKCVec_C3Tuple_OutPointCVec_MonitorEventZPublicKeyZZ ret_constr;
5358         ret_constr.datalen = ret->arr_len;
5359         if (ret_constr.datalen > 0)
5360                 ret_constr.data = MALLOC(ret_constr.datalen * sizeof(LDKC3Tuple_OutPointCVec_MonitorEventZPublicKeyZ), "LDKCVec_C3Tuple_OutPointCVec_MonitorEventZPublicKeyZZ Elements");
5361         else
5362                 ret_constr.data = NULL;
5363         uint64_t* ret_vals = ret->elems;
5364         for (size_t x = 0; x < ret_constr.datalen; x++) {
5365                 uint64_t ret_conv_49 = ret_vals[x];
5366                 void* ret_conv_49_ptr = untag_ptr(ret_conv_49);
5367                 CHECK_ACCESS(ret_conv_49_ptr);
5368                 LDKC3Tuple_OutPointCVec_MonitorEventZPublicKeyZ ret_conv_49_conv = *(LDKC3Tuple_OutPointCVec_MonitorEventZPublicKeyZ*)(ret_conv_49_ptr);
5369                 FREE(untag_ptr(ret_conv_49));
5370                 ret_constr.data[x] = ret_conv_49_conv;
5371         }
5372         FREE(ret);
5373         return ret_constr;
5374 }
5375 static void LDKWatch_JCalls_cloned(LDKWatch* new_obj) {
5376         LDKWatch_JCalls *j_calls = (LDKWatch_JCalls*) new_obj->this_arg;
5377         atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
5378 }
5379 static inline LDKWatch LDKWatch_init (JSValue o) {
5380         LDKWatch_JCalls *calls = MALLOC(sizeof(LDKWatch_JCalls), "LDKWatch_JCalls");
5381         atomic_init(&calls->refcnt, 1);
5382         calls->instance_ptr = o;
5383
5384         LDKWatch ret = {
5385                 .this_arg = (void*) calls,
5386                 .watch_channel = watch_channel_LDKWatch_jcall,
5387                 .update_channel = update_channel_LDKWatch_jcall,
5388                 .release_pending_monitor_events = release_pending_monitor_events_LDKWatch_jcall,
5389                 .free = LDKWatch_JCalls_free,
5390         };
5391         return ret;
5392 }
5393 uint64_t  __attribute__((export_name("TS_LDKWatch_new"))) TS_LDKWatch_new(JSValue o) {
5394         LDKWatch *res_ptr = MALLOC(sizeof(LDKWatch), "LDKWatch");
5395         *res_ptr = LDKWatch_init(o);
5396         return tag_ptr(res_ptr, true);
5397 }
5398 uint64_t  __attribute__((export_name("TS_Watch_watch_channel"))) TS_Watch_watch_channel(uint64_t this_arg, uint64_t funding_txo, uint64_t monitor) {
5399         void* this_arg_ptr = untag_ptr(this_arg);
5400         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
5401         LDKWatch* this_arg_conv = (LDKWatch*)this_arg_ptr;
5402         LDKOutPoint funding_txo_conv;
5403         funding_txo_conv.inner = untag_ptr(funding_txo);
5404         funding_txo_conv.is_owned = ptr_is_owned(funding_txo);
5405         CHECK_INNER_FIELD_ACCESS_OR_NULL(funding_txo_conv);
5406         funding_txo_conv = OutPoint_clone(&funding_txo_conv);
5407         LDKChannelMonitor monitor_conv;
5408         monitor_conv.inner = untag_ptr(monitor);
5409         monitor_conv.is_owned = ptr_is_owned(monitor);
5410         CHECK_INNER_FIELD_ACCESS_OR_NULL(monitor_conv);
5411         monitor_conv = ChannelMonitor_clone(&monitor_conv);
5412         LDKCResult_ChannelMonitorUpdateStatusNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelMonitorUpdateStatusNoneZ), "LDKCResult_ChannelMonitorUpdateStatusNoneZ");
5413         *ret_conv = (this_arg_conv->watch_channel)(this_arg_conv->this_arg, funding_txo_conv, monitor_conv);
5414         return tag_ptr(ret_conv, true);
5415 }
5416
5417 uint32_t  __attribute__((export_name("TS_Watch_update_channel"))) TS_Watch_update_channel(uint64_t this_arg, uint64_t funding_txo, uint64_t update) {
5418         void* this_arg_ptr = untag_ptr(this_arg);
5419         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
5420         LDKWatch* this_arg_conv = (LDKWatch*)this_arg_ptr;
5421         LDKOutPoint funding_txo_conv;
5422         funding_txo_conv.inner = untag_ptr(funding_txo);
5423         funding_txo_conv.is_owned = ptr_is_owned(funding_txo);
5424         CHECK_INNER_FIELD_ACCESS_OR_NULL(funding_txo_conv);
5425         funding_txo_conv = OutPoint_clone(&funding_txo_conv);
5426         LDKChannelMonitorUpdate update_conv;
5427         update_conv.inner = untag_ptr(update);
5428         update_conv.is_owned = ptr_is_owned(update);
5429         CHECK_INNER_FIELD_ACCESS_OR_NULL(update_conv);
5430         update_conv.is_owned = false;
5431         uint32_t ret_conv = LDKChannelMonitorUpdateStatus_to_js((this_arg_conv->update_channel)(this_arg_conv->this_arg, funding_txo_conv, &update_conv));
5432         return ret_conv;
5433 }
5434
5435 uint64_tArray  __attribute__((export_name("TS_Watch_release_pending_monitor_events"))) TS_Watch_release_pending_monitor_events(uint64_t this_arg) {
5436         void* this_arg_ptr = untag_ptr(this_arg);
5437         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
5438         LDKWatch* this_arg_conv = (LDKWatch*)this_arg_ptr;
5439         LDKCVec_C3Tuple_OutPointCVec_MonitorEventZPublicKeyZZ ret_var = (this_arg_conv->release_pending_monitor_events)(this_arg_conv->this_arg);
5440         uint64_tArray ret_arr = NULL;
5441         ret_arr = init_uint64_tArray(ret_var.datalen, __LINE__);
5442         uint64_t *ret_arr_ptr = (uint64_t*)(((uint8_t*)ret_arr) + 8);
5443         for (size_t x = 0; x < ret_var.datalen; x++) {
5444                 LDKC3Tuple_OutPointCVec_MonitorEventZPublicKeyZ* ret_conv_49_conv = MALLOC(sizeof(LDKC3Tuple_OutPointCVec_MonitorEventZPublicKeyZ), "LDKC3Tuple_OutPointCVec_MonitorEventZPublicKeyZ");
5445                 *ret_conv_49_conv = ret_var.data[x];
5446                 ret_arr_ptr[x] = tag_ptr(ret_conv_49_conv, true);
5447         }
5448         
5449         FREE(ret_var.data);
5450         return ret_arr;
5451 }
5452
5453 typedef struct LDKBroadcasterInterface_JCalls {
5454         atomic_size_t refcnt;
5455         uint32_t instance_ptr;
5456 } LDKBroadcasterInterface_JCalls;
5457 static void LDKBroadcasterInterface_JCalls_free(void* this_arg) {
5458         LDKBroadcasterInterface_JCalls *j_calls = (LDKBroadcasterInterface_JCalls*) this_arg;
5459         if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
5460                 FREE(j_calls);
5461         }
5462 }
5463 void broadcast_transactions_LDKBroadcasterInterface_jcall(const void* this_arg, LDKCVec_TransactionZ txs) {
5464         LDKBroadcasterInterface_JCalls *j_calls = (LDKBroadcasterInterface_JCalls*) this_arg;
5465         LDKCVec_TransactionZ txs_var = txs;
5466         ptrArray txs_arr = NULL;
5467         txs_arr = init_ptrArray(txs_var.datalen, __LINE__);
5468         int8_tArray *txs_arr_ptr = (int8_tArray*)(((uint8_t*)txs_arr) + 8);
5469         for (size_t m = 0; m < txs_var.datalen; m++) {
5470                 LDKTransaction txs_conv_12_var = txs_var.data[m];
5471                 int8_tArray txs_conv_12_arr = init_int8_tArray(txs_conv_12_var.datalen, __LINE__);
5472                 memcpy(txs_conv_12_arr->elems, txs_conv_12_var.data, txs_conv_12_var.datalen);
5473                 Transaction_free(txs_conv_12_var);
5474                 txs_arr_ptr[m] = txs_conv_12_arr;
5475         }
5476         
5477         FREE(txs_var.data);
5478         js_invoke_function_uuuuuu(j_calls->instance_ptr, 21, (uint32_t)txs_arr, 0, 0, 0, 0, 0);
5479 }
5480 static void LDKBroadcasterInterface_JCalls_cloned(LDKBroadcasterInterface* new_obj) {
5481         LDKBroadcasterInterface_JCalls *j_calls = (LDKBroadcasterInterface_JCalls*) new_obj->this_arg;
5482         atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
5483 }
5484 static inline LDKBroadcasterInterface LDKBroadcasterInterface_init (JSValue o) {
5485         LDKBroadcasterInterface_JCalls *calls = MALLOC(sizeof(LDKBroadcasterInterface_JCalls), "LDKBroadcasterInterface_JCalls");
5486         atomic_init(&calls->refcnt, 1);
5487         calls->instance_ptr = o;
5488
5489         LDKBroadcasterInterface ret = {
5490                 .this_arg = (void*) calls,
5491                 .broadcast_transactions = broadcast_transactions_LDKBroadcasterInterface_jcall,
5492                 .free = LDKBroadcasterInterface_JCalls_free,
5493         };
5494         return ret;
5495 }
5496 uint64_t  __attribute__((export_name("TS_LDKBroadcasterInterface_new"))) TS_LDKBroadcasterInterface_new(JSValue o) {
5497         LDKBroadcasterInterface *res_ptr = MALLOC(sizeof(LDKBroadcasterInterface), "LDKBroadcasterInterface");
5498         *res_ptr = LDKBroadcasterInterface_init(o);
5499         return tag_ptr(res_ptr, true);
5500 }
5501 void  __attribute__((export_name("TS_BroadcasterInterface_broadcast_transactions"))) TS_BroadcasterInterface_broadcast_transactions(uint64_t this_arg, ptrArray txs) {
5502         void* this_arg_ptr = untag_ptr(this_arg);
5503         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
5504         LDKBroadcasterInterface* this_arg_conv = (LDKBroadcasterInterface*)this_arg_ptr;
5505         LDKCVec_TransactionZ txs_constr;
5506         txs_constr.datalen = txs->arr_len;
5507         if (txs_constr.datalen > 0)
5508                 txs_constr.data = MALLOC(txs_constr.datalen * sizeof(LDKTransaction), "LDKCVec_TransactionZ Elements");
5509         else
5510                 txs_constr.data = NULL;
5511         int8_tArray* txs_vals = (void*) txs->elems;
5512         for (size_t m = 0; m < txs_constr.datalen; m++) {
5513                 int8_tArray txs_conv_12 = txs_vals[m];
5514                 LDKTransaction txs_conv_12_ref;
5515                 txs_conv_12_ref.datalen = txs_conv_12->arr_len;
5516                 txs_conv_12_ref.data = MALLOC(txs_conv_12_ref.datalen, "LDKTransaction Bytes");
5517                 memcpy(txs_conv_12_ref.data, txs_conv_12->elems, txs_conv_12_ref.datalen); FREE(txs_conv_12);
5518                 txs_conv_12_ref.data_is_owned = true;
5519                 txs_constr.data[m] = txs_conv_12_ref;
5520         }
5521         FREE(txs);
5522         (this_arg_conv->broadcast_transactions)(this_arg_conv->this_arg, txs_constr);
5523 }
5524
5525 typedef struct LDKEntropySource_JCalls {
5526         atomic_size_t refcnt;
5527         uint32_t instance_ptr;
5528 } LDKEntropySource_JCalls;
5529 static void LDKEntropySource_JCalls_free(void* this_arg) {
5530         LDKEntropySource_JCalls *j_calls = (LDKEntropySource_JCalls*) this_arg;
5531         if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
5532                 FREE(j_calls);
5533         }
5534 }
5535 LDKThirtyTwoBytes get_secure_random_bytes_LDKEntropySource_jcall(const void* this_arg) {
5536         LDKEntropySource_JCalls *j_calls = (LDKEntropySource_JCalls*) this_arg;
5537         int8_tArray ret = (int8_tArray)js_invoke_function_uuuuuu(j_calls->instance_ptr, 22, 0, 0, 0, 0, 0, 0);
5538         LDKThirtyTwoBytes ret_ref;
5539         CHECK(ret->arr_len == 32);
5540         memcpy(ret_ref.data, ret->elems, 32); FREE(ret);
5541         return ret_ref;
5542 }
5543 static void LDKEntropySource_JCalls_cloned(LDKEntropySource* new_obj) {
5544         LDKEntropySource_JCalls *j_calls = (LDKEntropySource_JCalls*) new_obj->this_arg;
5545         atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
5546 }
5547 static inline LDKEntropySource LDKEntropySource_init (JSValue o) {
5548         LDKEntropySource_JCalls *calls = MALLOC(sizeof(LDKEntropySource_JCalls), "LDKEntropySource_JCalls");
5549         atomic_init(&calls->refcnt, 1);
5550         calls->instance_ptr = o;
5551
5552         LDKEntropySource ret = {
5553                 .this_arg = (void*) calls,
5554                 .get_secure_random_bytes = get_secure_random_bytes_LDKEntropySource_jcall,
5555                 .free = LDKEntropySource_JCalls_free,
5556         };
5557         return ret;
5558 }
5559 uint64_t  __attribute__((export_name("TS_LDKEntropySource_new"))) TS_LDKEntropySource_new(JSValue o) {
5560         LDKEntropySource *res_ptr = MALLOC(sizeof(LDKEntropySource), "LDKEntropySource");
5561         *res_ptr = LDKEntropySource_init(o);
5562         return tag_ptr(res_ptr, true);
5563 }
5564 int8_tArray  __attribute__((export_name("TS_EntropySource_get_secure_random_bytes"))) TS_EntropySource_get_secure_random_bytes(uint64_t this_arg) {
5565         void* this_arg_ptr = untag_ptr(this_arg);
5566         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
5567         LDKEntropySource* this_arg_conv = (LDKEntropySource*)this_arg_ptr;
5568         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
5569         memcpy(ret_arr->elems, (this_arg_conv->get_secure_random_bytes)(this_arg_conv->this_arg).data, 32);
5570         return ret_arr;
5571 }
5572
5573 uint32_t __attribute__((export_name("TS_LDKUnsignedGossipMessage_ty_from_ptr"))) TS_LDKUnsignedGossipMessage_ty_from_ptr(uint64_t ptr) {
5574         LDKUnsignedGossipMessage *obj = (LDKUnsignedGossipMessage*)untag_ptr(ptr);
5575         switch(obj->tag) {
5576                 case LDKUnsignedGossipMessage_ChannelAnnouncement: return 0;
5577                 case LDKUnsignedGossipMessage_ChannelUpdate: return 1;
5578                 case LDKUnsignedGossipMessage_NodeAnnouncement: return 2;
5579                 default: abort();
5580         }
5581 }
5582 uint64_t __attribute__((export_name("TS_LDKUnsignedGossipMessage_ChannelAnnouncement_get_channel_announcement"))) TS_LDKUnsignedGossipMessage_ChannelAnnouncement_get_channel_announcement(uint64_t ptr) {
5583         LDKUnsignedGossipMessage *obj = (LDKUnsignedGossipMessage*)untag_ptr(ptr);
5584         assert(obj->tag == LDKUnsignedGossipMessage_ChannelAnnouncement);
5585         LDKUnsignedChannelAnnouncement channel_announcement_var = obj->channel_announcement;
5586                         uint64_t channel_announcement_ref = 0;
5587                         CHECK_INNER_FIELD_ACCESS_OR_NULL(channel_announcement_var);
5588                         channel_announcement_ref = tag_ptr(channel_announcement_var.inner, false);
5589         return channel_announcement_ref;
5590 }
5591 uint64_t __attribute__((export_name("TS_LDKUnsignedGossipMessage_ChannelUpdate_get_channel_update"))) TS_LDKUnsignedGossipMessage_ChannelUpdate_get_channel_update(uint64_t ptr) {
5592         LDKUnsignedGossipMessage *obj = (LDKUnsignedGossipMessage*)untag_ptr(ptr);
5593         assert(obj->tag == LDKUnsignedGossipMessage_ChannelUpdate);
5594         LDKUnsignedChannelUpdate channel_update_var = obj->channel_update;
5595                         uint64_t channel_update_ref = 0;
5596                         CHECK_INNER_FIELD_ACCESS_OR_NULL(channel_update_var);
5597                         channel_update_ref = tag_ptr(channel_update_var.inner, false);
5598         return channel_update_ref;
5599 }
5600 uint64_t __attribute__((export_name("TS_LDKUnsignedGossipMessage_NodeAnnouncement_get_node_announcement"))) TS_LDKUnsignedGossipMessage_NodeAnnouncement_get_node_announcement(uint64_t ptr) {
5601         LDKUnsignedGossipMessage *obj = (LDKUnsignedGossipMessage*)untag_ptr(ptr);
5602         assert(obj->tag == LDKUnsignedGossipMessage_NodeAnnouncement);
5603         LDKUnsignedNodeAnnouncement node_announcement_var = obj->node_announcement;
5604                         uint64_t node_announcement_ref = 0;
5605                         CHECK_INNER_FIELD_ACCESS_OR_NULL(node_announcement_var);
5606                         node_announcement_ref = tag_ptr(node_announcement_var.inner, false);
5607         return node_announcement_ref;
5608 }
5609 typedef struct LDKNodeSigner_JCalls {
5610         atomic_size_t refcnt;
5611         uint32_t instance_ptr;
5612 } LDKNodeSigner_JCalls;
5613 static void LDKNodeSigner_JCalls_free(void* this_arg) {
5614         LDKNodeSigner_JCalls *j_calls = (LDKNodeSigner_JCalls*) this_arg;
5615         if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
5616                 FREE(j_calls);
5617         }
5618 }
5619 LDKThirtyTwoBytes get_inbound_payment_key_material_LDKNodeSigner_jcall(const void* this_arg) {
5620         LDKNodeSigner_JCalls *j_calls = (LDKNodeSigner_JCalls*) this_arg;
5621         int8_tArray ret = (int8_tArray)js_invoke_function_uuuuuu(j_calls->instance_ptr, 23, 0, 0, 0, 0, 0, 0);
5622         LDKThirtyTwoBytes ret_ref;
5623         CHECK(ret->arr_len == 32);
5624         memcpy(ret_ref.data, ret->elems, 32); FREE(ret);
5625         return ret_ref;
5626 }
5627 LDKCResult_PublicKeyNoneZ get_node_id_LDKNodeSigner_jcall(const void* this_arg, LDKRecipient recipient) {
5628         LDKNodeSigner_JCalls *j_calls = (LDKNodeSigner_JCalls*) this_arg;
5629         uint32_t recipient_conv = LDKRecipient_to_js(recipient);
5630         uint64_t ret = js_invoke_function_uuuuuu(j_calls->instance_ptr, 24, recipient_conv, 0, 0, 0, 0, 0);
5631         void* ret_ptr = untag_ptr(ret);
5632         CHECK_ACCESS(ret_ptr);
5633         LDKCResult_PublicKeyNoneZ ret_conv = *(LDKCResult_PublicKeyNoneZ*)(ret_ptr);
5634         FREE(untag_ptr(ret));
5635         return ret_conv;
5636 }
5637 LDKCResult_ThirtyTwoBytesNoneZ ecdh_LDKNodeSigner_jcall(const void* this_arg, LDKRecipient recipient, LDKPublicKey other_key, LDKCOption_BigEndianScalarZ tweak) {
5638         LDKNodeSigner_JCalls *j_calls = (LDKNodeSigner_JCalls*) this_arg;
5639         uint32_t recipient_conv = LDKRecipient_to_js(recipient);
5640         int8_tArray other_key_arr = init_int8_tArray(33, __LINE__);
5641         memcpy(other_key_arr->elems, other_key.compressed_form, 33);
5642         LDKCOption_BigEndianScalarZ *tweak_copy = MALLOC(sizeof(LDKCOption_BigEndianScalarZ), "LDKCOption_BigEndianScalarZ");
5643         *tweak_copy = tweak;
5644         uint64_t tweak_ref = tag_ptr(tweak_copy, true);
5645         uint64_t ret = js_invoke_function_uubuuu(j_calls->instance_ptr, 25, recipient_conv, (uint32_t)other_key_arr, tweak_ref, 0, 0, 0);
5646         void* ret_ptr = untag_ptr(ret);
5647         CHECK_ACCESS(ret_ptr);
5648         LDKCResult_ThirtyTwoBytesNoneZ ret_conv = *(LDKCResult_ThirtyTwoBytesNoneZ*)(ret_ptr);
5649         FREE(untag_ptr(ret));
5650         return ret_conv;
5651 }
5652 LDKCResult_RecoverableSignatureNoneZ sign_invoice_LDKNodeSigner_jcall(const void* this_arg, LDKu8slice hrp_bytes, LDKCVec_U5Z invoice_data, LDKRecipient recipient) {
5653         LDKNodeSigner_JCalls *j_calls = (LDKNodeSigner_JCalls*) this_arg;
5654         LDKu8slice hrp_bytes_var = hrp_bytes;
5655         int8_tArray hrp_bytes_arr = init_int8_tArray(hrp_bytes_var.datalen, __LINE__);
5656         memcpy(hrp_bytes_arr->elems, hrp_bytes_var.data, hrp_bytes_var.datalen);
5657         LDKCVec_U5Z invoice_data_var = invoice_data;
5658         ptrArray invoice_data_arr = NULL;
5659         invoice_data_arr = init_ptrArray(invoice_data_var.datalen, __LINE__);
5660         int8_t *invoice_data_arr_ptr = (int8_t*)(((uint8_t*)invoice_data_arr) + 8);
5661         for (size_t h = 0; h < invoice_data_var.datalen; h++) {
5662                 uint8_t invoice_data_conv_7_val = invoice_data_var.data[h]._0;
5663                 invoice_data_arr_ptr[h] = invoice_data_conv_7_val;
5664         }
5665         
5666         FREE(invoice_data_var.data);
5667         uint32_t recipient_conv = LDKRecipient_to_js(recipient);
5668         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);
5669         void* ret_ptr = untag_ptr(ret);
5670         CHECK_ACCESS(ret_ptr);
5671         LDKCResult_RecoverableSignatureNoneZ ret_conv = *(LDKCResult_RecoverableSignatureNoneZ*)(ret_ptr);
5672         FREE(untag_ptr(ret));
5673         return ret_conv;
5674 }
5675 LDKCResult_SchnorrSignatureNoneZ sign_bolt12_invoice_request_LDKNodeSigner_jcall(const void* this_arg, const LDKUnsignedInvoiceRequest * invoice_request) {
5676         LDKNodeSigner_JCalls *j_calls = (LDKNodeSigner_JCalls*) this_arg;
5677         LDKUnsignedInvoiceRequest invoice_request_var = *invoice_request;
5678         uint64_t invoice_request_ref = 0;
5679         // WARNING: we may need a move here but no clone is available for LDKUnsignedInvoiceRequest
5680         CHECK_INNER_FIELD_ACCESS_OR_NULL(invoice_request_var);
5681         invoice_request_ref = tag_ptr(invoice_request_var.inner, invoice_request_var.is_owned);
5682         uint64_t ret = js_invoke_function_buuuuu(j_calls->instance_ptr, 27, invoice_request_ref, 0, 0, 0, 0, 0);
5683         void* ret_ptr = untag_ptr(ret);
5684         CHECK_ACCESS(ret_ptr);
5685         LDKCResult_SchnorrSignatureNoneZ ret_conv = *(LDKCResult_SchnorrSignatureNoneZ*)(ret_ptr);
5686         FREE(untag_ptr(ret));
5687         return ret_conv;
5688 }
5689 LDKCResult_SchnorrSignatureNoneZ sign_bolt12_invoice_LDKNodeSigner_jcall(const void* this_arg, const LDKUnsignedBolt12Invoice * invoice) {
5690         LDKNodeSigner_JCalls *j_calls = (LDKNodeSigner_JCalls*) this_arg;
5691         LDKUnsignedBolt12Invoice invoice_var = *invoice;
5692         uint64_t invoice_ref = 0;
5693         // WARNING: we may need a move here but no clone is available for LDKUnsignedBolt12Invoice
5694         CHECK_INNER_FIELD_ACCESS_OR_NULL(invoice_var);
5695         invoice_ref = tag_ptr(invoice_var.inner, invoice_var.is_owned);
5696         uint64_t ret = js_invoke_function_buuuuu(j_calls->instance_ptr, 28, invoice_ref, 0, 0, 0, 0, 0);
5697         void* ret_ptr = untag_ptr(ret);
5698         CHECK_ACCESS(ret_ptr);
5699         LDKCResult_SchnorrSignatureNoneZ ret_conv = *(LDKCResult_SchnorrSignatureNoneZ*)(ret_ptr);
5700         FREE(untag_ptr(ret));
5701         return ret_conv;
5702 }
5703 LDKCResult_ECDSASignatureNoneZ sign_gossip_message_LDKNodeSigner_jcall(const void* this_arg, LDKUnsignedGossipMessage msg) {
5704         LDKNodeSigner_JCalls *j_calls = (LDKNodeSigner_JCalls*) this_arg;
5705         LDKUnsignedGossipMessage *msg_copy = MALLOC(sizeof(LDKUnsignedGossipMessage), "LDKUnsignedGossipMessage");
5706         *msg_copy = msg;
5707         uint64_t msg_ref = tag_ptr(msg_copy, true);
5708         uint64_t ret = js_invoke_function_buuuuu(j_calls->instance_ptr, 29, msg_ref, 0, 0, 0, 0, 0);
5709         void* ret_ptr = untag_ptr(ret);
5710         CHECK_ACCESS(ret_ptr);
5711         LDKCResult_ECDSASignatureNoneZ ret_conv = *(LDKCResult_ECDSASignatureNoneZ*)(ret_ptr);
5712         FREE(untag_ptr(ret));
5713         return ret_conv;
5714 }
5715 static void LDKNodeSigner_JCalls_cloned(LDKNodeSigner* new_obj) {
5716         LDKNodeSigner_JCalls *j_calls = (LDKNodeSigner_JCalls*) new_obj->this_arg;
5717         atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
5718 }
5719 static inline LDKNodeSigner LDKNodeSigner_init (JSValue o) {
5720         LDKNodeSigner_JCalls *calls = MALLOC(sizeof(LDKNodeSigner_JCalls), "LDKNodeSigner_JCalls");
5721         atomic_init(&calls->refcnt, 1);
5722         calls->instance_ptr = o;
5723
5724         LDKNodeSigner ret = {
5725                 .this_arg = (void*) calls,
5726                 .get_inbound_payment_key_material = get_inbound_payment_key_material_LDKNodeSigner_jcall,
5727                 .get_node_id = get_node_id_LDKNodeSigner_jcall,
5728                 .ecdh = ecdh_LDKNodeSigner_jcall,
5729                 .sign_invoice = sign_invoice_LDKNodeSigner_jcall,
5730                 .sign_bolt12_invoice_request = sign_bolt12_invoice_request_LDKNodeSigner_jcall,
5731                 .sign_bolt12_invoice = sign_bolt12_invoice_LDKNodeSigner_jcall,
5732                 .sign_gossip_message = sign_gossip_message_LDKNodeSigner_jcall,
5733                 .free = LDKNodeSigner_JCalls_free,
5734         };
5735         return ret;
5736 }
5737 uint64_t  __attribute__((export_name("TS_LDKNodeSigner_new"))) TS_LDKNodeSigner_new(JSValue o) {
5738         LDKNodeSigner *res_ptr = MALLOC(sizeof(LDKNodeSigner), "LDKNodeSigner");
5739         *res_ptr = LDKNodeSigner_init(o);
5740         return tag_ptr(res_ptr, true);
5741 }
5742 int8_tArray  __attribute__((export_name("TS_NodeSigner_get_inbound_payment_key_material"))) TS_NodeSigner_get_inbound_payment_key_material(uint64_t this_arg) {
5743         void* this_arg_ptr = untag_ptr(this_arg);
5744         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
5745         LDKNodeSigner* this_arg_conv = (LDKNodeSigner*)this_arg_ptr;
5746         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
5747         memcpy(ret_arr->elems, (this_arg_conv->get_inbound_payment_key_material)(this_arg_conv->this_arg).data, 32);
5748         return ret_arr;
5749 }
5750
5751 uint64_t  __attribute__((export_name("TS_NodeSigner_get_node_id"))) TS_NodeSigner_get_node_id(uint64_t this_arg, uint32_t recipient) {
5752         void* this_arg_ptr = untag_ptr(this_arg);
5753         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
5754         LDKNodeSigner* this_arg_conv = (LDKNodeSigner*)this_arg_ptr;
5755         LDKRecipient recipient_conv = LDKRecipient_from_js(recipient);
5756         LDKCResult_PublicKeyNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_PublicKeyNoneZ), "LDKCResult_PublicKeyNoneZ");
5757         *ret_conv = (this_arg_conv->get_node_id)(this_arg_conv->this_arg, recipient_conv);
5758         return tag_ptr(ret_conv, true);
5759 }
5760
5761 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) {
5762         void* this_arg_ptr = untag_ptr(this_arg);
5763         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
5764         LDKNodeSigner* this_arg_conv = (LDKNodeSigner*)this_arg_ptr;
5765         LDKRecipient recipient_conv = LDKRecipient_from_js(recipient);
5766         LDKPublicKey other_key_ref;
5767         CHECK(other_key->arr_len == 33);
5768         memcpy(other_key_ref.compressed_form, other_key->elems, 33); FREE(other_key);
5769         void* tweak_ptr = untag_ptr(tweak);
5770         CHECK_ACCESS(tweak_ptr);
5771         LDKCOption_BigEndianScalarZ tweak_conv = *(LDKCOption_BigEndianScalarZ*)(tweak_ptr);
5772         tweak_conv = COption_BigEndianScalarZ_clone((LDKCOption_BigEndianScalarZ*)untag_ptr(tweak));
5773         LDKCResult_ThirtyTwoBytesNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_ThirtyTwoBytesNoneZ), "LDKCResult_ThirtyTwoBytesNoneZ");
5774         *ret_conv = (this_arg_conv->ecdh)(this_arg_conv->this_arg, recipient_conv, other_key_ref, tweak_conv);
5775         return tag_ptr(ret_conv, true);
5776 }
5777
5778 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) {
5779         void* this_arg_ptr = untag_ptr(this_arg);
5780         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
5781         LDKNodeSigner* this_arg_conv = (LDKNodeSigner*)this_arg_ptr;
5782         LDKu8slice hrp_bytes_ref;
5783         hrp_bytes_ref.datalen = hrp_bytes->arr_len;
5784         hrp_bytes_ref.data = hrp_bytes->elems;
5785         LDKCVec_U5Z invoice_data_constr;
5786         invoice_data_constr.datalen = invoice_data->arr_len;
5787         if (invoice_data_constr.datalen > 0)
5788                 invoice_data_constr.data = MALLOC(invoice_data_constr.datalen * sizeof(LDKU5), "LDKCVec_U5Z Elements");
5789         else
5790                 invoice_data_constr.data = NULL;
5791         int8_t* invoice_data_vals = (void*) invoice_data->elems;
5792         for (size_t h = 0; h < invoice_data_constr.datalen; h++) {
5793                 int8_t invoice_data_conv_7 = invoice_data_vals[h];
5794                 
5795                 invoice_data_constr.data[h] = (LDKU5){ ._0 = invoice_data_conv_7 };
5796         }
5797         FREE(invoice_data);
5798         LDKRecipient recipient_conv = LDKRecipient_from_js(recipient);
5799         LDKCResult_RecoverableSignatureNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_RecoverableSignatureNoneZ), "LDKCResult_RecoverableSignatureNoneZ");
5800         *ret_conv = (this_arg_conv->sign_invoice)(this_arg_conv->this_arg, hrp_bytes_ref, invoice_data_constr, recipient_conv);
5801         FREE(hrp_bytes);
5802         return tag_ptr(ret_conv, true);
5803 }
5804
5805 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) {
5806         void* this_arg_ptr = untag_ptr(this_arg);
5807         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
5808         LDKNodeSigner* this_arg_conv = (LDKNodeSigner*)this_arg_ptr;
5809         LDKUnsignedInvoiceRequest invoice_request_conv;
5810         invoice_request_conv.inner = untag_ptr(invoice_request);
5811         invoice_request_conv.is_owned = ptr_is_owned(invoice_request);
5812         CHECK_INNER_FIELD_ACCESS_OR_NULL(invoice_request_conv);
5813         invoice_request_conv.is_owned = false;
5814         LDKCResult_SchnorrSignatureNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_SchnorrSignatureNoneZ), "LDKCResult_SchnorrSignatureNoneZ");
5815         *ret_conv = (this_arg_conv->sign_bolt12_invoice_request)(this_arg_conv->this_arg, &invoice_request_conv);
5816         return tag_ptr(ret_conv, true);
5817 }
5818
5819 uint64_t  __attribute__((export_name("TS_NodeSigner_sign_bolt12_invoice"))) TS_NodeSigner_sign_bolt12_invoice(uint64_t this_arg, uint64_t invoice) {
5820         void* this_arg_ptr = untag_ptr(this_arg);
5821         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
5822         LDKNodeSigner* this_arg_conv = (LDKNodeSigner*)this_arg_ptr;
5823         LDKUnsignedBolt12Invoice invoice_conv;
5824         invoice_conv.inner = untag_ptr(invoice);
5825         invoice_conv.is_owned = ptr_is_owned(invoice);
5826         CHECK_INNER_FIELD_ACCESS_OR_NULL(invoice_conv);
5827         invoice_conv.is_owned = false;
5828         LDKCResult_SchnorrSignatureNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_SchnorrSignatureNoneZ), "LDKCResult_SchnorrSignatureNoneZ");
5829         *ret_conv = (this_arg_conv->sign_bolt12_invoice)(this_arg_conv->this_arg, &invoice_conv);
5830         return tag_ptr(ret_conv, true);
5831 }
5832
5833 uint64_t  __attribute__((export_name("TS_NodeSigner_sign_gossip_message"))) TS_NodeSigner_sign_gossip_message(uint64_t this_arg, uint64_t msg) {
5834         void* this_arg_ptr = untag_ptr(this_arg);
5835         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
5836         LDKNodeSigner* this_arg_conv = (LDKNodeSigner*)this_arg_ptr;
5837         void* msg_ptr = untag_ptr(msg);
5838         CHECK_ACCESS(msg_ptr);
5839         LDKUnsignedGossipMessage msg_conv = *(LDKUnsignedGossipMessage*)(msg_ptr);
5840         msg_conv = UnsignedGossipMessage_clone((LDKUnsignedGossipMessage*)untag_ptr(msg));
5841         LDKCResult_ECDSASignatureNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_ECDSASignatureNoneZ), "LDKCResult_ECDSASignatureNoneZ");
5842         *ret_conv = (this_arg_conv->sign_gossip_message)(this_arg_conv->this_arg, msg_conv);
5843         return tag_ptr(ret_conv, true);
5844 }
5845
5846 typedef struct LDKSignerProvider_JCalls {
5847         atomic_size_t refcnt;
5848         uint32_t instance_ptr;
5849 } LDKSignerProvider_JCalls;
5850 static void LDKSignerProvider_JCalls_free(void* this_arg) {
5851         LDKSignerProvider_JCalls *j_calls = (LDKSignerProvider_JCalls*) this_arg;
5852         if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
5853                 FREE(j_calls);
5854         }
5855 }
5856 LDKThirtyTwoBytes generate_channel_keys_id_LDKSignerProvider_jcall(const void* this_arg, bool inbound, uint64_t channel_value_satoshis, LDKU128 user_channel_id) {
5857         LDKSignerProvider_JCalls *j_calls = (LDKSignerProvider_JCalls*) this_arg;
5858         jboolean inbound_conv = inbound;
5859         int64_t channel_value_satoshis_conv = channel_value_satoshis;
5860         int8_tArray user_channel_id_arr = init_int8_tArray(16, __LINE__);
5861         memcpy(user_channel_id_arr->elems, user_channel_id.le_bytes, 16);
5862         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);
5863         LDKThirtyTwoBytes ret_ref;
5864         CHECK(ret->arr_len == 32);
5865         memcpy(ret_ref.data, ret->elems, 32); FREE(ret);
5866         return ret_ref;
5867 }
5868 LDKWriteableEcdsaChannelSigner derive_channel_signer_LDKSignerProvider_jcall(const void* this_arg, uint64_t channel_value_satoshis, LDKThirtyTwoBytes channel_keys_id) {
5869         LDKSignerProvider_JCalls *j_calls = (LDKSignerProvider_JCalls*) this_arg;
5870         int64_t channel_value_satoshis_conv = channel_value_satoshis;
5871         int8_tArray channel_keys_id_arr = init_int8_tArray(32, __LINE__);
5872         memcpy(channel_keys_id_arr->elems, channel_keys_id.data, 32);
5873         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);
5874         void* ret_ptr = untag_ptr(ret);
5875         CHECK_ACCESS(ret_ptr);
5876         LDKWriteableEcdsaChannelSigner ret_conv = *(LDKWriteableEcdsaChannelSigner*)(ret_ptr);
5877         FREE(untag_ptr(ret));
5878         return ret_conv;
5879 }
5880 LDKCResult_WriteableEcdsaChannelSignerDecodeErrorZ read_chan_signer_LDKSignerProvider_jcall(const void* this_arg, LDKu8slice reader) {
5881         LDKSignerProvider_JCalls *j_calls = (LDKSignerProvider_JCalls*) this_arg;
5882         LDKu8slice reader_var = reader;
5883         int8_tArray reader_arr = init_int8_tArray(reader_var.datalen, __LINE__);
5884         memcpy(reader_arr->elems, reader_var.data, reader_var.datalen);
5885         uint64_t ret = js_invoke_function_uuuuuu(j_calls->instance_ptr, 32, (uint32_t)reader_arr, 0, 0, 0, 0, 0);
5886         void* ret_ptr = untag_ptr(ret);
5887         CHECK_ACCESS(ret_ptr);
5888         LDKCResult_WriteableEcdsaChannelSignerDecodeErrorZ ret_conv = *(LDKCResult_WriteableEcdsaChannelSignerDecodeErrorZ*)(ret_ptr);
5889         FREE(untag_ptr(ret));
5890         return ret_conv;
5891 }
5892 LDKCResult_CVec_u8ZNoneZ get_destination_script_LDKSignerProvider_jcall(const void* this_arg) {
5893         LDKSignerProvider_JCalls *j_calls = (LDKSignerProvider_JCalls*) this_arg;
5894         uint64_t ret = js_invoke_function_uuuuuu(j_calls->instance_ptr, 33, 0, 0, 0, 0, 0, 0);
5895         void* ret_ptr = untag_ptr(ret);
5896         CHECK_ACCESS(ret_ptr);
5897         LDKCResult_CVec_u8ZNoneZ ret_conv = *(LDKCResult_CVec_u8ZNoneZ*)(ret_ptr);
5898         FREE(untag_ptr(ret));
5899         return ret_conv;
5900 }
5901 LDKCResult_ShutdownScriptNoneZ get_shutdown_scriptpubkey_LDKSignerProvider_jcall(const void* this_arg) {
5902         LDKSignerProvider_JCalls *j_calls = (LDKSignerProvider_JCalls*) this_arg;
5903         uint64_t ret = js_invoke_function_uuuuuu(j_calls->instance_ptr, 34, 0, 0, 0, 0, 0, 0);
5904         void* ret_ptr = untag_ptr(ret);
5905         CHECK_ACCESS(ret_ptr);
5906         LDKCResult_ShutdownScriptNoneZ ret_conv = *(LDKCResult_ShutdownScriptNoneZ*)(ret_ptr);
5907         FREE(untag_ptr(ret));
5908         return ret_conv;
5909 }
5910 static void LDKSignerProvider_JCalls_cloned(LDKSignerProvider* new_obj) {
5911         LDKSignerProvider_JCalls *j_calls = (LDKSignerProvider_JCalls*) new_obj->this_arg;
5912         atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
5913 }
5914 static inline LDKSignerProvider LDKSignerProvider_init (JSValue o) {
5915         LDKSignerProvider_JCalls *calls = MALLOC(sizeof(LDKSignerProvider_JCalls), "LDKSignerProvider_JCalls");
5916         atomic_init(&calls->refcnt, 1);
5917         calls->instance_ptr = o;
5918
5919         LDKSignerProvider ret = {
5920                 .this_arg = (void*) calls,
5921                 .generate_channel_keys_id = generate_channel_keys_id_LDKSignerProvider_jcall,
5922                 .derive_channel_signer = derive_channel_signer_LDKSignerProvider_jcall,
5923                 .read_chan_signer = read_chan_signer_LDKSignerProvider_jcall,
5924                 .get_destination_script = get_destination_script_LDKSignerProvider_jcall,
5925                 .get_shutdown_scriptpubkey = get_shutdown_scriptpubkey_LDKSignerProvider_jcall,
5926                 .free = LDKSignerProvider_JCalls_free,
5927         };
5928         return ret;
5929 }
5930 uint64_t  __attribute__((export_name("TS_LDKSignerProvider_new"))) TS_LDKSignerProvider_new(JSValue o) {
5931         LDKSignerProvider *res_ptr = MALLOC(sizeof(LDKSignerProvider), "LDKSignerProvider");
5932         *res_ptr = LDKSignerProvider_init(o);
5933         return tag_ptr(res_ptr, true);
5934 }
5935 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) {
5936         void* this_arg_ptr = untag_ptr(this_arg);
5937         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
5938         LDKSignerProvider* this_arg_conv = (LDKSignerProvider*)this_arg_ptr;
5939         LDKU128 user_channel_id_ref;
5940         CHECK(user_channel_id->arr_len == 16);
5941         memcpy(user_channel_id_ref.le_bytes, user_channel_id->elems, 16); FREE(user_channel_id);
5942         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
5943         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);
5944         return ret_arr;
5945 }
5946
5947 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) {
5948         void* this_arg_ptr = untag_ptr(this_arg);
5949         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
5950         LDKSignerProvider* this_arg_conv = (LDKSignerProvider*)this_arg_ptr;
5951         LDKThirtyTwoBytes channel_keys_id_ref;
5952         CHECK(channel_keys_id->arr_len == 32);
5953         memcpy(channel_keys_id_ref.data, channel_keys_id->elems, 32); FREE(channel_keys_id);
5954         LDKWriteableEcdsaChannelSigner* ret_ret = MALLOC(sizeof(LDKWriteableEcdsaChannelSigner), "LDKWriteableEcdsaChannelSigner");
5955         *ret_ret = (this_arg_conv->derive_channel_signer)(this_arg_conv->this_arg, channel_value_satoshis, channel_keys_id_ref);
5956         return tag_ptr(ret_ret, true);
5957 }
5958
5959 uint64_t  __attribute__((export_name("TS_SignerProvider_read_chan_signer"))) TS_SignerProvider_read_chan_signer(uint64_t this_arg, int8_tArray reader) {
5960         void* this_arg_ptr = untag_ptr(this_arg);
5961         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
5962         LDKSignerProvider* this_arg_conv = (LDKSignerProvider*)this_arg_ptr;
5963         LDKu8slice reader_ref;
5964         reader_ref.datalen = reader->arr_len;
5965         reader_ref.data = reader->elems;
5966         LDKCResult_WriteableEcdsaChannelSignerDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_WriteableEcdsaChannelSignerDecodeErrorZ), "LDKCResult_WriteableEcdsaChannelSignerDecodeErrorZ");
5967         *ret_conv = (this_arg_conv->read_chan_signer)(this_arg_conv->this_arg, reader_ref);
5968         FREE(reader);
5969         return tag_ptr(ret_conv, true);
5970 }
5971
5972 uint64_t  __attribute__((export_name("TS_SignerProvider_get_destination_script"))) TS_SignerProvider_get_destination_script(uint64_t this_arg) {
5973         void* this_arg_ptr = untag_ptr(this_arg);
5974         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
5975         LDKSignerProvider* this_arg_conv = (LDKSignerProvider*)this_arg_ptr;
5976         LDKCResult_CVec_u8ZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_u8ZNoneZ), "LDKCResult_CVec_u8ZNoneZ");
5977         *ret_conv = (this_arg_conv->get_destination_script)(this_arg_conv->this_arg);
5978         return tag_ptr(ret_conv, true);
5979 }
5980
5981 uint64_t  __attribute__((export_name("TS_SignerProvider_get_shutdown_scriptpubkey"))) TS_SignerProvider_get_shutdown_scriptpubkey(uint64_t this_arg) {
5982         void* this_arg_ptr = untag_ptr(this_arg);
5983         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
5984         LDKSignerProvider* this_arg_conv = (LDKSignerProvider*)this_arg_ptr;
5985         LDKCResult_ShutdownScriptNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_ShutdownScriptNoneZ), "LDKCResult_ShutdownScriptNoneZ");
5986         *ret_conv = (this_arg_conv->get_shutdown_scriptpubkey)(this_arg_conv->this_arg);
5987         return tag_ptr(ret_conv, true);
5988 }
5989
5990 typedef struct LDKFeeEstimator_JCalls {
5991         atomic_size_t refcnt;
5992         uint32_t instance_ptr;
5993 } LDKFeeEstimator_JCalls;
5994 static void LDKFeeEstimator_JCalls_free(void* this_arg) {
5995         LDKFeeEstimator_JCalls *j_calls = (LDKFeeEstimator_JCalls*) this_arg;
5996         if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
5997                 FREE(j_calls);
5998         }
5999 }
6000 uint32_t get_est_sat_per_1000_weight_LDKFeeEstimator_jcall(const void* this_arg, LDKConfirmationTarget confirmation_target) {
6001         LDKFeeEstimator_JCalls *j_calls = (LDKFeeEstimator_JCalls*) this_arg;
6002         uint32_t confirmation_target_conv = LDKConfirmationTarget_to_js(confirmation_target);
6003         return js_invoke_function_uuuuuu(j_calls->instance_ptr, 35, confirmation_target_conv, 0, 0, 0, 0, 0);
6004 }
6005 static void LDKFeeEstimator_JCalls_cloned(LDKFeeEstimator* new_obj) {
6006         LDKFeeEstimator_JCalls *j_calls = (LDKFeeEstimator_JCalls*) new_obj->this_arg;
6007         atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
6008 }
6009 static inline LDKFeeEstimator LDKFeeEstimator_init (JSValue o) {
6010         LDKFeeEstimator_JCalls *calls = MALLOC(sizeof(LDKFeeEstimator_JCalls), "LDKFeeEstimator_JCalls");
6011         atomic_init(&calls->refcnt, 1);
6012         calls->instance_ptr = o;
6013
6014         LDKFeeEstimator ret = {
6015                 .this_arg = (void*) calls,
6016                 .get_est_sat_per_1000_weight = get_est_sat_per_1000_weight_LDKFeeEstimator_jcall,
6017                 .free = LDKFeeEstimator_JCalls_free,
6018         };
6019         return ret;
6020 }
6021 uint64_t  __attribute__((export_name("TS_LDKFeeEstimator_new"))) TS_LDKFeeEstimator_new(JSValue o) {
6022         LDKFeeEstimator *res_ptr = MALLOC(sizeof(LDKFeeEstimator), "LDKFeeEstimator");
6023         *res_ptr = LDKFeeEstimator_init(o);
6024         return tag_ptr(res_ptr, true);
6025 }
6026 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) {
6027         void* this_arg_ptr = untag_ptr(this_arg);
6028         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
6029         LDKFeeEstimator* this_arg_conv = (LDKFeeEstimator*)this_arg_ptr;
6030         LDKConfirmationTarget confirmation_target_conv = LDKConfirmationTarget_from_js(confirmation_target);
6031         int32_t ret_conv = (this_arg_conv->get_est_sat_per_1000_weight)(this_arg_conv->this_arg, confirmation_target_conv);
6032         return ret_conv;
6033 }
6034
6035 typedef struct LDKRouter_JCalls {
6036         atomic_size_t refcnt;
6037         uint32_t instance_ptr;
6038 } LDKRouter_JCalls;
6039 static void LDKRouter_JCalls_free(void* this_arg) {
6040         LDKRouter_JCalls *j_calls = (LDKRouter_JCalls*) this_arg;
6041         if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
6042                 FREE(j_calls);
6043         }
6044 }
6045 LDKCResult_RouteLightningErrorZ find_route_LDKRouter_jcall(const void* this_arg, LDKPublicKey payer, const LDKRouteParameters * route_params, LDKCVec_ChannelDetailsZ * first_hops, LDKInFlightHtlcs inflight_htlcs) {
6046         LDKRouter_JCalls *j_calls = (LDKRouter_JCalls*) this_arg;
6047         int8_tArray payer_arr = init_int8_tArray(33, __LINE__);
6048         memcpy(payer_arr->elems, payer.compressed_form, 33);
6049         LDKRouteParameters route_params_var = *route_params;
6050         uint64_t route_params_ref = 0;
6051         route_params_var = RouteParameters_clone(&route_params_var);
6052         CHECK_INNER_FIELD_ACCESS_OR_NULL(route_params_var);
6053         route_params_ref = tag_ptr(route_params_var.inner, route_params_var.is_owned);
6054         LDKCVec_ChannelDetailsZ *first_hops_var_ptr = first_hops;
6055         uint64_tArray first_hops_arr = NULL;
6056         if (first_hops != NULL) {
6057                 LDKCVec_ChannelDetailsZ first_hops_var = *first_hops_var_ptr;
6058                 first_hops_arr = init_uint64_tArray(first_hops_var.datalen, __LINE__);
6059                 uint64_t *first_hops_arr_ptr = (uint64_t*)(((uint8_t*)first_hops_arr) + 8);
6060                 for (size_t q = 0; q < first_hops_var.datalen; q++) {
6061                         LDKChannelDetails first_hops_conv_16_var =      first_hops_var.data[q];
6062                         uint64_t first_hops_conv_16_ref = 0;
6063                         CHECK_INNER_FIELD_ACCESS_OR_NULL(first_hops_conv_16_var);
6064                         first_hops_conv_16_ref = tag_ptr(first_hops_conv_16_var.inner, first_hops_conv_16_var.is_owned);
6065                         first_hops_arr_ptr[q] = first_hops_conv_16_ref;
6066                 }
6067         
6068         }
6069         LDKInFlightHtlcs inflight_htlcs_var = inflight_htlcs;
6070         uint64_t inflight_htlcs_ref = 0;
6071         CHECK_INNER_FIELD_ACCESS_OR_NULL(inflight_htlcs_var);
6072         inflight_htlcs_ref = tag_ptr(inflight_htlcs_var.inner, inflight_htlcs_var.is_owned);
6073         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);
6074         void* ret_ptr = untag_ptr(ret);
6075         CHECK_ACCESS(ret_ptr);
6076         LDKCResult_RouteLightningErrorZ ret_conv = *(LDKCResult_RouteLightningErrorZ*)(ret_ptr);
6077         FREE(untag_ptr(ret));
6078         return ret_conv;
6079 }
6080 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) {
6081         LDKRouter_JCalls *j_calls = (LDKRouter_JCalls*) this_arg;
6082         int8_tArray payer_arr = init_int8_tArray(33, __LINE__);
6083         memcpy(payer_arr->elems, payer.compressed_form, 33);
6084         LDKRouteParameters route_params_var = *route_params;
6085         uint64_t route_params_ref = 0;
6086         route_params_var = RouteParameters_clone(&route_params_var);
6087         CHECK_INNER_FIELD_ACCESS_OR_NULL(route_params_var);
6088         route_params_ref = tag_ptr(route_params_var.inner, route_params_var.is_owned);
6089         LDKCVec_ChannelDetailsZ *first_hops_var_ptr = first_hops;
6090         uint64_tArray first_hops_arr = NULL;
6091         if (first_hops != NULL) {
6092                 LDKCVec_ChannelDetailsZ first_hops_var = *first_hops_var_ptr;
6093                 first_hops_arr = init_uint64_tArray(first_hops_var.datalen, __LINE__);
6094                 uint64_t *first_hops_arr_ptr = (uint64_t*)(((uint8_t*)first_hops_arr) + 8);
6095                 for (size_t q = 0; q < first_hops_var.datalen; q++) {
6096                         LDKChannelDetails first_hops_conv_16_var =      first_hops_var.data[q];
6097                         uint64_t first_hops_conv_16_ref = 0;
6098                         CHECK_INNER_FIELD_ACCESS_OR_NULL(first_hops_conv_16_var);
6099                         first_hops_conv_16_ref = tag_ptr(first_hops_conv_16_var.inner, first_hops_conv_16_var.is_owned);
6100                         first_hops_arr_ptr[q] = first_hops_conv_16_ref;
6101                 }
6102         
6103         }
6104         LDKInFlightHtlcs inflight_htlcs_var = inflight_htlcs;
6105         uint64_t inflight_htlcs_ref = 0;
6106         CHECK_INNER_FIELD_ACCESS_OR_NULL(inflight_htlcs_var);
6107         inflight_htlcs_ref = tag_ptr(inflight_htlcs_var.inner, inflight_htlcs_var.is_owned);
6108         int8_tArray _payment_hash_arr = init_int8_tArray(32, __LINE__);
6109         memcpy(_payment_hash_arr->elems, _payment_hash.data, 32);
6110         int8_tArray _payment_id_arr = init_int8_tArray(32, __LINE__);
6111         memcpy(_payment_id_arr->elems, _payment_id.data, 32);
6112         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);
6113         void* ret_ptr = untag_ptr(ret);
6114         CHECK_ACCESS(ret_ptr);
6115         LDKCResult_RouteLightningErrorZ ret_conv = *(LDKCResult_RouteLightningErrorZ*)(ret_ptr);
6116         FREE(untag_ptr(ret));
6117         return ret_conv;
6118 }
6119 static void LDKRouter_JCalls_cloned(LDKRouter* new_obj) {
6120         LDKRouter_JCalls *j_calls = (LDKRouter_JCalls*) new_obj->this_arg;
6121         atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
6122 }
6123 static inline LDKRouter LDKRouter_init (JSValue o) {
6124         LDKRouter_JCalls *calls = MALLOC(sizeof(LDKRouter_JCalls), "LDKRouter_JCalls");
6125         atomic_init(&calls->refcnt, 1);
6126         calls->instance_ptr = o;
6127
6128         LDKRouter ret = {
6129                 .this_arg = (void*) calls,
6130                 .find_route = find_route_LDKRouter_jcall,
6131                 .find_route_with_id = find_route_with_id_LDKRouter_jcall,
6132                 .free = LDKRouter_JCalls_free,
6133         };
6134         return ret;
6135 }
6136 uint64_t  __attribute__((export_name("TS_LDKRouter_new"))) TS_LDKRouter_new(JSValue o) {
6137         LDKRouter *res_ptr = MALLOC(sizeof(LDKRouter), "LDKRouter");
6138         *res_ptr = LDKRouter_init(o);
6139         return tag_ptr(res_ptr, true);
6140 }
6141 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) {
6142         void* this_arg_ptr = untag_ptr(this_arg);
6143         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
6144         LDKRouter* this_arg_conv = (LDKRouter*)this_arg_ptr;
6145         LDKPublicKey payer_ref;
6146         CHECK(payer->arr_len == 33);
6147         memcpy(payer_ref.compressed_form, payer->elems, 33); FREE(payer);
6148         LDKRouteParameters route_params_conv;
6149         route_params_conv.inner = untag_ptr(route_params);
6150         route_params_conv.is_owned = ptr_is_owned(route_params);
6151         CHECK_INNER_FIELD_ACCESS_OR_NULL(route_params_conv);
6152         route_params_conv.is_owned = false;
6153         LDKCVec_ChannelDetailsZ first_hops_constr;
6154         LDKCVec_ChannelDetailsZ *first_hops_ptr = NULL;
6155         if (first_hops != 0) {
6156                 first_hops_constr.datalen = first_hops->arr_len;
6157                 if (first_hops_constr.datalen > 0)
6158                         first_hops_constr.data = MALLOC(first_hops_constr.datalen * sizeof(LDKChannelDetails), "LDKCVec_ChannelDetailsZ Elements");
6159                 else
6160                         first_hops_constr.data = NULL;
6161                 uint64_t* first_hops_vals = first_hops->elems;
6162                 for (size_t q = 0; q < first_hops_constr.datalen; q++) {
6163                         uint64_t first_hops_conv_16 = first_hops_vals[q];
6164                         LDKChannelDetails first_hops_conv_16_conv;
6165                         first_hops_conv_16_conv.inner = untag_ptr(first_hops_conv_16);
6166                         first_hops_conv_16_conv.is_owned = ptr_is_owned(first_hops_conv_16);
6167                         CHECK_INNER_FIELD_ACCESS_OR_NULL(first_hops_conv_16_conv);
6168                         first_hops_conv_16_conv.is_owned = false;
6169                         first_hops_constr.data[q] = first_hops_conv_16_conv;
6170                 }
6171                 FREE(first_hops);
6172                 first_hops_ptr = &first_hops_constr;
6173         }
6174         LDKInFlightHtlcs inflight_htlcs_conv;
6175         inflight_htlcs_conv.inner = untag_ptr(inflight_htlcs);
6176         inflight_htlcs_conv.is_owned = ptr_is_owned(inflight_htlcs);
6177         CHECK_INNER_FIELD_ACCESS_OR_NULL(inflight_htlcs_conv);
6178         inflight_htlcs_conv = InFlightHtlcs_clone(&inflight_htlcs_conv);
6179         LDKCResult_RouteLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteLightningErrorZ), "LDKCResult_RouteLightningErrorZ");
6180         *ret_conv = (this_arg_conv->find_route)(this_arg_conv->this_arg, payer_ref, &route_params_conv, first_hops_ptr, inflight_htlcs_conv);
6181         if (first_hops_ptr != NULL) { FREE(first_hops_constr.data); }
6182         return tag_ptr(ret_conv, true);
6183 }
6184
6185 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) {
6186         void* this_arg_ptr = untag_ptr(this_arg);
6187         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
6188         LDKRouter* this_arg_conv = (LDKRouter*)this_arg_ptr;
6189         LDKPublicKey payer_ref;
6190         CHECK(payer->arr_len == 33);
6191         memcpy(payer_ref.compressed_form, payer->elems, 33); FREE(payer);
6192         LDKRouteParameters route_params_conv;
6193         route_params_conv.inner = untag_ptr(route_params);
6194         route_params_conv.is_owned = ptr_is_owned(route_params);
6195         CHECK_INNER_FIELD_ACCESS_OR_NULL(route_params_conv);
6196         route_params_conv.is_owned = false;
6197         LDKCVec_ChannelDetailsZ first_hops_constr;
6198         LDKCVec_ChannelDetailsZ *first_hops_ptr = NULL;
6199         if (first_hops != 0) {
6200                 first_hops_constr.datalen = first_hops->arr_len;
6201                 if (first_hops_constr.datalen > 0)
6202                         first_hops_constr.data = MALLOC(first_hops_constr.datalen * sizeof(LDKChannelDetails), "LDKCVec_ChannelDetailsZ Elements");
6203                 else
6204                         first_hops_constr.data = NULL;
6205                 uint64_t* first_hops_vals = first_hops->elems;
6206                 for (size_t q = 0; q < first_hops_constr.datalen; q++) {
6207                         uint64_t first_hops_conv_16 = first_hops_vals[q];
6208                         LDKChannelDetails first_hops_conv_16_conv;
6209                         first_hops_conv_16_conv.inner = untag_ptr(first_hops_conv_16);
6210                         first_hops_conv_16_conv.is_owned = ptr_is_owned(first_hops_conv_16);
6211                         CHECK_INNER_FIELD_ACCESS_OR_NULL(first_hops_conv_16_conv);
6212                         first_hops_conv_16_conv.is_owned = false;
6213                         first_hops_constr.data[q] = first_hops_conv_16_conv;
6214                 }
6215                 FREE(first_hops);
6216                 first_hops_ptr = &first_hops_constr;
6217         }
6218         LDKInFlightHtlcs inflight_htlcs_conv;
6219         inflight_htlcs_conv.inner = untag_ptr(inflight_htlcs);
6220         inflight_htlcs_conv.is_owned = ptr_is_owned(inflight_htlcs);
6221         CHECK_INNER_FIELD_ACCESS_OR_NULL(inflight_htlcs_conv);
6222         inflight_htlcs_conv = InFlightHtlcs_clone(&inflight_htlcs_conv);
6223         LDKThirtyTwoBytes _payment_hash_ref;
6224         CHECK(_payment_hash->arr_len == 32);
6225         memcpy(_payment_hash_ref.data, _payment_hash->elems, 32); FREE(_payment_hash);
6226         LDKThirtyTwoBytes _payment_id_ref;
6227         CHECK(_payment_id->arr_len == 32);
6228         memcpy(_payment_id_ref.data, _payment_id->elems, 32); FREE(_payment_id);
6229         LDKCResult_RouteLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteLightningErrorZ), "LDKCResult_RouteLightningErrorZ");
6230         *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);
6231         if (first_hops_ptr != NULL) { FREE(first_hops_constr.data); }
6232         return tag_ptr(ret_conv, true);
6233 }
6234
6235 static inline struct LDKThirtyTwoBytes C2Tuple_ThirtyTwoBytesChannelManagerZ_get_a(LDKC2Tuple_ThirtyTwoBytesChannelManagerZ *NONNULL_PTR owner){
6236         return ThirtyTwoBytes_clone(&owner->a);
6237 }
6238 int8_tArray  __attribute__((export_name("TS_C2Tuple_ThirtyTwoBytesChannelManagerZ_get_a"))) TS_C2Tuple_ThirtyTwoBytesChannelManagerZ_get_a(uint64_t owner) {
6239         LDKC2Tuple_ThirtyTwoBytesChannelManagerZ* owner_conv = (LDKC2Tuple_ThirtyTwoBytesChannelManagerZ*)untag_ptr(owner);
6240         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
6241         memcpy(ret_arr->elems, C2Tuple_ThirtyTwoBytesChannelManagerZ_get_a(owner_conv).data, 32);
6242         return ret_arr;
6243 }
6244
6245 static inline struct LDKChannelManager C2Tuple_ThirtyTwoBytesChannelManagerZ_get_b(LDKC2Tuple_ThirtyTwoBytesChannelManagerZ *NONNULL_PTR owner){
6246         LDKChannelManager ret = owner->b;
6247         ret.is_owned = false;
6248         return ret;
6249 }
6250 uint64_t  __attribute__((export_name("TS_C2Tuple_ThirtyTwoBytesChannelManagerZ_get_b"))) TS_C2Tuple_ThirtyTwoBytesChannelManagerZ_get_b(uint64_t owner) {
6251         LDKC2Tuple_ThirtyTwoBytesChannelManagerZ* owner_conv = (LDKC2Tuple_ThirtyTwoBytesChannelManagerZ*)untag_ptr(owner);
6252         LDKChannelManager ret_var = C2Tuple_ThirtyTwoBytesChannelManagerZ_get_b(owner_conv);
6253         uint64_t ret_ref = 0;
6254         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
6255         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
6256         return ret_ref;
6257 }
6258
6259 static inline struct LDKC2Tuple_ThirtyTwoBytesChannelManagerZ *CResult_C2Tuple_ThirtyTwoBytesChannelManagerZDecodeErrorZ_get_ok(LDKCResult_C2Tuple_ThirtyTwoBytesChannelManagerZDecodeErrorZ *NONNULL_PTR owner){
6260 CHECK(owner->result_ok);
6261         return &*owner->contents.result;
6262 }
6263 uint64_t  __attribute__((export_name("TS_CResult_C2Tuple_ThirtyTwoBytesChannelManagerZDecodeErrorZ_get_ok"))) TS_CResult_C2Tuple_ThirtyTwoBytesChannelManagerZDecodeErrorZ_get_ok(uint64_t owner) {
6264         LDKCResult_C2Tuple_ThirtyTwoBytesChannelManagerZDecodeErrorZ* owner_conv = (LDKCResult_C2Tuple_ThirtyTwoBytesChannelManagerZDecodeErrorZ*)untag_ptr(owner);
6265         uint64_t ret_ret = tag_ptr(CResult_C2Tuple_ThirtyTwoBytesChannelManagerZDecodeErrorZ_get_ok(owner_conv), false);
6266         return ret_ret;
6267 }
6268
6269 static inline struct LDKDecodeError CResult_C2Tuple_ThirtyTwoBytesChannelManagerZDecodeErrorZ_get_err(LDKCResult_C2Tuple_ThirtyTwoBytesChannelManagerZDecodeErrorZ *NONNULL_PTR owner){
6270 CHECK(!owner->result_ok);
6271         return DecodeError_clone(&*owner->contents.err);
6272 }
6273 uint64_t  __attribute__((export_name("TS_CResult_C2Tuple_ThirtyTwoBytesChannelManagerZDecodeErrorZ_get_err"))) TS_CResult_C2Tuple_ThirtyTwoBytesChannelManagerZDecodeErrorZ_get_err(uint64_t owner) {
6274         LDKCResult_C2Tuple_ThirtyTwoBytesChannelManagerZDecodeErrorZ* owner_conv = (LDKCResult_C2Tuple_ThirtyTwoBytesChannelManagerZDecodeErrorZ*)untag_ptr(owner);
6275         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
6276         *ret_copy = CResult_C2Tuple_ThirtyTwoBytesChannelManagerZDecodeErrorZ_get_err(owner_conv);
6277         uint64_t ret_ref = tag_ptr(ret_copy, true);
6278         return ret_ref;
6279 }
6280
6281 uint32_t __attribute__((export_name("TS_LDKMaxDustHTLCExposure_ty_from_ptr"))) TS_LDKMaxDustHTLCExposure_ty_from_ptr(uint64_t ptr) {
6282         LDKMaxDustHTLCExposure *obj = (LDKMaxDustHTLCExposure*)untag_ptr(ptr);
6283         switch(obj->tag) {
6284                 case LDKMaxDustHTLCExposure_FixedLimitMsat: return 0;
6285                 case LDKMaxDustHTLCExposure_FeeRateMultiplier: return 1;
6286                 default: abort();
6287         }
6288 }
6289 int64_t __attribute__((export_name("TS_LDKMaxDustHTLCExposure_FixedLimitMsat_get_fixed_limit_msat"))) TS_LDKMaxDustHTLCExposure_FixedLimitMsat_get_fixed_limit_msat(uint64_t ptr) {
6290         LDKMaxDustHTLCExposure *obj = (LDKMaxDustHTLCExposure*)untag_ptr(ptr);
6291         assert(obj->tag == LDKMaxDustHTLCExposure_FixedLimitMsat);
6292         int64_t fixed_limit_msat_conv = obj->fixed_limit_msat;
6293         return fixed_limit_msat_conv;
6294 }
6295 int64_t __attribute__((export_name("TS_LDKMaxDustHTLCExposure_FeeRateMultiplier_get_fee_rate_multiplier"))) TS_LDKMaxDustHTLCExposure_FeeRateMultiplier_get_fee_rate_multiplier(uint64_t ptr) {
6296         LDKMaxDustHTLCExposure *obj = (LDKMaxDustHTLCExposure*)untag_ptr(ptr);
6297         assert(obj->tag == LDKMaxDustHTLCExposure_FeeRateMultiplier);
6298         int64_t fee_rate_multiplier_conv = obj->fee_rate_multiplier;
6299         return fee_rate_multiplier_conv;
6300 }
6301 static inline struct LDKMaxDustHTLCExposure CResult_MaxDustHTLCExposureDecodeErrorZ_get_ok(LDKCResult_MaxDustHTLCExposureDecodeErrorZ *NONNULL_PTR owner){
6302 CHECK(owner->result_ok);
6303         return MaxDustHTLCExposure_clone(&*owner->contents.result);
6304 }
6305 uint64_t  __attribute__((export_name("TS_CResult_MaxDustHTLCExposureDecodeErrorZ_get_ok"))) TS_CResult_MaxDustHTLCExposureDecodeErrorZ_get_ok(uint64_t owner) {
6306         LDKCResult_MaxDustHTLCExposureDecodeErrorZ* owner_conv = (LDKCResult_MaxDustHTLCExposureDecodeErrorZ*)untag_ptr(owner);
6307         LDKMaxDustHTLCExposure *ret_copy = MALLOC(sizeof(LDKMaxDustHTLCExposure), "LDKMaxDustHTLCExposure");
6308         *ret_copy = CResult_MaxDustHTLCExposureDecodeErrorZ_get_ok(owner_conv);
6309         uint64_t ret_ref = tag_ptr(ret_copy, true);
6310         return ret_ref;
6311 }
6312
6313 static inline struct LDKDecodeError CResult_MaxDustHTLCExposureDecodeErrorZ_get_err(LDKCResult_MaxDustHTLCExposureDecodeErrorZ *NONNULL_PTR owner){
6314 CHECK(!owner->result_ok);
6315         return DecodeError_clone(&*owner->contents.err);
6316 }
6317 uint64_t  __attribute__((export_name("TS_CResult_MaxDustHTLCExposureDecodeErrorZ_get_err"))) TS_CResult_MaxDustHTLCExposureDecodeErrorZ_get_err(uint64_t owner) {
6318         LDKCResult_MaxDustHTLCExposureDecodeErrorZ* owner_conv = (LDKCResult_MaxDustHTLCExposureDecodeErrorZ*)untag_ptr(owner);
6319         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
6320         *ret_copy = CResult_MaxDustHTLCExposureDecodeErrorZ_get_err(owner_conv);
6321         uint64_t ret_ref = tag_ptr(ret_copy, true);
6322         return ret_ref;
6323 }
6324
6325 static inline struct LDKChannelConfig CResult_ChannelConfigDecodeErrorZ_get_ok(LDKCResult_ChannelConfigDecodeErrorZ *NONNULL_PTR owner){
6326         LDKChannelConfig ret = *owner->contents.result;
6327         ret.is_owned = false;
6328         return ret;
6329 }
6330 uint64_t  __attribute__((export_name("TS_CResult_ChannelConfigDecodeErrorZ_get_ok"))) TS_CResult_ChannelConfigDecodeErrorZ_get_ok(uint64_t owner) {
6331         LDKCResult_ChannelConfigDecodeErrorZ* owner_conv = (LDKCResult_ChannelConfigDecodeErrorZ*)untag_ptr(owner);
6332         LDKChannelConfig ret_var = CResult_ChannelConfigDecodeErrorZ_get_ok(owner_conv);
6333         uint64_t ret_ref = 0;
6334         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
6335         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
6336         return ret_ref;
6337 }
6338
6339 static inline struct LDKDecodeError CResult_ChannelConfigDecodeErrorZ_get_err(LDKCResult_ChannelConfigDecodeErrorZ *NONNULL_PTR owner){
6340 CHECK(!owner->result_ok);
6341         return DecodeError_clone(&*owner->contents.err);
6342 }
6343 uint64_t  __attribute__((export_name("TS_CResult_ChannelConfigDecodeErrorZ_get_err"))) TS_CResult_ChannelConfigDecodeErrorZ_get_err(uint64_t owner) {
6344         LDKCResult_ChannelConfigDecodeErrorZ* owner_conv = (LDKCResult_ChannelConfigDecodeErrorZ*)untag_ptr(owner);
6345         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
6346         *ret_copy = CResult_ChannelConfigDecodeErrorZ_get_err(owner_conv);
6347         uint64_t ret_ref = tag_ptr(ret_copy, true);
6348         return ret_ref;
6349 }
6350
6351 uint32_t __attribute__((export_name("TS_LDKCOption_MaxDustHTLCExposureZ_ty_from_ptr"))) TS_LDKCOption_MaxDustHTLCExposureZ_ty_from_ptr(uint64_t ptr) {
6352         LDKCOption_MaxDustHTLCExposureZ *obj = (LDKCOption_MaxDustHTLCExposureZ*)untag_ptr(ptr);
6353         switch(obj->tag) {
6354                 case LDKCOption_MaxDustHTLCExposureZ_Some: return 0;
6355                 case LDKCOption_MaxDustHTLCExposureZ_None: return 1;
6356                 default: abort();
6357         }
6358 }
6359 uint64_t __attribute__((export_name("TS_LDKCOption_MaxDustHTLCExposureZ_Some_get_some"))) TS_LDKCOption_MaxDustHTLCExposureZ_Some_get_some(uint64_t ptr) {
6360         LDKCOption_MaxDustHTLCExposureZ *obj = (LDKCOption_MaxDustHTLCExposureZ*)untag_ptr(ptr);
6361         assert(obj->tag == LDKCOption_MaxDustHTLCExposureZ_Some);
6362         uint64_t some_ref = tag_ptr(&obj->some, false);
6363         return some_ref;
6364 }
6365 uint32_t __attribute__((export_name("TS_LDKCOption_APIErrorZ_ty_from_ptr"))) TS_LDKCOption_APIErrorZ_ty_from_ptr(uint64_t ptr) {
6366         LDKCOption_APIErrorZ *obj = (LDKCOption_APIErrorZ*)untag_ptr(ptr);
6367         switch(obj->tag) {
6368                 case LDKCOption_APIErrorZ_Some: return 0;
6369                 case LDKCOption_APIErrorZ_None: return 1;
6370                 default: abort();
6371         }
6372 }
6373 uint64_t __attribute__((export_name("TS_LDKCOption_APIErrorZ_Some_get_some"))) TS_LDKCOption_APIErrorZ_Some_get_some(uint64_t ptr) {
6374         LDKCOption_APIErrorZ *obj = (LDKCOption_APIErrorZ*)untag_ptr(ptr);
6375         assert(obj->tag == LDKCOption_APIErrorZ_Some);
6376         uint64_t some_ref = tag_ptr(&obj->some, false);
6377         return some_ref;
6378 }
6379 static inline struct LDKCOption_APIErrorZ CResult_COption_APIErrorZDecodeErrorZ_get_ok(LDKCResult_COption_APIErrorZDecodeErrorZ *NONNULL_PTR owner){
6380 CHECK(owner->result_ok);
6381         return COption_APIErrorZ_clone(&*owner->contents.result);
6382 }
6383 uint64_t  __attribute__((export_name("TS_CResult_COption_APIErrorZDecodeErrorZ_get_ok"))) TS_CResult_COption_APIErrorZDecodeErrorZ_get_ok(uint64_t owner) {
6384         LDKCResult_COption_APIErrorZDecodeErrorZ* owner_conv = (LDKCResult_COption_APIErrorZDecodeErrorZ*)untag_ptr(owner);
6385         LDKCOption_APIErrorZ *ret_copy = MALLOC(sizeof(LDKCOption_APIErrorZ), "LDKCOption_APIErrorZ");
6386         *ret_copy = CResult_COption_APIErrorZDecodeErrorZ_get_ok(owner_conv);
6387         uint64_t ret_ref = tag_ptr(ret_copy, true);
6388         return ret_ref;
6389 }
6390
6391 static inline struct LDKDecodeError CResult_COption_APIErrorZDecodeErrorZ_get_err(LDKCResult_COption_APIErrorZDecodeErrorZ *NONNULL_PTR owner){
6392 CHECK(!owner->result_ok);
6393         return DecodeError_clone(&*owner->contents.err);
6394 }
6395 uint64_t  __attribute__((export_name("TS_CResult_COption_APIErrorZDecodeErrorZ_get_err"))) TS_CResult_COption_APIErrorZDecodeErrorZ_get_err(uint64_t owner) {
6396         LDKCResult_COption_APIErrorZDecodeErrorZ* owner_conv = (LDKCResult_COption_APIErrorZDecodeErrorZ*)untag_ptr(owner);
6397         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
6398         *ret_copy = CResult_COption_APIErrorZDecodeErrorZ_get_err(owner_conv);
6399         uint64_t ret_ref = tag_ptr(ret_copy, true);
6400         return ret_ref;
6401 }
6402
6403 static inline struct LDKChannelMonitorUpdate CResult_ChannelMonitorUpdateDecodeErrorZ_get_ok(LDKCResult_ChannelMonitorUpdateDecodeErrorZ *NONNULL_PTR owner){
6404         LDKChannelMonitorUpdate ret = *owner->contents.result;
6405         ret.is_owned = false;
6406         return ret;
6407 }
6408 uint64_t  __attribute__((export_name("TS_CResult_ChannelMonitorUpdateDecodeErrorZ_get_ok"))) TS_CResult_ChannelMonitorUpdateDecodeErrorZ_get_ok(uint64_t owner) {
6409         LDKCResult_ChannelMonitorUpdateDecodeErrorZ* owner_conv = (LDKCResult_ChannelMonitorUpdateDecodeErrorZ*)untag_ptr(owner);
6410         LDKChannelMonitorUpdate ret_var = CResult_ChannelMonitorUpdateDecodeErrorZ_get_ok(owner_conv);
6411         uint64_t ret_ref = 0;
6412         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
6413         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
6414         return ret_ref;
6415 }
6416
6417 static inline struct LDKDecodeError CResult_ChannelMonitorUpdateDecodeErrorZ_get_err(LDKCResult_ChannelMonitorUpdateDecodeErrorZ *NONNULL_PTR owner){
6418 CHECK(!owner->result_ok);
6419         return DecodeError_clone(&*owner->contents.err);
6420 }
6421 uint64_t  __attribute__((export_name("TS_CResult_ChannelMonitorUpdateDecodeErrorZ_get_err"))) TS_CResult_ChannelMonitorUpdateDecodeErrorZ_get_err(uint64_t owner) {
6422         LDKCResult_ChannelMonitorUpdateDecodeErrorZ* owner_conv = (LDKCResult_ChannelMonitorUpdateDecodeErrorZ*)untag_ptr(owner);
6423         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
6424         *ret_copy = CResult_ChannelMonitorUpdateDecodeErrorZ_get_err(owner_conv);
6425         uint64_t ret_ref = tag_ptr(ret_copy, true);
6426         return ret_ref;
6427 }
6428
6429 uint32_t __attribute__((export_name("TS_LDKCOption_MonitorEventZ_ty_from_ptr"))) TS_LDKCOption_MonitorEventZ_ty_from_ptr(uint64_t ptr) {
6430         LDKCOption_MonitorEventZ *obj = (LDKCOption_MonitorEventZ*)untag_ptr(ptr);
6431         switch(obj->tag) {
6432                 case LDKCOption_MonitorEventZ_Some: return 0;
6433                 case LDKCOption_MonitorEventZ_None: return 1;
6434                 default: abort();
6435         }
6436 }
6437 uint64_t __attribute__((export_name("TS_LDKCOption_MonitorEventZ_Some_get_some"))) TS_LDKCOption_MonitorEventZ_Some_get_some(uint64_t ptr) {
6438         LDKCOption_MonitorEventZ *obj = (LDKCOption_MonitorEventZ*)untag_ptr(ptr);
6439         assert(obj->tag == LDKCOption_MonitorEventZ_Some);
6440         uint64_t some_ref = tag_ptr(&obj->some, false);
6441         return some_ref;
6442 }
6443 static inline struct LDKCOption_MonitorEventZ CResult_COption_MonitorEventZDecodeErrorZ_get_ok(LDKCResult_COption_MonitorEventZDecodeErrorZ *NONNULL_PTR owner){
6444 CHECK(owner->result_ok);
6445         return COption_MonitorEventZ_clone(&*owner->contents.result);
6446 }
6447 uint64_t  __attribute__((export_name("TS_CResult_COption_MonitorEventZDecodeErrorZ_get_ok"))) TS_CResult_COption_MonitorEventZDecodeErrorZ_get_ok(uint64_t owner) {
6448         LDKCResult_COption_MonitorEventZDecodeErrorZ* owner_conv = (LDKCResult_COption_MonitorEventZDecodeErrorZ*)untag_ptr(owner);
6449         LDKCOption_MonitorEventZ *ret_copy = MALLOC(sizeof(LDKCOption_MonitorEventZ), "LDKCOption_MonitorEventZ");
6450         *ret_copy = CResult_COption_MonitorEventZDecodeErrorZ_get_ok(owner_conv);
6451         uint64_t ret_ref = tag_ptr(ret_copy, true);
6452         return ret_ref;
6453 }
6454
6455 static inline struct LDKDecodeError CResult_COption_MonitorEventZDecodeErrorZ_get_err(LDKCResult_COption_MonitorEventZDecodeErrorZ *NONNULL_PTR owner){
6456 CHECK(!owner->result_ok);
6457         return DecodeError_clone(&*owner->contents.err);
6458 }
6459 uint64_t  __attribute__((export_name("TS_CResult_COption_MonitorEventZDecodeErrorZ_get_err"))) TS_CResult_COption_MonitorEventZDecodeErrorZ_get_err(uint64_t owner) {
6460         LDKCResult_COption_MonitorEventZDecodeErrorZ* owner_conv = (LDKCResult_COption_MonitorEventZDecodeErrorZ*)untag_ptr(owner);
6461         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
6462         *ret_copy = CResult_COption_MonitorEventZDecodeErrorZ_get_err(owner_conv);
6463         uint64_t ret_ref = tag_ptr(ret_copy, true);
6464         return ret_ref;
6465 }
6466
6467 static inline struct LDKHTLCUpdate CResult_HTLCUpdateDecodeErrorZ_get_ok(LDKCResult_HTLCUpdateDecodeErrorZ *NONNULL_PTR owner){
6468         LDKHTLCUpdate ret = *owner->contents.result;
6469         ret.is_owned = false;
6470         return ret;
6471 }
6472 uint64_t  __attribute__((export_name("TS_CResult_HTLCUpdateDecodeErrorZ_get_ok"))) TS_CResult_HTLCUpdateDecodeErrorZ_get_ok(uint64_t owner) {
6473         LDKCResult_HTLCUpdateDecodeErrorZ* owner_conv = (LDKCResult_HTLCUpdateDecodeErrorZ*)untag_ptr(owner);
6474         LDKHTLCUpdate ret_var = CResult_HTLCUpdateDecodeErrorZ_get_ok(owner_conv);
6475         uint64_t ret_ref = 0;
6476         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
6477         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
6478         return ret_ref;
6479 }
6480
6481 static inline struct LDKDecodeError CResult_HTLCUpdateDecodeErrorZ_get_err(LDKCResult_HTLCUpdateDecodeErrorZ *NONNULL_PTR owner){
6482 CHECK(!owner->result_ok);
6483         return DecodeError_clone(&*owner->contents.err);
6484 }
6485 uint64_t  __attribute__((export_name("TS_CResult_HTLCUpdateDecodeErrorZ_get_err"))) TS_CResult_HTLCUpdateDecodeErrorZ_get_err(uint64_t owner) {
6486         LDKCResult_HTLCUpdateDecodeErrorZ* owner_conv = (LDKCResult_HTLCUpdateDecodeErrorZ*)untag_ptr(owner);
6487         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
6488         *ret_copy = CResult_HTLCUpdateDecodeErrorZ_get_err(owner_conv);
6489         uint64_t ret_ref = tag_ptr(ret_copy, true);
6490         return ret_ref;
6491 }
6492
6493 static inline struct LDKOutPoint C2Tuple_OutPointCVec_u8ZZ_get_a(LDKC2Tuple_OutPointCVec_u8ZZ *NONNULL_PTR owner){
6494         LDKOutPoint ret = owner->a;
6495         ret.is_owned = false;
6496         return ret;
6497 }
6498 uint64_t  __attribute__((export_name("TS_C2Tuple_OutPointCVec_u8ZZ_get_a"))) TS_C2Tuple_OutPointCVec_u8ZZ_get_a(uint64_t owner) {
6499         LDKC2Tuple_OutPointCVec_u8ZZ* owner_conv = (LDKC2Tuple_OutPointCVec_u8ZZ*)untag_ptr(owner);
6500         LDKOutPoint ret_var = C2Tuple_OutPointCVec_u8ZZ_get_a(owner_conv);
6501         uint64_t ret_ref = 0;
6502         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
6503         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
6504         return ret_ref;
6505 }
6506
6507 static inline struct LDKCVec_u8Z C2Tuple_OutPointCVec_u8ZZ_get_b(LDKC2Tuple_OutPointCVec_u8ZZ *NONNULL_PTR owner){
6508         return CVec_u8Z_clone(&owner->b);
6509 }
6510 int8_tArray  __attribute__((export_name("TS_C2Tuple_OutPointCVec_u8ZZ_get_b"))) TS_C2Tuple_OutPointCVec_u8ZZ_get_b(uint64_t owner) {
6511         LDKC2Tuple_OutPointCVec_u8ZZ* owner_conv = (LDKC2Tuple_OutPointCVec_u8ZZ*)untag_ptr(owner);
6512         LDKCVec_u8Z ret_var = C2Tuple_OutPointCVec_u8ZZ_get_b(owner_conv);
6513         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
6514         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
6515         CVec_u8Z_free(ret_var);
6516         return ret_arr;
6517 }
6518
6519 static inline uint32_t C2Tuple_u32CVec_u8ZZ_get_a(LDKC2Tuple_u32CVec_u8ZZ *NONNULL_PTR owner){
6520         return owner->a;
6521 }
6522 int32_t  __attribute__((export_name("TS_C2Tuple_u32CVec_u8ZZ_get_a"))) TS_C2Tuple_u32CVec_u8ZZ_get_a(uint64_t owner) {
6523         LDKC2Tuple_u32CVec_u8ZZ* owner_conv = (LDKC2Tuple_u32CVec_u8ZZ*)untag_ptr(owner);
6524         int32_t ret_conv = C2Tuple_u32CVec_u8ZZ_get_a(owner_conv);
6525         return ret_conv;
6526 }
6527
6528 static inline struct LDKCVec_u8Z C2Tuple_u32CVec_u8ZZ_get_b(LDKC2Tuple_u32CVec_u8ZZ *NONNULL_PTR owner){
6529         return CVec_u8Z_clone(&owner->b);
6530 }
6531 int8_tArray  __attribute__((export_name("TS_C2Tuple_u32CVec_u8ZZ_get_b"))) TS_C2Tuple_u32CVec_u8ZZ_get_b(uint64_t owner) {
6532         LDKC2Tuple_u32CVec_u8ZZ* owner_conv = (LDKC2Tuple_u32CVec_u8ZZ*)untag_ptr(owner);
6533         LDKCVec_u8Z ret_var = C2Tuple_u32CVec_u8ZZ_get_b(owner_conv);
6534         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
6535         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
6536         CVec_u8Z_free(ret_var);
6537         return ret_arr;
6538 }
6539
6540 static inline LDKCVec_C2Tuple_u32CVec_u8ZZZ CVec_C2Tuple_u32CVec_u8ZZZ_clone(const LDKCVec_C2Tuple_u32CVec_u8ZZZ *orig) {
6541         LDKCVec_C2Tuple_u32CVec_u8ZZZ ret = { .data = MALLOC(sizeof(LDKC2Tuple_u32CVec_u8ZZ) * orig->datalen, "LDKCVec_C2Tuple_u32CVec_u8ZZZ clone bytes"), .datalen = orig->datalen };
6542         for (size_t i = 0; i < ret.datalen; i++) {
6543                 ret.data[i] = C2Tuple_u32CVec_u8ZZ_clone(&orig->data[i]);
6544         }
6545         return ret;
6546 }
6547 static inline struct LDKThirtyTwoBytes C2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32CVec_u8ZZZZ_get_a(LDKC2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32CVec_u8ZZZZ *NONNULL_PTR owner){
6548         return ThirtyTwoBytes_clone(&owner->a);
6549 }
6550 int8_tArray  __attribute__((export_name("TS_C2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32CVec_u8ZZZZ_get_a"))) TS_C2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32CVec_u8ZZZZ_get_a(uint64_t owner) {
6551         LDKC2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32CVec_u8ZZZZ* owner_conv = (LDKC2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32CVec_u8ZZZZ*)untag_ptr(owner);
6552         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
6553         memcpy(ret_arr->elems, C2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32CVec_u8ZZZZ_get_a(owner_conv).data, 32);
6554         return ret_arr;
6555 }
6556
6557 static inline struct LDKCVec_C2Tuple_u32CVec_u8ZZZ C2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32CVec_u8ZZZZ_get_b(LDKC2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32CVec_u8ZZZZ *NONNULL_PTR owner){
6558         return CVec_C2Tuple_u32CVec_u8ZZZ_clone(&owner->b);
6559 }
6560 uint64_tArray  __attribute__((export_name("TS_C2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32CVec_u8ZZZZ_get_b"))) TS_C2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32CVec_u8ZZZZ_get_b(uint64_t owner) {
6561         LDKC2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32CVec_u8ZZZZ* owner_conv = (LDKC2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32CVec_u8ZZZZ*)untag_ptr(owner);
6562         LDKCVec_C2Tuple_u32CVec_u8ZZZ ret_var = C2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32CVec_u8ZZZZ_get_b(owner_conv);
6563         uint64_tArray ret_arr = NULL;
6564         ret_arr = init_uint64_tArray(ret_var.datalen, __LINE__);
6565         uint64_t *ret_arr_ptr = (uint64_t*)(((uint8_t*)ret_arr) + 8);
6566         for (size_t x = 0; x < ret_var.datalen; x++) {
6567                 LDKC2Tuple_u32CVec_u8ZZ* ret_conv_23_conv = MALLOC(sizeof(LDKC2Tuple_u32CVec_u8ZZ), "LDKC2Tuple_u32CVec_u8ZZ");
6568                 *ret_conv_23_conv = ret_var.data[x];
6569                 ret_arr_ptr[x] = tag_ptr(ret_conv_23_conv, true);
6570         }
6571         
6572         FREE(ret_var.data);
6573         return ret_arr;
6574 }
6575
6576 static inline LDKCVec_C2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32CVec_u8ZZZZZ CVec_C2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32CVec_u8ZZZZZ_clone(const LDKCVec_C2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32CVec_u8ZZZZZ *orig) {
6577         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 };
6578         for (size_t i = 0; i < ret.datalen; i++) {
6579                 ret.data[i] = C2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32CVec_u8ZZZZ_clone(&orig->data[i]);
6580         }
6581         return ret;
6582 }
6583 static inline LDKCVec_CommitmentTransactionZ CVec_CommitmentTransactionZ_clone(const LDKCVec_CommitmentTransactionZ *orig) {
6584         LDKCVec_CommitmentTransactionZ ret = { .data = MALLOC(sizeof(LDKCommitmentTransaction) * orig->datalen, "LDKCVec_CommitmentTransactionZ clone bytes"), .datalen = orig->datalen };
6585         for (size_t i = 0; i < ret.datalen; i++) {
6586                 ret.data[i] = CommitmentTransaction_clone(&orig->data[i]);
6587         }
6588         return ret;
6589 }
6590 static inline uint32_t C2Tuple_u32TxOutZ_get_a(LDKC2Tuple_u32TxOutZ *NONNULL_PTR owner){
6591         return owner->a;
6592 }
6593 int32_t  __attribute__((export_name("TS_C2Tuple_u32TxOutZ_get_a"))) TS_C2Tuple_u32TxOutZ_get_a(uint64_t owner) {
6594         LDKC2Tuple_u32TxOutZ* owner_conv = (LDKC2Tuple_u32TxOutZ*)untag_ptr(owner);
6595         int32_t ret_conv = C2Tuple_u32TxOutZ_get_a(owner_conv);
6596         return ret_conv;
6597 }
6598
6599 static inline struct LDKTxOut C2Tuple_u32TxOutZ_get_b(LDKC2Tuple_u32TxOutZ *NONNULL_PTR owner){
6600         return TxOut_clone(&owner->b);
6601 }
6602 uint64_t  __attribute__((export_name("TS_C2Tuple_u32TxOutZ_get_b"))) TS_C2Tuple_u32TxOutZ_get_b(uint64_t owner) {
6603         LDKC2Tuple_u32TxOutZ* owner_conv = (LDKC2Tuple_u32TxOutZ*)untag_ptr(owner);
6604         LDKTxOut* ret_ref = MALLOC(sizeof(LDKTxOut), "LDKTxOut");
6605         *ret_ref = C2Tuple_u32TxOutZ_get_b(owner_conv);
6606         return tag_ptr(ret_ref, true);
6607 }
6608
6609 static inline LDKCVec_C2Tuple_u32TxOutZZ CVec_C2Tuple_u32TxOutZZ_clone(const LDKCVec_C2Tuple_u32TxOutZZ *orig) {
6610         LDKCVec_C2Tuple_u32TxOutZZ ret = { .data = MALLOC(sizeof(LDKC2Tuple_u32TxOutZ) * orig->datalen, "LDKCVec_C2Tuple_u32TxOutZZ clone bytes"), .datalen = orig->datalen };
6611         for (size_t i = 0; i < ret.datalen; i++) {
6612                 ret.data[i] = C2Tuple_u32TxOutZ_clone(&orig->data[i]);
6613         }
6614         return ret;
6615 }
6616 static inline struct LDKThirtyTwoBytes C2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32TxOutZZZ_get_a(LDKC2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32TxOutZZZ *NONNULL_PTR owner){
6617         return ThirtyTwoBytes_clone(&owner->a);
6618 }
6619 int8_tArray  __attribute__((export_name("TS_C2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32TxOutZZZ_get_a"))) TS_C2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32TxOutZZZ_get_a(uint64_t owner) {
6620         LDKC2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32TxOutZZZ* owner_conv = (LDKC2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32TxOutZZZ*)untag_ptr(owner);
6621         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
6622         memcpy(ret_arr->elems, C2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32TxOutZZZ_get_a(owner_conv).data, 32);
6623         return ret_arr;
6624 }
6625
6626 static inline struct LDKCVec_C2Tuple_u32TxOutZZ C2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32TxOutZZZ_get_b(LDKC2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32TxOutZZZ *NONNULL_PTR owner){
6627         return CVec_C2Tuple_u32TxOutZZ_clone(&owner->b);
6628 }
6629 uint64_tArray  __attribute__((export_name("TS_C2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32TxOutZZZ_get_b"))) TS_C2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32TxOutZZZ_get_b(uint64_t owner) {
6630         LDKC2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32TxOutZZZ* owner_conv = (LDKC2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32TxOutZZZ*)untag_ptr(owner);
6631         LDKCVec_C2Tuple_u32TxOutZZ ret_var = C2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32TxOutZZZ_get_b(owner_conv);
6632         uint64_tArray ret_arr = NULL;
6633         ret_arr = init_uint64_tArray(ret_var.datalen, __LINE__);
6634         uint64_t *ret_arr_ptr = (uint64_t*)(((uint8_t*)ret_arr) + 8);
6635         for (size_t u = 0; u < ret_var.datalen; u++) {
6636                 LDKC2Tuple_u32TxOutZ* ret_conv_20_conv = MALLOC(sizeof(LDKC2Tuple_u32TxOutZ), "LDKC2Tuple_u32TxOutZ");
6637                 *ret_conv_20_conv = ret_var.data[u];
6638                 ret_arr_ptr[u] = tag_ptr(ret_conv_20_conv, true);
6639         }
6640         
6641         FREE(ret_var.data);
6642         return ret_arr;
6643 }
6644
6645 static inline LDKCVec_C2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32TxOutZZZZ CVec_C2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32TxOutZZZZ_clone(const LDKCVec_C2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32TxOutZZZZ *orig) {
6646         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 };
6647         for (size_t i = 0; i < ret.datalen; i++) {
6648                 ret.data[i] = C2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32TxOutZZZ_clone(&orig->data[i]);
6649         }
6650         return ret;
6651 }
6652 uint32_t __attribute__((export_name("TS_LDKBalance_ty_from_ptr"))) TS_LDKBalance_ty_from_ptr(uint64_t ptr) {
6653         LDKBalance *obj = (LDKBalance*)untag_ptr(ptr);
6654         switch(obj->tag) {
6655                 case LDKBalance_ClaimableOnChannelClose: return 0;
6656                 case LDKBalance_ClaimableAwaitingConfirmations: return 1;
6657                 case LDKBalance_ContentiousClaimable: return 2;
6658                 case LDKBalance_MaybeTimeoutClaimableHTLC: return 3;
6659                 case LDKBalance_MaybePreimageClaimableHTLC: return 4;
6660                 case LDKBalance_CounterpartyRevokedOutputClaimable: return 5;
6661                 default: abort();
6662         }
6663 }
6664 int64_t __attribute__((export_name("TS_LDKBalance_ClaimableOnChannelClose_get_amount_satoshis"))) TS_LDKBalance_ClaimableOnChannelClose_get_amount_satoshis(uint64_t ptr) {
6665         LDKBalance *obj = (LDKBalance*)untag_ptr(ptr);
6666         assert(obj->tag == LDKBalance_ClaimableOnChannelClose);
6667         int64_t amount_satoshis_conv = obj->claimable_on_channel_close.amount_satoshis;
6668         return amount_satoshis_conv;
6669 }
6670 int64_t __attribute__((export_name("TS_LDKBalance_ClaimableAwaitingConfirmations_get_amount_satoshis"))) TS_LDKBalance_ClaimableAwaitingConfirmations_get_amount_satoshis(uint64_t ptr) {
6671         LDKBalance *obj = (LDKBalance*)untag_ptr(ptr);
6672         assert(obj->tag == LDKBalance_ClaimableAwaitingConfirmations);
6673         int64_t amount_satoshis_conv = obj->claimable_awaiting_confirmations.amount_satoshis;
6674         return amount_satoshis_conv;
6675 }
6676 int32_t __attribute__((export_name("TS_LDKBalance_ClaimableAwaitingConfirmations_get_confirmation_height"))) TS_LDKBalance_ClaimableAwaitingConfirmations_get_confirmation_height(uint64_t ptr) {
6677         LDKBalance *obj = (LDKBalance*)untag_ptr(ptr);
6678         assert(obj->tag == LDKBalance_ClaimableAwaitingConfirmations);
6679         int32_t confirmation_height_conv = obj->claimable_awaiting_confirmations.confirmation_height;
6680         return confirmation_height_conv;
6681 }
6682 int64_t __attribute__((export_name("TS_LDKBalance_ContentiousClaimable_get_amount_satoshis"))) TS_LDKBalance_ContentiousClaimable_get_amount_satoshis(uint64_t ptr) {
6683         LDKBalance *obj = (LDKBalance*)untag_ptr(ptr);
6684         assert(obj->tag == LDKBalance_ContentiousClaimable);
6685         int64_t amount_satoshis_conv = obj->contentious_claimable.amount_satoshis;
6686         return amount_satoshis_conv;
6687 }
6688 int32_t __attribute__((export_name("TS_LDKBalance_ContentiousClaimable_get_timeout_height"))) TS_LDKBalance_ContentiousClaimable_get_timeout_height(uint64_t ptr) {
6689         LDKBalance *obj = (LDKBalance*)untag_ptr(ptr);
6690         assert(obj->tag == LDKBalance_ContentiousClaimable);
6691         int32_t timeout_height_conv = obj->contentious_claimable.timeout_height;
6692         return timeout_height_conv;
6693 }
6694 int8_tArray __attribute__((export_name("TS_LDKBalance_ContentiousClaimable_get_payment_hash"))) TS_LDKBalance_ContentiousClaimable_get_payment_hash(uint64_t ptr) {
6695         LDKBalance *obj = (LDKBalance*)untag_ptr(ptr);
6696         assert(obj->tag == LDKBalance_ContentiousClaimable);
6697         int8_tArray payment_hash_arr = init_int8_tArray(32, __LINE__);
6698         memcpy(payment_hash_arr->elems, obj->contentious_claimable.payment_hash.data, 32);
6699         return payment_hash_arr;
6700 }
6701 int8_tArray __attribute__((export_name("TS_LDKBalance_ContentiousClaimable_get_payment_preimage"))) TS_LDKBalance_ContentiousClaimable_get_payment_preimage(uint64_t ptr) {
6702         LDKBalance *obj = (LDKBalance*)untag_ptr(ptr);
6703         assert(obj->tag == LDKBalance_ContentiousClaimable);
6704         int8_tArray payment_preimage_arr = init_int8_tArray(32, __LINE__);
6705         memcpy(payment_preimage_arr->elems, obj->contentious_claimable.payment_preimage.data, 32);
6706         return payment_preimage_arr;
6707 }
6708 int64_t __attribute__((export_name("TS_LDKBalance_MaybeTimeoutClaimableHTLC_get_amount_satoshis"))) TS_LDKBalance_MaybeTimeoutClaimableHTLC_get_amount_satoshis(uint64_t ptr) {
6709         LDKBalance *obj = (LDKBalance*)untag_ptr(ptr);
6710         assert(obj->tag == LDKBalance_MaybeTimeoutClaimableHTLC);
6711         int64_t amount_satoshis_conv = obj->maybe_timeout_claimable_htlc.amount_satoshis;
6712         return amount_satoshis_conv;
6713 }
6714 int32_t __attribute__((export_name("TS_LDKBalance_MaybeTimeoutClaimableHTLC_get_claimable_height"))) TS_LDKBalance_MaybeTimeoutClaimableHTLC_get_claimable_height(uint64_t ptr) {
6715         LDKBalance *obj = (LDKBalance*)untag_ptr(ptr);
6716         assert(obj->tag == LDKBalance_MaybeTimeoutClaimableHTLC);
6717         int32_t claimable_height_conv = obj->maybe_timeout_claimable_htlc.claimable_height;
6718         return claimable_height_conv;
6719 }
6720 int8_tArray __attribute__((export_name("TS_LDKBalance_MaybeTimeoutClaimableHTLC_get_payment_hash"))) TS_LDKBalance_MaybeTimeoutClaimableHTLC_get_payment_hash(uint64_t ptr) {
6721         LDKBalance *obj = (LDKBalance*)untag_ptr(ptr);
6722         assert(obj->tag == LDKBalance_MaybeTimeoutClaimableHTLC);
6723         int8_tArray payment_hash_arr = init_int8_tArray(32, __LINE__);
6724         memcpy(payment_hash_arr->elems, obj->maybe_timeout_claimable_htlc.payment_hash.data, 32);
6725         return payment_hash_arr;
6726 }
6727 int64_t __attribute__((export_name("TS_LDKBalance_MaybePreimageClaimableHTLC_get_amount_satoshis"))) TS_LDKBalance_MaybePreimageClaimableHTLC_get_amount_satoshis(uint64_t ptr) {
6728         LDKBalance *obj = (LDKBalance*)untag_ptr(ptr);
6729         assert(obj->tag == LDKBalance_MaybePreimageClaimableHTLC);
6730         int64_t amount_satoshis_conv = obj->maybe_preimage_claimable_htlc.amount_satoshis;
6731         return amount_satoshis_conv;
6732 }
6733 int32_t __attribute__((export_name("TS_LDKBalance_MaybePreimageClaimableHTLC_get_expiry_height"))) TS_LDKBalance_MaybePreimageClaimableHTLC_get_expiry_height(uint64_t ptr) {
6734         LDKBalance *obj = (LDKBalance*)untag_ptr(ptr);
6735         assert(obj->tag == LDKBalance_MaybePreimageClaimableHTLC);
6736         int32_t expiry_height_conv = obj->maybe_preimage_claimable_htlc.expiry_height;
6737         return expiry_height_conv;
6738 }
6739 int8_tArray __attribute__((export_name("TS_LDKBalance_MaybePreimageClaimableHTLC_get_payment_hash"))) TS_LDKBalance_MaybePreimageClaimableHTLC_get_payment_hash(uint64_t ptr) {
6740         LDKBalance *obj = (LDKBalance*)untag_ptr(ptr);
6741         assert(obj->tag == LDKBalance_MaybePreimageClaimableHTLC);
6742         int8_tArray payment_hash_arr = init_int8_tArray(32, __LINE__);
6743         memcpy(payment_hash_arr->elems, obj->maybe_preimage_claimable_htlc.payment_hash.data, 32);
6744         return payment_hash_arr;
6745 }
6746 int64_t __attribute__((export_name("TS_LDKBalance_CounterpartyRevokedOutputClaimable_get_amount_satoshis"))) TS_LDKBalance_CounterpartyRevokedOutputClaimable_get_amount_satoshis(uint64_t ptr) {
6747         LDKBalance *obj = (LDKBalance*)untag_ptr(ptr);
6748         assert(obj->tag == LDKBalance_CounterpartyRevokedOutputClaimable);
6749         int64_t amount_satoshis_conv = obj->counterparty_revoked_output_claimable.amount_satoshis;
6750         return amount_satoshis_conv;
6751 }
6752 static inline LDKCVec_BalanceZ CVec_BalanceZ_clone(const LDKCVec_BalanceZ *orig) {
6753         LDKCVec_BalanceZ ret = { .data = MALLOC(sizeof(LDKBalance) * orig->datalen, "LDKCVec_BalanceZ clone bytes"), .datalen = orig->datalen };
6754         for (size_t i = 0; i < ret.datalen; i++) {
6755                 ret.data[i] = Balance_clone(&orig->data[i]);
6756         }
6757         return ret;
6758 }
6759 static inline struct LDKThirtyTwoBytes C2Tuple_ThirtyTwoBytesChannelMonitorZ_get_a(LDKC2Tuple_ThirtyTwoBytesChannelMonitorZ *NONNULL_PTR owner){
6760         return ThirtyTwoBytes_clone(&owner->a);
6761 }
6762 int8_tArray  __attribute__((export_name("TS_C2Tuple_ThirtyTwoBytesChannelMonitorZ_get_a"))) TS_C2Tuple_ThirtyTwoBytesChannelMonitorZ_get_a(uint64_t owner) {
6763         LDKC2Tuple_ThirtyTwoBytesChannelMonitorZ* owner_conv = (LDKC2Tuple_ThirtyTwoBytesChannelMonitorZ*)untag_ptr(owner);
6764         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
6765         memcpy(ret_arr->elems, C2Tuple_ThirtyTwoBytesChannelMonitorZ_get_a(owner_conv).data, 32);
6766         return ret_arr;
6767 }
6768
6769 static inline struct LDKChannelMonitor C2Tuple_ThirtyTwoBytesChannelMonitorZ_get_b(LDKC2Tuple_ThirtyTwoBytesChannelMonitorZ *NONNULL_PTR owner){
6770         LDKChannelMonitor ret = owner->b;
6771         ret.is_owned = false;
6772         return ret;
6773 }
6774 uint64_t  __attribute__((export_name("TS_C2Tuple_ThirtyTwoBytesChannelMonitorZ_get_b"))) TS_C2Tuple_ThirtyTwoBytesChannelMonitorZ_get_b(uint64_t owner) {
6775         LDKC2Tuple_ThirtyTwoBytesChannelMonitorZ* owner_conv = (LDKC2Tuple_ThirtyTwoBytesChannelMonitorZ*)untag_ptr(owner);
6776         LDKChannelMonitor ret_var = C2Tuple_ThirtyTwoBytesChannelMonitorZ_get_b(owner_conv);
6777         uint64_t ret_ref = 0;
6778         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
6779         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
6780         return ret_ref;
6781 }
6782
6783 static inline struct LDKC2Tuple_ThirtyTwoBytesChannelMonitorZ CResult_C2Tuple_ThirtyTwoBytesChannelMonitorZDecodeErrorZ_get_ok(LDKCResult_C2Tuple_ThirtyTwoBytesChannelMonitorZDecodeErrorZ *NONNULL_PTR owner){
6784 CHECK(owner->result_ok);
6785         return C2Tuple_ThirtyTwoBytesChannelMonitorZ_clone(&*owner->contents.result);
6786 }
6787 uint64_t  __attribute__((export_name("TS_CResult_C2Tuple_ThirtyTwoBytesChannelMonitorZDecodeErrorZ_get_ok"))) TS_CResult_C2Tuple_ThirtyTwoBytesChannelMonitorZDecodeErrorZ_get_ok(uint64_t owner) {
6788         LDKCResult_C2Tuple_ThirtyTwoBytesChannelMonitorZDecodeErrorZ* owner_conv = (LDKCResult_C2Tuple_ThirtyTwoBytesChannelMonitorZDecodeErrorZ*)untag_ptr(owner);
6789         LDKC2Tuple_ThirtyTwoBytesChannelMonitorZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_ThirtyTwoBytesChannelMonitorZ), "LDKC2Tuple_ThirtyTwoBytesChannelMonitorZ");
6790         *ret_conv = CResult_C2Tuple_ThirtyTwoBytesChannelMonitorZDecodeErrorZ_get_ok(owner_conv);
6791         return tag_ptr(ret_conv, true);
6792 }
6793
6794 static inline struct LDKDecodeError CResult_C2Tuple_ThirtyTwoBytesChannelMonitorZDecodeErrorZ_get_err(LDKCResult_C2Tuple_ThirtyTwoBytesChannelMonitorZDecodeErrorZ *NONNULL_PTR owner){
6795 CHECK(!owner->result_ok);
6796         return DecodeError_clone(&*owner->contents.err);
6797 }
6798 uint64_t  __attribute__((export_name("TS_CResult_C2Tuple_ThirtyTwoBytesChannelMonitorZDecodeErrorZ_get_err"))) TS_CResult_C2Tuple_ThirtyTwoBytesChannelMonitorZDecodeErrorZ_get_err(uint64_t owner) {
6799         LDKCResult_C2Tuple_ThirtyTwoBytesChannelMonitorZDecodeErrorZ* owner_conv = (LDKCResult_C2Tuple_ThirtyTwoBytesChannelMonitorZDecodeErrorZ*)untag_ptr(owner);
6800         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
6801         *ret_copy = CResult_C2Tuple_ThirtyTwoBytesChannelMonitorZDecodeErrorZ_get_err(owner_conv);
6802         uint64_t ret_ref = tag_ptr(ret_copy, true);
6803         return ret_ref;
6804 }
6805
6806 typedef struct LDKType_JCalls {
6807         atomic_size_t refcnt;
6808         uint32_t instance_ptr;
6809 } LDKType_JCalls;
6810 static void LDKType_JCalls_free(void* this_arg) {
6811         LDKType_JCalls *j_calls = (LDKType_JCalls*) this_arg;
6812         if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
6813                 FREE(j_calls);
6814         }
6815 }
6816 uint16_t type_id_LDKType_jcall(const void* this_arg) {
6817         LDKType_JCalls *j_calls = (LDKType_JCalls*) this_arg;
6818         return js_invoke_function_uuuuuu(j_calls->instance_ptr, 38, 0, 0, 0, 0, 0, 0);
6819 }
6820 LDKStr debug_str_LDKType_jcall(const void* this_arg) {
6821         LDKType_JCalls *j_calls = (LDKType_JCalls*) this_arg;
6822         jstring ret = (jstring)js_invoke_function_uuuuuu(j_calls->instance_ptr, 39, 0, 0, 0, 0, 0, 0);
6823         LDKStr ret_conv = str_ref_to_owned_c(ret);
6824         return ret_conv;
6825 }
6826 LDKCVec_u8Z write_LDKType_jcall(const void* this_arg) {
6827         LDKType_JCalls *j_calls = (LDKType_JCalls*) this_arg;
6828         int8_tArray ret = (int8_tArray)js_invoke_function_uuuuuu(j_calls->instance_ptr, 40, 0, 0, 0, 0, 0, 0);
6829         LDKCVec_u8Z ret_ref;
6830         ret_ref.datalen = ret->arr_len;
6831         ret_ref.data = MALLOC(ret_ref.datalen, "LDKCVec_u8Z Bytes");
6832         memcpy(ret_ref.data, ret->elems, ret_ref.datalen); FREE(ret);
6833         return ret_ref;
6834 }
6835 static void LDKType_JCalls_cloned(LDKType* new_obj) {
6836         LDKType_JCalls *j_calls = (LDKType_JCalls*) new_obj->this_arg;
6837         atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
6838 }
6839 static inline LDKType LDKType_init (JSValue o) {
6840         LDKType_JCalls *calls = MALLOC(sizeof(LDKType_JCalls), "LDKType_JCalls");
6841         atomic_init(&calls->refcnt, 1);
6842         calls->instance_ptr = o;
6843
6844         LDKType ret = {
6845                 .this_arg = (void*) calls,
6846                 .type_id = type_id_LDKType_jcall,
6847                 .debug_str = debug_str_LDKType_jcall,
6848                 .write = write_LDKType_jcall,
6849                 .cloned = LDKType_JCalls_cloned,
6850                 .free = LDKType_JCalls_free,
6851         };
6852         return ret;
6853 }
6854 uint64_t  __attribute__((export_name("TS_LDKType_new"))) TS_LDKType_new(JSValue o) {
6855         LDKType *res_ptr = MALLOC(sizeof(LDKType), "LDKType");
6856         *res_ptr = LDKType_init(o);
6857         return tag_ptr(res_ptr, true);
6858 }
6859 int16_t  __attribute__((export_name("TS_Type_type_id"))) TS_Type_type_id(uint64_t this_arg) {
6860         void* this_arg_ptr = untag_ptr(this_arg);
6861         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
6862         LDKType* this_arg_conv = (LDKType*)this_arg_ptr;
6863         int16_t ret_conv = (this_arg_conv->type_id)(this_arg_conv->this_arg);
6864         return ret_conv;
6865 }
6866
6867 jstring  __attribute__((export_name("TS_Type_debug_str"))) TS_Type_debug_str(uint64_t this_arg) {
6868         void* this_arg_ptr = untag_ptr(this_arg);
6869         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
6870         LDKType* this_arg_conv = (LDKType*)this_arg_ptr;
6871         LDKStr ret_str = (this_arg_conv->debug_str)(this_arg_conv->this_arg);
6872         jstring ret_conv = str_ref_to_ts(ret_str.chars, ret_str.len);
6873         Str_free(ret_str);
6874         return ret_conv;
6875 }
6876
6877 int8_tArray  __attribute__((export_name("TS_Type_write"))) TS_Type_write(uint64_t this_arg) {
6878         void* this_arg_ptr = untag_ptr(this_arg);
6879         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
6880         LDKType* this_arg_conv = (LDKType*)this_arg_ptr;
6881         LDKCVec_u8Z ret_var = (this_arg_conv->write)(this_arg_conv->this_arg);
6882         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
6883         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
6884         CVec_u8Z_free(ret_var);
6885         return ret_arr;
6886 }
6887
6888 static inline struct LDKPublicKey C2Tuple_PublicKeyTypeZ_get_a(LDKC2Tuple_PublicKeyTypeZ *NONNULL_PTR owner){
6889         return owner->a;
6890 }
6891 int8_tArray  __attribute__((export_name("TS_C2Tuple_PublicKeyTypeZ_get_a"))) TS_C2Tuple_PublicKeyTypeZ_get_a(uint64_t owner) {
6892         LDKC2Tuple_PublicKeyTypeZ* owner_conv = (LDKC2Tuple_PublicKeyTypeZ*)untag_ptr(owner);
6893         int8_tArray ret_arr = init_int8_tArray(33, __LINE__);
6894         memcpy(ret_arr->elems, C2Tuple_PublicKeyTypeZ_get_a(owner_conv).compressed_form, 33);
6895         return ret_arr;
6896 }
6897
6898 static inline struct LDKType C2Tuple_PublicKeyTypeZ_get_b(LDKC2Tuple_PublicKeyTypeZ *NONNULL_PTR owner){
6899         return Type_clone(&owner->b);
6900 }
6901 uint64_t  __attribute__((export_name("TS_C2Tuple_PublicKeyTypeZ_get_b"))) TS_C2Tuple_PublicKeyTypeZ_get_b(uint64_t owner) {
6902         LDKC2Tuple_PublicKeyTypeZ* owner_conv = (LDKC2Tuple_PublicKeyTypeZ*)untag_ptr(owner);
6903         LDKType* ret_ret = MALLOC(sizeof(LDKType), "LDKType");
6904         *ret_ret = C2Tuple_PublicKeyTypeZ_get_b(owner_conv);
6905         return tag_ptr(ret_ret, true);
6906 }
6907
6908 static inline LDKCVec_C2Tuple_PublicKeyTypeZZ CVec_C2Tuple_PublicKeyTypeZZ_clone(const LDKCVec_C2Tuple_PublicKeyTypeZZ *orig) {
6909         LDKCVec_C2Tuple_PublicKeyTypeZZ ret = { .data = MALLOC(sizeof(LDKC2Tuple_PublicKeyTypeZ) * orig->datalen, "LDKCVec_C2Tuple_PublicKeyTypeZZ clone bytes"), .datalen = orig->datalen };
6910         for (size_t i = 0; i < ret.datalen; i++) {
6911                 ret.data[i] = C2Tuple_PublicKeyTypeZ_clone(&orig->data[i]);
6912         }
6913         return ret;
6914 }
6915 typedef struct LDKOnionMessageContents_JCalls {
6916         atomic_size_t refcnt;
6917         uint32_t instance_ptr;
6918 } LDKOnionMessageContents_JCalls;
6919 static void LDKOnionMessageContents_JCalls_free(void* this_arg) {
6920         LDKOnionMessageContents_JCalls *j_calls = (LDKOnionMessageContents_JCalls*) this_arg;
6921         if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
6922                 FREE(j_calls);
6923         }
6924 }
6925 uint64_t tlv_type_LDKOnionMessageContents_jcall(const void* this_arg) {
6926         LDKOnionMessageContents_JCalls *j_calls = (LDKOnionMessageContents_JCalls*) this_arg;
6927         return js_invoke_function_uuuuuu(j_calls->instance_ptr, 41, 0, 0, 0, 0, 0, 0);
6928 }
6929 LDKCVec_u8Z write_LDKOnionMessageContents_jcall(const void* this_arg) {
6930         LDKOnionMessageContents_JCalls *j_calls = (LDKOnionMessageContents_JCalls*) this_arg;
6931         int8_tArray ret = (int8_tArray)js_invoke_function_uuuuuu(j_calls->instance_ptr, 42, 0, 0, 0, 0, 0, 0);
6932         LDKCVec_u8Z ret_ref;
6933         ret_ref.datalen = ret->arr_len;
6934         ret_ref.data = MALLOC(ret_ref.datalen, "LDKCVec_u8Z Bytes");
6935         memcpy(ret_ref.data, ret->elems, ret_ref.datalen); FREE(ret);
6936         return ret_ref;
6937 }
6938 static void LDKOnionMessageContents_JCalls_cloned(LDKOnionMessageContents* new_obj) {
6939         LDKOnionMessageContents_JCalls *j_calls = (LDKOnionMessageContents_JCalls*) new_obj->this_arg;
6940         atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
6941 }
6942 static inline LDKOnionMessageContents LDKOnionMessageContents_init (JSValue o) {
6943         LDKOnionMessageContents_JCalls *calls = MALLOC(sizeof(LDKOnionMessageContents_JCalls), "LDKOnionMessageContents_JCalls");
6944         atomic_init(&calls->refcnt, 1);
6945         calls->instance_ptr = o;
6946
6947         LDKOnionMessageContents ret = {
6948                 .this_arg = (void*) calls,
6949                 .tlv_type = tlv_type_LDKOnionMessageContents_jcall,
6950                 .write = write_LDKOnionMessageContents_jcall,
6951                 .cloned = LDKOnionMessageContents_JCalls_cloned,
6952                 .free = LDKOnionMessageContents_JCalls_free,
6953         };
6954         return ret;
6955 }
6956 uint64_t  __attribute__((export_name("TS_LDKOnionMessageContents_new"))) TS_LDKOnionMessageContents_new(JSValue o) {
6957         LDKOnionMessageContents *res_ptr = MALLOC(sizeof(LDKOnionMessageContents), "LDKOnionMessageContents");
6958         *res_ptr = LDKOnionMessageContents_init(o);
6959         return tag_ptr(res_ptr, true);
6960 }
6961 int64_t  __attribute__((export_name("TS_OnionMessageContents_tlv_type"))) TS_OnionMessageContents_tlv_type(uint64_t this_arg) {
6962         void* this_arg_ptr = untag_ptr(this_arg);
6963         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
6964         LDKOnionMessageContents* this_arg_conv = (LDKOnionMessageContents*)this_arg_ptr;
6965         int64_t ret_conv = (this_arg_conv->tlv_type)(this_arg_conv->this_arg);
6966         return ret_conv;
6967 }
6968
6969 int8_tArray  __attribute__((export_name("TS_OnionMessageContents_write"))) TS_OnionMessageContents_write(uint64_t this_arg) {
6970         void* this_arg_ptr = untag_ptr(this_arg);
6971         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
6972         LDKOnionMessageContents* this_arg_conv = (LDKOnionMessageContents*)this_arg_ptr;
6973         LDKCVec_u8Z ret_var = (this_arg_conv->write)(this_arg_conv->this_arg);
6974         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
6975         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
6976         CVec_u8Z_free(ret_var);
6977         return ret_arr;
6978 }
6979
6980 uint32_t __attribute__((export_name("TS_LDKCOption_OnionMessageContentsZ_ty_from_ptr"))) TS_LDKCOption_OnionMessageContentsZ_ty_from_ptr(uint64_t ptr) {
6981         LDKCOption_OnionMessageContentsZ *obj = (LDKCOption_OnionMessageContentsZ*)untag_ptr(ptr);
6982         switch(obj->tag) {
6983                 case LDKCOption_OnionMessageContentsZ_Some: return 0;
6984                 case LDKCOption_OnionMessageContentsZ_None: return 1;
6985                 default: abort();
6986         }
6987 }
6988 uint64_t __attribute__((export_name("TS_LDKCOption_OnionMessageContentsZ_Some_get_some"))) TS_LDKCOption_OnionMessageContentsZ_Some_get_some(uint64_t ptr) {
6989         LDKCOption_OnionMessageContentsZ *obj = (LDKCOption_OnionMessageContentsZ*)untag_ptr(ptr);
6990         assert(obj->tag == LDKCOption_OnionMessageContentsZ_Some);
6991         LDKOnionMessageContents* some_ret = MALLOC(sizeof(LDKOnionMessageContents), "LDKOnionMessageContents");
6992         *some_ret = OnionMessageContents_clone(&obj->some);
6993         return tag_ptr(some_ret, true);
6994 }
6995 static inline struct LDKCOption_OnionMessageContentsZ CResult_COption_OnionMessageContentsZDecodeErrorZ_get_ok(LDKCResult_COption_OnionMessageContentsZDecodeErrorZ *NONNULL_PTR owner){
6996 CHECK(owner->result_ok);
6997         return COption_OnionMessageContentsZ_clone(&*owner->contents.result);
6998 }
6999 uint64_t  __attribute__((export_name("TS_CResult_COption_OnionMessageContentsZDecodeErrorZ_get_ok"))) TS_CResult_COption_OnionMessageContentsZDecodeErrorZ_get_ok(uint64_t owner) {
7000         LDKCResult_COption_OnionMessageContentsZDecodeErrorZ* owner_conv = (LDKCResult_COption_OnionMessageContentsZDecodeErrorZ*)untag_ptr(owner);
7001         LDKCOption_OnionMessageContentsZ *ret_copy = MALLOC(sizeof(LDKCOption_OnionMessageContentsZ), "LDKCOption_OnionMessageContentsZ");
7002         *ret_copy = CResult_COption_OnionMessageContentsZDecodeErrorZ_get_ok(owner_conv);
7003         uint64_t ret_ref = tag_ptr(ret_copy, true);
7004         return ret_ref;
7005 }
7006
7007 static inline struct LDKDecodeError CResult_COption_OnionMessageContentsZDecodeErrorZ_get_err(LDKCResult_COption_OnionMessageContentsZDecodeErrorZ *NONNULL_PTR owner){
7008 CHECK(!owner->result_ok);
7009         return DecodeError_clone(&*owner->contents.err);
7010 }
7011 uint64_t  __attribute__((export_name("TS_CResult_COption_OnionMessageContentsZDecodeErrorZ_get_err"))) TS_CResult_COption_OnionMessageContentsZDecodeErrorZ_get_err(uint64_t owner) {
7012         LDKCResult_COption_OnionMessageContentsZDecodeErrorZ* owner_conv = (LDKCResult_COption_OnionMessageContentsZDecodeErrorZ*)untag_ptr(owner);
7013         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
7014         *ret_copy = CResult_COption_OnionMessageContentsZDecodeErrorZ_get_err(owner_conv);
7015         uint64_t ret_ref = tag_ptr(ret_copy, true);
7016         return ret_ref;
7017 }
7018
7019 static inline struct LDKOnionMessageContents C3Tuple_OnionMessageContentsDestinationBlindedPathZ_get_a(LDKC3Tuple_OnionMessageContentsDestinationBlindedPathZ *NONNULL_PTR owner){
7020         return OnionMessageContents_clone(&owner->a);
7021 }
7022 uint64_t  __attribute__((export_name("TS_C3Tuple_OnionMessageContentsDestinationBlindedPathZ_get_a"))) TS_C3Tuple_OnionMessageContentsDestinationBlindedPathZ_get_a(uint64_t owner) {
7023         LDKC3Tuple_OnionMessageContentsDestinationBlindedPathZ* owner_conv = (LDKC3Tuple_OnionMessageContentsDestinationBlindedPathZ*)untag_ptr(owner);
7024         LDKOnionMessageContents* ret_ret = MALLOC(sizeof(LDKOnionMessageContents), "LDKOnionMessageContents");
7025         *ret_ret = C3Tuple_OnionMessageContentsDestinationBlindedPathZ_get_a(owner_conv);
7026         return tag_ptr(ret_ret, true);
7027 }
7028
7029 static inline struct LDKDestination C3Tuple_OnionMessageContentsDestinationBlindedPathZ_get_b(LDKC3Tuple_OnionMessageContentsDestinationBlindedPathZ *NONNULL_PTR owner){
7030         return Destination_clone(&owner->b);
7031 }
7032 uint64_t  __attribute__((export_name("TS_C3Tuple_OnionMessageContentsDestinationBlindedPathZ_get_b"))) TS_C3Tuple_OnionMessageContentsDestinationBlindedPathZ_get_b(uint64_t owner) {
7033         LDKC3Tuple_OnionMessageContentsDestinationBlindedPathZ* owner_conv = (LDKC3Tuple_OnionMessageContentsDestinationBlindedPathZ*)untag_ptr(owner);
7034         LDKDestination *ret_copy = MALLOC(sizeof(LDKDestination), "LDKDestination");
7035         *ret_copy = C3Tuple_OnionMessageContentsDestinationBlindedPathZ_get_b(owner_conv);
7036         uint64_t ret_ref = tag_ptr(ret_copy, true);
7037         return ret_ref;
7038 }
7039
7040 static inline struct LDKBlindedPath C3Tuple_OnionMessageContentsDestinationBlindedPathZ_get_c(LDKC3Tuple_OnionMessageContentsDestinationBlindedPathZ *NONNULL_PTR owner){
7041         LDKBlindedPath ret = owner->c;
7042         ret.is_owned = false;
7043         return ret;
7044 }
7045 uint64_t  __attribute__((export_name("TS_C3Tuple_OnionMessageContentsDestinationBlindedPathZ_get_c"))) TS_C3Tuple_OnionMessageContentsDestinationBlindedPathZ_get_c(uint64_t owner) {
7046         LDKC3Tuple_OnionMessageContentsDestinationBlindedPathZ* owner_conv = (LDKC3Tuple_OnionMessageContentsDestinationBlindedPathZ*)untag_ptr(owner);
7047         LDKBlindedPath ret_var = C3Tuple_OnionMessageContentsDestinationBlindedPathZ_get_c(owner_conv);
7048         uint64_t ret_ref = 0;
7049         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
7050         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
7051         return ret_ref;
7052 }
7053
7054 static inline LDKCVec_C3Tuple_OnionMessageContentsDestinationBlindedPathZZ CVec_C3Tuple_OnionMessageContentsDestinationBlindedPathZZ_clone(const LDKCVec_C3Tuple_OnionMessageContentsDestinationBlindedPathZZ *orig) {
7055         LDKCVec_C3Tuple_OnionMessageContentsDestinationBlindedPathZZ ret = { .data = MALLOC(sizeof(LDKC3Tuple_OnionMessageContentsDestinationBlindedPathZ) * orig->datalen, "LDKCVec_C3Tuple_OnionMessageContentsDestinationBlindedPathZZ clone bytes"), .datalen = orig->datalen };
7056         for (size_t i = 0; i < ret.datalen; i++) {
7057                 ret.data[i] = C3Tuple_OnionMessageContentsDestinationBlindedPathZ_clone(&orig->data[i]);
7058         }
7059         return ret;
7060 }
7061 uint32_t __attribute__((export_name("TS_LDKCOption_TypeZ_ty_from_ptr"))) TS_LDKCOption_TypeZ_ty_from_ptr(uint64_t ptr) {
7062         LDKCOption_TypeZ *obj = (LDKCOption_TypeZ*)untag_ptr(ptr);
7063         switch(obj->tag) {
7064                 case LDKCOption_TypeZ_Some: return 0;
7065                 case LDKCOption_TypeZ_None: return 1;
7066                 default: abort();
7067         }
7068 }
7069 uint64_t __attribute__((export_name("TS_LDKCOption_TypeZ_Some_get_some"))) TS_LDKCOption_TypeZ_Some_get_some(uint64_t ptr) {
7070         LDKCOption_TypeZ *obj = (LDKCOption_TypeZ*)untag_ptr(ptr);
7071         assert(obj->tag == LDKCOption_TypeZ_Some);
7072         LDKType* some_ret = MALLOC(sizeof(LDKType), "LDKType");
7073         *some_ret = Type_clone(&obj->some);
7074         return tag_ptr(some_ret, true);
7075 }
7076 static inline struct LDKCOption_TypeZ CResult_COption_TypeZDecodeErrorZ_get_ok(LDKCResult_COption_TypeZDecodeErrorZ *NONNULL_PTR owner){
7077 CHECK(owner->result_ok);
7078         return COption_TypeZ_clone(&*owner->contents.result);
7079 }
7080 uint64_t  __attribute__((export_name("TS_CResult_COption_TypeZDecodeErrorZ_get_ok"))) TS_CResult_COption_TypeZDecodeErrorZ_get_ok(uint64_t owner) {
7081         LDKCResult_COption_TypeZDecodeErrorZ* owner_conv = (LDKCResult_COption_TypeZDecodeErrorZ*)untag_ptr(owner);
7082         LDKCOption_TypeZ *ret_copy = MALLOC(sizeof(LDKCOption_TypeZ), "LDKCOption_TypeZ");
7083         *ret_copy = CResult_COption_TypeZDecodeErrorZ_get_ok(owner_conv);
7084         uint64_t ret_ref = tag_ptr(ret_copy, true);
7085         return ret_ref;
7086 }
7087
7088 static inline struct LDKDecodeError CResult_COption_TypeZDecodeErrorZ_get_err(LDKCResult_COption_TypeZDecodeErrorZ *NONNULL_PTR owner){
7089 CHECK(!owner->result_ok);
7090         return DecodeError_clone(&*owner->contents.err);
7091 }
7092 uint64_t  __attribute__((export_name("TS_CResult_COption_TypeZDecodeErrorZ_get_err"))) TS_CResult_COption_TypeZDecodeErrorZ_get_err(uint64_t owner) {
7093         LDKCResult_COption_TypeZDecodeErrorZ* owner_conv = (LDKCResult_COption_TypeZDecodeErrorZ*)untag_ptr(owner);
7094         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
7095         *ret_copy = CResult_COption_TypeZDecodeErrorZ_get_err(owner_conv);
7096         uint64_t ret_ref = tag_ptr(ret_copy, true);
7097         return ret_ref;
7098 }
7099
7100 uint32_t __attribute__((export_name("TS_LDKCOption_SocketAddressZ_ty_from_ptr"))) TS_LDKCOption_SocketAddressZ_ty_from_ptr(uint64_t ptr) {
7101         LDKCOption_SocketAddressZ *obj = (LDKCOption_SocketAddressZ*)untag_ptr(ptr);
7102         switch(obj->tag) {
7103                 case LDKCOption_SocketAddressZ_Some: return 0;
7104                 case LDKCOption_SocketAddressZ_None: return 1;
7105                 default: abort();
7106         }
7107 }
7108 uint64_t __attribute__((export_name("TS_LDKCOption_SocketAddressZ_Some_get_some"))) TS_LDKCOption_SocketAddressZ_Some_get_some(uint64_t ptr) {
7109         LDKCOption_SocketAddressZ *obj = (LDKCOption_SocketAddressZ*)untag_ptr(ptr);
7110         assert(obj->tag == LDKCOption_SocketAddressZ_Some);
7111         uint64_t some_ref = tag_ptr(&obj->some, false);
7112         return some_ref;
7113 }
7114 static inline struct LDKPublicKey C2Tuple_PublicKeyCOption_SocketAddressZZ_get_a(LDKC2Tuple_PublicKeyCOption_SocketAddressZZ *NONNULL_PTR owner){
7115         return owner->a;
7116 }
7117 int8_tArray  __attribute__((export_name("TS_C2Tuple_PublicKeyCOption_SocketAddressZZ_get_a"))) TS_C2Tuple_PublicKeyCOption_SocketAddressZZ_get_a(uint64_t owner) {
7118         LDKC2Tuple_PublicKeyCOption_SocketAddressZZ* owner_conv = (LDKC2Tuple_PublicKeyCOption_SocketAddressZZ*)untag_ptr(owner);
7119         int8_tArray ret_arr = init_int8_tArray(33, __LINE__);
7120         memcpy(ret_arr->elems, C2Tuple_PublicKeyCOption_SocketAddressZZ_get_a(owner_conv).compressed_form, 33);
7121         return ret_arr;
7122 }
7123
7124 static inline struct LDKCOption_SocketAddressZ C2Tuple_PublicKeyCOption_SocketAddressZZ_get_b(LDKC2Tuple_PublicKeyCOption_SocketAddressZZ *NONNULL_PTR owner){
7125         return COption_SocketAddressZ_clone(&owner->b);
7126 }
7127 uint64_t  __attribute__((export_name("TS_C2Tuple_PublicKeyCOption_SocketAddressZZ_get_b"))) TS_C2Tuple_PublicKeyCOption_SocketAddressZZ_get_b(uint64_t owner) {
7128         LDKC2Tuple_PublicKeyCOption_SocketAddressZZ* owner_conv = (LDKC2Tuple_PublicKeyCOption_SocketAddressZZ*)untag_ptr(owner);
7129         LDKCOption_SocketAddressZ *ret_copy = MALLOC(sizeof(LDKCOption_SocketAddressZ), "LDKCOption_SocketAddressZ");
7130         *ret_copy = C2Tuple_PublicKeyCOption_SocketAddressZZ_get_b(owner_conv);
7131         uint64_t ret_ref = tag_ptr(ret_copy, true);
7132         return ret_ref;
7133 }
7134
7135 static inline LDKCVec_C2Tuple_PublicKeyCOption_SocketAddressZZZ CVec_C2Tuple_PublicKeyCOption_SocketAddressZZZ_clone(const LDKCVec_C2Tuple_PublicKeyCOption_SocketAddressZZZ *orig) {
7136         LDKCVec_C2Tuple_PublicKeyCOption_SocketAddressZZZ ret = { .data = MALLOC(sizeof(LDKC2Tuple_PublicKeyCOption_SocketAddressZZ) * orig->datalen, "LDKCVec_C2Tuple_PublicKeyCOption_SocketAddressZZZ clone bytes"), .datalen = orig->datalen };
7137         for (size_t i = 0; i < ret.datalen; i++) {
7138                 ret.data[i] = C2Tuple_PublicKeyCOption_SocketAddressZZ_clone(&orig->data[i]);
7139         }
7140         return ret;
7141 }
7142 static inline struct LDKCVec_u8Z CResult_CVec_u8ZPeerHandleErrorZ_get_ok(LDKCResult_CVec_u8ZPeerHandleErrorZ *NONNULL_PTR owner){
7143 CHECK(owner->result_ok);
7144         return CVec_u8Z_clone(&*owner->contents.result);
7145 }
7146 int8_tArray  __attribute__((export_name("TS_CResult_CVec_u8ZPeerHandleErrorZ_get_ok"))) TS_CResult_CVec_u8ZPeerHandleErrorZ_get_ok(uint64_t owner) {
7147         LDKCResult_CVec_u8ZPeerHandleErrorZ* owner_conv = (LDKCResult_CVec_u8ZPeerHandleErrorZ*)untag_ptr(owner);
7148         LDKCVec_u8Z ret_var = CResult_CVec_u8ZPeerHandleErrorZ_get_ok(owner_conv);
7149         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
7150         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
7151         CVec_u8Z_free(ret_var);
7152         return ret_arr;
7153 }
7154
7155 static inline struct LDKPeerHandleError CResult_CVec_u8ZPeerHandleErrorZ_get_err(LDKCResult_CVec_u8ZPeerHandleErrorZ *NONNULL_PTR owner){
7156         LDKPeerHandleError ret = *owner->contents.err;
7157         ret.is_owned = false;
7158         return ret;
7159 }
7160 uint64_t  __attribute__((export_name("TS_CResult_CVec_u8ZPeerHandleErrorZ_get_err"))) TS_CResult_CVec_u8ZPeerHandleErrorZ_get_err(uint64_t owner) {
7161         LDKCResult_CVec_u8ZPeerHandleErrorZ* owner_conv = (LDKCResult_CVec_u8ZPeerHandleErrorZ*)untag_ptr(owner);
7162         LDKPeerHandleError ret_var = CResult_CVec_u8ZPeerHandleErrorZ_get_err(owner_conv);
7163         uint64_t ret_ref = 0;
7164         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
7165         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
7166         return ret_ref;
7167 }
7168
7169 static inline void CResult_NonePeerHandleErrorZ_get_ok(LDKCResult_NonePeerHandleErrorZ *NONNULL_PTR owner){
7170 CHECK(owner->result_ok);
7171         return *owner->contents.result;
7172 }
7173 void  __attribute__((export_name("TS_CResult_NonePeerHandleErrorZ_get_ok"))) TS_CResult_NonePeerHandleErrorZ_get_ok(uint64_t owner) {
7174         LDKCResult_NonePeerHandleErrorZ* owner_conv = (LDKCResult_NonePeerHandleErrorZ*)untag_ptr(owner);
7175         CResult_NonePeerHandleErrorZ_get_ok(owner_conv);
7176 }
7177
7178 static inline struct LDKPeerHandleError CResult_NonePeerHandleErrorZ_get_err(LDKCResult_NonePeerHandleErrorZ *NONNULL_PTR owner){
7179         LDKPeerHandleError ret = *owner->contents.err;
7180         ret.is_owned = false;
7181         return ret;
7182 }
7183 uint64_t  __attribute__((export_name("TS_CResult_NonePeerHandleErrorZ_get_err"))) TS_CResult_NonePeerHandleErrorZ_get_err(uint64_t owner) {
7184         LDKCResult_NonePeerHandleErrorZ* owner_conv = (LDKCResult_NonePeerHandleErrorZ*)untag_ptr(owner);
7185         LDKPeerHandleError ret_var = CResult_NonePeerHandleErrorZ_get_err(owner_conv);
7186         uint64_t ret_ref = 0;
7187         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
7188         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
7189         return ret_ref;
7190 }
7191
7192 static inline bool CResult_boolPeerHandleErrorZ_get_ok(LDKCResult_boolPeerHandleErrorZ *NONNULL_PTR owner){
7193 CHECK(owner->result_ok);
7194         return *owner->contents.result;
7195 }
7196 jboolean  __attribute__((export_name("TS_CResult_boolPeerHandleErrorZ_get_ok"))) TS_CResult_boolPeerHandleErrorZ_get_ok(uint64_t owner) {
7197         LDKCResult_boolPeerHandleErrorZ* owner_conv = (LDKCResult_boolPeerHandleErrorZ*)untag_ptr(owner);
7198         jboolean ret_conv = CResult_boolPeerHandleErrorZ_get_ok(owner_conv);
7199         return ret_conv;
7200 }
7201
7202 static inline struct LDKPeerHandleError CResult_boolPeerHandleErrorZ_get_err(LDKCResult_boolPeerHandleErrorZ *NONNULL_PTR owner){
7203         LDKPeerHandleError ret = *owner->contents.err;
7204         ret.is_owned = false;
7205         return ret;
7206 }
7207 uint64_t  __attribute__((export_name("TS_CResult_boolPeerHandleErrorZ_get_err"))) TS_CResult_boolPeerHandleErrorZ_get_err(uint64_t owner) {
7208         LDKCResult_boolPeerHandleErrorZ* owner_conv = (LDKCResult_boolPeerHandleErrorZ*)untag_ptr(owner);
7209         LDKPeerHandleError ret_var = CResult_boolPeerHandleErrorZ_get_err(owner_conv);
7210         uint64_t ret_ref = 0;
7211         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
7212         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
7213         return ret_ref;
7214 }
7215
7216 uint32_t __attribute__((export_name("TS_LDKGraphSyncError_ty_from_ptr"))) TS_LDKGraphSyncError_ty_from_ptr(uint64_t ptr) {
7217         LDKGraphSyncError *obj = (LDKGraphSyncError*)untag_ptr(ptr);
7218         switch(obj->tag) {
7219                 case LDKGraphSyncError_DecodeError: return 0;
7220                 case LDKGraphSyncError_LightningError: return 1;
7221                 default: abort();
7222         }
7223 }
7224 uint64_t __attribute__((export_name("TS_LDKGraphSyncError_DecodeError_get_decode_error"))) TS_LDKGraphSyncError_DecodeError_get_decode_error(uint64_t ptr) {
7225         LDKGraphSyncError *obj = (LDKGraphSyncError*)untag_ptr(ptr);
7226         assert(obj->tag == LDKGraphSyncError_DecodeError);
7227         uint64_t decode_error_ref = tag_ptr(&obj->decode_error, false);
7228         return decode_error_ref;
7229 }
7230 uint64_t __attribute__((export_name("TS_LDKGraphSyncError_LightningError_get_lightning_error"))) TS_LDKGraphSyncError_LightningError_get_lightning_error(uint64_t ptr) {
7231         LDKGraphSyncError *obj = (LDKGraphSyncError*)untag_ptr(ptr);
7232         assert(obj->tag == LDKGraphSyncError_LightningError);
7233         LDKLightningError lightning_error_var = obj->lightning_error;
7234                         uint64_t lightning_error_ref = 0;
7235                         CHECK_INNER_FIELD_ACCESS_OR_NULL(lightning_error_var);
7236                         lightning_error_ref = tag_ptr(lightning_error_var.inner, false);
7237         return lightning_error_ref;
7238 }
7239 static inline uint32_t CResult_u32GraphSyncErrorZ_get_ok(LDKCResult_u32GraphSyncErrorZ *NONNULL_PTR owner){
7240 CHECK(owner->result_ok);
7241         return *owner->contents.result;
7242 }
7243 int32_t  __attribute__((export_name("TS_CResult_u32GraphSyncErrorZ_get_ok"))) TS_CResult_u32GraphSyncErrorZ_get_ok(uint64_t owner) {
7244         LDKCResult_u32GraphSyncErrorZ* owner_conv = (LDKCResult_u32GraphSyncErrorZ*)untag_ptr(owner);
7245         int32_t ret_conv = CResult_u32GraphSyncErrorZ_get_ok(owner_conv);
7246         return ret_conv;
7247 }
7248
7249 static inline struct LDKGraphSyncError CResult_u32GraphSyncErrorZ_get_err(LDKCResult_u32GraphSyncErrorZ *NONNULL_PTR owner){
7250 CHECK(!owner->result_ok);
7251         return GraphSyncError_clone(&*owner->contents.err);
7252 }
7253 uint64_t  __attribute__((export_name("TS_CResult_u32GraphSyncErrorZ_get_err"))) TS_CResult_u32GraphSyncErrorZ_get_err(uint64_t owner) {
7254         LDKCResult_u32GraphSyncErrorZ* owner_conv = (LDKCResult_u32GraphSyncErrorZ*)untag_ptr(owner);
7255         LDKGraphSyncError *ret_copy = MALLOC(sizeof(LDKGraphSyncError), "LDKGraphSyncError");
7256         *ret_copy = CResult_u32GraphSyncErrorZ_get_err(owner_conv);
7257         uint64_t ret_ref = tag_ptr(ret_copy, true);
7258         return ret_ref;
7259 }
7260
7261 static inline struct LDKCVec_u8Z CResult_CVec_u8ZIOErrorZ_get_ok(LDKCResult_CVec_u8ZIOErrorZ *NONNULL_PTR owner){
7262 CHECK(owner->result_ok);
7263         return CVec_u8Z_clone(&*owner->contents.result);
7264 }
7265 int8_tArray  __attribute__((export_name("TS_CResult_CVec_u8ZIOErrorZ_get_ok"))) TS_CResult_CVec_u8ZIOErrorZ_get_ok(uint64_t owner) {
7266         LDKCResult_CVec_u8ZIOErrorZ* owner_conv = (LDKCResult_CVec_u8ZIOErrorZ*)untag_ptr(owner);
7267         LDKCVec_u8Z ret_var = CResult_CVec_u8ZIOErrorZ_get_ok(owner_conv);
7268         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
7269         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
7270         CVec_u8Z_free(ret_var);
7271         return ret_arr;
7272 }
7273
7274 static inline enum LDKIOError CResult_CVec_u8ZIOErrorZ_get_err(LDKCResult_CVec_u8ZIOErrorZ *NONNULL_PTR owner){
7275 CHECK(!owner->result_ok);
7276         return *owner->contents.err;
7277 }
7278 uint32_t  __attribute__((export_name("TS_CResult_CVec_u8ZIOErrorZ_get_err"))) TS_CResult_CVec_u8ZIOErrorZ_get_err(uint64_t owner) {
7279         LDKCResult_CVec_u8ZIOErrorZ* owner_conv = (LDKCResult_CVec_u8ZIOErrorZ*)untag_ptr(owner);
7280         uint32_t ret_conv = LDKIOError_to_js(CResult_CVec_u8ZIOErrorZ_get_err(owner_conv));
7281         return ret_conv;
7282 }
7283
7284 static inline void CResult_NoneIOErrorZ_get_ok(LDKCResult_NoneIOErrorZ *NONNULL_PTR owner){
7285 CHECK(owner->result_ok);
7286         return *owner->contents.result;
7287 }
7288 void  __attribute__((export_name("TS_CResult_NoneIOErrorZ_get_ok"))) TS_CResult_NoneIOErrorZ_get_ok(uint64_t owner) {
7289         LDKCResult_NoneIOErrorZ* owner_conv = (LDKCResult_NoneIOErrorZ*)untag_ptr(owner);
7290         CResult_NoneIOErrorZ_get_ok(owner_conv);
7291 }
7292
7293 static inline enum LDKIOError CResult_NoneIOErrorZ_get_err(LDKCResult_NoneIOErrorZ *NONNULL_PTR owner){
7294 CHECK(!owner->result_ok);
7295         return *owner->contents.err;
7296 }
7297 uint32_t  __attribute__((export_name("TS_CResult_NoneIOErrorZ_get_err"))) TS_CResult_NoneIOErrorZ_get_err(uint64_t owner) {
7298         LDKCResult_NoneIOErrorZ* owner_conv = (LDKCResult_NoneIOErrorZ*)untag_ptr(owner);
7299         uint32_t ret_conv = LDKIOError_to_js(CResult_NoneIOErrorZ_get_err(owner_conv));
7300         return ret_conv;
7301 }
7302
7303 static inline struct LDKCVec_StrZ CResult_CVec_StrZIOErrorZ_get_ok(LDKCResult_CVec_StrZIOErrorZ *NONNULL_PTR owner){
7304 CHECK(owner->result_ok);
7305         return *owner->contents.result;
7306 }
7307 ptrArray  __attribute__((export_name("TS_CResult_CVec_StrZIOErrorZ_get_ok"))) TS_CResult_CVec_StrZIOErrorZ_get_ok(uint64_t owner) {
7308         LDKCResult_CVec_StrZIOErrorZ* owner_conv = (LDKCResult_CVec_StrZIOErrorZ*)untag_ptr(owner);
7309         LDKCVec_StrZ ret_var = CResult_CVec_StrZIOErrorZ_get_ok(owner_conv);
7310         ptrArray ret_arr = NULL;
7311         ret_arr = init_ptrArray(ret_var.datalen, __LINE__);
7312         jstring *ret_arr_ptr = (jstring*)(((uint8_t*)ret_arr) + 8);
7313         for (size_t i = 0; i < ret_var.datalen; i++) {
7314                 LDKStr ret_conv_8_str = ret_var.data[i];
7315                 jstring ret_conv_8_conv = str_ref_to_ts(ret_conv_8_str.chars, ret_conv_8_str.len);
7316                 ret_arr_ptr[i] = ret_conv_8_conv;
7317         }
7318         
7319         return ret_arr;
7320 }
7321
7322 static inline enum LDKIOError CResult_CVec_StrZIOErrorZ_get_err(LDKCResult_CVec_StrZIOErrorZ *NONNULL_PTR owner){
7323 CHECK(!owner->result_ok);
7324         return *owner->contents.err;
7325 }
7326 uint32_t  __attribute__((export_name("TS_CResult_CVec_StrZIOErrorZ_get_err"))) TS_CResult_CVec_StrZIOErrorZ_get_err(uint64_t owner) {
7327         LDKCResult_CVec_StrZIOErrorZ* owner_conv = (LDKCResult_CVec_StrZIOErrorZ*)untag_ptr(owner);
7328         uint32_t ret_conv = LDKIOError_to_js(CResult_CVec_StrZIOErrorZ_get_err(owner_conv));
7329         return ret_conv;
7330 }
7331
7332 static inline LDKCVec_C2Tuple_ThirtyTwoBytesChannelMonitorZZ CVec_C2Tuple_ThirtyTwoBytesChannelMonitorZZ_clone(const LDKCVec_C2Tuple_ThirtyTwoBytesChannelMonitorZZ *orig) {
7333         LDKCVec_C2Tuple_ThirtyTwoBytesChannelMonitorZZ ret = { .data = MALLOC(sizeof(LDKC2Tuple_ThirtyTwoBytesChannelMonitorZ) * orig->datalen, "LDKCVec_C2Tuple_ThirtyTwoBytesChannelMonitorZZ clone bytes"), .datalen = orig->datalen };
7334         for (size_t i = 0; i < ret.datalen; i++) {
7335                 ret.data[i] = C2Tuple_ThirtyTwoBytesChannelMonitorZ_clone(&orig->data[i]);
7336         }
7337         return ret;
7338 }
7339 static inline struct LDKCVec_C2Tuple_ThirtyTwoBytesChannelMonitorZZ CResult_CVec_C2Tuple_ThirtyTwoBytesChannelMonitorZZIOErrorZ_get_ok(LDKCResult_CVec_C2Tuple_ThirtyTwoBytesChannelMonitorZZIOErrorZ *NONNULL_PTR owner){
7340 CHECK(owner->result_ok);
7341         return CVec_C2Tuple_ThirtyTwoBytesChannelMonitorZZ_clone(&*owner->contents.result);
7342 }
7343 uint64_tArray  __attribute__((export_name("TS_CResult_CVec_C2Tuple_ThirtyTwoBytesChannelMonitorZZIOErrorZ_get_ok"))) TS_CResult_CVec_C2Tuple_ThirtyTwoBytesChannelMonitorZZIOErrorZ_get_ok(uint64_t owner) {
7344         LDKCResult_CVec_C2Tuple_ThirtyTwoBytesChannelMonitorZZIOErrorZ* owner_conv = (LDKCResult_CVec_C2Tuple_ThirtyTwoBytesChannelMonitorZZIOErrorZ*)untag_ptr(owner);
7345         LDKCVec_C2Tuple_ThirtyTwoBytesChannelMonitorZZ ret_var = CResult_CVec_C2Tuple_ThirtyTwoBytesChannelMonitorZZIOErrorZ_get_ok(owner_conv);
7346         uint64_tArray ret_arr = NULL;
7347         ret_arr = init_uint64_tArray(ret_var.datalen, __LINE__);
7348         uint64_t *ret_arr_ptr = (uint64_t*)(((uint8_t*)ret_arr) + 8);
7349         for (size_t o = 0; o < ret_var.datalen; o++) {
7350                 LDKC2Tuple_ThirtyTwoBytesChannelMonitorZ* ret_conv_40_conv = MALLOC(sizeof(LDKC2Tuple_ThirtyTwoBytesChannelMonitorZ), "LDKC2Tuple_ThirtyTwoBytesChannelMonitorZ");
7351                 *ret_conv_40_conv = ret_var.data[o];
7352                 ret_arr_ptr[o] = tag_ptr(ret_conv_40_conv, true);
7353         }
7354         
7355         FREE(ret_var.data);
7356         return ret_arr;
7357 }
7358
7359 static inline enum LDKIOError CResult_CVec_C2Tuple_ThirtyTwoBytesChannelMonitorZZIOErrorZ_get_err(LDKCResult_CVec_C2Tuple_ThirtyTwoBytesChannelMonitorZZIOErrorZ *NONNULL_PTR owner){
7360 CHECK(!owner->result_ok);
7361         return *owner->contents.err;
7362 }
7363 uint32_t  __attribute__((export_name("TS_CResult_CVec_C2Tuple_ThirtyTwoBytesChannelMonitorZZIOErrorZ_get_err"))) TS_CResult_CVec_C2Tuple_ThirtyTwoBytesChannelMonitorZZIOErrorZ_get_err(uint64_t owner) {
7364         LDKCResult_CVec_C2Tuple_ThirtyTwoBytesChannelMonitorZZIOErrorZ* owner_conv = (LDKCResult_CVec_C2Tuple_ThirtyTwoBytesChannelMonitorZZIOErrorZ*)untag_ptr(owner);
7365         uint32_t ret_conv = LDKIOError_to_js(CResult_CVec_C2Tuple_ThirtyTwoBytesChannelMonitorZZIOErrorZ_get_err(owner_conv));
7366         return ret_conv;
7367 }
7368
7369 static inline struct LDKC2Tuple_ThirtyTwoBytesChannelMonitorZ CResult_C2Tuple_ThirtyTwoBytesChannelMonitorZIOErrorZ_get_ok(LDKCResult_C2Tuple_ThirtyTwoBytesChannelMonitorZIOErrorZ *NONNULL_PTR owner){
7370 CHECK(owner->result_ok);
7371         return C2Tuple_ThirtyTwoBytesChannelMonitorZ_clone(&*owner->contents.result);
7372 }
7373 uint64_t  __attribute__((export_name("TS_CResult_C2Tuple_ThirtyTwoBytesChannelMonitorZIOErrorZ_get_ok"))) TS_CResult_C2Tuple_ThirtyTwoBytesChannelMonitorZIOErrorZ_get_ok(uint64_t owner) {
7374         LDKCResult_C2Tuple_ThirtyTwoBytesChannelMonitorZIOErrorZ* owner_conv = (LDKCResult_C2Tuple_ThirtyTwoBytesChannelMonitorZIOErrorZ*)untag_ptr(owner);
7375         LDKC2Tuple_ThirtyTwoBytesChannelMonitorZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_ThirtyTwoBytesChannelMonitorZ), "LDKC2Tuple_ThirtyTwoBytesChannelMonitorZ");
7376         *ret_conv = CResult_C2Tuple_ThirtyTwoBytesChannelMonitorZIOErrorZ_get_ok(owner_conv);
7377         return tag_ptr(ret_conv, true);
7378 }
7379
7380 static inline enum LDKIOError CResult_C2Tuple_ThirtyTwoBytesChannelMonitorZIOErrorZ_get_err(LDKCResult_C2Tuple_ThirtyTwoBytesChannelMonitorZIOErrorZ *NONNULL_PTR owner){
7381 CHECK(!owner->result_ok);
7382         return *owner->contents.err;
7383 }
7384 uint32_t  __attribute__((export_name("TS_CResult_C2Tuple_ThirtyTwoBytesChannelMonitorZIOErrorZ_get_err"))) TS_CResult_C2Tuple_ThirtyTwoBytesChannelMonitorZIOErrorZ_get_err(uint64_t owner) {
7385         LDKCResult_C2Tuple_ThirtyTwoBytesChannelMonitorZIOErrorZ* owner_conv = (LDKCResult_C2Tuple_ThirtyTwoBytesChannelMonitorZIOErrorZ*)untag_ptr(owner);
7386         uint32_t ret_conv = LDKIOError_to_js(CResult_C2Tuple_ThirtyTwoBytesChannelMonitorZIOErrorZ_get_err(owner_conv));
7387         return ret_conv;
7388 }
7389
7390 uint32_t __attribute__((export_name("TS_LDKCOption_SecretKeyZ_ty_from_ptr"))) TS_LDKCOption_SecretKeyZ_ty_from_ptr(uint64_t ptr) {
7391         LDKCOption_SecretKeyZ *obj = (LDKCOption_SecretKeyZ*)untag_ptr(ptr);
7392         switch(obj->tag) {
7393                 case LDKCOption_SecretKeyZ_Some: return 0;
7394                 case LDKCOption_SecretKeyZ_None: return 1;
7395                 default: abort();
7396         }
7397 }
7398 int8_tArray __attribute__((export_name("TS_LDKCOption_SecretKeyZ_Some_get_some"))) TS_LDKCOption_SecretKeyZ_Some_get_some(uint64_t ptr) {
7399         LDKCOption_SecretKeyZ *obj = (LDKCOption_SecretKeyZ*)untag_ptr(ptr);
7400         assert(obj->tag == LDKCOption_SecretKeyZ_Some);
7401         int8_tArray some_arr = init_int8_tArray(32, __LINE__);
7402         memcpy(some_arr->elems, obj->some.bytes, 32);
7403         return some_arr;
7404 }
7405 static inline struct LDKVerifiedInvoiceRequest CResult_VerifiedInvoiceRequestNoneZ_get_ok(LDKCResult_VerifiedInvoiceRequestNoneZ *NONNULL_PTR owner){
7406         LDKVerifiedInvoiceRequest ret = *owner->contents.result;
7407         ret.is_owned = false;
7408         return ret;
7409 }
7410 uint64_t  __attribute__((export_name("TS_CResult_VerifiedInvoiceRequestNoneZ_get_ok"))) TS_CResult_VerifiedInvoiceRequestNoneZ_get_ok(uint64_t owner) {
7411         LDKCResult_VerifiedInvoiceRequestNoneZ* owner_conv = (LDKCResult_VerifiedInvoiceRequestNoneZ*)untag_ptr(owner);
7412         LDKVerifiedInvoiceRequest ret_var = CResult_VerifiedInvoiceRequestNoneZ_get_ok(owner_conv);
7413         uint64_t ret_ref = 0;
7414         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
7415         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
7416         return ret_ref;
7417 }
7418
7419 static inline void CResult_VerifiedInvoiceRequestNoneZ_get_err(LDKCResult_VerifiedInvoiceRequestNoneZ *NONNULL_PTR owner){
7420 CHECK(!owner->result_ok);
7421         return *owner->contents.err;
7422 }
7423 void  __attribute__((export_name("TS_CResult_VerifiedInvoiceRequestNoneZ_get_err"))) TS_CResult_VerifiedInvoiceRequestNoneZ_get_err(uint64_t owner) {
7424         LDKCResult_VerifiedInvoiceRequestNoneZ* owner_conv = (LDKCResult_VerifiedInvoiceRequestNoneZ*)untag_ptr(owner);
7425         CResult_VerifiedInvoiceRequestNoneZ_get_err(owner_conv);
7426 }
7427
7428 static inline LDKCVec_WitnessZ CVec_WitnessZ_clone(const LDKCVec_WitnessZ *orig) {
7429         LDKCVec_WitnessZ ret = { .data = MALLOC(sizeof(LDKWitness) * orig->datalen, "LDKCVec_WitnessZ clone bytes"), .datalen = orig->datalen };
7430         for (size_t i = 0; i < ret.datalen; i++) {
7431                 ret.data[i] = Witness_clone(&orig->data[i]);
7432         }
7433         return ret;
7434 }
7435 uint32_t __attribute__((export_name("TS_LDKCOption_i64Z_ty_from_ptr"))) TS_LDKCOption_i64Z_ty_from_ptr(uint64_t ptr) {
7436         LDKCOption_i64Z *obj = (LDKCOption_i64Z*)untag_ptr(ptr);
7437         switch(obj->tag) {
7438                 case LDKCOption_i64Z_Some: return 0;
7439                 case LDKCOption_i64Z_None: return 1;
7440                 default: abort();
7441         }
7442 }
7443 int64_t __attribute__((export_name("TS_LDKCOption_i64Z_Some_get_some"))) TS_LDKCOption_i64Z_Some_get_some(uint64_t ptr) {
7444         LDKCOption_i64Z *obj = (LDKCOption_i64Z*)untag_ptr(ptr);
7445         assert(obj->tag == LDKCOption_i64Z_Some);
7446         int64_t some_conv = obj->some;
7447         return some_conv;
7448 }
7449 static inline struct LDKSocketAddress CResult_SocketAddressDecodeErrorZ_get_ok(LDKCResult_SocketAddressDecodeErrorZ *NONNULL_PTR owner){
7450 CHECK(owner->result_ok);
7451         return SocketAddress_clone(&*owner->contents.result);
7452 }
7453 uint64_t  __attribute__((export_name("TS_CResult_SocketAddressDecodeErrorZ_get_ok"))) TS_CResult_SocketAddressDecodeErrorZ_get_ok(uint64_t owner) {
7454         LDKCResult_SocketAddressDecodeErrorZ* owner_conv = (LDKCResult_SocketAddressDecodeErrorZ*)untag_ptr(owner);
7455         LDKSocketAddress *ret_copy = MALLOC(sizeof(LDKSocketAddress), "LDKSocketAddress");
7456         *ret_copy = CResult_SocketAddressDecodeErrorZ_get_ok(owner_conv);
7457         uint64_t ret_ref = tag_ptr(ret_copy, true);
7458         return ret_ref;
7459 }
7460
7461 static inline struct LDKDecodeError CResult_SocketAddressDecodeErrorZ_get_err(LDKCResult_SocketAddressDecodeErrorZ *NONNULL_PTR owner){
7462 CHECK(!owner->result_ok);
7463         return DecodeError_clone(&*owner->contents.err);
7464 }
7465 uint64_t  __attribute__((export_name("TS_CResult_SocketAddressDecodeErrorZ_get_err"))) TS_CResult_SocketAddressDecodeErrorZ_get_err(uint64_t owner) {
7466         LDKCResult_SocketAddressDecodeErrorZ* owner_conv = (LDKCResult_SocketAddressDecodeErrorZ*)untag_ptr(owner);
7467         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
7468         *ret_copy = CResult_SocketAddressDecodeErrorZ_get_err(owner_conv);
7469         uint64_t ret_ref = tag_ptr(ret_copy, true);
7470         return ret_ref;
7471 }
7472
7473 static inline struct LDKSocketAddress CResult_SocketAddressSocketAddressParseErrorZ_get_ok(LDKCResult_SocketAddressSocketAddressParseErrorZ *NONNULL_PTR owner){
7474 CHECK(owner->result_ok);
7475         return SocketAddress_clone(&*owner->contents.result);
7476 }
7477 uint64_t  __attribute__((export_name("TS_CResult_SocketAddressSocketAddressParseErrorZ_get_ok"))) TS_CResult_SocketAddressSocketAddressParseErrorZ_get_ok(uint64_t owner) {
7478         LDKCResult_SocketAddressSocketAddressParseErrorZ* owner_conv = (LDKCResult_SocketAddressSocketAddressParseErrorZ*)untag_ptr(owner);
7479         LDKSocketAddress *ret_copy = MALLOC(sizeof(LDKSocketAddress), "LDKSocketAddress");
7480         *ret_copy = CResult_SocketAddressSocketAddressParseErrorZ_get_ok(owner_conv);
7481         uint64_t ret_ref = tag_ptr(ret_copy, true);
7482         return ret_ref;
7483 }
7484
7485 static inline enum LDKSocketAddressParseError CResult_SocketAddressSocketAddressParseErrorZ_get_err(LDKCResult_SocketAddressSocketAddressParseErrorZ *NONNULL_PTR owner){
7486 CHECK(!owner->result_ok);
7487         return SocketAddressParseError_clone(&*owner->contents.err);
7488 }
7489 uint32_t  __attribute__((export_name("TS_CResult_SocketAddressSocketAddressParseErrorZ_get_err"))) TS_CResult_SocketAddressSocketAddressParseErrorZ_get_err(uint64_t owner) {
7490         LDKCResult_SocketAddressSocketAddressParseErrorZ* owner_conv = (LDKCResult_SocketAddressSocketAddressParseErrorZ*)untag_ptr(owner);
7491         uint32_t ret_conv = LDKSocketAddressParseError_to_js(CResult_SocketAddressSocketAddressParseErrorZ_get_err(owner_conv));
7492         return ret_conv;
7493 }
7494
7495 static inline LDKCVec_UpdateAddHTLCZ CVec_UpdateAddHTLCZ_clone(const LDKCVec_UpdateAddHTLCZ *orig) {
7496         LDKCVec_UpdateAddHTLCZ ret = { .data = MALLOC(sizeof(LDKUpdateAddHTLC) * orig->datalen, "LDKCVec_UpdateAddHTLCZ clone bytes"), .datalen = orig->datalen };
7497         for (size_t i = 0; i < ret.datalen; i++) {
7498                 ret.data[i] = UpdateAddHTLC_clone(&orig->data[i]);
7499         }
7500         return ret;
7501 }
7502 static inline LDKCVec_UpdateFulfillHTLCZ CVec_UpdateFulfillHTLCZ_clone(const LDKCVec_UpdateFulfillHTLCZ *orig) {
7503         LDKCVec_UpdateFulfillHTLCZ ret = { .data = MALLOC(sizeof(LDKUpdateFulfillHTLC) * orig->datalen, "LDKCVec_UpdateFulfillHTLCZ clone bytes"), .datalen = orig->datalen };
7504         for (size_t i = 0; i < ret.datalen; i++) {
7505                 ret.data[i] = UpdateFulfillHTLC_clone(&orig->data[i]);
7506         }
7507         return ret;
7508 }
7509 static inline LDKCVec_UpdateFailHTLCZ CVec_UpdateFailHTLCZ_clone(const LDKCVec_UpdateFailHTLCZ *orig) {
7510         LDKCVec_UpdateFailHTLCZ ret = { .data = MALLOC(sizeof(LDKUpdateFailHTLC) * orig->datalen, "LDKCVec_UpdateFailHTLCZ clone bytes"), .datalen = orig->datalen };
7511         for (size_t i = 0; i < ret.datalen; i++) {
7512                 ret.data[i] = UpdateFailHTLC_clone(&orig->data[i]);
7513         }
7514         return ret;
7515 }
7516 static inline LDKCVec_UpdateFailMalformedHTLCZ CVec_UpdateFailMalformedHTLCZ_clone(const LDKCVec_UpdateFailMalformedHTLCZ *orig) {
7517         LDKCVec_UpdateFailMalformedHTLCZ ret = { .data = MALLOC(sizeof(LDKUpdateFailMalformedHTLC) * orig->datalen, "LDKCVec_UpdateFailMalformedHTLCZ clone bytes"), .datalen = orig->datalen };
7518         for (size_t i = 0; i < ret.datalen; i++) {
7519                 ret.data[i] = UpdateFailMalformedHTLC_clone(&orig->data[i]);
7520         }
7521         return ret;
7522 }
7523 static inline struct LDKAcceptChannel CResult_AcceptChannelDecodeErrorZ_get_ok(LDKCResult_AcceptChannelDecodeErrorZ *NONNULL_PTR owner){
7524         LDKAcceptChannel ret = *owner->contents.result;
7525         ret.is_owned = false;
7526         return ret;
7527 }
7528 uint64_t  __attribute__((export_name("TS_CResult_AcceptChannelDecodeErrorZ_get_ok"))) TS_CResult_AcceptChannelDecodeErrorZ_get_ok(uint64_t owner) {
7529         LDKCResult_AcceptChannelDecodeErrorZ* owner_conv = (LDKCResult_AcceptChannelDecodeErrorZ*)untag_ptr(owner);
7530         LDKAcceptChannel ret_var = CResult_AcceptChannelDecodeErrorZ_get_ok(owner_conv);
7531         uint64_t ret_ref = 0;
7532         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
7533         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
7534         return ret_ref;
7535 }
7536
7537 static inline struct LDKDecodeError CResult_AcceptChannelDecodeErrorZ_get_err(LDKCResult_AcceptChannelDecodeErrorZ *NONNULL_PTR owner){
7538 CHECK(!owner->result_ok);
7539         return DecodeError_clone(&*owner->contents.err);
7540 }
7541 uint64_t  __attribute__((export_name("TS_CResult_AcceptChannelDecodeErrorZ_get_err"))) TS_CResult_AcceptChannelDecodeErrorZ_get_err(uint64_t owner) {
7542         LDKCResult_AcceptChannelDecodeErrorZ* owner_conv = (LDKCResult_AcceptChannelDecodeErrorZ*)untag_ptr(owner);
7543         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
7544         *ret_copy = CResult_AcceptChannelDecodeErrorZ_get_err(owner_conv);
7545         uint64_t ret_ref = tag_ptr(ret_copy, true);
7546         return ret_ref;
7547 }
7548
7549 static inline struct LDKAcceptChannelV2 CResult_AcceptChannelV2DecodeErrorZ_get_ok(LDKCResult_AcceptChannelV2DecodeErrorZ *NONNULL_PTR owner){
7550         LDKAcceptChannelV2 ret = *owner->contents.result;
7551         ret.is_owned = false;
7552         return ret;
7553 }
7554 uint64_t  __attribute__((export_name("TS_CResult_AcceptChannelV2DecodeErrorZ_get_ok"))) TS_CResult_AcceptChannelV2DecodeErrorZ_get_ok(uint64_t owner) {
7555         LDKCResult_AcceptChannelV2DecodeErrorZ* owner_conv = (LDKCResult_AcceptChannelV2DecodeErrorZ*)untag_ptr(owner);
7556         LDKAcceptChannelV2 ret_var = CResult_AcceptChannelV2DecodeErrorZ_get_ok(owner_conv);
7557         uint64_t ret_ref = 0;
7558         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
7559         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
7560         return ret_ref;
7561 }
7562
7563 static inline struct LDKDecodeError CResult_AcceptChannelV2DecodeErrorZ_get_err(LDKCResult_AcceptChannelV2DecodeErrorZ *NONNULL_PTR owner){
7564 CHECK(!owner->result_ok);
7565         return DecodeError_clone(&*owner->contents.err);
7566 }
7567 uint64_t  __attribute__((export_name("TS_CResult_AcceptChannelV2DecodeErrorZ_get_err"))) TS_CResult_AcceptChannelV2DecodeErrorZ_get_err(uint64_t owner) {
7568         LDKCResult_AcceptChannelV2DecodeErrorZ* owner_conv = (LDKCResult_AcceptChannelV2DecodeErrorZ*)untag_ptr(owner);
7569         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
7570         *ret_copy = CResult_AcceptChannelV2DecodeErrorZ_get_err(owner_conv);
7571         uint64_t ret_ref = tag_ptr(ret_copy, true);
7572         return ret_ref;
7573 }
7574
7575 static inline struct LDKTxAddInput CResult_TxAddInputDecodeErrorZ_get_ok(LDKCResult_TxAddInputDecodeErrorZ *NONNULL_PTR owner){
7576         LDKTxAddInput ret = *owner->contents.result;
7577         ret.is_owned = false;
7578         return ret;
7579 }
7580 uint64_t  __attribute__((export_name("TS_CResult_TxAddInputDecodeErrorZ_get_ok"))) TS_CResult_TxAddInputDecodeErrorZ_get_ok(uint64_t owner) {
7581         LDKCResult_TxAddInputDecodeErrorZ* owner_conv = (LDKCResult_TxAddInputDecodeErrorZ*)untag_ptr(owner);
7582         LDKTxAddInput ret_var = CResult_TxAddInputDecodeErrorZ_get_ok(owner_conv);
7583         uint64_t ret_ref = 0;
7584         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
7585         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
7586         return ret_ref;
7587 }
7588
7589 static inline struct LDKDecodeError CResult_TxAddInputDecodeErrorZ_get_err(LDKCResult_TxAddInputDecodeErrorZ *NONNULL_PTR owner){
7590 CHECK(!owner->result_ok);
7591         return DecodeError_clone(&*owner->contents.err);
7592 }
7593 uint64_t  __attribute__((export_name("TS_CResult_TxAddInputDecodeErrorZ_get_err"))) TS_CResult_TxAddInputDecodeErrorZ_get_err(uint64_t owner) {
7594         LDKCResult_TxAddInputDecodeErrorZ* owner_conv = (LDKCResult_TxAddInputDecodeErrorZ*)untag_ptr(owner);
7595         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
7596         *ret_copy = CResult_TxAddInputDecodeErrorZ_get_err(owner_conv);
7597         uint64_t ret_ref = tag_ptr(ret_copy, true);
7598         return ret_ref;
7599 }
7600
7601 static inline struct LDKTxAddOutput CResult_TxAddOutputDecodeErrorZ_get_ok(LDKCResult_TxAddOutputDecodeErrorZ *NONNULL_PTR owner){
7602         LDKTxAddOutput ret = *owner->contents.result;
7603         ret.is_owned = false;
7604         return ret;
7605 }
7606 uint64_t  __attribute__((export_name("TS_CResult_TxAddOutputDecodeErrorZ_get_ok"))) TS_CResult_TxAddOutputDecodeErrorZ_get_ok(uint64_t owner) {
7607         LDKCResult_TxAddOutputDecodeErrorZ* owner_conv = (LDKCResult_TxAddOutputDecodeErrorZ*)untag_ptr(owner);
7608         LDKTxAddOutput ret_var = CResult_TxAddOutputDecodeErrorZ_get_ok(owner_conv);
7609         uint64_t ret_ref = 0;
7610         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
7611         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
7612         return ret_ref;
7613 }
7614
7615 static inline struct LDKDecodeError CResult_TxAddOutputDecodeErrorZ_get_err(LDKCResult_TxAddOutputDecodeErrorZ *NONNULL_PTR owner){
7616 CHECK(!owner->result_ok);
7617         return DecodeError_clone(&*owner->contents.err);
7618 }
7619 uint64_t  __attribute__((export_name("TS_CResult_TxAddOutputDecodeErrorZ_get_err"))) TS_CResult_TxAddOutputDecodeErrorZ_get_err(uint64_t owner) {
7620         LDKCResult_TxAddOutputDecodeErrorZ* owner_conv = (LDKCResult_TxAddOutputDecodeErrorZ*)untag_ptr(owner);
7621         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
7622         *ret_copy = CResult_TxAddOutputDecodeErrorZ_get_err(owner_conv);
7623         uint64_t ret_ref = tag_ptr(ret_copy, true);
7624         return ret_ref;
7625 }
7626
7627 static inline struct LDKTxRemoveInput CResult_TxRemoveInputDecodeErrorZ_get_ok(LDKCResult_TxRemoveInputDecodeErrorZ *NONNULL_PTR owner){
7628         LDKTxRemoveInput ret = *owner->contents.result;
7629         ret.is_owned = false;
7630         return ret;
7631 }
7632 uint64_t  __attribute__((export_name("TS_CResult_TxRemoveInputDecodeErrorZ_get_ok"))) TS_CResult_TxRemoveInputDecodeErrorZ_get_ok(uint64_t owner) {
7633         LDKCResult_TxRemoveInputDecodeErrorZ* owner_conv = (LDKCResult_TxRemoveInputDecodeErrorZ*)untag_ptr(owner);
7634         LDKTxRemoveInput ret_var = CResult_TxRemoveInputDecodeErrorZ_get_ok(owner_conv);
7635         uint64_t ret_ref = 0;
7636         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
7637         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
7638         return ret_ref;
7639 }
7640
7641 static inline struct LDKDecodeError CResult_TxRemoveInputDecodeErrorZ_get_err(LDKCResult_TxRemoveInputDecodeErrorZ *NONNULL_PTR owner){
7642 CHECK(!owner->result_ok);
7643         return DecodeError_clone(&*owner->contents.err);
7644 }
7645 uint64_t  __attribute__((export_name("TS_CResult_TxRemoveInputDecodeErrorZ_get_err"))) TS_CResult_TxRemoveInputDecodeErrorZ_get_err(uint64_t owner) {
7646         LDKCResult_TxRemoveInputDecodeErrorZ* owner_conv = (LDKCResult_TxRemoveInputDecodeErrorZ*)untag_ptr(owner);
7647         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
7648         *ret_copy = CResult_TxRemoveInputDecodeErrorZ_get_err(owner_conv);
7649         uint64_t ret_ref = tag_ptr(ret_copy, true);
7650         return ret_ref;
7651 }
7652
7653 static inline struct LDKTxRemoveOutput CResult_TxRemoveOutputDecodeErrorZ_get_ok(LDKCResult_TxRemoveOutputDecodeErrorZ *NONNULL_PTR owner){
7654         LDKTxRemoveOutput ret = *owner->contents.result;
7655         ret.is_owned = false;
7656         return ret;
7657 }
7658 uint64_t  __attribute__((export_name("TS_CResult_TxRemoveOutputDecodeErrorZ_get_ok"))) TS_CResult_TxRemoveOutputDecodeErrorZ_get_ok(uint64_t owner) {
7659         LDKCResult_TxRemoveOutputDecodeErrorZ* owner_conv = (LDKCResult_TxRemoveOutputDecodeErrorZ*)untag_ptr(owner);
7660         LDKTxRemoveOutput ret_var = CResult_TxRemoveOutputDecodeErrorZ_get_ok(owner_conv);
7661         uint64_t ret_ref = 0;
7662         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
7663         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
7664         return ret_ref;
7665 }
7666
7667 static inline struct LDKDecodeError CResult_TxRemoveOutputDecodeErrorZ_get_err(LDKCResult_TxRemoveOutputDecodeErrorZ *NONNULL_PTR owner){
7668 CHECK(!owner->result_ok);
7669         return DecodeError_clone(&*owner->contents.err);
7670 }
7671 uint64_t  __attribute__((export_name("TS_CResult_TxRemoveOutputDecodeErrorZ_get_err"))) TS_CResult_TxRemoveOutputDecodeErrorZ_get_err(uint64_t owner) {
7672         LDKCResult_TxRemoveOutputDecodeErrorZ* owner_conv = (LDKCResult_TxRemoveOutputDecodeErrorZ*)untag_ptr(owner);
7673         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
7674         *ret_copy = CResult_TxRemoveOutputDecodeErrorZ_get_err(owner_conv);
7675         uint64_t ret_ref = tag_ptr(ret_copy, true);
7676         return ret_ref;
7677 }
7678
7679 static inline struct LDKTxComplete CResult_TxCompleteDecodeErrorZ_get_ok(LDKCResult_TxCompleteDecodeErrorZ *NONNULL_PTR owner){
7680         LDKTxComplete ret = *owner->contents.result;
7681         ret.is_owned = false;
7682         return ret;
7683 }
7684 uint64_t  __attribute__((export_name("TS_CResult_TxCompleteDecodeErrorZ_get_ok"))) TS_CResult_TxCompleteDecodeErrorZ_get_ok(uint64_t owner) {
7685         LDKCResult_TxCompleteDecodeErrorZ* owner_conv = (LDKCResult_TxCompleteDecodeErrorZ*)untag_ptr(owner);
7686         LDKTxComplete ret_var = CResult_TxCompleteDecodeErrorZ_get_ok(owner_conv);
7687         uint64_t ret_ref = 0;
7688         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
7689         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
7690         return ret_ref;
7691 }
7692
7693 static inline struct LDKDecodeError CResult_TxCompleteDecodeErrorZ_get_err(LDKCResult_TxCompleteDecodeErrorZ *NONNULL_PTR owner){
7694 CHECK(!owner->result_ok);
7695         return DecodeError_clone(&*owner->contents.err);
7696 }
7697 uint64_t  __attribute__((export_name("TS_CResult_TxCompleteDecodeErrorZ_get_err"))) TS_CResult_TxCompleteDecodeErrorZ_get_err(uint64_t owner) {
7698         LDKCResult_TxCompleteDecodeErrorZ* owner_conv = (LDKCResult_TxCompleteDecodeErrorZ*)untag_ptr(owner);
7699         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
7700         *ret_copy = CResult_TxCompleteDecodeErrorZ_get_err(owner_conv);
7701         uint64_t ret_ref = tag_ptr(ret_copy, true);
7702         return ret_ref;
7703 }
7704
7705 static inline struct LDKTxSignatures CResult_TxSignaturesDecodeErrorZ_get_ok(LDKCResult_TxSignaturesDecodeErrorZ *NONNULL_PTR owner){
7706         LDKTxSignatures ret = *owner->contents.result;
7707         ret.is_owned = false;
7708         return ret;
7709 }
7710 uint64_t  __attribute__((export_name("TS_CResult_TxSignaturesDecodeErrorZ_get_ok"))) TS_CResult_TxSignaturesDecodeErrorZ_get_ok(uint64_t owner) {
7711         LDKCResult_TxSignaturesDecodeErrorZ* owner_conv = (LDKCResult_TxSignaturesDecodeErrorZ*)untag_ptr(owner);
7712         LDKTxSignatures ret_var = CResult_TxSignaturesDecodeErrorZ_get_ok(owner_conv);
7713         uint64_t ret_ref = 0;
7714         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
7715         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
7716         return ret_ref;
7717 }
7718
7719 static inline struct LDKDecodeError CResult_TxSignaturesDecodeErrorZ_get_err(LDKCResult_TxSignaturesDecodeErrorZ *NONNULL_PTR owner){
7720 CHECK(!owner->result_ok);
7721         return DecodeError_clone(&*owner->contents.err);
7722 }
7723 uint64_t  __attribute__((export_name("TS_CResult_TxSignaturesDecodeErrorZ_get_err"))) TS_CResult_TxSignaturesDecodeErrorZ_get_err(uint64_t owner) {
7724         LDKCResult_TxSignaturesDecodeErrorZ* owner_conv = (LDKCResult_TxSignaturesDecodeErrorZ*)untag_ptr(owner);
7725         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
7726         *ret_copy = CResult_TxSignaturesDecodeErrorZ_get_err(owner_conv);
7727         uint64_t ret_ref = tag_ptr(ret_copy, true);
7728         return ret_ref;
7729 }
7730
7731 static inline struct LDKTxInitRbf CResult_TxInitRbfDecodeErrorZ_get_ok(LDKCResult_TxInitRbfDecodeErrorZ *NONNULL_PTR owner){
7732         LDKTxInitRbf ret = *owner->contents.result;
7733         ret.is_owned = false;
7734         return ret;
7735 }
7736 uint64_t  __attribute__((export_name("TS_CResult_TxInitRbfDecodeErrorZ_get_ok"))) TS_CResult_TxInitRbfDecodeErrorZ_get_ok(uint64_t owner) {
7737         LDKCResult_TxInitRbfDecodeErrorZ* owner_conv = (LDKCResult_TxInitRbfDecodeErrorZ*)untag_ptr(owner);
7738         LDKTxInitRbf ret_var = CResult_TxInitRbfDecodeErrorZ_get_ok(owner_conv);
7739         uint64_t ret_ref = 0;
7740         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
7741         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
7742         return ret_ref;
7743 }
7744
7745 static inline struct LDKDecodeError CResult_TxInitRbfDecodeErrorZ_get_err(LDKCResult_TxInitRbfDecodeErrorZ *NONNULL_PTR owner){
7746 CHECK(!owner->result_ok);
7747         return DecodeError_clone(&*owner->contents.err);
7748 }
7749 uint64_t  __attribute__((export_name("TS_CResult_TxInitRbfDecodeErrorZ_get_err"))) TS_CResult_TxInitRbfDecodeErrorZ_get_err(uint64_t owner) {
7750         LDKCResult_TxInitRbfDecodeErrorZ* owner_conv = (LDKCResult_TxInitRbfDecodeErrorZ*)untag_ptr(owner);
7751         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
7752         *ret_copy = CResult_TxInitRbfDecodeErrorZ_get_err(owner_conv);
7753         uint64_t ret_ref = tag_ptr(ret_copy, true);
7754         return ret_ref;
7755 }
7756
7757 static inline struct LDKTxAckRbf CResult_TxAckRbfDecodeErrorZ_get_ok(LDKCResult_TxAckRbfDecodeErrorZ *NONNULL_PTR owner){
7758         LDKTxAckRbf ret = *owner->contents.result;
7759         ret.is_owned = false;
7760         return ret;
7761 }
7762 uint64_t  __attribute__((export_name("TS_CResult_TxAckRbfDecodeErrorZ_get_ok"))) TS_CResult_TxAckRbfDecodeErrorZ_get_ok(uint64_t owner) {
7763         LDKCResult_TxAckRbfDecodeErrorZ* owner_conv = (LDKCResult_TxAckRbfDecodeErrorZ*)untag_ptr(owner);
7764         LDKTxAckRbf ret_var = CResult_TxAckRbfDecodeErrorZ_get_ok(owner_conv);
7765         uint64_t ret_ref = 0;
7766         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
7767         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
7768         return ret_ref;
7769 }
7770
7771 static inline struct LDKDecodeError CResult_TxAckRbfDecodeErrorZ_get_err(LDKCResult_TxAckRbfDecodeErrorZ *NONNULL_PTR owner){
7772 CHECK(!owner->result_ok);
7773         return DecodeError_clone(&*owner->contents.err);
7774 }
7775 uint64_t  __attribute__((export_name("TS_CResult_TxAckRbfDecodeErrorZ_get_err"))) TS_CResult_TxAckRbfDecodeErrorZ_get_err(uint64_t owner) {
7776         LDKCResult_TxAckRbfDecodeErrorZ* owner_conv = (LDKCResult_TxAckRbfDecodeErrorZ*)untag_ptr(owner);
7777         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
7778         *ret_copy = CResult_TxAckRbfDecodeErrorZ_get_err(owner_conv);
7779         uint64_t ret_ref = tag_ptr(ret_copy, true);
7780         return ret_ref;
7781 }
7782
7783 static inline struct LDKTxAbort CResult_TxAbortDecodeErrorZ_get_ok(LDKCResult_TxAbortDecodeErrorZ *NONNULL_PTR owner){
7784         LDKTxAbort ret = *owner->contents.result;
7785         ret.is_owned = false;
7786         return ret;
7787 }
7788 uint64_t  __attribute__((export_name("TS_CResult_TxAbortDecodeErrorZ_get_ok"))) TS_CResult_TxAbortDecodeErrorZ_get_ok(uint64_t owner) {
7789         LDKCResult_TxAbortDecodeErrorZ* owner_conv = (LDKCResult_TxAbortDecodeErrorZ*)untag_ptr(owner);
7790         LDKTxAbort ret_var = CResult_TxAbortDecodeErrorZ_get_ok(owner_conv);
7791         uint64_t ret_ref = 0;
7792         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
7793         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
7794         return ret_ref;
7795 }
7796
7797 static inline struct LDKDecodeError CResult_TxAbortDecodeErrorZ_get_err(LDKCResult_TxAbortDecodeErrorZ *NONNULL_PTR owner){
7798 CHECK(!owner->result_ok);
7799         return DecodeError_clone(&*owner->contents.err);
7800 }
7801 uint64_t  __attribute__((export_name("TS_CResult_TxAbortDecodeErrorZ_get_err"))) TS_CResult_TxAbortDecodeErrorZ_get_err(uint64_t owner) {
7802         LDKCResult_TxAbortDecodeErrorZ* owner_conv = (LDKCResult_TxAbortDecodeErrorZ*)untag_ptr(owner);
7803         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
7804         *ret_copy = CResult_TxAbortDecodeErrorZ_get_err(owner_conv);
7805         uint64_t ret_ref = tag_ptr(ret_copy, true);
7806         return ret_ref;
7807 }
7808
7809 static inline struct LDKAnnouncementSignatures CResult_AnnouncementSignaturesDecodeErrorZ_get_ok(LDKCResult_AnnouncementSignaturesDecodeErrorZ *NONNULL_PTR owner){
7810         LDKAnnouncementSignatures ret = *owner->contents.result;
7811         ret.is_owned = false;
7812         return ret;
7813 }
7814 uint64_t  __attribute__((export_name("TS_CResult_AnnouncementSignaturesDecodeErrorZ_get_ok"))) TS_CResult_AnnouncementSignaturesDecodeErrorZ_get_ok(uint64_t owner) {
7815         LDKCResult_AnnouncementSignaturesDecodeErrorZ* owner_conv = (LDKCResult_AnnouncementSignaturesDecodeErrorZ*)untag_ptr(owner);
7816         LDKAnnouncementSignatures ret_var = CResult_AnnouncementSignaturesDecodeErrorZ_get_ok(owner_conv);
7817         uint64_t ret_ref = 0;
7818         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
7819         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
7820         return ret_ref;
7821 }
7822
7823 static inline struct LDKDecodeError CResult_AnnouncementSignaturesDecodeErrorZ_get_err(LDKCResult_AnnouncementSignaturesDecodeErrorZ *NONNULL_PTR owner){
7824 CHECK(!owner->result_ok);
7825         return DecodeError_clone(&*owner->contents.err);
7826 }
7827 uint64_t  __attribute__((export_name("TS_CResult_AnnouncementSignaturesDecodeErrorZ_get_err"))) TS_CResult_AnnouncementSignaturesDecodeErrorZ_get_err(uint64_t owner) {
7828         LDKCResult_AnnouncementSignaturesDecodeErrorZ* owner_conv = (LDKCResult_AnnouncementSignaturesDecodeErrorZ*)untag_ptr(owner);
7829         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
7830         *ret_copy = CResult_AnnouncementSignaturesDecodeErrorZ_get_err(owner_conv);
7831         uint64_t ret_ref = tag_ptr(ret_copy, true);
7832         return ret_ref;
7833 }
7834
7835 static inline struct LDKChannelReestablish CResult_ChannelReestablishDecodeErrorZ_get_ok(LDKCResult_ChannelReestablishDecodeErrorZ *NONNULL_PTR owner){
7836         LDKChannelReestablish ret = *owner->contents.result;
7837         ret.is_owned = false;
7838         return ret;
7839 }
7840 uint64_t  __attribute__((export_name("TS_CResult_ChannelReestablishDecodeErrorZ_get_ok"))) TS_CResult_ChannelReestablishDecodeErrorZ_get_ok(uint64_t owner) {
7841         LDKCResult_ChannelReestablishDecodeErrorZ* owner_conv = (LDKCResult_ChannelReestablishDecodeErrorZ*)untag_ptr(owner);
7842         LDKChannelReestablish ret_var = CResult_ChannelReestablishDecodeErrorZ_get_ok(owner_conv);
7843         uint64_t ret_ref = 0;
7844         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
7845         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
7846         return ret_ref;
7847 }
7848
7849 static inline struct LDKDecodeError CResult_ChannelReestablishDecodeErrorZ_get_err(LDKCResult_ChannelReestablishDecodeErrorZ *NONNULL_PTR owner){
7850 CHECK(!owner->result_ok);
7851         return DecodeError_clone(&*owner->contents.err);
7852 }
7853 uint64_t  __attribute__((export_name("TS_CResult_ChannelReestablishDecodeErrorZ_get_err"))) TS_CResult_ChannelReestablishDecodeErrorZ_get_err(uint64_t owner) {
7854         LDKCResult_ChannelReestablishDecodeErrorZ* owner_conv = (LDKCResult_ChannelReestablishDecodeErrorZ*)untag_ptr(owner);
7855         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
7856         *ret_copy = CResult_ChannelReestablishDecodeErrorZ_get_err(owner_conv);
7857         uint64_t ret_ref = tag_ptr(ret_copy, true);
7858         return ret_ref;
7859 }
7860
7861 static inline struct LDKClosingSigned CResult_ClosingSignedDecodeErrorZ_get_ok(LDKCResult_ClosingSignedDecodeErrorZ *NONNULL_PTR owner){
7862         LDKClosingSigned ret = *owner->contents.result;
7863         ret.is_owned = false;
7864         return ret;
7865 }
7866 uint64_t  __attribute__((export_name("TS_CResult_ClosingSignedDecodeErrorZ_get_ok"))) TS_CResult_ClosingSignedDecodeErrorZ_get_ok(uint64_t owner) {
7867         LDKCResult_ClosingSignedDecodeErrorZ* owner_conv = (LDKCResult_ClosingSignedDecodeErrorZ*)untag_ptr(owner);
7868         LDKClosingSigned ret_var = CResult_ClosingSignedDecodeErrorZ_get_ok(owner_conv);
7869         uint64_t ret_ref = 0;
7870         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
7871         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
7872         return ret_ref;
7873 }
7874
7875 static inline struct LDKDecodeError CResult_ClosingSignedDecodeErrorZ_get_err(LDKCResult_ClosingSignedDecodeErrorZ *NONNULL_PTR owner){
7876 CHECK(!owner->result_ok);
7877         return DecodeError_clone(&*owner->contents.err);
7878 }
7879 uint64_t  __attribute__((export_name("TS_CResult_ClosingSignedDecodeErrorZ_get_err"))) TS_CResult_ClosingSignedDecodeErrorZ_get_err(uint64_t owner) {
7880         LDKCResult_ClosingSignedDecodeErrorZ* owner_conv = (LDKCResult_ClosingSignedDecodeErrorZ*)untag_ptr(owner);
7881         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
7882         *ret_copy = CResult_ClosingSignedDecodeErrorZ_get_err(owner_conv);
7883         uint64_t ret_ref = tag_ptr(ret_copy, true);
7884         return ret_ref;
7885 }
7886
7887 static inline struct LDKClosingSignedFeeRange CResult_ClosingSignedFeeRangeDecodeErrorZ_get_ok(LDKCResult_ClosingSignedFeeRangeDecodeErrorZ *NONNULL_PTR owner){
7888         LDKClosingSignedFeeRange ret = *owner->contents.result;
7889         ret.is_owned = false;
7890         return ret;
7891 }
7892 uint64_t  __attribute__((export_name("TS_CResult_ClosingSignedFeeRangeDecodeErrorZ_get_ok"))) TS_CResult_ClosingSignedFeeRangeDecodeErrorZ_get_ok(uint64_t owner) {
7893         LDKCResult_ClosingSignedFeeRangeDecodeErrorZ* owner_conv = (LDKCResult_ClosingSignedFeeRangeDecodeErrorZ*)untag_ptr(owner);
7894         LDKClosingSignedFeeRange ret_var = CResult_ClosingSignedFeeRangeDecodeErrorZ_get_ok(owner_conv);
7895         uint64_t ret_ref = 0;
7896         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
7897         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
7898         return ret_ref;
7899 }
7900
7901 static inline struct LDKDecodeError CResult_ClosingSignedFeeRangeDecodeErrorZ_get_err(LDKCResult_ClosingSignedFeeRangeDecodeErrorZ *NONNULL_PTR owner){
7902 CHECK(!owner->result_ok);
7903         return DecodeError_clone(&*owner->contents.err);
7904 }
7905 uint64_t  __attribute__((export_name("TS_CResult_ClosingSignedFeeRangeDecodeErrorZ_get_err"))) TS_CResult_ClosingSignedFeeRangeDecodeErrorZ_get_err(uint64_t owner) {
7906         LDKCResult_ClosingSignedFeeRangeDecodeErrorZ* owner_conv = (LDKCResult_ClosingSignedFeeRangeDecodeErrorZ*)untag_ptr(owner);
7907         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
7908         *ret_copy = CResult_ClosingSignedFeeRangeDecodeErrorZ_get_err(owner_conv);
7909         uint64_t ret_ref = tag_ptr(ret_copy, true);
7910         return ret_ref;
7911 }
7912
7913 static inline struct LDKCommitmentSigned CResult_CommitmentSignedDecodeErrorZ_get_ok(LDKCResult_CommitmentSignedDecodeErrorZ *NONNULL_PTR owner){
7914         LDKCommitmentSigned ret = *owner->contents.result;
7915         ret.is_owned = false;
7916         return ret;
7917 }
7918 uint64_t  __attribute__((export_name("TS_CResult_CommitmentSignedDecodeErrorZ_get_ok"))) TS_CResult_CommitmentSignedDecodeErrorZ_get_ok(uint64_t owner) {
7919         LDKCResult_CommitmentSignedDecodeErrorZ* owner_conv = (LDKCResult_CommitmentSignedDecodeErrorZ*)untag_ptr(owner);
7920         LDKCommitmentSigned ret_var = CResult_CommitmentSignedDecodeErrorZ_get_ok(owner_conv);
7921         uint64_t ret_ref = 0;
7922         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
7923         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
7924         return ret_ref;
7925 }
7926
7927 static inline struct LDKDecodeError CResult_CommitmentSignedDecodeErrorZ_get_err(LDKCResult_CommitmentSignedDecodeErrorZ *NONNULL_PTR owner){
7928 CHECK(!owner->result_ok);
7929         return DecodeError_clone(&*owner->contents.err);
7930 }
7931 uint64_t  __attribute__((export_name("TS_CResult_CommitmentSignedDecodeErrorZ_get_err"))) TS_CResult_CommitmentSignedDecodeErrorZ_get_err(uint64_t owner) {
7932         LDKCResult_CommitmentSignedDecodeErrorZ* owner_conv = (LDKCResult_CommitmentSignedDecodeErrorZ*)untag_ptr(owner);
7933         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
7934         *ret_copy = CResult_CommitmentSignedDecodeErrorZ_get_err(owner_conv);
7935         uint64_t ret_ref = tag_ptr(ret_copy, true);
7936         return ret_ref;
7937 }
7938
7939 static inline struct LDKFundingCreated CResult_FundingCreatedDecodeErrorZ_get_ok(LDKCResult_FundingCreatedDecodeErrorZ *NONNULL_PTR owner){
7940         LDKFundingCreated ret = *owner->contents.result;
7941         ret.is_owned = false;
7942         return ret;
7943 }
7944 uint64_t  __attribute__((export_name("TS_CResult_FundingCreatedDecodeErrorZ_get_ok"))) TS_CResult_FundingCreatedDecodeErrorZ_get_ok(uint64_t owner) {
7945         LDKCResult_FundingCreatedDecodeErrorZ* owner_conv = (LDKCResult_FundingCreatedDecodeErrorZ*)untag_ptr(owner);
7946         LDKFundingCreated ret_var = CResult_FundingCreatedDecodeErrorZ_get_ok(owner_conv);
7947         uint64_t ret_ref = 0;
7948         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
7949         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
7950         return ret_ref;
7951 }
7952
7953 static inline struct LDKDecodeError CResult_FundingCreatedDecodeErrorZ_get_err(LDKCResult_FundingCreatedDecodeErrorZ *NONNULL_PTR owner){
7954 CHECK(!owner->result_ok);
7955         return DecodeError_clone(&*owner->contents.err);
7956 }
7957 uint64_t  __attribute__((export_name("TS_CResult_FundingCreatedDecodeErrorZ_get_err"))) TS_CResult_FundingCreatedDecodeErrorZ_get_err(uint64_t owner) {
7958         LDKCResult_FundingCreatedDecodeErrorZ* owner_conv = (LDKCResult_FundingCreatedDecodeErrorZ*)untag_ptr(owner);
7959         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
7960         *ret_copy = CResult_FundingCreatedDecodeErrorZ_get_err(owner_conv);
7961         uint64_t ret_ref = tag_ptr(ret_copy, true);
7962         return ret_ref;
7963 }
7964
7965 static inline struct LDKFundingSigned CResult_FundingSignedDecodeErrorZ_get_ok(LDKCResult_FundingSignedDecodeErrorZ *NONNULL_PTR owner){
7966         LDKFundingSigned ret = *owner->contents.result;
7967         ret.is_owned = false;
7968         return ret;
7969 }
7970 uint64_t  __attribute__((export_name("TS_CResult_FundingSignedDecodeErrorZ_get_ok"))) TS_CResult_FundingSignedDecodeErrorZ_get_ok(uint64_t owner) {
7971         LDKCResult_FundingSignedDecodeErrorZ* owner_conv = (LDKCResult_FundingSignedDecodeErrorZ*)untag_ptr(owner);
7972         LDKFundingSigned ret_var = CResult_FundingSignedDecodeErrorZ_get_ok(owner_conv);
7973         uint64_t ret_ref = 0;
7974         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
7975         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
7976         return ret_ref;
7977 }
7978
7979 static inline struct LDKDecodeError CResult_FundingSignedDecodeErrorZ_get_err(LDKCResult_FundingSignedDecodeErrorZ *NONNULL_PTR owner){
7980 CHECK(!owner->result_ok);
7981         return DecodeError_clone(&*owner->contents.err);
7982 }
7983 uint64_t  __attribute__((export_name("TS_CResult_FundingSignedDecodeErrorZ_get_err"))) TS_CResult_FundingSignedDecodeErrorZ_get_err(uint64_t owner) {
7984         LDKCResult_FundingSignedDecodeErrorZ* owner_conv = (LDKCResult_FundingSignedDecodeErrorZ*)untag_ptr(owner);
7985         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
7986         *ret_copy = CResult_FundingSignedDecodeErrorZ_get_err(owner_conv);
7987         uint64_t ret_ref = tag_ptr(ret_copy, true);
7988         return ret_ref;
7989 }
7990
7991 static inline struct LDKChannelReady CResult_ChannelReadyDecodeErrorZ_get_ok(LDKCResult_ChannelReadyDecodeErrorZ *NONNULL_PTR owner){
7992         LDKChannelReady ret = *owner->contents.result;
7993         ret.is_owned = false;
7994         return ret;
7995 }
7996 uint64_t  __attribute__((export_name("TS_CResult_ChannelReadyDecodeErrorZ_get_ok"))) TS_CResult_ChannelReadyDecodeErrorZ_get_ok(uint64_t owner) {
7997         LDKCResult_ChannelReadyDecodeErrorZ* owner_conv = (LDKCResult_ChannelReadyDecodeErrorZ*)untag_ptr(owner);
7998         LDKChannelReady ret_var = CResult_ChannelReadyDecodeErrorZ_get_ok(owner_conv);
7999         uint64_t ret_ref = 0;
8000         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
8001         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
8002         return ret_ref;
8003 }
8004
8005 static inline struct LDKDecodeError CResult_ChannelReadyDecodeErrorZ_get_err(LDKCResult_ChannelReadyDecodeErrorZ *NONNULL_PTR owner){
8006 CHECK(!owner->result_ok);
8007         return DecodeError_clone(&*owner->contents.err);
8008 }
8009 uint64_t  __attribute__((export_name("TS_CResult_ChannelReadyDecodeErrorZ_get_err"))) TS_CResult_ChannelReadyDecodeErrorZ_get_err(uint64_t owner) {
8010         LDKCResult_ChannelReadyDecodeErrorZ* owner_conv = (LDKCResult_ChannelReadyDecodeErrorZ*)untag_ptr(owner);
8011         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
8012         *ret_copy = CResult_ChannelReadyDecodeErrorZ_get_err(owner_conv);
8013         uint64_t ret_ref = tag_ptr(ret_copy, true);
8014         return ret_ref;
8015 }
8016
8017 static inline struct LDKInit CResult_InitDecodeErrorZ_get_ok(LDKCResult_InitDecodeErrorZ *NONNULL_PTR owner){
8018         LDKInit ret = *owner->contents.result;
8019         ret.is_owned = false;
8020         return ret;
8021 }
8022 uint64_t  __attribute__((export_name("TS_CResult_InitDecodeErrorZ_get_ok"))) TS_CResult_InitDecodeErrorZ_get_ok(uint64_t owner) {
8023         LDKCResult_InitDecodeErrorZ* owner_conv = (LDKCResult_InitDecodeErrorZ*)untag_ptr(owner);
8024         LDKInit ret_var = CResult_InitDecodeErrorZ_get_ok(owner_conv);
8025         uint64_t ret_ref = 0;
8026         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
8027         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
8028         return ret_ref;
8029 }
8030
8031 static inline struct LDKDecodeError CResult_InitDecodeErrorZ_get_err(LDKCResult_InitDecodeErrorZ *NONNULL_PTR owner){
8032 CHECK(!owner->result_ok);
8033         return DecodeError_clone(&*owner->contents.err);
8034 }
8035 uint64_t  __attribute__((export_name("TS_CResult_InitDecodeErrorZ_get_err"))) TS_CResult_InitDecodeErrorZ_get_err(uint64_t owner) {
8036         LDKCResult_InitDecodeErrorZ* owner_conv = (LDKCResult_InitDecodeErrorZ*)untag_ptr(owner);
8037         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
8038         *ret_copy = CResult_InitDecodeErrorZ_get_err(owner_conv);
8039         uint64_t ret_ref = tag_ptr(ret_copy, true);
8040         return ret_ref;
8041 }
8042
8043 static inline struct LDKOpenChannel CResult_OpenChannelDecodeErrorZ_get_ok(LDKCResult_OpenChannelDecodeErrorZ *NONNULL_PTR owner){
8044         LDKOpenChannel ret = *owner->contents.result;
8045         ret.is_owned = false;
8046         return ret;
8047 }
8048 uint64_t  __attribute__((export_name("TS_CResult_OpenChannelDecodeErrorZ_get_ok"))) TS_CResult_OpenChannelDecodeErrorZ_get_ok(uint64_t owner) {
8049         LDKCResult_OpenChannelDecodeErrorZ* owner_conv = (LDKCResult_OpenChannelDecodeErrorZ*)untag_ptr(owner);
8050         LDKOpenChannel ret_var = CResult_OpenChannelDecodeErrorZ_get_ok(owner_conv);
8051         uint64_t ret_ref = 0;
8052         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
8053         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
8054         return ret_ref;
8055 }
8056
8057 static inline struct LDKDecodeError CResult_OpenChannelDecodeErrorZ_get_err(LDKCResult_OpenChannelDecodeErrorZ *NONNULL_PTR owner){
8058 CHECK(!owner->result_ok);
8059         return DecodeError_clone(&*owner->contents.err);
8060 }
8061 uint64_t  __attribute__((export_name("TS_CResult_OpenChannelDecodeErrorZ_get_err"))) TS_CResult_OpenChannelDecodeErrorZ_get_err(uint64_t owner) {
8062         LDKCResult_OpenChannelDecodeErrorZ* owner_conv = (LDKCResult_OpenChannelDecodeErrorZ*)untag_ptr(owner);
8063         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
8064         *ret_copy = CResult_OpenChannelDecodeErrorZ_get_err(owner_conv);
8065         uint64_t ret_ref = tag_ptr(ret_copy, true);
8066         return ret_ref;
8067 }
8068
8069 static inline struct LDKOpenChannelV2 CResult_OpenChannelV2DecodeErrorZ_get_ok(LDKCResult_OpenChannelV2DecodeErrorZ *NONNULL_PTR owner){
8070         LDKOpenChannelV2 ret = *owner->contents.result;
8071         ret.is_owned = false;
8072         return ret;
8073 }
8074 uint64_t  __attribute__((export_name("TS_CResult_OpenChannelV2DecodeErrorZ_get_ok"))) TS_CResult_OpenChannelV2DecodeErrorZ_get_ok(uint64_t owner) {
8075         LDKCResult_OpenChannelV2DecodeErrorZ* owner_conv = (LDKCResult_OpenChannelV2DecodeErrorZ*)untag_ptr(owner);
8076         LDKOpenChannelV2 ret_var = CResult_OpenChannelV2DecodeErrorZ_get_ok(owner_conv);
8077         uint64_t ret_ref = 0;
8078         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
8079         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
8080         return ret_ref;
8081 }
8082
8083 static inline struct LDKDecodeError CResult_OpenChannelV2DecodeErrorZ_get_err(LDKCResult_OpenChannelV2DecodeErrorZ *NONNULL_PTR owner){
8084 CHECK(!owner->result_ok);
8085         return DecodeError_clone(&*owner->contents.err);
8086 }
8087 uint64_t  __attribute__((export_name("TS_CResult_OpenChannelV2DecodeErrorZ_get_err"))) TS_CResult_OpenChannelV2DecodeErrorZ_get_err(uint64_t owner) {
8088         LDKCResult_OpenChannelV2DecodeErrorZ* owner_conv = (LDKCResult_OpenChannelV2DecodeErrorZ*)untag_ptr(owner);
8089         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
8090         *ret_copy = CResult_OpenChannelV2DecodeErrorZ_get_err(owner_conv);
8091         uint64_t ret_ref = tag_ptr(ret_copy, true);
8092         return ret_ref;
8093 }
8094
8095 static inline struct LDKRevokeAndACK CResult_RevokeAndACKDecodeErrorZ_get_ok(LDKCResult_RevokeAndACKDecodeErrorZ *NONNULL_PTR owner){
8096         LDKRevokeAndACK ret = *owner->contents.result;
8097         ret.is_owned = false;
8098         return ret;
8099 }
8100 uint64_t  __attribute__((export_name("TS_CResult_RevokeAndACKDecodeErrorZ_get_ok"))) TS_CResult_RevokeAndACKDecodeErrorZ_get_ok(uint64_t owner) {
8101         LDKCResult_RevokeAndACKDecodeErrorZ* owner_conv = (LDKCResult_RevokeAndACKDecodeErrorZ*)untag_ptr(owner);
8102         LDKRevokeAndACK ret_var = CResult_RevokeAndACKDecodeErrorZ_get_ok(owner_conv);
8103         uint64_t ret_ref = 0;
8104         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
8105         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
8106         return ret_ref;
8107 }
8108
8109 static inline struct LDKDecodeError CResult_RevokeAndACKDecodeErrorZ_get_err(LDKCResult_RevokeAndACKDecodeErrorZ *NONNULL_PTR owner){
8110 CHECK(!owner->result_ok);
8111         return DecodeError_clone(&*owner->contents.err);
8112 }
8113 uint64_t  __attribute__((export_name("TS_CResult_RevokeAndACKDecodeErrorZ_get_err"))) TS_CResult_RevokeAndACKDecodeErrorZ_get_err(uint64_t owner) {
8114         LDKCResult_RevokeAndACKDecodeErrorZ* owner_conv = (LDKCResult_RevokeAndACKDecodeErrorZ*)untag_ptr(owner);
8115         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
8116         *ret_copy = CResult_RevokeAndACKDecodeErrorZ_get_err(owner_conv);
8117         uint64_t ret_ref = tag_ptr(ret_copy, true);
8118         return ret_ref;
8119 }
8120
8121 static inline struct LDKShutdown CResult_ShutdownDecodeErrorZ_get_ok(LDKCResult_ShutdownDecodeErrorZ *NONNULL_PTR owner){
8122         LDKShutdown ret = *owner->contents.result;
8123         ret.is_owned = false;
8124         return ret;
8125 }
8126 uint64_t  __attribute__((export_name("TS_CResult_ShutdownDecodeErrorZ_get_ok"))) TS_CResult_ShutdownDecodeErrorZ_get_ok(uint64_t owner) {
8127         LDKCResult_ShutdownDecodeErrorZ* owner_conv = (LDKCResult_ShutdownDecodeErrorZ*)untag_ptr(owner);
8128         LDKShutdown ret_var = CResult_ShutdownDecodeErrorZ_get_ok(owner_conv);
8129         uint64_t ret_ref = 0;
8130         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
8131         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
8132         return ret_ref;
8133 }
8134
8135 static inline struct LDKDecodeError CResult_ShutdownDecodeErrorZ_get_err(LDKCResult_ShutdownDecodeErrorZ *NONNULL_PTR owner){
8136 CHECK(!owner->result_ok);
8137         return DecodeError_clone(&*owner->contents.err);
8138 }
8139 uint64_t  __attribute__((export_name("TS_CResult_ShutdownDecodeErrorZ_get_err"))) TS_CResult_ShutdownDecodeErrorZ_get_err(uint64_t owner) {
8140         LDKCResult_ShutdownDecodeErrorZ* owner_conv = (LDKCResult_ShutdownDecodeErrorZ*)untag_ptr(owner);
8141         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
8142         *ret_copy = CResult_ShutdownDecodeErrorZ_get_err(owner_conv);
8143         uint64_t ret_ref = tag_ptr(ret_copy, true);
8144         return ret_ref;
8145 }
8146
8147 static inline struct LDKUpdateFailHTLC CResult_UpdateFailHTLCDecodeErrorZ_get_ok(LDKCResult_UpdateFailHTLCDecodeErrorZ *NONNULL_PTR owner){
8148         LDKUpdateFailHTLC ret = *owner->contents.result;
8149         ret.is_owned = false;
8150         return ret;
8151 }
8152 uint64_t  __attribute__((export_name("TS_CResult_UpdateFailHTLCDecodeErrorZ_get_ok"))) TS_CResult_UpdateFailHTLCDecodeErrorZ_get_ok(uint64_t owner) {
8153         LDKCResult_UpdateFailHTLCDecodeErrorZ* owner_conv = (LDKCResult_UpdateFailHTLCDecodeErrorZ*)untag_ptr(owner);
8154         LDKUpdateFailHTLC ret_var = CResult_UpdateFailHTLCDecodeErrorZ_get_ok(owner_conv);
8155         uint64_t ret_ref = 0;
8156         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
8157         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
8158         return ret_ref;
8159 }
8160
8161 static inline struct LDKDecodeError CResult_UpdateFailHTLCDecodeErrorZ_get_err(LDKCResult_UpdateFailHTLCDecodeErrorZ *NONNULL_PTR owner){
8162 CHECK(!owner->result_ok);
8163         return DecodeError_clone(&*owner->contents.err);
8164 }
8165 uint64_t  __attribute__((export_name("TS_CResult_UpdateFailHTLCDecodeErrorZ_get_err"))) TS_CResult_UpdateFailHTLCDecodeErrorZ_get_err(uint64_t owner) {
8166         LDKCResult_UpdateFailHTLCDecodeErrorZ* owner_conv = (LDKCResult_UpdateFailHTLCDecodeErrorZ*)untag_ptr(owner);
8167         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
8168         *ret_copy = CResult_UpdateFailHTLCDecodeErrorZ_get_err(owner_conv);
8169         uint64_t ret_ref = tag_ptr(ret_copy, true);
8170         return ret_ref;
8171 }
8172
8173 static inline struct LDKUpdateFailMalformedHTLC CResult_UpdateFailMalformedHTLCDecodeErrorZ_get_ok(LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ *NONNULL_PTR owner){
8174         LDKUpdateFailMalformedHTLC ret = *owner->contents.result;
8175         ret.is_owned = false;
8176         return ret;
8177 }
8178 uint64_t  __attribute__((export_name("TS_CResult_UpdateFailMalformedHTLCDecodeErrorZ_get_ok"))) TS_CResult_UpdateFailMalformedHTLCDecodeErrorZ_get_ok(uint64_t owner) {
8179         LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ* owner_conv = (LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ*)untag_ptr(owner);
8180         LDKUpdateFailMalformedHTLC ret_var = CResult_UpdateFailMalformedHTLCDecodeErrorZ_get_ok(owner_conv);
8181         uint64_t ret_ref = 0;
8182         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
8183         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
8184         return ret_ref;
8185 }
8186
8187 static inline struct LDKDecodeError CResult_UpdateFailMalformedHTLCDecodeErrorZ_get_err(LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ *NONNULL_PTR owner){
8188 CHECK(!owner->result_ok);
8189         return DecodeError_clone(&*owner->contents.err);
8190 }
8191 uint64_t  __attribute__((export_name("TS_CResult_UpdateFailMalformedHTLCDecodeErrorZ_get_err"))) TS_CResult_UpdateFailMalformedHTLCDecodeErrorZ_get_err(uint64_t owner) {
8192         LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ* owner_conv = (LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ*)untag_ptr(owner);
8193         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
8194         *ret_copy = CResult_UpdateFailMalformedHTLCDecodeErrorZ_get_err(owner_conv);
8195         uint64_t ret_ref = tag_ptr(ret_copy, true);
8196         return ret_ref;
8197 }
8198
8199 static inline struct LDKUpdateFee CResult_UpdateFeeDecodeErrorZ_get_ok(LDKCResult_UpdateFeeDecodeErrorZ *NONNULL_PTR owner){
8200         LDKUpdateFee ret = *owner->contents.result;
8201         ret.is_owned = false;
8202         return ret;
8203 }
8204 uint64_t  __attribute__((export_name("TS_CResult_UpdateFeeDecodeErrorZ_get_ok"))) TS_CResult_UpdateFeeDecodeErrorZ_get_ok(uint64_t owner) {
8205         LDKCResult_UpdateFeeDecodeErrorZ* owner_conv = (LDKCResult_UpdateFeeDecodeErrorZ*)untag_ptr(owner);
8206         LDKUpdateFee ret_var = CResult_UpdateFeeDecodeErrorZ_get_ok(owner_conv);
8207         uint64_t ret_ref = 0;
8208         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
8209         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
8210         return ret_ref;
8211 }
8212
8213 static inline struct LDKDecodeError CResult_UpdateFeeDecodeErrorZ_get_err(LDKCResult_UpdateFeeDecodeErrorZ *NONNULL_PTR owner){
8214 CHECK(!owner->result_ok);
8215         return DecodeError_clone(&*owner->contents.err);
8216 }
8217 uint64_t  __attribute__((export_name("TS_CResult_UpdateFeeDecodeErrorZ_get_err"))) TS_CResult_UpdateFeeDecodeErrorZ_get_err(uint64_t owner) {
8218         LDKCResult_UpdateFeeDecodeErrorZ* owner_conv = (LDKCResult_UpdateFeeDecodeErrorZ*)untag_ptr(owner);
8219         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
8220         *ret_copy = CResult_UpdateFeeDecodeErrorZ_get_err(owner_conv);
8221         uint64_t ret_ref = tag_ptr(ret_copy, true);
8222         return ret_ref;
8223 }
8224
8225 static inline struct LDKUpdateFulfillHTLC CResult_UpdateFulfillHTLCDecodeErrorZ_get_ok(LDKCResult_UpdateFulfillHTLCDecodeErrorZ *NONNULL_PTR owner){
8226         LDKUpdateFulfillHTLC ret = *owner->contents.result;
8227         ret.is_owned = false;
8228         return ret;
8229 }
8230 uint64_t  __attribute__((export_name("TS_CResult_UpdateFulfillHTLCDecodeErrorZ_get_ok"))) TS_CResult_UpdateFulfillHTLCDecodeErrorZ_get_ok(uint64_t owner) {
8231         LDKCResult_UpdateFulfillHTLCDecodeErrorZ* owner_conv = (LDKCResult_UpdateFulfillHTLCDecodeErrorZ*)untag_ptr(owner);
8232         LDKUpdateFulfillHTLC ret_var = CResult_UpdateFulfillHTLCDecodeErrorZ_get_ok(owner_conv);
8233         uint64_t ret_ref = 0;
8234         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
8235         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
8236         return ret_ref;
8237 }
8238
8239 static inline struct LDKDecodeError CResult_UpdateFulfillHTLCDecodeErrorZ_get_err(LDKCResult_UpdateFulfillHTLCDecodeErrorZ *NONNULL_PTR owner){
8240 CHECK(!owner->result_ok);
8241         return DecodeError_clone(&*owner->contents.err);
8242 }
8243 uint64_t  __attribute__((export_name("TS_CResult_UpdateFulfillHTLCDecodeErrorZ_get_err"))) TS_CResult_UpdateFulfillHTLCDecodeErrorZ_get_err(uint64_t owner) {
8244         LDKCResult_UpdateFulfillHTLCDecodeErrorZ* owner_conv = (LDKCResult_UpdateFulfillHTLCDecodeErrorZ*)untag_ptr(owner);
8245         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
8246         *ret_copy = CResult_UpdateFulfillHTLCDecodeErrorZ_get_err(owner_conv);
8247         uint64_t ret_ref = tag_ptr(ret_copy, true);
8248         return ret_ref;
8249 }
8250
8251 static inline struct LDKUpdateAddHTLC CResult_UpdateAddHTLCDecodeErrorZ_get_ok(LDKCResult_UpdateAddHTLCDecodeErrorZ *NONNULL_PTR owner){
8252         LDKUpdateAddHTLC ret = *owner->contents.result;
8253         ret.is_owned = false;
8254         return ret;
8255 }
8256 uint64_t  __attribute__((export_name("TS_CResult_UpdateAddHTLCDecodeErrorZ_get_ok"))) TS_CResult_UpdateAddHTLCDecodeErrorZ_get_ok(uint64_t owner) {
8257         LDKCResult_UpdateAddHTLCDecodeErrorZ* owner_conv = (LDKCResult_UpdateAddHTLCDecodeErrorZ*)untag_ptr(owner);
8258         LDKUpdateAddHTLC ret_var = CResult_UpdateAddHTLCDecodeErrorZ_get_ok(owner_conv);
8259         uint64_t ret_ref = 0;
8260         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
8261         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
8262         return ret_ref;
8263 }
8264
8265 static inline struct LDKDecodeError CResult_UpdateAddHTLCDecodeErrorZ_get_err(LDKCResult_UpdateAddHTLCDecodeErrorZ *NONNULL_PTR owner){
8266 CHECK(!owner->result_ok);
8267         return DecodeError_clone(&*owner->contents.err);
8268 }
8269 uint64_t  __attribute__((export_name("TS_CResult_UpdateAddHTLCDecodeErrorZ_get_err"))) TS_CResult_UpdateAddHTLCDecodeErrorZ_get_err(uint64_t owner) {
8270         LDKCResult_UpdateAddHTLCDecodeErrorZ* owner_conv = (LDKCResult_UpdateAddHTLCDecodeErrorZ*)untag_ptr(owner);
8271         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
8272         *ret_copy = CResult_UpdateAddHTLCDecodeErrorZ_get_err(owner_conv);
8273         uint64_t ret_ref = tag_ptr(ret_copy, true);
8274         return ret_ref;
8275 }
8276
8277 static inline struct LDKOnionMessage CResult_OnionMessageDecodeErrorZ_get_ok(LDKCResult_OnionMessageDecodeErrorZ *NONNULL_PTR owner){
8278         LDKOnionMessage ret = *owner->contents.result;
8279         ret.is_owned = false;
8280         return ret;
8281 }
8282 uint64_t  __attribute__((export_name("TS_CResult_OnionMessageDecodeErrorZ_get_ok"))) TS_CResult_OnionMessageDecodeErrorZ_get_ok(uint64_t owner) {
8283         LDKCResult_OnionMessageDecodeErrorZ* owner_conv = (LDKCResult_OnionMessageDecodeErrorZ*)untag_ptr(owner);
8284         LDKOnionMessage ret_var = CResult_OnionMessageDecodeErrorZ_get_ok(owner_conv);
8285         uint64_t ret_ref = 0;
8286         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
8287         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
8288         return ret_ref;
8289 }
8290
8291 static inline struct LDKDecodeError CResult_OnionMessageDecodeErrorZ_get_err(LDKCResult_OnionMessageDecodeErrorZ *NONNULL_PTR owner){
8292 CHECK(!owner->result_ok);
8293         return DecodeError_clone(&*owner->contents.err);
8294 }
8295 uint64_t  __attribute__((export_name("TS_CResult_OnionMessageDecodeErrorZ_get_err"))) TS_CResult_OnionMessageDecodeErrorZ_get_err(uint64_t owner) {
8296         LDKCResult_OnionMessageDecodeErrorZ* owner_conv = (LDKCResult_OnionMessageDecodeErrorZ*)untag_ptr(owner);
8297         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
8298         *ret_copy = CResult_OnionMessageDecodeErrorZ_get_err(owner_conv);
8299         uint64_t ret_ref = tag_ptr(ret_copy, true);
8300         return ret_ref;
8301 }
8302
8303 static inline struct LDKPing CResult_PingDecodeErrorZ_get_ok(LDKCResult_PingDecodeErrorZ *NONNULL_PTR owner){
8304         LDKPing ret = *owner->contents.result;
8305         ret.is_owned = false;
8306         return ret;
8307 }
8308 uint64_t  __attribute__((export_name("TS_CResult_PingDecodeErrorZ_get_ok"))) TS_CResult_PingDecodeErrorZ_get_ok(uint64_t owner) {
8309         LDKCResult_PingDecodeErrorZ* owner_conv = (LDKCResult_PingDecodeErrorZ*)untag_ptr(owner);
8310         LDKPing ret_var = CResult_PingDecodeErrorZ_get_ok(owner_conv);
8311         uint64_t ret_ref = 0;
8312         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
8313         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
8314         return ret_ref;
8315 }
8316
8317 static inline struct LDKDecodeError CResult_PingDecodeErrorZ_get_err(LDKCResult_PingDecodeErrorZ *NONNULL_PTR owner){
8318 CHECK(!owner->result_ok);
8319         return DecodeError_clone(&*owner->contents.err);
8320 }
8321 uint64_t  __attribute__((export_name("TS_CResult_PingDecodeErrorZ_get_err"))) TS_CResult_PingDecodeErrorZ_get_err(uint64_t owner) {
8322         LDKCResult_PingDecodeErrorZ* owner_conv = (LDKCResult_PingDecodeErrorZ*)untag_ptr(owner);
8323         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
8324         *ret_copy = CResult_PingDecodeErrorZ_get_err(owner_conv);
8325         uint64_t ret_ref = tag_ptr(ret_copy, true);
8326         return ret_ref;
8327 }
8328
8329 static inline struct LDKPong CResult_PongDecodeErrorZ_get_ok(LDKCResult_PongDecodeErrorZ *NONNULL_PTR owner){
8330         LDKPong ret = *owner->contents.result;
8331         ret.is_owned = false;
8332         return ret;
8333 }
8334 uint64_t  __attribute__((export_name("TS_CResult_PongDecodeErrorZ_get_ok"))) TS_CResult_PongDecodeErrorZ_get_ok(uint64_t owner) {
8335         LDKCResult_PongDecodeErrorZ* owner_conv = (LDKCResult_PongDecodeErrorZ*)untag_ptr(owner);
8336         LDKPong ret_var = CResult_PongDecodeErrorZ_get_ok(owner_conv);
8337         uint64_t ret_ref = 0;
8338         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
8339         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
8340         return ret_ref;
8341 }
8342
8343 static inline struct LDKDecodeError CResult_PongDecodeErrorZ_get_err(LDKCResult_PongDecodeErrorZ *NONNULL_PTR owner){
8344 CHECK(!owner->result_ok);
8345         return DecodeError_clone(&*owner->contents.err);
8346 }
8347 uint64_t  __attribute__((export_name("TS_CResult_PongDecodeErrorZ_get_err"))) TS_CResult_PongDecodeErrorZ_get_err(uint64_t owner) {
8348         LDKCResult_PongDecodeErrorZ* owner_conv = (LDKCResult_PongDecodeErrorZ*)untag_ptr(owner);
8349         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
8350         *ret_copy = CResult_PongDecodeErrorZ_get_err(owner_conv);
8351         uint64_t ret_ref = tag_ptr(ret_copy, true);
8352         return ret_ref;
8353 }
8354
8355 static inline struct LDKUnsignedChannelAnnouncement CResult_UnsignedChannelAnnouncementDecodeErrorZ_get_ok(LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ *NONNULL_PTR owner){
8356         LDKUnsignedChannelAnnouncement ret = *owner->contents.result;
8357         ret.is_owned = false;
8358         return ret;
8359 }
8360 uint64_t  __attribute__((export_name("TS_CResult_UnsignedChannelAnnouncementDecodeErrorZ_get_ok"))) TS_CResult_UnsignedChannelAnnouncementDecodeErrorZ_get_ok(uint64_t owner) {
8361         LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ* owner_conv = (LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ*)untag_ptr(owner);
8362         LDKUnsignedChannelAnnouncement ret_var = CResult_UnsignedChannelAnnouncementDecodeErrorZ_get_ok(owner_conv);
8363         uint64_t ret_ref = 0;
8364         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
8365         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
8366         return ret_ref;
8367 }
8368
8369 static inline struct LDKDecodeError CResult_UnsignedChannelAnnouncementDecodeErrorZ_get_err(LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ *NONNULL_PTR owner){
8370 CHECK(!owner->result_ok);
8371         return DecodeError_clone(&*owner->contents.err);
8372 }
8373 uint64_t  __attribute__((export_name("TS_CResult_UnsignedChannelAnnouncementDecodeErrorZ_get_err"))) TS_CResult_UnsignedChannelAnnouncementDecodeErrorZ_get_err(uint64_t owner) {
8374         LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ* owner_conv = (LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ*)untag_ptr(owner);
8375         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
8376         *ret_copy = CResult_UnsignedChannelAnnouncementDecodeErrorZ_get_err(owner_conv);
8377         uint64_t ret_ref = tag_ptr(ret_copy, true);
8378         return ret_ref;
8379 }
8380
8381 static inline struct LDKChannelAnnouncement CResult_ChannelAnnouncementDecodeErrorZ_get_ok(LDKCResult_ChannelAnnouncementDecodeErrorZ *NONNULL_PTR owner){
8382         LDKChannelAnnouncement ret = *owner->contents.result;
8383         ret.is_owned = false;
8384         return ret;
8385 }
8386 uint64_t  __attribute__((export_name("TS_CResult_ChannelAnnouncementDecodeErrorZ_get_ok"))) TS_CResult_ChannelAnnouncementDecodeErrorZ_get_ok(uint64_t owner) {
8387         LDKCResult_ChannelAnnouncementDecodeErrorZ* owner_conv = (LDKCResult_ChannelAnnouncementDecodeErrorZ*)untag_ptr(owner);
8388         LDKChannelAnnouncement ret_var = CResult_ChannelAnnouncementDecodeErrorZ_get_ok(owner_conv);
8389         uint64_t ret_ref = 0;
8390         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
8391         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
8392         return ret_ref;
8393 }
8394
8395 static inline struct LDKDecodeError CResult_ChannelAnnouncementDecodeErrorZ_get_err(LDKCResult_ChannelAnnouncementDecodeErrorZ *NONNULL_PTR owner){
8396 CHECK(!owner->result_ok);
8397         return DecodeError_clone(&*owner->contents.err);
8398 }
8399 uint64_t  __attribute__((export_name("TS_CResult_ChannelAnnouncementDecodeErrorZ_get_err"))) TS_CResult_ChannelAnnouncementDecodeErrorZ_get_err(uint64_t owner) {
8400         LDKCResult_ChannelAnnouncementDecodeErrorZ* owner_conv = (LDKCResult_ChannelAnnouncementDecodeErrorZ*)untag_ptr(owner);
8401         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
8402         *ret_copy = CResult_ChannelAnnouncementDecodeErrorZ_get_err(owner_conv);
8403         uint64_t ret_ref = tag_ptr(ret_copy, true);
8404         return ret_ref;
8405 }
8406
8407 static inline struct LDKUnsignedChannelUpdate CResult_UnsignedChannelUpdateDecodeErrorZ_get_ok(LDKCResult_UnsignedChannelUpdateDecodeErrorZ *NONNULL_PTR owner){
8408         LDKUnsignedChannelUpdate ret = *owner->contents.result;
8409         ret.is_owned = false;
8410         return ret;
8411 }
8412 uint64_t  __attribute__((export_name("TS_CResult_UnsignedChannelUpdateDecodeErrorZ_get_ok"))) TS_CResult_UnsignedChannelUpdateDecodeErrorZ_get_ok(uint64_t owner) {
8413         LDKCResult_UnsignedChannelUpdateDecodeErrorZ* owner_conv = (LDKCResult_UnsignedChannelUpdateDecodeErrorZ*)untag_ptr(owner);
8414         LDKUnsignedChannelUpdate ret_var = CResult_UnsignedChannelUpdateDecodeErrorZ_get_ok(owner_conv);
8415         uint64_t ret_ref = 0;
8416         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
8417         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
8418         return ret_ref;
8419 }
8420
8421 static inline struct LDKDecodeError CResult_UnsignedChannelUpdateDecodeErrorZ_get_err(LDKCResult_UnsignedChannelUpdateDecodeErrorZ *NONNULL_PTR owner){
8422 CHECK(!owner->result_ok);
8423         return DecodeError_clone(&*owner->contents.err);
8424 }
8425 uint64_t  __attribute__((export_name("TS_CResult_UnsignedChannelUpdateDecodeErrorZ_get_err"))) TS_CResult_UnsignedChannelUpdateDecodeErrorZ_get_err(uint64_t owner) {
8426         LDKCResult_UnsignedChannelUpdateDecodeErrorZ* owner_conv = (LDKCResult_UnsignedChannelUpdateDecodeErrorZ*)untag_ptr(owner);
8427         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
8428         *ret_copy = CResult_UnsignedChannelUpdateDecodeErrorZ_get_err(owner_conv);
8429         uint64_t ret_ref = tag_ptr(ret_copy, true);
8430         return ret_ref;
8431 }
8432
8433 static inline struct LDKChannelUpdate CResult_ChannelUpdateDecodeErrorZ_get_ok(LDKCResult_ChannelUpdateDecodeErrorZ *NONNULL_PTR owner){
8434         LDKChannelUpdate ret = *owner->contents.result;
8435         ret.is_owned = false;
8436         return ret;
8437 }
8438 uint64_t  __attribute__((export_name("TS_CResult_ChannelUpdateDecodeErrorZ_get_ok"))) TS_CResult_ChannelUpdateDecodeErrorZ_get_ok(uint64_t owner) {
8439         LDKCResult_ChannelUpdateDecodeErrorZ* owner_conv = (LDKCResult_ChannelUpdateDecodeErrorZ*)untag_ptr(owner);
8440         LDKChannelUpdate ret_var = CResult_ChannelUpdateDecodeErrorZ_get_ok(owner_conv);
8441         uint64_t ret_ref = 0;
8442         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
8443         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
8444         return ret_ref;
8445 }
8446
8447 static inline struct LDKDecodeError CResult_ChannelUpdateDecodeErrorZ_get_err(LDKCResult_ChannelUpdateDecodeErrorZ *NONNULL_PTR owner){
8448 CHECK(!owner->result_ok);
8449         return DecodeError_clone(&*owner->contents.err);
8450 }
8451 uint64_t  __attribute__((export_name("TS_CResult_ChannelUpdateDecodeErrorZ_get_err"))) TS_CResult_ChannelUpdateDecodeErrorZ_get_err(uint64_t owner) {
8452         LDKCResult_ChannelUpdateDecodeErrorZ* owner_conv = (LDKCResult_ChannelUpdateDecodeErrorZ*)untag_ptr(owner);
8453         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
8454         *ret_copy = CResult_ChannelUpdateDecodeErrorZ_get_err(owner_conv);
8455         uint64_t ret_ref = tag_ptr(ret_copy, true);
8456         return ret_ref;
8457 }
8458
8459 static inline struct LDKErrorMessage CResult_ErrorMessageDecodeErrorZ_get_ok(LDKCResult_ErrorMessageDecodeErrorZ *NONNULL_PTR owner){
8460         LDKErrorMessage ret = *owner->contents.result;
8461         ret.is_owned = false;
8462         return ret;
8463 }
8464 uint64_t  __attribute__((export_name("TS_CResult_ErrorMessageDecodeErrorZ_get_ok"))) TS_CResult_ErrorMessageDecodeErrorZ_get_ok(uint64_t owner) {
8465         LDKCResult_ErrorMessageDecodeErrorZ* owner_conv = (LDKCResult_ErrorMessageDecodeErrorZ*)untag_ptr(owner);
8466         LDKErrorMessage ret_var = CResult_ErrorMessageDecodeErrorZ_get_ok(owner_conv);
8467         uint64_t ret_ref = 0;
8468         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
8469         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
8470         return ret_ref;
8471 }
8472
8473 static inline struct LDKDecodeError CResult_ErrorMessageDecodeErrorZ_get_err(LDKCResult_ErrorMessageDecodeErrorZ *NONNULL_PTR owner){
8474 CHECK(!owner->result_ok);
8475         return DecodeError_clone(&*owner->contents.err);
8476 }
8477 uint64_t  __attribute__((export_name("TS_CResult_ErrorMessageDecodeErrorZ_get_err"))) TS_CResult_ErrorMessageDecodeErrorZ_get_err(uint64_t owner) {
8478         LDKCResult_ErrorMessageDecodeErrorZ* owner_conv = (LDKCResult_ErrorMessageDecodeErrorZ*)untag_ptr(owner);
8479         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
8480         *ret_copy = CResult_ErrorMessageDecodeErrorZ_get_err(owner_conv);
8481         uint64_t ret_ref = tag_ptr(ret_copy, true);
8482         return ret_ref;
8483 }
8484
8485 static inline struct LDKWarningMessage CResult_WarningMessageDecodeErrorZ_get_ok(LDKCResult_WarningMessageDecodeErrorZ *NONNULL_PTR owner){
8486         LDKWarningMessage ret = *owner->contents.result;
8487         ret.is_owned = false;
8488         return ret;
8489 }
8490 uint64_t  __attribute__((export_name("TS_CResult_WarningMessageDecodeErrorZ_get_ok"))) TS_CResult_WarningMessageDecodeErrorZ_get_ok(uint64_t owner) {
8491         LDKCResult_WarningMessageDecodeErrorZ* owner_conv = (LDKCResult_WarningMessageDecodeErrorZ*)untag_ptr(owner);
8492         LDKWarningMessage ret_var = CResult_WarningMessageDecodeErrorZ_get_ok(owner_conv);
8493         uint64_t ret_ref = 0;
8494         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
8495         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
8496         return ret_ref;
8497 }
8498
8499 static inline struct LDKDecodeError CResult_WarningMessageDecodeErrorZ_get_err(LDKCResult_WarningMessageDecodeErrorZ *NONNULL_PTR owner){
8500 CHECK(!owner->result_ok);
8501         return DecodeError_clone(&*owner->contents.err);
8502 }
8503 uint64_t  __attribute__((export_name("TS_CResult_WarningMessageDecodeErrorZ_get_err"))) TS_CResult_WarningMessageDecodeErrorZ_get_err(uint64_t owner) {
8504         LDKCResult_WarningMessageDecodeErrorZ* owner_conv = (LDKCResult_WarningMessageDecodeErrorZ*)untag_ptr(owner);
8505         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
8506         *ret_copy = CResult_WarningMessageDecodeErrorZ_get_err(owner_conv);
8507         uint64_t ret_ref = tag_ptr(ret_copy, true);
8508         return ret_ref;
8509 }
8510
8511 static inline struct LDKUnsignedNodeAnnouncement CResult_UnsignedNodeAnnouncementDecodeErrorZ_get_ok(LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ *NONNULL_PTR owner){
8512         LDKUnsignedNodeAnnouncement ret = *owner->contents.result;
8513         ret.is_owned = false;
8514         return ret;
8515 }
8516 uint64_t  __attribute__((export_name("TS_CResult_UnsignedNodeAnnouncementDecodeErrorZ_get_ok"))) TS_CResult_UnsignedNodeAnnouncementDecodeErrorZ_get_ok(uint64_t owner) {
8517         LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ* owner_conv = (LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ*)untag_ptr(owner);
8518         LDKUnsignedNodeAnnouncement ret_var = CResult_UnsignedNodeAnnouncementDecodeErrorZ_get_ok(owner_conv);
8519         uint64_t ret_ref = 0;
8520         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
8521         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
8522         return ret_ref;
8523 }
8524
8525 static inline struct LDKDecodeError CResult_UnsignedNodeAnnouncementDecodeErrorZ_get_err(LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ *NONNULL_PTR owner){
8526 CHECK(!owner->result_ok);
8527         return DecodeError_clone(&*owner->contents.err);
8528 }
8529 uint64_t  __attribute__((export_name("TS_CResult_UnsignedNodeAnnouncementDecodeErrorZ_get_err"))) TS_CResult_UnsignedNodeAnnouncementDecodeErrorZ_get_err(uint64_t owner) {
8530         LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ* owner_conv = (LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ*)untag_ptr(owner);
8531         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
8532         *ret_copy = CResult_UnsignedNodeAnnouncementDecodeErrorZ_get_err(owner_conv);
8533         uint64_t ret_ref = tag_ptr(ret_copy, true);
8534         return ret_ref;
8535 }
8536
8537 static inline struct LDKNodeAnnouncement CResult_NodeAnnouncementDecodeErrorZ_get_ok(LDKCResult_NodeAnnouncementDecodeErrorZ *NONNULL_PTR owner){
8538         LDKNodeAnnouncement ret = *owner->contents.result;
8539         ret.is_owned = false;
8540         return ret;
8541 }
8542 uint64_t  __attribute__((export_name("TS_CResult_NodeAnnouncementDecodeErrorZ_get_ok"))) TS_CResult_NodeAnnouncementDecodeErrorZ_get_ok(uint64_t owner) {
8543         LDKCResult_NodeAnnouncementDecodeErrorZ* owner_conv = (LDKCResult_NodeAnnouncementDecodeErrorZ*)untag_ptr(owner);
8544         LDKNodeAnnouncement ret_var = CResult_NodeAnnouncementDecodeErrorZ_get_ok(owner_conv);
8545         uint64_t ret_ref = 0;
8546         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
8547         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
8548         return ret_ref;
8549 }
8550
8551 static inline struct LDKDecodeError CResult_NodeAnnouncementDecodeErrorZ_get_err(LDKCResult_NodeAnnouncementDecodeErrorZ *NONNULL_PTR owner){
8552 CHECK(!owner->result_ok);
8553         return DecodeError_clone(&*owner->contents.err);
8554 }
8555 uint64_t  __attribute__((export_name("TS_CResult_NodeAnnouncementDecodeErrorZ_get_err"))) TS_CResult_NodeAnnouncementDecodeErrorZ_get_err(uint64_t owner) {
8556         LDKCResult_NodeAnnouncementDecodeErrorZ* owner_conv = (LDKCResult_NodeAnnouncementDecodeErrorZ*)untag_ptr(owner);
8557         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
8558         *ret_copy = CResult_NodeAnnouncementDecodeErrorZ_get_err(owner_conv);
8559         uint64_t ret_ref = tag_ptr(ret_copy, true);
8560         return ret_ref;
8561 }
8562
8563 static inline struct LDKQueryShortChannelIds CResult_QueryShortChannelIdsDecodeErrorZ_get_ok(LDKCResult_QueryShortChannelIdsDecodeErrorZ *NONNULL_PTR owner){
8564         LDKQueryShortChannelIds ret = *owner->contents.result;
8565         ret.is_owned = false;
8566         return ret;
8567 }
8568 uint64_t  __attribute__((export_name("TS_CResult_QueryShortChannelIdsDecodeErrorZ_get_ok"))) TS_CResult_QueryShortChannelIdsDecodeErrorZ_get_ok(uint64_t owner) {
8569         LDKCResult_QueryShortChannelIdsDecodeErrorZ* owner_conv = (LDKCResult_QueryShortChannelIdsDecodeErrorZ*)untag_ptr(owner);
8570         LDKQueryShortChannelIds ret_var = CResult_QueryShortChannelIdsDecodeErrorZ_get_ok(owner_conv);
8571         uint64_t ret_ref = 0;
8572         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
8573         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
8574         return ret_ref;
8575 }
8576
8577 static inline struct LDKDecodeError CResult_QueryShortChannelIdsDecodeErrorZ_get_err(LDKCResult_QueryShortChannelIdsDecodeErrorZ *NONNULL_PTR owner){
8578 CHECK(!owner->result_ok);
8579         return DecodeError_clone(&*owner->contents.err);
8580 }
8581 uint64_t  __attribute__((export_name("TS_CResult_QueryShortChannelIdsDecodeErrorZ_get_err"))) TS_CResult_QueryShortChannelIdsDecodeErrorZ_get_err(uint64_t owner) {
8582         LDKCResult_QueryShortChannelIdsDecodeErrorZ* owner_conv = (LDKCResult_QueryShortChannelIdsDecodeErrorZ*)untag_ptr(owner);
8583         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
8584         *ret_copy = CResult_QueryShortChannelIdsDecodeErrorZ_get_err(owner_conv);
8585         uint64_t ret_ref = tag_ptr(ret_copy, true);
8586         return ret_ref;
8587 }
8588
8589 static inline struct LDKReplyShortChannelIdsEnd CResult_ReplyShortChannelIdsEndDecodeErrorZ_get_ok(LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ *NONNULL_PTR owner){
8590         LDKReplyShortChannelIdsEnd ret = *owner->contents.result;
8591         ret.is_owned = false;
8592         return ret;
8593 }
8594 uint64_t  __attribute__((export_name("TS_CResult_ReplyShortChannelIdsEndDecodeErrorZ_get_ok"))) TS_CResult_ReplyShortChannelIdsEndDecodeErrorZ_get_ok(uint64_t owner) {
8595         LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ* owner_conv = (LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ*)untag_ptr(owner);
8596         LDKReplyShortChannelIdsEnd ret_var = CResult_ReplyShortChannelIdsEndDecodeErrorZ_get_ok(owner_conv);
8597         uint64_t ret_ref = 0;
8598         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
8599         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
8600         return ret_ref;
8601 }
8602
8603 static inline struct LDKDecodeError CResult_ReplyShortChannelIdsEndDecodeErrorZ_get_err(LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ *NONNULL_PTR owner){
8604 CHECK(!owner->result_ok);
8605         return DecodeError_clone(&*owner->contents.err);
8606 }
8607 uint64_t  __attribute__((export_name("TS_CResult_ReplyShortChannelIdsEndDecodeErrorZ_get_err"))) TS_CResult_ReplyShortChannelIdsEndDecodeErrorZ_get_err(uint64_t owner) {
8608         LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ* owner_conv = (LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ*)untag_ptr(owner);
8609         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
8610         *ret_copy = CResult_ReplyShortChannelIdsEndDecodeErrorZ_get_err(owner_conv);
8611         uint64_t ret_ref = tag_ptr(ret_copy, true);
8612         return ret_ref;
8613 }
8614
8615 static inline struct LDKQueryChannelRange CResult_QueryChannelRangeDecodeErrorZ_get_ok(LDKCResult_QueryChannelRangeDecodeErrorZ *NONNULL_PTR owner){
8616         LDKQueryChannelRange ret = *owner->contents.result;
8617         ret.is_owned = false;
8618         return ret;
8619 }
8620 uint64_t  __attribute__((export_name("TS_CResult_QueryChannelRangeDecodeErrorZ_get_ok"))) TS_CResult_QueryChannelRangeDecodeErrorZ_get_ok(uint64_t owner) {
8621         LDKCResult_QueryChannelRangeDecodeErrorZ* owner_conv = (LDKCResult_QueryChannelRangeDecodeErrorZ*)untag_ptr(owner);
8622         LDKQueryChannelRange ret_var = CResult_QueryChannelRangeDecodeErrorZ_get_ok(owner_conv);
8623         uint64_t ret_ref = 0;
8624         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
8625         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
8626         return ret_ref;
8627 }
8628
8629 static inline struct LDKDecodeError CResult_QueryChannelRangeDecodeErrorZ_get_err(LDKCResult_QueryChannelRangeDecodeErrorZ *NONNULL_PTR owner){
8630 CHECK(!owner->result_ok);
8631         return DecodeError_clone(&*owner->contents.err);
8632 }
8633 uint64_t  __attribute__((export_name("TS_CResult_QueryChannelRangeDecodeErrorZ_get_err"))) TS_CResult_QueryChannelRangeDecodeErrorZ_get_err(uint64_t owner) {
8634         LDKCResult_QueryChannelRangeDecodeErrorZ* owner_conv = (LDKCResult_QueryChannelRangeDecodeErrorZ*)untag_ptr(owner);
8635         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
8636         *ret_copy = CResult_QueryChannelRangeDecodeErrorZ_get_err(owner_conv);
8637         uint64_t ret_ref = tag_ptr(ret_copy, true);
8638         return ret_ref;
8639 }
8640
8641 static inline struct LDKReplyChannelRange CResult_ReplyChannelRangeDecodeErrorZ_get_ok(LDKCResult_ReplyChannelRangeDecodeErrorZ *NONNULL_PTR owner){
8642         LDKReplyChannelRange ret = *owner->contents.result;
8643         ret.is_owned = false;
8644         return ret;
8645 }
8646 uint64_t  __attribute__((export_name("TS_CResult_ReplyChannelRangeDecodeErrorZ_get_ok"))) TS_CResult_ReplyChannelRangeDecodeErrorZ_get_ok(uint64_t owner) {
8647         LDKCResult_ReplyChannelRangeDecodeErrorZ* owner_conv = (LDKCResult_ReplyChannelRangeDecodeErrorZ*)untag_ptr(owner);
8648         LDKReplyChannelRange ret_var = CResult_ReplyChannelRangeDecodeErrorZ_get_ok(owner_conv);
8649         uint64_t ret_ref = 0;
8650         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
8651         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
8652         return ret_ref;
8653 }
8654
8655 static inline struct LDKDecodeError CResult_ReplyChannelRangeDecodeErrorZ_get_err(LDKCResult_ReplyChannelRangeDecodeErrorZ *NONNULL_PTR owner){
8656 CHECK(!owner->result_ok);
8657         return DecodeError_clone(&*owner->contents.err);
8658 }
8659 uint64_t  __attribute__((export_name("TS_CResult_ReplyChannelRangeDecodeErrorZ_get_err"))) TS_CResult_ReplyChannelRangeDecodeErrorZ_get_err(uint64_t owner) {
8660         LDKCResult_ReplyChannelRangeDecodeErrorZ* owner_conv = (LDKCResult_ReplyChannelRangeDecodeErrorZ*)untag_ptr(owner);
8661         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
8662         *ret_copy = CResult_ReplyChannelRangeDecodeErrorZ_get_err(owner_conv);
8663         uint64_t ret_ref = tag_ptr(ret_copy, true);
8664         return ret_ref;
8665 }
8666
8667 static inline struct LDKGossipTimestampFilter CResult_GossipTimestampFilterDecodeErrorZ_get_ok(LDKCResult_GossipTimestampFilterDecodeErrorZ *NONNULL_PTR owner){
8668         LDKGossipTimestampFilter ret = *owner->contents.result;
8669         ret.is_owned = false;
8670         return ret;
8671 }
8672 uint64_t  __attribute__((export_name("TS_CResult_GossipTimestampFilterDecodeErrorZ_get_ok"))) TS_CResult_GossipTimestampFilterDecodeErrorZ_get_ok(uint64_t owner) {
8673         LDKCResult_GossipTimestampFilterDecodeErrorZ* owner_conv = (LDKCResult_GossipTimestampFilterDecodeErrorZ*)untag_ptr(owner);
8674         LDKGossipTimestampFilter ret_var = CResult_GossipTimestampFilterDecodeErrorZ_get_ok(owner_conv);
8675         uint64_t ret_ref = 0;
8676         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
8677         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
8678         return ret_ref;
8679 }
8680
8681 static inline struct LDKDecodeError CResult_GossipTimestampFilterDecodeErrorZ_get_err(LDKCResult_GossipTimestampFilterDecodeErrorZ *NONNULL_PTR owner){
8682 CHECK(!owner->result_ok);
8683         return DecodeError_clone(&*owner->contents.err);
8684 }
8685 uint64_t  __attribute__((export_name("TS_CResult_GossipTimestampFilterDecodeErrorZ_get_err"))) TS_CResult_GossipTimestampFilterDecodeErrorZ_get_err(uint64_t owner) {
8686         LDKCResult_GossipTimestampFilterDecodeErrorZ* owner_conv = (LDKCResult_GossipTimestampFilterDecodeErrorZ*)untag_ptr(owner);
8687         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
8688         *ret_copy = CResult_GossipTimestampFilterDecodeErrorZ_get_err(owner_conv);
8689         uint64_t ret_ref = tag_ptr(ret_copy, true);
8690         return ret_ref;
8691 }
8692
8693 static inline LDKCVec_PhantomRouteHintsZ CVec_PhantomRouteHintsZ_clone(const LDKCVec_PhantomRouteHintsZ *orig) {
8694         LDKCVec_PhantomRouteHintsZ ret = { .data = MALLOC(sizeof(LDKPhantomRouteHints) * orig->datalen, "LDKCVec_PhantomRouteHintsZ clone bytes"), .datalen = orig->datalen };
8695         for (size_t i = 0; i < ret.datalen; i++) {
8696                 ret.data[i] = PhantomRouteHints_clone(&orig->data[i]);
8697         }
8698         return ret;
8699 }
8700 uint32_t __attribute__((export_name("TS_LDKSignOrCreationError_ty_from_ptr"))) TS_LDKSignOrCreationError_ty_from_ptr(uint64_t ptr) {
8701         LDKSignOrCreationError *obj = (LDKSignOrCreationError*)untag_ptr(ptr);
8702         switch(obj->tag) {
8703                 case LDKSignOrCreationError_SignError: return 0;
8704                 case LDKSignOrCreationError_CreationError: return 1;
8705                 default: abort();
8706         }
8707 }
8708 uint32_t __attribute__((export_name("TS_LDKSignOrCreationError_CreationError_get_creation_error"))) TS_LDKSignOrCreationError_CreationError_get_creation_error(uint64_t ptr) {
8709         LDKSignOrCreationError *obj = (LDKSignOrCreationError*)untag_ptr(ptr);
8710         assert(obj->tag == LDKSignOrCreationError_CreationError);
8711         uint32_t creation_error_conv = LDKCreationError_to_js(obj->creation_error);
8712         return creation_error_conv;
8713 }
8714 static inline struct LDKBolt11Invoice CResult_Bolt11InvoiceSignOrCreationErrorZ_get_ok(LDKCResult_Bolt11InvoiceSignOrCreationErrorZ *NONNULL_PTR owner){
8715         LDKBolt11Invoice ret = *owner->contents.result;
8716         ret.is_owned = false;
8717         return ret;
8718 }
8719 uint64_t  __attribute__((export_name("TS_CResult_Bolt11InvoiceSignOrCreationErrorZ_get_ok"))) TS_CResult_Bolt11InvoiceSignOrCreationErrorZ_get_ok(uint64_t owner) {
8720         LDKCResult_Bolt11InvoiceSignOrCreationErrorZ* owner_conv = (LDKCResult_Bolt11InvoiceSignOrCreationErrorZ*)untag_ptr(owner);
8721         LDKBolt11Invoice ret_var = CResult_Bolt11InvoiceSignOrCreationErrorZ_get_ok(owner_conv);
8722         uint64_t ret_ref = 0;
8723         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
8724         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
8725         return ret_ref;
8726 }
8727
8728 static inline struct LDKSignOrCreationError CResult_Bolt11InvoiceSignOrCreationErrorZ_get_err(LDKCResult_Bolt11InvoiceSignOrCreationErrorZ *NONNULL_PTR owner){
8729 CHECK(!owner->result_ok);
8730         return SignOrCreationError_clone(&*owner->contents.err);
8731 }
8732 uint64_t  __attribute__((export_name("TS_CResult_Bolt11InvoiceSignOrCreationErrorZ_get_err"))) TS_CResult_Bolt11InvoiceSignOrCreationErrorZ_get_err(uint64_t owner) {
8733         LDKCResult_Bolt11InvoiceSignOrCreationErrorZ* owner_conv = (LDKCResult_Bolt11InvoiceSignOrCreationErrorZ*)untag_ptr(owner);
8734         LDKSignOrCreationError *ret_copy = MALLOC(sizeof(LDKSignOrCreationError), "LDKSignOrCreationError");
8735         *ret_copy = CResult_Bolt11InvoiceSignOrCreationErrorZ_get_err(owner_conv);
8736         uint64_t ret_ref = tag_ptr(ret_copy, true);
8737         return ret_ref;
8738 }
8739
8740 static inline struct LDKOffersMessage CResult_OffersMessageDecodeErrorZ_get_ok(LDKCResult_OffersMessageDecodeErrorZ *NONNULL_PTR owner){
8741 CHECK(owner->result_ok);
8742         return OffersMessage_clone(&*owner->contents.result);
8743 }
8744 uint64_t  __attribute__((export_name("TS_CResult_OffersMessageDecodeErrorZ_get_ok"))) TS_CResult_OffersMessageDecodeErrorZ_get_ok(uint64_t owner) {
8745         LDKCResult_OffersMessageDecodeErrorZ* owner_conv = (LDKCResult_OffersMessageDecodeErrorZ*)untag_ptr(owner);
8746         LDKOffersMessage *ret_copy = MALLOC(sizeof(LDKOffersMessage), "LDKOffersMessage");
8747         *ret_copy = CResult_OffersMessageDecodeErrorZ_get_ok(owner_conv);
8748         uint64_t ret_ref = tag_ptr(ret_copy, true);
8749         return ret_ref;
8750 }
8751
8752 static inline struct LDKDecodeError CResult_OffersMessageDecodeErrorZ_get_err(LDKCResult_OffersMessageDecodeErrorZ *NONNULL_PTR owner){
8753 CHECK(!owner->result_ok);
8754         return DecodeError_clone(&*owner->contents.err);
8755 }
8756 uint64_t  __attribute__((export_name("TS_CResult_OffersMessageDecodeErrorZ_get_err"))) TS_CResult_OffersMessageDecodeErrorZ_get_err(uint64_t owner) {
8757         LDKCResult_OffersMessageDecodeErrorZ* owner_conv = (LDKCResult_OffersMessageDecodeErrorZ*)untag_ptr(owner);
8758         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
8759         *ret_copy = CResult_OffersMessageDecodeErrorZ_get_err(owner_conv);
8760         uint64_t ret_ref = tag_ptr(ret_copy, true);
8761         return ret_ref;
8762 }
8763
8764 uint32_t __attribute__((export_name("TS_LDKCOption_HTLCClaimZ_ty_from_ptr"))) TS_LDKCOption_HTLCClaimZ_ty_from_ptr(uint64_t ptr) {
8765         LDKCOption_HTLCClaimZ *obj = (LDKCOption_HTLCClaimZ*)untag_ptr(ptr);
8766         switch(obj->tag) {
8767                 case LDKCOption_HTLCClaimZ_Some: return 0;
8768                 case LDKCOption_HTLCClaimZ_None: return 1;
8769                 default: abort();
8770         }
8771 }
8772 uint32_t __attribute__((export_name("TS_LDKCOption_HTLCClaimZ_Some_get_some"))) TS_LDKCOption_HTLCClaimZ_Some_get_some(uint64_t ptr) {
8773         LDKCOption_HTLCClaimZ *obj = (LDKCOption_HTLCClaimZ*)untag_ptr(ptr);
8774         assert(obj->tag == LDKCOption_HTLCClaimZ_Some);
8775         uint32_t some_conv = LDKHTLCClaim_to_js(obj->some);
8776         return some_conv;
8777 }
8778 static inline struct LDKCounterpartyCommitmentSecrets CResult_CounterpartyCommitmentSecretsDecodeErrorZ_get_ok(LDKCResult_CounterpartyCommitmentSecretsDecodeErrorZ *NONNULL_PTR owner){
8779         LDKCounterpartyCommitmentSecrets ret = *owner->contents.result;
8780         ret.is_owned = false;
8781         return ret;
8782 }
8783 uint64_t  __attribute__((export_name("TS_CResult_CounterpartyCommitmentSecretsDecodeErrorZ_get_ok"))) TS_CResult_CounterpartyCommitmentSecretsDecodeErrorZ_get_ok(uint64_t owner) {
8784         LDKCResult_CounterpartyCommitmentSecretsDecodeErrorZ* owner_conv = (LDKCResult_CounterpartyCommitmentSecretsDecodeErrorZ*)untag_ptr(owner);
8785         LDKCounterpartyCommitmentSecrets ret_var = CResult_CounterpartyCommitmentSecretsDecodeErrorZ_get_ok(owner_conv);
8786         uint64_t ret_ref = 0;
8787         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
8788         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
8789         return ret_ref;
8790 }
8791
8792 static inline struct LDKDecodeError CResult_CounterpartyCommitmentSecretsDecodeErrorZ_get_err(LDKCResult_CounterpartyCommitmentSecretsDecodeErrorZ *NONNULL_PTR owner){
8793 CHECK(!owner->result_ok);
8794         return DecodeError_clone(&*owner->contents.err);
8795 }
8796 uint64_t  __attribute__((export_name("TS_CResult_CounterpartyCommitmentSecretsDecodeErrorZ_get_err"))) TS_CResult_CounterpartyCommitmentSecretsDecodeErrorZ_get_err(uint64_t owner) {
8797         LDKCResult_CounterpartyCommitmentSecretsDecodeErrorZ* owner_conv = (LDKCResult_CounterpartyCommitmentSecretsDecodeErrorZ*)untag_ptr(owner);
8798         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
8799         *ret_copy = CResult_CounterpartyCommitmentSecretsDecodeErrorZ_get_err(owner_conv);
8800         uint64_t ret_ref = tag_ptr(ret_copy, true);
8801         return ret_ref;
8802 }
8803
8804 static inline struct LDKTxCreationKeys CResult_TxCreationKeysDecodeErrorZ_get_ok(LDKCResult_TxCreationKeysDecodeErrorZ *NONNULL_PTR owner){
8805         LDKTxCreationKeys ret = *owner->contents.result;
8806         ret.is_owned = false;
8807         return ret;
8808 }
8809 uint64_t  __attribute__((export_name("TS_CResult_TxCreationKeysDecodeErrorZ_get_ok"))) TS_CResult_TxCreationKeysDecodeErrorZ_get_ok(uint64_t owner) {
8810         LDKCResult_TxCreationKeysDecodeErrorZ* owner_conv = (LDKCResult_TxCreationKeysDecodeErrorZ*)untag_ptr(owner);
8811         LDKTxCreationKeys ret_var = CResult_TxCreationKeysDecodeErrorZ_get_ok(owner_conv);
8812         uint64_t ret_ref = 0;
8813         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
8814         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
8815         return ret_ref;
8816 }
8817
8818 static inline struct LDKDecodeError CResult_TxCreationKeysDecodeErrorZ_get_err(LDKCResult_TxCreationKeysDecodeErrorZ *NONNULL_PTR owner){
8819 CHECK(!owner->result_ok);
8820         return DecodeError_clone(&*owner->contents.err);
8821 }
8822 uint64_t  __attribute__((export_name("TS_CResult_TxCreationKeysDecodeErrorZ_get_err"))) TS_CResult_TxCreationKeysDecodeErrorZ_get_err(uint64_t owner) {
8823         LDKCResult_TxCreationKeysDecodeErrorZ* owner_conv = (LDKCResult_TxCreationKeysDecodeErrorZ*)untag_ptr(owner);
8824         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
8825         *ret_copy = CResult_TxCreationKeysDecodeErrorZ_get_err(owner_conv);
8826         uint64_t ret_ref = tag_ptr(ret_copy, true);
8827         return ret_ref;
8828 }
8829
8830 static inline struct LDKChannelPublicKeys CResult_ChannelPublicKeysDecodeErrorZ_get_ok(LDKCResult_ChannelPublicKeysDecodeErrorZ *NONNULL_PTR owner){
8831         LDKChannelPublicKeys ret = *owner->contents.result;
8832         ret.is_owned = false;
8833         return ret;
8834 }
8835 uint64_t  __attribute__((export_name("TS_CResult_ChannelPublicKeysDecodeErrorZ_get_ok"))) TS_CResult_ChannelPublicKeysDecodeErrorZ_get_ok(uint64_t owner) {
8836         LDKCResult_ChannelPublicKeysDecodeErrorZ* owner_conv = (LDKCResult_ChannelPublicKeysDecodeErrorZ*)untag_ptr(owner);
8837         LDKChannelPublicKeys ret_var = CResult_ChannelPublicKeysDecodeErrorZ_get_ok(owner_conv);
8838         uint64_t ret_ref = 0;
8839         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
8840         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
8841         return ret_ref;
8842 }
8843
8844 static inline struct LDKDecodeError CResult_ChannelPublicKeysDecodeErrorZ_get_err(LDKCResult_ChannelPublicKeysDecodeErrorZ *NONNULL_PTR owner){
8845 CHECK(!owner->result_ok);
8846         return DecodeError_clone(&*owner->contents.err);
8847 }
8848 uint64_t  __attribute__((export_name("TS_CResult_ChannelPublicKeysDecodeErrorZ_get_err"))) TS_CResult_ChannelPublicKeysDecodeErrorZ_get_err(uint64_t owner) {
8849         LDKCResult_ChannelPublicKeysDecodeErrorZ* owner_conv = (LDKCResult_ChannelPublicKeysDecodeErrorZ*)untag_ptr(owner);
8850         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
8851         *ret_copy = CResult_ChannelPublicKeysDecodeErrorZ_get_err(owner_conv);
8852         uint64_t ret_ref = tag_ptr(ret_copy, true);
8853         return ret_ref;
8854 }
8855
8856 static inline struct LDKHTLCOutputInCommitment CResult_HTLCOutputInCommitmentDecodeErrorZ_get_ok(LDKCResult_HTLCOutputInCommitmentDecodeErrorZ *NONNULL_PTR owner){
8857         LDKHTLCOutputInCommitment ret = *owner->contents.result;
8858         ret.is_owned = false;
8859         return ret;
8860 }
8861 uint64_t  __attribute__((export_name("TS_CResult_HTLCOutputInCommitmentDecodeErrorZ_get_ok"))) TS_CResult_HTLCOutputInCommitmentDecodeErrorZ_get_ok(uint64_t owner) {
8862         LDKCResult_HTLCOutputInCommitmentDecodeErrorZ* owner_conv = (LDKCResult_HTLCOutputInCommitmentDecodeErrorZ*)untag_ptr(owner);
8863         LDKHTLCOutputInCommitment ret_var = CResult_HTLCOutputInCommitmentDecodeErrorZ_get_ok(owner_conv);
8864         uint64_t ret_ref = 0;
8865         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
8866         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
8867         return ret_ref;
8868 }
8869
8870 static inline struct LDKDecodeError CResult_HTLCOutputInCommitmentDecodeErrorZ_get_err(LDKCResult_HTLCOutputInCommitmentDecodeErrorZ *NONNULL_PTR owner){
8871 CHECK(!owner->result_ok);
8872         return DecodeError_clone(&*owner->contents.err);
8873 }
8874 uint64_t  __attribute__((export_name("TS_CResult_HTLCOutputInCommitmentDecodeErrorZ_get_err"))) TS_CResult_HTLCOutputInCommitmentDecodeErrorZ_get_err(uint64_t owner) {
8875         LDKCResult_HTLCOutputInCommitmentDecodeErrorZ* owner_conv = (LDKCResult_HTLCOutputInCommitmentDecodeErrorZ*)untag_ptr(owner);
8876         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
8877         *ret_copy = CResult_HTLCOutputInCommitmentDecodeErrorZ_get_err(owner_conv);
8878         uint64_t ret_ref = tag_ptr(ret_copy, true);
8879         return ret_ref;
8880 }
8881
8882 static inline struct LDKCounterpartyChannelTransactionParameters CResult_CounterpartyChannelTransactionParametersDecodeErrorZ_get_ok(LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ *NONNULL_PTR owner){
8883         LDKCounterpartyChannelTransactionParameters ret = *owner->contents.result;
8884         ret.is_owned = false;
8885         return ret;
8886 }
8887 uint64_t  __attribute__((export_name("TS_CResult_CounterpartyChannelTransactionParametersDecodeErrorZ_get_ok"))) TS_CResult_CounterpartyChannelTransactionParametersDecodeErrorZ_get_ok(uint64_t owner) {
8888         LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ* owner_conv = (LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ*)untag_ptr(owner);
8889         LDKCounterpartyChannelTransactionParameters ret_var = CResult_CounterpartyChannelTransactionParametersDecodeErrorZ_get_ok(owner_conv);
8890         uint64_t ret_ref = 0;
8891         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
8892         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
8893         return ret_ref;
8894 }
8895
8896 static inline struct LDKDecodeError CResult_CounterpartyChannelTransactionParametersDecodeErrorZ_get_err(LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ *NONNULL_PTR owner){
8897 CHECK(!owner->result_ok);
8898         return DecodeError_clone(&*owner->contents.err);
8899 }
8900 uint64_t  __attribute__((export_name("TS_CResult_CounterpartyChannelTransactionParametersDecodeErrorZ_get_err"))) TS_CResult_CounterpartyChannelTransactionParametersDecodeErrorZ_get_err(uint64_t owner) {
8901         LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ* owner_conv = (LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ*)untag_ptr(owner);
8902         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
8903         *ret_copy = CResult_CounterpartyChannelTransactionParametersDecodeErrorZ_get_err(owner_conv);
8904         uint64_t ret_ref = tag_ptr(ret_copy, true);
8905         return ret_ref;
8906 }
8907
8908 static inline struct LDKChannelTransactionParameters CResult_ChannelTransactionParametersDecodeErrorZ_get_ok(LDKCResult_ChannelTransactionParametersDecodeErrorZ *NONNULL_PTR owner){
8909         LDKChannelTransactionParameters ret = *owner->contents.result;
8910         ret.is_owned = false;
8911         return ret;
8912 }
8913 uint64_t  __attribute__((export_name("TS_CResult_ChannelTransactionParametersDecodeErrorZ_get_ok"))) TS_CResult_ChannelTransactionParametersDecodeErrorZ_get_ok(uint64_t owner) {
8914         LDKCResult_ChannelTransactionParametersDecodeErrorZ* owner_conv = (LDKCResult_ChannelTransactionParametersDecodeErrorZ*)untag_ptr(owner);
8915         LDKChannelTransactionParameters ret_var = CResult_ChannelTransactionParametersDecodeErrorZ_get_ok(owner_conv);
8916         uint64_t ret_ref = 0;
8917         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
8918         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
8919         return ret_ref;
8920 }
8921
8922 static inline struct LDKDecodeError CResult_ChannelTransactionParametersDecodeErrorZ_get_err(LDKCResult_ChannelTransactionParametersDecodeErrorZ *NONNULL_PTR owner){
8923 CHECK(!owner->result_ok);
8924         return DecodeError_clone(&*owner->contents.err);
8925 }
8926 uint64_t  __attribute__((export_name("TS_CResult_ChannelTransactionParametersDecodeErrorZ_get_err"))) TS_CResult_ChannelTransactionParametersDecodeErrorZ_get_err(uint64_t owner) {
8927         LDKCResult_ChannelTransactionParametersDecodeErrorZ* owner_conv = (LDKCResult_ChannelTransactionParametersDecodeErrorZ*)untag_ptr(owner);
8928         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
8929         *ret_copy = CResult_ChannelTransactionParametersDecodeErrorZ_get_err(owner_conv);
8930         uint64_t ret_ref = tag_ptr(ret_copy, true);
8931         return ret_ref;
8932 }
8933
8934 static inline struct LDKHolderCommitmentTransaction CResult_HolderCommitmentTransactionDecodeErrorZ_get_ok(LDKCResult_HolderCommitmentTransactionDecodeErrorZ *NONNULL_PTR owner){
8935         LDKHolderCommitmentTransaction ret = *owner->contents.result;
8936         ret.is_owned = false;
8937         return ret;
8938 }
8939 uint64_t  __attribute__((export_name("TS_CResult_HolderCommitmentTransactionDecodeErrorZ_get_ok"))) TS_CResult_HolderCommitmentTransactionDecodeErrorZ_get_ok(uint64_t owner) {
8940         LDKCResult_HolderCommitmentTransactionDecodeErrorZ* owner_conv = (LDKCResult_HolderCommitmentTransactionDecodeErrorZ*)untag_ptr(owner);
8941         LDKHolderCommitmentTransaction ret_var = CResult_HolderCommitmentTransactionDecodeErrorZ_get_ok(owner_conv);
8942         uint64_t ret_ref = 0;
8943         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
8944         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
8945         return ret_ref;
8946 }
8947
8948 static inline struct LDKDecodeError CResult_HolderCommitmentTransactionDecodeErrorZ_get_err(LDKCResult_HolderCommitmentTransactionDecodeErrorZ *NONNULL_PTR owner){
8949 CHECK(!owner->result_ok);
8950         return DecodeError_clone(&*owner->contents.err);
8951 }
8952 uint64_t  __attribute__((export_name("TS_CResult_HolderCommitmentTransactionDecodeErrorZ_get_err"))) TS_CResult_HolderCommitmentTransactionDecodeErrorZ_get_err(uint64_t owner) {
8953         LDKCResult_HolderCommitmentTransactionDecodeErrorZ* owner_conv = (LDKCResult_HolderCommitmentTransactionDecodeErrorZ*)untag_ptr(owner);
8954         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
8955         *ret_copy = CResult_HolderCommitmentTransactionDecodeErrorZ_get_err(owner_conv);
8956         uint64_t ret_ref = tag_ptr(ret_copy, true);
8957         return ret_ref;
8958 }
8959
8960 static inline struct LDKBuiltCommitmentTransaction CResult_BuiltCommitmentTransactionDecodeErrorZ_get_ok(LDKCResult_BuiltCommitmentTransactionDecodeErrorZ *NONNULL_PTR owner){
8961         LDKBuiltCommitmentTransaction ret = *owner->contents.result;
8962         ret.is_owned = false;
8963         return ret;
8964 }
8965 uint64_t  __attribute__((export_name("TS_CResult_BuiltCommitmentTransactionDecodeErrorZ_get_ok"))) TS_CResult_BuiltCommitmentTransactionDecodeErrorZ_get_ok(uint64_t owner) {
8966         LDKCResult_BuiltCommitmentTransactionDecodeErrorZ* owner_conv = (LDKCResult_BuiltCommitmentTransactionDecodeErrorZ*)untag_ptr(owner);
8967         LDKBuiltCommitmentTransaction ret_var = CResult_BuiltCommitmentTransactionDecodeErrorZ_get_ok(owner_conv);
8968         uint64_t ret_ref = 0;
8969         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
8970         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
8971         return ret_ref;
8972 }
8973
8974 static inline struct LDKDecodeError CResult_BuiltCommitmentTransactionDecodeErrorZ_get_err(LDKCResult_BuiltCommitmentTransactionDecodeErrorZ *NONNULL_PTR owner){
8975 CHECK(!owner->result_ok);
8976         return DecodeError_clone(&*owner->contents.err);
8977 }
8978 uint64_t  __attribute__((export_name("TS_CResult_BuiltCommitmentTransactionDecodeErrorZ_get_err"))) TS_CResult_BuiltCommitmentTransactionDecodeErrorZ_get_err(uint64_t owner) {
8979         LDKCResult_BuiltCommitmentTransactionDecodeErrorZ* owner_conv = (LDKCResult_BuiltCommitmentTransactionDecodeErrorZ*)untag_ptr(owner);
8980         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
8981         *ret_copy = CResult_BuiltCommitmentTransactionDecodeErrorZ_get_err(owner_conv);
8982         uint64_t ret_ref = tag_ptr(ret_copy, true);
8983         return ret_ref;
8984 }
8985
8986 static inline struct LDKTrustedClosingTransaction CResult_TrustedClosingTransactionNoneZ_get_ok(LDKCResult_TrustedClosingTransactionNoneZ *NONNULL_PTR owner){
8987         LDKTrustedClosingTransaction ret = *owner->contents.result;
8988         ret.is_owned = false;
8989         return ret;
8990 }
8991 uint64_t  __attribute__((export_name("TS_CResult_TrustedClosingTransactionNoneZ_get_ok"))) TS_CResult_TrustedClosingTransactionNoneZ_get_ok(uint64_t owner) {
8992         LDKCResult_TrustedClosingTransactionNoneZ* owner_conv = (LDKCResult_TrustedClosingTransactionNoneZ*)untag_ptr(owner);
8993         LDKTrustedClosingTransaction ret_var = CResult_TrustedClosingTransactionNoneZ_get_ok(owner_conv);
8994         uint64_t ret_ref = 0;
8995         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
8996         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
8997         return ret_ref;
8998 }
8999
9000 static inline void CResult_TrustedClosingTransactionNoneZ_get_err(LDKCResult_TrustedClosingTransactionNoneZ *NONNULL_PTR owner){
9001 CHECK(!owner->result_ok);
9002         return *owner->contents.err;
9003 }
9004 void  __attribute__((export_name("TS_CResult_TrustedClosingTransactionNoneZ_get_err"))) TS_CResult_TrustedClosingTransactionNoneZ_get_err(uint64_t owner) {
9005         LDKCResult_TrustedClosingTransactionNoneZ* owner_conv = (LDKCResult_TrustedClosingTransactionNoneZ*)untag_ptr(owner);
9006         CResult_TrustedClosingTransactionNoneZ_get_err(owner_conv);
9007 }
9008
9009 static inline struct LDKCommitmentTransaction CResult_CommitmentTransactionDecodeErrorZ_get_ok(LDKCResult_CommitmentTransactionDecodeErrorZ *NONNULL_PTR owner){
9010         LDKCommitmentTransaction ret = *owner->contents.result;
9011         ret.is_owned = false;
9012         return ret;
9013 }
9014 uint64_t  __attribute__((export_name("TS_CResult_CommitmentTransactionDecodeErrorZ_get_ok"))) TS_CResult_CommitmentTransactionDecodeErrorZ_get_ok(uint64_t owner) {
9015         LDKCResult_CommitmentTransactionDecodeErrorZ* owner_conv = (LDKCResult_CommitmentTransactionDecodeErrorZ*)untag_ptr(owner);
9016         LDKCommitmentTransaction ret_var = CResult_CommitmentTransactionDecodeErrorZ_get_ok(owner_conv);
9017         uint64_t ret_ref = 0;
9018         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
9019         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
9020         return ret_ref;
9021 }
9022
9023 static inline struct LDKDecodeError CResult_CommitmentTransactionDecodeErrorZ_get_err(LDKCResult_CommitmentTransactionDecodeErrorZ *NONNULL_PTR owner){
9024 CHECK(!owner->result_ok);
9025         return DecodeError_clone(&*owner->contents.err);
9026 }
9027 uint64_t  __attribute__((export_name("TS_CResult_CommitmentTransactionDecodeErrorZ_get_err"))) TS_CResult_CommitmentTransactionDecodeErrorZ_get_err(uint64_t owner) {
9028         LDKCResult_CommitmentTransactionDecodeErrorZ* owner_conv = (LDKCResult_CommitmentTransactionDecodeErrorZ*)untag_ptr(owner);
9029         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
9030         *ret_copy = CResult_CommitmentTransactionDecodeErrorZ_get_err(owner_conv);
9031         uint64_t ret_ref = tag_ptr(ret_copy, true);
9032         return ret_ref;
9033 }
9034
9035 static inline struct LDKTrustedCommitmentTransaction CResult_TrustedCommitmentTransactionNoneZ_get_ok(LDKCResult_TrustedCommitmentTransactionNoneZ *NONNULL_PTR owner){
9036         LDKTrustedCommitmentTransaction ret = *owner->contents.result;
9037         ret.is_owned = false;
9038         return ret;
9039 }
9040 uint64_t  __attribute__((export_name("TS_CResult_TrustedCommitmentTransactionNoneZ_get_ok"))) TS_CResult_TrustedCommitmentTransactionNoneZ_get_ok(uint64_t owner) {
9041         LDKCResult_TrustedCommitmentTransactionNoneZ* owner_conv = (LDKCResult_TrustedCommitmentTransactionNoneZ*)untag_ptr(owner);
9042         LDKTrustedCommitmentTransaction ret_var = CResult_TrustedCommitmentTransactionNoneZ_get_ok(owner_conv);
9043         uint64_t ret_ref = 0;
9044         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
9045         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
9046         return ret_ref;
9047 }
9048
9049 static inline void CResult_TrustedCommitmentTransactionNoneZ_get_err(LDKCResult_TrustedCommitmentTransactionNoneZ *NONNULL_PTR owner){
9050 CHECK(!owner->result_ok);
9051         return *owner->contents.err;
9052 }
9053 void  __attribute__((export_name("TS_CResult_TrustedCommitmentTransactionNoneZ_get_err"))) TS_CResult_TrustedCommitmentTransactionNoneZ_get_err(uint64_t owner) {
9054         LDKCResult_TrustedCommitmentTransactionNoneZ* owner_conv = (LDKCResult_TrustedCommitmentTransactionNoneZ*)untag_ptr(owner);
9055         CResult_TrustedCommitmentTransactionNoneZ_get_err(owner_conv);
9056 }
9057
9058 static inline struct LDKCVec_ECDSASignatureZ CResult_CVec_ECDSASignatureZNoneZ_get_ok(LDKCResult_CVec_ECDSASignatureZNoneZ *NONNULL_PTR owner){
9059 CHECK(owner->result_ok);
9060         return *owner->contents.result;
9061 }
9062 ptrArray  __attribute__((export_name("TS_CResult_CVec_ECDSASignatureZNoneZ_get_ok"))) TS_CResult_CVec_ECDSASignatureZNoneZ_get_ok(uint64_t owner) {
9063         LDKCResult_CVec_ECDSASignatureZNoneZ* owner_conv = (LDKCResult_CVec_ECDSASignatureZNoneZ*)untag_ptr(owner);
9064         LDKCVec_ECDSASignatureZ ret_var = CResult_CVec_ECDSASignatureZNoneZ_get_ok(owner_conv);
9065         ptrArray ret_arr = NULL;
9066         ret_arr = init_ptrArray(ret_var.datalen, __LINE__);
9067         int8_tArray *ret_arr_ptr = (int8_tArray*)(((uint8_t*)ret_arr) + 8);
9068         for (size_t m = 0; m < ret_var.datalen; m++) {
9069                 int8_tArray ret_conv_12_arr = init_int8_tArray(64, __LINE__);
9070                 memcpy(ret_conv_12_arr->elems, ret_var.data[m].compact_form, 64);
9071                 ret_arr_ptr[m] = ret_conv_12_arr;
9072         }
9073         
9074         return ret_arr;
9075 }
9076
9077 static inline void CResult_CVec_ECDSASignatureZNoneZ_get_err(LDKCResult_CVec_ECDSASignatureZNoneZ *NONNULL_PTR owner){
9078 CHECK(!owner->result_ok);
9079         return *owner->contents.err;
9080 }
9081 void  __attribute__((export_name("TS_CResult_CVec_ECDSASignatureZNoneZ_get_err"))) TS_CResult_CVec_ECDSASignatureZNoneZ_get_err(uint64_t owner) {
9082         LDKCResult_CVec_ECDSASignatureZNoneZ* owner_conv = (LDKCResult_CVec_ECDSASignatureZNoneZ*)untag_ptr(owner);
9083         CResult_CVec_ECDSASignatureZNoneZ_get_err(owner_conv);
9084 }
9085
9086 uint32_t __attribute__((export_name("TS_LDKCOption_usizeZ_ty_from_ptr"))) TS_LDKCOption_usizeZ_ty_from_ptr(uint64_t ptr) {
9087         LDKCOption_usizeZ *obj = (LDKCOption_usizeZ*)untag_ptr(ptr);
9088         switch(obj->tag) {
9089                 case LDKCOption_usizeZ_Some: return 0;
9090                 case LDKCOption_usizeZ_None: return 1;
9091                 default: abort();
9092         }
9093 }
9094 uint32_t __attribute__((export_name("TS_LDKCOption_usizeZ_Some_get_some"))) TS_LDKCOption_usizeZ_Some_get_some(uint64_t ptr) {
9095         LDKCOption_usizeZ *obj = (LDKCOption_usizeZ*)untag_ptr(ptr);
9096         assert(obj->tag == LDKCOption_usizeZ_Some);
9097         uint32_t some_conv = obj->some;
9098         return some_conv;
9099 }
9100 static inline struct LDKShutdownScript CResult_ShutdownScriptDecodeErrorZ_get_ok(LDKCResult_ShutdownScriptDecodeErrorZ *NONNULL_PTR owner){
9101         LDKShutdownScript ret = *owner->contents.result;
9102         ret.is_owned = false;
9103         return ret;
9104 }
9105 uint64_t  __attribute__((export_name("TS_CResult_ShutdownScriptDecodeErrorZ_get_ok"))) TS_CResult_ShutdownScriptDecodeErrorZ_get_ok(uint64_t owner) {
9106         LDKCResult_ShutdownScriptDecodeErrorZ* owner_conv = (LDKCResult_ShutdownScriptDecodeErrorZ*)untag_ptr(owner);
9107         LDKShutdownScript ret_var = CResult_ShutdownScriptDecodeErrorZ_get_ok(owner_conv);
9108         uint64_t ret_ref = 0;
9109         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
9110         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
9111         return ret_ref;
9112 }
9113
9114 static inline struct LDKDecodeError CResult_ShutdownScriptDecodeErrorZ_get_err(LDKCResult_ShutdownScriptDecodeErrorZ *NONNULL_PTR owner){
9115 CHECK(!owner->result_ok);
9116         return DecodeError_clone(&*owner->contents.err);
9117 }
9118 uint64_t  __attribute__((export_name("TS_CResult_ShutdownScriptDecodeErrorZ_get_err"))) TS_CResult_ShutdownScriptDecodeErrorZ_get_err(uint64_t owner) {
9119         LDKCResult_ShutdownScriptDecodeErrorZ* owner_conv = (LDKCResult_ShutdownScriptDecodeErrorZ*)untag_ptr(owner);
9120         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
9121         *ret_copy = CResult_ShutdownScriptDecodeErrorZ_get_err(owner_conv);
9122         uint64_t ret_ref = tag_ptr(ret_copy, true);
9123         return ret_ref;
9124 }
9125
9126 static inline struct LDKShutdownScript CResult_ShutdownScriptInvalidShutdownScriptZ_get_ok(LDKCResult_ShutdownScriptInvalidShutdownScriptZ *NONNULL_PTR owner){
9127         LDKShutdownScript ret = *owner->contents.result;
9128         ret.is_owned = false;
9129         return ret;
9130 }
9131 uint64_t  __attribute__((export_name("TS_CResult_ShutdownScriptInvalidShutdownScriptZ_get_ok"))) TS_CResult_ShutdownScriptInvalidShutdownScriptZ_get_ok(uint64_t owner) {
9132         LDKCResult_ShutdownScriptInvalidShutdownScriptZ* owner_conv = (LDKCResult_ShutdownScriptInvalidShutdownScriptZ*)untag_ptr(owner);
9133         LDKShutdownScript ret_var = CResult_ShutdownScriptInvalidShutdownScriptZ_get_ok(owner_conv);
9134         uint64_t ret_ref = 0;
9135         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
9136         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
9137         return ret_ref;
9138 }
9139
9140 static inline struct LDKInvalidShutdownScript CResult_ShutdownScriptInvalidShutdownScriptZ_get_err(LDKCResult_ShutdownScriptInvalidShutdownScriptZ *NONNULL_PTR owner){
9141         LDKInvalidShutdownScript ret = *owner->contents.err;
9142         ret.is_owned = false;
9143         return ret;
9144 }
9145 uint64_t  __attribute__((export_name("TS_CResult_ShutdownScriptInvalidShutdownScriptZ_get_err"))) TS_CResult_ShutdownScriptInvalidShutdownScriptZ_get_err(uint64_t owner) {
9146         LDKCResult_ShutdownScriptInvalidShutdownScriptZ* owner_conv = (LDKCResult_ShutdownScriptInvalidShutdownScriptZ*)untag_ptr(owner);
9147         LDKInvalidShutdownScript ret_var = CResult_ShutdownScriptInvalidShutdownScriptZ_get_err(owner_conv);
9148         uint64_t ret_ref = 0;
9149         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
9150         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
9151         return ret_ref;
9152 }
9153
9154 uint32_t __attribute__((export_name("TS_LDKPaymentPurpose_ty_from_ptr"))) TS_LDKPaymentPurpose_ty_from_ptr(uint64_t ptr) {
9155         LDKPaymentPurpose *obj = (LDKPaymentPurpose*)untag_ptr(ptr);
9156         switch(obj->tag) {
9157                 case LDKPaymentPurpose_InvoicePayment: return 0;
9158                 case LDKPaymentPurpose_SpontaneousPayment: return 1;
9159                 default: abort();
9160         }
9161 }
9162 uint64_t __attribute__((export_name("TS_LDKPaymentPurpose_InvoicePayment_get_payment_preimage"))) TS_LDKPaymentPurpose_InvoicePayment_get_payment_preimage(uint64_t ptr) {
9163         LDKPaymentPurpose *obj = (LDKPaymentPurpose*)untag_ptr(ptr);
9164         assert(obj->tag == LDKPaymentPurpose_InvoicePayment);
9165         uint64_t payment_preimage_ref = tag_ptr(&obj->invoice_payment.payment_preimage, false);
9166         return payment_preimage_ref;
9167 }
9168 int8_tArray __attribute__((export_name("TS_LDKPaymentPurpose_InvoicePayment_get_payment_secret"))) TS_LDKPaymentPurpose_InvoicePayment_get_payment_secret(uint64_t ptr) {
9169         LDKPaymentPurpose *obj = (LDKPaymentPurpose*)untag_ptr(ptr);
9170         assert(obj->tag == LDKPaymentPurpose_InvoicePayment);
9171         int8_tArray payment_secret_arr = init_int8_tArray(32, __LINE__);
9172         memcpy(payment_secret_arr->elems, obj->invoice_payment.payment_secret.data, 32);
9173         return payment_secret_arr;
9174 }
9175 int8_tArray __attribute__((export_name("TS_LDKPaymentPurpose_SpontaneousPayment_get_spontaneous_payment"))) TS_LDKPaymentPurpose_SpontaneousPayment_get_spontaneous_payment(uint64_t ptr) {
9176         LDKPaymentPurpose *obj = (LDKPaymentPurpose*)untag_ptr(ptr);
9177         assert(obj->tag == LDKPaymentPurpose_SpontaneousPayment);
9178         int8_tArray spontaneous_payment_arr = init_int8_tArray(32, __LINE__);
9179         memcpy(spontaneous_payment_arr->elems, obj->spontaneous_payment.data, 32);
9180         return spontaneous_payment_arr;
9181 }
9182 static inline struct LDKPaymentPurpose CResult_PaymentPurposeDecodeErrorZ_get_ok(LDKCResult_PaymentPurposeDecodeErrorZ *NONNULL_PTR owner){
9183 CHECK(owner->result_ok);
9184         return PaymentPurpose_clone(&*owner->contents.result);
9185 }
9186 uint64_t  __attribute__((export_name("TS_CResult_PaymentPurposeDecodeErrorZ_get_ok"))) TS_CResult_PaymentPurposeDecodeErrorZ_get_ok(uint64_t owner) {
9187         LDKCResult_PaymentPurposeDecodeErrorZ* owner_conv = (LDKCResult_PaymentPurposeDecodeErrorZ*)untag_ptr(owner);
9188         LDKPaymentPurpose *ret_copy = MALLOC(sizeof(LDKPaymentPurpose), "LDKPaymentPurpose");
9189         *ret_copy = CResult_PaymentPurposeDecodeErrorZ_get_ok(owner_conv);
9190         uint64_t ret_ref = tag_ptr(ret_copy, true);
9191         return ret_ref;
9192 }
9193
9194 static inline struct LDKDecodeError CResult_PaymentPurposeDecodeErrorZ_get_err(LDKCResult_PaymentPurposeDecodeErrorZ *NONNULL_PTR owner){
9195 CHECK(!owner->result_ok);
9196         return DecodeError_clone(&*owner->contents.err);
9197 }
9198 uint64_t  __attribute__((export_name("TS_CResult_PaymentPurposeDecodeErrorZ_get_err"))) TS_CResult_PaymentPurposeDecodeErrorZ_get_err(uint64_t owner) {
9199         LDKCResult_PaymentPurposeDecodeErrorZ* owner_conv = (LDKCResult_PaymentPurposeDecodeErrorZ*)untag_ptr(owner);
9200         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
9201         *ret_copy = CResult_PaymentPurposeDecodeErrorZ_get_err(owner_conv);
9202         uint64_t ret_ref = tag_ptr(ret_copy, true);
9203         return ret_ref;
9204 }
9205
9206 static inline struct LDKClaimedHTLC CResult_ClaimedHTLCDecodeErrorZ_get_ok(LDKCResult_ClaimedHTLCDecodeErrorZ *NONNULL_PTR owner){
9207         LDKClaimedHTLC ret = *owner->contents.result;
9208         ret.is_owned = false;
9209         return ret;
9210 }
9211 uint64_t  __attribute__((export_name("TS_CResult_ClaimedHTLCDecodeErrorZ_get_ok"))) TS_CResult_ClaimedHTLCDecodeErrorZ_get_ok(uint64_t owner) {
9212         LDKCResult_ClaimedHTLCDecodeErrorZ* owner_conv = (LDKCResult_ClaimedHTLCDecodeErrorZ*)untag_ptr(owner);
9213         LDKClaimedHTLC ret_var = CResult_ClaimedHTLCDecodeErrorZ_get_ok(owner_conv);
9214         uint64_t ret_ref = 0;
9215         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
9216         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
9217         return ret_ref;
9218 }
9219
9220 static inline struct LDKDecodeError CResult_ClaimedHTLCDecodeErrorZ_get_err(LDKCResult_ClaimedHTLCDecodeErrorZ *NONNULL_PTR owner){
9221 CHECK(!owner->result_ok);
9222         return DecodeError_clone(&*owner->contents.err);
9223 }
9224 uint64_t  __attribute__((export_name("TS_CResult_ClaimedHTLCDecodeErrorZ_get_err"))) TS_CResult_ClaimedHTLCDecodeErrorZ_get_err(uint64_t owner) {
9225         LDKCResult_ClaimedHTLCDecodeErrorZ* owner_conv = (LDKCResult_ClaimedHTLCDecodeErrorZ*)untag_ptr(owner);
9226         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
9227         *ret_copy = CResult_ClaimedHTLCDecodeErrorZ_get_err(owner_conv);
9228         uint64_t ret_ref = tag_ptr(ret_copy, true);
9229         return ret_ref;
9230 }
9231
9232 uint32_t __attribute__((export_name("TS_LDKPathFailure_ty_from_ptr"))) TS_LDKPathFailure_ty_from_ptr(uint64_t ptr) {
9233         LDKPathFailure *obj = (LDKPathFailure*)untag_ptr(ptr);
9234         switch(obj->tag) {
9235                 case LDKPathFailure_InitialSend: return 0;
9236                 case LDKPathFailure_OnPath: return 1;
9237                 default: abort();
9238         }
9239 }
9240 uint64_t __attribute__((export_name("TS_LDKPathFailure_InitialSend_get_err"))) TS_LDKPathFailure_InitialSend_get_err(uint64_t ptr) {
9241         LDKPathFailure *obj = (LDKPathFailure*)untag_ptr(ptr);
9242         assert(obj->tag == LDKPathFailure_InitialSend);
9243         uint64_t err_ref = tag_ptr(&obj->initial_send.err, false);
9244         return err_ref;
9245 }
9246 uint64_t __attribute__((export_name("TS_LDKPathFailure_OnPath_get_network_update"))) TS_LDKPathFailure_OnPath_get_network_update(uint64_t ptr) {
9247         LDKPathFailure *obj = (LDKPathFailure*)untag_ptr(ptr);
9248         assert(obj->tag == LDKPathFailure_OnPath);
9249         uint64_t network_update_ref = tag_ptr(&obj->on_path.network_update, false);
9250         return network_update_ref;
9251 }
9252 uint32_t __attribute__((export_name("TS_LDKCOption_PathFailureZ_ty_from_ptr"))) TS_LDKCOption_PathFailureZ_ty_from_ptr(uint64_t ptr) {
9253         LDKCOption_PathFailureZ *obj = (LDKCOption_PathFailureZ*)untag_ptr(ptr);
9254         switch(obj->tag) {
9255                 case LDKCOption_PathFailureZ_Some: return 0;
9256                 case LDKCOption_PathFailureZ_None: return 1;
9257                 default: abort();
9258         }
9259 }
9260 uint64_t __attribute__((export_name("TS_LDKCOption_PathFailureZ_Some_get_some"))) TS_LDKCOption_PathFailureZ_Some_get_some(uint64_t ptr) {
9261         LDKCOption_PathFailureZ *obj = (LDKCOption_PathFailureZ*)untag_ptr(ptr);
9262         assert(obj->tag == LDKCOption_PathFailureZ_Some);
9263         uint64_t some_ref = tag_ptr(&obj->some, false);
9264         return some_ref;
9265 }
9266 static inline struct LDKCOption_PathFailureZ CResult_COption_PathFailureZDecodeErrorZ_get_ok(LDKCResult_COption_PathFailureZDecodeErrorZ *NONNULL_PTR owner){
9267 CHECK(owner->result_ok);
9268         return COption_PathFailureZ_clone(&*owner->contents.result);
9269 }
9270 uint64_t  __attribute__((export_name("TS_CResult_COption_PathFailureZDecodeErrorZ_get_ok"))) TS_CResult_COption_PathFailureZDecodeErrorZ_get_ok(uint64_t owner) {
9271         LDKCResult_COption_PathFailureZDecodeErrorZ* owner_conv = (LDKCResult_COption_PathFailureZDecodeErrorZ*)untag_ptr(owner);
9272         LDKCOption_PathFailureZ *ret_copy = MALLOC(sizeof(LDKCOption_PathFailureZ), "LDKCOption_PathFailureZ");
9273         *ret_copy = CResult_COption_PathFailureZDecodeErrorZ_get_ok(owner_conv);
9274         uint64_t ret_ref = tag_ptr(ret_copy, true);
9275         return ret_ref;
9276 }
9277
9278 static inline struct LDKDecodeError CResult_COption_PathFailureZDecodeErrorZ_get_err(LDKCResult_COption_PathFailureZDecodeErrorZ *NONNULL_PTR owner){
9279 CHECK(!owner->result_ok);
9280         return DecodeError_clone(&*owner->contents.err);
9281 }
9282 uint64_t  __attribute__((export_name("TS_CResult_COption_PathFailureZDecodeErrorZ_get_err"))) TS_CResult_COption_PathFailureZDecodeErrorZ_get_err(uint64_t owner) {
9283         LDKCResult_COption_PathFailureZDecodeErrorZ* owner_conv = (LDKCResult_COption_PathFailureZDecodeErrorZ*)untag_ptr(owner);
9284         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
9285         *ret_copy = CResult_COption_PathFailureZDecodeErrorZ_get_err(owner_conv);
9286         uint64_t ret_ref = tag_ptr(ret_copy, true);
9287         return ret_ref;
9288 }
9289
9290 uint32_t __attribute__((export_name("TS_LDKClosureReason_ty_from_ptr"))) TS_LDKClosureReason_ty_from_ptr(uint64_t ptr) {
9291         LDKClosureReason *obj = (LDKClosureReason*)untag_ptr(ptr);
9292         switch(obj->tag) {
9293                 case LDKClosureReason_CounterpartyForceClosed: return 0;
9294                 case LDKClosureReason_HolderForceClosed: return 1;
9295                 case LDKClosureReason_CooperativeClosure: return 2;
9296                 case LDKClosureReason_CommitmentTxConfirmed: return 3;
9297                 case LDKClosureReason_FundingTimedOut: return 4;
9298                 case LDKClosureReason_ProcessingError: return 5;
9299                 case LDKClosureReason_DisconnectedPeer: return 6;
9300                 case LDKClosureReason_OutdatedChannelManager: return 7;
9301                 case LDKClosureReason_CounterpartyCoopClosedUnfundedChannel: return 8;
9302                 case LDKClosureReason_FundingBatchClosure: return 9;
9303                 default: abort();
9304         }
9305 }
9306 uint64_t __attribute__((export_name("TS_LDKClosureReason_CounterpartyForceClosed_get_peer_msg"))) TS_LDKClosureReason_CounterpartyForceClosed_get_peer_msg(uint64_t ptr) {
9307         LDKClosureReason *obj = (LDKClosureReason*)untag_ptr(ptr);
9308         assert(obj->tag == LDKClosureReason_CounterpartyForceClosed);
9309         LDKUntrustedString peer_msg_var = obj->counterparty_force_closed.peer_msg;
9310                         uint64_t peer_msg_ref = 0;
9311                         CHECK_INNER_FIELD_ACCESS_OR_NULL(peer_msg_var);
9312                         peer_msg_ref = tag_ptr(peer_msg_var.inner, false);
9313         return peer_msg_ref;
9314 }
9315 jstring __attribute__((export_name("TS_LDKClosureReason_ProcessingError_get_err"))) TS_LDKClosureReason_ProcessingError_get_err(uint64_t ptr) {
9316         LDKClosureReason *obj = (LDKClosureReason*)untag_ptr(ptr);
9317         assert(obj->tag == LDKClosureReason_ProcessingError);
9318         LDKStr err_str = obj->processing_error.err;
9319                         jstring err_conv = str_ref_to_ts(err_str.chars, err_str.len);
9320         return err_conv;
9321 }
9322 uint32_t __attribute__((export_name("TS_LDKCOption_ClosureReasonZ_ty_from_ptr"))) TS_LDKCOption_ClosureReasonZ_ty_from_ptr(uint64_t ptr) {
9323         LDKCOption_ClosureReasonZ *obj = (LDKCOption_ClosureReasonZ*)untag_ptr(ptr);
9324         switch(obj->tag) {
9325                 case LDKCOption_ClosureReasonZ_Some: return 0;
9326                 case LDKCOption_ClosureReasonZ_None: return 1;
9327                 default: abort();
9328         }
9329 }
9330 uint64_t __attribute__((export_name("TS_LDKCOption_ClosureReasonZ_Some_get_some"))) TS_LDKCOption_ClosureReasonZ_Some_get_some(uint64_t ptr) {
9331         LDKCOption_ClosureReasonZ *obj = (LDKCOption_ClosureReasonZ*)untag_ptr(ptr);
9332         assert(obj->tag == LDKCOption_ClosureReasonZ_Some);
9333         uint64_t some_ref = tag_ptr(&obj->some, false);
9334         return some_ref;
9335 }
9336 static inline struct LDKCOption_ClosureReasonZ CResult_COption_ClosureReasonZDecodeErrorZ_get_ok(LDKCResult_COption_ClosureReasonZDecodeErrorZ *NONNULL_PTR owner){
9337 CHECK(owner->result_ok);
9338         return COption_ClosureReasonZ_clone(&*owner->contents.result);
9339 }
9340 uint64_t  __attribute__((export_name("TS_CResult_COption_ClosureReasonZDecodeErrorZ_get_ok"))) TS_CResult_COption_ClosureReasonZDecodeErrorZ_get_ok(uint64_t owner) {
9341         LDKCResult_COption_ClosureReasonZDecodeErrorZ* owner_conv = (LDKCResult_COption_ClosureReasonZDecodeErrorZ*)untag_ptr(owner);
9342         LDKCOption_ClosureReasonZ *ret_copy = MALLOC(sizeof(LDKCOption_ClosureReasonZ), "LDKCOption_ClosureReasonZ");
9343         *ret_copy = CResult_COption_ClosureReasonZDecodeErrorZ_get_ok(owner_conv);
9344         uint64_t ret_ref = tag_ptr(ret_copy, true);
9345         return ret_ref;
9346 }
9347
9348 static inline struct LDKDecodeError CResult_COption_ClosureReasonZDecodeErrorZ_get_err(LDKCResult_COption_ClosureReasonZDecodeErrorZ *NONNULL_PTR owner){
9349 CHECK(!owner->result_ok);
9350         return DecodeError_clone(&*owner->contents.err);
9351 }
9352 uint64_t  __attribute__((export_name("TS_CResult_COption_ClosureReasonZDecodeErrorZ_get_err"))) TS_CResult_COption_ClosureReasonZDecodeErrorZ_get_err(uint64_t owner) {
9353         LDKCResult_COption_ClosureReasonZDecodeErrorZ* owner_conv = (LDKCResult_COption_ClosureReasonZDecodeErrorZ*)untag_ptr(owner);
9354         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
9355         *ret_copy = CResult_COption_ClosureReasonZDecodeErrorZ_get_err(owner_conv);
9356         uint64_t ret_ref = tag_ptr(ret_copy, true);
9357         return ret_ref;
9358 }
9359
9360 uint32_t __attribute__((export_name("TS_LDKHTLCDestination_ty_from_ptr"))) TS_LDKHTLCDestination_ty_from_ptr(uint64_t ptr) {
9361         LDKHTLCDestination *obj = (LDKHTLCDestination*)untag_ptr(ptr);
9362         switch(obj->tag) {
9363                 case LDKHTLCDestination_NextHopChannel: return 0;
9364                 case LDKHTLCDestination_UnknownNextHop: return 1;
9365                 case LDKHTLCDestination_InvalidForward: return 2;
9366                 case LDKHTLCDestination_FailedPayment: return 3;
9367                 default: abort();
9368         }
9369 }
9370 int8_tArray __attribute__((export_name("TS_LDKHTLCDestination_NextHopChannel_get_node_id"))) TS_LDKHTLCDestination_NextHopChannel_get_node_id(uint64_t ptr) {
9371         LDKHTLCDestination *obj = (LDKHTLCDestination*)untag_ptr(ptr);
9372         assert(obj->tag == LDKHTLCDestination_NextHopChannel);
9373         int8_tArray node_id_arr = init_int8_tArray(33, __LINE__);
9374         memcpy(node_id_arr->elems, obj->next_hop_channel.node_id.compressed_form, 33);
9375         return node_id_arr;
9376 }
9377 int8_tArray __attribute__((export_name("TS_LDKHTLCDestination_NextHopChannel_get_channel_id"))) TS_LDKHTLCDestination_NextHopChannel_get_channel_id(uint64_t ptr) {
9378         LDKHTLCDestination *obj = (LDKHTLCDestination*)untag_ptr(ptr);
9379         assert(obj->tag == LDKHTLCDestination_NextHopChannel);
9380         int8_tArray channel_id_arr = init_int8_tArray(32, __LINE__);
9381         memcpy(channel_id_arr->elems, obj->next_hop_channel.channel_id.data, 32);
9382         return channel_id_arr;
9383 }
9384 int64_t __attribute__((export_name("TS_LDKHTLCDestination_UnknownNextHop_get_requested_forward_scid"))) TS_LDKHTLCDestination_UnknownNextHop_get_requested_forward_scid(uint64_t ptr) {
9385         LDKHTLCDestination *obj = (LDKHTLCDestination*)untag_ptr(ptr);
9386         assert(obj->tag == LDKHTLCDestination_UnknownNextHop);
9387         int64_t requested_forward_scid_conv = obj->unknown_next_hop.requested_forward_scid;
9388         return requested_forward_scid_conv;
9389 }
9390 int64_t __attribute__((export_name("TS_LDKHTLCDestination_InvalidForward_get_requested_forward_scid"))) TS_LDKHTLCDestination_InvalidForward_get_requested_forward_scid(uint64_t ptr) {
9391         LDKHTLCDestination *obj = (LDKHTLCDestination*)untag_ptr(ptr);
9392         assert(obj->tag == LDKHTLCDestination_InvalidForward);
9393         int64_t requested_forward_scid_conv = obj->invalid_forward.requested_forward_scid;
9394         return requested_forward_scid_conv;
9395 }
9396 int8_tArray __attribute__((export_name("TS_LDKHTLCDestination_FailedPayment_get_payment_hash"))) TS_LDKHTLCDestination_FailedPayment_get_payment_hash(uint64_t ptr) {
9397         LDKHTLCDestination *obj = (LDKHTLCDestination*)untag_ptr(ptr);
9398         assert(obj->tag == LDKHTLCDestination_FailedPayment);
9399         int8_tArray payment_hash_arr = init_int8_tArray(32, __LINE__);
9400         memcpy(payment_hash_arr->elems, obj->failed_payment.payment_hash.data, 32);
9401         return payment_hash_arr;
9402 }
9403 uint32_t __attribute__((export_name("TS_LDKCOption_HTLCDestinationZ_ty_from_ptr"))) TS_LDKCOption_HTLCDestinationZ_ty_from_ptr(uint64_t ptr) {
9404         LDKCOption_HTLCDestinationZ *obj = (LDKCOption_HTLCDestinationZ*)untag_ptr(ptr);
9405         switch(obj->tag) {
9406                 case LDKCOption_HTLCDestinationZ_Some: return 0;
9407                 case LDKCOption_HTLCDestinationZ_None: return 1;
9408                 default: abort();
9409         }
9410 }
9411 uint64_t __attribute__((export_name("TS_LDKCOption_HTLCDestinationZ_Some_get_some"))) TS_LDKCOption_HTLCDestinationZ_Some_get_some(uint64_t ptr) {
9412         LDKCOption_HTLCDestinationZ *obj = (LDKCOption_HTLCDestinationZ*)untag_ptr(ptr);
9413         assert(obj->tag == LDKCOption_HTLCDestinationZ_Some);
9414         uint64_t some_ref = tag_ptr(&obj->some, false);
9415         return some_ref;
9416 }
9417 static inline struct LDKCOption_HTLCDestinationZ CResult_COption_HTLCDestinationZDecodeErrorZ_get_ok(LDKCResult_COption_HTLCDestinationZDecodeErrorZ *NONNULL_PTR owner){
9418 CHECK(owner->result_ok);
9419         return COption_HTLCDestinationZ_clone(&*owner->contents.result);
9420 }
9421 uint64_t  __attribute__((export_name("TS_CResult_COption_HTLCDestinationZDecodeErrorZ_get_ok"))) TS_CResult_COption_HTLCDestinationZDecodeErrorZ_get_ok(uint64_t owner) {
9422         LDKCResult_COption_HTLCDestinationZDecodeErrorZ* owner_conv = (LDKCResult_COption_HTLCDestinationZDecodeErrorZ*)untag_ptr(owner);
9423         LDKCOption_HTLCDestinationZ *ret_copy = MALLOC(sizeof(LDKCOption_HTLCDestinationZ), "LDKCOption_HTLCDestinationZ");
9424         *ret_copy = CResult_COption_HTLCDestinationZDecodeErrorZ_get_ok(owner_conv);
9425         uint64_t ret_ref = tag_ptr(ret_copy, true);
9426         return ret_ref;
9427 }
9428
9429 static inline struct LDKDecodeError CResult_COption_HTLCDestinationZDecodeErrorZ_get_err(LDKCResult_COption_HTLCDestinationZDecodeErrorZ *NONNULL_PTR owner){
9430 CHECK(!owner->result_ok);
9431         return DecodeError_clone(&*owner->contents.err);
9432 }
9433 uint64_t  __attribute__((export_name("TS_CResult_COption_HTLCDestinationZDecodeErrorZ_get_err"))) TS_CResult_COption_HTLCDestinationZDecodeErrorZ_get_err(uint64_t owner) {
9434         LDKCResult_COption_HTLCDestinationZDecodeErrorZ* owner_conv = (LDKCResult_COption_HTLCDestinationZDecodeErrorZ*)untag_ptr(owner);
9435         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
9436         *ret_copy = CResult_COption_HTLCDestinationZDecodeErrorZ_get_err(owner_conv);
9437         uint64_t ret_ref = tag_ptr(ret_copy, true);
9438         return ret_ref;
9439 }
9440
9441 static inline enum LDKPaymentFailureReason CResult_PaymentFailureReasonDecodeErrorZ_get_ok(LDKCResult_PaymentFailureReasonDecodeErrorZ *NONNULL_PTR owner){
9442 CHECK(owner->result_ok);
9443         return PaymentFailureReason_clone(&*owner->contents.result);
9444 }
9445 uint32_t  __attribute__((export_name("TS_CResult_PaymentFailureReasonDecodeErrorZ_get_ok"))) TS_CResult_PaymentFailureReasonDecodeErrorZ_get_ok(uint64_t owner) {
9446         LDKCResult_PaymentFailureReasonDecodeErrorZ* owner_conv = (LDKCResult_PaymentFailureReasonDecodeErrorZ*)untag_ptr(owner);
9447         uint32_t ret_conv = LDKPaymentFailureReason_to_js(CResult_PaymentFailureReasonDecodeErrorZ_get_ok(owner_conv));
9448         return ret_conv;
9449 }
9450
9451 static inline struct LDKDecodeError CResult_PaymentFailureReasonDecodeErrorZ_get_err(LDKCResult_PaymentFailureReasonDecodeErrorZ *NONNULL_PTR owner){
9452 CHECK(!owner->result_ok);
9453         return DecodeError_clone(&*owner->contents.err);
9454 }
9455 uint64_t  __attribute__((export_name("TS_CResult_PaymentFailureReasonDecodeErrorZ_get_err"))) TS_CResult_PaymentFailureReasonDecodeErrorZ_get_err(uint64_t owner) {
9456         LDKCResult_PaymentFailureReasonDecodeErrorZ* owner_conv = (LDKCResult_PaymentFailureReasonDecodeErrorZ*)untag_ptr(owner);
9457         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
9458         *ret_copy = CResult_PaymentFailureReasonDecodeErrorZ_get_err(owner_conv);
9459         uint64_t ret_ref = tag_ptr(ret_copy, true);
9460         return ret_ref;
9461 }
9462
9463 uint32_t __attribute__((export_name("TS_LDKCOption_U128Z_ty_from_ptr"))) TS_LDKCOption_U128Z_ty_from_ptr(uint64_t ptr) {
9464         LDKCOption_U128Z *obj = (LDKCOption_U128Z*)untag_ptr(ptr);
9465         switch(obj->tag) {
9466                 case LDKCOption_U128Z_Some: return 0;
9467                 case LDKCOption_U128Z_None: return 1;
9468                 default: abort();
9469         }
9470 }
9471 int8_tArray __attribute__((export_name("TS_LDKCOption_U128Z_Some_get_some"))) TS_LDKCOption_U128Z_Some_get_some(uint64_t ptr) {
9472         LDKCOption_U128Z *obj = (LDKCOption_U128Z*)untag_ptr(ptr);
9473         assert(obj->tag == LDKCOption_U128Z_Some);
9474         int8_tArray some_arr = init_int8_tArray(16, __LINE__);
9475         memcpy(some_arr->elems, obj->some.le_bytes, 16);
9476         return some_arr;
9477 }
9478 static inline LDKCVec_ClaimedHTLCZ CVec_ClaimedHTLCZ_clone(const LDKCVec_ClaimedHTLCZ *orig) {
9479         LDKCVec_ClaimedHTLCZ ret = { .data = MALLOC(sizeof(LDKClaimedHTLC) * orig->datalen, "LDKCVec_ClaimedHTLCZ clone bytes"), .datalen = orig->datalen };
9480         for (size_t i = 0; i < ret.datalen; i++) {
9481                 ret.data[i] = ClaimedHTLC_clone(&orig->data[i]);
9482         }
9483         return ret;
9484 }
9485 uint32_t __attribute__((export_name("TS_LDKCOption_PaymentFailureReasonZ_ty_from_ptr"))) TS_LDKCOption_PaymentFailureReasonZ_ty_from_ptr(uint64_t ptr) {
9486         LDKCOption_PaymentFailureReasonZ *obj = (LDKCOption_PaymentFailureReasonZ*)untag_ptr(ptr);
9487         switch(obj->tag) {
9488                 case LDKCOption_PaymentFailureReasonZ_Some: return 0;
9489                 case LDKCOption_PaymentFailureReasonZ_None: return 1;
9490                 default: abort();
9491         }
9492 }
9493 uint32_t __attribute__((export_name("TS_LDKCOption_PaymentFailureReasonZ_Some_get_some"))) TS_LDKCOption_PaymentFailureReasonZ_Some_get_some(uint64_t ptr) {
9494         LDKCOption_PaymentFailureReasonZ *obj = (LDKCOption_PaymentFailureReasonZ*)untag_ptr(ptr);
9495         assert(obj->tag == LDKCOption_PaymentFailureReasonZ_Some);
9496         uint32_t some_conv = LDKPaymentFailureReason_to_js(obj->some);
9497         return some_conv;
9498 }
9499 uint32_t __attribute__((export_name("TS_LDKBumpTransactionEvent_ty_from_ptr"))) TS_LDKBumpTransactionEvent_ty_from_ptr(uint64_t ptr) {
9500         LDKBumpTransactionEvent *obj = (LDKBumpTransactionEvent*)untag_ptr(ptr);
9501         switch(obj->tag) {
9502                 case LDKBumpTransactionEvent_ChannelClose: return 0;
9503                 case LDKBumpTransactionEvent_HTLCResolution: return 1;
9504                 default: abort();
9505         }
9506 }
9507 int8_tArray __attribute__((export_name("TS_LDKBumpTransactionEvent_ChannelClose_get_claim_id"))) TS_LDKBumpTransactionEvent_ChannelClose_get_claim_id(uint64_t ptr) {
9508         LDKBumpTransactionEvent *obj = (LDKBumpTransactionEvent*)untag_ptr(ptr);
9509         assert(obj->tag == LDKBumpTransactionEvent_ChannelClose);
9510         int8_tArray claim_id_arr = init_int8_tArray(32, __LINE__);
9511         memcpy(claim_id_arr->elems, obj->channel_close.claim_id.data, 32);
9512         return claim_id_arr;
9513 }
9514 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) {
9515         LDKBumpTransactionEvent *obj = (LDKBumpTransactionEvent*)untag_ptr(ptr);
9516         assert(obj->tag == LDKBumpTransactionEvent_ChannelClose);
9517         int32_t package_target_feerate_sat_per_1000_weight_conv = obj->channel_close.package_target_feerate_sat_per_1000_weight;
9518         return package_target_feerate_sat_per_1000_weight_conv;
9519 }
9520 int8_tArray __attribute__((export_name("TS_LDKBumpTransactionEvent_ChannelClose_get_commitment_tx"))) TS_LDKBumpTransactionEvent_ChannelClose_get_commitment_tx(uint64_t ptr) {
9521         LDKBumpTransactionEvent *obj = (LDKBumpTransactionEvent*)untag_ptr(ptr);
9522         assert(obj->tag == LDKBumpTransactionEvent_ChannelClose);
9523         LDKTransaction commitment_tx_var = obj->channel_close.commitment_tx;
9524                         int8_tArray commitment_tx_arr = init_int8_tArray(commitment_tx_var.datalen, __LINE__);
9525                         memcpy(commitment_tx_arr->elems, commitment_tx_var.data, commitment_tx_var.datalen);
9526         return commitment_tx_arr;
9527 }
9528 int64_t __attribute__((export_name("TS_LDKBumpTransactionEvent_ChannelClose_get_commitment_tx_fee_satoshis"))) TS_LDKBumpTransactionEvent_ChannelClose_get_commitment_tx_fee_satoshis(uint64_t ptr) {
9529         LDKBumpTransactionEvent *obj = (LDKBumpTransactionEvent*)untag_ptr(ptr);
9530         assert(obj->tag == LDKBumpTransactionEvent_ChannelClose);
9531         int64_t commitment_tx_fee_satoshis_conv = obj->channel_close.commitment_tx_fee_satoshis;
9532         return commitment_tx_fee_satoshis_conv;
9533 }
9534 uint64_t __attribute__((export_name("TS_LDKBumpTransactionEvent_ChannelClose_get_anchor_descriptor"))) TS_LDKBumpTransactionEvent_ChannelClose_get_anchor_descriptor(uint64_t ptr) {
9535         LDKBumpTransactionEvent *obj = (LDKBumpTransactionEvent*)untag_ptr(ptr);
9536         assert(obj->tag == LDKBumpTransactionEvent_ChannelClose);
9537         LDKAnchorDescriptor anchor_descriptor_var = obj->channel_close.anchor_descriptor;
9538                         uint64_t anchor_descriptor_ref = 0;
9539                         CHECK_INNER_FIELD_ACCESS_OR_NULL(anchor_descriptor_var);
9540                         anchor_descriptor_ref = tag_ptr(anchor_descriptor_var.inner, false);
9541         return anchor_descriptor_ref;
9542 }
9543 uint64_tArray __attribute__((export_name("TS_LDKBumpTransactionEvent_ChannelClose_get_pending_htlcs"))) TS_LDKBumpTransactionEvent_ChannelClose_get_pending_htlcs(uint64_t ptr) {
9544         LDKBumpTransactionEvent *obj = (LDKBumpTransactionEvent*)untag_ptr(ptr);
9545         assert(obj->tag == LDKBumpTransactionEvent_ChannelClose);
9546         LDKCVec_HTLCOutputInCommitmentZ pending_htlcs_var = obj->channel_close.pending_htlcs;
9547                         uint64_tArray pending_htlcs_arr = NULL;
9548                         pending_htlcs_arr = init_uint64_tArray(pending_htlcs_var.datalen, __LINE__);
9549                         uint64_t *pending_htlcs_arr_ptr = (uint64_t*)(((uint8_t*)pending_htlcs_arr) + 8);
9550                         for (size_t y = 0; y < pending_htlcs_var.datalen; y++) {
9551                                 LDKHTLCOutputInCommitment pending_htlcs_conv_24_var = pending_htlcs_var.data[y];
9552                                 uint64_t pending_htlcs_conv_24_ref = 0;
9553                                 CHECK_INNER_FIELD_ACCESS_OR_NULL(pending_htlcs_conv_24_var);
9554                                 pending_htlcs_conv_24_ref = tag_ptr(pending_htlcs_conv_24_var.inner, false);
9555                                 pending_htlcs_arr_ptr[y] = pending_htlcs_conv_24_ref;
9556                         }
9557                         
9558         return pending_htlcs_arr;
9559 }
9560 int8_tArray __attribute__((export_name("TS_LDKBumpTransactionEvent_HTLCResolution_get_claim_id"))) TS_LDKBumpTransactionEvent_HTLCResolution_get_claim_id(uint64_t ptr) {
9561         LDKBumpTransactionEvent *obj = (LDKBumpTransactionEvent*)untag_ptr(ptr);
9562         assert(obj->tag == LDKBumpTransactionEvent_HTLCResolution);
9563         int8_tArray claim_id_arr = init_int8_tArray(32, __LINE__);
9564         memcpy(claim_id_arr->elems, obj->htlc_resolution.claim_id.data, 32);
9565         return claim_id_arr;
9566 }
9567 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) {
9568         LDKBumpTransactionEvent *obj = (LDKBumpTransactionEvent*)untag_ptr(ptr);
9569         assert(obj->tag == LDKBumpTransactionEvent_HTLCResolution);
9570         int32_t target_feerate_sat_per_1000_weight_conv = obj->htlc_resolution.target_feerate_sat_per_1000_weight;
9571         return target_feerate_sat_per_1000_weight_conv;
9572 }
9573 uint64_tArray __attribute__((export_name("TS_LDKBumpTransactionEvent_HTLCResolution_get_htlc_descriptors"))) TS_LDKBumpTransactionEvent_HTLCResolution_get_htlc_descriptors(uint64_t ptr) {
9574         LDKBumpTransactionEvent *obj = (LDKBumpTransactionEvent*)untag_ptr(ptr);
9575         assert(obj->tag == LDKBumpTransactionEvent_HTLCResolution);
9576         LDKCVec_HTLCDescriptorZ htlc_descriptors_var = obj->htlc_resolution.htlc_descriptors;
9577                         uint64_tArray htlc_descriptors_arr = NULL;
9578                         htlc_descriptors_arr = init_uint64_tArray(htlc_descriptors_var.datalen, __LINE__);
9579                         uint64_t *htlc_descriptors_arr_ptr = (uint64_t*)(((uint8_t*)htlc_descriptors_arr) + 8);
9580                         for (size_t q = 0; q < htlc_descriptors_var.datalen; q++) {
9581                                 LDKHTLCDescriptor htlc_descriptors_conv_16_var = htlc_descriptors_var.data[q];
9582                                 uint64_t htlc_descriptors_conv_16_ref = 0;
9583                                 CHECK_INNER_FIELD_ACCESS_OR_NULL(htlc_descriptors_conv_16_var);
9584                                 htlc_descriptors_conv_16_ref = tag_ptr(htlc_descriptors_conv_16_var.inner, false);
9585                                 htlc_descriptors_arr_ptr[q] = htlc_descriptors_conv_16_ref;
9586                         }
9587                         
9588         return htlc_descriptors_arr;
9589 }
9590 int32_t __attribute__((export_name("TS_LDKBumpTransactionEvent_HTLCResolution_get_tx_lock_time"))) TS_LDKBumpTransactionEvent_HTLCResolution_get_tx_lock_time(uint64_t ptr) {
9591         LDKBumpTransactionEvent *obj = (LDKBumpTransactionEvent*)untag_ptr(ptr);
9592         assert(obj->tag == LDKBumpTransactionEvent_HTLCResolution);
9593         int32_t tx_lock_time_conv = obj->htlc_resolution.tx_lock_time;
9594         return tx_lock_time_conv;
9595 }
9596 uint32_t __attribute__((export_name("TS_LDKEvent_ty_from_ptr"))) TS_LDKEvent_ty_from_ptr(uint64_t ptr) {
9597         LDKEvent *obj = (LDKEvent*)untag_ptr(ptr);
9598         switch(obj->tag) {
9599                 case LDKEvent_FundingGenerationReady: return 0;
9600                 case LDKEvent_PaymentClaimable: return 1;
9601                 case LDKEvent_PaymentClaimed: return 2;
9602                 case LDKEvent_InvoiceRequestFailed: return 3;
9603                 case LDKEvent_PaymentSent: return 4;
9604                 case LDKEvent_PaymentFailed: return 5;
9605                 case LDKEvent_PaymentPathSuccessful: return 6;
9606                 case LDKEvent_PaymentPathFailed: return 7;
9607                 case LDKEvent_ProbeSuccessful: return 8;
9608                 case LDKEvent_ProbeFailed: return 9;
9609                 case LDKEvent_PendingHTLCsForwardable: return 10;
9610                 case LDKEvent_HTLCIntercepted: return 11;
9611                 case LDKEvent_SpendableOutputs: return 12;
9612                 case LDKEvent_PaymentForwarded: return 13;
9613                 case LDKEvent_ChannelPending: return 14;
9614                 case LDKEvent_ChannelReady: return 15;
9615                 case LDKEvent_ChannelClosed: return 16;
9616                 case LDKEvent_DiscardFunding: return 17;
9617                 case LDKEvent_OpenChannelRequest: return 18;
9618                 case LDKEvent_HTLCHandlingFailed: return 19;
9619                 case LDKEvent_BumpTransaction: return 20;
9620                 default: abort();
9621         }
9622 }
9623 int8_tArray __attribute__((export_name("TS_LDKEvent_FundingGenerationReady_get_temporary_channel_id"))) TS_LDKEvent_FundingGenerationReady_get_temporary_channel_id(uint64_t ptr) {
9624         LDKEvent *obj = (LDKEvent*)untag_ptr(ptr);
9625         assert(obj->tag == LDKEvent_FundingGenerationReady);
9626         int8_tArray temporary_channel_id_arr = init_int8_tArray(32, __LINE__);
9627         memcpy(temporary_channel_id_arr->elems, obj->funding_generation_ready.temporary_channel_id.data, 32);
9628         return temporary_channel_id_arr;
9629 }
9630 int8_tArray __attribute__((export_name("TS_LDKEvent_FundingGenerationReady_get_counterparty_node_id"))) TS_LDKEvent_FundingGenerationReady_get_counterparty_node_id(uint64_t ptr) {
9631         LDKEvent *obj = (LDKEvent*)untag_ptr(ptr);
9632         assert(obj->tag == LDKEvent_FundingGenerationReady);
9633         int8_tArray counterparty_node_id_arr = init_int8_tArray(33, __LINE__);
9634         memcpy(counterparty_node_id_arr->elems, obj->funding_generation_ready.counterparty_node_id.compressed_form, 33);
9635         return counterparty_node_id_arr;
9636 }
9637 int64_t __attribute__((export_name("TS_LDKEvent_FundingGenerationReady_get_channel_value_satoshis"))) TS_LDKEvent_FundingGenerationReady_get_channel_value_satoshis(uint64_t ptr) {
9638         LDKEvent *obj = (LDKEvent*)untag_ptr(ptr);
9639         assert(obj->tag == LDKEvent_FundingGenerationReady);
9640         int64_t channel_value_satoshis_conv = obj->funding_generation_ready.channel_value_satoshis;
9641         return channel_value_satoshis_conv;
9642 }
9643 int8_tArray __attribute__((export_name("TS_LDKEvent_FundingGenerationReady_get_output_script"))) TS_LDKEvent_FundingGenerationReady_get_output_script(uint64_t ptr) {
9644         LDKEvent *obj = (LDKEvent*)untag_ptr(ptr);
9645         assert(obj->tag == LDKEvent_FundingGenerationReady);
9646         LDKCVec_u8Z output_script_var = obj->funding_generation_ready.output_script;
9647                         int8_tArray output_script_arr = init_int8_tArray(output_script_var.datalen, __LINE__);
9648                         memcpy(output_script_arr->elems, output_script_var.data, output_script_var.datalen);
9649         return output_script_arr;
9650 }
9651 int8_tArray __attribute__((export_name("TS_LDKEvent_FundingGenerationReady_get_user_channel_id"))) TS_LDKEvent_FundingGenerationReady_get_user_channel_id(uint64_t ptr) {
9652         LDKEvent *obj = (LDKEvent*)untag_ptr(ptr);
9653         assert(obj->tag == LDKEvent_FundingGenerationReady);
9654         int8_tArray user_channel_id_arr = init_int8_tArray(16, __LINE__);
9655         memcpy(user_channel_id_arr->elems, obj->funding_generation_ready.user_channel_id.le_bytes, 16);
9656         return user_channel_id_arr;
9657 }
9658 int8_tArray __attribute__((export_name("TS_LDKEvent_PaymentClaimable_get_receiver_node_id"))) TS_LDKEvent_PaymentClaimable_get_receiver_node_id(uint64_t ptr) {
9659         LDKEvent *obj = (LDKEvent*)untag_ptr(ptr);
9660         assert(obj->tag == LDKEvent_PaymentClaimable);
9661         int8_tArray receiver_node_id_arr = init_int8_tArray(33, __LINE__);
9662         memcpy(receiver_node_id_arr->elems, obj->payment_claimable.receiver_node_id.compressed_form, 33);
9663         return receiver_node_id_arr;
9664 }
9665 int8_tArray __attribute__((export_name("TS_LDKEvent_PaymentClaimable_get_payment_hash"))) TS_LDKEvent_PaymentClaimable_get_payment_hash(uint64_t ptr) {
9666         LDKEvent *obj = (LDKEvent*)untag_ptr(ptr);
9667         assert(obj->tag == LDKEvent_PaymentClaimable);
9668         int8_tArray payment_hash_arr = init_int8_tArray(32, __LINE__);
9669         memcpy(payment_hash_arr->elems, obj->payment_claimable.payment_hash.data, 32);
9670         return payment_hash_arr;
9671 }
9672 uint64_t __attribute__((export_name("TS_LDKEvent_PaymentClaimable_get_onion_fields"))) TS_LDKEvent_PaymentClaimable_get_onion_fields(uint64_t ptr) {
9673         LDKEvent *obj = (LDKEvent*)untag_ptr(ptr);
9674         assert(obj->tag == LDKEvent_PaymentClaimable);
9675         LDKRecipientOnionFields onion_fields_var = obj->payment_claimable.onion_fields;
9676                         uint64_t onion_fields_ref = 0;
9677                         CHECK_INNER_FIELD_ACCESS_OR_NULL(onion_fields_var);
9678                         onion_fields_ref = tag_ptr(onion_fields_var.inner, false);
9679         return onion_fields_ref;
9680 }
9681 int64_t __attribute__((export_name("TS_LDKEvent_PaymentClaimable_get_amount_msat"))) TS_LDKEvent_PaymentClaimable_get_amount_msat(uint64_t ptr) {
9682         LDKEvent *obj = (LDKEvent*)untag_ptr(ptr);
9683         assert(obj->tag == LDKEvent_PaymentClaimable);
9684         int64_t amount_msat_conv = obj->payment_claimable.amount_msat;
9685         return amount_msat_conv;
9686 }
9687 int64_t __attribute__((export_name("TS_LDKEvent_PaymentClaimable_get_counterparty_skimmed_fee_msat"))) TS_LDKEvent_PaymentClaimable_get_counterparty_skimmed_fee_msat(uint64_t ptr) {
9688         LDKEvent *obj = (LDKEvent*)untag_ptr(ptr);
9689         assert(obj->tag == LDKEvent_PaymentClaimable);
9690         int64_t counterparty_skimmed_fee_msat_conv = obj->payment_claimable.counterparty_skimmed_fee_msat;
9691         return counterparty_skimmed_fee_msat_conv;
9692 }
9693 uint64_t __attribute__((export_name("TS_LDKEvent_PaymentClaimable_get_purpose"))) TS_LDKEvent_PaymentClaimable_get_purpose(uint64_t ptr) {
9694         LDKEvent *obj = (LDKEvent*)untag_ptr(ptr);
9695         assert(obj->tag == LDKEvent_PaymentClaimable);
9696         uint64_t purpose_ref = tag_ptr(&obj->payment_claimable.purpose, false);
9697         return purpose_ref;
9698 }
9699 uint64_t __attribute__((export_name("TS_LDKEvent_PaymentClaimable_get_via_channel_id"))) TS_LDKEvent_PaymentClaimable_get_via_channel_id(uint64_t ptr) {
9700         LDKEvent *obj = (LDKEvent*)untag_ptr(ptr);
9701         assert(obj->tag == LDKEvent_PaymentClaimable);
9702         uint64_t via_channel_id_ref = tag_ptr(&obj->payment_claimable.via_channel_id, false);
9703         return via_channel_id_ref;
9704 }
9705 uint64_t __attribute__((export_name("TS_LDKEvent_PaymentClaimable_get_via_user_channel_id"))) TS_LDKEvent_PaymentClaimable_get_via_user_channel_id(uint64_t ptr) {
9706         LDKEvent *obj = (LDKEvent*)untag_ptr(ptr);
9707         assert(obj->tag == LDKEvent_PaymentClaimable);
9708         uint64_t via_user_channel_id_ref = tag_ptr(&obj->payment_claimable.via_user_channel_id, false);
9709         return via_user_channel_id_ref;
9710 }
9711 uint64_t __attribute__((export_name("TS_LDKEvent_PaymentClaimable_get_claim_deadline"))) TS_LDKEvent_PaymentClaimable_get_claim_deadline(uint64_t ptr) {
9712         LDKEvent *obj = (LDKEvent*)untag_ptr(ptr);
9713         assert(obj->tag == LDKEvent_PaymentClaimable);
9714         uint64_t claim_deadline_ref = tag_ptr(&obj->payment_claimable.claim_deadline, false);
9715         return claim_deadline_ref;
9716 }
9717 int8_tArray __attribute__((export_name("TS_LDKEvent_PaymentClaimed_get_receiver_node_id"))) TS_LDKEvent_PaymentClaimed_get_receiver_node_id(uint64_t ptr) {
9718         LDKEvent *obj = (LDKEvent*)untag_ptr(ptr);
9719         assert(obj->tag == LDKEvent_PaymentClaimed);
9720         int8_tArray receiver_node_id_arr = init_int8_tArray(33, __LINE__);
9721         memcpy(receiver_node_id_arr->elems, obj->payment_claimed.receiver_node_id.compressed_form, 33);
9722         return receiver_node_id_arr;
9723 }
9724 int8_tArray __attribute__((export_name("TS_LDKEvent_PaymentClaimed_get_payment_hash"))) TS_LDKEvent_PaymentClaimed_get_payment_hash(uint64_t ptr) {
9725         LDKEvent *obj = (LDKEvent*)untag_ptr(ptr);
9726         assert(obj->tag == LDKEvent_PaymentClaimed);
9727         int8_tArray payment_hash_arr = init_int8_tArray(32, __LINE__);
9728         memcpy(payment_hash_arr->elems, obj->payment_claimed.payment_hash.data, 32);
9729         return payment_hash_arr;
9730 }
9731 int64_t __attribute__((export_name("TS_LDKEvent_PaymentClaimed_get_amount_msat"))) TS_LDKEvent_PaymentClaimed_get_amount_msat(uint64_t ptr) {
9732         LDKEvent *obj = (LDKEvent*)untag_ptr(ptr);
9733         assert(obj->tag == LDKEvent_PaymentClaimed);
9734         int64_t amount_msat_conv = obj->payment_claimed.amount_msat;
9735         return amount_msat_conv;
9736 }
9737 uint64_t __attribute__((export_name("TS_LDKEvent_PaymentClaimed_get_purpose"))) TS_LDKEvent_PaymentClaimed_get_purpose(uint64_t ptr) {
9738         LDKEvent *obj = (LDKEvent*)untag_ptr(ptr);
9739         assert(obj->tag == LDKEvent_PaymentClaimed);
9740         uint64_t purpose_ref = tag_ptr(&obj->payment_claimed.purpose, false);
9741         return purpose_ref;
9742 }
9743 uint64_tArray __attribute__((export_name("TS_LDKEvent_PaymentClaimed_get_htlcs"))) TS_LDKEvent_PaymentClaimed_get_htlcs(uint64_t ptr) {
9744         LDKEvent *obj = (LDKEvent*)untag_ptr(ptr);
9745         assert(obj->tag == LDKEvent_PaymentClaimed);
9746         LDKCVec_ClaimedHTLCZ htlcs_var = obj->payment_claimed.htlcs;
9747                         uint64_tArray htlcs_arr = NULL;
9748                         htlcs_arr = init_uint64_tArray(htlcs_var.datalen, __LINE__);
9749                         uint64_t *htlcs_arr_ptr = (uint64_t*)(((uint8_t*)htlcs_arr) + 8);
9750                         for (size_t n = 0; n < htlcs_var.datalen; n++) {
9751                                 LDKClaimedHTLC htlcs_conv_13_var = htlcs_var.data[n];
9752                                 uint64_t htlcs_conv_13_ref = 0;
9753                                 CHECK_INNER_FIELD_ACCESS_OR_NULL(htlcs_conv_13_var);
9754                                 htlcs_conv_13_ref = tag_ptr(htlcs_conv_13_var.inner, false);
9755                                 htlcs_arr_ptr[n] = htlcs_conv_13_ref;
9756                         }
9757                         
9758         return htlcs_arr;
9759 }
9760 uint64_t __attribute__((export_name("TS_LDKEvent_PaymentClaimed_get_sender_intended_total_msat"))) TS_LDKEvent_PaymentClaimed_get_sender_intended_total_msat(uint64_t ptr) {
9761         LDKEvent *obj = (LDKEvent*)untag_ptr(ptr);
9762         assert(obj->tag == LDKEvent_PaymentClaimed);
9763         uint64_t sender_intended_total_msat_ref = tag_ptr(&obj->payment_claimed.sender_intended_total_msat, false);
9764         return sender_intended_total_msat_ref;
9765 }
9766 int8_tArray __attribute__((export_name("TS_LDKEvent_InvoiceRequestFailed_get_payment_id"))) TS_LDKEvent_InvoiceRequestFailed_get_payment_id(uint64_t ptr) {
9767         LDKEvent *obj = (LDKEvent*)untag_ptr(ptr);
9768         assert(obj->tag == LDKEvent_InvoiceRequestFailed);
9769         int8_tArray payment_id_arr = init_int8_tArray(32, __LINE__);
9770         memcpy(payment_id_arr->elems, obj->invoice_request_failed.payment_id.data, 32);
9771         return payment_id_arr;
9772 }
9773 uint64_t __attribute__((export_name("TS_LDKEvent_PaymentSent_get_payment_id"))) TS_LDKEvent_PaymentSent_get_payment_id(uint64_t ptr) {
9774         LDKEvent *obj = (LDKEvent*)untag_ptr(ptr);
9775         assert(obj->tag == LDKEvent_PaymentSent);
9776         uint64_t payment_id_ref = tag_ptr(&obj->payment_sent.payment_id, false);
9777         return payment_id_ref;
9778 }
9779 int8_tArray __attribute__((export_name("TS_LDKEvent_PaymentSent_get_payment_preimage"))) TS_LDKEvent_PaymentSent_get_payment_preimage(uint64_t ptr) {
9780         LDKEvent *obj = (LDKEvent*)untag_ptr(ptr);
9781         assert(obj->tag == LDKEvent_PaymentSent);
9782         int8_tArray payment_preimage_arr = init_int8_tArray(32, __LINE__);
9783         memcpy(payment_preimage_arr->elems, obj->payment_sent.payment_preimage.data, 32);
9784         return payment_preimage_arr;
9785 }
9786 int8_tArray __attribute__((export_name("TS_LDKEvent_PaymentSent_get_payment_hash"))) TS_LDKEvent_PaymentSent_get_payment_hash(uint64_t ptr) {
9787         LDKEvent *obj = (LDKEvent*)untag_ptr(ptr);
9788         assert(obj->tag == LDKEvent_PaymentSent);
9789         int8_tArray payment_hash_arr = init_int8_tArray(32, __LINE__);
9790         memcpy(payment_hash_arr->elems, obj->payment_sent.payment_hash.data, 32);
9791         return payment_hash_arr;
9792 }
9793 uint64_t __attribute__((export_name("TS_LDKEvent_PaymentSent_get_fee_paid_msat"))) TS_LDKEvent_PaymentSent_get_fee_paid_msat(uint64_t ptr) {
9794         LDKEvent *obj = (LDKEvent*)untag_ptr(ptr);
9795         assert(obj->tag == LDKEvent_PaymentSent);
9796         uint64_t fee_paid_msat_ref = tag_ptr(&obj->payment_sent.fee_paid_msat, false);
9797         return fee_paid_msat_ref;
9798 }
9799 int8_tArray __attribute__((export_name("TS_LDKEvent_PaymentFailed_get_payment_id"))) TS_LDKEvent_PaymentFailed_get_payment_id(uint64_t ptr) {
9800         LDKEvent *obj = (LDKEvent*)untag_ptr(ptr);
9801         assert(obj->tag == LDKEvent_PaymentFailed);
9802         int8_tArray payment_id_arr = init_int8_tArray(32, __LINE__);
9803         memcpy(payment_id_arr->elems, obj->payment_failed.payment_id.data, 32);
9804         return payment_id_arr;
9805 }
9806 int8_tArray __attribute__((export_name("TS_LDKEvent_PaymentFailed_get_payment_hash"))) TS_LDKEvent_PaymentFailed_get_payment_hash(uint64_t ptr) {
9807         LDKEvent *obj = (LDKEvent*)untag_ptr(ptr);
9808         assert(obj->tag == LDKEvent_PaymentFailed);
9809         int8_tArray payment_hash_arr = init_int8_tArray(32, __LINE__);
9810         memcpy(payment_hash_arr->elems, obj->payment_failed.payment_hash.data, 32);
9811         return payment_hash_arr;
9812 }
9813 uint64_t __attribute__((export_name("TS_LDKEvent_PaymentFailed_get_reason"))) TS_LDKEvent_PaymentFailed_get_reason(uint64_t ptr) {
9814         LDKEvent *obj = (LDKEvent*)untag_ptr(ptr);
9815         assert(obj->tag == LDKEvent_PaymentFailed);
9816         uint64_t reason_ref = tag_ptr(&obj->payment_failed.reason, false);
9817         return reason_ref;
9818 }
9819 int8_tArray __attribute__((export_name("TS_LDKEvent_PaymentPathSuccessful_get_payment_id"))) TS_LDKEvent_PaymentPathSuccessful_get_payment_id(uint64_t ptr) {
9820         LDKEvent *obj = (LDKEvent*)untag_ptr(ptr);
9821         assert(obj->tag == LDKEvent_PaymentPathSuccessful);
9822         int8_tArray payment_id_arr = init_int8_tArray(32, __LINE__);
9823         memcpy(payment_id_arr->elems, obj->payment_path_successful.payment_id.data, 32);
9824         return payment_id_arr;
9825 }
9826 uint64_t __attribute__((export_name("TS_LDKEvent_PaymentPathSuccessful_get_payment_hash"))) TS_LDKEvent_PaymentPathSuccessful_get_payment_hash(uint64_t ptr) {
9827         LDKEvent *obj = (LDKEvent*)untag_ptr(ptr);
9828         assert(obj->tag == LDKEvent_PaymentPathSuccessful);
9829         uint64_t payment_hash_ref = tag_ptr(&obj->payment_path_successful.payment_hash, false);
9830         return payment_hash_ref;
9831 }
9832 uint64_t __attribute__((export_name("TS_LDKEvent_PaymentPathSuccessful_get_path"))) TS_LDKEvent_PaymentPathSuccessful_get_path(uint64_t ptr) {
9833         LDKEvent *obj = (LDKEvent*)untag_ptr(ptr);
9834         assert(obj->tag == LDKEvent_PaymentPathSuccessful);
9835         LDKPath path_var = obj->payment_path_successful.path;
9836                         uint64_t path_ref = 0;
9837                         CHECK_INNER_FIELD_ACCESS_OR_NULL(path_var);
9838                         path_ref = tag_ptr(path_var.inner, false);
9839         return path_ref;
9840 }
9841 uint64_t __attribute__((export_name("TS_LDKEvent_PaymentPathFailed_get_payment_id"))) TS_LDKEvent_PaymentPathFailed_get_payment_id(uint64_t ptr) {
9842         LDKEvent *obj = (LDKEvent*)untag_ptr(ptr);
9843         assert(obj->tag == LDKEvent_PaymentPathFailed);
9844         uint64_t payment_id_ref = tag_ptr(&obj->payment_path_failed.payment_id, false);
9845         return payment_id_ref;
9846 }
9847 int8_tArray __attribute__((export_name("TS_LDKEvent_PaymentPathFailed_get_payment_hash"))) TS_LDKEvent_PaymentPathFailed_get_payment_hash(uint64_t ptr) {
9848         LDKEvent *obj = (LDKEvent*)untag_ptr(ptr);
9849         assert(obj->tag == LDKEvent_PaymentPathFailed);
9850         int8_tArray payment_hash_arr = init_int8_tArray(32, __LINE__);
9851         memcpy(payment_hash_arr->elems, obj->payment_path_failed.payment_hash.data, 32);
9852         return payment_hash_arr;
9853 }
9854 jboolean __attribute__((export_name("TS_LDKEvent_PaymentPathFailed_get_payment_failed_permanently"))) TS_LDKEvent_PaymentPathFailed_get_payment_failed_permanently(uint64_t ptr) {
9855         LDKEvent *obj = (LDKEvent*)untag_ptr(ptr);
9856         assert(obj->tag == LDKEvent_PaymentPathFailed);
9857         jboolean payment_failed_permanently_conv = obj->payment_path_failed.payment_failed_permanently;
9858         return payment_failed_permanently_conv;
9859 }
9860 uint64_t __attribute__((export_name("TS_LDKEvent_PaymentPathFailed_get_failure"))) TS_LDKEvent_PaymentPathFailed_get_failure(uint64_t ptr) {
9861         LDKEvent *obj = (LDKEvent*)untag_ptr(ptr);
9862         assert(obj->tag == LDKEvent_PaymentPathFailed);
9863         uint64_t failure_ref = tag_ptr(&obj->payment_path_failed.failure, false);
9864         return failure_ref;
9865 }
9866 uint64_t __attribute__((export_name("TS_LDKEvent_PaymentPathFailed_get_path"))) TS_LDKEvent_PaymentPathFailed_get_path(uint64_t ptr) {
9867         LDKEvent *obj = (LDKEvent*)untag_ptr(ptr);
9868         assert(obj->tag == LDKEvent_PaymentPathFailed);
9869         LDKPath path_var = obj->payment_path_failed.path;
9870                         uint64_t path_ref = 0;
9871                         CHECK_INNER_FIELD_ACCESS_OR_NULL(path_var);
9872                         path_ref = tag_ptr(path_var.inner, false);
9873         return path_ref;
9874 }
9875 uint64_t __attribute__((export_name("TS_LDKEvent_PaymentPathFailed_get_short_channel_id"))) TS_LDKEvent_PaymentPathFailed_get_short_channel_id(uint64_t ptr) {
9876         LDKEvent *obj = (LDKEvent*)untag_ptr(ptr);
9877         assert(obj->tag == LDKEvent_PaymentPathFailed);
9878         uint64_t short_channel_id_ref = tag_ptr(&obj->payment_path_failed.short_channel_id, false);
9879         return short_channel_id_ref;
9880 }
9881 int8_tArray __attribute__((export_name("TS_LDKEvent_ProbeSuccessful_get_payment_id"))) TS_LDKEvent_ProbeSuccessful_get_payment_id(uint64_t ptr) {
9882         LDKEvent *obj = (LDKEvent*)untag_ptr(ptr);
9883         assert(obj->tag == LDKEvent_ProbeSuccessful);
9884         int8_tArray payment_id_arr = init_int8_tArray(32, __LINE__);
9885         memcpy(payment_id_arr->elems, obj->probe_successful.payment_id.data, 32);
9886         return payment_id_arr;
9887 }
9888 int8_tArray __attribute__((export_name("TS_LDKEvent_ProbeSuccessful_get_payment_hash"))) TS_LDKEvent_ProbeSuccessful_get_payment_hash(uint64_t ptr) {
9889         LDKEvent *obj = (LDKEvent*)untag_ptr(ptr);
9890         assert(obj->tag == LDKEvent_ProbeSuccessful);
9891         int8_tArray payment_hash_arr = init_int8_tArray(32, __LINE__);
9892         memcpy(payment_hash_arr->elems, obj->probe_successful.payment_hash.data, 32);
9893         return payment_hash_arr;
9894 }
9895 uint64_t __attribute__((export_name("TS_LDKEvent_ProbeSuccessful_get_path"))) TS_LDKEvent_ProbeSuccessful_get_path(uint64_t ptr) {
9896         LDKEvent *obj = (LDKEvent*)untag_ptr(ptr);
9897         assert(obj->tag == LDKEvent_ProbeSuccessful);
9898         LDKPath path_var = obj->probe_successful.path;
9899                         uint64_t path_ref = 0;
9900                         CHECK_INNER_FIELD_ACCESS_OR_NULL(path_var);
9901                         path_ref = tag_ptr(path_var.inner, false);
9902         return path_ref;
9903 }
9904 int8_tArray __attribute__((export_name("TS_LDKEvent_ProbeFailed_get_payment_id"))) TS_LDKEvent_ProbeFailed_get_payment_id(uint64_t ptr) {
9905         LDKEvent *obj = (LDKEvent*)untag_ptr(ptr);
9906         assert(obj->tag == LDKEvent_ProbeFailed);
9907         int8_tArray payment_id_arr = init_int8_tArray(32, __LINE__);
9908         memcpy(payment_id_arr->elems, obj->probe_failed.payment_id.data, 32);
9909         return payment_id_arr;
9910 }
9911 int8_tArray __attribute__((export_name("TS_LDKEvent_ProbeFailed_get_payment_hash"))) TS_LDKEvent_ProbeFailed_get_payment_hash(uint64_t ptr) {
9912         LDKEvent *obj = (LDKEvent*)untag_ptr(ptr);
9913         assert(obj->tag == LDKEvent_ProbeFailed);
9914         int8_tArray payment_hash_arr = init_int8_tArray(32, __LINE__);
9915         memcpy(payment_hash_arr->elems, obj->probe_failed.payment_hash.data, 32);
9916         return payment_hash_arr;
9917 }
9918 uint64_t __attribute__((export_name("TS_LDKEvent_ProbeFailed_get_path"))) TS_LDKEvent_ProbeFailed_get_path(uint64_t ptr) {
9919         LDKEvent *obj = (LDKEvent*)untag_ptr(ptr);
9920         assert(obj->tag == LDKEvent_ProbeFailed);
9921         LDKPath path_var = obj->probe_failed.path;
9922                         uint64_t path_ref = 0;
9923                         CHECK_INNER_FIELD_ACCESS_OR_NULL(path_var);
9924                         path_ref = tag_ptr(path_var.inner, false);
9925         return path_ref;
9926 }
9927 uint64_t __attribute__((export_name("TS_LDKEvent_ProbeFailed_get_short_channel_id"))) TS_LDKEvent_ProbeFailed_get_short_channel_id(uint64_t ptr) {
9928         LDKEvent *obj = (LDKEvent*)untag_ptr(ptr);
9929         assert(obj->tag == LDKEvent_ProbeFailed);
9930         uint64_t short_channel_id_ref = tag_ptr(&obj->probe_failed.short_channel_id, false);
9931         return short_channel_id_ref;
9932 }
9933 int64_t __attribute__((export_name("TS_LDKEvent_PendingHTLCsForwardable_get_time_forwardable"))) TS_LDKEvent_PendingHTLCsForwardable_get_time_forwardable(uint64_t ptr) {
9934         LDKEvent *obj = (LDKEvent*)untag_ptr(ptr);
9935         assert(obj->tag == LDKEvent_PendingHTLCsForwardable);
9936         int64_t time_forwardable_conv = obj->pending_htl_cs_forwardable.time_forwardable;
9937         return time_forwardable_conv;
9938 }
9939 int8_tArray __attribute__((export_name("TS_LDKEvent_HTLCIntercepted_get_intercept_id"))) TS_LDKEvent_HTLCIntercepted_get_intercept_id(uint64_t ptr) {
9940         LDKEvent *obj = (LDKEvent*)untag_ptr(ptr);
9941         assert(obj->tag == LDKEvent_HTLCIntercepted);
9942         int8_tArray intercept_id_arr = init_int8_tArray(32, __LINE__);
9943         memcpy(intercept_id_arr->elems, obj->htlc_intercepted.intercept_id.data, 32);
9944         return intercept_id_arr;
9945 }
9946 int64_t __attribute__((export_name("TS_LDKEvent_HTLCIntercepted_get_requested_next_hop_scid"))) TS_LDKEvent_HTLCIntercepted_get_requested_next_hop_scid(uint64_t ptr) {
9947         LDKEvent *obj = (LDKEvent*)untag_ptr(ptr);
9948         assert(obj->tag == LDKEvent_HTLCIntercepted);
9949         int64_t requested_next_hop_scid_conv = obj->htlc_intercepted.requested_next_hop_scid;
9950         return requested_next_hop_scid_conv;
9951 }
9952 int8_tArray __attribute__((export_name("TS_LDKEvent_HTLCIntercepted_get_payment_hash"))) TS_LDKEvent_HTLCIntercepted_get_payment_hash(uint64_t ptr) {
9953         LDKEvent *obj = (LDKEvent*)untag_ptr(ptr);
9954         assert(obj->tag == LDKEvent_HTLCIntercepted);
9955         int8_tArray payment_hash_arr = init_int8_tArray(32, __LINE__);
9956         memcpy(payment_hash_arr->elems, obj->htlc_intercepted.payment_hash.data, 32);
9957         return payment_hash_arr;
9958 }
9959 int64_t __attribute__((export_name("TS_LDKEvent_HTLCIntercepted_get_inbound_amount_msat"))) TS_LDKEvent_HTLCIntercepted_get_inbound_amount_msat(uint64_t ptr) {
9960         LDKEvent *obj = (LDKEvent*)untag_ptr(ptr);
9961         assert(obj->tag == LDKEvent_HTLCIntercepted);
9962         int64_t inbound_amount_msat_conv = obj->htlc_intercepted.inbound_amount_msat;
9963         return inbound_amount_msat_conv;
9964 }
9965 int64_t __attribute__((export_name("TS_LDKEvent_HTLCIntercepted_get_expected_outbound_amount_msat"))) TS_LDKEvent_HTLCIntercepted_get_expected_outbound_amount_msat(uint64_t ptr) {
9966         LDKEvent *obj = (LDKEvent*)untag_ptr(ptr);
9967         assert(obj->tag == LDKEvent_HTLCIntercepted);
9968         int64_t expected_outbound_amount_msat_conv = obj->htlc_intercepted.expected_outbound_amount_msat;
9969         return expected_outbound_amount_msat_conv;
9970 }
9971 uint64_tArray __attribute__((export_name("TS_LDKEvent_SpendableOutputs_get_outputs"))) TS_LDKEvent_SpendableOutputs_get_outputs(uint64_t ptr) {
9972         LDKEvent *obj = (LDKEvent*)untag_ptr(ptr);
9973         assert(obj->tag == LDKEvent_SpendableOutputs);
9974         LDKCVec_SpendableOutputDescriptorZ outputs_var = obj->spendable_outputs.outputs;
9975                         uint64_tArray outputs_arr = NULL;
9976                         outputs_arr = init_uint64_tArray(outputs_var.datalen, __LINE__);
9977                         uint64_t *outputs_arr_ptr = (uint64_t*)(((uint8_t*)outputs_arr) + 8);
9978                         for (size_t b = 0; b < outputs_var.datalen; b++) {
9979                                 uint64_t outputs_conv_27_ref = tag_ptr(&outputs_var.data[b], false);
9980                                 outputs_arr_ptr[b] = outputs_conv_27_ref;
9981                         }
9982                         
9983         return outputs_arr;
9984 }
9985 uint64_t __attribute__((export_name("TS_LDKEvent_SpendableOutputs_get_channel_id"))) TS_LDKEvent_SpendableOutputs_get_channel_id(uint64_t ptr) {
9986         LDKEvent *obj = (LDKEvent*)untag_ptr(ptr);
9987         assert(obj->tag == LDKEvent_SpendableOutputs);
9988         uint64_t channel_id_ref = tag_ptr(&obj->spendable_outputs.channel_id, false);
9989         return channel_id_ref;
9990 }
9991 uint64_t __attribute__((export_name("TS_LDKEvent_PaymentForwarded_get_prev_channel_id"))) TS_LDKEvent_PaymentForwarded_get_prev_channel_id(uint64_t ptr) {
9992         LDKEvent *obj = (LDKEvent*)untag_ptr(ptr);
9993         assert(obj->tag == LDKEvent_PaymentForwarded);
9994         uint64_t prev_channel_id_ref = tag_ptr(&obj->payment_forwarded.prev_channel_id, false);
9995         return prev_channel_id_ref;
9996 }
9997 uint64_t __attribute__((export_name("TS_LDKEvent_PaymentForwarded_get_next_channel_id"))) TS_LDKEvent_PaymentForwarded_get_next_channel_id(uint64_t ptr) {
9998         LDKEvent *obj = (LDKEvent*)untag_ptr(ptr);
9999         assert(obj->tag == LDKEvent_PaymentForwarded);
10000         uint64_t next_channel_id_ref = tag_ptr(&obj->payment_forwarded.next_channel_id, false);
10001         return next_channel_id_ref;
10002 }
10003 uint64_t __attribute__((export_name("TS_LDKEvent_PaymentForwarded_get_fee_earned_msat"))) TS_LDKEvent_PaymentForwarded_get_fee_earned_msat(uint64_t ptr) {
10004         LDKEvent *obj = (LDKEvent*)untag_ptr(ptr);
10005         assert(obj->tag == LDKEvent_PaymentForwarded);
10006         uint64_t fee_earned_msat_ref = tag_ptr(&obj->payment_forwarded.fee_earned_msat, false);
10007         return fee_earned_msat_ref;
10008 }
10009 jboolean __attribute__((export_name("TS_LDKEvent_PaymentForwarded_get_claim_from_onchain_tx"))) TS_LDKEvent_PaymentForwarded_get_claim_from_onchain_tx(uint64_t ptr) {
10010         LDKEvent *obj = (LDKEvent*)untag_ptr(ptr);
10011         assert(obj->tag == LDKEvent_PaymentForwarded);
10012         jboolean claim_from_onchain_tx_conv = obj->payment_forwarded.claim_from_onchain_tx;
10013         return claim_from_onchain_tx_conv;
10014 }
10015 uint64_t __attribute__((export_name("TS_LDKEvent_PaymentForwarded_get_outbound_amount_forwarded_msat"))) TS_LDKEvent_PaymentForwarded_get_outbound_amount_forwarded_msat(uint64_t ptr) {
10016         LDKEvent *obj = (LDKEvent*)untag_ptr(ptr);
10017         assert(obj->tag == LDKEvent_PaymentForwarded);
10018         uint64_t outbound_amount_forwarded_msat_ref = tag_ptr(&obj->payment_forwarded.outbound_amount_forwarded_msat, false);
10019         return outbound_amount_forwarded_msat_ref;
10020 }
10021 int8_tArray __attribute__((export_name("TS_LDKEvent_ChannelPending_get_channel_id"))) TS_LDKEvent_ChannelPending_get_channel_id(uint64_t ptr) {
10022         LDKEvent *obj = (LDKEvent*)untag_ptr(ptr);
10023         assert(obj->tag == LDKEvent_ChannelPending);
10024         int8_tArray channel_id_arr = init_int8_tArray(32, __LINE__);
10025         memcpy(channel_id_arr->elems, obj->channel_pending.channel_id.data, 32);
10026         return channel_id_arr;
10027 }
10028 int8_tArray __attribute__((export_name("TS_LDKEvent_ChannelPending_get_user_channel_id"))) TS_LDKEvent_ChannelPending_get_user_channel_id(uint64_t ptr) {
10029         LDKEvent *obj = (LDKEvent*)untag_ptr(ptr);
10030         assert(obj->tag == LDKEvent_ChannelPending);
10031         int8_tArray user_channel_id_arr = init_int8_tArray(16, __LINE__);
10032         memcpy(user_channel_id_arr->elems, obj->channel_pending.user_channel_id.le_bytes, 16);
10033         return user_channel_id_arr;
10034 }
10035 uint64_t __attribute__((export_name("TS_LDKEvent_ChannelPending_get_former_temporary_channel_id"))) TS_LDKEvent_ChannelPending_get_former_temporary_channel_id(uint64_t ptr) {
10036         LDKEvent *obj = (LDKEvent*)untag_ptr(ptr);
10037         assert(obj->tag == LDKEvent_ChannelPending);
10038         uint64_t former_temporary_channel_id_ref = tag_ptr(&obj->channel_pending.former_temporary_channel_id, false);
10039         return former_temporary_channel_id_ref;
10040 }
10041 int8_tArray __attribute__((export_name("TS_LDKEvent_ChannelPending_get_counterparty_node_id"))) TS_LDKEvent_ChannelPending_get_counterparty_node_id(uint64_t ptr) {
10042         LDKEvent *obj = (LDKEvent*)untag_ptr(ptr);
10043         assert(obj->tag == LDKEvent_ChannelPending);
10044         int8_tArray counterparty_node_id_arr = init_int8_tArray(33, __LINE__);
10045         memcpy(counterparty_node_id_arr->elems, obj->channel_pending.counterparty_node_id.compressed_form, 33);
10046         return counterparty_node_id_arr;
10047 }
10048 uint64_t __attribute__((export_name("TS_LDKEvent_ChannelPending_get_funding_txo"))) TS_LDKEvent_ChannelPending_get_funding_txo(uint64_t ptr) {
10049         LDKEvent *obj = (LDKEvent*)untag_ptr(ptr);
10050         assert(obj->tag == LDKEvent_ChannelPending);
10051         LDKOutPoint funding_txo_var = obj->channel_pending.funding_txo;
10052                         uint64_t funding_txo_ref = 0;
10053                         CHECK_INNER_FIELD_ACCESS_OR_NULL(funding_txo_var);
10054                         funding_txo_ref = tag_ptr(funding_txo_var.inner, false);
10055         return funding_txo_ref;
10056 }
10057 int8_tArray __attribute__((export_name("TS_LDKEvent_ChannelReady_get_channel_id"))) TS_LDKEvent_ChannelReady_get_channel_id(uint64_t ptr) {
10058         LDKEvent *obj = (LDKEvent*)untag_ptr(ptr);
10059         assert(obj->tag == LDKEvent_ChannelReady);
10060         int8_tArray channel_id_arr = init_int8_tArray(32, __LINE__);
10061         memcpy(channel_id_arr->elems, obj->channel_ready.channel_id.data, 32);
10062         return channel_id_arr;
10063 }
10064 int8_tArray __attribute__((export_name("TS_LDKEvent_ChannelReady_get_user_channel_id"))) TS_LDKEvent_ChannelReady_get_user_channel_id(uint64_t ptr) {
10065         LDKEvent *obj = (LDKEvent*)untag_ptr(ptr);
10066         assert(obj->tag == LDKEvent_ChannelReady);
10067         int8_tArray user_channel_id_arr = init_int8_tArray(16, __LINE__);
10068         memcpy(user_channel_id_arr->elems, obj->channel_ready.user_channel_id.le_bytes, 16);
10069         return user_channel_id_arr;
10070 }
10071 int8_tArray __attribute__((export_name("TS_LDKEvent_ChannelReady_get_counterparty_node_id"))) TS_LDKEvent_ChannelReady_get_counterparty_node_id(uint64_t ptr) {
10072         LDKEvent *obj = (LDKEvent*)untag_ptr(ptr);
10073         assert(obj->tag == LDKEvent_ChannelReady);
10074         int8_tArray counterparty_node_id_arr = init_int8_tArray(33, __LINE__);
10075         memcpy(counterparty_node_id_arr->elems, obj->channel_ready.counterparty_node_id.compressed_form, 33);
10076         return counterparty_node_id_arr;
10077 }
10078 uint64_t __attribute__((export_name("TS_LDKEvent_ChannelReady_get_channel_type"))) TS_LDKEvent_ChannelReady_get_channel_type(uint64_t ptr) {
10079         LDKEvent *obj = (LDKEvent*)untag_ptr(ptr);
10080         assert(obj->tag == LDKEvent_ChannelReady);
10081         LDKChannelTypeFeatures channel_type_var = obj->channel_ready.channel_type;
10082                         uint64_t channel_type_ref = 0;
10083                         CHECK_INNER_FIELD_ACCESS_OR_NULL(channel_type_var);
10084                         channel_type_ref = tag_ptr(channel_type_var.inner, false);
10085         return channel_type_ref;
10086 }
10087 int8_tArray __attribute__((export_name("TS_LDKEvent_ChannelClosed_get_channel_id"))) TS_LDKEvent_ChannelClosed_get_channel_id(uint64_t ptr) {
10088         LDKEvent *obj = (LDKEvent*)untag_ptr(ptr);
10089         assert(obj->tag == LDKEvent_ChannelClosed);
10090         int8_tArray channel_id_arr = init_int8_tArray(32, __LINE__);
10091         memcpy(channel_id_arr->elems, obj->channel_closed.channel_id.data, 32);
10092         return channel_id_arr;
10093 }
10094 int8_tArray __attribute__((export_name("TS_LDKEvent_ChannelClosed_get_user_channel_id"))) TS_LDKEvent_ChannelClosed_get_user_channel_id(uint64_t ptr) {
10095         LDKEvent *obj = (LDKEvent*)untag_ptr(ptr);
10096         assert(obj->tag == LDKEvent_ChannelClosed);
10097         int8_tArray user_channel_id_arr = init_int8_tArray(16, __LINE__);
10098         memcpy(user_channel_id_arr->elems, obj->channel_closed.user_channel_id.le_bytes, 16);
10099         return user_channel_id_arr;
10100 }
10101 uint64_t __attribute__((export_name("TS_LDKEvent_ChannelClosed_get_reason"))) TS_LDKEvent_ChannelClosed_get_reason(uint64_t ptr) {
10102         LDKEvent *obj = (LDKEvent*)untag_ptr(ptr);
10103         assert(obj->tag == LDKEvent_ChannelClosed);
10104         uint64_t reason_ref = tag_ptr(&obj->channel_closed.reason, false);
10105         return reason_ref;
10106 }
10107 int8_tArray __attribute__((export_name("TS_LDKEvent_ChannelClosed_get_counterparty_node_id"))) TS_LDKEvent_ChannelClosed_get_counterparty_node_id(uint64_t ptr) {
10108         LDKEvent *obj = (LDKEvent*)untag_ptr(ptr);
10109         assert(obj->tag == LDKEvent_ChannelClosed);
10110         int8_tArray counterparty_node_id_arr = init_int8_tArray(33, __LINE__);
10111         memcpy(counterparty_node_id_arr->elems, obj->channel_closed.counterparty_node_id.compressed_form, 33);
10112         return counterparty_node_id_arr;
10113 }
10114 uint64_t __attribute__((export_name("TS_LDKEvent_ChannelClosed_get_channel_capacity_sats"))) TS_LDKEvent_ChannelClosed_get_channel_capacity_sats(uint64_t ptr) {
10115         LDKEvent *obj = (LDKEvent*)untag_ptr(ptr);
10116         assert(obj->tag == LDKEvent_ChannelClosed);
10117         uint64_t channel_capacity_sats_ref = tag_ptr(&obj->channel_closed.channel_capacity_sats, false);
10118         return channel_capacity_sats_ref;
10119 }
10120 int8_tArray __attribute__((export_name("TS_LDKEvent_DiscardFunding_get_channel_id"))) TS_LDKEvent_DiscardFunding_get_channel_id(uint64_t ptr) {
10121         LDKEvent *obj = (LDKEvent*)untag_ptr(ptr);
10122         assert(obj->tag == LDKEvent_DiscardFunding);
10123         int8_tArray channel_id_arr = init_int8_tArray(32, __LINE__);
10124         memcpy(channel_id_arr->elems, obj->discard_funding.channel_id.data, 32);
10125         return channel_id_arr;
10126 }
10127 int8_tArray __attribute__((export_name("TS_LDKEvent_DiscardFunding_get_transaction"))) TS_LDKEvent_DiscardFunding_get_transaction(uint64_t ptr) {
10128         LDKEvent *obj = (LDKEvent*)untag_ptr(ptr);
10129         assert(obj->tag == LDKEvent_DiscardFunding);
10130         LDKTransaction transaction_var = obj->discard_funding.transaction;
10131                         int8_tArray transaction_arr = init_int8_tArray(transaction_var.datalen, __LINE__);
10132                         memcpy(transaction_arr->elems, transaction_var.data, transaction_var.datalen);
10133         return transaction_arr;
10134 }
10135 int8_tArray __attribute__((export_name("TS_LDKEvent_OpenChannelRequest_get_temporary_channel_id"))) TS_LDKEvent_OpenChannelRequest_get_temporary_channel_id(uint64_t ptr) {
10136         LDKEvent *obj = (LDKEvent*)untag_ptr(ptr);
10137         assert(obj->tag == LDKEvent_OpenChannelRequest);
10138         int8_tArray temporary_channel_id_arr = init_int8_tArray(32, __LINE__);
10139         memcpy(temporary_channel_id_arr->elems, obj->open_channel_request.temporary_channel_id.data, 32);
10140         return temporary_channel_id_arr;
10141 }
10142 int8_tArray __attribute__((export_name("TS_LDKEvent_OpenChannelRequest_get_counterparty_node_id"))) TS_LDKEvent_OpenChannelRequest_get_counterparty_node_id(uint64_t ptr) {
10143         LDKEvent *obj = (LDKEvent*)untag_ptr(ptr);
10144         assert(obj->tag == LDKEvent_OpenChannelRequest);
10145         int8_tArray counterparty_node_id_arr = init_int8_tArray(33, __LINE__);
10146         memcpy(counterparty_node_id_arr->elems, obj->open_channel_request.counterparty_node_id.compressed_form, 33);
10147         return counterparty_node_id_arr;
10148 }
10149 int64_t __attribute__((export_name("TS_LDKEvent_OpenChannelRequest_get_funding_satoshis"))) TS_LDKEvent_OpenChannelRequest_get_funding_satoshis(uint64_t ptr) {
10150         LDKEvent *obj = (LDKEvent*)untag_ptr(ptr);
10151         assert(obj->tag == LDKEvent_OpenChannelRequest);
10152         int64_t funding_satoshis_conv = obj->open_channel_request.funding_satoshis;
10153         return funding_satoshis_conv;
10154 }
10155 int64_t __attribute__((export_name("TS_LDKEvent_OpenChannelRequest_get_push_msat"))) TS_LDKEvent_OpenChannelRequest_get_push_msat(uint64_t ptr) {
10156         LDKEvent *obj = (LDKEvent*)untag_ptr(ptr);
10157         assert(obj->tag == LDKEvent_OpenChannelRequest);
10158         int64_t push_msat_conv = obj->open_channel_request.push_msat;
10159         return push_msat_conv;
10160 }
10161 uint64_t __attribute__((export_name("TS_LDKEvent_OpenChannelRequest_get_channel_type"))) TS_LDKEvent_OpenChannelRequest_get_channel_type(uint64_t ptr) {
10162         LDKEvent *obj = (LDKEvent*)untag_ptr(ptr);
10163         assert(obj->tag == LDKEvent_OpenChannelRequest);
10164         LDKChannelTypeFeatures channel_type_var = obj->open_channel_request.channel_type;
10165                         uint64_t channel_type_ref = 0;
10166                         CHECK_INNER_FIELD_ACCESS_OR_NULL(channel_type_var);
10167                         channel_type_ref = tag_ptr(channel_type_var.inner, false);
10168         return channel_type_ref;
10169 }
10170 int8_tArray __attribute__((export_name("TS_LDKEvent_HTLCHandlingFailed_get_prev_channel_id"))) TS_LDKEvent_HTLCHandlingFailed_get_prev_channel_id(uint64_t ptr) {
10171         LDKEvent *obj = (LDKEvent*)untag_ptr(ptr);
10172         assert(obj->tag == LDKEvent_HTLCHandlingFailed);
10173         int8_tArray prev_channel_id_arr = init_int8_tArray(32, __LINE__);
10174         memcpy(prev_channel_id_arr->elems, obj->htlc_handling_failed.prev_channel_id.data, 32);
10175         return prev_channel_id_arr;
10176 }
10177 uint64_t __attribute__((export_name("TS_LDKEvent_HTLCHandlingFailed_get_failed_next_destination"))) TS_LDKEvent_HTLCHandlingFailed_get_failed_next_destination(uint64_t ptr) {
10178         LDKEvent *obj = (LDKEvent*)untag_ptr(ptr);
10179         assert(obj->tag == LDKEvent_HTLCHandlingFailed);
10180         uint64_t failed_next_destination_ref = tag_ptr(&obj->htlc_handling_failed.failed_next_destination, false);
10181         return failed_next_destination_ref;
10182 }
10183 uint64_t __attribute__((export_name("TS_LDKEvent_BumpTransaction_get_bump_transaction"))) TS_LDKEvent_BumpTransaction_get_bump_transaction(uint64_t ptr) {
10184         LDKEvent *obj = (LDKEvent*)untag_ptr(ptr);
10185         assert(obj->tag == LDKEvent_BumpTransaction);
10186         uint64_t bump_transaction_ref = tag_ptr(&obj->bump_transaction, false);
10187         return bump_transaction_ref;
10188 }
10189 uint32_t __attribute__((export_name("TS_LDKCOption_EventZ_ty_from_ptr"))) TS_LDKCOption_EventZ_ty_from_ptr(uint64_t ptr) {
10190         LDKCOption_EventZ *obj = (LDKCOption_EventZ*)untag_ptr(ptr);
10191         switch(obj->tag) {
10192                 case LDKCOption_EventZ_Some: return 0;
10193                 case LDKCOption_EventZ_None: return 1;
10194                 default: abort();
10195         }
10196 }
10197 uint64_t __attribute__((export_name("TS_LDKCOption_EventZ_Some_get_some"))) TS_LDKCOption_EventZ_Some_get_some(uint64_t ptr) {
10198         LDKCOption_EventZ *obj = (LDKCOption_EventZ*)untag_ptr(ptr);
10199         assert(obj->tag == LDKCOption_EventZ_Some);
10200         uint64_t some_ref = tag_ptr(&obj->some, false);
10201         return some_ref;
10202 }
10203 static inline struct LDKCOption_EventZ CResult_COption_EventZDecodeErrorZ_get_ok(LDKCResult_COption_EventZDecodeErrorZ *NONNULL_PTR owner){
10204 CHECK(owner->result_ok);
10205         return COption_EventZ_clone(&*owner->contents.result);
10206 }
10207 uint64_t  __attribute__((export_name("TS_CResult_COption_EventZDecodeErrorZ_get_ok"))) TS_CResult_COption_EventZDecodeErrorZ_get_ok(uint64_t owner) {
10208         LDKCResult_COption_EventZDecodeErrorZ* owner_conv = (LDKCResult_COption_EventZDecodeErrorZ*)untag_ptr(owner);
10209         LDKCOption_EventZ *ret_copy = MALLOC(sizeof(LDKCOption_EventZ), "LDKCOption_EventZ");
10210         *ret_copy = CResult_COption_EventZDecodeErrorZ_get_ok(owner_conv);
10211         uint64_t ret_ref = tag_ptr(ret_copy, true);
10212         return ret_ref;
10213 }
10214
10215 static inline struct LDKDecodeError CResult_COption_EventZDecodeErrorZ_get_err(LDKCResult_COption_EventZDecodeErrorZ *NONNULL_PTR owner){
10216 CHECK(!owner->result_ok);
10217         return DecodeError_clone(&*owner->contents.err);
10218 }
10219 uint64_t  __attribute__((export_name("TS_CResult_COption_EventZDecodeErrorZ_get_err"))) TS_CResult_COption_EventZDecodeErrorZ_get_err(uint64_t owner) {
10220         LDKCResult_COption_EventZDecodeErrorZ* owner_conv = (LDKCResult_COption_EventZDecodeErrorZ*)untag_ptr(owner);
10221         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
10222         *ret_copy = CResult_COption_EventZDecodeErrorZ_get_err(owner_conv);
10223         uint64_t ret_ref = tag_ptr(ret_copy, true);
10224         return ret_ref;
10225 }
10226
10227 uint32_t __attribute__((export_name("TS_LDKBolt11ParseError_ty_from_ptr"))) TS_LDKBolt11ParseError_ty_from_ptr(uint64_t ptr) {
10228         LDKBolt11ParseError *obj = (LDKBolt11ParseError*)untag_ptr(ptr);
10229         switch(obj->tag) {
10230                 case LDKBolt11ParseError_Bech32Error: return 0;
10231                 case LDKBolt11ParseError_ParseAmountError: return 1;
10232                 case LDKBolt11ParseError_MalformedSignature: return 2;
10233                 case LDKBolt11ParseError_BadPrefix: return 3;
10234                 case LDKBolt11ParseError_UnknownCurrency: return 4;
10235                 case LDKBolt11ParseError_UnknownSiPrefix: return 5;
10236                 case LDKBolt11ParseError_MalformedHRP: return 6;
10237                 case LDKBolt11ParseError_TooShortDataPart: return 7;
10238                 case LDKBolt11ParseError_UnexpectedEndOfTaggedFields: return 8;
10239                 case LDKBolt11ParseError_DescriptionDecodeError: return 9;
10240                 case LDKBolt11ParseError_PaddingError: return 10;
10241                 case LDKBolt11ParseError_IntegerOverflowError: return 11;
10242                 case LDKBolt11ParseError_InvalidSegWitProgramLength: return 12;
10243                 case LDKBolt11ParseError_InvalidPubKeyHashLength: return 13;
10244                 case LDKBolt11ParseError_InvalidScriptHashLength: return 14;
10245                 case LDKBolt11ParseError_InvalidRecoveryId: return 15;
10246                 case LDKBolt11ParseError_InvalidSliceLength: return 16;
10247                 case LDKBolt11ParseError_Skip: return 17;
10248                 default: abort();
10249         }
10250 }
10251 uint64_t __attribute__((export_name("TS_LDKBolt11ParseError_Bech32Error_get_bech32_error"))) TS_LDKBolt11ParseError_Bech32Error_get_bech32_error(uint64_t ptr) {
10252         LDKBolt11ParseError *obj = (LDKBolt11ParseError*)untag_ptr(ptr);
10253         assert(obj->tag == LDKBolt11ParseError_Bech32Error);
10254         uint64_t bech32_error_ref = tag_ptr(&obj->bech32_error, false);
10255         return bech32_error_ref;
10256 }
10257 int32_t __attribute__((export_name("TS_LDKBolt11ParseError_ParseAmountError_get_parse_amount_error"))) TS_LDKBolt11ParseError_ParseAmountError_get_parse_amount_error(uint64_t ptr) {
10258         LDKBolt11ParseError *obj = (LDKBolt11ParseError*)untag_ptr(ptr);
10259         assert(obj->tag == LDKBolt11ParseError_ParseAmountError);
10260         /*obj->parse_amount_error*/
10261         return 0;
10262 }
10263 uint32_t __attribute__((export_name("TS_LDKBolt11ParseError_MalformedSignature_get_malformed_signature"))) TS_LDKBolt11ParseError_MalformedSignature_get_malformed_signature(uint64_t ptr) {
10264         LDKBolt11ParseError *obj = (LDKBolt11ParseError*)untag_ptr(ptr);
10265         assert(obj->tag == LDKBolt11ParseError_MalformedSignature);
10266         uint32_t malformed_signature_conv = LDKSecp256k1Error_to_js(obj->malformed_signature);
10267         return malformed_signature_conv;
10268 }
10269 int32_t __attribute__((export_name("TS_LDKBolt11ParseError_DescriptionDecodeError_get_description_decode_error"))) TS_LDKBolt11ParseError_DescriptionDecodeError_get_description_decode_error(uint64_t ptr) {
10270         LDKBolt11ParseError *obj = (LDKBolt11ParseError*)untag_ptr(ptr);
10271         assert(obj->tag == LDKBolt11ParseError_DescriptionDecodeError);
10272         /*obj->description_decode_error*/
10273         return 0;
10274 }
10275 jstring __attribute__((export_name("TS_LDKBolt11ParseError_InvalidSliceLength_get_invalid_slice_length"))) TS_LDKBolt11ParseError_InvalidSliceLength_get_invalid_slice_length(uint64_t ptr) {
10276         LDKBolt11ParseError *obj = (LDKBolt11ParseError*)untag_ptr(ptr);
10277         assert(obj->tag == LDKBolt11ParseError_InvalidSliceLength);
10278         LDKStr invalid_slice_length_str = obj->invalid_slice_length;
10279                         jstring invalid_slice_length_conv = str_ref_to_ts(invalid_slice_length_str.chars, invalid_slice_length_str.len);
10280         return invalid_slice_length_conv;
10281 }
10282 static inline enum LDKSiPrefix CResult_SiPrefixBolt11ParseErrorZ_get_ok(LDKCResult_SiPrefixBolt11ParseErrorZ *NONNULL_PTR owner){
10283 CHECK(owner->result_ok);
10284         return SiPrefix_clone(&*owner->contents.result);
10285 }
10286 uint32_t  __attribute__((export_name("TS_CResult_SiPrefixBolt11ParseErrorZ_get_ok"))) TS_CResult_SiPrefixBolt11ParseErrorZ_get_ok(uint64_t owner) {
10287         LDKCResult_SiPrefixBolt11ParseErrorZ* owner_conv = (LDKCResult_SiPrefixBolt11ParseErrorZ*)untag_ptr(owner);
10288         uint32_t ret_conv = LDKSiPrefix_to_js(CResult_SiPrefixBolt11ParseErrorZ_get_ok(owner_conv));
10289         return ret_conv;
10290 }
10291
10292 static inline struct LDKBolt11ParseError CResult_SiPrefixBolt11ParseErrorZ_get_err(LDKCResult_SiPrefixBolt11ParseErrorZ *NONNULL_PTR owner){
10293 CHECK(!owner->result_ok);
10294         return Bolt11ParseError_clone(&*owner->contents.err);
10295 }
10296 uint64_t  __attribute__((export_name("TS_CResult_SiPrefixBolt11ParseErrorZ_get_err"))) TS_CResult_SiPrefixBolt11ParseErrorZ_get_err(uint64_t owner) {
10297         LDKCResult_SiPrefixBolt11ParseErrorZ* owner_conv = (LDKCResult_SiPrefixBolt11ParseErrorZ*)untag_ptr(owner);
10298         LDKBolt11ParseError *ret_copy = MALLOC(sizeof(LDKBolt11ParseError), "LDKBolt11ParseError");
10299         *ret_copy = CResult_SiPrefixBolt11ParseErrorZ_get_err(owner_conv);
10300         uint64_t ret_ref = tag_ptr(ret_copy, true);
10301         return ret_ref;
10302 }
10303
10304 uint32_t __attribute__((export_name("TS_LDKParseOrSemanticError_ty_from_ptr"))) TS_LDKParseOrSemanticError_ty_from_ptr(uint64_t ptr) {
10305         LDKParseOrSemanticError *obj = (LDKParseOrSemanticError*)untag_ptr(ptr);
10306         switch(obj->tag) {
10307                 case LDKParseOrSemanticError_ParseError: return 0;
10308                 case LDKParseOrSemanticError_SemanticError: return 1;
10309                 default: abort();
10310         }
10311 }
10312 uint64_t __attribute__((export_name("TS_LDKParseOrSemanticError_ParseError_get_parse_error"))) TS_LDKParseOrSemanticError_ParseError_get_parse_error(uint64_t ptr) {
10313         LDKParseOrSemanticError *obj = (LDKParseOrSemanticError*)untag_ptr(ptr);
10314         assert(obj->tag == LDKParseOrSemanticError_ParseError);
10315         uint64_t parse_error_ref = tag_ptr(&obj->parse_error, false);
10316         return parse_error_ref;
10317 }
10318 uint32_t __attribute__((export_name("TS_LDKParseOrSemanticError_SemanticError_get_semantic_error"))) TS_LDKParseOrSemanticError_SemanticError_get_semantic_error(uint64_t ptr) {
10319         LDKParseOrSemanticError *obj = (LDKParseOrSemanticError*)untag_ptr(ptr);
10320         assert(obj->tag == LDKParseOrSemanticError_SemanticError);
10321         uint32_t semantic_error_conv = LDKBolt11SemanticError_to_js(obj->semantic_error);
10322         return semantic_error_conv;
10323 }
10324 static inline struct LDKBolt11Invoice CResult_Bolt11InvoiceParseOrSemanticErrorZ_get_ok(LDKCResult_Bolt11InvoiceParseOrSemanticErrorZ *NONNULL_PTR owner){
10325         LDKBolt11Invoice ret = *owner->contents.result;
10326         ret.is_owned = false;
10327         return ret;
10328 }
10329 uint64_t  __attribute__((export_name("TS_CResult_Bolt11InvoiceParseOrSemanticErrorZ_get_ok"))) TS_CResult_Bolt11InvoiceParseOrSemanticErrorZ_get_ok(uint64_t owner) {
10330         LDKCResult_Bolt11InvoiceParseOrSemanticErrorZ* owner_conv = (LDKCResult_Bolt11InvoiceParseOrSemanticErrorZ*)untag_ptr(owner);
10331         LDKBolt11Invoice ret_var = CResult_Bolt11InvoiceParseOrSemanticErrorZ_get_ok(owner_conv);
10332         uint64_t ret_ref = 0;
10333         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
10334         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
10335         return ret_ref;
10336 }
10337
10338 static inline struct LDKParseOrSemanticError CResult_Bolt11InvoiceParseOrSemanticErrorZ_get_err(LDKCResult_Bolt11InvoiceParseOrSemanticErrorZ *NONNULL_PTR owner){
10339 CHECK(!owner->result_ok);
10340         return ParseOrSemanticError_clone(&*owner->contents.err);
10341 }
10342 uint64_t  __attribute__((export_name("TS_CResult_Bolt11InvoiceParseOrSemanticErrorZ_get_err"))) TS_CResult_Bolt11InvoiceParseOrSemanticErrorZ_get_err(uint64_t owner) {
10343         LDKCResult_Bolt11InvoiceParseOrSemanticErrorZ* owner_conv = (LDKCResult_Bolt11InvoiceParseOrSemanticErrorZ*)untag_ptr(owner);
10344         LDKParseOrSemanticError *ret_copy = MALLOC(sizeof(LDKParseOrSemanticError), "LDKParseOrSemanticError");
10345         *ret_copy = CResult_Bolt11InvoiceParseOrSemanticErrorZ_get_err(owner_conv);
10346         uint64_t ret_ref = tag_ptr(ret_copy, true);
10347         return ret_ref;
10348 }
10349
10350 static inline struct LDKSignedRawBolt11Invoice CResult_SignedRawBolt11InvoiceBolt11ParseErrorZ_get_ok(LDKCResult_SignedRawBolt11InvoiceBolt11ParseErrorZ *NONNULL_PTR owner){
10351         LDKSignedRawBolt11Invoice ret = *owner->contents.result;
10352         ret.is_owned = false;
10353         return ret;
10354 }
10355 uint64_t  __attribute__((export_name("TS_CResult_SignedRawBolt11InvoiceBolt11ParseErrorZ_get_ok"))) TS_CResult_SignedRawBolt11InvoiceBolt11ParseErrorZ_get_ok(uint64_t owner) {
10356         LDKCResult_SignedRawBolt11InvoiceBolt11ParseErrorZ* owner_conv = (LDKCResult_SignedRawBolt11InvoiceBolt11ParseErrorZ*)untag_ptr(owner);
10357         LDKSignedRawBolt11Invoice ret_var = CResult_SignedRawBolt11InvoiceBolt11ParseErrorZ_get_ok(owner_conv);
10358         uint64_t ret_ref = 0;
10359         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
10360         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
10361         return ret_ref;
10362 }
10363
10364 static inline struct LDKBolt11ParseError CResult_SignedRawBolt11InvoiceBolt11ParseErrorZ_get_err(LDKCResult_SignedRawBolt11InvoiceBolt11ParseErrorZ *NONNULL_PTR owner){
10365 CHECK(!owner->result_ok);
10366         return Bolt11ParseError_clone(&*owner->contents.err);
10367 }
10368 uint64_t  __attribute__((export_name("TS_CResult_SignedRawBolt11InvoiceBolt11ParseErrorZ_get_err"))) TS_CResult_SignedRawBolt11InvoiceBolt11ParseErrorZ_get_err(uint64_t owner) {
10369         LDKCResult_SignedRawBolt11InvoiceBolt11ParseErrorZ* owner_conv = (LDKCResult_SignedRawBolt11InvoiceBolt11ParseErrorZ*)untag_ptr(owner);
10370         LDKBolt11ParseError *ret_copy = MALLOC(sizeof(LDKBolt11ParseError), "LDKBolt11ParseError");
10371         *ret_copy = CResult_SignedRawBolt11InvoiceBolt11ParseErrorZ_get_err(owner_conv);
10372         uint64_t ret_ref = tag_ptr(ret_copy, true);
10373         return ret_ref;
10374 }
10375
10376 static inline struct LDKRawBolt11Invoice C3Tuple_RawBolt11Invoice_u832Bolt11InvoiceSignatureZ_get_a(LDKC3Tuple_RawBolt11Invoice_u832Bolt11InvoiceSignatureZ *NONNULL_PTR owner){
10377         LDKRawBolt11Invoice ret = owner->a;
10378         ret.is_owned = false;
10379         return ret;
10380 }
10381 uint64_t  __attribute__((export_name("TS_C3Tuple_RawBolt11Invoice_u832Bolt11InvoiceSignatureZ_get_a"))) TS_C3Tuple_RawBolt11Invoice_u832Bolt11InvoiceSignatureZ_get_a(uint64_t owner) {
10382         LDKC3Tuple_RawBolt11Invoice_u832Bolt11InvoiceSignatureZ* owner_conv = (LDKC3Tuple_RawBolt11Invoice_u832Bolt11InvoiceSignatureZ*)untag_ptr(owner);
10383         LDKRawBolt11Invoice ret_var = C3Tuple_RawBolt11Invoice_u832Bolt11InvoiceSignatureZ_get_a(owner_conv);
10384         uint64_t ret_ref = 0;
10385         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
10386         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
10387         return ret_ref;
10388 }
10389
10390 static inline struct LDKThirtyTwoBytes C3Tuple_RawBolt11Invoice_u832Bolt11InvoiceSignatureZ_get_b(LDKC3Tuple_RawBolt11Invoice_u832Bolt11InvoiceSignatureZ *NONNULL_PTR owner){
10391         return ThirtyTwoBytes_clone(&owner->b);
10392 }
10393 int8_tArray  __attribute__((export_name("TS_C3Tuple_RawBolt11Invoice_u832Bolt11InvoiceSignatureZ_get_b"))) TS_C3Tuple_RawBolt11Invoice_u832Bolt11InvoiceSignatureZ_get_b(uint64_t owner) {
10394         LDKC3Tuple_RawBolt11Invoice_u832Bolt11InvoiceSignatureZ* owner_conv = (LDKC3Tuple_RawBolt11Invoice_u832Bolt11InvoiceSignatureZ*)untag_ptr(owner);
10395         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
10396         memcpy(ret_arr->elems, C3Tuple_RawBolt11Invoice_u832Bolt11InvoiceSignatureZ_get_b(owner_conv).data, 32);
10397         return ret_arr;
10398 }
10399
10400 static inline struct LDKBolt11InvoiceSignature C3Tuple_RawBolt11Invoice_u832Bolt11InvoiceSignatureZ_get_c(LDKC3Tuple_RawBolt11Invoice_u832Bolt11InvoiceSignatureZ *NONNULL_PTR owner){
10401         LDKBolt11InvoiceSignature ret = owner->c;
10402         ret.is_owned = false;
10403         return ret;
10404 }
10405 uint64_t  __attribute__((export_name("TS_C3Tuple_RawBolt11Invoice_u832Bolt11InvoiceSignatureZ_get_c"))) TS_C3Tuple_RawBolt11Invoice_u832Bolt11InvoiceSignatureZ_get_c(uint64_t owner) {
10406         LDKC3Tuple_RawBolt11Invoice_u832Bolt11InvoiceSignatureZ* owner_conv = (LDKC3Tuple_RawBolt11Invoice_u832Bolt11InvoiceSignatureZ*)untag_ptr(owner);
10407         LDKBolt11InvoiceSignature ret_var = C3Tuple_RawBolt11Invoice_u832Bolt11InvoiceSignatureZ_get_c(owner_conv);
10408         uint64_t ret_ref = 0;
10409         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
10410         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
10411         return ret_ref;
10412 }
10413
10414 static inline struct LDKPayeePubKey CResult_PayeePubKeySecp256k1ErrorZ_get_ok(LDKCResult_PayeePubKeySecp256k1ErrorZ *NONNULL_PTR owner){
10415         LDKPayeePubKey ret = *owner->contents.result;
10416         ret.is_owned = false;
10417         return ret;
10418 }
10419 uint64_t  __attribute__((export_name("TS_CResult_PayeePubKeySecp256k1ErrorZ_get_ok"))) TS_CResult_PayeePubKeySecp256k1ErrorZ_get_ok(uint64_t owner) {
10420         LDKCResult_PayeePubKeySecp256k1ErrorZ* owner_conv = (LDKCResult_PayeePubKeySecp256k1ErrorZ*)untag_ptr(owner);
10421         LDKPayeePubKey ret_var = CResult_PayeePubKeySecp256k1ErrorZ_get_ok(owner_conv);
10422         uint64_t ret_ref = 0;
10423         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
10424         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
10425         return ret_ref;
10426 }
10427
10428 static inline enum LDKSecp256k1Error CResult_PayeePubKeySecp256k1ErrorZ_get_err(LDKCResult_PayeePubKeySecp256k1ErrorZ *NONNULL_PTR owner){
10429 CHECK(!owner->result_ok);
10430         return *owner->contents.err;
10431 }
10432 uint32_t  __attribute__((export_name("TS_CResult_PayeePubKeySecp256k1ErrorZ_get_err"))) TS_CResult_PayeePubKeySecp256k1ErrorZ_get_err(uint64_t owner) {
10433         LDKCResult_PayeePubKeySecp256k1ErrorZ* owner_conv = (LDKCResult_PayeePubKeySecp256k1ErrorZ*)untag_ptr(owner);
10434         uint32_t ret_conv = LDKSecp256k1Error_to_js(CResult_PayeePubKeySecp256k1ErrorZ_get_err(owner_conv));
10435         return ret_conv;
10436 }
10437
10438 static inline LDKCVec_PrivateRouteZ CVec_PrivateRouteZ_clone(const LDKCVec_PrivateRouteZ *orig) {
10439         LDKCVec_PrivateRouteZ ret = { .data = MALLOC(sizeof(LDKPrivateRoute) * orig->datalen, "LDKCVec_PrivateRouteZ clone bytes"), .datalen = orig->datalen };
10440         for (size_t i = 0; i < ret.datalen; i++) {
10441                 ret.data[i] = PrivateRoute_clone(&orig->data[i]);
10442         }
10443         return ret;
10444 }
10445 static inline struct LDKPositiveTimestamp CResult_PositiveTimestampCreationErrorZ_get_ok(LDKCResult_PositiveTimestampCreationErrorZ *NONNULL_PTR owner){
10446         LDKPositiveTimestamp ret = *owner->contents.result;
10447         ret.is_owned = false;
10448         return ret;
10449 }
10450 uint64_t  __attribute__((export_name("TS_CResult_PositiveTimestampCreationErrorZ_get_ok"))) TS_CResult_PositiveTimestampCreationErrorZ_get_ok(uint64_t owner) {
10451         LDKCResult_PositiveTimestampCreationErrorZ* owner_conv = (LDKCResult_PositiveTimestampCreationErrorZ*)untag_ptr(owner);
10452         LDKPositiveTimestamp ret_var = CResult_PositiveTimestampCreationErrorZ_get_ok(owner_conv);
10453         uint64_t ret_ref = 0;
10454         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
10455         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
10456         return ret_ref;
10457 }
10458
10459 static inline enum LDKCreationError CResult_PositiveTimestampCreationErrorZ_get_err(LDKCResult_PositiveTimestampCreationErrorZ *NONNULL_PTR owner){
10460 CHECK(!owner->result_ok);
10461         return CreationError_clone(&*owner->contents.err);
10462 }
10463 uint32_t  __attribute__((export_name("TS_CResult_PositiveTimestampCreationErrorZ_get_err"))) TS_CResult_PositiveTimestampCreationErrorZ_get_err(uint64_t owner) {
10464         LDKCResult_PositiveTimestampCreationErrorZ* owner_conv = (LDKCResult_PositiveTimestampCreationErrorZ*)untag_ptr(owner);
10465         uint32_t ret_conv = LDKCreationError_to_js(CResult_PositiveTimestampCreationErrorZ_get_err(owner_conv));
10466         return ret_conv;
10467 }
10468
10469 static inline void CResult_NoneBolt11SemanticErrorZ_get_ok(LDKCResult_NoneBolt11SemanticErrorZ *NONNULL_PTR owner){
10470 CHECK(owner->result_ok);
10471         return *owner->contents.result;
10472 }
10473 void  __attribute__((export_name("TS_CResult_NoneBolt11SemanticErrorZ_get_ok"))) TS_CResult_NoneBolt11SemanticErrorZ_get_ok(uint64_t owner) {
10474         LDKCResult_NoneBolt11SemanticErrorZ* owner_conv = (LDKCResult_NoneBolt11SemanticErrorZ*)untag_ptr(owner);
10475         CResult_NoneBolt11SemanticErrorZ_get_ok(owner_conv);
10476 }
10477
10478 static inline enum LDKBolt11SemanticError CResult_NoneBolt11SemanticErrorZ_get_err(LDKCResult_NoneBolt11SemanticErrorZ *NONNULL_PTR owner){
10479 CHECK(!owner->result_ok);
10480         return Bolt11SemanticError_clone(&*owner->contents.err);
10481 }
10482 uint32_t  __attribute__((export_name("TS_CResult_NoneBolt11SemanticErrorZ_get_err"))) TS_CResult_NoneBolt11SemanticErrorZ_get_err(uint64_t owner) {
10483         LDKCResult_NoneBolt11SemanticErrorZ* owner_conv = (LDKCResult_NoneBolt11SemanticErrorZ*)untag_ptr(owner);
10484         uint32_t ret_conv = LDKBolt11SemanticError_to_js(CResult_NoneBolt11SemanticErrorZ_get_err(owner_conv));
10485         return ret_conv;
10486 }
10487
10488 static inline struct LDKBolt11Invoice CResult_Bolt11InvoiceBolt11SemanticErrorZ_get_ok(LDKCResult_Bolt11InvoiceBolt11SemanticErrorZ *NONNULL_PTR owner){
10489         LDKBolt11Invoice ret = *owner->contents.result;
10490         ret.is_owned = false;
10491         return ret;
10492 }
10493 uint64_t  __attribute__((export_name("TS_CResult_Bolt11InvoiceBolt11SemanticErrorZ_get_ok"))) TS_CResult_Bolt11InvoiceBolt11SemanticErrorZ_get_ok(uint64_t owner) {
10494         LDKCResult_Bolt11InvoiceBolt11SemanticErrorZ* owner_conv = (LDKCResult_Bolt11InvoiceBolt11SemanticErrorZ*)untag_ptr(owner);
10495         LDKBolt11Invoice ret_var = CResult_Bolt11InvoiceBolt11SemanticErrorZ_get_ok(owner_conv);
10496         uint64_t ret_ref = 0;
10497         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
10498         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
10499         return ret_ref;
10500 }
10501
10502 static inline enum LDKBolt11SemanticError CResult_Bolt11InvoiceBolt11SemanticErrorZ_get_err(LDKCResult_Bolt11InvoiceBolt11SemanticErrorZ *NONNULL_PTR owner){
10503 CHECK(!owner->result_ok);
10504         return Bolt11SemanticError_clone(&*owner->contents.err);
10505 }
10506 uint32_t  __attribute__((export_name("TS_CResult_Bolt11InvoiceBolt11SemanticErrorZ_get_err"))) TS_CResult_Bolt11InvoiceBolt11SemanticErrorZ_get_err(uint64_t owner) {
10507         LDKCResult_Bolt11InvoiceBolt11SemanticErrorZ* owner_conv = (LDKCResult_Bolt11InvoiceBolt11SemanticErrorZ*)untag_ptr(owner);
10508         uint32_t ret_conv = LDKBolt11SemanticError_to_js(CResult_Bolt11InvoiceBolt11SemanticErrorZ_get_err(owner_conv));
10509         return ret_conv;
10510 }
10511
10512 static inline struct LDKDescription CResult_DescriptionCreationErrorZ_get_ok(LDKCResult_DescriptionCreationErrorZ *NONNULL_PTR owner){
10513         LDKDescription ret = *owner->contents.result;
10514         ret.is_owned = false;
10515         return ret;
10516 }
10517 uint64_t  __attribute__((export_name("TS_CResult_DescriptionCreationErrorZ_get_ok"))) TS_CResult_DescriptionCreationErrorZ_get_ok(uint64_t owner) {
10518         LDKCResult_DescriptionCreationErrorZ* owner_conv = (LDKCResult_DescriptionCreationErrorZ*)untag_ptr(owner);
10519         LDKDescription ret_var = CResult_DescriptionCreationErrorZ_get_ok(owner_conv);
10520         uint64_t ret_ref = 0;
10521         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
10522         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
10523         return ret_ref;
10524 }
10525
10526 static inline enum LDKCreationError CResult_DescriptionCreationErrorZ_get_err(LDKCResult_DescriptionCreationErrorZ *NONNULL_PTR owner){
10527 CHECK(!owner->result_ok);
10528         return CreationError_clone(&*owner->contents.err);
10529 }
10530 uint32_t  __attribute__((export_name("TS_CResult_DescriptionCreationErrorZ_get_err"))) TS_CResult_DescriptionCreationErrorZ_get_err(uint64_t owner) {
10531         LDKCResult_DescriptionCreationErrorZ* owner_conv = (LDKCResult_DescriptionCreationErrorZ*)untag_ptr(owner);
10532         uint32_t ret_conv = LDKCreationError_to_js(CResult_DescriptionCreationErrorZ_get_err(owner_conv));
10533         return ret_conv;
10534 }
10535
10536 static inline struct LDKPrivateRoute CResult_PrivateRouteCreationErrorZ_get_ok(LDKCResult_PrivateRouteCreationErrorZ *NONNULL_PTR owner){
10537         LDKPrivateRoute ret = *owner->contents.result;
10538         ret.is_owned = false;
10539         return ret;
10540 }
10541 uint64_t  __attribute__((export_name("TS_CResult_PrivateRouteCreationErrorZ_get_ok"))) TS_CResult_PrivateRouteCreationErrorZ_get_ok(uint64_t owner) {
10542         LDKCResult_PrivateRouteCreationErrorZ* owner_conv = (LDKCResult_PrivateRouteCreationErrorZ*)untag_ptr(owner);
10543         LDKPrivateRoute ret_var = CResult_PrivateRouteCreationErrorZ_get_ok(owner_conv);
10544         uint64_t ret_ref = 0;
10545         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
10546         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
10547         return ret_ref;
10548 }
10549
10550 static inline enum LDKCreationError CResult_PrivateRouteCreationErrorZ_get_err(LDKCResult_PrivateRouteCreationErrorZ *NONNULL_PTR owner){
10551 CHECK(!owner->result_ok);
10552         return CreationError_clone(&*owner->contents.err);
10553 }
10554 uint32_t  __attribute__((export_name("TS_CResult_PrivateRouteCreationErrorZ_get_err"))) TS_CResult_PrivateRouteCreationErrorZ_get_err(uint64_t owner) {
10555         LDKCResult_PrivateRouteCreationErrorZ* owner_conv = (LDKCResult_PrivateRouteCreationErrorZ*)untag_ptr(owner);
10556         uint32_t ret_conv = LDKCreationError_to_js(CResult_PrivateRouteCreationErrorZ_get_err(owner_conv));
10557         return ret_conv;
10558 }
10559
10560 static inline struct LDKOutPoint CResult_OutPointDecodeErrorZ_get_ok(LDKCResult_OutPointDecodeErrorZ *NONNULL_PTR owner){
10561         LDKOutPoint ret = *owner->contents.result;
10562         ret.is_owned = false;
10563         return ret;
10564 }
10565 uint64_t  __attribute__((export_name("TS_CResult_OutPointDecodeErrorZ_get_ok"))) TS_CResult_OutPointDecodeErrorZ_get_ok(uint64_t owner) {
10566         LDKCResult_OutPointDecodeErrorZ* owner_conv = (LDKCResult_OutPointDecodeErrorZ*)untag_ptr(owner);
10567         LDKOutPoint ret_var = CResult_OutPointDecodeErrorZ_get_ok(owner_conv);
10568         uint64_t ret_ref = 0;
10569         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
10570         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
10571         return ret_ref;
10572 }
10573
10574 static inline struct LDKDecodeError CResult_OutPointDecodeErrorZ_get_err(LDKCResult_OutPointDecodeErrorZ *NONNULL_PTR owner){
10575 CHECK(!owner->result_ok);
10576         return DecodeError_clone(&*owner->contents.err);
10577 }
10578 uint64_t  __attribute__((export_name("TS_CResult_OutPointDecodeErrorZ_get_err"))) TS_CResult_OutPointDecodeErrorZ_get_err(uint64_t owner) {
10579         LDKCResult_OutPointDecodeErrorZ* owner_conv = (LDKCResult_OutPointDecodeErrorZ*)untag_ptr(owner);
10580         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
10581         *ret_copy = CResult_OutPointDecodeErrorZ_get_err(owner_conv);
10582         uint64_t ret_ref = tag_ptr(ret_copy, true);
10583         return ret_ref;
10584 }
10585
10586 static inline struct LDKBigSize CResult_BigSizeDecodeErrorZ_get_ok(LDKCResult_BigSizeDecodeErrorZ *NONNULL_PTR owner){
10587         LDKBigSize ret = *owner->contents.result;
10588         ret.is_owned = false;
10589         return ret;
10590 }
10591 uint64_t  __attribute__((export_name("TS_CResult_BigSizeDecodeErrorZ_get_ok"))) TS_CResult_BigSizeDecodeErrorZ_get_ok(uint64_t owner) {
10592         LDKCResult_BigSizeDecodeErrorZ* owner_conv = (LDKCResult_BigSizeDecodeErrorZ*)untag_ptr(owner);
10593         LDKBigSize ret_var = CResult_BigSizeDecodeErrorZ_get_ok(owner_conv);
10594         uint64_t ret_ref = 0;
10595         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
10596         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
10597         return ret_ref;
10598 }
10599
10600 static inline struct LDKDecodeError CResult_BigSizeDecodeErrorZ_get_err(LDKCResult_BigSizeDecodeErrorZ *NONNULL_PTR owner){
10601 CHECK(!owner->result_ok);
10602         return DecodeError_clone(&*owner->contents.err);
10603 }
10604 uint64_t  __attribute__((export_name("TS_CResult_BigSizeDecodeErrorZ_get_err"))) TS_CResult_BigSizeDecodeErrorZ_get_err(uint64_t owner) {
10605         LDKCResult_BigSizeDecodeErrorZ* owner_conv = (LDKCResult_BigSizeDecodeErrorZ*)untag_ptr(owner);
10606         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
10607         *ret_copy = CResult_BigSizeDecodeErrorZ_get_err(owner_conv);
10608         uint64_t ret_ref = tag_ptr(ret_copy, true);
10609         return ret_ref;
10610 }
10611
10612 static inline struct LDKHostname CResult_HostnameDecodeErrorZ_get_ok(LDKCResult_HostnameDecodeErrorZ *NONNULL_PTR owner){
10613         LDKHostname ret = *owner->contents.result;
10614         ret.is_owned = false;
10615         return ret;
10616 }
10617 uint64_t  __attribute__((export_name("TS_CResult_HostnameDecodeErrorZ_get_ok"))) TS_CResult_HostnameDecodeErrorZ_get_ok(uint64_t owner) {
10618         LDKCResult_HostnameDecodeErrorZ* owner_conv = (LDKCResult_HostnameDecodeErrorZ*)untag_ptr(owner);
10619         LDKHostname ret_var = CResult_HostnameDecodeErrorZ_get_ok(owner_conv);
10620         uint64_t ret_ref = 0;
10621         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
10622         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
10623         return ret_ref;
10624 }
10625
10626 static inline struct LDKDecodeError CResult_HostnameDecodeErrorZ_get_err(LDKCResult_HostnameDecodeErrorZ *NONNULL_PTR owner){
10627 CHECK(!owner->result_ok);
10628         return DecodeError_clone(&*owner->contents.err);
10629 }
10630 uint64_t  __attribute__((export_name("TS_CResult_HostnameDecodeErrorZ_get_err"))) TS_CResult_HostnameDecodeErrorZ_get_err(uint64_t owner) {
10631         LDKCResult_HostnameDecodeErrorZ* owner_conv = (LDKCResult_HostnameDecodeErrorZ*)untag_ptr(owner);
10632         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
10633         *ret_copy = CResult_HostnameDecodeErrorZ_get_err(owner_conv);
10634         uint64_t ret_ref = tag_ptr(ret_copy, true);
10635         return ret_ref;
10636 }
10637
10638 static inline struct LDKTransactionU16LenLimited CResult_TransactionU16LenLimitedNoneZ_get_ok(LDKCResult_TransactionU16LenLimitedNoneZ *NONNULL_PTR owner){
10639         LDKTransactionU16LenLimited ret = *owner->contents.result;
10640         ret.is_owned = false;
10641         return ret;
10642 }
10643 uint64_t  __attribute__((export_name("TS_CResult_TransactionU16LenLimitedNoneZ_get_ok"))) TS_CResult_TransactionU16LenLimitedNoneZ_get_ok(uint64_t owner) {
10644         LDKCResult_TransactionU16LenLimitedNoneZ* owner_conv = (LDKCResult_TransactionU16LenLimitedNoneZ*)untag_ptr(owner);
10645         LDKTransactionU16LenLimited ret_var = CResult_TransactionU16LenLimitedNoneZ_get_ok(owner_conv);
10646         uint64_t ret_ref = 0;
10647         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
10648         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
10649         return ret_ref;
10650 }
10651
10652 static inline void CResult_TransactionU16LenLimitedNoneZ_get_err(LDKCResult_TransactionU16LenLimitedNoneZ *NONNULL_PTR owner){
10653 CHECK(!owner->result_ok);
10654         return *owner->contents.err;
10655 }
10656 void  __attribute__((export_name("TS_CResult_TransactionU16LenLimitedNoneZ_get_err"))) TS_CResult_TransactionU16LenLimitedNoneZ_get_err(uint64_t owner) {
10657         LDKCResult_TransactionU16LenLimitedNoneZ* owner_conv = (LDKCResult_TransactionU16LenLimitedNoneZ*)untag_ptr(owner);
10658         CResult_TransactionU16LenLimitedNoneZ_get_err(owner_conv);
10659 }
10660
10661 static inline struct LDKTransactionU16LenLimited CResult_TransactionU16LenLimitedDecodeErrorZ_get_ok(LDKCResult_TransactionU16LenLimitedDecodeErrorZ *NONNULL_PTR owner){
10662         LDKTransactionU16LenLimited ret = *owner->contents.result;
10663         ret.is_owned = false;
10664         return ret;
10665 }
10666 uint64_t  __attribute__((export_name("TS_CResult_TransactionU16LenLimitedDecodeErrorZ_get_ok"))) TS_CResult_TransactionU16LenLimitedDecodeErrorZ_get_ok(uint64_t owner) {
10667         LDKCResult_TransactionU16LenLimitedDecodeErrorZ* owner_conv = (LDKCResult_TransactionU16LenLimitedDecodeErrorZ*)untag_ptr(owner);
10668         LDKTransactionU16LenLimited ret_var = CResult_TransactionU16LenLimitedDecodeErrorZ_get_ok(owner_conv);
10669         uint64_t ret_ref = 0;
10670         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
10671         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
10672         return ret_ref;
10673 }
10674
10675 static inline struct LDKDecodeError CResult_TransactionU16LenLimitedDecodeErrorZ_get_err(LDKCResult_TransactionU16LenLimitedDecodeErrorZ *NONNULL_PTR owner){
10676 CHECK(!owner->result_ok);
10677         return DecodeError_clone(&*owner->contents.err);
10678 }
10679 uint64_t  __attribute__((export_name("TS_CResult_TransactionU16LenLimitedDecodeErrorZ_get_err"))) TS_CResult_TransactionU16LenLimitedDecodeErrorZ_get_err(uint64_t owner) {
10680         LDKCResult_TransactionU16LenLimitedDecodeErrorZ* owner_conv = (LDKCResult_TransactionU16LenLimitedDecodeErrorZ*)untag_ptr(owner);
10681         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
10682         *ret_copy = CResult_TransactionU16LenLimitedDecodeErrorZ_get_err(owner_conv);
10683         uint64_t ret_ref = tag_ptr(ret_copy, true);
10684         return ret_ref;
10685 }
10686
10687 static inline struct LDKUntrustedString CResult_UntrustedStringDecodeErrorZ_get_ok(LDKCResult_UntrustedStringDecodeErrorZ *NONNULL_PTR owner){
10688         LDKUntrustedString ret = *owner->contents.result;
10689         ret.is_owned = false;
10690         return ret;
10691 }
10692 uint64_t  __attribute__((export_name("TS_CResult_UntrustedStringDecodeErrorZ_get_ok"))) TS_CResult_UntrustedStringDecodeErrorZ_get_ok(uint64_t owner) {
10693         LDKCResult_UntrustedStringDecodeErrorZ* owner_conv = (LDKCResult_UntrustedStringDecodeErrorZ*)untag_ptr(owner);
10694         LDKUntrustedString ret_var = CResult_UntrustedStringDecodeErrorZ_get_ok(owner_conv);
10695         uint64_t ret_ref = 0;
10696         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
10697         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
10698         return ret_ref;
10699 }
10700
10701 static inline struct LDKDecodeError CResult_UntrustedStringDecodeErrorZ_get_err(LDKCResult_UntrustedStringDecodeErrorZ *NONNULL_PTR owner){
10702 CHECK(!owner->result_ok);
10703         return DecodeError_clone(&*owner->contents.err);
10704 }
10705 uint64_t  __attribute__((export_name("TS_CResult_UntrustedStringDecodeErrorZ_get_err"))) TS_CResult_UntrustedStringDecodeErrorZ_get_err(uint64_t owner) {
10706         LDKCResult_UntrustedStringDecodeErrorZ* owner_conv = (LDKCResult_UntrustedStringDecodeErrorZ*)untag_ptr(owner);
10707         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
10708         *ret_copy = CResult_UntrustedStringDecodeErrorZ_get_err(owner_conv);
10709         uint64_t ret_ref = tag_ptr(ret_copy, true);
10710         return ret_ref;
10711 }
10712
10713 static inline struct LDKReceiveTlvs CResult_ReceiveTlvsDecodeErrorZ_get_ok(LDKCResult_ReceiveTlvsDecodeErrorZ *NONNULL_PTR owner){
10714         LDKReceiveTlvs ret = *owner->contents.result;
10715         ret.is_owned = false;
10716         return ret;
10717 }
10718 uint64_t  __attribute__((export_name("TS_CResult_ReceiveTlvsDecodeErrorZ_get_ok"))) TS_CResult_ReceiveTlvsDecodeErrorZ_get_ok(uint64_t owner) {
10719         LDKCResult_ReceiveTlvsDecodeErrorZ* owner_conv = (LDKCResult_ReceiveTlvsDecodeErrorZ*)untag_ptr(owner);
10720         LDKReceiveTlvs ret_var = CResult_ReceiveTlvsDecodeErrorZ_get_ok(owner_conv);
10721         uint64_t ret_ref = 0;
10722         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
10723         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
10724         return ret_ref;
10725 }
10726
10727 static inline struct LDKDecodeError CResult_ReceiveTlvsDecodeErrorZ_get_err(LDKCResult_ReceiveTlvsDecodeErrorZ *NONNULL_PTR owner){
10728 CHECK(!owner->result_ok);
10729         return DecodeError_clone(&*owner->contents.err);
10730 }
10731 uint64_t  __attribute__((export_name("TS_CResult_ReceiveTlvsDecodeErrorZ_get_err"))) TS_CResult_ReceiveTlvsDecodeErrorZ_get_err(uint64_t owner) {
10732         LDKCResult_ReceiveTlvsDecodeErrorZ* owner_conv = (LDKCResult_ReceiveTlvsDecodeErrorZ*)untag_ptr(owner);
10733         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
10734         *ret_copy = CResult_ReceiveTlvsDecodeErrorZ_get_err(owner_conv);
10735         uint64_t ret_ref = tag_ptr(ret_copy, true);
10736         return ret_ref;
10737 }
10738
10739 static inline struct LDKPaymentRelay CResult_PaymentRelayDecodeErrorZ_get_ok(LDKCResult_PaymentRelayDecodeErrorZ *NONNULL_PTR owner){
10740         LDKPaymentRelay ret = *owner->contents.result;
10741         ret.is_owned = false;
10742         return ret;
10743 }
10744 uint64_t  __attribute__((export_name("TS_CResult_PaymentRelayDecodeErrorZ_get_ok"))) TS_CResult_PaymentRelayDecodeErrorZ_get_ok(uint64_t owner) {
10745         LDKCResult_PaymentRelayDecodeErrorZ* owner_conv = (LDKCResult_PaymentRelayDecodeErrorZ*)untag_ptr(owner);
10746         LDKPaymentRelay ret_var = CResult_PaymentRelayDecodeErrorZ_get_ok(owner_conv);
10747         uint64_t ret_ref = 0;
10748         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
10749         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
10750         return ret_ref;
10751 }
10752
10753 static inline struct LDKDecodeError CResult_PaymentRelayDecodeErrorZ_get_err(LDKCResult_PaymentRelayDecodeErrorZ *NONNULL_PTR owner){
10754 CHECK(!owner->result_ok);
10755         return DecodeError_clone(&*owner->contents.err);
10756 }
10757 uint64_t  __attribute__((export_name("TS_CResult_PaymentRelayDecodeErrorZ_get_err"))) TS_CResult_PaymentRelayDecodeErrorZ_get_err(uint64_t owner) {
10758         LDKCResult_PaymentRelayDecodeErrorZ* owner_conv = (LDKCResult_PaymentRelayDecodeErrorZ*)untag_ptr(owner);
10759         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
10760         *ret_copy = CResult_PaymentRelayDecodeErrorZ_get_err(owner_conv);
10761         uint64_t ret_ref = tag_ptr(ret_copy, true);
10762         return ret_ref;
10763 }
10764
10765 static inline struct LDKPaymentConstraints CResult_PaymentConstraintsDecodeErrorZ_get_ok(LDKCResult_PaymentConstraintsDecodeErrorZ *NONNULL_PTR owner){
10766         LDKPaymentConstraints ret = *owner->contents.result;
10767         ret.is_owned = false;
10768         return ret;
10769 }
10770 uint64_t  __attribute__((export_name("TS_CResult_PaymentConstraintsDecodeErrorZ_get_ok"))) TS_CResult_PaymentConstraintsDecodeErrorZ_get_ok(uint64_t owner) {
10771         LDKCResult_PaymentConstraintsDecodeErrorZ* owner_conv = (LDKCResult_PaymentConstraintsDecodeErrorZ*)untag_ptr(owner);
10772         LDKPaymentConstraints ret_var = CResult_PaymentConstraintsDecodeErrorZ_get_ok(owner_conv);
10773         uint64_t ret_ref = 0;
10774         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
10775         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
10776         return ret_ref;
10777 }
10778
10779 static inline struct LDKDecodeError CResult_PaymentConstraintsDecodeErrorZ_get_err(LDKCResult_PaymentConstraintsDecodeErrorZ *NONNULL_PTR owner){
10780 CHECK(!owner->result_ok);
10781         return DecodeError_clone(&*owner->contents.err);
10782 }
10783 uint64_t  __attribute__((export_name("TS_CResult_PaymentConstraintsDecodeErrorZ_get_err"))) TS_CResult_PaymentConstraintsDecodeErrorZ_get_err(uint64_t owner) {
10784         LDKCResult_PaymentConstraintsDecodeErrorZ* owner_conv = (LDKCResult_PaymentConstraintsDecodeErrorZ*)untag_ptr(owner);
10785         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
10786         *ret_copy = CResult_PaymentConstraintsDecodeErrorZ_get_err(owner_conv);
10787         uint64_t ret_ref = tag_ptr(ret_copy, true);
10788         return ret_ref;
10789 }
10790
10791 uint32_t __attribute__((export_name("TS_LDKPaymentError_ty_from_ptr"))) TS_LDKPaymentError_ty_from_ptr(uint64_t ptr) {
10792         LDKPaymentError *obj = (LDKPaymentError*)untag_ptr(ptr);
10793         switch(obj->tag) {
10794                 case LDKPaymentError_Invoice: return 0;
10795                 case LDKPaymentError_Sending: return 1;
10796                 default: abort();
10797         }
10798 }
10799 jstring __attribute__((export_name("TS_LDKPaymentError_Invoice_get_invoice"))) TS_LDKPaymentError_Invoice_get_invoice(uint64_t ptr) {
10800         LDKPaymentError *obj = (LDKPaymentError*)untag_ptr(ptr);
10801         assert(obj->tag == LDKPaymentError_Invoice);
10802         LDKStr invoice_str = obj->invoice;
10803                         jstring invoice_conv = str_ref_to_ts(invoice_str.chars, invoice_str.len);
10804         return invoice_conv;
10805 }
10806 uint32_t __attribute__((export_name("TS_LDKPaymentError_Sending_get_sending"))) TS_LDKPaymentError_Sending_get_sending(uint64_t ptr) {
10807         LDKPaymentError *obj = (LDKPaymentError*)untag_ptr(ptr);
10808         assert(obj->tag == LDKPaymentError_Sending);
10809         uint32_t sending_conv = LDKRetryableSendFailure_to_js(obj->sending);
10810         return sending_conv;
10811 }
10812 static inline struct LDKThirtyTwoBytes CResult_ThirtyTwoBytesPaymentErrorZ_get_ok(LDKCResult_ThirtyTwoBytesPaymentErrorZ *NONNULL_PTR owner){
10813 CHECK(owner->result_ok);
10814         return ThirtyTwoBytes_clone(&*owner->contents.result);
10815 }
10816 int8_tArray  __attribute__((export_name("TS_CResult_ThirtyTwoBytesPaymentErrorZ_get_ok"))) TS_CResult_ThirtyTwoBytesPaymentErrorZ_get_ok(uint64_t owner) {
10817         LDKCResult_ThirtyTwoBytesPaymentErrorZ* owner_conv = (LDKCResult_ThirtyTwoBytesPaymentErrorZ*)untag_ptr(owner);
10818         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
10819         memcpy(ret_arr->elems, CResult_ThirtyTwoBytesPaymentErrorZ_get_ok(owner_conv).data, 32);
10820         return ret_arr;
10821 }
10822
10823 static inline struct LDKPaymentError CResult_ThirtyTwoBytesPaymentErrorZ_get_err(LDKCResult_ThirtyTwoBytesPaymentErrorZ *NONNULL_PTR owner){
10824 CHECK(!owner->result_ok);
10825         return PaymentError_clone(&*owner->contents.err);
10826 }
10827 uint64_t  __attribute__((export_name("TS_CResult_ThirtyTwoBytesPaymentErrorZ_get_err"))) TS_CResult_ThirtyTwoBytesPaymentErrorZ_get_err(uint64_t owner) {
10828         LDKCResult_ThirtyTwoBytesPaymentErrorZ* owner_conv = (LDKCResult_ThirtyTwoBytesPaymentErrorZ*)untag_ptr(owner);
10829         LDKPaymentError *ret_copy = MALLOC(sizeof(LDKPaymentError), "LDKPaymentError");
10830         *ret_copy = CResult_ThirtyTwoBytesPaymentErrorZ_get_err(owner_conv);
10831         uint64_t ret_ref = tag_ptr(ret_copy, true);
10832         return ret_ref;
10833 }
10834
10835 static inline void CResult_NonePaymentErrorZ_get_ok(LDKCResult_NonePaymentErrorZ *NONNULL_PTR owner){
10836 CHECK(owner->result_ok);
10837         return *owner->contents.result;
10838 }
10839 void  __attribute__((export_name("TS_CResult_NonePaymentErrorZ_get_ok"))) TS_CResult_NonePaymentErrorZ_get_ok(uint64_t owner) {
10840         LDKCResult_NonePaymentErrorZ* owner_conv = (LDKCResult_NonePaymentErrorZ*)untag_ptr(owner);
10841         CResult_NonePaymentErrorZ_get_ok(owner_conv);
10842 }
10843
10844 static inline struct LDKPaymentError CResult_NonePaymentErrorZ_get_err(LDKCResult_NonePaymentErrorZ *NONNULL_PTR owner){
10845 CHECK(!owner->result_ok);
10846         return PaymentError_clone(&*owner->contents.err);
10847 }
10848 uint64_t  __attribute__((export_name("TS_CResult_NonePaymentErrorZ_get_err"))) TS_CResult_NonePaymentErrorZ_get_err(uint64_t owner) {
10849         LDKCResult_NonePaymentErrorZ* owner_conv = (LDKCResult_NonePaymentErrorZ*)untag_ptr(owner);
10850         LDKPaymentError *ret_copy = MALLOC(sizeof(LDKPaymentError), "LDKPaymentError");
10851         *ret_copy = CResult_NonePaymentErrorZ_get_err(owner_conv);
10852         uint64_t ret_ref = tag_ptr(ret_copy, true);
10853         return ret_ref;
10854 }
10855
10856 uint32_t __attribute__((export_name("TS_LDKProbingError_ty_from_ptr"))) TS_LDKProbingError_ty_from_ptr(uint64_t ptr) {
10857         LDKProbingError *obj = (LDKProbingError*)untag_ptr(ptr);
10858         switch(obj->tag) {
10859                 case LDKProbingError_Invoice: return 0;
10860                 case LDKProbingError_Sending: return 1;
10861                 default: abort();
10862         }
10863 }
10864 jstring __attribute__((export_name("TS_LDKProbingError_Invoice_get_invoice"))) TS_LDKProbingError_Invoice_get_invoice(uint64_t ptr) {
10865         LDKProbingError *obj = (LDKProbingError*)untag_ptr(ptr);
10866         assert(obj->tag == LDKProbingError_Invoice);
10867         LDKStr invoice_str = obj->invoice;
10868                         jstring invoice_conv = str_ref_to_ts(invoice_str.chars, invoice_str.len);
10869         return invoice_conv;
10870 }
10871 uint64_t __attribute__((export_name("TS_LDKProbingError_Sending_get_sending"))) TS_LDKProbingError_Sending_get_sending(uint64_t ptr) {
10872         LDKProbingError *obj = (LDKProbingError*)untag_ptr(ptr);
10873         assert(obj->tag == LDKProbingError_Sending);
10874         uint64_t sending_ref = tag_ptr(&obj->sending, false);
10875         return sending_ref;
10876 }
10877 static inline struct LDKCVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZ CResult_CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZProbingErrorZ_get_ok(LDKCResult_CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZProbingErrorZ *NONNULL_PTR owner){
10878 CHECK(owner->result_ok);
10879         return CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZ_clone(&*owner->contents.result);
10880 }
10881 uint64_tArray  __attribute__((export_name("TS_CResult_CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZProbingErrorZ_get_ok"))) TS_CResult_CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZProbingErrorZ_get_ok(uint64_t owner) {
10882         LDKCResult_CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZProbingErrorZ* owner_conv = (LDKCResult_CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZProbingErrorZ*)untag_ptr(owner);
10883         LDKCVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZ ret_var = CResult_CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZProbingErrorZ_get_ok(owner_conv);
10884         uint64_tArray ret_arr = NULL;
10885         ret_arr = init_uint64_tArray(ret_var.datalen, __LINE__);
10886         uint64_t *ret_arr_ptr = (uint64_t*)(((uint8_t*)ret_arr) + 8);
10887         for (size_t o = 0; o < ret_var.datalen; o++) {
10888                 LDKC2Tuple_ThirtyTwoBytesThirtyTwoBytesZ* ret_conv_40_conv = MALLOC(sizeof(LDKC2Tuple_ThirtyTwoBytesThirtyTwoBytesZ), "LDKC2Tuple_ThirtyTwoBytesThirtyTwoBytesZ");
10889                 *ret_conv_40_conv = ret_var.data[o];
10890                 ret_arr_ptr[o] = tag_ptr(ret_conv_40_conv, true);
10891         }
10892         
10893         FREE(ret_var.data);
10894         return ret_arr;
10895 }
10896
10897 static inline struct LDKProbingError CResult_CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZProbingErrorZ_get_err(LDKCResult_CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZProbingErrorZ *NONNULL_PTR owner){
10898 CHECK(!owner->result_ok);
10899         return ProbingError_clone(&*owner->contents.err);
10900 }
10901 uint64_t  __attribute__((export_name("TS_CResult_CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZProbingErrorZ_get_err"))) TS_CResult_CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZProbingErrorZ_get_err(uint64_t owner) {
10902         LDKCResult_CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZProbingErrorZ* owner_conv = (LDKCResult_CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZProbingErrorZ*)untag_ptr(owner);
10903         LDKProbingError *ret_copy = MALLOC(sizeof(LDKProbingError), "LDKProbingError");
10904         *ret_copy = CResult_CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZProbingErrorZ_get_err(owner_conv);
10905         uint64_t ret_ref = tag_ptr(ret_copy, true);
10906         return ret_ref;
10907 }
10908
10909 static inline struct LDKStr CResult_StrSecp256k1ErrorZ_get_ok(LDKCResult_StrSecp256k1ErrorZ *NONNULL_PTR owner){
10910 CHECK(owner->result_ok);
10911         return *owner->contents.result;
10912 }
10913 jstring  __attribute__((export_name("TS_CResult_StrSecp256k1ErrorZ_get_ok"))) TS_CResult_StrSecp256k1ErrorZ_get_ok(uint64_t owner) {
10914         LDKCResult_StrSecp256k1ErrorZ* owner_conv = (LDKCResult_StrSecp256k1ErrorZ*)untag_ptr(owner);
10915         LDKStr ret_str = CResult_StrSecp256k1ErrorZ_get_ok(owner_conv);
10916         jstring ret_conv = str_ref_to_ts(ret_str.chars, ret_str.len);
10917         return ret_conv;
10918 }
10919
10920 static inline enum LDKSecp256k1Error CResult_StrSecp256k1ErrorZ_get_err(LDKCResult_StrSecp256k1ErrorZ *NONNULL_PTR owner){
10921 CHECK(!owner->result_ok);
10922         return *owner->contents.err;
10923 }
10924 uint32_t  __attribute__((export_name("TS_CResult_StrSecp256k1ErrorZ_get_err"))) TS_CResult_StrSecp256k1ErrorZ_get_err(uint64_t owner) {
10925         LDKCResult_StrSecp256k1ErrorZ* owner_conv = (LDKCResult_StrSecp256k1ErrorZ*)untag_ptr(owner);
10926         uint32_t ret_conv = LDKSecp256k1Error_to_js(CResult_StrSecp256k1ErrorZ_get_err(owner_conv));
10927         return ret_conv;
10928 }
10929
10930 static inline struct LDKOnionMessagePath CResult_OnionMessagePathNoneZ_get_ok(LDKCResult_OnionMessagePathNoneZ *NONNULL_PTR owner){
10931         LDKOnionMessagePath ret = *owner->contents.result;
10932         ret.is_owned = false;
10933         return ret;
10934 }
10935 uint64_t  __attribute__((export_name("TS_CResult_OnionMessagePathNoneZ_get_ok"))) TS_CResult_OnionMessagePathNoneZ_get_ok(uint64_t owner) {
10936         LDKCResult_OnionMessagePathNoneZ* owner_conv = (LDKCResult_OnionMessagePathNoneZ*)untag_ptr(owner);
10937         LDKOnionMessagePath ret_var = CResult_OnionMessagePathNoneZ_get_ok(owner_conv);
10938         uint64_t ret_ref = 0;
10939         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
10940         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
10941         return ret_ref;
10942 }
10943
10944 static inline void CResult_OnionMessagePathNoneZ_get_err(LDKCResult_OnionMessagePathNoneZ *NONNULL_PTR owner){
10945 CHECK(!owner->result_ok);
10946         return *owner->contents.err;
10947 }
10948 void  __attribute__((export_name("TS_CResult_OnionMessagePathNoneZ_get_err"))) TS_CResult_OnionMessagePathNoneZ_get_err(uint64_t owner) {
10949         LDKCResult_OnionMessagePathNoneZ* owner_conv = (LDKCResult_OnionMessagePathNoneZ*)untag_ptr(owner);
10950         CResult_OnionMessagePathNoneZ_get_err(owner_conv);
10951 }
10952
10953 static inline struct LDKPublicKey C2Tuple_PublicKeyOnionMessageZ_get_a(LDKC2Tuple_PublicKeyOnionMessageZ *NONNULL_PTR owner){
10954         return owner->a;
10955 }
10956 int8_tArray  __attribute__((export_name("TS_C2Tuple_PublicKeyOnionMessageZ_get_a"))) TS_C2Tuple_PublicKeyOnionMessageZ_get_a(uint64_t owner) {
10957         LDKC2Tuple_PublicKeyOnionMessageZ* owner_conv = (LDKC2Tuple_PublicKeyOnionMessageZ*)untag_ptr(owner);
10958         int8_tArray ret_arr = init_int8_tArray(33, __LINE__);
10959         memcpy(ret_arr->elems, C2Tuple_PublicKeyOnionMessageZ_get_a(owner_conv).compressed_form, 33);
10960         return ret_arr;
10961 }
10962
10963 static inline struct LDKOnionMessage C2Tuple_PublicKeyOnionMessageZ_get_b(LDKC2Tuple_PublicKeyOnionMessageZ *NONNULL_PTR owner){
10964         LDKOnionMessage ret = owner->b;
10965         ret.is_owned = false;
10966         return ret;
10967 }
10968 uint64_t  __attribute__((export_name("TS_C2Tuple_PublicKeyOnionMessageZ_get_b"))) TS_C2Tuple_PublicKeyOnionMessageZ_get_b(uint64_t owner) {
10969         LDKC2Tuple_PublicKeyOnionMessageZ* owner_conv = (LDKC2Tuple_PublicKeyOnionMessageZ*)untag_ptr(owner);
10970         LDKOnionMessage ret_var = C2Tuple_PublicKeyOnionMessageZ_get_b(owner_conv);
10971         uint64_t ret_ref = 0;
10972         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
10973         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
10974         return ret_ref;
10975 }
10976
10977 uint32_t __attribute__((export_name("TS_LDKSendError_ty_from_ptr"))) TS_LDKSendError_ty_from_ptr(uint64_t ptr) {
10978         LDKSendError *obj = (LDKSendError*)untag_ptr(ptr);
10979         switch(obj->tag) {
10980                 case LDKSendError_Secp256k1: return 0;
10981                 case LDKSendError_TooBigPacket: return 1;
10982                 case LDKSendError_TooFewBlindedHops: return 2;
10983                 case LDKSendError_InvalidFirstHop: return 3;
10984                 case LDKSendError_InvalidMessage: return 4;
10985                 case LDKSendError_BufferFull: return 5;
10986                 case LDKSendError_GetNodeIdFailed: return 6;
10987                 case LDKSendError_BlindedPathAdvanceFailed: return 7;
10988                 default: abort();
10989         }
10990 }
10991 uint32_t __attribute__((export_name("TS_LDKSendError_Secp256k1_get_secp256k1"))) TS_LDKSendError_Secp256k1_get_secp256k1(uint64_t ptr) {
10992         LDKSendError *obj = (LDKSendError*)untag_ptr(ptr);
10993         assert(obj->tag == LDKSendError_Secp256k1);
10994         uint32_t secp256k1_conv = LDKSecp256k1Error_to_js(obj->secp256k1);
10995         return secp256k1_conv;
10996 }
10997 static inline struct LDKC2Tuple_PublicKeyOnionMessageZ CResult_C2Tuple_PublicKeyOnionMessageZSendErrorZ_get_ok(LDKCResult_C2Tuple_PublicKeyOnionMessageZSendErrorZ *NONNULL_PTR owner){
10998 CHECK(owner->result_ok);
10999         return C2Tuple_PublicKeyOnionMessageZ_clone(&*owner->contents.result);
11000 }
11001 uint64_t  __attribute__((export_name("TS_CResult_C2Tuple_PublicKeyOnionMessageZSendErrorZ_get_ok"))) TS_CResult_C2Tuple_PublicKeyOnionMessageZSendErrorZ_get_ok(uint64_t owner) {
11002         LDKCResult_C2Tuple_PublicKeyOnionMessageZSendErrorZ* owner_conv = (LDKCResult_C2Tuple_PublicKeyOnionMessageZSendErrorZ*)untag_ptr(owner);
11003         LDKC2Tuple_PublicKeyOnionMessageZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_PublicKeyOnionMessageZ), "LDKC2Tuple_PublicKeyOnionMessageZ");
11004         *ret_conv = CResult_C2Tuple_PublicKeyOnionMessageZSendErrorZ_get_ok(owner_conv);
11005         return tag_ptr(ret_conv, true);
11006 }
11007
11008 static inline struct LDKSendError CResult_C2Tuple_PublicKeyOnionMessageZSendErrorZ_get_err(LDKCResult_C2Tuple_PublicKeyOnionMessageZSendErrorZ *NONNULL_PTR owner){
11009 CHECK(!owner->result_ok);
11010         return SendError_clone(&*owner->contents.err);
11011 }
11012 uint64_t  __attribute__((export_name("TS_CResult_C2Tuple_PublicKeyOnionMessageZSendErrorZ_get_err"))) TS_CResult_C2Tuple_PublicKeyOnionMessageZSendErrorZ_get_err(uint64_t owner) {
11013         LDKCResult_C2Tuple_PublicKeyOnionMessageZSendErrorZ* owner_conv = (LDKCResult_C2Tuple_PublicKeyOnionMessageZSendErrorZ*)untag_ptr(owner);
11014         LDKSendError *ret_copy = MALLOC(sizeof(LDKSendError), "LDKSendError");
11015         *ret_copy = CResult_C2Tuple_PublicKeyOnionMessageZSendErrorZ_get_err(owner_conv);
11016         uint64_t ret_ref = tag_ptr(ret_copy, true);
11017         return ret_ref;
11018 }
11019
11020 uint32_t __attribute__((export_name("TS_LDKParsedOnionMessageContents_ty_from_ptr"))) TS_LDKParsedOnionMessageContents_ty_from_ptr(uint64_t ptr) {
11021         LDKParsedOnionMessageContents *obj = (LDKParsedOnionMessageContents*)untag_ptr(ptr);
11022         switch(obj->tag) {
11023                 case LDKParsedOnionMessageContents_Offers: return 0;
11024                 case LDKParsedOnionMessageContents_Custom: return 1;
11025                 default: abort();
11026         }
11027 }
11028 uint64_t __attribute__((export_name("TS_LDKParsedOnionMessageContents_Offers_get_offers"))) TS_LDKParsedOnionMessageContents_Offers_get_offers(uint64_t ptr) {
11029         LDKParsedOnionMessageContents *obj = (LDKParsedOnionMessageContents*)untag_ptr(ptr);
11030         assert(obj->tag == LDKParsedOnionMessageContents_Offers);
11031         uint64_t offers_ref = tag_ptr(&obj->offers, false);
11032         return offers_ref;
11033 }
11034 uint64_t __attribute__((export_name("TS_LDKParsedOnionMessageContents_Custom_get_custom"))) TS_LDKParsedOnionMessageContents_Custom_get_custom(uint64_t ptr) {
11035         LDKParsedOnionMessageContents *obj = (LDKParsedOnionMessageContents*)untag_ptr(ptr);
11036         assert(obj->tag == LDKParsedOnionMessageContents_Custom);
11037         LDKOnionMessageContents* custom_ret = MALLOC(sizeof(LDKOnionMessageContents), "LDKOnionMessageContents");
11038         *custom_ret = OnionMessageContents_clone(&obj->custom);
11039         return tag_ptr(custom_ret, true);
11040 }
11041 uint32_t __attribute__((export_name("TS_LDKPeeledOnion_ty_from_ptr"))) TS_LDKPeeledOnion_ty_from_ptr(uint64_t ptr) {
11042         LDKPeeledOnion *obj = (LDKPeeledOnion*)untag_ptr(ptr);
11043         switch(obj->tag) {
11044                 case LDKPeeledOnion_Forward: return 0;
11045                 case LDKPeeledOnion_Receive: return 1;
11046                 default: abort();
11047         }
11048 }
11049 int8_tArray __attribute__((export_name("TS_LDKPeeledOnion_Forward_get__0"))) TS_LDKPeeledOnion_Forward_get__0(uint64_t ptr) {
11050         LDKPeeledOnion *obj = (LDKPeeledOnion*)untag_ptr(ptr);
11051         assert(obj->tag == LDKPeeledOnion_Forward);
11052         int8_tArray _0_arr = init_int8_tArray(33, __LINE__);
11053         memcpy(_0_arr->elems, obj->forward._0.compressed_form, 33);
11054         return _0_arr;
11055 }
11056 uint64_t __attribute__((export_name("TS_LDKPeeledOnion_Forward_get__1"))) TS_LDKPeeledOnion_Forward_get__1(uint64_t ptr) {
11057         LDKPeeledOnion *obj = (LDKPeeledOnion*)untag_ptr(ptr);
11058         assert(obj->tag == LDKPeeledOnion_Forward);
11059         LDKOnionMessage _1_var = obj->forward._1;
11060                         uint64_t _1_ref = 0;
11061                         CHECK_INNER_FIELD_ACCESS_OR_NULL(_1_var);
11062                         _1_ref = tag_ptr(_1_var.inner, false);
11063         return _1_ref;
11064 }
11065 uint64_t __attribute__((export_name("TS_LDKPeeledOnion_Receive_get__0"))) TS_LDKPeeledOnion_Receive_get__0(uint64_t ptr) {
11066         LDKPeeledOnion *obj = (LDKPeeledOnion*)untag_ptr(ptr);
11067         assert(obj->tag == LDKPeeledOnion_Receive);
11068         uint64_t _0_ref = tag_ptr(&obj->receive._0, false);
11069         return _0_ref;
11070 }
11071 int8_tArray __attribute__((export_name("TS_LDKPeeledOnion_Receive_get__1"))) TS_LDKPeeledOnion_Receive_get__1(uint64_t ptr) {
11072         LDKPeeledOnion *obj = (LDKPeeledOnion*)untag_ptr(ptr);
11073         assert(obj->tag == LDKPeeledOnion_Receive);
11074         int8_tArray _1_arr = init_int8_tArray(32, __LINE__);
11075         memcpy(_1_arr->elems, obj->receive._1.data, 32);
11076         return _1_arr;
11077 }
11078 uint64_t __attribute__((export_name("TS_LDKPeeledOnion_Receive_get__2"))) TS_LDKPeeledOnion_Receive_get__2(uint64_t ptr) {
11079         LDKPeeledOnion *obj = (LDKPeeledOnion*)untag_ptr(ptr);
11080         assert(obj->tag == LDKPeeledOnion_Receive);
11081         LDKBlindedPath _2_var = obj->receive._2;
11082                         uint64_t _2_ref = 0;
11083                         CHECK_INNER_FIELD_ACCESS_OR_NULL(_2_var);
11084                         _2_ref = tag_ptr(_2_var.inner, false);
11085         return _2_ref;
11086 }
11087 static inline struct LDKPeeledOnion CResult_PeeledOnionNoneZ_get_ok(LDKCResult_PeeledOnionNoneZ *NONNULL_PTR owner){
11088 CHECK(owner->result_ok);
11089         return PeeledOnion_clone(&*owner->contents.result);
11090 }
11091 uint64_t  __attribute__((export_name("TS_CResult_PeeledOnionNoneZ_get_ok"))) TS_CResult_PeeledOnionNoneZ_get_ok(uint64_t owner) {
11092         LDKCResult_PeeledOnionNoneZ* owner_conv = (LDKCResult_PeeledOnionNoneZ*)untag_ptr(owner);
11093         LDKPeeledOnion *ret_copy = MALLOC(sizeof(LDKPeeledOnion), "LDKPeeledOnion");
11094         *ret_copy = CResult_PeeledOnionNoneZ_get_ok(owner_conv);
11095         uint64_t ret_ref = tag_ptr(ret_copy, true);
11096         return ret_ref;
11097 }
11098
11099 static inline void CResult_PeeledOnionNoneZ_get_err(LDKCResult_PeeledOnionNoneZ *NONNULL_PTR owner){
11100 CHECK(!owner->result_ok);
11101         return *owner->contents.err;
11102 }
11103 void  __attribute__((export_name("TS_CResult_PeeledOnionNoneZ_get_err"))) TS_CResult_PeeledOnionNoneZ_get_err(uint64_t owner) {
11104         LDKCResult_PeeledOnionNoneZ* owner_conv = (LDKCResult_PeeledOnionNoneZ*)untag_ptr(owner);
11105         CResult_PeeledOnionNoneZ_get_err(owner_conv);
11106 }
11107
11108 static inline void CResult_NoneSendErrorZ_get_ok(LDKCResult_NoneSendErrorZ *NONNULL_PTR owner){
11109 CHECK(owner->result_ok);
11110         return *owner->contents.result;
11111 }
11112 void  __attribute__((export_name("TS_CResult_NoneSendErrorZ_get_ok"))) TS_CResult_NoneSendErrorZ_get_ok(uint64_t owner) {
11113         LDKCResult_NoneSendErrorZ* owner_conv = (LDKCResult_NoneSendErrorZ*)untag_ptr(owner);
11114         CResult_NoneSendErrorZ_get_ok(owner_conv);
11115 }
11116
11117 static inline struct LDKSendError CResult_NoneSendErrorZ_get_err(LDKCResult_NoneSendErrorZ *NONNULL_PTR owner){
11118 CHECK(!owner->result_ok);
11119         return SendError_clone(&*owner->contents.err);
11120 }
11121 uint64_t  __attribute__((export_name("TS_CResult_NoneSendErrorZ_get_err"))) TS_CResult_NoneSendErrorZ_get_err(uint64_t owner) {
11122         LDKCResult_NoneSendErrorZ* owner_conv = (LDKCResult_NoneSendErrorZ*)untag_ptr(owner);
11123         LDKSendError *ret_copy = MALLOC(sizeof(LDKSendError), "LDKSendError");
11124         *ret_copy = CResult_NoneSendErrorZ_get_err(owner_conv);
11125         uint64_t ret_ref = tag_ptr(ret_copy, true);
11126         return ret_ref;
11127 }
11128
11129 static inline struct LDKBlindedPath CResult_BlindedPathNoneZ_get_ok(LDKCResult_BlindedPathNoneZ *NONNULL_PTR owner){
11130         LDKBlindedPath ret = *owner->contents.result;
11131         ret.is_owned = false;
11132         return ret;
11133 }
11134 uint64_t  __attribute__((export_name("TS_CResult_BlindedPathNoneZ_get_ok"))) TS_CResult_BlindedPathNoneZ_get_ok(uint64_t owner) {
11135         LDKCResult_BlindedPathNoneZ* owner_conv = (LDKCResult_BlindedPathNoneZ*)untag_ptr(owner);
11136         LDKBlindedPath ret_var = CResult_BlindedPathNoneZ_get_ok(owner_conv);
11137         uint64_t ret_ref = 0;
11138         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
11139         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
11140         return ret_ref;
11141 }
11142
11143 static inline void CResult_BlindedPathNoneZ_get_err(LDKCResult_BlindedPathNoneZ *NONNULL_PTR owner){
11144 CHECK(!owner->result_ok);
11145         return *owner->contents.err;
11146 }
11147 void  __attribute__((export_name("TS_CResult_BlindedPathNoneZ_get_err"))) TS_CResult_BlindedPathNoneZ_get_err(uint64_t owner) {
11148         LDKCResult_BlindedPathNoneZ* owner_conv = (LDKCResult_BlindedPathNoneZ*)untag_ptr(owner);
11149         CResult_BlindedPathNoneZ_get_err(owner_conv);
11150 }
11151
11152 static inline struct LDKC2Tuple_BlindedPayInfoBlindedPathZ CResult_C2Tuple_BlindedPayInfoBlindedPathZNoneZ_get_ok(LDKCResult_C2Tuple_BlindedPayInfoBlindedPathZNoneZ *NONNULL_PTR owner){
11153 CHECK(owner->result_ok);
11154         return C2Tuple_BlindedPayInfoBlindedPathZ_clone(&*owner->contents.result);
11155 }
11156 uint64_t  __attribute__((export_name("TS_CResult_C2Tuple_BlindedPayInfoBlindedPathZNoneZ_get_ok"))) TS_CResult_C2Tuple_BlindedPayInfoBlindedPathZNoneZ_get_ok(uint64_t owner) {
11157         LDKCResult_C2Tuple_BlindedPayInfoBlindedPathZNoneZ* owner_conv = (LDKCResult_C2Tuple_BlindedPayInfoBlindedPathZNoneZ*)untag_ptr(owner);
11158         LDKC2Tuple_BlindedPayInfoBlindedPathZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_BlindedPayInfoBlindedPathZ), "LDKC2Tuple_BlindedPayInfoBlindedPathZ");
11159         *ret_conv = CResult_C2Tuple_BlindedPayInfoBlindedPathZNoneZ_get_ok(owner_conv);
11160         return tag_ptr(ret_conv, true);
11161 }
11162
11163 static inline void CResult_C2Tuple_BlindedPayInfoBlindedPathZNoneZ_get_err(LDKCResult_C2Tuple_BlindedPayInfoBlindedPathZNoneZ *NONNULL_PTR owner){
11164 CHECK(!owner->result_ok);
11165         return *owner->contents.err;
11166 }
11167 void  __attribute__((export_name("TS_CResult_C2Tuple_BlindedPayInfoBlindedPathZNoneZ_get_err"))) TS_CResult_C2Tuple_BlindedPayInfoBlindedPathZNoneZ_get_err(uint64_t owner) {
11168         LDKCResult_C2Tuple_BlindedPayInfoBlindedPathZNoneZ* owner_conv = (LDKCResult_C2Tuple_BlindedPayInfoBlindedPathZNoneZ*)untag_ptr(owner);
11169         CResult_C2Tuple_BlindedPayInfoBlindedPathZNoneZ_get_err(owner_conv);
11170 }
11171
11172 static inline struct LDKBlindedPath CResult_BlindedPathDecodeErrorZ_get_ok(LDKCResult_BlindedPathDecodeErrorZ *NONNULL_PTR owner){
11173         LDKBlindedPath ret = *owner->contents.result;
11174         ret.is_owned = false;
11175         return ret;
11176 }
11177 uint64_t  __attribute__((export_name("TS_CResult_BlindedPathDecodeErrorZ_get_ok"))) TS_CResult_BlindedPathDecodeErrorZ_get_ok(uint64_t owner) {
11178         LDKCResult_BlindedPathDecodeErrorZ* owner_conv = (LDKCResult_BlindedPathDecodeErrorZ*)untag_ptr(owner);
11179         LDKBlindedPath ret_var = CResult_BlindedPathDecodeErrorZ_get_ok(owner_conv);
11180         uint64_t ret_ref = 0;
11181         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
11182         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
11183         return ret_ref;
11184 }
11185
11186 static inline struct LDKDecodeError CResult_BlindedPathDecodeErrorZ_get_err(LDKCResult_BlindedPathDecodeErrorZ *NONNULL_PTR owner){
11187 CHECK(!owner->result_ok);
11188         return DecodeError_clone(&*owner->contents.err);
11189 }
11190 uint64_t  __attribute__((export_name("TS_CResult_BlindedPathDecodeErrorZ_get_err"))) TS_CResult_BlindedPathDecodeErrorZ_get_err(uint64_t owner) {
11191         LDKCResult_BlindedPathDecodeErrorZ* owner_conv = (LDKCResult_BlindedPathDecodeErrorZ*)untag_ptr(owner);
11192         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
11193         *ret_copy = CResult_BlindedPathDecodeErrorZ_get_err(owner_conv);
11194         uint64_t ret_ref = tag_ptr(ret_copy, true);
11195         return ret_ref;
11196 }
11197
11198 static inline struct LDKBlindedHop CResult_BlindedHopDecodeErrorZ_get_ok(LDKCResult_BlindedHopDecodeErrorZ *NONNULL_PTR owner){
11199         LDKBlindedHop ret = *owner->contents.result;
11200         ret.is_owned = false;
11201         return ret;
11202 }
11203 uint64_t  __attribute__((export_name("TS_CResult_BlindedHopDecodeErrorZ_get_ok"))) TS_CResult_BlindedHopDecodeErrorZ_get_ok(uint64_t owner) {
11204         LDKCResult_BlindedHopDecodeErrorZ* owner_conv = (LDKCResult_BlindedHopDecodeErrorZ*)untag_ptr(owner);
11205         LDKBlindedHop ret_var = CResult_BlindedHopDecodeErrorZ_get_ok(owner_conv);
11206         uint64_t ret_ref = 0;
11207         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
11208         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
11209         return ret_ref;
11210 }
11211
11212 static inline struct LDKDecodeError CResult_BlindedHopDecodeErrorZ_get_err(LDKCResult_BlindedHopDecodeErrorZ *NONNULL_PTR owner){
11213 CHECK(!owner->result_ok);
11214         return DecodeError_clone(&*owner->contents.err);
11215 }
11216 uint64_t  __attribute__((export_name("TS_CResult_BlindedHopDecodeErrorZ_get_err"))) TS_CResult_BlindedHopDecodeErrorZ_get_err(uint64_t owner) {
11217         LDKCResult_BlindedHopDecodeErrorZ* owner_conv = (LDKCResult_BlindedHopDecodeErrorZ*)untag_ptr(owner);
11218         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
11219         *ret_copy = CResult_BlindedHopDecodeErrorZ_get_err(owner_conv);
11220         uint64_t ret_ref = tag_ptr(ret_copy, true);
11221         return ret_ref;
11222 }
11223
11224 static inline struct LDKInvoiceError CResult_InvoiceErrorDecodeErrorZ_get_ok(LDKCResult_InvoiceErrorDecodeErrorZ *NONNULL_PTR owner){
11225         LDKInvoiceError ret = *owner->contents.result;
11226         ret.is_owned = false;
11227         return ret;
11228 }
11229 uint64_t  __attribute__((export_name("TS_CResult_InvoiceErrorDecodeErrorZ_get_ok"))) TS_CResult_InvoiceErrorDecodeErrorZ_get_ok(uint64_t owner) {
11230         LDKCResult_InvoiceErrorDecodeErrorZ* owner_conv = (LDKCResult_InvoiceErrorDecodeErrorZ*)untag_ptr(owner);
11231         LDKInvoiceError ret_var = CResult_InvoiceErrorDecodeErrorZ_get_ok(owner_conv);
11232         uint64_t ret_ref = 0;
11233         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
11234         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
11235         return ret_ref;
11236 }
11237
11238 static inline struct LDKDecodeError CResult_InvoiceErrorDecodeErrorZ_get_err(LDKCResult_InvoiceErrorDecodeErrorZ *NONNULL_PTR owner){
11239 CHECK(!owner->result_ok);
11240         return DecodeError_clone(&*owner->contents.err);
11241 }
11242 uint64_t  __attribute__((export_name("TS_CResult_InvoiceErrorDecodeErrorZ_get_err"))) TS_CResult_InvoiceErrorDecodeErrorZ_get_err(uint64_t owner) {
11243         LDKCResult_InvoiceErrorDecodeErrorZ* owner_conv = (LDKCResult_InvoiceErrorDecodeErrorZ*)untag_ptr(owner);
11244         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
11245         *ret_copy = CResult_InvoiceErrorDecodeErrorZ_get_err(owner_conv);
11246         uint64_t ret_ref = tag_ptr(ret_copy, true);
11247         return ret_ref;
11248 }
11249
11250 typedef struct LDKFilter_JCalls {
11251         atomic_size_t refcnt;
11252         uint32_t instance_ptr;
11253 } LDKFilter_JCalls;
11254 static void LDKFilter_JCalls_free(void* this_arg) {
11255         LDKFilter_JCalls *j_calls = (LDKFilter_JCalls*) this_arg;
11256         if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
11257                 FREE(j_calls);
11258         }
11259 }
11260 void register_tx_LDKFilter_jcall(const void* this_arg, const uint8_t (* txid)[32], LDKu8slice script_pubkey) {
11261         LDKFilter_JCalls *j_calls = (LDKFilter_JCalls*) this_arg;
11262         int8_tArray txid_arr = init_int8_tArray(32, __LINE__);
11263         memcpy(txid_arr->elems, *txid, 32);
11264         LDKu8slice script_pubkey_var = script_pubkey;
11265         int8_tArray script_pubkey_arr = init_int8_tArray(script_pubkey_var.datalen, __LINE__);
11266         memcpy(script_pubkey_arr->elems, script_pubkey_var.data, script_pubkey_var.datalen);
11267         js_invoke_function_uuuuuu(j_calls->instance_ptr, 43, (uint32_t)txid_arr, (uint32_t)script_pubkey_arr, 0, 0, 0, 0);
11268 }
11269 void register_output_LDKFilter_jcall(const void* this_arg, LDKWatchedOutput output) {
11270         LDKFilter_JCalls *j_calls = (LDKFilter_JCalls*) this_arg;
11271         LDKWatchedOutput output_var = output;
11272         uint64_t output_ref = 0;
11273         CHECK_INNER_FIELD_ACCESS_OR_NULL(output_var);
11274         output_ref = tag_ptr(output_var.inner, output_var.is_owned);
11275         js_invoke_function_buuuuu(j_calls->instance_ptr, 44, output_ref, 0, 0, 0, 0, 0);
11276 }
11277 static void LDKFilter_JCalls_cloned(LDKFilter* new_obj) {
11278         LDKFilter_JCalls *j_calls = (LDKFilter_JCalls*) new_obj->this_arg;
11279         atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
11280 }
11281 static inline LDKFilter LDKFilter_init (JSValue o) {
11282         LDKFilter_JCalls *calls = MALLOC(sizeof(LDKFilter_JCalls), "LDKFilter_JCalls");
11283         atomic_init(&calls->refcnt, 1);
11284         calls->instance_ptr = o;
11285
11286         LDKFilter ret = {
11287                 .this_arg = (void*) calls,
11288                 .register_tx = register_tx_LDKFilter_jcall,
11289                 .register_output = register_output_LDKFilter_jcall,
11290                 .free = LDKFilter_JCalls_free,
11291         };
11292         return ret;
11293 }
11294 uint64_t  __attribute__((export_name("TS_LDKFilter_new"))) TS_LDKFilter_new(JSValue o) {
11295         LDKFilter *res_ptr = MALLOC(sizeof(LDKFilter), "LDKFilter");
11296         *res_ptr = LDKFilter_init(o);
11297         return tag_ptr(res_ptr, true);
11298 }
11299 void  __attribute__((export_name("TS_Filter_register_tx"))) TS_Filter_register_tx(uint64_t this_arg, int8_tArray txid, int8_tArray script_pubkey) {
11300         void* this_arg_ptr = untag_ptr(this_arg);
11301         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
11302         LDKFilter* this_arg_conv = (LDKFilter*)this_arg_ptr;
11303         uint8_t txid_arr[32];
11304         CHECK(txid->arr_len == 32);
11305         memcpy(txid_arr, txid->elems, 32); FREE(txid);
11306         uint8_t (*txid_ref)[32] = &txid_arr;
11307         LDKu8slice script_pubkey_ref;
11308         script_pubkey_ref.datalen = script_pubkey->arr_len;
11309         script_pubkey_ref.data = script_pubkey->elems;
11310         (this_arg_conv->register_tx)(this_arg_conv->this_arg, txid_ref, script_pubkey_ref);
11311         FREE(script_pubkey);
11312 }
11313
11314 void  __attribute__((export_name("TS_Filter_register_output"))) TS_Filter_register_output(uint64_t this_arg, uint64_t output) {
11315         void* this_arg_ptr = untag_ptr(this_arg);
11316         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
11317         LDKFilter* this_arg_conv = (LDKFilter*)this_arg_ptr;
11318         LDKWatchedOutput output_conv;
11319         output_conv.inner = untag_ptr(output);
11320         output_conv.is_owned = ptr_is_owned(output);
11321         CHECK_INNER_FIELD_ACCESS_OR_NULL(output_conv);
11322         output_conv = WatchedOutput_clone(&output_conv);
11323         (this_arg_conv->register_output)(this_arg_conv->this_arg, output_conv);
11324 }
11325
11326 uint32_t __attribute__((export_name("TS_LDKCOption_FilterZ_ty_from_ptr"))) TS_LDKCOption_FilterZ_ty_from_ptr(uint64_t ptr) {
11327         LDKCOption_FilterZ *obj = (LDKCOption_FilterZ*)untag_ptr(ptr);
11328         switch(obj->tag) {
11329                 case LDKCOption_FilterZ_Some: return 0;
11330                 case LDKCOption_FilterZ_None: return 1;
11331                 default: abort();
11332         }
11333 }
11334 uint64_t __attribute__((export_name("TS_LDKCOption_FilterZ_Some_get_some"))) TS_LDKCOption_FilterZ_Some_get_some(uint64_t ptr) {
11335         LDKCOption_FilterZ *obj = (LDKCOption_FilterZ*)untag_ptr(ptr);
11336         assert(obj->tag == LDKCOption_FilterZ_Some);
11337         LDKFilter* some_ret = MALLOC(sizeof(LDKFilter), "LDKFilter");
11338         *some_ret = obj->some;
11339                         // WARNING: We likely need to clone here, but no clone is available, so we just do it for Java instances
11340                         if ((*some_ret).free == LDKFilter_JCalls_free) {
11341                                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
11342                                 LDKFilter_JCalls_cloned(&(*some_ret));
11343                         }
11344         return tag_ptr(some_ret, true);
11345 }
11346 static inline struct LDKLockedChannelMonitor CResult_LockedChannelMonitorNoneZ_get_ok(LDKCResult_LockedChannelMonitorNoneZ *NONNULL_PTR owner){
11347         LDKLockedChannelMonitor ret = *owner->contents.result;
11348         ret.is_owned = false;
11349         return ret;
11350 }
11351 uint64_t  __attribute__((export_name("TS_CResult_LockedChannelMonitorNoneZ_get_ok"))) TS_CResult_LockedChannelMonitorNoneZ_get_ok(uint64_t owner) {
11352         LDKCResult_LockedChannelMonitorNoneZ* owner_conv = (LDKCResult_LockedChannelMonitorNoneZ*)untag_ptr(owner);
11353         LDKLockedChannelMonitor ret_var = CResult_LockedChannelMonitorNoneZ_get_ok(owner_conv);
11354         uint64_t ret_ref = 0;
11355         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
11356         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
11357         return ret_ref;
11358 }
11359
11360 static inline void CResult_LockedChannelMonitorNoneZ_get_err(LDKCResult_LockedChannelMonitorNoneZ *NONNULL_PTR owner){
11361 CHECK(!owner->result_ok);
11362         return *owner->contents.err;
11363 }
11364 void  __attribute__((export_name("TS_CResult_LockedChannelMonitorNoneZ_get_err"))) TS_CResult_LockedChannelMonitorNoneZ_get_err(uint64_t owner) {
11365         LDKCResult_LockedChannelMonitorNoneZ* owner_conv = (LDKCResult_LockedChannelMonitorNoneZ*)untag_ptr(owner);
11366         CResult_LockedChannelMonitorNoneZ_get_err(owner_conv);
11367 }
11368
11369 static inline LDKCVec_OutPointZ CVec_OutPointZ_clone(const LDKCVec_OutPointZ *orig) {
11370         LDKCVec_OutPointZ ret = { .data = MALLOC(sizeof(LDKOutPoint) * orig->datalen, "LDKCVec_OutPointZ clone bytes"), .datalen = orig->datalen };
11371         for (size_t i = 0; i < ret.datalen; i++) {
11372                 ret.data[i] = OutPoint_clone(&orig->data[i]);
11373         }
11374         return ret;
11375 }
11376 static inline LDKCVec_MonitorUpdateIdZ CVec_MonitorUpdateIdZ_clone(const LDKCVec_MonitorUpdateIdZ *orig) {
11377         LDKCVec_MonitorUpdateIdZ ret = { .data = MALLOC(sizeof(LDKMonitorUpdateId) * orig->datalen, "LDKCVec_MonitorUpdateIdZ clone bytes"), .datalen = orig->datalen };
11378         for (size_t i = 0; i < ret.datalen; i++) {
11379                 ret.data[i] = MonitorUpdateId_clone(&orig->data[i]);
11380         }
11381         return ret;
11382 }
11383 static inline struct LDKOutPoint C2Tuple_OutPointCVec_MonitorUpdateIdZZ_get_a(LDKC2Tuple_OutPointCVec_MonitorUpdateIdZZ *NONNULL_PTR owner){
11384         LDKOutPoint ret = owner->a;
11385         ret.is_owned = false;
11386         return ret;
11387 }
11388 uint64_t  __attribute__((export_name("TS_C2Tuple_OutPointCVec_MonitorUpdateIdZZ_get_a"))) TS_C2Tuple_OutPointCVec_MonitorUpdateIdZZ_get_a(uint64_t owner) {
11389         LDKC2Tuple_OutPointCVec_MonitorUpdateIdZZ* owner_conv = (LDKC2Tuple_OutPointCVec_MonitorUpdateIdZZ*)untag_ptr(owner);
11390         LDKOutPoint ret_var = C2Tuple_OutPointCVec_MonitorUpdateIdZZ_get_a(owner_conv);
11391         uint64_t ret_ref = 0;
11392         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
11393         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
11394         return ret_ref;
11395 }
11396
11397 static inline struct LDKCVec_MonitorUpdateIdZ C2Tuple_OutPointCVec_MonitorUpdateIdZZ_get_b(LDKC2Tuple_OutPointCVec_MonitorUpdateIdZZ *NONNULL_PTR owner){
11398         return CVec_MonitorUpdateIdZ_clone(&owner->b);
11399 }
11400 uint64_tArray  __attribute__((export_name("TS_C2Tuple_OutPointCVec_MonitorUpdateIdZZ_get_b"))) TS_C2Tuple_OutPointCVec_MonitorUpdateIdZZ_get_b(uint64_t owner) {
11401         LDKC2Tuple_OutPointCVec_MonitorUpdateIdZZ* owner_conv = (LDKC2Tuple_OutPointCVec_MonitorUpdateIdZZ*)untag_ptr(owner);
11402         LDKCVec_MonitorUpdateIdZ ret_var = C2Tuple_OutPointCVec_MonitorUpdateIdZZ_get_b(owner_conv);
11403         uint64_tArray ret_arr = NULL;
11404         ret_arr = init_uint64_tArray(ret_var.datalen, __LINE__);
11405         uint64_t *ret_arr_ptr = (uint64_t*)(((uint8_t*)ret_arr) + 8);
11406         for (size_t r = 0; r < ret_var.datalen; r++) {
11407                 LDKMonitorUpdateId ret_conv_17_var = ret_var.data[r];
11408                 uint64_t ret_conv_17_ref = 0;
11409                 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_conv_17_var);
11410                 ret_conv_17_ref = tag_ptr(ret_conv_17_var.inner, ret_conv_17_var.is_owned);
11411                 ret_arr_ptr[r] = ret_conv_17_ref;
11412         }
11413         
11414         FREE(ret_var.data);
11415         return ret_arr;
11416 }
11417
11418 static inline LDKCVec_C2Tuple_OutPointCVec_MonitorUpdateIdZZZ CVec_C2Tuple_OutPointCVec_MonitorUpdateIdZZZ_clone(const LDKCVec_C2Tuple_OutPointCVec_MonitorUpdateIdZZZ *orig) {
11419         LDKCVec_C2Tuple_OutPointCVec_MonitorUpdateIdZZZ ret = { .data = MALLOC(sizeof(LDKC2Tuple_OutPointCVec_MonitorUpdateIdZZ) * orig->datalen, "LDKCVec_C2Tuple_OutPointCVec_MonitorUpdateIdZZZ clone bytes"), .datalen = orig->datalen };
11420         for (size_t i = 0; i < ret.datalen; i++) {
11421                 ret.data[i] = C2Tuple_OutPointCVec_MonitorUpdateIdZZ_clone(&orig->data[i]);
11422         }
11423         return ret;
11424 }
11425 typedef struct LDKKVStore_JCalls {
11426         atomic_size_t refcnt;
11427         uint32_t instance_ptr;
11428 } LDKKVStore_JCalls;
11429 static void LDKKVStore_JCalls_free(void* this_arg) {
11430         LDKKVStore_JCalls *j_calls = (LDKKVStore_JCalls*) this_arg;
11431         if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
11432                 FREE(j_calls);
11433         }
11434 }
11435 LDKCResult_CVec_u8ZIOErrorZ read_LDKKVStore_jcall(const void* this_arg, LDKStr primary_namespace, LDKStr secondary_namespace, LDKStr key) {
11436         LDKKVStore_JCalls *j_calls = (LDKKVStore_JCalls*) this_arg;
11437         LDKStr primary_namespace_str = primary_namespace;
11438         jstring primary_namespace_conv = str_ref_to_ts(primary_namespace_str.chars, primary_namespace_str.len);
11439         Str_free(primary_namespace_str);
11440         LDKStr secondary_namespace_str = secondary_namespace;
11441         jstring secondary_namespace_conv = str_ref_to_ts(secondary_namespace_str.chars, secondary_namespace_str.len);
11442         Str_free(secondary_namespace_str);
11443         LDKStr key_str = key;
11444         jstring key_conv = str_ref_to_ts(key_str.chars, key_str.len);
11445         Str_free(key_str);
11446         uint64_t ret = js_invoke_function_uuuuuu(j_calls->instance_ptr, 45, primary_namespace_conv, secondary_namespace_conv, key_conv, 0, 0, 0);
11447         void* ret_ptr = untag_ptr(ret);
11448         CHECK_ACCESS(ret_ptr);
11449         LDKCResult_CVec_u8ZIOErrorZ ret_conv = *(LDKCResult_CVec_u8ZIOErrorZ*)(ret_ptr);
11450         FREE(untag_ptr(ret));
11451         return ret_conv;
11452 }
11453 LDKCResult_NoneIOErrorZ write_LDKKVStore_jcall(const void* this_arg, LDKStr primary_namespace, LDKStr secondary_namespace, LDKStr key, LDKu8slice buf) {
11454         LDKKVStore_JCalls *j_calls = (LDKKVStore_JCalls*) this_arg;
11455         LDKStr primary_namespace_str = primary_namespace;
11456         jstring primary_namespace_conv = str_ref_to_ts(primary_namespace_str.chars, primary_namespace_str.len);
11457         Str_free(primary_namespace_str);
11458         LDKStr secondary_namespace_str = secondary_namespace;
11459         jstring secondary_namespace_conv = str_ref_to_ts(secondary_namespace_str.chars, secondary_namespace_str.len);
11460         Str_free(secondary_namespace_str);
11461         LDKStr key_str = key;
11462         jstring key_conv = str_ref_to_ts(key_str.chars, key_str.len);
11463         Str_free(key_str);
11464         LDKu8slice buf_var = buf;
11465         int8_tArray buf_arr = init_int8_tArray(buf_var.datalen, __LINE__);
11466         memcpy(buf_arr->elems, buf_var.data, buf_var.datalen);
11467         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);
11468         void* ret_ptr = untag_ptr(ret);
11469         CHECK_ACCESS(ret_ptr);
11470         LDKCResult_NoneIOErrorZ ret_conv = *(LDKCResult_NoneIOErrorZ*)(ret_ptr);
11471         FREE(untag_ptr(ret));
11472         return ret_conv;
11473 }
11474 LDKCResult_NoneIOErrorZ remove_LDKKVStore_jcall(const void* this_arg, LDKStr primary_namespace, LDKStr secondary_namespace, LDKStr key, bool lazy) {
11475         LDKKVStore_JCalls *j_calls = (LDKKVStore_JCalls*) this_arg;
11476         LDKStr primary_namespace_str = primary_namespace;
11477         jstring primary_namespace_conv = str_ref_to_ts(primary_namespace_str.chars, primary_namespace_str.len);
11478         Str_free(primary_namespace_str);
11479         LDKStr secondary_namespace_str = secondary_namespace;
11480         jstring secondary_namespace_conv = str_ref_to_ts(secondary_namespace_str.chars, secondary_namespace_str.len);
11481         Str_free(secondary_namespace_str);
11482         LDKStr key_str = key;
11483         jstring key_conv = str_ref_to_ts(key_str.chars, key_str.len);
11484         Str_free(key_str);
11485         jboolean lazy_conv = lazy;
11486         uint64_t ret = js_invoke_function_uuuuuu(j_calls->instance_ptr, 47, primary_namespace_conv, secondary_namespace_conv, key_conv, lazy_conv, 0, 0);
11487         void* ret_ptr = untag_ptr(ret);
11488         CHECK_ACCESS(ret_ptr);
11489         LDKCResult_NoneIOErrorZ ret_conv = *(LDKCResult_NoneIOErrorZ*)(ret_ptr);
11490         FREE(untag_ptr(ret));
11491         return ret_conv;
11492 }
11493 LDKCResult_CVec_StrZIOErrorZ list_LDKKVStore_jcall(const void* this_arg, LDKStr primary_namespace, LDKStr secondary_namespace) {
11494         LDKKVStore_JCalls *j_calls = (LDKKVStore_JCalls*) this_arg;
11495         LDKStr primary_namespace_str = primary_namespace;
11496         jstring primary_namespace_conv = str_ref_to_ts(primary_namespace_str.chars, primary_namespace_str.len);
11497         Str_free(primary_namespace_str);
11498         LDKStr secondary_namespace_str = secondary_namespace;
11499         jstring secondary_namespace_conv = str_ref_to_ts(secondary_namespace_str.chars, secondary_namespace_str.len);
11500         Str_free(secondary_namespace_str);
11501         uint64_t ret = js_invoke_function_uuuuuu(j_calls->instance_ptr, 48, primary_namespace_conv, secondary_namespace_conv, 0, 0, 0, 0);
11502         void* ret_ptr = untag_ptr(ret);
11503         CHECK_ACCESS(ret_ptr);
11504         LDKCResult_CVec_StrZIOErrorZ ret_conv = *(LDKCResult_CVec_StrZIOErrorZ*)(ret_ptr);
11505         FREE(untag_ptr(ret));
11506         return ret_conv;
11507 }
11508 static void LDKKVStore_JCalls_cloned(LDKKVStore* new_obj) {
11509         LDKKVStore_JCalls *j_calls = (LDKKVStore_JCalls*) new_obj->this_arg;
11510         atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
11511 }
11512 static inline LDKKVStore LDKKVStore_init (JSValue o) {
11513         LDKKVStore_JCalls *calls = MALLOC(sizeof(LDKKVStore_JCalls), "LDKKVStore_JCalls");
11514         atomic_init(&calls->refcnt, 1);
11515         calls->instance_ptr = o;
11516
11517         LDKKVStore ret = {
11518                 .this_arg = (void*) calls,
11519                 .read = read_LDKKVStore_jcall,
11520                 .write = write_LDKKVStore_jcall,
11521                 .remove = remove_LDKKVStore_jcall,
11522                 .list = list_LDKKVStore_jcall,
11523                 .free = LDKKVStore_JCalls_free,
11524         };
11525         return ret;
11526 }
11527 uint64_t  __attribute__((export_name("TS_LDKKVStore_new"))) TS_LDKKVStore_new(JSValue o) {
11528         LDKKVStore *res_ptr = MALLOC(sizeof(LDKKVStore), "LDKKVStore");
11529         *res_ptr = LDKKVStore_init(o);
11530         return tag_ptr(res_ptr, true);
11531 }
11532 uint64_t  __attribute__((export_name("TS_KVStore_read"))) TS_KVStore_read(uint64_t this_arg, jstring primary_namespace, jstring secondary_namespace, jstring key) {
11533         void* this_arg_ptr = untag_ptr(this_arg);
11534         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
11535         LDKKVStore* this_arg_conv = (LDKKVStore*)this_arg_ptr;
11536         LDKStr primary_namespace_conv = str_ref_to_owned_c(primary_namespace);
11537         LDKStr secondary_namespace_conv = str_ref_to_owned_c(secondary_namespace);
11538         LDKStr key_conv = str_ref_to_owned_c(key);
11539         LDKCResult_CVec_u8ZIOErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_u8ZIOErrorZ), "LDKCResult_CVec_u8ZIOErrorZ");
11540         *ret_conv = (this_arg_conv->read)(this_arg_conv->this_arg, primary_namespace_conv, secondary_namespace_conv, key_conv);
11541         return tag_ptr(ret_conv, true);
11542 }
11543
11544 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) {
11545         void* this_arg_ptr = untag_ptr(this_arg);
11546         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
11547         LDKKVStore* this_arg_conv = (LDKKVStore*)this_arg_ptr;
11548         LDKStr primary_namespace_conv = str_ref_to_owned_c(primary_namespace);
11549         LDKStr secondary_namespace_conv = str_ref_to_owned_c(secondary_namespace);
11550         LDKStr key_conv = str_ref_to_owned_c(key);
11551         LDKu8slice buf_ref;
11552         buf_ref.datalen = buf->arr_len;
11553         buf_ref.data = buf->elems;
11554         LDKCResult_NoneIOErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneIOErrorZ), "LDKCResult_NoneIOErrorZ");
11555         *ret_conv = (this_arg_conv->write)(this_arg_conv->this_arg, primary_namespace_conv, secondary_namespace_conv, key_conv, buf_ref);
11556         FREE(buf);
11557         return tag_ptr(ret_conv, true);
11558 }
11559
11560 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) {
11561         void* this_arg_ptr = untag_ptr(this_arg);
11562         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
11563         LDKKVStore* this_arg_conv = (LDKKVStore*)this_arg_ptr;
11564         LDKStr primary_namespace_conv = str_ref_to_owned_c(primary_namespace);
11565         LDKStr secondary_namespace_conv = str_ref_to_owned_c(secondary_namespace);
11566         LDKStr key_conv = str_ref_to_owned_c(key);
11567         LDKCResult_NoneIOErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneIOErrorZ), "LDKCResult_NoneIOErrorZ");
11568         *ret_conv = (this_arg_conv->remove)(this_arg_conv->this_arg, primary_namespace_conv, secondary_namespace_conv, key_conv, lazy);
11569         return tag_ptr(ret_conv, true);
11570 }
11571
11572 uint64_t  __attribute__((export_name("TS_KVStore_list"))) TS_KVStore_list(uint64_t this_arg, jstring primary_namespace, jstring secondary_namespace) {
11573         void* this_arg_ptr = untag_ptr(this_arg);
11574         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
11575         LDKKVStore* this_arg_conv = (LDKKVStore*)this_arg_ptr;
11576         LDKStr primary_namespace_conv = str_ref_to_owned_c(primary_namespace);
11577         LDKStr secondary_namespace_conv = str_ref_to_owned_c(secondary_namespace);
11578         LDKCResult_CVec_StrZIOErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_StrZIOErrorZ), "LDKCResult_CVec_StrZIOErrorZ");
11579         *ret_conv = (this_arg_conv->list)(this_arg_conv->this_arg, primary_namespace_conv, secondary_namespace_conv);
11580         return tag_ptr(ret_conv, true);
11581 }
11582
11583 typedef struct LDKScoreLookUp_JCalls {
11584         atomic_size_t refcnt;
11585         uint32_t instance_ptr;
11586 } LDKScoreLookUp_JCalls;
11587 static void LDKScoreLookUp_JCalls_free(void* this_arg) {
11588         LDKScoreLookUp_JCalls *j_calls = (LDKScoreLookUp_JCalls*) this_arg;
11589         if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
11590                 FREE(j_calls);
11591         }
11592 }
11593 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) {
11594         LDKScoreLookUp_JCalls *j_calls = (LDKScoreLookUp_JCalls*) this_arg;
11595         int64_t short_channel_id_conv = short_channel_id;
11596         LDKNodeId source_var = *source;
11597         uint64_t source_ref = 0;
11598         source_var = NodeId_clone(&source_var);
11599         CHECK_INNER_FIELD_ACCESS_OR_NULL(source_var);
11600         source_ref = tag_ptr(source_var.inner, source_var.is_owned);
11601         LDKNodeId target_var = *target;
11602         uint64_t target_ref = 0;
11603         target_var = NodeId_clone(&target_var);
11604         CHECK_INNER_FIELD_ACCESS_OR_NULL(target_var);
11605         target_ref = tag_ptr(target_var.inner, target_var.is_owned);
11606         LDKChannelUsage usage_var = usage;
11607         uint64_t usage_ref = 0;
11608         CHECK_INNER_FIELD_ACCESS_OR_NULL(usage_var);
11609         usage_ref = tag_ptr(usage_var.inner, usage_var.is_owned);
11610         LDKProbabilisticScoringFeeParameters score_params_var = *score_params;
11611         uint64_t score_params_ref = 0;
11612         score_params_var = ProbabilisticScoringFeeParameters_clone(&score_params_var);
11613         CHECK_INNER_FIELD_ACCESS_OR_NULL(score_params_var);
11614         score_params_ref = tag_ptr(score_params_var.inner, score_params_var.is_owned);
11615         return js_invoke_function_bbbbbu(j_calls->instance_ptr, 49, short_channel_id_conv, source_ref, target_ref, usage_ref, score_params_ref, 0);
11616 }
11617 static void LDKScoreLookUp_JCalls_cloned(LDKScoreLookUp* new_obj) {
11618         LDKScoreLookUp_JCalls *j_calls = (LDKScoreLookUp_JCalls*) new_obj->this_arg;
11619         atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
11620 }
11621 static inline LDKScoreLookUp LDKScoreLookUp_init (JSValue o) {
11622         LDKScoreLookUp_JCalls *calls = MALLOC(sizeof(LDKScoreLookUp_JCalls), "LDKScoreLookUp_JCalls");
11623         atomic_init(&calls->refcnt, 1);
11624         calls->instance_ptr = o;
11625
11626         LDKScoreLookUp ret = {
11627                 .this_arg = (void*) calls,
11628                 .channel_penalty_msat = channel_penalty_msat_LDKScoreLookUp_jcall,
11629                 .free = LDKScoreLookUp_JCalls_free,
11630         };
11631         return ret;
11632 }
11633 uint64_t  __attribute__((export_name("TS_LDKScoreLookUp_new"))) TS_LDKScoreLookUp_new(JSValue o) {
11634         LDKScoreLookUp *res_ptr = MALLOC(sizeof(LDKScoreLookUp), "LDKScoreLookUp");
11635         *res_ptr = LDKScoreLookUp_init(o);
11636         return tag_ptr(res_ptr, true);
11637 }
11638 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) {
11639         void* this_arg_ptr = untag_ptr(this_arg);
11640         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
11641         LDKScoreLookUp* this_arg_conv = (LDKScoreLookUp*)this_arg_ptr;
11642         LDKNodeId source_conv;
11643         source_conv.inner = untag_ptr(source);
11644         source_conv.is_owned = ptr_is_owned(source);
11645         CHECK_INNER_FIELD_ACCESS_OR_NULL(source_conv);
11646         source_conv.is_owned = false;
11647         LDKNodeId target_conv;
11648         target_conv.inner = untag_ptr(target);
11649         target_conv.is_owned = ptr_is_owned(target);
11650         CHECK_INNER_FIELD_ACCESS_OR_NULL(target_conv);
11651         target_conv.is_owned = false;
11652         LDKChannelUsage usage_conv;
11653         usage_conv.inner = untag_ptr(usage);
11654         usage_conv.is_owned = ptr_is_owned(usage);
11655         CHECK_INNER_FIELD_ACCESS_OR_NULL(usage_conv);
11656         usage_conv = ChannelUsage_clone(&usage_conv);
11657         LDKProbabilisticScoringFeeParameters score_params_conv;
11658         score_params_conv.inner = untag_ptr(score_params);
11659         score_params_conv.is_owned = ptr_is_owned(score_params);
11660         CHECK_INNER_FIELD_ACCESS_OR_NULL(score_params_conv);
11661         score_params_conv.is_owned = false;
11662         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);
11663         return ret_conv;
11664 }
11665
11666 typedef struct LDKScoreUpdate_JCalls {
11667         atomic_size_t refcnt;
11668         uint32_t instance_ptr;
11669 } LDKScoreUpdate_JCalls;
11670 static void LDKScoreUpdate_JCalls_free(void* this_arg) {
11671         LDKScoreUpdate_JCalls *j_calls = (LDKScoreUpdate_JCalls*) this_arg;
11672         if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
11673                 FREE(j_calls);
11674         }
11675 }
11676 void payment_path_failed_LDKScoreUpdate_jcall(void* this_arg, const LDKPath * path, uint64_t short_channel_id) {
11677         LDKScoreUpdate_JCalls *j_calls = (LDKScoreUpdate_JCalls*) this_arg;
11678         LDKPath path_var = *path;
11679         uint64_t path_ref = 0;
11680         path_var = Path_clone(&path_var);
11681         CHECK_INNER_FIELD_ACCESS_OR_NULL(path_var);
11682         path_ref = tag_ptr(path_var.inner, path_var.is_owned);
11683         int64_t short_channel_id_conv = short_channel_id;
11684         js_invoke_function_bbuuuu(j_calls->instance_ptr, 50, path_ref, short_channel_id_conv, 0, 0, 0, 0);
11685 }
11686 void payment_path_successful_LDKScoreUpdate_jcall(void* this_arg, const LDKPath * path) {
11687         LDKScoreUpdate_JCalls *j_calls = (LDKScoreUpdate_JCalls*) this_arg;
11688         LDKPath path_var = *path;
11689         uint64_t path_ref = 0;
11690         path_var = Path_clone(&path_var);
11691         CHECK_INNER_FIELD_ACCESS_OR_NULL(path_var);
11692         path_ref = tag_ptr(path_var.inner, path_var.is_owned);
11693         js_invoke_function_buuuuu(j_calls->instance_ptr, 51, path_ref, 0, 0, 0, 0, 0);
11694 }
11695 void probe_failed_LDKScoreUpdate_jcall(void* this_arg, const LDKPath * path, uint64_t short_channel_id) {
11696         LDKScoreUpdate_JCalls *j_calls = (LDKScoreUpdate_JCalls*) this_arg;
11697         LDKPath path_var = *path;
11698         uint64_t path_ref = 0;
11699         path_var = Path_clone(&path_var);
11700         CHECK_INNER_FIELD_ACCESS_OR_NULL(path_var);
11701         path_ref = tag_ptr(path_var.inner, path_var.is_owned);
11702         int64_t short_channel_id_conv = short_channel_id;
11703         js_invoke_function_bbuuuu(j_calls->instance_ptr, 52, path_ref, short_channel_id_conv, 0, 0, 0, 0);
11704 }
11705 void probe_successful_LDKScoreUpdate_jcall(void* this_arg, const LDKPath * path) {
11706         LDKScoreUpdate_JCalls *j_calls = (LDKScoreUpdate_JCalls*) this_arg;
11707         LDKPath path_var = *path;
11708         uint64_t path_ref = 0;
11709         path_var = Path_clone(&path_var);
11710         CHECK_INNER_FIELD_ACCESS_OR_NULL(path_var);
11711         path_ref = tag_ptr(path_var.inner, path_var.is_owned);
11712         js_invoke_function_buuuuu(j_calls->instance_ptr, 53, path_ref, 0, 0, 0, 0, 0);
11713 }
11714 static void LDKScoreUpdate_JCalls_cloned(LDKScoreUpdate* new_obj) {
11715         LDKScoreUpdate_JCalls *j_calls = (LDKScoreUpdate_JCalls*) new_obj->this_arg;
11716         atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
11717 }
11718 static inline LDKScoreUpdate LDKScoreUpdate_init (JSValue o) {
11719         LDKScoreUpdate_JCalls *calls = MALLOC(sizeof(LDKScoreUpdate_JCalls), "LDKScoreUpdate_JCalls");
11720         atomic_init(&calls->refcnt, 1);
11721         calls->instance_ptr = o;
11722
11723         LDKScoreUpdate ret = {
11724                 .this_arg = (void*) calls,
11725                 .payment_path_failed = payment_path_failed_LDKScoreUpdate_jcall,
11726                 .payment_path_successful = payment_path_successful_LDKScoreUpdate_jcall,
11727                 .probe_failed = probe_failed_LDKScoreUpdate_jcall,
11728                 .probe_successful = probe_successful_LDKScoreUpdate_jcall,
11729                 .free = LDKScoreUpdate_JCalls_free,
11730         };
11731         return ret;
11732 }
11733 uint64_t  __attribute__((export_name("TS_LDKScoreUpdate_new"))) TS_LDKScoreUpdate_new(JSValue o) {
11734         LDKScoreUpdate *res_ptr = MALLOC(sizeof(LDKScoreUpdate), "LDKScoreUpdate");
11735         *res_ptr = LDKScoreUpdate_init(o);
11736         return tag_ptr(res_ptr, true);
11737 }
11738 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) {
11739         void* this_arg_ptr = untag_ptr(this_arg);
11740         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
11741         LDKScoreUpdate* this_arg_conv = (LDKScoreUpdate*)this_arg_ptr;
11742         LDKPath path_conv;
11743         path_conv.inner = untag_ptr(path);
11744         path_conv.is_owned = ptr_is_owned(path);
11745         CHECK_INNER_FIELD_ACCESS_OR_NULL(path_conv);
11746         path_conv.is_owned = false;
11747         (this_arg_conv->payment_path_failed)(this_arg_conv->this_arg, &path_conv, short_channel_id);
11748 }
11749
11750 void  __attribute__((export_name("TS_ScoreUpdate_payment_path_successful"))) TS_ScoreUpdate_payment_path_successful(uint64_t this_arg, uint64_t path) {
11751         void* this_arg_ptr = untag_ptr(this_arg);
11752         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
11753         LDKScoreUpdate* this_arg_conv = (LDKScoreUpdate*)this_arg_ptr;
11754         LDKPath path_conv;
11755         path_conv.inner = untag_ptr(path);
11756         path_conv.is_owned = ptr_is_owned(path);
11757         CHECK_INNER_FIELD_ACCESS_OR_NULL(path_conv);
11758         path_conv.is_owned = false;
11759         (this_arg_conv->payment_path_successful)(this_arg_conv->this_arg, &path_conv);
11760 }
11761
11762 void  __attribute__((export_name("TS_ScoreUpdate_probe_failed"))) TS_ScoreUpdate_probe_failed(uint64_t this_arg, uint64_t path, int64_t short_channel_id) {
11763         void* this_arg_ptr = untag_ptr(this_arg);
11764         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
11765         LDKScoreUpdate* this_arg_conv = (LDKScoreUpdate*)this_arg_ptr;
11766         LDKPath path_conv;
11767         path_conv.inner = untag_ptr(path);
11768         path_conv.is_owned = ptr_is_owned(path);
11769         CHECK_INNER_FIELD_ACCESS_OR_NULL(path_conv);
11770         path_conv.is_owned = false;
11771         (this_arg_conv->probe_failed)(this_arg_conv->this_arg, &path_conv, short_channel_id);
11772 }
11773
11774 void  __attribute__((export_name("TS_ScoreUpdate_probe_successful"))) TS_ScoreUpdate_probe_successful(uint64_t this_arg, uint64_t path) {
11775         void* this_arg_ptr = untag_ptr(this_arg);
11776         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
11777         LDKScoreUpdate* this_arg_conv = (LDKScoreUpdate*)this_arg_ptr;
11778         LDKPath path_conv;
11779         path_conv.inner = untag_ptr(path);
11780         path_conv.is_owned = ptr_is_owned(path);
11781         CHECK_INNER_FIELD_ACCESS_OR_NULL(path_conv);
11782         path_conv.is_owned = false;
11783         (this_arg_conv->probe_successful)(this_arg_conv->this_arg, &path_conv);
11784 }
11785
11786 typedef struct LDKLockableScore_JCalls {
11787         atomic_size_t refcnt;
11788         uint32_t instance_ptr;
11789 } LDKLockableScore_JCalls;
11790 static void LDKLockableScore_JCalls_free(void* this_arg) {
11791         LDKLockableScore_JCalls *j_calls = (LDKLockableScore_JCalls*) this_arg;
11792         if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
11793                 FREE(j_calls);
11794         }
11795 }
11796 LDKScoreLookUp read_lock_LDKLockableScore_jcall(const void* this_arg) {
11797         LDKLockableScore_JCalls *j_calls = (LDKLockableScore_JCalls*) this_arg;
11798         uint64_t ret = js_invoke_function_uuuuuu(j_calls->instance_ptr, 54, 0, 0, 0, 0, 0, 0);
11799         void* ret_ptr = untag_ptr(ret);
11800         CHECK_ACCESS(ret_ptr);
11801         LDKScoreLookUp ret_conv = *(LDKScoreLookUp*)(ret_ptr);
11802         if (ret_conv.free == LDKScoreLookUp_JCalls_free) {
11803                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
11804                 LDKScoreLookUp_JCalls_cloned(&ret_conv);
11805         }// WARNING: we may need a move here but no clone is available for LDKScoreLookUp
11806         
11807         return ret_conv;
11808 }
11809 LDKScoreUpdate write_lock_LDKLockableScore_jcall(const void* this_arg) {
11810         LDKLockableScore_JCalls *j_calls = (LDKLockableScore_JCalls*) this_arg;
11811         uint64_t ret = js_invoke_function_uuuuuu(j_calls->instance_ptr, 55, 0, 0, 0, 0, 0, 0);
11812         void* ret_ptr = untag_ptr(ret);
11813         CHECK_ACCESS(ret_ptr);
11814         LDKScoreUpdate ret_conv = *(LDKScoreUpdate*)(ret_ptr);
11815         if (ret_conv.free == LDKScoreUpdate_JCalls_free) {
11816                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
11817                 LDKScoreUpdate_JCalls_cloned(&ret_conv);
11818         }// WARNING: we may need a move here but no clone is available for LDKScoreUpdate
11819         
11820         return ret_conv;
11821 }
11822 static void LDKLockableScore_JCalls_cloned(LDKLockableScore* new_obj) {
11823         LDKLockableScore_JCalls *j_calls = (LDKLockableScore_JCalls*) new_obj->this_arg;
11824         atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
11825 }
11826 static inline LDKLockableScore LDKLockableScore_init (JSValue o) {
11827         LDKLockableScore_JCalls *calls = MALLOC(sizeof(LDKLockableScore_JCalls), "LDKLockableScore_JCalls");
11828         atomic_init(&calls->refcnt, 1);
11829         calls->instance_ptr = o;
11830
11831         LDKLockableScore ret = {
11832                 .this_arg = (void*) calls,
11833                 .read_lock = read_lock_LDKLockableScore_jcall,
11834                 .write_lock = write_lock_LDKLockableScore_jcall,
11835                 .free = LDKLockableScore_JCalls_free,
11836         };
11837         return ret;
11838 }
11839 uint64_t  __attribute__((export_name("TS_LDKLockableScore_new"))) TS_LDKLockableScore_new(JSValue o) {
11840         LDKLockableScore *res_ptr = MALLOC(sizeof(LDKLockableScore), "LDKLockableScore");
11841         *res_ptr = LDKLockableScore_init(o);
11842         return tag_ptr(res_ptr, true);
11843 }
11844 uint64_t  __attribute__((export_name("TS_LockableScore_read_lock"))) TS_LockableScore_read_lock(uint64_t this_arg) {
11845         void* this_arg_ptr = untag_ptr(this_arg);
11846         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
11847         LDKLockableScore* this_arg_conv = (LDKLockableScore*)this_arg_ptr;
11848         LDKScoreLookUp* ret_ret = MALLOC(sizeof(LDKScoreLookUp), "LDKScoreLookUp");
11849         *ret_ret = (this_arg_conv->read_lock)(this_arg_conv->this_arg);
11850         return tag_ptr(ret_ret, true);
11851 }
11852
11853 uint64_t  __attribute__((export_name("TS_LockableScore_write_lock"))) TS_LockableScore_write_lock(uint64_t this_arg) {
11854         void* this_arg_ptr = untag_ptr(this_arg);
11855         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
11856         LDKLockableScore* this_arg_conv = (LDKLockableScore*)this_arg_ptr;
11857         LDKScoreUpdate* ret_ret = MALLOC(sizeof(LDKScoreUpdate), "LDKScoreUpdate");
11858         *ret_ret = (this_arg_conv->write_lock)(this_arg_conv->this_arg);
11859         return tag_ptr(ret_ret, true);
11860 }
11861
11862 typedef struct LDKWriteableScore_JCalls {
11863         atomic_size_t refcnt;
11864         uint32_t instance_ptr;
11865         LDKLockableScore_JCalls* LockableScore;
11866 } LDKWriteableScore_JCalls;
11867 static void LDKWriteableScore_JCalls_free(void* this_arg) {
11868         LDKWriteableScore_JCalls *j_calls = (LDKWriteableScore_JCalls*) this_arg;
11869         if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
11870                 FREE(j_calls);
11871         }
11872 }
11873 LDKCVec_u8Z write_LDKWriteableScore_jcall(const void* this_arg) {
11874         LDKWriteableScore_JCalls *j_calls = (LDKWriteableScore_JCalls*) this_arg;
11875         int8_tArray ret = (int8_tArray)js_invoke_function_uuuuuu(j_calls->instance_ptr, 56, 0, 0, 0, 0, 0, 0);
11876         LDKCVec_u8Z ret_ref;
11877         ret_ref.datalen = ret->arr_len;
11878         ret_ref.data = MALLOC(ret_ref.datalen, "LDKCVec_u8Z Bytes");
11879         memcpy(ret_ref.data, ret->elems, ret_ref.datalen); FREE(ret);
11880         return ret_ref;
11881 }
11882 static void LDKWriteableScore_JCalls_cloned(LDKWriteableScore* new_obj) {
11883         LDKWriteableScore_JCalls *j_calls = (LDKWriteableScore_JCalls*) new_obj->this_arg;
11884         atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
11885         atomic_fetch_add_explicit(&j_calls->LockableScore->refcnt, 1, memory_order_release);
11886 }
11887 static inline LDKWriteableScore LDKWriteableScore_init (JSValue o, JSValue LockableScore) {
11888         LDKWriteableScore_JCalls *calls = MALLOC(sizeof(LDKWriteableScore_JCalls), "LDKWriteableScore_JCalls");
11889         atomic_init(&calls->refcnt, 1);
11890         calls->instance_ptr = o;
11891
11892         LDKWriteableScore ret = {
11893                 .this_arg = (void*) calls,
11894                 .write = write_LDKWriteableScore_jcall,
11895                 .free = LDKWriteableScore_JCalls_free,
11896                 .LockableScore = LDKLockableScore_init(LockableScore),
11897         };
11898         calls->LockableScore = ret.LockableScore.this_arg;
11899         return ret;
11900 }
11901 uint64_t  __attribute__((export_name("TS_LDKWriteableScore_new"))) TS_LDKWriteableScore_new(JSValue o, JSValue LockableScore) {
11902         LDKWriteableScore *res_ptr = MALLOC(sizeof(LDKWriteableScore), "LDKWriteableScore");
11903         *res_ptr = LDKWriteableScore_init(o, LockableScore);
11904         return tag_ptr(res_ptr, true);
11905 }
11906 int8_tArray  __attribute__((export_name("TS_WriteableScore_write"))) TS_WriteableScore_write(uint64_t this_arg) {
11907         void* this_arg_ptr = untag_ptr(this_arg);
11908         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
11909         LDKWriteableScore* this_arg_conv = (LDKWriteableScore*)this_arg_ptr;
11910         LDKCVec_u8Z ret_var = (this_arg_conv->write)(this_arg_conv->this_arg);
11911         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
11912         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
11913         CVec_u8Z_free(ret_var);
11914         return ret_arr;
11915 }
11916
11917 typedef struct LDKPersister_JCalls {
11918         atomic_size_t refcnt;
11919         uint32_t instance_ptr;
11920 } LDKPersister_JCalls;
11921 static void LDKPersister_JCalls_free(void* this_arg) {
11922         LDKPersister_JCalls *j_calls = (LDKPersister_JCalls*) this_arg;
11923         if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
11924                 FREE(j_calls);
11925         }
11926 }
11927 LDKCResult_NoneIOErrorZ persist_manager_LDKPersister_jcall(const void* this_arg, const LDKChannelManager * channel_manager) {
11928         LDKPersister_JCalls *j_calls = (LDKPersister_JCalls*) this_arg;
11929         LDKChannelManager channel_manager_var = *channel_manager;
11930         uint64_t channel_manager_ref = 0;
11931         // WARNING: we may need a move here but no clone is available for LDKChannelManager
11932         CHECK_INNER_FIELD_ACCESS_OR_NULL(channel_manager_var);
11933         channel_manager_ref = tag_ptr(channel_manager_var.inner, channel_manager_var.is_owned);
11934         uint64_t ret = js_invoke_function_buuuuu(j_calls->instance_ptr, 57, channel_manager_ref, 0, 0, 0, 0, 0);
11935         void* ret_ptr = untag_ptr(ret);
11936         CHECK_ACCESS(ret_ptr);
11937         LDKCResult_NoneIOErrorZ ret_conv = *(LDKCResult_NoneIOErrorZ*)(ret_ptr);
11938         FREE(untag_ptr(ret));
11939         return ret_conv;
11940 }
11941 LDKCResult_NoneIOErrorZ persist_graph_LDKPersister_jcall(const void* this_arg, const LDKNetworkGraph * network_graph) {
11942         LDKPersister_JCalls *j_calls = (LDKPersister_JCalls*) this_arg;
11943         LDKNetworkGraph network_graph_var = *network_graph;
11944         uint64_t network_graph_ref = 0;
11945         // WARNING: we may need a move here but no clone is available for LDKNetworkGraph
11946         CHECK_INNER_FIELD_ACCESS_OR_NULL(network_graph_var);
11947         network_graph_ref = tag_ptr(network_graph_var.inner, network_graph_var.is_owned);
11948         uint64_t ret = js_invoke_function_buuuuu(j_calls->instance_ptr, 58, network_graph_ref, 0, 0, 0, 0, 0);
11949         void* ret_ptr = untag_ptr(ret);
11950         CHECK_ACCESS(ret_ptr);
11951         LDKCResult_NoneIOErrorZ ret_conv = *(LDKCResult_NoneIOErrorZ*)(ret_ptr);
11952         FREE(untag_ptr(ret));
11953         return ret_conv;
11954 }
11955 LDKCResult_NoneIOErrorZ persist_scorer_LDKPersister_jcall(const void* this_arg, const LDKWriteableScore * scorer) {
11956         LDKPersister_JCalls *j_calls = (LDKPersister_JCalls*) this_arg;
11957         // WARNING: This object doesn't live past this scope, needs clone!
11958         uint64_t ret_scorer = tag_ptr(scorer, false);
11959         uint64_t ret = js_invoke_function_buuuuu(j_calls->instance_ptr, 59, ret_scorer, 0, 0, 0, 0, 0);
11960         void* ret_ptr = untag_ptr(ret);
11961         CHECK_ACCESS(ret_ptr);
11962         LDKCResult_NoneIOErrorZ ret_conv = *(LDKCResult_NoneIOErrorZ*)(ret_ptr);
11963         FREE(untag_ptr(ret));
11964         return ret_conv;
11965 }
11966 static void LDKPersister_JCalls_cloned(LDKPersister* new_obj) {
11967         LDKPersister_JCalls *j_calls = (LDKPersister_JCalls*) new_obj->this_arg;
11968         atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
11969 }
11970 static inline LDKPersister LDKPersister_init (JSValue o) {
11971         LDKPersister_JCalls *calls = MALLOC(sizeof(LDKPersister_JCalls), "LDKPersister_JCalls");
11972         atomic_init(&calls->refcnt, 1);
11973         calls->instance_ptr = o;
11974
11975         LDKPersister ret = {
11976                 .this_arg = (void*) calls,
11977                 .persist_manager = persist_manager_LDKPersister_jcall,
11978                 .persist_graph = persist_graph_LDKPersister_jcall,
11979                 .persist_scorer = persist_scorer_LDKPersister_jcall,
11980                 .free = LDKPersister_JCalls_free,
11981         };
11982         return ret;
11983 }
11984 uint64_t  __attribute__((export_name("TS_LDKPersister_new"))) TS_LDKPersister_new(JSValue o) {
11985         LDKPersister *res_ptr = MALLOC(sizeof(LDKPersister), "LDKPersister");
11986         *res_ptr = LDKPersister_init(o);
11987         return tag_ptr(res_ptr, true);
11988 }
11989 uint64_t  __attribute__((export_name("TS_Persister_persist_manager"))) TS_Persister_persist_manager(uint64_t this_arg, uint64_t channel_manager) {
11990         void* this_arg_ptr = untag_ptr(this_arg);
11991         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
11992         LDKPersister* this_arg_conv = (LDKPersister*)this_arg_ptr;
11993         LDKChannelManager channel_manager_conv;
11994         channel_manager_conv.inner = untag_ptr(channel_manager);
11995         channel_manager_conv.is_owned = ptr_is_owned(channel_manager);
11996         CHECK_INNER_FIELD_ACCESS_OR_NULL(channel_manager_conv);
11997         channel_manager_conv.is_owned = false;
11998         LDKCResult_NoneIOErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneIOErrorZ), "LDKCResult_NoneIOErrorZ");
11999         *ret_conv = (this_arg_conv->persist_manager)(this_arg_conv->this_arg, &channel_manager_conv);
12000         return tag_ptr(ret_conv, true);
12001 }
12002
12003 uint64_t  __attribute__((export_name("TS_Persister_persist_graph"))) TS_Persister_persist_graph(uint64_t this_arg, uint64_t network_graph) {
12004         void* this_arg_ptr = untag_ptr(this_arg);
12005         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
12006         LDKPersister* this_arg_conv = (LDKPersister*)this_arg_ptr;
12007         LDKNetworkGraph network_graph_conv;
12008         network_graph_conv.inner = untag_ptr(network_graph);
12009         network_graph_conv.is_owned = ptr_is_owned(network_graph);
12010         CHECK_INNER_FIELD_ACCESS_OR_NULL(network_graph_conv);
12011         network_graph_conv.is_owned = false;
12012         LDKCResult_NoneIOErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneIOErrorZ), "LDKCResult_NoneIOErrorZ");
12013         *ret_conv = (this_arg_conv->persist_graph)(this_arg_conv->this_arg, &network_graph_conv);
12014         return tag_ptr(ret_conv, true);
12015 }
12016
12017 uint64_t  __attribute__((export_name("TS_Persister_persist_scorer"))) TS_Persister_persist_scorer(uint64_t this_arg, uint64_t scorer) {
12018         void* this_arg_ptr = untag_ptr(this_arg);
12019         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
12020         LDKPersister* this_arg_conv = (LDKPersister*)this_arg_ptr;
12021         void* scorer_ptr = untag_ptr(scorer);
12022         if (ptr_is_owned(scorer)) { CHECK_ACCESS(scorer_ptr); }
12023         LDKWriteableScore* scorer_conv = (LDKWriteableScore*)scorer_ptr;
12024         LDKCResult_NoneIOErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneIOErrorZ), "LDKCResult_NoneIOErrorZ");
12025         *ret_conv = (this_arg_conv->persist_scorer)(this_arg_conv->this_arg, scorer_conv);
12026         return tag_ptr(ret_conv, true);
12027 }
12028
12029 typedef struct LDKPersist_JCalls {
12030         atomic_size_t refcnt;
12031         uint32_t instance_ptr;
12032 } LDKPersist_JCalls;
12033 static void LDKPersist_JCalls_free(void* this_arg) {
12034         LDKPersist_JCalls *j_calls = (LDKPersist_JCalls*) this_arg;
12035         if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
12036                 FREE(j_calls);
12037         }
12038 }
12039 LDKChannelMonitorUpdateStatus persist_new_channel_LDKPersist_jcall(const void* this_arg, LDKOutPoint channel_id, const LDKChannelMonitor * data, LDKMonitorUpdateId update_id) {
12040         LDKPersist_JCalls *j_calls = (LDKPersist_JCalls*) this_arg;
12041         LDKOutPoint channel_id_var = channel_id;
12042         uint64_t channel_id_ref = 0;
12043         CHECK_INNER_FIELD_ACCESS_OR_NULL(channel_id_var);
12044         channel_id_ref = tag_ptr(channel_id_var.inner, channel_id_var.is_owned);
12045         LDKChannelMonitor data_var = *data;
12046         uint64_t data_ref = 0;
12047         data_var = ChannelMonitor_clone(&data_var);
12048         CHECK_INNER_FIELD_ACCESS_OR_NULL(data_var);
12049         data_ref = tag_ptr(data_var.inner, data_var.is_owned);
12050         LDKMonitorUpdateId update_id_var = update_id;
12051         uint64_t update_id_ref = 0;
12052         CHECK_INNER_FIELD_ACCESS_OR_NULL(update_id_var);
12053         update_id_ref = tag_ptr(update_id_var.inner, update_id_var.is_owned);
12054         uint64_t ret = js_invoke_function_bbbuuu(j_calls->instance_ptr, 60, channel_id_ref, data_ref, update_id_ref, 0, 0, 0);
12055         LDKChannelMonitorUpdateStatus ret_conv = LDKChannelMonitorUpdateStatus_from_js(ret);
12056         return ret_conv;
12057 }
12058 LDKChannelMonitorUpdateStatus update_persisted_channel_LDKPersist_jcall(const void* this_arg, LDKOutPoint channel_id, LDKChannelMonitorUpdate update, const LDKChannelMonitor * data, LDKMonitorUpdateId update_id) {
12059         LDKPersist_JCalls *j_calls = (LDKPersist_JCalls*) this_arg;
12060         LDKOutPoint channel_id_var = channel_id;
12061         uint64_t channel_id_ref = 0;
12062         CHECK_INNER_FIELD_ACCESS_OR_NULL(channel_id_var);
12063         channel_id_ref = tag_ptr(channel_id_var.inner, channel_id_var.is_owned);
12064         LDKChannelMonitorUpdate update_var = update;
12065         uint64_t update_ref = 0;
12066         CHECK_INNER_FIELD_ACCESS_OR_NULL(update_var);
12067         update_ref = tag_ptr(update_var.inner, update_var.is_owned);
12068         LDKChannelMonitor data_var = *data;
12069         uint64_t data_ref = 0;
12070         data_var = ChannelMonitor_clone(&data_var);
12071         CHECK_INNER_FIELD_ACCESS_OR_NULL(data_var);
12072         data_ref = tag_ptr(data_var.inner, data_var.is_owned);
12073         LDKMonitorUpdateId update_id_var = update_id;
12074         uint64_t update_id_ref = 0;
12075         CHECK_INNER_FIELD_ACCESS_OR_NULL(update_id_var);
12076         update_id_ref = tag_ptr(update_id_var.inner, update_id_var.is_owned);
12077         uint64_t ret = js_invoke_function_bbbbuu(j_calls->instance_ptr, 61, channel_id_ref, update_ref, data_ref, update_id_ref, 0, 0);
12078         LDKChannelMonitorUpdateStatus ret_conv = LDKChannelMonitorUpdateStatus_from_js(ret);
12079         return ret_conv;
12080 }
12081 static void LDKPersist_JCalls_cloned(LDKPersist* new_obj) {
12082         LDKPersist_JCalls *j_calls = (LDKPersist_JCalls*) new_obj->this_arg;
12083         atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
12084 }
12085 static inline LDKPersist LDKPersist_init (JSValue o) {
12086         LDKPersist_JCalls *calls = MALLOC(sizeof(LDKPersist_JCalls), "LDKPersist_JCalls");
12087         atomic_init(&calls->refcnt, 1);
12088         calls->instance_ptr = o;
12089
12090         LDKPersist ret = {
12091                 .this_arg = (void*) calls,
12092                 .persist_new_channel = persist_new_channel_LDKPersist_jcall,
12093                 .update_persisted_channel = update_persisted_channel_LDKPersist_jcall,
12094                 .free = LDKPersist_JCalls_free,
12095         };
12096         return ret;
12097 }
12098 uint64_t  __attribute__((export_name("TS_LDKPersist_new"))) TS_LDKPersist_new(JSValue o) {
12099         LDKPersist *res_ptr = MALLOC(sizeof(LDKPersist), "LDKPersist");
12100         *res_ptr = LDKPersist_init(o);
12101         return tag_ptr(res_ptr, true);
12102 }
12103 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) {
12104         void* this_arg_ptr = untag_ptr(this_arg);
12105         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
12106         LDKPersist* this_arg_conv = (LDKPersist*)this_arg_ptr;
12107         LDKOutPoint channel_id_conv;
12108         channel_id_conv.inner = untag_ptr(channel_id);
12109         channel_id_conv.is_owned = ptr_is_owned(channel_id);
12110         CHECK_INNER_FIELD_ACCESS_OR_NULL(channel_id_conv);
12111         channel_id_conv = OutPoint_clone(&channel_id_conv);
12112         LDKChannelMonitor data_conv;
12113         data_conv.inner = untag_ptr(data);
12114         data_conv.is_owned = ptr_is_owned(data);
12115         CHECK_INNER_FIELD_ACCESS_OR_NULL(data_conv);
12116         data_conv.is_owned = false;
12117         LDKMonitorUpdateId update_id_conv;
12118         update_id_conv.inner = untag_ptr(update_id);
12119         update_id_conv.is_owned = ptr_is_owned(update_id);
12120         CHECK_INNER_FIELD_ACCESS_OR_NULL(update_id_conv);
12121         update_id_conv = MonitorUpdateId_clone(&update_id_conv);
12122         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));
12123         return ret_conv;
12124 }
12125
12126 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) {
12127         void* this_arg_ptr = untag_ptr(this_arg);
12128         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
12129         LDKPersist* this_arg_conv = (LDKPersist*)this_arg_ptr;
12130         LDKOutPoint channel_id_conv;
12131         channel_id_conv.inner = untag_ptr(channel_id);
12132         channel_id_conv.is_owned = ptr_is_owned(channel_id);
12133         CHECK_INNER_FIELD_ACCESS_OR_NULL(channel_id_conv);
12134         channel_id_conv = OutPoint_clone(&channel_id_conv);
12135         LDKChannelMonitorUpdate update_conv;
12136         update_conv.inner = untag_ptr(update);
12137         update_conv.is_owned = ptr_is_owned(update);
12138         CHECK_INNER_FIELD_ACCESS_OR_NULL(update_conv);
12139         update_conv = ChannelMonitorUpdate_clone(&update_conv);
12140         LDKChannelMonitor data_conv;
12141         data_conv.inner = untag_ptr(data);
12142         data_conv.is_owned = ptr_is_owned(data);
12143         CHECK_INNER_FIELD_ACCESS_OR_NULL(data_conv);
12144         data_conv.is_owned = false;
12145         LDKMonitorUpdateId update_id_conv;
12146         update_id_conv.inner = untag_ptr(update_id);
12147         update_id_conv.is_owned = ptr_is_owned(update_id);
12148         CHECK_INNER_FIELD_ACCESS_OR_NULL(update_id_conv);
12149         update_id_conv = MonitorUpdateId_clone(&update_id_conv);
12150         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));
12151         return ret_conv;
12152 }
12153
12154 typedef struct LDKFutureCallback_JCalls {
12155         atomic_size_t refcnt;
12156         uint32_t instance_ptr;
12157 } LDKFutureCallback_JCalls;
12158 static void LDKFutureCallback_JCalls_free(void* this_arg) {
12159         LDKFutureCallback_JCalls *j_calls = (LDKFutureCallback_JCalls*) this_arg;
12160         if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
12161                 FREE(j_calls);
12162         }
12163 }
12164 void call_LDKFutureCallback_jcall(const void* this_arg) {
12165         LDKFutureCallback_JCalls *j_calls = (LDKFutureCallback_JCalls*) this_arg;
12166         js_invoke_function_uuuuuu(j_calls->instance_ptr, 62, 0, 0, 0, 0, 0, 0);
12167 }
12168 static void LDKFutureCallback_JCalls_cloned(LDKFutureCallback* new_obj) {
12169         LDKFutureCallback_JCalls *j_calls = (LDKFutureCallback_JCalls*) new_obj->this_arg;
12170         atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
12171 }
12172 static inline LDKFutureCallback LDKFutureCallback_init (JSValue o) {
12173         LDKFutureCallback_JCalls *calls = MALLOC(sizeof(LDKFutureCallback_JCalls), "LDKFutureCallback_JCalls");
12174         atomic_init(&calls->refcnt, 1);
12175         calls->instance_ptr = o;
12176
12177         LDKFutureCallback ret = {
12178                 .this_arg = (void*) calls,
12179                 .call = call_LDKFutureCallback_jcall,
12180                 .free = LDKFutureCallback_JCalls_free,
12181         };
12182         return ret;
12183 }
12184 uint64_t  __attribute__((export_name("TS_LDKFutureCallback_new"))) TS_LDKFutureCallback_new(JSValue o) {
12185         LDKFutureCallback *res_ptr = MALLOC(sizeof(LDKFutureCallback), "LDKFutureCallback");
12186         *res_ptr = LDKFutureCallback_init(o);
12187         return tag_ptr(res_ptr, true);
12188 }
12189 void  __attribute__((export_name("TS_FutureCallback_call"))) TS_FutureCallback_call(uint64_t this_arg) {
12190         void* this_arg_ptr = untag_ptr(this_arg);
12191         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
12192         LDKFutureCallback* this_arg_conv = (LDKFutureCallback*)this_arg_ptr;
12193         (this_arg_conv->call)(this_arg_conv->this_arg);
12194 }
12195
12196 typedef struct LDKListen_JCalls {
12197         atomic_size_t refcnt;
12198         uint32_t instance_ptr;
12199 } LDKListen_JCalls;
12200 static void LDKListen_JCalls_free(void* this_arg) {
12201         LDKListen_JCalls *j_calls = (LDKListen_JCalls*) this_arg;
12202         if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
12203                 FREE(j_calls);
12204         }
12205 }
12206 void filtered_block_connected_LDKListen_jcall(const void* this_arg, const uint8_t (* header)[80], LDKCVec_C2Tuple_usizeTransactionZZ txdata, uint32_t height) {
12207         LDKListen_JCalls *j_calls = (LDKListen_JCalls*) this_arg;
12208         int8_tArray header_arr = init_int8_tArray(80, __LINE__);
12209         memcpy(header_arr->elems, *header, 80);
12210         LDKCVec_C2Tuple_usizeTransactionZZ txdata_var = txdata;
12211         uint64_tArray txdata_arr = NULL;
12212         txdata_arr = init_uint64_tArray(txdata_var.datalen, __LINE__);
12213         uint64_t *txdata_arr_ptr = (uint64_t*)(((uint8_t*)txdata_arr) + 8);
12214         for (size_t c = 0; c < txdata_var.datalen; c++) {
12215                 LDKC2Tuple_usizeTransactionZ* txdata_conv_28_conv = MALLOC(sizeof(LDKC2Tuple_usizeTransactionZ), "LDKC2Tuple_usizeTransactionZ");
12216                 *txdata_conv_28_conv = txdata_var.data[c];
12217                 txdata_arr_ptr[c] = tag_ptr(txdata_conv_28_conv, true);
12218         }
12219         
12220         FREE(txdata_var.data);
12221         int32_t height_conv = height;
12222         js_invoke_function_uuuuuu(j_calls->instance_ptr, 63, (uint32_t)header_arr, (uint32_t)txdata_arr, height_conv, 0, 0, 0);
12223 }
12224 void block_connected_LDKListen_jcall(const void* this_arg, LDKu8slice block, uint32_t height) {
12225         LDKListen_JCalls *j_calls = (LDKListen_JCalls*) this_arg;
12226         LDKu8slice block_var = block;
12227         int8_tArray block_arr = init_int8_tArray(block_var.datalen, __LINE__);
12228         memcpy(block_arr->elems, block_var.data, block_var.datalen);
12229         int32_t height_conv = height;
12230         js_invoke_function_uuuuuu(j_calls->instance_ptr, 64, (uint32_t)block_arr, height_conv, 0, 0, 0, 0);
12231 }
12232 void block_disconnected_LDKListen_jcall(const void* this_arg, const uint8_t (* header)[80], uint32_t height) {
12233         LDKListen_JCalls *j_calls = (LDKListen_JCalls*) this_arg;
12234         int8_tArray header_arr = init_int8_tArray(80, __LINE__);
12235         memcpy(header_arr->elems, *header, 80);
12236         int32_t height_conv = height;
12237         js_invoke_function_uuuuuu(j_calls->instance_ptr, 65, (uint32_t)header_arr, height_conv, 0, 0, 0, 0);
12238 }
12239 static void LDKListen_JCalls_cloned(LDKListen* new_obj) {
12240         LDKListen_JCalls *j_calls = (LDKListen_JCalls*) new_obj->this_arg;
12241         atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
12242 }
12243 static inline LDKListen LDKListen_init (JSValue o) {
12244         LDKListen_JCalls *calls = MALLOC(sizeof(LDKListen_JCalls), "LDKListen_JCalls");
12245         atomic_init(&calls->refcnt, 1);
12246         calls->instance_ptr = o;
12247
12248         LDKListen ret = {
12249                 .this_arg = (void*) calls,
12250                 .filtered_block_connected = filtered_block_connected_LDKListen_jcall,
12251                 .block_connected = block_connected_LDKListen_jcall,
12252                 .block_disconnected = block_disconnected_LDKListen_jcall,
12253                 .free = LDKListen_JCalls_free,
12254         };
12255         return ret;
12256 }
12257 uint64_t  __attribute__((export_name("TS_LDKListen_new"))) TS_LDKListen_new(JSValue o) {
12258         LDKListen *res_ptr = MALLOC(sizeof(LDKListen), "LDKListen");
12259         *res_ptr = LDKListen_init(o);
12260         return tag_ptr(res_ptr, true);
12261 }
12262 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) {
12263         void* this_arg_ptr = untag_ptr(this_arg);
12264         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
12265         LDKListen* this_arg_conv = (LDKListen*)this_arg_ptr;
12266         uint8_t header_arr[80];
12267         CHECK(header->arr_len == 80);
12268         memcpy(header_arr, header->elems, 80); FREE(header);
12269         uint8_t (*header_ref)[80] = &header_arr;
12270         LDKCVec_C2Tuple_usizeTransactionZZ txdata_constr;
12271         txdata_constr.datalen = txdata->arr_len;
12272         if (txdata_constr.datalen > 0)
12273                 txdata_constr.data = MALLOC(txdata_constr.datalen * sizeof(LDKC2Tuple_usizeTransactionZ), "LDKCVec_C2Tuple_usizeTransactionZZ Elements");
12274         else
12275                 txdata_constr.data = NULL;
12276         uint64_t* txdata_vals = txdata->elems;
12277         for (size_t c = 0; c < txdata_constr.datalen; c++) {
12278                 uint64_t txdata_conv_28 = txdata_vals[c];
12279                 void* txdata_conv_28_ptr = untag_ptr(txdata_conv_28);
12280                 CHECK_ACCESS(txdata_conv_28_ptr);
12281                 LDKC2Tuple_usizeTransactionZ txdata_conv_28_conv = *(LDKC2Tuple_usizeTransactionZ*)(txdata_conv_28_ptr);
12282                 txdata_conv_28_conv = C2Tuple_usizeTransactionZ_clone((LDKC2Tuple_usizeTransactionZ*)untag_ptr(txdata_conv_28));
12283                 txdata_constr.data[c] = txdata_conv_28_conv;
12284         }
12285         FREE(txdata);
12286         (this_arg_conv->filtered_block_connected)(this_arg_conv->this_arg, header_ref, txdata_constr, height);
12287 }
12288
12289 void  __attribute__((export_name("TS_Listen_block_connected"))) TS_Listen_block_connected(uint64_t this_arg, int8_tArray block, int32_t height) {
12290         void* this_arg_ptr = untag_ptr(this_arg);
12291         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
12292         LDKListen* this_arg_conv = (LDKListen*)this_arg_ptr;
12293         LDKu8slice block_ref;
12294         block_ref.datalen = block->arr_len;
12295         block_ref.data = block->elems;
12296         (this_arg_conv->block_connected)(this_arg_conv->this_arg, block_ref, height);
12297         FREE(block);
12298 }
12299
12300 void  __attribute__((export_name("TS_Listen_block_disconnected"))) TS_Listen_block_disconnected(uint64_t this_arg, int8_tArray header, int32_t height) {
12301         void* this_arg_ptr = untag_ptr(this_arg);
12302         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
12303         LDKListen* this_arg_conv = (LDKListen*)this_arg_ptr;
12304         uint8_t header_arr[80];
12305         CHECK(header->arr_len == 80);
12306         memcpy(header_arr, header->elems, 80); FREE(header);
12307         uint8_t (*header_ref)[80] = &header_arr;
12308         (this_arg_conv->block_disconnected)(this_arg_conv->this_arg, header_ref, height);
12309 }
12310
12311 typedef struct LDKConfirm_JCalls {
12312         atomic_size_t refcnt;
12313         uint32_t instance_ptr;
12314 } LDKConfirm_JCalls;
12315 static void LDKConfirm_JCalls_free(void* this_arg) {
12316         LDKConfirm_JCalls *j_calls = (LDKConfirm_JCalls*) this_arg;
12317         if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
12318                 FREE(j_calls);
12319         }
12320 }
12321 void transactions_confirmed_LDKConfirm_jcall(const void* this_arg, const uint8_t (* header)[80], LDKCVec_C2Tuple_usizeTransactionZZ txdata, uint32_t height) {
12322         LDKConfirm_JCalls *j_calls = (LDKConfirm_JCalls*) this_arg;
12323         int8_tArray header_arr = init_int8_tArray(80, __LINE__);
12324         memcpy(header_arr->elems, *header, 80);
12325         LDKCVec_C2Tuple_usizeTransactionZZ txdata_var = txdata;
12326         uint64_tArray txdata_arr = NULL;
12327         txdata_arr = init_uint64_tArray(txdata_var.datalen, __LINE__);
12328         uint64_t *txdata_arr_ptr = (uint64_t*)(((uint8_t*)txdata_arr) + 8);
12329         for (size_t c = 0; c < txdata_var.datalen; c++) {
12330                 LDKC2Tuple_usizeTransactionZ* txdata_conv_28_conv = MALLOC(sizeof(LDKC2Tuple_usizeTransactionZ), "LDKC2Tuple_usizeTransactionZ");
12331                 *txdata_conv_28_conv = txdata_var.data[c];
12332                 txdata_arr_ptr[c] = tag_ptr(txdata_conv_28_conv, true);
12333         }
12334         
12335         FREE(txdata_var.data);
12336         int32_t height_conv = height;
12337         js_invoke_function_uuuuuu(j_calls->instance_ptr, 66, (uint32_t)header_arr, (uint32_t)txdata_arr, height_conv, 0, 0, 0);
12338 }
12339 void transaction_unconfirmed_LDKConfirm_jcall(const void* this_arg, const uint8_t (* txid)[32]) {
12340         LDKConfirm_JCalls *j_calls = (LDKConfirm_JCalls*) this_arg;
12341         int8_tArray txid_arr = init_int8_tArray(32, __LINE__);
12342         memcpy(txid_arr->elems, *txid, 32);
12343         js_invoke_function_uuuuuu(j_calls->instance_ptr, 67, (uint32_t)txid_arr, 0, 0, 0, 0, 0);
12344 }
12345 void best_block_updated_LDKConfirm_jcall(const void* this_arg, const uint8_t (* header)[80], uint32_t height) {
12346         LDKConfirm_JCalls *j_calls = (LDKConfirm_JCalls*) this_arg;
12347         int8_tArray header_arr = init_int8_tArray(80, __LINE__);
12348         memcpy(header_arr->elems, *header, 80);
12349         int32_t height_conv = height;
12350         js_invoke_function_uuuuuu(j_calls->instance_ptr, 68, (uint32_t)header_arr, height_conv, 0, 0, 0, 0);
12351 }
12352 LDKCVec_C2Tuple_ThirtyTwoBytesCOption_ThirtyTwoBytesZZZ get_relevant_txids_LDKConfirm_jcall(const void* this_arg) {
12353         LDKConfirm_JCalls *j_calls = (LDKConfirm_JCalls*) this_arg;
12354         uint64_tArray ret = (uint64_tArray)js_invoke_function_uuuuuu(j_calls->instance_ptr, 69, 0, 0, 0, 0, 0, 0);
12355         LDKCVec_C2Tuple_ThirtyTwoBytesCOption_ThirtyTwoBytesZZZ ret_constr;
12356         ret_constr.datalen = ret->arr_len;
12357         if (ret_constr.datalen > 0)
12358                 ret_constr.data = MALLOC(ret_constr.datalen * sizeof(LDKC2Tuple_ThirtyTwoBytesCOption_ThirtyTwoBytesZZ), "LDKCVec_C2Tuple_ThirtyTwoBytesCOption_ThirtyTwoBytesZZZ Elements");
12359         else
12360                 ret_constr.data = NULL;
12361         uint64_t* ret_vals = ret->elems;
12362         for (size_t x = 0; x < ret_constr.datalen; x++) {
12363                 uint64_t ret_conv_49 = ret_vals[x];
12364                 void* ret_conv_49_ptr = untag_ptr(ret_conv_49);
12365                 CHECK_ACCESS(ret_conv_49_ptr);
12366                 LDKC2Tuple_ThirtyTwoBytesCOption_ThirtyTwoBytesZZ ret_conv_49_conv = *(LDKC2Tuple_ThirtyTwoBytesCOption_ThirtyTwoBytesZZ*)(ret_conv_49_ptr);
12367                 FREE(untag_ptr(ret_conv_49));
12368                 ret_constr.data[x] = ret_conv_49_conv;
12369         }
12370         FREE(ret);
12371         return ret_constr;
12372 }
12373 static void LDKConfirm_JCalls_cloned(LDKConfirm* new_obj) {
12374         LDKConfirm_JCalls *j_calls = (LDKConfirm_JCalls*) new_obj->this_arg;
12375         atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
12376 }
12377 static inline LDKConfirm LDKConfirm_init (JSValue o) {
12378         LDKConfirm_JCalls *calls = MALLOC(sizeof(LDKConfirm_JCalls), "LDKConfirm_JCalls");
12379         atomic_init(&calls->refcnt, 1);
12380         calls->instance_ptr = o;
12381
12382         LDKConfirm ret = {
12383                 .this_arg = (void*) calls,
12384                 .transactions_confirmed = transactions_confirmed_LDKConfirm_jcall,
12385                 .transaction_unconfirmed = transaction_unconfirmed_LDKConfirm_jcall,
12386                 .best_block_updated = best_block_updated_LDKConfirm_jcall,
12387                 .get_relevant_txids = get_relevant_txids_LDKConfirm_jcall,
12388                 .free = LDKConfirm_JCalls_free,
12389         };
12390         return ret;
12391 }
12392 uint64_t  __attribute__((export_name("TS_LDKConfirm_new"))) TS_LDKConfirm_new(JSValue o) {
12393         LDKConfirm *res_ptr = MALLOC(sizeof(LDKConfirm), "LDKConfirm");
12394         *res_ptr = LDKConfirm_init(o);
12395         return tag_ptr(res_ptr, true);
12396 }
12397 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) {
12398         void* this_arg_ptr = untag_ptr(this_arg);
12399         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
12400         LDKConfirm* this_arg_conv = (LDKConfirm*)this_arg_ptr;
12401         uint8_t header_arr[80];
12402         CHECK(header->arr_len == 80);
12403         memcpy(header_arr, header->elems, 80); FREE(header);
12404         uint8_t (*header_ref)[80] = &header_arr;
12405         LDKCVec_C2Tuple_usizeTransactionZZ txdata_constr;
12406         txdata_constr.datalen = txdata->arr_len;
12407         if (txdata_constr.datalen > 0)
12408                 txdata_constr.data = MALLOC(txdata_constr.datalen * sizeof(LDKC2Tuple_usizeTransactionZ), "LDKCVec_C2Tuple_usizeTransactionZZ Elements");
12409         else
12410                 txdata_constr.data = NULL;
12411         uint64_t* txdata_vals = txdata->elems;
12412         for (size_t c = 0; c < txdata_constr.datalen; c++) {
12413                 uint64_t txdata_conv_28 = txdata_vals[c];
12414                 void* txdata_conv_28_ptr = untag_ptr(txdata_conv_28);
12415                 CHECK_ACCESS(txdata_conv_28_ptr);
12416                 LDKC2Tuple_usizeTransactionZ txdata_conv_28_conv = *(LDKC2Tuple_usizeTransactionZ*)(txdata_conv_28_ptr);
12417                 txdata_conv_28_conv = C2Tuple_usizeTransactionZ_clone((LDKC2Tuple_usizeTransactionZ*)untag_ptr(txdata_conv_28));
12418                 txdata_constr.data[c] = txdata_conv_28_conv;
12419         }
12420         FREE(txdata);
12421         (this_arg_conv->transactions_confirmed)(this_arg_conv->this_arg, header_ref, txdata_constr, height);
12422 }
12423
12424 void  __attribute__((export_name("TS_Confirm_transaction_unconfirmed"))) TS_Confirm_transaction_unconfirmed(uint64_t this_arg, int8_tArray txid) {
12425         void* this_arg_ptr = untag_ptr(this_arg);
12426         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
12427         LDKConfirm* this_arg_conv = (LDKConfirm*)this_arg_ptr;
12428         uint8_t txid_arr[32];
12429         CHECK(txid->arr_len == 32);
12430         memcpy(txid_arr, txid->elems, 32); FREE(txid);
12431         uint8_t (*txid_ref)[32] = &txid_arr;
12432         (this_arg_conv->transaction_unconfirmed)(this_arg_conv->this_arg, txid_ref);
12433 }
12434
12435 void  __attribute__((export_name("TS_Confirm_best_block_updated"))) TS_Confirm_best_block_updated(uint64_t this_arg, int8_tArray header, int32_t height) {
12436         void* this_arg_ptr = untag_ptr(this_arg);
12437         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
12438         LDKConfirm* this_arg_conv = (LDKConfirm*)this_arg_ptr;
12439         uint8_t header_arr[80];
12440         CHECK(header->arr_len == 80);
12441         memcpy(header_arr, header->elems, 80); FREE(header);
12442         uint8_t (*header_ref)[80] = &header_arr;
12443         (this_arg_conv->best_block_updated)(this_arg_conv->this_arg, header_ref, height);
12444 }
12445
12446 uint64_tArray  __attribute__((export_name("TS_Confirm_get_relevant_txids"))) TS_Confirm_get_relevant_txids(uint64_t this_arg) {
12447         void* this_arg_ptr = untag_ptr(this_arg);
12448         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
12449         LDKConfirm* this_arg_conv = (LDKConfirm*)this_arg_ptr;
12450         LDKCVec_C2Tuple_ThirtyTwoBytesCOption_ThirtyTwoBytesZZZ ret_var = (this_arg_conv->get_relevant_txids)(this_arg_conv->this_arg);
12451         uint64_tArray ret_arr = NULL;
12452         ret_arr = init_uint64_tArray(ret_var.datalen, __LINE__);
12453         uint64_t *ret_arr_ptr = (uint64_t*)(((uint8_t*)ret_arr) + 8);
12454         for (size_t x = 0; x < ret_var.datalen; x++) {
12455                 LDKC2Tuple_ThirtyTwoBytesCOption_ThirtyTwoBytesZZ* ret_conv_49_conv = MALLOC(sizeof(LDKC2Tuple_ThirtyTwoBytesCOption_ThirtyTwoBytesZZ), "LDKC2Tuple_ThirtyTwoBytesCOption_ThirtyTwoBytesZZ");
12456                 *ret_conv_49_conv = ret_var.data[x];
12457                 ret_arr_ptr[x] = tag_ptr(ret_conv_49_conv, true);
12458         }
12459         
12460         FREE(ret_var.data);
12461         return ret_arr;
12462 }
12463
12464 typedef struct LDKEventHandler_JCalls {
12465         atomic_size_t refcnt;
12466         uint32_t instance_ptr;
12467 } LDKEventHandler_JCalls;
12468 static void LDKEventHandler_JCalls_free(void* this_arg) {
12469         LDKEventHandler_JCalls *j_calls = (LDKEventHandler_JCalls*) this_arg;
12470         if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
12471                 FREE(j_calls);
12472         }
12473 }
12474 void handle_event_LDKEventHandler_jcall(const void* this_arg, LDKEvent event) {
12475         LDKEventHandler_JCalls *j_calls = (LDKEventHandler_JCalls*) this_arg;
12476         LDKEvent *event_copy = MALLOC(sizeof(LDKEvent), "LDKEvent");
12477         *event_copy = event;
12478         uint64_t event_ref = tag_ptr(event_copy, true);
12479         js_invoke_function_buuuuu(j_calls->instance_ptr, 70, event_ref, 0, 0, 0, 0, 0);
12480 }
12481 static void LDKEventHandler_JCalls_cloned(LDKEventHandler* new_obj) {
12482         LDKEventHandler_JCalls *j_calls = (LDKEventHandler_JCalls*) new_obj->this_arg;
12483         atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
12484 }
12485 static inline LDKEventHandler LDKEventHandler_init (JSValue o) {
12486         LDKEventHandler_JCalls *calls = MALLOC(sizeof(LDKEventHandler_JCalls), "LDKEventHandler_JCalls");
12487         atomic_init(&calls->refcnt, 1);
12488         calls->instance_ptr = o;
12489
12490         LDKEventHandler ret = {
12491                 .this_arg = (void*) calls,
12492                 .handle_event = handle_event_LDKEventHandler_jcall,
12493                 .free = LDKEventHandler_JCalls_free,
12494         };
12495         return ret;
12496 }
12497 uint64_t  __attribute__((export_name("TS_LDKEventHandler_new"))) TS_LDKEventHandler_new(JSValue o) {
12498         LDKEventHandler *res_ptr = MALLOC(sizeof(LDKEventHandler), "LDKEventHandler");
12499         *res_ptr = LDKEventHandler_init(o);
12500         return tag_ptr(res_ptr, true);
12501 }
12502 void  __attribute__((export_name("TS_EventHandler_handle_event"))) TS_EventHandler_handle_event(uint64_t this_arg, uint64_t event) {
12503         void* this_arg_ptr = untag_ptr(this_arg);
12504         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
12505         LDKEventHandler* this_arg_conv = (LDKEventHandler*)this_arg_ptr;
12506         void* event_ptr = untag_ptr(event);
12507         CHECK_ACCESS(event_ptr);
12508         LDKEvent event_conv = *(LDKEvent*)(event_ptr);
12509         event_conv = Event_clone((LDKEvent*)untag_ptr(event));
12510         (this_arg_conv->handle_event)(this_arg_conv->this_arg, event_conv);
12511 }
12512
12513 typedef struct LDKEventsProvider_JCalls {
12514         atomic_size_t refcnt;
12515         uint32_t instance_ptr;
12516 } LDKEventsProvider_JCalls;
12517 static void LDKEventsProvider_JCalls_free(void* this_arg) {
12518         LDKEventsProvider_JCalls *j_calls = (LDKEventsProvider_JCalls*) this_arg;
12519         if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
12520                 FREE(j_calls);
12521         }
12522 }
12523 void process_pending_events_LDKEventsProvider_jcall(const void* this_arg, LDKEventHandler handler) {
12524         LDKEventsProvider_JCalls *j_calls = (LDKEventsProvider_JCalls*) this_arg;
12525         LDKEventHandler* handler_ret = MALLOC(sizeof(LDKEventHandler), "LDKEventHandler");
12526         *handler_ret = handler;
12527         js_invoke_function_buuuuu(j_calls->instance_ptr, 71, tag_ptr(handler_ret, true), 0, 0, 0, 0, 0);
12528 }
12529 static void LDKEventsProvider_JCalls_cloned(LDKEventsProvider* new_obj) {
12530         LDKEventsProvider_JCalls *j_calls = (LDKEventsProvider_JCalls*) new_obj->this_arg;
12531         atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
12532 }
12533 static inline LDKEventsProvider LDKEventsProvider_init (JSValue o) {
12534         LDKEventsProvider_JCalls *calls = MALLOC(sizeof(LDKEventsProvider_JCalls), "LDKEventsProvider_JCalls");
12535         atomic_init(&calls->refcnt, 1);
12536         calls->instance_ptr = o;
12537
12538         LDKEventsProvider ret = {
12539                 .this_arg = (void*) calls,
12540                 .process_pending_events = process_pending_events_LDKEventsProvider_jcall,
12541                 .free = LDKEventsProvider_JCalls_free,
12542         };
12543         return ret;
12544 }
12545 uint64_t  __attribute__((export_name("TS_LDKEventsProvider_new"))) TS_LDKEventsProvider_new(JSValue o) {
12546         LDKEventsProvider *res_ptr = MALLOC(sizeof(LDKEventsProvider), "LDKEventsProvider");
12547         *res_ptr = LDKEventsProvider_init(o);
12548         return tag_ptr(res_ptr, true);
12549 }
12550 void  __attribute__((export_name("TS_EventsProvider_process_pending_events"))) TS_EventsProvider_process_pending_events(uint64_t this_arg, uint64_t handler) {
12551         void* this_arg_ptr = untag_ptr(this_arg);
12552         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
12553         LDKEventsProvider* this_arg_conv = (LDKEventsProvider*)this_arg_ptr;
12554         void* handler_ptr = untag_ptr(handler);
12555         CHECK_ACCESS(handler_ptr);
12556         LDKEventHandler handler_conv = *(LDKEventHandler*)(handler_ptr);
12557         if (handler_conv.free == LDKEventHandler_JCalls_free) {
12558                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
12559                 LDKEventHandler_JCalls_cloned(&handler_conv);
12560         }
12561         (this_arg_conv->process_pending_events)(this_arg_conv->this_arg, handler_conv);
12562 }
12563
12564 uint32_t __attribute__((export_name("TS_LDKFailureCode_ty_from_ptr"))) TS_LDKFailureCode_ty_from_ptr(uint64_t ptr) {
12565         LDKFailureCode *obj = (LDKFailureCode*)untag_ptr(ptr);
12566         switch(obj->tag) {
12567                 case LDKFailureCode_TemporaryNodeFailure: return 0;
12568                 case LDKFailureCode_RequiredNodeFeatureMissing: return 1;
12569                 case LDKFailureCode_IncorrectOrUnknownPaymentDetails: return 2;
12570                 case LDKFailureCode_InvalidOnionPayload: return 3;
12571                 default: abort();
12572         }
12573 }
12574 uint64_t __attribute__((export_name("TS_LDKFailureCode_InvalidOnionPayload_get_invalid_onion_payload"))) TS_LDKFailureCode_InvalidOnionPayload_get_invalid_onion_payload(uint64_t ptr) {
12575         LDKFailureCode *obj = (LDKFailureCode*)untag_ptr(ptr);
12576         assert(obj->tag == LDKFailureCode_InvalidOnionPayload);
12577         uint64_t invalid_onion_payload_ref = tag_ptr(&obj->invalid_onion_payload, false);
12578         return invalid_onion_payload_ref;
12579 }
12580 typedef struct LDKMessageSendEventsProvider_JCalls {
12581         atomic_size_t refcnt;
12582         uint32_t instance_ptr;
12583 } LDKMessageSendEventsProvider_JCalls;
12584 static void LDKMessageSendEventsProvider_JCalls_free(void* this_arg) {
12585         LDKMessageSendEventsProvider_JCalls *j_calls = (LDKMessageSendEventsProvider_JCalls*) this_arg;
12586         if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
12587                 FREE(j_calls);
12588         }
12589 }
12590 LDKCVec_MessageSendEventZ get_and_clear_pending_msg_events_LDKMessageSendEventsProvider_jcall(const void* this_arg) {
12591         LDKMessageSendEventsProvider_JCalls *j_calls = (LDKMessageSendEventsProvider_JCalls*) this_arg;
12592         uint64_tArray ret = (uint64_tArray)js_invoke_function_uuuuuu(j_calls->instance_ptr, 72, 0, 0, 0, 0, 0, 0);
12593         LDKCVec_MessageSendEventZ ret_constr;
12594         ret_constr.datalen = ret->arr_len;
12595         if (ret_constr.datalen > 0)
12596                 ret_constr.data = MALLOC(ret_constr.datalen * sizeof(LDKMessageSendEvent), "LDKCVec_MessageSendEventZ Elements");
12597         else
12598                 ret_constr.data = NULL;
12599         uint64_t* ret_vals = ret->elems;
12600         for (size_t s = 0; s < ret_constr.datalen; s++) {
12601                 uint64_t ret_conv_18 = ret_vals[s];
12602                 void* ret_conv_18_ptr = untag_ptr(ret_conv_18);
12603                 CHECK_ACCESS(ret_conv_18_ptr);
12604                 LDKMessageSendEvent ret_conv_18_conv = *(LDKMessageSendEvent*)(ret_conv_18_ptr);
12605                 FREE(untag_ptr(ret_conv_18));
12606                 ret_constr.data[s] = ret_conv_18_conv;
12607         }
12608         FREE(ret);
12609         return ret_constr;
12610 }
12611 static void LDKMessageSendEventsProvider_JCalls_cloned(LDKMessageSendEventsProvider* new_obj) {
12612         LDKMessageSendEventsProvider_JCalls *j_calls = (LDKMessageSendEventsProvider_JCalls*) new_obj->this_arg;
12613         atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
12614 }
12615 static inline LDKMessageSendEventsProvider LDKMessageSendEventsProvider_init (JSValue o) {
12616         LDKMessageSendEventsProvider_JCalls *calls = MALLOC(sizeof(LDKMessageSendEventsProvider_JCalls), "LDKMessageSendEventsProvider_JCalls");
12617         atomic_init(&calls->refcnt, 1);
12618         calls->instance_ptr = o;
12619
12620         LDKMessageSendEventsProvider ret = {
12621                 .this_arg = (void*) calls,
12622                 .get_and_clear_pending_msg_events = get_and_clear_pending_msg_events_LDKMessageSendEventsProvider_jcall,
12623                 .free = LDKMessageSendEventsProvider_JCalls_free,
12624         };
12625         return ret;
12626 }
12627 uint64_t  __attribute__((export_name("TS_LDKMessageSendEventsProvider_new"))) TS_LDKMessageSendEventsProvider_new(JSValue o) {
12628         LDKMessageSendEventsProvider *res_ptr = MALLOC(sizeof(LDKMessageSendEventsProvider), "LDKMessageSendEventsProvider");
12629         *res_ptr = LDKMessageSendEventsProvider_init(o);
12630         return tag_ptr(res_ptr, true);
12631 }
12632 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) {
12633         void* this_arg_ptr = untag_ptr(this_arg);
12634         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
12635         LDKMessageSendEventsProvider* this_arg_conv = (LDKMessageSendEventsProvider*)this_arg_ptr;
12636         LDKCVec_MessageSendEventZ ret_var = (this_arg_conv->get_and_clear_pending_msg_events)(this_arg_conv->this_arg);
12637         uint64_tArray ret_arr = NULL;
12638         ret_arr = init_uint64_tArray(ret_var.datalen, __LINE__);
12639         uint64_t *ret_arr_ptr = (uint64_t*)(((uint8_t*)ret_arr) + 8);
12640         for (size_t s = 0; s < ret_var.datalen; s++) {
12641                 LDKMessageSendEvent *ret_conv_18_copy = MALLOC(sizeof(LDKMessageSendEvent), "LDKMessageSendEvent");
12642                 *ret_conv_18_copy = ret_var.data[s];
12643                 uint64_t ret_conv_18_ref = tag_ptr(ret_conv_18_copy, true);
12644                 ret_arr_ptr[s] = ret_conv_18_ref;
12645         }
12646         
12647         FREE(ret_var.data);
12648         return ret_arr;
12649 }
12650
12651 typedef struct LDKChannelMessageHandler_JCalls {
12652         atomic_size_t refcnt;
12653         uint32_t instance_ptr;
12654         LDKMessageSendEventsProvider_JCalls* MessageSendEventsProvider;
12655 } LDKChannelMessageHandler_JCalls;
12656 static void LDKChannelMessageHandler_JCalls_free(void* this_arg) {
12657         LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
12658         if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
12659                 FREE(j_calls);
12660         }
12661 }
12662 void handle_open_channel_LDKChannelMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKOpenChannel * msg) {
12663         LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
12664         int8_tArray their_node_id_arr = init_int8_tArray(33, __LINE__);
12665         memcpy(their_node_id_arr->elems, their_node_id.compressed_form, 33);
12666         LDKOpenChannel msg_var = *msg;
12667         uint64_t msg_ref = 0;
12668         msg_var = OpenChannel_clone(&msg_var);
12669         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
12670         msg_ref = tag_ptr(msg_var.inner, msg_var.is_owned);
12671         js_invoke_function_ubuuuu(j_calls->instance_ptr, 73, (uint32_t)their_node_id_arr, msg_ref, 0, 0, 0, 0);
12672 }
12673 void handle_open_channel_v2_LDKChannelMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKOpenChannelV2 * msg) {
12674         LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
12675         int8_tArray their_node_id_arr = init_int8_tArray(33, __LINE__);
12676         memcpy(their_node_id_arr->elems, their_node_id.compressed_form, 33);
12677         LDKOpenChannelV2 msg_var = *msg;
12678         uint64_t msg_ref = 0;
12679         msg_var = OpenChannelV2_clone(&msg_var);
12680         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
12681         msg_ref = tag_ptr(msg_var.inner, msg_var.is_owned);
12682         js_invoke_function_ubuuuu(j_calls->instance_ptr, 74, (uint32_t)their_node_id_arr, msg_ref, 0, 0, 0, 0);
12683 }
12684 void handle_accept_channel_LDKChannelMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKAcceptChannel * msg) {
12685         LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
12686         int8_tArray their_node_id_arr = init_int8_tArray(33, __LINE__);
12687         memcpy(their_node_id_arr->elems, their_node_id.compressed_form, 33);
12688         LDKAcceptChannel msg_var = *msg;
12689         uint64_t msg_ref = 0;
12690         msg_var = AcceptChannel_clone(&msg_var);
12691         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
12692         msg_ref = tag_ptr(msg_var.inner, msg_var.is_owned);
12693         js_invoke_function_ubuuuu(j_calls->instance_ptr, 75, (uint32_t)their_node_id_arr, msg_ref, 0, 0, 0, 0);
12694 }
12695 void handle_accept_channel_v2_LDKChannelMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKAcceptChannelV2 * msg) {
12696         LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
12697         int8_tArray their_node_id_arr = init_int8_tArray(33, __LINE__);
12698         memcpy(their_node_id_arr->elems, their_node_id.compressed_form, 33);
12699         LDKAcceptChannelV2 msg_var = *msg;
12700         uint64_t msg_ref = 0;
12701         msg_var = AcceptChannelV2_clone(&msg_var);
12702         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
12703         msg_ref = tag_ptr(msg_var.inner, msg_var.is_owned);
12704         js_invoke_function_ubuuuu(j_calls->instance_ptr, 76, (uint32_t)their_node_id_arr, msg_ref, 0, 0, 0, 0);
12705 }
12706 void handle_funding_created_LDKChannelMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKFundingCreated * msg) {
12707         LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
12708         int8_tArray their_node_id_arr = init_int8_tArray(33, __LINE__);
12709         memcpy(their_node_id_arr->elems, their_node_id.compressed_form, 33);
12710         LDKFundingCreated msg_var = *msg;
12711         uint64_t msg_ref = 0;
12712         msg_var = FundingCreated_clone(&msg_var);
12713         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
12714         msg_ref = tag_ptr(msg_var.inner, msg_var.is_owned);
12715         js_invoke_function_ubuuuu(j_calls->instance_ptr, 77, (uint32_t)their_node_id_arr, msg_ref, 0, 0, 0, 0);
12716 }
12717 void handle_funding_signed_LDKChannelMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKFundingSigned * msg) {
12718         LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
12719         int8_tArray their_node_id_arr = init_int8_tArray(33, __LINE__);
12720         memcpy(their_node_id_arr->elems, their_node_id.compressed_form, 33);
12721         LDKFundingSigned msg_var = *msg;
12722         uint64_t msg_ref = 0;
12723         msg_var = FundingSigned_clone(&msg_var);
12724         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
12725         msg_ref = tag_ptr(msg_var.inner, msg_var.is_owned);
12726         js_invoke_function_ubuuuu(j_calls->instance_ptr, 78, (uint32_t)their_node_id_arr, msg_ref, 0, 0, 0, 0);
12727 }
12728 void handle_channel_ready_LDKChannelMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKChannelReady * msg) {
12729         LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
12730         int8_tArray their_node_id_arr = init_int8_tArray(33, __LINE__);
12731         memcpy(their_node_id_arr->elems, their_node_id.compressed_form, 33);
12732         LDKChannelReady msg_var = *msg;
12733         uint64_t msg_ref = 0;
12734         msg_var = ChannelReady_clone(&msg_var);
12735         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
12736         msg_ref = tag_ptr(msg_var.inner, msg_var.is_owned);
12737         js_invoke_function_ubuuuu(j_calls->instance_ptr, 79, (uint32_t)their_node_id_arr, msg_ref, 0, 0, 0, 0);
12738 }
12739 void handle_shutdown_LDKChannelMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKShutdown * msg) {
12740         LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
12741         int8_tArray their_node_id_arr = init_int8_tArray(33, __LINE__);
12742         memcpy(their_node_id_arr->elems, their_node_id.compressed_form, 33);
12743         LDKShutdown msg_var = *msg;
12744         uint64_t msg_ref = 0;
12745         msg_var = Shutdown_clone(&msg_var);
12746         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
12747         msg_ref = tag_ptr(msg_var.inner, msg_var.is_owned);
12748         js_invoke_function_ubuuuu(j_calls->instance_ptr, 80, (uint32_t)their_node_id_arr, msg_ref, 0, 0, 0, 0);
12749 }
12750 void handle_closing_signed_LDKChannelMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKClosingSigned * msg) {
12751         LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
12752         int8_tArray their_node_id_arr = init_int8_tArray(33, __LINE__);
12753         memcpy(their_node_id_arr->elems, their_node_id.compressed_form, 33);
12754         LDKClosingSigned msg_var = *msg;
12755         uint64_t msg_ref = 0;
12756         msg_var = ClosingSigned_clone(&msg_var);
12757         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
12758         msg_ref = tag_ptr(msg_var.inner, msg_var.is_owned);
12759         js_invoke_function_ubuuuu(j_calls->instance_ptr, 81, (uint32_t)their_node_id_arr, msg_ref, 0, 0, 0, 0);
12760 }
12761 void handle_tx_add_input_LDKChannelMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKTxAddInput * msg) {
12762         LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
12763         int8_tArray their_node_id_arr = init_int8_tArray(33, __LINE__);
12764         memcpy(their_node_id_arr->elems, their_node_id.compressed_form, 33);
12765         LDKTxAddInput msg_var = *msg;
12766         uint64_t msg_ref = 0;
12767         msg_var = TxAddInput_clone(&msg_var);
12768         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
12769         msg_ref = tag_ptr(msg_var.inner, msg_var.is_owned);
12770         js_invoke_function_ubuuuu(j_calls->instance_ptr, 82, (uint32_t)their_node_id_arr, msg_ref, 0, 0, 0, 0);
12771 }
12772 void handle_tx_add_output_LDKChannelMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKTxAddOutput * msg) {
12773         LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
12774         int8_tArray their_node_id_arr = init_int8_tArray(33, __LINE__);
12775         memcpy(their_node_id_arr->elems, their_node_id.compressed_form, 33);
12776         LDKTxAddOutput msg_var = *msg;
12777         uint64_t msg_ref = 0;
12778         msg_var = TxAddOutput_clone(&msg_var);
12779         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
12780         msg_ref = tag_ptr(msg_var.inner, msg_var.is_owned);
12781         js_invoke_function_ubuuuu(j_calls->instance_ptr, 83, (uint32_t)their_node_id_arr, msg_ref, 0, 0, 0, 0);
12782 }
12783 void handle_tx_remove_input_LDKChannelMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKTxRemoveInput * msg) {
12784         LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
12785         int8_tArray their_node_id_arr = init_int8_tArray(33, __LINE__);
12786         memcpy(their_node_id_arr->elems, their_node_id.compressed_form, 33);
12787         LDKTxRemoveInput msg_var = *msg;
12788         uint64_t msg_ref = 0;
12789         msg_var = TxRemoveInput_clone(&msg_var);
12790         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
12791         msg_ref = tag_ptr(msg_var.inner, msg_var.is_owned);
12792         js_invoke_function_ubuuuu(j_calls->instance_ptr, 84, (uint32_t)their_node_id_arr, msg_ref, 0, 0, 0, 0);
12793 }
12794 void handle_tx_remove_output_LDKChannelMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKTxRemoveOutput * msg) {
12795         LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
12796         int8_tArray their_node_id_arr = init_int8_tArray(33, __LINE__);
12797         memcpy(their_node_id_arr->elems, their_node_id.compressed_form, 33);
12798         LDKTxRemoveOutput msg_var = *msg;
12799         uint64_t msg_ref = 0;
12800         msg_var = TxRemoveOutput_clone(&msg_var);
12801         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
12802         msg_ref = tag_ptr(msg_var.inner, msg_var.is_owned);
12803         js_invoke_function_ubuuuu(j_calls->instance_ptr, 85, (uint32_t)their_node_id_arr, msg_ref, 0, 0, 0, 0);
12804 }
12805 void handle_tx_complete_LDKChannelMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKTxComplete * msg) {
12806         LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
12807         int8_tArray their_node_id_arr = init_int8_tArray(33, __LINE__);
12808         memcpy(their_node_id_arr->elems, their_node_id.compressed_form, 33);
12809         LDKTxComplete msg_var = *msg;
12810         uint64_t msg_ref = 0;
12811         msg_var = TxComplete_clone(&msg_var);
12812         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
12813         msg_ref = tag_ptr(msg_var.inner, msg_var.is_owned);
12814         js_invoke_function_ubuuuu(j_calls->instance_ptr, 86, (uint32_t)their_node_id_arr, msg_ref, 0, 0, 0, 0);
12815 }
12816 void handle_tx_signatures_LDKChannelMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKTxSignatures * msg) {
12817         LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
12818         int8_tArray their_node_id_arr = init_int8_tArray(33, __LINE__);
12819         memcpy(their_node_id_arr->elems, their_node_id.compressed_form, 33);
12820         LDKTxSignatures msg_var = *msg;
12821         uint64_t msg_ref = 0;
12822         msg_var = TxSignatures_clone(&msg_var);
12823         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
12824         msg_ref = tag_ptr(msg_var.inner, msg_var.is_owned);
12825         js_invoke_function_ubuuuu(j_calls->instance_ptr, 87, (uint32_t)their_node_id_arr, msg_ref, 0, 0, 0, 0);
12826 }
12827 void handle_tx_init_rbf_LDKChannelMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKTxInitRbf * msg) {
12828         LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
12829         int8_tArray their_node_id_arr = init_int8_tArray(33, __LINE__);
12830         memcpy(their_node_id_arr->elems, their_node_id.compressed_form, 33);
12831         LDKTxInitRbf msg_var = *msg;
12832         uint64_t msg_ref = 0;
12833         msg_var = TxInitRbf_clone(&msg_var);
12834         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
12835         msg_ref = tag_ptr(msg_var.inner, msg_var.is_owned);
12836         js_invoke_function_ubuuuu(j_calls->instance_ptr, 88, (uint32_t)their_node_id_arr, msg_ref, 0, 0, 0, 0);
12837 }
12838 void handle_tx_ack_rbf_LDKChannelMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKTxAckRbf * msg) {
12839         LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
12840         int8_tArray their_node_id_arr = init_int8_tArray(33, __LINE__);
12841         memcpy(their_node_id_arr->elems, their_node_id.compressed_form, 33);
12842         LDKTxAckRbf msg_var = *msg;
12843         uint64_t msg_ref = 0;
12844         msg_var = TxAckRbf_clone(&msg_var);
12845         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
12846         msg_ref = tag_ptr(msg_var.inner, msg_var.is_owned);
12847         js_invoke_function_ubuuuu(j_calls->instance_ptr, 89, (uint32_t)their_node_id_arr, msg_ref, 0, 0, 0, 0);
12848 }
12849 void handle_tx_abort_LDKChannelMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKTxAbort * msg) {
12850         LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
12851         int8_tArray their_node_id_arr = init_int8_tArray(33, __LINE__);
12852         memcpy(their_node_id_arr->elems, their_node_id.compressed_form, 33);
12853         LDKTxAbort msg_var = *msg;
12854         uint64_t msg_ref = 0;
12855         msg_var = TxAbort_clone(&msg_var);
12856         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
12857         msg_ref = tag_ptr(msg_var.inner, msg_var.is_owned);
12858         js_invoke_function_ubuuuu(j_calls->instance_ptr, 90, (uint32_t)their_node_id_arr, msg_ref, 0, 0, 0, 0);
12859 }
12860 void handle_update_add_htlc_LDKChannelMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKUpdateAddHTLC * msg) {
12861         LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
12862         int8_tArray their_node_id_arr = init_int8_tArray(33, __LINE__);
12863         memcpy(their_node_id_arr->elems, their_node_id.compressed_form, 33);
12864         LDKUpdateAddHTLC msg_var = *msg;
12865         uint64_t msg_ref = 0;
12866         msg_var = UpdateAddHTLC_clone(&msg_var);
12867         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
12868         msg_ref = tag_ptr(msg_var.inner, msg_var.is_owned);
12869         js_invoke_function_ubuuuu(j_calls->instance_ptr, 91, (uint32_t)their_node_id_arr, msg_ref, 0, 0, 0, 0);
12870 }
12871 void handle_update_fulfill_htlc_LDKChannelMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKUpdateFulfillHTLC * msg) {
12872         LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
12873         int8_tArray their_node_id_arr = init_int8_tArray(33, __LINE__);
12874         memcpy(their_node_id_arr->elems, their_node_id.compressed_form, 33);
12875         LDKUpdateFulfillHTLC msg_var = *msg;
12876         uint64_t msg_ref = 0;
12877         msg_var = UpdateFulfillHTLC_clone(&msg_var);
12878         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
12879         msg_ref = tag_ptr(msg_var.inner, msg_var.is_owned);
12880         js_invoke_function_ubuuuu(j_calls->instance_ptr, 92, (uint32_t)their_node_id_arr, msg_ref, 0, 0, 0, 0);
12881 }
12882 void handle_update_fail_htlc_LDKChannelMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKUpdateFailHTLC * msg) {
12883         LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
12884         int8_tArray their_node_id_arr = init_int8_tArray(33, __LINE__);
12885         memcpy(their_node_id_arr->elems, their_node_id.compressed_form, 33);
12886         LDKUpdateFailHTLC msg_var = *msg;
12887         uint64_t msg_ref = 0;
12888         msg_var = UpdateFailHTLC_clone(&msg_var);
12889         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
12890         msg_ref = tag_ptr(msg_var.inner, msg_var.is_owned);
12891         js_invoke_function_ubuuuu(j_calls->instance_ptr, 93, (uint32_t)their_node_id_arr, msg_ref, 0, 0, 0, 0);
12892 }
12893 void handle_update_fail_malformed_htlc_LDKChannelMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKUpdateFailMalformedHTLC * msg) {
12894         LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
12895         int8_tArray their_node_id_arr = init_int8_tArray(33, __LINE__);
12896         memcpy(their_node_id_arr->elems, their_node_id.compressed_form, 33);
12897         LDKUpdateFailMalformedHTLC msg_var = *msg;
12898         uint64_t msg_ref = 0;
12899         msg_var = UpdateFailMalformedHTLC_clone(&msg_var);
12900         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
12901         msg_ref = tag_ptr(msg_var.inner, msg_var.is_owned);
12902         js_invoke_function_ubuuuu(j_calls->instance_ptr, 94, (uint32_t)their_node_id_arr, msg_ref, 0, 0, 0, 0);
12903 }
12904 void handle_commitment_signed_LDKChannelMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKCommitmentSigned * msg) {
12905         LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
12906         int8_tArray their_node_id_arr = init_int8_tArray(33, __LINE__);
12907         memcpy(their_node_id_arr->elems, their_node_id.compressed_form, 33);
12908         LDKCommitmentSigned msg_var = *msg;
12909         uint64_t msg_ref = 0;
12910         msg_var = CommitmentSigned_clone(&msg_var);
12911         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
12912         msg_ref = tag_ptr(msg_var.inner, msg_var.is_owned);
12913         js_invoke_function_ubuuuu(j_calls->instance_ptr, 95, (uint32_t)their_node_id_arr, msg_ref, 0, 0, 0, 0);
12914 }
12915 void handle_revoke_and_ack_LDKChannelMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKRevokeAndACK * msg) {
12916         LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
12917         int8_tArray their_node_id_arr = init_int8_tArray(33, __LINE__);
12918         memcpy(their_node_id_arr->elems, their_node_id.compressed_form, 33);
12919         LDKRevokeAndACK msg_var = *msg;
12920         uint64_t msg_ref = 0;
12921         msg_var = RevokeAndACK_clone(&msg_var);
12922         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
12923         msg_ref = tag_ptr(msg_var.inner, msg_var.is_owned);
12924         js_invoke_function_ubuuuu(j_calls->instance_ptr, 96, (uint32_t)their_node_id_arr, msg_ref, 0, 0, 0, 0);
12925 }
12926 void handle_update_fee_LDKChannelMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKUpdateFee * msg) {
12927         LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
12928         int8_tArray their_node_id_arr = init_int8_tArray(33, __LINE__);
12929         memcpy(their_node_id_arr->elems, their_node_id.compressed_form, 33);
12930         LDKUpdateFee msg_var = *msg;
12931         uint64_t msg_ref = 0;
12932         msg_var = UpdateFee_clone(&msg_var);
12933         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
12934         msg_ref = tag_ptr(msg_var.inner, msg_var.is_owned);
12935         js_invoke_function_ubuuuu(j_calls->instance_ptr, 97, (uint32_t)their_node_id_arr, msg_ref, 0, 0, 0, 0);
12936 }
12937 void handle_announcement_signatures_LDKChannelMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKAnnouncementSignatures * msg) {
12938         LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
12939         int8_tArray their_node_id_arr = init_int8_tArray(33, __LINE__);
12940         memcpy(their_node_id_arr->elems, their_node_id.compressed_form, 33);
12941         LDKAnnouncementSignatures msg_var = *msg;
12942         uint64_t msg_ref = 0;
12943         msg_var = AnnouncementSignatures_clone(&msg_var);
12944         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
12945         msg_ref = tag_ptr(msg_var.inner, msg_var.is_owned);
12946         js_invoke_function_ubuuuu(j_calls->instance_ptr, 98, (uint32_t)their_node_id_arr, msg_ref, 0, 0, 0, 0);
12947 }
12948 void peer_disconnected_LDKChannelMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id) {
12949         LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
12950         int8_tArray their_node_id_arr = init_int8_tArray(33, __LINE__);
12951         memcpy(their_node_id_arr->elems, their_node_id.compressed_form, 33);
12952         js_invoke_function_uuuuuu(j_calls->instance_ptr, 99, (uint32_t)their_node_id_arr, 0, 0, 0, 0, 0);
12953 }
12954 LDKCResult_NoneNoneZ peer_connected_LDKChannelMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKInit * msg, bool inbound) {
12955         LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
12956         int8_tArray their_node_id_arr = init_int8_tArray(33, __LINE__);
12957         memcpy(their_node_id_arr->elems, their_node_id.compressed_form, 33);
12958         LDKInit msg_var = *msg;
12959         uint64_t msg_ref = 0;
12960         msg_var = Init_clone(&msg_var);
12961         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
12962         msg_ref = tag_ptr(msg_var.inner, msg_var.is_owned);
12963         jboolean inbound_conv = inbound;
12964         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);
12965         void* ret_ptr = untag_ptr(ret);
12966         CHECK_ACCESS(ret_ptr);
12967         LDKCResult_NoneNoneZ ret_conv = *(LDKCResult_NoneNoneZ*)(ret_ptr);
12968         FREE(untag_ptr(ret));
12969         return ret_conv;
12970 }
12971 void handle_channel_reestablish_LDKChannelMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKChannelReestablish * msg) {
12972         LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
12973         int8_tArray their_node_id_arr = init_int8_tArray(33, __LINE__);
12974         memcpy(their_node_id_arr->elems, their_node_id.compressed_form, 33);
12975         LDKChannelReestablish msg_var = *msg;
12976         uint64_t msg_ref = 0;
12977         msg_var = ChannelReestablish_clone(&msg_var);
12978         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
12979         msg_ref = tag_ptr(msg_var.inner, msg_var.is_owned);
12980         js_invoke_function_ubuuuu(j_calls->instance_ptr, 101, (uint32_t)their_node_id_arr, msg_ref, 0, 0, 0, 0);
12981 }
12982 void handle_channel_update_LDKChannelMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKChannelUpdate * msg) {
12983         LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
12984         int8_tArray their_node_id_arr = init_int8_tArray(33, __LINE__);
12985         memcpy(their_node_id_arr->elems, their_node_id.compressed_form, 33);
12986         LDKChannelUpdate msg_var = *msg;
12987         uint64_t msg_ref = 0;
12988         msg_var = ChannelUpdate_clone(&msg_var);
12989         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
12990         msg_ref = tag_ptr(msg_var.inner, msg_var.is_owned);
12991         js_invoke_function_ubuuuu(j_calls->instance_ptr, 102, (uint32_t)their_node_id_arr, msg_ref, 0, 0, 0, 0);
12992 }
12993 void handle_error_LDKChannelMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKErrorMessage * msg) {
12994         LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
12995         int8_tArray their_node_id_arr = init_int8_tArray(33, __LINE__);
12996         memcpy(their_node_id_arr->elems, their_node_id.compressed_form, 33);
12997         LDKErrorMessage msg_var = *msg;
12998         uint64_t msg_ref = 0;
12999         msg_var = ErrorMessage_clone(&msg_var);
13000         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
13001         msg_ref = tag_ptr(msg_var.inner, msg_var.is_owned);
13002         js_invoke_function_ubuuuu(j_calls->instance_ptr, 103, (uint32_t)their_node_id_arr, msg_ref, 0, 0, 0, 0);
13003 }
13004 LDKNodeFeatures provided_node_features_LDKChannelMessageHandler_jcall(const void* this_arg) {
13005         LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
13006         uint64_t ret = js_invoke_function_uuuuuu(j_calls->instance_ptr, 104, 0, 0, 0, 0, 0, 0);
13007         LDKNodeFeatures ret_conv;
13008         ret_conv.inner = untag_ptr(ret);
13009         ret_conv.is_owned = ptr_is_owned(ret);
13010         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_conv);
13011         return ret_conv;
13012 }
13013 LDKInitFeatures provided_init_features_LDKChannelMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id) {
13014         LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
13015         int8_tArray their_node_id_arr = init_int8_tArray(33, __LINE__);
13016         memcpy(their_node_id_arr->elems, their_node_id.compressed_form, 33);
13017         uint64_t ret = js_invoke_function_uuuuuu(j_calls->instance_ptr, 105, (uint32_t)their_node_id_arr, 0, 0, 0, 0, 0);
13018         LDKInitFeatures ret_conv;
13019         ret_conv.inner = untag_ptr(ret);
13020         ret_conv.is_owned = ptr_is_owned(ret);
13021         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_conv);
13022         return ret_conv;
13023 }
13024 LDKCOption_CVec_ThirtyTwoBytesZZ get_chain_hashes_LDKChannelMessageHandler_jcall(const void* this_arg) {
13025         LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
13026         uint64_t ret = js_invoke_function_uuuuuu(j_calls->instance_ptr, 106, 0, 0, 0, 0, 0, 0);
13027         void* ret_ptr = untag_ptr(ret);
13028         CHECK_ACCESS(ret_ptr);
13029         LDKCOption_CVec_ThirtyTwoBytesZZ ret_conv = *(LDKCOption_CVec_ThirtyTwoBytesZZ*)(ret_ptr);
13030         FREE(untag_ptr(ret));
13031         return ret_conv;
13032 }
13033 static void LDKChannelMessageHandler_JCalls_cloned(LDKChannelMessageHandler* new_obj) {
13034         LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) new_obj->this_arg;
13035         atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
13036         atomic_fetch_add_explicit(&j_calls->MessageSendEventsProvider->refcnt, 1, memory_order_release);
13037 }
13038 static inline LDKChannelMessageHandler LDKChannelMessageHandler_init (JSValue o, JSValue MessageSendEventsProvider) {
13039         LDKChannelMessageHandler_JCalls *calls = MALLOC(sizeof(LDKChannelMessageHandler_JCalls), "LDKChannelMessageHandler_JCalls");
13040         atomic_init(&calls->refcnt, 1);
13041         calls->instance_ptr = o;
13042
13043         LDKChannelMessageHandler ret = {
13044                 .this_arg = (void*) calls,
13045                 .handle_open_channel = handle_open_channel_LDKChannelMessageHandler_jcall,
13046                 .handle_open_channel_v2 = handle_open_channel_v2_LDKChannelMessageHandler_jcall,
13047                 .handle_accept_channel = handle_accept_channel_LDKChannelMessageHandler_jcall,
13048                 .handle_accept_channel_v2 = handle_accept_channel_v2_LDKChannelMessageHandler_jcall,
13049                 .handle_funding_created = handle_funding_created_LDKChannelMessageHandler_jcall,
13050                 .handle_funding_signed = handle_funding_signed_LDKChannelMessageHandler_jcall,
13051                 .handle_channel_ready = handle_channel_ready_LDKChannelMessageHandler_jcall,
13052                 .handle_shutdown = handle_shutdown_LDKChannelMessageHandler_jcall,
13053                 .handle_closing_signed = handle_closing_signed_LDKChannelMessageHandler_jcall,
13054                 .handle_tx_add_input = handle_tx_add_input_LDKChannelMessageHandler_jcall,
13055                 .handle_tx_add_output = handle_tx_add_output_LDKChannelMessageHandler_jcall,
13056                 .handle_tx_remove_input = handle_tx_remove_input_LDKChannelMessageHandler_jcall,
13057                 .handle_tx_remove_output = handle_tx_remove_output_LDKChannelMessageHandler_jcall,
13058                 .handle_tx_complete = handle_tx_complete_LDKChannelMessageHandler_jcall,
13059                 .handle_tx_signatures = handle_tx_signatures_LDKChannelMessageHandler_jcall,
13060                 .handle_tx_init_rbf = handle_tx_init_rbf_LDKChannelMessageHandler_jcall,
13061                 .handle_tx_ack_rbf = handle_tx_ack_rbf_LDKChannelMessageHandler_jcall,
13062                 .handle_tx_abort = handle_tx_abort_LDKChannelMessageHandler_jcall,
13063                 .handle_update_add_htlc = handle_update_add_htlc_LDKChannelMessageHandler_jcall,
13064                 .handle_update_fulfill_htlc = handle_update_fulfill_htlc_LDKChannelMessageHandler_jcall,
13065                 .handle_update_fail_htlc = handle_update_fail_htlc_LDKChannelMessageHandler_jcall,
13066                 .handle_update_fail_malformed_htlc = handle_update_fail_malformed_htlc_LDKChannelMessageHandler_jcall,
13067                 .handle_commitment_signed = handle_commitment_signed_LDKChannelMessageHandler_jcall,
13068                 .handle_revoke_and_ack = handle_revoke_and_ack_LDKChannelMessageHandler_jcall,
13069                 .handle_update_fee = handle_update_fee_LDKChannelMessageHandler_jcall,
13070                 .handle_announcement_signatures = handle_announcement_signatures_LDKChannelMessageHandler_jcall,
13071                 .peer_disconnected = peer_disconnected_LDKChannelMessageHandler_jcall,
13072                 .peer_connected = peer_connected_LDKChannelMessageHandler_jcall,
13073                 .handle_channel_reestablish = handle_channel_reestablish_LDKChannelMessageHandler_jcall,
13074                 .handle_channel_update = handle_channel_update_LDKChannelMessageHandler_jcall,
13075                 .handle_error = handle_error_LDKChannelMessageHandler_jcall,
13076                 .provided_node_features = provided_node_features_LDKChannelMessageHandler_jcall,
13077                 .provided_init_features = provided_init_features_LDKChannelMessageHandler_jcall,
13078                 .get_chain_hashes = get_chain_hashes_LDKChannelMessageHandler_jcall,
13079                 .free = LDKChannelMessageHandler_JCalls_free,
13080                 .MessageSendEventsProvider = LDKMessageSendEventsProvider_init(MessageSendEventsProvider),
13081         };
13082         calls->MessageSendEventsProvider = ret.MessageSendEventsProvider.this_arg;
13083         return ret;
13084 }
13085 uint64_t  __attribute__((export_name("TS_LDKChannelMessageHandler_new"))) TS_LDKChannelMessageHandler_new(JSValue o, JSValue MessageSendEventsProvider) {
13086         LDKChannelMessageHandler *res_ptr = MALLOC(sizeof(LDKChannelMessageHandler), "LDKChannelMessageHandler");
13087         *res_ptr = LDKChannelMessageHandler_init(o, MessageSendEventsProvider);
13088         return tag_ptr(res_ptr, true);
13089 }
13090 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) {
13091         void* this_arg_ptr = untag_ptr(this_arg);
13092         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
13093         LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)this_arg_ptr;
13094         LDKPublicKey their_node_id_ref;
13095         CHECK(their_node_id->arr_len == 33);
13096         memcpy(their_node_id_ref.compressed_form, their_node_id->elems, 33); FREE(their_node_id);
13097         LDKOpenChannel msg_conv;
13098         msg_conv.inner = untag_ptr(msg);
13099         msg_conv.is_owned = ptr_is_owned(msg);
13100         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
13101         msg_conv.is_owned = false;
13102         (this_arg_conv->handle_open_channel)(this_arg_conv->this_arg, their_node_id_ref, &msg_conv);
13103 }
13104
13105 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) {
13106         void* this_arg_ptr = untag_ptr(this_arg);
13107         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
13108         LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)this_arg_ptr;
13109         LDKPublicKey their_node_id_ref;
13110         CHECK(their_node_id->arr_len == 33);
13111         memcpy(their_node_id_ref.compressed_form, their_node_id->elems, 33); FREE(their_node_id);
13112         LDKOpenChannelV2 msg_conv;
13113         msg_conv.inner = untag_ptr(msg);
13114         msg_conv.is_owned = ptr_is_owned(msg);
13115         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
13116         msg_conv.is_owned = false;
13117         (this_arg_conv->handle_open_channel_v2)(this_arg_conv->this_arg, their_node_id_ref, &msg_conv);
13118 }
13119
13120 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) {
13121         void* this_arg_ptr = untag_ptr(this_arg);
13122         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
13123         LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)this_arg_ptr;
13124         LDKPublicKey their_node_id_ref;
13125         CHECK(their_node_id->arr_len == 33);
13126         memcpy(their_node_id_ref.compressed_form, their_node_id->elems, 33); FREE(their_node_id);
13127         LDKAcceptChannel msg_conv;
13128         msg_conv.inner = untag_ptr(msg);
13129         msg_conv.is_owned = ptr_is_owned(msg);
13130         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
13131         msg_conv.is_owned = false;
13132         (this_arg_conv->handle_accept_channel)(this_arg_conv->this_arg, their_node_id_ref, &msg_conv);
13133 }
13134
13135 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) {
13136         void* this_arg_ptr = untag_ptr(this_arg);
13137         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
13138         LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)this_arg_ptr;
13139         LDKPublicKey their_node_id_ref;
13140         CHECK(their_node_id->arr_len == 33);
13141         memcpy(their_node_id_ref.compressed_form, their_node_id->elems, 33); FREE(their_node_id);
13142         LDKAcceptChannelV2 msg_conv;
13143         msg_conv.inner = untag_ptr(msg);
13144         msg_conv.is_owned = ptr_is_owned(msg);
13145         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
13146         msg_conv.is_owned = false;
13147         (this_arg_conv->handle_accept_channel_v2)(this_arg_conv->this_arg, their_node_id_ref, &msg_conv);
13148 }
13149
13150 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) {
13151         void* this_arg_ptr = untag_ptr(this_arg);
13152         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
13153         LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)this_arg_ptr;
13154         LDKPublicKey their_node_id_ref;
13155         CHECK(their_node_id->arr_len == 33);
13156         memcpy(their_node_id_ref.compressed_form, their_node_id->elems, 33); FREE(their_node_id);
13157         LDKFundingCreated msg_conv;
13158         msg_conv.inner = untag_ptr(msg);
13159         msg_conv.is_owned = ptr_is_owned(msg);
13160         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
13161         msg_conv.is_owned = false;
13162         (this_arg_conv->handle_funding_created)(this_arg_conv->this_arg, their_node_id_ref, &msg_conv);
13163 }
13164
13165 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) {
13166         void* this_arg_ptr = untag_ptr(this_arg);
13167         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
13168         LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)this_arg_ptr;
13169         LDKPublicKey their_node_id_ref;
13170         CHECK(their_node_id->arr_len == 33);
13171         memcpy(their_node_id_ref.compressed_form, their_node_id->elems, 33); FREE(their_node_id);
13172         LDKFundingSigned msg_conv;
13173         msg_conv.inner = untag_ptr(msg);
13174         msg_conv.is_owned = ptr_is_owned(msg);
13175         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
13176         msg_conv.is_owned = false;
13177         (this_arg_conv->handle_funding_signed)(this_arg_conv->this_arg, their_node_id_ref, &msg_conv);
13178 }
13179
13180 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) {
13181         void* this_arg_ptr = untag_ptr(this_arg);
13182         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
13183         LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)this_arg_ptr;
13184         LDKPublicKey their_node_id_ref;
13185         CHECK(their_node_id->arr_len == 33);
13186         memcpy(their_node_id_ref.compressed_form, their_node_id->elems, 33); FREE(their_node_id);
13187         LDKChannelReady msg_conv;
13188         msg_conv.inner = untag_ptr(msg);
13189         msg_conv.is_owned = ptr_is_owned(msg);
13190         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
13191         msg_conv.is_owned = false;
13192         (this_arg_conv->handle_channel_ready)(this_arg_conv->this_arg, their_node_id_ref, &msg_conv);
13193 }
13194
13195 void  __attribute__((export_name("TS_ChannelMessageHandler_handle_shutdown"))) TS_ChannelMessageHandler_handle_shutdown(uint64_t this_arg, int8_tArray their_node_id, uint64_t msg) {
13196         void* this_arg_ptr = untag_ptr(this_arg);
13197         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
13198         LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)this_arg_ptr;
13199         LDKPublicKey their_node_id_ref;
13200         CHECK(their_node_id->arr_len == 33);
13201         memcpy(their_node_id_ref.compressed_form, their_node_id->elems, 33); FREE(their_node_id);
13202         LDKShutdown msg_conv;
13203         msg_conv.inner = untag_ptr(msg);
13204         msg_conv.is_owned = ptr_is_owned(msg);
13205         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
13206         msg_conv.is_owned = false;
13207         (this_arg_conv->handle_shutdown)(this_arg_conv->this_arg, their_node_id_ref, &msg_conv);
13208 }
13209
13210 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) {
13211         void* this_arg_ptr = untag_ptr(this_arg);
13212         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
13213         LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)this_arg_ptr;
13214         LDKPublicKey their_node_id_ref;
13215         CHECK(their_node_id->arr_len == 33);
13216         memcpy(their_node_id_ref.compressed_form, their_node_id->elems, 33); FREE(their_node_id);
13217         LDKClosingSigned msg_conv;
13218         msg_conv.inner = untag_ptr(msg);
13219         msg_conv.is_owned = ptr_is_owned(msg);
13220         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
13221         msg_conv.is_owned = false;
13222         (this_arg_conv->handle_closing_signed)(this_arg_conv->this_arg, their_node_id_ref, &msg_conv);
13223 }
13224
13225 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) {
13226         void* this_arg_ptr = untag_ptr(this_arg);
13227         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
13228         LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)this_arg_ptr;
13229         LDKPublicKey their_node_id_ref;
13230         CHECK(their_node_id->arr_len == 33);
13231         memcpy(their_node_id_ref.compressed_form, their_node_id->elems, 33); FREE(their_node_id);
13232         LDKTxAddInput msg_conv;
13233         msg_conv.inner = untag_ptr(msg);
13234         msg_conv.is_owned = ptr_is_owned(msg);
13235         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
13236         msg_conv.is_owned = false;
13237         (this_arg_conv->handle_tx_add_input)(this_arg_conv->this_arg, their_node_id_ref, &msg_conv);
13238 }
13239
13240 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) {
13241         void* this_arg_ptr = untag_ptr(this_arg);
13242         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
13243         LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)this_arg_ptr;
13244         LDKPublicKey their_node_id_ref;
13245         CHECK(their_node_id->arr_len == 33);
13246         memcpy(their_node_id_ref.compressed_form, their_node_id->elems, 33); FREE(their_node_id);
13247         LDKTxAddOutput msg_conv;
13248         msg_conv.inner = untag_ptr(msg);
13249         msg_conv.is_owned = ptr_is_owned(msg);
13250         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
13251         msg_conv.is_owned = false;
13252         (this_arg_conv->handle_tx_add_output)(this_arg_conv->this_arg, their_node_id_ref, &msg_conv);
13253 }
13254
13255 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) {
13256         void* this_arg_ptr = untag_ptr(this_arg);
13257         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
13258         LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)this_arg_ptr;
13259         LDKPublicKey their_node_id_ref;
13260         CHECK(their_node_id->arr_len == 33);
13261         memcpy(their_node_id_ref.compressed_form, their_node_id->elems, 33); FREE(their_node_id);
13262         LDKTxRemoveInput msg_conv;
13263         msg_conv.inner = untag_ptr(msg);
13264         msg_conv.is_owned = ptr_is_owned(msg);
13265         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
13266         msg_conv.is_owned = false;
13267         (this_arg_conv->handle_tx_remove_input)(this_arg_conv->this_arg, their_node_id_ref, &msg_conv);
13268 }
13269
13270 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) {
13271         void* this_arg_ptr = untag_ptr(this_arg);
13272         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
13273         LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)this_arg_ptr;
13274         LDKPublicKey their_node_id_ref;
13275         CHECK(their_node_id->arr_len == 33);
13276         memcpy(their_node_id_ref.compressed_form, their_node_id->elems, 33); FREE(their_node_id);
13277         LDKTxRemoveOutput msg_conv;
13278         msg_conv.inner = untag_ptr(msg);
13279         msg_conv.is_owned = ptr_is_owned(msg);
13280         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
13281         msg_conv.is_owned = false;
13282         (this_arg_conv->handle_tx_remove_output)(this_arg_conv->this_arg, their_node_id_ref, &msg_conv);
13283 }
13284
13285 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) {
13286         void* this_arg_ptr = untag_ptr(this_arg);
13287         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
13288         LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)this_arg_ptr;
13289         LDKPublicKey their_node_id_ref;
13290         CHECK(their_node_id->arr_len == 33);
13291         memcpy(their_node_id_ref.compressed_form, their_node_id->elems, 33); FREE(their_node_id);
13292         LDKTxComplete msg_conv;
13293         msg_conv.inner = untag_ptr(msg);
13294         msg_conv.is_owned = ptr_is_owned(msg);
13295         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
13296         msg_conv.is_owned = false;
13297         (this_arg_conv->handle_tx_complete)(this_arg_conv->this_arg, their_node_id_ref, &msg_conv);
13298 }
13299
13300 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) {
13301         void* this_arg_ptr = untag_ptr(this_arg);
13302         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
13303         LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)this_arg_ptr;
13304         LDKPublicKey their_node_id_ref;
13305         CHECK(their_node_id->arr_len == 33);
13306         memcpy(their_node_id_ref.compressed_form, their_node_id->elems, 33); FREE(their_node_id);
13307         LDKTxSignatures msg_conv;
13308         msg_conv.inner = untag_ptr(msg);
13309         msg_conv.is_owned = ptr_is_owned(msg);
13310         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
13311         msg_conv.is_owned = false;
13312         (this_arg_conv->handle_tx_signatures)(this_arg_conv->this_arg, their_node_id_ref, &msg_conv);
13313 }
13314
13315 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) {
13316         void* this_arg_ptr = untag_ptr(this_arg);
13317         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
13318         LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)this_arg_ptr;
13319         LDKPublicKey their_node_id_ref;
13320         CHECK(their_node_id->arr_len == 33);
13321         memcpy(their_node_id_ref.compressed_form, their_node_id->elems, 33); FREE(their_node_id);
13322         LDKTxInitRbf msg_conv;
13323         msg_conv.inner = untag_ptr(msg);
13324         msg_conv.is_owned = ptr_is_owned(msg);
13325         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
13326         msg_conv.is_owned = false;
13327         (this_arg_conv->handle_tx_init_rbf)(this_arg_conv->this_arg, their_node_id_ref, &msg_conv);
13328 }
13329
13330 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) {
13331         void* this_arg_ptr = untag_ptr(this_arg);
13332         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
13333         LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)this_arg_ptr;
13334         LDKPublicKey their_node_id_ref;
13335         CHECK(their_node_id->arr_len == 33);
13336         memcpy(their_node_id_ref.compressed_form, their_node_id->elems, 33); FREE(their_node_id);
13337         LDKTxAckRbf msg_conv;
13338         msg_conv.inner = untag_ptr(msg);
13339         msg_conv.is_owned = ptr_is_owned(msg);
13340         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
13341         msg_conv.is_owned = false;
13342         (this_arg_conv->handle_tx_ack_rbf)(this_arg_conv->this_arg, their_node_id_ref, &msg_conv);
13343 }
13344
13345 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) {
13346         void* this_arg_ptr = untag_ptr(this_arg);
13347         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
13348         LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)this_arg_ptr;
13349         LDKPublicKey their_node_id_ref;
13350         CHECK(their_node_id->arr_len == 33);
13351         memcpy(their_node_id_ref.compressed_form, their_node_id->elems, 33); FREE(their_node_id);
13352         LDKTxAbort msg_conv;
13353         msg_conv.inner = untag_ptr(msg);
13354         msg_conv.is_owned = ptr_is_owned(msg);
13355         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
13356         msg_conv.is_owned = false;
13357         (this_arg_conv->handle_tx_abort)(this_arg_conv->this_arg, their_node_id_ref, &msg_conv);
13358 }
13359
13360 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) {
13361         void* this_arg_ptr = untag_ptr(this_arg);
13362         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
13363         LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)this_arg_ptr;
13364         LDKPublicKey their_node_id_ref;
13365         CHECK(their_node_id->arr_len == 33);
13366         memcpy(their_node_id_ref.compressed_form, their_node_id->elems, 33); FREE(their_node_id);
13367         LDKUpdateAddHTLC msg_conv;
13368         msg_conv.inner = untag_ptr(msg);
13369         msg_conv.is_owned = ptr_is_owned(msg);
13370         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
13371         msg_conv.is_owned = false;
13372         (this_arg_conv->handle_update_add_htlc)(this_arg_conv->this_arg, their_node_id_ref, &msg_conv);
13373 }
13374
13375 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) {
13376         void* this_arg_ptr = untag_ptr(this_arg);
13377         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
13378         LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)this_arg_ptr;
13379         LDKPublicKey their_node_id_ref;
13380         CHECK(their_node_id->arr_len == 33);
13381         memcpy(their_node_id_ref.compressed_form, their_node_id->elems, 33); FREE(their_node_id);
13382         LDKUpdateFulfillHTLC msg_conv;
13383         msg_conv.inner = untag_ptr(msg);
13384         msg_conv.is_owned = ptr_is_owned(msg);
13385         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
13386         msg_conv.is_owned = false;
13387         (this_arg_conv->handle_update_fulfill_htlc)(this_arg_conv->this_arg, their_node_id_ref, &msg_conv);
13388 }
13389
13390 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) {
13391         void* this_arg_ptr = untag_ptr(this_arg);
13392         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
13393         LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)this_arg_ptr;
13394         LDKPublicKey their_node_id_ref;
13395         CHECK(their_node_id->arr_len == 33);
13396         memcpy(their_node_id_ref.compressed_form, their_node_id->elems, 33); FREE(their_node_id);
13397         LDKUpdateFailHTLC msg_conv;
13398         msg_conv.inner = untag_ptr(msg);
13399         msg_conv.is_owned = ptr_is_owned(msg);
13400         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
13401         msg_conv.is_owned = false;
13402         (this_arg_conv->handle_update_fail_htlc)(this_arg_conv->this_arg, their_node_id_ref, &msg_conv);
13403 }
13404
13405 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) {
13406         void* this_arg_ptr = untag_ptr(this_arg);
13407         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
13408         LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)this_arg_ptr;
13409         LDKPublicKey their_node_id_ref;
13410         CHECK(their_node_id->arr_len == 33);
13411         memcpy(their_node_id_ref.compressed_form, their_node_id->elems, 33); FREE(their_node_id);
13412         LDKUpdateFailMalformedHTLC msg_conv;
13413         msg_conv.inner = untag_ptr(msg);
13414         msg_conv.is_owned = ptr_is_owned(msg);
13415         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
13416         msg_conv.is_owned = false;
13417         (this_arg_conv->handle_update_fail_malformed_htlc)(this_arg_conv->this_arg, their_node_id_ref, &msg_conv);
13418 }
13419
13420 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) {
13421         void* this_arg_ptr = untag_ptr(this_arg);
13422         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
13423         LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)this_arg_ptr;
13424         LDKPublicKey their_node_id_ref;
13425         CHECK(their_node_id->arr_len == 33);
13426         memcpy(their_node_id_ref.compressed_form, their_node_id->elems, 33); FREE(their_node_id);
13427         LDKCommitmentSigned msg_conv;
13428         msg_conv.inner = untag_ptr(msg);
13429         msg_conv.is_owned = ptr_is_owned(msg);
13430         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
13431         msg_conv.is_owned = false;
13432         (this_arg_conv->handle_commitment_signed)(this_arg_conv->this_arg, their_node_id_ref, &msg_conv);
13433 }
13434
13435 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) {
13436         void* this_arg_ptr = untag_ptr(this_arg);
13437         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
13438         LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)this_arg_ptr;
13439         LDKPublicKey their_node_id_ref;
13440         CHECK(their_node_id->arr_len == 33);
13441         memcpy(their_node_id_ref.compressed_form, their_node_id->elems, 33); FREE(their_node_id);
13442         LDKRevokeAndACK msg_conv;
13443         msg_conv.inner = untag_ptr(msg);
13444         msg_conv.is_owned = ptr_is_owned(msg);
13445         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
13446         msg_conv.is_owned = false;
13447         (this_arg_conv->handle_revoke_and_ack)(this_arg_conv->this_arg, their_node_id_ref, &msg_conv);
13448 }
13449
13450 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) {
13451         void* this_arg_ptr = untag_ptr(this_arg);
13452         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
13453         LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)this_arg_ptr;
13454         LDKPublicKey their_node_id_ref;
13455         CHECK(their_node_id->arr_len == 33);
13456         memcpy(their_node_id_ref.compressed_form, their_node_id->elems, 33); FREE(their_node_id);
13457         LDKUpdateFee msg_conv;
13458         msg_conv.inner = untag_ptr(msg);
13459         msg_conv.is_owned = ptr_is_owned(msg);
13460         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
13461         msg_conv.is_owned = false;
13462         (this_arg_conv->handle_update_fee)(this_arg_conv->this_arg, their_node_id_ref, &msg_conv);
13463 }
13464
13465 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) {
13466         void* this_arg_ptr = untag_ptr(this_arg);
13467         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
13468         LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)this_arg_ptr;
13469         LDKPublicKey their_node_id_ref;
13470         CHECK(their_node_id->arr_len == 33);
13471         memcpy(their_node_id_ref.compressed_form, their_node_id->elems, 33); FREE(their_node_id);
13472         LDKAnnouncementSignatures msg_conv;
13473         msg_conv.inner = untag_ptr(msg);
13474         msg_conv.is_owned = ptr_is_owned(msg);
13475         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
13476         msg_conv.is_owned = false;
13477         (this_arg_conv->handle_announcement_signatures)(this_arg_conv->this_arg, their_node_id_ref, &msg_conv);
13478 }
13479
13480 void  __attribute__((export_name("TS_ChannelMessageHandler_peer_disconnected"))) TS_ChannelMessageHandler_peer_disconnected(uint64_t this_arg, int8_tArray their_node_id) {
13481         void* this_arg_ptr = untag_ptr(this_arg);
13482         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
13483         LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)this_arg_ptr;
13484         LDKPublicKey their_node_id_ref;
13485         CHECK(their_node_id->arr_len == 33);
13486         memcpy(their_node_id_ref.compressed_form, their_node_id->elems, 33); FREE(their_node_id);
13487         (this_arg_conv->peer_disconnected)(this_arg_conv->this_arg, their_node_id_ref);
13488 }
13489
13490 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) {
13491         void* this_arg_ptr = untag_ptr(this_arg);
13492         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
13493         LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)this_arg_ptr;
13494         LDKPublicKey their_node_id_ref;
13495         CHECK(their_node_id->arr_len == 33);
13496         memcpy(their_node_id_ref.compressed_form, their_node_id->elems, 33); FREE(their_node_id);
13497         LDKInit msg_conv;
13498         msg_conv.inner = untag_ptr(msg);
13499         msg_conv.is_owned = ptr_is_owned(msg);
13500         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
13501         msg_conv.is_owned = false;
13502         LDKCResult_NoneNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneNoneZ), "LDKCResult_NoneNoneZ");
13503         *ret_conv = (this_arg_conv->peer_connected)(this_arg_conv->this_arg, their_node_id_ref, &msg_conv, inbound);
13504         return tag_ptr(ret_conv, true);
13505 }
13506
13507 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) {
13508         void* this_arg_ptr = untag_ptr(this_arg);
13509         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
13510         LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)this_arg_ptr;
13511         LDKPublicKey their_node_id_ref;
13512         CHECK(their_node_id->arr_len == 33);
13513         memcpy(their_node_id_ref.compressed_form, their_node_id->elems, 33); FREE(their_node_id);
13514         LDKChannelReestablish msg_conv;
13515         msg_conv.inner = untag_ptr(msg);
13516         msg_conv.is_owned = ptr_is_owned(msg);
13517         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
13518         msg_conv.is_owned = false;
13519         (this_arg_conv->handle_channel_reestablish)(this_arg_conv->this_arg, their_node_id_ref, &msg_conv);
13520 }
13521
13522 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) {
13523         void* this_arg_ptr = untag_ptr(this_arg);
13524         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
13525         LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)this_arg_ptr;
13526         LDKPublicKey their_node_id_ref;
13527         CHECK(their_node_id->arr_len == 33);
13528         memcpy(their_node_id_ref.compressed_form, their_node_id->elems, 33); FREE(their_node_id);
13529         LDKChannelUpdate msg_conv;
13530         msg_conv.inner = untag_ptr(msg);
13531         msg_conv.is_owned = ptr_is_owned(msg);
13532         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
13533         msg_conv.is_owned = false;
13534         (this_arg_conv->handle_channel_update)(this_arg_conv->this_arg, their_node_id_ref, &msg_conv);
13535 }
13536
13537 void  __attribute__((export_name("TS_ChannelMessageHandler_handle_error"))) TS_ChannelMessageHandler_handle_error(uint64_t this_arg, int8_tArray their_node_id, uint64_t msg) {
13538         void* this_arg_ptr = untag_ptr(this_arg);
13539         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
13540         LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)this_arg_ptr;
13541         LDKPublicKey their_node_id_ref;
13542         CHECK(their_node_id->arr_len == 33);
13543         memcpy(their_node_id_ref.compressed_form, their_node_id->elems, 33); FREE(their_node_id);
13544         LDKErrorMessage msg_conv;
13545         msg_conv.inner = untag_ptr(msg);
13546         msg_conv.is_owned = ptr_is_owned(msg);
13547         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
13548         msg_conv.is_owned = false;
13549         (this_arg_conv->handle_error)(this_arg_conv->this_arg, their_node_id_ref, &msg_conv);
13550 }
13551
13552 uint64_t  __attribute__((export_name("TS_ChannelMessageHandler_provided_node_features"))) TS_ChannelMessageHandler_provided_node_features(uint64_t this_arg) {
13553         void* this_arg_ptr = untag_ptr(this_arg);
13554         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
13555         LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)this_arg_ptr;
13556         LDKNodeFeatures ret_var = (this_arg_conv->provided_node_features)(this_arg_conv->this_arg);
13557         uint64_t ret_ref = 0;
13558         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
13559         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
13560         return ret_ref;
13561 }
13562
13563 uint64_t  __attribute__((export_name("TS_ChannelMessageHandler_provided_init_features"))) TS_ChannelMessageHandler_provided_init_features(uint64_t this_arg, int8_tArray their_node_id) {
13564         void* this_arg_ptr = untag_ptr(this_arg);
13565         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
13566         LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)this_arg_ptr;
13567         LDKPublicKey their_node_id_ref;
13568         CHECK(their_node_id->arr_len == 33);
13569         memcpy(their_node_id_ref.compressed_form, their_node_id->elems, 33); FREE(their_node_id);
13570         LDKInitFeatures ret_var = (this_arg_conv->provided_init_features)(this_arg_conv->this_arg, their_node_id_ref);
13571         uint64_t ret_ref = 0;
13572         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
13573         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
13574         return ret_ref;
13575 }
13576
13577 uint64_t  __attribute__((export_name("TS_ChannelMessageHandler_get_chain_hashes"))) TS_ChannelMessageHandler_get_chain_hashes(uint64_t this_arg) {
13578         void* this_arg_ptr = untag_ptr(this_arg);
13579         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
13580         LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)this_arg_ptr;
13581         LDKCOption_CVec_ThirtyTwoBytesZZ *ret_copy = MALLOC(sizeof(LDKCOption_CVec_ThirtyTwoBytesZZ), "LDKCOption_CVec_ThirtyTwoBytesZZ");
13582         *ret_copy = (this_arg_conv->get_chain_hashes)(this_arg_conv->this_arg);
13583         uint64_t ret_ref = tag_ptr(ret_copy, true);
13584         return ret_ref;
13585 }
13586
13587 typedef struct LDKOffersMessageHandler_JCalls {
13588         atomic_size_t refcnt;
13589         uint32_t instance_ptr;
13590 } LDKOffersMessageHandler_JCalls;
13591 static void LDKOffersMessageHandler_JCalls_free(void* this_arg) {
13592         LDKOffersMessageHandler_JCalls *j_calls = (LDKOffersMessageHandler_JCalls*) this_arg;
13593         if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
13594                 FREE(j_calls);
13595         }
13596 }
13597 LDKCOption_OffersMessageZ handle_message_LDKOffersMessageHandler_jcall(const void* this_arg, LDKOffersMessage message) {
13598         LDKOffersMessageHandler_JCalls *j_calls = (LDKOffersMessageHandler_JCalls*) this_arg;
13599         LDKOffersMessage *message_copy = MALLOC(sizeof(LDKOffersMessage), "LDKOffersMessage");
13600         *message_copy = message;
13601         uint64_t message_ref = tag_ptr(message_copy, true);
13602         uint64_t ret = js_invoke_function_buuuuu(j_calls->instance_ptr, 107, message_ref, 0, 0, 0, 0, 0);
13603         void* ret_ptr = untag_ptr(ret);
13604         CHECK_ACCESS(ret_ptr);
13605         LDKCOption_OffersMessageZ ret_conv = *(LDKCOption_OffersMessageZ*)(ret_ptr);
13606         FREE(untag_ptr(ret));
13607         return ret_conv;
13608 }
13609 LDKCVec_C3Tuple_OffersMessageDestinationBlindedPathZZ release_pending_messages_LDKOffersMessageHandler_jcall(const void* this_arg) {
13610         LDKOffersMessageHandler_JCalls *j_calls = (LDKOffersMessageHandler_JCalls*) this_arg;
13611         uint64_tArray ret = (uint64_tArray)js_invoke_function_uuuuuu(j_calls->instance_ptr, 108, 0, 0, 0, 0, 0, 0);
13612         LDKCVec_C3Tuple_OffersMessageDestinationBlindedPathZZ ret_constr;
13613         ret_constr.datalen = ret->arr_len;
13614         if (ret_constr.datalen > 0)
13615                 ret_constr.data = MALLOC(ret_constr.datalen * sizeof(LDKC3Tuple_OffersMessageDestinationBlindedPathZ), "LDKCVec_C3Tuple_OffersMessageDestinationBlindedPathZZ Elements");
13616         else
13617                 ret_constr.data = NULL;
13618         uint64_t* ret_vals = ret->elems;
13619         for (size_t x = 0; x < ret_constr.datalen; x++) {
13620                 uint64_t ret_conv_49 = ret_vals[x];
13621                 void* ret_conv_49_ptr = untag_ptr(ret_conv_49);
13622                 CHECK_ACCESS(ret_conv_49_ptr);
13623                 LDKC3Tuple_OffersMessageDestinationBlindedPathZ ret_conv_49_conv = *(LDKC3Tuple_OffersMessageDestinationBlindedPathZ*)(ret_conv_49_ptr);
13624                 FREE(untag_ptr(ret_conv_49));
13625                 ret_constr.data[x] = ret_conv_49_conv;
13626         }
13627         FREE(ret);
13628         return ret_constr;
13629 }
13630 static void LDKOffersMessageHandler_JCalls_cloned(LDKOffersMessageHandler* new_obj) {
13631         LDKOffersMessageHandler_JCalls *j_calls = (LDKOffersMessageHandler_JCalls*) new_obj->this_arg;
13632         atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
13633 }
13634 static inline LDKOffersMessageHandler LDKOffersMessageHandler_init (JSValue o) {
13635         LDKOffersMessageHandler_JCalls *calls = MALLOC(sizeof(LDKOffersMessageHandler_JCalls), "LDKOffersMessageHandler_JCalls");
13636         atomic_init(&calls->refcnt, 1);
13637         calls->instance_ptr = o;
13638
13639         LDKOffersMessageHandler ret = {
13640                 .this_arg = (void*) calls,
13641                 .handle_message = handle_message_LDKOffersMessageHandler_jcall,
13642                 .release_pending_messages = release_pending_messages_LDKOffersMessageHandler_jcall,
13643                 .free = LDKOffersMessageHandler_JCalls_free,
13644         };
13645         return ret;
13646 }
13647 uint64_t  __attribute__((export_name("TS_LDKOffersMessageHandler_new"))) TS_LDKOffersMessageHandler_new(JSValue o) {
13648         LDKOffersMessageHandler *res_ptr = MALLOC(sizeof(LDKOffersMessageHandler), "LDKOffersMessageHandler");
13649         *res_ptr = LDKOffersMessageHandler_init(o);
13650         return tag_ptr(res_ptr, true);
13651 }
13652 uint64_t  __attribute__((export_name("TS_OffersMessageHandler_handle_message"))) TS_OffersMessageHandler_handle_message(uint64_t this_arg, uint64_t message) {
13653         void* this_arg_ptr = untag_ptr(this_arg);
13654         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
13655         LDKOffersMessageHandler* this_arg_conv = (LDKOffersMessageHandler*)this_arg_ptr;
13656         void* message_ptr = untag_ptr(message);
13657         CHECK_ACCESS(message_ptr);
13658         LDKOffersMessage message_conv = *(LDKOffersMessage*)(message_ptr);
13659         message_conv = OffersMessage_clone((LDKOffersMessage*)untag_ptr(message));
13660         LDKCOption_OffersMessageZ *ret_copy = MALLOC(sizeof(LDKCOption_OffersMessageZ), "LDKCOption_OffersMessageZ");
13661         *ret_copy = (this_arg_conv->handle_message)(this_arg_conv->this_arg, message_conv);
13662         uint64_t ret_ref = tag_ptr(ret_copy, true);
13663         return ret_ref;
13664 }
13665
13666 uint64_tArray  __attribute__((export_name("TS_OffersMessageHandler_release_pending_messages"))) TS_OffersMessageHandler_release_pending_messages(uint64_t this_arg) {
13667         void* this_arg_ptr = untag_ptr(this_arg);
13668         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
13669         LDKOffersMessageHandler* this_arg_conv = (LDKOffersMessageHandler*)this_arg_ptr;
13670         LDKCVec_C3Tuple_OffersMessageDestinationBlindedPathZZ ret_var = (this_arg_conv->release_pending_messages)(this_arg_conv->this_arg);
13671         uint64_tArray ret_arr = NULL;
13672         ret_arr = init_uint64_tArray(ret_var.datalen, __LINE__);
13673         uint64_t *ret_arr_ptr = (uint64_t*)(((uint8_t*)ret_arr) + 8);
13674         for (size_t x = 0; x < ret_var.datalen; x++) {
13675                 LDKC3Tuple_OffersMessageDestinationBlindedPathZ* ret_conv_49_conv = MALLOC(sizeof(LDKC3Tuple_OffersMessageDestinationBlindedPathZ), "LDKC3Tuple_OffersMessageDestinationBlindedPathZ");
13676                 *ret_conv_49_conv = ret_var.data[x];
13677                 ret_arr_ptr[x] = tag_ptr(ret_conv_49_conv, true);
13678         }
13679         
13680         FREE(ret_var.data);
13681         return ret_arr;
13682 }
13683
13684 typedef struct LDKRoutingMessageHandler_JCalls {
13685         atomic_size_t refcnt;
13686         uint32_t instance_ptr;
13687         LDKMessageSendEventsProvider_JCalls* MessageSendEventsProvider;
13688 } LDKRoutingMessageHandler_JCalls;
13689 static void LDKRoutingMessageHandler_JCalls_free(void* this_arg) {
13690         LDKRoutingMessageHandler_JCalls *j_calls = (LDKRoutingMessageHandler_JCalls*) this_arg;
13691         if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
13692                 FREE(j_calls);
13693         }
13694 }
13695 LDKCResult_boolLightningErrorZ handle_node_announcement_LDKRoutingMessageHandler_jcall(const void* this_arg, const LDKNodeAnnouncement * msg) {
13696         LDKRoutingMessageHandler_JCalls *j_calls = (LDKRoutingMessageHandler_JCalls*) this_arg;
13697         LDKNodeAnnouncement msg_var = *msg;
13698         uint64_t msg_ref = 0;
13699         msg_var = NodeAnnouncement_clone(&msg_var);
13700         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
13701         msg_ref = tag_ptr(msg_var.inner, msg_var.is_owned);
13702         uint64_t ret = js_invoke_function_buuuuu(j_calls->instance_ptr, 109, msg_ref, 0, 0, 0, 0, 0);
13703         void* ret_ptr = untag_ptr(ret);
13704         CHECK_ACCESS(ret_ptr);
13705         LDKCResult_boolLightningErrorZ ret_conv = *(LDKCResult_boolLightningErrorZ*)(ret_ptr);
13706         FREE(untag_ptr(ret));
13707         return ret_conv;
13708 }
13709 LDKCResult_boolLightningErrorZ handle_channel_announcement_LDKRoutingMessageHandler_jcall(const void* this_arg, const LDKChannelAnnouncement * msg) {
13710         LDKRoutingMessageHandler_JCalls *j_calls = (LDKRoutingMessageHandler_JCalls*) this_arg;
13711         LDKChannelAnnouncement msg_var = *msg;
13712         uint64_t msg_ref = 0;
13713         msg_var = ChannelAnnouncement_clone(&msg_var);
13714         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
13715         msg_ref = tag_ptr(msg_var.inner, msg_var.is_owned);
13716         uint64_t ret = js_invoke_function_buuuuu(j_calls->instance_ptr, 110, msg_ref, 0, 0, 0, 0, 0);
13717         void* ret_ptr = untag_ptr(ret);
13718         CHECK_ACCESS(ret_ptr);
13719         LDKCResult_boolLightningErrorZ ret_conv = *(LDKCResult_boolLightningErrorZ*)(ret_ptr);
13720         FREE(untag_ptr(ret));
13721         return ret_conv;
13722 }
13723 LDKCResult_boolLightningErrorZ handle_channel_update_LDKRoutingMessageHandler_jcall(const void* this_arg, const LDKChannelUpdate * msg) {
13724         LDKRoutingMessageHandler_JCalls *j_calls = (LDKRoutingMessageHandler_JCalls*) this_arg;
13725         LDKChannelUpdate msg_var = *msg;
13726         uint64_t msg_ref = 0;
13727         msg_var = ChannelUpdate_clone(&msg_var);
13728         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
13729         msg_ref = tag_ptr(msg_var.inner, msg_var.is_owned);
13730         uint64_t ret = js_invoke_function_buuuuu(j_calls->instance_ptr, 111, msg_ref, 0, 0, 0, 0, 0);
13731         void* ret_ptr = untag_ptr(ret);
13732         CHECK_ACCESS(ret_ptr);
13733         LDKCResult_boolLightningErrorZ ret_conv = *(LDKCResult_boolLightningErrorZ*)(ret_ptr);
13734         FREE(untag_ptr(ret));
13735         return ret_conv;
13736 }
13737 LDKCOption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ get_next_channel_announcement_LDKRoutingMessageHandler_jcall(const void* this_arg, uint64_t starting_point) {
13738         LDKRoutingMessageHandler_JCalls *j_calls = (LDKRoutingMessageHandler_JCalls*) this_arg;
13739         int64_t starting_point_conv = starting_point;
13740         uint64_t ret = js_invoke_function_buuuuu(j_calls->instance_ptr, 112, starting_point_conv, 0, 0, 0, 0, 0);
13741         void* ret_ptr = untag_ptr(ret);
13742         CHECK_ACCESS(ret_ptr);
13743         LDKCOption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ ret_conv = *(LDKCOption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ*)(ret_ptr);
13744         FREE(untag_ptr(ret));
13745         return ret_conv;
13746 }
13747 LDKNodeAnnouncement get_next_node_announcement_LDKRoutingMessageHandler_jcall(const void* this_arg, LDKNodeId starting_point) {
13748         LDKRoutingMessageHandler_JCalls *j_calls = (LDKRoutingMessageHandler_JCalls*) this_arg;
13749         LDKNodeId starting_point_var = starting_point;
13750         uint64_t starting_point_ref = 0;
13751         CHECK_INNER_FIELD_ACCESS_OR_NULL(starting_point_var);
13752         starting_point_ref = tag_ptr(starting_point_var.inner, starting_point_var.is_owned);
13753         uint64_t ret = js_invoke_function_buuuuu(j_calls->instance_ptr, 113, starting_point_ref, 0, 0, 0, 0, 0);
13754         LDKNodeAnnouncement ret_conv;
13755         ret_conv.inner = untag_ptr(ret);
13756         ret_conv.is_owned = ptr_is_owned(ret);
13757         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_conv);
13758         return ret_conv;
13759 }
13760 LDKCResult_NoneNoneZ peer_connected_LDKRoutingMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKInit * init, bool inbound) {
13761         LDKRoutingMessageHandler_JCalls *j_calls = (LDKRoutingMessageHandler_JCalls*) this_arg;
13762         int8_tArray their_node_id_arr = init_int8_tArray(33, __LINE__);
13763         memcpy(their_node_id_arr->elems, their_node_id.compressed_form, 33);
13764         LDKInit init_var = *init;
13765         uint64_t init_ref = 0;
13766         init_var = Init_clone(&init_var);
13767         CHECK_INNER_FIELD_ACCESS_OR_NULL(init_var);
13768         init_ref = tag_ptr(init_var.inner, init_var.is_owned);
13769         jboolean inbound_conv = inbound;
13770         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);
13771         void* ret_ptr = untag_ptr(ret);
13772         CHECK_ACCESS(ret_ptr);
13773         LDKCResult_NoneNoneZ ret_conv = *(LDKCResult_NoneNoneZ*)(ret_ptr);
13774         FREE(untag_ptr(ret));
13775         return ret_conv;
13776 }
13777 LDKCResult_NoneLightningErrorZ handle_reply_channel_range_LDKRoutingMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, LDKReplyChannelRange msg) {
13778         LDKRoutingMessageHandler_JCalls *j_calls = (LDKRoutingMessageHandler_JCalls*) this_arg;
13779         int8_tArray their_node_id_arr = init_int8_tArray(33, __LINE__);
13780         memcpy(their_node_id_arr->elems, their_node_id.compressed_form, 33);
13781         LDKReplyChannelRange msg_var = msg;
13782         uint64_t msg_ref = 0;
13783         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
13784         msg_ref = tag_ptr(msg_var.inner, msg_var.is_owned);
13785         uint64_t ret = js_invoke_function_ubuuuu(j_calls->instance_ptr, 115, (uint32_t)their_node_id_arr, msg_ref, 0, 0, 0, 0);
13786         void* ret_ptr = untag_ptr(ret);
13787         CHECK_ACCESS(ret_ptr);
13788         LDKCResult_NoneLightningErrorZ ret_conv = *(LDKCResult_NoneLightningErrorZ*)(ret_ptr);
13789         FREE(untag_ptr(ret));
13790         return ret_conv;
13791 }
13792 LDKCResult_NoneLightningErrorZ handle_reply_short_channel_ids_end_LDKRoutingMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, LDKReplyShortChannelIdsEnd msg) {
13793         LDKRoutingMessageHandler_JCalls *j_calls = (LDKRoutingMessageHandler_JCalls*) this_arg;
13794         int8_tArray their_node_id_arr = init_int8_tArray(33, __LINE__);
13795         memcpy(their_node_id_arr->elems, their_node_id.compressed_form, 33);
13796         LDKReplyShortChannelIdsEnd msg_var = msg;
13797         uint64_t msg_ref = 0;
13798         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
13799         msg_ref = tag_ptr(msg_var.inner, msg_var.is_owned);
13800         uint64_t ret = js_invoke_function_ubuuuu(j_calls->instance_ptr, 116, (uint32_t)their_node_id_arr, msg_ref, 0, 0, 0, 0);
13801         void* ret_ptr = untag_ptr(ret);
13802         CHECK_ACCESS(ret_ptr);
13803         LDKCResult_NoneLightningErrorZ ret_conv = *(LDKCResult_NoneLightningErrorZ*)(ret_ptr);
13804         FREE(untag_ptr(ret));
13805         return ret_conv;
13806 }
13807 LDKCResult_NoneLightningErrorZ handle_query_channel_range_LDKRoutingMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, LDKQueryChannelRange msg) {
13808         LDKRoutingMessageHandler_JCalls *j_calls = (LDKRoutingMessageHandler_JCalls*) this_arg;
13809         int8_tArray their_node_id_arr = init_int8_tArray(33, __LINE__);
13810         memcpy(their_node_id_arr->elems, their_node_id.compressed_form, 33);
13811         LDKQueryChannelRange msg_var = msg;
13812         uint64_t msg_ref = 0;
13813         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
13814         msg_ref = tag_ptr(msg_var.inner, msg_var.is_owned);
13815         uint64_t ret = js_invoke_function_ubuuuu(j_calls->instance_ptr, 117, (uint32_t)their_node_id_arr, msg_ref, 0, 0, 0, 0);
13816         void* ret_ptr = untag_ptr(ret);
13817         CHECK_ACCESS(ret_ptr);
13818         LDKCResult_NoneLightningErrorZ ret_conv = *(LDKCResult_NoneLightningErrorZ*)(ret_ptr);
13819         FREE(untag_ptr(ret));
13820         return ret_conv;
13821 }
13822 LDKCResult_NoneLightningErrorZ handle_query_short_channel_ids_LDKRoutingMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, LDKQueryShortChannelIds msg) {
13823         LDKRoutingMessageHandler_JCalls *j_calls = (LDKRoutingMessageHandler_JCalls*) this_arg;
13824         int8_tArray their_node_id_arr = init_int8_tArray(33, __LINE__);
13825         memcpy(their_node_id_arr->elems, their_node_id.compressed_form, 33);
13826         LDKQueryShortChannelIds msg_var = msg;
13827         uint64_t msg_ref = 0;
13828         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
13829         msg_ref = tag_ptr(msg_var.inner, msg_var.is_owned);
13830         uint64_t ret = js_invoke_function_ubuuuu(j_calls->instance_ptr, 118, (uint32_t)their_node_id_arr, msg_ref, 0, 0, 0, 0);
13831         void* ret_ptr = untag_ptr(ret);
13832         CHECK_ACCESS(ret_ptr);
13833         LDKCResult_NoneLightningErrorZ ret_conv = *(LDKCResult_NoneLightningErrorZ*)(ret_ptr);
13834         FREE(untag_ptr(ret));
13835         return ret_conv;
13836 }
13837 bool processing_queue_high_LDKRoutingMessageHandler_jcall(const void* this_arg) {
13838         LDKRoutingMessageHandler_JCalls *j_calls = (LDKRoutingMessageHandler_JCalls*) this_arg;
13839         return js_invoke_function_uuuuuu(j_calls->instance_ptr, 119, 0, 0, 0, 0, 0, 0);
13840 }
13841 LDKNodeFeatures provided_node_features_LDKRoutingMessageHandler_jcall(const void* this_arg) {
13842         LDKRoutingMessageHandler_JCalls *j_calls = (LDKRoutingMessageHandler_JCalls*) this_arg;
13843         uint64_t ret = js_invoke_function_uuuuuu(j_calls->instance_ptr, 120, 0, 0, 0, 0, 0, 0);
13844         LDKNodeFeatures ret_conv;
13845         ret_conv.inner = untag_ptr(ret);
13846         ret_conv.is_owned = ptr_is_owned(ret);
13847         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_conv);
13848         return ret_conv;
13849 }
13850 LDKInitFeatures provided_init_features_LDKRoutingMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id) {
13851         LDKRoutingMessageHandler_JCalls *j_calls = (LDKRoutingMessageHandler_JCalls*) this_arg;
13852         int8_tArray their_node_id_arr = init_int8_tArray(33, __LINE__);
13853         memcpy(their_node_id_arr->elems, their_node_id.compressed_form, 33);
13854         uint64_t ret = js_invoke_function_uuuuuu(j_calls->instance_ptr, 121, (uint32_t)their_node_id_arr, 0, 0, 0, 0, 0);
13855         LDKInitFeatures ret_conv;
13856         ret_conv.inner = untag_ptr(ret);
13857         ret_conv.is_owned = ptr_is_owned(ret);
13858         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_conv);
13859         return ret_conv;
13860 }
13861 static void LDKRoutingMessageHandler_JCalls_cloned(LDKRoutingMessageHandler* new_obj) {
13862         LDKRoutingMessageHandler_JCalls *j_calls = (LDKRoutingMessageHandler_JCalls*) new_obj->this_arg;
13863         atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
13864         atomic_fetch_add_explicit(&j_calls->MessageSendEventsProvider->refcnt, 1, memory_order_release);
13865 }
13866 static inline LDKRoutingMessageHandler LDKRoutingMessageHandler_init (JSValue o, JSValue MessageSendEventsProvider) {
13867         LDKRoutingMessageHandler_JCalls *calls = MALLOC(sizeof(LDKRoutingMessageHandler_JCalls), "LDKRoutingMessageHandler_JCalls");
13868         atomic_init(&calls->refcnt, 1);
13869         calls->instance_ptr = o;
13870
13871         LDKRoutingMessageHandler ret = {
13872                 .this_arg = (void*) calls,
13873                 .handle_node_announcement = handle_node_announcement_LDKRoutingMessageHandler_jcall,
13874                 .handle_channel_announcement = handle_channel_announcement_LDKRoutingMessageHandler_jcall,
13875                 .handle_channel_update = handle_channel_update_LDKRoutingMessageHandler_jcall,
13876                 .get_next_channel_announcement = get_next_channel_announcement_LDKRoutingMessageHandler_jcall,
13877                 .get_next_node_announcement = get_next_node_announcement_LDKRoutingMessageHandler_jcall,
13878                 .peer_connected = peer_connected_LDKRoutingMessageHandler_jcall,
13879                 .handle_reply_channel_range = handle_reply_channel_range_LDKRoutingMessageHandler_jcall,
13880                 .handle_reply_short_channel_ids_end = handle_reply_short_channel_ids_end_LDKRoutingMessageHandler_jcall,
13881                 .handle_query_channel_range = handle_query_channel_range_LDKRoutingMessageHandler_jcall,
13882                 .handle_query_short_channel_ids = handle_query_short_channel_ids_LDKRoutingMessageHandler_jcall,
13883                 .processing_queue_high = processing_queue_high_LDKRoutingMessageHandler_jcall,
13884                 .provided_node_features = provided_node_features_LDKRoutingMessageHandler_jcall,
13885                 .provided_init_features = provided_init_features_LDKRoutingMessageHandler_jcall,
13886                 .free = LDKRoutingMessageHandler_JCalls_free,
13887                 .MessageSendEventsProvider = LDKMessageSendEventsProvider_init(MessageSendEventsProvider),
13888         };
13889         calls->MessageSendEventsProvider = ret.MessageSendEventsProvider.this_arg;
13890         return ret;
13891 }
13892 uint64_t  __attribute__((export_name("TS_LDKRoutingMessageHandler_new"))) TS_LDKRoutingMessageHandler_new(JSValue o, JSValue MessageSendEventsProvider) {
13893         LDKRoutingMessageHandler *res_ptr = MALLOC(sizeof(LDKRoutingMessageHandler), "LDKRoutingMessageHandler");
13894         *res_ptr = LDKRoutingMessageHandler_init(o, MessageSendEventsProvider);
13895         return tag_ptr(res_ptr, true);
13896 }
13897 uint64_t  __attribute__((export_name("TS_RoutingMessageHandler_handle_node_announcement"))) TS_RoutingMessageHandler_handle_node_announcement(uint64_t this_arg, uint64_t msg) {
13898         void* this_arg_ptr = untag_ptr(this_arg);
13899         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
13900         LDKRoutingMessageHandler* this_arg_conv = (LDKRoutingMessageHandler*)this_arg_ptr;
13901         LDKNodeAnnouncement msg_conv;
13902         msg_conv.inner = untag_ptr(msg);
13903         msg_conv.is_owned = ptr_is_owned(msg);
13904         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
13905         msg_conv.is_owned = false;
13906         LDKCResult_boolLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_boolLightningErrorZ), "LDKCResult_boolLightningErrorZ");
13907         *ret_conv = (this_arg_conv->handle_node_announcement)(this_arg_conv->this_arg, &msg_conv);
13908         return tag_ptr(ret_conv, true);
13909 }
13910
13911 uint64_t  __attribute__((export_name("TS_RoutingMessageHandler_handle_channel_announcement"))) TS_RoutingMessageHandler_handle_channel_announcement(uint64_t this_arg, uint64_t msg) {
13912         void* this_arg_ptr = untag_ptr(this_arg);
13913         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
13914         LDKRoutingMessageHandler* this_arg_conv = (LDKRoutingMessageHandler*)this_arg_ptr;
13915         LDKChannelAnnouncement msg_conv;
13916         msg_conv.inner = untag_ptr(msg);
13917         msg_conv.is_owned = ptr_is_owned(msg);
13918         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
13919         msg_conv.is_owned = false;
13920         LDKCResult_boolLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_boolLightningErrorZ), "LDKCResult_boolLightningErrorZ");
13921         *ret_conv = (this_arg_conv->handle_channel_announcement)(this_arg_conv->this_arg, &msg_conv);
13922         return tag_ptr(ret_conv, true);
13923 }
13924
13925 uint64_t  __attribute__((export_name("TS_RoutingMessageHandler_handle_channel_update"))) TS_RoutingMessageHandler_handle_channel_update(uint64_t this_arg, uint64_t msg) {
13926         void* this_arg_ptr = untag_ptr(this_arg);
13927         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
13928         LDKRoutingMessageHandler* this_arg_conv = (LDKRoutingMessageHandler*)this_arg_ptr;
13929         LDKChannelUpdate msg_conv;
13930         msg_conv.inner = untag_ptr(msg);
13931         msg_conv.is_owned = ptr_is_owned(msg);
13932         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
13933         msg_conv.is_owned = false;
13934         LDKCResult_boolLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_boolLightningErrorZ), "LDKCResult_boolLightningErrorZ");
13935         *ret_conv = (this_arg_conv->handle_channel_update)(this_arg_conv->this_arg, &msg_conv);
13936         return tag_ptr(ret_conv, true);
13937 }
13938
13939 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) {
13940         void* this_arg_ptr = untag_ptr(this_arg);
13941         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
13942         LDKRoutingMessageHandler* this_arg_conv = (LDKRoutingMessageHandler*)this_arg_ptr;
13943         LDKCOption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ *ret_copy = MALLOC(sizeof(LDKCOption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ), "LDKCOption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ");
13944         *ret_copy = (this_arg_conv->get_next_channel_announcement)(this_arg_conv->this_arg, starting_point);
13945         uint64_t ret_ref = tag_ptr(ret_copy, true);
13946         return ret_ref;
13947 }
13948
13949 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) {
13950         void* this_arg_ptr = untag_ptr(this_arg);
13951         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
13952         LDKRoutingMessageHandler* this_arg_conv = (LDKRoutingMessageHandler*)this_arg_ptr;
13953         LDKNodeId starting_point_conv;
13954         starting_point_conv.inner = untag_ptr(starting_point);
13955         starting_point_conv.is_owned = ptr_is_owned(starting_point);
13956         CHECK_INNER_FIELD_ACCESS_OR_NULL(starting_point_conv);
13957         starting_point_conv = NodeId_clone(&starting_point_conv);
13958         LDKNodeAnnouncement ret_var = (this_arg_conv->get_next_node_announcement)(this_arg_conv->this_arg, starting_point_conv);
13959         uint64_t ret_ref = 0;
13960         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
13961         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
13962         return ret_ref;
13963 }
13964
13965 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) {
13966         void* this_arg_ptr = untag_ptr(this_arg);
13967         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
13968         LDKRoutingMessageHandler* this_arg_conv = (LDKRoutingMessageHandler*)this_arg_ptr;
13969         LDKPublicKey their_node_id_ref;
13970         CHECK(their_node_id->arr_len == 33);
13971         memcpy(their_node_id_ref.compressed_form, their_node_id->elems, 33); FREE(their_node_id);
13972         LDKInit init_conv;
13973         init_conv.inner = untag_ptr(init);
13974         init_conv.is_owned = ptr_is_owned(init);
13975         CHECK_INNER_FIELD_ACCESS_OR_NULL(init_conv);
13976         init_conv.is_owned = false;
13977         LDKCResult_NoneNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneNoneZ), "LDKCResult_NoneNoneZ");
13978         *ret_conv = (this_arg_conv->peer_connected)(this_arg_conv->this_arg, their_node_id_ref, &init_conv, inbound);
13979         return tag_ptr(ret_conv, true);
13980 }
13981
13982 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) {
13983         void* this_arg_ptr = untag_ptr(this_arg);
13984         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
13985         LDKRoutingMessageHandler* this_arg_conv = (LDKRoutingMessageHandler*)this_arg_ptr;
13986         LDKPublicKey their_node_id_ref;
13987         CHECK(their_node_id->arr_len == 33);
13988         memcpy(their_node_id_ref.compressed_form, their_node_id->elems, 33); FREE(their_node_id);
13989         LDKReplyChannelRange msg_conv;
13990         msg_conv.inner = untag_ptr(msg);
13991         msg_conv.is_owned = ptr_is_owned(msg);
13992         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
13993         msg_conv = ReplyChannelRange_clone(&msg_conv);
13994         LDKCResult_NoneLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneLightningErrorZ), "LDKCResult_NoneLightningErrorZ");
13995         *ret_conv = (this_arg_conv->handle_reply_channel_range)(this_arg_conv->this_arg, their_node_id_ref, msg_conv);
13996         return tag_ptr(ret_conv, true);
13997 }
13998
13999 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) {
14000         void* this_arg_ptr = untag_ptr(this_arg);
14001         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
14002         LDKRoutingMessageHandler* this_arg_conv = (LDKRoutingMessageHandler*)this_arg_ptr;
14003         LDKPublicKey their_node_id_ref;
14004         CHECK(their_node_id->arr_len == 33);
14005         memcpy(their_node_id_ref.compressed_form, their_node_id->elems, 33); FREE(their_node_id);
14006         LDKReplyShortChannelIdsEnd msg_conv;
14007         msg_conv.inner = untag_ptr(msg);
14008         msg_conv.is_owned = ptr_is_owned(msg);
14009         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
14010         msg_conv = ReplyShortChannelIdsEnd_clone(&msg_conv);
14011         LDKCResult_NoneLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneLightningErrorZ), "LDKCResult_NoneLightningErrorZ");
14012         *ret_conv = (this_arg_conv->handle_reply_short_channel_ids_end)(this_arg_conv->this_arg, their_node_id_ref, msg_conv);
14013         return tag_ptr(ret_conv, true);
14014 }
14015
14016 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) {
14017         void* this_arg_ptr = untag_ptr(this_arg);
14018         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
14019         LDKRoutingMessageHandler* this_arg_conv = (LDKRoutingMessageHandler*)this_arg_ptr;
14020         LDKPublicKey their_node_id_ref;
14021         CHECK(their_node_id->arr_len == 33);
14022         memcpy(their_node_id_ref.compressed_form, their_node_id->elems, 33); FREE(their_node_id);
14023         LDKQueryChannelRange msg_conv;
14024         msg_conv.inner = untag_ptr(msg);
14025         msg_conv.is_owned = ptr_is_owned(msg);
14026         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
14027         msg_conv = QueryChannelRange_clone(&msg_conv);
14028         LDKCResult_NoneLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneLightningErrorZ), "LDKCResult_NoneLightningErrorZ");
14029         *ret_conv = (this_arg_conv->handle_query_channel_range)(this_arg_conv->this_arg, their_node_id_ref, msg_conv);
14030         return tag_ptr(ret_conv, true);
14031 }
14032
14033 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) {
14034         void* this_arg_ptr = untag_ptr(this_arg);
14035         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
14036         LDKRoutingMessageHandler* this_arg_conv = (LDKRoutingMessageHandler*)this_arg_ptr;
14037         LDKPublicKey their_node_id_ref;
14038         CHECK(their_node_id->arr_len == 33);
14039         memcpy(their_node_id_ref.compressed_form, their_node_id->elems, 33); FREE(their_node_id);
14040         LDKQueryShortChannelIds msg_conv;
14041         msg_conv.inner = untag_ptr(msg);
14042         msg_conv.is_owned = ptr_is_owned(msg);
14043         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
14044         msg_conv = QueryShortChannelIds_clone(&msg_conv);
14045         LDKCResult_NoneLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneLightningErrorZ), "LDKCResult_NoneLightningErrorZ");
14046         *ret_conv = (this_arg_conv->handle_query_short_channel_ids)(this_arg_conv->this_arg, their_node_id_ref, msg_conv);
14047         return tag_ptr(ret_conv, true);
14048 }
14049
14050 jboolean  __attribute__((export_name("TS_RoutingMessageHandler_processing_queue_high"))) TS_RoutingMessageHandler_processing_queue_high(uint64_t this_arg) {
14051         void* this_arg_ptr = untag_ptr(this_arg);
14052         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
14053         LDKRoutingMessageHandler* this_arg_conv = (LDKRoutingMessageHandler*)this_arg_ptr;
14054         jboolean ret_conv = (this_arg_conv->processing_queue_high)(this_arg_conv->this_arg);
14055         return ret_conv;
14056 }
14057
14058 uint64_t  __attribute__((export_name("TS_RoutingMessageHandler_provided_node_features"))) TS_RoutingMessageHandler_provided_node_features(uint64_t this_arg) {
14059         void* this_arg_ptr = untag_ptr(this_arg);
14060         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
14061         LDKRoutingMessageHandler* this_arg_conv = (LDKRoutingMessageHandler*)this_arg_ptr;
14062         LDKNodeFeatures ret_var = (this_arg_conv->provided_node_features)(this_arg_conv->this_arg);
14063         uint64_t ret_ref = 0;
14064         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
14065         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
14066         return ret_ref;
14067 }
14068
14069 uint64_t  __attribute__((export_name("TS_RoutingMessageHandler_provided_init_features"))) TS_RoutingMessageHandler_provided_init_features(uint64_t this_arg, int8_tArray their_node_id) {
14070         void* this_arg_ptr = untag_ptr(this_arg);
14071         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
14072         LDKRoutingMessageHandler* this_arg_conv = (LDKRoutingMessageHandler*)this_arg_ptr;
14073         LDKPublicKey their_node_id_ref;
14074         CHECK(their_node_id->arr_len == 33);
14075         memcpy(their_node_id_ref.compressed_form, their_node_id->elems, 33); FREE(their_node_id);
14076         LDKInitFeatures ret_var = (this_arg_conv->provided_init_features)(this_arg_conv->this_arg, their_node_id_ref);
14077         uint64_t ret_ref = 0;
14078         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
14079         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
14080         return ret_ref;
14081 }
14082
14083 typedef struct LDKOnionMessageHandler_JCalls {
14084         atomic_size_t refcnt;
14085         uint32_t instance_ptr;
14086 } LDKOnionMessageHandler_JCalls;
14087 static void LDKOnionMessageHandler_JCalls_free(void* this_arg) {
14088         LDKOnionMessageHandler_JCalls *j_calls = (LDKOnionMessageHandler_JCalls*) this_arg;
14089         if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
14090                 FREE(j_calls);
14091         }
14092 }
14093 void handle_onion_message_LDKOnionMessageHandler_jcall(const void* this_arg, LDKPublicKey peer_node_id, const LDKOnionMessage * msg) {
14094         LDKOnionMessageHandler_JCalls *j_calls = (LDKOnionMessageHandler_JCalls*) this_arg;
14095         int8_tArray peer_node_id_arr = init_int8_tArray(33, __LINE__);
14096         memcpy(peer_node_id_arr->elems, peer_node_id.compressed_form, 33);
14097         LDKOnionMessage msg_var = *msg;
14098         uint64_t msg_ref = 0;
14099         msg_var = OnionMessage_clone(&msg_var);
14100         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
14101         msg_ref = tag_ptr(msg_var.inner, msg_var.is_owned);
14102         js_invoke_function_ubuuuu(j_calls->instance_ptr, 122, (uint32_t)peer_node_id_arr, msg_ref, 0, 0, 0, 0);
14103 }
14104 LDKOnionMessage next_onion_message_for_peer_LDKOnionMessageHandler_jcall(const void* this_arg, LDKPublicKey peer_node_id) {
14105         LDKOnionMessageHandler_JCalls *j_calls = (LDKOnionMessageHandler_JCalls*) this_arg;
14106         int8_tArray peer_node_id_arr = init_int8_tArray(33, __LINE__);
14107         memcpy(peer_node_id_arr->elems, peer_node_id.compressed_form, 33);
14108         uint64_t ret = js_invoke_function_uuuuuu(j_calls->instance_ptr, 123, (uint32_t)peer_node_id_arr, 0, 0, 0, 0, 0);
14109         LDKOnionMessage ret_conv;
14110         ret_conv.inner = untag_ptr(ret);
14111         ret_conv.is_owned = ptr_is_owned(ret);
14112         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_conv);
14113         return ret_conv;
14114 }
14115 LDKCResult_NoneNoneZ peer_connected_LDKOnionMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKInit * init, bool inbound) {
14116         LDKOnionMessageHandler_JCalls *j_calls = (LDKOnionMessageHandler_JCalls*) this_arg;
14117         int8_tArray their_node_id_arr = init_int8_tArray(33, __LINE__);
14118         memcpy(their_node_id_arr->elems, their_node_id.compressed_form, 33);
14119         LDKInit init_var = *init;
14120         uint64_t init_ref = 0;
14121         init_var = Init_clone(&init_var);
14122         CHECK_INNER_FIELD_ACCESS_OR_NULL(init_var);
14123         init_ref = tag_ptr(init_var.inner, init_var.is_owned);
14124         jboolean inbound_conv = inbound;
14125         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);
14126         void* ret_ptr = untag_ptr(ret);
14127         CHECK_ACCESS(ret_ptr);
14128         LDKCResult_NoneNoneZ ret_conv = *(LDKCResult_NoneNoneZ*)(ret_ptr);
14129         FREE(untag_ptr(ret));
14130         return ret_conv;
14131 }
14132 void peer_disconnected_LDKOnionMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id) {
14133         LDKOnionMessageHandler_JCalls *j_calls = (LDKOnionMessageHandler_JCalls*) this_arg;
14134         int8_tArray their_node_id_arr = init_int8_tArray(33, __LINE__);
14135         memcpy(their_node_id_arr->elems, their_node_id.compressed_form, 33);
14136         js_invoke_function_uuuuuu(j_calls->instance_ptr, 125, (uint32_t)their_node_id_arr, 0, 0, 0, 0, 0);
14137 }
14138 LDKNodeFeatures provided_node_features_LDKOnionMessageHandler_jcall(const void* this_arg) {
14139         LDKOnionMessageHandler_JCalls *j_calls = (LDKOnionMessageHandler_JCalls*) this_arg;
14140         uint64_t ret = js_invoke_function_uuuuuu(j_calls->instance_ptr, 126, 0, 0, 0, 0, 0, 0);
14141         LDKNodeFeatures ret_conv;
14142         ret_conv.inner = untag_ptr(ret);
14143         ret_conv.is_owned = ptr_is_owned(ret);
14144         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_conv);
14145         return ret_conv;
14146 }
14147 LDKInitFeatures provided_init_features_LDKOnionMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id) {
14148         LDKOnionMessageHandler_JCalls *j_calls = (LDKOnionMessageHandler_JCalls*) this_arg;
14149         int8_tArray their_node_id_arr = init_int8_tArray(33, __LINE__);
14150         memcpy(their_node_id_arr->elems, their_node_id.compressed_form, 33);
14151         uint64_t ret = js_invoke_function_uuuuuu(j_calls->instance_ptr, 127, (uint32_t)their_node_id_arr, 0, 0, 0, 0, 0);
14152         LDKInitFeatures ret_conv;
14153         ret_conv.inner = untag_ptr(ret);
14154         ret_conv.is_owned = ptr_is_owned(ret);
14155         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_conv);
14156         return ret_conv;
14157 }
14158 static void LDKOnionMessageHandler_JCalls_cloned(LDKOnionMessageHandler* new_obj) {
14159         LDKOnionMessageHandler_JCalls *j_calls = (LDKOnionMessageHandler_JCalls*) new_obj->this_arg;
14160         atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
14161 }
14162 static inline LDKOnionMessageHandler LDKOnionMessageHandler_init (JSValue o) {
14163         LDKOnionMessageHandler_JCalls *calls = MALLOC(sizeof(LDKOnionMessageHandler_JCalls), "LDKOnionMessageHandler_JCalls");
14164         atomic_init(&calls->refcnt, 1);
14165         calls->instance_ptr = o;
14166
14167         LDKOnionMessageHandler ret = {
14168                 .this_arg = (void*) calls,
14169                 .handle_onion_message = handle_onion_message_LDKOnionMessageHandler_jcall,
14170                 .next_onion_message_for_peer = next_onion_message_for_peer_LDKOnionMessageHandler_jcall,
14171                 .peer_connected = peer_connected_LDKOnionMessageHandler_jcall,
14172                 .peer_disconnected = peer_disconnected_LDKOnionMessageHandler_jcall,
14173                 .provided_node_features = provided_node_features_LDKOnionMessageHandler_jcall,
14174                 .provided_init_features = provided_init_features_LDKOnionMessageHandler_jcall,
14175                 .free = LDKOnionMessageHandler_JCalls_free,
14176         };
14177         return ret;
14178 }
14179 uint64_t  __attribute__((export_name("TS_LDKOnionMessageHandler_new"))) TS_LDKOnionMessageHandler_new(JSValue o) {
14180         LDKOnionMessageHandler *res_ptr = MALLOC(sizeof(LDKOnionMessageHandler), "LDKOnionMessageHandler");
14181         *res_ptr = LDKOnionMessageHandler_init(o);
14182         return tag_ptr(res_ptr, true);
14183 }
14184 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) {
14185         void* this_arg_ptr = untag_ptr(this_arg);
14186         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
14187         LDKOnionMessageHandler* this_arg_conv = (LDKOnionMessageHandler*)this_arg_ptr;
14188         LDKPublicKey peer_node_id_ref;
14189         CHECK(peer_node_id->arr_len == 33);
14190         memcpy(peer_node_id_ref.compressed_form, peer_node_id->elems, 33); FREE(peer_node_id);
14191         LDKOnionMessage msg_conv;
14192         msg_conv.inner = untag_ptr(msg);
14193         msg_conv.is_owned = ptr_is_owned(msg);
14194         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
14195         msg_conv.is_owned = false;
14196         (this_arg_conv->handle_onion_message)(this_arg_conv->this_arg, peer_node_id_ref, &msg_conv);
14197 }
14198
14199 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) {
14200         void* this_arg_ptr = untag_ptr(this_arg);
14201         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
14202         LDKOnionMessageHandler* this_arg_conv = (LDKOnionMessageHandler*)this_arg_ptr;
14203         LDKPublicKey peer_node_id_ref;
14204         CHECK(peer_node_id->arr_len == 33);
14205         memcpy(peer_node_id_ref.compressed_form, peer_node_id->elems, 33); FREE(peer_node_id);
14206         LDKOnionMessage ret_var = (this_arg_conv->next_onion_message_for_peer)(this_arg_conv->this_arg, peer_node_id_ref);
14207         uint64_t ret_ref = 0;
14208         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
14209         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
14210         return ret_ref;
14211 }
14212
14213 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) {
14214         void* this_arg_ptr = untag_ptr(this_arg);
14215         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
14216         LDKOnionMessageHandler* this_arg_conv = (LDKOnionMessageHandler*)this_arg_ptr;
14217         LDKPublicKey their_node_id_ref;
14218         CHECK(their_node_id->arr_len == 33);
14219         memcpy(their_node_id_ref.compressed_form, their_node_id->elems, 33); FREE(their_node_id);
14220         LDKInit init_conv;
14221         init_conv.inner = untag_ptr(init);
14222         init_conv.is_owned = ptr_is_owned(init);
14223         CHECK_INNER_FIELD_ACCESS_OR_NULL(init_conv);
14224         init_conv.is_owned = false;
14225         LDKCResult_NoneNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneNoneZ), "LDKCResult_NoneNoneZ");
14226         *ret_conv = (this_arg_conv->peer_connected)(this_arg_conv->this_arg, their_node_id_ref, &init_conv, inbound);
14227         return tag_ptr(ret_conv, true);
14228 }
14229
14230 void  __attribute__((export_name("TS_OnionMessageHandler_peer_disconnected"))) TS_OnionMessageHandler_peer_disconnected(uint64_t this_arg, int8_tArray their_node_id) {
14231         void* this_arg_ptr = untag_ptr(this_arg);
14232         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
14233         LDKOnionMessageHandler* this_arg_conv = (LDKOnionMessageHandler*)this_arg_ptr;
14234         LDKPublicKey their_node_id_ref;
14235         CHECK(their_node_id->arr_len == 33);
14236         memcpy(their_node_id_ref.compressed_form, their_node_id->elems, 33); FREE(their_node_id);
14237         (this_arg_conv->peer_disconnected)(this_arg_conv->this_arg, their_node_id_ref);
14238 }
14239
14240 uint64_t  __attribute__((export_name("TS_OnionMessageHandler_provided_node_features"))) TS_OnionMessageHandler_provided_node_features(uint64_t this_arg) {
14241         void* this_arg_ptr = untag_ptr(this_arg);
14242         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
14243         LDKOnionMessageHandler* this_arg_conv = (LDKOnionMessageHandler*)this_arg_ptr;
14244         LDKNodeFeatures ret_var = (this_arg_conv->provided_node_features)(this_arg_conv->this_arg);
14245         uint64_t ret_ref = 0;
14246         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
14247         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
14248         return ret_ref;
14249 }
14250
14251 uint64_t  __attribute__((export_name("TS_OnionMessageHandler_provided_init_features"))) TS_OnionMessageHandler_provided_init_features(uint64_t this_arg, int8_tArray their_node_id) {
14252         void* this_arg_ptr = untag_ptr(this_arg);
14253         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
14254         LDKOnionMessageHandler* this_arg_conv = (LDKOnionMessageHandler*)this_arg_ptr;
14255         LDKPublicKey their_node_id_ref;
14256         CHECK(their_node_id->arr_len == 33);
14257         memcpy(their_node_id_ref.compressed_form, their_node_id->elems, 33); FREE(their_node_id);
14258         LDKInitFeatures ret_var = (this_arg_conv->provided_init_features)(this_arg_conv->this_arg, their_node_id_ref);
14259         uint64_t ret_ref = 0;
14260         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
14261         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
14262         return ret_ref;
14263 }
14264
14265 typedef struct LDKCustomMessageReader_JCalls {
14266         atomic_size_t refcnt;
14267         uint32_t instance_ptr;
14268 } LDKCustomMessageReader_JCalls;
14269 static void LDKCustomMessageReader_JCalls_free(void* this_arg) {
14270         LDKCustomMessageReader_JCalls *j_calls = (LDKCustomMessageReader_JCalls*) this_arg;
14271         if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
14272                 FREE(j_calls);
14273         }
14274 }
14275 LDKCResult_COption_TypeZDecodeErrorZ read_LDKCustomMessageReader_jcall(const void* this_arg, uint16_t message_type, LDKu8slice buffer) {
14276         LDKCustomMessageReader_JCalls *j_calls = (LDKCustomMessageReader_JCalls*) this_arg;
14277         int16_t message_type_conv = message_type;
14278         LDKu8slice buffer_var = buffer;
14279         int8_tArray buffer_arr = init_int8_tArray(buffer_var.datalen, __LINE__);
14280         memcpy(buffer_arr->elems, buffer_var.data, buffer_var.datalen);
14281         uint64_t ret = js_invoke_function_uuuuuu(j_calls->instance_ptr, 128, message_type_conv, (uint32_t)buffer_arr, 0, 0, 0, 0);
14282         void* ret_ptr = untag_ptr(ret);
14283         CHECK_ACCESS(ret_ptr);
14284         LDKCResult_COption_TypeZDecodeErrorZ ret_conv = *(LDKCResult_COption_TypeZDecodeErrorZ*)(ret_ptr);
14285         FREE(untag_ptr(ret));
14286         return ret_conv;
14287 }
14288 static void LDKCustomMessageReader_JCalls_cloned(LDKCustomMessageReader* new_obj) {
14289         LDKCustomMessageReader_JCalls *j_calls = (LDKCustomMessageReader_JCalls*) new_obj->this_arg;
14290         atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
14291 }
14292 static inline LDKCustomMessageReader LDKCustomMessageReader_init (JSValue o) {
14293         LDKCustomMessageReader_JCalls *calls = MALLOC(sizeof(LDKCustomMessageReader_JCalls), "LDKCustomMessageReader_JCalls");
14294         atomic_init(&calls->refcnt, 1);
14295         calls->instance_ptr = o;
14296
14297         LDKCustomMessageReader ret = {
14298                 .this_arg = (void*) calls,
14299                 .read = read_LDKCustomMessageReader_jcall,
14300                 .free = LDKCustomMessageReader_JCalls_free,
14301         };
14302         return ret;
14303 }
14304 uint64_t  __attribute__((export_name("TS_LDKCustomMessageReader_new"))) TS_LDKCustomMessageReader_new(JSValue o) {
14305         LDKCustomMessageReader *res_ptr = MALLOC(sizeof(LDKCustomMessageReader), "LDKCustomMessageReader");
14306         *res_ptr = LDKCustomMessageReader_init(o);
14307         return tag_ptr(res_ptr, true);
14308 }
14309 uint64_t  __attribute__((export_name("TS_CustomMessageReader_read"))) TS_CustomMessageReader_read(uint64_t this_arg, int16_t message_type, int8_tArray buffer) {
14310         void* this_arg_ptr = untag_ptr(this_arg);
14311         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
14312         LDKCustomMessageReader* this_arg_conv = (LDKCustomMessageReader*)this_arg_ptr;
14313         LDKu8slice buffer_ref;
14314         buffer_ref.datalen = buffer->arr_len;
14315         buffer_ref.data = buffer->elems;
14316         LDKCResult_COption_TypeZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_COption_TypeZDecodeErrorZ), "LDKCResult_COption_TypeZDecodeErrorZ");
14317         *ret_conv = (this_arg_conv->read)(this_arg_conv->this_arg, message_type, buffer_ref);
14318         FREE(buffer);
14319         return tag_ptr(ret_conv, true);
14320 }
14321
14322 typedef struct LDKCustomMessageHandler_JCalls {
14323         atomic_size_t refcnt;
14324         uint32_t instance_ptr;
14325         LDKCustomMessageReader_JCalls* CustomMessageReader;
14326 } LDKCustomMessageHandler_JCalls;
14327 static void LDKCustomMessageHandler_JCalls_free(void* this_arg) {
14328         LDKCustomMessageHandler_JCalls *j_calls = (LDKCustomMessageHandler_JCalls*) this_arg;
14329         if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
14330                 FREE(j_calls);
14331         }
14332 }
14333 LDKCResult_NoneLightningErrorZ handle_custom_message_LDKCustomMessageHandler_jcall(const void* this_arg, LDKType msg, LDKPublicKey sender_node_id) {
14334         LDKCustomMessageHandler_JCalls *j_calls = (LDKCustomMessageHandler_JCalls*) this_arg;
14335         LDKType* msg_ret = MALLOC(sizeof(LDKType), "LDKType");
14336         *msg_ret = msg;
14337         int8_tArray sender_node_id_arr = init_int8_tArray(33, __LINE__);
14338         memcpy(sender_node_id_arr->elems, sender_node_id.compressed_form, 33);
14339         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);
14340         void* ret_ptr = untag_ptr(ret);
14341         CHECK_ACCESS(ret_ptr);
14342         LDKCResult_NoneLightningErrorZ ret_conv = *(LDKCResult_NoneLightningErrorZ*)(ret_ptr);
14343         FREE(untag_ptr(ret));
14344         return ret_conv;
14345 }
14346 LDKCVec_C2Tuple_PublicKeyTypeZZ get_and_clear_pending_msg_LDKCustomMessageHandler_jcall(const void* this_arg) {
14347         LDKCustomMessageHandler_JCalls *j_calls = (LDKCustomMessageHandler_JCalls*) this_arg;
14348         uint64_tArray ret = (uint64_tArray)js_invoke_function_uuuuuu(j_calls->instance_ptr, 130, 0, 0, 0, 0, 0, 0);
14349         LDKCVec_C2Tuple_PublicKeyTypeZZ ret_constr;
14350         ret_constr.datalen = ret->arr_len;
14351         if (ret_constr.datalen > 0)
14352                 ret_constr.data = MALLOC(ret_constr.datalen * sizeof(LDKC2Tuple_PublicKeyTypeZ), "LDKCVec_C2Tuple_PublicKeyTypeZZ Elements");
14353         else
14354                 ret_constr.data = NULL;
14355         uint64_t* ret_vals = ret->elems;
14356         for (size_t z = 0; z < ret_constr.datalen; z++) {
14357                 uint64_t ret_conv_25 = ret_vals[z];
14358                 void* ret_conv_25_ptr = untag_ptr(ret_conv_25);
14359                 CHECK_ACCESS(ret_conv_25_ptr);
14360                 LDKC2Tuple_PublicKeyTypeZ ret_conv_25_conv = *(LDKC2Tuple_PublicKeyTypeZ*)(ret_conv_25_ptr);
14361                 FREE(untag_ptr(ret_conv_25));
14362                 ret_constr.data[z] = ret_conv_25_conv;
14363         }
14364         FREE(ret);
14365         return ret_constr;
14366 }
14367 LDKNodeFeatures provided_node_features_LDKCustomMessageHandler_jcall(const void* this_arg) {
14368         LDKCustomMessageHandler_JCalls *j_calls = (LDKCustomMessageHandler_JCalls*) this_arg;
14369         uint64_t ret = js_invoke_function_uuuuuu(j_calls->instance_ptr, 131, 0, 0, 0, 0, 0, 0);
14370         LDKNodeFeatures ret_conv;
14371         ret_conv.inner = untag_ptr(ret);
14372         ret_conv.is_owned = ptr_is_owned(ret);
14373         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_conv);
14374         return ret_conv;
14375 }
14376 LDKInitFeatures provided_init_features_LDKCustomMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id) {
14377         LDKCustomMessageHandler_JCalls *j_calls = (LDKCustomMessageHandler_JCalls*) this_arg;
14378         int8_tArray their_node_id_arr = init_int8_tArray(33, __LINE__);
14379         memcpy(their_node_id_arr->elems, their_node_id.compressed_form, 33);
14380         uint64_t ret = js_invoke_function_uuuuuu(j_calls->instance_ptr, 132, (uint32_t)their_node_id_arr, 0, 0, 0, 0, 0);
14381         LDKInitFeatures ret_conv;
14382         ret_conv.inner = untag_ptr(ret);
14383         ret_conv.is_owned = ptr_is_owned(ret);
14384         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_conv);
14385         return ret_conv;
14386 }
14387 static void LDKCustomMessageHandler_JCalls_cloned(LDKCustomMessageHandler* new_obj) {
14388         LDKCustomMessageHandler_JCalls *j_calls = (LDKCustomMessageHandler_JCalls*) new_obj->this_arg;
14389         atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
14390         atomic_fetch_add_explicit(&j_calls->CustomMessageReader->refcnt, 1, memory_order_release);
14391 }
14392 static inline LDKCustomMessageHandler LDKCustomMessageHandler_init (JSValue o, JSValue CustomMessageReader) {
14393         LDKCustomMessageHandler_JCalls *calls = MALLOC(sizeof(LDKCustomMessageHandler_JCalls), "LDKCustomMessageHandler_JCalls");
14394         atomic_init(&calls->refcnt, 1);
14395         calls->instance_ptr = o;
14396
14397         LDKCustomMessageHandler ret = {
14398                 .this_arg = (void*) calls,
14399                 .handle_custom_message = handle_custom_message_LDKCustomMessageHandler_jcall,
14400                 .get_and_clear_pending_msg = get_and_clear_pending_msg_LDKCustomMessageHandler_jcall,
14401                 .provided_node_features = provided_node_features_LDKCustomMessageHandler_jcall,
14402                 .provided_init_features = provided_init_features_LDKCustomMessageHandler_jcall,
14403                 .free = LDKCustomMessageHandler_JCalls_free,
14404                 .CustomMessageReader = LDKCustomMessageReader_init(CustomMessageReader),
14405         };
14406         calls->CustomMessageReader = ret.CustomMessageReader.this_arg;
14407         return ret;
14408 }
14409 uint64_t  __attribute__((export_name("TS_LDKCustomMessageHandler_new"))) TS_LDKCustomMessageHandler_new(JSValue o, JSValue CustomMessageReader) {
14410         LDKCustomMessageHandler *res_ptr = MALLOC(sizeof(LDKCustomMessageHandler), "LDKCustomMessageHandler");
14411         *res_ptr = LDKCustomMessageHandler_init(o, CustomMessageReader);
14412         return tag_ptr(res_ptr, true);
14413 }
14414 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) {
14415         void* this_arg_ptr = untag_ptr(this_arg);
14416         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
14417         LDKCustomMessageHandler* this_arg_conv = (LDKCustomMessageHandler*)this_arg_ptr;
14418         void* msg_ptr = untag_ptr(msg);
14419         CHECK_ACCESS(msg_ptr);
14420         LDKType msg_conv = *(LDKType*)(msg_ptr);
14421         if (msg_conv.free == LDKType_JCalls_free) {
14422                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
14423                 LDKType_JCalls_cloned(&msg_conv);
14424         }
14425         LDKPublicKey sender_node_id_ref;
14426         CHECK(sender_node_id->arr_len == 33);
14427         memcpy(sender_node_id_ref.compressed_form, sender_node_id->elems, 33); FREE(sender_node_id);
14428         LDKCResult_NoneLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneLightningErrorZ), "LDKCResult_NoneLightningErrorZ");
14429         *ret_conv = (this_arg_conv->handle_custom_message)(this_arg_conv->this_arg, msg_conv, sender_node_id_ref);
14430         return tag_ptr(ret_conv, true);
14431 }
14432
14433 uint64_tArray  __attribute__((export_name("TS_CustomMessageHandler_get_and_clear_pending_msg"))) TS_CustomMessageHandler_get_and_clear_pending_msg(uint64_t this_arg) {
14434         void* this_arg_ptr = untag_ptr(this_arg);
14435         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
14436         LDKCustomMessageHandler* this_arg_conv = (LDKCustomMessageHandler*)this_arg_ptr;
14437         LDKCVec_C2Tuple_PublicKeyTypeZZ ret_var = (this_arg_conv->get_and_clear_pending_msg)(this_arg_conv->this_arg);
14438         uint64_tArray ret_arr = NULL;
14439         ret_arr = init_uint64_tArray(ret_var.datalen, __LINE__);
14440         uint64_t *ret_arr_ptr = (uint64_t*)(((uint8_t*)ret_arr) + 8);
14441         for (size_t z = 0; z < ret_var.datalen; z++) {
14442                 LDKC2Tuple_PublicKeyTypeZ* ret_conv_25_conv = MALLOC(sizeof(LDKC2Tuple_PublicKeyTypeZ), "LDKC2Tuple_PublicKeyTypeZ");
14443                 *ret_conv_25_conv = ret_var.data[z];
14444                 ret_arr_ptr[z] = tag_ptr(ret_conv_25_conv, true);
14445         }
14446         
14447         FREE(ret_var.data);
14448         return ret_arr;
14449 }
14450
14451 uint64_t  __attribute__((export_name("TS_CustomMessageHandler_provided_node_features"))) TS_CustomMessageHandler_provided_node_features(uint64_t this_arg) {
14452         void* this_arg_ptr = untag_ptr(this_arg);
14453         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
14454         LDKCustomMessageHandler* this_arg_conv = (LDKCustomMessageHandler*)this_arg_ptr;
14455         LDKNodeFeatures ret_var = (this_arg_conv->provided_node_features)(this_arg_conv->this_arg);
14456         uint64_t ret_ref = 0;
14457         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
14458         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
14459         return ret_ref;
14460 }
14461
14462 uint64_t  __attribute__((export_name("TS_CustomMessageHandler_provided_init_features"))) TS_CustomMessageHandler_provided_init_features(uint64_t this_arg, int8_tArray their_node_id) {
14463         void* this_arg_ptr = untag_ptr(this_arg);
14464         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
14465         LDKCustomMessageHandler* this_arg_conv = (LDKCustomMessageHandler*)this_arg_ptr;
14466         LDKPublicKey their_node_id_ref;
14467         CHECK(their_node_id->arr_len == 33);
14468         memcpy(their_node_id_ref.compressed_form, their_node_id->elems, 33); FREE(their_node_id);
14469         LDKInitFeatures ret_var = (this_arg_conv->provided_init_features)(this_arg_conv->this_arg, their_node_id_ref);
14470         uint64_t ret_ref = 0;
14471         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
14472         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
14473         return ret_ref;
14474 }
14475
14476 typedef struct LDKCustomOnionMessageHandler_JCalls {
14477         atomic_size_t refcnt;
14478         uint32_t instance_ptr;
14479 } LDKCustomOnionMessageHandler_JCalls;
14480 static void LDKCustomOnionMessageHandler_JCalls_free(void* this_arg) {
14481         LDKCustomOnionMessageHandler_JCalls *j_calls = (LDKCustomOnionMessageHandler_JCalls*) this_arg;
14482         if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
14483                 FREE(j_calls);
14484         }
14485 }
14486 LDKCOption_OnionMessageContentsZ handle_custom_message_LDKCustomOnionMessageHandler_jcall(const void* this_arg, LDKOnionMessageContents msg) {
14487         LDKCustomOnionMessageHandler_JCalls *j_calls = (LDKCustomOnionMessageHandler_JCalls*) this_arg;
14488         LDKOnionMessageContents* msg_ret = MALLOC(sizeof(LDKOnionMessageContents), "LDKOnionMessageContents");
14489         *msg_ret = msg;
14490         uint64_t ret = js_invoke_function_buuuuu(j_calls->instance_ptr, 133, tag_ptr(msg_ret, true), 0, 0, 0, 0, 0);
14491         void* ret_ptr = untag_ptr(ret);
14492         CHECK_ACCESS(ret_ptr);
14493         LDKCOption_OnionMessageContentsZ ret_conv = *(LDKCOption_OnionMessageContentsZ*)(ret_ptr);
14494         FREE(untag_ptr(ret));
14495         return ret_conv;
14496 }
14497 LDKCResult_COption_OnionMessageContentsZDecodeErrorZ read_custom_message_LDKCustomOnionMessageHandler_jcall(const void* this_arg, uint64_t message_type, LDKu8slice buffer) {
14498         LDKCustomOnionMessageHandler_JCalls *j_calls = (LDKCustomOnionMessageHandler_JCalls*) this_arg;
14499         int64_t message_type_conv = message_type;
14500         LDKu8slice buffer_var = buffer;
14501         int8_tArray buffer_arr = init_int8_tArray(buffer_var.datalen, __LINE__);
14502         memcpy(buffer_arr->elems, buffer_var.data, buffer_var.datalen);
14503         uint64_t ret = js_invoke_function_buuuuu(j_calls->instance_ptr, 134, message_type_conv, (uint32_t)buffer_arr, 0, 0, 0, 0);
14504         void* ret_ptr = untag_ptr(ret);
14505         CHECK_ACCESS(ret_ptr);
14506         LDKCResult_COption_OnionMessageContentsZDecodeErrorZ ret_conv = *(LDKCResult_COption_OnionMessageContentsZDecodeErrorZ*)(ret_ptr);
14507         FREE(untag_ptr(ret));
14508         return ret_conv;
14509 }
14510 LDKCVec_C3Tuple_OnionMessageContentsDestinationBlindedPathZZ release_pending_custom_messages_LDKCustomOnionMessageHandler_jcall(const void* this_arg) {
14511         LDKCustomOnionMessageHandler_JCalls *j_calls = (LDKCustomOnionMessageHandler_JCalls*) this_arg;
14512         uint64_tArray ret = (uint64_tArray)js_invoke_function_uuuuuu(j_calls->instance_ptr, 135, 0, 0, 0, 0, 0, 0);
14513         LDKCVec_C3Tuple_OnionMessageContentsDestinationBlindedPathZZ ret_constr;
14514         ret_constr.datalen = ret->arr_len;
14515         if (ret_constr.datalen > 0)
14516                 ret_constr.data = MALLOC(ret_constr.datalen * sizeof(LDKC3Tuple_OnionMessageContentsDestinationBlindedPathZ), "LDKCVec_C3Tuple_OnionMessageContentsDestinationBlindedPathZZ Elements");
14517         else
14518                 ret_constr.data = NULL;
14519         uint64_t* ret_vals = ret->elems;
14520         for (size_t e = 0; e < ret_constr.datalen; e++) {
14521                 uint64_t ret_conv_56 = ret_vals[e];
14522                 void* ret_conv_56_ptr = untag_ptr(ret_conv_56);
14523                 CHECK_ACCESS(ret_conv_56_ptr);
14524                 LDKC3Tuple_OnionMessageContentsDestinationBlindedPathZ ret_conv_56_conv = *(LDKC3Tuple_OnionMessageContentsDestinationBlindedPathZ*)(ret_conv_56_ptr);
14525                 FREE(untag_ptr(ret_conv_56));
14526                 ret_constr.data[e] = ret_conv_56_conv;
14527         }
14528         FREE(ret);
14529         return ret_constr;
14530 }
14531 static void LDKCustomOnionMessageHandler_JCalls_cloned(LDKCustomOnionMessageHandler* new_obj) {
14532         LDKCustomOnionMessageHandler_JCalls *j_calls = (LDKCustomOnionMessageHandler_JCalls*) new_obj->this_arg;
14533         atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
14534 }
14535 static inline LDKCustomOnionMessageHandler LDKCustomOnionMessageHandler_init (JSValue o) {
14536         LDKCustomOnionMessageHandler_JCalls *calls = MALLOC(sizeof(LDKCustomOnionMessageHandler_JCalls), "LDKCustomOnionMessageHandler_JCalls");
14537         atomic_init(&calls->refcnt, 1);
14538         calls->instance_ptr = o;
14539
14540         LDKCustomOnionMessageHandler ret = {
14541                 .this_arg = (void*) calls,
14542                 .handle_custom_message = handle_custom_message_LDKCustomOnionMessageHandler_jcall,
14543                 .read_custom_message = read_custom_message_LDKCustomOnionMessageHandler_jcall,
14544                 .release_pending_custom_messages = release_pending_custom_messages_LDKCustomOnionMessageHandler_jcall,
14545                 .free = LDKCustomOnionMessageHandler_JCalls_free,
14546         };
14547         return ret;
14548 }
14549 uint64_t  __attribute__((export_name("TS_LDKCustomOnionMessageHandler_new"))) TS_LDKCustomOnionMessageHandler_new(JSValue o) {
14550         LDKCustomOnionMessageHandler *res_ptr = MALLOC(sizeof(LDKCustomOnionMessageHandler), "LDKCustomOnionMessageHandler");
14551         *res_ptr = LDKCustomOnionMessageHandler_init(o);
14552         return tag_ptr(res_ptr, true);
14553 }
14554 uint64_t  __attribute__((export_name("TS_CustomOnionMessageHandler_handle_custom_message"))) TS_CustomOnionMessageHandler_handle_custom_message(uint64_t this_arg, uint64_t msg) {
14555         void* this_arg_ptr = untag_ptr(this_arg);
14556         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
14557         LDKCustomOnionMessageHandler* this_arg_conv = (LDKCustomOnionMessageHandler*)this_arg_ptr;
14558         void* msg_ptr = untag_ptr(msg);
14559         CHECK_ACCESS(msg_ptr);
14560         LDKOnionMessageContents msg_conv = *(LDKOnionMessageContents*)(msg_ptr);
14561         if (msg_conv.free == LDKOnionMessageContents_JCalls_free) {
14562                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
14563                 LDKOnionMessageContents_JCalls_cloned(&msg_conv);
14564         }
14565         LDKCOption_OnionMessageContentsZ *ret_copy = MALLOC(sizeof(LDKCOption_OnionMessageContentsZ), "LDKCOption_OnionMessageContentsZ");
14566         *ret_copy = (this_arg_conv->handle_custom_message)(this_arg_conv->this_arg, msg_conv);
14567         uint64_t ret_ref = tag_ptr(ret_copy, true);
14568         return ret_ref;
14569 }
14570
14571 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) {
14572         void* this_arg_ptr = untag_ptr(this_arg);
14573         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
14574         LDKCustomOnionMessageHandler* this_arg_conv = (LDKCustomOnionMessageHandler*)this_arg_ptr;
14575         LDKu8slice buffer_ref;
14576         buffer_ref.datalen = buffer->arr_len;
14577         buffer_ref.data = buffer->elems;
14578         LDKCResult_COption_OnionMessageContentsZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_COption_OnionMessageContentsZDecodeErrorZ), "LDKCResult_COption_OnionMessageContentsZDecodeErrorZ");
14579         *ret_conv = (this_arg_conv->read_custom_message)(this_arg_conv->this_arg, message_type, buffer_ref);
14580         FREE(buffer);
14581         return tag_ptr(ret_conv, true);
14582 }
14583
14584 uint64_tArray  __attribute__((export_name("TS_CustomOnionMessageHandler_release_pending_custom_messages"))) TS_CustomOnionMessageHandler_release_pending_custom_messages(uint64_t this_arg) {
14585         void* this_arg_ptr = untag_ptr(this_arg);
14586         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
14587         LDKCustomOnionMessageHandler* this_arg_conv = (LDKCustomOnionMessageHandler*)this_arg_ptr;
14588         LDKCVec_C3Tuple_OnionMessageContentsDestinationBlindedPathZZ ret_var = (this_arg_conv->release_pending_custom_messages)(this_arg_conv->this_arg);
14589         uint64_tArray ret_arr = NULL;
14590         ret_arr = init_uint64_tArray(ret_var.datalen, __LINE__);
14591         uint64_t *ret_arr_ptr = (uint64_t*)(((uint8_t*)ret_arr) + 8);
14592         for (size_t e = 0; e < ret_var.datalen; e++) {
14593                 LDKC3Tuple_OnionMessageContentsDestinationBlindedPathZ* ret_conv_56_conv = MALLOC(sizeof(LDKC3Tuple_OnionMessageContentsDestinationBlindedPathZ), "LDKC3Tuple_OnionMessageContentsDestinationBlindedPathZ");
14594                 *ret_conv_56_conv = ret_var.data[e];
14595                 ret_arr_ptr[e] = tag_ptr(ret_conv_56_conv, true);
14596         }
14597         
14598         FREE(ret_var.data);
14599         return ret_arr;
14600 }
14601
14602 typedef struct LDKSocketDescriptor_JCalls {
14603         atomic_size_t refcnt;
14604         uint32_t instance_ptr;
14605 } LDKSocketDescriptor_JCalls;
14606 static void LDKSocketDescriptor_JCalls_free(void* this_arg) {
14607         LDKSocketDescriptor_JCalls *j_calls = (LDKSocketDescriptor_JCalls*) this_arg;
14608         if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
14609                 FREE(j_calls);
14610         }
14611 }
14612 uintptr_t send_data_LDKSocketDescriptor_jcall(void* this_arg, LDKu8slice data, bool resume_read) {
14613         LDKSocketDescriptor_JCalls *j_calls = (LDKSocketDescriptor_JCalls*) this_arg;
14614         LDKu8slice data_var = data;
14615         int8_tArray data_arr = init_int8_tArray(data_var.datalen, __LINE__);
14616         memcpy(data_arr->elems, data_var.data, data_var.datalen);
14617         jboolean resume_read_conv = resume_read;
14618         return js_invoke_function_uuuuuu(j_calls->instance_ptr, 136, (uint32_t)data_arr, resume_read_conv, 0, 0, 0, 0);
14619 }
14620 void disconnect_socket_LDKSocketDescriptor_jcall(void* this_arg) {
14621         LDKSocketDescriptor_JCalls *j_calls = (LDKSocketDescriptor_JCalls*) this_arg;
14622         js_invoke_function_uuuuuu(j_calls->instance_ptr, 137, 0, 0, 0, 0, 0, 0);
14623 }
14624 bool eq_LDKSocketDescriptor_jcall(const void* this_arg, const LDKSocketDescriptor * other_arg) {
14625         LDKSocketDescriptor_JCalls *j_calls = (LDKSocketDescriptor_JCalls*) this_arg;
14626         LDKSocketDescriptor *other_arg_clone = MALLOC(sizeof(LDKSocketDescriptor), "LDKSocketDescriptor");
14627         *other_arg_clone = SocketDescriptor_clone(other_arg);
14628         return js_invoke_function_buuuuu(j_calls->instance_ptr, 138, tag_ptr(other_arg_clone, true), 0, 0, 0, 0, 0);
14629 }
14630 uint64_t hash_LDKSocketDescriptor_jcall(const void* this_arg) {
14631         LDKSocketDescriptor_JCalls *j_calls = (LDKSocketDescriptor_JCalls*) this_arg;
14632         return js_invoke_function_uuuuuu(j_calls->instance_ptr, 139, 0, 0, 0, 0, 0, 0);
14633 }
14634 static void LDKSocketDescriptor_JCalls_cloned(LDKSocketDescriptor* new_obj) {
14635         LDKSocketDescriptor_JCalls *j_calls = (LDKSocketDescriptor_JCalls*) new_obj->this_arg;
14636         atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
14637 }
14638 static inline LDKSocketDescriptor LDKSocketDescriptor_init (JSValue o) {
14639         LDKSocketDescriptor_JCalls *calls = MALLOC(sizeof(LDKSocketDescriptor_JCalls), "LDKSocketDescriptor_JCalls");
14640         atomic_init(&calls->refcnt, 1);
14641         calls->instance_ptr = o;
14642
14643         LDKSocketDescriptor ret = {
14644                 .this_arg = (void*) calls,
14645                 .send_data = send_data_LDKSocketDescriptor_jcall,
14646                 .disconnect_socket = disconnect_socket_LDKSocketDescriptor_jcall,
14647                 .eq = eq_LDKSocketDescriptor_jcall,
14648                 .hash = hash_LDKSocketDescriptor_jcall,
14649                 .cloned = LDKSocketDescriptor_JCalls_cloned,
14650                 .free = LDKSocketDescriptor_JCalls_free,
14651         };
14652         return ret;
14653 }
14654 uint64_t  __attribute__((export_name("TS_LDKSocketDescriptor_new"))) TS_LDKSocketDescriptor_new(JSValue o) {
14655         LDKSocketDescriptor *res_ptr = MALLOC(sizeof(LDKSocketDescriptor), "LDKSocketDescriptor");
14656         *res_ptr = LDKSocketDescriptor_init(o);
14657         return tag_ptr(res_ptr, true);
14658 }
14659 uint32_t  __attribute__((export_name("TS_SocketDescriptor_send_data"))) TS_SocketDescriptor_send_data(uint64_t this_arg, int8_tArray data, jboolean resume_read) {
14660         void* this_arg_ptr = untag_ptr(this_arg);
14661         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
14662         LDKSocketDescriptor* this_arg_conv = (LDKSocketDescriptor*)this_arg_ptr;
14663         LDKu8slice data_ref;
14664         data_ref.datalen = data->arr_len;
14665         data_ref.data = data->elems;
14666         uint32_t ret_conv = (this_arg_conv->send_data)(this_arg_conv->this_arg, data_ref, resume_read);
14667         FREE(data);
14668         return ret_conv;
14669 }
14670
14671 void  __attribute__((export_name("TS_SocketDescriptor_disconnect_socket"))) TS_SocketDescriptor_disconnect_socket(uint64_t this_arg) {
14672         void* this_arg_ptr = untag_ptr(this_arg);
14673         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
14674         LDKSocketDescriptor* this_arg_conv = (LDKSocketDescriptor*)this_arg_ptr;
14675         (this_arg_conv->disconnect_socket)(this_arg_conv->this_arg);
14676 }
14677
14678 int64_t  __attribute__((export_name("TS_SocketDescriptor_hash"))) TS_SocketDescriptor_hash(uint64_t this_arg) {
14679         void* this_arg_ptr = untag_ptr(this_arg);
14680         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
14681         LDKSocketDescriptor* this_arg_conv = (LDKSocketDescriptor*)this_arg_ptr;
14682         int64_t ret_conv = (this_arg_conv->hash)(this_arg_conv->this_arg);
14683         return ret_conv;
14684 }
14685
14686 uint32_t __attribute__((export_name("TS_LDKEffectiveCapacity_ty_from_ptr"))) TS_LDKEffectiveCapacity_ty_from_ptr(uint64_t ptr) {
14687         LDKEffectiveCapacity *obj = (LDKEffectiveCapacity*)untag_ptr(ptr);
14688         switch(obj->tag) {
14689                 case LDKEffectiveCapacity_ExactLiquidity: return 0;
14690                 case LDKEffectiveCapacity_AdvertisedMaxHTLC: return 1;
14691                 case LDKEffectiveCapacity_Total: return 2;
14692                 case LDKEffectiveCapacity_Infinite: return 3;
14693                 case LDKEffectiveCapacity_HintMaxHTLC: return 4;
14694                 case LDKEffectiveCapacity_Unknown: return 5;
14695                 default: abort();
14696         }
14697 }
14698 int64_t __attribute__((export_name("TS_LDKEffectiveCapacity_ExactLiquidity_get_liquidity_msat"))) TS_LDKEffectiveCapacity_ExactLiquidity_get_liquidity_msat(uint64_t ptr) {
14699         LDKEffectiveCapacity *obj = (LDKEffectiveCapacity*)untag_ptr(ptr);
14700         assert(obj->tag == LDKEffectiveCapacity_ExactLiquidity);
14701         int64_t liquidity_msat_conv = obj->exact_liquidity.liquidity_msat;
14702         return liquidity_msat_conv;
14703 }
14704 int64_t __attribute__((export_name("TS_LDKEffectiveCapacity_AdvertisedMaxHTLC_get_amount_msat"))) TS_LDKEffectiveCapacity_AdvertisedMaxHTLC_get_amount_msat(uint64_t ptr) {
14705         LDKEffectiveCapacity *obj = (LDKEffectiveCapacity*)untag_ptr(ptr);
14706         assert(obj->tag == LDKEffectiveCapacity_AdvertisedMaxHTLC);
14707         int64_t amount_msat_conv = obj->advertised_max_htlc.amount_msat;
14708         return amount_msat_conv;
14709 }
14710 int64_t __attribute__((export_name("TS_LDKEffectiveCapacity_Total_get_capacity_msat"))) TS_LDKEffectiveCapacity_Total_get_capacity_msat(uint64_t ptr) {
14711         LDKEffectiveCapacity *obj = (LDKEffectiveCapacity*)untag_ptr(ptr);
14712         assert(obj->tag == LDKEffectiveCapacity_Total);
14713         int64_t capacity_msat_conv = obj->total.capacity_msat;
14714         return capacity_msat_conv;
14715 }
14716 int64_t __attribute__((export_name("TS_LDKEffectiveCapacity_Total_get_htlc_maximum_msat"))) TS_LDKEffectiveCapacity_Total_get_htlc_maximum_msat(uint64_t ptr) {
14717         LDKEffectiveCapacity *obj = (LDKEffectiveCapacity*)untag_ptr(ptr);
14718         assert(obj->tag == LDKEffectiveCapacity_Total);
14719         int64_t htlc_maximum_msat_conv = obj->total.htlc_maximum_msat;
14720         return htlc_maximum_msat_conv;
14721 }
14722 int64_t __attribute__((export_name("TS_LDKEffectiveCapacity_HintMaxHTLC_get_amount_msat"))) TS_LDKEffectiveCapacity_HintMaxHTLC_get_amount_msat(uint64_t ptr) {
14723         LDKEffectiveCapacity *obj = (LDKEffectiveCapacity*)untag_ptr(ptr);
14724         assert(obj->tag == LDKEffectiveCapacity_HintMaxHTLC);
14725         int64_t amount_msat_conv = obj->hint_max_htlc.amount_msat;
14726         return amount_msat_conv;
14727 }
14728 uint32_t __attribute__((export_name("TS_LDKPayee_ty_from_ptr"))) TS_LDKPayee_ty_from_ptr(uint64_t ptr) {
14729         LDKPayee *obj = (LDKPayee*)untag_ptr(ptr);
14730         switch(obj->tag) {
14731                 case LDKPayee_Blinded: return 0;
14732                 case LDKPayee_Clear: return 1;
14733                 default: abort();
14734         }
14735 }
14736 uint64_tArray __attribute__((export_name("TS_LDKPayee_Blinded_get_route_hints"))) TS_LDKPayee_Blinded_get_route_hints(uint64_t ptr) {
14737         LDKPayee *obj = (LDKPayee*)untag_ptr(ptr);
14738         assert(obj->tag == LDKPayee_Blinded);
14739         LDKCVec_C2Tuple_BlindedPayInfoBlindedPathZZ route_hints_var = obj->blinded.route_hints;
14740                         uint64_tArray route_hints_arr = NULL;
14741                         route_hints_arr = init_uint64_tArray(route_hints_var.datalen, __LINE__);
14742                         uint64_t *route_hints_arr_ptr = (uint64_t*)(((uint8_t*)route_hints_arr) + 8);
14743                         for (size_t l = 0; l < route_hints_var.datalen; l++) {
14744                                 LDKC2Tuple_BlindedPayInfoBlindedPathZ* route_hints_conv_37_conv = MALLOC(sizeof(LDKC2Tuple_BlindedPayInfoBlindedPathZ), "LDKC2Tuple_BlindedPayInfoBlindedPathZ");
14745                                 *route_hints_conv_37_conv = route_hints_var.data[l];
14746                                 *route_hints_conv_37_conv = C2Tuple_BlindedPayInfoBlindedPathZ_clone(route_hints_conv_37_conv);
14747                                 route_hints_arr_ptr[l] = tag_ptr(route_hints_conv_37_conv, true);
14748                         }
14749                         
14750         return route_hints_arr;
14751 }
14752 uint64_t __attribute__((export_name("TS_LDKPayee_Blinded_get_features"))) TS_LDKPayee_Blinded_get_features(uint64_t ptr) {
14753         LDKPayee *obj = (LDKPayee*)untag_ptr(ptr);
14754         assert(obj->tag == LDKPayee_Blinded);
14755         LDKBolt12InvoiceFeatures features_var = obj->blinded.features;
14756                         uint64_t features_ref = 0;
14757                         CHECK_INNER_FIELD_ACCESS_OR_NULL(features_var);
14758                         features_ref = tag_ptr(features_var.inner, false);
14759         return features_ref;
14760 }
14761 int8_tArray __attribute__((export_name("TS_LDKPayee_Clear_get_node_id"))) TS_LDKPayee_Clear_get_node_id(uint64_t ptr) {
14762         LDKPayee *obj = (LDKPayee*)untag_ptr(ptr);
14763         assert(obj->tag == LDKPayee_Clear);
14764         int8_tArray node_id_arr = init_int8_tArray(33, __LINE__);
14765         memcpy(node_id_arr->elems, obj->clear.node_id.compressed_form, 33);
14766         return node_id_arr;
14767 }
14768 uint64_tArray __attribute__((export_name("TS_LDKPayee_Clear_get_route_hints"))) TS_LDKPayee_Clear_get_route_hints(uint64_t ptr) {
14769         LDKPayee *obj = (LDKPayee*)untag_ptr(ptr);
14770         assert(obj->tag == LDKPayee_Clear);
14771         LDKCVec_RouteHintZ route_hints_var = obj->clear.route_hints;
14772                         uint64_tArray route_hints_arr = NULL;
14773                         route_hints_arr = init_uint64_tArray(route_hints_var.datalen, __LINE__);
14774                         uint64_t *route_hints_arr_ptr = (uint64_t*)(((uint8_t*)route_hints_arr) + 8);
14775                         for (size_t l = 0; l < route_hints_var.datalen; l++) {
14776                                 LDKRouteHint route_hints_conv_11_var = route_hints_var.data[l];
14777                                 uint64_t route_hints_conv_11_ref = 0;
14778                                 CHECK_INNER_FIELD_ACCESS_OR_NULL(route_hints_conv_11_var);
14779                                 route_hints_conv_11_ref = tag_ptr(route_hints_conv_11_var.inner, false);
14780                                 route_hints_arr_ptr[l] = route_hints_conv_11_ref;
14781                         }
14782                         
14783         return route_hints_arr;
14784 }
14785 uint64_t __attribute__((export_name("TS_LDKPayee_Clear_get_features"))) TS_LDKPayee_Clear_get_features(uint64_t ptr) {
14786         LDKPayee *obj = (LDKPayee*)untag_ptr(ptr);
14787         assert(obj->tag == LDKPayee_Clear);
14788         LDKBolt11InvoiceFeatures features_var = obj->clear.features;
14789                         uint64_t features_ref = 0;
14790                         CHECK_INNER_FIELD_ACCESS_OR_NULL(features_var);
14791                         features_ref = tag_ptr(features_var.inner, false);
14792         return features_ref;
14793 }
14794 int32_t __attribute__((export_name("TS_LDKPayee_Clear_get_final_cltv_expiry_delta"))) TS_LDKPayee_Clear_get_final_cltv_expiry_delta(uint64_t ptr) {
14795         LDKPayee *obj = (LDKPayee*)untag_ptr(ptr);
14796         assert(obj->tag == LDKPayee_Clear);
14797         int32_t final_cltv_expiry_delta_conv = obj->clear.final_cltv_expiry_delta;
14798         return final_cltv_expiry_delta_conv;
14799 }
14800 typedef struct LDKScore_JCalls {
14801         atomic_size_t refcnt;
14802         uint32_t instance_ptr;
14803         LDKScoreLookUp_JCalls* ScoreLookUp;
14804         LDKScoreUpdate_JCalls* ScoreUpdate;
14805 } LDKScore_JCalls;
14806 static void LDKScore_JCalls_free(void* this_arg) {
14807         LDKScore_JCalls *j_calls = (LDKScore_JCalls*) this_arg;
14808         if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
14809                 FREE(j_calls);
14810         }
14811 }
14812 LDKCVec_u8Z write_LDKScore_jcall(const void* this_arg) {
14813         LDKScore_JCalls *j_calls = (LDKScore_JCalls*) this_arg;
14814         int8_tArray ret = (int8_tArray)js_invoke_function_uuuuuu(j_calls->instance_ptr, 140, 0, 0, 0, 0, 0, 0);
14815         LDKCVec_u8Z ret_ref;
14816         ret_ref.datalen = ret->arr_len;
14817         ret_ref.data = MALLOC(ret_ref.datalen, "LDKCVec_u8Z Bytes");
14818         memcpy(ret_ref.data, ret->elems, ret_ref.datalen); FREE(ret);
14819         return ret_ref;
14820 }
14821 static void LDKScore_JCalls_cloned(LDKScore* new_obj) {
14822         LDKScore_JCalls *j_calls = (LDKScore_JCalls*) new_obj->this_arg;
14823         atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
14824         atomic_fetch_add_explicit(&j_calls->ScoreLookUp->refcnt, 1, memory_order_release);
14825         atomic_fetch_add_explicit(&j_calls->ScoreUpdate->refcnt, 1, memory_order_release);
14826 }
14827 static inline LDKScore LDKScore_init (JSValue o, JSValue ScoreLookUp, JSValue ScoreUpdate) {
14828         LDKScore_JCalls *calls = MALLOC(sizeof(LDKScore_JCalls), "LDKScore_JCalls");
14829         atomic_init(&calls->refcnt, 1);
14830         calls->instance_ptr = o;
14831
14832         LDKScore ret = {
14833                 .this_arg = (void*) calls,
14834                 .write = write_LDKScore_jcall,
14835                 .free = LDKScore_JCalls_free,
14836                 .ScoreLookUp = LDKScoreLookUp_init(ScoreLookUp),
14837                 .ScoreUpdate = LDKScoreUpdate_init(ScoreUpdate),
14838         };
14839         calls->ScoreLookUp = ret.ScoreLookUp.this_arg;
14840         calls->ScoreUpdate = ret.ScoreUpdate.this_arg;
14841         return ret;
14842 }
14843 uint64_t  __attribute__((export_name("TS_LDKScore_new"))) TS_LDKScore_new(JSValue o, JSValue ScoreLookUp, JSValue ScoreUpdate) {
14844         LDKScore *res_ptr = MALLOC(sizeof(LDKScore), "LDKScore");
14845         *res_ptr = LDKScore_init(o, ScoreLookUp, ScoreUpdate);
14846         return tag_ptr(res_ptr, true);
14847 }
14848 int8_tArray  __attribute__((export_name("TS_Score_write"))) TS_Score_write(uint64_t this_arg) {
14849         void* this_arg_ptr = untag_ptr(this_arg);
14850         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
14851         LDKScore* this_arg_conv = (LDKScore*)this_arg_ptr;
14852         LDKCVec_u8Z ret_var = (this_arg_conv->write)(this_arg_conv->this_arg);
14853         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
14854         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
14855         CVec_u8Z_free(ret_var);
14856         return ret_arr;
14857 }
14858
14859 typedef struct LDKMessageRouter_JCalls {
14860         atomic_size_t refcnt;
14861         uint32_t instance_ptr;
14862 } LDKMessageRouter_JCalls;
14863 static void LDKMessageRouter_JCalls_free(void* this_arg) {
14864         LDKMessageRouter_JCalls *j_calls = (LDKMessageRouter_JCalls*) this_arg;
14865         if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
14866                 FREE(j_calls);
14867         }
14868 }
14869 LDKCResult_OnionMessagePathNoneZ find_path_LDKMessageRouter_jcall(const void* this_arg, LDKPublicKey sender, LDKCVec_PublicKeyZ peers, LDKDestination destination) {
14870         LDKMessageRouter_JCalls *j_calls = (LDKMessageRouter_JCalls*) this_arg;
14871         int8_tArray sender_arr = init_int8_tArray(33, __LINE__);
14872         memcpy(sender_arr->elems, sender.compressed_form, 33);
14873         LDKCVec_PublicKeyZ peers_var = peers;
14874         ptrArray peers_arr = NULL;
14875         peers_arr = init_ptrArray(peers_var.datalen, __LINE__);
14876         int8_tArray *peers_arr_ptr = (int8_tArray*)(((uint8_t*)peers_arr) + 8);
14877         for (size_t m = 0; m < peers_var.datalen; m++) {
14878                 int8_tArray peers_conv_12_arr = init_int8_tArray(33, __LINE__);
14879                 memcpy(peers_conv_12_arr->elems, peers_var.data[m].compressed_form, 33);
14880                 peers_arr_ptr[m] = peers_conv_12_arr;
14881         }
14882         
14883         FREE(peers_var.data);
14884         LDKDestination *destination_copy = MALLOC(sizeof(LDKDestination), "LDKDestination");
14885         *destination_copy = destination;
14886         uint64_t destination_ref = tag_ptr(destination_copy, true);
14887         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);
14888         void* ret_ptr = untag_ptr(ret);
14889         CHECK_ACCESS(ret_ptr);
14890         LDKCResult_OnionMessagePathNoneZ ret_conv = *(LDKCResult_OnionMessagePathNoneZ*)(ret_ptr);
14891         FREE(untag_ptr(ret));
14892         return ret_conv;
14893 }
14894 static void LDKMessageRouter_JCalls_cloned(LDKMessageRouter* new_obj) {
14895         LDKMessageRouter_JCalls *j_calls = (LDKMessageRouter_JCalls*) new_obj->this_arg;
14896         atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
14897 }
14898 static inline LDKMessageRouter LDKMessageRouter_init (JSValue o) {
14899         LDKMessageRouter_JCalls *calls = MALLOC(sizeof(LDKMessageRouter_JCalls), "LDKMessageRouter_JCalls");
14900         atomic_init(&calls->refcnt, 1);
14901         calls->instance_ptr = o;
14902
14903         LDKMessageRouter ret = {
14904                 .this_arg = (void*) calls,
14905                 .find_path = find_path_LDKMessageRouter_jcall,
14906                 .free = LDKMessageRouter_JCalls_free,
14907         };
14908         return ret;
14909 }
14910 uint64_t  __attribute__((export_name("TS_LDKMessageRouter_new"))) TS_LDKMessageRouter_new(JSValue o) {
14911         LDKMessageRouter *res_ptr = MALLOC(sizeof(LDKMessageRouter), "LDKMessageRouter");
14912         *res_ptr = LDKMessageRouter_init(o);
14913         return tag_ptr(res_ptr, true);
14914 }
14915 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) {
14916         void* this_arg_ptr = untag_ptr(this_arg);
14917         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
14918         LDKMessageRouter* this_arg_conv = (LDKMessageRouter*)this_arg_ptr;
14919         LDKPublicKey sender_ref;
14920         CHECK(sender->arr_len == 33);
14921         memcpy(sender_ref.compressed_form, sender->elems, 33); FREE(sender);
14922         LDKCVec_PublicKeyZ peers_constr;
14923         peers_constr.datalen = peers->arr_len;
14924         if (peers_constr.datalen > 0)
14925                 peers_constr.data = MALLOC(peers_constr.datalen * sizeof(LDKPublicKey), "LDKCVec_PublicKeyZ Elements");
14926         else
14927                 peers_constr.data = NULL;
14928         int8_tArray* peers_vals = (void*) peers->elems;
14929         for (size_t m = 0; m < peers_constr.datalen; m++) {
14930                 int8_tArray peers_conv_12 = peers_vals[m];
14931                 LDKPublicKey peers_conv_12_ref;
14932                 CHECK(peers_conv_12->arr_len == 33);
14933                 memcpy(peers_conv_12_ref.compressed_form, peers_conv_12->elems, 33); FREE(peers_conv_12);
14934                 peers_constr.data[m] = peers_conv_12_ref;
14935         }
14936         FREE(peers);
14937         void* destination_ptr = untag_ptr(destination);
14938         CHECK_ACCESS(destination_ptr);
14939         LDKDestination destination_conv = *(LDKDestination*)(destination_ptr);
14940         destination_conv = Destination_clone((LDKDestination*)untag_ptr(destination));
14941         LDKCResult_OnionMessagePathNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_OnionMessagePathNoneZ), "LDKCResult_OnionMessagePathNoneZ");
14942         *ret_conv = (this_arg_conv->find_path)(this_arg_conv->this_arg, sender_ref, peers_constr, destination_conv);
14943         return tag_ptr(ret_conv, true);
14944 }
14945
14946 typedef struct LDKCoinSelectionSource_JCalls {
14947         atomic_size_t refcnt;
14948         uint32_t instance_ptr;
14949 } LDKCoinSelectionSource_JCalls;
14950 static void LDKCoinSelectionSource_JCalls_free(void* this_arg) {
14951         LDKCoinSelectionSource_JCalls *j_calls = (LDKCoinSelectionSource_JCalls*) this_arg;
14952         if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
14953                 FREE(j_calls);
14954         }
14955 }
14956 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) {
14957         LDKCoinSelectionSource_JCalls *j_calls = (LDKCoinSelectionSource_JCalls*) this_arg;
14958         int8_tArray claim_id_arr = init_int8_tArray(32, __LINE__);
14959         memcpy(claim_id_arr->elems, claim_id.data, 32);
14960         LDKCVec_InputZ must_spend_var = must_spend;
14961         uint64_tArray must_spend_arr = NULL;
14962         must_spend_arr = init_uint64_tArray(must_spend_var.datalen, __LINE__);
14963         uint64_t *must_spend_arr_ptr = (uint64_t*)(((uint8_t*)must_spend_arr) + 8);
14964         for (size_t h = 0; h < must_spend_var.datalen; h++) {
14965                 LDKInput must_spend_conv_7_var = must_spend_var.data[h];
14966                 uint64_t must_spend_conv_7_ref = 0;
14967                 CHECK_INNER_FIELD_ACCESS_OR_NULL(must_spend_conv_7_var);
14968                 must_spend_conv_7_ref = tag_ptr(must_spend_conv_7_var.inner, must_spend_conv_7_var.is_owned);
14969                 must_spend_arr_ptr[h] = must_spend_conv_7_ref;
14970         }
14971         
14972         FREE(must_spend_var.data);
14973         LDKCVec_TxOutZ must_pay_to_var = must_pay_to;
14974         uint64_tArray must_pay_to_arr = NULL;
14975         must_pay_to_arr = init_uint64_tArray(must_pay_to_var.datalen, __LINE__);
14976         uint64_t *must_pay_to_arr_ptr = (uint64_t*)(((uint8_t*)must_pay_to_arr) + 8);
14977         for (size_t h = 0; h < must_pay_to_var.datalen; h++) {
14978                 LDKTxOut* must_pay_to_conv_7_ref = MALLOC(sizeof(LDKTxOut), "LDKTxOut");
14979                 *must_pay_to_conv_7_ref = must_pay_to_var.data[h];
14980                 must_pay_to_arr_ptr[h] = tag_ptr(must_pay_to_conv_7_ref, true);
14981         }
14982         
14983         FREE(must_pay_to_var.data);
14984         int32_t target_feerate_sat_per_1000_weight_conv = target_feerate_sat_per_1000_weight;
14985         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);
14986         void* ret_ptr = untag_ptr(ret);
14987         CHECK_ACCESS(ret_ptr);
14988         LDKCResult_CoinSelectionNoneZ ret_conv = *(LDKCResult_CoinSelectionNoneZ*)(ret_ptr);
14989         FREE(untag_ptr(ret));
14990         return ret_conv;
14991 }
14992 LDKCResult_TransactionNoneZ sign_tx_LDKCoinSelectionSource_jcall(const void* this_arg, LDKTransaction tx) {
14993         LDKCoinSelectionSource_JCalls *j_calls = (LDKCoinSelectionSource_JCalls*) this_arg;
14994         LDKTransaction tx_var = tx;
14995         int8_tArray tx_arr = init_int8_tArray(tx_var.datalen, __LINE__);
14996         memcpy(tx_arr->elems, tx_var.data, tx_var.datalen);
14997         Transaction_free(tx_var);
14998         uint64_t ret = js_invoke_function_uuuuuu(j_calls->instance_ptr, 143, (uint32_t)tx_arr, 0, 0, 0, 0, 0);
14999         void* ret_ptr = untag_ptr(ret);
15000         CHECK_ACCESS(ret_ptr);
15001         LDKCResult_TransactionNoneZ ret_conv = *(LDKCResult_TransactionNoneZ*)(ret_ptr);
15002         FREE(untag_ptr(ret));
15003         return ret_conv;
15004 }
15005 static void LDKCoinSelectionSource_JCalls_cloned(LDKCoinSelectionSource* new_obj) {
15006         LDKCoinSelectionSource_JCalls *j_calls = (LDKCoinSelectionSource_JCalls*) new_obj->this_arg;
15007         atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
15008 }
15009 static inline LDKCoinSelectionSource LDKCoinSelectionSource_init (JSValue o) {
15010         LDKCoinSelectionSource_JCalls *calls = MALLOC(sizeof(LDKCoinSelectionSource_JCalls), "LDKCoinSelectionSource_JCalls");
15011         atomic_init(&calls->refcnt, 1);
15012         calls->instance_ptr = o;
15013
15014         LDKCoinSelectionSource ret = {
15015                 .this_arg = (void*) calls,
15016                 .select_confirmed_utxos = select_confirmed_utxos_LDKCoinSelectionSource_jcall,
15017                 .sign_tx = sign_tx_LDKCoinSelectionSource_jcall,
15018                 .free = LDKCoinSelectionSource_JCalls_free,
15019         };
15020         return ret;
15021 }
15022 uint64_t  __attribute__((export_name("TS_LDKCoinSelectionSource_new"))) TS_LDKCoinSelectionSource_new(JSValue o) {
15023         LDKCoinSelectionSource *res_ptr = MALLOC(sizeof(LDKCoinSelectionSource), "LDKCoinSelectionSource");
15024         *res_ptr = LDKCoinSelectionSource_init(o);
15025         return tag_ptr(res_ptr, true);
15026 }
15027 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) {
15028         void* this_arg_ptr = untag_ptr(this_arg);
15029         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
15030         LDKCoinSelectionSource* this_arg_conv = (LDKCoinSelectionSource*)this_arg_ptr;
15031         LDKThirtyTwoBytes claim_id_ref;
15032         CHECK(claim_id->arr_len == 32);
15033         memcpy(claim_id_ref.data, claim_id->elems, 32); FREE(claim_id);
15034         LDKCVec_InputZ must_spend_constr;
15035         must_spend_constr.datalen = must_spend->arr_len;
15036         if (must_spend_constr.datalen > 0)
15037                 must_spend_constr.data = MALLOC(must_spend_constr.datalen * sizeof(LDKInput), "LDKCVec_InputZ Elements");
15038         else
15039                 must_spend_constr.data = NULL;
15040         uint64_t* must_spend_vals = must_spend->elems;
15041         for (size_t h = 0; h < must_spend_constr.datalen; h++) {
15042                 uint64_t must_spend_conv_7 = must_spend_vals[h];
15043                 LDKInput must_spend_conv_7_conv;
15044                 must_spend_conv_7_conv.inner = untag_ptr(must_spend_conv_7);
15045                 must_spend_conv_7_conv.is_owned = ptr_is_owned(must_spend_conv_7);
15046                 CHECK_INNER_FIELD_ACCESS_OR_NULL(must_spend_conv_7_conv);
15047                 must_spend_conv_7_conv = Input_clone(&must_spend_conv_7_conv);
15048                 must_spend_constr.data[h] = must_spend_conv_7_conv;
15049         }
15050         FREE(must_spend);
15051         LDKCVec_TxOutZ must_pay_to_constr;
15052         must_pay_to_constr.datalen = must_pay_to->arr_len;
15053         if (must_pay_to_constr.datalen > 0)
15054                 must_pay_to_constr.data = MALLOC(must_pay_to_constr.datalen * sizeof(LDKTxOut), "LDKCVec_TxOutZ Elements");
15055         else
15056                 must_pay_to_constr.data = NULL;
15057         uint64_t* must_pay_to_vals = must_pay_to->elems;
15058         for (size_t h = 0; h < must_pay_to_constr.datalen; h++) {
15059                 uint64_t must_pay_to_conv_7 = must_pay_to_vals[h];
15060                 void* must_pay_to_conv_7_ptr = untag_ptr(must_pay_to_conv_7);
15061                 CHECK_ACCESS(must_pay_to_conv_7_ptr);
15062                 LDKTxOut must_pay_to_conv_7_conv = *(LDKTxOut*)(must_pay_to_conv_7_ptr);
15063                 must_pay_to_conv_7_conv = TxOut_clone((LDKTxOut*)untag_ptr(must_pay_to_conv_7));
15064                 must_pay_to_constr.data[h] = must_pay_to_conv_7_conv;
15065         }
15066         FREE(must_pay_to);
15067         LDKCResult_CoinSelectionNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_CoinSelectionNoneZ), "LDKCResult_CoinSelectionNoneZ");
15068         *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);
15069         return tag_ptr(ret_conv, true);
15070 }
15071
15072 uint64_t  __attribute__((export_name("TS_CoinSelectionSource_sign_tx"))) TS_CoinSelectionSource_sign_tx(uint64_t this_arg, int8_tArray tx) {
15073         void* this_arg_ptr = untag_ptr(this_arg);
15074         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
15075         LDKCoinSelectionSource* this_arg_conv = (LDKCoinSelectionSource*)this_arg_ptr;
15076         LDKTransaction tx_ref;
15077         tx_ref.datalen = tx->arr_len;
15078         tx_ref.data = MALLOC(tx_ref.datalen, "LDKTransaction Bytes");
15079         memcpy(tx_ref.data, tx->elems, tx_ref.datalen); FREE(tx);
15080         tx_ref.data_is_owned = true;
15081         LDKCResult_TransactionNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_TransactionNoneZ), "LDKCResult_TransactionNoneZ");
15082         *ret_conv = (this_arg_conv->sign_tx)(this_arg_conv->this_arg, tx_ref);
15083         return tag_ptr(ret_conv, true);
15084 }
15085
15086 typedef struct LDKWalletSource_JCalls {
15087         atomic_size_t refcnt;
15088         uint32_t instance_ptr;
15089 } LDKWalletSource_JCalls;
15090 static void LDKWalletSource_JCalls_free(void* this_arg) {
15091         LDKWalletSource_JCalls *j_calls = (LDKWalletSource_JCalls*) this_arg;
15092         if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
15093                 FREE(j_calls);
15094         }
15095 }
15096 LDKCResult_CVec_UtxoZNoneZ list_confirmed_utxos_LDKWalletSource_jcall(const void* this_arg) {
15097         LDKWalletSource_JCalls *j_calls = (LDKWalletSource_JCalls*) this_arg;
15098         uint64_t ret = js_invoke_function_uuuuuu(j_calls->instance_ptr, 144, 0, 0, 0, 0, 0, 0);
15099         void* ret_ptr = untag_ptr(ret);
15100         CHECK_ACCESS(ret_ptr);
15101         LDKCResult_CVec_UtxoZNoneZ ret_conv = *(LDKCResult_CVec_UtxoZNoneZ*)(ret_ptr);
15102         FREE(untag_ptr(ret));
15103         return ret_conv;
15104 }
15105 LDKCResult_CVec_u8ZNoneZ get_change_script_LDKWalletSource_jcall(const void* this_arg) {
15106         LDKWalletSource_JCalls *j_calls = (LDKWalletSource_JCalls*) this_arg;
15107         uint64_t ret = js_invoke_function_uuuuuu(j_calls->instance_ptr, 145, 0, 0, 0, 0, 0, 0);
15108         void* ret_ptr = untag_ptr(ret);
15109         CHECK_ACCESS(ret_ptr);
15110         LDKCResult_CVec_u8ZNoneZ ret_conv = *(LDKCResult_CVec_u8ZNoneZ*)(ret_ptr);
15111         FREE(untag_ptr(ret));
15112         return ret_conv;
15113 }
15114 LDKCResult_TransactionNoneZ sign_tx_LDKWalletSource_jcall(const void* this_arg, LDKTransaction tx) {
15115         LDKWalletSource_JCalls *j_calls = (LDKWalletSource_JCalls*) this_arg;
15116         LDKTransaction tx_var = tx;
15117         int8_tArray tx_arr = init_int8_tArray(tx_var.datalen, __LINE__);
15118         memcpy(tx_arr->elems, tx_var.data, tx_var.datalen);
15119         Transaction_free(tx_var);
15120         uint64_t ret = js_invoke_function_uuuuuu(j_calls->instance_ptr, 146, (uint32_t)tx_arr, 0, 0, 0, 0, 0);
15121         void* ret_ptr = untag_ptr(ret);
15122         CHECK_ACCESS(ret_ptr);
15123         LDKCResult_TransactionNoneZ ret_conv = *(LDKCResult_TransactionNoneZ*)(ret_ptr);
15124         FREE(untag_ptr(ret));
15125         return ret_conv;
15126 }
15127 static void LDKWalletSource_JCalls_cloned(LDKWalletSource* new_obj) {
15128         LDKWalletSource_JCalls *j_calls = (LDKWalletSource_JCalls*) new_obj->this_arg;
15129         atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
15130 }
15131 static inline LDKWalletSource LDKWalletSource_init (JSValue o) {
15132         LDKWalletSource_JCalls *calls = MALLOC(sizeof(LDKWalletSource_JCalls), "LDKWalletSource_JCalls");
15133         atomic_init(&calls->refcnt, 1);
15134         calls->instance_ptr = o;
15135
15136         LDKWalletSource ret = {
15137                 .this_arg = (void*) calls,
15138                 .list_confirmed_utxos = list_confirmed_utxos_LDKWalletSource_jcall,
15139                 .get_change_script = get_change_script_LDKWalletSource_jcall,
15140                 .sign_tx = sign_tx_LDKWalletSource_jcall,
15141                 .free = LDKWalletSource_JCalls_free,
15142         };
15143         return ret;
15144 }
15145 uint64_t  __attribute__((export_name("TS_LDKWalletSource_new"))) TS_LDKWalletSource_new(JSValue o) {
15146         LDKWalletSource *res_ptr = MALLOC(sizeof(LDKWalletSource), "LDKWalletSource");
15147         *res_ptr = LDKWalletSource_init(o);
15148         return tag_ptr(res_ptr, true);
15149 }
15150 uint64_t  __attribute__((export_name("TS_WalletSource_list_confirmed_utxos"))) TS_WalletSource_list_confirmed_utxos(uint64_t this_arg) {
15151         void* this_arg_ptr = untag_ptr(this_arg);
15152         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
15153         LDKWalletSource* this_arg_conv = (LDKWalletSource*)this_arg_ptr;
15154         LDKCResult_CVec_UtxoZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_UtxoZNoneZ), "LDKCResult_CVec_UtxoZNoneZ");
15155         *ret_conv = (this_arg_conv->list_confirmed_utxos)(this_arg_conv->this_arg);
15156         return tag_ptr(ret_conv, true);
15157 }
15158
15159 uint64_t  __attribute__((export_name("TS_WalletSource_get_change_script"))) TS_WalletSource_get_change_script(uint64_t this_arg) {
15160         void* this_arg_ptr = untag_ptr(this_arg);
15161         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
15162         LDKWalletSource* this_arg_conv = (LDKWalletSource*)this_arg_ptr;
15163         LDKCResult_CVec_u8ZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_u8ZNoneZ), "LDKCResult_CVec_u8ZNoneZ");
15164         *ret_conv = (this_arg_conv->get_change_script)(this_arg_conv->this_arg);
15165         return tag_ptr(ret_conv, true);
15166 }
15167
15168 uint64_t  __attribute__((export_name("TS_WalletSource_sign_tx"))) TS_WalletSource_sign_tx(uint64_t this_arg, int8_tArray tx) {
15169         void* this_arg_ptr = untag_ptr(this_arg);
15170         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
15171         LDKWalletSource* this_arg_conv = (LDKWalletSource*)this_arg_ptr;
15172         LDKTransaction tx_ref;
15173         tx_ref.datalen = tx->arr_len;
15174         tx_ref.data = MALLOC(tx_ref.datalen, "LDKTransaction Bytes");
15175         memcpy(tx_ref.data, tx->elems, tx_ref.datalen); FREE(tx);
15176         tx_ref.data_is_owned = true;
15177         LDKCResult_TransactionNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_TransactionNoneZ), "LDKCResult_TransactionNoneZ");
15178         *ret_conv = (this_arg_conv->sign_tx)(this_arg_conv->this_arg, tx_ref);
15179         return tag_ptr(ret_conv, true);
15180 }
15181
15182 uint32_t __attribute__((export_name("TS_LDKGossipSync_ty_from_ptr"))) TS_LDKGossipSync_ty_from_ptr(uint64_t ptr) {
15183         LDKGossipSync *obj = (LDKGossipSync*)untag_ptr(ptr);
15184         switch(obj->tag) {
15185                 case LDKGossipSync_P2P: return 0;
15186                 case LDKGossipSync_Rapid: return 1;
15187                 case LDKGossipSync_None: return 2;
15188                 default: abort();
15189         }
15190 }
15191 uint64_t __attribute__((export_name("TS_LDKGossipSync_P2P_get_p2p"))) TS_LDKGossipSync_P2P_get_p2p(uint64_t ptr) {
15192         LDKGossipSync *obj = (LDKGossipSync*)untag_ptr(ptr);
15193         assert(obj->tag == LDKGossipSync_P2P);
15194         LDKP2PGossipSync p2p_var = obj->p2p;
15195                         uint64_t p2p_ref = 0;
15196                         CHECK_INNER_FIELD_ACCESS_OR_NULL(p2p_var);
15197                         p2p_ref = tag_ptr(p2p_var.inner, false);
15198         return p2p_ref;
15199 }
15200 uint64_t __attribute__((export_name("TS_LDKGossipSync_Rapid_get_rapid"))) TS_LDKGossipSync_Rapid_get_rapid(uint64_t ptr) {
15201         LDKGossipSync *obj = (LDKGossipSync*)untag_ptr(ptr);
15202         assert(obj->tag == LDKGossipSync_Rapid);
15203         LDKRapidGossipSync rapid_var = obj->rapid;
15204                         uint64_t rapid_ref = 0;
15205                         CHECK_INNER_FIELD_ACCESS_OR_NULL(rapid_var);
15206                         rapid_ref = tag_ptr(rapid_var.inner, false);
15207         return rapid_ref;
15208 }
15209 uint32_t __attribute__((export_name("TS_LDKFallback_ty_from_ptr"))) TS_LDKFallback_ty_from_ptr(uint64_t ptr) {
15210         LDKFallback *obj = (LDKFallback*)untag_ptr(ptr);
15211         switch(obj->tag) {
15212                 case LDKFallback_SegWitProgram: return 0;
15213                 case LDKFallback_PubKeyHash: return 1;
15214                 case LDKFallback_ScriptHash: return 2;
15215                 default: abort();
15216         }
15217 }
15218 int8_t __attribute__((export_name("TS_LDKFallback_SegWitProgram_get_version"))) TS_LDKFallback_SegWitProgram_get_version(uint64_t ptr) {
15219         LDKFallback *obj = (LDKFallback*)untag_ptr(ptr);
15220         assert(obj->tag == LDKFallback_SegWitProgram);
15221         uint8_t version_val = obj->seg_wit_program.version._0;
15222         return version_val;
15223 }
15224 int8_tArray __attribute__((export_name("TS_LDKFallback_SegWitProgram_get_program"))) TS_LDKFallback_SegWitProgram_get_program(uint64_t ptr) {
15225         LDKFallback *obj = (LDKFallback*)untag_ptr(ptr);
15226         assert(obj->tag == LDKFallback_SegWitProgram);
15227         LDKCVec_u8Z program_var = obj->seg_wit_program.program;
15228                         int8_tArray program_arr = init_int8_tArray(program_var.datalen, __LINE__);
15229                         memcpy(program_arr->elems, program_var.data, program_var.datalen);
15230         return program_arr;
15231 }
15232 int8_tArray __attribute__((export_name("TS_LDKFallback_PubKeyHash_get_pub_key_hash"))) TS_LDKFallback_PubKeyHash_get_pub_key_hash(uint64_t ptr) {
15233         LDKFallback *obj = (LDKFallback*)untag_ptr(ptr);
15234         assert(obj->tag == LDKFallback_PubKeyHash);
15235         int8_tArray pub_key_hash_arr = init_int8_tArray(20, __LINE__);
15236         memcpy(pub_key_hash_arr->elems, obj->pub_key_hash.data, 20);
15237         return pub_key_hash_arr;
15238 }
15239 int8_tArray __attribute__((export_name("TS_LDKFallback_ScriptHash_get_script_hash"))) TS_LDKFallback_ScriptHash_get_script_hash(uint64_t ptr) {
15240         LDKFallback *obj = (LDKFallback*)untag_ptr(ptr);
15241         assert(obj->tag == LDKFallback_ScriptHash);
15242         int8_tArray script_hash_arr = init_int8_tArray(20, __LINE__);
15243         memcpy(script_hash_arr->elems, obj->script_hash.data, 20);
15244         return script_hash_arr;
15245 }
15246 jstring  __attribute__((export_name("TS__ldk_get_compiled_version"))) TS__ldk_get_compiled_version() {
15247         LDKStr ret_str = _ldk_get_compiled_version();
15248         jstring ret_conv = str_ref_to_ts(ret_str.chars, ret_str.len);
15249         Str_free(ret_str);
15250         return ret_conv;
15251 }
15252
15253 jstring  __attribute__((export_name("TS__ldk_c_bindings_get_compiled_version"))) TS__ldk_c_bindings_get_compiled_version() {
15254         LDKStr ret_str = _ldk_c_bindings_get_compiled_version();
15255         jstring ret_conv = str_ref_to_ts(ret_str.chars, ret_str.len);
15256         Str_free(ret_str);
15257         return ret_conv;
15258 }
15259
15260 int8_tArray  __attribute__((export_name("TS_U128_le_bytes"))) TS_U128_le_bytes(int8_tArray val) {
15261         LDKU128 val_ref;
15262         CHECK(val->arr_len == 16);
15263         memcpy(val_ref.le_bytes, val->elems, 16); FREE(val);
15264         int8_tArray ret_arr = init_int8_tArray(16, __LINE__);
15265         memcpy(ret_arr->elems, U128_le_bytes(val_ref).data, 16);
15266         return ret_arr;
15267 }
15268
15269 int8_tArray  __attribute__((export_name("TS_U128_new"))) TS_U128_new(int8_tArray le_bytes) {
15270         LDKSixteenBytes le_bytes_ref;
15271         CHECK(le_bytes->arr_len == 16);
15272         memcpy(le_bytes_ref.data, le_bytes->elems, 16); FREE(le_bytes);
15273         int8_tArray ret_arr = init_int8_tArray(16, __LINE__);
15274         memcpy(ret_arr->elems, U128_new(le_bytes_ref).le_bytes, 16);
15275         return ret_arr;
15276 }
15277
15278 uint64_t  __attribute__((export_name("TS_BigEndianScalar_new"))) TS_BigEndianScalar_new(int8_tArray big_endian_bytes) {
15279         LDKThirtyTwoBytes big_endian_bytes_ref;
15280         CHECK(big_endian_bytes->arr_len == 32);
15281         memcpy(big_endian_bytes_ref.data, big_endian_bytes->elems, 32); FREE(big_endian_bytes);
15282         LDKBigEndianScalar* ret_ref = MALLOC(sizeof(LDKBigEndianScalar), "LDKBigEndianScalar");
15283         *ret_ref = BigEndianScalar_new(big_endian_bytes_ref);
15284         return tag_ptr(ret_ref, true);
15285 }
15286
15287 static inline uint64_t Bech32Error_clone_ptr(LDKBech32Error *NONNULL_PTR arg) {
15288         LDKBech32Error *ret_copy = MALLOC(sizeof(LDKBech32Error), "LDKBech32Error");
15289         *ret_copy = Bech32Error_clone(arg);
15290         uint64_t ret_ref = tag_ptr(ret_copy, true);
15291         return ret_ref;
15292 }
15293 int64_t  __attribute__((export_name("TS_Bech32Error_clone_ptr"))) TS_Bech32Error_clone_ptr(uint64_t arg) {
15294         LDKBech32Error* arg_conv = (LDKBech32Error*)untag_ptr(arg);
15295         int64_t ret_conv = Bech32Error_clone_ptr(arg_conv);
15296         return ret_conv;
15297 }
15298
15299 uint64_t  __attribute__((export_name("TS_Bech32Error_clone"))) TS_Bech32Error_clone(uint64_t orig) {
15300         LDKBech32Error* orig_conv = (LDKBech32Error*)untag_ptr(orig);
15301         LDKBech32Error *ret_copy = MALLOC(sizeof(LDKBech32Error), "LDKBech32Error");
15302         *ret_copy = Bech32Error_clone(orig_conv);
15303         uint64_t ret_ref = tag_ptr(ret_copy, true);
15304         return ret_ref;
15305 }
15306
15307 void  __attribute__((export_name("TS_Bech32Error_free"))) TS_Bech32Error_free(uint64_t o) {
15308         if (!ptr_is_owned(o)) return;
15309         void* o_ptr = untag_ptr(o);
15310         CHECK_ACCESS(o_ptr);
15311         LDKBech32Error o_conv = *(LDKBech32Error*)(o_ptr);
15312         FREE(untag_ptr(o));
15313         Bech32Error_free(o_conv);
15314 }
15315
15316 void  __attribute__((export_name("TS_Transaction_free"))) TS_Transaction_free(int8_tArray _res) {
15317         LDKTransaction _res_ref;
15318         _res_ref.datalen = _res->arr_len;
15319         _res_ref.data = MALLOC(_res_ref.datalen, "LDKTransaction Bytes");
15320         memcpy(_res_ref.data, _res->elems, _res_ref.datalen); FREE(_res);
15321         _res_ref.data_is_owned = true;
15322         Transaction_free(_res_ref);
15323 }
15324
15325 void  __attribute__((export_name("TS_Witness_free"))) TS_Witness_free(int8_tArray _res) {
15326         LDKWitness _res_ref;
15327         _res_ref.datalen = _res->arr_len;
15328         _res_ref.data = MALLOC(_res_ref.datalen, "LDKWitness Bytes");
15329         memcpy(_res_ref.data, _res->elems, _res_ref.datalen); FREE(_res);
15330         _res_ref.data_is_owned = true;
15331         Witness_free(_res_ref);
15332 }
15333
15334 void  __attribute__((export_name("TS_TxIn_free"))) TS_TxIn_free(uint64_t _res) {
15335         if (!ptr_is_owned(_res)) return;
15336         void* _res_ptr = untag_ptr(_res);
15337         CHECK_ACCESS(_res_ptr);
15338         LDKTxIn _res_conv = *(LDKTxIn*)(_res_ptr);
15339         FREE(untag_ptr(_res));
15340         TxIn_free(_res_conv);
15341 }
15342
15343 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) {
15344         LDKWitness witness_ref;
15345         witness_ref.datalen = witness->arr_len;
15346         witness_ref.data = MALLOC(witness_ref.datalen, "LDKWitness Bytes");
15347         memcpy(witness_ref.data, witness->elems, witness_ref.datalen); FREE(witness);
15348         witness_ref.data_is_owned = true;
15349         LDKCVec_u8Z script_sig_ref;
15350         script_sig_ref.datalen = script_sig->arr_len;
15351         script_sig_ref.data = MALLOC(script_sig_ref.datalen, "LDKCVec_u8Z Bytes");
15352         memcpy(script_sig_ref.data, script_sig->elems, script_sig_ref.datalen); FREE(script_sig);
15353         LDKThirtyTwoBytes previous_txid_ref;
15354         CHECK(previous_txid->arr_len == 32);
15355         memcpy(previous_txid_ref.data, previous_txid->elems, 32); FREE(previous_txid);
15356         LDKTxIn* ret_ref = MALLOC(sizeof(LDKTxIn), "LDKTxIn");
15357         *ret_ref = TxIn_new(witness_ref, script_sig_ref, sequence, previous_txid_ref, previous_vout);
15358         return tag_ptr(ret_ref, true);
15359 }
15360
15361 uint64_t  __attribute__((export_name("TS_TxOut_new"))) TS_TxOut_new(int8_tArray script_pubkey, int64_t value) {
15362         LDKCVec_u8Z script_pubkey_ref;
15363         script_pubkey_ref.datalen = script_pubkey->arr_len;
15364         script_pubkey_ref.data = MALLOC(script_pubkey_ref.datalen, "LDKCVec_u8Z Bytes");
15365         memcpy(script_pubkey_ref.data, script_pubkey->elems, script_pubkey_ref.datalen); FREE(script_pubkey);
15366         LDKTxOut* ret_ref = MALLOC(sizeof(LDKTxOut), "LDKTxOut");
15367         *ret_ref = TxOut_new(script_pubkey_ref, value);
15368         return tag_ptr(ret_ref, true);
15369 }
15370
15371 void  __attribute__((export_name("TS_TxOut_free"))) TS_TxOut_free(uint64_t _res) {
15372         if (!ptr_is_owned(_res)) return;
15373         void* _res_ptr = untag_ptr(_res);
15374         CHECK_ACCESS(_res_ptr);
15375         LDKTxOut _res_conv = *(LDKTxOut*)(_res_ptr);
15376         FREE(untag_ptr(_res));
15377         TxOut_free(_res_conv);
15378 }
15379
15380 static inline uint64_t TxOut_clone_ptr(LDKTxOut *NONNULL_PTR arg) {
15381         LDKTxOut* ret_ref = MALLOC(sizeof(LDKTxOut), "LDKTxOut");
15382         *ret_ref = TxOut_clone(arg);
15383         return tag_ptr(ret_ref, true);
15384 }
15385 int64_t  __attribute__((export_name("TS_TxOut_clone_ptr"))) TS_TxOut_clone_ptr(uint64_t arg) {
15386         LDKTxOut* arg_conv = (LDKTxOut*)untag_ptr(arg);
15387         int64_t ret_conv = TxOut_clone_ptr(arg_conv);
15388         return ret_conv;
15389 }
15390
15391 uint64_t  __attribute__((export_name("TS_TxOut_clone"))) TS_TxOut_clone(uint64_t orig) {
15392         LDKTxOut* orig_conv = (LDKTxOut*)untag_ptr(orig);
15393         LDKTxOut* ret_ref = MALLOC(sizeof(LDKTxOut), "LDKTxOut");
15394         *ret_ref = TxOut_clone(orig_conv);
15395         return tag_ptr(ret_ref, true);
15396 }
15397
15398 void  __attribute__((export_name("TS_Str_free"))) TS_Str_free(jstring _res) {
15399         LDKStr dummy = { .chars = NULL, .len = 0, .chars_is_owned = false };
15400         Str_free(dummy);
15401 }
15402
15403 uint64_t  __attribute__((export_name("TS_COption_u64Z_some"))) TS_COption_u64Z_some(int64_t o) {
15404         LDKCOption_u64Z *ret_copy = MALLOC(sizeof(LDKCOption_u64Z), "LDKCOption_u64Z");
15405         *ret_copy = COption_u64Z_some(o);
15406         uint64_t ret_ref = tag_ptr(ret_copy, true);
15407         return ret_ref;
15408 }
15409
15410 uint64_t  __attribute__((export_name("TS_COption_u64Z_none"))) TS_COption_u64Z_none() {
15411         LDKCOption_u64Z *ret_copy = MALLOC(sizeof(LDKCOption_u64Z), "LDKCOption_u64Z");
15412         *ret_copy = COption_u64Z_none();
15413         uint64_t ret_ref = tag_ptr(ret_copy, true);
15414         return ret_ref;
15415 }
15416
15417 void  __attribute__((export_name("TS_COption_u64Z_free"))) TS_COption_u64Z_free(uint64_t _res) {
15418         if (!ptr_is_owned(_res)) return;
15419         void* _res_ptr = untag_ptr(_res);
15420         CHECK_ACCESS(_res_ptr);
15421         LDKCOption_u64Z _res_conv = *(LDKCOption_u64Z*)(_res_ptr);
15422         FREE(untag_ptr(_res));
15423         COption_u64Z_free(_res_conv);
15424 }
15425
15426 static inline uint64_t COption_u64Z_clone_ptr(LDKCOption_u64Z *NONNULL_PTR arg) {
15427         LDKCOption_u64Z *ret_copy = MALLOC(sizeof(LDKCOption_u64Z), "LDKCOption_u64Z");
15428         *ret_copy = COption_u64Z_clone(arg);
15429         uint64_t ret_ref = tag_ptr(ret_copy, true);
15430         return ret_ref;
15431 }
15432 int64_t  __attribute__((export_name("TS_COption_u64Z_clone_ptr"))) TS_COption_u64Z_clone_ptr(uint64_t arg) {
15433         LDKCOption_u64Z* arg_conv = (LDKCOption_u64Z*)untag_ptr(arg);
15434         int64_t ret_conv = COption_u64Z_clone_ptr(arg_conv);
15435         return ret_conv;
15436 }
15437
15438 uint64_t  __attribute__((export_name("TS_COption_u64Z_clone"))) TS_COption_u64Z_clone(uint64_t orig) {
15439         LDKCOption_u64Z* orig_conv = (LDKCOption_u64Z*)untag_ptr(orig);
15440         LDKCOption_u64Z *ret_copy = MALLOC(sizeof(LDKCOption_u64Z), "LDKCOption_u64Z");
15441         *ret_copy = COption_u64Z_clone(orig_conv);
15442         uint64_t ret_ref = tag_ptr(ret_copy, true);
15443         return ret_ref;
15444 }
15445
15446 void  __attribute__((export_name("TS_CVec_BlindedPathZ_free"))) TS_CVec_BlindedPathZ_free(uint64_tArray _res) {
15447         LDKCVec_BlindedPathZ _res_constr;
15448         _res_constr.datalen = _res->arr_len;
15449         if (_res_constr.datalen > 0)
15450                 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKBlindedPath), "LDKCVec_BlindedPathZ Elements");
15451         else
15452                 _res_constr.data = NULL;
15453         uint64_t* _res_vals = _res->elems;
15454         for (size_t n = 0; n < _res_constr.datalen; n++) {
15455                 uint64_t _res_conv_13 = _res_vals[n];
15456                 LDKBlindedPath _res_conv_13_conv;
15457                 _res_conv_13_conv.inner = untag_ptr(_res_conv_13);
15458                 _res_conv_13_conv.is_owned = ptr_is_owned(_res_conv_13);
15459                 CHECK_INNER_FIELD_ACCESS_OR_NULL(_res_conv_13_conv);
15460                 _res_constr.data[n] = _res_conv_13_conv;
15461         }
15462         FREE(_res);
15463         CVec_BlindedPathZ_free(_res_constr);
15464 }
15465
15466 uint64_t  __attribute__((export_name("TS_CResult_RefundBolt12ParseErrorZ_ok"))) TS_CResult_RefundBolt12ParseErrorZ_ok(uint64_t o) {
15467         LDKRefund o_conv;
15468         o_conv.inner = untag_ptr(o);
15469         o_conv.is_owned = ptr_is_owned(o);
15470         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
15471         o_conv = Refund_clone(&o_conv);
15472         LDKCResult_RefundBolt12ParseErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RefundBolt12ParseErrorZ), "LDKCResult_RefundBolt12ParseErrorZ");
15473         *ret_conv = CResult_RefundBolt12ParseErrorZ_ok(o_conv);
15474         return tag_ptr(ret_conv, true);
15475 }
15476
15477 uint64_t  __attribute__((export_name("TS_CResult_RefundBolt12ParseErrorZ_err"))) TS_CResult_RefundBolt12ParseErrorZ_err(uint64_t e) {
15478         LDKBolt12ParseError e_conv;
15479         e_conv.inner = untag_ptr(e);
15480         e_conv.is_owned = ptr_is_owned(e);
15481         CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
15482         e_conv = Bolt12ParseError_clone(&e_conv);
15483         LDKCResult_RefundBolt12ParseErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RefundBolt12ParseErrorZ), "LDKCResult_RefundBolt12ParseErrorZ");
15484         *ret_conv = CResult_RefundBolt12ParseErrorZ_err(e_conv);
15485         return tag_ptr(ret_conv, true);
15486 }
15487
15488 jboolean  __attribute__((export_name("TS_CResult_RefundBolt12ParseErrorZ_is_ok"))) TS_CResult_RefundBolt12ParseErrorZ_is_ok(uint64_t o) {
15489         LDKCResult_RefundBolt12ParseErrorZ* o_conv = (LDKCResult_RefundBolt12ParseErrorZ*)untag_ptr(o);
15490         jboolean ret_conv = CResult_RefundBolt12ParseErrorZ_is_ok(o_conv);
15491         return ret_conv;
15492 }
15493
15494 void  __attribute__((export_name("TS_CResult_RefundBolt12ParseErrorZ_free"))) TS_CResult_RefundBolt12ParseErrorZ_free(uint64_t _res) {
15495         if (!ptr_is_owned(_res)) return;
15496         void* _res_ptr = untag_ptr(_res);
15497         CHECK_ACCESS(_res_ptr);
15498         LDKCResult_RefundBolt12ParseErrorZ _res_conv = *(LDKCResult_RefundBolt12ParseErrorZ*)(_res_ptr);
15499         FREE(untag_ptr(_res));
15500         CResult_RefundBolt12ParseErrorZ_free(_res_conv);
15501 }
15502
15503 static inline uint64_t CResult_RefundBolt12ParseErrorZ_clone_ptr(LDKCResult_RefundBolt12ParseErrorZ *NONNULL_PTR arg) {
15504         LDKCResult_RefundBolt12ParseErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RefundBolt12ParseErrorZ), "LDKCResult_RefundBolt12ParseErrorZ");
15505         *ret_conv = CResult_RefundBolt12ParseErrorZ_clone(arg);
15506         return tag_ptr(ret_conv, true);
15507 }
15508 int64_t  __attribute__((export_name("TS_CResult_RefundBolt12ParseErrorZ_clone_ptr"))) TS_CResult_RefundBolt12ParseErrorZ_clone_ptr(uint64_t arg) {
15509         LDKCResult_RefundBolt12ParseErrorZ* arg_conv = (LDKCResult_RefundBolt12ParseErrorZ*)untag_ptr(arg);
15510         int64_t ret_conv = CResult_RefundBolt12ParseErrorZ_clone_ptr(arg_conv);
15511         return ret_conv;
15512 }
15513
15514 uint64_t  __attribute__((export_name("TS_CResult_RefundBolt12ParseErrorZ_clone"))) TS_CResult_RefundBolt12ParseErrorZ_clone(uint64_t orig) {
15515         LDKCResult_RefundBolt12ParseErrorZ* orig_conv = (LDKCResult_RefundBolt12ParseErrorZ*)untag_ptr(orig);
15516         LDKCResult_RefundBolt12ParseErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RefundBolt12ParseErrorZ), "LDKCResult_RefundBolt12ParseErrorZ");
15517         *ret_conv = CResult_RefundBolt12ParseErrorZ_clone(orig_conv);
15518         return tag_ptr(ret_conv, true);
15519 }
15520
15521 uint64_t  __attribute__((export_name("TS_CResult_RetryDecodeErrorZ_ok"))) TS_CResult_RetryDecodeErrorZ_ok(uint64_t o) {
15522         void* o_ptr = untag_ptr(o);
15523         CHECK_ACCESS(o_ptr);
15524         LDKRetry o_conv = *(LDKRetry*)(o_ptr);
15525         o_conv = Retry_clone((LDKRetry*)untag_ptr(o));
15526         LDKCResult_RetryDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RetryDecodeErrorZ), "LDKCResult_RetryDecodeErrorZ");
15527         *ret_conv = CResult_RetryDecodeErrorZ_ok(o_conv);
15528         return tag_ptr(ret_conv, true);
15529 }
15530
15531 uint64_t  __attribute__((export_name("TS_CResult_RetryDecodeErrorZ_err"))) TS_CResult_RetryDecodeErrorZ_err(uint64_t e) {
15532         void* e_ptr = untag_ptr(e);
15533         CHECK_ACCESS(e_ptr);
15534         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
15535         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
15536         LDKCResult_RetryDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RetryDecodeErrorZ), "LDKCResult_RetryDecodeErrorZ");
15537         *ret_conv = CResult_RetryDecodeErrorZ_err(e_conv);
15538         return tag_ptr(ret_conv, true);
15539 }
15540
15541 jboolean  __attribute__((export_name("TS_CResult_RetryDecodeErrorZ_is_ok"))) TS_CResult_RetryDecodeErrorZ_is_ok(uint64_t o) {
15542         LDKCResult_RetryDecodeErrorZ* o_conv = (LDKCResult_RetryDecodeErrorZ*)untag_ptr(o);
15543         jboolean ret_conv = CResult_RetryDecodeErrorZ_is_ok(o_conv);
15544         return ret_conv;
15545 }
15546
15547 void  __attribute__((export_name("TS_CResult_RetryDecodeErrorZ_free"))) TS_CResult_RetryDecodeErrorZ_free(uint64_t _res) {
15548         if (!ptr_is_owned(_res)) return;
15549         void* _res_ptr = untag_ptr(_res);
15550         CHECK_ACCESS(_res_ptr);
15551         LDKCResult_RetryDecodeErrorZ _res_conv = *(LDKCResult_RetryDecodeErrorZ*)(_res_ptr);
15552         FREE(untag_ptr(_res));
15553         CResult_RetryDecodeErrorZ_free(_res_conv);
15554 }
15555
15556 static inline uint64_t CResult_RetryDecodeErrorZ_clone_ptr(LDKCResult_RetryDecodeErrorZ *NONNULL_PTR arg) {
15557         LDKCResult_RetryDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RetryDecodeErrorZ), "LDKCResult_RetryDecodeErrorZ");
15558         *ret_conv = CResult_RetryDecodeErrorZ_clone(arg);
15559         return tag_ptr(ret_conv, true);
15560 }
15561 int64_t  __attribute__((export_name("TS_CResult_RetryDecodeErrorZ_clone_ptr"))) TS_CResult_RetryDecodeErrorZ_clone_ptr(uint64_t arg) {
15562         LDKCResult_RetryDecodeErrorZ* arg_conv = (LDKCResult_RetryDecodeErrorZ*)untag_ptr(arg);
15563         int64_t ret_conv = CResult_RetryDecodeErrorZ_clone_ptr(arg_conv);
15564         return ret_conv;
15565 }
15566
15567 uint64_t  __attribute__((export_name("TS_CResult_RetryDecodeErrorZ_clone"))) TS_CResult_RetryDecodeErrorZ_clone(uint64_t orig) {
15568         LDKCResult_RetryDecodeErrorZ* orig_conv = (LDKCResult_RetryDecodeErrorZ*)untag_ptr(orig);
15569         LDKCResult_RetryDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RetryDecodeErrorZ), "LDKCResult_RetryDecodeErrorZ");
15570         *ret_conv = CResult_RetryDecodeErrorZ_clone(orig_conv);
15571         return tag_ptr(ret_conv, true);
15572 }
15573
15574 uint64_t  __attribute__((export_name("TS_CResult_NoneAPIErrorZ_ok"))) TS_CResult_NoneAPIErrorZ_ok() {
15575         LDKCResult_NoneAPIErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneAPIErrorZ), "LDKCResult_NoneAPIErrorZ");
15576         *ret_conv = CResult_NoneAPIErrorZ_ok();
15577         return tag_ptr(ret_conv, true);
15578 }
15579
15580 uint64_t  __attribute__((export_name("TS_CResult_NoneAPIErrorZ_err"))) TS_CResult_NoneAPIErrorZ_err(uint64_t e) {
15581         void* e_ptr = untag_ptr(e);
15582         CHECK_ACCESS(e_ptr);
15583         LDKAPIError e_conv = *(LDKAPIError*)(e_ptr);
15584         e_conv = APIError_clone((LDKAPIError*)untag_ptr(e));
15585         LDKCResult_NoneAPIErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneAPIErrorZ), "LDKCResult_NoneAPIErrorZ");
15586         *ret_conv = CResult_NoneAPIErrorZ_err(e_conv);
15587         return tag_ptr(ret_conv, true);
15588 }
15589
15590 jboolean  __attribute__((export_name("TS_CResult_NoneAPIErrorZ_is_ok"))) TS_CResult_NoneAPIErrorZ_is_ok(uint64_t o) {
15591         LDKCResult_NoneAPIErrorZ* o_conv = (LDKCResult_NoneAPIErrorZ*)untag_ptr(o);
15592         jboolean ret_conv = CResult_NoneAPIErrorZ_is_ok(o_conv);
15593         return ret_conv;
15594 }
15595
15596 void  __attribute__((export_name("TS_CResult_NoneAPIErrorZ_free"))) TS_CResult_NoneAPIErrorZ_free(uint64_t _res) {
15597         if (!ptr_is_owned(_res)) return;
15598         void* _res_ptr = untag_ptr(_res);
15599         CHECK_ACCESS(_res_ptr);
15600         LDKCResult_NoneAPIErrorZ _res_conv = *(LDKCResult_NoneAPIErrorZ*)(_res_ptr);
15601         FREE(untag_ptr(_res));
15602         CResult_NoneAPIErrorZ_free(_res_conv);
15603 }
15604
15605 static inline uint64_t CResult_NoneAPIErrorZ_clone_ptr(LDKCResult_NoneAPIErrorZ *NONNULL_PTR arg) {
15606         LDKCResult_NoneAPIErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneAPIErrorZ), "LDKCResult_NoneAPIErrorZ");
15607         *ret_conv = CResult_NoneAPIErrorZ_clone(arg);
15608         return tag_ptr(ret_conv, true);
15609 }
15610 int64_t  __attribute__((export_name("TS_CResult_NoneAPIErrorZ_clone_ptr"))) TS_CResult_NoneAPIErrorZ_clone_ptr(uint64_t arg) {
15611         LDKCResult_NoneAPIErrorZ* arg_conv = (LDKCResult_NoneAPIErrorZ*)untag_ptr(arg);
15612         int64_t ret_conv = CResult_NoneAPIErrorZ_clone_ptr(arg_conv);
15613         return ret_conv;
15614 }
15615
15616 uint64_t  __attribute__((export_name("TS_CResult_NoneAPIErrorZ_clone"))) TS_CResult_NoneAPIErrorZ_clone(uint64_t orig) {
15617         LDKCResult_NoneAPIErrorZ* orig_conv = (LDKCResult_NoneAPIErrorZ*)untag_ptr(orig);
15618         LDKCResult_NoneAPIErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneAPIErrorZ), "LDKCResult_NoneAPIErrorZ");
15619         *ret_conv = CResult_NoneAPIErrorZ_clone(orig_conv);
15620         return tag_ptr(ret_conv, true);
15621 }
15622
15623 void  __attribute__((export_name("TS_CVec_CResult_NoneAPIErrorZZ_free"))) TS_CVec_CResult_NoneAPIErrorZZ_free(uint64_tArray _res) {
15624         LDKCVec_CResult_NoneAPIErrorZZ _res_constr;
15625         _res_constr.datalen = _res->arr_len;
15626         if (_res_constr.datalen > 0)
15627                 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKCResult_NoneAPIErrorZ), "LDKCVec_CResult_NoneAPIErrorZZ Elements");
15628         else
15629                 _res_constr.data = NULL;
15630         uint64_t* _res_vals = _res->elems;
15631         for (size_t w = 0; w < _res_constr.datalen; w++) {
15632                 uint64_t _res_conv_22 = _res_vals[w];
15633                 void* _res_conv_22_ptr = untag_ptr(_res_conv_22);
15634                 CHECK_ACCESS(_res_conv_22_ptr);
15635                 LDKCResult_NoneAPIErrorZ _res_conv_22_conv = *(LDKCResult_NoneAPIErrorZ*)(_res_conv_22_ptr);
15636                 FREE(untag_ptr(_res_conv_22));
15637                 _res_constr.data[w] = _res_conv_22_conv;
15638         }
15639         FREE(_res);
15640         CVec_CResult_NoneAPIErrorZZ_free(_res_constr);
15641 }
15642
15643 void  __attribute__((export_name("TS_CVec_APIErrorZ_free"))) TS_CVec_APIErrorZ_free(uint64_tArray _res) {
15644         LDKCVec_APIErrorZ _res_constr;
15645         _res_constr.datalen = _res->arr_len;
15646         if (_res_constr.datalen > 0)
15647                 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKAPIError), "LDKCVec_APIErrorZ Elements");
15648         else
15649                 _res_constr.data = NULL;
15650         uint64_t* _res_vals = _res->elems;
15651         for (size_t k = 0; k < _res_constr.datalen; k++) {
15652                 uint64_t _res_conv_10 = _res_vals[k];
15653                 void* _res_conv_10_ptr = untag_ptr(_res_conv_10);
15654                 CHECK_ACCESS(_res_conv_10_ptr);
15655                 LDKAPIError _res_conv_10_conv = *(LDKAPIError*)(_res_conv_10_ptr);
15656                 FREE(untag_ptr(_res_conv_10));
15657                 _res_constr.data[k] = _res_conv_10_conv;
15658         }
15659         FREE(_res);
15660         CVec_APIErrorZ_free(_res_constr);
15661 }
15662
15663 uint64_t  __attribute__((export_name("TS_COption_ThirtyTwoBytesZ_some"))) TS_COption_ThirtyTwoBytesZ_some(int8_tArray o) {
15664         LDKThirtyTwoBytes o_ref;
15665         CHECK(o->arr_len == 32);
15666         memcpy(o_ref.data, o->elems, 32); FREE(o);
15667         LDKCOption_ThirtyTwoBytesZ *ret_copy = MALLOC(sizeof(LDKCOption_ThirtyTwoBytesZ), "LDKCOption_ThirtyTwoBytesZ");
15668         *ret_copy = COption_ThirtyTwoBytesZ_some(o_ref);
15669         uint64_t ret_ref = tag_ptr(ret_copy, true);
15670         return ret_ref;
15671 }
15672
15673 uint64_t  __attribute__((export_name("TS_COption_ThirtyTwoBytesZ_none"))) TS_COption_ThirtyTwoBytesZ_none() {
15674         LDKCOption_ThirtyTwoBytesZ *ret_copy = MALLOC(sizeof(LDKCOption_ThirtyTwoBytesZ), "LDKCOption_ThirtyTwoBytesZ");
15675         *ret_copy = COption_ThirtyTwoBytesZ_none();
15676         uint64_t ret_ref = tag_ptr(ret_copy, true);
15677         return ret_ref;
15678 }
15679
15680 void  __attribute__((export_name("TS_COption_ThirtyTwoBytesZ_free"))) TS_COption_ThirtyTwoBytesZ_free(uint64_t _res) {
15681         if (!ptr_is_owned(_res)) return;
15682         void* _res_ptr = untag_ptr(_res);
15683         CHECK_ACCESS(_res_ptr);
15684         LDKCOption_ThirtyTwoBytesZ _res_conv = *(LDKCOption_ThirtyTwoBytesZ*)(_res_ptr);
15685         FREE(untag_ptr(_res));
15686         COption_ThirtyTwoBytesZ_free(_res_conv);
15687 }
15688
15689 static inline uint64_t COption_ThirtyTwoBytesZ_clone_ptr(LDKCOption_ThirtyTwoBytesZ *NONNULL_PTR arg) {
15690         LDKCOption_ThirtyTwoBytesZ *ret_copy = MALLOC(sizeof(LDKCOption_ThirtyTwoBytesZ), "LDKCOption_ThirtyTwoBytesZ");
15691         *ret_copy = COption_ThirtyTwoBytesZ_clone(arg);
15692         uint64_t ret_ref = tag_ptr(ret_copy, true);
15693         return ret_ref;
15694 }
15695 int64_t  __attribute__((export_name("TS_COption_ThirtyTwoBytesZ_clone_ptr"))) TS_COption_ThirtyTwoBytesZ_clone_ptr(uint64_t arg) {
15696         LDKCOption_ThirtyTwoBytesZ* arg_conv = (LDKCOption_ThirtyTwoBytesZ*)untag_ptr(arg);
15697         int64_t ret_conv = COption_ThirtyTwoBytesZ_clone_ptr(arg_conv);
15698         return ret_conv;
15699 }
15700
15701 uint64_t  __attribute__((export_name("TS_COption_ThirtyTwoBytesZ_clone"))) TS_COption_ThirtyTwoBytesZ_clone(uint64_t orig) {
15702         LDKCOption_ThirtyTwoBytesZ* orig_conv = (LDKCOption_ThirtyTwoBytesZ*)untag_ptr(orig);
15703         LDKCOption_ThirtyTwoBytesZ *ret_copy = MALLOC(sizeof(LDKCOption_ThirtyTwoBytesZ), "LDKCOption_ThirtyTwoBytesZ");
15704         *ret_copy = COption_ThirtyTwoBytesZ_clone(orig_conv);
15705         uint64_t ret_ref = tag_ptr(ret_copy, true);
15706         return ret_ref;
15707 }
15708
15709 void  __attribute__((export_name("TS_CVec_u8Z_free"))) TS_CVec_u8Z_free(int8_tArray _res) {
15710         LDKCVec_u8Z _res_ref;
15711         _res_ref.datalen = _res->arr_len;
15712         _res_ref.data = MALLOC(_res_ref.datalen, "LDKCVec_u8Z Bytes");
15713         memcpy(_res_ref.data, _res->elems, _res_ref.datalen); FREE(_res);
15714         CVec_u8Z_free(_res_ref);
15715 }
15716
15717 uint64_t  __attribute__((export_name("TS_COption_CVec_u8ZZ_some"))) TS_COption_CVec_u8ZZ_some(int8_tArray o) {
15718         LDKCVec_u8Z o_ref;
15719         o_ref.datalen = o->arr_len;
15720         o_ref.data = MALLOC(o_ref.datalen, "LDKCVec_u8Z Bytes");
15721         memcpy(o_ref.data, o->elems, o_ref.datalen); FREE(o);
15722         LDKCOption_CVec_u8ZZ *ret_copy = MALLOC(sizeof(LDKCOption_CVec_u8ZZ), "LDKCOption_CVec_u8ZZ");
15723         *ret_copy = COption_CVec_u8ZZ_some(o_ref);
15724         uint64_t ret_ref = tag_ptr(ret_copy, true);
15725         return ret_ref;
15726 }
15727
15728 uint64_t  __attribute__((export_name("TS_COption_CVec_u8ZZ_none"))) TS_COption_CVec_u8ZZ_none() {
15729         LDKCOption_CVec_u8ZZ *ret_copy = MALLOC(sizeof(LDKCOption_CVec_u8ZZ), "LDKCOption_CVec_u8ZZ");
15730         *ret_copy = COption_CVec_u8ZZ_none();
15731         uint64_t ret_ref = tag_ptr(ret_copy, true);
15732         return ret_ref;
15733 }
15734
15735 void  __attribute__((export_name("TS_COption_CVec_u8ZZ_free"))) TS_COption_CVec_u8ZZ_free(uint64_t _res) {
15736         if (!ptr_is_owned(_res)) return;
15737         void* _res_ptr = untag_ptr(_res);
15738         CHECK_ACCESS(_res_ptr);
15739         LDKCOption_CVec_u8ZZ _res_conv = *(LDKCOption_CVec_u8ZZ*)(_res_ptr);
15740         FREE(untag_ptr(_res));
15741         COption_CVec_u8ZZ_free(_res_conv);
15742 }
15743
15744 static inline uint64_t COption_CVec_u8ZZ_clone_ptr(LDKCOption_CVec_u8ZZ *NONNULL_PTR arg) {
15745         LDKCOption_CVec_u8ZZ *ret_copy = MALLOC(sizeof(LDKCOption_CVec_u8ZZ), "LDKCOption_CVec_u8ZZ");
15746         *ret_copy = COption_CVec_u8ZZ_clone(arg);
15747         uint64_t ret_ref = tag_ptr(ret_copy, true);
15748         return ret_ref;
15749 }
15750 int64_t  __attribute__((export_name("TS_COption_CVec_u8ZZ_clone_ptr"))) TS_COption_CVec_u8ZZ_clone_ptr(uint64_t arg) {
15751         LDKCOption_CVec_u8ZZ* arg_conv = (LDKCOption_CVec_u8ZZ*)untag_ptr(arg);
15752         int64_t ret_conv = COption_CVec_u8ZZ_clone_ptr(arg_conv);
15753         return ret_conv;
15754 }
15755
15756 uint64_t  __attribute__((export_name("TS_COption_CVec_u8ZZ_clone"))) TS_COption_CVec_u8ZZ_clone(uint64_t orig) {
15757         LDKCOption_CVec_u8ZZ* orig_conv = (LDKCOption_CVec_u8ZZ*)untag_ptr(orig);
15758         LDKCOption_CVec_u8ZZ *ret_copy = MALLOC(sizeof(LDKCOption_CVec_u8ZZ), "LDKCOption_CVec_u8ZZ");
15759         *ret_copy = COption_CVec_u8ZZ_clone(orig_conv);
15760         uint64_t ret_ref = tag_ptr(ret_copy, true);
15761         return ret_ref;
15762 }
15763
15764 uint64_t  __attribute__((export_name("TS_CResult_RecipientOnionFieldsDecodeErrorZ_ok"))) TS_CResult_RecipientOnionFieldsDecodeErrorZ_ok(uint64_t o) {
15765         LDKRecipientOnionFields o_conv;
15766         o_conv.inner = untag_ptr(o);
15767         o_conv.is_owned = ptr_is_owned(o);
15768         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
15769         o_conv = RecipientOnionFields_clone(&o_conv);
15770         LDKCResult_RecipientOnionFieldsDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RecipientOnionFieldsDecodeErrorZ), "LDKCResult_RecipientOnionFieldsDecodeErrorZ");
15771         *ret_conv = CResult_RecipientOnionFieldsDecodeErrorZ_ok(o_conv);
15772         return tag_ptr(ret_conv, true);
15773 }
15774
15775 uint64_t  __attribute__((export_name("TS_CResult_RecipientOnionFieldsDecodeErrorZ_err"))) TS_CResult_RecipientOnionFieldsDecodeErrorZ_err(uint64_t e) {
15776         void* e_ptr = untag_ptr(e);
15777         CHECK_ACCESS(e_ptr);
15778         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
15779         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
15780         LDKCResult_RecipientOnionFieldsDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RecipientOnionFieldsDecodeErrorZ), "LDKCResult_RecipientOnionFieldsDecodeErrorZ");
15781         *ret_conv = CResult_RecipientOnionFieldsDecodeErrorZ_err(e_conv);
15782         return tag_ptr(ret_conv, true);
15783 }
15784
15785 jboolean  __attribute__((export_name("TS_CResult_RecipientOnionFieldsDecodeErrorZ_is_ok"))) TS_CResult_RecipientOnionFieldsDecodeErrorZ_is_ok(uint64_t o) {
15786         LDKCResult_RecipientOnionFieldsDecodeErrorZ* o_conv = (LDKCResult_RecipientOnionFieldsDecodeErrorZ*)untag_ptr(o);
15787         jboolean ret_conv = CResult_RecipientOnionFieldsDecodeErrorZ_is_ok(o_conv);
15788         return ret_conv;
15789 }
15790
15791 void  __attribute__((export_name("TS_CResult_RecipientOnionFieldsDecodeErrorZ_free"))) TS_CResult_RecipientOnionFieldsDecodeErrorZ_free(uint64_t _res) {
15792         if (!ptr_is_owned(_res)) return;
15793         void* _res_ptr = untag_ptr(_res);
15794         CHECK_ACCESS(_res_ptr);
15795         LDKCResult_RecipientOnionFieldsDecodeErrorZ _res_conv = *(LDKCResult_RecipientOnionFieldsDecodeErrorZ*)(_res_ptr);
15796         FREE(untag_ptr(_res));
15797         CResult_RecipientOnionFieldsDecodeErrorZ_free(_res_conv);
15798 }
15799
15800 static inline uint64_t CResult_RecipientOnionFieldsDecodeErrorZ_clone_ptr(LDKCResult_RecipientOnionFieldsDecodeErrorZ *NONNULL_PTR arg) {
15801         LDKCResult_RecipientOnionFieldsDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RecipientOnionFieldsDecodeErrorZ), "LDKCResult_RecipientOnionFieldsDecodeErrorZ");
15802         *ret_conv = CResult_RecipientOnionFieldsDecodeErrorZ_clone(arg);
15803         return tag_ptr(ret_conv, true);
15804 }
15805 int64_t  __attribute__((export_name("TS_CResult_RecipientOnionFieldsDecodeErrorZ_clone_ptr"))) TS_CResult_RecipientOnionFieldsDecodeErrorZ_clone_ptr(uint64_t arg) {
15806         LDKCResult_RecipientOnionFieldsDecodeErrorZ* arg_conv = (LDKCResult_RecipientOnionFieldsDecodeErrorZ*)untag_ptr(arg);
15807         int64_t ret_conv = CResult_RecipientOnionFieldsDecodeErrorZ_clone_ptr(arg_conv);
15808         return ret_conv;
15809 }
15810
15811 uint64_t  __attribute__((export_name("TS_CResult_RecipientOnionFieldsDecodeErrorZ_clone"))) TS_CResult_RecipientOnionFieldsDecodeErrorZ_clone(uint64_t orig) {
15812         LDKCResult_RecipientOnionFieldsDecodeErrorZ* orig_conv = (LDKCResult_RecipientOnionFieldsDecodeErrorZ*)untag_ptr(orig);
15813         LDKCResult_RecipientOnionFieldsDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RecipientOnionFieldsDecodeErrorZ), "LDKCResult_RecipientOnionFieldsDecodeErrorZ");
15814         *ret_conv = CResult_RecipientOnionFieldsDecodeErrorZ_clone(orig_conv);
15815         return tag_ptr(ret_conv, true);
15816 }
15817
15818 static inline uint64_t C2Tuple_u64CVec_u8ZZ_clone_ptr(LDKC2Tuple_u64CVec_u8ZZ *NONNULL_PTR arg) {
15819         LDKC2Tuple_u64CVec_u8ZZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_u64CVec_u8ZZ), "LDKC2Tuple_u64CVec_u8ZZ");
15820         *ret_conv = C2Tuple_u64CVec_u8ZZ_clone(arg);
15821         return tag_ptr(ret_conv, true);
15822 }
15823 int64_t  __attribute__((export_name("TS_C2Tuple_u64CVec_u8ZZ_clone_ptr"))) TS_C2Tuple_u64CVec_u8ZZ_clone_ptr(uint64_t arg) {
15824         LDKC2Tuple_u64CVec_u8ZZ* arg_conv = (LDKC2Tuple_u64CVec_u8ZZ*)untag_ptr(arg);
15825         int64_t ret_conv = C2Tuple_u64CVec_u8ZZ_clone_ptr(arg_conv);
15826         return ret_conv;
15827 }
15828
15829 uint64_t  __attribute__((export_name("TS_C2Tuple_u64CVec_u8ZZ_clone"))) TS_C2Tuple_u64CVec_u8ZZ_clone(uint64_t orig) {
15830         LDKC2Tuple_u64CVec_u8ZZ* orig_conv = (LDKC2Tuple_u64CVec_u8ZZ*)untag_ptr(orig);
15831         LDKC2Tuple_u64CVec_u8ZZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_u64CVec_u8ZZ), "LDKC2Tuple_u64CVec_u8ZZ");
15832         *ret_conv = C2Tuple_u64CVec_u8ZZ_clone(orig_conv);
15833         return tag_ptr(ret_conv, true);
15834 }
15835
15836 uint64_t  __attribute__((export_name("TS_C2Tuple_u64CVec_u8ZZ_new"))) TS_C2Tuple_u64CVec_u8ZZ_new(int64_t a, int8_tArray b) {
15837         LDKCVec_u8Z b_ref;
15838         b_ref.datalen = b->arr_len;
15839         b_ref.data = MALLOC(b_ref.datalen, "LDKCVec_u8Z Bytes");
15840         memcpy(b_ref.data, b->elems, b_ref.datalen); FREE(b);
15841         LDKC2Tuple_u64CVec_u8ZZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_u64CVec_u8ZZ), "LDKC2Tuple_u64CVec_u8ZZ");
15842         *ret_conv = C2Tuple_u64CVec_u8ZZ_new(a, b_ref);
15843         return tag_ptr(ret_conv, true);
15844 }
15845
15846 void  __attribute__((export_name("TS_C2Tuple_u64CVec_u8ZZ_free"))) TS_C2Tuple_u64CVec_u8ZZ_free(uint64_t _res) {
15847         if (!ptr_is_owned(_res)) return;
15848         void* _res_ptr = untag_ptr(_res);
15849         CHECK_ACCESS(_res_ptr);
15850         LDKC2Tuple_u64CVec_u8ZZ _res_conv = *(LDKC2Tuple_u64CVec_u8ZZ*)(_res_ptr);
15851         FREE(untag_ptr(_res));
15852         C2Tuple_u64CVec_u8ZZ_free(_res_conv);
15853 }
15854
15855 void  __attribute__((export_name("TS_CVec_C2Tuple_u64CVec_u8ZZZ_free"))) TS_CVec_C2Tuple_u64CVec_u8ZZZ_free(uint64_tArray _res) {
15856         LDKCVec_C2Tuple_u64CVec_u8ZZZ _res_constr;
15857         _res_constr.datalen = _res->arr_len;
15858         if (_res_constr.datalen > 0)
15859                 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKC2Tuple_u64CVec_u8ZZ), "LDKCVec_C2Tuple_u64CVec_u8ZZZ Elements");
15860         else
15861                 _res_constr.data = NULL;
15862         uint64_t* _res_vals = _res->elems;
15863         for (size_t x = 0; x < _res_constr.datalen; x++) {
15864                 uint64_t _res_conv_23 = _res_vals[x];
15865                 void* _res_conv_23_ptr = untag_ptr(_res_conv_23);
15866                 CHECK_ACCESS(_res_conv_23_ptr);
15867                 LDKC2Tuple_u64CVec_u8ZZ _res_conv_23_conv = *(LDKC2Tuple_u64CVec_u8ZZ*)(_res_conv_23_ptr);
15868                 FREE(untag_ptr(_res_conv_23));
15869                 _res_constr.data[x] = _res_conv_23_conv;
15870         }
15871         FREE(_res);
15872         CVec_C2Tuple_u64CVec_u8ZZZ_free(_res_constr);
15873 }
15874
15875 uint64_t  __attribute__((export_name("TS_CResult_RecipientOnionFieldsNoneZ_ok"))) TS_CResult_RecipientOnionFieldsNoneZ_ok(uint64_t o) {
15876         LDKRecipientOnionFields o_conv;
15877         o_conv.inner = untag_ptr(o);
15878         o_conv.is_owned = ptr_is_owned(o);
15879         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
15880         o_conv = RecipientOnionFields_clone(&o_conv);
15881         LDKCResult_RecipientOnionFieldsNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_RecipientOnionFieldsNoneZ), "LDKCResult_RecipientOnionFieldsNoneZ");
15882         *ret_conv = CResult_RecipientOnionFieldsNoneZ_ok(o_conv);
15883         return tag_ptr(ret_conv, true);
15884 }
15885
15886 uint64_t  __attribute__((export_name("TS_CResult_RecipientOnionFieldsNoneZ_err"))) TS_CResult_RecipientOnionFieldsNoneZ_err() {
15887         LDKCResult_RecipientOnionFieldsNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_RecipientOnionFieldsNoneZ), "LDKCResult_RecipientOnionFieldsNoneZ");
15888         *ret_conv = CResult_RecipientOnionFieldsNoneZ_err();
15889         return tag_ptr(ret_conv, true);
15890 }
15891
15892 jboolean  __attribute__((export_name("TS_CResult_RecipientOnionFieldsNoneZ_is_ok"))) TS_CResult_RecipientOnionFieldsNoneZ_is_ok(uint64_t o) {
15893         LDKCResult_RecipientOnionFieldsNoneZ* o_conv = (LDKCResult_RecipientOnionFieldsNoneZ*)untag_ptr(o);
15894         jboolean ret_conv = CResult_RecipientOnionFieldsNoneZ_is_ok(o_conv);
15895         return ret_conv;
15896 }
15897
15898 void  __attribute__((export_name("TS_CResult_RecipientOnionFieldsNoneZ_free"))) TS_CResult_RecipientOnionFieldsNoneZ_free(uint64_t _res) {
15899         if (!ptr_is_owned(_res)) return;
15900         void* _res_ptr = untag_ptr(_res);
15901         CHECK_ACCESS(_res_ptr);
15902         LDKCResult_RecipientOnionFieldsNoneZ _res_conv = *(LDKCResult_RecipientOnionFieldsNoneZ*)(_res_ptr);
15903         FREE(untag_ptr(_res));
15904         CResult_RecipientOnionFieldsNoneZ_free(_res_conv);
15905 }
15906
15907 static inline uint64_t CResult_RecipientOnionFieldsNoneZ_clone_ptr(LDKCResult_RecipientOnionFieldsNoneZ *NONNULL_PTR arg) {
15908         LDKCResult_RecipientOnionFieldsNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_RecipientOnionFieldsNoneZ), "LDKCResult_RecipientOnionFieldsNoneZ");
15909         *ret_conv = CResult_RecipientOnionFieldsNoneZ_clone(arg);
15910         return tag_ptr(ret_conv, true);
15911 }
15912 int64_t  __attribute__((export_name("TS_CResult_RecipientOnionFieldsNoneZ_clone_ptr"))) TS_CResult_RecipientOnionFieldsNoneZ_clone_ptr(uint64_t arg) {
15913         LDKCResult_RecipientOnionFieldsNoneZ* arg_conv = (LDKCResult_RecipientOnionFieldsNoneZ*)untag_ptr(arg);
15914         int64_t ret_conv = CResult_RecipientOnionFieldsNoneZ_clone_ptr(arg_conv);
15915         return ret_conv;
15916 }
15917
15918 uint64_t  __attribute__((export_name("TS_CResult_RecipientOnionFieldsNoneZ_clone"))) TS_CResult_RecipientOnionFieldsNoneZ_clone(uint64_t orig) {
15919         LDKCResult_RecipientOnionFieldsNoneZ* orig_conv = (LDKCResult_RecipientOnionFieldsNoneZ*)untag_ptr(orig);
15920         LDKCResult_RecipientOnionFieldsNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_RecipientOnionFieldsNoneZ), "LDKCResult_RecipientOnionFieldsNoneZ");
15921         *ret_conv = CResult_RecipientOnionFieldsNoneZ_clone(orig_conv);
15922         return tag_ptr(ret_conv, true);
15923 }
15924
15925 void  __attribute__((export_name("TS_CVec_ThirtyTwoBytesZ_free"))) TS_CVec_ThirtyTwoBytesZ_free(ptrArray _res) {
15926         LDKCVec_ThirtyTwoBytesZ _res_constr;
15927         _res_constr.datalen = _res->arr_len;
15928         if (_res_constr.datalen > 0)
15929                 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKThirtyTwoBytes), "LDKCVec_ThirtyTwoBytesZ Elements");
15930         else
15931                 _res_constr.data = NULL;
15932         int8_tArray* _res_vals = (void*) _res->elems;
15933         for (size_t m = 0; m < _res_constr.datalen; m++) {
15934                 int8_tArray _res_conv_12 = _res_vals[m];
15935                 LDKThirtyTwoBytes _res_conv_12_ref;
15936                 CHECK(_res_conv_12->arr_len == 32);
15937                 memcpy(_res_conv_12_ref.data, _res_conv_12->elems, 32); FREE(_res_conv_12);
15938                 _res_constr.data[m] = _res_conv_12_ref;
15939         }
15940         FREE(_res);
15941         CVec_ThirtyTwoBytesZ_free(_res_constr);
15942 }
15943
15944 uint64_t  __attribute__((export_name("TS_COption_CVec_ThirtyTwoBytesZZ_some"))) TS_COption_CVec_ThirtyTwoBytesZZ_some(ptrArray o) {
15945         LDKCVec_ThirtyTwoBytesZ o_constr;
15946         o_constr.datalen = o->arr_len;
15947         if (o_constr.datalen > 0)
15948                 o_constr.data = MALLOC(o_constr.datalen * sizeof(LDKThirtyTwoBytes), "LDKCVec_ThirtyTwoBytesZ Elements");
15949         else
15950                 o_constr.data = NULL;
15951         int8_tArray* o_vals = (void*) o->elems;
15952         for (size_t m = 0; m < o_constr.datalen; m++) {
15953                 int8_tArray o_conv_12 = o_vals[m];
15954                 LDKThirtyTwoBytes o_conv_12_ref;
15955                 CHECK(o_conv_12->arr_len == 32);
15956                 memcpy(o_conv_12_ref.data, o_conv_12->elems, 32); FREE(o_conv_12);
15957                 o_constr.data[m] = o_conv_12_ref;
15958         }
15959         FREE(o);
15960         LDKCOption_CVec_ThirtyTwoBytesZZ *ret_copy = MALLOC(sizeof(LDKCOption_CVec_ThirtyTwoBytesZZ), "LDKCOption_CVec_ThirtyTwoBytesZZ");
15961         *ret_copy = COption_CVec_ThirtyTwoBytesZZ_some(o_constr);
15962         uint64_t ret_ref = tag_ptr(ret_copy, true);
15963         return ret_ref;
15964 }
15965
15966 uint64_t  __attribute__((export_name("TS_COption_CVec_ThirtyTwoBytesZZ_none"))) TS_COption_CVec_ThirtyTwoBytesZZ_none() {
15967         LDKCOption_CVec_ThirtyTwoBytesZZ *ret_copy = MALLOC(sizeof(LDKCOption_CVec_ThirtyTwoBytesZZ), "LDKCOption_CVec_ThirtyTwoBytesZZ");
15968         *ret_copy = COption_CVec_ThirtyTwoBytesZZ_none();
15969         uint64_t ret_ref = tag_ptr(ret_copy, true);
15970         return ret_ref;
15971 }
15972
15973 void  __attribute__((export_name("TS_COption_CVec_ThirtyTwoBytesZZ_free"))) TS_COption_CVec_ThirtyTwoBytesZZ_free(uint64_t _res) {
15974         if (!ptr_is_owned(_res)) return;
15975         void* _res_ptr = untag_ptr(_res);
15976         CHECK_ACCESS(_res_ptr);
15977         LDKCOption_CVec_ThirtyTwoBytesZZ _res_conv = *(LDKCOption_CVec_ThirtyTwoBytesZZ*)(_res_ptr);
15978         FREE(untag_ptr(_res));
15979         COption_CVec_ThirtyTwoBytesZZ_free(_res_conv);
15980 }
15981
15982 static inline uint64_t COption_CVec_ThirtyTwoBytesZZ_clone_ptr(LDKCOption_CVec_ThirtyTwoBytesZZ *NONNULL_PTR arg) {
15983         LDKCOption_CVec_ThirtyTwoBytesZZ *ret_copy = MALLOC(sizeof(LDKCOption_CVec_ThirtyTwoBytesZZ), "LDKCOption_CVec_ThirtyTwoBytesZZ");
15984         *ret_copy = COption_CVec_ThirtyTwoBytesZZ_clone(arg);
15985         uint64_t ret_ref = tag_ptr(ret_copy, true);
15986         return ret_ref;
15987 }
15988 int64_t  __attribute__((export_name("TS_COption_CVec_ThirtyTwoBytesZZ_clone_ptr"))) TS_COption_CVec_ThirtyTwoBytesZZ_clone_ptr(uint64_t arg) {
15989         LDKCOption_CVec_ThirtyTwoBytesZZ* arg_conv = (LDKCOption_CVec_ThirtyTwoBytesZZ*)untag_ptr(arg);
15990         int64_t ret_conv = COption_CVec_ThirtyTwoBytesZZ_clone_ptr(arg_conv);
15991         return ret_conv;
15992 }
15993
15994 uint64_t  __attribute__((export_name("TS_COption_CVec_ThirtyTwoBytesZZ_clone"))) TS_COption_CVec_ThirtyTwoBytesZZ_clone(uint64_t orig) {
15995         LDKCOption_CVec_ThirtyTwoBytesZZ* orig_conv = (LDKCOption_CVec_ThirtyTwoBytesZZ*)untag_ptr(orig);
15996         LDKCOption_CVec_ThirtyTwoBytesZZ *ret_copy = MALLOC(sizeof(LDKCOption_CVec_ThirtyTwoBytesZZ), "LDKCOption_CVec_ThirtyTwoBytesZZ");
15997         *ret_copy = COption_CVec_ThirtyTwoBytesZZ_clone(orig_conv);
15998         uint64_t ret_ref = tag_ptr(ret_copy, true);
15999         return ret_ref;
16000 }
16001
16002 uint64_t  __attribute__((export_name("TS_CResult_ThirtyTwoBytesNoneZ_ok"))) TS_CResult_ThirtyTwoBytesNoneZ_ok(int8_tArray o) {
16003         LDKThirtyTwoBytes o_ref;
16004         CHECK(o->arr_len == 32);
16005         memcpy(o_ref.data, o->elems, 32); FREE(o);
16006         LDKCResult_ThirtyTwoBytesNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_ThirtyTwoBytesNoneZ), "LDKCResult_ThirtyTwoBytesNoneZ");
16007         *ret_conv = CResult_ThirtyTwoBytesNoneZ_ok(o_ref);
16008         return tag_ptr(ret_conv, true);
16009 }
16010
16011 uint64_t  __attribute__((export_name("TS_CResult_ThirtyTwoBytesNoneZ_err"))) TS_CResult_ThirtyTwoBytesNoneZ_err() {
16012         LDKCResult_ThirtyTwoBytesNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_ThirtyTwoBytesNoneZ), "LDKCResult_ThirtyTwoBytesNoneZ");
16013         *ret_conv = CResult_ThirtyTwoBytesNoneZ_err();
16014         return tag_ptr(ret_conv, true);
16015 }
16016
16017 jboolean  __attribute__((export_name("TS_CResult_ThirtyTwoBytesNoneZ_is_ok"))) TS_CResult_ThirtyTwoBytesNoneZ_is_ok(uint64_t o) {
16018         LDKCResult_ThirtyTwoBytesNoneZ* o_conv = (LDKCResult_ThirtyTwoBytesNoneZ*)untag_ptr(o);
16019         jboolean ret_conv = CResult_ThirtyTwoBytesNoneZ_is_ok(o_conv);
16020         return ret_conv;
16021 }
16022
16023 void  __attribute__((export_name("TS_CResult_ThirtyTwoBytesNoneZ_free"))) TS_CResult_ThirtyTwoBytesNoneZ_free(uint64_t _res) {
16024         if (!ptr_is_owned(_res)) return;
16025         void* _res_ptr = untag_ptr(_res);
16026         CHECK_ACCESS(_res_ptr);
16027         LDKCResult_ThirtyTwoBytesNoneZ _res_conv = *(LDKCResult_ThirtyTwoBytesNoneZ*)(_res_ptr);
16028         FREE(untag_ptr(_res));
16029         CResult_ThirtyTwoBytesNoneZ_free(_res_conv);
16030 }
16031
16032 static inline uint64_t CResult_ThirtyTwoBytesNoneZ_clone_ptr(LDKCResult_ThirtyTwoBytesNoneZ *NONNULL_PTR arg) {
16033         LDKCResult_ThirtyTwoBytesNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_ThirtyTwoBytesNoneZ), "LDKCResult_ThirtyTwoBytesNoneZ");
16034         *ret_conv = CResult_ThirtyTwoBytesNoneZ_clone(arg);
16035         return tag_ptr(ret_conv, true);
16036 }
16037 int64_t  __attribute__((export_name("TS_CResult_ThirtyTwoBytesNoneZ_clone_ptr"))) TS_CResult_ThirtyTwoBytesNoneZ_clone_ptr(uint64_t arg) {
16038         LDKCResult_ThirtyTwoBytesNoneZ* arg_conv = (LDKCResult_ThirtyTwoBytesNoneZ*)untag_ptr(arg);
16039         int64_t ret_conv = CResult_ThirtyTwoBytesNoneZ_clone_ptr(arg_conv);
16040         return ret_conv;
16041 }
16042
16043 uint64_t  __attribute__((export_name("TS_CResult_ThirtyTwoBytesNoneZ_clone"))) TS_CResult_ThirtyTwoBytesNoneZ_clone(uint64_t orig) {
16044         LDKCResult_ThirtyTwoBytesNoneZ* orig_conv = (LDKCResult_ThirtyTwoBytesNoneZ*)untag_ptr(orig);
16045         LDKCResult_ThirtyTwoBytesNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_ThirtyTwoBytesNoneZ), "LDKCResult_ThirtyTwoBytesNoneZ");
16046         *ret_conv = CResult_ThirtyTwoBytesNoneZ_clone(orig_conv);
16047         return tag_ptr(ret_conv, true);
16048 }
16049
16050 uint64_t  __attribute__((export_name("TS_CResult_BlindedPayInfoDecodeErrorZ_ok"))) TS_CResult_BlindedPayInfoDecodeErrorZ_ok(uint64_t o) {
16051         LDKBlindedPayInfo o_conv;
16052         o_conv.inner = untag_ptr(o);
16053         o_conv.is_owned = ptr_is_owned(o);
16054         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
16055         o_conv = BlindedPayInfo_clone(&o_conv);
16056         LDKCResult_BlindedPayInfoDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_BlindedPayInfoDecodeErrorZ), "LDKCResult_BlindedPayInfoDecodeErrorZ");
16057         *ret_conv = CResult_BlindedPayInfoDecodeErrorZ_ok(o_conv);
16058         return tag_ptr(ret_conv, true);
16059 }
16060
16061 uint64_t  __attribute__((export_name("TS_CResult_BlindedPayInfoDecodeErrorZ_err"))) TS_CResult_BlindedPayInfoDecodeErrorZ_err(uint64_t e) {
16062         void* e_ptr = untag_ptr(e);
16063         CHECK_ACCESS(e_ptr);
16064         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
16065         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
16066         LDKCResult_BlindedPayInfoDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_BlindedPayInfoDecodeErrorZ), "LDKCResult_BlindedPayInfoDecodeErrorZ");
16067         *ret_conv = CResult_BlindedPayInfoDecodeErrorZ_err(e_conv);
16068         return tag_ptr(ret_conv, true);
16069 }
16070
16071 jboolean  __attribute__((export_name("TS_CResult_BlindedPayInfoDecodeErrorZ_is_ok"))) TS_CResult_BlindedPayInfoDecodeErrorZ_is_ok(uint64_t o) {
16072         LDKCResult_BlindedPayInfoDecodeErrorZ* o_conv = (LDKCResult_BlindedPayInfoDecodeErrorZ*)untag_ptr(o);
16073         jboolean ret_conv = CResult_BlindedPayInfoDecodeErrorZ_is_ok(o_conv);
16074         return ret_conv;
16075 }
16076
16077 void  __attribute__((export_name("TS_CResult_BlindedPayInfoDecodeErrorZ_free"))) TS_CResult_BlindedPayInfoDecodeErrorZ_free(uint64_t _res) {
16078         if (!ptr_is_owned(_res)) return;
16079         void* _res_ptr = untag_ptr(_res);
16080         CHECK_ACCESS(_res_ptr);
16081         LDKCResult_BlindedPayInfoDecodeErrorZ _res_conv = *(LDKCResult_BlindedPayInfoDecodeErrorZ*)(_res_ptr);
16082         FREE(untag_ptr(_res));
16083         CResult_BlindedPayInfoDecodeErrorZ_free(_res_conv);
16084 }
16085
16086 static inline uint64_t CResult_BlindedPayInfoDecodeErrorZ_clone_ptr(LDKCResult_BlindedPayInfoDecodeErrorZ *NONNULL_PTR arg) {
16087         LDKCResult_BlindedPayInfoDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_BlindedPayInfoDecodeErrorZ), "LDKCResult_BlindedPayInfoDecodeErrorZ");
16088         *ret_conv = CResult_BlindedPayInfoDecodeErrorZ_clone(arg);
16089         return tag_ptr(ret_conv, true);
16090 }
16091 int64_t  __attribute__((export_name("TS_CResult_BlindedPayInfoDecodeErrorZ_clone_ptr"))) TS_CResult_BlindedPayInfoDecodeErrorZ_clone_ptr(uint64_t arg) {
16092         LDKCResult_BlindedPayInfoDecodeErrorZ* arg_conv = (LDKCResult_BlindedPayInfoDecodeErrorZ*)untag_ptr(arg);
16093         int64_t ret_conv = CResult_BlindedPayInfoDecodeErrorZ_clone_ptr(arg_conv);
16094         return ret_conv;
16095 }
16096
16097 uint64_t  __attribute__((export_name("TS_CResult_BlindedPayInfoDecodeErrorZ_clone"))) TS_CResult_BlindedPayInfoDecodeErrorZ_clone(uint64_t orig) {
16098         LDKCResult_BlindedPayInfoDecodeErrorZ* orig_conv = (LDKCResult_BlindedPayInfoDecodeErrorZ*)untag_ptr(orig);
16099         LDKCResult_BlindedPayInfoDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_BlindedPayInfoDecodeErrorZ), "LDKCResult_BlindedPayInfoDecodeErrorZ");
16100         *ret_conv = CResult_BlindedPayInfoDecodeErrorZ_clone(orig_conv);
16101         return tag_ptr(ret_conv, true);
16102 }
16103
16104 uint64_t  __attribute__((export_name("TS_CResult_DelayedPaymentOutputDescriptorDecodeErrorZ_ok"))) TS_CResult_DelayedPaymentOutputDescriptorDecodeErrorZ_ok(uint64_t o) {
16105         LDKDelayedPaymentOutputDescriptor o_conv;
16106         o_conv.inner = untag_ptr(o);
16107         o_conv.is_owned = ptr_is_owned(o);
16108         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
16109         o_conv = DelayedPaymentOutputDescriptor_clone(&o_conv);
16110         LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ), "LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ");
16111         *ret_conv = CResult_DelayedPaymentOutputDescriptorDecodeErrorZ_ok(o_conv);
16112         return tag_ptr(ret_conv, true);
16113 }
16114
16115 uint64_t  __attribute__((export_name("TS_CResult_DelayedPaymentOutputDescriptorDecodeErrorZ_err"))) TS_CResult_DelayedPaymentOutputDescriptorDecodeErrorZ_err(uint64_t e) {
16116         void* e_ptr = untag_ptr(e);
16117         CHECK_ACCESS(e_ptr);
16118         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
16119         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
16120         LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ), "LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ");
16121         *ret_conv = CResult_DelayedPaymentOutputDescriptorDecodeErrorZ_err(e_conv);
16122         return tag_ptr(ret_conv, true);
16123 }
16124
16125 jboolean  __attribute__((export_name("TS_CResult_DelayedPaymentOutputDescriptorDecodeErrorZ_is_ok"))) TS_CResult_DelayedPaymentOutputDescriptorDecodeErrorZ_is_ok(uint64_t o) {
16126         LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ* o_conv = (LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ*)untag_ptr(o);
16127         jboolean ret_conv = CResult_DelayedPaymentOutputDescriptorDecodeErrorZ_is_ok(o_conv);
16128         return ret_conv;
16129 }
16130
16131 void  __attribute__((export_name("TS_CResult_DelayedPaymentOutputDescriptorDecodeErrorZ_free"))) TS_CResult_DelayedPaymentOutputDescriptorDecodeErrorZ_free(uint64_t _res) {
16132         if (!ptr_is_owned(_res)) return;
16133         void* _res_ptr = untag_ptr(_res);
16134         CHECK_ACCESS(_res_ptr);
16135         LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ _res_conv = *(LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ*)(_res_ptr);
16136         FREE(untag_ptr(_res));
16137         CResult_DelayedPaymentOutputDescriptorDecodeErrorZ_free(_res_conv);
16138 }
16139
16140 static inline uint64_t CResult_DelayedPaymentOutputDescriptorDecodeErrorZ_clone_ptr(LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ *NONNULL_PTR arg) {
16141         LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ), "LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ");
16142         *ret_conv = CResult_DelayedPaymentOutputDescriptorDecodeErrorZ_clone(arg);
16143         return tag_ptr(ret_conv, true);
16144 }
16145 int64_t  __attribute__((export_name("TS_CResult_DelayedPaymentOutputDescriptorDecodeErrorZ_clone_ptr"))) TS_CResult_DelayedPaymentOutputDescriptorDecodeErrorZ_clone_ptr(uint64_t arg) {
16146         LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ* arg_conv = (LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ*)untag_ptr(arg);
16147         int64_t ret_conv = CResult_DelayedPaymentOutputDescriptorDecodeErrorZ_clone_ptr(arg_conv);
16148         return ret_conv;
16149 }
16150
16151 uint64_t  __attribute__((export_name("TS_CResult_DelayedPaymentOutputDescriptorDecodeErrorZ_clone"))) TS_CResult_DelayedPaymentOutputDescriptorDecodeErrorZ_clone(uint64_t orig) {
16152         LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ* orig_conv = (LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ*)untag_ptr(orig);
16153         LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ), "LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ");
16154         *ret_conv = CResult_DelayedPaymentOutputDescriptorDecodeErrorZ_clone(orig_conv);
16155         return tag_ptr(ret_conv, true);
16156 }
16157
16158 uint64_t  __attribute__((export_name("TS_CResult_StaticPaymentOutputDescriptorDecodeErrorZ_ok"))) TS_CResult_StaticPaymentOutputDescriptorDecodeErrorZ_ok(uint64_t o) {
16159         LDKStaticPaymentOutputDescriptor o_conv;
16160         o_conv.inner = untag_ptr(o);
16161         o_conv.is_owned = ptr_is_owned(o);
16162         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
16163         o_conv = StaticPaymentOutputDescriptor_clone(&o_conv);
16164         LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ), "LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ");
16165         *ret_conv = CResult_StaticPaymentOutputDescriptorDecodeErrorZ_ok(o_conv);
16166         return tag_ptr(ret_conv, true);
16167 }
16168
16169 uint64_t  __attribute__((export_name("TS_CResult_StaticPaymentOutputDescriptorDecodeErrorZ_err"))) TS_CResult_StaticPaymentOutputDescriptorDecodeErrorZ_err(uint64_t e) {
16170         void* e_ptr = untag_ptr(e);
16171         CHECK_ACCESS(e_ptr);
16172         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
16173         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
16174         LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ), "LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ");
16175         *ret_conv = CResult_StaticPaymentOutputDescriptorDecodeErrorZ_err(e_conv);
16176         return tag_ptr(ret_conv, true);
16177 }
16178
16179 jboolean  __attribute__((export_name("TS_CResult_StaticPaymentOutputDescriptorDecodeErrorZ_is_ok"))) TS_CResult_StaticPaymentOutputDescriptorDecodeErrorZ_is_ok(uint64_t o) {
16180         LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ* o_conv = (LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ*)untag_ptr(o);
16181         jboolean ret_conv = CResult_StaticPaymentOutputDescriptorDecodeErrorZ_is_ok(o_conv);
16182         return ret_conv;
16183 }
16184
16185 void  __attribute__((export_name("TS_CResult_StaticPaymentOutputDescriptorDecodeErrorZ_free"))) TS_CResult_StaticPaymentOutputDescriptorDecodeErrorZ_free(uint64_t _res) {
16186         if (!ptr_is_owned(_res)) return;
16187         void* _res_ptr = untag_ptr(_res);
16188         CHECK_ACCESS(_res_ptr);
16189         LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ _res_conv = *(LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ*)(_res_ptr);
16190         FREE(untag_ptr(_res));
16191         CResult_StaticPaymentOutputDescriptorDecodeErrorZ_free(_res_conv);
16192 }
16193
16194 static inline uint64_t CResult_StaticPaymentOutputDescriptorDecodeErrorZ_clone_ptr(LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ *NONNULL_PTR arg) {
16195         LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ), "LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ");
16196         *ret_conv = CResult_StaticPaymentOutputDescriptorDecodeErrorZ_clone(arg);
16197         return tag_ptr(ret_conv, true);
16198 }
16199 int64_t  __attribute__((export_name("TS_CResult_StaticPaymentOutputDescriptorDecodeErrorZ_clone_ptr"))) TS_CResult_StaticPaymentOutputDescriptorDecodeErrorZ_clone_ptr(uint64_t arg) {
16200         LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ* arg_conv = (LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ*)untag_ptr(arg);
16201         int64_t ret_conv = CResult_StaticPaymentOutputDescriptorDecodeErrorZ_clone_ptr(arg_conv);
16202         return ret_conv;
16203 }
16204
16205 uint64_t  __attribute__((export_name("TS_CResult_StaticPaymentOutputDescriptorDecodeErrorZ_clone"))) TS_CResult_StaticPaymentOutputDescriptorDecodeErrorZ_clone(uint64_t orig) {
16206         LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ* orig_conv = (LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ*)untag_ptr(orig);
16207         LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ), "LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ");
16208         *ret_conv = CResult_StaticPaymentOutputDescriptorDecodeErrorZ_clone(orig_conv);
16209         return tag_ptr(ret_conv, true);
16210 }
16211
16212 uint64_t  __attribute__((export_name("TS_CResult_SpendableOutputDescriptorDecodeErrorZ_ok"))) TS_CResult_SpendableOutputDescriptorDecodeErrorZ_ok(uint64_t o) {
16213         void* o_ptr = untag_ptr(o);
16214         CHECK_ACCESS(o_ptr);
16215         LDKSpendableOutputDescriptor o_conv = *(LDKSpendableOutputDescriptor*)(o_ptr);
16216         o_conv = SpendableOutputDescriptor_clone((LDKSpendableOutputDescriptor*)untag_ptr(o));
16217         LDKCResult_SpendableOutputDescriptorDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_SpendableOutputDescriptorDecodeErrorZ), "LDKCResult_SpendableOutputDescriptorDecodeErrorZ");
16218         *ret_conv = CResult_SpendableOutputDescriptorDecodeErrorZ_ok(o_conv);
16219         return tag_ptr(ret_conv, true);
16220 }
16221
16222 uint64_t  __attribute__((export_name("TS_CResult_SpendableOutputDescriptorDecodeErrorZ_err"))) TS_CResult_SpendableOutputDescriptorDecodeErrorZ_err(uint64_t e) {
16223         void* e_ptr = untag_ptr(e);
16224         CHECK_ACCESS(e_ptr);
16225         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
16226         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
16227         LDKCResult_SpendableOutputDescriptorDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_SpendableOutputDescriptorDecodeErrorZ), "LDKCResult_SpendableOutputDescriptorDecodeErrorZ");
16228         *ret_conv = CResult_SpendableOutputDescriptorDecodeErrorZ_err(e_conv);
16229         return tag_ptr(ret_conv, true);
16230 }
16231
16232 jboolean  __attribute__((export_name("TS_CResult_SpendableOutputDescriptorDecodeErrorZ_is_ok"))) TS_CResult_SpendableOutputDescriptorDecodeErrorZ_is_ok(uint64_t o) {
16233         LDKCResult_SpendableOutputDescriptorDecodeErrorZ* o_conv = (LDKCResult_SpendableOutputDescriptorDecodeErrorZ*)untag_ptr(o);
16234         jboolean ret_conv = CResult_SpendableOutputDescriptorDecodeErrorZ_is_ok(o_conv);
16235         return ret_conv;
16236 }
16237
16238 void  __attribute__((export_name("TS_CResult_SpendableOutputDescriptorDecodeErrorZ_free"))) TS_CResult_SpendableOutputDescriptorDecodeErrorZ_free(uint64_t _res) {
16239         if (!ptr_is_owned(_res)) return;
16240         void* _res_ptr = untag_ptr(_res);
16241         CHECK_ACCESS(_res_ptr);
16242         LDKCResult_SpendableOutputDescriptorDecodeErrorZ _res_conv = *(LDKCResult_SpendableOutputDescriptorDecodeErrorZ*)(_res_ptr);
16243         FREE(untag_ptr(_res));
16244         CResult_SpendableOutputDescriptorDecodeErrorZ_free(_res_conv);
16245 }
16246
16247 static inline uint64_t CResult_SpendableOutputDescriptorDecodeErrorZ_clone_ptr(LDKCResult_SpendableOutputDescriptorDecodeErrorZ *NONNULL_PTR arg) {
16248         LDKCResult_SpendableOutputDescriptorDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_SpendableOutputDescriptorDecodeErrorZ), "LDKCResult_SpendableOutputDescriptorDecodeErrorZ");
16249         *ret_conv = CResult_SpendableOutputDescriptorDecodeErrorZ_clone(arg);
16250         return tag_ptr(ret_conv, true);
16251 }
16252 int64_t  __attribute__((export_name("TS_CResult_SpendableOutputDescriptorDecodeErrorZ_clone_ptr"))) TS_CResult_SpendableOutputDescriptorDecodeErrorZ_clone_ptr(uint64_t arg) {
16253         LDKCResult_SpendableOutputDescriptorDecodeErrorZ* arg_conv = (LDKCResult_SpendableOutputDescriptorDecodeErrorZ*)untag_ptr(arg);
16254         int64_t ret_conv = CResult_SpendableOutputDescriptorDecodeErrorZ_clone_ptr(arg_conv);
16255         return ret_conv;
16256 }
16257
16258 uint64_t  __attribute__((export_name("TS_CResult_SpendableOutputDescriptorDecodeErrorZ_clone"))) TS_CResult_SpendableOutputDescriptorDecodeErrorZ_clone(uint64_t orig) {
16259         LDKCResult_SpendableOutputDescriptorDecodeErrorZ* orig_conv = (LDKCResult_SpendableOutputDescriptorDecodeErrorZ*)untag_ptr(orig);
16260         LDKCResult_SpendableOutputDescriptorDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_SpendableOutputDescriptorDecodeErrorZ), "LDKCResult_SpendableOutputDescriptorDecodeErrorZ");
16261         *ret_conv = CResult_SpendableOutputDescriptorDecodeErrorZ_clone(orig_conv);
16262         return tag_ptr(ret_conv, true);
16263 }
16264
16265 void  __attribute__((export_name("TS_CVec_SpendableOutputDescriptorZ_free"))) TS_CVec_SpendableOutputDescriptorZ_free(uint64_tArray _res) {
16266         LDKCVec_SpendableOutputDescriptorZ _res_constr;
16267         _res_constr.datalen = _res->arr_len;
16268         if (_res_constr.datalen > 0)
16269                 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKSpendableOutputDescriptor), "LDKCVec_SpendableOutputDescriptorZ Elements");
16270         else
16271                 _res_constr.data = NULL;
16272         uint64_t* _res_vals = _res->elems;
16273         for (size_t b = 0; b < _res_constr.datalen; b++) {
16274                 uint64_t _res_conv_27 = _res_vals[b];
16275                 void* _res_conv_27_ptr = untag_ptr(_res_conv_27);
16276                 CHECK_ACCESS(_res_conv_27_ptr);
16277                 LDKSpendableOutputDescriptor _res_conv_27_conv = *(LDKSpendableOutputDescriptor*)(_res_conv_27_ptr);
16278                 FREE(untag_ptr(_res_conv_27));
16279                 _res_constr.data[b] = _res_conv_27_conv;
16280         }
16281         FREE(_res);
16282         CVec_SpendableOutputDescriptorZ_free(_res_constr);
16283 }
16284
16285 void  __attribute__((export_name("TS_CVec_TxOutZ_free"))) TS_CVec_TxOutZ_free(uint64_tArray _res) {
16286         LDKCVec_TxOutZ _res_constr;
16287         _res_constr.datalen = _res->arr_len;
16288         if (_res_constr.datalen > 0)
16289                 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKTxOut), "LDKCVec_TxOutZ Elements");
16290         else
16291                 _res_constr.data = NULL;
16292         uint64_t* _res_vals = _res->elems;
16293         for (size_t h = 0; h < _res_constr.datalen; h++) {
16294                 uint64_t _res_conv_7 = _res_vals[h];
16295                 void* _res_conv_7_ptr = untag_ptr(_res_conv_7);
16296                 CHECK_ACCESS(_res_conv_7_ptr);
16297                 LDKTxOut _res_conv_7_conv = *(LDKTxOut*)(_res_conv_7_ptr);
16298                 FREE(untag_ptr(_res_conv_7));
16299                 _res_constr.data[h] = _res_conv_7_conv;
16300         }
16301         FREE(_res);
16302         CVec_TxOutZ_free(_res_constr);
16303 }
16304
16305 uint64_t  __attribute__((export_name("TS_COption_u32Z_some"))) TS_COption_u32Z_some(int32_t o) {
16306         LDKCOption_u32Z *ret_copy = MALLOC(sizeof(LDKCOption_u32Z), "LDKCOption_u32Z");
16307         *ret_copy = COption_u32Z_some(o);
16308         uint64_t ret_ref = tag_ptr(ret_copy, true);
16309         return ret_ref;
16310 }
16311
16312 uint64_t  __attribute__((export_name("TS_COption_u32Z_none"))) TS_COption_u32Z_none() {
16313         LDKCOption_u32Z *ret_copy = MALLOC(sizeof(LDKCOption_u32Z), "LDKCOption_u32Z");
16314         *ret_copy = COption_u32Z_none();
16315         uint64_t ret_ref = tag_ptr(ret_copy, true);
16316         return ret_ref;
16317 }
16318
16319 void  __attribute__((export_name("TS_COption_u32Z_free"))) TS_COption_u32Z_free(uint64_t _res) {
16320         if (!ptr_is_owned(_res)) return;
16321         void* _res_ptr = untag_ptr(_res);
16322         CHECK_ACCESS(_res_ptr);
16323         LDKCOption_u32Z _res_conv = *(LDKCOption_u32Z*)(_res_ptr);
16324         FREE(untag_ptr(_res));
16325         COption_u32Z_free(_res_conv);
16326 }
16327
16328 static inline uint64_t COption_u32Z_clone_ptr(LDKCOption_u32Z *NONNULL_PTR arg) {
16329         LDKCOption_u32Z *ret_copy = MALLOC(sizeof(LDKCOption_u32Z), "LDKCOption_u32Z");
16330         *ret_copy = COption_u32Z_clone(arg);
16331         uint64_t ret_ref = tag_ptr(ret_copy, true);
16332         return ret_ref;
16333 }
16334 int64_t  __attribute__((export_name("TS_COption_u32Z_clone_ptr"))) TS_COption_u32Z_clone_ptr(uint64_t arg) {
16335         LDKCOption_u32Z* arg_conv = (LDKCOption_u32Z*)untag_ptr(arg);
16336         int64_t ret_conv = COption_u32Z_clone_ptr(arg_conv);
16337         return ret_conv;
16338 }
16339
16340 uint64_t  __attribute__((export_name("TS_COption_u32Z_clone"))) TS_COption_u32Z_clone(uint64_t orig) {
16341         LDKCOption_u32Z* orig_conv = (LDKCOption_u32Z*)untag_ptr(orig);
16342         LDKCOption_u32Z *ret_copy = MALLOC(sizeof(LDKCOption_u32Z), "LDKCOption_u32Z");
16343         *ret_copy = COption_u32Z_clone(orig_conv);
16344         uint64_t ret_ref = tag_ptr(ret_copy, true);
16345         return ret_ref;
16346 }
16347
16348 static inline uint64_t C2Tuple_CVec_u8ZusizeZ_clone_ptr(LDKC2Tuple_CVec_u8ZusizeZ *NONNULL_PTR arg) {
16349         LDKC2Tuple_CVec_u8ZusizeZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_CVec_u8ZusizeZ), "LDKC2Tuple_CVec_u8ZusizeZ");
16350         *ret_conv = C2Tuple_CVec_u8ZusizeZ_clone(arg);
16351         return tag_ptr(ret_conv, true);
16352 }
16353 int64_t  __attribute__((export_name("TS_C2Tuple_CVec_u8ZusizeZ_clone_ptr"))) TS_C2Tuple_CVec_u8ZusizeZ_clone_ptr(uint64_t arg) {
16354         LDKC2Tuple_CVec_u8ZusizeZ* arg_conv = (LDKC2Tuple_CVec_u8ZusizeZ*)untag_ptr(arg);
16355         int64_t ret_conv = C2Tuple_CVec_u8ZusizeZ_clone_ptr(arg_conv);
16356         return ret_conv;
16357 }
16358
16359 uint64_t  __attribute__((export_name("TS_C2Tuple_CVec_u8ZusizeZ_clone"))) TS_C2Tuple_CVec_u8ZusizeZ_clone(uint64_t orig) {
16360         LDKC2Tuple_CVec_u8ZusizeZ* orig_conv = (LDKC2Tuple_CVec_u8ZusizeZ*)untag_ptr(orig);
16361         LDKC2Tuple_CVec_u8ZusizeZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_CVec_u8ZusizeZ), "LDKC2Tuple_CVec_u8ZusizeZ");
16362         *ret_conv = C2Tuple_CVec_u8ZusizeZ_clone(orig_conv);
16363         return tag_ptr(ret_conv, true);
16364 }
16365
16366 uint64_t  __attribute__((export_name("TS_C2Tuple_CVec_u8ZusizeZ_new"))) TS_C2Tuple_CVec_u8ZusizeZ_new(int8_tArray a, uint32_t b) {
16367         LDKCVec_u8Z a_ref;
16368         a_ref.datalen = a->arr_len;
16369         a_ref.data = MALLOC(a_ref.datalen, "LDKCVec_u8Z Bytes");
16370         memcpy(a_ref.data, a->elems, a_ref.datalen); FREE(a);
16371         LDKC2Tuple_CVec_u8ZusizeZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_CVec_u8ZusizeZ), "LDKC2Tuple_CVec_u8ZusizeZ");
16372         *ret_conv = C2Tuple_CVec_u8ZusizeZ_new(a_ref, b);
16373         return tag_ptr(ret_conv, true);
16374 }
16375
16376 void  __attribute__((export_name("TS_C2Tuple_CVec_u8ZusizeZ_free"))) TS_C2Tuple_CVec_u8ZusizeZ_free(uint64_t _res) {
16377         if (!ptr_is_owned(_res)) return;
16378         void* _res_ptr = untag_ptr(_res);
16379         CHECK_ACCESS(_res_ptr);
16380         LDKC2Tuple_CVec_u8ZusizeZ _res_conv = *(LDKC2Tuple_CVec_u8ZusizeZ*)(_res_ptr);
16381         FREE(untag_ptr(_res));
16382         C2Tuple_CVec_u8ZusizeZ_free(_res_conv);
16383 }
16384
16385 uint64_t  __attribute__((export_name("TS_CResult_C2Tuple_CVec_u8ZusizeZNoneZ_ok"))) TS_CResult_C2Tuple_CVec_u8ZusizeZNoneZ_ok(uint64_t o) {
16386         void* o_ptr = untag_ptr(o);
16387         CHECK_ACCESS(o_ptr);
16388         LDKC2Tuple_CVec_u8ZusizeZ o_conv = *(LDKC2Tuple_CVec_u8ZusizeZ*)(o_ptr);
16389         o_conv = C2Tuple_CVec_u8ZusizeZ_clone((LDKC2Tuple_CVec_u8ZusizeZ*)untag_ptr(o));
16390         LDKCResult_C2Tuple_CVec_u8ZusizeZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_CVec_u8ZusizeZNoneZ), "LDKCResult_C2Tuple_CVec_u8ZusizeZNoneZ");
16391         *ret_conv = CResult_C2Tuple_CVec_u8ZusizeZNoneZ_ok(o_conv);
16392         return tag_ptr(ret_conv, true);
16393 }
16394
16395 uint64_t  __attribute__((export_name("TS_CResult_C2Tuple_CVec_u8ZusizeZNoneZ_err"))) TS_CResult_C2Tuple_CVec_u8ZusizeZNoneZ_err() {
16396         LDKCResult_C2Tuple_CVec_u8ZusizeZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_CVec_u8ZusizeZNoneZ), "LDKCResult_C2Tuple_CVec_u8ZusizeZNoneZ");
16397         *ret_conv = CResult_C2Tuple_CVec_u8ZusizeZNoneZ_err();
16398         return tag_ptr(ret_conv, true);
16399 }
16400
16401 jboolean  __attribute__((export_name("TS_CResult_C2Tuple_CVec_u8ZusizeZNoneZ_is_ok"))) TS_CResult_C2Tuple_CVec_u8ZusizeZNoneZ_is_ok(uint64_t o) {
16402         LDKCResult_C2Tuple_CVec_u8ZusizeZNoneZ* o_conv = (LDKCResult_C2Tuple_CVec_u8ZusizeZNoneZ*)untag_ptr(o);
16403         jboolean ret_conv = CResult_C2Tuple_CVec_u8ZusizeZNoneZ_is_ok(o_conv);
16404         return ret_conv;
16405 }
16406
16407 void  __attribute__((export_name("TS_CResult_C2Tuple_CVec_u8ZusizeZNoneZ_free"))) TS_CResult_C2Tuple_CVec_u8ZusizeZNoneZ_free(uint64_t _res) {
16408         if (!ptr_is_owned(_res)) return;
16409         void* _res_ptr = untag_ptr(_res);
16410         CHECK_ACCESS(_res_ptr);
16411         LDKCResult_C2Tuple_CVec_u8ZusizeZNoneZ _res_conv = *(LDKCResult_C2Tuple_CVec_u8ZusizeZNoneZ*)(_res_ptr);
16412         FREE(untag_ptr(_res));
16413         CResult_C2Tuple_CVec_u8ZusizeZNoneZ_free(_res_conv);
16414 }
16415
16416 static inline uint64_t CResult_C2Tuple_CVec_u8ZusizeZNoneZ_clone_ptr(LDKCResult_C2Tuple_CVec_u8ZusizeZNoneZ *NONNULL_PTR arg) {
16417         LDKCResult_C2Tuple_CVec_u8ZusizeZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_CVec_u8ZusizeZNoneZ), "LDKCResult_C2Tuple_CVec_u8ZusizeZNoneZ");
16418         *ret_conv = CResult_C2Tuple_CVec_u8ZusizeZNoneZ_clone(arg);
16419         return tag_ptr(ret_conv, true);
16420 }
16421 int64_t  __attribute__((export_name("TS_CResult_C2Tuple_CVec_u8ZusizeZNoneZ_clone_ptr"))) TS_CResult_C2Tuple_CVec_u8ZusizeZNoneZ_clone_ptr(uint64_t arg) {
16422         LDKCResult_C2Tuple_CVec_u8ZusizeZNoneZ* arg_conv = (LDKCResult_C2Tuple_CVec_u8ZusizeZNoneZ*)untag_ptr(arg);
16423         int64_t ret_conv = CResult_C2Tuple_CVec_u8ZusizeZNoneZ_clone_ptr(arg_conv);
16424         return ret_conv;
16425 }
16426
16427 uint64_t  __attribute__((export_name("TS_CResult_C2Tuple_CVec_u8ZusizeZNoneZ_clone"))) TS_CResult_C2Tuple_CVec_u8ZusizeZNoneZ_clone(uint64_t orig) {
16428         LDKCResult_C2Tuple_CVec_u8ZusizeZNoneZ* orig_conv = (LDKCResult_C2Tuple_CVec_u8ZusizeZNoneZ*)untag_ptr(orig);
16429         LDKCResult_C2Tuple_CVec_u8ZusizeZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_CVec_u8ZusizeZNoneZ), "LDKCResult_C2Tuple_CVec_u8ZusizeZNoneZ");
16430         *ret_conv = CResult_C2Tuple_CVec_u8ZusizeZNoneZ_clone(orig_conv);
16431         return tag_ptr(ret_conv, true);
16432 }
16433
16434 uint64_t  __attribute__((export_name("TS_CResult_ChannelDerivationParametersDecodeErrorZ_ok"))) TS_CResult_ChannelDerivationParametersDecodeErrorZ_ok(uint64_t o) {
16435         LDKChannelDerivationParameters o_conv;
16436         o_conv.inner = untag_ptr(o);
16437         o_conv.is_owned = ptr_is_owned(o);
16438         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
16439         o_conv = ChannelDerivationParameters_clone(&o_conv);
16440         LDKCResult_ChannelDerivationParametersDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelDerivationParametersDecodeErrorZ), "LDKCResult_ChannelDerivationParametersDecodeErrorZ");
16441         *ret_conv = CResult_ChannelDerivationParametersDecodeErrorZ_ok(o_conv);
16442         return tag_ptr(ret_conv, true);
16443 }
16444
16445 uint64_t  __attribute__((export_name("TS_CResult_ChannelDerivationParametersDecodeErrorZ_err"))) TS_CResult_ChannelDerivationParametersDecodeErrorZ_err(uint64_t e) {
16446         void* e_ptr = untag_ptr(e);
16447         CHECK_ACCESS(e_ptr);
16448         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
16449         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
16450         LDKCResult_ChannelDerivationParametersDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelDerivationParametersDecodeErrorZ), "LDKCResult_ChannelDerivationParametersDecodeErrorZ");
16451         *ret_conv = CResult_ChannelDerivationParametersDecodeErrorZ_err(e_conv);
16452         return tag_ptr(ret_conv, true);
16453 }
16454
16455 jboolean  __attribute__((export_name("TS_CResult_ChannelDerivationParametersDecodeErrorZ_is_ok"))) TS_CResult_ChannelDerivationParametersDecodeErrorZ_is_ok(uint64_t o) {
16456         LDKCResult_ChannelDerivationParametersDecodeErrorZ* o_conv = (LDKCResult_ChannelDerivationParametersDecodeErrorZ*)untag_ptr(o);
16457         jboolean ret_conv = CResult_ChannelDerivationParametersDecodeErrorZ_is_ok(o_conv);
16458         return ret_conv;
16459 }
16460
16461 void  __attribute__((export_name("TS_CResult_ChannelDerivationParametersDecodeErrorZ_free"))) TS_CResult_ChannelDerivationParametersDecodeErrorZ_free(uint64_t _res) {
16462         if (!ptr_is_owned(_res)) return;
16463         void* _res_ptr = untag_ptr(_res);
16464         CHECK_ACCESS(_res_ptr);
16465         LDKCResult_ChannelDerivationParametersDecodeErrorZ _res_conv = *(LDKCResult_ChannelDerivationParametersDecodeErrorZ*)(_res_ptr);
16466         FREE(untag_ptr(_res));
16467         CResult_ChannelDerivationParametersDecodeErrorZ_free(_res_conv);
16468 }
16469
16470 static inline uint64_t CResult_ChannelDerivationParametersDecodeErrorZ_clone_ptr(LDKCResult_ChannelDerivationParametersDecodeErrorZ *NONNULL_PTR arg) {
16471         LDKCResult_ChannelDerivationParametersDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelDerivationParametersDecodeErrorZ), "LDKCResult_ChannelDerivationParametersDecodeErrorZ");
16472         *ret_conv = CResult_ChannelDerivationParametersDecodeErrorZ_clone(arg);
16473         return tag_ptr(ret_conv, true);
16474 }
16475 int64_t  __attribute__((export_name("TS_CResult_ChannelDerivationParametersDecodeErrorZ_clone_ptr"))) TS_CResult_ChannelDerivationParametersDecodeErrorZ_clone_ptr(uint64_t arg) {
16476         LDKCResult_ChannelDerivationParametersDecodeErrorZ* arg_conv = (LDKCResult_ChannelDerivationParametersDecodeErrorZ*)untag_ptr(arg);
16477         int64_t ret_conv = CResult_ChannelDerivationParametersDecodeErrorZ_clone_ptr(arg_conv);
16478         return ret_conv;
16479 }
16480
16481 uint64_t  __attribute__((export_name("TS_CResult_ChannelDerivationParametersDecodeErrorZ_clone"))) TS_CResult_ChannelDerivationParametersDecodeErrorZ_clone(uint64_t orig) {
16482         LDKCResult_ChannelDerivationParametersDecodeErrorZ* orig_conv = (LDKCResult_ChannelDerivationParametersDecodeErrorZ*)untag_ptr(orig);
16483         LDKCResult_ChannelDerivationParametersDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelDerivationParametersDecodeErrorZ), "LDKCResult_ChannelDerivationParametersDecodeErrorZ");
16484         *ret_conv = CResult_ChannelDerivationParametersDecodeErrorZ_clone(orig_conv);
16485         return tag_ptr(ret_conv, true);
16486 }
16487
16488 uint64_t  __attribute__((export_name("TS_CResult_HTLCDescriptorDecodeErrorZ_ok"))) TS_CResult_HTLCDescriptorDecodeErrorZ_ok(uint64_t o) {
16489         LDKHTLCDescriptor o_conv;
16490         o_conv.inner = untag_ptr(o);
16491         o_conv.is_owned = ptr_is_owned(o);
16492         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
16493         o_conv = HTLCDescriptor_clone(&o_conv);
16494         LDKCResult_HTLCDescriptorDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_HTLCDescriptorDecodeErrorZ), "LDKCResult_HTLCDescriptorDecodeErrorZ");
16495         *ret_conv = CResult_HTLCDescriptorDecodeErrorZ_ok(o_conv);
16496         return tag_ptr(ret_conv, true);
16497 }
16498
16499 uint64_t  __attribute__((export_name("TS_CResult_HTLCDescriptorDecodeErrorZ_err"))) TS_CResult_HTLCDescriptorDecodeErrorZ_err(uint64_t e) {
16500         void* e_ptr = untag_ptr(e);
16501         CHECK_ACCESS(e_ptr);
16502         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
16503         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
16504         LDKCResult_HTLCDescriptorDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_HTLCDescriptorDecodeErrorZ), "LDKCResult_HTLCDescriptorDecodeErrorZ");
16505         *ret_conv = CResult_HTLCDescriptorDecodeErrorZ_err(e_conv);
16506         return tag_ptr(ret_conv, true);
16507 }
16508
16509 jboolean  __attribute__((export_name("TS_CResult_HTLCDescriptorDecodeErrorZ_is_ok"))) TS_CResult_HTLCDescriptorDecodeErrorZ_is_ok(uint64_t o) {
16510         LDKCResult_HTLCDescriptorDecodeErrorZ* o_conv = (LDKCResult_HTLCDescriptorDecodeErrorZ*)untag_ptr(o);
16511         jboolean ret_conv = CResult_HTLCDescriptorDecodeErrorZ_is_ok(o_conv);
16512         return ret_conv;
16513 }
16514
16515 void  __attribute__((export_name("TS_CResult_HTLCDescriptorDecodeErrorZ_free"))) TS_CResult_HTLCDescriptorDecodeErrorZ_free(uint64_t _res) {
16516         if (!ptr_is_owned(_res)) return;
16517         void* _res_ptr = untag_ptr(_res);
16518         CHECK_ACCESS(_res_ptr);
16519         LDKCResult_HTLCDescriptorDecodeErrorZ _res_conv = *(LDKCResult_HTLCDescriptorDecodeErrorZ*)(_res_ptr);
16520         FREE(untag_ptr(_res));
16521         CResult_HTLCDescriptorDecodeErrorZ_free(_res_conv);
16522 }
16523
16524 static inline uint64_t CResult_HTLCDescriptorDecodeErrorZ_clone_ptr(LDKCResult_HTLCDescriptorDecodeErrorZ *NONNULL_PTR arg) {
16525         LDKCResult_HTLCDescriptorDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_HTLCDescriptorDecodeErrorZ), "LDKCResult_HTLCDescriptorDecodeErrorZ");
16526         *ret_conv = CResult_HTLCDescriptorDecodeErrorZ_clone(arg);
16527         return tag_ptr(ret_conv, true);
16528 }
16529 int64_t  __attribute__((export_name("TS_CResult_HTLCDescriptorDecodeErrorZ_clone_ptr"))) TS_CResult_HTLCDescriptorDecodeErrorZ_clone_ptr(uint64_t arg) {
16530         LDKCResult_HTLCDescriptorDecodeErrorZ* arg_conv = (LDKCResult_HTLCDescriptorDecodeErrorZ*)untag_ptr(arg);
16531         int64_t ret_conv = CResult_HTLCDescriptorDecodeErrorZ_clone_ptr(arg_conv);
16532         return ret_conv;
16533 }
16534
16535 uint64_t  __attribute__((export_name("TS_CResult_HTLCDescriptorDecodeErrorZ_clone"))) TS_CResult_HTLCDescriptorDecodeErrorZ_clone(uint64_t orig) {
16536         LDKCResult_HTLCDescriptorDecodeErrorZ* orig_conv = (LDKCResult_HTLCDescriptorDecodeErrorZ*)untag_ptr(orig);
16537         LDKCResult_HTLCDescriptorDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_HTLCDescriptorDecodeErrorZ), "LDKCResult_HTLCDescriptorDecodeErrorZ");
16538         *ret_conv = CResult_HTLCDescriptorDecodeErrorZ_clone(orig_conv);
16539         return tag_ptr(ret_conv, true);
16540 }
16541
16542 uint64_t  __attribute__((export_name("TS_CResult_NoneNoneZ_ok"))) TS_CResult_NoneNoneZ_ok() {
16543         LDKCResult_NoneNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneNoneZ), "LDKCResult_NoneNoneZ");
16544         *ret_conv = CResult_NoneNoneZ_ok();
16545         return tag_ptr(ret_conv, true);
16546 }
16547
16548 uint64_t  __attribute__((export_name("TS_CResult_NoneNoneZ_err"))) TS_CResult_NoneNoneZ_err() {
16549         LDKCResult_NoneNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneNoneZ), "LDKCResult_NoneNoneZ");
16550         *ret_conv = CResult_NoneNoneZ_err();
16551         return tag_ptr(ret_conv, true);
16552 }
16553
16554 jboolean  __attribute__((export_name("TS_CResult_NoneNoneZ_is_ok"))) TS_CResult_NoneNoneZ_is_ok(uint64_t o) {
16555         LDKCResult_NoneNoneZ* o_conv = (LDKCResult_NoneNoneZ*)untag_ptr(o);
16556         jboolean ret_conv = CResult_NoneNoneZ_is_ok(o_conv);
16557         return ret_conv;
16558 }
16559
16560 void  __attribute__((export_name("TS_CResult_NoneNoneZ_free"))) TS_CResult_NoneNoneZ_free(uint64_t _res) {
16561         if (!ptr_is_owned(_res)) return;
16562         void* _res_ptr = untag_ptr(_res);
16563         CHECK_ACCESS(_res_ptr);
16564         LDKCResult_NoneNoneZ _res_conv = *(LDKCResult_NoneNoneZ*)(_res_ptr);
16565         FREE(untag_ptr(_res));
16566         CResult_NoneNoneZ_free(_res_conv);
16567 }
16568
16569 static inline uint64_t CResult_NoneNoneZ_clone_ptr(LDKCResult_NoneNoneZ *NONNULL_PTR arg) {
16570         LDKCResult_NoneNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneNoneZ), "LDKCResult_NoneNoneZ");
16571         *ret_conv = CResult_NoneNoneZ_clone(arg);
16572         return tag_ptr(ret_conv, true);
16573 }
16574 int64_t  __attribute__((export_name("TS_CResult_NoneNoneZ_clone_ptr"))) TS_CResult_NoneNoneZ_clone_ptr(uint64_t arg) {
16575         LDKCResult_NoneNoneZ* arg_conv = (LDKCResult_NoneNoneZ*)untag_ptr(arg);
16576         int64_t ret_conv = CResult_NoneNoneZ_clone_ptr(arg_conv);
16577         return ret_conv;
16578 }
16579
16580 uint64_t  __attribute__((export_name("TS_CResult_NoneNoneZ_clone"))) TS_CResult_NoneNoneZ_clone(uint64_t orig) {
16581         LDKCResult_NoneNoneZ* orig_conv = (LDKCResult_NoneNoneZ*)untag_ptr(orig);
16582         LDKCResult_NoneNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneNoneZ), "LDKCResult_NoneNoneZ");
16583         *ret_conv = CResult_NoneNoneZ_clone(orig_conv);
16584         return tag_ptr(ret_conv, true);
16585 }
16586
16587 void  __attribute__((export_name("TS_CVec_ECDSASignatureZ_free"))) TS_CVec_ECDSASignatureZ_free(ptrArray _res) {
16588         LDKCVec_ECDSASignatureZ _res_constr;
16589         _res_constr.datalen = _res->arr_len;
16590         if (_res_constr.datalen > 0)
16591                 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKECDSASignature), "LDKCVec_ECDSASignatureZ Elements");
16592         else
16593                 _res_constr.data = NULL;
16594         int8_tArray* _res_vals = (void*) _res->elems;
16595         for (size_t m = 0; m < _res_constr.datalen; m++) {
16596                 int8_tArray _res_conv_12 = _res_vals[m];
16597                 LDKECDSASignature _res_conv_12_ref;
16598                 CHECK(_res_conv_12->arr_len == 64);
16599                 memcpy(_res_conv_12_ref.compact_form, _res_conv_12->elems, 64); FREE(_res_conv_12);
16600                 _res_constr.data[m] = _res_conv_12_ref;
16601         }
16602         FREE(_res);
16603         CVec_ECDSASignatureZ_free(_res_constr);
16604 }
16605
16606 static inline uint64_t C2Tuple_ECDSASignatureCVec_ECDSASignatureZZ_clone_ptr(LDKC2Tuple_ECDSASignatureCVec_ECDSASignatureZZ *NONNULL_PTR arg) {
16607         LDKC2Tuple_ECDSASignatureCVec_ECDSASignatureZZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_ECDSASignatureCVec_ECDSASignatureZZ), "LDKC2Tuple_ECDSASignatureCVec_ECDSASignatureZZ");
16608         *ret_conv = C2Tuple_ECDSASignatureCVec_ECDSASignatureZZ_clone(arg);
16609         return tag_ptr(ret_conv, true);
16610 }
16611 int64_t  __attribute__((export_name("TS_C2Tuple_ECDSASignatureCVec_ECDSASignatureZZ_clone_ptr"))) TS_C2Tuple_ECDSASignatureCVec_ECDSASignatureZZ_clone_ptr(uint64_t arg) {
16612         LDKC2Tuple_ECDSASignatureCVec_ECDSASignatureZZ* arg_conv = (LDKC2Tuple_ECDSASignatureCVec_ECDSASignatureZZ*)untag_ptr(arg);
16613         int64_t ret_conv = C2Tuple_ECDSASignatureCVec_ECDSASignatureZZ_clone_ptr(arg_conv);
16614         return ret_conv;
16615 }
16616
16617 uint64_t  __attribute__((export_name("TS_C2Tuple_ECDSASignatureCVec_ECDSASignatureZZ_clone"))) TS_C2Tuple_ECDSASignatureCVec_ECDSASignatureZZ_clone(uint64_t orig) {
16618         LDKC2Tuple_ECDSASignatureCVec_ECDSASignatureZZ* orig_conv = (LDKC2Tuple_ECDSASignatureCVec_ECDSASignatureZZ*)untag_ptr(orig);
16619         LDKC2Tuple_ECDSASignatureCVec_ECDSASignatureZZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_ECDSASignatureCVec_ECDSASignatureZZ), "LDKC2Tuple_ECDSASignatureCVec_ECDSASignatureZZ");
16620         *ret_conv = C2Tuple_ECDSASignatureCVec_ECDSASignatureZZ_clone(orig_conv);
16621         return tag_ptr(ret_conv, true);
16622 }
16623
16624 uint64_t  __attribute__((export_name("TS_C2Tuple_ECDSASignatureCVec_ECDSASignatureZZ_new"))) TS_C2Tuple_ECDSASignatureCVec_ECDSASignatureZZ_new(int8_tArray a, ptrArray b) {
16625         LDKECDSASignature a_ref;
16626         CHECK(a->arr_len == 64);
16627         memcpy(a_ref.compact_form, a->elems, 64); FREE(a);
16628         LDKCVec_ECDSASignatureZ b_constr;
16629         b_constr.datalen = b->arr_len;
16630         if (b_constr.datalen > 0)
16631                 b_constr.data = MALLOC(b_constr.datalen * sizeof(LDKECDSASignature), "LDKCVec_ECDSASignatureZ Elements");
16632         else
16633                 b_constr.data = NULL;
16634         int8_tArray* b_vals = (void*) b->elems;
16635         for (size_t m = 0; m < b_constr.datalen; m++) {
16636                 int8_tArray b_conv_12 = b_vals[m];
16637                 LDKECDSASignature b_conv_12_ref;
16638                 CHECK(b_conv_12->arr_len == 64);
16639                 memcpy(b_conv_12_ref.compact_form, b_conv_12->elems, 64); FREE(b_conv_12);
16640                 b_constr.data[m] = b_conv_12_ref;
16641         }
16642         FREE(b);
16643         LDKC2Tuple_ECDSASignatureCVec_ECDSASignatureZZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_ECDSASignatureCVec_ECDSASignatureZZ), "LDKC2Tuple_ECDSASignatureCVec_ECDSASignatureZZ");
16644         *ret_conv = C2Tuple_ECDSASignatureCVec_ECDSASignatureZZ_new(a_ref, b_constr);
16645         return tag_ptr(ret_conv, true);
16646 }
16647
16648 void  __attribute__((export_name("TS_C2Tuple_ECDSASignatureCVec_ECDSASignatureZZ_free"))) TS_C2Tuple_ECDSASignatureCVec_ECDSASignatureZZ_free(uint64_t _res) {
16649         if (!ptr_is_owned(_res)) return;
16650         void* _res_ptr = untag_ptr(_res);
16651         CHECK_ACCESS(_res_ptr);
16652         LDKC2Tuple_ECDSASignatureCVec_ECDSASignatureZZ _res_conv = *(LDKC2Tuple_ECDSASignatureCVec_ECDSASignatureZZ*)(_res_ptr);
16653         FREE(untag_ptr(_res));
16654         C2Tuple_ECDSASignatureCVec_ECDSASignatureZZ_free(_res_conv);
16655 }
16656
16657 uint64_t  __attribute__((export_name("TS_CResult_C2Tuple_ECDSASignatureCVec_ECDSASignatureZZNoneZ_ok"))) TS_CResult_C2Tuple_ECDSASignatureCVec_ECDSASignatureZZNoneZ_ok(uint64_t o) {
16658         void* o_ptr = untag_ptr(o);
16659         CHECK_ACCESS(o_ptr);
16660         LDKC2Tuple_ECDSASignatureCVec_ECDSASignatureZZ o_conv = *(LDKC2Tuple_ECDSASignatureCVec_ECDSASignatureZZ*)(o_ptr);
16661         o_conv = C2Tuple_ECDSASignatureCVec_ECDSASignatureZZ_clone((LDKC2Tuple_ECDSASignatureCVec_ECDSASignatureZZ*)untag_ptr(o));
16662         LDKCResult_C2Tuple_ECDSASignatureCVec_ECDSASignatureZZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_ECDSASignatureCVec_ECDSASignatureZZNoneZ), "LDKCResult_C2Tuple_ECDSASignatureCVec_ECDSASignatureZZNoneZ");
16663         *ret_conv = CResult_C2Tuple_ECDSASignatureCVec_ECDSASignatureZZNoneZ_ok(o_conv);
16664         return tag_ptr(ret_conv, true);
16665 }
16666
16667 uint64_t  __attribute__((export_name("TS_CResult_C2Tuple_ECDSASignatureCVec_ECDSASignatureZZNoneZ_err"))) TS_CResult_C2Tuple_ECDSASignatureCVec_ECDSASignatureZZNoneZ_err() {
16668         LDKCResult_C2Tuple_ECDSASignatureCVec_ECDSASignatureZZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_ECDSASignatureCVec_ECDSASignatureZZNoneZ), "LDKCResult_C2Tuple_ECDSASignatureCVec_ECDSASignatureZZNoneZ");
16669         *ret_conv = CResult_C2Tuple_ECDSASignatureCVec_ECDSASignatureZZNoneZ_err();
16670         return tag_ptr(ret_conv, true);
16671 }
16672
16673 jboolean  __attribute__((export_name("TS_CResult_C2Tuple_ECDSASignatureCVec_ECDSASignatureZZNoneZ_is_ok"))) TS_CResult_C2Tuple_ECDSASignatureCVec_ECDSASignatureZZNoneZ_is_ok(uint64_t o) {
16674         LDKCResult_C2Tuple_ECDSASignatureCVec_ECDSASignatureZZNoneZ* o_conv = (LDKCResult_C2Tuple_ECDSASignatureCVec_ECDSASignatureZZNoneZ*)untag_ptr(o);
16675         jboolean ret_conv = CResult_C2Tuple_ECDSASignatureCVec_ECDSASignatureZZNoneZ_is_ok(o_conv);
16676         return ret_conv;
16677 }
16678
16679 void  __attribute__((export_name("TS_CResult_C2Tuple_ECDSASignatureCVec_ECDSASignatureZZNoneZ_free"))) TS_CResult_C2Tuple_ECDSASignatureCVec_ECDSASignatureZZNoneZ_free(uint64_t _res) {
16680         if (!ptr_is_owned(_res)) return;
16681         void* _res_ptr = untag_ptr(_res);
16682         CHECK_ACCESS(_res_ptr);
16683         LDKCResult_C2Tuple_ECDSASignatureCVec_ECDSASignatureZZNoneZ _res_conv = *(LDKCResult_C2Tuple_ECDSASignatureCVec_ECDSASignatureZZNoneZ*)(_res_ptr);
16684         FREE(untag_ptr(_res));
16685         CResult_C2Tuple_ECDSASignatureCVec_ECDSASignatureZZNoneZ_free(_res_conv);
16686 }
16687
16688 static inline uint64_t CResult_C2Tuple_ECDSASignatureCVec_ECDSASignatureZZNoneZ_clone_ptr(LDKCResult_C2Tuple_ECDSASignatureCVec_ECDSASignatureZZNoneZ *NONNULL_PTR arg) {
16689         LDKCResult_C2Tuple_ECDSASignatureCVec_ECDSASignatureZZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_ECDSASignatureCVec_ECDSASignatureZZNoneZ), "LDKCResult_C2Tuple_ECDSASignatureCVec_ECDSASignatureZZNoneZ");
16690         *ret_conv = CResult_C2Tuple_ECDSASignatureCVec_ECDSASignatureZZNoneZ_clone(arg);
16691         return tag_ptr(ret_conv, true);
16692 }
16693 int64_t  __attribute__((export_name("TS_CResult_C2Tuple_ECDSASignatureCVec_ECDSASignatureZZNoneZ_clone_ptr"))) TS_CResult_C2Tuple_ECDSASignatureCVec_ECDSASignatureZZNoneZ_clone_ptr(uint64_t arg) {
16694         LDKCResult_C2Tuple_ECDSASignatureCVec_ECDSASignatureZZNoneZ* arg_conv = (LDKCResult_C2Tuple_ECDSASignatureCVec_ECDSASignatureZZNoneZ*)untag_ptr(arg);
16695         int64_t ret_conv = CResult_C2Tuple_ECDSASignatureCVec_ECDSASignatureZZNoneZ_clone_ptr(arg_conv);
16696         return ret_conv;
16697 }
16698
16699 uint64_t  __attribute__((export_name("TS_CResult_C2Tuple_ECDSASignatureCVec_ECDSASignatureZZNoneZ_clone"))) TS_CResult_C2Tuple_ECDSASignatureCVec_ECDSASignatureZZNoneZ_clone(uint64_t orig) {
16700         LDKCResult_C2Tuple_ECDSASignatureCVec_ECDSASignatureZZNoneZ* orig_conv = (LDKCResult_C2Tuple_ECDSASignatureCVec_ECDSASignatureZZNoneZ*)untag_ptr(orig);
16701         LDKCResult_C2Tuple_ECDSASignatureCVec_ECDSASignatureZZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_ECDSASignatureCVec_ECDSASignatureZZNoneZ), "LDKCResult_C2Tuple_ECDSASignatureCVec_ECDSASignatureZZNoneZ");
16702         *ret_conv = CResult_C2Tuple_ECDSASignatureCVec_ECDSASignatureZZNoneZ_clone(orig_conv);
16703         return tag_ptr(ret_conv, true);
16704 }
16705
16706 uint64_t  __attribute__((export_name("TS_CResult_ECDSASignatureNoneZ_ok"))) TS_CResult_ECDSASignatureNoneZ_ok(int8_tArray o) {
16707         LDKECDSASignature o_ref;
16708         CHECK(o->arr_len == 64);
16709         memcpy(o_ref.compact_form, o->elems, 64); FREE(o);
16710         LDKCResult_ECDSASignatureNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_ECDSASignatureNoneZ), "LDKCResult_ECDSASignatureNoneZ");
16711         *ret_conv = CResult_ECDSASignatureNoneZ_ok(o_ref);
16712         return tag_ptr(ret_conv, true);
16713 }
16714
16715 uint64_t  __attribute__((export_name("TS_CResult_ECDSASignatureNoneZ_err"))) TS_CResult_ECDSASignatureNoneZ_err() {
16716         LDKCResult_ECDSASignatureNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_ECDSASignatureNoneZ), "LDKCResult_ECDSASignatureNoneZ");
16717         *ret_conv = CResult_ECDSASignatureNoneZ_err();
16718         return tag_ptr(ret_conv, true);
16719 }
16720
16721 jboolean  __attribute__((export_name("TS_CResult_ECDSASignatureNoneZ_is_ok"))) TS_CResult_ECDSASignatureNoneZ_is_ok(uint64_t o) {
16722         LDKCResult_ECDSASignatureNoneZ* o_conv = (LDKCResult_ECDSASignatureNoneZ*)untag_ptr(o);
16723         jboolean ret_conv = CResult_ECDSASignatureNoneZ_is_ok(o_conv);
16724         return ret_conv;
16725 }
16726
16727 void  __attribute__((export_name("TS_CResult_ECDSASignatureNoneZ_free"))) TS_CResult_ECDSASignatureNoneZ_free(uint64_t _res) {
16728         if (!ptr_is_owned(_res)) return;
16729         void* _res_ptr = untag_ptr(_res);
16730         CHECK_ACCESS(_res_ptr);
16731         LDKCResult_ECDSASignatureNoneZ _res_conv = *(LDKCResult_ECDSASignatureNoneZ*)(_res_ptr);
16732         FREE(untag_ptr(_res));
16733         CResult_ECDSASignatureNoneZ_free(_res_conv);
16734 }
16735
16736 static inline uint64_t CResult_ECDSASignatureNoneZ_clone_ptr(LDKCResult_ECDSASignatureNoneZ *NONNULL_PTR arg) {
16737         LDKCResult_ECDSASignatureNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_ECDSASignatureNoneZ), "LDKCResult_ECDSASignatureNoneZ");
16738         *ret_conv = CResult_ECDSASignatureNoneZ_clone(arg);
16739         return tag_ptr(ret_conv, true);
16740 }
16741 int64_t  __attribute__((export_name("TS_CResult_ECDSASignatureNoneZ_clone_ptr"))) TS_CResult_ECDSASignatureNoneZ_clone_ptr(uint64_t arg) {
16742         LDKCResult_ECDSASignatureNoneZ* arg_conv = (LDKCResult_ECDSASignatureNoneZ*)untag_ptr(arg);
16743         int64_t ret_conv = CResult_ECDSASignatureNoneZ_clone_ptr(arg_conv);
16744         return ret_conv;
16745 }
16746
16747 uint64_t  __attribute__((export_name("TS_CResult_ECDSASignatureNoneZ_clone"))) TS_CResult_ECDSASignatureNoneZ_clone(uint64_t orig) {
16748         LDKCResult_ECDSASignatureNoneZ* orig_conv = (LDKCResult_ECDSASignatureNoneZ*)untag_ptr(orig);
16749         LDKCResult_ECDSASignatureNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_ECDSASignatureNoneZ), "LDKCResult_ECDSASignatureNoneZ");
16750         *ret_conv = CResult_ECDSASignatureNoneZ_clone(orig_conv);
16751         return tag_ptr(ret_conv, true);
16752 }
16753
16754 uint64_t  __attribute__((export_name("TS_CResult_PublicKeyNoneZ_ok"))) TS_CResult_PublicKeyNoneZ_ok(int8_tArray o) {
16755         LDKPublicKey o_ref;
16756         CHECK(o->arr_len == 33);
16757         memcpy(o_ref.compressed_form, o->elems, 33); FREE(o);
16758         LDKCResult_PublicKeyNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_PublicKeyNoneZ), "LDKCResult_PublicKeyNoneZ");
16759         *ret_conv = CResult_PublicKeyNoneZ_ok(o_ref);
16760         return tag_ptr(ret_conv, true);
16761 }
16762
16763 uint64_t  __attribute__((export_name("TS_CResult_PublicKeyNoneZ_err"))) TS_CResult_PublicKeyNoneZ_err() {
16764         LDKCResult_PublicKeyNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_PublicKeyNoneZ), "LDKCResult_PublicKeyNoneZ");
16765         *ret_conv = CResult_PublicKeyNoneZ_err();
16766         return tag_ptr(ret_conv, true);
16767 }
16768
16769 jboolean  __attribute__((export_name("TS_CResult_PublicKeyNoneZ_is_ok"))) TS_CResult_PublicKeyNoneZ_is_ok(uint64_t o) {
16770         LDKCResult_PublicKeyNoneZ* o_conv = (LDKCResult_PublicKeyNoneZ*)untag_ptr(o);
16771         jboolean ret_conv = CResult_PublicKeyNoneZ_is_ok(o_conv);
16772         return ret_conv;
16773 }
16774
16775 void  __attribute__((export_name("TS_CResult_PublicKeyNoneZ_free"))) TS_CResult_PublicKeyNoneZ_free(uint64_t _res) {
16776         if (!ptr_is_owned(_res)) return;
16777         void* _res_ptr = untag_ptr(_res);
16778         CHECK_ACCESS(_res_ptr);
16779         LDKCResult_PublicKeyNoneZ _res_conv = *(LDKCResult_PublicKeyNoneZ*)(_res_ptr);
16780         FREE(untag_ptr(_res));
16781         CResult_PublicKeyNoneZ_free(_res_conv);
16782 }
16783
16784 static inline uint64_t CResult_PublicKeyNoneZ_clone_ptr(LDKCResult_PublicKeyNoneZ *NONNULL_PTR arg) {
16785         LDKCResult_PublicKeyNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_PublicKeyNoneZ), "LDKCResult_PublicKeyNoneZ");
16786         *ret_conv = CResult_PublicKeyNoneZ_clone(arg);
16787         return tag_ptr(ret_conv, true);
16788 }
16789 int64_t  __attribute__((export_name("TS_CResult_PublicKeyNoneZ_clone_ptr"))) TS_CResult_PublicKeyNoneZ_clone_ptr(uint64_t arg) {
16790         LDKCResult_PublicKeyNoneZ* arg_conv = (LDKCResult_PublicKeyNoneZ*)untag_ptr(arg);
16791         int64_t ret_conv = CResult_PublicKeyNoneZ_clone_ptr(arg_conv);
16792         return ret_conv;
16793 }
16794
16795 uint64_t  __attribute__((export_name("TS_CResult_PublicKeyNoneZ_clone"))) TS_CResult_PublicKeyNoneZ_clone(uint64_t orig) {
16796         LDKCResult_PublicKeyNoneZ* orig_conv = (LDKCResult_PublicKeyNoneZ*)untag_ptr(orig);
16797         LDKCResult_PublicKeyNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_PublicKeyNoneZ), "LDKCResult_PublicKeyNoneZ");
16798         *ret_conv = CResult_PublicKeyNoneZ_clone(orig_conv);
16799         return tag_ptr(ret_conv, true);
16800 }
16801
16802 uint64_t  __attribute__((export_name("TS_COption_BigEndianScalarZ_some"))) TS_COption_BigEndianScalarZ_some(uint64_t o) {
16803         void* o_ptr = untag_ptr(o);
16804         CHECK_ACCESS(o_ptr);
16805         LDKBigEndianScalar o_conv = *(LDKBigEndianScalar*)(o_ptr);
16806         // WARNING: we may need a move here but no clone is available for LDKBigEndianScalar
16807         LDKCOption_BigEndianScalarZ *ret_copy = MALLOC(sizeof(LDKCOption_BigEndianScalarZ), "LDKCOption_BigEndianScalarZ");
16808         *ret_copy = COption_BigEndianScalarZ_some(o_conv);
16809         uint64_t ret_ref = tag_ptr(ret_copy, true);
16810         return ret_ref;
16811 }
16812
16813 uint64_t  __attribute__((export_name("TS_COption_BigEndianScalarZ_none"))) TS_COption_BigEndianScalarZ_none() {
16814         LDKCOption_BigEndianScalarZ *ret_copy = MALLOC(sizeof(LDKCOption_BigEndianScalarZ), "LDKCOption_BigEndianScalarZ");
16815         *ret_copy = COption_BigEndianScalarZ_none();
16816         uint64_t ret_ref = tag_ptr(ret_copy, true);
16817         return ret_ref;
16818 }
16819
16820 void  __attribute__((export_name("TS_COption_BigEndianScalarZ_free"))) TS_COption_BigEndianScalarZ_free(uint64_t _res) {
16821         if (!ptr_is_owned(_res)) return;
16822         void* _res_ptr = untag_ptr(_res);
16823         CHECK_ACCESS(_res_ptr);
16824         LDKCOption_BigEndianScalarZ _res_conv = *(LDKCOption_BigEndianScalarZ*)(_res_ptr);
16825         FREE(untag_ptr(_res));
16826         COption_BigEndianScalarZ_free(_res_conv);
16827 }
16828
16829 static inline uint64_t COption_BigEndianScalarZ_clone_ptr(LDKCOption_BigEndianScalarZ *NONNULL_PTR arg) {
16830         LDKCOption_BigEndianScalarZ *ret_copy = MALLOC(sizeof(LDKCOption_BigEndianScalarZ), "LDKCOption_BigEndianScalarZ");
16831         *ret_copy = COption_BigEndianScalarZ_clone(arg);
16832         uint64_t ret_ref = tag_ptr(ret_copy, true);
16833         return ret_ref;
16834 }
16835 int64_t  __attribute__((export_name("TS_COption_BigEndianScalarZ_clone_ptr"))) TS_COption_BigEndianScalarZ_clone_ptr(uint64_t arg) {
16836         LDKCOption_BigEndianScalarZ* arg_conv = (LDKCOption_BigEndianScalarZ*)untag_ptr(arg);
16837         int64_t ret_conv = COption_BigEndianScalarZ_clone_ptr(arg_conv);
16838         return ret_conv;
16839 }
16840
16841 uint64_t  __attribute__((export_name("TS_COption_BigEndianScalarZ_clone"))) TS_COption_BigEndianScalarZ_clone(uint64_t orig) {
16842         LDKCOption_BigEndianScalarZ* orig_conv = (LDKCOption_BigEndianScalarZ*)untag_ptr(orig);
16843         LDKCOption_BigEndianScalarZ *ret_copy = MALLOC(sizeof(LDKCOption_BigEndianScalarZ), "LDKCOption_BigEndianScalarZ");
16844         *ret_copy = COption_BigEndianScalarZ_clone(orig_conv);
16845         uint64_t ret_ref = tag_ptr(ret_copy, true);
16846         return ret_ref;
16847 }
16848
16849 void  __attribute__((export_name("TS_CVec_U5Z_free"))) TS_CVec_U5Z_free(ptrArray _res) {
16850         LDKCVec_U5Z _res_constr;
16851         _res_constr.datalen = _res->arr_len;
16852         if (_res_constr.datalen > 0)
16853                 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKU5), "LDKCVec_U5Z Elements");
16854         else
16855                 _res_constr.data = NULL;
16856         int8_t* _res_vals = (void*) _res->elems;
16857         for (size_t h = 0; h < _res_constr.datalen; h++) {
16858                 int8_t _res_conv_7 = _res_vals[h];
16859                 
16860                 _res_constr.data[h] = (LDKU5){ ._0 = _res_conv_7 };
16861         }
16862         FREE(_res);
16863         CVec_U5Z_free(_res_constr);
16864 }
16865
16866 uint64_t  __attribute__((export_name("TS_CResult_RecoverableSignatureNoneZ_ok"))) TS_CResult_RecoverableSignatureNoneZ_ok(int8_tArray o) {
16867         LDKRecoverableSignature o_ref;
16868         CHECK(o->arr_len == 68);
16869         memcpy(o_ref.serialized_form, o->elems, 68); FREE(o);
16870         LDKCResult_RecoverableSignatureNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_RecoverableSignatureNoneZ), "LDKCResult_RecoverableSignatureNoneZ");
16871         *ret_conv = CResult_RecoverableSignatureNoneZ_ok(o_ref);
16872         return tag_ptr(ret_conv, true);
16873 }
16874
16875 uint64_t  __attribute__((export_name("TS_CResult_RecoverableSignatureNoneZ_err"))) TS_CResult_RecoverableSignatureNoneZ_err() {
16876         LDKCResult_RecoverableSignatureNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_RecoverableSignatureNoneZ), "LDKCResult_RecoverableSignatureNoneZ");
16877         *ret_conv = CResult_RecoverableSignatureNoneZ_err();
16878         return tag_ptr(ret_conv, true);
16879 }
16880
16881 jboolean  __attribute__((export_name("TS_CResult_RecoverableSignatureNoneZ_is_ok"))) TS_CResult_RecoverableSignatureNoneZ_is_ok(uint64_t o) {
16882         LDKCResult_RecoverableSignatureNoneZ* o_conv = (LDKCResult_RecoverableSignatureNoneZ*)untag_ptr(o);
16883         jboolean ret_conv = CResult_RecoverableSignatureNoneZ_is_ok(o_conv);
16884         return ret_conv;
16885 }
16886
16887 void  __attribute__((export_name("TS_CResult_RecoverableSignatureNoneZ_free"))) TS_CResult_RecoverableSignatureNoneZ_free(uint64_t _res) {
16888         if (!ptr_is_owned(_res)) return;
16889         void* _res_ptr = untag_ptr(_res);
16890         CHECK_ACCESS(_res_ptr);
16891         LDKCResult_RecoverableSignatureNoneZ _res_conv = *(LDKCResult_RecoverableSignatureNoneZ*)(_res_ptr);
16892         FREE(untag_ptr(_res));
16893         CResult_RecoverableSignatureNoneZ_free(_res_conv);
16894 }
16895
16896 static inline uint64_t CResult_RecoverableSignatureNoneZ_clone_ptr(LDKCResult_RecoverableSignatureNoneZ *NONNULL_PTR arg) {
16897         LDKCResult_RecoverableSignatureNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_RecoverableSignatureNoneZ), "LDKCResult_RecoverableSignatureNoneZ");
16898         *ret_conv = CResult_RecoverableSignatureNoneZ_clone(arg);
16899         return tag_ptr(ret_conv, true);
16900 }
16901 int64_t  __attribute__((export_name("TS_CResult_RecoverableSignatureNoneZ_clone_ptr"))) TS_CResult_RecoverableSignatureNoneZ_clone_ptr(uint64_t arg) {
16902         LDKCResult_RecoverableSignatureNoneZ* arg_conv = (LDKCResult_RecoverableSignatureNoneZ*)untag_ptr(arg);
16903         int64_t ret_conv = CResult_RecoverableSignatureNoneZ_clone_ptr(arg_conv);
16904         return ret_conv;
16905 }
16906
16907 uint64_t  __attribute__((export_name("TS_CResult_RecoverableSignatureNoneZ_clone"))) TS_CResult_RecoverableSignatureNoneZ_clone(uint64_t orig) {
16908         LDKCResult_RecoverableSignatureNoneZ* orig_conv = (LDKCResult_RecoverableSignatureNoneZ*)untag_ptr(orig);
16909         LDKCResult_RecoverableSignatureNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_RecoverableSignatureNoneZ), "LDKCResult_RecoverableSignatureNoneZ");
16910         *ret_conv = CResult_RecoverableSignatureNoneZ_clone(orig_conv);
16911         return tag_ptr(ret_conv, true);
16912 }
16913
16914 uint64_t  __attribute__((export_name("TS_CResult_SchnorrSignatureNoneZ_ok"))) TS_CResult_SchnorrSignatureNoneZ_ok(int8_tArray o) {
16915         LDKSchnorrSignature o_ref;
16916         CHECK(o->arr_len == 64);
16917         memcpy(o_ref.compact_form, o->elems, 64); FREE(o);
16918         LDKCResult_SchnorrSignatureNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_SchnorrSignatureNoneZ), "LDKCResult_SchnorrSignatureNoneZ");
16919         *ret_conv = CResult_SchnorrSignatureNoneZ_ok(o_ref);
16920         return tag_ptr(ret_conv, true);
16921 }
16922
16923 uint64_t  __attribute__((export_name("TS_CResult_SchnorrSignatureNoneZ_err"))) TS_CResult_SchnorrSignatureNoneZ_err() {
16924         LDKCResult_SchnorrSignatureNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_SchnorrSignatureNoneZ), "LDKCResult_SchnorrSignatureNoneZ");
16925         *ret_conv = CResult_SchnorrSignatureNoneZ_err();
16926         return tag_ptr(ret_conv, true);
16927 }
16928
16929 jboolean  __attribute__((export_name("TS_CResult_SchnorrSignatureNoneZ_is_ok"))) TS_CResult_SchnorrSignatureNoneZ_is_ok(uint64_t o) {
16930         LDKCResult_SchnorrSignatureNoneZ* o_conv = (LDKCResult_SchnorrSignatureNoneZ*)untag_ptr(o);
16931         jboolean ret_conv = CResult_SchnorrSignatureNoneZ_is_ok(o_conv);
16932         return ret_conv;
16933 }
16934
16935 void  __attribute__((export_name("TS_CResult_SchnorrSignatureNoneZ_free"))) TS_CResult_SchnorrSignatureNoneZ_free(uint64_t _res) {
16936         if (!ptr_is_owned(_res)) return;
16937         void* _res_ptr = untag_ptr(_res);
16938         CHECK_ACCESS(_res_ptr);
16939         LDKCResult_SchnorrSignatureNoneZ _res_conv = *(LDKCResult_SchnorrSignatureNoneZ*)(_res_ptr);
16940         FREE(untag_ptr(_res));
16941         CResult_SchnorrSignatureNoneZ_free(_res_conv);
16942 }
16943
16944 static inline uint64_t CResult_SchnorrSignatureNoneZ_clone_ptr(LDKCResult_SchnorrSignatureNoneZ *NONNULL_PTR arg) {
16945         LDKCResult_SchnorrSignatureNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_SchnorrSignatureNoneZ), "LDKCResult_SchnorrSignatureNoneZ");
16946         *ret_conv = CResult_SchnorrSignatureNoneZ_clone(arg);
16947         return tag_ptr(ret_conv, true);
16948 }
16949 int64_t  __attribute__((export_name("TS_CResult_SchnorrSignatureNoneZ_clone_ptr"))) TS_CResult_SchnorrSignatureNoneZ_clone_ptr(uint64_t arg) {
16950         LDKCResult_SchnorrSignatureNoneZ* arg_conv = (LDKCResult_SchnorrSignatureNoneZ*)untag_ptr(arg);
16951         int64_t ret_conv = CResult_SchnorrSignatureNoneZ_clone_ptr(arg_conv);
16952         return ret_conv;
16953 }
16954
16955 uint64_t  __attribute__((export_name("TS_CResult_SchnorrSignatureNoneZ_clone"))) TS_CResult_SchnorrSignatureNoneZ_clone(uint64_t orig) {
16956         LDKCResult_SchnorrSignatureNoneZ* orig_conv = (LDKCResult_SchnorrSignatureNoneZ*)untag_ptr(orig);
16957         LDKCResult_SchnorrSignatureNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_SchnorrSignatureNoneZ), "LDKCResult_SchnorrSignatureNoneZ");
16958         *ret_conv = CResult_SchnorrSignatureNoneZ_clone(orig_conv);
16959         return tag_ptr(ret_conv, true);
16960 }
16961
16962 uint64_t  __attribute__((export_name("TS_CResult_WriteableEcdsaChannelSignerDecodeErrorZ_ok"))) TS_CResult_WriteableEcdsaChannelSignerDecodeErrorZ_ok(uint64_t o) {
16963         void* o_ptr = untag_ptr(o);
16964         CHECK_ACCESS(o_ptr);
16965         LDKWriteableEcdsaChannelSigner o_conv = *(LDKWriteableEcdsaChannelSigner*)(o_ptr);
16966         if (o_conv.free == LDKWriteableEcdsaChannelSigner_JCalls_free) {
16967                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
16968                 LDKWriteableEcdsaChannelSigner_JCalls_cloned(&o_conv);
16969         }
16970         LDKCResult_WriteableEcdsaChannelSignerDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_WriteableEcdsaChannelSignerDecodeErrorZ), "LDKCResult_WriteableEcdsaChannelSignerDecodeErrorZ");
16971         *ret_conv = CResult_WriteableEcdsaChannelSignerDecodeErrorZ_ok(o_conv);
16972         return tag_ptr(ret_conv, true);
16973 }
16974
16975 uint64_t  __attribute__((export_name("TS_CResult_WriteableEcdsaChannelSignerDecodeErrorZ_err"))) TS_CResult_WriteableEcdsaChannelSignerDecodeErrorZ_err(uint64_t e) {
16976         void* e_ptr = untag_ptr(e);
16977         CHECK_ACCESS(e_ptr);
16978         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
16979         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
16980         LDKCResult_WriteableEcdsaChannelSignerDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_WriteableEcdsaChannelSignerDecodeErrorZ), "LDKCResult_WriteableEcdsaChannelSignerDecodeErrorZ");
16981         *ret_conv = CResult_WriteableEcdsaChannelSignerDecodeErrorZ_err(e_conv);
16982         return tag_ptr(ret_conv, true);
16983 }
16984
16985 jboolean  __attribute__((export_name("TS_CResult_WriteableEcdsaChannelSignerDecodeErrorZ_is_ok"))) TS_CResult_WriteableEcdsaChannelSignerDecodeErrorZ_is_ok(uint64_t o) {
16986         LDKCResult_WriteableEcdsaChannelSignerDecodeErrorZ* o_conv = (LDKCResult_WriteableEcdsaChannelSignerDecodeErrorZ*)untag_ptr(o);
16987         jboolean ret_conv = CResult_WriteableEcdsaChannelSignerDecodeErrorZ_is_ok(o_conv);
16988         return ret_conv;
16989 }
16990
16991 void  __attribute__((export_name("TS_CResult_WriteableEcdsaChannelSignerDecodeErrorZ_free"))) TS_CResult_WriteableEcdsaChannelSignerDecodeErrorZ_free(uint64_t _res) {
16992         if (!ptr_is_owned(_res)) return;
16993         void* _res_ptr = untag_ptr(_res);
16994         CHECK_ACCESS(_res_ptr);
16995         LDKCResult_WriteableEcdsaChannelSignerDecodeErrorZ _res_conv = *(LDKCResult_WriteableEcdsaChannelSignerDecodeErrorZ*)(_res_ptr);
16996         FREE(untag_ptr(_res));
16997         CResult_WriteableEcdsaChannelSignerDecodeErrorZ_free(_res_conv);
16998 }
16999
17000 static inline uint64_t CResult_WriteableEcdsaChannelSignerDecodeErrorZ_clone_ptr(LDKCResult_WriteableEcdsaChannelSignerDecodeErrorZ *NONNULL_PTR arg) {
17001         LDKCResult_WriteableEcdsaChannelSignerDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_WriteableEcdsaChannelSignerDecodeErrorZ), "LDKCResult_WriteableEcdsaChannelSignerDecodeErrorZ");
17002         *ret_conv = CResult_WriteableEcdsaChannelSignerDecodeErrorZ_clone(arg);
17003         return tag_ptr(ret_conv, true);
17004 }
17005 int64_t  __attribute__((export_name("TS_CResult_WriteableEcdsaChannelSignerDecodeErrorZ_clone_ptr"))) TS_CResult_WriteableEcdsaChannelSignerDecodeErrorZ_clone_ptr(uint64_t arg) {
17006         LDKCResult_WriteableEcdsaChannelSignerDecodeErrorZ* arg_conv = (LDKCResult_WriteableEcdsaChannelSignerDecodeErrorZ*)untag_ptr(arg);
17007         int64_t ret_conv = CResult_WriteableEcdsaChannelSignerDecodeErrorZ_clone_ptr(arg_conv);
17008         return ret_conv;
17009 }
17010
17011 uint64_t  __attribute__((export_name("TS_CResult_WriteableEcdsaChannelSignerDecodeErrorZ_clone"))) TS_CResult_WriteableEcdsaChannelSignerDecodeErrorZ_clone(uint64_t orig) {
17012         LDKCResult_WriteableEcdsaChannelSignerDecodeErrorZ* orig_conv = (LDKCResult_WriteableEcdsaChannelSignerDecodeErrorZ*)untag_ptr(orig);
17013         LDKCResult_WriteableEcdsaChannelSignerDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_WriteableEcdsaChannelSignerDecodeErrorZ), "LDKCResult_WriteableEcdsaChannelSignerDecodeErrorZ");
17014         *ret_conv = CResult_WriteableEcdsaChannelSignerDecodeErrorZ_clone(orig_conv);
17015         return tag_ptr(ret_conv, true);
17016 }
17017
17018 uint64_t  __attribute__((export_name("TS_CResult_CVec_u8ZNoneZ_ok"))) TS_CResult_CVec_u8ZNoneZ_ok(int8_tArray o) {
17019         LDKCVec_u8Z o_ref;
17020         o_ref.datalen = o->arr_len;
17021         o_ref.data = MALLOC(o_ref.datalen, "LDKCVec_u8Z Bytes");
17022         memcpy(o_ref.data, o->elems, o_ref.datalen); FREE(o);
17023         LDKCResult_CVec_u8ZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_u8ZNoneZ), "LDKCResult_CVec_u8ZNoneZ");
17024         *ret_conv = CResult_CVec_u8ZNoneZ_ok(o_ref);
17025         return tag_ptr(ret_conv, true);
17026 }
17027
17028 uint64_t  __attribute__((export_name("TS_CResult_CVec_u8ZNoneZ_err"))) TS_CResult_CVec_u8ZNoneZ_err() {
17029         LDKCResult_CVec_u8ZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_u8ZNoneZ), "LDKCResult_CVec_u8ZNoneZ");
17030         *ret_conv = CResult_CVec_u8ZNoneZ_err();
17031         return tag_ptr(ret_conv, true);
17032 }
17033
17034 jboolean  __attribute__((export_name("TS_CResult_CVec_u8ZNoneZ_is_ok"))) TS_CResult_CVec_u8ZNoneZ_is_ok(uint64_t o) {
17035         LDKCResult_CVec_u8ZNoneZ* o_conv = (LDKCResult_CVec_u8ZNoneZ*)untag_ptr(o);
17036         jboolean ret_conv = CResult_CVec_u8ZNoneZ_is_ok(o_conv);
17037         return ret_conv;
17038 }
17039
17040 void  __attribute__((export_name("TS_CResult_CVec_u8ZNoneZ_free"))) TS_CResult_CVec_u8ZNoneZ_free(uint64_t _res) {
17041         if (!ptr_is_owned(_res)) return;
17042         void* _res_ptr = untag_ptr(_res);
17043         CHECK_ACCESS(_res_ptr);
17044         LDKCResult_CVec_u8ZNoneZ _res_conv = *(LDKCResult_CVec_u8ZNoneZ*)(_res_ptr);
17045         FREE(untag_ptr(_res));
17046         CResult_CVec_u8ZNoneZ_free(_res_conv);
17047 }
17048
17049 static inline uint64_t CResult_CVec_u8ZNoneZ_clone_ptr(LDKCResult_CVec_u8ZNoneZ *NONNULL_PTR arg) {
17050         LDKCResult_CVec_u8ZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_u8ZNoneZ), "LDKCResult_CVec_u8ZNoneZ");
17051         *ret_conv = CResult_CVec_u8ZNoneZ_clone(arg);
17052         return tag_ptr(ret_conv, true);
17053 }
17054 int64_t  __attribute__((export_name("TS_CResult_CVec_u8ZNoneZ_clone_ptr"))) TS_CResult_CVec_u8ZNoneZ_clone_ptr(uint64_t arg) {
17055         LDKCResult_CVec_u8ZNoneZ* arg_conv = (LDKCResult_CVec_u8ZNoneZ*)untag_ptr(arg);
17056         int64_t ret_conv = CResult_CVec_u8ZNoneZ_clone_ptr(arg_conv);
17057         return ret_conv;
17058 }
17059
17060 uint64_t  __attribute__((export_name("TS_CResult_CVec_u8ZNoneZ_clone"))) TS_CResult_CVec_u8ZNoneZ_clone(uint64_t orig) {
17061         LDKCResult_CVec_u8ZNoneZ* orig_conv = (LDKCResult_CVec_u8ZNoneZ*)untag_ptr(orig);
17062         LDKCResult_CVec_u8ZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_u8ZNoneZ), "LDKCResult_CVec_u8ZNoneZ");
17063         *ret_conv = CResult_CVec_u8ZNoneZ_clone(orig_conv);
17064         return tag_ptr(ret_conv, true);
17065 }
17066
17067 uint64_t  __attribute__((export_name("TS_CResult_ShutdownScriptNoneZ_ok"))) TS_CResult_ShutdownScriptNoneZ_ok(uint64_t o) {
17068         LDKShutdownScript o_conv;
17069         o_conv.inner = untag_ptr(o);
17070         o_conv.is_owned = ptr_is_owned(o);
17071         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
17072         o_conv = ShutdownScript_clone(&o_conv);
17073         LDKCResult_ShutdownScriptNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_ShutdownScriptNoneZ), "LDKCResult_ShutdownScriptNoneZ");
17074         *ret_conv = CResult_ShutdownScriptNoneZ_ok(o_conv);
17075         return tag_ptr(ret_conv, true);
17076 }
17077
17078 uint64_t  __attribute__((export_name("TS_CResult_ShutdownScriptNoneZ_err"))) TS_CResult_ShutdownScriptNoneZ_err() {
17079         LDKCResult_ShutdownScriptNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_ShutdownScriptNoneZ), "LDKCResult_ShutdownScriptNoneZ");
17080         *ret_conv = CResult_ShutdownScriptNoneZ_err();
17081         return tag_ptr(ret_conv, true);
17082 }
17083
17084 jboolean  __attribute__((export_name("TS_CResult_ShutdownScriptNoneZ_is_ok"))) TS_CResult_ShutdownScriptNoneZ_is_ok(uint64_t o) {
17085         LDKCResult_ShutdownScriptNoneZ* o_conv = (LDKCResult_ShutdownScriptNoneZ*)untag_ptr(o);
17086         jboolean ret_conv = CResult_ShutdownScriptNoneZ_is_ok(o_conv);
17087         return ret_conv;
17088 }
17089
17090 void  __attribute__((export_name("TS_CResult_ShutdownScriptNoneZ_free"))) TS_CResult_ShutdownScriptNoneZ_free(uint64_t _res) {
17091         if (!ptr_is_owned(_res)) return;
17092         void* _res_ptr = untag_ptr(_res);
17093         CHECK_ACCESS(_res_ptr);
17094         LDKCResult_ShutdownScriptNoneZ _res_conv = *(LDKCResult_ShutdownScriptNoneZ*)(_res_ptr);
17095         FREE(untag_ptr(_res));
17096         CResult_ShutdownScriptNoneZ_free(_res_conv);
17097 }
17098
17099 static inline uint64_t CResult_ShutdownScriptNoneZ_clone_ptr(LDKCResult_ShutdownScriptNoneZ *NONNULL_PTR arg) {
17100         LDKCResult_ShutdownScriptNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_ShutdownScriptNoneZ), "LDKCResult_ShutdownScriptNoneZ");
17101         *ret_conv = CResult_ShutdownScriptNoneZ_clone(arg);
17102         return tag_ptr(ret_conv, true);
17103 }
17104 int64_t  __attribute__((export_name("TS_CResult_ShutdownScriptNoneZ_clone_ptr"))) TS_CResult_ShutdownScriptNoneZ_clone_ptr(uint64_t arg) {
17105         LDKCResult_ShutdownScriptNoneZ* arg_conv = (LDKCResult_ShutdownScriptNoneZ*)untag_ptr(arg);
17106         int64_t ret_conv = CResult_ShutdownScriptNoneZ_clone_ptr(arg_conv);
17107         return ret_conv;
17108 }
17109
17110 uint64_t  __attribute__((export_name("TS_CResult_ShutdownScriptNoneZ_clone"))) TS_CResult_ShutdownScriptNoneZ_clone(uint64_t orig) {
17111         LDKCResult_ShutdownScriptNoneZ* orig_conv = (LDKCResult_ShutdownScriptNoneZ*)untag_ptr(orig);
17112         LDKCResult_ShutdownScriptNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_ShutdownScriptNoneZ), "LDKCResult_ShutdownScriptNoneZ");
17113         *ret_conv = CResult_ShutdownScriptNoneZ_clone(orig_conv);
17114         return tag_ptr(ret_conv, true);
17115 }
17116
17117 uint64_t  __attribute__((export_name("TS_COption_u16Z_some"))) TS_COption_u16Z_some(int16_t o) {
17118         LDKCOption_u16Z *ret_copy = MALLOC(sizeof(LDKCOption_u16Z), "LDKCOption_u16Z");
17119         *ret_copy = COption_u16Z_some(o);
17120         uint64_t ret_ref = tag_ptr(ret_copy, true);
17121         return ret_ref;
17122 }
17123
17124 uint64_t  __attribute__((export_name("TS_COption_u16Z_none"))) TS_COption_u16Z_none() {
17125         LDKCOption_u16Z *ret_copy = MALLOC(sizeof(LDKCOption_u16Z), "LDKCOption_u16Z");
17126         *ret_copy = COption_u16Z_none();
17127         uint64_t ret_ref = tag_ptr(ret_copy, true);
17128         return ret_ref;
17129 }
17130
17131 void  __attribute__((export_name("TS_COption_u16Z_free"))) TS_COption_u16Z_free(uint64_t _res) {
17132         if (!ptr_is_owned(_res)) return;
17133         void* _res_ptr = untag_ptr(_res);
17134         CHECK_ACCESS(_res_ptr);
17135         LDKCOption_u16Z _res_conv = *(LDKCOption_u16Z*)(_res_ptr);
17136         FREE(untag_ptr(_res));
17137         COption_u16Z_free(_res_conv);
17138 }
17139
17140 static inline uint64_t COption_u16Z_clone_ptr(LDKCOption_u16Z *NONNULL_PTR arg) {
17141         LDKCOption_u16Z *ret_copy = MALLOC(sizeof(LDKCOption_u16Z), "LDKCOption_u16Z");
17142         *ret_copy = COption_u16Z_clone(arg);
17143         uint64_t ret_ref = tag_ptr(ret_copy, true);
17144         return ret_ref;
17145 }
17146 int64_t  __attribute__((export_name("TS_COption_u16Z_clone_ptr"))) TS_COption_u16Z_clone_ptr(uint64_t arg) {
17147         LDKCOption_u16Z* arg_conv = (LDKCOption_u16Z*)untag_ptr(arg);
17148         int64_t ret_conv = COption_u16Z_clone_ptr(arg_conv);
17149         return ret_conv;
17150 }
17151
17152 uint64_t  __attribute__((export_name("TS_COption_u16Z_clone"))) TS_COption_u16Z_clone(uint64_t orig) {
17153         LDKCOption_u16Z* orig_conv = (LDKCOption_u16Z*)untag_ptr(orig);
17154         LDKCOption_u16Z *ret_copy = MALLOC(sizeof(LDKCOption_u16Z), "LDKCOption_u16Z");
17155         *ret_copy = COption_u16Z_clone(orig_conv);
17156         uint64_t ret_ref = tag_ptr(ret_copy, true);
17157         return ret_ref;
17158 }
17159
17160 uint64_t  __attribute__((export_name("TS_COption_boolZ_some"))) TS_COption_boolZ_some(jboolean o) {
17161         LDKCOption_boolZ *ret_copy = MALLOC(sizeof(LDKCOption_boolZ), "LDKCOption_boolZ");
17162         *ret_copy = COption_boolZ_some(o);
17163         uint64_t ret_ref = tag_ptr(ret_copy, true);
17164         return ret_ref;
17165 }
17166
17167 uint64_t  __attribute__((export_name("TS_COption_boolZ_none"))) TS_COption_boolZ_none() {
17168         LDKCOption_boolZ *ret_copy = MALLOC(sizeof(LDKCOption_boolZ), "LDKCOption_boolZ");
17169         *ret_copy = COption_boolZ_none();
17170         uint64_t ret_ref = tag_ptr(ret_copy, true);
17171         return ret_ref;
17172 }
17173
17174 void  __attribute__((export_name("TS_COption_boolZ_free"))) TS_COption_boolZ_free(uint64_t _res) {
17175         if (!ptr_is_owned(_res)) return;
17176         void* _res_ptr = untag_ptr(_res);
17177         CHECK_ACCESS(_res_ptr);
17178         LDKCOption_boolZ _res_conv = *(LDKCOption_boolZ*)(_res_ptr);
17179         FREE(untag_ptr(_res));
17180         COption_boolZ_free(_res_conv);
17181 }
17182
17183 static inline uint64_t COption_boolZ_clone_ptr(LDKCOption_boolZ *NONNULL_PTR arg) {
17184         LDKCOption_boolZ *ret_copy = MALLOC(sizeof(LDKCOption_boolZ), "LDKCOption_boolZ");
17185         *ret_copy = COption_boolZ_clone(arg);
17186         uint64_t ret_ref = tag_ptr(ret_copy, true);
17187         return ret_ref;
17188 }
17189 int64_t  __attribute__((export_name("TS_COption_boolZ_clone_ptr"))) TS_COption_boolZ_clone_ptr(uint64_t arg) {
17190         LDKCOption_boolZ* arg_conv = (LDKCOption_boolZ*)untag_ptr(arg);
17191         int64_t ret_conv = COption_boolZ_clone_ptr(arg_conv);
17192         return ret_conv;
17193 }
17194
17195 uint64_t  __attribute__((export_name("TS_COption_boolZ_clone"))) TS_COption_boolZ_clone(uint64_t orig) {
17196         LDKCOption_boolZ* orig_conv = (LDKCOption_boolZ*)untag_ptr(orig);
17197         LDKCOption_boolZ *ret_copy = MALLOC(sizeof(LDKCOption_boolZ), "LDKCOption_boolZ");
17198         *ret_copy = COption_boolZ_clone(orig_conv);
17199         uint64_t ret_ref = tag_ptr(ret_copy, true);
17200         return ret_ref;
17201 }
17202
17203 void  __attribute__((export_name("TS_CVec_CVec_u8ZZ_free"))) TS_CVec_CVec_u8ZZ_free(ptrArray _res) {
17204         LDKCVec_CVec_u8ZZ _res_constr;
17205         _res_constr.datalen = _res->arr_len;
17206         if (_res_constr.datalen > 0)
17207                 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKCVec_u8Z), "LDKCVec_CVec_u8ZZ Elements");
17208         else
17209                 _res_constr.data = NULL;
17210         int8_tArray* _res_vals = (void*) _res->elems;
17211         for (size_t m = 0; m < _res_constr.datalen; m++) {
17212                 int8_tArray _res_conv_12 = _res_vals[m];
17213                 LDKCVec_u8Z _res_conv_12_ref;
17214                 _res_conv_12_ref.datalen = _res_conv_12->arr_len;
17215                 _res_conv_12_ref.data = MALLOC(_res_conv_12_ref.datalen, "LDKCVec_u8Z Bytes");
17216                 memcpy(_res_conv_12_ref.data, _res_conv_12->elems, _res_conv_12_ref.datalen); FREE(_res_conv_12);
17217                 _res_constr.data[m] = _res_conv_12_ref;
17218         }
17219         FREE(_res);
17220         CVec_CVec_u8ZZ_free(_res_constr);
17221 }
17222
17223 uint64_t  __attribute__((export_name("TS_CResult_CVec_CVec_u8ZZNoneZ_ok"))) TS_CResult_CVec_CVec_u8ZZNoneZ_ok(ptrArray o) {
17224         LDKCVec_CVec_u8ZZ o_constr;
17225         o_constr.datalen = o->arr_len;
17226         if (o_constr.datalen > 0)
17227                 o_constr.data = MALLOC(o_constr.datalen * sizeof(LDKCVec_u8Z), "LDKCVec_CVec_u8ZZ Elements");
17228         else
17229                 o_constr.data = NULL;
17230         int8_tArray* o_vals = (void*) o->elems;
17231         for (size_t m = 0; m < o_constr.datalen; m++) {
17232                 int8_tArray o_conv_12 = o_vals[m];
17233                 LDKCVec_u8Z o_conv_12_ref;
17234                 o_conv_12_ref.datalen = o_conv_12->arr_len;
17235                 o_conv_12_ref.data = MALLOC(o_conv_12_ref.datalen, "LDKCVec_u8Z Bytes");
17236                 memcpy(o_conv_12_ref.data, o_conv_12->elems, o_conv_12_ref.datalen); FREE(o_conv_12);
17237                 o_constr.data[m] = o_conv_12_ref;
17238         }
17239         FREE(o);
17240         LDKCResult_CVec_CVec_u8ZZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_CVec_u8ZZNoneZ), "LDKCResult_CVec_CVec_u8ZZNoneZ");
17241         *ret_conv = CResult_CVec_CVec_u8ZZNoneZ_ok(o_constr);
17242         return tag_ptr(ret_conv, true);
17243 }
17244
17245 uint64_t  __attribute__((export_name("TS_CResult_CVec_CVec_u8ZZNoneZ_err"))) TS_CResult_CVec_CVec_u8ZZNoneZ_err() {
17246         LDKCResult_CVec_CVec_u8ZZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_CVec_u8ZZNoneZ), "LDKCResult_CVec_CVec_u8ZZNoneZ");
17247         *ret_conv = CResult_CVec_CVec_u8ZZNoneZ_err();
17248         return tag_ptr(ret_conv, true);
17249 }
17250
17251 jboolean  __attribute__((export_name("TS_CResult_CVec_CVec_u8ZZNoneZ_is_ok"))) TS_CResult_CVec_CVec_u8ZZNoneZ_is_ok(uint64_t o) {
17252         LDKCResult_CVec_CVec_u8ZZNoneZ* o_conv = (LDKCResult_CVec_CVec_u8ZZNoneZ*)untag_ptr(o);
17253         jboolean ret_conv = CResult_CVec_CVec_u8ZZNoneZ_is_ok(o_conv);
17254         return ret_conv;
17255 }
17256
17257 void  __attribute__((export_name("TS_CResult_CVec_CVec_u8ZZNoneZ_free"))) TS_CResult_CVec_CVec_u8ZZNoneZ_free(uint64_t _res) {
17258         if (!ptr_is_owned(_res)) return;
17259         void* _res_ptr = untag_ptr(_res);
17260         CHECK_ACCESS(_res_ptr);
17261         LDKCResult_CVec_CVec_u8ZZNoneZ _res_conv = *(LDKCResult_CVec_CVec_u8ZZNoneZ*)(_res_ptr);
17262         FREE(untag_ptr(_res));
17263         CResult_CVec_CVec_u8ZZNoneZ_free(_res_conv);
17264 }
17265
17266 static inline uint64_t CResult_CVec_CVec_u8ZZNoneZ_clone_ptr(LDKCResult_CVec_CVec_u8ZZNoneZ *NONNULL_PTR arg) {
17267         LDKCResult_CVec_CVec_u8ZZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_CVec_u8ZZNoneZ), "LDKCResult_CVec_CVec_u8ZZNoneZ");
17268         *ret_conv = CResult_CVec_CVec_u8ZZNoneZ_clone(arg);
17269         return tag_ptr(ret_conv, true);
17270 }
17271 int64_t  __attribute__((export_name("TS_CResult_CVec_CVec_u8ZZNoneZ_clone_ptr"))) TS_CResult_CVec_CVec_u8ZZNoneZ_clone_ptr(uint64_t arg) {
17272         LDKCResult_CVec_CVec_u8ZZNoneZ* arg_conv = (LDKCResult_CVec_CVec_u8ZZNoneZ*)untag_ptr(arg);
17273         int64_t ret_conv = CResult_CVec_CVec_u8ZZNoneZ_clone_ptr(arg_conv);
17274         return ret_conv;
17275 }
17276
17277 uint64_t  __attribute__((export_name("TS_CResult_CVec_CVec_u8ZZNoneZ_clone"))) TS_CResult_CVec_CVec_u8ZZNoneZ_clone(uint64_t orig) {
17278         LDKCResult_CVec_CVec_u8ZZNoneZ* orig_conv = (LDKCResult_CVec_CVec_u8ZZNoneZ*)untag_ptr(orig);
17279         LDKCResult_CVec_CVec_u8ZZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_CVec_u8ZZNoneZ), "LDKCResult_CVec_CVec_u8ZZNoneZ");
17280         *ret_conv = CResult_CVec_CVec_u8ZZNoneZ_clone(orig_conv);
17281         return tag_ptr(ret_conv, true);
17282 }
17283
17284 uint64_t  __attribute__((export_name("TS_CResult_InMemorySignerDecodeErrorZ_ok"))) TS_CResult_InMemorySignerDecodeErrorZ_ok(uint64_t o) {
17285         LDKInMemorySigner o_conv;
17286         o_conv.inner = untag_ptr(o);
17287         o_conv.is_owned = ptr_is_owned(o);
17288         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
17289         o_conv = InMemorySigner_clone(&o_conv);
17290         LDKCResult_InMemorySignerDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InMemorySignerDecodeErrorZ), "LDKCResult_InMemorySignerDecodeErrorZ");
17291         *ret_conv = CResult_InMemorySignerDecodeErrorZ_ok(o_conv);
17292         return tag_ptr(ret_conv, true);
17293 }
17294
17295 uint64_t  __attribute__((export_name("TS_CResult_InMemorySignerDecodeErrorZ_err"))) TS_CResult_InMemorySignerDecodeErrorZ_err(uint64_t e) {
17296         void* e_ptr = untag_ptr(e);
17297         CHECK_ACCESS(e_ptr);
17298         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
17299         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
17300         LDKCResult_InMemorySignerDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InMemorySignerDecodeErrorZ), "LDKCResult_InMemorySignerDecodeErrorZ");
17301         *ret_conv = CResult_InMemorySignerDecodeErrorZ_err(e_conv);
17302         return tag_ptr(ret_conv, true);
17303 }
17304
17305 jboolean  __attribute__((export_name("TS_CResult_InMemorySignerDecodeErrorZ_is_ok"))) TS_CResult_InMemorySignerDecodeErrorZ_is_ok(uint64_t o) {
17306         LDKCResult_InMemorySignerDecodeErrorZ* o_conv = (LDKCResult_InMemorySignerDecodeErrorZ*)untag_ptr(o);
17307         jboolean ret_conv = CResult_InMemorySignerDecodeErrorZ_is_ok(o_conv);
17308         return ret_conv;
17309 }
17310
17311 void  __attribute__((export_name("TS_CResult_InMemorySignerDecodeErrorZ_free"))) TS_CResult_InMemorySignerDecodeErrorZ_free(uint64_t _res) {
17312         if (!ptr_is_owned(_res)) return;
17313         void* _res_ptr = untag_ptr(_res);
17314         CHECK_ACCESS(_res_ptr);
17315         LDKCResult_InMemorySignerDecodeErrorZ _res_conv = *(LDKCResult_InMemorySignerDecodeErrorZ*)(_res_ptr);
17316         FREE(untag_ptr(_res));
17317         CResult_InMemorySignerDecodeErrorZ_free(_res_conv);
17318 }
17319
17320 static inline uint64_t CResult_InMemorySignerDecodeErrorZ_clone_ptr(LDKCResult_InMemorySignerDecodeErrorZ *NONNULL_PTR arg) {
17321         LDKCResult_InMemorySignerDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InMemorySignerDecodeErrorZ), "LDKCResult_InMemorySignerDecodeErrorZ");
17322         *ret_conv = CResult_InMemorySignerDecodeErrorZ_clone(arg);
17323         return tag_ptr(ret_conv, true);
17324 }
17325 int64_t  __attribute__((export_name("TS_CResult_InMemorySignerDecodeErrorZ_clone_ptr"))) TS_CResult_InMemorySignerDecodeErrorZ_clone_ptr(uint64_t arg) {
17326         LDKCResult_InMemorySignerDecodeErrorZ* arg_conv = (LDKCResult_InMemorySignerDecodeErrorZ*)untag_ptr(arg);
17327         int64_t ret_conv = CResult_InMemorySignerDecodeErrorZ_clone_ptr(arg_conv);
17328         return ret_conv;
17329 }
17330
17331 uint64_t  __attribute__((export_name("TS_CResult_InMemorySignerDecodeErrorZ_clone"))) TS_CResult_InMemorySignerDecodeErrorZ_clone(uint64_t orig) {
17332         LDKCResult_InMemorySignerDecodeErrorZ* orig_conv = (LDKCResult_InMemorySignerDecodeErrorZ*)untag_ptr(orig);
17333         LDKCResult_InMemorySignerDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InMemorySignerDecodeErrorZ), "LDKCResult_InMemorySignerDecodeErrorZ");
17334         *ret_conv = CResult_InMemorySignerDecodeErrorZ_clone(orig_conv);
17335         return tag_ptr(ret_conv, true);
17336 }
17337
17338 uint64_t  __attribute__((export_name("TS_CResult_TransactionNoneZ_ok"))) TS_CResult_TransactionNoneZ_ok(int8_tArray o) {
17339         LDKTransaction o_ref;
17340         o_ref.datalen = o->arr_len;
17341         o_ref.data = MALLOC(o_ref.datalen, "LDKTransaction Bytes");
17342         memcpy(o_ref.data, o->elems, o_ref.datalen); FREE(o);
17343         o_ref.data_is_owned = true;
17344         LDKCResult_TransactionNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_TransactionNoneZ), "LDKCResult_TransactionNoneZ");
17345         *ret_conv = CResult_TransactionNoneZ_ok(o_ref);
17346         return tag_ptr(ret_conv, true);
17347 }
17348
17349 uint64_t  __attribute__((export_name("TS_CResult_TransactionNoneZ_err"))) TS_CResult_TransactionNoneZ_err() {
17350         LDKCResult_TransactionNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_TransactionNoneZ), "LDKCResult_TransactionNoneZ");
17351         *ret_conv = CResult_TransactionNoneZ_err();
17352         return tag_ptr(ret_conv, true);
17353 }
17354
17355 jboolean  __attribute__((export_name("TS_CResult_TransactionNoneZ_is_ok"))) TS_CResult_TransactionNoneZ_is_ok(uint64_t o) {
17356         LDKCResult_TransactionNoneZ* o_conv = (LDKCResult_TransactionNoneZ*)untag_ptr(o);
17357         jboolean ret_conv = CResult_TransactionNoneZ_is_ok(o_conv);
17358         return ret_conv;
17359 }
17360
17361 void  __attribute__((export_name("TS_CResult_TransactionNoneZ_free"))) TS_CResult_TransactionNoneZ_free(uint64_t _res) {
17362         if (!ptr_is_owned(_res)) return;
17363         void* _res_ptr = untag_ptr(_res);
17364         CHECK_ACCESS(_res_ptr);
17365         LDKCResult_TransactionNoneZ _res_conv = *(LDKCResult_TransactionNoneZ*)(_res_ptr);
17366         FREE(untag_ptr(_res));
17367         CResult_TransactionNoneZ_free(_res_conv);
17368 }
17369
17370 static inline uint64_t CResult_TransactionNoneZ_clone_ptr(LDKCResult_TransactionNoneZ *NONNULL_PTR arg) {
17371         LDKCResult_TransactionNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_TransactionNoneZ), "LDKCResult_TransactionNoneZ");
17372         *ret_conv = CResult_TransactionNoneZ_clone(arg);
17373         return tag_ptr(ret_conv, true);
17374 }
17375 int64_t  __attribute__((export_name("TS_CResult_TransactionNoneZ_clone_ptr"))) TS_CResult_TransactionNoneZ_clone_ptr(uint64_t arg) {
17376         LDKCResult_TransactionNoneZ* arg_conv = (LDKCResult_TransactionNoneZ*)untag_ptr(arg);
17377         int64_t ret_conv = CResult_TransactionNoneZ_clone_ptr(arg_conv);
17378         return ret_conv;
17379 }
17380
17381 uint64_t  __attribute__((export_name("TS_CResult_TransactionNoneZ_clone"))) TS_CResult_TransactionNoneZ_clone(uint64_t orig) {
17382         LDKCResult_TransactionNoneZ* orig_conv = (LDKCResult_TransactionNoneZ*)untag_ptr(orig);
17383         LDKCResult_TransactionNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_TransactionNoneZ), "LDKCResult_TransactionNoneZ");
17384         *ret_conv = CResult_TransactionNoneZ_clone(orig_conv);
17385         return tag_ptr(ret_conv, true);
17386 }
17387
17388 void  __attribute__((export_name("TS_CVec_ChannelDetailsZ_free"))) TS_CVec_ChannelDetailsZ_free(uint64_tArray _res) {
17389         LDKCVec_ChannelDetailsZ _res_constr;
17390         _res_constr.datalen = _res->arr_len;
17391         if (_res_constr.datalen > 0)
17392                 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKChannelDetails), "LDKCVec_ChannelDetailsZ Elements");
17393         else
17394                 _res_constr.data = NULL;
17395         uint64_t* _res_vals = _res->elems;
17396         for (size_t q = 0; q < _res_constr.datalen; q++) {
17397                 uint64_t _res_conv_16 = _res_vals[q];
17398                 LDKChannelDetails _res_conv_16_conv;
17399                 _res_conv_16_conv.inner = untag_ptr(_res_conv_16);
17400                 _res_conv_16_conv.is_owned = ptr_is_owned(_res_conv_16);
17401                 CHECK_INNER_FIELD_ACCESS_OR_NULL(_res_conv_16_conv);
17402                 _res_constr.data[q] = _res_conv_16_conv;
17403         }
17404         FREE(_res);
17405         CVec_ChannelDetailsZ_free(_res_constr);
17406 }
17407
17408 uint64_t  __attribute__((export_name("TS_CResult_RouteLightningErrorZ_ok"))) TS_CResult_RouteLightningErrorZ_ok(uint64_t o) {
17409         LDKRoute o_conv;
17410         o_conv.inner = untag_ptr(o);
17411         o_conv.is_owned = ptr_is_owned(o);
17412         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
17413         o_conv = Route_clone(&o_conv);
17414         LDKCResult_RouteLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteLightningErrorZ), "LDKCResult_RouteLightningErrorZ");
17415         *ret_conv = CResult_RouteLightningErrorZ_ok(o_conv);
17416         return tag_ptr(ret_conv, true);
17417 }
17418
17419 uint64_t  __attribute__((export_name("TS_CResult_RouteLightningErrorZ_err"))) TS_CResult_RouteLightningErrorZ_err(uint64_t e) {
17420         LDKLightningError e_conv;
17421         e_conv.inner = untag_ptr(e);
17422         e_conv.is_owned = ptr_is_owned(e);
17423         CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
17424         e_conv = LightningError_clone(&e_conv);
17425         LDKCResult_RouteLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteLightningErrorZ), "LDKCResult_RouteLightningErrorZ");
17426         *ret_conv = CResult_RouteLightningErrorZ_err(e_conv);
17427         return tag_ptr(ret_conv, true);
17428 }
17429
17430 jboolean  __attribute__((export_name("TS_CResult_RouteLightningErrorZ_is_ok"))) TS_CResult_RouteLightningErrorZ_is_ok(uint64_t o) {
17431         LDKCResult_RouteLightningErrorZ* o_conv = (LDKCResult_RouteLightningErrorZ*)untag_ptr(o);
17432         jboolean ret_conv = CResult_RouteLightningErrorZ_is_ok(o_conv);
17433         return ret_conv;
17434 }
17435
17436 void  __attribute__((export_name("TS_CResult_RouteLightningErrorZ_free"))) TS_CResult_RouteLightningErrorZ_free(uint64_t _res) {
17437         if (!ptr_is_owned(_res)) return;
17438         void* _res_ptr = untag_ptr(_res);
17439         CHECK_ACCESS(_res_ptr);
17440         LDKCResult_RouteLightningErrorZ _res_conv = *(LDKCResult_RouteLightningErrorZ*)(_res_ptr);
17441         FREE(untag_ptr(_res));
17442         CResult_RouteLightningErrorZ_free(_res_conv);
17443 }
17444
17445 static inline uint64_t CResult_RouteLightningErrorZ_clone_ptr(LDKCResult_RouteLightningErrorZ *NONNULL_PTR arg) {
17446         LDKCResult_RouteLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteLightningErrorZ), "LDKCResult_RouteLightningErrorZ");
17447         *ret_conv = CResult_RouteLightningErrorZ_clone(arg);
17448         return tag_ptr(ret_conv, true);
17449 }
17450 int64_t  __attribute__((export_name("TS_CResult_RouteLightningErrorZ_clone_ptr"))) TS_CResult_RouteLightningErrorZ_clone_ptr(uint64_t arg) {
17451         LDKCResult_RouteLightningErrorZ* arg_conv = (LDKCResult_RouteLightningErrorZ*)untag_ptr(arg);
17452         int64_t ret_conv = CResult_RouteLightningErrorZ_clone_ptr(arg_conv);
17453         return ret_conv;
17454 }
17455
17456 uint64_t  __attribute__((export_name("TS_CResult_RouteLightningErrorZ_clone"))) TS_CResult_RouteLightningErrorZ_clone(uint64_t orig) {
17457         LDKCResult_RouteLightningErrorZ* orig_conv = (LDKCResult_RouteLightningErrorZ*)untag_ptr(orig);
17458         LDKCResult_RouteLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteLightningErrorZ), "LDKCResult_RouteLightningErrorZ");
17459         *ret_conv = CResult_RouteLightningErrorZ_clone(orig_conv);
17460         return tag_ptr(ret_conv, true);
17461 }
17462
17463 uint64_t  __attribute__((export_name("TS_CResult_InFlightHtlcsDecodeErrorZ_ok"))) TS_CResult_InFlightHtlcsDecodeErrorZ_ok(uint64_t o) {
17464         LDKInFlightHtlcs o_conv;
17465         o_conv.inner = untag_ptr(o);
17466         o_conv.is_owned = ptr_is_owned(o);
17467         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
17468         o_conv = InFlightHtlcs_clone(&o_conv);
17469         LDKCResult_InFlightHtlcsDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InFlightHtlcsDecodeErrorZ), "LDKCResult_InFlightHtlcsDecodeErrorZ");
17470         *ret_conv = CResult_InFlightHtlcsDecodeErrorZ_ok(o_conv);
17471         return tag_ptr(ret_conv, true);
17472 }
17473
17474 uint64_t  __attribute__((export_name("TS_CResult_InFlightHtlcsDecodeErrorZ_err"))) TS_CResult_InFlightHtlcsDecodeErrorZ_err(uint64_t e) {
17475         void* e_ptr = untag_ptr(e);
17476         CHECK_ACCESS(e_ptr);
17477         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
17478         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
17479         LDKCResult_InFlightHtlcsDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InFlightHtlcsDecodeErrorZ), "LDKCResult_InFlightHtlcsDecodeErrorZ");
17480         *ret_conv = CResult_InFlightHtlcsDecodeErrorZ_err(e_conv);
17481         return tag_ptr(ret_conv, true);
17482 }
17483
17484 jboolean  __attribute__((export_name("TS_CResult_InFlightHtlcsDecodeErrorZ_is_ok"))) TS_CResult_InFlightHtlcsDecodeErrorZ_is_ok(uint64_t o) {
17485         LDKCResult_InFlightHtlcsDecodeErrorZ* o_conv = (LDKCResult_InFlightHtlcsDecodeErrorZ*)untag_ptr(o);
17486         jboolean ret_conv = CResult_InFlightHtlcsDecodeErrorZ_is_ok(o_conv);
17487         return ret_conv;
17488 }
17489
17490 void  __attribute__((export_name("TS_CResult_InFlightHtlcsDecodeErrorZ_free"))) TS_CResult_InFlightHtlcsDecodeErrorZ_free(uint64_t _res) {
17491         if (!ptr_is_owned(_res)) return;
17492         void* _res_ptr = untag_ptr(_res);
17493         CHECK_ACCESS(_res_ptr);
17494         LDKCResult_InFlightHtlcsDecodeErrorZ _res_conv = *(LDKCResult_InFlightHtlcsDecodeErrorZ*)(_res_ptr);
17495         FREE(untag_ptr(_res));
17496         CResult_InFlightHtlcsDecodeErrorZ_free(_res_conv);
17497 }
17498
17499 static inline uint64_t CResult_InFlightHtlcsDecodeErrorZ_clone_ptr(LDKCResult_InFlightHtlcsDecodeErrorZ *NONNULL_PTR arg) {
17500         LDKCResult_InFlightHtlcsDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InFlightHtlcsDecodeErrorZ), "LDKCResult_InFlightHtlcsDecodeErrorZ");
17501         *ret_conv = CResult_InFlightHtlcsDecodeErrorZ_clone(arg);
17502         return tag_ptr(ret_conv, true);
17503 }
17504 int64_t  __attribute__((export_name("TS_CResult_InFlightHtlcsDecodeErrorZ_clone_ptr"))) TS_CResult_InFlightHtlcsDecodeErrorZ_clone_ptr(uint64_t arg) {
17505         LDKCResult_InFlightHtlcsDecodeErrorZ* arg_conv = (LDKCResult_InFlightHtlcsDecodeErrorZ*)untag_ptr(arg);
17506         int64_t ret_conv = CResult_InFlightHtlcsDecodeErrorZ_clone_ptr(arg_conv);
17507         return ret_conv;
17508 }
17509
17510 uint64_t  __attribute__((export_name("TS_CResult_InFlightHtlcsDecodeErrorZ_clone"))) TS_CResult_InFlightHtlcsDecodeErrorZ_clone(uint64_t orig) {
17511         LDKCResult_InFlightHtlcsDecodeErrorZ* orig_conv = (LDKCResult_InFlightHtlcsDecodeErrorZ*)untag_ptr(orig);
17512         LDKCResult_InFlightHtlcsDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InFlightHtlcsDecodeErrorZ), "LDKCResult_InFlightHtlcsDecodeErrorZ");
17513         *ret_conv = CResult_InFlightHtlcsDecodeErrorZ_clone(orig_conv);
17514         return tag_ptr(ret_conv, true);
17515 }
17516
17517 uint64_t  __attribute__((export_name("TS_CResult_RouteHopDecodeErrorZ_ok"))) TS_CResult_RouteHopDecodeErrorZ_ok(uint64_t o) {
17518         LDKRouteHop o_conv;
17519         o_conv.inner = untag_ptr(o);
17520         o_conv.is_owned = ptr_is_owned(o);
17521         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
17522         o_conv = RouteHop_clone(&o_conv);
17523         LDKCResult_RouteHopDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteHopDecodeErrorZ), "LDKCResult_RouteHopDecodeErrorZ");
17524         *ret_conv = CResult_RouteHopDecodeErrorZ_ok(o_conv);
17525         return tag_ptr(ret_conv, true);
17526 }
17527
17528 uint64_t  __attribute__((export_name("TS_CResult_RouteHopDecodeErrorZ_err"))) TS_CResult_RouteHopDecodeErrorZ_err(uint64_t e) {
17529         void* e_ptr = untag_ptr(e);
17530         CHECK_ACCESS(e_ptr);
17531         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
17532         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
17533         LDKCResult_RouteHopDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteHopDecodeErrorZ), "LDKCResult_RouteHopDecodeErrorZ");
17534         *ret_conv = CResult_RouteHopDecodeErrorZ_err(e_conv);
17535         return tag_ptr(ret_conv, true);
17536 }
17537
17538 jboolean  __attribute__((export_name("TS_CResult_RouteHopDecodeErrorZ_is_ok"))) TS_CResult_RouteHopDecodeErrorZ_is_ok(uint64_t o) {
17539         LDKCResult_RouteHopDecodeErrorZ* o_conv = (LDKCResult_RouteHopDecodeErrorZ*)untag_ptr(o);
17540         jboolean ret_conv = CResult_RouteHopDecodeErrorZ_is_ok(o_conv);
17541         return ret_conv;
17542 }
17543
17544 void  __attribute__((export_name("TS_CResult_RouteHopDecodeErrorZ_free"))) TS_CResult_RouteHopDecodeErrorZ_free(uint64_t _res) {
17545         if (!ptr_is_owned(_res)) return;
17546         void* _res_ptr = untag_ptr(_res);
17547         CHECK_ACCESS(_res_ptr);
17548         LDKCResult_RouteHopDecodeErrorZ _res_conv = *(LDKCResult_RouteHopDecodeErrorZ*)(_res_ptr);
17549         FREE(untag_ptr(_res));
17550         CResult_RouteHopDecodeErrorZ_free(_res_conv);
17551 }
17552
17553 static inline uint64_t CResult_RouteHopDecodeErrorZ_clone_ptr(LDKCResult_RouteHopDecodeErrorZ *NONNULL_PTR arg) {
17554         LDKCResult_RouteHopDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteHopDecodeErrorZ), "LDKCResult_RouteHopDecodeErrorZ");
17555         *ret_conv = CResult_RouteHopDecodeErrorZ_clone(arg);
17556         return tag_ptr(ret_conv, true);
17557 }
17558 int64_t  __attribute__((export_name("TS_CResult_RouteHopDecodeErrorZ_clone_ptr"))) TS_CResult_RouteHopDecodeErrorZ_clone_ptr(uint64_t arg) {
17559         LDKCResult_RouteHopDecodeErrorZ* arg_conv = (LDKCResult_RouteHopDecodeErrorZ*)untag_ptr(arg);
17560         int64_t ret_conv = CResult_RouteHopDecodeErrorZ_clone_ptr(arg_conv);
17561         return ret_conv;
17562 }
17563
17564 uint64_t  __attribute__((export_name("TS_CResult_RouteHopDecodeErrorZ_clone"))) TS_CResult_RouteHopDecodeErrorZ_clone(uint64_t orig) {
17565         LDKCResult_RouteHopDecodeErrorZ* orig_conv = (LDKCResult_RouteHopDecodeErrorZ*)untag_ptr(orig);
17566         LDKCResult_RouteHopDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteHopDecodeErrorZ), "LDKCResult_RouteHopDecodeErrorZ");
17567         *ret_conv = CResult_RouteHopDecodeErrorZ_clone(orig_conv);
17568         return tag_ptr(ret_conv, true);
17569 }
17570
17571 void  __attribute__((export_name("TS_CVec_BlindedHopZ_free"))) TS_CVec_BlindedHopZ_free(uint64_tArray _res) {
17572         LDKCVec_BlindedHopZ _res_constr;
17573         _res_constr.datalen = _res->arr_len;
17574         if (_res_constr.datalen > 0)
17575                 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKBlindedHop), "LDKCVec_BlindedHopZ Elements");
17576         else
17577                 _res_constr.data = NULL;
17578         uint64_t* _res_vals = _res->elems;
17579         for (size_t m = 0; m < _res_constr.datalen; m++) {
17580                 uint64_t _res_conv_12 = _res_vals[m];
17581                 LDKBlindedHop _res_conv_12_conv;
17582                 _res_conv_12_conv.inner = untag_ptr(_res_conv_12);
17583                 _res_conv_12_conv.is_owned = ptr_is_owned(_res_conv_12);
17584                 CHECK_INNER_FIELD_ACCESS_OR_NULL(_res_conv_12_conv);
17585                 _res_constr.data[m] = _res_conv_12_conv;
17586         }
17587         FREE(_res);
17588         CVec_BlindedHopZ_free(_res_constr);
17589 }
17590
17591 uint64_t  __attribute__((export_name("TS_CResult_BlindedTailDecodeErrorZ_ok"))) TS_CResult_BlindedTailDecodeErrorZ_ok(uint64_t o) {
17592         LDKBlindedTail o_conv;
17593         o_conv.inner = untag_ptr(o);
17594         o_conv.is_owned = ptr_is_owned(o);
17595         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
17596         o_conv = BlindedTail_clone(&o_conv);
17597         LDKCResult_BlindedTailDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_BlindedTailDecodeErrorZ), "LDKCResult_BlindedTailDecodeErrorZ");
17598         *ret_conv = CResult_BlindedTailDecodeErrorZ_ok(o_conv);
17599         return tag_ptr(ret_conv, true);
17600 }
17601
17602 uint64_t  __attribute__((export_name("TS_CResult_BlindedTailDecodeErrorZ_err"))) TS_CResult_BlindedTailDecodeErrorZ_err(uint64_t e) {
17603         void* e_ptr = untag_ptr(e);
17604         CHECK_ACCESS(e_ptr);
17605         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
17606         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
17607         LDKCResult_BlindedTailDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_BlindedTailDecodeErrorZ), "LDKCResult_BlindedTailDecodeErrorZ");
17608         *ret_conv = CResult_BlindedTailDecodeErrorZ_err(e_conv);
17609         return tag_ptr(ret_conv, true);
17610 }
17611
17612 jboolean  __attribute__((export_name("TS_CResult_BlindedTailDecodeErrorZ_is_ok"))) TS_CResult_BlindedTailDecodeErrorZ_is_ok(uint64_t o) {
17613         LDKCResult_BlindedTailDecodeErrorZ* o_conv = (LDKCResult_BlindedTailDecodeErrorZ*)untag_ptr(o);
17614         jboolean ret_conv = CResult_BlindedTailDecodeErrorZ_is_ok(o_conv);
17615         return ret_conv;
17616 }
17617
17618 void  __attribute__((export_name("TS_CResult_BlindedTailDecodeErrorZ_free"))) TS_CResult_BlindedTailDecodeErrorZ_free(uint64_t _res) {
17619         if (!ptr_is_owned(_res)) return;
17620         void* _res_ptr = untag_ptr(_res);
17621         CHECK_ACCESS(_res_ptr);
17622         LDKCResult_BlindedTailDecodeErrorZ _res_conv = *(LDKCResult_BlindedTailDecodeErrorZ*)(_res_ptr);
17623         FREE(untag_ptr(_res));
17624         CResult_BlindedTailDecodeErrorZ_free(_res_conv);
17625 }
17626
17627 static inline uint64_t CResult_BlindedTailDecodeErrorZ_clone_ptr(LDKCResult_BlindedTailDecodeErrorZ *NONNULL_PTR arg) {
17628         LDKCResult_BlindedTailDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_BlindedTailDecodeErrorZ), "LDKCResult_BlindedTailDecodeErrorZ");
17629         *ret_conv = CResult_BlindedTailDecodeErrorZ_clone(arg);
17630         return tag_ptr(ret_conv, true);
17631 }
17632 int64_t  __attribute__((export_name("TS_CResult_BlindedTailDecodeErrorZ_clone_ptr"))) TS_CResult_BlindedTailDecodeErrorZ_clone_ptr(uint64_t arg) {
17633         LDKCResult_BlindedTailDecodeErrorZ* arg_conv = (LDKCResult_BlindedTailDecodeErrorZ*)untag_ptr(arg);
17634         int64_t ret_conv = CResult_BlindedTailDecodeErrorZ_clone_ptr(arg_conv);
17635         return ret_conv;
17636 }
17637
17638 uint64_t  __attribute__((export_name("TS_CResult_BlindedTailDecodeErrorZ_clone"))) TS_CResult_BlindedTailDecodeErrorZ_clone(uint64_t orig) {
17639         LDKCResult_BlindedTailDecodeErrorZ* orig_conv = (LDKCResult_BlindedTailDecodeErrorZ*)untag_ptr(orig);
17640         LDKCResult_BlindedTailDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_BlindedTailDecodeErrorZ), "LDKCResult_BlindedTailDecodeErrorZ");
17641         *ret_conv = CResult_BlindedTailDecodeErrorZ_clone(orig_conv);
17642         return tag_ptr(ret_conv, true);
17643 }
17644
17645 void  __attribute__((export_name("TS_CVec_RouteHopZ_free"))) TS_CVec_RouteHopZ_free(uint64_tArray _res) {
17646         LDKCVec_RouteHopZ _res_constr;
17647         _res_constr.datalen = _res->arr_len;
17648         if (_res_constr.datalen > 0)
17649                 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKRouteHop), "LDKCVec_RouteHopZ Elements");
17650         else
17651                 _res_constr.data = NULL;
17652         uint64_t* _res_vals = _res->elems;
17653         for (size_t k = 0; k < _res_constr.datalen; k++) {
17654                 uint64_t _res_conv_10 = _res_vals[k];
17655                 LDKRouteHop _res_conv_10_conv;
17656                 _res_conv_10_conv.inner = untag_ptr(_res_conv_10);
17657                 _res_conv_10_conv.is_owned = ptr_is_owned(_res_conv_10);
17658                 CHECK_INNER_FIELD_ACCESS_OR_NULL(_res_conv_10_conv);
17659                 _res_constr.data[k] = _res_conv_10_conv;
17660         }
17661         FREE(_res);
17662         CVec_RouteHopZ_free(_res_constr);
17663 }
17664
17665 void  __attribute__((export_name("TS_CVec_PathZ_free"))) TS_CVec_PathZ_free(uint64_tArray _res) {
17666         LDKCVec_PathZ _res_constr;
17667         _res_constr.datalen = _res->arr_len;
17668         if (_res_constr.datalen > 0)
17669                 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKPath), "LDKCVec_PathZ Elements");
17670         else
17671                 _res_constr.data = NULL;
17672         uint64_t* _res_vals = _res->elems;
17673         for (size_t g = 0; g < _res_constr.datalen; g++) {
17674                 uint64_t _res_conv_6 = _res_vals[g];
17675                 LDKPath _res_conv_6_conv;
17676                 _res_conv_6_conv.inner = untag_ptr(_res_conv_6);
17677                 _res_conv_6_conv.is_owned = ptr_is_owned(_res_conv_6);
17678                 CHECK_INNER_FIELD_ACCESS_OR_NULL(_res_conv_6_conv);
17679                 _res_constr.data[g] = _res_conv_6_conv;
17680         }
17681         FREE(_res);
17682         CVec_PathZ_free(_res_constr);
17683 }
17684
17685 uint64_t  __attribute__((export_name("TS_CResult_RouteDecodeErrorZ_ok"))) TS_CResult_RouteDecodeErrorZ_ok(uint64_t o) {
17686         LDKRoute o_conv;
17687         o_conv.inner = untag_ptr(o);
17688         o_conv.is_owned = ptr_is_owned(o);
17689         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
17690         o_conv = Route_clone(&o_conv);
17691         LDKCResult_RouteDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteDecodeErrorZ), "LDKCResult_RouteDecodeErrorZ");
17692         *ret_conv = CResult_RouteDecodeErrorZ_ok(o_conv);
17693         return tag_ptr(ret_conv, true);
17694 }
17695
17696 uint64_t  __attribute__((export_name("TS_CResult_RouteDecodeErrorZ_err"))) TS_CResult_RouteDecodeErrorZ_err(uint64_t e) {
17697         void* e_ptr = untag_ptr(e);
17698         CHECK_ACCESS(e_ptr);
17699         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
17700         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
17701         LDKCResult_RouteDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteDecodeErrorZ), "LDKCResult_RouteDecodeErrorZ");
17702         *ret_conv = CResult_RouteDecodeErrorZ_err(e_conv);
17703         return tag_ptr(ret_conv, true);
17704 }
17705
17706 jboolean  __attribute__((export_name("TS_CResult_RouteDecodeErrorZ_is_ok"))) TS_CResult_RouteDecodeErrorZ_is_ok(uint64_t o) {
17707         LDKCResult_RouteDecodeErrorZ* o_conv = (LDKCResult_RouteDecodeErrorZ*)untag_ptr(o);
17708         jboolean ret_conv = CResult_RouteDecodeErrorZ_is_ok(o_conv);
17709         return ret_conv;
17710 }
17711
17712 void  __attribute__((export_name("TS_CResult_RouteDecodeErrorZ_free"))) TS_CResult_RouteDecodeErrorZ_free(uint64_t _res) {
17713         if (!ptr_is_owned(_res)) return;
17714         void* _res_ptr = untag_ptr(_res);
17715         CHECK_ACCESS(_res_ptr);
17716         LDKCResult_RouteDecodeErrorZ _res_conv = *(LDKCResult_RouteDecodeErrorZ*)(_res_ptr);
17717         FREE(untag_ptr(_res));
17718         CResult_RouteDecodeErrorZ_free(_res_conv);
17719 }
17720
17721 static inline uint64_t CResult_RouteDecodeErrorZ_clone_ptr(LDKCResult_RouteDecodeErrorZ *NONNULL_PTR arg) {
17722         LDKCResult_RouteDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteDecodeErrorZ), "LDKCResult_RouteDecodeErrorZ");
17723         *ret_conv = CResult_RouteDecodeErrorZ_clone(arg);
17724         return tag_ptr(ret_conv, true);
17725 }
17726 int64_t  __attribute__((export_name("TS_CResult_RouteDecodeErrorZ_clone_ptr"))) TS_CResult_RouteDecodeErrorZ_clone_ptr(uint64_t arg) {
17727         LDKCResult_RouteDecodeErrorZ* arg_conv = (LDKCResult_RouteDecodeErrorZ*)untag_ptr(arg);
17728         int64_t ret_conv = CResult_RouteDecodeErrorZ_clone_ptr(arg_conv);
17729         return ret_conv;
17730 }
17731
17732 uint64_t  __attribute__((export_name("TS_CResult_RouteDecodeErrorZ_clone"))) TS_CResult_RouteDecodeErrorZ_clone(uint64_t orig) {
17733         LDKCResult_RouteDecodeErrorZ* orig_conv = (LDKCResult_RouteDecodeErrorZ*)untag_ptr(orig);
17734         LDKCResult_RouteDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteDecodeErrorZ), "LDKCResult_RouteDecodeErrorZ");
17735         *ret_conv = CResult_RouteDecodeErrorZ_clone(orig_conv);
17736         return tag_ptr(ret_conv, true);
17737 }
17738
17739 uint64_t  __attribute__((export_name("TS_CResult_RouteParametersDecodeErrorZ_ok"))) TS_CResult_RouteParametersDecodeErrorZ_ok(uint64_t o) {
17740         LDKRouteParameters o_conv;
17741         o_conv.inner = untag_ptr(o);
17742         o_conv.is_owned = ptr_is_owned(o);
17743         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
17744         o_conv = RouteParameters_clone(&o_conv);
17745         LDKCResult_RouteParametersDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteParametersDecodeErrorZ), "LDKCResult_RouteParametersDecodeErrorZ");
17746         *ret_conv = CResult_RouteParametersDecodeErrorZ_ok(o_conv);
17747         return tag_ptr(ret_conv, true);
17748 }
17749
17750 uint64_t  __attribute__((export_name("TS_CResult_RouteParametersDecodeErrorZ_err"))) TS_CResult_RouteParametersDecodeErrorZ_err(uint64_t e) {
17751         void* e_ptr = untag_ptr(e);
17752         CHECK_ACCESS(e_ptr);
17753         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
17754         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
17755         LDKCResult_RouteParametersDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteParametersDecodeErrorZ), "LDKCResult_RouteParametersDecodeErrorZ");
17756         *ret_conv = CResult_RouteParametersDecodeErrorZ_err(e_conv);
17757         return tag_ptr(ret_conv, true);
17758 }
17759
17760 jboolean  __attribute__((export_name("TS_CResult_RouteParametersDecodeErrorZ_is_ok"))) TS_CResult_RouteParametersDecodeErrorZ_is_ok(uint64_t o) {
17761         LDKCResult_RouteParametersDecodeErrorZ* o_conv = (LDKCResult_RouteParametersDecodeErrorZ*)untag_ptr(o);
17762         jboolean ret_conv = CResult_RouteParametersDecodeErrorZ_is_ok(o_conv);
17763         return ret_conv;
17764 }
17765
17766 void  __attribute__((export_name("TS_CResult_RouteParametersDecodeErrorZ_free"))) TS_CResult_RouteParametersDecodeErrorZ_free(uint64_t _res) {
17767         if (!ptr_is_owned(_res)) return;
17768         void* _res_ptr = untag_ptr(_res);
17769         CHECK_ACCESS(_res_ptr);
17770         LDKCResult_RouteParametersDecodeErrorZ _res_conv = *(LDKCResult_RouteParametersDecodeErrorZ*)(_res_ptr);
17771         FREE(untag_ptr(_res));
17772         CResult_RouteParametersDecodeErrorZ_free(_res_conv);
17773 }
17774
17775 static inline uint64_t CResult_RouteParametersDecodeErrorZ_clone_ptr(LDKCResult_RouteParametersDecodeErrorZ *NONNULL_PTR arg) {
17776         LDKCResult_RouteParametersDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteParametersDecodeErrorZ), "LDKCResult_RouteParametersDecodeErrorZ");
17777         *ret_conv = CResult_RouteParametersDecodeErrorZ_clone(arg);
17778         return tag_ptr(ret_conv, true);
17779 }
17780 int64_t  __attribute__((export_name("TS_CResult_RouteParametersDecodeErrorZ_clone_ptr"))) TS_CResult_RouteParametersDecodeErrorZ_clone_ptr(uint64_t arg) {
17781         LDKCResult_RouteParametersDecodeErrorZ* arg_conv = (LDKCResult_RouteParametersDecodeErrorZ*)untag_ptr(arg);
17782         int64_t ret_conv = CResult_RouteParametersDecodeErrorZ_clone_ptr(arg_conv);
17783         return ret_conv;
17784 }
17785
17786 uint64_t  __attribute__((export_name("TS_CResult_RouteParametersDecodeErrorZ_clone"))) TS_CResult_RouteParametersDecodeErrorZ_clone(uint64_t orig) {
17787         LDKCResult_RouteParametersDecodeErrorZ* orig_conv = (LDKCResult_RouteParametersDecodeErrorZ*)untag_ptr(orig);
17788         LDKCResult_RouteParametersDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteParametersDecodeErrorZ), "LDKCResult_RouteParametersDecodeErrorZ");
17789         *ret_conv = CResult_RouteParametersDecodeErrorZ_clone(orig_conv);
17790         return tag_ptr(ret_conv, true);
17791 }
17792
17793 void  __attribute__((export_name("TS_CVec_u64Z_free"))) TS_CVec_u64Z_free(int64_tArray _res) {
17794         LDKCVec_u64Z _res_constr;
17795         _res_constr.datalen = _res->arr_len;
17796         if (_res_constr.datalen > 0)
17797                 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(int64_t), "LDKCVec_u64Z Elements");
17798         else
17799                 _res_constr.data = NULL;
17800         int64_t* _res_vals = _res->elems;
17801         for (size_t i = 0; i < _res_constr.datalen; i++) {
17802                 int64_t _res_conv_8 = _res_vals[i];
17803                 _res_constr.data[i] = _res_conv_8;
17804         }
17805         FREE(_res);
17806         CVec_u64Z_free(_res_constr);
17807 }
17808
17809 uint64_t  __attribute__((export_name("TS_CResult_PaymentParametersDecodeErrorZ_ok"))) TS_CResult_PaymentParametersDecodeErrorZ_ok(uint64_t o) {
17810         LDKPaymentParameters o_conv;
17811         o_conv.inner = untag_ptr(o);
17812         o_conv.is_owned = ptr_is_owned(o);
17813         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
17814         o_conv = PaymentParameters_clone(&o_conv);
17815         LDKCResult_PaymentParametersDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PaymentParametersDecodeErrorZ), "LDKCResult_PaymentParametersDecodeErrorZ");
17816         *ret_conv = CResult_PaymentParametersDecodeErrorZ_ok(o_conv);
17817         return tag_ptr(ret_conv, true);
17818 }
17819
17820 uint64_t  __attribute__((export_name("TS_CResult_PaymentParametersDecodeErrorZ_err"))) TS_CResult_PaymentParametersDecodeErrorZ_err(uint64_t e) {
17821         void* e_ptr = untag_ptr(e);
17822         CHECK_ACCESS(e_ptr);
17823         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
17824         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
17825         LDKCResult_PaymentParametersDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PaymentParametersDecodeErrorZ), "LDKCResult_PaymentParametersDecodeErrorZ");
17826         *ret_conv = CResult_PaymentParametersDecodeErrorZ_err(e_conv);
17827         return tag_ptr(ret_conv, true);
17828 }
17829
17830 jboolean  __attribute__((export_name("TS_CResult_PaymentParametersDecodeErrorZ_is_ok"))) TS_CResult_PaymentParametersDecodeErrorZ_is_ok(uint64_t o) {
17831         LDKCResult_PaymentParametersDecodeErrorZ* o_conv = (LDKCResult_PaymentParametersDecodeErrorZ*)untag_ptr(o);
17832         jboolean ret_conv = CResult_PaymentParametersDecodeErrorZ_is_ok(o_conv);
17833         return ret_conv;
17834 }
17835
17836 void  __attribute__((export_name("TS_CResult_PaymentParametersDecodeErrorZ_free"))) TS_CResult_PaymentParametersDecodeErrorZ_free(uint64_t _res) {
17837         if (!ptr_is_owned(_res)) return;
17838         void* _res_ptr = untag_ptr(_res);
17839         CHECK_ACCESS(_res_ptr);
17840         LDKCResult_PaymentParametersDecodeErrorZ _res_conv = *(LDKCResult_PaymentParametersDecodeErrorZ*)(_res_ptr);
17841         FREE(untag_ptr(_res));
17842         CResult_PaymentParametersDecodeErrorZ_free(_res_conv);
17843 }
17844
17845 static inline uint64_t CResult_PaymentParametersDecodeErrorZ_clone_ptr(LDKCResult_PaymentParametersDecodeErrorZ *NONNULL_PTR arg) {
17846         LDKCResult_PaymentParametersDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PaymentParametersDecodeErrorZ), "LDKCResult_PaymentParametersDecodeErrorZ");
17847         *ret_conv = CResult_PaymentParametersDecodeErrorZ_clone(arg);
17848         return tag_ptr(ret_conv, true);
17849 }
17850 int64_t  __attribute__((export_name("TS_CResult_PaymentParametersDecodeErrorZ_clone_ptr"))) TS_CResult_PaymentParametersDecodeErrorZ_clone_ptr(uint64_t arg) {
17851         LDKCResult_PaymentParametersDecodeErrorZ* arg_conv = (LDKCResult_PaymentParametersDecodeErrorZ*)untag_ptr(arg);
17852         int64_t ret_conv = CResult_PaymentParametersDecodeErrorZ_clone_ptr(arg_conv);
17853         return ret_conv;
17854 }
17855
17856 uint64_t  __attribute__((export_name("TS_CResult_PaymentParametersDecodeErrorZ_clone"))) TS_CResult_PaymentParametersDecodeErrorZ_clone(uint64_t orig) {
17857         LDKCResult_PaymentParametersDecodeErrorZ* orig_conv = (LDKCResult_PaymentParametersDecodeErrorZ*)untag_ptr(orig);
17858         LDKCResult_PaymentParametersDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PaymentParametersDecodeErrorZ), "LDKCResult_PaymentParametersDecodeErrorZ");
17859         *ret_conv = CResult_PaymentParametersDecodeErrorZ_clone(orig_conv);
17860         return tag_ptr(ret_conv, true);
17861 }
17862
17863 static inline uint64_t C2Tuple_BlindedPayInfoBlindedPathZ_clone_ptr(LDKC2Tuple_BlindedPayInfoBlindedPathZ *NONNULL_PTR arg) {
17864         LDKC2Tuple_BlindedPayInfoBlindedPathZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_BlindedPayInfoBlindedPathZ), "LDKC2Tuple_BlindedPayInfoBlindedPathZ");
17865         *ret_conv = C2Tuple_BlindedPayInfoBlindedPathZ_clone(arg);
17866         return tag_ptr(ret_conv, true);
17867 }
17868 int64_t  __attribute__((export_name("TS_C2Tuple_BlindedPayInfoBlindedPathZ_clone_ptr"))) TS_C2Tuple_BlindedPayInfoBlindedPathZ_clone_ptr(uint64_t arg) {
17869         LDKC2Tuple_BlindedPayInfoBlindedPathZ* arg_conv = (LDKC2Tuple_BlindedPayInfoBlindedPathZ*)untag_ptr(arg);
17870         int64_t ret_conv = C2Tuple_BlindedPayInfoBlindedPathZ_clone_ptr(arg_conv);
17871         return ret_conv;
17872 }
17873
17874 uint64_t  __attribute__((export_name("TS_C2Tuple_BlindedPayInfoBlindedPathZ_clone"))) TS_C2Tuple_BlindedPayInfoBlindedPathZ_clone(uint64_t orig) {
17875         LDKC2Tuple_BlindedPayInfoBlindedPathZ* orig_conv = (LDKC2Tuple_BlindedPayInfoBlindedPathZ*)untag_ptr(orig);
17876         LDKC2Tuple_BlindedPayInfoBlindedPathZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_BlindedPayInfoBlindedPathZ), "LDKC2Tuple_BlindedPayInfoBlindedPathZ");
17877         *ret_conv = C2Tuple_BlindedPayInfoBlindedPathZ_clone(orig_conv);
17878         return tag_ptr(ret_conv, true);
17879 }
17880
17881 uint64_t  __attribute__((export_name("TS_C2Tuple_BlindedPayInfoBlindedPathZ_new"))) TS_C2Tuple_BlindedPayInfoBlindedPathZ_new(uint64_t a, uint64_t b) {
17882         LDKBlindedPayInfo a_conv;
17883         a_conv.inner = untag_ptr(a);
17884         a_conv.is_owned = ptr_is_owned(a);
17885         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
17886         a_conv = BlindedPayInfo_clone(&a_conv);
17887         LDKBlindedPath b_conv;
17888         b_conv.inner = untag_ptr(b);
17889         b_conv.is_owned = ptr_is_owned(b);
17890         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
17891         b_conv = BlindedPath_clone(&b_conv);
17892         LDKC2Tuple_BlindedPayInfoBlindedPathZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_BlindedPayInfoBlindedPathZ), "LDKC2Tuple_BlindedPayInfoBlindedPathZ");
17893         *ret_conv = C2Tuple_BlindedPayInfoBlindedPathZ_new(a_conv, b_conv);
17894         return tag_ptr(ret_conv, true);
17895 }
17896
17897 void  __attribute__((export_name("TS_C2Tuple_BlindedPayInfoBlindedPathZ_free"))) TS_C2Tuple_BlindedPayInfoBlindedPathZ_free(uint64_t _res) {
17898         if (!ptr_is_owned(_res)) return;
17899         void* _res_ptr = untag_ptr(_res);
17900         CHECK_ACCESS(_res_ptr);
17901         LDKC2Tuple_BlindedPayInfoBlindedPathZ _res_conv = *(LDKC2Tuple_BlindedPayInfoBlindedPathZ*)(_res_ptr);
17902         FREE(untag_ptr(_res));
17903         C2Tuple_BlindedPayInfoBlindedPathZ_free(_res_conv);
17904 }
17905
17906 void  __attribute__((export_name("TS_CVec_C2Tuple_BlindedPayInfoBlindedPathZZ_free"))) TS_CVec_C2Tuple_BlindedPayInfoBlindedPathZZ_free(uint64_tArray _res) {
17907         LDKCVec_C2Tuple_BlindedPayInfoBlindedPathZZ _res_constr;
17908         _res_constr.datalen = _res->arr_len;
17909         if (_res_constr.datalen > 0)
17910                 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKC2Tuple_BlindedPayInfoBlindedPathZ), "LDKCVec_C2Tuple_BlindedPayInfoBlindedPathZZ Elements");
17911         else
17912                 _res_constr.data = NULL;
17913         uint64_t* _res_vals = _res->elems;
17914         for (size_t l = 0; l < _res_constr.datalen; l++) {
17915                 uint64_t _res_conv_37 = _res_vals[l];
17916                 void* _res_conv_37_ptr = untag_ptr(_res_conv_37);
17917                 CHECK_ACCESS(_res_conv_37_ptr);
17918                 LDKC2Tuple_BlindedPayInfoBlindedPathZ _res_conv_37_conv = *(LDKC2Tuple_BlindedPayInfoBlindedPathZ*)(_res_conv_37_ptr);
17919                 FREE(untag_ptr(_res_conv_37));
17920                 _res_constr.data[l] = _res_conv_37_conv;
17921         }
17922         FREE(_res);
17923         CVec_C2Tuple_BlindedPayInfoBlindedPathZZ_free(_res_constr);
17924 }
17925
17926 void  __attribute__((export_name("TS_CVec_RouteHintZ_free"))) TS_CVec_RouteHintZ_free(uint64_tArray _res) {
17927         LDKCVec_RouteHintZ _res_constr;
17928         _res_constr.datalen = _res->arr_len;
17929         if (_res_constr.datalen > 0)
17930                 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKRouteHint), "LDKCVec_RouteHintZ Elements");
17931         else
17932                 _res_constr.data = NULL;
17933         uint64_t* _res_vals = _res->elems;
17934         for (size_t l = 0; l < _res_constr.datalen; l++) {
17935                 uint64_t _res_conv_11 = _res_vals[l];
17936                 LDKRouteHint _res_conv_11_conv;
17937                 _res_conv_11_conv.inner = untag_ptr(_res_conv_11);
17938                 _res_conv_11_conv.is_owned = ptr_is_owned(_res_conv_11);
17939                 CHECK_INNER_FIELD_ACCESS_OR_NULL(_res_conv_11_conv);
17940                 _res_constr.data[l] = _res_conv_11_conv;
17941         }
17942         FREE(_res);
17943         CVec_RouteHintZ_free(_res_constr);
17944 }
17945
17946 void  __attribute__((export_name("TS_CVec_RouteHintHopZ_free"))) TS_CVec_RouteHintHopZ_free(uint64_tArray _res) {
17947         LDKCVec_RouteHintHopZ _res_constr;
17948         _res_constr.datalen = _res->arr_len;
17949         if (_res_constr.datalen > 0)
17950                 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKRouteHintHop), "LDKCVec_RouteHintHopZ Elements");
17951         else
17952                 _res_constr.data = NULL;
17953         uint64_t* _res_vals = _res->elems;
17954         for (size_t o = 0; o < _res_constr.datalen; o++) {
17955                 uint64_t _res_conv_14 = _res_vals[o];
17956                 LDKRouteHintHop _res_conv_14_conv;
17957                 _res_conv_14_conv.inner = untag_ptr(_res_conv_14);
17958                 _res_conv_14_conv.is_owned = ptr_is_owned(_res_conv_14);
17959                 CHECK_INNER_FIELD_ACCESS_OR_NULL(_res_conv_14_conv);
17960                 _res_constr.data[o] = _res_conv_14_conv;
17961         }
17962         FREE(_res);
17963         CVec_RouteHintHopZ_free(_res_constr);
17964 }
17965
17966 uint64_t  __attribute__((export_name("TS_CResult_RouteHintDecodeErrorZ_ok"))) TS_CResult_RouteHintDecodeErrorZ_ok(uint64_t o) {
17967         LDKRouteHint o_conv;
17968         o_conv.inner = untag_ptr(o);
17969         o_conv.is_owned = ptr_is_owned(o);
17970         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
17971         o_conv = RouteHint_clone(&o_conv);
17972         LDKCResult_RouteHintDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteHintDecodeErrorZ), "LDKCResult_RouteHintDecodeErrorZ");
17973         *ret_conv = CResult_RouteHintDecodeErrorZ_ok(o_conv);
17974         return tag_ptr(ret_conv, true);
17975 }
17976
17977 uint64_t  __attribute__((export_name("TS_CResult_RouteHintDecodeErrorZ_err"))) TS_CResult_RouteHintDecodeErrorZ_err(uint64_t e) {
17978         void* e_ptr = untag_ptr(e);
17979         CHECK_ACCESS(e_ptr);
17980         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
17981         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
17982         LDKCResult_RouteHintDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteHintDecodeErrorZ), "LDKCResult_RouteHintDecodeErrorZ");
17983         *ret_conv = CResult_RouteHintDecodeErrorZ_err(e_conv);
17984         return tag_ptr(ret_conv, true);
17985 }
17986
17987 jboolean  __attribute__((export_name("TS_CResult_RouteHintDecodeErrorZ_is_ok"))) TS_CResult_RouteHintDecodeErrorZ_is_ok(uint64_t o) {
17988         LDKCResult_RouteHintDecodeErrorZ* o_conv = (LDKCResult_RouteHintDecodeErrorZ*)untag_ptr(o);
17989         jboolean ret_conv = CResult_RouteHintDecodeErrorZ_is_ok(o_conv);
17990         return ret_conv;
17991 }
17992
17993 void  __attribute__((export_name("TS_CResult_RouteHintDecodeErrorZ_free"))) TS_CResult_RouteHintDecodeErrorZ_free(uint64_t _res) {
17994         if (!ptr_is_owned(_res)) return;
17995         void* _res_ptr = untag_ptr(_res);
17996         CHECK_ACCESS(_res_ptr);
17997         LDKCResult_RouteHintDecodeErrorZ _res_conv = *(LDKCResult_RouteHintDecodeErrorZ*)(_res_ptr);
17998         FREE(untag_ptr(_res));
17999         CResult_RouteHintDecodeErrorZ_free(_res_conv);
18000 }
18001
18002 static inline uint64_t CResult_RouteHintDecodeErrorZ_clone_ptr(LDKCResult_RouteHintDecodeErrorZ *NONNULL_PTR arg) {
18003         LDKCResult_RouteHintDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteHintDecodeErrorZ), "LDKCResult_RouteHintDecodeErrorZ");
18004         *ret_conv = CResult_RouteHintDecodeErrorZ_clone(arg);
18005         return tag_ptr(ret_conv, true);
18006 }
18007 int64_t  __attribute__((export_name("TS_CResult_RouteHintDecodeErrorZ_clone_ptr"))) TS_CResult_RouteHintDecodeErrorZ_clone_ptr(uint64_t arg) {
18008         LDKCResult_RouteHintDecodeErrorZ* arg_conv = (LDKCResult_RouteHintDecodeErrorZ*)untag_ptr(arg);
18009         int64_t ret_conv = CResult_RouteHintDecodeErrorZ_clone_ptr(arg_conv);
18010         return ret_conv;
18011 }
18012
18013 uint64_t  __attribute__((export_name("TS_CResult_RouteHintDecodeErrorZ_clone"))) TS_CResult_RouteHintDecodeErrorZ_clone(uint64_t orig) {
18014         LDKCResult_RouteHintDecodeErrorZ* orig_conv = (LDKCResult_RouteHintDecodeErrorZ*)untag_ptr(orig);
18015         LDKCResult_RouteHintDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteHintDecodeErrorZ), "LDKCResult_RouteHintDecodeErrorZ");
18016         *ret_conv = CResult_RouteHintDecodeErrorZ_clone(orig_conv);
18017         return tag_ptr(ret_conv, true);
18018 }
18019
18020 uint64_t  __attribute__((export_name("TS_CResult_RouteHintHopDecodeErrorZ_ok"))) TS_CResult_RouteHintHopDecodeErrorZ_ok(uint64_t o) {
18021         LDKRouteHintHop o_conv;
18022         o_conv.inner = untag_ptr(o);
18023         o_conv.is_owned = ptr_is_owned(o);
18024         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
18025         o_conv = RouteHintHop_clone(&o_conv);
18026         LDKCResult_RouteHintHopDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteHintHopDecodeErrorZ), "LDKCResult_RouteHintHopDecodeErrorZ");
18027         *ret_conv = CResult_RouteHintHopDecodeErrorZ_ok(o_conv);
18028         return tag_ptr(ret_conv, true);
18029 }
18030
18031 uint64_t  __attribute__((export_name("TS_CResult_RouteHintHopDecodeErrorZ_err"))) TS_CResult_RouteHintHopDecodeErrorZ_err(uint64_t e) {
18032         void* e_ptr = untag_ptr(e);
18033         CHECK_ACCESS(e_ptr);
18034         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
18035         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
18036         LDKCResult_RouteHintHopDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteHintHopDecodeErrorZ), "LDKCResult_RouteHintHopDecodeErrorZ");
18037         *ret_conv = CResult_RouteHintHopDecodeErrorZ_err(e_conv);
18038         return tag_ptr(ret_conv, true);
18039 }
18040
18041 jboolean  __attribute__((export_name("TS_CResult_RouteHintHopDecodeErrorZ_is_ok"))) TS_CResult_RouteHintHopDecodeErrorZ_is_ok(uint64_t o) {
18042         LDKCResult_RouteHintHopDecodeErrorZ* o_conv = (LDKCResult_RouteHintHopDecodeErrorZ*)untag_ptr(o);
18043         jboolean ret_conv = CResult_RouteHintHopDecodeErrorZ_is_ok(o_conv);
18044         return ret_conv;
18045 }
18046
18047 void  __attribute__((export_name("TS_CResult_RouteHintHopDecodeErrorZ_free"))) TS_CResult_RouteHintHopDecodeErrorZ_free(uint64_t _res) {
18048         if (!ptr_is_owned(_res)) return;
18049         void* _res_ptr = untag_ptr(_res);
18050         CHECK_ACCESS(_res_ptr);
18051         LDKCResult_RouteHintHopDecodeErrorZ _res_conv = *(LDKCResult_RouteHintHopDecodeErrorZ*)(_res_ptr);
18052         FREE(untag_ptr(_res));
18053         CResult_RouteHintHopDecodeErrorZ_free(_res_conv);
18054 }
18055
18056 static inline uint64_t CResult_RouteHintHopDecodeErrorZ_clone_ptr(LDKCResult_RouteHintHopDecodeErrorZ *NONNULL_PTR arg) {
18057         LDKCResult_RouteHintHopDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteHintHopDecodeErrorZ), "LDKCResult_RouteHintHopDecodeErrorZ");
18058         *ret_conv = CResult_RouteHintHopDecodeErrorZ_clone(arg);
18059         return tag_ptr(ret_conv, true);
18060 }
18061 int64_t  __attribute__((export_name("TS_CResult_RouteHintHopDecodeErrorZ_clone_ptr"))) TS_CResult_RouteHintHopDecodeErrorZ_clone_ptr(uint64_t arg) {
18062         LDKCResult_RouteHintHopDecodeErrorZ* arg_conv = (LDKCResult_RouteHintHopDecodeErrorZ*)untag_ptr(arg);
18063         int64_t ret_conv = CResult_RouteHintHopDecodeErrorZ_clone_ptr(arg_conv);
18064         return ret_conv;
18065 }
18066
18067 uint64_t  __attribute__((export_name("TS_CResult_RouteHintHopDecodeErrorZ_clone"))) TS_CResult_RouteHintHopDecodeErrorZ_clone(uint64_t orig) {
18068         LDKCResult_RouteHintHopDecodeErrorZ* orig_conv = (LDKCResult_RouteHintHopDecodeErrorZ*)untag_ptr(orig);
18069         LDKCResult_RouteHintHopDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteHintHopDecodeErrorZ), "LDKCResult_RouteHintHopDecodeErrorZ");
18070         *ret_conv = CResult_RouteHintHopDecodeErrorZ_clone(orig_conv);
18071         return tag_ptr(ret_conv, true);
18072 }
18073
18074 void  __attribute__((export_name("TS_CVec_PublicKeyZ_free"))) TS_CVec_PublicKeyZ_free(ptrArray _res) {
18075         LDKCVec_PublicKeyZ _res_constr;
18076         _res_constr.datalen = _res->arr_len;
18077         if (_res_constr.datalen > 0)
18078                 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKPublicKey), "LDKCVec_PublicKeyZ Elements");
18079         else
18080                 _res_constr.data = NULL;
18081         int8_tArray* _res_vals = (void*) _res->elems;
18082         for (size_t m = 0; m < _res_constr.datalen; m++) {
18083                 int8_tArray _res_conv_12 = _res_vals[m];
18084                 LDKPublicKey _res_conv_12_ref;
18085                 CHECK(_res_conv_12->arr_len == 33);
18086                 memcpy(_res_conv_12_ref.compressed_form, _res_conv_12->elems, 33); FREE(_res_conv_12);
18087                 _res_constr.data[m] = _res_conv_12_ref;
18088         }
18089         FREE(_res);
18090         CVec_PublicKeyZ_free(_res_constr);
18091 }
18092
18093 uint64_t  __attribute__((export_name("TS_CResult_FixedPenaltyScorerDecodeErrorZ_ok"))) TS_CResult_FixedPenaltyScorerDecodeErrorZ_ok(uint64_t o) {
18094         LDKFixedPenaltyScorer o_conv;
18095         o_conv.inner = untag_ptr(o);
18096         o_conv.is_owned = ptr_is_owned(o);
18097         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
18098         o_conv = FixedPenaltyScorer_clone(&o_conv);
18099         LDKCResult_FixedPenaltyScorerDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_FixedPenaltyScorerDecodeErrorZ), "LDKCResult_FixedPenaltyScorerDecodeErrorZ");
18100         *ret_conv = CResult_FixedPenaltyScorerDecodeErrorZ_ok(o_conv);
18101         return tag_ptr(ret_conv, true);
18102 }
18103
18104 uint64_t  __attribute__((export_name("TS_CResult_FixedPenaltyScorerDecodeErrorZ_err"))) TS_CResult_FixedPenaltyScorerDecodeErrorZ_err(uint64_t e) {
18105         void* e_ptr = untag_ptr(e);
18106         CHECK_ACCESS(e_ptr);
18107         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
18108         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
18109         LDKCResult_FixedPenaltyScorerDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_FixedPenaltyScorerDecodeErrorZ), "LDKCResult_FixedPenaltyScorerDecodeErrorZ");
18110         *ret_conv = CResult_FixedPenaltyScorerDecodeErrorZ_err(e_conv);
18111         return tag_ptr(ret_conv, true);
18112 }
18113
18114 jboolean  __attribute__((export_name("TS_CResult_FixedPenaltyScorerDecodeErrorZ_is_ok"))) TS_CResult_FixedPenaltyScorerDecodeErrorZ_is_ok(uint64_t o) {
18115         LDKCResult_FixedPenaltyScorerDecodeErrorZ* o_conv = (LDKCResult_FixedPenaltyScorerDecodeErrorZ*)untag_ptr(o);
18116         jboolean ret_conv = CResult_FixedPenaltyScorerDecodeErrorZ_is_ok(o_conv);
18117         return ret_conv;
18118 }
18119
18120 void  __attribute__((export_name("TS_CResult_FixedPenaltyScorerDecodeErrorZ_free"))) TS_CResult_FixedPenaltyScorerDecodeErrorZ_free(uint64_t _res) {
18121         if (!ptr_is_owned(_res)) return;
18122         void* _res_ptr = untag_ptr(_res);
18123         CHECK_ACCESS(_res_ptr);
18124         LDKCResult_FixedPenaltyScorerDecodeErrorZ _res_conv = *(LDKCResult_FixedPenaltyScorerDecodeErrorZ*)(_res_ptr);
18125         FREE(untag_ptr(_res));
18126         CResult_FixedPenaltyScorerDecodeErrorZ_free(_res_conv);
18127 }
18128
18129 static inline uint64_t CResult_FixedPenaltyScorerDecodeErrorZ_clone_ptr(LDKCResult_FixedPenaltyScorerDecodeErrorZ *NONNULL_PTR arg) {
18130         LDKCResult_FixedPenaltyScorerDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_FixedPenaltyScorerDecodeErrorZ), "LDKCResult_FixedPenaltyScorerDecodeErrorZ");
18131         *ret_conv = CResult_FixedPenaltyScorerDecodeErrorZ_clone(arg);
18132         return tag_ptr(ret_conv, true);
18133 }
18134 int64_t  __attribute__((export_name("TS_CResult_FixedPenaltyScorerDecodeErrorZ_clone_ptr"))) TS_CResult_FixedPenaltyScorerDecodeErrorZ_clone_ptr(uint64_t arg) {
18135         LDKCResult_FixedPenaltyScorerDecodeErrorZ* arg_conv = (LDKCResult_FixedPenaltyScorerDecodeErrorZ*)untag_ptr(arg);
18136         int64_t ret_conv = CResult_FixedPenaltyScorerDecodeErrorZ_clone_ptr(arg_conv);
18137         return ret_conv;
18138 }
18139
18140 uint64_t  __attribute__((export_name("TS_CResult_FixedPenaltyScorerDecodeErrorZ_clone"))) TS_CResult_FixedPenaltyScorerDecodeErrorZ_clone(uint64_t orig) {
18141         LDKCResult_FixedPenaltyScorerDecodeErrorZ* orig_conv = (LDKCResult_FixedPenaltyScorerDecodeErrorZ*)untag_ptr(orig);
18142         LDKCResult_FixedPenaltyScorerDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_FixedPenaltyScorerDecodeErrorZ), "LDKCResult_FixedPenaltyScorerDecodeErrorZ");
18143         *ret_conv = CResult_FixedPenaltyScorerDecodeErrorZ_clone(orig_conv);
18144         return tag_ptr(ret_conv, true);
18145 }
18146
18147 void  __attribute__((export_name("TS_CVec_NodeIdZ_free"))) TS_CVec_NodeIdZ_free(uint64_tArray _res) {
18148         LDKCVec_NodeIdZ _res_constr;
18149         _res_constr.datalen = _res->arr_len;
18150         if (_res_constr.datalen > 0)
18151                 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKNodeId), "LDKCVec_NodeIdZ Elements");
18152         else
18153                 _res_constr.data = NULL;
18154         uint64_t* _res_vals = _res->elems;
18155         for (size_t i = 0; i < _res_constr.datalen; i++) {
18156                 uint64_t _res_conv_8 = _res_vals[i];
18157                 LDKNodeId _res_conv_8_conv;
18158                 _res_conv_8_conv.inner = untag_ptr(_res_conv_8);
18159                 _res_conv_8_conv.is_owned = ptr_is_owned(_res_conv_8);
18160                 CHECK_INNER_FIELD_ACCESS_OR_NULL(_res_conv_8_conv);
18161                 _res_constr.data[i] = _res_conv_8_conv;
18162         }
18163         FREE(_res);
18164         CVec_NodeIdZ_free(_res_constr);
18165 }
18166
18167 static inline uint64_t C2Tuple_u64u64Z_clone_ptr(LDKC2Tuple_u64u64Z *NONNULL_PTR arg) {
18168         LDKC2Tuple_u64u64Z* ret_conv = MALLOC(sizeof(LDKC2Tuple_u64u64Z), "LDKC2Tuple_u64u64Z");
18169         *ret_conv = C2Tuple_u64u64Z_clone(arg);
18170         return tag_ptr(ret_conv, true);
18171 }
18172 int64_t  __attribute__((export_name("TS_C2Tuple_u64u64Z_clone_ptr"))) TS_C2Tuple_u64u64Z_clone_ptr(uint64_t arg) {
18173         LDKC2Tuple_u64u64Z* arg_conv = (LDKC2Tuple_u64u64Z*)untag_ptr(arg);
18174         int64_t ret_conv = C2Tuple_u64u64Z_clone_ptr(arg_conv);
18175         return ret_conv;
18176 }
18177
18178 uint64_t  __attribute__((export_name("TS_C2Tuple_u64u64Z_clone"))) TS_C2Tuple_u64u64Z_clone(uint64_t orig) {
18179         LDKC2Tuple_u64u64Z* orig_conv = (LDKC2Tuple_u64u64Z*)untag_ptr(orig);
18180         LDKC2Tuple_u64u64Z* ret_conv = MALLOC(sizeof(LDKC2Tuple_u64u64Z), "LDKC2Tuple_u64u64Z");
18181         *ret_conv = C2Tuple_u64u64Z_clone(orig_conv);
18182         return tag_ptr(ret_conv, true);
18183 }
18184
18185 uint64_t  __attribute__((export_name("TS_C2Tuple_u64u64Z_new"))) TS_C2Tuple_u64u64Z_new(int64_t a, int64_t b) {
18186         LDKC2Tuple_u64u64Z* ret_conv = MALLOC(sizeof(LDKC2Tuple_u64u64Z), "LDKC2Tuple_u64u64Z");
18187         *ret_conv = C2Tuple_u64u64Z_new(a, b);
18188         return tag_ptr(ret_conv, true);
18189 }
18190
18191 void  __attribute__((export_name("TS_C2Tuple_u64u64Z_free"))) TS_C2Tuple_u64u64Z_free(uint64_t _res) {
18192         if (!ptr_is_owned(_res)) return;
18193         void* _res_ptr = untag_ptr(_res);
18194         CHECK_ACCESS(_res_ptr);
18195         LDKC2Tuple_u64u64Z _res_conv = *(LDKC2Tuple_u64u64Z*)(_res_ptr);
18196         FREE(untag_ptr(_res));
18197         C2Tuple_u64u64Z_free(_res_conv);
18198 }
18199
18200 uint64_t  __attribute__((export_name("TS_COption_C2Tuple_u64u64ZZ_some"))) TS_COption_C2Tuple_u64u64ZZ_some(uint64_t o) {
18201         void* o_ptr = untag_ptr(o);
18202         CHECK_ACCESS(o_ptr);
18203         LDKC2Tuple_u64u64Z o_conv = *(LDKC2Tuple_u64u64Z*)(o_ptr);
18204         o_conv = C2Tuple_u64u64Z_clone((LDKC2Tuple_u64u64Z*)untag_ptr(o));
18205         LDKCOption_C2Tuple_u64u64ZZ *ret_copy = MALLOC(sizeof(LDKCOption_C2Tuple_u64u64ZZ), "LDKCOption_C2Tuple_u64u64ZZ");
18206         *ret_copy = COption_C2Tuple_u64u64ZZ_some(o_conv);
18207         uint64_t ret_ref = tag_ptr(ret_copy, true);
18208         return ret_ref;
18209 }
18210
18211 uint64_t  __attribute__((export_name("TS_COption_C2Tuple_u64u64ZZ_none"))) TS_COption_C2Tuple_u64u64ZZ_none() {
18212         LDKCOption_C2Tuple_u64u64ZZ *ret_copy = MALLOC(sizeof(LDKCOption_C2Tuple_u64u64ZZ), "LDKCOption_C2Tuple_u64u64ZZ");
18213         *ret_copy = COption_C2Tuple_u64u64ZZ_none();
18214         uint64_t ret_ref = tag_ptr(ret_copy, true);
18215         return ret_ref;
18216 }
18217
18218 void  __attribute__((export_name("TS_COption_C2Tuple_u64u64ZZ_free"))) TS_COption_C2Tuple_u64u64ZZ_free(uint64_t _res) {
18219         if (!ptr_is_owned(_res)) return;
18220         void* _res_ptr = untag_ptr(_res);
18221         CHECK_ACCESS(_res_ptr);
18222         LDKCOption_C2Tuple_u64u64ZZ _res_conv = *(LDKCOption_C2Tuple_u64u64ZZ*)(_res_ptr);
18223         FREE(untag_ptr(_res));
18224         COption_C2Tuple_u64u64ZZ_free(_res_conv);
18225 }
18226
18227 static inline uint64_t COption_C2Tuple_u64u64ZZ_clone_ptr(LDKCOption_C2Tuple_u64u64ZZ *NONNULL_PTR arg) {
18228         LDKCOption_C2Tuple_u64u64ZZ *ret_copy = MALLOC(sizeof(LDKCOption_C2Tuple_u64u64ZZ), "LDKCOption_C2Tuple_u64u64ZZ");
18229         *ret_copy = COption_C2Tuple_u64u64ZZ_clone(arg);
18230         uint64_t ret_ref = tag_ptr(ret_copy, true);
18231         return ret_ref;
18232 }
18233 int64_t  __attribute__((export_name("TS_COption_C2Tuple_u64u64ZZ_clone_ptr"))) TS_COption_C2Tuple_u64u64ZZ_clone_ptr(uint64_t arg) {
18234         LDKCOption_C2Tuple_u64u64ZZ* arg_conv = (LDKCOption_C2Tuple_u64u64ZZ*)untag_ptr(arg);
18235         int64_t ret_conv = COption_C2Tuple_u64u64ZZ_clone_ptr(arg_conv);
18236         return ret_conv;
18237 }
18238
18239 uint64_t  __attribute__((export_name("TS_COption_C2Tuple_u64u64ZZ_clone"))) TS_COption_C2Tuple_u64u64ZZ_clone(uint64_t orig) {
18240         LDKCOption_C2Tuple_u64u64ZZ* orig_conv = (LDKCOption_C2Tuple_u64u64ZZ*)untag_ptr(orig);
18241         LDKCOption_C2Tuple_u64u64ZZ *ret_copy = MALLOC(sizeof(LDKCOption_C2Tuple_u64u64ZZ), "LDKCOption_C2Tuple_u64u64ZZ");
18242         *ret_copy = COption_C2Tuple_u64u64ZZ_clone(orig_conv);
18243         uint64_t ret_ref = tag_ptr(ret_copy, true);
18244         return ret_ref;
18245 }
18246
18247 uint64_t  __attribute__((export_name("TS_C2Tuple_Z_new"))) TS_C2Tuple_Z_new(int16_tArray a, int16_tArray b) {
18248         LDKThirtyTwoU16s a_ref;
18249         CHECK(a->arr_len == 32);
18250         memcpy(a_ref.data, a->elems, 32 * 2); FREE(a);
18251         LDKThirtyTwoU16s b_ref;
18252         CHECK(b->arr_len == 32);
18253         memcpy(b_ref.data, b->elems, 32 * 2); FREE(b);
18254         LDKC2Tuple_Z* ret_conv = MALLOC(sizeof(LDKC2Tuple_Z), "LDKC2Tuple_Z");
18255         *ret_conv = C2Tuple_Z_new(a_ref, b_ref);
18256         return tag_ptr(ret_conv, true);
18257 }
18258
18259 void  __attribute__((export_name("TS_C2Tuple_Z_free"))) TS_C2Tuple_Z_free(uint64_t _res) {
18260         if (!ptr_is_owned(_res)) return;
18261         void* _res_ptr = untag_ptr(_res);
18262         CHECK_ACCESS(_res_ptr);
18263         LDKC2Tuple_Z _res_conv = *(LDKC2Tuple_Z*)(_res_ptr);
18264         FREE(untag_ptr(_res));
18265         C2Tuple_Z_free(_res_conv);
18266 }
18267
18268 uint64_t  __attribute__((export_name("TS_C2Tuple__u1632_u1632Z_new"))) TS_C2Tuple__u1632_u1632Z_new(int16_tArray a, int16_tArray b) {
18269         LDKThirtyTwoU16s a_ref;
18270         CHECK(a->arr_len == 32);
18271         memcpy(a_ref.data, a->elems, 32 * 2); FREE(a);
18272         LDKThirtyTwoU16s b_ref;
18273         CHECK(b->arr_len == 32);
18274         memcpy(b_ref.data, b->elems, 32 * 2); FREE(b);
18275         LDKC2Tuple__u1632_u1632Z* ret_conv = MALLOC(sizeof(LDKC2Tuple__u1632_u1632Z), "LDKC2Tuple__u1632_u1632Z");
18276         *ret_conv = C2Tuple__u1632_u1632Z_new(a_ref, b_ref);
18277         return tag_ptr(ret_conv, true);
18278 }
18279
18280 void  __attribute__((export_name("TS_C2Tuple__u1632_u1632Z_free"))) TS_C2Tuple__u1632_u1632Z_free(uint64_t _res) {
18281         if (!ptr_is_owned(_res)) return;
18282         void* _res_ptr = untag_ptr(_res);
18283         CHECK_ACCESS(_res_ptr);
18284         LDKC2Tuple__u1632_u1632Z _res_conv = *(LDKC2Tuple__u1632_u1632Z*)(_res_ptr);
18285         FREE(untag_ptr(_res));
18286         C2Tuple__u1632_u1632Z_free(_res_conv);
18287 }
18288
18289 uint64_t  __attribute__((export_name("TS_COption_C2Tuple_ThirtyTwoU16sThirtyTwoU16sZZ_some"))) TS_COption_C2Tuple_ThirtyTwoU16sThirtyTwoU16sZZ_some(uint64_t o) {
18290         void* o_ptr = untag_ptr(o);
18291         CHECK_ACCESS(o_ptr);
18292         LDKC2Tuple__u1632_u1632Z o_conv = *(LDKC2Tuple__u1632_u1632Z*)(o_ptr);
18293         // WARNING: we may need a move here but no clone is available for LDKC2Tuple__u1632_u1632Z
18294         LDKCOption_C2Tuple_ThirtyTwoU16sThirtyTwoU16sZZ *ret_copy = MALLOC(sizeof(LDKCOption_C2Tuple_ThirtyTwoU16sThirtyTwoU16sZZ), "LDKCOption_C2Tuple_ThirtyTwoU16sThirtyTwoU16sZZ");
18295         *ret_copy = COption_C2Tuple_ThirtyTwoU16sThirtyTwoU16sZZ_some(o_conv);
18296         uint64_t ret_ref = tag_ptr(ret_copy, true);
18297         return ret_ref;
18298 }
18299
18300 uint64_t  __attribute__((export_name("TS_COption_C2Tuple_ThirtyTwoU16sThirtyTwoU16sZZ_none"))) TS_COption_C2Tuple_ThirtyTwoU16sThirtyTwoU16sZZ_none() {
18301         LDKCOption_C2Tuple_ThirtyTwoU16sThirtyTwoU16sZZ *ret_copy = MALLOC(sizeof(LDKCOption_C2Tuple_ThirtyTwoU16sThirtyTwoU16sZZ), "LDKCOption_C2Tuple_ThirtyTwoU16sThirtyTwoU16sZZ");
18302         *ret_copy = COption_C2Tuple_ThirtyTwoU16sThirtyTwoU16sZZ_none();
18303         uint64_t ret_ref = tag_ptr(ret_copy, true);
18304         return ret_ref;
18305 }
18306
18307 void  __attribute__((export_name("TS_COption_C2Tuple_ThirtyTwoU16sThirtyTwoU16sZZ_free"))) TS_COption_C2Tuple_ThirtyTwoU16sThirtyTwoU16sZZ_free(uint64_t _res) {
18308         if (!ptr_is_owned(_res)) return;
18309         void* _res_ptr = untag_ptr(_res);
18310         CHECK_ACCESS(_res_ptr);
18311         LDKCOption_C2Tuple_ThirtyTwoU16sThirtyTwoU16sZZ _res_conv = *(LDKCOption_C2Tuple_ThirtyTwoU16sThirtyTwoU16sZZ*)(_res_ptr);
18312         FREE(untag_ptr(_res));
18313         COption_C2Tuple_ThirtyTwoU16sThirtyTwoU16sZZ_free(_res_conv);
18314 }
18315
18316 uint64_t  __attribute__((export_name("TS_COption_f64Z_some"))) TS_COption_f64Z_some(double o) {
18317         LDKCOption_f64Z *ret_copy = MALLOC(sizeof(LDKCOption_f64Z), "LDKCOption_f64Z");
18318         *ret_copy = COption_f64Z_some(o);
18319         uint64_t ret_ref = tag_ptr(ret_copy, true);
18320         return ret_ref;
18321 }
18322
18323 uint64_t  __attribute__((export_name("TS_COption_f64Z_none"))) TS_COption_f64Z_none() {
18324         LDKCOption_f64Z *ret_copy = MALLOC(sizeof(LDKCOption_f64Z), "LDKCOption_f64Z");
18325         *ret_copy = COption_f64Z_none();
18326         uint64_t ret_ref = tag_ptr(ret_copy, true);
18327         return ret_ref;
18328 }
18329
18330 void  __attribute__((export_name("TS_COption_f64Z_free"))) TS_COption_f64Z_free(uint64_t _res) {
18331         if (!ptr_is_owned(_res)) return;
18332         void* _res_ptr = untag_ptr(_res);
18333         CHECK_ACCESS(_res_ptr);
18334         LDKCOption_f64Z _res_conv = *(LDKCOption_f64Z*)(_res_ptr);
18335         FREE(untag_ptr(_res));
18336         COption_f64Z_free(_res_conv);
18337 }
18338
18339 static inline uint64_t COption_f64Z_clone_ptr(LDKCOption_f64Z *NONNULL_PTR arg) {
18340         LDKCOption_f64Z *ret_copy = MALLOC(sizeof(LDKCOption_f64Z), "LDKCOption_f64Z");
18341         *ret_copy = COption_f64Z_clone(arg);
18342         uint64_t ret_ref = tag_ptr(ret_copy, true);
18343         return ret_ref;
18344 }
18345 int64_t  __attribute__((export_name("TS_COption_f64Z_clone_ptr"))) TS_COption_f64Z_clone_ptr(uint64_t arg) {
18346         LDKCOption_f64Z* arg_conv = (LDKCOption_f64Z*)untag_ptr(arg);
18347         int64_t ret_conv = COption_f64Z_clone_ptr(arg_conv);
18348         return ret_conv;
18349 }
18350
18351 uint64_t  __attribute__((export_name("TS_COption_f64Z_clone"))) TS_COption_f64Z_clone(uint64_t orig) {
18352         LDKCOption_f64Z* orig_conv = (LDKCOption_f64Z*)untag_ptr(orig);
18353         LDKCOption_f64Z *ret_copy = MALLOC(sizeof(LDKCOption_f64Z), "LDKCOption_f64Z");
18354         *ret_copy = COption_f64Z_clone(orig_conv);
18355         uint64_t ret_ref = tag_ptr(ret_copy, true);
18356         return ret_ref;
18357 }
18358
18359 uint64_t  __attribute__((export_name("TS_CResult_ProbabilisticScorerDecodeErrorZ_ok"))) TS_CResult_ProbabilisticScorerDecodeErrorZ_ok(uint64_t o) {
18360         LDKProbabilisticScorer o_conv;
18361         o_conv.inner = untag_ptr(o);
18362         o_conv.is_owned = ptr_is_owned(o);
18363         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
18364         // WARNING: we need a move here but no clone is available for LDKProbabilisticScorer
18365         
18366         LDKCResult_ProbabilisticScorerDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ProbabilisticScorerDecodeErrorZ), "LDKCResult_ProbabilisticScorerDecodeErrorZ");
18367         *ret_conv = CResult_ProbabilisticScorerDecodeErrorZ_ok(o_conv);
18368         return tag_ptr(ret_conv, true);
18369 }
18370
18371 uint64_t  __attribute__((export_name("TS_CResult_ProbabilisticScorerDecodeErrorZ_err"))) TS_CResult_ProbabilisticScorerDecodeErrorZ_err(uint64_t e) {
18372         void* e_ptr = untag_ptr(e);
18373         CHECK_ACCESS(e_ptr);
18374         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
18375         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
18376         LDKCResult_ProbabilisticScorerDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ProbabilisticScorerDecodeErrorZ), "LDKCResult_ProbabilisticScorerDecodeErrorZ");
18377         *ret_conv = CResult_ProbabilisticScorerDecodeErrorZ_err(e_conv);
18378         return tag_ptr(ret_conv, true);
18379 }
18380
18381 jboolean  __attribute__((export_name("TS_CResult_ProbabilisticScorerDecodeErrorZ_is_ok"))) TS_CResult_ProbabilisticScorerDecodeErrorZ_is_ok(uint64_t o) {
18382         LDKCResult_ProbabilisticScorerDecodeErrorZ* o_conv = (LDKCResult_ProbabilisticScorerDecodeErrorZ*)untag_ptr(o);
18383         jboolean ret_conv = CResult_ProbabilisticScorerDecodeErrorZ_is_ok(o_conv);
18384         return ret_conv;
18385 }
18386
18387 void  __attribute__((export_name("TS_CResult_ProbabilisticScorerDecodeErrorZ_free"))) TS_CResult_ProbabilisticScorerDecodeErrorZ_free(uint64_t _res) {
18388         if (!ptr_is_owned(_res)) return;
18389         void* _res_ptr = untag_ptr(_res);
18390         CHECK_ACCESS(_res_ptr);
18391         LDKCResult_ProbabilisticScorerDecodeErrorZ _res_conv = *(LDKCResult_ProbabilisticScorerDecodeErrorZ*)(_res_ptr);
18392         FREE(untag_ptr(_res));
18393         CResult_ProbabilisticScorerDecodeErrorZ_free(_res_conv);
18394 }
18395
18396 static inline uint64_t C2Tuple_usizeTransactionZ_clone_ptr(LDKC2Tuple_usizeTransactionZ *NONNULL_PTR arg) {
18397         LDKC2Tuple_usizeTransactionZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_usizeTransactionZ), "LDKC2Tuple_usizeTransactionZ");
18398         *ret_conv = C2Tuple_usizeTransactionZ_clone(arg);
18399         return tag_ptr(ret_conv, true);
18400 }
18401 int64_t  __attribute__((export_name("TS_C2Tuple_usizeTransactionZ_clone_ptr"))) TS_C2Tuple_usizeTransactionZ_clone_ptr(uint64_t arg) {
18402         LDKC2Tuple_usizeTransactionZ* arg_conv = (LDKC2Tuple_usizeTransactionZ*)untag_ptr(arg);
18403         int64_t ret_conv = C2Tuple_usizeTransactionZ_clone_ptr(arg_conv);
18404         return ret_conv;
18405 }
18406
18407 uint64_t  __attribute__((export_name("TS_C2Tuple_usizeTransactionZ_clone"))) TS_C2Tuple_usizeTransactionZ_clone(uint64_t orig) {
18408         LDKC2Tuple_usizeTransactionZ* orig_conv = (LDKC2Tuple_usizeTransactionZ*)untag_ptr(orig);
18409         LDKC2Tuple_usizeTransactionZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_usizeTransactionZ), "LDKC2Tuple_usizeTransactionZ");
18410         *ret_conv = C2Tuple_usizeTransactionZ_clone(orig_conv);
18411         return tag_ptr(ret_conv, true);
18412 }
18413
18414 uint64_t  __attribute__((export_name("TS_C2Tuple_usizeTransactionZ_new"))) TS_C2Tuple_usizeTransactionZ_new(uint32_t a, int8_tArray b) {
18415         LDKTransaction b_ref;
18416         b_ref.datalen = b->arr_len;
18417         b_ref.data = MALLOC(b_ref.datalen, "LDKTransaction Bytes");
18418         memcpy(b_ref.data, b->elems, b_ref.datalen); FREE(b);
18419         b_ref.data_is_owned = true;
18420         LDKC2Tuple_usizeTransactionZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_usizeTransactionZ), "LDKC2Tuple_usizeTransactionZ");
18421         *ret_conv = C2Tuple_usizeTransactionZ_new(a, b_ref);
18422         return tag_ptr(ret_conv, true);
18423 }
18424
18425 void  __attribute__((export_name("TS_C2Tuple_usizeTransactionZ_free"))) TS_C2Tuple_usizeTransactionZ_free(uint64_t _res) {
18426         if (!ptr_is_owned(_res)) return;
18427         void* _res_ptr = untag_ptr(_res);
18428         CHECK_ACCESS(_res_ptr);
18429         LDKC2Tuple_usizeTransactionZ _res_conv = *(LDKC2Tuple_usizeTransactionZ*)(_res_ptr);
18430         FREE(untag_ptr(_res));
18431         C2Tuple_usizeTransactionZ_free(_res_conv);
18432 }
18433
18434 void  __attribute__((export_name("TS_CVec_C2Tuple_usizeTransactionZZ_free"))) TS_CVec_C2Tuple_usizeTransactionZZ_free(uint64_tArray _res) {
18435         LDKCVec_C2Tuple_usizeTransactionZZ _res_constr;
18436         _res_constr.datalen = _res->arr_len;
18437         if (_res_constr.datalen > 0)
18438                 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKC2Tuple_usizeTransactionZ), "LDKCVec_C2Tuple_usizeTransactionZZ Elements");
18439         else
18440                 _res_constr.data = NULL;
18441         uint64_t* _res_vals = _res->elems;
18442         for (size_t c = 0; c < _res_constr.datalen; c++) {
18443                 uint64_t _res_conv_28 = _res_vals[c];
18444                 void* _res_conv_28_ptr = untag_ptr(_res_conv_28);
18445                 CHECK_ACCESS(_res_conv_28_ptr);
18446                 LDKC2Tuple_usizeTransactionZ _res_conv_28_conv = *(LDKC2Tuple_usizeTransactionZ*)(_res_conv_28_ptr);
18447                 FREE(untag_ptr(_res_conv_28));
18448                 _res_constr.data[c] = _res_conv_28_conv;
18449         }
18450         FREE(_res);
18451         CVec_C2Tuple_usizeTransactionZZ_free(_res_constr);
18452 }
18453
18454 static inline uint64_t C2Tuple_ThirtyTwoBytesCOption_ThirtyTwoBytesZZ_clone_ptr(LDKC2Tuple_ThirtyTwoBytesCOption_ThirtyTwoBytesZZ *NONNULL_PTR arg) {
18455         LDKC2Tuple_ThirtyTwoBytesCOption_ThirtyTwoBytesZZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_ThirtyTwoBytesCOption_ThirtyTwoBytesZZ), "LDKC2Tuple_ThirtyTwoBytesCOption_ThirtyTwoBytesZZ");
18456         *ret_conv = C2Tuple_ThirtyTwoBytesCOption_ThirtyTwoBytesZZ_clone(arg);
18457         return tag_ptr(ret_conv, true);
18458 }
18459 int64_t  __attribute__((export_name("TS_C2Tuple_ThirtyTwoBytesCOption_ThirtyTwoBytesZZ_clone_ptr"))) TS_C2Tuple_ThirtyTwoBytesCOption_ThirtyTwoBytesZZ_clone_ptr(uint64_t arg) {
18460         LDKC2Tuple_ThirtyTwoBytesCOption_ThirtyTwoBytesZZ* arg_conv = (LDKC2Tuple_ThirtyTwoBytesCOption_ThirtyTwoBytesZZ*)untag_ptr(arg);
18461         int64_t ret_conv = C2Tuple_ThirtyTwoBytesCOption_ThirtyTwoBytesZZ_clone_ptr(arg_conv);
18462         return ret_conv;
18463 }
18464
18465 uint64_t  __attribute__((export_name("TS_C2Tuple_ThirtyTwoBytesCOption_ThirtyTwoBytesZZ_clone"))) TS_C2Tuple_ThirtyTwoBytesCOption_ThirtyTwoBytesZZ_clone(uint64_t orig) {
18466         LDKC2Tuple_ThirtyTwoBytesCOption_ThirtyTwoBytesZZ* orig_conv = (LDKC2Tuple_ThirtyTwoBytesCOption_ThirtyTwoBytesZZ*)untag_ptr(orig);
18467         LDKC2Tuple_ThirtyTwoBytesCOption_ThirtyTwoBytesZZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_ThirtyTwoBytesCOption_ThirtyTwoBytesZZ), "LDKC2Tuple_ThirtyTwoBytesCOption_ThirtyTwoBytesZZ");
18468         *ret_conv = C2Tuple_ThirtyTwoBytesCOption_ThirtyTwoBytesZZ_clone(orig_conv);
18469         return tag_ptr(ret_conv, true);
18470 }
18471
18472 uint64_t  __attribute__((export_name("TS_C2Tuple_ThirtyTwoBytesCOption_ThirtyTwoBytesZZ_new"))) TS_C2Tuple_ThirtyTwoBytesCOption_ThirtyTwoBytesZZ_new(int8_tArray a, uint64_t b) {
18473         LDKThirtyTwoBytes a_ref;
18474         CHECK(a->arr_len == 32);
18475         memcpy(a_ref.data, a->elems, 32); FREE(a);
18476         void* b_ptr = untag_ptr(b);
18477         CHECK_ACCESS(b_ptr);
18478         LDKCOption_ThirtyTwoBytesZ b_conv = *(LDKCOption_ThirtyTwoBytesZ*)(b_ptr);
18479         b_conv = COption_ThirtyTwoBytesZ_clone((LDKCOption_ThirtyTwoBytesZ*)untag_ptr(b));
18480         LDKC2Tuple_ThirtyTwoBytesCOption_ThirtyTwoBytesZZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_ThirtyTwoBytesCOption_ThirtyTwoBytesZZ), "LDKC2Tuple_ThirtyTwoBytesCOption_ThirtyTwoBytesZZ");
18481         *ret_conv = C2Tuple_ThirtyTwoBytesCOption_ThirtyTwoBytesZZ_new(a_ref, b_conv);
18482         return tag_ptr(ret_conv, true);
18483 }
18484
18485 void  __attribute__((export_name("TS_C2Tuple_ThirtyTwoBytesCOption_ThirtyTwoBytesZZ_free"))) TS_C2Tuple_ThirtyTwoBytesCOption_ThirtyTwoBytesZZ_free(uint64_t _res) {
18486         if (!ptr_is_owned(_res)) return;
18487         void* _res_ptr = untag_ptr(_res);
18488         CHECK_ACCESS(_res_ptr);
18489         LDKC2Tuple_ThirtyTwoBytesCOption_ThirtyTwoBytesZZ _res_conv = *(LDKC2Tuple_ThirtyTwoBytesCOption_ThirtyTwoBytesZZ*)(_res_ptr);
18490         FREE(untag_ptr(_res));
18491         C2Tuple_ThirtyTwoBytesCOption_ThirtyTwoBytesZZ_free(_res_conv);
18492 }
18493
18494 void  __attribute__((export_name("TS_CVec_C2Tuple_ThirtyTwoBytesCOption_ThirtyTwoBytesZZZ_free"))) TS_CVec_C2Tuple_ThirtyTwoBytesCOption_ThirtyTwoBytesZZZ_free(uint64_tArray _res) {
18495         LDKCVec_C2Tuple_ThirtyTwoBytesCOption_ThirtyTwoBytesZZZ _res_constr;
18496         _res_constr.datalen = _res->arr_len;
18497         if (_res_constr.datalen > 0)
18498                 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKC2Tuple_ThirtyTwoBytesCOption_ThirtyTwoBytesZZ), "LDKCVec_C2Tuple_ThirtyTwoBytesCOption_ThirtyTwoBytesZZZ Elements");
18499         else
18500                 _res_constr.data = NULL;
18501         uint64_t* _res_vals = _res->elems;
18502         for (size_t x = 0; x < _res_constr.datalen; x++) {
18503                 uint64_t _res_conv_49 = _res_vals[x];
18504                 void* _res_conv_49_ptr = untag_ptr(_res_conv_49);
18505                 CHECK_ACCESS(_res_conv_49_ptr);
18506                 LDKC2Tuple_ThirtyTwoBytesCOption_ThirtyTwoBytesZZ _res_conv_49_conv = *(LDKC2Tuple_ThirtyTwoBytesCOption_ThirtyTwoBytesZZ*)(_res_conv_49_ptr);
18507                 FREE(untag_ptr(_res_conv_49));
18508                 _res_constr.data[x] = _res_conv_49_conv;
18509         }
18510         FREE(_res);
18511         CVec_C2Tuple_ThirtyTwoBytesCOption_ThirtyTwoBytesZZZ_free(_res_constr);
18512 }
18513
18514 uint64_t  __attribute__((export_name("TS_CResult_ChannelMonitorUpdateStatusNoneZ_ok"))) TS_CResult_ChannelMonitorUpdateStatusNoneZ_ok(uint32_t o) {
18515         LDKChannelMonitorUpdateStatus o_conv = LDKChannelMonitorUpdateStatus_from_js(o);
18516         LDKCResult_ChannelMonitorUpdateStatusNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelMonitorUpdateStatusNoneZ), "LDKCResult_ChannelMonitorUpdateStatusNoneZ");
18517         *ret_conv = CResult_ChannelMonitorUpdateStatusNoneZ_ok(o_conv);
18518         return tag_ptr(ret_conv, true);
18519 }
18520
18521 uint64_t  __attribute__((export_name("TS_CResult_ChannelMonitorUpdateStatusNoneZ_err"))) TS_CResult_ChannelMonitorUpdateStatusNoneZ_err() {
18522         LDKCResult_ChannelMonitorUpdateStatusNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelMonitorUpdateStatusNoneZ), "LDKCResult_ChannelMonitorUpdateStatusNoneZ");
18523         *ret_conv = CResult_ChannelMonitorUpdateStatusNoneZ_err();
18524         return tag_ptr(ret_conv, true);
18525 }
18526
18527 jboolean  __attribute__((export_name("TS_CResult_ChannelMonitorUpdateStatusNoneZ_is_ok"))) TS_CResult_ChannelMonitorUpdateStatusNoneZ_is_ok(uint64_t o) {
18528         LDKCResult_ChannelMonitorUpdateStatusNoneZ* o_conv = (LDKCResult_ChannelMonitorUpdateStatusNoneZ*)untag_ptr(o);
18529         jboolean ret_conv = CResult_ChannelMonitorUpdateStatusNoneZ_is_ok(o_conv);
18530         return ret_conv;
18531 }
18532
18533 void  __attribute__((export_name("TS_CResult_ChannelMonitorUpdateStatusNoneZ_free"))) TS_CResult_ChannelMonitorUpdateStatusNoneZ_free(uint64_t _res) {
18534         if (!ptr_is_owned(_res)) return;
18535         void* _res_ptr = untag_ptr(_res);
18536         CHECK_ACCESS(_res_ptr);
18537         LDKCResult_ChannelMonitorUpdateStatusNoneZ _res_conv = *(LDKCResult_ChannelMonitorUpdateStatusNoneZ*)(_res_ptr);
18538         FREE(untag_ptr(_res));
18539         CResult_ChannelMonitorUpdateStatusNoneZ_free(_res_conv);
18540 }
18541
18542 static inline uint64_t CResult_ChannelMonitorUpdateStatusNoneZ_clone_ptr(LDKCResult_ChannelMonitorUpdateStatusNoneZ *NONNULL_PTR arg) {
18543         LDKCResult_ChannelMonitorUpdateStatusNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelMonitorUpdateStatusNoneZ), "LDKCResult_ChannelMonitorUpdateStatusNoneZ");
18544         *ret_conv = CResult_ChannelMonitorUpdateStatusNoneZ_clone(arg);
18545         return tag_ptr(ret_conv, true);
18546 }
18547 int64_t  __attribute__((export_name("TS_CResult_ChannelMonitorUpdateStatusNoneZ_clone_ptr"))) TS_CResult_ChannelMonitorUpdateStatusNoneZ_clone_ptr(uint64_t arg) {
18548         LDKCResult_ChannelMonitorUpdateStatusNoneZ* arg_conv = (LDKCResult_ChannelMonitorUpdateStatusNoneZ*)untag_ptr(arg);
18549         int64_t ret_conv = CResult_ChannelMonitorUpdateStatusNoneZ_clone_ptr(arg_conv);
18550         return ret_conv;
18551 }
18552
18553 uint64_t  __attribute__((export_name("TS_CResult_ChannelMonitorUpdateStatusNoneZ_clone"))) TS_CResult_ChannelMonitorUpdateStatusNoneZ_clone(uint64_t orig) {
18554         LDKCResult_ChannelMonitorUpdateStatusNoneZ* orig_conv = (LDKCResult_ChannelMonitorUpdateStatusNoneZ*)untag_ptr(orig);
18555         LDKCResult_ChannelMonitorUpdateStatusNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelMonitorUpdateStatusNoneZ), "LDKCResult_ChannelMonitorUpdateStatusNoneZ");
18556         *ret_conv = CResult_ChannelMonitorUpdateStatusNoneZ_clone(orig_conv);
18557         return tag_ptr(ret_conv, true);
18558 }
18559
18560 void  __attribute__((export_name("TS_CVec_MonitorEventZ_free"))) TS_CVec_MonitorEventZ_free(uint64_tArray _res) {
18561         LDKCVec_MonitorEventZ _res_constr;
18562         _res_constr.datalen = _res->arr_len;
18563         if (_res_constr.datalen > 0)
18564                 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKMonitorEvent), "LDKCVec_MonitorEventZ Elements");
18565         else
18566                 _res_constr.data = NULL;
18567         uint64_t* _res_vals = _res->elems;
18568         for (size_t o = 0; o < _res_constr.datalen; o++) {
18569                 uint64_t _res_conv_14 = _res_vals[o];
18570                 void* _res_conv_14_ptr = untag_ptr(_res_conv_14);
18571                 CHECK_ACCESS(_res_conv_14_ptr);
18572                 LDKMonitorEvent _res_conv_14_conv = *(LDKMonitorEvent*)(_res_conv_14_ptr);
18573                 FREE(untag_ptr(_res_conv_14));
18574                 _res_constr.data[o] = _res_conv_14_conv;
18575         }
18576         FREE(_res);
18577         CVec_MonitorEventZ_free(_res_constr);
18578 }
18579
18580 static inline uint64_t C3Tuple_OutPointCVec_MonitorEventZPublicKeyZ_clone_ptr(LDKC3Tuple_OutPointCVec_MonitorEventZPublicKeyZ *NONNULL_PTR arg) {
18581         LDKC3Tuple_OutPointCVec_MonitorEventZPublicKeyZ* ret_conv = MALLOC(sizeof(LDKC3Tuple_OutPointCVec_MonitorEventZPublicKeyZ), "LDKC3Tuple_OutPointCVec_MonitorEventZPublicKeyZ");
18582         *ret_conv = C3Tuple_OutPointCVec_MonitorEventZPublicKeyZ_clone(arg);
18583         return tag_ptr(ret_conv, true);
18584 }
18585 int64_t  __attribute__((export_name("TS_C3Tuple_OutPointCVec_MonitorEventZPublicKeyZ_clone_ptr"))) TS_C3Tuple_OutPointCVec_MonitorEventZPublicKeyZ_clone_ptr(uint64_t arg) {
18586         LDKC3Tuple_OutPointCVec_MonitorEventZPublicKeyZ* arg_conv = (LDKC3Tuple_OutPointCVec_MonitorEventZPublicKeyZ*)untag_ptr(arg);
18587         int64_t ret_conv = C3Tuple_OutPointCVec_MonitorEventZPublicKeyZ_clone_ptr(arg_conv);
18588         return ret_conv;
18589 }
18590
18591 uint64_t  __attribute__((export_name("TS_C3Tuple_OutPointCVec_MonitorEventZPublicKeyZ_clone"))) TS_C3Tuple_OutPointCVec_MonitorEventZPublicKeyZ_clone(uint64_t orig) {
18592         LDKC3Tuple_OutPointCVec_MonitorEventZPublicKeyZ* orig_conv = (LDKC3Tuple_OutPointCVec_MonitorEventZPublicKeyZ*)untag_ptr(orig);
18593         LDKC3Tuple_OutPointCVec_MonitorEventZPublicKeyZ* ret_conv = MALLOC(sizeof(LDKC3Tuple_OutPointCVec_MonitorEventZPublicKeyZ), "LDKC3Tuple_OutPointCVec_MonitorEventZPublicKeyZ");
18594         *ret_conv = C3Tuple_OutPointCVec_MonitorEventZPublicKeyZ_clone(orig_conv);
18595         return tag_ptr(ret_conv, true);
18596 }
18597
18598 uint64_t  __attribute__((export_name("TS_C3Tuple_OutPointCVec_MonitorEventZPublicKeyZ_new"))) TS_C3Tuple_OutPointCVec_MonitorEventZPublicKeyZ_new(uint64_t a, uint64_tArray b, int8_tArray c) {
18599         LDKOutPoint a_conv;
18600         a_conv.inner = untag_ptr(a);
18601         a_conv.is_owned = ptr_is_owned(a);
18602         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
18603         a_conv = OutPoint_clone(&a_conv);
18604         LDKCVec_MonitorEventZ b_constr;
18605         b_constr.datalen = b->arr_len;
18606         if (b_constr.datalen > 0)
18607                 b_constr.data = MALLOC(b_constr.datalen * sizeof(LDKMonitorEvent), "LDKCVec_MonitorEventZ Elements");
18608         else
18609                 b_constr.data = NULL;
18610         uint64_t* b_vals = b->elems;
18611         for (size_t o = 0; o < b_constr.datalen; o++) {
18612                 uint64_t b_conv_14 = b_vals[o];
18613                 void* b_conv_14_ptr = untag_ptr(b_conv_14);
18614                 CHECK_ACCESS(b_conv_14_ptr);
18615                 LDKMonitorEvent b_conv_14_conv = *(LDKMonitorEvent*)(b_conv_14_ptr);
18616                 b_conv_14_conv = MonitorEvent_clone((LDKMonitorEvent*)untag_ptr(b_conv_14));
18617                 b_constr.data[o] = b_conv_14_conv;
18618         }
18619         FREE(b);
18620         LDKPublicKey c_ref;
18621         CHECK(c->arr_len == 33);
18622         memcpy(c_ref.compressed_form, c->elems, 33); FREE(c);
18623         LDKC3Tuple_OutPointCVec_MonitorEventZPublicKeyZ* ret_conv = MALLOC(sizeof(LDKC3Tuple_OutPointCVec_MonitorEventZPublicKeyZ), "LDKC3Tuple_OutPointCVec_MonitorEventZPublicKeyZ");
18624         *ret_conv = C3Tuple_OutPointCVec_MonitorEventZPublicKeyZ_new(a_conv, b_constr, c_ref);
18625         return tag_ptr(ret_conv, true);
18626 }
18627
18628 void  __attribute__((export_name("TS_C3Tuple_OutPointCVec_MonitorEventZPublicKeyZ_free"))) TS_C3Tuple_OutPointCVec_MonitorEventZPublicKeyZ_free(uint64_t _res) {
18629         if (!ptr_is_owned(_res)) return;
18630         void* _res_ptr = untag_ptr(_res);
18631         CHECK_ACCESS(_res_ptr);
18632         LDKC3Tuple_OutPointCVec_MonitorEventZPublicKeyZ _res_conv = *(LDKC3Tuple_OutPointCVec_MonitorEventZPublicKeyZ*)(_res_ptr);
18633         FREE(untag_ptr(_res));
18634         C3Tuple_OutPointCVec_MonitorEventZPublicKeyZ_free(_res_conv);
18635 }
18636
18637 void  __attribute__((export_name("TS_CVec_C3Tuple_OutPointCVec_MonitorEventZPublicKeyZZ_free"))) TS_CVec_C3Tuple_OutPointCVec_MonitorEventZPublicKeyZZ_free(uint64_tArray _res) {
18638         LDKCVec_C3Tuple_OutPointCVec_MonitorEventZPublicKeyZZ _res_constr;
18639         _res_constr.datalen = _res->arr_len;
18640         if (_res_constr.datalen > 0)
18641                 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKC3Tuple_OutPointCVec_MonitorEventZPublicKeyZ), "LDKCVec_C3Tuple_OutPointCVec_MonitorEventZPublicKeyZZ Elements");
18642         else
18643                 _res_constr.data = NULL;
18644         uint64_t* _res_vals = _res->elems;
18645         for (size_t x = 0; x < _res_constr.datalen; x++) {
18646                 uint64_t _res_conv_49 = _res_vals[x];
18647                 void* _res_conv_49_ptr = untag_ptr(_res_conv_49);
18648                 CHECK_ACCESS(_res_conv_49_ptr);
18649                 LDKC3Tuple_OutPointCVec_MonitorEventZPublicKeyZ _res_conv_49_conv = *(LDKC3Tuple_OutPointCVec_MonitorEventZPublicKeyZ*)(_res_conv_49_ptr);
18650                 FREE(untag_ptr(_res_conv_49));
18651                 _res_constr.data[x] = _res_conv_49_conv;
18652         }
18653         FREE(_res);
18654         CVec_C3Tuple_OutPointCVec_MonitorEventZPublicKeyZZ_free(_res_constr);
18655 }
18656
18657 uint64_t  __attribute__((export_name("TS_CResult_InitFeaturesDecodeErrorZ_ok"))) TS_CResult_InitFeaturesDecodeErrorZ_ok(uint64_t o) {
18658         LDKInitFeatures o_conv;
18659         o_conv.inner = untag_ptr(o);
18660         o_conv.is_owned = ptr_is_owned(o);
18661         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
18662         o_conv = InitFeatures_clone(&o_conv);
18663         LDKCResult_InitFeaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InitFeaturesDecodeErrorZ), "LDKCResult_InitFeaturesDecodeErrorZ");
18664         *ret_conv = CResult_InitFeaturesDecodeErrorZ_ok(o_conv);
18665         return tag_ptr(ret_conv, true);
18666 }
18667
18668 uint64_t  __attribute__((export_name("TS_CResult_InitFeaturesDecodeErrorZ_err"))) TS_CResult_InitFeaturesDecodeErrorZ_err(uint64_t e) {
18669         void* e_ptr = untag_ptr(e);
18670         CHECK_ACCESS(e_ptr);
18671         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
18672         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
18673         LDKCResult_InitFeaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InitFeaturesDecodeErrorZ), "LDKCResult_InitFeaturesDecodeErrorZ");
18674         *ret_conv = CResult_InitFeaturesDecodeErrorZ_err(e_conv);
18675         return tag_ptr(ret_conv, true);
18676 }
18677
18678 jboolean  __attribute__((export_name("TS_CResult_InitFeaturesDecodeErrorZ_is_ok"))) TS_CResult_InitFeaturesDecodeErrorZ_is_ok(uint64_t o) {
18679         LDKCResult_InitFeaturesDecodeErrorZ* o_conv = (LDKCResult_InitFeaturesDecodeErrorZ*)untag_ptr(o);
18680         jboolean ret_conv = CResult_InitFeaturesDecodeErrorZ_is_ok(o_conv);
18681         return ret_conv;
18682 }
18683
18684 void  __attribute__((export_name("TS_CResult_InitFeaturesDecodeErrorZ_free"))) TS_CResult_InitFeaturesDecodeErrorZ_free(uint64_t _res) {
18685         if (!ptr_is_owned(_res)) return;
18686         void* _res_ptr = untag_ptr(_res);
18687         CHECK_ACCESS(_res_ptr);
18688         LDKCResult_InitFeaturesDecodeErrorZ _res_conv = *(LDKCResult_InitFeaturesDecodeErrorZ*)(_res_ptr);
18689         FREE(untag_ptr(_res));
18690         CResult_InitFeaturesDecodeErrorZ_free(_res_conv);
18691 }
18692
18693 static inline uint64_t CResult_InitFeaturesDecodeErrorZ_clone_ptr(LDKCResult_InitFeaturesDecodeErrorZ *NONNULL_PTR arg) {
18694         LDKCResult_InitFeaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InitFeaturesDecodeErrorZ), "LDKCResult_InitFeaturesDecodeErrorZ");
18695         *ret_conv = CResult_InitFeaturesDecodeErrorZ_clone(arg);
18696         return tag_ptr(ret_conv, true);
18697 }
18698 int64_t  __attribute__((export_name("TS_CResult_InitFeaturesDecodeErrorZ_clone_ptr"))) TS_CResult_InitFeaturesDecodeErrorZ_clone_ptr(uint64_t arg) {
18699         LDKCResult_InitFeaturesDecodeErrorZ* arg_conv = (LDKCResult_InitFeaturesDecodeErrorZ*)untag_ptr(arg);
18700         int64_t ret_conv = CResult_InitFeaturesDecodeErrorZ_clone_ptr(arg_conv);
18701         return ret_conv;
18702 }
18703
18704 uint64_t  __attribute__((export_name("TS_CResult_InitFeaturesDecodeErrorZ_clone"))) TS_CResult_InitFeaturesDecodeErrorZ_clone(uint64_t orig) {
18705         LDKCResult_InitFeaturesDecodeErrorZ* orig_conv = (LDKCResult_InitFeaturesDecodeErrorZ*)untag_ptr(orig);
18706         LDKCResult_InitFeaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InitFeaturesDecodeErrorZ), "LDKCResult_InitFeaturesDecodeErrorZ");
18707         *ret_conv = CResult_InitFeaturesDecodeErrorZ_clone(orig_conv);
18708         return tag_ptr(ret_conv, true);
18709 }
18710
18711 uint64_t  __attribute__((export_name("TS_CResult_ChannelFeaturesDecodeErrorZ_ok"))) TS_CResult_ChannelFeaturesDecodeErrorZ_ok(uint64_t o) {
18712         LDKChannelFeatures o_conv;
18713         o_conv.inner = untag_ptr(o);
18714         o_conv.is_owned = ptr_is_owned(o);
18715         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
18716         o_conv = ChannelFeatures_clone(&o_conv);
18717         LDKCResult_ChannelFeaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelFeaturesDecodeErrorZ), "LDKCResult_ChannelFeaturesDecodeErrorZ");
18718         *ret_conv = CResult_ChannelFeaturesDecodeErrorZ_ok(o_conv);
18719         return tag_ptr(ret_conv, true);
18720 }
18721
18722 uint64_t  __attribute__((export_name("TS_CResult_ChannelFeaturesDecodeErrorZ_err"))) TS_CResult_ChannelFeaturesDecodeErrorZ_err(uint64_t e) {
18723         void* e_ptr = untag_ptr(e);
18724         CHECK_ACCESS(e_ptr);
18725         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
18726         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
18727         LDKCResult_ChannelFeaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelFeaturesDecodeErrorZ), "LDKCResult_ChannelFeaturesDecodeErrorZ");
18728         *ret_conv = CResult_ChannelFeaturesDecodeErrorZ_err(e_conv);
18729         return tag_ptr(ret_conv, true);
18730 }
18731
18732 jboolean  __attribute__((export_name("TS_CResult_ChannelFeaturesDecodeErrorZ_is_ok"))) TS_CResult_ChannelFeaturesDecodeErrorZ_is_ok(uint64_t o) {
18733         LDKCResult_ChannelFeaturesDecodeErrorZ* o_conv = (LDKCResult_ChannelFeaturesDecodeErrorZ*)untag_ptr(o);
18734         jboolean ret_conv = CResult_ChannelFeaturesDecodeErrorZ_is_ok(o_conv);
18735         return ret_conv;
18736 }
18737
18738 void  __attribute__((export_name("TS_CResult_ChannelFeaturesDecodeErrorZ_free"))) TS_CResult_ChannelFeaturesDecodeErrorZ_free(uint64_t _res) {
18739         if (!ptr_is_owned(_res)) return;
18740         void* _res_ptr = untag_ptr(_res);
18741         CHECK_ACCESS(_res_ptr);
18742         LDKCResult_ChannelFeaturesDecodeErrorZ _res_conv = *(LDKCResult_ChannelFeaturesDecodeErrorZ*)(_res_ptr);
18743         FREE(untag_ptr(_res));
18744         CResult_ChannelFeaturesDecodeErrorZ_free(_res_conv);
18745 }
18746
18747 static inline uint64_t CResult_ChannelFeaturesDecodeErrorZ_clone_ptr(LDKCResult_ChannelFeaturesDecodeErrorZ *NONNULL_PTR arg) {
18748         LDKCResult_ChannelFeaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelFeaturesDecodeErrorZ), "LDKCResult_ChannelFeaturesDecodeErrorZ");
18749         *ret_conv = CResult_ChannelFeaturesDecodeErrorZ_clone(arg);
18750         return tag_ptr(ret_conv, true);
18751 }
18752 int64_t  __attribute__((export_name("TS_CResult_ChannelFeaturesDecodeErrorZ_clone_ptr"))) TS_CResult_ChannelFeaturesDecodeErrorZ_clone_ptr(uint64_t arg) {
18753         LDKCResult_ChannelFeaturesDecodeErrorZ* arg_conv = (LDKCResult_ChannelFeaturesDecodeErrorZ*)untag_ptr(arg);
18754         int64_t ret_conv = CResult_ChannelFeaturesDecodeErrorZ_clone_ptr(arg_conv);
18755         return ret_conv;
18756 }
18757
18758 uint64_t  __attribute__((export_name("TS_CResult_ChannelFeaturesDecodeErrorZ_clone"))) TS_CResult_ChannelFeaturesDecodeErrorZ_clone(uint64_t orig) {
18759         LDKCResult_ChannelFeaturesDecodeErrorZ* orig_conv = (LDKCResult_ChannelFeaturesDecodeErrorZ*)untag_ptr(orig);
18760         LDKCResult_ChannelFeaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelFeaturesDecodeErrorZ), "LDKCResult_ChannelFeaturesDecodeErrorZ");
18761         *ret_conv = CResult_ChannelFeaturesDecodeErrorZ_clone(orig_conv);
18762         return tag_ptr(ret_conv, true);
18763 }
18764
18765 uint64_t  __attribute__((export_name("TS_CResult_NodeFeaturesDecodeErrorZ_ok"))) TS_CResult_NodeFeaturesDecodeErrorZ_ok(uint64_t o) {
18766         LDKNodeFeatures o_conv;
18767         o_conv.inner = untag_ptr(o);
18768         o_conv.is_owned = ptr_is_owned(o);
18769         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
18770         o_conv = NodeFeatures_clone(&o_conv);
18771         LDKCResult_NodeFeaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NodeFeaturesDecodeErrorZ), "LDKCResult_NodeFeaturesDecodeErrorZ");
18772         *ret_conv = CResult_NodeFeaturesDecodeErrorZ_ok(o_conv);
18773         return tag_ptr(ret_conv, true);
18774 }
18775
18776 uint64_t  __attribute__((export_name("TS_CResult_NodeFeaturesDecodeErrorZ_err"))) TS_CResult_NodeFeaturesDecodeErrorZ_err(uint64_t e) {
18777         void* e_ptr = untag_ptr(e);
18778         CHECK_ACCESS(e_ptr);
18779         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
18780         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
18781         LDKCResult_NodeFeaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NodeFeaturesDecodeErrorZ), "LDKCResult_NodeFeaturesDecodeErrorZ");
18782         *ret_conv = CResult_NodeFeaturesDecodeErrorZ_err(e_conv);
18783         return tag_ptr(ret_conv, true);
18784 }
18785
18786 jboolean  __attribute__((export_name("TS_CResult_NodeFeaturesDecodeErrorZ_is_ok"))) TS_CResult_NodeFeaturesDecodeErrorZ_is_ok(uint64_t o) {
18787         LDKCResult_NodeFeaturesDecodeErrorZ* o_conv = (LDKCResult_NodeFeaturesDecodeErrorZ*)untag_ptr(o);
18788         jboolean ret_conv = CResult_NodeFeaturesDecodeErrorZ_is_ok(o_conv);
18789         return ret_conv;
18790 }
18791
18792 void  __attribute__((export_name("TS_CResult_NodeFeaturesDecodeErrorZ_free"))) TS_CResult_NodeFeaturesDecodeErrorZ_free(uint64_t _res) {
18793         if (!ptr_is_owned(_res)) return;
18794         void* _res_ptr = untag_ptr(_res);
18795         CHECK_ACCESS(_res_ptr);
18796         LDKCResult_NodeFeaturesDecodeErrorZ _res_conv = *(LDKCResult_NodeFeaturesDecodeErrorZ*)(_res_ptr);
18797         FREE(untag_ptr(_res));
18798         CResult_NodeFeaturesDecodeErrorZ_free(_res_conv);
18799 }
18800
18801 static inline uint64_t CResult_NodeFeaturesDecodeErrorZ_clone_ptr(LDKCResult_NodeFeaturesDecodeErrorZ *NONNULL_PTR arg) {
18802         LDKCResult_NodeFeaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NodeFeaturesDecodeErrorZ), "LDKCResult_NodeFeaturesDecodeErrorZ");
18803         *ret_conv = CResult_NodeFeaturesDecodeErrorZ_clone(arg);
18804         return tag_ptr(ret_conv, true);
18805 }
18806 int64_t  __attribute__((export_name("TS_CResult_NodeFeaturesDecodeErrorZ_clone_ptr"))) TS_CResult_NodeFeaturesDecodeErrorZ_clone_ptr(uint64_t arg) {
18807         LDKCResult_NodeFeaturesDecodeErrorZ* arg_conv = (LDKCResult_NodeFeaturesDecodeErrorZ*)untag_ptr(arg);
18808         int64_t ret_conv = CResult_NodeFeaturesDecodeErrorZ_clone_ptr(arg_conv);
18809         return ret_conv;
18810 }
18811
18812 uint64_t  __attribute__((export_name("TS_CResult_NodeFeaturesDecodeErrorZ_clone"))) TS_CResult_NodeFeaturesDecodeErrorZ_clone(uint64_t orig) {
18813         LDKCResult_NodeFeaturesDecodeErrorZ* orig_conv = (LDKCResult_NodeFeaturesDecodeErrorZ*)untag_ptr(orig);
18814         LDKCResult_NodeFeaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NodeFeaturesDecodeErrorZ), "LDKCResult_NodeFeaturesDecodeErrorZ");
18815         *ret_conv = CResult_NodeFeaturesDecodeErrorZ_clone(orig_conv);
18816         return tag_ptr(ret_conv, true);
18817 }
18818
18819 uint64_t  __attribute__((export_name("TS_CResult_Bolt11InvoiceFeaturesDecodeErrorZ_ok"))) TS_CResult_Bolt11InvoiceFeaturesDecodeErrorZ_ok(uint64_t o) {
18820         LDKBolt11InvoiceFeatures o_conv;
18821         o_conv.inner = untag_ptr(o);
18822         o_conv.is_owned = ptr_is_owned(o);
18823         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
18824         o_conv = Bolt11InvoiceFeatures_clone(&o_conv);
18825         LDKCResult_Bolt11InvoiceFeaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_Bolt11InvoiceFeaturesDecodeErrorZ), "LDKCResult_Bolt11InvoiceFeaturesDecodeErrorZ");
18826         *ret_conv = CResult_Bolt11InvoiceFeaturesDecodeErrorZ_ok(o_conv);
18827         return tag_ptr(ret_conv, true);
18828 }
18829
18830 uint64_t  __attribute__((export_name("TS_CResult_Bolt11InvoiceFeaturesDecodeErrorZ_err"))) TS_CResult_Bolt11InvoiceFeaturesDecodeErrorZ_err(uint64_t e) {
18831         void* e_ptr = untag_ptr(e);
18832         CHECK_ACCESS(e_ptr);
18833         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
18834         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
18835         LDKCResult_Bolt11InvoiceFeaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_Bolt11InvoiceFeaturesDecodeErrorZ), "LDKCResult_Bolt11InvoiceFeaturesDecodeErrorZ");
18836         *ret_conv = CResult_Bolt11InvoiceFeaturesDecodeErrorZ_err(e_conv);
18837         return tag_ptr(ret_conv, true);
18838 }
18839
18840 jboolean  __attribute__((export_name("TS_CResult_Bolt11InvoiceFeaturesDecodeErrorZ_is_ok"))) TS_CResult_Bolt11InvoiceFeaturesDecodeErrorZ_is_ok(uint64_t o) {
18841         LDKCResult_Bolt11InvoiceFeaturesDecodeErrorZ* o_conv = (LDKCResult_Bolt11InvoiceFeaturesDecodeErrorZ*)untag_ptr(o);
18842         jboolean ret_conv = CResult_Bolt11InvoiceFeaturesDecodeErrorZ_is_ok(o_conv);
18843         return ret_conv;
18844 }
18845
18846 void  __attribute__((export_name("TS_CResult_Bolt11InvoiceFeaturesDecodeErrorZ_free"))) TS_CResult_Bolt11InvoiceFeaturesDecodeErrorZ_free(uint64_t _res) {
18847         if (!ptr_is_owned(_res)) return;
18848         void* _res_ptr = untag_ptr(_res);
18849         CHECK_ACCESS(_res_ptr);
18850         LDKCResult_Bolt11InvoiceFeaturesDecodeErrorZ _res_conv = *(LDKCResult_Bolt11InvoiceFeaturesDecodeErrorZ*)(_res_ptr);
18851         FREE(untag_ptr(_res));
18852         CResult_Bolt11InvoiceFeaturesDecodeErrorZ_free(_res_conv);
18853 }
18854
18855 static inline uint64_t CResult_Bolt11InvoiceFeaturesDecodeErrorZ_clone_ptr(LDKCResult_Bolt11InvoiceFeaturesDecodeErrorZ *NONNULL_PTR arg) {
18856         LDKCResult_Bolt11InvoiceFeaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_Bolt11InvoiceFeaturesDecodeErrorZ), "LDKCResult_Bolt11InvoiceFeaturesDecodeErrorZ");
18857         *ret_conv = CResult_Bolt11InvoiceFeaturesDecodeErrorZ_clone(arg);
18858         return tag_ptr(ret_conv, true);
18859 }
18860 int64_t  __attribute__((export_name("TS_CResult_Bolt11InvoiceFeaturesDecodeErrorZ_clone_ptr"))) TS_CResult_Bolt11InvoiceFeaturesDecodeErrorZ_clone_ptr(uint64_t arg) {
18861         LDKCResult_Bolt11InvoiceFeaturesDecodeErrorZ* arg_conv = (LDKCResult_Bolt11InvoiceFeaturesDecodeErrorZ*)untag_ptr(arg);
18862         int64_t ret_conv = CResult_Bolt11InvoiceFeaturesDecodeErrorZ_clone_ptr(arg_conv);
18863         return ret_conv;
18864 }
18865
18866 uint64_t  __attribute__((export_name("TS_CResult_Bolt11InvoiceFeaturesDecodeErrorZ_clone"))) TS_CResult_Bolt11InvoiceFeaturesDecodeErrorZ_clone(uint64_t orig) {
18867         LDKCResult_Bolt11InvoiceFeaturesDecodeErrorZ* orig_conv = (LDKCResult_Bolt11InvoiceFeaturesDecodeErrorZ*)untag_ptr(orig);
18868         LDKCResult_Bolt11InvoiceFeaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_Bolt11InvoiceFeaturesDecodeErrorZ), "LDKCResult_Bolt11InvoiceFeaturesDecodeErrorZ");
18869         *ret_conv = CResult_Bolt11InvoiceFeaturesDecodeErrorZ_clone(orig_conv);
18870         return tag_ptr(ret_conv, true);
18871 }
18872
18873 uint64_t  __attribute__((export_name("TS_CResult_Bolt12InvoiceFeaturesDecodeErrorZ_ok"))) TS_CResult_Bolt12InvoiceFeaturesDecodeErrorZ_ok(uint64_t o) {
18874         LDKBolt12InvoiceFeatures o_conv;
18875         o_conv.inner = untag_ptr(o);
18876         o_conv.is_owned = ptr_is_owned(o);
18877         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
18878         o_conv = Bolt12InvoiceFeatures_clone(&o_conv);
18879         LDKCResult_Bolt12InvoiceFeaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_Bolt12InvoiceFeaturesDecodeErrorZ), "LDKCResult_Bolt12InvoiceFeaturesDecodeErrorZ");
18880         *ret_conv = CResult_Bolt12InvoiceFeaturesDecodeErrorZ_ok(o_conv);
18881         return tag_ptr(ret_conv, true);
18882 }
18883
18884 uint64_t  __attribute__((export_name("TS_CResult_Bolt12InvoiceFeaturesDecodeErrorZ_err"))) TS_CResult_Bolt12InvoiceFeaturesDecodeErrorZ_err(uint64_t e) {
18885         void* e_ptr = untag_ptr(e);
18886         CHECK_ACCESS(e_ptr);
18887         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
18888         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
18889         LDKCResult_Bolt12InvoiceFeaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_Bolt12InvoiceFeaturesDecodeErrorZ), "LDKCResult_Bolt12InvoiceFeaturesDecodeErrorZ");
18890         *ret_conv = CResult_Bolt12InvoiceFeaturesDecodeErrorZ_err(e_conv);
18891         return tag_ptr(ret_conv, true);
18892 }
18893
18894 jboolean  __attribute__((export_name("TS_CResult_Bolt12InvoiceFeaturesDecodeErrorZ_is_ok"))) TS_CResult_Bolt12InvoiceFeaturesDecodeErrorZ_is_ok(uint64_t o) {
18895         LDKCResult_Bolt12InvoiceFeaturesDecodeErrorZ* o_conv = (LDKCResult_Bolt12InvoiceFeaturesDecodeErrorZ*)untag_ptr(o);
18896         jboolean ret_conv = CResult_Bolt12InvoiceFeaturesDecodeErrorZ_is_ok(o_conv);
18897         return ret_conv;
18898 }
18899
18900 void  __attribute__((export_name("TS_CResult_Bolt12InvoiceFeaturesDecodeErrorZ_free"))) TS_CResult_Bolt12InvoiceFeaturesDecodeErrorZ_free(uint64_t _res) {
18901         if (!ptr_is_owned(_res)) return;
18902         void* _res_ptr = untag_ptr(_res);
18903         CHECK_ACCESS(_res_ptr);
18904         LDKCResult_Bolt12InvoiceFeaturesDecodeErrorZ _res_conv = *(LDKCResult_Bolt12InvoiceFeaturesDecodeErrorZ*)(_res_ptr);
18905         FREE(untag_ptr(_res));
18906         CResult_Bolt12InvoiceFeaturesDecodeErrorZ_free(_res_conv);
18907 }
18908
18909 static inline uint64_t CResult_Bolt12InvoiceFeaturesDecodeErrorZ_clone_ptr(LDKCResult_Bolt12InvoiceFeaturesDecodeErrorZ *NONNULL_PTR arg) {
18910         LDKCResult_Bolt12InvoiceFeaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_Bolt12InvoiceFeaturesDecodeErrorZ), "LDKCResult_Bolt12InvoiceFeaturesDecodeErrorZ");
18911         *ret_conv = CResult_Bolt12InvoiceFeaturesDecodeErrorZ_clone(arg);
18912         return tag_ptr(ret_conv, true);
18913 }
18914 int64_t  __attribute__((export_name("TS_CResult_Bolt12InvoiceFeaturesDecodeErrorZ_clone_ptr"))) TS_CResult_Bolt12InvoiceFeaturesDecodeErrorZ_clone_ptr(uint64_t arg) {
18915         LDKCResult_Bolt12InvoiceFeaturesDecodeErrorZ* arg_conv = (LDKCResult_Bolt12InvoiceFeaturesDecodeErrorZ*)untag_ptr(arg);
18916         int64_t ret_conv = CResult_Bolt12InvoiceFeaturesDecodeErrorZ_clone_ptr(arg_conv);
18917         return ret_conv;
18918 }
18919
18920 uint64_t  __attribute__((export_name("TS_CResult_Bolt12InvoiceFeaturesDecodeErrorZ_clone"))) TS_CResult_Bolt12InvoiceFeaturesDecodeErrorZ_clone(uint64_t orig) {
18921         LDKCResult_Bolt12InvoiceFeaturesDecodeErrorZ* orig_conv = (LDKCResult_Bolt12InvoiceFeaturesDecodeErrorZ*)untag_ptr(orig);
18922         LDKCResult_Bolt12InvoiceFeaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_Bolt12InvoiceFeaturesDecodeErrorZ), "LDKCResult_Bolt12InvoiceFeaturesDecodeErrorZ");
18923         *ret_conv = CResult_Bolt12InvoiceFeaturesDecodeErrorZ_clone(orig_conv);
18924         return tag_ptr(ret_conv, true);
18925 }
18926
18927 uint64_t  __attribute__((export_name("TS_CResult_BlindedHopFeaturesDecodeErrorZ_ok"))) TS_CResult_BlindedHopFeaturesDecodeErrorZ_ok(uint64_t o) {
18928         LDKBlindedHopFeatures o_conv;
18929         o_conv.inner = untag_ptr(o);
18930         o_conv.is_owned = ptr_is_owned(o);
18931         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
18932         o_conv = BlindedHopFeatures_clone(&o_conv);
18933         LDKCResult_BlindedHopFeaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_BlindedHopFeaturesDecodeErrorZ), "LDKCResult_BlindedHopFeaturesDecodeErrorZ");
18934         *ret_conv = CResult_BlindedHopFeaturesDecodeErrorZ_ok(o_conv);
18935         return tag_ptr(ret_conv, true);
18936 }
18937
18938 uint64_t  __attribute__((export_name("TS_CResult_BlindedHopFeaturesDecodeErrorZ_err"))) TS_CResult_BlindedHopFeaturesDecodeErrorZ_err(uint64_t e) {
18939         void* e_ptr = untag_ptr(e);
18940         CHECK_ACCESS(e_ptr);
18941         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
18942         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
18943         LDKCResult_BlindedHopFeaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_BlindedHopFeaturesDecodeErrorZ), "LDKCResult_BlindedHopFeaturesDecodeErrorZ");
18944         *ret_conv = CResult_BlindedHopFeaturesDecodeErrorZ_err(e_conv);
18945         return tag_ptr(ret_conv, true);
18946 }
18947
18948 jboolean  __attribute__((export_name("TS_CResult_BlindedHopFeaturesDecodeErrorZ_is_ok"))) TS_CResult_BlindedHopFeaturesDecodeErrorZ_is_ok(uint64_t o) {
18949         LDKCResult_BlindedHopFeaturesDecodeErrorZ* o_conv = (LDKCResult_BlindedHopFeaturesDecodeErrorZ*)untag_ptr(o);
18950         jboolean ret_conv = CResult_BlindedHopFeaturesDecodeErrorZ_is_ok(o_conv);
18951         return ret_conv;
18952 }
18953
18954 void  __attribute__((export_name("TS_CResult_BlindedHopFeaturesDecodeErrorZ_free"))) TS_CResult_BlindedHopFeaturesDecodeErrorZ_free(uint64_t _res) {
18955         if (!ptr_is_owned(_res)) return;
18956         void* _res_ptr = untag_ptr(_res);
18957         CHECK_ACCESS(_res_ptr);
18958         LDKCResult_BlindedHopFeaturesDecodeErrorZ _res_conv = *(LDKCResult_BlindedHopFeaturesDecodeErrorZ*)(_res_ptr);
18959         FREE(untag_ptr(_res));
18960         CResult_BlindedHopFeaturesDecodeErrorZ_free(_res_conv);
18961 }
18962
18963 static inline uint64_t CResult_BlindedHopFeaturesDecodeErrorZ_clone_ptr(LDKCResult_BlindedHopFeaturesDecodeErrorZ *NONNULL_PTR arg) {
18964         LDKCResult_BlindedHopFeaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_BlindedHopFeaturesDecodeErrorZ), "LDKCResult_BlindedHopFeaturesDecodeErrorZ");
18965         *ret_conv = CResult_BlindedHopFeaturesDecodeErrorZ_clone(arg);
18966         return tag_ptr(ret_conv, true);
18967 }
18968 int64_t  __attribute__((export_name("TS_CResult_BlindedHopFeaturesDecodeErrorZ_clone_ptr"))) TS_CResult_BlindedHopFeaturesDecodeErrorZ_clone_ptr(uint64_t arg) {
18969         LDKCResult_BlindedHopFeaturesDecodeErrorZ* arg_conv = (LDKCResult_BlindedHopFeaturesDecodeErrorZ*)untag_ptr(arg);
18970         int64_t ret_conv = CResult_BlindedHopFeaturesDecodeErrorZ_clone_ptr(arg_conv);
18971         return ret_conv;
18972 }
18973
18974 uint64_t  __attribute__((export_name("TS_CResult_BlindedHopFeaturesDecodeErrorZ_clone"))) TS_CResult_BlindedHopFeaturesDecodeErrorZ_clone(uint64_t orig) {
18975         LDKCResult_BlindedHopFeaturesDecodeErrorZ* orig_conv = (LDKCResult_BlindedHopFeaturesDecodeErrorZ*)untag_ptr(orig);
18976         LDKCResult_BlindedHopFeaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_BlindedHopFeaturesDecodeErrorZ), "LDKCResult_BlindedHopFeaturesDecodeErrorZ");
18977         *ret_conv = CResult_BlindedHopFeaturesDecodeErrorZ_clone(orig_conv);
18978         return tag_ptr(ret_conv, true);
18979 }
18980
18981 uint64_t  __attribute__((export_name("TS_CResult_ChannelTypeFeaturesDecodeErrorZ_ok"))) TS_CResult_ChannelTypeFeaturesDecodeErrorZ_ok(uint64_t o) {
18982         LDKChannelTypeFeatures o_conv;
18983         o_conv.inner = untag_ptr(o);
18984         o_conv.is_owned = ptr_is_owned(o);
18985         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
18986         o_conv = ChannelTypeFeatures_clone(&o_conv);
18987         LDKCResult_ChannelTypeFeaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelTypeFeaturesDecodeErrorZ), "LDKCResult_ChannelTypeFeaturesDecodeErrorZ");
18988         *ret_conv = CResult_ChannelTypeFeaturesDecodeErrorZ_ok(o_conv);
18989         return tag_ptr(ret_conv, true);
18990 }
18991
18992 uint64_t  __attribute__((export_name("TS_CResult_ChannelTypeFeaturesDecodeErrorZ_err"))) TS_CResult_ChannelTypeFeaturesDecodeErrorZ_err(uint64_t e) {
18993         void* e_ptr = untag_ptr(e);
18994         CHECK_ACCESS(e_ptr);
18995         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
18996         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
18997         LDKCResult_ChannelTypeFeaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelTypeFeaturesDecodeErrorZ), "LDKCResult_ChannelTypeFeaturesDecodeErrorZ");
18998         *ret_conv = CResult_ChannelTypeFeaturesDecodeErrorZ_err(e_conv);
18999         return tag_ptr(ret_conv, true);
19000 }
19001
19002 jboolean  __attribute__((export_name("TS_CResult_ChannelTypeFeaturesDecodeErrorZ_is_ok"))) TS_CResult_ChannelTypeFeaturesDecodeErrorZ_is_ok(uint64_t o) {
19003         LDKCResult_ChannelTypeFeaturesDecodeErrorZ* o_conv = (LDKCResult_ChannelTypeFeaturesDecodeErrorZ*)untag_ptr(o);
19004         jboolean ret_conv = CResult_ChannelTypeFeaturesDecodeErrorZ_is_ok(o_conv);
19005         return ret_conv;
19006 }
19007
19008 void  __attribute__((export_name("TS_CResult_ChannelTypeFeaturesDecodeErrorZ_free"))) TS_CResult_ChannelTypeFeaturesDecodeErrorZ_free(uint64_t _res) {
19009         if (!ptr_is_owned(_res)) return;
19010         void* _res_ptr = untag_ptr(_res);
19011         CHECK_ACCESS(_res_ptr);
19012         LDKCResult_ChannelTypeFeaturesDecodeErrorZ _res_conv = *(LDKCResult_ChannelTypeFeaturesDecodeErrorZ*)(_res_ptr);
19013         FREE(untag_ptr(_res));
19014         CResult_ChannelTypeFeaturesDecodeErrorZ_free(_res_conv);
19015 }
19016
19017 static inline uint64_t CResult_ChannelTypeFeaturesDecodeErrorZ_clone_ptr(LDKCResult_ChannelTypeFeaturesDecodeErrorZ *NONNULL_PTR arg) {
19018         LDKCResult_ChannelTypeFeaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelTypeFeaturesDecodeErrorZ), "LDKCResult_ChannelTypeFeaturesDecodeErrorZ");
19019         *ret_conv = CResult_ChannelTypeFeaturesDecodeErrorZ_clone(arg);
19020         return tag_ptr(ret_conv, true);
19021 }
19022 int64_t  __attribute__((export_name("TS_CResult_ChannelTypeFeaturesDecodeErrorZ_clone_ptr"))) TS_CResult_ChannelTypeFeaturesDecodeErrorZ_clone_ptr(uint64_t arg) {
19023         LDKCResult_ChannelTypeFeaturesDecodeErrorZ* arg_conv = (LDKCResult_ChannelTypeFeaturesDecodeErrorZ*)untag_ptr(arg);
19024         int64_t ret_conv = CResult_ChannelTypeFeaturesDecodeErrorZ_clone_ptr(arg_conv);
19025         return ret_conv;
19026 }
19027
19028 uint64_t  __attribute__((export_name("TS_CResult_ChannelTypeFeaturesDecodeErrorZ_clone"))) TS_CResult_ChannelTypeFeaturesDecodeErrorZ_clone(uint64_t orig) {
19029         LDKCResult_ChannelTypeFeaturesDecodeErrorZ* orig_conv = (LDKCResult_ChannelTypeFeaturesDecodeErrorZ*)untag_ptr(orig);
19030         LDKCResult_ChannelTypeFeaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelTypeFeaturesDecodeErrorZ), "LDKCResult_ChannelTypeFeaturesDecodeErrorZ");
19031         *ret_conv = CResult_ChannelTypeFeaturesDecodeErrorZ_clone(orig_conv);
19032         return tag_ptr(ret_conv, true);
19033 }
19034
19035 uint64_t  __attribute__((export_name("TS_CResult_OfferBolt12ParseErrorZ_ok"))) TS_CResult_OfferBolt12ParseErrorZ_ok(uint64_t o) {
19036         LDKOffer o_conv;
19037         o_conv.inner = untag_ptr(o);
19038         o_conv.is_owned = ptr_is_owned(o);
19039         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
19040         o_conv = Offer_clone(&o_conv);
19041         LDKCResult_OfferBolt12ParseErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_OfferBolt12ParseErrorZ), "LDKCResult_OfferBolt12ParseErrorZ");
19042         *ret_conv = CResult_OfferBolt12ParseErrorZ_ok(o_conv);
19043         return tag_ptr(ret_conv, true);
19044 }
19045
19046 uint64_t  __attribute__((export_name("TS_CResult_OfferBolt12ParseErrorZ_err"))) TS_CResult_OfferBolt12ParseErrorZ_err(uint64_t e) {
19047         LDKBolt12ParseError e_conv;
19048         e_conv.inner = untag_ptr(e);
19049         e_conv.is_owned = ptr_is_owned(e);
19050         CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
19051         e_conv = Bolt12ParseError_clone(&e_conv);
19052         LDKCResult_OfferBolt12ParseErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_OfferBolt12ParseErrorZ), "LDKCResult_OfferBolt12ParseErrorZ");
19053         *ret_conv = CResult_OfferBolt12ParseErrorZ_err(e_conv);
19054         return tag_ptr(ret_conv, true);
19055 }
19056
19057 jboolean  __attribute__((export_name("TS_CResult_OfferBolt12ParseErrorZ_is_ok"))) TS_CResult_OfferBolt12ParseErrorZ_is_ok(uint64_t o) {
19058         LDKCResult_OfferBolt12ParseErrorZ* o_conv = (LDKCResult_OfferBolt12ParseErrorZ*)untag_ptr(o);
19059         jboolean ret_conv = CResult_OfferBolt12ParseErrorZ_is_ok(o_conv);
19060         return ret_conv;
19061 }
19062
19063 void  __attribute__((export_name("TS_CResult_OfferBolt12ParseErrorZ_free"))) TS_CResult_OfferBolt12ParseErrorZ_free(uint64_t _res) {
19064         if (!ptr_is_owned(_res)) return;
19065         void* _res_ptr = untag_ptr(_res);
19066         CHECK_ACCESS(_res_ptr);
19067         LDKCResult_OfferBolt12ParseErrorZ _res_conv = *(LDKCResult_OfferBolt12ParseErrorZ*)(_res_ptr);
19068         FREE(untag_ptr(_res));
19069         CResult_OfferBolt12ParseErrorZ_free(_res_conv);
19070 }
19071
19072 static inline uint64_t CResult_OfferBolt12ParseErrorZ_clone_ptr(LDKCResult_OfferBolt12ParseErrorZ *NONNULL_PTR arg) {
19073         LDKCResult_OfferBolt12ParseErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_OfferBolt12ParseErrorZ), "LDKCResult_OfferBolt12ParseErrorZ");
19074         *ret_conv = CResult_OfferBolt12ParseErrorZ_clone(arg);
19075         return tag_ptr(ret_conv, true);
19076 }
19077 int64_t  __attribute__((export_name("TS_CResult_OfferBolt12ParseErrorZ_clone_ptr"))) TS_CResult_OfferBolt12ParseErrorZ_clone_ptr(uint64_t arg) {
19078         LDKCResult_OfferBolt12ParseErrorZ* arg_conv = (LDKCResult_OfferBolt12ParseErrorZ*)untag_ptr(arg);
19079         int64_t ret_conv = CResult_OfferBolt12ParseErrorZ_clone_ptr(arg_conv);
19080         return ret_conv;
19081 }
19082
19083 uint64_t  __attribute__((export_name("TS_CResult_OfferBolt12ParseErrorZ_clone"))) TS_CResult_OfferBolt12ParseErrorZ_clone(uint64_t orig) {
19084         LDKCResult_OfferBolt12ParseErrorZ* orig_conv = (LDKCResult_OfferBolt12ParseErrorZ*)untag_ptr(orig);
19085         LDKCResult_OfferBolt12ParseErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_OfferBolt12ParseErrorZ), "LDKCResult_OfferBolt12ParseErrorZ");
19086         *ret_conv = CResult_OfferBolt12ParseErrorZ_clone(orig_conv);
19087         return tag_ptr(ret_conv, true);
19088 }
19089
19090 uint64_t  __attribute__((export_name("TS_CResult_PublicKeySecp256k1ErrorZ_ok"))) TS_CResult_PublicKeySecp256k1ErrorZ_ok(int8_tArray o) {
19091         LDKPublicKey o_ref;
19092         CHECK(o->arr_len == 33);
19093         memcpy(o_ref.compressed_form, o->elems, 33); FREE(o);
19094         LDKCResult_PublicKeySecp256k1ErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PublicKeySecp256k1ErrorZ), "LDKCResult_PublicKeySecp256k1ErrorZ");
19095         *ret_conv = CResult_PublicKeySecp256k1ErrorZ_ok(o_ref);
19096         return tag_ptr(ret_conv, true);
19097 }
19098
19099 uint64_t  __attribute__((export_name("TS_CResult_PublicKeySecp256k1ErrorZ_err"))) TS_CResult_PublicKeySecp256k1ErrorZ_err(uint32_t e) {
19100         LDKSecp256k1Error e_conv = LDKSecp256k1Error_from_js(e);
19101         LDKCResult_PublicKeySecp256k1ErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PublicKeySecp256k1ErrorZ), "LDKCResult_PublicKeySecp256k1ErrorZ");
19102         *ret_conv = CResult_PublicKeySecp256k1ErrorZ_err(e_conv);
19103         return tag_ptr(ret_conv, true);
19104 }
19105
19106 jboolean  __attribute__((export_name("TS_CResult_PublicKeySecp256k1ErrorZ_is_ok"))) TS_CResult_PublicKeySecp256k1ErrorZ_is_ok(uint64_t o) {
19107         LDKCResult_PublicKeySecp256k1ErrorZ* o_conv = (LDKCResult_PublicKeySecp256k1ErrorZ*)untag_ptr(o);
19108         jboolean ret_conv = CResult_PublicKeySecp256k1ErrorZ_is_ok(o_conv);
19109         return ret_conv;
19110 }
19111
19112 void  __attribute__((export_name("TS_CResult_PublicKeySecp256k1ErrorZ_free"))) TS_CResult_PublicKeySecp256k1ErrorZ_free(uint64_t _res) {
19113         if (!ptr_is_owned(_res)) return;
19114         void* _res_ptr = untag_ptr(_res);
19115         CHECK_ACCESS(_res_ptr);
19116         LDKCResult_PublicKeySecp256k1ErrorZ _res_conv = *(LDKCResult_PublicKeySecp256k1ErrorZ*)(_res_ptr);
19117         FREE(untag_ptr(_res));
19118         CResult_PublicKeySecp256k1ErrorZ_free(_res_conv);
19119 }
19120
19121 static inline uint64_t CResult_PublicKeySecp256k1ErrorZ_clone_ptr(LDKCResult_PublicKeySecp256k1ErrorZ *NONNULL_PTR arg) {
19122         LDKCResult_PublicKeySecp256k1ErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PublicKeySecp256k1ErrorZ), "LDKCResult_PublicKeySecp256k1ErrorZ");
19123         *ret_conv = CResult_PublicKeySecp256k1ErrorZ_clone(arg);
19124         return tag_ptr(ret_conv, true);
19125 }
19126 int64_t  __attribute__((export_name("TS_CResult_PublicKeySecp256k1ErrorZ_clone_ptr"))) TS_CResult_PublicKeySecp256k1ErrorZ_clone_ptr(uint64_t arg) {
19127         LDKCResult_PublicKeySecp256k1ErrorZ* arg_conv = (LDKCResult_PublicKeySecp256k1ErrorZ*)untag_ptr(arg);
19128         int64_t ret_conv = CResult_PublicKeySecp256k1ErrorZ_clone_ptr(arg_conv);
19129         return ret_conv;
19130 }
19131
19132 uint64_t  __attribute__((export_name("TS_CResult_PublicKeySecp256k1ErrorZ_clone"))) TS_CResult_PublicKeySecp256k1ErrorZ_clone(uint64_t orig) {
19133         LDKCResult_PublicKeySecp256k1ErrorZ* orig_conv = (LDKCResult_PublicKeySecp256k1ErrorZ*)untag_ptr(orig);
19134         LDKCResult_PublicKeySecp256k1ErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PublicKeySecp256k1ErrorZ), "LDKCResult_PublicKeySecp256k1ErrorZ");
19135         *ret_conv = CResult_PublicKeySecp256k1ErrorZ_clone(orig_conv);
19136         return tag_ptr(ret_conv, true);
19137 }
19138
19139 uint64_t  __attribute__((export_name("TS_CResult_NodeIdDecodeErrorZ_ok"))) TS_CResult_NodeIdDecodeErrorZ_ok(uint64_t o) {
19140         LDKNodeId o_conv;
19141         o_conv.inner = untag_ptr(o);
19142         o_conv.is_owned = ptr_is_owned(o);
19143         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
19144         o_conv = NodeId_clone(&o_conv);
19145         LDKCResult_NodeIdDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NodeIdDecodeErrorZ), "LDKCResult_NodeIdDecodeErrorZ");
19146         *ret_conv = CResult_NodeIdDecodeErrorZ_ok(o_conv);
19147         return tag_ptr(ret_conv, true);
19148 }
19149
19150 uint64_t  __attribute__((export_name("TS_CResult_NodeIdDecodeErrorZ_err"))) TS_CResult_NodeIdDecodeErrorZ_err(uint64_t e) {
19151         void* e_ptr = untag_ptr(e);
19152         CHECK_ACCESS(e_ptr);
19153         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
19154         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
19155         LDKCResult_NodeIdDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NodeIdDecodeErrorZ), "LDKCResult_NodeIdDecodeErrorZ");
19156         *ret_conv = CResult_NodeIdDecodeErrorZ_err(e_conv);
19157         return tag_ptr(ret_conv, true);
19158 }
19159
19160 jboolean  __attribute__((export_name("TS_CResult_NodeIdDecodeErrorZ_is_ok"))) TS_CResult_NodeIdDecodeErrorZ_is_ok(uint64_t o) {
19161         LDKCResult_NodeIdDecodeErrorZ* o_conv = (LDKCResult_NodeIdDecodeErrorZ*)untag_ptr(o);
19162         jboolean ret_conv = CResult_NodeIdDecodeErrorZ_is_ok(o_conv);
19163         return ret_conv;
19164 }
19165
19166 void  __attribute__((export_name("TS_CResult_NodeIdDecodeErrorZ_free"))) TS_CResult_NodeIdDecodeErrorZ_free(uint64_t _res) {
19167         if (!ptr_is_owned(_res)) return;
19168         void* _res_ptr = untag_ptr(_res);
19169         CHECK_ACCESS(_res_ptr);
19170         LDKCResult_NodeIdDecodeErrorZ _res_conv = *(LDKCResult_NodeIdDecodeErrorZ*)(_res_ptr);
19171         FREE(untag_ptr(_res));
19172         CResult_NodeIdDecodeErrorZ_free(_res_conv);
19173 }
19174
19175 static inline uint64_t CResult_NodeIdDecodeErrorZ_clone_ptr(LDKCResult_NodeIdDecodeErrorZ *NONNULL_PTR arg) {
19176         LDKCResult_NodeIdDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NodeIdDecodeErrorZ), "LDKCResult_NodeIdDecodeErrorZ");
19177         *ret_conv = CResult_NodeIdDecodeErrorZ_clone(arg);
19178         return tag_ptr(ret_conv, true);
19179 }
19180 int64_t  __attribute__((export_name("TS_CResult_NodeIdDecodeErrorZ_clone_ptr"))) TS_CResult_NodeIdDecodeErrorZ_clone_ptr(uint64_t arg) {
19181         LDKCResult_NodeIdDecodeErrorZ* arg_conv = (LDKCResult_NodeIdDecodeErrorZ*)untag_ptr(arg);
19182         int64_t ret_conv = CResult_NodeIdDecodeErrorZ_clone_ptr(arg_conv);
19183         return ret_conv;
19184 }
19185
19186 uint64_t  __attribute__((export_name("TS_CResult_NodeIdDecodeErrorZ_clone"))) TS_CResult_NodeIdDecodeErrorZ_clone(uint64_t orig) {
19187         LDKCResult_NodeIdDecodeErrorZ* orig_conv = (LDKCResult_NodeIdDecodeErrorZ*)untag_ptr(orig);
19188         LDKCResult_NodeIdDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NodeIdDecodeErrorZ), "LDKCResult_NodeIdDecodeErrorZ");
19189         *ret_conv = CResult_NodeIdDecodeErrorZ_clone(orig_conv);
19190         return tag_ptr(ret_conv, true);
19191 }
19192
19193 uint64_t  __attribute__((export_name("TS_COption_NetworkUpdateZ_some"))) TS_COption_NetworkUpdateZ_some(uint64_t o) {
19194         void* o_ptr = untag_ptr(o);
19195         CHECK_ACCESS(o_ptr);
19196         LDKNetworkUpdate o_conv = *(LDKNetworkUpdate*)(o_ptr);
19197         o_conv = NetworkUpdate_clone((LDKNetworkUpdate*)untag_ptr(o));
19198         LDKCOption_NetworkUpdateZ *ret_copy = MALLOC(sizeof(LDKCOption_NetworkUpdateZ), "LDKCOption_NetworkUpdateZ");
19199         *ret_copy = COption_NetworkUpdateZ_some(o_conv);
19200         uint64_t ret_ref = tag_ptr(ret_copy, true);
19201         return ret_ref;
19202 }
19203
19204 uint64_t  __attribute__((export_name("TS_COption_NetworkUpdateZ_none"))) TS_COption_NetworkUpdateZ_none() {
19205         LDKCOption_NetworkUpdateZ *ret_copy = MALLOC(sizeof(LDKCOption_NetworkUpdateZ), "LDKCOption_NetworkUpdateZ");
19206         *ret_copy = COption_NetworkUpdateZ_none();
19207         uint64_t ret_ref = tag_ptr(ret_copy, true);
19208         return ret_ref;
19209 }
19210
19211 void  __attribute__((export_name("TS_COption_NetworkUpdateZ_free"))) TS_COption_NetworkUpdateZ_free(uint64_t _res) {
19212         if (!ptr_is_owned(_res)) return;
19213         void* _res_ptr = untag_ptr(_res);
19214         CHECK_ACCESS(_res_ptr);
19215         LDKCOption_NetworkUpdateZ _res_conv = *(LDKCOption_NetworkUpdateZ*)(_res_ptr);
19216         FREE(untag_ptr(_res));
19217         COption_NetworkUpdateZ_free(_res_conv);
19218 }
19219
19220 static inline uint64_t COption_NetworkUpdateZ_clone_ptr(LDKCOption_NetworkUpdateZ *NONNULL_PTR arg) {
19221         LDKCOption_NetworkUpdateZ *ret_copy = MALLOC(sizeof(LDKCOption_NetworkUpdateZ), "LDKCOption_NetworkUpdateZ");
19222         *ret_copy = COption_NetworkUpdateZ_clone(arg);
19223         uint64_t ret_ref = tag_ptr(ret_copy, true);
19224         return ret_ref;
19225 }
19226 int64_t  __attribute__((export_name("TS_COption_NetworkUpdateZ_clone_ptr"))) TS_COption_NetworkUpdateZ_clone_ptr(uint64_t arg) {
19227         LDKCOption_NetworkUpdateZ* arg_conv = (LDKCOption_NetworkUpdateZ*)untag_ptr(arg);
19228         int64_t ret_conv = COption_NetworkUpdateZ_clone_ptr(arg_conv);
19229         return ret_conv;
19230 }
19231
19232 uint64_t  __attribute__((export_name("TS_COption_NetworkUpdateZ_clone"))) TS_COption_NetworkUpdateZ_clone(uint64_t orig) {
19233         LDKCOption_NetworkUpdateZ* orig_conv = (LDKCOption_NetworkUpdateZ*)untag_ptr(orig);
19234         LDKCOption_NetworkUpdateZ *ret_copy = MALLOC(sizeof(LDKCOption_NetworkUpdateZ), "LDKCOption_NetworkUpdateZ");
19235         *ret_copy = COption_NetworkUpdateZ_clone(orig_conv);
19236         uint64_t ret_ref = tag_ptr(ret_copy, true);
19237         return ret_ref;
19238 }
19239
19240 uint64_t  __attribute__((export_name("TS_CResult_COption_NetworkUpdateZDecodeErrorZ_ok"))) TS_CResult_COption_NetworkUpdateZDecodeErrorZ_ok(uint64_t o) {
19241         void* o_ptr = untag_ptr(o);
19242         CHECK_ACCESS(o_ptr);
19243         LDKCOption_NetworkUpdateZ o_conv = *(LDKCOption_NetworkUpdateZ*)(o_ptr);
19244         o_conv = COption_NetworkUpdateZ_clone((LDKCOption_NetworkUpdateZ*)untag_ptr(o));
19245         LDKCResult_COption_NetworkUpdateZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_COption_NetworkUpdateZDecodeErrorZ), "LDKCResult_COption_NetworkUpdateZDecodeErrorZ");
19246         *ret_conv = CResult_COption_NetworkUpdateZDecodeErrorZ_ok(o_conv);
19247         return tag_ptr(ret_conv, true);
19248 }
19249
19250 uint64_t  __attribute__((export_name("TS_CResult_COption_NetworkUpdateZDecodeErrorZ_err"))) TS_CResult_COption_NetworkUpdateZDecodeErrorZ_err(uint64_t e) {
19251         void* e_ptr = untag_ptr(e);
19252         CHECK_ACCESS(e_ptr);
19253         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
19254         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
19255         LDKCResult_COption_NetworkUpdateZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_COption_NetworkUpdateZDecodeErrorZ), "LDKCResult_COption_NetworkUpdateZDecodeErrorZ");
19256         *ret_conv = CResult_COption_NetworkUpdateZDecodeErrorZ_err(e_conv);
19257         return tag_ptr(ret_conv, true);
19258 }
19259
19260 jboolean  __attribute__((export_name("TS_CResult_COption_NetworkUpdateZDecodeErrorZ_is_ok"))) TS_CResult_COption_NetworkUpdateZDecodeErrorZ_is_ok(uint64_t o) {
19261         LDKCResult_COption_NetworkUpdateZDecodeErrorZ* o_conv = (LDKCResult_COption_NetworkUpdateZDecodeErrorZ*)untag_ptr(o);
19262         jboolean ret_conv = CResult_COption_NetworkUpdateZDecodeErrorZ_is_ok(o_conv);
19263         return ret_conv;
19264 }
19265
19266 void  __attribute__((export_name("TS_CResult_COption_NetworkUpdateZDecodeErrorZ_free"))) TS_CResult_COption_NetworkUpdateZDecodeErrorZ_free(uint64_t _res) {
19267         if (!ptr_is_owned(_res)) return;
19268         void* _res_ptr = untag_ptr(_res);
19269         CHECK_ACCESS(_res_ptr);
19270         LDKCResult_COption_NetworkUpdateZDecodeErrorZ _res_conv = *(LDKCResult_COption_NetworkUpdateZDecodeErrorZ*)(_res_ptr);
19271         FREE(untag_ptr(_res));
19272         CResult_COption_NetworkUpdateZDecodeErrorZ_free(_res_conv);
19273 }
19274
19275 static inline uint64_t CResult_COption_NetworkUpdateZDecodeErrorZ_clone_ptr(LDKCResult_COption_NetworkUpdateZDecodeErrorZ *NONNULL_PTR arg) {
19276         LDKCResult_COption_NetworkUpdateZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_COption_NetworkUpdateZDecodeErrorZ), "LDKCResult_COption_NetworkUpdateZDecodeErrorZ");
19277         *ret_conv = CResult_COption_NetworkUpdateZDecodeErrorZ_clone(arg);
19278         return tag_ptr(ret_conv, true);
19279 }
19280 int64_t  __attribute__((export_name("TS_CResult_COption_NetworkUpdateZDecodeErrorZ_clone_ptr"))) TS_CResult_COption_NetworkUpdateZDecodeErrorZ_clone_ptr(uint64_t arg) {
19281         LDKCResult_COption_NetworkUpdateZDecodeErrorZ* arg_conv = (LDKCResult_COption_NetworkUpdateZDecodeErrorZ*)untag_ptr(arg);
19282         int64_t ret_conv = CResult_COption_NetworkUpdateZDecodeErrorZ_clone_ptr(arg_conv);
19283         return ret_conv;
19284 }
19285
19286 uint64_t  __attribute__((export_name("TS_CResult_COption_NetworkUpdateZDecodeErrorZ_clone"))) TS_CResult_COption_NetworkUpdateZDecodeErrorZ_clone(uint64_t orig) {
19287         LDKCResult_COption_NetworkUpdateZDecodeErrorZ* orig_conv = (LDKCResult_COption_NetworkUpdateZDecodeErrorZ*)untag_ptr(orig);
19288         LDKCResult_COption_NetworkUpdateZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_COption_NetworkUpdateZDecodeErrorZ), "LDKCResult_COption_NetworkUpdateZDecodeErrorZ");
19289         *ret_conv = CResult_COption_NetworkUpdateZDecodeErrorZ_clone(orig_conv);
19290         return tag_ptr(ret_conv, true);
19291 }
19292
19293 uint64_t  __attribute__((export_name("TS_COption_UtxoLookupZ_some"))) TS_COption_UtxoLookupZ_some(uint64_t o) {
19294         void* o_ptr = untag_ptr(o);
19295         CHECK_ACCESS(o_ptr);
19296         LDKUtxoLookup o_conv = *(LDKUtxoLookup*)(o_ptr);
19297         if (o_conv.free == LDKUtxoLookup_JCalls_free) {
19298                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
19299                 LDKUtxoLookup_JCalls_cloned(&o_conv);
19300         }
19301         LDKCOption_UtxoLookupZ *ret_copy = MALLOC(sizeof(LDKCOption_UtxoLookupZ), "LDKCOption_UtxoLookupZ");
19302         *ret_copy = COption_UtxoLookupZ_some(o_conv);
19303         uint64_t ret_ref = tag_ptr(ret_copy, true);
19304         return ret_ref;
19305 }
19306
19307 uint64_t  __attribute__((export_name("TS_COption_UtxoLookupZ_none"))) TS_COption_UtxoLookupZ_none() {
19308         LDKCOption_UtxoLookupZ *ret_copy = MALLOC(sizeof(LDKCOption_UtxoLookupZ), "LDKCOption_UtxoLookupZ");
19309         *ret_copy = COption_UtxoLookupZ_none();
19310         uint64_t ret_ref = tag_ptr(ret_copy, true);
19311         return ret_ref;
19312 }
19313
19314 void  __attribute__((export_name("TS_COption_UtxoLookupZ_free"))) TS_COption_UtxoLookupZ_free(uint64_t _res) {
19315         if (!ptr_is_owned(_res)) return;
19316         void* _res_ptr = untag_ptr(_res);
19317         CHECK_ACCESS(_res_ptr);
19318         LDKCOption_UtxoLookupZ _res_conv = *(LDKCOption_UtxoLookupZ*)(_res_ptr);
19319         FREE(untag_ptr(_res));
19320         COption_UtxoLookupZ_free(_res_conv);
19321 }
19322
19323 uint64_t  __attribute__((export_name("TS_CResult_NoneLightningErrorZ_ok"))) TS_CResult_NoneLightningErrorZ_ok() {
19324         LDKCResult_NoneLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneLightningErrorZ), "LDKCResult_NoneLightningErrorZ");
19325         *ret_conv = CResult_NoneLightningErrorZ_ok();
19326         return tag_ptr(ret_conv, true);
19327 }
19328
19329 uint64_t  __attribute__((export_name("TS_CResult_NoneLightningErrorZ_err"))) TS_CResult_NoneLightningErrorZ_err(uint64_t e) {
19330         LDKLightningError e_conv;
19331         e_conv.inner = untag_ptr(e);
19332         e_conv.is_owned = ptr_is_owned(e);
19333         CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
19334         e_conv = LightningError_clone(&e_conv);
19335         LDKCResult_NoneLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneLightningErrorZ), "LDKCResult_NoneLightningErrorZ");
19336         *ret_conv = CResult_NoneLightningErrorZ_err(e_conv);
19337         return tag_ptr(ret_conv, true);
19338 }
19339
19340 jboolean  __attribute__((export_name("TS_CResult_NoneLightningErrorZ_is_ok"))) TS_CResult_NoneLightningErrorZ_is_ok(uint64_t o) {
19341         LDKCResult_NoneLightningErrorZ* o_conv = (LDKCResult_NoneLightningErrorZ*)untag_ptr(o);
19342         jboolean ret_conv = CResult_NoneLightningErrorZ_is_ok(o_conv);
19343         return ret_conv;
19344 }
19345
19346 void  __attribute__((export_name("TS_CResult_NoneLightningErrorZ_free"))) TS_CResult_NoneLightningErrorZ_free(uint64_t _res) {
19347         if (!ptr_is_owned(_res)) return;
19348         void* _res_ptr = untag_ptr(_res);
19349         CHECK_ACCESS(_res_ptr);
19350         LDKCResult_NoneLightningErrorZ _res_conv = *(LDKCResult_NoneLightningErrorZ*)(_res_ptr);
19351         FREE(untag_ptr(_res));
19352         CResult_NoneLightningErrorZ_free(_res_conv);
19353 }
19354
19355 static inline uint64_t CResult_NoneLightningErrorZ_clone_ptr(LDKCResult_NoneLightningErrorZ *NONNULL_PTR arg) {
19356         LDKCResult_NoneLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneLightningErrorZ), "LDKCResult_NoneLightningErrorZ");
19357         *ret_conv = CResult_NoneLightningErrorZ_clone(arg);
19358         return tag_ptr(ret_conv, true);
19359 }
19360 int64_t  __attribute__((export_name("TS_CResult_NoneLightningErrorZ_clone_ptr"))) TS_CResult_NoneLightningErrorZ_clone_ptr(uint64_t arg) {
19361         LDKCResult_NoneLightningErrorZ* arg_conv = (LDKCResult_NoneLightningErrorZ*)untag_ptr(arg);
19362         int64_t ret_conv = CResult_NoneLightningErrorZ_clone_ptr(arg_conv);
19363         return ret_conv;
19364 }
19365
19366 uint64_t  __attribute__((export_name("TS_CResult_NoneLightningErrorZ_clone"))) TS_CResult_NoneLightningErrorZ_clone(uint64_t orig) {
19367         LDKCResult_NoneLightningErrorZ* orig_conv = (LDKCResult_NoneLightningErrorZ*)untag_ptr(orig);
19368         LDKCResult_NoneLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneLightningErrorZ), "LDKCResult_NoneLightningErrorZ");
19369         *ret_conv = CResult_NoneLightningErrorZ_clone(orig_conv);
19370         return tag_ptr(ret_conv, true);
19371 }
19372
19373 uint64_t  __attribute__((export_name("TS_CResult_boolLightningErrorZ_ok"))) TS_CResult_boolLightningErrorZ_ok(jboolean o) {
19374         LDKCResult_boolLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_boolLightningErrorZ), "LDKCResult_boolLightningErrorZ");
19375         *ret_conv = CResult_boolLightningErrorZ_ok(o);
19376         return tag_ptr(ret_conv, true);
19377 }
19378
19379 uint64_t  __attribute__((export_name("TS_CResult_boolLightningErrorZ_err"))) TS_CResult_boolLightningErrorZ_err(uint64_t e) {
19380         LDKLightningError e_conv;
19381         e_conv.inner = untag_ptr(e);
19382         e_conv.is_owned = ptr_is_owned(e);
19383         CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
19384         e_conv = LightningError_clone(&e_conv);
19385         LDKCResult_boolLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_boolLightningErrorZ), "LDKCResult_boolLightningErrorZ");
19386         *ret_conv = CResult_boolLightningErrorZ_err(e_conv);
19387         return tag_ptr(ret_conv, true);
19388 }
19389
19390 jboolean  __attribute__((export_name("TS_CResult_boolLightningErrorZ_is_ok"))) TS_CResult_boolLightningErrorZ_is_ok(uint64_t o) {
19391         LDKCResult_boolLightningErrorZ* o_conv = (LDKCResult_boolLightningErrorZ*)untag_ptr(o);
19392         jboolean ret_conv = CResult_boolLightningErrorZ_is_ok(o_conv);
19393         return ret_conv;
19394 }
19395
19396 void  __attribute__((export_name("TS_CResult_boolLightningErrorZ_free"))) TS_CResult_boolLightningErrorZ_free(uint64_t _res) {
19397         if (!ptr_is_owned(_res)) return;
19398         void* _res_ptr = untag_ptr(_res);
19399         CHECK_ACCESS(_res_ptr);
19400         LDKCResult_boolLightningErrorZ _res_conv = *(LDKCResult_boolLightningErrorZ*)(_res_ptr);
19401         FREE(untag_ptr(_res));
19402         CResult_boolLightningErrorZ_free(_res_conv);
19403 }
19404
19405 static inline uint64_t CResult_boolLightningErrorZ_clone_ptr(LDKCResult_boolLightningErrorZ *NONNULL_PTR arg) {
19406         LDKCResult_boolLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_boolLightningErrorZ), "LDKCResult_boolLightningErrorZ");
19407         *ret_conv = CResult_boolLightningErrorZ_clone(arg);
19408         return tag_ptr(ret_conv, true);
19409 }
19410 int64_t  __attribute__((export_name("TS_CResult_boolLightningErrorZ_clone_ptr"))) TS_CResult_boolLightningErrorZ_clone_ptr(uint64_t arg) {
19411         LDKCResult_boolLightningErrorZ* arg_conv = (LDKCResult_boolLightningErrorZ*)untag_ptr(arg);
19412         int64_t ret_conv = CResult_boolLightningErrorZ_clone_ptr(arg_conv);
19413         return ret_conv;
19414 }
19415
19416 uint64_t  __attribute__((export_name("TS_CResult_boolLightningErrorZ_clone"))) TS_CResult_boolLightningErrorZ_clone(uint64_t orig) {
19417         LDKCResult_boolLightningErrorZ* orig_conv = (LDKCResult_boolLightningErrorZ*)untag_ptr(orig);
19418         LDKCResult_boolLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_boolLightningErrorZ), "LDKCResult_boolLightningErrorZ");
19419         *ret_conv = CResult_boolLightningErrorZ_clone(orig_conv);
19420         return tag_ptr(ret_conv, true);
19421 }
19422
19423 static inline uint64_t C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ_clone_ptr(LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ *NONNULL_PTR arg) {
19424         LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ* ret_conv = MALLOC(sizeof(LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ), "LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ");
19425         *ret_conv = C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ_clone(arg);
19426         return tag_ptr(ret_conv, true);
19427 }
19428 int64_t  __attribute__((export_name("TS_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ_clone_ptr"))) TS_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ_clone_ptr(uint64_t arg) {
19429         LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ* arg_conv = (LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ*)untag_ptr(arg);
19430         int64_t ret_conv = C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ_clone_ptr(arg_conv);
19431         return ret_conv;
19432 }
19433
19434 uint64_t  __attribute__((export_name("TS_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ_clone"))) TS_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ_clone(uint64_t orig) {
19435         LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ* orig_conv = (LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ*)untag_ptr(orig);
19436         LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ* ret_conv = MALLOC(sizeof(LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ), "LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ");
19437         *ret_conv = C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ_clone(orig_conv);
19438         return tag_ptr(ret_conv, true);
19439 }
19440
19441 uint64_t  __attribute__((export_name("TS_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ_new"))) TS_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ_new(uint64_t a, uint64_t b, uint64_t c) {
19442         LDKChannelAnnouncement a_conv;
19443         a_conv.inner = untag_ptr(a);
19444         a_conv.is_owned = ptr_is_owned(a);
19445         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
19446         a_conv = ChannelAnnouncement_clone(&a_conv);
19447         LDKChannelUpdate b_conv;
19448         b_conv.inner = untag_ptr(b);
19449         b_conv.is_owned = ptr_is_owned(b);
19450         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
19451         b_conv = ChannelUpdate_clone(&b_conv);
19452         LDKChannelUpdate c_conv;
19453         c_conv.inner = untag_ptr(c);
19454         c_conv.is_owned = ptr_is_owned(c);
19455         CHECK_INNER_FIELD_ACCESS_OR_NULL(c_conv);
19456         c_conv = ChannelUpdate_clone(&c_conv);
19457         LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ* ret_conv = MALLOC(sizeof(LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ), "LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ");
19458         *ret_conv = C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ_new(a_conv, b_conv, c_conv);
19459         return tag_ptr(ret_conv, true);
19460 }
19461
19462 void  __attribute__((export_name("TS_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ_free"))) TS_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ_free(uint64_t _res) {
19463         if (!ptr_is_owned(_res)) return;
19464         void* _res_ptr = untag_ptr(_res);
19465         CHECK_ACCESS(_res_ptr);
19466         LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ _res_conv = *(LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ*)(_res_ptr);
19467         FREE(untag_ptr(_res));
19468         C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ_free(_res_conv);
19469 }
19470
19471 uint64_t  __attribute__((export_name("TS_COption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ_some"))) TS_COption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ_some(uint64_t o) {
19472         void* o_ptr = untag_ptr(o);
19473         CHECK_ACCESS(o_ptr);
19474         LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ o_conv = *(LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ*)(o_ptr);
19475         o_conv = C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ_clone((LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ*)untag_ptr(o));
19476         LDKCOption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ *ret_copy = MALLOC(sizeof(LDKCOption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ), "LDKCOption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ");
19477         *ret_copy = COption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ_some(o_conv);
19478         uint64_t ret_ref = tag_ptr(ret_copy, true);
19479         return ret_ref;
19480 }
19481
19482 uint64_t  __attribute__((export_name("TS_COption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ_none"))) TS_COption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ_none() {
19483         LDKCOption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ *ret_copy = MALLOC(sizeof(LDKCOption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ), "LDKCOption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ");
19484         *ret_copy = COption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ_none();
19485         uint64_t ret_ref = tag_ptr(ret_copy, true);
19486         return ret_ref;
19487 }
19488
19489 void  __attribute__((export_name("TS_COption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ_free"))) TS_COption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ_free(uint64_t _res) {
19490         if (!ptr_is_owned(_res)) return;
19491         void* _res_ptr = untag_ptr(_res);
19492         CHECK_ACCESS(_res_ptr);
19493         LDKCOption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ _res_conv = *(LDKCOption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ*)(_res_ptr);
19494         FREE(untag_ptr(_res));
19495         COption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ_free(_res_conv);
19496 }
19497
19498 static inline uint64_t COption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ_clone_ptr(LDKCOption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ *NONNULL_PTR arg) {
19499         LDKCOption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ *ret_copy = MALLOC(sizeof(LDKCOption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ), "LDKCOption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ");
19500         *ret_copy = COption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ_clone(arg);
19501         uint64_t ret_ref = tag_ptr(ret_copy, true);
19502         return ret_ref;
19503 }
19504 int64_t  __attribute__((export_name("TS_COption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ_clone_ptr"))) TS_COption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ_clone_ptr(uint64_t arg) {
19505         LDKCOption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ* arg_conv = (LDKCOption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ*)untag_ptr(arg);
19506         int64_t ret_conv = COption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ_clone_ptr(arg_conv);
19507         return ret_conv;
19508 }
19509
19510 uint64_t  __attribute__((export_name("TS_COption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ_clone"))) TS_COption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ_clone(uint64_t orig) {
19511         LDKCOption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ* orig_conv = (LDKCOption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ*)untag_ptr(orig);
19512         LDKCOption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ *ret_copy = MALLOC(sizeof(LDKCOption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ), "LDKCOption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ");
19513         *ret_copy = COption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ_clone(orig_conv);
19514         uint64_t ret_ref = tag_ptr(ret_copy, true);
19515         return ret_ref;
19516 }
19517
19518 void  __attribute__((export_name("TS_CVec_MessageSendEventZ_free"))) TS_CVec_MessageSendEventZ_free(uint64_tArray _res) {
19519         LDKCVec_MessageSendEventZ _res_constr;
19520         _res_constr.datalen = _res->arr_len;
19521         if (_res_constr.datalen > 0)
19522                 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKMessageSendEvent), "LDKCVec_MessageSendEventZ Elements");
19523         else
19524                 _res_constr.data = NULL;
19525         uint64_t* _res_vals = _res->elems;
19526         for (size_t s = 0; s < _res_constr.datalen; s++) {
19527                 uint64_t _res_conv_18 = _res_vals[s];
19528                 void* _res_conv_18_ptr = untag_ptr(_res_conv_18);
19529                 CHECK_ACCESS(_res_conv_18_ptr);
19530                 LDKMessageSendEvent _res_conv_18_conv = *(LDKMessageSendEvent*)(_res_conv_18_ptr);
19531                 FREE(untag_ptr(_res_conv_18));
19532                 _res_constr.data[s] = _res_conv_18_conv;
19533         }
19534         FREE(_res);
19535         CVec_MessageSendEventZ_free(_res_constr);
19536 }
19537
19538 uint64_t  __attribute__((export_name("TS_CResult_ChannelUpdateInfoDecodeErrorZ_ok"))) TS_CResult_ChannelUpdateInfoDecodeErrorZ_ok(uint64_t o) {
19539         LDKChannelUpdateInfo o_conv;
19540         o_conv.inner = untag_ptr(o);
19541         o_conv.is_owned = ptr_is_owned(o);
19542         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
19543         o_conv = ChannelUpdateInfo_clone(&o_conv);
19544         LDKCResult_ChannelUpdateInfoDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelUpdateInfoDecodeErrorZ), "LDKCResult_ChannelUpdateInfoDecodeErrorZ");
19545         *ret_conv = CResult_ChannelUpdateInfoDecodeErrorZ_ok(o_conv);
19546         return tag_ptr(ret_conv, true);
19547 }
19548
19549 uint64_t  __attribute__((export_name("TS_CResult_ChannelUpdateInfoDecodeErrorZ_err"))) TS_CResult_ChannelUpdateInfoDecodeErrorZ_err(uint64_t e) {
19550         void* e_ptr = untag_ptr(e);
19551         CHECK_ACCESS(e_ptr);
19552         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
19553         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
19554         LDKCResult_ChannelUpdateInfoDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelUpdateInfoDecodeErrorZ), "LDKCResult_ChannelUpdateInfoDecodeErrorZ");
19555         *ret_conv = CResult_ChannelUpdateInfoDecodeErrorZ_err(e_conv);
19556         return tag_ptr(ret_conv, true);
19557 }
19558
19559 jboolean  __attribute__((export_name("TS_CResult_ChannelUpdateInfoDecodeErrorZ_is_ok"))) TS_CResult_ChannelUpdateInfoDecodeErrorZ_is_ok(uint64_t o) {
19560         LDKCResult_ChannelUpdateInfoDecodeErrorZ* o_conv = (LDKCResult_ChannelUpdateInfoDecodeErrorZ*)untag_ptr(o);
19561         jboolean ret_conv = CResult_ChannelUpdateInfoDecodeErrorZ_is_ok(o_conv);
19562         return ret_conv;
19563 }
19564
19565 void  __attribute__((export_name("TS_CResult_ChannelUpdateInfoDecodeErrorZ_free"))) TS_CResult_ChannelUpdateInfoDecodeErrorZ_free(uint64_t _res) {
19566         if (!ptr_is_owned(_res)) return;
19567         void* _res_ptr = untag_ptr(_res);
19568         CHECK_ACCESS(_res_ptr);
19569         LDKCResult_ChannelUpdateInfoDecodeErrorZ _res_conv = *(LDKCResult_ChannelUpdateInfoDecodeErrorZ*)(_res_ptr);
19570         FREE(untag_ptr(_res));
19571         CResult_ChannelUpdateInfoDecodeErrorZ_free(_res_conv);
19572 }
19573
19574 static inline uint64_t CResult_ChannelUpdateInfoDecodeErrorZ_clone_ptr(LDKCResult_ChannelUpdateInfoDecodeErrorZ *NONNULL_PTR arg) {
19575         LDKCResult_ChannelUpdateInfoDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelUpdateInfoDecodeErrorZ), "LDKCResult_ChannelUpdateInfoDecodeErrorZ");
19576         *ret_conv = CResult_ChannelUpdateInfoDecodeErrorZ_clone(arg);
19577         return tag_ptr(ret_conv, true);
19578 }
19579 int64_t  __attribute__((export_name("TS_CResult_ChannelUpdateInfoDecodeErrorZ_clone_ptr"))) TS_CResult_ChannelUpdateInfoDecodeErrorZ_clone_ptr(uint64_t arg) {
19580         LDKCResult_ChannelUpdateInfoDecodeErrorZ* arg_conv = (LDKCResult_ChannelUpdateInfoDecodeErrorZ*)untag_ptr(arg);
19581         int64_t ret_conv = CResult_ChannelUpdateInfoDecodeErrorZ_clone_ptr(arg_conv);
19582         return ret_conv;
19583 }
19584
19585 uint64_t  __attribute__((export_name("TS_CResult_ChannelUpdateInfoDecodeErrorZ_clone"))) TS_CResult_ChannelUpdateInfoDecodeErrorZ_clone(uint64_t orig) {
19586         LDKCResult_ChannelUpdateInfoDecodeErrorZ* orig_conv = (LDKCResult_ChannelUpdateInfoDecodeErrorZ*)untag_ptr(orig);
19587         LDKCResult_ChannelUpdateInfoDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelUpdateInfoDecodeErrorZ), "LDKCResult_ChannelUpdateInfoDecodeErrorZ");
19588         *ret_conv = CResult_ChannelUpdateInfoDecodeErrorZ_clone(orig_conv);
19589         return tag_ptr(ret_conv, true);
19590 }
19591
19592 uint64_t  __attribute__((export_name("TS_CResult_ChannelInfoDecodeErrorZ_ok"))) TS_CResult_ChannelInfoDecodeErrorZ_ok(uint64_t o) {
19593         LDKChannelInfo o_conv;
19594         o_conv.inner = untag_ptr(o);
19595         o_conv.is_owned = ptr_is_owned(o);
19596         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
19597         o_conv = ChannelInfo_clone(&o_conv);
19598         LDKCResult_ChannelInfoDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelInfoDecodeErrorZ), "LDKCResult_ChannelInfoDecodeErrorZ");
19599         *ret_conv = CResult_ChannelInfoDecodeErrorZ_ok(o_conv);
19600         return tag_ptr(ret_conv, true);
19601 }
19602
19603 uint64_t  __attribute__((export_name("TS_CResult_ChannelInfoDecodeErrorZ_err"))) TS_CResult_ChannelInfoDecodeErrorZ_err(uint64_t e) {
19604         void* e_ptr = untag_ptr(e);
19605         CHECK_ACCESS(e_ptr);
19606         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
19607         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
19608         LDKCResult_ChannelInfoDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelInfoDecodeErrorZ), "LDKCResult_ChannelInfoDecodeErrorZ");
19609         *ret_conv = CResult_ChannelInfoDecodeErrorZ_err(e_conv);
19610         return tag_ptr(ret_conv, true);
19611 }
19612
19613 jboolean  __attribute__((export_name("TS_CResult_ChannelInfoDecodeErrorZ_is_ok"))) TS_CResult_ChannelInfoDecodeErrorZ_is_ok(uint64_t o) {
19614         LDKCResult_ChannelInfoDecodeErrorZ* o_conv = (LDKCResult_ChannelInfoDecodeErrorZ*)untag_ptr(o);
19615         jboolean ret_conv = CResult_ChannelInfoDecodeErrorZ_is_ok(o_conv);
19616         return ret_conv;
19617 }
19618
19619 void  __attribute__((export_name("TS_CResult_ChannelInfoDecodeErrorZ_free"))) TS_CResult_ChannelInfoDecodeErrorZ_free(uint64_t _res) {
19620         if (!ptr_is_owned(_res)) return;
19621         void* _res_ptr = untag_ptr(_res);
19622         CHECK_ACCESS(_res_ptr);
19623         LDKCResult_ChannelInfoDecodeErrorZ _res_conv = *(LDKCResult_ChannelInfoDecodeErrorZ*)(_res_ptr);
19624         FREE(untag_ptr(_res));
19625         CResult_ChannelInfoDecodeErrorZ_free(_res_conv);
19626 }
19627
19628 static inline uint64_t CResult_ChannelInfoDecodeErrorZ_clone_ptr(LDKCResult_ChannelInfoDecodeErrorZ *NONNULL_PTR arg) {
19629         LDKCResult_ChannelInfoDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelInfoDecodeErrorZ), "LDKCResult_ChannelInfoDecodeErrorZ");
19630         *ret_conv = CResult_ChannelInfoDecodeErrorZ_clone(arg);
19631         return tag_ptr(ret_conv, true);
19632 }
19633 int64_t  __attribute__((export_name("TS_CResult_ChannelInfoDecodeErrorZ_clone_ptr"))) TS_CResult_ChannelInfoDecodeErrorZ_clone_ptr(uint64_t arg) {
19634         LDKCResult_ChannelInfoDecodeErrorZ* arg_conv = (LDKCResult_ChannelInfoDecodeErrorZ*)untag_ptr(arg);
19635         int64_t ret_conv = CResult_ChannelInfoDecodeErrorZ_clone_ptr(arg_conv);
19636         return ret_conv;
19637 }
19638
19639 uint64_t  __attribute__((export_name("TS_CResult_ChannelInfoDecodeErrorZ_clone"))) TS_CResult_ChannelInfoDecodeErrorZ_clone(uint64_t orig) {
19640         LDKCResult_ChannelInfoDecodeErrorZ* orig_conv = (LDKCResult_ChannelInfoDecodeErrorZ*)untag_ptr(orig);
19641         LDKCResult_ChannelInfoDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelInfoDecodeErrorZ), "LDKCResult_ChannelInfoDecodeErrorZ");
19642         *ret_conv = CResult_ChannelInfoDecodeErrorZ_clone(orig_conv);
19643         return tag_ptr(ret_conv, true);
19644 }
19645
19646 uint64_t  __attribute__((export_name("TS_CResult_RoutingFeesDecodeErrorZ_ok"))) TS_CResult_RoutingFeesDecodeErrorZ_ok(uint64_t o) {
19647         LDKRoutingFees o_conv;
19648         o_conv.inner = untag_ptr(o);
19649         o_conv.is_owned = ptr_is_owned(o);
19650         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
19651         o_conv = RoutingFees_clone(&o_conv);
19652         LDKCResult_RoutingFeesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RoutingFeesDecodeErrorZ), "LDKCResult_RoutingFeesDecodeErrorZ");
19653         *ret_conv = CResult_RoutingFeesDecodeErrorZ_ok(o_conv);
19654         return tag_ptr(ret_conv, true);
19655 }
19656
19657 uint64_t  __attribute__((export_name("TS_CResult_RoutingFeesDecodeErrorZ_err"))) TS_CResult_RoutingFeesDecodeErrorZ_err(uint64_t e) {
19658         void* e_ptr = untag_ptr(e);
19659         CHECK_ACCESS(e_ptr);
19660         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
19661         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
19662         LDKCResult_RoutingFeesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RoutingFeesDecodeErrorZ), "LDKCResult_RoutingFeesDecodeErrorZ");
19663         *ret_conv = CResult_RoutingFeesDecodeErrorZ_err(e_conv);
19664         return tag_ptr(ret_conv, true);
19665 }
19666
19667 jboolean  __attribute__((export_name("TS_CResult_RoutingFeesDecodeErrorZ_is_ok"))) TS_CResult_RoutingFeesDecodeErrorZ_is_ok(uint64_t o) {
19668         LDKCResult_RoutingFeesDecodeErrorZ* o_conv = (LDKCResult_RoutingFeesDecodeErrorZ*)untag_ptr(o);
19669         jboolean ret_conv = CResult_RoutingFeesDecodeErrorZ_is_ok(o_conv);
19670         return ret_conv;
19671 }
19672
19673 void  __attribute__((export_name("TS_CResult_RoutingFeesDecodeErrorZ_free"))) TS_CResult_RoutingFeesDecodeErrorZ_free(uint64_t _res) {
19674         if (!ptr_is_owned(_res)) return;
19675         void* _res_ptr = untag_ptr(_res);
19676         CHECK_ACCESS(_res_ptr);
19677         LDKCResult_RoutingFeesDecodeErrorZ _res_conv = *(LDKCResult_RoutingFeesDecodeErrorZ*)(_res_ptr);
19678         FREE(untag_ptr(_res));
19679         CResult_RoutingFeesDecodeErrorZ_free(_res_conv);
19680 }
19681
19682 static inline uint64_t CResult_RoutingFeesDecodeErrorZ_clone_ptr(LDKCResult_RoutingFeesDecodeErrorZ *NONNULL_PTR arg) {
19683         LDKCResult_RoutingFeesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RoutingFeesDecodeErrorZ), "LDKCResult_RoutingFeesDecodeErrorZ");
19684         *ret_conv = CResult_RoutingFeesDecodeErrorZ_clone(arg);
19685         return tag_ptr(ret_conv, true);
19686 }
19687 int64_t  __attribute__((export_name("TS_CResult_RoutingFeesDecodeErrorZ_clone_ptr"))) TS_CResult_RoutingFeesDecodeErrorZ_clone_ptr(uint64_t arg) {
19688         LDKCResult_RoutingFeesDecodeErrorZ* arg_conv = (LDKCResult_RoutingFeesDecodeErrorZ*)untag_ptr(arg);
19689         int64_t ret_conv = CResult_RoutingFeesDecodeErrorZ_clone_ptr(arg_conv);
19690         return ret_conv;
19691 }
19692
19693 uint64_t  __attribute__((export_name("TS_CResult_RoutingFeesDecodeErrorZ_clone"))) TS_CResult_RoutingFeesDecodeErrorZ_clone(uint64_t orig) {
19694         LDKCResult_RoutingFeesDecodeErrorZ* orig_conv = (LDKCResult_RoutingFeesDecodeErrorZ*)untag_ptr(orig);
19695         LDKCResult_RoutingFeesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RoutingFeesDecodeErrorZ), "LDKCResult_RoutingFeesDecodeErrorZ");
19696         *ret_conv = CResult_RoutingFeesDecodeErrorZ_clone(orig_conv);
19697         return tag_ptr(ret_conv, true);
19698 }
19699
19700 void  __attribute__((export_name("TS_CVec_SocketAddressZ_free"))) TS_CVec_SocketAddressZ_free(uint64_tArray _res) {
19701         LDKCVec_SocketAddressZ _res_constr;
19702         _res_constr.datalen = _res->arr_len;
19703         if (_res_constr.datalen > 0)
19704                 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKSocketAddress), "LDKCVec_SocketAddressZ Elements");
19705         else
19706                 _res_constr.data = NULL;
19707         uint64_t* _res_vals = _res->elems;
19708         for (size_t p = 0; p < _res_constr.datalen; p++) {
19709                 uint64_t _res_conv_15 = _res_vals[p];
19710                 void* _res_conv_15_ptr = untag_ptr(_res_conv_15);
19711                 CHECK_ACCESS(_res_conv_15_ptr);
19712                 LDKSocketAddress _res_conv_15_conv = *(LDKSocketAddress*)(_res_conv_15_ptr);
19713                 FREE(untag_ptr(_res_conv_15));
19714                 _res_constr.data[p] = _res_conv_15_conv;
19715         }
19716         FREE(_res);
19717         CVec_SocketAddressZ_free(_res_constr);
19718 }
19719
19720 uint64_t  __attribute__((export_name("TS_CResult_NodeAnnouncementInfoDecodeErrorZ_ok"))) TS_CResult_NodeAnnouncementInfoDecodeErrorZ_ok(uint64_t o) {
19721         LDKNodeAnnouncementInfo o_conv;
19722         o_conv.inner = untag_ptr(o);
19723         o_conv.is_owned = ptr_is_owned(o);
19724         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
19725         o_conv = NodeAnnouncementInfo_clone(&o_conv);
19726         LDKCResult_NodeAnnouncementInfoDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NodeAnnouncementInfoDecodeErrorZ), "LDKCResult_NodeAnnouncementInfoDecodeErrorZ");
19727         *ret_conv = CResult_NodeAnnouncementInfoDecodeErrorZ_ok(o_conv);
19728         return tag_ptr(ret_conv, true);
19729 }
19730
19731 uint64_t  __attribute__((export_name("TS_CResult_NodeAnnouncementInfoDecodeErrorZ_err"))) TS_CResult_NodeAnnouncementInfoDecodeErrorZ_err(uint64_t e) {
19732         void* e_ptr = untag_ptr(e);
19733         CHECK_ACCESS(e_ptr);
19734         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
19735         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
19736         LDKCResult_NodeAnnouncementInfoDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NodeAnnouncementInfoDecodeErrorZ), "LDKCResult_NodeAnnouncementInfoDecodeErrorZ");
19737         *ret_conv = CResult_NodeAnnouncementInfoDecodeErrorZ_err(e_conv);
19738         return tag_ptr(ret_conv, true);
19739 }
19740
19741 jboolean  __attribute__((export_name("TS_CResult_NodeAnnouncementInfoDecodeErrorZ_is_ok"))) TS_CResult_NodeAnnouncementInfoDecodeErrorZ_is_ok(uint64_t o) {
19742         LDKCResult_NodeAnnouncementInfoDecodeErrorZ* o_conv = (LDKCResult_NodeAnnouncementInfoDecodeErrorZ*)untag_ptr(o);
19743         jboolean ret_conv = CResult_NodeAnnouncementInfoDecodeErrorZ_is_ok(o_conv);
19744         return ret_conv;
19745 }
19746
19747 void  __attribute__((export_name("TS_CResult_NodeAnnouncementInfoDecodeErrorZ_free"))) TS_CResult_NodeAnnouncementInfoDecodeErrorZ_free(uint64_t _res) {
19748         if (!ptr_is_owned(_res)) return;
19749         void* _res_ptr = untag_ptr(_res);
19750         CHECK_ACCESS(_res_ptr);
19751         LDKCResult_NodeAnnouncementInfoDecodeErrorZ _res_conv = *(LDKCResult_NodeAnnouncementInfoDecodeErrorZ*)(_res_ptr);
19752         FREE(untag_ptr(_res));
19753         CResult_NodeAnnouncementInfoDecodeErrorZ_free(_res_conv);
19754 }
19755
19756 static inline uint64_t CResult_NodeAnnouncementInfoDecodeErrorZ_clone_ptr(LDKCResult_NodeAnnouncementInfoDecodeErrorZ *NONNULL_PTR arg) {
19757         LDKCResult_NodeAnnouncementInfoDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NodeAnnouncementInfoDecodeErrorZ), "LDKCResult_NodeAnnouncementInfoDecodeErrorZ");
19758         *ret_conv = CResult_NodeAnnouncementInfoDecodeErrorZ_clone(arg);
19759         return tag_ptr(ret_conv, true);
19760 }
19761 int64_t  __attribute__((export_name("TS_CResult_NodeAnnouncementInfoDecodeErrorZ_clone_ptr"))) TS_CResult_NodeAnnouncementInfoDecodeErrorZ_clone_ptr(uint64_t arg) {
19762         LDKCResult_NodeAnnouncementInfoDecodeErrorZ* arg_conv = (LDKCResult_NodeAnnouncementInfoDecodeErrorZ*)untag_ptr(arg);
19763         int64_t ret_conv = CResult_NodeAnnouncementInfoDecodeErrorZ_clone_ptr(arg_conv);
19764         return ret_conv;
19765 }
19766
19767 uint64_t  __attribute__((export_name("TS_CResult_NodeAnnouncementInfoDecodeErrorZ_clone"))) TS_CResult_NodeAnnouncementInfoDecodeErrorZ_clone(uint64_t orig) {
19768         LDKCResult_NodeAnnouncementInfoDecodeErrorZ* orig_conv = (LDKCResult_NodeAnnouncementInfoDecodeErrorZ*)untag_ptr(orig);
19769         LDKCResult_NodeAnnouncementInfoDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NodeAnnouncementInfoDecodeErrorZ), "LDKCResult_NodeAnnouncementInfoDecodeErrorZ");
19770         *ret_conv = CResult_NodeAnnouncementInfoDecodeErrorZ_clone(orig_conv);
19771         return tag_ptr(ret_conv, true);
19772 }
19773
19774 uint64_t  __attribute__((export_name("TS_CResult_NodeAliasDecodeErrorZ_ok"))) TS_CResult_NodeAliasDecodeErrorZ_ok(uint64_t o) {
19775         LDKNodeAlias o_conv;
19776         o_conv.inner = untag_ptr(o);
19777         o_conv.is_owned = ptr_is_owned(o);
19778         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
19779         o_conv = NodeAlias_clone(&o_conv);
19780         LDKCResult_NodeAliasDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NodeAliasDecodeErrorZ), "LDKCResult_NodeAliasDecodeErrorZ");
19781         *ret_conv = CResult_NodeAliasDecodeErrorZ_ok(o_conv);
19782         return tag_ptr(ret_conv, true);
19783 }
19784
19785 uint64_t  __attribute__((export_name("TS_CResult_NodeAliasDecodeErrorZ_err"))) TS_CResult_NodeAliasDecodeErrorZ_err(uint64_t e) {
19786         void* e_ptr = untag_ptr(e);
19787         CHECK_ACCESS(e_ptr);
19788         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
19789         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
19790         LDKCResult_NodeAliasDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NodeAliasDecodeErrorZ), "LDKCResult_NodeAliasDecodeErrorZ");
19791         *ret_conv = CResult_NodeAliasDecodeErrorZ_err(e_conv);
19792         return tag_ptr(ret_conv, true);
19793 }
19794
19795 jboolean  __attribute__((export_name("TS_CResult_NodeAliasDecodeErrorZ_is_ok"))) TS_CResult_NodeAliasDecodeErrorZ_is_ok(uint64_t o) {
19796         LDKCResult_NodeAliasDecodeErrorZ* o_conv = (LDKCResult_NodeAliasDecodeErrorZ*)untag_ptr(o);
19797         jboolean ret_conv = CResult_NodeAliasDecodeErrorZ_is_ok(o_conv);
19798         return ret_conv;
19799 }
19800
19801 void  __attribute__((export_name("TS_CResult_NodeAliasDecodeErrorZ_free"))) TS_CResult_NodeAliasDecodeErrorZ_free(uint64_t _res) {
19802         if (!ptr_is_owned(_res)) return;
19803         void* _res_ptr = untag_ptr(_res);
19804         CHECK_ACCESS(_res_ptr);
19805         LDKCResult_NodeAliasDecodeErrorZ _res_conv = *(LDKCResult_NodeAliasDecodeErrorZ*)(_res_ptr);
19806         FREE(untag_ptr(_res));
19807         CResult_NodeAliasDecodeErrorZ_free(_res_conv);
19808 }
19809
19810 static inline uint64_t CResult_NodeAliasDecodeErrorZ_clone_ptr(LDKCResult_NodeAliasDecodeErrorZ *NONNULL_PTR arg) {
19811         LDKCResult_NodeAliasDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NodeAliasDecodeErrorZ), "LDKCResult_NodeAliasDecodeErrorZ");
19812         *ret_conv = CResult_NodeAliasDecodeErrorZ_clone(arg);
19813         return tag_ptr(ret_conv, true);
19814 }
19815 int64_t  __attribute__((export_name("TS_CResult_NodeAliasDecodeErrorZ_clone_ptr"))) TS_CResult_NodeAliasDecodeErrorZ_clone_ptr(uint64_t arg) {
19816         LDKCResult_NodeAliasDecodeErrorZ* arg_conv = (LDKCResult_NodeAliasDecodeErrorZ*)untag_ptr(arg);
19817         int64_t ret_conv = CResult_NodeAliasDecodeErrorZ_clone_ptr(arg_conv);
19818         return ret_conv;
19819 }
19820
19821 uint64_t  __attribute__((export_name("TS_CResult_NodeAliasDecodeErrorZ_clone"))) TS_CResult_NodeAliasDecodeErrorZ_clone(uint64_t orig) {
19822         LDKCResult_NodeAliasDecodeErrorZ* orig_conv = (LDKCResult_NodeAliasDecodeErrorZ*)untag_ptr(orig);
19823         LDKCResult_NodeAliasDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NodeAliasDecodeErrorZ), "LDKCResult_NodeAliasDecodeErrorZ");
19824         *ret_conv = CResult_NodeAliasDecodeErrorZ_clone(orig_conv);
19825         return tag_ptr(ret_conv, true);
19826 }
19827
19828 uint64_t  __attribute__((export_name("TS_CResult_NodeInfoDecodeErrorZ_ok"))) TS_CResult_NodeInfoDecodeErrorZ_ok(uint64_t o) {
19829         LDKNodeInfo o_conv;
19830         o_conv.inner = untag_ptr(o);
19831         o_conv.is_owned = ptr_is_owned(o);
19832         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
19833         o_conv = NodeInfo_clone(&o_conv);
19834         LDKCResult_NodeInfoDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NodeInfoDecodeErrorZ), "LDKCResult_NodeInfoDecodeErrorZ");
19835         *ret_conv = CResult_NodeInfoDecodeErrorZ_ok(o_conv);
19836         return tag_ptr(ret_conv, true);
19837 }
19838
19839 uint64_t  __attribute__((export_name("TS_CResult_NodeInfoDecodeErrorZ_err"))) TS_CResult_NodeInfoDecodeErrorZ_err(uint64_t e) {
19840         void* e_ptr = untag_ptr(e);
19841         CHECK_ACCESS(e_ptr);
19842         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
19843         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
19844         LDKCResult_NodeInfoDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NodeInfoDecodeErrorZ), "LDKCResult_NodeInfoDecodeErrorZ");
19845         *ret_conv = CResult_NodeInfoDecodeErrorZ_err(e_conv);
19846         return tag_ptr(ret_conv, true);
19847 }
19848
19849 jboolean  __attribute__((export_name("TS_CResult_NodeInfoDecodeErrorZ_is_ok"))) TS_CResult_NodeInfoDecodeErrorZ_is_ok(uint64_t o) {
19850         LDKCResult_NodeInfoDecodeErrorZ* o_conv = (LDKCResult_NodeInfoDecodeErrorZ*)untag_ptr(o);
19851         jboolean ret_conv = CResult_NodeInfoDecodeErrorZ_is_ok(o_conv);
19852         return ret_conv;
19853 }
19854
19855 void  __attribute__((export_name("TS_CResult_NodeInfoDecodeErrorZ_free"))) TS_CResult_NodeInfoDecodeErrorZ_free(uint64_t _res) {
19856         if (!ptr_is_owned(_res)) return;
19857         void* _res_ptr = untag_ptr(_res);
19858         CHECK_ACCESS(_res_ptr);
19859         LDKCResult_NodeInfoDecodeErrorZ _res_conv = *(LDKCResult_NodeInfoDecodeErrorZ*)(_res_ptr);
19860         FREE(untag_ptr(_res));
19861         CResult_NodeInfoDecodeErrorZ_free(_res_conv);
19862 }
19863
19864 static inline uint64_t CResult_NodeInfoDecodeErrorZ_clone_ptr(LDKCResult_NodeInfoDecodeErrorZ *NONNULL_PTR arg) {
19865         LDKCResult_NodeInfoDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NodeInfoDecodeErrorZ), "LDKCResult_NodeInfoDecodeErrorZ");
19866         *ret_conv = CResult_NodeInfoDecodeErrorZ_clone(arg);
19867         return tag_ptr(ret_conv, true);
19868 }
19869 int64_t  __attribute__((export_name("TS_CResult_NodeInfoDecodeErrorZ_clone_ptr"))) TS_CResult_NodeInfoDecodeErrorZ_clone_ptr(uint64_t arg) {
19870         LDKCResult_NodeInfoDecodeErrorZ* arg_conv = (LDKCResult_NodeInfoDecodeErrorZ*)untag_ptr(arg);
19871         int64_t ret_conv = CResult_NodeInfoDecodeErrorZ_clone_ptr(arg_conv);
19872         return ret_conv;
19873 }
19874
19875 uint64_t  __attribute__((export_name("TS_CResult_NodeInfoDecodeErrorZ_clone"))) TS_CResult_NodeInfoDecodeErrorZ_clone(uint64_t orig) {
19876         LDKCResult_NodeInfoDecodeErrorZ* orig_conv = (LDKCResult_NodeInfoDecodeErrorZ*)untag_ptr(orig);
19877         LDKCResult_NodeInfoDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NodeInfoDecodeErrorZ), "LDKCResult_NodeInfoDecodeErrorZ");
19878         *ret_conv = CResult_NodeInfoDecodeErrorZ_clone(orig_conv);
19879         return tag_ptr(ret_conv, true);
19880 }
19881
19882 uint64_t  __attribute__((export_name("TS_CResult_NetworkGraphDecodeErrorZ_ok"))) TS_CResult_NetworkGraphDecodeErrorZ_ok(uint64_t o) {
19883         LDKNetworkGraph o_conv;
19884         o_conv.inner = untag_ptr(o);
19885         o_conv.is_owned = ptr_is_owned(o);
19886         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
19887         // WARNING: we need a move here but no clone is available for LDKNetworkGraph
19888         
19889         LDKCResult_NetworkGraphDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NetworkGraphDecodeErrorZ), "LDKCResult_NetworkGraphDecodeErrorZ");
19890         *ret_conv = CResult_NetworkGraphDecodeErrorZ_ok(o_conv);
19891         return tag_ptr(ret_conv, true);
19892 }
19893
19894 uint64_t  __attribute__((export_name("TS_CResult_NetworkGraphDecodeErrorZ_err"))) TS_CResult_NetworkGraphDecodeErrorZ_err(uint64_t e) {
19895         void* e_ptr = untag_ptr(e);
19896         CHECK_ACCESS(e_ptr);
19897         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
19898         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
19899         LDKCResult_NetworkGraphDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NetworkGraphDecodeErrorZ), "LDKCResult_NetworkGraphDecodeErrorZ");
19900         *ret_conv = CResult_NetworkGraphDecodeErrorZ_err(e_conv);
19901         return tag_ptr(ret_conv, true);
19902 }
19903
19904 jboolean  __attribute__((export_name("TS_CResult_NetworkGraphDecodeErrorZ_is_ok"))) TS_CResult_NetworkGraphDecodeErrorZ_is_ok(uint64_t o) {
19905         LDKCResult_NetworkGraphDecodeErrorZ* o_conv = (LDKCResult_NetworkGraphDecodeErrorZ*)untag_ptr(o);
19906         jboolean ret_conv = CResult_NetworkGraphDecodeErrorZ_is_ok(o_conv);
19907         return ret_conv;
19908 }
19909
19910 void  __attribute__((export_name("TS_CResult_NetworkGraphDecodeErrorZ_free"))) TS_CResult_NetworkGraphDecodeErrorZ_free(uint64_t _res) {
19911         if (!ptr_is_owned(_res)) return;
19912         void* _res_ptr = untag_ptr(_res);
19913         CHECK_ACCESS(_res_ptr);
19914         LDKCResult_NetworkGraphDecodeErrorZ _res_conv = *(LDKCResult_NetworkGraphDecodeErrorZ*)(_res_ptr);
19915         FREE(untag_ptr(_res));
19916         CResult_NetworkGraphDecodeErrorZ_free(_res_conv);
19917 }
19918
19919 uint64_t  __attribute__((export_name("TS_COption_CVec_SocketAddressZZ_some"))) TS_COption_CVec_SocketAddressZZ_some(uint64_tArray o) {
19920         LDKCVec_SocketAddressZ o_constr;
19921         o_constr.datalen = o->arr_len;
19922         if (o_constr.datalen > 0)
19923                 o_constr.data = MALLOC(o_constr.datalen * sizeof(LDKSocketAddress), "LDKCVec_SocketAddressZ Elements");
19924         else
19925                 o_constr.data = NULL;
19926         uint64_t* o_vals = o->elems;
19927         for (size_t p = 0; p < o_constr.datalen; p++) {
19928                 uint64_t o_conv_15 = o_vals[p];
19929                 void* o_conv_15_ptr = untag_ptr(o_conv_15);
19930                 CHECK_ACCESS(o_conv_15_ptr);
19931                 LDKSocketAddress o_conv_15_conv = *(LDKSocketAddress*)(o_conv_15_ptr);
19932                 o_conv_15_conv = SocketAddress_clone((LDKSocketAddress*)untag_ptr(o_conv_15));
19933                 o_constr.data[p] = o_conv_15_conv;
19934         }
19935         FREE(o);
19936         LDKCOption_CVec_SocketAddressZZ *ret_copy = MALLOC(sizeof(LDKCOption_CVec_SocketAddressZZ), "LDKCOption_CVec_SocketAddressZZ");
19937         *ret_copy = COption_CVec_SocketAddressZZ_some(o_constr);
19938         uint64_t ret_ref = tag_ptr(ret_copy, true);
19939         return ret_ref;
19940 }
19941
19942 uint64_t  __attribute__((export_name("TS_COption_CVec_SocketAddressZZ_none"))) TS_COption_CVec_SocketAddressZZ_none() {
19943         LDKCOption_CVec_SocketAddressZZ *ret_copy = MALLOC(sizeof(LDKCOption_CVec_SocketAddressZZ), "LDKCOption_CVec_SocketAddressZZ");
19944         *ret_copy = COption_CVec_SocketAddressZZ_none();
19945         uint64_t ret_ref = tag_ptr(ret_copy, true);
19946         return ret_ref;
19947 }
19948
19949 void  __attribute__((export_name("TS_COption_CVec_SocketAddressZZ_free"))) TS_COption_CVec_SocketAddressZZ_free(uint64_t _res) {
19950         if (!ptr_is_owned(_res)) return;
19951         void* _res_ptr = untag_ptr(_res);
19952         CHECK_ACCESS(_res_ptr);
19953         LDKCOption_CVec_SocketAddressZZ _res_conv = *(LDKCOption_CVec_SocketAddressZZ*)(_res_ptr);
19954         FREE(untag_ptr(_res));
19955         COption_CVec_SocketAddressZZ_free(_res_conv);
19956 }
19957
19958 static inline uint64_t COption_CVec_SocketAddressZZ_clone_ptr(LDKCOption_CVec_SocketAddressZZ *NONNULL_PTR arg) {
19959         LDKCOption_CVec_SocketAddressZZ *ret_copy = MALLOC(sizeof(LDKCOption_CVec_SocketAddressZZ), "LDKCOption_CVec_SocketAddressZZ");
19960         *ret_copy = COption_CVec_SocketAddressZZ_clone(arg);
19961         uint64_t ret_ref = tag_ptr(ret_copy, true);
19962         return ret_ref;
19963 }
19964 int64_t  __attribute__((export_name("TS_COption_CVec_SocketAddressZZ_clone_ptr"))) TS_COption_CVec_SocketAddressZZ_clone_ptr(uint64_t arg) {
19965         LDKCOption_CVec_SocketAddressZZ* arg_conv = (LDKCOption_CVec_SocketAddressZZ*)untag_ptr(arg);
19966         int64_t ret_conv = COption_CVec_SocketAddressZZ_clone_ptr(arg_conv);
19967         return ret_conv;
19968 }
19969
19970 uint64_t  __attribute__((export_name("TS_COption_CVec_SocketAddressZZ_clone"))) TS_COption_CVec_SocketAddressZZ_clone(uint64_t orig) {
19971         LDKCOption_CVec_SocketAddressZZ* orig_conv = (LDKCOption_CVec_SocketAddressZZ*)untag_ptr(orig);
19972         LDKCOption_CVec_SocketAddressZZ *ret_copy = MALLOC(sizeof(LDKCOption_CVec_SocketAddressZZ), "LDKCOption_CVec_SocketAddressZZ");
19973         *ret_copy = COption_CVec_SocketAddressZZ_clone(orig_conv);
19974         uint64_t ret_ref = tag_ptr(ret_copy, true);
19975         return ret_ref;
19976 }
19977
19978 void  __attribute__((export_name("TS_CVec_HTLCOutputInCommitmentZ_free"))) TS_CVec_HTLCOutputInCommitmentZ_free(uint64_tArray _res) {
19979         LDKCVec_HTLCOutputInCommitmentZ _res_constr;
19980         _res_constr.datalen = _res->arr_len;
19981         if (_res_constr.datalen > 0)
19982                 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKHTLCOutputInCommitment), "LDKCVec_HTLCOutputInCommitmentZ Elements");
19983         else
19984                 _res_constr.data = NULL;
19985         uint64_t* _res_vals = _res->elems;
19986         for (size_t y = 0; y < _res_constr.datalen; y++) {
19987                 uint64_t _res_conv_24 = _res_vals[y];
19988                 LDKHTLCOutputInCommitment _res_conv_24_conv;
19989                 _res_conv_24_conv.inner = untag_ptr(_res_conv_24);
19990                 _res_conv_24_conv.is_owned = ptr_is_owned(_res_conv_24);
19991                 CHECK_INNER_FIELD_ACCESS_OR_NULL(_res_conv_24_conv);
19992                 _res_constr.data[y] = _res_conv_24_conv;
19993         }
19994         FREE(_res);
19995         CVec_HTLCOutputInCommitmentZ_free(_res_constr);
19996 }
19997
19998 void  __attribute__((export_name("TS_CVec_HTLCDescriptorZ_free"))) TS_CVec_HTLCDescriptorZ_free(uint64_tArray _res) {
19999         LDKCVec_HTLCDescriptorZ _res_constr;
20000         _res_constr.datalen = _res->arr_len;
20001         if (_res_constr.datalen > 0)
20002                 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKHTLCDescriptor), "LDKCVec_HTLCDescriptorZ Elements");
20003         else
20004                 _res_constr.data = NULL;
20005         uint64_t* _res_vals = _res->elems;
20006         for (size_t q = 0; q < _res_constr.datalen; q++) {
20007                 uint64_t _res_conv_16 = _res_vals[q];
20008                 LDKHTLCDescriptor _res_conv_16_conv;
20009                 _res_conv_16_conv.inner = untag_ptr(_res_conv_16);
20010                 _res_conv_16_conv.is_owned = ptr_is_owned(_res_conv_16);
20011                 CHECK_INNER_FIELD_ACCESS_OR_NULL(_res_conv_16_conv);
20012                 _res_constr.data[q] = _res_conv_16_conv;
20013         }
20014         FREE(_res);
20015         CVec_HTLCDescriptorZ_free(_res_constr);
20016 }
20017
20018 void  __attribute__((export_name("TS_CVec_UtxoZ_free"))) TS_CVec_UtxoZ_free(uint64_tArray _res) {
20019         LDKCVec_UtxoZ _res_constr;
20020         _res_constr.datalen = _res->arr_len;
20021         if (_res_constr.datalen > 0)
20022                 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKUtxo), "LDKCVec_UtxoZ Elements");
20023         else
20024                 _res_constr.data = NULL;
20025         uint64_t* _res_vals = _res->elems;
20026         for (size_t g = 0; g < _res_constr.datalen; g++) {
20027                 uint64_t _res_conv_6 = _res_vals[g];
20028                 LDKUtxo _res_conv_6_conv;
20029                 _res_conv_6_conv.inner = untag_ptr(_res_conv_6);
20030                 _res_conv_6_conv.is_owned = ptr_is_owned(_res_conv_6);
20031                 CHECK_INNER_FIELD_ACCESS_OR_NULL(_res_conv_6_conv);
20032                 _res_constr.data[g] = _res_conv_6_conv;
20033         }
20034         FREE(_res);
20035         CVec_UtxoZ_free(_res_constr);
20036 }
20037
20038 uint64_t  __attribute__((export_name("TS_COption_TxOutZ_some"))) TS_COption_TxOutZ_some(uint64_t o) {
20039         void* o_ptr = untag_ptr(o);
20040         CHECK_ACCESS(o_ptr);
20041         LDKTxOut o_conv = *(LDKTxOut*)(o_ptr);
20042         o_conv = TxOut_clone((LDKTxOut*)untag_ptr(o));
20043         LDKCOption_TxOutZ *ret_copy = MALLOC(sizeof(LDKCOption_TxOutZ), "LDKCOption_TxOutZ");
20044         *ret_copy = COption_TxOutZ_some(o_conv);
20045         uint64_t ret_ref = tag_ptr(ret_copy, true);
20046         return ret_ref;
20047 }
20048
20049 uint64_t  __attribute__((export_name("TS_COption_TxOutZ_none"))) TS_COption_TxOutZ_none() {
20050         LDKCOption_TxOutZ *ret_copy = MALLOC(sizeof(LDKCOption_TxOutZ), "LDKCOption_TxOutZ");
20051         *ret_copy = COption_TxOutZ_none();
20052         uint64_t ret_ref = tag_ptr(ret_copy, true);
20053         return ret_ref;
20054 }
20055
20056 void  __attribute__((export_name("TS_COption_TxOutZ_free"))) TS_COption_TxOutZ_free(uint64_t _res) {
20057         if (!ptr_is_owned(_res)) return;
20058         void* _res_ptr = untag_ptr(_res);
20059         CHECK_ACCESS(_res_ptr);
20060         LDKCOption_TxOutZ _res_conv = *(LDKCOption_TxOutZ*)(_res_ptr);
20061         FREE(untag_ptr(_res));
20062         COption_TxOutZ_free(_res_conv);
20063 }
20064
20065 static inline uint64_t COption_TxOutZ_clone_ptr(LDKCOption_TxOutZ *NONNULL_PTR arg) {
20066         LDKCOption_TxOutZ *ret_copy = MALLOC(sizeof(LDKCOption_TxOutZ), "LDKCOption_TxOutZ");
20067         *ret_copy = COption_TxOutZ_clone(arg);
20068         uint64_t ret_ref = tag_ptr(ret_copy, true);
20069         return ret_ref;
20070 }
20071 int64_t  __attribute__((export_name("TS_COption_TxOutZ_clone_ptr"))) TS_COption_TxOutZ_clone_ptr(uint64_t arg) {
20072         LDKCOption_TxOutZ* arg_conv = (LDKCOption_TxOutZ*)untag_ptr(arg);
20073         int64_t ret_conv = COption_TxOutZ_clone_ptr(arg_conv);
20074         return ret_conv;
20075 }
20076
20077 uint64_t  __attribute__((export_name("TS_COption_TxOutZ_clone"))) TS_COption_TxOutZ_clone(uint64_t orig) {
20078         LDKCOption_TxOutZ* orig_conv = (LDKCOption_TxOutZ*)untag_ptr(orig);
20079         LDKCOption_TxOutZ *ret_copy = MALLOC(sizeof(LDKCOption_TxOutZ), "LDKCOption_TxOutZ");
20080         *ret_copy = COption_TxOutZ_clone(orig_conv);
20081         uint64_t ret_ref = tag_ptr(ret_copy, true);
20082         return ret_ref;
20083 }
20084
20085 void  __attribute__((export_name("TS_CVec_InputZ_free"))) TS_CVec_InputZ_free(uint64_tArray _res) {
20086         LDKCVec_InputZ _res_constr;
20087         _res_constr.datalen = _res->arr_len;
20088         if (_res_constr.datalen > 0)
20089                 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKInput), "LDKCVec_InputZ Elements");
20090         else
20091                 _res_constr.data = NULL;
20092         uint64_t* _res_vals = _res->elems;
20093         for (size_t h = 0; h < _res_constr.datalen; h++) {
20094                 uint64_t _res_conv_7 = _res_vals[h];
20095                 LDKInput _res_conv_7_conv;
20096                 _res_conv_7_conv.inner = untag_ptr(_res_conv_7);
20097                 _res_conv_7_conv.is_owned = ptr_is_owned(_res_conv_7);
20098                 CHECK_INNER_FIELD_ACCESS_OR_NULL(_res_conv_7_conv);
20099                 _res_constr.data[h] = _res_conv_7_conv;
20100         }
20101         FREE(_res);
20102         CVec_InputZ_free(_res_constr);
20103 }
20104
20105 uint64_t  __attribute__((export_name("TS_CResult_CoinSelectionNoneZ_ok"))) TS_CResult_CoinSelectionNoneZ_ok(uint64_t o) {
20106         LDKCoinSelection o_conv;
20107         o_conv.inner = untag_ptr(o);
20108         o_conv.is_owned = ptr_is_owned(o);
20109         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
20110         o_conv = CoinSelection_clone(&o_conv);
20111         LDKCResult_CoinSelectionNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_CoinSelectionNoneZ), "LDKCResult_CoinSelectionNoneZ");
20112         *ret_conv = CResult_CoinSelectionNoneZ_ok(o_conv);
20113         return tag_ptr(ret_conv, true);
20114 }
20115
20116 uint64_t  __attribute__((export_name("TS_CResult_CoinSelectionNoneZ_err"))) TS_CResult_CoinSelectionNoneZ_err() {
20117         LDKCResult_CoinSelectionNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_CoinSelectionNoneZ), "LDKCResult_CoinSelectionNoneZ");
20118         *ret_conv = CResult_CoinSelectionNoneZ_err();
20119         return tag_ptr(ret_conv, true);
20120 }
20121
20122 jboolean  __attribute__((export_name("TS_CResult_CoinSelectionNoneZ_is_ok"))) TS_CResult_CoinSelectionNoneZ_is_ok(uint64_t o) {
20123         LDKCResult_CoinSelectionNoneZ* o_conv = (LDKCResult_CoinSelectionNoneZ*)untag_ptr(o);
20124         jboolean ret_conv = CResult_CoinSelectionNoneZ_is_ok(o_conv);
20125         return ret_conv;
20126 }
20127
20128 void  __attribute__((export_name("TS_CResult_CoinSelectionNoneZ_free"))) TS_CResult_CoinSelectionNoneZ_free(uint64_t _res) {
20129         if (!ptr_is_owned(_res)) return;
20130         void* _res_ptr = untag_ptr(_res);
20131         CHECK_ACCESS(_res_ptr);
20132         LDKCResult_CoinSelectionNoneZ _res_conv = *(LDKCResult_CoinSelectionNoneZ*)(_res_ptr);
20133         FREE(untag_ptr(_res));
20134         CResult_CoinSelectionNoneZ_free(_res_conv);
20135 }
20136
20137 static inline uint64_t CResult_CoinSelectionNoneZ_clone_ptr(LDKCResult_CoinSelectionNoneZ *NONNULL_PTR arg) {
20138         LDKCResult_CoinSelectionNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_CoinSelectionNoneZ), "LDKCResult_CoinSelectionNoneZ");
20139         *ret_conv = CResult_CoinSelectionNoneZ_clone(arg);
20140         return tag_ptr(ret_conv, true);
20141 }
20142 int64_t  __attribute__((export_name("TS_CResult_CoinSelectionNoneZ_clone_ptr"))) TS_CResult_CoinSelectionNoneZ_clone_ptr(uint64_t arg) {
20143         LDKCResult_CoinSelectionNoneZ* arg_conv = (LDKCResult_CoinSelectionNoneZ*)untag_ptr(arg);
20144         int64_t ret_conv = CResult_CoinSelectionNoneZ_clone_ptr(arg_conv);
20145         return ret_conv;
20146 }
20147
20148 uint64_t  __attribute__((export_name("TS_CResult_CoinSelectionNoneZ_clone"))) TS_CResult_CoinSelectionNoneZ_clone(uint64_t orig) {
20149         LDKCResult_CoinSelectionNoneZ* orig_conv = (LDKCResult_CoinSelectionNoneZ*)untag_ptr(orig);
20150         LDKCResult_CoinSelectionNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_CoinSelectionNoneZ), "LDKCResult_CoinSelectionNoneZ");
20151         *ret_conv = CResult_CoinSelectionNoneZ_clone(orig_conv);
20152         return tag_ptr(ret_conv, true);
20153 }
20154
20155 uint64_t  __attribute__((export_name("TS_CResult_CVec_UtxoZNoneZ_ok"))) TS_CResult_CVec_UtxoZNoneZ_ok(uint64_tArray o) {
20156         LDKCVec_UtxoZ o_constr;
20157         o_constr.datalen = o->arr_len;
20158         if (o_constr.datalen > 0)
20159                 o_constr.data = MALLOC(o_constr.datalen * sizeof(LDKUtxo), "LDKCVec_UtxoZ Elements");
20160         else
20161                 o_constr.data = NULL;
20162         uint64_t* o_vals = o->elems;
20163         for (size_t g = 0; g < o_constr.datalen; g++) {
20164                 uint64_t o_conv_6 = o_vals[g];
20165                 LDKUtxo o_conv_6_conv;
20166                 o_conv_6_conv.inner = untag_ptr(o_conv_6);
20167                 o_conv_6_conv.is_owned = ptr_is_owned(o_conv_6);
20168                 CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv_6_conv);
20169                 o_conv_6_conv = Utxo_clone(&o_conv_6_conv);
20170                 o_constr.data[g] = o_conv_6_conv;
20171         }
20172         FREE(o);
20173         LDKCResult_CVec_UtxoZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_UtxoZNoneZ), "LDKCResult_CVec_UtxoZNoneZ");
20174         *ret_conv = CResult_CVec_UtxoZNoneZ_ok(o_constr);
20175         return tag_ptr(ret_conv, true);
20176 }
20177
20178 uint64_t  __attribute__((export_name("TS_CResult_CVec_UtxoZNoneZ_err"))) TS_CResult_CVec_UtxoZNoneZ_err() {
20179         LDKCResult_CVec_UtxoZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_UtxoZNoneZ), "LDKCResult_CVec_UtxoZNoneZ");
20180         *ret_conv = CResult_CVec_UtxoZNoneZ_err();
20181         return tag_ptr(ret_conv, true);
20182 }
20183
20184 jboolean  __attribute__((export_name("TS_CResult_CVec_UtxoZNoneZ_is_ok"))) TS_CResult_CVec_UtxoZNoneZ_is_ok(uint64_t o) {
20185         LDKCResult_CVec_UtxoZNoneZ* o_conv = (LDKCResult_CVec_UtxoZNoneZ*)untag_ptr(o);
20186         jboolean ret_conv = CResult_CVec_UtxoZNoneZ_is_ok(o_conv);
20187         return ret_conv;
20188 }
20189
20190 void  __attribute__((export_name("TS_CResult_CVec_UtxoZNoneZ_free"))) TS_CResult_CVec_UtxoZNoneZ_free(uint64_t _res) {
20191         if (!ptr_is_owned(_res)) return;
20192         void* _res_ptr = untag_ptr(_res);
20193         CHECK_ACCESS(_res_ptr);
20194         LDKCResult_CVec_UtxoZNoneZ _res_conv = *(LDKCResult_CVec_UtxoZNoneZ*)(_res_ptr);
20195         FREE(untag_ptr(_res));
20196         CResult_CVec_UtxoZNoneZ_free(_res_conv);
20197 }
20198
20199 static inline uint64_t CResult_CVec_UtxoZNoneZ_clone_ptr(LDKCResult_CVec_UtxoZNoneZ *NONNULL_PTR arg) {
20200         LDKCResult_CVec_UtxoZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_UtxoZNoneZ), "LDKCResult_CVec_UtxoZNoneZ");
20201         *ret_conv = CResult_CVec_UtxoZNoneZ_clone(arg);
20202         return tag_ptr(ret_conv, true);
20203 }
20204 int64_t  __attribute__((export_name("TS_CResult_CVec_UtxoZNoneZ_clone_ptr"))) TS_CResult_CVec_UtxoZNoneZ_clone_ptr(uint64_t arg) {
20205         LDKCResult_CVec_UtxoZNoneZ* arg_conv = (LDKCResult_CVec_UtxoZNoneZ*)untag_ptr(arg);
20206         int64_t ret_conv = CResult_CVec_UtxoZNoneZ_clone_ptr(arg_conv);
20207         return ret_conv;
20208 }
20209
20210 uint64_t  __attribute__((export_name("TS_CResult_CVec_UtxoZNoneZ_clone"))) TS_CResult_CVec_UtxoZNoneZ_clone(uint64_t orig) {
20211         LDKCResult_CVec_UtxoZNoneZ* orig_conv = (LDKCResult_CVec_UtxoZNoneZ*)untag_ptr(orig);
20212         LDKCResult_CVec_UtxoZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_UtxoZNoneZ), "LDKCResult_CVec_UtxoZNoneZ");
20213         *ret_conv = CResult_CVec_UtxoZNoneZ_clone(orig_conv);
20214         return tag_ptr(ret_conv, true);
20215 }
20216
20217 static inline uint64_t C2Tuple_u64u16Z_clone_ptr(LDKC2Tuple_u64u16Z *NONNULL_PTR arg) {
20218         LDKC2Tuple_u64u16Z* ret_conv = MALLOC(sizeof(LDKC2Tuple_u64u16Z), "LDKC2Tuple_u64u16Z");
20219         *ret_conv = C2Tuple_u64u16Z_clone(arg);
20220         return tag_ptr(ret_conv, true);
20221 }
20222 int64_t  __attribute__((export_name("TS_C2Tuple_u64u16Z_clone_ptr"))) TS_C2Tuple_u64u16Z_clone_ptr(uint64_t arg) {
20223         LDKC2Tuple_u64u16Z* arg_conv = (LDKC2Tuple_u64u16Z*)untag_ptr(arg);
20224         int64_t ret_conv = C2Tuple_u64u16Z_clone_ptr(arg_conv);
20225         return ret_conv;
20226 }
20227
20228 uint64_t  __attribute__((export_name("TS_C2Tuple_u64u16Z_clone"))) TS_C2Tuple_u64u16Z_clone(uint64_t orig) {
20229         LDKC2Tuple_u64u16Z* orig_conv = (LDKC2Tuple_u64u16Z*)untag_ptr(orig);
20230         LDKC2Tuple_u64u16Z* ret_conv = MALLOC(sizeof(LDKC2Tuple_u64u16Z), "LDKC2Tuple_u64u16Z");
20231         *ret_conv = C2Tuple_u64u16Z_clone(orig_conv);
20232         return tag_ptr(ret_conv, true);
20233 }
20234
20235 uint64_t  __attribute__((export_name("TS_C2Tuple_u64u16Z_new"))) TS_C2Tuple_u64u16Z_new(int64_t a, int16_t b) {
20236         LDKC2Tuple_u64u16Z* ret_conv = MALLOC(sizeof(LDKC2Tuple_u64u16Z), "LDKC2Tuple_u64u16Z");
20237         *ret_conv = C2Tuple_u64u16Z_new(a, b);
20238         return tag_ptr(ret_conv, true);
20239 }
20240
20241 void  __attribute__((export_name("TS_C2Tuple_u64u16Z_free"))) TS_C2Tuple_u64u16Z_free(uint64_t _res) {
20242         if (!ptr_is_owned(_res)) return;
20243         void* _res_ptr = untag_ptr(_res);
20244         CHECK_ACCESS(_res_ptr);
20245         LDKC2Tuple_u64u16Z _res_conv = *(LDKC2Tuple_u64u16Z*)(_res_ptr);
20246         FREE(untag_ptr(_res));
20247         C2Tuple_u64u16Z_free(_res_conv);
20248 }
20249
20250 uint64_t  __attribute__((export_name("TS_COption_C2Tuple_u64u16ZZ_some"))) TS_COption_C2Tuple_u64u16ZZ_some(uint64_t o) {
20251         void* o_ptr = untag_ptr(o);
20252         CHECK_ACCESS(o_ptr);
20253         LDKC2Tuple_u64u16Z o_conv = *(LDKC2Tuple_u64u16Z*)(o_ptr);
20254         o_conv = C2Tuple_u64u16Z_clone((LDKC2Tuple_u64u16Z*)untag_ptr(o));
20255         LDKCOption_C2Tuple_u64u16ZZ *ret_copy = MALLOC(sizeof(LDKCOption_C2Tuple_u64u16ZZ), "LDKCOption_C2Tuple_u64u16ZZ");
20256         *ret_copy = COption_C2Tuple_u64u16ZZ_some(o_conv);
20257         uint64_t ret_ref = tag_ptr(ret_copy, true);
20258         return ret_ref;
20259 }
20260
20261 uint64_t  __attribute__((export_name("TS_COption_C2Tuple_u64u16ZZ_none"))) TS_COption_C2Tuple_u64u16ZZ_none() {
20262         LDKCOption_C2Tuple_u64u16ZZ *ret_copy = MALLOC(sizeof(LDKCOption_C2Tuple_u64u16ZZ), "LDKCOption_C2Tuple_u64u16ZZ");
20263         *ret_copy = COption_C2Tuple_u64u16ZZ_none();
20264         uint64_t ret_ref = tag_ptr(ret_copy, true);
20265         return ret_ref;
20266 }
20267
20268 void  __attribute__((export_name("TS_COption_C2Tuple_u64u16ZZ_free"))) TS_COption_C2Tuple_u64u16ZZ_free(uint64_t _res) {
20269         if (!ptr_is_owned(_res)) return;
20270         void* _res_ptr = untag_ptr(_res);
20271         CHECK_ACCESS(_res_ptr);
20272         LDKCOption_C2Tuple_u64u16ZZ _res_conv = *(LDKCOption_C2Tuple_u64u16ZZ*)(_res_ptr);
20273         FREE(untag_ptr(_res));
20274         COption_C2Tuple_u64u16ZZ_free(_res_conv);
20275 }
20276
20277 static inline uint64_t COption_C2Tuple_u64u16ZZ_clone_ptr(LDKCOption_C2Tuple_u64u16ZZ *NONNULL_PTR arg) {
20278         LDKCOption_C2Tuple_u64u16ZZ *ret_copy = MALLOC(sizeof(LDKCOption_C2Tuple_u64u16ZZ), "LDKCOption_C2Tuple_u64u16ZZ");
20279         *ret_copy = COption_C2Tuple_u64u16ZZ_clone(arg);
20280         uint64_t ret_ref = tag_ptr(ret_copy, true);
20281         return ret_ref;
20282 }
20283 int64_t  __attribute__((export_name("TS_COption_C2Tuple_u64u16ZZ_clone_ptr"))) TS_COption_C2Tuple_u64u16ZZ_clone_ptr(uint64_t arg) {
20284         LDKCOption_C2Tuple_u64u16ZZ* arg_conv = (LDKCOption_C2Tuple_u64u16ZZ*)untag_ptr(arg);
20285         int64_t ret_conv = COption_C2Tuple_u64u16ZZ_clone_ptr(arg_conv);
20286         return ret_conv;
20287 }
20288
20289 uint64_t  __attribute__((export_name("TS_COption_C2Tuple_u64u16ZZ_clone"))) TS_COption_C2Tuple_u64u16ZZ_clone(uint64_t orig) {
20290         LDKCOption_C2Tuple_u64u16ZZ* orig_conv = (LDKCOption_C2Tuple_u64u16ZZ*)untag_ptr(orig);
20291         LDKCOption_C2Tuple_u64u16ZZ *ret_copy = MALLOC(sizeof(LDKCOption_C2Tuple_u64u16ZZ), "LDKCOption_C2Tuple_u64u16ZZ");
20292         *ret_copy = COption_C2Tuple_u64u16ZZ_clone(orig_conv);
20293         uint64_t ret_ref = tag_ptr(ret_copy, true);
20294         return ret_ref;
20295 }
20296
20297 uint64_t  __attribute__((export_name("TS_COption_ChannelShutdownStateZ_some"))) TS_COption_ChannelShutdownStateZ_some(uint32_t o) {
20298         LDKChannelShutdownState o_conv = LDKChannelShutdownState_from_js(o);
20299         LDKCOption_ChannelShutdownStateZ *ret_copy = MALLOC(sizeof(LDKCOption_ChannelShutdownStateZ), "LDKCOption_ChannelShutdownStateZ");
20300         *ret_copy = COption_ChannelShutdownStateZ_some(o_conv);
20301         uint64_t ret_ref = tag_ptr(ret_copy, true);
20302         return ret_ref;
20303 }
20304
20305 uint64_t  __attribute__((export_name("TS_COption_ChannelShutdownStateZ_none"))) TS_COption_ChannelShutdownStateZ_none() {
20306         LDKCOption_ChannelShutdownStateZ *ret_copy = MALLOC(sizeof(LDKCOption_ChannelShutdownStateZ), "LDKCOption_ChannelShutdownStateZ");
20307         *ret_copy = COption_ChannelShutdownStateZ_none();
20308         uint64_t ret_ref = tag_ptr(ret_copy, true);
20309         return ret_ref;
20310 }
20311
20312 void  __attribute__((export_name("TS_COption_ChannelShutdownStateZ_free"))) TS_COption_ChannelShutdownStateZ_free(uint64_t _res) {
20313         if (!ptr_is_owned(_res)) return;
20314         void* _res_ptr = untag_ptr(_res);
20315         CHECK_ACCESS(_res_ptr);
20316         LDKCOption_ChannelShutdownStateZ _res_conv = *(LDKCOption_ChannelShutdownStateZ*)(_res_ptr);
20317         FREE(untag_ptr(_res));
20318         COption_ChannelShutdownStateZ_free(_res_conv);
20319 }
20320
20321 static inline uint64_t COption_ChannelShutdownStateZ_clone_ptr(LDKCOption_ChannelShutdownStateZ *NONNULL_PTR arg) {
20322         LDKCOption_ChannelShutdownStateZ *ret_copy = MALLOC(sizeof(LDKCOption_ChannelShutdownStateZ), "LDKCOption_ChannelShutdownStateZ");
20323         *ret_copy = COption_ChannelShutdownStateZ_clone(arg);
20324         uint64_t ret_ref = tag_ptr(ret_copy, true);
20325         return ret_ref;
20326 }
20327 int64_t  __attribute__((export_name("TS_COption_ChannelShutdownStateZ_clone_ptr"))) TS_COption_ChannelShutdownStateZ_clone_ptr(uint64_t arg) {
20328         LDKCOption_ChannelShutdownStateZ* arg_conv = (LDKCOption_ChannelShutdownStateZ*)untag_ptr(arg);
20329         int64_t ret_conv = COption_ChannelShutdownStateZ_clone_ptr(arg_conv);
20330         return ret_conv;
20331 }
20332
20333 uint64_t  __attribute__((export_name("TS_COption_ChannelShutdownStateZ_clone"))) TS_COption_ChannelShutdownStateZ_clone(uint64_t orig) {
20334         LDKCOption_ChannelShutdownStateZ* orig_conv = (LDKCOption_ChannelShutdownStateZ*)untag_ptr(orig);
20335         LDKCOption_ChannelShutdownStateZ *ret_copy = MALLOC(sizeof(LDKCOption_ChannelShutdownStateZ), "LDKCOption_ChannelShutdownStateZ");
20336         *ret_copy = COption_ChannelShutdownStateZ_clone(orig_conv);
20337         uint64_t ret_ref = tag_ptr(ret_copy, true);
20338         return ret_ref;
20339 }
20340
20341 uint64_t  __attribute__((export_name("TS_CResult_ThirtyTwoBytesAPIErrorZ_ok"))) TS_CResult_ThirtyTwoBytesAPIErrorZ_ok(int8_tArray o) {
20342         LDKThirtyTwoBytes o_ref;
20343         CHECK(o->arr_len == 32);
20344         memcpy(o_ref.data, o->elems, 32); FREE(o);
20345         LDKCResult_ThirtyTwoBytesAPIErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ThirtyTwoBytesAPIErrorZ), "LDKCResult_ThirtyTwoBytesAPIErrorZ");
20346         *ret_conv = CResult_ThirtyTwoBytesAPIErrorZ_ok(o_ref);
20347         return tag_ptr(ret_conv, true);
20348 }
20349
20350 uint64_t  __attribute__((export_name("TS_CResult_ThirtyTwoBytesAPIErrorZ_err"))) TS_CResult_ThirtyTwoBytesAPIErrorZ_err(uint64_t e) {
20351         void* e_ptr = untag_ptr(e);
20352         CHECK_ACCESS(e_ptr);
20353         LDKAPIError e_conv = *(LDKAPIError*)(e_ptr);
20354         e_conv = APIError_clone((LDKAPIError*)untag_ptr(e));
20355         LDKCResult_ThirtyTwoBytesAPIErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ThirtyTwoBytesAPIErrorZ), "LDKCResult_ThirtyTwoBytesAPIErrorZ");
20356         *ret_conv = CResult_ThirtyTwoBytesAPIErrorZ_err(e_conv);
20357         return tag_ptr(ret_conv, true);
20358 }
20359
20360 jboolean  __attribute__((export_name("TS_CResult_ThirtyTwoBytesAPIErrorZ_is_ok"))) TS_CResult_ThirtyTwoBytesAPIErrorZ_is_ok(uint64_t o) {
20361         LDKCResult_ThirtyTwoBytesAPIErrorZ* o_conv = (LDKCResult_ThirtyTwoBytesAPIErrorZ*)untag_ptr(o);
20362         jboolean ret_conv = CResult_ThirtyTwoBytesAPIErrorZ_is_ok(o_conv);
20363         return ret_conv;
20364 }
20365
20366 void  __attribute__((export_name("TS_CResult_ThirtyTwoBytesAPIErrorZ_free"))) TS_CResult_ThirtyTwoBytesAPIErrorZ_free(uint64_t _res) {
20367         if (!ptr_is_owned(_res)) return;
20368         void* _res_ptr = untag_ptr(_res);
20369         CHECK_ACCESS(_res_ptr);
20370         LDKCResult_ThirtyTwoBytesAPIErrorZ _res_conv = *(LDKCResult_ThirtyTwoBytesAPIErrorZ*)(_res_ptr);
20371         FREE(untag_ptr(_res));
20372         CResult_ThirtyTwoBytesAPIErrorZ_free(_res_conv);
20373 }
20374
20375 static inline uint64_t CResult_ThirtyTwoBytesAPIErrorZ_clone_ptr(LDKCResult_ThirtyTwoBytesAPIErrorZ *NONNULL_PTR arg) {
20376         LDKCResult_ThirtyTwoBytesAPIErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ThirtyTwoBytesAPIErrorZ), "LDKCResult_ThirtyTwoBytesAPIErrorZ");
20377         *ret_conv = CResult_ThirtyTwoBytesAPIErrorZ_clone(arg);
20378         return tag_ptr(ret_conv, true);
20379 }
20380 int64_t  __attribute__((export_name("TS_CResult_ThirtyTwoBytesAPIErrorZ_clone_ptr"))) TS_CResult_ThirtyTwoBytesAPIErrorZ_clone_ptr(uint64_t arg) {
20381         LDKCResult_ThirtyTwoBytesAPIErrorZ* arg_conv = (LDKCResult_ThirtyTwoBytesAPIErrorZ*)untag_ptr(arg);
20382         int64_t ret_conv = CResult_ThirtyTwoBytesAPIErrorZ_clone_ptr(arg_conv);
20383         return ret_conv;
20384 }
20385
20386 uint64_t  __attribute__((export_name("TS_CResult_ThirtyTwoBytesAPIErrorZ_clone"))) TS_CResult_ThirtyTwoBytesAPIErrorZ_clone(uint64_t orig) {
20387         LDKCResult_ThirtyTwoBytesAPIErrorZ* orig_conv = (LDKCResult_ThirtyTwoBytesAPIErrorZ*)untag_ptr(orig);
20388         LDKCResult_ThirtyTwoBytesAPIErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ThirtyTwoBytesAPIErrorZ), "LDKCResult_ThirtyTwoBytesAPIErrorZ");
20389         *ret_conv = CResult_ThirtyTwoBytesAPIErrorZ_clone(orig_conv);
20390         return tag_ptr(ret_conv, true);
20391 }
20392
20393 void  __attribute__((export_name("TS_CVec_RecentPaymentDetailsZ_free"))) TS_CVec_RecentPaymentDetailsZ_free(uint64_tArray _res) {
20394         LDKCVec_RecentPaymentDetailsZ _res_constr;
20395         _res_constr.datalen = _res->arr_len;
20396         if (_res_constr.datalen > 0)
20397                 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKRecentPaymentDetails), "LDKCVec_RecentPaymentDetailsZ Elements");
20398         else
20399                 _res_constr.data = NULL;
20400         uint64_t* _res_vals = _res->elems;
20401         for (size_t w = 0; w < _res_constr.datalen; w++) {
20402                 uint64_t _res_conv_22 = _res_vals[w];
20403                 void* _res_conv_22_ptr = untag_ptr(_res_conv_22);
20404                 CHECK_ACCESS(_res_conv_22_ptr);
20405                 LDKRecentPaymentDetails _res_conv_22_conv = *(LDKRecentPaymentDetails*)(_res_conv_22_ptr);
20406                 FREE(untag_ptr(_res_conv_22));
20407                 _res_constr.data[w] = _res_conv_22_conv;
20408         }
20409         FREE(_res);
20410         CVec_RecentPaymentDetailsZ_free(_res_constr);
20411 }
20412
20413 uint64_t  __attribute__((export_name("TS_CResult_NonePaymentSendFailureZ_ok"))) TS_CResult_NonePaymentSendFailureZ_ok() {
20414         LDKCResult_NonePaymentSendFailureZ* ret_conv = MALLOC(sizeof(LDKCResult_NonePaymentSendFailureZ), "LDKCResult_NonePaymentSendFailureZ");
20415         *ret_conv = CResult_NonePaymentSendFailureZ_ok();
20416         return tag_ptr(ret_conv, true);
20417 }
20418
20419 uint64_t  __attribute__((export_name("TS_CResult_NonePaymentSendFailureZ_err"))) TS_CResult_NonePaymentSendFailureZ_err(uint64_t e) {
20420         void* e_ptr = untag_ptr(e);
20421         CHECK_ACCESS(e_ptr);
20422         LDKPaymentSendFailure e_conv = *(LDKPaymentSendFailure*)(e_ptr);
20423         e_conv = PaymentSendFailure_clone((LDKPaymentSendFailure*)untag_ptr(e));
20424         LDKCResult_NonePaymentSendFailureZ* ret_conv = MALLOC(sizeof(LDKCResult_NonePaymentSendFailureZ), "LDKCResult_NonePaymentSendFailureZ");
20425         *ret_conv = CResult_NonePaymentSendFailureZ_err(e_conv);
20426         return tag_ptr(ret_conv, true);
20427 }
20428
20429 jboolean  __attribute__((export_name("TS_CResult_NonePaymentSendFailureZ_is_ok"))) TS_CResult_NonePaymentSendFailureZ_is_ok(uint64_t o) {
20430         LDKCResult_NonePaymentSendFailureZ* o_conv = (LDKCResult_NonePaymentSendFailureZ*)untag_ptr(o);
20431         jboolean ret_conv = CResult_NonePaymentSendFailureZ_is_ok(o_conv);
20432         return ret_conv;
20433 }
20434
20435 void  __attribute__((export_name("TS_CResult_NonePaymentSendFailureZ_free"))) TS_CResult_NonePaymentSendFailureZ_free(uint64_t _res) {
20436         if (!ptr_is_owned(_res)) return;
20437         void* _res_ptr = untag_ptr(_res);
20438         CHECK_ACCESS(_res_ptr);
20439         LDKCResult_NonePaymentSendFailureZ _res_conv = *(LDKCResult_NonePaymentSendFailureZ*)(_res_ptr);
20440         FREE(untag_ptr(_res));
20441         CResult_NonePaymentSendFailureZ_free(_res_conv);
20442 }
20443
20444 static inline uint64_t CResult_NonePaymentSendFailureZ_clone_ptr(LDKCResult_NonePaymentSendFailureZ *NONNULL_PTR arg) {
20445         LDKCResult_NonePaymentSendFailureZ* ret_conv = MALLOC(sizeof(LDKCResult_NonePaymentSendFailureZ), "LDKCResult_NonePaymentSendFailureZ");
20446         *ret_conv = CResult_NonePaymentSendFailureZ_clone(arg);
20447         return tag_ptr(ret_conv, true);
20448 }
20449 int64_t  __attribute__((export_name("TS_CResult_NonePaymentSendFailureZ_clone_ptr"))) TS_CResult_NonePaymentSendFailureZ_clone_ptr(uint64_t arg) {
20450         LDKCResult_NonePaymentSendFailureZ* arg_conv = (LDKCResult_NonePaymentSendFailureZ*)untag_ptr(arg);
20451         int64_t ret_conv = CResult_NonePaymentSendFailureZ_clone_ptr(arg_conv);
20452         return ret_conv;
20453 }
20454
20455 uint64_t  __attribute__((export_name("TS_CResult_NonePaymentSendFailureZ_clone"))) TS_CResult_NonePaymentSendFailureZ_clone(uint64_t orig) {
20456         LDKCResult_NonePaymentSendFailureZ* orig_conv = (LDKCResult_NonePaymentSendFailureZ*)untag_ptr(orig);
20457         LDKCResult_NonePaymentSendFailureZ* ret_conv = MALLOC(sizeof(LDKCResult_NonePaymentSendFailureZ), "LDKCResult_NonePaymentSendFailureZ");
20458         *ret_conv = CResult_NonePaymentSendFailureZ_clone(orig_conv);
20459         return tag_ptr(ret_conv, true);
20460 }
20461
20462 uint64_t  __attribute__((export_name("TS_CResult_NoneRetryableSendFailureZ_ok"))) TS_CResult_NoneRetryableSendFailureZ_ok() {
20463         LDKCResult_NoneRetryableSendFailureZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneRetryableSendFailureZ), "LDKCResult_NoneRetryableSendFailureZ");
20464         *ret_conv = CResult_NoneRetryableSendFailureZ_ok();
20465         return tag_ptr(ret_conv, true);
20466 }
20467
20468 uint64_t  __attribute__((export_name("TS_CResult_NoneRetryableSendFailureZ_err"))) TS_CResult_NoneRetryableSendFailureZ_err(uint32_t e) {
20469         LDKRetryableSendFailure e_conv = LDKRetryableSendFailure_from_js(e);
20470         LDKCResult_NoneRetryableSendFailureZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneRetryableSendFailureZ), "LDKCResult_NoneRetryableSendFailureZ");
20471         *ret_conv = CResult_NoneRetryableSendFailureZ_err(e_conv);
20472         return tag_ptr(ret_conv, true);
20473 }
20474
20475 jboolean  __attribute__((export_name("TS_CResult_NoneRetryableSendFailureZ_is_ok"))) TS_CResult_NoneRetryableSendFailureZ_is_ok(uint64_t o) {
20476         LDKCResult_NoneRetryableSendFailureZ* o_conv = (LDKCResult_NoneRetryableSendFailureZ*)untag_ptr(o);
20477         jboolean ret_conv = CResult_NoneRetryableSendFailureZ_is_ok(o_conv);
20478         return ret_conv;
20479 }
20480
20481 void  __attribute__((export_name("TS_CResult_NoneRetryableSendFailureZ_free"))) TS_CResult_NoneRetryableSendFailureZ_free(uint64_t _res) {
20482         if (!ptr_is_owned(_res)) return;
20483         void* _res_ptr = untag_ptr(_res);
20484         CHECK_ACCESS(_res_ptr);
20485         LDKCResult_NoneRetryableSendFailureZ _res_conv = *(LDKCResult_NoneRetryableSendFailureZ*)(_res_ptr);
20486         FREE(untag_ptr(_res));
20487         CResult_NoneRetryableSendFailureZ_free(_res_conv);
20488 }
20489
20490 static inline uint64_t CResult_NoneRetryableSendFailureZ_clone_ptr(LDKCResult_NoneRetryableSendFailureZ *NONNULL_PTR arg) {
20491         LDKCResult_NoneRetryableSendFailureZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneRetryableSendFailureZ), "LDKCResult_NoneRetryableSendFailureZ");
20492         *ret_conv = CResult_NoneRetryableSendFailureZ_clone(arg);
20493         return tag_ptr(ret_conv, true);
20494 }
20495 int64_t  __attribute__((export_name("TS_CResult_NoneRetryableSendFailureZ_clone_ptr"))) TS_CResult_NoneRetryableSendFailureZ_clone_ptr(uint64_t arg) {
20496         LDKCResult_NoneRetryableSendFailureZ* arg_conv = (LDKCResult_NoneRetryableSendFailureZ*)untag_ptr(arg);
20497         int64_t ret_conv = CResult_NoneRetryableSendFailureZ_clone_ptr(arg_conv);
20498         return ret_conv;
20499 }
20500
20501 uint64_t  __attribute__((export_name("TS_CResult_NoneRetryableSendFailureZ_clone"))) TS_CResult_NoneRetryableSendFailureZ_clone(uint64_t orig) {
20502         LDKCResult_NoneRetryableSendFailureZ* orig_conv = (LDKCResult_NoneRetryableSendFailureZ*)untag_ptr(orig);
20503         LDKCResult_NoneRetryableSendFailureZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneRetryableSendFailureZ), "LDKCResult_NoneRetryableSendFailureZ");
20504         *ret_conv = CResult_NoneRetryableSendFailureZ_clone(orig_conv);
20505         return tag_ptr(ret_conv, true);
20506 }
20507
20508 uint64_t  __attribute__((export_name("TS_CResult_ThirtyTwoBytesPaymentSendFailureZ_ok"))) TS_CResult_ThirtyTwoBytesPaymentSendFailureZ_ok(int8_tArray o) {
20509         LDKThirtyTwoBytes o_ref;
20510         CHECK(o->arr_len == 32);
20511         memcpy(o_ref.data, o->elems, 32); FREE(o);
20512         LDKCResult_ThirtyTwoBytesPaymentSendFailureZ* ret_conv = MALLOC(sizeof(LDKCResult_ThirtyTwoBytesPaymentSendFailureZ), "LDKCResult_ThirtyTwoBytesPaymentSendFailureZ");
20513         *ret_conv = CResult_ThirtyTwoBytesPaymentSendFailureZ_ok(o_ref);
20514         return tag_ptr(ret_conv, true);
20515 }
20516
20517 uint64_t  __attribute__((export_name("TS_CResult_ThirtyTwoBytesPaymentSendFailureZ_err"))) TS_CResult_ThirtyTwoBytesPaymentSendFailureZ_err(uint64_t e) {
20518         void* e_ptr = untag_ptr(e);
20519         CHECK_ACCESS(e_ptr);
20520         LDKPaymentSendFailure e_conv = *(LDKPaymentSendFailure*)(e_ptr);
20521         e_conv = PaymentSendFailure_clone((LDKPaymentSendFailure*)untag_ptr(e));
20522         LDKCResult_ThirtyTwoBytesPaymentSendFailureZ* ret_conv = MALLOC(sizeof(LDKCResult_ThirtyTwoBytesPaymentSendFailureZ), "LDKCResult_ThirtyTwoBytesPaymentSendFailureZ");
20523         *ret_conv = CResult_ThirtyTwoBytesPaymentSendFailureZ_err(e_conv);
20524         return tag_ptr(ret_conv, true);
20525 }
20526
20527 jboolean  __attribute__((export_name("TS_CResult_ThirtyTwoBytesPaymentSendFailureZ_is_ok"))) TS_CResult_ThirtyTwoBytesPaymentSendFailureZ_is_ok(uint64_t o) {
20528         LDKCResult_ThirtyTwoBytesPaymentSendFailureZ* o_conv = (LDKCResult_ThirtyTwoBytesPaymentSendFailureZ*)untag_ptr(o);
20529         jboolean ret_conv = CResult_ThirtyTwoBytesPaymentSendFailureZ_is_ok(o_conv);
20530         return ret_conv;
20531 }
20532
20533 void  __attribute__((export_name("TS_CResult_ThirtyTwoBytesPaymentSendFailureZ_free"))) TS_CResult_ThirtyTwoBytesPaymentSendFailureZ_free(uint64_t _res) {
20534         if (!ptr_is_owned(_res)) return;
20535         void* _res_ptr = untag_ptr(_res);
20536         CHECK_ACCESS(_res_ptr);
20537         LDKCResult_ThirtyTwoBytesPaymentSendFailureZ _res_conv = *(LDKCResult_ThirtyTwoBytesPaymentSendFailureZ*)(_res_ptr);
20538         FREE(untag_ptr(_res));
20539         CResult_ThirtyTwoBytesPaymentSendFailureZ_free(_res_conv);
20540 }
20541
20542 static inline uint64_t CResult_ThirtyTwoBytesPaymentSendFailureZ_clone_ptr(LDKCResult_ThirtyTwoBytesPaymentSendFailureZ *NONNULL_PTR arg) {
20543         LDKCResult_ThirtyTwoBytesPaymentSendFailureZ* ret_conv = MALLOC(sizeof(LDKCResult_ThirtyTwoBytesPaymentSendFailureZ), "LDKCResult_ThirtyTwoBytesPaymentSendFailureZ");
20544         *ret_conv = CResult_ThirtyTwoBytesPaymentSendFailureZ_clone(arg);
20545         return tag_ptr(ret_conv, true);
20546 }
20547 int64_t  __attribute__((export_name("TS_CResult_ThirtyTwoBytesPaymentSendFailureZ_clone_ptr"))) TS_CResult_ThirtyTwoBytesPaymentSendFailureZ_clone_ptr(uint64_t arg) {
20548         LDKCResult_ThirtyTwoBytesPaymentSendFailureZ* arg_conv = (LDKCResult_ThirtyTwoBytesPaymentSendFailureZ*)untag_ptr(arg);
20549         int64_t ret_conv = CResult_ThirtyTwoBytesPaymentSendFailureZ_clone_ptr(arg_conv);
20550         return ret_conv;
20551 }
20552
20553 uint64_t  __attribute__((export_name("TS_CResult_ThirtyTwoBytesPaymentSendFailureZ_clone"))) TS_CResult_ThirtyTwoBytesPaymentSendFailureZ_clone(uint64_t orig) {
20554         LDKCResult_ThirtyTwoBytesPaymentSendFailureZ* orig_conv = (LDKCResult_ThirtyTwoBytesPaymentSendFailureZ*)untag_ptr(orig);
20555         LDKCResult_ThirtyTwoBytesPaymentSendFailureZ* ret_conv = MALLOC(sizeof(LDKCResult_ThirtyTwoBytesPaymentSendFailureZ), "LDKCResult_ThirtyTwoBytesPaymentSendFailureZ");
20556         *ret_conv = CResult_ThirtyTwoBytesPaymentSendFailureZ_clone(orig_conv);
20557         return tag_ptr(ret_conv, true);
20558 }
20559
20560 uint64_t  __attribute__((export_name("TS_CResult_ThirtyTwoBytesRetryableSendFailureZ_ok"))) TS_CResult_ThirtyTwoBytesRetryableSendFailureZ_ok(int8_tArray o) {
20561         LDKThirtyTwoBytes o_ref;
20562         CHECK(o->arr_len == 32);
20563         memcpy(o_ref.data, o->elems, 32); FREE(o);
20564         LDKCResult_ThirtyTwoBytesRetryableSendFailureZ* ret_conv = MALLOC(sizeof(LDKCResult_ThirtyTwoBytesRetryableSendFailureZ), "LDKCResult_ThirtyTwoBytesRetryableSendFailureZ");
20565         *ret_conv = CResult_ThirtyTwoBytesRetryableSendFailureZ_ok(o_ref);
20566         return tag_ptr(ret_conv, true);
20567 }
20568
20569 uint64_t  __attribute__((export_name("TS_CResult_ThirtyTwoBytesRetryableSendFailureZ_err"))) TS_CResult_ThirtyTwoBytesRetryableSendFailureZ_err(uint32_t e) {
20570         LDKRetryableSendFailure e_conv = LDKRetryableSendFailure_from_js(e);
20571         LDKCResult_ThirtyTwoBytesRetryableSendFailureZ* ret_conv = MALLOC(sizeof(LDKCResult_ThirtyTwoBytesRetryableSendFailureZ), "LDKCResult_ThirtyTwoBytesRetryableSendFailureZ");
20572         *ret_conv = CResult_ThirtyTwoBytesRetryableSendFailureZ_err(e_conv);
20573         return tag_ptr(ret_conv, true);
20574 }
20575
20576 jboolean  __attribute__((export_name("TS_CResult_ThirtyTwoBytesRetryableSendFailureZ_is_ok"))) TS_CResult_ThirtyTwoBytesRetryableSendFailureZ_is_ok(uint64_t o) {
20577         LDKCResult_ThirtyTwoBytesRetryableSendFailureZ* o_conv = (LDKCResult_ThirtyTwoBytesRetryableSendFailureZ*)untag_ptr(o);
20578         jboolean ret_conv = CResult_ThirtyTwoBytesRetryableSendFailureZ_is_ok(o_conv);
20579         return ret_conv;
20580 }
20581
20582 void  __attribute__((export_name("TS_CResult_ThirtyTwoBytesRetryableSendFailureZ_free"))) TS_CResult_ThirtyTwoBytesRetryableSendFailureZ_free(uint64_t _res) {
20583         if (!ptr_is_owned(_res)) return;
20584         void* _res_ptr = untag_ptr(_res);
20585         CHECK_ACCESS(_res_ptr);
20586         LDKCResult_ThirtyTwoBytesRetryableSendFailureZ _res_conv = *(LDKCResult_ThirtyTwoBytesRetryableSendFailureZ*)(_res_ptr);
20587         FREE(untag_ptr(_res));
20588         CResult_ThirtyTwoBytesRetryableSendFailureZ_free(_res_conv);
20589 }
20590
20591 static inline uint64_t CResult_ThirtyTwoBytesRetryableSendFailureZ_clone_ptr(LDKCResult_ThirtyTwoBytesRetryableSendFailureZ *NONNULL_PTR arg) {
20592         LDKCResult_ThirtyTwoBytesRetryableSendFailureZ* ret_conv = MALLOC(sizeof(LDKCResult_ThirtyTwoBytesRetryableSendFailureZ), "LDKCResult_ThirtyTwoBytesRetryableSendFailureZ");
20593         *ret_conv = CResult_ThirtyTwoBytesRetryableSendFailureZ_clone(arg);
20594         return tag_ptr(ret_conv, true);
20595 }
20596 int64_t  __attribute__((export_name("TS_CResult_ThirtyTwoBytesRetryableSendFailureZ_clone_ptr"))) TS_CResult_ThirtyTwoBytesRetryableSendFailureZ_clone_ptr(uint64_t arg) {
20597         LDKCResult_ThirtyTwoBytesRetryableSendFailureZ* arg_conv = (LDKCResult_ThirtyTwoBytesRetryableSendFailureZ*)untag_ptr(arg);
20598         int64_t ret_conv = CResult_ThirtyTwoBytesRetryableSendFailureZ_clone_ptr(arg_conv);
20599         return ret_conv;
20600 }
20601
20602 uint64_t  __attribute__((export_name("TS_CResult_ThirtyTwoBytesRetryableSendFailureZ_clone"))) TS_CResult_ThirtyTwoBytesRetryableSendFailureZ_clone(uint64_t orig) {
20603         LDKCResult_ThirtyTwoBytesRetryableSendFailureZ* orig_conv = (LDKCResult_ThirtyTwoBytesRetryableSendFailureZ*)untag_ptr(orig);
20604         LDKCResult_ThirtyTwoBytesRetryableSendFailureZ* ret_conv = MALLOC(sizeof(LDKCResult_ThirtyTwoBytesRetryableSendFailureZ), "LDKCResult_ThirtyTwoBytesRetryableSendFailureZ");
20605         *ret_conv = CResult_ThirtyTwoBytesRetryableSendFailureZ_clone(orig_conv);
20606         return tag_ptr(ret_conv, true);
20607 }
20608
20609 static inline uint64_t C2Tuple_ThirtyTwoBytesThirtyTwoBytesZ_clone_ptr(LDKC2Tuple_ThirtyTwoBytesThirtyTwoBytesZ *NONNULL_PTR arg) {
20610         LDKC2Tuple_ThirtyTwoBytesThirtyTwoBytesZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_ThirtyTwoBytesThirtyTwoBytesZ), "LDKC2Tuple_ThirtyTwoBytesThirtyTwoBytesZ");
20611         *ret_conv = C2Tuple_ThirtyTwoBytesThirtyTwoBytesZ_clone(arg);
20612         return tag_ptr(ret_conv, true);
20613 }
20614 int64_t  __attribute__((export_name("TS_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZ_clone_ptr"))) TS_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZ_clone_ptr(uint64_t arg) {
20615         LDKC2Tuple_ThirtyTwoBytesThirtyTwoBytesZ* arg_conv = (LDKC2Tuple_ThirtyTwoBytesThirtyTwoBytesZ*)untag_ptr(arg);
20616         int64_t ret_conv = C2Tuple_ThirtyTwoBytesThirtyTwoBytesZ_clone_ptr(arg_conv);
20617         return ret_conv;
20618 }
20619
20620 uint64_t  __attribute__((export_name("TS_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZ_clone"))) TS_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZ_clone(uint64_t orig) {
20621         LDKC2Tuple_ThirtyTwoBytesThirtyTwoBytesZ* orig_conv = (LDKC2Tuple_ThirtyTwoBytesThirtyTwoBytesZ*)untag_ptr(orig);
20622         LDKC2Tuple_ThirtyTwoBytesThirtyTwoBytesZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_ThirtyTwoBytesThirtyTwoBytesZ), "LDKC2Tuple_ThirtyTwoBytesThirtyTwoBytesZ");
20623         *ret_conv = C2Tuple_ThirtyTwoBytesThirtyTwoBytesZ_clone(orig_conv);
20624         return tag_ptr(ret_conv, true);
20625 }
20626
20627 uint64_t  __attribute__((export_name("TS_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZ_new"))) TS_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZ_new(int8_tArray a, int8_tArray b) {
20628         LDKThirtyTwoBytes a_ref;
20629         CHECK(a->arr_len == 32);
20630         memcpy(a_ref.data, a->elems, 32); FREE(a);
20631         LDKThirtyTwoBytes b_ref;
20632         CHECK(b->arr_len == 32);
20633         memcpy(b_ref.data, b->elems, 32); FREE(b);
20634         LDKC2Tuple_ThirtyTwoBytesThirtyTwoBytesZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_ThirtyTwoBytesThirtyTwoBytesZ), "LDKC2Tuple_ThirtyTwoBytesThirtyTwoBytesZ");
20635         *ret_conv = C2Tuple_ThirtyTwoBytesThirtyTwoBytesZ_new(a_ref, b_ref);
20636         return tag_ptr(ret_conv, true);
20637 }
20638
20639 void  __attribute__((export_name("TS_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZ_free"))) TS_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZ_free(uint64_t _res) {
20640         if (!ptr_is_owned(_res)) return;
20641         void* _res_ptr = untag_ptr(_res);
20642         CHECK_ACCESS(_res_ptr);
20643         LDKC2Tuple_ThirtyTwoBytesThirtyTwoBytesZ _res_conv = *(LDKC2Tuple_ThirtyTwoBytesThirtyTwoBytesZ*)(_res_ptr);
20644         FREE(untag_ptr(_res));
20645         C2Tuple_ThirtyTwoBytesThirtyTwoBytesZ_free(_res_conv);
20646 }
20647
20648 uint64_t  __attribute__((export_name("TS_CResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZPaymentSendFailureZ_ok"))) TS_CResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZPaymentSendFailureZ_ok(uint64_t o) {
20649         void* o_ptr = untag_ptr(o);
20650         CHECK_ACCESS(o_ptr);
20651         LDKC2Tuple_ThirtyTwoBytesThirtyTwoBytesZ o_conv = *(LDKC2Tuple_ThirtyTwoBytesThirtyTwoBytesZ*)(o_ptr);
20652         o_conv = C2Tuple_ThirtyTwoBytesThirtyTwoBytesZ_clone((LDKC2Tuple_ThirtyTwoBytesThirtyTwoBytesZ*)untag_ptr(o));
20653         LDKCResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZPaymentSendFailureZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZPaymentSendFailureZ), "LDKCResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZPaymentSendFailureZ");
20654         *ret_conv = CResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZPaymentSendFailureZ_ok(o_conv);
20655         return tag_ptr(ret_conv, true);
20656 }
20657
20658 uint64_t  __attribute__((export_name("TS_CResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZPaymentSendFailureZ_err"))) TS_CResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZPaymentSendFailureZ_err(uint64_t e) {
20659         void* e_ptr = untag_ptr(e);
20660         CHECK_ACCESS(e_ptr);
20661         LDKPaymentSendFailure e_conv = *(LDKPaymentSendFailure*)(e_ptr);
20662         e_conv = PaymentSendFailure_clone((LDKPaymentSendFailure*)untag_ptr(e));
20663         LDKCResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZPaymentSendFailureZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZPaymentSendFailureZ), "LDKCResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZPaymentSendFailureZ");
20664         *ret_conv = CResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZPaymentSendFailureZ_err(e_conv);
20665         return tag_ptr(ret_conv, true);
20666 }
20667
20668 jboolean  __attribute__((export_name("TS_CResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZPaymentSendFailureZ_is_ok"))) TS_CResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZPaymentSendFailureZ_is_ok(uint64_t o) {
20669         LDKCResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZPaymentSendFailureZ* o_conv = (LDKCResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZPaymentSendFailureZ*)untag_ptr(o);
20670         jboolean ret_conv = CResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZPaymentSendFailureZ_is_ok(o_conv);
20671         return ret_conv;
20672 }
20673
20674 void  __attribute__((export_name("TS_CResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZPaymentSendFailureZ_free"))) TS_CResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZPaymentSendFailureZ_free(uint64_t _res) {
20675         if (!ptr_is_owned(_res)) return;
20676         void* _res_ptr = untag_ptr(_res);
20677         CHECK_ACCESS(_res_ptr);
20678         LDKCResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZPaymentSendFailureZ _res_conv = *(LDKCResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZPaymentSendFailureZ*)(_res_ptr);
20679         FREE(untag_ptr(_res));
20680         CResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZPaymentSendFailureZ_free(_res_conv);
20681 }
20682
20683 static inline uint64_t CResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZPaymentSendFailureZ_clone_ptr(LDKCResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZPaymentSendFailureZ *NONNULL_PTR arg) {
20684         LDKCResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZPaymentSendFailureZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZPaymentSendFailureZ), "LDKCResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZPaymentSendFailureZ");
20685         *ret_conv = CResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZPaymentSendFailureZ_clone(arg);
20686         return tag_ptr(ret_conv, true);
20687 }
20688 int64_t  __attribute__((export_name("TS_CResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZPaymentSendFailureZ_clone_ptr"))) TS_CResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZPaymentSendFailureZ_clone_ptr(uint64_t arg) {
20689         LDKCResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZPaymentSendFailureZ* arg_conv = (LDKCResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZPaymentSendFailureZ*)untag_ptr(arg);
20690         int64_t ret_conv = CResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZPaymentSendFailureZ_clone_ptr(arg_conv);
20691         return ret_conv;
20692 }
20693
20694 uint64_t  __attribute__((export_name("TS_CResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZPaymentSendFailureZ_clone"))) TS_CResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZPaymentSendFailureZ_clone(uint64_t orig) {
20695         LDKCResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZPaymentSendFailureZ* orig_conv = (LDKCResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZPaymentSendFailureZ*)untag_ptr(orig);
20696         LDKCResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZPaymentSendFailureZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZPaymentSendFailureZ), "LDKCResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZPaymentSendFailureZ");
20697         *ret_conv = CResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZPaymentSendFailureZ_clone(orig_conv);
20698         return tag_ptr(ret_conv, true);
20699 }
20700
20701 void  __attribute__((export_name("TS_CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZ_free"))) TS_CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZ_free(uint64_tArray _res) {
20702         LDKCVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZ _res_constr;
20703         _res_constr.datalen = _res->arr_len;
20704         if (_res_constr.datalen > 0)
20705                 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKC2Tuple_ThirtyTwoBytesThirtyTwoBytesZ), "LDKCVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZ Elements");
20706         else
20707                 _res_constr.data = NULL;
20708         uint64_t* _res_vals = _res->elems;
20709         for (size_t o = 0; o < _res_constr.datalen; o++) {
20710                 uint64_t _res_conv_40 = _res_vals[o];
20711                 void* _res_conv_40_ptr = untag_ptr(_res_conv_40);
20712                 CHECK_ACCESS(_res_conv_40_ptr);
20713                 LDKC2Tuple_ThirtyTwoBytesThirtyTwoBytesZ _res_conv_40_conv = *(LDKC2Tuple_ThirtyTwoBytesThirtyTwoBytesZ*)(_res_conv_40_ptr);
20714                 FREE(untag_ptr(_res_conv_40));
20715                 _res_constr.data[o] = _res_conv_40_conv;
20716         }
20717         FREE(_res);
20718         CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZ_free(_res_constr);
20719 }
20720
20721 uint64_t  __attribute__((export_name("TS_CResult_CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZProbeSendFailureZ_ok"))) TS_CResult_CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZProbeSendFailureZ_ok(uint64_tArray o) {
20722         LDKCVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZ o_constr;
20723         o_constr.datalen = o->arr_len;
20724         if (o_constr.datalen > 0)
20725                 o_constr.data = MALLOC(o_constr.datalen * sizeof(LDKC2Tuple_ThirtyTwoBytesThirtyTwoBytesZ), "LDKCVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZ Elements");
20726         else
20727                 o_constr.data = NULL;
20728         uint64_t* o_vals = o->elems;
20729         for (size_t o = 0; o < o_constr.datalen; o++) {
20730                 uint64_t o_conv_40 = o_vals[o];
20731                 void* o_conv_40_ptr = untag_ptr(o_conv_40);
20732                 CHECK_ACCESS(o_conv_40_ptr);
20733                 LDKC2Tuple_ThirtyTwoBytesThirtyTwoBytesZ o_conv_40_conv = *(LDKC2Tuple_ThirtyTwoBytesThirtyTwoBytesZ*)(o_conv_40_ptr);
20734                 o_conv_40_conv = C2Tuple_ThirtyTwoBytesThirtyTwoBytesZ_clone((LDKC2Tuple_ThirtyTwoBytesThirtyTwoBytesZ*)untag_ptr(o_conv_40));
20735                 o_constr.data[o] = o_conv_40_conv;
20736         }
20737         FREE(o);
20738         LDKCResult_CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZProbeSendFailureZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZProbeSendFailureZ), "LDKCResult_CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZProbeSendFailureZ");
20739         *ret_conv = CResult_CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZProbeSendFailureZ_ok(o_constr);
20740         return tag_ptr(ret_conv, true);
20741 }
20742
20743 uint64_t  __attribute__((export_name("TS_CResult_CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZProbeSendFailureZ_err"))) TS_CResult_CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZProbeSendFailureZ_err(uint64_t e) {
20744         void* e_ptr = untag_ptr(e);
20745         CHECK_ACCESS(e_ptr);
20746         LDKProbeSendFailure e_conv = *(LDKProbeSendFailure*)(e_ptr);
20747         e_conv = ProbeSendFailure_clone((LDKProbeSendFailure*)untag_ptr(e));
20748         LDKCResult_CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZProbeSendFailureZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZProbeSendFailureZ), "LDKCResult_CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZProbeSendFailureZ");
20749         *ret_conv = CResult_CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZProbeSendFailureZ_err(e_conv);
20750         return tag_ptr(ret_conv, true);
20751 }
20752
20753 jboolean  __attribute__((export_name("TS_CResult_CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZProbeSendFailureZ_is_ok"))) TS_CResult_CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZProbeSendFailureZ_is_ok(uint64_t o) {
20754         LDKCResult_CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZProbeSendFailureZ* o_conv = (LDKCResult_CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZProbeSendFailureZ*)untag_ptr(o);
20755         jboolean ret_conv = CResult_CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZProbeSendFailureZ_is_ok(o_conv);
20756         return ret_conv;
20757 }
20758
20759 void  __attribute__((export_name("TS_CResult_CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZProbeSendFailureZ_free"))) TS_CResult_CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZProbeSendFailureZ_free(uint64_t _res) {
20760         if (!ptr_is_owned(_res)) return;
20761         void* _res_ptr = untag_ptr(_res);
20762         CHECK_ACCESS(_res_ptr);
20763         LDKCResult_CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZProbeSendFailureZ _res_conv = *(LDKCResult_CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZProbeSendFailureZ*)(_res_ptr);
20764         FREE(untag_ptr(_res));
20765         CResult_CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZProbeSendFailureZ_free(_res_conv);
20766 }
20767
20768 static inline uint64_t CResult_CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZProbeSendFailureZ_clone_ptr(LDKCResult_CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZProbeSendFailureZ *NONNULL_PTR arg) {
20769         LDKCResult_CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZProbeSendFailureZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZProbeSendFailureZ), "LDKCResult_CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZProbeSendFailureZ");
20770         *ret_conv = CResult_CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZProbeSendFailureZ_clone(arg);
20771         return tag_ptr(ret_conv, true);
20772 }
20773 int64_t  __attribute__((export_name("TS_CResult_CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZProbeSendFailureZ_clone_ptr"))) TS_CResult_CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZProbeSendFailureZ_clone_ptr(uint64_t arg) {
20774         LDKCResult_CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZProbeSendFailureZ* arg_conv = (LDKCResult_CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZProbeSendFailureZ*)untag_ptr(arg);
20775         int64_t ret_conv = CResult_CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZProbeSendFailureZ_clone_ptr(arg_conv);
20776         return ret_conv;
20777 }
20778
20779 uint64_t  __attribute__((export_name("TS_CResult_CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZProbeSendFailureZ_clone"))) TS_CResult_CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZProbeSendFailureZ_clone(uint64_t orig) {
20780         LDKCResult_CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZProbeSendFailureZ* orig_conv = (LDKCResult_CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZProbeSendFailureZ*)untag_ptr(orig);
20781         LDKCResult_CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZProbeSendFailureZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZProbeSendFailureZ), "LDKCResult_CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZProbeSendFailureZ");
20782         *ret_conv = CResult_CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZProbeSendFailureZ_clone(orig_conv);
20783         return tag_ptr(ret_conv, true);
20784 }
20785
20786 static inline uint64_t C2Tuple_ThirtyTwoBytesPublicKeyZ_clone_ptr(LDKC2Tuple_ThirtyTwoBytesPublicKeyZ *NONNULL_PTR arg) {
20787         LDKC2Tuple_ThirtyTwoBytesPublicKeyZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_ThirtyTwoBytesPublicKeyZ), "LDKC2Tuple_ThirtyTwoBytesPublicKeyZ");
20788         *ret_conv = C2Tuple_ThirtyTwoBytesPublicKeyZ_clone(arg);
20789         return tag_ptr(ret_conv, true);
20790 }
20791 int64_t  __attribute__((export_name("TS_C2Tuple_ThirtyTwoBytesPublicKeyZ_clone_ptr"))) TS_C2Tuple_ThirtyTwoBytesPublicKeyZ_clone_ptr(uint64_t arg) {
20792         LDKC2Tuple_ThirtyTwoBytesPublicKeyZ* arg_conv = (LDKC2Tuple_ThirtyTwoBytesPublicKeyZ*)untag_ptr(arg);
20793         int64_t ret_conv = C2Tuple_ThirtyTwoBytesPublicKeyZ_clone_ptr(arg_conv);
20794         return ret_conv;
20795 }
20796
20797 uint64_t  __attribute__((export_name("TS_C2Tuple_ThirtyTwoBytesPublicKeyZ_clone"))) TS_C2Tuple_ThirtyTwoBytesPublicKeyZ_clone(uint64_t orig) {
20798         LDKC2Tuple_ThirtyTwoBytesPublicKeyZ* orig_conv = (LDKC2Tuple_ThirtyTwoBytesPublicKeyZ*)untag_ptr(orig);
20799         LDKC2Tuple_ThirtyTwoBytesPublicKeyZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_ThirtyTwoBytesPublicKeyZ), "LDKC2Tuple_ThirtyTwoBytesPublicKeyZ");
20800         *ret_conv = C2Tuple_ThirtyTwoBytesPublicKeyZ_clone(orig_conv);
20801         return tag_ptr(ret_conv, true);
20802 }
20803
20804 uint64_t  __attribute__((export_name("TS_C2Tuple_ThirtyTwoBytesPublicKeyZ_new"))) TS_C2Tuple_ThirtyTwoBytesPublicKeyZ_new(int8_tArray a, int8_tArray b) {
20805         LDKThirtyTwoBytes a_ref;
20806         CHECK(a->arr_len == 32);
20807         memcpy(a_ref.data, a->elems, 32); FREE(a);
20808         LDKPublicKey b_ref;
20809         CHECK(b->arr_len == 33);
20810         memcpy(b_ref.compressed_form, b->elems, 33); FREE(b);
20811         LDKC2Tuple_ThirtyTwoBytesPublicKeyZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_ThirtyTwoBytesPublicKeyZ), "LDKC2Tuple_ThirtyTwoBytesPublicKeyZ");
20812         *ret_conv = C2Tuple_ThirtyTwoBytesPublicKeyZ_new(a_ref, b_ref);
20813         return tag_ptr(ret_conv, true);
20814 }
20815
20816 void  __attribute__((export_name("TS_C2Tuple_ThirtyTwoBytesPublicKeyZ_free"))) TS_C2Tuple_ThirtyTwoBytesPublicKeyZ_free(uint64_t _res) {
20817         if (!ptr_is_owned(_res)) return;
20818         void* _res_ptr = untag_ptr(_res);
20819         CHECK_ACCESS(_res_ptr);
20820         LDKC2Tuple_ThirtyTwoBytesPublicKeyZ _res_conv = *(LDKC2Tuple_ThirtyTwoBytesPublicKeyZ*)(_res_ptr);
20821         FREE(untag_ptr(_res));
20822         C2Tuple_ThirtyTwoBytesPublicKeyZ_free(_res_conv);
20823 }
20824
20825 void  __attribute__((export_name("TS_CVec_C2Tuple_ThirtyTwoBytesPublicKeyZZ_free"))) TS_CVec_C2Tuple_ThirtyTwoBytesPublicKeyZZ_free(uint64_tArray _res) {
20826         LDKCVec_C2Tuple_ThirtyTwoBytesPublicKeyZZ _res_constr;
20827         _res_constr.datalen = _res->arr_len;
20828         if (_res_constr.datalen > 0)
20829                 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKC2Tuple_ThirtyTwoBytesPublicKeyZ), "LDKCVec_C2Tuple_ThirtyTwoBytesPublicKeyZZ Elements");
20830         else
20831                 _res_constr.data = NULL;
20832         uint64_t* _res_vals = _res->elems;
20833         for (size_t j = 0; j < _res_constr.datalen; j++) {
20834                 uint64_t _res_conv_35 = _res_vals[j];
20835                 void* _res_conv_35_ptr = untag_ptr(_res_conv_35);
20836                 CHECK_ACCESS(_res_conv_35_ptr);
20837                 LDKC2Tuple_ThirtyTwoBytesPublicKeyZ _res_conv_35_conv = *(LDKC2Tuple_ThirtyTwoBytesPublicKeyZ*)(_res_conv_35_ptr);
20838                 FREE(untag_ptr(_res_conv_35));
20839                 _res_constr.data[j] = _res_conv_35_conv;
20840         }
20841         FREE(_res);
20842         CVec_C2Tuple_ThirtyTwoBytesPublicKeyZZ_free(_res_constr);
20843 }
20844
20845 uint64_t  __attribute__((export_name("TS_COption_StrZ_some"))) TS_COption_StrZ_some(jstring o) {
20846         LDKStr o_conv = str_ref_to_owned_c(o);
20847         LDKCOption_StrZ *ret_copy = MALLOC(sizeof(LDKCOption_StrZ), "LDKCOption_StrZ");
20848         *ret_copy = COption_StrZ_some(o_conv);
20849         uint64_t ret_ref = tag_ptr(ret_copy, true);
20850         return ret_ref;
20851 }
20852
20853 uint64_t  __attribute__((export_name("TS_COption_StrZ_none"))) TS_COption_StrZ_none() {
20854         LDKCOption_StrZ *ret_copy = MALLOC(sizeof(LDKCOption_StrZ), "LDKCOption_StrZ");
20855         *ret_copy = COption_StrZ_none();
20856         uint64_t ret_ref = tag_ptr(ret_copy, true);
20857         return ret_ref;
20858 }
20859
20860 void  __attribute__((export_name("TS_COption_StrZ_free"))) TS_COption_StrZ_free(uint64_t _res) {
20861         if (!ptr_is_owned(_res)) return;
20862         void* _res_ptr = untag_ptr(_res);
20863         CHECK_ACCESS(_res_ptr);
20864         LDKCOption_StrZ _res_conv = *(LDKCOption_StrZ*)(_res_ptr);
20865         FREE(untag_ptr(_res));
20866         COption_StrZ_free(_res_conv);
20867 }
20868
20869 static inline uint64_t COption_StrZ_clone_ptr(LDKCOption_StrZ *NONNULL_PTR arg) {
20870         LDKCOption_StrZ *ret_copy = MALLOC(sizeof(LDKCOption_StrZ), "LDKCOption_StrZ");
20871         *ret_copy = COption_StrZ_clone(arg);
20872         uint64_t ret_ref = tag_ptr(ret_copy, true);
20873         return ret_ref;
20874 }
20875 int64_t  __attribute__((export_name("TS_COption_StrZ_clone_ptr"))) TS_COption_StrZ_clone_ptr(uint64_t arg) {
20876         LDKCOption_StrZ* arg_conv = (LDKCOption_StrZ*)untag_ptr(arg);
20877         int64_t ret_conv = COption_StrZ_clone_ptr(arg_conv);
20878         return ret_conv;
20879 }
20880
20881 uint64_t  __attribute__((export_name("TS_COption_StrZ_clone"))) TS_COption_StrZ_clone(uint64_t orig) {
20882         LDKCOption_StrZ* orig_conv = (LDKCOption_StrZ*)untag_ptr(orig);
20883         LDKCOption_StrZ *ret_copy = MALLOC(sizeof(LDKCOption_StrZ), "LDKCOption_StrZ");
20884         *ret_copy = COption_StrZ_clone(orig_conv);
20885         uint64_t ret_ref = tag_ptr(ret_copy, true);
20886         return ret_ref;
20887 }
20888
20889 uint64_t  __attribute__((export_name("TS_CResult_NoneBolt12SemanticErrorZ_ok"))) TS_CResult_NoneBolt12SemanticErrorZ_ok() {
20890         LDKCResult_NoneBolt12SemanticErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneBolt12SemanticErrorZ), "LDKCResult_NoneBolt12SemanticErrorZ");
20891         *ret_conv = CResult_NoneBolt12SemanticErrorZ_ok();
20892         return tag_ptr(ret_conv, true);
20893 }
20894
20895 uint64_t  __attribute__((export_name("TS_CResult_NoneBolt12SemanticErrorZ_err"))) TS_CResult_NoneBolt12SemanticErrorZ_err(uint32_t e) {
20896         LDKBolt12SemanticError e_conv = LDKBolt12SemanticError_from_js(e);
20897         LDKCResult_NoneBolt12SemanticErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneBolt12SemanticErrorZ), "LDKCResult_NoneBolt12SemanticErrorZ");
20898         *ret_conv = CResult_NoneBolt12SemanticErrorZ_err(e_conv);
20899         return tag_ptr(ret_conv, true);
20900 }
20901
20902 jboolean  __attribute__((export_name("TS_CResult_NoneBolt12SemanticErrorZ_is_ok"))) TS_CResult_NoneBolt12SemanticErrorZ_is_ok(uint64_t o) {
20903         LDKCResult_NoneBolt12SemanticErrorZ* o_conv = (LDKCResult_NoneBolt12SemanticErrorZ*)untag_ptr(o);
20904         jboolean ret_conv = CResult_NoneBolt12SemanticErrorZ_is_ok(o_conv);
20905         return ret_conv;
20906 }
20907
20908 void  __attribute__((export_name("TS_CResult_NoneBolt12SemanticErrorZ_free"))) TS_CResult_NoneBolt12SemanticErrorZ_free(uint64_t _res) {
20909         if (!ptr_is_owned(_res)) return;
20910         void* _res_ptr = untag_ptr(_res);
20911         CHECK_ACCESS(_res_ptr);
20912         LDKCResult_NoneBolt12SemanticErrorZ _res_conv = *(LDKCResult_NoneBolt12SemanticErrorZ*)(_res_ptr);
20913         FREE(untag_ptr(_res));
20914         CResult_NoneBolt12SemanticErrorZ_free(_res_conv);
20915 }
20916
20917 static inline uint64_t CResult_NoneBolt12SemanticErrorZ_clone_ptr(LDKCResult_NoneBolt12SemanticErrorZ *NONNULL_PTR arg) {
20918         LDKCResult_NoneBolt12SemanticErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneBolt12SemanticErrorZ), "LDKCResult_NoneBolt12SemanticErrorZ");
20919         *ret_conv = CResult_NoneBolt12SemanticErrorZ_clone(arg);
20920         return tag_ptr(ret_conv, true);
20921 }
20922 int64_t  __attribute__((export_name("TS_CResult_NoneBolt12SemanticErrorZ_clone_ptr"))) TS_CResult_NoneBolt12SemanticErrorZ_clone_ptr(uint64_t arg) {
20923         LDKCResult_NoneBolt12SemanticErrorZ* arg_conv = (LDKCResult_NoneBolt12SemanticErrorZ*)untag_ptr(arg);
20924         int64_t ret_conv = CResult_NoneBolt12SemanticErrorZ_clone_ptr(arg_conv);
20925         return ret_conv;
20926 }
20927
20928 uint64_t  __attribute__((export_name("TS_CResult_NoneBolt12SemanticErrorZ_clone"))) TS_CResult_NoneBolt12SemanticErrorZ_clone(uint64_t orig) {
20929         LDKCResult_NoneBolt12SemanticErrorZ* orig_conv = (LDKCResult_NoneBolt12SemanticErrorZ*)untag_ptr(orig);
20930         LDKCResult_NoneBolt12SemanticErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneBolt12SemanticErrorZ), "LDKCResult_NoneBolt12SemanticErrorZ");
20931         *ret_conv = CResult_NoneBolt12SemanticErrorZ_clone(orig_conv);
20932         return tag_ptr(ret_conv, true);
20933 }
20934
20935 uint64_t  __attribute__((export_name("TS_CResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZNoneZ_ok"))) TS_CResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZNoneZ_ok(uint64_t o) {
20936         void* o_ptr = untag_ptr(o);
20937         CHECK_ACCESS(o_ptr);
20938         LDKC2Tuple_ThirtyTwoBytesThirtyTwoBytesZ o_conv = *(LDKC2Tuple_ThirtyTwoBytesThirtyTwoBytesZ*)(o_ptr);
20939         o_conv = C2Tuple_ThirtyTwoBytesThirtyTwoBytesZ_clone((LDKC2Tuple_ThirtyTwoBytesThirtyTwoBytesZ*)untag_ptr(o));
20940         LDKCResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZNoneZ), "LDKCResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZNoneZ");
20941         *ret_conv = CResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZNoneZ_ok(o_conv);
20942         return tag_ptr(ret_conv, true);
20943 }
20944
20945 uint64_t  __attribute__((export_name("TS_CResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZNoneZ_err"))) TS_CResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZNoneZ_err() {
20946         LDKCResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZNoneZ), "LDKCResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZNoneZ");
20947         *ret_conv = CResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZNoneZ_err();
20948         return tag_ptr(ret_conv, true);
20949 }
20950
20951 jboolean  __attribute__((export_name("TS_CResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZNoneZ_is_ok"))) TS_CResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZNoneZ_is_ok(uint64_t o) {
20952         LDKCResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZNoneZ* o_conv = (LDKCResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZNoneZ*)untag_ptr(o);
20953         jboolean ret_conv = CResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZNoneZ_is_ok(o_conv);
20954         return ret_conv;
20955 }
20956
20957 void  __attribute__((export_name("TS_CResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZNoneZ_free"))) TS_CResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZNoneZ_free(uint64_t _res) {
20958         if (!ptr_is_owned(_res)) return;
20959         void* _res_ptr = untag_ptr(_res);
20960         CHECK_ACCESS(_res_ptr);
20961         LDKCResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZNoneZ _res_conv = *(LDKCResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZNoneZ*)(_res_ptr);
20962         FREE(untag_ptr(_res));
20963         CResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZNoneZ_free(_res_conv);
20964 }
20965
20966 static inline uint64_t CResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZNoneZ_clone_ptr(LDKCResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZNoneZ *NONNULL_PTR arg) {
20967         LDKCResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZNoneZ), "LDKCResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZNoneZ");
20968         *ret_conv = CResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZNoneZ_clone(arg);
20969         return tag_ptr(ret_conv, true);
20970 }
20971 int64_t  __attribute__((export_name("TS_CResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZNoneZ_clone_ptr"))) TS_CResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZNoneZ_clone_ptr(uint64_t arg) {
20972         LDKCResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZNoneZ* arg_conv = (LDKCResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZNoneZ*)untag_ptr(arg);
20973         int64_t ret_conv = CResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZNoneZ_clone_ptr(arg_conv);
20974         return ret_conv;
20975 }
20976
20977 uint64_t  __attribute__((export_name("TS_CResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZNoneZ_clone"))) TS_CResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZNoneZ_clone(uint64_t orig) {
20978         LDKCResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZNoneZ* orig_conv = (LDKCResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZNoneZ*)untag_ptr(orig);
20979         LDKCResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZNoneZ), "LDKCResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZNoneZ");
20980         *ret_conv = CResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZNoneZ_clone(orig_conv);
20981         return tag_ptr(ret_conv, true);
20982 }
20983
20984 uint64_t  __attribute__((export_name("TS_COption_OffersMessageZ_some"))) TS_COption_OffersMessageZ_some(uint64_t o) {
20985         void* o_ptr = untag_ptr(o);
20986         CHECK_ACCESS(o_ptr);
20987         LDKOffersMessage o_conv = *(LDKOffersMessage*)(o_ptr);
20988         o_conv = OffersMessage_clone((LDKOffersMessage*)untag_ptr(o));
20989         LDKCOption_OffersMessageZ *ret_copy = MALLOC(sizeof(LDKCOption_OffersMessageZ), "LDKCOption_OffersMessageZ");
20990         *ret_copy = COption_OffersMessageZ_some(o_conv);
20991         uint64_t ret_ref = tag_ptr(ret_copy, true);
20992         return ret_ref;
20993 }
20994
20995 uint64_t  __attribute__((export_name("TS_COption_OffersMessageZ_none"))) TS_COption_OffersMessageZ_none() {
20996         LDKCOption_OffersMessageZ *ret_copy = MALLOC(sizeof(LDKCOption_OffersMessageZ), "LDKCOption_OffersMessageZ");
20997         *ret_copy = COption_OffersMessageZ_none();
20998         uint64_t ret_ref = tag_ptr(ret_copy, true);
20999         return ret_ref;
21000 }
21001
21002 void  __attribute__((export_name("TS_COption_OffersMessageZ_free"))) TS_COption_OffersMessageZ_free(uint64_t _res) {
21003         if (!ptr_is_owned(_res)) return;
21004         void* _res_ptr = untag_ptr(_res);
21005         CHECK_ACCESS(_res_ptr);
21006         LDKCOption_OffersMessageZ _res_conv = *(LDKCOption_OffersMessageZ*)(_res_ptr);
21007         FREE(untag_ptr(_res));
21008         COption_OffersMessageZ_free(_res_conv);
21009 }
21010
21011 static inline uint64_t COption_OffersMessageZ_clone_ptr(LDKCOption_OffersMessageZ *NONNULL_PTR arg) {
21012         LDKCOption_OffersMessageZ *ret_copy = MALLOC(sizeof(LDKCOption_OffersMessageZ), "LDKCOption_OffersMessageZ");
21013         *ret_copy = COption_OffersMessageZ_clone(arg);
21014         uint64_t ret_ref = tag_ptr(ret_copy, true);
21015         return ret_ref;
21016 }
21017 int64_t  __attribute__((export_name("TS_COption_OffersMessageZ_clone_ptr"))) TS_COption_OffersMessageZ_clone_ptr(uint64_t arg) {
21018         LDKCOption_OffersMessageZ* arg_conv = (LDKCOption_OffersMessageZ*)untag_ptr(arg);
21019         int64_t ret_conv = COption_OffersMessageZ_clone_ptr(arg_conv);
21020         return ret_conv;
21021 }
21022
21023 uint64_t  __attribute__((export_name("TS_COption_OffersMessageZ_clone"))) TS_COption_OffersMessageZ_clone(uint64_t orig) {
21024         LDKCOption_OffersMessageZ* orig_conv = (LDKCOption_OffersMessageZ*)untag_ptr(orig);
21025         LDKCOption_OffersMessageZ *ret_copy = MALLOC(sizeof(LDKCOption_OffersMessageZ), "LDKCOption_OffersMessageZ");
21026         *ret_copy = COption_OffersMessageZ_clone(orig_conv);
21027         uint64_t ret_ref = tag_ptr(ret_copy, true);
21028         return ret_ref;
21029 }
21030
21031 static inline uint64_t C3Tuple_OffersMessageDestinationBlindedPathZ_clone_ptr(LDKC3Tuple_OffersMessageDestinationBlindedPathZ *NONNULL_PTR arg) {
21032         LDKC3Tuple_OffersMessageDestinationBlindedPathZ* ret_conv = MALLOC(sizeof(LDKC3Tuple_OffersMessageDestinationBlindedPathZ), "LDKC3Tuple_OffersMessageDestinationBlindedPathZ");
21033         *ret_conv = C3Tuple_OffersMessageDestinationBlindedPathZ_clone(arg);
21034         return tag_ptr(ret_conv, true);
21035 }
21036 int64_t  __attribute__((export_name("TS_C3Tuple_OffersMessageDestinationBlindedPathZ_clone_ptr"))) TS_C3Tuple_OffersMessageDestinationBlindedPathZ_clone_ptr(uint64_t arg) {
21037         LDKC3Tuple_OffersMessageDestinationBlindedPathZ* arg_conv = (LDKC3Tuple_OffersMessageDestinationBlindedPathZ*)untag_ptr(arg);
21038         int64_t ret_conv = C3Tuple_OffersMessageDestinationBlindedPathZ_clone_ptr(arg_conv);
21039         return ret_conv;
21040 }
21041
21042 uint64_t  __attribute__((export_name("TS_C3Tuple_OffersMessageDestinationBlindedPathZ_clone"))) TS_C3Tuple_OffersMessageDestinationBlindedPathZ_clone(uint64_t orig) {
21043         LDKC3Tuple_OffersMessageDestinationBlindedPathZ* orig_conv = (LDKC3Tuple_OffersMessageDestinationBlindedPathZ*)untag_ptr(orig);
21044         LDKC3Tuple_OffersMessageDestinationBlindedPathZ* ret_conv = MALLOC(sizeof(LDKC3Tuple_OffersMessageDestinationBlindedPathZ), "LDKC3Tuple_OffersMessageDestinationBlindedPathZ");
21045         *ret_conv = C3Tuple_OffersMessageDestinationBlindedPathZ_clone(orig_conv);
21046         return tag_ptr(ret_conv, true);
21047 }
21048
21049 uint64_t  __attribute__((export_name("TS_C3Tuple_OffersMessageDestinationBlindedPathZ_new"))) TS_C3Tuple_OffersMessageDestinationBlindedPathZ_new(uint64_t a, uint64_t b, uint64_t c) {
21050         void* a_ptr = untag_ptr(a);
21051         CHECK_ACCESS(a_ptr);
21052         LDKOffersMessage a_conv = *(LDKOffersMessage*)(a_ptr);
21053         a_conv = OffersMessage_clone((LDKOffersMessage*)untag_ptr(a));
21054         void* b_ptr = untag_ptr(b);
21055         CHECK_ACCESS(b_ptr);
21056         LDKDestination b_conv = *(LDKDestination*)(b_ptr);
21057         b_conv = Destination_clone((LDKDestination*)untag_ptr(b));
21058         LDKBlindedPath c_conv;
21059         c_conv.inner = untag_ptr(c);
21060         c_conv.is_owned = ptr_is_owned(c);
21061         CHECK_INNER_FIELD_ACCESS_OR_NULL(c_conv);
21062         c_conv = BlindedPath_clone(&c_conv);
21063         LDKC3Tuple_OffersMessageDestinationBlindedPathZ* ret_conv = MALLOC(sizeof(LDKC3Tuple_OffersMessageDestinationBlindedPathZ), "LDKC3Tuple_OffersMessageDestinationBlindedPathZ");
21064         *ret_conv = C3Tuple_OffersMessageDestinationBlindedPathZ_new(a_conv, b_conv, c_conv);
21065         return tag_ptr(ret_conv, true);
21066 }
21067
21068 void  __attribute__((export_name("TS_C3Tuple_OffersMessageDestinationBlindedPathZ_free"))) TS_C3Tuple_OffersMessageDestinationBlindedPathZ_free(uint64_t _res) {
21069         if (!ptr_is_owned(_res)) return;
21070         void* _res_ptr = untag_ptr(_res);
21071         CHECK_ACCESS(_res_ptr);
21072         LDKC3Tuple_OffersMessageDestinationBlindedPathZ _res_conv = *(LDKC3Tuple_OffersMessageDestinationBlindedPathZ*)(_res_ptr);
21073         FREE(untag_ptr(_res));
21074         C3Tuple_OffersMessageDestinationBlindedPathZ_free(_res_conv);
21075 }
21076
21077 void  __attribute__((export_name("TS_CVec_C3Tuple_OffersMessageDestinationBlindedPathZZ_free"))) TS_CVec_C3Tuple_OffersMessageDestinationBlindedPathZZ_free(uint64_tArray _res) {
21078         LDKCVec_C3Tuple_OffersMessageDestinationBlindedPathZZ _res_constr;
21079         _res_constr.datalen = _res->arr_len;
21080         if (_res_constr.datalen > 0)
21081                 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKC3Tuple_OffersMessageDestinationBlindedPathZ), "LDKCVec_C3Tuple_OffersMessageDestinationBlindedPathZZ Elements");
21082         else
21083                 _res_constr.data = NULL;
21084         uint64_t* _res_vals = _res->elems;
21085         for (size_t x = 0; x < _res_constr.datalen; x++) {
21086                 uint64_t _res_conv_49 = _res_vals[x];
21087                 void* _res_conv_49_ptr = untag_ptr(_res_conv_49);
21088                 CHECK_ACCESS(_res_conv_49_ptr);
21089                 LDKC3Tuple_OffersMessageDestinationBlindedPathZ _res_conv_49_conv = *(LDKC3Tuple_OffersMessageDestinationBlindedPathZ*)(_res_conv_49_ptr);
21090                 FREE(untag_ptr(_res_conv_49));
21091                 _res_constr.data[x] = _res_conv_49_conv;
21092         }
21093         FREE(_res);
21094         CVec_C3Tuple_OffersMessageDestinationBlindedPathZZ_free(_res_constr);
21095 }
21096
21097 uint64_t  __attribute__((export_name("TS_CResult_CounterpartyForwardingInfoDecodeErrorZ_ok"))) TS_CResult_CounterpartyForwardingInfoDecodeErrorZ_ok(uint64_t o) {
21098         LDKCounterpartyForwardingInfo o_conv;
21099         o_conv.inner = untag_ptr(o);
21100         o_conv.is_owned = ptr_is_owned(o);
21101         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
21102         o_conv = CounterpartyForwardingInfo_clone(&o_conv);
21103         LDKCResult_CounterpartyForwardingInfoDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CounterpartyForwardingInfoDecodeErrorZ), "LDKCResult_CounterpartyForwardingInfoDecodeErrorZ");
21104         *ret_conv = CResult_CounterpartyForwardingInfoDecodeErrorZ_ok(o_conv);
21105         return tag_ptr(ret_conv, true);
21106 }
21107
21108 uint64_t  __attribute__((export_name("TS_CResult_CounterpartyForwardingInfoDecodeErrorZ_err"))) TS_CResult_CounterpartyForwardingInfoDecodeErrorZ_err(uint64_t e) {
21109         void* e_ptr = untag_ptr(e);
21110         CHECK_ACCESS(e_ptr);
21111         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
21112         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
21113         LDKCResult_CounterpartyForwardingInfoDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CounterpartyForwardingInfoDecodeErrorZ), "LDKCResult_CounterpartyForwardingInfoDecodeErrorZ");
21114         *ret_conv = CResult_CounterpartyForwardingInfoDecodeErrorZ_err(e_conv);
21115         return tag_ptr(ret_conv, true);
21116 }
21117
21118 jboolean  __attribute__((export_name("TS_CResult_CounterpartyForwardingInfoDecodeErrorZ_is_ok"))) TS_CResult_CounterpartyForwardingInfoDecodeErrorZ_is_ok(uint64_t o) {
21119         LDKCResult_CounterpartyForwardingInfoDecodeErrorZ* o_conv = (LDKCResult_CounterpartyForwardingInfoDecodeErrorZ*)untag_ptr(o);
21120         jboolean ret_conv = CResult_CounterpartyForwardingInfoDecodeErrorZ_is_ok(o_conv);
21121         return ret_conv;
21122 }
21123
21124 void  __attribute__((export_name("TS_CResult_CounterpartyForwardingInfoDecodeErrorZ_free"))) TS_CResult_CounterpartyForwardingInfoDecodeErrorZ_free(uint64_t _res) {
21125         if (!ptr_is_owned(_res)) return;
21126         void* _res_ptr = untag_ptr(_res);
21127         CHECK_ACCESS(_res_ptr);
21128         LDKCResult_CounterpartyForwardingInfoDecodeErrorZ _res_conv = *(LDKCResult_CounterpartyForwardingInfoDecodeErrorZ*)(_res_ptr);
21129         FREE(untag_ptr(_res));
21130         CResult_CounterpartyForwardingInfoDecodeErrorZ_free(_res_conv);
21131 }
21132
21133 static inline uint64_t CResult_CounterpartyForwardingInfoDecodeErrorZ_clone_ptr(LDKCResult_CounterpartyForwardingInfoDecodeErrorZ *NONNULL_PTR arg) {
21134         LDKCResult_CounterpartyForwardingInfoDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CounterpartyForwardingInfoDecodeErrorZ), "LDKCResult_CounterpartyForwardingInfoDecodeErrorZ");
21135         *ret_conv = CResult_CounterpartyForwardingInfoDecodeErrorZ_clone(arg);
21136         return tag_ptr(ret_conv, true);
21137 }
21138 int64_t  __attribute__((export_name("TS_CResult_CounterpartyForwardingInfoDecodeErrorZ_clone_ptr"))) TS_CResult_CounterpartyForwardingInfoDecodeErrorZ_clone_ptr(uint64_t arg) {
21139         LDKCResult_CounterpartyForwardingInfoDecodeErrorZ* arg_conv = (LDKCResult_CounterpartyForwardingInfoDecodeErrorZ*)untag_ptr(arg);
21140         int64_t ret_conv = CResult_CounterpartyForwardingInfoDecodeErrorZ_clone_ptr(arg_conv);
21141         return ret_conv;
21142 }
21143
21144 uint64_t  __attribute__((export_name("TS_CResult_CounterpartyForwardingInfoDecodeErrorZ_clone"))) TS_CResult_CounterpartyForwardingInfoDecodeErrorZ_clone(uint64_t orig) {
21145         LDKCResult_CounterpartyForwardingInfoDecodeErrorZ* orig_conv = (LDKCResult_CounterpartyForwardingInfoDecodeErrorZ*)untag_ptr(orig);
21146         LDKCResult_CounterpartyForwardingInfoDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CounterpartyForwardingInfoDecodeErrorZ), "LDKCResult_CounterpartyForwardingInfoDecodeErrorZ");
21147         *ret_conv = CResult_CounterpartyForwardingInfoDecodeErrorZ_clone(orig_conv);
21148         return tag_ptr(ret_conv, true);
21149 }
21150
21151 uint64_t  __attribute__((export_name("TS_CResult_ChannelCounterpartyDecodeErrorZ_ok"))) TS_CResult_ChannelCounterpartyDecodeErrorZ_ok(uint64_t o) {
21152         LDKChannelCounterparty o_conv;
21153         o_conv.inner = untag_ptr(o);
21154         o_conv.is_owned = ptr_is_owned(o);
21155         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
21156         o_conv = ChannelCounterparty_clone(&o_conv);
21157         LDKCResult_ChannelCounterpartyDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelCounterpartyDecodeErrorZ), "LDKCResult_ChannelCounterpartyDecodeErrorZ");
21158         *ret_conv = CResult_ChannelCounterpartyDecodeErrorZ_ok(o_conv);
21159         return tag_ptr(ret_conv, true);
21160 }
21161
21162 uint64_t  __attribute__((export_name("TS_CResult_ChannelCounterpartyDecodeErrorZ_err"))) TS_CResult_ChannelCounterpartyDecodeErrorZ_err(uint64_t e) {
21163         void* e_ptr = untag_ptr(e);
21164         CHECK_ACCESS(e_ptr);
21165         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
21166         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
21167         LDKCResult_ChannelCounterpartyDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelCounterpartyDecodeErrorZ), "LDKCResult_ChannelCounterpartyDecodeErrorZ");
21168         *ret_conv = CResult_ChannelCounterpartyDecodeErrorZ_err(e_conv);
21169         return tag_ptr(ret_conv, true);
21170 }
21171
21172 jboolean  __attribute__((export_name("TS_CResult_ChannelCounterpartyDecodeErrorZ_is_ok"))) TS_CResult_ChannelCounterpartyDecodeErrorZ_is_ok(uint64_t o) {
21173         LDKCResult_ChannelCounterpartyDecodeErrorZ* o_conv = (LDKCResult_ChannelCounterpartyDecodeErrorZ*)untag_ptr(o);
21174         jboolean ret_conv = CResult_ChannelCounterpartyDecodeErrorZ_is_ok(o_conv);
21175         return ret_conv;
21176 }
21177
21178 void  __attribute__((export_name("TS_CResult_ChannelCounterpartyDecodeErrorZ_free"))) TS_CResult_ChannelCounterpartyDecodeErrorZ_free(uint64_t _res) {
21179         if (!ptr_is_owned(_res)) return;
21180         void* _res_ptr = untag_ptr(_res);
21181         CHECK_ACCESS(_res_ptr);
21182         LDKCResult_ChannelCounterpartyDecodeErrorZ _res_conv = *(LDKCResult_ChannelCounterpartyDecodeErrorZ*)(_res_ptr);
21183         FREE(untag_ptr(_res));
21184         CResult_ChannelCounterpartyDecodeErrorZ_free(_res_conv);
21185 }
21186
21187 static inline uint64_t CResult_ChannelCounterpartyDecodeErrorZ_clone_ptr(LDKCResult_ChannelCounterpartyDecodeErrorZ *NONNULL_PTR arg) {
21188         LDKCResult_ChannelCounterpartyDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelCounterpartyDecodeErrorZ), "LDKCResult_ChannelCounterpartyDecodeErrorZ");
21189         *ret_conv = CResult_ChannelCounterpartyDecodeErrorZ_clone(arg);
21190         return tag_ptr(ret_conv, true);
21191 }
21192 int64_t  __attribute__((export_name("TS_CResult_ChannelCounterpartyDecodeErrorZ_clone_ptr"))) TS_CResult_ChannelCounterpartyDecodeErrorZ_clone_ptr(uint64_t arg) {
21193         LDKCResult_ChannelCounterpartyDecodeErrorZ* arg_conv = (LDKCResult_ChannelCounterpartyDecodeErrorZ*)untag_ptr(arg);
21194         int64_t ret_conv = CResult_ChannelCounterpartyDecodeErrorZ_clone_ptr(arg_conv);
21195         return ret_conv;
21196 }
21197
21198 uint64_t  __attribute__((export_name("TS_CResult_ChannelCounterpartyDecodeErrorZ_clone"))) TS_CResult_ChannelCounterpartyDecodeErrorZ_clone(uint64_t orig) {
21199         LDKCResult_ChannelCounterpartyDecodeErrorZ* orig_conv = (LDKCResult_ChannelCounterpartyDecodeErrorZ*)untag_ptr(orig);
21200         LDKCResult_ChannelCounterpartyDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelCounterpartyDecodeErrorZ), "LDKCResult_ChannelCounterpartyDecodeErrorZ");
21201         *ret_conv = CResult_ChannelCounterpartyDecodeErrorZ_clone(orig_conv);
21202         return tag_ptr(ret_conv, true);
21203 }
21204
21205 uint64_t  __attribute__((export_name("TS_CResult_ChannelDetailsDecodeErrorZ_ok"))) TS_CResult_ChannelDetailsDecodeErrorZ_ok(uint64_t o) {
21206         LDKChannelDetails o_conv;
21207         o_conv.inner = untag_ptr(o);
21208         o_conv.is_owned = ptr_is_owned(o);
21209         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
21210         o_conv = ChannelDetails_clone(&o_conv);
21211         LDKCResult_ChannelDetailsDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelDetailsDecodeErrorZ), "LDKCResult_ChannelDetailsDecodeErrorZ");
21212         *ret_conv = CResult_ChannelDetailsDecodeErrorZ_ok(o_conv);
21213         return tag_ptr(ret_conv, true);
21214 }
21215
21216 uint64_t  __attribute__((export_name("TS_CResult_ChannelDetailsDecodeErrorZ_err"))) TS_CResult_ChannelDetailsDecodeErrorZ_err(uint64_t e) {
21217         void* e_ptr = untag_ptr(e);
21218         CHECK_ACCESS(e_ptr);
21219         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
21220         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
21221         LDKCResult_ChannelDetailsDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelDetailsDecodeErrorZ), "LDKCResult_ChannelDetailsDecodeErrorZ");
21222         *ret_conv = CResult_ChannelDetailsDecodeErrorZ_err(e_conv);
21223         return tag_ptr(ret_conv, true);
21224 }
21225
21226 jboolean  __attribute__((export_name("TS_CResult_ChannelDetailsDecodeErrorZ_is_ok"))) TS_CResult_ChannelDetailsDecodeErrorZ_is_ok(uint64_t o) {
21227         LDKCResult_ChannelDetailsDecodeErrorZ* o_conv = (LDKCResult_ChannelDetailsDecodeErrorZ*)untag_ptr(o);
21228         jboolean ret_conv = CResult_ChannelDetailsDecodeErrorZ_is_ok(o_conv);
21229         return ret_conv;
21230 }
21231
21232 void  __attribute__((export_name("TS_CResult_ChannelDetailsDecodeErrorZ_free"))) TS_CResult_ChannelDetailsDecodeErrorZ_free(uint64_t _res) {
21233         if (!ptr_is_owned(_res)) return;
21234         void* _res_ptr = untag_ptr(_res);
21235         CHECK_ACCESS(_res_ptr);
21236         LDKCResult_ChannelDetailsDecodeErrorZ _res_conv = *(LDKCResult_ChannelDetailsDecodeErrorZ*)(_res_ptr);
21237         FREE(untag_ptr(_res));
21238         CResult_ChannelDetailsDecodeErrorZ_free(_res_conv);
21239 }
21240
21241 static inline uint64_t CResult_ChannelDetailsDecodeErrorZ_clone_ptr(LDKCResult_ChannelDetailsDecodeErrorZ *NONNULL_PTR arg) {
21242         LDKCResult_ChannelDetailsDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelDetailsDecodeErrorZ), "LDKCResult_ChannelDetailsDecodeErrorZ");
21243         *ret_conv = CResult_ChannelDetailsDecodeErrorZ_clone(arg);
21244         return tag_ptr(ret_conv, true);
21245 }
21246 int64_t  __attribute__((export_name("TS_CResult_ChannelDetailsDecodeErrorZ_clone_ptr"))) TS_CResult_ChannelDetailsDecodeErrorZ_clone_ptr(uint64_t arg) {
21247         LDKCResult_ChannelDetailsDecodeErrorZ* arg_conv = (LDKCResult_ChannelDetailsDecodeErrorZ*)untag_ptr(arg);
21248         int64_t ret_conv = CResult_ChannelDetailsDecodeErrorZ_clone_ptr(arg_conv);
21249         return ret_conv;
21250 }
21251
21252 uint64_t  __attribute__((export_name("TS_CResult_ChannelDetailsDecodeErrorZ_clone"))) TS_CResult_ChannelDetailsDecodeErrorZ_clone(uint64_t orig) {
21253         LDKCResult_ChannelDetailsDecodeErrorZ* orig_conv = (LDKCResult_ChannelDetailsDecodeErrorZ*)untag_ptr(orig);
21254         LDKCResult_ChannelDetailsDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelDetailsDecodeErrorZ), "LDKCResult_ChannelDetailsDecodeErrorZ");
21255         *ret_conv = CResult_ChannelDetailsDecodeErrorZ_clone(orig_conv);
21256         return tag_ptr(ret_conv, true);
21257 }
21258
21259 uint64_t  __attribute__((export_name("TS_CResult_PhantomRouteHintsDecodeErrorZ_ok"))) TS_CResult_PhantomRouteHintsDecodeErrorZ_ok(uint64_t o) {
21260         LDKPhantomRouteHints o_conv;
21261         o_conv.inner = untag_ptr(o);
21262         o_conv.is_owned = ptr_is_owned(o);
21263         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
21264         o_conv = PhantomRouteHints_clone(&o_conv);
21265         LDKCResult_PhantomRouteHintsDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PhantomRouteHintsDecodeErrorZ), "LDKCResult_PhantomRouteHintsDecodeErrorZ");
21266         *ret_conv = CResult_PhantomRouteHintsDecodeErrorZ_ok(o_conv);
21267         return tag_ptr(ret_conv, true);
21268 }
21269
21270 uint64_t  __attribute__((export_name("TS_CResult_PhantomRouteHintsDecodeErrorZ_err"))) TS_CResult_PhantomRouteHintsDecodeErrorZ_err(uint64_t e) {
21271         void* e_ptr = untag_ptr(e);
21272         CHECK_ACCESS(e_ptr);
21273         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
21274         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
21275         LDKCResult_PhantomRouteHintsDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PhantomRouteHintsDecodeErrorZ), "LDKCResult_PhantomRouteHintsDecodeErrorZ");
21276         *ret_conv = CResult_PhantomRouteHintsDecodeErrorZ_err(e_conv);
21277         return tag_ptr(ret_conv, true);
21278 }
21279
21280 jboolean  __attribute__((export_name("TS_CResult_PhantomRouteHintsDecodeErrorZ_is_ok"))) TS_CResult_PhantomRouteHintsDecodeErrorZ_is_ok(uint64_t o) {
21281         LDKCResult_PhantomRouteHintsDecodeErrorZ* o_conv = (LDKCResult_PhantomRouteHintsDecodeErrorZ*)untag_ptr(o);
21282         jboolean ret_conv = CResult_PhantomRouteHintsDecodeErrorZ_is_ok(o_conv);
21283         return ret_conv;
21284 }
21285
21286 void  __attribute__((export_name("TS_CResult_PhantomRouteHintsDecodeErrorZ_free"))) TS_CResult_PhantomRouteHintsDecodeErrorZ_free(uint64_t _res) {
21287         if (!ptr_is_owned(_res)) return;
21288         void* _res_ptr = untag_ptr(_res);
21289         CHECK_ACCESS(_res_ptr);
21290         LDKCResult_PhantomRouteHintsDecodeErrorZ _res_conv = *(LDKCResult_PhantomRouteHintsDecodeErrorZ*)(_res_ptr);
21291         FREE(untag_ptr(_res));
21292         CResult_PhantomRouteHintsDecodeErrorZ_free(_res_conv);
21293 }
21294
21295 static inline uint64_t CResult_PhantomRouteHintsDecodeErrorZ_clone_ptr(LDKCResult_PhantomRouteHintsDecodeErrorZ *NONNULL_PTR arg) {
21296         LDKCResult_PhantomRouteHintsDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PhantomRouteHintsDecodeErrorZ), "LDKCResult_PhantomRouteHintsDecodeErrorZ");
21297         *ret_conv = CResult_PhantomRouteHintsDecodeErrorZ_clone(arg);
21298         return tag_ptr(ret_conv, true);
21299 }
21300 int64_t  __attribute__((export_name("TS_CResult_PhantomRouteHintsDecodeErrorZ_clone_ptr"))) TS_CResult_PhantomRouteHintsDecodeErrorZ_clone_ptr(uint64_t arg) {
21301         LDKCResult_PhantomRouteHintsDecodeErrorZ* arg_conv = (LDKCResult_PhantomRouteHintsDecodeErrorZ*)untag_ptr(arg);
21302         int64_t ret_conv = CResult_PhantomRouteHintsDecodeErrorZ_clone_ptr(arg_conv);
21303         return ret_conv;
21304 }
21305
21306 uint64_t  __attribute__((export_name("TS_CResult_PhantomRouteHintsDecodeErrorZ_clone"))) TS_CResult_PhantomRouteHintsDecodeErrorZ_clone(uint64_t orig) {
21307         LDKCResult_PhantomRouteHintsDecodeErrorZ* orig_conv = (LDKCResult_PhantomRouteHintsDecodeErrorZ*)untag_ptr(orig);
21308         LDKCResult_PhantomRouteHintsDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PhantomRouteHintsDecodeErrorZ), "LDKCResult_PhantomRouteHintsDecodeErrorZ");
21309         *ret_conv = CResult_PhantomRouteHintsDecodeErrorZ_clone(orig_conv);
21310         return tag_ptr(ret_conv, true);
21311 }
21312
21313 uint64_t  __attribute__((export_name("TS_CResult_ChannelShutdownStateDecodeErrorZ_ok"))) TS_CResult_ChannelShutdownStateDecodeErrorZ_ok(uint32_t o) {
21314         LDKChannelShutdownState o_conv = LDKChannelShutdownState_from_js(o);
21315         LDKCResult_ChannelShutdownStateDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelShutdownStateDecodeErrorZ), "LDKCResult_ChannelShutdownStateDecodeErrorZ");
21316         *ret_conv = CResult_ChannelShutdownStateDecodeErrorZ_ok(o_conv);
21317         return tag_ptr(ret_conv, true);
21318 }
21319
21320 uint64_t  __attribute__((export_name("TS_CResult_ChannelShutdownStateDecodeErrorZ_err"))) TS_CResult_ChannelShutdownStateDecodeErrorZ_err(uint64_t e) {
21321         void* e_ptr = untag_ptr(e);
21322         CHECK_ACCESS(e_ptr);
21323         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
21324         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
21325         LDKCResult_ChannelShutdownStateDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelShutdownStateDecodeErrorZ), "LDKCResult_ChannelShutdownStateDecodeErrorZ");
21326         *ret_conv = CResult_ChannelShutdownStateDecodeErrorZ_err(e_conv);
21327         return tag_ptr(ret_conv, true);
21328 }
21329
21330 jboolean  __attribute__((export_name("TS_CResult_ChannelShutdownStateDecodeErrorZ_is_ok"))) TS_CResult_ChannelShutdownStateDecodeErrorZ_is_ok(uint64_t o) {
21331         LDKCResult_ChannelShutdownStateDecodeErrorZ* o_conv = (LDKCResult_ChannelShutdownStateDecodeErrorZ*)untag_ptr(o);
21332         jboolean ret_conv = CResult_ChannelShutdownStateDecodeErrorZ_is_ok(o_conv);
21333         return ret_conv;
21334 }
21335
21336 void  __attribute__((export_name("TS_CResult_ChannelShutdownStateDecodeErrorZ_free"))) TS_CResult_ChannelShutdownStateDecodeErrorZ_free(uint64_t _res) {
21337         if (!ptr_is_owned(_res)) return;
21338         void* _res_ptr = untag_ptr(_res);
21339         CHECK_ACCESS(_res_ptr);
21340         LDKCResult_ChannelShutdownStateDecodeErrorZ _res_conv = *(LDKCResult_ChannelShutdownStateDecodeErrorZ*)(_res_ptr);
21341         FREE(untag_ptr(_res));
21342         CResult_ChannelShutdownStateDecodeErrorZ_free(_res_conv);
21343 }
21344
21345 static inline uint64_t CResult_ChannelShutdownStateDecodeErrorZ_clone_ptr(LDKCResult_ChannelShutdownStateDecodeErrorZ *NONNULL_PTR arg) {
21346         LDKCResult_ChannelShutdownStateDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelShutdownStateDecodeErrorZ), "LDKCResult_ChannelShutdownStateDecodeErrorZ");
21347         *ret_conv = CResult_ChannelShutdownStateDecodeErrorZ_clone(arg);
21348         return tag_ptr(ret_conv, true);
21349 }
21350 int64_t  __attribute__((export_name("TS_CResult_ChannelShutdownStateDecodeErrorZ_clone_ptr"))) TS_CResult_ChannelShutdownStateDecodeErrorZ_clone_ptr(uint64_t arg) {
21351         LDKCResult_ChannelShutdownStateDecodeErrorZ* arg_conv = (LDKCResult_ChannelShutdownStateDecodeErrorZ*)untag_ptr(arg);
21352         int64_t ret_conv = CResult_ChannelShutdownStateDecodeErrorZ_clone_ptr(arg_conv);
21353         return ret_conv;
21354 }
21355
21356 uint64_t  __attribute__((export_name("TS_CResult_ChannelShutdownStateDecodeErrorZ_clone"))) TS_CResult_ChannelShutdownStateDecodeErrorZ_clone(uint64_t orig) {
21357         LDKCResult_ChannelShutdownStateDecodeErrorZ* orig_conv = (LDKCResult_ChannelShutdownStateDecodeErrorZ*)untag_ptr(orig);
21358         LDKCResult_ChannelShutdownStateDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelShutdownStateDecodeErrorZ), "LDKCResult_ChannelShutdownStateDecodeErrorZ");
21359         *ret_conv = CResult_ChannelShutdownStateDecodeErrorZ_clone(orig_conv);
21360         return tag_ptr(ret_conv, true);
21361 }
21362
21363 void  __attribute__((export_name("TS_CVec_ChannelMonitorZ_free"))) TS_CVec_ChannelMonitorZ_free(uint64_tArray _res) {
21364         LDKCVec_ChannelMonitorZ _res_constr;
21365         _res_constr.datalen = _res->arr_len;
21366         if (_res_constr.datalen > 0)
21367                 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKChannelMonitor), "LDKCVec_ChannelMonitorZ Elements");
21368         else
21369                 _res_constr.data = NULL;
21370         uint64_t* _res_vals = _res->elems;
21371         for (size_t q = 0; q < _res_constr.datalen; q++) {
21372                 uint64_t _res_conv_16 = _res_vals[q];
21373                 LDKChannelMonitor _res_conv_16_conv;
21374                 _res_conv_16_conv.inner = untag_ptr(_res_conv_16);
21375                 _res_conv_16_conv.is_owned = ptr_is_owned(_res_conv_16);
21376                 CHECK_INNER_FIELD_ACCESS_OR_NULL(_res_conv_16_conv);
21377                 _res_constr.data[q] = _res_conv_16_conv;
21378         }
21379         FREE(_res);
21380         CVec_ChannelMonitorZ_free(_res_constr);
21381 }
21382
21383 uint64_t  __attribute__((export_name("TS_C2Tuple_ThirtyTwoBytesChannelManagerZ_new"))) TS_C2Tuple_ThirtyTwoBytesChannelManagerZ_new(int8_tArray a, uint64_t b) {
21384         LDKThirtyTwoBytes a_ref;
21385         CHECK(a->arr_len == 32);
21386         memcpy(a_ref.data, a->elems, 32); FREE(a);
21387         LDKChannelManager b_conv;
21388         b_conv.inner = untag_ptr(b);
21389         b_conv.is_owned = ptr_is_owned(b);
21390         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
21391         // WARNING: we need a move here but no clone is available for LDKChannelManager
21392         
21393         LDKC2Tuple_ThirtyTwoBytesChannelManagerZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_ThirtyTwoBytesChannelManagerZ), "LDKC2Tuple_ThirtyTwoBytesChannelManagerZ");
21394         *ret_conv = C2Tuple_ThirtyTwoBytesChannelManagerZ_new(a_ref, b_conv);
21395         return tag_ptr(ret_conv, true);
21396 }
21397
21398 void  __attribute__((export_name("TS_C2Tuple_ThirtyTwoBytesChannelManagerZ_free"))) TS_C2Tuple_ThirtyTwoBytesChannelManagerZ_free(uint64_t _res) {
21399         if (!ptr_is_owned(_res)) return;
21400         void* _res_ptr = untag_ptr(_res);
21401         CHECK_ACCESS(_res_ptr);
21402         LDKC2Tuple_ThirtyTwoBytesChannelManagerZ _res_conv = *(LDKC2Tuple_ThirtyTwoBytesChannelManagerZ*)(_res_ptr);
21403         FREE(untag_ptr(_res));
21404         C2Tuple_ThirtyTwoBytesChannelManagerZ_free(_res_conv);
21405 }
21406
21407 uint64_t  __attribute__((export_name("TS_CResult_C2Tuple_ThirtyTwoBytesChannelManagerZDecodeErrorZ_ok"))) TS_CResult_C2Tuple_ThirtyTwoBytesChannelManagerZDecodeErrorZ_ok(uint64_t o) {
21408         void* o_ptr = untag_ptr(o);
21409         CHECK_ACCESS(o_ptr);
21410         LDKC2Tuple_ThirtyTwoBytesChannelManagerZ o_conv = *(LDKC2Tuple_ThirtyTwoBytesChannelManagerZ*)(o_ptr);
21411         // WARNING: we may need a move here but no clone is available for LDKC2Tuple_ThirtyTwoBytesChannelManagerZ
21412         LDKCResult_C2Tuple_ThirtyTwoBytesChannelManagerZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_ThirtyTwoBytesChannelManagerZDecodeErrorZ), "LDKCResult_C2Tuple_ThirtyTwoBytesChannelManagerZDecodeErrorZ");
21413         *ret_conv = CResult_C2Tuple_ThirtyTwoBytesChannelManagerZDecodeErrorZ_ok(o_conv);
21414         return tag_ptr(ret_conv, true);
21415 }
21416
21417 uint64_t  __attribute__((export_name("TS_CResult_C2Tuple_ThirtyTwoBytesChannelManagerZDecodeErrorZ_err"))) TS_CResult_C2Tuple_ThirtyTwoBytesChannelManagerZDecodeErrorZ_err(uint64_t e) {
21418         void* e_ptr = untag_ptr(e);
21419         CHECK_ACCESS(e_ptr);
21420         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
21421         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
21422         LDKCResult_C2Tuple_ThirtyTwoBytesChannelManagerZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_ThirtyTwoBytesChannelManagerZDecodeErrorZ), "LDKCResult_C2Tuple_ThirtyTwoBytesChannelManagerZDecodeErrorZ");
21423         *ret_conv = CResult_C2Tuple_ThirtyTwoBytesChannelManagerZDecodeErrorZ_err(e_conv);
21424         return tag_ptr(ret_conv, true);
21425 }
21426
21427 jboolean  __attribute__((export_name("TS_CResult_C2Tuple_ThirtyTwoBytesChannelManagerZDecodeErrorZ_is_ok"))) TS_CResult_C2Tuple_ThirtyTwoBytesChannelManagerZDecodeErrorZ_is_ok(uint64_t o) {
21428         LDKCResult_C2Tuple_ThirtyTwoBytesChannelManagerZDecodeErrorZ* o_conv = (LDKCResult_C2Tuple_ThirtyTwoBytesChannelManagerZDecodeErrorZ*)untag_ptr(o);
21429         jboolean ret_conv = CResult_C2Tuple_ThirtyTwoBytesChannelManagerZDecodeErrorZ_is_ok(o_conv);
21430         return ret_conv;
21431 }
21432
21433 void  __attribute__((export_name("TS_CResult_C2Tuple_ThirtyTwoBytesChannelManagerZDecodeErrorZ_free"))) TS_CResult_C2Tuple_ThirtyTwoBytesChannelManagerZDecodeErrorZ_free(uint64_t _res) {
21434         if (!ptr_is_owned(_res)) return;
21435         void* _res_ptr = untag_ptr(_res);
21436         CHECK_ACCESS(_res_ptr);
21437         LDKCResult_C2Tuple_ThirtyTwoBytesChannelManagerZDecodeErrorZ _res_conv = *(LDKCResult_C2Tuple_ThirtyTwoBytesChannelManagerZDecodeErrorZ*)(_res_ptr);
21438         FREE(untag_ptr(_res));
21439         CResult_C2Tuple_ThirtyTwoBytesChannelManagerZDecodeErrorZ_free(_res_conv);
21440 }
21441
21442 uint64_t  __attribute__((export_name("TS_CResult_MaxDustHTLCExposureDecodeErrorZ_ok"))) TS_CResult_MaxDustHTLCExposureDecodeErrorZ_ok(uint64_t o) {
21443         void* o_ptr = untag_ptr(o);
21444         CHECK_ACCESS(o_ptr);
21445         LDKMaxDustHTLCExposure o_conv = *(LDKMaxDustHTLCExposure*)(o_ptr);
21446         o_conv = MaxDustHTLCExposure_clone((LDKMaxDustHTLCExposure*)untag_ptr(o));
21447         LDKCResult_MaxDustHTLCExposureDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_MaxDustHTLCExposureDecodeErrorZ), "LDKCResult_MaxDustHTLCExposureDecodeErrorZ");
21448         *ret_conv = CResult_MaxDustHTLCExposureDecodeErrorZ_ok(o_conv);
21449         return tag_ptr(ret_conv, true);
21450 }
21451
21452 uint64_t  __attribute__((export_name("TS_CResult_MaxDustHTLCExposureDecodeErrorZ_err"))) TS_CResult_MaxDustHTLCExposureDecodeErrorZ_err(uint64_t e) {
21453         void* e_ptr = untag_ptr(e);
21454         CHECK_ACCESS(e_ptr);
21455         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
21456         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
21457         LDKCResult_MaxDustHTLCExposureDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_MaxDustHTLCExposureDecodeErrorZ), "LDKCResult_MaxDustHTLCExposureDecodeErrorZ");
21458         *ret_conv = CResult_MaxDustHTLCExposureDecodeErrorZ_err(e_conv);
21459         return tag_ptr(ret_conv, true);
21460 }
21461
21462 jboolean  __attribute__((export_name("TS_CResult_MaxDustHTLCExposureDecodeErrorZ_is_ok"))) TS_CResult_MaxDustHTLCExposureDecodeErrorZ_is_ok(uint64_t o) {
21463         LDKCResult_MaxDustHTLCExposureDecodeErrorZ* o_conv = (LDKCResult_MaxDustHTLCExposureDecodeErrorZ*)untag_ptr(o);
21464         jboolean ret_conv = CResult_MaxDustHTLCExposureDecodeErrorZ_is_ok(o_conv);
21465         return ret_conv;
21466 }
21467
21468 void  __attribute__((export_name("TS_CResult_MaxDustHTLCExposureDecodeErrorZ_free"))) TS_CResult_MaxDustHTLCExposureDecodeErrorZ_free(uint64_t _res) {
21469         if (!ptr_is_owned(_res)) return;
21470         void* _res_ptr = untag_ptr(_res);
21471         CHECK_ACCESS(_res_ptr);
21472         LDKCResult_MaxDustHTLCExposureDecodeErrorZ _res_conv = *(LDKCResult_MaxDustHTLCExposureDecodeErrorZ*)(_res_ptr);
21473         FREE(untag_ptr(_res));
21474         CResult_MaxDustHTLCExposureDecodeErrorZ_free(_res_conv);
21475 }
21476
21477 static inline uint64_t CResult_MaxDustHTLCExposureDecodeErrorZ_clone_ptr(LDKCResult_MaxDustHTLCExposureDecodeErrorZ *NONNULL_PTR arg) {
21478         LDKCResult_MaxDustHTLCExposureDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_MaxDustHTLCExposureDecodeErrorZ), "LDKCResult_MaxDustHTLCExposureDecodeErrorZ");
21479         *ret_conv = CResult_MaxDustHTLCExposureDecodeErrorZ_clone(arg);
21480         return tag_ptr(ret_conv, true);
21481 }
21482 int64_t  __attribute__((export_name("TS_CResult_MaxDustHTLCExposureDecodeErrorZ_clone_ptr"))) TS_CResult_MaxDustHTLCExposureDecodeErrorZ_clone_ptr(uint64_t arg) {
21483         LDKCResult_MaxDustHTLCExposureDecodeErrorZ* arg_conv = (LDKCResult_MaxDustHTLCExposureDecodeErrorZ*)untag_ptr(arg);
21484         int64_t ret_conv = CResult_MaxDustHTLCExposureDecodeErrorZ_clone_ptr(arg_conv);
21485         return ret_conv;
21486 }
21487
21488 uint64_t  __attribute__((export_name("TS_CResult_MaxDustHTLCExposureDecodeErrorZ_clone"))) TS_CResult_MaxDustHTLCExposureDecodeErrorZ_clone(uint64_t orig) {
21489         LDKCResult_MaxDustHTLCExposureDecodeErrorZ* orig_conv = (LDKCResult_MaxDustHTLCExposureDecodeErrorZ*)untag_ptr(orig);
21490         LDKCResult_MaxDustHTLCExposureDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_MaxDustHTLCExposureDecodeErrorZ), "LDKCResult_MaxDustHTLCExposureDecodeErrorZ");
21491         *ret_conv = CResult_MaxDustHTLCExposureDecodeErrorZ_clone(orig_conv);
21492         return tag_ptr(ret_conv, true);
21493 }
21494
21495 uint64_t  __attribute__((export_name("TS_CResult_ChannelConfigDecodeErrorZ_ok"))) TS_CResult_ChannelConfigDecodeErrorZ_ok(uint64_t o) {
21496         LDKChannelConfig o_conv;
21497         o_conv.inner = untag_ptr(o);
21498         o_conv.is_owned = ptr_is_owned(o);
21499         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
21500         o_conv = ChannelConfig_clone(&o_conv);
21501         LDKCResult_ChannelConfigDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelConfigDecodeErrorZ), "LDKCResult_ChannelConfigDecodeErrorZ");
21502         *ret_conv = CResult_ChannelConfigDecodeErrorZ_ok(o_conv);
21503         return tag_ptr(ret_conv, true);
21504 }
21505
21506 uint64_t  __attribute__((export_name("TS_CResult_ChannelConfigDecodeErrorZ_err"))) TS_CResult_ChannelConfigDecodeErrorZ_err(uint64_t e) {
21507         void* e_ptr = untag_ptr(e);
21508         CHECK_ACCESS(e_ptr);
21509         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
21510         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
21511         LDKCResult_ChannelConfigDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelConfigDecodeErrorZ), "LDKCResult_ChannelConfigDecodeErrorZ");
21512         *ret_conv = CResult_ChannelConfigDecodeErrorZ_err(e_conv);
21513         return tag_ptr(ret_conv, true);
21514 }
21515
21516 jboolean  __attribute__((export_name("TS_CResult_ChannelConfigDecodeErrorZ_is_ok"))) TS_CResult_ChannelConfigDecodeErrorZ_is_ok(uint64_t o) {
21517         LDKCResult_ChannelConfigDecodeErrorZ* o_conv = (LDKCResult_ChannelConfigDecodeErrorZ*)untag_ptr(o);
21518         jboolean ret_conv = CResult_ChannelConfigDecodeErrorZ_is_ok(o_conv);
21519         return ret_conv;
21520 }
21521
21522 void  __attribute__((export_name("TS_CResult_ChannelConfigDecodeErrorZ_free"))) TS_CResult_ChannelConfigDecodeErrorZ_free(uint64_t _res) {
21523         if (!ptr_is_owned(_res)) return;
21524         void* _res_ptr = untag_ptr(_res);
21525         CHECK_ACCESS(_res_ptr);
21526         LDKCResult_ChannelConfigDecodeErrorZ _res_conv = *(LDKCResult_ChannelConfigDecodeErrorZ*)(_res_ptr);
21527         FREE(untag_ptr(_res));
21528         CResult_ChannelConfigDecodeErrorZ_free(_res_conv);
21529 }
21530
21531 static inline uint64_t CResult_ChannelConfigDecodeErrorZ_clone_ptr(LDKCResult_ChannelConfigDecodeErrorZ *NONNULL_PTR arg) {
21532         LDKCResult_ChannelConfigDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelConfigDecodeErrorZ), "LDKCResult_ChannelConfigDecodeErrorZ");
21533         *ret_conv = CResult_ChannelConfigDecodeErrorZ_clone(arg);
21534         return tag_ptr(ret_conv, true);
21535 }
21536 int64_t  __attribute__((export_name("TS_CResult_ChannelConfigDecodeErrorZ_clone_ptr"))) TS_CResult_ChannelConfigDecodeErrorZ_clone_ptr(uint64_t arg) {
21537         LDKCResult_ChannelConfigDecodeErrorZ* arg_conv = (LDKCResult_ChannelConfigDecodeErrorZ*)untag_ptr(arg);
21538         int64_t ret_conv = CResult_ChannelConfigDecodeErrorZ_clone_ptr(arg_conv);
21539         return ret_conv;
21540 }
21541
21542 uint64_t  __attribute__((export_name("TS_CResult_ChannelConfigDecodeErrorZ_clone"))) TS_CResult_ChannelConfigDecodeErrorZ_clone(uint64_t orig) {
21543         LDKCResult_ChannelConfigDecodeErrorZ* orig_conv = (LDKCResult_ChannelConfigDecodeErrorZ*)untag_ptr(orig);
21544         LDKCResult_ChannelConfigDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelConfigDecodeErrorZ), "LDKCResult_ChannelConfigDecodeErrorZ");
21545         *ret_conv = CResult_ChannelConfigDecodeErrorZ_clone(orig_conv);
21546         return tag_ptr(ret_conv, true);
21547 }
21548
21549 uint64_t  __attribute__((export_name("TS_COption_MaxDustHTLCExposureZ_some"))) TS_COption_MaxDustHTLCExposureZ_some(uint64_t o) {
21550         void* o_ptr = untag_ptr(o);
21551         CHECK_ACCESS(o_ptr);
21552         LDKMaxDustHTLCExposure o_conv = *(LDKMaxDustHTLCExposure*)(o_ptr);
21553         o_conv = MaxDustHTLCExposure_clone((LDKMaxDustHTLCExposure*)untag_ptr(o));
21554         LDKCOption_MaxDustHTLCExposureZ *ret_copy = MALLOC(sizeof(LDKCOption_MaxDustHTLCExposureZ), "LDKCOption_MaxDustHTLCExposureZ");
21555         *ret_copy = COption_MaxDustHTLCExposureZ_some(o_conv);
21556         uint64_t ret_ref = tag_ptr(ret_copy, true);
21557         return ret_ref;
21558 }
21559
21560 uint64_t  __attribute__((export_name("TS_COption_MaxDustHTLCExposureZ_none"))) TS_COption_MaxDustHTLCExposureZ_none() {
21561         LDKCOption_MaxDustHTLCExposureZ *ret_copy = MALLOC(sizeof(LDKCOption_MaxDustHTLCExposureZ), "LDKCOption_MaxDustHTLCExposureZ");
21562         *ret_copy = COption_MaxDustHTLCExposureZ_none();
21563         uint64_t ret_ref = tag_ptr(ret_copy, true);
21564         return ret_ref;
21565 }
21566
21567 void  __attribute__((export_name("TS_COption_MaxDustHTLCExposureZ_free"))) TS_COption_MaxDustHTLCExposureZ_free(uint64_t _res) {
21568         if (!ptr_is_owned(_res)) return;
21569         void* _res_ptr = untag_ptr(_res);
21570         CHECK_ACCESS(_res_ptr);
21571         LDKCOption_MaxDustHTLCExposureZ _res_conv = *(LDKCOption_MaxDustHTLCExposureZ*)(_res_ptr);
21572         FREE(untag_ptr(_res));
21573         COption_MaxDustHTLCExposureZ_free(_res_conv);
21574 }
21575
21576 static inline uint64_t COption_MaxDustHTLCExposureZ_clone_ptr(LDKCOption_MaxDustHTLCExposureZ *NONNULL_PTR arg) {
21577         LDKCOption_MaxDustHTLCExposureZ *ret_copy = MALLOC(sizeof(LDKCOption_MaxDustHTLCExposureZ), "LDKCOption_MaxDustHTLCExposureZ");
21578         *ret_copy = COption_MaxDustHTLCExposureZ_clone(arg);
21579         uint64_t ret_ref = tag_ptr(ret_copy, true);
21580         return ret_ref;
21581 }
21582 int64_t  __attribute__((export_name("TS_COption_MaxDustHTLCExposureZ_clone_ptr"))) TS_COption_MaxDustHTLCExposureZ_clone_ptr(uint64_t arg) {
21583         LDKCOption_MaxDustHTLCExposureZ* arg_conv = (LDKCOption_MaxDustHTLCExposureZ*)untag_ptr(arg);
21584         int64_t ret_conv = COption_MaxDustHTLCExposureZ_clone_ptr(arg_conv);
21585         return ret_conv;
21586 }
21587
21588 uint64_t  __attribute__((export_name("TS_COption_MaxDustHTLCExposureZ_clone"))) TS_COption_MaxDustHTLCExposureZ_clone(uint64_t orig) {
21589         LDKCOption_MaxDustHTLCExposureZ* orig_conv = (LDKCOption_MaxDustHTLCExposureZ*)untag_ptr(orig);
21590         LDKCOption_MaxDustHTLCExposureZ *ret_copy = MALLOC(sizeof(LDKCOption_MaxDustHTLCExposureZ), "LDKCOption_MaxDustHTLCExposureZ");
21591         *ret_copy = COption_MaxDustHTLCExposureZ_clone(orig_conv);
21592         uint64_t ret_ref = tag_ptr(ret_copy, true);
21593         return ret_ref;
21594 }
21595
21596 uint64_t  __attribute__((export_name("TS_COption_APIErrorZ_some"))) TS_COption_APIErrorZ_some(uint64_t o) {
21597         void* o_ptr = untag_ptr(o);
21598         CHECK_ACCESS(o_ptr);
21599         LDKAPIError o_conv = *(LDKAPIError*)(o_ptr);
21600         o_conv = APIError_clone((LDKAPIError*)untag_ptr(o));
21601         LDKCOption_APIErrorZ *ret_copy = MALLOC(sizeof(LDKCOption_APIErrorZ), "LDKCOption_APIErrorZ");
21602         *ret_copy = COption_APIErrorZ_some(o_conv);
21603         uint64_t ret_ref = tag_ptr(ret_copy, true);
21604         return ret_ref;
21605 }
21606
21607 uint64_t  __attribute__((export_name("TS_COption_APIErrorZ_none"))) TS_COption_APIErrorZ_none() {
21608         LDKCOption_APIErrorZ *ret_copy = MALLOC(sizeof(LDKCOption_APIErrorZ), "LDKCOption_APIErrorZ");
21609         *ret_copy = COption_APIErrorZ_none();
21610         uint64_t ret_ref = tag_ptr(ret_copy, true);
21611         return ret_ref;
21612 }
21613
21614 void  __attribute__((export_name("TS_COption_APIErrorZ_free"))) TS_COption_APIErrorZ_free(uint64_t _res) {
21615         if (!ptr_is_owned(_res)) return;
21616         void* _res_ptr = untag_ptr(_res);
21617         CHECK_ACCESS(_res_ptr);
21618         LDKCOption_APIErrorZ _res_conv = *(LDKCOption_APIErrorZ*)(_res_ptr);
21619         FREE(untag_ptr(_res));
21620         COption_APIErrorZ_free(_res_conv);
21621 }
21622
21623 static inline uint64_t COption_APIErrorZ_clone_ptr(LDKCOption_APIErrorZ *NONNULL_PTR arg) {
21624         LDKCOption_APIErrorZ *ret_copy = MALLOC(sizeof(LDKCOption_APIErrorZ), "LDKCOption_APIErrorZ");
21625         *ret_copy = COption_APIErrorZ_clone(arg);
21626         uint64_t ret_ref = tag_ptr(ret_copy, true);
21627         return ret_ref;
21628 }
21629 int64_t  __attribute__((export_name("TS_COption_APIErrorZ_clone_ptr"))) TS_COption_APIErrorZ_clone_ptr(uint64_t arg) {
21630         LDKCOption_APIErrorZ* arg_conv = (LDKCOption_APIErrorZ*)untag_ptr(arg);
21631         int64_t ret_conv = COption_APIErrorZ_clone_ptr(arg_conv);
21632         return ret_conv;
21633 }
21634
21635 uint64_t  __attribute__((export_name("TS_COption_APIErrorZ_clone"))) TS_COption_APIErrorZ_clone(uint64_t orig) {
21636         LDKCOption_APIErrorZ* orig_conv = (LDKCOption_APIErrorZ*)untag_ptr(orig);
21637         LDKCOption_APIErrorZ *ret_copy = MALLOC(sizeof(LDKCOption_APIErrorZ), "LDKCOption_APIErrorZ");
21638         *ret_copy = COption_APIErrorZ_clone(orig_conv);
21639         uint64_t ret_ref = tag_ptr(ret_copy, true);
21640         return ret_ref;
21641 }
21642
21643 uint64_t  __attribute__((export_name("TS_CResult_COption_APIErrorZDecodeErrorZ_ok"))) TS_CResult_COption_APIErrorZDecodeErrorZ_ok(uint64_t o) {
21644         void* o_ptr = untag_ptr(o);
21645         CHECK_ACCESS(o_ptr);
21646         LDKCOption_APIErrorZ o_conv = *(LDKCOption_APIErrorZ*)(o_ptr);
21647         o_conv = COption_APIErrorZ_clone((LDKCOption_APIErrorZ*)untag_ptr(o));
21648         LDKCResult_COption_APIErrorZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_COption_APIErrorZDecodeErrorZ), "LDKCResult_COption_APIErrorZDecodeErrorZ");
21649         *ret_conv = CResult_COption_APIErrorZDecodeErrorZ_ok(o_conv);
21650         return tag_ptr(ret_conv, true);
21651 }
21652
21653 uint64_t  __attribute__((export_name("TS_CResult_COption_APIErrorZDecodeErrorZ_err"))) TS_CResult_COption_APIErrorZDecodeErrorZ_err(uint64_t e) {
21654         void* e_ptr = untag_ptr(e);
21655         CHECK_ACCESS(e_ptr);
21656         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
21657         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
21658         LDKCResult_COption_APIErrorZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_COption_APIErrorZDecodeErrorZ), "LDKCResult_COption_APIErrorZDecodeErrorZ");
21659         *ret_conv = CResult_COption_APIErrorZDecodeErrorZ_err(e_conv);
21660         return tag_ptr(ret_conv, true);
21661 }
21662
21663 jboolean  __attribute__((export_name("TS_CResult_COption_APIErrorZDecodeErrorZ_is_ok"))) TS_CResult_COption_APIErrorZDecodeErrorZ_is_ok(uint64_t o) {
21664         LDKCResult_COption_APIErrorZDecodeErrorZ* o_conv = (LDKCResult_COption_APIErrorZDecodeErrorZ*)untag_ptr(o);
21665         jboolean ret_conv = CResult_COption_APIErrorZDecodeErrorZ_is_ok(o_conv);
21666         return ret_conv;
21667 }
21668
21669 void  __attribute__((export_name("TS_CResult_COption_APIErrorZDecodeErrorZ_free"))) TS_CResult_COption_APIErrorZDecodeErrorZ_free(uint64_t _res) {
21670         if (!ptr_is_owned(_res)) return;
21671         void* _res_ptr = untag_ptr(_res);
21672         CHECK_ACCESS(_res_ptr);
21673         LDKCResult_COption_APIErrorZDecodeErrorZ _res_conv = *(LDKCResult_COption_APIErrorZDecodeErrorZ*)(_res_ptr);
21674         FREE(untag_ptr(_res));
21675         CResult_COption_APIErrorZDecodeErrorZ_free(_res_conv);
21676 }
21677
21678 static inline uint64_t CResult_COption_APIErrorZDecodeErrorZ_clone_ptr(LDKCResult_COption_APIErrorZDecodeErrorZ *NONNULL_PTR arg) {
21679         LDKCResult_COption_APIErrorZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_COption_APIErrorZDecodeErrorZ), "LDKCResult_COption_APIErrorZDecodeErrorZ");
21680         *ret_conv = CResult_COption_APIErrorZDecodeErrorZ_clone(arg);
21681         return tag_ptr(ret_conv, true);
21682 }
21683 int64_t  __attribute__((export_name("TS_CResult_COption_APIErrorZDecodeErrorZ_clone_ptr"))) TS_CResult_COption_APIErrorZDecodeErrorZ_clone_ptr(uint64_t arg) {
21684         LDKCResult_COption_APIErrorZDecodeErrorZ* arg_conv = (LDKCResult_COption_APIErrorZDecodeErrorZ*)untag_ptr(arg);
21685         int64_t ret_conv = CResult_COption_APIErrorZDecodeErrorZ_clone_ptr(arg_conv);
21686         return ret_conv;
21687 }
21688
21689 uint64_t  __attribute__((export_name("TS_CResult_COption_APIErrorZDecodeErrorZ_clone"))) TS_CResult_COption_APIErrorZDecodeErrorZ_clone(uint64_t orig) {
21690         LDKCResult_COption_APIErrorZDecodeErrorZ* orig_conv = (LDKCResult_COption_APIErrorZDecodeErrorZ*)untag_ptr(orig);
21691         LDKCResult_COption_APIErrorZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_COption_APIErrorZDecodeErrorZ), "LDKCResult_COption_APIErrorZDecodeErrorZ");
21692         *ret_conv = CResult_COption_APIErrorZDecodeErrorZ_clone(orig_conv);
21693         return tag_ptr(ret_conv, true);
21694 }
21695
21696 uint64_t  __attribute__((export_name("TS_CResult_ChannelMonitorUpdateDecodeErrorZ_ok"))) TS_CResult_ChannelMonitorUpdateDecodeErrorZ_ok(uint64_t o) {
21697         LDKChannelMonitorUpdate o_conv;
21698         o_conv.inner = untag_ptr(o);
21699         o_conv.is_owned = ptr_is_owned(o);
21700         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
21701         o_conv = ChannelMonitorUpdate_clone(&o_conv);
21702         LDKCResult_ChannelMonitorUpdateDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelMonitorUpdateDecodeErrorZ), "LDKCResult_ChannelMonitorUpdateDecodeErrorZ");
21703         *ret_conv = CResult_ChannelMonitorUpdateDecodeErrorZ_ok(o_conv);
21704         return tag_ptr(ret_conv, true);
21705 }
21706
21707 uint64_t  __attribute__((export_name("TS_CResult_ChannelMonitorUpdateDecodeErrorZ_err"))) TS_CResult_ChannelMonitorUpdateDecodeErrorZ_err(uint64_t e) {
21708         void* e_ptr = untag_ptr(e);
21709         CHECK_ACCESS(e_ptr);
21710         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
21711         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
21712         LDKCResult_ChannelMonitorUpdateDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelMonitorUpdateDecodeErrorZ), "LDKCResult_ChannelMonitorUpdateDecodeErrorZ");
21713         *ret_conv = CResult_ChannelMonitorUpdateDecodeErrorZ_err(e_conv);
21714         return tag_ptr(ret_conv, true);
21715 }
21716
21717 jboolean  __attribute__((export_name("TS_CResult_ChannelMonitorUpdateDecodeErrorZ_is_ok"))) TS_CResult_ChannelMonitorUpdateDecodeErrorZ_is_ok(uint64_t o) {
21718         LDKCResult_ChannelMonitorUpdateDecodeErrorZ* o_conv = (LDKCResult_ChannelMonitorUpdateDecodeErrorZ*)untag_ptr(o);
21719         jboolean ret_conv = CResult_ChannelMonitorUpdateDecodeErrorZ_is_ok(o_conv);
21720         return ret_conv;
21721 }
21722
21723 void  __attribute__((export_name("TS_CResult_ChannelMonitorUpdateDecodeErrorZ_free"))) TS_CResult_ChannelMonitorUpdateDecodeErrorZ_free(uint64_t _res) {
21724         if (!ptr_is_owned(_res)) return;
21725         void* _res_ptr = untag_ptr(_res);
21726         CHECK_ACCESS(_res_ptr);
21727         LDKCResult_ChannelMonitorUpdateDecodeErrorZ _res_conv = *(LDKCResult_ChannelMonitorUpdateDecodeErrorZ*)(_res_ptr);
21728         FREE(untag_ptr(_res));
21729         CResult_ChannelMonitorUpdateDecodeErrorZ_free(_res_conv);
21730 }
21731
21732 static inline uint64_t CResult_ChannelMonitorUpdateDecodeErrorZ_clone_ptr(LDKCResult_ChannelMonitorUpdateDecodeErrorZ *NONNULL_PTR arg) {
21733         LDKCResult_ChannelMonitorUpdateDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelMonitorUpdateDecodeErrorZ), "LDKCResult_ChannelMonitorUpdateDecodeErrorZ");
21734         *ret_conv = CResult_ChannelMonitorUpdateDecodeErrorZ_clone(arg);
21735         return tag_ptr(ret_conv, true);
21736 }
21737 int64_t  __attribute__((export_name("TS_CResult_ChannelMonitorUpdateDecodeErrorZ_clone_ptr"))) TS_CResult_ChannelMonitorUpdateDecodeErrorZ_clone_ptr(uint64_t arg) {
21738         LDKCResult_ChannelMonitorUpdateDecodeErrorZ* arg_conv = (LDKCResult_ChannelMonitorUpdateDecodeErrorZ*)untag_ptr(arg);
21739         int64_t ret_conv = CResult_ChannelMonitorUpdateDecodeErrorZ_clone_ptr(arg_conv);
21740         return ret_conv;
21741 }
21742
21743 uint64_t  __attribute__((export_name("TS_CResult_ChannelMonitorUpdateDecodeErrorZ_clone"))) TS_CResult_ChannelMonitorUpdateDecodeErrorZ_clone(uint64_t orig) {
21744         LDKCResult_ChannelMonitorUpdateDecodeErrorZ* orig_conv = (LDKCResult_ChannelMonitorUpdateDecodeErrorZ*)untag_ptr(orig);
21745         LDKCResult_ChannelMonitorUpdateDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelMonitorUpdateDecodeErrorZ), "LDKCResult_ChannelMonitorUpdateDecodeErrorZ");
21746         *ret_conv = CResult_ChannelMonitorUpdateDecodeErrorZ_clone(orig_conv);
21747         return tag_ptr(ret_conv, true);
21748 }
21749
21750 uint64_t  __attribute__((export_name("TS_COption_MonitorEventZ_some"))) TS_COption_MonitorEventZ_some(uint64_t o) {
21751         void* o_ptr = untag_ptr(o);
21752         CHECK_ACCESS(o_ptr);
21753         LDKMonitorEvent o_conv = *(LDKMonitorEvent*)(o_ptr);
21754         o_conv = MonitorEvent_clone((LDKMonitorEvent*)untag_ptr(o));
21755         LDKCOption_MonitorEventZ *ret_copy = MALLOC(sizeof(LDKCOption_MonitorEventZ), "LDKCOption_MonitorEventZ");
21756         *ret_copy = COption_MonitorEventZ_some(o_conv);
21757         uint64_t ret_ref = tag_ptr(ret_copy, true);
21758         return ret_ref;
21759 }
21760
21761 uint64_t  __attribute__((export_name("TS_COption_MonitorEventZ_none"))) TS_COption_MonitorEventZ_none() {
21762         LDKCOption_MonitorEventZ *ret_copy = MALLOC(sizeof(LDKCOption_MonitorEventZ), "LDKCOption_MonitorEventZ");
21763         *ret_copy = COption_MonitorEventZ_none();
21764         uint64_t ret_ref = tag_ptr(ret_copy, true);
21765         return ret_ref;
21766 }
21767
21768 void  __attribute__((export_name("TS_COption_MonitorEventZ_free"))) TS_COption_MonitorEventZ_free(uint64_t _res) {
21769         if (!ptr_is_owned(_res)) return;
21770         void* _res_ptr = untag_ptr(_res);
21771         CHECK_ACCESS(_res_ptr);
21772         LDKCOption_MonitorEventZ _res_conv = *(LDKCOption_MonitorEventZ*)(_res_ptr);
21773         FREE(untag_ptr(_res));
21774         COption_MonitorEventZ_free(_res_conv);
21775 }
21776
21777 static inline uint64_t COption_MonitorEventZ_clone_ptr(LDKCOption_MonitorEventZ *NONNULL_PTR arg) {
21778         LDKCOption_MonitorEventZ *ret_copy = MALLOC(sizeof(LDKCOption_MonitorEventZ), "LDKCOption_MonitorEventZ");
21779         *ret_copy = COption_MonitorEventZ_clone(arg);
21780         uint64_t ret_ref = tag_ptr(ret_copy, true);
21781         return ret_ref;
21782 }
21783 int64_t  __attribute__((export_name("TS_COption_MonitorEventZ_clone_ptr"))) TS_COption_MonitorEventZ_clone_ptr(uint64_t arg) {
21784         LDKCOption_MonitorEventZ* arg_conv = (LDKCOption_MonitorEventZ*)untag_ptr(arg);
21785         int64_t ret_conv = COption_MonitorEventZ_clone_ptr(arg_conv);
21786         return ret_conv;
21787 }
21788
21789 uint64_t  __attribute__((export_name("TS_COption_MonitorEventZ_clone"))) TS_COption_MonitorEventZ_clone(uint64_t orig) {
21790         LDKCOption_MonitorEventZ* orig_conv = (LDKCOption_MonitorEventZ*)untag_ptr(orig);
21791         LDKCOption_MonitorEventZ *ret_copy = MALLOC(sizeof(LDKCOption_MonitorEventZ), "LDKCOption_MonitorEventZ");
21792         *ret_copy = COption_MonitorEventZ_clone(orig_conv);
21793         uint64_t ret_ref = tag_ptr(ret_copy, true);
21794         return ret_ref;
21795 }
21796
21797 uint64_t  __attribute__((export_name("TS_CResult_COption_MonitorEventZDecodeErrorZ_ok"))) TS_CResult_COption_MonitorEventZDecodeErrorZ_ok(uint64_t o) {
21798         void* o_ptr = untag_ptr(o);
21799         CHECK_ACCESS(o_ptr);
21800         LDKCOption_MonitorEventZ o_conv = *(LDKCOption_MonitorEventZ*)(o_ptr);
21801         o_conv = COption_MonitorEventZ_clone((LDKCOption_MonitorEventZ*)untag_ptr(o));
21802         LDKCResult_COption_MonitorEventZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_COption_MonitorEventZDecodeErrorZ), "LDKCResult_COption_MonitorEventZDecodeErrorZ");
21803         *ret_conv = CResult_COption_MonitorEventZDecodeErrorZ_ok(o_conv);
21804         return tag_ptr(ret_conv, true);
21805 }
21806
21807 uint64_t  __attribute__((export_name("TS_CResult_COption_MonitorEventZDecodeErrorZ_err"))) TS_CResult_COption_MonitorEventZDecodeErrorZ_err(uint64_t e) {
21808         void* e_ptr = untag_ptr(e);
21809         CHECK_ACCESS(e_ptr);
21810         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
21811         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
21812         LDKCResult_COption_MonitorEventZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_COption_MonitorEventZDecodeErrorZ), "LDKCResult_COption_MonitorEventZDecodeErrorZ");
21813         *ret_conv = CResult_COption_MonitorEventZDecodeErrorZ_err(e_conv);
21814         return tag_ptr(ret_conv, true);
21815 }
21816
21817 jboolean  __attribute__((export_name("TS_CResult_COption_MonitorEventZDecodeErrorZ_is_ok"))) TS_CResult_COption_MonitorEventZDecodeErrorZ_is_ok(uint64_t o) {
21818         LDKCResult_COption_MonitorEventZDecodeErrorZ* o_conv = (LDKCResult_COption_MonitorEventZDecodeErrorZ*)untag_ptr(o);
21819         jboolean ret_conv = CResult_COption_MonitorEventZDecodeErrorZ_is_ok(o_conv);
21820         return ret_conv;
21821 }
21822
21823 void  __attribute__((export_name("TS_CResult_COption_MonitorEventZDecodeErrorZ_free"))) TS_CResult_COption_MonitorEventZDecodeErrorZ_free(uint64_t _res) {
21824         if (!ptr_is_owned(_res)) return;
21825         void* _res_ptr = untag_ptr(_res);
21826         CHECK_ACCESS(_res_ptr);
21827         LDKCResult_COption_MonitorEventZDecodeErrorZ _res_conv = *(LDKCResult_COption_MonitorEventZDecodeErrorZ*)(_res_ptr);
21828         FREE(untag_ptr(_res));
21829         CResult_COption_MonitorEventZDecodeErrorZ_free(_res_conv);
21830 }
21831
21832 static inline uint64_t CResult_COption_MonitorEventZDecodeErrorZ_clone_ptr(LDKCResult_COption_MonitorEventZDecodeErrorZ *NONNULL_PTR arg) {
21833         LDKCResult_COption_MonitorEventZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_COption_MonitorEventZDecodeErrorZ), "LDKCResult_COption_MonitorEventZDecodeErrorZ");
21834         *ret_conv = CResult_COption_MonitorEventZDecodeErrorZ_clone(arg);
21835         return tag_ptr(ret_conv, true);
21836 }
21837 int64_t  __attribute__((export_name("TS_CResult_COption_MonitorEventZDecodeErrorZ_clone_ptr"))) TS_CResult_COption_MonitorEventZDecodeErrorZ_clone_ptr(uint64_t arg) {
21838         LDKCResult_COption_MonitorEventZDecodeErrorZ* arg_conv = (LDKCResult_COption_MonitorEventZDecodeErrorZ*)untag_ptr(arg);
21839         int64_t ret_conv = CResult_COption_MonitorEventZDecodeErrorZ_clone_ptr(arg_conv);
21840         return ret_conv;
21841 }
21842
21843 uint64_t  __attribute__((export_name("TS_CResult_COption_MonitorEventZDecodeErrorZ_clone"))) TS_CResult_COption_MonitorEventZDecodeErrorZ_clone(uint64_t orig) {
21844         LDKCResult_COption_MonitorEventZDecodeErrorZ* orig_conv = (LDKCResult_COption_MonitorEventZDecodeErrorZ*)untag_ptr(orig);
21845         LDKCResult_COption_MonitorEventZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_COption_MonitorEventZDecodeErrorZ), "LDKCResult_COption_MonitorEventZDecodeErrorZ");
21846         *ret_conv = CResult_COption_MonitorEventZDecodeErrorZ_clone(orig_conv);
21847         return tag_ptr(ret_conv, true);
21848 }
21849
21850 uint64_t  __attribute__((export_name("TS_CResult_HTLCUpdateDecodeErrorZ_ok"))) TS_CResult_HTLCUpdateDecodeErrorZ_ok(uint64_t o) {
21851         LDKHTLCUpdate o_conv;
21852         o_conv.inner = untag_ptr(o);
21853         o_conv.is_owned = ptr_is_owned(o);
21854         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
21855         o_conv = HTLCUpdate_clone(&o_conv);
21856         LDKCResult_HTLCUpdateDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_HTLCUpdateDecodeErrorZ), "LDKCResult_HTLCUpdateDecodeErrorZ");
21857         *ret_conv = CResult_HTLCUpdateDecodeErrorZ_ok(o_conv);
21858         return tag_ptr(ret_conv, true);
21859 }
21860
21861 uint64_t  __attribute__((export_name("TS_CResult_HTLCUpdateDecodeErrorZ_err"))) TS_CResult_HTLCUpdateDecodeErrorZ_err(uint64_t e) {
21862         void* e_ptr = untag_ptr(e);
21863         CHECK_ACCESS(e_ptr);
21864         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
21865         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
21866         LDKCResult_HTLCUpdateDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_HTLCUpdateDecodeErrorZ), "LDKCResult_HTLCUpdateDecodeErrorZ");
21867         *ret_conv = CResult_HTLCUpdateDecodeErrorZ_err(e_conv);
21868         return tag_ptr(ret_conv, true);
21869 }
21870
21871 jboolean  __attribute__((export_name("TS_CResult_HTLCUpdateDecodeErrorZ_is_ok"))) TS_CResult_HTLCUpdateDecodeErrorZ_is_ok(uint64_t o) {
21872         LDKCResult_HTLCUpdateDecodeErrorZ* o_conv = (LDKCResult_HTLCUpdateDecodeErrorZ*)untag_ptr(o);
21873         jboolean ret_conv = CResult_HTLCUpdateDecodeErrorZ_is_ok(o_conv);
21874         return ret_conv;
21875 }
21876
21877 void  __attribute__((export_name("TS_CResult_HTLCUpdateDecodeErrorZ_free"))) TS_CResult_HTLCUpdateDecodeErrorZ_free(uint64_t _res) {
21878         if (!ptr_is_owned(_res)) return;
21879         void* _res_ptr = untag_ptr(_res);
21880         CHECK_ACCESS(_res_ptr);
21881         LDKCResult_HTLCUpdateDecodeErrorZ _res_conv = *(LDKCResult_HTLCUpdateDecodeErrorZ*)(_res_ptr);
21882         FREE(untag_ptr(_res));
21883         CResult_HTLCUpdateDecodeErrorZ_free(_res_conv);
21884 }
21885
21886 static inline uint64_t CResult_HTLCUpdateDecodeErrorZ_clone_ptr(LDKCResult_HTLCUpdateDecodeErrorZ *NONNULL_PTR arg) {
21887         LDKCResult_HTLCUpdateDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_HTLCUpdateDecodeErrorZ), "LDKCResult_HTLCUpdateDecodeErrorZ");
21888         *ret_conv = CResult_HTLCUpdateDecodeErrorZ_clone(arg);
21889         return tag_ptr(ret_conv, true);
21890 }
21891 int64_t  __attribute__((export_name("TS_CResult_HTLCUpdateDecodeErrorZ_clone_ptr"))) TS_CResult_HTLCUpdateDecodeErrorZ_clone_ptr(uint64_t arg) {
21892         LDKCResult_HTLCUpdateDecodeErrorZ* arg_conv = (LDKCResult_HTLCUpdateDecodeErrorZ*)untag_ptr(arg);
21893         int64_t ret_conv = CResult_HTLCUpdateDecodeErrorZ_clone_ptr(arg_conv);
21894         return ret_conv;
21895 }
21896
21897 uint64_t  __attribute__((export_name("TS_CResult_HTLCUpdateDecodeErrorZ_clone"))) TS_CResult_HTLCUpdateDecodeErrorZ_clone(uint64_t orig) {
21898         LDKCResult_HTLCUpdateDecodeErrorZ* orig_conv = (LDKCResult_HTLCUpdateDecodeErrorZ*)untag_ptr(orig);
21899         LDKCResult_HTLCUpdateDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_HTLCUpdateDecodeErrorZ), "LDKCResult_HTLCUpdateDecodeErrorZ");
21900         *ret_conv = CResult_HTLCUpdateDecodeErrorZ_clone(orig_conv);
21901         return tag_ptr(ret_conv, true);
21902 }
21903
21904 static inline uint64_t C2Tuple_OutPointCVec_u8ZZ_clone_ptr(LDKC2Tuple_OutPointCVec_u8ZZ *NONNULL_PTR arg) {
21905         LDKC2Tuple_OutPointCVec_u8ZZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_OutPointCVec_u8ZZ), "LDKC2Tuple_OutPointCVec_u8ZZ");
21906         *ret_conv = C2Tuple_OutPointCVec_u8ZZ_clone(arg);
21907         return tag_ptr(ret_conv, true);
21908 }
21909 int64_t  __attribute__((export_name("TS_C2Tuple_OutPointCVec_u8ZZ_clone_ptr"))) TS_C2Tuple_OutPointCVec_u8ZZ_clone_ptr(uint64_t arg) {
21910         LDKC2Tuple_OutPointCVec_u8ZZ* arg_conv = (LDKC2Tuple_OutPointCVec_u8ZZ*)untag_ptr(arg);
21911         int64_t ret_conv = C2Tuple_OutPointCVec_u8ZZ_clone_ptr(arg_conv);
21912         return ret_conv;
21913 }
21914
21915 uint64_t  __attribute__((export_name("TS_C2Tuple_OutPointCVec_u8ZZ_clone"))) TS_C2Tuple_OutPointCVec_u8ZZ_clone(uint64_t orig) {
21916         LDKC2Tuple_OutPointCVec_u8ZZ* orig_conv = (LDKC2Tuple_OutPointCVec_u8ZZ*)untag_ptr(orig);
21917         LDKC2Tuple_OutPointCVec_u8ZZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_OutPointCVec_u8ZZ), "LDKC2Tuple_OutPointCVec_u8ZZ");
21918         *ret_conv = C2Tuple_OutPointCVec_u8ZZ_clone(orig_conv);
21919         return tag_ptr(ret_conv, true);
21920 }
21921
21922 uint64_t  __attribute__((export_name("TS_C2Tuple_OutPointCVec_u8ZZ_new"))) TS_C2Tuple_OutPointCVec_u8ZZ_new(uint64_t a, int8_tArray b) {
21923         LDKOutPoint a_conv;
21924         a_conv.inner = untag_ptr(a);
21925         a_conv.is_owned = ptr_is_owned(a);
21926         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
21927         a_conv = OutPoint_clone(&a_conv);
21928         LDKCVec_u8Z b_ref;
21929         b_ref.datalen = b->arr_len;
21930         b_ref.data = MALLOC(b_ref.datalen, "LDKCVec_u8Z Bytes");
21931         memcpy(b_ref.data, b->elems, b_ref.datalen); FREE(b);
21932         LDKC2Tuple_OutPointCVec_u8ZZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_OutPointCVec_u8ZZ), "LDKC2Tuple_OutPointCVec_u8ZZ");
21933         *ret_conv = C2Tuple_OutPointCVec_u8ZZ_new(a_conv, b_ref);
21934         return tag_ptr(ret_conv, true);
21935 }
21936
21937 void  __attribute__((export_name("TS_C2Tuple_OutPointCVec_u8ZZ_free"))) TS_C2Tuple_OutPointCVec_u8ZZ_free(uint64_t _res) {
21938         if (!ptr_is_owned(_res)) return;
21939         void* _res_ptr = untag_ptr(_res);
21940         CHECK_ACCESS(_res_ptr);
21941         LDKC2Tuple_OutPointCVec_u8ZZ _res_conv = *(LDKC2Tuple_OutPointCVec_u8ZZ*)(_res_ptr);
21942         FREE(untag_ptr(_res));
21943         C2Tuple_OutPointCVec_u8ZZ_free(_res_conv);
21944 }
21945
21946 static inline uint64_t C2Tuple_u32CVec_u8ZZ_clone_ptr(LDKC2Tuple_u32CVec_u8ZZ *NONNULL_PTR arg) {
21947         LDKC2Tuple_u32CVec_u8ZZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_u32CVec_u8ZZ), "LDKC2Tuple_u32CVec_u8ZZ");
21948         *ret_conv = C2Tuple_u32CVec_u8ZZ_clone(arg);
21949         return tag_ptr(ret_conv, true);
21950 }
21951 int64_t  __attribute__((export_name("TS_C2Tuple_u32CVec_u8ZZ_clone_ptr"))) TS_C2Tuple_u32CVec_u8ZZ_clone_ptr(uint64_t arg) {
21952         LDKC2Tuple_u32CVec_u8ZZ* arg_conv = (LDKC2Tuple_u32CVec_u8ZZ*)untag_ptr(arg);
21953         int64_t ret_conv = C2Tuple_u32CVec_u8ZZ_clone_ptr(arg_conv);
21954         return ret_conv;
21955 }
21956
21957 uint64_t  __attribute__((export_name("TS_C2Tuple_u32CVec_u8ZZ_clone"))) TS_C2Tuple_u32CVec_u8ZZ_clone(uint64_t orig) {
21958         LDKC2Tuple_u32CVec_u8ZZ* orig_conv = (LDKC2Tuple_u32CVec_u8ZZ*)untag_ptr(orig);
21959         LDKC2Tuple_u32CVec_u8ZZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_u32CVec_u8ZZ), "LDKC2Tuple_u32CVec_u8ZZ");
21960         *ret_conv = C2Tuple_u32CVec_u8ZZ_clone(orig_conv);
21961         return tag_ptr(ret_conv, true);
21962 }
21963
21964 uint64_t  __attribute__((export_name("TS_C2Tuple_u32CVec_u8ZZ_new"))) TS_C2Tuple_u32CVec_u8ZZ_new(int32_t a, int8_tArray b) {
21965         LDKCVec_u8Z b_ref;
21966         b_ref.datalen = b->arr_len;
21967         b_ref.data = MALLOC(b_ref.datalen, "LDKCVec_u8Z Bytes");
21968         memcpy(b_ref.data, b->elems, b_ref.datalen); FREE(b);
21969         LDKC2Tuple_u32CVec_u8ZZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_u32CVec_u8ZZ), "LDKC2Tuple_u32CVec_u8ZZ");
21970         *ret_conv = C2Tuple_u32CVec_u8ZZ_new(a, b_ref);
21971         return tag_ptr(ret_conv, true);
21972 }
21973
21974 void  __attribute__((export_name("TS_C2Tuple_u32CVec_u8ZZ_free"))) TS_C2Tuple_u32CVec_u8ZZ_free(uint64_t _res) {
21975         if (!ptr_is_owned(_res)) return;
21976         void* _res_ptr = untag_ptr(_res);
21977         CHECK_ACCESS(_res_ptr);
21978         LDKC2Tuple_u32CVec_u8ZZ _res_conv = *(LDKC2Tuple_u32CVec_u8ZZ*)(_res_ptr);
21979         FREE(untag_ptr(_res));
21980         C2Tuple_u32CVec_u8ZZ_free(_res_conv);
21981 }
21982
21983 void  __attribute__((export_name("TS_CVec_C2Tuple_u32CVec_u8ZZZ_free"))) TS_CVec_C2Tuple_u32CVec_u8ZZZ_free(uint64_tArray _res) {
21984         LDKCVec_C2Tuple_u32CVec_u8ZZZ _res_constr;
21985         _res_constr.datalen = _res->arr_len;
21986         if (_res_constr.datalen > 0)
21987                 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKC2Tuple_u32CVec_u8ZZ), "LDKCVec_C2Tuple_u32CVec_u8ZZZ Elements");
21988         else
21989                 _res_constr.data = NULL;
21990         uint64_t* _res_vals = _res->elems;
21991         for (size_t x = 0; x < _res_constr.datalen; x++) {
21992                 uint64_t _res_conv_23 = _res_vals[x];
21993                 void* _res_conv_23_ptr = untag_ptr(_res_conv_23);
21994                 CHECK_ACCESS(_res_conv_23_ptr);
21995                 LDKC2Tuple_u32CVec_u8ZZ _res_conv_23_conv = *(LDKC2Tuple_u32CVec_u8ZZ*)(_res_conv_23_ptr);
21996                 FREE(untag_ptr(_res_conv_23));
21997                 _res_constr.data[x] = _res_conv_23_conv;
21998         }
21999         FREE(_res);
22000         CVec_C2Tuple_u32CVec_u8ZZZ_free(_res_constr);
22001 }
22002
22003 static inline uint64_t C2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32CVec_u8ZZZZ_clone_ptr(LDKC2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32CVec_u8ZZZZ *NONNULL_PTR arg) {
22004         LDKC2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32CVec_u8ZZZZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32CVec_u8ZZZZ), "LDKC2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32CVec_u8ZZZZ");
22005         *ret_conv = C2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32CVec_u8ZZZZ_clone(arg);
22006         return tag_ptr(ret_conv, true);
22007 }
22008 int64_t  __attribute__((export_name("TS_C2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32CVec_u8ZZZZ_clone_ptr"))) TS_C2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32CVec_u8ZZZZ_clone_ptr(uint64_t arg) {
22009         LDKC2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32CVec_u8ZZZZ* arg_conv = (LDKC2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32CVec_u8ZZZZ*)untag_ptr(arg);
22010         int64_t ret_conv = C2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32CVec_u8ZZZZ_clone_ptr(arg_conv);
22011         return ret_conv;
22012 }
22013
22014 uint64_t  __attribute__((export_name("TS_C2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32CVec_u8ZZZZ_clone"))) TS_C2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32CVec_u8ZZZZ_clone(uint64_t orig) {
22015         LDKC2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32CVec_u8ZZZZ* orig_conv = (LDKC2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32CVec_u8ZZZZ*)untag_ptr(orig);
22016         LDKC2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32CVec_u8ZZZZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32CVec_u8ZZZZ), "LDKC2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32CVec_u8ZZZZ");
22017         *ret_conv = C2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32CVec_u8ZZZZ_clone(orig_conv);
22018         return tag_ptr(ret_conv, true);
22019 }
22020
22021 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) {
22022         LDKThirtyTwoBytes a_ref;
22023         CHECK(a->arr_len == 32);
22024         memcpy(a_ref.data, a->elems, 32); FREE(a);
22025         LDKCVec_C2Tuple_u32CVec_u8ZZZ b_constr;
22026         b_constr.datalen = b->arr_len;
22027         if (b_constr.datalen > 0)
22028                 b_constr.data = MALLOC(b_constr.datalen * sizeof(LDKC2Tuple_u32CVec_u8ZZ), "LDKCVec_C2Tuple_u32CVec_u8ZZZ Elements");
22029         else
22030                 b_constr.data = NULL;
22031         uint64_t* b_vals = b->elems;
22032         for (size_t x = 0; x < b_constr.datalen; x++) {
22033                 uint64_t b_conv_23 = b_vals[x];
22034                 void* b_conv_23_ptr = untag_ptr(b_conv_23);
22035                 CHECK_ACCESS(b_conv_23_ptr);
22036                 LDKC2Tuple_u32CVec_u8ZZ b_conv_23_conv = *(LDKC2Tuple_u32CVec_u8ZZ*)(b_conv_23_ptr);
22037                 b_conv_23_conv = C2Tuple_u32CVec_u8ZZ_clone((LDKC2Tuple_u32CVec_u8ZZ*)untag_ptr(b_conv_23));
22038                 b_constr.data[x] = b_conv_23_conv;
22039         }
22040         FREE(b);
22041         LDKC2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32CVec_u8ZZZZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32CVec_u8ZZZZ), "LDKC2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32CVec_u8ZZZZ");
22042         *ret_conv = C2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32CVec_u8ZZZZ_new(a_ref, b_constr);
22043         return tag_ptr(ret_conv, true);
22044 }
22045
22046 void  __attribute__((export_name("TS_C2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32CVec_u8ZZZZ_free"))) TS_C2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32CVec_u8ZZZZ_free(uint64_t _res) {
22047         if (!ptr_is_owned(_res)) return;
22048         void* _res_ptr = untag_ptr(_res);
22049         CHECK_ACCESS(_res_ptr);
22050         LDKC2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32CVec_u8ZZZZ _res_conv = *(LDKC2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32CVec_u8ZZZZ*)(_res_ptr);
22051         FREE(untag_ptr(_res));
22052         C2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32CVec_u8ZZZZ_free(_res_conv);
22053 }
22054
22055 void  __attribute__((export_name("TS_CVec_C2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32CVec_u8ZZZZZ_free"))) TS_CVec_C2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32CVec_u8ZZZZZ_free(uint64_tArray _res) {
22056         LDKCVec_C2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32CVec_u8ZZZZZ _res_constr;
22057         _res_constr.datalen = _res->arr_len;
22058         if (_res_constr.datalen > 0)
22059                 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKC2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32CVec_u8ZZZZ), "LDKCVec_C2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32CVec_u8ZZZZZ Elements");
22060         else
22061                 _res_constr.data = NULL;
22062         uint64_t* _res_vals = _res->elems;
22063         for (size_t a = 0; a < _res_constr.datalen; a++) {
22064                 uint64_t _res_conv_52 = _res_vals[a];
22065                 void* _res_conv_52_ptr = untag_ptr(_res_conv_52);
22066                 CHECK_ACCESS(_res_conv_52_ptr);
22067                 LDKC2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32CVec_u8ZZZZ _res_conv_52_conv = *(LDKC2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32CVec_u8ZZZZ*)(_res_conv_52_ptr);
22068                 FREE(untag_ptr(_res_conv_52));
22069                 _res_constr.data[a] = _res_conv_52_conv;
22070         }
22071         FREE(_res);
22072         CVec_C2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32CVec_u8ZZZZZ_free(_res_constr);
22073 }
22074
22075 void  __attribute__((export_name("TS_CVec_CommitmentTransactionZ_free"))) TS_CVec_CommitmentTransactionZ_free(uint64_tArray _res) {
22076         LDKCVec_CommitmentTransactionZ _res_constr;
22077         _res_constr.datalen = _res->arr_len;
22078         if (_res_constr.datalen > 0)
22079                 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKCommitmentTransaction), "LDKCVec_CommitmentTransactionZ Elements");
22080         else
22081                 _res_constr.data = NULL;
22082         uint64_t* _res_vals = _res->elems;
22083         for (size_t x = 0; x < _res_constr.datalen; x++) {
22084                 uint64_t _res_conv_23 = _res_vals[x];
22085                 LDKCommitmentTransaction _res_conv_23_conv;
22086                 _res_conv_23_conv.inner = untag_ptr(_res_conv_23);
22087                 _res_conv_23_conv.is_owned = ptr_is_owned(_res_conv_23);
22088                 CHECK_INNER_FIELD_ACCESS_OR_NULL(_res_conv_23_conv);
22089                 _res_constr.data[x] = _res_conv_23_conv;
22090         }
22091         FREE(_res);
22092         CVec_CommitmentTransactionZ_free(_res_constr);
22093 }
22094
22095 void  __attribute__((export_name("TS_CVec_TransactionZ_free"))) TS_CVec_TransactionZ_free(ptrArray _res) {
22096         LDKCVec_TransactionZ _res_constr;
22097         _res_constr.datalen = _res->arr_len;
22098         if (_res_constr.datalen > 0)
22099                 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKTransaction), "LDKCVec_TransactionZ Elements");
22100         else
22101                 _res_constr.data = NULL;
22102         int8_tArray* _res_vals = (void*) _res->elems;
22103         for (size_t m = 0; m < _res_constr.datalen; m++) {
22104                 int8_tArray _res_conv_12 = _res_vals[m];
22105                 LDKTransaction _res_conv_12_ref;
22106                 _res_conv_12_ref.datalen = _res_conv_12->arr_len;
22107                 _res_conv_12_ref.data = MALLOC(_res_conv_12_ref.datalen, "LDKTransaction Bytes");
22108                 memcpy(_res_conv_12_ref.data, _res_conv_12->elems, _res_conv_12_ref.datalen); FREE(_res_conv_12);
22109                 _res_conv_12_ref.data_is_owned = true;
22110                 _res_constr.data[m] = _res_conv_12_ref;
22111         }
22112         FREE(_res);
22113         CVec_TransactionZ_free(_res_constr);
22114 }
22115
22116 static inline uint64_t C2Tuple_u32TxOutZ_clone_ptr(LDKC2Tuple_u32TxOutZ *NONNULL_PTR arg) {
22117         LDKC2Tuple_u32TxOutZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_u32TxOutZ), "LDKC2Tuple_u32TxOutZ");
22118         *ret_conv = C2Tuple_u32TxOutZ_clone(arg);
22119         return tag_ptr(ret_conv, true);
22120 }
22121 int64_t  __attribute__((export_name("TS_C2Tuple_u32TxOutZ_clone_ptr"))) TS_C2Tuple_u32TxOutZ_clone_ptr(uint64_t arg) {
22122         LDKC2Tuple_u32TxOutZ* arg_conv = (LDKC2Tuple_u32TxOutZ*)untag_ptr(arg);
22123         int64_t ret_conv = C2Tuple_u32TxOutZ_clone_ptr(arg_conv);
22124         return ret_conv;
22125 }
22126
22127 uint64_t  __attribute__((export_name("TS_C2Tuple_u32TxOutZ_clone"))) TS_C2Tuple_u32TxOutZ_clone(uint64_t orig) {
22128         LDKC2Tuple_u32TxOutZ* orig_conv = (LDKC2Tuple_u32TxOutZ*)untag_ptr(orig);
22129         LDKC2Tuple_u32TxOutZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_u32TxOutZ), "LDKC2Tuple_u32TxOutZ");
22130         *ret_conv = C2Tuple_u32TxOutZ_clone(orig_conv);
22131         return tag_ptr(ret_conv, true);
22132 }
22133
22134 uint64_t  __attribute__((export_name("TS_C2Tuple_u32TxOutZ_new"))) TS_C2Tuple_u32TxOutZ_new(int32_t a, uint64_t b) {
22135         void* b_ptr = untag_ptr(b);
22136         CHECK_ACCESS(b_ptr);
22137         LDKTxOut b_conv = *(LDKTxOut*)(b_ptr);
22138         b_conv = TxOut_clone((LDKTxOut*)untag_ptr(b));
22139         LDKC2Tuple_u32TxOutZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_u32TxOutZ), "LDKC2Tuple_u32TxOutZ");
22140         *ret_conv = C2Tuple_u32TxOutZ_new(a, b_conv);
22141         return tag_ptr(ret_conv, true);
22142 }
22143
22144 void  __attribute__((export_name("TS_C2Tuple_u32TxOutZ_free"))) TS_C2Tuple_u32TxOutZ_free(uint64_t _res) {
22145         if (!ptr_is_owned(_res)) return;
22146         void* _res_ptr = untag_ptr(_res);
22147         CHECK_ACCESS(_res_ptr);
22148         LDKC2Tuple_u32TxOutZ _res_conv = *(LDKC2Tuple_u32TxOutZ*)(_res_ptr);
22149         FREE(untag_ptr(_res));
22150         C2Tuple_u32TxOutZ_free(_res_conv);
22151 }
22152
22153 void  __attribute__((export_name("TS_CVec_C2Tuple_u32TxOutZZ_free"))) TS_CVec_C2Tuple_u32TxOutZZ_free(uint64_tArray _res) {
22154         LDKCVec_C2Tuple_u32TxOutZZ _res_constr;
22155         _res_constr.datalen = _res->arr_len;
22156         if (_res_constr.datalen > 0)
22157                 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKC2Tuple_u32TxOutZ), "LDKCVec_C2Tuple_u32TxOutZZ Elements");
22158         else
22159                 _res_constr.data = NULL;
22160         uint64_t* _res_vals = _res->elems;
22161         for (size_t u = 0; u < _res_constr.datalen; u++) {
22162                 uint64_t _res_conv_20 = _res_vals[u];
22163                 void* _res_conv_20_ptr = untag_ptr(_res_conv_20);
22164                 CHECK_ACCESS(_res_conv_20_ptr);
22165                 LDKC2Tuple_u32TxOutZ _res_conv_20_conv = *(LDKC2Tuple_u32TxOutZ*)(_res_conv_20_ptr);
22166                 FREE(untag_ptr(_res_conv_20));
22167                 _res_constr.data[u] = _res_conv_20_conv;
22168         }
22169         FREE(_res);
22170         CVec_C2Tuple_u32TxOutZZ_free(_res_constr);
22171 }
22172
22173 static inline uint64_t C2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32TxOutZZZ_clone_ptr(LDKC2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32TxOutZZZ *NONNULL_PTR arg) {
22174         LDKC2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32TxOutZZZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32TxOutZZZ), "LDKC2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32TxOutZZZ");
22175         *ret_conv = C2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32TxOutZZZ_clone(arg);
22176         return tag_ptr(ret_conv, true);
22177 }
22178 int64_t  __attribute__((export_name("TS_C2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32TxOutZZZ_clone_ptr"))) TS_C2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32TxOutZZZ_clone_ptr(uint64_t arg) {
22179         LDKC2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32TxOutZZZ* arg_conv = (LDKC2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32TxOutZZZ*)untag_ptr(arg);
22180         int64_t ret_conv = C2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32TxOutZZZ_clone_ptr(arg_conv);
22181         return ret_conv;
22182 }
22183
22184 uint64_t  __attribute__((export_name("TS_C2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32TxOutZZZ_clone"))) TS_C2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32TxOutZZZ_clone(uint64_t orig) {
22185         LDKC2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32TxOutZZZ* orig_conv = (LDKC2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32TxOutZZZ*)untag_ptr(orig);
22186         LDKC2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32TxOutZZZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32TxOutZZZ), "LDKC2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32TxOutZZZ");
22187         *ret_conv = C2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32TxOutZZZ_clone(orig_conv);
22188         return tag_ptr(ret_conv, true);
22189 }
22190
22191 uint64_t  __attribute__((export_name("TS_C2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32TxOutZZZ_new"))) TS_C2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32TxOutZZZ_new(int8_tArray a, uint64_tArray b) {
22192         LDKThirtyTwoBytes a_ref;
22193         CHECK(a->arr_len == 32);
22194         memcpy(a_ref.data, a->elems, 32); FREE(a);
22195         LDKCVec_C2Tuple_u32TxOutZZ b_constr;
22196         b_constr.datalen = b->arr_len;
22197         if (b_constr.datalen > 0)
22198                 b_constr.data = MALLOC(b_constr.datalen * sizeof(LDKC2Tuple_u32TxOutZ), "LDKCVec_C2Tuple_u32TxOutZZ Elements");
22199         else
22200                 b_constr.data = NULL;
22201         uint64_t* b_vals = b->elems;
22202         for (size_t u = 0; u < b_constr.datalen; u++) {
22203                 uint64_t b_conv_20 = b_vals[u];
22204                 void* b_conv_20_ptr = untag_ptr(b_conv_20);
22205                 CHECK_ACCESS(b_conv_20_ptr);
22206                 LDKC2Tuple_u32TxOutZ b_conv_20_conv = *(LDKC2Tuple_u32TxOutZ*)(b_conv_20_ptr);
22207                 b_conv_20_conv = C2Tuple_u32TxOutZ_clone((LDKC2Tuple_u32TxOutZ*)untag_ptr(b_conv_20));
22208                 b_constr.data[u] = b_conv_20_conv;
22209         }
22210         FREE(b);
22211         LDKC2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32TxOutZZZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32TxOutZZZ), "LDKC2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32TxOutZZZ");
22212         *ret_conv = C2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32TxOutZZZ_new(a_ref, b_constr);
22213         return tag_ptr(ret_conv, true);
22214 }
22215
22216 void  __attribute__((export_name("TS_C2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32TxOutZZZ_free"))) TS_C2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32TxOutZZZ_free(uint64_t _res) {
22217         if (!ptr_is_owned(_res)) return;
22218         void* _res_ptr = untag_ptr(_res);
22219         CHECK_ACCESS(_res_ptr);
22220         LDKC2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32TxOutZZZ _res_conv = *(LDKC2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32TxOutZZZ*)(_res_ptr);
22221         FREE(untag_ptr(_res));
22222         C2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32TxOutZZZ_free(_res_conv);
22223 }
22224
22225 void  __attribute__((export_name("TS_CVec_C2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32TxOutZZZZ_free"))) TS_CVec_C2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32TxOutZZZZ_free(uint64_tArray _res) {
22226         LDKCVec_C2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32TxOutZZZZ _res_constr;
22227         _res_constr.datalen = _res->arr_len;
22228         if (_res_constr.datalen > 0)
22229                 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKC2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32TxOutZZZ), "LDKCVec_C2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32TxOutZZZZ Elements");
22230         else
22231                 _res_constr.data = NULL;
22232         uint64_t* _res_vals = _res->elems;
22233         for (size_t x = 0; x < _res_constr.datalen; x++) {
22234                 uint64_t _res_conv_49 = _res_vals[x];
22235                 void* _res_conv_49_ptr = untag_ptr(_res_conv_49);
22236                 CHECK_ACCESS(_res_conv_49_ptr);
22237                 LDKC2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32TxOutZZZ _res_conv_49_conv = *(LDKC2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32TxOutZZZ*)(_res_conv_49_ptr);
22238                 FREE(untag_ptr(_res_conv_49));
22239                 _res_constr.data[x] = _res_conv_49_conv;
22240         }
22241         FREE(_res);
22242         CVec_C2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32TxOutZZZZ_free(_res_constr);
22243 }
22244
22245 void  __attribute__((export_name("TS_CVec_BalanceZ_free"))) TS_CVec_BalanceZ_free(uint64_tArray _res) {
22246         LDKCVec_BalanceZ _res_constr;
22247         _res_constr.datalen = _res->arr_len;
22248         if (_res_constr.datalen > 0)
22249                 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKBalance), "LDKCVec_BalanceZ Elements");
22250         else
22251                 _res_constr.data = NULL;
22252         uint64_t* _res_vals = _res->elems;
22253         for (size_t j = 0; j < _res_constr.datalen; j++) {
22254                 uint64_t _res_conv_9 = _res_vals[j];
22255                 void* _res_conv_9_ptr = untag_ptr(_res_conv_9);
22256                 CHECK_ACCESS(_res_conv_9_ptr);
22257                 LDKBalance _res_conv_9_conv = *(LDKBalance*)(_res_conv_9_ptr);
22258                 FREE(untag_ptr(_res_conv_9));
22259                 _res_constr.data[j] = _res_conv_9_conv;
22260         }
22261         FREE(_res);
22262         CVec_BalanceZ_free(_res_constr);
22263 }
22264
22265 static inline uint64_t C2Tuple_ThirtyTwoBytesChannelMonitorZ_clone_ptr(LDKC2Tuple_ThirtyTwoBytesChannelMonitorZ *NONNULL_PTR arg) {
22266         LDKC2Tuple_ThirtyTwoBytesChannelMonitorZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_ThirtyTwoBytesChannelMonitorZ), "LDKC2Tuple_ThirtyTwoBytesChannelMonitorZ");
22267         *ret_conv = C2Tuple_ThirtyTwoBytesChannelMonitorZ_clone(arg);
22268         return tag_ptr(ret_conv, true);
22269 }
22270 int64_t  __attribute__((export_name("TS_C2Tuple_ThirtyTwoBytesChannelMonitorZ_clone_ptr"))) TS_C2Tuple_ThirtyTwoBytesChannelMonitorZ_clone_ptr(uint64_t arg) {
22271         LDKC2Tuple_ThirtyTwoBytesChannelMonitorZ* arg_conv = (LDKC2Tuple_ThirtyTwoBytesChannelMonitorZ*)untag_ptr(arg);
22272         int64_t ret_conv = C2Tuple_ThirtyTwoBytesChannelMonitorZ_clone_ptr(arg_conv);
22273         return ret_conv;
22274 }
22275
22276 uint64_t  __attribute__((export_name("TS_C2Tuple_ThirtyTwoBytesChannelMonitorZ_clone"))) TS_C2Tuple_ThirtyTwoBytesChannelMonitorZ_clone(uint64_t orig) {
22277         LDKC2Tuple_ThirtyTwoBytesChannelMonitorZ* orig_conv = (LDKC2Tuple_ThirtyTwoBytesChannelMonitorZ*)untag_ptr(orig);
22278         LDKC2Tuple_ThirtyTwoBytesChannelMonitorZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_ThirtyTwoBytesChannelMonitorZ), "LDKC2Tuple_ThirtyTwoBytesChannelMonitorZ");
22279         *ret_conv = C2Tuple_ThirtyTwoBytesChannelMonitorZ_clone(orig_conv);
22280         return tag_ptr(ret_conv, true);
22281 }
22282
22283 uint64_t  __attribute__((export_name("TS_C2Tuple_ThirtyTwoBytesChannelMonitorZ_new"))) TS_C2Tuple_ThirtyTwoBytesChannelMonitorZ_new(int8_tArray a, uint64_t b) {
22284         LDKThirtyTwoBytes a_ref;
22285         CHECK(a->arr_len == 32);
22286         memcpy(a_ref.data, a->elems, 32); FREE(a);
22287         LDKChannelMonitor b_conv;
22288         b_conv.inner = untag_ptr(b);
22289         b_conv.is_owned = ptr_is_owned(b);
22290         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
22291         b_conv = ChannelMonitor_clone(&b_conv);
22292         LDKC2Tuple_ThirtyTwoBytesChannelMonitorZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_ThirtyTwoBytesChannelMonitorZ), "LDKC2Tuple_ThirtyTwoBytesChannelMonitorZ");
22293         *ret_conv = C2Tuple_ThirtyTwoBytesChannelMonitorZ_new(a_ref, b_conv);
22294         return tag_ptr(ret_conv, true);
22295 }
22296
22297 void  __attribute__((export_name("TS_C2Tuple_ThirtyTwoBytesChannelMonitorZ_free"))) TS_C2Tuple_ThirtyTwoBytesChannelMonitorZ_free(uint64_t _res) {
22298         if (!ptr_is_owned(_res)) return;
22299         void* _res_ptr = untag_ptr(_res);
22300         CHECK_ACCESS(_res_ptr);
22301         LDKC2Tuple_ThirtyTwoBytesChannelMonitorZ _res_conv = *(LDKC2Tuple_ThirtyTwoBytesChannelMonitorZ*)(_res_ptr);
22302         FREE(untag_ptr(_res));
22303         C2Tuple_ThirtyTwoBytesChannelMonitorZ_free(_res_conv);
22304 }
22305
22306 uint64_t  __attribute__((export_name("TS_CResult_C2Tuple_ThirtyTwoBytesChannelMonitorZDecodeErrorZ_ok"))) TS_CResult_C2Tuple_ThirtyTwoBytesChannelMonitorZDecodeErrorZ_ok(uint64_t o) {
22307         void* o_ptr = untag_ptr(o);
22308         CHECK_ACCESS(o_ptr);
22309         LDKC2Tuple_ThirtyTwoBytesChannelMonitorZ o_conv = *(LDKC2Tuple_ThirtyTwoBytesChannelMonitorZ*)(o_ptr);
22310         o_conv = C2Tuple_ThirtyTwoBytesChannelMonitorZ_clone((LDKC2Tuple_ThirtyTwoBytesChannelMonitorZ*)untag_ptr(o));
22311         LDKCResult_C2Tuple_ThirtyTwoBytesChannelMonitorZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_ThirtyTwoBytesChannelMonitorZDecodeErrorZ), "LDKCResult_C2Tuple_ThirtyTwoBytesChannelMonitorZDecodeErrorZ");
22312         *ret_conv = CResult_C2Tuple_ThirtyTwoBytesChannelMonitorZDecodeErrorZ_ok(o_conv);
22313         return tag_ptr(ret_conv, true);
22314 }
22315
22316 uint64_t  __attribute__((export_name("TS_CResult_C2Tuple_ThirtyTwoBytesChannelMonitorZDecodeErrorZ_err"))) TS_CResult_C2Tuple_ThirtyTwoBytesChannelMonitorZDecodeErrorZ_err(uint64_t e) {
22317         void* e_ptr = untag_ptr(e);
22318         CHECK_ACCESS(e_ptr);
22319         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
22320         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
22321         LDKCResult_C2Tuple_ThirtyTwoBytesChannelMonitorZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_ThirtyTwoBytesChannelMonitorZDecodeErrorZ), "LDKCResult_C2Tuple_ThirtyTwoBytesChannelMonitorZDecodeErrorZ");
22322         *ret_conv = CResult_C2Tuple_ThirtyTwoBytesChannelMonitorZDecodeErrorZ_err(e_conv);
22323         return tag_ptr(ret_conv, true);
22324 }
22325
22326 jboolean  __attribute__((export_name("TS_CResult_C2Tuple_ThirtyTwoBytesChannelMonitorZDecodeErrorZ_is_ok"))) TS_CResult_C2Tuple_ThirtyTwoBytesChannelMonitorZDecodeErrorZ_is_ok(uint64_t o) {
22327         LDKCResult_C2Tuple_ThirtyTwoBytesChannelMonitorZDecodeErrorZ* o_conv = (LDKCResult_C2Tuple_ThirtyTwoBytesChannelMonitorZDecodeErrorZ*)untag_ptr(o);
22328         jboolean ret_conv = CResult_C2Tuple_ThirtyTwoBytesChannelMonitorZDecodeErrorZ_is_ok(o_conv);
22329         return ret_conv;
22330 }
22331
22332 void  __attribute__((export_name("TS_CResult_C2Tuple_ThirtyTwoBytesChannelMonitorZDecodeErrorZ_free"))) TS_CResult_C2Tuple_ThirtyTwoBytesChannelMonitorZDecodeErrorZ_free(uint64_t _res) {
22333         if (!ptr_is_owned(_res)) return;
22334         void* _res_ptr = untag_ptr(_res);
22335         CHECK_ACCESS(_res_ptr);
22336         LDKCResult_C2Tuple_ThirtyTwoBytesChannelMonitorZDecodeErrorZ _res_conv = *(LDKCResult_C2Tuple_ThirtyTwoBytesChannelMonitorZDecodeErrorZ*)(_res_ptr);
22337         FREE(untag_ptr(_res));
22338         CResult_C2Tuple_ThirtyTwoBytesChannelMonitorZDecodeErrorZ_free(_res_conv);
22339 }
22340
22341 static inline uint64_t CResult_C2Tuple_ThirtyTwoBytesChannelMonitorZDecodeErrorZ_clone_ptr(LDKCResult_C2Tuple_ThirtyTwoBytesChannelMonitorZDecodeErrorZ *NONNULL_PTR arg) {
22342         LDKCResult_C2Tuple_ThirtyTwoBytesChannelMonitorZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_ThirtyTwoBytesChannelMonitorZDecodeErrorZ), "LDKCResult_C2Tuple_ThirtyTwoBytesChannelMonitorZDecodeErrorZ");
22343         *ret_conv = CResult_C2Tuple_ThirtyTwoBytesChannelMonitorZDecodeErrorZ_clone(arg);
22344         return tag_ptr(ret_conv, true);
22345 }
22346 int64_t  __attribute__((export_name("TS_CResult_C2Tuple_ThirtyTwoBytesChannelMonitorZDecodeErrorZ_clone_ptr"))) TS_CResult_C2Tuple_ThirtyTwoBytesChannelMonitorZDecodeErrorZ_clone_ptr(uint64_t arg) {
22347         LDKCResult_C2Tuple_ThirtyTwoBytesChannelMonitorZDecodeErrorZ* arg_conv = (LDKCResult_C2Tuple_ThirtyTwoBytesChannelMonitorZDecodeErrorZ*)untag_ptr(arg);
22348         int64_t ret_conv = CResult_C2Tuple_ThirtyTwoBytesChannelMonitorZDecodeErrorZ_clone_ptr(arg_conv);
22349         return ret_conv;
22350 }
22351
22352 uint64_t  __attribute__((export_name("TS_CResult_C2Tuple_ThirtyTwoBytesChannelMonitorZDecodeErrorZ_clone"))) TS_CResult_C2Tuple_ThirtyTwoBytesChannelMonitorZDecodeErrorZ_clone(uint64_t orig) {
22353         LDKCResult_C2Tuple_ThirtyTwoBytesChannelMonitorZDecodeErrorZ* orig_conv = (LDKCResult_C2Tuple_ThirtyTwoBytesChannelMonitorZDecodeErrorZ*)untag_ptr(orig);
22354         LDKCResult_C2Tuple_ThirtyTwoBytesChannelMonitorZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_ThirtyTwoBytesChannelMonitorZDecodeErrorZ), "LDKCResult_C2Tuple_ThirtyTwoBytesChannelMonitorZDecodeErrorZ");
22355         *ret_conv = CResult_C2Tuple_ThirtyTwoBytesChannelMonitorZDecodeErrorZ_clone(orig_conv);
22356         return tag_ptr(ret_conv, true);
22357 }
22358
22359 static inline uint64_t C2Tuple_PublicKeyTypeZ_clone_ptr(LDKC2Tuple_PublicKeyTypeZ *NONNULL_PTR arg) {
22360         LDKC2Tuple_PublicKeyTypeZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_PublicKeyTypeZ), "LDKC2Tuple_PublicKeyTypeZ");
22361         *ret_conv = C2Tuple_PublicKeyTypeZ_clone(arg);
22362         return tag_ptr(ret_conv, true);
22363 }
22364 int64_t  __attribute__((export_name("TS_C2Tuple_PublicKeyTypeZ_clone_ptr"))) TS_C2Tuple_PublicKeyTypeZ_clone_ptr(uint64_t arg) {
22365         LDKC2Tuple_PublicKeyTypeZ* arg_conv = (LDKC2Tuple_PublicKeyTypeZ*)untag_ptr(arg);
22366         int64_t ret_conv = C2Tuple_PublicKeyTypeZ_clone_ptr(arg_conv);
22367         return ret_conv;
22368 }
22369
22370 uint64_t  __attribute__((export_name("TS_C2Tuple_PublicKeyTypeZ_clone"))) TS_C2Tuple_PublicKeyTypeZ_clone(uint64_t orig) {
22371         LDKC2Tuple_PublicKeyTypeZ* orig_conv = (LDKC2Tuple_PublicKeyTypeZ*)untag_ptr(orig);
22372         LDKC2Tuple_PublicKeyTypeZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_PublicKeyTypeZ), "LDKC2Tuple_PublicKeyTypeZ");
22373         *ret_conv = C2Tuple_PublicKeyTypeZ_clone(orig_conv);
22374         return tag_ptr(ret_conv, true);
22375 }
22376
22377 uint64_t  __attribute__((export_name("TS_C2Tuple_PublicKeyTypeZ_new"))) TS_C2Tuple_PublicKeyTypeZ_new(int8_tArray a, uint64_t b) {
22378         LDKPublicKey a_ref;
22379         CHECK(a->arr_len == 33);
22380         memcpy(a_ref.compressed_form, a->elems, 33); FREE(a);
22381         void* b_ptr = untag_ptr(b);
22382         CHECK_ACCESS(b_ptr);
22383         LDKType b_conv = *(LDKType*)(b_ptr);
22384         if (b_conv.free == LDKType_JCalls_free) {
22385                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
22386                 LDKType_JCalls_cloned(&b_conv);
22387         }
22388         LDKC2Tuple_PublicKeyTypeZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_PublicKeyTypeZ), "LDKC2Tuple_PublicKeyTypeZ");
22389         *ret_conv = C2Tuple_PublicKeyTypeZ_new(a_ref, b_conv);
22390         return tag_ptr(ret_conv, true);
22391 }
22392
22393 void  __attribute__((export_name("TS_C2Tuple_PublicKeyTypeZ_free"))) TS_C2Tuple_PublicKeyTypeZ_free(uint64_t _res) {
22394         if (!ptr_is_owned(_res)) return;
22395         void* _res_ptr = untag_ptr(_res);
22396         CHECK_ACCESS(_res_ptr);
22397         LDKC2Tuple_PublicKeyTypeZ _res_conv = *(LDKC2Tuple_PublicKeyTypeZ*)(_res_ptr);
22398         FREE(untag_ptr(_res));
22399         C2Tuple_PublicKeyTypeZ_free(_res_conv);
22400 }
22401
22402 void  __attribute__((export_name("TS_CVec_C2Tuple_PublicKeyTypeZZ_free"))) TS_CVec_C2Tuple_PublicKeyTypeZZ_free(uint64_tArray _res) {
22403         LDKCVec_C2Tuple_PublicKeyTypeZZ _res_constr;
22404         _res_constr.datalen = _res->arr_len;
22405         if (_res_constr.datalen > 0)
22406                 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKC2Tuple_PublicKeyTypeZ), "LDKCVec_C2Tuple_PublicKeyTypeZZ Elements");
22407         else
22408                 _res_constr.data = NULL;
22409         uint64_t* _res_vals = _res->elems;
22410         for (size_t z = 0; z < _res_constr.datalen; z++) {
22411                 uint64_t _res_conv_25 = _res_vals[z];
22412                 void* _res_conv_25_ptr = untag_ptr(_res_conv_25);
22413                 CHECK_ACCESS(_res_conv_25_ptr);
22414                 LDKC2Tuple_PublicKeyTypeZ _res_conv_25_conv = *(LDKC2Tuple_PublicKeyTypeZ*)(_res_conv_25_ptr);
22415                 FREE(untag_ptr(_res_conv_25));
22416                 _res_constr.data[z] = _res_conv_25_conv;
22417         }
22418         FREE(_res);
22419         CVec_C2Tuple_PublicKeyTypeZZ_free(_res_constr);
22420 }
22421
22422 uint64_t  __attribute__((export_name("TS_COption_OnionMessageContentsZ_some"))) TS_COption_OnionMessageContentsZ_some(uint64_t o) {
22423         void* o_ptr = untag_ptr(o);
22424         CHECK_ACCESS(o_ptr);
22425         LDKOnionMessageContents o_conv = *(LDKOnionMessageContents*)(o_ptr);
22426         if (o_conv.free == LDKOnionMessageContents_JCalls_free) {
22427                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
22428                 LDKOnionMessageContents_JCalls_cloned(&o_conv);
22429         }
22430         LDKCOption_OnionMessageContentsZ *ret_copy = MALLOC(sizeof(LDKCOption_OnionMessageContentsZ), "LDKCOption_OnionMessageContentsZ");
22431         *ret_copy = COption_OnionMessageContentsZ_some(o_conv);
22432         uint64_t ret_ref = tag_ptr(ret_copy, true);
22433         return ret_ref;
22434 }
22435
22436 uint64_t  __attribute__((export_name("TS_COption_OnionMessageContentsZ_none"))) TS_COption_OnionMessageContentsZ_none() {
22437         LDKCOption_OnionMessageContentsZ *ret_copy = MALLOC(sizeof(LDKCOption_OnionMessageContentsZ), "LDKCOption_OnionMessageContentsZ");
22438         *ret_copy = COption_OnionMessageContentsZ_none();
22439         uint64_t ret_ref = tag_ptr(ret_copy, true);
22440         return ret_ref;
22441 }
22442
22443 void  __attribute__((export_name("TS_COption_OnionMessageContentsZ_free"))) TS_COption_OnionMessageContentsZ_free(uint64_t _res) {
22444         if (!ptr_is_owned(_res)) return;
22445         void* _res_ptr = untag_ptr(_res);
22446         CHECK_ACCESS(_res_ptr);
22447         LDKCOption_OnionMessageContentsZ _res_conv = *(LDKCOption_OnionMessageContentsZ*)(_res_ptr);
22448         FREE(untag_ptr(_res));
22449         COption_OnionMessageContentsZ_free(_res_conv);
22450 }
22451
22452 static inline uint64_t COption_OnionMessageContentsZ_clone_ptr(LDKCOption_OnionMessageContentsZ *NONNULL_PTR arg) {
22453         LDKCOption_OnionMessageContentsZ *ret_copy = MALLOC(sizeof(LDKCOption_OnionMessageContentsZ), "LDKCOption_OnionMessageContentsZ");
22454         *ret_copy = COption_OnionMessageContentsZ_clone(arg);
22455         uint64_t ret_ref = tag_ptr(ret_copy, true);
22456         return ret_ref;
22457 }
22458 int64_t  __attribute__((export_name("TS_COption_OnionMessageContentsZ_clone_ptr"))) TS_COption_OnionMessageContentsZ_clone_ptr(uint64_t arg) {
22459         LDKCOption_OnionMessageContentsZ* arg_conv = (LDKCOption_OnionMessageContentsZ*)untag_ptr(arg);
22460         int64_t ret_conv = COption_OnionMessageContentsZ_clone_ptr(arg_conv);
22461         return ret_conv;
22462 }
22463
22464 uint64_t  __attribute__((export_name("TS_COption_OnionMessageContentsZ_clone"))) TS_COption_OnionMessageContentsZ_clone(uint64_t orig) {
22465         LDKCOption_OnionMessageContentsZ* orig_conv = (LDKCOption_OnionMessageContentsZ*)untag_ptr(orig);
22466         LDKCOption_OnionMessageContentsZ *ret_copy = MALLOC(sizeof(LDKCOption_OnionMessageContentsZ), "LDKCOption_OnionMessageContentsZ");
22467         *ret_copy = COption_OnionMessageContentsZ_clone(orig_conv);
22468         uint64_t ret_ref = tag_ptr(ret_copy, true);
22469         return ret_ref;
22470 }
22471
22472 uint64_t  __attribute__((export_name("TS_CResult_COption_OnionMessageContentsZDecodeErrorZ_ok"))) TS_CResult_COption_OnionMessageContentsZDecodeErrorZ_ok(uint64_t o) {
22473         void* o_ptr = untag_ptr(o);
22474         CHECK_ACCESS(o_ptr);
22475         LDKCOption_OnionMessageContentsZ o_conv = *(LDKCOption_OnionMessageContentsZ*)(o_ptr);
22476         o_conv = COption_OnionMessageContentsZ_clone((LDKCOption_OnionMessageContentsZ*)untag_ptr(o));
22477         LDKCResult_COption_OnionMessageContentsZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_COption_OnionMessageContentsZDecodeErrorZ), "LDKCResult_COption_OnionMessageContentsZDecodeErrorZ");
22478         *ret_conv = CResult_COption_OnionMessageContentsZDecodeErrorZ_ok(o_conv);
22479         return tag_ptr(ret_conv, true);
22480 }
22481
22482 uint64_t  __attribute__((export_name("TS_CResult_COption_OnionMessageContentsZDecodeErrorZ_err"))) TS_CResult_COption_OnionMessageContentsZDecodeErrorZ_err(uint64_t e) {
22483         void* e_ptr = untag_ptr(e);
22484         CHECK_ACCESS(e_ptr);
22485         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
22486         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
22487         LDKCResult_COption_OnionMessageContentsZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_COption_OnionMessageContentsZDecodeErrorZ), "LDKCResult_COption_OnionMessageContentsZDecodeErrorZ");
22488         *ret_conv = CResult_COption_OnionMessageContentsZDecodeErrorZ_err(e_conv);
22489         return tag_ptr(ret_conv, true);
22490 }
22491
22492 jboolean  __attribute__((export_name("TS_CResult_COption_OnionMessageContentsZDecodeErrorZ_is_ok"))) TS_CResult_COption_OnionMessageContentsZDecodeErrorZ_is_ok(uint64_t o) {
22493         LDKCResult_COption_OnionMessageContentsZDecodeErrorZ* o_conv = (LDKCResult_COption_OnionMessageContentsZDecodeErrorZ*)untag_ptr(o);
22494         jboolean ret_conv = CResult_COption_OnionMessageContentsZDecodeErrorZ_is_ok(o_conv);
22495         return ret_conv;
22496 }
22497
22498 void  __attribute__((export_name("TS_CResult_COption_OnionMessageContentsZDecodeErrorZ_free"))) TS_CResult_COption_OnionMessageContentsZDecodeErrorZ_free(uint64_t _res) {
22499         if (!ptr_is_owned(_res)) return;
22500         void* _res_ptr = untag_ptr(_res);
22501         CHECK_ACCESS(_res_ptr);
22502         LDKCResult_COption_OnionMessageContentsZDecodeErrorZ _res_conv = *(LDKCResult_COption_OnionMessageContentsZDecodeErrorZ*)(_res_ptr);
22503         FREE(untag_ptr(_res));
22504         CResult_COption_OnionMessageContentsZDecodeErrorZ_free(_res_conv);
22505 }
22506
22507 static inline uint64_t CResult_COption_OnionMessageContentsZDecodeErrorZ_clone_ptr(LDKCResult_COption_OnionMessageContentsZDecodeErrorZ *NONNULL_PTR arg) {
22508         LDKCResult_COption_OnionMessageContentsZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_COption_OnionMessageContentsZDecodeErrorZ), "LDKCResult_COption_OnionMessageContentsZDecodeErrorZ");
22509         *ret_conv = CResult_COption_OnionMessageContentsZDecodeErrorZ_clone(arg);
22510         return tag_ptr(ret_conv, true);
22511 }
22512 int64_t  __attribute__((export_name("TS_CResult_COption_OnionMessageContentsZDecodeErrorZ_clone_ptr"))) TS_CResult_COption_OnionMessageContentsZDecodeErrorZ_clone_ptr(uint64_t arg) {
22513         LDKCResult_COption_OnionMessageContentsZDecodeErrorZ* arg_conv = (LDKCResult_COption_OnionMessageContentsZDecodeErrorZ*)untag_ptr(arg);
22514         int64_t ret_conv = CResult_COption_OnionMessageContentsZDecodeErrorZ_clone_ptr(arg_conv);
22515         return ret_conv;
22516 }
22517
22518 uint64_t  __attribute__((export_name("TS_CResult_COption_OnionMessageContentsZDecodeErrorZ_clone"))) TS_CResult_COption_OnionMessageContentsZDecodeErrorZ_clone(uint64_t orig) {
22519         LDKCResult_COption_OnionMessageContentsZDecodeErrorZ* orig_conv = (LDKCResult_COption_OnionMessageContentsZDecodeErrorZ*)untag_ptr(orig);
22520         LDKCResult_COption_OnionMessageContentsZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_COption_OnionMessageContentsZDecodeErrorZ), "LDKCResult_COption_OnionMessageContentsZDecodeErrorZ");
22521         *ret_conv = CResult_COption_OnionMessageContentsZDecodeErrorZ_clone(orig_conv);
22522         return tag_ptr(ret_conv, true);
22523 }
22524
22525 static inline uint64_t C3Tuple_OnionMessageContentsDestinationBlindedPathZ_clone_ptr(LDKC3Tuple_OnionMessageContentsDestinationBlindedPathZ *NONNULL_PTR arg) {
22526         LDKC3Tuple_OnionMessageContentsDestinationBlindedPathZ* ret_conv = MALLOC(sizeof(LDKC3Tuple_OnionMessageContentsDestinationBlindedPathZ), "LDKC3Tuple_OnionMessageContentsDestinationBlindedPathZ");
22527         *ret_conv = C3Tuple_OnionMessageContentsDestinationBlindedPathZ_clone(arg);
22528         return tag_ptr(ret_conv, true);
22529 }
22530 int64_t  __attribute__((export_name("TS_C3Tuple_OnionMessageContentsDestinationBlindedPathZ_clone_ptr"))) TS_C3Tuple_OnionMessageContentsDestinationBlindedPathZ_clone_ptr(uint64_t arg) {
22531         LDKC3Tuple_OnionMessageContentsDestinationBlindedPathZ* arg_conv = (LDKC3Tuple_OnionMessageContentsDestinationBlindedPathZ*)untag_ptr(arg);
22532         int64_t ret_conv = C3Tuple_OnionMessageContentsDestinationBlindedPathZ_clone_ptr(arg_conv);
22533         return ret_conv;
22534 }
22535
22536 uint64_t  __attribute__((export_name("TS_C3Tuple_OnionMessageContentsDestinationBlindedPathZ_clone"))) TS_C3Tuple_OnionMessageContentsDestinationBlindedPathZ_clone(uint64_t orig) {
22537         LDKC3Tuple_OnionMessageContentsDestinationBlindedPathZ* orig_conv = (LDKC3Tuple_OnionMessageContentsDestinationBlindedPathZ*)untag_ptr(orig);
22538         LDKC3Tuple_OnionMessageContentsDestinationBlindedPathZ* ret_conv = MALLOC(sizeof(LDKC3Tuple_OnionMessageContentsDestinationBlindedPathZ), "LDKC3Tuple_OnionMessageContentsDestinationBlindedPathZ");
22539         *ret_conv = C3Tuple_OnionMessageContentsDestinationBlindedPathZ_clone(orig_conv);
22540         return tag_ptr(ret_conv, true);
22541 }
22542
22543 uint64_t  __attribute__((export_name("TS_C3Tuple_OnionMessageContentsDestinationBlindedPathZ_new"))) TS_C3Tuple_OnionMessageContentsDestinationBlindedPathZ_new(uint64_t a, uint64_t b, uint64_t c) {
22544         void* a_ptr = untag_ptr(a);
22545         CHECK_ACCESS(a_ptr);
22546         LDKOnionMessageContents a_conv = *(LDKOnionMessageContents*)(a_ptr);
22547         if (a_conv.free == LDKOnionMessageContents_JCalls_free) {
22548                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
22549                 LDKOnionMessageContents_JCalls_cloned(&a_conv);
22550         }
22551         void* b_ptr = untag_ptr(b);
22552         CHECK_ACCESS(b_ptr);
22553         LDKDestination b_conv = *(LDKDestination*)(b_ptr);
22554         b_conv = Destination_clone((LDKDestination*)untag_ptr(b));
22555         LDKBlindedPath c_conv;
22556         c_conv.inner = untag_ptr(c);
22557         c_conv.is_owned = ptr_is_owned(c);
22558         CHECK_INNER_FIELD_ACCESS_OR_NULL(c_conv);
22559         c_conv = BlindedPath_clone(&c_conv);
22560         LDKC3Tuple_OnionMessageContentsDestinationBlindedPathZ* ret_conv = MALLOC(sizeof(LDKC3Tuple_OnionMessageContentsDestinationBlindedPathZ), "LDKC3Tuple_OnionMessageContentsDestinationBlindedPathZ");
22561         *ret_conv = C3Tuple_OnionMessageContentsDestinationBlindedPathZ_new(a_conv, b_conv, c_conv);
22562         return tag_ptr(ret_conv, true);
22563 }
22564
22565 void  __attribute__((export_name("TS_C3Tuple_OnionMessageContentsDestinationBlindedPathZ_free"))) TS_C3Tuple_OnionMessageContentsDestinationBlindedPathZ_free(uint64_t _res) {
22566         if (!ptr_is_owned(_res)) return;
22567         void* _res_ptr = untag_ptr(_res);
22568         CHECK_ACCESS(_res_ptr);
22569         LDKC3Tuple_OnionMessageContentsDestinationBlindedPathZ _res_conv = *(LDKC3Tuple_OnionMessageContentsDestinationBlindedPathZ*)(_res_ptr);
22570         FREE(untag_ptr(_res));
22571         C3Tuple_OnionMessageContentsDestinationBlindedPathZ_free(_res_conv);
22572 }
22573
22574 void  __attribute__((export_name("TS_CVec_C3Tuple_OnionMessageContentsDestinationBlindedPathZZ_free"))) TS_CVec_C3Tuple_OnionMessageContentsDestinationBlindedPathZZ_free(uint64_tArray _res) {
22575         LDKCVec_C3Tuple_OnionMessageContentsDestinationBlindedPathZZ _res_constr;
22576         _res_constr.datalen = _res->arr_len;
22577         if (_res_constr.datalen > 0)
22578                 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKC3Tuple_OnionMessageContentsDestinationBlindedPathZ), "LDKCVec_C3Tuple_OnionMessageContentsDestinationBlindedPathZZ Elements");
22579         else
22580                 _res_constr.data = NULL;
22581         uint64_t* _res_vals = _res->elems;
22582         for (size_t e = 0; e < _res_constr.datalen; e++) {
22583                 uint64_t _res_conv_56 = _res_vals[e];
22584                 void* _res_conv_56_ptr = untag_ptr(_res_conv_56);
22585                 CHECK_ACCESS(_res_conv_56_ptr);
22586                 LDKC3Tuple_OnionMessageContentsDestinationBlindedPathZ _res_conv_56_conv = *(LDKC3Tuple_OnionMessageContentsDestinationBlindedPathZ*)(_res_conv_56_ptr);
22587                 FREE(untag_ptr(_res_conv_56));
22588                 _res_constr.data[e] = _res_conv_56_conv;
22589         }
22590         FREE(_res);
22591         CVec_C3Tuple_OnionMessageContentsDestinationBlindedPathZZ_free(_res_constr);
22592 }
22593
22594 uint64_t  __attribute__((export_name("TS_COption_TypeZ_some"))) TS_COption_TypeZ_some(uint64_t o) {
22595         void* o_ptr = untag_ptr(o);
22596         CHECK_ACCESS(o_ptr);
22597         LDKType o_conv = *(LDKType*)(o_ptr);
22598         if (o_conv.free == LDKType_JCalls_free) {
22599                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
22600                 LDKType_JCalls_cloned(&o_conv);
22601         }
22602         LDKCOption_TypeZ *ret_copy = MALLOC(sizeof(LDKCOption_TypeZ), "LDKCOption_TypeZ");
22603         *ret_copy = COption_TypeZ_some(o_conv);
22604         uint64_t ret_ref = tag_ptr(ret_copy, true);
22605         return ret_ref;
22606 }
22607
22608 uint64_t  __attribute__((export_name("TS_COption_TypeZ_none"))) TS_COption_TypeZ_none() {
22609         LDKCOption_TypeZ *ret_copy = MALLOC(sizeof(LDKCOption_TypeZ), "LDKCOption_TypeZ");
22610         *ret_copy = COption_TypeZ_none();
22611         uint64_t ret_ref = tag_ptr(ret_copy, true);
22612         return ret_ref;
22613 }
22614
22615 void  __attribute__((export_name("TS_COption_TypeZ_free"))) TS_COption_TypeZ_free(uint64_t _res) {
22616         if (!ptr_is_owned(_res)) return;
22617         void* _res_ptr = untag_ptr(_res);
22618         CHECK_ACCESS(_res_ptr);
22619         LDKCOption_TypeZ _res_conv = *(LDKCOption_TypeZ*)(_res_ptr);
22620         FREE(untag_ptr(_res));
22621         COption_TypeZ_free(_res_conv);
22622 }
22623
22624 static inline uint64_t COption_TypeZ_clone_ptr(LDKCOption_TypeZ *NONNULL_PTR arg) {
22625         LDKCOption_TypeZ *ret_copy = MALLOC(sizeof(LDKCOption_TypeZ), "LDKCOption_TypeZ");
22626         *ret_copy = COption_TypeZ_clone(arg);
22627         uint64_t ret_ref = tag_ptr(ret_copy, true);
22628         return ret_ref;
22629 }
22630 int64_t  __attribute__((export_name("TS_COption_TypeZ_clone_ptr"))) TS_COption_TypeZ_clone_ptr(uint64_t arg) {
22631         LDKCOption_TypeZ* arg_conv = (LDKCOption_TypeZ*)untag_ptr(arg);
22632         int64_t ret_conv = COption_TypeZ_clone_ptr(arg_conv);
22633         return ret_conv;
22634 }
22635
22636 uint64_t  __attribute__((export_name("TS_COption_TypeZ_clone"))) TS_COption_TypeZ_clone(uint64_t orig) {
22637         LDKCOption_TypeZ* orig_conv = (LDKCOption_TypeZ*)untag_ptr(orig);
22638         LDKCOption_TypeZ *ret_copy = MALLOC(sizeof(LDKCOption_TypeZ), "LDKCOption_TypeZ");
22639         *ret_copy = COption_TypeZ_clone(orig_conv);
22640         uint64_t ret_ref = tag_ptr(ret_copy, true);
22641         return ret_ref;
22642 }
22643
22644 uint64_t  __attribute__((export_name("TS_CResult_COption_TypeZDecodeErrorZ_ok"))) TS_CResult_COption_TypeZDecodeErrorZ_ok(uint64_t o) {
22645         void* o_ptr = untag_ptr(o);
22646         CHECK_ACCESS(o_ptr);
22647         LDKCOption_TypeZ o_conv = *(LDKCOption_TypeZ*)(o_ptr);
22648         o_conv = COption_TypeZ_clone((LDKCOption_TypeZ*)untag_ptr(o));
22649         LDKCResult_COption_TypeZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_COption_TypeZDecodeErrorZ), "LDKCResult_COption_TypeZDecodeErrorZ");
22650         *ret_conv = CResult_COption_TypeZDecodeErrorZ_ok(o_conv);
22651         return tag_ptr(ret_conv, true);
22652 }
22653
22654 uint64_t  __attribute__((export_name("TS_CResult_COption_TypeZDecodeErrorZ_err"))) TS_CResult_COption_TypeZDecodeErrorZ_err(uint64_t e) {
22655         void* e_ptr = untag_ptr(e);
22656         CHECK_ACCESS(e_ptr);
22657         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
22658         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
22659         LDKCResult_COption_TypeZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_COption_TypeZDecodeErrorZ), "LDKCResult_COption_TypeZDecodeErrorZ");
22660         *ret_conv = CResult_COption_TypeZDecodeErrorZ_err(e_conv);
22661         return tag_ptr(ret_conv, true);
22662 }
22663
22664 jboolean  __attribute__((export_name("TS_CResult_COption_TypeZDecodeErrorZ_is_ok"))) TS_CResult_COption_TypeZDecodeErrorZ_is_ok(uint64_t o) {
22665         LDKCResult_COption_TypeZDecodeErrorZ* o_conv = (LDKCResult_COption_TypeZDecodeErrorZ*)untag_ptr(o);
22666         jboolean ret_conv = CResult_COption_TypeZDecodeErrorZ_is_ok(o_conv);
22667         return ret_conv;
22668 }
22669
22670 void  __attribute__((export_name("TS_CResult_COption_TypeZDecodeErrorZ_free"))) TS_CResult_COption_TypeZDecodeErrorZ_free(uint64_t _res) {
22671         if (!ptr_is_owned(_res)) return;
22672         void* _res_ptr = untag_ptr(_res);
22673         CHECK_ACCESS(_res_ptr);
22674         LDKCResult_COption_TypeZDecodeErrorZ _res_conv = *(LDKCResult_COption_TypeZDecodeErrorZ*)(_res_ptr);
22675         FREE(untag_ptr(_res));
22676         CResult_COption_TypeZDecodeErrorZ_free(_res_conv);
22677 }
22678
22679 static inline uint64_t CResult_COption_TypeZDecodeErrorZ_clone_ptr(LDKCResult_COption_TypeZDecodeErrorZ *NONNULL_PTR arg) {
22680         LDKCResult_COption_TypeZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_COption_TypeZDecodeErrorZ), "LDKCResult_COption_TypeZDecodeErrorZ");
22681         *ret_conv = CResult_COption_TypeZDecodeErrorZ_clone(arg);
22682         return tag_ptr(ret_conv, true);
22683 }
22684 int64_t  __attribute__((export_name("TS_CResult_COption_TypeZDecodeErrorZ_clone_ptr"))) TS_CResult_COption_TypeZDecodeErrorZ_clone_ptr(uint64_t arg) {
22685         LDKCResult_COption_TypeZDecodeErrorZ* arg_conv = (LDKCResult_COption_TypeZDecodeErrorZ*)untag_ptr(arg);
22686         int64_t ret_conv = CResult_COption_TypeZDecodeErrorZ_clone_ptr(arg_conv);
22687         return ret_conv;
22688 }
22689
22690 uint64_t  __attribute__((export_name("TS_CResult_COption_TypeZDecodeErrorZ_clone"))) TS_CResult_COption_TypeZDecodeErrorZ_clone(uint64_t orig) {
22691         LDKCResult_COption_TypeZDecodeErrorZ* orig_conv = (LDKCResult_COption_TypeZDecodeErrorZ*)untag_ptr(orig);
22692         LDKCResult_COption_TypeZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_COption_TypeZDecodeErrorZ), "LDKCResult_COption_TypeZDecodeErrorZ");
22693         *ret_conv = CResult_COption_TypeZDecodeErrorZ_clone(orig_conv);
22694         return tag_ptr(ret_conv, true);
22695 }
22696
22697 uint64_t  __attribute__((export_name("TS_COption_SocketAddressZ_some"))) TS_COption_SocketAddressZ_some(uint64_t o) {
22698         void* o_ptr = untag_ptr(o);
22699         CHECK_ACCESS(o_ptr);
22700         LDKSocketAddress o_conv = *(LDKSocketAddress*)(o_ptr);
22701         o_conv = SocketAddress_clone((LDKSocketAddress*)untag_ptr(o));
22702         LDKCOption_SocketAddressZ *ret_copy = MALLOC(sizeof(LDKCOption_SocketAddressZ), "LDKCOption_SocketAddressZ");
22703         *ret_copy = COption_SocketAddressZ_some(o_conv);
22704         uint64_t ret_ref = tag_ptr(ret_copy, true);
22705         return ret_ref;
22706 }
22707
22708 uint64_t  __attribute__((export_name("TS_COption_SocketAddressZ_none"))) TS_COption_SocketAddressZ_none() {
22709         LDKCOption_SocketAddressZ *ret_copy = MALLOC(sizeof(LDKCOption_SocketAddressZ), "LDKCOption_SocketAddressZ");
22710         *ret_copy = COption_SocketAddressZ_none();
22711         uint64_t ret_ref = tag_ptr(ret_copy, true);
22712         return ret_ref;
22713 }
22714
22715 void  __attribute__((export_name("TS_COption_SocketAddressZ_free"))) TS_COption_SocketAddressZ_free(uint64_t _res) {
22716         if (!ptr_is_owned(_res)) return;
22717         void* _res_ptr = untag_ptr(_res);
22718         CHECK_ACCESS(_res_ptr);
22719         LDKCOption_SocketAddressZ _res_conv = *(LDKCOption_SocketAddressZ*)(_res_ptr);
22720         FREE(untag_ptr(_res));
22721         COption_SocketAddressZ_free(_res_conv);
22722 }
22723
22724 static inline uint64_t COption_SocketAddressZ_clone_ptr(LDKCOption_SocketAddressZ *NONNULL_PTR arg) {
22725         LDKCOption_SocketAddressZ *ret_copy = MALLOC(sizeof(LDKCOption_SocketAddressZ), "LDKCOption_SocketAddressZ");
22726         *ret_copy = COption_SocketAddressZ_clone(arg);
22727         uint64_t ret_ref = tag_ptr(ret_copy, true);
22728         return ret_ref;
22729 }
22730 int64_t  __attribute__((export_name("TS_COption_SocketAddressZ_clone_ptr"))) TS_COption_SocketAddressZ_clone_ptr(uint64_t arg) {
22731         LDKCOption_SocketAddressZ* arg_conv = (LDKCOption_SocketAddressZ*)untag_ptr(arg);
22732         int64_t ret_conv = COption_SocketAddressZ_clone_ptr(arg_conv);
22733         return ret_conv;
22734 }
22735
22736 uint64_t  __attribute__((export_name("TS_COption_SocketAddressZ_clone"))) TS_COption_SocketAddressZ_clone(uint64_t orig) {
22737         LDKCOption_SocketAddressZ* orig_conv = (LDKCOption_SocketAddressZ*)untag_ptr(orig);
22738         LDKCOption_SocketAddressZ *ret_copy = MALLOC(sizeof(LDKCOption_SocketAddressZ), "LDKCOption_SocketAddressZ");
22739         *ret_copy = COption_SocketAddressZ_clone(orig_conv);
22740         uint64_t ret_ref = tag_ptr(ret_copy, true);
22741         return ret_ref;
22742 }
22743
22744 static inline uint64_t C2Tuple_PublicKeyCOption_SocketAddressZZ_clone_ptr(LDKC2Tuple_PublicKeyCOption_SocketAddressZZ *NONNULL_PTR arg) {
22745         LDKC2Tuple_PublicKeyCOption_SocketAddressZZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_PublicKeyCOption_SocketAddressZZ), "LDKC2Tuple_PublicKeyCOption_SocketAddressZZ");
22746         *ret_conv = C2Tuple_PublicKeyCOption_SocketAddressZZ_clone(arg);
22747         return tag_ptr(ret_conv, true);
22748 }
22749 int64_t  __attribute__((export_name("TS_C2Tuple_PublicKeyCOption_SocketAddressZZ_clone_ptr"))) TS_C2Tuple_PublicKeyCOption_SocketAddressZZ_clone_ptr(uint64_t arg) {
22750         LDKC2Tuple_PublicKeyCOption_SocketAddressZZ* arg_conv = (LDKC2Tuple_PublicKeyCOption_SocketAddressZZ*)untag_ptr(arg);
22751         int64_t ret_conv = C2Tuple_PublicKeyCOption_SocketAddressZZ_clone_ptr(arg_conv);
22752         return ret_conv;
22753 }
22754
22755 uint64_t  __attribute__((export_name("TS_C2Tuple_PublicKeyCOption_SocketAddressZZ_clone"))) TS_C2Tuple_PublicKeyCOption_SocketAddressZZ_clone(uint64_t orig) {
22756         LDKC2Tuple_PublicKeyCOption_SocketAddressZZ* orig_conv = (LDKC2Tuple_PublicKeyCOption_SocketAddressZZ*)untag_ptr(orig);
22757         LDKC2Tuple_PublicKeyCOption_SocketAddressZZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_PublicKeyCOption_SocketAddressZZ), "LDKC2Tuple_PublicKeyCOption_SocketAddressZZ");
22758         *ret_conv = C2Tuple_PublicKeyCOption_SocketAddressZZ_clone(orig_conv);
22759         return tag_ptr(ret_conv, true);
22760 }
22761
22762 uint64_t  __attribute__((export_name("TS_C2Tuple_PublicKeyCOption_SocketAddressZZ_new"))) TS_C2Tuple_PublicKeyCOption_SocketAddressZZ_new(int8_tArray a, uint64_t b) {
22763         LDKPublicKey a_ref;
22764         CHECK(a->arr_len == 33);
22765         memcpy(a_ref.compressed_form, a->elems, 33); FREE(a);
22766         void* b_ptr = untag_ptr(b);
22767         CHECK_ACCESS(b_ptr);
22768         LDKCOption_SocketAddressZ b_conv = *(LDKCOption_SocketAddressZ*)(b_ptr);
22769         b_conv = COption_SocketAddressZ_clone((LDKCOption_SocketAddressZ*)untag_ptr(b));
22770         LDKC2Tuple_PublicKeyCOption_SocketAddressZZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_PublicKeyCOption_SocketAddressZZ), "LDKC2Tuple_PublicKeyCOption_SocketAddressZZ");
22771         *ret_conv = C2Tuple_PublicKeyCOption_SocketAddressZZ_new(a_ref, b_conv);
22772         return tag_ptr(ret_conv, true);
22773 }
22774
22775 void  __attribute__((export_name("TS_C2Tuple_PublicKeyCOption_SocketAddressZZ_free"))) TS_C2Tuple_PublicKeyCOption_SocketAddressZZ_free(uint64_t _res) {
22776         if (!ptr_is_owned(_res)) return;
22777         void* _res_ptr = untag_ptr(_res);
22778         CHECK_ACCESS(_res_ptr);
22779         LDKC2Tuple_PublicKeyCOption_SocketAddressZZ _res_conv = *(LDKC2Tuple_PublicKeyCOption_SocketAddressZZ*)(_res_ptr);
22780         FREE(untag_ptr(_res));
22781         C2Tuple_PublicKeyCOption_SocketAddressZZ_free(_res_conv);
22782 }
22783
22784 void  __attribute__((export_name("TS_CVec_C2Tuple_PublicKeyCOption_SocketAddressZZZ_free"))) TS_CVec_C2Tuple_PublicKeyCOption_SocketAddressZZZ_free(uint64_tArray _res) {
22785         LDKCVec_C2Tuple_PublicKeyCOption_SocketAddressZZZ _res_constr;
22786         _res_constr.datalen = _res->arr_len;
22787         if (_res_constr.datalen > 0)
22788                 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKC2Tuple_PublicKeyCOption_SocketAddressZZ), "LDKCVec_C2Tuple_PublicKeyCOption_SocketAddressZZZ Elements");
22789         else
22790                 _res_constr.data = NULL;
22791         uint64_t* _res_vals = _res->elems;
22792         for (size_t r = 0; r < _res_constr.datalen; r++) {
22793                 uint64_t _res_conv_43 = _res_vals[r];
22794                 void* _res_conv_43_ptr = untag_ptr(_res_conv_43);
22795                 CHECK_ACCESS(_res_conv_43_ptr);
22796                 LDKC2Tuple_PublicKeyCOption_SocketAddressZZ _res_conv_43_conv = *(LDKC2Tuple_PublicKeyCOption_SocketAddressZZ*)(_res_conv_43_ptr);
22797                 FREE(untag_ptr(_res_conv_43));
22798                 _res_constr.data[r] = _res_conv_43_conv;
22799         }
22800         FREE(_res);
22801         CVec_C2Tuple_PublicKeyCOption_SocketAddressZZZ_free(_res_constr);
22802 }
22803
22804 uint64_t  __attribute__((export_name("TS_CResult_CVec_u8ZPeerHandleErrorZ_ok"))) TS_CResult_CVec_u8ZPeerHandleErrorZ_ok(int8_tArray o) {
22805         LDKCVec_u8Z o_ref;
22806         o_ref.datalen = o->arr_len;
22807         o_ref.data = MALLOC(o_ref.datalen, "LDKCVec_u8Z Bytes");
22808         memcpy(o_ref.data, o->elems, o_ref.datalen); FREE(o);
22809         LDKCResult_CVec_u8ZPeerHandleErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_u8ZPeerHandleErrorZ), "LDKCResult_CVec_u8ZPeerHandleErrorZ");
22810         *ret_conv = CResult_CVec_u8ZPeerHandleErrorZ_ok(o_ref);
22811         return tag_ptr(ret_conv, true);
22812 }
22813
22814 uint64_t  __attribute__((export_name("TS_CResult_CVec_u8ZPeerHandleErrorZ_err"))) TS_CResult_CVec_u8ZPeerHandleErrorZ_err(uint64_t e) {
22815         LDKPeerHandleError e_conv;
22816         e_conv.inner = untag_ptr(e);
22817         e_conv.is_owned = ptr_is_owned(e);
22818         CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
22819         e_conv = PeerHandleError_clone(&e_conv);
22820         LDKCResult_CVec_u8ZPeerHandleErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_u8ZPeerHandleErrorZ), "LDKCResult_CVec_u8ZPeerHandleErrorZ");
22821         *ret_conv = CResult_CVec_u8ZPeerHandleErrorZ_err(e_conv);
22822         return tag_ptr(ret_conv, true);
22823 }
22824
22825 jboolean  __attribute__((export_name("TS_CResult_CVec_u8ZPeerHandleErrorZ_is_ok"))) TS_CResult_CVec_u8ZPeerHandleErrorZ_is_ok(uint64_t o) {
22826         LDKCResult_CVec_u8ZPeerHandleErrorZ* o_conv = (LDKCResult_CVec_u8ZPeerHandleErrorZ*)untag_ptr(o);
22827         jboolean ret_conv = CResult_CVec_u8ZPeerHandleErrorZ_is_ok(o_conv);
22828         return ret_conv;
22829 }
22830
22831 void  __attribute__((export_name("TS_CResult_CVec_u8ZPeerHandleErrorZ_free"))) TS_CResult_CVec_u8ZPeerHandleErrorZ_free(uint64_t _res) {
22832         if (!ptr_is_owned(_res)) return;
22833         void* _res_ptr = untag_ptr(_res);
22834         CHECK_ACCESS(_res_ptr);
22835         LDKCResult_CVec_u8ZPeerHandleErrorZ _res_conv = *(LDKCResult_CVec_u8ZPeerHandleErrorZ*)(_res_ptr);
22836         FREE(untag_ptr(_res));
22837         CResult_CVec_u8ZPeerHandleErrorZ_free(_res_conv);
22838 }
22839
22840 static inline uint64_t CResult_CVec_u8ZPeerHandleErrorZ_clone_ptr(LDKCResult_CVec_u8ZPeerHandleErrorZ *NONNULL_PTR arg) {
22841         LDKCResult_CVec_u8ZPeerHandleErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_u8ZPeerHandleErrorZ), "LDKCResult_CVec_u8ZPeerHandleErrorZ");
22842         *ret_conv = CResult_CVec_u8ZPeerHandleErrorZ_clone(arg);
22843         return tag_ptr(ret_conv, true);
22844 }
22845 int64_t  __attribute__((export_name("TS_CResult_CVec_u8ZPeerHandleErrorZ_clone_ptr"))) TS_CResult_CVec_u8ZPeerHandleErrorZ_clone_ptr(uint64_t arg) {
22846         LDKCResult_CVec_u8ZPeerHandleErrorZ* arg_conv = (LDKCResult_CVec_u8ZPeerHandleErrorZ*)untag_ptr(arg);
22847         int64_t ret_conv = CResult_CVec_u8ZPeerHandleErrorZ_clone_ptr(arg_conv);
22848         return ret_conv;
22849 }
22850
22851 uint64_t  __attribute__((export_name("TS_CResult_CVec_u8ZPeerHandleErrorZ_clone"))) TS_CResult_CVec_u8ZPeerHandleErrorZ_clone(uint64_t orig) {
22852         LDKCResult_CVec_u8ZPeerHandleErrorZ* orig_conv = (LDKCResult_CVec_u8ZPeerHandleErrorZ*)untag_ptr(orig);
22853         LDKCResult_CVec_u8ZPeerHandleErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_u8ZPeerHandleErrorZ), "LDKCResult_CVec_u8ZPeerHandleErrorZ");
22854         *ret_conv = CResult_CVec_u8ZPeerHandleErrorZ_clone(orig_conv);
22855         return tag_ptr(ret_conv, true);
22856 }
22857
22858 uint64_t  __attribute__((export_name("TS_CResult_NonePeerHandleErrorZ_ok"))) TS_CResult_NonePeerHandleErrorZ_ok() {
22859         LDKCResult_NonePeerHandleErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NonePeerHandleErrorZ), "LDKCResult_NonePeerHandleErrorZ");
22860         *ret_conv = CResult_NonePeerHandleErrorZ_ok();
22861         return tag_ptr(ret_conv, true);
22862 }
22863
22864 uint64_t  __attribute__((export_name("TS_CResult_NonePeerHandleErrorZ_err"))) TS_CResult_NonePeerHandleErrorZ_err(uint64_t e) {
22865         LDKPeerHandleError e_conv;
22866         e_conv.inner = untag_ptr(e);
22867         e_conv.is_owned = ptr_is_owned(e);
22868         CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
22869         e_conv = PeerHandleError_clone(&e_conv);
22870         LDKCResult_NonePeerHandleErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NonePeerHandleErrorZ), "LDKCResult_NonePeerHandleErrorZ");
22871         *ret_conv = CResult_NonePeerHandleErrorZ_err(e_conv);
22872         return tag_ptr(ret_conv, true);
22873 }
22874
22875 jboolean  __attribute__((export_name("TS_CResult_NonePeerHandleErrorZ_is_ok"))) TS_CResult_NonePeerHandleErrorZ_is_ok(uint64_t o) {
22876         LDKCResult_NonePeerHandleErrorZ* o_conv = (LDKCResult_NonePeerHandleErrorZ*)untag_ptr(o);
22877         jboolean ret_conv = CResult_NonePeerHandleErrorZ_is_ok(o_conv);
22878         return ret_conv;
22879 }
22880
22881 void  __attribute__((export_name("TS_CResult_NonePeerHandleErrorZ_free"))) TS_CResult_NonePeerHandleErrorZ_free(uint64_t _res) {
22882         if (!ptr_is_owned(_res)) return;
22883         void* _res_ptr = untag_ptr(_res);
22884         CHECK_ACCESS(_res_ptr);
22885         LDKCResult_NonePeerHandleErrorZ _res_conv = *(LDKCResult_NonePeerHandleErrorZ*)(_res_ptr);
22886         FREE(untag_ptr(_res));
22887         CResult_NonePeerHandleErrorZ_free(_res_conv);
22888 }
22889
22890 static inline uint64_t CResult_NonePeerHandleErrorZ_clone_ptr(LDKCResult_NonePeerHandleErrorZ *NONNULL_PTR arg) {
22891         LDKCResult_NonePeerHandleErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NonePeerHandleErrorZ), "LDKCResult_NonePeerHandleErrorZ");
22892         *ret_conv = CResult_NonePeerHandleErrorZ_clone(arg);
22893         return tag_ptr(ret_conv, true);
22894 }
22895 int64_t  __attribute__((export_name("TS_CResult_NonePeerHandleErrorZ_clone_ptr"))) TS_CResult_NonePeerHandleErrorZ_clone_ptr(uint64_t arg) {
22896         LDKCResult_NonePeerHandleErrorZ* arg_conv = (LDKCResult_NonePeerHandleErrorZ*)untag_ptr(arg);
22897         int64_t ret_conv = CResult_NonePeerHandleErrorZ_clone_ptr(arg_conv);
22898         return ret_conv;
22899 }
22900
22901 uint64_t  __attribute__((export_name("TS_CResult_NonePeerHandleErrorZ_clone"))) TS_CResult_NonePeerHandleErrorZ_clone(uint64_t orig) {
22902         LDKCResult_NonePeerHandleErrorZ* orig_conv = (LDKCResult_NonePeerHandleErrorZ*)untag_ptr(orig);
22903         LDKCResult_NonePeerHandleErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NonePeerHandleErrorZ), "LDKCResult_NonePeerHandleErrorZ");
22904         *ret_conv = CResult_NonePeerHandleErrorZ_clone(orig_conv);
22905         return tag_ptr(ret_conv, true);
22906 }
22907
22908 uint64_t  __attribute__((export_name("TS_CResult_boolPeerHandleErrorZ_ok"))) TS_CResult_boolPeerHandleErrorZ_ok(jboolean o) {
22909         LDKCResult_boolPeerHandleErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_boolPeerHandleErrorZ), "LDKCResult_boolPeerHandleErrorZ");
22910         *ret_conv = CResult_boolPeerHandleErrorZ_ok(o);
22911         return tag_ptr(ret_conv, true);
22912 }
22913
22914 uint64_t  __attribute__((export_name("TS_CResult_boolPeerHandleErrorZ_err"))) TS_CResult_boolPeerHandleErrorZ_err(uint64_t e) {
22915         LDKPeerHandleError e_conv;
22916         e_conv.inner = untag_ptr(e);
22917         e_conv.is_owned = ptr_is_owned(e);
22918         CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
22919         e_conv = PeerHandleError_clone(&e_conv);
22920         LDKCResult_boolPeerHandleErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_boolPeerHandleErrorZ), "LDKCResult_boolPeerHandleErrorZ");
22921         *ret_conv = CResult_boolPeerHandleErrorZ_err(e_conv);
22922         return tag_ptr(ret_conv, true);
22923 }
22924
22925 jboolean  __attribute__((export_name("TS_CResult_boolPeerHandleErrorZ_is_ok"))) TS_CResult_boolPeerHandleErrorZ_is_ok(uint64_t o) {
22926         LDKCResult_boolPeerHandleErrorZ* o_conv = (LDKCResult_boolPeerHandleErrorZ*)untag_ptr(o);
22927         jboolean ret_conv = CResult_boolPeerHandleErrorZ_is_ok(o_conv);
22928         return ret_conv;
22929 }
22930
22931 void  __attribute__((export_name("TS_CResult_boolPeerHandleErrorZ_free"))) TS_CResult_boolPeerHandleErrorZ_free(uint64_t _res) {
22932         if (!ptr_is_owned(_res)) return;
22933         void* _res_ptr = untag_ptr(_res);
22934         CHECK_ACCESS(_res_ptr);
22935         LDKCResult_boolPeerHandleErrorZ _res_conv = *(LDKCResult_boolPeerHandleErrorZ*)(_res_ptr);
22936         FREE(untag_ptr(_res));
22937         CResult_boolPeerHandleErrorZ_free(_res_conv);
22938 }
22939
22940 static inline uint64_t CResult_boolPeerHandleErrorZ_clone_ptr(LDKCResult_boolPeerHandleErrorZ *NONNULL_PTR arg) {
22941         LDKCResult_boolPeerHandleErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_boolPeerHandleErrorZ), "LDKCResult_boolPeerHandleErrorZ");
22942         *ret_conv = CResult_boolPeerHandleErrorZ_clone(arg);
22943         return tag_ptr(ret_conv, true);
22944 }
22945 int64_t  __attribute__((export_name("TS_CResult_boolPeerHandleErrorZ_clone_ptr"))) TS_CResult_boolPeerHandleErrorZ_clone_ptr(uint64_t arg) {
22946         LDKCResult_boolPeerHandleErrorZ* arg_conv = (LDKCResult_boolPeerHandleErrorZ*)untag_ptr(arg);
22947         int64_t ret_conv = CResult_boolPeerHandleErrorZ_clone_ptr(arg_conv);
22948         return ret_conv;
22949 }
22950
22951 uint64_t  __attribute__((export_name("TS_CResult_boolPeerHandleErrorZ_clone"))) TS_CResult_boolPeerHandleErrorZ_clone(uint64_t orig) {
22952         LDKCResult_boolPeerHandleErrorZ* orig_conv = (LDKCResult_boolPeerHandleErrorZ*)untag_ptr(orig);
22953         LDKCResult_boolPeerHandleErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_boolPeerHandleErrorZ), "LDKCResult_boolPeerHandleErrorZ");
22954         *ret_conv = CResult_boolPeerHandleErrorZ_clone(orig_conv);
22955         return tag_ptr(ret_conv, true);
22956 }
22957
22958 uint64_t  __attribute__((export_name("TS_CResult_u32GraphSyncErrorZ_ok"))) TS_CResult_u32GraphSyncErrorZ_ok(int32_t o) {
22959         LDKCResult_u32GraphSyncErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_u32GraphSyncErrorZ), "LDKCResult_u32GraphSyncErrorZ");
22960         *ret_conv = CResult_u32GraphSyncErrorZ_ok(o);
22961         return tag_ptr(ret_conv, true);
22962 }
22963
22964 uint64_t  __attribute__((export_name("TS_CResult_u32GraphSyncErrorZ_err"))) TS_CResult_u32GraphSyncErrorZ_err(uint64_t e) {
22965         void* e_ptr = untag_ptr(e);
22966         CHECK_ACCESS(e_ptr);
22967         LDKGraphSyncError e_conv = *(LDKGraphSyncError*)(e_ptr);
22968         e_conv = GraphSyncError_clone((LDKGraphSyncError*)untag_ptr(e));
22969         LDKCResult_u32GraphSyncErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_u32GraphSyncErrorZ), "LDKCResult_u32GraphSyncErrorZ");
22970         *ret_conv = CResult_u32GraphSyncErrorZ_err(e_conv);
22971         return tag_ptr(ret_conv, true);
22972 }
22973
22974 jboolean  __attribute__((export_name("TS_CResult_u32GraphSyncErrorZ_is_ok"))) TS_CResult_u32GraphSyncErrorZ_is_ok(uint64_t o) {
22975         LDKCResult_u32GraphSyncErrorZ* o_conv = (LDKCResult_u32GraphSyncErrorZ*)untag_ptr(o);
22976         jboolean ret_conv = CResult_u32GraphSyncErrorZ_is_ok(o_conv);
22977         return ret_conv;
22978 }
22979
22980 void  __attribute__((export_name("TS_CResult_u32GraphSyncErrorZ_free"))) TS_CResult_u32GraphSyncErrorZ_free(uint64_t _res) {
22981         if (!ptr_is_owned(_res)) return;
22982         void* _res_ptr = untag_ptr(_res);
22983         CHECK_ACCESS(_res_ptr);
22984         LDKCResult_u32GraphSyncErrorZ _res_conv = *(LDKCResult_u32GraphSyncErrorZ*)(_res_ptr);
22985         FREE(untag_ptr(_res));
22986         CResult_u32GraphSyncErrorZ_free(_res_conv);
22987 }
22988
22989 uint64_t  __attribute__((export_name("TS_CResult_CVec_u8ZIOErrorZ_ok"))) TS_CResult_CVec_u8ZIOErrorZ_ok(int8_tArray o) {
22990         LDKCVec_u8Z o_ref;
22991         o_ref.datalen = o->arr_len;
22992         o_ref.data = MALLOC(o_ref.datalen, "LDKCVec_u8Z Bytes");
22993         memcpy(o_ref.data, o->elems, o_ref.datalen); FREE(o);
22994         LDKCResult_CVec_u8ZIOErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_u8ZIOErrorZ), "LDKCResult_CVec_u8ZIOErrorZ");
22995         *ret_conv = CResult_CVec_u8ZIOErrorZ_ok(o_ref);
22996         return tag_ptr(ret_conv, true);
22997 }
22998
22999 uint64_t  __attribute__((export_name("TS_CResult_CVec_u8ZIOErrorZ_err"))) TS_CResult_CVec_u8ZIOErrorZ_err(uint32_t e) {
23000         LDKIOError e_conv = LDKIOError_from_js(e);
23001         LDKCResult_CVec_u8ZIOErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_u8ZIOErrorZ), "LDKCResult_CVec_u8ZIOErrorZ");
23002         *ret_conv = CResult_CVec_u8ZIOErrorZ_err(e_conv);
23003         return tag_ptr(ret_conv, true);
23004 }
23005
23006 jboolean  __attribute__((export_name("TS_CResult_CVec_u8ZIOErrorZ_is_ok"))) TS_CResult_CVec_u8ZIOErrorZ_is_ok(uint64_t o) {
23007         LDKCResult_CVec_u8ZIOErrorZ* o_conv = (LDKCResult_CVec_u8ZIOErrorZ*)untag_ptr(o);
23008         jboolean ret_conv = CResult_CVec_u8ZIOErrorZ_is_ok(o_conv);
23009         return ret_conv;
23010 }
23011
23012 void  __attribute__((export_name("TS_CResult_CVec_u8ZIOErrorZ_free"))) TS_CResult_CVec_u8ZIOErrorZ_free(uint64_t _res) {
23013         if (!ptr_is_owned(_res)) return;
23014         void* _res_ptr = untag_ptr(_res);
23015         CHECK_ACCESS(_res_ptr);
23016         LDKCResult_CVec_u8ZIOErrorZ _res_conv = *(LDKCResult_CVec_u8ZIOErrorZ*)(_res_ptr);
23017         FREE(untag_ptr(_res));
23018         CResult_CVec_u8ZIOErrorZ_free(_res_conv);
23019 }
23020
23021 static inline uint64_t CResult_CVec_u8ZIOErrorZ_clone_ptr(LDKCResult_CVec_u8ZIOErrorZ *NONNULL_PTR arg) {
23022         LDKCResult_CVec_u8ZIOErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_u8ZIOErrorZ), "LDKCResult_CVec_u8ZIOErrorZ");
23023         *ret_conv = CResult_CVec_u8ZIOErrorZ_clone(arg);
23024         return tag_ptr(ret_conv, true);
23025 }
23026 int64_t  __attribute__((export_name("TS_CResult_CVec_u8ZIOErrorZ_clone_ptr"))) TS_CResult_CVec_u8ZIOErrorZ_clone_ptr(uint64_t arg) {
23027         LDKCResult_CVec_u8ZIOErrorZ* arg_conv = (LDKCResult_CVec_u8ZIOErrorZ*)untag_ptr(arg);
23028         int64_t ret_conv = CResult_CVec_u8ZIOErrorZ_clone_ptr(arg_conv);
23029         return ret_conv;
23030 }
23031
23032 uint64_t  __attribute__((export_name("TS_CResult_CVec_u8ZIOErrorZ_clone"))) TS_CResult_CVec_u8ZIOErrorZ_clone(uint64_t orig) {
23033         LDKCResult_CVec_u8ZIOErrorZ* orig_conv = (LDKCResult_CVec_u8ZIOErrorZ*)untag_ptr(orig);
23034         LDKCResult_CVec_u8ZIOErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_u8ZIOErrorZ), "LDKCResult_CVec_u8ZIOErrorZ");
23035         *ret_conv = CResult_CVec_u8ZIOErrorZ_clone(orig_conv);
23036         return tag_ptr(ret_conv, true);
23037 }
23038
23039 uint64_t  __attribute__((export_name("TS_CResult_NoneIOErrorZ_ok"))) TS_CResult_NoneIOErrorZ_ok() {
23040         LDKCResult_NoneIOErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneIOErrorZ), "LDKCResult_NoneIOErrorZ");
23041         *ret_conv = CResult_NoneIOErrorZ_ok();
23042         return tag_ptr(ret_conv, true);
23043 }
23044
23045 uint64_t  __attribute__((export_name("TS_CResult_NoneIOErrorZ_err"))) TS_CResult_NoneIOErrorZ_err(uint32_t e) {
23046         LDKIOError e_conv = LDKIOError_from_js(e);
23047         LDKCResult_NoneIOErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneIOErrorZ), "LDKCResult_NoneIOErrorZ");
23048         *ret_conv = CResult_NoneIOErrorZ_err(e_conv);
23049         return tag_ptr(ret_conv, true);
23050 }
23051
23052 jboolean  __attribute__((export_name("TS_CResult_NoneIOErrorZ_is_ok"))) TS_CResult_NoneIOErrorZ_is_ok(uint64_t o) {
23053         LDKCResult_NoneIOErrorZ* o_conv = (LDKCResult_NoneIOErrorZ*)untag_ptr(o);
23054         jboolean ret_conv = CResult_NoneIOErrorZ_is_ok(o_conv);
23055         return ret_conv;
23056 }
23057
23058 void  __attribute__((export_name("TS_CResult_NoneIOErrorZ_free"))) TS_CResult_NoneIOErrorZ_free(uint64_t _res) {
23059         if (!ptr_is_owned(_res)) return;
23060         void* _res_ptr = untag_ptr(_res);
23061         CHECK_ACCESS(_res_ptr);
23062         LDKCResult_NoneIOErrorZ _res_conv = *(LDKCResult_NoneIOErrorZ*)(_res_ptr);
23063         FREE(untag_ptr(_res));
23064         CResult_NoneIOErrorZ_free(_res_conv);
23065 }
23066
23067 static inline uint64_t CResult_NoneIOErrorZ_clone_ptr(LDKCResult_NoneIOErrorZ *NONNULL_PTR arg) {
23068         LDKCResult_NoneIOErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneIOErrorZ), "LDKCResult_NoneIOErrorZ");
23069         *ret_conv = CResult_NoneIOErrorZ_clone(arg);
23070         return tag_ptr(ret_conv, true);
23071 }
23072 int64_t  __attribute__((export_name("TS_CResult_NoneIOErrorZ_clone_ptr"))) TS_CResult_NoneIOErrorZ_clone_ptr(uint64_t arg) {
23073         LDKCResult_NoneIOErrorZ* arg_conv = (LDKCResult_NoneIOErrorZ*)untag_ptr(arg);
23074         int64_t ret_conv = CResult_NoneIOErrorZ_clone_ptr(arg_conv);
23075         return ret_conv;
23076 }
23077
23078 uint64_t  __attribute__((export_name("TS_CResult_NoneIOErrorZ_clone"))) TS_CResult_NoneIOErrorZ_clone(uint64_t orig) {
23079         LDKCResult_NoneIOErrorZ* orig_conv = (LDKCResult_NoneIOErrorZ*)untag_ptr(orig);
23080         LDKCResult_NoneIOErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneIOErrorZ), "LDKCResult_NoneIOErrorZ");
23081         *ret_conv = CResult_NoneIOErrorZ_clone(orig_conv);
23082         return tag_ptr(ret_conv, true);
23083 }
23084
23085 void  __attribute__((export_name("TS_CVec_StrZ_free"))) TS_CVec_StrZ_free(ptrArray _res) {
23086         LDKCVec_StrZ _res_constr;
23087         _res_constr.datalen = _res->arr_len;
23088         if (_res_constr.datalen > 0)
23089                 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKStr), "LDKCVec_StrZ Elements");
23090         else
23091                 _res_constr.data = NULL;
23092         jstring* _res_vals = (void*) _res->elems;
23093         for (size_t i = 0; i < _res_constr.datalen; i++) {
23094                 jstring _res_conv_8 = _res_vals[i];
23095                 LDKStr dummy = { .chars = NULL, .len = 0, .chars_is_owned = false };
23096                 _res_constr.data[i] = dummy;
23097         }
23098         FREE(_res);
23099         CVec_StrZ_free(_res_constr);
23100 }
23101
23102 uint64_t  __attribute__((export_name("TS_CResult_CVec_StrZIOErrorZ_ok"))) TS_CResult_CVec_StrZIOErrorZ_ok(ptrArray o) {
23103         LDKCVec_StrZ o_constr;
23104         o_constr.datalen = o->arr_len;
23105         if (o_constr.datalen > 0)
23106                 o_constr.data = MALLOC(o_constr.datalen * sizeof(LDKStr), "LDKCVec_StrZ Elements");
23107         else
23108                 o_constr.data = NULL;
23109         jstring* o_vals = (void*) o->elems;
23110         for (size_t i = 0; i < o_constr.datalen; i++) {
23111                 jstring o_conv_8 = o_vals[i];
23112                 LDKStr o_conv_8_conv = str_ref_to_owned_c(o_conv_8);
23113                 o_constr.data[i] = o_conv_8_conv;
23114         }
23115         FREE(o);
23116         LDKCResult_CVec_StrZIOErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_StrZIOErrorZ), "LDKCResult_CVec_StrZIOErrorZ");
23117         *ret_conv = CResult_CVec_StrZIOErrorZ_ok(o_constr);
23118         return tag_ptr(ret_conv, true);
23119 }
23120
23121 uint64_t  __attribute__((export_name("TS_CResult_CVec_StrZIOErrorZ_err"))) TS_CResult_CVec_StrZIOErrorZ_err(uint32_t e) {
23122         LDKIOError e_conv = LDKIOError_from_js(e);
23123         LDKCResult_CVec_StrZIOErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_StrZIOErrorZ), "LDKCResult_CVec_StrZIOErrorZ");
23124         *ret_conv = CResult_CVec_StrZIOErrorZ_err(e_conv);
23125         return tag_ptr(ret_conv, true);
23126 }
23127
23128 jboolean  __attribute__((export_name("TS_CResult_CVec_StrZIOErrorZ_is_ok"))) TS_CResult_CVec_StrZIOErrorZ_is_ok(uint64_t o) {
23129         LDKCResult_CVec_StrZIOErrorZ* o_conv = (LDKCResult_CVec_StrZIOErrorZ*)untag_ptr(o);
23130         jboolean ret_conv = CResult_CVec_StrZIOErrorZ_is_ok(o_conv);
23131         return ret_conv;
23132 }
23133
23134 void  __attribute__((export_name("TS_CResult_CVec_StrZIOErrorZ_free"))) TS_CResult_CVec_StrZIOErrorZ_free(uint64_t _res) {
23135         if (!ptr_is_owned(_res)) return;
23136         void* _res_ptr = untag_ptr(_res);
23137         CHECK_ACCESS(_res_ptr);
23138         LDKCResult_CVec_StrZIOErrorZ _res_conv = *(LDKCResult_CVec_StrZIOErrorZ*)(_res_ptr);
23139         FREE(untag_ptr(_res));
23140         CResult_CVec_StrZIOErrorZ_free(_res_conv);
23141 }
23142
23143 static inline uint64_t CResult_CVec_StrZIOErrorZ_clone_ptr(LDKCResult_CVec_StrZIOErrorZ *NONNULL_PTR arg) {
23144         LDKCResult_CVec_StrZIOErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_StrZIOErrorZ), "LDKCResult_CVec_StrZIOErrorZ");
23145         *ret_conv = CResult_CVec_StrZIOErrorZ_clone(arg);
23146         return tag_ptr(ret_conv, true);
23147 }
23148 int64_t  __attribute__((export_name("TS_CResult_CVec_StrZIOErrorZ_clone_ptr"))) TS_CResult_CVec_StrZIOErrorZ_clone_ptr(uint64_t arg) {
23149         LDKCResult_CVec_StrZIOErrorZ* arg_conv = (LDKCResult_CVec_StrZIOErrorZ*)untag_ptr(arg);
23150         int64_t ret_conv = CResult_CVec_StrZIOErrorZ_clone_ptr(arg_conv);
23151         return ret_conv;
23152 }
23153
23154 uint64_t  __attribute__((export_name("TS_CResult_CVec_StrZIOErrorZ_clone"))) TS_CResult_CVec_StrZIOErrorZ_clone(uint64_t orig) {
23155         LDKCResult_CVec_StrZIOErrorZ* orig_conv = (LDKCResult_CVec_StrZIOErrorZ*)untag_ptr(orig);
23156         LDKCResult_CVec_StrZIOErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_StrZIOErrorZ), "LDKCResult_CVec_StrZIOErrorZ");
23157         *ret_conv = CResult_CVec_StrZIOErrorZ_clone(orig_conv);
23158         return tag_ptr(ret_conv, true);
23159 }
23160
23161 void  __attribute__((export_name("TS_CVec_C2Tuple_ThirtyTwoBytesChannelMonitorZZ_free"))) TS_CVec_C2Tuple_ThirtyTwoBytesChannelMonitorZZ_free(uint64_tArray _res) {
23162         LDKCVec_C2Tuple_ThirtyTwoBytesChannelMonitorZZ _res_constr;
23163         _res_constr.datalen = _res->arr_len;
23164         if (_res_constr.datalen > 0)
23165                 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKC2Tuple_ThirtyTwoBytesChannelMonitorZ), "LDKCVec_C2Tuple_ThirtyTwoBytesChannelMonitorZZ Elements");
23166         else
23167                 _res_constr.data = NULL;
23168         uint64_t* _res_vals = _res->elems;
23169         for (size_t o = 0; o < _res_constr.datalen; o++) {
23170                 uint64_t _res_conv_40 = _res_vals[o];
23171                 void* _res_conv_40_ptr = untag_ptr(_res_conv_40);
23172                 CHECK_ACCESS(_res_conv_40_ptr);
23173                 LDKC2Tuple_ThirtyTwoBytesChannelMonitorZ _res_conv_40_conv = *(LDKC2Tuple_ThirtyTwoBytesChannelMonitorZ*)(_res_conv_40_ptr);
23174                 FREE(untag_ptr(_res_conv_40));
23175                 _res_constr.data[o] = _res_conv_40_conv;
23176         }
23177         FREE(_res);
23178         CVec_C2Tuple_ThirtyTwoBytesChannelMonitorZZ_free(_res_constr);
23179 }
23180
23181 uint64_t  __attribute__((export_name("TS_CResult_CVec_C2Tuple_ThirtyTwoBytesChannelMonitorZZIOErrorZ_ok"))) TS_CResult_CVec_C2Tuple_ThirtyTwoBytesChannelMonitorZZIOErrorZ_ok(uint64_tArray o) {
23182         LDKCVec_C2Tuple_ThirtyTwoBytesChannelMonitorZZ o_constr;
23183         o_constr.datalen = o->arr_len;
23184         if (o_constr.datalen > 0)
23185                 o_constr.data = MALLOC(o_constr.datalen * sizeof(LDKC2Tuple_ThirtyTwoBytesChannelMonitorZ), "LDKCVec_C2Tuple_ThirtyTwoBytesChannelMonitorZZ Elements");
23186         else
23187                 o_constr.data = NULL;
23188         uint64_t* o_vals = o->elems;
23189         for (size_t o = 0; o < o_constr.datalen; o++) {
23190                 uint64_t o_conv_40 = o_vals[o];
23191                 void* o_conv_40_ptr = untag_ptr(o_conv_40);
23192                 CHECK_ACCESS(o_conv_40_ptr);
23193                 LDKC2Tuple_ThirtyTwoBytesChannelMonitorZ o_conv_40_conv = *(LDKC2Tuple_ThirtyTwoBytesChannelMonitorZ*)(o_conv_40_ptr);
23194                 o_conv_40_conv = C2Tuple_ThirtyTwoBytesChannelMonitorZ_clone((LDKC2Tuple_ThirtyTwoBytesChannelMonitorZ*)untag_ptr(o_conv_40));
23195                 o_constr.data[o] = o_conv_40_conv;
23196         }
23197         FREE(o);
23198         LDKCResult_CVec_C2Tuple_ThirtyTwoBytesChannelMonitorZZIOErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_C2Tuple_ThirtyTwoBytesChannelMonitorZZIOErrorZ), "LDKCResult_CVec_C2Tuple_ThirtyTwoBytesChannelMonitorZZIOErrorZ");
23199         *ret_conv = CResult_CVec_C2Tuple_ThirtyTwoBytesChannelMonitorZZIOErrorZ_ok(o_constr);
23200         return tag_ptr(ret_conv, true);
23201 }
23202
23203 uint64_t  __attribute__((export_name("TS_CResult_CVec_C2Tuple_ThirtyTwoBytesChannelMonitorZZIOErrorZ_err"))) TS_CResult_CVec_C2Tuple_ThirtyTwoBytesChannelMonitorZZIOErrorZ_err(uint32_t e) {
23204         LDKIOError e_conv = LDKIOError_from_js(e);
23205         LDKCResult_CVec_C2Tuple_ThirtyTwoBytesChannelMonitorZZIOErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_C2Tuple_ThirtyTwoBytesChannelMonitorZZIOErrorZ), "LDKCResult_CVec_C2Tuple_ThirtyTwoBytesChannelMonitorZZIOErrorZ");
23206         *ret_conv = CResult_CVec_C2Tuple_ThirtyTwoBytesChannelMonitorZZIOErrorZ_err(e_conv);
23207         return tag_ptr(ret_conv, true);
23208 }
23209
23210 jboolean  __attribute__((export_name("TS_CResult_CVec_C2Tuple_ThirtyTwoBytesChannelMonitorZZIOErrorZ_is_ok"))) TS_CResult_CVec_C2Tuple_ThirtyTwoBytesChannelMonitorZZIOErrorZ_is_ok(uint64_t o) {
23211         LDKCResult_CVec_C2Tuple_ThirtyTwoBytesChannelMonitorZZIOErrorZ* o_conv = (LDKCResult_CVec_C2Tuple_ThirtyTwoBytesChannelMonitorZZIOErrorZ*)untag_ptr(o);
23212         jboolean ret_conv = CResult_CVec_C2Tuple_ThirtyTwoBytesChannelMonitorZZIOErrorZ_is_ok(o_conv);
23213         return ret_conv;
23214 }
23215
23216 void  __attribute__((export_name("TS_CResult_CVec_C2Tuple_ThirtyTwoBytesChannelMonitorZZIOErrorZ_free"))) TS_CResult_CVec_C2Tuple_ThirtyTwoBytesChannelMonitorZZIOErrorZ_free(uint64_t _res) {
23217         if (!ptr_is_owned(_res)) return;
23218         void* _res_ptr = untag_ptr(_res);
23219         CHECK_ACCESS(_res_ptr);
23220         LDKCResult_CVec_C2Tuple_ThirtyTwoBytesChannelMonitorZZIOErrorZ _res_conv = *(LDKCResult_CVec_C2Tuple_ThirtyTwoBytesChannelMonitorZZIOErrorZ*)(_res_ptr);
23221         FREE(untag_ptr(_res));
23222         CResult_CVec_C2Tuple_ThirtyTwoBytesChannelMonitorZZIOErrorZ_free(_res_conv);
23223 }
23224
23225 static inline uint64_t CResult_CVec_C2Tuple_ThirtyTwoBytesChannelMonitorZZIOErrorZ_clone_ptr(LDKCResult_CVec_C2Tuple_ThirtyTwoBytesChannelMonitorZZIOErrorZ *NONNULL_PTR arg) {
23226         LDKCResult_CVec_C2Tuple_ThirtyTwoBytesChannelMonitorZZIOErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_C2Tuple_ThirtyTwoBytesChannelMonitorZZIOErrorZ), "LDKCResult_CVec_C2Tuple_ThirtyTwoBytesChannelMonitorZZIOErrorZ");
23227         *ret_conv = CResult_CVec_C2Tuple_ThirtyTwoBytesChannelMonitorZZIOErrorZ_clone(arg);
23228         return tag_ptr(ret_conv, true);
23229 }
23230 int64_t  __attribute__((export_name("TS_CResult_CVec_C2Tuple_ThirtyTwoBytesChannelMonitorZZIOErrorZ_clone_ptr"))) TS_CResult_CVec_C2Tuple_ThirtyTwoBytesChannelMonitorZZIOErrorZ_clone_ptr(uint64_t arg) {
23231         LDKCResult_CVec_C2Tuple_ThirtyTwoBytesChannelMonitorZZIOErrorZ* arg_conv = (LDKCResult_CVec_C2Tuple_ThirtyTwoBytesChannelMonitorZZIOErrorZ*)untag_ptr(arg);
23232         int64_t ret_conv = CResult_CVec_C2Tuple_ThirtyTwoBytesChannelMonitorZZIOErrorZ_clone_ptr(arg_conv);
23233         return ret_conv;
23234 }
23235
23236 uint64_t  __attribute__((export_name("TS_CResult_CVec_C2Tuple_ThirtyTwoBytesChannelMonitorZZIOErrorZ_clone"))) TS_CResult_CVec_C2Tuple_ThirtyTwoBytesChannelMonitorZZIOErrorZ_clone(uint64_t orig) {
23237         LDKCResult_CVec_C2Tuple_ThirtyTwoBytesChannelMonitorZZIOErrorZ* orig_conv = (LDKCResult_CVec_C2Tuple_ThirtyTwoBytesChannelMonitorZZIOErrorZ*)untag_ptr(orig);
23238         LDKCResult_CVec_C2Tuple_ThirtyTwoBytesChannelMonitorZZIOErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_C2Tuple_ThirtyTwoBytesChannelMonitorZZIOErrorZ), "LDKCResult_CVec_C2Tuple_ThirtyTwoBytesChannelMonitorZZIOErrorZ");
23239         *ret_conv = CResult_CVec_C2Tuple_ThirtyTwoBytesChannelMonitorZZIOErrorZ_clone(orig_conv);
23240         return tag_ptr(ret_conv, true);
23241 }
23242
23243 uint64_t  __attribute__((export_name("TS_CResult_C2Tuple_ThirtyTwoBytesChannelMonitorZIOErrorZ_ok"))) TS_CResult_C2Tuple_ThirtyTwoBytesChannelMonitorZIOErrorZ_ok(uint64_t o) {
23244         void* o_ptr = untag_ptr(o);
23245         CHECK_ACCESS(o_ptr);
23246         LDKC2Tuple_ThirtyTwoBytesChannelMonitorZ o_conv = *(LDKC2Tuple_ThirtyTwoBytesChannelMonitorZ*)(o_ptr);
23247         o_conv = C2Tuple_ThirtyTwoBytesChannelMonitorZ_clone((LDKC2Tuple_ThirtyTwoBytesChannelMonitorZ*)untag_ptr(o));
23248         LDKCResult_C2Tuple_ThirtyTwoBytesChannelMonitorZIOErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_ThirtyTwoBytesChannelMonitorZIOErrorZ), "LDKCResult_C2Tuple_ThirtyTwoBytesChannelMonitorZIOErrorZ");
23249         *ret_conv = CResult_C2Tuple_ThirtyTwoBytesChannelMonitorZIOErrorZ_ok(o_conv);
23250         return tag_ptr(ret_conv, true);
23251 }
23252
23253 uint64_t  __attribute__((export_name("TS_CResult_C2Tuple_ThirtyTwoBytesChannelMonitorZIOErrorZ_err"))) TS_CResult_C2Tuple_ThirtyTwoBytesChannelMonitorZIOErrorZ_err(uint32_t e) {
23254         LDKIOError e_conv = LDKIOError_from_js(e);
23255         LDKCResult_C2Tuple_ThirtyTwoBytesChannelMonitorZIOErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_ThirtyTwoBytesChannelMonitorZIOErrorZ), "LDKCResult_C2Tuple_ThirtyTwoBytesChannelMonitorZIOErrorZ");
23256         *ret_conv = CResult_C2Tuple_ThirtyTwoBytesChannelMonitorZIOErrorZ_err(e_conv);
23257         return tag_ptr(ret_conv, true);
23258 }
23259
23260 jboolean  __attribute__((export_name("TS_CResult_C2Tuple_ThirtyTwoBytesChannelMonitorZIOErrorZ_is_ok"))) TS_CResult_C2Tuple_ThirtyTwoBytesChannelMonitorZIOErrorZ_is_ok(uint64_t o) {
23261         LDKCResult_C2Tuple_ThirtyTwoBytesChannelMonitorZIOErrorZ* o_conv = (LDKCResult_C2Tuple_ThirtyTwoBytesChannelMonitorZIOErrorZ*)untag_ptr(o);
23262         jboolean ret_conv = CResult_C2Tuple_ThirtyTwoBytesChannelMonitorZIOErrorZ_is_ok(o_conv);
23263         return ret_conv;
23264 }
23265
23266 void  __attribute__((export_name("TS_CResult_C2Tuple_ThirtyTwoBytesChannelMonitorZIOErrorZ_free"))) TS_CResult_C2Tuple_ThirtyTwoBytesChannelMonitorZIOErrorZ_free(uint64_t _res) {
23267         if (!ptr_is_owned(_res)) return;
23268         void* _res_ptr = untag_ptr(_res);
23269         CHECK_ACCESS(_res_ptr);
23270         LDKCResult_C2Tuple_ThirtyTwoBytesChannelMonitorZIOErrorZ _res_conv = *(LDKCResult_C2Tuple_ThirtyTwoBytesChannelMonitorZIOErrorZ*)(_res_ptr);
23271         FREE(untag_ptr(_res));
23272         CResult_C2Tuple_ThirtyTwoBytesChannelMonitorZIOErrorZ_free(_res_conv);
23273 }
23274
23275 static inline uint64_t CResult_C2Tuple_ThirtyTwoBytesChannelMonitorZIOErrorZ_clone_ptr(LDKCResult_C2Tuple_ThirtyTwoBytesChannelMonitorZIOErrorZ *NONNULL_PTR arg) {
23276         LDKCResult_C2Tuple_ThirtyTwoBytesChannelMonitorZIOErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_ThirtyTwoBytesChannelMonitorZIOErrorZ), "LDKCResult_C2Tuple_ThirtyTwoBytesChannelMonitorZIOErrorZ");
23277         *ret_conv = CResult_C2Tuple_ThirtyTwoBytesChannelMonitorZIOErrorZ_clone(arg);
23278         return tag_ptr(ret_conv, true);
23279 }
23280 int64_t  __attribute__((export_name("TS_CResult_C2Tuple_ThirtyTwoBytesChannelMonitorZIOErrorZ_clone_ptr"))) TS_CResult_C2Tuple_ThirtyTwoBytesChannelMonitorZIOErrorZ_clone_ptr(uint64_t arg) {
23281         LDKCResult_C2Tuple_ThirtyTwoBytesChannelMonitorZIOErrorZ* arg_conv = (LDKCResult_C2Tuple_ThirtyTwoBytesChannelMonitorZIOErrorZ*)untag_ptr(arg);
23282         int64_t ret_conv = CResult_C2Tuple_ThirtyTwoBytesChannelMonitorZIOErrorZ_clone_ptr(arg_conv);
23283         return ret_conv;
23284 }
23285
23286 uint64_t  __attribute__((export_name("TS_CResult_C2Tuple_ThirtyTwoBytesChannelMonitorZIOErrorZ_clone"))) TS_CResult_C2Tuple_ThirtyTwoBytesChannelMonitorZIOErrorZ_clone(uint64_t orig) {
23287         LDKCResult_C2Tuple_ThirtyTwoBytesChannelMonitorZIOErrorZ* orig_conv = (LDKCResult_C2Tuple_ThirtyTwoBytesChannelMonitorZIOErrorZ*)untag_ptr(orig);
23288         LDKCResult_C2Tuple_ThirtyTwoBytesChannelMonitorZIOErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_ThirtyTwoBytesChannelMonitorZIOErrorZ), "LDKCResult_C2Tuple_ThirtyTwoBytesChannelMonitorZIOErrorZ");
23289         *ret_conv = CResult_C2Tuple_ThirtyTwoBytesChannelMonitorZIOErrorZ_clone(orig_conv);
23290         return tag_ptr(ret_conv, true);
23291 }
23292
23293 uint64_t  __attribute__((export_name("TS_COption_SecretKeyZ_some"))) TS_COption_SecretKeyZ_some(int8_tArray o) {
23294         LDKSecretKey o_ref;
23295         CHECK(o->arr_len == 32);
23296         memcpy(o_ref.bytes, o->elems, 32); FREE(o);
23297         LDKCOption_SecretKeyZ *ret_copy = MALLOC(sizeof(LDKCOption_SecretKeyZ), "LDKCOption_SecretKeyZ");
23298         *ret_copy = COption_SecretKeyZ_some(o_ref);
23299         uint64_t ret_ref = tag_ptr(ret_copy, true);
23300         return ret_ref;
23301 }
23302
23303 uint64_t  __attribute__((export_name("TS_COption_SecretKeyZ_none"))) TS_COption_SecretKeyZ_none() {
23304         LDKCOption_SecretKeyZ *ret_copy = MALLOC(sizeof(LDKCOption_SecretKeyZ), "LDKCOption_SecretKeyZ");
23305         *ret_copy = COption_SecretKeyZ_none();
23306         uint64_t ret_ref = tag_ptr(ret_copy, true);
23307         return ret_ref;
23308 }
23309
23310 void  __attribute__((export_name("TS_COption_SecretKeyZ_free"))) TS_COption_SecretKeyZ_free(uint64_t _res) {
23311         if (!ptr_is_owned(_res)) return;
23312         void* _res_ptr = untag_ptr(_res);
23313         CHECK_ACCESS(_res_ptr);
23314         LDKCOption_SecretKeyZ _res_conv = *(LDKCOption_SecretKeyZ*)(_res_ptr);
23315         FREE(untag_ptr(_res));
23316         COption_SecretKeyZ_free(_res_conv);
23317 }
23318
23319 static inline uint64_t COption_SecretKeyZ_clone_ptr(LDKCOption_SecretKeyZ *NONNULL_PTR arg) {
23320         LDKCOption_SecretKeyZ *ret_copy = MALLOC(sizeof(LDKCOption_SecretKeyZ), "LDKCOption_SecretKeyZ");
23321         *ret_copy = COption_SecretKeyZ_clone(arg);
23322         uint64_t ret_ref = tag_ptr(ret_copy, true);
23323         return ret_ref;
23324 }
23325 int64_t  __attribute__((export_name("TS_COption_SecretKeyZ_clone_ptr"))) TS_COption_SecretKeyZ_clone_ptr(uint64_t arg) {
23326         LDKCOption_SecretKeyZ* arg_conv = (LDKCOption_SecretKeyZ*)untag_ptr(arg);
23327         int64_t ret_conv = COption_SecretKeyZ_clone_ptr(arg_conv);
23328         return ret_conv;
23329 }
23330
23331 uint64_t  __attribute__((export_name("TS_COption_SecretKeyZ_clone"))) TS_COption_SecretKeyZ_clone(uint64_t orig) {
23332         LDKCOption_SecretKeyZ* orig_conv = (LDKCOption_SecretKeyZ*)untag_ptr(orig);
23333         LDKCOption_SecretKeyZ *ret_copy = MALLOC(sizeof(LDKCOption_SecretKeyZ), "LDKCOption_SecretKeyZ");
23334         *ret_copy = COption_SecretKeyZ_clone(orig_conv);
23335         uint64_t ret_ref = tag_ptr(ret_copy, true);
23336         return ret_ref;
23337 }
23338
23339 uint64_t  __attribute__((export_name("TS_CResult_VerifiedInvoiceRequestNoneZ_ok"))) TS_CResult_VerifiedInvoiceRequestNoneZ_ok(uint64_t o) {
23340         LDKVerifiedInvoiceRequest o_conv;
23341         o_conv.inner = untag_ptr(o);
23342         o_conv.is_owned = ptr_is_owned(o);
23343         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
23344         o_conv = VerifiedInvoiceRequest_clone(&o_conv);
23345         LDKCResult_VerifiedInvoiceRequestNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_VerifiedInvoiceRequestNoneZ), "LDKCResult_VerifiedInvoiceRequestNoneZ");
23346         *ret_conv = CResult_VerifiedInvoiceRequestNoneZ_ok(o_conv);
23347         return tag_ptr(ret_conv, true);
23348 }
23349
23350 uint64_t  __attribute__((export_name("TS_CResult_VerifiedInvoiceRequestNoneZ_err"))) TS_CResult_VerifiedInvoiceRequestNoneZ_err() {
23351         LDKCResult_VerifiedInvoiceRequestNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_VerifiedInvoiceRequestNoneZ), "LDKCResult_VerifiedInvoiceRequestNoneZ");
23352         *ret_conv = CResult_VerifiedInvoiceRequestNoneZ_err();
23353         return tag_ptr(ret_conv, true);
23354 }
23355
23356 jboolean  __attribute__((export_name("TS_CResult_VerifiedInvoiceRequestNoneZ_is_ok"))) TS_CResult_VerifiedInvoiceRequestNoneZ_is_ok(uint64_t o) {
23357         LDKCResult_VerifiedInvoiceRequestNoneZ* o_conv = (LDKCResult_VerifiedInvoiceRequestNoneZ*)untag_ptr(o);
23358         jboolean ret_conv = CResult_VerifiedInvoiceRequestNoneZ_is_ok(o_conv);
23359         return ret_conv;
23360 }
23361
23362 void  __attribute__((export_name("TS_CResult_VerifiedInvoiceRequestNoneZ_free"))) TS_CResult_VerifiedInvoiceRequestNoneZ_free(uint64_t _res) {
23363         if (!ptr_is_owned(_res)) return;
23364         void* _res_ptr = untag_ptr(_res);
23365         CHECK_ACCESS(_res_ptr);
23366         LDKCResult_VerifiedInvoiceRequestNoneZ _res_conv = *(LDKCResult_VerifiedInvoiceRequestNoneZ*)(_res_ptr);
23367         FREE(untag_ptr(_res));
23368         CResult_VerifiedInvoiceRequestNoneZ_free(_res_conv);
23369 }
23370
23371 static inline uint64_t CResult_VerifiedInvoiceRequestNoneZ_clone_ptr(LDKCResult_VerifiedInvoiceRequestNoneZ *NONNULL_PTR arg) {
23372         LDKCResult_VerifiedInvoiceRequestNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_VerifiedInvoiceRequestNoneZ), "LDKCResult_VerifiedInvoiceRequestNoneZ");
23373         *ret_conv = CResult_VerifiedInvoiceRequestNoneZ_clone(arg);
23374         return tag_ptr(ret_conv, true);
23375 }
23376 int64_t  __attribute__((export_name("TS_CResult_VerifiedInvoiceRequestNoneZ_clone_ptr"))) TS_CResult_VerifiedInvoiceRequestNoneZ_clone_ptr(uint64_t arg) {
23377         LDKCResult_VerifiedInvoiceRequestNoneZ* arg_conv = (LDKCResult_VerifiedInvoiceRequestNoneZ*)untag_ptr(arg);
23378         int64_t ret_conv = CResult_VerifiedInvoiceRequestNoneZ_clone_ptr(arg_conv);
23379         return ret_conv;
23380 }
23381
23382 uint64_t  __attribute__((export_name("TS_CResult_VerifiedInvoiceRequestNoneZ_clone"))) TS_CResult_VerifiedInvoiceRequestNoneZ_clone(uint64_t orig) {
23383         LDKCResult_VerifiedInvoiceRequestNoneZ* orig_conv = (LDKCResult_VerifiedInvoiceRequestNoneZ*)untag_ptr(orig);
23384         LDKCResult_VerifiedInvoiceRequestNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_VerifiedInvoiceRequestNoneZ), "LDKCResult_VerifiedInvoiceRequestNoneZ");
23385         *ret_conv = CResult_VerifiedInvoiceRequestNoneZ_clone(orig_conv);
23386         return tag_ptr(ret_conv, true);
23387 }
23388
23389 uint32_t  __attribute__((export_name("TS_COption_NoneZ_some"))) TS_COption_NoneZ_some() {
23390         uint32_t ret_conv = LDKCOption_NoneZ_to_js(COption_NoneZ_some());
23391         return ret_conv;
23392 }
23393
23394 uint32_t  __attribute__((export_name("TS_COption_NoneZ_none"))) TS_COption_NoneZ_none() {
23395         uint32_t ret_conv = LDKCOption_NoneZ_to_js(COption_NoneZ_none());
23396         return ret_conv;
23397 }
23398
23399 void  __attribute__((export_name("TS_COption_NoneZ_free"))) TS_COption_NoneZ_free(uint32_t _res) {
23400         LDKCOption_NoneZ _res_conv = LDKCOption_NoneZ_from_js(_res);
23401         COption_NoneZ_free(_res_conv);
23402 }
23403
23404 void  __attribute__((export_name("TS_CVec_WitnessZ_free"))) TS_CVec_WitnessZ_free(ptrArray _res) {
23405         LDKCVec_WitnessZ _res_constr;
23406         _res_constr.datalen = _res->arr_len;
23407         if (_res_constr.datalen > 0)
23408                 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKWitness), "LDKCVec_WitnessZ Elements");
23409         else
23410                 _res_constr.data = NULL;
23411         int8_tArray* _res_vals = (void*) _res->elems;
23412         for (size_t m = 0; m < _res_constr.datalen; m++) {
23413                 int8_tArray _res_conv_12 = _res_vals[m];
23414                 LDKWitness _res_conv_12_ref;
23415                 _res_conv_12_ref.datalen = _res_conv_12->arr_len;
23416                 _res_conv_12_ref.data = MALLOC(_res_conv_12_ref.datalen, "LDKWitness Bytes");
23417                 memcpy(_res_conv_12_ref.data, _res_conv_12->elems, _res_conv_12_ref.datalen); FREE(_res_conv_12);
23418                 _res_conv_12_ref.data_is_owned = true;
23419                 _res_constr.data[m] = _res_conv_12_ref;
23420         }
23421         FREE(_res);
23422         CVec_WitnessZ_free(_res_constr);
23423 }
23424
23425 uint64_t  __attribute__((export_name("TS_COption_i64Z_some"))) TS_COption_i64Z_some(int64_t o) {
23426         LDKCOption_i64Z *ret_copy = MALLOC(sizeof(LDKCOption_i64Z), "LDKCOption_i64Z");
23427         *ret_copy = COption_i64Z_some(o);
23428         uint64_t ret_ref = tag_ptr(ret_copy, true);
23429         return ret_ref;
23430 }
23431
23432 uint64_t  __attribute__((export_name("TS_COption_i64Z_none"))) TS_COption_i64Z_none() {
23433         LDKCOption_i64Z *ret_copy = MALLOC(sizeof(LDKCOption_i64Z), "LDKCOption_i64Z");
23434         *ret_copy = COption_i64Z_none();
23435         uint64_t ret_ref = tag_ptr(ret_copy, true);
23436         return ret_ref;
23437 }
23438
23439 void  __attribute__((export_name("TS_COption_i64Z_free"))) TS_COption_i64Z_free(uint64_t _res) {
23440         if (!ptr_is_owned(_res)) return;
23441         void* _res_ptr = untag_ptr(_res);
23442         CHECK_ACCESS(_res_ptr);
23443         LDKCOption_i64Z _res_conv = *(LDKCOption_i64Z*)(_res_ptr);
23444         FREE(untag_ptr(_res));
23445         COption_i64Z_free(_res_conv);
23446 }
23447
23448 static inline uint64_t COption_i64Z_clone_ptr(LDKCOption_i64Z *NONNULL_PTR arg) {
23449         LDKCOption_i64Z *ret_copy = MALLOC(sizeof(LDKCOption_i64Z), "LDKCOption_i64Z");
23450         *ret_copy = COption_i64Z_clone(arg);
23451         uint64_t ret_ref = tag_ptr(ret_copy, true);
23452         return ret_ref;
23453 }
23454 int64_t  __attribute__((export_name("TS_COption_i64Z_clone_ptr"))) TS_COption_i64Z_clone_ptr(uint64_t arg) {
23455         LDKCOption_i64Z* arg_conv = (LDKCOption_i64Z*)untag_ptr(arg);
23456         int64_t ret_conv = COption_i64Z_clone_ptr(arg_conv);
23457         return ret_conv;
23458 }
23459
23460 uint64_t  __attribute__((export_name("TS_COption_i64Z_clone"))) TS_COption_i64Z_clone(uint64_t orig) {
23461         LDKCOption_i64Z* orig_conv = (LDKCOption_i64Z*)untag_ptr(orig);
23462         LDKCOption_i64Z *ret_copy = MALLOC(sizeof(LDKCOption_i64Z), "LDKCOption_i64Z");
23463         *ret_copy = COption_i64Z_clone(orig_conv);
23464         uint64_t ret_ref = tag_ptr(ret_copy, true);
23465         return ret_ref;
23466 }
23467
23468 uint64_t  __attribute__((export_name("TS_CResult_SocketAddressDecodeErrorZ_ok"))) TS_CResult_SocketAddressDecodeErrorZ_ok(uint64_t o) {
23469         void* o_ptr = untag_ptr(o);
23470         CHECK_ACCESS(o_ptr);
23471         LDKSocketAddress o_conv = *(LDKSocketAddress*)(o_ptr);
23472         o_conv = SocketAddress_clone((LDKSocketAddress*)untag_ptr(o));
23473         LDKCResult_SocketAddressDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_SocketAddressDecodeErrorZ), "LDKCResult_SocketAddressDecodeErrorZ");
23474         *ret_conv = CResult_SocketAddressDecodeErrorZ_ok(o_conv);
23475         return tag_ptr(ret_conv, true);
23476 }
23477
23478 uint64_t  __attribute__((export_name("TS_CResult_SocketAddressDecodeErrorZ_err"))) TS_CResult_SocketAddressDecodeErrorZ_err(uint64_t e) {
23479         void* e_ptr = untag_ptr(e);
23480         CHECK_ACCESS(e_ptr);
23481         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
23482         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
23483         LDKCResult_SocketAddressDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_SocketAddressDecodeErrorZ), "LDKCResult_SocketAddressDecodeErrorZ");
23484         *ret_conv = CResult_SocketAddressDecodeErrorZ_err(e_conv);
23485         return tag_ptr(ret_conv, true);
23486 }
23487
23488 jboolean  __attribute__((export_name("TS_CResult_SocketAddressDecodeErrorZ_is_ok"))) TS_CResult_SocketAddressDecodeErrorZ_is_ok(uint64_t o) {
23489         LDKCResult_SocketAddressDecodeErrorZ* o_conv = (LDKCResult_SocketAddressDecodeErrorZ*)untag_ptr(o);
23490         jboolean ret_conv = CResult_SocketAddressDecodeErrorZ_is_ok(o_conv);
23491         return ret_conv;
23492 }
23493
23494 void  __attribute__((export_name("TS_CResult_SocketAddressDecodeErrorZ_free"))) TS_CResult_SocketAddressDecodeErrorZ_free(uint64_t _res) {
23495         if (!ptr_is_owned(_res)) return;
23496         void* _res_ptr = untag_ptr(_res);
23497         CHECK_ACCESS(_res_ptr);
23498         LDKCResult_SocketAddressDecodeErrorZ _res_conv = *(LDKCResult_SocketAddressDecodeErrorZ*)(_res_ptr);
23499         FREE(untag_ptr(_res));
23500         CResult_SocketAddressDecodeErrorZ_free(_res_conv);
23501 }
23502
23503 static inline uint64_t CResult_SocketAddressDecodeErrorZ_clone_ptr(LDKCResult_SocketAddressDecodeErrorZ *NONNULL_PTR arg) {
23504         LDKCResult_SocketAddressDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_SocketAddressDecodeErrorZ), "LDKCResult_SocketAddressDecodeErrorZ");
23505         *ret_conv = CResult_SocketAddressDecodeErrorZ_clone(arg);
23506         return tag_ptr(ret_conv, true);
23507 }
23508 int64_t  __attribute__((export_name("TS_CResult_SocketAddressDecodeErrorZ_clone_ptr"))) TS_CResult_SocketAddressDecodeErrorZ_clone_ptr(uint64_t arg) {
23509         LDKCResult_SocketAddressDecodeErrorZ* arg_conv = (LDKCResult_SocketAddressDecodeErrorZ*)untag_ptr(arg);
23510         int64_t ret_conv = CResult_SocketAddressDecodeErrorZ_clone_ptr(arg_conv);
23511         return ret_conv;
23512 }
23513
23514 uint64_t  __attribute__((export_name("TS_CResult_SocketAddressDecodeErrorZ_clone"))) TS_CResult_SocketAddressDecodeErrorZ_clone(uint64_t orig) {
23515         LDKCResult_SocketAddressDecodeErrorZ* orig_conv = (LDKCResult_SocketAddressDecodeErrorZ*)untag_ptr(orig);
23516         LDKCResult_SocketAddressDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_SocketAddressDecodeErrorZ), "LDKCResult_SocketAddressDecodeErrorZ");
23517         *ret_conv = CResult_SocketAddressDecodeErrorZ_clone(orig_conv);
23518         return tag_ptr(ret_conv, true);
23519 }
23520
23521 uint64_t  __attribute__((export_name("TS_CResult_SocketAddressSocketAddressParseErrorZ_ok"))) TS_CResult_SocketAddressSocketAddressParseErrorZ_ok(uint64_t o) {
23522         void* o_ptr = untag_ptr(o);
23523         CHECK_ACCESS(o_ptr);
23524         LDKSocketAddress o_conv = *(LDKSocketAddress*)(o_ptr);
23525         o_conv = SocketAddress_clone((LDKSocketAddress*)untag_ptr(o));
23526         LDKCResult_SocketAddressSocketAddressParseErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_SocketAddressSocketAddressParseErrorZ), "LDKCResult_SocketAddressSocketAddressParseErrorZ");
23527         *ret_conv = CResult_SocketAddressSocketAddressParseErrorZ_ok(o_conv);
23528         return tag_ptr(ret_conv, true);
23529 }
23530
23531 uint64_t  __attribute__((export_name("TS_CResult_SocketAddressSocketAddressParseErrorZ_err"))) TS_CResult_SocketAddressSocketAddressParseErrorZ_err(uint32_t e) {
23532         LDKSocketAddressParseError e_conv = LDKSocketAddressParseError_from_js(e);
23533         LDKCResult_SocketAddressSocketAddressParseErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_SocketAddressSocketAddressParseErrorZ), "LDKCResult_SocketAddressSocketAddressParseErrorZ");
23534         *ret_conv = CResult_SocketAddressSocketAddressParseErrorZ_err(e_conv);
23535         return tag_ptr(ret_conv, true);
23536 }
23537
23538 jboolean  __attribute__((export_name("TS_CResult_SocketAddressSocketAddressParseErrorZ_is_ok"))) TS_CResult_SocketAddressSocketAddressParseErrorZ_is_ok(uint64_t o) {
23539         LDKCResult_SocketAddressSocketAddressParseErrorZ* o_conv = (LDKCResult_SocketAddressSocketAddressParseErrorZ*)untag_ptr(o);
23540         jboolean ret_conv = CResult_SocketAddressSocketAddressParseErrorZ_is_ok(o_conv);
23541         return ret_conv;
23542 }
23543
23544 void  __attribute__((export_name("TS_CResult_SocketAddressSocketAddressParseErrorZ_free"))) TS_CResult_SocketAddressSocketAddressParseErrorZ_free(uint64_t _res) {
23545         if (!ptr_is_owned(_res)) return;
23546         void* _res_ptr = untag_ptr(_res);
23547         CHECK_ACCESS(_res_ptr);
23548         LDKCResult_SocketAddressSocketAddressParseErrorZ _res_conv = *(LDKCResult_SocketAddressSocketAddressParseErrorZ*)(_res_ptr);
23549         FREE(untag_ptr(_res));
23550         CResult_SocketAddressSocketAddressParseErrorZ_free(_res_conv);
23551 }
23552
23553 static inline uint64_t CResult_SocketAddressSocketAddressParseErrorZ_clone_ptr(LDKCResult_SocketAddressSocketAddressParseErrorZ *NONNULL_PTR arg) {
23554         LDKCResult_SocketAddressSocketAddressParseErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_SocketAddressSocketAddressParseErrorZ), "LDKCResult_SocketAddressSocketAddressParseErrorZ");
23555         *ret_conv = CResult_SocketAddressSocketAddressParseErrorZ_clone(arg);
23556         return tag_ptr(ret_conv, true);
23557 }
23558 int64_t  __attribute__((export_name("TS_CResult_SocketAddressSocketAddressParseErrorZ_clone_ptr"))) TS_CResult_SocketAddressSocketAddressParseErrorZ_clone_ptr(uint64_t arg) {
23559         LDKCResult_SocketAddressSocketAddressParseErrorZ* arg_conv = (LDKCResult_SocketAddressSocketAddressParseErrorZ*)untag_ptr(arg);
23560         int64_t ret_conv = CResult_SocketAddressSocketAddressParseErrorZ_clone_ptr(arg_conv);
23561         return ret_conv;
23562 }
23563
23564 uint64_t  __attribute__((export_name("TS_CResult_SocketAddressSocketAddressParseErrorZ_clone"))) TS_CResult_SocketAddressSocketAddressParseErrorZ_clone(uint64_t orig) {
23565         LDKCResult_SocketAddressSocketAddressParseErrorZ* orig_conv = (LDKCResult_SocketAddressSocketAddressParseErrorZ*)untag_ptr(orig);
23566         LDKCResult_SocketAddressSocketAddressParseErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_SocketAddressSocketAddressParseErrorZ), "LDKCResult_SocketAddressSocketAddressParseErrorZ");
23567         *ret_conv = CResult_SocketAddressSocketAddressParseErrorZ_clone(orig_conv);
23568         return tag_ptr(ret_conv, true);
23569 }
23570
23571 void  __attribute__((export_name("TS_CVec_UpdateAddHTLCZ_free"))) TS_CVec_UpdateAddHTLCZ_free(uint64_tArray _res) {
23572         LDKCVec_UpdateAddHTLCZ _res_constr;
23573         _res_constr.datalen = _res->arr_len;
23574         if (_res_constr.datalen > 0)
23575                 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKUpdateAddHTLC), "LDKCVec_UpdateAddHTLCZ Elements");
23576         else
23577                 _res_constr.data = NULL;
23578         uint64_t* _res_vals = _res->elems;
23579         for (size_t p = 0; p < _res_constr.datalen; p++) {
23580                 uint64_t _res_conv_15 = _res_vals[p];
23581                 LDKUpdateAddHTLC _res_conv_15_conv;
23582                 _res_conv_15_conv.inner = untag_ptr(_res_conv_15);
23583                 _res_conv_15_conv.is_owned = ptr_is_owned(_res_conv_15);
23584                 CHECK_INNER_FIELD_ACCESS_OR_NULL(_res_conv_15_conv);
23585                 _res_constr.data[p] = _res_conv_15_conv;
23586         }
23587         FREE(_res);
23588         CVec_UpdateAddHTLCZ_free(_res_constr);
23589 }
23590
23591 void  __attribute__((export_name("TS_CVec_UpdateFulfillHTLCZ_free"))) TS_CVec_UpdateFulfillHTLCZ_free(uint64_tArray _res) {
23592         LDKCVec_UpdateFulfillHTLCZ _res_constr;
23593         _res_constr.datalen = _res->arr_len;
23594         if (_res_constr.datalen > 0)
23595                 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKUpdateFulfillHTLC), "LDKCVec_UpdateFulfillHTLCZ Elements");
23596         else
23597                 _res_constr.data = NULL;
23598         uint64_t* _res_vals = _res->elems;
23599         for (size_t t = 0; t < _res_constr.datalen; t++) {
23600                 uint64_t _res_conv_19 = _res_vals[t];
23601                 LDKUpdateFulfillHTLC _res_conv_19_conv;
23602                 _res_conv_19_conv.inner = untag_ptr(_res_conv_19);
23603                 _res_conv_19_conv.is_owned = ptr_is_owned(_res_conv_19);
23604                 CHECK_INNER_FIELD_ACCESS_OR_NULL(_res_conv_19_conv);
23605                 _res_constr.data[t] = _res_conv_19_conv;
23606         }
23607         FREE(_res);
23608         CVec_UpdateFulfillHTLCZ_free(_res_constr);
23609 }
23610
23611 void  __attribute__((export_name("TS_CVec_UpdateFailHTLCZ_free"))) TS_CVec_UpdateFailHTLCZ_free(uint64_tArray _res) {
23612         LDKCVec_UpdateFailHTLCZ _res_constr;
23613         _res_constr.datalen = _res->arr_len;
23614         if (_res_constr.datalen > 0)
23615                 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKUpdateFailHTLC), "LDKCVec_UpdateFailHTLCZ Elements");
23616         else
23617                 _res_constr.data = NULL;
23618         uint64_t* _res_vals = _res->elems;
23619         for (size_t q = 0; q < _res_constr.datalen; q++) {
23620                 uint64_t _res_conv_16 = _res_vals[q];
23621                 LDKUpdateFailHTLC _res_conv_16_conv;
23622                 _res_conv_16_conv.inner = untag_ptr(_res_conv_16);
23623                 _res_conv_16_conv.is_owned = ptr_is_owned(_res_conv_16);
23624                 CHECK_INNER_FIELD_ACCESS_OR_NULL(_res_conv_16_conv);
23625                 _res_constr.data[q] = _res_conv_16_conv;
23626         }
23627         FREE(_res);
23628         CVec_UpdateFailHTLCZ_free(_res_constr);
23629 }
23630
23631 void  __attribute__((export_name("TS_CVec_UpdateFailMalformedHTLCZ_free"))) TS_CVec_UpdateFailMalformedHTLCZ_free(uint64_tArray _res) {
23632         LDKCVec_UpdateFailMalformedHTLCZ _res_constr;
23633         _res_constr.datalen = _res->arr_len;
23634         if (_res_constr.datalen > 0)
23635                 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKUpdateFailMalformedHTLC), "LDKCVec_UpdateFailMalformedHTLCZ Elements");
23636         else
23637                 _res_constr.data = NULL;
23638         uint64_t* _res_vals = _res->elems;
23639         for (size_t z = 0; z < _res_constr.datalen; z++) {
23640                 uint64_t _res_conv_25 = _res_vals[z];
23641                 LDKUpdateFailMalformedHTLC _res_conv_25_conv;
23642                 _res_conv_25_conv.inner = untag_ptr(_res_conv_25);
23643                 _res_conv_25_conv.is_owned = ptr_is_owned(_res_conv_25);
23644                 CHECK_INNER_FIELD_ACCESS_OR_NULL(_res_conv_25_conv);
23645                 _res_constr.data[z] = _res_conv_25_conv;
23646         }
23647         FREE(_res);
23648         CVec_UpdateFailMalformedHTLCZ_free(_res_constr);
23649 }
23650
23651 uint64_t  __attribute__((export_name("TS_CResult_AcceptChannelDecodeErrorZ_ok"))) TS_CResult_AcceptChannelDecodeErrorZ_ok(uint64_t o) {
23652         LDKAcceptChannel o_conv;
23653         o_conv.inner = untag_ptr(o);
23654         o_conv.is_owned = ptr_is_owned(o);
23655         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
23656         o_conv = AcceptChannel_clone(&o_conv);
23657         LDKCResult_AcceptChannelDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_AcceptChannelDecodeErrorZ), "LDKCResult_AcceptChannelDecodeErrorZ");
23658         *ret_conv = CResult_AcceptChannelDecodeErrorZ_ok(o_conv);
23659         return tag_ptr(ret_conv, true);
23660 }
23661
23662 uint64_t  __attribute__((export_name("TS_CResult_AcceptChannelDecodeErrorZ_err"))) TS_CResult_AcceptChannelDecodeErrorZ_err(uint64_t e) {
23663         void* e_ptr = untag_ptr(e);
23664         CHECK_ACCESS(e_ptr);
23665         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
23666         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
23667         LDKCResult_AcceptChannelDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_AcceptChannelDecodeErrorZ), "LDKCResult_AcceptChannelDecodeErrorZ");
23668         *ret_conv = CResult_AcceptChannelDecodeErrorZ_err(e_conv);
23669         return tag_ptr(ret_conv, true);
23670 }
23671
23672 jboolean  __attribute__((export_name("TS_CResult_AcceptChannelDecodeErrorZ_is_ok"))) TS_CResult_AcceptChannelDecodeErrorZ_is_ok(uint64_t o) {
23673         LDKCResult_AcceptChannelDecodeErrorZ* o_conv = (LDKCResult_AcceptChannelDecodeErrorZ*)untag_ptr(o);
23674         jboolean ret_conv = CResult_AcceptChannelDecodeErrorZ_is_ok(o_conv);
23675         return ret_conv;
23676 }
23677
23678 void  __attribute__((export_name("TS_CResult_AcceptChannelDecodeErrorZ_free"))) TS_CResult_AcceptChannelDecodeErrorZ_free(uint64_t _res) {
23679         if (!ptr_is_owned(_res)) return;
23680         void* _res_ptr = untag_ptr(_res);
23681         CHECK_ACCESS(_res_ptr);
23682         LDKCResult_AcceptChannelDecodeErrorZ _res_conv = *(LDKCResult_AcceptChannelDecodeErrorZ*)(_res_ptr);
23683         FREE(untag_ptr(_res));
23684         CResult_AcceptChannelDecodeErrorZ_free(_res_conv);
23685 }
23686
23687 static inline uint64_t CResult_AcceptChannelDecodeErrorZ_clone_ptr(LDKCResult_AcceptChannelDecodeErrorZ *NONNULL_PTR arg) {
23688         LDKCResult_AcceptChannelDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_AcceptChannelDecodeErrorZ), "LDKCResult_AcceptChannelDecodeErrorZ");
23689         *ret_conv = CResult_AcceptChannelDecodeErrorZ_clone(arg);
23690         return tag_ptr(ret_conv, true);
23691 }
23692 int64_t  __attribute__((export_name("TS_CResult_AcceptChannelDecodeErrorZ_clone_ptr"))) TS_CResult_AcceptChannelDecodeErrorZ_clone_ptr(uint64_t arg) {
23693         LDKCResult_AcceptChannelDecodeErrorZ* arg_conv = (LDKCResult_AcceptChannelDecodeErrorZ*)untag_ptr(arg);
23694         int64_t ret_conv = CResult_AcceptChannelDecodeErrorZ_clone_ptr(arg_conv);
23695         return ret_conv;
23696 }
23697
23698 uint64_t  __attribute__((export_name("TS_CResult_AcceptChannelDecodeErrorZ_clone"))) TS_CResult_AcceptChannelDecodeErrorZ_clone(uint64_t orig) {
23699         LDKCResult_AcceptChannelDecodeErrorZ* orig_conv = (LDKCResult_AcceptChannelDecodeErrorZ*)untag_ptr(orig);
23700         LDKCResult_AcceptChannelDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_AcceptChannelDecodeErrorZ), "LDKCResult_AcceptChannelDecodeErrorZ");
23701         *ret_conv = CResult_AcceptChannelDecodeErrorZ_clone(orig_conv);
23702         return tag_ptr(ret_conv, true);
23703 }
23704
23705 uint64_t  __attribute__((export_name("TS_CResult_AcceptChannelV2DecodeErrorZ_ok"))) TS_CResult_AcceptChannelV2DecodeErrorZ_ok(uint64_t o) {
23706         LDKAcceptChannelV2 o_conv;
23707         o_conv.inner = untag_ptr(o);
23708         o_conv.is_owned = ptr_is_owned(o);
23709         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
23710         o_conv = AcceptChannelV2_clone(&o_conv);
23711         LDKCResult_AcceptChannelV2DecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_AcceptChannelV2DecodeErrorZ), "LDKCResult_AcceptChannelV2DecodeErrorZ");
23712         *ret_conv = CResult_AcceptChannelV2DecodeErrorZ_ok(o_conv);
23713         return tag_ptr(ret_conv, true);
23714 }
23715
23716 uint64_t  __attribute__((export_name("TS_CResult_AcceptChannelV2DecodeErrorZ_err"))) TS_CResult_AcceptChannelV2DecodeErrorZ_err(uint64_t e) {
23717         void* e_ptr = untag_ptr(e);
23718         CHECK_ACCESS(e_ptr);
23719         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
23720         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
23721         LDKCResult_AcceptChannelV2DecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_AcceptChannelV2DecodeErrorZ), "LDKCResult_AcceptChannelV2DecodeErrorZ");
23722         *ret_conv = CResult_AcceptChannelV2DecodeErrorZ_err(e_conv);
23723         return tag_ptr(ret_conv, true);
23724 }
23725
23726 jboolean  __attribute__((export_name("TS_CResult_AcceptChannelV2DecodeErrorZ_is_ok"))) TS_CResult_AcceptChannelV2DecodeErrorZ_is_ok(uint64_t o) {
23727         LDKCResult_AcceptChannelV2DecodeErrorZ* o_conv = (LDKCResult_AcceptChannelV2DecodeErrorZ*)untag_ptr(o);
23728         jboolean ret_conv = CResult_AcceptChannelV2DecodeErrorZ_is_ok(o_conv);
23729         return ret_conv;
23730 }
23731
23732 void  __attribute__((export_name("TS_CResult_AcceptChannelV2DecodeErrorZ_free"))) TS_CResult_AcceptChannelV2DecodeErrorZ_free(uint64_t _res) {
23733         if (!ptr_is_owned(_res)) return;
23734         void* _res_ptr = untag_ptr(_res);
23735         CHECK_ACCESS(_res_ptr);
23736         LDKCResult_AcceptChannelV2DecodeErrorZ _res_conv = *(LDKCResult_AcceptChannelV2DecodeErrorZ*)(_res_ptr);
23737         FREE(untag_ptr(_res));
23738         CResult_AcceptChannelV2DecodeErrorZ_free(_res_conv);
23739 }
23740
23741 static inline uint64_t CResult_AcceptChannelV2DecodeErrorZ_clone_ptr(LDKCResult_AcceptChannelV2DecodeErrorZ *NONNULL_PTR arg) {
23742         LDKCResult_AcceptChannelV2DecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_AcceptChannelV2DecodeErrorZ), "LDKCResult_AcceptChannelV2DecodeErrorZ");
23743         *ret_conv = CResult_AcceptChannelV2DecodeErrorZ_clone(arg);
23744         return tag_ptr(ret_conv, true);
23745 }
23746 int64_t  __attribute__((export_name("TS_CResult_AcceptChannelV2DecodeErrorZ_clone_ptr"))) TS_CResult_AcceptChannelV2DecodeErrorZ_clone_ptr(uint64_t arg) {
23747         LDKCResult_AcceptChannelV2DecodeErrorZ* arg_conv = (LDKCResult_AcceptChannelV2DecodeErrorZ*)untag_ptr(arg);
23748         int64_t ret_conv = CResult_AcceptChannelV2DecodeErrorZ_clone_ptr(arg_conv);
23749         return ret_conv;
23750 }
23751
23752 uint64_t  __attribute__((export_name("TS_CResult_AcceptChannelV2DecodeErrorZ_clone"))) TS_CResult_AcceptChannelV2DecodeErrorZ_clone(uint64_t orig) {
23753         LDKCResult_AcceptChannelV2DecodeErrorZ* orig_conv = (LDKCResult_AcceptChannelV2DecodeErrorZ*)untag_ptr(orig);
23754         LDKCResult_AcceptChannelV2DecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_AcceptChannelV2DecodeErrorZ), "LDKCResult_AcceptChannelV2DecodeErrorZ");
23755         *ret_conv = CResult_AcceptChannelV2DecodeErrorZ_clone(orig_conv);
23756         return tag_ptr(ret_conv, true);
23757 }
23758
23759 uint64_t  __attribute__((export_name("TS_CResult_TxAddInputDecodeErrorZ_ok"))) TS_CResult_TxAddInputDecodeErrorZ_ok(uint64_t o) {
23760         LDKTxAddInput o_conv;
23761         o_conv.inner = untag_ptr(o);
23762         o_conv.is_owned = ptr_is_owned(o);
23763         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
23764         o_conv = TxAddInput_clone(&o_conv);
23765         LDKCResult_TxAddInputDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TxAddInputDecodeErrorZ), "LDKCResult_TxAddInputDecodeErrorZ");
23766         *ret_conv = CResult_TxAddInputDecodeErrorZ_ok(o_conv);
23767         return tag_ptr(ret_conv, true);
23768 }
23769
23770 uint64_t  __attribute__((export_name("TS_CResult_TxAddInputDecodeErrorZ_err"))) TS_CResult_TxAddInputDecodeErrorZ_err(uint64_t e) {
23771         void* e_ptr = untag_ptr(e);
23772         CHECK_ACCESS(e_ptr);
23773         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
23774         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
23775         LDKCResult_TxAddInputDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TxAddInputDecodeErrorZ), "LDKCResult_TxAddInputDecodeErrorZ");
23776         *ret_conv = CResult_TxAddInputDecodeErrorZ_err(e_conv);
23777         return tag_ptr(ret_conv, true);
23778 }
23779
23780 jboolean  __attribute__((export_name("TS_CResult_TxAddInputDecodeErrorZ_is_ok"))) TS_CResult_TxAddInputDecodeErrorZ_is_ok(uint64_t o) {
23781         LDKCResult_TxAddInputDecodeErrorZ* o_conv = (LDKCResult_TxAddInputDecodeErrorZ*)untag_ptr(o);
23782         jboolean ret_conv = CResult_TxAddInputDecodeErrorZ_is_ok(o_conv);
23783         return ret_conv;
23784 }
23785
23786 void  __attribute__((export_name("TS_CResult_TxAddInputDecodeErrorZ_free"))) TS_CResult_TxAddInputDecodeErrorZ_free(uint64_t _res) {
23787         if (!ptr_is_owned(_res)) return;
23788         void* _res_ptr = untag_ptr(_res);
23789         CHECK_ACCESS(_res_ptr);
23790         LDKCResult_TxAddInputDecodeErrorZ _res_conv = *(LDKCResult_TxAddInputDecodeErrorZ*)(_res_ptr);
23791         FREE(untag_ptr(_res));
23792         CResult_TxAddInputDecodeErrorZ_free(_res_conv);
23793 }
23794
23795 static inline uint64_t CResult_TxAddInputDecodeErrorZ_clone_ptr(LDKCResult_TxAddInputDecodeErrorZ *NONNULL_PTR arg) {
23796         LDKCResult_TxAddInputDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TxAddInputDecodeErrorZ), "LDKCResult_TxAddInputDecodeErrorZ");
23797         *ret_conv = CResult_TxAddInputDecodeErrorZ_clone(arg);
23798         return tag_ptr(ret_conv, true);
23799 }
23800 int64_t  __attribute__((export_name("TS_CResult_TxAddInputDecodeErrorZ_clone_ptr"))) TS_CResult_TxAddInputDecodeErrorZ_clone_ptr(uint64_t arg) {
23801         LDKCResult_TxAddInputDecodeErrorZ* arg_conv = (LDKCResult_TxAddInputDecodeErrorZ*)untag_ptr(arg);
23802         int64_t ret_conv = CResult_TxAddInputDecodeErrorZ_clone_ptr(arg_conv);
23803         return ret_conv;
23804 }
23805
23806 uint64_t  __attribute__((export_name("TS_CResult_TxAddInputDecodeErrorZ_clone"))) TS_CResult_TxAddInputDecodeErrorZ_clone(uint64_t orig) {
23807         LDKCResult_TxAddInputDecodeErrorZ* orig_conv = (LDKCResult_TxAddInputDecodeErrorZ*)untag_ptr(orig);
23808         LDKCResult_TxAddInputDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TxAddInputDecodeErrorZ), "LDKCResult_TxAddInputDecodeErrorZ");
23809         *ret_conv = CResult_TxAddInputDecodeErrorZ_clone(orig_conv);
23810         return tag_ptr(ret_conv, true);
23811 }
23812
23813 uint64_t  __attribute__((export_name("TS_CResult_TxAddOutputDecodeErrorZ_ok"))) TS_CResult_TxAddOutputDecodeErrorZ_ok(uint64_t o) {
23814         LDKTxAddOutput o_conv;
23815         o_conv.inner = untag_ptr(o);
23816         o_conv.is_owned = ptr_is_owned(o);
23817         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
23818         o_conv = TxAddOutput_clone(&o_conv);
23819         LDKCResult_TxAddOutputDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TxAddOutputDecodeErrorZ), "LDKCResult_TxAddOutputDecodeErrorZ");
23820         *ret_conv = CResult_TxAddOutputDecodeErrorZ_ok(o_conv);
23821         return tag_ptr(ret_conv, true);
23822 }
23823
23824 uint64_t  __attribute__((export_name("TS_CResult_TxAddOutputDecodeErrorZ_err"))) TS_CResult_TxAddOutputDecodeErrorZ_err(uint64_t e) {
23825         void* e_ptr = untag_ptr(e);
23826         CHECK_ACCESS(e_ptr);
23827         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
23828         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
23829         LDKCResult_TxAddOutputDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TxAddOutputDecodeErrorZ), "LDKCResult_TxAddOutputDecodeErrorZ");
23830         *ret_conv = CResult_TxAddOutputDecodeErrorZ_err(e_conv);
23831         return tag_ptr(ret_conv, true);
23832 }
23833
23834 jboolean  __attribute__((export_name("TS_CResult_TxAddOutputDecodeErrorZ_is_ok"))) TS_CResult_TxAddOutputDecodeErrorZ_is_ok(uint64_t o) {
23835         LDKCResult_TxAddOutputDecodeErrorZ* o_conv = (LDKCResult_TxAddOutputDecodeErrorZ*)untag_ptr(o);
23836         jboolean ret_conv = CResult_TxAddOutputDecodeErrorZ_is_ok(o_conv);
23837         return ret_conv;
23838 }
23839
23840 void  __attribute__((export_name("TS_CResult_TxAddOutputDecodeErrorZ_free"))) TS_CResult_TxAddOutputDecodeErrorZ_free(uint64_t _res) {
23841         if (!ptr_is_owned(_res)) return;
23842         void* _res_ptr = untag_ptr(_res);
23843         CHECK_ACCESS(_res_ptr);
23844         LDKCResult_TxAddOutputDecodeErrorZ _res_conv = *(LDKCResult_TxAddOutputDecodeErrorZ*)(_res_ptr);
23845         FREE(untag_ptr(_res));
23846         CResult_TxAddOutputDecodeErrorZ_free(_res_conv);
23847 }
23848
23849 static inline uint64_t CResult_TxAddOutputDecodeErrorZ_clone_ptr(LDKCResult_TxAddOutputDecodeErrorZ *NONNULL_PTR arg) {
23850         LDKCResult_TxAddOutputDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TxAddOutputDecodeErrorZ), "LDKCResult_TxAddOutputDecodeErrorZ");
23851         *ret_conv = CResult_TxAddOutputDecodeErrorZ_clone(arg);
23852         return tag_ptr(ret_conv, true);
23853 }
23854 int64_t  __attribute__((export_name("TS_CResult_TxAddOutputDecodeErrorZ_clone_ptr"))) TS_CResult_TxAddOutputDecodeErrorZ_clone_ptr(uint64_t arg) {
23855         LDKCResult_TxAddOutputDecodeErrorZ* arg_conv = (LDKCResult_TxAddOutputDecodeErrorZ*)untag_ptr(arg);
23856         int64_t ret_conv = CResult_TxAddOutputDecodeErrorZ_clone_ptr(arg_conv);
23857         return ret_conv;
23858 }
23859
23860 uint64_t  __attribute__((export_name("TS_CResult_TxAddOutputDecodeErrorZ_clone"))) TS_CResult_TxAddOutputDecodeErrorZ_clone(uint64_t orig) {
23861         LDKCResult_TxAddOutputDecodeErrorZ* orig_conv = (LDKCResult_TxAddOutputDecodeErrorZ*)untag_ptr(orig);
23862         LDKCResult_TxAddOutputDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TxAddOutputDecodeErrorZ), "LDKCResult_TxAddOutputDecodeErrorZ");
23863         *ret_conv = CResult_TxAddOutputDecodeErrorZ_clone(orig_conv);
23864         return tag_ptr(ret_conv, true);
23865 }
23866
23867 uint64_t  __attribute__((export_name("TS_CResult_TxRemoveInputDecodeErrorZ_ok"))) TS_CResult_TxRemoveInputDecodeErrorZ_ok(uint64_t o) {
23868         LDKTxRemoveInput o_conv;
23869         o_conv.inner = untag_ptr(o);
23870         o_conv.is_owned = ptr_is_owned(o);
23871         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
23872         o_conv = TxRemoveInput_clone(&o_conv);
23873         LDKCResult_TxRemoveInputDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TxRemoveInputDecodeErrorZ), "LDKCResult_TxRemoveInputDecodeErrorZ");
23874         *ret_conv = CResult_TxRemoveInputDecodeErrorZ_ok(o_conv);
23875         return tag_ptr(ret_conv, true);
23876 }
23877
23878 uint64_t  __attribute__((export_name("TS_CResult_TxRemoveInputDecodeErrorZ_err"))) TS_CResult_TxRemoveInputDecodeErrorZ_err(uint64_t e) {
23879         void* e_ptr = untag_ptr(e);
23880         CHECK_ACCESS(e_ptr);
23881         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
23882         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
23883         LDKCResult_TxRemoveInputDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TxRemoveInputDecodeErrorZ), "LDKCResult_TxRemoveInputDecodeErrorZ");
23884         *ret_conv = CResult_TxRemoveInputDecodeErrorZ_err(e_conv);
23885         return tag_ptr(ret_conv, true);
23886 }
23887
23888 jboolean  __attribute__((export_name("TS_CResult_TxRemoveInputDecodeErrorZ_is_ok"))) TS_CResult_TxRemoveInputDecodeErrorZ_is_ok(uint64_t o) {
23889         LDKCResult_TxRemoveInputDecodeErrorZ* o_conv = (LDKCResult_TxRemoveInputDecodeErrorZ*)untag_ptr(o);
23890         jboolean ret_conv = CResult_TxRemoveInputDecodeErrorZ_is_ok(o_conv);
23891         return ret_conv;
23892 }
23893
23894 void  __attribute__((export_name("TS_CResult_TxRemoveInputDecodeErrorZ_free"))) TS_CResult_TxRemoveInputDecodeErrorZ_free(uint64_t _res) {
23895         if (!ptr_is_owned(_res)) return;
23896         void* _res_ptr = untag_ptr(_res);
23897         CHECK_ACCESS(_res_ptr);
23898         LDKCResult_TxRemoveInputDecodeErrorZ _res_conv = *(LDKCResult_TxRemoveInputDecodeErrorZ*)(_res_ptr);
23899         FREE(untag_ptr(_res));
23900         CResult_TxRemoveInputDecodeErrorZ_free(_res_conv);
23901 }
23902
23903 static inline uint64_t CResult_TxRemoveInputDecodeErrorZ_clone_ptr(LDKCResult_TxRemoveInputDecodeErrorZ *NONNULL_PTR arg) {
23904         LDKCResult_TxRemoveInputDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TxRemoveInputDecodeErrorZ), "LDKCResult_TxRemoveInputDecodeErrorZ");
23905         *ret_conv = CResult_TxRemoveInputDecodeErrorZ_clone(arg);
23906         return tag_ptr(ret_conv, true);
23907 }
23908 int64_t  __attribute__((export_name("TS_CResult_TxRemoveInputDecodeErrorZ_clone_ptr"))) TS_CResult_TxRemoveInputDecodeErrorZ_clone_ptr(uint64_t arg) {
23909         LDKCResult_TxRemoveInputDecodeErrorZ* arg_conv = (LDKCResult_TxRemoveInputDecodeErrorZ*)untag_ptr(arg);
23910         int64_t ret_conv = CResult_TxRemoveInputDecodeErrorZ_clone_ptr(arg_conv);
23911         return ret_conv;
23912 }
23913
23914 uint64_t  __attribute__((export_name("TS_CResult_TxRemoveInputDecodeErrorZ_clone"))) TS_CResult_TxRemoveInputDecodeErrorZ_clone(uint64_t orig) {
23915         LDKCResult_TxRemoveInputDecodeErrorZ* orig_conv = (LDKCResult_TxRemoveInputDecodeErrorZ*)untag_ptr(orig);
23916         LDKCResult_TxRemoveInputDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TxRemoveInputDecodeErrorZ), "LDKCResult_TxRemoveInputDecodeErrorZ");
23917         *ret_conv = CResult_TxRemoveInputDecodeErrorZ_clone(orig_conv);
23918         return tag_ptr(ret_conv, true);
23919 }
23920
23921 uint64_t  __attribute__((export_name("TS_CResult_TxRemoveOutputDecodeErrorZ_ok"))) TS_CResult_TxRemoveOutputDecodeErrorZ_ok(uint64_t o) {
23922         LDKTxRemoveOutput o_conv;
23923         o_conv.inner = untag_ptr(o);
23924         o_conv.is_owned = ptr_is_owned(o);
23925         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
23926         o_conv = TxRemoveOutput_clone(&o_conv);
23927         LDKCResult_TxRemoveOutputDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TxRemoveOutputDecodeErrorZ), "LDKCResult_TxRemoveOutputDecodeErrorZ");
23928         *ret_conv = CResult_TxRemoveOutputDecodeErrorZ_ok(o_conv);
23929         return tag_ptr(ret_conv, true);
23930 }
23931
23932 uint64_t  __attribute__((export_name("TS_CResult_TxRemoveOutputDecodeErrorZ_err"))) TS_CResult_TxRemoveOutputDecodeErrorZ_err(uint64_t e) {
23933         void* e_ptr = untag_ptr(e);
23934         CHECK_ACCESS(e_ptr);
23935         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
23936         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
23937         LDKCResult_TxRemoveOutputDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TxRemoveOutputDecodeErrorZ), "LDKCResult_TxRemoveOutputDecodeErrorZ");
23938         *ret_conv = CResult_TxRemoveOutputDecodeErrorZ_err(e_conv);
23939         return tag_ptr(ret_conv, true);
23940 }
23941
23942 jboolean  __attribute__((export_name("TS_CResult_TxRemoveOutputDecodeErrorZ_is_ok"))) TS_CResult_TxRemoveOutputDecodeErrorZ_is_ok(uint64_t o) {
23943         LDKCResult_TxRemoveOutputDecodeErrorZ* o_conv = (LDKCResult_TxRemoveOutputDecodeErrorZ*)untag_ptr(o);
23944         jboolean ret_conv = CResult_TxRemoveOutputDecodeErrorZ_is_ok(o_conv);
23945         return ret_conv;
23946 }
23947
23948 void  __attribute__((export_name("TS_CResult_TxRemoveOutputDecodeErrorZ_free"))) TS_CResult_TxRemoveOutputDecodeErrorZ_free(uint64_t _res) {
23949         if (!ptr_is_owned(_res)) return;
23950         void* _res_ptr = untag_ptr(_res);
23951         CHECK_ACCESS(_res_ptr);
23952         LDKCResult_TxRemoveOutputDecodeErrorZ _res_conv = *(LDKCResult_TxRemoveOutputDecodeErrorZ*)(_res_ptr);
23953         FREE(untag_ptr(_res));
23954         CResult_TxRemoveOutputDecodeErrorZ_free(_res_conv);
23955 }
23956
23957 static inline uint64_t CResult_TxRemoveOutputDecodeErrorZ_clone_ptr(LDKCResult_TxRemoveOutputDecodeErrorZ *NONNULL_PTR arg) {
23958         LDKCResult_TxRemoveOutputDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TxRemoveOutputDecodeErrorZ), "LDKCResult_TxRemoveOutputDecodeErrorZ");
23959         *ret_conv = CResult_TxRemoveOutputDecodeErrorZ_clone(arg);
23960         return tag_ptr(ret_conv, true);
23961 }
23962 int64_t  __attribute__((export_name("TS_CResult_TxRemoveOutputDecodeErrorZ_clone_ptr"))) TS_CResult_TxRemoveOutputDecodeErrorZ_clone_ptr(uint64_t arg) {
23963         LDKCResult_TxRemoveOutputDecodeErrorZ* arg_conv = (LDKCResult_TxRemoveOutputDecodeErrorZ*)untag_ptr(arg);
23964         int64_t ret_conv = CResult_TxRemoveOutputDecodeErrorZ_clone_ptr(arg_conv);
23965         return ret_conv;
23966 }
23967
23968 uint64_t  __attribute__((export_name("TS_CResult_TxRemoveOutputDecodeErrorZ_clone"))) TS_CResult_TxRemoveOutputDecodeErrorZ_clone(uint64_t orig) {
23969         LDKCResult_TxRemoveOutputDecodeErrorZ* orig_conv = (LDKCResult_TxRemoveOutputDecodeErrorZ*)untag_ptr(orig);
23970         LDKCResult_TxRemoveOutputDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TxRemoveOutputDecodeErrorZ), "LDKCResult_TxRemoveOutputDecodeErrorZ");
23971         *ret_conv = CResult_TxRemoveOutputDecodeErrorZ_clone(orig_conv);
23972         return tag_ptr(ret_conv, true);
23973 }
23974
23975 uint64_t  __attribute__((export_name("TS_CResult_TxCompleteDecodeErrorZ_ok"))) TS_CResult_TxCompleteDecodeErrorZ_ok(uint64_t o) {
23976         LDKTxComplete o_conv;
23977         o_conv.inner = untag_ptr(o);
23978         o_conv.is_owned = ptr_is_owned(o);
23979         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
23980         o_conv = TxComplete_clone(&o_conv);
23981         LDKCResult_TxCompleteDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TxCompleteDecodeErrorZ), "LDKCResult_TxCompleteDecodeErrorZ");
23982         *ret_conv = CResult_TxCompleteDecodeErrorZ_ok(o_conv);
23983         return tag_ptr(ret_conv, true);
23984 }
23985
23986 uint64_t  __attribute__((export_name("TS_CResult_TxCompleteDecodeErrorZ_err"))) TS_CResult_TxCompleteDecodeErrorZ_err(uint64_t e) {
23987         void* e_ptr = untag_ptr(e);
23988         CHECK_ACCESS(e_ptr);
23989         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
23990         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
23991         LDKCResult_TxCompleteDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TxCompleteDecodeErrorZ), "LDKCResult_TxCompleteDecodeErrorZ");
23992         *ret_conv = CResult_TxCompleteDecodeErrorZ_err(e_conv);
23993         return tag_ptr(ret_conv, true);
23994 }
23995
23996 jboolean  __attribute__((export_name("TS_CResult_TxCompleteDecodeErrorZ_is_ok"))) TS_CResult_TxCompleteDecodeErrorZ_is_ok(uint64_t o) {
23997         LDKCResult_TxCompleteDecodeErrorZ* o_conv = (LDKCResult_TxCompleteDecodeErrorZ*)untag_ptr(o);
23998         jboolean ret_conv = CResult_TxCompleteDecodeErrorZ_is_ok(o_conv);
23999         return ret_conv;
24000 }
24001
24002 void  __attribute__((export_name("TS_CResult_TxCompleteDecodeErrorZ_free"))) TS_CResult_TxCompleteDecodeErrorZ_free(uint64_t _res) {
24003         if (!ptr_is_owned(_res)) return;
24004         void* _res_ptr = untag_ptr(_res);
24005         CHECK_ACCESS(_res_ptr);
24006         LDKCResult_TxCompleteDecodeErrorZ _res_conv = *(LDKCResult_TxCompleteDecodeErrorZ*)(_res_ptr);
24007         FREE(untag_ptr(_res));
24008         CResult_TxCompleteDecodeErrorZ_free(_res_conv);
24009 }
24010
24011 static inline uint64_t CResult_TxCompleteDecodeErrorZ_clone_ptr(LDKCResult_TxCompleteDecodeErrorZ *NONNULL_PTR arg) {
24012         LDKCResult_TxCompleteDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TxCompleteDecodeErrorZ), "LDKCResult_TxCompleteDecodeErrorZ");
24013         *ret_conv = CResult_TxCompleteDecodeErrorZ_clone(arg);
24014         return tag_ptr(ret_conv, true);
24015 }
24016 int64_t  __attribute__((export_name("TS_CResult_TxCompleteDecodeErrorZ_clone_ptr"))) TS_CResult_TxCompleteDecodeErrorZ_clone_ptr(uint64_t arg) {
24017         LDKCResult_TxCompleteDecodeErrorZ* arg_conv = (LDKCResult_TxCompleteDecodeErrorZ*)untag_ptr(arg);
24018         int64_t ret_conv = CResult_TxCompleteDecodeErrorZ_clone_ptr(arg_conv);
24019         return ret_conv;
24020 }
24021
24022 uint64_t  __attribute__((export_name("TS_CResult_TxCompleteDecodeErrorZ_clone"))) TS_CResult_TxCompleteDecodeErrorZ_clone(uint64_t orig) {
24023         LDKCResult_TxCompleteDecodeErrorZ* orig_conv = (LDKCResult_TxCompleteDecodeErrorZ*)untag_ptr(orig);
24024         LDKCResult_TxCompleteDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TxCompleteDecodeErrorZ), "LDKCResult_TxCompleteDecodeErrorZ");
24025         *ret_conv = CResult_TxCompleteDecodeErrorZ_clone(orig_conv);
24026         return tag_ptr(ret_conv, true);
24027 }
24028
24029 uint64_t  __attribute__((export_name("TS_CResult_TxSignaturesDecodeErrorZ_ok"))) TS_CResult_TxSignaturesDecodeErrorZ_ok(uint64_t o) {
24030         LDKTxSignatures o_conv;
24031         o_conv.inner = untag_ptr(o);
24032         o_conv.is_owned = ptr_is_owned(o);
24033         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
24034         o_conv = TxSignatures_clone(&o_conv);
24035         LDKCResult_TxSignaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TxSignaturesDecodeErrorZ), "LDKCResult_TxSignaturesDecodeErrorZ");
24036         *ret_conv = CResult_TxSignaturesDecodeErrorZ_ok(o_conv);
24037         return tag_ptr(ret_conv, true);
24038 }
24039
24040 uint64_t  __attribute__((export_name("TS_CResult_TxSignaturesDecodeErrorZ_err"))) TS_CResult_TxSignaturesDecodeErrorZ_err(uint64_t e) {
24041         void* e_ptr = untag_ptr(e);
24042         CHECK_ACCESS(e_ptr);
24043         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
24044         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
24045         LDKCResult_TxSignaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TxSignaturesDecodeErrorZ), "LDKCResult_TxSignaturesDecodeErrorZ");
24046         *ret_conv = CResult_TxSignaturesDecodeErrorZ_err(e_conv);
24047         return tag_ptr(ret_conv, true);
24048 }
24049
24050 jboolean  __attribute__((export_name("TS_CResult_TxSignaturesDecodeErrorZ_is_ok"))) TS_CResult_TxSignaturesDecodeErrorZ_is_ok(uint64_t o) {
24051         LDKCResult_TxSignaturesDecodeErrorZ* o_conv = (LDKCResult_TxSignaturesDecodeErrorZ*)untag_ptr(o);
24052         jboolean ret_conv = CResult_TxSignaturesDecodeErrorZ_is_ok(o_conv);
24053         return ret_conv;
24054 }
24055
24056 void  __attribute__((export_name("TS_CResult_TxSignaturesDecodeErrorZ_free"))) TS_CResult_TxSignaturesDecodeErrorZ_free(uint64_t _res) {
24057         if (!ptr_is_owned(_res)) return;
24058         void* _res_ptr = untag_ptr(_res);
24059         CHECK_ACCESS(_res_ptr);
24060         LDKCResult_TxSignaturesDecodeErrorZ _res_conv = *(LDKCResult_TxSignaturesDecodeErrorZ*)(_res_ptr);
24061         FREE(untag_ptr(_res));
24062         CResult_TxSignaturesDecodeErrorZ_free(_res_conv);
24063 }
24064
24065 static inline uint64_t CResult_TxSignaturesDecodeErrorZ_clone_ptr(LDKCResult_TxSignaturesDecodeErrorZ *NONNULL_PTR arg) {
24066         LDKCResult_TxSignaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TxSignaturesDecodeErrorZ), "LDKCResult_TxSignaturesDecodeErrorZ");
24067         *ret_conv = CResult_TxSignaturesDecodeErrorZ_clone(arg);
24068         return tag_ptr(ret_conv, true);
24069 }
24070 int64_t  __attribute__((export_name("TS_CResult_TxSignaturesDecodeErrorZ_clone_ptr"))) TS_CResult_TxSignaturesDecodeErrorZ_clone_ptr(uint64_t arg) {
24071         LDKCResult_TxSignaturesDecodeErrorZ* arg_conv = (LDKCResult_TxSignaturesDecodeErrorZ*)untag_ptr(arg);
24072         int64_t ret_conv = CResult_TxSignaturesDecodeErrorZ_clone_ptr(arg_conv);
24073         return ret_conv;
24074 }
24075
24076 uint64_t  __attribute__((export_name("TS_CResult_TxSignaturesDecodeErrorZ_clone"))) TS_CResult_TxSignaturesDecodeErrorZ_clone(uint64_t orig) {
24077         LDKCResult_TxSignaturesDecodeErrorZ* orig_conv = (LDKCResult_TxSignaturesDecodeErrorZ*)untag_ptr(orig);
24078         LDKCResult_TxSignaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TxSignaturesDecodeErrorZ), "LDKCResult_TxSignaturesDecodeErrorZ");
24079         *ret_conv = CResult_TxSignaturesDecodeErrorZ_clone(orig_conv);
24080         return tag_ptr(ret_conv, true);
24081 }
24082
24083 uint64_t  __attribute__((export_name("TS_CResult_TxInitRbfDecodeErrorZ_ok"))) TS_CResult_TxInitRbfDecodeErrorZ_ok(uint64_t o) {
24084         LDKTxInitRbf o_conv;
24085         o_conv.inner = untag_ptr(o);
24086         o_conv.is_owned = ptr_is_owned(o);
24087         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
24088         o_conv = TxInitRbf_clone(&o_conv);
24089         LDKCResult_TxInitRbfDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TxInitRbfDecodeErrorZ), "LDKCResult_TxInitRbfDecodeErrorZ");
24090         *ret_conv = CResult_TxInitRbfDecodeErrorZ_ok(o_conv);
24091         return tag_ptr(ret_conv, true);
24092 }
24093
24094 uint64_t  __attribute__((export_name("TS_CResult_TxInitRbfDecodeErrorZ_err"))) TS_CResult_TxInitRbfDecodeErrorZ_err(uint64_t e) {
24095         void* e_ptr = untag_ptr(e);
24096         CHECK_ACCESS(e_ptr);
24097         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
24098         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
24099         LDKCResult_TxInitRbfDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TxInitRbfDecodeErrorZ), "LDKCResult_TxInitRbfDecodeErrorZ");
24100         *ret_conv = CResult_TxInitRbfDecodeErrorZ_err(e_conv);
24101         return tag_ptr(ret_conv, true);
24102 }
24103
24104 jboolean  __attribute__((export_name("TS_CResult_TxInitRbfDecodeErrorZ_is_ok"))) TS_CResult_TxInitRbfDecodeErrorZ_is_ok(uint64_t o) {
24105         LDKCResult_TxInitRbfDecodeErrorZ* o_conv = (LDKCResult_TxInitRbfDecodeErrorZ*)untag_ptr(o);
24106         jboolean ret_conv = CResult_TxInitRbfDecodeErrorZ_is_ok(o_conv);
24107         return ret_conv;
24108 }
24109
24110 void  __attribute__((export_name("TS_CResult_TxInitRbfDecodeErrorZ_free"))) TS_CResult_TxInitRbfDecodeErrorZ_free(uint64_t _res) {
24111         if (!ptr_is_owned(_res)) return;
24112         void* _res_ptr = untag_ptr(_res);
24113         CHECK_ACCESS(_res_ptr);
24114         LDKCResult_TxInitRbfDecodeErrorZ _res_conv = *(LDKCResult_TxInitRbfDecodeErrorZ*)(_res_ptr);
24115         FREE(untag_ptr(_res));
24116         CResult_TxInitRbfDecodeErrorZ_free(_res_conv);
24117 }
24118
24119 static inline uint64_t CResult_TxInitRbfDecodeErrorZ_clone_ptr(LDKCResult_TxInitRbfDecodeErrorZ *NONNULL_PTR arg) {
24120         LDKCResult_TxInitRbfDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TxInitRbfDecodeErrorZ), "LDKCResult_TxInitRbfDecodeErrorZ");
24121         *ret_conv = CResult_TxInitRbfDecodeErrorZ_clone(arg);
24122         return tag_ptr(ret_conv, true);
24123 }
24124 int64_t  __attribute__((export_name("TS_CResult_TxInitRbfDecodeErrorZ_clone_ptr"))) TS_CResult_TxInitRbfDecodeErrorZ_clone_ptr(uint64_t arg) {
24125         LDKCResult_TxInitRbfDecodeErrorZ* arg_conv = (LDKCResult_TxInitRbfDecodeErrorZ*)untag_ptr(arg);
24126         int64_t ret_conv = CResult_TxInitRbfDecodeErrorZ_clone_ptr(arg_conv);
24127         return ret_conv;
24128 }
24129
24130 uint64_t  __attribute__((export_name("TS_CResult_TxInitRbfDecodeErrorZ_clone"))) TS_CResult_TxInitRbfDecodeErrorZ_clone(uint64_t orig) {
24131         LDKCResult_TxInitRbfDecodeErrorZ* orig_conv = (LDKCResult_TxInitRbfDecodeErrorZ*)untag_ptr(orig);
24132         LDKCResult_TxInitRbfDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TxInitRbfDecodeErrorZ), "LDKCResult_TxInitRbfDecodeErrorZ");
24133         *ret_conv = CResult_TxInitRbfDecodeErrorZ_clone(orig_conv);
24134         return tag_ptr(ret_conv, true);
24135 }
24136
24137 uint64_t  __attribute__((export_name("TS_CResult_TxAckRbfDecodeErrorZ_ok"))) TS_CResult_TxAckRbfDecodeErrorZ_ok(uint64_t o) {
24138         LDKTxAckRbf o_conv;
24139         o_conv.inner = untag_ptr(o);
24140         o_conv.is_owned = ptr_is_owned(o);
24141         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
24142         o_conv = TxAckRbf_clone(&o_conv);
24143         LDKCResult_TxAckRbfDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TxAckRbfDecodeErrorZ), "LDKCResult_TxAckRbfDecodeErrorZ");
24144         *ret_conv = CResult_TxAckRbfDecodeErrorZ_ok(o_conv);
24145         return tag_ptr(ret_conv, true);
24146 }
24147
24148 uint64_t  __attribute__((export_name("TS_CResult_TxAckRbfDecodeErrorZ_err"))) TS_CResult_TxAckRbfDecodeErrorZ_err(uint64_t e) {
24149         void* e_ptr = untag_ptr(e);
24150         CHECK_ACCESS(e_ptr);
24151         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
24152         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
24153         LDKCResult_TxAckRbfDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TxAckRbfDecodeErrorZ), "LDKCResult_TxAckRbfDecodeErrorZ");
24154         *ret_conv = CResult_TxAckRbfDecodeErrorZ_err(e_conv);
24155         return tag_ptr(ret_conv, true);
24156 }
24157
24158 jboolean  __attribute__((export_name("TS_CResult_TxAckRbfDecodeErrorZ_is_ok"))) TS_CResult_TxAckRbfDecodeErrorZ_is_ok(uint64_t o) {
24159         LDKCResult_TxAckRbfDecodeErrorZ* o_conv = (LDKCResult_TxAckRbfDecodeErrorZ*)untag_ptr(o);
24160         jboolean ret_conv = CResult_TxAckRbfDecodeErrorZ_is_ok(o_conv);
24161         return ret_conv;
24162 }
24163
24164 void  __attribute__((export_name("TS_CResult_TxAckRbfDecodeErrorZ_free"))) TS_CResult_TxAckRbfDecodeErrorZ_free(uint64_t _res) {
24165         if (!ptr_is_owned(_res)) return;
24166         void* _res_ptr = untag_ptr(_res);
24167         CHECK_ACCESS(_res_ptr);
24168         LDKCResult_TxAckRbfDecodeErrorZ _res_conv = *(LDKCResult_TxAckRbfDecodeErrorZ*)(_res_ptr);
24169         FREE(untag_ptr(_res));
24170         CResult_TxAckRbfDecodeErrorZ_free(_res_conv);
24171 }
24172
24173 static inline uint64_t CResult_TxAckRbfDecodeErrorZ_clone_ptr(LDKCResult_TxAckRbfDecodeErrorZ *NONNULL_PTR arg) {
24174         LDKCResult_TxAckRbfDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TxAckRbfDecodeErrorZ), "LDKCResult_TxAckRbfDecodeErrorZ");
24175         *ret_conv = CResult_TxAckRbfDecodeErrorZ_clone(arg);
24176         return tag_ptr(ret_conv, true);
24177 }
24178 int64_t  __attribute__((export_name("TS_CResult_TxAckRbfDecodeErrorZ_clone_ptr"))) TS_CResult_TxAckRbfDecodeErrorZ_clone_ptr(uint64_t arg) {
24179         LDKCResult_TxAckRbfDecodeErrorZ* arg_conv = (LDKCResult_TxAckRbfDecodeErrorZ*)untag_ptr(arg);
24180         int64_t ret_conv = CResult_TxAckRbfDecodeErrorZ_clone_ptr(arg_conv);
24181         return ret_conv;
24182 }
24183
24184 uint64_t  __attribute__((export_name("TS_CResult_TxAckRbfDecodeErrorZ_clone"))) TS_CResult_TxAckRbfDecodeErrorZ_clone(uint64_t orig) {
24185         LDKCResult_TxAckRbfDecodeErrorZ* orig_conv = (LDKCResult_TxAckRbfDecodeErrorZ*)untag_ptr(orig);
24186         LDKCResult_TxAckRbfDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TxAckRbfDecodeErrorZ), "LDKCResult_TxAckRbfDecodeErrorZ");
24187         *ret_conv = CResult_TxAckRbfDecodeErrorZ_clone(orig_conv);
24188         return tag_ptr(ret_conv, true);
24189 }
24190
24191 uint64_t  __attribute__((export_name("TS_CResult_TxAbortDecodeErrorZ_ok"))) TS_CResult_TxAbortDecodeErrorZ_ok(uint64_t o) {
24192         LDKTxAbort o_conv;
24193         o_conv.inner = untag_ptr(o);
24194         o_conv.is_owned = ptr_is_owned(o);
24195         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
24196         o_conv = TxAbort_clone(&o_conv);
24197         LDKCResult_TxAbortDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TxAbortDecodeErrorZ), "LDKCResult_TxAbortDecodeErrorZ");
24198         *ret_conv = CResult_TxAbortDecodeErrorZ_ok(o_conv);
24199         return tag_ptr(ret_conv, true);
24200 }
24201
24202 uint64_t  __attribute__((export_name("TS_CResult_TxAbortDecodeErrorZ_err"))) TS_CResult_TxAbortDecodeErrorZ_err(uint64_t e) {
24203         void* e_ptr = untag_ptr(e);
24204         CHECK_ACCESS(e_ptr);
24205         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
24206         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
24207         LDKCResult_TxAbortDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TxAbortDecodeErrorZ), "LDKCResult_TxAbortDecodeErrorZ");
24208         *ret_conv = CResult_TxAbortDecodeErrorZ_err(e_conv);
24209         return tag_ptr(ret_conv, true);
24210 }
24211
24212 jboolean  __attribute__((export_name("TS_CResult_TxAbortDecodeErrorZ_is_ok"))) TS_CResult_TxAbortDecodeErrorZ_is_ok(uint64_t o) {
24213         LDKCResult_TxAbortDecodeErrorZ* o_conv = (LDKCResult_TxAbortDecodeErrorZ*)untag_ptr(o);
24214         jboolean ret_conv = CResult_TxAbortDecodeErrorZ_is_ok(o_conv);
24215         return ret_conv;
24216 }
24217
24218 void  __attribute__((export_name("TS_CResult_TxAbortDecodeErrorZ_free"))) TS_CResult_TxAbortDecodeErrorZ_free(uint64_t _res) {
24219         if (!ptr_is_owned(_res)) return;
24220         void* _res_ptr = untag_ptr(_res);
24221         CHECK_ACCESS(_res_ptr);
24222         LDKCResult_TxAbortDecodeErrorZ _res_conv = *(LDKCResult_TxAbortDecodeErrorZ*)(_res_ptr);
24223         FREE(untag_ptr(_res));
24224         CResult_TxAbortDecodeErrorZ_free(_res_conv);
24225 }
24226
24227 static inline uint64_t CResult_TxAbortDecodeErrorZ_clone_ptr(LDKCResult_TxAbortDecodeErrorZ *NONNULL_PTR arg) {
24228         LDKCResult_TxAbortDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TxAbortDecodeErrorZ), "LDKCResult_TxAbortDecodeErrorZ");
24229         *ret_conv = CResult_TxAbortDecodeErrorZ_clone(arg);
24230         return tag_ptr(ret_conv, true);
24231 }
24232 int64_t  __attribute__((export_name("TS_CResult_TxAbortDecodeErrorZ_clone_ptr"))) TS_CResult_TxAbortDecodeErrorZ_clone_ptr(uint64_t arg) {
24233         LDKCResult_TxAbortDecodeErrorZ* arg_conv = (LDKCResult_TxAbortDecodeErrorZ*)untag_ptr(arg);
24234         int64_t ret_conv = CResult_TxAbortDecodeErrorZ_clone_ptr(arg_conv);
24235         return ret_conv;
24236 }
24237
24238 uint64_t  __attribute__((export_name("TS_CResult_TxAbortDecodeErrorZ_clone"))) TS_CResult_TxAbortDecodeErrorZ_clone(uint64_t orig) {
24239         LDKCResult_TxAbortDecodeErrorZ* orig_conv = (LDKCResult_TxAbortDecodeErrorZ*)untag_ptr(orig);
24240         LDKCResult_TxAbortDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TxAbortDecodeErrorZ), "LDKCResult_TxAbortDecodeErrorZ");
24241         *ret_conv = CResult_TxAbortDecodeErrorZ_clone(orig_conv);
24242         return tag_ptr(ret_conv, true);
24243 }
24244
24245 uint64_t  __attribute__((export_name("TS_CResult_AnnouncementSignaturesDecodeErrorZ_ok"))) TS_CResult_AnnouncementSignaturesDecodeErrorZ_ok(uint64_t o) {
24246         LDKAnnouncementSignatures o_conv;
24247         o_conv.inner = untag_ptr(o);
24248         o_conv.is_owned = ptr_is_owned(o);
24249         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
24250         o_conv = AnnouncementSignatures_clone(&o_conv);
24251         LDKCResult_AnnouncementSignaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_AnnouncementSignaturesDecodeErrorZ), "LDKCResult_AnnouncementSignaturesDecodeErrorZ");
24252         *ret_conv = CResult_AnnouncementSignaturesDecodeErrorZ_ok(o_conv);
24253         return tag_ptr(ret_conv, true);
24254 }
24255
24256 uint64_t  __attribute__((export_name("TS_CResult_AnnouncementSignaturesDecodeErrorZ_err"))) TS_CResult_AnnouncementSignaturesDecodeErrorZ_err(uint64_t e) {
24257         void* e_ptr = untag_ptr(e);
24258         CHECK_ACCESS(e_ptr);
24259         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
24260         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
24261         LDKCResult_AnnouncementSignaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_AnnouncementSignaturesDecodeErrorZ), "LDKCResult_AnnouncementSignaturesDecodeErrorZ");
24262         *ret_conv = CResult_AnnouncementSignaturesDecodeErrorZ_err(e_conv);
24263         return tag_ptr(ret_conv, true);
24264 }
24265
24266 jboolean  __attribute__((export_name("TS_CResult_AnnouncementSignaturesDecodeErrorZ_is_ok"))) TS_CResult_AnnouncementSignaturesDecodeErrorZ_is_ok(uint64_t o) {
24267         LDKCResult_AnnouncementSignaturesDecodeErrorZ* o_conv = (LDKCResult_AnnouncementSignaturesDecodeErrorZ*)untag_ptr(o);
24268         jboolean ret_conv = CResult_AnnouncementSignaturesDecodeErrorZ_is_ok(o_conv);
24269         return ret_conv;
24270 }
24271
24272 void  __attribute__((export_name("TS_CResult_AnnouncementSignaturesDecodeErrorZ_free"))) TS_CResult_AnnouncementSignaturesDecodeErrorZ_free(uint64_t _res) {
24273         if (!ptr_is_owned(_res)) return;
24274         void* _res_ptr = untag_ptr(_res);
24275         CHECK_ACCESS(_res_ptr);
24276         LDKCResult_AnnouncementSignaturesDecodeErrorZ _res_conv = *(LDKCResult_AnnouncementSignaturesDecodeErrorZ*)(_res_ptr);
24277         FREE(untag_ptr(_res));
24278         CResult_AnnouncementSignaturesDecodeErrorZ_free(_res_conv);
24279 }
24280
24281 static inline uint64_t CResult_AnnouncementSignaturesDecodeErrorZ_clone_ptr(LDKCResult_AnnouncementSignaturesDecodeErrorZ *NONNULL_PTR arg) {
24282         LDKCResult_AnnouncementSignaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_AnnouncementSignaturesDecodeErrorZ), "LDKCResult_AnnouncementSignaturesDecodeErrorZ");
24283         *ret_conv = CResult_AnnouncementSignaturesDecodeErrorZ_clone(arg);
24284         return tag_ptr(ret_conv, true);
24285 }
24286 int64_t  __attribute__((export_name("TS_CResult_AnnouncementSignaturesDecodeErrorZ_clone_ptr"))) TS_CResult_AnnouncementSignaturesDecodeErrorZ_clone_ptr(uint64_t arg) {
24287         LDKCResult_AnnouncementSignaturesDecodeErrorZ* arg_conv = (LDKCResult_AnnouncementSignaturesDecodeErrorZ*)untag_ptr(arg);
24288         int64_t ret_conv = CResult_AnnouncementSignaturesDecodeErrorZ_clone_ptr(arg_conv);
24289         return ret_conv;
24290 }
24291
24292 uint64_t  __attribute__((export_name("TS_CResult_AnnouncementSignaturesDecodeErrorZ_clone"))) TS_CResult_AnnouncementSignaturesDecodeErrorZ_clone(uint64_t orig) {
24293         LDKCResult_AnnouncementSignaturesDecodeErrorZ* orig_conv = (LDKCResult_AnnouncementSignaturesDecodeErrorZ*)untag_ptr(orig);
24294         LDKCResult_AnnouncementSignaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_AnnouncementSignaturesDecodeErrorZ), "LDKCResult_AnnouncementSignaturesDecodeErrorZ");
24295         *ret_conv = CResult_AnnouncementSignaturesDecodeErrorZ_clone(orig_conv);
24296         return tag_ptr(ret_conv, true);
24297 }
24298
24299 uint64_t  __attribute__((export_name("TS_CResult_ChannelReestablishDecodeErrorZ_ok"))) TS_CResult_ChannelReestablishDecodeErrorZ_ok(uint64_t o) {
24300         LDKChannelReestablish o_conv;
24301         o_conv.inner = untag_ptr(o);
24302         o_conv.is_owned = ptr_is_owned(o);
24303         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
24304         o_conv = ChannelReestablish_clone(&o_conv);
24305         LDKCResult_ChannelReestablishDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelReestablishDecodeErrorZ), "LDKCResult_ChannelReestablishDecodeErrorZ");
24306         *ret_conv = CResult_ChannelReestablishDecodeErrorZ_ok(o_conv);
24307         return tag_ptr(ret_conv, true);
24308 }
24309
24310 uint64_t  __attribute__((export_name("TS_CResult_ChannelReestablishDecodeErrorZ_err"))) TS_CResult_ChannelReestablishDecodeErrorZ_err(uint64_t e) {
24311         void* e_ptr = untag_ptr(e);
24312         CHECK_ACCESS(e_ptr);
24313         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
24314         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
24315         LDKCResult_ChannelReestablishDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelReestablishDecodeErrorZ), "LDKCResult_ChannelReestablishDecodeErrorZ");
24316         *ret_conv = CResult_ChannelReestablishDecodeErrorZ_err(e_conv);
24317         return tag_ptr(ret_conv, true);
24318 }
24319
24320 jboolean  __attribute__((export_name("TS_CResult_ChannelReestablishDecodeErrorZ_is_ok"))) TS_CResult_ChannelReestablishDecodeErrorZ_is_ok(uint64_t o) {
24321         LDKCResult_ChannelReestablishDecodeErrorZ* o_conv = (LDKCResult_ChannelReestablishDecodeErrorZ*)untag_ptr(o);
24322         jboolean ret_conv = CResult_ChannelReestablishDecodeErrorZ_is_ok(o_conv);
24323         return ret_conv;
24324 }
24325
24326 void  __attribute__((export_name("TS_CResult_ChannelReestablishDecodeErrorZ_free"))) TS_CResult_ChannelReestablishDecodeErrorZ_free(uint64_t _res) {
24327         if (!ptr_is_owned(_res)) return;
24328         void* _res_ptr = untag_ptr(_res);
24329         CHECK_ACCESS(_res_ptr);
24330         LDKCResult_ChannelReestablishDecodeErrorZ _res_conv = *(LDKCResult_ChannelReestablishDecodeErrorZ*)(_res_ptr);
24331         FREE(untag_ptr(_res));
24332         CResult_ChannelReestablishDecodeErrorZ_free(_res_conv);
24333 }
24334
24335 static inline uint64_t CResult_ChannelReestablishDecodeErrorZ_clone_ptr(LDKCResult_ChannelReestablishDecodeErrorZ *NONNULL_PTR arg) {
24336         LDKCResult_ChannelReestablishDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelReestablishDecodeErrorZ), "LDKCResult_ChannelReestablishDecodeErrorZ");
24337         *ret_conv = CResult_ChannelReestablishDecodeErrorZ_clone(arg);
24338         return tag_ptr(ret_conv, true);
24339 }
24340 int64_t  __attribute__((export_name("TS_CResult_ChannelReestablishDecodeErrorZ_clone_ptr"))) TS_CResult_ChannelReestablishDecodeErrorZ_clone_ptr(uint64_t arg) {
24341         LDKCResult_ChannelReestablishDecodeErrorZ* arg_conv = (LDKCResult_ChannelReestablishDecodeErrorZ*)untag_ptr(arg);
24342         int64_t ret_conv = CResult_ChannelReestablishDecodeErrorZ_clone_ptr(arg_conv);
24343         return ret_conv;
24344 }
24345
24346 uint64_t  __attribute__((export_name("TS_CResult_ChannelReestablishDecodeErrorZ_clone"))) TS_CResult_ChannelReestablishDecodeErrorZ_clone(uint64_t orig) {
24347         LDKCResult_ChannelReestablishDecodeErrorZ* orig_conv = (LDKCResult_ChannelReestablishDecodeErrorZ*)untag_ptr(orig);
24348         LDKCResult_ChannelReestablishDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelReestablishDecodeErrorZ), "LDKCResult_ChannelReestablishDecodeErrorZ");
24349         *ret_conv = CResult_ChannelReestablishDecodeErrorZ_clone(orig_conv);
24350         return tag_ptr(ret_conv, true);
24351 }
24352
24353 uint64_t  __attribute__((export_name("TS_CResult_ClosingSignedDecodeErrorZ_ok"))) TS_CResult_ClosingSignedDecodeErrorZ_ok(uint64_t o) {
24354         LDKClosingSigned o_conv;
24355         o_conv.inner = untag_ptr(o);
24356         o_conv.is_owned = ptr_is_owned(o);
24357         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
24358         o_conv = ClosingSigned_clone(&o_conv);
24359         LDKCResult_ClosingSignedDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ClosingSignedDecodeErrorZ), "LDKCResult_ClosingSignedDecodeErrorZ");
24360         *ret_conv = CResult_ClosingSignedDecodeErrorZ_ok(o_conv);
24361         return tag_ptr(ret_conv, true);
24362 }
24363
24364 uint64_t  __attribute__((export_name("TS_CResult_ClosingSignedDecodeErrorZ_err"))) TS_CResult_ClosingSignedDecodeErrorZ_err(uint64_t e) {
24365         void* e_ptr = untag_ptr(e);
24366         CHECK_ACCESS(e_ptr);
24367         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
24368         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
24369         LDKCResult_ClosingSignedDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ClosingSignedDecodeErrorZ), "LDKCResult_ClosingSignedDecodeErrorZ");
24370         *ret_conv = CResult_ClosingSignedDecodeErrorZ_err(e_conv);
24371         return tag_ptr(ret_conv, true);
24372 }
24373
24374 jboolean  __attribute__((export_name("TS_CResult_ClosingSignedDecodeErrorZ_is_ok"))) TS_CResult_ClosingSignedDecodeErrorZ_is_ok(uint64_t o) {
24375         LDKCResult_ClosingSignedDecodeErrorZ* o_conv = (LDKCResult_ClosingSignedDecodeErrorZ*)untag_ptr(o);
24376         jboolean ret_conv = CResult_ClosingSignedDecodeErrorZ_is_ok(o_conv);
24377         return ret_conv;
24378 }
24379
24380 void  __attribute__((export_name("TS_CResult_ClosingSignedDecodeErrorZ_free"))) TS_CResult_ClosingSignedDecodeErrorZ_free(uint64_t _res) {
24381         if (!ptr_is_owned(_res)) return;
24382         void* _res_ptr = untag_ptr(_res);
24383         CHECK_ACCESS(_res_ptr);
24384         LDKCResult_ClosingSignedDecodeErrorZ _res_conv = *(LDKCResult_ClosingSignedDecodeErrorZ*)(_res_ptr);
24385         FREE(untag_ptr(_res));
24386         CResult_ClosingSignedDecodeErrorZ_free(_res_conv);
24387 }
24388
24389 static inline uint64_t CResult_ClosingSignedDecodeErrorZ_clone_ptr(LDKCResult_ClosingSignedDecodeErrorZ *NONNULL_PTR arg) {
24390         LDKCResult_ClosingSignedDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ClosingSignedDecodeErrorZ), "LDKCResult_ClosingSignedDecodeErrorZ");
24391         *ret_conv = CResult_ClosingSignedDecodeErrorZ_clone(arg);
24392         return tag_ptr(ret_conv, true);
24393 }
24394 int64_t  __attribute__((export_name("TS_CResult_ClosingSignedDecodeErrorZ_clone_ptr"))) TS_CResult_ClosingSignedDecodeErrorZ_clone_ptr(uint64_t arg) {
24395         LDKCResult_ClosingSignedDecodeErrorZ* arg_conv = (LDKCResult_ClosingSignedDecodeErrorZ*)untag_ptr(arg);
24396         int64_t ret_conv = CResult_ClosingSignedDecodeErrorZ_clone_ptr(arg_conv);
24397         return ret_conv;
24398 }
24399
24400 uint64_t  __attribute__((export_name("TS_CResult_ClosingSignedDecodeErrorZ_clone"))) TS_CResult_ClosingSignedDecodeErrorZ_clone(uint64_t orig) {
24401         LDKCResult_ClosingSignedDecodeErrorZ* orig_conv = (LDKCResult_ClosingSignedDecodeErrorZ*)untag_ptr(orig);
24402         LDKCResult_ClosingSignedDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ClosingSignedDecodeErrorZ), "LDKCResult_ClosingSignedDecodeErrorZ");
24403         *ret_conv = CResult_ClosingSignedDecodeErrorZ_clone(orig_conv);
24404         return tag_ptr(ret_conv, true);
24405 }
24406
24407 uint64_t  __attribute__((export_name("TS_CResult_ClosingSignedFeeRangeDecodeErrorZ_ok"))) TS_CResult_ClosingSignedFeeRangeDecodeErrorZ_ok(uint64_t o) {
24408         LDKClosingSignedFeeRange o_conv;
24409         o_conv.inner = untag_ptr(o);
24410         o_conv.is_owned = ptr_is_owned(o);
24411         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
24412         o_conv = ClosingSignedFeeRange_clone(&o_conv);
24413         LDKCResult_ClosingSignedFeeRangeDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ClosingSignedFeeRangeDecodeErrorZ), "LDKCResult_ClosingSignedFeeRangeDecodeErrorZ");
24414         *ret_conv = CResult_ClosingSignedFeeRangeDecodeErrorZ_ok(o_conv);
24415         return tag_ptr(ret_conv, true);
24416 }
24417
24418 uint64_t  __attribute__((export_name("TS_CResult_ClosingSignedFeeRangeDecodeErrorZ_err"))) TS_CResult_ClosingSignedFeeRangeDecodeErrorZ_err(uint64_t e) {
24419         void* e_ptr = untag_ptr(e);
24420         CHECK_ACCESS(e_ptr);
24421         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
24422         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
24423         LDKCResult_ClosingSignedFeeRangeDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ClosingSignedFeeRangeDecodeErrorZ), "LDKCResult_ClosingSignedFeeRangeDecodeErrorZ");
24424         *ret_conv = CResult_ClosingSignedFeeRangeDecodeErrorZ_err(e_conv);
24425         return tag_ptr(ret_conv, true);
24426 }
24427
24428 jboolean  __attribute__((export_name("TS_CResult_ClosingSignedFeeRangeDecodeErrorZ_is_ok"))) TS_CResult_ClosingSignedFeeRangeDecodeErrorZ_is_ok(uint64_t o) {
24429         LDKCResult_ClosingSignedFeeRangeDecodeErrorZ* o_conv = (LDKCResult_ClosingSignedFeeRangeDecodeErrorZ*)untag_ptr(o);
24430         jboolean ret_conv = CResult_ClosingSignedFeeRangeDecodeErrorZ_is_ok(o_conv);
24431         return ret_conv;
24432 }
24433
24434 void  __attribute__((export_name("TS_CResult_ClosingSignedFeeRangeDecodeErrorZ_free"))) TS_CResult_ClosingSignedFeeRangeDecodeErrorZ_free(uint64_t _res) {
24435         if (!ptr_is_owned(_res)) return;
24436         void* _res_ptr = untag_ptr(_res);
24437         CHECK_ACCESS(_res_ptr);
24438         LDKCResult_ClosingSignedFeeRangeDecodeErrorZ _res_conv = *(LDKCResult_ClosingSignedFeeRangeDecodeErrorZ*)(_res_ptr);
24439         FREE(untag_ptr(_res));
24440         CResult_ClosingSignedFeeRangeDecodeErrorZ_free(_res_conv);
24441 }
24442
24443 static inline uint64_t CResult_ClosingSignedFeeRangeDecodeErrorZ_clone_ptr(LDKCResult_ClosingSignedFeeRangeDecodeErrorZ *NONNULL_PTR arg) {
24444         LDKCResult_ClosingSignedFeeRangeDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ClosingSignedFeeRangeDecodeErrorZ), "LDKCResult_ClosingSignedFeeRangeDecodeErrorZ");
24445         *ret_conv = CResult_ClosingSignedFeeRangeDecodeErrorZ_clone(arg);
24446         return tag_ptr(ret_conv, true);
24447 }
24448 int64_t  __attribute__((export_name("TS_CResult_ClosingSignedFeeRangeDecodeErrorZ_clone_ptr"))) TS_CResult_ClosingSignedFeeRangeDecodeErrorZ_clone_ptr(uint64_t arg) {
24449         LDKCResult_ClosingSignedFeeRangeDecodeErrorZ* arg_conv = (LDKCResult_ClosingSignedFeeRangeDecodeErrorZ*)untag_ptr(arg);
24450         int64_t ret_conv = CResult_ClosingSignedFeeRangeDecodeErrorZ_clone_ptr(arg_conv);
24451         return ret_conv;
24452 }
24453
24454 uint64_t  __attribute__((export_name("TS_CResult_ClosingSignedFeeRangeDecodeErrorZ_clone"))) TS_CResult_ClosingSignedFeeRangeDecodeErrorZ_clone(uint64_t orig) {
24455         LDKCResult_ClosingSignedFeeRangeDecodeErrorZ* orig_conv = (LDKCResult_ClosingSignedFeeRangeDecodeErrorZ*)untag_ptr(orig);
24456         LDKCResult_ClosingSignedFeeRangeDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ClosingSignedFeeRangeDecodeErrorZ), "LDKCResult_ClosingSignedFeeRangeDecodeErrorZ");
24457         *ret_conv = CResult_ClosingSignedFeeRangeDecodeErrorZ_clone(orig_conv);
24458         return tag_ptr(ret_conv, true);
24459 }
24460
24461 uint64_t  __attribute__((export_name("TS_CResult_CommitmentSignedDecodeErrorZ_ok"))) TS_CResult_CommitmentSignedDecodeErrorZ_ok(uint64_t o) {
24462         LDKCommitmentSigned o_conv;
24463         o_conv.inner = untag_ptr(o);
24464         o_conv.is_owned = ptr_is_owned(o);
24465         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
24466         o_conv = CommitmentSigned_clone(&o_conv);
24467         LDKCResult_CommitmentSignedDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CommitmentSignedDecodeErrorZ), "LDKCResult_CommitmentSignedDecodeErrorZ");
24468         *ret_conv = CResult_CommitmentSignedDecodeErrorZ_ok(o_conv);
24469         return tag_ptr(ret_conv, true);
24470 }
24471
24472 uint64_t  __attribute__((export_name("TS_CResult_CommitmentSignedDecodeErrorZ_err"))) TS_CResult_CommitmentSignedDecodeErrorZ_err(uint64_t e) {
24473         void* e_ptr = untag_ptr(e);
24474         CHECK_ACCESS(e_ptr);
24475         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
24476         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
24477         LDKCResult_CommitmentSignedDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CommitmentSignedDecodeErrorZ), "LDKCResult_CommitmentSignedDecodeErrorZ");
24478         *ret_conv = CResult_CommitmentSignedDecodeErrorZ_err(e_conv);
24479         return tag_ptr(ret_conv, true);
24480 }
24481
24482 jboolean  __attribute__((export_name("TS_CResult_CommitmentSignedDecodeErrorZ_is_ok"))) TS_CResult_CommitmentSignedDecodeErrorZ_is_ok(uint64_t o) {
24483         LDKCResult_CommitmentSignedDecodeErrorZ* o_conv = (LDKCResult_CommitmentSignedDecodeErrorZ*)untag_ptr(o);
24484         jboolean ret_conv = CResult_CommitmentSignedDecodeErrorZ_is_ok(o_conv);
24485         return ret_conv;
24486 }
24487
24488 void  __attribute__((export_name("TS_CResult_CommitmentSignedDecodeErrorZ_free"))) TS_CResult_CommitmentSignedDecodeErrorZ_free(uint64_t _res) {
24489         if (!ptr_is_owned(_res)) return;
24490         void* _res_ptr = untag_ptr(_res);
24491         CHECK_ACCESS(_res_ptr);
24492         LDKCResult_CommitmentSignedDecodeErrorZ _res_conv = *(LDKCResult_CommitmentSignedDecodeErrorZ*)(_res_ptr);
24493         FREE(untag_ptr(_res));
24494         CResult_CommitmentSignedDecodeErrorZ_free(_res_conv);
24495 }
24496
24497 static inline uint64_t CResult_CommitmentSignedDecodeErrorZ_clone_ptr(LDKCResult_CommitmentSignedDecodeErrorZ *NONNULL_PTR arg) {
24498         LDKCResult_CommitmentSignedDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CommitmentSignedDecodeErrorZ), "LDKCResult_CommitmentSignedDecodeErrorZ");
24499         *ret_conv = CResult_CommitmentSignedDecodeErrorZ_clone(arg);
24500         return tag_ptr(ret_conv, true);
24501 }
24502 int64_t  __attribute__((export_name("TS_CResult_CommitmentSignedDecodeErrorZ_clone_ptr"))) TS_CResult_CommitmentSignedDecodeErrorZ_clone_ptr(uint64_t arg) {
24503         LDKCResult_CommitmentSignedDecodeErrorZ* arg_conv = (LDKCResult_CommitmentSignedDecodeErrorZ*)untag_ptr(arg);
24504         int64_t ret_conv = CResult_CommitmentSignedDecodeErrorZ_clone_ptr(arg_conv);
24505         return ret_conv;
24506 }
24507
24508 uint64_t  __attribute__((export_name("TS_CResult_CommitmentSignedDecodeErrorZ_clone"))) TS_CResult_CommitmentSignedDecodeErrorZ_clone(uint64_t orig) {
24509         LDKCResult_CommitmentSignedDecodeErrorZ* orig_conv = (LDKCResult_CommitmentSignedDecodeErrorZ*)untag_ptr(orig);
24510         LDKCResult_CommitmentSignedDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CommitmentSignedDecodeErrorZ), "LDKCResult_CommitmentSignedDecodeErrorZ");
24511         *ret_conv = CResult_CommitmentSignedDecodeErrorZ_clone(orig_conv);
24512         return tag_ptr(ret_conv, true);
24513 }
24514
24515 uint64_t  __attribute__((export_name("TS_CResult_FundingCreatedDecodeErrorZ_ok"))) TS_CResult_FundingCreatedDecodeErrorZ_ok(uint64_t o) {
24516         LDKFundingCreated o_conv;
24517         o_conv.inner = untag_ptr(o);
24518         o_conv.is_owned = ptr_is_owned(o);
24519         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
24520         o_conv = FundingCreated_clone(&o_conv);
24521         LDKCResult_FundingCreatedDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_FundingCreatedDecodeErrorZ), "LDKCResult_FundingCreatedDecodeErrorZ");
24522         *ret_conv = CResult_FundingCreatedDecodeErrorZ_ok(o_conv);
24523         return tag_ptr(ret_conv, true);
24524 }
24525
24526 uint64_t  __attribute__((export_name("TS_CResult_FundingCreatedDecodeErrorZ_err"))) TS_CResult_FundingCreatedDecodeErrorZ_err(uint64_t e) {
24527         void* e_ptr = untag_ptr(e);
24528         CHECK_ACCESS(e_ptr);
24529         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
24530         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
24531         LDKCResult_FundingCreatedDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_FundingCreatedDecodeErrorZ), "LDKCResult_FundingCreatedDecodeErrorZ");
24532         *ret_conv = CResult_FundingCreatedDecodeErrorZ_err(e_conv);
24533         return tag_ptr(ret_conv, true);
24534 }
24535
24536 jboolean  __attribute__((export_name("TS_CResult_FundingCreatedDecodeErrorZ_is_ok"))) TS_CResult_FundingCreatedDecodeErrorZ_is_ok(uint64_t o) {
24537         LDKCResult_FundingCreatedDecodeErrorZ* o_conv = (LDKCResult_FundingCreatedDecodeErrorZ*)untag_ptr(o);
24538         jboolean ret_conv = CResult_FundingCreatedDecodeErrorZ_is_ok(o_conv);
24539         return ret_conv;
24540 }
24541
24542 void  __attribute__((export_name("TS_CResult_FundingCreatedDecodeErrorZ_free"))) TS_CResult_FundingCreatedDecodeErrorZ_free(uint64_t _res) {
24543         if (!ptr_is_owned(_res)) return;
24544         void* _res_ptr = untag_ptr(_res);
24545         CHECK_ACCESS(_res_ptr);
24546         LDKCResult_FundingCreatedDecodeErrorZ _res_conv = *(LDKCResult_FundingCreatedDecodeErrorZ*)(_res_ptr);
24547         FREE(untag_ptr(_res));
24548         CResult_FundingCreatedDecodeErrorZ_free(_res_conv);
24549 }
24550
24551 static inline uint64_t CResult_FundingCreatedDecodeErrorZ_clone_ptr(LDKCResult_FundingCreatedDecodeErrorZ *NONNULL_PTR arg) {
24552         LDKCResult_FundingCreatedDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_FundingCreatedDecodeErrorZ), "LDKCResult_FundingCreatedDecodeErrorZ");
24553         *ret_conv = CResult_FundingCreatedDecodeErrorZ_clone(arg);
24554         return tag_ptr(ret_conv, true);
24555 }
24556 int64_t  __attribute__((export_name("TS_CResult_FundingCreatedDecodeErrorZ_clone_ptr"))) TS_CResult_FundingCreatedDecodeErrorZ_clone_ptr(uint64_t arg) {
24557         LDKCResult_FundingCreatedDecodeErrorZ* arg_conv = (LDKCResult_FundingCreatedDecodeErrorZ*)untag_ptr(arg);
24558         int64_t ret_conv = CResult_FundingCreatedDecodeErrorZ_clone_ptr(arg_conv);
24559         return ret_conv;
24560 }
24561
24562 uint64_t  __attribute__((export_name("TS_CResult_FundingCreatedDecodeErrorZ_clone"))) TS_CResult_FundingCreatedDecodeErrorZ_clone(uint64_t orig) {
24563         LDKCResult_FundingCreatedDecodeErrorZ* orig_conv = (LDKCResult_FundingCreatedDecodeErrorZ*)untag_ptr(orig);
24564         LDKCResult_FundingCreatedDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_FundingCreatedDecodeErrorZ), "LDKCResult_FundingCreatedDecodeErrorZ");
24565         *ret_conv = CResult_FundingCreatedDecodeErrorZ_clone(orig_conv);
24566         return tag_ptr(ret_conv, true);
24567 }
24568
24569 uint64_t  __attribute__((export_name("TS_CResult_FundingSignedDecodeErrorZ_ok"))) TS_CResult_FundingSignedDecodeErrorZ_ok(uint64_t o) {
24570         LDKFundingSigned o_conv;
24571         o_conv.inner = untag_ptr(o);
24572         o_conv.is_owned = ptr_is_owned(o);
24573         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
24574         o_conv = FundingSigned_clone(&o_conv);
24575         LDKCResult_FundingSignedDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_FundingSignedDecodeErrorZ), "LDKCResult_FundingSignedDecodeErrorZ");
24576         *ret_conv = CResult_FundingSignedDecodeErrorZ_ok(o_conv);
24577         return tag_ptr(ret_conv, true);
24578 }
24579
24580 uint64_t  __attribute__((export_name("TS_CResult_FundingSignedDecodeErrorZ_err"))) TS_CResult_FundingSignedDecodeErrorZ_err(uint64_t e) {
24581         void* e_ptr = untag_ptr(e);
24582         CHECK_ACCESS(e_ptr);
24583         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
24584         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
24585         LDKCResult_FundingSignedDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_FundingSignedDecodeErrorZ), "LDKCResult_FundingSignedDecodeErrorZ");
24586         *ret_conv = CResult_FundingSignedDecodeErrorZ_err(e_conv);
24587         return tag_ptr(ret_conv, true);
24588 }
24589
24590 jboolean  __attribute__((export_name("TS_CResult_FundingSignedDecodeErrorZ_is_ok"))) TS_CResult_FundingSignedDecodeErrorZ_is_ok(uint64_t o) {
24591         LDKCResult_FundingSignedDecodeErrorZ* o_conv = (LDKCResult_FundingSignedDecodeErrorZ*)untag_ptr(o);
24592         jboolean ret_conv = CResult_FundingSignedDecodeErrorZ_is_ok(o_conv);
24593         return ret_conv;
24594 }
24595
24596 void  __attribute__((export_name("TS_CResult_FundingSignedDecodeErrorZ_free"))) TS_CResult_FundingSignedDecodeErrorZ_free(uint64_t _res) {
24597         if (!ptr_is_owned(_res)) return;
24598         void* _res_ptr = untag_ptr(_res);
24599         CHECK_ACCESS(_res_ptr);
24600         LDKCResult_FundingSignedDecodeErrorZ _res_conv = *(LDKCResult_FundingSignedDecodeErrorZ*)(_res_ptr);
24601         FREE(untag_ptr(_res));
24602         CResult_FundingSignedDecodeErrorZ_free(_res_conv);
24603 }
24604
24605 static inline uint64_t CResult_FundingSignedDecodeErrorZ_clone_ptr(LDKCResult_FundingSignedDecodeErrorZ *NONNULL_PTR arg) {
24606         LDKCResult_FundingSignedDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_FundingSignedDecodeErrorZ), "LDKCResult_FundingSignedDecodeErrorZ");
24607         *ret_conv = CResult_FundingSignedDecodeErrorZ_clone(arg);
24608         return tag_ptr(ret_conv, true);
24609 }
24610 int64_t  __attribute__((export_name("TS_CResult_FundingSignedDecodeErrorZ_clone_ptr"))) TS_CResult_FundingSignedDecodeErrorZ_clone_ptr(uint64_t arg) {
24611         LDKCResult_FundingSignedDecodeErrorZ* arg_conv = (LDKCResult_FundingSignedDecodeErrorZ*)untag_ptr(arg);
24612         int64_t ret_conv = CResult_FundingSignedDecodeErrorZ_clone_ptr(arg_conv);
24613         return ret_conv;
24614 }
24615
24616 uint64_t  __attribute__((export_name("TS_CResult_FundingSignedDecodeErrorZ_clone"))) TS_CResult_FundingSignedDecodeErrorZ_clone(uint64_t orig) {
24617         LDKCResult_FundingSignedDecodeErrorZ* orig_conv = (LDKCResult_FundingSignedDecodeErrorZ*)untag_ptr(orig);
24618         LDKCResult_FundingSignedDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_FundingSignedDecodeErrorZ), "LDKCResult_FundingSignedDecodeErrorZ");
24619         *ret_conv = CResult_FundingSignedDecodeErrorZ_clone(orig_conv);
24620         return tag_ptr(ret_conv, true);
24621 }
24622
24623 uint64_t  __attribute__((export_name("TS_CResult_ChannelReadyDecodeErrorZ_ok"))) TS_CResult_ChannelReadyDecodeErrorZ_ok(uint64_t o) {
24624         LDKChannelReady o_conv;
24625         o_conv.inner = untag_ptr(o);
24626         o_conv.is_owned = ptr_is_owned(o);
24627         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
24628         o_conv = ChannelReady_clone(&o_conv);
24629         LDKCResult_ChannelReadyDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelReadyDecodeErrorZ), "LDKCResult_ChannelReadyDecodeErrorZ");
24630         *ret_conv = CResult_ChannelReadyDecodeErrorZ_ok(o_conv);
24631         return tag_ptr(ret_conv, true);
24632 }
24633
24634 uint64_t  __attribute__((export_name("TS_CResult_ChannelReadyDecodeErrorZ_err"))) TS_CResult_ChannelReadyDecodeErrorZ_err(uint64_t e) {
24635         void* e_ptr = untag_ptr(e);
24636         CHECK_ACCESS(e_ptr);
24637         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
24638         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
24639         LDKCResult_ChannelReadyDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelReadyDecodeErrorZ), "LDKCResult_ChannelReadyDecodeErrorZ");
24640         *ret_conv = CResult_ChannelReadyDecodeErrorZ_err(e_conv);
24641         return tag_ptr(ret_conv, true);
24642 }
24643
24644 jboolean  __attribute__((export_name("TS_CResult_ChannelReadyDecodeErrorZ_is_ok"))) TS_CResult_ChannelReadyDecodeErrorZ_is_ok(uint64_t o) {
24645         LDKCResult_ChannelReadyDecodeErrorZ* o_conv = (LDKCResult_ChannelReadyDecodeErrorZ*)untag_ptr(o);
24646         jboolean ret_conv = CResult_ChannelReadyDecodeErrorZ_is_ok(o_conv);
24647         return ret_conv;
24648 }
24649
24650 void  __attribute__((export_name("TS_CResult_ChannelReadyDecodeErrorZ_free"))) TS_CResult_ChannelReadyDecodeErrorZ_free(uint64_t _res) {
24651         if (!ptr_is_owned(_res)) return;
24652         void* _res_ptr = untag_ptr(_res);
24653         CHECK_ACCESS(_res_ptr);
24654         LDKCResult_ChannelReadyDecodeErrorZ _res_conv = *(LDKCResult_ChannelReadyDecodeErrorZ*)(_res_ptr);
24655         FREE(untag_ptr(_res));
24656         CResult_ChannelReadyDecodeErrorZ_free(_res_conv);
24657 }
24658
24659 static inline uint64_t CResult_ChannelReadyDecodeErrorZ_clone_ptr(LDKCResult_ChannelReadyDecodeErrorZ *NONNULL_PTR arg) {
24660         LDKCResult_ChannelReadyDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelReadyDecodeErrorZ), "LDKCResult_ChannelReadyDecodeErrorZ");
24661         *ret_conv = CResult_ChannelReadyDecodeErrorZ_clone(arg);
24662         return tag_ptr(ret_conv, true);
24663 }
24664 int64_t  __attribute__((export_name("TS_CResult_ChannelReadyDecodeErrorZ_clone_ptr"))) TS_CResult_ChannelReadyDecodeErrorZ_clone_ptr(uint64_t arg) {
24665         LDKCResult_ChannelReadyDecodeErrorZ* arg_conv = (LDKCResult_ChannelReadyDecodeErrorZ*)untag_ptr(arg);
24666         int64_t ret_conv = CResult_ChannelReadyDecodeErrorZ_clone_ptr(arg_conv);
24667         return ret_conv;
24668 }
24669
24670 uint64_t  __attribute__((export_name("TS_CResult_ChannelReadyDecodeErrorZ_clone"))) TS_CResult_ChannelReadyDecodeErrorZ_clone(uint64_t orig) {
24671         LDKCResult_ChannelReadyDecodeErrorZ* orig_conv = (LDKCResult_ChannelReadyDecodeErrorZ*)untag_ptr(orig);
24672         LDKCResult_ChannelReadyDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelReadyDecodeErrorZ), "LDKCResult_ChannelReadyDecodeErrorZ");
24673         *ret_conv = CResult_ChannelReadyDecodeErrorZ_clone(orig_conv);
24674         return tag_ptr(ret_conv, true);
24675 }
24676
24677 uint64_t  __attribute__((export_name("TS_CResult_InitDecodeErrorZ_ok"))) TS_CResult_InitDecodeErrorZ_ok(uint64_t o) {
24678         LDKInit o_conv;
24679         o_conv.inner = untag_ptr(o);
24680         o_conv.is_owned = ptr_is_owned(o);
24681         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
24682         o_conv = Init_clone(&o_conv);
24683         LDKCResult_InitDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InitDecodeErrorZ), "LDKCResult_InitDecodeErrorZ");
24684         *ret_conv = CResult_InitDecodeErrorZ_ok(o_conv);
24685         return tag_ptr(ret_conv, true);
24686 }
24687
24688 uint64_t  __attribute__((export_name("TS_CResult_InitDecodeErrorZ_err"))) TS_CResult_InitDecodeErrorZ_err(uint64_t e) {
24689         void* e_ptr = untag_ptr(e);
24690         CHECK_ACCESS(e_ptr);
24691         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
24692         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
24693         LDKCResult_InitDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InitDecodeErrorZ), "LDKCResult_InitDecodeErrorZ");
24694         *ret_conv = CResult_InitDecodeErrorZ_err(e_conv);
24695         return tag_ptr(ret_conv, true);
24696 }
24697
24698 jboolean  __attribute__((export_name("TS_CResult_InitDecodeErrorZ_is_ok"))) TS_CResult_InitDecodeErrorZ_is_ok(uint64_t o) {
24699         LDKCResult_InitDecodeErrorZ* o_conv = (LDKCResult_InitDecodeErrorZ*)untag_ptr(o);
24700         jboolean ret_conv = CResult_InitDecodeErrorZ_is_ok(o_conv);
24701         return ret_conv;
24702 }
24703
24704 void  __attribute__((export_name("TS_CResult_InitDecodeErrorZ_free"))) TS_CResult_InitDecodeErrorZ_free(uint64_t _res) {
24705         if (!ptr_is_owned(_res)) return;
24706         void* _res_ptr = untag_ptr(_res);
24707         CHECK_ACCESS(_res_ptr);
24708         LDKCResult_InitDecodeErrorZ _res_conv = *(LDKCResult_InitDecodeErrorZ*)(_res_ptr);
24709         FREE(untag_ptr(_res));
24710         CResult_InitDecodeErrorZ_free(_res_conv);
24711 }
24712
24713 static inline uint64_t CResult_InitDecodeErrorZ_clone_ptr(LDKCResult_InitDecodeErrorZ *NONNULL_PTR arg) {
24714         LDKCResult_InitDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InitDecodeErrorZ), "LDKCResult_InitDecodeErrorZ");
24715         *ret_conv = CResult_InitDecodeErrorZ_clone(arg);
24716         return tag_ptr(ret_conv, true);
24717 }
24718 int64_t  __attribute__((export_name("TS_CResult_InitDecodeErrorZ_clone_ptr"))) TS_CResult_InitDecodeErrorZ_clone_ptr(uint64_t arg) {
24719         LDKCResult_InitDecodeErrorZ* arg_conv = (LDKCResult_InitDecodeErrorZ*)untag_ptr(arg);
24720         int64_t ret_conv = CResult_InitDecodeErrorZ_clone_ptr(arg_conv);
24721         return ret_conv;
24722 }
24723
24724 uint64_t  __attribute__((export_name("TS_CResult_InitDecodeErrorZ_clone"))) TS_CResult_InitDecodeErrorZ_clone(uint64_t orig) {
24725         LDKCResult_InitDecodeErrorZ* orig_conv = (LDKCResult_InitDecodeErrorZ*)untag_ptr(orig);
24726         LDKCResult_InitDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InitDecodeErrorZ), "LDKCResult_InitDecodeErrorZ");
24727         *ret_conv = CResult_InitDecodeErrorZ_clone(orig_conv);
24728         return tag_ptr(ret_conv, true);
24729 }
24730
24731 uint64_t  __attribute__((export_name("TS_CResult_OpenChannelDecodeErrorZ_ok"))) TS_CResult_OpenChannelDecodeErrorZ_ok(uint64_t o) {
24732         LDKOpenChannel o_conv;
24733         o_conv.inner = untag_ptr(o);
24734         o_conv.is_owned = ptr_is_owned(o);
24735         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
24736         o_conv = OpenChannel_clone(&o_conv);
24737         LDKCResult_OpenChannelDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_OpenChannelDecodeErrorZ), "LDKCResult_OpenChannelDecodeErrorZ");
24738         *ret_conv = CResult_OpenChannelDecodeErrorZ_ok(o_conv);
24739         return tag_ptr(ret_conv, true);
24740 }
24741
24742 uint64_t  __attribute__((export_name("TS_CResult_OpenChannelDecodeErrorZ_err"))) TS_CResult_OpenChannelDecodeErrorZ_err(uint64_t e) {
24743         void* e_ptr = untag_ptr(e);
24744         CHECK_ACCESS(e_ptr);
24745         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
24746         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
24747         LDKCResult_OpenChannelDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_OpenChannelDecodeErrorZ), "LDKCResult_OpenChannelDecodeErrorZ");
24748         *ret_conv = CResult_OpenChannelDecodeErrorZ_err(e_conv);
24749         return tag_ptr(ret_conv, true);
24750 }
24751
24752 jboolean  __attribute__((export_name("TS_CResult_OpenChannelDecodeErrorZ_is_ok"))) TS_CResult_OpenChannelDecodeErrorZ_is_ok(uint64_t o) {
24753         LDKCResult_OpenChannelDecodeErrorZ* o_conv = (LDKCResult_OpenChannelDecodeErrorZ*)untag_ptr(o);
24754         jboolean ret_conv = CResult_OpenChannelDecodeErrorZ_is_ok(o_conv);
24755         return ret_conv;
24756 }
24757
24758 void  __attribute__((export_name("TS_CResult_OpenChannelDecodeErrorZ_free"))) TS_CResult_OpenChannelDecodeErrorZ_free(uint64_t _res) {
24759         if (!ptr_is_owned(_res)) return;
24760         void* _res_ptr = untag_ptr(_res);
24761         CHECK_ACCESS(_res_ptr);
24762         LDKCResult_OpenChannelDecodeErrorZ _res_conv = *(LDKCResult_OpenChannelDecodeErrorZ*)(_res_ptr);
24763         FREE(untag_ptr(_res));
24764         CResult_OpenChannelDecodeErrorZ_free(_res_conv);
24765 }
24766
24767 static inline uint64_t CResult_OpenChannelDecodeErrorZ_clone_ptr(LDKCResult_OpenChannelDecodeErrorZ *NONNULL_PTR arg) {
24768         LDKCResult_OpenChannelDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_OpenChannelDecodeErrorZ), "LDKCResult_OpenChannelDecodeErrorZ");
24769         *ret_conv = CResult_OpenChannelDecodeErrorZ_clone(arg);
24770         return tag_ptr(ret_conv, true);
24771 }
24772 int64_t  __attribute__((export_name("TS_CResult_OpenChannelDecodeErrorZ_clone_ptr"))) TS_CResult_OpenChannelDecodeErrorZ_clone_ptr(uint64_t arg) {
24773         LDKCResult_OpenChannelDecodeErrorZ* arg_conv = (LDKCResult_OpenChannelDecodeErrorZ*)untag_ptr(arg);
24774         int64_t ret_conv = CResult_OpenChannelDecodeErrorZ_clone_ptr(arg_conv);
24775         return ret_conv;
24776 }
24777
24778 uint64_t  __attribute__((export_name("TS_CResult_OpenChannelDecodeErrorZ_clone"))) TS_CResult_OpenChannelDecodeErrorZ_clone(uint64_t orig) {
24779         LDKCResult_OpenChannelDecodeErrorZ* orig_conv = (LDKCResult_OpenChannelDecodeErrorZ*)untag_ptr(orig);
24780         LDKCResult_OpenChannelDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_OpenChannelDecodeErrorZ), "LDKCResult_OpenChannelDecodeErrorZ");
24781         *ret_conv = CResult_OpenChannelDecodeErrorZ_clone(orig_conv);
24782         return tag_ptr(ret_conv, true);
24783 }
24784
24785 uint64_t  __attribute__((export_name("TS_CResult_OpenChannelV2DecodeErrorZ_ok"))) TS_CResult_OpenChannelV2DecodeErrorZ_ok(uint64_t o) {
24786         LDKOpenChannelV2 o_conv;
24787         o_conv.inner = untag_ptr(o);
24788         o_conv.is_owned = ptr_is_owned(o);
24789         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
24790         o_conv = OpenChannelV2_clone(&o_conv);
24791         LDKCResult_OpenChannelV2DecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_OpenChannelV2DecodeErrorZ), "LDKCResult_OpenChannelV2DecodeErrorZ");
24792         *ret_conv = CResult_OpenChannelV2DecodeErrorZ_ok(o_conv);
24793         return tag_ptr(ret_conv, true);
24794 }
24795
24796 uint64_t  __attribute__((export_name("TS_CResult_OpenChannelV2DecodeErrorZ_err"))) TS_CResult_OpenChannelV2DecodeErrorZ_err(uint64_t e) {
24797         void* e_ptr = untag_ptr(e);
24798         CHECK_ACCESS(e_ptr);
24799         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
24800         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
24801         LDKCResult_OpenChannelV2DecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_OpenChannelV2DecodeErrorZ), "LDKCResult_OpenChannelV2DecodeErrorZ");
24802         *ret_conv = CResult_OpenChannelV2DecodeErrorZ_err(e_conv);
24803         return tag_ptr(ret_conv, true);
24804 }
24805
24806 jboolean  __attribute__((export_name("TS_CResult_OpenChannelV2DecodeErrorZ_is_ok"))) TS_CResult_OpenChannelV2DecodeErrorZ_is_ok(uint64_t o) {
24807         LDKCResult_OpenChannelV2DecodeErrorZ* o_conv = (LDKCResult_OpenChannelV2DecodeErrorZ*)untag_ptr(o);
24808         jboolean ret_conv = CResult_OpenChannelV2DecodeErrorZ_is_ok(o_conv);
24809         return ret_conv;
24810 }
24811
24812 void  __attribute__((export_name("TS_CResult_OpenChannelV2DecodeErrorZ_free"))) TS_CResult_OpenChannelV2DecodeErrorZ_free(uint64_t _res) {
24813         if (!ptr_is_owned(_res)) return;
24814         void* _res_ptr = untag_ptr(_res);
24815         CHECK_ACCESS(_res_ptr);
24816         LDKCResult_OpenChannelV2DecodeErrorZ _res_conv = *(LDKCResult_OpenChannelV2DecodeErrorZ*)(_res_ptr);
24817         FREE(untag_ptr(_res));
24818         CResult_OpenChannelV2DecodeErrorZ_free(_res_conv);
24819 }
24820
24821 static inline uint64_t CResult_OpenChannelV2DecodeErrorZ_clone_ptr(LDKCResult_OpenChannelV2DecodeErrorZ *NONNULL_PTR arg) {
24822         LDKCResult_OpenChannelV2DecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_OpenChannelV2DecodeErrorZ), "LDKCResult_OpenChannelV2DecodeErrorZ");
24823         *ret_conv = CResult_OpenChannelV2DecodeErrorZ_clone(arg);
24824         return tag_ptr(ret_conv, true);
24825 }
24826 int64_t  __attribute__((export_name("TS_CResult_OpenChannelV2DecodeErrorZ_clone_ptr"))) TS_CResult_OpenChannelV2DecodeErrorZ_clone_ptr(uint64_t arg) {
24827         LDKCResult_OpenChannelV2DecodeErrorZ* arg_conv = (LDKCResult_OpenChannelV2DecodeErrorZ*)untag_ptr(arg);
24828         int64_t ret_conv = CResult_OpenChannelV2DecodeErrorZ_clone_ptr(arg_conv);
24829         return ret_conv;
24830 }
24831
24832 uint64_t  __attribute__((export_name("TS_CResult_OpenChannelV2DecodeErrorZ_clone"))) TS_CResult_OpenChannelV2DecodeErrorZ_clone(uint64_t orig) {
24833         LDKCResult_OpenChannelV2DecodeErrorZ* orig_conv = (LDKCResult_OpenChannelV2DecodeErrorZ*)untag_ptr(orig);
24834         LDKCResult_OpenChannelV2DecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_OpenChannelV2DecodeErrorZ), "LDKCResult_OpenChannelV2DecodeErrorZ");
24835         *ret_conv = CResult_OpenChannelV2DecodeErrorZ_clone(orig_conv);
24836         return tag_ptr(ret_conv, true);
24837 }
24838
24839 uint64_t  __attribute__((export_name("TS_CResult_RevokeAndACKDecodeErrorZ_ok"))) TS_CResult_RevokeAndACKDecodeErrorZ_ok(uint64_t o) {
24840         LDKRevokeAndACK o_conv;
24841         o_conv.inner = untag_ptr(o);
24842         o_conv.is_owned = ptr_is_owned(o);
24843         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
24844         o_conv = RevokeAndACK_clone(&o_conv);
24845         LDKCResult_RevokeAndACKDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RevokeAndACKDecodeErrorZ), "LDKCResult_RevokeAndACKDecodeErrorZ");
24846         *ret_conv = CResult_RevokeAndACKDecodeErrorZ_ok(o_conv);
24847         return tag_ptr(ret_conv, true);
24848 }
24849
24850 uint64_t  __attribute__((export_name("TS_CResult_RevokeAndACKDecodeErrorZ_err"))) TS_CResult_RevokeAndACKDecodeErrorZ_err(uint64_t e) {
24851         void* e_ptr = untag_ptr(e);
24852         CHECK_ACCESS(e_ptr);
24853         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
24854         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
24855         LDKCResult_RevokeAndACKDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RevokeAndACKDecodeErrorZ), "LDKCResult_RevokeAndACKDecodeErrorZ");
24856         *ret_conv = CResult_RevokeAndACKDecodeErrorZ_err(e_conv);
24857         return tag_ptr(ret_conv, true);
24858 }
24859
24860 jboolean  __attribute__((export_name("TS_CResult_RevokeAndACKDecodeErrorZ_is_ok"))) TS_CResult_RevokeAndACKDecodeErrorZ_is_ok(uint64_t o) {
24861         LDKCResult_RevokeAndACKDecodeErrorZ* o_conv = (LDKCResult_RevokeAndACKDecodeErrorZ*)untag_ptr(o);
24862         jboolean ret_conv = CResult_RevokeAndACKDecodeErrorZ_is_ok(o_conv);
24863         return ret_conv;
24864 }
24865
24866 void  __attribute__((export_name("TS_CResult_RevokeAndACKDecodeErrorZ_free"))) TS_CResult_RevokeAndACKDecodeErrorZ_free(uint64_t _res) {
24867         if (!ptr_is_owned(_res)) return;
24868         void* _res_ptr = untag_ptr(_res);
24869         CHECK_ACCESS(_res_ptr);
24870         LDKCResult_RevokeAndACKDecodeErrorZ _res_conv = *(LDKCResult_RevokeAndACKDecodeErrorZ*)(_res_ptr);
24871         FREE(untag_ptr(_res));
24872         CResult_RevokeAndACKDecodeErrorZ_free(_res_conv);
24873 }
24874
24875 static inline uint64_t CResult_RevokeAndACKDecodeErrorZ_clone_ptr(LDKCResult_RevokeAndACKDecodeErrorZ *NONNULL_PTR arg) {
24876         LDKCResult_RevokeAndACKDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RevokeAndACKDecodeErrorZ), "LDKCResult_RevokeAndACKDecodeErrorZ");
24877         *ret_conv = CResult_RevokeAndACKDecodeErrorZ_clone(arg);
24878         return tag_ptr(ret_conv, true);
24879 }
24880 int64_t  __attribute__((export_name("TS_CResult_RevokeAndACKDecodeErrorZ_clone_ptr"))) TS_CResult_RevokeAndACKDecodeErrorZ_clone_ptr(uint64_t arg) {
24881         LDKCResult_RevokeAndACKDecodeErrorZ* arg_conv = (LDKCResult_RevokeAndACKDecodeErrorZ*)untag_ptr(arg);
24882         int64_t ret_conv = CResult_RevokeAndACKDecodeErrorZ_clone_ptr(arg_conv);
24883         return ret_conv;
24884 }
24885
24886 uint64_t  __attribute__((export_name("TS_CResult_RevokeAndACKDecodeErrorZ_clone"))) TS_CResult_RevokeAndACKDecodeErrorZ_clone(uint64_t orig) {
24887         LDKCResult_RevokeAndACKDecodeErrorZ* orig_conv = (LDKCResult_RevokeAndACKDecodeErrorZ*)untag_ptr(orig);
24888         LDKCResult_RevokeAndACKDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RevokeAndACKDecodeErrorZ), "LDKCResult_RevokeAndACKDecodeErrorZ");
24889         *ret_conv = CResult_RevokeAndACKDecodeErrorZ_clone(orig_conv);
24890         return tag_ptr(ret_conv, true);
24891 }
24892
24893 uint64_t  __attribute__((export_name("TS_CResult_ShutdownDecodeErrorZ_ok"))) TS_CResult_ShutdownDecodeErrorZ_ok(uint64_t o) {
24894         LDKShutdown o_conv;
24895         o_conv.inner = untag_ptr(o);
24896         o_conv.is_owned = ptr_is_owned(o);
24897         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
24898         o_conv = Shutdown_clone(&o_conv);
24899         LDKCResult_ShutdownDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ShutdownDecodeErrorZ), "LDKCResult_ShutdownDecodeErrorZ");
24900         *ret_conv = CResult_ShutdownDecodeErrorZ_ok(o_conv);
24901         return tag_ptr(ret_conv, true);
24902 }
24903
24904 uint64_t  __attribute__((export_name("TS_CResult_ShutdownDecodeErrorZ_err"))) TS_CResult_ShutdownDecodeErrorZ_err(uint64_t e) {
24905         void* e_ptr = untag_ptr(e);
24906         CHECK_ACCESS(e_ptr);
24907         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
24908         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
24909         LDKCResult_ShutdownDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ShutdownDecodeErrorZ), "LDKCResult_ShutdownDecodeErrorZ");
24910         *ret_conv = CResult_ShutdownDecodeErrorZ_err(e_conv);
24911         return tag_ptr(ret_conv, true);
24912 }
24913
24914 jboolean  __attribute__((export_name("TS_CResult_ShutdownDecodeErrorZ_is_ok"))) TS_CResult_ShutdownDecodeErrorZ_is_ok(uint64_t o) {
24915         LDKCResult_ShutdownDecodeErrorZ* o_conv = (LDKCResult_ShutdownDecodeErrorZ*)untag_ptr(o);
24916         jboolean ret_conv = CResult_ShutdownDecodeErrorZ_is_ok(o_conv);
24917         return ret_conv;
24918 }
24919
24920 void  __attribute__((export_name("TS_CResult_ShutdownDecodeErrorZ_free"))) TS_CResult_ShutdownDecodeErrorZ_free(uint64_t _res) {
24921         if (!ptr_is_owned(_res)) return;
24922         void* _res_ptr = untag_ptr(_res);
24923         CHECK_ACCESS(_res_ptr);
24924         LDKCResult_ShutdownDecodeErrorZ _res_conv = *(LDKCResult_ShutdownDecodeErrorZ*)(_res_ptr);
24925         FREE(untag_ptr(_res));
24926         CResult_ShutdownDecodeErrorZ_free(_res_conv);
24927 }
24928
24929 static inline uint64_t CResult_ShutdownDecodeErrorZ_clone_ptr(LDKCResult_ShutdownDecodeErrorZ *NONNULL_PTR arg) {
24930         LDKCResult_ShutdownDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ShutdownDecodeErrorZ), "LDKCResult_ShutdownDecodeErrorZ");
24931         *ret_conv = CResult_ShutdownDecodeErrorZ_clone(arg);
24932         return tag_ptr(ret_conv, true);
24933 }
24934 int64_t  __attribute__((export_name("TS_CResult_ShutdownDecodeErrorZ_clone_ptr"))) TS_CResult_ShutdownDecodeErrorZ_clone_ptr(uint64_t arg) {
24935         LDKCResult_ShutdownDecodeErrorZ* arg_conv = (LDKCResult_ShutdownDecodeErrorZ*)untag_ptr(arg);
24936         int64_t ret_conv = CResult_ShutdownDecodeErrorZ_clone_ptr(arg_conv);
24937         return ret_conv;
24938 }
24939
24940 uint64_t  __attribute__((export_name("TS_CResult_ShutdownDecodeErrorZ_clone"))) TS_CResult_ShutdownDecodeErrorZ_clone(uint64_t orig) {
24941         LDKCResult_ShutdownDecodeErrorZ* orig_conv = (LDKCResult_ShutdownDecodeErrorZ*)untag_ptr(orig);
24942         LDKCResult_ShutdownDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ShutdownDecodeErrorZ), "LDKCResult_ShutdownDecodeErrorZ");
24943         *ret_conv = CResult_ShutdownDecodeErrorZ_clone(orig_conv);
24944         return tag_ptr(ret_conv, true);
24945 }
24946
24947 uint64_t  __attribute__((export_name("TS_CResult_UpdateFailHTLCDecodeErrorZ_ok"))) TS_CResult_UpdateFailHTLCDecodeErrorZ_ok(uint64_t o) {
24948         LDKUpdateFailHTLC o_conv;
24949         o_conv.inner = untag_ptr(o);
24950         o_conv.is_owned = ptr_is_owned(o);
24951         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
24952         o_conv = UpdateFailHTLC_clone(&o_conv);
24953         LDKCResult_UpdateFailHTLCDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UpdateFailHTLCDecodeErrorZ), "LDKCResult_UpdateFailHTLCDecodeErrorZ");
24954         *ret_conv = CResult_UpdateFailHTLCDecodeErrorZ_ok(o_conv);
24955         return tag_ptr(ret_conv, true);
24956 }
24957
24958 uint64_t  __attribute__((export_name("TS_CResult_UpdateFailHTLCDecodeErrorZ_err"))) TS_CResult_UpdateFailHTLCDecodeErrorZ_err(uint64_t e) {
24959         void* e_ptr = untag_ptr(e);
24960         CHECK_ACCESS(e_ptr);
24961         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
24962         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
24963         LDKCResult_UpdateFailHTLCDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UpdateFailHTLCDecodeErrorZ), "LDKCResult_UpdateFailHTLCDecodeErrorZ");
24964         *ret_conv = CResult_UpdateFailHTLCDecodeErrorZ_err(e_conv);
24965         return tag_ptr(ret_conv, true);
24966 }
24967
24968 jboolean  __attribute__((export_name("TS_CResult_UpdateFailHTLCDecodeErrorZ_is_ok"))) TS_CResult_UpdateFailHTLCDecodeErrorZ_is_ok(uint64_t o) {
24969         LDKCResult_UpdateFailHTLCDecodeErrorZ* o_conv = (LDKCResult_UpdateFailHTLCDecodeErrorZ*)untag_ptr(o);
24970         jboolean ret_conv = CResult_UpdateFailHTLCDecodeErrorZ_is_ok(o_conv);
24971         return ret_conv;
24972 }
24973
24974 void  __attribute__((export_name("TS_CResult_UpdateFailHTLCDecodeErrorZ_free"))) TS_CResult_UpdateFailHTLCDecodeErrorZ_free(uint64_t _res) {
24975         if (!ptr_is_owned(_res)) return;
24976         void* _res_ptr = untag_ptr(_res);
24977         CHECK_ACCESS(_res_ptr);
24978         LDKCResult_UpdateFailHTLCDecodeErrorZ _res_conv = *(LDKCResult_UpdateFailHTLCDecodeErrorZ*)(_res_ptr);
24979         FREE(untag_ptr(_res));
24980         CResult_UpdateFailHTLCDecodeErrorZ_free(_res_conv);
24981 }
24982
24983 static inline uint64_t CResult_UpdateFailHTLCDecodeErrorZ_clone_ptr(LDKCResult_UpdateFailHTLCDecodeErrorZ *NONNULL_PTR arg) {
24984         LDKCResult_UpdateFailHTLCDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UpdateFailHTLCDecodeErrorZ), "LDKCResult_UpdateFailHTLCDecodeErrorZ");
24985         *ret_conv = CResult_UpdateFailHTLCDecodeErrorZ_clone(arg);
24986         return tag_ptr(ret_conv, true);
24987 }
24988 int64_t  __attribute__((export_name("TS_CResult_UpdateFailHTLCDecodeErrorZ_clone_ptr"))) TS_CResult_UpdateFailHTLCDecodeErrorZ_clone_ptr(uint64_t arg) {
24989         LDKCResult_UpdateFailHTLCDecodeErrorZ* arg_conv = (LDKCResult_UpdateFailHTLCDecodeErrorZ*)untag_ptr(arg);
24990         int64_t ret_conv = CResult_UpdateFailHTLCDecodeErrorZ_clone_ptr(arg_conv);
24991         return ret_conv;
24992 }
24993
24994 uint64_t  __attribute__((export_name("TS_CResult_UpdateFailHTLCDecodeErrorZ_clone"))) TS_CResult_UpdateFailHTLCDecodeErrorZ_clone(uint64_t orig) {
24995         LDKCResult_UpdateFailHTLCDecodeErrorZ* orig_conv = (LDKCResult_UpdateFailHTLCDecodeErrorZ*)untag_ptr(orig);
24996         LDKCResult_UpdateFailHTLCDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UpdateFailHTLCDecodeErrorZ), "LDKCResult_UpdateFailHTLCDecodeErrorZ");
24997         *ret_conv = CResult_UpdateFailHTLCDecodeErrorZ_clone(orig_conv);
24998         return tag_ptr(ret_conv, true);
24999 }
25000
25001 uint64_t  __attribute__((export_name("TS_CResult_UpdateFailMalformedHTLCDecodeErrorZ_ok"))) TS_CResult_UpdateFailMalformedHTLCDecodeErrorZ_ok(uint64_t o) {
25002         LDKUpdateFailMalformedHTLC o_conv;
25003         o_conv.inner = untag_ptr(o);
25004         o_conv.is_owned = ptr_is_owned(o);
25005         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
25006         o_conv = UpdateFailMalformedHTLC_clone(&o_conv);
25007         LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ), "LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ");
25008         *ret_conv = CResult_UpdateFailMalformedHTLCDecodeErrorZ_ok(o_conv);
25009         return tag_ptr(ret_conv, true);
25010 }
25011
25012 uint64_t  __attribute__((export_name("TS_CResult_UpdateFailMalformedHTLCDecodeErrorZ_err"))) TS_CResult_UpdateFailMalformedHTLCDecodeErrorZ_err(uint64_t e) {
25013         void* e_ptr = untag_ptr(e);
25014         CHECK_ACCESS(e_ptr);
25015         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
25016         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
25017         LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ), "LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ");
25018         *ret_conv = CResult_UpdateFailMalformedHTLCDecodeErrorZ_err(e_conv);
25019         return tag_ptr(ret_conv, true);
25020 }
25021
25022 jboolean  __attribute__((export_name("TS_CResult_UpdateFailMalformedHTLCDecodeErrorZ_is_ok"))) TS_CResult_UpdateFailMalformedHTLCDecodeErrorZ_is_ok(uint64_t o) {
25023         LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ* o_conv = (LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ*)untag_ptr(o);
25024         jboolean ret_conv = CResult_UpdateFailMalformedHTLCDecodeErrorZ_is_ok(o_conv);
25025         return ret_conv;
25026 }
25027
25028 void  __attribute__((export_name("TS_CResult_UpdateFailMalformedHTLCDecodeErrorZ_free"))) TS_CResult_UpdateFailMalformedHTLCDecodeErrorZ_free(uint64_t _res) {
25029         if (!ptr_is_owned(_res)) return;
25030         void* _res_ptr = untag_ptr(_res);
25031         CHECK_ACCESS(_res_ptr);
25032         LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ _res_conv = *(LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ*)(_res_ptr);
25033         FREE(untag_ptr(_res));
25034         CResult_UpdateFailMalformedHTLCDecodeErrorZ_free(_res_conv);
25035 }
25036
25037 static inline uint64_t CResult_UpdateFailMalformedHTLCDecodeErrorZ_clone_ptr(LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ *NONNULL_PTR arg) {
25038         LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ), "LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ");
25039         *ret_conv = CResult_UpdateFailMalformedHTLCDecodeErrorZ_clone(arg);
25040         return tag_ptr(ret_conv, true);
25041 }
25042 int64_t  __attribute__((export_name("TS_CResult_UpdateFailMalformedHTLCDecodeErrorZ_clone_ptr"))) TS_CResult_UpdateFailMalformedHTLCDecodeErrorZ_clone_ptr(uint64_t arg) {
25043         LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ* arg_conv = (LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ*)untag_ptr(arg);
25044         int64_t ret_conv = CResult_UpdateFailMalformedHTLCDecodeErrorZ_clone_ptr(arg_conv);
25045         return ret_conv;
25046 }
25047
25048 uint64_t  __attribute__((export_name("TS_CResult_UpdateFailMalformedHTLCDecodeErrorZ_clone"))) TS_CResult_UpdateFailMalformedHTLCDecodeErrorZ_clone(uint64_t orig) {
25049         LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ* orig_conv = (LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ*)untag_ptr(orig);
25050         LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ), "LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ");
25051         *ret_conv = CResult_UpdateFailMalformedHTLCDecodeErrorZ_clone(orig_conv);
25052         return tag_ptr(ret_conv, true);
25053 }
25054
25055 uint64_t  __attribute__((export_name("TS_CResult_UpdateFeeDecodeErrorZ_ok"))) TS_CResult_UpdateFeeDecodeErrorZ_ok(uint64_t o) {
25056         LDKUpdateFee o_conv;
25057         o_conv.inner = untag_ptr(o);
25058         o_conv.is_owned = ptr_is_owned(o);
25059         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
25060         o_conv = UpdateFee_clone(&o_conv);
25061         LDKCResult_UpdateFeeDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UpdateFeeDecodeErrorZ), "LDKCResult_UpdateFeeDecodeErrorZ");
25062         *ret_conv = CResult_UpdateFeeDecodeErrorZ_ok(o_conv);
25063         return tag_ptr(ret_conv, true);
25064 }
25065
25066 uint64_t  __attribute__((export_name("TS_CResult_UpdateFeeDecodeErrorZ_err"))) TS_CResult_UpdateFeeDecodeErrorZ_err(uint64_t e) {
25067         void* e_ptr = untag_ptr(e);
25068         CHECK_ACCESS(e_ptr);
25069         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
25070         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
25071         LDKCResult_UpdateFeeDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UpdateFeeDecodeErrorZ), "LDKCResult_UpdateFeeDecodeErrorZ");
25072         *ret_conv = CResult_UpdateFeeDecodeErrorZ_err(e_conv);
25073         return tag_ptr(ret_conv, true);
25074 }
25075
25076 jboolean  __attribute__((export_name("TS_CResult_UpdateFeeDecodeErrorZ_is_ok"))) TS_CResult_UpdateFeeDecodeErrorZ_is_ok(uint64_t o) {
25077         LDKCResult_UpdateFeeDecodeErrorZ* o_conv = (LDKCResult_UpdateFeeDecodeErrorZ*)untag_ptr(o);
25078         jboolean ret_conv = CResult_UpdateFeeDecodeErrorZ_is_ok(o_conv);
25079         return ret_conv;
25080 }
25081
25082 void  __attribute__((export_name("TS_CResult_UpdateFeeDecodeErrorZ_free"))) TS_CResult_UpdateFeeDecodeErrorZ_free(uint64_t _res) {
25083         if (!ptr_is_owned(_res)) return;
25084         void* _res_ptr = untag_ptr(_res);
25085         CHECK_ACCESS(_res_ptr);
25086         LDKCResult_UpdateFeeDecodeErrorZ _res_conv = *(LDKCResult_UpdateFeeDecodeErrorZ*)(_res_ptr);
25087         FREE(untag_ptr(_res));
25088         CResult_UpdateFeeDecodeErrorZ_free(_res_conv);
25089 }
25090
25091 static inline uint64_t CResult_UpdateFeeDecodeErrorZ_clone_ptr(LDKCResult_UpdateFeeDecodeErrorZ *NONNULL_PTR arg) {
25092         LDKCResult_UpdateFeeDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UpdateFeeDecodeErrorZ), "LDKCResult_UpdateFeeDecodeErrorZ");
25093         *ret_conv = CResult_UpdateFeeDecodeErrorZ_clone(arg);
25094         return tag_ptr(ret_conv, true);
25095 }
25096 int64_t  __attribute__((export_name("TS_CResult_UpdateFeeDecodeErrorZ_clone_ptr"))) TS_CResult_UpdateFeeDecodeErrorZ_clone_ptr(uint64_t arg) {
25097         LDKCResult_UpdateFeeDecodeErrorZ* arg_conv = (LDKCResult_UpdateFeeDecodeErrorZ*)untag_ptr(arg);
25098         int64_t ret_conv = CResult_UpdateFeeDecodeErrorZ_clone_ptr(arg_conv);
25099         return ret_conv;
25100 }
25101
25102 uint64_t  __attribute__((export_name("TS_CResult_UpdateFeeDecodeErrorZ_clone"))) TS_CResult_UpdateFeeDecodeErrorZ_clone(uint64_t orig) {
25103         LDKCResult_UpdateFeeDecodeErrorZ* orig_conv = (LDKCResult_UpdateFeeDecodeErrorZ*)untag_ptr(orig);
25104         LDKCResult_UpdateFeeDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UpdateFeeDecodeErrorZ), "LDKCResult_UpdateFeeDecodeErrorZ");
25105         *ret_conv = CResult_UpdateFeeDecodeErrorZ_clone(orig_conv);
25106         return tag_ptr(ret_conv, true);
25107 }
25108
25109 uint64_t  __attribute__((export_name("TS_CResult_UpdateFulfillHTLCDecodeErrorZ_ok"))) TS_CResult_UpdateFulfillHTLCDecodeErrorZ_ok(uint64_t o) {
25110         LDKUpdateFulfillHTLC o_conv;
25111         o_conv.inner = untag_ptr(o);
25112         o_conv.is_owned = ptr_is_owned(o);
25113         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
25114         o_conv = UpdateFulfillHTLC_clone(&o_conv);
25115         LDKCResult_UpdateFulfillHTLCDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UpdateFulfillHTLCDecodeErrorZ), "LDKCResult_UpdateFulfillHTLCDecodeErrorZ");
25116         *ret_conv = CResult_UpdateFulfillHTLCDecodeErrorZ_ok(o_conv);
25117         return tag_ptr(ret_conv, true);
25118 }
25119
25120 uint64_t  __attribute__((export_name("TS_CResult_UpdateFulfillHTLCDecodeErrorZ_err"))) TS_CResult_UpdateFulfillHTLCDecodeErrorZ_err(uint64_t e) {
25121         void* e_ptr = untag_ptr(e);
25122         CHECK_ACCESS(e_ptr);
25123         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
25124         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
25125         LDKCResult_UpdateFulfillHTLCDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UpdateFulfillHTLCDecodeErrorZ), "LDKCResult_UpdateFulfillHTLCDecodeErrorZ");
25126         *ret_conv = CResult_UpdateFulfillHTLCDecodeErrorZ_err(e_conv);
25127         return tag_ptr(ret_conv, true);
25128 }
25129
25130 jboolean  __attribute__((export_name("TS_CResult_UpdateFulfillHTLCDecodeErrorZ_is_ok"))) TS_CResult_UpdateFulfillHTLCDecodeErrorZ_is_ok(uint64_t o) {
25131         LDKCResult_UpdateFulfillHTLCDecodeErrorZ* o_conv = (LDKCResult_UpdateFulfillHTLCDecodeErrorZ*)untag_ptr(o);
25132         jboolean ret_conv = CResult_UpdateFulfillHTLCDecodeErrorZ_is_ok(o_conv);
25133         return ret_conv;
25134 }
25135
25136 void  __attribute__((export_name("TS_CResult_UpdateFulfillHTLCDecodeErrorZ_free"))) TS_CResult_UpdateFulfillHTLCDecodeErrorZ_free(uint64_t _res) {
25137         if (!ptr_is_owned(_res)) return;
25138         void* _res_ptr = untag_ptr(_res);
25139         CHECK_ACCESS(_res_ptr);
25140         LDKCResult_UpdateFulfillHTLCDecodeErrorZ _res_conv = *(LDKCResult_UpdateFulfillHTLCDecodeErrorZ*)(_res_ptr);
25141         FREE(untag_ptr(_res));
25142         CResult_UpdateFulfillHTLCDecodeErrorZ_free(_res_conv);
25143 }
25144
25145 static inline uint64_t CResult_UpdateFulfillHTLCDecodeErrorZ_clone_ptr(LDKCResult_UpdateFulfillHTLCDecodeErrorZ *NONNULL_PTR arg) {
25146         LDKCResult_UpdateFulfillHTLCDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UpdateFulfillHTLCDecodeErrorZ), "LDKCResult_UpdateFulfillHTLCDecodeErrorZ");
25147         *ret_conv = CResult_UpdateFulfillHTLCDecodeErrorZ_clone(arg);
25148         return tag_ptr(ret_conv, true);
25149 }
25150 int64_t  __attribute__((export_name("TS_CResult_UpdateFulfillHTLCDecodeErrorZ_clone_ptr"))) TS_CResult_UpdateFulfillHTLCDecodeErrorZ_clone_ptr(uint64_t arg) {
25151         LDKCResult_UpdateFulfillHTLCDecodeErrorZ* arg_conv = (LDKCResult_UpdateFulfillHTLCDecodeErrorZ*)untag_ptr(arg);
25152         int64_t ret_conv = CResult_UpdateFulfillHTLCDecodeErrorZ_clone_ptr(arg_conv);
25153         return ret_conv;
25154 }
25155
25156 uint64_t  __attribute__((export_name("TS_CResult_UpdateFulfillHTLCDecodeErrorZ_clone"))) TS_CResult_UpdateFulfillHTLCDecodeErrorZ_clone(uint64_t orig) {
25157         LDKCResult_UpdateFulfillHTLCDecodeErrorZ* orig_conv = (LDKCResult_UpdateFulfillHTLCDecodeErrorZ*)untag_ptr(orig);
25158         LDKCResult_UpdateFulfillHTLCDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UpdateFulfillHTLCDecodeErrorZ), "LDKCResult_UpdateFulfillHTLCDecodeErrorZ");
25159         *ret_conv = CResult_UpdateFulfillHTLCDecodeErrorZ_clone(orig_conv);
25160         return tag_ptr(ret_conv, true);
25161 }
25162
25163 uint64_t  __attribute__((export_name("TS_CResult_UpdateAddHTLCDecodeErrorZ_ok"))) TS_CResult_UpdateAddHTLCDecodeErrorZ_ok(uint64_t o) {
25164         LDKUpdateAddHTLC o_conv;
25165         o_conv.inner = untag_ptr(o);
25166         o_conv.is_owned = ptr_is_owned(o);
25167         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
25168         o_conv = UpdateAddHTLC_clone(&o_conv);
25169         LDKCResult_UpdateAddHTLCDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UpdateAddHTLCDecodeErrorZ), "LDKCResult_UpdateAddHTLCDecodeErrorZ");
25170         *ret_conv = CResult_UpdateAddHTLCDecodeErrorZ_ok(o_conv);
25171         return tag_ptr(ret_conv, true);
25172 }
25173
25174 uint64_t  __attribute__((export_name("TS_CResult_UpdateAddHTLCDecodeErrorZ_err"))) TS_CResult_UpdateAddHTLCDecodeErrorZ_err(uint64_t e) {
25175         void* e_ptr = untag_ptr(e);
25176         CHECK_ACCESS(e_ptr);
25177         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
25178         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
25179         LDKCResult_UpdateAddHTLCDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UpdateAddHTLCDecodeErrorZ), "LDKCResult_UpdateAddHTLCDecodeErrorZ");
25180         *ret_conv = CResult_UpdateAddHTLCDecodeErrorZ_err(e_conv);
25181         return tag_ptr(ret_conv, true);
25182 }
25183
25184 jboolean  __attribute__((export_name("TS_CResult_UpdateAddHTLCDecodeErrorZ_is_ok"))) TS_CResult_UpdateAddHTLCDecodeErrorZ_is_ok(uint64_t o) {
25185         LDKCResult_UpdateAddHTLCDecodeErrorZ* o_conv = (LDKCResult_UpdateAddHTLCDecodeErrorZ*)untag_ptr(o);
25186         jboolean ret_conv = CResult_UpdateAddHTLCDecodeErrorZ_is_ok(o_conv);
25187         return ret_conv;
25188 }
25189
25190 void  __attribute__((export_name("TS_CResult_UpdateAddHTLCDecodeErrorZ_free"))) TS_CResult_UpdateAddHTLCDecodeErrorZ_free(uint64_t _res) {
25191         if (!ptr_is_owned(_res)) return;
25192         void* _res_ptr = untag_ptr(_res);
25193         CHECK_ACCESS(_res_ptr);
25194         LDKCResult_UpdateAddHTLCDecodeErrorZ _res_conv = *(LDKCResult_UpdateAddHTLCDecodeErrorZ*)(_res_ptr);
25195         FREE(untag_ptr(_res));
25196         CResult_UpdateAddHTLCDecodeErrorZ_free(_res_conv);
25197 }
25198
25199 static inline uint64_t CResult_UpdateAddHTLCDecodeErrorZ_clone_ptr(LDKCResult_UpdateAddHTLCDecodeErrorZ *NONNULL_PTR arg) {
25200         LDKCResult_UpdateAddHTLCDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UpdateAddHTLCDecodeErrorZ), "LDKCResult_UpdateAddHTLCDecodeErrorZ");
25201         *ret_conv = CResult_UpdateAddHTLCDecodeErrorZ_clone(arg);
25202         return tag_ptr(ret_conv, true);
25203 }
25204 int64_t  __attribute__((export_name("TS_CResult_UpdateAddHTLCDecodeErrorZ_clone_ptr"))) TS_CResult_UpdateAddHTLCDecodeErrorZ_clone_ptr(uint64_t arg) {
25205         LDKCResult_UpdateAddHTLCDecodeErrorZ* arg_conv = (LDKCResult_UpdateAddHTLCDecodeErrorZ*)untag_ptr(arg);
25206         int64_t ret_conv = CResult_UpdateAddHTLCDecodeErrorZ_clone_ptr(arg_conv);
25207         return ret_conv;
25208 }
25209
25210 uint64_t  __attribute__((export_name("TS_CResult_UpdateAddHTLCDecodeErrorZ_clone"))) TS_CResult_UpdateAddHTLCDecodeErrorZ_clone(uint64_t orig) {
25211         LDKCResult_UpdateAddHTLCDecodeErrorZ* orig_conv = (LDKCResult_UpdateAddHTLCDecodeErrorZ*)untag_ptr(orig);
25212         LDKCResult_UpdateAddHTLCDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UpdateAddHTLCDecodeErrorZ), "LDKCResult_UpdateAddHTLCDecodeErrorZ");
25213         *ret_conv = CResult_UpdateAddHTLCDecodeErrorZ_clone(orig_conv);
25214         return tag_ptr(ret_conv, true);
25215 }
25216
25217 uint64_t  __attribute__((export_name("TS_CResult_OnionMessageDecodeErrorZ_ok"))) TS_CResult_OnionMessageDecodeErrorZ_ok(uint64_t o) {
25218         LDKOnionMessage o_conv;
25219         o_conv.inner = untag_ptr(o);
25220         o_conv.is_owned = ptr_is_owned(o);
25221         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
25222         o_conv = OnionMessage_clone(&o_conv);
25223         LDKCResult_OnionMessageDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_OnionMessageDecodeErrorZ), "LDKCResult_OnionMessageDecodeErrorZ");
25224         *ret_conv = CResult_OnionMessageDecodeErrorZ_ok(o_conv);
25225         return tag_ptr(ret_conv, true);
25226 }
25227
25228 uint64_t  __attribute__((export_name("TS_CResult_OnionMessageDecodeErrorZ_err"))) TS_CResult_OnionMessageDecodeErrorZ_err(uint64_t e) {
25229         void* e_ptr = untag_ptr(e);
25230         CHECK_ACCESS(e_ptr);
25231         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
25232         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
25233         LDKCResult_OnionMessageDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_OnionMessageDecodeErrorZ), "LDKCResult_OnionMessageDecodeErrorZ");
25234         *ret_conv = CResult_OnionMessageDecodeErrorZ_err(e_conv);
25235         return tag_ptr(ret_conv, true);
25236 }
25237
25238 jboolean  __attribute__((export_name("TS_CResult_OnionMessageDecodeErrorZ_is_ok"))) TS_CResult_OnionMessageDecodeErrorZ_is_ok(uint64_t o) {
25239         LDKCResult_OnionMessageDecodeErrorZ* o_conv = (LDKCResult_OnionMessageDecodeErrorZ*)untag_ptr(o);
25240         jboolean ret_conv = CResult_OnionMessageDecodeErrorZ_is_ok(o_conv);
25241         return ret_conv;
25242 }
25243
25244 void  __attribute__((export_name("TS_CResult_OnionMessageDecodeErrorZ_free"))) TS_CResult_OnionMessageDecodeErrorZ_free(uint64_t _res) {
25245         if (!ptr_is_owned(_res)) return;
25246         void* _res_ptr = untag_ptr(_res);
25247         CHECK_ACCESS(_res_ptr);
25248         LDKCResult_OnionMessageDecodeErrorZ _res_conv = *(LDKCResult_OnionMessageDecodeErrorZ*)(_res_ptr);
25249         FREE(untag_ptr(_res));
25250         CResult_OnionMessageDecodeErrorZ_free(_res_conv);
25251 }
25252
25253 static inline uint64_t CResult_OnionMessageDecodeErrorZ_clone_ptr(LDKCResult_OnionMessageDecodeErrorZ *NONNULL_PTR arg) {
25254         LDKCResult_OnionMessageDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_OnionMessageDecodeErrorZ), "LDKCResult_OnionMessageDecodeErrorZ");
25255         *ret_conv = CResult_OnionMessageDecodeErrorZ_clone(arg);
25256         return tag_ptr(ret_conv, true);
25257 }
25258 int64_t  __attribute__((export_name("TS_CResult_OnionMessageDecodeErrorZ_clone_ptr"))) TS_CResult_OnionMessageDecodeErrorZ_clone_ptr(uint64_t arg) {
25259         LDKCResult_OnionMessageDecodeErrorZ* arg_conv = (LDKCResult_OnionMessageDecodeErrorZ*)untag_ptr(arg);
25260         int64_t ret_conv = CResult_OnionMessageDecodeErrorZ_clone_ptr(arg_conv);
25261         return ret_conv;
25262 }
25263
25264 uint64_t  __attribute__((export_name("TS_CResult_OnionMessageDecodeErrorZ_clone"))) TS_CResult_OnionMessageDecodeErrorZ_clone(uint64_t orig) {
25265         LDKCResult_OnionMessageDecodeErrorZ* orig_conv = (LDKCResult_OnionMessageDecodeErrorZ*)untag_ptr(orig);
25266         LDKCResult_OnionMessageDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_OnionMessageDecodeErrorZ), "LDKCResult_OnionMessageDecodeErrorZ");
25267         *ret_conv = CResult_OnionMessageDecodeErrorZ_clone(orig_conv);
25268         return tag_ptr(ret_conv, true);
25269 }
25270
25271 uint64_t  __attribute__((export_name("TS_CResult_PingDecodeErrorZ_ok"))) TS_CResult_PingDecodeErrorZ_ok(uint64_t o) {
25272         LDKPing o_conv;
25273         o_conv.inner = untag_ptr(o);
25274         o_conv.is_owned = ptr_is_owned(o);
25275         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
25276         o_conv = Ping_clone(&o_conv);
25277         LDKCResult_PingDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PingDecodeErrorZ), "LDKCResult_PingDecodeErrorZ");
25278         *ret_conv = CResult_PingDecodeErrorZ_ok(o_conv);
25279         return tag_ptr(ret_conv, true);
25280 }
25281
25282 uint64_t  __attribute__((export_name("TS_CResult_PingDecodeErrorZ_err"))) TS_CResult_PingDecodeErrorZ_err(uint64_t e) {
25283         void* e_ptr = untag_ptr(e);
25284         CHECK_ACCESS(e_ptr);
25285         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
25286         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
25287         LDKCResult_PingDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PingDecodeErrorZ), "LDKCResult_PingDecodeErrorZ");
25288         *ret_conv = CResult_PingDecodeErrorZ_err(e_conv);
25289         return tag_ptr(ret_conv, true);
25290 }
25291
25292 jboolean  __attribute__((export_name("TS_CResult_PingDecodeErrorZ_is_ok"))) TS_CResult_PingDecodeErrorZ_is_ok(uint64_t o) {
25293         LDKCResult_PingDecodeErrorZ* o_conv = (LDKCResult_PingDecodeErrorZ*)untag_ptr(o);
25294         jboolean ret_conv = CResult_PingDecodeErrorZ_is_ok(o_conv);
25295         return ret_conv;
25296 }
25297
25298 void  __attribute__((export_name("TS_CResult_PingDecodeErrorZ_free"))) TS_CResult_PingDecodeErrorZ_free(uint64_t _res) {
25299         if (!ptr_is_owned(_res)) return;
25300         void* _res_ptr = untag_ptr(_res);
25301         CHECK_ACCESS(_res_ptr);
25302         LDKCResult_PingDecodeErrorZ _res_conv = *(LDKCResult_PingDecodeErrorZ*)(_res_ptr);
25303         FREE(untag_ptr(_res));
25304         CResult_PingDecodeErrorZ_free(_res_conv);
25305 }
25306
25307 static inline uint64_t CResult_PingDecodeErrorZ_clone_ptr(LDKCResult_PingDecodeErrorZ *NONNULL_PTR arg) {
25308         LDKCResult_PingDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PingDecodeErrorZ), "LDKCResult_PingDecodeErrorZ");
25309         *ret_conv = CResult_PingDecodeErrorZ_clone(arg);
25310         return tag_ptr(ret_conv, true);
25311 }
25312 int64_t  __attribute__((export_name("TS_CResult_PingDecodeErrorZ_clone_ptr"))) TS_CResult_PingDecodeErrorZ_clone_ptr(uint64_t arg) {
25313         LDKCResult_PingDecodeErrorZ* arg_conv = (LDKCResult_PingDecodeErrorZ*)untag_ptr(arg);
25314         int64_t ret_conv = CResult_PingDecodeErrorZ_clone_ptr(arg_conv);
25315         return ret_conv;
25316 }
25317
25318 uint64_t  __attribute__((export_name("TS_CResult_PingDecodeErrorZ_clone"))) TS_CResult_PingDecodeErrorZ_clone(uint64_t orig) {
25319         LDKCResult_PingDecodeErrorZ* orig_conv = (LDKCResult_PingDecodeErrorZ*)untag_ptr(orig);
25320         LDKCResult_PingDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PingDecodeErrorZ), "LDKCResult_PingDecodeErrorZ");
25321         *ret_conv = CResult_PingDecodeErrorZ_clone(orig_conv);
25322         return tag_ptr(ret_conv, true);
25323 }
25324
25325 uint64_t  __attribute__((export_name("TS_CResult_PongDecodeErrorZ_ok"))) TS_CResult_PongDecodeErrorZ_ok(uint64_t o) {
25326         LDKPong o_conv;
25327         o_conv.inner = untag_ptr(o);
25328         o_conv.is_owned = ptr_is_owned(o);
25329         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
25330         o_conv = Pong_clone(&o_conv);
25331         LDKCResult_PongDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PongDecodeErrorZ), "LDKCResult_PongDecodeErrorZ");
25332         *ret_conv = CResult_PongDecodeErrorZ_ok(o_conv);
25333         return tag_ptr(ret_conv, true);
25334 }
25335
25336 uint64_t  __attribute__((export_name("TS_CResult_PongDecodeErrorZ_err"))) TS_CResult_PongDecodeErrorZ_err(uint64_t e) {
25337         void* e_ptr = untag_ptr(e);
25338         CHECK_ACCESS(e_ptr);
25339         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
25340         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
25341         LDKCResult_PongDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PongDecodeErrorZ), "LDKCResult_PongDecodeErrorZ");
25342         *ret_conv = CResult_PongDecodeErrorZ_err(e_conv);
25343         return tag_ptr(ret_conv, true);
25344 }
25345
25346 jboolean  __attribute__((export_name("TS_CResult_PongDecodeErrorZ_is_ok"))) TS_CResult_PongDecodeErrorZ_is_ok(uint64_t o) {
25347         LDKCResult_PongDecodeErrorZ* o_conv = (LDKCResult_PongDecodeErrorZ*)untag_ptr(o);
25348         jboolean ret_conv = CResult_PongDecodeErrorZ_is_ok(o_conv);
25349         return ret_conv;
25350 }
25351
25352 void  __attribute__((export_name("TS_CResult_PongDecodeErrorZ_free"))) TS_CResult_PongDecodeErrorZ_free(uint64_t _res) {
25353         if (!ptr_is_owned(_res)) return;
25354         void* _res_ptr = untag_ptr(_res);
25355         CHECK_ACCESS(_res_ptr);
25356         LDKCResult_PongDecodeErrorZ _res_conv = *(LDKCResult_PongDecodeErrorZ*)(_res_ptr);
25357         FREE(untag_ptr(_res));
25358         CResult_PongDecodeErrorZ_free(_res_conv);
25359 }
25360
25361 static inline uint64_t CResult_PongDecodeErrorZ_clone_ptr(LDKCResult_PongDecodeErrorZ *NONNULL_PTR arg) {
25362         LDKCResult_PongDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PongDecodeErrorZ), "LDKCResult_PongDecodeErrorZ");
25363         *ret_conv = CResult_PongDecodeErrorZ_clone(arg);
25364         return tag_ptr(ret_conv, true);
25365 }
25366 int64_t  __attribute__((export_name("TS_CResult_PongDecodeErrorZ_clone_ptr"))) TS_CResult_PongDecodeErrorZ_clone_ptr(uint64_t arg) {
25367         LDKCResult_PongDecodeErrorZ* arg_conv = (LDKCResult_PongDecodeErrorZ*)untag_ptr(arg);
25368         int64_t ret_conv = CResult_PongDecodeErrorZ_clone_ptr(arg_conv);
25369         return ret_conv;
25370 }
25371
25372 uint64_t  __attribute__((export_name("TS_CResult_PongDecodeErrorZ_clone"))) TS_CResult_PongDecodeErrorZ_clone(uint64_t orig) {
25373         LDKCResult_PongDecodeErrorZ* orig_conv = (LDKCResult_PongDecodeErrorZ*)untag_ptr(orig);
25374         LDKCResult_PongDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PongDecodeErrorZ), "LDKCResult_PongDecodeErrorZ");
25375         *ret_conv = CResult_PongDecodeErrorZ_clone(orig_conv);
25376         return tag_ptr(ret_conv, true);
25377 }
25378
25379 uint64_t  __attribute__((export_name("TS_CResult_UnsignedChannelAnnouncementDecodeErrorZ_ok"))) TS_CResult_UnsignedChannelAnnouncementDecodeErrorZ_ok(uint64_t o) {
25380         LDKUnsignedChannelAnnouncement o_conv;
25381         o_conv.inner = untag_ptr(o);
25382         o_conv.is_owned = ptr_is_owned(o);
25383         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
25384         o_conv = UnsignedChannelAnnouncement_clone(&o_conv);
25385         LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ), "LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ");
25386         *ret_conv = CResult_UnsignedChannelAnnouncementDecodeErrorZ_ok(o_conv);
25387         return tag_ptr(ret_conv, true);
25388 }
25389
25390 uint64_t  __attribute__((export_name("TS_CResult_UnsignedChannelAnnouncementDecodeErrorZ_err"))) TS_CResult_UnsignedChannelAnnouncementDecodeErrorZ_err(uint64_t e) {
25391         void* e_ptr = untag_ptr(e);
25392         CHECK_ACCESS(e_ptr);
25393         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
25394         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
25395         LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ), "LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ");
25396         *ret_conv = CResult_UnsignedChannelAnnouncementDecodeErrorZ_err(e_conv);
25397         return tag_ptr(ret_conv, true);
25398 }
25399
25400 jboolean  __attribute__((export_name("TS_CResult_UnsignedChannelAnnouncementDecodeErrorZ_is_ok"))) TS_CResult_UnsignedChannelAnnouncementDecodeErrorZ_is_ok(uint64_t o) {
25401         LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ* o_conv = (LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ*)untag_ptr(o);
25402         jboolean ret_conv = CResult_UnsignedChannelAnnouncementDecodeErrorZ_is_ok(o_conv);
25403         return ret_conv;
25404 }
25405
25406 void  __attribute__((export_name("TS_CResult_UnsignedChannelAnnouncementDecodeErrorZ_free"))) TS_CResult_UnsignedChannelAnnouncementDecodeErrorZ_free(uint64_t _res) {
25407         if (!ptr_is_owned(_res)) return;
25408         void* _res_ptr = untag_ptr(_res);
25409         CHECK_ACCESS(_res_ptr);
25410         LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ _res_conv = *(LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ*)(_res_ptr);
25411         FREE(untag_ptr(_res));
25412         CResult_UnsignedChannelAnnouncementDecodeErrorZ_free(_res_conv);
25413 }
25414
25415 static inline uint64_t CResult_UnsignedChannelAnnouncementDecodeErrorZ_clone_ptr(LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ *NONNULL_PTR arg) {
25416         LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ), "LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ");
25417         *ret_conv = CResult_UnsignedChannelAnnouncementDecodeErrorZ_clone(arg);
25418         return tag_ptr(ret_conv, true);
25419 }
25420 int64_t  __attribute__((export_name("TS_CResult_UnsignedChannelAnnouncementDecodeErrorZ_clone_ptr"))) TS_CResult_UnsignedChannelAnnouncementDecodeErrorZ_clone_ptr(uint64_t arg) {
25421         LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ* arg_conv = (LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ*)untag_ptr(arg);
25422         int64_t ret_conv = CResult_UnsignedChannelAnnouncementDecodeErrorZ_clone_ptr(arg_conv);
25423         return ret_conv;
25424 }
25425
25426 uint64_t  __attribute__((export_name("TS_CResult_UnsignedChannelAnnouncementDecodeErrorZ_clone"))) TS_CResult_UnsignedChannelAnnouncementDecodeErrorZ_clone(uint64_t orig) {
25427         LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ* orig_conv = (LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ*)untag_ptr(orig);
25428         LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ), "LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ");
25429         *ret_conv = CResult_UnsignedChannelAnnouncementDecodeErrorZ_clone(orig_conv);
25430         return tag_ptr(ret_conv, true);
25431 }
25432
25433 uint64_t  __attribute__((export_name("TS_CResult_ChannelAnnouncementDecodeErrorZ_ok"))) TS_CResult_ChannelAnnouncementDecodeErrorZ_ok(uint64_t o) {
25434         LDKChannelAnnouncement o_conv;
25435         o_conv.inner = untag_ptr(o);
25436         o_conv.is_owned = ptr_is_owned(o);
25437         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
25438         o_conv = ChannelAnnouncement_clone(&o_conv);
25439         LDKCResult_ChannelAnnouncementDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelAnnouncementDecodeErrorZ), "LDKCResult_ChannelAnnouncementDecodeErrorZ");
25440         *ret_conv = CResult_ChannelAnnouncementDecodeErrorZ_ok(o_conv);
25441         return tag_ptr(ret_conv, true);
25442 }
25443
25444 uint64_t  __attribute__((export_name("TS_CResult_ChannelAnnouncementDecodeErrorZ_err"))) TS_CResult_ChannelAnnouncementDecodeErrorZ_err(uint64_t e) {
25445         void* e_ptr = untag_ptr(e);
25446         CHECK_ACCESS(e_ptr);
25447         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
25448         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
25449         LDKCResult_ChannelAnnouncementDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelAnnouncementDecodeErrorZ), "LDKCResult_ChannelAnnouncementDecodeErrorZ");
25450         *ret_conv = CResult_ChannelAnnouncementDecodeErrorZ_err(e_conv);
25451         return tag_ptr(ret_conv, true);
25452 }
25453
25454 jboolean  __attribute__((export_name("TS_CResult_ChannelAnnouncementDecodeErrorZ_is_ok"))) TS_CResult_ChannelAnnouncementDecodeErrorZ_is_ok(uint64_t o) {
25455         LDKCResult_ChannelAnnouncementDecodeErrorZ* o_conv = (LDKCResult_ChannelAnnouncementDecodeErrorZ*)untag_ptr(o);
25456         jboolean ret_conv = CResult_ChannelAnnouncementDecodeErrorZ_is_ok(o_conv);
25457         return ret_conv;
25458 }
25459
25460 void  __attribute__((export_name("TS_CResult_ChannelAnnouncementDecodeErrorZ_free"))) TS_CResult_ChannelAnnouncementDecodeErrorZ_free(uint64_t _res) {
25461         if (!ptr_is_owned(_res)) return;
25462         void* _res_ptr = untag_ptr(_res);
25463         CHECK_ACCESS(_res_ptr);
25464         LDKCResult_ChannelAnnouncementDecodeErrorZ _res_conv = *(LDKCResult_ChannelAnnouncementDecodeErrorZ*)(_res_ptr);
25465         FREE(untag_ptr(_res));
25466         CResult_ChannelAnnouncementDecodeErrorZ_free(_res_conv);
25467 }
25468
25469 static inline uint64_t CResult_ChannelAnnouncementDecodeErrorZ_clone_ptr(LDKCResult_ChannelAnnouncementDecodeErrorZ *NONNULL_PTR arg) {
25470         LDKCResult_ChannelAnnouncementDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelAnnouncementDecodeErrorZ), "LDKCResult_ChannelAnnouncementDecodeErrorZ");
25471         *ret_conv = CResult_ChannelAnnouncementDecodeErrorZ_clone(arg);
25472         return tag_ptr(ret_conv, true);
25473 }
25474 int64_t  __attribute__((export_name("TS_CResult_ChannelAnnouncementDecodeErrorZ_clone_ptr"))) TS_CResult_ChannelAnnouncementDecodeErrorZ_clone_ptr(uint64_t arg) {
25475         LDKCResult_ChannelAnnouncementDecodeErrorZ* arg_conv = (LDKCResult_ChannelAnnouncementDecodeErrorZ*)untag_ptr(arg);
25476         int64_t ret_conv = CResult_ChannelAnnouncementDecodeErrorZ_clone_ptr(arg_conv);
25477         return ret_conv;
25478 }
25479
25480 uint64_t  __attribute__((export_name("TS_CResult_ChannelAnnouncementDecodeErrorZ_clone"))) TS_CResult_ChannelAnnouncementDecodeErrorZ_clone(uint64_t orig) {
25481         LDKCResult_ChannelAnnouncementDecodeErrorZ* orig_conv = (LDKCResult_ChannelAnnouncementDecodeErrorZ*)untag_ptr(orig);
25482         LDKCResult_ChannelAnnouncementDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelAnnouncementDecodeErrorZ), "LDKCResult_ChannelAnnouncementDecodeErrorZ");
25483         *ret_conv = CResult_ChannelAnnouncementDecodeErrorZ_clone(orig_conv);
25484         return tag_ptr(ret_conv, true);
25485 }
25486
25487 uint64_t  __attribute__((export_name("TS_CResult_UnsignedChannelUpdateDecodeErrorZ_ok"))) TS_CResult_UnsignedChannelUpdateDecodeErrorZ_ok(uint64_t o) {
25488         LDKUnsignedChannelUpdate o_conv;
25489         o_conv.inner = untag_ptr(o);
25490         o_conv.is_owned = ptr_is_owned(o);
25491         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
25492         o_conv = UnsignedChannelUpdate_clone(&o_conv);
25493         LDKCResult_UnsignedChannelUpdateDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UnsignedChannelUpdateDecodeErrorZ), "LDKCResult_UnsignedChannelUpdateDecodeErrorZ");
25494         *ret_conv = CResult_UnsignedChannelUpdateDecodeErrorZ_ok(o_conv);
25495         return tag_ptr(ret_conv, true);
25496 }
25497
25498 uint64_t  __attribute__((export_name("TS_CResult_UnsignedChannelUpdateDecodeErrorZ_err"))) TS_CResult_UnsignedChannelUpdateDecodeErrorZ_err(uint64_t e) {
25499         void* e_ptr = untag_ptr(e);
25500         CHECK_ACCESS(e_ptr);
25501         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
25502         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
25503         LDKCResult_UnsignedChannelUpdateDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UnsignedChannelUpdateDecodeErrorZ), "LDKCResult_UnsignedChannelUpdateDecodeErrorZ");
25504         *ret_conv = CResult_UnsignedChannelUpdateDecodeErrorZ_err(e_conv);
25505         return tag_ptr(ret_conv, true);
25506 }
25507
25508 jboolean  __attribute__((export_name("TS_CResult_UnsignedChannelUpdateDecodeErrorZ_is_ok"))) TS_CResult_UnsignedChannelUpdateDecodeErrorZ_is_ok(uint64_t o) {
25509         LDKCResult_UnsignedChannelUpdateDecodeErrorZ* o_conv = (LDKCResult_UnsignedChannelUpdateDecodeErrorZ*)untag_ptr(o);
25510         jboolean ret_conv = CResult_UnsignedChannelUpdateDecodeErrorZ_is_ok(o_conv);
25511         return ret_conv;
25512 }
25513
25514 void  __attribute__((export_name("TS_CResult_UnsignedChannelUpdateDecodeErrorZ_free"))) TS_CResult_UnsignedChannelUpdateDecodeErrorZ_free(uint64_t _res) {
25515         if (!ptr_is_owned(_res)) return;
25516         void* _res_ptr = untag_ptr(_res);
25517         CHECK_ACCESS(_res_ptr);
25518         LDKCResult_UnsignedChannelUpdateDecodeErrorZ _res_conv = *(LDKCResult_UnsignedChannelUpdateDecodeErrorZ*)(_res_ptr);
25519         FREE(untag_ptr(_res));
25520         CResult_UnsignedChannelUpdateDecodeErrorZ_free(_res_conv);
25521 }
25522
25523 static inline uint64_t CResult_UnsignedChannelUpdateDecodeErrorZ_clone_ptr(LDKCResult_UnsignedChannelUpdateDecodeErrorZ *NONNULL_PTR arg) {
25524         LDKCResult_UnsignedChannelUpdateDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UnsignedChannelUpdateDecodeErrorZ), "LDKCResult_UnsignedChannelUpdateDecodeErrorZ");
25525         *ret_conv = CResult_UnsignedChannelUpdateDecodeErrorZ_clone(arg);
25526         return tag_ptr(ret_conv, true);
25527 }
25528 int64_t  __attribute__((export_name("TS_CResult_UnsignedChannelUpdateDecodeErrorZ_clone_ptr"))) TS_CResult_UnsignedChannelUpdateDecodeErrorZ_clone_ptr(uint64_t arg) {
25529         LDKCResult_UnsignedChannelUpdateDecodeErrorZ* arg_conv = (LDKCResult_UnsignedChannelUpdateDecodeErrorZ*)untag_ptr(arg);
25530         int64_t ret_conv = CResult_UnsignedChannelUpdateDecodeErrorZ_clone_ptr(arg_conv);
25531         return ret_conv;
25532 }
25533
25534 uint64_t  __attribute__((export_name("TS_CResult_UnsignedChannelUpdateDecodeErrorZ_clone"))) TS_CResult_UnsignedChannelUpdateDecodeErrorZ_clone(uint64_t orig) {
25535         LDKCResult_UnsignedChannelUpdateDecodeErrorZ* orig_conv = (LDKCResult_UnsignedChannelUpdateDecodeErrorZ*)untag_ptr(orig);
25536         LDKCResult_UnsignedChannelUpdateDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UnsignedChannelUpdateDecodeErrorZ), "LDKCResult_UnsignedChannelUpdateDecodeErrorZ");
25537         *ret_conv = CResult_UnsignedChannelUpdateDecodeErrorZ_clone(orig_conv);
25538         return tag_ptr(ret_conv, true);
25539 }
25540
25541 uint64_t  __attribute__((export_name("TS_CResult_ChannelUpdateDecodeErrorZ_ok"))) TS_CResult_ChannelUpdateDecodeErrorZ_ok(uint64_t o) {
25542         LDKChannelUpdate o_conv;
25543         o_conv.inner = untag_ptr(o);
25544         o_conv.is_owned = ptr_is_owned(o);
25545         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
25546         o_conv = ChannelUpdate_clone(&o_conv);
25547         LDKCResult_ChannelUpdateDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelUpdateDecodeErrorZ), "LDKCResult_ChannelUpdateDecodeErrorZ");
25548         *ret_conv = CResult_ChannelUpdateDecodeErrorZ_ok(o_conv);
25549         return tag_ptr(ret_conv, true);
25550 }
25551
25552 uint64_t  __attribute__((export_name("TS_CResult_ChannelUpdateDecodeErrorZ_err"))) TS_CResult_ChannelUpdateDecodeErrorZ_err(uint64_t e) {
25553         void* e_ptr = untag_ptr(e);
25554         CHECK_ACCESS(e_ptr);
25555         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
25556         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
25557         LDKCResult_ChannelUpdateDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelUpdateDecodeErrorZ), "LDKCResult_ChannelUpdateDecodeErrorZ");
25558         *ret_conv = CResult_ChannelUpdateDecodeErrorZ_err(e_conv);
25559         return tag_ptr(ret_conv, true);
25560 }
25561
25562 jboolean  __attribute__((export_name("TS_CResult_ChannelUpdateDecodeErrorZ_is_ok"))) TS_CResult_ChannelUpdateDecodeErrorZ_is_ok(uint64_t o) {
25563         LDKCResult_ChannelUpdateDecodeErrorZ* o_conv = (LDKCResult_ChannelUpdateDecodeErrorZ*)untag_ptr(o);
25564         jboolean ret_conv = CResult_ChannelUpdateDecodeErrorZ_is_ok(o_conv);
25565         return ret_conv;
25566 }
25567
25568 void  __attribute__((export_name("TS_CResult_ChannelUpdateDecodeErrorZ_free"))) TS_CResult_ChannelUpdateDecodeErrorZ_free(uint64_t _res) {
25569         if (!ptr_is_owned(_res)) return;
25570         void* _res_ptr = untag_ptr(_res);
25571         CHECK_ACCESS(_res_ptr);
25572         LDKCResult_ChannelUpdateDecodeErrorZ _res_conv = *(LDKCResult_ChannelUpdateDecodeErrorZ*)(_res_ptr);
25573         FREE(untag_ptr(_res));
25574         CResult_ChannelUpdateDecodeErrorZ_free(_res_conv);
25575 }
25576
25577 static inline uint64_t CResult_ChannelUpdateDecodeErrorZ_clone_ptr(LDKCResult_ChannelUpdateDecodeErrorZ *NONNULL_PTR arg) {
25578         LDKCResult_ChannelUpdateDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelUpdateDecodeErrorZ), "LDKCResult_ChannelUpdateDecodeErrorZ");
25579         *ret_conv = CResult_ChannelUpdateDecodeErrorZ_clone(arg);
25580         return tag_ptr(ret_conv, true);
25581 }
25582 int64_t  __attribute__((export_name("TS_CResult_ChannelUpdateDecodeErrorZ_clone_ptr"))) TS_CResult_ChannelUpdateDecodeErrorZ_clone_ptr(uint64_t arg) {
25583         LDKCResult_ChannelUpdateDecodeErrorZ* arg_conv = (LDKCResult_ChannelUpdateDecodeErrorZ*)untag_ptr(arg);
25584         int64_t ret_conv = CResult_ChannelUpdateDecodeErrorZ_clone_ptr(arg_conv);
25585         return ret_conv;
25586 }
25587
25588 uint64_t  __attribute__((export_name("TS_CResult_ChannelUpdateDecodeErrorZ_clone"))) TS_CResult_ChannelUpdateDecodeErrorZ_clone(uint64_t orig) {
25589         LDKCResult_ChannelUpdateDecodeErrorZ* orig_conv = (LDKCResult_ChannelUpdateDecodeErrorZ*)untag_ptr(orig);
25590         LDKCResult_ChannelUpdateDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelUpdateDecodeErrorZ), "LDKCResult_ChannelUpdateDecodeErrorZ");
25591         *ret_conv = CResult_ChannelUpdateDecodeErrorZ_clone(orig_conv);
25592         return tag_ptr(ret_conv, true);
25593 }
25594
25595 uint64_t  __attribute__((export_name("TS_CResult_ErrorMessageDecodeErrorZ_ok"))) TS_CResult_ErrorMessageDecodeErrorZ_ok(uint64_t o) {
25596         LDKErrorMessage o_conv;
25597         o_conv.inner = untag_ptr(o);
25598         o_conv.is_owned = ptr_is_owned(o);
25599         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
25600         o_conv = ErrorMessage_clone(&o_conv);
25601         LDKCResult_ErrorMessageDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ErrorMessageDecodeErrorZ), "LDKCResult_ErrorMessageDecodeErrorZ");
25602         *ret_conv = CResult_ErrorMessageDecodeErrorZ_ok(o_conv);
25603         return tag_ptr(ret_conv, true);
25604 }
25605
25606 uint64_t  __attribute__((export_name("TS_CResult_ErrorMessageDecodeErrorZ_err"))) TS_CResult_ErrorMessageDecodeErrorZ_err(uint64_t e) {
25607         void* e_ptr = untag_ptr(e);
25608         CHECK_ACCESS(e_ptr);
25609         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
25610         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
25611         LDKCResult_ErrorMessageDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ErrorMessageDecodeErrorZ), "LDKCResult_ErrorMessageDecodeErrorZ");
25612         *ret_conv = CResult_ErrorMessageDecodeErrorZ_err(e_conv);
25613         return tag_ptr(ret_conv, true);
25614 }
25615
25616 jboolean  __attribute__((export_name("TS_CResult_ErrorMessageDecodeErrorZ_is_ok"))) TS_CResult_ErrorMessageDecodeErrorZ_is_ok(uint64_t o) {
25617         LDKCResult_ErrorMessageDecodeErrorZ* o_conv = (LDKCResult_ErrorMessageDecodeErrorZ*)untag_ptr(o);
25618         jboolean ret_conv = CResult_ErrorMessageDecodeErrorZ_is_ok(o_conv);
25619         return ret_conv;
25620 }
25621
25622 void  __attribute__((export_name("TS_CResult_ErrorMessageDecodeErrorZ_free"))) TS_CResult_ErrorMessageDecodeErrorZ_free(uint64_t _res) {
25623         if (!ptr_is_owned(_res)) return;
25624         void* _res_ptr = untag_ptr(_res);
25625         CHECK_ACCESS(_res_ptr);
25626         LDKCResult_ErrorMessageDecodeErrorZ _res_conv = *(LDKCResult_ErrorMessageDecodeErrorZ*)(_res_ptr);
25627         FREE(untag_ptr(_res));
25628         CResult_ErrorMessageDecodeErrorZ_free(_res_conv);
25629 }
25630
25631 static inline uint64_t CResult_ErrorMessageDecodeErrorZ_clone_ptr(LDKCResult_ErrorMessageDecodeErrorZ *NONNULL_PTR arg) {
25632         LDKCResult_ErrorMessageDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ErrorMessageDecodeErrorZ), "LDKCResult_ErrorMessageDecodeErrorZ");
25633         *ret_conv = CResult_ErrorMessageDecodeErrorZ_clone(arg);
25634         return tag_ptr(ret_conv, true);
25635 }
25636 int64_t  __attribute__((export_name("TS_CResult_ErrorMessageDecodeErrorZ_clone_ptr"))) TS_CResult_ErrorMessageDecodeErrorZ_clone_ptr(uint64_t arg) {
25637         LDKCResult_ErrorMessageDecodeErrorZ* arg_conv = (LDKCResult_ErrorMessageDecodeErrorZ*)untag_ptr(arg);
25638         int64_t ret_conv = CResult_ErrorMessageDecodeErrorZ_clone_ptr(arg_conv);
25639         return ret_conv;
25640 }
25641
25642 uint64_t  __attribute__((export_name("TS_CResult_ErrorMessageDecodeErrorZ_clone"))) TS_CResult_ErrorMessageDecodeErrorZ_clone(uint64_t orig) {
25643         LDKCResult_ErrorMessageDecodeErrorZ* orig_conv = (LDKCResult_ErrorMessageDecodeErrorZ*)untag_ptr(orig);
25644         LDKCResult_ErrorMessageDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ErrorMessageDecodeErrorZ), "LDKCResult_ErrorMessageDecodeErrorZ");
25645         *ret_conv = CResult_ErrorMessageDecodeErrorZ_clone(orig_conv);
25646         return tag_ptr(ret_conv, true);
25647 }
25648
25649 uint64_t  __attribute__((export_name("TS_CResult_WarningMessageDecodeErrorZ_ok"))) TS_CResult_WarningMessageDecodeErrorZ_ok(uint64_t o) {
25650         LDKWarningMessage o_conv;
25651         o_conv.inner = untag_ptr(o);
25652         o_conv.is_owned = ptr_is_owned(o);
25653         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
25654         o_conv = WarningMessage_clone(&o_conv);
25655         LDKCResult_WarningMessageDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_WarningMessageDecodeErrorZ), "LDKCResult_WarningMessageDecodeErrorZ");
25656         *ret_conv = CResult_WarningMessageDecodeErrorZ_ok(o_conv);
25657         return tag_ptr(ret_conv, true);
25658 }
25659
25660 uint64_t  __attribute__((export_name("TS_CResult_WarningMessageDecodeErrorZ_err"))) TS_CResult_WarningMessageDecodeErrorZ_err(uint64_t e) {
25661         void* e_ptr = untag_ptr(e);
25662         CHECK_ACCESS(e_ptr);
25663         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
25664         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
25665         LDKCResult_WarningMessageDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_WarningMessageDecodeErrorZ), "LDKCResult_WarningMessageDecodeErrorZ");
25666         *ret_conv = CResult_WarningMessageDecodeErrorZ_err(e_conv);
25667         return tag_ptr(ret_conv, true);
25668 }
25669
25670 jboolean  __attribute__((export_name("TS_CResult_WarningMessageDecodeErrorZ_is_ok"))) TS_CResult_WarningMessageDecodeErrorZ_is_ok(uint64_t o) {
25671         LDKCResult_WarningMessageDecodeErrorZ* o_conv = (LDKCResult_WarningMessageDecodeErrorZ*)untag_ptr(o);
25672         jboolean ret_conv = CResult_WarningMessageDecodeErrorZ_is_ok(o_conv);
25673         return ret_conv;
25674 }
25675
25676 void  __attribute__((export_name("TS_CResult_WarningMessageDecodeErrorZ_free"))) TS_CResult_WarningMessageDecodeErrorZ_free(uint64_t _res) {
25677         if (!ptr_is_owned(_res)) return;
25678         void* _res_ptr = untag_ptr(_res);
25679         CHECK_ACCESS(_res_ptr);
25680         LDKCResult_WarningMessageDecodeErrorZ _res_conv = *(LDKCResult_WarningMessageDecodeErrorZ*)(_res_ptr);
25681         FREE(untag_ptr(_res));
25682         CResult_WarningMessageDecodeErrorZ_free(_res_conv);
25683 }
25684
25685 static inline uint64_t CResult_WarningMessageDecodeErrorZ_clone_ptr(LDKCResult_WarningMessageDecodeErrorZ *NONNULL_PTR arg) {
25686         LDKCResult_WarningMessageDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_WarningMessageDecodeErrorZ), "LDKCResult_WarningMessageDecodeErrorZ");
25687         *ret_conv = CResult_WarningMessageDecodeErrorZ_clone(arg);
25688         return tag_ptr(ret_conv, true);
25689 }
25690 int64_t  __attribute__((export_name("TS_CResult_WarningMessageDecodeErrorZ_clone_ptr"))) TS_CResult_WarningMessageDecodeErrorZ_clone_ptr(uint64_t arg) {
25691         LDKCResult_WarningMessageDecodeErrorZ* arg_conv = (LDKCResult_WarningMessageDecodeErrorZ*)untag_ptr(arg);
25692         int64_t ret_conv = CResult_WarningMessageDecodeErrorZ_clone_ptr(arg_conv);
25693         return ret_conv;
25694 }
25695
25696 uint64_t  __attribute__((export_name("TS_CResult_WarningMessageDecodeErrorZ_clone"))) TS_CResult_WarningMessageDecodeErrorZ_clone(uint64_t orig) {
25697         LDKCResult_WarningMessageDecodeErrorZ* orig_conv = (LDKCResult_WarningMessageDecodeErrorZ*)untag_ptr(orig);
25698         LDKCResult_WarningMessageDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_WarningMessageDecodeErrorZ), "LDKCResult_WarningMessageDecodeErrorZ");
25699         *ret_conv = CResult_WarningMessageDecodeErrorZ_clone(orig_conv);
25700         return tag_ptr(ret_conv, true);
25701 }
25702
25703 uint64_t  __attribute__((export_name("TS_CResult_UnsignedNodeAnnouncementDecodeErrorZ_ok"))) TS_CResult_UnsignedNodeAnnouncementDecodeErrorZ_ok(uint64_t o) {
25704         LDKUnsignedNodeAnnouncement o_conv;
25705         o_conv.inner = untag_ptr(o);
25706         o_conv.is_owned = ptr_is_owned(o);
25707         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
25708         o_conv = UnsignedNodeAnnouncement_clone(&o_conv);
25709         LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ), "LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ");
25710         *ret_conv = CResult_UnsignedNodeAnnouncementDecodeErrorZ_ok(o_conv);
25711         return tag_ptr(ret_conv, true);
25712 }
25713
25714 uint64_t  __attribute__((export_name("TS_CResult_UnsignedNodeAnnouncementDecodeErrorZ_err"))) TS_CResult_UnsignedNodeAnnouncementDecodeErrorZ_err(uint64_t e) {
25715         void* e_ptr = untag_ptr(e);
25716         CHECK_ACCESS(e_ptr);
25717         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
25718         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
25719         LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ), "LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ");
25720         *ret_conv = CResult_UnsignedNodeAnnouncementDecodeErrorZ_err(e_conv);
25721         return tag_ptr(ret_conv, true);
25722 }
25723
25724 jboolean  __attribute__((export_name("TS_CResult_UnsignedNodeAnnouncementDecodeErrorZ_is_ok"))) TS_CResult_UnsignedNodeAnnouncementDecodeErrorZ_is_ok(uint64_t o) {
25725         LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ* o_conv = (LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ*)untag_ptr(o);
25726         jboolean ret_conv = CResult_UnsignedNodeAnnouncementDecodeErrorZ_is_ok(o_conv);
25727         return ret_conv;
25728 }
25729
25730 void  __attribute__((export_name("TS_CResult_UnsignedNodeAnnouncementDecodeErrorZ_free"))) TS_CResult_UnsignedNodeAnnouncementDecodeErrorZ_free(uint64_t _res) {
25731         if (!ptr_is_owned(_res)) return;
25732         void* _res_ptr = untag_ptr(_res);
25733         CHECK_ACCESS(_res_ptr);
25734         LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ _res_conv = *(LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ*)(_res_ptr);
25735         FREE(untag_ptr(_res));
25736         CResult_UnsignedNodeAnnouncementDecodeErrorZ_free(_res_conv);
25737 }
25738
25739 static inline uint64_t CResult_UnsignedNodeAnnouncementDecodeErrorZ_clone_ptr(LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ *NONNULL_PTR arg) {
25740         LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ), "LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ");
25741         *ret_conv = CResult_UnsignedNodeAnnouncementDecodeErrorZ_clone(arg);
25742         return tag_ptr(ret_conv, true);
25743 }
25744 int64_t  __attribute__((export_name("TS_CResult_UnsignedNodeAnnouncementDecodeErrorZ_clone_ptr"))) TS_CResult_UnsignedNodeAnnouncementDecodeErrorZ_clone_ptr(uint64_t arg) {
25745         LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ* arg_conv = (LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ*)untag_ptr(arg);
25746         int64_t ret_conv = CResult_UnsignedNodeAnnouncementDecodeErrorZ_clone_ptr(arg_conv);
25747         return ret_conv;
25748 }
25749
25750 uint64_t  __attribute__((export_name("TS_CResult_UnsignedNodeAnnouncementDecodeErrorZ_clone"))) TS_CResult_UnsignedNodeAnnouncementDecodeErrorZ_clone(uint64_t orig) {
25751         LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ* orig_conv = (LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ*)untag_ptr(orig);
25752         LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ), "LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ");
25753         *ret_conv = CResult_UnsignedNodeAnnouncementDecodeErrorZ_clone(orig_conv);
25754         return tag_ptr(ret_conv, true);
25755 }
25756
25757 uint64_t  __attribute__((export_name("TS_CResult_NodeAnnouncementDecodeErrorZ_ok"))) TS_CResult_NodeAnnouncementDecodeErrorZ_ok(uint64_t o) {
25758         LDKNodeAnnouncement o_conv;
25759         o_conv.inner = untag_ptr(o);
25760         o_conv.is_owned = ptr_is_owned(o);
25761         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
25762         o_conv = NodeAnnouncement_clone(&o_conv);
25763         LDKCResult_NodeAnnouncementDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NodeAnnouncementDecodeErrorZ), "LDKCResult_NodeAnnouncementDecodeErrorZ");
25764         *ret_conv = CResult_NodeAnnouncementDecodeErrorZ_ok(o_conv);
25765         return tag_ptr(ret_conv, true);
25766 }
25767
25768 uint64_t  __attribute__((export_name("TS_CResult_NodeAnnouncementDecodeErrorZ_err"))) TS_CResult_NodeAnnouncementDecodeErrorZ_err(uint64_t e) {
25769         void* e_ptr = untag_ptr(e);
25770         CHECK_ACCESS(e_ptr);
25771         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
25772         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
25773         LDKCResult_NodeAnnouncementDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NodeAnnouncementDecodeErrorZ), "LDKCResult_NodeAnnouncementDecodeErrorZ");
25774         *ret_conv = CResult_NodeAnnouncementDecodeErrorZ_err(e_conv);
25775         return tag_ptr(ret_conv, true);
25776 }
25777
25778 jboolean  __attribute__((export_name("TS_CResult_NodeAnnouncementDecodeErrorZ_is_ok"))) TS_CResult_NodeAnnouncementDecodeErrorZ_is_ok(uint64_t o) {
25779         LDKCResult_NodeAnnouncementDecodeErrorZ* o_conv = (LDKCResult_NodeAnnouncementDecodeErrorZ*)untag_ptr(o);
25780         jboolean ret_conv = CResult_NodeAnnouncementDecodeErrorZ_is_ok(o_conv);
25781         return ret_conv;
25782 }
25783
25784 void  __attribute__((export_name("TS_CResult_NodeAnnouncementDecodeErrorZ_free"))) TS_CResult_NodeAnnouncementDecodeErrorZ_free(uint64_t _res) {
25785         if (!ptr_is_owned(_res)) return;
25786         void* _res_ptr = untag_ptr(_res);
25787         CHECK_ACCESS(_res_ptr);
25788         LDKCResult_NodeAnnouncementDecodeErrorZ _res_conv = *(LDKCResult_NodeAnnouncementDecodeErrorZ*)(_res_ptr);
25789         FREE(untag_ptr(_res));
25790         CResult_NodeAnnouncementDecodeErrorZ_free(_res_conv);
25791 }
25792
25793 static inline uint64_t CResult_NodeAnnouncementDecodeErrorZ_clone_ptr(LDKCResult_NodeAnnouncementDecodeErrorZ *NONNULL_PTR arg) {
25794         LDKCResult_NodeAnnouncementDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NodeAnnouncementDecodeErrorZ), "LDKCResult_NodeAnnouncementDecodeErrorZ");
25795         *ret_conv = CResult_NodeAnnouncementDecodeErrorZ_clone(arg);
25796         return tag_ptr(ret_conv, true);
25797 }
25798 int64_t  __attribute__((export_name("TS_CResult_NodeAnnouncementDecodeErrorZ_clone_ptr"))) TS_CResult_NodeAnnouncementDecodeErrorZ_clone_ptr(uint64_t arg) {
25799         LDKCResult_NodeAnnouncementDecodeErrorZ* arg_conv = (LDKCResult_NodeAnnouncementDecodeErrorZ*)untag_ptr(arg);
25800         int64_t ret_conv = CResult_NodeAnnouncementDecodeErrorZ_clone_ptr(arg_conv);
25801         return ret_conv;
25802 }
25803
25804 uint64_t  __attribute__((export_name("TS_CResult_NodeAnnouncementDecodeErrorZ_clone"))) TS_CResult_NodeAnnouncementDecodeErrorZ_clone(uint64_t orig) {
25805         LDKCResult_NodeAnnouncementDecodeErrorZ* orig_conv = (LDKCResult_NodeAnnouncementDecodeErrorZ*)untag_ptr(orig);
25806         LDKCResult_NodeAnnouncementDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NodeAnnouncementDecodeErrorZ), "LDKCResult_NodeAnnouncementDecodeErrorZ");
25807         *ret_conv = CResult_NodeAnnouncementDecodeErrorZ_clone(orig_conv);
25808         return tag_ptr(ret_conv, true);
25809 }
25810
25811 uint64_t  __attribute__((export_name("TS_CResult_QueryShortChannelIdsDecodeErrorZ_ok"))) TS_CResult_QueryShortChannelIdsDecodeErrorZ_ok(uint64_t o) {
25812         LDKQueryShortChannelIds o_conv;
25813         o_conv.inner = untag_ptr(o);
25814         o_conv.is_owned = ptr_is_owned(o);
25815         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
25816         o_conv = QueryShortChannelIds_clone(&o_conv);
25817         LDKCResult_QueryShortChannelIdsDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_QueryShortChannelIdsDecodeErrorZ), "LDKCResult_QueryShortChannelIdsDecodeErrorZ");
25818         *ret_conv = CResult_QueryShortChannelIdsDecodeErrorZ_ok(o_conv);
25819         return tag_ptr(ret_conv, true);
25820 }
25821
25822 uint64_t  __attribute__((export_name("TS_CResult_QueryShortChannelIdsDecodeErrorZ_err"))) TS_CResult_QueryShortChannelIdsDecodeErrorZ_err(uint64_t e) {
25823         void* e_ptr = untag_ptr(e);
25824         CHECK_ACCESS(e_ptr);
25825         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
25826         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
25827         LDKCResult_QueryShortChannelIdsDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_QueryShortChannelIdsDecodeErrorZ), "LDKCResult_QueryShortChannelIdsDecodeErrorZ");
25828         *ret_conv = CResult_QueryShortChannelIdsDecodeErrorZ_err(e_conv);
25829         return tag_ptr(ret_conv, true);
25830 }
25831
25832 jboolean  __attribute__((export_name("TS_CResult_QueryShortChannelIdsDecodeErrorZ_is_ok"))) TS_CResult_QueryShortChannelIdsDecodeErrorZ_is_ok(uint64_t o) {
25833         LDKCResult_QueryShortChannelIdsDecodeErrorZ* o_conv = (LDKCResult_QueryShortChannelIdsDecodeErrorZ*)untag_ptr(o);
25834         jboolean ret_conv = CResult_QueryShortChannelIdsDecodeErrorZ_is_ok(o_conv);
25835         return ret_conv;
25836 }
25837
25838 void  __attribute__((export_name("TS_CResult_QueryShortChannelIdsDecodeErrorZ_free"))) TS_CResult_QueryShortChannelIdsDecodeErrorZ_free(uint64_t _res) {
25839         if (!ptr_is_owned(_res)) return;
25840         void* _res_ptr = untag_ptr(_res);
25841         CHECK_ACCESS(_res_ptr);
25842         LDKCResult_QueryShortChannelIdsDecodeErrorZ _res_conv = *(LDKCResult_QueryShortChannelIdsDecodeErrorZ*)(_res_ptr);
25843         FREE(untag_ptr(_res));
25844         CResult_QueryShortChannelIdsDecodeErrorZ_free(_res_conv);
25845 }
25846
25847 static inline uint64_t CResult_QueryShortChannelIdsDecodeErrorZ_clone_ptr(LDKCResult_QueryShortChannelIdsDecodeErrorZ *NONNULL_PTR arg) {
25848         LDKCResult_QueryShortChannelIdsDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_QueryShortChannelIdsDecodeErrorZ), "LDKCResult_QueryShortChannelIdsDecodeErrorZ");
25849         *ret_conv = CResult_QueryShortChannelIdsDecodeErrorZ_clone(arg);
25850         return tag_ptr(ret_conv, true);
25851 }
25852 int64_t  __attribute__((export_name("TS_CResult_QueryShortChannelIdsDecodeErrorZ_clone_ptr"))) TS_CResult_QueryShortChannelIdsDecodeErrorZ_clone_ptr(uint64_t arg) {
25853         LDKCResult_QueryShortChannelIdsDecodeErrorZ* arg_conv = (LDKCResult_QueryShortChannelIdsDecodeErrorZ*)untag_ptr(arg);
25854         int64_t ret_conv = CResult_QueryShortChannelIdsDecodeErrorZ_clone_ptr(arg_conv);
25855         return ret_conv;
25856 }
25857
25858 uint64_t  __attribute__((export_name("TS_CResult_QueryShortChannelIdsDecodeErrorZ_clone"))) TS_CResult_QueryShortChannelIdsDecodeErrorZ_clone(uint64_t orig) {
25859         LDKCResult_QueryShortChannelIdsDecodeErrorZ* orig_conv = (LDKCResult_QueryShortChannelIdsDecodeErrorZ*)untag_ptr(orig);
25860         LDKCResult_QueryShortChannelIdsDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_QueryShortChannelIdsDecodeErrorZ), "LDKCResult_QueryShortChannelIdsDecodeErrorZ");
25861         *ret_conv = CResult_QueryShortChannelIdsDecodeErrorZ_clone(orig_conv);
25862         return tag_ptr(ret_conv, true);
25863 }
25864
25865 uint64_t  __attribute__((export_name("TS_CResult_ReplyShortChannelIdsEndDecodeErrorZ_ok"))) TS_CResult_ReplyShortChannelIdsEndDecodeErrorZ_ok(uint64_t o) {
25866         LDKReplyShortChannelIdsEnd o_conv;
25867         o_conv.inner = untag_ptr(o);
25868         o_conv.is_owned = ptr_is_owned(o);
25869         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
25870         o_conv = ReplyShortChannelIdsEnd_clone(&o_conv);
25871         LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ), "LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ");
25872         *ret_conv = CResult_ReplyShortChannelIdsEndDecodeErrorZ_ok(o_conv);
25873         return tag_ptr(ret_conv, true);
25874 }
25875
25876 uint64_t  __attribute__((export_name("TS_CResult_ReplyShortChannelIdsEndDecodeErrorZ_err"))) TS_CResult_ReplyShortChannelIdsEndDecodeErrorZ_err(uint64_t e) {
25877         void* e_ptr = untag_ptr(e);
25878         CHECK_ACCESS(e_ptr);
25879         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
25880         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
25881         LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ), "LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ");
25882         *ret_conv = CResult_ReplyShortChannelIdsEndDecodeErrorZ_err(e_conv);
25883         return tag_ptr(ret_conv, true);
25884 }
25885
25886 jboolean  __attribute__((export_name("TS_CResult_ReplyShortChannelIdsEndDecodeErrorZ_is_ok"))) TS_CResult_ReplyShortChannelIdsEndDecodeErrorZ_is_ok(uint64_t o) {
25887         LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ* o_conv = (LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ*)untag_ptr(o);
25888         jboolean ret_conv = CResult_ReplyShortChannelIdsEndDecodeErrorZ_is_ok(o_conv);
25889         return ret_conv;
25890 }
25891
25892 void  __attribute__((export_name("TS_CResult_ReplyShortChannelIdsEndDecodeErrorZ_free"))) TS_CResult_ReplyShortChannelIdsEndDecodeErrorZ_free(uint64_t _res) {
25893         if (!ptr_is_owned(_res)) return;
25894         void* _res_ptr = untag_ptr(_res);
25895         CHECK_ACCESS(_res_ptr);
25896         LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ _res_conv = *(LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ*)(_res_ptr);
25897         FREE(untag_ptr(_res));
25898         CResult_ReplyShortChannelIdsEndDecodeErrorZ_free(_res_conv);
25899 }
25900
25901 static inline uint64_t CResult_ReplyShortChannelIdsEndDecodeErrorZ_clone_ptr(LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ *NONNULL_PTR arg) {
25902         LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ), "LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ");
25903         *ret_conv = CResult_ReplyShortChannelIdsEndDecodeErrorZ_clone(arg);
25904         return tag_ptr(ret_conv, true);
25905 }
25906 int64_t  __attribute__((export_name("TS_CResult_ReplyShortChannelIdsEndDecodeErrorZ_clone_ptr"))) TS_CResult_ReplyShortChannelIdsEndDecodeErrorZ_clone_ptr(uint64_t arg) {
25907         LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ* arg_conv = (LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ*)untag_ptr(arg);
25908         int64_t ret_conv = CResult_ReplyShortChannelIdsEndDecodeErrorZ_clone_ptr(arg_conv);
25909         return ret_conv;
25910 }
25911
25912 uint64_t  __attribute__((export_name("TS_CResult_ReplyShortChannelIdsEndDecodeErrorZ_clone"))) TS_CResult_ReplyShortChannelIdsEndDecodeErrorZ_clone(uint64_t orig) {
25913         LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ* orig_conv = (LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ*)untag_ptr(orig);
25914         LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ), "LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ");
25915         *ret_conv = CResult_ReplyShortChannelIdsEndDecodeErrorZ_clone(orig_conv);
25916         return tag_ptr(ret_conv, true);
25917 }
25918
25919 uint64_t  __attribute__((export_name("TS_CResult_QueryChannelRangeDecodeErrorZ_ok"))) TS_CResult_QueryChannelRangeDecodeErrorZ_ok(uint64_t o) {
25920         LDKQueryChannelRange o_conv;
25921         o_conv.inner = untag_ptr(o);
25922         o_conv.is_owned = ptr_is_owned(o);
25923         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
25924         o_conv = QueryChannelRange_clone(&o_conv);
25925         LDKCResult_QueryChannelRangeDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_QueryChannelRangeDecodeErrorZ), "LDKCResult_QueryChannelRangeDecodeErrorZ");
25926         *ret_conv = CResult_QueryChannelRangeDecodeErrorZ_ok(o_conv);
25927         return tag_ptr(ret_conv, true);
25928 }
25929
25930 uint64_t  __attribute__((export_name("TS_CResult_QueryChannelRangeDecodeErrorZ_err"))) TS_CResult_QueryChannelRangeDecodeErrorZ_err(uint64_t e) {
25931         void* e_ptr = untag_ptr(e);
25932         CHECK_ACCESS(e_ptr);
25933         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
25934         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
25935         LDKCResult_QueryChannelRangeDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_QueryChannelRangeDecodeErrorZ), "LDKCResult_QueryChannelRangeDecodeErrorZ");
25936         *ret_conv = CResult_QueryChannelRangeDecodeErrorZ_err(e_conv);
25937         return tag_ptr(ret_conv, true);
25938 }
25939
25940 jboolean  __attribute__((export_name("TS_CResult_QueryChannelRangeDecodeErrorZ_is_ok"))) TS_CResult_QueryChannelRangeDecodeErrorZ_is_ok(uint64_t o) {
25941         LDKCResult_QueryChannelRangeDecodeErrorZ* o_conv = (LDKCResult_QueryChannelRangeDecodeErrorZ*)untag_ptr(o);
25942         jboolean ret_conv = CResult_QueryChannelRangeDecodeErrorZ_is_ok(o_conv);
25943         return ret_conv;
25944 }
25945
25946 void  __attribute__((export_name("TS_CResult_QueryChannelRangeDecodeErrorZ_free"))) TS_CResult_QueryChannelRangeDecodeErrorZ_free(uint64_t _res) {
25947         if (!ptr_is_owned(_res)) return;
25948         void* _res_ptr = untag_ptr(_res);
25949         CHECK_ACCESS(_res_ptr);
25950         LDKCResult_QueryChannelRangeDecodeErrorZ _res_conv = *(LDKCResult_QueryChannelRangeDecodeErrorZ*)(_res_ptr);
25951         FREE(untag_ptr(_res));
25952         CResult_QueryChannelRangeDecodeErrorZ_free(_res_conv);
25953 }
25954
25955 static inline uint64_t CResult_QueryChannelRangeDecodeErrorZ_clone_ptr(LDKCResult_QueryChannelRangeDecodeErrorZ *NONNULL_PTR arg) {
25956         LDKCResult_QueryChannelRangeDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_QueryChannelRangeDecodeErrorZ), "LDKCResult_QueryChannelRangeDecodeErrorZ");
25957         *ret_conv = CResult_QueryChannelRangeDecodeErrorZ_clone(arg);
25958         return tag_ptr(ret_conv, true);
25959 }
25960 int64_t  __attribute__((export_name("TS_CResult_QueryChannelRangeDecodeErrorZ_clone_ptr"))) TS_CResult_QueryChannelRangeDecodeErrorZ_clone_ptr(uint64_t arg) {
25961         LDKCResult_QueryChannelRangeDecodeErrorZ* arg_conv = (LDKCResult_QueryChannelRangeDecodeErrorZ*)untag_ptr(arg);
25962         int64_t ret_conv = CResult_QueryChannelRangeDecodeErrorZ_clone_ptr(arg_conv);
25963         return ret_conv;
25964 }
25965
25966 uint64_t  __attribute__((export_name("TS_CResult_QueryChannelRangeDecodeErrorZ_clone"))) TS_CResult_QueryChannelRangeDecodeErrorZ_clone(uint64_t orig) {
25967         LDKCResult_QueryChannelRangeDecodeErrorZ* orig_conv = (LDKCResult_QueryChannelRangeDecodeErrorZ*)untag_ptr(orig);
25968         LDKCResult_QueryChannelRangeDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_QueryChannelRangeDecodeErrorZ), "LDKCResult_QueryChannelRangeDecodeErrorZ");
25969         *ret_conv = CResult_QueryChannelRangeDecodeErrorZ_clone(orig_conv);
25970         return tag_ptr(ret_conv, true);
25971 }
25972
25973 uint64_t  __attribute__((export_name("TS_CResult_ReplyChannelRangeDecodeErrorZ_ok"))) TS_CResult_ReplyChannelRangeDecodeErrorZ_ok(uint64_t o) {
25974         LDKReplyChannelRange o_conv;
25975         o_conv.inner = untag_ptr(o);
25976         o_conv.is_owned = ptr_is_owned(o);
25977         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
25978         o_conv = ReplyChannelRange_clone(&o_conv);
25979         LDKCResult_ReplyChannelRangeDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ReplyChannelRangeDecodeErrorZ), "LDKCResult_ReplyChannelRangeDecodeErrorZ");
25980         *ret_conv = CResult_ReplyChannelRangeDecodeErrorZ_ok(o_conv);
25981         return tag_ptr(ret_conv, true);
25982 }
25983
25984 uint64_t  __attribute__((export_name("TS_CResult_ReplyChannelRangeDecodeErrorZ_err"))) TS_CResult_ReplyChannelRangeDecodeErrorZ_err(uint64_t e) {
25985         void* e_ptr = untag_ptr(e);
25986         CHECK_ACCESS(e_ptr);
25987         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
25988         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
25989         LDKCResult_ReplyChannelRangeDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ReplyChannelRangeDecodeErrorZ), "LDKCResult_ReplyChannelRangeDecodeErrorZ");
25990         *ret_conv = CResult_ReplyChannelRangeDecodeErrorZ_err(e_conv);
25991         return tag_ptr(ret_conv, true);
25992 }
25993
25994 jboolean  __attribute__((export_name("TS_CResult_ReplyChannelRangeDecodeErrorZ_is_ok"))) TS_CResult_ReplyChannelRangeDecodeErrorZ_is_ok(uint64_t o) {
25995         LDKCResult_ReplyChannelRangeDecodeErrorZ* o_conv = (LDKCResult_ReplyChannelRangeDecodeErrorZ*)untag_ptr(o);
25996         jboolean ret_conv = CResult_ReplyChannelRangeDecodeErrorZ_is_ok(o_conv);
25997         return ret_conv;
25998 }
25999
26000 void  __attribute__((export_name("TS_CResult_ReplyChannelRangeDecodeErrorZ_free"))) TS_CResult_ReplyChannelRangeDecodeErrorZ_free(uint64_t _res) {
26001         if (!ptr_is_owned(_res)) return;
26002         void* _res_ptr = untag_ptr(_res);
26003         CHECK_ACCESS(_res_ptr);
26004         LDKCResult_ReplyChannelRangeDecodeErrorZ _res_conv = *(LDKCResult_ReplyChannelRangeDecodeErrorZ*)(_res_ptr);
26005         FREE(untag_ptr(_res));
26006         CResult_ReplyChannelRangeDecodeErrorZ_free(_res_conv);
26007 }
26008
26009 static inline uint64_t CResult_ReplyChannelRangeDecodeErrorZ_clone_ptr(LDKCResult_ReplyChannelRangeDecodeErrorZ *NONNULL_PTR arg) {
26010         LDKCResult_ReplyChannelRangeDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ReplyChannelRangeDecodeErrorZ), "LDKCResult_ReplyChannelRangeDecodeErrorZ");
26011         *ret_conv = CResult_ReplyChannelRangeDecodeErrorZ_clone(arg);
26012         return tag_ptr(ret_conv, true);
26013 }
26014 int64_t  __attribute__((export_name("TS_CResult_ReplyChannelRangeDecodeErrorZ_clone_ptr"))) TS_CResult_ReplyChannelRangeDecodeErrorZ_clone_ptr(uint64_t arg) {
26015         LDKCResult_ReplyChannelRangeDecodeErrorZ* arg_conv = (LDKCResult_ReplyChannelRangeDecodeErrorZ*)untag_ptr(arg);
26016         int64_t ret_conv = CResult_ReplyChannelRangeDecodeErrorZ_clone_ptr(arg_conv);
26017         return ret_conv;
26018 }
26019
26020 uint64_t  __attribute__((export_name("TS_CResult_ReplyChannelRangeDecodeErrorZ_clone"))) TS_CResult_ReplyChannelRangeDecodeErrorZ_clone(uint64_t orig) {
26021         LDKCResult_ReplyChannelRangeDecodeErrorZ* orig_conv = (LDKCResult_ReplyChannelRangeDecodeErrorZ*)untag_ptr(orig);
26022         LDKCResult_ReplyChannelRangeDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ReplyChannelRangeDecodeErrorZ), "LDKCResult_ReplyChannelRangeDecodeErrorZ");
26023         *ret_conv = CResult_ReplyChannelRangeDecodeErrorZ_clone(orig_conv);
26024         return tag_ptr(ret_conv, true);
26025 }
26026
26027 uint64_t  __attribute__((export_name("TS_CResult_GossipTimestampFilterDecodeErrorZ_ok"))) TS_CResult_GossipTimestampFilterDecodeErrorZ_ok(uint64_t o) {
26028         LDKGossipTimestampFilter o_conv;
26029         o_conv.inner = untag_ptr(o);
26030         o_conv.is_owned = ptr_is_owned(o);
26031         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
26032         o_conv = GossipTimestampFilter_clone(&o_conv);
26033         LDKCResult_GossipTimestampFilterDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_GossipTimestampFilterDecodeErrorZ), "LDKCResult_GossipTimestampFilterDecodeErrorZ");
26034         *ret_conv = CResult_GossipTimestampFilterDecodeErrorZ_ok(o_conv);
26035         return tag_ptr(ret_conv, true);
26036 }
26037
26038 uint64_t  __attribute__((export_name("TS_CResult_GossipTimestampFilterDecodeErrorZ_err"))) TS_CResult_GossipTimestampFilterDecodeErrorZ_err(uint64_t e) {
26039         void* e_ptr = untag_ptr(e);
26040         CHECK_ACCESS(e_ptr);
26041         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
26042         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
26043         LDKCResult_GossipTimestampFilterDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_GossipTimestampFilterDecodeErrorZ), "LDKCResult_GossipTimestampFilterDecodeErrorZ");
26044         *ret_conv = CResult_GossipTimestampFilterDecodeErrorZ_err(e_conv);
26045         return tag_ptr(ret_conv, true);
26046 }
26047
26048 jboolean  __attribute__((export_name("TS_CResult_GossipTimestampFilterDecodeErrorZ_is_ok"))) TS_CResult_GossipTimestampFilterDecodeErrorZ_is_ok(uint64_t o) {
26049         LDKCResult_GossipTimestampFilterDecodeErrorZ* o_conv = (LDKCResult_GossipTimestampFilterDecodeErrorZ*)untag_ptr(o);
26050         jboolean ret_conv = CResult_GossipTimestampFilterDecodeErrorZ_is_ok(o_conv);
26051         return ret_conv;
26052 }
26053
26054 void  __attribute__((export_name("TS_CResult_GossipTimestampFilterDecodeErrorZ_free"))) TS_CResult_GossipTimestampFilterDecodeErrorZ_free(uint64_t _res) {
26055         if (!ptr_is_owned(_res)) return;
26056         void* _res_ptr = untag_ptr(_res);
26057         CHECK_ACCESS(_res_ptr);
26058         LDKCResult_GossipTimestampFilterDecodeErrorZ _res_conv = *(LDKCResult_GossipTimestampFilterDecodeErrorZ*)(_res_ptr);
26059         FREE(untag_ptr(_res));
26060         CResult_GossipTimestampFilterDecodeErrorZ_free(_res_conv);
26061 }
26062
26063 static inline uint64_t CResult_GossipTimestampFilterDecodeErrorZ_clone_ptr(LDKCResult_GossipTimestampFilterDecodeErrorZ *NONNULL_PTR arg) {
26064         LDKCResult_GossipTimestampFilterDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_GossipTimestampFilterDecodeErrorZ), "LDKCResult_GossipTimestampFilterDecodeErrorZ");
26065         *ret_conv = CResult_GossipTimestampFilterDecodeErrorZ_clone(arg);
26066         return tag_ptr(ret_conv, true);
26067 }
26068 int64_t  __attribute__((export_name("TS_CResult_GossipTimestampFilterDecodeErrorZ_clone_ptr"))) TS_CResult_GossipTimestampFilterDecodeErrorZ_clone_ptr(uint64_t arg) {
26069         LDKCResult_GossipTimestampFilterDecodeErrorZ* arg_conv = (LDKCResult_GossipTimestampFilterDecodeErrorZ*)untag_ptr(arg);
26070         int64_t ret_conv = CResult_GossipTimestampFilterDecodeErrorZ_clone_ptr(arg_conv);
26071         return ret_conv;
26072 }
26073
26074 uint64_t  __attribute__((export_name("TS_CResult_GossipTimestampFilterDecodeErrorZ_clone"))) TS_CResult_GossipTimestampFilterDecodeErrorZ_clone(uint64_t orig) {
26075         LDKCResult_GossipTimestampFilterDecodeErrorZ* orig_conv = (LDKCResult_GossipTimestampFilterDecodeErrorZ*)untag_ptr(orig);
26076         LDKCResult_GossipTimestampFilterDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_GossipTimestampFilterDecodeErrorZ), "LDKCResult_GossipTimestampFilterDecodeErrorZ");
26077         *ret_conv = CResult_GossipTimestampFilterDecodeErrorZ_clone(orig_conv);
26078         return tag_ptr(ret_conv, true);
26079 }
26080
26081 void  __attribute__((export_name("TS_CVec_PhantomRouteHintsZ_free"))) TS_CVec_PhantomRouteHintsZ_free(uint64_tArray _res) {
26082         LDKCVec_PhantomRouteHintsZ _res_constr;
26083         _res_constr.datalen = _res->arr_len;
26084         if (_res_constr.datalen > 0)
26085                 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKPhantomRouteHints), "LDKCVec_PhantomRouteHintsZ Elements");
26086         else
26087                 _res_constr.data = NULL;
26088         uint64_t* _res_vals = _res->elems;
26089         for (size_t t = 0; t < _res_constr.datalen; t++) {
26090                 uint64_t _res_conv_19 = _res_vals[t];
26091                 LDKPhantomRouteHints _res_conv_19_conv;
26092                 _res_conv_19_conv.inner = untag_ptr(_res_conv_19);
26093                 _res_conv_19_conv.is_owned = ptr_is_owned(_res_conv_19);
26094                 CHECK_INNER_FIELD_ACCESS_OR_NULL(_res_conv_19_conv);
26095                 _res_constr.data[t] = _res_conv_19_conv;
26096         }
26097         FREE(_res);
26098         CVec_PhantomRouteHintsZ_free(_res_constr);
26099 }
26100
26101 uint64_t  __attribute__((export_name("TS_CResult_Bolt11InvoiceSignOrCreationErrorZ_ok"))) TS_CResult_Bolt11InvoiceSignOrCreationErrorZ_ok(uint64_t o) {
26102         LDKBolt11Invoice o_conv;
26103         o_conv.inner = untag_ptr(o);
26104         o_conv.is_owned = ptr_is_owned(o);
26105         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
26106         o_conv = Bolt11Invoice_clone(&o_conv);
26107         LDKCResult_Bolt11InvoiceSignOrCreationErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_Bolt11InvoiceSignOrCreationErrorZ), "LDKCResult_Bolt11InvoiceSignOrCreationErrorZ");
26108         *ret_conv = CResult_Bolt11InvoiceSignOrCreationErrorZ_ok(o_conv);
26109         return tag_ptr(ret_conv, true);
26110 }
26111
26112 uint64_t  __attribute__((export_name("TS_CResult_Bolt11InvoiceSignOrCreationErrorZ_err"))) TS_CResult_Bolt11InvoiceSignOrCreationErrorZ_err(uint64_t e) {
26113         void* e_ptr = untag_ptr(e);
26114         CHECK_ACCESS(e_ptr);
26115         LDKSignOrCreationError e_conv = *(LDKSignOrCreationError*)(e_ptr);
26116         e_conv = SignOrCreationError_clone((LDKSignOrCreationError*)untag_ptr(e));
26117         LDKCResult_Bolt11InvoiceSignOrCreationErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_Bolt11InvoiceSignOrCreationErrorZ), "LDKCResult_Bolt11InvoiceSignOrCreationErrorZ");
26118         *ret_conv = CResult_Bolt11InvoiceSignOrCreationErrorZ_err(e_conv);
26119         return tag_ptr(ret_conv, true);
26120 }
26121
26122 jboolean  __attribute__((export_name("TS_CResult_Bolt11InvoiceSignOrCreationErrorZ_is_ok"))) TS_CResult_Bolt11InvoiceSignOrCreationErrorZ_is_ok(uint64_t o) {
26123         LDKCResult_Bolt11InvoiceSignOrCreationErrorZ* o_conv = (LDKCResult_Bolt11InvoiceSignOrCreationErrorZ*)untag_ptr(o);
26124         jboolean ret_conv = CResult_Bolt11InvoiceSignOrCreationErrorZ_is_ok(o_conv);
26125         return ret_conv;
26126 }
26127
26128 void  __attribute__((export_name("TS_CResult_Bolt11InvoiceSignOrCreationErrorZ_free"))) TS_CResult_Bolt11InvoiceSignOrCreationErrorZ_free(uint64_t _res) {
26129         if (!ptr_is_owned(_res)) return;
26130         void* _res_ptr = untag_ptr(_res);
26131         CHECK_ACCESS(_res_ptr);
26132         LDKCResult_Bolt11InvoiceSignOrCreationErrorZ _res_conv = *(LDKCResult_Bolt11InvoiceSignOrCreationErrorZ*)(_res_ptr);
26133         FREE(untag_ptr(_res));
26134         CResult_Bolt11InvoiceSignOrCreationErrorZ_free(_res_conv);
26135 }
26136
26137 static inline uint64_t CResult_Bolt11InvoiceSignOrCreationErrorZ_clone_ptr(LDKCResult_Bolt11InvoiceSignOrCreationErrorZ *NONNULL_PTR arg) {
26138         LDKCResult_Bolt11InvoiceSignOrCreationErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_Bolt11InvoiceSignOrCreationErrorZ), "LDKCResult_Bolt11InvoiceSignOrCreationErrorZ");
26139         *ret_conv = CResult_Bolt11InvoiceSignOrCreationErrorZ_clone(arg);
26140         return tag_ptr(ret_conv, true);
26141 }
26142 int64_t  __attribute__((export_name("TS_CResult_Bolt11InvoiceSignOrCreationErrorZ_clone_ptr"))) TS_CResult_Bolt11InvoiceSignOrCreationErrorZ_clone_ptr(uint64_t arg) {
26143         LDKCResult_Bolt11InvoiceSignOrCreationErrorZ* arg_conv = (LDKCResult_Bolt11InvoiceSignOrCreationErrorZ*)untag_ptr(arg);
26144         int64_t ret_conv = CResult_Bolt11InvoiceSignOrCreationErrorZ_clone_ptr(arg_conv);
26145         return ret_conv;
26146 }
26147
26148 uint64_t  __attribute__((export_name("TS_CResult_Bolt11InvoiceSignOrCreationErrorZ_clone"))) TS_CResult_Bolt11InvoiceSignOrCreationErrorZ_clone(uint64_t orig) {
26149         LDKCResult_Bolt11InvoiceSignOrCreationErrorZ* orig_conv = (LDKCResult_Bolt11InvoiceSignOrCreationErrorZ*)untag_ptr(orig);
26150         LDKCResult_Bolt11InvoiceSignOrCreationErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_Bolt11InvoiceSignOrCreationErrorZ), "LDKCResult_Bolt11InvoiceSignOrCreationErrorZ");
26151         *ret_conv = CResult_Bolt11InvoiceSignOrCreationErrorZ_clone(orig_conv);
26152         return tag_ptr(ret_conv, true);
26153 }
26154
26155 uint64_t  __attribute__((export_name("TS_CResult_OffersMessageDecodeErrorZ_ok"))) TS_CResult_OffersMessageDecodeErrorZ_ok(uint64_t o) {
26156         void* o_ptr = untag_ptr(o);
26157         CHECK_ACCESS(o_ptr);
26158         LDKOffersMessage o_conv = *(LDKOffersMessage*)(o_ptr);
26159         o_conv = OffersMessage_clone((LDKOffersMessage*)untag_ptr(o));
26160         LDKCResult_OffersMessageDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_OffersMessageDecodeErrorZ), "LDKCResult_OffersMessageDecodeErrorZ");
26161         *ret_conv = CResult_OffersMessageDecodeErrorZ_ok(o_conv);
26162         return tag_ptr(ret_conv, true);
26163 }
26164
26165 uint64_t  __attribute__((export_name("TS_CResult_OffersMessageDecodeErrorZ_err"))) TS_CResult_OffersMessageDecodeErrorZ_err(uint64_t e) {
26166         void* e_ptr = untag_ptr(e);
26167         CHECK_ACCESS(e_ptr);
26168         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
26169         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
26170         LDKCResult_OffersMessageDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_OffersMessageDecodeErrorZ), "LDKCResult_OffersMessageDecodeErrorZ");
26171         *ret_conv = CResult_OffersMessageDecodeErrorZ_err(e_conv);
26172         return tag_ptr(ret_conv, true);
26173 }
26174
26175 jboolean  __attribute__((export_name("TS_CResult_OffersMessageDecodeErrorZ_is_ok"))) TS_CResult_OffersMessageDecodeErrorZ_is_ok(uint64_t o) {
26176         LDKCResult_OffersMessageDecodeErrorZ* o_conv = (LDKCResult_OffersMessageDecodeErrorZ*)untag_ptr(o);
26177         jboolean ret_conv = CResult_OffersMessageDecodeErrorZ_is_ok(o_conv);
26178         return ret_conv;
26179 }
26180
26181 void  __attribute__((export_name("TS_CResult_OffersMessageDecodeErrorZ_free"))) TS_CResult_OffersMessageDecodeErrorZ_free(uint64_t _res) {
26182         if (!ptr_is_owned(_res)) return;
26183         void* _res_ptr = untag_ptr(_res);
26184         CHECK_ACCESS(_res_ptr);
26185         LDKCResult_OffersMessageDecodeErrorZ _res_conv = *(LDKCResult_OffersMessageDecodeErrorZ*)(_res_ptr);
26186         FREE(untag_ptr(_res));
26187         CResult_OffersMessageDecodeErrorZ_free(_res_conv);
26188 }
26189
26190 static inline uint64_t CResult_OffersMessageDecodeErrorZ_clone_ptr(LDKCResult_OffersMessageDecodeErrorZ *NONNULL_PTR arg) {
26191         LDKCResult_OffersMessageDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_OffersMessageDecodeErrorZ), "LDKCResult_OffersMessageDecodeErrorZ");
26192         *ret_conv = CResult_OffersMessageDecodeErrorZ_clone(arg);
26193         return tag_ptr(ret_conv, true);
26194 }
26195 int64_t  __attribute__((export_name("TS_CResult_OffersMessageDecodeErrorZ_clone_ptr"))) TS_CResult_OffersMessageDecodeErrorZ_clone_ptr(uint64_t arg) {
26196         LDKCResult_OffersMessageDecodeErrorZ* arg_conv = (LDKCResult_OffersMessageDecodeErrorZ*)untag_ptr(arg);
26197         int64_t ret_conv = CResult_OffersMessageDecodeErrorZ_clone_ptr(arg_conv);
26198         return ret_conv;
26199 }
26200
26201 uint64_t  __attribute__((export_name("TS_CResult_OffersMessageDecodeErrorZ_clone"))) TS_CResult_OffersMessageDecodeErrorZ_clone(uint64_t orig) {
26202         LDKCResult_OffersMessageDecodeErrorZ* orig_conv = (LDKCResult_OffersMessageDecodeErrorZ*)untag_ptr(orig);
26203         LDKCResult_OffersMessageDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_OffersMessageDecodeErrorZ), "LDKCResult_OffersMessageDecodeErrorZ");
26204         *ret_conv = CResult_OffersMessageDecodeErrorZ_clone(orig_conv);
26205         return tag_ptr(ret_conv, true);
26206 }
26207
26208 uint64_t  __attribute__((export_name("TS_COption_HTLCClaimZ_some"))) TS_COption_HTLCClaimZ_some(uint32_t o) {
26209         LDKHTLCClaim o_conv = LDKHTLCClaim_from_js(o);
26210         LDKCOption_HTLCClaimZ *ret_copy = MALLOC(sizeof(LDKCOption_HTLCClaimZ), "LDKCOption_HTLCClaimZ");
26211         *ret_copy = COption_HTLCClaimZ_some(o_conv);
26212         uint64_t ret_ref = tag_ptr(ret_copy, true);
26213         return ret_ref;
26214 }
26215
26216 uint64_t  __attribute__((export_name("TS_COption_HTLCClaimZ_none"))) TS_COption_HTLCClaimZ_none() {
26217         LDKCOption_HTLCClaimZ *ret_copy = MALLOC(sizeof(LDKCOption_HTLCClaimZ), "LDKCOption_HTLCClaimZ");
26218         *ret_copy = COption_HTLCClaimZ_none();
26219         uint64_t ret_ref = tag_ptr(ret_copy, true);
26220         return ret_ref;
26221 }
26222
26223 void  __attribute__((export_name("TS_COption_HTLCClaimZ_free"))) TS_COption_HTLCClaimZ_free(uint64_t _res) {
26224         if (!ptr_is_owned(_res)) return;
26225         void* _res_ptr = untag_ptr(_res);
26226         CHECK_ACCESS(_res_ptr);
26227         LDKCOption_HTLCClaimZ _res_conv = *(LDKCOption_HTLCClaimZ*)(_res_ptr);
26228         FREE(untag_ptr(_res));
26229         COption_HTLCClaimZ_free(_res_conv);
26230 }
26231
26232 uint64_t  __attribute__((export_name("TS_CResult_CounterpartyCommitmentSecretsDecodeErrorZ_ok"))) TS_CResult_CounterpartyCommitmentSecretsDecodeErrorZ_ok(uint64_t o) {
26233         LDKCounterpartyCommitmentSecrets o_conv;
26234         o_conv.inner = untag_ptr(o);
26235         o_conv.is_owned = ptr_is_owned(o);
26236         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
26237         o_conv = CounterpartyCommitmentSecrets_clone(&o_conv);
26238         LDKCResult_CounterpartyCommitmentSecretsDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CounterpartyCommitmentSecretsDecodeErrorZ), "LDKCResult_CounterpartyCommitmentSecretsDecodeErrorZ");
26239         *ret_conv = CResult_CounterpartyCommitmentSecretsDecodeErrorZ_ok(o_conv);
26240         return tag_ptr(ret_conv, true);
26241 }
26242
26243 uint64_t  __attribute__((export_name("TS_CResult_CounterpartyCommitmentSecretsDecodeErrorZ_err"))) TS_CResult_CounterpartyCommitmentSecretsDecodeErrorZ_err(uint64_t e) {
26244         void* e_ptr = untag_ptr(e);
26245         CHECK_ACCESS(e_ptr);
26246         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
26247         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
26248         LDKCResult_CounterpartyCommitmentSecretsDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CounterpartyCommitmentSecretsDecodeErrorZ), "LDKCResult_CounterpartyCommitmentSecretsDecodeErrorZ");
26249         *ret_conv = CResult_CounterpartyCommitmentSecretsDecodeErrorZ_err(e_conv);
26250         return tag_ptr(ret_conv, true);
26251 }
26252
26253 jboolean  __attribute__((export_name("TS_CResult_CounterpartyCommitmentSecretsDecodeErrorZ_is_ok"))) TS_CResult_CounterpartyCommitmentSecretsDecodeErrorZ_is_ok(uint64_t o) {
26254         LDKCResult_CounterpartyCommitmentSecretsDecodeErrorZ* o_conv = (LDKCResult_CounterpartyCommitmentSecretsDecodeErrorZ*)untag_ptr(o);
26255         jboolean ret_conv = CResult_CounterpartyCommitmentSecretsDecodeErrorZ_is_ok(o_conv);
26256         return ret_conv;
26257 }
26258
26259 void  __attribute__((export_name("TS_CResult_CounterpartyCommitmentSecretsDecodeErrorZ_free"))) TS_CResult_CounterpartyCommitmentSecretsDecodeErrorZ_free(uint64_t _res) {
26260         if (!ptr_is_owned(_res)) return;
26261         void* _res_ptr = untag_ptr(_res);
26262         CHECK_ACCESS(_res_ptr);
26263         LDKCResult_CounterpartyCommitmentSecretsDecodeErrorZ _res_conv = *(LDKCResult_CounterpartyCommitmentSecretsDecodeErrorZ*)(_res_ptr);
26264         FREE(untag_ptr(_res));
26265         CResult_CounterpartyCommitmentSecretsDecodeErrorZ_free(_res_conv);
26266 }
26267
26268 static inline uint64_t CResult_CounterpartyCommitmentSecretsDecodeErrorZ_clone_ptr(LDKCResult_CounterpartyCommitmentSecretsDecodeErrorZ *NONNULL_PTR arg) {
26269         LDKCResult_CounterpartyCommitmentSecretsDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CounterpartyCommitmentSecretsDecodeErrorZ), "LDKCResult_CounterpartyCommitmentSecretsDecodeErrorZ");
26270         *ret_conv = CResult_CounterpartyCommitmentSecretsDecodeErrorZ_clone(arg);
26271         return tag_ptr(ret_conv, true);
26272 }
26273 int64_t  __attribute__((export_name("TS_CResult_CounterpartyCommitmentSecretsDecodeErrorZ_clone_ptr"))) TS_CResult_CounterpartyCommitmentSecretsDecodeErrorZ_clone_ptr(uint64_t arg) {
26274         LDKCResult_CounterpartyCommitmentSecretsDecodeErrorZ* arg_conv = (LDKCResult_CounterpartyCommitmentSecretsDecodeErrorZ*)untag_ptr(arg);
26275         int64_t ret_conv = CResult_CounterpartyCommitmentSecretsDecodeErrorZ_clone_ptr(arg_conv);
26276         return ret_conv;
26277 }
26278
26279 uint64_t  __attribute__((export_name("TS_CResult_CounterpartyCommitmentSecretsDecodeErrorZ_clone"))) TS_CResult_CounterpartyCommitmentSecretsDecodeErrorZ_clone(uint64_t orig) {
26280         LDKCResult_CounterpartyCommitmentSecretsDecodeErrorZ* orig_conv = (LDKCResult_CounterpartyCommitmentSecretsDecodeErrorZ*)untag_ptr(orig);
26281         LDKCResult_CounterpartyCommitmentSecretsDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CounterpartyCommitmentSecretsDecodeErrorZ), "LDKCResult_CounterpartyCommitmentSecretsDecodeErrorZ");
26282         *ret_conv = CResult_CounterpartyCommitmentSecretsDecodeErrorZ_clone(orig_conv);
26283         return tag_ptr(ret_conv, true);
26284 }
26285
26286 uint64_t  __attribute__((export_name("TS_CResult_TxCreationKeysDecodeErrorZ_ok"))) TS_CResult_TxCreationKeysDecodeErrorZ_ok(uint64_t o) {
26287         LDKTxCreationKeys o_conv;
26288         o_conv.inner = untag_ptr(o);
26289         o_conv.is_owned = ptr_is_owned(o);
26290         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
26291         o_conv = TxCreationKeys_clone(&o_conv);
26292         LDKCResult_TxCreationKeysDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TxCreationKeysDecodeErrorZ), "LDKCResult_TxCreationKeysDecodeErrorZ");
26293         *ret_conv = CResult_TxCreationKeysDecodeErrorZ_ok(o_conv);
26294         return tag_ptr(ret_conv, true);
26295 }
26296
26297 uint64_t  __attribute__((export_name("TS_CResult_TxCreationKeysDecodeErrorZ_err"))) TS_CResult_TxCreationKeysDecodeErrorZ_err(uint64_t e) {
26298         void* e_ptr = untag_ptr(e);
26299         CHECK_ACCESS(e_ptr);
26300         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
26301         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
26302         LDKCResult_TxCreationKeysDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TxCreationKeysDecodeErrorZ), "LDKCResult_TxCreationKeysDecodeErrorZ");
26303         *ret_conv = CResult_TxCreationKeysDecodeErrorZ_err(e_conv);
26304         return tag_ptr(ret_conv, true);
26305 }
26306
26307 jboolean  __attribute__((export_name("TS_CResult_TxCreationKeysDecodeErrorZ_is_ok"))) TS_CResult_TxCreationKeysDecodeErrorZ_is_ok(uint64_t o) {
26308         LDKCResult_TxCreationKeysDecodeErrorZ* o_conv = (LDKCResult_TxCreationKeysDecodeErrorZ*)untag_ptr(o);
26309         jboolean ret_conv = CResult_TxCreationKeysDecodeErrorZ_is_ok(o_conv);
26310         return ret_conv;
26311 }
26312
26313 void  __attribute__((export_name("TS_CResult_TxCreationKeysDecodeErrorZ_free"))) TS_CResult_TxCreationKeysDecodeErrorZ_free(uint64_t _res) {
26314         if (!ptr_is_owned(_res)) return;
26315         void* _res_ptr = untag_ptr(_res);
26316         CHECK_ACCESS(_res_ptr);
26317         LDKCResult_TxCreationKeysDecodeErrorZ _res_conv = *(LDKCResult_TxCreationKeysDecodeErrorZ*)(_res_ptr);
26318         FREE(untag_ptr(_res));
26319         CResult_TxCreationKeysDecodeErrorZ_free(_res_conv);
26320 }
26321
26322 static inline uint64_t CResult_TxCreationKeysDecodeErrorZ_clone_ptr(LDKCResult_TxCreationKeysDecodeErrorZ *NONNULL_PTR arg) {
26323         LDKCResult_TxCreationKeysDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TxCreationKeysDecodeErrorZ), "LDKCResult_TxCreationKeysDecodeErrorZ");
26324         *ret_conv = CResult_TxCreationKeysDecodeErrorZ_clone(arg);
26325         return tag_ptr(ret_conv, true);
26326 }
26327 int64_t  __attribute__((export_name("TS_CResult_TxCreationKeysDecodeErrorZ_clone_ptr"))) TS_CResult_TxCreationKeysDecodeErrorZ_clone_ptr(uint64_t arg) {
26328         LDKCResult_TxCreationKeysDecodeErrorZ* arg_conv = (LDKCResult_TxCreationKeysDecodeErrorZ*)untag_ptr(arg);
26329         int64_t ret_conv = CResult_TxCreationKeysDecodeErrorZ_clone_ptr(arg_conv);
26330         return ret_conv;
26331 }
26332
26333 uint64_t  __attribute__((export_name("TS_CResult_TxCreationKeysDecodeErrorZ_clone"))) TS_CResult_TxCreationKeysDecodeErrorZ_clone(uint64_t orig) {
26334         LDKCResult_TxCreationKeysDecodeErrorZ* orig_conv = (LDKCResult_TxCreationKeysDecodeErrorZ*)untag_ptr(orig);
26335         LDKCResult_TxCreationKeysDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TxCreationKeysDecodeErrorZ), "LDKCResult_TxCreationKeysDecodeErrorZ");
26336         *ret_conv = CResult_TxCreationKeysDecodeErrorZ_clone(orig_conv);
26337         return tag_ptr(ret_conv, true);
26338 }
26339
26340 uint64_t  __attribute__((export_name("TS_CResult_ChannelPublicKeysDecodeErrorZ_ok"))) TS_CResult_ChannelPublicKeysDecodeErrorZ_ok(uint64_t o) {
26341         LDKChannelPublicKeys o_conv;
26342         o_conv.inner = untag_ptr(o);
26343         o_conv.is_owned = ptr_is_owned(o);
26344         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
26345         o_conv = ChannelPublicKeys_clone(&o_conv);
26346         LDKCResult_ChannelPublicKeysDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelPublicKeysDecodeErrorZ), "LDKCResult_ChannelPublicKeysDecodeErrorZ");
26347         *ret_conv = CResult_ChannelPublicKeysDecodeErrorZ_ok(o_conv);
26348         return tag_ptr(ret_conv, true);
26349 }
26350
26351 uint64_t  __attribute__((export_name("TS_CResult_ChannelPublicKeysDecodeErrorZ_err"))) TS_CResult_ChannelPublicKeysDecodeErrorZ_err(uint64_t e) {
26352         void* e_ptr = untag_ptr(e);
26353         CHECK_ACCESS(e_ptr);
26354         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
26355         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
26356         LDKCResult_ChannelPublicKeysDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelPublicKeysDecodeErrorZ), "LDKCResult_ChannelPublicKeysDecodeErrorZ");
26357         *ret_conv = CResult_ChannelPublicKeysDecodeErrorZ_err(e_conv);
26358         return tag_ptr(ret_conv, true);
26359 }
26360
26361 jboolean  __attribute__((export_name("TS_CResult_ChannelPublicKeysDecodeErrorZ_is_ok"))) TS_CResult_ChannelPublicKeysDecodeErrorZ_is_ok(uint64_t o) {
26362         LDKCResult_ChannelPublicKeysDecodeErrorZ* o_conv = (LDKCResult_ChannelPublicKeysDecodeErrorZ*)untag_ptr(o);
26363         jboolean ret_conv = CResult_ChannelPublicKeysDecodeErrorZ_is_ok(o_conv);
26364         return ret_conv;
26365 }
26366
26367 void  __attribute__((export_name("TS_CResult_ChannelPublicKeysDecodeErrorZ_free"))) TS_CResult_ChannelPublicKeysDecodeErrorZ_free(uint64_t _res) {
26368         if (!ptr_is_owned(_res)) return;
26369         void* _res_ptr = untag_ptr(_res);
26370         CHECK_ACCESS(_res_ptr);
26371         LDKCResult_ChannelPublicKeysDecodeErrorZ _res_conv = *(LDKCResult_ChannelPublicKeysDecodeErrorZ*)(_res_ptr);
26372         FREE(untag_ptr(_res));
26373         CResult_ChannelPublicKeysDecodeErrorZ_free(_res_conv);
26374 }
26375
26376 static inline uint64_t CResult_ChannelPublicKeysDecodeErrorZ_clone_ptr(LDKCResult_ChannelPublicKeysDecodeErrorZ *NONNULL_PTR arg) {
26377         LDKCResult_ChannelPublicKeysDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelPublicKeysDecodeErrorZ), "LDKCResult_ChannelPublicKeysDecodeErrorZ");
26378         *ret_conv = CResult_ChannelPublicKeysDecodeErrorZ_clone(arg);
26379         return tag_ptr(ret_conv, true);
26380 }
26381 int64_t  __attribute__((export_name("TS_CResult_ChannelPublicKeysDecodeErrorZ_clone_ptr"))) TS_CResult_ChannelPublicKeysDecodeErrorZ_clone_ptr(uint64_t arg) {
26382         LDKCResult_ChannelPublicKeysDecodeErrorZ* arg_conv = (LDKCResult_ChannelPublicKeysDecodeErrorZ*)untag_ptr(arg);
26383         int64_t ret_conv = CResult_ChannelPublicKeysDecodeErrorZ_clone_ptr(arg_conv);
26384         return ret_conv;
26385 }
26386
26387 uint64_t  __attribute__((export_name("TS_CResult_ChannelPublicKeysDecodeErrorZ_clone"))) TS_CResult_ChannelPublicKeysDecodeErrorZ_clone(uint64_t orig) {
26388         LDKCResult_ChannelPublicKeysDecodeErrorZ* orig_conv = (LDKCResult_ChannelPublicKeysDecodeErrorZ*)untag_ptr(orig);
26389         LDKCResult_ChannelPublicKeysDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelPublicKeysDecodeErrorZ), "LDKCResult_ChannelPublicKeysDecodeErrorZ");
26390         *ret_conv = CResult_ChannelPublicKeysDecodeErrorZ_clone(orig_conv);
26391         return tag_ptr(ret_conv, true);
26392 }
26393
26394 uint64_t  __attribute__((export_name("TS_CResult_HTLCOutputInCommitmentDecodeErrorZ_ok"))) TS_CResult_HTLCOutputInCommitmentDecodeErrorZ_ok(uint64_t o) {
26395         LDKHTLCOutputInCommitment o_conv;
26396         o_conv.inner = untag_ptr(o);
26397         o_conv.is_owned = ptr_is_owned(o);
26398         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
26399         o_conv = HTLCOutputInCommitment_clone(&o_conv);
26400         LDKCResult_HTLCOutputInCommitmentDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_HTLCOutputInCommitmentDecodeErrorZ), "LDKCResult_HTLCOutputInCommitmentDecodeErrorZ");
26401         *ret_conv = CResult_HTLCOutputInCommitmentDecodeErrorZ_ok(o_conv);
26402         return tag_ptr(ret_conv, true);
26403 }
26404
26405 uint64_t  __attribute__((export_name("TS_CResult_HTLCOutputInCommitmentDecodeErrorZ_err"))) TS_CResult_HTLCOutputInCommitmentDecodeErrorZ_err(uint64_t e) {
26406         void* e_ptr = untag_ptr(e);
26407         CHECK_ACCESS(e_ptr);
26408         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
26409         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
26410         LDKCResult_HTLCOutputInCommitmentDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_HTLCOutputInCommitmentDecodeErrorZ), "LDKCResult_HTLCOutputInCommitmentDecodeErrorZ");
26411         *ret_conv = CResult_HTLCOutputInCommitmentDecodeErrorZ_err(e_conv);
26412         return tag_ptr(ret_conv, true);
26413 }
26414
26415 jboolean  __attribute__((export_name("TS_CResult_HTLCOutputInCommitmentDecodeErrorZ_is_ok"))) TS_CResult_HTLCOutputInCommitmentDecodeErrorZ_is_ok(uint64_t o) {
26416         LDKCResult_HTLCOutputInCommitmentDecodeErrorZ* o_conv = (LDKCResult_HTLCOutputInCommitmentDecodeErrorZ*)untag_ptr(o);
26417         jboolean ret_conv = CResult_HTLCOutputInCommitmentDecodeErrorZ_is_ok(o_conv);
26418         return ret_conv;
26419 }
26420
26421 void  __attribute__((export_name("TS_CResult_HTLCOutputInCommitmentDecodeErrorZ_free"))) TS_CResult_HTLCOutputInCommitmentDecodeErrorZ_free(uint64_t _res) {
26422         if (!ptr_is_owned(_res)) return;
26423         void* _res_ptr = untag_ptr(_res);
26424         CHECK_ACCESS(_res_ptr);
26425         LDKCResult_HTLCOutputInCommitmentDecodeErrorZ _res_conv = *(LDKCResult_HTLCOutputInCommitmentDecodeErrorZ*)(_res_ptr);
26426         FREE(untag_ptr(_res));
26427         CResult_HTLCOutputInCommitmentDecodeErrorZ_free(_res_conv);
26428 }
26429
26430 static inline uint64_t CResult_HTLCOutputInCommitmentDecodeErrorZ_clone_ptr(LDKCResult_HTLCOutputInCommitmentDecodeErrorZ *NONNULL_PTR arg) {
26431         LDKCResult_HTLCOutputInCommitmentDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_HTLCOutputInCommitmentDecodeErrorZ), "LDKCResult_HTLCOutputInCommitmentDecodeErrorZ");
26432         *ret_conv = CResult_HTLCOutputInCommitmentDecodeErrorZ_clone(arg);
26433         return tag_ptr(ret_conv, true);
26434 }
26435 int64_t  __attribute__((export_name("TS_CResult_HTLCOutputInCommitmentDecodeErrorZ_clone_ptr"))) TS_CResult_HTLCOutputInCommitmentDecodeErrorZ_clone_ptr(uint64_t arg) {
26436         LDKCResult_HTLCOutputInCommitmentDecodeErrorZ* arg_conv = (LDKCResult_HTLCOutputInCommitmentDecodeErrorZ*)untag_ptr(arg);
26437         int64_t ret_conv = CResult_HTLCOutputInCommitmentDecodeErrorZ_clone_ptr(arg_conv);
26438         return ret_conv;
26439 }
26440
26441 uint64_t  __attribute__((export_name("TS_CResult_HTLCOutputInCommitmentDecodeErrorZ_clone"))) TS_CResult_HTLCOutputInCommitmentDecodeErrorZ_clone(uint64_t orig) {
26442         LDKCResult_HTLCOutputInCommitmentDecodeErrorZ* orig_conv = (LDKCResult_HTLCOutputInCommitmentDecodeErrorZ*)untag_ptr(orig);
26443         LDKCResult_HTLCOutputInCommitmentDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_HTLCOutputInCommitmentDecodeErrorZ), "LDKCResult_HTLCOutputInCommitmentDecodeErrorZ");
26444         *ret_conv = CResult_HTLCOutputInCommitmentDecodeErrorZ_clone(orig_conv);
26445         return tag_ptr(ret_conv, true);
26446 }
26447
26448 uint64_t  __attribute__((export_name("TS_CResult_CounterpartyChannelTransactionParametersDecodeErrorZ_ok"))) TS_CResult_CounterpartyChannelTransactionParametersDecodeErrorZ_ok(uint64_t o) {
26449         LDKCounterpartyChannelTransactionParameters o_conv;
26450         o_conv.inner = untag_ptr(o);
26451         o_conv.is_owned = ptr_is_owned(o);
26452         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
26453         o_conv = CounterpartyChannelTransactionParameters_clone(&o_conv);
26454         LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ), "LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ");
26455         *ret_conv = CResult_CounterpartyChannelTransactionParametersDecodeErrorZ_ok(o_conv);
26456         return tag_ptr(ret_conv, true);
26457 }
26458
26459 uint64_t  __attribute__((export_name("TS_CResult_CounterpartyChannelTransactionParametersDecodeErrorZ_err"))) TS_CResult_CounterpartyChannelTransactionParametersDecodeErrorZ_err(uint64_t e) {
26460         void* e_ptr = untag_ptr(e);
26461         CHECK_ACCESS(e_ptr);
26462         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
26463         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
26464         LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ), "LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ");
26465         *ret_conv = CResult_CounterpartyChannelTransactionParametersDecodeErrorZ_err(e_conv);
26466         return tag_ptr(ret_conv, true);
26467 }
26468
26469 jboolean  __attribute__((export_name("TS_CResult_CounterpartyChannelTransactionParametersDecodeErrorZ_is_ok"))) TS_CResult_CounterpartyChannelTransactionParametersDecodeErrorZ_is_ok(uint64_t o) {
26470         LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ* o_conv = (LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ*)untag_ptr(o);
26471         jboolean ret_conv = CResult_CounterpartyChannelTransactionParametersDecodeErrorZ_is_ok(o_conv);
26472         return ret_conv;
26473 }
26474
26475 void  __attribute__((export_name("TS_CResult_CounterpartyChannelTransactionParametersDecodeErrorZ_free"))) TS_CResult_CounterpartyChannelTransactionParametersDecodeErrorZ_free(uint64_t _res) {
26476         if (!ptr_is_owned(_res)) return;
26477         void* _res_ptr = untag_ptr(_res);
26478         CHECK_ACCESS(_res_ptr);
26479         LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ _res_conv = *(LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ*)(_res_ptr);
26480         FREE(untag_ptr(_res));
26481         CResult_CounterpartyChannelTransactionParametersDecodeErrorZ_free(_res_conv);
26482 }
26483
26484 static inline uint64_t CResult_CounterpartyChannelTransactionParametersDecodeErrorZ_clone_ptr(LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ *NONNULL_PTR arg) {
26485         LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ), "LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ");
26486         *ret_conv = CResult_CounterpartyChannelTransactionParametersDecodeErrorZ_clone(arg);
26487         return tag_ptr(ret_conv, true);
26488 }
26489 int64_t  __attribute__((export_name("TS_CResult_CounterpartyChannelTransactionParametersDecodeErrorZ_clone_ptr"))) TS_CResult_CounterpartyChannelTransactionParametersDecodeErrorZ_clone_ptr(uint64_t arg) {
26490         LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ* arg_conv = (LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ*)untag_ptr(arg);
26491         int64_t ret_conv = CResult_CounterpartyChannelTransactionParametersDecodeErrorZ_clone_ptr(arg_conv);
26492         return ret_conv;
26493 }
26494
26495 uint64_t  __attribute__((export_name("TS_CResult_CounterpartyChannelTransactionParametersDecodeErrorZ_clone"))) TS_CResult_CounterpartyChannelTransactionParametersDecodeErrorZ_clone(uint64_t orig) {
26496         LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ* orig_conv = (LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ*)untag_ptr(orig);
26497         LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ), "LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ");
26498         *ret_conv = CResult_CounterpartyChannelTransactionParametersDecodeErrorZ_clone(orig_conv);
26499         return tag_ptr(ret_conv, true);
26500 }
26501
26502 uint64_t  __attribute__((export_name("TS_CResult_ChannelTransactionParametersDecodeErrorZ_ok"))) TS_CResult_ChannelTransactionParametersDecodeErrorZ_ok(uint64_t o) {
26503         LDKChannelTransactionParameters o_conv;
26504         o_conv.inner = untag_ptr(o);
26505         o_conv.is_owned = ptr_is_owned(o);
26506         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
26507         o_conv = ChannelTransactionParameters_clone(&o_conv);
26508         LDKCResult_ChannelTransactionParametersDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelTransactionParametersDecodeErrorZ), "LDKCResult_ChannelTransactionParametersDecodeErrorZ");
26509         *ret_conv = CResult_ChannelTransactionParametersDecodeErrorZ_ok(o_conv);
26510         return tag_ptr(ret_conv, true);
26511 }
26512
26513 uint64_t  __attribute__((export_name("TS_CResult_ChannelTransactionParametersDecodeErrorZ_err"))) TS_CResult_ChannelTransactionParametersDecodeErrorZ_err(uint64_t e) {
26514         void* e_ptr = untag_ptr(e);
26515         CHECK_ACCESS(e_ptr);
26516         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
26517         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
26518         LDKCResult_ChannelTransactionParametersDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelTransactionParametersDecodeErrorZ), "LDKCResult_ChannelTransactionParametersDecodeErrorZ");
26519         *ret_conv = CResult_ChannelTransactionParametersDecodeErrorZ_err(e_conv);
26520         return tag_ptr(ret_conv, true);
26521 }
26522
26523 jboolean  __attribute__((export_name("TS_CResult_ChannelTransactionParametersDecodeErrorZ_is_ok"))) TS_CResult_ChannelTransactionParametersDecodeErrorZ_is_ok(uint64_t o) {
26524         LDKCResult_ChannelTransactionParametersDecodeErrorZ* o_conv = (LDKCResult_ChannelTransactionParametersDecodeErrorZ*)untag_ptr(o);
26525         jboolean ret_conv = CResult_ChannelTransactionParametersDecodeErrorZ_is_ok(o_conv);
26526         return ret_conv;
26527 }
26528
26529 void  __attribute__((export_name("TS_CResult_ChannelTransactionParametersDecodeErrorZ_free"))) TS_CResult_ChannelTransactionParametersDecodeErrorZ_free(uint64_t _res) {
26530         if (!ptr_is_owned(_res)) return;
26531         void* _res_ptr = untag_ptr(_res);
26532         CHECK_ACCESS(_res_ptr);
26533         LDKCResult_ChannelTransactionParametersDecodeErrorZ _res_conv = *(LDKCResult_ChannelTransactionParametersDecodeErrorZ*)(_res_ptr);
26534         FREE(untag_ptr(_res));
26535         CResult_ChannelTransactionParametersDecodeErrorZ_free(_res_conv);
26536 }
26537
26538 static inline uint64_t CResult_ChannelTransactionParametersDecodeErrorZ_clone_ptr(LDKCResult_ChannelTransactionParametersDecodeErrorZ *NONNULL_PTR arg) {
26539         LDKCResult_ChannelTransactionParametersDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelTransactionParametersDecodeErrorZ), "LDKCResult_ChannelTransactionParametersDecodeErrorZ");
26540         *ret_conv = CResult_ChannelTransactionParametersDecodeErrorZ_clone(arg);
26541         return tag_ptr(ret_conv, true);
26542 }
26543 int64_t  __attribute__((export_name("TS_CResult_ChannelTransactionParametersDecodeErrorZ_clone_ptr"))) TS_CResult_ChannelTransactionParametersDecodeErrorZ_clone_ptr(uint64_t arg) {
26544         LDKCResult_ChannelTransactionParametersDecodeErrorZ* arg_conv = (LDKCResult_ChannelTransactionParametersDecodeErrorZ*)untag_ptr(arg);
26545         int64_t ret_conv = CResult_ChannelTransactionParametersDecodeErrorZ_clone_ptr(arg_conv);
26546         return ret_conv;
26547 }
26548
26549 uint64_t  __attribute__((export_name("TS_CResult_ChannelTransactionParametersDecodeErrorZ_clone"))) TS_CResult_ChannelTransactionParametersDecodeErrorZ_clone(uint64_t orig) {
26550         LDKCResult_ChannelTransactionParametersDecodeErrorZ* orig_conv = (LDKCResult_ChannelTransactionParametersDecodeErrorZ*)untag_ptr(orig);
26551         LDKCResult_ChannelTransactionParametersDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelTransactionParametersDecodeErrorZ), "LDKCResult_ChannelTransactionParametersDecodeErrorZ");
26552         *ret_conv = CResult_ChannelTransactionParametersDecodeErrorZ_clone(orig_conv);
26553         return tag_ptr(ret_conv, true);
26554 }
26555
26556 uint64_t  __attribute__((export_name("TS_CResult_HolderCommitmentTransactionDecodeErrorZ_ok"))) TS_CResult_HolderCommitmentTransactionDecodeErrorZ_ok(uint64_t o) {
26557         LDKHolderCommitmentTransaction o_conv;
26558         o_conv.inner = untag_ptr(o);
26559         o_conv.is_owned = ptr_is_owned(o);
26560         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
26561         o_conv = HolderCommitmentTransaction_clone(&o_conv);
26562         LDKCResult_HolderCommitmentTransactionDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_HolderCommitmentTransactionDecodeErrorZ), "LDKCResult_HolderCommitmentTransactionDecodeErrorZ");
26563         *ret_conv = CResult_HolderCommitmentTransactionDecodeErrorZ_ok(o_conv);
26564         return tag_ptr(ret_conv, true);
26565 }
26566
26567 uint64_t  __attribute__((export_name("TS_CResult_HolderCommitmentTransactionDecodeErrorZ_err"))) TS_CResult_HolderCommitmentTransactionDecodeErrorZ_err(uint64_t e) {
26568         void* e_ptr = untag_ptr(e);
26569         CHECK_ACCESS(e_ptr);
26570         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
26571         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
26572         LDKCResult_HolderCommitmentTransactionDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_HolderCommitmentTransactionDecodeErrorZ), "LDKCResult_HolderCommitmentTransactionDecodeErrorZ");
26573         *ret_conv = CResult_HolderCommitmentTransactionDecodeErrorZ_err(e_conv);
26574         return tag_ptr(ret_conv, true);
26575 }
26576
26577 jboolean  __attribute__((export_name("TS_CResult_HolderCommitmentTransactionDecodeErrorZ_is_ok"))) TS_CResult_HolderCommitmentTransactionDecodeErrorZ_is_ok(uint64_t o) {
26578         LDKCResult_HolderCommitmentTransactionDecodeErrorZ* o_conv = (LDKCResult_HolderCommitmentTransactionDecodeErrorZ*)untag_ptr(o);
26579         jboolean ret_conv = CResult_HolderCommitmentTransactionDecodeErrorZ_is_ok(o_conv);
26580         return ret_conv;
26581 }
26582
26583 void  __attribute__((export_name("TS_CResult_HolderCommitmentTransactionDecodeErrorZ_free"))) TS_CResult_HolderCommitmentTransactionDecodeErrorZ_free(uint64_t _res) {
26584         if (!ptr_is_owned(_res)) return;
26585         void* _res_ptr = untag_ptr(_res);
26586         CHECK_ACCESS(_res_ptr);
26587         LDKCResult_HolderCommitmentTransactionDecodeErrorZ _res_conv = *(LDKCResult_HolderCommitmentTransactionDecodeErrorZ*)(_res_ptr);
26588         FREE(untag_ptr(_res));
26589         CResult_HolderCommitmentTransactionDecodeErrorZ_free(_res_conv);
26590 }
26591
26592 static inline uint64_t CResult_HolderCommitmentTransactionDecodeErrorZ_clone_ptr(LDKCResult_HolderCommitmentTransactionDecodeErrorZ *NONNULL_PTR arg) {
26593         LDKCResult_HolderCommitmentTransactionDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_HolderCommitmentTransactionDecodeErrorZ), "LDKCResult_HolderCommitmentTransactionDecodeErrorZ");
26594         *ret_conv = CResult_HolderCommitmentTransactionDecodeErrorZ_clone(arg);
26595         return tag_ptr(ret_conv, true);
26596 }
26597 int64_t  __attribute__((export_name("TS_CResult_HolderCommitmentTransactionDecodeErrorZ_clone_ptr"))) TS_CResult_HolderCommitmentTransactionDecodeErrorZ_clone_ptr(uint64_t arg) {
26598         LDKCResult_HolderCommitmentTransactionDecodeErrorZ* arg_conv = (LDKCResult_HolderCommitmentTransactionDecodeErrorZ*)untag_ptr(arg);
26599         int64_t ret_conv = CResult_HolderCommitmentTransactionDecodeErrorZ_clone_ptr(arg_conv);
26600         return ret_conv;
26601 }
26602
26603 uint64_t  __attribute__((export_name("TS_CResult_HolderCommitmentTransactionDecodeErrorZ_clone"))) TS_CResult_HolderCommitmentTransactionDecodeErrorZ_clone(uint64_t orig) {
26604         LDKCResult_HolderCommitmentTransactionDecodeErrorZ* orig_conv = (LDKCResult_HolderCommitmentTransactionDecodeErrorZ*)untag_ptr(orig);
26605         LDKCResult_HolderCommitmentTransactionDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_HolderCommitmentTransactionDecodeErrorZ), "LDKCResult_HolderCommitmentTransactionDecodeErrorZ");
26606         *ret_conv = CResult_HolderCommitmentTransactionDecodeErrorZ_clone(orig_conv);
26607         return tag_ptr(ret_conv, true);
26608 }
26609
26610 uint64_t  __attribute__((export_name("TS_CResult_BuiltCommitmentTransactionDecodeErrorZ_ok"))) TS_CResult_BuiltCommitmentTransactionDecodeErrorZ_ok(uint64_t o) {
26611         LDKBuiltCommitmentTransaction o_conv;
26612         o_conv.inner = untag_ptr(o);
26613         o_conv.is_owned = ptr_is_owned(o);
26614         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
26615         o_conv = BuiltCommitmentTransaction_clone(&o_conv);
26616         LDKCResult_BuiltCommitmentTransactionDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_BuiltCommitmentTransactionDecodeErrorZ), "LDKCResult_BuiltCommitmentTransactionDecodeErrorZ");
26617         *ret_conv = CResult_BuiltCommitmentTransactionDecodeErrorZ_ok(o_conv);
26618         return tag_ptr(ret_conv, true);
26619 }
26620
26621 uint64_t  __attribute__((export_name("TS_CResult_BuiltCommitmentTransactionDecodeErrorZ_err"))) TS_CResult_BuiltCommitmentTransactionDecodeErrorZ_err(uint64_t e) {
26622         void* e_ptr = untag_ptr(e);
26623         CHECK_ACCESS(e_ptr);
26624         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
26625         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
26626         LDKCResult_BuiltCommitmentTransactionDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_BuiltCommitmentTransactionDecodeErrorZ), "LDKCResult_BuiltCommitmentTransactionDecodeErrorZ");
26627         *ret_conv = CResult_BuiltCommitmentTransactionDecodeErrorZ_err(e_conv);
26628         return tag_ptr(ret_conv, true);
26629 }
26630
26631 jboolean  __attribute__((export_name("TS_CResult_BuiltCommitmentTransactionDecodeErrorZ_is_ok"))) TS_CResult_BuiltCommitmentTransactionDecodeErrorZ_is_ok(uint64_t o) {
26632         LDKCResult_BuiltCommitmentTransactionDecodeErrorZ* o_conv = (LDKCResult_BuiltCommitmentTransactionDecodeErrorZ*)untag_ptr(o);
26633         jboolean ret_conv = CResult_BuiltCommitmentTransactionDecodeErrorZ_is_ok(o_conv);
26634         return ret_conv;
26635 }
26636
26637 void  __attribute__((export_name("TS_CResult_BuiltCommitmentTransactionDecodeErrorZ_free"))) TS_CResult_BuiltCommitmentTransactionDecodeErrorZ_free(uint64_t _res) {
26638         if (!ptr_is_owned(_res)) return;
26639         void* _res_ptr = untag_ptr(_res);
26640         CHECK_ACCESS(_res_ptr);
26641         LDKCResult_BuiltCommitmentTransactionDecodeErrorZ _res_conv = *(LDKCResult_BuiltCommitmentTransactionDecodeErrorZ*)(_res_ptr);
26642         FREE(untag_ptr(_res));
26643         CResult_BuiltCommitmentTransactionDecodeErrorZ_free(_res_conv);
26644 }
26645
26646 static inline uint64_t CResult_BuiltCommitmentTransactionDecodeErrorZ_clone_ptr(LDKCResult_BuiltCommitmentTransactionDecodeErrorZ *NONNULL_PTR arg) {
26647         LDKCResult_BuiltCommitmentTransactionDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_BuiltCommitmentTransactionDecodeErrorZ), "LDKCResult_BuiltCommitmentTransactionDecodeErrorZ");
26648         *ret_conv = CResult_BuiltCommitmentTransactionDecodeErrorZ_clone(arg);
26649         return tag_ptr(ret_conv, true);
26650 }
26651 int64_t  __attribute__((export_name("TS_CResult_BuiltCommitmentTransactionDecodeErrorZ_clone_ptr"))) TS_CResult_BuiltCommitmentTransactionDecodeErrorZ_clone_ptr(uint64_t arg) {
26652         LDKCResult_BuiltCommitmentTransactionDecodeErrorZ* arg_conv = (LDKCResult_BuiltCommitmentTransactionDecodeErrorZ*)untag_ptr(arg);
26653         int64_t ret_conv = CResult_BuiltCommitmentTransactionDecodeErrorZ_clone_ptr(arg_conv);
26654         return ret_conv;
26655 }
26656
26657 uint64_t  __attribute__((export_name("TS_CResult_BuiltCommitmentTransactionDecodeErrorZ_clone"))) TS_CResult_BuiltCommitmentTransactionDecodeErrorZ_clone(uint64_t orig) {
26658         LDKCResult_BuiltCommitmentTransactionDecodeErrorZ* orig_conv = (LDKCResult_BuiltCommitmentTransactionDecodeErrorZ*)untag_ptr(orig);
26659         LDKCResult_BuiltCommitmentTransactionDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_BuiltCommitmentTransactionDecodeErrorZ), "LDKCResult_BuiltCommitmentTransactionDecodeErrorZ");
26660         *ret_conv = CResult_BuiltCommitmentTransactionDecodeErrorZ_clone(orig_conv);
26661         return tag_ptr(ret_conv, true);
26662 }
26663
26664 uint64_t  __attribute__((export_name("TS_CResult_TrustedClosingTransactionNoneZ_ok"))) TS_CResult_TrustedClosingTransactionNoneZ_ok(uint64_t o) {
26665         LDKTrustedClosingTransaction o_conv;
26666         o_conv.inner = untag_ptr(o);
26667         o_conv.is_owned = ptr_is_owned(o);
26668         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
26669         // WARNING: we need a move here but no clone is available for LDKTrustedClosingTransaction
26670         
26671         LDKCResult_TrustedClosingTransactionNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_TrustedClosingTransactionNoneZ), "LDKCResult_TrustedClosingTransactionNoneZ");
26672         *ret_conv = CResult_TrustedClosingTransactionNoneZ_ok(o_conv);
26673         return tag_ptr(ret_conv, true);
26674 }
26675
26676 uint64_t  __attribute__((export_name("TS_CResult_TrustedClosingTransactionNoneZ_err"))) TS_CResult_TrustedClosingTransactionNoneZ_err() {
26677         LDKCResult_TrustedClosingTransactionNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_TrustedClosingTransactionNoneZ), "LDKCResult_TrustedClosingTransactionNoneZ");
26678         *ret_conv = CResult_TrustedClosingTransactionNoneZ_err();
26679         return tag_ptr(ret_conv, true);
26680 }
26681
26682 jboolean  __attribute__((export_name("TS_CResult_TrustedClosingTransactionNoneZ_is_ok"))) TS_CResult_TrustedClosingTransactionNoneZ_is_ok(uint64_t o) {
26683         LDKCResult_TrustedClosingTransactionNoneZ* o_conv = (LDKCResult_TrustedClosingTransactionNoneZ*)untag_ptr(o);
26684         jboolean ret_conv = CResult_TrustedClosingTransactionNoneZ_is_ok(o_conv);
26685         return ret_conv;
26686 }
26687
26688 void  __attribute__((export_name("TS_CResult_TrustedClosingTransactionNoneZ_free"))) TS_CResult_TrustedClosingTransactionNoneZ_free(uint64_t _res) {
26689         if (!ptr_is_owned(_res)) return;
26690         void* _res_ptr = untag_ptr(_res);
26691         CHECK_ACCESS(_res_ptr);
26692         LDKCResult_TrustedClosingTransactionNoneZ _res_conv = *(LDKCResult_TrustedClosingTransactionNoneZ*)(_res_ptr);
26693         FREE(untag_ptr(_res));
26694         CResult_TrustedClosingTransactionNoneZ_free(_res_conv);
26695 }
26696
26697 uint64_t  __attribute__((export_name("TS_CResult_CommitmentTransactionDecodeErrorZ_ok"))) TS_CResult_CommitmentTransactionDecodeErrorZ_ok(uint64_t o) {
26698         LDKCommitmentTransaction o_conv;
26699         o_conv.inner = untag_ptr(o);
26700         o_conv.is_owned = ptr_is_owned(o);
26701         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
26702         o_conv = CommitmentTransaction_clone(&o_conv);
26703         LDKCResult_CommitmentTransactionDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CommitmentTransactionDecodeErrorZ), "LDKCResult_CommitmentTransactionDecodeErrorZ");
26704         *ret_conv = CResult_CommitmentTransactionDecodeErrorZ_ok(o_conv);
26705         return tag_ptr(ret_conv, true);
26706 }
26707
26708 uint64_t  __attribute__((export_name("TS_CResult_CommitmentTransactionDecodeErrorZ_err"))) TS_CResult_CommitmentTransactionDecodeErrorZ_err(uint64_t e) {
26709         void* e_ptr = untag_ptr(e);
26710         CHECK_ACCESS(e_ptr);
26711         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
26712         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
26713         LDKCResult_CommitmentTransactionDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CommitmentTransactionDecodeErrorZ), "LDKCResult_CommitmentTransactionDecodeErrorZ");
26714         *ret_conv = CResult_CommitmentTransactionDecodeErrorZ_err(e_conv);
26715         return tag_ptr(ret_conv, true);
26716 }
26717
26718 jboolean  __attribute__((export_name("TS_CResult_CommitmentTransactionDecodeErrorZ_is_ok"))) TS_CResult_CommitmentTransactionDecodeErrorZ_is_ok(uint64_t o) {
26719         LDKCResult_CommitmentTransactionDecodeErrorZ* o_conv = (LDKCResult_CommitmentTransactionDecodeErrorZ*)untag_ptr(o);
26720         jboolean ret_conv = CResult_CommitmentTransactionDecodeErrorZ_is_ok(o_conv);
26721         return ret_conv;
26722 }
26723
26724 void  __attribute__((export_name("TS_CResult_CommitmentTransactionDecodeErrorZ_free"))) TS_CResult_CommitmentTransactionDecodeErrorZ_free(uint64_t _res) {
26725         if (!ptr_is_owned(_res)) return;
26726         void* _res_ptr = untag_ptr(_res);
26727         CHECK_ACCESS(_res_ptr);
26728         LDKCResult_CommitmentTransactionDecodeErrorZ _res_conv = *(LDKCResult_CommitmentTransactionDecodeErrorZ*)(_res_ptr);
26729         FREE(untag_ptr(_res));
26730         CResult_CommitmentTransactionDecodeErrorZ_free(_res_conv);
26731 }
26732
26733 static inline uint64_t CResult_CommitmentTransactionDecodeErrorZ_clone_ptr(LDKCResult_CommitmentTransactionDecodeErrorZ *NONNULL_PTR arg) {
26734         LDKCResult_CommitmentTransactionDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CommitmentTransactionDecodeErrorZ), "LDKCResult_CommitmentTransactionDecodeErrorZ");
26735         *ret_conv = CResult_CommitmentTransactionDecodeErrorZ_clone(arg);
26736         return tag_ptr(ret_conv, true);
26737 }
26738 int64_t  __attribute__((export_name("TS_CResult_CommitmentTransactionDecodeErrorZ_clone_ptr"))) TS_CResult_CommitmentTransactionDecodeErrorZ_clone_ptr(uint64_t arg) {
26739         LDKCResult_CommitmentTransactionDecodeErrorZ* arg_conv = (LDKCResult_CommitmentTransactionDecodeErrorZ*)untag_ptr(arg);
26740         int64_t ret_conv = CResult_CommitmentTransactionDecodeErrorZ_clone_ptr(arg_conv);
26741         return ret_conv;
26742 }
26743
26744 uint64_t  __attribute__((export_name("TS_CResult_CommitmentTransactionDecodeErrorZ_clone"))) TS_CResult_CommitmentTransactionDecodeErrorZ_clone(uint64_t orig) {
26745         LDKCResult_CommitmentTransactionDecodeErrorZ* orig_conv = (LDKCResult_CommitmentTransactionDecodeErrorZ*)untag_ptr(orig);
26746         LDKCResult_CommitmentTransactionDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CommitmentTransactionDecodeErrorZ), "LDKCResult_CommitmentTransactionDecodeErrorZ");
26747         *ret_conv = CResult_CommitmentTransactionDecodeErrorZ_clone(orig_conv);
26748         return tag_ptr(ret_conv, true);
26749 }
26750
26751 uint64_t  __attribute__((export_name("TS_CResult_TrustedCommitmentTransactionNoneZ_ok"))) TS_CResult_TrustedCommitmentTransactionNoneZ_ok(uint64_t o) {
26752         LDKTrustedCommitmentTransaction o_conv;
26753         o_conv.inner = untag_ptr(o);
26754         o_conv.is_owned = ptr_is_owned(o);
26755         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
26756         // WARNING: we need a move here but no clone is available for LDKTrustedCommitmentTransaction
26757         
26758         LDKCResult_TrustedCommitmentTransactionNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_TrustedCommitmentTransactionNoneZ), "LDKCResult_TrustedCommitmentTransactionNoneZ");
26759         *ret_conv = CResult_TrustedCommitmentTransactionNoneZ_ok(o_conv);
26760         return tag_ptr(ret_conv, true);
26761 }
26762
26763 uint64_t  __attribute__((export_name("TS_CResult_TrustedCommitmentTransactionNoneZ_err"))) TS_CResult_TrustedCommitmentTransactionNoneZ_err() {
26764         LDKCResult_TrustedCommitmentTransactionNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_TrustedCommitmentTransactionNoneZ), "LDKCResult_TrustedCommitmentTransactionNoneZ");
26765         *ret_conv = CResult_TrustedCommitmentTransactionNoneZ_err();
26766         return tag_ptr(ret_conv, true);
26767 }
26768
26769 jboolean  __attribute__((export_name("TS_CResult_TrustedCommitmentTransactionNoneZ_is_ok"))) TS_CResult_TrustedCommitmentTransactionNoneZ_is_ok(uint64_t o) {
26770         LDKCResult_TrustedCommitmentTransactionNoneZ* o_conv = (LDKCResult_TrustedCommitmentTransactionNoneZ*)untag_ptr(o);
26771         jboolean ret_conv = CResult_TrustedCommitmentTransactionNoneZ_is_ok(o_conv);
26772         return ret_conv;
26773 }
26774
26775 void  __attribute__((export_name("TS_CResult_TrustedCommitmentTransactionNoneZ_free"))) TS_CResult_TrustedCommitmentTransactionNoneZ_free(uint64_t _res) {
26776         if (!ptr_is_owned(_res)) return;
26777         void* _res_ptr = untag_ptr(_res);
26778         CHECK_ACCESS(_res_ptr);
26779         LDKCResult_TrustedCommitmentTransactionNoneZ _res_conv = *(LDKCResult_TrustedCommitmentTransactionNoneZ*)(_res_ptr);
26780         FREE(untag_ptr(_res));
26781         CResult_TrustedCommitmentTransactionNoneZ_free(_res_conv);
26782 }
26783
26784 uint64_t  __attribute__((export_name("TS_CResult_CVec_ECDSASignatureZNoneZ_ok"))) TS_CResult_CVec_ECDSASignatureZNoneZ_ok(ptrArray o) {
26785         LDKCVec_ECDSASignatureZ o_constr;
26786         o_constr.datalen = o->arr_len;
26787         if (o_constr.datalen > 0)
26788                 o_constr.data = MALLOC(o_constr.datalen * sizeof(LDKECDSASignature), "LDKCVec_ECDSASignatureZ Elements");
26789         else
26790                 o_constr.data = NULL;
26791         int8_tArray* o_vals = (void*) o->elems;
26792         for (size_t m = 0; m < o_constr.datalen; m++) {
26793                 int8_tArray o_conv_12 = o_vals[m];
26794                 LDKECDSASignature o_conv_12_ref;
26795                 CHECK(o_conv_12->arr_len == 64);
26796                 memcpy(o_conv_12_ref.compact_form, o_conv_12->elems, 64); FREE(o_conv_12);
26797                 o_constr.data[m] = o_conv_12_ref;
26798         }
26799         FREE(o);
26800         LDKCResult_CVec_ECDSASignatureZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_ECDSASignatureZNoneZ), "LDKCResult_CVec_ECDSASignatureZNoneZ");
26801         *ret_conv = CResult_CVec_ECDSASignatureZNoneZ_ok(o_constr);
26802         return tag_ptr(ret_conv, true);
26803 }
26804
26805 uint64_t  __attribute__((export_name("TS_CResult_CVec_ECDSASignatureZNoneZ_err"))) TS_CResult_CVec_ECDSASignatureZNoneZ_err() {
26806         LDKCResult_CVec_ECDSASignatureZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_ECDSASignatureZNoneZ), "LDKCResult_CVec_ECDSASignatureZNoneZ");
26807         *ret_conv = CResult_CVec_ECDSASignatureZNoneZ_err();
26808         return tag_ptr(ret_conv, true);
26809 }
26810
26811 jboolean  __attribute__((export_name("TS_CResult_CVec_ECDSASignatureZNoneZ_is_ok"))) TS_CResult_CVec_ECDSASignatureZNoneZ_is_ok(uint64_t o) {
26812         LDKCResult_CVec_ECDSASignatureZNoneZ* o_conv = (LDKCResult_CVec_ECDSASignatureZNoneZ*)untag_ptr(o);
26813         jboolean ret_conv = CResult_CVec_ECDSASignatureZNoneZ_is_ok(o_conv);
26814         return ret_conv;
26815 }
26816
26817 void  __attribute__((export_name("TS_CResult_CVec_ECDSASignatureZNoneZ_free"))) TS_CResult_CVec_ECDSASignatureZNoneZ_free(uint64_t _res) {
26818         if (!ptr_is_owned(_res)) return;
26819         void* _res_ptr = untag_ptr(_res);
26820         CHECK_ACCESS(_res_ptr);
26821         LDKCResult_CVec_ECDSASignatureZNoneZ _res_conv = *(LDKCResult_CVec_ECDSASignatureZNoneZ*)(_res_ptr);
26822         FREE(untag_ptr(_res));
26823         CResult_CVec_ECDSASignatureZNoneZ_free(_res_conv);
26824 }
26825
26826 static inline uint64_t CResult_CVec_ECDSASignatureZNoneZ_clone_ptr(LDKCResult_CVec_ECDSASignatureZNoneZ *NONNULL_PTR arg) {
26827         LDKCResult_CVec_ECDSASignatureZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_ECDSASignatureZNoneZ), "LDKCResult_CVec_ECDSASignatureZNoneZ");
26828         *ret_conv = CResult_CVec_ECDSASignatureZNoneZ_clone(arg);
26829         return tag_ptr(ret_conv, true);
26830 }
26831 int64_t  __attribute__((export_name("TS_CResult_CVec_ECDSASignatureZNoneZ_clone_ptr"))) TS_CResult_CVec_ECDSASignatureZNoneZ_clone_ptr(uint64_t arg) {
26832         LDKCResult_CVec_ECDSASignatureZNoneZ* arg_conv = (LDKCResult_CVec_ECDSASignatureZNoneZ*)untag_ptr(arg);
26833         int64_t ret_conv = CResult_CVec_ECDSASignatureZNoneZ_clone_ptr(arg_conv);
26834         return ret_conv;
26835 }
26836
26837 uint64_t  __attribute__((export_name("TS_CResult_CVec_ECDSASignatureZNoneZ_clone"))) TS_CResult_CVec_ECDSASignatureZNoneZ_clone(uint64_t orig) {
26838         LDKCResult_CVec_ECDSASignatureZNoneZ* orig_conv = (LDKCResult_CVec_ECDSASignatureZNoneZ*)untag_ptr(orig);
26839         LDKCResult_CVec_ECDSASignatureZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_ECDSASignatureZNoneZ), "LDKCResult_CVec_ECDSASignatureZNoneZ");
26840         *ret_conv = CResult_CVec_ECDSASignatureZNoneZ_clone(orig_conv);
26841         return tag_ptr(ret_conv, true);
26842 }
26843
26844 uint64_t  __attribute__((export_name("TS_COption_usizeZ_some"))) TS_COption_usizeZ_some(uint32_t o) {
26845         LDKCOption_usizeZ *ret_copy = MALLOC(sizeof(LDKCOption_usizeZ), "LDKCOption_usizeZ");
26846         *ret_copy = COption_usizeZ_some(o);
26847         uint64_t ret_ref = tag_ptr(ret_copy, true);
26848         return ret_ref;
26849 }
26850
26851 uint64_t  __attribute__((export_name("TS_COption_usizeZ_none"))) TS_COption_usizeZ_none() {
26852         LDKCOption_usizeZ *ret_copy = MALLOC(sizeof(LDKCOption_usizeZ), "LDKCOption_usizeZ");
26853         *ret_copy = COption_usizeZ_none();
26854         uint64_t ret_ref = tag_ptr(ret_copy, true);
26855         return ret_ref;
26856 }
26857
26858 void  __attribute__((export_name("TS_COption_usizeZ_free"))) TS_COption_usizeZ_free(uint64_t _res) {
26859         if (!ptr_is_owned(_res)) return;
26860         void* _res_ptr = untag_ptr(_res);
26861         CHECK_ACCESS(_res_ptr);
26862         LDKCOption_usizeZ _res_conv = *(LDKCOption_usizeZ*)(_res_ptr);
26863         FREE(untag_ptr(_res));
26864         COption_usizeZ_free(_res_conv);
26865 }
26866
26867 static inline uint64_t COption_usizeZ_clone_ptr(LDKCOption_usizeZ *NONNULL_PTR arg) {
26868         LDKCOption_usizeZ *ret_copy = MALLOC(sizeof(LDKCOption_usizeZ), "LDKCOption_usizeZ");
26869         *ret_copy = COption_usizeZ_clone(arg);
26870         uint64_t ret_ref = tag_ptr(ret_copy, true);
26871         return ret_ref;
26872 }
26873 int64_t  __attribute__((export_name("TS_COption_usizeZ_clone_ptr"))) TS_COption_usizeZ_clone_ptr(uint64_t arg) {
26874         LDKCOption_usizeZ* arg_conv = (LDKCOption_usizeZ*)untag_ptr(arg);
26875         int64_t ret_conv = COption_usizeZ_clone_ptr(arg_conv);
26876         return ret_conv;
26877 }
26878
26879 uint64_t  __attribute__((export_name("TS_COption_usizeZ_clone"))) TS_COption_usizeZ_clone(uint64_t orig) {
26880         LDKCOption_usizeZ* orig_conv = (LDKCOption_usizeZ*)untag_ptr(orig);
26881         LDKCOption_usizeZ *ret_copy = MALLOC(sizeof(LDKCOption_usizeZ), "LDKCOption_usizeZ");
26882         *ret_copy = COption_usizeZ_clone(orig_conv);
26883         uint64_t ret_ref = tag_ptr(ret_copy, true);
26884         return ret_ref;
26885 }
26886
26887 uint64_t  __attribute__((export_name("TS_CResult_ShutdownScriptDecodeErrorZ_ok"))) TS_CResult_ShutdownScriptDecodeErrorZ_ok(uint64_t o) {
26888         LDKShutdownScript o_conv;
26889         o_conv.inner = untag_ptr(o);
26890         o_conv.is_owned = ptr_is_owned(o);
26891         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
26892         o_conv = ShutdownScript_clone(&o_conv);
26893         LDKCResult_ShutdownScriptDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ShutdownScriptDecodeErrorZ), "LDKCResult_ShutdownScriptDecodeErrorZ");
26894         *ret_conv = CResult_ShutdownScriptDecodeErrorZ_ok(o_conv);
26895         return tag_ptr(ret_conv, true);
26896 }
26897
26898 uint64_t  __attribute__((export_name("TS_CResult_ShutdownScriptDecodeErrorZ_err"))) TS_CResult_ShutdownScriptDecodeErrorZ_err(uint64_t e) {
26899         void* e_ptr = untag_ptr(e);
26900         CHECK_ACCESS(e_ptr);
26901         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
26902         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
26903         LDKCResult_ShutdownScriptDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ShutdownScriptDecodeErrorZ), "LDKCResult_ShutdownScriptDecodeErrorZ");
26904         *ret_conv = CResult_ShutdownScriptDecodeErrorZ_err(e_conv);
26905         return tag_ptr(ret_conv, true);
26906 }
26907
26908 jboolean  __attribute__((export_name("TS_CResult_ShutdownScriptDecodeErrorZ_is_ok"))) TS_CResult_ShutdownScriptDecodeErrorZ_is_ok(uint64_t o) {
26909         LDKCResult_ShutdownScriptDecodeErrorZ* o_conv = (LDKCResult_ShutdownScriptDecodeErrorZ*)untag_ptr(o);
26910         jboolean ret_conv = CResult_ShutdownScriptDecodeErrorZ_is_ok(o_conv);
26911         return ret_conv;
26912 }
26913
26914 void  __attribute__((export_name("TS_CResult_ShutdownScriptDecodeErrorZ_free"))) TS_CResult_ShutdownScriptDecodeErrorZ_free(uint64_t _res) {
26915         if (!ptr_is_owned(_res)) return;
26916         void* _res_ptr = untag_ptr(_res);
26917         CHECK_ACCESS(_res_ptr);
26918         LDKCResult_ShutdownScriptDecodeErrorZ _res_conv = *(LDKCResult_ShutdownScriptDecodeErrorZ*)(_res_ptr);
26919         FREE(untag_ptr(_res));
26920         CResult_ShutdownScriptDecodeErrorZ_free(_res_conv);
26921 }
26922
26923 static inline uint64_t CResult_ShutdownScriptDecodeErrorZ_clone_ptr(LDKCResult_ShutdownScriptDecodeErrorZ *NONNULL_PTR arg) {
26924         LDKCResult_ShutdownScriptDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ShutdownScriptDecodeErrorZ), "LDKCResult_ShutdownScriptDecodeErrorZ");
26925         *ret_conv = CResult_ShutdownScriptDecodeErrorZ_clone(arg);
26926         return tag_ptr(ret_conv, true);
26927 }
26928 int64_t  __attribute__((export_name("TS_CResult_ShutdownScriptDecodeErrorZ_clone_ptr"))) TS_CResult_ShutdownScriptDecodeErrorZ_clone_ptr(uint64_t arg) {
26929         LDKCResult_ShutdownScriptDecodeErrorZ* arg_conv = (LDKCResult_ShutdownScriptDecodeErrorZ*)untag_ptr(arg);
26930         int64_t ret_conv = CResult_ShutdownScriptDecodeErrorZ_clone_ptr(arg_conv);
26931         return ret_conv;
26932 }
26933
26934 uint64_t  __attribute__((export_name("TS_CResult_ShutdownScriptDecodeErrorZ_clone"))) TS_CResult_ShutdownScriptDecodeErrorZ_clone(uint64_t orig) {
26935         LDKCResult_ShutdownScriptDecodeErrorZ* orig_conv = (LDKCResult_ShutdownScriptDecodeErrorZ*)untag_ptr(orig);
26936         LDKCResult_ShutdownScriptDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ShutdownScriptDecodeErrorZ), "LDKCResult_ShutdownScriptDecodeErrorZ");
26937         *ret_conv = CResult_ShutdownScriptDecodeErrorZ_clone(orig_conv);
26938         return tag_ptr(ret_conv, true);
26939 }
26940
26941 uint64_t  __attribute__((export_name("TS_CResult_ShutdownScriptInvalidShutdownScriptZ_ok"))) TS_CResult_ShutdownScriptInvalidShutdownScriptZ_ok(uint64_t o) {
26942         LDKShutdownScript o_conv;
26943         o_conv.inner = untag_ptr(o);
26944         o_conv.is_owned = ptr_is_owned(o);
26945         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
26946         o_conv = ShutdownScript_clone(&o_conv);
26947         LDKCResult_ShutdownScriptInvalidShutdownScriptZ* ret_conv = MALLOC(sizeof(LDKCResult_ShutdownScriptInvalidShutdownScriptZ), "LDKCResult_ShutdownScriptInvalidShutdownScriptZ");
26948         *ret_conv = CResult_ShutdownScriptInvalidShutdownScriptZ_ok(o_conv);
26949         return tag_ptr(ret_conv, true);
26950 }
26951
26952 uint64_t  __attribute__((export_name("TS_CResult_ShutdownScriptInvalidShutdownScriptZ_err"))) TS_CResult_ShutdownScriptInvalidShutdownScriptZ_err(uint64_t e) {
26953         LDKInvalidShutdownScript e_conv;
26954         e_conv.inner = untag_ptr(e);
26955         e_conv.is_owned = ptr_is_owned(e);
26956         CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
26957         e_conv = InvalidShutdownScript_clone(&e_conv);
26958         LDKCResult_ShutdownScriptInvalidShutdownScriptZ* ret_conv = MALLOC(sizeof(LDKCResult_ShutdownScriptInvalidShutdownScriptZ), "LDKCResult_ShutdownScriptInvalidShutdownScriptZ");
26959         *ret_conv = CResult_ShutdownScriptInvalidShutdownScriptZ_err(e_conv);
26960         return tag_ptr(ret_conv, true);
26961 }
26962
26963 jboolean  __attribute__((export_name("TS_CResult_ShutdownScriptInvalidShutdownScriptZ_is_ok"))) TS_CResult_ShutdownScriptInvalidShutdownScriptZ_is_ok(uint64_t o) {
26964         LDKCResult_ShutdownScriptInvalidShutdownScriptZ* o_conv = (LDKCResult_ShutdownScriptInvalidShutdownScriptZ*)untag_ptr(o);
26965         jboolean ret_conv = CResult_ShutdownScriptInvalidShutdownScriptZ_is_ok(o_conv);
26966         return ret_conv;
26967 }
26968
26969 void  __attribute__((export_name("TS_CResult_ShutdownScriptInvalidShutdownScriptZ_free"))) TS_CResult_ShutdownScriptInvalidShutdownScriptZ_free(uint64_t _res) {
26970         if (!ptr_is_owned(_res)) return;
26971         void* _res_ptr = untag_ptr(_res);
26972         CHECK_ACCESS(_res_ptr);
26973         LDKCResult_ShutdownScriptInvalidShutdownScriptZ _res_conv = *(LDKCResult_ShutdownScriptInvalidShutdownScriptZ*)(_res_ptr);
26974         FREE(untag_ptr(_res));
26975         CResult_ShutdownScriptInvalidShutdownScriptZ_free(_res_conv);
26976 }
26977
26978 static inline uint64_t CResult_ShutdownScriptInvalidShutdownScriptZ_clone_ptr(LDKCResult_ShutdownScriptInvalidShutdownScriptZ *NONNULL_PTR arg) {
26979         LDKCResult_ShutdownScriptInvalidShutdownScriptZ* ret_conv = MALLOC(sizeof(LDKCResult_ShutdownScriptInvalidShutdownScriptZ), "LDKCResult_ShutdownScriptInvalidShutdownScriptZ");
26980         *ret_conv = CResult_ShutdownScriptInvalidShutdownScriptZ_clone(arg);
26981         return tag_ptr(ret_conv, true);
26982 }
26983 int64_t  __attribute__((export_name("TS_CResult_ShutdownScriptInvalidShutdownScriptZ_clone_ptr"))) TS_CResult_ShutdownScriptInvalidShutdownScriptZ_clone_ptr(uint64_t arg) {
26984         LDKCResult_ShutdownScriptInvalidShutdownScriptZ* arg_conv = (LDKCResult_ShutdownScriptInvalidShutdownScriptZ*)untag_ptr(arg);
26985         int64_t ret_conv = CResult_ShutdownScriptInvalidShutdownScriptZ_clone_ptr(arg_conv);
26986         return ret_conv;
26987 }
26988
26989 uint64_t  __attribute__((export_name("TS_CResult_ShutdownScriptInvalidShutdownScriptZ_clone"))) TS_CResult_ShutdownScriptInvalidShutdownScriptZ_clone(uint64_t orig) {
26990         LDKCResult_ShutdownScriptInvalidShutdownScriptZ* orig_conv = (LDKCResult_ShutdownScriptInvalidShutdownScriptZ*)untag_ptr(orig);
26991         LDKCResult_ShutdownScriptInvalidShutdownScriptZ* ret_conv = MALLOC(sizeof(LDKCResult_ShutdownScriptInvalidShutdownScriptZ), "LDKCResult_ShutdownScriptInvalidShutdownScriptZ");
26992         *ret_conv = CResult_ShutdownScriptInvalidShutdownScriptZ_clone(orig_conv);
26993         return tag_ptr(ret_conv, true);
26994 }
26995
26996 uint64_t  __attribute__((export_name("TS_CResult_PaymentPurposeDecodeErrorZ_ok"))) TS_CResult_PaymentPurposeDecodeErrorZ_ok(uint64_t o) {
26997         void* o_ptr = untag_ptr(o);
26998         CHECK_ACCESS(o_ptr);
26999         LDKPaymentPurpose o_conv = *(LDKPaymentPurpose*)(o_ptr);
27000         o_conv = PaymentPurpose_clone((LDKPaymentPurpose*)untag_ptr(o));
27001         LDKCResult_PaymentPurposeDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PaymentPurposeDecodeErrorZ), "LDKCResult_PaymentPurposeDecodeErrorZ");
27002         *ret_conv = CResult_PaymentPurposeDecodeErrorZ_ok(o_conv);
27003         return tag_ptr(ret_conv, true);
27004 }
27005
27006 uint64_t  __attribute__((export_name("TS_CResult_PaymentPurposeDecodeErrorZ_err"))) TS_CResult_PaymentPurposeDecodeErrorZ_err(uint64_t e) {
27007         void* e_ptr = untag_ptr(e);
27008         CHECK_ACCESS(e_ptr);
27009         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
27010         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
27011         LDKCResult_PaymentPurposeDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PaymentPurposeDecodeErrorZ), "LDKCResult_PaymentPurposeDecodeErrorZ");
27012         *ret_conv = CResult_PaymentPurposeDecodeErrorZ_err(e_conv);
27013         return tag_ptr(ret_conv, true);
27014 }
27015
27016 jboolean  __attribute__((export_name("TS_CResult_PaymentPurposeDecodeErrorZ_is_ok"))) TS_CResult_PaymentPurposeDecodeErrorZ_is_ok(uint64_t o) {
27017         LDKCResult_PaymentPurposeDecodeErrorZ* o_conv = (LDKCResult_PaymentPurposeDecodeErrorZ*)untag_ptr(o);
27018         jboolean ret_conv = CResult_PaymentPurposeDecodeErrorZ_is_ok(o_conv);
27019         return ret_conv;
27020 }
27021
27022 void  __attribute__((export_name("TS_CResult_PaymentPurposeDecodeErrorZ_free"))) TS_CResult_PaymentPurposeDecodeErrorZ_free(uint64_t _res) {
27023         if (!ptr_is_owned(_res)) return;
27024         void* _res_ptr = untag_ptr(_res);
27025         CHECK_ACCESS(_res_ptr);
27026         LDKCResult_PaymentPurposeDecodeErrorZ _res_conv = *(LDKCResult_PaymentPurposeDecodeErrorZ*)(_res_ptr);
27027         FREE(untag_ptr(_res));
27028         CResult_PaymentPurposeDecodeErrorZ_free(_res_conv);
27029 }
27030
27031 static inline uint64_t CResult_PaymentPurposeDecodeErrorZ_clone_ptr(LDKCResult_PaymentPurposeDecodeErrorZ *NONNULL_PTR arg) {
27032         LDKCResult_PaymentPurposeDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PaymentPurposeDecodeErrorZ), "LDKCResult_PaymentPurposeDecodeErrorZ");
27033         *ret_conv = CResult_PaymentPurposeDecodeErrorZ_clone(arg);
27034         return tag_ptr(ret_conv, true);
27035 }
27036 int64_t  __attribute__((export_name("TS_CResult_PaymentPurposeDecodeErrorZ_clone_ptr"))) TS_CResult_PaymentPurposeDecodeErrorZ_clone_ptr(uint64_t arg) {
27037         LDKCResult_PaymentPurposeDecodeErrorZ* arg_conv = (LDKCResult_PaymentPurposeDecodeErrorZ*)untag_ptr(arg);
27038         int64_t ret_conv = CResult_PaymentPurposeDecodeErrorZ_clone_ptr(arg_conv);
27039         return ret_conv;
27040 }
27041
27042 uint64_t  __attribute__((export_name("TS_CResult_PaymentPurposeDecodeErrorZ_clone"))) TS_CResult_PaymentPurposeDecodeErrorZ_clone(uint64_t orig) {
27043         LDKCResult_PaymentPurposeDecodeErrorZ* orig_conv = (LDKCResult_PaymentPurposeDecodeErrorZ*)untag_ptr(orig);
27044         LDKCResult_PaymentPurposeDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PaymentPurposeDecodeErrorZ), "LDKCResult_PaymentPurposeDecodeErrorZ");
27045         *ret_conv = CResult_PaymentPurposeDecodeErrorZ_clone(orig_conv);
27046         return tag_ptr(ret_conv, true);
27047 }
27048
27049 uint64_t  __attribute__((export_name("TS_CResult_ClaimedHTLCDecodeErrorZ_ok"))) TS_CResult_ClaimedHTLCDecodeErrorZ_ok(uint64_t o) {
27050         LDKClaimedHTLC o_conv;
27051         o_conv.inner = untag_ptr(o);
27052         o_conv.is_owned = ptr_is_owned(o);
27053         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
27054         o_conv = ClaimedHTLC_clone(&o_conv);
27055         LDKCResult_ClaimedHTLCDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ClaimedHTLCDecodeErrorZ), "LDKCResult_ClaimedHTLCDecodeErrorZ");
27056         *ret_conv = CResult_ClaimedHTLCDecodeErrorZ_ok(o_conv);
27057         return tag_ptr(ret_conv, true);
27058 }
27059
27060 uint64_t  __attribute__((export_name("TS_CResult_ClaimedHTLCDecodeErrorZ_err"))) TS_CResult_ClaimedHTLCDecodeErrorZ_err(uint64_t e) {
27061         void* e_ptr = untag_ptr(e);
27062         CHECK_ACCESS(e_ptr);
27063         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
27064         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
27065         LDKCResult_ClaimedHTLCDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ClaimedHTLCDecodeErrorZ), "LDKCResult_ClaimedHTLCDecodeErrorZ");
27066         *ret_conv = CResult_ClaimedHTLCDecodeErrorZ_err(e_conv);
27067         return tag_ptr(ret_conv, true);
27068 }
27069
27070 jboolean  __attribute__((export_name("TS_CResult_ClaimedHTLCDecodeErrorZ_is_ok"))) TS_CResult_ClaimedHTLCDecodeErrorZ_is_ok(uint64_t o) {
27071         LDKCResult_ClaimedHTLCDecodeErrorZ* o_conv = (LDKCResult_ClaimedHTLCDecodeErrorZ*)untag_ptr(o);
27072         jboolean ret_conv = CResult_ClaimedHTLCDecodeErrorZ_is_ok(o_conv);
27073         return ret_conv;
27074 }
27075
27076 void  __attribute__((export_name("TS_CResult_ClaimedHTLCDecodeErrorZ_free"))) TS_CResult_ClaimedHTLCDecodeErrorZ_free(uint64_t _res) {
27077         if (!ptr_is_owned(_res)) return;
27078         void* _res_ptr = untag_ptr(_res);
27079         CHECK_ACCESS(_res_ptr);
27080         LDKCResult_ClaimedHTLCDecodeErrorZ _res_conv = *(LDKCResult_ClaimedHTLCDecodeErrorZ*)(_res_ptr);
27081         FREE(untag_ptr(_res));
27082         CResult_ClaimedHTLCDecodeErrorZ_free(_res_conv);
27083 }
27084
27085 static inline uint64_t CResult_ClaimedHTLCDecodeErrorZ_clone_ptr(LDKCResult_ClaimedHTLCDecodeErrorZ *NONNULL_PTR arg) {
27086         LDKCResult_ClaimedHTLCDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ClaimedHTLCDecodeErrorZ), "LDKCResult_ClaimedHTLCDecodeErrorZ");
27087         *ret_conv = CResult_ClaimedHTLCDecodeErrorZ_clone(arg);
27088         return tag_ptr(ret_conv, true);
27089 }
27090 int64_t  __attribute__((export_name("TS_CResult_ClaimedHTLCDecodeErrorZ_clone_ptr"))) TS_CResult_ClaimedHTLCDecodeErrorZ_clone_ptr(uint64_t arg) {
27091         LDKCResult_ClaimedHTLCDecodeErrorZ* arg_conv = (LDKCResult_ClaimedHTLCDecodeErrorZ*)untag_ptr(arg);
27092         int64_t ret_conv = CResult_ClaimedHTLCDecodeErrorZ_clone_ptr(arg_conv);
27093         return ret_conv;
27094 }
27095
27096 uint64_t  __attribute__((export_name("TS_CResult_ClaimedHTLCDecodeErrorZ_clone"))) TS_CResult_ClaimedHTLCDecodeErrorZ_clone(uint64_t orig) {
27097         LDKCResult_ClaimedHTLCDecodeErrorZ* orig_conv = (LDKCResult_ClaimedHTLCDecodeErrorZ*)untag_ptr(orig);
27098         LDKCResult_ClaimedHTLCDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ClaimedHTLCDecodeErrorZ), "LDKCResult_ClaimedHTLCDecodeErrorZ");
27099         *ret_conv = CResult_ClaimedHTLCDecodeErrorZ_clone(orig_conv);
27100         return tag_ptr(ret_conv, true);
27101 }
27102
27103 uint64_t  __attribute__((export_name("TS_COption_PathFailureZ_some"))) TS_COption_PathFailureZ_some(uint64_t o) {
27104         void* o_ptr = untag_ptr(o);
27105         CHECK_ACCESS(o_ptr);
27106         LDKPathFailure o_conv = *(LDKPathFailure*)(o_ptr);
27107         o_conv = PathFailure_clone((LDKPathFailure*)untag_ptr(o));
27108         LDKCOption_PathFailureZ *ret_copy = MALLOC(sizeof(LDKCOption_PathFailureZ), "LDKCOption_PathFailureZ");
27109         *ret_copy = COption_PathFailureZ_some(o_conv);
27110         uint64_t ret_ref = tag_ptr(ret_copy, true);
27111         return ret_ref;
27112 }
27113
27114 uint64_t  __attribute__((export_name("TS_COption_PathFailureZ_none"))) TS_COption_PathFailureZ_none() {
27115         LDKCOption_PathFailureZ *ret_copy = MALLOC(sizeof(LDKCOption_PathFailureZ), "LDKCOption_PathFailureZ");
27116         *ret_copy = COption_PathFailureZ_none();
27117         uint64_t ret_ref = tag_ptr(ret_copy, true);
27118         return ret_ref;
27119 }
27120
27121 void  __attribute__((export_name("TS_COption_PathFailureZ_free"))) TS_COption_PathFailureZ_free(uint64_t _res) {
27122         if (!ptr_is_owned(_res)) return;
27123         void* _res_ptr = untag_ptr(_res);
27124         CHECK_ACCESS(_res_ptr);
27125         LDKCOption_PathFailureZ _res_conv = *(LDKCOption_PathFailureZ*)(_res_ptr);
27126         FREE(untag_ptr(_res));
27127         COption_PathFailureZ_free(_res_conv);
27128 }
27129
27130 static inline uint64_t COption_PathFailureZ_clone_ptr(LDKCOption_PathFailureZ *NONNULL_PTR arg) {
27131         LDKCOption_PathFailureZ *ret_copy = MALLOC(sizeof(LDKCOption_PathFailureZ), "LDKCOption_PathFailureZ");
27132         *ret_copy = COption_PathFailureZ_clone(arg);
27133         uint64_t ret_ref = tag_ptr(ret_copy, true);
27134         return ret_ref;
27135 }
27136 int64_t  __attribute__((export_name("TS_COption_PathFailureZ_clone_ptr"))) TS_COption_PathFailureZ_clone_ptr(uint64_t arg) {
27137         LDKCOption_PathFailureZ* arg_conv = (LDKCOption_PathFailureZ*)untag_ptr(arg);
27138         int64_t ret_conv = COption_PathFailureZ_clone_ptr(arg_conv);
27139         return ret_conv;
27140 }
27141
27142 uint64_t  __attribute__((export_name("TS_COption_PathFailureZ_clone"))) TS_COption_PathFailureZ_clone(uint64_t orig) {
27143         LDKCOption_PathFailureZ* orig_conv = (LDKCOption_PathFailureZ*)untag_ptr(orig);
27144         LDKCOption_PathFailureZ *ret_copy = MALLOC(sizeof(LDKCOption_PathFailureZ), "LDKCOption_PathFailureZ");
27145         *ret_copy = COption_PathFailureZ_clone(orig_conv);
27146         uint64_t ret_ref = tag_ptr(ret_copy, true);
27147         return ret_ref;
27148 }
27149
27150 uint64_t  __attribute__((export_name("TS_CResult_COption_PathFailureZDecodeErrorZ_ok"))) TS_CResult_COption_PathFailureZDecodeErrorZ_ok(uint64_t o) {
27151         void* o_ptr = untag_ptr(o);
27152         CHECK_ACCESS(o_ptr);
27153         LDKCOption_PathFailureZ o_conv = *(LDKCOption_PathFailureZ*)(o_ptr);
27154         o_conv = COption_PathFailureZ_clone((LDKCOption_PathFailureZ*)untag_ptr(o));
27155         LDKCResult_COption_PathFailureZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_COption_PathFailureZDecodeErrorZ), "LDKCResult_COption_PathFailureZDecodeErrorZ");
27156         *ret_conv = CResult_COption_PathFailureZDecodeErrorZ_ok(o_conv);
27157         return tag_ptr(ret_conv, true);
27158 }
27159
27160 uint64_t  __attribute__((export_name("TS_CResult_COption_PathFailureZDecodeErrorZ_err"))) TS_CResult_COption_PathFailureZDecodeErrorZ_err(uint64_t e) {
27161         void* e_ptr = untag_ptr(e);
27162         CHECK_ACCESS(e_ptr);
27163         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
27164         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
27165         LDKCResult_COption_PathFailureZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_COption_PathFailureZDecodeErrorZ), "LDKCResult_COption_PathFailureZDecodeErrorZ");
27166         *ret_conv = CResult_COption_PathFailureZDecodeErrorZ_err(e_conv);
27167         return tag_ptr(ret_conv, true);
27168 }
27169
27170 jboolean  __attribute__((export_name("TS_CResult_COption_PathFailureZDecodeErrorZ_is_ok"))) TS_CResult_COption_PathFailureZDecodeErrorZ_is_ok(uint64_t o) {
27171         LDKCResult_COption_PathFailureZDecodeErrorZ* o_conv = (LDKCResult_COption_PathFailureZDecodeErrorZ*)untag_ptr(o);
27172         jboolean ret_conv = CResult_COption_PathFailureZDecodeErrorZ_is_ok(o_conv);
27173         return ret_conv;
27174 }
27175
27176 void  __attribute__((export_name("TS_CResult_COption_PathFailureZDecodeErrorZ_free"))) TS_CResult_COption_PathFailureZDecodeErrorZ_free(uint64_t _res) {
27177         if (!ptr_is_owned(_res)) return;
27178         void* _res_ptr = untag_ptr(_res);
27179         CHECK_ACCESS(_res_ptr);
27180         LDKCResult_COption_PathFailureZDecodeErrorZ _res_conv = *(LDKCResult_COption_PathFailureZDecodeErrorZ*)(_res_ptr);
27181         FREE(untag_ptr(_res));
27182         CResult_COption_PathFailureZDecodeErrorZ_free(_res_conv);
27183 }
27184
27185 static inline uint64_t CResult_COption_PathFailureZDecodeErrorZ_clone_ptr(LDKCResult_COption_PathFailureZDecodeErrorZ *NONNULL_PTR arg) {
27186         LDKCResult_COption_PathFailureZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_COption_PathFailureZDecodeErrorZ), "LDKCResult_COption_PathFailureZDecodeErrorZ");
27187         *ret_conv = CResult_COption_PathFailureZDecodeErrorZ_clone(arg);
27188         return tag_ptr(ret_conv, true);
27189 }
27190 int64_t  __attribute__((export_name("TS_CResult_COption_PathFailureZDecodeErrorZ_clone_ptr"))) TS_CResult_COption_PathFailureZDecodeErrorZ_clone_ptr(uint64_t arg) {
27191         LDKCResult_COption_PathFailureZDecodeErrorZ* arg_conv = (LDKCResult_COption_PathFailureZDecodeErrorZ*)untag_ptr(arg);
27192         int64_t ret_conv = CResult_COption_PathFailureZDecodeErrorZ_clone_ptr(arg_conv);
27193         return ret_conv;
27194 }
27195
27196 uint64_t  __attribute__((export_name("TS_CResult_COption_PathFailureZDecodeErrorZ_clone"))) TS_CResult_COption_PathFailureZDecodeErrorZ_clone(uint64_t orig) {
27197         LDKCResult_COption_PathFailureZDecodeErrorZ* orig_conv = (LDKCResult_COption_PathFailureZDecodeErrorZ*)untag_ptr(orig);
27198         LDKCResult_COption_PathFailureZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_COption_PathFailureZDecodeErrorZ), "LDKCResult_COption_PathFailureZDecodeErrorZ");
27199         *ret_conv = CResult_COption_PathFailureZDecodeErrorZ_clone(orig_conv);
27200         return tag_ptr(ret_conv, true);
27201 }
27202
27203 uint64_t  __attribute__((export_name("TS_COption_ClosureReasonZ_some"))) TS_COption_ClosureReasonZ_some(uint64_t o) {
27204         void* o_ptr = untag_ptr(o);
27205         CHECK_ACCESS(o_ptr);
27206         LDKClosureReason o_conv = *(LDKClosureReason*)(o_ptr);
27207         o_conv = ClosureReason_clone((LDKClosureReason*)untag_ptr(o));
27208         LDKCOption_ClosureReasonZ *ret_copy = MALLOC(sizeof(LDKCOption_ClosureReasonZ), "LDKCOption_ClosureReasonZ");
27209         *ret_copy = COption_ClosureReasonZ_some(o_conv);
27210         uint64_t ret_ref = tag_ptr(ret_copy, true);
27211         return ret_ref;
27212 }
27213
27214 uint64_t  __attribute__((export_name("TS_COption_ClosureReasonZ_none"))) TS_COption_ClosureReasonZ_none() {
27215         LDKCOption_ClosureReasonZ *ret_copy = MALLOC(sizeof(LDKCOption_ClosureReasonZ), "LDKCOption_ClosureReasonZ");
27216         *ret_copy = COption_ClosureReasonZ_none();
27217         uint64_t ret_ref = tag_ptr(ret_copy, true);
27218         return ret_ref;
27219 }
27220
27221 void  __attribute__((export_name("TS_COption_ClosureReasonZ_free"))) TS_COption_ClosureReasonZ_free(uint64_t _res) {
27222         if (!ptr_is_owned(_res)) return;
27223         void* _res_ptr = untag_ptr(_res);
27224         CHECK_ACCESS(_res_ptr);
27225         LDKCOption_ClosureReasonZ _res_conv = *(LDKCOption_ClosureReasonZ*)(_res_ptr);
27226         FREE(untag_ptr(_res));
27227         COption_ClosureReasonZ_free(_res_conv);
27228 }
27229
27230 static inline uint64_t COption_ClosureReasonZ_clone_ptr(LDKCOption_ClosureReasonZ *NONNULL_PTR arg) {
27231         LDKCOption_ClosureReasonZ *ret_copy = MALLOC(sizeof(LDKCOption_ClosureReasonZ), "LDKCOption_ClosureReasonZ");
27232         *ret_copy = COption_ClosureReasonZ_clone(arg);
27233         uint64_t ret_ref = tag_ptr(ret_copy, true);
27234         return ret_ref;
27235 }
27236 int64_t  __attribute__((export_name("TS_COption_ClosureReasonZ_clone_ptr"))) TS_COption_ClosureReasonZ_clone_ptr(uint64_t arg) {
27237         LDKCOption_ClosureReasonZ* arg_conv = (LDKCOption_ClosureReasonZ*)untag_ptr(arg);
27238         int64_t ret_conv = COption_ClosureReasonZ_clone_ptr(arg_conv);
27239         return ret_conv;
27240 }
27241
27242 uint64_t  __attribute__((export_name("TS_COption_ClosureReasonZ_clone"))) TS_COption_ClosureReasonZ_clone(uint64_t orig) {
27243         LDKCOption_ClosureReasonZ* orig_conv = (LDKCOption_ClosureReasonZ*)untag_ptr(orig);
27244         LDKCOption_ClosureReasonZ *ret_copy = MALLOC(sizeof(LDKCOption_ClosureReasonZ), "LDKCOption_ClosureReasonZ");
27245         *ret_copy = COption_ClosureReasonZ_clone(orig_conv);
27246         uint64_t ret_ref = tag_ptr(ret_copy, true);
27247         return ret_ref;
27248 }
27249
27250 uint64_t  __attribute__((export_name("TS_CResult_COption_ClosureReasonZDecodeErrorZ_ok"))) TS_CResult_COption_ClosureReasonZDecodeErrorZ_ok(uint64_t o) {
27251         void* o_ptr = untag_ptr(o);
27252         CHECK_ACCESS(o_ptr);
27253         LDKCOption_ClosureReasonZ o_conv = *(LDKCOption_ClosureReasonZ*)(o_ptr);
27254         o_conv = COption_ClosureReasonZ_clone((LDKCOption_ClosureReasonZ*)untag_ptr(o));
27255         LDKCResult_COption_ClosureReasonZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_COption_ClosureReasonZDecodeErrorZ), "LDKCResult_COption_ClosureReasonZDecodeErrorZ");
27256         *ret_conv = CResult_COption_ClosureReasonZDecodeErrorZ_ok(o_conv);
27257         return tag_ptr(ret_conv, true);
27258 }
27259
27260 uint64_t  __attribute__((export_name("TS_CResult_COption_ClosureReasonZDecodeErrorZ_err"))) TS_CResult_COption_ClosureReasonZDecodeErrorZ_err(uint64_t e) {
27261         void* e_ptr = untag_ptr(e);
27262         CHECK_ACCESS(e_ptr);
27263         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
27264         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
27265         LDKCResult_COption_ClosureReasonZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_COption_ClosureReasonZDecodeErrorZ), "LDKCResult_COption_ClosureReasonZDecodeErrorZ");
27266         *ret_conv = CResult_COption_ClosureReasonZDecodeErrorZ_err(e_conv);
27267         return tag_ptr(ret_conv, true);
27268 }
27269
27270 jboolean  __attribute__((export_name("TS_CResult_COption_ClosureReasonZDecodeErrorZ_is_ok"))) TS_CResult_COption_ClosureReasonZDecodeErrorZ_is_ok(uint64_t o) {
27271         LDKCResult_COption_ClosureReasonZDecodeErrorZ* o_conv = (LDKCResult_COption_ClosureReasonZDecodeErrorZ*)untag_ptr(o);
27272         jboolean ret_conv = CResult_COption_ClosureReasonZDecodeErrorZ_is_ok(o_conv);
27273         return ret_conv;
27274 }
27275
27276 void  __attribute__((export_name("TS_CResult_COption_ClosureReasonZDecodeErrorZ_free"))) TS_CResult_COption_ClosureReasonZDecodeErrorZ_free(uint64_t _res) {
27277         if (!ptr_is_owned(_res)) return;
27278         void* _res_ptr = untag_ptr(_res);
27279         CHECK_ACCESS(_res_ptr);
27280         LDKCResult_COption_ClosureReasonZDecodeErrorZ _res_conv = *(LDKCResult_COption_ClosureReasonZDecodeErrorZ*)(_res_ptr);
27281         FREE(untag_ptr(_res));
27282         CResult_COption_ClosureReasonZDecodeErrorZ_free(_res_conv);
27283 }
27284
27285 static inline uint64_t CResult_COption_ClosureReasonZDecodeErrorZ_clone_ptr(LDKCResult_COption_ClosureReasonZDecodeErrorZ *NONNULL_PTR arg) {
27286         LDKCResult_COption_ClosureReasonZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_COption_ClosureReasonZDecodeErrorZ), "LDKCResult_COption_ClosureReasonZDecodeErrorZ");
27287         *ret_conv = CResult_COption_ClosureReasonZDecodeErrorZ_clone(arg);
27288         return tag_ptr(ret_conv, true);
27289 }
27290 int64_t  __attribute__((export_name("TS_CResult_COption_ClosureReasonZDecodeErrorZ_clone_ptr"))) TS_CResult_COption_ClosureReasonZDecodeErrorZ_clone_ptr(uint64_t arg) {
27291         LDKCResult_COption_ClosureReasonZDecodeErrorZ* arg_conv = (LDKCResult_COption_ClosureReasonZDecodeErrorZ*)untag_ptr(arg);
27292         int64_t ret_conv = CResult_COption_ClosureReasonZDecodeErrorZ_clone_ptr(arg_conv);
27293         return ret_conv;
27294 }
27295
27296 uint64_t  __attribute__((export_name("TS_CResult_COption_ClosureReasonZDecodeErrorZ_clone"))) TS_CResult_COption_ClosureReasonZDecodeErrorZ_clone(uint64_t orig) {
27297         LDKCResult_COption_ClosureReasonZDecodeErrorZ* orig_conv = (LDKCResult_COption_ClosureReasonZDecodeErrorZ*)untag_ptr(orig);
27298         LDKCResult_COption_ClosureReasonZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_COption_ClosureReasonZDecodeErrorZ), "LDKCResult_COption_ClosureReasonZDecodeErrorZ");
27299         *ret_conv = CResult_COption_ClosureReasonZDecodeErrorZ_clone(orig_conv);
27300         return tag_ptr(ret_conv, true);
27301 }
27302
27303 uint64_t  __attribute__((export_name("TS_COption_HTLCDestinationZ_some"))) TS_COption_HTLCDestinationZ_some(uint64_t o) {
27304         void* o_ptr = untag_ptr(o);
27305         CHECK_ACCESS(o_ptr);
27306         LDKHTLCDestination o_conv = *(LDKHTLCDestination*)(o_ptr);
27307         o_conv = HTLCDestination_clone((LDKHTLCDestination*)untag_ptr(o));
27308         LDKCOption_HTLCDestinationZ *ret_copy = MALLOC(sizeof(LDKCOption_HTLCDestinationZ), "LDKCOption_HTLCDestinationZ");
27309         *ret_copy = COption_HTLCDestinationZ_some(o_conv);
27310         uint64_t ret_ref = tag_ptr(ret_copy, true);
27311         return ret_ref;
27312 }
27313
27314 uint64_t  __attribute__((export_name("TS_COption_HTLCDestinationZ_none"))) TS_COption_HTLCDestinationZ_none() {
27315         LDKCOption_HTLCDestinationZ *ret_copy = MALLOC(sizeof(LDKCOption_HTLCDestinationZ), "LDKCOption_HTLCDestinationZ");
27316         *ret_copy = COption_HTLCDestinationZ_none();
27317         uint64_t ret_ref = tag_ptr(ret_copy, true);
27318         return ret_ref;
27319 }
27320
27321 void  __attribute__((export_name("TS_COption_HTLCDestinationZ_free"))) TS_COption_HTLCDestinationZ_free(uint64_t _res) {
27322         if (!ptr_is_owned(_res)) return;
27323         void* _res_ptr = untag_ptr(_res);
27324         CHECK_ACCESS(_res_ptr);
27325         LDKCOption_HTLCDestinationZ _res_conv = *(LDKCOption_HTLCDestinationZ*)(_res_ptr);
27326         FREE(untag_ptr(_res));
27327         COption_HTLCDestinationZ_free(_res_conv);
27328 }
27329
27330 static inline uint64_t COption_HTLCDestinationZ_clone_ptr(LDKCOption_HTLCDestinationZ *NONNULL_PTR arg) {
27331         LDKCOption_HTLCDestinationZ *ret_copy = MALLOC(sizeof(LDKCOption_HTLCDestinationZ), "LDKCOption_HTLCDestinationZ");
27332         *ret_copy = COption_HTLCDestinationZ_clone(arg);
27333         uint64_t ret_ref = tag_ptr(ret_copy, true);
27334         return ret_ref;
27335 }
27336 int64_t  __attribute__((export_name("TS_COption_HTLCDestinationZ_clone_ptr"))) TS_COption_HTLCDestinationZ_clone_ptr(uint64_t arg) {
27337         LDKCOption_HTLCDestinationZ* arg_conv = (LDKCOption_HTLCDestinationZ*)untag_ptr(arg);
27338         int64_t ret_conv = COption_HTLCDestinationZ_clone_ptr(arg_conv);
27339         return ret_conv;
27340 }
27341
27342 uint64_t  __attribute__((export_name("TS_COption_HTLCDestinationZ_clone"))) TS_COption_HTLCDestinationZ_clone(uint64_t orig) {
27343         LDKCOption_HTLCDestinationZ* orig_conv = (LDKCOption_HTLCDestinationZ*)untag_ptr(orig);
27344         LDKCOption_HTLCDestinationZ *ret_copy = MALLOC(sizeof(LDKCOption_HTLCDestinationZ), "LDKCOption_HTLCDestinationZ");
27345         *ret_copy = COption_HTLCDestinationZ_clone(orig_conv);
27346         uint64_t ret_ref = tag_ptr(ret_copy, true);
27347         return ret_ref;
27348 }
27349
27350 uint64_t  __attribute__((export_name("TS_CResult_COption_HTLCDestinationZDecodeErrorZ_ok"))) TS_CResult_COption_HTLCDestinationZDecodeErrorZ_ok(uint64_t o) {
27351         void* o_ptr = untag_ptr(o);
27352         CHECK_ACCESS(o_ptr);
27353         LDKCOption_HTLCDestinationZ o_conv = *(LDKCOption_HTLCDestinationZ*)(o_ptr);
27354         o_conv = COption_HTLCDestinationZ_clone((LDKCOption_HTLCDestinationZ*)untag_ptr(o));
27355         LDKCResult_COption_HTLCDestinationZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_COption_HTLCDestinationZDecodeErrorZ), "LDKCResult_COption_HTLCDestinationZDecodeErrorZ");
27356         *ret_conv = CResult_COption_HTLCDestinationZDecodeErrorZ_ok(o_conv);
27357         return tag_ptr(ret_conv, true);
27358 }
27359
27360 uint64_t  __attribute__((export_name("TS_CResult_COption_HTLCDestinationZDecodeErrorZ_err"))) TS_CResult_COption_HTLCDestinationZDecodeErrorZ_err(uint64_t e) {
27361         void* e_ptr = untag_ptr(e);
27362         CHECK_ACCESS(e_ptr);
27363         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
27364         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
27365         LDKCResult_COption_HTLCDestinationZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_COption_HTLCDestinationZDecodeErrorZ), "LDKCResult_COption_HTLCDestinationZDecodeErrorZ");
27366         *ret_conv = CResult_COption_HTLCDestinationZDecodeErrorZ_err(e_conv);
27367         return tag_ptr(ret_conv, true);
27368 }
27369
27370 jboolean  __attribute__((export_name("TS_CResult_COption_HTLCDestinationZDecodeErrorZ_is_ok"))) TS_CResult_COption_HTLCDestinationZDecodeErrorZ_is_ok(uint64_t o) {
27371         LDKCResult_COption_HTLCDestinationZDecodeErrorZ* o_conv = (LDKCResult_COption_HTLCDestinationZDecodeErrorZ*)untag_ptr(o);
27372         jboolean ret_conv = CResult_COption_HTLCDestinationZDecodeErrorZ_is_ok(o_conv);
27373         return ret_conv;
27374 }
27375
27376 void  __attribute__((export_name("TS_CResult_COption_HTLCDestinationZDecodeErrorZ_free"))) TS_CResult_COption_HTLCDestinationZDecodeErrorZ_free(uint64_t _res) {
27377         if (!ptr_is_owned(_res)) return;
27378         void* _res_ptr = untag_ptr(_res);
27379         CHECK_ACCESS(_res_ptr);
27380         LDKCResult_COption_HTLCDestinationZDecodeErrorZ _res_conv = *(LDKCResult_COption_HTLCDestinationZDecodeErrorZ*)(_res_ptr);
27381         FREE(untag_ptr(_res));
27382         CResult_COption_HTLCDestinationZDecodeErrorZ_free(_res_conv);
27383 }
27384
27385 static inline uint64_t CResult_COption_HTLCDestinationZDecodeErrorZ_clone_ptr(LDKCResult_COption_HTLCDestinationZDecodeErrorZ *NONNULL_PTR arg) {
27386         LDKCResult_COption_HTLCDestinationZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_COption_HTLCDestinationZDecodeErrorZ), "LDKCResult_COption_HTLCDestinationZDecodeErrorZ");
27387         *ret_conv = CResult_COption_HTLCDestinationZDecodeErrorZ_clone(arg);
27388         return tag_ptr(ret_conv, true);
27389 }
27390 int64_t  __attribute__((export_name("TS_CResult_COption_HTLCDestinationZDecodeErrorZ_clone_ptr"))) TS_CResult_COption_HTLCDestinationZDecodeErrorZ_clone_ptr(uint64_t arg) {
27391         LDKCResult_COption_HTLCDestinationZDecodeErrorZ* arg_conv = (LDKCResult_COption_HTLCDestinationZDecodeErrorZ*)untag_ptr(arg);
27392         int64_t ret_conv = CResult_COption_HTLCDestinationZDecodeErrorZ_clone_ptr(arg_conv);
27393         return ret_conv;
27394 }
27395
27396 uint64_t  __attribute__((export_name("TS_CResult_COption_HTLCDestinationZDecodeErrorZ_clone"))) TS_CResult_COption_HTLCDestinationZDecodeErrorZ_clone(uint64_t orig) {
27397         LDKCResult_COption_HTLCDestinationZDecodeErrorZ* orig_conv = (LDKCResult_COption_HTLCDestinationZDecodeErrorZ*)untag_ptr(orig);
27398         LDKCResult_COption_HTLCDestinationZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_COption_HTLCDestinationZDecodeErrorZ), "LDKCResult_COption_HTLCDestinationZDecodeErrorZ");
27399         *ret_conv = CResult_COption_HTLCDestinationZDecodeErrorZ_clone(orig_conv);
27400         return tag_ptr(ret_conv, true);
27401 }
27402
27403 uint64_t  __attribute__((export_name("TS_CResult_PaymentFailureReasonDecodeErrorZ_ok"))) TS_CResult_PaymentFailureReasonDecodeErrorZ_ok(uint32_t o) {
27404         LDKPaymentFailureReason o_conv = LDKPaymentFailureReason_from_js(o);
27405         LDKCResult_PaymentFailureReasonDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PaymentFailureReasonDecodeErrorZ), "LDKCResult_PaymentFailureReasonDecodeErrorZ");
27406         *ret_conv = CResult_PaymentFailureReasonDecodeErrorZ_ok(o_conv);
27407         return tag_ptr(ret_conv, true);
27408 }
27409
27410 uint64_t  __attribute__((export_name("TS_CResult_PaymentFailureReasonDecodeErrorZ_err"))) TS_CResult_PaymentFailureReasonDecodeErrorZ_err(uint64_t e) {
27411         void* e_ptr = untag_ptr(e);
27412         CHECK_ACCESS(e_ptr);
27413         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
27414         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
27415         LDKCResult_PaymentFailureReasonDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PaymentFailureReasonDecodeErrorZ), "LDKCResult_PaymentFailureReasonDecodeErrorZ");
27416         *ret_conv = CResult_PaymentFailureReasonDecodeErrorZ_err(e_conv);
27417         return tag_ptr(ret_conv, true);
27418 }
27419
27420 jboolean  __attribute__((export_name("TS_CResult_PaymentFailureReasonDecodeErrorZ_is_ok"))) TS_CResult_PaymentFailureReasonDecodeErrorZ_is_ok(uint64_t o) {
27421         LDKCResult_PaymentFailureReasonDecodeErrorZ* o_conv = (LDKCResult_PaymentFailureReasonDecodeErrorZ*)untag_ptr(o);
27422         jboolean ret_conv = CResult_PaymentFailureReasonDecodeErrorZ_is_ok(o_conv);
27423         return ret_conv;
27424 }
27425
27426 void  __attribute__((export_name("TS_CResult_PaymentFailureReasonDecodeErrorZ_free"))) TS_CResult_PaymentFailureReasonDecodeErrorZ_free(uint64_t _res) {
27427         if (!ptr_is_owned(_res)) return;
27428         void* _res_ptr = untag_ptr(_res);
27429         CHECK_ACCESS(_res_ptr);
27430         LDKCResult_PaymentFailureReasonDecodeErrorZ _res_conv = *(LDKCResult_PaymentFailureReasonDecodeErrorZ*)(_res_ptr);
27431         FREE(untag_ptr(_res));
27432         CResult_PaymentFailureReasonDecodeErrorZ_free(_res_conv);
27433 }
27434
27435 static inline uint64_t CResult_PaymentFailureReasonDecodeErrorZ_clone_ptr(LDKCResult_PaymentFailureReasonDecodeErrorZ *NONNULL_PTR arg) {
27436         LDKCResult_PaymentFailureReasonDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PaymentFailureReasonDecodeErrorZ), "LDKCResult_PaymentFailureReasonDecodeErrorZ");
27437         *ret_conv = CResult_PaymentFailureReasonDecodeErrorZ_clone(arg);
27438         return tag_ptr(ret_conv, true);
27439 }
27440 int64_t  __attribute__((export_name("TS_CResult_PaymentFailureReasonDecodeErrorZ_clone_ptr"))) TS_CResult_PaymentFailureReasonDecodeErrorZ_clone_ptr(uint64_t arg) {
27441         LDKCResult_PaymentFailureReasonDecodeErrorZ* arg_conv = (LDKCResult_PaymentFailureReasonDecodeErrorZ*)untag_ptr(arg);
27442         int64_t ret_conv = CResult_PaymentFailureReasonDecodeErrorZ_clone_ptr(arg_conv);
27443         return ret_conv;
27444 }
27445
27446 uint64_t  __attribute__((export_name("TS_CResult_PaymentFailureReasonDecodeErrorZ_clone"))) TS_CResult_PaymentFailureReasonDecodeErrorZ_clone(uint64_t orig) {
27447         LDKCResult_PaymentFailureReasonDecodeErrorZ* orig_conv = (LDKCResult_PaymentFailureReasonDecodeErrorZ*)untag_ptr(orig);
27448         LDKCResult_PaymentFailureReasonDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PaymentFailureReasonDecodeErrorZ), "LDKCResult_PaymentFailureReasonDecodeErrorZ");
27449         *ret_conv = CResult_PaymentFailureReasonDecodeErrorZ_clone(orig_conv);
27450         return tag_ptr(ret_conv, true);
27451 }
27452
27453 uint64_t  __attribute__((export_name("TS_COption_U128Z_some"))) TS_COption_U128Z_some(int8_tArray o) {
27454         LDKU128 o_ref;
27455         CHECK(o->arr_len == 16);
27456         memcpy(o_ref.le_bytes, o->elems, 16); FREE(o);
27457         LDKCOption_U128Z *ret_copy = MALLOC(sizeof(LDKCOption_U128Z), "LDKCOption_U128Z");
27458         *ret_copy = COption_U128Z_some(o_ref);
27459         uint64_t ret_ref = tag_ptr(ret_copy, true);
27460         return ret_ref;
27461 }
27462
27463 uint64_t  __attribute__((export_name("TS_COption_U128Z_none"))) TS_COption_U128Z_none() {
27464         LDKCOption_U128Z *ret_copy = MALLOC(sizeof(LDKCOption_U128Z), "LDKCOption_U128Z");
27465         *ret_copy = COption_U128Z_none();
27466         uint64_t ret_ref = tag_ptr(ret_copy, true);
27467         return ret_ref;
27468 }
27469
27470 void  __attribute__((export_name("TS_COption_U128Z_free"))) TS_COption_U128Z_free(uint64_t _res) {
27471         if (!ptr_is_owned(_res)) return;
27472         void* _res_ptr = untag_ptr(_res);
27473         CHECK_ACCESS(_res_ptr);
27474         LDKCOption_U128Z _res_conv = *(LDKCOption_U128Z*)(_res_ptr);
27475         FREE(untag_ptr(_res));
27476         COption_U128Z_free(_res_conv);
27477 }
27478
27479 static inline uint64_t COption_U128Z_clone_ptr(LDKCOption_U128Z *NONNULL_PTR arg) {
27480         LDKCOption_U128Z *ret_copy = MALLOC(sizeof(LDKCOption_U128Z), "LDKCOption_U128Z");
27481         *ret_copy = COption_U128Z_clone(arg);
27482         uint64_t ret_ref = tag_ptr(ret_copy, true);
27483         return ret_ref;
27484 }
27485 int64_t  __attribute__((export_name("TS_COption_U128Z_clone_ptr"))) TS_COption_U128Z_clone_ptr(uint64_t arg) {
27486         LDKCOption_U128Z* arg_conv = (LDKCOption_U128Z*)untag_ptr(arg);
27487         int64_t ret_conv = COption_U128Z_clone_ptr(arg_conv);
27488         return ret_conv;
27489 }
27490
27491 uint64_t  __attribute__((export_name("TS_COption_U128Z_clone"))) TS_COption_U128Z_clone(uint64_t orig) {
27492         LDKCOption_U128Z* orig_conv = (LDKCOption_U128Z*)untag_ptr(orig);
27493         LDKCOption_U128Z *ret_copy = MALLOC(sizeof(LDKCOption_U128Z), "LDKCOption_U128Z");
27494         *ret_copy = COption_U128Z_clone(orig_conv);
27495         uint64_t ret_ref = tag_ptr(ret_copy, true);
27496         return ret_ref;
27497 }
27498
27499 void  __attribute__((export_name("TS_CVec_ClaimedHTLCZ_free"))) TS_CVec_ClaimedHTLCZ_free(uint64_tArray _res) {
27500         LDKCVec_ClaimedHTLCZ _res_constr;
27501         _res_constr.datalen = _res->arr_len;
27502         if (_res_constr.datalen > 0)
27503                 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKClaimedHTLC), "LDKCVec_ClaimedHTLCZ Elements");
27504         else
27505                 _res_constr.data = NULL;
27506         uint64_t* _res_vals = _res->elems;
27507         for (size_t n = 0; n < _res_constr.datalen; n++) {
27508                 uint64_t _res_conv_13 = _res_vals[n];
27509                 LDKClaimedHTLC _res_conv_13_conv;
27510                 _res_conv_13_conv.inner = untag_ptr(_res_conv_13);
27511                 _res_conv_13_conv.is_owned = ptr_is_owned(_res_conv_13);
27512                 CHECK_INNER_FIELD_ACCESS_OR_NULL(_res_conv_13_conv);
27513                 _res_constr.data[n] = _res_conv_13_conv;
27514         }
27515         FREE(_res);
27516         CVec_ClaimedHTLCZ_free(_res_constr);
27517 }
27518
27519 uint64_t  __attribute__((export_name("TS_COption_PaymentFailureReasonZ_some"))) TS_COption_PaymentFailureReasonZ_some(uint32_t o) {
27520         LDKPaymentFailureReason o_conv = LDKPaymentFailureReason_from_js(o);
27521         LDKCOption_PaymentFailureReasonZ *ret_copy = MALLOC(sizeof(LDKCOption_PaymentFailureReasonZ), "LDKCOption_PaymentFailureReasonZ");
27522         *ret_copy = COption_PaymentFailureReasonZ_some(o_conv);
27523         uint64_t ret_ref = tag_ptr(ret_copy, true);
27524         return ret_ref;
27525 }
27526
27527 uint64_t  __attribute__((export_name("TS_COption_PaymentFailureReasonZ_none"))) TS_COption_PaymentFailureReasonZ_none() {
27528         LDKCOption_PaymentFailureReasonZ *ret_copy = MALLOC(sizeof(LDKCOption_PaymentFailureReasonZ), "LDKCOption_PaymentFailureReasonZ");
27529         *ret_copy = COption_PaymentFailureReasonZ_none();
27530         uint64_t ret_ref = tag_ptr(ret_copy, true);
27531         return ret_ref;
27532 }
27533
27534 void  __attribute__((export_name("TS_COption_PaymentFailureReasonZ_free"))) TS_COption_PaymentFailureReasonZ_free(uint64_t _res) {
27535         if (!ptr_is_owned(_res)) return;
27536         void* _res_ptr = untag_ptr(_res);
27537         CHECK_ACCESS(_res_ptr);
27538         LDKCOption_PaymentFailureReasonZ _res_conv = *(LDKCOption_PaymentFailureReasonZ*)(_res_ptr);
27539         FREE(untag_ptr(_res));
27540         COption_PaymentFailureReasonZ_free(_res_conv);
27541 }
27542
27543 static inline uint64_t COption_PaymentFailureReasonZ_clone_ptr(LDKCOption_PaymentFailureReasonZ *NONNULL_PTR arg) {
27544         LDKCOption_PaymentFailureReasonZ *ret_copy = MALLOC(sizeof(LDKCOption_PaymentFailureReasonZ), "LDKCOption_PaymentFailureReasonZ");
27545         *ret_copy = COption_PaymentFailureReasonZ_clone(arg);
27546         uint64_t ret_ref = tag_ptr(ret_copy, true);
27547         return ret_ref;
27548 }
27549 int64_t  __attribute__((export_name("TS_COption_PaymentFailureReasonZ_clone_ptr"))) TS_COption_PaymentFailureReasonZ_clone_ptr(uint64_t arg) {
27550         LDKCOption_PaymentFailureReasonZ* arg_conv = (LDKCOption_PaymentFailureReasonZ*)untag_ptr(arg);
27551         int64_t ret_conv = COption_PaymentFailureReasonZ_clone_ptr(arg_conv);
27552         return ret_conv;
27553 }
27554
27555 uint64_t  __attribute__((export_name("TS_COption_PaymentFailureReasonZ_clone"))) TS_COption_PaymentFailureReasonZ_clone(uint64_t orig) {
27556         LDKCOption_PaymentFailureReasonZ* orig_conv = (LDKCOption_PaymentFailureReasonZ*)untag_ptr(orig);
27557         LDKCOption_PaymentFailureReasonZ *ret_copy = MALLOC(sizeof(LDKCOption_PaymentFailureReasonZ), "LDKCOption_PaymentFailureReasonZ");
27558         *ret_copy = COption_PaymentFailureReasonZ_clone(orig_conv);
27559         uint64_t ret_ref = tag_ptr(ret_copy, true);
27560         return ret_ref;
27561 }
27562
27563 uint64_t  __attribute__((export_name("TS_COption_EventZ_some"))) TS_COption_EventZ_some(uint64_t o) {
27564         void* o_ptr = untag_ptr(o);
27565         CHECK_ACCESS(o_ptr);
27566         LDKEvent o_conv = *(LDKEvent*)(o_ptr);
27567         o_conv = Event_clone((LDKEvent*)untag_ptr(o));
27568         LDKCOption_EventZ *ret_copy = MALLOC(sizeof(LDKCOption_EventZ), "LDKCOption_EventZ");
27569         *ret_copy = COption_EventZ_some(o_conv);
27570         uint64_t ret_ref = tag_ptr(ret_copy, true);
27571         return ret_ref;
27572 }
27573
27574 uint64_t  __attribute__((export_name("TS_COption_EventZ_none"))) TS_COption_EventZ_none() {
27575         LDKCOption_EventZ *ret_copy = MALLOC(sizeof(LDKCOption_EventZ), "LDKCOption_EventZ");
27576         *ret_copy = COption_EventZ_none();
27577         uint64_t ret_ref = tag_ptr(ret_copy, true);
27578         return ret_ref;
27579 }
27580
27581 void  __attribute__((export_name("TS_COption_EventZ_free"))) TS_COption_EventZ_free(uint64_t _res) {
27582         if (!ptr_is_owned(_res)) return;
27583         void* _res_ptr = untag_ptr(_res);
27584         CHECK_ACCESS(_res_ptr);
27585         LDKCOption_EventZ _res_conv = *(LDKCOption_EventZ*)(_res_ptr);
27586         FREE(untag_ptr(_res));
27587         COption_EventZ_free(_res_conv);
27588 }
27589
27590 static inline uint64_t COption_EventZ_clone_ptr(LDKCOption_EventZ *NONNULL_PTR arg) {
27591         LDKCOption_EventZ *ret_copy = MALLOC(sizeof(LDKCOption_EventZ), "LDKCOption_EventZ");
27592         *ret_copy = COption_EventZ_clone(arg);
27593         uint64_t ret_ref = tag_ptr(ret_copy, true);
27594         return ret_ref;
27595 }
27596 int64_t  __attribute__((export_name("TS_COption_EventZ_clone_ptr"))) TS_COption_EventZ_clone_ptr(uint64_t arg) {
27597         LDKCOption_EventZ* arg_conv = (LDKCOption_EventZ*)untag_ptr(arg);
27598         int64_t ret_conv = COption_EventZ_clone_ptr(arg_conv);
27599         return ret_conv;
27600 }
27601
27602 uint64_t  __attribute__((export_name("TS_COption_EventZ_clone"))) TS_COption_EventZ_clone(uint64_t orig) {
27603         LDKCOption_EventZ* orig_conv = (LDKCOption_EventZ*)untag_ptr(orig);
27604         LDKCOption_EventZ *ret_copy = MALLOC(sizeof(LDKCOption_EventZ), "LDKCOption_EventZ");
27605         *ret_copy = COption_EventZ_clone(orig_conv);
27606         uint64_t ret_ref = tag_ptr(ret_copy, true);
27607         return ret_ref;
27608 }
27609
27610 uint64_t  __attribute__((export_name("TS_CResult_COption_EventZDecodeErrorZ_ok"))) TS_CResult_COption_EventZDecodeErrorZ_ok(uint64_t o) {
27611         void* o_ptr = untag_ptr(o);
27612         CHECK_ACCESS(o_ptr);
27613         LDKCOption_EventZ o_conv = *(LDKCOption_EventZ*)(o_ptr);
27614         o_conv = COption_EventZ_clone((LDKCOption_EventZ*)untag_ptr(o));
27615         LDKCResult_COption_EventZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_COption_EventZDecodeErrorZ), "LDKCResult_COption_EventZDecodeErrorZ");
27616         *ret_conv = CResult_COption_EventZDecodeErrorZ_ok(o_conv);
27617         return tag_ptr(ret_conv, true);
27618 }
27619
27620 uint64_t  __attribute__((export_name("TS_CResult_COption_EventZDecodeErrorZ_err"))) TS_CResult_COption_EventZDecodeErrorZ_err(uint64_t e) {
27621         void* e_ptr = untag_ptr(e);
27622         CHECK_ACCESS(e_ptr);
27623         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
27624         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
27625         LDKCResult_COption_EventZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_COption_EventZDecodeErrorZ), "LDKCResult_COption_EventZDecodeErrorZ");
27626         *ret_conv = CResult_COption_EventZDecodeErrorZ_err(e_conv);
27627         return tag_ptr(ret_conv, true);
27628 }
27629
27630 jboolean  __attribute__((export_name("TS_CResult_COption_EventZDecodeErrorZ_is_ok"))) TS_CResult_COption_EventZDecodeErrorZ_is_ok(uint64_t o) {
27631         LDKCResult_COption_EventZDecodeErrorZ* o_conv = (LDKCResult_COption_EventZDecodeErrorZ*)untag_ptr(o);
27632         jboolean ret_conv = CResult_COption_EventZDecodeErrorZ_is_ok(o_conv);
27633         return ret_conv;
27634 }
27635
27636 void  __attribute__((export_name("TS_CResult_COption_EventZDecodeErrorZ_free"))) TS_CResult_COption_EventZDecodeErrorZ_free(uint64_t _res) {
27637         if (!ptr_is_owned(_res)) return;
27638         void* _res_ptr = untag_ptr(_res);
27639         CHECK_ACCESS(_res_ptr);
27640         LDKCResult_COption_EventZDecodeErrorZ _res_conv = *(LDKCResult_COption_EventZDecodeErrorZ*)(_res_ptr);
27641         FREE(untag_ptr(_res));
27642         CResult_COption_EventZDecodeErrorZ_free(_res_conv);
27643 }
27644
27645 static inline uint64_t CResult_COption_EventZDecodeErrorZ_clone_ptr(LDKCResult_COption_EventZDecodeErrorZ *NONNULL_PTR arg) {
27646         LDKCResult_COption_EventZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_COption_EventZDecodeErrorZ), "LDKCResult_COption_EventZDecodeErrorZ");
27647         *ret_conv = CResult_COption_EventZDecodeErrorZ_clone(arg);
27648         return tag_ptr(ret_conv, true);
27649 }
27650 int64_t  __attribute__((export_name("TS_CResult_COption_EventZDecodeErrorZ_clone_ptr"))) TS_CResult_COption_EventZDecodeErrorZ_clone_ptr(uint64_t arg) {
27651         LDKCResult_COption_EventZDecodeErrorZ* arg_conv = (LDKCResult_COption_EventZDecodeErrorZ*)untag_ptr(arg);
27652         int64_t ret_conv = CResult_COption_EventZDecodeErrorZ_clone_ptr(arg_conv);
27653         return ret_conv;
27654 }
27655
27656 uint64_t  __attribute__((export_name("TS_CResult_COption_EventZDecodeErrorZ_clone"))) TS_CResult_COption_EventZDecodeErrorZ_clone(uint64_t orig) {
27657         LDKCResult_COption_EventZDecodeErrorZ* orig_conv = (LDKCResult_COption_EventZDecodeErrorZ*)untag_ptr(orig);
27658         LDKCResult_COption_EventZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_COption_EventZDecodeErrorZ), "LDKCResult_COption_EventZDecodeErrorZ");
27659         *ret_conv = CResult_COption_EventZDecodeErrorZ_clone(orig_conv);
27660         return tag_ptr(ret_conv, true);
27661 }
27662
27663 uint64_t  __attribute__((export_name("TS_CResult_SiPrefixBolt11ParseErrorZ_ok"))) TS_CResult_SiPrefixBolt11ParseErrorZ_ok(uint32_t o) {
27664         LDKSiPrefix o_conv = LDKSiPrefix_from_js(o);
27665         LDKCResult_SiPrefixBolt11ParseErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_SiPrefixBolt11ParseErrorZ), "LDKCResult_SiPrefixBolt11ParseErrorZ");
27666         *ret_conv = CResult_SiPrefixBolt11ParseErrorZ_ok(o_conv);
27667         return tag_ptr(ret_conv, true);
27668 }
27669
27670 uint64_t  __attribute__((export_name("TS_CResult_SiPrefixBolt11ParseErrorZ_err"))) TS_CResult_SiPrefixBolt11ParseErrorZ_err(uint64_t e) {
27671         void* e_ptr = untag_ptr(e);
27672         CHECK_ACCESS(e_ptr);
27673         LDKBolt11ParseError e_conv = *(LDKBolt11ParseError*)(e_ptr);
27674         e_conv = Bolt11ParseError_clone((LDKBolt11ParseError*)untag_ptr(e));
27675         LDKCResult_SiPrefixBolt11ParseErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_SiPrefixBolt11ParseErrorZ), "LDKCResult_SiPrefixBolt11ParseErrorZ");
27676         *ret_conv = CResult_SiPrefixBolt11ParseErrorZ_err(e_conv);
27677         return tag_ptr(ret_conv, true);
27678 }
27679
27680 jboolean  __attribute__((export_name("TS_CResult_SiPrefixBolt11ParseErrorZ_is_ok"))) TS_CResult_SiPrefixBolt11ParseErrorZ_is_ok(uint64_t o) {
27681         LDKCResult_SiPrefixBolt11ParseErrorZ* o_conv = (LDKCResult_SiPrefixBolt11ParseErrorZ*)untag_ptr(o);
27682         jboolean ret_conv = CResult_SiPrefixBolt11ParseErrorZ_is_ok(o_conv);
27683         return ret_conv;
27684 }
27685
27686 void  __attribute__((export_name("TS_CResult_SiPrefixBolt11ParseErrorZ_free"))) TS_CResult_SiPrefixBolt11ParseErrorZ_free(uint64_t _res) {
27687         if (!ptr_is_owned(_res)) return;
27688         void* _res_ptr = untag_ptr(_res);
27689         CHECK_ACCESS(_res_ptr);
27690         LDKCResult_SiPrefixBolt11ParseErrorZ _res_conv = *(LDKCResult_SiPrefixBolt11ParseErrorZ*)(_res_ptr);
27691         FREE(untag_ptr(_res));
27692         CResult_SiPrefixBolt11ParseErrorZ_free(_res_conv);
27693 }
27694
27695 static inline uint64_t CResult_SiPrefixBolt11ParseErrorZ_clone_ptr(LDKCResult_SiPrefixBolt11ParseErrorZ *NONNULL_PTR arg) {
27696         LDKCResult_SiPrefixBolt11ParseErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_SiPrefixBolt11ParseErrorZ), "LDKCResult_SiPrefixBolt11ParseErrorZ");
27697         *ret_conv = CResult_SiPrefixBolt11ParseErrorZ_clone(arg);
27698         return tag_ptr(ret_conv, true);
27699 }
27700 int64_t  __attribute__((export_name("TS_CResult_SiPrefixBolt11ParseErrorZ_clone_ptr"))) TS_CResult_SiPrefixBolt11ParseErrorZ_clone_ptr(uint64_t arg) {
27701         LDKCResult_SiPrefixBolt11ParseErrorZ* arg_conv = (LDKCResult_SiPrefixBolt11ParseErrorZ*)untag_ptr(arg);
27702         int64_t ret_conv = CResult_SiPrefixBolt11ParseErrorZ_clone_ptr(arg_conv);
27703         return ret_conv;
27704 }
27705
27706 uint64_t  __attribute__((export_name("TS_CResult_SiPrefixBolt11ParseErrorZ_clone"))) TS_CResult_SiPrefixBolt11ParseErrorZ_clone(uint64_t orig) {
27707         LDKCResult_SiPrefixBolt11ParseErrorZ* orig_conv = (LDKCResult_SiPrefixBolt11ParseErrorZ*)untag_ptr(orig);
27708         LDKCResult_SiPrefixBolt11ParseErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_SiPrefixBolt11ParseErrorZ), "LDKCResult_SiPrefixBolt11ParseErrorZ");
27709         *ret_conv = CResult_SiPrefixBolt11ParseErrorZ_clone(orig_conv);
27710         return tag_ptr(ret_conv, true);
27711 }
27712
27713 uint64_t  __attribute__((export_name("TS_CResult_Bolt11InvoiceParseOrSemanticErrorZ_ok"))) TS_CResult_Bolt11InvoiceParseOrSemanticErrorZ_ok(uint64_t o) {
27714         LDKBolt11Invoice o_conv;
27715         o_conv.inner = untag_ptr(o);
27716         o_conv.is_owned = ptr_is_owned(o);
27717         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
27718         o_conv = Bolt11Invoice_clone(&o_conv);
27719         LDKCResult_Bolt11InvoiceParseOrSemanticErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_Bolt11InvoiceParseOrSemanticErrorZ), "LDKCResult_Bolt11InvoiceParseOrSemanticErrorZ");
27720         *ret_conv = CResult_Bolt11InvoiceParseOrSemanticErrorZ_ok(o_conv);
27721         return tag_ptr(ret_conv, true);
27722 }
27723
27724 uint64_t  __attribute__((export_name("TS_CResult_Bolt11InvoiceParseOrSemanticErrorZ_err"))) TS_CResult_Bolt11InvoiceParseOrSemanticErrorZ_err(uint64_t e) {
27725         void* e_ptr = untag_ptr(e);
27726         CHECK_ACCESS(e_ptr);
27727         LDKParseOrSemanticError e_conv = *(LDKParseOrSemanticError*)(e_ptr);
27728         e_conv = ParseOrSemanticError_clone((LDKParseOrSemanticError*)untag_ptr(e));
27729         LDKCResult_Bolt11InvoiceParseOrSemanticErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_Bolt11InvoiceParseOrSemanticErrorZ), "LDKCResult_Bolt11InvoiceParseOrSemanticErrorZ");
27730         *ret_conv = CResult_Bolt11InvoiceParseOrSemanticErrorZ_err(e_conv);
27731         return tag_ptr(ret_conv, true);
27732 }
27733
27734 jboolean  __attribute__((export_name("TS_CResult_Bolt11InvoiceParseOrSemanticErrorZ_is_ok"))) TS_CResult_Bolt11InvoiceParseOrSemanticErrorZ_is_ok(uint64_t o) {
27735         LDKCResult_Bolt11InvoiceParseOrSemanticErrorZ* o_conv = (LDKCResult_Bolt11InvoiceParseOrSemanticErrorZ*)untag_ptr(o);
27736         jboolean ret_conv = CResult_Bolt11InvoiceParseOrSemanticErrorZ_is_ok(o_conv);
27737         return ret_conv;
27738 }
27739
27740 void  __attribute__((export_name("TS_CResult_Bolt11InvoiceParseOrSemanticErrorZ_free"))) TS_CResult_Bolt11InvoiceParseOrSemanticErrorZ_free(uint64_t _res) {
27741         if (!ptr_is_owned(_res)) return;
27742         void* _res_ptr = untag_ptr(_res);
27743         CHECK_ACCESS(_res_ptr);
27744         LDKCResult_Bolt11InvoiceParseOrSemanticErrorZ _res_conv = *(LDKCResult_Bolt11InvoiceParseOrSemanticErrorZ*)(_res_ptr);
27745         FREE(untag_ptr(_res));
27746         CResult_Bolt11InvoiceParseOrSemanticErrorZ_free(_res_conv);
27747 }
27748
27749 static inline uint64_t CResult_Bolt11InvoiceParseOrSemanticErrorZ_clone_ptr(LDKCResult_Bolt11InvoiceParseOrSemanticErrorZ *NONNULL_PTR arg) {
27750         LDKCResult_Bolt11InvoiceParseOrSemanticErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_Bolt11InvoiceParseOrSemanticErrorZ), "LDKCResult_Bolt11InvoiceParseOrSemanticErrorZ");
27751         *ret_conv = CResult_Bolt11InvoiceParseOrSemanticErrorZ_clone(arg);
27752         return tag_ptr(ret_conv, true);
27753 }
27754 int64_t  __attribute__((export_name("TS_CResult_Bolt11InvoiceParseOrSemanticErrorZ_clone_ptr"))) TS_CResult_Bolt11InvoiceParseOrSemanticErrorZ_clone_ptr(uint64_t arg) {
27755         LDKCResult_Bolt11InvoiceParseOrSemanticErrorZ* arg_conv = (LDKCResult_Bolt11InvoiceParseOrSemanticErrorZ*)untag_ptr(arg);
27756         int64_t ret_conv = CResult_Bolt11InvoiceParseOrSemanticErrorZ_clone_ptr(arg_conv);
27757         return ret_conv;
27758 }
27759
27760 uint64_t  __attribute__((export_name("TS_CResult_Bolt11InvoiceParseOrSemanticErrorZ_clone"))) TS_CResult_Bolt11InvoiceParseOrSemanticErrorZ_clone(uint64_t orig) {
27761         LDKCResult_Bolt11InvoiceParseOrSemanticErrorZ* orig_conv = (LDKCResult_Bolt11InvoiceParseOrSemanticErrorZ*)untag_ptr(orig);
27762         LDKCResult_Bolt11InvoiceParseOrSemanticErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_Bolt11InvoiceParseOrSemanticErrorZ), "LDKCResult_Bolt11InvoiceParseOrSemanticErrorZ");
27763         *ret_conv = CResult_Bolt11InvoiceParseOrSemanticErrorZ_clone(orig_conv);
27764         return tag_ptr(ret_conv, true);
27765 }
27766
27767 uint64_t  __attribute__((export_name("TS_CResult_SignedRawBolt11InvoiceBolt11ParseErrorZ_ok"))) TS_CResult_SignedRawBolt11InvoiceBolt11ParseErrorZ_ok(uint64_t o) {
27768         LDKSignedRawBolt11Invoice o_conv;
27769         o_conv.inner = untag_ptr(o);
27770         o_conv.is_owned = ptr_is_owned(o);
27771         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
27772         o_conv = SignedRawBolt11Invoice_clone(&o_conv);
27773         LDKCResult_SignedRawBolt11InvoiceBolt11ParseErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_SignedRawBolt11InvoiceBolt11ParseErrorZ), "LDKCResult_SignedRawBolt11InvoiceBolt11ParseErrorZ");
27774         *ret_conv = CResult_SignedRawBolt11InvoiceBolt11ParseErrorZ_ok(o_conv);
27775         return tag_ptr(ret_conv, true);
27776 }
27777
27778 uint64_t  __attribute__((export_name("TS_CResult_SignedRawBolt11InvoiceBolt11ParseErrorZ_err"))) TS_CResult_SignedRawBolt11InvoiceBolt11ParseErrorZ_err(uint64_t e) {
27779         void* e_ptr = untag_ptr(e);
27780         CHECK_ACCESS(e_ptr);
27781         LDKBolt11ParseError e_conv = *(LDKBolt11ParseError*)(e_ptr);
27782         e_conv = Bolt11ParseError_clone((LDKBolt11ParseError*)untag_ptr(e));
27783         LDKCResult_SignedRawBolt11InvoiceBolt11ParseErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_SignedRawBolt11InvoiceBolt11ParseErrorZ), "LDKCResult_SignedRawBolt11InvoiceBolt11ParseErrorZ");
27784         *ret_conv = CResult_SignedRawBolt11InvoiceBolt11ParseErrorZ_err(e_conv);
27785         return tag_ptr(ret_conv, true);
27786 }
27787
27788 jboolean  __attribute__((export_name("TS_CResult_SignedRawBolt11InvoiceBolt11ParseErrorZ_is_ok"))) TS_CResult_SignedRawBolt11InvoiceBolt11ParseErrorZ_is_ok(uint64_t o) {
27789         LDKCResult_SignedRawBolt11InvoiceBolt11ParseErrorZ* o_conv = (LDKCResult_SignedRawBolt11InvoiceBolt11ParseErrorZ*)untag_ptr(o);
27790         jboolean ret_conv = CResult_SignedRawBolt11InvoiceBolt11ParseErrorZ_is_ok(o_conv);
27791         return ret_conv;
27792 }
27793
27794 void  __attribute__((export_name("TS_CResult_SignedRawBolt11InvoiceBolt11ParseErrorZ_free"))) TS_CResult_SignedRawBolt11InvoiceBolt11ParseErrorZ_free(uint64_t _res) {
27795         if (!ptr_is_owned(_res)) return;
27796         void* _res_ptr = untag_ptr(_res);
27797         CHECK_ACCESS(_res_ptr);
27798         LDKCResult_SignedRawBolt11InvoiceBolt11ParseErrorZ _res_conv = *(LDKCResult_SignedRawBolt11InvoiceBolt11ParseErrorZ*)(_res_ptr);
27799         FREE(untag_ptr(_res));
27800         CResult_SignedRawBolt11InvoiceBolt11ParseErrorZ_free(_res_conv);
27801 }
27802
27803 static inline uint64_t CResult_SignedRawBolt11InvoiceBolt11ParseErrorZ_clone_ptr(LDKCResult_SignedRawBolt11InvoiceBolt11ParseErrorZ *NONNULL_PTR arg) {
27804         LDKCResult_SignedRawBolt11InvoiceBolt11ParseErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_SignedRawBolt11InvoiceBolt11ParseErrorZ), "LDKCResult_SignedRawBolt11InvoiceBolt11ParseErrorZ");
27805         *ret_conv = CResult_SignedRawBolt11InvoiceBolt11ParseErrorZ_clone(arg);
27806         return tag_ptr(ret_conv, true);
27807 }
27808 int64_t  __attribute__((export_name("TS_CResult_SignedRawBolt11InvoiceBolt11ParseErrorZ_clone_ptr"))) TS_CResult_SignedRawBolt11InvoiceBolt11ParseErrorZ_clone_ptr(uint64_t arg) {
27809         LDKCResult_SignedRawBolt11InvoiceBolt11ParseErrorZ* arg_conv = (LDKCResult_SignedRawBolt11InvoiceBolt11ParseErrorZ*)untag_ptr(arg);
27810         int64_t ret_conv = CResult_SignedRawBolt11InvoiceBolt11ParseErrorZ_clone_ptr(arg_conv);
27811         return ret_conv;
27812 }
27813
27814 uint64_t  __attribute__((export_name("TS_CResult_SignedRawBolt11InvoiceBolt11ParseErrorZ_clone"))) TS_CResult_SignedRawBolt11InvoiceBolt11ParseErrorZ_clone(uint64_t orig) {
27815         LDKCResult_SignedRawBolt11InvoiceBolt11ParseErrorZ* orig_conv = (LDKCResult_SignedRawBolt11InvoiceBolt11ParseErrorZ*)untag_ptr(orig);
27816         LDKCResult_SignedRawBolt11InvoiceBolt11ParseErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_SignedRawBolt11InvoiceBolt11ParseErrorZ), "LDKCResult_SignedRawBolt11InvoiceBolt11ParseErrorZ");
27817         *ret_conv = CResult_SignedRawBolt11InvoiceBolt11ParseErrorZ_clone(orig_conv);
27818         return tag_ptr(ret_conv, true);
27819 }
27820
27821 static inline uint64_t C3Tuple_RawBolt11Invoice_u832Bolt11InvoiceSignatureZ_clone_ptr(LDKC3Tuple_RawBolt11Invoice_u832Bolt11InvoiceSignatureZ *NONNULL_PTR arg) {
27822         LDKC3Tuple_RawBolt11Invoice_u832Bolt11InvoiceSignatureZ* ret_conv = MALLOC(sizeof(LDKC3Tuple_RawBolt11Invoice_u832Bolt11InvoiceSignatureZ), "LDKC3Tuple_RawBolt11Invoice_u832Bolt11InvoiceSignatureZ");
27823         *ret_conv = C3Tuple_RawBolt11Invoice_u832Bolt11InvoiceSignatureZ_clone(arg);
27824         return tag_ptr(ret_conv, true);
27825 }
27826 int64_t  __attribute__((export_name("TS_C3Tuple_RawBolt11Invoice_u832Bolt11InvoiceSignatureZ_clone_ptr"))) TS_C3Tuple_RawBolt11Invoice_u832Bolt11InvoiceSignatureZ_clone_ptr(uint64_t arg) {
27827         LDKC3Tuple_RawBolt11Invoice_u832Bolt11InvoiceSignatureZ* arg_conv = (LDKC3Tuple_RawBolt11Invoice_u832Bolt11InvoiceSignatureZ*)untag_ptr(arg);
27828         int64_t ret_conv = C3Tuple_RawBolt11Invoice_u832Bolt11InvoiceSignatureZ_clone_ptr(arg_conv);
27829         return ret_conv;
27830 }
27831
27832 uint64_t  __attribute__((export_name("TS_C3Tuple_RawBolt11Invoice_u832Bolt11InvoiceSignatureZ_clone"))) TS_C3Tuple_RawBolt11Invoice_u832Bolt11InvoiceSignatureZ_clone(uint64_t orig) {
27833         LDKC3Tuple_RawBolt11Invoice_u832Bolt11InvoiceSignatureZ* orig_conv = (LDKC3Tuple_RawBolt11Invoice_u832Bolt11InvoiceSignatureZ*)untag_ptr(orig);
27834         LDKC3Tuple_RawBolt11Invoice_u832Bolt11InvoiceSignatureZ* ret_conv = MALLOC(sizeof(LDKC3Tuple_RawBolt11Invoice_u832Bolt11InvoiceSignatureZ), "LDKC3Tuple_RawBolt11Invoice_u832Bolt11InvoiceSignatureZ");
27835         *ret_conv = C3Tuple_RawBolt11Invoice_u832Bolt11InvoiceSignatureZ_clone(orig_conv);
27836         return tag_ptr(ret_conv, true);
27837 }
27838
27839 uint64_t  __attribute__((export_name("TS_C3Tuple_RawBolt11Invoice_u832Bolt11InvoiceSignatureZ_new"))) TS_C3Tuple_RawBolt11Invoice_u832Bolt11InvoiceSignatureZ_new(uint64_t a, int8_tArray b, uint64_t c) {
27840         LDKRawBolt11Invoice a_conv;
27841         a_conv.inner = untag_ptr(a);
27842         a_conv.is_owned = ptr_is_owned(a);
27843         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
27844         a_conv = RawBolt11Invoice_clone(&a_conv);
27845         LDKThirtyTwoBytes b_ref;
27846         CHECK(b->arr_len == 32);
27847         memcpy(b_ref.data, b->elems, 32); FREE(b);
27848         LDKBolt11InvoiceSignature c_conv;
27849         c_conv.inner = untag_ptr(c);
27850         c_conv.is_owned = ptr_is_owned(c);
27851         CHECK_INNER_FIELD_ACCESS_OR_NULL(c_conv);
27852         c_conv = Bolt11InvoiceSignature_clone(&c_conv);
27853         LDKC3Tuple_RawBolt11Invoice_u832Bolt11InvoiceSignatureZ* ret_conv = MALLOC(sizeof(LDKC3Tuple_RawBolt11Invoice_u832Bolt11InvoiceSignatureZ), "LDKC3Tuple_RawBolt11Invoice_u832Bolt11InvoiceSignatureZ");
27854         *ret_conv = C3Tuple_RawBolt11Invoice_u832Bolt11InvoiceSignatureZ_new(a_conv, b_ref, c_conv);
27855         return tag_ptr(ret_conv, true);
27856 }
27857
27858 void  __attribute__((export_name("TS_C3Tuple_RawBolt11Invoice_u832Bolt11InvoiceSignatureZ_free"))) TS_C3Tuple_RawBolt11Invoice_u832Bolt11InvoiceSignatureZ_free(uint64_t _res) {
27859         if (!ptr_is_owned(_res)) return;
27860         void* _res_ptr = untag_ptr(_res);
27861         CHECK_ACCESS(_res_ptr);
27862         LDKC3Tuple_RawBolt11Invoice_u832Bolt11InvoiceSignatureZ _res_conv = *(LDKC3Tuple_RawBolt11Invoice_u832Bolt11InvoiceSignatureZ*)(_res_ptr);
27863         FREE(untag_ptr(_res));
27864         C3Tuple_RawBolt11Invoice_u832Bolt11InvoiceSignatureZ_free(_res_conv);
27865 }
27866
27867 uint64_t  __attribute__((export_name("TS_CResult_PayeePubKeySecp256k1ErrorZ_ok"))) TS_CResult_PayeePubKeySecp256k1ErrorZ_ok(uint64_t o) {
27868         LDKPayeePubKey o_conv;
27869         o_conv.inner = untag_ptr(o);
27870         o_conv.is_owned = ptr_is_owned(o);
27871         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
27872         o_conv = PayeePubKey_clone(&o_conv);
27873         LDKCResult_PayeePubKeySecp256k1ErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PayeePubKeySecp256k1ErrorZ), "LDKCResult_PayeePubKeySecp256k1ErrorZ");
27874         *ret_conv = CResult_PayeePubKeySecp256k1ErrorZ_ok(o_conv);
27875         return tag_ptr(ret_conv, true);
27876 }
27877
27878 uint64_t  __attribute__((export_name("TS_CResult_PayeePubKeySecp256k1ErrorZ_err"))) TS_CResult_PayeePubKeySecp256k1ErrorZ_err(uint32_t e) {
27879         LDKSecp256k1Error e_conv = LDKSecp256k1Error_from_js(e);
27880         LDKCResult_PayeePubKeySecp256k1ErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PayeePubKeySecp256k1ErrorZ), "LDKCResult_PayeePubKeySecp256k1ErrorZ");
27881         *ret_conv = CResult_PayeePubKeySecp256k1ErrorZ_err(e_conv);
27882         return tag_ptr(ret_conv, true);
27883 }
27884
27885 jboolean  __attribute__((export_name("TS_CResult_PayeePubKeySecp256k1ErrorZ_is_ok"))) TS_CResult_PayeePubKeySecp256k1ErrorZ_is_ok(uint64_t o) {
27886         LDKCResult_PayeePubKeySecp256k1ErrorZ* o_conv = (LDKCResult_PayeePubKeySecp256k1ErrorZ*)untag_ptr(o);
27887         jboolean ret_conv = CResult_PayeePubKeySecp256k1ErrorZ_is_ok(o_conv);
27888         return ret_conv;
27889 }
27890
27891 void  __attribute__((export_name("TS_CResult_PayeePubKeySecp256k1ErrorZ_free"))) TS_CResult_PayeePubKeySecp256k1ErrorZ_free(uint64_t _res) {
27892         if (!ptr_is_owned(_res)) return;
27893         void* _res_ptr = untag_ptr(_res);
27894         CHECK_ACCESS(_res_ptr);
27895         LDKCResult_PayeePubKeySecp256k1ErrorZ _res_conv = *(LDKCResult_PayeePubKeySecp256k1ErrorZ*)(_res_ptr);
27896         FREE(untag_ptr(_res));
27897         CResult_PayeePubKeySecp256k1ErrorZ_free(_res_conv);
27898 }
27899
27900 static inline uint64_t CResult_PayeePubKeySecp256k1ErrorZ_clone_ptr(LDKCResult_PayeePubKeySecp256k1ErrorZ *NONNULL_PTR arg) {
27901         LDKCResult_PayeePubKeySecp256k1ErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PayeePubKeySecp256k1ErrorZ), "LDKCResult_PayeePubKeySecp256k1ErrorZ");
27902         *ret_conv = CResult_PayeePubKeySecp256k1ErrorZ_clone(arg);
27903         return tag_ptr(ret_conv, true);
27904 }
27905 int64_t  __attribute__((export_name("TS_CResult_PayeePubKeySecp256k1ErrorZ_clone_ptr"))) TS_CResult_PayeePubKeySecp256k1ErrorZ_clone_ptr(uint64_t arg) {
27906         LDKCResult_PayeePubKeySecp256k1ErrorZ* arg_conv = (LDKCResult_PayeePubKeySecp256k1ErrorZ*)untag_ptr(arg);
27907         int64_t ret_conv = CResult_PayeePubKeySecp256k1ErrorZ_clone_ptr(arg_conv);
27908         return ret_conv;
27909 }
27910
27911 uint64_t  __attribute__((export_name("TS_CResult_PayeePubKeySecp256k1ErrorZ_clone"))) TS_CResult_PayeePubKeySecp256k1ErrorZ_clone(uint64_t orig) {
27912         LDKCResult_PayeePubKeySecp256k1ErrorZ* orig_conv = (LDKCResult_PayeePubKeySecp256k1ErrorZ*)untag_ptr(orig);
27913         LDKCResult_PayeePubKeySecp256k1ErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PayeePubKeySecp256k1ErrorZ), "LDKCResult_PayeePubKeySecp256k1ErrorZ");
27914         *ret_conv = CResult_PayeePubKeySecp256k1ErrorZ_clone(orig_conv);
27915         return tag_ptr(ret_conv, true);
27916 }
27917
27918 void  __attribute__((export_name("TS_CVec_PrivateRouteZ_free"))) TS_CVec_PrivateRouteZ_free(uint64_tArray _res) {
27919         LDKCVec_PrivateRouteZ _res_constr;
27920         _res_constr.datalen = _res->arr_len;
27921         if (_res_constr.datalen > 0)
27922                 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKPrivateRoute), "LDKCVec_PrivateRouteZ Elements");
27923         else
27924                 _res_constr.data = NULL;
27925         uint64_t* _res_vals = _res->elems;
27926         for (size_t o = 0; o < _res_constr.datalen; o++) {
27927                 uint64_t _res_conv_14 = _res_vals[o];
27928                 LDKPrivateRoute _res_conv_14_conv;
27929                 _res_conv_14_conv.inner = untag_ptr(_res_conv_14);
27930                 _res_conv_14_conv.is_owned = ptr_is_owned(_res_conv_14);
27931                 CHECK_INNER_FIELD_ACCESS_OR_NULL(_res_conv_14_conv);
27932                 _res_constr.data[o] = _res_conv_14_conv;
27933         }
27934         FREE(_res);
27935         CVec_PrivateRouteZ_free(_res_constr);
27936 }
27937
27938 uint64_t  __attribute__((export_name("TS_CResult_PositiveTimestampCreationErrorZ_ok"))) TS_CResult_PositiveTimestampCreationErrorZ_ok(uint64_t o) {
27939         LDKPositiveTimestamp o_conv;
27940         o_conv.inner = untag_ptr(o);
27941         o_conv.is_owned = ptr_is_owned(o);
27942         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
27943         o_conv = PositiveTimestamp_clone(&o_conv);
27944         LDKCResult_PositiveTimestampCreationErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PositiveTimestampCreationErrorZ), "LDKCResult_PositiveTimestampCreationErrorZ");
27945         *ret_conv = CResult_PositiveTimestampCreationErrorZ_ok(o_conv);
27946         return tag_ptr(ret_conv, true);
27947 }
27948
27949 uint64_t  __attribute__((export_name("TS_CResult_PositiveTimestampCreationErrorZ_err"))) TS_CResult_PositiveTimestampCreationErrorZ_err(uint32_t e) {
27950         LDKCreationError e_conv = LDKCreationError_from_js(e);
27951         LDKCResult_PositiveTimestampCreationErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PositiveTimestampCreationErrorZ), "LDKCResult_PositiveTimestampCreationErrorZ");
27952         *ret_conv = CResult_PositiveTimestampCreationErrorZ_err(e_conv);
27953         return tag_ptr(ret_conv, true);
27954 }
27955
27956 jboolean  __attribute__((export_name("TS_CResult_PositiveTimestampCreationErrorZ_is_ok"))) TS_CResult_PositiveTimestampCreationErrorZ_is_ok(uint64_t o) {
27957         LDKCResult_PositiveTimestampCreationErrorZ* o_conv = (LDKCResult_PositiveTimestampCreationErrorZ*)untag_ptr(o);
27958         jboolean ret_conv = CResult_PositiveTimestampCreationErrorZ_is_ok(o_conv);
27959         return ret_conv;
27960 }
27961
27962 void  __attribute__((export_name("TS_CResult_PositiveTimestampCreationErrorZ_free"))) TS_CResult_PositiveTimestampCreationErrorZ_free(uint64_t _res) {
27963         if (!ptr_is_owned(_res)) return;
27964         void* _res_ptr = untag_ptr(_res);
27965         CHECK_ACCESS(_res_ptr);
27966         LDKCResult_PositiveTimestampCreationErrorZ _res_conv = *(LDKCResult_PositiveTimestampCreationErrorZ*)(_res_ptr);
27967         FREE(untag_ptr(_res));
27968         CResult_PositiveTimestampCreationErrorZ_free(_res_conv);
27969 }
27970
27971 static inline uint64_t CResult_PositiveTimestampCreationErrorZ_clone_ptr(LDKCResult_PositiveTimestampCreationErrorZ *NONNULL_PTR arg) {
27972         LDKCResult_PositiveTimestampCreationErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PositiveTimestampCreationErrorZ), "LDKCResult_PositiveTimestampCreationErrorZ");
27973         *ret_conv = CResult_PositiveTimestampCreationErrorZ_clone(arg);
27974         return tag_ptr(ret_conv, true);
27975 }
27976 int64_t  __attribute__((export_name("TS_CResult_PositiveTimestampCreationErrorZ_clone_ptr"))) TS_CResult_PositiveTimestampCreationErrorZ_clone_ptr(uint64_t arg) {
27977         LDKCResult_PositiveTimestampCreationErrorZ* arg_conv = (LDKCResult_PositiveTimestampCreationErrorZ*)untag_ptr(arg);
27978         int64_t ret_conv = CResult_PositiveTimestampCreationErrorZ_clone_ptr(arg_conv);
27979         return ret_conv;
27980 }
27981
27982 uint64_t  __attribute__((export_name("TS_CResult_PositiveTimestampCreationErrorZ_clone"))) TS_CResult_PositiveTimestampCreationErrorZ_clone(uint64_t orig) {
27983         LDKCResult_PositiveTimestampCreationErrorZ* orig_conv = (LDKCResult_PositiveTimestampCreationErrorZ*)untag_ptr(orig);
27984         LDKCResult_PositiveTimestampCreationErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PositiveTimestampCreationErrorZ), "LDKCResult_PositiveTimestampCreationErrorZ");
27985         *ret_conv = CResult_PositiveTimestampCreationErrorZ_clone(orig_conv);
27986         return tag_ptr(ret_conv, true);
27987 }
27988
27989 uint64_t  __attribute__((export_name("TS_CResult_NoneBolt11SemanticErrorZ_ok"))) TS_CResult_NoneBolt11SemanticErrorZ_ok() {
27990         LDKCResult_NoneBolt11SemanticErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneBolt11SemanticErrorZ), "LDKCResult_NoneBolt11SemanticErrorZ");
27991         *ret_conv = CResult_NoneBolt11SemanticErrorZ_ok();
27992         return tag_ptr(ret_conv, true);
27993 }
27994
27995 uint64_t  __attribute__((export_name("TS_CResult_NoneBolt11SemanticErrorZ_err"))) TS_CResult_NoneBolt11SemanticErrorZ_err(uint32_t e) {
27996         LDKBolt11SemanticError e_conv = LDKBolt11SemanticError_from_js(e);
27997         LDKCResult_NoneBolt11SemanticErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneBolt11SemanticErrorZ), "LDKCResult_NoneBolt11SemanticErrorZ");
27998         *ret_conv = CResult_NoneBolt11SemanticErrorZ_err(e_conv);
27999         return tag_ptr(ret_conv, true);
28000 }
28001
28002 jboolean  __attribute__((export_name("TS_CResult_NoneBolt11SemanticErrorZ_is_ok"))) TS_CResult_NoneBolt11SemanticErrorZ_is_ok(uint64_t o) {
28003         LDKCResult_NoneBolt11SemanticErrorZ* o_conv = (LDKCResult_NoneBolt11SemanticErrorZ*)untag_ptr(o);
28004         jboolean ret_conv = CResult_NoneBolt11SemanticErrorZ_is_ok(o_conv);
28005         return ret_conv;
28006 }
28007
28008 void  __attribute__((export_name("TS_CResult_NoneBolt11SemanticErrorZ_free"))) TS_CResult_NoneBolt11SemanticErrorZ_free(uint64_t _res) {
28009         if (!ptr_is_owned(_res)) return;
28010         void* _res_ptr = untag_ptr(_res);
28011         CHECK_ACCESS(_res_ptr);
28012         LDKCResult_NoneBolt11SemanticErrorZ _res_conv = *(LDKCResult_NoneBolt11SemanticErrorZ*)(_res_ptr);
28013         FREE(untag_ptr(_res));
28014         CResult_NoneBolt11SemanticErrorZ_free(_res_conv);
28015 }
28016
28017 static inline uint64_t CResult_NoneBolt11SemanticErrorZ_clone_ptr(LDKCResult_NoneBolt11SemanticErrorZ *NONNULL_PTR arg) {
28018         LDKCResult_NoneBolt11SemanticErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneBolt11SemanticErrorZ), "LDKCResult_NoneBolt11SemanticErrorZ");
28019         *ret_conv = CResult_NoneBolt11SemanticErrorZ_clone(arg);
28020         return tag_ptr(ret_conv, true);
28021 }
28022 int64_t  __attribute__((export_name("TS_CResult_NoneBolt11SemanticErrorZ_clone_ptr"))) TS_CResult_NoneBolt11SemanticErrorZ_clone_ptr(uint64_t arg) {
28023         LDKCResult_NoneBolt11SemanticErrorZ* arg_conv = (LDKCResult_NoneBolt11SemanticErrorZ*)untag_ptr(arg);
28024         int64_t ret_conv = CResult_NoneBolt11SemanticErrorZ_clone_ptr(arg_conv);
28025         return ret_conv;
28026 }
28027
28028 uint64_t  __attribute__((export_name("TS_CResult_NoneBolt11SemanticErrorZ_clone"))) TS_CResult_NoneBolt11SemanticErrorZ_clone(uint64_t orig) {
28029         LDKCResult_NoneBolt11SemanticErrorZ* orig_conv = (LDKCResult_NoneBolt11SemanticErrorZ*)untag_ptr(orig);
28030         LDKCResult_NoneBolt11SemanticErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneBolt11SemanticErrorZ), "LDKCResult_NoneBolt11SemanticErrorZ");
28031         *ret_conv = CResult_NoneBolt11SemanticErrorZ_clone(orig_conv);
28032         return tag_ptr(ret_conv, true);
28033 }
28034
28035 uint64_t  __attribute__((export_name("TS_CResult_Bolt11InvoiceBolt11SemanticErrorZ_ok"))) TS_CResult_Bolt11InvoiceBolt11SemanticErrorZ_ok(uint64_t o) {
28036         LDKBolt11Invoice o_conv;
28037         o_conv.inner = untag_ptr(o);
28038         o_conv.is_owned = ptr_is_owned(o);
28039         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
28040         o_conv = Bolt11Invoice_clone(&o_conv);
28041         LDKCResult_Bolt11InvoiceBolt11SemanticErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_Bolt11InvoiceBolt11SemanticErrorZ), "LDKCResult_Bolt11InvoiceBolt11SemanticErrorZ");
28042         *ret_conv = CResult_Bolt11InvoiceBolt11SemanticErrorZ_ok(o_conv);
28043         return tag_ptr(ret_conv, true);
28044 }
28045
28046 uint64_t  __attribute__((export_name("TS_CResult_Bolt11InvoiceBolt11SemanticErrorZ_err"))) TS_CResult_Bolt11InvoiceBolt11SemanticErrorZ_err(uint32_t e) {
28047         LDKBolt11SemanticError e_conv = LDKBolt11SemanticError_from_js(e);
28048         LDKCResult_Bolt11InvoiceBolt11SemanticErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_Bolt11InvoiceBolt11SemanticErrorZ), "LDKCResult_Bolt11InvoiceBolt11SemanticErrorZ");
28049         *ret_conv = CResult_Bolt11InvoiceBolt11SemanticErrorZ_err(e_conv);
28050         return tag_ptr(ret_conv, true);
28051 }
28052
28053 jboolean  __attribute__((export_name("TS_CResult_Bolt11InvoiceBolt11SemanticErrorZ_is_ok"))) TS_CResult_Bolt11InvoiceBolt11SemanticErrorZ_is_ok(uint64_t o) {
28054         LDKCResult_Bolt11InvoiceBolt11SemanticErrorZ* o_conv = (LDKCResult_Bolt11InvoiceBolt11SemanticErrorZ*)untag_ptr(o);
28055         jboolean ret_conv = CResult_Bolt11InvoiceBolt11SemanticErrorZ_is_ok(o_conv);
28056         return ret_conv;
28057 }
28058
28059 void  __attribute__((export_name("TS_CResult_Bolt11InvoiceBolt11SemanticErrorZ_free"))) TS_CResult_Bolt11InvoiceBolt11SemanticErrorZ_free(uint64_t _res) {
28060         if (!ptr_is_owned(_res)) return;
28061         void* _res_ptr = untag_ptr(_res);
28062         CHECK_ACCESS(_res_ptr);
28063         LDKCResult_Bolt11InvoiceBolt11SemanticErrorZ _res_conv = *(LDKCResult_Bolt11InvoiceBolt11SemanticErrorZ*)(_res_ptr);
28064         FREE(untag_ptr(_res));
28065         CResult_Bolt11InvoiceBolt11SemanticErrorZ_free(_res_conv);
28066 }
28067
28068 static inline uint64_t CResult_Bolt11InvoiceBolt11SemanticErrorZ_clone_ptr(LDKCResult_Bolt11InvoiceBolt11SemanticErrorZ *NONNULL_PTR arg) {
28069         LDKCResult_Bolt11InvoiceBolt11SemanticErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_Bolt11InvoiceBolt11SemanticErrorZ), "LDKCResult_Bolt11InvoiceBolt11SemanticErrorZ");
28070         *ret_conv = CResult_Bolt11InvoiceBolt11SemanticErrorZ_clone(arg);
28071         return tag_ptr(ret_conv, true);
28072 }
28073 int64_t  __attribute__((export_name("TS_CResult_Bolt11InvoiceBolt11SemanticErrorZ_clone_ptr"))) TS_CResult_Bolt11InvoiceBolt11SemanticErrorZ_clone_ptr(uint64_t arg) {
28074         LDKCResult_Bolt11InvoiceBolt11SemanticErrorZ* arg_conv = (LDKCResult_Bolt11InvoiceBolt11SemanticErrorZ*)untag_ptr(arg);
28075         int64_t ret_conv = CResult_Bolt11InvoiceBolt11SemanticErrorZ_clone_ptr(arg_conv);
28076         return ret_conv;
28077 }
28078
28079 uint64_t  __attribute__((export_name("TS_CResult_Bolt11InvoiceBolt11SemanticErrorZ_clone"))) TS_CResult_Bolt11InvoiceBolt11SemanticErrorZ_clone(uint64_t orig) {
28080         LDKCResult_Bolt11InvoiceBolt11SemanticErrorZ* orig_conv = (LDKCResult_Bolt11InvoiceBolt11SemanticErrorZ*)untag_ptr(orig);
28081         LDKCResult_Bolt11InvoiceBolt11SemanticErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_Bolt11InvoiceBolt11SemanticErrorZ), "LDKCResult_Bolt11InvoiceBolt11SemanticErrorZ");
28082         *ret_conv = CResult_Bolt11InvoiceBolt11SemanticErrorZ_clone(orig_conv);
28083         return tag_ptr(ret_conv, true);
28084 }
28085
28086 uint64_t  __attribute__((export_name("TS_CResult_DescriptionCreationErrorZ_ok"))) TS_CResult_DescriptionCreationErrorZ_ok(uint64_t o) {
28087         LDKDescription o_conv;
28088         o_conv.inner = untag_ptr(o);
28089         o_conv.is_owned = ptr_is_owned(o);
28090         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
28091         o_conv = Description_clone(&o_conv);
28092         LDKCResult_DescriptionCreationErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_DescriptionCreationErrorZ), "LDKCResult_DescriptionCreationErrorZ");
28093         *ret_conv = CResult_DescriptionCreationErrorZ_ok(o_conv);
28094         return tag_ptr(ret_conv, true);
28095 }
28096
28097 uint64_t  __attribute__((export_name("TS_CResult_DescriptionCreationErrorZ_err"))) TS_CResult_DescriptionCreationErrorZ_err(uint32_t e) {
28098         LDKCreationError e_conv = LDKCreationError_from_js(e);
28099         LDKCResult_DescriptionCreationErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_DescriptionCreationErrorZ), "LDKCResult_DescriptionCreationErrorZ");
28100         *ret_conv = CResult_DescriptionCreationErrorZ_err(e_conv);
28101         return tag_ptr(ret_conv, true);
28102 }
28103
28104 jboolean  __attribute__((export_name("TS_CResult_DescriptionCreationErrorZ_is_ok"))) TS_CResult_DescriptionCreationErrorZ_is_ok(uint64_t o) {
28105         LDKCResult_DescriptionCreationErrorZ* o_conv = (LDKCResult_DescriptionCreationErrorZ*)untag_ptr(o);
28106         jboolean ret_conv = CResult_DescriptionCreationErrorZ_is_ok(o_conv);
28107         return ret_conv;
28108 }
28109
28110 void  __attribute__((export_name("TS_CResult_DescriptionCreationErrorZ_free"))) TS_CResult_DescriptionCreationErrorZ_free(uint64_t _res) {
28111         if (!ptr_is_owned(_res)) return;
28112         void* _res_ptr = untag_ptr(_res);
28113         CHECK_ACCESS(_res_ptr);
28114         LDKCResult_DescriptionCreationErrorZ _res_conv = *(LDKCResult_DescriptionCreationErrorZ*)(_res_ptr);
28115         FREE(untag_ptr(_res));
28116         CResult_DescriptionCreationErrorZ_free(_res_conv);
28117 }
28118
28119 static inline uint64_t CResult_DescriptionCreationErrorZ_clone_ptr(LDKCResult_DescriptionCreationErrorZ *NONNULL_PTR arg) {
28120         LDKCResult_DescriptionCreationErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_DescriptionCreationErrorZ), "LDKCResult_DescriptionCreationErrorZ");
28121         *ret_conv = CResult_DescriptionCreationErrorZ_clone(arg);
28122         return tag_ptr(ret_conv, true);
28123 }
28124 int64_t  __attribute__((export_name("TS_CResult_DescriptionCreationErrorZ_clone_ptr"))) TS_CResult_DescriptionCreationErrorZ_clone_ptr(uint64_t arg) {
28125         LDKCResult_DescriptionCreationErrorZ* arg_conv = (LDKCResult_DescriptionCreationErrorZ*)untag_ptr(arg);
28126         int64_t ret_conv = CResult_DescriptionCreationErrorZ_clone_ptr(arg_conv);
28127         return ret_conv;
28128 }
28129
28130 uint64_t  __attribute__((export_name("TS_CResult_DescriptionCreationErrorZ_clone"))) TS_CResult_DescriptionCreationErrorZ_clone(uint64_t orig) {
28131         LDKCResult_DescriptionCreationErrorZ* orig_conv = (LDKCResult_DescriptionCreationErrorZ*)untag_ptr(orig);
28132         LDKCResult_DescriptionCreationErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_DescriptionCreationErrorZ), "LDKCResult_DescriptionCreationErrorZ");
28133         *ret_conv = CResult_DescriptionCreationErrorZ_clone(orig_conv);
28134         return tag_ptr(ret_conv, true);
28135 }
28136
28137 uint64_t  __attribute__((export_name("TS_CResult_PrivateRouteCreationErrorZ_ok"))) TS_CResult_PrivateRouteCreationErrorZ_ok(uint64_t o) {
28138         LDKPrivateRoute o_conv;
28139         o_conv.inner = untag_ptr(o);
28140         o_conv.is_owned = ptr_is_owned(o);
28141         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
28142         o_conv = PrivateRoute_clone(&o_conv);
28143         LDKCResult_PrivateRouteCreationErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PrivateRouteCreationErrorZ), "LDKCResult_PrivateRouteCreationErrorZ");
28144         *ret_conv = CResult_PrivateRouteCreationErrorZ_ok(o_conv);
28145         return tag_ptr(ret_conv, true);
28146 }
28147
28148 uint64_t  __attribute__((export_name("TS_CResult_PrivateRouteCreationErrorZ_err"))) TS_CResult_PrivateRouteCreationErrorZ_err(uint32_t e) {
28149         LDKCreationError e_conv = LDKCreationError_from_js(e);
28150         LDKCResult_PrivateRouteCreationErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PrivateRouteCreationErrorZ), "LDKCResult_PrivateRouteCreationErrorZ");
28151         *ret_conv = CResult_PrivateRouteCreationErrorZ_err(e_conv);
28152         return tag_ptr(ret_conv, true);
28153 }
28154
28155 jboolean  __attribute__((export_name("TS_CResult_PrivateRouteCreationErrorZ_is_ok"))) TS_CResult_PrivateRouteCreationErrorZ_is_ok(uint64_t o) {
28156         LDKCResult_PrivateRouteCreationErrorZ* o_conv = (LDKCResult_PrivateRouteCreationErrorZ*)untag_ptr(o);
28157         jboolean ret_conv = CResult_PrivateRouteCreationErrorZ_is_ok(o_conv);
28158         return ret_conv;
28159 }
28160
28161 void  __attribute__((export_name("TS_CResult_PrivateRouteCreationErrorZ_free"))) TS_CResult_PrivateRouteCreationErrorZ_free(uint64_t _res) {
28162         if (!ptr_is_owned(_res)) return;
28163         void* _res_ptr = untag_ptr(_res);
28164         CHECK_ACCESS(_res_ptr);
28165         LDKCResult_PrivateRouteCreationErrorZ _res_conv = *(LDKCResult_PrivateRouteCreationErrorZ*)(_res_ptr);
28166         FREE(untag_ptr(_res));
28167         CResult_PrivateRouteCreationErrorZ_free(_res_conv);
28168 }
28169
28170 static inline uint64_t CResult_PrivateRouteCreationErrorZ_clone_ptr(LDKCResult_PrivateRouteCreationErrorZ *NONNULL_PTR arg) {
28171         LDKCResult_PrivateRouteCreationErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PrivateRouteCreationErrorZ), "LDKCResult_PrivateRouteCreationErrorZ");
28172         *ret_conv = CResult_PrivateRouteCreationErrorZ_clone(arg);
28173         return tag_ptr(ret_conv, true);
28174 }
28175 int64_t  __attribute__((export_name("TS_CResult_PrivateRouteCreationErrorZ_clone_ptr"))) TS_CResult_PrivateRouteCreationErrorZ_clone_ptr(uint64_t arg) {
28176         LDKCResult_PrivateRouteCreationErrorZ* arg_conv = (LDKCResult_PrivateRouteCreationErrorZ*)untag_ptr(arg);
28177         int64_t ret_conv = CResult_PrivateRouteCreationErrorZ_clone_ptr(arg_conv);
28178         return ret_conv;
28179 }
28180
28181 uint64_t  __attribute__((export_name("TS_CResult_PrivateRouteCreationErrorZ_clone"))) TS_CResult_PrivateRouteCreationErrorZ_clone(uint64_t orig) {
28182         LDKCResult_PrivateRouteCreationErrorZ* orig_conv = (LDKCResult_PrivateRouteCreationErrorZ*)untag_ptr(orig);
28183         LDKCResult_PrivateRouteCreationErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PrivateRouteCreationErrorZ), "LDKCResult_PrivateRouteCreationErrorZ");
28184         *ret_conv = CResult_PrivateRouteCreationErrorZ_clone(orig_conv);
28185         return tag_ptr(ret_conv, true);
28186 }
28187
28188 uint64_t  __attribute__((export_name("TS_CResult_OutPointDecodeErrorZ_ok"))) TS_CResult_OutPointDecodeErrorZ_ok(uint64_t o) {
28189         LDKOutPoint o_conv;
28190         o_conv.inner = untag_ptr(o);
28191         o_conv.is_owned = ptr_is_owned(o);
28192         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
28193         o_conv = OutPoint_clone(&o_conv);
28194         LDKCResult_OutPointDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_OutPointDecodeErrorZ), "LDKCResult_OutPointDecodeErrorZ");
28195         *ret_conv = CResult_OutPointDecodeErrorZ_ok(o_conv);
28196         return tag_ptr(ret_conv, true);
28197 }
28198
28199 uint64_t  __attribute__((export_name("TS_CResult_OutPointDecodeErrorZ_err"))) TS_CResult_OutPointDecodeErrorZ_err(uint64_t e) {
28200         void* e_ptr = untag_ptr(e);
28201         CHECK_ACCESS(e_ptr);
28202         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
28203         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
28204         LDKCResult_OutPointDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_OutPointDecodeErrorZ), "LDKCResult_OutPointDecodeErrorZ");
28205         *ret_conv = CResult_OutPointDecodeErrorZ_err(e_conv);
28206         return tag_ptr(ret_conv, true);
28207 }
28208
28209 jboolean  __attribute__((export_name("TS_CResult_OutPointDecodeErrorZ_is_ok"))) TS_CResult_OutPointDecodeErrorZ_is_ok(uint64_t o) {
28210         LDKCResult_OutPointDecodeErrorZ* o_conv = (LDKCResult_OutPointDecodeErrorZ*)untag_ptr(o);
28211         jboolean ret_conv = CResult_OutPointDecodeErrorZ_is_ok(o_conv);
28212         return ret_conv;
28213 }
28214
28215 void  __attribute__((export_name("TS_CResult_OutPointDecodeErrorZ_free"))) TS_CResult_OutPointDecodeErrorZ_free(uint64_t _res) {
28216         if (!ptr_is_owned(_res)) return;
28217         void* _res_ptr = untag_ptr(_res);
28218         CHECK_ACCESS(_res_ptr);
28219         LDKCResult_OutPointDecodeErrorZ _res_conv = *(LDKCResult_OutPointDecodeErrorZ*)(_res_ptr);
28220         FREE(untag_ptr(_res));
28221         CResult_OutPointDecodeErrorZ_free(_res_conv);
28222 }
28223
28224 static inline uint64_t CResult_OutPointDecodeErrorZ_clone_ptr(LDKCResult_OutPointDecodeErrorZ *NONNULL_PTR arg) {
28225         LDKCResult_OutPointDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_OutPointDecodeErrorZ), "LDKCResult_OutPointDecodeErrorZ");
28226         *ret_conv = CResult_OutPointDecodeErrorZ_clone(arg);
28227         return tag_ptr(ret_conv, true);
28228 }
28229 int64_t  __attribute__((export_name("TS_CResult_OutPointDecodeErrorZ_clone_ptr"))) TS_CResult_OutPointDecodeErrorZ_clone_ptr(uint64_t arg) {
28230         LDKCResult_OutPointDecodeErrorZ* arg_conv = (LDKCResult_OutPointDecodeErrorZ*)untag_ptr(arg);
28231         int64_t ret_conv = CResult_OutPointDecodeErrorZ_clone_ptr(arg_conv);
28232         return ret_conv;
28233 }
28234
28235 uint64_t  __attribute__((export_name("TS_CResult_OutPointDecodeErrorZ_clone"))) TS_CResult_OutPointDecodeErrorZ_clone(uint64_t orig) {
28236         LDKCResult_OutPointDecodeErrorZ* orig_conv = (LDKCResult_OutPointDecodeErrorZ*)untag_ptr(orig);
28237         LDKCResult_OutPointDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_OutPointDecodeErrorZ), "LDKCResult_OutPointDecodeErrorZ");
28238         *ret_conv = CResult_OutPointDecodeErrorZ_clone(orig_conv);
28239         return tag_ptr(ret_conv, true);
28240 }
28241
28242 uint64_t  __attribute__((export_name("TS_CResult_BigSizeDecodeErrorZ_ok"))) TS_CResult_BigSizeDecodeErrorZ_ok(uint64_t o) {
28243         LDKBigSize o_conv;
28244         o_conv.inner = untag_ptr(o);
28245         o_conv.is_owned = ptr_is_owned(o);
28246         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
28247         o_conv = BigSize_clone(&o_conv);
28248         LDKCResult_BigSizeDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_BigSizeDecodeErrorZ), "LDKCResult_BigSizeDecodeErrorZ");
28249         *ret_conv = CResult_BigSizeDecodeErrorZ_ok(o_conv);
28250         return tag_ptr(ret_conv, true);
28251 }
28252
28253 uint64_t  __attribute__((export_name("TS_CResult_BigSizeDecodeErrorZ_err"))) TS_CResult_BigSizeDecodeErrorZ_err(uint64_t e) {
28254         void* e_ptr = untag_ptr(e);
28255         CHECK_ACCESS(e_ptr);
28256         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
28257         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
28258         LDKCResult_BigSizeDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_BigSizeDecodeErrorZ), "LDKCResult_BigSizeDecodeErrorZ");
28259         *ret_conv = CResult_BigSizeDecodeErrorZ_err(e_conv);
28260         return tag_ptr(ret_conv, true);
28261 }
28262
28263 jboolean  __attribute__((export_name("TS_CResult_BigSizeDecodeErrorZ_is_ok"))) TS_CResult_BigSizeDecodeErrorZ_is_ok(uint64_t o) {
28264         LDKCResult_BigSizeDecodeErrorZ* o_conv = (LDKCResult_BigSizeDecodeErrorZ*)untag_ptr(o);
28265         jboolean ret_conv = CResult_BigSizeDecodeErrorZ_is_ok(o_conv);
28266         return ret_conv;
28267 }
28268
28269 void  __attribute__((export_name("TS_CResult_BigSizeDecodeErrorZ_free"))) TS_CResult_BigSizeDecodeErrorZ_free(uint64_t _res) {
28270         if (!ptr_is_owned(_res)) return;
28271         void* _res_ptr = untag_ptr(_res);
28272         CHECK_ACCESS(_res_ptr);
28273         LDKCResult_BigSizeDecodeErrorZ _res_conv = *(LDKCResult_BigSizeDecodeErrorZ*)(_res_ptr);
28274         FREE(untag_ptr(_res));
28275         CResult_BigSizeDecodeErrorZ_free(_res_conv);
28276 }
28277
28278 static inline uint64_t CResult_BigSizeDecodeErrorZ_clone_ptr(LDKCResult_BigSizeDecodeErrorZ *NONNULL_PTR arg) {
28279         LDKCResult_BigSizeDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_BigSizeDecodeErrorZ), "LDKCResult_BigSizeDecodeErrorZ");
28280         *ret_conv = CResult_BigSizeDecodeErrorZ_clone(arg);
28281         return tag_ptr(ret_conv, true);
28282 }
28283 int64_t  __attribute__((export_name("TS_CResult_BigSizeDecodeErrorZ_clone_ptr"))) TS_CResult_BigSizeDecodeErrorZ_clone_ptr(uint64_t arg) {
28284         LDKCResult_BigSizeDecodeErrorZ* arg_conv = (LDKCResult_BigSizeDecodeErrorZ*)untag_ptr(arg);
28285         int64_t ret_conv = CResult_BigSizeDecodeErrorZ_clone_ptr(arg_conv);
28286         return ret_conv;
28287 }
28288
28289 uint64_t  __attribute__((export_name("TS_CResult_BigSizeDecodeErrorZ_clone"))) TS_CResult_BigSizeDecodeErrorZ_clone(uint64_t orig) {
28290         LDKCResult_BigSizeDecodeErrorZ* orig_conv = (LDKCResult_BigSizeDecodeErrorZ*)untag_ptr(orig);
28291         LDKCResult_BigSizeDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_BigSizeDecodeErrorZ), "LDKCResult_BigSizeDecodeErrorZ");
28292         *ret_conv = CResult_BigSizeDecodeErrorZ_clone(orig_conv);
28293         return tag_ptr(ret_conv, true);
28294 }
28295
28296 uint64_t  __attribute__((export_name("TS_CResult_HostnameDecodeErrorZ_ok"))) TS_CResult_HostnameDecodeErrorZ_ok(uint64_t o) {
28297         LDKHostname o_conv;
28298         o_conv.inner = untag_ptr(o);
28299         o_conv.is_owned = ptr_is_owned(o);
28300         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
28301         o_conv = Hostname_clone(&o_conv);
28302         LDKCResult_HostnameDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_HostnameDecodeErrorZ), "LDKCResult_HostnameDecodeErrorZ");
28303         *ret_conv = CResult_HostnameDecodeErrorZ_ok(o_conv);
28304         return tag_ptr(ret_conv, true);
28305 }
28306
28307 uint64_t  __attribute__((export_name("TS_CResult_HostnameDecodeErrorZ_err"))) TS_CResult_HostnameDecodeErrorZ_err(uint64_t e) {
28308         void* e_ptr = untag_ptr(e);
28309         CHECK_ACCESS(e_ptr);
28310         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
28311         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
28312         LDKCResult_HostnameDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_HostnameDecodeErrorZ), "LDKCResult_HostnameDecodeErrorZ");
28313         *ret_conv = CResult_HostnameDecodeErrorZ_err(e_conv);
28314         return tag_ptr(ret_conv, true);
28315 }
28316
28317 jboolean  __attribute__((export_name("TS_CResult_HostnameDecodeErrorZ_is_ok"))) TS_CResult_HostnameDecodeErrorZ_is_ok(uint64_t o) {
28318         LDKCResult_HostnameDecodeErrorZ* o_conv = (LDKCResult_HostnameDecodeErrorZ*)untag_ptr(o);
28319         jboolean ret_conv = CResult_HostnameDecodeErrorZ_is_ok(o_conv);
28320         return ret_conv;
28321 }
28322
28323 void  __attribute__((export_name("TS_CResult_HostnameDecodeErrorZ_free"))) TS_CResult_HostnameDecodeErrorZ_free(uint64_t _res) {
28324         if (!ptr_is_owned(_res)) return;
28325         void* _res_ptr = untag_ptr(_res);
28326         CHECK_ACCESS(_res_ptr);
28327         LDKCResult_HostnameDecodeErrorZ _res_conv = *(LDKCResult_HostnameDecodeErrorZ*)(_res_ptr);
28328         FREE(untag_ptr(_res));
28329         CResult_HostnameDecodeErrorZ_free(_res_conv);
28330 }
28331
28332 static inline uint64_t CResult_HostnameDecodeErrorZ_clone_ptr(LDKCResult_HostnameDecodeErrorZ *NONNULL_PTR arg) {
28333         LDKCResult_HostnameDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_HostnameDecodeErrorZ), "LDKCResult_HostnameDecodeErrorZ");
28334         *ret_conv = CResult_HostnameDecodeErrorZ_clone(arg);
28335         return tag_ptr(ret_conv, true);
28336 }
28337 int64_t  __attribute__((export_name("TS_CResult_HostnameDecodeErrorZ_clone_ptr"))) TS_CResult_HostnameDecodeErrorZ_clone_ptr(uint64_t arg) {
28338         LDKCResult_HostnameDecodeErrorZ* arg_conv = (LDKCResult_HostnameDecodeErrorZ*)untag_ptr(arg);
28339         int64_t ret_conv = CResult_HostnameDecodeErrorZ_clone_ptr(arg_conv);
28340         return ret_conv;
28341 }
28342
28343 uint64_t  __attribute__((export_name("TS_CResult_HostnameDecodeErrorZ_clone"))) TS_CResult_HostnameDecodeErrorZ_clone(uint64_t orig) {
28344         LDKCResult_HostnameDecodeErrorZ* orig_conv = (LDKCResult_HostnameDecodeErrorZ*)untag_ptr(orig);
28345         LDKCResult_HostnameDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_HostnameDecodeErrorZ), "LDKCResult_HostnameDecodeErrorZ");
28346         *ret_conv = CResult_HostnameDecodeErrorZ_clone(orig_conv);
28347         return tag_ptr(ret_conv, true);
28348 }
28349
28350 uint64_t  __attribute__((export_name("TS_CResult_TransactionU16LenLimitedNoneZ_ok"))) TS_CResult_TransactionU16LenLimitedNoneZ_ok(uint64_t o) {
28351         LDKTransactionU16LenLimited o_conv;
28352         o_conv.inner = untag_ptr(o);
28353         o_conv.is_owned = ptr_is_owned(o);
28354         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
28355         o_conv = TransactionU16LenLimited_clone(&o_conv);
28356         LDKCResult_TransactionU16LenLimitedNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_TransactionU16LenLimitedNoneZ), "LDKCResult_TransactionU16LenLimitedNoneZ");
28357         *ret_conv = CResult_TransactionU16LenLimitedNoneZ_ok(o_conv);
28358         return tag_ptr(ret_conv, true);
28359 }
28360
28361 uint64_t  __attribute__((export_name("TS_CResult_TransactionU16LenLimitedNoneZ_err"))) TS_CResult_TransactionU16LenLimitedNoneZ_err() {
28362         LDKCResult_TransactionU16LenLimitedNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_TransactionU16LenLimitedNoneZ), "LDKCResult_TransactionU16LenLimitedNoneZ");
28363         *ret_conv = CResult_TransactionU16LenLimitedNoneZ_err();
28364         return tag_ptr(ret_conv, true);
28365 }
28366
28367 jboolean  __attribute__((export_name("TS_CResult_TransactionU16LenLimitedNoneZ_is_ok"))) TS_CResult_TransactionU16LenLimitedNoneZ_is_ok(uint64_t o) {
28368         LDKCResult_TransactionU16LenLimitedNoneZ* o_conv = (LDKCResult_TransactionU16LenLimitedNoneZ*)untag_ptr(o);
28369         jboolean ret_conv = CResult_TransactionU16LenLimitedNoneZ_is_ok(o_conv);
28370         return ret_conv;
28371 }
28372
28373 void  __attribute__((export_name("TS_CResult_TransactionU16LenLimitedNoneZ_free"))) TS_CResult_TransactionU16LenLimitedNoneZ_free(uint64_t _res) {
28374         if (!ptr_is_owned(_res)) return;
28375         void* _res_ptr = untag_ptr(_res);
28376         CHECK_ACCESS(_res_ptr);
28377         LDKCResult_TransactionU16LenLimitedNoneZ _res_conv = *(LDKCResult_TransactionU16LenLimitedNoneZ*)(_res_ptr);
28378         FREE(untag_ptr(_res));
28379         CResult_TransactionU16LenLimitedNoneZ_free(_res_conv);
28380 }
28381
28382 static inline uint64_t CResult_TransactionU16LenLimitedNoneZ_clone_ptr(LDKCResult_TransactionU16LenLimitedNoneZ *NONNULL_PTR arg) {
28383         LDKCResult_TransactionU16LenLimitedNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_TransactionU16LenLimitedNoneZ), "LDKCResult_TransactionU16LenLimitedNoneZ");
28384         *ret_conv = CResult_TransactionU16LenLimitedNoneZ_clone(arg);
28385         return tag_ptr(ret_conv, true);
28386 }
28387 int64_t  __attribute__((export_name("TS_CResult_TransactionU16LenLimitedNoneZ_clone_ptr"))) TS_CResult_TransactionU16LenLimitedNoneZ_clone_ptr(uint64_t arg) {
28388         LDKCResult_TransactionU16LenLimitedNoneZ* arg_conv = (LDKCResult_TransactionU16LenLimitedNoneZ*)untag_ptr(arg);
28389         int64_t ret_conv = CResult_TransactionU16LenLimitedNoneZ_clone_ptr(arg_conv);
28390         return ret_conv;
28391 }
28392
28393 uint64_t  __attribute__((export_name("TS_CResult_TransactionU16LenLimitedNoneZ_clone"))) TS_CResult_TransactionU16LenLimitedNoneZ_clone(uint64_t orig) {
28394         LDKCResult_TransactionU16LenLimitedNoneZ* orig_conv = (LDKCResult_TransactionU16LenLimitedNoneZ*)untag_ptr(orig);
28395         LDKCResult_TransactionU16LenLimitedNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_TransactionU16LenLimitedNoneZ), "LDKCResult_TransactionU16LenLimitedNoneZ");
28396         *ret_conv = CResult_TransactionU16LenLimitedNoneZ_clone(orig_conv);
28397         return tag_ptr(ret_conv, true);
28398 }
28399
28400 uint64_t  __attribute__((export_name("TS_CResult_TransactionU16LenLimitedDecodeErrorZ_ok"))) TS_CResult_TransactionU16LenLimitedDecodeErrorZ_ok(uint64_t o) {
28401         LDKTransactionU16LenLimited o_conv;
28402         o_conv.inner = untag_ptr(o);
28403         o_conv.is_owned = ptr_is_owned(o);
28404         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
28405         o_conv = TransactionU16LenLimited_clone(&o_conv);
28406         LDKCResult_TransactionU16LenLimitedDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TransactionU16LenLimitedDecodeErrorZ), "LDKCResult_TransactionU16LenLimitedDecodeErrorZ");
28407         *ret_conv = CResult_TransactionU16LenLimitedDecodeErrorZ_ok(o_conv);
28408         return tag_ptr(ret_conv, true);
28409 }
28410
28411 uint64_t  __attribute__((export_name("TS_CResult_TransactionU16LenLimitedDecodeErrorZ_err"))) TS_CResult_TransactionU16LenLimitedDecodeErrorZ_err(uint64_t e) {
28412         void* e_ptr = untag_ptr(e);
28413         CHECK_ACCESS(e_ptr);
28414         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
28415         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
28416         LDKCResult_TransactionU16LenLimitedDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TransactionU16LenLimitedDecodeErrorZ), "LDKCResult_TransactionU16LenLimitedDecodeErrorZ");
28417         *ret_conv = CResult_TransactionU16LenLimitedDecodeErrorZ_err(e_conv);
28418         return tag_ptr(ret_conv, true);
28419 }
28420
28421 jboolean  __attribute__((export_name("TS_CResult_TransactionU16LenLimitedDecodeErrorZ_is_ok"))) TS_CResult_TransactionU16LenLimitedDecodeErrorZ_is_ok(uint64_t o) {
28422         LDKCResult_TransactionU16LenLimitedDecodeErrorZ* o_conv = (LDKCResult_TransactionU16LenLimitedDecodeErrorZ*)untag_ptr(o);
28423         jboolean ret_conv = CResult_TransactionU16LenLimitedDecodeErrorZ_is_ok(o_conv);
28424         return ret_conv;
28425 }
28426
28427 void  __attribute__((export_name("TS_CResult_TransactionU16LenLimitedDecodeErrorZ_free"))) TS_CResult_TransactionU16LenLimitedDecodeErrorZ_free(uint64_t _res) {
28428         if (!ptr_is_owned(_res)) return;
28429         void* _res_ptr = untag_ptr(_res);
28430         CHECK_ACCESS(_res_ptr);
28431         LDKCResult_TransactionU16LenLimitedDecodeErrorZ _res_conv = *(LDKCResult_TransactionU16LenLimitedDecodeErrorZ*)(_res_ptr);
28432         FREE(untag_ptr(_res));
28433         CResult_TransactionU16LenLimitedDecodeErrorZ_free(_res_conv);
28434 }
28435
28436 static inline uint64_t CResult_TransactionU16LenLimitedDecodeErrorZ_clone_ptr(LDKCResult_TransactionU16LenLimitedDecodeErrorZ *NONNULL_PTR arg) {
28437         LDKCResult_TransactionU16LenLimitedDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TransactionU16LenLimitedDecodeErrorZ), "LDKCResult_TransactionU16LenLimitedDecodeErrorZ");
28438         *ret_conv = CResult_TransactionU16LenLimitedDecodeErrorZ_clone(arg);
28439         return tag_ptr(ret_conv, true);
28440 }
28441 int64_t  __attribute__((export_name("TS_CResult_TransactionU16LenLimitedDecodeErrorZ_clone_ptr"))) TS_CResult_TransactionU16LenLimitedDecodeErrorZ_clone_ptr(uint64_t arg) {
28442         LDKCResult_TransactionU16LenLimitedDecodeErrorZ* arg_conv = (LDKCResult_TransactionU16LenLimitedDecodeErrorZ*)untag_ptr(arg);
28443         int64_t ret_conv = CResult_TransactionU16LenLimitedDecodeErrorZ_clone_ptr(arg_conv);
28444         return ret_conv;
28445 }
28446
28447 uint64_t  __attribute__((export_name("TS_CResult_TransactionU16LenLimitedDecodeErrorZ_clone"))) TS_CResult_TransactionU16LenLimitedDecodeErrorZ_clone(uint64_t orig) {
28448         LDKCResult_TransactionU16LenLimitedDecodeErrorZ* orig_conv = (LDKCResult_TransactionU16LenLimitedDecodeErrorZ*)untag_ptr(orig);
28449         LDKCResult_TransactionU16LenLimitedDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TransactionU16LenLimitedDecodeErrorZ), "LDKCResult_TransactionU16LenLimitedDecodeErrorZ");
28450         *ret_conv = CResult_TransactionU16LenLimitedDecodeErrorZ_clone(orig_conv);
28451         return tag_ptr(ret_conv, true);
28452 }
28453
28454 uint64_t  __attribute__((export_name("TS_CResult_UntrustedStringDecodeErrorZ_ok"))) TS_CResult_UntrustedStringDecodeErrorZ_ok(uint64_t o) {
28455         LDKUntrustedString o_conv;
28456         o_conv.inner = untag_ptr(o);
28457         o_conv.is_owned = ptr_is_owned(o);
28458         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
28459         o_conv = UntrustedString_clone(&o_conv);
28460         LDKCResult_UntrustedStringDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UntrustedStringDecodeErrorZ), "LDKCResult_UntrustedStringDecodeErrorZ");
28461         *ret_conv = CResult_UntrustedStringDecodeErrorZ_ok(o_conv);
28462         return tag_ptr(ret_conv, true);
28463 }
28464
28465 uint64_t  __attribute__((export_name("TS_CResult_UntrustedStringDecodeErrorZ_err"))) TS_CResult_UntrustedStringDecodeErrorZ_err(uint64_t e) {
28466         void* e_ptr = untag_ptr(e);
28467         CHECK_ACCESS(e_ptr);
28468         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
28469         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
28470         LDKCResult_UntrustedStringDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UntrustedStringDecodeErrorZ), "LDKCResult_UntrustedStringDecodeErrorZ");
28471         *ret_conv = CResult_UntrustedStringDecodeErrorZ_err(e_conv);
28472         return tag_ptr(ret_conv, true);
28473 }
28474
28475 jboolean  __attribute__((export_name("TS_CResult_UntrustedStringDecodeErrorZ_is_ok"))) TS_CResult_UntrustedStringDecodeErrorZ_is_ok(uint64_t o) {
28476         LDKCResult_UntrustedStringDecodeErrorZ* o_conv = (LDKCResult_UntrustedStringDecodeErrorZ*)untag_ptr(o);
28477         jboolean ret_conv = CResult_UntrustedStringDecodeErrorZ_is_ok(o_conv);
28478         return ret_conv;
28479 }
28480
28481 void  __attribute__((export_name("TS_CResult_UntrustedStringDecodeErrorZ_free"))) TS_CResult_UntrustedStringDecodeErrorZ_free(uint64_t _res) {
28482         if (!ptr_is_owned(_res)) return;
28483         void* _res_ptr = untag_ptr(_res);
28484         CHECK_ACCESS(_res_ptr);
28485         LDKCResult_UntrustedStringDecodeErrorZ _res_conv = *(LDKCResult_UntrustedStringDecodeErrorZ*)(_res_ptr);
28486         FREE(untag_ptr(_res));
28487         CResult_UntrustedStringDecodeErrorZ_free(_res_conv);
28488 }
28489
28490 static inline uint64_t CResult_UntrustedStringDecodeErrorZ_clone_ptr(LDKCResult_UntrustedStringDecodeErrorZ *NONNULL_PTR arg) {
28491         LDKCResult_UntrustedStringDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UntrustedStringDecodeErrorZ), "LDKCResult_UntrustedStringDecodeErrorZ");
28492         *ret_conv = CResult_UntrustedStringDecodeErrorZ_clone(arg);
28493         return tag_ptr(ret_conv, true);
28494 }
28495 int64_t  __attribute__((export_name("TS_CResult_UntrustedStringDecodeErrorZ_clone_ptr"))) TS_CResult_UntrustedStringDecodeErrorZ_clone_ptr(uint64_t arg) {
28496         LDKCResult_UntrustedStringDecodeErrorZ* arg_conv = (LDKCResult_UntrustedStringDecodeErrorZ*)untag_ptr(arg);
28497         int64_t ret_conv = CResult_UntrustedStringDecodeErrorZ_clone_ptr(arg_conv);
28498         return ret_conv;
28499 }
28500
28501 uint64_t  __attribute__((export_name("TS_CResult_UntrustedStringDecodeErrorZ_clone"))) TS_CResult_UntrustedStringDecodeErrorZ_clone(uint64_t orig) {
28502         LDKCResult_UntrustedStringDecodeErrorZ* orig_conv = (LDKCResult_UntrustedStringDecodeErrorZ*)untag_ptr(orig);
28503         LDKCResult_UntrustedStringDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UntrustedStringDecodeErrorZ), "LDKCResult_UntrustedStringDecodeErrorZ");
28504         *ret_conv = CResult_UntrustedStringDecodeErrorZ_clone(orig_conv);
28505         return tag_ptr(ret_conv, true);
28506 }
28507
28508 uint64_t  __attribute__((export_name("TS_CResult_ReceiveTlvsDecodeErrorZ_ok"))) TS_CResult_ReceiveTlvsDecodeErrorZ_ok(uint64_t o) {
28509         LDKReceiveTlvs o_conv;
28510         o_conv.inner = untag_ptr(o);
28511         o_conv.is_owned = ptr_is_owned(o);
28512         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
28513         o_conv = ReceiveTlvs_clone(&o_conv);
28514         LDKCResult_ReceiveTlvsDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ReceiveTlvsDecodeErrorZ), "LDKCResult_ReceiveTlvsDecodeErrorZ");
28515         *ret_conv = CResult_ReceiveTlvsDecodeErrorZ_ok(o_conv);
28516         return tag_ptr(ret_conv, true);
28517 }
28518
28519 uint64_t  __attribute__((export_name("TS_CResult_ReceiveTlvsDecodeErrorZ_err"))) TS_CResult_ReceiveTlvsDecodeErrorZ_err(uint64_t e) {
28520         void* e_ptr = untag_ptr(e);
28521         CHECK_ACCESS(e_ptr);
28522         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
28523         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
28524         LDKCResult_ReceiveTlvsDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ReceiveTlvsDecodeErrorZ), "LDKCResult_ReceiveTlvsDecodeErrorZ");
28525         *ret_conv = CResult_ReceiveTlvsDecodeErrorZ_err(e_conv);
28526         return tag_ptr(ret_conv, true);
28527 }
28528
28529 jboolean  __attribute__((export_name("TS_CResult_ReceiveTlvsDecodeErrorZ_is_ok"))) TS_CResult_ReceiveTlvsDecodeErrorZ_is_ok(uint64_t o) {
28530         LDKCResult_ReceiveTlvsDecodeErrorZ* o_conv = (LDKCResult_ReceiveTlvsDecodeErrorZ*)untag_ptr(o);
28531         jboolean ret_conv = CResult_ReceiveTlvsDecodeErrorZ_is_ok(o_conv);
28532         return ret_conv;
28533 }
28534
28535 void  __attribute__((export_name("TS_CResult_ReceiveTlvsDecodeErrorZ_free"))) TS_CResult_ReceiveTlvsDecodeErrorZ_free(uint64_t _res) {
28536         if (!ptr_is_owned(_res)) return;
28537         void* _res_ptr = untag_ptr(_res);
28538         CHECK_ACCESS(_res_ptr);
28539         LDKCResult_ReceiveTlvsDecodeErrorZ _res_conv = *(LDKCResult_ReceiveTlvsDecodeErrorZ*)(_res_ptr);
28540         FREE(untag_ptr(_res));
28541         CResult_ReceiveTlvsDecodeErrorZ_free(_res_conv);
28542 }
28543
28544 static inline uint64_t CResult_ReceiveTlvsDecodeErrorZ_clone_ptr(LDKCResult_ReceiveTlvsDecodeErrorZ *NONNULL_PTR arg) {
28545         LDKCResult_ReceiveTlvsDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ReceiveTlvsDecodeErrorZ), "LDKCResult_ReceiveTlvsDecodeErrorZ");
28546         *ret_conv = CResult_ReceiveTlvsDecodeErrorZ_clone(arg);
28547         return tag_ptr(ret_conv, true);
28548 }
28549 int64_t  __attribute__((export_name("TS_CResult_ReceiveTlvsDecodeErrorZ_clone_ptr"))) TS_CResult_ReceiveTlvsDecodeErrorZ_clone_ptr(uint64_t arg) {
28550         LDKCResult_ReceiveTlvsDecodeErrorZ* arg_conv = (LDKCResult_ReceiveTlvsDecodeErrorZ*)untag_ptr(arg);
28551         int64_t ret_conv = CResult_ReceiveTlvsDecodeErrorZ_clone_ptr(arg_conv);
28552         return ret_conv;
28553 }
28554
28555 uint64_t  __attribute__((export_name("TS_CResult_ReceiveTlvsDecodeErrorZ_clone"))) TS_CResult_ReceiveTlvsDecodeErrorZ_clone(uint64_t orig) {
28556         LDKCResult_ReceiveTlvsDecodeErrorZ* orig_conv = (LDKCResult_ReceiveTlvsDecodeErrorZ*)untag_ptr(orig);
28557         LDKCResult_ReceiveTlvsDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ReceiveTlvsDecodeErrorZ), "LDKCResult_ReceiveTlvsDecodeErrorZ");
28558         *ret_conv = CResult_ReceiveTlvsDecodeErrorZ_clone(orig_conv);
28559         return tag_ptr(ret_conv, true);
28560 }
28561
28562 uint64_t  __attribute__((export_name("TS_CResult_PaymentRelayDecodeErrorZ_ok"))) TS_CResult_PaymentRelayDecodeErrorZ_ok(uint64_t o) {
28563         LDKPaymentRelay o_conv;
28564         o_conv.inner = untag_ptr(o);
28565         o_conv.is_owned = ptr_is_owned(o);
28566         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
28567         o_conv = PaymentRelay_clone(&o_conv);
28568         LDKCResult_PaymentRelayDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PaymentRelayDecodeErrorZ), "LDKCResult_PaymentRelayDecodeErrorZ");
28569         *ret_conv = CResult_PaymentRelayDecodeErrorZ_ok(o_conv);
28570         return tag_ptr(ret_conv, true);
28571 }
28572
28573 uint64_t  __attribute__((export_name("TS_CResult_PaymentRelayDecodeErrorZ_err"))) TS_CResult_PaymentRelayDecodeErrorZ_err(uint64_t e) {
28574         void* e_ptr = untag_ptr(e);
28575         CHECK_ACCESS(e_ptr);
28576         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
28577         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
28578         LDKCResult_PaymentRelayDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PaymentRelayDecodeErrorZ), "LDKCResult_PaymentRelayDecodeErrorZ");
28579         *ret_conv = CResult_PaymentRelayDecodeErrorZ_err(e_conv);
28580         return tag_ptr(ret_conv, true);
28581 }
28582
28583 jboolean  __attribute__((export_name("TS_CResult_PaymentRelayDecodeErrorZ_is_ok"))) TS_CResult_PaymentRelayDecodeErrorZ_is_ok(uint64_t o) {
28584         LDKCResult_PaymentRelayDecodeErrorZ* o_conv = (LDKCResult_PaymentRelayDecodeErrorZ*)untag_ptr(o);
28585         jboolean ret_conv = CResult_PaymentRelayDecodeErrorZ_is_ok(o_conv);
28586         return ret_conv;
28587 }
28588
28589 void  __attribute__((export_name("TS_CResult_PaymentRelayDecodeErrorZ_free"))) TS_CResult_PaymentRelayDecodeErrorZ_free(uint64_t _res) {
28590         if (!ptr_is_owned(_res)) return;
28591         void* _res_ptr = untag_ptr(_res);
28592         CHECK_ACCESS(_res_ptr);
28593         LDKCResult_PaymentRelayDecodeErrorZ _res_conv = *(LDKCResult_PaymentRelayDecodeErrorZ*)(_res_ptr);
28594         FREE(untag_ptr(_res));
28595         CResult_PaymentRelayDecodeErrorZ_free(_res_conv);
28596 }
28597
28598 static inline uint64_t CResult_PaymentRelayDecodeErrorZ_clone_ptr(LDKCResult_PaymentRelayDecodeErrorZ *NONNULL_PTR arg) {
28599         LDKCResult_PaymentRelayDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PaymentRelayDecodeErrorZ), "LDKCResult_PaymentRelayDecodeErrorZ");
28600         *ret_conv = CResult_PaymentRelayDecodeErrorZ_clone(arg);
28601         return tag_ptr(ret_conv, true);
28602 }
28603 int64_t  __attribute__((export_name("TS_CResult_PaymentRelayDecodeErrorZ_clone_ptr"))) TS_CResult_PaymentRelayDecodeErrorZ_clone_ptr(uint64_t arg) {
28604         LDKCResult_PaymentRelayDecodeErrorZ* arg_conv = (LDKCResult_PaymentRelayDecodeErrorZ*)untag_ptr(arg);
28605         int64_t ret_conv = CResult_PaymentRelayDecodeErrorZ_clone_ptr(arg_conv);
28606         return ret_conv;
28607 }
28608
28609 uint64_t  __attribute__((export_name("TS_CResult_PaymentRelayDecodeErrorZ_clone"))) TS_CResult_PaymentRelayDecodeErrorZ_clone(uint64_t orig) {
28610         LDKCResult_PaymentRelayDecodeErrorZ* orig_conv = (LDKCResult_PaymentRelayDecodeErrorZ*)untag_ptr(orig);
28611         LDKCResult_PaymentRelayDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PaymentRelayDecodeErrorZ), "LDKCResult_PaymentRelayDecodeErrorZ");
28612         *ret_conv = CResult_PaymentRelayDecodeErrorZ_clone(orig_conv);
28613         return tag_ptr(ret_conv, true);
28614 }
28615
28616 uint64_t  __attribute__((export_name("TS_CResult_PaymentConstraintsDecodeErrorZ_ok"))) TS_CResult_PaymentConstraintsDecodeErrorZ_ok(uint64_t o) {
28617         LDKPaymentConstraints o_conv;
28618         o_conv.inner = untag_ptr(o);
28619         o_conv.is_owned = ptr_is_owned(o);
28620         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
28621         o_conv = PaymentConstraints_clone(&o_conv);
28622         LDKCResult_PaymentConstraintsDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PaymentConstraintsDecodeErrorZ), "LDKCResult_PaymentConstraintsDecodeErrorZ");
28623         *ret_conv = CResult_PaymentConstraintsDecodeErrorZ_ok(o_conv);
28624         return tag_ptr(ret_conv, true);
28625 }
28626
28627 uint64_t  __attribute__((export_name("TS_CResult_PaymentConstraintsDecodeErrorZ_err"))) TS_CResult_PaymentConstraintsDecodeErrorZ_err(uint64_t e) {
28628         void* e_ptr = untag_ptr(e);
28629         CHECK_ACCESS(e_ptr);
28630         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
28631         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
28632         LDKCResult_PaymentConstraintsDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PaymentConstraintsDecodeErrorZ), "LDKCResult_PaymentConstraintsDecodeErrorZ");
28633         *ret_conv = CResult_PaymentConstraintsDecodeErrorZ_err(e_conv);
28634         return tag_ptr(ret_conv, true);
28635 }
28636
28637 jboolean  __attribute__((export_name("TS_CResult_PaymentConstraintsDecodeErrorZ_is_ok"))) TS_CResult_PaymentConstraintsDecodeErrorZ_is_ok(uint64_t o) {
28638         LDKCResult_PaymentConstraintsDecodeErrorZ* o_conv = (LDKCResult_PaymentConstraintsDecodeErrorZ*)untag_ptr(o);
28639         jboolean ret_conv = CResult_PaymentConstraintsDecodeErrorZ_is_ok(o_conv);
28640         return ret_conv;
28641 }
28642
28643 void  __attribute__((export_name("TS_CResult_PaymentConstraintsDecodeErrorZ_free"))) TS_CResult_PaymentConstraintsDecodeErrorZ_free(uint64_t _res) {
28644         if (!ptr_is_owned(_res)) return;
28645         void* _res_ptr = untag_ptr(_res);
28646         CHECK_ACCESS(_res_ptr);
28647         LDKCResult_PaymentConstraintsDecodeErrorZ _res_conv = *(LDKCResult_PaymentConstraintsDecodeErrorZ*)(_res_ptr);
28648         FREE(untag_ptr(_res));
28649         CResult_PaymentConstraintsDecodeErrorZ_free(_res_conv);
28650 }
28651
28652 static inline uint64_t CResult_PaymentConstraintsDecodeErrorZ_clone_ptr(LDKCResult_PaymentConstraintsDecodeErrorZ *NONNULL_PTR arg) {
28653         LDKCResult_PaymentConstraintsDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PaymentConstraintsDecodeErrorZ), "LDKCResult_PaymentConstraintsDecodeErrorZ");
28654         *ret_conv = CResult_PaymentConstraintsDecodeErrorZ_clone(arg);
28655         return tag_ptr(ret_conv, true);
28656 }
28657 int64_t  __attribute__((export_name("TS_CResult_PaymentConstraintsDecodeErrorZ_clone_ptr"))) TS_CResult_PaymentConstraintsDecodeErrorZ_clone_ptr(uint64_t arg) {
28658         LDKCResult_PaymentConstraintsDecodeErrorZ* arg_conv = (LDKCResult_PaymentConstraintsDecodeErrorZ*)untag_ptr(arg);
28659         int64_t ret_conv = CResult_PaymentConstraintsDecodeErrorZ_clone_ptr(arg_conv);
28660         return ret_conv;
28661 }
28662
28663 uint64_t  __attribute__((export_name("TS_CResult_PaymentConstraintsDecodeErrorZ_clone"))) TS_CResult_PaymentConstraintsDecodeErrorZ_clone(uint64_t orig) {
28664         LDKCResult_PaymentConstraintsDecodeErrorZ* orig_conv = (LDKCResult_PaymentConstraintsDecodeErrorZ*)untag_ptr(orig);
28665         LDKCResult_PaymentConstraintsDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PaymentConstraintsDecodeErrorZ), "LDKCResult_PaymentConstraintsDecodeErrorZ");
28666         *ret_conv = CResult_PaymentConstraintsDecodeErrorZ_clone(orig_conv);
28667         return tag_ptr(ret_conv, true);
28668 }
28669
28670 uint64_t  __attribute__((export_name("TS_CResult_ThirtyTwoBytesPaymentErrorZ_ok"))) TS_CResult_ThirtyTwoBytesPaymentErrorZ_ok(int8_tArray o) {
28671         LDKThirtyTwoBytes o_ref;
28672         CHECK(o->arr_len == 32);
28673         memcpy(o_ref.data, o->elems, 32); FREE(o);
28674         LDKCResult_ThirtyTwoBytesPaymentErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ThirtyTwoBytesPaymentErrorZ), "LDKCResult_ThirtyTwoBytesPaymentErrorZ");
28675         *ret_conv = CResult_ThirtyTwoBytesPaymentErrorZ_ok(o_ref);
28676         return tag_ptr(ret_conv, true);
28677 }
28678
28679 uint64_t  __attribute__((export_name("TS_CResult_ThirtyTwoBytesPaymentErrorZ_err"))) TS_CResult_ThirtyTwoBytesPaymentErrorZ_err(uint64_t e) {
28680         void* e_ptr = untag_ptr(e);
28681         CHECK_ACCESS(e_ptr);
28682         LDKPaymentError e_conv = *(LDKPaymentError*)(e_ptr);
28683         e_conv = PaymentError_clone((LDKPaymentError*)untag_ptr(e));
28684         LDKCResult_ThirtyTwoBytesPaymentErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ThirtyTwoBytesPaymentErrorZ), "LDKCResult_ThirtyTwoBytesPaymentErrorZ");
28685         *ret_conv = CResult_ThirtyTwoBytesPaymentErrorZ_err(e_conv);
28686         return tag_ptr(ret_conv, true);
28687 }
28688
28689 jboolean  __attribute__((export_name("TS_CResult_ThirtyTwoBytesPaymentErrorZ_is_ok"))) TS_CResult_ThirtyTwoBytesPaymentErrorZ_is_ok(uint64_t o) {
28690         LDKCResult_ThirtyTwoBytesPaymentErrorZ* o_conv = (LDKCResult_ThirtyTwoBytesPaymentErrorZ*)untag_ptr(o);
28691         jboolean ret_conv = CResult_ThirtyTwoBytesPaymentErrorZ_is_ok(o_conv);
28692         return ret_conv;
28693 }
28694
28695 void  __attribute__((export_name("TS_CResult_ThirtyTwoBytesPaymentErrorZ_free"))) TS_CResult_ThirtyTwoBytesPaymentErrorZ_free(uint64_t _res) {
28696         if (!ptr_is_owned(_res)) return;
28697         void* _res_ptr = untag_ptr(_res);
28698         CHECK_ACCESS(_res_ptr);
28699         LDKCResult_ThirtyTwoBytesPaymentErrorZ _res_conv = *(LDKCResult_ThirtyTwoBytesPaymentErrorZ*)(_res_ptr);
28700         FREE(untag_ptr(_res));
28701         CResult_ThirtyTwoBytesPaymentErrorZ_free(_res_conv);
28702 }
28703
28704 static inline uint64_t CResult_ThirtyTwoBytesPaymentErrorZ_clone_ptr(LDKCResult_ThirtyTwoBytesPaymentErrorZ *NONNULL_PTR arg) {
28705         LDKCResult_ThirtyTwoBytesPaymentErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ThirtyTwoBytesPaymentErrorZ), "LDKCResult_ThirtyTwoBytesPaymentErrorZ");
28706         *ret_conv = CResult_ThirtyTwoBytesPaymentErrorZ_clone(arg);
28707         return tag_ptr(ret_conv, true);
28708 }
28709 int64_t  __attribute__((export_name("TS_CResult_ThirtyTwoBytesPaymentErrorZ_clone_ptr"))) TS_CResult_ThirtyTwoBytesPaymentErrorZ_clone_ptr(uint64_t arg) {
28710         LDKCResult_ThirtyTwoBytesPaymentErrorZ* arg_conv = (LDKCResult_ThirtyTwoBytesPaymentErrorZ*)untag_ptr(arg);
28711         int64_t ret_conv = CResult_ThirtyTwoBytesPaymentErrorZ_clone_ptr(arg_conv);
28712         return ret_conv;
28713 }
28714
28715 uint64_t  __attribute__((export_name("TS_CResult_ThirtyTwoBytesPaymentErrorZ_clone"))) TS_CResult_ThirtyTwoBytesPaymentErrorZ_clone(uint64_t orig) {
28716         LDKCResult_ThirtyTwoBytesPaymentErrorZ* orig_conv = (LDKCResult_ThirtyTwoBytesPaymentErrorZ*)untag_ptr(orig);
28717         LDKCResult_ThirtyTwoBytesPaymentErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ThirtyTwoBytesPaymentErrorZ), "LDKCResult_ThirtyTwoBytesPaymentErrorZ");
28718         *ret_conv = CResult_ThirtyTwoBytesPaymentErrorZ_clone(orig_conv);
28719         return tag_ptr(ret_conv, true);
28720 }
28721
28722 uint64_t  __attribute__((export_name("TS_CResult_NonePaymentErrorZ_ok"))) TS_CResult_NonePaymentErrorZ_ok() {
28723         LDKCResult_NonePaymentErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NonePaymentErrorZ), "LDKCResult_NonePaymentErrorZ");
28724         *ret_conv = CResult_NonePaymentErrorZ_ok();
28725         return tag_ptr(ret_conv, true);
28726 }
28727
28728 uint64_t  __attribute__((export_name("TS_CResult_NonePaymentErrorZ_err"))) TS_CResult_NonePaymentErrorZ_err(uint64_t e) {
28729         void* e_ptr = untag_ptr(e);
28730         CHECK_ACCESS(e_ptr);
28731         LDKPaymentError e_conv = *(LDKPaymentError*)(e_ptr);
28732         e_conv = PaymentError_clone((LDKPaymentError*)untag_ptr(e));
28733         LDKCResult_NonePaymentErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NonePaymentErrorZ), "LDKCResult_NonePaymentErrorZ");
28734         *ret_conv = CResult_NonePaymentErrorZ_err(e_conv);
28735         return tag_ptr(ret_conv, true);
28736 }
28737
28738 jboolean  __attribute__((export_name("TS_CResult_NonePaymentErrorZ_is_ok"))) TS_CResult_NonePaymentErrorZ_is_ok(uint64_t o) {
28739         LDKCResult_NonePaymentErrorZ* o_conv = (LDKCResult_NonePaymentErrorZ*)untag_ptr(o);
28740         jboolean ret_conv = CResult_NonePaymentErrorZ_is_ok(o_conv);
28741         return ret_conv;
28742 }
28743
28744 void  __attribute__((export_name("TS_CResult_NonePaymentErrorZ_free"))) TS_CResult_NonePaymentErrorZ_free(uint64_t _res) {
28745         if (!ptr_is_owned(_res)) return;
28746         void* _res_ptr = untag_ptr(_res);
28747         CHECK_ACCESS(_res_ptr);
28748         LDKCResult_NonePaymentErrorZ _res_conv = *(LDKCResult_NonePaymentErrorZ*)(_res_ptr);
28749         FREE(untag_ptr(_res));
28750         CResult_NonePaymentErrorZ_free(_res_conv);
28751 }
28752
28753 static inline uint64_t CResult_NonePaymentErrorZ_clone_ptr(LDKCResult_NonePaymentErrorZ *NONNULL_PTR arg) {
28754         LDKCResult_NonePaymentErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NonePaymentErrorZ), "LDKCResult_NonePaymentErrorZ");
28755         *ret_conv = CResult_NonePaymentErrorZ_clone(arg);
28756         return tag_ptr(ret_conv, true);
28757 }
28758 int64_t  __attribute__((export_name("TS_CResult_NonePaymentErrorZ_clone_ptr"))) TS_CResult_NonePaymentErrorZ_clone_ptr(uint64_t arg) {
28759         LDKCResult_NonePaymentErrorZ* arg_conv = (LDKCResult_NonePaymentErrorZ*)untag_ptr(arg);
28760         int64_t ret_conv = CResult_NonePaymentErrorZ_clone_ptr(arg_conv);
28761         return ret_conv;
28762 }
28763
28764 uint64_t  __attribute__((export_name("TS_CResult_NonePaymentErrorZ_clone"))) TS_CResult_NonePaymentErrorZ_clone(uint64_t orig) {
28765         LDKCResult_NonePaymentErrorZ* orig_conv = (LDKCResult_NonePaymentErrorZ*)untag_ptr(orig);
28766         LDKCResult_NonePaymentErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NonePaymentErrorZ), "LDKCResult_NonePaymentErrorZ");
28767         *ret_conv = CResult_NonePaymentErrorZ_clone(orig_conv);
28768         return tag_ptr(ret_conv, true);
28769 }
28770
28771 uint64_t  __attribute__((export_name("TS_CResult_CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZProbingErrorZ_ok"))) TS_CResult_CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZProbingErrorZ_ok(uint64_tArray o) {
28772         LDKCVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZ o_constr;
28773         o_constr.datalen = o->arr_len;
28774         if (o_constr.datalen > 0)
28775                 o_constr.data = MALLOC(o_constr.datalen * sizeof(LDKC2Tuple_ThirtyTwoBytesThirtyTwoBytesZ), "LDKCVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZ Elements");
28776         else
28777                 o_constr.data = NULL;
28778         uint64_t* o_vals = o->elems;
28779         for (size_t o = 0; o < o_constr.datalen; o++) {
28780                 uint64_t o_conv_40 = o_vals[o];
28781                 void* o_conv_40_ptr = untag_ptr(o_conv_40);
28782                 CHECK_ACCESS(o_conv_40_ptr);
28783                 LDKC2Tuple_ThirtyTwoBytesThirtyTwoBytesZ o_conv_40_conv = *(LDKC2Tuple_ThirtyTwoBytesThirtyTwoBytesZ*)(o_conv_40_ptr);
28784                 o_conv_40_conv = C2Tuple_ThirtyTwoBytesThirtyTwoBytesZ_clone((LDKC2Tuple_ThirtyTwoBytesThirtyTwoBytesZ*)untag_ptr(o_conv_40));
28785                 o_constr.data[o] = o_conv_40_conv;
28786         }
28787         FREE(o);
28788         LDKCResult_CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZProbingErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZProbingErrorZ), "LDKCResult_CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZProbingErrorZ");
28789         *ret_conv = CResult_CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZProbingErrorZ_ok(o_constr);
28790         return tag_ptr(ret_conv, true);
28791 }
28792
28793 uint64_t  __attribute__((export_name("TS_CResult_CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZProbingErrorZ_err"))) TS_CResult_CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZProbingErrorZ_err(uint64_t e) {
28794         void* e_ptr = untag_ptr(e);
28795         CHECK_ACCESS(e_ptr);
28796         LDKProbingError e_conv = *(LDKProbingError*)(e_ptr);
28797         e_conv = ProbingError_clone((LDKProbingError*)untag_ptr(e));
28798         LDKCResult_CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZProbingErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZProbingErrorZ), "LDKCResult_CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZProbingErrorZ");
28799         *ret_conv = CResult_CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZProbingErrorZ_err(e_conv);
28800         return tag_ptr(ret_conv, true);
28801 }
28802
28803 jboolean  __attribute__((export_name("TS_CResult_CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZProbingErrorZ_is_ok"))) TS_CResult_CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZProbingErrorZ_is_ok(uint64_t o) {
28804         LDKCResult_CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZProbingErrorZ* o_conv = (LDKCResult_CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZProbingErrorZ*)untag_ptr(o);
28805         jboolean ret_conv = CResult_CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZProbingErrorZ_is_ok(o_conv);
28806         return ret_conv;
28807 }
28808
28809 void  __attribute__((export_name("TS_CResult_CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZProbingErrorZ_free"))) TS_CResult_CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZProbingErrorZ_free(uint64_t _res) {
28810         if (!ptr_is_owned(_res)) return;
28811         void* _res_ptr = untag_ptr(_res);
28812         CHECK_ACCESS(_res_ptr);
28813         LDKCResult_CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZProbingErrorZ _res_conv = *(LDKCResult_CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZProbingErrorZ*)(_res_ptr);
28814         FREE(untag_ptr(_res));
28815         CResult_CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZProbingErrorZ_free(_res_conv);
28816 }
28817
28818 static inline uint64_t CResult_CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZProbingErrorZ_clone_ptr(LDKCResult_CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZProbingErrorZ *NONNULL_PTR arg) {
28819         LDKCResult_CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZProbingErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZProbingErrorZ), "LDKCResult_CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZProbingErrorZ");
28820         *ret_conv = CResult_CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZProbingErrorZ_clone(arg);
28821         return tag_ptr(ret_conv, true);
28822 }
28823 int64_t  __attribute__((export_name("TS_CResult_CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZProbingErrorZ_clone_ptr"))) TS_CResult_CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZProbingErrorZ_clone_ptr(uint64_t arg) {
28824         LDKCResult_CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZProbingErrorZ* arg_conv = (LDKCResult_CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZProbingErrorZ*)untag_ptr(arg);
28825         int64_t ret_conv = CResult_CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZProbingErrorZ_clone_ptr(arg_conv);
28826         return ret_conv;
28827 }
28828
28829 uint64_t  __attribute__((export_name("TS_CResult_CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZProbingErrorZ_clone"))) TS_CResult_CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZProbingErrorZ_clone(uint64_t orig) {
28830         LDKCResult_CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZProbingErrorZ* orig_conv = (LDKCResult_CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZProbingErrorZ*)untag_ptr(orig);
28831         LDKCResult_CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZProbingErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZProbingErrorZ), "LDKCResult_CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZProbingErrorZ");
28832         *ret_conv = CResult_CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZProbingErrorZ_clone(orig_conv);
28833         return tag_ptr(ret_conv, true);
28834 }
28835
28836 uint64_t  __attribute__((export_name("TS_CResult_StrSecp256k1ErrorZ_ok"))) TS_CResult_StrSecp256k1ErrorZ_ok(jstring o) {
28837         LDKStr o_conv = str_ref_to_owned_c(o);
28838         LDKCResult_StrSecp256k1ErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_StrSecp256k1ErrorZ), "LDKCResult_StrSecp256k1ErrorZ");
28839         *ret_conv = CResult_StrSecp256k1ErrorZ_ok(o_conv);
28840         return tag_ptr(ret_conv, true);
28841 }
28842
28843 uint64_t  __attribute__((export_name("TS_CResult_StrSecp256k1ErrorZ_err"))) TS_CResult_StrSecp256k1ErrorZ_err(uint32_t e) {
28844         LDKSecp256k1Error e_conv = LDKSecp256k1Error_from_js(e);
28845         LDKCResult_StrSecp256k1ErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_StrSecp256k1ErrorZ), "LDKCResult_StrSecp256k1ErrorZ");
28846         *ret_conv = CResult_StrSecp256k1ErrorZ_err(e_conv);
28847         return tag_ptr(ret_conv, true);
28848 }
28849
28850 jboolean  __attribute__((export_name("TS_CResult_StrSecp256k1ErrorZ_is_ok"))) TS_CResult_StrSecp256k1ErrorZ_is_ok(uint64_t o) {
28851         LDKCResult_StrSecp256k1ErrorZ* o_conv = (LDKCResult_StrSecp256k1ErrorZ*)untag_ptr(o);
28852         jboolean ret_conv = CResult_StrSecp256k1ErrorZ_is_ok(o_conv);
28853         return ret_conv;
28854 }
28855
28856 void  __attribute__((export_name("TS_CResult_StrSecp256k1ErrorZ_free"))) TS_CResult_StrSecp256k1ErrorZ_free(uint64_t _res) {
28857         if (!ptr_is_owned(_res)) return;
28858         void* _res_ptr = untag_ptr(_res);
28859         CHECK_ACCESS(_res_ptr);
28860         LDKCResult_StrSecp256k1ErrorZ _res_conv = *(LDKCResult_StrSecp256k1ErrorZ*)(_res_ptr);
28861         FREE(untag_ptr(_res));
28862         CResult_StrSecp256k1ErrorZ_free(_res_conv);
28863 }
28864
28865 static inline uint64_t CResult_StrSecp256k1ErrorZ_clone_ptr(LDKCResult_StrSecp256k1ErrorZ *NONNULL_PTR arg) {
28866         LDKCResult_StrSecp256k1ErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_StrSecp256k1ErrorZ), "LDKCResult_StrSecp256k1ErrorZ");
28867         *ret_conv = CResult_StrSecp256k1ErrorZ_clone(arg);
28868         return tag_ptr(ret_conv, true);
28869 }
28870 int64_t  __attribute__((export_name("TS_CResult_StrSecp256k1ErrorZ_clone_ptr"))) TS_CResult_StrSecp256k1ErrorZ_clone_ptr(uint64_t arg) {
28871         LDKCResult_StrSecp256k1ErrorZ* arg_conv = (LDKCResult_StrSecp256k1ErrorZ*)untag_ptr(arg);
28872         int64_t ret_conv = CResult_StrSecp256k1ErrorZ_clone_ptr(arg_conv);
28873         return ret_conv;
28874 }
28875
28876 uint64_t  __attribute__((export_name("TS_CResult_StrSecp256k1ErrorZ_clone"))) TS_CResult_StrSecp256k1ErrorZ_clone(uint64_t orig) {
28877         LDKCResult_StrSecp256k1ErrorZ* orig_conv = (LDKCResult_StrSecp256k1ErrorZ*)untag_ptr(orig);
28878         LDKCResult_StrSecp256k1ErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_StrSecp256k1ErrorZ), "LDKCResult_StrSecp256k1ErrorZ");
28879         *ret_conv = CResult_StrSecp256k1ErrorZ_clone(orig_conv);
28880         return tag_ptr(ret_conv, true);
28881 }
28882
28883 uint64_t  __attribute__((export_name("TS_CResult_TxOutUtxoLookupErrorZ_ok"))) TS_CResult_TxOutUtxoLookupErrorZ_ok(uint64_t o) {
28884         void* o_ptr = untag_ptr(o);
28885         CHECK_ACCESS(o_ptr);
28886         LDKTxOut o_conv = *(LDKTxOut*)(o_ptr);
28887         o_conv = TxOut_clone((LDKTxOut*)untag_ptr(o));
28888         LDKCResult_TxOutUtxoLookupErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TxOutUtxoLookupErrorZ), "LDKCResult_TxOutUtxoLookupErrorZ");
28889         *ret_conv = CResult_TxOutUtxoLookupErrorZ_ok(o_conv);
28890         return tag_ptr(ret_conv, true);
28891 }
28892
28893 uint64_t  __attribute__((export_name("TS_CResult_TxOutUtxoLookupErrorZ_err"))) TS_CResult_TxOutUtxoLookupErrorZ_err(uint32_t e) {
28894         LDKUtxoLookupError e_conv = LDKUtxoLookupError_from_js(e);
28895         LDKCResult_TxOutUtxoLookupErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TxOutUtxoLookupErrorZ), "LDKCResult_TxOutUtxoLookupErrorZ");
28896         *ret_conv = CResult_TxOutUtxoLookupErrorZ_err(e_conv);
28897         return tag_ptr(ret_conv, true);
28898 }
28899
28900 jboolean  __attribute__((export_name("TS_CResult_TxOutUtxoLookupErrorZ_is_ok"))) TS_CResult_TxOutUtxoLookupErrorZ_is_ok(uint64_t o) {
28901         LDKCResult_TxOutUtxoLookupErrorZ* o_conv = (LDKCResult_TxOutUtxoLookupErrorZ*)untag_ptr(o);
28902         jboolean ret_conv = CResult_TxOutUtxoLookupErrorZ_is_ok(o_conv);
28903         return ret_conv;
28904 }
28905
28906 void  __attribute__((export_name("TS_CResult_TxOutUtxoLookupErrorZ_free"))) TS_CResult_TxOutUtxoLookupErrorZ_free(uint64_t _res) {
28907         if (!ptr_is_owned(_res)) return;
28908         void* _res_ptr = untag_ptr(_res);
28909         CHECK_ACCESS(_res_ptr);
28910         LDKCResult_TxOutUtxoLookupErrorZ _res_conv = *(LDKCResult_TxOutUtxoLookupErrorZ*)(_res_ptr);
28911         FREE(untag_ptr(_res));
28912         CResult_TxOutUtxoLookupErrorZ_free(_res_conv);
28913 }
28914
28915 static inline uint64_t CResult_TxOutUtxoLookupErrorZ_clone_ptr(LDKCResult_TxOutUtxoLookupErrorZ *NONNULL_PTR arg) {
28916         LDKCResult_TxOutUtxoLookupErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TxOutUtxoLookupErrorZ), "LDKCResult_TxOutUtxoLookupErrorZ");
28917         *ret_conv = CResult_TxOutUtxoLookupErrorZ_clone(arg);
28918         return tag_ptr(ret_conv, true);
28919 }
28920 int64_t  __attribute__((export_name("TS_CResult_TxOutUtxoLookupErrorZ_clone_ptr"))) TS_CResult_TxOutUtxoLookupErrorZ_clone_ptr(uint64_t arg) {
28921         LDKCResult_TxOutUtxoLookupErrorZ* arg_conv = (LDKCResult_TxOutUtxoLookupErrorZ*)untag_ptr(arg);
28922         int64_t ret_conv = CResult_TxOutUtxoLookupErrorZ_clone_ptr(arg_conv);
28923         return ret_conv;
28924 }
28925
28926 uint64_t  __attribute__((export_name("TS_CResult_TxOutUtxoLookupErrorZ_clone"))) TS_CResult_TxOutUtxoLookupErrorZ_clone(uint64_t orig) {
28927         LDKCResult_TxOutUtxoLookupErrorZ* orig_conv = (LDKCResult_TxOutUtxoLookupErrorZ*)untag_ptr(orig);
28928         LDKCResult_TxOutUtxoLookupErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TxOutUtxoLookupErrorZ), "LDKCResult_TxOutUtxoLookupErrorZ");
28929         *ret_conv = CResult_TxOutUtxoLookupErrorZ_clone(orig_conv);
28930         return tag_ptr(ret_conv, true);
28931 }
28932
28933 uint64_t  __attribute__((export_name("TS_CResult_OnionMessagePathNoneZ_ok"))) TS_CResult_OnionMessagePathNoneZ_ok(uint64_t o) {
28934         LDKOnionMessagePath o_conv;
28935         o_conv.inner = untag_ptr(o);
28936         o_conv.is_owned = ptr_is_owned(o);
28937         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
28938         o_conv = OnionMessagePath_clone(&o_conv);
28939         LDKCResult_OnionMessagePathNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_OnionMessagePathNoneZ), "LDKCResult_OnionMessagePathNoneZ");
28940         *ret_conv = CResult_OnionMessagePathNoneZ_ok(o_conv);
28941         return tag_ptr(ret_conv, true);
28942 }
28943
28944 uint64_t  __attribute__((export_name("TS_CResult_OnionMessagePathNoneZ_err"))) TS_CResult_OnionMessagePathNoneZ_err() {
28945         LDKCResult_OnionMessagePathNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_OnionMessagePathNoneZ), "LDKCResult_OnionMessagePathNoneZ");
28946         *ret_conv = CResult_OnionMessagePathNoneZ_err();
28947         return tag_ptr(ret_conv, true);
28948 }
28949
28950 jboolean  __attribute__((export_name("TS_CResult_OnionMessagePathNoneZ_is_ok"))) TS_CResult_OnionMessagePathNoneZ_is_ok(uint64_t o) {
28951         LDKCResult_OnionMessagePathNoneZ* o_conv = (LDKCResult_OnionMessagePathNoneZ*)untag_ptr(o);
28952         jboolean ret_conv = CResult_OnionMessagePathNoneZ_is_ok(o_conv);
28953         return ret_conv;
28954 }
28955
28956 void  __attribute__((export_name("TS_CResult_OnionMessagePathNoneZ_free"))) TS_CResult_OnionMessagePathNoneZ_free(uint64_t _res) {
28957         if (!ptr_is_owned(_res)) return;
28958         void* _res_ptr = untag_ptr(_res);
28959         CHECK_ACCESS(_res_ptr);
28960         LDKCResult_OnionMessagePathNoneZ _res_conv = *(LDKCResult_OnionMessagePathNoneZ*)(_res_ptr);
28961         FREE(untag_ptr(_res));
28962         CResult_OnionMessagePathNoneZ_free(_res_conv);
28963 }
28964
28965 static inline uint64_t CResult_OnionMessagePathNoneZ_clone_ptr(LDKCResult_OnionMessagePathNoneZ *NONNULL_PTR arg) {
28966         LDKCResult_OnionMessagePathNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_OnionMessagePathNoneZ), "LDKCResult_OnionMessagePathNoneZ");
28967         *ret_conv = CResult_OnionMessagePathNoneZ_clone(arg);
28968         return tag_ptr(ret_conv, true);
28969 }
28970 int64_t  __attribute__((export_name("TS_CResult_OnionMessagePathNoneZ_clone_ptr"))) TS_CResult_OnionMessagePathNoneZ_clone_ptr(uint64_t arg) {
28971         LDKCResult_OnionMessagePathNoneZ* arg_conv = (LDKCResult_OnionMessagePathNoneZ*)untag_ptr(arg);
28972         int64_t ret_conv = CResult_OnionMessagePathNoneZ_clone_ptr(arg_conv);
28973         return ret_conv;
28974 }
28975
28976 uint64_t  __attribute__((export_name("TS_CResult_OnionMessagePathNoneZ_clone"))) TS_CResult_OnionMessagePathNoneZ_clone(uint64_t orig) {
28977         LDKCResult_OnionMessagePathNoneZ* orig_conv = (LDKCResult_OnionMessagePathNoneZ*)untag_ptr(orig);
28978         LDKCResult_OnionMessagePathNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_OnionMessagePathNoneZ), "LDKCResult_OnionMessagePathNoneZ");
28979         *ret_conv = CResult_OnionMessagePathNoneZ_clone(orig_conv);
28980         return tag_ptr(ret_conv, true);
28981 }
28982
28983 static inline uint64_t C2Tuple_PublicKeyOnionMessageZ_clone_ptr(LDKC2Tuple_PublicKeyOnionMessageZ *NONNULL_PTR arg) {
28984         LDKC2Tuple_PublicKeyOnionMessageZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_PublicKeyOnionMessageZ), "LDKC2Tuple_PublicKeyOnionMessageZ");
28985         *ret_conv = C2Tuple_PublicKeyOnionMessageZ_clone(arg);
28986         return tag_ptr(ret_conv, true);
28987 }
28988 int64_t  __attribute__((export_name("TS_C2Tuple_PublicKeyOnionMessageZ_clone_ptr"))) TS_C2Tuple_PublicKeyOnionMessageZ_clone_ptr(uint64_t arg) {
28989         LDKC2Tuple_PublicKeyOnionMessageZ* arg_conv = (LDKC2Tuple_PublicKeyOnionMessageZ*)untag_ptr(arg);
28990         int64_t ret_conv = C2Tuple_PublicKeyOnionMessageZ_clone_ptr(arg_conv);
28991         return ret_conv;
28992 }
28993
28994 uint64_t  __attribute__((export_name("TS_C2Tuple_PublicKeyOnionMessageZ_clone"))) TS_C2Tuple_PublicKeyOnionMessageZ_clone(uint64_t orig) {
28995         LDKC2Tuple_PublicKeyOnionMessageZ* orig_conv = (LDKC2Tuple_PublicKeyOnionMessageZ*)untag_ptr(orig);
28996         LDKC2Tuple_PublicKeyOnionMessageZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_PublicKeyOnionMessageZ), "LDKC2Tuple_PublicKeyOnionMessageZ");
28997         *ret_conv = C2Tuple_PublicKeyOnionMessageZ_clone(orig_conv);
28998         return tag_ptr(ret_conv, true);
28999 }
29000
29001 uint64_t  __attribute__((export_name("TS_C2Tuple_PublicKeyOnionMessageZ_new"))) TS_C2Tuple_PublicKeyOnionMessageZ_new(int8_tArray a, uint64_t b) {
29002         LDKPublicKey a_ref;
29003         CHECK(a->arr_len == 33);
29004         memcpy(a_ref.compressed_form, a->elems, 33); FREE(a);
29005         LDKOnionMessage b_conv;
29006         b_conv.inner = untag_ptr(b);
29007         b_conv.is_owned = ptr_is_owned(b);
29008         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
29009         b_conv = OnionMessage_clone(&b_conv);
29010         LDKC2Tuple_PublicKeyOnionMessageZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_PublicKeyOnionMessageZ), "LDKC2Tuple_PublicKeyOnionMessageZ");
29011         *ret_conv = C2Tuple_PublicKeyOnionMessageZ_new(a_ref, b_conv);
29012         return tag_ptr(ret_conv, true);
29013 }
29014
29015 void  __attribute__((export_name("TS_C2Tuple_PublicKeyOnionMessageZ_free"))) TS_C2Tuple_PublicKeyOnionMessageZ_free(uint64_t _res) {
29016         if (!ptr_is_owned(_res)) return;
29017         void* _res_ptr = untag_ptr(_res);
29018         CHECK_ACCESS(_res_ptr);
29019         LDKC2Tuple_PublicKeyOnionMessageZ _res_conv = *(LDKC2Tuple_PublicKeyOnionMessageZ*)(_res_ptr);
29020         FREE(untag_ptr(_res));
29021         C2Tuple_PublicKeyOnionMessageZ_free(_res_conv);
29022 }
29023
29024 uint64_t  __attribute__((export_name("TS_CResult_C2Tuple_PublicKeyOnionMessageZSendErrorZ_ok"))) TS_CResult_C2Tuple_PublicKeyOnionMessageZSendErrorZ_ok(uint64_t o) {
29025         void* o_ptr = untag_ptr(o);
29026         CHECK_ACCESS(o_ptr);
29027         LDKC2Tuple_PublicKeyOnionMessageZ o_conv = *(LDKC2Tuple_PublicKeyOnionMessageZ*)(o_ptr);
29028         o_conv = C2Tuple_PublicKeyOnionMessageZ_clone((LDKC2Tuple_PublicKeyOnionMessageZ*)untag_ptr(o));
29029         LDKCResult_C2Tuple_PublicKeyOnionMessageZSendErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_PublicKeyOnionMessageZSendErrorZ), "LDKCResult_C2Tuple_PublicKeyOnionMessageZSendErrorZ");
29030         *ret_conv = CResult_C2Tuple_PublicKeyOnionMessageZSendErrorZ_ok(o_conv);
29031         return tag_ptr(ret_conv, true);
29032 }
29033
29034 uint64_t  __attribute__((export_name("TS_CResult_C2Tuple_PublicKeyOnionMessageZSendErrorZ_err"))) TS_CResult_C2Tuple_PublicKeyOnionMessageZSendErrorZ_err(uint64_t e) {
29035         void* e_ptr = untag_ptr(e);
29036         CHECK_ACCESS(e_ptr);
29037         LDKSendError e_conv = *(LDKSendError*)(e_ptr);
29038         e_conv = SendError_clone((LDKSendError*)untag_ptr(e));
29039         LDKCResult_C2Tuple_PublicKeyOnionMessageZSendErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_PublicKeyOnionMessageZSendErrorZ), "LDKCResult_C2Tuple_PublicKeyOnionMessageZSendErrorZ");
29040         *ret_conv = CResult_C2Tuple_PublicKeyOnionMessageZSendErrorZ_err(e_conv);
29041         return tag_ptr(ret_conv, true);
29042 }
29043
29044 jboolean  __attribute__((export_name("TS_CResult_C2Tuple_PublicKeyOnionMessageZSendErrorZ_is_ok"))) TS_CResult_C2Tuple_PublicKeyOnionMessageZSendErrorZ_is_ok(uint64_t o) {
29045         LDKCResult_C2Tuple_PublicKeyOnionMessageZSendErrorZ* o_conv = (LDKCResult_C2Tuple_PublicKeyOnionMessageZSendErrorZ*)untag_ptr(o);
29046         jboolean ret_conv = CResult_C2Tuple_PublicKeyOnionMessageZSendErrorZ_is_ok(o_conv);
29047         return ret_conv;
29048 }
29049
29050 void  __attribute__((export_name("TS_CResult_C2Tuple_PublicKeyOnionMessageZSendErrorZ_free"))) TS_CResult_C2Tuple_PublicKeyOnionMessageZSendErrorZ_free(uint64_t _res) {
29051         if (!ptr_is_owned(_res)) return;
29052         void* _res_ptr = untag_ptr(_res);
29053         CHECK_ACCESS(_res_ptr);
29054         LDKCResult_C2Tuple_PublicKeyOnionMessageZSendErrorZ _res_conv = *(LDKCResult_C2Tuple_PublicKeyOnionMessageZSendErrorZ*)(_res_ptr);
29055         FREE(untag_ptr(_res));
29056         CResult_C2Tuple_PublicKeyOnionMessageZSendErrorZ_free(_res_conv);
29057 }
29058
29059 uint64_t  __attribute__((export_name("TS_CResult_PeeledOnionNoneZ_ok"))) TS_CResult_PeeledOnionNoneZ_ok(uint64_t o) {
29060         void* o_ptr = untag_ptr(o);
29061         CHECK_ACCESS(o_ptr);
29062         LDKPeeledOnion o_conv = *(LDKPeeledOnion*)(o_ptr);
29063         o_conv = PeeledOnion_clone((LDKPeeledOnion*)untag_ptr(o));
29064         LDKCResult_PeeledOnionNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_PeeledOnionNoneZ), "LDKCResult_PeeledOnionNoneZ");
29065         *ret_conv = CResult_PeeledOnionNoneZ_ok(o_conv);
29066         return tag_ptr(ret_conv, true);
29067 }
29068
29069 uint64_t  __attribute__((export_name("TS_CResult_PeeledOnionNoneZ_err"))) TS_CResult_PeeledOnionNoneZ_err() {
29070         LDKCResult_PeeledOnionNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_PeeledOnionNoneZ), "LDKCResult_PeeledOnionNoneZ");
29071         *ret_conv = CResult_PeeledOnionNoneZ_err();
29072         return tag_ptr(ret_conv, true);
29073 }
29074
29075 jboolean  __attribute__((export_name("TS_CResult_PeeledOnionNoneZ_is_ok"))) TS_CResult_PeeledOnionNoneZ_is_ok(uint64_t o) {
29076         LDKCResult_PeeledOnionNoneZ* o_conv = (LDKCResult_PeeledOnionNoneZ*)untag_ptr(o);
29077         jboolean ret_conv = CResult_PeeledOnionNoneZ_is_ok(o_conv);
29078         return ret_conv;
29079 }
29080
29081 void  __attribute__((export_name("TS_CResult_PeeledOnionNoneZ_free"))) TS_CResult_PeeledOnionNoneZ_free(uint64_t _res) {
29082         if (!ptr_is_owned(_res)) return;
29083         void* _res_ptr = untag_ptr(_res);
29084         CHECK_ACCESS(_res_ptr);
29085         LDKCResult_PeeledOnionNoneZ _res_conv = *(LDKCResult_PeeledOnionNoneZ*)(_res_ptr);
29086         FREE(untag_ptr(_res));
29087         CResult_PeeledOnionNoneZ_free(_res_conv);
29088 }
29089
29090 uint64_t  __attribute__((export_name("TS_CResult_NoneSendErrorZ_ok"))) TS_CResult_NoneSendErrorZ_ok() {
29091         LDKCResult_NoneSendErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneSendErrorZ), "LDKCResult_NoneSendErrorZ");
29092         *ret_conv = CResult_NoneSendErrorZ_ok();
29093         return tag_ptr(ret_conv, true);
29094 }
29095
29096 uint64_t  __attribute__((export_name("TS_CResult_NoneSendErrorZ_err"))) TS_CResult_NoneSendErrorZ_err(uint64_t e) {
29097         void* e_ptr = untag_ptr(e);
29098         CHECK_ACCESS(e_ptr);
29099         LDKSendError e_conv = *(LDKSendError*)(e_ptr);
29100         e_conv = SendError_clone((LDKSendError*)untag_ptr(e));
29101         LDKCResult_NoneSendErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneSendErrorZ), "LDKCResult_NoneSendErrorZ");
29102         *ret_conv = CResult_NoneSendErrorZ_err(e_conv);
29103         return tag_ptr(ret_conv, true);
29104 }
29105
29106 jboolean  __attribute__((export_name("TS_CResult_NoneSendErrorZ_is_ok"))) TS_CResult_NoneSendErrorZ_is_ok(uint64_t o) {
29107         LDKCResult_NoneSendErrorZ* o_conv = (LDKCResult_NoneSendErrorZ*)untag_ptr(o);
29108         jboolean ret_conv = CResult_NoneSendErrorZ_is_ok(o_conv);
29109         return ret_conv;
29110 }
29111
29112 void  __attribute__((export_name("TS_CResult_NoneSendErrorZ_free"))) TS_CResult_NoneSendErrorZ_free(uint64_t _res) {
29113         if (!ptr_is_owned(_res)) return;
29114         void* _res_ptr = untag_ptr(_res);
29115         CHECK_ACCESS(_res_ptr);
29116         LDKCResult_NoneSendErrorZ _res_conv = *(LDKCResult_NoneSendErrorZ*)(_res_ptr);
29117         FREE(untag_ptr(_res));
29118         CResult_NoneSendErrorZ_free(_res_conv);
29119 }
29120
29121 uint64_t  __attribute__((export_name("TS_CResult_BlindedPathNoneZ_ok"))) TS_CResult_BlindedPathNoneZ_ok(uint64_t o) {
29122         LDKBlindedPath o_conv;
29123         o_conv.inner = untag_ptr(o);
29124         o_conv.is_owned = ptr_is_owned(o);
29125         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
29126         o_conv = BlindedPath_clone(&o_conv);
29127         LDKCResult_BlindedPathNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_BlindedPathNoneZ), "LDKCResult_BlindedPathNoneZ");
29128         *ret_conv = CResult_BlindedPathNoneZ_ok(o_conv);
29129         return tag_ptr(ret_conv, true);
29130 }
29131
29132 uint64_t  __attribute__((export_name("TS_CResult_BlindedPathNoneZ_err"))) TS_CResult_BlindedPathNoneZ_err() {
29133         LDKCResult_BlindedPathNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_BlindedPathNoneZ), "LDKCResult_BlindedPathNoneZ");
29134         *ret_conv = CResult_BlindedPathNoneZ_err();
29135         return tag_ptr(ret_conv, true);
29136 }
29137
29138 jboolean  __attribute__((export_name("TS_CResult_BlindedPathNoneZ_is_ok"))) TS_CResult_BlindedPathNoneZ_is_ok(uint64_t o) {
29139         LDKCResult_BlindedPathNoneZ* o_conv = (LDKCResult_BlindedPathNoneZ*)untag_ptr(o);
29140         jboolean ret_conv = CResult_BlindedPathNoneZ_is_ok(o_conv);
29141         return ret_conv;
29142 }
29143
29144 void  __attribute__((export_name("TS_CResult_BlindedPathNoneZ_free"))) TS_CResult_BlindedPathNoneZ_free(uint64_t _res) {
29145         if (!ptr_is_owned(_res)) return;
29146         void* _res_ptr = untag_ptr(_res);
29147         CHECK_ACCESS(_res_ptr);
29148         LDKCResult_BlindedPathNoneZ _res_conv = *(LDKCResult_BlindedPathNoneZ*)(_res_ptr);
29149         FREE(untag_ptr(_res));
29150         CResult_BlindedPathNoneZ_free(_res_conv);
29151 }
29152
29153 static inline uint64_t CResult_BlindedPathNoneZ_clone_ptr(LDKCResult_BlindedPathNoneZ *NONNULL_PTR arg) {
29154         LDKCResult_BlindedPathNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_BlindedPathNoneZ), "LDKCResult_BlindedPathNoneZ");
29155         *ret_conv = CResult_BlindedPathNoneZ_clone(arg);
29156         return tag_ptr(ret_conv, true);
29157 }
29158 int64_t  __attribute__((export_name("TS_CResult_BlindedPathNoneZ_clone_ptr"))) TS_CResult_BlindedPathNoneZ_clone_ptr(uint64_t arg) {
29159         LDKCResult_BlindedPathNoneZ* arg_conv = (LDKCResult_BlindedPathNoneZ*)untag_ptr(arg);
29160         int64_t ret_conv = CResult_BlindedPathNoneZ_clone_ptr(arg_conv);
29161         return ret_conv;
29162 }
29163
29164 uint64_t  __attribute__((export_name("TS_CResult_BlindedPathNoneZ_clone"))) TS_CResult_BlindedPathNoneZ_clone(uint64_t orig) {
29165         LDKCResult_BlindedPathNoneZ* orig_conv = (LDKCResult_BlindedPathNoneZ*)untag_ptr(orig);
29166         LDKCResult_BlindedPathNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_BlindedPathNoneZ), "LDKCResult_BlindedPathNoneZ");
29167         *ret_conv = CResult_BlindedPathNoneZ_clone(orig_conv);
29168         return tag_ptr(ret_conv, true);
29169 }
29170
29171 uint64_t  __attribute__((export_name("TS_CResult_C2Tuple_BlindedPayInfoBlindedPathZNoneZ_ok"))) TS_CResult_C2Tuple_BlindedPayInfoBlindedPathZNoneZ_ok(uint64_t o) {
29172         void* o_ptr = untag_ptr(o);
29173         CHECK_ACCESS(o_ptr);
29174         LDKC2Tuple_BlindedPayInfoBlindedPathZ o_conv = *(LDKC2Tuple_BlindedPayInfoBlindedPathZ*)(o_ptr);
29175         o_conv = C2Tuple_BlindedPayInfoBlindedPathZ_clone((LDKC2Tuple_BlindedPayInfoBlindedPathZ*)untag_ptr(o));
29176         LDKCResult_C2Tuple_BlindedPayInfoBlindedPathZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_BlindedPayInfoBlindedPathZNoneZ), "LDKCResult_C2Tuple_BlindedPayInfoBlindedPathZNoneZ");
29177         *ret_conv = CResult_C2Tuple_BlindedPayInfoBlindedPathZNoneZ_ok(o_conv);
29178         return tag_ptr(ret_conv, true);
29179 }
29180
29181 uint64_t  __attribute__((export_name("TS_CResult_C2Tuple_BlindedPayInfoBlindedPathZNoneZ_err"))) TS_CResult_C2Tuple_BlindedPayInfoBlindedPathZNoneZ_err() {
29182         LDKCResult_C2Tuple_BlindedPayInfoBlindedPathZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_BlindedPayInfoBlindedPathZNoneZ), "LDKCResult_C2Tuple_BlindedPayInfoBlindedPathZNoneZ");
29183         *ret_conv = CResult_C2Tuple_BlindedPayInfoBlindedPathZNoneZ_err();
29184         return tag_ptr(ret_conv, true);
29185 }
29186
29187 jboolean  __attribute__((export_name("TS_CResult_C2Tuple_BlindedPayInfoBlindedPathZNoneZ_is_ok"))) TS_CResult_C2Tuple_BlindedPayInfoBlindedPathZNoneZ_is_ok(uint64_t o) {
29188         LDKCResult_C2Tuple_BlindedPayInfoBlindedPathZNoneZ* o_conv = (LDKCResult_C2Tuple_BlindedPayInfoBlindedPathZNoneZ*)untag_ptr(o);
29189         jboolean ret_conv = CResult_C2Tuple_BlindedPayInfoBlindedPathZNoneZ_is_ok(o_conv);
29190         return ret_conv;
29191 }
29192
29193 void  __attribute__((export_name("TS_CResult_C2Tuple_BlindedPayInfoBlindedPathZNoneZ_free"))) TS_CResult_C2Tuple_BlindedPayInfoBlindedPathZNoneZ_free(uint64_t _res) {
29194         if (!ptr_is_owned(_res)) return;
29195         void* _res_ptr = untag_ptr(_res);
29196         CHECK_ACCESS(_res_ptr);
29197         LDKCResult_C2Tuple_BlindedPayInfoBlindedPathZNoneZ _res_conv = *(LDKCResult_C2Tuple_BlindedPayInfoBlindedPathZNoneZ*)(_res_ptr);
29198         FREE(untag_ptr(_res));
29199         CResult_C2Tuple_BlindedPayInfoBlindedPathZNoneZ_free(_res_conv);
29200 }
29201
29202 static inline uint64_t CResult_C2Tuple_BlindedPayInfoBlindedPathZNoneZ_clone_ptr(LDKCResult_C2Tuple_BlindedPayInfoBlindedPathZNoneZ *NONNULL_PTR arg) {
29203         LDKCResult_C2Tuple_BlindedPayInfoBlindedPathZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_BlindedPayInfoBlindedPathZNoneZ), "LDKCResult_C2Tuple_BlindedPayInfoBlindedPathZNoneZ");
29204         *ret_conv = CResult_C2Tuple_BlindedPayInfoBlindedPathZNoneZ_clone(arg);
29205         return tag_ptr(ret_conv, true);
29206 }
29207 int64_t  __attribute__((export_name("TS_CResult_C2Tuple_BlindedPayInfoBlindedPathZNoneZ_clone_ptr"))) TS_CResult_C2Tuple_BlindedPayInfoBlindedPathZNoneZ_clone_ptr(uint64_t arg) {
29208         LDKCResult_C2Tuple_BlindedPayInfoBlindedPathZNoneZ* arg_conv = (LDKCResult_C2Tuple_BlindedPayInfoBlindedPathZNoneZ*)untag_ptr(arg);
29209         int64_t ret_conv = CResult_C2Tuple_BlindedPayInfoBlindedPathZNoneZ_clone_ptr(arg_conv);
29210         return ret_conv;
29211 }
29212
29213 uint64_t  __attribute__((export_name("TS_CResult_C2Tuple_BlindedPayInfoBlindedPathZNoneZ_clone"))) TS_CResult_C2Tuple_BlindedPayInfoBlindedPathZNoneZ_clone(uint64_t orig) {
29214         LDKCResult_C2Tuple_BlindedPayInfoBlindedPathZNoneZ* orig_conv = (LDKCResult_C2Tuple_BlindedPayInfoBlindedPathZNoneZ*)untag_ptr(orig);
29215         LDKCResult_C2Tuple_BlindedPayInfoBlindedPathZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_BlindedPayInfoBlindedPathZNoneZ), "LDKCResult_C2Tuple_BlindedPayInfoBlindedPathZNoneZ");
29216         *ret_conv = CResult_C2Tuple_BlindedPayInfoBlindedPathZNoneZ_clone(orig_conv);
29217         return tag_ptr(ret_conv, true);
29218 }
29219
29220 uint64_t  __attribute__((export_name("TS_CResult_BlindedPathDecodeErrorZ_ok"))) TS_CResult_BlindedPathDecodeErrorZ_ok(uint64_t o) {
29221         LDKBlindedPath o_conv;
29222         o_conv.inner = untag_ptr(o);
29223         o_conv.is_owned = ptr_is_owned(o);
29224         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
29225         o_conv = BlindedPath_clone(&o_conv);
29226         LDKCResult_BlindedPathDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_BlindedPathDecodeErrorZ), "LDKCResult_BlindedPathDecodeErrorZ");
29227         *ret_conv = CResult_BlindedPathDecodeErrorZ_ok(o_conv);
29228         return tag_ptr(ret_conv, true);
29229 }
29230
29231 uint64_t  __attribute__((export_name("TS_CResult_BlindedPathDecodeErrorZ_err"))) TS_CResult_BlindedPathDecodeErrorZ_err(uint64_t e) {
29232         void* e_ptr = untag_ptr(e);
29233         CHECK_ACCESS(e_ptr);
29234         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
29235         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
29236         LDKCResult_BlindedPathDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_BlindedPathDecodeErrorZ), "LDKCResult_BlindedPathDecodeErrorZ");
29237         *ret_conv = CResult_BlindedPathDecodeErrorZ_err(e_conv);
29238         return tag_ptr(ret_conv, true);
29239 }
29240
29241 jboolean  __attribute__((export_name("TS_CResult_BlindedPathDecodeErrorZ_is_ok"))) TS_CResult_BlindedPathDecodeErrorZ_is_ok(uint64_t o) {
29242         LDKCResult_BlindedPathDecodeErrorZ* o_conv = (LDKCResult_BlindedPathDecodeErrorZ*)untag_ptr(o);
29243         jboolean ret_conv = CResult_BlindedPathDecodeErrorZ_is_ok(o_conv);
29244         return ret_conv;
29245 }
29246
29247 void  __attribute__((export_name("TS_CResult_BlindedPathDecodeErrorZ_free"))) TS_CResult_BlindedPathDecodeErrorZ_free(uint64_t _res) {
29248         if (!ptr_is_owned(_res)) return;
29249         void* _res_ptr = untag_ptr(_res);
29250         CHECK_ACCESS(_res_ptr);
29251         LDKCResult_BlindedPathDecodeErrorZ _res_conv = *(LDKCResult_BlindedPathDecodeErrorZ*)(_res_ptr);
29252         FREE(untag_ptr(_res));
29253         CResult_BlindedPathDecodeErrorZ_free(_res_conv);
29254 }
29255
29256 static inline uint64_t CResult_BlindedPathDecodeErrorZ_clone_ptr(LDKCResult_BlindedPathDecodeErrorZ *NONNULL_PTR arg) {
29257         LDKCResult_BlindedPathDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_BlindedPathDecodeErrorZ), "LDKCResult_BlindedPathDecodeErrorZ");
29258         *ret_conv = CResult_BlindedPathDecodeErrorZ_clone(arg);
29259         return tag_ptr(ret_conv, true);
29260 }
29261 int64_t  __attribute__((export_name("TS_CResult_BlindedPathDecodeErrorZ_clone_ptr"))) TS_CResult_BlindedPathDecodeErrorZ_clone_ptr(uint64_t arg) {
29262         LDKCResult_BlindedPathDecodeErrorZ* arg_conv = (LDKCResult_BlindedPathDecodeErrorZ*)untag_ptr(arg);
29263         int64_t ret_conv = CResult_BlindedPathDecodeErrorZ_clone_ptr(arg_conv);
29264         return ret_conv;
29265 }
29266
29267 uint64_t  __attribute__((export_name("TS_CResult_BlindedPathDecodeErrorZ_clone"))) TS_CResult_BlindedPathDecodeErrorZ_clone(uint64_t orig) {
29268         LDKCResult_BlindedPathDecodeErrorZ* orig_conv = (LDKCResult_BlindedPathDecodeErrorZ*)untag_ptr(orig);
29269         LDKCResult_BlindedPathDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_BlindedPathDecodeErrorZ), "LDKCResult_BlindedPathDecodeErrorZ");
29270         *ret_conv = CResult_BlindedPathDecodeErrorZ_clone(orig_conv);
29271         return tag_ptr(ret_conv, true);
29272 }
29273
29274 uint64_t  __attribute__((export_name("TS_CResult_BlindedHopDecodeErrorZ_ok"))) TS_CResult_BlindedHopDecodeErrorZ_ok(uint64_t o) {
29275         LDKBlindedHop o_conv;
29276         o_conv.inner = untag_ptr(o);
29277         o_conv.is_owned = ptr_is_owned(o);
29278         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
29279         o_conv = BlindedHop_clone(&o_conv);
29280         LDKCResult_BlindedHopDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_BlindedHopDecodeErrorZ), "LDKCResult_BlindedHopDecodeErrorZ");
29281         *ret_conv = CResult_BlindedHopDecodeErrorZ_ok(o_conv);
29282         return tag_ptr(ret_conv, true);
29283 }
29284
29285 uint64_t  __attribute__((export_name("TS_CResult_BlindedHopDecodeErrorZ_err"))) TS_CResult_BlindedHopDecodeErrorZ_err(uint64_t e) {
29286         void* e_ptr = untag_ptr(e);
29287         CHECK_ACCESS(e_ptr);
29288         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
29289         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
29290         LDKCResult_BlindedHopDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_BlindedHopDecodeErrorZ), "LDKCResult_BlindedHopDecodeErrorZ");
29291         *ret_conv = CResult_BlindedHopDecodeErrorZ_err(e_conv);
29292         return tag_ptr(ret_conv, true);
29293 }
29294
29295 jboolean  __attribute__((export_name("TS_CResult_BlindedHopDecodeErrorZ_is_ok"))) TS_CResult_BlindedHopDecodeErrorZ_is_ok(uint64_t o) {
29296         LDKCResult_BlindedHopDecodeErrorZ* o_conv = (LDKCResult_BlindedHopDecodeErrorZ*)untag_ptr(o);
29297         jboolean ret_conv = CResult_BlindedHopDecodeErrorZ_is_ok(o_conv);
29298         return ret_conv;
29299 }
29300
29301 void  __attribute__((export_name("TS_CResult_BlindedHopDecodeErrorZ_free"))) TS_CResult_BlindedHopDecodeErrorZ_free(uint64_t _res) {
29302         if (!ptr_is_owned(_res)) return;
29303         void* _res_ptr = untag_ptr(_res);
29304         CHECK_ACCESS(_res_ptr);
29305         LDKCResult_BlindedHopDecodeErrorZ _res_conv = *(LDKCResult_BlindedHopDecodeErrorZ*)(_res_ptr);
29306         FREE(untag_ptr(_res));
29307         CResult_BlindedHopDecodeErrorZ_free(_res_conv);
29308 }
29309
29310 static inline uint64_t CResult_BlindedHopDecodeErrorZ_clone_ptr(LDKCResult_BlindedHopDecodeErrorZ *NONNULL_PTR arg) {
29311         LDKCResult_BlindedHopDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_BlindedHopDecodeErrorZ), "LDKCResult_BlindedHopDecodeErrorZ");
29312         *ret_conv = CResult_BlindedHopDecodeErrorZ_clone(arg);
29313         return tag_ptr(ret_conv, true);
29314 }
29315 int64_t  __attribute__((export_name("TS_CResult_BlindedHopDecodeErrorZ_clone_ptr"))) TS_CResult_BlindedHopDecodeErrorZ_clone_ptr(uint64_t arg) {
29316         LDKCResult_BlindedHopDecodeErrorZ* arg_conv = (LDKCResult_BlindedHopDecodeErrorZ*)untag_ptr(arg);
29317         int64_t ret_conv = CResult_BlindedHopDecodeErrorZ_clone_ptr(arg_conv);
29318         return ret_conv;
29319 }
29320
29321 uint64_t  __attribute__((export_name("TS_CResult_BlindedHopDecodeErrorZ_clone"))) TS_CResult_BlindedHopDecodeErrorZ_clone(uint64_t orig) {
29322         LDKCResult_BlindedHopDecodeErrorZ* orig_conv = (LDKCResult_BlindedHopDecodeErrorZ*)untag_ptr(orig);
29323         LDKCResult_BlindedHopDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_BlindedHopDecodeErrorZ), "LDKCResult_BlindedHopDecodeErrorZ");
29324         *ret_conv = CResult_BlindedHopDecodeErrorZ_clone(orig_conv);
29325         return tag_ptr(ret_conv, true);
29326 }
29327
29328 uint64_t  __attribute__((export_name("TS_CResult_InvoiceErrorDecodeErrorZ_ok"))) TS_CResult_InvoiceErrorDecodeErrorZ_ok(uint64_t o) {
29329         LDKInvoiceError o_conv;
29330         o_conv.inner = untag_ptr(o);
29331         o_conv.is_owned = ptr_is_owned(o);
29332         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
29333         o_conv = InvoiceError_clone(&o_conv);
29334         LDKCResult_InvoiceErrorDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InvoiceErrorDecodeErrorZ), "LDKCResult_InvoiceErrorDecodeErrorZ");
29335         *ret_conv = CResult_InvoiceErrorDecodeErrorZ_ok(o_conv);
29336         return tag_ptr(ret_conv, true);
29337 }
29338
29339 uint64_t  __attribute__((export_name("TS_CResult_InvoiceErrorDecodeErrorZ_err"))) TS_CResult_InvoiceErrorDecodeErrorZ_err(uint64_t e) {
29340         void* e_ptr = untag_ptr(e);
29341         CHECK_ACCESS(e_ptr);
29342         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
29343         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
29344         LDKCResult_InvoiceErrorDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InvoiceErrorDecodeErrorZ), "LDKCResult_InvoiceErrorDecodeErrorZ");
29345         *ret_conv = CResult_InvoiceErrorDecodeErrorZ_err(e_conv);
29346         return tag_ptr(ret_conv, true);
29347 }
29348
29349 jboolean  __attribute__((export_name("TS_CResult_InvoiceErrorDecodeErrorZ_is_ok"))) TS_CResult_InvoiceErrorDecodeErrorZ_is_ok(uint64_t o) {
29350         LDKCResult_InvoiceErrorDecodeErrorZ* o_conv = (LDKCResult_InvoiceErrorDecodeErrorZ*)untag_ptr(o);
29351         jboolean ret_conv = CResult_InvoiceErrorDecodeErrorZ_is_ok(o_conv);
29352         return ret_conv;
29353 }
29354
29355 void  __attribute__((export_name("TS_CResult_InvoiceErrorDecodeErrorZ_free"))) TS_CResult_InvoiceErrorDecodeErrorZ_free(uint64_t _res) {
29356         if (!ptr_is_owned(_res)) return;
29357         void* _res_ptr = untag_ptr(_res);
29358         CHECK_ACCESS(_res_ptr);
29359         LDKCResult_InvoiceErrorDecodeErrorZ _res_conv = *(LDKCResult_InvoiceErrorDecodeErrorZ*)(_res_ptr);
29360         FREE(untag_ptr(_res));
29361         CResult_InvoiceErrorDecodeErrorZ_free(_res_conv);
29362 }
29363
29364 static inline uint64_t CResult_InvoiceErrorDecodeErrorZ_clone_ptr(LDKCResult_InvoiceErrorDecodeErrorZ *NONNULL_PTR arg) {
29365         LDKCResult_InvoiceErrorDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InvoiceErrorDecodeErrorZ), "LDKCResult_InvoiceErrorDecodeErrorZ");
29366         *ret_conv = CResult_InvoiceErrorDecodeErrorZ_clone(arg);
29367         return tag_ptr(ret_conv, true);
29368 }
29369 int64_t  __attribute__((export_name("TS_CResult_InvoiceErrorDecodeErrorZ_clone_ptr"))) TS_CResult_InvoiceErrorDecodeErrorZ_clone_ptr(uint64_t arg) {
29370         LDKCResult_InvoiceErrorDecodeErrorZ* arg_conv = (LDKCResult_InvoiceErrorDecodeErrorZ*)untag_ptr(arg);
29371         int64_t ret_conv = CResult_InvoiceErrorDecodeErrorZ_clone_ptr(arg_conv);
29372         return ret_conv;
29373 }
29374
29375 uint64_t  __attribute__((export_name("TS_CResult_InvoiceErrorDecodeErrorZ_clone"))) TS_CResult_InvoiceErrorDecodeErrorZ_clone(uint64_t orig) {
29376         LDKCResult_InvoiceErrorDecodeErrorZ* orig_conv = (LDKCResult_InvoiceErrorDecodeErrorZ*)untag_ptr(orig);
29377         LDKCResult_InvoiceErrorDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InvoiceErrorDecodeErrorZ), "LDKCResult_InvoiceErrorDecodeErrorZ");
29378         *ret_conv = CResult_InvoiceErrorDecodeErrorZ_clone(orig_conv);
29379         return tag_ptr(ret_conv, true);
29380 }
29381
29382 uint64_t  __attribute__((export_name("TS_COption_FilterZ_some"))) TS_COption_FilterZ_some(uint64_t o) {
29383         void* o_ptr = untag_ptr(o);
29384         CHECK_ACCESS(o_ptr);
29385         LDKFilter o_conv = *(LDKFilter*)(o_ptr);
29386         if (o_conv.free == LDKFilter_JCalls_free) {
29387                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
29388                 LDKFilter_JCalls_cloned(&o_conv);
29389         }
29390         LDKCOption_FilterZ *ret_copy = MALLOC(sizeof(LDKCOption_FilterZ), "LDKCOption_FilterZ");
29391         *ret_copy = COption_FilterZ_some(o_conv);
29392         uint64_t ret_ref = tag_ptr(ret_copy, true);
29393         return ret_ref;
29394 }
29395
29396 uint64_t  __attribute__((export_name("TS_COption_FilterZ_none"))) TS_COption_FilterZ_none() {
29397         LDKCOption_FilterZ *ret_copy = MALLOC(sizeof(LDKCOption_FilterZ), "LDKCOption_FilterZ");
29398         *ret_copy = COption_FilterZ_none();
29399         uint64_t ret_ref = tag_ptr(ret_copy, true);
29400         return ret_ref;
29401 }
29402
29403 void  __attribute__((export_name("TS_COption_FilterZ_free"))) TS_COption_FilterZ_free(uint64_t _res) {
29404         if (!ptr_is_owned(_res)) return;
29405         void* _res_ptr = untag_ptr(_res);
29406         CHECK_ACCESS(_res_ptr);
29407         LDKCOption_FilterZ _res_conv = *(LDKCOption_FilterZ*)(_res_ptr);
29408         FREE(untag_ptr(_res));
29409         COption_FilterZ_free(_res_conv);
29410 }
29411
29412 uint64_t  __attribute__((export_name("TS_CResult_LockedChannelMonitorNoneZ_ok"))) TS_CResult_LockedChannelMonitorNoneZ_ok(uint64_t o) {
29413         LDKLockedChannelMonitor o_conv;
29414         o_conv.inner = untag_ptr(o);
29415         o_conv.is_owned = ptr_is_owned(o);
29416         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
29417         // WARNING: we need a move here but no clone is available for LDKLockedChannelMonitor
29418         
29419         LDKCResult_LockedChannelMonitorNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_LockedChannelMonitorNoneZ), "LDKCResult_LockedChannelMonitorNoneZ");
29420         *ret_conv = CResult_LockedChannelMonitorNoneZ_ok(o_conv);
29421         return tag_ptr(ret_conv, true);
29422 }
29423
29424 uint64_t  __attribute__((export_name("TS_CResult_LockedChannelMonitorNoneZ_err"))) TS_CResult_LockedChannelMonitorNoneZ_err() {
29425         LDKCResult_LockedChannelMonitorNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_LockedChannelMonitorNoneZ), "LDKCResult_LockedChannelMonitorNoneZ");
29426         *ret_conv = CResult_LockedChannelMonitorNoneZ_err();
29427         return tag_ptr(ret_conv, true);
29428 }
29429
29430 jboolean  __attribute__((export_name("TS_CResult_LockedChannelMonitorNoneZ_is_ok"))) TS_CResult_LockedChannelMonitorNoneZ_is_ok(uint64_t o) {
29431         LDKCResult_LockedChannelMonitorNoneZ* o_conv = (LDKCResult_LockedChannelMonitorNoneZ*)untag_ptr(o);
29432         jboolean ret_conv = CResult_LockedChannelMonitorNoneZ_is_ok(o_conv);
29433         return ret_conv;
29434 }
29435
29436 void  __attribute__((export_name("TS_CResult_LockedChannelMonitorNoneZ_free"))) TS_CResult_LockedChannelMonitorNoneZ_free(uint64_t _res) {
29437         if (!ptr_is_owned(_res)) return;
29438         void* _res_ptr = untag_ptr(_res);
29439         CHECK_ACCESS(_res_ptr);
29440         LDKCResult_LockedChannelMonitorNoneZ _res_conv = *(LDKCResult_LockedChannelMonitorNoneZ*)(_res_ptr);
29441         FREE(untag_ptr(_res));
29442         CResult_LockedChannelMonitorNoneZ_free(_res_conv);
29443 }
29444
29445 void  __attribute__((export_name("TS_CVec_OutPointZ_free"))) TS_CVec_OutPointZ_free(uint64_tArray _res) {
29446         LDKCVec_OutPointZ _res_constr;
29447         _res_constr.datalen = _res->arr_len;
29448         if (_res_constr.datalen > 0)
29449                 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKOutPoint), "LDKCVec_OutPointZ Elements");
29450         else
29451                 _res_constr.data = NULL;
29452         uint64_t* _res_vals = _res->elems;
29453         for (size_t k = 0; k < _res_constr.datalen; k++) {
29454                 uint64_t _res_conv_10 = _res_vals[k];
29455                 LDKOutPoint _res_conv_10_conv;
29456                 _res_conv_10_conv.inner = untag_ptr(_res_conv_10);
29457                 _res_conv_10_conv.is_owned = ptr_is_owned(_res_conv_10);
29458                 CHECK_INNER_FIELD_ACCESS_OR_NULL(_res_conv_10_conv);
29459                 _res_constr.data[k] = _res_conv_10_conv;
29460         }
29461         FREE(_res);
29462         CVec_OutPointZ_free(_res_constr);
29463 }
29464
29465 void  __attribute__((export_name("TS_CVec_MonitorUpdateIdZ_free"))) TS_CVec_MonitorUpdateIdZ_free(uint64_tArray _res) {
29466         LDKCVec_MonitorUpdateIdZ _res_constr;
29467         _res_constr.datalen = _res->arr_len;
29468         if (_res_constr.datalen > 0)
29469                 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKMonitorUpdateId), "LDKCVec_MonitorUpdateIdZ Elements");
29470         else
29471                 _res_constr.data = NULL;
29472         uint64_t* _res_vals = _res->elems;
29473         for (size_t r = 0; r < _res_constr.datalen; r++) {
29474                 uint64_t _res_conv_17 = _res_vals[r];
29475                 LDKMonitorUpdateId _res_conv_17_conv;
29476                 _res_conv_17_conv.inner = untag_ptr(_res_conv_17);
29477                 _res_conv_17_conv.is_owned = ptr_is_owned(_res_conv_17);
29478                 CHECK_INNER_FIELD_ACCESS_OR_NULL(_res_conv_17_conv);
29479                 _res_constr.data[r] = _res_conv_17_conv;
29480         }
29481         FREE(_res);
29482         CVec_MonitorUpdateIdZ_free(_res_constr);
29483 }
29484
29485 static inline uint64_t C2Tuple_OutPointCVec_MonitorUpdateIdZZ_clone_ptr(LDKC2Tuple_OutPointCVec_MonitorUpdateIdZZ *NONNULL_PTR arg) {
29486         LDKC2Tuple_OutPointCVec_MonitorUpdateIdZZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_OutPointCVec_MonitorUpdateIdZZ), "LDKC2Tuple_OutPointCVec_MonitorUpdateIdZZ");
29487         *ret_conv = C2Tuple_OutPointCVec_MonitorUpdateIdZZ_clone(arg);
29488         return tag_ptr(ret_conv, true);
29489 }
29490 int64_t  __attribute__((export_name("TS_C2Tuple_OutPointCVec_MonitorUpdateIdZZ_clone_ptr"))) TS_C2Tuple_OutPointCVec_MonitorUpdateIdZZ_clone_ptr(uint64_t arg) {
29491         LDKC2Tuple_OutPointCVec_MonitorUpdateIdZZ* arg_conv = (LDKC2Tuple_OutPointCVec_MonitorUpdateIdZZ*)untag_ptr(arg);
29492         int64_t ret_conv = C2Tuple_OutPointCVec_MonitorUpdateIdZZ_clone_ptr(arg_conv);
29493         return ret_conv;
29494 }
29495
29496 uint64_t  __attribute__((export_name("TS_C2Tuple_OutPointCVec_MonitorUpdateIdZZ_clone"))) TS_C2Tuple_OutPointCVec_MonitorUpdateIdZZ_clone(uint64_t orig) {
29497         LDKC2Tuple_OutPointCVec_MonitorUpdateIdZZ* orig_conv = (LDKC2Tuple_OutPointCVec_MonitorUpdateIdZZ*)untag_ptr(orig);
29498         LDKC2Tuple_OutPointCVec_MonitorUpdateIdZZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_OutPointCVec_MonitorUpdateIdZZ), "LDKC2Tuple_OutPointCVec_MonitorUpdateIdZZ");
29499         *ret_conv = C2Tuple_OutPointCVec_MonitorUpdateIdZZ_clone(orig_conv);
29500         return tag_ptr(ret_conv, true);
29501 }
29502
29503 uint64_t  __attribute__((export_name("TS_C2Tuple_OutPointCVec_MonitorUpdateIdZZ_new"))) TS_C2Tuple_OutPointCVec_MonitorUpdateIdZZ_new(uint64_t a, uint64_tArray b) {
29504         LDKOutPoint a_conv;
29505         a_conv.inner = untag_ptr(a);
29506         a_conv.is_owned = ptr_is_owned(a);
29507         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
29508         a_conv = OutPoint_clone(&a_conv);
29509         LDKCVec_MonitorUpdateIdZ b_constr;
29510         b_constr.datalen = b->arr_len;
29511         if (b_constr.datalen > 0)
29512                 b_constr.data = MALLOC(b_constr.datalen * sizeof(LDKMonitorUpdateId), "LDKCVec_MonitorUpdateIdZ Elements");
29513         else
29514                 b_constr.data = NULL;
29515         uint64_t* b_vals = b->elems;
29516         for (size_t r = 0; r < b_constr.datalen; r++) {
29517                 uint64_t b_conv_17 = b_vals[r];
29518                 LDKMonitorUpdateId b_conv_17_conv;
29519                 b_conv_17_conv.inner = untag_ptr(b_conv_17);
29520                 b_conv_17_conv.is_owned = ptr_is_owned(b_conv_17);
29521                 CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv_17_conv);
29522                 b_conv_17_conv = MonitorUpdateId_clone(&b_conv_17_conv);
29523                 b_constr.data[r] = b_conv_17_conv;
29524         }
29525         FREE(b);
29526         LDKC2Tuple_OutPointCVec_MonitorUpdateIdZZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_OutPointCVec_MonitorUpdateIdZZ), "LDKC2Tuple_OutPointCVec_MonitorUpdateIdZZ");
29527         *ret_conv = C2Tuple_OutPointCVec_MonitorUpdateIdZZ_new(a_conv, b_constr);
29528         return tag_ptr(ret_conv, true);
29529 }
29530
29531 void  __attribute__((export_name("TS_C2Tuple_OutPointCVec_MonitorUpdateIdZZ_free"))) TS_C2Tuple_OutPointCVec_MonitorUpdateIdZZ_free(uint64_t _res) {
29532         if (!ptr_is_owned(_res)) return;
29533         void* _res_ptr = untag_ptr(_res);
29534         CHECK_ACCESS(_res_ptr);
29535         LDKC2Tuple_OutPointCVec_MonitorUpdateIdZZ _res_conv = *(LDKC2Tuple_OutPointCVec_MonitorUpdateIdZZ*)(_res_ptr);
29536         FREE(untag_ptr(_res));
29537         C2Tuple_OutPointCVec_MonitorUpdateIdZZ_free(_res_conv);
29538 }
29539
29540 void  __attribute__((export_name("TS_CVec_C2Tuple_OutPointCVec_MonitorUpdateIdZZZ_free"))) TS_CVec_C2Tuple_OutPointCVec_MonitorUpdateIdZZZ_free(uint64_tArray _res) {
29541         LDKCVec_C2Tuple_OutPointCVec_MonitorUpdateIdZZZ _res_constr;
29542         _res_constr.datalen = _res->arr_len;
29543         if (_res_constr.datalen > 0)
29544                 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKC2Tuple_OutPointCVec_MonitorUpdateIdZZ), "LDKCVec_C2Tuple_OutPointCVec_MonitorUpdateIdZZZ Elements");
29545         else
29546                 _res_constr.data = NULL;
29547         uint64_t* _res_vals = _res->elems;
29548         for (size_t p = 0; p < _res_constr.datalen; p++) {
29549                 uint64_t _res_conv_41 = _res_vals[p];
29550                 void* _res_conv_41_ptr = untag_ptr(_res_conv_41);
29551                 CHECK_ACCESS(_res_conv_41_ptr);
29552                 LDKC2Tuple_OutPointCVec_MonitorUpdateIdZZ _res_conv_41_conv = *(LDKC2Tuple_OutPointCVec_MonitorUpdateIdZZ*)(_res_conv_41_ptr);
29553                 FREE(untag_ptr(_res_conv_41));
29554                 _res_constr.data[p] = _res_conv_41_conv;
29555         }
29556         FREE(_res);
29557         CVec_C2Tuple_OutPointCVec_MonitorUpdateIdZZZ_free(_res_constr);
29558 }
29559
29560 void  __attribute__((export_name("TS_APIError_free"))) TS_APIError_free(uint64_t this_ptr) {
29561         if (!ptr_is_owned(this_ptr)) return;
29562         void* this_ptr_ptr = untag_ptr(this_ptr);
29563         CHECK_ACCESS(this_ptr_ptr);
29564         LDKAPIError this_ptr_conv = *(LDKAPIError*)(this_ptr_ptr);
29565         FREE(untag_ptr(this_ptr));
29566         APIError_free(this_ptr_conv);
29567 }
29568
29569 static inline uint64_t APIError_clone_ptr(LDKAPIError *NONNULL_PTR arg) {
29570         LDKAPIError *ret_copy = MALLOC(sizeof(LDKAPIError), "LDKAPIError");
29571         *ret_copy = APIError_clone(arg);
29572         uint64_t ret_ref = tag_ptr(ret_copy, true);
29573         return ret_ref;
29574 }
29575 int64_t  __attribute__((export_name("TS_APIError_clone_ptr"))) TS_APIError_clone_ptr(uint64_t arg) {
29576         LDKAPIError* arg_conv = (LDKAPIError*)untag_ptr(arg);
29577         int64_t ret_conv = APIError_clone_ptr(arg_conv);
29578         return ret_conv;
29579 }
29580
29581 uint64_t  __attribute__((export_name("TS_APIError_clone"))) TS_APIError_clone(uint64_t orig) {
29582         LDKAPIError* orig_conv = (LDKAPIError*)untag_ptr(orig);
29583         LDKAPIError *ret_copy = MALLOC(sizeof(LDKAPIError), "LDKAPIError");
29584         *ret_copy = APIError_clone(orig_conv);
29585         uint64_t ret_ref = tag_ptr(ret_copy, true);
29586         return ret_ref;
29587 }
29588
29589 uint64_t  __attribute__((export_name("TS_APIError_apimisuse_error"))) TS_APIError_apimisuse_error(jstring err) {
29590         LDKStr err_conv = str_ref_to_owned_c(err);
29591         LDKAPIError *ret_copy = MALLOC(sizeof(LDKAPIError), "LDKAPIError");
29592         *ret_copy = APIError_apimisuse_error(err_conv);
29593         uint64_t ret_ref = tag_ptr(ret_copy, true);
29594         return ret_ref;
29595 }
29596
29597 uint64_t  __attribute__((export_name("TS_APIError_fee_rate_too_high"))) TS_APIError_fee_rate_too_high(jstring err, int32_t feerate) {
29598         LDKStr err_conv = str_ref_to_owned_c(err);
29599         LDKAPIError *ret_copy = MALLOC(sizeof(LDKAPIError), "LDKAPIError");
29600         *ret_copy = APIError_fee_rate_too_high(err_conv, feerate);
29601         uint64_t ret_ref = tag_ptr(ret_copy, true);
29602         return ret_ref;
29603 }
29604
29605 uint64_t  __attribute__((export_name("TS_APIError_invalid_route"))) TS_APIError_invalid_route(jstring err) {
29606         LDKStr err_conv = str_ref_to_owned_c(err);
29607         LDKAPIError *ret_copy = MALLOC(sizeof(LDKAPIError), "LDKAPIError");
29608         *ret_copy = APIError_invalid_route(err_conv);
29609         uint64_t ret_ref = tag_ptr(ret_copy, true);
29610         return ret_ref;
29611 }
29612
29613 uint64_t  __attribute__((export_name("TS_APIError_channel_unavailable"))) TS_APIError_channel_unavailable(jstring err) {
29614         LDKStr err_conv = str_ref_to_owned_c(err);
29615         LDKAPIError *ret_copy = MALLOC(sizeof(LDKAPIError), "LDKAPIError");
29616         *ret_copy = APIError_channel_unavailable(err_conv);
29617         uint64_t ret_ref = tag_ptr(ret_copy, true);
29618         return ret_ref;
29619 }
29620
29621 uint64_t  __attribute__((export_name("TS_APIError_monitor_update_in_progress"))) TS_APIError_monitor_update_in_progress() {
29622         LDKAPIError *ret_copy = MALLOC(sizeof(LDKAPIError), "LDKAPIError");
29623         *ret_copy = APIError_monitor_update_in_progress();
29624         uint64_t ret_ref = tag_ptr(ret_copy, true);
29625         return ret_ref;
29626 }
29627
29628 uint64_t  __attribute__((export_name("TS_APIError_incompatible_shutdown_script"))) TS_APIError_incompatible_shutdown_script(uint64_t script) {
29629         LDKShutdownScript script_conv;
29630         script_conv.inner = untag_ptr(script);
29631         script_conv.is_owned = ptr_is_owned(script);
29632         CHECK_INNER_FIELD_ACCESS_OR_NULL(script_conv);
29633         script_conv = ShutdownScript_clone(&script_conv);
29634         LDKAPIError *ret_copy = MALLOC(sizeof(LDKAPIError), "LDKAPIError");
29635         *ret_copy = APIError_incompatible_shutdown_script(script_conv);
29636         uint64_t ret_ref = tag_ptr(ret_copy, true);
29637         return ret_ref;
29638 }
29639
29640 jboolean  __attribute__((export_name("TS_APIError_eq"))) TS_APIError_eq(uint64_t a, uint64_t b) {
29641         LDKAPIError* a_conv = (LDKAPIError*)untag_ptr(a);
29642         LDKAPIError* b_conv = (LDKAPIError*)untag_ptr(b);
29643         jboolean ret_conv = APIError_eq(a_conv, b_conv);
29644         return ret_conv;
29645 }
29646
29647 int8_tArray  __attribute__((export_name("TS_APIError_write"))) TS_APIError_write(uint64_t obj) {
29648         LDKAPIError* obj_conv = (LDKAPIError*)untag_ptr(obj);
29649         LDKCVec_u8Z ret_var = APIError_write(obj_conv);
29650         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
29651         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
29652         CVec_u8Z_free(ret_var);
29653         return ret_arr;
29654 }
29655
29656 uint64_t  __attribute__((export_name("TS_APIError_read"))) TS_APIError_read(int8_tArray ser) {
29657         LDKu8slice ser_ref;
29658         ser_ref.datalen = ser->arr_len;
29659         ser_ref.data = ser->elems;
29660         LDKCResult_COption_APIErrorZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_COption_APIErrorZDecodeErrorZ), "LDKCResult_COption_APIErrorZDecodeErrorZ");
29661         *ret_conv = APIError_read(ser_ref);
29662         FREE(ser);
29663         return tag_ptr(ret_conv, true);
29664 }
29665
29666 void  __attribute__((export_name("TS_BigSize_free"))) TS_BigSize_free(uint64_t this_obj) {
29667         LDKBigSize this_obj_conv;
29668         this_obj_conv.inner = untag_ptr(this_obj);
29669         this_obj_conv.is_owned = ptr_is_owned(this_obj);
29670         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
29671         BigSize_free(this_obj_conv);
29672 }
29673
29674 int64_t  __attribute__((export_name("TS_BigSize_get_a"))) TS_BigSize_get_a(uint64_t this_ptr) {
29675         LDKBigSize this_ptr_conv;
29676         this_ptr_conv.inner = untag_ptr(this_ptr);
29677         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
29678         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
29679         this_ptr_conv.is_owned = false;
29680         int64_t ret_conv = BigSize_get_a(&this_ptr_conv);
29681         return ret_conv;
29682 }
29683
29684 void  __attribute__((export_name("TS_BigSize_set_a"))) TS_BigSize_set_a(uint64_t this_ptr, int64_t val) {
29685         LDKBigSize this_ptr_conv;
29686         this_ptr_conv.inner = untag_ptr(this_ptr);
29687         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
29688         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
29689         this_ptr_conv.is_owned = false;
29690         BigSize_set_a(&this_ptr_conv, val);
29691 }
29692
29693 uint64_t  __attribute__((export_name("TS_BigSize_new"))) TS_BigSize_new(int64_t a_arg) {
29694         LDKBigSize ret_var = BigSize_new(a_arg);
29695         uint64_t ret_ref = 0;
29696         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
29697         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
29698         return ret_ref;
29699 }
29700
29701 static inline uint64_t BigSize_clone_ptr(LDKBigSize *NONNULL_PTR arg) {
29702         LDKBigSize ret_var = BigSize_clone(arg);
29703         uint64_t ret_ref = 0;
29704         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
29705         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
29706         return ret_ref;
29707 }
29708 int64_t  __attribute__((export_name("TS_BigSize_clone_ptr"))) TS_BigSize_clone_ptr(uint64_t arg) {
29709         LDKBigSize arg_conv;
29710         arg_conv.inner = untag_ptr(arg);
29711         arg_conv.is_owned = ptr_is_owned(arg);
29712         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
29713         arg_conv.is_owned = false;
29714         int64_t ret_conv = BigSize_clone_ptr(&arg_conv);
29715         return ret_conv;
29716 }
29717
29718 uint64_t  __attribute__((export_name("TS_BigSize_clone"))) TS_BigSize_clone(uint64_t orig) {
29719         LDKBigSize orig_conv;
29720         orig_conv.inner = untag_ptr(orig);
29721         orig_conv.is_owned = ptr_is_owned(orig);
29722         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
29723         orig_conv.is_owned = false;
29724         LDKBigSize ret_var = BigSize_clone(&orig_conv);
29725         uint64_t ret_ref = 0;
29726         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
29727         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
29728         return ret_ref;
29729 }
29730
29731 int64_t  __attribute__((export_name("TS_BigSize_hash"))) TS_BigSize_hash(uint64_t o) {
29732         LDKBigSize o_conv;
29733         o_conv.inner = untag_ptr(o);
29734         o_conv.is_owned = ptr_is_owned(o);
29735         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
29736         o_conv.is_owned = false;
29737         int64_t ret_conv = BigSize_hash(&o_conv);
29738         return ret_conv;
29739 }
29740
29741 jboolean  __attribute__((export_name("TS_BigSize_eq"))) TS_BigSize_eq(uint64_t a, uint64_t b) {
29742         LDKBigSize a_conv;
29743         a_conv.inner = untag_ptr(a);
29744         a_conv.is_owned = ptr_is_owned(a);
29745         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
29746         a_conv.is_owned = false;
29747         LDKBigSize b_conv;
29748         b_conv.inner = untag_ptr(b);
29749         b_conv.is_owned = ptr_is_owned(b);
29750         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
29751         b_conv.is_owned = false;
29752         jboolean ret_conv = BigSize_eq(&a_conv, &b_conv);
29753         return ret_conv;
29754 }
29755
29756 int8_tArray  __attribute__((export_name("TS_BigSize_write"))) TS_BigSize_write(uint64_t obj) {
29757         LDKBigSize obj_conv;
29758         obj_conv.inner = untag_ptr(obj);
29759         obj_conv.is_owned = ptr_is_owned(obj);
29760         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
29761         obj_conv.is_owned = false;
29762         LDKCVec_u8Z ret_var = BigSize_write(&obj_conv);
29763         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
29764         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
29765         CVec_u8Z_free(ret_var);
29766         return ret_arr;
29767 }
29768
29769 uint64_t  __attribute__((export_name("TS_BigSize_read"))) TS_BigSize_read(int8_tArray ser) {
29770         LDKu8slice ser_ref;
29771         ser_ref.datalen = ser->arr_len;
29772         ser_ref.data = ser->elems;
29773         LDKCResult_BigSizeDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_BigSizeDecodeErrorZ), "LDKCResult_BigSizeDecodeErrorZ");
29774         *ret_conv = BigSize_read(ser_ref);
29775         FREE(ser);
29776         return tag_ptr(ret_conv, true);
29777 }
29778
29779 void  __attribute__((export_name("TS_Hostname_free"))) TS_Hostname_free(uint64_t this_obj) {
29780         LDKHostname this_obj_conv;
29781         this_obj_conv.inner = untag_ptr(this_obj);
29782         this_obj_conv.is_owned = ptr_is_owned(this_obj);
29783         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
29784         Hostname_free(this_obj_conv);
29785 }
29786
29787 static inline uint64_t Hostname_clone_ptr(LDKHostname *NONNULL_PTR arg) {
29788         LDKHostname ret_var = Hostname_clone(arg);
29789         uint64_t ret_ref = 0;
29790         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
29791         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
29792         return ret_ref;
29793 }
29794 int64_t  __attribute__((export_name("TS_Hostname_clone_ptr"))) TS_Hostname_clone_ptr(uint64_t arg) {
29795         LDKHostname arg_conv;
29796         arg_conv.inner = untag_ptr(arg);
29797         arg_conv.is_owned = ptr_is_owned(arg);
29798         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
29799         arg_conv.is_owned = false;
29800         int64_t ret_conv = Hostname_clone_ptr(&arg_conv);
29801         return ret_conv;
29802 }
29803
29804 uint64_t  __attribute__((export_name("TS_Hostname_clone"))) TS_Hostname_clone(uint64_t orig) {
29805         LDKHostname orig_conv;
29806         orig_conv.inner = untag_ptr(orig);
29807         orig_conv.is_owned = ptr_is_owned(orig);
29808         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
29809         orig_conv.is_owned = false;
29810         LDKHostname ret_var = Hostname_clone(&orig_conv);
29811         uint64_t ret_ref = 0;
29812         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
29813         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
29814         return ret_ref;
29815 }
29816
29817 jboolean  __attribute__((export_name("TS_Hostname_eq"))) TS_Hostname_eq(uint64_t a, uint64_t b) {
29818         LDKHostname a_conv;
29819         a_conv.inner = untag_ptr(a);
29820         a_conv.is_owned = ptr_is_owned(a);
29821         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
29822         a_conv.is_owned = false;
29823         LDKHostname b_conv;
29824         b_conv.inner = untag_ptr(b);
29825         b_conv.is_owned = ptr_is_owned(b);
29826         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
29827         b_conv.is_owned = false;
29828         jboolean ret_conv = Hostname_eq(&a_conv, &b_conv);
29829         return ret_conv;
29830 }
29831
29832 int8_t  __attribute__((export_name("TS_Hostname_len"))) TS_Hostname_len(uint64_t this_arg) {
29833         LDKHostname this_arg_conv;
29834         this_arg_conv.inner = untag_ptr(this_arg);
29835         this_arg_conv.is_owned = ptr_is_owned(this_arg);
29836         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
29837         this_arg_conv.is_owned = false;
29838         int8_t ret_conv = Hostname_len(&this_arg_conv);
29839         return ret_conv;
29840 }
29841
29842 int8_tArray  __attribute__((export_name("TS_Hostname_write"))) TS_Hostname_write(uint64_t obj) {
29843         LDKHostname obj_conv;
29844         obj_conv.inner = untag_ptr(obj);
29845         obj_conv.is_owned = ptr_is_owned(obj);
29846         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
29847         obj_conv.is_owned = false;
29848         LDKCVec_u8Z ret_var = Hostname_write(&obj_conv);
29849         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
29850         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
29851         CVec_u8Z_free(ret_var);
29852         return ret_arr;
29853 }
29854
29855 uint64_t  __attribute__((export_name("TS_Hostname_read"))) TS_Hostname_read(int8_tArray ser) {
29856         LDKu8slice ser_ref;
29857         ser_ref.datalen = ser->arr_len;
29858         ser_ref.data = ser->elems;
29859         LDKCResult_HostnameDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_HostnameDecodeErrorZ), "LDKCResult_HostnameDecodeErrorZ");
29860         *ret_conv = Hostname_read(ser_ref);
29861         FREE(ser);
29862         return tag_ptr(ret_conv, true);
29863 }
29864
29865 void  __attribute__((export_name("TS_TransactionU16LenLimited_free"))) TS_TransactionU16LenLimited_free(uint64_t this_obj) {
29866         LDKTransactionU16LenLimited this_obj_conv;
29867         this_obj_conv.inner = untag_ptr(this_obj);
29868         this_obj_conv.is_owned = ptr_is_owned(this_obj);
29869         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
29870         TransactionU16LenLimited_free(this_obj_conv);
29871 }
29872
29873 static inline uint64_t TransactionU16LenLimited_clone_ptr(LDKTransactionU16LenLimited *NONNULL_PTR arg) {
29874         LDKTransactionU16LenLimited ret_var = TransactionU16LenLimited_clone(arg);
29875         uint64_t ret_ref = 0;
29876         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
29877         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
29878         return ret_ref;
29879 }
29880 int64_t  __attribute__((export_name("TS_TransactionU16LenLimited_clone_ptr"))) TS_TransactionU16LenLimited_clone_ptr(uint64_t arg) {
29881         LDKTransactionU16LenLimited arg_conv;
29882         arg_conv.inner = untag_ptr(arg);
29883         arg_conv.is_owned = ptr_is_owned(arg);
29884         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
29885         arg_conv.is_owned = false;
29886         int64_t ret_conv = TransactionU16LenLimited_clone_ptr(&arg_conv);
29887         return ret_conv;
29888 }
29889
29890 uint64_t  __attribute__((export_name("TS_TransactionU16LenLimited_clone"))) TS_TransactionU16LenLimited_clone(uint64_t orig) {
29891         LDKTransactionU16LenLimited orig_conv;
29892         orig_conv.inner = untag_ptr(orig);
29893         orig_conv.is_owned = ptr_is_owned(orig);
29894         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
29895         orig_conv.is_owned = false;
29896         LDKTransactionU16LenLimited ret_var = TransactionU16LenLimited_clone(&orig_conv);
29897         uint64_t ret_ref = 0;
29898         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
29899         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
29900         return ret_ref;
29901 }
29902
29903 jboolean  __attribute__((export_name("TS_TransactionU16LenLimited_eq"))) TS_TransactionU16LenLimited_eq(uint64_t a, uint64_t b) {
29904         LDKTransactionU16LenLimited a_conv;
29905         a_conv.inner = untag_ptr(a);
29906         a_conv.is_owned = ptr_is_owned(a);
29907         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
29908         a_conv.is_owned = false;
29909         LDKTransactionU16LenLimited b_conv;
29910         b_conv.inner = untag_ptr(b);
29911         b_conv.is_owned = ptr_is_owned(b);
29912         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
29913         b_conv.is_owned = false;
29914         jboolean ret_conv = TransactionU16LenLimited_eq(&a_conv, &b_conv);
29915         return ret_conv;
29916 }
29917
29918 uint64_t  __attribute__((export_name("TS_TransactionU16LenLimited_new"))) TS_TransactionU16LenLimited_new(int8_tArray transaction) {
29919         LDKTransaction transaction_ref;
29920         transaction_ref.datalen = transaction->arr_len;
29921         transaction_ref.data = MALLOC(transaction_ref.datalen, "LDKTransaction Bytes");
29922         memcpy(transaction_ref.data, transaction->elems, transaction_ref.datalen); FREE(transaction);
29923         transaction_ref.data_is_owned = true;
29924         LDKCResult_TransactionU16LenLimitedNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_TransactionU16LenLimitedNoneZ), "LDKCResult_TransactionU16LenLimitedNoneZ");
29925         *ret_conv = TransactionU16LenLimited_new(transaction_ref);
29926         return tag_ptr(ret_conv, true);
29927 }
29928
29929 int8_tArray  __attribute__((export_name("TS_TransactionU16LenLimited_into_transaction"))) TS_TransactionU16LenLimited_into_transaction(uint64_t this_arg) {
29930         LDKTransactionU16LenLimited this_arg_conv;
29931         this_arg_conv.inner = untag_ptr(this_arg);
29932         this_arg_conv.is_owned = ptr_is_owned(this_arg);
29933         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
29934         this_arg_conv = TransactionU16LenLimited_clone(&this_arg_conv);
29935         LDKTransaction ret_var = TransactionU16LenLimited_into_transaction(this_arg_conv);
29936         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
29937         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
29938         Transaction_free(ret_var);
29939         return ret_arr;
29940 }
29941
29942 int8_tArray  __attribute__((export_name("TS_TransactionU16LenLimited_write"))) TS_TransactionU16LenLimited_write(uint64_t obj) {
29943         LDKTransactionU16LenLimited obj_conv;
29944         obj_conv.inner = untag_ptr(obj);
29945         obj_conv.is_owned = ptr_is_owned(obj);
29946         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
29947         obj_conv.is_owned = false;
29948         LDKCVec_u8Z ret_var = TransactionU16LenLimited_write(&obj_conv);
29949         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
29950         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
29951         CVec_u8Z_free(ret_var);
29952         return ret_arr;
29953 }
29954
29955 uint64_t  __attribute__((export_name("TS_TransactionU16LenLimited_read"))) TS_TransactionU16LenLimited_read(int8_tArray ser) {
29956         LDKu8slice ser_ref;
29957         ser_ref.datalen = ser->arr_len;
29958         ser_ref.data = ser->elems;
29959         LDKCResult_TransactionU16LenLimitedDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TransactionU16LenLimitedDecodeErrorZ), "LDKCResult_TransactionU16LenLimitedDecodeErrorZ");
29960         *ret_conv = TransactionU16LenLimited_read(ser_ref);
29961         FREE(ser);
29962         return tag_ptr(ret_conv, true);
29963 }
29964
29965 uint64_t  __attribute__((export_name("TS_sign"))) TS_sign(int8_tArray msg, int8_tArray sk) {
29966         LDKu8slice msg_ref;
29967         msg_ref.datalen = msg->arr_len;
29968         msg_ref.data = msg->elems;
29969         uint8_t sk_arr[32];
29970         CHECK(sk->arr_len == 32);
29971         memcpy(sk_arr, sk->elems, 32); FREE(sk);
29972         uint8_t (*sk_ref)[32] = &sk_arr;
29973         LDKCResult_StrSecp256k1ErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_StrSecp256k1ErrorZ), "LDKCResult_StrSecp256k1ErrorZ");
29974         *ret_conv = sign(msg_ref, sk_ref);
29975         FREE(msg);
29976         return tag_ptr(ret_conv, true);
29977 }
29978
29979 uint64_t  __attribute__((export_name("TS_recover_pk"))) TS_recover_pk(int8_tArray msg, jstring sig) {
29980         LDKu8slice msg_ref;
29981         msg_ref.datalen = msg->arr_len;
29982         msg_ref.data = msg->elems;
29983         LDKStr sig_conv = str_ref_to_owned_c(sig);
29984         LDKCResult_PublicKeySecp256k1ErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PublicKeySecp256k1ErrorZ), "LDKCResult_PublicKeySecp256k1ErrorZ");
29985         *ret_conv = recover_pk(msg_ref, sig_conv);
29986         FREE(msg);
29987         return tag_ptr(ret_conv, true);
29988 }
29989
29990 jboolean  __attribute__((export_name("TS_verify"))) TS_verify(int8_tArray msg, jstring sig, int8_tArray pk) {
29991         LDKu8slice msg_ref;
29992         msg_ref.datalen = msg->arr_len;
29993         msg_ref.data = msg->elems;
29994         LDKStr sig_conv = str_ref_to_owned_c(sig);
29995         LDKPublicKey pk_ref;
29996         CHECK(pk->arr_len == 33);
29997         memcpy(pk_ref.compressed_form, pk->elems, 33); FREE(pk);
29998         jboolean ret_conv = verify(msg_ref, sig_conv, pk_ref);
29999         FREE(msg);
30000         return ret_conv;
30001 }
30002
30003 int8_tArray  __attribute__((export_name("TS_construct_invoice_preimage"))) TS_construct_invoice_preimage(int8_tArray hrp_bytes, ptrArray data_without_signature) {
30004         LDKu8slice hrp_bytes_ref;
30005         hrp_bytes_ref.datalen = hrp_bytes->arr_len;
30006         hrp_bytes_ref.data = hrp_bytes->elems;
30007         LDKCVec_U5Z data_without_signature_constr;
30008         data_without_signature_constr.datalen = data_without_signature->arr_len;
30009         if (data_without_signature_constr.datalen > 0)
30010                 data_without_signature_constr.data = MALLOC(data_without_signature_constr.datalen * sizeof(LDKU5), "LDKCVec_U5Z Elements");
30011         else
30012                 data_without_signature_constr.data = NULL;
30013         int8_t* data_without_signature_vals = (void*) data_without_signature->elems;
30014         for (size_t h = 0; h < data_without_signature_constr.datalen; h++) {
30015                 int8_t data_without_signature_conv_7 = data_without_signature_vals[h];
30016                 
30017                 data_without_signature_constr.data[h] = (LDKU5){ ._0 = data_without_signature_conv_7 };
30018         }
30019         FREE(data_without_signature);
30020         LDKCVec_u8Z ret_var = construct_invoice_preimage(hrp_bytes_ref, data_without_signature_constr);
30021         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
30022         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
30023         CVec_u8Z_free(ret_var);
30024         FREE(hrp_bytes);
30025         return ret_arr;
30026 }
30027
30028 void  __attribute__((export_name("TS_KVStore_free"))) TS_KVStore_free(uint64_t this_ptr) {
30029         if (!ptr_is_owned(this_ptr)) return;
30030         void* this_ptr_ptr = untag_ptr(this_ptr);
30031         CHECK_ACCESS(this_ptr_ptr);
30032         LDKKVStore this_ptr_conv = *(LDKKVStore*)(this_ptr_ptr);
30033         FREE(untag_ptr(this_ptr));
30034         KVStore_free(this_ptr_conv);
30035 }
30036
30037 void  __attribute__((export_name("TS_Persister_free"))) TS_Persister_free(uint64_t this_ptr) {
30038         if (!ptr_is_owned(this_ptr)) return;
30039         void* this_ptr_ptr = untag_ptr(this_ptr);
30040         CHECK_ACCESS(this_ptr_ptr);
30041         LDKPersister this_ptr_conv = *(LDKPersister*)(this_ptr_ptr);
30042         FREE(untag_ptr(this_ptr));
30043         Persister_free(this_ptr_conv);
30044 }
30045
30046 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) {
30047         void* kv_store_ptr = untag_ptr(kv_store);
30048         CHECK_ACCESS(kv_store_ptr);
30049         LDKKVStore kv_store_conv = *(LDKKVStore*)(kv_store_ptr);
30050         if (kv_store_conv.free == LDKKVStore_JCalls_free) {
30051                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
30052                 LDKKVStore_JCalls_cloned(&kv_store_conv);
30053         }
30054         void* entropy_source_ptr = untag_ptr(entropy_source);
30055         CHECK_ACCESS(entropy_source_ptr);
30056         LDKEntropySource entropy_source_conv = *(LDKEntropySource*)(entropy_source_ptr);
30057         if (entropy_source_conv.free == LDKEntropySource_JCalls_free) {
30058                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
30059                 LDKEntropySource_JCalls_cloned(&entropy_source_conv);
30060         }
30061         void* signer_provider_ptr = untag_ptr(signer_provider);
30062         CHECK_ACCESS(signer_provider_ptr);
30063         LDKSignerProvider signer_provider_conv = *(LDKSignerProvider*)(signer_provider_ptr);
30064         if (signer_provider_conv.free == LDKSignerProvider_JCalls_free) {
30065                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
30066                 LDKSignerProvider_JCalls_cloned(&signer_provider_conv);
30067         }
30068         LDKCResult_CVec_C2Tuple_ThirtyTwoBytesChannelMonitorZZIOErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_C2Tuple_ThirtyTwoBytesChannelMonitorZZIOErrorZ), "LDKCResult_CVec_C2Tuple_ThirtyTwoBytesChannelMonitorZZIOErrorZ");
30069         *ret_conv = read_channel_monitors(kv_store_conv, entropy_source_conv, signer_provider_conv);
30070         return tag_ptr(ret_conv, true);
30071 }
30072
30073 void  __attribute__((export_name("TS_MonitorUpdatingPersister_free"))) TS_MonitorUpdatingPersister_free(uint64_t this_obj) {
30074         LDKMonitorUpdatingPersister this_obj_conv;
30075         this_obj_conv.inner = untag_ptr(this_obj);
30076         this_obj_conv.is_owned = ptr_is_owned(this_obj);
30077         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
30078         MonitorUpdatingPersister_free(this_obj_conv);
30079 }
30080
30081 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) {
30082         void* kv_store_ptr = untag_ptr(kv_store);
30083         CHECK_ACCESS(kv_store_ptr);
30084         LDKKVStore kv_store_conv = *(LDKKVStore*)(kv_store_ptr);
30085         if (kv_store_conv.free == LDKKVStore_JCalls_free) {
30086                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
30087                 LDKKVStore_JCalls_cloned(&kv_store_conv);
30088         }
30089         void* logger_ptr = untag_ptr(logger);
30090         CHECK_ACCESS(logger_ptr);
30091         LDKLogger logger_conv = *(LDKLogger*)(logger_ptr);
30092         if (logger_conv.free == LDKLogger_JCalls_free) {
30093                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
30094                 LDKLogger_JCalls_cloned(&logger_conv);
30095         }
30096         void* entropy_source_ptr = untag_ptr(entropy_source);
30097         CHECK_ACCESS(entropy_source_ptr);
30098         LDKEntropySource entropy_source_conv = *(LDKEntropySource*)(entropy_source_ptr);
30099         if (entropy_source_conv.free == LDKEntropySource_JCalls_free) {
30100                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
30101                 LDKEntropySource_JCalls_cloned(&entropy_source_conv);
30102         }
30103         void* signer_provider_ptr = untag_ptr(signer_provider);
30104         CHECK_ACCESS(signer_provider_ptr);
30105         LDKSignerProvider signer_provider_conv = *(LDKSignerProvider*)(signer_provider_ptr);
30106         if (signer_provider_conv.free == LDKSignerProvider_JCalls_free) {
30107                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
30108                 LDKSignerProvider_JCalls_cloned(&signer_provider_conv);
30109         }
30110         LDKMonitorUpdatingPersister ret_var = MonitorUpdatingPersister_new(kv_store_conv, logger_conv, maximum_pending_updates, entropy_source_conv, signer_provider_conv);
30111         uint64_t ret_ref = 0;
30112         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
30113         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
30114         return ret_ref;
30115 }
30116
30117 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) {
30118         LDKMonitorUpdatingPersister this_arg_conv;
30119         this_arg_conv.inner = untag_ptr(this_arg);
30120         this_arg_conv.is_owned = ptr_is_owned(this_arg);
30121         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
30122         this_arg_conv.is_owned = false;
30123         void* broadcaster_ptr = untag_ptr(broadcaster);
30124         if (ptr_is_owned(broadcaster)) { CHECK_ACCESS(broadcaster_ptr); }
30125         LDKBroadcasterInterface* broadcaster_conv = (LDKBroadcasterInterface*)broadcaster_ptr;
30126         void* fee_estimator_ptr = untag_ptr(fee_estimator);
30127         if (ptr_is_owned(fee_estimator)) { CHECK_ACCESS(fee_estimator_ptr); }
30128         LDKFeeEstimator* fee_estimator_conv = (LDKFeeEstimator*)fee_estimator_ptr;
30129         LDKCResult_CVec_C2Tuple_ThirtyTwoBytesChannelMonitorZZIOErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_C2Tuple_ThirtyTwoBytesChannelMonitorZZIOErrorZ), "LDKCResult_CVec_C2Tuple_ThirtyTwoBytesChannelMonitorZZIOErrorZ");
30130         *ret_conv = MonitorUpdatingPersister_read_all_channel_monitors_with_updates(&this_arg_conv, broadcaster_conv, fee_estimator_conv);
30131         return tag_ptr(ret_conv, true);
30132 }
30133
30134 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) {
30135         LDKMonitorUpdatingPersister this_arg_conv;
30136         this_arg_conv.inner = untag_ptr(this_arg);
30137         this_arg_conv.is_owned = ptr_is_owned(this_arg);
30138         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
30139         this_arg_conv.is_owned = false;
30140         void* broadcaster_ptr = untag_ptr(broadcaster);
30141         if (ptr_is_owned(broadcaster)) { CHECK_ACCESS(broadcaster_ptr); }
30142         LDKBroadcasterInterface* broadcaster_conv = (LDKBroadcasterInterface*)broadcaster_ptr;
30143         void* fee_estimator_ptr = untag_ptr(fee_estimator);
30144         if (ptr_is_owned(fee_estimator)) { CHECK_ACCESS(fee_estimator_ptr); }
30145         LDKFeeEstimator* fee_estimator_conv = (LDKFeeEstimator*)fee_estimator_ptr;
30146         LDKStr monitor_key_conv = str_ref_to_owned_c(monitor_key);
30147         LDKCResult_C2Tuple_ThirtyTwoBytesChannelMonitorZIOErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_ThirtyTwoBytesChannelMonitorZIOErrorZ), "LDKCResult_C2Tuple_ThirtyTwoBytesChannelMonitorZIOErrorZ");
30148         *ret_conv = MonitorUpdatingPersister_read_channel_monitor_with_updates(&this_arg_conv, broadcaster_conv, fee_estimator_conv, monitor_key_conv);
30149         return tag_ptr(ret_conv, true);
30150 }
30151
30152 uint64_t  __attribute__((export_name("TS_MonitorUpdatingPersister_cleanup_stale_updates"))) TS_MonitorUpdatingPersister_cleanup_stale_updates(uint64_t this_arg, jboolean lazy) {
30153         LDKMonitorUpdatingPersister this_arg_conv;
30154         this_arg_conv.inner = untag_ptr(this_arg);
30155         this_arg_conv.is_owned = ptr_is_owned(this_arg);
30156         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
30157         this_arg_conv.is_owned = false;
30158         LDKCResult_NoneIOErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneIOErrorZ), "LDKCResult_NoneIOErrorZ");
30159         *ret_conv = MonitorUpdatingPersister_cleanup_stale_updates(&this_arg_conv, lazy);
30160         return tag_ptr(ret_conv, true);
30161 }
30162
30163 uint64_t  __attribute__((export_name("TS_MonitorUpdatingPersister_as_Persist"))) TS_MonitorUpdatingPersister_as_Persist(uint64_t this_arg) {
30164         LDKMonitorUpdatingPersister this_arg_conv;
30165         this_arg_conv.inner = untag_ptr(this_arg);
30166         this_arg_conv.is_owned = ptr_is_owned(this_arg);
30167         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
30168         this_arg_conv.is_owned = false;
30169         LDKPersist* ret_ret = MALLOC(sizeof(LDKPersist), "LDKPersist");
30170         *ret_ret = MonitorUpdatingPersister_as_Persist(&this_arg_conv);
30171         return tag_ptr(ret_ret, true);
30172 }
30173
30174 void  __attribute__((export_name("TS_UntrustedString_free"))) TS_UntrustedString_free(uint64_t this_obj) {
30175         LDKUntrustedString this_obj_conv;
30176         this_obj_conv.inner = untag_ptr(this_obj);
30177         this_obj_conv.is_owned = ptr_is_owned(this_obj);
30178         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
30179         UntrustedString_free(this_obj_conv);
30180 }
30181
30182 jstring  __attribute__((export_name("TS_UntrustedString_get_a"))) TS_UntrustedString_get_a(uint64_t this_ptr) {
30183         LDKUntrustedString this_ptr_conv;
30184         this_ptr_conv.inner = untag_ptr(this_ptr);
30185         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
30186         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
30187         this_ptr_conv.is_owned = false;
30188         LDKStr ret_str = UntrustedString_get_a(&this_ptr_conv);
30189         jstring ret_conv = str_ref_to_ts(ret_str.chars, ret_str.len);
30190         Str_free(ret_str);
30191         return ret_conv;
30192 }
30193
30194 void  __attribute__((export_name("TS_UntrustedString_set_a"))) TS_UntrustedString_set_a(uint64_t this_ptr, jstring val) {
30195         LDKUntrustedString this_ptr_conv;
30196         this_ptr_conv.inner = untag_ptr(this_ptr);
30197         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
30198         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
30199         this_ptr_conv.is_owned = false;
30200         LDKStr val_conv = str_ref_to_owned_c(val);
30201         UntrustedString_set_a(&this_ptr_conv, val_conv);
30202 }
30203
30204 uint64_t  __attribute__((export_name("TS_UntrustedString_new"))) TS_UntrustedString_new(jstring a_arg) {
30205         LDKStr a_arg_conv = str_ref_to_owned_c(a_arg);
30206         LDKUntrustedString ret_var = UntrustedString_new(a_arg_conv);
30207         uint64_t ret_ref = 0;
30208         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
30209         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
30210         return ret_ref;
30211 }
30212
30213 static inline uint64_t UntrustedString_clone_ptr(LDKUntrustedString *NONNULL_PTR arg) {
30214         LDKUntrustedString ret_var = UntrustedString_clone(arg);
30215         uint64_t ret_ref = 0;
30216         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
30217         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
30218         return ret_ref;
30219 }
30220 int64_t  __attribute__((export_name("TS_UntrustedString_clone_ptr"))) TS_UntrustedString_clone_ptr(uint64_t arg) {
30221         LDKUntrustedString arg_conv;
30222         arg_conv.inner = untag_ptr(arg);
30223         arg_conv.is_owned = ptr_is_owned(arg);
30224         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
30225         arg_conv.is_owned = false;
30226         int64_t ret_conv = UntrustedString_clone_ptr(&arg_conv);
30227         return ret_conv;
30228 }
30229
30230 uint64_t  __attribute__((export_name("TS_UntrustedString_clone"))) TS_UntrustedString_clone(uint64_t orig) {
30231         LDKUntrustedString orig_conv;
30232         orig_conv.inner = untag_ptr(orig);
30233         orig_conv.is_owned = ptr_is_owned(orig);
30234         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
30235         orig_conv.is_owned = false;
30236         LDKUntrustedString ret_var = UntrustedString_clone(&orig_conv);
30237         uint64_t ret_ref = 0;
30238         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
30239         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
30240         return ret_ref;
30241 }
30242
30243 jboolean  __attribute__((export_name("TS_UntrustedString_eq"))) TS_UntrustedString_eq(uint64_t a, uint64_t b) {
30244         LDKUntrustedString a_conv;
30245         a_conv.inner = untag_ptr(a);
30246         a_conv.is_owned = ptr_is_owned(a);
30247         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
30248         a_conv.is_owned = false;
30249         LDKUntrustedString b_conv;
30250         b_conv.inner = untag_ptr(b);
30251         b_conv.is_owned = ptr_is_owned(b);
30252         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
30253         b_conv.is_owned = false;
30254         jboolean ret_conv = UntrustedString_eq(&a_conv, &b_conv);
30255         return ret_conv;
30256 }
30257
30258 int8_tArray  __attribute__((export_name("TS_UntrustedString_write"))) TS_UntrustedString_write(uint64_t obj) {
30259         LDKUntrustedString obj_conv;
30260         obj_conv.inner = untag_ptr(obj);
30261         obj_conv.is_owned = ptr_is_owned(obj);
30262         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
30263         obj_conv.is_owned = false;
30264         LDKCVec_u8Z ret_var = UntrustedString_write(&obj_conv);
30265         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
30266         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
30267         CVec_u8Z_free(ret_var);
30268         return ret_arr;
30269 }
30270
30271 uint64_t  __attribute__((export_name("TS_UntrustedString_read"))) TS_UntrustedString_read(int8_tArray ser) {
30272         LDKu8slice ser_ref;
30273         ser_ref.datalen = ser->arr_len;
30274         ser_ref.data = ser->elems;
30275         LDKCResult_UntrustedStringDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UntrustedStringDecodeErrorZ), "LDKCResult_UntrustedStringDecodeErrorZ");
30276         *ret_conv = UntrustedString_read(ser_ref);
30277         FREE(ser);
30278         return tag_ptr(ret_conv, true);
30279 }
30280
30281 void  __attribute__((export_name("TS_PrintableString_free"))) TS_PrintableString_free(uint64_t this_obj) {
30282         LDKPrintableString this_obj_conv;
30283         this_obj_conv.inner = untag_ptr(this_obj);
30284         this_obj_conv.is_owned = ptr_is_owned(this_obj);
30285         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
30286         PrintableString_free(this_obj_conv);
30287 }
30288
30289 jstring  __attribute__((export_name("TS_PrintableString_get_a"))) TS_PrintableString_get_a(uint64_t this_ptr) {
30290         LDKPrintableString this_ptr_conv;
30291         this_ptr_conv.inner = untag_ptr(this_ptr);
30292         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
30293         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
30294         this_ptr_conv.is_owned = false;
30295         LDKStr ret_str = PrintableString_get_a(&this_ptr_conv);
30296         jstring ret_conv = str_ref_to_ts(ret_str.chars, ret_str.len);
30297         Str_free(ret_str);
30298         return ret_conv;
30299 }
30300
30301 void  __attribute__((export_name("TS_PrintableString_set_a"))) TS_PrintableString_set_a(uint64_t this_ptr, jstring val) {
30302         LDKPrintableString this_ptr_conv;
30303         this_ptr_conv.inner = untag_ptr(this_ptr);
30304         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
30305         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
30306         this_ptr_conv.is_owned = false;
30307         LDKStr val_conv = str_ref_to_owned_c(val);
30308         PrintableString_set_a(&this_ptr_conv, val_conv);
30309 }
30310
30311 uint64_t  __attribute__((export_name("TS_PrintableString_new"))) TS_PrintableString_new(jstring a_arg) {
30312         LDKStr a_arg_conv = str_ref_to_owned_c(a_arg);
30313         LDKPrintableString ret_var = PrintableString_new(a_arg_conv);
30314         uint64_t ret_ref = 0;
30315         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
30316         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
30317         return ret_ref;
30318 }
30319
30320 void  __attribute__((export_name("TS_FutureCallback_free"))) TS_FutureCallback_free(uint64_t this_ptr) {
30321         if (!ptr_is_owned(this_ptr)) return;
30322         void* this_ptr_ptr = untag_ptr(this_ptr);
30323         CHECK_ACCESS(this_ptr_ptr);
30324         LDKFutureCallback this_ptr_conv = *(LDKFutureCallback*)(this_ptr_ptr);
30325         FREE(untag_ptr(this_ptr));
30326         FutureCallback_free(this_ptr_conv);
30327 }
30328
30329 void  __attribute__((export_name("TS_Future_free"))) TS_Future_free(uint64_t this_obj) {
30330         LDKFuture this_obj_conv;
30331         this_obj_conv.inner = untag_ptr(this_obj);
30332         this_obj_conv.is_owned = ptr_is_owned(this_obj);
30333         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
30334         Future_free(this_obj_conv);
30335 }
30336
30337 static inline uint64_t Future_clone_ptr(LDKFuture *NONNULL_PTR arg) {
30338         LDKFuture ret_var = Future_clone(arg);
30339         uint64_t ret_ref = 0;
30340         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
30341         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
30342         return ret_ref;
30343 }
30344 int64_t  __attribute__((export_name("TS_Future_clone_ptr"))) TS_Future_clone_ptr(uint64_t arg) {
30345         LDKFuture arg_conv;
30346         arg_conv.inner = untag_ptr(arg);
30347         arg_conv.is_owned = ptr_is_owned(arg);
30348         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
30349         arg_conv.is_owned = false;
30350         int64_t ret_conv = Future_clone_ptr(&arg_conv);
30351         return ret_conv;
30352 }
30353
30354 uint64_t  __attribute__((export_name("TS_Future_clone"))) TS_Future_clone(uint64_t orig) {
30355         LDKFuture orig_conv;
30356         orig_conv.inner = untag_ptr(orig);
30357         orig_conv.is_owned = ptr_is_owned(orig);
30358         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
30359         orig_conv.is_owned = false;
30360         LDKFuture ret_var = Future_clone(&orig_conv);
30361         uint64_t ret_ref = 0;
30362         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
30363         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
30364         return ret_ref;
30365 }
30366
30367 void  __attribute__((export_name("TS_Future_register_callback_fn"))) TS_Future_register_callback_fn(uint64_t this_arg, uint64_t callback) {
30368         LDKFuture this_arg_conv;
30369         this_arg_conv.inner = untag_ptr(this_arg);
30370         this_arg_conv.is_owned = ptr_is_owned(this_arg);
30371         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
30372         this_arg_conv.is_owned = false;
30373         void* callback_ptr = untag_ptr(callback);
30374         CHECK_ACCESS(callback_ptr);
30375         LDKFutureCallback callback_conv = *(LDKFutureCallback*)(callback_ptr);
30376         if (callback_conv.free == LDKFutureCallback_JCalls_free) {
30377                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
30378                 LDKFutureCallback_JCalls_cloned(&callback_conv);
30379         }
30380         Future_register_callback_fn(&this_arg_conv, callback_conv);
30381 }
30382
30383 uint32_t  __attribute__((export_name("TS_Level_clone"))) TS_Level_clone(uint64_t orig) {
30384         LDKLevel* orig_conv = (LDKLevel*)untag_ptr(orig);
30385         uint32_t ret_conv = LDKLevel_to_js(Level_clone(orig_conv));
30386         return ret_conv;
30387 }
30388
30389 uint32_t  __attribute__((export_name("TS_Level_gossip"))) TS_Level_gossip() {
30390         uint32_t ret_conv = LDKLevel_to_js(Level_gossip());
30391         return ret_conv;
30392 }
30393
30394 uint32_t  __attribute__((export_name("TS_Level_trace"))) TS_Level_trace() {
30395         uint32_t ret_conv = LDKLevel_to_js(Level_trace());
30396         return ret_conv;
30397 }
30398
30399 uint32_t  __attribute__((export_name("TS_Level_debug"))) TS_Level_debug() {
30400         uint32_t ret_conv = LDKLevel_to_js(Level_debug());
30401         return ret_conv;
30402 }
30403
30404 uint32_t  __attribute__((export_name("TS_Level_info"))) TS_Level_info() {
30405         uint32_t ret_conv = LDKLevel_to_js(Level_info());
30406         return ret_conv;
30407 }
30408
30409 uint32_t  __attribute__((export_name("TS_Level_warn"))) TS_Level_warn() {
30410         uint32_t ret_conv = LDKLevel_to_js(Level_warn());
30411         return ret_conv;
30412 }
30413
30414 uint32_t  __attribute__((export_name("TS_Level_error"))) TS_Level_error() {
30415         uint32_t ret_conv = LDKLevel_to_js(Level_error());
30416         return ret_conv;
30417 }
30418
30419 jboolean  __attribute__((export_name("TS_Level_eq"))) TS_Level_eq(uint64_t a, uint64_t b) {
30420         LDKLevel* a_conv = (LDKLevel*)untag_ptr(a);
30421         LDKLevel* b_conv = (LDKLevel*)untag_ptr(b);
30422         jboolean ret_conv = Level_eq(a_conv, b_conv);
30423         return ret_conv;
30424 }
30425
30426 int64_t  __attribute__((export_name("TS_Level_hash"))) TS_Level_hash(uint64_t o) {
30427         LDKLevel* o_conv = (LDKLevel*)untag_ptr(o);
30428         int64_t ret_conv = Level_hash(o_conv);
30429         return ret_conv;
30430 }
30431
30432 uint32_t  __attribute__((export_name("TS_Level_max"))) TS_Level_max() {
30433         uint32_t ret_conv = LDKLevel_to_js(Level_max());
30434         return ret_conv;
30435 }
30436
30437 void  __attribute__((export_name("TS_Record_free"))) TS_Record_free(uint64_t this_obj) {
30438         LDKRecord this_obj_conv;
30439         this_obj_conv.inner = untag_ptr(this_obj);
30440         this_obj_conv.is_owned = ptr_is_owned(this_obj);
30441         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
30442         Record_free(this_obj_conv);
30443 }
30444
30445 uint32_t  __attribute__((export_name("TS_Record_get_level"))) TS_Record_get_level(uint64_t this_ptr) {
30446         LDKRecord this_ptr_conv;
30447         this_ptr_conv.inner = untag_ptr(this_ptr);
30448         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
30449         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
30450         this_ptr_conv.is_owned = false;
30451         uint32_t ret_conv = LDKLevel_to_js(Record_get_level(&this_ptr_conv));
30452         return ret_conv;
30453 }
30454
30455 void  __attribute__((export_name("TS_Record_set_level"))) TS_Record_set_level(uint64_t this_ptr, uint32_t val) {
30456         LDKRecord this_ptr_conv;
30457         this_ptr_conv.inner = untag_ptr(this_ptr);
30458         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
30459         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
30460         this_ptr_conv.is_owned = false;
30461         LDKLevel val_conv = LDKLevel_from_js(val);
30462         Record_set_level(&this_ptr_conv, val_conv);
30463 }
30464
30465 jstring  __attribute__((export_name("TS_Record_get_args"))) TS_Record_get_args(uint64_t this_ptr) {
30466         LDKRecord this_ptr_conv;
30467         this_ptr_conv.inner = untag_ptr(this_ptr);
30468         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
30469         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
30470         this_ptr_conv.is_owned = false;
30471         LDKStr ret_str = Record_get_args(&this_ptr_conv);
30472         jstring ret_conv = str_ref_to_ts(ret_str.chars, ret_str.len);
30473         Str_free(ret_str);
30474         return ret_conv;
30475 }
30476
30477 void  __attribute__((export_name("TS_Record_set_args"))) TS_Record_set_args(uint64_t this_ptr, jstring val) {
30478         LDKRecord this_ptr_conv;
30479         this_ptr_conv.inner = untag_ptr(this_ptr);
30480         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
30481         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
30482         this_ptr_conv.is_owned = false;
30483         LDKStr val_conv = str_ref_to_owned_c(val);
30484         Record_set_args(&this_ptr_conv, val_conv);
30485 }
30486
30487 jstring  __attribute__((export_name("TS_Record_get_module_path"))) TS_Record_get_module_path(uint64_t this_ptr) {
30488         LDKRecord this_ptr_conv;
30489         this_ptr_conv.inner = untag_ptr(this_ptr);
30490         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
30491         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
30492         this_ptr_conv.is_owned = false;
30493         LDKStr ret_str = Record_get_module_path(&this_ptr_conv);
30494         jstring ret_conv = str_ref_to_ts(ret_str.chars, ret_str.len);
30495         Str_free(ret_str);
30496         return ret_conv;
30497 }
30498
30499 void  __attribute__((export_name("TS_Record_set_module_path"))) TS_Record_set_module_path(uint64_t this_ptr, jstring val) {
30500         LDKRecord this_ptr_conv;
30501         this_ptr_conv.inner = untag_ptr(this_ptr);
30502         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
30503         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
30504         this_ptr_conv.is_owned = false;
30505         LDKStr val_conv = str_ref_to_owned_c(val);
30506         Record_set_module_path(&this_ptr_conv, val_conv);
30507 }
30508
30509 jstring  __attribute__((export_name("TS_Record_get_file"))) TS_Record_get_file(uint64_t this_ptr) {
30510         LDKRecord this_ptr_conv;
30511         this_ptr_conv.inner = untag_ptr(this_ptr);
30512         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
30513         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
30514         this_ptr_conv.is_owned = false;
30515         LDKStr ret_str = Record_get_file(&this_ptr_conv);
30516         jstring ret_conv = str_ref_to_ts(ret_str.chars, ret_str.len);
30517         Str_free(ret_str);
30518         return ret_conv;
30519 }
30520
30521 void  __attribute__((export_name("TS_Record_set_file"))) TS_Record_set_file(uint64_t this_ptr, jstring val) {
30522         LDKRecord this_ptr_conv;
30523         this_ptr_conv.inner = untag_ptr(this_ptr);
30524         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
30525         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
30526         this_ptr_conv.is_owned = false;
30527         LDKStr val_conv = str_ref_to_owned_c(val);
30528         Record_set_file(&this_ptr_conv, val_conv);
30529 }
30530
30531 int32_t  __attribute__((export_name("TS_Record_get_line"))) TS_Record_get_line(uint64_t this_ptr) {
30532         LDKRecord this_ptr_conv;
30533         this_ptr_conv.inner = untag_ptr(this_ptr);
30534         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
30535         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
30536         this_ptr_conv.is_owned = false;
30537         int32_t ret_conv = Record_get_line(&this_ptr_conv);
30538         return ret_conv;
30539 }
30540
30541 void  __attribute__((export_name("TS_Record_set_line"))) TS_Record_set_line(uint64_t this_ptr, int32_t val) {
30542         LDKRecord this_ptr_conv;
30543         this_ptr_conv.inner = untag_ptr(this_ptr);
30544         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
30545         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
30546         this_ptr_conv.is_owned = false;
30547         Record_set_line(&this_ptr_conv, val);
30548 }
30549
30550 static inline uint64_t Record_clone_ptr(LDKRecord *NONNULL_PTR arg) {
30551         LDKRecord ret_var = Record_clone(arg);
30552         uint64_t ret_ref = 0;
30553         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
30554         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
30555         return ret_ref;
30556 }
30557 int64_t  __attribute__((export_name("TS_Record_clone_ptr"))) TS_Record_clone_ptr(uint64_t arg) {
30558         LDKRecord arg_conv;
30559         arg_conv.inner = untag_ptr(arg);
30560         arg_conv.is_owned = ptr_is_owned(arg);
30561         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
30562         arg_conv.is_owned = false;
30563         int64_t ret_conv = Record_clone_ptr(&arg_conv);
30564         return ret_conv;
30565 }
30566
30567 uint64_t  __attribute__((export_name("TS_Record_clone"))) TS_Record_clone(uint64_t orig) {
30568         LDKRecord orig_conv;
30569         orig_conv.inner = untag_ptr(orig);
30570         orig_conv.is_owned = ptr_is_owned(orig);
30571         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
30572         orig_conv.is_owned = false;
30573         LDKRecord ret_var = Record_clone(&orig_conv);
30574         uint64_t ret_ref = 0;
30575         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
30576         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
30577         return ret_ref;
30578 }
30579
30580 void  __attribute__((export_name("TS_Logger_free"))) TS_Logger_free(uint64_t this_ptr) {
30581         if (!ptr_is_owned(this_ptr)) return;
30582         void* this_ptr_ptr = untag_ptr(this_ptr);
30583         CHECK_ACCESS(this_ptr_ptr);
30584         LDKLogger this_ptr_conv = *(LDKLogger*)(this_ptr_ptr);
30585         FREE(untag_ptr(this_ptr));
30586         Logger_free(this_ptr_conv);
30587 }
30588
30589 void  __attribute__((export_name("TS_ChannelHandshakeConfig_free"))) TS_ChannelHandshakeConfig_free(uint64_t this_obj) {
30590         LDKChannelHandshakeConfig this_obj_conv;
30591         this_obj_conv.inner = untag_ptr(this_obj);
30592         this_obj_conv.is_owned = ptr_is_owned(this_obj);
30593         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
30594         ChannelHandshakeConfig_free(this_obj_conv);
30595 }
30596
30597 int32_t  __attribute__((export_name("TS_ChannelHandshakeConfig_get_minimum_depth"))) TS_ChannelHandshakeConfig_get_minimum_depth(uint64_t this_ptr) {
30598         LDKChannelHandshakeConfig this_ptr_conv;
30599         this_ptr_conv.inner = untag_ptr(this_ptr);
30600         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
30601         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
30602         this_ptr_conv.is_owned = false;
30603         int32_t ret_conv = ChannelHandshakeConfig_get_minimum_depth(&this_ptr_conv);
30604         return ret_conv;
30605 }
30606
30607 void  __attribute__((export_name("TS_ChannelHandshakeConfig_set_minimum_depth"))) TS_ChannelHandshakeConfig_set_minimum_depth(uint64_t this_ptr, int32_t val) {
30608         LDKChannelHandshakeConfig this_ptr_conv;
30609         this_ptr_conv.inner = untag_ptr(this_ptr);
30610         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
30611         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
30612         this_ptr_conv.is_owned = false;
30613         ChannelHandshakeConfig_set_minimum_depth(&this_ptr_conv, val);
30614 }
30615
30616 int16_t  __attribute__((export_name("TS_ChannelHandshakeConfig_get_our_to_self_delay"))) TS_ChannelHandshakeConfig_get_our_to_self_delay(uint64_t this_ptr) {
30617         LDKChannelHandshakeConfig this_ptr_conv;
30618         this_ptr_conv.inner = untag_ptr(this_ptr);
30619         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
30620         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
30621         this_ptr_conv.is_owned = false;
30622         int16_t ret_conv = ChannelHandshakeConfig_get_our_to_self_delay(&this_ptr_conv);
30623         return ret_conv;
30624 }
30625
30626 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) {
30627         LDKChannelHandshakeConfig this_ptr_conv;
30628         this_ptr_conv.inner = untag_ptr(this_ptr);
30629         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
30630         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
30631         this_ptr_conv.is_owned = false;
30632         ChannelHandshakeConfig_set_our_to_self_delay(&this_ptr_conv, val);
30633 }
30634
30635 int64_t  __attribute__((export_name("TS_ChannelHandshakeConfig_get_our_htlc_minimum_msat"))) TS_ChannelHandshakeConfig_get_our_htlc_minimum_msat(uint64_t this_ptr) {
30636         LDKChannelHandshakeConfig this_ptr_conv;
30637         this_ptr_conv.inner = untag_ptr(this_ptr);
30638         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
30639         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
30640         this_ptr_conv.is_owned = false;
30641         int64_t ret_conv = ChannelHandshakeConfig_get_our_htlc_minimum_msat(&this_ptr_conv);
30642         return ret_conv;
30643 }
30644
30645 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) {
30646         LDKChannelHandshakeConfig this_ptr_conv;
30647         this_ptr_conv.inner = untag_ptr(this_ptr);
30648         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
30649         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
30650         this_ptr_conv.is_owned = false;
30651         ChannelHandshakeConfig_set_our_htlc_minimum_msat(&this_ptr_conv, val);
30652 }
30653
30654 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) {
30655         LDKChannelHandshakeConfig this_ptr_conv;
30656         this_ptr_conv.inner = untag_ptr(this_ptr);
30657         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
30658         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
30659         this_ptr_conv.is_owned = false;
30660         int8_t ret_conv = ChannelHandshakeConfig_get_max_inbound_htlc_value_in_flight_percent_of_channel(&this_ptr_conv);
30661         return ret_conv;
30662 }
30663
30664 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) {
30665         LDKChannelHandshakeConfig this_ptr_conv;
30666         this_ptr_conv.inner = untag_ptr(this_ptr);
30667         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
30668         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
30669         this_ptr_conv.is_owned = false;
30670         ChannelHandshakeConfig_set_max_inbound_htlc_value_in_flight_percent_of_channel(&this_ptr_conv, val);
30671 }
30672
30673 jboolean  __attribute__((export_name("TS_ChannelHandshakeConfig_get_negotiate_scid_privacy"))) TS_ChannelHandshakeConfig_get_negotiate_scid_privacy(uint64_t this_ptr) {
30674         LDKChannelHandshakeConfig this_ptr_conv;
30675         this_ptr_conv.inner = untag_ptr(this_ptr);
30676         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
30677         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
30678         this_ptr_conv.is_owned = false;
30679         jboolean ret_conv = ChannelHandshakeConfig_get_negotiate_scid_privacy(&this_ptr_conv);
30680         return ret_conv;
30681 }
30682
30683 void  __attribute__((export_name("TS_ChannelHandshakeConfig_set_negotiate_scid_privacy"))) TS_ChannelHandshakeConfig_set_negotiate_scid_privacy(uint64_t this_ptr, jboolean val) {
30684         LDKChannelHandshakeConfig this_ptr_conv;
30685         this_ptr_conv.inner = untag_ptr(this_ptr);
30686         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
30687         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
30688         this_ptr_conv.is_owned = false;
30689         ChannelHandshakeConfig_set_negotiate_scid_privacy(&this_ptr_conv, val);
30690 }
30691
30692 jboolean  __attribute__((export_name("TS_ChannelHandshakeConfig_get_announced_channel"))) TS_ChannelHandshakeConfig_get_announced_channel(uint64_t this_ptr) {
30693         LDKChannelHandshakeConfig this_ptr_conv;
30694         this_ptr_conv.inner = untag_ptr(this_ptr);
30695         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
30696         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
30697         this_ptr_conv.is_owned = false;
30698         jboolean ret_conv = ChannelHandshakeConfig_get_announced_channel(&this_ptr_conv);
30699         return ret_conv;
30700 }
30701
30702 void  __attribute__((export_name("TS_ChannelHandshakeConfig_set_announced_channel"))) TS_ChannelHandshakeConfig_set_announced_channel(uint64_t this_ptr, jboolean val) {
30703         LDKChannelHandshakeConfig this_ptr_conv;
30704         this_ptr_conv.inner = untag_ptr(this_ptr);
30705         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
30706         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
30707         this_ptr_conv.is_owned = false;
30708         ChannelHandshakeConfig_set_announced_channel(&this_ptr_conv, val);
30709 }
30710
30711 jboolean  __attribute__((export_name("TS_ChannelHandshakeConfig_get_commit_upfront_shutdown_pubkey"))) TS_ChannelHandshakeConfig_get_commit_upfront_shutdown_pubkey(uint64_t this_ptr) {
30712         LDKChannelHandshakeConfig this_ptr_conv;
30713         this_ptr_conv.inner = untag_ptr(this_ptr);
30714         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
30715         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
30716         this_ptr_conv.is_owned = false;
30717         jboolean ret_conv = ChannelHandshakeConfig_get_commit_upfront_shutdown_pubkey(&this_ptr_conv);
30718         return ret_conv;
30719 }
30720
30721 void  __attribute__((export_name("TS_ChannelHandshakeConfig_set_commit_upfront_shutdown_pubkey"))) TS_ChannelHandshakeConfig_set_commit_upfront_shutdown_pubkey(uint64_t this_ptr, jboolean val) {
30722         LDKChannelHandshakeConfig this_ptr_conv;
30723         this_ptr_conv.inner = untag_ptr(this_ptr);
30724         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
30725         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
30726         this_ptr_conv.is_owned = false;
30727         ChannelHandshakeConfig_set_commit_upfront_shutdown_pubkey(&this_ptr_conv, val);
30728 }
30729
30730 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) {
30731         LDKChannelHandshakeConfig this_ptr_conv;
30732         this_ptr_conv.inner = untag_ptr(this_ptr);
30733         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
30734         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
30735         this_ptr_conv.is_owned = false;
30736         int32_t ret_conv = ChannelHandshakeConfig_get_their_channel_reserve_proportional_millionths(&this_ptr_conv);
30737         return ret_conv;
30738 }
30739
30740 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) {
30741         LDKChannelHandshakeConfig this_ptr_conv;
30742         this_ptr_conv.inner = untag_ptr(this_ptr);
30743         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
30744         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
30745         this_ptr_conv.is_owned = false;
30746         ChannelHandshakeConfig_set_their_channel_reserve_proportional_millionths(&this_ptr_conv, val);
30747 }
30748
30749 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) {
30750         LDKChannelHandshakeConfig this_ptr_conv;
30751         this_ptr_conv.inner = untag_ptr(this_ptr);
30752         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
30753         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
30754         this_ptr_conv.is_owned = false;
30755         jboolean ret_conv = ChannelHandshakeConfig_get_negotiate_anchors_zero_fee_htlc_tx(&this_ptr_conv);
30756         return ret_conv;
30757 }
30758
30759 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) {
30760         LDKChannelHandshakeConfig this_ptr_conv;
30761         this_ptr_conv.inner = untag_ptr(this_ptr);
30762         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
30763         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
30764         this_ptr_conv.is_owned = false;
30765         ChannelHandshakeConfig_set_negotiate_anchors_zero_fee_htlc_tx(&this_ptr_conv, val);
30766 }
30767
30768 int16_t  __attribute__((export_name("TS_ChannelHandshakeConfig_get_our_max_accepted_htlcs"))) TS_ChannelHandshakeConfig_get_our_max_accepted_htlcs(uint64_t this_ptr) {
30769         LDKChannelHandshakeConfig this_ptr_conv;
30770         this_ptr_conv.inner = untag_ptr(this_ptr);
30771         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
30772         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
30773         this_ptr_conv.is_owned = false;
30774         int16_t ret_conv = ChannelHandshakeConfig_get_our_max_accepted_htlcs(&this_ptr_conv);
30775         return ret_conv;
30776 }
30777
30778 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) {
30779         LDKChannelHandshakeConfig this_ptr_conv;
30780         this_ptr_conv.inner = untag_ptr(this_ptr);
30781         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
30782         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
30783         this_ptr_conv.is_owned = false;
30784         ChannelHandshakeConfig_set_our_max_accepted_htlcs(&this_ptr_conv, val);
30785 }
30786
30787 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) {
30788         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);
30789         uint64_t ret_ref = 0;
30790         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
30791         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
30792         return ret_ref;
30793 }
30794
30795 static inline uint64_t ChannelHandshakeConfig_clone_ptr(LDKChannelHandshakeConfig *NONNULL_PTR arg) {
30796         LDKChannelHandshakeConfig ret_var = ChannelHandshakeConfig_clone(arg);
30797         uint64_t ret_ref = 0;
30798         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
30799         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
30800         return ret_ref;
30801 }
30802 int64_t  __attribute__((export_name("TS_ChannelHandshakeConfig_clone_ptr"))) TS_ChannelHandshakeConfig_clone_ptr(uint64_t arg) {
30803         LDKChannelHandshakeConfig arg_conv;
30804         arg_conv.inner = untag_ptr(arg);
30805         arg_conv.is_owned = ptr_is_owned(arg);
30806         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
30807         arg_conv.is_owned = false;
30808         int64_t ret_conv = ChannelHandshakeConfig_clone_ptr(&arg_conv);
30809         return ret_conv;
30810 }
30811
30812 uint64_t  __attribute__((export_name("TS_ChannelHandshakeConfig_clone"))) TS_ChannelHandshakeConfig_clone(uint64_t orig) {
30813         LDKChannelHandshakeConfig orig_conv;
30814         orig_conv.inner = untag_ptr(orig);
30815         orig_conv.is_owned = ptr_is_owned(orig);
30816         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
30817         orig_conv.is_owned = false;
30818         LDKChannelHandshakeConfig ret_var = ChannelHandshakeConfig_clone(&orig_conv);
30819         uint64_t ret_ref = 0;
30820         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
30821         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
30822         return ret_ref;
30823 }
30824
30825 uint64_t  __attribute__((export_name("TS_ChannelHandshakeConfig_default"))) TS_ChannelHandshakeConfig_default() {
30826         LDKChannelHandshakeConfig ret_var = ChannelHandshakeConfig_default();
30827         uint64_t ret_ref = 0;
30828         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
30829         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
30830         return ret_ref;
30831 }
30832
30833 void  __attribute__((export_name("TS_ChannelHandshakeLimits_free"))) TS_ChannelHandshakeLimits_free(uint64_t this_obj) {
30834         LDKChannelHandshakeLimits this_obj_conv;
30835         this_obj_conv.inner = untag_ptr(this_obj);
30836         this_obj_conv.is_owned = ptr_is_owned(this_obj);
30837         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
30838         ChannelHandshakeLimits_free(this_obj_conv);
30839 }
30840
30841 int64_t  __attribute__((export_name("TS_ChannelHandshakeLimits_get_min_funding_satoshis"))) TS_ChannelHandshakeLimits_get_min_funding_satoshis(uint64_t this_ptr) {
30842         LDKChannelHandshakeLimits this_ptr_conv;
30843         this_ptr_conv.inner = untag_ptr(this_ptr);
30844         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
30845         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
30846         this_ptr_conv.is_owned = false;
30847         int64_t ret_conv = ChannelHandshakeLimits_get_min_funding_satoshis(&this_ptr_conv);
30848         return ret_conv;
30849 }
30850
30851 void  __attribute__((export_name("TS_ChannelHandshakeLimits_set_min_funding_satoshis"))) TS_ChannelHandshakeLimits_set_min_funding_satoshis(uint64_t this_ptr, int64_t val) {
30852         LDKChannelHandshakeLimits this_ptr_conv;
30853         this_ptr_conv.inner = untag_ptr(this_ptr);
30854         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
30855         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
30856         this_ptr_conv.is_owned = false;
30857         ChannelHandshakeLimits_set_min_funding_satoshis(&this_ptr_conv, val);
30858 }
30859
30860 int64_t  __attribute__((export_name("TS_ChannelHandshakeLimits_get_max_funding_satoshis"))) TS_ChannelHandshakeLimits_get_max_funding_satoshis(uint64_t this_ptr) {
30861         LDKChannelHandshakeLimits this_ptr_conv;
30862         this_ptr_conv.inner = untag_ptr(this_ptr);
30863         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
30864         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
30865         this_ptr_conv.is_owned = false;
30866         int64_t ret_conv = ChannelHandshakeLimits_get_max_funding_satoshis(&this_ptr_conv);
30867         return ret_conv;
30868 }
30869
30870 void  __attribute__((export_name("TS_ChannelHandshakeLimits_set_max_funding_satoshis"))) TS_ChannelHandshakeLimits_set_max_funding_satoshis(uint64_t this_ptr, int64_t val) {
30871         LDKChannelHandshakeLimits this_ptr_conv;
30872         this_ptr_conv.inner = untag_ptr(this_ptr);
30873         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
30874         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
30875         this_ptr_conv.is_owned = false;
30876         ChannelHandshakeLimits_set_max_funding_satoshis(&this_ptr_conv, val);
30877 }
30878
30879 int64_t  __attribute__((export_name("TS_ChannelHandshakeLimits_get_max_htlc_minimum_msat"))) TS_ChannelHandshakeLimits_get_max_htlc_minimum_msat(uint64_t this_ptr) {
30880         LDKChannelHandshakeLimits this_ptr_conv;
30881         this_ptr_conv.inner = untag_ptr(this_ptr);
30882         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
30883         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
30884         this_ptr_conv.is_owned = false;
30885         int64_t ret_conv = ChannelHandshakeLimits_get_max_htlc_minimum_msat(&this_ptr_conv);
30886         return ret_conv;
30887 }
30888
30889 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) {
30890         LDKChannelHandshakeLimits this_ptr_conv;
30891         this_ptr_conv.inner = untag_ptr(this_ptr);
30892         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
30893         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
30894         this_ptr_conv.is_owned = false;
30895         ChannelHandshakeLimits_set_max_htlc_minimum_msat(&this_ptr_conv, val);
30896 }
30897
30898 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) {
30899         LDKChannelHandshakeLimits this_ptr_conv;
30900         this_ptr_conv.inner = untag_ptr(this_ptr);
30901         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
30902         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
30903         this_ptr_conv.is_owned = false;
30904         int64_t ret_conv = ChannelHandshakeLimits_get_min_max_htlc_value_in_flight_msat(&this_ptr_conv);
30905         return ret_conv;
30906 }
30907
30908 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) {
30909         LDKChannelHandshakeLimits this_ptr_conv;
30910         this_ptr_conv.inner = untag_ptr(this_ptr);
30911         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
30912         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
30913         this_ptr_conv.is_owned = false;
30914         ChannelHandshakeLimits_set_min_max_htlc_value_in_flight_msat(&this_ptr_conv, val);
30915 }
30916
30917 int64_t  __attribute__((export_name("TS_ChannelHandshakeLimits_get_max_channel_reserve_satoshis"))) TS_ChannelHandshakeLimits_get_max_channel_reserve_satoshis(uint64_t this_ptr) {
30918         LDKChannelHandshakeLimits this_ptr_conv;
30919         this_ptr_conv.inner = untag_ptr(this_ptr);
30920         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
30921         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
30922         this_ptr_conv.is_owned = false;
30923         int64_t ret_conv = ChannelHandshakeLimits_get_max_channel_reserve_satoshis(&this_ptr_conv);
30924         return ret_conv;
30925 }
30926
30927 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) {
30928         LDKChannelHandshakeLimits this_ptr_conv;
30929         this_ptr_conv.inner = untag_ptr(this_ptr);
30930         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
30931         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
30932         this_ptr_conv.is_owned = false;
30933         ChannelHandshakeLimits_set_max_channel_reserve_satoshis(&this_ptr_conv, val);
30934 }
30935
30936 int16_t  __attribute__((export_name("TS_ChannelHandshakeLimits_get_min_max_accepted_htlcs"))) TS_ChannelHandshakeLimits_get_min_max_accepted_htlcs(uint64_t this_ptr) {
30937         LDKChannelHandshakeLimits this_ptr_conv;
30938         this_ptr_conv.inner = untag_ptr(this_ptr);
30939         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
30940         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
30941         this_ptr_conv.is_owned = false;
30942         int16_t ret_conv = ChannelHandshakeLimits_get_min_max_accepted_htlcs(&this_ptr_conv);
30943         return ret_conv;
30944 }
30945
30946 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) {
30947         LDKChannelHandshakeLimits this_ptr_conv;
30948         this_ptr_conv.inner = untag_ptr(this_ptr);
30949         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
30950         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
30951         this_ptr_conv.is_owned = false;
30952         ChannelHandshakeLimits_set_min_max_accepted_htlcs(&this_ptr_conv, val);
30953 }
30954
30955 int32_t  __attribute__((export_name("TS_ChannelHandshakeLimits_get_max_minimum_depth"))) TS_ChannelHandshakeLimits_get_max_minimum_depth(uint64_t this_ptr) {
30956         LDKChannelHandshakeLimits this_ptr_conv;
30957         this_ptr_conv.inner = untag_ptr(this_ptr);
30958         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
30959         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
30960         this_ptr_conv.is_owned = false;
30961         int32_t ret_conv = ChannelHandshakeLimits_get_max_minimum_depth(&this_ptr_conv);
30962         return ret_conv;
30963 }
30964
30965 void  __attribute__((export_name("TS_ChannelHandshakeLimits_set_max_minimum_depth"))) TS_ChannelHandshakeLimits_set_max_minimum_depth(uint64_t this_ptr, int32_t val) {
30966         LDKChannelHandshakeLimits this_ptr_conv;
30967         this_ptr_conv.inner = untag_ptr(this_ptr);
30968         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
30969         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
30970         this_ptr_conv.is_owned = false;
30971         ChannelHandshakeLimits_set_max_minimum_depth(&this_ptr_conv, val);
30972 }
30973
30974 jboolean  __attribute__((export_name("TS_ChannelHandshakeLimits_get_trust_own_funding_0conf"))) TS_ChannelHandshakeLimits_get_trust_own_funding_0conf(uint64_t this_ptr) {
30975         LDKChannelHandshakeLimits this_ptr_conv;
30976         this_ptr_conv.inner = untag_ptr(this_ptr);
30977         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
30978         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
30979         this_ptr_conv.is_owned = false;
30980         jboolean ret_conv = ChannelHandshakeLimits_get_trust_own_funding_0conf(&this_ptr_conv);
30981         return ret_conv;
30982 }
30983
30984 void  __attribute__((export_name("TS_ChannelHandshakeLimits_set_trust_own_funding_0conf"))) TS_ChannelHandshakeLimits_set_trust_own_funding_0conf(uint64_t this_ptr, jboolean val) {
30985         LDKChannelHandshakeLimits this_ptr_conv;
30986         this_ptr_conv.inner = untag_ptr(this_ptr);
30987         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
30988         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
30989         this_ptr_conv.is_owned = false;
30990         ChannelHandshakeLimits_set_trust_own_funding_0conf(&this_ptr_conv, val);
30991 }
30992
30993 jboolean  __attribute__((export_name("TS_ChannelHandshakeLimits_get_force_announced_channel_preference"))) TS_ChannelHandshakeLimits_get_force_announced_channel_preference(uint64_t this_ptr) {
30994         LDKChannelHandshakeLimits this_ptr_conv;
30995         this_ptr_conv.inner = untag_ptr(this_ptr);
30996         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
30997         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
30998         this_ptr_conv.is_owned = false;
30999         jboolean ret_conv = ChannelHandshakeLimits_get_force_announced_channel_preference(&this_ptr_conv);
31000         return ret_conv;
31001 }
31002
31003 void  __attribute__((export_name("TS_ChannelHandshakeLimits_set_force_announced_channel_preference"))) TS_ChannelHandshakeLimits_set_force_announced_channel_preference(uint64_t this_ptr, jboolean val) {
31004         LDKChannelHandshakeLimits this_ptr_conv;
31005         this_ptr_conv.inner = untag_ptr(this_ptr);
31006         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
31007         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
31008         this_ptr_conv.is_owned = false;
31009         ChannelHandshakeLimits_set_force_announced_channel_preference(&this_ptr_conv, val);
31010 }
31011
31012 int16_t  __attribute__((export_name("TS_ChannelHandshakeLimits_get_their_to_self_delay"))) TS_ChannelHandshakeLimits_get_their_to_self_delay(uint64_t this_ptr) {
31013         LDKChannelHandshakeLimits this_ptr_conv;
31014         this_ptr_conv.inner = untag_ptr(this_ptr);
31015         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
31016         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
31017         this_ptr_conv.is_owned = false;
31018         int16_t ret_conv = ChannelHandshakeLimits_get_their_to_self_delay(&this_ptr_conv);
31019         return ret_conv;
31020 }
31021
31022 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) {
31023         LDKChannelHandshakeLimits this_ptr_conv;
31024         this_ptr_conv.inner = untag_ptr(this_ptr);
31025         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
31026         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
31027         this_ptr_conv.is_owned = false;
31028         ChannelHandshakeLimits_set_their_to_self_delay(&this_ptr_conv, val);
31029 }
31030
31031 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) {
31032         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);
31033         uint64_t ret_ref = 0;
31034         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
31035         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
31036         return ret_ref;
31037 }
31038
31039 static inline uint64_t ChannelHandshakeLimits_clone_ptr(LDKChannelHandshakeLimits *NONNULL_PTR arg) {
31040         LDKChannelHandshakeLimits ret_var = ChannelHandshakeLimits_clone(arg);
31041         uint64_t ret_ref = 0;
31042         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
31043         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
31044         return ret_ref;
31045 }
31046 int64_t  __attribute__((export_name("TS_ChannelHandshakeLimits_clone_ptr"))) TS_ChannelHandshakeLimits_clone_ptr(uint64_t arg) {
31047         LDKChannelHandshakeLimits arg_conv;
31048         arg_conv.inner = untag_ptr(arg);
31049         arg_conv.is_owned = ptr_is_owned(arg);
31050         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
31051         arg_conv.is_owned = false;
31052         int64_t ret_conv = ChannelHandshakeLimits_clone_ptr(&arg_conv);
31053         return ret_conv;
31054 }
31055
31056 uint64_t  __attribute__((export_name("TS_ChannelHandshakeLimits_clone"))) TS_ChannelHandshakeLimits_clone(uint64_t orig) {
31057         LDKChannelHandshakeLimits orig_conv;
31058         orig_conv.inner = untag_ptr(orig);
31059         orig_conv.is_owned = ptr_is_owned(orig);
31060         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
31061         orig_conv.is_owned = false;
31062         LDKChannelHandshakeLimits ret_var = ChannelHandshakeLimits_clone(&orig_conv);
31063         uint64_t ret_ref = 0;
31064         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
31065         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
31066         return ret_ref;
31067 }
31068
31069 uint64_t  __attribute__((export_name("TS_ChannelHandshakeLimits_default"))) TS_ChannelHandshakeLimits_default() {
31070         LDKChannelHandshakeLimits ret_var = ChannelHandshakeLimits_default();
31071         uint64_t ret_ref = 0;
31072         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
31073         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
31074         return ret_ref;
31075 }
31076
31077 void  __attribute__((export_name("TS_MaxDustHTLCExposure_free"))) TS_MaxDustHTLCExposure_free(uint64_t this_ptr) {
31078         if (!ptr_is_owned(this_ptr)) return;
31079         void* this_ptr_ptr = untag_ptr(this_ptr);
31080         CHECK_ACCESS(this_ptr_ptr);
31081         LDKMaxDustHTLCExposure this_ptr_conv = *(LDKMaxDustHTLCExposure*)(this_ptr_ptr);
31082         FREE(untag_ptr(this_ptr));
31083         MaxDustHTLCExposure_free(this_ptr_conv);
31084 }
31085
31086 static inline uint64_t MaxDustHTLCExposure_clone_ptr(LDKMaxDustHTLCExposure *NONNULL_PTR arg) {
31087         LDKMaxDustHTLCExposure *ret_copy = MALLOC(sizeof(LDKMaxDustHTLCExposure), "LDKMaxDustHTLCExposure");
31088         *ret_copy = MaxDustHTLCExposure_clone(arg);
31089         uint64_t ret_ref = tag_ptr(ret_copy, true);
31090         return ret_ref;
31091 }
31092 int64_t  __attribute__((export_name("TS_MaxDustHTLCExposure_clone_ptr"))) TS_MaxDustHTLCExposure_clone_ptr(uint64_t arg) {
31093         LDKMaxDustHTLCExposure* arg_conv = (LDKMaxDustHTLCExposure*)untag_ptr(arg);
31094         int64_t ret_conv = MaxDustHTLCExposure_clone_ptr(arg_conv);
31095         return ret_conv;
31096 }
31097
31098 uint64_t  __attribute__((export_name("TS_MaxDustHTLCExposure_clone"))) TS_MaxDustHTLCExposure_clone(uint64_t orig) {
31099         LDKMaxDustHTLCExposure* orig_conv = (LDKMaxDustHTLCExposure*)untag_ptr(orig);
31100         LDKMaxDustHTLCExposure *ret_copy = MALLOC(sizeof(LDKMaxDustHTLCExposure), "LDKMaxDustHTLCExposure");
31101         *ret_copy = MaxDustHTLCExposure_clone(orig_conv);
31102         uint64_t ret_ref = tag_ptr(ret_copy, true);
31103         return ret_ref;
31104 }
31105
31106 uint64_t  __attribute__((export_name("TS_MaxDustHTLCExposure_fixed_limit_msat"))) TS_MaxDustHTLCExposure_fixed_limit_msat(int64_t a) {
31107         LDKMaxDustHTLCExposure *ret_copy = MALLOC(sizeof(LDKMaxDustHTLCExposure), "LDKMaxDustHTLCExposure");
31108         *ret_copy = MaxDustHTLCExposure_fixed_limit_msat(a);
31109         uint64_t ret_ref = tag_ptr(ret_copy, true);
31110         return ret_ref;
31111 }
31112
31113 uint64_t  __attribute__((export_name("TS_MaxDustHTLCExposure_fee_rate_multiplier"))) TS_MaxDustHTLCExposure_fee_rate_multiplier(int64_t a) {
31114         LDKMaxDustHTLCExposure *ret_copy = MALLOC(sizeof(LDKMaxDustHTLCExposure), "LDKMaxDustHTLCExposure");
31115         *ret_copy = MaxDustHTLCExposure_fee_rate_multiplier(a);
31116         uint64_t ret_ref = tag_ptr(ret_copy, true);
31117         return ret_ref;
31118 }
31119
31120 jboolean  __attribute__((export_name("TS_MaxDustHTLCExposure_eq"))) TS_MaxDustHTLCExposure_eq(uint64_t a, uint64_t b) {
31121         LDKMaxDustHTLCExposure* a_conv = (LDKMaxDustHTLCExposure*)untag_ptr(a);
31122         LDKMaxDustHTLCExposure* b_conv = (LDKMaxDustHTLCExposure*)untag_ptr(b);
31123         jboolean ret_conv = MaxDustHTLCExposure_eq(a_conv, b_conv);
31124         return ret_conv;
31125 }
31126
31127 int8_tArray  __attribute__((export_name("TS_MaxDustHTLCExposure_write"))) TS_MaxDustHTLCExposure_write(uint64_t obj) {
31128         LDKMaxDustHTLCExposure* obj_conv = (LDKMaxDustHTLCExposure*)untag_ptr(obj);
31129         LDKCVec_u8Z ret_var = MaxDustHTLCExposure_write(obj_conv);
31130         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
31131         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
31132         CVec_u8Z_free(ret_var);
31133         return ret_arr;
31134 }
31135
31136 uint64_t  __attribute__((export_name("TS_MaxDustHTLCExposure_read"))) TS_MaxDustHTLCExposure_read(int8_tArray ser) {
31137         LDKu8slice ser_ref;
31138         ser_ref.datalen = ser->arr_len;
31139         ser_ref.data = ser->elems;
31140         LDKCResult_MaxDustHTLCExposureDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_MaxDustHTLCExposureDecodeErrorZ), "LDKCResult_MaxDustHTLCExposureDecodeErrorZ");
31141         *ret_conv = MaxDustHTLCExposure_read(ser_ref);
31142         FREE(ser);
31143         return tag_ptr(ret_conv, true);
31144 }
31145
31146 void  __attribute__((export_name("TS_ChannelConfig_free"))) TS_ChannelConfig_free(uint64_t this_obj) {
31147         LDKChannelConfig this_obj_conv;
31148         this_obj_conv.inner = untag_ptr(this_obj);
31149         this_obj_conv.is_owned = ptr_is_owned(this_obj);
31150         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
31151         ChannelConfig_free(this_obj_conv);
31152 }
31153
31154 int32_t  __attribute__((export_name("TS_ChannelConfig_get_forwarding_fee_proportional_millionths"))) TS_ChannelConfig_get_forwarding_fee_proportional_millionths(uint64_t this_ptr) {
31155         LDKChannelConfig this_ptr_conv;
31156         this_ptr_conv.inner = untag_ptr(this_ptr);
31157         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
31158         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
31159         this_ptr_conv.is_owned = false;
31160         int32_t ret_conv = ChannelConfig_get_forwarding_fee_proportional_millionths(&this_ptr_conv);
31161         return ret_conv;
31162 }
31163
31164 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) {
31165         LDKChannelConfig this_ptr_conv;
31166         this_ptr_conv.inner = untag_ptr(this_ptr);
31167         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
31168         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
31169         this_ptr_conv.is_owned = false;
31170         ChannelConfig_set_forwarding_fee_proportional_millionths(&this_ptr_conv, val);
31171 }
31172
31173 int32_t  __attribute__((export_name("TS_ChannelConfig_get_forwarding_fee_base_msat"))) TS_ChannelConfig_get_forwarding_fee_base_msat(uint64_t this_ptr) {
31174         LDKChannelConfig this_ptr_conv;
31175         this_ptr_conv.inner = untag_ptr(this_ptr);
31176         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
31177         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
31178         this_ptr_conv.is_owned = false;
31179         int32_t ret_conv = ChannelConfig_get_forwarding_fee_base_msat(&this_ptr_conv);
31180         return ret_conv;
31181 }
31182
31183 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) {
31184         LDKChannelConfig this_ptr_conv;
31185         this_ptr_conv.inner = untag_ptr(this_ptr);
31186         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
31187         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
31188         this_ptr_conv.is_owned = false;
31189         ChannelConfig_set_forwarding_fee_base_msat(&this_ptr_conv, val);
31190 }
31191
31192 int16_t  __attribute__((export_name("TS_ChannelConfig_get_cltv_expiry_delta"))) TS_ChannelConfig_get_cltv_expiry_delta(uint64_t this_ptr) {
31193         LDKChannelConfig this_ptr_conv;
31194         this_ptr_conv.inner = untag_ptr(this_ptr);
31195         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
31196         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
31197         this_ptr_conv.is_owned = false;
31198         int16_t ret_conv = ChannelConfig_get_cltv_expiry_delta(&this_ptr_conv);
31199         return ret_conv;
31200 }
31201
31202 void  __attribute__((export_name("TS_ChannelConfig_set_cltv_expiry_delta"))) TS_ChannelConfig_set_cltv_expiry_delta(uint64_t this_ptr, int16_t val) {
31203         LDKChannelConfig this_ptr_conv;
31204         this_ptr_conv.inner = untag_ptr(this_ptr);
31205         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
31206         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
31207         this_ptr_conv.is_owned = false;
31208         ChannelConfig_set_cltv_expiry_delta(&this_ptr_conv, val);
31209 }
31210
31211 uint64_t  __attribute__((export_name("TS_ChannelConfig_get_max_dust_htlc_exposure"))) TS_ChannelConfig_get_max_dust_htlc_exposure(uint64_t this_ptr) {
31212         LDKChannelConfig this_ptr_conv;
31213         this_ptr_conv.inner = untag_ptr(this_ptr);
31214         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
31215         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
31216         this_ptr_conv.is_owned = false;
31217         LDKMaxDustHTLCExposure *ret_copy = MALLOC(sizeof(LDKMaxDustHTLCExposure), "LDKMaxDustHTLCExposure");
31218         *ret_copy = ChannelConfig_get_max_dust_htlc_exposure(&this_ptr_conv);
31219         uint64_t ret_ref = tag_ptr(ret_copy, true);
31220         return ret_ref;
31221 }
31222
31223 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) {
31224         LDKChannelConfig this_ptr_conv;
31225         this_ptr_conv.inner = untag_ptr(this_ptr);
31226         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
31227         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
31228         this_ptr_conv.is_owned = false;
31229         void* val_ptr = untag_ptr(val);
31230         CHECK_ACCESS(val_ptr);
31231         LDKMaxDustHTLCExposure val_conv = *(LDKMaxDustHTLCExposure*)(val_ptr);
31232         val_conv = MaxDustHTLCExposure_clone((LDKMaxDustHTLCExposure*)untag_ptr(val));
31233         ChannelConfig_set_max_dust_htlc_exposure(&this_ptr_conv, val_conv);
31234 }
31235
31236 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) {
31237         LDKChannelConfig this_ptr_conv;
31238         this_ptr_conv.inner = untag_ptr(this_ptr);
31239         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
31240         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
31241         this_ptr_conv.is_owned = false;
31242         int64_t ret_conv = ChannelConfig_get_force_close_avoidance_max_fee_satoshis(&this_ptr_conv);
31243         return ret_conv;
31244 }
31245
31246 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) {
31247         LDKChannelConfig this_ptr_conv;
31248         this_ptr_conv.inner = untag_ptr(this_ptr);
31249         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
31250         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
31251         this_ptr_conv.is_owned = false;
31252         ChannelConfig_set_force_close_avoidance_max_fee_satoshis(&this_ptr_conv, val);
31253 }
31254
31255 jboolean  __attribute__((export_name("TS_ChannelConfig_get_accept_underpaying_htlcs"))) TS_ChannelConfig_get_accept_underpaying_htlcs(uint64_t this_ptr) {
31256         LDKChannelConfig this_ptr_conv;
31257         this_ptr_conv.inner = untag_ptr(this_ptr);
31258         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
31259         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
31260         this_ptr_conv.is_owned = false;
31261         jboolean ret_conv = ChannelConfig_get_accept_underpaying_htlcs(&this_ptr_conv);
31262         return ret_conv;
31263 }
31264
31265 void  __attribute__((export_name("TS_ChannelConfig_set_accept_underpaying_htlcs"))) TS_ChannelConfig_set_accept_underpaying_htlcs(uint64_t this_ptr, jboolean val) {
31266         LDKChannelConfig this_ptr_conv;
31267         this_ptr_conv.inner = untag_ptr(this_ptr);
31268         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
31269         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
31270         this_ptr_conv.is_owned = false;
31271         ChannelConfig_set_accept_underpaying_htlcs(&this_ptr_conv, val);
31272 }
31273
31274 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) {
31275         void* max_dust_htlc_exposure_arg_ptr = untag_ptr(max_dust_htlc_exposure_arg);
31276         CHECK_ACCESS(max_dust_htlc_exposure_arg_ptr);
31277         LDKMaxDustHTLCExposure max_dust_htlc_exposure_arg_conv = *(LDKMaxDustHTLCExposure*)(max_dust_htlc_exposure_arg_ptr);
31278         max_dust_htlc_exposure_arg_conv = MaxDustHTLCExposure_clone((LDKMaxDustHTLCExposure*)untag_ptr(max_dust_htlc_exposure_arg));
31279         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);
31280         uint64_t ret_ref = 0;
31281         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
31282         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
31283         return ret_ref;
31284 }
31285
31286 static inline uint64_t ChannelConfig_clone_ptr(LDKChannelConfig *NONNULL_PTR arg) {
31287         LDKChannelConfig ret_var = ChannelConfig_clone(arg);
31288         uint64_t ret_ref = 0;
31289         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
31290         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
31291         return ret_ref;
31292 }
31293 int64_t  __attribute__((export_name("TS_ChannelConfig_clone_ptr"))) TS_ChannelConfig_clone_ptr(uint64_t arg) {
31294         LDKChannelConfig arg_conv;
31295         arg_conv.inner = untag_ptr(arg);
31296         arg_conv.is_owned = ptr_is_owned(arg);
31297         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
31298         arg_conv.is_owned = false;
31299         int64_t ret_conv = ChannelConfig_clone_ptr(&arg_conv);
31300         return ret_conv;
31301 }
31302
31303 uint64_t  __attribute__((export_name("TS_ChannelConfig_clone"))) TS_ChannelConfig_clone(uint64_t orig) {
31304         LDKChannelConfig orig_conv;
31305         orig_conv.inner = untag_ptr(orig);
31306         orig_conv.is_owned = ptr_is_owned(orig);
31307         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
31308         orig_conv.is_owned = false;
31309         LDKChannelConfig ret_var = ChannelConfig_clone(&orig_conv);
31310         uint64_t ret_ref = 0;
31311         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
31312         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
31313         return ret_ref;
31314 }
31315
31316 jboolean  __attribute__((export_name("TS_ChannelConfig_eq"))) TS_ChannelConfig_eq(uint64_t a, uint64_t b) {
31317         LDKChannelConfig a_conv;
31318         a_conv.inner = untag_ptr(a);
31319         a_conv.is_owned = ptr_is_owned(a);
31320         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
31321         a_conv.is_owned = false;
31322         LDKChannelConfig b_conv;
31323         b_conv.inner = untag_ptr(b);
31324         b_conv.is_owned = ptr_is_owned(b);
31325         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
31326         b_conv.is_owned = false;
31327         jboolean ret_conv = ChannelConfig_eq(&a_conv, &b_conv);
31328         return ret_conv;
31329 }
31330
31331 void  __attribute__((export_name("TS_ChannelConfig_apply"))) TS_ChannelConfig_apply(uint64_t this_arg, uint64_t update) {
31332         LDKChannelConfig this_arg_conv;
31333         this_arg_conv.inner = untag_ptr(this_arg);
31334         this_arg_conv.is_owned = ptr_is_owned(this_arg);
31335         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
31336         this_arg_conv.is_owned = false;
31337         LDKChannelConfigUpdate update_conv;
31338         update_conv.inner = untag_ptr(update);
31339         update_conv.is_owned = ptr_is_owned(update);
31340         CHECK_INNER_FIELD_ACCESS_OR_NULL(update_conv);
31341         update_conv.is_owned = false;
31342         ChannelConfig_apply(&this_arg_conv, &update_conv);
31343 }
31344
31345 uint64_t  __attribute__((export_name("TS_ChannelConfig_default"))) TS_ChannelConfig_default() {
31346         LDKChannelConfig ret_var = ChannelConfig_default();
31347         uint64_t ret_ref = 0;
31348         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
31349         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
31350         return ret_ref;
31351 }
31352
31353 int8_tArray  __attribute__((export_name("TS_ChannelConfig_write"))) TS_ChannelConfig_write(uint64_t obj) {
31354         LDKChannelConfig obj_conv;
31355         obj_conv.inner = untag_ptr(obj);
31356         obj_conv.is_owned = ptr_is_owned(obj);
31357         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
31358         obj_conv.is_owned = false;
31359         LDKCVec_u8Z ret_var = ChannelConfig_write(&obj_conv);
31360         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
31361         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
31362         CVec_u8Z_free(ret_var);
31363         return ret_arr;
31364 }
31365
31366 uint64_t  __attribute__((export_name("TS_ChannelConfig_read"))) TS_ChannelConfig_read(int8_tArray ser) {
31367         LDKu8slice ser_ref;
31368         ser_ref.datalen = ser->arr_len;
31369         ser_ref.data = ser->elems;
31370         LDKCResult_ChannelConfigDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelConfigDecodeErrorZ), "LDKCResult_ChannelConfigDecodeErrorZ");
31371         *ret_conv = ChannelConfig_read(ser_ref);
31372         FREE(ser);
31373         return tag_ptr(ret_conv, true);
31374 }
31375
31376 void  __attribute__((export_name("TS_ChannelConfigUpdate_free"))) TS_ChannelConfigUpdate_free(uint64_t this_obj) {
31377         LDKChannelConfigUpdate this_obj_conv;
31378         this_obj_conv.inner = untag_ptr(this_obj);
31379         this_obj_conv.is_owned = ptr_is_owned(this_obj);
31380         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
31381         ChannelConfigUpdate_free(this_obj_conv);
31382 }
31383
31384 uint64_t  __attribute__((export_name("TS_ChannelConfigUpdate_get_forwarding_fee_proportional_millionths"))) TS_ChannelConfigUpdate_get_forwarding_fee_proportional_millionths(uint64_t this_ptr) {
31385         LDKChannelConfigUpdate this_ptr_conv;
31386         this_ptr_conv.inner = untag_ptr(this_ptr);
31387         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
31388         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
31389         this_ptr_conv.is_owned = false;
31390         LDKCOption_u32Z *ret_copy = MALLOC(sizeof(LDKCOption_u32Z), "LDKCOption_u32Z");
31391         *ret_copy = ChannelConfigUpdate_get_forwarding_fee_proportional_millionths(&this_ptr_conv);
31392         uint64_t ret_ref = tag_ptr(ret_copy, true);
31393         return ret_ref;
31394 }
31395
31396 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) {
31397         LDKChannelConfigUpdate this_ptr_conv;
31398         this_ptr_conv.inner = untag_ptr(this_ptr);
31399         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
31400         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
31401         this_ptr_conv.is_owned = false;
31402         void* val_ptr = untag_ptr(val);
31403         CHECK_ACCESS(val_ptr);
31404         LDKCOption_u32Z val_conv = *(LDKCOption_u32Z*)(val_ptr);
31405         val_conv = COption_u32Z_clone((LDKCOption_u32Z*)untag_ptr(val));
31406         ChannelConfigUpdate_set_forwarding_fee_proportional_millionths(&this_ptr_conv, val_conv);
31407 }
31408
31409 uint64_t  __attribute__((export_name("TS_ChannelConfigUpdate_get_forwarding_fee_base_msat"))) TS_ChannelConfigUpdate_get_forwarding_fee_base_msat(uint64_t this_ptr) {
31410         LDKChannelConfigUpdate this_ptr_conv;
31411         this_ptr_conv.inner = untag_ptr(this_ptr);
31412         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
31413         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
31414         this_ptr_conv.is_owned = false;
31415         LDKCOption_u32Z *ret_copy = MALLOC(sizeof(LDKCOption_u32Z), "LDKCOption_u32Z");
31416         *ret_copy = ChannelConfigUpdate_get_forwarding_fee_base_msat(&this_ptr_conv);
31417         uint64_t ret_ref = tag_ptr(ret_copy, true);
31418         return ret_ref;
31419 }
31420
31421 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) {
31422         LDKChannelConfigUpdate this_ptr_conv;
31423         this_ptr_conv.inner = untag_ptr(this_ptr);
31424         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
31425         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
31426         this_ptr_conv.is_owned = false;
31427         void* val_ptr = untag_ptr(val);
31428         CHECK_ACCESS(val_ptr);
31429         LDKCOption_u32Z val_conv = *(LDKCOption_u32Z*)(val_ptr);
31430         val_conv = COption_u32Z_clone((LDKCOption_u32Z*)untag_ptr(val));
31431         ChannelConfigUpdate_set_forwarding_fee_base_msat(&this_ptr_conv, val_conv);
31432 }
31433
31434 uint64_t  __attribute__((export_name("TS_ChannelConfigUpdate_get_cltv_expiry_delta"))) TS_ChannelConfigUpdate_get_cltv_expiry_delta(uint64_t this_ptr) {
31435         LDKChannelConfigUpdate this_ptr_conv;
31436         this_ptr_conv.inner = untag_ptr(this_ptr);
31437         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
31438         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
31439         this_ptr_conv.is_owned = false;
31440         LDKCOption_u16Z *ret_copy = MALLOC(sizeof(LDKCOption_u16Z), "LDKCOption_u16Z");
31441         *ret_copy = ChannelConfigUpdate_get_cltv_expiry_delta(&this_ptr_conv);
31442         uint64_t ret_ref = tag_ptr(ret_copy, true);
31443         return ret_ref;
31444 }
31445
31446 void  __attribute__((export_name("TS_ChannelConfigUpdate_set_cltv_expiry_delta"))) TS_ChannelConfigUpdate_set_cltv_expiry_delta(uint64_t this_ptr, uint64_t val) {
31447         LDKChannelConfigUpdate this_ptr_conv;
31448         this_ptr_conv.inner = untag_ptr(this_ptr);
31449         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
31450         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
31451         this_ptr_conv.is_owned = false;
31452         void* val_ptr = untag_ptr(val);
31453         CHECK_ACCESS(val_ptr);
31454         LDKCOption_u16Z val_conv = *(LDKCOption_u16Z*)(val_ptr);
31455         val_conv = COption_u16Z_clone((LDKCOption_u16Z*)untag_ptr(val));
31456         ChannelConfigUpdate_set_cltv_expiry_delta(&this_ptr_conv, val_conv);
31457 }
31458
31459 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) {
31460         LDKChannelConfigUpdate this_ptr_conv;
31461         this_ptr_conv.inner = untag_ptr(this_ptr);
31462         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
31463         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
31464         this_ptr_conv.is_owned = false;
31465         LDKCOption_MaxDustHTLCExposureZ *ret_copy = MALLOC(sizeof(LDKCOption_MaxDustHTLCExposureZ), "LDKCOption_MaxDustHTLCExposureZ");
31466         *ret_copy = ChannelConfigUpdate_get_max_dust_htlc_exposure_msat(&this_ptr_conv);
31467         uint64_t ret_ref = tag_ptr(ret_copy, true);
31468         return ret_ref;
31469 }
31470
31471 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) {
31472         LDKChannelConfigUpdate this_ptr_conv;
31473         this_ptr_conv.inner = untag_ptr(this_ptr);
31474         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
31475         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
31476         this_ptr_conv.is_owned = false;
31477         void* val_ptr = untag_ptr(val);
31478         CHECK_ACCESS(val_ptr);
31479         LDKCOption_MaxDustHTLCExposureZ val_conv = *(LDKCOption_MaxDustHTLCExposureZ*)(val_ptr);
31480         val_conv = COption_MaxDustHTLCExposureZ_clone((LDKCOption_MaxDustHTLCExposureZ*)untag_ptr(val));
31481         ChannelConfigUpdate_set_max_dust_htlc_exposure_msat(&this_ptr_conv, val_conv);
31482 }
31483
31484 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) {
31485         LDKChannelConfigUpdate this_ptr_conv;
31486         this_ptr_conv.inner = untag_ptr(this_ptr);
31487         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
31488         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
31489         this_ptr_conv.is_owned = false;
31490         LDKCOption_u64Z *ret_copy = MALLOC(sizeof(LDKCOption_u64Z), "LDKCOption_u64Z");
31491         *ret_copy = ChannelConfigUpdate_get_force_close_avoidance_max_fee_satoshis(&this_ptr_conv);
31492         uint64_t ret_ref = tag_ptr(ret_copy, true);
31493         return ret_ref;
31494 }
31495
31496 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) {
31497         LDKChannelConfigUpdate this_ptr_conv;
31498         this_ptr_conv.inner = untag_ptr(this_ptr);
31499         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
31500         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
31501         this_ptr_conv.is_owned = false;
31502         void* val_ptr = untag_ptr(val);
31503         CHECK_ACCESS(val_ptr);
31504         LDKCOption_u64Z val_conv = *(LDKCOption_u64Z*)(val_ptr);
31505         val_conv = COption_u64Z_clone((LDKCOption_u64Z*)untag_ptr(val));
31506         ChannelConfigUpdate_set_force_close_avoidance_max_fee_satoshis(&this_ptr_conv, val_conv);
31507 }
31508
31509 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) {
31510         void* forwarding_fee_proportional_millionths_arg_ptr = untag_ptr(forwarding_fee_proportional_millionths_arg);
31511         CHECK_ACCESS(forwarding_fee_proportional_millionths_arg_ptr);
31512         LDKCOption_u32Z forwarding_fee_proportional_millionths_arg_conv = *(LDKCOption_u32Z*)(forwarding_fee_proportional_millionths_arg_ptr);
31513         forwarding_fee_proportional_millionths_arg_conv = COption_u32Z_clone((LDKCOption_u32Z*)untag_ptr(forwarding_fee_proportional_millionths_arg));
31514         void* forwarding_fee_base_msat_arg_ptr = untag_ptr(forwarding_fee_base_msat_arg);
31515         CHECK_ACCESS(forwarding_fee_base_msat_arg_ptr);
31516         LDKCOption_u32Z forwarding_fee_base_msat_arg_conv = *(LDKCOption_u32Z*)(forwarding_fee_base_msat_arg_ptr);
31517         forwarding_fee_base_msat_arg_conv = COption_u32Z_clone((LDKCOption_u32Z*)untag_ptr(forwarding_fee_base_msat_arg));
31518         void* cltv_expiry_delta_arg_ptr = untag_ptr(cltv_expiry_delta_arg);
31519         CHECK_ACCESS(cltv_expiry_delta_arg_ptr);
31520         LDKCOption_u16Z cltv_expiry_delta_arg_conv = *(LDKCOption_u16Z*)(cltv_expiry_delta_arg_ptr);
31521         cltv_expiry_delta_arg_conv = COption_u16Z_clone((LDKCOption_u16Z*)untag_ptr(cltv_expiry_delta_arg));
31522         void* max_dust_htlc_exposure_msat_arg_ptr = untag_ptr(max_dust_htlc_exposure_msat_arg);
31523         CHECK_ACCESS(max_dust_htlc_exposure_msat_arg_ptr);
31524         LDKCOption_MaxDustHTLCExposureZ max_dust_htlc_exposure_msat_arg_conv = *(LDKCOption_MaxDustHTLCExposureZ*)(max_dust_htlc_exposure_msat_arg_ptr);
31525         max_dust_htlc_exposure_msat_arg_conv = COption_MaxDustHTLCExposureZ_clone((LDKCOption_MaxDustHTLCExposureZ*)untag_ptr(max_dust_htlc_exposure_msat_arg));
31526         void* force_close_avoidance_max_fee_satoshis_arg_ptr = untag_ptr(force_close_avoidance_max_fee_satoshis_arg);
31527         CHECK_ACCESS(force_close_avoidance_max_fee_satoshis_arg_ptr);
31528         LDKCOption_u64Z force_close_avoidance_max_fee_satoshis_arg_conv = *(LDKCOption_u64Z*)(force_close_avoidance_max_fee_satoshis_arg_ptr);
31529         force_close_avoidance_max_fee_satoshis_arg_conv = COption_u64Z_clone((LDKCOption_u64Z*)untag_ptr(force_close_avoidance_max_fee_satoshis_arg));
31530         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);
31531         uint64_t ret_ref = 0;
31532         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
31533         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
31534         return ret_ref;
31535 }
31536
31537 uint64_t  __attribute__((export_name("TS_ChannelConfigUpdate_default"))) TS_ChannelConfigUpdate_default() {
31538         LDKChannelConfigUpdate ret_var = ChannelConfigUpdate_default();
31539         uint64_t ret_ref = 0;
31540         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
31541         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
31542         return ret_ref;
31543 }
31544
31545 void  __attribute__((export_name("TS_UserConfig_free"))) TS_UserConfig_free(uint64_t this_obj) {
31546         LDKUserConfig this_obj_conv;
31547         this_obj_conv.inner = untag_ptr(this_obj);
31548         this_obj_conv.is_owned = ptr_is_owned(this_obj);
31549         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
31550         UserConfig_free(this_obj_conv);
31551 }
31552
31553 uint64_t  __attribute__((export_name("TS_UserConfig_get_channel_handshake_config"))) TS_UserConfig_get_channel_handshake_config(uint64_t this_ptr) {
31554         LDKUserConfig this_ptr_conv;
31555         this_ptr_conv.inner = untag_ptr(this_ptr);
31556         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
31557         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
31558         this_ptr_conv.is_owned = false;
31559         LDKChannelHandshakeConfig ret_var = UserConfig_get_channel_handshake_config(&this_ptr_conv);
31560         uint64_t ret_ref = 0;
31561         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
31562         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
31563         return ret_ref;
31564 }
31565
31566 void  __attribute__((export_name("TS_UserConfig_set_channel_handshake_config"))) TS_UserConfig_set_channel_handshake_config(uint64_t this_ptr, uint64_t val) {
31567         LDKUserConfig this_ptr_conv;
31568         this_ptr_conv.inner = untag_ptr(this_ptr);
31569         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
31570         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
31571         this_ptr_conv.is_owned = false;
31572         LDKChannelHandshakeConfig val_conv;
31573         val_conv.inner = untag_ptr(val);
31574         val_conv.is_owned = ptr_is_owned(val);
31575         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
31576         val_conv = ChannelHandshakeConfig_clone(&val_conv);
31577         UserConfig_set_channel_handshake_config(&this_ptr_conv, val_conv);
31578 }
31579
31580 uint64_t  __attribute__((export_name("TS_UserConfig_get_channel_handshake_limits"))) TS_UserConfig_get_channel_handshake_limits(uint64_t this_ptr) {
31581         LDKUserConfig this_ptr_conv;
31582         this_ptr_conv.inner = untag_ptr(this_ptr);
31583         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
31584         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
31585         this_ptr_conv.is_owned = false;
31586         LDKChannelHandshakeLimits ret_var = UserConfig_get_channel_handshake_limits(&this_ptr_conv);
31587         uint64_t ret_ref = 0;
31588         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
31589         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
31590         return ret_ref;
31591 }
31592
31593 void  __attribute__((export_name("TS_UserConfig_set_channel_handshake_limits"))) TS_UserConfig_set_channel_handshake_limits(uint64_t this_ptr, uint64_t val) {
31594         LDKUserConfig this_ptr_conv;
31595         this_ptr_conv.inner = untag_ptr(this_ptr);
31596         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
31597         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
31598         this_ptr_conv.is_owned = false;
31599         LDKChannelHandshakeLimits val_conv;
31600         val_conv.inner = untag_ptr(val);
31601         val_conv.is_owned = ptr_is_owned(val);
31602         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
31603         val_conv = ChannelHandshakeLimits_clone(&val_conv);
31604         UserConfig_set_channel_handshake_limits(&this_ptr_conv, val_conv);
31605 }
31606
31607 uint64_t  __attribute__((export_name("TS_UserConfig_get_channel_config"))) TS_UserConfig_get_channel_config(uint64_t this_ptr) {
31608         LDKUserConfig this_ptr_conv;
31609         this_ptr_conv.inner = untag_ptr(this_ptr);
31610         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
31611         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
31612         this_ptr_conv.is_owned = false;
31613         LDKChannelConfig ret_var = UserConfig_get_channel_config(&this_ptr_conv);
31614         uint64_t ret_ref = 0;
31615         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
31616         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
31617         return ret_ref;
31618 }
31619
31620 void  __attribute__((export_name("TS_UserConfig_set_channel_config"))) TS_UserConfig_set_channel_config(uint64_t this_ptr, uint64_t val) {
31621         LDKUserConfig this_ptr_conv;
31622         this_ptr_conv.inner = untag_ptr(this_ptr);
31623         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
31624         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
31625         this_ptr_conv.is_owned = false;
31626         LDKChannelConfig val_conv;
31627         val_conv.inner = untag_ptr(val);
31628         val_conv.is_owned = ptr_is_owned(val);
31629         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
31630         val_conv = ChannelConfig_clone(&val_conv);
31631         UserConfig_set_channel_config(&this_ptr_conv, val_conv);
31632 }
31633
31634 jboolean  __attribute__((export_name("TS_UserConfig_get_accept_forwards_to_priv_channels"))) TS_UserConfig_get_accept_forwards_to_priv_channels(uint64_t this_ptr) {
31635         LDKUserConfig this_ptr_conv;
31636         this_ptr_conv.inner = untag_ptr(this_ptr);
31637         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
31638         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
31639         this_ptr_conv.is_owned = false;
31640         jboolean ret_conv = UserConfig_get_accept_forwards_to_priv_channels(&this_ptr_conv);
31641         return ret_conv;
31642 }
31643
31644 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) {
31645         LDKUserConfig this_ptr_conv;
31646         this_ptr_conv.inner = untag_ptr(this_ptr);
31647         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
31648         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
31649         this_ptr_conv.is_owned = false;
31650         UserConfig_set_accept_forwards_to_priv_channels(&this_ptr_conv, val);
31651 }
31652
31653 jboolean  __attribute__((export_name("TS_UserConfig_get_accept_inbound_channels"))) TS_UserConfig_get_accept_inbound_channels(uint64_t this_ptr) {
31654         LDKUserConfig this_ptr_conv;
31655         this_ptr_conv.inner = untag_ptr(this_ptr);
31656         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
31657         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
31658         this_ptr_conv.is_owned = false;
31659         jboolean ret_conv = UserConfig_get_accept_inbound_channels(&this_ptr_conv);
31660         return ret_conv;
31661 }
31662
31663 void  __attribute__((export_name("TS_UserConfig_set_accept_inbound_channels"))) TS_UserConfig_set_accept_inbound_channels(uint64_t this_ptr, jboolean val) {
31664         LDKUserConfig this_ptr_conv;
31665         this_ptr_conv.inner = untag_ptr(this_ptr);
31666         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
31667         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
31668         this_ptr_conv.is_owned = false;
31669         UserConfig_set_accept_inbound_channels(&this_ptr_conv, val);
31670 }
31671
31672 jboolean  __attribute__((export_name("TS_UserConfig_get_manually_accept_inbound_channels"))) TS_UserConfig_get_manually_accept_inbound_channels(uint64_t this_ptr) {
31673         LDKUserConfig this_ptr_conv;
31674         this_ptr_conv.inner = untag_ptr(this_ptr);
31675         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
31676         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
31677         this_ptr_conv.is_owned = false;
31678         jboolean ret_conv = UserConfig_get_manually_accept_inbound_channels(&this_ptr_conv);
31679         return ret_conv;
31680 }
31681
31682 void  __attribute__((export_name("TS_UserConfig_set_manually_accept_inbound_channels"))) TS_UserConfig_set_manually_accept_inbound_channels(uint64_t this_ptr, jboolean val) {
31683         LDKUserConfig this_ptr_conv;
31684         this_ptr_conv.inner = untag_ptr(this_ptr);
31685         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
31686         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
31687         this_ptr_conv.is_owned = false;
31688         UserConfig_set_manually_accept_inbound_channels(&this_ptr_conv, val);
31689 }
31690
31691 jboolean  __attribute__((export_name("TS_UserConfig_get_accept_intercept_htlcs"))) TS_UserConfig_get_accept_intercept_htlcs(uint64_t this_ptr) {
31692         LDKUserConfig this_ptr_conv;
31693         this_ptr_conv.inner = untag_ptr(this_ptr);
31694         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
31695         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
31696         this_ptr_conv.is_owned = false;
31697         jboolean ret_conv = UserConfig_get_accept_intercept_htlcs(&this_ptr_conv);
31698         return ret_conv;
31699 }
31700
31701 void  __attribute__((export_name("TS_UserConfig_set_accept_intercept_htlcs"))) TS_UserConfig_set_accept_intercept_htlcs(uint64_t this_ptr, jboolean val) {
31702         LDKUserConfig this_ptr_conv;
31703         this_ptr_conv.inner = untag_ptr(this_ptr);
31704         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
31705         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
31706         this_ptr_conv.is_owned = false;
31707         UserConfig_set_accept_intercept_htlcs(&this_ptr_conv, val);
31708 }
31709
31710 jboolean  __attribute__((export_name("TS_UserConfig_get_accept_mpp_keysend"))) TS_UserConfig_get_accept_mpp_keysend(uint64_t this_ptr) {
31711         LDKUserConfig this_ptr_conv;
31712         this_ptr_conv.inner = untag_ptr(this_ptr);
31713         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
31714         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
31715         this_ptr_conv.is_owned = false;
31716         jboolean ret_conv = UserConfig_get_accept_mpp_keysend(&this_ptr_conv);
31717         return ret_conv;
31718 }
31719
31720 void  __attribute__((export_name("TS_UserConfig_set_accept_mpp_keysend"))) TS_UserConfig_set_accept_mpp_keysend(uint64_t this_ptr, jboolean val) {
31721         LDKUserConfig this_ptr_conv;
31722         this_ptr_conv.inner = untag_ptr(this_ptr);
31723         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
31724         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
31725         this_ptr_conv.is_owned = false;
31726         UserConfig_set_accept_mpp_keysend(&this_ptr_conv, val);
31727 }
31728
31729 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) {
31730         LDKChannelHandshakeConfig channel_handshake_config_arg_conv;
31731         channel_handshake_config_arg_conv.inner = untag_ptr(channel_handshake_config_arg);
31732         channel_handshake_config_arg_conv.is_owned = ptr_is_owned(channel_handshake_config_arg);
31733         CHECK_INNER_FIELD_ACCESS_OR_NULL(channel_handshake_config_arg_conv);
31734         channel_handshake_config_arg_conv = ChannelHandshakeConfig_clone(&channel_handshake_config_arg_conv);
31735         LDKChannelHandshakeLimits channel_handshake_limits_arg_conv;
31736         channel_handshake_limits_arg_conv.inner = untag_ptr(channel_handshake_limits_arg);
31737         channel_handshake_limits_arg_conv.is_owned = ptr_is_owned(channel_handshake_limits_arg);
31738         CHECK_INNER_FIELD_ACCESS_OR_NULL(channel_handshake_limits_arg_conv);
31739         channel_handshake_limits_arg_conv = ChannelHandshakeLimits_clone(&channel_handshake_limits_arg_conv);
31740         LDKChannelConfig channel_config_arg_conv;
31741         channel_config_arg_conv.inner = untag_ptr(channel_config_arg);
31742         channel_config_arg_conv.is_owned = ptr_is_owned(channel_config_arg);
31743         CHECK_INNER_FIELD_ACCESS_OR_NULL(channel_config_arg_conv);
31744         channel_config_arg_conv = ChannelConfig_clone(&channel_config_arg_conv);
31745         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);
31746         uint64_t ret_ref = 0;
31747         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
31748         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
31749         return ret_ref;
31750 }
31751
31752 static inline uint64_t UserConfig_clone_ptr(LDKUserConfig *NONNULL_PTR arg) {
31753         LDKUserConfig ret_var = UserConfig_clone(arg);
31754         uint64_t ret_ref = 0;
31755         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
31756         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
31757         return ret_ref;
31758 }
31759 int64_t  __attribute__((export_name("TS_UserConfig_clone_ptr"))) TS_UserConfig_clone_ptr(uint64_t arg) {
31760         LDKUserConfig arg_conv;
31761         arg_conv.inner = untag_ptr(arg);
31762         arg_conv.is_owned = ptr_is_owned(arg);
31763         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
31764         arg_conv.is_owned = false;
31765         int64_t ret_conv = UserConfig_clone_ptr(&arg_conv);
31766         return ret_conv;
31767 }
31768
31769 uint64_t  __attribute__((export_name("TS_UserConfig_clone"))) TS_UserConfig_clone(uint64_t orig) {
31770         LDKUserConfig orig_conv;
31771         orig_conv.inner = untag_ptr(orig);
31772         orig_conv.is_owned = ptr_is_owned(orig);
31773         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
31774         orig_conv.is_owned = false;
31775         LDKUserConfig ret_var = UserConfig_clone(&orig_conv);
31776         uint64_t ret_ref = 0;
31777         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
31778         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
31779         return ret_ref;
31780 }
31781
31782 uint64_t  __attribute__((export_name("TS_UserConfig_default"))) TS_UserConfig_default() {
31783         LDKUserConfig ret_var = UserConfig_default();
31784         uint64_t ret_ref = 0;
31785         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
31786         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
31787         return ret_ref;
31788 }
31789
31790 void  __attribute__((export_name("TS_BestBlock_free"))) TS_BestBlock_free(uint64_t this_obj) {
31791         LDKBestBlock this_obj_conv;
31792         this_obj_conv.inner = untag_ptr(this_obj);
31793         this_obj_conv.is_owned = ptr_is_owned(this_obj);
31794         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
31795         BestBlock_free(this_obj_conv);
31796 }
31797
31798 static inline uint64_t BestBlock_clone_ptr(LDKBestBlock *NONNULL_PTR arg) {
31799         LDKBestBlock ret_var = BestBlock_clone(arg);
31800         uint64_t ret_ref = 0;
31801         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
31802         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
31803         return ret_ref;
31804 }
31805 int64_t  __attribute__((export_name("TS_BestBlock_clone_ptr"))) TS_BestBlock_clone_ptr(uint64_t arg) {
31806         LDKBestBlock arg_conv;
31807         arg_conv.inner = untag_ptr(arg);
31808         arg_conv.is_owned = ptr_is_owned(arg);
31809         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
31810         arg_conv.is_owned = false;
31811         int64_t ret_conv = BestBlock_clone_ptr(&arg_conv);
31812         return ret_conv;
31813 }
31814
31815 uint64_t  __attribute__((export_name("TS_BestBlock_clone"))) TS_BestBlock_clone(uint64_t orig) {
31816         LDKBestBlock orig_conv;
31817         orig_conv.inner = untag_ptr(orig);
31818         orig_conv.is_owned = ptr_is_owned(orig);
31819         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
31820         orig_conv.is_owned = false;
31821         LDKBestBlock ret_var = BestBlock_clone(&orig_conv);
31822         uint64_t ret_ref = 0;
31823         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
31824         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
31825         return ret_ref;
31826 }
31827
31828 jboolean  __attribute__((export_name("TS_BestBlock_eq"))) TS_BestBlock_eq(uint64_t a, uint64_t b) {
31829         LDKBestBlock a_conv;
31830         a_conv.inner = untag_ptr(a);
31831         a_conv.is_owned = ptr_is_owned(a);
31832         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
31833         a_conv.is_owned = false;
31834         LDKBestBlock b_conv;
31835         b_conv.inner = untag_ptr(b);
31836         b_conv.is_owned = ptr_is_owned(b);
31837         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
31838         b_conv.is_owned = false;
31839         jboolean ret_conv = BestBlock_eq(&a_conv, &b_conv);
31840         return ret_conv;
31841 }
31842
31843 uint64_t  __attribute__((export_name("TS_BestBlock_from_network"))) TS_BestBlock_from_network(uint32_t network) {
31844         LDKNetwork network_conv = LDKNetwork_from_js(network);
31845         LDKBestBlock ret_var = BestBlock_from_network(network_conv);
31846         uint64_t ret_ref = 0;
31847         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
31848         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
31849         return ret_ref;
31850 }
31851
31852 uint64_t  __attribute__((export_name("TS_BestBlock_new"))) TS_BestBlock_new(int8_tArray block_hash, int32_t height) {
31853         LDKThirtyTwoBytes block_hash_ref;
31854         CHECK(block_hash->arr_len == 32);
31855         memcpy(block_hash_ref.data, block_hash->elems, 32); FREE(block_hash);
31856         LDKBestBlock ret_var = BestBlock_new(block_hash_ref, height);
31857         uint64_t ret_ref = 0;
31858         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
31859         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
31860         return ret_ref;
31861 }
31862
31863 int8_tArray  __attribute__((export_name("TS_BestBlock_block_hash"))) TS_BestBlock_block_hash(uint64_t this_arg) {
31864         LDKBestBlock this_arg_conv;
31865         this_arg_conv.inner = untag_ptr(this_arg);
31866         this_arg_conv.is_owned = ptr_is_owned(this_arg);
31867         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
31868         this_arg_conv.is_owned = false;
31869         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
31870         memcpy(ret_arr->elems, BestBlock_block_hash(&this_arg_conv).data, 32);
31871         return ret_arr;
31872 }
31873
31874 int32_t  __attribute__((export_name("TS_BestBlock_height"))) TS_BestBlock_height(uint64_t this_arg) {
31875         LDKBestBlock this_arg_conv;
31876         this_arg_conv.inner = untag_ptr(this_arg);
31877         this_arg_conv.is_owned = ptr_is_owned(this_arg);
31878         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
31879         this_arg_conv.is_owned = false;
31880         int32_t ret_conv = BestBlock_height(&this_arg_conv);
31881         return ret_conv;
31882 }
31883
31884 void  __attribute__((export_name("TS_Listen_free"))) TS_Listen_free(uint64_t this_ptr) {
31885         if (!ptr_is_owned(this_ptr)) return;
31886         void* this_ptr_ptr = untag_ptr(this_ptr);
31887         CHECK_ACCESS(this_ptr_ptr);
31888         LDKListen this_ptr_conv = *(LDKListen*)(this_ptr_ptr);
31889         FREE(untag_ptr(this_ptr));
31890         Listen_free(this_ptr_conv);
31891 }
31892
31893 void  __attribute__((export_name("TS_Confirm_free"))) TS_Confirm_free(uint64_t this_ptr) {
31894         if (!ptr_is_owned(this_ptr)) return;
31895         void* this_ptr_ptr = untag_ptr(this_ptr);
31896         CHECK_ACCESS(this_ptr_ptr);
31897         LDKConfirm this_ptr_conv = *(LDKConfirm*)(this_ptr_ptr);
31898         FREE(untag_ptr(this_ptr));
31899         Confirm_free(this_ptr_conv);
31900 }
31901
31902 uint32_t  __attribute__((export_name("TS_ChannelMonitorUpdateStatus_clone"))) TS_ChannelMonitorUpdateStatus_clone(uint64_t orig) {
31903         LDKChannelMonitorUpdateStatus* orig_conv = (LDKChannelMonitorUpdateStatus*)untag_ptr(orig);
31904         uint32_t ret_conv = LDKChannelMonitorUpdateStatus_to_js(ChannelMonitorUpdateStatus_clone(orig_conv));
31905         return ret_conv;
31906 }
31907
31908 uint32_t  __attribute__((export_name("TS_ChannelMonitorUpdateStatus_completed"))) TS_ChannelMonitorUpdateStatus_completed() {
31909         uint32_t ret_conv = LDKChannelMonitorUpdateStatus_to_js(ChannelMonitorUpdateStatus_completed());
31910         return ret_conv;
31911 }
31912
31913 uint32_t  __attribute__((export_name("TS_ChannelMonitorUpdateStatus_in_progress"))) TS_ChannelMonitorUpdateStatus_in_progress() {
31914         uint32_t ret_conv = LDKChannelMonitorUpdateStatus_to_js(ChannelMonitorUpdateStatus_in_progress());
31915         return ret_conv;
31916 }
31917
31918 uint32_t  __attribute__((export_name("TS_ChannelMonitorUpdateStatus_unrecoverable_error"))) TS_ChannelMonitorUpdateStatus_unrecoverable_error() {
31919         uint32_t ret_conv = LDKChannelMonitorUpdateStatus_to_js(ChannelMonitorUpdateStatus_unrecoverable_error());
31920         return ret_conv;
31921 }
31922
31923 jboolean  __attribute__((export_name("TS_ChannelMonitorUpdateStatus_eq"))) TS_ChannelMonitorUpdateStatus_eq(uint64_t a, uint64_t b) {
31924         LDKChannelMonitorUpdateStatus* a_conv = (LDKChannelMonitorUpdateStatus*)untag_ptr(a);
31925         LDKChannelMonitorUpdateStatus* b_conv = (LDKChannelMonitorUpdateStatus*)untag_ptr(b);
31926         jboolean ret_conv = ChannelMonitorUpdateStatus_eq(a_conv, b_conv);
31927         return ret_conv;
31928 }
31929
31930 void  __attribute__((export_name("TS_Watch_free"))) TS_Watch_free(uint64_t this_ptr) {
31931         if (!ptr_is_owned(this_ptr)) return;
31932         void* this_ptr_ptr = untag_ptr(this_ptr);
31933         CHECK_ACCESS(this_ptr_ptr);
31934         LDKWatch this_ptr_conv = *(LDKWatch*)(this_ptr_ptr);
31935         FREE(untag_ptr(this_ptr));
31936         Watch_free(this_ptr_conv);
31937 }
31938
31939 void  __attribute__((export_name("TS_Filter_free"))) TS_Filter_free(uint64_t this_ptr) {
31940         if (!ptr_is_owned(this_ptr)) return;
31941         void* this_ptr_ptr = untag_ptr(this_ptr);
31942         CHECK_ACCESS(this_ptr_ptr);
31943         LDKFilter this_ptr_conv = *(LDKFilter*)(this_ptr_ptr);
31944         FREE(untag_ptr(this_ptr));
31945         Filter_free(this_ptr_conv);
31946 }
31947
31948 void  __attribute__((export_name("TS_WatchedOutput_free"))) TS_WatchedOutput_free(uint64_t this_obj) {
31949         LDKWatchedOutput this_obj_conv;
31950         this_obj_conv.inner = untag_ptr(this_obj);
31951         this_obj_conv.is_owned = ptr_is_owned(this_obj);
31952         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
31953         WatchedOutput_free(this_obj_conv);
31954 }
31955
31956 uint64_t  __attribute__((export_name("TS_WatchedOutput_get_block_hash"))) TS_WatchedOutput_get_block_hash(uint64_t this_ptr) {
31957         LDKWatchedOutput this_ptr_conv;
31958         this_ptr_conv.inner = untag_ptr(this_ptr);
31959         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
31960         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
31961         this_ptr_conv.is_owned = false;
31962         LDKCOption_ThirtyTwoBytesZ *ret_copy = MALLOC(sizeof(LDKCOption_ThirtyTwoBytesZ), "LDKCOption_ThirtyTwoBytesZ");
31963         *ret_copy = WatchedOutput_get_block_hash(&this_ptr_conv);
31964         uint64_t ret_ref = tag_ptr(ret_copy, true);
31965         return ret_ref;
31966 }
31967
31968 void  __attribute__((export_name("TS_WatchedOutput_set_block_hash"))) TS_WatchedOutput_set_block_hash(uint64_t this_ptr, uint64_t val) {
31969         LDKWatchedOutput this_ptr_conv;
31970         this_ptr_conv.inner = untag_ptr(this_ptr);
31971         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
31972         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
31973         this_ptr_conv.is_owned = false;
31974         void* val_ptr = untag_ptr(val);
31975         CHECK_ACCESS(val_ptr);
31976         LDKCOption_ThirtyTwoBytesZ val_conv = *(LDKCOption_ThirtyTwoBytesZ*)(val_ptr);
31977         val_conv = COption_ThirtyTwoBytesZ_clone((LDKCOption_ThirtyTwoBytesZ*)untag_ptr(val));
31978         WatchedOutput_set_block_hash(&this_ptr_conv, val_conv);
31979 }
31980
31981 uint64_t  __attribute__((export_name("TS_WatchedOutput_get_outpoint"))) TS_WatchedOutput_get_outpoint(uint64_t this_ptr) {
31982         LDKWatchedOutput this_ptr_conv;
31983         this_ptr_conv.inner = untag_ptr(this_ptr);
31984         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
31985         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
31986         this_ptr_conv.is_owned = false;
31987         LDKOutPoint ret_var = WatchedOutput_get_outpoint(&this_ptr_conv);
31988         uint64_t ret_ref = 0;
31989         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
31990         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
31991         return ret_ref;
31992 }
31993
31994 void  __attribute__((export_name("TS_WatchedOutput_set_outpoint"))) TS_WatchedOutput_set_outpoint(uint64_t this_ptr, uint64_t val) {
31995         LDKWatchedOutput this_ptr_conv;
31996         this_ptr_conv.inner = untag_ptr(this_ptr);
31997         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
31998         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
31999         this_ptr_conv.is_owned = false;
32000         LDKOutPoint val_conv;
32001         val_conv.inner = untag_ptr(val);
32002         val_conv.is_owned = ptr_is_owned(val);
32003         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
32004         val_conv = OutPoint_clone(&val_conv);
32005         WatchedOutput_set_outpoint(&this_ptr_conv, val_conv);
32006 }
32007
32008 int8_tArray  __attribute__((export_name("TS_WatchedOutput_get_script_pubkey"))) TS_WatchedOutput_get_script_pubkey(uint64_t this_ptr) {
32009         LDKWatchedOutput this_ptr_conv;
32010         this_ptr_conv.inner = untag_ptr(this_ptr);
32011         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
32012         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
32013         this_ptr_conv.is_owned = false;
32014         LDKu8slice ret_var = WatchedOutput_get_script_pubkey(&this_ptr_conv);
32015         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
32016         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
32017         return ret_arr;
32018 }
32019
32020 void  __attribute__((export_name("TS_WatchedOutput_set_script_pubkey"))) TS_WatchedOutput_set_script_pubkey(uint64_t this_ptr, int8_tArray val) {
32021         LDKWatchedOutput this_ptr_conv;
32022         this_ptr_conv.inner = untag_ptr(this_ptr);
32023         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
32024         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
32025         this_ptr_conv.is_owned = false;
32026         LDKCVec_u8Z val_ref;
32027         val_ref.datalen = val->arr_len;
32028         val_ref.data = MALLOC(val_ref.datalen, "LDKCVec_u8Z Bytes");
32029         memcpy(val_ref.data, val->elems, val_ref.datalen); FREE(val);
32030         WatchedOutput_set_script_pubkey(&this_ptr_conv, val_ref);
32031 }
32032
32033 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) {
32034         void* block_hash_arg_ptr = untag_ptr(block_hash_arg);
32035         CHECK_ACCESS(block_hash_arg_ptr);
32036         LDKCOption_ThirtyTwoBytesZ block_hash_arg_conv = *(LDKCOption_ThirtyTwoBytesZ*)(block_hash_arg_ptr);
32037         block_hash_arg_conv = COption_ThirtyTwoBytesZ_clone((LDKCOption_ThirtyTwoBytesZ*)untag_ptr(block_hash_arg));
32038         LDKOutPoint outpoint_arg_conv;
32039         outpoint_arg_conv.inner = untag_ptr(outpoint_arg);
32040         outpoint_arg_conv.is_owned = ptr_is_owned(outpoint_arg);
32041         CHECK_INNER_FIELD_ACCESS_OR_NULL(outpoint_arg_conv);
32042         outpoint_arg_conv = OutPoint_clone(&outpoint_arg_conv);
32043         LDKCVec_u8Z script_pubkey_arg_ref;
32044         script_pubkey_arg_ref.datalen = script_pubkey_arg->arr_len;
32045         script_pubkey_arg_ref.data = MALLOC(script_pubkey_arg_ref.datalen, "LDKCVec_u8Z Bytes");
32046         memcpy(script_pubkey_arg_ref.data, script_pubkey_arg->elems, script_pubkey_arg_ref.datalen); FREE(script_pubkey_arg);
32047         LDKWatchedOutput ret_var = WatchedOutput_new(block_hash_arg_conv, outpoint_arg_conv, script_pubkey_arg_ref);
32048         uint64_t ret_ref = 0;
32049         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
32050         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
32051         return ret_ref;
32052 }
32053
32054 static inline uint64_t WatchedOutput_clone_ptr(LDKWatchedOutput *NONNULL_PTR arg) {
32055         LDKWatchedOutput ret_var = WatchedOutput_clone(arg);
32056         uint64_t ret_ref = 0;
32057         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
32058         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
32059         return ret_ref;
32060 }
32061 int64_t  __attribute__((export_name("TS_WatchedOutput_clone_ptr"))) TS_WatchedOutput_clone_ptr(uint64_t arg) {
32062         LDKWatchedOutput arg_conv;
32063         arg_conv.inner = untag_ptr(arg);
32064         arg_conv.is_owned = ptr_is_owned(arg);
32065         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
32066         arg_conv.is_owned = false;
32067         int64_t ret_conv = WatchedOutput_clone_ptr(&arg_conv);
32068         return ret_conv;
32069 }
32070
32071 uint64_t  __attribute__((export_name("TS_WatchedOutput_clone"))) TS_WatchedOutput_clone(uint64_t orig) {
32072         LDKWatchedOutput orig_conv;
32073         orig_conv.inner = untag_ptr(orig);
32074         orig_conv.is_owned = ptr_is_owned(orig);
32075         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
32076         orig_conv.is_owned = false;
32077         LDKWatchedOutput ret_var = WatchedOutput_clone(&orig_conv);
32078         uint64_t ret_ref = 0;
32079         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
32080         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
32081         return ret_ref;
32082 }
32083
32084 jboolean  __attribute__((export_name("TS_WatchedOutput_eq"))) TS_WatchedOutput_eq(uint64_t a, uint64_t b) {
32085         LDKWatchedOutput a_conv;
32086         a_conv.inner = untag_ptr(a);
32087         a_conv.is_owned = ptr_is_owned(a);
32088         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
32089         a_conv.is_owned = false;
32090         LDKWatchedOutput b_conv;
32091         b_conv.inner = untag_ptr(b);
32092         b_conv.is_owned = ptr_is_owned(b);
32093         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
32094         b_conv.is_owned = false;
32095         jboolean ret_conv = WatchedOutput_eq(&a_conv, &b_conv);
32096         return ret_conv;
32097 }
32098
32099 int64_t  __attribute__((export_name("TS_WatchedOutput_hash"))) TS_WatchedOutput_hash(uint64_t o) {
32100         LDKWatchedOutput o_conv;
32101         o_conv.inner = untag_ptr(o);
32102         o_conv.is_owned = ptr_is_owned(o);
32103         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
32104         o_conv.is_owned = false;
32105         int64_t ret_conv = WatchedOutput_hash(&o_conv);
32106         return ret_conv;
32107 }
32108
32109 void  __attribute__((export_name("TS_BroadcasterInterface_free"))) TS_BroadcasterInterface_free(uint64_t this_ptr) {
32110         if (!ptr_is_owned(this_ptr)) return;
32111         void* this_ptr_ptr = untag_ptr(this_ptr);
32112         CHECK_ACCESS(this_ptr_ptr);
32113         LDKBroadcasterInterface this_ptr_conv = *(LDKBroadcasterInterface*)(this_ptr_ptr);
32114         FREE(untag_ptr(this_ptr));
32115         BroadcasterInterface_free(this_ptr_conv);
32116 }
32117
32118 uint32_t  __attribute__((export_name("TS_ConfirmationTarget_clone"))) TS_ConfirmationTarget_clone(uint64_t orig) {
32119         LDKConfirmationTarget* orig_conv = (LDKConfirmationTarget*)untag_ptr(orig);
32120         uint32_t ret_conv = LDKConfirmationTarget_to_js(ConfirmationTarget_clone(orig_conv));
32121         return ret_conv;
32122 }
32123
32124 uint32_t  __attribute__((export_name("TS_ConfirmationTarget_on_chain_sweep"))) TS_ConfirmationTarget_on_chain_sweep() {
32125         uint32_t ret_conv = LDKConfirmationTarget_to_js(ConfirmationTarget_on_chain_sweep());
32126         return ret_conv;
32127 }
32128
32129 uint32_t  __attribute__((export_name("TS_ConfirmationTarget_max_allowed_non_anchor_channel_remote_fee"))) TS_ConfirmationTarget_max_allowed_non_anchor_channel_remote_fee() {
32130         uint32_t ret_conv = LDKConfirmationTarget_to_js(ConfirmationTarget_max_allowed_non_anchor_channel_remote_fee());
32131         return ret_conv;
32132 }
32133
32134 uint32_t  __attribute__((export_name("TS_ConfirmationTarget_min_allowed_anchor_channel_remote_fee"))) TS_ConfirmationTarget_min_allowed_anchor_channel_remote_fee() {
32135         uint32_t ret_conv = LDKConfirmationTarget_to_js(ConfirmationTarget_min_allowed_anchor_channel_remote_fee());
32136         return ret_conv;
32137 }
32138
32139 uint32_t  __attribute__((export_name("TS_ConfirmationTarget_min_allowed_non_anchor_channel_remote_fee"))) TS_ConfirmationTarget_min_allowed_non_anchor_channel_remote_fee() {
32140         uint32_t ret_conv = LDKConfirmationTarget_to_js(ConfirmationTarget_min_allowed_non_anchor_channel_remote_fee());
32141         return ret_conv;
32142 }
32143
32144 uint32_t  __attribute__((export_name("TS_ConfirmationTarget_anchor_channel_fee"))) TS_ConfirmationTarget_anchor_channel_fee() {
32145         uint32_t ret_conv = LDKConfirmationTarget_to_js(ConfirmationTarget_anchor_channel_fee());
32146         return ret_conv;
32147 }
32148
32149 uint32_t  __attribute__((export_name("TS_ConfirmationTarget_non_anchor_channel_fee"))) TS_ConfirmationTarget_non_anchor_channel_fee() {
32150         uint32_t ret_conv = LDKConfirmationTarget_to_js(ConfirmationTarget_non_anchor_channel_fee());
32151         return ret_conv;
32152 }
32153
32154 uint32_t  __attribute__((export_name("TS_ConfirmationTarget_channel_close_minimum"))) TS_ConfirmationTarget_channel_close_minimum() {
32155         uint32_t ret_conv = LDKConfirmationTarget_to_js(ConfirmationTarget_channel_close_minimum());
32156         return ret_conv;
32157 }
32158
32159 int64_t  __attribute__((export_name("TS_ConfirmationTarget_hash"))) TS_ConfirmationTarget_hash(uint64_t o) {
32160         LDKConfirmationTarget* o_conv = (LDKConfirmationTarget*)untag_ptr(o);
32161         int64_t ret_conv = ConfirmationTarget_hash(o_conv);
32162         return ret_conv;
32163 }
32164
32165 jboolean  __attribute__((export_name("TS_ConfirmationTarget_eq"))) TS_ConfirmationTarget_eq(uint64_t a, uint64_t b) {
32166         LDKConfirmationTarget* a_conv = (LDKConfirmationTarget*)untag_ptr(a);
32167         LDKConfirmationTarget* b_conv = (LDKConfirmationTarget*)untag_ptr(b);
32168         jboolean ret_conv = ConfirmationTarget_eq(a_conv, b_conv);
32169         return ret_conv;
32170 }
32171
32172 void  __attribute__((export_name("TS_FeeEstimator_free"))) TS_FeeEstimator_free(uint64_t this_ptr) {
32173         if (!ptr_is_owned(this_ptr)) return;
32174         void* this_ptr_ptr = untag_ptr(this_ptr);
32175         CHECK_ACCESS(this_ptr_ptr);
32176         LDKFeeEstimator this_ptr_conv = *(LDKFeeEstimator*)(this_ptr_ptr);
32177         FREE(untag_ptr(this_ptr));
32178         FeeEstimator_free(this_ptr_conv);
32179 }
32180
32181 void  __attribute__((export_name("TS_MonitorUpdateId_free"))) TS_MonitorUpdateId_free(uint64_t this_obj) {
32182         LDKMonitorUpdateId this_obj_conv;
32183         this_obj_conv.inner = untag_ptr(this_obj);
32184         this_obj_conv.is_owned = ptr_is_owned(this_obj);
32185         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
32186         MonitorUpdateId_free(this_obj_conv);
32187 }
32188
32189 static inline uint64_t MonitorUpdateId_clone_ptr(LDKMonitorUpdateId *NONNULL_PTR arg) {
32190         LDKMonitorUpdateId ret_var = MonitorUpdateId_clone(arg);
32191         uint64_t ret_ref = 0;
32192         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
32193         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
32194         return ret_ref;
32195 }
32196 int64_t  __attribute__((export_name("TS_MonitorUpdateId_clone_ptr"))) TS_MonitorUpdateId_clone_ptr(uint64_t arg) {
32197         LDKMonitorUpdateId arg_conv;
32198         arg_conv.inner = untag_ptr(arg);
32199         arg_conv.is_owned = ptr_is_owned(arg);
32200         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
32201         arg_conv.is_owned = false;
32202         int64_t ret_conv = MonitorUpdateId_clone_ptr(&arg_conv);
32203         return ret_conv;
32204 }
32205
32206 uint64_t  __attribute__((export_name("TS_MonitorUpdateId_clone"))) TS_MonitorUpdateId_clone(uint64_t orig) {
32207         LDKMonitorUpdateId orig_conv;
32208         orig_conv.inner = untag_ptr(orig);
32209         orig_conv.is_owned = ptr_is_owned(orig);
32210         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
32211         orig_conv.is_owned = false;
32212         LDKMonitorUpdateId ret_var = MonitorUpdateId_clone(&orig_conv);
32213         uint64_t ret_ref = 0;
32214         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
32215         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
32216         return ret_ref;
32217 }
32218
32219 int64_t  __attribute__((export_name("TS_MonitorUpdateId_hash"))) TS_MonitorUpdateId_hash(uint64_t o) {
32220         LDKMonitorUpdateId o_conv;
32221         o_conv.inner = untag_ptr(o);
32222         o_conv.is_owned = ptr_is_owned(o);
32223         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
32224         o_conv.is_owned = false;
32225         int64_t ret_conv = MonitorUpdateId_hash(&o_conv);
32226         return ret_conv;
32227 }
32228
32229 jboolean  __attribute__((export_name("TS_MonitorUpdateId_eq"))) TS_MonitorUpdateId_eq(uint64_t a, uint64_t b) {
32230         LDKMonitorUpdateId a_conv;
32231         a_conv.inner = untag_ptr(a);
32232         a_conv.is_owned = ptr_is_owned(a);
32233         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
32234         a_conv.is_owned = false;
32235         LDKMonitorUpdateId b_conv;
32236         b_conv.inner = untag_ptr(b);
32237         b_conv.is_owned = ptr_is_owned(b);
32238         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
32239         b_conv.is_owned = false;
32240         jboolean ret_conv = MonitorUpdateId_eq(&a_conv, &b_conv);
32241         return ret_conv;
32242 }
32243
32244 void  __attribute__((export_name("TS_Persist_free"))) TS_Persist_free(uint64_t this_ptr) {
32245         if (!ptr_is_owned(this_ptr)) return;
32246         void* this_ptr_ptr = untag_ptr(this_ptr);
32247         CHECK_ACCESS(this_ptr_ptr);
32248         LDKPersist this_ptr_conv = *(LDKPersist*)(this_ptr_ptr);
32249         FREE(untag_ptr(this_ptr));
32250         Persist_free(this_ptr_conv);
32251 }
32252
32253 void  __attribute__((export_name("TS_LockedChannelMonitor_free"))) TS_LockedChannelMonitor_free(uint64_t this_obj) {
32254         LDKLockedChannelMonitor this_obj_conv;
32255         this_obj_conv.inner = untag_ptr(this_obj);
32256         this_obj_conv.is_owned = ptr_is_owned(this_obj);
32257         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
32258         LockedChannelMonitor_free(this_obj_conv);
32259 }
32260
32261 void  __attribute__((export_name("TS_ChainMonitor_free"))) TS_ChainMonitor_free(uint64_t this_obj) {
32262         LDKChainMonitor this_obj_conv;
32263         this_obj_conv.inner = untag_ptr(this_obj);
32264         this_obj_conv.is_owned = ptr_is_owned(this_obj);
32265         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
32266         ChainMonitor_free(this_obj_conv);
32267 }
32268
32269 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) {
32270         void* chain_source_ptr = untag_ptr(chain_source);
32271         CHECK_ACCESS(chain_source_ptr);
32272         LDKCOption_FilterZ chain_source_conv = *(LDKCOption_FilterZ*)(chain_source_ptr);
32273         // WARNING: we may need a move here but no clone is available for LDKCOption_FilterZ
32274         if (chain_source_conv.tag == LDKCOption_FilterZ_Some) {
32275                 // Manually implement clone for Java trait instances
32276                 if (chain_source_conv.some.free == LDKFilter_JCalls_free) {
32277                         // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
32278                         LDKFilter_JCalls_cloned(&chain_source_conv.some);
32279                 }
32280         }
32281         void* broadcaster_ptr = untag_ptr(broadcaster);
32282         CHECK_ACCESS(broadcaster_ptr);
32283         LDKBroadcasterInterface broadcaster_conv = *(LDKBroadcasterInterface*)(broadcaster_ptr);
32284         if (broadcaster_conv.free == LDKBroadcasterInterface_JCalls_free) {
32285                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
32286                 LDKBroadcasterInterface_JCalls_cloned(&broadcaster_conv);
32287         }
32288         void* logger_ptr = untag_ptr(logger);
32289         CHECK_ACCESS(logger_ptr);
32290         LDKLogger logger_conv = *(LDKLogger*)(logger_ptr);
32291         if (logger_conv.free == LDKLogger_JCalls_free) {
32292                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
32293                 LDKLogger_JCalls_cloned(&logger_conv);
32294         }
32295         void* feeest_ptr = untag_ptr(feeest);
32296         CHECK_ACCESS(feeest_ptr);
32297         LDKFeeEstimator feeest_conv = *(LDKFeeEstimator*)(feeest_ptr);
32298         if (feeest_conv.free == LDKFeeEstimator_JCalls_free) {
32299                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
32300                 LDKFeeEstimator_JCalls_cloned(&feeest_conv);
32301         }
32302         void* persister_ptr = untag_ptr(persister);
32303         CHECK_ACCESS(persister_ptr);
32304         LDKPersist persister_conv = *(LDKPersist*)(persister_ptr);
32305         if (persister_conv.free == LDKPersist_JCalls_free) {
32306                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
32307                 LDKPersist_JCalls_cloned(&persister_conv);
32308         }
32309         LDKChainMonitor ret_var = ChainMonitor_new(chain_source_conv, broadcaster_conv, logger_conv, feeest_conv, persister_conv);
32310         uint64_t ret_ref = 0;
32311         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
32312         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
32313         return ret_ref;
32314 }
32315
32316 uint64_tArray  __attribute__((export_name("TS_ChainMonitor_get_claimable_balances"))) TS_ChainMonitor_get_claimable_balances(uint64_t this_arg, uint64_tArray ignored_channels) {
32317         LDKChainMonitor this_arg_conv;
32318         this_arg_conv.inner = untag_ptr(this_arg);
32319         this_arg_conv.is_owned = ptr_is_owned(this_arg);
32320         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
32321         this_arg_conv.is_owned = false;
32322         LDKCVec_ChannelDetailsZ ignored_channels_constr;
32323         ignored_channels_constr.datalen = ignored_channels->arr_len;
32324         if (ignored_channels_constr.datalen > 0)
32325                 ignored_channels_constr.data = MALLOC(ignored_channels_constr.datalen * sizeof(LDKChannelDetails), "LDKCVec_ChannelDetailsZ Elements");
32326         else
32327                 ignored_channels_constr.data = NULL;
32328         uint64_t* ignored_channels_vals = ignored_channels->elems;
32329         for (size_t q = 0; q < ignored_channels_constr.datalen; q++) {
32330                 uint64_t ignored_channels_conv_16 = ignored_channels_vals[q];
32331                 LDKChannelDetails ignored_channels_conv_16_conv;
32332                 ignored_channels_conv_16_conv.inner = untag_ptr(ignored_channels_conv_16);
32333                 ignored_channels_conv_16_conv.is_owned = ptr_is_owned(ignored_channels_conv_16);
32334                 CHECK_INNER_FIELD_ACCESS_OR_NULL(ignored_channels_conv_16_conv);
32335                 ignored_channels_conv_16_conv = ChannelDetails_clone(&ignored_channels_conv_16_conv);
32336                 ignored_channels_constr.data[q] = ignored_channels_conv_16_conv;
32337         }
32338         FREE(ignored_channels);
32339         LDKCVec_BalanceZ ret_var = ChainMonitor_get_claimable_balances(&this_arg_conv, ignored_channels_constr);
32340         uint64_tArray ret_arr = NULL;
32341         ret_arr = init_uint64_tArray(ret_var.datalen, __LINE__);
32342         uint64_t *ret_arr_ptr = (uint64_t*)(((uint8_t*)ret_arr) + 8);
32343         for (size_t j = 0; j < ret_var.datalen; j++) {
32344                 LDKBalance *ret_conv_9_copy = MALLOC(sizeof(LDKBalance), "LDKBalance");
32345                 *ret_conv_9_copy = ret_var.data[j];
32346                 uint64_t ret_conv_9_ref = tag_ptr(ret_conv_9_copy, true);
32347                 ret_arr_ptr[j] = ret_conv_9_ref;
32348         }
32349         
32350         FREE(ret_var.data);
32351         return ret_arr;
32352 }
32353
32354 uint64_t  __attribute__((export_name("TS_ChainMonitor_get_monitor"))) TS_ChainMonitor_get_monitor(uint64_t this_arg, uint64_t funding_txo) {
32355         LDKChainMonitor this_arg_conv;
32356         this_arg_conv.inner = untag_ptr(this_arg);
32357         this_arg_conv.is_owned = ptr_is_owned(this_arg);
32358         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
32359         this_arg_conv.is_owned = false;
32360         LDKOutPoint funding_txo_conv;
32361         funding_txo_conv.inner = untag_ptr(funding_txo);
32362         funding_txo_conv.is_owned = ptr_is_owned(funding_txo);
32363         CHECK_INNER_FIELD_ACCESS_OR_NULL(funding_txo_conv);
32364         funding_txo_conv = OutPoint_clone(&funding_txo_conv);
32365         LDKCResult_LockedChannelMonitorNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_LockedChannelMonitorNoneZ), "LDKCResult_LockedChannelMonitorNoneZ");
32366         *ret_conv = ChainMonitor_get_monitor(&this_arg_conv, funding_txo_conv);
32367         return tag_ptr(ret_conv, true);
32368 }
32369
32370 uint64_tArray  __attribute__((export_name("TS_ChainMonitor_list_monitors"))) TS_ChainMonitor_list_monitors(uint64_t this_arg) {
32371         LDKChainMonitor this_arg_conv;
32372         this_arg_conv.inner = untag_ptr(this_arg);
32373         this_arg_conv.is_owned = ptr_is_owned(this_arg);
32374         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
32375         this_arg_conv.is_owned = false;
32376         LDKCVec_OutPointZ ret_var = ChainMonitor_list_monitors(&this_arg_conv);
32377         uint64_tArray ret_arr = NULL;
32378         ret_arr = init_uint64_tArray(ret_var.datalen, __LINE__);
32379         uint64_t *ret_arr_ptr = (uint64_t*)(((uint8_t*)ret_arr) + 8);
32380         for (size_t k = 0; k < ret_var.datalen; k++) {
32381                 LDKOutPoint ret_conv_10_var = ret_var.data[k];
32382                 uint64_t ret_conv_10_ref = 0;
32383                 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_conv_10_var);
32384                 ret_conv_10_ref = tag_ptr(ret_conv_10_var.inner, ret_conv_10_var.is_owned);
32385                 ret_arr_ptr[k] = ret_conv_10_ref;
32386         }
32387         
32388         FREE(ret_var.data);
32389         return ret_arr;
32390 }
32391
32392 uint64_tArray  __attribute__((export_name("TS_ChainMonitor_list_pending_monitor_updates"))) TS_ChainMonitor_list_pending_monitor_updates(uint64_t this_arg) {
32393         LDKChainMonitor this_arg_conv;
32394         this_arg_conv.inner = untag_ptr(this_arg);
32395         this_arg_conv.is_owned = ptr_is_owned(this_arg);
32396         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
32397         this_arg_conv.is_owned = false;
32398         LDKCVec_C2Tuple_OutPointCVec_MonitorUpdateIdZZZ ret_var = ChainMonitor_list_pending_monitor_updates(&this_arg_conv);
32399         uint64_tArray ret_arr = NULL;
32400         ret_arr = init_uint64_tArray(ret_var.datalen, __LINE__);
32401         uint64_t *ret_arr_ptr = (uint64_t*)(((uint8_t*)ret_arr) + 8);
32402         for (size_t p = 0; p < ret_var.datalen; p++) {
32403                 LDKC2Tuple_OutPointCVec_MonitorUpdateIdZZ* ret_conv_41_conv = MALLOC(sizeof(LDKC2Tuple_OutPointCVec_MonitorUpdateIdZZ), "LDKC2Tuple_OutPointCVec_MonitorUpdateIdZZ");
32404                 *ret_conv_41_conv = ret_var.data[p];
32405                 ret_arr_ptr[p] = tag_ptr(ret_conv_41_conv, true);
32406         }
32407         
32408         FREE(ret_var.data);
32409         return ret_arr;
32410 }
32411
32412 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) {
32413         LDKChainMonitor this_arg_conv;
32414         this_arg_conv.inner = untag_ptr(this_arg);
32415         this_arg_conv.is_owned = ptr_is_owned(this_arg);
32416         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
32417         this_arg_conv.is_owned = false;
32418         LDKOutPoint funding_txo_conv;
32419         funding_txo_conv.inner = untag_ptr(funding_txo);
32420         funding_txo_conv.is_owned = ptr_is_owned(funding_txo);
32421         CHECK_INNER_FIELD_ACCESS_OR_NULL(funding_txo_conv);
32422         funding_txo_conv = OutPoint_clone(&funding_txo_conv);
32423         LDKMonitorUpdateId completed_update_id_conv;
32424         completed_update_id_conv.inner = untag_ptr(completed_update_id);
32425         completed_update_id_conv.is_owned = ptr_is_owned(completed_update_id);
32426         CHECK_INNER_FIELD_ACCESS_OR_NULL(completed_update_id_conv);
32427         completed_update_id_conv = MonitorUpdateId_clone(&completed_update_id_conv);
32428         LDKCResult_NoneAPIErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneAPIErrorZ), "LDKCResult_NoneAPIErrorZ");
32429         *ret_conv = ChainMonitor_channel_monitor_updated(&this_arg_conv, funding_txo_conv, completed_update_id_conv);
32430         return tag_ptr(ret_conv, true);
32431 }
32432
32433 uint64_t  __attribute__((export_name("TS_ChainMonitor_get_update_future"))) TS_ChainMonitor_get_update_future(uint64_t this_arg) {
32434         LDKChainMonitor this_arg_conv;
32435         this_arg_conv.inner = untag_ptr(this_arg);
32436         this_arg_conv.is_owned = ptr_is_owned(this_arg);
32437         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
32438         this_arg_conv.is_owned = false;
32439         LDKFuture ret_var = ChainMonitor_get_update_future(&this_arg_conv);
32440         uint64_t ret_ref = 0;
32441         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
32442         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
32443         return ret_ref;
32444 }
32445
32446 void  __attribute__((export_name("TS_ChainMonitor_rebroadcast_pending_claims"))) TS_ChainMonitor_rebroadcast_pending_claims(uint64_t this_arg) {
32447         LDKChainMonitor this_arg_conv;
32448         this_arg_conv.inner = untag_ptr(this_arg);
32449         this_arg_conv.is_owned = ptr_is_owned(this_arg);
32450         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
32451         this_arg_conv.is_owned = false;
32452         ChainMonitor_rebroadcast_pending_claims(&this_arg_conv);
32453 }
32454
32455 uint64_t  __attribute__((export_name("TS_ChainMonitor_as_Listen"))) TS_ChainMonitor_as_Listen(uint64_t this_arg) {
32456         LDKChainMonitor this_arg_conv;
32457         this_arg_conv.inner = untag_ptr(this_arg);
32458         this_arg_conv.is_owned = ptr_is_owned(this_arg);
32459         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
32460         this_arg_conv.is_owned = false;
32461         LDKListen* ret_ret = MALLOC(sizeof(LDKListen), "LDKListen");
32462         *ret_ret = ChainMonitor_as_Listen(&this_arg_conv);
32463         return tag_ptr(ret_ret, true);
32464 }
32465
32466 uint64_t  __attribute__((export_name("TS_ChainMonitor_as_Confirm"))) TS_ChainMonitor_as_Confirm(uint64_t this_arg) {
32467         LDKChainMonitor this_arg_conv;
32468         this_arg_conv.inner = untag_ptr(this_arg);
32469         this_arg_conv.is_owned = ptr_is_owned(this_arg);
32470         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
32471         this_arg_conv.is_owned = false;
32472         LDKConfirm* ret_ret = MALLOC(sizeof(LDKConfirm), "LDKConfirm");
32473         *ret_ret = ChainMonitor_as_Confirm(&this_arg_conv);
32474         return tag_ptr(ret_ret, true);
32475 }
32476
32477 uint64_t  __attribute__((export_name("TS_ChainMonitor_as_Watch"))) TS_ChainMonitor_as_Watch(uint64_t this_arg) {
32478         LDKChainMonitor this_arg_conv;
32479         this_arg_conv.inner = untag_ptr(this_arg);
32480         this_arg_conv.is_owned = ptr_is_owned(this_arg);
32481         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
32482         this_arg_conv.is_owned = false;
32483         LDKWatch* ret_ret = MALLOC(sizeof(LDKWatch), "LDKWatch");
32484         *ret_ret = ChainMonitor_as_Watch(&this_arg_conv);
32485         return tag_ptr(ret_ret, true);
32486 }
32487
32488 uint64_t  __attribute__((export_name("TS_ChainMonitor_as_EventsProvider"))) TS_ChainMonitor_as_EventsProvider(uint64_t this_arg) {
32489         LDKChainMonitor this_arg_conv;
32490         this_arg_conv.inner = untag_ptr(this_arg);
32491         this_arg_conv.is_owned = ptr_is_owned(this_arg);
32492         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
32493         this_arg_conv.is_owned = false;
32494         LDKEventsProvider* ret_ret = MALLOC(sizeof(LDKEventsProvider), "LDKEventsProvider");
32495         *ret_ret = ChainMonitor_as_EventsProvider(&this_arg_conv);
32496         return tag_ptr(ret_ret, true);
32497 }
32498
32499 void  __attribute__((export_name("TS_ChannelMonitorUpdate_free"))) TS_ChannelMonitorUpdate_free(uint64_t this_obj) {
32500         LDKChannelMonitorUpdate this_obj_conv;
32501         this_obj_conv.inner = untag_ptr(this_obj);
32502         this_obj_conv.is_owned = ptr_is_owned(this_obj);
32503         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
32504         ChannelMonitorUpdate_free(this_obj_conv);
32505 }
32506
32507 int64_t  __attribute__((export_name("TS_ChannelMonitorUpdate_get_update_id"))) TS_ChannelMonitorUpdate_get_update_id(uint64_t this_ptr) {
32508         LDKChannelMonitorUpdate this_ptr_conv;
32509         this_ptr_conv.inner = untag_ptr(this_ptr);
32510         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
32511         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
32512         this_ptr_conv.is_owned = false;
32513         int64_t ret_conv = ChannelMonitorUpdate_get_update_id(&this_ptr_conv);
32514         return ret_conv;
32515 }
32516
32517 void  __attribute__((export_name("TS_ChannelMonitorUpdate_set_update_id"))) TS_ChannelMonitorUpdate_set_update_id(uint64_t this_ptr, int64_t val) {
32518         LDKChannelMonitorUpdate this_ptr_conv;
32519         this_ptr_conv.inner = untag_ptr(this_ptr);
32520         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
32521         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
32522         this_ptr_conv.is_owned = false;
32523         ChannelMonitorUpdate_set_update_id(&this_ptr_conv, val);
32524 }
32525
32526 static inline uint64_t ChannelMonitorUpdate_clone_ptr(LDKChannelMonitorUpdate *NONNULL_PTR arg) {
32527         LDKChannelMonitorUpdate ret_var = ChannelMonitorUpdate_clone(arg);
32528         uint64_t ret_ref = 0;
32529         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
32530         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
32531         return ret_ref;
32532 }
32533 int64_t  __attribute__((export_name("TS_ChannelMonitorUpdate_clone_ptr"))) TS_ChannelMonitorUpdate_clone_ptr(uint64_t arg) {
32534         LDKChannelMonitorUpdate arg_conv;
32535         arg_conv.inner = untag_ptr(arg);
32536         arg_conv.is_owned = ptr_is_owned(arg);
32537         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
32538         arg_conv.is_owned = false;
32539         int64_t ret_conv = ChannelMonitorUpdate_clone_ptr(&arg_conv);
32540         return ret_conv;
32541 }
32542
32543 uint64_t  __attribute__((export_name("TS_ChannelMonitorUpdate_clone"))) TS_ChannelMonitorUpdate_clone(uint64_t orig) {
32544         LDKChannelMonitorUpdate orig_conv;
32545         orig_conv.inner = untag_ptr(orig);
32546         orig_conv.is_owned = ptr_is_owned(orig);
32547         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
32548         orig_conv.is_owned = false;
32549         LDKChannelMonitorUpdate ret_var = ChannelMonitorUpdate_clone(&orig_conv);
32550         uint64_t ret_ref = 0;
32551         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
32552         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
32553         return ret_ref;
32554 }
32555
32556 jboolean  __attribute__((export_name("TS_ChannelMonitorUpdate_eq"))) TS_ChannelMonitorUpdate_eq(uint64_t a, uint64_t b) {
32557         LDKChannelMonitorUpdate a_conv;
32558         a_conv.inner = untag_ptr(a);
32559         a_conv.is_owned = ptr_is_owned(a);
32560         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
32561         a_conv.is_owned = false;
32562         LDKChannelMonitorUpdate b_conv;
32563         b_conv.inner = untag_ptr(b);
32564         b_conv.is_owned = ptr_is_owned(b);
32565         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
32566         b_conv.is_owned = false;
32567         jboolean ret_conv = ChannelMonitorUpdate_eq(&a_conv, &b_conv);
32568         return ret_conv;
32569 }
32570
32571 int8_tArray  __attribute__((export_name("TS_ChannelMonitorUpdate_write"))) TS_ChannelMonitorUpdate_write(uint64_t obj) {
32572         LDKChannelMonitorUpdate obj_conv;
32573         obj_conv.inner = untag_ptr(obj);
32574         obj_conv.is_owned = ptr_is_owned(obj);
32575         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
32576         obj_conv.is_owned = false;
32577         LDKCVec_u8Z ret_var = ChannelMonitorUpdate_write(&obj_conv);
32578         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
32579         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
32580         CVec_u8Z_free(ret_var);
32581         return ret_arr;
32582 }
32583
32584 uint64_t  __attribute__((export_name("TS_ChannelMonitorUpdate_read"))) TS_ChannelMonitorUpdate_read(int8_tArray ser) {
32585         LDKu8slice ser_ref;
32586         ser_ref.datalen = ser->arr_len;
32587         ser_ref.data = ser->elems;
32588         LDKCResult_ChannelMonitorUpdateDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelMonitorUpdateDecodeErrorZ), "LDKCResult_ChannelMonitorUpdateDecodeErrorZ");
32589         *ret_conv = ChannelMonitorUpdate_read(ser_ref);
32590         FREE(ser);
32591         return tag_ptr(ret_conv, true);
32592 }
32593
32594 void  __attribute__((export_name("TS_MonitorEvent_free"))) TS_MonitorEvent_free(uint64_t this_ptr) {
32595         if (!ptr_is_owned(this_ptr)) return;
32596         void* this_ptr_ptr = untag_ptr(this_ptr);
32597         CHECK_ACCESS(this_ptr_ptr);
32598         LDKMonitorEvent this_ptr_conv = *(LDKMonitorEvent*)(this_ptr_ptr);
32599         FREE(untag_ptr(this_ptr));
32600         MonitorEvent_free(this_ptr_conv);
32601 }
32602
32603 static inline uint64_t MonitorEvent_clone_ptr(LDKMonitorEvent *NONNULL_PTR arg) {
32604         LDKMonitorEvent *ret_copy = MALLOC(sizeof(LDKMonitorEvent), "LDKMonitorEvent");
32605         *ret_copy = MonitorEvent_clone(arg);
32606         uint64_t ret_ref = tag_ptr(ret_copy, true);
32607         return ret_ref;
32608 }
32609 int64_t  __attribute__((export_name("TS_MonitorEvent_clone_ptr"))) TS_MonitorEvent_clone_ptr(uint64_t arg) {
32610         LDKMonitorEvent* arg_conv = (LDKMonitorEvent*)untag_ptr(arg);
32611         int64_t ret_conv = MonitorEvent_clone_ptr(arg_conv);
32612         return ret_conv;
32613 }
32614
32615 uint64_t  __attribute__((export_name("TS_MonitorEvent_clone"))) TS_MonitorEvent_clone(uint64_t orig) {
32616         LDKMonitorEvent* orig_conv = (LDKMonitorEvent*)untag_ptr(orig);
32617         LDKMonitorEvent *ret_copy = MALLOC(sizeof(LDKMonitorEvent), "LDKMonitorEvent");
32618         *ret_copy = MonitorEvent_clone(orig_conv);
32619         uint64_t ret_ref = tag_ptr(ret_copy, true);
32620         return ret_ref;
32621 }
32622
32623 uint64_t  __attribute__((export_name("TS_MonitorEvent_htlcevent"))) TS_MonitorEvent_htlcevent(uint64_t a) {
32624         LDKHTLCUpdate a_conv;
32625         a_conv.inner = untag_ptr(a);
32626         a_conv.is_owned = ptr_is_owned(a);
32627         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
32628         a_conv = HTLCUpdate_clone(&a_conv);
32629         LDKMonitorEvent *ret_copy = MALLOC(sizeof(LDKMonitorEvent), "LDKMonitorEvent");
32630         *ret_copy = MonitorEvent_htlcevent(a_conv);
32631         uint64_t ret_ref = tag_ptr(ret_copy, true);
32632         return ret_ref;
32633 }
32634
32635 uint64_t  __attribute__((export_name("TS_MonitorEvent_holder_force_closed"))) TS_MonitorEvent_holder_force_closed(uint64_t a) {
32636         LDKOutPoint a_conv;
32637         a_conv.inner = untag_ptr(a);
32638         a_conv.is_owned = ptr_is_owned(a);
32639         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
32640         a_conv = OutPoint_clone(&a_conv);
32641         LDKMonitorEvent *ret_copy = MALLOC(sizeof(LDKMonitorEvent), "LDKMonitorEvent");
32642         *ret_copy = MonitorEvent_holder_force_closed(a_conv);
32643         uint64_t ret_ref = tag_ptr(ret_copy, true);
32644         return ret_ref;
32645 }
32646
32647 uint64_t  __attribute__((export_name("TS_MonitorEvent_completed"))) TS_MonitorEvent_completed(uint64_t funding_txo, int64_t monitor_update_id) {
32648         LDKOutPoint funding_txo_conv;
32649         funding_txo_conv.inner = untag_ptr(funding_txo);
32650         funding_txo_conv.is_owned = ptr_is_owned(funding_txo);
32651         CHECK_INNER_FIELD_ACCESS_OR_NULL(funding_txo_conv);
32652         funding_txo_conv = OutPoint_clone(&funding_txo_conv);
32653         LDKMonitorEvent *ret_copy = MALLOC(sizeof(LDKMonitorEvent), "LDKMonitorEvent");
32654         *ret_copy = MonitorEvent_completed(funding_txo_conv, monitor_update_id);
32655         uint64_t ret_ref = tag_ptr(ret_copy, true);
32656         return ret_ref;
32657 }
32658
32659 jboolean  __attribute__((export_name("TS_MonitorEvent_eq"))) TS_MonitorEvent_eq(uint64_t a, uint64_t b) {
32660         LDKMonitorEvent* a_conv = (LDKMonitorEvent*)untag_ptr(a);
32661         LDKMonitorEvent* b_conv = (LDKMonitorEvent*)untag_ptr(b);
32662         jboolean ret_conv = MonitorEvent_eq(a_conv, b_conv);
32663         return ret_conv;
32664 }
32665
32666 int8_tArray  __attribute__((export_name("TS_MonitorEvent_write"))) TS_MonitorEvent_write(uint64_t obj) {
32667         LDKMonitorEvent* obj_conv = (LDKMonitorEvent*)untag_ptr(obj);
32668         LDKCVec_u8Z ret_var = MonitorEvent_write(obj_conv);
32669         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
32670         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
32671         CVec_u8Z_free(ret_var);
32672         return ret_arr;
32673 }
32674
32675 uint64_t  __attribute__((export_name("TS_MonitorEvent_read"))) TS_MonitorEvent_read(int8_tArray ser) {
32676         LDKu8slice ser_ref;
32677         ser_ref.datalen = ser->arr_len;
32678         ser_ref.data = ser->elems;
32679         LDKCResult_COption_MonitorEventZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_COption_MonitorEventZDecodeErrorZ), "LDKCResult_COption_MonitorEventZDecodeErrorZ");
32680         *ret_conv = MonitorEvent_read(ser_ref);
32681         FREE(ser);
32682         return tag_ptr(ret_conv, true);
32683 }
32684
32685 void  __attribute__((export_name("TS_HTLCUpdate_free"))) TS_HTLCUpdate_free(uint64_t this_obj) {
32686         LDKHTLCUpdate this_obj_conv;
32687         this_obj_conv.inner = untag_ptr(this_obj);
32688         this_obj_conv.is_owned = ptr_is_owned(this_obj);
32689         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
32690         HTLCUpdate_free(this_obj_conv);
32691 }
32692
32693 static inline uint64_t HTLCUpdate_clone_ptr(LDKHTLCUpdate *NONNULL_PTR arg) {
32694         LDKHTLCUpdate ret_var = HTLCUpdate_clone(arg);
32695         uint64_t ret_ref = 0;
32696         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
32697         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
32698         return ret_ref;
32699 }
32700 int64_t  __attribute__((export_name("TS_HTLCUpdate_clone_ptr"))) TS_HTLCUpdate_clone_ptr(uint64_t arg) {
32701         LDKHTLCUpdate arg_conv;
32702         arg_conv.inner = untag_ptr(arg);
32703         arg_conv.is_owned = ptr_is_owned(arg);
32704         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
32705         arg_conv.is_owned = false;
32706         int64_t ret_conv = HTLCUpdate_clone_ptr(&arg_conv);
32707         return ret_conv;
32708 }
32709
32710 uint64_t  __attribute__((export_name("TS_HTLCUpdate_clone"))) TS_HTLCUpdate_clone(uint64_t orig) {
32711         LDKHTLCUpdate orig_conv;
32712         orig_conv.inner = untag_ptr(orig);
32713         orig_conv.is_owned = ptr_is_owned(orig);
32714         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
32715         orig_conv.is_owned = false;
32716         LDKHTLCUpdate ret_var = HTLCUpdate_clone(&orig_conv);
32717         uint64_t ret_ref = 0;
32718         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
32719         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
32720         return ret_ref;
32721 }
32722
32723 jboolean  __attribute__((export_name("TS_HTLCUpdate_eq"))) TS_HTLCUpdate_eq(uint64_t a, uint64_t b) {
32724         LDKHTLCUpdate a_conv;
32725         a_conv.inner = untag_ptr(a);
32726         a_conv.is_owned = ptr_is_owned(a);
32727         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
32728         a_conv.is_owned = false;
32729         LDKHTLCUpdate b_conv;
32730         b_conv.inner = untag_ptr(b);
32731         b_conv.is_owned = ptr_is_owned(b);
32732         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
32733         b_conv.is_owned = false;
32734         jboolean ret_conv = HTLCUpdate_eq(&a_conv, &b_conv);
32735         return ret_conv;
32736 }
32737
32738 int8_tArray  __attribute__((export_name("TS_HTLCUpdate_write"))) TS_HTLCUpdate_write(uint64_t obj) {
32739         LDKHTLCUpdate obj_conv;
32740         obj_conv.inner = untag_ptr(obj);
32741         obj_conv.is_owned = ptr_is_owned(obj);
32742         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
32743         obj_conv.is_owned = false;
32744         LDKCVec_u8Z ret_var = HTLCUpdate_write(&obj_conv);
32745         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
32746         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
32747         CVec_u8Z_free(ret_var);
32748         return ret_arr;
32749 }
32750
32751 uint64_t  __attribute__((export_name("TS_HTLCUpdate_read"))) TS_HTLCUpdate_read(int8_tArray ser) {
32752         LDKu8slice ser_ref;
32753         ser_ref.datalen = ser->arr_len;
32754         ser_ref.data = ser->elems;
32755         LDKCResult_HTLCUpdateDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_HTLCUpdateDecodeErrorZ), "LDKCResult_HTLCUpdateDecodeErrorZ");
32756         *ret_conv = HTLCUpdate_read(ser_ref);
32757         FREE(ser);
32758         return tag_ptr(ret_conv, true);
32759 }
32760
32761 void  __attribute__((export_name("TS_Balance_free"))) TS_Balance_free(uint64_t this_ptr) {
32762         if (!ptr_is_owned(this_ptr)) return;
32763         void* this_ptr_ptr = untag_ptr(this_ptr);
32764         CHECK_ACCESS(this_ptr_ptr);
32765         LDKBalance this_ptr_conv = *(LDKBalance*)(this_ptr_ptr);
32766         FREE(untag_ptr(this_ptr));
32767         Balance_free(this_ptr_conv);
32768 }
32769
32770 static inline uint64_t Balance_clone_ptr(LDKBalance *NONNULL_PTR arg) {
32771         LDKBalance *ret_copy = MALLOC(sizeof(LDKBalance), "LDKBalance");
32772         *ret_copy = Balance_clone(arg);
32773         uint64_t ret_ref = tag_ptr(ret_copy, true);
32774         return ret_ref;
32775 }
32776 int64_t  __attribute__((export_name("TS_Balance_clone_ptr"))) TS_Balance_clone_ptr(uint64_t arg) {
32777         LDKBalance* arg_conv = (LDKBalance*)untag_ptr(arg);
32778         int64_t ret_conv = Balance_clone_ptr(arg_conv);
32779         return ret_conv;
32780 }
32781
32782 uint64_t  __attribute__((export_name("TS_Balance_clone"))) TS_Balance_clone(uint64_t orig) {
32783         LDKBalance* orig_conv = (LDKBalance*)untag_ptr(orig);
32784         LDKBalance *ret_copy = MALLOC(sizeof(LDKBalance), "LDKBalance");
32785         *ret_copy = Balance_clone(orig_conv);
32786         uint64_t ret_ref = tag_ptr(ret_copy, true);
32787         return ret_ref;
32788 }
32789
32790 uint64_t  __attribute__((export_name("TS_Balance_claimable_on_channel_close"))) TS_Balance_claimable_on_channel_close(int64_t amount_satoshis) {
32791         LDKBalance *ret_copy = MALLOC(sizeof(LDKBalance), "LDKBalance");
32792         *ret_copy = Balance_claimable_on_channel_close(amount_satoshis);
32793         uint64_t ret_ref = tag_ptr(ret_copy, true);
32794         return ret_ref;
32795 }
32796
32797 uint64_t  __attribute__((export_name("TS_Balance_claimable_awaiting_confirmations"))) TS_Balance_claimable_awaiting_confirmations(int64_t amount_satoshis, int32_t confirmation_height) {
32798         LDKBalance *ret_copy = MALLOC(sizeof(LDKBalance), "LDKBalance");
32799         *ret_copy = Balance_claimable_awaiting_confirmations(amount_satoshis, confirmation_height);
32800         uint64_t ret_ref = tag_ptr(ret_copy, true);
32801         return ret_ref;
32802 }
32803
32804 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) {
32805         LDKThirtyTwoBytes payment_hash_ref;
32806         CHECK(payment_hash->arr_len == 32);
32807         memcpy(payment_hash_ref.data, payment_hash->elems, 32); FREE(payment_hash);
32808         LDKThirtyTwoBytes payment_preimage_ref;
32809         CHECK(payment_preimage->arr_len == 32);
32810         memcpy(payment_preimage_ref.data, payment_preimage->elems, 32); FREE(payment_preimage);
32811         LDKBalance *ret_copy = MALLOC(sizeof(LDKBalance), "LDKBalance");
32812         *ret_copy = Balance_contentious_claimable(amount_satoshis, timeout_height, payment_hash_ref, payment_preimage_ref);
32813         uint64_t ret_ref = tag_ptr(ret_copy, true);
32814         return ret_ref;
32815 }
32816
32817 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) {
32818         LDKThirtyTwoBytes payment_hash_ref;
32819         CHECK(payment_hash->arr_len == 32);
32820         memcpy(payment_hash_ref.data, payment_hash->elems, 32); FREE(payment_hash);
32821         LDKBalance *ret_copy = MALLOC(sizeof(LDKBalance), "LDKBalance");
32822         *ret_copy = Balance_maybe_timeout_claimable_htlc(amount_satoshis, claimable_height, payment_hash_ref);
32823         uint64_t ret_ref = tag_ptr(ret_copy, true);
32824         return ret_ref;
32825 }
32826
32827 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) {
32828         LDKThirtyTwoBytes payment_hash_ref;
32829         CHECK(payment_hash->arr_len == 32);
32830         memcpy(payment_hash_ref.data, payment_hash->elems, 32); FREE(payment_hash);
32831         LDKBalance *ret_copy = MALLOC(sizeof(LDKBalance), "LDKBalance");
32832         *ret_copy = Balance_maybe_preimage_claimable_htlc(amount_satoshis, expiry_height, payment_hash_ref);
32833         uint64_t ret_ref = tag_ptr(ret_copy, true);
32834         return ret_ref;
32835 }
32836
32837 uint64_t  __attribute__((export_name("TS_Balance_counterparty_revoked_output_claimable"))) TS_Balance_counterparty_revoked_output_claimable(int64_t amount_satoshis) {
32838         LDKBalance *ret_copy = MALLOC(sizeof(LDKBalance), "LDKBalance");
32839         *ret_copy = Balance_counterparty_revoked_output_claimable(amount_satoshis);
32840         uint64_t ret_ref = tag_ptr(ret_copy, true);
32841         return ret_ref;
32842 }
32843
32844 jboolean  __attribute__((export_name("TS_Balance_eq"))) TS_Balance_eq(uint64_t a, uint64_t b) {
32845         LDKBalance* a_conv = (LDKBalance*)untag_ptr(a);
32846         LDKBalance* b_conv = (LDKBalance*)untag_ptr(b);
32847         jboolean ret_conv = Balance_eq(a_conv, b_conv);
32848         return ret_conv;
32849 }
32850
32851 int64_t  __attribute__((export_name("TS_Balance_claimable_amount_satoshis"))) TS_Balance_claimable_amount_satoshis(uint64_t this_arg) {
32852         LDKBalance* this_arg_conv = (LDKBalance*)untag_ptr(this_arg);
32853         int64_t ret_conv = Balance_claimable_amount_satoshis(this_arg_conv);
32854         return ret_conv;
32855 }
32856
32857 void  __attribute__((export_name("TS_ChannelMonitor_free"))) TS_ChannelMonitor_free(uint64_t this_obj) {
32858         LDKChannelMonitor this_obj_conv;
32859         this_obj_conv.inner = untag_ptr(this_obj);
32860         this_obj_conv.is_owned = ptr_is_owned(this_obj);
32861         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
32862         ChannelMonitor_free(this_obj_conv);
32863 }
32864
32865 static inline uint64_t ChannelMonitor_clone_ptr(LDKChannelMonitor *NONNULL_PTR arg) {
32866         LDKChannelMonitor ret_var = ChannelMonitor_clone(arg);
32867         uint64_t ret_ref = 0;
32868         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
32869         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
32870         return ret_ref;
32871 }
32872 int64_t  __attribute__((export_name("TS_ChannelMonitor_clone_ptr"))) TS_ChannelMonitor_clone_ptr(uint64_t arg) {
32873         LDKChannelMonitor arg_conv;
32874         arg_conv.inner = untag_ptr(arg);
32875         arg_conv.is_owned = ptr_is_owned(arg);
32876         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
32877         arg_conv.is_owned = false;
32878         int64_t ret_conv = ChannelMonitor_clone_ptr(&arg_conv);
32879         return ret_conv;
32880 }
32881
32882 uint64_t  __attribute__((export_name("TS_ChannelMonitor_clone"))) TS_ChannelMonitor_clone(uint64_t orig) {
32883         LDKChannelMonitor orig_conv;
32884         orig_conv.inner = untag_ptr(orig);
32885         orig_conv.is_owned = ptr_is_owned(orig);
32886         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
32887         orig_conv.is_owned = false;
32888         LDKChannelMonitor ret_var = ChannelMonitor_clone(&orig_conv);
32889         uint64_t ret_ref = 0;
32890         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
32891         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
32892         return ret_ref;
32893 }
32894
32895 int8_tArray  __attribute__((export_name("TS_ChannelMonitor_write"))) TS_ChannelMonitor_write(uint64_t obj) {
32896         LDKChannelMonitor obj_conv;
32897         obj_conv.inner = untag_ptr(obj);
32898         obj_conv.is_owned = ptr_is_owned(obj);
32899         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
32900         obj_conv.is_owned = false;
32901         LDKCVec_u8Z ret_var = ChannelMonitor_write(&obj_conv);
32902         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
32903         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
32904         CVec_u8Z_free(ret_var);
32905         return ret_arr;
32906 }
32907
32908 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) {
32909         LDKChannelMonitor this_arg_conv;
32910         this_arg_conv.inner = untag_ptr(this_arg);
32911         this_arg_conv.is_owned = ptr_is_owned(this_arg);
32912         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
32913         this_arg_conv.is_owned = false;
32914         LDKChannelMonitorUpdate updates_conv;
32915         updates_conv.inner = untag_ptr(updates);
32916         updates_conv.is_owned = ptr_is_owned(updates);
32917         CHECK_INNER_FIELD_ACCESS_OR_NULL(updates_conv);
32918         updates_conv.is_owned = false;
32919         void* broadcaster_ptr = untag_ptr(broadcaster);
32920         if (ptr_is_owned(broadcaster)) { CHECK_ACCESS(broadcaster_ptr); }
32921         LDKBroadcasterInterface* broadcaster_conv = (LDKBroadcasterInterface*)broadcaster_ptr;
32922         void* fee_estimator_ptr = untag_ptr(fee_estimator);
32923         if (ptr_is_owned(fee_estimator)) { CHECK_ACCESS(fee_estimator_ptr); }
32924         LDKFeeEstimator* fee_estimator_conv = (LDKFeeEstimator*)fee_estimator_ptr;
32925         void* logger_ptr = untag_ptr(logger);
32926         if (ptr_is_owned(logger)) { CHECK_ACCESS(logger_ptr); }
32927         LDKLogger* logger_conv = (LDKLogger*)logger_ptr;
32928         LDKCResult_NoneNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneNoneZ), "LDKCResult_NoneNoneZ");
32929         *ret_conv = ChannelMonitor_update_monitor(&this_arg_conv, &updates_conv, broadcaster_conv, fee_estimator_conv, logger_conv);
32930         return tag_ptr(ret_conv, true);
32931 }
32932
32933 int64_t  __attribute__((export_name("TS_ChannelMonitor_get_latest_update_id"))) TS_ChannelMonitor_get_latest_update_id(uint64_t this_arg) {
32934         LDKChannelMonitor this_arg_conv;
32935         this_arg_conv.inner = untag_ptr(this_arg);
32936         this_arg_conv.is_owned = ptr_is_owned(this_arg);
32937         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
32938         this_arg_conv.is_owned = false;
32939         int64_t ret_conv = ChannelMonitor_get_latest_update_id(&this_arg_conv);
32940         return ret_conv;
32941 }
32942
32943 uint64_t  __attribute__((export_name("TS_ChannelMonitor_get_funding_txo"))) TS_ChannelMonitor_get_funding_txo(uint64_t this_arg) {
32944         LDKChannelMonitor this_arg_conv;
32945         this_arg_conv.inner = untag_ptr(this_arg);
32946         this_arg_conv.is_owned = ptr_is_owned(this_arg);
32947         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
32948         this_arg_conv.is_owned = false;
32949         LDKC2Tuple_OutPointCVec_u8ZZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_OutPointCVec_u8ZZ), "LDKC2Tuple_OutPointCVec_u8ZZ");
32950         *ret_conv = ChannelMonitor_get_funding_txo(&this_arg_conv);
32951         return tag_ptr(ret_conv, true);
32952 }
32953
32954 uint64_tArray  __attribute__((export_name("TS_ChannelMonitor_get_outputs_to_watch"))) TS_ChannelMonitor_get_outputs_to_watch(uint64_t this_arg) {
32955         LDKChannelMonitor this_arg_conv;
32956         this_arg_conv.inner = untag_ptr(this_arg);
32957         this_arg_conv.is_owned = ptr_is_owned(this_arg);
32958         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
32959         this_arg_conv.is_owned = false;
32960         LDKCVec_C2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32CVec_u8ZZZZZ ret_var = ChannelMonitor_get_outputs_to_watch(&this_arg_conv);
32961         uint64_tArray ret_arr = NULL;
32962         ret_arr = init_uint64_tArray(ret_var.datalen, __LINE__);
32963         uint64_t *ret_arr_ptr = (uint64_t*)(((uint8_t*)ret_arr) + 8);
32964         for (size_t a = 0; a < ret_var.datalen; a++) {
32965                 LDKC2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32CVec_u8ZZZZ* ret_conv_52_conv = MALLOC(sizeof(LDKC2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32CVec_u8ZZZZ), "LDKC2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32CVec_u8ZZZZ");
32966                 *ret_conv_52_conv = ret_var.data[a];
32967                 ret_arr_ptr[a] = tag_ptr(ret_conv_52_conv, true);
32968         }
32969         
32970         FREE(ret_var.data);
32971         return ret_arr;
32972 }
32973
32974 void  __attribute__((export_name("TS_ChannelMonitor_load_outputs_to_watch"))) TS_ChannelMonitor_load_outputs_to_watch(uint64_t this_arg, uint64_t filter) {
32975         LDKChannelMonitor this_arg_conv;
32976         this_arg_conv.inner = untag_ptr(this_arg);
32977         this_arg_conv.is_owned = ptr_is_owned(this_arg);
32978         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
32979         this_arg_conv.is_owned = false;
32980         void* filter_ptr = untag_ptr(filter);
32981         if (ptr_is_owned(filter)) { CHECK_ACCESS(filter_ptr); }
32982         LDKFilter* filter_conv = (LDKFilter*)filter_ptr;
32983         ChannelMonitor_load_outputs_to_watch(&this_arg_conv, filter_conv);
32984 }
32985
32986 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) {
32987         LDKChannelMonitor this_arg_conv;
32988         this_arg_conv.inner = untag_ptr(this_arg);
32989         this_arg_conv.is_owned = ptr_is_owned(this_arg);
32990         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
32991         this_arg_conv.is_owned = false;
32992         LDKCVec_MonitorEventZ ret_var = ChannelMonitor_get_and_clear_pending_monitor_events(&this_arg_conv);
32993         uint64_tArray ret_arr = NULL;
32994         ret_arr = init_uint64_tArray(ret_var.datalen, __LINE__);
32995         uint64_t *ret_arr_ptr = (uint64_t*)(((uint8_t*)ret_arr) + 8);
32996         for (size_t o = 0; o < ret_var.datalen; o++) {
32997                 LDKMonitorEvent *ret_conv_14_copy = MALLOC(sizeof(LDKMonitorEvent), "LDKMonitorEvent");
32998                 *ret_conv_14_copy = ret_var.data[o];
32999                 uint64_t ret_conv_14_ref = tag_ptr(ret_conv_14_copy, true);
33000                 ret_arr_ptr[o] = ret_conv_14_ref;
33001         }
33002         
33003         FREE(ret_var.data);
33004         return ret_arr;
33005 }
33006
33007 void  __attribute__((export_name("TS_ChannelMonitor_process_pending_events"))) TS_ChannelMonitor_process_pending_events(uint64_t this_arg, uint64_t handler) {
33008         LDKChannelMonitor this_arg_conv;
33009         this_arg_conv.inner = untag_ptr(this_arg);
33010         this_arg_conv.is_owned = ptr_is_owned(this_arg);
33011         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
33012         this_arg_conv.is_owned = false;
33013         void* handler_ptr = untag_ptr(handler);
33014         if (ptr_is_owned(handler)) { CHECK_ACCESS(handler_ptr); }
33015         LDKEventHandler* handler_conv = (LDKEventHandler*)handler_ptr;
33016         ChannelMonitor_process_pending_events(&this_arg_conv, handler_conv);
33017 }
33018
33019 uint64_t  __attribute__((export_name("TS_ChannelMonitor_initial_counterparty_commitment_tx"))) TS_ChannelMonitor_initial_counterparty_commitment_tx(uint64_t this_arg) {
33020         LDKChannelMonitor this_arg_conv;
33021         this_arg_conv.inner = untag_ptr(this_arg);
33022         this_arg_conv.is_owned = ptr_is_owned(this_arg);
33023         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
33024         this_arg_conv.is_owned = false;
33025         LDKCommitmentTransaction ret_var = ChannelMonitor_initial_counterparty_commitment_tx(&this_arg_conv);
33026         uint64_t ret_ref = 0;
33027         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
33028         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
33029         return ret_ref;
33030 }
33031
33032 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) {
33033         LDKChannelMonitor this_arg_conv;
33034         this_arg_conv.inner = untag_ptr(this_arg);
33035         this_arg_conv.is_owned = ptr_is_owned(this_arg);
33036         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
33037         this_arg_conv.is_owned = false;
33038         LDKChannelMonitorUpdate update_conv;
33039         update_conv.inner = untag_ptr(update);
33040         update_conv.is_owned = ptr_is_owned(update);
33041         CHECK_INNER_FIELD_ACCESS_OR_NULL(update_conv);
33042         update_conv.is_owned = false;
33043         LDKCVec_CommitmentTransactionZ ret_var = ChannelMonitor_counterparty_commitment_txs_from_update(&this_arg_conv, &update_conv);
33044         uint64_tArray ret_arr = NULL;
33045         ret_arr = init_uint64_tArray(ret_var.datalen, __LINE__);
33046         uint64_t *ret_arr_ptr = (uint64_t*)(((uint8_t*)ret_arr) + 8);
33047         for (size_t x = 0; x < ret_var.datalen; x++) {
33048                 LDKCommitmentTransaction ret_conv_23_var = ret_var.data[x];
33049                 uint64_t ret_conv_23_ref = 0;
33050                 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_conv_23_var);
33051                 ret_conv_23_ref = tag_ptr(ret_conv_23_var.inner, ret_conv_23_var.is_owned);
33052                 ret_arr_ptr[x] = ret_conv_23_ref;
33053         }
33054         
33055         FREE(ret_var.data);
33056         return ret_arr;
33057 }
33058
33059 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) {
33060         LDKChannelMonitor this_arg_conv;
33061         this_arg_conv.inner = untag_ptr(this_arg);
33062         this_arg_conv.is_owned = ptr_is_owned(this_arg);
33063         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
33064         this_arg_conv.is_owned = false;
33065         LDKTransaction justice_tx_ref;
33066         justice_tx_ref.datalen = justice_tx->arr_len;
33067         justice_tx_ref.data = MALLOC(justice_tx_ref.datalen, "LDKTransaction Bytes");
33068         memcpy(justice_tx_ref.data, justice_tx->elems, justice_tx_ref.datalen); FREE(justice_tx);
33069         justice_tx_ref.data_is_owned = true;
33070         LDKCResult_TransactionNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_TransactionNoneZ), "LDKCResult_TransactionNoneZ");
33071         *ret_conv = ChannelMonitor_sign_to_local_justice_tx(&this_arg_conv, justice_tx_ref, input_idx, value, commitment_number);
33072         return tag_ptr(ret_conv, true);
33073 }
33074
33075 int8_tArray  __attribute__((export_name("TS_ChannelMonitor_get_counterparty_node_id"))) TS_ChannelMonitor_get_counterparty_node_id(uint64_t this_arg) {
33076         LDKChannelMonitor this_arg_conv;
33077         this_arg_conv.inner = untag_ptr(this_arg);
33078         this_arg_conv.is_owned = ptr_is_owned(this_arg);
33079         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
33080         this_arg_conv.is_owned = false;
33081         int8_tArray ret_arr = init_int8_tArray(33, __LINE__);
33082         memcpy(ret_arr->elems, ChannelMonitor_get_counterparty_node_id(&this_arg_conv).compressed_form, 33);
33083         return ret_arr;
33084 }
33085
33086 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) {
33087         LDKChannelMonitor this_arg_conv;
33088         this_arg_conv.inner = untag_ptr(this_arg);
33089         this_arg_conv.is_owned = ptr_is_owned(this_arg);
33090         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
33091         this_arg_conv.is_owned = false;
33092         void* logger_ptr = untag_ptr(logger);
33093         if (ptr_is_owned(logger)) { CHECK_ACCESS(logger_ptr); }
33094         LDKLogger* logger_conv = (LDKLogger*)logger_ptr;
33095         LDKCVec_TransactionZ ret_var = ChannelMonitor_get_latest_holder_commitment_txn(&this_arg_conv, logger_conv);
33096         ptrArray ret_arr = NULL;
33097         ret_arr = init_ptrArray(ret_var.datalen, __LINE__);
33098         int8_tArray *ret_arr_ptr = (int8_tArray*)(((uint8_t*)ret_arr) + 8);
33099         for (size_t m = 0; m < ret_var.datalen; m++) {
33100                 LDKTransaction ret_conv_12_var = ret_var.data[m];
33101                 int8_tArray ret_conv_12_arr = init_int8_tArray(ret_conv_12_var.datalen, __LINE__);
33102                 memcpy(ret_conv_12_arr->elems, ret_conv_12_var.data, ret_conv_12_var.datalen);
33103                 Transaction_free(ret_conv_12_var);
33104                 ret_arr_ptr[m] = ret_conv_12_arr;
33105         }
33106         
33107         FREE(ret_var.data);
33108         return ret_arr;
33109 }
33110
33111 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) {
33112         LDKChannelMonitor this_arg_conv;
33113         this_arg_conv.inner = untag_ptr(this_arg);
33114         this_arg_conv.is_owned = ptr_is_owned(this_arg);
33115         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
33116         this_arg_conv.is_owned = false;
33117         uint8_t header_arr[80];
33118         CHECK(header->arr_len == 80);
33119         memcpy(header_arr, header->elems, 80); FREE(header);
33120         uint8_t (*header_ref)[80] = &header_arr;
33121         LDKCVec_C2Tuple_usizeTransactionZZ txdata_constr;
33122         txdata_constr.datalen = txdata->arr_len;
33123         if (txdata_constr.datalen > 0)
33124                 txdata_constr.data = MALLOC(txdata_constr.datalen * sizeof(LDKC2Tuple_usizeTransactionZ), "LDKCVec_C2Tuple_usizeTransactionZZ Elements");
33125         else
33126                 txdata_constr.data = NULL;
33127         uint64_t* txdata_vals = txdata->elems;
33128         for (size_t c = 0; c < txdata_constr.datalen; c++) {
33129                 uint64_t txdata_conv_28 = txdata_vals[c];
33130                 void* txdata_conv_28_ptr = untag_ptr(txdata_conv_28);
33131                 CHECK_ACCESS(txdata_conv_28_ptr);
33132                 LDKC2Tuple_usizeTransactionZ txdata_conv_28_conv = *(LDKC2Tuple_usizeTransactionZ*)(txdata_conv_28_ptr);
33133                 txdata_conv_28_conv = C2Tuple_usizeTransactionZ_clone((LDKC2Tuple_usizeTransactionZ*)untag_ptr(txdata_conv_28));
33134                 txdata_constr.data[c] = txdata_conv_28_conv;
33135         }
33136         FREE(txdata);
33137         void* broadcaster_ptr = untag_ptr(broadcaster);
33138         CHECK_ACCESS(broadcaster_ptr);
33139         LDKBroadcasterInterface broadcaster_conv = *(LDKBroadcasterInterface*)(broadcaster_ptr);
33140         if (broadcaster_conv.free == LDKBroadcasterInterface_JCalls_free) {
33141                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
33142                 LDKBroadcasterInterface_JCalls_cloned(&broadcaster_conv);
33143         }
33144         void* fee_estimator_ptr = untag_ptr(fee_estimator);
33145         CHECK_ACCESS(fee_estimator_ptr);
33146         LDKFeeEstimator fee_estimator_conv = *(LDKFeeEstimator*)(fee_estimator_ptr);
33147         if (fee_estimator_conv.free == LDKFeeEstimator_JCalls_free) {
33148                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
33149                 LDKFeeEstimator_JCalls_cloned(&fee_estimator_conv);
33150         }
33151         void* logger_ptr = untag_ptr(logger);
33152         CHECK_ACCESS(logger_ptr);
33153         LDKLogger logger_conv = *(LDKLogger*)(logger_ptr);
33154         if (logger_conv.free == LDKLogger_JCalls_free) {
33155                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
33156                 LDKLogger_JCalls_cloned(&logger_conv);
33157         }
33158         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);
33159         uint64_tArray ret_arr = NULL;
33160         ret_arr = init_uint64_tArray(ret_var.datalen, __LINE__);
33161         uint64_t *ret_arr_ptr = (uint64_t*)(((uint8_t*)ret_arr) + 8);
33162         for (size_t x = 0; x < ret_var.datalen; x++) {
33163                 LDKC2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32TxOutZZZ* ret_conv_49_conv = MALLOC(sizeof(LDKC2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32TxOutZZZ), "LDKC2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32TxOutZZZ");
33164                 *ret_conv_49_conv = ret_var.data[x];
33165                 ret_arr_ptr[x] = tag_ptr(ret_conv_49_conv, true);
33166         }
33167         
33168         FREE(ret_var.data);
33169         return ret_arr;
33170 }
33171
33172 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) {
33173         LDKChannelMonitor this_arg_conv;
33174         this_arg_conv.inner = untag_ptr(this_arg);
33175         this_arg_conv.is_owned = ptr_is_owned(this_arg);
33176         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
33177         this_arg_conv.is_owned = false;
33178         uint8_t header_arr[80];
33179         CHECK(header->arr_len == 80);
33180         memcpy(header_arr, header->elems, 80); FREE(header);
33181         uint8_t (*header_ref)[80] = &header_arr;
33182         void* broadcaster_ptr = untag_ptr(broadcaster);
33183         CHECK_ACCESS(broadcaster_ptr);
33184         LDKBroadcasterInterface broadcaster_conv = *(LDKBroadcasterInterface*)(broadcaster_ptr);
33185         if (broadcaster_conv.free == LDKBroadcasterInterface_JCalls_free) {
33186                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
33187                 LDKBroadcasterInterface_JCalls_cloned(&broadcaster_conv);
33188         }
33189         void* fee_estimator_ptr = untag_ptr(fee_estimator);
33190         CHECK_ACCESS(fee_estimator_ptr);
33191         LDKFeeEstimator fee_estimator_conv = *(LDKFeeEstimator*)(fee_estimator_ptr);
33192         if (fee_estimator_conv.free == LDKFeeEstimator_JCalls_free) {
33193                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
33194                 LDKFeeEstimator_JCalls_cloned(&fee_estimator_conv);
33195         }
33196         void* logger_ptr = untag_ptr(logger);
33197         CHECK_ACCESS(logger_ptr);
33198         LDKLogger logger_conv = *(LDKLogger*)(logger_ptr);
33199         if (logger_conv.free == LDKLogger_JCalls_free) {
33200                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
33201                 LDKLogger_JCalls_cloned(&logger_conv);
33202         }
33203         ChannelMonitor_block_disconnected(&this_arg_conv, header_ref, height, broadcaster_conv, fee_estimator_conv, logger_conv);
33204 }
33205
33206 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) {
33207         LDKChannelMonitor this_arg_conv;
33208         this_arg_conv.inner = untag_ptr(this_arg);
33209         this_arg_conv.is_owned = ptr_is_owned(this_arg);
33210         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
33211         this_arg_conv.is_owned = false;
33212         uint8_t header_arr[80];
33213         CHECK(header->arr_len == 80);
33214         memcpy(header_arr, header->elems, 80); FREE(header);
33215         uint8_t (*header_ref)[80] = &header_arr;
33216         LDKCVec_C2Tuple_usizeTransactionZZ txdata_constr;
33217         txdata_constr.datalen = txdata->arr_len;
33218         if (txdata_constr.datalen > 0)
33219                 txdata_constr.data = MALLOC(txdata_constr.datalen * sizeof(LDKC2Tuple_usizeTransactionZ), "LDKCVec_C2Tuple_usizeTransactionZZ Elements");
33220         else
33221                 txdata_constr.data = NULL;
33222         uint64_t* txdata_vals = txdata->elems;
33223         for (size_t c = 0; c < txdata_constr.datalen; c++) {
33224                 uint64_t txdata_conv_28 = txdata_vals[c];
33225                 void* txdata_conv_28_ptr = untag_ptr(txdata_conv_28);
33226                 CHECK_ACCESS(txdata_conv_28_ptr);
33227                 LDKC2Tuple_usizeTransactionZ txdata_conv_28_conv = *(LDKC2Tuple_usizeTransactionZ*)(txdata_conv_28_ptr);
33228                 txdata_conv_28_conv = C2Tuple_usizeTransactionZ_clone((LDKC2Tuple_usizeTransactionZ*)untag_ptr(txdata_conv_28));
33229                 txdata_constr.data[c] = txdata_conv_28_conv;
33230         }
33231         FREE(txdata);
33232         void* broadcaster_ptr = untag_ptr(broadcaster);
33233         CHECK_ACCESS(broadcaster_ptr);
33234         LDKBroadcasterInterface broadcaster_conv = *(LDKBroadcasterInterface*)(broadcaster_ptr);
33235         if (broadcaster_conv.free == LDKBroadcasterInterface_JCalls_free) {
33236                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
33237                 LDKBroadcasterInterface_JCalls_cloned(&broadcaster_conv);
33238         }
33239         void* fee_estimator_ptr = untag_ptr(fee_estimator);
33240         CHECK_ACCESS(fee_estimator_ptr);
33241         LDKFeeEstimator fee_estimator_conv = *(LDKFeeEstimator*)(fee_estimator_ptr);
33242         if (fee_estimator_conv.free == LDKFeeEstimator_JCalls_free) {
33243                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
33244                 LDKFeeEstimator_JCalls_cloned(&fee_estimator_conv);
33245         }
33246         void* logger_ptr = untag_ptr(logger);
33247         CHECK_ACCESS(logger_ptr);
33248         LDKLogger logger_conv = *(LDKLogger*)(logger_ptr);
33249         if (logger_conv.free == LDKLogger_JCalls_free) {
33250                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
33251                 LDKLogger_JCalls_cloned(&logger_conv);
33252         }
33253         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);
33254         uint64_tArray ret_arr = NULL;
33255         ret_arr = init_uint64_tArray(ret_var.datalen, __LINE__);
33256         uint64_t *ret_arr_ptr = (uint64_t*)(((uint8_t*)ret_arr) + 8);
33257         for (size_t x = 0; x < ret_var.datalen; x++) {
33258                 LDKC2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32TxOutZZZ* ret_conv_49_conv = MALLOC(sizeof(LDKC2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32TxOutZZZ), "LDKC2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32TxOutZZZ");
33259                 *ret_conv_49_conv = ret_var.data[x];
33260                 ret_arr_ptr[x] = tag_ptr(ret_conv_49_conv, true);
33261         }
33262         
33263         FREE(ret_var.data);
33264         return ret_arr;
33265 }
33266
33267 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) {
33268         LDKChannelMonitor this_arg_conv;
33269         this_arg_conv.inner = untag_ptr(this_arg);
33270         this_arg_conv.is_owned = ptr_is_owned(this_arg);
33271         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
33272         this_arg_conv.is_owned = false;
33273         uint8_t txid_arr[32];
33274         CHECK(txid->arr_len == 32);
33275         memcpy(txid_arr, txid->elems, 32); FREE(txid);
33276         uint8_t (*txid_ref)[32] = &txid_arr;
33277         void* broadcaster_ptr = untag_ptr(broadcaster);
33278         CHECK_ACCESS(broadcaster_ptr);
33279         LDKBroadcasterInterface broadcaster_conv = *(LDKBroadcasterInterface*)(broadcaster_ptr);
33280         if (broadcaster_conv.free == LDKBroadcasterInterface_JCalls_free) {
33281                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
33282                 LDKBroadcasterInterface_JCalls_cloned(&broadcaster_conv);
33283         }
33284         void* fee_estimator_ptr = untag_ptr(fee_estimator);
33285         CHECK_ACCESS(fee_estimator_ptr);
33286         LDKFeeEstimator fee_estimator_conv = *(LDKFeeEstimator*)(fee_estimator_ptr);
33287         if (fee_estimator_conv.free == LDKFeeEstimator_JCalls_free) {
33288                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
33289                 LDKFeeEstimator_JCalls_cloned(&fee_estimator_conv);
33290         }
33291         void* logger_ptr = untag_ptr(logger);
33292         CHECK_ACCESS(logger_ptr);
33293         LDKLogger logger_conv = *(LDKLogger*)(logger_ptr);
33294         if (logger_conv.free == LDKLogger_JCalls_free) {
33295                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
33296                 LDKLogger_JCalls_cloned(&logger_conv);
33297         }
33298         ChannelMonitor_transaction_unconfirmed(&this_arg_conv, txid_ref, broadcaster_conv, fee_estimator_conv, logger_conv);
33299 }
33300
33301 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) {
33302         LDKChannelMonitor this_arg_conv;
33303         this_arg_conv.inner = untag_ptr(this_arg);
33304         this_arg_conv.is_owned = ptr_is_owned(this_arg);
33305         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
33306         this_arg_conv.is_owned = false;
33307         uint8_t header_arr[80];
33308         CHECK(header->arr_len == 80);
33309         memcpy(header_arr, header->elems, 80); FREE(header);
33310         uint8_t (*header_ref)[80] = &header_arr;
33311         void* broadcaster_ptr = untag_ptr(broadcaster);
33312         CHECK_ACCESS(broadcaster_ptr);
33313         LDKBroadcasterInterface broadcaster_conv = *(LDKBroadcasterInterface*)(broadcaster_ptr);
33314         if (broadcaster_conv.free == LDKBroadcasterInterface_JCalls_free) {
33315                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
33316                 LDKBroadcasterInterface_JCalls_cloned(&broadcaster_conv);
33317         }
33318         void* fee_estimator_ptr = untag_ptr(fee_estimator);
33319         CHECK_ACCESS(fee_estimator_ptr);
33320         LDKFeeEstimator fee_estimator_conv = *(LDKFeeEstimator*)(fee_estimator_ptr);
33321         if (fee_estimator_conv.free == LDKFeeEstimator_JCalls_free) {
33322                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
33323                 LDKFeeEstimator_JCalls_cloned(&fee_estimator_conv);
33324         }
33325         void* logger_ptr = untag_ptr(logger);
33326         CHECK_ACCESS(logger_ptr);
33327         LDKLogger logger_conv = *(LDKLogger*)(logger_ptr);
33328         if (logger_conv.free == LDKLogger_JCalls_free) {
33329                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
33330                 LDKLogger_JCalls_cloned(&logger_conv);
33331         }
33332         LDKCVec_C2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32TxOutZZZZ ret_var = ChannelMonitor_best_block_updated(&this_arg_conv, header_ref, height, broadcaster_conv, fee_estimator_conv, logger_conv);
33333         uint64_tArray ret_arr = NULL;
33334         ret_arr = init_uint64_tArray(ret_var.datalen, __LINE__);
33335         uint64_t *ret_arr_ptr = (uint64_t*)(((uint8_t*)ret_arr) + 8);
33336         for (size_t x = 0; x < ret_var.datalen; x++) {
33337                 LDKC2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32TxOutZZZ* ret_conv_49_conv = MALLOC(sizeof(LDKC2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32TxOutZZZ), "LDKC2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32TxOutZZZ");
33338                 *ret_conv_49_conv = ret_var.data[x];
33339                 ret_arr_ptr[x] = tag_ptr(ret_conv_49_conv, true);
33340         }
33341         
33342         FREE(ret_var.data);
33343         return ret_arr;
33344 }
33345
33346 uint64_tArray  __attribute__((export_name("TS_ChannelMonitor_get_relevant_txids"))) TS_ChannelMonitor_get_relevant_txids(uint64_t this_arg) {
33347         LDKChannelMonitor this_arg_conv;
33348         this_arg_conv.inner = untag_ptr(this_arg);
33349         this_arg_conv.is_owned = ptr_is_owned(this_arg);
33350         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
33351         this_arg_conv.is_owned = false;
33352         LDKCVec_C2Tuple_ThirtyTwoBytesCOption_ThirtyTwoBytesZZZ ret_var = ChannelMonitor_get_relevant_txids(&this_arg_conv);
33353         uint64_tArray ret_arr = NULL;
33354         ret_arr = init_uint64_tArray(ret_var.datalen, __LINE__);
33355         uint64_t *ret_arr_ptr = (uint64_t*)(((uint8_t*)ret_arr) + 8);
33356         for (size_t x = 0; x < ret_var.datalen; x++) {
33357                 LDKC2Tuple_ThirtyTwoBytesCOption_ThirtyTwoBytesZZ* ret_conv_49_conv = MALLOC(sizeof(LDKC2Tuple_ThirtyTwoBytesCOption_ThirtyTwoBytesZZ), "LDKC2Tuple_ThirtyTwoBytesCOption_ThirtyTwoBytesZZ");
33358                 *ret_conv_49_conv = ret_var.data[x];
33359                 ret_arr_ptr[x] = tag_ptr(ret_conv_49_conv, true);
33360         }
33361         
33362         FREE(ret_var.data);
33363         return ret_arr;
33364 }
33365
33366 uint64_t  __attribute__((export_name("TS_ChannelMonitor_current_best_block"))) TS_ChannelMonitor_current_best_block(uint64_t this_arg) {
33367         LDKChannelMonitor this_arg_conv;
33368         this_arg_conv.inner = untag_ptr(this_arg);
33369         this_arg_conv.is_owned = ptr_is_owned(this_arg);
33370         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
33371         this_arg_conv.is_owned = false;
33372         LDKBestBlock ret_var = ChannelMonitor_current_best_block(&this_arg_conv);
33373         uint64_t ret_ref = 0;
33374         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
33375         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
33376         return ret_ref;
33377 }
33378
33379 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) {
33380         LDKChannelMonitor this_arg_conv;
33381         this_arg_conv.inner = untag_ptr(this_arg);
33382         this_arg_conv.is_owned = ptr_is_owned(this_arg);
33383         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
33384         this_arg_conv.is_owned = false;
33385         void* broadcaster_ptr = untag_ptr(broadcaster);
33386         CHECK_ACCESS(broadcaster_ptr);
33387         LDKBroadcasterInterface broadcaster_conv = *(LDKBroadcasterInterface*)(broadcaster_ptr);
33388         if (broadcaster_conv.free == LDKBroadcasterInterface_JCalls_free) {
33389                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
33390                 LDKBroadcasterInterface_JCalls_cloned(&broadcaster_conv);
33391         }
33392         void* fee_estimator_ptr = untag_ptr(fee_estimator);
33393         CHECK_ACCESS(fee_estimator_ptr);
33394         LDKFeeEstimator fee_estimator_conv = *(LDKFeeEstimator*)(fee_estimator_ptr);
33395         if (fee_estimator_conv.free == LDKFeeEstimator_JCalls_free) {
33396                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
33397                 LDKFeeEstimator_JCalls_cloned(&fee_estimator_conv);
33398         }
33399         void* logger_ptr = untag_ptr(logger);
33400         CHECK_ACCESS(logger_ptr);
33401         LDKLogger logger_conv = *(LDKLogger*)(logger_ptr);
33402         if (logger_conv.free == LDKLogger_JCalls_free) {
33403                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
33404                 LDKLogger_JCalls_cloned(&logger_conv);
33405         }
33406         ChannelMonitor_rebroadcast_pending_claims(&this_arg_conv, broadcaster_conv, fee_estimator_conv, logger_conv);
33407 }
33408
33409 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) {
33410         LDKChannelMonitor this_arg_conv;
33411         this_arg_conv.inner = untag_ptr(this_arg);
33412         this_arg_conv.is_owned = ptr_is_owned(this_arg);
33413         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
33414         this_arg_conv.is_owned = false;
33415         LDKTransaction tx_ref;
33416         tx_ref.datalen = tx->arr_len;
33417         tx_ref.data = MALLOC(tx_ref.datalen, "LDKTransaction Bytes");
33418         memcpy(tx_ref.data, tx->elems, tx_ref.datalen); FREE(tx);
33419         tx_ref.data_is_owned = true;
33420         LDKCVec_SpendableOutputDescriptorZ ret_var = ChannelMonitor_get_spendable_outputs(&this_arg_conv, tx_ref, confirmation_height);
33421         uint64_tArray ret_arr = NULL;
33422         ret_arr = init_uint64_tArray(ret_var.datalen, __LINE__);
33423         uint64_t *ret_arr_ptr = (uint64_t*)(((uint8_t*)ret_arr) + 8);
33424         for (size_t b = 0; b < ret_var.datalen; b++) {
33425                 LDKSpendableOutputDescriptor *ret_conv_27_copy = MALLOC(sizeof(LDKSpendableOutputDescriptor), "LDKSpendableOutputDescriptor");
33426                 *ret_conv_27_copy = ret_var.data[b];
33427                 uint64_t ret_conv_27_ref = tag_ptr(ret_conv_27_copy, true);
33428                 ret_arr_ptr[b] = ret_conv_27_ref;
33429         }
33430         
33431         FREE(ret_var.data);
33432         return ret_arr;
33433 }
33434
33435 uint64_tArray  __attribute__((export_name("TS_ChannelMonitor_get_claimable_balances"))) TS_ChannelMonitor_get_claimable_balances(uint64_t this_arg) {
33436         LDKChannelMonitor this_arg_conv;
33437         this_arg_conv.inner = untag_ptr(this_arg);
33438         this_arg_conv.is_owned = ptr_is_owned(this_arg);
33439         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
33440         this_arg_conv.is_owned = false;
33441         LDKCVec_BalanceZ ret_var = ChannelMonitor_get_claimable_balances(&this_arg_conv);
33442         uint64_tArray ret_arr = NULL;
33443         ret_arr = init_uint64_tArray(ret_var.datalen, __LINE__);
33444         uint64_t *ret_arr_ptr = (uint64_t*)(((uint8_t*)ret_arr) + 8);
33445         for (size_t j = 0; j < ret_var.datalen; j++) {
33446                 LDKBalance *ret_conv_9_copy = MALLOC(sizeof(LDKBalance), "LDKBalance");
33447                 *ret_conv_9_copy = ret_var.data[j];
33448                 uint64_t ret_conv_9_ref = tag_ptr(ret_conv_9_copy, true);
33449                 ret_arr_ptr[j] = ret_conv_9_ref;
33450         }
33451         
33452         FREE(ret_var.data);
33453         return ret_arr;
33454 }
33455
33456 uint64_t  __attribute__((export_name("TS_C2Tuple_ThirtyTwoBytesChannelMonitorZ_read"))) TS_C2Tuple_ThirtyTwoBytesChannelMonitorZ_read(int8_tArray ser, uint64_t arg_a, uint64_t arg_b) {
33457         LDKu8slice ser_ref;
33458         ser_ref.datalen = ser->arr_len;
33459         ser_ref.data = ser->elems;
33460         void* arg_a_ptr = untag_ptr(arg_a);
33461         if (ptr_is_owned(arg_a)) { CHECK_ACCESS(arg_a_ptr); }
33462         LDKEntropySource* arg_a_conv = (LDKEntropySource*)arg_a_ptr;
33463         void* arg_b_ptr = untag_ptr(arg_b);
33464         if (ptr_is_owned(arg_b)) { CHECK_ACCESS(arg_b_ptr); }
33465         LDKSignerProvider* arg_b_conv = (LDKSignerProvider*)arg_b_ptr;
33466         LDKCResult_C2Tuple_ThirtyTwoBytesChannelMonitorZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_ThirtyTwoBytesChannelMonitorZDecodeErrorZ), "LDKCResult_C2Tuple_ThirtyTwoBytesChannelMonitorZDecodeErrorZ");
33467         *ret_conv = C2Tuple_ThirtyTwoBytesChannelMonitorZ_read(ser_ref, arg_a_conv, arg_b_conv);
33468         FREE(ser);
33469         return tag_ptr(ret_conv, true);
33470 }
33471
33472 void  __attribute__((export_name("TS_OutPoint_free"))) TS_OutPoint_free(uint64_t this_obj) {
33473         LDKOutPoint this_obj_conv;
33474         this_obj_conv.inner = untag_ptr(this_obj);
33475         this_obj_conv.is_owned = ptr_is_owned(this_obj);
33476         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
33477         OutPoint_free(this_obj_conv);
33478 }
33479
33480 int8_tArray  __attribute__((export_name("TS_OutPoint_get_txid"))) TS_OutPoint_get_txid(uint64_t this_ptr) {
33481         LDKOutPoint this_ptr_conv;
33482         this_ptr_conv.inner = untag_ptr(this_ptr);
33483         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
33484         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
33485         this_ptr_conv.is_owned = false;
33486         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
33487         memcpy(ret_arr->elems, *OutPoint_get_txid(&this_ptr_conv), 32);
33488         return ret_arr;
33489 }
33490
33491 void  __attribute__((export_name("TS_OutPoint_set_txid"))) TS_OutPoint_set_txid(uint64_t this_ptr, int8_tArray val) {
33492         LDKOutPoint this_ptr_conv;
33493         this_ptr_conv.inner = untag_ptr(this_ptr);
33494         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
33495         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
33496         this_ptr_conv.is_owned = false;
33497         LDKThirtyTwoBytes val_ref;
33498         CHECK(val->arr_len == 32);
33499         memcpy(val_ref.data, val->elems, 32); FREE(val);
33500         OutPoint_set_txid(&this_ptr_conv, val_ref);
33501 }
33502
33503 int16_t  __attribute__((export_name("TS_OutPoint_get_index"))) TS_OutPoint_get_index(uint64_t this_ptr) {
33504         LDKOutPoint this_ptr_conv;
33505         this_ptr_conv.inner = untag_ptr(this_ptr);
33506         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
33507         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
33508         this_ptr_conv.is_owned = false;
33509         int16_t ret_conv = OutPoint_get_index(&this_ptr_conv);
33510         return ret_conv;
33511 }
33512
33513 void  __attribute__((export_name("TS_OutPoint_set_index"))) TS_OutPoint_set_index(uint64_t this_ptr, int16_t val) {
33514         LDKOutPoint this_ptr_conv;
33515         this_ptr_conv.inner = untag_ptr(this_ptr);
33516         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
33517         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
33518         this_ptr_conv.is_owned = false;
33519         OutPoint_set_index(&this_ptr_conv, val);
33520 }
33521
33522 uint64_t  __attribute__((export_name("TS_OutPoint_new"))) TS_OutPoint_new(int8_tArray txid_arg, int16_t index_arg) {
33523         LDKThirtyTwoBytes txid_arg_ref;
33524         CHECK(txid_arg->arr_len == 32);
33525         memcpy(txid_arg_ref.data, txid_arg->elems, 32); FREE(txid_arg);
33526         LDKOutPoint ret_var = OutPoint_new(txid_arg_ref, index_arg);
33527         uint64_t ret_ref = 0;
33528         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
33529         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
33530         return ret_ref;
33531 }
33532
33533 static inline uint64_t OutPoint_clone_ptr(LDKOutPoint *NONNULL_PTR arg) {
33534         LDKOutPoint ret_var = OutPoint_clone(arg);
33535         uint64_t ret_ref = 0;
33536         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
33537         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
33538         return ret_ref;
33539 }
33540 int64_t  __attribute__((export_name("TS_OutPoint_clone_ptr"))) TS_OutPoint_clone_ptr(uint64_t arg) {
33541         LDKOutPoint arg_conv;
33542         arg_conv.inner = untag_ptr(arg);
33543         arg_conv.is_owned = ptr_is_owned(arg);
33544         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
33545         arg_conv.is_owned = false;
33546         int64_t ret_conv = OutPoint_clone_ptr(&arg_conv);
33547         return ret_conv;
33548 }
33549
33550 uint64_t  __attribute__((export_name("TS_OutPoint_clone"))) TS_OutPoint_clone(uint64_t orig) {
33551         LDKOutPoint orig_conv;
33552         orig_conv.inner = untag_ptr(orig);
33553         orig_conv.is_owned = ptr_is_owned(orig);
33554         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
33555         orig_conv.is_owned = false;
33556         LDKOutPoint ret_var = OutPoint_clone(&orig_conv);
33557         uint64_t ret_ref = 0;
33558         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
33559         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
33560         return ret_ref;
33561 }
33562
33563 jboolean  __attribute__((export_name("TS_OutPoint_eq"))) TS_OutPoint_eq(uint64_t a, uint64_t b) {
33564         LDKOutPoint a_conv;
33565         a_conv.inner = untag_ptr(a);
33566         a_conv.is_owned = ptr_is_owned(a);
33567         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
33568         a_conv.is_owned = false;
33569         LDKOutPoint b_conv;
33570         b_conv.inner = untag_ptr(b);
33571         b_conv.is_owned = ptr_is_owned(b);
33572         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
33573         b_conv.is_owned = false;
33574         jboolean ret_conv = OutPoint_eq(&a_conv, &b_conv);
33575         return ret_conv;
33576 }
33577
33578 int64_t  __attribute__((export_name("TS_OutPoint_hash"))) TS_OutPoint_hash(uint64_t o) {
33579         LDKOutPoint o_conv;
33580         o_conv.inner = untag_ptr(o);
33581         o_conv.is_owned = ptr_is_owned(o);
33582         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
33583         o_conv.is_owned = false;
33584         int64_t ret_conv = OutPoint_hash(&o_conv);
33585         return ret_conv;
33586 }
33587
33588 int8_tArray  __attribute__((export_name("TS_OutPoint_to_channel_id"))) TS_OutPoint_to_channel_id(uint64_t this_arg) {
33589         LDKOutPoint this_arg_conv;
33590         this_arg_conv.inner = untag_ptr(this_arg);
33591         this_arg_conv.is_owned = ptr_is_owned(this_arg);
33592         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
33593         this_arg_conv.is_owned = false;
33594         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
33595         memcpy(ret_arr->elems, OutPoint_to_channel_id(&this_arg_conv).data, 32);
33596         return ret_arr;
33597 }
33598
33599 int8_tArray  __attribute__((export_name("TS_OutPoint_write"))) TS_OutPoint_write(uint64_t obj) {
33600         LDKOutPoint obj_conv;
33601         obj_conv.inner = untag_ptr(obj);
33602         obj_conv.is_owned = ptr_is_owned(obj);
33603         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
33604         obj_conv.is_owned = false;
33605         LDKCVec_u8Z ret_var = OutPoint_write(&obj_conv);
33606         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
33607         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
33608         CVec_u8Z_free(ret_var);
33609         return ret_arr;
33610 }
33611
33612 uint64_t  __attribute__((export_name("TS_OutPoint_read"))) TS_OutPoint_read(int8_tArray ser) {
33613         LDKu8slice ser_ref;
33614         ser_ref.datalen = ser->arr_len;
33615         ser_ref.data = ser->elems;
33616         LDKCResult_OutPointDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_OutPointDecodeErrorZ), "LDKCResult_OutPointDecodeErrorZ");
33617         *ret_conv = OutPoint_read(ser_ref);
33618         FREE(ser);
33619         return tag_ptr(ret_conv, true);
33620 }
33621
33622 void  __attribute__((export_name("TS_FailureCode_free"))) TS_FailureCode_free(uint64_t this_ptr) {
33623         if (!ptr_is_owned(this_ptr)) return;
33624         void* this_ptr_ptr = untag_ptr(this_ptr);
33625         CHECK_ACCESS(this_ptr_ptr);
33626         LDKFailureCode this_ptr_conv = *(LDKFailureCode*)(this_ptr_ptr);
33627         FREE(untag_ptr(this_ptr));
33628         FailureCode_free(this_ptr_conv);
33629 }
33630
33631 static inline uint64_t FailureCode_clone_ptr(LDKFailureCode *NONNULL_PTR arg) {
33632         LDKFailureCode *ret_copy = MALLOC(sizeof(LDKFailureCode), "LDKFailureCode");
33633         *ret_copy = FailureCode_clone(arg);
33634         uint64_t ret_ref = tag_ptr(ret_copy, true);
33635         return ret_ref;
33636 }
33637 int64_t  __attribute__((export_name("TS_FailureCode_clone_ptr"))) TS_FailureCode_clone_ptr(uint64_t arg) {
33638         LDKFailureCode* arg_conv = (LDKFailureCode*)untag_ptr(arg);
33639         int64_t ret_conv = FailureCode_clone_ptr(arg_conv);
33640         return ret_conv;
33641 }
33642
33643 uint64_t  __attribute__((export_name("TS_FailureCode_clone"))) TS_FailureCode_clone(uint64_t orig) {
33644         LDKFailureCode* orig_conv = (LDKFailureCode*)untag_ptr(orig);
33645         LDKFailureCode *ret_copy = MALLOC(sizeof(LDKFailureCode), "LDKFailureCode");
33646         *ret_copy = FailureCode_clone(orig_conv);
33647         uint64_t ret_ref = tag_ptr(ret_copy, true);
33648         return ret_ref;
33649 }
33650
33651 uint64_t  __attribute__((export_name("TS_FailureCode_temporary_node_failure"))) TS_FailureCode_temporary_node_failure() {
33652         LDKFailureCode *ret_copy = MALLOC(sizeof(LDKFailureCode), "LDKFailureCode");
33653         *ret_copy = FailureCode_temporary_node_failure();
33654         uint64_t ret_ref = tag_ptr(ret_copy, true);
33655         return ret_ref;
33656 }
33657
33658 uint64_t  __attribute__((export_name("TS_FailureCode_required_node_feature_missing"))) TS_FailureCode_required_node_feature_missing() {
33659         LDKFailureCode *ret_copy = MALLOC(sizeof(LDKFailureCode), "LDKFailureCode");
33660         *ret_copy = FailureCode_required_node_feature_missing();
33661         uint64_t ret_ref = tag_ptr(ret_copy, true);
33662         return ret_ref;
33663 }
33664
33665 uint64_t  __attribute__((export_name("TS_FailureCode_incorrect_or_unknown_payment_details"))) TS_FailureCode_incorrect_or_unknown_payment_details() {
33666         LDKFailureCode *ret_copy = MALLOC(sizeof(LDKFailureCode), "LDKFailureCode");
33667         *ret_copy = FailureCode_incorrect_or_unknown_payment_details();
33668         uint64_t ret_ref = tag_ptr(ret_copy, true);
33669         return ret_ref;
33670 }
33671
33672 uint64_t  __attribute__((export_name("TS_FailureCode_invalid_onion_payload"))) TS_FailureCode_invalid_onion_payload(uint64_t a) {
33673         void* a_ptr = untag_ptr(a);
33674         CHECK_ACCESS(a_ptr);
33675         LDKCOption_C2Tuple_u64u16ZZ a_conv = *(LDKCOption_C2Tuple_u64u16ZZ*)(a_ptr);
33676         a_conv = COption_C2Tuple_u64u16ZZ_clone((LDKCOption_C2Tuple_u64u16ZZ*)untag_ptr(a));
33677         LDKFailureCode *ret_copy = MALLOC(sizeof(LDKFailureCode), "LDKFailureCode");
33678         *ret_copy = FailureCode_invalid_onion_payload(a_conv);
33679         uint64_t ret_ref = tag_ptr(ret_copy, true);
33680         return ret_ref;
33681 }
33682
33683 void  __attribute__((export_name("TS_ChannelManager_free"))) TS_ChannelManager_free(uint64_t this_obj) {
33684         LDKChannelManager this_obj_conv;
33685         this_obj_conv.inner = untag_ptr(this_obj);
33686         this_obj_conv.is_owned = ptr_is_owned(this_obj);
33687         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
33688         ChannelManager_free(this_obj_conv);
33689 }
33690
33691 void  __attribute__((export_name("TS_ChainParameters_free"))) TS_ChainParameters_free(uint64_t this_obj) {
33692         LDKChainParameters this_obj_conv;
33693         this_obj_conv.inner = untag_ptr(this_obj);
33694         this_obj_conv.is_owned = ptr_is_owned(this_obj);
33695         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
33696         ChainParameters_free(this_obj_conv);
33697 }
33698
33699 uint32_t  __attribute__((export_name("TS_ChainParameters_get_network"))) TS_ChainParameters_get_network(uint64_t this_ptr) {
33700         LDKChainParameters this_ptr_conv;
33701         this_ptr_conv.inner = untag_ptr(this_ptr);
33702         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
33703         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
33704         this_ptr_conv.is_owned = false;
33705         uint32_t ret_conv = LDKNetwork_to_js(ChainParameters_get_network(&this_ptr_conv));
33706         return ret_conv;
33707 }
33708
33709 void  __attribute__((export_name("TS_ChainParameters_set_network"))) TS_ChainParameters_set_network(uint64_t this_ptr, uint32_t val) {
33710         LDKChainParameters this_ptr_conv;
33711         this_ptr_conv.inner = untag_ptr(this_ptr);
33712         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
33713         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
33714         this_ptr_conv.is_owned = false;
33715         LDKNetwork val_conv = LDKNetwork_from_js(val);
33716         ChainParameters_set_network(&this_ptr_conv, val_conv);
33717 }
33718
33719 uint64_t  __attribute__((export_name("TS_ChainParameters_get_best_block"))) TS_ChainParameters_get_best_block(uint64_t this_ptr) {
33720         LDKChainParameters this_ptr_conv;
33721         this_ptr_conv.inner = untag_ptr(this_ptr);
33722         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
33723         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
33724         this_ptr_conv.is_owned = false;
33725         LDKBestBlock ret_var = ChainParameters_get_best_block(&this_ptr_conv);
33726         uint64_t ret_ref = 0;
33727         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
33728         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
33729         return ret_ref;
33730 }
33731
33732 void  __attribute__((export_name("TS_ChainParameters_set_best_block"))) TS_ChainParameters_set_best_block(uint64_t this_ptr, uint64_t val) {
33733         LDKChainParameters this_ptr_conv;
33734         this_ptr_conv.inner = untag_ptr(this_ptr);
33735         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
33736         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
33737         this_ptr_conv.is_owned = false;
33738         LDKBestBlock val_conv;
33739         val_conv.inner = untag_ptr(val);
33740         val_conv.is_owned = ptr_is_owned(val);
33741         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
33742         val_conv = BestBlock_clone(&val_conv);
33743         ChainParameters_set_best_block(&this_ptr_conv, val_conv);
33744 }
33745
33746 uint64_t  __attribute__((export_name("TS_ChainParameters_new"))) TS_ChainParameters_new(uint32_t network_arg, uint64_t best_block_arg) {
33747         LDKNetwork network_arg_conv = LDKNetwork_from_js(network_arg);
33748         LDKBestBlock best_block_arg_conv;
33749         best_block_arg_conv.inner = untag_ptr(best_block_arg);
33750         best_block_arg_conv.is_owned = ptr_is_owned(best_block_arg);
33751         CHECK_INNER_FIELD_ACCESS_OR_NULL(best_block_arg_conv);
33752         best_block_arg_conv = BestBlock_clone(&best_block_arg_conv);
33753         LDKChainParameters ret_var = ChainParameters_new(network_arg_conv, best_block_arg_conv);
33754         uint64_t ret_ref = 0;
33755         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
33756         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
33757         return ret_ref;
33758 }
33759
33760 static inline uint64_t ChainParameters_clone_ptr(LDKChainParameters *NONNULL_PTR arg) {
33761         LDKChainParameters ret_var = ChainParameters_clone(arg);
33762         uint64_t ret_ref = 0;
33763         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
33764         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
33765         return ret_ref;
33766 }
33767 int64_t  __attribute__((export_name("TS_ChainParameters_clone_ptr"))) TS_ChainParameters_clone_ptr(uint64_t arg) {
33768         LDKChainParameters arg_conv;
33769         arg_conv.inner = untag_ptr(arg);
33770         arg_conv.is_owned = ptr_is_owned(arg);
33771         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
33772         arg_conv.is_owned = false;
33773         int64_t ret_conv = ChainParameters_clone_ptr(&arg_conv);
33774         return ret_conv;
33775 }
33776
33777 uint64_t  __attribute__((export_name("TS_ChainParameters_clone"))) TS_ChainParameters_clone(uint64_t orig) {
33778         LDKChainParameters orig_conv;
33779         orig_conv.inner = untag_ptr(orig);
33780         orig_conv.is_owned = ptr_is_owned(orig);
33781         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
33782         orig_conv.is_owned = false;
33783         LDKChainParameters ret_var = ChainParameters_clone(&orig_conv);
33784         uint64_t ret_ref = 0;
33785         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
33786         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
33787         return ret_ref;
33788 }
33789
33790 void  __attribute__((export_name("TS_CounterpartyForwardingInfo_free"))) TS_CounterpartyForwardingInfo_free(uint64_t this_obj) {
33791         LDKCounterpartyForwardingInfo this_obj_conv;
33792         this_obj_conv.inner = untag_ptr(this_obj);
33793         this_obj_conv.is_owned = ptr_is_owned(this_obj);
33794         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
33795         CounterpartyForwardingInfo_free(this_obj_conv);
33796 }
33797
33798 int32_t  __attribute__((export_name("TS_CounterpartyForwardingInfo_get_fee_base_msat"))) TS_CounterpartyForwardingInfo_get_fee_base_msat(uint64_t this_ptr) {
33799         LDKCounterpartyForwardingInfo this_ptr_conv;
33800         this_ptr_conv.inner = untag_ptr(this_ptr);
33801         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
33802         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
33803         this_ptr_conv.is_owned = false;
33804         int32_t ret_conv = CounterpartyForwardingInfo_get_fee_base_msat(&this_ptr_conv);
33805         return ret_conv;
33806 }
33807
33808 void  __attribute__((export_name("TS_CounterpartyForwardingInfo_set_fee_base_msat"))) TS_CounterpartyForwardingInfo_set_fee_base_msat(uint64_t this_ptr, int32_t val) {
33809         LDKCounterpartyForwardingInfo this_ptr_conv;
33810         this_ptr_conv.inner = untag_ptr(this_ptr);
33811         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
33812         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
33813         this_ptr_conv.is_owned = false;
33814         CounterpartyForwardingInfo_set_fee_base_msat(&this_ptr_conv, val);
33815 }
33816
33817 int32_t  __attribute__((export_name("TS_CounterpartyForwardingInfo_get_fee_proportional_millionths"))) TS_CounterpartyForwardingInfo_get_fee_proportional_millionths(uint64_t this_ptr) {
33818         LDKCounterpartyForwardingInfo this_ptr_conv;
33819         this_ptr_conv.inner = untag_ptr(this_ptr);
33820         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
33821         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
33822         this_ptr_conv.is_owned = false;
33823         int32_t ret_conv = CounterpartyForwardingInfo_get_fee_proportional_millionths(&this_ptr_conv);
33824         return ret_conv;
33825 }
33826
33827 void  __attribute__((export_name("TS_CounterpartyForwardingInfo_set_fee_proportional_millionths"))) TS_CounterpartyForwardingInfo_set_fee_proportional_millionths(uint64_t this_ptr, int32_t val) {
33828         LDKCounterpartyForwardingInfo this_ptr_conv;
33829         this_ptr_conv.inner = untag_ptr(this_ptr);
33830         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
33831         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
33832         this_ptr_conv.is_owned = false;
33833         CounterpartyForwardingInfo_set_fee_proportional_millionths(&this_ptr_conv, val);
33834 }
33835
33836 int16_t  __attribute__((export_name("TS_CounterpartyForwardingInfo_get_cltv_expiry_delta"))) TS_CounterpartyForwardingInfo_get_cltv_expiry_delta(uint64_t this_ptr) {
33837         LDKCounterpartyForwardingInfo this_ptr_conv;
33838         this_ptr_conv.inner = untag_ptr(this_ptr);
33839         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
33840         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
33841         this_ptr_conv.is_owned = false;
33842         int16_t ret_conv = CounterpartyForwardingInfo_get_cltv_expiry_delta(&this_ptr_conv);
33843         return ret_conv;
33844 }
33845
33846 void  __attribute__((export_name("TS_CounterpartyForwardingInfo_set_cltv_expiry_delta"))) TS_CounterpartyForwardingInfo_set_cltv_expiry_delta(uint64_t this_ptr, int16_t val) {
33847         LDKCounterpartyForwardingInfo this_ptr_conv;
33848         this_ptr_conv.inner = untag_ptr(this_ptr);
33849         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
33850         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
33851         this_ptr_conv.is_owned = false;
33852         CounterpartyForwardingInfo_set_cltv_expiry_delta(&this_ptr_conv, val);
33853 }
33854
33855 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) {
33856         LDKCounterpartyForwardingInfo ret_var = CounterpartyForwardingInfo_new(fee_base_msat_arg, fee_proportional_millionths_arg, cltv_expiry_delta_arg);
33857         uint64_t ret_ref = 0;
33858         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
33859         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
33860         return ret_ref;
33861 }
33862
33863 static inline uint64_t CounterpartyForwardingInfo_clone_ptr(LDKCounterpartyForwardingInfo *NONNULL_PTR arg) {
33864         LDKCounterpartyForwardingInfo ret_var = CounterpartyForwardingInfo_clone(arg);
33865         uint64_t ret_ref = 0;
33866         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
33867         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
33868         return ret_ref;
33869 }
33870 int64_t  __attribute__((export_name("TS_CounterpartyForwardingInfo_clone_ptr"))) TS_CounterpartyForwardingInfo_clone_ptr(uint64_t arg) {
33871         LDKCounterpartyForwardingInfo arg_conv;
33872         arg_conv.inner = untag_ptr(arg);
33873         arg_conv.is_owned = ptr_is_owned(arg);
33874         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
33875         arg_conv.is_owned = false;
33876         int64_t ret_conv = CounterpartyForwardingInfo_clone_ptr(&arg_conv);
33877         return ret_conv;
33878 }
33879
33880 uint64_t  __attribute__((export_name("TS_CounterpartyForwardingInfo_clone"))) TS_CounterpartyForwardingInfo_clone(uint64_t orig) {
33881         LDKCounterpartyForwardingInfo orig_conv;
33882         orig_conv.inner = untag_ptr(orig);
33883         orig_conv.is_owned = ptr_is_owned(orig);
33884         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
33885         orig_conv.is_owned = false;
33886         LDKCounterpartyForwardingInfo ret_var = CounterpartyForwardingInfo_clone(&orig_conv);
33887         uint64_t ret_ref = 0;
33888         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
33889         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
33890         return ret_ref;
33891 }
33892
33893 void  __attribute__((export_name("TS_ChannelCounterparty_free"))) TS_ChannelCounterparty_free(uint64_t this_obj) {
33894         LDKChannelCounterparty this_obj_conv;
33895         this_obj_conv.inner = untag_ptr(this_obj);
33896         this_obj_conv.is_owned = ptr_is_owned(this_obj);
33897         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
33898         ChannelCounterparty_free(this_obj_conv);
33899 }
33900
33901 int8_tArray  __attribute__((export_name("TS_ChannelCounterparty_get_node_id"))) TS_ChannelCounterparty_get_node_id(uint64_t this_ptr) {
33902         LDKChannelCounterparty this_ptr_conv;
33903         this_ptr_conv.inner = untag_ptr(this_ptr);
33904         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
33905         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
33906         this_ptr_conv.is_owned = false;
33907         int8_tArray ret_arr = init_int8_tArray(33, __LINE__);
33908         memcpy(ret_arr->elems, ChannelCounterparty_get_node_id(&this_ptr_conv).compressed_form, 33);
33909         return ret_arr;
33910 }
33911
33912 void  __attribute__((export_name("TS_ChannelCounterparty_set_node_id"))) TS_ChannelCounterparty_set_node_id(uint64_t this_ptr, int8_tArray val) {
33913         LDKChannelCounterparty this_ptr_conv;
33914         this_ptr_conv.inner = untag_ptr(this_ptr);
33915         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
33916         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
33917         this_ptr_conv.is_owned = false;
33918         LDKPublicKey val_ref;
33919         CHECK(val->arr_len == 33);
33920         memcpy(val_ref.compressed_form, val->elems, 33); FREE(val);
33921         ChannelCounterparty_set_node_id(&this_ptr_conv, val_ref);
33922 }
33923
33924 uint64_t  __attribute__((export_name("TS_ChannelCounterparty_get_features"))) TS_ChannelCounterparty_get_features(uint64_t this_ptr) {
33925         LDKChannelCounterparty this_ptr_conv;
33926         this_ptr_conv.inner = untag_ptr(this_ptr);
33927         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
33928         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
33929         this_ptr_conv.is_owned = false;
33930         LDKInitFeatures ret_var = ChannelCounterparty_get_features(&this_ptr_conv);
33931         uint64_t ret_ref = 0;
33932         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
33933         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
33934         return ret_ref;
33935 }
33936
33937 void  __attribute__((export_name("TS_ChannelCounterparty_set_features"))) TS_ChannelCounterparty_set_features(uint64_t this_ptr, uint64_t val) {
33938         LDKChannelCounterparty this_ptr_conv;
33939         this_ptr_conv.inner = untag_ptr(this_ptr);
33940         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
33941         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
33942         this_ptr_conv.is_owned = false;
33943         LDKInitFeatures val_conv;
33944         val_conv.inner = untag_ptr(val);
33945         val_conv.is_owned = ptr_is_owned(val);
33946         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
33947         val_conv = InitFeatures_clone(&val_conv);
33948         ChannelCounterparty_set_features(&this_ptr_conv, val_conv);
33949 }
33950
33951 int64_t  __attribute__((export_name("TS_ChannelCounterparty_get_unspendable_punishment_reserve"))) TS_ChannelCounterparty_get_unspendable_punishment_reserve(uint64_t this_ptr) {
33952         LDKChannelCounterparty this_ptr_conv;
33953         this_ptr_conv.inner = untag_ptr(this_ptr);
33954         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
33955         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
33956         this_ptr_conv.is_owned = false;
33957         int64_t ret_conv = ChannelCounterparty_get_unspendable_punishment_reserve(&this_ptr_conv);
33958         return ret_conv;
33959 }
33960
33961 void  __attribute__((export_name("TS_ChannelCounterparty_set_unspendable_punishment_reserve"))) TS_ChannelCounterparty_set_unspendable_punishment_reserve(uint64_t this_ptr, int64_t val) {
33962         LDKChannelCounterparty this_ptr_conv;
33963         this_ptr_conv.inner = untag_ptr(this_ptr);
33964         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
33965         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
33966         this_ptr_conv.is_owned = false;
33967         ChannelCounterparty_set_unspendable_punishment_reserve(&this_ptr_conv, val);
33968 }
33969
33970 uint64_t  __attribute__((export_name("TS_ChannelCounterparty_get_forwarding_info"))) TS_ChannelCounterparty_get_forwarding_info(uint64_t this_ptr) {
33971         LDKChannelCounterparty this_ptr_conv;
33972         this_ptr_conv.inner = untag_ptr(this_ptr);
33973         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
33974         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
33975         this_ptr_conv.is_owned = false;
33976         LDKCounterpartyForwardingInfo ret_var = ChannelCounterparty_get_forwarding_info(&this_ptr_conv);
33977         uint64_t ret_ref = 0;
33978         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
33979         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
33980         return ret_ref;
33981 }
33982
33983 void  __attribute__((export_name("TS_ChannelCounterparty_set_forwarding_info"))) TS_ChannelCounterparty_set_forwarding_info(uint64_t this_ptr, uint64_t val) {
33984         LDKChannelCounterparty this_ptr_conv;
33985         this_ptr_conv.inner = untag_ptr(this_ptr);
33986         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
33987         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
33988         this_ptr_conv.is_owned = false;
33989         LDKCounterpartyForwardingInfo val_conv;
33990         val_conv.inner = untag_ptr(val);
33991         val_conv.is_owned = ptr_is_owned(val);
33992         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
33993         val_conv = CounterpartyForwardingInfo_clone(&val_conv);
33994         ChannelCounterparty_set_forwarding_info(&this_ptr_conv, val_conv);
33995 }
33996
33997 uint64_t  __attribute__((export_name("TS_ChannelCounterparty_get_outbound_htlc_minimum_msat"))) TS_ChannelCounterparty_get_outbound_htlc_minimum_msat(uint64_t this_ptr) {
33998         LDKChannelCounterparty this_ptr_conv;
33999         this_ptr_conv.inner = untag_ptr(this_ptr);
34000         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
34001         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
34002         this_ptr_conv.is_owned = false;
34003         LDKCOption_u64Z *ret_copy = MALLOC(sizeof(LDKCOption_u64Z), "LDKCOption_u64Z");
34004         *ret_copy = ChannelCounterparty_get_outbound_htlc_minimum_msat(&this_ptr_conv);
34005         uint64_t ret_ref = tag_ptr(ret_copy, true);
34006         return ret_ref;
34007 }
34008
34009 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) {
34010         LDKChannelCounterparty this_ptr_conv;
34011         this_ptr_conv.inner = untag_ptr(this_ptr);
34012         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
34013         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
34014         this_ptr_conv.is_owned = false;
34015         void* val_ptr = untag_ptr(val);
34016         CHECK_ACCESS(val_ptr);
34017         LDKCOption_u64Z val_conv = *(LDKCOption_u64Z*)(val_ptr);
34018         val_conv = COption_u64Z_clone((LDKCOption_u64Z*)untag_ptr(val));
34019         ChannelCounterparty_set_outbound_htlc_minimum_msat(&this_ptr_conv, val_conv);
34020 }
34021
34022 uint64_t  __attribute__((export_name("TS_ChannelCounterparty_get_outbound_htlc_maximum_msat"))) TS_ChannelCounterparty_get_outbound_htlc_maximum_msat(uint64_t this_ptr) {
34023         LDKChannelCounterparty this_ptr_conv;
34024         this_ptr_conv.inner = untag_ptr(this_ptr);
34025         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
34026         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
34027         this_ptr_conv.is_owned = false;
34028         LDKCOption_u64Z *ret_copy = MALLOC(sizeof(LDKCOption_u64Z), "LDKCOption_u64Z");
34029         *ret_copy = ChannelCounterparty_get_outbound_htlc_maximum_msat(&this_ptr_conv);
34030         uint64_t ret_ref = tag_ptr(ret_copy, true);
34031         return ret_ref;
34032 }
34033
34034 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) {
34035         LDKChannelCounterparty this_ptr_conv;
34036         this_ptr_conv.inner = untag_ptr(this_ptr);
34037         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
34038         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
34039         this_ptr_conv.is_owned = false;
34040         void* val_ptr = untag_ptr(val);
34041         CHECK_ACCESS(val_ptr);
34042         LDKCOption_u64Z val_conv = *(LDKCOption_u64Z*)(val_ptr);
34043         val_conv = COption_u64Z_clone((LDKCOption_u64Z*)untag_ptr(val));
34044         ChannelCounterparty_set_outbound_htlc_maximum_msat(&this_ptr_conv, val_conv);
34045 }
34046
34047 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) {
34048         LDKPublicKey node_id_arg_ref;
34049         CHECK(node_id_arg->arr_len == 33);
34050         memcpy(node_id_arg_ref.compressed_form, node_id_arg->elems, 33); FREE(node_id_arg);
34051         LDKInitFeatures features_arg_conv;
34052         features_arg_conv.inner = untag_ptr(features_arg);
34053         features_arg_conv.is_owned = ptr_is_owned(features_arg);
34054         CHECK_INNER_FIELD_ACCESS_OR_NULL(features_arg_conv);
34055         features_arg_conv = InitFeatures_clone(&features_arg_conv);
34056         LDKCounterpartyForwardingInfo forwarding_info_arg_conv;
34057         forwarding_info_arg_conv.inner = untag_ptr(forwarding_info_arg);
34058         forwarding_info_arg_conv.is_owned = ptr_is_owned(forwarding_info_arg);
34059         CHECK_INNER_FIELD_ACCESS_OR_NULL(forwarding_info_arg_conv);
34060         forwarding_info_arg_conv = CounterpartyForwardingInfo_clone(&forwarding_info_arg_conv);
34061         void* outbound_htlc_minimum_msat_arg_ptr = untag_ptr(outbound_htlc_minimum_msat_arg);
34062         CHECK_ACCESS(outbound_htlc_minimum_msat_arg_ptr);
34063         LDKCOption_u64Z outbound_htlc_minimum_msat_arg_conv = *(LDKCOption_u64Z*)(outbound_htlc_minimum_msat_arg_ptr);
34064         outbound_htlc_minimum_msat_arg_conv = COption_u64Z_clone((LDKCOption_u64Z*)untag_ptr(outbound_htlc_minimum_msat_arg));
34065         void* outbound_htlc_maximum_msat_arg_ptr = untag_ptr(outbound_htlc_maximum_msat_arg);
34066         CHECK_ACCESS(outbound_htlc_maximum_msat_arg_ptr);
34067         LDKCOption_u64Z outbound_htlc_maximum_msat_arg_conv = *(LDKCOption_u64Z*)(outbound_htlc_maximum_msat_arg_ptr);
34068         outbound_htlc_maximum_msat_arg_conv = COption_u64Z_clone((LDKCOption_u64Z*)untag_ptr(outbound_htlc_maximum_msat_arg));
34069         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);
34070         uint64_t ret_ref = 0;
34071         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
34072         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
34073         return ret_ref;
34074 }
34075
34076 static inline uint64_t ChannelCounterparty_clone_ptr(LDKChannelCounterparty *NONNULL_PTR arg) {
34077         LDKChannelCounterparty ret_var = ChannelCounterparty_clone(arg);
34078         uint64_t ret_ref = 0;
34079         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
34080         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
34081         return ret_ref;
34082 }
34083 int64_t  __attribute__((export_name("TS_ChannelCounterparty_clone_ptr"))) TS_ChannelCounterparty_clone_ptr(uint64_t arg) {
34084         LDKChannelCounterparty arg_conv;
34085         arg_conv.inner = untag_ptr(arg);
34086         arg_conv.is_owned = ptr_is_owned(arg);
34087         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
34088         arg_conv.is_owned = false;
34089         int64_t ret_conv = ChannelCounterparty_clone_ptr(&arg_conv);
34090         return ret_conv;
34091 }
34092
34093 uint64_t  __attribute__((export_name("TS_ChannelCounterparty_clone"))) TS_ChannelCounterparty_clone(uint64_t orig) {
34094         LDKChannelCounterparty orig_conv;
34095         orig_conv.inner = untag_ptr(orig);
34096         orig_conv.is_owned = ptr_is_owned(orig);
34097         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
34098         orig_conv.is_owned = false;
34099         LDKChannelCounterparty ret_var = ChannelCounterparty_clone(&orig_conv);
34100         uint64_t ret_ref = 0;
34101         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
34102         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
34103         return ret_ref;
34104 }
34105
34106 void  __attribute__((export_name("TS_ChannelDetails_free"))) TS_ChannelDetails_free(uint64_t this_obj) {
34107         LDKChannelDetails this_obj_conv;
34108         this_obj_conv.inner = untag_ptr(this_obj);
34109         this_obj_conv.is_owned = ptr_is_owned(this_obj);
34110         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
34111         ChannelDetails_free(this_obj_conv);
34112 }
34113
34114 int8_tArray  __attribute__((export_name("TS_ChannelDetails_get_channel_id"))) TS_ChannelDetails_get_channel_id(uint64_t this_ptr) {
34115         LDKChannelDetails this_ptr_conv;
34116         this_ptr_conv.inner = untag_ptr(this_ptr);
34117         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
34118         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
34119         this_ptr_conv.is_owned = false;
34120         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
34121         memcpy(ret_arr->elems, *ChannelDetails_get_channel_id(&this_ptr_conv), 32);
34122         return ret_arr;
34123 }
34124
34125 void  __attribute__((export_name("TS_ChannelDetails_set_channel_id"))) TS_ChannelDetails_set_channel_id(uint64_t this_ptr, int8_tArray val) {
34126         LDKChannelDetails this_ptr_conv;
34127         this_ptr_conv.inner = untag_ptr(this_ptr);
34128         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
34129         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
34130         this_ptr_conv.is_owned = false;
34131         LDKThirtyTwoBytes val_ref;
34132         CHECK(val->arr_len == 32);
34133         memcpy(val_ref.data, val->elems, 32); FREE(val);
34134         ChannelDetails_set_channel_id(&this_ptr_conv, val_ref);
34135 }
34136
34137 uint64_t  __attribute__((export_name("TS_ChannelDetails_get_counterparty"))) TS_ChannelDetails_get_counterparty(uint64_t this_ptr) {
34138         LDKChannelDetails this_ptr_conv;
34139         this_ptr_conv.inner = untag_ptr(this_ptr);
34140         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
34141         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
34142         this_ptr_conv.is_owned = false;
34143         LDKChannelCounterparty ret_var = ChannelDetails_get_counterparty(&this_ptr_conv);
34144         uint64_t ret_ref = 0;
34145         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
34146         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
34147         return ret_ref;
34148 }
34149
34150 void  __attribute__((export_name("TS_ChannelDetails_set_counterparty"))) TS_ChannelDetails_set_counterparty(uint64_t this_ptr, uint64_t val) {
34151         LDKChannelDetails this_ptr_conv;
34152         this_ptr_conv.inner = untag_ptr(this_ptr);
34153         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
34154         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
34155         this_ptr_conv.is_owned = false;
34156         LDKChannelCounterparty val_conv;
34157         val_conv.inner = untag_ptr(val);
34158         val_conv.is_owned = ptr_is_owned(val);
34159         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
34160         val_conv = ChannelCounterparty_clone(&val_conv);
34161         ChannelDetails_set_counterparty(&this_ptr_conv, val_conv);
34162 }
34163
34164 uint64_t  __attribute__((export_name("TS_ChannelDetails_get_funding_txo"))) TS_ChannelDetails_get_funding_txo(uint64_t this_ptr) {
34165         LDKChannelDetails this_ptr_conv;
34166         this_ptr_conv.inner = untag_ptr(this_ptr);
34167         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
34168         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
34169         this_ptr_conv.is_owned = false;
34170         LDKOutPoint ret_var = ChannelDetails_get_funding_txo(&this_ptr_conv);
34171         uint64_t ret_ref = 0;
34172         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
34173         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
34174         return ret_ref;
34175 }
34176
34177 void  __attribute__((export_name("TS_ChannelDetails_set_funding_txo"))) TS_ChannelDetails_set_funding_txo(uint64_t this_ptr, uint64_t val) {
34178         LDKChannelDetails this_ptr_conv;
34179         this_ptr_conv.inner = untag_ptr(this_ptr);
34180         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
34181         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
34182         this_ptr_conv.is_owned = false;
34183         LDKOutPoint val_conv;
34184         val_conv.inner = untag_ptr(val);
34185         val_conv.is_owned = ptr_is_owned(val);
34186         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
34187         val_conv = OutPoint_clone(&val_conv);
34188         ChannelDetails_set_funding_txo(&this_ptr_conv, val_conv);
34189 }
34190
34191 uint64_t  __attribute__((export_name("TS_ChannelDetails_get_channel_type"))) TS_ChannelDetails_get_channel_type(uint64_t this_ptr) {
34192         LDKChannelDetails this_ptr_conv;
34193         this_ptr_conv.inner = untag_ptr(this_ptr);
34194         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
34195         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
34196         this_ptr_conv.is_owned = false;
34197         LDKChannelTypeFeatures ret_var = ChannelDetails_get_channel_type(&this_ptr_conv);
34198         uint64_t ret_ref = 0;
34199         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
34200         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
34201         return ret_ref;
34202 }
34203
34204 void  __attribute__((export_name("TS_ChannelDetails_set_channel_type"))) TS_ChannelDetails_set_channel_type(uint64_t this_ptr, uint64_t val) {
34205         LDKChannelDetails this_ptr_conv;
34206         this_ptr_conv.inner = untag_ptr(this_ptr);
34207         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
34208         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
34209         this_ptr_conv.is_owned = false;
34210         LDKChannelTypeFeatures val_conv;
34211         val_conv.inner = untag_ptr(val);
34212         val_conv.is_owned = ptr_is_owned(val);
34213         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
34214         val_conv = ChannelTypeFeatures_clone(&val_conv);
34215         ChannelDetails_set_channel_type(&this_ptr_conv, val_conv);
34216 }
34217
34218 uint64_t  __attribute__((export_name("TS_ChannelDetails_get_short_channel_id"))) TS_ChannelDetails_get_short_channel_id(uint64_t this_ptr) {
34219         LDKChannelDetails this_ptr_conv;
34220         this_ptr_conv.inner = untag_ptr(this_ptr);
34221         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
34222         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
34223         this_ptr_conv.is_owned = false;
34224         LDKCOption_u64Z *ret_copy = MALLOC(sizeof(LDKCOption_u64Z), "LDKCOption_u64Z");
34225         *ret_copy = ChannelDetails_get_short_channel_id(&this_ptr_conv);
34226         uint64_t ret_ref = tag_ptr(ret_copy, true);
34227         return ret_ref;
34228 }
34229
34230 void  __attribute__((export_name("TS_ChannelDetails_set_short_channel_id"))) TS_ChannelDetails_set_short_channel_id(uint64_t this_ptr, uint64_t val) {
34231         LDKChannelDetails this_ptr_conv;
34232         this_ptr_conv.inner = untag_ptr(this_ptr);
34233         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
34234         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
34235         this_ptr_conv.is_owned = false;
34236         void* val_ptr = untag_ptr(val);
34237         CHECK_ACCESS(val_ptr);
34238         LDKCOption_u64Z val_conv = *(LDKCOption_u64Z*)(val_ptr);
34239         val_conv = COption_u64Z_clone((LDKCOption_u64Z*)untag_ptr(val));
34240         ChannelDetails_set_short_channel_id(&this_ptr_conv, val_conv);
34241 }
34242
34243 uint64_t  __attribute__((export_name("TS_ChannelDetails_get_outbound_scid_alias"))) TS_ChannelDetails_get_outbound_scid_alias(uint64_t this_ptr) {
34244         LDKChannelDetails this_ptr_conv;
34245         this_ptr_conv.inner = untag_ptr(this_ptr);
34246         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
34247         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
34248         this_ptr_conv.is_owned = false;
34249         LDKCOption_u64Z *ret_copy = MALLOC(sizeof(LDKCOption_u64Z), "LDKCOption_u64Z");
34250         *ret_copy = ChannelDetails_get_outbound_scid_alias(&this_ptr_conv);
34251         uint64_t ret_ref = tag_ptr(ret_copy, true);
34252         return ret_ref;
34253 }
34254
34255 void  __attribute__((export_name("TS_ChannelDetails_set_outbound_scid_alias"))) TS_ChannelDetails_set_outbound_scid_alias(uint64_t this_ptr, uint64_t val) {
34256         LDKChannelDetails this_ptr_conv;
34257         this_ptr_conv.inner = untag_ptr(this_ptr);
34258         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
34259         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
34260         this_ptr_conv.is_owned = false;
34261         void* val_ptr = untag_ptr(val);
34262         CHECK_ACCESS(val_ptr);
34263         LDKCOption_u64Z val_conv = *(LDKCOption_u64Z*)(val_ptr);
34264         val_conv = COption_u64Z_clone((LDKCOption_u64Z*)untag_ptr(val));
34265         ChannelDetails_set_outbound_scid_alias(&this_ptr_conv, val_conv);
34266 }
34267
34268 uint64_t  __attribute__((export_name("TS_ChannelDetails_get_inbound_scid_alias"))) TS_ChannelDetails_get_inbound_scid_alias(uint64_t this_ptr) {
34269         LDKChannelDetails this_ptr_conv;
34270         this_ptr_conv.inner = untag_ptr(this_ptr);
34271         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
34272         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
34273         this_ptr_conv.is_owned = false;
34274         LDKCOption_u64Z *ret_copy = MALLOC(sizeof(LDKCOption_u64Z), "LDKCOption_u64Z");
34275         *ret_copy = ChannelDetails_get_inbound_scid_alias(&this_ptr_conv);
34276         uint64_t ret_ref = tag_ptr(ret_copy, true);
34277         return ret_ref;
34278 }
34279
34280 void  __attribute__((export_name("TS_ChannelDetails_set_inbound_scid_alias"))) TS_ChannelDetails_set_inbound_scid_alias(uint64_t this_ptr, uint64_t val) {
34281         LDKChannelDetails this_ptr_conv;
34282         this_ptr_conv.inner = untag_ptr(this_ptr);
34283         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
34284         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
34285         this_ptr_conv.is_owned = false;
34286         void* val_ptr = untag_ptr(val);
34287         CHECK_ACCESS(val_ptr);
34288         LDKCOption_u64Z val_conv = *(LDKCOption_u64Z*)(val_ptr);
34289         val_conv = COption_u64Z_clone((LDKCOption_u64Z*)untag_ptr(val));
34290         ChannelDetails_set_inbound_scid_alias(&this_ptr_conv, val_conv);
34291 }
34292
34293 int64_t  __attribute__((export_name("TS_ChannelDetails_get_channel_value_satoshis"))) TS_ChannelDetails_get_channel_value_satoshis(uint64_t this_ptr) {
34294         LDKChannelDetails this_ptr_conv;
34295         this_ptr_conv.inner = untag_ptr(this_ptr);
34296         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
34297         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
34298         this_ptr_conv.is_owned = false;
34299         int64_t ret_conv = ChannelDetails_get_channel_value_satoshis(&this_ptr_conv);
34300         return ret_conv;
34301 }
34302
34303 void  __attribute__((export_name("TS_ChannelDetails_set_channel_value_satoshis"))) TS_ChannelDetails_set_channel_value_satoshis(uint64_t this_ptr, int64_t val) {
34304         LDKChannelDetails this_ptr_conv;
34305         this_ptr_conv.inner = untag_ptr(this_ptr);
34306         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
34307         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
34308         this_ptr_conv.is_owned = false;
34309         ChannelDetails_set_channel_value_satoshis(&this_ptr_conv, val);
34310 }
34311
34312 uint64_t  __attribute__((export_name("TS_ChannelDetails_get_unspendable_punishment_reserve"))) TS_ChannelDetails_get_unspendable_punishment_reserve(uint64_t this_ptr) {
34313         LDKChannelDetails this_ptr_conv;
34314         this_ptr_conv.inner = untag_ptr(this_ptr);
34315         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
34316         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
34317         this_ptr_conv.is_owned = false;
34318         LDKCOption_u64Z *ret_copy = MALLOC(sizeof(LDKCOption_u64Z), "LDKCOption_u64Z");
34319         *ret_copy = ChannelDetails_get_unspendable_punishment_reserve(&this_ptr_conv);
34320         uint64_t ret_ref = tag_ptr(ret_copy, true);
34321         return ret_ref;
34322 }
34323
34324 void  __attribute__((export_name("TS_ChannelDetails_set_unspendable_punishment_reserve"))) TS_ChannelDetails_set_unspendable_punishment_reserve(uint64_t this_ptr, uint64_t val) {
34325         LDKChannelDetails this_ptr_conv;
34326         this_ptr_conv.inner = untag_ptr(this_ptr);
34327         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
34328         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
34329         this_ptr_conv.is_owned = false;
34330         void* val_ptr = untag_ptr(val);
34331         CHECK_ACCESS(val_ptr);
34332         LDKCOption_u64Z val_conv = *(LDKCOption_u64Z*)(val_ptr);
34333         val_conv = COption_u64Z_clone((LDKCOption_u64Z*)untag_ptr(val));
34334         ChannelDetails_set_unspendable_punishment_reserve(&this_ptr_conv, val_conv);
34335 }
34336
34337 int8_tArray  __attribute__((export_name("TS_ChannelDetails_get_user_channel_id"))) TS_ChannelDetails_get_user_channel_id(uint64_t this_ptr) {
34338         LDKChannelDetails this_ptr_conv;
34339         this_ptr_conv.inner = untag_ptr(this_ptr);
34340         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
34341         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
34342         this_ptr_conv.is_owned = false;
34343         int8_tArray ret_arr = init_int8_tArray(16, __LINE__);
34344         memcpy(ret_arr->elems, ChannelDetails_get_user_channel_id(&this_ptr_conv).le_bytes, 16);
34345         return ret_arr;
34346 }
34347
34348 void  __attribute__((export_name("TS_ChannelDetails_set_user_channel_id"))) TS_ChannelDetails_set_user_channel_id(uint64_t this_ptr, int8_tArray val) {
34349         LDKChannelDetails this_ptr_conv;
34350         this_ptr_conv.inner = untag_ptr(this_ptr);
34351         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
34352         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
34353         this_ptr_conv.is_owned = false;
34354         LDKU128 val_ref;
34355         CHECK(val->arr_len == 16);
34356         memcpy(val_ref.le_bytes, val->elems, 16); FREE(val);
34357         ChannelDetails_set_user_channel_id(&this_ptr_conv, val_ref);
34358 }
34359
34360 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) {
34361         LDKChannelDetails this_ptr_conv;
34362         this_ptr_conv.inner = untag_ptr(this_ptr);
34363         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
34364         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
34365         this_ptr_conv.is_owned = false;
34366         LDKCOption_u32Z *ret_copy = MALLOC(sizeof(LDKCOption_u32Z), "LDKCOption_u32Z");
34367         *ret_copy = ChannelDetails_get_feerate_sat_per_1000_weight(&this_ptr_conv);
34368         uint64_t ret_ref = tag_ptr(ret_copy, true);
34369         return ret_ref;
34370 }
34371
34372 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) {
34373         LDKChannelDetails this_ptr_conv;
34374         this_ptr_conv.inner = untag_ptr(this_ptr);
34375         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
34376         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
34377         this_ptr_conv.is_owned = false;
34378         void* val_ptr = untag_ptr(val);
34379         CHECK_ACCESS(val_ptr);
34380         LDKCOption_u32Z val_conv = *(LDKCOption_u32Z*)(val_ptr);
34381         val_conv = COption_u32Z_clone((LDKCOption_u32Z*)untag_ptr(val));
34382         ChannelDetails_set_feerate_sat_per_1000_weight(&this_ptr_conv, val_conv);
34383 }
34384
34385 int64_t  __attribute__((export_name("TS_ChannelDetails_get_balance_msat"))) TS_ChannelDetails_get_balance_msat(uint64_t this_ptr) {
34386         LDKChannelDetails this_ptr_conv;
34387         this_ptr_conv.inner = untag_ptr(this_ptr);
34388         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
34389         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
34390         this_ptr_conv.is_owned = false;
34391         int64_t ret_conv = ChannelDetails_get_balance_msat(&this_ptr_conv);
34392         return ret_conv;
34393 }
34394
34395 void  __attribute__((export_name("TS_ChannelDetails_set_balance_msat"))) TS_ChannelDetails_set_balance_msat(uint64_t this_ptr, int64_t val) {
34396         LDKChannelDetails this_ptr_conv;
34397         this_ptr_conv.inner = untag_ptr(this_ptr);
34398         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
34399         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
34400         this_ptr_conv.is_owned = false;
34401         ChannelDetails_set_balance_msat(&this_ptr_conv, val);
34402 }
34403
34404 int64_t  __attribute__((export_name("TS_ChannelDetails_get_outbound_capacity_msat"))) TS_ChannelDetails_get_outbound_capacity_msat(uint64_t this_ptr) {
34405         LDKChannelDetails this_ptr_conv;
34406         this_ptr_conv.inner = untag_ptr(this_ptr);
34407         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
34408         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
34409         this_ptr_conv.is_owned = false;
34410         int64_t ret_conv = ChannelDetails_get_outbound_capacity_msat(&this_ptr_conv);
34411         return ret_conv;
34412 }
34413
34414 void  __attribute__((export_name("TS_ChannelDetails_set_outbound_capacity_msat"))) TS_ChannelDetails_set_outbound_capacity_msat(uint64_t this_ptr, int64_t val) {
34415         LDKChannelDetails this_ptr_conv;
34416         this_ptr_conv.inner = untag_ptr(this_ptr);
34417         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
34418         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
34419         this_ptr_conv.is_owned = false;
34420         ChannelDetails_set_outbound_capacity_msat(&this_ptr_conv, val);
34421 }
34422
34423 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) {
34424         LDKChannelDetails this_ptr_conv;
34425         this_ptr_conv.inner = untag_ptr(this_ptr);
34426         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
34427         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
34428         this_ptr_conv.is_owned = false;
34429         int64_t ret_conv = ChannelDetails_get_next_outbound_htlc_limit_msat(&this_ptr_conv);
34430         return ret_conv;
34431 }
34432
34433 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) {
34434         LDKChannelDetails this_ptr_conv;
34435         this_ptr_conv.inner = untag_ptr(this_ptr);
34436         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
34437         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
34438         this_ptr_conv.is_owned = false;
34439         ChannelDetails_set_next_outbound_htlc_limit_msat(&this_ptr_conv, val);
34440 }
34441
34442 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) {
34443         LDKChannelDetails this_ptr_conv;
34444         this_ptr_conv.inner = untag_ptr(this_ptr);
34445         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
34446         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
34447         this_ptr_conv.is_owned = false;
34448         int64_t ret_conv = ChannelDetails_get_next_outbound_htlc_minimum_msat(&this_ptr_conv);
34449         return ret_conv;
34450 }
34451
34452 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) {
34453         LDKChannelDetails this_ptr_conv;
34454         this_ptr_conv.inner = untag_ptr(this_ptr);
34455         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
34456         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
34457         this_ptr_conv.is_owned = false;
34458         ChannelDetails_set_next_outbound_htlc_minimum_msat(&this_ptr_conv, val);
34459 }
34460
34461 int64_t  __attribute__((export_name("TS_ChannelDetails_get_inbound_capacity_msat"))) TS_ChannelDetails_get_inbound_capacity_msat(uint64_t this_ptr) {
34462         LDKChannelDetails this_ptr_conv;
34463         this_ptr_conv.inner = untag_ptr(this_ptr);
34464         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
34465         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
34466         this_ptr_conv.is_owned = false;
34467         int64_t ret_conv = ChannelDetails_get_inbound_capacity_msat(&this_ptr_conv);
34468         return ret_conv;
34469 }
34470
34471 void  __attribute__((export_name("TS_ChannelDetails_set_inbound_capacity_msat"))) TS_ChannelDetails_set_inbound_capacity_msat(uint64_t this_ptr, int64_t val) {
34472         LDKChannelDetails this_ptr_conv;
34473         this_ptr_conv.inner = untag_ptr(this_ptr);
34474         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
34475         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
34476         this_ptr_conv.is_owned = false;
34477         ChannelDetails_set_inbound_capacity_msat(&this_ptr_conv, val);
34478 }
34479
34480 uint64_t  __attribute__((export_name("TS_ChannelDetails_get_confirmations_required"))) TS_ChannelDetails_get_confirmations_required(uint64_t this_ptr) {
34481         LDKChannelDetails this_ptr_conv;
34482         this_ptr_conv.inner = untag_ptr(this_ptr);
34483         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
34484         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
34485         this_ptr_conv.is_owned = false;
34486         LDKCOption_u32Z *ret_copy = MALLOC(sizeof(LDKCOption_u32Z), "LDKCOption_u32Z");
34487         *ret_copy = ChannelDetails_get_confirmations_required(&this_ptr_conv);
34488         uint64_t ret_ref = tag_ptr(ret_copy, true);
34489         return ret_ref;
34490 }
34491
34492 void  __attribute__((export_name("TS_ChannelDetails_set_confirmations_required"))) TS_ChannelDetails_set_confirmations_required(uint64_t this_ptr, uint64_t val) {
34493         LDKChannelDetails this_ptr_conv;
34494         this_ptr_conv.inner = untag_ptr(this_ptr);
34495         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
34496         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
34497         this_ptr_conv.is_owned = false;
34498         void* val_ptr = untag_ptr(val);
34499         CHECK_ACCESS(val_ptr);
34500         LDKCOption_u32Z val_conv = *(LDKCOption_u32Z*)(val_ptr);
34501         val_conv = COption_u32Z_clone((LDKCOption_u32Z*)untag_ptr(val));
34502         ChannelDetails_set_confirmations_required(&this_ptr_conv, val_conv);
34503 }
34504
34505 uint64_t  __attribute__((export_name("TS_ChannelDetails_get_confirmations"))) TS_ChannelDetails_get_confirmations(uint64_t this_ptr) {
34506         LDKChannelDetails this_ptr_conv;
34507         this_ptr_conv.inner = untag_ptr(this_ptr);
34508         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
34509         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
34510         this_ptr_conv.is_owned = false;
34511         LDKCOption_u32Z *ret_copy = MALLOC(sizeof(LDKCOption_u32Z), "LDKCOption_u32Z");
34512         *ret_copy = ChannelDetails_get_confirmations(&this_ptr_conv);
34513         uint64_t ret_ref = tag_ptr(ret_copy, true);
34514         return ret_ref;
34515 }
34516
34517 void  __attribute__((export_name("TS_ChannelDetails_set_confirmations"))) TS_ChannelDetails_set_confirmations(uint64_t this_ptr, uint64_t val) {
34518         LDKChannelDetails this_ptr_conv;
34519         this_ptr_conv.inner = untag_ptr(this_ptr);
34520         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
34521         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
34522         this_ptr_conv.is_owned = false;
34523         void* val_ptr = untag_ptr(val);
34524         CHECK_ACCESS(val_ptr);
34525         LDKCOption_u32Z val_conv = *(LDKCOption_u32Z*)(val_ptr);
34526         val_conv = COption_u32Z_clone((LDKCOption_u32Z*)untag_ptr(val));
34527         ChannelDetails_set_confirmations(&this_ptr_conv, val_conv);
34528 }
34529
34530 uint64_t  __attribute__((export_name("TS_ChannelDetails_get_force_close_spend_delay"))) TS_ChannelDetails_get_force_close_spend_delay(uint64_t this_ptr) {
34531         LDKChannelDetails this_ptr_conv;
34532         this_ptr_conv.inner = untag_ptr(this_ptr);
34533         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
34534         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
34535         this_ptr_conv.is_owned = false;
34536         LDKCOption_u16Z *ret_copy = MALLOC(sizeof(LDKCOption_u16Z), "LDKCOption_u16Z");
34537         *ret_copy = ChannelDetails_get_force_close_spend_delay(&this_ptr_conv);
34538         uint64_t ret_ref = tag_ptr(ret_copy, true);
34539         return ret_ref;
34540 }
34541
34542 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) {
34543         LDKChannelDetails this_ptr_conv;
34544         this_ptr_conv.inner = untag_ptr(this_ptr);
34545         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
34546         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
34547         this_ptr_conv.is_owned = false;
34548         void* val_ptr = untag_ptr(val);
34549         CHECK_ACCESS(val_ptr);
34550         LDKCOption_u16Z val_conv = *(LDKCOption_u16Z*)(val_ptr);
34551         val_conv = COption_u16Z_clone((LDKCOption_u16Z*)untag_ptr(val));
34552         ChannelDetails_set_force_close_spend_delay(&this_ptr_conv, val_conv);
34553 }
34554
34555 jboolean  __attribute__((export_name("TS_ChannelDetails_get_is_outbound"))) TS_ChannelDetails_get_is_outbound(uint64_t this_ptr) {
34556         LDKChannelDetails this_ptr_conv;
34557         this_ptr_conv.inner = untag_ptr(this_ptr);
34558         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
34559         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
34560         this_ptr_conv.is_owned = false;
34561         jboolean ret_conv = ChannelDetails_get_is_outbound(&this_ptr_conv);
34562         return ret_conv;
34563 }
34564
34565 void  __attribute__((export_name("TS_ChannelDetails_set_is_outbound"))) TS_ChannelDetails_set_is_outbound(uint64_t this_ptr, jboolean val) {
34566         LDKChannelDetails this_ptr_conv;
34567         this_ptr_conv.inner = untag_ptr(this_ptr);
34568         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
34569         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
34570         this_ptr_conv.is_owned = false;
34571         ChannelDetails_set_is_outbound(&this_ptr_conv, val);
34572 }
34573
34574 jboolean  __attribute__((export_name("TS_ChannelDetails_get_is_channel_ready"))) TS_ChannelDetails_get_is_channel_ready(uint64_t this_ptr) {
34575         LDKChannelDetails this_ptr_conv;
34576         this_ptr_conv.inner = untag_ptr(this_ptr);
34577         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
34578         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
34579         this_ptr_conv.is_owned = false;
34580         jboolean ret_conv = ChannelDetails_get_is_channel_ready(&this_ptr_conv);
34581         return ret_conv;
34582 }
34583
34584 void  __attribute__((export_name("TS_ChannelDetails_set_is_channel_ready"))) TS_ChannelDetails_set_is_channel_ready(uint64_t this_ptr, jboolean val) {
34585         LDKChannelDetails this_ptr_conv;
34586         this_ptr_conv.inner = untag_ptr(this_ptr);
34587         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
34588         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
34589         this_ptr_conv.is_owned = false;
34590         ChannelDetails_set_is_channel_ready(&this_ptr_conv, val);
34591 }
34592
34593 uint64_t  __attribute__((export_name("TS_ChannelDetails_get_channel_shutdown_state"))) TS_ChannelDetails_get_channel_shutdown_state(uint64_t this_ptr) {
34594         LDKChannelDetails this_ptr_conv;
34595         this_ptr_conv.inner = untag_ptr(this_ptr);
34596         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
34597         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
34598         this_ptr_conv.is_owned = false;
34599         LDKCOption_ChannelShutdownStateZ *ret_copy = MALLOC(sizeof(LDKCOption_ChannelShutdownStateZ), "LDKCOption_ChannelShutdownStateZ");
34600         *ret_copy = ChannelDetails_get_channel_shutdown_state(&this_ptr_conv);
34601         uint64_t ret_ref = tag_ptr(ret_copy, true);
34602         return ret_ref;
34603 }
34604
34605 void  __attribute__((export_name("TS_ChannelDetails_set_channel_shutdown_state"))) TS_ChannelDetails_set_channel_shutdown_state(uint64_t this_ptr, uint64_t val) {
34606         LDKChannelDetails this_ptr_conv;
34607         this_ptr_conv.inner = untag_ptr(this_ptr);
34608         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
34609         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
34610         this_ptr_conv.is_owned = false;
34611         void* val_ptr = untag_ptr(val);
34612         CHECK_ACCESS(val_ptr);
34613         LDKCOption_ChannelShutdownStateZ val_conv = *(LDKCOption_ChannelShutdownStateZ*)(val_ptr);
34614         val_conv = COption_ChannelShutdownStateZ_clone((LDKCOption_ChannelShutdownStateZ*)untag_ptr(val));
34615         ChannelDetails_set_channel_shutdown_state(&this_ptr_conv, val_conv);
34616 }
34617
34618 jboolean  __attribute__((export_name("TS_ChannelDetails_get_is_usable"))) TS_ChannelDetails_get_is_usable(uint64_t this_ptr) {
34619         LDKChannelDetails this_ptr_conv;
34620         this_ptr_conv.inner = untag_ptr(this_ptr);
34621         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
34622         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
34623         this_ptr_conv.is_owned = false;
34624         jboolean ret_conv = ChannelDetails_get_is_usable(&this_ptr_conv);
34625         return ret_conv;
34626 }
34627
34628 void  __attribute__((export_name("TS_ChannelDetails_set_is_usable"))) TS_ChannelDetails_set_is_usable(uint64_t this_ptr, jboolean val) {
34629         LDKChannelDetails this_ptr_conv;
34630         this_ptr_conv.inner = untag_ptr(this_ptr);
34631         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
34632         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
34633         this_ptr_conv.is_owned = false;
34634         ChannelDetails_set_is_usable(&this_ptr_conv, val);
34635 }
34636
34637 jboolean  __attribute__((export_name("TS_ChannelDetails_get_is_public"))) TS_ChannelDetails_get_is_public(uint64_t this_ptr) {
34638         LDKChannelDetails this_ptr_conv;
34639         this_ptr_conv.inner = untag_ptr(this_ptr);
34640         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
34641         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
34642         this_ptr_conv.is_owned = false;
34643         jboolean ret_conv = ChannelDetails_get_is_public(&this_ptr_conv);
34644         return ret_conv;
34645 }
34646
34647 void  __attribute__((export_name("TS_ChannelDetails_set_is_public"))) TS_ChannelDetails_set_is_public(uint64_t this_ptr, jboolean val) {
34648         LDKChannelDetails this_ptr_conv;
34649         this_ptr_conv.inner = untag_ptr(this_ptr);
34650         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
34651         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
34652         this_ptr_conv.is_owned = false;
34653         ChannelDetails_set_is_public(&this_ptr_conv, val);
34654 }
34655
34656 uint64_t  __attribute__((export_name("TS_ChannelDetails_get_inbound_htlc_minimum_msat"))) TS_ChannelDetails_get_inbound_htlc_minimum_msat(uint64_t this_ptr) {
34657         LDKChannelDetails this_ptr_conv;
34658         this_ptr_conv.inner = untag_ptr(this_ptr);
34659         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
34660         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
34661         this_ptr_conv.is_owned = false;
34662         LDKCOption_u64Z *ret_copy = MALLOC(sizeof(LDKCOption_u64Z), "LDKCOption_u64Z");
34663         *ret_copy = ChannelDetails_get_inbound_htlc_minimum_msat(&this_ptr_conv);
34664         uint64_t ret_ref = tag_ptr(ret_copy, true);
34665         return ret_ref;
34666 }
34667
34668 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) {
34669         LDKChannelDetails this_ptr_conv;
34670         this_ptr_conv.inner = untag_ptr(this_ptr);
34671         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
34672         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
34673         this_ptr_conv.is_owned = false;
34674         void* val_ptr = untag_ptr(val);
34675         CHECK_ACCESS(val_ptr);
34676         LDKCOption_u64Z val_conv = *(LDKCOption_u64Z*)(val_ptr);
34677         val_conv = COption_u64Z_clone((LDKCOption_u64Z*)untag_ptr(val));
34678         ChannelDetails_set_inbound_htlc_minimum_msat(&this_ptr_conv, val_conv);
34679 }
34680
34681 uint64_t  __attribute__((export_name("TS_ChannelDetails_get_inbound_htlc_maximum_msat"))) TS_ChannelDetails_get_inbound_htlc_maximum_msat(uint64_t this_ptr) {
34682         LDKChannelDetails this_ptr_conv;
34683         this_ptr_conv.inner = untag_ptr(this_ptr);
34684         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
34685         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
34686         this_ptr_conv.is_owned = false;
34687         LDKCOption_u64Z *ret_copy = MALLOC(sizeof(LDKCOption_u64Z), "LDKCOption_u64Z");
34688         *ret_copy = ChannelDetails_get_inbound_htlc_maximum_msat(&this_ptr_conv);
34689         uint64_t ret_ref = tag_ptr(ret_copy, true);
34690         return ret_ref;
34691 }
34692
34693 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) {
34694         LDKChannelDetails this_ptr_conv;
34695         this_ptr_conv.inner = untag_ptr(this_ptr);
34696         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
34697         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
34698         this_ptr_conv.is_owned = false;
34699         void* val_ptr = untag_ptr(val);
34700         CHECK_ACCESS(val_ptr);
34701         LDKCOption_u64Z val_conv = *(LDKCOption_u64Z*)(val_ptr);
34702         val_conv = COption_u64Z_clone((LDKCOption_u64Z*)untag_ptr(val));
34703         ChannelDetails_set_inbound_htlc_maximum_msat(&this_ptr_conv, val_conv);
34704 }
34705
34706 uint64_t  __attribute__((export_name("TS_ChannelDetails_get_config"))) TS_ChannelDetails_get_config(uint64_t this_ptr) {
34707         LDKChannelDetails this_ptr_conv;
34708         this_ptr_conv.inner = untag_ptr(this_ptr);
34709         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
34710         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
34711         this_ptr_conv.is_owned = false;
34712         LDKChannelConfig ret_var = ChannelDetails_get_config(&this_ptr_conv);
34713         uint64_t ret_ref = 0;
34714         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
34715         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
34716         return ret_ref;
34717 }
34718
34719 void  __attribute__((export_name("TS_ChannelDetails_set_config"))) TS_ChannelDetails_set_config(uint64_t this_ptr, uint64_t val) {
34720         LDKChannelDetails this_ptr_conv;
34721         this_ptr_conv.inner = untag_ptr(this_ptr);
34722         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
34723         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
34724         this_ptr_conv.is_owned = false;
34725         LDKChannelConfig val_conv;
34726         val_conv.inner = untag_ptr(val);
34727         val_conv.is_owned = ptr_is_owned(val);
34728         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
34729         val_conv = ChannelConfig_clone(&val_conv);
34730         ChannelDetails_set_config(&this_ptr_conv, val_conv);
34731 }
34732
34733 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) {
34734         LDKThirtyTwoBytes channel_id_arg_ref;
34735         CHECK(channel_id_arg->arr_len == 32);
34736         memcpy(channel_id_arg_ref.data, channel_id_arg->elems, 32); FREE(channel_id_arg);
34737         LDKChannelCounterparty counterparty_arg_conv;
34738         counterparty_arg_conv.inner = untag_ptr(counterparty_arg);
34739         counterparty_arg_conv.is_owned = ptr_is_owned(counterparty_arg);
34740         CHECK_INNER_FIELD_ACCESS_OR_NULL(counterparty_arg_conv);
34741         counterparty_arg_conv = ChannelCounterparty_clone(&counterparty_arg_conv);
34742         LDKOutPoint funding_txo_arg_conv;
34743         funding_txo_arg_conv.inner = untag_ptr(funding_txo_arg);
34744         funding_txo_arg_conv.is_owned = ptr_is_owned(funding_txo_arg);
34745         CHECK_INNER_FIELD_ACCESS_OR_NULL(funding_txo_arg_conv);
34746         funding_txo_arg_conv = OutPoint_clone(&funding_txo_arg_conv);
34747         LDKChannelTypeFeatures channel_type_arg_conv;
34748         channel_type_arg_conv.inner = untag_ptr(channel_type_arg);
34749         channel_type_arg_conv.is_owned = ptr_is_owned(channel_type_arg);
34750         CHECK_INNER_FIELD_ACCESS_OR_NULL(channel_type_arg_conv);
34751         channel_type_arg_conv = ChannelTypeFeatures_clone(&channel_type_arg_conv);
34752         void* short_channel_id_arg_ptr = untag_ptr(short_channel_id_arg);
34753         CHECK_ACCESS(short_channel_id_arg_ptr);
34754         LDKCOption_u64Z short_channel_id_arg_conv = *(LDKCOption_u64Z*)(short_channel_id_arg_ptr);
34755         short_channel_id_arg_conv = COption_u64Z_clone((LDKCOption_u64Z*)untag_ptr(short_channel_id_arg));
34756         void* outbound_scid_alias_arg_ptr = untag_ptr(outbound_scid_alias_arg);
34757         CHECK_ACCESS(outbound_scid_alias_arg_ptr);
34758         LDKCOption_u64Z outbound_scid_alias_arg_conv = *(LDKCOption_u64Z*)(outbound_scid_alias_arg_ptr);
34759         outbound_scid_alias_arg_conv = COption_u64Z_clone((LDKCOption_u64Z*)untag_ptr(outbound_scid_alias_arg));
34760         void* inbound_scid_alias_arg_ptr = untag_ptr(inbound_scid_alias_arg);
34761         CHECK_ACCESS(inbound_scid_alias_arg_ptr);
34762         LDKCOption_u64Z inbound_scid_alias_arg_conv = *(LDKCOption_u64Z*)(inbound_scid_alias_arg_ptr);
34763         inbound_scid_alias_arg_conv = COption_u64Z_clone((LDKCOption_u64Z*)untag_ptr(inbound_scid_alias_arg));
34764         void* unspendable_punishment_reserve_arg_ptr = untag_ptr(unspendable_punishment_reserve_arg);
34765         CHECK_ACCESS(unspendable_punishment_reserve_arg_ptr);
34766         LDKCOption_u64Z unspendable_punishment_reserve_arg_conv = *(LDKCOption_u64Z*)(unspendable_punishment_reserve_arg_ptr);
34767         LDKU128 user_channel_id_arg_ref;
34768         CHECK(user_channel_id_arg->arr_len == 16);
34769         memcpy(user_channel_id_arg_ref.le_bytes, user_channel_id_arg->elems, 16); FREE(user_channel_id_arg);
34770         void* feerate_sat_per_1000_weight_arg_ptr = untag_ptr(feerate_sat_per_1000_weight_arg);
34771         CHECK_ACCESS(feerate_sat_per_1000_weight_arg_ptr);
34772         LDKCOption_u32Z feerate_sat_per_1000_weight_arg_conv = *(LDKCOption_u32Z*)(feerate_sat_per_1000_weight_arg_ptr);
34773         feerate_sat_per_1000_weight_arg_conv = COption_u32Z_clone((LDKCOption_u32Z*)untag_ptr(feerate_sat_per_1000_weight_arg));
34774         void* confirmations_required_arg_ptr = untag_ptr(confirmations_required_arg);
34775         CHECK_ACCESS(confirmations_required_arg_ptr);
34776         LDKCOption_u32Z confirmations_required_arg_conv = *(LDKCOption_u32Z*)(confirmations_required_arg_ptr);
34777         confirmations_required_arg_conv = COption_u32Z_clone((LDKCOption_u32Z*)untag_ptr(confirmations_required_arg));
34778         void* confirmations_arg_ptr = untag_ptr(confirmations_arg);
34779         CHECK_ACCESS(confirmations_arg_ptr);
34780         LDKCOption_u32Z confirmations_arg_conv = *(LDKCOption_u32Z*)(confirmations_arg_ptr);
34781         confirmations_arg_conv = COption_u32Z_clone((LDKCOption_u32Z*)untag_ptr(confirmations_arg));
34782         void* force_close_spend_delay_arg_ptr = untag_ptr(force_close_spend_delay_arg);
34783         CHECK_ACCESS(force_close_spend_delay_arg_ptr);
34784         LDKCOption_u16Z force_close_spend_delay_arg_conv = *(LDKCOption_u16Z*)(force_close_spend_delay_arg_ptr);
34785         force_close_spend_delay_arg_conv = COption_u16Z_clone((LDKCOption_u16Z*)untag_ptr(force_close_spend_delay_arg));
34786         void* channel_shutdown_state_arg_ptr = untag_ptr(channel_shutdown_state_arg);
34787         CHECK_ACCESS(channel_shutdown_state_arg_ptr);
34788         LDKCOption_ChannelShutdownStateZ channel_shutdown_state_arg_conv = *(LDKCOption_ChannelShutdownStateZ*)(channel_shutdown_state_arg_ptr);
34789         channel_shutdown_state_arg_conv = COption_ChannelShutdownStateZ_clone((LDKCOption_ChannelShutdownStateZ*)untag_ptr(channel_shutdown_state_arg));
34790         void* inbound_htlc_minimum_msat_arg_ptr = untag_ptr(inbound_htlc_minimum_msat_arg);
34791         CHECK_ACCESS(inbound_htlc_minimum_msat_arg_ptr);
34792         LDKCOption_u64Z inbound_htlc_minimum_msat_arg_conv = *(LDKCOption_u64Z*)(inbound_htlc_minimum_msat_arg_ptr);
34793         inbound_htlc_minimum_msat_arg_conv = COption_u64Z_clone((LDKCOption_u64Z*)untag_ptr(inbound_htlc_minimum_msat_arg));
34794         void* inbound_htlc_maximum_msat_arg_ptr = untag_ptr(inbound_htlc_maximum_msat_arg);
34795         CHECK_ACCESS(inbound_htlc_maximum_msat_arg_ptr);
34796         LDKCOption_u64Z inbound_htlc_maximum_msat_arg_conv = *(LDKCOption_u64Z*)(inbound_htlc_maximum_msat_arg_ptr);
34797         inbound_htlc_maximum_msat_arg_conv = COption_u64Z_clone((LDKCOption_u64Z*)untag_ptr(inbound_htlc_maximum_msat_arg));
34798         LDKChannelConfig config_arg_conv;
34799         config_arg_conv.inner = untag_ptr(config_arg);
34800         config_arg_conv.is_owned = ptr_is_owned(config_arg);
34801         CHECK_INNER_FIELD_ACCESS_OR_NULL(config_arg_conv);
34802         config_arg_conv = ChannelConfig_clone(&config_arg_conv);
34803         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);
34804         uint64_t ret_ref = 0;
34805         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
34806         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
34807         return ret_ref;
34808 }
34809
34810 static inline uint64_t ChannelDetails_clone_ptr(LDKChannelDetails *NONNULL_PTR arg) {
34811         LDKChannelDetails ret_var = ChannelDetails_clone(arg);
34812         uint64_t ret_ref = 0;
34813         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
34814         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
34815         return ret_ref;
34816 }
34817 int64_t  __attribute__((export_name("TS_ChannelDetails_clone_ptr"))) TS_ChannelDetails_clone_ptr(uint64_t arg) {
34818         LDKChannelDetails arg_conv;
34819         arg_conv.inner = untag_ptr(arg);
34820         arg_conv.is_owned = ptr_is_owned(arg);
34821         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
34822         arg_conv.is_owned = false;
34823         int64_t ret_conv = ChannelDetails_clone_ptr(&arg_conv);
34824         return ret_conv;
34825 }
34826
34827 uint64_t  __attribute__((export_name("TS_ChannelDetails_clone"))) TS_ChannelDetails_clone(uint64_t orig) {
34828         LDKChannelDetails orig_conv;
34829         orig_conv.inner = untag_ptr(orig);
34830         orig_conv.is_owned = ptr_is_owned(orig);
34831         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
34832         orig_conv.is_owned = false;
34833         LDKChannelDetails ret_var = ChannelDetails_clone(&orig_conv);
34834         uint64_t ret_ref = 0;
34835         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
34836         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
34837         return ret_ref;
34838 }
34839
34840 uint64_t  __attribute__((export_name("TS_ChannelDetails_get_inbound_payment_scid"))) TS_ChannelDetails_get_inbound_payment_scid(uint64_t this_arg) {
34841         LDKChannelDetails this_arg_conv;
34842         this_arg_conv.inner = untag_ptr(this_arg);
34843         this_arg_conv.is_owned = ptr_is_owned(this_arg);
34844         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
34845         this_arg_conv.is_owned = false;
34846         LDKCOption_u64Z *ret_copy = MALLOC(sizeof(LDKCOption_u64Z), "LDKCOption_u64Z");
34847         *ret_copy = ChannelDetails_get_inbound_payment_scid(&this_arg_conv);
34848         uint64_t ret_ref = tag_ptr(ret_copy, true);
34849         return ret_ref;
34850 }
34851
34852 uint64_t  __attribute__((export_name("TS_ChannelDetails_get_outbound_payment_scid"))) TS_ChannelDetails_get_outbound_payment_scid(uint64_t this_arg) {
34853         LDKChannelDetails this_arg_conv;
34854         this_arg_conv.inner = untag_ptr(this_arg);
34855         this_arg_conv.is_owned = ptr_is_owned(this_arg);
34856         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
34857         this_arg_conv.is_owned = false;
34858         LDKCOption_u64Z *ret_copy = MALLOC(sizeof(LDKCOption_u64Z), "LDKCOption_u64Z");
34859         *ret_copy = ChannelDetails_get_outbound_payment_scid(&this_arg_conv);
34860         uint64_t ret_ref = tag_ptr(ret_copy, true);
34861         return ret_ref;
34862 }
34863
34864 uint32_t  __attribute__((export_name("TS_ChannelShutdownState_clone"))) TS_ChannelShutdownState_clone(uint64_t orig) {
34865         LDKChannelShutdownState* orig_conv = (LDKChannelShutdownState*)untag_ptr(orig);
34866         uint32_t ret_conv = LDKChannelShutdownState_to_js(ChannelShutdownState_clone(orig_conv));
34867         return ret_conv;
34868 }
34869
34870 uint32_t  __attribute__((export_name("TS_ChannelShutdownState_not_shutting_down"))) TS_ChannelShutdownState_not_shutting_down() {
34871         uint32_t ret_conv = LDKChannelShutdownState_to_js(ChannelShutdownState_not_shutting_down());
34872         return ret_conv;
34873 }
34874
34875 uint32_t  __attribute__((export_name("TS_ChannelShutdownState_shutdown_initiated"))) TS_ChannelShutdownState_shutdown_initiated() {
34876         uint32_t ret_conv = LDKChannelShutdownState_to_js(ChannelShutdownState_shutdown_initiated());
34877         return ret_conv;
34878 }
34879
34880 uint32_t  __attribute__((export_name("TS_ChannelShutdownState_resolving_htlcs"))) TS_ChannelShutdownState_resolving_htlcs() {
34881         uint32_t ret_conv = LDKChannelShutdownState_to_js(ChannelShutdownState_resolving_htlcs());
34882         return ret_conv;
34883 }
34884
34885 uint32_t  __attribute__((export_name("TS_ChannelShutdownState_negotiating_closing_fee"))) TS_ChannelShutdownState_negotiating_closing_fee() {
34886         uint32_t ret_conv = LDKChannelShutdownState_to_js(ChannelShutdownState_negotiating_closing_fee());
34887         return ret_conv;
34888 }
34889
34890 uint32_t  __attribute__((export_name("TS_ChannelShutdownState_shutdown_complete"))) TS_ChannelShutdownState_shutdown_complete() {
34891         uint32_t ret_conv = LDKChannelShutdownState_to_js(ChannelShutdownState_shutdown_complete());
34892         return ret_conv;
34893 }
34894
34895 jboolean  __attribute__((export_name("TS_ChannelShutdownState_eq"))) TS_ChannelShutdownState_eq(uint64_t a, uint64_t b) {
34896         LDKChannelShutdownState* a_conv = (LDKChannelShutdownState*)untag_ptr(a);
34897         LDKChannelShutdownState* b_conv = (LDKChannelShutdownState*)untag_ptr(b);
34898         jboolean ret_conv = ChannelShutdownState_eq(a_conv, b_conv);
34899         return ret_conv;
34900 }
34901
34902 void  __attribute__((export_name("TS_RecentPaymentDetails_free"))) TS_RecentPaymentDetails_free(uint64_t this_ptr) {
34903         if (!ptr_is_owned(this_ptr)) return;
34904         void* this_ptr_ptr = untag_ptr(this_ptr);
34905         CHECK_ACCESS(this_ptr_ptr);
34906         LDKRecentPaymentDetails this_ptr_conv = *(LDKRecentPaymentDetails*)(this_ptr_ptr);
34907         FREE(untag_ptr(this_ptr));
34908         RecentPaymentDetails_free(this_ptr_conv);
34909 }
34910
34911 static inline uint64_t RecentPaymentDetails_clone_ptr(LDKRecentPaymentDetails *NONNULL_PTR arg) {
34912         LDKRecentPaymentDetails *ret_copy = MALLOC(sizeof(LDKRecentPaymentDetails), "LDKRecentPaymentDetails");
34913         *ret_copy = RecentPaymentDetails_clone(arg);
34914         uint64_t ret_ref = tag_ptr(ret_copy, true);
34915         return ret_ref;
34916 }
34917 int64_t  __attribute__((export_name("TS_RecentPaymentDetails_clone_ptr"))) TS_RecentPaymentDetails_clone_ptr(uint64_t arg) {
34918         LDKRecentPaymentDetails* arg_conv = (LDKRecentPaymentDetails*)untag_ptr(arg);
34919         int64_t ret_conv = RecentPaymentDetails_clone_ptr(arg_conv);
34920         return ret_conv;
34921 }
34922
34923 uint64_t  __attribute__((export_name("TS_RecentPaymentDetails_clone"))) TS_RecentPaymentDetails_clone(uint64_t orig) {
34924         LDKRecentPaymentDetails* orig_conv = (LDKRecentPaymentDetails*)untag_ptr(orig);
34925         LDKRecentPaymentDetails *ret_copy = MALLOC(sizeof(LDKRecentPaymentDetails), "LDKRecentPaymentDetails");
34926         *ret_copy = RecentPaymentDetails_clone(orig_conv);
34927         uint64_t ret_ref = tag_ptr(ret_copy, true);
34928         return ret_ref;
34929 }
34930
34931 uint64_t  __attribute__((export_name("TS_RecentPaymentDetails_awaiting_invoice"))) TS_RecentPaymentDetails_awaiting_invoice(int8_tArray payment_id) {
34932         LDKThirtyTwoBytes payment_id_ref;
34933         CHECK(payment_id->arr_len == 32);
34934         memcpy(payment_id_ref.data, payment_id->elems, 32); FREE(payment_id);
34935         LDKRecentPaymentDetails *ret_copy = MALLOC(sizeof(LDKRecentPaymentDetails), "LDKRecentPaymentDetails");
34936         *ret_copy = RecentPaymentDetails_awaiting_invoice(payment_id_ref);
34937         uint64_t ret_ref = tag_ptr(ret_copy, true);
34938         return ret_ref;
34939 }
34940
34941 uint64_t  __attribute__((export_name("TS_RecentPaymentDetails_pending"))) TS_RecentPaymentDetails_pending(int8_tArray payment_id, int8_tArray payment_hash, int64_t total_msat) {
34942         LDKThirtyTwoBytes payment_id_ref;
34943         CHECK(payment_id->arr_len == 32);
34944         memcpy(payment_id_ref.data, payment_id->elems, 32); FREE(payment_id);
34945         LDKThirtyTwoBytes payment_hash_ref;
34946         CHECK(payment_hash->arr_len == 32);
34947         memcpy(payment_hash_ref.data, payment_hash->elems, 32); FREE(payment_hash);
34948         LDKRecentPaymentDetails *ret_copy = MALLOC(sizeof(LDKRecentPaymentDetails), "LDKRecentPaymentDetails");
34949         *ret_copy = RecentPaymentDetails_pending(payment_id_ref, payment_hash_ref, total_msat);
34950         uint64_t ret_ref = tag_ptr(ret_copy, true);
34951         return ret_ref;
34952 }
34953
34954 uint64_t  __attribute__((export_name("TS_RecentPaymentDetails_fulfilled"))) TS_RecentPaymentDetails_fulfilled(int8_tArray payment_id, uint64_t payment_hash) {
34955         LDKThirtyTwoBytes payment_id_ref;
34956         CHECK(payment_id->arr_len == 32);
34957         memcpy(payment_id_ref.data, payment_id->elems, 32); FREE(payment_id);
34958         void* payment_hash_ptr = untag_ptr(payment_hash);
34959         CHECK_ACCESS(payment_hash_ptr);
34960         LDKCOption_ThirtyTwoBytesZ payment_hash_conv = *(LDKCOption_ThirtyTwoBytesZ*)(payment_hash_ptr);
34961         payment_hash_conv = COption_ThirtyTwoBytesZ_clone((LDKCOption_ThirtyTwoBytesZ*)untag_ptr(payment_hash));
34962         LDKRecentPaymentDetails *ret_copy = MALLOC(sizeof(LDKRecentPaymentDetails), "LDKRecentPaymentDetails");
34963         *ret_copy = RecentPaymentDetails_fulfilled(payment_id_ref, payment_hash_conv);
34964         uint64_t ret_ref = tag_ptr(ret_copy, true);
34965         return ret_ref;
34966 }
34967
34968 uint64_t  __attribute__((export_name("TS_RecentPaymentDetails_abandoned"))) TS_RecentPaymentDetails_abandoned(int8_tArray payment_id, int8_tArray payment_hash) {
34969         LDKThirtyTwoBytes payment_id_ref;
34970         CHECK(payment_id->arr_len == 32);
34971         memcpy(payment_id_ref.data, payment_id->elems, 32); FREE(payment_id);
34972         LDKThirtyTwoBytes payment_hash_ref;
34973         CHECK(payment_hash->arr_len == 32);
34974         memcpy(payment_hash_ref.data, payment_hash->elems, 32); FREE(payment_hash);
34975         LDKRecentPaymentDetails *ret_copy = MALLOC(sizeof(LDKRecentPaymentDetails), "LDKRecentPaymentDetails");
34976         *ret_copy = RecentPaymentDetails_abandoned(payment_id_ref, payment_hash_ref);
34977         uint64_t ret_ref = tag_ptr(ret_copy, true);
34978         return ret_ref;
34979 }
34980
34981 void  __attribute__((export_name("TS_PhantomRouteHints_free"))) TS_PhantomRouteHints_free(uint64_t this_obj) {
34982         LDKPhantomRouteHints this_obj_conv;
34983         this_obj_conv.inner = untag_ptr(this_obj);
34984         this_obj_conv.is_owned = ptr_is_owned(this_obj);
34985         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
34986         PhantomRouteHints_free(this_obj_conv);
34987 }
34988
34989 uint64_tArray  __attribute__((export_name("TS_PhantomRouteHints_get_channels"))) TS_PhantomRouteHints_get_channels(uint64_t this_ptr) {
34990         LDKPhantomRouteHints this_ptr_conv;
34991         this_ptr_conv.inner = untag_ptr(this_ptr);
34992         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
34993         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
34994         this_ptr_conv.is_owned = false;
34995         LDKCVec_ChannelDetailsZ ret_var = PhantomRouteHints_get_channels(&this_ptr_conv);
34996         uint64_tArray ret_arr = NULL;
34997         ret_arr = init_uint64_tArray(ret_var.datalen, __LINE__);
34998         uint64_t *ret_arr_ptr = (uint64_t*)(((uint8_t*)ret_arr) + 8);
34999         for (size_t q = 0; q < ret_var.datalen; q++) {
35000                 LDKChannelDetails ret_conv_16_var = ret_var.data[q];
35001                 uint64_t ret_conv_16_ref = 0;
35002                 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_conv_16_var);
35003                 ret_conv_16_ref = tag_ptr(ret_conv_16_var.inner, ret_conv_16_var.is_owned);
35004                 ret_arr_ptr[q] = ret_conv_16_ref;
35005         }
35006         
35007         FREE(ret_var.data);
35008         return ret_arr;
35009 }
35010
35011 void  __attribute__((export_name("TS_PhantomRouteHints_set_channels"))) TS_PhantomRouteHints_set_channels(uint64_t this_ptr, uint64_tArray val) {
35012         LDKPhantomRouteHints this_ptr_conv;
35013         this_ptr_conv.inner = untag_ptr(this_ptr);
35014         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
35015         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
35016         this_ptr_conv.is_owned = false;
35017         LDKCVec_ChannelDetailsZ val_constr;
35018         val_constr.datalen = val->arr_len;
35019         if (val_constr.datalen > 0)
35020                 val_constr.data = MALLOC(val_constr.datalen * sizeof(LDKChannelDetails), "LDKCVec_ChannelDetailsZ Elements");
35021         else
35022                 val_constr.data = NULL;
35023         uint64_t* val_vals = val->elems;
35024         for (size_t q = 0; q < val_constr.datalen; q++) {
35025                 uint64_t val_conv_16 = val_vals[q];
35026                 LDKChannelDetails val_conv_16_conv;
35027                 val_conv_16_conv.inner = untag_ptr(val_conv_16);
35028                 val_conv_16_conv.is_owned = ptr_is_owned(val_conv_16);
35029                 CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv_16_conv);
35030                 val_conv_16_conv = ChannelDetails_clone(&val_conv_16_conv);
35031                 val_constr.data[q] = val_conv_16_conv;
35032         }
35033         FREE(val);
35034         PhantomRouteHints_set_channels(&this_ptr_conv, val_constr);
35035 }
35036
35037 int64_t  __attribute__((export_name("TS_PhantomRouteHints_get_phantom_scid"))) TS_PhantomRouteHints_get_phantom_scid(uint64_t this_ptr) {
35038         LDKPhantomRouteHints this_ptr_conv;
35039         this_ptr_conv.inner = untag_ptr(this_ptr);
35040         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
35041         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
35042         this_ptr_conv.is_owned = false;
35043         int64_t ret_conv = PhantomRouteHints_get_phantom_scid(&this_ptr_conv);
35044         return ret_conv;
35045 }
35046
35047 void  __attribute__((export_name("TS_PhantomRouteHints_set_phantom_scid"))) TS_PhantomRouteHints_set_phantom_scid(uint64_t this_ptr, int64_t val) {
35048         LDKPhantomRouteHints this_ptr_conv;
35049         this_ptr_conv.inner = untag_ptr(this_ptr);
35050         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
35051         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
35052         this_ptr_conv.is_owned = false;
35053         PhantomRouteHints_set_phantom_scid(&this_ptr_conv, val);
35054 }
35055
35056 int8_tArray  __attribute__((export_name("TS_PhantomRouteHints_get_real_node_pubkey"))) TS_PhantomRouteHints_get_real_node_pubkey(uint64_t this_ptr) {
35057         LDKPhantomRouteHints this_ptr_conv;
35058         this_ptr_conv.inner = untag_ptr(this_ptr);
35059         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
35060         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
35061         this_ptr_conv.is_owned = false;
35062         int8_tArray ret_arr = init_int8_tArray(33, __LINE__);
35063         memcpy(ret_arr->elems, PhantomRouteHints_get_real_node_pubkey(&this_ptr_conv).compressed_form, 33);
35064         return ret_arr;
35065 }
35066
35067 void  __attribute__((export_name("TS_PhantomRouteHints_set_real_node_pubkey"))) TS_PhantomRouteHints_set_real_node_pubkey(uint64_t this_ptr, int8_tArray val) {
35068         LDKPhantomRouteHints this_ptr_conv;
35069         this_ptr_conv.inner = untag_ptr(this_ptr);
35070         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
35071         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
35072         this_ptr_conv.is_owned = false;
35073         LDKPublicKey val_ref;
35074         CHECK(val->arr_len == 33);
35075         memcpy(val_ref.compressed_form, val->elems, 33); FREE(val);
35076         PhantomRouteHints_set_real_node_pubkey(&this_ptr_conv, val_ref);
35077 }
35078
35079 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) {
35080         LDKCVec_ChannelDetailsZ channels_arg_constr;
35081         channels_arg_constr.datalen = channels_arg->arr_len;
35082         if (channels_arg_constr.datalen > 0)
35083                 channels_arg_constr.data = MALLOC(channels_arg_constr.datalen * sizeof(LDKChannelDetails), "LDKCVec_ChannelDetailsZ Elements");
35084         else
35085                 channels_arg_constr.data = NULL;
35086         uint64_t* channels_arg_vals = channels_arg->elems;
35087         for (size_t q = 0; q < channels_arg_constr.datalen; q++) {
35088                 uint64_t channels_arg_conv_16 = channels_arg_vals[q];
35089                 LDKChannelDetails channels_arg_conv_16_conv;
35090                 channels_arg_conv_16_conv.inner = untag_ptr(channels_arg_conv_16);
35091                 channels_arg_conv_16_conv.is_owned = ptr_is_owned(channels_arg_conv_16);
35092                 CHECK_INNER_FIELD_ACCESS_OR_NULL(channels_arg_conv_16_conv);
35093                 channels_arg_conv_16_conv = ChannelDetails_clone(&channels_arg_conv_16_conv);
35094                 channels_arg_constr.data[q] = channels_arg_conv_16_conv;
35095         }
35096         FREE(channels_arg);
35097         LDKPublicKey real_node_pubkey_arg_ref;
35098         CHECK(real_node_pubkey_arg->arr_len == 33);
35099         memcpy(real_node_pubkey_arg_ref.compressed_form, real_node_pubkey_arg->elems, 33); FREE(real_node_pubkey_arg);
35100         LDKPhantomRouteHints ret_var = PhantomRouteHints_new(channels_arg_constr, phantom_scid_arg, real_node_pubkey_arg_ref);
35101         uint64_t ret_ref = 0;
35102         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
35103         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
35104         return ret_ref;
35105 }
35106
35107 static inline uint64_t PhantomRouteHints_clone_ptr(LDKPhantomRouteHints *NONNULL_PTR arg) {
35108         LDKPhantomRouteHints ret_var = PhantomRouteHints_clone(arg);
35109         uint64_t ret_ref = 0;
35110         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
35111         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
35112         return ret_ref;
35113 }
35114 int64_t  __attribute__((export_name("TS_PhantomRouteHints_clone_ptr"))) TS_PhantomRouteHints_clone_ptr(uint64_t arg) {
35115         LDKPhantomRouteHints arg_conv;
35116         arg_conv.inner = untag_ptr(arg);
35117         arg_conv.is_owned = ptr_is_owned(arg);
35118         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
35119         arg_conv.is_owned = false;
35120         int64_t ret_conv = PhantomRouteHints_clone_ptr(&arg_conv);
35121         return ret_conv;
35122 }
35123
35124 uint64_t  __attribute__((export_name("TS_PhantomRouteHints_clone"))) TS_PhantomRouteHints_clone(uint64_t orig) {
35125         LDKPhantomRouteHints orig_conv;
35126         orig_conv.inner = untag_ptr(orig);
35127         orig_conv.is_owned = ptr_is_owned(orig);
35128         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
35129         orig_conv.is_owned = false;
35130         LDKPhantomRouteHints ret_var = PhantomRouteHints_clone(&orig_conv);
35131         uint64_t ret_ref = 0;
35132         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
35133         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
35134         return ret_ref;
35135 }
35136
35137 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) {
35138         void* fee_est_ptr = untag_ptr(fee_est);
35139         CHECK_ACCESS(fee_est_ptr);
35140         LDKFeeEstimator fee_est_conv = *(LDKFeeEstimator*)(fee_est_ptr);
35141         if (fee_est_conv.free == LDKFeeEstimator_JCalls_free) {
35142                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
35143                 LDKFeeEstimator_JCalls_cloned(&fee_est_conv);
35144         }
35145         void* chain_monitor_ptr = untag_ptr(chain_monitor);
35146         CHECK_ACCESS(chain_monitor_ptr);
35147         LDKWatch chain_monitor_conv = *(LDKWatch*)(chain_monitor_ptr);
35148         if (chain_monitor_conv.free == LDKWatch_JCalls_free) {
35149                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
35150                 LDKWatch_JCalls_cloned(&chain_monitor_conv);
35151         }
35152         void* tx_broadcaster_ptr = untag_ptr(tx_broadcaster);
35153         CHECK_ACCESS(tx_broadcaster_ptr);
35154         LDKBroadcasterInterface tx_broadcaster_conv = *(LDKBroadcasterInterface*)(tx_broadcaster_ptr);
35155         if (tx_broadcaster_conv.free == LDKBroadcasterInterface_JCalls_free) {
35156                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
35157                 LDKBroadcasterInterface_JCalls_cloned(&tx_broadcaster_conv);
35158         }
35159         void* router_ptr = untag_ptr(router);
35160         CHECK_ACCESS(router_ptr);
35161         LDKRouter router_conv = *(LDKRouter*)(router_ptr);
35162         if (router_conv.free == LDKRouter_JCalls_free) {
35163                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
35164                 LDKRouter_JCalls_cloned(&router_conv);
35165         }
35166         void* logger_ptr = untag_ptr(logger);
35167         CHECK_ACCESS(logger_ptr);
35168         LDKLogger logger_conv = *(LDKLogger*)(logger_ptr);
35169         if (logger_conv.free == LDKLogger_JCalls_free) {
35170                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
35171                 LDKLogger_JCalls_cloned(&logger_conv);
35172         }
35173         void* entropy_source_ptr = untag_ptr(entropy_source);
35174         CHECK_ACCESS(entropy_source_ptr);
35175         LDKEntropySource entropy_source_conv = *(LDKEntropySource*)(entropy_source_ptr);
35176         if (entropy_source_conv.free == LDKEntropySource_JCalls_free) {
35177                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
35178                 LDKEntropySource_JCalls_cloned(&entropy_source_conv);
35179         }
35180         void* node_signer_ptr = untag_ptr(node_signer);
35181         CHECK_ACCESS(node_signer_ptr);
35182         LDKNodeSigner node_signer_conv = *(LDKNodeSigner*)(node_signer_ptr);
35183         if (node_signer_conv.free == LDKNodeSigner_JCalls_free) {
35184                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
35185                 LDKNodeSigner_JCalls_cloned(&node_signer_conv);
35186         }
35187         void* signer_provider_ptr = untag_ptr(signer_provider);
35188         CHECK_ACCESS(signer_provider_ptr);
35189         LDKSignerProvider signer_provider_conv = *(LDKSignerProvider*)(signer_provider_ptr);
35190         if (signer_provider_conv.free == LDKSignerProvider_JCalls_free) {
35191                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
35192                 LDKSignerProvider_JCalls_cloned(&signer_provider_conv);
35193         }
35194         LDKUserConfig config_conv;
35195         config_conv.inner = untag_ptr(config);
35196         config_conv.is_owned = ptr_is_owned(config);
35197         CHECK_INNER_FIELD_ACCESS_OR_NULL(config_conv);
35198         config_conv = UserConfig_clone(&config_conv);
35199         LDKChainParameters params_conv;
35200         params_conv.inner = untag_ptr(params);
35201         params_conv.is_owned = ptr_is_owned(params);
35202         CHECK_INNER_FIELD_ACCESS_OR_NULL(params_conv);
35203         params_conv = ChainParameters_clone(&params_conv);
35204         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);
35205         uint64_t ret_ref = 0;
35206         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
35207         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
35208         return ret_ref;
35209 }
35210
35211 uint64_t  __attribute__((export_name("TS_ChannelManager_get_current_default_configuration"))) TS_ChannelManager_get_current_default_configuration(uint64_t this_arg) {
35212         LDKChannelManager this_arg_conv;
35213         this_arg_conv.inner = untag_ptr(this_arg);
35214         this_arg_conv.is_owned = ptr_is_owned(this_arg);
35215         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
35216         this_arg_conv.is_owned = false;
35217         LDKUserConfig ret_var = ChannelManager_get_current_default_configuration(&this_arg_conv);
35218         uint64_t ret_ref = 0;
35219         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
35220         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
35221         return ret_ref;
35222 }
35223
35224 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) {
35225         LDKChannelManager this_arg_conv;
35226         this_arg_conv.inner = untag_ptr(this_arg);
35227         this_arg_conv.is_owned = ptr_is_owned(this_arg);
35228         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
35229         this_arg_conv.is_owned = false;
35230         LDKPublicKey their_network_key_ref;
35231         CHECK(their_network_key->arr_len == 33);
35232         memcpy(their_network_key_ref.compressed_form, their_network_key->elems, 33); FREE(their_network_key);
35233         LDKU128 user_channel_id_ref;
35234         CHECK(user_channel_id->arr_len == 16);
35235         memcpy(user_channel_id_ref.le_bytes, user_channel_id->elems, 16); FREE(user_channel_id);
35236         LDKUserConfig override_config_conv;
35237         override_config_conv.inner = untag_ptr(override_config);
35238         override_config_conv.is_owned = ptr_is_owned(override_config);
35239         CHECK_INNER_FIELD_ACCESS_OR_NULL(override_config_conv);
35240         override_config_conv = UserConfig_clone(&override_config_conv);
35241         LDKCResult_ThirtyTwoBytesAPIErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ThirtyTwoBytesAPIErrorZ), "LDKCResult_ThirtyTwoBytesAPIErrorZ");
35242         *ret_conv = ChannelManager_create_channel(&this_arg_conv, their_network_key_ref, channel_value_satoshis, push_msat, user_channel_id_ref, override_config_conv);
35243         return tag_ptr(ret_conv, true);
35244 }
35245
35246 uint64_tArray  __attribute__((export_name("TS_ChannelManager_list_channels"))) TS_ChannelManager_list_channels(uint64_t this_arg) {
35247         LDKChannelManager this_arg_conv;
35248         this_arg_conv.inner = untag_ptr(this_arg);
35249         this_arg_conv.is_owned = ptr_is_owned(this_arg);
35250         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
35251         this_arg_conv.is_owned = false;
35252         LDKCVec_ChannelDetailsZ ret_var = ChannelManager_list_channels(&this_arg_conv);
35253         uint64_tArray ret_arr = NULL;
35254         ret_arr = init_uint64_tArray(ret_var.datalen, __LINE__);
35255         uint64_t *ret_arr_ptr = (uint64_t*)(((uint8_t*)ret_arr) + 8);
35256         for (size_t q = 0; q < ret_var.datalen; q++) {
35257                 LDKChannelDetails ret_conv_16_var = ret_var.data[q];
35258                 uint64_t ret_conv_16_ref = 0;
35259                 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_conv_16_var);
35260                 ret_conv_16_ref = tag_ptr(ret_conv_16_var.inner, ret_conv_16_var.is_owned);
35261                 ret_arr_ptr[q] = ret_conv_16_ref;
35262         }
35263         
35264         FREE(ret_var.data);
35265         return ret_arr;
35266 }
35267
35268 uint64_tArray  __attribute__((export_name("TS_ChannelManager_list_usable_channels"))) TS_ChannelManager_list_usable_channels(uint64_t this_arg) {
35269         LDKChannelManager this_arg_conv;
35270         this_arg_conv.inner = untag_ptr(this_arg);
35271         this_arg_conv.is_owned = ptr_is_owned(this_arg);
35272         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
35273         this_arg_conv.is_owned = false;
35274         LDKCVec_ChannelDetailsZ ret_var = ChannelManager_list_usable_channels(&this_arg_conv);
35275         uint64_tArray ret_arr = NULL;
35276         ret_arr = init_uint64_tArray(ret_var.datalen, __LINE__);
35277         uint64_t *ret_arr_ptr = (uint64_t*)(((uint8_t*)ret_arr) + 8);
35278         for (size_t q = 0; q < ret_var.datalen; q++) {
35279                 LDKChannelDetails ret_conv_16_var = ret_var.data[q];
35280                 uint64_t ret_conv_16_ref = 0;
35281                 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_conv_16_var);
35282                 ret_conv_16_ref = tag_ptr(ret_conv_16_var.inner, ret_conv_16_var.is_owned);
35283                 ret_arr_ptr[q] = ret_conv_16_ref;
35284         }
35285         
35286         FREE(ret_var.data);
35287         return ret_arr;
35288 }
35289
35290 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) {
35291         LDKChannelManager this_arg_conv;
35292         this_arg_conv.inner = untag_ptr(this_arg);
35293         this_arg_conv.is_owned = ptr_is_owned(this_arg);
35294         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
35295         this_arg_conv.is_owned = false;
35296         LDKPublicKey counterparty_node_id_ref;
35297         CHECK(counterparty_node_id->arr_len == 33);
35298         memcpy(counterparty_node_id_ref.compressed_form, counterparty_node_id->elems, 33); FREE(counterparty_node_id);
35299         LDKCVec_ChannelDetailsZ ret_var = ChannelManager_list_channels_with_counterparty(&this_arg_conv, counterparty_node_id_ref);
35300         uint64_tArray ret_arr = NULL;
35301         ret_arr = init_uint64_tArray(ret_var.datalen, __LINE__);
35302         uint64_t *ret_arr_ptr = (uint64_t*)(((uint8_t*)ret_arr) + 8);
35303         for (size_t q = 0; q < ret_var.datalen; q++) {
35304                 LDKChannelDetails ret_conv_16_var = ret_var.data[q];
35305                 uint64_t ret_conv_16_ref = 0;
35306                 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_conv_16_var);
35307                 ret_conv_16_ref = tag_ptr(ret_conv_16_var.inner, ret_conv_16_var.is_owned);
35308                 ret_arr_ptr[q] = ret_conv_16_ref;
35309         }
35310         
35311         FREE(ret_var.data);
35312         return ret_arr;
35313 }
35314
35315 uint64_tArray  __attribute__((export_name("TS_ChannelManager_list_recent_payments"))) TS_ChannelManager_list_recent_payments(uint64_t this_arg) {
35316         LDKChannelManager this_arg_conv;
35317         this_arg_conv.inner = untag_ptr(this_arg);
35318         this_arg_conv.is_owned = ptr_is_owned(this_arg);
35319         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
35320         this_arg_conv.is_owned = false;
35321         LDKCVec_RecentPaymentDetailsZ ret_var = ChannelManager_list_recent_payments(&this_arg_conv);
35322         uint64_tArray ret_arr = NULL;
35323         ret_arr = init_uint64_tArray(ret_var.datalen, __LINE__);
35324         uint64_t *ret_arr_ptr = (uint64_t*)(((uint8_t*)ret_arr) + 8);
35325         for (size_t w = 0; w < ret_var.datalen; w++) {
35326                 LDKRecentPaymentDetails *ret_conv_22_copy = MALLOC(sizeof(LDKRecentPaymentDetails), "LDKRecentPaymentDetails");
35327                 *ret_conv_22_copy = ret_var.data[w];
35328                 uint64_t ret_conv_22_ref = tag_ptr(ret_conv_22_copy, true);
35329                 ret_arr_ptr[w] = ret_conv_22_ref;
35330         }
35331         
35332         FREE(ret_var.data);
35333         return ret_arr;
35334 }
35335
35336 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) {
35337         LDKChannelManager this_arg_conv;
35338         this_arg_conv.inner = untag_ptr(this_arg);
35339         this_arg_conv.is_owned = ptr_is_owned(this_arg);
35340         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
35341         this_arg_conv.is_owned = false;
35342         uint8_t channel_id_arr[32];
35343         CHECK(channel_id->arr_len == 32);
35344         memcpy(channel_id_arr, channel_id->elems, 32); FREE(channel_id);
35345         uint8_t (*channel_id_ref)[32] = &channel_id_arr;
35346         LDKPublicKey counterparty_node_id_ref;
35347         CHECK(counterparty_node_id->arr_len == 33);
35348         memcpy(counterparty_node_id_ref.compressed_form, counterparty_node_id->elems, 33); FREE(counterparty_node_id);
35349         LDKCResult_NoneAPIErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneAPIErrorZ), "LDKCResult_NoneAPIErrorZ");
35350         *ret_conv = ChannelManager_close_channel(&this_arg_conv, channel_id_ref, counterparty_node_id_ref);
35351         return tag_ptr(ret_conv, true);
35352 }
35353
35354 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) {
35355         LDKChannelManager this_arg_conv;
35356         this_arg_conv.inner = untag_ptr(this_arg);
35357         this_arg_conv.is_owned = ptr_is_owned(this_arg);
35358         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
35359         this_arg_conv.is_owned = false;
35360         uint8_t channel_id_arr[32];
35361         CHECK(channel_id->arr_len == 32);
35362         memcpy(channel_id_arr, channel_id->elems, 32); FREE(channel_id);
35363         uint8_t (*channel_id_ref)[32] = &channel_id_arr;
35364         LDKPublicKey counterparty_node_id_ref;
35365         CHECK(counterparty_node_id->arr_len == 33);
35366         memcpy(counterparty_node_id_ref.compressed_form, counterparty_node_id->elems, 33); FREE(counterparty_node_id);
35367         void* target_feerate_sats_per_1000_weight_ptr = untag_ptr(target_feerate_sats_per_1000_weight);
35368         CHECK_ACCESS(target_feerate_sats_per_1000_weight_ptr);
35369         LDKCOption_u32Z target_feerate_sats_per_1000_weight_conv = *(LDKCOption_u32Z*)(target_feerate_sats_per_1000_weight_ptr);
35370         target_feerate_sats_per_1000_weight_conv = COption_u32Z_clone((LDKCOption_u32Z*)untag_ptr(target_feerate_sats_per_1000_weight));
35371         LDKShutdownScript shutdown_script_conv;
35372         shutdown_script_conv.inner = untag_ptr(shutdown_script);
35373         shutdown_script_conv.is_owned = ptr_is_owned(shutdown_script);
35374         CHECK_INNER_FIELD_ACCESS_OR_NULL(shutdown_script_conv);
35375         shutdown_script_conv = ShutdownScript_clone(&shutdown_script_conv);
35376         LDKCResult_NoneAPIErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneAPIErrorZ), "LDKCResult_NoneAPIErrorZ");
35377         *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);
35378         return tag_ptr(ret_conv, true);
35379 }
35380
35381 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) {
35382         LDKChannelManager this_arg_conv;
35383         this_arg_conv.inner = untag_ptr(this_arg);
35384         this_arg_conv.is_owned = ptr_is_owned(this_arg);
35385         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
35386         this_arg_conv.is_owned = false;
35387         uint8_t channel_id_arr[32];
35388         CHECK(channel_id->arr_len == 32);
35389         memcpy(channel_id_arr, channel_id->elems, 32); FREE(channel_id);
35390         uint8_t (*channel_id_ref)[32] = &channel_id_arr;
35391         LDKPublicKey counterparty_node_id_ref;
35392         CHECK(counterparty_node_id->arr_len == 33);
35393         memcpy(counterparty_node_id_ref.compressed_form, counterparty_node_id->elems, 33); FREE(counterparty_node_id);
35394         LDKCResult_NoneAPIErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneAPIErrorZ), "LDKCResult_NoneAPIErrorZ");
35395         *ret_conv = ChannelManager_force_close_broadcasting_latest_txn(&this_arg_conv, channel_id_ref, counterparty_node_id_ref);
35396         return tag_ptr(ret_conv, true);
35397 }
35398
35399 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) {
35400         LDKChannelManager this_arg_conv;
35401         this_arg_conv.inner = untag_ptr(this_arg);
35402         this_arg_conv.is_owned = ptr_is_owned(this_arg);
35403         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
35404         this_arg_conv.is_owned = false;
35405         uint8_t channel_id_arr[32];
35406         CHECK(channel_id->arr_len == 32);
35407         memcpy(channel_id_arr, channel_id->elems, 32); FREE(channel_id);
35408         uint8_t (*channel_id_ref)[32] = &channel_id_arr;
35409         LDKPublicKey counterparty_node_id_ref;
35410         CHECK(counterparty_node_id->arr_len == 33);
35411         memcpy(counterparty_node_id_ref.compressed_form, counterparty_node_id->elems, 33); FREE(counterparty_node_id);
35412         LDKCResult_NoneAPIErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneAPIErrorZ), "LDKCResult_NoneAPIErrorZ");
35413         *ret_conv = ChannelManager_force_close_without_broadcasting_txn(&this_arg_conv, channel_id_ref, counterparty_node_id_ref);
35414         return tag_ptr(ret_conv, true);
35415 }
35416
35417 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) {
35418         LDKChannelManager this_arg_conv;
35419         this_arg_conv.inner = untag_ptr(this_arg);
35420         this_arg_conv.is_owned = ptr_is_owned(this_arg);
35421         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
35422         this_arg_conv.is_owned = false;
35423         ChannelManager_force_close_all_channels_broadcasting_latest_txn(&this_arg_conv);
35424 }
35425
35426 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) {
35427         LDKChannelManager this_arg_conv;
35428         this_arg_conv.inner = untag_ptr(this_arg);
35429         this_arg_conv.is_owned = ptr_is_owned(this_arg);
35430         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
35431         this_arg_conv.is_owned = false;
35432         ChannelManager_force_close_all_channels_without_broadcasting_txn(&this_arg_conv);
35433 }
35434
35435 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) {
35436         LDKChannelManager this_arg_conv;
35437         this_arg_conv.inner = untag_ptr(this_arg);
35438         this_arg_conv.is_owned = ptr_is_owned(this_arg);
35439         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
35440         this_arg_conv.is_owned = false;
35441         LDKRoute route_conv;
35442         route_conv.inner = untag_ptr(route);
35443         route_conv.is_owned = ptr_is_owned(route);
35444         CHECK_INNER_FIELD_ACCESS_OR_NULL(route_conv);
35445         route_conv.is_owned = false;
35446         LDKThirtyTwoBytes payment_hash_ref;
35447         CHECK(payment_hash->arr_len == 32);
35448         memcpy(payment_hash_ref.data, payment_hash->elems, 32); FREE(payment_hash);
35449         LDKRecipientOnionFields recipient_onion_conv;
35450         recipient_onion_conv.inner = untag_ptr(recipient_onion);
35451         recipient_onion_conv.is_owned = ptr_is_owned(recipient_onion);
35452         CHECK_INNER_FIELD_ACCESS_OR_NULL(recipient_onion_conv);
35453         recipient_onion_conv = RecipientOnionFields_clone(&recipient_onion_conv);
35454         LDKThirtyTwoBytes payment_id_ref;
35455         CHECK(payment_id->arr_len == 32);
35456         memcpy(payment_id_ref.data, payment_id->elems, 32); FREE(payment_id);
35457         LDKCResult_NonePaymentSendFailureZ* ret_conv = MALLOC(sizeof(LDKCResult_NonePaymentSendFailureZ), "LDKCResult_NonePaymentSendFailureZ");
35458         *ret_conv = ChannelManager_send_payment_with_route(&this_arg_conv, &route_conv, payment_hash_ref, recipient_onion_conv, payment_id_ref);
35459         return tag_ptr(ret_conv, true);
35460 }
35461
35462 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) {
35463         LDKChannelManager this_arg_conv;
35464         this_arg_conv.inner = untag_ptr(this_arg);
35465         this_arg_conv.is_owned = ptr_is_owned(this_arg);
35466         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
35467         this_arg_conv.is_owned = false;
35468         LDKThirtyTwoBytes payment_hash_ref;
35469         CHECK(payment_hash->arr_len == 32);
35470         memcpy(payment_hash_ref.data, payment_hash->elems, 32); FREE(payment_hash);
35471         LDKRecipientOnionFields recipient_onion_conv;
35472         recipient_onion_conv.inner = untag_ptr(recipient_onion);
35473         recipient_onion_conv.is_owned = ptr_is_owned(recipient_onion);
35474         CHECK_INNER_FIELD_ACCESS_OR_NULL(recipient_onion_conv);
35475         recipient_onion_conv = RecipientOnionFields_clone(&recipient_onion_conv);
35476         LDKThirtyTwoBytes payment_id_ref;
35477         CHECK(payment_id->arr_len == 32);
35478         memcpy(payment_id_ref.data, payment_id->elems, 32); FREE(payment_id);
35479         LDKRouteParameters route_params_conv;
35480         route_params_conv.inner = untag_ptr(route_params);
35481         route_params_conv.is_owned = ptr_is_owned(route_params);
35482         CHECK_INNER_FIELD_ACCESS_OR_NULL(route_params_conv);
35483         route_params_conv = RouteParameters_clone(&route_params_conv);
35484         void* retry_strategy_ptr = untag_ptr(retry_strategy);
35485         CHECK_ACCESS(retry_strategy_ptr);
35486         LDKRetry retry_strategy_conv = *(LDKRetry*)(retry_strategy_ptr);
35487         retry_strategy_conv = Retry_clone((LDKRetry*)untag_ptr(retry_strategy));
35488         LDKCResult_NoneRetryableSendFailureZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneRetryableSendFailureZ), "LDKCResult_NoneRetryableSendFailureZ");
35489         *ret_conv = ChannelManager_send_payment(&this_arg_conv, payment_hash_ref, recipient_onion_conv, payment_id_ref, route_params_conv, retry_strategy_conv);
35490         return tag_ptr(ret_conv, true);
35491 }
35492
35493 void  __attribute__((export_name("TS_ChannelManager_abandon_payment"))) TS_ChannelManager_abandon_payment(uint64_t this_arg, int8_tArray payment_id) {
35494         LDKChannelManager this_arg_conv;
35495         this_arg_conv.inner = untag_ptr(this_arg);
35496         this_arg_conv.is_owned = ptr_is_owned(this_arg);
35497         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
35498         this_arg_conv.is_owned = false;
35499         LDKThirtyTwoBytes payment_id_ref;
35500         CHECK(payment_id->arr_len == 32);
35501         memcpy(payment_id_ref.data, payment_id->elems, 32); FREE(payment_id);
35502         ChannelManager_abandon_payment(&this_arg_conv, payment_id_ref);
35503 }
35504
35505 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) {
35506         LDKChannelManager this_arg_conv;
35507         this_arg_conv.inner = untag_ptr(this_arg);
35508         this_arg_conv.is_owned = ptr_is_owned(this_arg);
35509         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
35510         this_arg_conv.is_owned = false;
35511         LDKRoute route_conv;
35512         route_conv.inner = untag_ptr(route);
35513         route_conv.is_owned = ptr_is_owned(route);
35514         CHECK_INNER_FIELD_ACCESS_OR_NULL(route_conv);
35515         route_conv.is_owned = false;
35516         void* payment_preimage_ptr = untag_ptr(payment_preimage);
35517         CHECK_ACCESS(payment_preimage_ptr);
35518         LDKCOption_ThirtyTwoBytesZ payment_preimage_conv = *(LDKCOption_ThirtyTwoBytesZ*)(payment_preimage_ptr);
35519         payment_preimage_conv = COption_ThirtyTwoBytesZ_clone((LDKCOption_ThirtyTwoBytesZ*)untag_ptr(payment_preimage));
35520         LDKRecipientOnionFields recipient_onion_conv;
35521         recipient_onion_conv.inner = untag_ptr(recipient_onion);
35522         recipient_onion_conv.is_owned = ptr_is_owned(recipient_onion);
35523         CHECK_INNER_FIELD_ACCESS_OR_NULL(recipient_onion_conv);
35524         recipient_onion_conv = RecipientOnionFields_clone(&recipient_onion_conv);
35525         LDKThirtyTwoBytes payment_id_ref;
35526         CHECK(payment_id->arr_len == 32);
35527         memcpy(payment_id_ref.data, payment_id->elems, 32); FREE(payment_id);
35528         LDKCResult_ThirtyTwoBytesPaymentSendFailureZ* ret_conv = MALLOC(sizeof(LDKCResult_ThirtyTwoBytesPaymentSendFailureZ), "LDKCResult_ThirtyTwoBytesPaymentSendFailureZ");
35529         *ret_conv = ChannelManager_send_spontaneous_payment(&this_arg_conv, &route_conv, payment_preimage_conv, recipient_onion_conv, payment_id_ref);
35530         return tag_ptr(ret_conv, true);
35531 }
35532
35533 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) {
35534         LDKChannelManager this_arg_conv;
35535         this_arg_conv.inner = untag_ptr(this_arg);
35536         this_arg_conv.is_owned = ptr_is_owned(this_arg);
35537         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
35538         this_arg_conv.is_owned = false;
35539         void* payment_preimage_ptr = untag_ptr(payment_preimage);
35540         CHECK_ACCESS(payment_preimage_ptr);
35541         LDKCOption_ThirtyTwoBytesZ payment_preimage_conv = *(LDKCOption_ThirtyTwoBytesZ*)(payment_preimage_ptr);
35542         payment_preimage_conv = COption_ThirtyTwoBytesZ_clone((LDKCOption_ThirtyTwoBytesZ*)untag_ptr(payment_preimage));
35543         LDKRecipientOnionFields recipient_onion_conv;
35544         recipient_onion_conv.inner = untag_ptr(recipient_onion);
35545         recipient_onion_conv.is_owned = ptr_is_owned(recipient_onion);
35546         CHECK_INNER_FIELD_ACCESS_OR_NULL(recipient_onion_conv);
35547         recipient_onion_conv = RecipientOnionFields_clone(&recipient_onion_conv);
35548         LDKThirtyTwoBytes payment_id_ref;
35549         CHECK(payment_id->arr_len == 32);
35550         memcpy(payment_id_ref.data, payment_id->elems, 32); FREE(payment_id);
35551         LDKRouteParameters route_params_conv;
35552         route_params_conv.inner = untag_ptr(route_params);
35553         route_params_conv.is_owned = ptr_is_owned(route_params);
35554         CHECK_INNER_FIELD_ACCESS_OR_NULL(route_params_conv);
35555         route_params_conv = RouteParameters_clone(&route_params_conv);
35556         void* retry_strategy_ptr = untag_ptr(retry_strategy);
35557         CHECK_ACCESS(retry_strategy_ptr);
35558         LDKRetry retry_strategy_conv = *(LDKRetry*)(retry_strategy_ptr);
35559         retry_strategy_conv = Retry_clone((LDKRetry*)untag_ptr(retry_strategy));
35560         LDKCResult_ThirtyTwoBytesRetryableSendFailureZ* ret_conv = MALLOC(sizeof(LDKCResult_ThirtyTwoBytesRetryableSendFailureZ), "LDKCResult_ThirtyTwoBytesRetryableSendFailureZ");
35561         *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);
35562         return tag_ptr(ret_conv, true);
35563 }
35564
35565 uint64_t  __attribute__((export_name("TS_ChannelManager_send_probe"))) TS_ChannelManager_send_probe(uint64_t this_arg, uint64_t path) {
35566         LDKChannelManager this_arg_conv;
35567         this_arg_conv.inner = untag_ptr(this_arg);
35568         this_arg_conv.is_owned = ptr_is_owned(this_arg);
35569         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
35570         this_arg_conv.is_owned = false;
35571         LDKPath path_conv;
35572         path_conv.inner = untag_ptr(path);
35573         path_conv.is_owned = ptr_is_owned(path);
35574         CHECK_INNER_FIELD_ACCESS_OR_NULL(path_conv);
35575         path_conv = Path_clone(&path_conv);
35576         LDKCResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZPaymentSendFailureZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZPaymentSendFailureZ), "LDKCResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZPaymentSendFailureZ");
35577         *ret_conv = ChannelManager_send_probe(&this_arg_conv, path_conv);
35578         return tag_ptr(ret_conv, true);
35579 }
35580
35581 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) {
35582         LDKChannelManager this_arg_conv;
35583         this_arg_conv.inner = untag_ptr(this_arg);
35584         this_arg_conv.is_owned = ptr_is_owned(this_arg);
35585         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
35586         this_arg_conv.is_owned = false;
35587         LDKPublicKey node_id_ref;
35588         CHECK(node_id->arr_len == 33);
35589         memcpy(node_id_ref.compressed_form, node_id->elems, 33); FREE(node_id);
35590         void* liquidity_limit_multiplier_ptr = untag_ptr(liquidity_limit_multiplier);
35591         CHECK_ACCESS(liquidity_limit_multiplier_ptr);
35592         LDKCOption_u64Z liquidity_limit_multiplier_conv = *(LDKCOption_u64Z*)(liquidity_limit_multiplier_ptr);
35593         liquidity_limit_multiplier_conv = COption_u64Z_clone((LDKCOption_u64Z*)untag_ptr(liquidity_limit_multiplier));
35594         LDKCResult_CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZProbeSendFailureZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZProbeSendFailureZ), "LDKCResult_CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZProbeSendFailureZ");
35595         *ret_conv = ChannelManager_send_spontaneous_preflight_probes(&this_arg_conv, node_id_ref, amount_msat, final_cltv_expiry_delta, liquidity_limit_multiplier_conv);
35596         return tag_ptr(ret_conv, true);
35597 }
35598
35599 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) {
35600         LDKChannelManager this_arg_conv;
35601         this_arg_conv.inner = untag_ptr(this_arg);
35602         this_arg_conv.is_owned = ptr_is_owned(this_arg);
35603         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
35604         this_arg_conv.is_owned = false;
35605         LDKRouteParameters route_params_conv;
35606         route_params_conv.inner = untag_ptr(route_params);
35607         route_params_conv.is_owned = ptr_is_owned(route_params);
35608         CHECK_INNER_FIELD_ACCESS_OR_NULL(route_params_conv);
35609         route_params_conv = RouteParameters_clone(&route_params_conv);
35610         void* liquidity_limit_multiplier_ptr = untag_ptr(liquidity_limit_multiplier);
35611         CHECK_ACCESS(liquidity_limit_multiplier_ptr);
35612         LDKCOption_u64Z liquidity_limit_multiplier_conv = *(LDKCOption_u64Z*)(liquidity_limit_multiplier_ptr);
35613         liquidity_limit_multiplier_conv = COption_u64Z_clone((LDKCOption_u64Z*)untag_ptr(liquidity_limit_multiplier));
35614         LDKCResult_CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZProbeSendFailureZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZProbeSendFailureZ), "LDKCResult_CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZProbeSendFailureZ");
35615         *ret_conv = ChannelManager_send_preflight_probes(&this_arg_conv, route_params_conv, liquidity_limit_multiplier_conv);
35616         return tag_ptr(ret_conv, true);
35617 }
35618
35619 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) {
35620         LDKChannelManager this_arg_conv;
35621         this_arg_conv.inner = untag_ptr(this_arg);
35622         this_arg_conv.is_owned = ptr_is_owned(this_arg);
35623         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
35624         this_arg_conv.is_owned = false;
35625         uint8_t temporary_channel_id_arr[32];
35626         CHECK(temporary_channel_id->arr_len == 32);
35627         memcpy(temporary_channel_id_arr, temporary_channel_id->elems, 32); FREE(temporary_channel_id);
35628         uint8_t (*temporary_channel_id_ref)[32] = &temporary_channel_id_arr;
35629         LDKPublicKey counterparty_node_id_ref;
35630         CHECK(counterparty_node_id->arr_len == 33);
35631         memcpy(counterparty_node_id_ref.compressed_form, counterparty_node_id->elems, 33); FREE(counterparty_node_id);
35632         LDKTransaction funding_transaction_ref;
35633         funding_transaction_ref.datalen = funding_transaction->arr_len;
35634         funding_transaction_ref.data = MALLOC(funding_transaction_ref.datalen, "LDKTransaction Bytes");
35635         memcpy(funding_transaction_ref.data, funding_transaction->elems, funding_transaction_ref.datalen); FREE(funding_transaction);
35636         funding_transaction_ref.data_is_owned = true;
35637         LDKCResult_NoneAPIErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneAPIErrorZ), "LDKCResult_NoneAPIErrorZ");
35638         *ret_conv = ChannelManager_funding_transaction_generated(&this_arg_conv, temporary_channel_id_ref, counterparty_node_id_ref, funding_transaction_ref);
35639         return tag_ptr(ret_conv, true);
35640 }
35641
35642 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) {
35643         LDKChannelManager this_arg_conv;
35644         this_arg_conv.inner = untag_ptr(this_arg);
35645         this_arg_conv.is_owned = ptr_is_owned(this_arg);
35646         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
35647         this_arg_conv.is_owned = false;
35648         LDKCVec_C2Tuple_ThirtyTwoBytesPublicKeyZZ temporary_channels_constr;
35649         temporary_channels_constr.datalen = temporary_channels->arr_len;
35650         if (temporary_channels_constr.datalen > 0)
35651                 temporary_channels_constr.data = MALLOC(temporary_channels_constr.datalen * sizeof(LDKC2Tuple_ThirtyTwoBytesPublicKeyZ), "LDKCVec_C2Tuple_ThirtyTwoBytesPublicKeyZZ Elements");
35652         else
35653                 temporary_channels_constr.data = NULL;
35654         uint64_t* temporary_channels_vals = temporary_channels->elems;
35655         for (size_t j = 0; j < temporary_channels_constr.datalen; j++) {
35656                 uint64_t temporary_channels_conv_35 = temporary_channels_vals[j];
35657                 void* temporary_channels_conv_35_ptr = untag_ptr(temporary_channels_conv_35);
35658                 CHECK_ACCESS(temporary_channels_conv_35_ptr);
35659                 LDKC2Tuple_ThirtyTwoBytesPublicKeyZ temporary_channels_conv_35_conv = *(LDKC2Tuple_ThirtyTwoBytesPublicKeyZ*)(temporary_channels_conv_35_ptr);
35660                 temporary_channels_conv_35_conv = C2Tuple_ThirtyTwoBytesPublicKeyZ_clone((LDKC2Tuple_ThirtyTwoBytesPublicKeyZ*)untag_ptr(temporary_channels_conv_35));
35661                 temporary_channels_constr.data[j] = temporary_channels_conv_35_conv;
35662         }
35663         FREE(temporary_channels);
35664         LDKTransaction funding_transaction_ref;
35665         funding_transaction_ref.datalen = funding_transaction->arr_len;
35666         funding_transaction_ref.data = MALLOC(funding_transaction_ref.datalen, "LDKTransaction Bytes");
35667         memcpy(funding_transaction_ref.data, funding_transaction->elems, funding_transaction_ref.datalen); FREE(funding_transaction);
35668         funding_transaction_ref.data_is_owned = true;
35669         LDKCResult_NoneAPIErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneAPIErrorZ), "LDKCResult_NoneAPIErrorZ");
35670         *ret_conv = ChannelManager_batch_funding_transaction_generated(&this_arg_conv, temporary_channels_constr, funding_transaction_ref);
35671         return tag_ptr(ret_conv, true);
35672 }
35673
35674 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) {
35675         LDKChannelManager this_arg_conv;
35676         this_arg_conv.inner = untag_ptr(this_arg);
35677         this_arg_conv.is_owned = ptr_is_owned(this_arg);
35678         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
35679         this_arg_conv.is_owned = false;
35680         LDKPublicKey counterparty_node_id_ref;
35681         CHECK(counterparty_node_id->arr_len == 33);
35682         memcpy(counterparty_node_id_ref.compressed_form, counterparty_node_id->elems, 33); FREE(counterparty_node_id);
35683         LDKCVec_ThirtyTwoBytesZ channel_ids_constr;
35684         channel_ids_constr.datalen = channel_ids->arr_len;
35685         if (channel_ids_constr.datalen > 0)
35686                 channel_ids_constr.data = MALLOC(channel_ids_constr.datalen * sizeof(LDKThirtyTwoBytes), "LDKCVec_ThirtyTwoBytesZ Elements");
35687         else
35688                 channel_ids_constr.data = NULL;
35689         int8_tArray* channel_ids_vals = (void*) channel_ids->elems;
35690         for (size_t m = 0; m < channel_ids_constr.datalen; m++) {
35691                 int8_tArray channel_ids_conv_12 = channel_ids_vals[m];
35692                 LDKThirtyTwoBytes channel_ids_conv_12_ref;
35693                 CHECK(channel_ids_conv_12->arr_len == 32);
35694                 memcpy(channel_ids_conv_12_ref.data, channel_ids_conv_12->elems, 32); FREE(channel_ids_conv_12);
35695                 channel_ids_constr.data[m] = channel_ids_conv_12_ref;
35696         }
35697         FREE(channel_ids);
35698         LDKChannelConfigUpdate config_update_conv;
35699         config_update_conv.inner = untag_ptr(config_update);
35700         config_update_conv.is_owned = ptr_is_owned(config_update);
35701         CHECK_INNER_FIELD_ACCESS_OR_NULL(config_update_conv);
35702         config_update_conv.is_owned = false;
35703         LDKCResult_NoneAPIErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneAPIErrorZ), "LDKCResult_NoneAPIErrorZ");
35704         *ret_conv = ChannelManager_update_partial_channel_config(&this_arg_conv, counterparty_node_id_ref, channel_ids_constr, &config_update_conv);
35705         return tag_ptr(ret_conv, true);
35706 }
35707
35708 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) {
35709         LDKChannelManager this_arg_conv;
35710         this_arg_conv.inner = untag_ptr(this_arg);
35711         this_arg_conv.is_owned = ptr_is_owned(this_arg);
35712         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
35713         this_arg_conv.is_owned = false;
35714         LDKPublicKey counterparty_node_id_ref;
35715         CHECK(counterparty_node_id->arr_len == 33);
35716         memcpy(counterparty_node_id_ref.compressed_form, counterparty_node_id->elems, 33); FREE(counterparty_node_id);
35717         LDKCVec_ThirtyTwoBytesZ channel_ids_constr;
35718         channel_ids_constr.datalen = channel_ids->arr_len;
35719         if (channel_ids_constr.datalen > 0)
35720                 channel_ids_constr.data = MALLOC(channel_ids_constr.datalen * sizeof(LDKThirtyTwoBytes), "LDKCVec_ThirtyTwoBytesZ Elements");
35721         else
35722                 channel_ids_constr.data = NULL;
35723         int8_tArray* channel_ids_vals = (void*) channel_ids->elems;
35724         for (size_t m = 0; m < channel_ids_constr.datalen; m++) {
35725                 int8_tArray channel_ids_conv_12 = channel_ids_vals[m];
35726                 LDKThirtyTwoBytes channel_ids_conv_12_ref;
35727                 CHECK(channel_ids_conv_12->arr_len == 32);
35728                 memcpy(channel_ids_conv_12_ref.data, channel_ids_conv_12->elems, 32); FREE(channel_ids_conv_12);
35729                 channel_ids_constr.data[m] = channel_ids_conv_12_ref;
35730         }
35731         FREE(channel_ids);
35732         LDKChannelConfig config_conv;
35733         config_conv.inner = untag_ptr(config);
35734         config_conv.is_owned = ptr_is_owned(config);
35735         CHECK_INNER_FIELD_ACCESS_OR_NULL(config_conv);
35736         config_conv.is_owned = false;
35737         LDKCResult_NoneAPIErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneAPIErrorZ), "LDKCResult_NoneAPIErrorZ");
35738         *ret_conv = ChannelManager_update_channel_config(&this_arg_conv, counterparty_node_id_ref, channel_ids_constr, &config_conv);
35739         return tag_ptr(ret_conv, true);
35740 }
35741
35742 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) {
35743         LDKChannelManager this_arg_conv;
35744         this_arg_conv.inner = untag_ptr(this_arg);
35745         this_arg_conv.is_owned = ptr_is_owned(this_arg);
35746         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
35747         this_arg_conv.is_owned = false;
35748         LDKThirtyTwoBytes intercept_id_ref;
35749         CHECK(intercept_id->arr_len == 32);
35750         memcpy(intercept_id_ref.data, intercept_id->elems, 32); FREE(intercept_id);
35751         uint8_t next_hop_channel_id_arr[32];
35752         CHECK(next_hop_channel_id->arr_len == 32);
35753         memcpy(next_hop_channel_id_arr, next_hop_channel_id->elems, 32); FREE(next_hop_channel_id);
35754         uint8_t (*next_hop_channel_id_ref)[32] = &next_hop_channel_id_arr;
35755         LDKPublicKey next_node_id_ref;
35756         CHECK(next_node_id->arr_len == 33);
35757         memcpy(next_node_id_ref.compressed_form, next_node_id->elems, 33); FREE(next_node_id);
35758         LDKCResult_NoneAPIErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneAPIErrorZ), "LDKCResult_NoneAPIErrorZ");
35759         *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);
35760         return tag_ptr(ret_conv, true);
35761 }
35762
35763 uint64_t  __attribute__((export_name("TS_ChannelManager_fail_intercepted_htlc"))) TS_ChannelManager_fail_intercepted_htlc(uint64_t this_arg, int8_tArray intercept_id) {
35764         LDKChannelManager this_arg_conv;
35765         this_arg_conv.inner = untag_ptr(this_arg);
35766         this_arg_conv.is_owned = ptr_is_owned(this_arg);
35767         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
35768         this_arg_conv.is_owned = false;
35769         LDKThirtyTwoBytes intercept_id_ref;
35770         CHECK(intercept_id->arr_len == 32);
35771         memcpy(intercept_id_ref.data, intercept_id->elems, 32); FREE(intercept_id);
35772         LDKCResult_NoneAPIErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneAPIErrorZ), "LDKCResult_NoneAPIErrorZ");
35773         *ret_conv = ChannelManager_fail_intercepted_htlc(&this_arg_conv, intercept_id_ref);
35774         return tag_ptr(ret_conv, true);
35775 }
35776
35777 void  __attribute__((export_name("TS_ChannelManager_process_pending_htlc_forwards"))) TS_ChannelManager_process_pending_htlc_forwards(uint64_t this_arg) {
35778         LDKChannelManager this_arg_conv;
35779         this_arg_conv.inner = untag_ptr(this_arg);
35780         this_arg_conv.is_owned = ptr_is_owned(this_arg);
35781         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
35782         this_arg_conv.is_owned = false;
35783         ChannelManager_process_pending_htlc_forwards(&this_arg_conv);
35784 }
35785
35786 void  __attribute__((export_name("TS_ChannelManager_timer_tick_occurred"))) TS_ChannelManager_timer_tick_occurred(uint64_t this_arg) {
35787         LDKChannelManager this_arg_conv;
35788         this_arg_conv.inner = untag_ptr(this_arg);
35789         this_arg_conv.is_owned = ptr_is_owned(this_arg);
35790         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
35791         this_arg_conv.is_owned = false;
35792         ChannelManager_timer_tick_occurred(&this_arg_conv);
35793 }
35794
35795 void  __attribute__((export_name("TS_ChannelManager_fail_htlc_backwards"))) TS_ChannelManager_fail_htlc_backwards(uint64_t this_arg, int8_tArray payment_hash) {
35796         LDKChannelManager this_arg_conv;
35797         this_arg_conv.inner = untag_ptr(this_arg);
35798         this_arg_conv.is_owned = ptr_is_owned(this_arg);
35799         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
35800         this_arg_conv.is_owned = false;
35801         uint8_t payment_hash_arr[32];
35802         CHECK(payment_hash->arr_len == 32);
35803         memcpy(payment_hash_arr, payment_hash->elems, 32); FREE(payment_hash);
35804         uint8_t (*payment_hash_ref)[32] = &payment_hash_arr;
35805         ChannelManager_fail_htlc_backwards(&this_arg_conv, payment_hash_ref);
35806 }
35807
35808 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) {
35809         LDKChannelManager this_arg_conv;
35810         this_arg_conv.inner = untag_ptr(this_arg);
35811         this_arg_conv.is_owned = ptr_is_owned(this_arg);
35812         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
35813         this_arg_conv.is_owned = false;
35814         uint8_t payment_hash_arr[32];
35815         CHECK(payment_hash->arr_len == 32);
35816         memcpy(payment_hash_arr, payment_hash->elems, 32); FREE(payment_hash);
35817         uint8_t (*payment_hash_ref)[32] = &payment_hash_arr;
35818         void* failure_code_ptr = untag_ptr(failure_code);
35819         CHECK_ACCESS(failure_code_ptr);
35820         LDKFailureCode failure_code_conv = *(LDKFailureCode*)(failure_code_ptr);
35821         failure_code_conv = FailureCode_clone((LDKFailureCode*)untag_ptr(failure_code));
35822         ChannelManager_fail_htlc_backwards_with_reason(&this_arg_conv, payment_hash_ref, failure_code_conv);
35823 }
35824
35825 void  __attribute__((export_name("TS_ChannelManager_claim_funds"))) TS_ChannelManager_claim_funds(uint64_t this_arg, int8_tArray payment_preimage) {
35826         LDKChannelManager this_arg_conv;
35827         this_arg_conv.inner = untag_ptr(this_arg);
35828         this_arg_conv.is_owned = ptr_is_owned(this_arg);
35829         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
35830         this_arg_conv.is_owned = false;
35831         LDKThirtyTwoBytes payment_preimage_ref;
35832         CHECK(payment_preimage->arr_len == 32);
35833         memcpy(payment_preimage_ref.data, payment_preimage->elems, 32); FREE(payment_preimage);
35834         ChannelManager_claim_funds(&this_arg_conv, payment_preimage_ref);
35835 }
35836
35837 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) {
35838         LDKChannelManager this_arg_conv;
35839         this_arg_conv.inner = untag_ptr(this_arg);
35840         this_arg_conv.is_owned = ptr_is_owned(this_arg);
35841         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
35842         this_arg_conv.is_owned = false;
35843         LDKThirtyTwoBytes payment_preimage_ref;
35844         CHECK(payment_preimage->arr_len == 32);
35845         memcpy(payment_preimage_ref.data, payment_preimage->elems, 32); FREE(payment_preimage);
35846         ChannelManager_claim_funds_with_known_custom_tlvs(&this_arg_conv, payment_preimage_ref);
35847 }
35848
35849 int8_tArray  __attribute__((export_name("TS_ChannelManager_get_our_node_id"))) TS_ChannelManager_get_our_node_id(uint64_t this_arg) {
35850         LDKChannelManager this_arg_conv;
35851         this_arg_conv.inner = untag_ptr(this_arg);
35852         this_arg_conv.is_owned = ptr_is_owned(this_arg);
35853         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
35854         this_arg_conv.is_owned = false;
35855         int8_tArray ret_arr = init_int8_tArray(33, __LINE__);
35856         memcpy(ret_arr->elems, ChannelManager_get_our_node_id(&this_arg_conv).compressed_form, 33);
35857         return ret_arr;
35858 }
35859
35860 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) {
35861         LDKChannelManager this_arg_conv;
35862         this_arg_conv.inner = untag_ptr(this_arg);
35863         this_arg_conv.is_owned = ptr_is_owned(this_arg);
35864         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
35865         this_arg_conv.is_owned = false;
35866         uint8_t temporary_channel_id_arr[32];
35867         CHECK(temporary_channel_id->arr_len == 32);
35868         memcpy(temporary_channel_id_arr, temporary_channel_id->elems, 32); FREE(temporary_channel_id);
35869         uint8_t (*temporary_channel_id_ref)[32] = &temporary_channel_id_arr;
35870         LDKPublicKey counterparty_node_id_ref;
35871         CHECK(counterparty_node_id->arr_len == 33);
35872         memcpy(counterparty_node_id_ref.compressed_form, counterparty_node_id->elems, 33); FREE(counterparty_node_id);
35873         LDKU128 user_channel_id_ref;
35874         CHECK(user_channel_id->arr_len == 16);
35875         memcpy(user_channel_id_ref.le_bytes, user_channel_id->elems, 16); FREE(user_channel_id);
35876         LDKCResult_NoneAPIErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneAPIErrorZ), "LDKCResult_NoneAPIErrorZ");
35877         *ret_conv = ChannelManager_accept_inbound_channel(&this_arg_conv, temporary_channel_id_ref, counterparty_node_id_ref, user_channel_id_ref);
35878         return tag_ptr(ret_conv, true);
35879 }
35880
35881 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) {
35882         LDKChannelManager this_arg_conv;
35883         this_arg_conv.inner = untag_ptr(this_arg);
35884         this_arg_conv.is_owned = ptr_is_owned(this_arg);
35885         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
35886         this_arg_conv.is_owned = false;
35887         uint8_t temporary_channel_id_arr[32];
35888         CHECK(temporary_channel_id->arr_len == 32);
35889         memcpy(temporary_channel_id_arr, temporary_channel_id->elems, 32); FREE(temporary_channel_id);
35890         uint8_t (*temporary_channel_id_ref)[32] = &temporary_channel_id_arr;
35891         LDKPublicKey counterparty_node_id_ref;
35892         CHECK(counterparty_node_id->arr_len == 33);
35893         memcpy(counterparty_node_id_ref.compressed_form, counterparty_node_id->elems, 33); FREE(counterparty_node_id);
35894         LDKU128 user_channel_id_ref;
35895         CHECK(user_channel_id->arr_len == 16);
35896         memcpy(user_channel_id_ref.le_bytes, user_channel_id->elems, 16); FREE(user_channel_id);
35897         LDKCResult_NoneAPIErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneAPIErrorZ), "LDKCResult_NoneAPIErrorZ");
35898         *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);
35899         return tag_ptr(ret_conv, true);
35900 }
35901
35902 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) {
35903         LDKChannelManager this_arg_conv;
35904         this_arg_conv.inner = untag_ptr(this_arg);
35905         this_arg_conv.is_owned = ptr_is_owned(this_arg);
35906         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
35907         this_arg_conv.is_owned = false;
35908         LDKOffer offer_conv;
35909         offer_conv.inner = untag_ptr(offer);
35910         offer_conv.is_owned = ptr_is_owned(offer);
35911         CHECK_INNER_FIELD_ACCESS_OR_NULL(offer_conv);
35912         offer_conv.is_owned = false;
35913         void* quantity_ptr = untag_ptr(quantity);
35914         CHECK_ACCESS(quantity_ptr);
35915         LDKCOption_u64Z quantity_conv = *(LDKCOption_u64Z*)(quantity_ptr);
35916         quantity_conv = COption_u64Z_clone((LDKCOption_u64Z*)untag_ptr(quantity));
35917         void* amount_msats_ptr = untag_ptr(amount_msats);
35918         CHECK_ACCESS(amount_msats_ptr);
35919         LDKCOption_u64Z amount_msats_conv = *(LDKCOption_u64Z*)(amount_msats_ptr);
35920         amount_msats_conv = COption_u64Z_clone((LDKCOption_u64Z*)untag_ptr(amount_msats));
35921         void* payer_note_ptr = untag_ptr(payer_note);
35922         CHECK_ACCESS(payer_note_ptr);
35923         LDKCOption_StrZ payer_note_conv = *(LDKCOption_StrZ*)(payer_note_ptr);
35924         payer_note_conv = COption_StrZ_clone((LDKCOption_StrZ*)untag_ptr(payer_note));
35925         LDKThirtyTwoBytes payment_id_ref;
35926         CHECK(payment_id->arr_len == 32);
35927         memcpy(payment_id_ref.data, payment_id->elems, 32); FREE(payment_id);
35928         void* retry_strategy_ptr = untag_ptr(retry_strategy);
35929         CHECK_ACCESS(retry_strategy_ptr);
35930         LDKRetry retry_strategy_conv = *(LDKRetry*)(retry_strategy_ptr);
35931         retry_strategy_conv = Retry_clone((LDKRetry*)untag_ptr(retry_strategy));
35932         void* max_total_routing_fee_msat_ptr = untag_ptr(max_total_routing_fee_msat);
35933         CHECK_ACCESS(max_total_routing_fee_msat_ptr);
35934         LDKCOption_u64Z max_total_routing_fee_msat_conv = *(LDKCOption_u64Z*)(max_total_routing_fee_msat_ptr);
35935         max_total_routing_fee_msat_conv = COption_u64Z_clone((LDKCOption_u64Z*)untag_ptr(max_total_routing_fee_msat));
35936         LDKCResult_NoneBolt12SemanticErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneBolt12SemanticErrorZ), "LDKCResult_NoneBolt12SemanticErrorZ");
35937         *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);
35938         return tag_ptr(ret_conv, true);
35939 }
35940
35941 uint64_t  __attribute__((export_name("TS_ChannelManager_request_refund_payment"))) TS_ChannelManager_request_refund_payment(uint64_t this_arg, uint64_t refund) {
35942         LDKChannelManager this_arg_conv;
35943         this_arg_conv.inner = untag_ptr(this_arg);
35944         this_arg_conv.is_owned = ptr_is_owned(this_arg);
35945         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
35946         this_arg_conv.is_owned = false;
35947         LDKRefund refund_conv;
35948         refund_conv.inner = untag_ptr(refund);
35949         refund_conv.is_owned = ptr_is_owned(refund);
35950         CHECK_INNER_FIELD_ACCESS_OR_NULL(refund_conv);
35951         refund_conv.is_owned = false;
35952         LDKCResult_NoneBolt12SemanticErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneBolt12SemanticErrorZ), "LDKCResult_NoneBolt12SemanticErrorZ");
35953         *ret_conv = ChannelManager_request_refund_payment(&this_arg_conv, &refund_conv);
35954         return tag_ptr(ret_conv, true);
35955 }
35956
35957 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) {
35958         LDKChannelManager this_arg_conv;
35959         this_arg_conv.inner = untag_ptr(this_arg);
35960         this_arg_conv.is_owned = ptr_is_owned(this_arg);
35961         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
35962         this_arg_conv.is_owned = false;
35963         void* min_value_msat_ptr = untag_ptr(min_value_msat);
35964         CHECK_ACCESS(min_value_msat_ptr);
35965         LDKCOption_u64Z min_value_msat_conv = *(LDKCOption_u64Z*)(min_value_msat_ptr);
35966         min_value_msat_conv = COption_u64Z_clone((LDKCOption_u64Z*)untag_ptr(min_value_msat));
35967         void* min_final_cltv_expiry_delta_ptr = untag_ptr(min_final_cltv_expiry_delta);
35968         CHECK_ACCESS(min_final_cltv_expiry_delta_ptr);
35969         LDKCOption_u16Z min_final_cltv_expiry_delta_conv = *(LDKCOption_u16Z*)(min_final_cltv_expiry_delta_ptr);
35970         min_final_cltv_expiry_delta_conv = COption_u16Z_clone((LDKCOption_u16Z*)untag_ptr(min_final_cltv_expiry_delta));
35971         LDKCResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZNoneZ), "LDKCResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZNoneZ");
35972         *ret_conv = ChannelManager_create_inbound_payment(&this_arg_conv, min_value_msat_conv, invoice_expiry_delta_secs, min_final_cltv_expiry_delta_conv);
35973         return tag_ptr(ret_conv, true);
35974 }
35975
35976 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) {
35977         LDKChannelManager this_arg_conv;
35978         this_arg_conv.inner = untag_ptr(this_arg);
35979         this_arg_conv.is_owned = ptr_is_owned(this_arg);
35980         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
35981         this_arg_conv.is_owned = false;
35982         LDKThirtyTwoBytes payment_hash_ref;
35983         CHECK(payment_hash->arr_len == 32);
35984         memcpy(payment_hash_ref.data, payment_hash->elems, 32); FREE(payment_hash);
35985         void* min_value_msat_ptr = untag_ptr(min_value_msat);
35986         CHECK_ACCESS(min_value_msat_ptr);
35987         LDKCOption_u64Z min_value_msat_conv = *(LDKCOption_u64Z*)(min_value_msat_ptr);
35988         min_value_msat_conv = COption_u64Z_clone((LDKCOption_u64Z*)untag_ptr(min_value_msat));
35989         void* min_final_cltv_expiry_ptr = untag_ptr(min_final_cltv_expiry);
35990         CHECK_ACCESS(min_final_cltv_expiry_ptr);
35991         LDKCOption_u16Z min_final_cltv_expiry_conv = *(LDKCOption_u16Z*)(min_final_cltv_expiry_ptr);
35992         min_final_cltv_expiry_conv = COption_u16Z_clone((LDKCOption_u16Z*)untag_ptr(min_final_cltv_expiry));
35993         LDKCResult_ThirtyTwoBytesNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_ThirtyTwoBytesNoneZ), "LDKCResult_ThirtyTwoBytesNoneZ");
35994         *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);
35995         return tag_ptr(ret_conv, true);
35996 }
35997
35998 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) {
35999         LDKChannelManager this_arg_conv;
36000         this_arg_conv.inner = untag_ptr(this_arg);
36001         this_arg_conv.is_owned = ptr_is_owned(this_arg);
36002         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
36003         this_arg_conv.is_owned = false;
36004         LDKThirtyTwoBytes payment_hash_ref;
36005         CHECK(payment_hash->arr_len == 32);
36006         memcpy(payment_hash_ref.data, payment_hash->elems, 32); FREE(payment_hash);
36007         LDKThirtyTwoBytes payment_secret_ref;
36008         CHECK(payment_secret->arr_len == 32);
36009         memcpy(payment_secret_ref.data, payment_secret->elems, 32); FREE(payment_secret);
36010         LDKCResult_ThirtyTwoBytesAPIErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ThirtyTwoBytesAPIErrorZ), "LDKCResult_ThirtyTwoBytesAPIErrorZ");
36011         *ret_conv = ChannelManager_get_payment_preimage(&this_arg_conv, payment_hash_ref, payment_secret_ref);
36012         return tag_ptr(ret_conv, true);
36013 }
36014
36015 int64_t  __attribute__((export_name("TS_ChannelManager_get_phantom_scid"))) TS_ChannelManager_get_phantom_scid(uint64_t this_arg) {
36016         LDKChannelManager this_arg_conv;
36017         this_arg_conv.inner = untag_ptr(this_arg);
36018         this_arg_conv.is_owned = ptr_is_owned(this_arg);
36019         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
36020         this_arg_conv.is_owned = false;
36021         int64_t ret_conv = ChannelManager_get_phantom_scid(&this_arg_conv);
36022         return ret_conv;
36023 }
36024
36025 uint64_t  __attribute__((export_name("TS_ChannelManager_get_phantom_route_hints"))) TS_ChannelManager_get_phantom_route_hints(uint64_t this_arg) {
36026         LDKChannelManager this_arg_conv;
36027         this_arg_conv.inner = untag_ptr(this_arg);
36028         this_arg_conv.is_owned = ptr_is_owned(this_arg);
36029         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
36030         this_arg_conv.is_owned = false;
36031         LDKPhantomRouteHints ret_var = ChannelManager_get_phantom_route_hints(&this_arg_conv);
36032         uint64_t ret_ref = 0;
36033         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
36034         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
36035         return ret_ref;
36036 }
36037
36038 int64_t  __attribute__((export_name("TS_ChannelManager_get_intercept_scid"))) TS_ChannelManager_get_intercept_scid(uint64_t this_arg) {
36039         LDKChannelManager this_arg_conv;
36040         this_arg_conv.inner = untag_ptr(this_arg);
36041         this_arg_conv.is_owned = ptr_is_owned(this_arg);
36042         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
36043         this_arg_conv.is_owned = false;
36044         int64_t ret_conv = ChannelManager_get_intercept_scid(&this_arg_conv);
36045         return ret_conv;
36046 }
36047
36048 uint64_t  __attribute__((export_name("TS_ChannelManager_compute_inflight_htlcs"))) TS_ChannelManager_compute_inflight_htlcs(uint64_t this_arg) {
36049         LDKChannelManager this_arg_conv;
36050         this_arg_conv.inner = untag_ptr(this_arg);
36051         this_arg_conv.is_owned = ptr_is_owned(this_arg);
36052         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
36053         this_arg_conv.is_owned = false;
36054         LDKInFlightHtlcs ret_var = ChannelManager_compute_inflight_htlcs(&this_arg_conv);
36055         uint64_t ret_ref = 0;
36056         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
36057         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
36058         return ret_ref;
36059 }
36060
36061 uint64_t  __attribute__((export_name("TS_ChannelManager_as_MessageSendEventsProvider"))) TS_ChannelManager_as_MessageSendEventsProvider(uint64_t this_arg) {
36062         LDKChannelManager this_arg_conv;
36063         this_arg_conv.inner = untag_ptr(this_arg);
36064         this_arg_conv.is_owned = ptr_is_owned(this_arg);
36065         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
36066         this_arg_conv.is_owned = false;
36067         LDKMessageSendEventsProvider* ret_ret = MALLOC(sizeof(LDKMessageSendEventsProvider), "LDKMessageSendEventsProvider");
36068         *ret_ret = ChannelManager_as_MessageSendEventsProvider(&this_arg_conv);
36069         return tag_ptr(ret_ret, true);
36070 }
36071
36072 uint64_t  __attribute__((export_name("TS_ChannelManager_as_EventsProvider"))) TS_ChannelManager_as_EventsProvider(uint64_t this_arg) {
36073         LDKChannelManager this_arg_conv;
36074         this_arg_conv.inner = untag_ptr(this_arg);
36075         this_arg_conv.is_owned = ptr_is_owned(this_arg);
36076         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
36077         this_arg_conv.is_owned = false;
36078         LDKEventsProvider* ret_ret = MALLOC(sizeof(LDKEventsProvider), "LDKEventsProvider");
36079         *ret_ret = ChannelManager_as_EventsProvider(&this_arg_conv);
36080         return tag_ptr(ret_ret, true);
36081 }
36082
36083 uint64_t  __attribute__((export_name("TS_ChannelManager_as_Listen"))) TS_ChannelManager_as_Listen(uint64_t this_arg) {
36084         LDKChannelManager this_arg_conv;
36085         this_arg_conv.inner = untag_ptr(this_arg);
36086         this_arg_conv.is_owned = ptr_is_owned(this_arg);
36087         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
36088         this_arg_conv.is_owned = false;
36089         LDKListen* ret_ret = MALLOC(sizeof(LDKListen), "LDKListen");
36090         *ret_ret = ChannelManager_as_Listen(&this_arg_conv);
36091         return tag_ptr(ret_ret, true);
36092 }
36093
36094 uint64_t  __attribute__((export_name("TS_ChannelManager_as_Confirm"))) TS_ChannelManager_as_Confirm(uint64_t this_arg) {
36095         LDKChannelManager this_arg_conv;
36096         this_arg_conv.inner = untag_ptr(this_arg);
36097         this_arg_conv.is_owned = ptr_is_owned(this_arg);
36098         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
36099         this_arg_conv.is_owned = false;
36100         LDKConfirm* ret_ret = MALLOC(sizeof(LDKConfirm), "LDKConfirm");
36101         *ret_ret = ChannelManager_as_Confirm(&this_arg_conv);
36102         return tag_ptr(ret_ret, true);
36103 }
36104
36105 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) {
36106         LDKChannelManager this_arg_conv;
36107         this_arg_conv.inner = untag_ptr(this_arg);
36108         this_arg_conv.is_owned = ptr_is_owned(this_arg);
36109         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
36110         this_arg_conv.is_owned = false;
36111         LDKFuture ret_var = ChannelManager_get_event_or_persistence_needed_future(&this_arg_conv);
36112         uint64_t ret_ref = 0;
36113         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
36114         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
36115         return ret_ref;
36116 }
36117
36118 jboolean  __attribute__((export_name("TS_ChannelManager_get_and_clear_needs_persistence"))) TS_ChannelManager_get_and_clear_needs_persistence(uint64_t this_arg) {
36119         LDKChannelManager this_arg_conv;
36120         this_arg_conv.inner = untag_ptr(this_arg);
36121         this_arg_conv.is_owned = ptr_is_owned(this_arg);
36122         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
36123         this_arg_conv.is_owned = false;
36124         jboolean ret_conv = ChannelManager_get_and_clear_needs_persistence(&this_arg_conv);
36125         return ret_conv;
36126 }
36127
36128 uint64_t  __attribute__((export_name("TS_ChannelManager_current_best_block"))) TS_ChannelManager_current_best_block(uint64_t this_arg) {
36129         LDKChannelManager this_arg_conv;
36130         this_arg_conv.inner = untag_ptr(this_arg);
36131         this_arg_conv.is_owned = ptr_is_owned(this_arg);
36132         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
36133         this_arg_conv.is_owned = false;
36134         LDKBestBlock ret_var = ChannelManager_current_best_block(&this_arg_conv);
36135         uint64_t ret_ref = 0;
36136         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
36137         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
36138         return ret_ref;
36139 }
36140
36141 uint64_t  __attribute__((export_name("TS_ChannelManager_node_features"))) TS_ChannelManager_node_features(uint64_t this_arg) {
36142         LDKChannelManager this_arg_conv;
36143         this_arg_conv.inner = untag_ptr(this_arg);
36144         this_arg_conv.is_owned = ptr_is_owned(this_arg);
36145         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
36146         this_arg_conv.is_owned = false;
36147         LDKNodeFeatures ret_var = ChannelManager_node_features(&this_arg_conv);
36148         uint64_t ret_ref = 0;
36149         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
36150         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
36151         return ret_ref;
36152 }
36153
36154 uint64_t  __attribute__((export_name("TS_ChannelManager_channel_features"))) TS_ChannelManager_channel_features(uint64_t this_arg) {
36155         LDKChannelManager this_arg_conv;
36156         this_arg_conv.inner = untag_ptr(this_arg);
36157         this_arg_conv.is_owned = ptr_is_owned(this_arg);
36158         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
36159         this_arg_conv.is_owned = false;
36160         LDKChannelFeatures ret_var = ChannelManager_channel_features(&this_arg_conv);
36161         uint64_t ret_ref = 0;
36162         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
36163         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
36164         return ret_ref;
36165 }
36166
36167 uint64_t  __attribute__((export_name("TS_ChannelManager_channel_type_features"))) TS_ChannelManager_channel_type_features(uint64_t this_arg) {
36168         LDKChannelManager this_arg_conv;
36169         this_arg_conv.inner = untag_ptr(this_arg);
36170         this_arg_conv.is_owned = ptr_is_owned(this_arg);
36171         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
36172         this_arg_conv.is_owned = false;
36173         LDKChannelTypeFeatures ret_var = ChannelManager_channel_type_features(&this_arg_conv);
36174         uint64_t ret_ref = 0;
36175         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
36176         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
36177         return ret_ref;
36178 }
36179
36180 uint64_t  __attribute__((export_name("TS_ChannelManager_init_features"))) TS_ChannelManager_init_features(uint64_t this_arg) {
36181         LDKChannelManager this_arg_conv;
36182         this_arg_conv.inner = untag_ptr(this_arg);
36183         this_arg_conv.is_owned = ptr_is_owned(this_arg);
36184         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
36185         this_arg_conv.is_owned = false;
36186         LDKInitFeatures ret_var = ChannelManager_init_features(&this_arg_conv);
36187         uint64_t ret_ref = 0;
36188         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
36189         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
36190         return ret_ref;
36191 }
36192
36193 uint64_t  __attribute__((export_name("TS_ChannelManager_as_ChannelMessageHandler"))) TS_ChannelManager_as_ChannelMessageHandler(uint64_t this_arg) {
36194         LDKChannelManager this_arg_conv;
36195         this_arg_conv.inner = untag_ptr(this_arg);
36196         this_arg_conv.is_owned = ptr_is_owned(this_arg);
36197         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
36198         this_arg_conv.is_owned = false;
36199         LDKChannelMessageHandler* ret_ret = MALLOC(sizeof(LDKChannelMessageHandler), "LDKChannelMessageHandler");
36200         *ret_ret = ChannelManager_as_ChannelMessageHandler(&this_arg_conv);
36201         return tag_ptr(ret_ret, true);
36202 }
36203
36204 uint64_t  __attribute__((export_name("TS_ChannelManager_as_OffersMessageHandler"))) TS_ChannelManager_as_OffersMessageHandler(uint64_t this_arg) {
36205         LDKChannelManager this_arg_conv;
36206         this_arg_conv.inner = untag_ptr(this_arg);
36207         this_arg_conv.is_owned = ptr_is_owned(this_arg);
36208         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
36209         this_arg_conv.is_owned = false;
36210         LDKOffersMessageHandler* ret_ret = MALLOC(sizeof(LDKOffersMessageHandler), "LDKOffersMessageHandler");
36211         *ret_ret = ChannelManager_as_OffersMessageHandler(&this_arg_conv);
36212         return tag_ptr(ret_ret, true);
36213 }
36214
36215 uint64_t  __attribute__((export_name("TS_provided_init_features"))) TS_provided_init_features(uint64_t config) {
36216         LDKUserConfig config_conv;
36217         config_conv.inner = untag_ptr(config);
36218         config_conv.is_owned = ptr_is_owned(config);
36219         CHECK_INNER_FIELD_ACCESS_OR_NULL(config_conv);
36220         config_conv.is_owned = false;
36221         LDKInitFeatures ret_var = provided_init_features(&config_conv);
36222         uint64_t ret_ref = 0;
36223         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
36224         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
36225         return ret_ref;
36226 }
36227
36228 int8_tArray  __attribute__((export_name("TS_CounterpartyForwardingInfo_write"))) TS_CounterpartyForwardingInfo_write(uint64_t obj) {
36229         LDKCounterpartyForwardingInfo obj_conv;
36230         obj_conv.inner = untag_ptr(obj);
36231         obj_conv.is_owned = ptr_is_owned(obj);
36232         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
36233         obj_conv.is_owned = false;
36234         LDKCVec_u8Z ret_var = CounterpartyForwardingInfo_write(&obj_conv);
36235         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
36236         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
36237         CVec_u8Z_free(ret_var);
36238         return ret_arr;
36239 }
36240
36241 uint64_t  __attribute__((export_name("TS_CounterpartyForwardingInfo_read"))) TS_CounterpartyForwardingInfo_read(int8_tArray ser) {
36242         LDKu8slice ser_ref;
36243         ser_ref.datalen = ser->arr_len;
36244         ser_ref.data = ser->elems;
36245         LDKCResult_CounterpartyForwardingInfoDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CounterpartyForwardingInfoDecodeErrorZ), "LDKCResult_CounterpartyForwardingInfoDecodeErrorZ");
36246         *ret_conv = CounterpartyForwardingInfo_read(ser_ref);
36247         FREE(ser);
36248         return tag_ptr(ret_conv, true);
36249 }
36250
36251 int8_tArray  __attribute__((export_name("TS_ChannelCounterparty_write"))) TS_ChannelCounterparty_write(uint64_t obj) {
36252         LDKChannelCounterparty obj_conv;
36253         obj_conv.inner = untag_ptr(obj);
36254         obj_conv.is_owned = ptr_is_owned(obj);
36255         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
36256         obj_conv.is_owned = false;
36257         LDKCVec_u8Z ret_var = ChannelCounterparty_write(&obj_conv);
36258         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
36259         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
36260         CVec_u8Z_free(ret_var);
36261         return ret_arr;
36262 }
36263
36264 uint64_t  __attribute__((export_name("TS_ChannelCounterparty_read"))) TS_ChannelCounterparty_read(int8_tArray ser) {
36265         LDKu8slice ser_ref;
36266         ser_ref.datalen = ser->arr_len;
36267         ser_ref.data = ser->elems;
36268         LDKCResult_ChannelCounterpartyDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelCounterpartyDecodeErrorZ), "LDKCResult_ChannelCounterpartyDecodeErrorZ");
36269         *ret_conv = ChannelCounterparty_read(ser_ref);
36270         FREE(ser);
36271         return tag_ptr(ret_conv, true);
36272 }
36273
36274 int8_tArray  __attribute__((export_name("TS_ChannelDetails_write"))) TS_ChannelDetails_write(uint64_t obj) {
36275         LDKChannelDetails obj_conv;
36276         obj_conv.inner = untag_ptr(obj);
36277         obj_conv.is_owned = ptr_is_owned(obj);
36278         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
36279         obj_conv.is_owned = false;
36280         LDKCVec_u8Z ret_var = ChannelDetails_write(&obj_conv);
36281         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
36282         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
36283         CVec_u8Z_free(ret_var);
36284         return ret_arr;
36285 }
36286
36287 uint64_t  __attribute__((export_name("TS_ChannelDetails_read"))) TS_ChannelDetails_read(int8_tArray ser) {
36288         LDKu8slice ser_ref;
36289         ser_ref.datalen = ser->arr_len;
36290         ser_ref.data = ser->elems;
36291         LDKCResult_ChannelDetailsDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelDetailsDecodeErrorZ), "LDKCResult_ChannelDetailsDecodeErrorZ");
36292         *ret_conv = ChannelDetails_read(ser_ref);
36293         FREE(ser);
36294         return tag_ptr(ret_conv, true);
36295 }
36296
36297 int8_tArray  __attribute__((export_name("TS_PhantomRouteHints_write"))) TS_PhantomRouteHints_write(uint64_t obj) {
36298         LDKPhantomRouteHints obj_conv;
36299         obj_conv.inner = untag_ptr(obj);
36300         obj_conv.is_owned = ptr_is_owned(obj);
36301         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
36302         obj_conv.is_owned = false;
36303         LDKCVec_u8Z ret_var = PhantomRouteHints_write(&obj_conv);
36304         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
36305         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
36306         CVec_u8Z_free(ret_var);
36307         return ret_arr;
36308 }
36309
36310 uint64_t  __attribute__((export_name("TS_PhantomRouteHints_read"))) TS_PhantomRouteHints_read(int8_tArray ser) {
36311         LDKu8slice ser_ref;
36312         ser_ref.datalen = ser->arr_len;
36313         ser_ref.data = ser->elems;
36314         LDKCResult_PhantomRouteHintsDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PhantomRouteHintsDecodeErrorZ), "LDKCResult_PhantomRouteHintsDecodeErrorZ");
36315         *ret_conv = PhantomRouteHints_read(ser_ref);
36316         FREE(ser);
36317         return tag_ptr(ret_conv, true);
36318 }
36319
36320 int8_tArray  __attribute__((export_name("TS_ChannelManager_write"))) TS_ChannelManager_write(uint64_t obj) {
36321         LDKChannelManager obj_conv;
36322         obj_conv.inner = untag_ptr(obj);
36323         obj_conv.is_owned = ptr_is_owned(obj);
36324         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
36325         obj_conv.is_owned = false;
36326         LDKCVec_u8Z ret_var = ChannelManager_write(&obj_conv);
36327         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
36328         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
36329         CVec_u8Z_free(ret_var);
36330         return ret_arr;
36331 }
36332
36333 int8_tArray  __attribute__((export_name("TS_ChannelShutdownState_write"))) TS_ChannelShutdownState_write(uint64_t obj) {
36334         LDKChannelShutdownState* obj_conv = (LDKChannelShutdownState*)untag_ptr(obj);
36335         LDKCVec_u8Z ret_var = ChannelShutdownState_write(obj_conv);
36336         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
36337         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
36338         CVec_u8Z_free(ret_var);
36339         return ret_arr;
36340 }
36341
36342 uint64_t  __attribute__((export_name("TS_ChannelShutdownState_read"))) TS_ChannelShutdownState_read(int8_tArray ser) {
36343         LDKu8slice ser_ref;
36344         ser_ref.datalen = ser->arr_len;
36345         ser_ref.data = ser->elems;
36346         LDKCResult_ChannelShutdownStateDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelShutdownStateDecodeErrorZ), "LDKCResult_ChannelShutdownStateDecodeErrorZ");
36347         *ret_conv = ChannelShutdownState_read(ser_ref);
36348         FREE(ser);
36349         return tag_ptr(ret_conv, true);
36350 }
36351
36352 void  __attribute__((export_name("TS_ChannelManagerReadArgs_free"))) TS_ChannelManagerReadArgs_free(uint64_t this_obj) {
36353         LDKChannelManagerReadArgs this_obj_conv;
36354         this_obj_conv.inner = untag_ptr(this_obj);
36355         this_obj_conv.is_owned = ptr_is_owned(this_obj);
36356         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
36357         ChannelManagerReadArgs_free(this_obj_conv);
36358 }
36359
36360 uint64_t  __attribute__((export_name("TS_ChannelManagerReadArgs_get_entropy_source"))) TS_ChannelManagerReadArgs_get_entropy_source(uint64_t this_ptr) {
36361         LDKChannelManagerReadArgs this_ptr_conv;
36362         this_ptr_conv.inner = untag_ptr(this_ptr);
36363         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
36364         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
36365         this_ptr_conv.is_owned = false;
36366         // WARNING: This object doesn't live past this scope, needs clone!
36367         uint64_t ret_ret = tag_ptr(ChannelManagerReadArgs_get_entropy_source(&this_ptr_conv), false);
36368         return ret_ret;
36369 }
36370
36371 void  __attribute__((export_name("TS_ChannelManagerReadArgs_set_entropy_source"))) TS_ChannelManagerReadArgs_set_entropy_source(uint64_t this_ptr, uint64_t val) {
36372         LDKChannelManagerReadArgs this_ptr_conv;
36373         this_ptr_conv.inner = untag_ptr(this_ptr);
36374         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
36375         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
36376         this_ptr_conv.is_owned = false;
36377         void* val_ptr = untag_ptr(val);
36378         CHECK_ACCESS(val_ptr);
36379         LDKEntropySource val_conv = *(LDKEntropySource*)(val_ptr);
36380         if (val_conv.free == LDKEntropySource_JCalls_free) {
36381                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
36382                 LDKEntropySource_JCalls_cloned(&val_conv);
36383         }
36384         ChannelManagerReadArgs_set_entropy_source(&this_ptr_conv, val_conv);
36385 }
36386
36387 uint64_t  __attribute__((export_name("TS_ChannelManagerReadArgs_get_node_signer"))) TS_ChannelManagerReadArgs_get_node_signer(uint64_t this_ptr) {
36388         LDKChannelManagerReadArgs this_ptr_conv;
36389         this_ptr_conv.inner = untag_ptr(this_ptr);
36390         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
36391         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
36392         this_ptr_conv.is_owned = false;
36393         // WARNING: This object doesn't live past this scope, needs clone!
36394         uint64_t ret_ret = tag_ptr(ChannelManagerReadArgs_get_node_signer(&this_ptr_conv), false);
36395         return ret_ret;
36396 }
36397
36398 void  __attribute__((export_name("TS_ChannelManagerReadArgs_set_node_signer"))) TS_ChannelManagerReadArgs_set_node_signer(uint64_t this_ptr, uint64_t val) {
36399         LDKChannelManagerReadArgs this_ptr_conv;
36400         this_ptr_conv.inner = untag_ptr(this_ptr);
36401         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
36402         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
36403         this_ptr_conv.is_owned = false;
36404         void* val_ptr = untag_ptr(val);
36405         CHECK_ACCESS(val_ptr);
36406         LDKNodeSigner val_conv = *(LDKNodeSigner*)(val_ptr);
36407         if (val_conv.free == LDKNodeSigner_JCalls_free) {
36408                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
36409                 LDKNodeSigner_JCalls_cloned(&val_conv);
36410         }
36411         ChannelManagerReadArgs_set_node_signer(&this_ptr_conv, val_conv);
36412 }
36413
36414 uint64_t  __attribute__((export_name("TS_ChannelManagerReadArgs_get_signer_provider"))) TS_ChannelManagerReadArgs_get_signer_provider(uint64_t this_ptr) {
36415         LDKChannelManagerReadArgs this_ptr_conv;
36416         this_ptr_conv.inner = untag_ptr(this_ptr);
36417         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
36418         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
36419         this_ptr_conv.is_owned = false;
36420         // WARNING: This object doesn't live past this scope, needs clone!
36421         uint64_t ret_ret = tag_ptr(ChannelManagerReadArgs_get_signer_provider(&this_ptr_conv), false);
36422         return ret_ret;
36423 }
36424
36425 void  __attribute__((export_name("TS_ChannelManagerReadArgs_set_signer_provider"))) TS_ChannelManagerReadArgs_set_signer_provider(uint64_t this_ptr, uint64_t val) {
36426         LDKChannelManagerReadArgs this_ptr_conv;
36427         this_ptr_conv.inner = untag_ptr(this_ptr);
36428         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
36429         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
36430         this_ptr_conv.is_owned = false;
36431         void* val_ptr = untag_ptr(val);
36432         CHECK_ACCESS(val_ptr);
36433         LDKSignerProvider val_conv = *(LDKSignerProvider*)(val_ptr);
36434         if (val_conv.free == LDKSignerProvider_JCalls_free) {
36435                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
36436                 LDKSignerProvider_JCalls_cloned(&val_conv);
36437         }
36438         ChannelManagerReadArgs_set_signer_provider(&this_ptr_conv, val_conv);
36439 }
36440
36441 uint64_t  __attribute__((export_name("TS_ChannelManagerReadArgs_get_fee_estimator"))) TS_ChannelManagerReadArgs_get_fee_estimator(uint64_t this_ptr) {
36442         LDKChannelManagerReadArgs this_ptr_conv;
36443         this_ptr_conv.inner = untag_ptr(this_ptr);
36444         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
36445         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
36446         this_ptr_conv.is_owned = false;
36447         // WARNING: This object doesn't live past this scope, needs clone!
36448         uint64_t ret_ret = tag_ptr(ChannelManagerReadArgs_get_fee_estimator(&this_ptr_conv), false);
36449         return ret_ret;
36450 }
36451
36452 void  __attribute__((export_name("TS_ChannelManagerReadArgs_set_fee_estimator"))) TS_ChannelManagerReadArgs_set_fee_estimator(uint64_t this_ptr, uint64_t val) {
36453         LDKChannelManagerReadArgs this_ptr_conv;
36454         this_ptr_conv.inner = untag_ptr(this_ptr);
36455         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
36456         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
36457         this_ptr_conv.is_owned = false;
36458         void* val_ptr = untag_ptr(val);
36459         CHECK_ACCESS(val_ptr);
36460         LDKFeeEstimator val_conv = *(LDKFeeEstimator*)(val_ptr);
36461         if (val_conv.free == LDKFeeEstimator_JCalls_free) {
36462                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
36463                 LDKFeeEstimator_JCalls_cloned(&val_conv);
36464         }
36465         ChannelManagerReadArgs_set_fee_estimator(&this_ptr_conv, val_conv);
36466 }
36467
36468 uint64_t  __attribute__((export_name("TS_ChannelManagerReadArgs_get_chain_monitor"))) TS_ChannelManagerReadArgs_get_chain_monitor(uint64_t this_ptr) {
36469         LDKChannelManagerReadArgs this_ptr_conv;
36470         this_ptr_conv.inner = untag_ptr(this_ptr);
36471         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
36472         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
36473         this_ptr_conv.is_owned = false;
36474         // WARNING: This object doesn't live past this scope, needs clone!
36475         uint64_t ret_ret = tag_ptr(ChannelManagerReadArgs_get_chain_monitor(&this_ptr_conv), false);
36476         return ret_ret;
36477 }
36478
36479 void  __attribute__((export_name("TS_ChannelManagerReadArgs_set_chain_monitor"))) TS_ChannelManagerReadArgs_set_chain_monitor(uint64_t this_ptr, uint64_t val) {
36480         LDKChannelManagerReadArgs this_ptr_conv;
36481         this_ptr_conv.inner = untag_ptr(this_ptr);
36482         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
36483         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
36484         this_ptr_conv.is_owned = false;
36485         void* val_ptr = untag_ptr(val);
36486         CHECK_ACCESS(val_ptr);
36487         LDKWatch val_conv = *(LDKWatch*)(val_ptr);
36488         if (val_conv.free == LDKWatch_JCalls_free) {
36489                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
36490                 LDKWatch_JCalls_cloned(&val_conv);
36491         }
36492         ChannelManagerReadArgs_set_chain_monitor(&this_ptr_conv, val_conv);
36493 }
36494
36495 uint64_t  __attribute__((export_name("TS_ChannelManagerReadArgs_get_tx_broadcaster"))) TS_ChannelManagerReadArgs_get_tx_broadcaster(uint64_t this_ptr) {
36496         LDKChannelManagerReadArgs this_ptr_conv;
36497         this_ptr_conv.inner = untag_ptr(this_ptr);
36498         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
36499         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
36500         this_ptr_conv.is_owned = false;
36501         // WARNING: This object doesn't live past this scope, needs clone!
36502         uint64_t ret_ret = tag_ptr(ChannelManagerReadArgs_get_tx_broadcaster(&this_ptr_conv), false);
36503         return ret_ret;
36504 }
36505
36506 void  __attribute__((export_name("TS_ChannelManagerReadArgs_set_tx_broadcaster"))) TS_ChannelManagerReadArgs_set_tx_broadcaster(uint64_t this_ptr, uint64_t val) {
36507         LDKChannelManagerReadArgs this_ptr_conv;
36508         this_ptr_conv.inner = untag_ptr(this_ptr);
36509         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
36510         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
36511         this_ptr_conv.is_owned = false;
36512         void* val_ptr = untag_ptr(val);
36513         CHECK_ACCESS(val_ptr);
36514         LDKBroadcasterInterface val_conv = *(LDKBroadcasterInterface*)(val_ptr);
36515         if (val_conv.free == LDKBroadcasterInterface_JCalls_free) {
36516                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
36517                 LDKBroadcasterInterface_JCalls_cloned(&val_conv);
36518         }
36519         ChannelManagerReadArgs_set_tx_broadcaster(&this_ptr_conv, val_conv);
36520 }
36521
36522 uint64_t  __attribute__((export_name("TS_ChannelManagerReadArgs_get_router"))) TS_ChannelManagerReadArgs_get_router(uint64_t this_ptr) {
36523         LDKChannelManagerReadArgs this_ptr_conv;
36524         this_ptr_conv.inner = untag_ptr(this_ptr);
36525         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
36526         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
36527         this_ptr_conv.is_owned = false;
36528         // WARNING: This object doesn't live past this scope, needs clone!
36529         uint64_t ret_ret = tag_ptr(ChannelManagerReadArgs_get_router(&this_ptr_conv), false);
36530         return ret_ret;
36531 }
36532
36533 void  __attribute__((export_name("TS_ChannelManagerReadArgs_set_router"))) TS_ChannelManagerReadArgs_set_router(uint64_t this_ptr, uint64_t val) {
36534         LDKChannelManagerReadArgs this_ptr_conv;
36535         this_ptr_conv.inner = untag_ptr(this_ptr);
36536         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
36537         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
36538         this_ptr_conv.is_owned = false;
36539         void* val_ptr = untag_ptr(val);
36540         CHECK_ACCESS(val_ptr);
36541         LDKRouter val_conv = *(LDKRouter*)(val_ptr);
36542         if (val_conv.free == LDKRouter_JCalls_free) {
36543                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
36544                 LDKRouter_JCalls_cloned(&val_conv);
36545         }
36546         ChannelManagerReadArgs_set_router(&this_ptr_conv, val_conv);
36547 }
36548
36549 uint64_t  __attribute__((export_name("TS_ChannelManagerReadArgs_get_logger"))) TS_ChannelManagerReadArgs_get_logger(uint64_t this_ptr) {
36550         LDKChannelManagerReadArgs this_ptr_conv;
36551         this_ptr_conv.inner = untag_ptr(this_ptr);
36552         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
36553         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
36554         this_ptr_conv.is_owned = false;
36555         // WARNING: This object doesn't live past this scope, needs clone!
36556         uint64_t ret_ret = tag_ptr(ChannelManagerReadArgs_get_logger(&this_ptr_conv), false);
36557         return ret_ret;
36558 }
36559
36560 void  __attribute__((export_name("TS_ChannelManagerReadArgs_set_logger"))) TS_ChannelManagerReadArgs_set_logger(uint64_t this_ptr, uint64_t val) {
36561         LDKChannelManagerReadArgs this_ptr_conv;
36562         this_ptr_conv.inner = untag_ptr(this_ptr);
36563         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
36564         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
36565         this_ptr_conv.is_owned = false;
36566         void* val_ptr = untag_ptr(val);
36567         CHECK_ACCESS(val_ptr);
36568         LDKLogger val_conv = *(LDKLogger*)(val_ptr);
36569         if (val_conv.free == LDKLogger_JCalls_free) {
36570                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
36571                 LDKLogger_JCalls_cloned(&val_conv);
36572         }
36573         ChannelManagerReadArgs_set_logger(&this_ptr_conv, val_conv);
36574 }
36575
36576 uint64_t  __attribute__((export_name("TS_ChannelManagerReadArgs_get_default_config"))) TS_ChannelManagerReadArgs_get_default_config(uint64_t this_ptr) {
36577         LDKChannelManagerReadArgs this_ptr_conv;
36578         this_ptr_conv.inner = untag_ptr(this_ptr);
36579         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
36580         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
36581         this_ptr_conv.is_owned = false;
36582         LDKUserConfig ret_var = ChannelManagerReadArgs_get_default_config(&this_ptr_conv);
36583         uint64_t ret_ref = 0;
36584         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
36585         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
36586         return ret_ref;
36587 }
36588
36589 void  __attribute__((export_name("TS_ChannelManagerReadArgs_set_default_config"))) TS_ChannelManagerReadArgs_set_default_config(uint64_t this_ptr, uint64_t val) {
36590         LDKChannelManagerReadArgs this_ptr_conv;
36591         this_ptr_conv.inner = untag_ptr(this_ptr);
36592         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
36593         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
36594         this_ptr_conv.is_owned = false;
36595         LDKUserConfig val_conv;
36596         val_conv.inner = untag_ptr(val);
36597         val_conv.is_owned = ptr_is_owned(val);
36598         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
36599         val_conv = UserConfig_clone(&val_conv);
36600         ChannelManagerReadArgs_set_default_config(&this_ptr_conv, val_conv);
36601 }
36602
36603 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) {
36604         void* entropy_source_ptr = untag_ptr(entropy_source);
36605         CHECK_ACCESS(entropy_source_ptr);
36606         LDKEntropySource entropy_source_conv = *(LDKEntropySource*)(entropy_source_ptr);
36607         if (entropy_source_conv.free == LDKEntropySource_JCalls_free) {
36608                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
36609                 LDKEntropySource_JCalls_cloned(&entropy_source_conv);
36610         }
36611         void* node_signer_ptr = untag_ptr(node_signer);
36612         CHECK_ACCESS(node_signer_ptr);
36613         LDKNodeSigner node_signer_conv = *(LDKNodeSigner*)(node_signer_ptr);
36614         if (node_signer_conv.free == LDKNodeSigner_JCalls_free) {
36615                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
36616                 LDKNodeSigner_JCalls_cloned(&node_signer_conv);
36617         }
36618         void* signer_provider_ptr = untag_ptr(signer_provider);
36619         CHECK_ACCESS(signer_provider_ptr);
36620         LDKSignerProvider signer_provider_conv = *(LDKSignerProvider*)(signer_provider_ptr);
36621         if (signer_provider_conv.free == LDKSignerProvider_JCalls_free) {
36622                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
36623                 LDKSignerProvider_JCalls_cloned(&signer_provider_conv);
36624         }
36625         void* fee_estimator_ptr = untag_ptr(fee_estimator);
36626         CHECK_ACCESS(fee_estimator_ptr);
36627         LDKFeeEstimator fee_estimator_conv = *(LDKFeeEstimator*)(fee_estimator_ptr);
36628         if (fee_estimator_conv.free == LDKFeeEstimator_JCalls_free) {
36629                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
36630                 LDKFeeEstimator_JCalls_cloned(&fee_estimator_conv);
36631         }
36632         void* chain_monitor_ptr = untag_ptr(chain_monitor);
36633         CHECK_ACCESS(chain_monitor_ptr);
36634         LDKWatch chain_monitor_conv = *(LDKWatch*)(chain_monitor_ptr);
36635         if (chain_monitor_conv.free == LDKWatch_JCalls_free) {
36636                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
36637                 LDKWatch_JCalls_cloned(&chain_monitor_conv);
36638         }
36639         void* tx_broadcaster_ptr = untag_ptr(tx_broadcaster);
36640         CHECK_ACCESS(tx_broadcaster_ptr);
36641         LDKBroadcasterInterface tx_broadcaster_conv = *(LDKBroadcasterInterface*)(tx_broadcaster_ptr);
36642         if (tx_broadcaster_conv.free == LDKBroadcasterInterface_JCalls_free) {
36643                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
36644                 LDKBroadcasterInterface_JCalls_cloned(&tx_broadcaster_conv);
36645         }
36646         void* router_ptr = untag_ptr(router);
36647         CHECK_ACCESS(router_ptr);
36648         LDKRouter router_conv = *(LDKRouter*)(router_ptr);
36649         if (router_conv.free == LDKRouter_JCalls_free) {
36650                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
36651                 LDKRouter_JCalls_cloned(&router_conv);
36652         }
36653         void* logger_ptr = untag_ptr(logger);
36654         CHECK_ACCESS(logger_ptr);
36655         LDKLogger logger_conv = *(LDKLogger*)(logger_ptr);
36656         if (logger_conv.free == LDKLogger_JCalls_free) {
36657                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
36658                 LDKLogger_JCalls_cloned(&logger_conv);
36659         }
36660         LDKUserConfig default_config_conv;
36661         default_config_conv.inner = untag_ptr(default_config);
36662         default_config_conv.is_owned = ptr_is_owned(default_config);
36663         CHECK_INNER_FIELD_ACCESS_OR_NULL(default_config_conv);
36664         default_config_conv = UserConfig_clone(&default_config_conv);
36665         LDKCVec_ChannelMonitorZ channel_monitors_constr;
36666         channel_monitors_constr.datalen = channel_monitors->arr_len;
36667         if (channel_monitors_constr.datalen > 0)
36668                 channel_monitors_constr.data = MALLOC(channel_monitors_constr.datalen * sizeof(LDKChannelMonitor), "LDKCVec_ChannelMonitorZ Elements");
36669         else
36670                 channel_monitors_constr.data = NULL;
36671         uint64_t* channel_monitors_vals = channel_monitors->elems;
36672         for (size_t q = 0; q < channel_monitors_constr.datalen; q++) {
36673                 uint64_t channel_monitors_conv_16 = channel_monitors_vals[q];
36674                 LDKChannelMonitor channel_monitors_conv_16_conv;
36675                 channel_monitors_conv_16_conv.inner = untag_ptr(channel_monitors_conv_16);
36676                 channel_monitors_conv_16_conv.is_owned = ptr_is_owned(channel_monitors_conv_16);
36677                 CHECK_INNER_FIELD_ACCESS_OR_NULL(channel_monitors_conv_16_conv);
36678                 channel_monitors_conv_16_conv.is_owned = false;
36679                 channel_monitors_constr.data[q] = channel_monitors_conv_16_conv;
36680         }
36681         FREE(channel_monitors);
36682         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);
36683         uint64_t ret_ref = 0;
36684         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
36685         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
36686         return ret_ref;
36687 }
36688
36689 uint64_t  __attribute__((export_name("TS_C2Tuple_ThirtyTwoBytesChannelManagerZ_read"))) TS_C2Tuple_ThirtyTwoBytesChannelManagerZ_read(int8_tArray ser, uint64_t arg) {
36690         LDKu8slice ser_ref;
36691         ser_ref.datalen = ser->arr_len;
36692         ser_ref.data = ser->elems;
36693         LDKChannelManagerReadArgs arg_conv;
36694         arg_conv.inner = untag_ptr(arg);
36695         arg_conv.is_owned = ptr_is_owned(arg);
36696         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
36697         // WARNING: we need a move here but no clone is available for LDKChannelManagerReadArgs
36698         
36699         LDKCResult_C2Tuple_ThirtyTwoBytesChannelManagerZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_ThirtyTwoBytesChannelManagerZDecodeErrorZ), "LDKCResult_C2Tuple_ThirtyTwoBytesChannelManagerZDecodeErrorZ");
36700         *ret_conv = C2Tuple_ThirtyTwoBytesChannelManagerZ_read(ser_ref, arg_conv);
36701         FREE(ser);
36702         return tag_ptr(ret_conv, true);
36703 }
36704
36705 void  __attribute__((export_name("TS_ExpandedKey_free"))) TS_ExpandedKey_free(uint64_t this_obj) {
36706         LDKExpandedKey this_obj_conv;
36707         this_obj_conv.inner = untag_ptr(this_obj);
36708         this_obj_conv.is_owned = ptr_is_owned(this_obj);
36709         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
36710         ExpandedKey_free(this_obj_conv);
36711 }
36712
36713 uint64_t  __attribute__((export_name("TS_ExpandedKey_new"))) TS_ExpandedKey_new(int8_tArray key_material) {
36714         uint8_t key_material_arr[32];
36715         CHECK(key_material->arr_len == 32);
36716         memcpy(key_material_arr, key_material->elems, 32); FREE(key_material);
36717         uint8_t (*key_material_ref)[32] = &key_material_arr;
36718         LDKExpandedKey ret_var = ExpandedKey_new(key_material_ref);
36719         uint64_t ret_ref = 0;
36720         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
36721         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
36722         return ret_ref;
36723 }
36724
36725 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) {
36726         LDKExpandedKey keys_conv;
36727         keys_conv.inner = untag_ptr(keys);
36728         keys_conv.is_owned = ptr_is_owned(keys);
36729         CHECK_INNER_FIELD_ACCESS_OR_NULL(keys_conv);
36730         keys_conv.is_owned = false;
36731         void* min_value_msat_ptr = untag_ptr(min_value_msat);
36732         CHECK_ACCESS(min_value_msat_ptr);
36733         LDKCOption_u64Z min_value_msat_conv = *(LDKCOption_u64Z*)(min_value_msat_ptr);
36734         min_value_msat_conv = COption_u64Z_clone((LDKCOption_u64Z*)untag_ptr(min_value_msat));
36735         void* entropy_source_ptr = untag_ptr(entropy_source);
36736         if (ptr_is_owned(entropy_source)) { CHECK_ACCESS(entropy_source_ptr); }
36737         LDKEntropySource* entropy_source_conv = (LDKEntropySource*)entropy_source_ptr;
36738         void* min_final_cltv_expiry_delta_ptr = untag_ptr(min_final_cltv_expiry_delta);
36739         CHECK_ACCESS(min_final_cltv_expiry_delta_ptr);
36740         LDKCOption_u16Z min_final_cltv_expiry_delta_conv = *(LDKCOption_u16Z*)(min_final_cltv_expiry_delta_ptr);
36741         min_final_cltv_expiry_delta_conv = COption_u16Z_clone((LDKCOption_u16Z*)untag_ptr(min_final_cltv_expiry_delta));
36742         LDKCResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZNoneZ), "LDKCResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZNoneZ");
36743         *ret_conv = create(&keys_conv, min_value_msat_conv, invoice_expiry_delta_secs, entropy_source_conv, current_time, min_final_cltv_expiry_delta_conv);
36744         return tag_ptr(ret_conv, true);
36745 }
36746
36747 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) {
36748         LDKExpandedKey keys_conv;
36749         keys_conv.inner = untag_ptr(keys);
36750         keys_conv.is_owned = ptr_is_owned(keys);
36751         CHECK_INNER_FIELD_ACCESS_OR_NULL(keys_conv);
36752         keys_conv.is_owned = false;
36753         void* min_value_msat_ptr = untag_ptr(min_value_msat);
36754         CHECK_ACCESS(min_value_msat_ptr);
36755         LDKCOption_u64Z min_value_msat_conv = *(LDKCOption_u64Z*)(min_value_msat_ptr);
36756         min_value_msat_conv = COption_u64Z_clone((LDKCOption_u64Z*)untag_ptr(min_value_msat));
36757         LDKThirtyTwoBytes payment_hash_ref;
36758         CHECK(payment_hash->arr_len == 32);
36759         memcpy(payment_hash_ref.data, payment_hash->elems, 32); FREE(payment_hash);
36760         void* min_final_cltv_expiry_delta_ptr = untag_ptr(min_final_cltv_expiry_delta);
36761         CHECK_ACCESS(min_final_cltv_expiry_delta_ptr);
36762         LDKCOption_u16Z min_final_cltv_expiry_delta_conv = *(LDKCOption_u16Z*)(min_final_cltv_expiry_delta_ptr);
36763         min_final_cltv_expiry_delta_conv = COption_u16Z_clone((LDKCOption_u16Z*)untag_ptr(min_final_cltv_expiry_delta));
36764         LDKCResult_ThirtyTwoBytesNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_ThirtyTwoBytesNoneZ), "LDKCResult_ThirtyTwoBytesNoneZ");
36765         *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);
36766         return tag_ptr(ret_conv, true);
36767 }
36768
36769 void  __attribute__((export_name("TS_DecodeError_free"))) TS_DecodeError_free(uint64_t this_ptr) {
36770         if (!ptr_is_owned(this_ptr)) return;
36771         void* this_ptr_ptr = untag_ptr(this_ptr);
36772         CHECK_ACCESS(this_ptr_ptr);
36773         LDKDecodeError this_ptr_conv = *(LDKDecodeError*)(this_ptr_ptr);
36774         FREE(untag_ptr(this_ptr));
36775         DecodeError_free(this_ptr_conv);
36776 }
36777
36778 static inline uint64_t DecodeError_clone_ptr(LDKDecodeError *NONNULL_PTR arg) {
36779         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
36780         *ret_copy = DecodeError_clone(arg);
36781         uint64_t ret_ref = tag_ptr(ret_copy, true);
36782         return ret_ref;
36783 }
36784 int64_t  __attribute__((export_name("TS_DecodeError_clone_ptr"))) TS_DecodeError_clone_ptr(uint64_t arg) {
36785         LDKDecodeError* arg_conv = (LDKDecodeError*)untag_ptr(arg);
36786         int64_t ret_conv = DecodeError_clone_ptr(arg_conv);
36787         return ret_conv;
36788 }
36789
36790 uint64_t  __attribute__((export_name("TS_DecodeError_clone"))) TS_DecodeError_clone(uint64_t orig) {
36791         LDKDecodeError* orig_conv = (LDKDecodeError*)untag_ptr(orig);
36792         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
36793         *ret_copy = DecodeError_clone(orig_conv);
36794         uint64_t ret_ref = tag_ptr(ret_copy, true);
36795         return ret_ref;
36796 }
36797
36798 uint64_t  __attribute__((export_name("TS_DecodeError_unknown_version"))) TS_DecodeError_unknown_version() {
36799         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
36800         *ret_copy = DecodeError_unknown_version();
36801         uint64_t ret_ref = tag_ptr(ret_copy, true);
36802         return ret_ref;
36803 }
36804
36805 uint64_t  __attribute__((export_name("TS_DecodeError_unknown_required_feature"))) TS_DecodeError_unknown_required_feature() {
36806         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
36807         *ret_copy = DecodeError_unknown_required_feature();
36808         uint64_t ret_ref = tag_ptr(ret_copy, true);
36809         return ret_ref;
36810 }
36811
36812 uint64_t  __attribute__((export_name("TS_DecodeError_invalid_value"))) TS_DecodeError_invalid_value() {
36813         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
36814         *ret_copy = DecodeError_invalid_value();
36815         uint64_t ret_ref = tag_ptr(ret_copy, true);
36816         return ret_ref;
36817 }
36818
36819 uint64_t  __attribute__((export_name("TS_DecodeError_short_read"))) TS_DecodeError_short_read() {
36820         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
36821         *ret_copy = DecodeError_short_read();
36822         uint64_t ret_ref = tag_ptr(ret_copy, true);
36823         return ret_ref;
36824 }
36825
36826 uint64_t  __attribute__((export_name("TS_DecodeError_bad_length_descriptor"))) TS_DecodeError_bad_length_descriptor() {
36827         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
36828         *ret_copy = DecodeError_bad_length_descriptor();
36829         uint64_t ret_ref = tag_ptr(ret_copy, true);
36830         return ret_ref;
36831 }
36832
36833 uint64_t  __attribute__((export_name("TS_DecodeError_io"))) TS_DecodeError_io(uint32_t a) {
36834         LDKIOError a_conv = LDKIOError_from_js(a);
36835         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
36836         *ret_copy = DecodeError_io(a_conv);
36837         uint64_t ret_ref = tag_ptr(ret_copy, true);
36838         return ret_ref;
36839 }
36840
36841 uint64_t  __attribute__((export_name("TS_DecodeError_unsupported_compression"))) TS_DecodeError_unsupported_compression() {
36842         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
36843         *ret_copy = DecodeError_unsupported_compression();
36844         uint64_t ret_ref = tag_ptr(ret_copy, true);
36845         return ret_ref;
36846 }
36847
36848 jboolean  __attribute__((export_name("TS_DecodeError_eq"))) TS_DecodeError_eq(uint64_t a, uint64_t b) {
36849         LDKDecodeError* a_conv = (LDKDecodeError*)untag_ptr(a);
36850         LDKDecodeError* b_conv = (LDKDecodeError*)untag_ptr(b);
36851         jboolean ret_conv = DecodeError_eq(a_conv, b_conv);
36852         return ret_conv;
36853 }
36854
36855 void  __attribute__((export_name("TS_Init_free"))) TS_Init_free(uint64_t this_obj) {
36856         LDKInit this_obj_conv;
36857         this_obj_conv.inner = untag_ptr(this_obj);
36858         this_obj_conv.is_owned = ptr_is_owned(this_obj);
36859         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
36860         Init_free(this_obj_conv);
36861 }
36862
36863 uint64_t  __attribute__((export_name("TS_Init_get_features"))) TS_Init_get_features(uint64_t this_ptr) {
36864         LDKInit this_ptr_conv;
36865         this_ptr_conv.inner = untag_ptr(this_ptr);
36866         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
36867         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
36868         this_ptr_conv.is_owned = false;
36869         LDKInitFeatures ret_var = Init_get_features(&this_ptr_conv);
36870         uint64_t ret_ref = 0;
36871         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
36872         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
36873         return ret_ref;
36874 }
36875
36876 void  __attribute__((export_name("TS_Init_set_features"))) TS_Init_set_features(uint64_t this_ptr, uint64_t val) {
36877         LDKInit this_ptr_conv;
36878         this_ptr_conv.inner = untag_ptr(this_ptr);
36879         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
36880         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
36881         this_ptr_conv.is_owned = false;
36882         LDKInitFeatures val_conv;
36883         val_conv.inner = untag_ptr(val);
36884         val_conv.is_owned = ptr_is_owned(val);
36885         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
36886         val_conv = InitFeatures_clone(&val_conv);
36887         Init_set_features(&this_ptr_conv, val_conv);
36888 }
36889
36890 uint64_t  __attribute__((export_name("TS_Init_get_networks"))) TS_Init_get_networks(uint64_t this_ptr) {
36891         LDKInit this_ptr_conv;
36892         this_ptr_conv.inner = untag_ptr(this_ptr);
36893         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
36894         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
36895         this_ptr_conv.is_owned = false;
36896         LDKCOption_CVec_ThirtyTwoBytesZZ *ret_copy = MALLOC(sizeof(LDKCOption_CVec_ThirtyTwoBytesZZ), "LDKCOption_CVec_ThirtyTwoBytesZZ");
36897         *ret_copy = Init_get_networks(&this_ptr_conv);
36898         uint64_t ret_ref = tag_ptr(ret_copy, true);
36899         return ret_ref;
36900 }
36901
36902 void  __attribute__((export_name("TS_Init_set_networks"))) TS_Init_set_networks(uint64_t this_ptr, uint64_t val) {
36903         LDKInit this_ptr_conv;
36904         this_ptr_conv.inner = untag_ptr(this_ptr);
36905         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
36906         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
36907         this_ptr_conv.is_owned = false;
36908         void* val_ptr = untag_ptr(val);
36909         CHECK_ACCESS(val_ptr);
36910         LDKCOption_CVec_ThirtyTwoBytesZZ val_conv = *(LDKCOption_CVec_ThirtyTwoBytesZZ*)(val_ptr);
36911         val_conv = COption_CVec_ThirtyTwoBytesZZ_clone((LDKCOption_CVec_ThirtyTwoBytesZZ*)untag_ptr(val));
36912         Init_set_networks(&this_ptr_conv, val_conv);
36913 }
36914
36915 uint64_t  __attribute__((export_name("TS_Init_get_remote_network_address"))) TS_Init_get_remote_network_address(uint64_t this_ptr) {
36916         LDKInit this_ptr_conv;
36917         this_ptr_conv.inner = untag_ptr(this_ptr);
36918         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
36919         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
36920         this_ptr_conv.is_owned = false;
36921         LDKCOption_SocketAddressZ *ret_copy = MALLOC(sizeof(LDKCOption_SocketAddressZ), "LDKCOption_SocketAddressZ");
36922         *ret_copy = Init_get_remote_network_address(&this_ptr_conv);
36923         uint64_t ret_ref = tag_ptr(ret_copy, true);
36924         return ret_ref;
36925 }
36926
36927 void  __attribute__((export_name("TS_Init_set_remote_network_address"))) TS_Init_set_remote_network_address(uint64_t this_ptr, uint64_t val) {
36928         LDKInit this_ptr_conv;
36929         this_ptr_conv.inner = untag_ptr(this_ptr);
36930         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
36931         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
36932         this_ptr_conv.is_owned = false;
36933         void* val_ptr = untag_ptr(val);
36934         CHECK_ACCESS(val_ptr);
36935         LDKCOption_SocketAddressZ val_conv = *(LDKCOption_SocketAddressZ*)(val_ptr);
36936         val_conv = COption_SocketAddressZ_clone((LDKCOption_SocketAddressZ*)untag_ptr(val));
36937         Init_set_remote_network_address(&this_ptr_conv, val_conv);
36938 }
36939
36940 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) {
36941         LDKInitFeatures features_arg_conv;
36942         features_arg_conv.inner = untag_ptr(features_arg);
36943         features_arg_conv.is_owned = ptr_is_owned(features_arg);
36944         CHECK_INNER_FIELD_ACCESS_OR_NULL(features_arg_conv);
36945         features_arg_conv = InitFeatures_clone(&features_arg_conv);
36946         void* networks_arg_ptr = untag_ptr(networks_arg);
36947         CHECK_ACCESS(networks_arg_ptr);
36948         LDKCOption_CVec_ThirtyTwoBytesZZ networks_arg_conv = *(LDKCOption_CVec_ThirtyTwoBytesZZ*)(networks_arg_ptr);
36949         networks_arg_conv = COption_CVec_ThirtyTwoBytesZZ_clone((LDKCOption_CVec_ThirtyTwoBytesZZ*)untag_ptr(networks_arg));
36950         void* remote_network_address_arg_ptr = untag_ptr(remote_network_address_arg);
36951         CHECK_ACCESS(remote_network_address_arg_ptr);
36952         LDKCOption_SocketAddressZ remote_network_address_arg_conv = *(LDKCOption_SocketAddressZ*)(remote_network_address_arg_ptr);
36953         LDKInit ret_var = Init_new(features_arg_conv, networks_arg_conv, remote_network_address_arg_conv);
36954         uint64_t ret_ref = 0;
36955         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
36956         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
36957         return ret_ref;
36958 }
36959
36960 static inline uint64_t Init_clone_ptr(LDKInit *NONNULL_PTR arg) {
36961         LDKInit ret_var = Init_clone(arg);
36962         uint64_t ret_ref = 0;
36963         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
36964         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
36965         return ret_ref;
36966 }
36967 int64_t  __attribute__((export_name("TS_Init_clone_ptr"))) TS_Init_clone_ptr(uint64_t arg) {
36968         LDKInit arg_conv;
36969         arg_conv.inner = untag_ptr(arg);
36970         arg_conv.is_owned = ptr_is_owned(arg);
36971         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
36972         arg_conv.is_owned = false;
36973         int64_t ret_conv = Init_clone_ptr(&arg_conv);
36974         return ret_conv;
36975 }
36976
36977 uint64_t  __attribute__((export_name("TS_Init_clone"))) TS_Init_clone(uint64_t orig) {
36978         LDKInit orig_conv;
36979         orig_conv.inner = untag_ptr(orig);
36980         orig_conv.is_owned = ptr_is_owned(orig);
36981         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
36982         orig_conv.is_owned = false;
36983         LDKInit ret_var = Init_clone(&orig_conv);
36984         uint64_t ret_ref = 0;
36985         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
36986         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
36987         return ret_ref;
36988 }
36989
36990 jboolean  __attribute__((export_name("TS_Init_eq"))) TS_Init_eq(uint64_t a, uint64_t b) {
36991         LDKInit a_conv;
36992         a_conv.inner = untag_ptr(a);
36993         a_conv.is_owned = ptr_is_owned(a);
36994         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
36995         a_conv.is_owned = false;
36996         LDKInit b_conv;
36997         b_conv.inner = untag_ptr(b);
36998         b_conv.is_owned = ptr_is_owned(b);
36999         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
37000         b_conv.is_owned = false;
37001         jboolean ret_conv = Init_eq(&a_conv, &b_conv);
37002         return ret_conv;
37003 }
37004
37005 void  __attribute__((export_name("TS_ErrorMessage_free"))) TS_ErrorMessage_free(uint64_t this_obj) {
37006         LDKErrorMessage this_obj_conv;
37007         this_obj_conv.inner = untag_ptr(this_obj);
37008         this_obj_conv.is_owned = ptr_is_owned(this_obj);
37009         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
37010         ErrorMessage_free(this_obj_conv);
37011 }
37012
37013 int8_tArray  __attribute__((export_name("TS_ErrorMessage_get_channel_id"))) TS_ErrorMessage_get_channel_id(uint64_t this_ptr) {
37014         LDKErrorMessage this_ptr_conv;
37015         this_ptr_conv.inner = untag_ptr(this_ptr);
37016         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
37017         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
37018         this_ptr_conv.is_owned = false;
37019         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
37020         memcpy(ret_arr->elems, *ErrorMessage_get_channel_id(&this_ptr_conv), 32);
37021         return ret_arr;
37022 }
37023
37024 void  __attribute__((export_name("TS_ErrorMessage_set_channel_id"))) TS_ErrorMessage_set_channel_id(uint64_t this_ptr, int8_tArray val) {
37025         LDKErrorMessage this_ptr_conv;
37026         this_ptr_conv.inner = untag_ptr(this_ptr);
37027         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
37028         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
37029         this_ptr_conv.is_owned = false;
37030         LDKThirtyTwoBytes val_ref;
37031         CHECK(val->arr_len == 32);
37032         memcpy(val_ref.data, val->elems, 32); FREE(val);
37033         ErrorMessage_set_channel_id(&this_ptr_conv, val_ref);
37034 }
37035
37036 jstring  __attribute__((export_name("TS_ErrorMessage_get_data"))) TS_ErrorMessage_get_data(uint64_t this_ptr) {
37037         LDKErrorMessage this_ptr_conv;
37038         this_ptr_conv.inner = untag_ptr(this_ptr);
37039         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
37040         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
37041         this_ptr_conv.is_owned = false;
37042         LDKStr ret_str = ErrorMessage_get_data(&this_ptr_conv);
37043         jstring ret_conv = str_ref_to_ts(ret_str.chars, ret_str.len);
37044         Str_free(ret_str);
37045         return ret_conv;
37046 }
37047
37048 void  __attribute__((export_name("TS_ErrorMessage_set_data"))) TS_ErrorMessage_set_data(uint64_t this_ptr, jstring val) {
37049         LDKErrorMessage this_ptr_conv;
37050         this_ptr_conv.inner = untag_ptr(this_ptr);
37051         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
37052         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
37053         this_ptr_conv.is_owned = false;
37054         LDKStr val_conv = str_ref_to_owned_c(val);
37055         ErrorMessage_set_data(&this_ptr_conv, val_conv);
37056 }
37057
37058 uint64_t  __attribute__((export_name("TS_ErrorMessage_new"))) TS_ErrorMessage_new(int8_tArray channel_id_arg, jstring data_arg) {
37059         LDKThirtyTwoBytes channel_id_arg_ref;
37060         CHECK(channel_id_arg->arr_len == 32);
37061         memcpy(channel_id_arg_ref.data, channel_id_arg->elems, 32); FREE(channel_id_arg);
37062         LDKStr data_arg_conv = str_ref_to_owned_c(data_arg);
37063         LDKErrorMessage ret_var = ErrorMessage_new(channel_id_arg_ref, data_arg_conv);
37064         uint64_t ret_ref = 0;
37065         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
37066         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
37067         return ret_ref;
37068 }
37069
37070 static inline uint64_t ErrorMessage_clone_ptr(LDKErrorMessage *NONNULL_PTR arg) {
37071         LDKErrorMessage ret_var = ErrorMessage_clone(arg);
37072         uint64_t ret_ref = 0;
37073         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
37074         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
37075         return ret_ref;
37076 }
37077 int64_t  __attribute__((export_name("TS_ErrorMessage_clone_ptr"))) TS_ErrorMessage_clone_ptr(uint64_t arg) {
37078         LDKErrorMessage arg_conv;
37079         arg_conv.inner = untag_ptr(arg);
37080         arg_conv.is_owned = ptr_is_owned(arg);
37081         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
37082         arg_conv.is_owned = false;
37083         int64_t ret_conv = ErrorMessage_clone_ptr(&arg_conv);
37084         return ret_conv;
37085 }
37086
37087 uint64_t  __attribute__((export_name("TS_ErrorMessage_clone"))) TS_ErrorMessage_clone(uint64_t orig) {
37088         LDKErrorMessage orig_conv;
37089         orig_conv.inner = untag_ptr(orig);
37090         orig_conv.is_owned = ptr_is_owned(orig);
37091         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
37092         orig_conv.is_owned = false;
37093         LDKErrorMessage ret_var = ErrorMessage_clone(&orig_conv);
37094         uint64_t ret_ref = 0;
37095         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
37096         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
37097         return ret_ref;
37098 }
37099
37100 jboolean  __attribute__((export_name("TS_ErrorMessage_eq"))) TS_ErrorMessage_eq(uint64_t a, uint64_t b) {
37101         LDKErrorMessage a_conv;
37102         a_conv.inner = untag_ptr(a);
37103         a_conv.is_owned = ptr_is_owned(a);
37104         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
37105         a_conv.is_owned = false;
37106         LDKErrorMessage b_conv;
37107         b_conv.inner = untag_ptr(b);
37108         b_conv.is_owned = ptr_is_owned(b);
37109         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
37110         b_conv.is_owned = false;
37111         jboolean ret_conv = ErrorMessage_eq(&a_conv, &b_conv);
37112         return ret_conv;
37113 }
37114
37115 void  __attribute__((export_name("TS_WarningMessage_free"))) TS_WarningMessage_free(uint64_t this_obj) {
37116         LDKWarningMessage this_obj_conv;
37117         this_obj_conv.inner = untag_ptr(this_obj);
37118         this_obj_conv.is_owned = ptr_is_owned(this_obj);
37119         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
37120         WarningMessage_free(this_obj_conv);
37121 }
37122
37123 int8_tArray  __attribute__((export_name("TS_WarningMessage_get_channel_id"))) TS_WarningMessage_get_channel_id(uint64_t this_ptr) {
37124         LDKWarningMessage this_ptr_conv;
37125         this_ptr_conv.inner = untag_ptr(this_ptr);
37126         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
37127         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
37128         this_ptr_conv.is_owned = false;
37129         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
37130         memcpy(ret_arr->elems, *WarningMessage_get_channel_id(&this_ptr_conv), 32);
37131         return ret_arr;
37132 }
37133
37134 void  __attribute__((export_name("TS_WarningMessage_set_channel_id"))) TS_WarningMessage_set_channel_id(uint64_t this_ptr, int8_tArray val) {
37135         LDKWarningMessage this_ptr_conv;
37136         this_ptr_conv.inner = untag_ptr(this_ptr);
37137         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
37138         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
37139         this_ptr_conv.is_owned = false;
37140         LDKThirtyTwoBytes val_ref;
37141         CHECK(val->arr_len == 32);
37142         memcpy(val_ref.data, val->elems, 32); FREE(val);
37143         WarningMessage_set_channel_id(&this_ptr_conv, val_ref);
37144 }
37145
37146 jstring  __attribute__((export_name("TS_WarningMessage_get_data"))) TS_WarningMessage_get_data(uint64_t this_ptr) {
37147         LDKWarningMessage this_ptr_conv;
37148         this_ptr_conv.inner = untag_ptr(this_ptr);
37149         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
37150         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
37151         this_ptr_conv.is_owned = false;
37152         LDKStr ret_str = WarningMessage_get_data(&this_ptr_conv);
37153         jstring ret_conv = str_ref_to_ts(ret_str.chars, ret_str.len);
37154         Str_free(ret_str);
37155         return ret_conv;
37156 }
37157
37158 void  __attribute__((export_name("TS_WarningMessage_set_data"))) TS_WarningMessage_set_data(uint64_t this_ptr, jstring val) {
37159         LDKWarningMessage this_ptr_conv;
37160         this_ptr_conv.inner = untag_ptr(this_ptr);
37161         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
37162         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
37163         this_ptr_conv.is_owned = false;
37164         LDKStr val_conv = str_ref_to_owned_c(val);
37165         WarningMessage_set_data(&this_ptr_conv, val_conv);
37166 }
37167
37168 uint64_t  __attribute__((export_name("TS_WarningMessage_new"))) TS_WarningMessage_new(int8_tArray channel_id_arg, jstring data_arg) {
37169         LDKThirtyTwoBytes channel_id_arg_ref;
37170         CHECK(channel_id_arg->arr_len == 32);
37171         memcpy(channel_id_arg_ref.data, channel_id_arg->elems, 32); FREE(channel_id_arg);
37172         LDKStr data_arg_conv = str_ref_to_owned_c(data_arg);
37173         LDKWarningMessage ret_var = WarningMessage_new(channel_id_arg_ref, data_arg_conv);
37174         uint64_t ret_ref = 0;
37175         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
37176         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
37177         return ret_ref;
37178 }
37179
37180 static inline uint64_t WarningMessage_clone_ptr(LDKWarningMessage *NONNULL_PTR arg) {
37181         LDKWarningMessage ret_var = WarningMessage_clone(arg);
37182         uint64_t ret_ref = 0;
37183         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
37184         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
37185         return ret_ref;
37186 }
37187 int64_t  __attribute__((export_name("TS_WarningMessage_clone_ptr"))) TS_WarningMessage_clone_ptr(uint64_t arg) {
37188         LDKWarningMessage arg_conv;
37189         arg_conv.inner = untag_ptr(arg);
37190         arg_conv.is_owned = ptr_is_owned(arg);
37191         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
37192         arg_conv.is_owned = false;
37193         int64_t ret_conv = WarningMessage_clone_ptr(&arg_conv);
37194         return ret_conv;
37195 }
37196
37197 uint64_t  __attribute__((export_name("TS_WarningMessage_clone"))) TS_WarningMessage_clone(uint64_t orig) {
37198         LDKWarningMessage orig_conv;
37199         orig_conv.inner = untag_ptr(orig);
37200         orig_conv.is_owned = ptr_is_owned(orig);
37201         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
37202         orig_conv.is_owned = false;
37203         LDKWarningMessage ret_var = WarningMessage_clone(&orig_conv);
37204         uint64_t ret_ref = 0;
37205         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
37206         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
37207         return ret_ref;
37208 }
37209
37210 jboolean  __attribute__((export_name("TS_WarningMessage_eq"))) TS_WarningMessage_eq(uint64_t a, uint64_t b) {
37211         LDKWarningMessage a_conv;
37212         a_conv.inner = untag_ptr(a);
37213         a_conv.is_owned = ptr_is_owned(a);
37214         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
37215         a_conv.is_owned = false;
37216         LDKWarningMessage b_conv;
37217         b_conv.inner = untag_ptr(b);
37218         b_conv.is_owned = ptr_is_owned(b);
37219         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
37220         b_conv.is_owned = false;
37221         jboolean ret_conv = WarningMessage_eq(&a_conv, &b_conv);
37222         return ret_conv;
37223 }
37224
37225 void  __attribute__((export_name("TS_Ping_free"))) TS_Ping_free(uint64_t this_obj) {
37226         LDKPing this_obj_conv;
37227         this_obj_conv.inner = untag_ptr(this_obj);
37228         this_obj_conv.is_owned = ptr_is_owned(this_obj);
37229         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
37230         Ping_free(this_obj_conv);
37231 }
37232
37233 int16_t  __attribute__((export_name("TS_Ping_get_ponglen"))) TS_Ping_get_ponglen(uint64_t this_ptr) {
37234         LDKPing this_ptr_conv;
37235         this_ptr_conv.inner = untag_ptr(this_ptr);
37236         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
37237         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
37238         this_ptr_conv.is_owned = false;
37239         int16_t ret_conv = Ping_get_ponglen(&this_ptr_conv);
37240         return ret_conv;
37241 }
37242
37243 void  __attribute__((export_name("TS_Ping_set_ponglen"))) TS_Ping_set_ponglen(uint64_t this_ptr, int16_t val) {
37244         LDKPing this_ptr_conv;
37245         this_ptr_conv.inner = untag_ptr(this_ptr);
37246         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
37247         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
37248         this_ptr_conv.is_owned = false;
37249         Ping_set_ponglen(&this_ptr_conv, val);
37250 }
37251
37252 int16_t  __attribute__((export_name("TS_Ping_get_byteslen"))) TS_Ping_get_byteslen(uint64_t this_ptr) {
37253         LDKPing this_ptr_conv;
37254         this_ptr_conv.inner = untag_ptr(this_ptr);
37255         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
37256         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
37257         this_ptr_conv.is_owned = false;
37258         int16_t ret_conv = Ping_get_byteslen(&this_ptr_conv);
37259         return ret_conv;
37260 }
37261
37262 void  __attribute__((export_name("TS_Ping_set_byteslen"))) TS_Ping_set_byteslen(uint64_t this_ptr, int16_t val) {
37263         LDKPing this_ptr_conv;
37264         this_ptr_conv.inner = untag_ptr(this_ptr);
37265         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
37266         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
37267         this_ptr_conv.is_owned = false;
37268         Ping_set_byteslen(&this_ptr_conv, val);
37269 }
37270
37271 uint64_t  __attribute__((export_name("TS_Ping_new"))) TS_Ping_new(int16_t ponglen_arg, int16_t byteslen_arg) {
37272         LDKPing ret_var = Ping_new(ponglen_arg, byteslen_arg);
37273         uint64_t ret_ref = 0;
37274         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
37275         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
37276         return ret_ref;
37277 }
37278
37279 static inline uint64_t Ping_clone_ptr(LDKPing *NONNULL_PTR arg) {
37280         LDKPing ret_var = Ping_clone(arg);
37281         uint64_t ret_ref = 0;
37282         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
37283         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
37284         return ret_ref;
37285 }
37286 int64_t  __attribute__((export_name("TS_Ping_clone_ptr"))) TS_Ping_clone_ptr(uint64_t arg) {
37287         LDKPing arg_conv;
37288         arg_conv.inner = untag_ptr(arg);
37289         arg_conv.is_owned = ptr_is_owned(arg);
37290         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
37291         arg_conv.is_owned = false;
37292         int64_t ret_conv = Ping_clone_ptr(&arg_conv);
37293         return ret_conv;
37294 }
37295
37296 uint64_t  __attribute__((export_name("TS_Ping_clone"))) TS_Ping_clone(uint64_t orig) {
37297         LDKPing orig_conv;
37298         orig_conv.inner = untag_ptr(orig);
37299         orig_conv.is_owned = ptr_is_owned(orig);
37300         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
37301         orig_conv.is_owned = false;
37302         LDKPing ret_var = Ping_clone(&orig_conv);
37303         uint64_t ret_ref = 0;
37304         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
37305         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
37306         return ret_ref;
37307 }
37308
37309 jboolean  __attribute__((export_name("TS_Ping_eq"))) TS_Ping_eq(uint64_t a, uint64_t b) {
37310         LDKPing a_conv;
37311         a_conv.inner = untag_ptr(a);
37312         a_conv.is_owned = ptr_is_owned(a);
37313         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
37314         a_conv.is_owned = false;
37315         LDKPing b_conv;
37316         b_conv.inner = untag_ptr(b);
37317         b_conv.is_owned = ptr_is_owned(b);
37318         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
37319         b_conv.is_owned = false;
37320         jboolean ret_conv = Ping_eq(&a_conv, &b_conv);
37321         return ret_conv;
37322 }
37323
37324 void  __attribute__((export_name("TS_Pong_free"))) TS_Pong_free(uint64_t this_obj) {
37325         LDKPong this_obj_conv;
37326         this_obj_conv.inner = untag_ptr(this_obj);
37327         this_obj_conv.is_owned = ptr_is_owned(this_obj);
37328         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
37329         Pong_free(this_obj_conv);
37330 }
37331
37332 int16_t  __attribute__((export_name("TS_Pong_get_byteslen"))) TS_Pong_get_byteslen(uint64_t this_ptr) {
37333         LDKPong this_ptr_conv;
37334         this_ptr_conv.inner = untag_ptr(this_ptr);
37335         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
37336         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
37337         this_ptr_conv.is_owned = false;
37338         int16_t ret_conv = Pong_get_byteslen(&this_ptr_conv);
37339         return ret_conv;
37340 }
37341
37342 void  __attribute__((export_name("TS_Pong_set_byteslen"))) TS_Pong_set_byteslen(uint64_t this_ptr, int16_t val) {
37343         LDKPong this_ptr_conv;
37344         this_ptr_conv.inner = untag_ptr(this_ptr);
37345         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
37346         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
37347         this_ptr_conv.is_owned = false;
37348         Pong_set_byteslen(&this_ptr_conv, val);
37349 }
37350
37351 uint64_t  __attribute__((export_name("TS_Pong_new"))) TS_Pong_new(int16_t byteslen_arg) {
37352         LDKPong ret_var = Pong_new(byteslen_arg);
37353         uint64_t ret_ref = 0;
37354         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
37355         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
37356         return ret_ref;
37357 }
37358
37359 static inline uint64_t Pong_clone_ptr(LDKPong *NONNULL_PTR arg) {
37360         LDKPong ret_var = Pong_clone(arg);
37361         uint64_t ret_ref = 0;
37362         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
37363         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
37364         return ret_ref;
37365 }
37366 int64_t  __attribute__((export_name("TS_Pong_clone_ptr"))) TS_Pong_clone_ptr(uint64_t arg) {
37367         LDKPong arg_conv;
37368         arg_conv.inner = untag_ptr(arg);
37369         arg_conv.is_owned = ptr_is_owned(arg);
37370         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
37371         arg_conv.is_owned = false;
37372         int64_t ret_conv = Pong_clone_ptr(&arg_conv);
37373         return ret_conv;
37374 }
37375
37376 uint64_t  __attribute__((export_name("TS_Pong_clone"))) TS_Pong_clone(uint64_t orig) {
37377         LDKPong orig_conv;
37378         orig_conv.inner = untag_ptr(orig);
37379         orig_conv.is_owned = ptr_is_owned(orig);
37380         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
37381         orig_conv.is_owned = false;
37382         LDKPong ret_var = Pong_clone(&orig_conv);
37383         uint64_t ret_ref = 0;
37384         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
37385         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
37386         return ret_ref;
37387 }
37388
37389 jboolean  __attribute__((export_name("TS_Pong_eq"))) TS_Pong_eq(uint64_t a, uint64_t b) {
37390         LDKPong a_conv;
37391         a_conv.inner = untag_ptr(a);
37392         a_conv.is_owned = ptr_is_owned(a);
37393         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
37394         a_conv.is_owned = false;
37395         LDKPong b_conv;
37396         b_conv.inner = untag_ptr(b);
37397         b_conv.is_owned = ptr_is_owned(b);
37398         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
37399         b_conv.is_owned = false;
37400         jboolean ret_conv = Pong_eq(&a_conv, &b_conv);
37401         return ret_conv;
37402 }
37403
37404 void  __attribute__((export_name("TS_OpenChannel_free"))) TS_OpenChannel_free(uint64_t this_obj) {
37405         LDKOpenChannel this_obj_conv;
37406         this_obj_conv.inner = untag_ptr(this_obj);
37407         this_obj_conv.is_owned = ptr_is_owned(this_obj);
37408         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
37409         OpenChannel_free(this_obj_conv);
37410 }
37411
37412 int8_tArray  __attribute__((export_name("TS_OpenChannel_get_chain_hash"))) TS_OpenChannel_get_chain_hash(uint64_t this_ptr) {
37413         LDKOpenChannel this_ptr_conv;
37414         this_ptr_conv.inner = untag_ptr(this_ptr);
37415         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
37416         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
37417         this_ptr_conv.is_owned = false;
37418         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
37419         memcpy(ret_arr->elems, *OpenChannel_get_chain_hash(&this_ptr_conv), 32);
37420         return ret_arr;
37421 }
37422
37423 void  __attribute__((export_name("TS_OpenChannel_set_chain_hash"))) TS_OpenChannel_set_chain_hash(uint64_t this_ptr, int8_tArray val) {
37424         LDKOpenChannel this_ptr_conv;
37425         this_ptr_conv.inner = untag_ptr(this_ptr);
37426         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
37427         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
37428         this_ptr_conv.is_owned = false;
37429         LDKThirtyTwoBytes val_ref;
37430         CHECK(val->arr_len == 32);
37431         memcpy(val_ref.data, val->elems, 32); FREE(val);
37432         OpenChannel_set_chain_hash(&this_ptr_conv, val_ref);
37433 }
37434
37435 int8_tArray  __attribute__((export_name("TS_OpenChannel_get_temporary_channel_id"))) TS_OpenChannel_get_temporary_channel_id(uint64_t this_ptr) {
37436         LDKOpenChannel this_ptr_conv;
37437         this_ptr_conv.inner = untag_ptr(this_ptr);
37438         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
37439         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
37440         this_ptr_conv.is_owned = false;
37441         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
37442         memcpy(ret_arr->elems, *OpenChannel_get_temporary_channel_id(&this_ptr_conv), 32);
37443         return ret_arr;
37444 }
37445
37446 void  __attribute__((export_name("TS_OpenChannel_set_temporary_channel_id"))) TS_OpenChannel_set_temporary_channel_id(uint64_t this_ptr, int8_tArray val) {
37447         LDKOpenChannel this_ptr_conv;
37448         this_ptr_conv.inner = untag_ptr(this_ptr);
37449         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
37450         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
37451         this_ptr_conv.is_owned = false;
37452         LDKThirtyTwoBytes val_ref;
37453         CHECK(val->arr_len == 32);
37454         memcpy(val_ref.data, val->elems, 32); FREE(val);
37455         OpenChannel_set_temporary_channel_id(&this_ptr_conv, val_ref);
37456 }
37457
37458 int64_t  __attribute__((export_name("TS_OpenChannel_get_funding_satoshis"))) TS_OpenChannel_get_funding_satoshis(uint64_t this_ptr) {
37459         LDKOpenChannel this_ptr_conv;
37460         this_ptr_conv.inner = untag_ptr(this_ptr);
37461         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
37462         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
37463         this_ptr_conv.is_owned = false;
37464         int64_t ret_conv = OpenChannel_get_funding_satoshis(&this_ptr_conv);
37465         return ret_conv;
37466 }
37467
37468 void  __attribute__((export_name("TS_OpenChannel_set_funding_satoshis"))) TS_OpenChannel_set_funding_satoshis(uint64_t this_ptr, int64_t val) {
37469         LDKOpenChannel this_ptr_conv;
37470         this_ptr_conv.inner = untag_ptr(this_ptr);
37471         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
37472         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
37473         this_ptr_conv.is_owned = false;
37474         OpenChannel_set_funding_satoshis(&this_ptr_conv, val);
37475 }
37476
37477 int64_t  __attribute__((export_name("TS_OpenChannel_get_push_msat"))) TS_OpenChannel_get_push_msat(uint64_t this_ptr) {
37478         LDKOpenChannel this_ptr_conv;
37479         this_ptr_conv.inner = untag_ptr(this_ptr);
37480         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
37481         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
37482         this_ptr_conv.is_owned = false;
37483         int64_t ret_conv = OpenChannel_get_push_msat(&this_ptr_conv);
37484         return ret_conv;
37485 }
37486
37487 void  __attribute__((export_name("TS_OpenChannel_set_push_msat"))) TS_OpenChannel_set_push_msat(uint64_t this_ptr, int64_t val) {
37488         LDKOpenChannel this_ptr_conv;
37489         this_ptr_conv.inner = untag_ptr(this_ptr);
37490         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
37491         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
37492         this_ptr_conv.is_owned = false;
37493         OpenChannel_set_push_msat(&this_ptr_conv, val);
37494 }
37495
37496 int64_t  __attribute__((export_name("TS_OpenChannel_get_dust_limit_satoshis"))) TS_OpenChannel_get_dust_limit_satoshis(uint64_t this_ptr) {
37497         LDKOpenChannel this_ptr_conv;
37498         this_ptr_conv.inner = untag_ptr(this_ptr);
37499         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
37500         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
37501         this_ptr_conv.is_owned = false;
37502         int64_t ret_conv = OpenChannel_get_dust_limit_satoshis(&this_ptr_conv);
37503         return ret_conv;
37504 }
37505
37506 void  __attribute__((export_name("TS_OpenChannel_set_dust_limit_satoshis"))) TS_OpenChannel_set_dust_limit_satoshis(uint64_t this_ptr, int64_t val) {
37507         LDKOpenChannel this_ptr_conv;
37508         this_ptr_conv.inner = untag_ptr(this_ptr);
37509         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
37510         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
37511         this_ptr_conv.is_owned = false;
37512         OpenChannel_set_dust_limit_satoshis(&this_ptr_conv, val);
37513 }
37514
37515 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) {
37516         LDKOpenChannel this_ptr_conv;
37517         this_ptr_conv.inner = untag_ptr(this_ptr);
37518         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
37519         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
37520         this_ptr_conv.is_owned = false;
37521         int64_t ret_conv = OpenChannel_get_max_htlc_value_in_flight_msat(&this_ptr_conv);
37522         return ret_conv;
37523 }
37524
37525 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) {
37526         LDKOpenChannel this_ptr_conv;
37527         this_ptr_conv.inner = untag_ptr(this_ptr);
37528         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
37529         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
37530         this_ptr_conv.is_owned = false;
37531         OpenChannel_set_max_htlc_value_in_flight_msat(&this_ptr_conv, val);
37532 }
37533
37534 int64_t  __attribute__((export_name("TS_OpenChannel_get_channel_reserve_satoshis"))) TS_OpenChannel_get_channel_reserve_satoshis(uint64_t this_ptr) {
37535         LDKOpenChannel this_ptr_conv;
37536         this_ptr_conv.inner = untag_ptr(this_ptr);
37537         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
37538         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
37539         this_ptr_conv.is_owned = false;
37540         int64_t ret_conv = OpenChannel_get_channel_reserve_satoshis(&this_ptr_conv);
37541         return ret_conv;
37542 }
37543
37544 void  __attribute__((export_name("TS_OpenChannel_set_channel_reserve_satoshis"))) TS_OpenChannel_set_channel_reserve_satoshis(uint64_t this_ptr, int64_t val) {
37545         LDKOpenChannel this_ptr_conv;
37546         this_ptr_conv.inner = untag_ptr(this_ptr);
37547         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
37548         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
37549         this_ptr_conv.is_owned = false;
37550         OpenChannel_set_channel_reserve_satoshis(&this_ptr_conv, val);
37551 }
37552
37553 int64_t  __attribute__((export_name("TS_OpenChannel_get_htlc_minimum_msat"))) TS_OpenChannel_get_htlc_minimum_msat(uint64_t this_ptr) {
37554         LDKOpenChannel this_ptr_conv;
37555         this_ptr_conv.inner = untag_ptr(this_ptr);
37556         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
37557         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
37558         this_ptr_conv.is_owned = false;
37559         int64_t ret_conv = OpenChannel_get_htlc_minimum_msat(&this_ptr_conv);
37560         return ret_conv;
37561 }
37562
37563 void  __attribute__((export_name("TS_OpenChannel_set_htlc_minimum_msat"))) TS_OpenChannel_set_htlc_minimum_msat(uint64_t this_ptr, int64_t val) {
37564         LDKOpenChannel this_ptr_conv;
37565         this_ptr_conv.inner = untag_ptr(this_ptr);
37566         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
37567         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
37568         this_ptr_conv.is_owned = false;
37569         OpenChannel_set_htlc_minimum_msat(&this_ptr_conv, val);
37570 }
37571
37572 int32_t  __attribute__((export_name("TS_OpenChannel_get_feerate_per_kw"))) TS_OpenChannel_get_feerate_per_kw(uint64_t this_ptr) {
37573         LDKOpenChannel this_ptr_conv;
37574         this_ptr_conv.inner = untag_ptr(this_ptr);
37575         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
37576         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
37577         this_ptr_conv.is_owned = false;
37578         int32_t ret_conv = OpenChannel_get_feerate_per_kw(&this_ptr_conv);
37579         return ret_conv;
37580 }
37581
37582 void  __attribute__((export_name("TS_OpenChannel_set_feerate_per_kw"))) TS_OpenChannel_set_feerate_per_kw(uint64_t this_ptr, int32_t val) {
37583         LDKOpenChannel this_ptr_conv;
37584         this_ptr_conv.inner = untag_ptr(this_ptr);
37585         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
37586         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
37587         this_ptr_conv.is_owned = false;
37588         OpenChannel_set_feerate_per_kw(&this_ptr_conv, val);
37589 }
37590
37591 int16_t  __attribute__((export_name("TS_OpenChannel_get_to_self_delay"))) TS_OpenChannel_get_to_self_delay(uint64_t this_ptr) {
37592         LDKOpenChannel this_ptr_conv;
37593         this_ptr_conv.inner = untag_ptr(this_ptr);
37594         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
37595         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
37596         this_ptr_conv.is_owned = false;
37597         int16_t ret_conv = OpenChannel_get_to_self_delay(&this_ptr_conv);
37598         return ret_conv;
37599 }
37600
37601 void  __attribute__((export_name("TS_OpenChannel_set_to_self_delay"))) TS_OpenChannel_set_to_self_delay(uint64_t this_ptr, int16_t val) {
37602         LDKOpenChannel this_ptr_conv;
37603         this_ptr_conv.inner = untag_ptr(this_ptr);
37604         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
37605         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
37606         this_ptr_conv.is_owned = false;
37607         OpenChannel_set_to_self_delay(&this_ptr_conv, val);
37608 }
37609
37610 int16_t  __attribute__((export_name("TS_OpenChannel_get_max_accepted_htlcs"))) TS_OpenChannel_get_max_accepted_htlcs(uint64_t this_ptr) {
37611         LDKOpenChannel this_ptr_conv;
37612         this_ptr_conv.inner = untag_ptr(this_ptr);
37613         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
37614         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
37615         this_ptr_conv.is_owned = false;
37616         int16_t ret_conv = OpenChannel_get_max_accepted_htlcs(&this_ptr_conv);
37617         return ret_conv;
37618 }
37619
37620 void  __attribute__((export_name("TS_OpenChannel_set_max_accepted_htlcs"))) TS_OpenChannel_set_max_accepted_htlcs(uint64_t this_ptr, int16_t val) {
37621         LDKOpenChannel this_ptr_conv;
37622         this_ptr_conv.inner = untag_ptr(this_ptr);
37623         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
37624         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
37625         this_ptr_conv.is_owned = false;
37626         OpenChannel_set_max_accepted_htlcs(&this_ptr_conv, val);
37627 }
37628
37629 int8_tArray  __attribute__((export_name("TS_OpenChannel_get_funding_pubkey"))) TS_OpenChannel_get_funding_pubkey(uint64_t this_ptr) {
37630         LDKOpenChannel this_ptr_conv;
37631         this_ptr_conv.inner = untag_ptr(this_ptr);
37632         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
37633         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
37634         this_ptr_conv.is_owned = false;
37635         int8_tArray ret_arr = init_int8_tArray(33, __LINE__);
37636         memcpy(ret_arr->elems, OpenChannel_get_funding_pubkey(&this_ptr_conv).compressed_form, 33);
37637         return ret_arr;
37638 }
37639
37640 void  __attribute__((export_name("TS_OpenChannel_set_funding_pubkey"))) TS_OpenChannel_set_funding_pubkey(uint64_t this_ptr, int8_tArray val) {
37641         LDKOpenChannel this_ptr_conv;
37642         this_ptr_conv.inner = untag_ptr(this_ptr);
37643         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
37644         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
37645         this_ptr_conv.is_owned = false;
37646         LDKPublicKey val_ref;
37647         CHECK(val->arr_len == 33);
37648         memcpy(val_ref.compressed_form, val->elems, 33); FREE(val);
37649         OpenChannel_set_funding_pubkey(&this_ptr_conv, val_ref);
37650 }
37651
37652 int8_tArray  __attribute__((export_name("TS_OpenChannel_get_revocation_basepoint"))) TS_OpenChannel_get_revocation_basepoint(uint64_t this_ptr) {
37653         LDKOpenChannel this_ptr_conv;
37654         this_ptr_conv.inner = untag_ptr(this_ptr);
37655         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
37656         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
37657         this_ptr_conv.is_owned = false;
37658         int8_tArray ret_arr = init_int8_tArray(33, __LINE__);
37659         memcpy(ret_arr->elems, OpenChannel_get_revocation_basepoint(&this_ptr_conv).compressed_form, 33);
37660         return ret_arr;
37661 }
37662
37663 void  __attribute__((export_name("TS_OpenChannel_set_revocation_basepoint"))) TS_OpenChannel_set_revocation_basepoint(uint64_t this_ptr, int8_tArray val) {
37664         LDKOpenChannel this_ptr_conv;
37665         this_ptr_conv.inner = untag_ptr(this_ptr);
37666         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
37667         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
37668         this_ptr_conv.is_owned = false;
37669         LDKPublicKey val_ref;
37670         CHECK(val->arr_len == 33);
37671         memcpy(val_ref.compressed_form, val->elems, 33); FREE(val);
37672         OpenChannel_set_revocation_basepoint(&this_ptr_conv, val_ref);
37673 }
37674
37675 int8_tArray  __attribute__((export_name("TS_OpenChannel_get_payment_point"))) TS_OpenChannel_get_payment_point(uint64_t this_ptr) {
37676         LDKOpenChannel this_ptr_conv;
37677         this_ptr_conv.inner = untag_ptr(this_ptr);
37678         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
37679         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
37680         this_ptr_conv.is_owned = false;
37681         int8_tArray ret_arr = init_int8_tArray(33, __LINE__);
37682         memcpy(ret_arr->elems, OpenChannel_get_payment_point(&this_ptr_conv).compressed_form, 33);
37683         return ret_arr;
37684 }
37685
37686 void  __attribute__((export_name("TS_OpenChannel_set_payment_point"))) TS_OpenChannel_set_payment_point(uint64_t this_ptr, int8_tArray val) {
37687         LDKOpenChannel this_ptr_conv;
37688         this_ptr_conv.inner = untag_ptr(this_ptr);
37689         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
37690         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
37691         this_ptr_conv.is_owned = false;
37692         LDKPublicKey val_ref;
37693         CHECK(val->arr_len == 33);
37694         memcpy(val_ref.compressed_form, val->elems, 33); FREE(val);
37695         OpenChannel_set_payment_point(&this_ptr_conv, val_ref);
37696 }
37697
37698 int8_tArray  __attribute__((export_name("TS_OpenChannel_get_delayed_payment_basepoint"))) TS_OpenChannel_get_delayed_payment_basepoint(uint64_t this_ptr) {
37699         LDKOpenChannel this_ptr_conv;
37700         this_ptr_conv.inner = untag_ptr(this_ptr);
37701         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
37702         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
37703         this_ptr_conv.is_owned = false;
37704         int8_tArray ret_arr = init_int8_tArray(33, __LINE__);
37705         memcpy(ret_arr->elems, OpenChannel_get_delayed_payment_basepoint(&this_ptr_conv).compressed_form, 33);
37706         return ret_arr;
37707 }
37708
37709 void  __attribute__((export_name("TS_OpenChannel_set_delayed_payment_basepoint"))) TS_OpenChannel_set_delayed_payment_basepoint(uint64_t this_ptr, int8_tArray val) {
37710         LDKOpenChannel this_ptr_conv;
37711         this_ptr_conv.inner = untag_ptr(this_ptr);
37712         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
37713         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
37714         this_ptr_conv.is_owned = false;
37715         LDKPublicKey val_ref;
37716         CHECK(val->arr_len == 33);
37717         memcpy(val_ref.compressed_form, val->elems, 33); FREE(val);
37718         OpenChannel_set_delayed_payment_basepoint(&this_ptr_conv, val_ref);
37719 }
37720
37721 int8_tArray  __attribute__((export_name("TS_OpenChannel_get_htlc_basepoint"))) TS_OpenChannel_get_htlc_basepoint(uint64_t this_ptr) {
37722         LDKOpenChannel this_ptr_conv;
37723         this_ptr_conv.inner = untag_ptr(this_ptr);
37724         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
37725         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
37726         this_ptr_conv.is_owned = false;
37727         int8_tArray ret_arr = init_int8_tArray(33, __LINE__);
37728         memcpy(ret_arr->elems, OpenChannel_get_htlc_basepoint(&this_ptr_conv).compressed_form, 33);
37729         return ret_arr;
37730 }
37731
37732 void  __attribute__((export_name("TS_OpenChannel_set_htlc_basepoint"))) TS_OpenChannel_set_htlc_basepoint(uint64_t this_ptr, int8_tArray val) {
37733         LDKOpenChannel this_ptr_conv;
37734         this_ptr_conv.inner = untag_ptr(this_ptr);
37735         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
37736         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
37737         this_ptr_conv.is_owned = false;
37738         LDKPublicKey val_ref;
37739         CHECK(val->arr_len == 33);
37740         memcpy(val_ref.compressed_form, val->elems, 33); FREE(val);
37741         OpenChannel_set_htlc_basepoint(&this_ptr_conv, val_ref);
37742 }
37743
37744 int8_tArray  __attribute__((export_name("TS_OpenChannel_get_first_per_commitment_point"))) TS_OpenChannel_get_first_per_commitment_point(uint64_t this_ptr) {
37745         LDKOpenChannel this_ptr_conv;
37746         this_ptr_conv.inner = untag_ptr(this_ptr);
37747         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
37748         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
37749         this_ptr_conv.is_owned = false;
37750         int8_tArray ret_arr = init_int8_tArray(33, __LINE__);
37751         memcpy(ret_arr->elems, OpenChannel_get_first_per_commitment_point(&this_ptr_conv).compressed_form, 33);
37752         return ret_arr;
37753 }
37754
37755 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) {
37756         LDKOpenChannel this_ptr_conv;
37757         this_ptr_conv.inner = untag_ptr(this_ptr);
37758         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
37759         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
37760         this_ptr_conv.is_owned = false;
37761         LDKPublicKey val_ref;
37762         CHECK(val->arr_len == 33);
37763         memcpy(val_ref.compressed_form, val->elems, 33); FREE(val);
37764         OpenChannel_set_first_per_commitment_point(&this_ptr_conv, val_ref);
37765 }
37766
37767 int8_t  __attribute__((export_name("TS_OpenChannel_get_channel_flags"))) TS_OpenChannel_get_channel_flags(uint64_t this_ptr) {
37768         LDKOpenChannel this_ptr_conv;
37769         this_ptr_conv.inner = untag_ptr(this_ptr);
37770         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
37771         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
37772         this_ptr_conv.is_owned = false;
37773         int8_t ret_conv = OpenChannel_get_channel_flags(&this_ptr_conv);
37774         return ret_conv;
37775 }
37776
37777 void  __attribute__((export_name("TS_OpenChannel_set_channel_flags"))) TS_OpenChannel_set_channel_flags(uint64_t this_ptr, int8_t val) {
37778         LDKOpenChannel this_ptr_conv;
37779         this_ptr_conv.inner = untag_ptr(this_ptr);
37780         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
37781         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
37782         this_ptr_conv.is_owned = false;
37783         OpenChannel_set_channel_flags(&this_ptr_conv, val);
37784 }
37785
37786 uint64_t  __attribute__((export_name("TS_OpenChannel_get_shutdown_scriptpubkey"))) TS_OpenChannel_get_shutdown_scriptpubkey(uint64_t this_ptr) {
37787         LDKOpenChannel this_ptr_conv;
37788         this_ptr_conv.inner = untag_ptr(this_ptr);
37789         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
37790         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
37791         this_ptr_conv.is_owned = false;
37792         LDKCOption_CVec_u8ZZ *ret_copy = MALLOC(sizeof(LDKCOption_CVec_u8ZZ), "LDKCOption_CVec_u8ZZ");
37793         *ret_copy = OpenChannel_get_shutdown_scriptpubkey(&this_ptr_conv);
37794         uint64_t ret_ref = tag_ptr(ret_copy, true);
37795         return ret_ref;
37796 }
37797
37798 void  __attribute__((export_name("TS_OpenChannel_set_shutdown_scriptpubkey"))) TS_OpenChannel_set_shutdown_scriptpubkey(uint64_t this_ptr, uint64_t val) {
37799         LDKOpenChannel this_ptr_conv;
37800         this_ptr_conv.inner = untag_ptr(this_ptr);
37801         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
37802         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
37803         this_ptr_conv.is_owned = false;
37804         void* val_ptr = untag_ptr(val);
37805         CHECK_ACCESS(val_ptr);
37806         LDKCOption_CVec_u8ZZ val_conv = *(LDKCOption_CVec_u8ZZ*)(val_ptr);
37807         val_conv = COption_CVec_u8ZZ_clone((LDKCOption_CVec_u8ZZ*)untag_ptr(val));
37808         OpenChannel_set_shutdown_scriptpubkey(&this_ptr_conv, val_conv);
37809 }
37810
37811 uint64_t  __attribute__((export_name("TS_OpenChannel_get_channel_type"))) TS_OpenChannel_get_channel_type(uint64_t this_ptr) {
37812         LDKOpenChannel this_ptr_conv;
37813         this_ptr_conv.inner = untag_ptr(this_ptr);
37814         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
37815         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
37816         this_ptr_conv.is_owned = false;
37817         LDKChannelTypeFeatures ret_var = OpenChannel_get_channel_type(&this_ptr_conv);
37818         uint64_t ret_ref = 0;
37819         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
37820         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
37821         return ret_ref;
37822 }
37823
37824 void  __attribute__((export_name("TS_OpenChannel_set_channel_type"))) TS_OpenChannel_set_channel_type(uint64_t this_ptr, uint64_t val) {
37825         LDKOpenChannel this_ptr_conv;
37826         this_ptr_conv.inner = untag_ptr(this_ptr);
37827         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
37828         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
37829         this_ptr_conv.is_owned = false;
37830         LDKChannelTypeFeatures val_conv;
37831         val_conv.inner = untag_ptr(val);
37832         val_conv.is_owned = ptr_is_owned(val);
37833         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
37834         val_conv = ChannelTypeFeatures_clone(&val_conv);
37835         OpenChannel_set_channel_type(&this_ptr_conv, val_conv);
37836 }
37837
37838 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) {
37839         LDKThirtyTwoBytes chain_hash_arg_ref;
37840         CHECK(chain_hash_arg->arr_len == 32);
37841         memcpy(chain_hash_arg_ref.data, chain_hash_arg->elems, 32); FREE(chain_hash_arg);
37842         LDKThirtyTwoBytes temporary_channel_id_arg_ref;
37843         CHECK(temporary_channel_id_arg->arr_len == 32);
37844         memcpy(temporary_channel_id_arg_ref.data, temporary_channel_id_arg->elems, 32); FREE(temporary_channel_id_arg);
37845         LDKPublicKey funding_pubkey_arg_ref;
37846         CHECK(funding_pubkey_arg->arr_len == 33);
37847         memcpy(funding_pubkey_arg_ref.compressed_form, funding_pubkey_arg->elems, 33); FREE(funding_pubkey_arg);
37848         LDKPublicKey revocation_basepoint_arg_ref;
37849         CHECK(revocation_basepoint_arg->arr_len == 33);
37850         memcpy(revocation_basepoint_arg_ref.compressed_form, revocation_basepoint_arg->elems, 33); FREE(revocation_basepoint_arg);
37851         LDKPublicKey payment_point_arg_ref;
37852         CHECK(payment_point_arg->arr_len == 33);
37853         memcpy(payment_point_arg_ref.compressed_form, payment_point_arg->elems, 33); FREE(payment_point_arg);
37854         LDKPublicKey delayed_payment_basepoint_arg_ref;
37855         CHECK(delayed_payment_basepoint_arg->arr_len == 33);
37856         memcpy(delayed_payment_basepoint_arg_ref.compressed_form, delayed_payment_basepoint_arg->elems, 33); FREE(delayed_payment_basepoint_arg);
37857         LDKPublicKey htlc_basepoint_arg_ref;
37858         CHECK(htlc_basepoint_arg->arr_len == 33);
37859         memcpy(htlc_basepoint_arg_ref.compressed_form, htlc_basepoint_arg->elems, 33); FREE(htlc_basepoint_arg);
37860         LDKPublicKey first_per_commitment_point_arg_ref;
37861         CHECK(first_per_commitment_point_arg->arr_len == 33);
37862         memcpy(first_per_commitment_point_arg_ref.compressed_form, first_per_commitment_point_arg->elems, 33); FREE(first_per_commitment_point_arg);
37863         void* shutdown_scriptpubkey_arg_ptr = untag_ptr(shutdown_scriptpubkey_arg);
37864         CHECK_ACCESS(shutdown_scriptpubkey_arg_ptr);
37865         LDKCOption_CVec_u8ZZ shutdown_scriptpubkey_arg_conv = *(LDKCOption_CVec_u8ZZ*)(shutdown_scriptpubkey_arg_ptr);
37866         shutdown_scriptpubkey_arg_conv = COption_CVec_u8ZZ_clone((LDKCOption_CVec_u8ZZ*)untag_ptr(shutdown_scriptpubkey_arg));
37867         LDKChannelTypeFeatures channel_type_arg_conv;
37868         channel_type_arg_conv.inner = untag_ptr(channel_type_arg);
37869         channel_type_arg_conv.is_owned = ptr_is_owned(channel_type_arg);
37870         CHECK_INNER_FIELD_ACCESS_OR_NULL(channel_type_arg_conv);
37871         channel_type_arg_conv = ChannelTypeFeatures_clone(&channel_type_arg_conv);
37872         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);
37873         uint64_t ret_ref = 0;
37874         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
37875         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
37876         return ret_ref;
37877 }
37878
37879 static inline uint64_t OpenChannel_clone_ptr(LDKOpenChannel *NONNULL_PTR arg) {
37880         LDKOpenChannel ret_var = OpenChannel_clone(arg);
37881         uint64_t ret_ref = 0;
37882         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
37883         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
37884         return ret_ref;
37885 }
37886 int64_t  __attribute__((export_name("TS_OpenChannel_clone_ptr"))) TS_OpenChannel_clone_ptr(uint64_t arg) {
37887         LDKOpenChannel arg_conv;
37888         arg_conv.inner = untag_ptr(arg);
37889         arg_conv.is_owned = ptr_is_owned(arg);
37890         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
37891         arg_conv.is_owned = false;
37892         int64_t ret_conv = OpenChannel_clone_ptr(&arg_conv);
37893         return ret_conv;
37894 }
37895
37896 uint64_t  __attribute__((export_name("TS_OpenChannel_clone"))) TS_OpenChannel_clone(uint64_t orig) {
37897         LDKOpenChannel orig_conv;
37898         orig_conv.inner = untag_ptr(orig);
37899         orig_conv.is_owned = ptr_is_owned(orig);
37900         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
37901         orig_conv.is_owned = false;
37902         LDKOpenChannel ret_var = OpenChannel_clone(&orig_conv);
37903         uint64_t ret_ref = 0;
37904         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
37905         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
37906         return ret_ref;
37907 }
37908
37909 jboolean  __attribute__((export_name("TS_OpenChannel_eq"))) TS_OpenChannel_eq(uint64_t a, uint64_t b) {
37910         LDKOpenChannel a_conv;
37911         a_conv.inner = untag_ptr(a);
37912         a_conv.is_owned = ptr_is_owned(a);
37913         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
37914         a_conv.is_owned = false;
37915         LDKOpenChannel b_conv;
37916         b_conv.inner = untag_ptr(b);
37917         b_conv.is_owned = ptr_is_owned(b);
37918         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
37919         b_conv.is_owned = false;
37920         jboolean ret_conv = OpenChannel_eq(&a_conv, &b_conv);
37921         return ret_conv;
37922 }
37923
37924 void  __attribute__((export_name("TS_OpenChannelV2_free"))) TS_OpenChannelV2_free(uint64_t this_obj) {
37925         LDKOpenChannelV2 this_obj_conv;
37926         this_obj_conv.inner = untag_ptr(this_obj);
37927         this_obj_conv.is_owned = ptr_is_owned(this_obj);
37928         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
37929         OpenChannelV2_free(this_obj_conv);
37930 }
37931
37932 int8_tArray  __attribute__((export_name("TS_OpenChannelV2_get_chain_hash"))) TS_OpenChannelV2_get_chain_hash(uint64_t this_ptr) {
37933         LDKOpenChannelV2 this_ptr_conv;
37934         this_ptr_conv.inner = untag_ptr(this_ptr);
37935         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
37936         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
37937         this_ptr_conv.is_owned = false;
37938         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
37939         memcpy(ret_arr->elems, *OpenChannelV2_get_chain_hash(&this_ptr_conv), 32);
37940         return ret_arr;
37941 }
37942
37943 void  __attribute__((export_name("TS_OpenChannelV2_set_chain_hash"))) TS_OpenChannelV2_set_chain_hash(uint64_t this_ptr, int8_tArray val) {
37944         LDKOpenChannelV2 this_ptr_conv;
37945         this_ptr_conv.inner = untag_ptr(this_ptr);
37946         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
37947         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
37948         this_ptr_conv.is_owned = false;
37949         LDKThirtyTwoBytes val_ref;
37950         CHECK(val->arr_len == 32);
37951         memcpy(val_ref.data, val->elems, 32); FREE(val);
37952         OpenChannelV2_set_chain_hash(&this_ptr_conv, val_ref);
37953 }
37954
37955 int8_tArray  __attribute__((export_name("TS_OpenChannelV2_get_temporary_channel_id"))) TS_OpenChannelV2_get_temporary_channel_id(uint64_t this_ptr) {
37956         LDKOpenChannelV2 this_ptr_conv;
37957         this_ptr_conv.inner = untag_ptr(this_ptr);
37958         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
37959         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
37960         this_ptr_conv.is_owned = false;
37961         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
37962         memcpy(ret_arr->elems, *OpenChannelV2_get_temporary_channel_id(&this_ptr_conv), 32);
37963         return ret_arr;
37964 }
37965
37966 void  __attribute__((export_name("TS_OpenChannelV2_set_temporary_channel_id"))) TS_OpenChannelV2_set_temporary_channel_id(uint64_t this_ptr, int8_tArray val) {
37967         LDKOpenChannelV2 this_ptr_conv;
37968         this_ptr_conv.inner = untag_ptr(this_ptr);
37969         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
37970         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
37971         this_ptr_conv.is_owned = false;
37972         LDKThirtyTwoBytes val_ref;
37973         CHECK(val->arr_len == 32);
37974         memcpy(val_ref.data, val->elems, 32); FREE(val);
37975         OpenChannelV2_set_temporary_channel_id(&this_ptr_conv, val_ref);
37976 }
37977
37978 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) {
37979         LDKOpenChannelV2 this_ptr_conv;
37980         this_ptr_conv.inner = untag_ptr(this_ptr);
37981         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
37982         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
37983         this_ptr_conv.is_owned = false;
37984         int32_t ret_conv = OpenChannelV2_get_funding_feerate_sat_per_1000_weight(&this_ptr_conv);
37985         return ret_conv;
37986 }
37987
37988 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) {
37989         LDKOpenChannelV2 this_ptr_conv;
37990         this_ptr_conv.inner = untag_ptr(this_ptr);
37991         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
37992         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
37993         this_ptr_conv.is_owned = false;
37994         OpenChannelV2_set_funding_feerate_sat_per_1000_weight(&this_ptr_conv, val);
37995 }
37996
37997 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) {
37998         LDKOpenChannelV2 this_ptr_conv;
37999         this_ptr_conv.inner = untag_ptr(this_ptr);
38000         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
38001         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
38002         this_ptr_conv.is_owned = false;
38003         int32_t ret_conv = OpenChannelV2_get_commitment_feerate_sat_per_1000_weight(&this_ptr_conv);
38004         return ret_conv;
38005 }
38006
38007 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) {
38008         LDKOpenChannelV2 this_ptr_conv;
38009         this_ptr_conv.inner = untag_ptr(this_ptr);
38010         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
38011         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
38012         this_ptr_conv.is_owned = false;
38013         OpenChannelV2_set_commitment_feerate_sat_per_1000_weight(&this_ptr_conv, val);
38014 }
38015
38016 int64_t  __attribute__((export_name("TS_OpenChannelV2_get_funding_satoshis"))) TS_OpenChannelV2_get_funding_satoshis(uint64_t this_ptr) {
38017         LDKOpenChannelV2 this_ptr_conv;
38018         this_ptr_conv.inner = untag_ptr(this_ptr);
38019         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
38020         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
38021         this_ptr_conv.is_owned = false;
38022         int64_t ret_conv = OpenChannelV2_get_funding_satoshis(&this_ptr_conv);
38023         return ret_conv;
38024 }
38025
38026 void  __attribute__((export_name("TS_OpenChannelV2_set_funding_satoshis"))) TS_OpenChannelV2_set_funding_satoshis(uint64_t this_ptr, int64_t val) {
38027         LDKOpenChannelV2 this_ptr_conv;
38028         this_ptr_conv.inner = untag_ptr(this_ptr);
38029         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
38030         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
38031         this_ptr_conv.is_owned = false;
38032         OpenChannelV2_set_funding_satoshis(&this_ptr_conv, val);
38033 }
38034
38035 int64_t  __attribute__((export_name("TS_OpenChannelV2_get_dust_limit_satoshis"))) TS_OpenChannelV2_get_dust_limit_satoshis(uint64_t this_ptr) {
38036         LDKOpenChannelV2 this_ptr_conv;
38037         this_ptr_conv.inner = untag_ptr(this_ptr);
38038         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
38039         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
38040         this_ptr_conv.is_owned = false;
38041         int64_t ret_conv = OpenChannelV2_get_dust_limit_satoshis(&this_ptr_conv);
38042         return ret_conv;
38043 }
38044
38045 void  __attribute__((export_name("TS_OpenChannelV2_set_dust_limit_satoshis"))) TS_OpenChannelV2_set_dust_limit_satoshis(uint64_t this_ptr, int64_t val) {
38046         LDKOpenChannelV2 this_ptr_conv;
38047         this_ptr_conv.inner = untag_ptr(this_ptr);
38048         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
38049         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
38050         this_ptr_conv.is_owned = false;
38051         OpenChannelV2_set_dust_limit_satoshis(&this_ptr_conv, val);
38052 }
38053
38054 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) {
38055         LDKOpenChannelV2 this_ptr_conv;
38056         this_ptr_conv.inner = untag_ptr(this_ptr);
38057         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
38058         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
38059         this_ptr_conv.is_owned = false;
38060         int64_t ret_conv = OpenChannelV2_get_max_htlc_value_in_flight_msat(&this_ptr_conv);
38061         return ret_conv;
38062 }
38063
38064 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) {
38065         LDKOpenChannelV2 this_ptr_conv;
38066         this_ptr_conv.inner = untag_ptr(this_ptr);
38067         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
38068         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
38069         this_ptr_conv.is_owned = false;
38070         OpenChannelV2_set_max_htlc_value_in_flight_msat(&this_ptr_conv, val);
38071 }
38072
38073 int64_t  __attribute__((export_name("TS_OpenChannelV2_get_htlc_minimum_msat"))) TS_OpenChannelV2_get_htlc_minimum_msat(uint64_t this_ptr) {
38074         LDKOpenChannelV2 this_ptr_conv;
38075         this_ptr_conv.inner = untag_ptr(this_ptr);
38076         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
38077         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
38078         this_ptr_conv.is_owned = false;
38079         int64_t ret_conv = OpenChannelV2_get_htlc_minimum_msat(&this_ptr_conv);
38080         return ret_conv;
38081 }
38082
38083 void  __attribute__((export_name("TS_OpenChannelV2_set_htlc_minimum_msat"))) TS_OpenChannelV2_set_htlc_minimum_msat(uint64_t this_ptr, int64_t val) {
38084         LDKOpenChannelV2 this_ptr_conv;
38085         this_ptr_conv.inner = untag_ptr(this_ptr);
38086         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
38087         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
38088         this_ptr_conv.is_owned = false;
38089         OpenChannelV2_set_htlc_minimum_msat(&this_ptr_conv, val);
38090 }
38091
38092 int16_t  __attribute__((export_name("TS_OpenChannelV2_get_to_self_delay"))) TS_OpenChannelV2_get_to_self_delay(uint64_t this_ptr) {
38093         LDKOpenChannelV2 this_ptr_conv;
38094         this_ptr_conv.inner = untag_ptr(this_ptr);
38095         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
38096         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
38097         this_ptr_conv.is_owned = false;
38098         int16_t ret_conv = OpenChannelV2_get_to_self_delay(&this_ptr_conv);
38099         return ret_conv;
38100 }
38101
38102 void  __attribute__((export_name("TS_OpenChannelV2_set_to_self_delay"))) TS_OpenChannelV2_set_to_self_delay(uint64_t this_ptr, int16_t val) {
38103         LDKOpenChannelV2 this_ptr_conv;
38104         this_ptr_conv.inner = untag_ptr(this_ptr);
38105         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
38106         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
38107         this_ptr_conv.is_owned = false;
38108         OpenChannelV2_set_to_self_delay(&this_ptr_conv, val);
38109 }
38110
38111 int16_t  __attribute__((export_name("TS_OpenChannelV2_get_max_accepted_htlcs"))) TS_OpenChannelV2_get_max_accepted_htlcs(uint64_t this_ptr) {
38112         LDKOpenChannelV2 this_ptr_conv;
38113         this_ptr_conv.inner = untag_ptr(this_ptr);
38114         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
38115         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
38116         this_ptr_conv.is_owned = false;
38117         int16_t ret_conv = OpenChannelV2_get_max_accepted_htlcs(&this_ptr_conv);
38118         return ret_conv;
38119 }
38120
38121 void  __attribute__((export_name("TS_OpenChannelV2_set_max_accepted_htlcs"))) TS_OpenChannelV2_set_max_accepted_htlcs(uint64_t this_ptr, int16_t val) {
38122         LDKOpenChannelV2 this_ptr_conv;
38123         this_ptr_conv.inner = untag_ptr(this_ptr);
38124         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
38125         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
38126         this_ptr_conv.is_owned = false;
38127         OpenChannelV2_set_max_accepted_htlcs(&this_ptr_conv, val);
38128 }
38129
38130 int32_t  __attribute__((export_name("TS_OpenChannelV2_get_locktime"))) TS_OpenChannelV2_get_locktime(uint64_t this_ptr) {
38131         LDKOpenChannelV2 this_ptr_conv;
38132         this_ptr_conv.inner = untag_ptr(this_ptr);
38133         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
38134         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
38135         this_ptr_conv.is_owned = false;
38136         int32_t ret_conv = OpenChannelV2_get_locktime(&this_ptr_conv);
38137         return ret_conv;
38138 }
38139
38140 void  __attribute__((export_name("TS_OpenChannelV2_set_locktime"))) TS_OpenChannelV2_set_locktime(uint64_t this_ptr, int32_t val) {
38141         LDKOpenChannelV2 this_ptr_conv;
38142         this_ptr_conv.inner = untag_ptr(this_ptr);
38143         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
38144         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
38145         this_ptr_conv.is_owned = false;
38146         OpenChannelV2_set_locktime(&this_ptr_conv, val);
38147 }
38148
38149 int8_tArray  __attribute__((export_name("TS_OpenChannelV2_get_funding_pubkey"))) TS_OpenChannelV2_get_funding_pubkey(uint64_t this_ptr) {
38150         LDKOpenChannelV2 this_ptr_conv;
38151         this_ptr_conv.inner = untag_ptr(this_ptr);
38152         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
38153         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
38154         this_ptr_conv.is_owned = false;
38155         int8_tArray ret_arr = init_int8_tArray(33, __LINE__);
38156         memcpy(ret_arr->elems, OpenChannelV2_get_funding_pubkey(&this_ptr_conv).compressed_form, 33);
38157         return ret_arr;
38158 }
38159
38160 void  __attribute__((export_name("TS_OpenChannelV2_set_funding_pubkey"))) TS_OpenChannelV2_set_funding_pubkey(uint64_t this_ptr, int8_tArray val) {
38161         LDKOpenChannelV2 this_ptr_conv;
38162         this_ptr_conv.inner = untag_ptr(this_ptr);
38163         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
38164         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
38165         this_ptr_conv.is_owned = false;
38166         LDKPublicKey val_ref;
38167         CHECK(val->arr_len == 33);
38168         memcpy(val_ref.compressed_form, val->elems, 33); FREE(val);
38169         OpenChannelV2_set_funding_pubkey(&this_ptr_conv, val_ref);
38170 }
38171
38172 int8_tArray  __attribute__((export_name("TS_OpenChannelV2_get_revocation_basepoint"))) TS_OpenChannelV2_get_revocation_basepoint(uint64_t this_ptr) {
38173         LDKOpenChannelV2 this_ptr_conv;
38174         this_ptr_conv.inner = untag_ptr(this_ptr);
38175         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
38176         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
38177         this_ptr_conv.is_owned = false;
38178         int8_tArray ret_arr = init_int8_tArray(33, __LINE__);
38179         memcpy(ret_arr->elems, OpenChannelV2_get_revocation_basepoint(&this_ptr_conv).compressed_form, 33);
38180         return ret_arr;
38181 }
38182
38183 void  __attribute__((export_name("TS_OpenChannelV2_set_revocation_basepoint"))) TS_OpenChannelV2_set_revocation_basepoint(uint64_t this_ptr, int8_tArray val) {
38184         LDKOpenChannelV2 this_ptr_conv;
38185         this_ptr_conv.inner = untag_ptr(this_ptr);
38186         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
38187         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
38188         this_ptr_conv.is_owned = false;
38189         LDKPublicKey val_ref;
38190         CHECK(val->arr_len == 33);
38191         memcpy(val_ref.compressed_form, val->elems, 33); FREE(val);
38192         OpenChannelV2_set_revocation_basepoint(&this_ptr_conv, val_ref);
38193 }
38194
38195 int8_tArray  __attribute__((export_name("TS_OpenChannelV2_get_payment_basepoint"))) TS_OpenChannelV2_get_payment_basepoint(uint64_t this_ptr) {
38196         LDKOpenChannelV2 this_ptr_conv;
38197         this_ptr_conv.inner = untag_ptr(this_ptr);
38198         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
38199         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
38200         this_ptr_conv.is_owned = false;
38201         int8_tArray ret_arr = init_int8_tArray(33, __LINE__);
38202         memcpy(ret_arr->elems, OpenChannelV2_get_payment_basepoint(&this_ptr_conv).compressed_form, 33);
38203         return ret_arr;
38204 }
38205
38206 void  __attribute__((export_name("TS_OpenChannelV2_set_payment_basepoint"))) TS_OpenChannelV2_set_payment_basepoint(uint64_t this_ptr, int8_tArray val) {
38207         LDKOpenChannelV2 this_ptr_conv;
38208         this_ptr_conv.inner = untag_ptr(this_ptr);
38209         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
38210         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
38211         this_ptr_conv.is_owned = false;
38212         LDKPublicKey val_ref;
38213         CHECK(val->arr_len == 33);
38214         memcpy(val_ref.compressed_form, val->elems, 33); FREE(val);
38215         OpenChannelV2_set_payment_basepoint(&this_ptr_conv, val_ref);
38216 }
38217
38218 int8_tArray  __attribute__((export_name("TS_OpenChannelV2_get_delayed_payment_basepoint"))) TS_OpenChannelV2_get_delayed_payment_basepoint(uint64_t this_ptr) {
38219         LDKOpenChannelV2 this_ptr_conv;
38220         this_ptr_conv.inner = untag_ptr(this_ptr);
38221         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
38222         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
38223         this_ptr_conv.is_owned = false;
38224         int8_tArray ret_arr = init_int8_tArray(33, __LINE__);
38225         memcpy(ret_arr->elems, OpenChannelV2_get_delayed_payment_basepoint(&this_ptr_conv).compressed_form, 33);
38226         return ret_arr;
38227 }
38228
38229 void  __attribute__((export_name("TS_OpenChannelV2_set_delayed_payment_basepoint"))) TS_OpenChannelV2_set_delayed_payment_basepoint(uint64_t this_ptr, int8_tArray val) {
38230         LDKOpenChannelV2 this_ptr_conv;
38231         this_ptr_conv.inner = untag_ptr(this_ptr);
38232         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
38233         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
38234         this_ptr_conv.is_owned = false;
38235         LDKPublicKey val_ref;
38236         CHECK(val->arr_len == 33);
38237         memcpy(val_ref.compressed_form, val->elems, 33); FREE(val);
38238         OpenChannelV2_set_delayed_payment_basepoint(&this_ptr_conv, val_ref);
38239 }
38240
38241 int8_tArray  __attribute__((export_name("TS_OpenChannelV2_get_htlc_basepoint"))) TS_OpenChannelV2_get_htlc_basepoint(uint64_t this_ptr) {
38242         LDKOpenChannelV2 this_ptr_conv;
38243         this_ptr_conv.inner = untag_ptr(this_ptr);
38244         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
38245         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
38246         this_ptr_conv.is_owned = false;
38247         int8_tArray ret_arr = init_int8_tArray(33, __LINE__);
38248         memcpy(ret_arr->elems, OpenChannelV2_get_htlc_basepoint(&this_ptr_conv).compressed_form, 33);
38249         return ret_arr;
38250 }
38251
38252 void  __attribute__((export_name("TS_OpenChannelV2_set_htlc_basepoint"))) TS_OpenChannelV2_set_htlc_basepoint(uint64_t this_ptr, int8_tArray val) {
38253         LDKOpenChannelV2 this_ptr_conv;
38254         this_ptr_conv.inner = untag_ptr(this_ptr);
38255         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
38256         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
38257         this_ptr_conv.is_owned = false;
38258         LDKPublicKey val_ref;
38259         CHECK(val->arr_len == 33);
38260         memcpy(val_ref.compressed_form, val->elems, 33); FREE(val);
38261         OpenChannelV2_set_htlc_basepoint(&this_ptr_conv, val_ref);
38262 }
38263
38264 int8_tArray  __attribute__((export_name("TS_OpenChannelV2_get_first_per_commitment_point"))) TS_OpenChannelV2_get_first_per_commitment_point(uint64_t this_ptr) {
38265         LDKOpenChannelV2 this_ptr_conv;
38266         this_ptr_conv.inner = untag_ptr(this_ptr);
38267         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
38268         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
38269         this_ptr_conv.is_owned = false;
38270         int8_tArray ret_arr = init_int8_tArray(33, __LINE__);
38271         memcpy(ret_arr->elems, OpenChannelV2_get_first_per_commitment_point(&this_ptr_conv).compressed_form, 33);
38272         return ret_arr;
38273 }
38274
38275 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) {
38276         LDKOpenChannelV2 this_ptr_conv;
38277         this_ptr_conv.inner = untag_ptr(this_ptr);
38278         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
38279         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
38280         this_ptr_conv.is_owned = false;
38281         LDKPublicKey val_ref;
38282         CHECK(val->arr_len == 33);
38283         memcpy(val_ref.compressed_form, val->elems, 33); FREE(val);
38284         OpenChannelV2_set_first_per_commitment_point(&this_ptr_conv, val_ref);
38285 }
38286
38287 int8_tArray  __attribute__((export_name("TS_OpenChannelV2_get_second_per_commitment_point"))) TS_OpenChannelV2_get_second_per_commitment_point(uint64_t this_ptr) {
38288         LDKOpenChannelV2 this_ptr_conv;
38289         this_ptr_conv.inner = untag_ptr(this_ptr);
38290         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
38291         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
38292         this_ptr_conv.is_owned = false;
38293         int8_tArray ret_arr = init_int8_tArray(33, __LINE__);
38294         memcpy(ret_arr->elems, OpenChannelV2_get_second_per_commitment_point(&this_ptr_conv).compressed_form, 33);
38295         return ret_arr;
38296 }
38297
38298 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) {
38299         LDKOpenChannelV2 this_ptr_conv;
38300         this_ptr_conv.inner = untag_ptr(this_ptr);
38301         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
38302         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
38303         this_ptr_conv.is_owned = false;
38304         LDKPublicKey val_ref;
38305         CHECK(val->arr_len == 33);
38306         memcpy(val_ref.compressed_form, val->elems, 33); FREE(val);
38307         OpenChannelV2_set_second_per_commitment_point(&this_ptr_conv, val_ref);
38308 }
38309
38310 int8_t  __attribute__((export_name("TS_OpenChannelV2_get_channel_flags"))) TS_OpenChannelV2_get_channel_flags(uint64_t this_ptr) {
38311         LDKOpenChannelV2 this_ptr_conv;
38312         this_ptr_conv.inner = untag_ptr(this_ptr);
38313         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
38314         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
38315         this_ptr_conv.is_owned = false;
38316         int8_t ret_conv = OpenChannelV2_get_channel_flags(&this_ptr_conv);
38317         return ret_conv;
38318 }
38319
38320 void  __attribute__((export_name("TS_OpenChannelV2_set_channel_flags"))) TS_OpenChannelV2_set_channel_flags(uint64_t this_ptr, int8_t val) {
38321         LDKOpenChannelV2 this_ptr_conv;
38322         this_ptr_conv.inner = untag_ptr(this_ptr);
38323         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
38324         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
38325         this_ptr_conv.is_owned = false;
38326         OpenChannelV2_set_channel_flags(&this_ptr_conv, val);
38327 }
38328
38329 uint64_t  __attribute__((export_name("TS_OpenChannelV2_get_shutdown_scriptpubkey"))) TS_OpenChannelV2_get_shutdown_scriptpubkey(uint64_t this_ptr) {
38330         LDKOpenChannelV2 this_ptr_conv;
38331         this_ptr_conv.inner = untag_ptr(this_ptr);
38332         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
38333         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
38334         this_ptr_conv.is_owned = false;
38335         LDKCOption_CVec_u8ZZ *ret_copy = MALLOC(sizeof(LDKCOption_CVec_u8ZZ), "LDKCOption_CVec_u8ZZ");
38336         *ret_copy = OpenChannelV2_get_shutdown_scriptpubkey(&this_ptr_conv);
38337         uint64_t ret_ref = tag_ptr(ret_copy, true);
38338         return ret_ref;
38339 }
38340
38341 void  __attribute__((export_name("TS_OpenChannelV2_set_shutdown_scriptpubkey"))) TS_OpenChannelV2_set_shutdown_scriptpubkey(uint64_t this_ptr, uint64_t val) {
38342         LDKOpenChannelV2 this_ptr_conv;
38343         this_ptr_conv.inner = untag_ptr(this_ptr);
38344         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
38345         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
38346         this_ptr_conv.is_owned = false;
38347         void* val_ptr = untag_ptr(val);
38348         CHECK_ACCESS(val_ptr);
38349         LDKCOption_CVec_u8ZZ val_conv = *(LDKCOption_CVec_u8ZZ*)(val_ptr);
38350         val_conv = COption_CVec_u8ZZ_clone((LDKCOption_CVec_u8ZZ*)untag_ptr(val));
38351         OpenChannelV2_set_shutdown_scriptpubkey(&this_ptr_conv, val_conv);
38352 }
38353
38354 uint64_t  __attribute__((export_name("TS_OpenChannelV2_get_channel_type"))) TS_OpenChannelV2_get_channel_type(uint64_t this_ptr) {
38355         LDKOpenChannelV2 this_ptr_conv;
38356         this_ptr_conv.inner = untag_ptr(this_ptr);
38357         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
38358         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
38359         this_ptr_conv.is_owned = false;
38360         LDKChannelTypeFeatures ret_var = OpenChannelV2_get_channel_type(&this_ptr_conv);
38361         uint64_t ret_ref = 0;
38362         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
38363         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
38364         return ret_ref;
38365 }
38366
38367 void  __attribute__((export_name("TS_OpenChannelV2_set_channel_type"))) TS_OpenChannelV2_set_channel_type(uint64_t this_ptr, uint64_t val) {
38368         LDKOpenChannelV2 this_ptr_conv;
38369         this_ptr_conv.inner = untag_ptr(this_ptr);
38370         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
38371         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
38372         this_ptr_conv.is_owned = false;
38373         LDKChannelTypeFeatures val_conv;
38374         val_conv.inner = untag_ptr(val);
38375         val_conv.is_owned = ptr_is_owned(val);
38376         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
38377         val_conv = ChannelTypeFeatures_clone(&val_conv);
38378         OpenChannelV2_set_channel_type(&this_ptr_conv, val_conv);
38379 }
38380
38381 uint32_t  __attribute__((export_name("TS_OpenChannelV2_get_require_confirmed_inputs"))) TS_OpenChannelV2_get_require_confirmed_inputs(uint64_t this_ptr) {
38382         LDKOpenChannelV2 this_ptr_conv;
38383         this_ptr_conv.inner = untag_ptr(this_ptr);
38384         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
38385         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
38386         this_ptr_conv.is_owned = false;
38387         uint32_t ret_conv = LDKCOption_NoneZ_to_js(OpenChannelV2_get_require_confirmed_inputs(&this_ptr_conv));
38388         return ret_conv;
38389 }
38390
38391 void  __attribute__((export_name("TS_OpenChannelV2_set_require_confirmed_inputs"))) TS_OpenChannelV2_set_require_confirmed_inputs(uint64_t this_ptr, uint32_t val) {
38392         LDKOpenChannelV2 this_ptr_conv;
38393         this_ptr_conv.inner = untag_ptr(this_ptr);
38394         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
38395         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
38396         this_ptr_conv.is_owned = false;
38397         LDKCOption_NoneZ val_conv = LDKCOption_NoneZ_from_js(val);
38398         OpenChannelV2_set_require_confirmed_inputs(&this_ptr_conv, val_conv);
38399 }
38400
38401 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) {
38402         LDKThirtyTwoBytes chain_hash_arg_ref;
38403         CHECK(chain_hash_arg->arr_len == 32);
38404         memcpy(chain_hash_arg_ref.data, chain_hash_arg->elems, 32); FREE(chain_hash_arg);
38405         LDKThirtyTwoBytes temporary_channel_id_arg_ref;
38406         CHECK(temporary_channel_id_arg->arr_len == 32);
38407         memcpy(temporary_channel_id_arg_ref.data, temporary_channel_id_arg->elems, 32); FREE(temporary_channel_id_arg);
38408         LDKPublicKey funding_pubkey_arg_ref;
38409         CHECK(funding_pubkey_arg->arr_len == 33);
38410         memcpy(funding_pubkey_arg_ref.compressed_form, funding_pubkey_arg->elems, 33); FREE(funding_pubkey_arg);
38411         LDKPublicKey revocation_basepoint_arg_ref;
38412         CHECK(revocation_basepoint_arg->arr_len == 33);
38413         memcpy(revocation_basepoint_arg_ref.compressed_form, revocation_basepoint_arg->elems, 33); FREE(revocation_basepoint_arg);
38414         LDKPublicKey payment_basepoint_arg_ref;
38415         CHECK(payment_basepoint_arg->arr_len == 33);
38416         memcpy(payment_basepoint_arg_ref.compressed_form, payment_basepoint_arg->elems, 33); FREE(payment_basepoint_arg);
38417         LDKPublicKey delayed_payment_basepoint_arg_ref;
38418         CHECK(delayed_payment_basepoint_arg->arr_len == 33);
38419         memcpy(delayed_payment_basepoint_arg_ref.compressed_form, delayed_payment_basepoint_arg->elems, 33); FREE(delayed_payment_basepoint_arg);
38420         LDKPublicKey htlc_basepoint_arg_ref;
38421         CHECK(htlc_basepoint_arg->arr_len == 33);
38422         memcpy(htlc_basepoint_arg_ref.compressed_form, htlc_basepoint_arg->elems, 33); FREE(htlc_basepoint_arg);
38423         LDKPublicKey first_per_commitment_point_arg_ref;
38424         CHECK(first_per_commitment_point_arg->arr_len == 33);
38425         memcpy(first_per_commitment_point_arg_ref.compressed_form, first_per_commitment_point_arg->elems, 33); FREE(first_per_commitment_point_arg);
38426         LDKPublicKey second_per_commitment_point_arg_ref;
38427         CHECK(second_per_commitment_point_arg->arr_len == 33);
38428         memcpy(second_per_commitment_point_arg_ref.compressed_form, second_per_commitment_point_arg->elems, 33); FREE(second_per_commitment_point_arg);
38429         void* shutdown_scriptpubkey_arg_ptr = untag_ptr(shutdown_scriptpubkey_arg);
38430         CHECK_ACCESS(shutdown_scriptpubkey_arg_ptr);
38431         LDKCOption_CVec_u8ZZ shutdown_scriptpubkey_arg_conv = *(LDKCOption_CVec_u8ZZ*)(shutdown_scriptpubkey_arg_ptr);
38432         shutdown_scriptpubkey_arg_conv = COption_CVec_u8ZZ_clone((LDKCOption_CVec_u8ZZ*)untag_ptr(shutdown_scriptpubkey_arg));
38433         LDKChannelTypeFeatures channel_type_arg_conv;
38434         channel_type_arg_conv.inner = untag_ptr(channel_type_arg);
38435         channel_type_arg_conv.is_owned = ptr_is_owned(channel_type_arg);
38436         CHECK_INNER_FIELD_ACCESS_OR_NULL(channel_type_arg_conv);
38437         channel_type_arg_conv = ChannelTypeFeatures_clone(&channel_type_arg_conv);
38438         LDKCOption_NoneZ require_confirmed_inputs_arg_conv = LDKCOption_NoneZ_from_js(require_confirmed_inputs_arg);
38439         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);
38440         uint64_t ret_ref = 0;
38441         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
38442         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
38443         return ret_ref;
38444 }
38445
38446 static inline uint64_t OpenChannelV2_clone_ptr(LDKOpenChannelV2 *NONNULL_PTR arg) {
38447         LDKOpenChannelV2 ret_var = OpenChannelV2_clone(arg);
38448         uint64_t ret_ref = 0;
38449         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
38450         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
38451         return ret_ref;
38452 }
38453 int64_t  __attribute__((export_name("TS_OpenChannelV2_clone_ptr"))) TS_OpenChannelV2_clone_ptr(uint64_t arg) {
38454         LDKOpenChannelV2 arg_conv;
38455         arg_conv.inner = untag_ptr(arg);
38456         arg_conv.is_owned = ptr_is_owned(arg);
38457         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
38458         arg_conv.is_owned = false;
38459         int64_t ret_conv = OpenChannelV2_clone_ptr(&arg_conv);
38460         return ret_conv;
38461 }
38462
38463 uint64_t  __attribute__((export_name("TS_OpenChannelV2_clone"))) TS_OpenChannelV2_clone(uint64_t orig) {
38464         LDKOpenChannelV2 orig_conv;
38465         orig_conv.inner = untag_ptr(orig);
38466         orig_conv.is_owned = ptr_is_owned(orig);
38467         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
38468         orig_conv.is_owned = false;
38469         LDKOpenChannelV2 ret_var = OpenChannelV2_clone(&orig_conv);
38470         uint64_t ret_ref = 0;
38471         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
38472         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
38473         return ret_ref;
38474 }
38475
38476 jboolean  __attribute__((export_name("TS_OpenChannelV2_eq"))) TS_OpenChannelV2_eq(uint64_t a, uint64_t b) {
38477         LDKOpenChannelV2 a_conv;
38478         a_conv.inner = untag_ptr(a);
38479         a_conv.is_owned = ptr_is_owned(a);
38480         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
38481         a_conv.is_owned = false;
38482         LDKOpenChannelV2 b_conv;
38483         b_conv.inner = untag_ptr(b);
38484         b_conv.is_owned = ptr_is_owned(b);
38485         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
38486         b_conv.is_owned = false;
38487         jboolean ret_conv = OpenChannelV2_eq(&a_conv, &b_conv);
38488         return ret_conv;
38489 }
38490
38491 void  __attribute__((export_name("TS_AcceptChannel_free"))) TS_AcceptChannel_free(uint64_t this_obj) {
38492         LDKAcceptChannel this_obj_conv;
38493         this_obj_conv.inner = untag_ptr(this_obj);
38494         this_obj_conv.is_owned = ptr_is_owned(this_obj);
38495         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
38496         AcceptChannel_free(this_obj_conv);
38497 }
38498
38499 int8_tArray  __attribute__((export_name("TS_AcceptChannel_get_temporary_channel_id"))) TS_AcceptChannel_get_temporary_channel_id(uint64_t this_ptr) {
38500         LDKAcceptChannel this_ptr_conv;
38501         this_ptr_conv.inner = untag_ptr(this_ptr);
38502         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
38503         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
38504         this_ptr_conv.is_owned = false;
38505         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
38506         memcpy(ret_arr->elems, *AcceptChannel_get_temporary_channel_id(&this_ptr_conv), 32);
38507         return ret_arr;
38508 }
38509
38510 void  __attribute__((export_name("TS_AcceptChannel_set_temporary_channel_id"))) TS_AcceptChannel_set_temporary_channel_id(uint64_t this_ptr, int8_tArray val) {
38511         LDKAcceptChannel this_ptr_conv;
38512         this_ptr_conv.inner = untag_ptr(this_ptr);
38513         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
38514         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
38515         this_ptr_conv.is_owned = false;
38516         LDKThirtyTwoBytes val_ref;
38517         CHECK(val->arr_len == 32);
38518         memcpy(val_ref.data, val->elems, 32); FREE(val);
38519         AcceptChannel_set_temporary_channel_id(&this_ptr_conv, val_ref);
38520 }
38521
38522 int64_t  __attribute__((export_name("TS_AcceptChannel_get_dust_limit_satoshis"))) TS_AcceptChannel_get_dust_limit_satoshis(uint64_t this_ptr) {
38523         LDKAcceptChannel this_ptr_conv;
38524         this_ptr_conv.inner = untag_ptr(this_ptr);
38525         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
38526         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
38527         this_ptr_conv.is_owned = false;
38528         int64_t ret_conv = AcceptChannel_get_dust_limit_satoshis(&this_ptr_conv);
38529         return ret_conv;
38530 }
38531
38532 void  __attribute__((export_name("TS_AcceptChannel_set_dust_limit_satoshis"))) TS_AcceptChannel_set_dust_limit_satoshis(uint64_t this_ptr, int64_t val) {
38533         LDKAcceptChannel this_ptr_conv;
38534         this_ptr_conv.inner = untag_ptr(this_ptr);
38535         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
38536         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
38537         this_ptr_conv.is_owned = false;
38538         AcceptChannel_set_dust_limit_satoshis(&this_ptr_conv, val);
38539 }
38540
38541 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) {
38542         LDKAcceptChannel this_ptr_conv;
38543         this_ptr_conv.inner = untag_ptr(this_ptr);
38544         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
38545         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
38546         this_ptr_conv.is_owned = false;
38547         int64_t ret_conv = AcceptChannel_get_max_htlc_value_in_flight_msat(&this_ptr_conv);
38548         return ret_conv;
38549 }
38550
38551 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) {
38552         LDKAcceptChannel this_ptr_conv;
38553         this_ptr_conv.inner = untag_ptr(this_ptr);
38554         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
38555         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
38556         this_ptr_conv.is_owned = false;
38557         AcceptChannel_set_max_htlc_value_in_flight_msat(&this_ptr_conv, val);
38558 }
38559
38560 int64_t  __attribute__((export_name("TS_AcceptChannel_get_channel_reserve_satoshis"))) TS_AcceptChannel_get_channel_reserve_satoshis(uint64_t this_ptr) {
38561         LDKAcceptChannel this_ptr_conv;
38562         this_ptr_conv.inner = untag_ptr(this_ptr);
38563         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
38564         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
38565         this_ptr_conv.is_owned = false;
38566         int64_t ret_conv = AcceptChannel_get_channel_reserve_satoshis(&this_ptr_conv);
38567         return ret_conv;
38568 }
38569
38570 void  __attribute__((export_name("TS_AcceptChannel_set_channel_reserve_satoshis"))) TS_AcceptChannel_set_channel_reserve_satoshis(uint64_t this_ptr, int64_t val) {
38571         LDKAcceptChannel this_ptr_conv;
38572         this_ptr_conv.inner = untag_ptr(this_ptr);
38573         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
38574         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
38575         this_ptr_conv.is_owned = false;
38576         AcceptChannel_set_channel_reserve_satoshis(&this_ptr_conv, val);
38577 }
38578
38579 int64_t  __attribute__((export_name("TS_AcceptChannel_get_htlc_minimum_msat"))) TS_AcceptChannel_get_htlc_minimum_msat(uint64_t this_ptr) {
38580         LDKAcceptChannel this_ptr_conv;
38581         this_ptr_conv.inner = untag_ptr(this_ptr);
38582         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
38583         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
38584         this_ptr_conv.is_owned = false;
38585         int64_t ret_conv = AcceptChannel_get_htlc_minimum_msat(&this_ptr_conv);
38586         return ret_conv;
38587 }
38588
38589 void  __attribute__((export_name("TS_AcceptChannel_set_htlc_minimum_msat"))) TS_AcceptChannel_set_htlc_minimum_msat(uint64_t this_ptr, int64_t val) {
38590         LDKAcceptChannel this_ptr_conv;
38591         this_ptr_conv.inner = untag_ptr(this_ptr);
38592         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
38593         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
38594         this_ptr_conv.is_owned = false;
38595         AcceptChannel_set_htlc_minimum_msat(&this_ptr_conv, val);
38596 }
38597
38598 int32_t  __attribute__((export_name("TS_AcceptChannel_get_minimum_depth"))) TS_AcceptChannel_get_minimum_depth(uint64_t this_ptr) {
38599         LDKAcceptChannel this_ptr_conv;
38600         this_ptr_conv.inner = untag_ptr(this_ptr);
38601         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
38602         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
38603         this_ptr_conv.is_owned = false;
38604         int32_t ret_conv = AcceptChannel_get_minimum_depth(&this_ptr_conv);
38605         return ret_conv;
38606 }
38607
38608 void  __attribute__((export_name("TS_AcceptChannel_set_minimum_depth"))) TS_AcceptChannel_set_minimum_depth(uint64_t this_ptr, int32_t val) {
38609         LDKAcceptChannel this_ptr_conv;
38610         this_ptr_conv.inner = untag_ptr(this_ptr);
38611         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
38612         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
38613         this_ptr_conv.is_owned = false;
38614         AcceptChannel_set_minimum_depth(&this_ptr_conv, val);
38615 }
38616
38617 int16_t  __attribute__((export_name("TS_AcceptChannel_get_to_self_delay"))) TS_AcceptChannel_get_to_self_delay(uint64_t this_ptr) {
38618         LDKAcceptChannel this_ptr_conv;
38619         this_ptr_conv.inner = untag_ptr(this_ptr);
38620         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
38621         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
38622         this_ptr_conv.is_owned = false;
38623         int16_t ret_conv = AcceptChannel_get_to_self_delay(&this_ptr_conv);
38624         return ret_conv;
38625 }
38626
38627 void  __attribute__((export_name("TS_AcceptChannel_set_to_self_delay"))) TS_AcceptChannel_set_to_self_delay(uint64_t this_ptr, int16_t val) {
38628         LDKAcceptChannel this_ptr_conv;
38629         this_ptr_conv.inner = untag_ptr(this_ptr);
38630         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
38631         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
38632         this_ptr_conv.is_owned = false;
38633         AcceptChannel_set_to_self_delay(&this_ptr_conv, val);
38634 }
38635
38636 int16_t  __attribute__((export_name("TS_AcceptChannel_get_max_accepted_htlcs"))) TS_AcceptChannel_get_max_accepted_htlcs(uint64_t this_ptr) {
38637         LDKAcceptChannel this_ptr_conv;
38638         this_ptr_conv.inner = untag_ptr(this_ptr);
38639         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
38640         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
38641         this_ptr_conv.is_owned = false;
38642         int16_t ret_conv = AcceptChannel_get_max_accepted_htlcs(&this_ptr_conv);
38643         return ret_conv;
38644 }
38645
38646 void  __attribute__((export_name("TS_AcceptChannel_set_max_accepted_htlcs"))) TS_AcceptChannel_set_max_accepted_htlcs(uint64_t this_ptr, int16_t val) {
38647         LDKAcceptChannel this_ptr_conv;
38648         this_ptr_conv.inner = untag_ptr(this_ptr);
38649         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
38650         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
38651         this_ptr_conv.is_owned = false;
38652         AcceptChannel_set_max_accepted_htlcs(&this_ptr_conv, val);
38653 }
38654
38655 int8_tArray  __attribute__((export_name("TS_AcceptChannel_get_funding_pubkey"))) TS_AcceptChannel_get_funding_pubkey(uint64_t this_ptr) {
38656         LDKAcceptChannel this_ptr_conv;
38657         this_ptr_conv.inner = untag_ptr(this_ptr);
38658         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
38659         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
38660         this_ptr_conv.is_owned = false;
38661         int8_tArray ret_arr = init_int8_tArray(33, __LINE__);
38662         memcpy(ret_arr->elems, AcceptChannel_get_funding_pubkey(&this_ptr_conv).compressed_form, 33);
38663         return ret_arr;
38664 }
38665
38666 void  __attribute__((export_name("TS_AcceptChannel_set_funding_pubkey"))) TS_AcceptChannel_set_funding_pubkey(uint64_t this_ptr, int8_tArray val) {
38667         LDKAcceptChannel this_ptr_conv;
38668         this_ptr_conv.inner = untag_ptr(this_ptr);
38669         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
38670         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
38671         this_ptr_conv.is_owned = false;
38672         LDKPublicKey val_ref;
38673         CHECK(val->arr_len == 33);
38674         memcpy(val_ref.compressed_form, val->elems, 33); FREE(val);
38675         AcceptChannel_set_funding_pubkey(&this_ptr_conv, val_ref);
38676 }
38677
38678 int8_tArray  __attribute__((export_name("TS_AcceptChannel_get_revocation_basepoint"))) TS_AcceptChannel_get_revocation_basepoint(uint64_t this_ptr) {
38679         LDKAcceptChannel this_ptr_conv;
38680         this_ptr_conv.inner = untag_ptr(this_ptr);
38681         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
38682         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
38683         this_ptr_conv.is_owned = false;
38684         int8_tArray ret_arr = init_int8_tArray(33, __LINE__);
38685         memcpy(ret_arr->elems, AcceptChannel_get_revocation_basepoint(&this_ptr_conv).compressed_form, 33);
38686         return ret_arr;
38687 }
38688
38689 void  __attribute__((export_name("TS_AcceptChannel_set_revocation_basepoint"))) TS_AcceptChannel_set_revocation_basepoint(uint64_t this_ptr, int8_tArray val) {
38690         LDKAcceptChannel this_ptr_conv;
38691         this_ptr_conv.inner = untag_ptr(this_ptr);
38692         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
38693         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
38694         this_ptr_conv.is_owned = false;
38695         LDKPublicKey val_ref;
38696         CHECK(val->arr_len == 33);
38697         memcpy(val_ref.compressed_form, val->elems, 33); FREE(val);
38698         AcceptChannel_set_revocation_basepoint(&this_ptr_conv, val_ref);
38699 }
38700
38701 int8_tArray  __attribute__((export_name("TS_AcceptChannel_get_payment_point"))) TS_AcceptChannel_get_payment_point(uint64_t this_ptr) {
38702         LDKAcceptChannel this_ptr_conv;
38703         this_ptr_conv.inner = untag_ptr(this_ptr);
38704         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
38705         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
38706         this_ptr_conv.is_owned = false;
38707         int8_tArray ret_arr = init_int8_tArray(33, __LINE__);
38708         memcpy(ret_arr->elems, AcceptChannel_get_payment_point(&this_ptr_conv).compressed_form, 33);
38709         return ret_arr;
38710 }
38711
38712 void  __attribute__((export_name("TS_AcceptChannel_set_payment_point"))) TS_AcceptChannel_set_payment_point(uint64_t this_ptr, int8_tArray val) {
38713         LDKAcceptChannel this_ptr_conv;
38714         this_ptr_conv.inner = untag_ptr(this_ptr);
38715         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
38716         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
38717         this_ptr_conv.is_owned = false;
38718         LDKPublicKey val_ref;
38719         CHECK(val->arr_len == 33);
38720         memcpy(val_ref.compressed_form, val->elems, 33); FREE(val);
38721         AcceptChannel_set_payment_point(&this_ptr_conv, val_ref);
38722 }
38723
38724 int8_tArray  __attribute__((export_name("TS_AcceptChannel_get_delayed_payment_basepoint"))) TS_AcceptChannel_get_delayed_payment_basepoint(uint64_t this_ptr) {
38725         LDKAcceptChannel this_ptr_conv;
38726         this_ptr_conv.inner = untag_ptr(this_ptr);
38727         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
38728         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
38729         this_ptr_conv.is_owned = false;
38730         int8_tArray ret_arr = init_int8_tArray(33, __LINE__);
38731         memcpy(ret_arr->elems, AcceptChannel_get_delayed_payment_basepoint(&this_ptr_conv).compressed_form, 33);
38732         return ret_arr;
38733 }
38734
38735 void  __attribute__((export_name("TS_AcceptChannel_set_delayed_payment_basepoint"))) TS_AcceptChannel_set_delayed_payment_basepoint(uint64_t this_ptr, int8_tArray val) {
38736         LDKAcceptChannel this_ptr_conv;
38737         this_ptr_conv.inner = untag_ptr(this_ptr);
38738         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
38739         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
38740         this_ptr_conv.is_owned = false;
38741         LDKPublicKey val_ref;
38742         CHECK(val->arr_len == 33);
38743         memcpy(val_ref.compressed_form, val->elems, 33); FREE(val);
38744         AcceptChannel_set_delayed_payment_basepoint(&this_ptr_conv, val_ref);
38745 }
38746
38747 int8_tArray  __attribute__((export_name("TS_AcceptChannel_get_htlc_basepoint"))) TS_AcceptChannel_get_htlc_basepoint(uint64_t this_ptr) {
38748         LDKAcceptChannel this_ptr_conv;
38749         this_ptr_conv.inner = untag_ptr(this_ptr);
38750         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
38751         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
38752         this_ptr_conv.is_owned = false;
38753         int8_tArray ret_arr = init_int8_tArray(33, __LINE__);
38754         memcpy(ret_arr->elems, AcceptChannel_get_htlc_basepoint(&this_ptr_conv).compressed_form, 33);
38755         return ret_arr;
38756 }
38757
38758 void  __attribute__((export_name("TS_AcceptChannel_set_htlc_basepoint"))) TS_AcceptChannel_set_htlc_basepoint(uint64_t this_ptr, int8_tArray val) {
38759         LDKAcceptChannel this_ptr_conv;
38760         this_ptr_conv.inner = untag_ptr(this_ptr);
38761         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
38762         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
38763         this_ptr_conv.is_owned = false;
38764         LDKPublicKey val_ref;
38765         CHECK(val->arr_len == 33);
38766         memcpy(val_ref.compressed_form, val->elems, 33); FREE(val);
38767         AcceptChannel_set_htlc_basepoint(&this_ptr_conv, val_ref);
38768 }
38769
38770 int8_tArray  __attribute__((export_name("TS_AcceptChannel_get_first_per_commitment_point"))) TS_AcceptChannel_get_first_per_commitment_point(uint64_t this_ptr) {
38771         LDKAcceptChannel this_ptr_conv;
38772         this_ptr_conv.inner = untag_ptr(this_ptr);
38773         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
38774         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
38775         this_ptr_conv.is_owned = false;
38776         int8_tArray ret_arr = init_int8_tArray(33, __LINE__);
38777         memcpy(ret_arr->elems, AcceptChannel_get_first_per_commitment_point(&this_ptr_conv).compressed_form, 33);
38778         return ret_arr;
38779 }
38780
38781 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) {
38782         LDKAcceptChannel this_ptr_conv;
38783         this_ptr_conv.inner = untag_ptr(this_ptr);
38784         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
38785         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
38786         this_ptr_conv.is_owned = false;
38787         LDKPublicKey val_ref;
38788         CHECK(val->arr_len == 33);
38789         memcpy(val_ref.compressed_form, val->elems, 33); FREE(val);
38790         AcceptChannel_set_first_per_commitment_point(&this_ptr_conv, val_ref);
38791 }
38792
38793 uint64_t  __attribute__((export_name("TS_AcceptChannel_get_shutdown_scriptpubkey"))) TS_AcceptChannel_get_shutdown_scriptpubkey(uint64_t this_ptr) {
38794         LDKAcceptChannel this_ptr_conv;
38795         this_ptr_conv.inner = untag_ptr(this_ptr);
38796         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
38797         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
38798         this_ptr_conv.is_owned = false;
38799         LDKCOption_CVec_u8ZZ *ret_copy = MALLOC(sizeof(LDKCOption_CVec_u8ZZ), "LDKCOption_CVec_u8ZZ");
38800         *ret_copy = AcceptChannel_get_shutdown_scriptpubkey(&this_ptr_conv);
38801         uint64_t ret_ref = tag_ptr(ret_copy, true);
38802         return ret_ref;
38803 }
38804
38805 void  __attribute__((export_name("TS_AcceptChannel_set_shutdown_scriptpubkey"))) TS_AcceptChannel_set_shutdown_scriptpubkey(uint64_t this_ptr, uint64_t val) {
38806         LDKAcceptChannel this_ptr_conv;
38807         this_ptr_conv.inner = untag_ptr(this_ptr);
38808         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
38809         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
38810         this_ptr_conv.is_owned = false;
38811         void* val_ptr = untag_ptr(val);
38812         CHECK_ACCESS(val_ptr);
38813         LDKCOption_CVec_u8ZZ val_conv = *(LDKCOption_CVec_u8ZZ*)(val_ptr);
38814         val_conv = COption_CVec_u8ZZ_clone((LDKCOption_CVec_u8ZZ*)untag_ptr(val));
38815         AcceptChannel_set_shutdown_scriptpubkey(&this_ptr_conv, val_conv);
38816 }
38817
38818 uint64_t  __attribute__((export_name("TS_AcceptChannel_get_channel_type"))) TS_AcceptChannel_get_channel_type(uint64_t this_ptr) {
38819         LDKAcceptChannel this_ptr_conv;
38820         this_ptr_conv.inner = untag_ptr(this_ptr);
38821         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
38822         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
38823         this_ptr_conv.is_owned = false;
38824         LDKChannelTypeFeatures ret_var = AcceptChannel_get_channel_type(&this_ptr_conv);
38825         uint64_t ret_ref = 0;
38826         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
38827         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
38828         return ret_ref;
38829 }
38830
38831 void  __attribute__((export_name("TS_AcceptChannel_set_channel_type"))) TS_AcceptChannel_set_channel_type(uint64_t this_ptr, uint64_t val) {
38832         LDKAcceptChannel this_ptr_conv;
38833         this_ptr_conv.inner = untag_ptr(this_ptr);
38834         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
38835         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
38836         this_ptr_conv.is_owned = false;
38837         LDKChannelTypeFeatures val_conv;
38838         val_conv.inner = untag_ptr(val);
38839         val_conv.is_owned = ptr_is_owned(val);
38840         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
38841         val_conv = ChannelTypeFeatures_clone(&val_conv);
38842         AcceptChannel_set_channel_type(&this_ptr_conv, val_conv);
38843 }
38844
38845 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) {
38846         LDKThirtyTwoBytes temporary_channel_id_arg_ref;
38847         CHECK(temporary_channel_id_arg->arr_len == 32);
38848         memcpy(temporary_channel_id_arg_ref.data, temporary_channel_id_arg->elems, 32); FREE(temporary_channel_id_arg);
38849         LDKPublicKey funding_pubkey_arg_ref;
38850         CHECK(funding_pubkey_arg->arr_len == 33);
38851         memcpy(funding_pubkey_arg_ref.compressed_form, funding_pubkey_arg->elems, 33); FREE(funding_pubkey_arg);
38852         LDKPublicKey revocation_basepoint_arg_ref;
38853         CHECK(revocation_basepoint_arg->arr_len == 33);
38854         memcpy(revocation_basepoint_arg_ref.compressed_form, revocation_basepoint_arg->elems, 33); FREE(revocation_basepoint_arg);
38855         LDKPublicKey payment_point_arg_ref;
38856         CHECK(payment_point_arg->arr_len == 33);
38857         memcpy(payment_point_arg_ref.compressed_form, payment_point_arg->elems, 33); FREE(payment_point_arg);
38858         LDKPublicKey delayed_payment_basepoint_arg_ref;
38859         CHECK(delayed_payment_basepoint_arg->arr_len == 33);
38860         memcpy(delayed_payment_basepoint_arg_ref.compressed_form, delayed_payment_basepoint_arg->elems, 33); FREE(delayed_payment_basepoint_arg);
38861         LDKPublicKey htlc_basepoint_arg_ref;
38862         CHECK(htlc_basepoint_arg->arr_len == 33);
38863         memcpy(htlc_basepoint_arg_ref.compressed_form, htlc_basepoint_arg->elems, 33); FREE(htlc_basepoint_arg);
38864         LDKPublicKey first_per_commitment_point_arg_ref;
38865         CHECK(first_per_commitment_point_arg->arr_len == 33);
38866         memcpy(first_per_commitment_point_arg_ref.compressed_form, first_per_commitment_point_arg->elems, 33); FREE(first_per_commitment_point_arg);
38867         void* shutdown_scriptpubkey_arg_ptr = untag_ptr(shutdown_scriptpubkey_arg);
38868         CHECK_ACCESS(shutdown_scriptpubkey_arg_ptr);
38869         LDKCOption_CVec_u8ZZ shutdown_scriptpubkey_arg_conv = *(LDKCOption_CVec_u8ZZ*)(shutdown_scriptpubkey_arg_ptr);
38870         shutdown_scriptpubkey_arg_conv = COption_CVec_u8ZZ_clone((LDKCOption_CVec_u8ZZ*)untag_ptr(shutdown_scriptpubkey_arg));
38871         LDKChannelTypeFeatures channel_type_arg_conv;
38872         channel_type_arg_conv.inner = untag_ptr(channel_type_arg);
38873         channel_type_arg_conv.is_owned = ptr_is_owned(channel_type_arg);
38874         CHECK_INNER_FIELD_ACCESS_OR_NULL(channel_type_arg_conv);
38875         channel_type_arg_conv = ChannelTypeFeatures_clone(&channel_type_arg_conv);
38876         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);
38877         uint64_t ret_ref = 0;
38878         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
38879         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
38880         return ret_ref;
38881 }
38882
38883 static inline uint64_t AcceptChannel_clone_ptr(LDKAcceptChannel *NONNULL_PTR arg) {
38884         LDKAcceptChannel ret_var = AcceptChannel_clone(arg);
38885         uint64_t ret_ref = 0;
38886         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
38887         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
38888         return ret_ref;
38889 }
38890 int64_t  __attribute__((export_name("TS_AcceptChannel_clone_ptr"))) TS_AcceptChannel_clone_ptr(uint64_t arg) {
38891         LDKAcceptChannel arg_conv;
38892         arg_conv.inner = untag_ptr(arg);
38893         arg_conv.is_owned = ptr_is_owned(arg);
38894         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
38895         arg_conv.is_owned = false;
38896         int64_t ret_conv = AcceptChannel_clone_ptr(&arg_conv);
38897         return ret_conv;
38898 }
38899
38900 uint64_t  __attribute__((export_name("TS_AcceptChannel_clone"))) TS_AcceptChannel_clone(uint64_t orig) {
38901         LDKAcceptChannel orig_conv;
38902         orig_conv.inner = untag_ptr(orig);
38903         orig_conv.is_owned = ptr_is_owned(orig);
38904         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
38905         orig_conv.is_owned = false;
38906         LDKAcceptChannel ret_var = AcceptChannel_clone(&orig_conv);
38907         uint64_t ret_ref = 0;
38908         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
38909         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
38910         return ret_ref;
38911 }
38912
38913 jboolean  __attribute__((export_name("TS_AcceptChannel_eq"))) TS_AcceptChannel_eq(uint64_t a, uint64_t b) {
38914         LDKAcceptChannel a_conv;
38915         a_conv.inner = untag_ptr(a);
38916         a_conv.is_owned = ptr_is_owned(a);
38917         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
38918         a_conv.is_owned = false;
38919         LDKAcceptChannel b_conv;
38920         b_conv.inner = untag_ptr(b);
38921         b_conv.is_owned = ptr_is_owned(b);
38922         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
38923         b_conv.is_owned = false;
38924         jboolean ret_conv = AcceptChannel_eq(&a_conv, &b_conv);
38925         return ret_conv;
38926 }
38927
38928 void  __attribute__((export_name("TS_AcceptChannelV2_free"))) TS_AcceptChannelV2_free(uint64_t this_obj) {
38929         LDKAcceptChannelV2 this_obj_conv;
38930         this_obj_conv.inner = untag_ptr(this_obj);
38931         this_obj_conv.is_owned = ptr_is_owned(this_obj);
38932         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
38933         AcceptChannelV2_free(this_obj_conv);
38934 }
38935
38936 int8_tArray  __attribute__((export_name("TS_AcceptChannelV2_get_temporary_channel_id"))) TS_AcceptChannelV2_get_temporary_channel_id(uint64_t this_ptr) {
38937         LDKAcceptChannelV2 this_ptr_conv;
38938         this_ptr_conv.inner = untag_ptr(this_ptr);
38939         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
38940         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
38941         this_ptr_conv.is_owned = false;
38942         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
38943         memcpy(ret_arr->elems, *AcceptChannelV2_get_temporary_channel_id(&this_ptr_conv), 32);
38944         return ret_arr;
38945 }
38946
38947 void  __attribute__((export_name("TS_AcceptChannelV2_set_temporary_channel_id"))) TS_AcceptChannelV2_set_temporary_channel_id(uint64_t this_ptr, int8_tArray val) {
38948         LDKAcceptChannelV2 this_ptr_conv;
38949         this_ptr_conv.inner = untag_ptr(this_ptr);
38950         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
38951         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
38952         this_ptr_conv.is_owned = false;
38953         LDKThirtyTwoBytes val_ref;
38954         CHECK(val->arr_len == 32);
38955         memcpy(val_ref.data, val->elems, 32); FREE(val);
38956         AcceptChannelV2_set_temporary_channel_id(&this_ptr_conv, val_ref);
38957 }
38958
38959 int64_t  __attribute__((export_name("TS_AcceptChannelV2_get_funding_satoshis"))) TS_AcceptChannelV2_get_funding_satoshis(uint64_t this_ptr) {
38960         LDKAcceptChannelV2 this_ptr_conv;
38961         this_ptr_conv.inner = untag_ptr(this_ptr);
38962         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
38963         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
38964         this_ptr_conv.is_owned = false;
38965         int64_t ret_conv = AcceptChannelV2_get_funding_satoshis(&this_ptr_conv);
38966         return ret_conv;
38967 }
38968
38969 void  __attribute__((export_name("TS_AcceptChannelV2_set_funding_satoshis"))) TS_AcceptChannelV2_set_funding_satoshis(uint64_t this_ptr, int64_t val) {
38970         LDKAcceptChannelV2 this_ptr_conv;
38971         this_ptr_conv.inner = untag_ptr(this_ptr);
38972         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
38973         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
38974         this_ptr_conv.is_owned = false;
38975         AcceptChannelV2_set_funding_satoshis(&this_ptr_conv, val);
38976 }
38977
38978 int64_t  __attribute__((export_name("TS_AcceptChannelV2_get_dust_limit_satoshis"))) TS_AcceptChannelV2_get_dust_limit_satoshis(uint64_t this_ptr) {
38979         LDKAcceptChannelV2 this_ptr_conv;
38980         this_ptr_conv.inner = untag_ptr(this_ptr);
38981         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
38982         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
38983         this_ptr_conv.is_owned = false;
38984         int64_t ret_conv = AcceptChannelV2_get_dust_limit_satoshis(&this_ptr_conv);
38985         return ret_conv;
38986 }
38987
38988 void  __attribute__((export_name("TS_AcceptChannelV2_set_dust_limit_satoshis"))) TS_AcceptChannelV2_set_dust_limit_satoshis(uint64_t this_ptr, int64_t val) {
38989         LDKAcceptChannelV2 this_ptr_conv;
38990         this_ptr_conv.inner = untag_ptr(this_ptr);
38991         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
38992         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
38993         this_ptr_conv.is_owned = false;
38994         AcceptChannelV2_set_dust_limit_satoshis(&this_ptr_conv, val);
38995 }
38996
38997 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) {
38998         LDKAcceptChannelV2 this_ptr_conv;
38999         this_ptr_conv.inner = untag_ptr(this_ptr);
39000         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
39001         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
39002         this_ptr_conv.is_owned = false;
39003         int64_t ret_conv = AcceptChannelV2_get_max_htlc_value_in_flight_msat(&this_ptr_conv);
39004         return ret_conv;
39005 }
39006
39007 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) {
39008         LDKAcceptChannelV2 this_ptr_conv;
39009         this_ptr_conv.inner = untag_ptr(this_ptr);
39010         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
39011         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
39012         this_ptr_conv.is_owned = false;
39013         AcceptChannelV2_set_max_htlc_value_in_flight_msat(&this_ptr_conv, val);
39014 }
39015
39016 int64_t  __attribute__((export_name("TS_AcceptChannelV2_get_htlc_minimum_msat"))) TS_AcceptChannelV2_get_htlc_minimum_msat(uint64_t this_ptr) {
39017         LDKAcceptChannelV2 this_ptr_conv;
39018         this_ptr_conv.inner = untag_ptr(this_ptr);
39019         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
39020         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
39021         this_ptr_conv.is_owned = false;
39022         int64_t ret_conv = AcceptChannelV2_get_htlc_minimum_msat(&this_ptr_conv);
39023         return ret_conv;
39024 }
39025
39026 void  __attribute__((export_name("TS_AcceptChannelV2_set_htlc_minimum_msat"))) TS_AcceptChannelV2_set_htlc_minimum_msat(uint64_t this_ptr, int64_t val) {
39027         LDKAcceptChannelV2 this_ptr_conv;
39028         this_ptr_conv.inner = untag_ptr(this_ptr);
39029         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
39030         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
39031         this_ptr_conv.is_owned = false;
39032         AcceptChannelV2_set_htlc_minimum_msat(&this_ptr_conv, val);
39033 }
39034
39035 int32_t  __attribute__((export_name("TS_AcceptChannelV2_get_minimum_depth"))) TS_AcceptChannelV2_get_minimum_depth(uint64_t this_ptr) {
39036         LDKAcceptChannelV2 this_ptr_conv;
39037         this_ptr_conv.inner = untag_ptr(this_ptr);
39038         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
39039         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
39040         this_ptr_conv.is_owned = false;
39041         int32_t ret_conv = AcceptChannelV2_get_minimum_depth(&this_ptr_conv);
39042         return ret_conv;
39043 }
39044
39045 void  __attribute__((export_name("TS_AcceptChannelV2_set_minimum_depth"))) TS_AcceptChannelV2_set_minimum_depth(uint64_t this_ptr, int32_t val) {
39046         LDKAcceptChannelV2 this_ptr_conv;
39047         this_ptr_conv.inner = untag_ptr(this_ptr);
39048         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
39049         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
39050         this_ptr_conv.is_owned = false;
39051         AcceptChannelV2_set_minimum_depth(&this_ptr_conv, val);
39052 }
39053
39054 int16_t  __attribute__((export_name("TS_AcceptChannelV2_get_to_self_delay"))) TS_AcceptChannelV2_get_to_self_delay(uint64_t this_ptr) {
39055         LDKAcceptChannelV2 this_ptr_conv;
39056         this_ptr_conv.inner = untag_ptr(this_ptr);
39057         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
39058         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
39059         this_ptr_conv.is_owned = false;
39060         int16_t ret_conv = AcceptChannelV2_get_to_self_delay(&this_ptr_conv);
39061         return ret_conv;
39062 }
39063
39064 void  __attribute__((export_name("TS_AcceptChannelV2_set_to_self_delay"))) TS_AcceptChannelV2_set_to_self_delay(uint64_t this_ptr, int16_t val) {
39065         LDKAcceptChannelV2 this_ptr_conv;
39066         this_ptr_conv.inner = untag_ptr(this_ptr);
39067         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
39068         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
39069         this_ptr_conv.is_owned = false;
39070         AcceptChannelV2_set_to_self_delay(&this_ptr_conv, val);
39071 }
39072
39073 int16_t  __attribute__((export_name("TS_AcceptChannelV2_get_max_accepted_htlcs"))) TS_AcceptChannelV2_get_max_accepted_htlcs(uint64_t this_ptr) {
39074         LDKAcceptChannelV2 this_ptr_conv;
39075         this_ptr_conv.inner = untag_ptr(this_ptr);
39076         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
39077         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
39078         this_ptr_conv.is_owned = false;
39079         int16_t ret_conv = AcceptChannelV2_get_max_accepted_htlcs(&this_ptr_conv);
39080         return ret_conv;
39081 }
39082
39083 void  __attribute__((export_name("TS_AcceptChannelV2_set_max_accepted_htlcs"))) TS_AcceptChannelV2_set_max_accepted_htlcs(uint64_t this_ptr, int16_t val) {
39084         LDKAcceptChannelV2 this_ptr_conv;
39085         this_ptr_conv.inner = untag_ptr(this_ptr);
39086         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
39087         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
39088         this_ptr_conv.is_owned = false;
39089         AcceptChannelV2_set_max_accepted_htlcs(&this_ptr_conv, val);
39090 }
39091
39092 int8_tArray  __attribute__((export_name("TS_AcceptChannelV2_get_funding_pubkey"))) TS_AcceptChannelV2_get_funding_pubkey(uint64_t this_ptr) {
39093         LDKAcceptChannelV2 this_ptr_conv;
39094         this_ptr_conv.inner = untag_ptr(this_ptr);
39095         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
39096         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
39097         this_ptr_conv.is_owned = false;
39098         int8_tArray ret_arr = init_int8_tArray(33, __LINE__);
39099         memcpy(ret_arr->elems, AcceptChannelV2_get_funding_pubkey(&this_ptr_conv).compressed_form, 33);
39100         return ret_arr;
39101 }
39102
39103 void  __attribute__((export_name("TS_AcceptChannelV2_set_funding_pubkey"))) TS_AcceptChannelV2_set_funding_pubkey(uint64_t this_ptr, int8_tArray val) {
39104         LDKAcceptChannelV2 this_ptr_conv;
39105         this_ptr_conv.inner = untag_ptr(this_ptr);
39106         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
39107         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
39108         this_ptr_conv.is_owned = false;
39109         LDKPublicKey val_ref;
39110         CHECK(val->arr_len == 33);
39111         memcpy(val_ref.compressed_form, val->elems, 33); FREE(val);
39112         AcceptChannelV2_set_funding_pubkey(&this_ptr_conv, val_ref);
39113 }
39114
39115 int8_tArray  __attribute__((export_name("TS_AcceptChannelV2_get_revocation_basepoint"))) TS_AcceptChannelV2_get_revocation_basepoint(uint64_t this_ptr) {
39116         LDKAcceptChannelV2 this_ptr_conv;
39117         this_ptr_conv.inner = untag_ptr(this_ptr);
39118         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
39119         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
39120         this_ptr_conv.is_owned = false;
39121         int8_tArray ret_arr = init_int8_tArray(33, __LINE__);
39122         memcpy(ret_arr->elems, AcceptChannelV2_get_revocation_basepoint(&this_ptr_conv).compressed_form, 33);
39123         return ret_arr;
39124 }
39125
39126 void  __attribute__((export_name("TS_AcceptChannelV2_set_revocation_basepoint"))) TS_AcceptChannelV2_set_revocation_basepoint(uint64_t this_ptr, int8_tArray val) {
39127         LDKAcceptChannelV2 this_ptr_conv;
39128         this_ptr_conv.inner = untag_ptr(this_ptr);
39129         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
39130         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
39131         this_ptr_conv.is_owned = false;
39132         LDKPublicKey val_ref;
39133         CHECK(val->arr_len == 33);
39134         memcpy(val_ref.compressed_form, val->elems, 33); FREE(val);
39135         AcceptChannelV2_set_revocation_basepoint(&this_ptr_conv, val_ref);
39136 }
39137
39138 int8_tArray  __attribute__((export_name("TS_AcceptChannelV2_get_payment_basepoint"))) TS_AcceptChannelV2_get_payment_basepoint(uint64_t this_ptr) {
39139         LDKAcceptChannelV2 this_ptr_conv;
39140         this_ptr_conv.inner = untag_ptr(this_ptr);
39141         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
39142         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
39143         this_ptr_conv.is_owned = false;
39144         int8_tArray ret_arr = init_int8_tArray(33, __LINE__);
39145         memcpy(ret_arr->elems, AcceptChannelV2_get_payment_basepoint(&this_ptr_conv).compressed_form, 33);
39146         return ret_arr;
39147 }
39148
39149 void  __attribute__((export_name("TS_AcceptChannelV2_set_payment_basepoint"))) TS_AcceptChannelV2_set_payment_basepoint(uint64_t this_ptr, int8_tArray val) {
39150         LDKAcceptChannelV2 this_ptr_conv;
39151         this_ptr_conv.inner = untag_ptr(this_ptr);
39152         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
39153         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
39154         this_ptr_conv.is_owned = false;
39155         LDKPublicKey val_ref;
39156         CHECK(val->arr_len == 33);
39157         memcpy(val_ref.compressed_form, val->elems, 33); FREE(val);
39158         AcceptChannelV2_set_payment_basepoint(&this_ptr_conv, val_ref);
39159 }
39160
39161 int8_tArray  __attribute__((export_name("TS_AcceptChannelV2_get_delayed_payment_basepoint"))) TS_AcceptChannelV2_get_delayed_payment_basepoint(uint64_t this_ptr) {
39162         LDKAcceptChannelV2 this_ptr_conv;
39163         this_ptr_conv.inner = untag_ptr(this_ptr);
39164         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
39165         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
39166         this_ptr_conv.is_owned = false;
39167         int8_tArray ret_arr = init_int8_tArray(33, __LINE__);
39168         memcpy(ret_arr->elems, AcceptChannelV2_get_delayed_payment_basepoint(&this_ptr_conv).compressed_form, 33);
39169         return ret_arr;
39170 }
39171
39172 void  __attribute__((export_name("TS_AcceptChannelV2_set_delayed_payment_basepoint"))) TS_AcceptChannelV2_set_delayed_payment_basepoint(uint64_t this_ptr, int8_tArray val) {
39173         LDKAcceptChannelV2 this_ptr_conv;
39174         this_ptr_conv.inner = untag_ptr(this_ptr);
39175         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
39176         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
39177         this_ptr_conv.is_owned = false;
39178         LDKPublicKey val_ref;
39179         CHECK(val->arr_len == 33);
39180         memcpy(val_ref.compressed_form, val->elems, 33); FREE(val);
39181         AcceptChannelV2_set_delayed_payment_basepoint(&this_ptr_conv, val_ref);
39182 }
39183
39184 int8_tArray  __attribute__((export_name("TS_AcceptChannelV2_get_htlc_basepoint"))) TS_AcceptChannelV2_get_htlc_basepoint(uint64_t this_ptr) {
39185         LDKAcceptChannelV2 this_ptr_conv;
39186         this_ptr_conv.inner = untag_ptr(this_ptr);
39187         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
39188         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
39189         this_ptr_conv.is_owned = false;
39190         int8_tArray ret_arr = init_int8_tArray(33, __LINE__);
39191         memcpy(ret_arr->elems, AcceptChannelV2_get_htlc_basepoint(&this_ptr_conv).compressed_form, 33);
39192         return ret_arr;
39193 }
39194
39195 void  __attribute__((export_name("TS_AcceptChannelV2_set_htlc_basepoint"))) TS_AcceptChannelV2_set_htlc_basepoint(uint64_t this_ptr, int8_tArray val) {
39196         LDKAcceptChannelV2 this_ptr_conv;
39197         this_ptr_conv.inner = untag_ptr(this_ptr);
39198         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
39199         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
39200         this_ptr_conv.is_owned = false;
39201         LDKPublicKey val_ref;
39202         CHECK(val->arr_len == 33);
39203         memcpy(val_ref.compressed_form, val->elems, 33); FREE(val);
39204         AcceptChannelV2_set_htlc_basepoint(&this_ptr_conv, val_ref);
39205 }
39206
39207 int8_tArray  __attribute__((export_name("TS_AcceptChannelV2_get_first_per_commitment_point"))) TS_AcceptChannelV2_get_first_per_commitment_point(uint64_t this_ptr) {
39208         LDKAcceptChannelV2 this_ptr_conv;
39209         this_ptr_conv.inner = untag_ptr(this_ptr);
39210         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
39211         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
39212         this_ptr_conv.is_owned = false;
39213         int8_tArray ret_arr = init_int8_tArray(33, __LINE__);
39214         memcpy(ret_arr->elems, AcceptChannelV2_get_first_per_commitment_point(&this_ptr_conv).compressed_form, 33);
39215         return ret_arr;
39216 }
39217
39218 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) {
39219         LDKAcceptChannelV2 this_ptr_conv;
39220         this_ptr_conv.inner = untag_ptr(this_ptr);
39221         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
39222         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
39223         this_ptr_conv.is_owned = false;
39224         LDKPublicKey val_ref;
39225         CHECK(val->arr_len == 33);
39226         memcpy(val_ref.compressed_form, val->elems, 33); FREE(val);
39227         AcceptChannelV2_set_first_per_commitment_point(&this_ptr_conv, val_ref);
39228 }
39229
39230 int8_tArray  __attribute__((export_name("TS_AcceptChannelV2_get_second_per_commitment_point"))) TS_AcceptChannelV2_get_second_per_commitment_point(uint64_t this_ptr) {
39231         LDKAcceptChannelV2 this_ptr_conv;
39232         this_ptr_conv.inner = untag_ptr(this_ptr);
39233         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
39234         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
39235         this_ptr_conv.is_owned = false;
39236         int8_tArray ret_arr = init_int8_tArray(33, __LINE__);
39237         memcpy(ret_arr->elems, AcceptChannelV2_get_second_per_commitment_point(&this_ptr_conv).compressed_form, 33);
39238         return ret_arr;
39239 }
39240
39241 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) {
39242         LDKAcceptChannelV2 this_ptr_conv;
39243         this_ptr_conv.inner = untag_ptr(this_ptr);
39244         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
39245         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
39246         this_ptr_conv.is_owned = false;
39247         LDKPublicKey val_ref;
39248         CHECK(val->arr_len == 33);
39249         memcpy(val_ref.compressed_form, val->elems, 33); FREE(val);
39250         AcceptChannelV2_set_second_per_commitment_point(&this_ptr_conv, val_ref);
39251 }
39252
39253 uint64_t  __attribute__((export_name("TS_AcceptChannelV2_get_shutdown_scriptpubkey"))) TS_AcceptChannelV2_get_shutdown_scriptpubkey(uint64_t this_ptr) {
39254         LDKAcceptChannelV2 this_ptr_conv;
39255         this_ptr_conv.inner = untag_ptr(this_ptr);
39256         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
39257         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
39258         this_ptr_conv.is_owned = false;
39259         LDKCOption_CVec_u8ZZ *ret_copy = MALLOC(sizeof(LDKCOption_CVec_u8ZZ), "LDKCOption_CVec_u8ZZ");
39260         *ret_copy = AcceptChannelV2_get_shutdown_scriptpubkey(&this_ptr_conv);
39261         uint64_t ret_ref = tag_ptr(ret_copy, true);
39262         return ret_ref;
39263 }
39264
39265 void  __attribute__((export_name("TS_AcceptChannelV2_set_shutdown_scriptpubkey"))) TS_AcceptChannelV2_set_shutdown_scriptpubkey(uint64_t this_ptr, uint64_t val) {
39266         LDKAcceptChannelV2 this_ptr_conv;
39267         this_ptr_conv.inner = untag_ptr(this_ptr);
39268         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
39269         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
39270         this_ptr_conv.is_owned = false;
39271         void* val_ptr = untag_ptr(val);
39272         CHECK_ACCESS(val_ptr);
39273         LDKCOption_CVec_u8ZZ val_conv = *(LDKCOption_CVec_u8ZZ*)(val_ptr);
39274         val_conv = COption_CVec_u8ZZ_clone((LDKCOption_CVec_u8ZZ*)untag_ptr(val));
39275         AcceptChannelV2_set_shutdown_scriptpubkey(&this_ptr_conv, val_conv);
39276 }
39277
39278 uint64_t  __attribute__((export_name("TS_AcceptChannelV2_get_channel_type"))) TS_AcceptChannelV2_get_channel_type(uint64_t this_ptr) {
39279         LDKAcceptChannelV2 this_ptr_conv;
39280         this_ptr_conv.inner = untag_ptr(this_ptr);
39281         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
39282         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
39283         this_ptr_conv.is_owned = false;
39284         LDKChannelTypeFeatures ret_var = AcceptChannelV2_get_channel_type(&this_ptr_conv);
39285         uint64_t ret_ref = 0;
39286         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
39287         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
39288         return ret_ref;
39289 }
39290
39291 void  __attribute__((export_name("TS_AcceptChannelV2_set_channel_type"))) TS_AcceptChannelV2_set_channel_type(uint64_t this_ptr, uint64_t val) {
39292         LDKAcceptChannelV2 this_ptr_conv;
39293         this_ptr_conv.inner = untag_ptr(this_ptr);
39294         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
39295         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
39296         this_ptr_conv.is_owned = false;
39297         LDKChannelTypeFeatures val_conv;
39298         val_conv.inner = untag_ptr(val);
39299         val_conv.is_owned = ptr_is_owned(val);
39300         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
39301         val_conv = ChannelTypeFeatures_clone(&val_conv);
39302         AcceptChannelV2_set_channel_type(&this_ptr_conv, val_conv);
39303 }
39304
39305 uint32_t  __attribute__((export_name("TS_AcceptChannelV2_get_require_confirmed_inputs"))) TS_AcceptChannelV2_get_require_confirmed_inputs(uint64_t this_ptr) {
39306         LDKAcceptChannelV2 this_ptr_conv;
39307         this_ptr_conv.inner = untag_ptr(this_ptr);
39308         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
39309         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
39310         this_ptr_conv.is_owned = false;
39311         uint32_t ret_conv = LDKCOption_NoneZ_to_js(AcceptChannelV2_get_require_confirmed_inputs(&this_ptr_conv));
39312         return ret_conv;
39313 }
39314
39315 void  __attribute__((export_name("TS_AcceptChannelV2_set_require_confirmed_inputs"))) TS_AcceptChannelV2_set_require_confirmed_inputs(uint64_t this_ptr, uint32_t val) {
39316         LDKAcceptChannelV2 this_ptr_conv;
39317         this_ptr_conv.inner = untag_ptr(this_ptr);
39318         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
39319         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
39320         this_ptr_conv.is_owned = false;
39321         LDKCOption_NoneZ val_conv = LDKCOption_NoneZ_from_js(val);
39322         AcceptChannelV2_set_require_confirmed_inputs(&this_ptr_conv, val_conv);
39323 }
39324
39325 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) {
39326         LDKThirtyTwoBytes temporary_channel_id_arg_ref;
39327         CHECK(temporary_channel_id_arg->arr_len == 32);
39328         memcpy(temporary_channel_id_arg_ref.data, temporary_channel_id_arg->elems, 32); FREE(temporary_channel_id_arg);
39329         LDKPublicKey funding_pubkey_arg_ref;
39330         CHECK(funding_pubkey_arg->arr_len == 33);
39331         memcpy(funding_pubkey_arg_ref.compressed_form, funding_pubkey_arg->elems, 33); FREE(funding_pubkey_arg);
39332         LDKPublicKey revocation_basepoint_arg_ref;
39333         CHECK(revocation_basepoint_arg->arr_len == 33);
39334         memcpy(revocation_basepoint_arg_ref.compressed_form, revocation_basepoint_arg->elems, 33); FREE(revocation_basepoint_arg);
39335         LDKPublicKey payment_basepoint_arg_ref;
39336         CHECK(payment_basepoint_arg->arr_len == 33);
39337         memcpy(payment_basepoint_arg_ref.compressed_form, payment_basepoint_arg->elems, 33); FREE(payment_basepoint_arg);
39338         LDKPublicKey delayed_payment_basepoint_arg_ref;
39339         CHECK(delayed_payment_basepoint_arg->arr_len == 33);
39340         memcpy(delayed_payment_basepoint_arg_ref.compressed_form, delayed_payment_basepoint_arg->elems, 33); FREE(delayed_payment_basepoint_arg);
39341         LDKPublicKey htlc_basepoint_arg_ref;
39342         CHECK(htlc_basepoint_arg->arr_len == 33);
39343         memcpy(htlc_basepoint_arg_ref.compressed_form, htlc_basepoint_arg->elems, 33); FREE(htlc_basepoint_arg);
39344         LDKPublicKey first_per_commitment_point_arg_ref;
39345         CHECK(first_per_commitment_point_arg->arr_len == 33);
39346         memcpy(first_per_commitment_point_arg_ref.compressed_form, first_per_commitment_point_arg->elems, 33); FREE(first_per_commitment_point_arg);
39347         LDKPublicKey second_per_commitment_point_arg_ref;
39348         CHECK(second_per_commitment_point_arg->arr_len == 33);
39349         memcpy(second_per_commitment_point_arg_ref.compressed_form, second_per_commitment_point_arg->elems, 33); FREE(second_per_commitment_point_arg);
39350         void* shutdown_scriptpubkey_arg_ptr = untag_ptr(shutdown_scriptpubkey_arg);
39351         CHECK_ACCESS(shutdown_scriptpubkey_arg_ptr);
39352         LDKCOption_CVec_u8ZZ shutdown_scriptpubkey_arg_conv = *(LDKCOption_CVec_u8ZZ*)(shutdown_scriptpubkey_arg_ptr);
39353         shutdown_scriptpubkey_arg_conv = COption_CVec_u8ZZ_clone((LDKCOption_CVec_u8ZZ*)untag_ptr(shutdown_scriptpubkey_arg));
39354         LDKChannelTypeFeatures channel_type_arg_conv;
39355         channel_type_arg_conv.inner = untag_ptr(channel_type_arg);
39356         channel_type_arg_conv.is_owned = ptr_is_owned(channel_type_arg);
39357         CHECK_INNER_FIELD_ACCESS_OR_NULL(channel_type_arg_conv);
39358         channel_type_arg_conv = ChannelTypeFeatures_clone(&channel_type_arg_conv);
39359         LDKCOption_NoneZ require_confirmed_inputs_arg_conv = LDKCOption_NoneZ_from_js(require_confirmed_inputs_arg);
39360         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);
39361         uint64_t ret_ref = 0;
39362         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
39363         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
39364         return ret_ref;
39365 }
39366
39367 static inline uint64_t AcceptChannelV2_clone_ptr(LDKAcceptChannelV2 *NONNULL_PTR arg) {
39368         LDKAcceptChannelV2 ret_var = AcceptChannelV2_clone(arg);
39369         uint64_t ret_ref = 0;
39370         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
39371         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
39372         return ret_ref;
39373 }
39374 int64_t  __attribute__((export_name("TS_AcceptChannelV2_clone_ptr"))) TS_AcceptChannelV2_clone_ptr(uint64_t arg) {
39375         LDKAcceptChannelV2 arg_conv;
39376         arg_conv.inner = untag_ptr(arg);
39377         arg_conv.is_owned = ptr_is_owned(arg);
39378         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
39379         arg_conv.is_owned = false;
39380         int64_t ret_conv = AcceptChannelV2_clone_ptr(&arg_conv);
39381         return ret_conv;
39382 }
39383
39384 uint64_t  __attribute__((export_name("TS_AcceptChannelV2_clone"))) TS_AcceptChannelV2_clone(uint64_t orig) {
39385         LDKAcceptChannelV2 orig_conv;
39386         orig_conv.inner = untag_ptr(orig);
39387         orig_conv.is_owned = ptr_is_owned(orig);
39388         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
39389         orig_conv.is_owned = false;
39390         LDKAcceptChannelV2 ret_var = AcceptChannelV2_clone(&orig_conv);
39391         uint64_t ret_ref = 0;
39392         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
39393         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
39394         return ret_ref;
39395 }
39396
39397 jboolean  __attribute__((export_name("TS_AcceptChannelV2_eq"))) TS_AcceptChannelV2_eq(uint64_t a, uint64_t b) {
39398         LDKAcceptChannelV2 a_conv;
39399         a_conv.inner = untag_ptr(a);
39400         a_conv.is_owned = ptr_is_owned(a);
39401         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
39402         a_conv.is_owned = false;
39403         LDKAcceptChannelV2 b_conv;
39404         b_conv.inner = untag_ptr(b);
39405         b_conv.is_owned = ptr_is_owned(b);
39406         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
39407         b_conv.is_owned = false;
39408         jboolean ret_conv = AcceptChannelV2_eq(&a_conv, &b_conv);
39409         return ret_conv;
39410 }
39411
39412 void  __attribute__((export_name("TS_FundingCreated_free"))) TS_FundingCreated_free(uint64_t this_obj) {
39413         LDKFundingCreated this_obj_conv;
39414         this_obj_conv.inner = untag_ptr(this_obj);
39415         this_obj_conv.is_owned = ptr_is_owned(this_obj);
39416         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
39417         FundingCreated_free(this_obj_conv);
39418 }
39419
39420 int8_tArray  __attribute__((export_name("TS_FundingCreated_get_temporary_channel_id"))) TS_FundingCreated_get_temporary_channel_id(uint64_t this_ptr) {
39421         LDKFundingCreated this_ptr_conv;
39422         this_ptr_conv.inner = untag_ptr(this_ptr);
39423         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
39424         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
39425         this_ptr_conv.is_owned = false;
39426         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
39427         memcpy(ret_arr->elems, *FundingCreated_get_temporary_channel_id(&this_ptr_conv), 32);
39428         return ret_arr;
39429 }
39430
39431 void  __attribute__((export_name("TS_FundingCreated_set_temporary_channel_id"))) TS_FundingCreated_set_temporary_channel_id(uint64_t this_ptr, int8_tArray val) {
39432         LDKFundingCreated this_ptr_conv;
39433         this_ptr_conv.inner = untag_ptr(this_ptr);
39434         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
39435         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
39436         this_ptr_conv.is_owned = false;
39437         LDKThirtyTwoBytes val_ref;
39438         CHECK(val->arr_len == 32);
39439         memcpy(val_ref.data, val->elems, 32); FREE(val);
39440         FundingCreated_set_temporary_channel_id(&this_ptr_conv, val_ref);
39441 }
39442
39443 int8_tArray  __attribute__((export_name("TS_FundingCreated_get_funding_txid"))) TS_FundingCreated_get_funding_txid(uint64_t this_ptr) {
39444         LDKFundingCreated this_ptr_conv;
39445         this_ptr_conv.inner = untag_ptr(this_ptr);
39446         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
39447         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
39448         this_ptr_conv.is_owned = false;
39449         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
39450         memcpy(ret_arr->elems, *FundingCreated_get_funding_txid(&this_ptr_conv), 32);
39451         return ret_arr;
39452 }
39453
39454 void  __attribute__((export_name("TS_FundingCreated_set_funding_txid"))) TS_FundingCreated_set_funding_txid(uint64_t this_ptr, int8_tArray val) {
39455         LDKFundingCreated this_ptr_conv;
39456         this_ptr_conv.inner = untag_ptr(this_ptr);
39457         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
39458         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
39459         this_ptr_conv.is_owned = false;
39460         LDKThirtyTwoBytes val_ref;
39461         CHECK(val->arr_len == 32);
39462         memcpy(val_ref.data, val->elems, 32); FREE(val);
39463         FundingCreated_set_funding_txid(&this_ptr_conv, val_ref);
39464 }
39465
39466 int16_t  __attribute__((export_name("TS_FundingCreated_get_funding_output_index"))) TS_FundingCreated_get_funding_output_index(uint64_t this_ptr) {
39467         LDKFundingCreated this_ptr_conv;
39468         this_ptr_conv.inner = untag_ptr(this_ptr);
39469         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
39470         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
39471         this_ptr_conv.is_owned = false;
39472         int16_t ret_conv = FundingCreated_get_funding_output_index(&this_ptr_conv);
39473         return ret_conv;
39474 }
39475
39476 void  __attribute__((export_name("TS_FundingCreated_set_funding_output_index"))) TS_FundingCreated_set_funding_output_index(uint64_t this_ptr, int16_t val) {
39477         LDKFundingCreated this_ptr_conv;
39478         this_ptr_conv.inner = untag_ptr(this_ptr);
39479         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
39480         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
39481         this_ptr_conv.is_owned = false;
39482         FundingCreated_set_funding_output_index(&this_ptr_conv, val);
39483 }
39484
39485 int8_tArray  __attribute__((export_name("TS_FundingCreated_get_signature"))) TS_FundingCreated_get_signature(uint64_t this_ptr) {
39486         LDKFundingCreated this_ptr_conv;
39487         this_ptr_conv.inner = untag_ptr(this_ptr);
39488         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
39489         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
39490         this_ptr_conv.is_owned = false;
39491         int8_tArray ret_arr = init_int8_tArray(64, __LINE__);
39492         memcpy(ret_arr->elems, FundingCreated_get_signature(&this_ptr_conv).compact_form, 64);
39493         return ret_arr;
39494 }
39495
39496 void  __attribute__((export_name("TS_FundingCreated_set_signature"))) TS_FundingCreated_set_signature(uint64_t this_ptr, int8_tArray val) {
39497         LDKFundingCreated this_ptr_conv;
39498         this_ptr_conv.inner = untag_ptr(this_ptr);
39499         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
39500         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
39501         this_ptr_conv.is_owned = false;
39502         LDKECDSASignature val_ref;
39503         CHECK(val->arr_len == 64);
39504         memcpy(val_ref.compact_form, val->elems, 64); FREE(val);
39505         FundingCreated_set_signature(&this_ptr_conv, val_ref);
39506 }
39507
39508 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) {
39509         LDKThirtyTwoBytes temporary_channel_id_arg_ref;
39510         CHECK(temporary_channel_id_arg->arr_len == 32);
39511         memcpy(temporary_channel_id_arg_ref.data, temporary_channel_id_arg->elems, 32); FREE(temporary_channel_id_arg);
39512         LDKThirtyTwoBytes funding_txid_arg_ref;
39513         CHECK(funding_txid_arg->arr_len == 32);
39514         memcpy(funding_txid_arg_ref.data, funding_txid_arg->elems, 32); FREE(funding_txid_arg);
39515         LDKECDSASignature signature_arg_ref;
39516         CHECK(signature_arg->arr_len == 64);
39517         memcpy(signature_arg_ref.compact_form, signature_arg->elems, 64); FREE(signature_arg);
39518         LDKFundingCreated ret_var = FundingCreated_new(temporary_channel_id_arg_ref, funding_txid_arg_ref, funding_output_index_arg, signature_arg_ref);
39519         uint64_t ret_ref = 0;
39520         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
39521         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
39522         return ret_ref;
39523 }
39524
39525 static inline uint64_t FundingCreated_clone_ptr(LDKFundingCreated *NONNULL_PTR arg) {
39526         LDKFundingCreated ret_var = FundingCreated_clone(arg);
39527         uint64_t ret_ref = 0;
39528         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
39529         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
39530         return ret_ref;
39531 }
39532 int64_t  __attribute__((export_name("TS_FundingCreated_clone_ptr"))) TS_FundingCreated_clone_ptr(uint64_t arg) {
39533         LDKFundingCreated arg_conv;
39534         arg_conv.inner = untag_ptr(arg);
39535         arg_conv.is_owned = ptr_is_owned(arg);
39536         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
39537         arg_conv.is_owned = false;
39538         int64_t ret_conv = FundingCreated_clone_ptr(&arg_conv);
39539         return ret_conv;
39540 }
39541
39542 uint64_t  __attribute__((export_name("TS_FundingCreated_clone"))) TS_FundingCreated_clone(uint64_t orig) {
39543         LDKFundingCreated orig_conv;
39544         orig_conv.inner = untag_ptr(orig);
39545         orig_conv.is_owned = ptr_is_owned(orig);
39546         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
39547         orig_conv.is_owned = false;
39548         LDKFundingCreated ret_var = FundingCreated_clone(&orig_conv);
39549         uint64_t ret_ref = 0;
39550         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
39551         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
39552         return ret_ref;
39553 }
39554
39555 jboolean  __attribute__((export_name("TS_FundingCreated_eq"))) TS_FundingCreated_eq(uint64_t a, uint64_t b) {
39556         LDKFundingCreated a_conv;
39557         a_conv.inner = untag_ptr(a);
39558         a_conv.is_owned = ptr_is_owned(a);
39559         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
39560         a_conv.is_owned = false;
39561         LDKFundingCreated b_conv;
39562         b_conv.inner = untag_ptr(b);
39563         b_conv.is_owned = ptr_is_owned(b);
39564         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
39565         b_conv.is_owned = false;
39566         jboolean ret_conv = FundingCreated_eq(&a_conv, &b_conv);
39567         return ret_conv;
39568 }
39569
39570 void  __attribute__((export_name("TS_FundingSigned_free"))) TS_FundingSigned_free(uint64_t this_obj) {
39571         LDKFundingSigned this_obj_conv;
39572         this_obj_conv.inner = untag_ptr(this_obj);
39573         this_obj_conv.is_owned = ptr_is_owned(this_obj);
39574         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
39575         FundingSigned_free(this_obj_conv);
39576 }
39577
39578 int8_tArray  __attribute__((export_name("TS_FundingSigned_get_channel_id"))) TS_FundingSigned_get_channel_id(uint64_t this_ptr) {
39579         LDKFundingSigned this_ptr_conv;
39580         this_ptr_conv.inner = untag_ptr(this_ptr);
39581         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
39582         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
39583         this_ptr_conv.is_owned = false;
39584         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
39585         memcpy(ret_arr->elems, *FundingSigned_get_channel_id(&this_ptr_conv), 32);
39586         return ret_arr;
39587 }
39588
39589 void  __attribute__((export_name("TS_FundingSigned_set_channel_id"))) TS_FundingSigned_set_channel_id(uint64_t this_ptr, int8_tArray val) {
39590         LDKFundingSigned this_ptr_conv;
39591         this_ptr_conv.inner = untag_ptr(this_ptr);
39592         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
39593         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
39594         this_ptr_conv.is_owned = false;
39595         LDKThirtyTwoBytes val_ref;
39596         CHECK(val->arr_len == 32);
39597         memcpy(val_ref.data, val->elems, 32); FREE(val);
39598         FundingSigned_set_channel_id(&this_ptr_conv, val_ref);
39599 }
39600
39601 int8_tArray  __attribute__((export_name("TS_FundingSigned_get_signature"))) TS_FundingSigned_get_signature(uint64_t this_ptr) {
39602         LDKFundingSigned this_ptr_conv;
39603         this_ptr_conv.inner = untag_ptr(this_ptr);
39604         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
39605         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
39606         this_ptr_conv.is_owned = false;
39607         int8_tArray ret_arr = init_int8_tArray(64, __LINE__);
39608         memcpy(ret_arr->elems, FundingSigned_get_signature(&this_ptr_conv).compact_form, 64);
39609         return ret_arr;
39610 }
39611
39612 void  __attribute__((export_name("TS_FundingSigned_set_signature"))) TS_FundingSigned_set_signature(uint64_t this_ptr, int8_tArray val) {
39613         LDKFundingSigned this_ptr_conv;
39614         this_ptr_conv.inner = untag_ptr(this_ptr);
39615         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
39616         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
39617         this_ptr_conv.is_owned = false;
39618         LDKECDSASignature val_ref;
39619         CHECK(val->arr_len == 64);
39620         memcpy(val_ref.compact_form, val->elems, 64); FREE(val);
39621         FundingSigned_set_signature(&this_ptr_conv, val_ref);
39622 }
39623
39624 uint64_t  __attribute__((export_name("TS_FundingSigned_new"))) TS_FundingSigned_new(int8_tArray channel_id_arg, int8_tArray signature_arg) {
39625         LDKThirtyTwoBytes channel_id_arg_ref;
39626         CHECK(channel_id_arg->arr_len == 32);
39627         memcpy(channel_id_arg_ref.data, channel_id_arg->elems, 32); FREE(channel_id_arg);
39628         LDKECDSASignature signature_arg_ref;
39629         CHECK(signature_arg->arr_len == 64);
39630         memcpy(signature_arg_ref.compact_form, signature_arg->elems, 64); FREE(signature_arg);
39631         LDKFundingSigned ret_var = FundingSigned_new(channel_id_arg_ref, signature_arg_ref);
39632         uint64_t ret_ref = 0;
39633         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
39634         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
39635         return ret_ref;
39636 }
39637
39638 static inline uint64_t FundingSigned_clone_ptr(LDKFundingSigned *NONNULL_PTR arg) {
39639         LDKFundingSigned ret_var = FundingSigned_clone(arg);
39640         uint64_t ret_ref = 0;
39641         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
39642         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
39643         return ret_ref;
39644 }
39645 int64_t  __attribute__((export_name("TS_FundingSigned_clone_ptr"))) TS_FundingSigned_clone_ptr(uint64_t arg) {
39646         LDKFundingSigned arg_conv;
39647         arg_conv.inner = untag_ptr(arg);
39648         arg_conv.is_owned = ptr_is_owned(arg);
39649         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
39650         arg_conv.is_owned = false;
39651         int64_t ret_conv = FundingSigned_clone_ptr(&arg_conv);
39652         return ret_conv;
39653 }
39654
39655 uint64_t  __attribute__((export_name("TS_FundingSigned_clone"))) TS_FundingSigned_clone(uint64_t orig) {
39656         LDKFundingSigned orig_conv;
39657         orig_conv.inner = untag_ptr(orig);
39658         orig_conv.is_owned = ptr_is_owned(orig);
39659         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
39660         orig_conv.is_owned = false;
39661         LDKFundingSigned ret_var = FundingSigned_clone(&orig_conv);
39662         uint64_t ret_ref = 0;
39663         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
39664         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
39665         return ret_ref;
39666 }
39667
39668 jboolean  __attribute__((export_name("TS_FundingSigned_eq"))) TS_FundingSigned_eq(uint64_t a, uint64_t b) {
39669         LDKFundingSigned a_conv;
39670         a_conv.inner = untag_ptr(a);
39671         a_conv.is_owned = ptr_is_owned(a);
39672         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
39673         a_conv.is_owned = false;
39674         LDKFundingSigned b_conv;
39675         b_conv.inner = untag_ptr(b);
39676         b_conv.is_owned = ptr_is_owned(b);
39677         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
39678         b_conv.is_owned = false;
39679         jboolean ret_conv = FundingSigned_eq(&a_conv, &b_conv);
39680         return ret_conv;
39681 }
39682
39683 void  __attribute__((export_name("TS_ChannelReady_free"))) TS_ChannelReady_free(uint64_t this_obj) {
39684         LDKChannelReady this_obj_conv;
39685         this_obj_conv.inner = untag_ptr(this_obj);
39686         this_obj_conv.is_owned = ptr_is_owned(this_obj);
39687         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
39688         ChannelReady_free(this_obj_conv);
39689 }
39690
39691 int8_tArray  __attribute__((export_name("TS_ChannelReady_get_channel_id"))) TS_ChannelReady_get_channel_id(uint64_t this_ptr) {
39692         LDKChannelReady this_ptr_conv;
39693         this_ptr_conv.inner = untag_ptr(this_ptr);
39694         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
39695         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
39696         this_ptr_conv.is_owned = false;
39697         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
39698         memcpy(ret_arr->elems, *ChannelReady_get_channel_id(&this_ptr_conv), 32);
39699         return ret_arr;
39700 }
39701
39702 void  __attribute__((export_name("TS_ChannelReady_set_channel_id"))) TS_ChannelReady_set_channel_id(uint64_t this_ptr, int8_tArray val) {
39703         LDKChannelReady this_ptr_conv;
39704         this_ptr_conv.inner = untag_ptr(this_ptr);
39705         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
39706         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
39707         this_ptr_conv.is_owned = false;
39708         LDKThirtyTwoBytes val_ref;
39709         CHECK(val->arr_len == 32);
39710         memcpy(val_ref.data, val->elems, 32); FREE(val);
39711         ChannelReady_set_channel_id(&this_ptr_conv, val_ref);
39712 }
39713
39714 int8_tArray  __attribute__((export_name("TS_ChannelReady_get_next_per_commitment_point"))) TS_ChannelReady_get_next_per_commitment_point(uint64_t this_ptr) {
39715         LDKChannelReady this_ptr_conv;
39716         this_ptr_conv.inner = untag_ptr(this_ptr);
39717         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
39718         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
39719         this_ptr_conv.is_owned = false;
39720         int8_tArray ret_arr = init_int8_tArray(33, __LINE__);
39721         memcpy(ret_arr->elems, ChannelReady_get_next_per_commitment_point(&this_ptr_conv).compressed_form, 33);
39722         return ret_arr;
39723 }
39724
39725 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) {
39726         LDKChannelReady this_ptr_conv;
39727         this_ptr_conv.inner = untag_ptr(this_ptr);
39728         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
39729         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
39730         this_ptr_conv.is_owned = false;
39731         LDKPublicKey val_ref;
39732         CHECK(val->arr_len == 33);
39733         memcpy(val_ref.compressed_form, val->elems, 33); FREE(val);
39734         ChannelReady_set_next_per_commitment_point(&this_ptr_conv, val_ref);
39735 }
39736
39737 uint64_t  __attribute__((export_name("TS_ChannelReady_get_short_channel_id_alias"))) TS_ChannelReady_get_short_channel_id_alias(uint64_t this_ptr) {
39738         LDKChannelReady this_ptr_conv;
39739         this_ptr_conv.inner = untag_ptr(this_ptr);
39740         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
39741         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
39742         this_ptr_conv.is_owned = false;
39743         LDKCOption_u64Z *ret_copy = MALLOC(sizeof(LDKCOption_u64Z), "LDKCOption_u64Z");
39744         *ret_copy = ChannelReady_get_short_channel_id_alias(&this_ptr_conv);
39745         uint64_t ret_ref = tag_ptr(ret_copy, true);
39746         return ret_ref;
39747 }
39748
39749 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) {
39750         LDKChannelReady this_ptr_conv;
39751         this_ptr_conv.inner = untag_ptr(this_ptr);
39752         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
39753         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
39754         this_ptr_conv.is_owned = false;
39755         void* val_ptr = untag_ptr(val);
39756         CHECK_ACCESS(val_ptr);
39757         LDKCOption_u64Z val_conv = *(LDKCOption_u64Z*)(val_ptr);
39758         val_conv = COption_u64Z_clone((LDKCOption_u64Z*)untag_ptr(val));
39759         ChannelReady_set_short_channel_id_alias(&this_ptr_conv, val_conv);
39760 }
39761
39762 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) {
39763         LDKThirtyTwoBytes channel_id_arg_ref;
39764         CHECK(channel_id_arg->arr_len == 32);
39765         memcpy(channel_id_arg_ref.data, channel_id_arg->elems, 32); FREE(channel_id_arg);
39766         LDKPublicKey next_per_commitment_point_arg_ref;
39767         CHECK(next_per_commitment_point_arg->arr_len == 33);
39768         memcpy(next_per_commitment_point_arg_ref.compressed_form, next_per_commitment_point_arg->elems, 33); FREE(next_per_commitment_point_arg);
39769         void* short_channel_id_alias_arg_ptr = untag_ptr(short_channel_id_alias_arg);
39770         CHECK_ACCESS(short_channel_id_alias_arg_ptr);
39771         LDKCOption_u64Z short_channel_id_alias_arg_conv = *(LDKCOption_u64Z*)(short_channel_id_alias_arg_ptr);
39772         short_channel_id_alias_arg_conv = COption_u64Z_clone((LDKCOption_u64Z*)untag_ptr(short_channel_id_alias_arg));
39773         LDKChannelReady ret_var = ChannelReady_new(channel_id_arg_ref, next_per_commitment_point_arg_ref, short_channel_id_alias_arg_conv);
39774         uint64_t ret_ref = 0;
39775         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
39776         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
39777         return ret_ref;
39778 }
39779
39780 static inline uint64_t ChannelReady_clone_ptr(LDKChannelReady *NONNULL_PTR arg) {
39781         LDKChannelReady ret_var = ChannelReady_clone(arg);
39782         uint64_t ret_ref = 0;
39783         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
39784         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
39785         return ret_ref;
39786 }
39787 int64_t  __attribute__((export_name("TS_ChannelReady_clone_ptr"))) TS_ChannelReady_clone_ptr(uint64_t arg) {
39788         LDKChannelReady arg_conv;
39789         arg_conv.inner = untag_ptr(arg);
39790         arg_conv.is_owned = ptr_is_owned(arg);
39791         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
39792         arg_conv.is_owned = false;
39793         int64_t ret_conv = ChannelReady_clone_ptr(&arg_conv);
39794         return ret_conv;
39795 }
39796
39797 uint64_t  __attribute__((export_name("TS_ChannelReady_clone"))) TS_ChannelReady_clone(uint64_t orig) {
39798         LDKChannelReady orig_conv;
39799         orig_conv.inner = untag_ptr(orig);
39800         orig_conv.is_owned = ptr_is_owned(orig);
39801         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
39802         orig_conv.is_owned = false;
39803         LDKChannelReady ret_var = ChannelReady_clone(&orig_conv);
39804         uint64_t ret_ref = 0;
39805         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
39806         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
39807         return ret_ref;
39808 }
39809
39810 jboolean  __attribute__((export_name("TS_ChannelReady_eq"))) TS_ChannelReady_eq(uint64_t a, uint64_t b) {
39811         LDKChannelReady a_conv;
39812         a_conv.inner = untag_ptr(a);
39813         a_conv.is_owned = ptr_is_owned(a);
39814         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
39815         a_conv.is_owned = false;
39816         LDKChannelReady b_conv;
39817         b_conv.inner = untag_ptr(b);
39818         b_conv.is_owned = ptr_is_owned(b);
39819         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
39820         b_conv.is_owned = false;
39821         jboolean ret_conv = ChannelReady_eq(&a_conv, &b_conv);
39822         return ret_conv;
39823 }
39824
39825 void  __attribute__((export_name("TS_TxAddInput_free"))) TS_TxAddInput_free(uint64_t this_obj) {
39826         LDKTxAddInput this_obj_conv;
39827         this_obj_conv.inner = untag_ptr(this_obj);
39828         this_obj_conv.is_owned = ptr_is_owned(this_obj);
39829         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
39830         TxAddInput_free(this_obj_conv);
39831 }
39832
39833 int8_tArray  __attribute__((export_name("TS_TxAddInput_get_channel_id"))) TS_TxAddInput_get_channel_id(uint64_t this_ptr) {
39834         LDKTxAddInput this_ptr_conv;
39835         this_ptr_conv.inner = untag_ptr(this_ptr);
39836         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
39837         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
39838         this_ptr_conv.is_owned = false;
39839         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
39840         memcpy(ret_arr->elems, *TxAddInput_get_channel_id(&this_ptr_conv), 32);
39841         return ret_arr;
39842 }
39843
39844 void  __attribute__((export_name("TS_TxAddInput_set_channel_id"))) TS_TxAddInput_set_channel_id(uint64_t this_ptr, int8_tArray val) {
39845         LDKTxAddInput this_ptr_conv;
39846         this_ptr_conv.inner = untag_ptr(this_ptr);
39847         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
39848         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
39849         this_ptr_conv.is_owned = false;
39850         LDKThirtyTwoBytes val_ref;
39851         CHECK(val->arr_len == 32);
39852         memcpy(val_ref.data, val->elems, 32); FREE(val);
39853         TxAddInput_set_channel_id(&this_ptr_conv, val_ref);
39854 }
39855
39856 int64_t  __attribute__((export_name("TS_TxAddInput_get_serial_id"))) TS_TxAddInput_get_serial_id(uint64_t this_ptr) {
39857         LDKTxAddInput this_ptr_conv;
39858         this_ptr_conv.inner = untag_ptr(this_ptr);
39859         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
39860         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
39861         this_ptr_conv.is_owned = false;
39862         int64_t ret_conv = TxAddInput_get_serial_id(&this_ptr_conv);
39863         return ret_conv;
39864 }
39865
39866 void  __attribute__((export_name("TS_TxAddInput_set_serial_id"))) TS_TxAddInput_set_serial_id(uint64_t this_ptr, int64_t val) {
39867         LDKTxAddInput this_ptr_conv;
39868         this_ptr_conv.inner = untag_ptr(this_ptr);
39869         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
39870         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
39871         this_ptr_conv.is_owned = false;
39872         TxAddInput_set_serial_id(&this_ptr_conv, val);
39873 }
39874
39875 uint64_t  __attribute__((export_name("TS_TxAddInput_get_prevtx"))) TS_TxAddInput_get_prevtx(uint64_t this_ptr) {
39876         LDKTxAddInput this_ptr_conv;
39877         this_ptr_conv.inner = untag_ptr(this_ptr);
39878         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
39879         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
39880         this_ptr_conv.is_owned = false;
39881         LDKTransactionU16LenLimited ret_var = TxAddInput_get_prevtx(&this_ptr_conv);
39882         uint64_t ret_ref = 0;
39883         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
39884         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
39885         return ret_ref;
39886 }
39887
39888 void  __attribute__((export_name("TS_TxAddInput_set_prevtx"))) TS_TxAddInput_set_prevtx(uint64_t this_ptr, uint64_t val) {
39889         LDKTxAddInput this_ptr_conv;
39890         this_ptr_conv.inner = untag_ptr(this_ptr);
39891         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
39892         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
39893         this_ptr_conv.is_owned = false;
39894         LDKTransactionU16LenLimited val_conv;
39895         val_conv.inner = untag_ptr(val);
39896         val_conv.is_owned = ptr_is_owned(val);
39897         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
39898         val_conv = TransactionU16LenLimited_clone(&val_conv);
39899         TxAddInput_set_prevtx(&this_ptr_conv, val_conv);
39900 }
39901
39902 int32_t  __attribute__((export_name("TS_TxAddInput_get_prevtx_out"))) TS_TxAddInput_get_prevtx_out(uint64_t this_ptr) {
39903         LDKTxAddInput this_ptr_conv;
39904         this_ptr_conv.inner = untag_ptr(this_ptr);
39905         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
39906         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
39907         this_ptr_conv.is_owned = false;
39908         int32_t ret_conv = TxAddInput_get_prevtx_out(&this_ptr_conv);
39909         return ret_conv;
39910 }
39911
39912 void  __attribute__((export_name("TS_TxAddInput_set_prevtx_out"))) TS_TxAddInput_set_prevtx_out(uint64_t this_ptr, int32_t val) {
39913         LDKTxAddInput this_ptr_conv;
39914         this_ptr_conv.inner = untag_ptr(this_ptr);
39915         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
39916         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
39917         this_ptr_conv.is_owned = false;
39918         TxAddInput_set_prevtx_out(&this_ptr_conv, val);
39919 }
39920
39921 int32_t  __attribute__((export_name("TS_TxAddInput_get_sequence"))) TS_TxAddInput_get_sequence(uint64_t this_ptr) {
39922         LDKTxAddInput this_ptr_conv;
39923         this_ptr_conv.inner = untag_ptr(this_ptr);
39924         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
39925         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
39926         this_ptr_conv.is_owned = false;
39927         int32_t ret_conv = TxAddInput_get_sequence(&this_ptr_conv);
39928         return ret_conv;
39929 }
39930
39931 void  __attribute__((export_name("TS_TxAddInput_set_sequence"))) TS_TxAddInput_set_sequence(uint64_t this_ptr, int32_t val) {
39932         LDKTxAddInput this_ptr_conv;
39933         this_ptr_conv.inner = untag_ptr(this_ptr);
39934         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
39935         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
39936         this_ptr_conv.is_owned = false;
39937         TxAddInput_set_sequence(&this_ptr_conv, val);
39938 }
39939
39940 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) {
39941         LDKThirtyTwoBytes channel_id_arg_ref;
39942         CHECK(channel_id_arg->arr_len == 32);
39943         memcpy(channel_id_arg_ref.data, channel_id_arg->elems, 32); FREE(channel_id_arg);
39944         LDKTransactionU16LenLimited prevtx_arg_conv;
39945         prevtx_arg_conv.inner = untag_ptr(prevtx_arg);
39946         prevtx_arg_conv.is_owned = ptr_is_owned(prevtx_arg);
39947         CHECK_INNER_FIELD_ACCESS_OR_NULL(prevtx_arg_conv);
39948         prevtx_arg_conv = TransactionU16LenLimited_clone(&prevtx_arg_conv);
39949         LDKTxAddInput ret_var = TxAddInput_new(channel_id_arg_ref, serial_id_arg, prevtx_arg_conv, prevtx_out_arg, sequence_arg);
39950         uint64_t ret_ref = 0;
39951         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
39952         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
39953         return ret_ref;
39954 }
39955
39956 static inline uint64_t TxAddInput_clone_ptr(LDKTxAddInput *NONNULL_PTR arg) {
39957         LDKTxAddInput ret_var = TxAddInput_clone(arg);
39958         uint64_t ret_ref = 0;
39959         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
39960         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
39961         return ret_ref;
39962 }
39963 int64_t  __attribute__((export_name("TS_TxAddInput_clone_ptr"))) TS_TxAddInput_clone_ptr(uint64_t arg) {
39964         LDKTxAddInput arg_conv;
39965         arg_conv.inner = untag_ptr(arg);
39966         arg_conv.is_owned = ptr_is_owned(arg);
39967         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
39968         arg_conv.is_owned = false;
39969         int64_t ret_conv = TxAddInput_clone_ptr(&arg_conv);
39970         return ret_conv;
39971 }
39972
39973 uint64_t  __attribute__((export_name("TS_TxAddInput_clone"))) TS_TxAddInput_clone(uint64_t orig) {
39974         LDKTxAddInput orig_conv;
39975         orig_conv.inner = untag_ptr(orig);
39976         orig_conv.is_owned = ptr_is_owned(orig);
39977         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
39978         orig_conv.is_owned = false;
39979         LDKTxAddInput ret_var = TxAddInput_clone(&orig_conv);
39980         uint64_t ret_ref = 0;
39981         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
39982         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
39983         return ret_ref;
39984 }
39985
39986 jboolean  __attribute__((export_name("TS_TxAddInput_eq"))) TS_TxAddInput_eq(uint64_t a, uint64_t b) {
39987         LDKTxAddInput a_conv;
39988         a_conv.inner = untag_ptr(a);
39989         a_conv.is_owned = ptr_is_owned(a);
39990         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
39991         a_conv.is_owned = false;
39992         LDKTxAddInput b_conv;
39993         b_conv.inner = untag_ptr(b);
39994         b_conv.is_owned = ptr_is_owned(b);
39995         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
39996         b_conv.is_owned = false;
39997         jboolean ret_conv = TxAddInput_eq(&a_conv, &b_conv);
39998         return ret_conv;
39999 }
40000
40001 void  __attribute__((export_name("TS_TxAddOutput_free"))) TS_TxAddOutput_free(uint64_t this_obj) {
40002         LDKTxAddOutput this_obj_conv;
40003         this_obj_conv.inner = untag_ptr(this_obj);
40004         this_obj_conv.is_owned = ptr_is_owned(this_obj);
40005         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
40006         TxAddOutput_free(this_obj_conv);
40007 }
40008
40009 int8_tArray  __attribute__((export_name("TS_TxAddOutput_get_channel_id"))) TS_TxAddOutput_get_channel_id(uint64_t this_ptr) {
40010         LDKTxAddOutput this_ptr_conv;
40011         this_ptr_conv.inner = untag_ptr(this_ptr);
40012         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
40013         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
40014         this_ptr_conv.is_owned = false;
40015         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
40016         memcpy(ret_arr->elems, *TxAddOutput_get_channel_id(&this_ptr_conv), 32);
40017         return ret_arr;
40018 }
40019
40020 void  __attribute__((export_name("TS_TxAddOutput_set_channel_id"))) TS_TxAddOutput_set_channel_id(uint64_t this_ptr, int8_tArray val) {
40021         LDKTxAddOutput this_ptr_conv;
40022         this_ptr_conv.inner = untag_ptr(this_ptr);
40023         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
40024         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
40025         this_ptr_conv.is_owned = false;
40026         LDKThirtyTwoBytes val_ref;
40027         CHECK(val->arr_len == 32);
40028         memcpy(val_ref.data, val->elems, 32); FREE(val);
40029         TxAddOutput_set_channel_id(&this_ptr_conv, val_ref);
40030 }
40031
40032 int64_t  __attribute__((export_name("TS_TxAddOutput_get_serial_id"))) TS_TxAddOutput_get_serial_id(uint64_t this_ptr) {
40033         LDKTxAddOutput this_ptr_conv;
40034         this_ptr_conv.inner = untag_ptr(this_ptr);
40035         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
40036         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
40037         this_ptr_conv.is_owned = false;
40038         int64_t ret_conv = TxAddOutput_get_serial_id(&this_ptr_conv);
40039         return ret_conv;
40040 }
40041
40042 void  __attribute__((export_name("TS_TxAddOutput_set_serial_id"))) TS_TxAddOutput_set_serial_id(uint64_t this_ptr, int64_t val) {
40043         LDKTxAddOutput this_ptr_conv;
40044         this_ptr_conv.inner = untag_ptr(this_ptr);
40045         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
40046         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
40047         this_ptr_conv.is_owned = false;
40048         TxAddOutput_set_serial_id(&this_ptr_conv, val);
40049 }
40050
40051 int64_t  __attribute__((export_name("TS_TxAddOutput_get_sats"))) TS_TxAddOutput_get_sats(uint64_t this_ptr) {
40052         LDKTxAddOutput this_ptr_conv;
40053         this_ptr_conv.inner = untag_ptr(this_ptr);
40054         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
40055         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
40056         this_ptr_conv.is_owned = false;
40057         int64_t ret_conv = TxAddOutput_get_sats(&this_ptr_conv);
40058         return ret_conv;
40059 }
40060
40061 void  __attribute__((export_name("TS_TxAddOutput_set_sats"))) TS_TxAddOutput_set_sats(uint64_t this_ptr, int64_t val) {
40062         LDKTxAddOutput this_ptr_conv;
40063         this_ptr_conv.inner = untag_ptr(this_ptr);
40064         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
40065         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
40066         this_ptr_conv.is_owned = false;
40067         TxAddOutput_set_sats(&this_ptr_conv, val);
40068 }
40069
40070 int8_tArray  __attribute__((export_name("TS_TxAddOutput_get_script"))) TS_TxAddOutput_get_script(uint64_t this_ptr) {
40071         LDKTxAddOutput this_ptr_conv;
40072         this_ptr_conv.inner = untag_ptr(this_ptr);
40073         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
40074         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
40075         this_ptr_conv.is_owned = false;
40076         LDKu8slice ret_var = TxAddOutput_get_script(&this_ptr_conv);
40077         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
40078         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
40079         return ret_arr;
40080 }
40081
40082 void  __attribute__((export_name("TS_TxAddOutput_set_script"))) TS_TxAddOutput_set_script(uint64_t this_ptr, int8_tArray val) {
40083         LDKTxAddOutput this_ptr_conv;
40084         this_ptr_conv.inner = untag_ptr(this_ptr);
40085         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
40086         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
40087         this_ptr_conv.is_owned = false;
40088         LDKCVec_u8Z val_ref;
40089         val_ref.datalen = val->arr_len;
40090         val_ref.data = MALLOC(val_ref.datalen, "LDKCVec_u8Z Bytes");
40091         memcpy(val_ref.data, val->elems, val_ref.datalen); FREE(val);
40092         TxAddOutput_set_script(&this_ptr_conv, val_ref);
40093 }
40094
40095 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) {
40096         LDKThirtyTwoBytes channel_id_arg_ref;
40097         CHECK(channel_id_arg->arr_len == 32);
40098         memcpy(channel_id_arg_ref.data, channel_id_arg->elems, 32); FREE(channel_id_arg);
40099         LDKCVec_u8Z script_arg_ref;
40100         script_arg_ref.datalen = script_arg->arr_len;
40101         script_arg_ref.data = MALLOC(script_arg_ref.datalen, "LDKCVec_u8Z Bytes");
40102         memcpy(script_arg_ref.data, script_arg->elems, script_arg_ref.datalen); FREE(script_arg);
40103         LDKTxAddOutput ret_var = TxAddOutput_new(channel_id_arg_ref, serial_id_arg, sats_arg, script_arg_ref);
40104         uint64_t ret_ref = 0;
40105         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
40106         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
40107         return ret_ref;
40108 }
40109
40110 static inline uint64_t TxAddOutput_clone_ptr(LDKTxAddOutput *NONNULL_PTR arg) {
40111         LDKTxAddOutput ret_var = TxAddOutput_clone(arg);
40112         uint64_t ret_ref = 0;
40113         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
40114         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
40115         return ret_ref;
40116 }
40117 int64_t  __attribute__((export_name("TS_TxAddOutput_clone_ptr"))) TS_TxAddOutput_clone_ptr(uint64_t arg) {
40118         LDKTxAddOutput arg_conv;
40119         arg_conv.inner = untag_ptr(arg);
40120         arg_conv.is_owned = ptr_is_owned(arg);
40121         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
40122         arg_conv.is_owned = false;
40123         int64_t ret_conv = TxAddOutput_clone_ptr(&arg_conv);
40124         return ret_conv;
40125 }
40126
40127 uint64_t  __attribute__((export_name("TS_TxAddOutput_clone"))) TS_TxAddOutput_clone(uint64_t orig) {
40128         LDKTxAddOutput orig_conv;
40129         orig_conv.inner = untag_ptr(orig);
40130         orig_conv.is_owned = ptr_is_owned(orig);
40131         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
40132         orig_conv.is_owned = false;
40133         LDKTxAddOutput ret_var = TxAddOutput_clone(&orig_conv);
40134         uint64_t ret_ref = 0;
40135         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
40136         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
40137         return ret_ref;
40138 }
40139
40140 jboolean  __attribute__((export_name("TS_TxAddOutput_eq"))) TS_TxAddOutput_eq(uint64_t a, uint64_t b) {
40141         LDKTxAddOutput a_conv;
40142         a_conv.inner = untag_ptr(a);
40143         a_conv.is_owned = ptr_is_owned(a);
40144         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
40145         a_conv.is_owned = false;
40146         LDKTxAddOutput b_conv;
40147         b_conv.inner = untag_ptr(b);
40148         b_conv.is_owned = ptr_is_owned(b);
40149         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
40150         b_conv.is_owned = false;
40151         jboolean ret_conv = TxAddOutput_eq(&a_conv, &b_conv);
40152         return ret_conv;
40153 }
40154
40155 void  __attribute__((export_name("TS_TxRemoveInput_free"))) TS_TxRemoveInput_free(uint64_t this_obj) {
40156         LDKTxRemoveInput this_obj_conv;
40157         this_obj_conv.inner = untag_ptr(this_obj);
40158         this_obj_conv.is_owned = ptr_is_owned(this_obj);
40159         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
40160         TxRemoveInput_free(this_obj_conv);
40161 }
40162
40163 int8_tArray  __attribute__((export_name("TS_TxRemoveInput_get_channel_id"))) TS_TxRemoveInput_get_channel_id(uint64_t this_ptr) {
40164         LDKTxRemoveInput this_ptr_conv;
40165         this_ptr_conv.inner = untag_ptr(this_ptr);
40166         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
40167         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
40168         this_ptr_conv.is_owned = false;
40169         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
40170         memcpy(ret_arr->elems, *TxRemoveInput_get_channel_id(&this_ptr_conv), 32);
40171         return ret_arr;
40172 }
40173
40174 void  __attribute__((export_name("TS_TxRemoveInput_set_channel_id"))) TS_TxRemoveInput_set_channel_id(uint64_t this_ptr, int8_tArray val) {
40175         LDKTxRemoveInput this_ptr_conv;
40176         this_ptr_conv.inner = untag_ptr(this_ptr);
40177         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
40178         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
40179         this_ptr_conv.is_owned = false;
40180         LDKThirtyTwoBytes val_ref;
40181         CHECK(val->arr_len == 32);
40182         memcpy(val_ref.data, val->elems, 32); FREE(val);
40183         TxRemoveInput_set_channel_id(&this_ptr_conv, val_ref);
40184 }
40185
40186 int64_t  __attribute__((export_name("TS_TxRemoveInput_get_serial_id"))) TS_TxRemoveInput_get_serial_id(uint64_t this_ptr) {
40187         LDKTxRemoveInput this_ptr_conv;
40188         this_ptr_conv.inner = untag_ptr(this_ptr);
40189         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
40190         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
40191         this_ptr_conv.is_owned = false;
40192         int64_t ret_conv = TxRemoveInput_get_serial_id(&this_ptr_conv);
40193         return ret_conv;
40194 }
40195
40196 void  __attribute__((export_name("TS_TxRemoveInput_set_serial_id"))) TS_TxRemoveInput_set_serial_id(uint64_t this_ptr, int64_t val) {
40197         LDKTxRemoveInput this_ptr_conv;
40198         this_ptr_conv.inner = untag_ptr(this_ptr);
40199         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
40200         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
40201         this_ptr_conv.is_owned = false;
40202         TxRemoveInput_set_serial_id(&this_ptr_conv, val);
40203 }
40204
40205 uint64_t  __attribute__((export_name("TS_TxRemoveInput_new"))) TS_TxRemoveInput_new(int8_tArray channel_id_arg, int64_t serial_id_arg) {
40206         LDKThirtyTwoBytes channel_id_arg_ref;
40207         CHECK(channel_id_arg->arr_len == 32);
40208         memcpy(channel_id_arg_ref.data, channel_id_arg->elems, 32); FREE(channel_id_arg);
40209         LDKTxRemoveInput ret_var = TxRemoveInput_new(channel_id_arg_ref, serial_id_arg);
40210         uint64_t ret_ref = 0;
40211         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
40212         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
40213         return ret_ref;
40214 }
40215
40216 static inline uint64_t TxRemoveInput_clone_ptr(LDKTxRemoveInput *NONNULL_PTR arg) {
40217         LDKTxRemoveInput ret_var = TxRemoveInput_clone(arg);
40218         uint64_t ret_ref = 0;
40219         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
40220         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
40221         return ret_ref;
40222 }
40223 int64_t  __attribute__((export_name("TS_TxRemoveInput_clone_ptr"))) TS_TxRemoveInput_clone_ptr(uint64_t arg) {
40224         LDKTxRemoveInput arg_conv;
40225         arg_conv.inner = untag_ptr(arg);
40226         arg_conv.is_owned = ptr_is_owned(arg);
40227         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
40228         arg_conv.is_owned = false;
40229         int64_t ret_conv = TxRemoveInput_clone_ptr(&arg_conv);
40230         return ret_conv;
40231 }
40232
40233 uint64_t  __attribute__((export_name("TS_TxRemoveInput_clone"))) TS_TxRemoveInput_clone(uint64_t orig) {
40234         LDKTxRemoveInput orig_conv;
40235         orig_conv.inner = untag_ptr(orig);
40236         orig_conv.is_owned = ptr_is_owned(orig);
40237         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
40238         orig_conv.is_owned = false;
40239         LDKTxRemoveInput ret_var = TxRemoveInput_clone(&orig_conv);
40240         uint64_t ret_ref = 0;
40241         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
40242         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
40243         return ret_ref;
40244 }
40245
40246 jboolean  __attribute__((export_name("TS_TxRemoveInput_eq"))) TS_TxRemoveInput_eq(uint64_t a, uint64_t b) {
40247         LDKTxRemoveInput a_conv;
40248         a_conv.inner = untag_ptr(a);
40249         a_conv.is_owned = ptr_is_owned(a);
40250         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
40251         a_conv.is_owned = false;
40252         LDKTxRemoveInput b_conv;
40253         b_conv.inner = untag_ptr(b);
40254         b_conv.is_owned = ptr_is_owned(b);
40255         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
40256         b_conv.is_owned = false;
40257         jboolean ret_conv = TxRemoveInput_eq(&a_conv, &b_conv);
40258         return ret_conv;
40259 }
40260
40261 void  __attribute__((export_name("TS_TxRemoveOutput_free"))) TS_TxRemoveOutput_free(uint64_t this_obj) {
40262         LDKTxRemoveOutput this_obj_conv;
40263         this_obj_conv.inner = untag_ptr(this_obj);
40264         this_obj_conv.is_owned = ptr_is_owned(this_obj);
40265         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
40266         TxRemoveOutput_free(this_obj_conv);
40267 }
40268
40269 int8_tArray  __attribute__((export_name("TS_TxRemoveOutput_get_channel_id"))) TS_TxRemoveOutput_get_channel_id(uint64_t this_ptr) {
40270         LDKTxRemoveOutput this_ptr_conv;
40271         this_ptr_conv.inner = untag_ptr(this_ptr);
40272         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
40273         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
40274         this_ptr_conv.is_owned = false;
40275         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
40276         memcpy(ret_arr->elems, *TxRemoveOutput_get_channel_id(&this_ptr_conv), 32);
40277         return ret_arr;
40278 }
40279
40280 void  __attribute__((export_name("TS_TxRemoveOutput_set_channel_id"))) TS_TxRemoveOutput_set_channel_id(uint64_t this_ptr, int8_tArray val) {
40281         LDKTxRemoveOutput this_ptr_conv;
40282         this_ptr_conv.inner = untag_ptr(this_ptr);
40283         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
40284         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
40285         this_ptr_conv.is_owned = false;
40286         LDKThirtyTwoBytes val_ref;
40287         CHECK(val->arr_len == 32);
40288         memcpy(val_ref.data, val->elems, 32); FREE(val);
40289         TxRemoveOutput_set_channel_id(&this_ptr_conv, val_ref);
40290 }
40291
40292 int64_t  __attribute__((export_name("TS_TxRemoveOutput_get_serial_id"))) TS_TxRemoveOutput_get_serial_id(uint64_t this_ptr) {
40293         LDKTxRemoveOutput this_ptr_conv;
40294         this_ptr_conv.inner = untag_ptr(this_ptr);
40295         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
40296         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
40297         this_ptr_conv.is_owned = false;
40298         int64_t ret_conv = TxRemoveOutput_get_serial_id(&this_ptr_conv);
40299         return ret_conv;
40300 }
40301
40302 void  __attribute__((export_name("TS_TxRemoveOutput_set_serial_id"))) TS_TxRemoveOutput_set_serial_id(uint64_t this_ptr, int64_t val) {
40303         LDKTxRemoveOutput this_ptr_conv;
40304         this_ptr_conv.inner = untag_ptr(this_ptr);
40305         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
40306         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
40307         this_ptr_conv.is_owned = false;
40308         TxRemoveOutput_set_serial_id(&this_ptr_conv, val);
40309 }
40310
40311 uint64_t  __attribute__((export_name("TS_TxRemoveOutput_new"))) TS_TxRemoveOutput_new(int8_tArray channel_id_arg, int64_t serial_id_arg) {
40312         LDKThirtyTwoBytes channel_id_arg_ref;
40313         CHECK(channel_id_arg->arr_len == 32);
40314         memcpy(channel_id_arg_ref.data, channel_id_arg->elems, 32); FREE(channel_id_arg);
40315         LDKTxRemoveOutput ret_var = TxRemoveOutput_new(channel_id_arg_ref, serial_id_arg);
40316         uint64_t ret_ref = 0;
40317         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
40318         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
40319         return ret_ref;
40320 }
40321
40322 static inline uint64_t TxRemoveOutput_clone_ptr(LDKTxRemoveOutput *NONNULL_PTR arg) {
40323         LDKTxRemoveOutput ret_var = TxRemoveOutput_clone(arg);
40324         uint64_t ret_ref = 0;
40325         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
40326         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
40327         return ret_ref;
40328 }
40329 int64_t  __attribute__((export_name("TS_TxRemoveOutput_clone_ptr"))) TS_TxRemoveOutput_clone_ptr(uint64_t arg) {
40330         LDKTxRemoveOutput arg_conv;
40331         arg_conv.inner = untag_ptr(arg);
40332         arg_conv.is_owned = ptr_is_owned(arg);
40333         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
40334         arg_conv.is_owned = false;
40335         int64_t ret_conv = TxRemoveOutput_clone_ptr(&arg_conv);
40336         return ret_conv;
40337 }
40338
40339 uint64_t  __attribute__((export_name("TS_TxRemoveOutput_clone"))) TS_TxRemoveOutput_clone(uint64_t orig) {
40340         LDKTxRemoveOutput orig_conv;
40341         orig_conv.inner = untag_ptr(orig);
40342         orig_conv.is_owned = ptr_is_owned(orig);
40343         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
40344         orig_conv.is_owned = false;
40345         LDKTxRemoveOutput ret_var = TxRemoveOutput_clone(&orig_conv);
40346         uint64_t ret_ref = 0;
40347         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
40348         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
40349         return ret_ref;
40350 }
40351
40352 jboolean  __attribute__((export_name("TS_TxRemoveOutput_eq"))) TS_TxRemoveOutput_eq(uint64_t a, uint64_t b) {
40353         LDKTxRemoveOutput a_conv;
40354         a_conv.inner = untag_ptr(a);
40355         a_conv.is_owned = ptr_is_owned(a);
40356         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
40357         a_conv.is_owned = false;
40358         LDKTxRemoveOutput b_conv;
40359         b_conv.inner = untag_ptr(b);
40360         b_conv.is_owned = ptr_is_owned(b);
40361         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
40362         b_conv.is_owned = false;
40363         jboolean ret_conv = TxRemoveOutput_eq(&a_conv, &b_conv);
40364         return ret_conv;
40365 }
40366
40367 void  __attribute__((export_name("TS_TxComplete_free"))) TS_TxComplete_free(uint64_t this_obj) {
40368         LDKTxComplete this_obj_conv;
40369         this_obj_conv.inner = untag_ptr(this_obj);
40370         this_obj_conv.is_owned = ptr_is_owned(this_obj);
40371         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
40372         TxComplete_free(this_obj_conv);
40373 }
40374
40375 int8_tArray  __attribute__((export_name("TS_TxComplete_get_channel_id"))) TS_TxComplete_get_channel_id(uint64_t this_ptr) {
40376         LDKTxComplete this_ptr_conv;
40377         this_ptr_conv.inner = untag_ptr(this_ptr);
40378         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
40379         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
40380         this_ptr_conv.is_owned = false;
40381         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
40382         memcpy(ret_arr->elems, *TxComplete_get_channel_id(&this_ptr_conv), 32);
40383         return ret_arr;
40384 }
40385
40386 void  __attribute__((export_name("TS_TxComplete_set_channel_id"))) TS_TxComplete_set_channel_id(uint64_t this_ptr, int8_tArray val) {
40387         LDKTxComplete this_ptr_conv;
40388         this_ptr_conv.inner = untag_ptr(this_ptr);
40389         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
40390         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
40391         this_ptr_conv.is_owned = false;
40392         LDKThirtyTwoBytes val_ref;
40393         CHECK(val->arr_len == 32);
40394         memcpy(val_ref.data, val->elems, 32); FREE(val);
40395         TxComplete_set_channel_id(&this_ptr_conv, val_ref);
40396 }
40397
40398 uint64_t  __attribute__((export_name("TS_TxComplete_new"))) TS_TxComplete_new(int8_tArray channel_id_arg) {
40399         LDKThirtyTwoBytes channel_id_arg_ref;
40400         CHECK(channel_id_arg->arr_len == 32);
40401         memcpy(channel_id_arg_ref.data, channel_id_arg->elems, 32); FREE(channel_id_arg);
40402         LDKTxComplete ret_var = TxComplete_new(channel_id_arg_ref);
40403         uint64_t ret_ref = 0;
40404         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
40405         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
40406         return ret_ref;
40407 }
40408
40409 static inline uint64_t TxComplete_clone_ptr(LDKTxComplete *NONNULL_PTR arg) {
40410         LDKTxComplete ret_var = TxComplete_clone(arg);
40411         uint64_t ret_ref = 0;
40412         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
40413         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
40414         return ret_ref;
40415 }
40416 int64_t  __attribute__((export_name("TS_TxComplete_clone_ptr"))) TS_TxComplete_clone_ptr(uint64_t arg) {
40417         LDKTxComplete arg_conv;
40418         arg_conv.inner = untag_ptr(arg);
40419         arg_conv.is_owned = ptr_is_owned(arg);
40420         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
40421         arg_conv.is_owned = false;
40422         int64_t ret_conv = TxComplete_clone_ptr(&arg_conv);
40423         return ret_conv;
40424 }
40425
40426 uint64_t  __attribute__((export_name("TS_TxComplete_clone"))) TS_TxComplete_clone(uint64_t orig) {
40427         LDKTxComplete orig_conv;
40428         orig_conv.inner = untag_ptr(orig);
40429         orig_conv.is_owned = ptr_is_owned(orig);
40430         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
40431         orig_conv.is_owned = false;
40432         LDKTxComplete ret_var = TxComplete_clone(&orig_conv);
40433         uint64_t ret_ref = 0;
40434         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
40435         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
40436         return ret_ref;
40437 }
40438
40439 jboolean  __attribute__((export_name("TS_TxComplete_eq"))) TS_TxComplete_eq(uint64_t a, uint64_t b) {
40440         LDKTxComplete a_conv;
40441         a_conv.inner = untag_ptr(a);
40442         a_conv.is_owned = ptr_is_owned(a);
40443         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
40444         a_conv.is_owned = false;
40445         LDKTxComplete b_conv;
40446         b_conv.inner = untag_ptr(b);
40447         b_conv.is_owned = ptr_is_owned(b);
40448         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
40449         b_conv.is_owned = false;
40450         jboolean ret_conv = TxComplete_eq(&a_conv, &b_conv);
40451         return ret_conv;
40452 }
40453
40454 void  __attribute__((export_name("TS_TxSignatures_free"))) TS_TxSignatures_free(uint64_t this_obj) {
40455         LDKTxSignatures this_obj_conv;
40456         this_obj_conv.inner = untag_ptr(this_obj);
40457         this_obj_conv.is_owned = ptr_is_owned(this_obj);
40458         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
40459         TxSignatures_free(this_obj_conv);
40460 }
40461
40462 int8_tArray  __attribute__((export_name("TS_TxSignatures_get_channel_id"))) TS_TxSignatures_get_channel_id(uint64_t this_ptr) {
40463         LDKTxSignatures this_ptr_conv;
40464         this_ptr_conv.inner = untag_ptr(this_ptr);
40465         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
40466         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
40467         this_ptr_conv.is_owned = false;
40468         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
40469         memcpy(ret_arr->elems, *TxSignatures_get_channel_id(&this_ptr_conv), 32);
40470         return ret_arr;
40471 }
40472
40473 void  __attribute__((export_name("TS_TxSignatures_set_channel_id"))) TS_TxSignatures_set_channel_id(uint64_t this_ptr, int8_tArray val) {
40474         LDKTxSignatures this_ptr_conv;
40475         this_ptr_conv.inner = untag_ptr(this_ptr);
40476         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
40477         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
40478         this_ptr_conv.is_owned = false;
40479         LDKThirtyTwoBytes val_ref;
40480         CHECK(val->arr_len == 32);
40481         memcpy(val_ref.data, val->elems, 32); FREE(val);
40482         TxSignatures_set_channel_id(&this_ptr_conv, val_ref);
40483 }
40484
40485 int8_tArray  __attribute__((export_name("TS_TxSignatures_get_tx_hash"))) TS_TxSignatures_get_tx_hash(uint64_t this_ptr) {
40486         LDKTxSignatures this_ptr_conv;
40487         this_ptr_conv.inner = untag_ptr(this_ptr);
40488         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
40489         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
40490         this_ptr_conv.is_owned = false;
40491         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
40492         memcpy(ret_arr->elems, *TxSignatures_get_tx_hash(&this_ptr_conv), 32);
40493         return ret_arr;
40494 }
40495
40496 void  __attribute__((export_name("TS_TxSignatures_set_tx_hash"))) TS_TxSignatures_set_tx_hash(uint64_t this_ptr, int8_tArray val) {
40497         LDKTxSignatures this_ptr_conv;
40498         this_ptr_conv.inner = untag_ptr(this_ptr);
40499         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
40500         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
40501         this_ptr_conv.is_owned = false;
40502         LDKThirtyTwoBytes val_ref;
40503         CHECK(val->arr_len == 32);
40504         memcpy(val_ref.data, val->elems, 32); FREE(val);
40505         TxSignatures_set_tx_hash(&this_ptr_conv, val_ref);
40506 }
40507
40508 ptrArray  __attribute__((export_name("TS_TxSignatures_get_witnesses"))) TS_TxSignatures_get_witnesses(uint64_t this_ptr) {
40509         LDKTxSignatures this_ptr_conv;
40510         this_ptr_conv.inner = untag_ptr(this_ptr);
40511         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
40512         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
40513         this_ptr_conv.is_owned = false;
40514         LDKCVec_WitnessZ ret_var = TxSignatures_get_witnesses(&this_ptr_conv);
40515         ptrArray ret_arr = NULL;
40516         ret_arr = init_ptrArray(ret_var.datalen, __LINE__);
40517         int8_tArray *ret_arr_ptr = (int8_tArray*)(((uint8_t*)ret_arr) + 8);
40518         for (size_t m = 0; m < ret_var.datalen; m++) {
40519                 LDKWitness ret_conv_12_var = ret_var.data[m];
40520                 int8_tArray ret_conv_12_arr = init_int8_tArray(ret_conv_12_var.datalen, __LINE__);
40521                 memcpy(ret_conv_12_arr->elems, ret_conv_12_var.data, ret_conv_12_var.datalen);
40522                 Witness_free(ret_conv_12_var);
40523                 ret_arr_ptr[m] = ret_conv_12_arr;
40524         }
40525         
40526         FREE(ret_var.data);
40527         return ret_arr;
40528 }
40529
40530 void  __attribute__((export_name("TS_TxSignatures_set_witnesses"))) TS_TxSignatures_set_witnesses(uint64_t this_ptr, ptrArray val) {
40531         LDKTxSignatures this_ptr_conv;
40532         this_ptr_conv.inner = untag_ptr(this_ptr);
40533         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
40534         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
40535         this_ptr_conv.is_owned = false;
40536         LDKCVec_WitnessZ val_constr;
40537         val_constr.datalen = val->arr_len;
40538         if (val_constr.datalen > 0)
40539                 val_constr.data = MALLOC(val_constr.datalen * sizeof(LDKWitness), "LDKCVec_WitnessZ Elements");
40540         else
40541                 val_constr.data = NULL;
40542         int8_tArray* val_vals = (void*) val->elems;
40543         for (size_t m = 0; m < val_constr.datalen; m++) {
40544                 int8_tArray val_conv_12 = val_vals[m];
40545                 LDKWitness val_conv_12_ref;
40546                 val_conv_12_ref.datalen = val_conv_12->arr_len;
40547                 val_conv_12_ref.data = MALLOC(val_conv_12_ref.datalen, "LDKWitness Bytes");
40548                 memcpy(val_conv_12_ref.data, val_conv_12->elems, val_conv_12_ref.datalen); FREE(val_conv_12);
40549                 val_conv_12_ref.data_is_owned = true;
40550                 val_constr.data[m] = val_conv_12_ref;
40551         }
40552         FREE(val);
40553         TxSignatures_set_witnesses(&this_ptr_conv, val_constr);
40554 }
40555
40556 uint64_t  __attribute__((export_name("TS_TxSignatures_new"))) TS_TxSignatures_new(int8_tArray channel_id_arg, int8_tArray tx_hash_arg, ptrArray witnesses_arg) {
40557         LDKThirtyTwoBytes channel_id_arg_ref;
40558         CHECK(channel_id_arg->arr_len == 32);
40559         memcpy(channel_id_arg_ref.data, channel_id_arg->elems, 32); FREE(channel_id_arg);
40560         LDKThirtyTwoBytes tx_hash_arg_ref;
40561         CHECK(tx_hash_arg->arr_len == 32);
40562         memcpy(tx_hash_arg_ref.data, tx_hash_arg->elems, 32); FREE(tx_hash_arg);
40563         LDKCVec_WitnessZ witnesses_arg_constr;
40564         witnesses_arg_constr.datalen = witnesses_arg->arr_len;
40565         if (witnesses_arg_constr.datalen > 0)
40566                 witnesses_arg_constr.data = MALLOC(witnesses_arg_constr.datalen * sizeof(LDKWitness), "LDKCVec_WitnessZ Elements");
40567         else
40568                 witnesses_arg_constr.data = NULL;
40569         int8_tArray* witnesses_arg_vals = (void*) witnesses_arg->elems;
40570         for (size_t m = 0; m < witnesses_arg_constr.datalen; m++) {
40571                 int8_tArray witnesses_arg_conv_12 = witnesses_arg_vals[m];
40572                 LDKWitness witnesses_arg_conv_12_ref;
40573                 witnesses_arg_conv_12_ref.datalen = witnesses_arg_conv_12->arr_len;
40574                 witnesses_arg_conv_12_ref.data = MALLOC(witnesses_arg_conv_12_ref.datalen, "LDKWitness Bytes");
40575                 memcpy(witnesses_arg_conv_12_ref.data, witnesses_arg_conv_12->elems, witnesses_arg_conv_12_ref.datalen); FREE(witnesses_arg_conv_12);
40576                 witnesses_arg_conv_12_ref.data_is_owned = true;
40577                 witnesses_arg_constr.data[m] = witnesses_arg_conv_12_ref;
40578         }
40579         FREE(witnesses_arg);
40580         LDKTxSignatures ret_var = TxSignatures_new(channel_id_arg_ref, tx_hash_arg_ref, witnesses_arg_constr);
40581         uint64_t ret_ref = 0;
40582         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
40583         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
40584         return ret_ref;
40585 }
40586
40587 static inline uint64_t TxSignatures_clone_ptr(LDKTxSignatures *NONNULL_PTR arg) {
40588         LDKTxSignatures ret_var = TxSignatures_clone(arg);
40589         uint64_t ret_ref = 0;
40590         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
40591         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
40592         return ret_ref;
40593 }
40594 int64_t  __attribute__((export_name("TS_TxSignatures_clone_ptr"))) TS_TxSignatures_clone_ptr(uint64_t arg) {
40595         LDKTxSignatures arg_conv;
40596         arg_conv.inner = untag_ptr(arg);
40597         arg_conv.is_owned = ptr_is_owned(arg);
40598         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
40599         arg_conv.is_owned = false;
40600         int64_t ret_conv = TxSignatures_clone_ptr(&arg_conv);
40601         return ret_conv;
40602 }
40603
40604 uint64_t  __attribute__((export_name("TS_TxSignatures_clone"))) TS_TxSignatures_clone(uint64_t orig) {
40605         LDKTxSignatures orig_conv;
40606         orig_conv.inner = untag_ptr(orig);
40607         orig_conv.is_owned = ptr_is_owned(orig);
40608         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
40609         orig_conv.is_owned = false;
40610         LDKTxSignatures ret_var = TxSignatures_clone(&orig_conv);
40611         uint64_t ret_ref = 0;
40612         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
40613         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
40614         return ret_ref;
40615 }
40616
40617 jboolean  __attribute__((export_name("TS_TxSignatures_eq"))) TS_TxSignatures_eq(uint64_t a, uint64_t b) {
40618         LDKTxSignatures a_conv;
40619         a_conv.inner = untag_ptr(a);
40620         a_conv.is_owned = ptr_is_owned(a);
40621         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
40622         a_conv.is_owned = false;
40623         LDKTxSignatures b_conv;
40624         b_conv.inner = untag_ptr(b);
40625         b_conv.is_owned = ptr_is_owned(b);
40626         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
40627         b_conv.is_owned = false;
40628         jboolean ret_conv = TxSignatures_eq(&a_conv, &b_conv);
40629         return ret_conv;
40630 }
40631
40632 void  __attribute__((export_name("TS_TxInitRbf_free"))) TS_TxInitRbf_free(uint64_t this_obj) {
40633         LDKTxInitRbf this_obj_conv;
40634         this_obj_conv.inner = untag_ptr(this_obj);
40635         this_obj_conv.is_owned = ptr_is_owned(this_obj);
40636         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
40637         TxInitRbf_free(this_obj_conv);
40638 }
40639
40640 int8_tArray  __attribute__((export_name("TS_TxInitRbf_get_channel_id"))) TS_TxInitRbf_get_channel_id(uint64_t this_ptr) {
40641         LDKTxInitRbf this_ptr_conv;
40642         this_ptr_conv.inner = untag_ptr(this_ptr);
40643         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
40644         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
40645         this_ptr_conv.is_owned = false;
40646         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
40647         memcpy(ret_arr->elems, *TxInitRbf_get_channel_id(&this_ptr_conv), 32);
40648         return ret_arr;
40649 }
40650
40651 void  __attribute__((export_name("TS_TxInitRbf_set_channel_id"))) TS_TxInitRbf_set_channel_id(uint64_t this_ptr, int8_tArray val) {
40652         LDKTxInitRbf this_ptr_conv;
40653         this_ptr_conv.inner = untag_ptr(this_ptr);
40654         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
40655         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
40656         this_ptr_conv.is_owned = false;
40657         LDKThirtyTwoBytes val_ref;
40658         CHECK(val->arr_len == 32);
40659         memcpy(val_ref.data, val->elems, 32); FREE(val);
40660         TxInitRbf_set_channel_id(&this_ptr_conv, val_ref);
40661 }
40662
40663 int32_t  __attribute__((export_name("TS_TxInitRbf_get_locktime"))) TS_TxInitRbf_get_locktime(uint64_t this_ptr) {
40664         LDKTxInitRbf this_ptr_conv;
40665         this_ptr_conv.inner = untag_ptr(this_ptr);
40666         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
40667         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
40668         this_ptr_conv.is_owned = false;
40669         int32_t ret_conv = TxInitRbf_get_locktime(&this_ptr_conv);
40670         return ret_conv;
40671 }
40672
40673 void  __attribute__((export_name("TS_TxInitRbf_set_locktime"))) TS_TxInitRbf_set_locktime(uint64_t this_ptr, int32_t val) {
40674         LDKTxInitRbf this_ptr_conv;
40675         this_ptr_conv.inner = untag_ptr(this_ptr);
40676         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
40677         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
40678         this_ptr_conv.is_owned = false;
40679         TxInitRbf_set_locktime(&this_ptr_conv, val);
40680 }
40681
40682 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) {
40683         LDKTxInitRbf this_ptr_conv;
40684         this_ptr_conv.inner = untag_ptr(this_ptr);
40685         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
40686         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
40687         this_ptr_conv.is_owned = false;
40688         int32_t ret_conv = TxInitRbf_get_feerate_sat_per_1000_weight(&this_ptr_conv);
40689         return ret_conv;
40690 }
40691
40692 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) {
40693         LDKTxInitRbf this_ptr_conv;
40694         this_ptr_conv.inner = untag_ptr(this_ptr);
40695         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
40696         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
40697         this_ptr_conv.is_owned = false;
40698         TxInitRbf_set_feerate_sat_per_1000_weight(&this_ptr_conv, val);
40699 }
40700
40701 uint64_t  __attribute__((export_name("TS_TxInitRbf_get_funding_output_contribution"))) TS_TxInitRbf_get_funding_output_contribution(uint64_t this_ptr) {
40702         LDKTxInitRbf this_ptr_conv;
40703         this_ptr_conv.inner = untag_ptr(this_ptr);
40704         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
40705         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
40706         this_ptr_conv.is_owned = false;
40707         LDKCOption_i64Z *ret_copy = MALLOC(sizeof(LDKCOption_i64Z), "LDKCOption_i64Z");
40708         *ret_copy = TxInitRbf_get_funding_output_contribution(&this_ptr_conv);
40709         uint64_t ret_ref = tag_ptr(ret_copy, true);
40710         return ret_ref;
40711 }
40712
40713 void  __attribute__((export_name("TS_TxInitRbf_set_funding_output_contribution"))) TS_TxInitRbf_set_funding_output_contribution(uint64_t this_ptr, uint64_t val) {
40714         LDKTxInitRbf this_ptr_conv;
40715         this_ptr_conv.inner = untag_ptr(this_ptr);
40716         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
40717         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
40718         this_ptr_conv.is_owned = false;
40719         void* val_ptr = untag_ptr(val);
40720         CHECK_ACCESS(val_ptr);
40721         LDKCOption_i64Z val_conv = *(LDKCOption_i64Z*)(val_ptr);
40722         val_conv = COption_i64Z_clone((LDKCOption_i64Z*)untag_ptr(val));
40723         TxInitRbf_set_funding_output_contribution(&this_ptr_conv, val_conv);
40724 }
40725
40726 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) {
40727         LDKThirtyTwoBytes channel_id_arg_ref;
40728         CHECK(channel_id_arg->arr_len == 32);
40729         memcpy(channel_id_arg_ref.data, channel_id_arg->elems, 32); FREE(channel_id_arg);
40730         void* funding_output_contribution_arg_ptr = untag_ptr(funding_output_contribution_arg);
40731         CHECK_ACCESS(funding_output_contribution_arg_ptr);
40732         LDKCOption_i64Z funding_output_contribution_arg_conv = *(LDKCOption_i64Z*)(funding_output_contribution_arg_ptr);
40733         funding_output_contribution_arg_conv = COption_i64Z_clone((LDKCOption_i64Z*)untag_ptr(funding_output_contribution_arg));
40734         LDKTxInitRbf ret_var = TxInitRbf_new(channel_id_arg_ref, locktime_arg, feerate_sat_per_1000_weight_arg, funding_output_contribution_arg_conv);
40735         uint64_t ret_ref = 0;
40736         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
40737         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
40738         return ret_ref;
40739 }
40740
40741 static inline uint64_t TxInitRbf_clone_ptr(LDKTxInitRbf *NONNULL_PTR arg) {
40742         LDKTxInitRbf ret_var = TxInitRbf_clone(arg);
40743         uint64_t ret_ref = 0;
40744         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
40745         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
40746         return ret_ref;
40747 }
40748 int64_t  __attribute__((export_name("TS_TxInitRbf_clone_ptr"))) TS_TxInitRbf_clone_ptr(uint64_t arg) {
40749         LDKTxInitRbf arg_conv;
40750         arg_conv.inner = untag_ptr(arg);
40751         arg_conv.is_owned = ptr_is_owned(arg);
40752         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
40753         arg_conv.is_owned = false;
40754         int64_t ret_conv = TxInitRbf_clone_ptr(&arg_conv);
40755         return ret_conv;
40756 }
40757
40758 uint64_t  __attribute__((export_name("TS_TxInitRbf_clone"))) TS_TxInitRbf_clone(uint64_t orig) {
40759         LDKTxInitRbf orig_conv;
40760         orig_conv.inner = untag_ptr(orig);
40761         orig_conv.is_owned = ptr_is_owned(orig);
40762         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
40763         orig_conv.is_owned = false;
40764         LDKTxInitRbf ret_var = TxInitRbf_clone(&orig_conv);
40765         uint64_t ret_ref = 0;
40766         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
40767         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
40768         return ret_ref;
40769 }
40770
40771 jboolean  __attribute__((export_name("TS_TxInitRbf_eq"))) TS_TxInitRbf_eq(uint64_t a, uint64_t b) {
40772         LDKTxInitRbf a_conv;
40773         a_conv.inner = untag_ptr(a);
40774         a_conv.is_owned = ptr_is_owned(a);
40775         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
40776         a_conv.is_owned = false;
40777         LDKTxInitRbf b_conv;
40778         b_conv.inner = untag_ptr(b);
40779         b_conv.is_owned = ptr_is_owned(b);
40780         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
40781         b_conv.is_owned = false;
40782         jboolean ret_conv = TxInitRbf_eq(&a_conv, &b_conv);
40783         return ret_conv;
40784 }
40785
40786 void  __attribute__((export_name("TS_TxAckRbf_free"))) TS_TxAckRbf_free(uint64_t this_obj) {
40787         LDKTxAckRbf this_obj_conv;
40788         this_obj_conv.inner = untag_ptr(this_obj);
40789         this_obj_conv.is_owned = ptr_is_owned(this_obj);
40790         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
40791         TxAckRbf_free(this_obj_conv);
40792 }
40793
40794 int8_tArray  __attribute__((export_name("TS_TxAckRbf_get_channel_id"))) TS_TxAckRbf_get_channel_id(uint64_t this_ptr) {
40795         LDKTxAckRbf this_ptr_conv;
40796         this_ptr_conv.inner = untag_ptr(this_ptr);
40797         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
40798         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
40799         this_ptr_conv.is_owned = false;
40800         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
40801         memcpy(ret_arr->elems, *TxAckRbf_get_channel_id(&this_ptr_conv), 32);
40802         return ret_arr;
40803 }
40804
40805 void  __attribute__((export_name("TS_TxAckRbf_set_channel_id"))) TS_TxAckRbf_set_channel_id(uint64_t this_ptr, int8_tArray val) {
40806         LDKTxAckRbf this_ptr_conv;
40807         this_ptr_conv.inner = untag_ptr(this_ptr);
40808         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
40809         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
40810         this_ptr_conv.is_owned = false;
40811         LDKThirtyTwoBytes val_ref;
40812         CHECK(val->arr_len == 32);
40813         memcpy(val_ref.data, val->elems, 32); FREE(val);
40814         TxAckRbf_set_channel_id(&this_ptr_conv, val_ref);
40815 }
40816
40817 uint64_t  __attribute__((export_name("TS_TxAckRbf_get_funding_output_contribution"))) TS_TxAckRbf_get_funding_output_contribution(uint64_t this_ptr) {
40818         LDKTxAckRbf this_ptr_conv;
40819         this_ptr_conv.inner = untag_ptr(this_ptr);
40820         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
40821         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
40822         this_ptr_conv.is_owned = false;
40823         LDKCOption_i64Z *ret_copy = MALLOC(sizeof(LDKCOption_i64Z), "LDKCOption_i64Z");
40824         *ret_copy = TxAckRbf_get_funding_output_contribution(&this_ptr_conv);
40825         uint64_t ret_ref = tag_ptr(ret_copy, true);
40826         return ret_ref;
40827 }
40828
40829 void  __attribute__((export_name("TS_TxAckRbf_set_funding_output_contribution"))) TS_TxAckRbf_set_funding_output_contribution(uint64_t this_ptr, uint64_t val) {
40830         LDKTxAckRbf this_ptr_conv;
40831         this_ptr_conv.inner = untag_ptr(this_ptr);
40832         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
40833         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
40834         this_ptr_conv.is_owned = false;
40835         void* val_ptr = untag_ptr(val);
40836         CHECK_ACCESS(val_ptr);
40837         LDKCOption_i64Z val_conv = *(LDKCOption_i64Z*)(val_ptr);
40838         val_conv = COption_i64Z_clone((LDKCOption_i64Z*)untag_ptr(val));
40839         TxAckRbf_set_funding_output_contribution(&this_ptr_conv, val_conv);
40840 }
40841
40842 uint64_t  __attribute__((export_name("TS_TxAckRbf_new"))) TS_TxAckRbf_new(int8_tArray channel_id_arg, uint64_t funding_output_contribution_arg) {
40843         LDKThirtyTwoBytes channel_id_arg_ref;
40844         CHECK(channel_id_arg->arr_len == 32);
40845         memcpy(channel_id_arg_ref.data, channel_id_arg->elems, 32); FREE(channel_id_arg);
40846         void* funding_output_contribution_arg_ptr = untag_ptr(funding_output_contribution_arg);
40847         CHECK_ACCESS(funding_output_contribution_arg_ptr);
40848         LDKCOption_i64Z funding_output_contribution_arg_conv = *(LDKCOption_i64Z*)(funding_output_contribution_arg_ptr);
40849         funding_output_contribution_arg_conv = COption_i64Z_clone((LDKCOption_i64Z*)untag_ptr(funding_output_contribution_arg));
40850         LDKTxAckRbf ret_var = TxAckRbf_new(channel_id_arg_ref, funding_output_contribution_arg_conv);
40851         uint64_t ret_ref = 0;
40852         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
40853         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
40854         return ret_ref;
40855 }
40856
40857 static inline uint64_t TxAckRbf_clone_ptr(LDKTxAckRbf *NONNULL_PTR arg) {
40858         LDKTxAckRbf ret_var = TxAckRbf_clone(arg);
40859         uint64_t ret_ref = 0;
40860         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
40861         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
40862         return ret_ref;
40863 }
40864 int64_t  __attribute__((export_name("TS_TxAckRbf_clone_ptr"))) TS_TxAckRbf_clone_ptr(uint64_t arg) {
40865         LDKTxAckRbf arg_conv;
40866         arg_conv.inner = untag_ptr(arg);
40867         arg_conv.is_owned = ptr_is_owned(arg);
40868         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
40869         arg_conv.is_owned = false;
40870         int64_t ret_conv = TxAckRbf_clone_ptr(&arg_conv);
40871         return ret_conv;
40872 }
40873
40874 uint64_t  __attribute__((export_name("TS_TxAckRbf_clone"))) TS_TxAckRbf_clone(uint64_t orig) {
40875         LDKTxAckRbf orig_conv;
40876         orig_conv.inner = untag_ptr(orig);
40877         orig_conv.is_owned = ptr_is_owned(orig);
40878         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
40879         orig_conv.is_owned = false;
40880         LDKTxAckRbf ret_var = TxAckRbf_clone(&orig_conv);
40881         uint64_t ret_ref = 0;
40882         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
40883         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
40884         return ret_ref;
40885 }
40886
40887 jboolean  __attribute__((export_name("TS_TxAckRbf_eq"))) TS_TxAckRbf_eq(uint64_t a, uint64_t b) {
40888         LDKTxAckRbf a_conv;
40889         a_conv.inner = untag_ptr(a);
40890         a_conv.is_owned = ptr_is_owned(a);
40891         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
40892         a_conv.is_owned = false;
40893         LDKTxAckRbf b_conv;
40894         b_conv.inner = untag_ptr(b);
40895         b_conv.is_owned = ptr_is_owned(b);
40896         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
40897         b_conv.is_owned = false;
40898         jboolean ret_conv = TxAckRbf_eq(&a_conv, &b_conv);
40899         return ret_conv;
40900 }
40901
40902 void  __attribute__((export_name("TS_TxAbort_free"))) TS_TxAbort_free(uint64_t this_obj) {
40903         LDKTxAbort this_obj_conv;
40904         this_obj_conv.inner = untag_ptr(this_obj);
40905         this_obj_conv.is_owned = ptr_is_owned(this_obj);
40906         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
40907         TxAbort_free(this_obj_conv);
40908 }
40909
40910 int8_tArray  __attribute__((export_name("TS_TxAbort_get_channel_id"))) TS_TxAbort_get_channel_id(uint64_t this_ptr) {
40911         LDKTxAbort this_ptr_conv;
40912         this_ptr_conv.inner = untag_ptr(this_ptr);
40913         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
40914         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
40915         this_ptr_conv.is_owned = false;
40916         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
40917         memcpy(ret_arr->elems, *TxAbort_get_channel_id(&this_ptr_conv), 32);
40918         return ret_arr;
40919 }
40920
40921 void  __attribute__((export_name("TS_TxAbort_set_channel_id"))) TS_TxAbort_set_channel_id(uint64_t this_ptr, int8_tArray val) {
40922         LDKTxAbort this_ptr_conv;
40923         this_ptr_conv.inner = untag_ptr(this_ptr);
40924         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
40925         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
40926         this_ptr_conv.is_owned = false;
40927         LDKThirtyTwoBytes val_ref;
40928         CHECK(val->arr_len == 32);
40929         memcpy(val_ref.data, val->elems, 32); FREE(val);
40930         TxAbort_set_channel_id(&this_ptr_conv, val_ref);
40931 }
40932
40933 int8_tArray  __attribute__((export_name("TS_TxAbort_get_data"))) TS_TxAbort_get_data(uint64_t this_ptr) {
40934         LDKTxAbort this_ptr_conv;
40935         this_ptr_conv.inner = untag_ptr(this_ptr);
40936         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
40937         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
40938         this_ptr_conv.is_owned = false;
40939         LDKCVec_u8Z ret_var = TxAbort_get_data(&this_ptr_conv);
40940         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
40941         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
40942         CVec_u8Z_free(ret_var);
40943         return ret_arr;
40944 }
40945
40946 void  __attribute__((export_name("TS_TxAbort_set_data"))) TS_TxAbort_set_data(uint64_t this_ptr, int8_tArray val) {
40947         LDKTxAbort this_ptr_conv;
40948         this_ptr_conv.inner = untag_ptr(this_ptr);
40949         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
40950         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
40951         this_ptr_conv.is_owned = false;
40952         LDKCVec_u8Z val_ref;
40953         val_ref.datalen = val->arr_len;
40954         val_ref.data = MALLOC(val_ref.datalen, "LDKCVec_u8Z Bytes");
40955         memcpy(val_ref.data, val->elems, val_ref.datalen); FREE(val);
40956         TxAbort_set_data(&this_ptr_conv, val_ref);
40957 }
40958
40959 uint64_t  __attribute__((export_name("TS_TxAbort_new"))) TS_TxAbort_new(int8_tArray channel_id_arg, int8_tArray data_arg) {
40960         LDKThirtyTwoBytes channel_id_arg_ref;
40961         CHECK(channel_id_arg->arr_len == 32);
40962         memcpy(channel_id_arg_ref.data, channel_id_arg->elems, 32); FREE(channel_id_arg);
40963         LDKCVec_u8Z data_arg_ref;
40964         data_arg_ref.datalen = data_arg->arr_len;
40965         data_arg_ref.data = MALLOC(data_arg_ref.datalen, "LDKCVec_u8Z Bytes");
40966         memcpy(data_arg_ref.data, data_arg->elems, data_arg_ref.datalen); FREE(data_arg);
40967         LDKTxAbort ret_var = TxAbort_new(channel_id_arg_ref, data_arg_ref);
40968         uint64_t ret_ref = 0;
40969         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
40970         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
40971         return ret_ref;
40972 }
40973
40974 static inline uint64_t TxAbort_clone_ptr(LDKTxAbort *NONNULL_PTR arg) {
40975         LDKTxAbort ret_var = TxAbort_clone(arg);
40976         uint64_t ret_ref = 0;
40977         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
40978         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
40979         return ret_ref;
40980 }
40981 int64_t  __attribute__((export_name("TS_TxAbort_clone_ptr"))) TS_TxAbort_clone_ptr(uint64_t arg) {
40982         LDKTxAbort arg_conv;
40983         arg_conv.inner = untag_ptr(arg);
40984         arg_conv.is_owned = ptr_is_owned(arg);
40985         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
40986         arg_conv.is_owned = false;
40987         int64_t ret_conv = TxAbort_clone_ptr(&arg_conv);
40988         return ret_conv;
40989 }
40990
40991 uint64_t  __attribute__((export_name("TS_TxAbort_clone"))) TS_TxAbort_clone(uint64_t orig) {
40992         LDKTxAbort orig_conv;
40993         orig_conv.inner = untag_ptr(orig);
40994         orig_conv.is_owned = ptr_is_owned(orig);
40995         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
40996         orig_conv.is_owned = false;
40997         LDKTxAbort ret_var = TxAbort_clone(&orig_conv);
40998         uint64_t ret_ref = 0;
40999         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
41000         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
41001         return ret_ref;
41002 }
41003
41004 jboolean  __attribute__((export_name("TS_TxAbort_eq"))) TS_TxAbort_eq(uint64_t a, uint64_t b) {
41005         LDKTxAbort a_conv;
41006         a_conv.inner = untag_ptr(a);
41007         a_conv.is_owned = ptr_is_owned(a);
41008         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
41009         a_conv.is_owned = false;
41010         LDKTxAbort b_conv;
41011         b_conv.inner = untag_ptr(b);
41012         b_conv.is_owned = ptr_is_owned(b);
41013         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
41014         b_conv.is_owned = false;
41015         jboolean ret_conv = TxAbort_eq(&a_conv, &b_conv);
41016         return ret_conv;
41017 }
41018
41019 void  __attribute__((export_name("TS_Shutdown_free"))) TS_Shutdown_free(uint64_t this_obj) {
41020         LDKShutdown this_obj_conv;
41021         this_obj_conv.inner = untag_ptr(this_obj);
41022         this_obj_conv.is_owned = ptr_is_owned(this_obj);
41023         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
41024         Shutdown_free(this_obj_conv);
41025 }
41026
41027 int8_tArray  __attribute__((export_name("TS_Shutdown_get_channel_id"))) TS_Shutdown_get_channel_id(uint64_t this_ptr) {
41028         LDKShutdown this_ptr_conv;
41029         this_ptr_conv.inner = untag_ptr(this_ptr);
41030         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
41031         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
41032         this_ptr_conv.is_owned = false;
41033         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
41034         memcpy(ret_arr->elems, *Shutdown_get_channel_id(&this_ptr_conv), 32);
41035         return ret_arr;
41036 }
41037
41038 void  __attribute__((export_name("TS_Shutdown_set_channel_id"))) TS_Shutdown_set_channel_id(uint64_t this_ptr, int8_tArray val) {
41039         LDKShutdown this_ptr_conv;
41040         this_ptr_conv.inner = untag_ptr(this_ptr);
41041         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
41042         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
41043         this_ptr_conv.is_owned = false;
41044         LDKThirtyTwoBytes val_ref;
41045         CHECK(val->arr_len == 32);
41046         memcpy(val_ref.data, val->elems, 32); FREE(val);
41047         Shutdown_set_channel_id(&this_ptr_conv, val_ref);
41048 }
41049
41050 int8_tArray  __attribute__((export_name("TS_Shutdown_get_scriptpubkey"))) TS_Shutdown_get_scriptpubkey(uint64_t this_ptr) {
41051         LDKShutdown this_ptr_conv;
41052         this_ptr_conv.inner = untag_ptr(this_ptr);
41053         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
41054         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
41055         this_ptr_conv.is_owned = false;
41056         LDKu8slice ret_var = Shutdown_get_scriptpubkey(&this_ptr_conv);
41057         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
41058         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
41059         return ret_arr;
41060 }
41061
41062 void  __attribute__((export_name("TS_Shutdown_set_scriptpubkey"))) TS_Shutdown_set_scriptpubkey(uint64_t this_ptr, int8_tArray val) {
41063         LDKShutdown this_ptr_conv;
41064         this_ptr_conv.inner = untag_ptr(this_ptr);
41065         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
41066         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
41067         this_ptr_conv.is_owned = false;
41068         LDKCVec_u8Z val_ref;
41069         val_ref.datalen = val->arr_len;
41070         val_ref.data = MALLOC(val_ref.datalen, "LDKCVec_u8Z Bytes");
41071         memcpy(val_ref.data, val->elems, val_ref.datalen); FREE(val);
41072         Shutdown_set_scriptpubkey(&this_ptr_conv, val_ref);
41073 }
41074
41075 uint64_t  __attribute__((export_name("TS_Shutdown_new"))) TS_Shutdown_new(int8_tArray channel_id_arg, int8_tArray scriptpubkey_arg) {
41076         LDKThirtyTwoBytes channel_id_arg_ref;
41077         CHECK(channel_id_arg->arr_len == 32);
41078         memcpy(channel_id_arg_ref.data, channel_id_arg->elems, 32); FREE(channel_id_arg);
41079         LDKCVec_u8Z scriptpubkey_arg_ref;
41080         scriptpubkey_arg_ref.datalen = scriptpubkey_arg->arr_len;
41081         scriptpubkey_arg_ref.data = MALLOC(scriptpubkey_arg_ref.datalen, "LDKCVec_u8Z Bytes");
41082         memcpy(scriptpubkey_arg_ref.data, scriptpubkey_arg->elems, scriptpubkey_arg_ref.datalen); FREE(scriptpubkey_arg);
41083         LDKShutdown ret_var = Shutdown_new(channel_id_arg_ref, scriptpubkey_arg_ref);
41084         uint64_t ret_ref = 0;
41085         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
41086         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
41087         return ret_ref;
41088 }
41089
41090 static inline uint64_t Shutdown_clone_ptr(LDKShutdown *NONNULL_PTR arg) {
41091         LDKShutdown ret_var = Shutdown_clone(arg);
41092         uint64_t ret_ref = 0;
41093         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
41094         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
41095         return ret_ref;
41096 }
41097 int64_t  __attribute__((export_name("TS_Shutdown_clone_ptr"))) TS_Shutdown_clone_ptr(uint64_t arg) {
41098         LDKShutdown arg_conv;
41099         arg_conv.inner = untag_ptr(arg);
41100         arg_conv.is_owned = ptr_is_owned(arg);
41101         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
41102         arg_conv.is_owned = false;
41103         int64_t ret_conv = Shutdown_clone_ptr(&arg_conv);
41104         return ret_conv;
41105 }
41106
41107 uint64_t  __attribute__((export_name("TS_Shutdown_clone"))) TS_Shutdown_clone(uint64_t orig) {
41108         LDKShutdown orig_conv;
41109         orig_conv.inner = untag_ptr(orig);
41110         orig_conv.is_owned = ptr_is_owned(orig);
41111         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
41112         orig_conv.is_owned = false;
41113         LDKShutdown ret_var = Shutdown_clone(&orig_conv);
41114         uint64_t ret_ref = 0;
41115         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
41116         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
41117         return ret_ref;
41118 }
41119
41120 jboolean  __attribute__((export_name("TS_Shutdown_eq"))) TS_Shutdown_eq(uint64_t a, uint64_t b) {
41121         LDKShutdown a_conv;
41122         a_conv.inner = untag_ptr(a);
41123         a_conv.is_owned = ptr_is_owned(a);
41124         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
41125         a_conv.is_owned = false;
41126         LDKShutdown b_conv;
41127         b_conv.inner = untag_ptr(b);
41128         b_conv.is_owned = ptr_is_owned(b);
41129         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
41130         b_conv.is_owned = false;
41131         jboolean ret_conv = Shutdown_eq(&a_conv, &b_conv);
41132         return ret_conv;
41133 }
41134
41135 void  __attribute__((export_name("TS_ClosingSignedFeeRange_free"))) TS_ClosingSignedFeeRange_free(uint64_t this_obj) {
41136         LDKClosingSignedFeeRange this_obj_conv;
41137         this_obj_conv.inner = untag_ptr(this_obj);
41138         this_obj_conv.is_owned = ptr_is_owned(this_obj);
41139         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
41140         ClosingSignedFeeRange_free(this_obj_conv);
41141 }
41142
41143 int64_t  __attribute__((export_name("TS_ClosingSignedFeeRange_get_min_fee_satoshis"))) TS_ClosingSignedFeeRange_get_min_fee_satoshis(uint64_t this_ptr) {
41144         LDKClosingSignedFeeRange this_ptr_conv;
41145         this_ptr_conv.inner = untag_ptr(this_ptr);
41146         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
41147         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
41148         this_ptr_conv.is_owned = false;
41149         int64_t ret_conv = ClosingSignedFeeRange_get_min_fee_satoshis(&this_ptr_conv);
41150         return ret_conv;
41151 }
41152
41153 void  __attribute__((export_name("TS_ClosingSignedFeeRange_set_min_fee_satoshis"))) TS_ClosingSignedFeeRange_set_min_fee_satoshis(uint64_t this_ptr, int64_t val) {
41154         LDKClosingSignedFeeRange this_ptr_conv;
41155         this_ptr_conv.inner = untag_ptr(this_ptr);
41156         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
41157         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
41158         this_ptr_conv.is_owned = false;
41159         ClosingSignedFeeRange_set_min_fee_satoshis(&this_ptr_conv, val);
41160 }
41161
41162 int64_t  __attribute__((export_name("TS_ClosingSignedFeeRange_get_max_fee_satoshis"))) TS_ClosingSignedFeeRange_get_max_fee_satoshis(uint64_t this_ptr) {
41163         LDKClosingSignedFeeRange this_ptr_conv;
41164         this_ptr_conv.inner = untag_ptr(this_ptr);
41165         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
41166         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
41167         this_ptr_conv.is_owned = false;
41168         int64_t ret_conv = ClosingSignedFeeRange_get_max_fee_satoshis(&this_ptr_conv);
41169         return ret_conv;
41170 }
41171
41172 void  __attribute__((export_name("TS_ClosingSignedFeeRange_set_max_fee_satoshis"))) TS_ClosingSignedFeeRange_set_max_fee_satoshis(uint64_t this_ptr, int64_t val) {
41173         LDKClosingSignedFeeRange this_ptr_conv;
41174         this_ptr_conv.inner = untag_ptr(this_ptr);
41175         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
41176         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
41177         this_ptr_conv.is_owned = false;
41178         ClosingSignedFeeRange_set_max_fee_satoshis(&this_ptr_conv, val);
41179 }
41180
41181 uint64_t  __attribute__((export_name("TS_ClosingSignedFeeRange_new"))) TS_ClosingSignedFeeRange_new(int64_t min_fee_satoshis_arg, int64_t max_fee_satoshis_arg) {
41182         LDKClosingSignedFeeRange ret_var = ClosingSignedFeeRange_new(min_fee_satoshis_arg, max_fee_satoshis_arg);
41183         uint64_t ret_ref = 0;
41184         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
41185         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
41186         return ret_ref;
41187 }
41188
41189 static inline uint64_t ClosingSignedFeeRange_clone_ptr(LDKClosingSignedFeeRange *NONNULL_PTR arg) {
41190         LDKClosingSignedFeeRange ret_var = ClosingSignedFeeRange_clone(arg);
41191         uint64_t ret_ref = 0;
41192         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
41193         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
41194         return ret_ref;
41195 }
41196 int64_t  __attribute__((export_name("TS_ClosingSignedFeeRange_clone_ptr"))) TS_ClosingSignedFeeRange_clone_ptr(uint64_t arg) {
41197         LDKClosingSignedFeeRange arg_conv;
41198         arg_conv.inner = untag_ptr(arg);
41199         arg_conv.is_owned = ptr_is_owned(arg);
41200         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
41201         arg_conv.is_owned = false;
41202         int64_t ret_conv = ClosingSignedFeeRange_clone_ptr(&arg_conv);
41203         return ret_conv;
41204 }
41205
41206 uint64_t  __attribute__((export_name("TS_ClosingSignedFeeRange_clone"))) TS_ClosingSignedFeeRange_clone(uint64_t orig) {
41207         LDKClosingSignedFeeRange orig_conv;
41208         orig_conv.inner = untag_ptr(orig);
41209         orig_conv.is_owned = ptr_is_owned(orig);
41210         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
41211         orig_conv.is_owned = false;
41212         LDKClosingSignedFeeRange ret_var = ClosingSignedFeeRange_clone(&orig_conv);
41213         uint64_t ret_ref = 0;
41214         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
41215         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
41216         return ret_ref;
41217 }
41218
41219 jboolean  __attribute__((export_name("TS_ClosingSignedFeeRange_eq"))) TS_ClosingSignedFeeRange_eq(uint64_t a, uint64_t b) {
41220         LDKClosingSignedFeeRange a_conv;
41221         a_conv.inner = untag_ptr(a);
41222         a_conv.is_owned = ptr_is_owned(a);
41223         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
41224         a_conv.is_owned = false;
41225         LDKClosingSignedFeeRange b_conv;
41226         b_conv.inner = untag_ptr(b);
41227         b_conv.is_owned = ptr_is_owned(b);
41228         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
41229         b_conv.is_owned = false;
41230         jboolean ret_conv = ClosingSignedFeeRange_eq(&a_conv, &b_conv);
41231         return ret_conv;
41232 }
41233
41234 void  __attribute__((export_name("TS_ClosingSigned_free"))) TS_ClosingSigned_free(uint64_t this_obj) {
41235         LDKClosingSigned this_obj_conv;
41236         this_obj_conv.inner = untag_ptr(this_obj);
41237         this_obj_conv.is_owned = ptr_is_owned(this_obj);
41238         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
41239         ClosingSigned_free(this_obj_conv);
41240 }
41241
41242 int8_tArray  __attribute__((export_name("TS_ClosingSigned_get_channel_id"))) TS_ClosingSigned_get_channel_id(uint64_t this_ptr) {
41243         LDKClosingSigned this_ptr_conv;
41244         this_ptr_conv.inner = untag_ptr(this_ptr);
41245         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
41246         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
41247         this_ptr_conv.is_owned = false;
41248         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
41249         memcpy(ret_arr->elems, *ClosingSigned_get_channel_id(&this_ptr_conv), 32);
41250         return ret_arr;
41251 }
41252
41253 void  __attribute__((export_name("TS_ClosingSigned_set_channel_id"))) TS_ClosingSigned_set_channel_id(uint64_t this_ptr, int8_tArray val) {
41254         LDKClosingSigned this_ptr_conv;
41255         this_ptr_conv.inner = untag_ptr(this_ptr);
41256         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
41257         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
41258         this_ptr_conv.is_owned = false;
41259         LDKThirtyTwoBytes val_ref;
41260         CHECK(val->arr_len == 32);
41261         memcpy(val_ref.data, val->elems, 32); FREE(val);
41262         ClosingSigned_set_channel_id(&this_ptr_conv, val_ref);
41263 }
41264
41265 int64_t  __attribute__((export_name("TS_ClosingSigned_get_fee_satoshis"))) TS_ClosingSigned_get_fee_satoshis(uint64_t this_ptr) {
41266         LDKClosingSigned this_ptr_conv;
41267         this_ptr_conv.inner = untag_ptr(this_ptr);
41268         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
41269         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
41270         this_ptr_conv.is_owned = false;
41271         int64_t ret_conv = ClosingSigned_get_fee_satoshis(&this_ptr_conv);
41272         return ret_conv;
41273 }
41274
41275 void  __attribute__((export_name("TS_ClosingSigned_set_fee_satoshis"))) TS_ClosingSigned_set_fee_satoshis(uint64_t this_ptr, int64_t val) {
41276         LDKClosingSigned this_ptr_conv;
41277         this_ptr_conv.inner = untag_ptr(this_ptr);
41278         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
41279         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
41280         this_ptr_conv.is_owned = false;
41281         ClosingSigned_set_fee_satoshis(&this_ptr_conv, val);
41282 }
41283
41284 int8_tArray  __attribute__((export_name("TS_ClosingSigned_get_signature"))) TS_ClosingSigned_get_signature(uint64_t this_ptr) {
41285         LDKClosingSigned this_ptr_conv;
41286         this_ptr_conv.inner = untag_ptr(this_ptr);
41287         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
41288         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
41289         this_ptr_conv.is_owned = false;
41290         int8_tArray ret_arr = init_int8_tArray(64, __LINE__);
41291         memcpy(ret_arr->elems, ClosingSigned_get_signature(&this_ptr_conv).compact_form, 64);
41292         return ret_arr;
41293 }
41294
41295 void  __attribute__((export_name("TS_ClosingSigned_set_signature"))) TS_ClosingSigned_set_signature(uint64_t this_ptr, int8_tArray val) {
41296         LDKClosingSigned this_ptr_conv;
41297         this_ptr_conv.inner = untag_ptr(this_ptr);
41298         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
41299         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
41300         this_ptr_conv.is_owned = false;
41301         LDKECDSASignature val_ref;
41302         CHECK(val->arr_len == 64);
41303         memcpy(val_ref.compact_form, val->elems, 64); FREE(val);
41304         ClosingSigned_set_signature(&this_ptr_conv, val_ref);
41305 }
41306
41307 uint64_t  __attribute__((export_name("TS_ClosingSigned_get_fee_range"))) TS_ClosingSigned_get_fee_range(uint64_t this_ptr) {
41308         LDKClosingSigned this_ptr_conv;
41309         this_ptr_conv.inner = untag_ptr(this_ptr);
41310         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
41311         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
41312         this_ptr_conv.is_owned = false;
41313         LDKClosingSignedFeeRange ret_var = ClosingSigned_get_fee_range(&this_ptr_conv);
41314         uint64_t ret_ref = 0;
41315         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
41316         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
41317         return ret_ref;
41318 }
41319
41320 void  __attribute__((export_name("TS_ClosingSigned_set_fee_range"))) TS_ClosingSigned_set_fee_range(uint64_t this_ptr, uint64_t val) {
41321         LDKClosingSigned this_ptr_conv;
41322         this_ptr_conv.inner = untag_ptr(this_ptr);
41323         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
41324         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
41325         this_ptr_conv.is_owned = false;
41326         LDKClosingSignedFeeRange val_conv;
41327         val_conv.inner = untag_ptr(val);
41328         val_conv.is_owned = ptr_is_owned(val);
41329         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
41330         val_conv = ClosingSignedFeeRange_clone(&val_conv);
41331         ClosingSigned_set_fee_range(&this_ptr_conv, val_conv);
41332 }
41333
41334 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) {
41335         LDKThirtyTwoBytes channel_id_arg_ref;
41336         CHECK(channel_id_arg->arr_len == 32);
41337         memcpy(channel_id_arg_ref.data, channel_id_arg->elems, 32); FREE(channel_id_arg);
41338         LDKECDSASignature signature_arg_ref;
41339         CHECK(signature_arg->arr_len == 64);
41340         memcpy(signature_arg_ref.compact_form, signature_arg->elems, 64); FREE(signature_arg);
41341         LDKClosingSignedFeeRange fee_range_arg_conv;
41342         fee_range_arg_conv.inner = untag_ptr(fee_range_arg);
41343         fee_range_arg_conv.is_owned = ptr_is_owned(fee_range_arg);
41344         CHECK_INNER_FIELD_ACCESS_OR_NULL(fee_range_arg_conv);
41345         fee_range_arg_conv = ClosingSignedFeeRange_clone(&fee_range_arg_conv);
41346         LDKClosingSigned ret_var = ClosingSigned_new(channel_id_arg_ref, fee_satoshis_arg, signature_arg_ref, fee_range_arg_conv);
41347         uint64_t ret_ref = 0;
41348         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
41349         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
41350         return ret_ref;
41351 }
41352
41353 static inline uint64_t ClosingSigned_clone_ptr(LDKClosingSigned *NONNULL_PTR arg) {
41354         LDKClosingSigned ret_var = ClosingSigned_clone(arg);
41355         uint64_t ret_ref = 0;
41356         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
41357         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
41358         return ret_ref;
41359 }
41360 int64_t  __attribute__((export_name("TS_ClosingSigned_clone_ptr"))) TS_ClosingSigned_clone_ptr(uint64_t arg) {
41361         LDKClosingSigned arg_conv;
41362         arg_conv.inner = untag_ptr(arg);
41363         arg_conv.is_owned = ptr_is_owned(arg);
41364         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
41365         arg_conv.is_owned = false;
41366         int64_t ret_conv = ClosingSigned_clone_ptr(&arg_conv);
41367         return ret_conv;
41368 }
41369
41370 uint64_t  __attribute__((export_name("TS_ClosingSigned_clone"))) TS_ClosingSigned_clone(uint64_t orig) {
41371         LDKClosingSigned orig_conv;
41372         orig_conv.inner = untag_ptr(orig);
41373         orig_conv.is_owned = ptr_is_owned(orig);
41374         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
41375         orig_conv.is_owned = false;
41376         LDKClosingSigned ret_var = ClosingSigned_clone(&orig_conv);
41377         uint64_t ret_ref = 0;
41378         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
41379         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
41380         return ret_ref;
41381 }
41382
41383 jboolean  __attribute__((export_name("TS_ClosingSigned_eq"))) TS_ClosingSigned_eq(uint64_t a, uint64_t b) {
41384         LDKClosingSigned a_conv;
41385         a_conv.inner = untag_ptr(a);
41386         a_conv.is_owned = ptr_is_owned(a);
41387         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
41388         a_conv.is_owned = false;
41389         LDKClosingSigned b_conv;
41390         b_conv.inner = untag_ptr(b);
41391         b_conv.is_owned = ptr_is_owned(b);
41392         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
41393         b_conv.is_owned = false;
41394         jboolean ret_conv = ClosingSigned_eq(&a_conv, &b_conv);
41395         return ret_conv;
41396 }
41397
41398 void  __attribute__((export_name("TS_UpdateAddHTLC_free"))) TS_UpdateAddHTLC_free(uint64_t this_obj) {
41399         LDKUpdateAddHTLC this_obj_conv;
41400         this_obj_conv.inner = untag_ptr(this_obj);
41401         this_obj_conv.is_owned = ptr_is_owned(this_obj);
41402         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
41403         UpdateAddHTLC_free(this_obj_conv);
41404 }
41405
41406 int8_tArray  __attribute__((export_name("TS_UpdateAddHTLC_get_channel_id"))) TS_UpdateAddHTLC_get_channel_id(uint64_t this_ptr) {
41407         LDKUpdateAddHTLC this_ptr_conv;
41408         this_ptr_conv.inner = untag_ptr(this_ptr);
41409         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
41410         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
41411         this_ptr_conv.is_owned = false;
41412         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
41413         memcpy(ret_arr->elems, *UpdateAddHTLC_get_channel_id(&this_ptr_conv), 32);
41414         return ret_arr;
41415 }
41416
41417 void  __attribute__((export_name("TS_UpdateAddHTLC_set_channel_id"))) TS_UpdateAddHTLC_set_channel_id(uint64_t this_ptr, int8_tArray val) {
41418         LDKUpdateAddHTLC this_ptr_conv;
41419         this_ptr_conv.inner = untag_ptr(this_ptr);
41420         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
41421         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
41422         this_ptr_conv.is_owned = false;
41423         LDKThirtyTwoBytes val_ref;
41424         CHECK(val->arr_len == 32);
41425         memcpy(val_ref.data, val->elems, 32); FREE(val);
41426         UpdateAddHTLC_set_channel_id(&this_ptr_conv, val_ref);
41427 }
41428
41429 int64_t  __attribute__((export_name("TS_UpdateAddHTLC_get_htlc_id"))) TS_UpdateAddHTLC_get_htlc_id(uint64_t this_ptr) {
41430         LDKUpdateAddHTLC this_ptr_conv;
41431         this_ptr_conv.inner = untag_ptr(this_ptr);
41432         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
41433         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
41434         this_ptr_conv.is_owned = false;
41435         int64_t ret_conv = UpdateAddHTLC_get_htlc_id(&this_ptr_conv);
41436         return ret_conv;
41437 }
41438
41439 void  __attribute__((export_name("TS_UpdateAddHTLC_set_htlc_id"))) TS_UpdateAddHTLC_set_htlc_id(uint64_t this_ptr, int64_t val) {
41440         LDKUpdateAddHTLC this_ptr_conv;
41441         this_ptr_conv.inner = untag_ptr(this_ptr);
41442         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
41443         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
41444         this_ptr_conv.is_owned = false;
41445         UpdateAddHTLC_set_htlc_id(&this_ptr_conv, val);
41446 }
41447
41448 int64_t  __attribute__((export_name("TS_UpdateAddHTLC_get_amount_msat"))) TS_UpdateAddHTLC_get_amount_msat(uint64_t this_ptr) {
41449         LDKUpdateAddHTLC this_ptr_conv;
41450         this_ptr_conv.inner = untag_ptr(this_ptr);
41451         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
41452         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
41453         this_ptr_conv.is_owned = false;
41454         int64_t ret_conv = UpdateAddHTLC_get_amount_msat(&this_ptr_conv);
41455         return ret_conv;
41456 }
41457
41458 void  __attribute__((export_name("TS_UpdateAddHTLC_set_amount_msat"))) TS_UpdateAddHTLC_set_amount_msat(uint64_t this_ptr, int64_t val) {
41459         LDKUpdateAddHTLC this_ptr_conv;
41460         this_ptr_conv.inner = untag_ptr(this_ptr);
41461         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
41462         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
41463         this_ptr_conv.is_owned = false;
41464         UpdateAddHTLC_set_amount_msat(&this_ptr_conv, val);
41465 }
41466
41467 int8_tArray  __attribute__((export_name("TS_UpdateAddHTLC_get_payment_hash"))) TS_UpdateAddHTLC_get_payment_hash(uint64_t this_ptr) {
41468         LDKUpdateAddHTLC this_ptr_conv;
41469         this_ptr_conv.inner = untag_ptr(this_ptr);
41470         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
41471         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
41472         this_ptr_conv.is_owned = false;
41473         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
41474         memcpy(ret_arr->elems, *UpdateAddHTLC_get_payment_hash(&this_ptr_conv), 32);
41475         return ret_arr;
41476 }
41477
41478 void  __attribute__((export_name("TS_UpdateAddHTLC_set_payment_hash"))) TS_UpdateAddHTLC_set_payment_hash(uint64_t this_ptr, int8_tArray val) {
41479         LDKUpdateAddHTLC this_ptr_conv;
41480         this_ptr_conv.inner = untag_ptr(this_ptr);
41481         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
41482         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
41483         this_ptr_conv.is_owned = false;
41484         LDKThirtyTwoBytes val_ref;
41485         CHECK(val->arr_len == 32);
41486         memcpy(val_ref.data, val->elems, 32); FREE(val);
41487         UpdateAddHTLC_set_payment_hash(&this_ptr_conv, val_ref);
41488 }
41489
41490 int32_t  __attribute__((export_name("TS_UpdateAddHTLC_get_cltv_expiry"))) TS_UpdateAddHTLC_get_cltv_expiry(uint64_t this_ptr) {
41491         LDKUpdateAddHTLC this_ptr_conv;
41492         this_ptr_conv.inner = untag_ptr(this_ptr);
41493         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
41494         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
41495         this_ptr_conv.is_owned = false;
41496         int32_t ret_conv = UpdateAddHTLC_get_cltv_expiry(&this_ptr_conv);
41497         return ret_conv;
41498 }
41499
41500 void  __attribute__((export_name("TS_UpdateAddHTLC_set_cltv_expiry"))) TS_UpdateAddHTLC_set_cltv_expiry(uint64_t this_ptr, int32_t val) {
41501         LDKUpdateAddHTLC this_ptr_conv;
41502         this_ptr_conv.inner = untag_ptr(this_ptr);
41503         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
41504         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
41505         this_ptr_conv.is_owned = false;
41506         UpdateAddHTLC_set_cltv_expiry(&this_ptr_conv, val);
41507 }
41508
41509 uint64_t  __attribute__((export_name("TS_UpdateAddHTLC_get_skimmed_fee_msat"))) TS_UpdateAddHTLC_get_skimmed_fee_msat(uint64_t this_ptr) {
41510         LDKUpdateAddHTLC this_ptr_conv;
41511         this_ptr_conv.inner = untag_ptr(this_ptr);
41512         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
41513         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
41514         this_ptr_conv.is_owned = false;
41515         LDKCOption_u64Z *ret_copy = MALLOC(sizeof(LDKCOption_u64Z), "LDKCOption_u64Z");
41516         *ret_copy = UpdateAddHTLC_get_skimmed_fee_msat(&this_ptr_conv);
41517         uint64_t ret_ref = tag_ptr(ret_copy, true);
41518         return ret_ref;
41519 }
41520
41521 void  __attribute__((export_name("TS_UpdateAddHTLC_set_skimmed_fee_msat"))) TS_UpdateAddHTLC_set_skimmed_fee_msat(uint64_t this_ptr, uint64_t val) {
41522         LDKUpdateAddHTLC this_ptr_conv;
41523         this_ptr_conv.inner = untag_ptr(this_ptr);
41524         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
41525         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
41526         this_ptr_conv.is_owned = false;
41527         void* val_ptr = untag_ptr(val);
41528         CHECK_ACCESS(val_ptr);
41529         LDKCOption_u64Z val_conv = *(LDKCOption_u64Z*)(val_ptr);
41530         val_conv = COption_u64Z_clone((LDKCOption_u64Z*)untag_ptr(val));
41531         UpdateAddHTLC_set_skimmed_fee_msat(&this_ptr_conv, val_conv);
41532 }
41533
41534 static inline uint64_t UpdateAddHTLC_clone_ptr(LDKUpdateAddHTLC *NONNULL_PTR arg) {
41535         LDKUpdateAddHTLC ret_var = UpdateAddHTLC_clone(arg);
41536         uint64_t ret_ref = 0;
41537         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
41538         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
41539         return ret_ref;
41540 }
41541 int64_t  __attribute__((export_name("TS_UpdateAddHTLC_clone_ptr"))) TS_UpdateAddHTLC_clone_ptr(uint64_t arg) {
41542         LDKUpdateAddHTLC arg_conv;
41543         arg_conv.inner = untag_ptr(arg);
41544         arg_conv.is_owned = ptr_is_owned(arg);
41545         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
41546         arg_conv.is_owned = false;
41547         int64_t ret_conv = UpdateAddHTLC_clone_ptr(&arg_conv);
41548         return ret_conv;
41549 }
41550
41551 uint64_t  __attribute__((export_name("TS_UpdateAddHTLC_clone"))) TS_UpdateAddHTLC_clone(uint64_t orig) {
41552         LDKUpdateAddHTLC orig_conv;
41553         orig_conv.inner = untag_ptr(orig);
41554         orig_conv.is_owned = ptr_is_owned(orig);
41555         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
41556         orig_conv.is_owned = false;
41557         LDKUpdateAddHTLC ret_var = UpdateAddHTLC_clone(&orig_conv);
41558         uint64_t ret_ref = 0;
41559         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
41560         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
41561         return ret_ref;
41562 }
41563
41564 jboolean  __attribute__((export_name("TS_UpdateAddHTLC_eq"))) TS_UpdateAddHTLC_eq(uint64_t a, uint64_t b) {
41565         LDKUpdateAddHTLC a_conv;
41566         a_conv.inner = untag_ptr(a);
41567         a_conv.is_owned = ptr_is_owned(a);
41568         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
41569         a_conv.is_owned = false;
41570         LDKUpdateAddHTLC b_conv;
41571         b_conv.inner = untag_ptr(b);
41572         b_conv.is_owned = ptr_is_owned(b);
41573         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
41574         b_conv.is_owned = false;
41575         jboolean ret_conv = UpdateAddHTLC_eq(&a_conv, &b_conv);
41576         return ret_conv;
41577 }
41578
41579 void  __attribute__((export_name("TS_OnionMessage_free"))) TS_OnionMessage_free(uint64_t this_obj) {
41580         LDKOnionMessage this_obj_conv;
41581         this_obj_conv.inner = untag_ptr(this_obj);
41582         this_obj_conv.is_owned = ptr_is_owned(this_obj);
41583         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
41584         OnionMessage_free(this_obj_conv);
41585 }
41586
41587 int8_tArray  __attribute__((export_name("TS_OnionMessage_get_blinding_point"))) TS_OnionMessage_get_blinding_point(uint64_t this_ptr) {
41588         LDKOnionMessage this_ptr_conv;
41589         this_ptr_conv.inner = untag_ptr(this_ptr);
41590         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
41591         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
41592         this_ptr_conv.is_owned = false;
41593         int8_tArray ret_arr = init_int8_tArray(33, __LINE__);
41594         memcpy(ret_arr->elems, OnionMessage_get_blinding_point(&this_ptr_conv).compressed_form, 33);
41595         return ret_arr;
41596 }
41597
41598 void  __attribute__((export_name("TS_OnionMessage_set_blinding_point"))) TS_OnionMessage_set_blinding_point(uint64_t this_ptr, int8_tArray val) {
41599         LDKOnionMessage this_ptr_conv;
41600         this_ptr_conv.inner = untag_ptr(this_ptr);
41601         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
41602         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
41603         this_ptr_conv.is_owned = false;
41604         LDKPublicKey val_ref;
41605         CHECK(val->arr_len == 33);
41606         memcpy(val_ref.compressed_form, val->elems, 33); FREE(val);
41607         OnionMessage_set_blinding_point(&this_ptr_conv, val_ref);
41608 }
41609
41610 uint64_t  __attribute__((export_name("TS_OnionMessage_get_onion_routing_packet"))) TS_OnionMessage_get_onion_routing_packet(uint64_t this_ptr) {
41611         LDKOnionMessage this_ptr_conv;
41612         this_ptr_conv.inner = untag_ptr(this_ptr);
41613         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
41614         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
41615         this_ptr_conv.is_owned = false;
41616         LDKPacket ret_var = OnionMessage_get_onion_routing_packet(&this_ptr_conv);
41617         uint64_t ret_ref = 0;
41618         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
41619         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
41620         return ret_ref;
41621 }
41622
41623 void  __attribute__((export_name("TS_OnionMessage_set_onion_routing_packet"))) TS_OnionMessage_set_onion_routing_packet(uint64_t this_ptr, uint64_t val) {
41624         LDKOnionMessage this_ptr_conv;
41625         this_ptr_conv.inner = untag_ptr(this_ptr);
41626         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
41627         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
41628         this_ptr_conv.is_owned = false;
41629         LDKPacket val_conv;
41630         val_conv.inner = untag_ptr(val);
41631         val_conv.is_owned = ptr_is_owned(val);
41632         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
41633         val_conv = Packet_clone(&val_conv);
41634         OnionMessage_set_onion_routing_packet(&this_ptr_conv, val_conv);
41635 }
41636
41637 uint64_t  __attribute__((export_name("TS_OnionMessage_new"))) TS_OnionMessage_new(int8_tArray blinding_point_arg, uint64_t onion_routing_packet_arg) {
41638         LDKPublicKey blinding_point_arg_ref;
41639         CHECK(blinding_point_arg->arr_len == 33);
41640         memcpy(blinding_point_arg_ref.compressed_form, blinding_point_arg->elems, 33); FREE(blinding_point_arg);
41641         LDKPacket onion_routing_packet_arg_conv;
41642         onion_routing_packet_arg_conv.inner = untag_ptr(onion_routing_packet_arg);
41643         onion_routing_packet_arg_conv.is_owned = ptr_is_owned(onion_routing_packet_arg);
41644         CHECK_INNER_FIELD_ACCESS_OR_NULL(onion_routing_packet_arg_conv);
41645         onion_routing_packet_arg_conv = Packet_clone(&onion_routing_packet_arg_conv);
41646         LDKOnionMessage ret_var = OnionMessage_new(blinding_point_arg_ref, onion_routing_packet_arg_conv);
41647         uint64_t ret_ref = 0;
41648         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
41649         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
41650         return ret_ref;
41651 }
41652
41653 static inline uint64_t OnionMessage_clone_ptr(LDKOnionMessage *NONNULL_PTR arg) {
41654         LDKOnionMessage ret_var = OnionMessage_clone(arg);
41655         uint64_t ret_ref = 0;
41656         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
41657         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
41658         return ret_ref;
41659 }
41660 int64_t  __attribute__((export_name("TS_OnionMessage_clone_ptr"))) TS_OnionMessage_clone_ptr(uint64_t arg) {
41661         LDKOnionMessage arg_conv;
41662         arg_conv.inner = untag_ptr(arg);
41663         arg_conv.is_owned = ptr_is_owned(arg);
41664         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
41665         arg_conv.is_owned = false;
41666         int64_t ret_conv = OnionMessage_clone_ptr(&arg_conv);
41667         return ret_conv;
41668 }
41669
41670 uint64_t  __attribute__((export_name("TS_OnionMessage_clone"))) TS_OnionMessage_clone(uint64_t orig) {
41671         LDKOnionMessage orig_conv;
41672         orig_conv.inner = untag_ptr(orig);
41673         orig_conv.is_owned = ptr_is_owned(orig);
41674         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
41675         orig_conv.is_owned = false;
41676         LDKOnionMessage ret_var = OnionMessage_clone(&orig_conv);
41677         uint64_t ret_ref = 0;
41678         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
41679         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
41680         return ret_ref;
41681 }
41682
41683 jboolean  __attribute__((export_name("TS_OnionMessage_eq"))) TS_OnionMessage_eq(uint64_t a, uint64_t b) {
41684         LDKOnionMessage a_conv;
41685         a_conv.inner = untag_ptr(a);
41686         a_conv.is_owned = ptr_is_owned(a);
41687         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
41688         a_conv.is_owned = false;
41689         LDKOnionMessage b_conv;
41690         b_conv.inner = untag_ptr(b);
41691         b_conv.is_owned = ptr_is_owned(b);
41692         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
41693         b_conv.is_owned = false;
41694         jboolean ret_conv = OnionMessage_eq(&a_conv, &b_conv);
41695         return ret_conv;
41696 }
41697
41698 void  __attribute__((export_name("TS_UpdateFulfillHTLC_free"))) TS_UpdateFulfillHTLC_free(uint64_t this_obj) {
41699         LDKUpdateFulfillHTLC this_obj_conv;
41700         this_obj_conv.inner = untag_ptr(this_obj);
41701         this_obj_conv.is_owned = ptr_is_owned(this_obj);
41702         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
41703         UpdateFulfillHTLC_free(this_obj_conv);
41704 }
41705
41706 int8_tArray  __attribute__((export_name("TS_UpdateFulfillHTLC_get_channel_id"))) TS_UpdateFulfillHTLC_get_channel_id(uint64_t this_ptr) {
41707         LDKUpdateFulfillHTLC this_ptr_conv;
41708         this_ptr_conv.inner = untag_ptr(this_ptr);
41709         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
41710         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
41711         this_ptr_conv.is_owned = false;
41712         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
41713         memcpy(ret_arr->elems, *UpdateFulfillHTLC_get_channel_id(&this_ptr_conv), 32);
41714         return ret_arr;
41715 }
41716
41717 void  __attribute__((export_name("TS_UpdateFulfillHTLC_set_channel_id"))) TS_UpdateFulfillHTLC_set_channel_id(uint64_t this_ptr, int8_tArray val) {
41718         LDKUpdateFulfillHTLC this_ptr_conv;
41719         this_ptr_conv.inner = untag_ptr(this_ptr);
41720         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
41721         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
41722         this_ptr_conv.is_owned = false;
41723         LDKThirtyTwoBytes val_ref;
41724         CHECK(val->arr_len == 32);
41725         memcpy(val_ref.data, val->elems, 32); FREE(val);
41726         UpdateFulfillHTLC_set_channel_id(&this_ptr_conv, val_ref);
41727 }
41728
41729 int64_t  __attribute__((export_name("TS_UpdateFulfillHTLC_get_htlc_id"))) TS_UpdateFulfillHTLC_get_htlc_id(uint64_t this_ptr) {
41730         LDKUpdateFulfillHTLC this_ptr_conv;
41731         this_ptr_conv.inner = untag_ptr(this_ptr);
41732         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
41733         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
41734         this_ptr_conv.is_owned = false;
41735         int64_t ret_conv = UpdateFulfillHTLC_get_htlc_id(&this_ptr_conv);
41736         return ret_conv;
41737 }
41738
41739 void  __attribute__((export_name("TS_UpdateFulfillHTLC_set_htlc_id"))) TS_UpdateFulfillHTLC_set_htlc_id(uint64_t this_ptr, int64_t val) {
41740         LDKUpdateFulfillHTLC this_ptr_conv;
41741         this_ptr_conv.inner = untag_ptr(this_ptr);
41742         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
41743         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
41744         this_ptr_conv.is_owned = false;
41745         UpdateFulfillHTLC_set_htlc_id(&this_ptr_conv, val);
41746 }
41747
41748 int8_tArray  __attribute__((export_name("TS_UpdateFulfillHTLC_get_payment_preimage"))) TS_UpdateFulfillHTLC_get_payment_preimage(uint64_t this_ptr) {
41749         LDKUpdateFulfillHTLC this_ptr_conv;
41750         this_ptr_conv.inner = untag_ptr(this_ptr);
41751         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
41752         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
41753         this_ptr_conv.is_owned = false;
41754         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
41755         memcpy(ret_arr->elems, *UpdateFulfillHTLC_get_payment_preimage(&this_ptr_conv), 32);
41756         return ret_arr;
41757 }
41758
41759 void  __attribute__((export_name("TS_UpdateFulfillHTLC_set_payment_preimage"))) TS_UpdateFulfillHTLC_set_payment_preimage(uint64_t this_ptr, int8_tArray val) {
41760         LDKUpdateFulfillHTLC this_ptr_conv;
41761         this_ptr_conv.inner = untag_ptr(this_ptr);
41762         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
41763         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
41764         this_ptr_conv.is_owned = false;
41765         LDKThirtyTwoBytes val_ref;
41766         CHECK(val->arr_len == 32);
41767         memcpy(val_ref.data, val->elems, 32); FREE(val);
41768         UpdateFulfillHTLC_set_payment_preimage(&this_ptr_conv, val_ref);
41769 }
41770
41771 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) {
41772         LDKThirtyTwoBytes channel_id_arg_ref;
41773         CHECK(channel_id_arg->arr_len == 32);
41774         memcpy(channel_id_arg_ref.data, channel_id_arg->elems, 32); FREE(channel_id_arg);
41775         LDKThirtyTwoBytes payment_preimage_arg_ref;
41776         CHECK(payment_preimage_arg->arr_len == 32);
41777         memcpy(payment_preimage_arg_ref.data, payment_preimage_arg->elems, 32); FREE(payment_preimage_arg);
41778         LDKUpdateFulfillHTLC ret_var = UpdateFulfillHTLC_new(channel_id_arg_ref, htlc_id_arg, payment_preimage_arg_ref);
41779         uint64_t ret_ref = 0;
41780         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
41781         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
41782         return ret_ref;
41783 }
41784
41785 static inline uint64_t UpdateFulfillHTLC_clone_ptr(LDKUpdateFulfillHTLC *NONNULL_PTR arg) {
41786         LDKUpdateFulfillHTLC ret_var = UpdateFulfillHTLC_clone(arg);
41787         uint64_t ret_ref = 0;
41788         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
41789         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
41790         return ret_ref;
41791 }
41792 int64_t  __attribute__((export_name("TS_UpdateFulfillHTLC_clone_ptr"))) TS_UpdateFulfillHTLC_clone_ptr(uint64_t arg) {
41793         LDKUpdateFulfillHTLC arg_conv;
41794         arg_conv.inner = untag_ptr(arg);
41795         arg_conv.is_owned = ptr_is_owned(arg);
41796         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
41797         arg_conv.is_owned = false;
41798         int64_t ret_conv = UpdateFulfillHTLC_clone_ptr(&arg_conv);
41799         return ret_conv;
41800 }
41801
41802 uint64_t  __attribute__((export_name("TS_UpdateFulfillHTLC_clone"))) TS_UpdateFulfillHTLC_clone(uint64_t orig) {
41803         LDKUpdateFulfillHTLC orig_conv;
41804         orig_conv.inner = untag_ptr(orig);
41805         orig_conv.is_owned = ptr_is_owned(orig);
41806         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
41807         orig_conv.is_owned = false;
41808         LDKUpdateFulfillHTLC ret_var = UpdateFulfillHTLC_clone(&orig_conv);
41809         uint64_t ret_ref = 0;
41810         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
41811         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
41812         return ret_ref;
41813 }
41814
41815 jboolean  __attribute__((export_name("TS_UpdateFulfillHTLC_eq"))) TS_UpdateFulfillHTLC_eq(uint64_t a, uint64_t b) {
41816         LDKUpdateFulfillHTLC a_conv;
41817         a_conv.inner = untag_ptr(a);
41818         a_conv.is_owned = ptr_is_owned(a);
41819         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
41820         a_conv.is_owned = false;
41821         LDKUpdateFulfillHTLC b_conv;
41822         b_conv.inner = untag_ptr(b);
41823         b_conv.is_owned = ptr_is_owned(b);
41824         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
41825         b_conv.is_owned = false;
41826         jboolean ret_conv = UpdateFulfillHTLC_eq(&a_conv, &b_conv);
41827         return ret_conv;
41828 }
41829
41830 void  __attribute__((export_name("TS_UpdateFailHTLC_free"))) TS_UpdateFailHTLC_free(uint64_t this_obj) {
41831         LDKUpdateFailHTLC this_obj_conv;
41832         this_obj_conv.inner = untag_ptr(this_obj);
41833         this_obj_conv.is_owned = ptr_is_owned(this_obj);
41834         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
41835         UpdateFailHTLC_free(this_obj_conv);
41836 }
41837
41838 int8_tArray  __attribute__((export_name("TS_UpdateFailHTLC_get_channel_id"))) TS_UpdateFailHTLC_get_channel_id(uint64_t this_ptr) {
41839         LDKUpdateFailHTLC this_ptr_conv;
41840         this_ptr_conv.inner = untag_ptr(this_ptr);
41841         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
41842         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
41843         this_ptr_conv.is_owned = false;
41844         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
41845         memcpy(ret_arr->elems, *UpdateFailHTLC_get_channel_id(&this_ptr_conv), 32);
41846         return ret_arr;
41847 }
41848
41849 void  __attribute__((export_name("TS_UpdateFailHTLC_set_channel_id"))) TS_UpdateFailHTLC_set_channel_id(uint64_t this_ptr, int8_tArray val) {
41850         LDKUpdateFailHTLC this_ptr_conv;
41851         this_ptr_conv.inner = untag_ptr(this_ptr);
41852         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
41853         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
41854         this_ptr_conv.is_owned = false;
41855         LDKThirtyTwoBytes val_ref;
41856         CHECK(val->arr_len == 32);
41857         memcpy(val_ref.data, val->elems, 32); FREE(val);
41858         UpdateFailHTLC_set_channel_id(&this_ptr_conv, val_ref);
41859 }
41860
41861 int64_t  __attribute__((export_name("TS_UpdateFailHTLC_get_htlc_id"))) TS_UpdateFailHTLC_get_htlc_id(uint64_t this_ptr) {
41862         LDKUpdateFailHTLC this_ptr_conv;
41863         this_ptr_conv.inner = untag_ptr(this_ptr);
41864         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
41865         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
41866         this_ptr_conv.is_owned = false;
41867         int64_t ret_conv = UpdateFailHTLC_get_htlc_id(&this_ptr_conv);
41868         return ret_conv;
41869 }
41870
41871 void  __attribute__((export_name("TS_UpdateFailHTLC_set_htlc_id"))) TS_UpdateFailHTLC_set_htlc_id(uint64_t this_ptr, int64_t val) {
41872         LDKUpdateFailHTLC this_ptr_conv;
41873         this_ptr_conv.inner = untag_ptr(this_ptr);
41874         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
41875         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
41876         this_ptr_conv.is_owned = false;
41877         UpdateFailHTLC_set_htlc_id(&this_ptr_conv, val);
41878 }
41879
41880 static inline uint64_t UpdateFailHTLC_clone_ptr(LDKUpdateFailHTLC *NONNULL_PTR arg) {
41881         LDKUpdateFailHTLC ret_var = UpdateFailHTLC_clone(arg);
41882         uint64_t ret_ref = 0;
41883         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
41884         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
41885         return ret_ref;
41886 }
41887 int64_t  __attribute__((export_name("TS_UpdateFailHTLC_clone_ptr"))) TS_UpdateFailHTLC_clone_ptr(uint64_t arg) {
41888         LDKUpdateFailHTLC arg_conv;
41889         arg_conv.inner = untag_ptr(arg);
41890         arg_conv.is_owned = ptr_is_owned(arg);
41891         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
41892         arg_conv.is_owned = false;
41893         int64_t ret_conv = UpdateFailHTLC_clone_ptr(&arg_conv);
41894         return ret_conv;
41895 }
41896
41897 uint64_t  __attribute__((export_name("TS_UpdateFailHTLC_clone"))) TS_UpdateFailHTLC_clone(uint64_t orig) {
41898         LDKUpdateFailHTLC orig_conv;
41899         orig_conv.inner = untag_ptr(orig);
41900         orig_conv.is_owned = ptr_is_owned(orig);
41901         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
41902         orig_conv.is_owned = false;
41903         LDKUpdateFailHTLC ret_var = UpdateFailHTLC_clone(&orig_conv);
41904         uint64_t ret_ref = 0;
41905         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
41906         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
41907         return ret_ref;
41908 }
41909
41910 jboolean  __attribute__((export_name("TS_UpdateFailHTLC_eq"))) TS_UpdateFailHTLC_eq(uint64_t a, uint64_t b) {
41911         LDKUpdateFailHTLC a_conv;
41912         a_conv.inner = untag_ptr(a);
41913         a_conv.is_owned = ptr_is_owned(a);
41914         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
41915         a_conv.is_owned = false;
41916         LDKUpdateFailHTLC b_conv;
41917         b_conv.inner = untag_ptr(b);
41918         b_conv.is_owned = ptr_is_owned(b);
41919         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
41920         b_conv.is_owned = false;
41921         jboolean ret_conv = UpdateFailHTLC_eq(&a_conv, &b_conv);
41922         return ret_conv;
41923 }
41924
41925 void  __attribute__((export_name("TS_UpdateFailMalformedHTLC_free"))) TS_UpdateFailMalformedHTLC_free(uint64_t this_obj) {
41926         LDKUpdateFailMalformedHTLC this_obj_conv;
41927         this_obj_conv.inner = untag_ptr(this_obj);
41928         this_obj_conv.is_owned = ptr_is_owned(this_obj);
41929         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
41930         UpdateFailMalformedHTLC_free(this_obj_conv);
41931 }
41932
41933 int8_tArray  __attribute__((export_name("TS_UpdateFailMalformedHTLC_get_channel_id"))) TS_UpdateFailMalformedHTLC_get_channel_id(uint64_t this_ptr) {
41934         LDKUpdateFailMalformedHTLC this_ptr_conv;
41935         this_ptr_conv.inner = untag_ptr(this_ptr);
41936         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
41937         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
41938         this_ptr_conv.is_owned = false;
41939         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
41940         memcpy(ret_arr->elems, *UpdateFailMalformedHTLC_get_channel_id(&this_ptr_conv), 32);
41941         return ret_arr;
41942 }
41943
41944 void  __attribute__((export_name("TS_UpdateFailMalformedHTLC_set_channel_id"))) TS_UpdateFailMalformedHTLC_set_channel_id(uint64_t this_ptr, int8_tArray val) {
41945         LDKUpdateFailMalformedHTLC this_ptr_conv;
41946         this_ptr_conv.inner = untag_ptr(this_ptr);
41947         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
41948         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
41949         this_ptr_conv.is_owned = false;
41950         LDKThirtyTwoBytes val_ref;
41951         CHECK(val->arr_len == 32);
41952         memcpy(val_ref.data, val->elems, 32); FREE(val);
41953         UpdateFailMalformedHTLC_set_channel_id(&this_ptr_conv, val_ref);
41954 }
41955
41956 int64_t  __attribute__((export_name("TS_UpdateFailMalformedHTLC_get_htlc_id"))) TS_UpdateFailMalformedHTLC_get_htlc_id(uint64_t this_ptr) {
41957         LDKUpdateFailMalformedHTLC this_ptr_conv;
41958         this_ptr_conv.inner = untag_ptr(this_ptr);
41959         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
41960         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
41961         this_ptr_conv.is_owned = false;
41962         int64_t ret_conv = UpdateFailMalformedHTLC_get_htlc_id(&this_ptr_conv);
41963         return ret_conv;
41964 }
41965
41966 void  __attribute__((export_name("TS_UpdateFailMalformedHTLC_set_htlc_id"))) TS_UpdateFailMalformedHTLC_set_htlc_id(uint64_t this_ptr, int64_t val) {
41967         LDKUpdateFailMalformedHTLC this_ptr_conv;
41968         this_ptr_conv.inner = untag_ptr(this_ptr);
41969         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
41970         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
41971         this_ptr_conv.is_owned = false;
41972         UpdateFailMalformedHTLC_set_htlc_id(&this_ptr_conv, val);
41973 }
41974
41975 int16_t  __attribute__((export_name("TS_UpdateFailMalformedHTLC_get_failure_code"))) TS_UpdateFailMalformedHTLC_get_failure_code(uint64_t this_ptr) {
41976         LDKUpdateFailMalformedHTLC this_ptr_conv;
41977         this_ptr_conv.inner = untag_ptr(this_ptr);
41978         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
41979         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
41980         this_ptr_conv.is_owned = false;
41981         int16_t ret_conv = UpdateFailMalformedHTLC_get_failure_code(&this_ptr_conv);
41982         return ret_conv;
41983 }
41984
41985 void  __attribute__((export_name("TS_UpdateFailMalformedHTLC_set_failure_code"))) TS_UpdateFailMalformedHTLC_set_failure_code(uint64_t this_ptr, int16_t val) {
41986         LDKUpdateFailMalformedHTLC this_ptr_conv;
41987         this_ptr_conv.inner = untag_ptr(this_ptr);
41988         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
41989         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
41990         this_ptr_conv.is_owned = false;
41991         UpdateFailMalformedHTLC_set_failure_code(&this_ptr_conv, val);
41992 }
41993
41994 static inline uint64_t UpdateFailMalformedHTLC_clone_ptr(LDKUpdateFailMalformedHTLC *NONNULL_PTR arg) {
41995         LDKUpdateFailMalformedHTLC ret_var = UpdateFailMalformedHTLC_clone(arg);
41996         uint64_t ret_ref = 0;
41997         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
41998         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
41999         return ret_ref;
42000 }
42001 int64_t  __attribute__((export_name("TS_UpdateFailMalformedHTLC_clone_ptr"))) TS_UpdateFailMalformedHTLC_clone_ptr(uint64_t arg) {
42002         LDKUpdateFailMalformedHTLC arg_conv;
42003         arg_conv.inner = untag_ptr(arg);
42004         arg_conv.is_owned = ptr_is_owned(arg);
42005         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
42006         arg_conv.is_owned = false;
42007         int64_t ret_conv = UpdateFailMalformedHTLC_clone_ptr(&arg_conv);
42008         return ret_conv;
42009 }
42010
42011 uint64_t  __attribute__((export_name("TS_UpdateFailMalformedHTLC_clone"))) TS_UpdateFailMalformedHTLC_clone(uint64_t orig) {
42012         LDKUpdateFailMalformedHTLC orig_conv;
42013         orig_conv.inner = untag_ptr(orig);
42014         orig_conv.is_owned = ptr_is_owned(orig);
42015         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
42016         orig_conv.is_owned = false;
42017         LDKUpdateFailMalformedHTLC ret_var = UpdateFailMalformedHTLC_clone(&orig_conv);
42018         uint64_t ret_ref = 0;
42019         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
42020         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
42021         return ret_ref;
42022 }
42023
42024 jboolean  __attribute__((export_name("TS_UpdateFailMalformedHTLC_eq"))) TS_UpdateFailMalformedHTLC_eq(uint64_t a, uint64_t b) {
42025         LDKUpdateFailMalformedHTLC a_conv;
42026         a_conv.inner = untag_ptr(a);
42027         a_conv.is_owned = ptr_is_owned(a);
42028         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
42029         a_conv.is_owned = false;
42030         LDKUpdateFailMalformedHTLC b_conv;
42031         b_conv.inner = untag_ptr(b);
42032         b_conv.is_owned = ptr_is_owned(b);
42033         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
42034         b_conv.is_owned = false;
42035         jboolean ret_conv = UpdateFailMalformedHTLC_eq(&a_conv, &b_conv);
42036         return ret_conv;
42037 }
42038
42039 void  __attribute__((export_name("TS_CommitmentSigned_free"))) TS_CommitmentSigned_free(uint64_t this_obj) {
42040         LDKCommitmentSigned this_obj_conv;
42041         this_obj_conv.inner = untag_ptr(this_obj);
42042         this_obj_conv.is_owned = ptr_is_owned(this_obj);
42043         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
42044         CommitmentSigned_free(this_obj_conv);
42045 }
42046
42047 int8_tArray  __attribute__((export_name("TS_CommitmentSigned_get_channel_id"))) TS_CommitmentSigned_get_channel_id(uint64_t this_ptr) {
42048         LDKCommitmentSigned this_ptr_conv;
42049         this_ptr_conv.inner = untag_ptr(this_ptr);
42050         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
42051         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
42052         this_ptr_conv.is_owned = false;
42053         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
42054         memcpy(ret_arr->elems, *CommitmentSigned_get_channel_id(&this_ptr_conv), 32);
42055         return ret_arr;
42056 }
42057
42058 void  __attribute__((export_name("TS_CommitmentSigned_set_channel_id"))) TS_CommitmentSigned_set_channel_id(uint64_t this_ptr, int8_tArray val) {
42059         LDKCommitmentSigned this_ptr_conv;
42060         this_ptr_conv.inner = untag_ptr(this_ptr);
42061         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
42062         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
42063         this_ptr_conv.is_owned = false;
42064         LDKThirtyTwoBytes val_ref;
42065         CHECK(val->arr_len == 32);
42066         memcpy(val_ref.data, val->elems, 32); FREE(val);
42067         CommitmentSigned_set_channel_id(&this_ptr_conv, val_ref);
42068 }
42069
42070 int8_tArray  __attribute__((export_name("TS_CommitmentSigned_get_signature"))) TS_CommitmentSigned_get_signature(uint64_t this_ptr) {
42071         LDKCommitmentSigned this_ptr_conv;
42072         this_ptr_conv.inner = untag_ptr(this_ptr);
42073         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
42074         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
42075         this_ptr_conv.is_owned = false;
42076         int8_tArray ret_arr = init_int8_tArray(64, __LINE__);
42077         memcpy(ret_arr->elems, CommitmentSigned_get_signature(&this_ptr_conv).compact_form, 64);
42078         return ret_arr;
42079 }
42080
42081 void  __attribute__((export_name("TS_CommitmentSigned_set_signature"))) TS_CommitmentSigned_set_signature(uint64_t this_ptr, int8_tArray val) {
42082         LDKCommitmentSigned this_ptr_conv;
42083         this_ptr_conv.inner = untag_ptr(this_ptr);
42084         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
42085         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
42086         this_ptr_conv.is_owned = false;
42087         LDKECDSASignature val_ref;
42088         CHECK(val->arr_len == 64);
42089         memcpy(val_ref.compact_form, val->elems, 64); FREE(val);
42090         CommitmentSigned_set_signature(&this_ptr_conv, val_ref);
42091 }
42092
42093 ptrArray  __attribute__((export_name("TS_CommitmentSigned_get_htlc_signatures"))) TS_CommitmentSigned_get_htlc_signatures(uint64_t this_ptr) {
42094         LDKCommitmentSigned this_ptr_conv;
42095         this_ptr_conv.inner = untag_ptr(this_ptr);
42096         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
42097         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
42098         this_ptr_conv.is_owned = false;
42099         LDKCVec_ECDSASignatureZ ret_var = CommitmentSigned_get_htlc_signatures(&this_ptr_conv);
42100         ptrArray ret_arr = NULL;
42101         ret_arr = init_ptrArray(ret_var.datalen, __LINE__);
42102         int8_tArray *ret_arr_ptr = (int8_tArray*)(((uint8_t*)ret_arr) + 8);
42103         for (size_t m = 0; m < ret_var.datalen; m++) {
42104                 int8_tArray ret_conv_12_arr = init_int8_tArray(64, __LINE__);
42105                 memcpy(ret_conv_12_arr->elems, ret_var.data[m].compact_form, 64);
42106                 ret_arr_ptr[m] = ret_conv_12_arr;
42107         }
42108         
42109         FREE(ret_var.data);
42110         return ret_arr;
42111 }
42112
42113 void  __attribute__((export_name("TS_CommitmentSigned_set_htlc_signatures"))) TS_CommitmentSigned_set_htlc_signatures(uint64_t this_ptr, ptrArray val) {
42114         LDKCommitmentSigned this_ptr_conv;
42115         this_ptr_conv.inner = untag_ptr(this_ptr);
42116         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
42117         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
42118         this_ptr_conv.is_owned = false;
42119         LDKCVec_ECDSASignatureZ val_constr;
42120         val_constr.datalen = val->arr_len;
42121         if (val_constr.datalen > 0)
42122                 val_constr.data = MALLOC(val_constr.datalen * sizeof(LDKECDSASignature), "LDKCVec_ECDSASignatureZ Elements");
42123         else
42124                 val_constr.data = NULL;
42125         int8_tArray* val_vals = (void*) val->elems;
42126         for (size_t m = 0; m < val_constr.datalen; m++) {
42127                 int8_tArray val_conv_12 = val_vals[m];
42128                 LDKECDSASignature val_conv_12_ref;
42129                 CHECK(val_conv_12->arr_len == 64);
42130                 memcpy(val_conv_12_ref.compact_form, val_conv_12->elems, 64); FREE(val_conv_12);
42131                 val_constr.data[m] = val_conv_12_ref;
42132         }
42133         FREE(val);
42134         CommitmentSigned_set_htlc_signatures(&this_ptr_conv, val_constr);
42135 }
42136
42137 uint64_t  __attribute__((export_name("TS_CommitmentSigned_new"))) TS_CommitmentSigned_new(int8_tArray channel_id_arg, int8_tArray signature_arg, ptrArray htlc_signatures_arg) {
42138         LDKThirtyTwoBytes channel_id_arg_ref;
42139         CHECK(channel_id_arg->arr_len == 32);
42140         memcpy(channel_id_arg_ref.data, channel_id_arg->elems, 32); FREE(channel_id_arg);
42141         LDKECDSASignature signature_arg_ref;
42142         CHECK(signature_arg->arr_len == 64);
42143         memcpy(signature_arg_ref.compact_form, signature_arg->elems, 64); FREE(signature_arg);
42144         LDKCVec_ECDSASignatureZ htlc_signatures_arg_constr;
42145         htlc_signatures_arg_constr.datalen = htlc_signatures_arg->arr_len;
42146         if (htlc_signatures_arg_constr.datalen > 0)
42147                 htlc_signatures_arg_constr.data = MALLOC(htlc_signatures_arg_constr.datalen * sizeof(LDKECDSASignature), "LDKCVec_ECDSASignatureZ Elements");
42148         else
42149                 htlc_signatures_arg_constr.data = NULL;
42150         int8_tArray* htlc_signatures_arg_vals = (void*) htlc_signatures_arg->elems;
42151         for (size_t m = 0; m < htlc_signatures_arg_constr.datalen; m++) {
42152                 int8_tArray htlc_signatures_arg_conv_12 = htlc_signatures_arg_vals[m];
42153                 LDKECDSASignature htlc_signatures_arg_conv_12_ref;
42154                 CHECK(htlc_signatures_arg_conv_12->arr_len == 64);
42155                 memcpy(htlc_signatures_arg_conv_12_ref.compact_form, htlc_signatures_arg_conv_12->elems, 64); FREE(htlc_signatures_arg_conv_12);
42156                 htlc_signatures_arg_constr.data[m] = htlc_signatures_arg_conv_12_ref;
42157         }
42158         FREE(htlc_signatures_arg);
42159         LDKCommitmentSigned ret_var = CommitmentSigned_new(channel_id_arg_ref, signature_arg_ref, htlc_signatures_arg_constr);
42160         uint64_t ret_ref = 0;
42161         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
42162         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
42163         return ret_ref;
42164 }
42165
42166 static inline uint64_t CommitmentSigned_clone_ptr(LDKCommitmentSigned *NONNULL_PTR arg) {
42167         LDKCommitmentSigned ret_var = CommitmentSigned_clone(arg);
42168         uint64_t ret_ref = 0;
42169         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
42170         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
42171         return ret_ref;
42172 }
42173 int64_t  __attribute__((export_name("TS_CommitmentSigned_clone_ptr"))) TS_CommitmentSigned_clone_ptr(uint64_t arg) {
42174         LDKCommitmentSigned arg_conv;
42175         arg_conv.inner = untag_ptr(arg);
42176         arg_conv.is_owned = ptr_is_owned(arg);
42177         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
42178         arg_conv.is_owned = false;
42179         int64_t ret_conv = CommitmentSigned_clone_ptr(&arg_conv);
42180         return ret_conv;
42181 }
42182
42183 uint64_t  __attribute__((export_name("TS_CommitmentSigned_clone"))) TS_CommitmentSigned_clone(uint64_t orig) {
42184         LDKCommitmentSigned orig_conv;
42185         orig_conv.inner = untag_ptr(orig);
42186         orig_conv.is_owned = ptr_is_owned(orig);
42187         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
42188         orig_conv.is_owned = false;
42189         LDKCommitmentSigned ret_var = CommitmentSigned_clone(&orig_conv);
42190         uint64_t ret_ref = 0;
42191         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
42192         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
42193         return ret_ref;
42194 }
42195
42196 jboolean  __attribute__((export_name("TS_CommitmentSigned_eq"))) TS_CommitmentSigned_eq(uint64_t a, uint64_t b) {
42197         LDKCommitmentSigned a_conv;
42198         a_conv.inner = untag_ptr(a);
42199         a_conv.is_owned = ptr_is_owned(a);
42200         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
42201         a_conv.is_owned = false;
42202         LDKCommitmentSigned b_conv;
42203         b_conv.inner = untag_ptr(b);
42204         b_conv.is_owned = ptr_is_owned(b);
42205         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
42206         b_conv.is_owned = false;
42207         jboolean ret_conv = CommitmentSigned_eq(&a_conv, &b_conv);
42208         return ret_conv;
42209 }
42210
42211 void  __attribute__((export_name("TS_RevokeAndACK_free"))) TS_RevokeAndACK_free(uint64_t this_obj) {
42212         LDKRevokeAndACK this_obj_conv;
42213         this_obj_conv.inner = untag_ptr(this_obj);
42214         this_obj_conv.is_owned = ptr_is_owned(this_obj);
42215         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
42216         RevokeAndACK_free(this_obj_conv);
42217 }
42218
42219 int8_tArray  __attribute__((export_name("TS_RevokeAndACK_get_channel_id"))) TS_RevokeAndACK_get_channel_id(uint64_t this_ptr) {
42220         LDKRevokeAndACK this_ptr_conv;
42221         this_ptr_conv.inner = untag_ptr(this_ptr);
42222         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
42223         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
42224         this_ptr_conv.is_owned = false;
42225         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
42226         memcpy(ret_arr->elems, *RevokeAndACK_get_channel_id(&this_ptr_conv), 32);
42227         return ret_arr;
42228 }
42229
42230 void  __attribute__((export_name("TS_RevokeAndACK_set_channel_id"))) TS_RevokeAndACK_set_channel_id(uint64_t this_ptr, int8_tArray val) {
42231         LDKRevokeAndACK this_ptr_conv;
42232         this_ptr_conv.inner = untag_ptr(this_ptr);
42233         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
42234         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
42235         this_ptr_conv.is_owned = false;
42236         LDKThirtyTwoBytes val_ref;
42237         CHECK(val->arr_len == 32);
42238         memcpy(val_ref.data, val->elems, 32); FREE(val);
42239         RevokeAndACK_set_channel_id(&this_ptr_conv, val_ref);
42240 }
42241
42242 int8_tArray  __attribute__((export_name("TS_RevokeAndACK_get_per_commitment_secret"))) TS_RevokeAndACK_get_per_commitment_secret(uint64_t this_ptr) {
42243         LDKRevokeAndACK this_ptr_conv;
42244         this_ptr_conv.inner = untag_ptr(this_ptr);
42245         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
42246         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
42247         this_ptr_conv.is_owned = false;
42248         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
42249         memcpy(ret_arr->elems, *RevokeAndACK_get_per_commitment_secret(&this_ptr_conv), 32);
42250         return ret_arr;
42251 }
42252
42253 void  __attribute__((export_name("TS_RevokeAndACK_set_per_commitment_secret"))) TS_RevokeAndACK_set_per_commitment_secret(uint64_t this_ptr, int8_tArray val) {
42254         LDKRevokeAndACK this_ptr_conv;
42255         this_ptr_conv.inner = untag_ptr(this_ptr);
42256         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
42257         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
42258         this_ptr_conv.is_owned = false;
42259         LDKThirtyTwoBytes val_ref;
42260         CHECK(val->arr_len == 32);
42261         memcpy(val_ref.data, val->elems, 32); FREE(val);
42262         RevokeAndACK_set_per_commitment_secret(&this_ptr_conv, val_ref);
42263 }
42264
42265 int8_tArray  __attribute__((export_name("TS_RevokeAndACK_get_next_per_commitment_point"))) TS_RevokeAndACK_get_next_per_commitment_point(uint64_t this_ptr) {
42266         LDKRevokeAndACK this_ptr_conv;
42267         this_ptr_conv.inner = untag_ptr(this_ptr);
42268         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
42269         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
42270         this_ptr_conv.is_owned = false;
42271         int8_tArray ret_arr = init_int8_tArray(33, __LINE__);
42272         memcpy(ret_arr->elems, RevokeAndACK_get_next_per_commitment_point(&this_ptr_conv).compressed_form, 33);
42273         return ret_arr;
42274 }
42275
42276 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) {
42277         LDKRevokeAndACK this_ptr_conv;
42278         this_ptr_conv.inner = untag_ptr(this_ptr);
42279         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
42280         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
42281         this_ptr_conv.is_owned = false;
42282         LDKPublicKey val_ref;
42283         CHECK(val->arr_len == 33);
42284         memcpy(val_ref.compressed_form, val->elems, 33); FREE(val);
42285         RevokeAndACK_set_next_per_commitment_point(&this_ptr_conv, val_ref);
42286 }
42287
42288 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) {
42289         LDKThirtyTwoBytes channel_id_arg_ref;
42290         CHECK(channel_id_arg->arr_len == 32);
42291         memcpy(channel_id_arg_ref.data, channel_id_arg->elems, 32); FREE(channel_id_arg);
42292         LDKThirtyTwoBytes per_commitment_secret_arg_ref;
42293         CHECK(per_commitment_secret_arg->arr_len == 32);
42294         memcpy(per_commitment_secret_arg_ref.data, per_commitment_secret_arg->elems, 32); FREE(per_commitment_secret_arg);
42295         LDKPublicKey next_per_commitment_point_arg_ref;
42296         CHECK(next_per_commitment_point_arg->arr_len == 33);
42297         memcpy(next_per_commitment_point_arg_ref.compressed_form, next_per_commitment_point_arg->elems, 33); FREE(next_per_commitment_point_arg);
42298         LDKRevokeAndACK ret_var = RevokeAndACK_new(channel_id_arg_ref, per_commitment_secret_arg_ref, next_per_commitment_point_arg_ref);
42299         uint64_t ret_ref = 0;
42300         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
42301         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
42302         return ret_ref;
42303 }
42304
42305 static inline uint64_t RevokeAndACK_clone_ptr(LDKRevokeAndACK *NONNULL_PTR arg) {
42306         LDKRevokeAndACK ret_var = RevokeAndACK_clone(arg);
42307         uint64_t ret_ref = 0;
42308         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
42309         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
42310         return ret_ref;
42311 }
42312 int64_t  __attribute__((export_name("TS_RevokeAndACK_clone_ptr"))) TS_RevokeAndACK_clone_ptr(uint64_t arg) {
42313         LDKRevokeAndACK arg_conv;
42314         arg_conv.inner = untag_ptr(arg);
42315         arg_conv.is_owned = ptr_is_owned(arg);
42316         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
42317         arg_conv.is_owned = false;
42318         int64_t ret_conv = RevokeAndACK_clone_ptr(&arg_conv);
42319         return ret_conv;
42320 }
42321
42322 uint64_t  __attribute__((export_name("TS_RevokeAndACK_clone"))) TS_RevokeAndACK_clone(uint64_t orig) {
42323         LDKRevokeAndACK orig_conv;
42324         orig_conv.inner = untag_ptr(orig);
42325         orig_conv.is_owned = ptr_is_owned(orig);
42326         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
42327         orig_conv.is_owned = false;
42328         LDKRevokeAndACK ret_var = RevokeAndACK_clone(&orig_conv);
42329         uint64_t ret_ref = 0;
42330         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
42331         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
42332         return ret_ref;
42333 }
42334
42335 jboolean  __attribute__((export_name("TS_RevokeAndACK_eq"))) TS_RevokeAndACK_eq(uint64_t a, uint64_t b) {
42336         LDKRevokeAndACK a_conv;
42337         a_conv.inner = untag_ptr(a);
42338         a_conv.is_owned = ptr_is_owned(a);
42339         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
42340         a_conv.is_owned = false;
42341         LDKRevokeAndACK b_conv;
42342         b_conv.inner = untag_ptr(b);
42343         b_conv.is_owned = ptr_is_owned(b);
42344         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
42345         b_conv.is_owned = false;
42346         jboolean ret_conv = RevokeAndACK_eq(&a_conv, &b_conv);
42347         return ret_conv;
42348 }
42349
42350 void  __attribute__((export_name("TS_UpdateFee_free"))) TS_UpdateFee_free(uint64_t this_obj) {
42351         LDKUpdateFee this_obj_conv;
42352         this_obj_conv.inner = untag_ptr(this_obj);
42353         this_obj_conv.is_owned = ptr_is_owned(this_obj);
42354         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
42355         UpdateFee_free(this_obj_conv);
42356 }
42357
42358 int8_tArray  __attribute__((export_name("TS_UpdateFee_get_channel_id"))) TS_UpdateFee_get_channel_id(uint64_t this_ptr) {
42359         LDKUpdateFee this_ptr_conv;
42360         this_ptr_conv.inner = untag_ptr(this_ptr);
42361         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
42362         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
42363         this_ptr_conv.is_owned = false;
42364         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
42365         memcpy(ret_arr->elems, *UpdateFee_get_channel_id(&this_ptr_conv), 32);
42366         return ret_arr;
42367 }
42368
42369 void  __attribute__((export_name("TS_UpdateFee_set_channel_id"))) TS_UpdateFee_set_channel_id(uint64_t this_ptr, int8_tArray val) {
42370         LDKUpdateFee this_ptr_conv;
42371         this_ptr_conv.inner = untag_ptr(this_ptr);
42372         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
42373         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
42374         this_ptr_conv.is_owned = false;
42375         LDKThirtyTwoBytes val_ref;
42376         CHECK(val->arr_len == 32);
42377         memcpy(val_ref.data, val->elems, 32); FREE(val);
42378         UpdateFee_set_channel_id(&this_ptr_conv, val_ref);
42379 }
42380
42381 int32_t  __attribute__((export_name("TS_UpdateFee_get_feerate_per_kw"))) TS_UpdateFee_get_feerate_per_kw(uint64_t this_ptr) {
42382         LDKUpdateFee this_ptr_conv;
42383         this_ptr_conv.inner = untag_ptr(this_ptr);
42384         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
42385         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
42386         this_ptr_conv.is_owned = false;
42387         int32_t ret_conv = UpdateFee_get_feerate_per_kw(&this_ptr_conv);
42388         return ret_conv;
42389 }
42390
42391 void  __attribute__((export_name("TS_UpdateFee_set_feerate_per_kw"))) TS_UpdateFee_set_feerate_per_kw(uint64_t this_ptr, int32_t val) {
42392         LDKUpdateFee this_ptr_conv;
42393         this_ptr_conv.inner = untag_ptr(this_ptr);
42394         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
42395         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
42396         this_ptr_conv.is_owned = false;
42397         UpdateFee_set_feerate_per_kw(&this_ptr_conv, val);
42398 }
42399
42400 uint64_t  __attribute__((export_name("TS_UpdateFee_new"))) TS_UpdateFee_new(int8_tArray channel_id_arg, int32_t feerate_per_kw_arg) {
42401         LDKThirtyTwoBytes channel_id_arg_ref;
42402         CHECK(channel_id_arg->arr_len == 32);
42403         memcpy(channel_id_arg_ref.data, channel_id_arg->elems, 32); FREE(channel_id_arg);
42404         LDKUpdateFee ret_var = UpdateFee_new(channel_id_arg_ref, feerate_per_kw_arg);
42405         uint64_t ret_ref = 0;
42406         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
42407         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
42408         return ret_ref;
42409 }
42410
42411 static inline uint64_t UpdateFee_clone_ptr(LDKUpdateFee *NONNULL_PTR arg) {
42412         LDKUpdateFee ret_var = UpdateFee_clone(arg);
42413         uint64_t ret_ref = 0;
42414         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
42415         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
42416         return ret_ref;
42417 }
42418 int64_t  __attribute__((export_name("TS_UpdateFee_clone_ptr"))) TS_UpdateFee_clone_ptr(uint64_t arg) {
42419         LDKUpdateFee arg_conv;
42420         arg_conv.inner = untag_ptr(arg);
42421         arg_conv.is_owned = ptr_is_owned(arg);
42422         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
42423         arg_conv.is_owned = false;
42424         int64_t ret_conv = UpdateFee_clone_ptr(&arg_conv);
42425         return ret_conv;
42426 }
42427
42428 uint64_t  __attribute__((export_name("TS_UpdateFee_clone"))) TS_UpdateFee_clone(uint64_t orig) {
42429         LDKUpdateFee orig_conv;
42430         orig_conv.inner = untag_ptr(orig);
42431         orig_conv.is_owned = ptr_is_owned(orig);
42432         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
42433         orig_conv.is_owned = false;
42434         LDKUpdateFee ret_var = UpdateFee_clone(&orig_conv);
42435         uint64_t ret_ref = 0;
42436         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
42437         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
42438         return ret_ref;
42439 }
42440
42441 jboolean  __attribute__((export_name("TS_UpdateFee_eq"))) TS_UpdateFee_eq(uint64_t a, uint64_t b) {
42442         LDKUpdateFee a_conv;
42443         a_conv.inner = untag_ptr(a);
42444         a_conv.is_owned = ptr_is_owned(a);
42445         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
42446         a_conv.is_owned = false;
42447         LDKUpdateFee b_conv;
42448         b_conv.inner = untag_ptr(b);
42449         b_conv.is_owned = ptr_is_owned(b);
42450         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
42451         b_conv.is_owned = false;
42452         jboolean ret_conv = UpdateFee_eq(&a_conv, &b_conv);
42453         return ret_conv;
42454 }
42455
42456 void  __attribute__((export_name("TS_ChannelReestablish_free"))) TS_ChannelReestablish_free(uint64_t this_obj) {
42457         LDKChannelReestablish this_obj_conv;
42458         this_obj_conv.inner = untag_ptr(this_obj);
42459         this_obj_conv.is_owned = ptr_is_owned(this_obj);
42460         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
42461         ChannelReestablish_free(this_obj_conv);
42462 }
42463
42464 int8_tArray  __attribute__((export_name("TS_ChannelReestablish_get_channel_id"))) TS_ChannelReestablish_get_channel_id(uint64_t this_ptr) {
42465         LDKChannelReestablish this_ptr_conv;
42466         this_ptr_conv.inner = untag_ptr(this_ptr);
42467         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
42468         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
42469         this_ptr_conv.is_owned = false;
42470         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
42471         memcpy(ret_arr->elems, *ChannelReestablish_get_channel_id(&this_ptr_conv), 32);
42472         return ret_arr;
42473 }
42474
42475 void  __attribute__((export_name("TS_ChannelReestablish_set_channel_id"))) TS_ChannelReestablish_set_channel_id(uint64_t this_ptr, int8_tArray val) {
42476         LDKChannelReestablish this_ptr_conv;
42477         this_ptr_conv.inner = untag_ptr(this_ptr);
42478         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
42479         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
42480         this_ptr_conv.is_owned = false;
42481         LDKThirtyTwoBytes val_ref;
42482         CHECK(val->arr_len == 32);
42483         memcpy(val_ref.data, val->elems, 32); FREE(val);
42484         ChannelReestablish_set_channel_id(&this_ptr_conv, val_ref);
42485 }
42486
42487 int64_t  __attribute__((export_name("TS_ChannelReestablish_get_next_local_commitment_number"))) TS_ChannelReestablish_get_next_local_commitment_number(uint64_t this_ptr) {
42488         LDKChannelReestablish this_ptr_conv;
42489         this_ptr_conv.inner = untag_ptr(this_ptr);
42490         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
42491         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
42492         this_ptr_conv.is_owned = false;
42493         int64_t ret_conv = ChannelReestablish_get_next_local_commitment_number(&this_ptr_conv);
42494         return ret_conv;
42495 }
42496
42497 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) {
42498         LDKChannelReestablish this_ptr_conv;
42499         this_ptr_conv.inner = untag_ptr(this_ptr);
42500         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
42501         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
42502         this_ptr_conv.is_owned = false;
42503         ChannelReestablish_set_next_local_commitment_number(&this_ptr_conv, val);
42504 }
42505
42506 int64_t  __attribute__((export_name("TS_ChannelReestablish_get_next_remote_commitment_number"))) TS_ChannelReestablish_get_next_remote_commitment_number(uint64_t this_ptr) {
42507         LDKChannelReestablish this_ptr_conv;
42508         this_ptr_conv.inner = untag_ptr(this_ptr);
42509         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
42510         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
42511         this_ptr_conv.is_owned = false;
42512         int64_t ret_conv = ChannelReestablish_get_next_remote_commitment_number(&this_ptr_conv);
42513         return ret_conv;
42514 }
42515
42516 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) {
42517         LDKChannelReestablish this_ptr_conv;
42518         this_ptr_conv.inner = untag_ptr(this_ptr);
42519         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
42520         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
42521         this_ptr_conv.is_owned = false;
42522         ChannelReestablish_set_next_remote_commitment_number(&this_ptr_conv, val);
42523 }
42524
42525 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) {
42526         LDKChannelReestablish this_ptr_conv;
42527         this_ptr_conv.inner = untag_ptr(this_ptr);
42528         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
42529         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
42530         this_ptr_conv.is_owned = false;
42531         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
42532         memcpy(ret_arr->elems, *ChannelReestablish_get_your_last_per_commitment_secret(&this_ptr_conv), 32);
42533         return ret_arr;
42534 }
42535
42536 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) {
42537         LDKChannelReestablish this_ptr_conv;
42538         this_ptr_conv.inner = untag_ptr(this_ptr);
42539         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
42540         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
42541         this_ptr_conv.is_owned = false;
42542         LDKThirtyTwoBytes val_ref;
42543         CHECK(val->arr_len == 32);
42544         memcpy(val_ref.data, val->elems, 32); FREE(val);
42545         ChannelReestablish_set_your_last_per_commitment_secret(&this_ptr_conv, val_ref);
42546 }
42547
42548 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) {
42549         LDKChannelReestablish this_ptr_conv;
42550         this_ptr_conv.inner = untag_ptr(this_ptr);
42551         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
42552         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
42553         this_ptr_conv.is_owned = false;
42554         int8_tArray ret_arr = init_int8_tArray(33, __LINE__);
42555         memcpy(ret_arr->elems, ChannelReestablish_get_my_current_per_commitment_point(&this_ptr_conv).compressed_form, 33);
42556         return ret_arr;
42557 }
42558
42559 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) {
42560         LDKChannelReestablish this_ptr_conv;
42561         this_ptr_conv.inner = untag_ptr(this_ptr);
42562         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
42563         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
42564         this_ptr_conv.is_owned = false;
42565         LDKPublicKey val_ref;
42566         CHECK(val->arr_len == 33);
42567         memcpy(val_ref.compressed_form, val->elems, 33); FREE(val);
42568         ChannelReestablish_set_my_current_per_commitment_point(&this_ptr_conv, val_ref);
42569 }
42570
42571 uint64_t  __attribute__((export_name("TS_ChannelReestablish_get_next_funding_txid"))) TS_ChannelReestablish_get_next_funding_txid(uint64_t this_ptr) {
42572         LDKChannelReestablish this_ptr_conv;
42573         this_ptr_conv.inner = untag_ptr(this_ptr);
42574         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
42575         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
42576         this_ptr_conv.is_owned = false;
42577         LDKCOption_ThirtyTwoBytesZ *ret_copy = MALLOC(sizeof(LDKCOption_ThirtyTwoBytesZ), "LDKCOption_ThirtyTwoBytesZ");
42578         *ret_copy = ChannelReestablish_get_next_funding_txid(&this_ptr_conv);
42579         uint64_t ret_ref = tag_ptr(ret_copy, true);
42580         return ret_ref;
42581 }
42582
42583 void  __attribute__((export_name("TS_ChannelReestablish_set_next_funding_txid"))) TS_ChannelReestablish_set_next_funding_txid(uint64_t this_ptr, uint64_t val) {
42584         LDKChannelReestablish this_ptr_conv;
42585         this_ptr_conv.inner = untag_ptr(this_ptr);
42586         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
42587         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
42588         this_ptr_conv.is_owned = false;
42589         void* val_ptr = untag_ptr(val);
42590         CHECK_ACCESS(val_ptr);
42591         LDKCOption_ThirtyTwoBytesZ val_conv = *(LDKCOption_ThirtyTwoBytesZ*)(val_ptr);
42592         val_conv = COption_ThirtyTwoBytesZ_clone((LDKCOption_ThirtyTwoBytesZ*)untag_ptr(val));
42593         ChannelReestablish_set_next_funding_txid(&this_ptr_conv, val_conv);
42594 }
42595
42596 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) {
42597         LDKThirtyTwoBytes channel_id_arg_ref;
42598         CHECK(channel_id_arg->arr_len == 32);
42599         memcpy(channel_id_arg_ref.data, channel_id_arg->elems, 32); FREE(channel_id_arg);
42600         LDKThirtyTwoBytes your_last_per_commitment_secret_arg_ref;
42601         CHECK(your_last_per_commitment_secret_arg->arr_len == 32);
42602         memcpy(your_last_per_commitment_secret_arg_ref.data, your_last_per_commitment_secret_arg->elems, 32); FREE(your_last_per_commitment_secret_arg);
42603         LDKPublicKey my_current_per_commitment_point_arg_ref;
42604         CHECK(my_current_per_commitment_point_arg->arr_len == 33);
42605         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);
42606         void* next_funding_txid_arg_ptr = untag_ptr(next_funding_txid_arg);
42607         CHECK_ACCESS(next_funding_txid_arg_ptr);
42608         LDKCOption_ThirtyTwoBytesZ next_funding_txid_arg_conv = *(LDKCOption_ThirtyTwoBytesZ*)(next_funding_txid_arg_ptr);
42609         next_funding_txid_arg_conv = COption_ThirtyTwoBytesZ_clone((LDKCOption_ThirtyTwoBytesZ*)untag_ptr(next_funding_txid_arg));
42610         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);
42611         uint64_t ret_ref = 0;
42612         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
42613         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
42614         return ret_ref;
42615 }
42616
42617 static inline uint64_t ChannelReestablish_clone_ptr(LDKChannelReestablish *NONNULL_PTR arg) {
42618         LDKChannelReestablish ret_var = ChannelReestablish_clone(arg);
42619         uint64_t ret_ref = 0;
42620         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
42621         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
42622         return ret_ref;
42623 }
42624 int64_t  __attribute__((export_name("TS_ChannelReestablish_clone_ptr"))) TS_ChannelReestablish_clone_ptr(uint64_t arg) {
42625         LDKChannelReestablish arg_conv;
42626         arg_conv.inner = untag_ptr(arg);
42627         arg_conv.is_owned = ptr_is_owned(arg);
42628         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
42629         arg_conv.is_owned = false;
42630         int64_t ret_conv = ChannelReestablish_clone_ptr(&arg_conv);
42631         return ret_conv;
42632 }
42633
42634 uint64_t  __attribute__((export_name("TS_ChannelReestablish_clone"))) TS_ChannelReestablish_clone(uint64_t orig) {
42635         LDKChannelReestablish orig_conv;
42636         orig_conv.inner = untag_ptr(orig);
42637         orig_conv.is_owned = ptr_is_owned(orig);
42638         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
42639         orig_conv.is_owned = false;
42640         LDKChannelReestablish ret_var = ChannelReestablish_clone(&orig_conv);
42641         uint64_t ret_ref = 0;
42642         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
42643         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
42644         return ret_ref;
42645 }
42646
42647 jboolean  __attribute__((export_name("TS_ChannelReestablish_eq"))) TS_ChannelReestablish_eq(uint64_t a, uint64_t b) {
42648         LDKChannelReestablish a_conv;
42649         a_conv.inner = untag_ptr(a);
42650         a_conv.is_owned = ptr_is_owned(a);
42651         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
42652         a_conv.is_owned = false;
42653         LDKChannelReestablish b_conv;
42654         b_conv.inner = untag_ptr(b);
42655         b_conv.is_owned = ptr_is_owned(b);
42656         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
42657         b_conv.is_owned = false;
42658         jboolean ret_conv = ChannelReestablish_eq(&a_conv, &b_conv);
42659         return ret_conv;
42660 }
42661
42662 void  __attribute__((export_name("TS_AnnouncementSignatures_free"))) TS_AnnouncementSignatures_free(uint64_t this_obj) {
42663         LDKAnnouncementSignatures this_obj_conv;
42664         this_obj_conv.inner = untag_ptr(this_obj);
42665         this_obj_conv.is_owned = ptr_is_owned(this_obj);
42666         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
42667         AnnouncementSignatures_free(this_obj_conv);
42668 }
42669
42670 int8_tArray  __attribute__((export_name("TS_AnnouncementSignatures_get_channel_id"))) TS_AnnouncementSignatures_get_channel_id(uint64_t this_ptr) {
42671         LDKAnnouncementSignatures this_ptr_conv;
42672         this_ptr_conv.inner = untag_ptr(this_ptr);
42673         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
42674         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
42675         this_ptr_conv.is_owned = false;
42676         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
42677         memcpy(ret_arr->elems, *AnnouncementSignatures_get_channel_id(&this_ptr_conv), 32);
42678         return ret_arr;
42679 }
42680
42681 void  __attribute__((export_name("TS_AnnouncementSignatures_set_channel_id"))) TS_AnnouncementSignatures_set_channel_id(uint64_t this_ptr, int8_tArray val) {
42682         LDKAnnouncementSignatures this_ptr_conv;
42683         this_ptr_conv.inner = untag_ptr(this_ptr);
42684         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
42685         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
42686         this_ptr_conv.is_owned = false;
42687         LDKThirtyTwoBytes val_ref;
42688         CHECK(val->arr_len == 32);
42689         memcpy(val_ref.data, val->elems, 32); FREE(val);
42690         AnnouncementSignatures_set_channel_id(&this_ptr_conv, val_ref);
42691 }
42692
42693 int64_t  __attribute__((export_name("TS_AnnouncementSignatures_get_short_channel_id"))) TS_AnnouncementSignatures_get_short_channel_id(uint64_t this_ptr) {
42694         LDKAnnouncementSignatures this_ptr_conv;
42695         this_ptr_conv.inner = untag_ptr(this_ptr);
42696         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
42697         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
42698         this_ptr_conv.is_owned = false;
42699         int64_t ret_conv = AnnouncementSignatures_get_short_channel_id(&this_ptr_conv);
42700         return ret_conv;
42701 }
42702
42703 void  __attribute__((export_name("TS_AnnouncementSignatures_set_short_channel_id"))) TS_AnnouncementSignatures_set_short_channel_id(uint64_t this_ptr, int64_t val) {
42704         LDKAnnouncementSignatures this_ptr_conv;
42705         this_ptr_conv.inner = untag_ptr(this_ptr);
42706         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
42707         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
42708         this_ptr_conv.is_owned = false;
42709         AnnouncementSignatures_set_short_channel_id(&this_ptr_conv, val);
42710 }
42711
42712 int8_tArray  __attribute__((export_name("TS_AnnouncementSignatures_get_node_signature"))) TS_AnnouncementSignatures_get_node_signature(uint64_t this_ptr) {
42713         LDKAnnouncementSignatures this_ptr_conv;
42714         this_ptr_conv.inner = untag_ptr(this_ptr);
42715         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
42716         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
42717         this_ptr_conv.is_owned = false;
42718         int8_tArray ret_arr = init_int8_tArray(64, __LINE__);
42719         memcpy(ret_arr->elems, AnnouncementSignatures_get_node_signature(&this_ptr_conv).compact_form, 64);
42720         return ret_arr;
42721 }
42722
42723 void  __attribute__((export_name("TS_AnnouncementSignatures_set_node_signature"))) TS_AnnouncementSignatures_set_node_signature(uint64_t this_ptr, int8_tArray val) {
42724         LDKAnnouncementSignatures this_ptr_conv;
42725         this_ptr_conv.inner = untag_ptr(this_ptr);
42726         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
42727         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
42728         this_ptr_conv.is_owned = false;
42729         LDKECDSASignature val_ref;
42730         CHECK(val->arr_len == 64);
42731         memcpy(val_ref.compact_form, val->elems, 64); FREE(val);
42732         AnnouncementSignatures_set_node_signature(&this_ptr_conv, val_ref);
42733 }
42734
42735 int8_tArray  __attribute__((export_name("TS_AnnouncementSignatures_get_bitcoin_signature"))) TS_AnnouncementSignatures_get_bitcoin_signature(uint64_t this_ptr) {
42736         LDKAnnouncementSignatures this_ptr_conv;
42737         this_ptr_conv.inner = untag_ptr(this_ptr);
42738         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
42739         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
42740         this_ptr_conv.is_owned = false;
42741         int8_tArray ret_arr = init_int8_tArray(64, __LINE__);
42742         memcpy(ret_arr->elems, AnnouncementSignatures_get_bitcoin_signature(&this_ptr_conv).compact_form, 64);
42743         return ret_arr;
42744 }
42745
42746 void  __attribute__((export_name("TS_AnnouncementSignatures_set_bitcoin_signature"))) TS_AnnouncementSignatures_set_bitcoin_signature(uint64_t this_ptr, int8_tArray val) {
42747         LDKAnnouncementSignatures this_ptr_conv;
42748         this_ptr_conv.inner = untag_ptr(this_ptr);
42749         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
42750         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
42751         this_ptr_conv.is_owned = false;
42752         LDKECDSASignature val_ref;
42753         CHECK(val->arr_len == 64);
42754         memcpy(val_ref.compact_form, val->elems, 64); FREE(val);
42755         AnnouncementSignatures_set_bitcoin_signature(&this_ptr_conv, val_ref);
42756 }
42757
42758 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) {
42759         LDKThirtyTwoBytes channel_id_arg_ref;
42760         CHECK(channel_id_arg->arr_len == 32);
42761         memcpy(channel_id_arg_ref.data, channel_id_arg->elems, 32); FREE(channel_id_arg);
42762         LDKECDSASignature node_signature_arg_ref;
42763         CHECK(node_signature_arg->arr_len == 64);
42764         memcpy(node_signature_arg_ref.compact_form, node_signature_arg->elems, 64); FREE(node_signature_arg);
42765         LDKECDSASignature bitcoin_signature_arg_ref;
42766         CHECK(bitcoin_signature_arg->arr_len == 64);
42767         memcpy(bitcoin_signature_arg_ref.compact_form, bitcoin_signature_arg->elems, 64); FREE(bitcoin_signature_arg);
42768         LDKAnnouncementSignatures ret_var = AnnouncementSignatures_new(channel_id_arg_ref, short_channel_id_arg, node_signature_arg_ref, bitcoin_signature_arg_ref);
42769         uint64_t ret_ref = 0;
42770         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
42771         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
42772         return ret_ref;
42773 }
42774
42775 static inline uint64_t AnnouncementSignatures_clone_ptr(LDKAnnouncementSignatures *NONNULL_PTR arg) {
42776         LDKAnnouncementSignatures ret_var = AnnouncementSignatures_clone(arg);
42777         uint64_t ret_ref = 0;
42778         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
42779         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
42780         return ret_ref;
42781 }
42782 int64_t  __attribute__((export_name("TS_AnnouncementSignatures_clone_ptr"))) TS_AnnouncementSignatures_clone_ptr(uint64_t arg) {
42783         LDKAnnouncementSignatures arg_conv;
42784         arg_conv.inner = untag_ptr(arg);
42785         arg_conv.is_owned = ptr_is_owned(arg);
42786         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
42787         arg_conv.is_owned = false;
42788         int64_t ret_conv = AnnouncementSignatures_clone_ptr(&arg_conv);
42789         return ret_conv;
42790 }
42791
42792 uint64_t  __attribute__((export_name("TS_AnnouncementSignatures_clone"))) TS_AnnouncementSignatures_clone(uint64_t orig) {
42793         LDKAnnouncementSignatures orig_conv;
42794         orig_conv.inner = untag_ptr(orig);
42795         orig_conv.is_owned = ptr_is_owned(orig);
42796         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
42797         orig_conv.is_owned = false;
42798         LDKAnnouncementSignatures ret_var = AnnouncementSignatures_clone(&orig_conv);
42799         uint64_t ret_ref = 0;
42800         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
42801         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
42802         return ret_ref;
42803 }
42804
42805 jboolean  __attribute__((export_name("TS_AnnouncementSignatures_eq"))) TS_AnnouncementSignatures_eq(uint64_t a, uint64_t b) {
42806         LDKAnnouncementSignatures a_conv;
42807         a_conv.inner = untag_ptr(a);
42808         a_conv.is_owned = ptr_is_owned(a);
42809         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
42810         a_conv.is_owned = false;
42811         LDKAnnouncementSignatures b_conv;
42812         b_conv.inner = untag_ptr(b);
42813         b_conv.is_owned = ptr_is_owned(b);
42814         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
42815         b_conv.is_owned = false;
42816         jboolean ret_conv = AnnouncementSignatures_eq(&a_conv, &b_conv);
42817         return ret_conv;
42818 }
42819
42820 void  __attribute__((export_name("TS_SocketAddress_free"))) TS_SocketAddress_free(uint64_t this_ptr) {
42821         if (!ptr_is_owned(this_ptr)) return;
42822         void* this_ptr_ptr = untag_ptr(this_ptr);
42823         CHECK_ACCESS(this_ptr_ptr);
42824         LDKSocketAddress this_ptr_conv = *(LDKSocketAddress*)(this_ptr_ptr);
42825         FREE(untag_ptr(this_ptr));
42826         SocketAddress_free(this_ptr_conv);
42827 }
42828
42829 static inline uint64_t SocketAddress_clone_ptr(LDKSocketAddress *NONNULL_PTR arg) {
42830         LDKSocketAddress *ret_copy = MALLOC(sizeof(LDKSocketAddress), "LDKSocketAddress");
42831         *ret_copy = SocketAddress_clone(arg);
42832         uint64_t ret_ref = tag_ptr(ret_copy, true);
42833         return ret_ref;
42834 }
42835 int64_t  __attribute__((export_name("TS_SocketAddress_clone_ptr"))) TS_SocketAddress_clone_ptr(uint64_t arg) {
42836         LDKSocketAddress* arg_conv = (LDKSocketAddress*)untag_ptr(arg);
42837         int64_t ret_conv = SocketAddress_clone_ptr(arg_conv);
42838         return ret_conv;
42839 }
42840
42841 uint64_t  __attribute__((export_name("TS_SocketAddress_clone"))) TS_SocketAddress_clone(uint64_t orig) {
42842         LDKSocketAddress* orig_conv = (LDKSocketAddress*)untag_ptr(orig);
42843         LDKSocketAddress *ret_copy = MALLOC(sizeof(LDKSocketAddress), "LDKSocketAddress");
42844         *ret_copy = SocketAddress_clone(orig_conv);
42845         uint64_t ret_ref = tag_ptr(ret_copy, true);
42846         return ret_ref;
42847 }
42848
42849 uint64_t  __attribute__((export_name("TS_SocketAddress_tcp_ip_v4"))) TS_SocketAddress_tcp_ip_v4(int8_tArray addr, int16_t port) {
42850         LDKFourBytes addr_ref;
42851         CHECK(addr->arr_len == 4);
42852         memcpy(addr_ref.data, addr->elems, 4); FREE(addr);
42853         LDKSocketAddress *ret_copy = MALLOC(sizeof(LDKSocketAddress), "LDKSocketAddress");
42854         *ret_copy = SocketAddress_tcp_ip_v4(addr_ref, port);
42855         uint64_t ret_ref = tag_ptr(ret_copy, true);
42856         return ret_ref;
42857 }
42858
42859 uint64_t  __attribute__((export_name("TS_SocketAddress_tcp_ip_v6"))) TS_SocketAddress_tcp_ip_v6(int8_tArray addr, int16_t port) {
42860         LDKSixteenBytes addr_ref;
42861         CHECK(addr->arr_len == 16);
42862         memcpy(addr_ref.data, addr->elems, 16); FREE(addr);
42863         LDKSocketAddress *ret_copy = MALLOC(sizeof(LDKSocketAddress), "LDKSocketAddress");
42864         *ret_copy = SocketAddress_tcp_ip_v6(addr_ref, port);
42865         uint64_t ret_ref = tag_ptr(ret_copy, true);
42866         return ret_ref;
42867 }
42868
42869 uint64_t  __attribute__((export_name("TS_SocketAddress_onion_v2"))) TS_SocketAddress_onion_v2(int8_tArray a) {
42870         LDKTwelveBytes a_ref;
42871         CHECK(a->arr_len == 12);
42872         memcpy(a_ref.data, a->elems, 12); FREE(a);
42873         LDKSocketAddress *ret_copy = MALLOC(sizeof(LDKSocketAddress), "LDKSocketAddress");
42874         *ret_copy = SocketAddress_onion_v2(a_ref);
42875         uint64_t ret_ref = tag_ptr(ret_copy, true);
42876         return ret_ref;
42877 }
42878
42879 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) {
42880         LDKThirtyTwoBytes ed25519_pubkey_ref;
42881         CHECK(ed25519_pubkey->arr_len == 32);
42882         memcpy(ed25519_pubkey_ref.data, ed25519_pubkey->elems, 32); FREE(ed25519_pubkey);
42883         LDKSocketAddress *ret_copy = MALLOC(sizeof(LDKSocketAddress), "LDKSocketAddress");
42884         *ret_copy = SocketAddress_onion_v3(ed25519_pubkey_ref, checksum, version, port);
42885         uint64_t ret_ref = tag_ptr(ret_copy, true);
42886         return ret_ref;
42887 }
42888
42889 uint64_t  __attribute__((export_name("TS_SocketAddress_hostname"))) TS_SocketAddress_hostname(uint64_t hostname, int16_t port) {
42890         LDKHostname hostname_conv;
42891         hostname_conv.inner = untag_ptr(hostname);
42892         hostname_conv.is_owned = ptr_is_owned(hostname);
42893         CHECK_INNER_FIELD_ACCESS_OR_NULL(hostname_conv);
42894         hostname_conv = Hostname_clone(&hostname_conv);
42895         LDKSocketAddress *ret_copy = MALLOC(sizeof(LDKSocketAddress), "LDKSocketAddress");
42896         *ret_copy = SocketAddress_hostname(hostname_conv, port);
42897         uint64_t ret_ref = tag_ptr(ret_copy, true);
42898         return ret_ref;
42899 }
42900
42901 jboolean  __attribute__((export_name("TS_SocketAddress_eq"))) TS_SocketAddress_eq(uint64_t a, uint64_t b) {
42902         LDKSocketAddress* a_conv = (LDKSocketAddress*)untag_ptr(a);
42903         LDKSocketAddress* b_conv = (LDKSocketAddress*)untag_ptr(b);
42904         jboolean ret_conv = SocketAddress_eq(a_conv, b_conv);
42905         return ret_conv;
42906 }
42907
42908 int8_tArray  __attribute__((export_name("TS_SocketAddress_write"))) TS_SocketAddress_write(uint64_t obj) {
42909         LDKSocketAddress* obj_conv = (LDKSocketAddress*)untag_ptr(obj);
42910         LDKCVec_u8Z ret_var = SocketAddress_write(obj_conv);
42911         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
42912         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
42913         CVec_u8Z_free(ret_var);
42914         return ret_arr;
42915 }
42916
42917 uint64_t  __attribute__((export_name("TS_SocketAddress_read"))) TS_SocketAddress_read(int8_tArray ser) {
42918         LDKu8slice ser_ref;
42919         ser_ref.datalen = ser->arr_len;
42920         ser_ref.data = ser->elems;
42921         LDKCResult_SocketAddressDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_SocketAddressDecodeErrorZ), "LDKCResult_SocketAddressDecodeErrorZ");
42922         *ret_conv = SocketAddress_read(ser_ref);
42923         FREE(ser);
42924         return tag_ptr(ret_conv, true);
42925 }
42926
42927 uint32_t  __attribute__((export_name("TS_SocketAddressParseError_clone"))) TS_SocketAddressParseError_clone(uint64_t orig) {
42928         LDKSocketAddressParseError* orig_conv = (LDKSocketAddressParseError*)untag_ptr(orig);
42929         uint32_t ret_conv = LDKSocketAddressParseError_to_js(SocketAddressParseError_clone(orig_conv));
42930         return ret_conv;
42931 }
42932
42933 uint32_t  __attribute__((export_name("TS_SocketAddressParseError_socket_addr_parse"))) TS_SocketAddressParseError_socket_addr_parse() {
42934         uint32_t ret_conv = LDKSocketAddressParseError_to_js(SocketAddressParseError_socket_addr_parse());
42935         return ret_conv;
42936 }
42937
42938 uint32_t  __attribute__((export_name("TS_SocketAddressParseError_invalid_input"))) TS_SocketAddressParseError_invalid_input() {
42939         uint32_t ret_conv = LDKSocketAddressParseError_to_js(SocketAddressParseError_invalid_input());
42940         return ret_conv;
42941 }
42942
42943 uint32_t  __attribute__((export_name("TS_SocketAddressParseError_invalid_port"))) TS_SocketAddressParseError_invalid_port() {
42944         uint32_t ret_conv = LDKSocketAddressParseError_to_js(SocketAddressParseError_invalid_port());
42945         return ret_conv;
42946 }
42947
42948 uint32_t  __attribute__((export_name("TS_SocketAddressParseError_invalid_onion_v3"))) TS_SocketAddressParseError_invalid_onion_v3() {
42949         uint32_t ret_conv = LDKSocketAddressParseError_to_js(SocketAddressParseError_invalid_onion_v3());
42950         return ret_conv;
42951 }
42952
42953 jboolean  __attribute__((export_name("TS_SocketAddressParseError_eq"))) TS_SocketAddressParseError_eq(uint64_t a, uint64_t b) {
42954         LDKSocketAddressParseError* a_conv = (LDKSocketAddressParseError*)untag_ptr(a);
42955         LDKSocketAddressParseError* b_conv = (LDKSocketAddressParseError*)untag_ptr(b);
42956         jboolean ret_conv = SocketAddressParseError_eq(a_conv, b_conv);
42957         return ret_conv;
42958 }
42959
42960 uint64_t  __attribute__((export_name("TS_parse_onion_address"))) TS_parse_onion_address(jstring host, int16_t port) {
42961         LDKStr host_conv = str_ref_to_owned_c(host);
42962         LDKCResult_SocketAddressSocketAddressParseErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_SocketAddressSocketAddressParseErrorZ), "LDKCResult_SocketAddressSocketAddressParseErrorZ");
42963         *ret_conv = parse_onion_address(host_conv, port);
42964         return tag_ptr(ret_conv, true);
42965 }
42966
42967 jstring  __attribute__((export_name("TS_SocketAddress_to_str"))) TS_SocketAddress_to_str(uint64_t o) {
42968         LDKSocketAddress* o_conv = (LDKSocketAddress*)untag_ptr(o);
42969         LDKStr ret_str = SocketAddress_to_str(o_conv);
42970         jstring ret_conv = str_ref_to_ts(ret_str.chars, ret_str.len);
42971         Str_free(ret_str);
42972         return ret_conv;
42973 }
42974
42975 void  __attribute__((export_name("TS_UnsignedGossipMessage_free"))) TS_UnsignedGossipMessage_free(uint64_t this_ptr) {
42976         if (!ptr_is_owned(this_ptr)) return;
42977         void* this_ptr_ptr = untag_ptr(this_ptr);
42978         CHECK_ACCESS(this_ptr_ptr);
42979         LDKUnsignedGossipMessage this_ptr_conv = *(LDKUnsignedGossipMessage*)(this_ptr_ptr);
42980         FREE(untag_ptr(this_ptr));
42981         UnsignedGossipMessage_free(this_ptr_conv);
42982 }
42983
42984 static inline uint64_t UnsignedGossipMessage_clone_ptr(LDKUnsignedGossipMessage *NONNULL_PTR arg) {
42985         LDKUnsignedGossipMessage *ret_copy = MALLOC(sizeof(LDKUnsignedGossipMessage), "LDKUnsignedGossipMessage");
42986         *ret_copy = UnsignedGossipMessage_clone(arg);
42987         uint64_t ret_ref = tag_ptr(ret_copy, true);
42988         return ret_ref;
42989 }
42990 int64_t  __attribute__((export_name("TS_UnsignedGossipMessage_clone_ptr"))) TS_UnsignedGossipMessage_clone_ptr(uint64_t arg) {
42991         LDKUnsignedGossipMessage* arg_conv = (LDKUnsignedGossipMessage*)untag_ptr(arg);
42992         int64_t ret_conv = UnsignedGossipMessage_clone_ptr(arg_conv);
42993         return ret_conv;
42994 }
42995
42996 uint64_t  __attribute__((export_name("TS_UnsignedGossipMessage_clone"))) TS_UnsignedGossipMessage_clone(uint64_t orig) {
42997         LDKUnsignedGossipMessage* orig_conv = (LDKUnsignedGossipMessage*)untag_ptr(orig);
42998         LDKUnsignedGossipMessage *ret_copy = MALLOC(sizeof(LDKUnsignedGossipMessage), "LDKUnsignedGossipMessage");
42999         *ret_copy = UnsignedGossipMessage_clone(orig_conv);
43000         uint64_t ret_ref = tag_ptr(ret_copy, true);
43001         return ret_ref;
43002 }
43003
43004 uint64_t  __attribute__((export_name("TS_UnsignedGossipMessage_channel_announcement"))) TS_UnsignedGossipMessage_channel_announcement(uint64_t a) {
43005         LDKUnsignedChannelAnnouncement a_conv;
43006         a_conv.inner = untag_ptr(a);
43007         a_conv.is_owned = ptr_is_owned(a);
43008         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
43009         a_conv = UnsignedChannelAnnouncement_clone(&a_conv);
43010         LDKUnsignedGossipMessage *ret_copy = MALLOC(sizeof(LDKUnsignedGossipMessage), "LDKUnsignedGossipMessage");
43011         *ret_copy = UnsignedGossipMessage_channel_announcement(a_conv);
43012         uint64_t ret_ref = tag_ptr(ret_copy, true);
43013         return ret_ref;
43014 }
43015
43016 uint64_t  __attribute__((export_name("TS_UnsignedGossipMessage_channel_update"))) TS_UnsignedGossipMessage_channel_update(uint64_t a) {
43017         LDKUnsignedChannelUpdate a_conv;
43018         a_conv.inner = untag_ptr(a);
43019         a_conv.is_owned = ptr_is_owned(a);
43020         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
43021         a_conv = UnsignedChannelUpdate_clone(&a_conv);
43022         LDKUnsignedGossipMessage *ret_copy = MALLOC(sizeof(LDKUnsignedGossipMessage), "LDKUnsignedGossipMessage");
43023         *ret_copy = UnsignedGossipMessage_channel_update(a_conv);
43024         uint64_t ret_ref = tag_ptr(ret_copy, true);
43025         return ret_ref;
43026 }
43027
43028 uint64_t  __attribute__((export_name("TS_UnsignedGossipMessage_node_announcement"))) TS_UnsignedGossipMessage_node_announcement(uint64_t a) {
43029         LDKUnsignedNodeAnnouncement a_conv;
43030         a_conv.inner = untag_ptr(a);
43031         a_conv.is_owned = ptr_is_owned(a);
43032         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
43033         a_conv = UnsignedNodeAnnouncement_clone(&a_conv);
43034         LDKUnsignedGossipMessage *ret_copy = MALLOC(sizeof(LDKUnsignedGossipMessage), "LDKUnsignedGossipMessage");
43035         *ret_copy = UnsignedGossipMessage_node_announcement(a_conv);
43036         uint64_t ret_ref = tag_ptr(ret_copy, true);
43037         return ret_ref;
43038 }
43039
43040 int8_tArray  __attribute__((export_name("TS_UnsignedGossipMessage_write"))) TS_UnsignedGossipMessage_write(uint64_t obj) {
43041         LDKUnsignedGossipMessage* obj_conv = (LDKUnsignedGossipMessage*)untag_ptr(obj);
43042         LDKCVec_u8Z ret_var = UnsignedGossipMessage_write(obj_conv);
43043         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
43044         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
43045         CVec_u8Z_free(ret_var);
43046         return ret_arr;
43047 }
43048
43049 void  __attribute__((export_name("TS_UnsignedNodeAnnouncement_free"))) TS_UnsignedNodeAnnouncement_free(uint64_t this_obj) {
43050         LDKUnsignedNodeAnnouncement this_obj_conv;
43051         this_obj_conv.inner = untag_ptr(this_obj);
43052         this_obj_conv.is_owned = ptr_is_owned(this_obj);
43053         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
43054         UnsignedNodeAnnouncement_free(this_obj_conv);
43055 }
43056
43057 uint64_t  __attribute__((export_name("TS_UnsignedNodeAnnouncement_get_features"))) TS_UnsignedNodeAnnouncement_get_features(uint64_t this_ptr) {
43058         LDKUnsignedNodeAnnouncement this_ptr_conv;
43059         this_ptr_conv.inner = untag_ptr(this_ptr);
43060         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
43061         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
43062         this_ptr_conv.is_owned = false;
43063         LDKNodeFeatures ret_var = UnsignedNodeAnnouncement_get_features(&this_ptr_conv);
43064         uint64_t ret_ref = 0;
43065         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
43066         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
43067         return ret_ref;
43068 }
43069
43070 void  __attribute__((export_name("TS_UnsignedNodeAnnouncement_set_features"))) TS_UnsignedNodeAnnouncement_set_features(uint64_t this_ptr, uint64_t val) {
43071         LDKUnsignedNodeAnnouncement this_ptr_conv;
43072         this_ptr_conv.inner = untag_ptr(this_ptr);
43073         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
43074         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
43075         this_ptr_conv.is_owned = false;
43076         LDKNodeFeatures val_conv;
43077         val_conv.inner = untag_ptr(val);
43078         val_conv.is_owned = ptr_is_owned(val);
43079         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
43080         val_conv = NodeFeatures_clone(&val_conv);
43081         UnsignedNodeAnnouncement_set_features(&this_ptr_conv, val_conv);
43082 }
43083
43084 int32_t  __attribute__((export_name("TS_UnsignedNodeAnnouncement_get_timestamp"))) TS_UnsignedNodeAnnouncement_get_timestamp(uint64_t this_ptr) {
43085         LDKUnsignedNodeAnnouncement this_ptr_conv;
43086         this_ptr_conv.inner = untag_ptr(this_ptr);
43087         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
43088         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
43089         this_ptr_conv.is_owned = false;
43090         int32_t ret_conv = UnsignedNodeAnnouncement_get_timestamp(&this_ptr_conv);
43091         return ret_conv;
43092 }
43093
43094 void  __attribute__((export_name("TS_UnsignedNodeAnnouncement_set_timestamp"))) TS_UnsignedNodeAnnouncement_set_timestamp(uint64_t this_ptr, int32_t val) {
43095         LDKUnsignedNodeAnnouncement this_ptr_conv;
43096         this_ptr_conv.inner = untag_ptr(this_ptr);
43097         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
43098         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
43099         this_ptr_conv.is_owned = false;
43100         UnsignedNodeAnnouncement_set_timestamp(&this_ptr_conv, val);
43101 }
43102
43103 uint64_t  __attribute__((export_name("TS_UnsignedNodeAnnouncement_get_node_id"))) TS_UnsignedNodeAnnouncement_get_node_id(uint64_t this_ptr) {
43104         LDKUnsignedNodeAnnouncement this_ptr_conv;
43105         this_ptr_conv.inner = untag_ptr(this_ptr);
43106         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
43107         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
43108         this_ptr_conv.is_owned = false;
43109         LDKNodeId ret_var = UnsignedNodeAnnouncement_get_node_id(&this_ptr_conv);
43110         uint64_t ret_ref = 0;
43111         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
43112         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
43113         return ret_ref;
43114 }
43115
43116 void  __attribute__((export_name("TS_UnsignedNodeAnnouncement_set_node_id"))) TS_UnsignedNodeAnnouncement_set_node_id(uint64_t this_ptr, uint64_t val) {
43117         LDKUnsignedNodeAnnouncement this_ptr_conv;
43118         this_ptr_conv.inner = untag_ptr(this_ptr);
43119         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
43120         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
43121         this_ptr_conv.is_owned = false;
43122         LDKNodeId val_conv;
43123         val_conv.inner = untag_ptr(val);
43124         val_conv.is_owned = ptr_is_owned(val);
43125         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
43126         val_conv = NodeId_clone(&val_conv);
43127         UnsignedNodeAnnouncement_set_node_id(&this_ptr_conv, val_conv);
43128 }
43129
43130 int8_tArray  __attribute__((export_name("TS_UnsignedNodeAnnouncement_get_rgb"))) TS_UnsignedNodeAnnouncement_get_rgb(uint64_t this_ptr) {
43131         LDKUnsignedNodeAnnouncement this_ptr_conv;
43132         this_ptr_conv.inner = untag_ptr(this_ptr);
43133         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
43134         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
43135         this_ptr_conv.is_owned = false;
43136         int8_tArray ret_arr = init_int8_tArray(3, __LINE__);
43137         memcpy(ret_arr->elems, *UnsignedNodeAnnouncement_get_rgb(&this_ptr_conv), 3);
43138         return ret_arr;
43139 }
43140
43141 void  __attribute__((export_name("TS_UnsignedNodeAnnouncement_set_rgb"))) TS_UnsignedNodeAnnouncement_set_rgb(uint64_t this_ptr, int8_tArray val) {
43142         LDKUnsignedNodeAnnouncement this_ptr_conv;
43143         this_ptr_conv.inner = untag_ptr(this_ptr);
43144         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
43145         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
43146         this_ptr_conv.is_owned = false;
43147         LDKThreeBytes val_ref;
43148         CHECK(val->arr_len == 3);
43149         memcpy(val_ref.data, val->elems, 3); FREE(val);
43150         UnsignedNodeAnnouncement_set_rgb(&this_ptr_conv, val_ref);
43151 }
43152
43153 uint64_t  __attribute__((export_name("TS_UnsignedNodeAnnouncement_get_alias"))) TS_UnsignedNodeAnnouncement_get_alias(uint64_t this_ptr) {
43154         LDKUnsignedNodeAnnouncement this_ptr_conv;
43155         this_ptr_conv.inner = untag_ptr(this_ptr);
43156         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
43157         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
43158         this_ptr_conv.is_owned = false;
43159         LDKNodeAlias ret_var = UnsignedNodeAnnouncement_get_alias(&this_ptr_conv);
43160         uint64_t ret_ref = 0;
43161         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
43162         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
43163         return ret_ref;
43164 }
43165
43166 void  __attribute__((export_name("TS_UnsignedNodeAnnouncement_set_alias"))) TS_UnsignedNodeAnnouncement_set_alias(uint64_t this_ptr, uint64_t val) {
43167         LDKUnsignedNodeAnnouncement this_ptr_conv;
43168         this_ptr_conv.inner = untag_ptr(this_ptr);
43169         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
43170         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
43171         this_ptr_conv.is_owned = false;
43172         LDKNodeAlias val_conv;
43173         val_conv.inner = untag_ptr(val);
43174         val_conv.is_owned = ptr_is_owned(val);
43175         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
43176         val_conv = NodeAlias_clone(&val_conv);
43177         UnsignedNodeAnnouncement_set_alias(&this_ptr_conv, val_conv);
43178 }
43179
43180 uint64_tArray  __attribute__((export_name("TS_UnsignedNodeAnnouncement_get_addresses"))) TS_UnsignedNodeAnnouncement_get_addresses(uint64_t this_ptr) {
43181         LDKUnsignedNodeAnnouncement this_ptr_conv;
43182         this_ptr_conv.inner = untag_ptr(this_ptr);
43183         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
43184         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
43185         this_ptr_conv.is_owned = false;
43186         LDKCVec_SocketAddressZ ret_var = UnsignedNodeAnnouncement_get_addresses(&this_ptr_conv);
43187         uint64_tArray ret_arr = NULL;
43188         ret_arr = init_uint64_tArray(ret_var.datalen, __LINE__);
43189         uint64_t *ret_arr_ptr = (uint64_t*)(((uint8_t*)ret_arr) + 8);
43190         for (size_t p = 0; p < ret_var.datalen; p++) {
43191                 LDKSocketAddress *ret_conv_15_copy = MALLOC(sizeof(LDKSocketAddress), "LDKSocketAddress");
43192                 *ret_conv_15_copy = ret_var.data[p];
43193                 uint64_t ret_conv_15_ref = tag_ptr(ret_conv_15_copy, true);
43194                 ret_arr_ptr[p] = ret_conv_15_ref;
43195         }
43196         
43197         FREE(ret_var.data);
43198         return ret_arr;
43199 }
43200
43201 void  __attribute__((export_name("TS_UnsignedNodeAnnouncement_set_addresses"))) TS_UnsignedNodeAnnouncement_set_addresses(uint64_t this_ptr, uint64_tArray val) {
43202         LDKUnsignedNodeAnnouncement this_ptr_conv;
43203         this_ptr_conv.inner = untag_ptr(this_ptr);
43204         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
43205         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
43206         this_ptr_conv.is_owned = false;
43207         LDKCVec_SocketAddressZ val_constr;
43208         val_constr.datalen = val->arr_len;
43209         if (val_constr.datalen > 0)
43210                 val_constr.data = MALLOC(val_constr.datalen * sizeof(LDKSocketAddress), "LDKCVec_SocketAddressZ Elements");
43211         else
43212                 val_constr.data = NULL;
43213         uint64_t* val_vals = val->elems;
43214         for (size_t p = 0; p < val_constr.datalen; p++) {
43215                 uint64_t val_conv_15 = val_vals[p];
43216                 void* val_conv_15_ptr = untag_ptr(val_conv_15);
43217                 CHECK_ACCESS(val_conv_15_ptr);
43218                 LDKSocketAddress val_conv_15_conv = *(LDKSocketAddress*)(val_conv_15_ptr);
43219                 val_conv_15_conv = SocketAddress_clone((LDKSocketAddress*)untag_ptr(val_conv_15));
43220                 val_constr.data[p] = val_conv_15_conv;
43221         }
43222         FREE(val);
43223         UnsignedNodeAnnouncement_set_addresses(&this_ptr_conv, val_constr);
43224 }
43225
43226 static inline uint64_t UnsignedNodeAnnouncement_clone_ptr(LDKUnsignedNodeAnnouncement *NONNULL_PTR arg) {
43227         LDKUnsignedNodeAnnouncement ret_var = UnsignedNodeAnnouncement_clone(arg);
43228         uint64_t ret_ref = 0;
43229         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
43230         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
43231         return ret_ref;
43232 }
43233 int64_t  __attribute__((export_name("TS_UnsignedNodeAnnouncement_clone_ptr"))) TS_UnsignedNodeAnnouncement_clone_ptr(uint64_t arg) {
43234         LDKUnsignedNodeAnnouncement arg_conv;
43235         arg_conv.inner = untag_ptr(arg);
43236         arg_conv.is_owned = ptr_is_owned(arg);
43237         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
43238         arg_conv.is_owned = false;
43239         int64_t ret_conv = UnsignedNodeAnnouncement_clone_ptr(&arg_conv);
43240         return ret_conv;
43241 }
43242
43243 uint64_t  __attribute__((export_name("TS_UnsignedNodeAnnouncement_clone"))) TS_UnsignedNodeAnnouncement_clone(uint64_t orig) {
43244         LDKUnsignedNodeAnnouncement orig_conv;
43245         orig_conv.inner = untag_ptr(orig);
43246         orig_conv.is_owned = ptr_is_owned(orig);
43247         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
43248         orig_conv.is_owned = false;
43249         LDKUnsignedNodeAnnouncement ret_var = UnsignedNodeAnnouncement_clone(&orig_conv);
43250         uint64_t ret_ref = 0;
43251         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
43252         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
43253         return ret_ref;
43254 }
43255
43256 jboolean  __attribute__((export_name("TS_UnsignedNodeAnnouncement_eq"))) TS_UnsignedNodeAnnouncement_eq(uint64_t a, uint64_t b) {
43257         LDKUnsignedNodeAnnouncement a_conv;
43258         a_conv.inner = untag_ptr(a);
43259         a_conv.is_owned = ptr_is_owned(a);
43260         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
43261         a_conv.is_owned = false;
43262         LDKUnsignedNodeAnnouncement b_conv;
43263         b_conv.inner = untag_ptr(b);
43264         b_conv.is_owned = ptr_is_owned(b);
43265         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
43266         b_conv.is_owned = false;
43267         jboolean ret_conv = UnsignedNodeAnnouncement_eq(&a_conv, &b_conv);
43268         return ret_conv;
43269 }
43270
43271 void  __attribute__((export_name("TS_NodeAnnouncement_free"))) TS_NodeAnnouncement_free(uint64_t this_obj) {
43272         LDKNodeAnnouncement this_obj_conv;
43273         this_obj_conv.inner = untag_ptr(this_obj);
43274         this_obj_conv.is_owned = ptr_is_owned(this_obj);
43275         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
43276         NodeAnnouncement_free(this_obj_conv);
43277 }
43278
43279 int8_tArray  __attribute__((export_name("TS_NodeAnnouncement_get_signature"))) TS_NodeAnnouncement_get_signature(uint64_t this_ptr) {
43280         LDKNodeAnnouncement this_ptr_conv;
43281         this_ptr_conv.inner = untag_ptr(this_ptr);
43282         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
43283         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
43284         this_ptr_conv.is_owned = false;
43285         int8_tArray ret_arr = init_int8_tArray(64, __LINE__);
43286         memcpy(ret_arr->elems, NodeAnnouncement_get_signature(&this_ptr_conv).compact_form, 64);
43287         return ret_arr;
43288 }
43289
43290 void  __attribute__((export_name("TS_NodeAnnouncement_set_signature"))) TS_NodeAnnouncement_set_signature(uint64_t this_ptr, int8_tArray val) {
43291         LDKNodeAnnouncement this_ptr_conv;
43292         this_ptr_conv.inner = untag_ptr(this_ptr);
43293         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
43294         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
43295         this_ptr_conv.is_owned = false;
43296         LDKECDSASignature val_ref;
43297         CHECK(val->arr_len == 64);
43298         memcpy(val_ref.compact_form, val->elems, 64); FREE(val);
43299         NodeAnnouncement_set_signature(&this_ptr_conv, val_ref);
43300 }
43301
43302 uint64_t  __attribute__((export_name("TS_NodeAnnouncement_get_contents"))) TS_NodeAnnouncement_get_contents(uint64_t this_ptr) {
43303         LDKNodeAnnouncement this_ptr_conv;
43304         this_ptr_conv.inner = untag_ptr(this_ptr);
43305         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
43306         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
43307         this_ptr_conv.is_owned = false;
43308         LDKUnsignedNodeAnnouncement ret_var = NodeAnnouncement_get_contents(&this_ptr_conv);
43309         uint64_t ret_ref = 0;
43310         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
43311         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
43312         return ret_ref;
43313 }
43314
43315 void  __attribute__((export_name("TS_NodeAnnouncement_set_contents"))) TS_NodeAnnouncement_set_contents(uint64_t this_ptr, uint64_t val) {
43316         LDKNodeAnnouncement this_ptr_conv;
43317         this_ptr_conv.inner = untag_ptr(this_ptr);
43318         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
43319         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
43320         this_ptr_conv.is_owned = false;
43321         LDKUnsignedNodeAnnouncement val_conv;
43322         val_conv.inner = untag_ptr(val);
43323         val_conv.is_owned = ptr_is_owned(val);
43324         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
43325         val_conv = UnsignedNodeAnnouncement_clone(&val_conv);
43326         NodeAnnouncement_set_contents(&this_ptr_conv, val_conv);
43327 }
43328
43329 uint64_t  __attribute__((export_name("TS_NodeAnnouncement_new"))) TS_NodeAnnouncement_new(int8_tArray signature_arg, uint64_t contents_arg) {
43330         LDKECDSASignature signature_arg_ref;
43331         CHECK(signature_arg->arr_len == 64);
43332         memcpy(signature_arg_ref.compact_form, signature_arg->elems, 64); FREE(signature_arg);
43333         LDKUnsignedNodeAnnouncement contents_arg_conv;
43334         contents_arg_conv.inner = untag_ptr(contents_arg);
43335         contents_arg_conv.is_owned = ptr_is_owned(contents_arg);
43336         CHECK_INNER_FIELD_ACCESS_OR_NULL(contents_arg_conv);
43337         contents_arg_conv = UnsignedNodeAnnouncement_clone(&contents_arg_conv);
43338         LDKNodeAnnouncement ret_var = NodeAnnouncement_new(signature_arg_ref, contents_arg_conv);
43339         uint64_t ret_ref = 0;
43340         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
43341         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
43342         return ret_ref;
43343 }
43344
43345 static inline uint64_t NodeAnnouncement_clone_ptr(LDKNodeAnnouncement *NONNULL_PTR arg) {
43346         LDKNodeAnnouncement ret_var = NodeAnnouncement_clone(arg);
43347         uint64_t ret_ref = 0;
43348         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
43349         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
43350         return ret_ref;
43351 }
43352 int64_t  __attribute__((export_name("TS_NodeAnnouncement_clone_ptr"))) TS_NodeAnnouncement_clone_ptr(uint64_t arg) {
43353         LDKNodeAnnouncement arg_conv;
43354         arg_conv.inner = untag_ptr(arg);
43355         arg_conv.is_owned = ptr_is_owned(arg);
43356         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
43357         arg_conv.is_owned = false;
43358         int64_t ret_conv = NodeAnnouncement_clone_ptr(&arg_conv);
43359         return ret_conv;
43360 }
43361
43362 uint64_t  __attribute__((export_name("TS_NodeAnnouncement_clone"))) TS_NodeAnnouncement_clone(uint64_t orig) {
43363         LDKNodeAnnouncement orig_conv;
43364         orig_conv.inner = untag_ptr(orig);
43365         orig_conv.is_owned = ptr_is_owned(orig);
43366         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
43367         orig_conv.is_owned = false;
43368         LDKNodeAnnouncement ret_var = NodeAnnouncement_clone(&orig_conv);
43369         uint64_t ret_ref = 0;
43370         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
43371         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
43372         return ret_ref;
43373 }
43374
43375 jboolean  __attribute__((export_name("TS_NodeAnnouncement_eq"))) TS_NodeAnnouncement_eq(uint64_t a, uint64_t b) {
43376         LDKNodeAnnouncement a_conv;
43377         a_conv.inner = untag_ptr(a);
43378         a_conv.is_owned = ptr_is_owned(a);
43379         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
43380         a_conv.is_owned = false;
43381         LDKNodeAnnouncement b_conv;
43382         b_conv.inner = untag_ptr(b);
43383         b_conv.is_owned = ptr_is_owned(b);
43384         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
43385         b_conv.is_owned = false;
43386         jboolean ret_conv = NodeAnnouncement_eq(&a_conv, &b_conv);
43387         return ret_conv;
43388 }
43389
43390 void  __attribute__((export_name("TS_UnsignedChannelAnnouncement_free"))) TS_UnsignedChannelAnnouncement_free(uint64_t this_obj) {
43391         LDKUnsignedChannelAnnouncement this_obj_conv;
43392         this_obj_conv.inner = untag_ptr(this_obj);
43393         this_obj_conv.is_owned = ptr_is_owned(this_obj);
43394         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
43395         UnsignedChannelAnnouncement_free(this_obj_conv);
43396 }
43397
43398 uint64_t  __attribute__((export_name("TS_UnsignedChannelAnnouncement_get_features"))) TS_UnsignedChannelAnnouncement_get_features(uint64_t this_ptr) {
43399         LDKUnsignedChannelAnnouncement this_ptr_conv;
43400         this_ptr_conv.inner = untag_ptr(this_ptr);
43401         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
43402         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
43403         this_ptr_conv.is_owned = false;
43404         LDKChannelFeatures ret_var = UnsignedChannelAnnouncement_get_features(&this_ptr_conv);
43405         uint64_t ret_ref = 0;
43406         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
43407         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
43408         return ret_ref;
43409 }
43410
43411 void  __attribute__((export_name("TS_UnsignedChannelAnnouncement_set_features"))) TS_UnsignedChannelAnnouncement_set_features(uint64_t this_ptr, uint64_t val) {
43412         LDKUnsignedChannelAnnouncement this_ptr_conv;
43413         this_ptr_conv.inner = untag_ptr(this_ptr);
43414         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
43415         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
43416         this_ptr_conv.is_owned = false;
43417         LDKChannelFeatures val_conv;
43418         val_conv.inner = untag_ptr(val);
43419         val_conv.is_owned = ptr_is_owned(val);
43420         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
43421         val_conv = ChannelFeatures_clone(&val_conv);
43422         UnsignedChannelAnnouncement_set_features(&this_ptr_conv, val_conv);
43423 }
43424
43425 int8_tArray  __attribute__((export_name("TS_UnsignedChannelAnnouncement_get_chain_hash"))) TS_UnsignedChannelAnnouncement_get_chain_hash(uint64_t this_ptr) {
43426         LDKUnsignedChannelAnnouncement this_ptr_conv;
43427         this_ptr_conv.inner = untag_ptr(this_ptr);
43428         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
43429         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
43430         this_ptr_conv.is_owned = false;
43431         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
43432         memcpy(ret_arr->elems, *UnsignedChannelAnnouncement_get_chain_hash(&this_ptr_conv), 32);
43433         return ret_arr;
43434 }
43435
43436 void  __attribute__((export_name("TS_UnsignedChannelAnnouncement_set_chain_hash"))) TS_UnsignedChannelAnnouncement_set_chain_hash(uint64_t this_ptr, int8_tArray val) {
43437         LDKUnsignedChannelAnnouncement this_ptr_conv;
43438         this_ptr_conv.inner = untag_ptr(this_ptr);
43439         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
43440         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
43441         this_ptr_conv.is_owned = false;
43442         LDKThirtyTwoBytes val_ref;
43443         CHECK(val->arr_len == 32);
43444         memcpy(val_ref.data, val->elems, 32); FREE(val);
43445         UnsignedChannelAnnouncement_set_chain_hash(&this_ptr_conv, val_ref);
43446 }
43447
43448 int64_t  __attribute__((export_name("TS_UnsignedChannelAnnouncement_get_short_channel_id"))) TS_UnsignedChannelAnnouncement_get_short_channel_id(uint64_t this_ptr) {
43449         LDKUnsignedChannelAnnouncement this_ptr_conv;
43450         this_ptr_conv.inner = untag_ptr(this_ptr);
43451         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
43452         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
43453         this_ptr_conv.is_owned = false;
43454         int64_t ret_conv = UnsignedChannelAnnouncement_get_short_channel_id(&this_ptr_conv);
43455         return ret_conv;
43456 }
43457
43458 void  __attribute__((export_name("TS_UnsignedChannelAnnouncement_set_short_channel_id"))) TS_UnsignedChannelAnnouncement_set_short_channel_id(uint64_t this_ptr, int64_t val) {
43459         LDKUnsignedChannelAnnouncement this_ptr_conv;
43460         this_ptr_conv.inner = untag_ptr(this_ptr);
43461         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
43462         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
43463         this_ptr_conv.is_owned = false;
43464         UnsignedChannelAnnouncement_set_short_channel_id(&this_ptr_conv, val);
43465 }
43466
43467 uint64_t  __attribute__((export_name("TS_UnsignedChannelAnnouncement_get_node_id_1"))) TS_UnsignedChannelAnnouncement_get_node_id_1(uint64_t this_ptr) {
43468         LDKUnsignedChannelAnnouncement this_ptr_conv;
43469         this_ptr_conv.inner = untag_ptr(this_ptr);
43470         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
43471         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
43472         this_ptr_conv.is_owned = false;
43473         LDKNodeId ret_var = UnsignedChannelAnnouncement_get_node_id_1(&this_ptr_conv);
43474         uint64_t ret_ref = 0;
43475         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
43476         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
43477         return ret_ref;
43478 }
43479
43480 void  __attribute__((export_name("TS_UnsignedChannelAnnouncement_set_node_id_1"))) TS_UnsignedChannelAnnouncement_set_node_id_1(uint64_t this_ptr, uint64_t val) {
43481         LDKUnsignedChannelAnnouncement this_ptr_conv;
43482         this_ptr_conv.inner = untag_ptr(this_ptr);
43483         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
43484         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
43485         this_ptr_conv.is_owned = false;
43486         LDKNodeId val_conv;
43487         val_conv.inner = untag_ptr(val);
43488         val_conv.is_owned = ptr_is_owned(val);
43489         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
43490         val_conv = NodeId_clone(&val_conv);
43491         UnsignedChannelAnnouncement_set_node_id_1(&this_ptr_conv, val_conv);
43492 }
43493
43494 uint64_t  __attribute__((export_name("TS_UnsignedChannelAnnouncement_get_node_id_2"))) TS_UnsignedChannelAnnouncement_get_node_id_2(uint64_t this_ptr) {
43495         LDKUnsignedChannelAnnouncement this_ptr_conv;
43496         this_ptr_conv.inner = untag_ptr(this_ptr);
43497         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
43498         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
43499         this_ptr_conv.is_owned = false;
43500         LDKNodeId ret_var = UnsignedChannelAnnouncement_get_node_id_2(&this_ptr_conv);
43501         uint64_t ret_ref = 0;
43502         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
43503         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
43504         return ret_ref;
43505 }
43506
43507 void  __attribute__((export_name("TS_UnsignedChannelAnnouncement_set_node_id_2"))) TS_UnsignedChannelAnnouncement_set_node_id_2(uint64_t this_ptr, uint64_t val) {
43508         LDKUnsignedChannelAnnouncement this_ptr_conv;
43509         this_ptr_conv.inner = untag_ptr(this_ptr);
43510         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
43511         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
43512         this_ptr_conv.is_owned = false;
43513         LDKNodeId val_conv;
43514         val_conv.inner = untag_ptr(val);
43515         val_conv.is_owned = ptr_is_owned(val);
43516         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
43517         val_conv = NodeId_clone(&val_conv);
43518         UnsignedChannelAnnouncement_set_node_id_2(&this_ptr_conv, val_conv);
43519 }
43520
43521 uint64_t  __attribute__((export_name("TS_UnsignedChannelAnnouncement_get_bitcoin_key_1"))) TS_UnsignedChannelAnnouncement_get_bitcoin_key_1(uint64_t this_ptr) {
43522         LDKUnsignedChannelAnnouncement this_ptr_conv;
43523         this_ptr_conv.inner = untag_ptr(this_ptr);
43524         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
43525         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
43526         this_ptr_conv.is_owned = false;
43527         LDKNodeId ret_var = UnsignedChannelAnnouncement_get_bitcoin_key_1(&this_ptr_conv);
43528         uint64_t ret_ref = 0;
43529         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
43530         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
43531         return ret_ref;
43532 }
43533
43534 void  __attribute__((export_name("TS_UnsignedChannelAnnouncement_set_bitcoin_key_1"))) TS_UnsignedChannelAnnouncement_set_bitcoin_key_1(uint64_t this_ptr, uint64_t val) {
43535         LDKUnsignedChannelAnnouncement this_ptr_conv;
43536         this_ptr_conv.inner = untag_ptr(this_ptr);
43537         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
43538         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
43539         this_ptr_conv.is_owned = false;
43540         LDKNodeId val_conv;
43541         val_conv.inner = untag_ptr(val);
43542         val_conv.is_owned = ptr_is_owned(val);
43543         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
43544         val_conv = NodeId_clone(&val_conv);
43545         UnsignedChannelAnnouncement_set_bitcoin_key_1(&this_ptr_conv, val_conv);
43546 }
43547
43548 uint64_t  __attribute__((export_name("TS_UnsignedChannelAnnouncement_get_bitcoin_key_2"))) TS_UnsignedChannelAnnouncement_get_bitcoin_key_2(uint64_t this_ptr) {
43549         LDKUnsignedChannelAnnouncement this_ptr_conv;
43550         this_ptr_conv.inner = untag_ptr(this_ptr);
43551         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
43552         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
43553         this_ptr_conv.is_owned = false;
43554         LDKNodeId ret_var = UnsignedChannelAnnouncement_get_bitcoin_key_2(&this_ptr_conv);
43555         uint64_t ret_ref = 0;
43556         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
43557         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
43558         return ret_ref;
43559 }
43560
43561 void  __attribute__((export_name("TS_UnsignedChannelAnnouncement_set_bitcoin_key_2"))) TS_UnsignedChannelAnnouncement_set_bitcoin_key_2(uint64_t this_ptr, uint64_t val) {
43562         LDKUnsignedChannelAnnouncement this_ptr_conv;
43563         this_ptr_conv.inner = untag_ptr(this_ptr);
43564         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
43565         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
43566         this_ptr_conv.is_owned = false;
43567         LDKNodeId val_conv;
43568         val_conv.inner = untag_ptr(val);
43569         val_conv.is_owned = ptr_is_owned(val);
43570         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
43571         val_conv = NodeId_clone(&val_conv);
43572         UnsignedChannelAnnouncement_set_bitcoin_key_2(&this_ptr_conv, val_conv);
43573 }
43574
43575 int8_tArray  __attribute__((export_name("TS_UnsignedChannelAnnouncement_get_excess_data"))) TS_UnsignedChannelAnnouncement_get_excess_data(uint64_t this_ptr) {
43576         LDKUnsignedChannelAnnouncement this_ptr_conv;
43577         this_ptr_conv.inner = untag_ptr(this_ptr);
43578         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
43579         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
43580         this_ptr_conv.is_owned = false;
43581         LDKCVec_u8Z ret_var = UnsignedChannelAnnouncement_get_excess_data(&this_ptr_conv);
43582         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
43583         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
43584         CVec_u8Z_free(ret_var);
43585         return ret_arr;
43586 }
43587
43588 void  __attribute__((export_name("TS_UnsignedChannelAnnouncement_set_excess_data"))) TS_UnsignedChannelAnnouncement_set_excess_data(uint64_t this_ptr, int8_tArray val) {
43589         LDKUnsignedChannelAnnouncement this_ptr_conv;
43590         this_ptr_conv.inner = untag_ptr(this_ptr);
43591         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
43592         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
43593         this_ptr_conv.is_owned = false;
43594         LDKCVec_u8Z val_ref;
43595         val_ref.datalen = val->arr_len;
43596         val_ref.data = MALLOC(val_ref.datalen, "LDKCVec_u8Z Bytes");
43597         memcpy(val_ref.data, val->elems, val_ref.datalen); FREE(val);
43598         UnsignedChannelAnnouncement_set_excess_data(&this_ptr_conv, val_ref);
43599 }
43600
43601 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) {
43602         LDKChannelFeatures features_arg_conv;
43603         features_arg_conv.inner = untag_ptr(features_arg);
43604         features_arg_conv.is_owned = ptr_is_owned(features_arg);
43605         CHECK_INNER_FIELD_ACCESS_OR_NULL(features_arg_conv);
43606         features_arg_conv = ChannelFeatures_clone(&features_arg_conv);
43607         LDKThirtyTwoBytes chain_hash_arg_ref;
43608         CHECK(chain_hash_arg->arr_len == 32);
43609         memcpy(chain_hash_arg_ref.data, chain_hash_arg->elems, 32); FREE(chain_hash_arg);
43610         LDKNodeId node_id_1_arg_conv;
43611         node_id_1_arg_conv.inner = untag_ptr(node_id_1_arg);
43612         node_id_1_arg_conv.is_owned = ptr_is_owned(node_id_1_arg);
43613         CHECK_INNER_FIELD_ACCESS_OR_NULL(node_id_1_arg_conv);
43614         node_id_1_arg_conv = NodeId_clone(&node_id_1_arg_conv);
43615         LDKNodeId node_id_2_arg_conv;
43616         node_id_2_arg_conv.inner = untag_ptr(node_id_2_arg);
43617         node_id_2_arg_conv.is_owned = ptr_is_owned(node_id_2_arg);
43618         CHECK_INNER_FIELD_ACCESS_OR_NULL(node_id_2_arg_conv);
43619         node_id_2_arg_conv = NodeId_clone(&node_id_2_arg_conv);
43620         LDKNodeId bitcoin_key_1_arg_conv;
43621         bitcoin_key_1_arg_conv.inner = untag_ptr(bitcoin_key_1_arg);
43622         bitcoin_key_1_arg_conv.is_owned = ptr_is_owned(bitcoin_key_1_arg);
43623         CHECK_INNER_FIELD_ACCESS_OR_NULL(bitcoin_key_1_arg_conv);
43624         bitcoin_key_1_arg_conv = NodeId_clone(&bitcoin_key_1_arg_conv);
43625         LDKNodeId bitcoin_key_2_arg_conv;
43626         bitcoin_key_2_arg_conv.inner = untag_ptr(bitcoin_key_2_arg);
43627         bitcoin_key_2_arg_conv.is_owned = ptr_is_owned(bitcoin_key_2_arg);
43628         CHECK_INNER_FIELD_ACCESS_OR_NULL(bitcoin_key_2_arg_conv);
43629         bitcoin_key_2_arg_conv = NodeId_clone(&bitcoin_key_2_arg_conv);
43630         LDKCVec_u8Z excess_data_arg_ref;
43631         excess_data_arg_ref.datalen = excess_data_arg->arr_len;
43632         excess_data_arg_ref.data = MALLOC(excess_data_arg_ref.datalen, "LDKCVec_u8Z Bytes");
43633         memcpy(excess_data_arg_ref.data, excess_data_arg->elems, excess_data_arg_ref.datalen); FREE(excess_data_arg);
43634         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);
43635         uint64_t ret_ref = 0;
43636         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
43637         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
43638         return ret_ref;
43639 }
43640
43641 static inline uint64_t UnsignedChannelAnnouncement_clone_ptr(LDKUnsignedChannelAnnouncement *NONNULL_PTR arg) {
43642         LDKUnsignedChannelAnnouncement ret_var = UnsignedChannelAnnouncement_clone(arg);
43643         uint64_t ret_ref = 0;
43644         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
43645         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
43646         return ret_ref;
43647 }
43648 int64_t  __attribute__((export_name("TS_UnsignedChannelAnnouncement_clone_ptr"))) TS_UnsignedChannelAnnouncement_clone_ptr(uint64_t arg) {
43649         LDKUnsignedChannelAnnouncement arg_conv;
43650         arg_conv.inner = untag_ptr(arg);
43651         arg_conv.is_owned = ptr_is_owned(arg);
43652         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
43653         arg_conv.is_owned = false;
43654         int64_t ret_conv = UnsignedChannelAnnouncement_clone_ptr(&arg_conv);
43655         return ret_conv;
43656 }
43657
43658 uint64_t  __attribute__((export_name("TS_UnsignedChannelAnnouncement_clone"))) TS_UnsignedChannelAnnouncement_clone(uint64_t orig) {
43659         LDKUnsignedChannelAnnouncement orig_conv;
43660         orig_conv.inner = untag_ptr(orig);
43661         orig_conv.is_owned = ptr_is_owned(orig);
43662         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
43663         orig_conv.is_owned = false;
43664         LDKUnsignedChannelAnnouncement ret_var = UnsignedChannelAnnouncement_clone(&orig_conv);
43665         uint64_t ret_ref = 0;
43666         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
43667         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
43668         return ret_ref;
43669 }
43670
43671 jboolean  __attribute__((export_name("TS_UnsignedChannelAnnouncement_eq"))) TS_UnsignedChannelAnnouncement_eq(uint64_t a, uint64_t b) {
43672         LDKUnsignedChannelAnnouncement a_conv;
43673         a_conv.inner = untag_ptr(a);
43674         a_conv.is_owned = ptr_is_owned(a);
43675         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
43676         a_conv.is_owned = false;
43677         LDKUnsignedChannelAnnouncement b_conv;
43678         b_conv.inner = untag_ptr(b);
43679         b_conv.is_owned = ptr_is_owned(b);
43680         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
43681         b_conv.is_owned = false;
43682         jboolean ret_conv = UnsignedChannelAnnouncement_eq(&a_conv, &b_conv);
43683         return ret_conv;
43684 }
43685
43686 void  __attribute__((export_name("TS_ChannelAnnouncement_free"))) TS_ChannelAnnouncement_free(uint64_t this_obj) {
43687         LDKChannelAnnouncement this_obj_conv;
43688         this_obj_conv.inner = untag_ptr(this_obj);
43689         this_obj_conv.is_owned = ptr_is_owned(this_obj);
43690         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
43691         ChannelAnnouncement_free(this_obj_conv);
43692 }
43693
43694 int8_tArray  __attribute__((export_name("TS_ChannelAnnouncement_get_node_signature_1"))) TS_ChannelAnnouncement_get_node_signature_1(uint64_t this_ptr) {
43695         LDKChannelAnnouncement this_ptr_conv;
43696         this_ptr_conv.inner = untag_ptr(this_ptr);
43697         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
43698         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
43699         this_ptr_conv.is_owned = false;
43700         int8_tArray ret_arr = init_int8_tArray(64, __LINE__);
43701         memcpy(ret_arr->elems, ChannelAnnouncement_get_node_signature_1(&this_ptr_conv).compact_form, 64);
43702         return ret_arr;
43703 }
43704
43705 void  __attribute__((export_name("TS_ChannelAnnouncement_set_node_signature_1"))) TS_ChannelAnnouncement_set_node_signature_1(uint64_t this_ptr, int8_tArray val) {
43706         LDKChannelAnnouncement this_ptr_conv;
43707         this_ptr_conv.inner = untag_ptr(this_ptr);
43708         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
43709         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
43710         this_ptr_conv.is_owned = false;
43711         LDKECDSASignature val_ref;
43712         CHECK(val->arr_len == 64);
43713         memcpy(val_ref.compact_form, val->elems, 64); FREE(val);
43714         ChannelAnnouncement_set_node_signature_1(&this_ptr_conv, val_ref);
43715 }
43716
43717 int8_tArray  __attribute__((export_name("TS_ChannelAnnouncement_get_node_signature_2"))) TS_ChannelAnnouncement_get_node_signature_2(uint64_t this_ptr) {
43718         LDKChannelAnnouncement this_ptr_conv;
43719         this_ptr_conv.inner = untag_ptr(this_ptr);
43720         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
43721         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
43722         this_ptr_conv.is_owned = false;
43723         int8_tArray ret_arr = init_int8_tArray(64, __LINE__);
43724         memcpy(ret_arr->elems, ChannelAnnouncement_get_node_signature_2(&this_ptr_conv).compact_form, 64);
43725         return ret_arr;
43726 }
43727
43728 void  __attribute__((export_name("TS_ChannelAnnouncement_set_node_signature_2"))) TS_ChannelAnnouncement_set_node_signature_2(uint64_t this_ptr, int8_tArray val) {
43729         LDKChannelAnnouncement this_ptr_conv;
43730         this_ptr_conv.inner = untag_ptr(this_ptr);
43731         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
43732         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
43733         this_ptr_conv.is_owned = false;
43734         LDKECDSASignature val_ref;
43735         CHECK(val->arr_len == 64);
43736         memcpy(val_ref.compact_form, val->elems, 64); FREE(val);
43737         ChannelAnnouncement_set_node_signature_2(&this_ptr_conv, val_ref);
43738 }
43739
43740 int8_tArray  __attribute__((export_name("TS_ChannelAnnouncement_get_bitcoin_signature_1"))) TS_ChannelAnnouncement_get_bitcoin_signature_1(uint64_t this_ptr) {
43741         LDKChannelAnnouncement this_ptr_conv;
43742         this_ptr_conv.inner = untag_ptr(this_ptr);
43743         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
43744         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
43745         this_ptr_conv.is_owned = false;
43746         int8_tArray ret_arr = init_int8_tArray(64, __LINE__);
43747         memcpy(ret_arr->elems, ChannelAnnouncement_get_bitcoin_signature_1(&this_ptr_conv).compact_form, 64);
43748         return ret_arr;
43749 }
43750
43751 void  __attribute__((export_name("TS_ChannelAnnouncement_set_bitcoin_signature_1"))) TS_ChannelAnnouncement_set_bitcoin_signature_1(uint64_t this_ptr, int8_tArray val) {
43752         LDKChannelAnnouncement this_ptr_conv;
43753         this_ptr_conv.inner = untag_ptr(this_ptr);
43754         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
43755         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
43756         this_ptr_conv.is_owned = false;
43757         LDKECDSASignature val_ref;
43758         CHECK(val->arr_len == 64);
43759         memcpy(val_ref.compact_form, val->elems, 64); FREE(val);
43760         ChannelAnnouncement_set_bitcoin_signature_1(&this_ptr_conv, val_ref);
43761 }
43762
43763 int8_tArray  __attribute__((export_name("TS_ChannelAnnouncement_get_bitcoin_signature_2"))) TS_ChannelAnnouncement_get_bitcoin_signature_2(uint64_t this_ptr) {
43764         LDKChannelAnnouncement this_ptr_conv;
43765         this_ptr_conv.inner = untag_ptr(this_ptr);
43766         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
43767         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
43768         this_ptr_conv.is_owned = false;
43769         int8_tArray ret_arr = init_int8_tArray(64, __LINE__);
43770         memcpy(ret_arr->elems, ChannelAnnouncement_get_bitcoin_signature_2(&this_ptr_conv).compact_form, 64);
43771         return ret_arr;
43772 }
43773
43774 void  __attribute__((export_name("TS_ChannelAnnouncement_set_bitcoin_signature_2"))) TS_ChannelAnnouncement_set_bitcoin_signature_2(uint64_t this_ptr, int8_tArray val) {
43775         LDKChannelAnnouncement this_ptr_conv;
43776         this_ptr_conv.inner = untag_ptr(this_ptr);
43777         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
43778         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
43779         this_ptr_conv.is_owned = false;
43780         LDKECDSASignature val_ref;
43781         CHECK(val->arr_len == 64);
43782         memcpy(val_ref.compact_form, val->elems, 64); FREE(val);
43783         ChannelAnnouncement_set_bitcoin_signature_2(&this_ptr_conv, val_ref);
43784 }
43785
43786 uint64_t  __attribute__((export_name("TS_ChannelAnnouncement_get_contents"))) TS_ChannelAnnouncement_get_contents(uint64_t this_ptr) {
43787         LDKChannelAnnouncement this_ptr_conv;
43788         this_ptr_conv.inner = untag_ptr(this_ptr);
43789         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
43790         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
43791         this_ptr_conv.is_owned = false;
43792         LDKUnsignedChannelAnnouncement ret_var = ChannelAnnouncement_get_contents(&this_ptr_conv);
43793         uint64_t ret_ref = 0;
43794         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
43795         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
43796         return ret_ref;
43797 }
43798
43799 void  __attribute__((export_name("TS_ChannelAnnouncement_set_contents"))) TS_ChannelAnnouncement_set_contents(uint64_t this_ptr, uint64_t val) {
43800         LDKChannelAnnouncement this_ptr_conv;
43801         this_ptr_conv.inner = untag_ptr(this_ptr);
43802         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
43803         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
43804         this_ptr_conv.is_owned = false;
43805         LDKUnsignedChannelAnnouncement val_conv;
43806         val_conv.inner = untag_ptr(val);
43807         val_conv.is_owned = ptr_is_owned(val);
43808         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
43809         val_conv = UnsignedChannelAnnouncement_clone(&val_conv);
43810         ChannelAnnouncement_set_contents(&this_ptr_conv, val_conv);
43811 }
43812
43813 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) {
43814         LDKECDSASignature node_signature_1_arg_ref;
43815         CHECK(node_signature_1_arg->arr_len == 64);
43816         memcpy(node_signature_1_arg_ref.compact_form, node_signature_1_arg->elems, 64); FREE(node_signature_1_arg);
43817         LDKECDSASignature node_signature_2_arg_ref;
43818         CHECK(node_signature_2_arg->arr_len == 64);
43819         memcpy(node_signature_2_arg_ref.compact_form, node_signature_2_arg->elems, 64); FREE(node_signature_2_arg);
43820         LDKECDSASignature bitcoin_signature_1_arg_ref;
43821         CHECK(bitcoin_signature_1_arg->arr_len == 64);
43822         memcpy(bitcoin_signature_1_arg_ref.compact_form, bitcoin_signature_1_arg->elems, 64); FREE(bitcoin_signature_1_arg);
43823         LDKECDSASignature bitcoin_signature_2_arg_ref;
43824         CHECK(bitcoin_signature_2_arg->arr_len == 64);
43825         memcpy(bitcoin_signature_2_arg_ref.compact_form, bitcoin_signature_2_arg->elems, 64); FREE(bitcoin_signature_2_arg);
43826         LDKUnsignedChannelAnnouncement contents_arg_conv;
43827         contents_arg_conv.inner = untag_ptr(contents_arg);
43828         contents_arg_conv.is_owned = ptr_is_owned(contents_arg);
43829         CHECK_INNER_FIELD_ACCESS_OR_NULL(contents_arg_conv);
43830         contents_arg_conv = UnsignedChannelAnnouncement_clone(&contents_arg_conv);
43831         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);
43832         uint64_t ret_ref = 0;
43833         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
43834         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
43835         return ret_ref;
43836 }
43837
43838 static inline uint64_t ChannelAnnouncement_clone_ptr(LDKChannelAnnouncement *NONNULL_PTR arg) {
43839         LDKChannelAnnouncement ret_var = ChannelAnnouncement_clone(arg);
43840         uint64_t ret_ref = 0;
43841         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
43842         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
43843         return ret_ref;
43844 }
43845 int64_t  __attribute__((export_name("TS_ChannelAnnouncement_clone_ptr"))) TS_ChannelAnnouncement_clone_ptr(uint64_t arg) {
43846         LDKChannelAnnouncement arg_conv;
43847         arg_conv.inner = untag_ptr(arg);
43848         arg_conv.is_owned = ptr_is_owned(arg);
43849         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
43850         arg_conv.is_owned = false;
43851         int64_t ret_conv = ChannelAnnouncement_clone_ptr(&arg_conv);
43852         return ret_conv;
43853 }
43854
43855 uint64_t  __attribute__((export_name("TS_ChannelAnnouncement_clone"))) TS_ChannelAnnouncement_clone(uint64_t orig) {
43856         LDKChannelAnnouncement orig_conv;
43857         orig_conv.inner = untag_ptr(orig);
43858         orig_conv.is_owned = ptr_is_owned(orig);
43859         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
43860         orig_conv.is_owned = false;
43861         LDKChannelAnnouncement ret_var = ChannelAnnouncement_clone(&orig_conv);
43862         uint64_t ret_ref = 0;
43863         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
43864         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
43865         return ret_ref;
43866 }
43867
43868 jboolean  __attribute__((export_name("TS_ChannelAnnouncement_eq"))) TS_ChannelAnnouncement_eq(uint64_t a, uint64_t b) {
43869         LDKChannelAnnouncement a_conv;
43870         a_conv.inner = untag_ptr(a);
43871         a_conv.is_owned = ptr_is_owned(a);
43872         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
43873         a_conv.is_owned = false;
43874         LDKChannelAnnouncement b_conv;
43875         b_conv.inner = untag_ptr(b);
43876         b_conv.is_owned = ptr_is_owned(b);
43877         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
43878         b_conv.is_owned = false;
43879         jboolean ret_conv = ChannelAnnouncement_eq(&a_conv, &b_conv);
43880         return ret_conv;
43881 }
43882
43883 void  __attribute__((export_name("TS_UnsignedChannelUpdate_free"))) TS_UnsignedChannelUpdate_free(uint64_t this_obj) {
43884         LDKUnsignedChannelUpdate this_obj_conv;
43885         this_obj_conv.inner = untag_ptr(this_obj);
43886         this_obj_conv.is_owned = ptr_is_owned(this_obj);
43887         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
43888         UnsignedChannelUpdate_free(this_obj_conv);
43889 }
43890
43891 int8_tArray  __attribute__((export_name("TS_UnsignedChannelUpdate_get_chain_hash"))) TS_UnsignedChannelUpdate_get_chain_hash(uint64_t this_ptr) {
43892         LDKUnsignedChannelUpdate this_ptr_conv;
43893         this_ptr_conv.inner = untag_ptr(this_ptr);
43894         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
43895         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
43896         this_ptr_conv.is_owned = false;
43897         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
43898         memcpy(ret_arr->elems, *UnsignedChannelUpdate_get_chain_hash(&this_ptr_conv), 32);
43899         return ret_arr;
43900 }
43901
43902 void  __attribute__((export_name("TS_UnsignedChannelUpdate_set_chain_hash"))) TS_UnsignedChannelUpdate_set_chain_hash(uint64_t this_ptr, int8_tArray val) {
43903         LDKUnsignedChannelUpdate this_ptr_conv;
43904         this_ptr_conv.inner = untag_ptr(this_ptr);
43905         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
43906         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
43907         this_ptr_conv.is_owned = false;
43908         LDKThirtyTwoBytes val_ref;
43909         CHECK(val->arr_len == 32);
43910         memcpy(val_ref.data, val->elems, 32); FREE(val);
43911         UnsignedChannelUpdate_set_chain_hash(&this_ptr_conv, val_ref);
43912 }
43913
43914 int64_t  __attribute__((export_name("TS_UnsignedChannelUpdate_get_short_channel_id"))) TS_UnsignedChannelUpdate_get_short_channel_id(uint64_t this_ptr) {
43915         LDKUnsignedChannelUpdate this_ptr_conv;
43916         this_ptr_conv.inner = untag_ptr(this_ptr);
43917         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
43918         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
43919         this_ptr_conv.is_owned = false;
43920         int64_t ret_conv = UnsignedChannelUpdate_get_short_channel_id(&this_ptr_conv);
43921         return ret_conv;
43922 }
43923
43924 void  __attribute__((export_name("TS_UnsignedChannelUpdate_set_short_channel_id"))) TS_UnsignedChannelUpdate_set_short_channel_id(uint64_t this_ptr, int64_t val) {
43925         LDKUnsignedChannelUpdate this_ptr_conv;
43926         this_ptr_conv.inner = untag_ptr(this_ptr);
43927         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
43928         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
43929         this_ptr_conv.is_owned = false;
43930         UnsignedChannelUpdate_set_short_channel_id(&this_ptr_conv, val);
43931 }
43932
43933 int32_t  __attribute__((export_name("TS_UnsignedChannelUpdate_get_timestamp"))) TS_UnsignedChannelUpdate_get_timestamp(uint64_t this_ptr) {
43934         LDKUnsignedChannelUpdate this_ptr_conv;
43935         this_ptr_conv.inner = untag_ptr(this_ptr);
43936         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
43937         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
43938         this_ptr_conv.is_owned = false;
43939         int32_t ret_conv = UnsignedChannelUpdate_get_timestamp(&this_ptr_conv);
43940         return ret_conv;
43941 }
43942
43943 void  __attribute__((export_name("TS_UnsignedChannelUpdate_set_timestamp"))) TS_UnsignedChannelUpdate_set_timestamp(uint64_t this_ptr, int32_t val) {
43944         LDKUnsignedChannelUpdate this_ptr_conv;
43945         this_ptr_conv.inner = untag_ptr(this_ptr);
43946         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
43947         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
43948         this_ptr_conv.is_owned = false;
43949         UnsignedChannelUpdate_set_timestamp(&this_ptr_conv, val);
43950 }
43951
43952 int8_t  __attribute__((export_name("TS_UnsignedChannelUpdate_get_flags"))) TS_UnsignedChannelUpdate_get_flags(uint64_t this_ptr) {
43953         LDKUnsignedChannelUpdate this_ptr_conv;
43954         this_ptr_conv.inner = untag_ptr(this_ptr);
43955         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
43956         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
43957         this_ptr_conv.is_owned = false;
43958         int8_t ret_conv = UnsignedChannelUpdate_get_flags(&this_ptr_conv);
43959         return ret_conv;
43960 }
43961
43962 void  __attribute__((export_name("TS_UnsignedChannelUpdate_set_flags"))) TS_UnsignedChannelUpdate_set_flags(uint64_t this_ptr, int8_t val) {
43963         LDKUnsignedChannelUpdate this_ptr_conv;
43964         this_ptr_conv.inner = untag_ptr(this_ptr);
43965         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
43966         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
43967         this_ptr_conv.is_owned = false;
43968         UnsignedChannelUpdate_set_flags(&this_ptr_conv, val);
43969 }
43970
43971 int16_t  __attribute__((export_name("TS_UnsignedChannelUpdate_get_cltv_expiry_delta"))) TS_UnsignedChannelUpdate_get_cltv_expiry_delta(uint64_t this_ptr) {
43972         LDKUnsignedChannelUpdate this_ptr_conv;
43973         this_ptr_conv.inner = untag_ptr(this_ptr);
43974         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
43975         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
43976         this_ptr_conv.is_owned = false;
43977         int16_t ret_conv = UnsignedChannelUpdate_get_cltv_expiry_delta(&this_ptr_conv);
43978         return ret_conv;
43979 }
43980
43981 void  __attribute__((export_name("TS_UnsignedChannelUpdate_set_cltv_expiry_delta"))) TS_UnsignedChannelUpdate_set_cltv_expiry_delta(uint64_t this_ptr, int16_t val) {
43982         LDKUnsignedChannelUpdate this_ptr_conv;
43983         this_ptr_conv.inner = untag_ptr(this_ptr);
43984         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
43985         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
43986         this_ptr_conv.is_owned = false;
43987         UnsignedChannelUpdate_set_cltv_expiry_delta(&this_ptr_conv, val);
43988 }
43989
43990 int64_t  __attribute__((export_name("TS_UnsignedChannelUpdate_get_htlc_minimum_msat"))) TS_UnsignedChannelUpdate_get_htlc_minimum_msat(uint64_t this_ptr) {
43991         LDKUnsignedChannelUpdate this_ptr_conv;
43992         this_ptr_conv.inner = untag_ptr(this_ptr);
43993         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
43994         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
43995         this_ptr_conv.is_owned = false;
43996         int64_t ret_conv = UnsignedChannelUpdate_get_htlc_minimum_msat(&this_ptr_conv);
43997         return ret_conv;
43998 }
43999
44000 void  __attribute__((export_name("TS_UnsignedChannelUpdate_set_htlc_minimum_msat"))) TS_UnsignedChannelUpdate_set_htlc_minimum_msat(uint64_t this_ptr, int64_t val) {
44001         LDKUnsignedChannelUpdate this_ptr_conv;
44002         this_ptr_conv.inner = untag_ptr(this_ptr);
44003         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
44004         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
44005         this_ptr_conv.is_owned = false;
44006         UnsignedChannelUpdate_set_htlc_minimum_msat(&this_ptr_conv, val);
44007 }
44008
44009 int64_t  __attribute__((export_name("TS_UnsignedChannelUpdate_get_htlc_maximum_msat"))) TS_UnsignedChannelUpdate_get_htlc_maximum_msat(uint64_t this_ptr) {
44010         LDKUnsignedChannelUpdate this_ptr_conv;
44011         this_ptr_conv.inner = untag_ptr(this_ptr);
44012         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
44013         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
44014         this_ptr_conv.is_owned = false;
44015         int64_t ret_conv = UnsignedChannelUpdate_get_htlc_maximum_msat(&this_ptr_conv);
44016         return ret_conv;
44017 }
44018
44019 void  __attribute__((export_name("TS_UnsignedChannelUpdate_set_htlc_maximum_msat"))) TS_UnsignedChannelUpdate_set_htlc_maximum_msat(uint64_t this_ptr, int64_t val) {
44020         LDKUnsignedChannelUpdate this_ptr_conv;
44021         this_ptr_conv.inner = untag_ptr(this_ptr);
44022         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
44023         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
44024         this_ptr_conv.is_owned = false;
44025         UnsignedChannelUpdate_set_htlc_maximum_msat(&this_ptr_conv, val);
44026 }
44027
44028 int32_t  __attribute__((export_name("TS_UnsignedChannelUpdate_get_fee_base_msat"))) TS_UnsignedChannelUpdate_get_fee_base_msat(uint64_t this_ptr) {
44029         LDKUnsignedChannelUpdate this_ptr_conv;
44030         this_ptr_conv.inner = untag_ptr(this_ptr);
44031         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
44032         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
44033         this_ptr_conv.is_owned = false;
44034         int32_t ret_conv = UnsignedChannelUpdate_get_fee_base_msat(&this_ptr_conv);
44035         return ret_conv;
44036 }
44037
44038 void  __attribute__((export_name("TS_UnsignedChannelUpdate_set_fee_base_msat"))) TS_UnsignedChannelUpdate_set_fee_base_msat(uint64_t this_ptr, int32_t val) {
44039         LDKUnsignedChannelUpdate this_ptr_conv;
44040         this_ptr_conv.inner = untag_ptr(this_ptr);
44041         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
44042         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
44043         this_ptr_conv.is_owned = false;
44044         UnsignedChannelUpdate_set_fee_base_msat(&this_ptr_conv, val);
44045 }
44046
44047 int32_t  __attribute__((export_name("TS_UnsignedChannelUpdate_get_fee_proportional_millionths"))) TS_UnsignedChannelUpdate_get_fee_proportional_millionths(uint64_t this_ptr) {
44048         LDKUnsignedChannelUpdate this_ptr_conv;
44049         this_ptr_conv.inner = untag_ptr(this_ptr);
44050         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
44051         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
44052         this_ptr_conv.is_owned = false;
44053         int32_t ret_conv = UnsignedChannelUpdate_get_fee_proportional_millionths(&this_ptr_conv);
44054         return ret_conv;
44055 }
44056
44057 void  __attribute__((export_name("TS_UnsignedChannelUpdate_set_fee_proportional_millionths"))) TS_UnsignedChannelUpdate_set_fee_proportional_millionths(uint64_t this_ptr, int32_t val) {
44058         LDKUnsignedChannelUpdate this_ptr_conv;
44059         this_ptr_conv.inner = untag_ptr(this_ptr);
44060         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
44061         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
44062         this_ptr_conv.is_owned = false;
44063         UnsignedChannelUpdate_set_fee_proportional_millionths(&this_ptr_conv, val);
44064 }
44065
44066 int8_tArray  __attribute__((export_name("TS_UnsignedChannelUpdate_get_excess_data"))) TS_UnsignedChannelUpdate_get_excess_data(uint64_t this_ptr) {
44067         LDKUnsignedChannelUpdate this_ptr_conv;
44068         this_ptr_conv.inner = untag_ptr(this_ptr);
44069         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
44070         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
44071         this_ptr_conv.is_owned = false;
44072         LDKCVec_u8Z ret_var = UnsignedChannelUpdate_get_excess_data(&this_ptr_conv);
44073         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
44074         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
44075         CVec_u8Z_free(ret_var);
44076         return ret_arr;
44077 }
44078
44079 void  __attribute__((export_name("TS_UnsignedChannelUpdate_set_excess_data"))) TS_UnsignedChannelUpdate_set_excess_data(uint64_t this_ptr, int8_tArray val) {
44080         LDKUnsignedChannelUpdate this_ptr_conv;
44081         this_ptr_conv.inner = untag_ptr(this_ptr);
44082         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
44083         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
44084         this_ptr_conv.is_owned = false;
44085         LDKCVec_u8Z val_ref;
44086         val_ref.datalen = val->arr_len;
44087         val_ref.data = MALLOC(val_ref.datalen, "LDKCVec_u8Z Bytes");
44088         memcpy(val_ref.data, val->elems, val_ref.datalen); FREE(val);
44089         UnsignedChannelUpdate_set_excess_data(&this_ptr_conv, val_ref);
44090 }
44091
44092 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) {
44093         LDKThirtyTwoBytes chain_hash_arg_ref;
44094         CHECK(chain_hash_arg->arr_len == 32);
44095         memcpy(chain_hash_arg_ref.data, chain_hash_arg->elems, 32); FREE(chain_hash_arg);
44096         LDKCVec_u8Z excess_data_arg_ref;
44097         excess_data_arg_ref.datalen = excess_data_arg->arr_len;
44098         excess_data_arg_ref.data = MALLOC(excess_data_arg_ref.datalen, "LDKCVec_u8Z Bytes");
44099         memcpy(excess_data_arg_ref.data, excess_data_arg->elems, excess_data_arg_ref.datalen); FREE(excess_data_arg);
44100         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);
44101         uint64_t ret_ref = 0;
44102         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
44103         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
44104         return ret_ref;
44105 }
44106
44107 static inline uint64_t UnsignedChannelUpdate_clone_ptr(LDKUnsignedChannelUpdate *NONNULL_PTR arg) {
44108         LDKUnsignedChannelUpdate ret_var = UnsignedChannelUpdate_clone(arg);
44109         uint64_t ret_ref = 0;
44110         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
44111         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
44112         return ret_ref;
44113 }
44114 int64_t  __attribute__((export_name("TS_UnsignedChannelUpdate_clone_ptr"))) TS_UnsignedChannelUpdate_clone_ptr(uint64_t arg) {
44115         LDKUnsignedChannelUpdate arg_conv;
44116         arg_conv.inner = untag_ptr(arg);
44117         arg_conv.is_owned = ptr_is_owned(arg);
44118         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
44119         arg_conv.is_owned = false;
44120         int64_t ret_conv = UnsignedChannelUpdate_clone_ptr(&arg_conv);
44121         return ret_conv;
44122 }
44123
44124 uint64_t  __attribute__((export_name("TS_UnsignedChannelUpdate_clone"))) TS_UnsignedChannelUpdate_clone(uint64_t orig) {
44125         LDKUnsignedChannelUpdate orig_conv;
44126         orig_conv.inner = untag_ptr(orig);
44127         orig_conv.is_owned = ptr_is_owned(orig);
44128         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
44129         orig_conv.is_owned = false;
44130         LDKUnsignedChannelUpdate ret_var = UnsignedChannelUpdate_clone(&orig_conv);
44131         uint64_t ret_ref = 0;
44132         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
44133         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
44134         return ret_ref;
44135 }
44136
44137 jboolean  __attribute__((export_name("TS_UnsignedChannelUpdate_eq"))) TS_UnsignedChannelUpdate_eq(uint64_t a, uint64_t b) {
44138         LDKUnsignedChannelUpdate a_conv;
44139         a_conv.inner = untag_ptr(a);
44140         a_conv.is_owned = ptr_is_owned(a);
44141         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
44142         a_conv.is_owned = false;
44143         LDKUnsignedChannelUpdate b_conv;
44144         b_conv.inner = untag_ptr(b);
44145         b_conv.is_owned = ptr_is_owned(b);
44146         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
44147         b_conv.is_owned = false;
44148         jboolean ret_conv = UnsignedChannelUpdate_eq(&a_conv, &b_conv);
44149         return ret_conv;
44150 }
44151
44152 void  __attribute__((export_name("TS_ChannelUpdate_free"))) TS_ChannelUpdate_free(uint64_t this_obj) {
44153         LDKChannelUpdate this_obj_conv;
44154         this_obj_conv.inner = untag_ptr(this_obj);
44155         this_obj_conv.is_owned = ptr_is_owned(this_obj);
44156         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
44157         ChannelUpdate_free(this_obj_conv);
44158 }
44159
44160 int8_tArray  __attribute__((export_name("TS_ChannelUpdate_get_signature"))) TS_ChannelUpdate_get_signature(uint64_t this_ptr) {
44161         LDKChannelUpdate this_ptr_conv;
44162         this_ptr_conv.inner = untag_ptr(this_ptr);
44163         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
44164         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
44165         this_ptr_conv.is_owned = false;
44166         int8_tArray ret_arr = init_int8_tArray(64, __LINE__);
44167         memcpy(ret_arr->elems, ChannelUpdate_get_signature(&this_ptr_conv).compact_form, 64);
44168         return ret_arr;
44169 }
44170
44171 void  __attribute__((export_name("TS_ChannelUpdate_set_signature"))) TS_ChannelUpdate_set_signature(uint64_t this_ptr, int8_tArray val) {
44172         LDKChannelUpdate this_ptr_conv;
44173         this_ptr_conv.inner = untag_ptr(this_ptr);
44174         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
44175         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
44176         this_ptr_conv.is_owned = false;
44177         LDKECDSASignature val_ref;
44178         CHECK(val->arr_len == 64);
44179         memcpy(val_ref.compact_form, val->elems, 64); FREE(val);
44180         ChannelUpdate_set_signature(&this_ptr_conv, val_ref);
44181 }
44182
44183 uint64_t  __attribute__((export_name("TS_ChannelUpdate_get_contents"))) TS_ChannelUpdate_get_contents(uint64_t this_ptr) {
44184         LDKChannelUpdate this_ptr_conv;
44185         this_ptr_conv.inner = untag_ptr(this_ptr);
44186         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
44187         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
44188         this_ptr_conv.is_owned = false;
44189         LDKUnsignedChannelUpdate ret_var = ChannelUpdate_get_contents(&this_ptr_conv);
44190         uint64_t ret_ref = 0;
44191         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
44192         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
44193         return ret_ref;
44194 }
44195
44196 void  __attribute__((export_name("TS_ChannelUpdate_set_contents"))) TS_ChannelUpdate_set_contents(uint64_t this_ptr, uint64_t val) {
44197         LDKChannelUpdate this_ptr_conv;
44198         this_ptr_conv.inner = untag_ptr(this_ptr);
44199         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
44200         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
44201         this_ptr_conv.is_owned = false;
44202         LDKUnsignedChannelUpdate val_conv;
44203         val_conv.inner = untag_ptr(val);
44204         val_conv.is_owned = ptr_is_owned(val);
44205         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
44206         val_conv = UnsignedChannelUpdate_clone(&val_conv);
44207         ChannelUpdate_set_contents(&this_ptr_conv, val_conv);
44208 }
44209
44210 uint64_t  __attribute__((export_name("TS_ChannelUpdate_new"))) TS_ChannelUpdate_new(int8_tArray signature_arg, uint64_t contents_arg) {
44211         LDKECDSASignature signature_arg_ref;
44212         CHECK(signature_arg->arr_len == 64);
44213         memcpy(signature_arg_ref.compact_form, signature_arg->elems, 64); FREE(signature_arg);
44214         LDKUnsignedChannelUpdate contents_arg_conv;
44215         contents_arg_conv.inner = untag_ptr(contents_arg);
44216         contents_arg_conv.is_owned = ptr_is_owned(contents_arg);
44217         CHECK_INNER_FIELD_ACCESS_OR_NULL(contents_arg_conv);
44218         contents_arg_conv = UnsignedChannelUpdate_clone(&contents_arg_conv);
44219         LDKChannelUpdate ret_var = ChannelUpdate_new(signature_arg_ref, contents_arg_conv);
44220         uint64_t ret_ref = 0;
44221         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
44222         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
44223         return ret_ref;
44224 }
44225
44226 static inline uint64_t ChannelUpdate_clone_ptr(LDKChannelUpdate *NONNULL_PTR arg) {
44227         LDKChannelUpdate ret_var = ChannelUpdate_clone(arg);
44228         uint64_t ret_ref = 0;
44229         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
44230         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
44231         return ret_ref;
44232 }
44233 int64_t  __attribute__((export_name("TS_ChannelUpdate_clone_ptr"))) TS_ChannelUpdate_clone_ptr(uint64_t arg) {
44234         LDKChannelUpdate arg_conv;
44235         arg_conv.inner = untag_ptr(arg);
44236         arg_conv.is_owned = ptr_is_owned(arg);
44237         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
44238         arg_conv.is_owned = false;
44239         int64_t ret_conv = ChannelUpdate_clone_ptr(&arg_conv);
44240         return ret_conv;
44241 }
44242
44243 uint64_t  __attribute__((export_name("TS_ChannelUpdate_clone"))) TS_ChannelUpdate_clone(uint64_t orig) {
44244         LDKChannelUpdate orig_conv;
44245         orig_conv.inner = untag_ptr(orig);
44246         orig_conv.is_owned = ptr_is_owned(orig);
44247         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
44248         orig_conv.is_owned = false;
44249         LDKChannelUpdate ret_var = ChannelUpdate_clone(&orig_conv);
44250         uint64_t ret_ref = 0;
44251         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
44252         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
44253         return ret_ref;
44254 }
44255
44256 jboolean  __attribute__((export_name("TS_ChannelUpdate_eq"))) TS_ChannelUpdate_eq(uint64_t a, uint64_t b) {
44257         LDKChannelUpdate a_conv;
44258         a_conv.inner = untag_ptr(a);
44259         a_conv.is_owned = ptr_is_owned(a);
44260         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
44261         a_conv.is_owned = false;
44262         LDKChannelUpdate b_conv;
44263         b_conv.inner = untag_ptr(b);
44264         b_conv.is_owned = ptr_is_owned(b);
44265         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
44266         b_conv.is_owned = false;
44267         jboolean ret_conv = ChannelUpdate_eq(&a_conv, &b_conv);
44268         return ret_conv;
44269 }
44270
44271 void  __attribute__((export_name("TS_QueryChannelRange_free"))) TS_QueryChannelRange_free(uint64_t this_obj) {
44272         LDKQueryChannelRange this_obj_conv;
44273         this_obj_conv.inner = untag_ptr(this_obj);
44274         this_obj_conv.is_owned = ptr_is_owned(this_obj);
44275         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
44276         QueryChannelRange_free(this_obj_conv);
44277 }
44278
44279 int8_tArray  __attribute__((export_name("TS_QueryChannelRange_get_chain_hash"))) TS_QueryChannelRange_get_chain_hash(uint64_t this_ptr) {
44280         LDKQueryChannelRange this_ptr_conv;
44281         this_ptr_conv.inner = untag_ptr(this_ptr);
44282         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
44283         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
44284         this_ptr_conv.is_owned = false;
44285         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
44286         memcpy(ret_arr->elems, *QueryChannelRange_get_chain_hash(&this_ptr_conv), 32);
44287         return ret_arr;
44288 }
44289
44290 void  __attribute__((export_name("TS_QueryChannelRange_set_chain_hash"))) TS_QueryChannelRange_set_chain_hash(uint64_t this_ptr, int8_tArray val) {
44291         LDKQueryChannelRange this_ptr_conv;
44292         this_ptr_conv.inner = untag_ptr(this_ptr);
44293         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
44294         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
44295         this_ptr_conv.is_owned = false;
44296         LDKThirtyTwoBytes val_ref;
44297         CHECK(val->arr_len == 32);
44298         memcpy(val_ref.data, val->elems, 32); FREE(val);
44299         QueryChannelRange_set_chain_hash(&this_ptr_conv, val_ref);
44300 }
44301
44302 int32_t  __attribute__((export_name("TS_QueryChannelRange_get_first_blocknum"))) TS_QueryChannelRange_get_first_blocknum(uint64_t this_ptr) {
44303         LDKQueryChannelRange this_ptr_conv;
44304         this_ptr_conv.inner = untag_ptr(this_ptr);
44305         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
44306         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
44307         this_ptr_conv.is_owned = false;
44308         int32_t ret_conv = QueryChannelRange_get_first_blocknum(&this_ptr_conv);
44309         return ret_conv;
44310 }
44311
44312 void  __attribute__((export_name("TS_QueryChannelRange_set_first_blocknum"))) TS_QueryChannelRange_set_first_blocknum(uint64_t this_ptr, int32_t val) {
44313         LDKQueryChannelRange this_ptr_conv;
44314         this_ptr_conv.inner = untag_ptr(this_ptr);
44315         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
44316         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
44317         this_ptr_conv.is_owned = false;
44318         QueryChannelRange_set_first_blocknum(&this_ptr_conv, val);
44319 }
44320
44321 int32_t  __attribute__((export_name("TS_QueryChannelRange_get_number_of_blocks"))) TS_QueryChannelRange_get_number_of_blocks(uint64_t this_ptr) {
44322         LDKQueryChannelRange this_ptr_conv;
44323         this_ptr_conv.inner = untag_ptr(this_ptr);
44324         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
44325         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
44326         this_ptr_conv.is_owned = false;
44327         int32_t ret_conv = QueryChannelRange_get_number_of_blocks(&this_ptr_conv);
44328         return ret_conv;
44329 }
44330
44331 void  __attribute__((export_name("TS_QueryChannelRange_set_number_of_blocks"))) TS_QueryChannelRange_set_number_of_blocks(uint64_t this_ptr, int32_t val) {
44332         LDKQueryChannelRange this_ptr_conv;
44333         this_ptr_conv.inner = untag_ptr(this_ptr);
44334         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
44335         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
44336         this_ptr_conv.is_owned = false;
44337         QueryChannelRange_set_number_of_blocks(&this_ptr_conv, val);
44338 }
44339
44340 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) {
44341         LDKThirtyTwoBytes chain_hash_arg_ref;
44342         CHECK(chain_hash_arg->arr_len == 32);
44343         memcpy(chain_hash_arg_ref.data, chain_hash_arg->elems, 32); FREE(chain_hash_arg);
44344         LDKQueryChannelRange ret_var = QueryChannelRange_new(chain_hash_arg_ref, first_blocknum_arg, number_of_blocks_arg);
44345         uint64_t ret_ref = 0;
44346         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
44347         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
44348         return ret_ref;
44349 }
44350
44351 static inline uint64_t QueryChannelRange_clone_ptr(LDKQueryChannelRange *NONNULL_PTR arg) {
44352         LDKQueryChannelRange ret_var = QueryChannelRange_clone(arg);
44353         uint64_t ret_ref = 0;
44354         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
44355         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
44356         return ret_ref;
44357 }
44358 int64_t  __attribute__((export_name("TS_QueryChannelRange_clone_ptr"))) TS_QueryChannelRange_clone_ptr(uint64_t arg) {
44359         LDKQueryChannelRange arg_conv;
44360         arg_conv.inner = untag_ptr(arg);
44361         arg_conv.is_owned = ptr_is_owned(arg);
44362         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
44363         arg_conv.is_owned = false;
44364         int64_t ret_conv = QueryChannelRange_clone_ptr(&arg_conv);
44365         return ret_conv;
44366 }
44367
44368 uint64_t  __attribute__((export_name("TS_QueryChannelRange_clone"))) TS_QueryChannelRange_clone(uint64_t orig) {
44369         LDKQueryChannelRange orig_conv;
44370         orig_conv.inner = untag_ptr(orig);
44371         orig_conv.is_owned = ptr_is_owned(orig);
44372         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
44373         orig_conv.is_owned = false;
44374         LDKQueryChannelRange ret_var = QueryChannelRange_clone(&orig_conv);
44375         uint64_t ret_ref = 0;
44376         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
44377         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
44378         return ret_ref;
44379 }
44380
44381 jboolean  __attribute__((export_name("TS_QueryChannelRange_eq"))) TS_QueryChannelRange_eq(uint64_t a, uint64_t b) {
44382         LDKQueryChannelRange a_conv;
44383         a_conv.inner = untag_ptr(a);
44384         a_conv.is_owned = ptr_is_owned(a);
44385         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
44386         a_conv.is_owned = false;
44387         LDKQueryChannelRange b_conv;
44388         b_conv.inner = untag_ptr(b);
44389         b_conv.is_owned = ptr_is_owned(b);
44390         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
44391         b_conv.is_owned = false;
44392         jboolean ret_conv = QueryChannelRange_eq(&a_conv, &b_conv);
44393         return ret_conv;
44394 }
44395
44396 void  __attribute__((export_name("TS_ReplyChannelRange_free"))) TS_ReplyChannelRange_free(uint64_t this_obj) {
44397         LDKReplyChannelRange this_obj_conv;
44398         this_obj_conv.inner = untag_ptr(this_obj);
44399         this_obj_conv.is_owned = ptr_is_owned(this_obj);
44400         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
44401         ReplyChannelRange_free(this_obj_conv);
44402 }
44403
44404 int8_tArray  __attribute__((export_name("TS_ReplyChannelRange_get_chain_hash"))) TS_ReplyChannelRange_get_chain_hash(uint64_t this_ptr) {
44405         LDKReplyChannelRange this_ptr_conv;
44406         this_ptr_conv.inner = untag_ptr(this_ptr);
44407         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
44408         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
44409         this_ptr_conv.is_owned = false;
44410         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
44411         memcpy(ret_arr->elems, *ReplyChannelRange_get_chain_hash(&this_ptr_conv), 32);
44412         return ret_arr;
44413 }
44414
44415 void  __attribute__((export_name("TS_ReplyChannelRange_set_chain_hash"))) TS_ReplyChannelRange_set_chain_hash(uint64_t this_ptr, int8_tArray val) {
44416         LDKReplyChannelRange this_ptr_conv;
44417         this_ptr_conv.inner = untag_ptr(this_ptr);
44418         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
44419         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
44420         this_ptr_conv.is_owned = false;
44421         LDKThirtyTwoBytes val_ref;
44422         CHECK(val->arr_len == 32);
44423         memcpy(val_ref.data, val->elems, 32); FREE(val);
44424         ReplyChannelRange_set_chain_hash(&this_ptr_conv, val_ref);
44425 }
44426
44427 int32_t  __attribute__((export_name("TS_ReplyChannelRange_get_first_blocknum"))) TS_ReplyChannelRange_get_first_blocknum(uint64_t this_ptr) {
44428         LDKReplyChannelRange this_ptr_conv;
44429         this_ptr_conv.inner = untag_ptr(this_ptr);
44430         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
44431         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
44432         this_ptr_conv.is_owned = false;
44433         int32_t ret_conv = ReplyChannelRange_get_first_blocknum(&this_ptr_conv);
44434         return ret_conv;
44435 }
44436
44437 void  __attribute__((export_name("TS_ReplyChannelRange_set_first_blocknum"))) TS_ReplyChannelRange_set_first_blocknum(uint64_t this_ptr, int32_t val) {
44438         LDKReplyChannelRange this_ptr_conv;
44439         this_ptr_conv.inner = untag_ptr(this_ptr);
44440         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
44441         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
44442         this_ptr_conv.is_owned = false;
44443         ReplyChannelRange_set_first_blocknum(&this_ptr_conv, val);
44444 }
44445
44446 int32_t  __attribute__((export_name("TS_ReplyChannelRange_get_number_of_blocks"))) TS_ReplyChannelRange_get_number_of_blocks(uint64_t this_ptr) {
44447         LDKReplyChannelRange this_ptr_conv;
44448         this_ptr_conv.inner = untag_ptr(this_ptr);
44449         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
44450         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
44451         this_ptr_conv.is_owned = false;
44452         int32_t ret_conv = ReplyChannelRange_get_number_of_blocks(&this_ptr_conv);
44453         return ret_conv;
44454 }
44455
44456 void  __attribute__((export_name("TS_ReplyChannelRange_set_number_of_blocks"))) TS_ReplyChannelRange_set_number_of_blocks(uint64_t this_ptr, int32_t val) {
44457         LDKReplyChannelRange this_ptr_conv;
44458         this_ptr_conv.inner = untag_ptr(this_ptr);
44459         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
44460         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
44461         this_ptr_conv.is_owned = false;
44462         ReplyChannelRange_set_number_of_blocks(&this_ptr_conv, val);
44463 }
44464
44465 jboolean  __attribute__((export_name("TS_ReplyChannelRange_get_sync_complete"))) TS_ReplyChannelRange_get_sync_complete(uint64_t this_ptr) {
44466         LDKReplyChannelRange this_ptr_conv;
44467         this_ptr_conv.inner = untag_ptr(this_ptr);
44468         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
44469         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
44470         this_ptr_conv.is_owned = false;
44471         jboolean ret_conv = ReplyChannelRange_get_sync_complete(&this_ptr_conv);
44472         return ret_conv;
44473 }
44474
44475 void  __attribute__((export_name("TS_ReplyChannelRange_set_sync_complete"))) TS_ReplyChannelRange_set_sync_complete(uint64_t this_ptr, jboolean val) {
44476         LDKReplyChannelRange this_ptr_conv;
44477         this_ptr_conv.inner = untag_ptr(this_ptr);
44478         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
44479         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
44480         this_ptr_conv.is_owned = false;
44481         ReplyChannelRange_set_sync_complete(&this_ptr_conv, val);
44482 }
44483
44484 int64_tArray  __attribute__((export_name("TS_ReplyChannelRange_get_short_channel_ids"))) TS_ReplyChannelRange_get_short_channel_ids(uint64_t this_ptr) {
44485         LDKReplyChannelRange this_ptr_conv;
44486         this_ptr_conv.inner = untag_ptr(this_ptr);
44487         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
44488         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
44489         this_ptr_conv.is_owned = false;
44490         LDKCVec_u64Z ret_var = ReplyChannelRange_get_short_channel_ids(&this_ptr_conv);
44491         int64_tArray ret_arr = NULL;
44492         ret_arr = init_int64_tArray(ret_var.datalen, __LINE__);
44493         int64_t *ret_arr_ptr = (int64_t*)(((uint8_t*)ret_arr) + 8);
44494         for (size_t i = 0; i < ret_var.datalen; i++) {
44495                 int64_t ret_conv_8_conv = ret_var.data[i];
44496                 ret_arr_ptr[i] = ret_conv_8_conv;
44497         }
44498         
44499         FREE(ret_var.data);
44500         return ret_arr;
44501 }
44502
44503 void  __attribute__((export_name("TS_ReplyChannelRange_set_short_channel_ids"))) TS_ReplyChannelRange_set_short_channel_ids(uint64_t this_ptr, int64_tArray val) {
44504         LDKReplyChannelRange this_ptr_conv;
44505         this_ptr_conv.inner = untag_ptr(this_ptr);
44506         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
44507         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
44508         this_ptr_conv.is_owned = false;
44509         LDKCVec_u64Z val_constr;
44510         val_constr.datalen = val->arr_len;
44511         if (val_constr.datalen > 0)
44512                 val_constr.data = MALLOC(val_constr.datalen * sizeof(int64_t), "LDKCVec_u64Z Elements");
44513         else
44514                 val_constr.data = NULL;
44515         int64_t* val_vals = val->elems;
44516         for (size_t i = 0; i < val_constr.datalen; i++) {
44517                 int64_t val_conv_8 = val_vals[i];
44518                 val_constr.data[i] = val_conv_8;
44519         }
44520         FREE(val);
44521         ReplyChannelRange_set_short_channel_ids(&this_ptr_conv, val_constr);
44522 }
44523
44524 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) {
44525         LDKThirtyTwoBytes chain_hash_arg_ref;
44526         CHECK(chain_hash_arg->arr_len == 32);
44527         memcpy(chain_hash_arg_ref.data, chain_hash_arg->elems, 32); FREE(chain_hash_arg);
44528         LDKCVec_u64Z short_channel_ids_arg_constr;
44529         short_channel_ids_arg_constr.datalen = short_channel_ids_arg->arr_len;
44530         if (short_channel_ids_arg_constr.datalen > 0)
44531                 short_channel_ids_arg_constr.data = MALLOC(short_channel_ids_arg_constr.datalen * sizeof(int64_t), "LDKCVec_u64Z Elements");
44532         else
44533                 short_channel_ids_arg_constr.data = NULL;
44534         int64_t* short_channel_ids_arg_vals = short_channel_ids_arg->elems;
44535         for (size_t i = 0; i < short_channel_ids_arg_constr.datalen; i++) {
44536                 int64_t short_channel_ids_arg_conv_8 = short_channel_ids_arg_vals[i];
44537                 short_channel_ids_arg_constr.data[i] = short_channel_ids_arg_conv_8;
44538         }
44539         FREE(short_channel_ids_arg);
44540         LDKReplyChannelRange ret_var = ReplyChannelRange_new(chain_hash_arg_ref, first_blocknum_arg, number_of_blocks_arg, sync_complete_arg, short_channel_ids_arg_constr);
44541         uint64_t ret_ref = 0;
44542         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
44543         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
44544         return ret_ref;
44545 }
44546
44547 static inline uint64_t ReplyChannelRange_clone_ptr(LDKReplyChannelRange *NONNULL_PTR arg) {
44548         LDKReplyChannelRange ret_var = ReplyChannelRange_clone(arg);
44549         uint64_t ret_ref = 0;
44550         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
44551         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
44552         return ret_ref;
44553 }
44554 int64_t  __attribute__((export_name("TS_ReplyChannelRange_clone_ptr"))) TS_ReplyChannelRange_clone_ptr(uint64_t arg) {
44555         LDKReplyChannelRange arg_conv;
44556         arg_conv.inner = untag_ptr(arg);
44557         arg_conv.is_owned = ptr_is_owned(arg);
44558         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
44559         arg_conv.is_owned = false;
44560         int64_t ret_conv = ReplyChannelRange_clone_ptr(&arg_conv);
44561         return ret_conv;
44562 }
44563
44564 uint64_t  __attribute__((export_name("TS_ReplyChannelRange_clone"))) TS_ReplyChannelRange_clone(uint64_t orig) {
44565         LDKReplyChannelRange orig_conv;
44566         orig_conv.inner = untag_ptr(orig);
44567         orig_conv.is_owned = ptr_is_owned(orig);
44568         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
44569         orig_conv.is_owned = false;
44570         LDKReplyChannelRange ret_var = ReplyChannelRange_clone(&orig_conv);
44571         uint64_t ret_ref = 0;
44572         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
44573         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
44574         return ret_ref;
44575 }
44576
44577 jboolean  __attribute__((export_name("TS_ReplyChannelRange_eq"))) TS_ReplyChannelRange_eq(uint64_t a, uint64_t b) {
44578         LDKReplyChannelRange a_conv;
44579         a_conv.inner = untag_ptr(a);
44580         a_conv.is_owned = ptr_is_owned(a);
44581         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
44582         a_conv.is_owned = false;
44583         LDKReplyChannelRange b_conv;
44584         b_conv.inner = untag_ptr(b);
44585         b_conv.is_owned = ptr_is_owned(b);
44586         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
44587         b_conv.is_owned = false;
44588         jboolean ret_conv = ReplyChannelRange_eq(&a_conv, &b_conv);
44589         return ret_conv;
44590 }
44591
44592 void  __attribute__((export_name("TS_QueryShortChannelIds_free"))) TS_QueryShortChannelIds_free(uint64_t this_obj) {
44593         LDKQueryShortChannelIds this_obj_conv;
44594         this_obj_conv.inner = untag_ptr(this_obj);
44595         this_obj_conv.is_owned = ptr_is_owned(this_obj);
44596         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
44597         QueryShortChannelIds_free(this_obj_conv);
44598 }
44599
44600 int8_tArray  __attribute__((export_name("TS_QueryShortChannelIds_get_chain_hash"))) TS_QueryShortChannelIds_get_chain_hash(uint64_t this_ptr) {
44601         LDKQueryShortChannelIds this_ptr_conv;
44602         this_ptr_conv.inner = untag_ptr(this_ptr);
44603         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
44604         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
44605         this_ptr_conv.is_owned = false;
44606         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
44607         memcpy(ret_arr->elems, *QueryShortChannelIds_get_chain_hash(&this_ptr_conv), 32);
44608         return ret_arr;
44609 }
44610
44611 void  __attribute__((export_name("TS_QueryShortChannelIds_set_chain_hash"))) TS_QueryShortChannelIds_set_chain_hash(uint64_t this_ptr, int8_tArray val) {
44612         LDKQueryShortChannelIds this_ptr_conv;
44613         this_ptr_conv.inner = untag_ptr(this_ptr);
44614         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
44615         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
44616         this_ptr_conv.is_owned = false;
44617         LDKThirtyTwoBytes val_ref;
44618         CHECK(val->arr_len == 32);
44619         memcpy(val_ref.data, val->elems, 32); FREE(val);
44620         QueryShortChannelIds_set_chain_hash(&this_ptr_conv, val_ref);
44621 }
44622
44623 int64_tArray  __attribute__((export_name("TS_QueryShortChannelIds_get_short_channel_ids"))) TS_QueryShortChannelIds_get_short_channel_ids(uint64_t this_ptr) {
44624         LDKQueryShortChannelIds this_ptr_conv;
44625         this_ptr_conv.inner = untag_ptr(this_ptr);
44626         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
44627         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
44628         this_ptr_conv.is_owned = false;
44629         LDKCVec_u64Z ret_var = QueryShortChannelIds_get_short_channel_ids(&this_ptr_conv);
44630         int64_tArray ret_arr = NULL;
44631         ret_arr = init_int64_tArray(ret_var.datalen, __LINE__);
44632         int64_t *ret_arr_ptr = (int64_t*)(((uint8_t*)ret_arr) + 8);
44633         for (size_t i = 0; i < ret_var.datalen; i++) {
44634                 int64_t ret_conv_8_conv = ret_var.data[i];
44635                 ret_arr_ptr[i] = ret_conv_8_conv;
44636         }
44637         
44638         FREE(ret_var.data);
44639         return ret_arr;
44640 }
44641
44642 void  __attribute__((export_name("TS_QueryShortChannelIds_set_short_channel_ids"))) TS_QueryShortChannelIds_set_short_channel_ids(uint64_t this_ptr, int64_tArray val) {
44643         LDKQueryShortChannelIds this_ptr_conv;
44644         this_ptr_conv.inner = untag_ptr(this_ptr);
44645         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
44646         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
44647         this_ptr_conv.is_owned = false;
44648         LDKCVec_u64Z val_constr;
44649         val_constr.datalen = val->arr_len;
44650         if (val_constr.datalen > 0)
44651                 val_constr.data = MALLOC(val_constr.datalen * sizeof(int64_t), "LDKCVec_u64Z Elements");
44652         else
44653                 val_constr.data = NULL;
44654         int64_t* val_vals = val->elems;
44655         for (size_t i = 0; i < val_constr.datalen; i++) {
44656                 int64_t val_conv_8 = val_vals[i];
44657                 val_constr.data[i] = val_conv_8;
44658         }
44659         FREE(val);
44660         QueryShortChannelIds_set_short_channel_ids(&this_ptr_conv, val_constr);
44661 }
44662
44663 uint64_t  __attribute__((export_name("TS_QueryShortChannelIds_new"))) TS_QueryShortChannelIds_new(int8_tArray chain_hash_arg, int64_tArray short_channel_ids_arg) {
44664         LDKThirtyTwoBytes chain_hash_arg_ref;
44665         CHECK(chain_hash_arg->arr_len == 32);
44666         memcpy(chain_hash_arg_ref.data, chain_hash_arg->elems, 32); FREE(chain_hash_arg);
44667         LDKCVec_u64Z short_channel_ids_arg_constr;
44668         short_channel_ids_arg_constr.datalen = short_channel_ids_arg->arr_len;
44669         if (short_channel_ids_arg_constr.datalen > 0)
44670                 short_channel_ids_arg_constr.data = MALLOC(short_channel_ids_arg_constr.datalen * sizeof(int64_t), "LDKCVec_u64Z Elements");
44671         else
44672                 short_channel_ids_arg_constr.data = NULL;
44673         int64_t* short_channel_ids_arg_vals = short_channel_ids_arg->elems;
44674         for (size_t i = 0; i < short_channel_ids_arg_constr.datalen; i++) {
44675                 int64_t short_channel_ids_arg_conv_8 = short_channel_ids_arg_vals[i];
44676                 short_channel_ids_arg_constr.data[i] = short_channel_ids_arg_conv_8;
44677         }
44678         FREE(short_channel_ids_arg);
44679         LDKQueryShortChannelIds ret_var = QueryShortChannelIds_new(chain_hash_arg_ref, short_channel_ids_arg_constr);
44680         uint64_t ret_ref = 0;
44681         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
44682         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
44683         return ret_ref;
44684 }
44685
44686 static inline uint64_t QueryShortChannelIds_clone_ptr(LDKQueryShortChannelIds *NONNULL_PTR arg) {
44687         LDKQueryShortChannelIds ret_var = QueryShortChannelIds_clone(arg);
44688         uint64_t ret_ref = 0;
44689         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
44690         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
44691         return ret_ref;
44692 }
44693 int64_t  __attribute__((export_name("TS_QueryShortChannelIds_clone_ptr"))) TS_QueryShortChannelIds_clone_ptr(uint64_t arg) {
44694         LDKQueryShortChannelIds arg_conv;
44695         arg_conv.inner = untag_ptr(arg);
44696         arg_conv.is_owned = ptr_is_owned(arg);
44697         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
44698         arg_conv.is_owned = false;
44699         int64_t ret_conv = QueryShortChannelIds_clone_ptr(&arg_conv);
44700         return ret_conv;
44701 }
44702
44703 uint64_t  __attribute__((export_name("TS_QueryShortChannelIds_clone"))) TS_QueryShortChannelIds_clone(uint64_t orig) {
44704         LDKQueryShortChannelIds orig_conv;
44705         orig_conv.inner = untag_ptr(orig);
44706         orig_conv.is_owned = ptr_is_owned(orig);
44707         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
44708         orig_conv.is_owned = false;
44709         LDKQueryShortChannelIds ret_var = QueryShortChannelIds_clone(&orig_conv);
44710         uint64_t ret_ref = 0;
44711         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
44712         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
44713         return ret_ref;
44714 }
44715
44716 jboolean  __attribute__((export_name("TS_QueryShortChannelIds_eq"))) TS_QueryShortChannelIds_eq(uint64_t a, uint64_t b) {
44717         LDKQueryShortChannelIds a_conv;
44718         a_conv.inner = untag_ptr(a);
44719         a_conv.is_owned = ptr_is_owned(a);
44720         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
44721         a_conv.is_owned = false;
44722         LDKQueryShortChannelIds b_conv;
44723         b_conv.inner = untag_ptr(b);
44724         b_conv.is_owned = ptr_is_owned(b);
44725         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
44726         b_conv.is_owned = false;
44727         jboolean ret_conv = QueryShortChannelIds_eq(&a_conv, &b_conv);
44728         return ret_conv;
44729 }
44730
44731 void  __attribute__((export_name("TS_ReplyShortChannelIdsEnd_free"))) TS_ReplyShortChannelIdsEnd_free(uint64_t this_obj) {
44732         LDKReplyShortChannelIdsEnd this_obj_conv;
44733         this_obj_conv.inner = untag_ptr(this_obj);
44734         this_obj_conv.is_owned = ptr_is_owned(this_obj);
44735         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
44736         ReplyShortChannelIdsEnd_free(this_obj_conv);
44737 }
44738
44739 int8_tArray  __attribute__((export_name("TS_ReplyShortChannelIdsEnd_get_chain_hash"))) TS_ReplyShortChannelIdsEnd_get_chain_hash(uint64_t this_ptr) {
44740         LDKReplyShortChannelIdsEnd this_ptr_conv;
44741         this_ptr_conv.inner = untag_ptr(this_ptr);
44742         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
44743         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
44744         this_ptr_conv.is_owned = false;
44745         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
44746         memcpy(ret_arr->elems, *ReplyShortChannelIdsEnd_get_chain_hash(&this_ptr_conv), 32);
44747         return ret_arr;
44748 }
44749
44750 void  __attribute__((export_name("TS_ReplyShortChannelIdsEnd_set_chain_hash"))) TS_ReplyShortChannelIdsEnd_set_chain_hash(uint64_t this_ptr, int8_tArray val) {
44751         LDKReplyShortChannelIdsEnd this_ptr_conv;
44752         this_ptr_conv.inner = untag_ptr(this_ptr);
44753         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
44754         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
44755         this_ptr_conv.is_owned = false;
44756         LDKThirtyTwoBytes val_ref;
44757         CHECK(val->arr_len == 32);
44758         memcpy(val_ref.data, val->elems, 32); FREE(val);
44759         ReplyShortChannelIdsEnd_set_chain_hash(&this_ptr_conv, val_ref);
44760 }
44761
44762 jboolean  __attribute__((export_name("TS_ReplyShortChannelIdsEnd_get_full_information"))) TS_ReplyShortChannelIdsEnd_get_full_information(uint64_t this_ptr) {
44763         LDKReplyShortChannelIdsEnd this_ptr_conv;
44764         this_ptr_conv.inner = untag_ptr(this_ptr);
44765         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
44766         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
44767         this_ptr_conv.is_owned = false;
44768         jboolean ret_conv = ReplyShortChannelIdsEnd_get_full_information(&this_ptr_conv);
44769         return ret_conv;
44770 }
44771
44772 void  __attribute__((export_name("TS_ReplyShortChannelIdsEnd_set_full_information"))) TS_ReplyShortChannelIdsEnd_set_full_information(uint64_t this_ptr, jboolean val) {
44773         LDKReplyShortChannelIdsEnd this_ptr_conv;
44774         this_ptr_conv.inner = untag_ptr(this_ptr);
44775         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
44776         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
44777         this_ptr_conv.is_owned = false;
44778         ReplyShortChannelIdsEnd_set_full_information(&this_ptr_conv, val);
44779 }
44780
44781 uint64_t  __attribute__((export_name("TS_ReplyShortChannelIdsEnd_new"))) TS_ReplyShortChannelIdsEnd_new(int8_tArray chain_hash_arg, jboolean full_information_arg) {
44782         LDKThirtyTwoBytes chain_hash_arg_ref;
44783         CHECK(chain_hash_arg->arr_len == 32);
44784         memcpy(chain_hash_arg_ref.data, chain_hash_arg->elems, 32); FREE(chain_hash_arg);
44785         LDKReplyShortChannelIdsEnd ret_var = ReplyShortChannelIdsEnd_new(chain_hash_arg_ref, full_information_arg);
44786         uint64_t ret_ref = 0;
44787         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
44788         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
44789         return ret_ref;
44790 }
44791
44792 static inline uint64_t ReplyShortChannelIdsEnd_clone_ptr(LDKReplyShortChannelIdsEnd *NONNULL_PTR arg) {
44793         LDKReplyShortChannelIdsEnd ret_var = ReplyShortChannelIdsEnd_clone(arg);
44794         uint64_t ret_ref = 0;
44795         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
44796         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
44797         return ret_ref;
44798 }
44799 int64_t  __attribute__((export_name("TS_ReplyShortChannelIdsEnd_clone_ptr"))) TS_ReplyShortChannelIdsEnd_clone_ptr(uint64_t arg) {
44800         LDKReplyShortChannelIdsEnd arg_conv;
44801         arg_conv.inner = untag_ptr(arg);
44802         arg_conv.is_owned = ptr_is_owned(arg);
44803         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
44804         arg_conv.is_owned = false;
44805         int64_t ret_conv = ReplyShortChannelIdsEnd_clone_ptr(&arg_conv);
44806         return ret_conv;
44807 }
44808
44809 uint64_t  __attribute__((export_name("TS_ReplyShortChannelIdsEnd_clone"))) TS_ReplyShortChannelIdsEnd_clone(uint64_t orig) {
44810         LDKReplyShortChannelIdsEnd orig_conv;
44811         orig_conv.inner = untag_ptr(orig);
44812         orig_conv.is_owned = ptr_is_owned(orig);
44813         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
44814         orig_conv.is_owned = false;
44815         LDKReplyShortChannelIdsEnd ret_var = ReplyShortChannelIdsEnd_clone(&orig_conv);
44816         uint64_t ret_ref = 0;
44817         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
44818         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
44819         return ret_ref;
44820 }
44821
44822 jboolean  __attribute__((export_name("TS_ReplyShortChannelIdsEnd_eq"))) TS_ReplyShortChannelIdsEnd_eq(uint64_t a, uint64_t b) {
44823         LDKReplyShortChannelIdsEnd a_conv;
44824         a_conv.inner = untag_ptr(a);
44825         a_conv.is_owned = ptr_is_owned(a);
44826         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
44827         a_conv.is_owned = false;
44828         LDKReplyShortChannelIdsEnd b_conv;
44829         b_conv.inner = untag_ptr(b);
44830         b_conv.is_owned = ptr_is_owned(b);
44831         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
44832         b_conv.is_owned = false;
44833         jboolean ret_conv = ReplyShortChannelIdsEnd_eq(&a_conv, &b_conv);
44834         return ret_conv;
44835 }
44836
44837 void  __attribute__((export_name("TS_GossipTimestampFilter_free"))) TS_GossipTimestampFilter_free(uint64_t this_obj) {
44838         LDKGossipTimestampFilter this_obj_conv;
44839         this_obj_conv.inner = untag_ptr(this_obj);
44840         this_obj_conv.is_owned = ptr_is_owned(this_obj);
44841         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
44842         GossipTimestampFilter_free(this_obj_conv);
44843 }
44844
44845 int8_tArray  __attribute__((export_name("TS_GossipTimestampFilter_get_chain_hash"))) TS_GossipTimestampFilter_get_chain_hash(uint64_t this_ptr) {
44846         LDKGossipTimestampFilter this_ptr_conv;
44847         this_ptr_conv.inner = untag_ptr(this_ptr);
44848         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
44849         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
44850         this_ptr_conv.is_owned = false;
44851         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
44852         memcpy(ret_arr->elems, *GossipTimestampFilter_get_chain_hash(&this_ptr_conv), 32);
44853         return ret_arr;
44854 }
44855
44856 void  __attribute__((export_name("TS_GossipTimestampFilter_set_chain_hash"))) TS_GossipTimestampFilter_set_chain_hash(uint64_t this_ptr, int8_tArray val) {
44857         LDKGossipTimestampFilter this_ptr_conv;
44858         this_ptr_conv.inner = untag_ptr(this_ptr);
44859         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
44860         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
44861         this_ptr_conv.is_owned = false;
44862         LDKThirtyTwoBytes val_ref;
44863         CHECK(val->arr_len == 32);
44864         memcpy(val_ref.data, val->elems, 32); FREE(val);
44865         GossipTimestampFilter_set_chain_hash(&this_ptr_conv, val_ref);
44866 }
44867
44868 int32_t  __attribute__((export_name("TS_GossipTimestampFilter_get_first_timestamp"))) TS_GossipTimestampFilter_get_first_timestamp(uint64_t this_ptr) {
44869         LDKGossipTimestampFilter this_ptr_conv;
44870         this_ptr_conv.inner = untag_ptr(this_ptr);
44871         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
44872         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
44873         this_ptr_conv.is_owned = false;
44874         int32_t ret_conv = GossipTimestampFilter_get_first_timestamp(&this_ptr_conv);
44875         return ret_conv;
44876 }
44877
44878 void  __attribute__((export_name("TS_GossipTimestampFilter_set_first_timestamp"))) TS_GossipTimestampFilter_set_first_timestamp(uint64_t this_ptr, int32_t val) {
44879         LDKGossipTimestampFilter this_ptr_conv;
44880         this_ptr_conv.inner = untag_ptr(this_ptr);
44881         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
44882         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
44883         this_ptr_conv.is_owned = false;
44884         GossipTimestampFilter_set_first_timestamp(&this_ptr_conv, val);
44885 }
44886
44887 int32_t  __attribute__((export_name("TS_GossipTimestampFilter_get_timestamp_range"))) TS_GossipTimestampFilter_get_timestamp_range(uint64_t this_ptr) {
44888         LDKGossipTimestampFilter this_ptr_conv;
44889         this_ptr_conv.inner = untag_ptr(this_ptr);
44890         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
44891         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
44892         this_ptr_conv.is_owned = false;
44893         int32_t ret_conv = GossipTimestampFilter_get_timestamp_range(&this_ptr_conv);
44894         return ret_conv;
44895 }
44896
44897 void  __attribute__((export_name("TS_GossipTimestampFilter_set_timestamp_range"))) TS_GossipTimestampFilter_set_timestamp_range(uint64_t this_ptr, int32_t val) {
44898         LDKGossipTimestampFilter this_ptr_conv;
44899         this_ptr_conv.inner = untag_ptr(this_ptr);
44900         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
44901         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
44902         this_ptr_conv.is_owned = false;
44903         GossipTimestampFilter_set_timestamp_range(&this_ptr_conv, val);
44904 }
44905
44906 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) {
44907         LDKThirtyTwoBytes chain_hash_arg_ref;
44908         CHECK(chain_hash_arg->arr_len == 32);
44909         memcpy(chain_hash_arg_ref.data, chain_hash_arg->elems, 32); FREE(chain_hash_arg);
44910         LDKGossipTimestampFilter ret_var = GossipTimestampFilter_new(chain_hash_arg_ref, first_timestamp_arg, timestamp_range_arg);
44911         uint64_t ret_ref = 0;
44912         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
44913         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
44914         return ret_ref;
44915 }
44916
44917 static inline uint64_t GossipTimestampFilter_clone_ptr(LDKGossipTimestampFilter *NONNULL_PTR arg) {
44918         LDKGossipTimestampFilter ret_var = GossipTimestampFilter_clone(arg);
44919         uint64_t ret_ref = 0;
44920         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
44921         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
44922         return ret_ref;
44923 }
44924 int64_t  __attribute__((export_name("TS_GossipTimestampFilter_clone_ptr"))) TS_GossipTimestampFilter_clone_ptr(uint64_t arg) {
44925         LDKGossipTimestampFilter arg_conv;
44926         arg_conv.inner = untag_ptr(arg);
44927         arg_conv.is_owned = ptr_is_owned(arg);
44928         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
44929         arg_conv.is_owned = false;
44930         int64_t ret_conv = GossipTimestampFilter_clone_ptr(&arg_conv);
44931         return ret_conv;
44932 }
44933
44934 uint64_t  __attribute__((export_name("TS_GossipTimestampFilter_clone"))) TS_GossipTimestampFilter_clone(uint64_t orig) {
44935         LDKGossipTimestampFilter orig_conv;
44936         orig_conv.inner = untag_ptr(orig);
44937         orig_conv.is_owned = ptr_is_owned(orig);
44938         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
44939         orig_conv.is_owned = false;
44940         LDKGossipTimestampFilter ret_var = GossipTimestampFilter_clone(&orig_conv);
44941         uint64_t ret_ref = 0;
44942         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
44943         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
44944         return ret_ref;
44945 }
44946
44947 jboolean  __attribute__((export_name("TS_GossipTimestampFilter_eq"))) TS_GossipTimestampFilter_eq(uint64_t a, uint64_t b) {
44948         LDKGossipTimestampFilter a_conv;
44949         a_conv.inner = untag_ptr(a);
44950         a_conv.is_owned = ptr_is_owned(a);
44951         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
44952         a_conv.is_owned = false;
44953         LDKGossipTimestampFilter b_conv;
44954         b_conv.inner = untag_ptr(b);
44955         b_conv.is_owned = ptr_is_owned(b);
44956         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
44957         b_conv.is_owned = false;
44958         jboolean ret_conv = GossipTimestampFilter_eq(&a_conv, &b_conv);
44959         return ret_conv;
44960 }
44961
44962 void  __attribute__((export_name("TS_ErrorAction_free"))) TS_ErrorAction_free(uint64_t this_ptr) {
44963         if (!ptr_is_owned(this_ptr)) return;
44964         void* this_ptr_ptr = untag_ptr(this_ptr);
44965         CHECK_ACCESS(this_ptr_ptr);
44966         LDKErrorAction this_ptr_conv = *(LDKErrorAction*)(this_ptr_ptr);
44967         FREE(untag_ptr(this_ptr));
44968         ErrorAction_free(this_ptr_conv);
44969 }
44970
44971 static inline uint64_t ErrorAction_clone_ptr(LDKErrorAction *NONNULL_PTR arg) {
44972         LDKErrorAction *ret_copy = MALLOC(sizeof(LDKErrorAction), "LDKErrorAction");
44973         *ret_copy = ErrorAction_clone(arg);
44974         uint64_t ret_ref = tag_ptr(ret_copy, true);
44975         return ret_ref;
44976 }
44977 int64_t  __attribute__((export_name("TS_ErrorAction_clone_ptr"))) TS_ErrorAction_clone_ptr(uint64_t arg) {
44978         LDKErrorAction* arg_conv = (LDKErrorAction*)untag_ptr(arg);
44979         int64_t ret_conv = ErrorAction_clone_ptr(arg_conv);
44980         return ret_conv;
44981 }
44982
44983 uint64_t  __attribute__((export_name("TS_ErrorAction_clone"))) TS_ErrorAction_clone(uint64_t orig) {
44984         LDKErrorAction* orig_conv = (LDKErrorAction*)untag_ptr(orig);
44985         LDKErrorAction *ret_copy = MALLOC(sizeof(LDKErrorAction), "LDKErrorAction");
44986         *ret_copy = ErrorAction_clone(orig_conv);
44987         uint64_t ret_ref = tag_ptr(ret_copy, true);
44988         return ret_ref;
44989 }
44990
44991 uint64_t  __attribute__((export_name("TS_ErrorAction_disconnect_peer"))) TS_ErrorAction_disconnect_peer(uint64_t msg) {
44992         LDKErrorMessage msg_conv;
44993         msg_conv.inner = untag_ptr(msg);
44994         msg_conv.is_owned = ptr_is_owned(msg);
44995         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
44996         msg_conv = ErrorMessage_clone(&msg_conv);
44997         LDKErrorAction *ret_copy = MALLOC(sizeof(LDKErrorAction), "LDKErrorAction");
44998         *ret_copy = ErrorAction_disconnect_peer(msg_conv);
44999         uint64_t ret_ref = tag_ptr(ret_copy, true);
45000         return ret_ref;
45001 }
45002
45003 uint64_t  __attribute__((export_name("TS_ErrorAction_disconnect_peer_with_warning"))) TS_ErrorAction_disconnect_peer_with_warning(uint64_t msg) {
45004         LDKWarningMessage msg_conv;
45005         msg_conv.inner = untag_ptr(msg);
45006         msg_conv.is_owned = ptr_is_owned(msg);
45007         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
45008         msg_conv = WarningMessage_clone(&msg_conv);
45009         LDKErrorAction *ret_copy = MALLOC(sizeof(LDKErrorAction), "LDKErrorAction");
45010         *ret_copy = ErrorAction_disconnect_peer_with_warning(msg_conv);
45011         uint64_t ret_ref = tag_ptr(ret_copy, true);
45012         return ret_ref;
45013 }
45014
45015 uint64_t  __attribute__((export_name("TS_ErrorAction_ignore_error"))) TS_ErrorAction_ignore_error() {
45016         LDKErrorAction *ret_copy = MALLOC(sizeof(LDKErrorAction), "LDKErrorAction");
45017         *ret_copy = ErrorAction_ignore_error();
45018         uint64_t ret_ref = tag_ptr(ret_copy, true);
45019         return ret_ref;
45020 }
45021
45022 uint64_t  __attribute__((export_name("TS_ErrorAction_ignore_and_log"))) TS_ErrorAction_ignore_and_log(uint32_t a) {
45023         LDKLevel a_conv = LDKLevel_from_js(a);
45024         LDKErrorAction *ret_copy = MALLOC(sizeof(LDKErrorAction), "LDKErrorAction");
45025         *ret_copy = ErrorAction_ignore_and_log(a_conv);
45026         uint64_t ret_ref = tag_ptr(ret_copy, true);
45027         return ret_ref;
45028 }
45029
45030 uint64_t  __attribute__((export_name("TS_ErrorAction_ignore_duplicate_gossip"))) TS_ErrorAction_ignore_duplicate_gossip() {
45031         LDKErrorAction *ret_copy = MALLOC(sizeof(LDKErrorAction), "LDKErrorAction");
45032         *ret_copy = ErrorAction_ignore_duplicate_gossip();
45033         uint64_t ret_ref = tag_ptr(ret_copy, true);
45034         return ret_ref;
45035 }
45036
45037 uint64_t  __attribute__((export_name("TS_ErrorAction_send_error_message"))) TS_ErrorAction_send_error_message(uint64_t msg) {
45038         LDKErrorMessage msg_conv;
45039         msg_conv.inner = untag_ptr(msg);
45040         msg_conv.is_owned = ptr_is_owned(msg);
45041         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
45042         msg_conv = ErrorMessage_clone(&msg_conv);
45043         LDKErrorAction *ret_copy = MALLOC(sizeof(LDKErrorAction), "LDKErrorAction");
45044         *ret_copy = ErrorAction_send_error_message(msg_conv);
45045         uint64_t ret_ref = tag_ptr(ret_copy, true);
45046         return ret_ref;
45047 }
45048
45049 uint64_t  __attribute__((export_name("TS_ErrorAction_send_warning_message"))) TS_ErrorAction_send_warning_message(uint64_t msg, uint32_t log_level) {
45050         LDKWarningMessage msg_conv;
45051         msg_conv.inner = untag_ptr(msg);
45052         msg_conv.is_owned = ptr_is_owned(msg);
45053         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
45054         msg_conv = WarningMessage_clone(&msg_conv);
45055         LDKLevel log_level_conv = LDKLevel_from_js(log_level);
45056         LDKErrorAction *ret_copy = MALLOC(sizeof(LDKErrorAction), "LDKErrorAction");
45057         *ret_copy = ErrorAction_send_warning_message(msg_conv, log_level_conv);
45058         uint64_t ret_ref = tag_ptr(ret_copy, true);
45059         return ret_ref;
45060 }
45061
45062 void  __attribute__((export_name("TS_LightningError_free"))) TS_LightningError_free(uint64_t this_obj) {
45063         LDKLightningError this_obj_conv;
45064         this_obj_conv.inner = untag_ptr(this_obj);
45065         this_obj_conv.is_owned = ptr_is_owned(this_obj);
45066         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
45067         LightningError_free(this_obj_conv);
45068 }
45069
45070 jstring  __attribute__((export_name("TS_LightningError_get_err"))) TS_LightningError_get_err(uint64_t this_ptr) {
45071         LDKLightningError this_ptr_conv;
45072         this_ptr_conv.inner = untag_ptr(this_ptr);
45073         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
45074         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
45075         this_ptr_conv.is_owned = false;
45076         LDKStr ret_str = LightningError_get_err(&this_ptr_conv);
45077         jstring ret_conv = str_ref_to_ts(ret_str.chars, ret_str.len);
45078         Str_free(ret_str);
45079         return ret_conv;
45080 }
45081
45082 void  __attribute__((export_name("TS_LightningError_set_err"))) TS_LightningError_set_err(uint64_t this_ptr, jstring val) {
45083         LDKLightningError this_ptr_conv;
45084         this_ptr_conv.inner = untag_ptr(this_ptr);
45085         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
45086         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
45087         this_ptr_conv.is_owned = false;
45088         LDKStr val_conv = str_ref_to_owned_c(val);
45089         LightningError_set_err(&this_ptr_conv, val_conv);
45090 }
45091
45092 uint64_t  __attribute__((export_name("TS_LightningError_get_action"))) TS_LightningError_get_action(uint64_t this_ptr) {
45093         LDKLightningError this_ptr_conv;
45094         this_ptr_conv.inner = untag_ptr(this_ptr);
45095         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
45096         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
45097         this_ptr_conv.is_owned = false;
45098         LDKErrorAction *ret_copy = MALLOC(sizeof(LDKErrorAction), "LDKErrorAction");
45099         *ret_copy = LightningError_get_action(&this_ptr_conv);
45100         uint64_t ret_ref = tag_ptr(ret_copy, true);
45101         return ret_ref;
45102 }
45103
45104 void  __attribute__((export_name("TS_LightningError_set_action"))) TS_LightningError_set_action(uint64_t this_ptr, uint64_t val) {
45105         LDKLightningError this_ptr_conv;
45106         this_ptr_conv.inner = untag_ptr(this_ptr);
45107         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
45108         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
45109         this_ptr_conv.is_owned = false;
45110         void* val_ptr = untag_ptr(val);
45111         CHECK_ACCESS(val_ptr);
45112         LDKErrorAction val_conv = *(LDKErrorAction*)(val_ptr);
45113         val_conv = ErrorAction_clone((LDKErrorAction*)untag_ptr(val));
45114         LightningError_set_action(&this_ptr_conv, val_conv);
45115 }
45116
45117 uint64_t  __attribute__((export_name("TS_LightningError_new"))) TS_LightningError_new(jstring err_arg, uint64_t action_arg) {
45118         LDKStr err_arg_conv = str_ref_to_owned_c(err_arg);
45119         void* action_arg_ptr = untag_ptr(action_arg);
45120         CHECK_ACCESS(action_arg_ptr);
45121         LDKErrorAction action_arg_conv = *(LDKErrorAction*)(action_arg_ptr);
45122         action_arg_conv = ErrorAction_clone((LDKErrorAction*)untag_ptr(action_arg));
45123         LDKLightningError ret_var = LightningError_new(err_arg_conv, action_arg_conv);
45124         uint64_t ret_ref = 0;
45125         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
45126         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
45127         return ret_ref;
45128 }
45129
45130 static inline uint64_t LightningError_clone_ptr(LDKLightningError *NONNULL_PTR arg) {
45131         LDKLightningError ret_var = LightningError_clone(arg);
45132         uint64_t ret_ref = 0;
45133         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
45134         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
45135         return ret_ref;
45136 }
45137 int64_t  __attribute__((export_name("TS_LightningError_clone_ptr"))) TS_LightningError_clone_ptr(uint64_t arg) {
45138         LDKLightningError arg_conv;
45139         arg_conv.inner = untag_ptr(arg);
45140         arg_conv.is_owned = ptr_is_owned(arg);
45141         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
45142         arg_conv.is_owned = false;
45143         int64_t ret_conv = LightningError_clone_ptr(&arg_conv);
45144         return ret_conv;
45145 }
45146
45147 uint64_t  __attribute__((export_name("TS_LightningError_clone"))) TS_LightningError_clone(uint64_t orig) {
45148         LDKLightningError orig_conv;
45149         orig_conv.inner = untag_ptr(orig);
45150         orig_conv.is_owned = ptr_is_owned(orig);
45151         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
45152         orig_conv.is_owned = false;
45153         LDKLightningError ret_var = LightningError_clone(&orig_conv);
45154         uint64_t ret_ref = 0;
45155         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
45156         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
45157         return ret_ref;
45158 }
45159
45160 void  __attribute__((export_name("TS_CommitmentUpdate_free"))) TS_CommitmentUpdate_free(uint64_t this_obj) {
45161         LDKCommitmentUpdate this_obj_conv;
45162         this_obj_conv.inner = untag_ptr(this_obj);
45163         this_obj_conv.is_owned = ptr_is_owned(this_obj);
45164         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
45165         CommitmentUpdate_free(this_obj_conv);
45166 }
45167
45168 uint64_tArray  __attribute__((export_name("TS_CommitmentUpdate_get_update_add_htlcs"))) TS_CommitmentUpdate_get_update_add_htlcs(uint64_t this_ptr) {
45169         LDKCommitmentUpdate this_ptr_conv;
45170         this_ptr_conv.inner = untag_ptr(this_ptr);
45171         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
45172         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
45173         this_ptr_conv.is_owned = false;
45174         LDKCVec_UpdateAddHTLCZ ret_var = CommitmentUpdate_get_update_add_htlcs(&this_ptr_conv);
45175         uint64_tArray ret_arr = NULL;
45176         ret_arr = init_uint64_tArray(ret_var.datalen, __LINE__);
45177         uint64_t *ret_arr_ptr = (uint64_t*)(((uint8_t*)ret_arr) + 8);
45178         for (size_t p = 0; p < ret_var.datalen; p++) {
45179                 LDKUpdateAddHTLC ret_conv_15_var = ret_var.data[p];
45180                 uint64_t ret_conv_15_ref = 0;
45181                 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_conv_15_var);
45182                 ret_conv_15_ref = tag_ptr(ret_conv_15_var.inner, ret_conv_15_var.is_owned);
45183                 ret_arr_ptr[p] = ret_conv_15_ref;
45184         }
45185         
45186         FREE(ret_var.data);
45187         return ret_arr;
45188 }
45189
45190 void  __attribute__((export_name("TS_CommitmentUpdate_set_update_add_htlcs"))) TS_CommitmentUpdate_set_update_add_htlcs(uint64_t this_ptr, uint64_tArray val) {
45191         LDKCommitmentUpdate this_ptr_conv;
45192         this_ptr_conv.inner = untag_ptr(this_ptr);
45193         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
45194         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
45195         this_ptr_conv.is_owned = false;
45196         LDKCVec_UpdateAddHTLCZ val_constr;
45197         val_constr.datalen = val->arr_len;
45198         if (val_constr.datalen > 0)
45199                 val_constr.data = MALLOC(val_constr.datalen * sizeof(LDKUpdateAddHTLC), "LDKCVec_UpdateAddHTLCZ Elements");
45200         else
45201                 val_constr.data = NULL;
45202         uint64_t* val_vals = val->elems;
45203         for (size_t p = 0; p < val_constr.datalen; p++) {
45204                 uint64_t val_conv_15 = val_vals[p];
45205                 LDKUpdateAddHTLC val_conv_15_conv;
45206                 val_conv_15_conv.inner = untag_ptr(val_conv_15);
45207                 val_conv_15_conv.is_owned = ptr_is_owned(val_conv_15);
45208                 CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv_15_conv);
45209                 val_conv_15_conv = UpdateAddHTLC_clone(&val_conv_15_conv);
45210                 val_constr.data[p] = val_conv_15_conv;
45211         }
45212         FREE(val);
45213         CommitmentUpdate_set_update_add_htlcs(&this_ptr_conv, val_constr);
45214 }
45215
45216 uint64_tArray  __attribute__((export_name("TS_CommitmentUpdate_get_update_fulfill_htlcs"))) TS_CommitmentUpdate_get_update_fulfill_htlcs(uint64_t this_ptr) {
45217         LDKCommitmentUpdate this_ptr_conv;
45218         this_ptr_conv.inner = untag_ptr(this_ptr);
45219         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
45220         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
45221         this_ptr_conv.is_owned = false;
45222         LDKCVec_UpdateFulfillHTLCZ ret_var = CommitmentUpdate_get_update_fulfill_htlcs(&this_ptr_conv);
45223         uint64_tArray ret_arr = NULL;
45224         ret_arr = init_uint64_tArray(ret_var.datalen, __LINE__);
45225         uint64_t *ret_arr_ptr = (uint64_t*)(((uint8_t*)ret_arr) + 8);
45226         for (size_t t = 0; t < ret_var.datalen; t++) {
45227                 LDKUpdateFulfillHTLC ret_conv_19_var = ret_var.data[t];
45228                 uint64_t ret_conv_19_ref = 0;
45229                 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_conv_19_var);
45230                 ret_conv_19_ref = tag_ptr(ret_conv_19_var.inner, ret_conv_19_var.is_owned);
45231                 ret_arr_ptr[t] = ret_conv_19_ref;
45232         }
45233         
45234         FREE(ret_var.data);
45235         return ret_arr;
45236 }
45237
45238 void  __attribute__((export_name("TS_CommitmentUpdate_set_update_fulfill_htlcs"))) TS_CommitmentUpdate_set_update_fulfill_htlcs(uint64_t this_ptr, uint64_tArray val) {
45239         LDKCommitmentUpdate this_ptr_conv;
45240         this_ptr_conv.inner = untag_ptr(this_ptr);
45241         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
45242         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
45243         this_ptr_conv.is_owned = false;
45244         LDKCVec_UpdateFulfillHTLCZ val_constr;
45245         val_constr.datalen = val->arr_len;
45246         if (val_constr.datalen > 0)
45247                 val_constr.data = MALLOC(val_constr.datalen * sizeof(LDKUpdateFulfillHTLC), "LDKCVec_UpdateFulfillHTLCZ Elements");
45248         else
45249                 val_constr.data = NULL;
45250         uint64_t* val_vals = val->elems;
45251         for (size_t t = 0; t < val_constr.datalen; t++) {
45252                 uint64_t val_conv_19 = val_vals[t];
45253                 LDKUpdateFulfillHTLC val_conv_19_conv;
45254                 val_conv_19_conv.inner = untag_ptr(val_conv_19);
45255                 val_conv_19_conv.is_owned = ptr_is_owned(val_conv_19);
45256                 CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv_19_conv);
45257                 val_conv_19_conv = UpdateFulfillHTLC_clone(&val_conv_19_conv);
45258                 val_constr.data[t] = val_conv_19_conv;
45259         }
45260         FREE(val);
45261         CommitmentUpdate_set_update_fulfill_htlcs(&this_ptr_conv, val_constr);
45262 }
45263
45264 uint64_tArray  __attribute__((export_name("TS_CommitmentUpdate_get_update_fail_htlcs"))) TS_CommitmentUpdate_get_update_fail_htlcs(uint64_t this_ptr) {
45265         LDKCommitmentUpdate this_ptr_conv;
45266         this_ptr_conv.inner = untag_ptr(this_ptr);
45267         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
45268         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
45269         this_ptr_conv.is_owned = false;
45270         LDKCVec_UpdateFailHTLCZ ret_var = CommitmentUpdate_get_update_fail_htlcs(&this_ptr_conv);
45271         uint64_tArray ret_arr = NULL;
45272         ret_arr = init_uint64_tArray(ret_var.datalen, __LINE__);
45273         uint64_t *ret_arr_ptr = (uint64_t*)(((uint8_t*)ret_arr) + 8);
45274         for (size_t q = 0; q < ret_var.datalen; q++) {
45275                 LDKUpdateFailHTLC ret_conv_16_var = ret_var.data[q];
45276                 uint64_t ret_conv_16_ref = 0;
45277                 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_conv_16_var);
45278                 ret_conv_16_ref = tag_ptr(ret_conv_16_var.inner, ret_conv_16_var.is_owned);
45279                 ret_arr_ptr[q] = ret_conv_16_ref;
45280         }
45281         
45282         FREE(ret_var.data);
45283         return ret_arr;
45284 }
45285
45286 void  __attribute__((export_name("TS_CommitmentUpdate_set_update_fail_htlcs"))) TS_CommitmentUpdate_set_update_fail_htlcs(uint64_t this_ptr, uint64_tArray val) {
45287         LDKCommitmentUpdate this_ptr_conv;
45288         this_ptr_conv.inner = untag_ptr(this_ptr);
45289         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
45290         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
45291         this_ptr_conv.is_owned = false;
45292         LDKCVec_UpdateFailHTLCZ val_constr;
45293         val_constr.datalen = val->arr_len;
45294         if (val_constr.datalen > 0)
45295                 val_constr.data = MALLOC(val_constr.datalen * sizeof(LDKUpdateFailHTLC), "LDKCVec_UpdateFailHTLCZ Elements");
45296         else
45297                 val_constr.data = NULL;
45298         uint64_t* val_vals = val->elems;
45299         for (size_t q = 0; q < val_constr.datalen; q++) {
45300                 uint64_t val_conv_16 = val_vals[q];
45301                 LDKUpdateFailHTLC val_conv_16_conv;
45302                 val_conv_16_conv.inner = untag_ptr(val_conv_16);
45303                 val_conv_16_conv.is_owned = ptr_is_owned(val_conv_16);
45304                 CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv_16_conv);
45305                 val_conv_16_conv = UpdateFailHTLC_clone(&val_conv_16_conv);
45306                 val_constr.data[q] = val_conv_16_conv;
45307         }
45308         FREE(val);
45309         CommitmentUpdate_set_update_fail_htlcs(&this_ptr_conv, val_constr);
45310 }
45311
45312 uint64_tArray  __attribute__((export_name("TS_CommitmentUpdate_get_update_fail_malformed_htlcs"))) TS_CommitmentUpdate_get_update_fail_malformed_htlcs(uint64_t this_ptr) {
45313         LDKCommitmentUpdate this_ptr_conv;
45314         this_ptr_conv.inner = untag_ptr(this_ptr);
45315         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
45316         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
45317         this_ptr_conv.is_owned = false;
45318         LDKCVec_UpdateFailMalformedHTLCZ ret_var = CommitmentUpdate_get_update_fail_malformed_htlcs(&this_ptr_conv);
45319         uint64_tArray ret_arr = NULL;
45320         ret_arr = init_uint64_tArray(ret_var.datalen, __LINE__);
45321         uint64_t *ret_arr_ptr = (uint64_t*)(((uint8_t*)ret_arr) + 8);
45322         for (size_t z = 0; z < ret_var.datalen; z++) {
45323                 LDKUpdateFailMalformedHTLC ret_conv_25_var = ret_var.data[z];
45324                 uint64_t ret_conv_25_ref = 0;
45325                 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_conv_25_var);
45326                 ret_conv_25_ref = tag_ptr(ret_conv_25_var.inner, ret_conv_25_var.is_owned);
45327                 ret_arr_ptr[z] = ret_conv_25_ref;
45328         }
45329         
45330         FREE(ret_var.data);
45331         return ret_arr;
45332 }
45333
45334 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) {
45335         LDKCommitmentUpdate this_ptr_conv;
45336         this_ptr_conv.inner = untag_ptr(this_ptr);
45337         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
45338         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
45339         this_ptr_conv.is_owned = false;
45340         LDKCVec_UpdateFailMalformedHTLCZ val_constr;
45341         val_constr.datalen = val->arr_len;
45342         if (val_constr.datalen > 0)
45343                 val_constr.data = MALLOC(val_constr.datalen * sizeof(LDKUpdateFailMalformedHTLC), "LDKCVec_UpdateFailMalformedHTLCZ Elements");
45344         else
45345                 val_constr.data = NULL;
45346         uint64_t* val_vals = val->elems;
45347         for (size_t z = 0; z < val_constr.datalen; z++) {
45348                 uint64_t val_conv_25 = val_vals[z];
45349                 LDKUpdateFailMalformedHTLC val_conv_25_conv;
45350                 val_conv_25_conv.inner = untag_ptr(val_conv_25);
45351                 val_conv_25_conv.is_owned = ptr_is_owned(val_conv_25);
45352                 CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv_25_conv);
45353                 val_conv_25_conv = UpdateFailMalformedHTLC_clone(&val_conv_25_conv);
45354                 val_constr.data[z] = val_conv_25_conv;
45355         }
45356         FREE(val);
45357         CommitmentUpdate_set_update_fail_malformed_htlcs(&this_ptr_conv, val_constr);
45358 }
45359
45360 uint64_t  __attribute__((export_name("TS_CommitmentUpdate_get_update_fee"))) TS_CommitmentUpdate_get_update_fee(uint64_t this_ptr) {
45361         LDKCommitmentUpdate this_ptr_conv;
45362         this_ptr_conv.inner = untag_ptr(this_ptr);
45363         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
45364         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
45365         this_ptr_conv.is_owned = false;
45366         LDKUpdateFee ret_var = CommitmentUpdate_get_update_fee(&this_ptr_conv);
45367         uint64_t ret_ref = 0;
45368         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
45369         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
45370         return ret_ref;
45371 }
45372
45373 void  __attribute__((export_name("TS_CommitmentUpdate_set_update_fee"))) TS_CommitmentUpdate_set_update_fee(uint64_t this_ptr, uint64_t val) {
45374         LDKCommitmentUpdate this_ptr_conv;
45375         this_ptr_conv.inner = untag_ptr(this_ptr);
45376         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
45377         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
45378         this_ptr_conv.is_owned = false;
45379         LDKUpdateFee val_conv;
45380         val_conv.inner = untag_ptr(val);
45381         val_conv.is_owned = ptr_is_owned(val);
45382         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
45383         val_conv = UpdateFee_clone(&val_conv);
45384         CommitmentUpdate_set_update_fee(&this_ptr_conv, val_conv);
45385 }
45386
45387 uint64_t  __attribute__((export_name("TS_CommitmentUpdate_get_commitment_signed"))) TS_CommitmentUpdate_get_commitment_signed(uint64_t this_ptr) {
45388         LDKCommitmentUpdate this_ptr_conv;
45389         this_ptr_conv.inner = untag_ptr(this_ptr);
45390         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
45391         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
45392         this_ptr_conv.is_owned = false;
45393         LDKCommitmentSigned ret_var = CommitmentUpdate_get_commitment_signed(&this_ptr_conv);
45394         uint64_t ret_ref = 0;
45395         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
45396         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
45397         return ret_ref;
45398 }
45399
45400 void  __attribute__((export_name("TS_CommitmentUpdate_set_commitment_signed"))) TS_CommitmentUpdate_set_commitment_signed(uint64_t this_ptr, uint64_t val) {
45401         LDKCommitmentUpdate this_ptr_conv;
45402         this_ptr_conv.inner = untag_ptr(this_ptr);
45403         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
45404         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
45405         this_ptr_conv.is_owned = false;
45406         LDKCommitmentSigned val_conv;
45407         val_conv.inner = untag_ptr(val);
45408         val_conv.is_owned = ptr_is_owned(val);
45409         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
45410         val_conv = CommitmentSigned_clone(&val_conv);
45411         CommitmentUpdate_set_commitment_signed(&this_ptr_conv, val_conv);
45412 }
45413
45414 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) {
45415         LDKCVec_UpdateAddHTLCZ update_add_htlcs_arg_constr;
45416         update_add_htlcs_arg_constr.datalen = update_add_htlcs_arg->arr_len;
45417         if (update_add_htlcs_arg_constr.datalen > 0)
45418                 update_add_htlcs_arg_constr.data = MALLOC(update_add_htlcs_arg_constr.datalen * sizeof(LDKUpdateAddHTLC), "LDKCVec_UpdateAddHTLCZ Elements");
45419         else
45420                 update_add_htlcs_arg_constr.data = NULL;
45421         uint64_t* update_add_htlcs_arg_vals = update_add_htlcs_arg->elems;
45422         for (size_t p = 0; p < update_add_htlcs_arg_constr.datalen; p++) {
45423                 uint64_t update_add_htlcs_arg_conv_15 = update_add_htlcs_arg_vals[p];
45424                 LDKUpdateAddHTLC update_add_htlcs_arg_conv_15_conv;
45425                 update_add_htlcs_arg_conv_15_conv.inner = untag_ptr(update_add_htlcs_arg_conv_15);
45426                 update_add_htlcs_arg_conv_15_conv.is_owned = ptr_is_owned(update_add_htlcs_arg_conv_15);
45427                 CHECK_INNER_FIELD_ACCESS_OR_NULL(update_add_htlcs_arg_conv_15_conv);
45428                 update_add_htlcs_arg_conv_15_conv = UpdateAddHTLC_clone(&update_add_htlcs_arg_conv_15_conv);
45429                 update_add_htlcs_arg_constr.data[p] = update_add_htlcs_arg_conv_15_conv;
45430         }
45431         FREE(update_add_htlcs_arg);
45432         LDKCVec_UpdateFulfillHTLCZ update_fulfill_htlcs_arg_constr;
45433         update_fulfill_htlcs_arg_constr.datalen = update_fulfill_htlcs_arg->arr_len;
45434         if (update_fulfill_htlcs_arg_constr.datalen > 0)
45435                 update_fulfill_htlcs_arg_constr.data = MALLOC(update_fulfill_htlcs_arg_constr.datalen * sizeof(LDKUpdateFulfillHTLC), "LDKCVec_UpdateFulfillHTLCZ Elements");
45436         else
45437                 update_fulfill_htlcs_arg_constr.data = NULL;
45438         uint64_t* update_fulfill_htlcs_arg_vals = update_fulfill_htlcs_arg->elems;
45439         for (size_t t = 0; t < update_fulfill_htlcs_arg_constr.datalen; t++) {
45440                 uint64_t update_fulfill_htlcs_arg_conv_19 = update_fulfill_htlcs_arg_vals[t];
45441                 LDKUpdateFulfillHTLC update_fulfill_htlcs_arg_conv_19_conv;
45442                 update_fulfill_htlcs_arg_conv_19_conv.inner = untag_ptr(update_fulfill_htlcs_arg_conv_19);
45443                 update_fulfill_htlcs_arg_conv_19_conv.is_owned = ptr_is_owned(update_fulfill_htlcs_arg_conv_19);
45444                 CHECK_INNER_FIELD_ACCESS_OR_NULL(update_fulfill_htlcs_arg_conv_19_conv);
45445                 update_fulfill_htlcs_arg_conv_19_conv = UpdateFulfillHTLC_clone(&update_fulfill_htlcs_arg_conv_19_conv);
45446                 update_fulfill_htlcs_arg_constr.data[t] = update_fulfill_htlcs_arg_conv_19_conv;
45447         }
45448         FREE(update_fulfill_htlcs_arg);
45449         LDKCVec_UpdateFailHTLCZ update_fail_htlcs_arg_constr;
45450         update_fail_htlcs_arg_constr.datalen = update_fail_htlcs_arg->arr_len;
45451         if (update_fail_htlcs_arg_constr.datalen > 0)
45452                 update_fail_htlcs_arg_constr.data = MALLOC(update_fail_htlcs_arg_constr.datalen * sizeof(LDKUpdateFailHTLC), "LDKCVec_UpdateFailHTLCZ Elements");
45453         else
45454                 update_fail_htlcs_arg_constr.data = NULL;
45455         uint64_t* update_fail_htlcs_arg_vals = update_fail_htlcs_arg->elems;
45456         for (size_t q = 0; q < update_fail_htlcs_arg_constr.datalen; q++) {
45457                 uint64_t update_fail_htlcs_arg_conv_16 = update_fail_htlcs_arg_vals[q];
45458                 LDKUpdateFailHTLC update_fail_htlcs_arg_conv_16_conv;
45459                 update_fail_htlcs_arg_conv_16_conv.inner = untag_ptr(update_fail_htlcs_arg_conv_16);
45460                 update_fail_htlcs_arg_conv_16_conv.is_owned = ptr_is_owned(update_fail_htlcs_arg_conv_16);
45461                 CHECK_INNER_FIELD_ACCESS_OR_NULL(update_fail_htlcs_arg_conv_16_conv);
45462                 update_fail_htlcs_arg_conv_16_conv = UpdateFailHTLC_clone(&update_fail_htlcs_arg_conv_16_conv);
45463                 update_fail_htlcs_arg_constr.data[q] = update_fail_htlcs_arg_conv_16_conv;
45464         }
45465         FREE(update_fail_htlcs_arg);
45466         LDKCVec_UpdateFailMalformedHTLCZ update_fail_malformed_htlcs_arg_constr;
45467         update_fail_malformed_htlcs_arg_constr.datalen = update_fail_malformed_htlcs_arg->arr_len;
45468         if (update_fail_malformed_htlcs_arg_constr.datalen > 0)
45469                 update_fail_malformed_htlcs_arg_constr.data = MALLOC(update_fail_malformed_htlcs_arg_constr.datalen * sizeof(LDKUpdateFailMalformedHTLC), "LDKCVec_UpdateFailMalformedHTLCZ Elements");
45470         else
45471                 update_fail_malformed_htlcs_arg_constr.data = NULL;
45472         uint64_t* update_fail_malformed_htlcs_arg_vals = update_fail_malformed_htlcs_arg->elems;
45473         for (size_t z = 0; z < update_fail_malformed_htlcs_arg_constr.datalen; z++) {
45474                 uint64_t update_fail_malformed_htlcs_arg_conv_25 = update_fail_malformed_htlcs_arg_vals[z];
45475                 LDKUpdateFailMalformedHTLC update_fail_malformed_htlcs_arg_conv_25_conv;
45476                 update_fail_malformed_htlcs_arg_conv_25_conv.inner = untag_ptr(update_fail_malformed_htlcs_arg_conv_25);
45477                 update_fail_malformed_htlcs_arg_conv_25_conv.is_owned = ptr_is_owned(update_fail_malformed_htlcs_arg_conv_25);
45478                 CHECK_INNER_FIELD_ACCESS_OR_NULL(update_fail_malformed_htlcs_arg_conv_25_conv);
45479                 update_fail_malformed_htlcs_arg_conv_25_conv = UpdateFailMalformedHTLC_clone(&update_fail_malformed_htlcs_arg_conv_25_conv);
45480                 update_fail_malformed_htlcs_arg_constr.data[z] = update_fail_malformed_htlcs_arg_conv_25_conv;
45481         }
45482         FREE(update_fail_malformed_htlcs_arg);
45483         LDKUpdateFee update_fee_arg_conv;
45484         update_fee_arg_conv.inner = untag_ptr(update_fee_arg);
45485         update_fee_arg_conv.is_owned = ptr_is_owned(update_fee_arg);
45486         CHECK_INNER_FIELD_ACCESS_OR_NULL(update_fee_arg_conv);
45487         update_fee_arg_conv = UpdateFee_clone(&update_fee_arg_conv);
45488         LDKCommitmentSigned commitment_signed_arg_conv;
45489         commitment_signed_arg_conv.inner = untag_ptr(commitment_signed_arg);
45490         commitment_signed_arg_conv.is_owned = ptr_is_owned(commitment_signed_arg);
45491         CHECK_INNER_FIELD_ACCESS_OR_NULL(commitment_signed_arg_conv);
45492         commitment_signed_arg_conv = CommitmentSigned_clone(&commitment_signed_arg_conv);
45493         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);
45494         uint64_t ret_ref = 0;
45495         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
45496         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
45497         return ret_ref;
45498 }
45499
45500 static inline uint64_t CommitmentUpdate_clone_ptr(LDKCommitmentUpdate *NONNULL_PTR arg) {
45501         LDKCommitmentUpdate ret_var = CommitmentUpdate_clone(arg);
45502         uint64_t ret_ref = 0;
45503         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
45504         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
45505         return ret_ref;
45506 }
45507 int64_t  __attribute__((export_name("TS_CommitmentUpdate_clone_ptr"))) TS_CommitmentUpdate_clone_ptr(uint64_t arg) {
45508         LDKCommitmentUpdate arg_conv;
45509         arg_conv.inner = untag_ptr(arg);
45510         arg_conv.is_owned = ptr_is_owned(arg);
45511         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
45512         arg_conv.is_owned = false;
45513         int64_t ret_conv = CommitmentUpdate_clone_ptr(&arg_conv);
45514         return ret_conv;
45515 }
45516
45517 uint64_t  __attribute__((export_name("TS_CommitmentUpdate_clone"))) TS_CommitmentUpdate_clone(uint64_t orig) {
45518         LDKCommitmentUpdate orig_conv;
45519         orig_conv.inner = untag_ptr(orig);
45520         orig_conv.is_owned = ptr_is_owned(orig);
45521         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
45522         orig_conv.is_owned = false;
45523         LDKCommitmentUpdate ret_var = CommitmentUpdate_clone(&orig_conv);
45524         uint64_t ret_ref = 0;
45525         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
45526         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
45527         return ret_ref;
45528 }
45529
45530 jboolean  __attribute__((export_name("TS_CommitmentUpdate_eq"))) TS_CommitmentUpdate_eq(uint64_t a, uint64_t b) {
45531         LDKCommitmentUpdate a_conv;
45532         a_conv.inner = untag_ptr(a);
45533         a_conv.is_owned = ptr_is_owned(a);
45534         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
45535         a_conv.is_owned = false;
45536         LDKCommitmentUpdate b_conv;
45537         b_conv.inner = untag_ptr(b);
45538         b_conv.is_owned = ptr_is_owned(b);
45539         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
45540         b_conv.is_owned = false;
45541         jboolean ret_conv = CommitmentUpdate_eq(&a_conv, &b_conv);
45542         return ret_conv;
45543 }
45544
45545 void  __attribute__((export_name("TS_ChannelMessageHandler_free"))) TS_ChannelMessageHandler_free(uint64_t this_ptr) {
45546         if (!ptr_is_owned(this_ptr)) return;
45547         void* this_ptr_ptr = untag_ptr(this_ptr);
45548         CHECK_ACCESS(this_ptr_ptr);
45549         LDKChannelMessageHandler this_ptr_conv = *(LDKChannelMessageHandler*)(this_ptr_ptr);
45550         FREE(untag_ptr(this_ptr));
45551         ChannelMessageHandler_free(this_ptr_conv);
45552 }
45553
45554 void  __attribute__((export_name("TS_RoutingMessageHandler_free"))) TS_RoutingMessageHandler_free(uint64_t this_ptr) {
45555         if (!ptr_is_owned(this_ptr)) return;
45556         void* this_ptr_ptr = untag_ptr(this_ptr);
45557         CHECK_ACCESS(this_ptr_ptr);
45558         LDKRoutingMessageHandler this_ptr_conv = *(LDKRoutingMessageHandler*)(this_ptr_ptr);
45559         FREE(untag_ptr(this_ptr));
45560         RoutingMessageHandler_free(this_ptr_conv);
45561 }
45562
45563 void  __attribute__((export_name("TS_OnionMessageHandler_free"))) TS_OnionMessageHandler_free(uint64_t this_ptr) {
45564         if (!ptr_is_owned(this_ptr)) return;
45565         void* this_ptr_ptr = untag_ptr(this_ptr);
45566         CHECK_ACCESS(this_ptr_ptr);
45567         LDKOnionMessageHandler this_ptr_conv = *(LDKOnionMessageHandler*)(this_ptr_ptr);
45568         FREE(untag_ptr(this_ptr));
45569         OnionMessageHandler_free(this_ptr_conv);
45570 }
45571
45572 int8_tArray  __attribute__((export_name("TS_AcceptChannel_write"))) TS_AcceptChannel_write(uint64_t obj) {
45573         LDKAcceptChannel obj_conv;
45574         obj_conv.inner = untag_ptr(obj);
45575         obj_conv.is_owned = ptr_is_owned(obj);
45576         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
45577         obj_conv.is_owned = false;
45578         LDKCVec_u8Z ret_var = AcceptChannel_write(&obj_conv);
45579         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
45580         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
45581         CVec_u8Z_free(ret_var);
45582         return ret_arr;
45583 }
45584
45585 uint64_t  __attribute__((export_name("TS_AcceptChannel_read"))) TS_AcceptChannel_read(int8_tArray ser) {
45586         LDKu8slice ser_ref;
45587         ser_ref.datalen = ser->arr_len;
45588         ser_ref.data = ser->elems;
45589         LDKCResult_AcceptChannelDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_AcceptChannelDecodeErrorZ), "LDKCResult_AcceptChannelDecodeErrorZ");
45590         *ret_conv = AcceptChannel_read(ser_ref);
45591         FREE(ser);
45592         return tag_ptr(ret_conv, true);
45593 }
45594
45595 int8_tArray  __attribute__((export_name("TS_AcceptChannelV2_write"))) TS_AcceptChannelV2_write(uint64_t obj) {
45596         LDKAcceptChannelV2 obj_conv;
45597         obj_conv.inner = untag_ptr(obj);
45598         obj_conv.is_owned = ptr_is_owned(obj);
45599         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
45600         obj_conv.is_owned = false;
45601         LDKCVec_u8Z ret_var = AcceptChannelV2_write(&obj_conv);
45602         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
45603         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
45604         CVec_u8Z_free(ret_var);
45605         return ret_arr;
45606 }
45607
45608 uint64_t  __attribute__((export_name("TS_AcceptChannelV2_read"))) TS_AcceptChannelV2_read(int8_tArray ser) {
45609         LDKu8slice ser_ref;
45610         ser_ref.datalen = ser->arr_len;
45611         ser_ref.data = ser->elems;
45612         LDKCResult_AcceptChannelV2DecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_AcceptChannelV2DecodeErrorZ), "LDKCResult_AcceptChannelV2DecodeErrorZ");
45613         *ret_conv = AcceptChannelV2_read(ser_ref);
45614         FREE(ser);
45615         return tag_ptr(ret_conv, true);
45616 }
45617
45618 int8_tArray  __attribute__((export_name("TS_TxAddInput_write"))) TS_TxAddInput_write(uint64_t obj) {
45619         LDKTxAddInput obj_conv;
45620         obj_conv.inner = untag_ptr(obj);
45621         obj_conv.is_owned = ptr_is_owned(obj);
45622         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
45623         obj_conv.is_owned = false;
45624         LDKCVec_u8Z ret_var = TxAddInput_write(&obj_conv);
45625         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
45626         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
45627         CVec_u8Z_free(ret_var);
45628         return ret_arr;
45629 }
45630
45631 uint64_t  __attribute__((export_name("TS_TxAddInput_read"))) TS_TxAddInput_read(int8_tArray ser) {
45632         LDKu8slice ser_ref;
45633         ser_ref.datalen = ser->arr_len;
45634         ser_ref.data = ser->elems;
45635         LDKCResult_TxAddInputDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TxAddInputDecodeErrorZ), "LDKCResult_TxAddInputDecodeErrorZ");
45636         *ret_conv = TxAddInput_read(ser_ref);
45637         FREE(ser);
45638         return tag_ptr(ret_conv, true);
45639 }
45640
45641 int8_tArray  __attribute__((export_name("TS_TxAddOutput_write"))) TS_TxAddOutput_write(uint64_t obj) {
45642         LDKTxAddOutput obj_conv;
45643         obj_conv.inner = untag_ptr(obj);
45644         obj_conv.is_owned = ptr_is_owned(obj);
45645         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
45646         obj_conv.is_owned = false;
45647         LDKCVec_u8Z ret_var = TxAddOutput_write(&obj_conv);
45648         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
45649         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
45650         CVec_u8Z_free(ret_var);
45651         return ret_arr;
45652 }
45653
45654 uint64_t  __attribute__((export_name("TS_TxAddOutput_read"))) TS_TxAddOutput_read(int8_tArray ser) {
45655         LDKu8slice ser_ref;
45656         ser_ref.datalen = ser->arr_len;
45657         ser_ref.data = ser->elems;
45658         LDKCResult_TxAddOutputDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TxAddOutputDecodeErrorZ), "LDKCResult_TxAddOutputDecodeErrorZ");
45659         *ret_conv = TxAddOutput_read(ser_ref);
45660         FREE(ser);
45661         return tag_ptr(ret_conv, true);
45662 }
45663
45664 int8_tArray  __attribute__((export_name("TS_TxRemoveInput_write"))) TS_TxRemoveInput_write(uint64_t obj) {
45665         LDKTxRemoveInput obj_conv;
45666         obj_conv.inner = untag_ptr(obj);
45667         obj_conv.is_owned = ptr_is_owned(obj);
45668         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
45669         obj_conv.is_owned = false;
45670         LDKCVec_u8Z ret_var = TxRemoveInput_write(&obj_conv);
45671         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
45672         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
45673         CVec_u8Z_free(ret_var);
45674         return ret_arr;
45675 }
45676
45677 uint64_t  __attribute__((export_name("TS_TxRemoveInput_read"))) TS_TxRemoveInput_read(int8_tArray ser) {
45678         LDKu8slice ser_ref;
45679         ser_ref.datalen = ser->arr_len;
45680         ser_ref.data = ser->elems;
45681         LDKCResult_TxRemoveInputDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TxRemoveInputDecodeErrorZ), "LDKCResult_TxRemoveInputDecodeErrorZ");
45682         *ret_conv = TxRemoveInput_read(ser_ref);
45683         FREE(ser);
45684         return tag_ptr(ret_conv, true);
45685 }
45686
45687 int8_tArray  __attribute__((export_name("TS_TxRemoveOutput_write"))) TS_TxRemoveOutput_write(uint64_t obj) {
45688         LDKTxRemoveOutput obj_conv;
45689         obj_conv.inner = untag_ptr(obj);
45690         obj_conv.is_owned = ptr_is_owned(obj);
45691         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
45692         obj_conv.is_owned = false;
45693         LDKCVec_u8Z ret_var = TxRemoveOutput_write(&obj_conv);
45694         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
45695         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
45696         CVec_u8Z_free(ret_var);
45697         return ret_arr;
45698 }
45699
45700 uint64_t  __attribute__((export_name("TS_TxRemoveOutput_read"))) TS_TxRemoveOutput_read(int8_tArray ser) {
45701         LDKu8slice ser_ref;
45702         ser_ref.datalen = ser->arr_len;
45703         ser_ref.data = ser->elems;
45704         LDKCResult_TxRemoveOutputDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TxRemoveOutputDecodeErrorZ), "LDKCResult_TxRemoveOutputDecodeErrorZ");
45705         *ret_conv = TxRemoveOutput_read(ser_ref);
45706         FREE(ser);
45707         return tag_ptr(ret_conv, true);
45708 }
45709
45710 int8_tArray  __attribute__((export_name("TS_TxComplete_write"))) TS_TxComplete_write(uint64_t obj) {
45711         LDKTxComplete obj_conv;
45712         obj_conv.inner = untag_ptr(obj);
45713         obj_conv.is_owned = ptr_is_owned(obj);
45714         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
45715         obj_conv.is_owned = false;
45716         LDKCVec_u8Z ret_var = TxComplete_write(&obj_conv);
45717         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
45718         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
45719         CVec_u8Z_free(ret_var);
45720         return ret_arr;
45721 }
45722
45723 uint64_t  __attribute__((export_name("TS_TxComplete_read"))) TS_TxComplete_read(int8_tArray ser) {
45724         LDKu8slice ser_ref;
45725         ser_ref.datalen = ser->arr_len;
45726         ser_ref.data = ser->elems;
45727         LDKCResult_TxCompleteDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TxCompleteDecodeErrorZ), "LDKCResult_TxCompleteDecodeErrorZ");
45728         *ret_conv = TxComplete_read(ser_ref);
45729         FREE(ser);
45730         return tag_ptr(ret_conv, true);
45731 }
45732
45733 int8_tArray  __attribute__((export_name("TS_TxSignatures_write"))) TS_TxSignatures_write(uint64_t obj) {
45734         LDKTxSignatures obj_conv;
45735         obj_conv.inner = untag_ptr(obj);
45736         obj_conv.is_owned = ptr_is_owned(obj);
45737         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
45738         obj_conv.is_owned = false;
45739         LDKCVec_u8Z ret_var = TxSignatures_write(&obj_conv);
45740         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
45741         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
45742         CVec_u8Z_free(ret_var);
45743         return ret_arr;
45744 }
45745
45746 uint64_t  __attribute__((export_name("TS_TxSignatures_read"))) TS_TxSignatures_read(int8_tArray ser) {
45747         LDKu8slice ser_ref;
45748         ser_ref.datalen = ser->arr_len;
45749         ser_ref.data = ser->elems;
45750         LDKCResult_TxSignaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TxSignaturesDecodeErrorZ), "LDKCResult_TxSignaturesDecodeErrorZ");
45751         *ret_conv = TxSignatures_read(ser_ref);
45752         FREE(ser);
45753         return tag_ptr(ret_conv, true);
45754 }
45755
45756 int8_tArray  __attribute__((export_name("TS_TxInitRbf_write"))) TS_TxInitRbf_write(uint64_t obj) {
45757         LDKTxInitRbf obj_conv;
45758         obj_conv.inner = untag_ptr(obj);
45759         obj_conv.is_owned = ptr_is_owned(obj);
45760         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
45761         obj_conv.is_owned = false;
45762         LDKCVec_u8Z ret_var = TxInitRbf_write(&obj_conv);
45763         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
45764         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
45765         CVec_u8Z_free(ret_var);
45766         return ret_arr;
45767 }
45768
45769 uint64_t  __attribute__((export_name("TS_TxInitRbf_read"))) TS_TxInitRbf_read(int8_tArray ser) {
45770         LDKu8slice ser_ref;
45771         ser_ref.datalen = ser->arr_len;
45772         ser_ref.data = ser->elems;
45773         LDKCResult_TxInitRbfDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TxInitRbfDecodeErrorZ), "LDKCResult_TxInitRbfDecodeErrorZ");
45774         *ret_conv = TxInitRbf_read(ser_ref);
45775         FREE(ser);
45776         return tag_ptr(ret_conv, true);
45777 }
45778
45779 int8_tArray  __attribute__((export_name("TS_TxAckRbf_write"))) TS_TxAckRbf_write(uint64_t obj) {
45780         LDKTxAckRbf obj_conv;
45781         obj_conv.inner = untag_ptr(obj);
45782         obj_conv.is_owned = ptr_is_owned(obj);
45783         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
45784         obj_conv.is_owned = false;
45785         LDKCVec_u8Z ret_var = TxAckRbf_write(&obj_conv);
45786         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
45787         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
45788         CVec_u8Z_free(ret_var);
45789         return ret_arr;
45790 }
45791
45792 uint64_t  __attribute__((export_name("TS_TxAckRbf_read"))) TS_TxAckRbf_read(int8_tArray ser) {
45793         LDKu8slice ser_ref;
45794         ser_ref.datalen = ser->arr_len;
45795         ser_ref.data = ser->elems;
45796         LDKCResult_TxAckRbfDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TxAckRbfDecodeErrorZ), "LDKCResult_TxAckRbfDecodeErrorZ");
45797         *ret_conv = TxAckRbf_read(ser_ref);
45798         FREE(ser);
45799         return tag_ptr(ret_conv, true);
45800 }
45801
45802 int8_tArray  __attribute__((export_name("TS_TxAbort_write"))) TS_TxAbort_write(uint64_t obj) {
45803         LDKTxAbort obj_conv;
45804         obj_conv.inner = untag_ptr(obj);
45805         obj_conv.is_owned = ptr_is_owned(obj);
45806         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
45807         obj_conv.is_owned = false;
45808         LDKCVec_u8Z ret_var = TxAbort_write(&obj_conv);
45809         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
45810         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
45811         CVec_u8Z_free(ret_var);
45812         return ret_arr;
45813 }
45814
45815 uint64_t  __attribute__((export_name("TS_TxAbort_read"))) TS_TxAbort_read(int8_tArray ser) {
45816         LDKu8slice ser_ref;
45817         ser_ref.datalen = ser->arr_len;
45818         ser_ref.data = ser->elems;
45819         LDKCResult_TxAbortDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TxAbortDecodeErrorZ), "LDKCResult_TxAbortDecodeErrorZ");
45820         *ret_conv = TxAbort_read(ser_ref);
45821         FREE(ser);
45822         return tag_ptr(ret_conv, true);
45823 }
45824
45825 int8_tArray  __attribute__((export_name("TS_AnnouncementSignatures_write"))) TS_AnnouncementSignatures_write(uint64_t obj) {
45826         LDKAnnouncementSignatures obj_conv;
45827         obj_conv.inner = untag_ptr(obj);
45828         obj_conv.is_owned = ptr_is_owned(obj);
45829         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
45830         obj_conv.is_owned = false;
45831         LDKCVec_u8Z ret_var = AnnouncementSignatures_write(&obj_conv);
45832         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
45833         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
45834         CVec_u8Z_free(ret_var);
45835         return ret_arr;
45836 }
45837
45838 uint64_t  __attribute__((export_name("TS_AnnouncementSignatures_read"))) TS_AnnouncementSignatures_read(int8_tArray ser) {
45839         LDKu8slice ser_ref;
45840         ser_ref.datalen = ser->arr_len;
45841         ser_ref.data = ser->elems;
45842         LDKCResult_AnnouncementSignaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_AnnouncementSignaturesDecodeErrorZ), "LDKCResult_AnnouncementSignaturesDecodeErrorZ");
45843         *ret_conv = AnnouncementSignatures_read(ser_ref);
45844         FREE(ser);
45845         return tag_ptr(ret_conv, true);
45846 }
45847
45848 int8_tArray  __attribute__((export_name("TS_ChannelReestablish_write"))) TS_ChannelReestablish_write(uint64_t obj) {
45849         LDKChannelReestablish obj_conv;
45850         obj_conv.inner = untag_ptr(obj);
45851         obj_conv.is_owned = ptr_is_owned(obj);
45852         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
45853         obj_conv.is_owned = false;
45854         LDKCVec_u8Z ret_var = ChannelReestablish_write(&obj_conv);
45855         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
45856         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
45857         CVec_u8Z_free(ret_var);
45858         return ret_arr;
45859 }
45860
45861 uint64_t  __attribute__((export_name("TS_ChannelReestablish_read"))) TS_ChannelReestablish_read(int8_tArray ser) {
45862         LDKu8slice ser_ref;
45863         ser_ref.datalen = ser->arr_len;
45864         ser_ref.data = ser->elems;
45865         LDKCResult_ChannelReestablishDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelReestablishDecodeErrorZ), "LDKCResult_ChannelReestablishDecodeErrorZ");
45866         *ret_conv = ChannelReestablish_read(ser_ref);
45867         FREE(ser);
45868         return tag_ptr(ret_conv, true);
45869 }
45870
45871 int8_tArray  __attribute__((export_name("TS_ClosingSigned_write"))) TS_ClosingSigned_write(uint64_t obj) {
45872         LDKClosingSigned obj_conv;
45873         obj_conv.inner = untag_ptr(obj);
45874         obj_conv.is_owned = ptr_is_owned(obj);
45875         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
45876         obj_conv.is_owned = false;
45877         LDKCVec_u8Z ret_var = ClosingSigned_write(&obj_conv);
45878         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
45879         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
45880         CVec_u8Z_free(ret_var);
45881         return ret_arr;
45882 }
45883
45884 uint64_t  __attribute__((export_name("TS_ClosingSigned_read"))) TS_ClosingSigned_read(int8_tArray ser) {
45885         LDKu8slice ser_ref;
45886         ser_ref.datalen = ser->arr_len;
45887         ser_ref.data = ser->elems;
45888         LDKCResult_ClosingSignedDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ClosingSignedDecodeErrorZ), "LDKCResult_ClosingSignedDecodeErrorZ");
45889         *ret_conv = ClosingSigned_read(ser_ref);
45890         FREE(ser);
45891         return tag_ptr(ret_conv, true);
45892 }
45893
45894 int8_tArray  __attribute__((export_name("TS_ClosingSignedFeeRange_write"))) TS_ClosingSignedFeeRange_write(uint64_t obj) {
45895         LDKClosingSignedFeeRange obj_conv;
45896         obj_conv.inner = untag_ptr(obj);
45897         obj_conv.is_owned = ptr_is_owned(obj);
45898         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
45899         obj_conv.is_owned = false;
45900         LDKCVec_u8Z ret_var = ClosingSignedFeeRange_write(&obj_conv);
45901         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
45902         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
45903         CVec_u8Z_free(ret_var);
45904         return ret_arr;
45905 }
45906
45907 uint64_t  __attribute__((export_name("TS_ClosingSignedFeeRange_read"))) TS_ClosingSignedFeeRange_read(int8_tArray ser) {
45908         LDKu8slice ser_ref;
45909         ser_ref.datalen = ser->arr_len;
45910         ser_ref.data = ser->elems;
45911         LDKCResult_ClosingSignedFeeRangeDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ClosingSignedFeeRangeDecodeErrorZ), "LDKCResult_ClosingSignedFeeRangeDecodeErrorZ");
45912         *ret_conv = ClosingSignedFeeRange_read(ser_ref);
45913         FREE(ser);
45914         return tag_ptr(ret_conv, true);
45915 }
45916
45917 int8_tArray  __attribute__((export_name("TS_CommitmentSigned_write"))) TS_CommitmentSigned_write(uint64_t obj) {
45918         LDKCommitmentSigned obj_conv;
45919         obj_conv.inner = untag_ptr(obj);
45920         obj_conv.is_owned = ptr_is_owned(obj);
45921         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
45922         obj_conv.is_owned = false;
45923         LDKCVec_u8Z ret_var = CommitmentSigned_write(&obj_conv);
45924         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
45925         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
45926         CVec_u8Z_free(ret_var);
45927         return ret_arr;
45928 }
45929
45930 uint64_t  __attribute__((export_name("TS_CommitmentSigned_read"))) TS_CommitmentSigned_read(int8_tArray ser) {
45931         LDKu8slice ser_ref;
45932         ser_ref.datalen = ser->arr_len;
45933         ser_ref.data = ser->elems;
45934         LDKCResult_CommitmentSignedDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CommitmentSignedDecodeErrorZ), "LDKCResult_CommitmentSignedDecodeErrorZ");
45935         *ret_conv = CommitmentSigned_read(ser_ref);
45936         FREE(ser);
45937         return tag_ptr(ret_conv, true);
45938 }
45939
45940 int8_tArray  __attribute__((export_name("TS_FundingCreated_write"))) TS_FundingCreated_write(uint64_t obj) {
45941         LDKFundingCreated obj_conv;
45942         obj_conv.inner = untag_ptr(obj);
45943         obj_conv.is_owned = ptr_is_owned(obj);
45944         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
45945         obj_conv.is_owned = false;
45946         LDKCVec_u8Z ret_var = FundingCreated_write(&obj_conv);
45947         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
45948         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
45949         CVec_u8Z_free(ret_var);
45950         return ret_arr;
45951 }
45952
45953 uint64_t  __attribute__((export_name("TS_FundingCreated_read"))) TS_FundingCreated_read(int8_tArray ser) {
45954         LDKu8slice ser_ref;
45955         ser_ref.datalen = ser->arr_len;
45956         ser_ref.data = ser->elems;
45957         LDKCResult_FundingCreatedDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_FundingCreatedDecodeErrorZ), "LDKCResult_FundingCreatedDecodeErrorZ");
45958         *ret_conv = FundingCreated_read(ser_ref);
45959         FREE(ser);
45960         return tag_ptr(ret_conv, true);
45961 }
45962
45963 int8_tArray  __attribute__((export_name("TS_FundingSigned_write"))) TS_FundingSigned_write(uint64_t obj) {
45964         LDKFundingSigned obj_conv;
45965         obj_conv.inner = untag_ptr(obj);
45966         obj_conv.is_owned = ptr_is_owned(obj);
45967         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
45968         obj_conv.is_owned = false;
45969         LDKCVec_u8Z ret_var = FundingSigned_write(&obj_conv);
45970         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
45971         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
45972         CVec_u8Z_free(ret_var);
45973         return ret_arr;
45974 }
45975
45976 uint64_t  __attribute__((export_name("TS_FundingSigned_read"))) TS_FundingSigned_read(int8_tArray ser) {
45977         LDKu8slice ser_ref;
45978         ser_ref.datalen = ser->arr_len;
45979         ser_ref.data = ser->elems;
45980         LDKCResult_FundingSignedDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_FundingSignedDecodeErrorZ), "LDKCResult_FundingSignedDecodeErrorZ");
45981         *ret_conv = FundingSigned_read(ser_ref);
45982         FREE(ser);
45983         return tag_ptr(ret_conv, true);
45984 }
45985
45986 int8_tArray  __attribute__((export_name("TS_ChannelReady_write"))) TS_ChannelReady_write(uint64_t obj) {
45987         LDKChannelReady obj_conv;
45988         obj_conv.inner = untag_ptr(obj);
45989         obj_conv.is_owned = ptr_is_owned(obj);
45990         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
45991         obj_conv.is_owned = false;
45992         LDKCVec_u8Z ret_var = ChannelReady_write(&obj_conv);
45993         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
45994         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
45995         CVec_u8Z_free(ret_var);
45996         return ret_arr;
45997 }
45998
45999 uint64_t  __attribute__((export_name("TS_ChannelReady_read"))) TS_ChannelReady_read(int8_tArray ser) {
46000         LDKu8slice ser_ref;
46001         ser_ref.datalen = ser->arr_len;
46002         ser_ref.data = ser->elems;
46003         LDKCResult_ChannelReadyDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelReadyDecodeErrorZ), "LDKCResult_ChannelReadyDecodeErrorZ");
46004         *ret_conv = ChannelReady_read(ser_ref);
46005         FREE(ser);
46006         return tag_ptr(ret_conv, true);
46007 }
46008
46009 int8_tArray  __attribute__((export_name("TS_Init_write"))) TS_Init_write(uint64_t obj) {
46010         LDKInit obj_conv;
46011         obj_conv.inner = untag_ptr(obj);
46012         obj_conv.is_owned = ptr_is_owned(obj);
46013         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
46014         obj_conv.is_owned = false;
46015         LDKCVec_u8Z ret_var = Init_write(&obj_conv);
46016         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
46017         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
46018         CVec_u8Z_free(ret_var);
46019         return ret_arr;
46020 }
46021
46022 uint64_t  __attribute__((export_name("TS_Init_read"))) TS_Init_read(int8_tArray ser) {
46023         LDKu8slice ser_ref;
46024         ser_ref.datalen = ser->arr_len;
46025         ser_ref.data = ser->elems;
46026         LDKCResult_InitDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InitDecodeErrorZ), "LDKCResult_InitDecodeErrorZ");
46027         *ret_conv = Init_read(ser_ref);
46028         FREE(ser);
46029         return tag_ptr(ret_conv, true);
46030 }
46031
46032 int8_tArray  __attribute__((export_name("TS_OpenChannel_write"))) TS_OpenChannel_write(uint64_t obj) {
46033         LDKOpenChannel obj_conv;
46034         obj_conv.inner = untag_ptr(obj);
46035         obj_conv.is_owned = ptr_is_owned(obj);
46036         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
46037         obj_conv.is_owned = false;
46038         LDKCVec_u8Z ret_var = OpenChannel_write(&obj_conv);
46039         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
46040         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
46041         CVec_u8Z_free(ret_var);
46042         return ret_arr;
46043 }
46044
46045 uint64_t  __attribute__((export_name("TS_OpenChannel_read"))) TS_OpenChannel_read(int8_tArray ser) {
46046         LDKu8slice ser_ref;
46047         ser_ref.datalen = ser->arr_len;
46048         ser_ref.data = ser->elems;
46049         LDKCResult_OpenChannelDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_OpenChannelDecodeErrorZ), "LDKCResult_OpenChannelDecodeErrorZ");
46050         *ret_conv = OpenChannel_read(ser_ref);
46051         FREE(ser);
46052         return tag_ptr(ret_conv, true);
46053 }
46054
46055 int8_tArray  __attribute__((export_name("TS_OpenChannelV2_write"))) TS_OpenChannelV2_write(uint64_t obj) {
46056         LDKOpenChannelV2 obj_conv;
46057         obj_conv.inner = untag_ptr(obj);
46058         obj_conv.is_owned = ptr_is_owned(obj);
46059         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
46060         obj_conv.is_owned = false;
46061         LDKCVec_u8Z ret_var = OpenChannelV2_write(&obj_conv);
46062         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
46063         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
46064         CVec_u8Z_free(ret_var);
46065         return ret_arr;
46066 }
46067
46068 uint64_t  __attribute__((export_name("TS_OpenChannelV2_read"))) TS_OpenChannelV2_read(int8_tArray ser) {
46069         LDKu8slice ser_ref;
46070         ser_ref.datalen = ser->arr_len;
46071         ser_ref.data = ser->elems;
46072         LDKCResult_OpenChannelV2DecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_OpenChannelV2DecodeErrorZ), "LDKCResult_OpenChannelV2DecodeErrorZ");
46073         *ret_conv = OpenChannelV2_read(ser_ref);
46074         FREE(ser);
46075         return tag_ptr(ret_conv, true);
46076 }
46077
46078 int8_tArray  __attribute__((export_name("TS_RevokeAndACK_write"))) TS_RevokeAndACK_write(uint64_t obj) {
46079         LDKRevokeAndACK obj_conv;
46080         obj_conv.inner = untag_ptr(obj);
46081         obj_conv.is_owned = ptr_is_owned(obj);
46082         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
46083         obj_conv.is_owned = false;
46084         LDKCVec_u8Z ret_var = RevokeAndACK_write(&obj_conv);
46085         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
46086         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
46087         CVec_u8Z_free(ret_var);
46088         return ret_arr;
46089 }
46090
46091 uint64_t  __attribute__((export_name("TS_RevokeAndACK_read"))) TS_RevokeAndACK_read(int8_tArray ser) {
46092         LDKu8slice ser_ref;
46093         ser_ref.datalen = ser->arr_len;
46094         ser_ref.data = ser->elems;
46095         LDKCResult_RevokeAndACKDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RevokeAndACKDecodeErrorZ), "LDKCResult_RevokeAndACKDecodeErrorZ");
46096         *ret_conv = RevokeAndACK_read(ser_ref);
46097         FREE(ser);
46098         return tag_ptr(ret_conv, true);
46099 }
46100
46101 int8_tArray  __attribute__((export_name("TS_Shutdown_write"))) TS_Shutdown_write(uint64_t obj) {
46102         LDKShutdown obj_conv;
46103         obj_conv.inner = untag_ptr(obj);
46104         obj_conv.is_owned = ptr_is_owned(obj);
46105         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
46106         obj_conv.is_owned = false;
46107         LDKCVec_u8Z ret_var = Shutdown_write(&obj_conv);
46108         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
46109         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
46110         CVec_u8Z_free(ret_var);
46111         return ret_arr;
46112 }
46113
46114 uint64_t  __attribute__((export_name("TS_Shutdown_read"))) TS_Shutdown_read(int8_tArray ser) {
46115         LDKu8slice ser_ref;
46116         ser_ref.datalen = ser->arr_len;
46117         ser_ref.data = ser->elems;
46118         LDKCResult_ShutdownDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ShutdownDecodeErrorZ), "LDKCResult_ShutdownDecodeErrorZ");
46119         *ret_conv = Shutdown_read(ser_ref);
46120         FREE(ser);
46121         return tag_ptr(ret_conv, true);
46122 }
46123
46124 int8_tArray  __attribute__((export_name("TS_UpdateFailHTLC_write"))) TS_UpdateFailHTLC_write(uint64_t obj) {
46125         LDKUpdateFailHTLC obj_conv;
46126         obj_conv.inner = untag_ptr(obj);
46127         obj_conv.is_owned = ptr_is_owned(obj);
46128         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
46129         obj_conv.is_owned = false;
46130         LDKCVec_u8Z ret_var = UpdateFailHTLC_write(&obj_conv);
46131         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
46132         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
46133         CVec_u8Z_free(ret_var);
46134         return ret_arr;
46135 }
46136
46137 uint64_t  __attribute__((export_name("TS_UpdateFailHTLC_read"))) TS_UpdateFailHTLC_read(int8_tArray ser) {
46138         LDKu8slice ser_ref;
46139         ser_ref.datalen = ser->arr_len;
46140         ser_ref.data = ser->elems;
46141         LDKCResult_UpdateFailHTLCDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UpdateFailHTLCDecodeErrorZ), "LDKCResult_UpdateFailHTLCDecodeErrorZ");
46142         *ret_conv = UpdateFailHTLC_read(ser_ref);
46143         FREE(ser);
46144         return tag_ptr(ret_conv, true);
46145 }
46146
46147 int8_tArray  __attribute__((export_name("TS_UpdateFailMalformedHTLC_write"))) TS_UpdateFailMalformedHTLC_write(uint64_t obj) {
46148         LDKUpdateFailMalformedHTLC obj_conv;
46149         obj_conv.inner = untag_ptr(obj);
46150         obj_conv.is_owned = ptr_is_owned(obj);
46151         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
46152         obj_conv.is_owned = false;
46153         LDKCVec_u8Z ret_var = UpdateFailMalformedHTLC_write(&obj_conv);
46154         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
46155         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
46156         CVec_u8Z_free(ret_var);
46157         return ret_arr;
46158 }
46159
46160 uint64_t  __attribute__((export_name("TS_UpdateFailMalformedHTLC_read"))) TS_UpdateFailMalformedHTLC_read(int8_tArray ser) {
46161         LDKu8slice ser_ref;
46162         ser_ref.datalen = ser->arr_len;
46163         ser_ref.data = ser->elems;
46164         LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ), "LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ");
46165         *ret_conv = UpdateFailMalformedHTLC_read(ser_ref);
46166         FREE(ser);
46167         return tag_ptr(ret_conv, true);
46168 }
46169
46170 int8_tArray  __attribute__((export_name("TS_UpdateFee_write"))) TS_UpdateFee_write(uint64_t obj) {
46171         LDKUpdateFee obj_conv;
46172         obj_conv.inner = untag_ptr(obj);
46173         obj_conv.is_owned = ptr_is_owned(obj);
46174         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
46175         obj_conv.is_owned = false;
46176         LDKCVec_u8Z ret_var = UpdateFee_write(&obj_conv);
46177         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
46178         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
46179         CVec_u8Z_free(ret_var);
46180         return ret_arr;
46181 }
46182
46183 uint64_t  __attribute__((export_name("TS_UpdateFee_read"))) TS_UpdateFee_read(int8_tArray ser) {
46184         LDKu8slice ser_ref;
46185         ser_ref.datalen = ser->arr_len;
46186         ser_ref.data = ser->elems;
46187         LDKCResult_UpdateFeeDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UpdateFeeDecodeErrorZ), "LDKCResult_UpdateFeeDecodeErrorZ");
46188         *ret_conv = UpdateFee_read(ser_ref);
46189         FREE(ser);
46190         return tag_ptr(ret_conv, true);
46191 }
46192
46193 int8_tArray  __attribute__((export_name("TS_UpdateFulfillHTLC_write"))) TS_UpdateFulfillHTLC_write(uint64_t obj) {
46194         LDKUpdateFulfillHTLC obj_conv;
46195         obj_conv.inner = untag_ptr(obj);
46196         obj_conv.is_owned = ptr_is_owned(obj);
46197         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
46198         obj_conv.is_owned = false;
46199         LDKCVec_u8Z ret_var = UpdateFulfillHTLC_write(&obj_conv);
46200         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
46201         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
46202         CVec_u8Z_free(ret_var);
46203         return ret_arr;
46204 }
46205
46206 uint64_t  __attribute__((export_name("TS_UpdateFulfillHTLC_read"))) TS_UpdateFulfillHTLC_read(int8_tArray ser) {
46207         LDKu8slice ser_ref;
46208         ser_ref.datalen = ser->arr_len;
46209         ser_ref.data = ser->elems;
46210         LDKCResult_UpdateFulfillHTLCDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UpdateFulfillHTLCDecodeErrorZ), "LDKCResult_UpdateFulfillHTLCDecodeErrorZ");
46211         *ret_conv = UpdateFulfillHTLC_read(ser_ref);
46212         FREE(ser);
46213         return tag_ptr(ret_conv, true);
46214 }
46215
46216 int8_tArray  __attribute__((export_name("TS_UpdateAddHTLC_write"))) TS_UpdateAddHTLC_write(uint64_t obj) {
46217         LDKUpdateAddHTLC obj_conv;
46218         obj_conv.inner = untag_ptr(obj);
46219         obj_conv.is_owned = ptr_is_owned(obj);
46220         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
46221         obj_conv.is_owned = false;
46222         LDKCVec_u8Z ret_var = UpdateAddHTLC_write(&obj_conv);
46223         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
46224         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
46225         CVec_u8Z_free(ret_var);
46226         return ret_arr;
46227 }
46228
46229 uint64_t  __attribute__((export_name("TS_UpdateAddHTLC_read"))) TS_UpdateAddHTLC_read(int8_tArray ser) {
46230         LDKu8slice ser_ref;
46231         ser_ref.datalen = ser->arr_len;
46232         ser_ref.data = ser->elems;
46233         LDKCResult_UpdateAddHTLCDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UpdateAddHTLCDecodeErrorZ), "LDKCResult_UpdateAddHTLCDecodeErrorZ");
46234         *ret_conv = UpdateAddHTLC_read(ser_ref);
46235         FREE(ser);
46236         return tag_ptr(ret_conv, true);
46237 }
46238
46239 uint64_t  __attribute__((export_name("TS_OnionMessage_read"))) TS_OnionMessage_read(int8_tArray ser) {
46240         LDKu8slice ser_ref;
46241         ser_ref.datalen = ser->arr_len;
46242         ser_ref.data = ser->elems;
46243         LDKCResult_OnionMessageDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_OnionMessageDecodeErrorZ), "LDKCResult_OnionMessageDecodeErrorZ");
46244         *ret_conv = OnionMessage_read(ser_ref);
46245         FREE(ser);
46246         return tag_ptr(ret_conv, true);
46247 }
46248
46249 int8_tArray  __attribute__((export_name("TS_OnionMessage_write"))) TS_OnionMessage_write(uint64_t obj) {
46250         LDKOnionMessage obj_conv;
46251         obj_conv.inner = untag_ptr(obj);
46252         obj_conv.is_owned = ptr_is_owned(obj);
46253         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
46254         obj_conv.is_owned = false;
46255         LDKCVec_u8Z ret_var = OnionMessage_write(&obj_conv);
46256         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
46257         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
46258         CVec_u8Z_free(ret_var);
46259         return ret_arr;
46260 }
46261
46262 int8_tArray  __attribute__((export_name("TS_Ping_write"))) TS_Ping_write(uint64_t obj) {
46263         LDKPing obj_conv;
46264         obj_conv.inner = untag_ptr(obj);
46265         obj_conv.is_owned = ptr_is_owned(obj);
46266         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
46267         obj_conv.is_owned = false;
46268         LDKCVec_u8Z ret_var = Ping_write(&obj_conv);
46269         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
46270         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
46271         CVec_u8Z_free(ret_var);
46272         return ret_arr;
46273 }
46274
46275 uint64_t  __attribute__((export_name("TS_Ping_read"))) TS_Ping_read(int8_tArray ser) {
46276         LDKu8slice ser_ref;
46277         ser_ref.datalen = ser->arr_len;
46278         ser_ref.data = ser->elems;
46279         LDKCResult_PingDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PingDecodeErrorZ), "LDKCResult_PingDecodeErrorZ");
46280         *ret_conv = Ping_read(ser_ref);
46281         FREE(ser);
46282         return tag_ptr(ret_conv, true);
46283 }
46284
46285 int8_tArray  __attribute__((export_name("TS_Pong_write"))) TS_Pong_write(uint64_t obj) {
46286         LDKPong obj_conv;
46287         obj_conv.inner = untag_ptr(obj);
46288         obj_conv.is_owned = ptr_is_owned(obj);
46289         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
46290         obj_conv.is_owned = false;
46291         LDKCVec_u8Z ret_var = Pong_write(&obj_conv);
46292         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
46293         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
46294         CVec_u8Z_free(ret_var);
46295         return ret_arr;
46296 }
46297
46298 uint64_t  __attribute__((export_name("TS_Pong_read"))) TS_Pong_read(int8_tArray ser) {
46299         LDKu8slice ser_ref;
46300         ser_ref.datalen = ser->arr_len;
46301         ser_ref.data = ser->elems;
46302         LDKCResult_PongDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PongDecodeErrorZ), "LDKCResult_PongDecodeErrorZ");
46303         *ret_conv = Pong_read(ser_ref);
46304         FREE(ser);
46305         return tag_ptr(ret_conv, true);
46306 }
46307
46308 int8_tArray  __attribute__((export_name("TS_UnsignedChannelAnnouncement_write"))) TS_UnsignedChannelAnnouncement_write(uint64_t obj) {
46309         LDKUnsignedChannelAnnouncement obj_conv;
46310         obj_conv.inner = untag_ptr(obj);
46311         obj_conv.is_owned = ptr_is_owned(obj);
46312         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
46313         obj_conv.is_owned = false;
46314         LDKCVec_u8Z ret_var = UnsignedChannelAnnouncement_write(&obj_conv);
46315         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
46316         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
46317         CVec_u8Z_free(ret_var);
46318         return ret_arr;
46319 }
46320
46321 uint64_t  __attribute__((export_name("TS_UnsignedChannelAnnouncement_read"))) TS_UnsignedChannelAnnouncement_read(int8_tArray ser) {
46322         LDKu8slice ser_ref;
46323         ser_ref.datalen = ser->arr_len;
46324         ser_ref.data = ser->elems;
46325         LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ), "LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ");
46326         *ret_conv = UnsignedChannelAnnouncement_read(ser_ref);
46327         FREE(ser);
46328         return tag_ptr(ret_conv, true);
46329 }
46330
46331 int8_tArray  __attribute__((export_name("TS_ChannelAnnouncement_write"))) TS_ChannelAnnouncement_write(uint64_t obj) {
46332         LDKChannelAnnouncement obj_conv;
46333         obj_conv.inner = untag_ptr(obj);
46334         obj_conv.is_owned = ptr_is_owned(obj);
46335         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
46336         obj_conv.is_owned = false;
46337         LDKCVec_u8Z ret_var = ChannelAnnouncement_write(&obj_conv);
46338         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
46339         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
46340         CVec_u8Z_free(ret_var);
46341         return ret_arr;
46342 }
46343
46344 uint64_t  __attribute__((export_name("TS_ChannelAnnouncement_read"))) TS_ChannelAnnouncement_read(int8_tArray ser) {
46345         LDKu8slice ser_ref;
46346         ser_ref.datalen = ser->arr_len;
46347         ser_ref.data = ser->elems;
46348         LDKCResult_ChannelAnnouncementDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelAnnouncementDecodeErrorZ), "LDKCResult_ChannelAnnouncementDecodeErrorZ");
46349         *ret_conv = ChannelAnnouncement_read(ser_ref);
46350         FREE(ser);
46351         return tag_ptr(ret_conv, true);
46352 }
46353
46354 int8_tArray  __attribute__((export_name("TS_UnsignedChannelUpdate_write"))) TS_UnsignedChannelUpdate_write(uint64_t obj) {
46355         LDKUnsignedChannelUpdate obj_conv;
46356         obj_conv.inner = untag_ptr(obj);
46357         obj_conv.is_owned = ptr_is_owned(obj);
46358         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
46359         obj_conv.is_owned = false;
46360         LDKCVec_u8Z ret_var = UnsignedChannelUpdate_write(&obj_conv);
46361         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
46362         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
46363         CVec_u8Z_free(ret_var);
46364         return ret_arr;
46365 }
46366
46367 uint64_t  __attribute__((export_name("TS_UnsignedChannelUpdate_read"))) TS_UnsignedChannelUpdate_read(int8_tArray ser) {
46368         LDKu8slice ser_ref;
46369         ser_ref.datalen = ser->arr_len;
46370         ser_ref.data = ser->elems;
46371         LDKCResult_UnsignedChannelUpdateDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UnsignedChannelUpdateDecodeErrorZ), "LDKCResult_UnsignedChannelUpdateDecodeErrorZ");
46372         *ret_conv = UnsignedChannelUpdate_read(ser_ref);
46373         FREE(ser);
46374         return tag_ptr(ret_conv, true);
46375 }
46376
46377 int8_tArray  __attribute__((export_name("TS_ChannelUpdate_write"))) TS_ChannelUpdate_write(uint64_t obj) {
46378         LDKChannelUpdate obj_conv;
46379         obj_conv.inner = untag_ptr(obj);
46380         obj_conv.is_owned = ptr_is_owned(obj);
46381         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
46382         obj_conv.is_owned = false;
46383         LDKCVec_u8Z ret_var = ChannelUpdate_write(&obj_conv);
46384         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
46385         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
46386         CVec_u8Z_free(ret_var);
46387         return ret_arr;
46388 }
46389
46390 uint64_t  __attribute__((export_name("TS_ChannelUpdate_read"))) TS_ChannelUpdate_read(int8_tArray ser) {
46391         LDKu8slice ser_ref;
46392         ser_ref.datalen = ser->arr_len;
46393         ser_ref.data = ser->elems;
46394         LDKCResult_ChannelUpdateDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelUpdateDecodeErrorZ), "LDKCResult_ChannelUpdateDecodeErrorZ");
46395         *ret_conv = ChannelUpdate_read(ser_ref);
46396         FREE(ser);
46397         return tag_ptr(ret_conv, true);
46398 }
46399
46400 int8_tArray  __attribute__((export_name("TS_ErrorMessage_write"))) TS_ErrorMessage_write(uint64_t obj) {
46401         LDKErrorMessage obj_conv;
46402         obj_conv.inner = untag_ptr(obj);
46403         obj_conv.is_owned = ptr_is_owned(obj);
46404         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
46405         obj_conv.is_owned = false;
46406         LDKCVec_u8Z ret_var = ErrorMessage_write(&obj_conv);
46407         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
46408         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
46409         CVec_u8Z_free(ret_var);
46410         return ret_arr;
46411 }
46412
46413 uint64_t  __attribute__((export_name("TS_ErrorMessage_read"))) TS_ErrorMessage_read(int8_tArray ser) {
46414         LDKu8slice ser_ref;
46415         ser_ref.datalen = ser->arr_len;
46416         ser_ref.data = ser->elems;
46417         LDKCResult_ErrorMessageDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ErrorMessageDecodeErrorZ), "LDKCResult_ErrorMessageDecodeErrorZ");
46418         *ret_conv = ErrorMessage_read(ser_ref);
46419         FREE(ser);
46420         return tag_ptr(ret_conv, true);
46421 }
46422
46423 int8_tArray  __attribute__((export_name("TS_WarningMessage_write"))) TS_WarningMessage_write(uint64_t obj) {
46424         LDKWarningMessage obj_conv;
46425         obj_conv.inner = untag_ptr(obj);
46426         obj_conv.is_owned = ptr_is_owned(obj);
46427         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
46428         obj_conv.is_owned = false;
46429         LDKCVec_u8Z ret_var = WarningMessage_write(&obj_conv);
46430         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
46431         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
46432         CVec_u8Z_free(ret_var);
46433         return ret_arr;
46434 }
46435
46436 uint64_t  __attribute__((export_name("TS_WarningMessage_read"))) TS_WarningMessage_read(int8_tArray ser) {
46437         LDKu8slice ser_ref;
46438         ser_ref.datalen = ser->arr_len;
46439         ser_ref.data = ser->elems;
46440         LDKCResult_WarningMessageDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_WarningMessageDecodeErrorZ), "LDKCResult_WarningMessageDecodeErrorZ");
46441         *ret_conv = WarningMessage_read(ser_ref);
46442         FREE(ser);
46443         return tag_ptr(ret_conv, true);
46444 }
46445
46446 int8_tArray  __attribute__((export_name("TS_UnsignedNodeAnnouncement_write"))) TS_UnsignedNodeAnnouncement_write(uint64_t obj) {
46447         LDKUnsignedNodeAnnouncement obj_conv;
46448         obj_conv.inner = untag_ptr(obj);
46449         obj_conv.is_owned = ptr_is_owned(obj);
46450         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
46451         obj_conv.is_owned = false;
46452         LDKCVec_u8Z ret_var = UnsignedNodeAnnouncement_write(&obj_conv);
46453         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
46454         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
46455         CVec_u8Z_free(ret_var);
46456         return ret_arr;
46457 }
46458
46459 uint64_t  __attribute__((export_name("TS_UnsignedNodeAnnouncement_read"))) TS_UnsignedNodeAnnouncement_read(int8_tArray ser) {
46460         LDKu8slice ser_ref;
46461         ser_ref.datalen = ser->arr_len;
46462         ser_ref.data = ser->elems;
46463         LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ), "LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ");
46464         *ret_conv = UnsignedNodeAnnouncement_read(ser_ref);
46465         FREE(ser);
46466         return tag_ptr(ret_conv, true);
46467 }
46468
46469 int8_tArray  __attribute__((export_name("TS_NodeAnnouncement_write"))) TS_NodeAnnouncement_write(uint64_t obj) {
46470         LDKNodeAnnouncement obj_conv;
46471         obj_conv.inner = untag_ptr(obj);
46472         obj_conv.is_owned = ptr_is_owned(obj);
46473         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
46474         obj_conv.is_owned = false;
46475         LDKCVec_u8Z ret_var = NodeAnnouncement_write(&obj_conv);
46476         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
46477         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
46478         CVec_u8Z_free(ret_var);
46479         return ret_arr;
46480 }
46481
46482 uint64_t  __attribute__((export_name("TS_NodeAnnouncement_read"))) TS_NodeAnnouncement_read(int8_tArray ser) {
46483         LDKu8slice ser_ref;
46484         ser_ref.datalen = ser->arr_len;
46485         ser_ref.data = ser->elems;
46486         LDKCResult_NodeAnnouncementDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NodeAnnouncementDecodeErrorZ), "LDKCResult_NodeAnnouncementDecodeErrorZ");
46487         *ret_conv = NodeAnnouncement_read(ser_ref);
46488         FREE(ser);
46489         return tag_ptr(ret_conv, true);
46490 }
46491
46492 uint64_t  __attribute__((export_name("TS_QueryShortChannelIds_read"))) TS_QueryShortChannelIds_read(int8_tArray ser) {
46493         LDKu8slice ser_ref;
46494         ser_ref.datalen = ser->arr_len;
46495         ser_ref.data = ser->elems;
46496         LDKCResult_QueryShortChannelIdsDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_QueryShortChannelIdsDecodeErrorZ), "LDKCResult_QueryShortChannelIdsDecodeErrorZ");
46497         *ret_conv = QueryShortChannelIds_read(ser_ref);
46498         FREE(ser);
46499         return tag_ptr(ret_conv, true);
46500 }
46501
46502 int8_tArray  __attribute__((export_name("TS_QueryShortChannelIds_write"))) TS_QueryShortChannelIds_write(uint64_t obj) {
46503         LDKQueryShortChannelIds obj_conv;
46504         obj_conv.inner = untag_ptr(obj);
46505         obj_conv.is_owned = ptr_is_owned(obj);
46506         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
46507         obj_conv.is_owned = false;
46508         LDKCVec_u8Z ret_var = QueryShortChannelIds_write(&obj_conv);
46509         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
46510         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
46511         CVec_u8Z_free(ret_var);
46512         return ret_arr;
46513 }
46514
46515 int8_tArray  __attribute__((export_name("TS_ReplyShortChannelIdsEnd_write"))) TS_ReplyShortChannelIdsEnd_write(uint64_t obj) {
46516         LDKReplyShortChannelIdsEnd obj_conv;
46517         obj_conv.inner = untag_ptr(obj);
46518         obj_conv.is_owned = ptr_is_owned(obj);
46519         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
46520         obj_conv.is_owned = false;
46521         LDKCVec_u8Z ret_var = ReplyShortChannelIdsEnd_write(&obj_conv);
46522         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
46523         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
46524         CVec_u8Z_free(ret_var);
46525         return ret_arr;
46526 }
46527
46528 uint64_t  __attribute__((export_name("TS_ReplyShortChannelIdsEnd_read"))) TS_ReplyShortChannelIdsEnd_read(int8_tArray ser) {
46529         LDKu8slice ser_ref;
46530         ser_ref.datalen = ser->arr_len;
46531         ser_ref.data = ser->elems;
46532         LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ), "LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ");
46533         *ret_conv = ReplyShortChannelIdsEnd_read(ser_ref);
46534         FREE(ser);
46535         return tag_ptr(ret_conv, true);
46536 }
46537
46538 int32_t  __attribute__((export_name("TS_QueryChannelRange_end_blocknum"))) TS_QueryChannelRange_end_blocknum(uint64_t this_arg) {
46539         LDKQueryChannelRange this_arg_conv;
46540         this_arg_conv.inner = untag_ptr(this_arg);
46541         this_arg_conv.is_owned = ptr_is_owned(this_arg);
46542         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
46543         this_arg_conv.is_owned = false;
46544         int32_t ret_conv = QueryChannelRange_end_blocknum(&this_arg_conv);
46545         return ret_conv;
46546 }
46547
46548 int8_tArray  __attribute__((export_name("TS_QueryChannelRange_write"))) TS_QueryChannelRange_write(uint64_t obj) {
46549         LDKQueryChannelRange obj_conv;
46550         obj_conv.inner = untag_ptr(obj);
46551         obj_conv.is_owned = ptr_is_owned(obj);
46552         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
46553         obj_conv.is_owned = false;
46554         LDKCVec_u8Z ret_var = QueryChannelRange_write(&obj_conv);
46555         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
46556         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
46557         CVec_u8Z_free(ret_var);
46558         return ret_arr;
46559 }
46560
46561 uint64_t  __attribute__((export_name("TS_QueryChannelRange_read"))) TS_QueryChannelRange_read(int8_tArray ser) {
46562         LDKu8slice ser_ref;
46563         ser_ref.datalen = ser->arr_len;
46564         ser_ref.data = ser->elems;
46565         LDKCResult_QueryChannelRangeDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_QueryChannelRangeDecodeErrorZ), "LDKCResult_QueryChannelRangeDecodeErrorZ");
46566         *ret_conv = QueryChannelRange_read(ser_ref);
46567         FREE(ser);
46568         return tag_ptr(ret_conv, true);
46569 }
46570
46571 uint64_t  __attribute__((export_name("TS_ReplyChannelRange_read"))) TS_ReplyChannelRange_read(int8_tArray ser) {
46572         LDKu8slice ser_ref;
46573         ser_ref.datalen = ser->arr_len;
46574         ser_ref.data = ser->elems;
46575         LDKCResult_ReplyChannelRangeDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ReplyChannelRangeDecodeErrorZ), "LDKCResult_ReplyChannelRangeDecodeErrorZ");
46576         *ret_conv = ReplyChannelRange_read(ser_ref);
46577         FREE(ser);
46578         return tag_ptr(ret_conv, true);
46579 }
46580
46581 int8_tArray  __attribute__((export_name("TS_ReplyChannelRange_write"))) TS_ReplyChannelRange_write(uint64_t obj) {
46582         LDKReplyChannelRange obj_conv;
46583         obj_conv.inner = untag_ptr(obj);
46584         obj_conv.is_owned = ptr_is_owned(obj);
46585         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
46586         obj_conv.is_owned = false;
46587         LDKCVec_u8Z ret_var = ReplyChannelRange_write(&obj_conv);
46588         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
46589         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
46590         CVec_u8Z_free(ret_var);
46591         return ret_arr;
46592 }
46593
46594 int8_tArray  __attribute__((export_name("TS_GossipTimestampFilter_write"))) TS_GossipTimestampFilter_write(uint64_t obj) {
46595         LDKGossipTimestampFilter obj_conv;
46596         obj_conv.inner = untag_ptr(obj);
46597         obj_conv.is_owned = ptr_is_owned(obj);
46598         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
46599         obj_conv.is_owned = false;
46600         LDKCVec_u8Z ret_var = GossipTimestampFilter_write(&obj_conv);
46601         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
46602         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
46603         CVec_u8Z_free(ret_var);
46604         return ret_arr;
46605 }
46606
46607 uint64_t  __attribute__((export_name("TS_GossipTimestampFilter_read"))) TS_GossipTimestampFilter_read(int8_tArray ser) {
46608         LDKu8slice ser_ref;
46609         ser_ref.datalen = ser->arr_len;
46610         ser_ref.data = ser->elems;
46611         LDKCResult_GossipTimestampFilterDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_GossipTimestampFilterDecodeErrorZ), "LDKCResult_GossipTimestampFilterDecodeErrorZ");
46612         *ret_conv = GossipTimestampFilter_read(ser_ref);
46613         FREE(ser);
46614         return tag_ptr(ret_conv, true);
46615 }
46616
46617 void  __attribute__((export_name("TS_CustomMessageHandler_free"))) TS_CustomMessageHandler_free(uint64_t this_ptr) {
46618         if (!ptr_is_owned(this_ptr)) return;
46619         void* this_ptr_ptr = untag_ptr(this_ptr);
46620         CHECK_ACCESS(this_ptr_ptr);
46621         LDKCustomMessageHandler this_ptr_conv = *(LDKCustomMessageHandler*)(this_ptr_ptr);
46622         FREE(untag_ptr(this_ptr));
46623         CustomMessageHandler_free(this_ptr_conv);
46624 }
46625
46626 void  __attribute__((export_name("TS_IgnoringMessageHandler_free"))) TS_IgnoringMessageHandler_free(uint64_t this_obj) {
46627         LDKIgnoringMessageHandler this_obj_conv;
46628         this_obj_conv.inner = untag_ptr(this_obj);
46629         this_obj_conv.is_owned = ptr_is_owned(this_obj);
46630         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
46631         IgnoringMessageHandler_free(this_obj_conv);
46632 }
46633
46634 uint64_t  __attribute__((export_name("TS_IgnoringMessageHandler_new"))) TS_IgnoringMessageHandler_new() {
46635         LDKIgnoringMessageHandler ret_var = IgnoringMessageHandler_new();
46636         uint64_t ret_ref = 0;
46637         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
46638         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
46639         return ret_ref;
46640 }
46641
46642 uint64_t  __attribute__((export_name("TS_IgnoringMessageHandler_as_MessageSendEventsProvider"))) TS_IgnoringMessageHandler_as_MessageSendEventsProvider(uint64_t this_arg) {
46643         LDKIgnoringMessageHandler this_arg_conv;
46644         this_arg_conv.inner = untag_ptr(this_arg);
46645         this_arg_conv.is_owned = ptr_is_owned(this_arg);
46646         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
46647         this_arg_conv.is_owned = false;
46648         LDKMessageSendEventsProvider* ret_ret = MALLOC(sizeof(LDKMessageSendEventsProvider), "LDKMessageSendEventsProvider");
46649         *ret_ret = IgnoringMessageHandler_as_MessageSendEventsProvider(&this_arg_conv);
46650         return tag_ptr(ret_ret, true);
46651 }
46652
46653 uint64_t  __attribute__((export_name("TS_IgnoringMessageHandler_as_RoutingMessageHandler"))) TS_IgnoringMessageHandler_as_RoutingMessageHandler(uint64_t this_arg) {
46654         LDKIgnoringMessageHandler this_arg_conv;
46655         this_arg_conv.inner = untag_ptr(this_arg);
46656         this_arg_conv.is_owned = ptr_is_owned(this_arg);
46657         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
46658         this_arg_conv.is_owned = false;
46659         LDKRoutingMessageHandler* ret_ret = MALLOC(sizeof(LDKRoutingMessageHandler), "LDKRoutingMessageHandler");
46660         *ret_ret = IgnoringMessageHandler_as_RoutingMessageHandler(&this_arg_conv);
46661         return tag_ptr(ret_ret, true);
46662 }
46663
46664 uint64_t  __attribute__((export_name("TS_IgnoringMessageHandler_as_OnionMessageHandler"))) TS_IgnoringMessageHandler_as_OnionMessageHandler(uint64_t this_arg) {
46665         LDKIgnoringMessageHandler this_arg_conv;
46666         this_arg_conv.inner = untag_ptr(this_arg);
46667         this_arg_conv.is_owned = ptr_is_owned(this_arg);
46668         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
46669         this_arg_conv.is_owned = false;
46670         LDKOnionMessageHandler* ret_ret = MALLOC(sizeof(LDKOnionMessageHandler), "LDKOnionMessageHandler");
46671         *ret_ret = IgnoringMessageHandler_as_OnionMessageHandler(&this_arg_conv);
46672         return tag_ptr(ret_ret, true);
46673 }
46674
46675 uint64_t  __attribute__((export_name("TS_IgnoringMessageHandler_as_OffersMessageHandler"))) TS_IgnoringMessageHandler_as_OffersMessageHandler(uint64_t this_arg) {
46676         LDKIgnoringMessageHandler this_arg_conv;
46677         this_arg_conv.inner = untag_ptr(this_arg);
46678         this_arg_conv.is_owned = ptr_is_owned(this_arg);
46679         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
46680         this_arg_conv.is_owned = false;
46681         LDKOffersMessageHandler* ret_ret = MALLOC(sizeof(LDKOffersMessageHandler), "LDKOffersMessageHandler");
46682         *ret_ret = IgnoringMessageHandler_as_OffersMessageHandler(&this_arg_conv);
46683         return tag_ptr(ret_ret, true);
46684 }
46685
46686 uint64_t  __attribute__((export_name("TS_IgnoringMessageHandler_as_CustomOnionMessageHandler"))) TS_IgnoringMessageHandler_as_CustomOnionMessageHandler(uint64_t this_arg) {
46687         LDKIgnoringMessageHandler this_arg_conv;
46688         this_arg_conv.inner = untag_ptr(this_arg);
46689         this_arg_conv.is_owned = ptr_is_owned(this_arg);
46690         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
46691         this_arg_conv.is_owned = false;
46692         LDKCustomOnionMessageHandler* ret_ret = MALLOC(sizeof(LDKCustomOnionMessageHandler), "LDKCustomOnionMessageHandler");
46693         *ret_ret = IgnoringMessageHandler_as_CustomOnionMessageHandler(&this_arg_conv);
46694         return tag_ptr(ret_ret, true);
46695 }
46696
46697 uint64_t  __attribute__((export_name("TS_IgnoringMessageHandler_as_CustomMessageReader"))) TS_IgnoringMessageHandler_as_CustomMessageReader(uint64_t this_arg) {
46698         LDKIgnoringMessageHandler this_arg_conv;
46699         this_arg_conv.inner = untag_ptr(this_arg);
46700         this_arg_conv.is_owned = ptr_is_owned(this_arg);
46701         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
46702         this_arg_conv.is_owned = false;
46703         LDKCustomMessageReader* ret_ret = MALLOC(sizeof(LDKCustomMessageReader), "LDKCustomMessageReader");
46704         *ret_ret = IgnoringMessageHandler_as_CustomMessageReader(&this_arg_conv);
46705         return tag_ptr(ret_ret, true);
46706 }
46707
46708 uint64_t  __attribute__((export_name("TS_IgnoringMessageHandler_as_CustomMessageHandler"))) TS_IgnoringMessageHandler_as_CustomMessageHandler(uint64_t this_arg) {
46709         LDKIgnoringMessageHandler this_arg_conv;
46710         this_arg_conv.inner = untag_ptr(this_arg);
46711         this_arg_conv.is_owned = ptr_is_owned(this_arg);
46712         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
46713         this_arg_conv.is_owned = false;
46714         LDKCustomMessageHandler* ret_ret = MALLOC(sizeof(LDKCustomMessageHandler), "LDKCustomMessageHandler");
46715         *ret_ret = IgnoringMessageHandler_as_CustomMessageHandler(&this_arg_conv);
46716         return tag_ptr(ret_ret, true);
46717 }
46718
46719 void  __attribute__((export_name("TS_ErroringMessageHandler_free"))) TS_ErroringMessageHandler_free(uint64_t this_obj) {
46720         LDKErroringMessageHandler this_obj_conv;
46721         this_obj_conv.inner = untag_ptr(this_obj);
46722         this_obj_conv.is_owned = ptr_is_owned(this_obj);
46723         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
46724         ErroringMessageHandler_free(this_obj_conv);
46725 }
46726
46727 uint64_t  __attribute__((export_name("TS_ErroringMessageHandler_new"))) TS_ErroringMessageHandler_new() {
46728         LDKErroringMessageHandler ret_var = ErroringMessageHandler_new();
46729         uint64_t ret_ref = 0;
46730         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
46731         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
46732         return ret_ref;
46733 }
46734
46735 uint64_t  __attribute__((export_name("TS_ErroringMessageHandler_as_MessageSendEventsProvider"))) TS_ErroringMessageHandler_as_MessageSendEventsProvider(uint64_t this_arg) {
46736         LDKErroringMessageHandler this_arg_conv;
46737         this_arg_conv.inner = untag_ptr(this_arg);
46738         this_arg_conv.is_owned = ptr_is_owned(this_arg);
46739         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
46740         this_arg_conv.is_owned = false;
46741         LDKMessageSendEventsProvider* ret_ret = MALLOC(sizeof(LDKMessageSendEventsProvider), "LDKMessageSendEventsProvider");
46742         *ret_ret = ErroringMessageHandler_as_MessageSendEventsProvider(&this_arg_conv);
46743         return tag_ptr(ret_ret, true);
46744 }
46745
46746 uint64_t  __attribute__((export_name("TS_ErroringMessageHandler_as_ChannelMessageHandler"))) TS_ErroringMessageHandler_as_ChannelMessageHandler(uint64_t this_arg) {
46747         LDKErroringMessageHandler this_arg_conv;
46748         this_arg_conv.inner = untag_ptr(this_arg);
46749         this_arg_conv.is_owned = ptr_is_owned(this_arg);
46750         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
46751         this_arg_conv.is_owned = false;
46752         LDKChannelMessageHandler* ret_ret = MALLOC(sizeof(LDKChannelMessageHandler), "LDKChannelMessageHandler");
46753         *ret_ret = ErroringMessageHandler_as_ChannelMessageHandler(&this_arg_conv);
46754         return tag_ptr(ret_ret, true);
46755 }
46756
46757 void  __attribute__((export_name("TS_MessageHandler_free"))) TS_MessageHandler_free(uint64_t this_obj) {
46758         LDKMessageHandler this_obj_conv;
46759         this_obj_conv.inner = untag_ptr(this_obj);
46760         this_obj_conv.is_owned = ptr_is_owned(this_obj);
46761         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
46762         MessageHandler_free(this_obj_conv);
46763 }
46764
46765 uint64_t  __attribute__((export_name("TS_MessageHandler_get_chan_handler"))) TS_MessageHandler_get_chan_handler(uint64_t this_ptr) {
46766         LDKMessageHandler this_ptr_conv;
46767         this_ptr_conv.inner = untag_ptr(this_ptr);
46768         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
46769         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
46770         this_ptr_conv.is_owned = false;
46771         // WARNING: This object doesn't live past this scope, needs clone!
46772         uint64_t ret_ret = tag_ptr(MessageHandler_get_chan_handler(&this_ptr_conv), false);
46773         return ret_ret;
46774 }
46775
46776 void  __attribute__((export_name("TS_MessageHandler_set_chan_handler"))) TS_MessageHandler_set_chan_handler(uint64_t this_ptr, uint64_t val) {
46777         LDKMessageHandler this_ptr_conv;
46778         this_ptr_conv.inner = untag_ptr(this_ptr);
46779         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
46780         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
46781         this_ptr_conv.is_owned = false;
46782         void* val_ptr = untag_ptr(val);
46783         CHECK_ACCESS(val_ptr);
46784         LDKChannelMessageHandler val_conv = *(LDKChannelMessageHandler*)(val_ptr);
46785         if (val_conv.free == LDKChannelMessageHandler_JCalls_free) {
46786                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
46787                 LDKChannelMessageHandler_JCalls_cloned(&val_conv);
46788         }
46789         MessageHandler_set_chan_handler(&this_ptr_conv, val_conv);
46790 }
46791
46792 uint64_t  __attribute__((export_name("TS_MessageHandler_get_route_handler"))) TS_MessageHandler_get_route_handler(uint64_t this_ptr) {
46793         LDKMessageHandler this_ptr_conv;
46794         this_ptr_conv.inner = untag_ptr(this_ptr);
46795         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
46796         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
46797         this_ptr_conv.is_owned = false;
46798         // WARNING: This object doesn't live past this scope, needs clone!
46799         uint64_t ret_ret = tag_ptr(MessageHandler_get_route_handler(&this_ptr_conv), false);
46800         return ret_ret;
46801 }
46802
46803 void  __attribute__((export_name("TS_MessageHandler_set_route_handler"))) TS_MessageHandler_set_route_handler(uint64_t this_ptr, uint64_t val) {
46804         LDKMessageHandler this_ptr_conv;
46805         this_ptr_conv.inner = untag_ptr(this_ptr);
46806         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
46807         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
46808         this_ptr_conv.is_owned = false;
46809         void* val_ptr = untag_ptr(val);
46810         CHECK_ACCESS(val_ptr);
46811         LDKRoutingMessageHandler val_conv = *(LDKRoutingMessageHandler*)(val_ptr);
46812         if (val_conv.free == LDKRoutingMessageHandler_JCalls_free) {
46813                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
46814                 LDKRoutingMessageHandler_JCalls_cloned(&val_conv);
46815         }
46816         MessageHandler_set_route_handler(&this_ptr_conv, val_conv);
46817 }
46818
46819 uint64_t  __attribute__((export_name("TS_MessageHandler_get_onion_message_handler"))) TS_MessageHandler_get_onion_message_handler(uint64_t this_ptr) {
46820         LDKMessageHandler this_ptr_conv;
46821         this_ptr_conv.inner = untag_ptr(this_ptr);
46822         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
46823         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
46824         this_ptr_conv.is_owned = false;
46825         // WARNING: This object doesn't live past this scope, needs clone!
46826         uint64_t ret_ret = tag_ptr(MessageHandler_get_onion_message_handler(&this_ptr_conv), false);
46827         return ret_ret;
46828 }
46829
46830 void  __attribute__((export_name("TS_MessageHandler_set_onion_message_handler"))) TS_MessageHandler_set_onion_message_handler(uint64_t this_ptr, uint64_t val) {
46831         LDKMessageHandler this_ptr_conv;
46832         this_ptr_conv.inner = untag_ptr(this_ptr);
46833         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
46834         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
46835         this_ptr_conv.is_owned = false;
46836         void* val_ptr = untag_ptr(val);
46837         CHECK_ACCESS(val_ptr);
46838         LDKOnionMessageHandler val_conv = *(LDKOnionMessageHandler*)(val_ptr);
46839         if (val_conv.free == LDKOnionMessageHandler_JCalls_free) {
46840                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
46841                 LDKOnionMessageHandler_JCalls_cloned(&val_conv);
46842         }
46843         MessageHandler_set_onion_message_handler(&this_ptr_conv, val_conv);
46844 }
46845
46846 uint64_t  __attribute__((export_name("TS_MessageHandler_get_custom_message_handler"))) TS_MessageHandler_get_custom_message_handler(uint64_t this_ptr) {
46847         LDKMessageHandler this_ptr_conv;
46848         this_ptr_conv.inner = untag_ptr(this_ptr);
46849         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
46850         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
46851         this_ptr_conv.is_owned = false;
46852         // WARNING: This object doesn't live past this scope, needs clone!
46853         uint64_t ret_ret = tag_ptr(MessageHandler_get_custom_message_handler(&this_ptr_conv), false);
46854         return ret_ret;
46855 }
46856
46857 void  __attribute__((export_name("TS_MessageHandler_set_custom_message_handler"))) TS_MessageHandler_set_custom_message_handler(uint64_t this_ptr, uint64_t val) {
46858         LDKMessageHandler this_ptr_conv;
46859         this_ptr_conv.inner = untag_ptr(this_ptr);
46860         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
46861         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
46862         this_ptr_conv.is_owned = false;
46863         void* val_ptr = untag_ptr(val);
46864         CHECK_ACCESS(val_ptr);
46865         LDKCustomMessageHandler val_conv = *(LDKCustomMessageHandler*)(val_ptr);
46866         if (val_conv.free == LDKCustomMessageHandler_JCalls_free) {
46867                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
46868                 LDKCustomMessageHandler_JCalls_cloned(&val_conv);
46869         }
46870         MessageHandler_set_custom_message_handler(&this_ptr_conv, val_conv);
46871 }
46872
46873 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) {
46874         void* chan_handler_arg_ptr = untag_ptr(chan_handler_arg);
46875         CHECK_ACCESS(chan_handler_arg_ptr);
46876         LDKChannelMessageHandler chan_handler_arg_conv = *(LDKChannelMessageHandler*)(chan_handler_arg_ptr);
46877         if (chan_handler_arg_conv.free == LDKChannelMessageHandler_JCalls_free) {
46878                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
46879                 LDKChannelMessageHandler_JCalls_cloned(&chan_handler_arg_conv);
46880         }
46881         void* route_handler_arg_ptr = untag_ptr(route_handler_arg);
46882         CHECK_ACCESS(route_handler_arg_ptr);
46883         LDKRoutingMessageHandler route_handler_arg_conv = *(LDKRoutingMessageHandler*)(route_handler_arg_ptr);
46884         if (route_handler_arg_conv.free == LDKRoutingMessageHandler_JCalls_free) {
46885                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
46886                 LDKRoutingMessageHandler_JCalls_cloned(&route_handler_arg_conv);
46887         }
46888         void* onion_message_handler_arg_ptr = untag_ptr(onion_message_handler_arg);
46889         CHECK_ACCESS(onion_message_handler_arg_ptr);
46890         LDKOnionMessageHandler onion_message_handler_arg_conv = *(LDKOnionMessageHandler*)(onion_message_handler_arg_ptr);
46891         if (onion_message_handler_arg_conv.free == LDKOnionMessageHandler_JCalls_free) {
46892                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
46893                 LDKOnionMessageHandler_JCalls_cloned(&onion_message_handler_arg_conv);
46894         }
46895         void* custom_message_handler_arg_ptr = untag_ptr(custom_message_handler_arg);
46896         CHECK_ACCESS(custom_message_handler_arg_ptr);
46897         LDKCustomMessageHandler custom_message_handler_arg_conv = *(LDKCustomMessageHandler*)(custom_message_handler_arg_ptr);
46898         if (custom_message_handler_arg_conv.free == LDKCustomMessageHandler_JCalls_free) {
46899                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
46900                 LDKCustomMessageHandler_JCalls_cloned(&custom_message_handler_arg_conv);
46901         }
46902         LDKMessageHandler ret_var = MessageHandler_new(chan_handler_arg_conv, route_handler_arg_conv, onion_message_handler_arg_conv, custom_message_handler_arg_conv);
46903         uint64_t ret_ref = 0;
46904         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
46905         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
46906         return ret_ref;
46907 }
46908
46909 static inline uint64_t SocketDescriptor_clone_ptr(LDKSocketDescriptor *NONNULL_PTR arg) {
46910         LDKSocketDescriptor* ret_ret = MALLOC(sizeof(LDKSocketDescriptor), "LDKSocketDescriptor");
46911         *ret_ret = SocketDescriptor_clone(arg);
46912         return tag_ptr(ret_ret, true);
46913 }
46914 int64_t  __attribute__((export_name("TS_SocketDescriptor_clone_ptr"))) TS_SocketDescriptor_clone_ptr(uint64_t arg) {
46915         void* arg_ptr = untag_ptr(arg);
46916         if (ptr_is_owned(arg)) { CHECK_ACCESS(arg_ptr); }
46917         LDKSocketDescriptor* arg_conv = (LDKSocketDescriptor*)arg_ptr;
46918         int64_t ret_conv = SocketDescriptor_clone_ptr(arg_conv);
46919         return ret_conv;
46920 }
46921
46922 uint64_t  __attribute__((export_name("TS_SocketDescriptor_clone"))) TS_SocketDescriptor_clone(uint64_t orig) {
46923         void* orig_ptr = untag_ptr(orig);
46924         if (ptr_is_owned(orig)) { CHECK_ACCESS(orig_ptr); }
46925         LDKSocketDescriptor* orig_conv = (LDKSocketDescriptor*)orig_ptr;
46926         LDKSocketDescriptor* ret_ret = MALLOC(sizeof(LDKSocketDescriptor), "LDKSocketDescriptor");
46927         *ret_ret = SocketDescriptor_clone(orig_conv);
46928         return tag_ptr(ret_ret, true);
46929 }
46930
46931 void  __attribute__((export_name("TS_SocketDescriptor_free"))) TS_SocketDescriptor_free(uint64_t this_ptr) {
46932         if (!ptr_is_owned(this_ptr)) return;
46933         void* this_ptr_ptr = untag_ptr(this_ptr);
46934         CHECK_ACCESS(this_ptr_ptr);
46935         LDKSocketDescriptor this_ptr_conv = *(LDKSocketDescriptor*)(this_ptr_ptr);
46936         FREE(untag_ptr(this_ptr));
46937         SocketDescriptor_free(this_ptr_conv);
46938 }
46939
46940 void  __attribute__((export_name("TS_PeerHandleError_free"))) TS_PeerHandleError_free(uint64_t this_obj) {
46941         LDKPeerHandleError this_obj_conv;
46942         this_obj_conv.inner = untag_ptr(this_obj);
46943         this_obj_conv.is_owned = ptr_is_owned(this_obj);
46944         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
46945         PeerHandleError_free(this_obj_conv);
46946 }
46947
46948 uint64_t  __attribute__((export_name("TS_PeerHandleError_new"))) TS_PeerHandleError_new() {
46949         LDKPeerHandleError ret_var = PeerHandleError_new();
46950         uint64_t ret_ref = 0;
46951         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
46952         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
46953         return ret_ref;
46954 }
46955
46956 static inline uint64_t PeerHandleError_clone_ptr(LDKPeerHandleError *NONNULL_PTR arg) {
46957         LDKPeerHandleError ret_var = PeerHandleError_clone(arg);
46958         uint64_t ret_ref = 0;
46959         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
46960         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
46961         return ret_ref;
46962 }
46963 int64_t  __attribute__((export_name("TS_PeerHandleError_clone_ptr"))) TS_PeerHandleError_clone_ptr(uint64_t arg) {
46964         LDKPeerHandleError arg_conv;
46965         arg_conv.inner = untag_ptr(arg);
46966         arg_conv.is_owned = ptr_is_owned(arg);
46967         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
46968         arg_conv.is_owned = false;
46969         int64_t ret_conv = PeerHandleError_clone_ptr(&arg_conv);
46970         return ret_conv;
46971 }
46972
46973 uint64_t  __attribute__((export_name("TS_PeerHandleError_clone"))) TS_PeerHandleError_clone(uint64_t orig) {
46974         LDKPeerHandleError orig_conv;
46975         orig_conv.inner = untag_ptr(orig);
46976         orig_conv.is_owned = ptr_is_owned(orig);
46977         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
46978         orig_conv.is_owned = false;
46979         LDKPeerHandleError ret_var = PeerHandleError_clone(&orig_conv);
46980         uint64_t ret_ref = 0;
46981         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
46982         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
46983         return ret_ref;
46984 }
46985
46986 void  __attribute__((export_name("TS_PeerManager_free"))) TS_PeerManager_free(uint64_t this_obj) {
46987         LDKPeerManager this_obj_conv;
46988         this_obj_conv.inner = untag_ptr(this_obj);
46989         this_obj_conv.is_owned = ptr_is_owned(this_obj);
46990         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
46991         PeerManager_free(this_obj_conv);
46992 }
46993
46994 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) {
46995         LDKMessageHandler message_handler_conv;
46996         message_handler_conv.inner = untag_ptr(message_handler);
46997         message_handler_conv.is_owned = ptr_is_owned(message_handler);
46998         CHECK_INNER_FIELD_ACCESS_OR_NULL(message_handler_conv);
46999         // WARNING: we need a move here but no clone is available for LDKMessageHandler
47000         
47001         uint8_t ephemeral_random_data_arr[32];
47002         CHECK(ephemeral_random_data->arr_len == 32);
47003         memcpy(ephemeral_random_data_arr, ephemeral_random_data->elems, 32); FREE(ephemeral_random_data);
47004         uint8_t (*ephemeral_random_data_ref)[32] = &ephemeral_random_data_arr;
47005         void* logger_ptr = untag_ptr(logger);
47006         CHECK_ACCESS(logger_ptr);
47007         LDKLogger logger_conv = *(LDKLogger*)(logger_ptr);
47008         if (logger_conv.free == LDKLogger_JCalls_free) {
47009                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
47010                 LDKLogger_JCalls_cloned(&logger_conv);
47011         }
47012         void* node_signer_ptr = untag_ptr(node_signer);
47013         CHECK_ACCESS(node_signer_ptr);
47014         LDKNodeSigner node_signer_conv = *(LDKNodeSigner*)(node_signer_ptr);
47015         if (node_signer_conv.free == LDKNodeSigner_JCalls_free) {
47016                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
47017                 LDKNodeSigner_JCalls_cloned(&node_signer_conv);
47018         }
47019         LDKPeerManager ret_var = PeerManager_new(message_handler_conv, current_time, ephemeral_random_data_ref, logger_conv, node_signer_conv);
47020         uint64_t ret_ref = 0;
47021         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
47022         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
47023         return ret_ref;
47024 }
47025
47026 uint64_tArray  __attribute__((export_name("TS_PeerManager_get_peer_node_ids"))) TS_PeerManager_get_peer_node_ids(uint64_t this_arg) {
47027         LDKPeerManager this_arg_conv;
47028         this_arg_conv.inner = untag_ptr(this_arg);
47029         this_arg_conv.is_owned = ptr_is_owned(this_arg);
47030         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
47031         this_arg_conv.is_owned = false;
47032         LDKCVec_C2Tuple_PublicKeyCOption_SocketAddressZZZ ret_var = PeerManager_get_peer_node_ids(&this_arg_conv);
47033         uint64_tArray ret_arr = NULL;
47034         ret_arr = init_uint64_tArray(ret_var.datalen, __LINE__);
47035         uint64_t *ret_arr_ptr = (uint64_t*)(((uint8_t*)ret_arr) + 8);
47036         for (size_t r = 0; r < ret_var.datalen; r++) {
47037                 LDKC2Tuple_PublicKeyCOption_SocketAddressZZ* ret_conv_43_conv = MALLOC(sizeof(LDKC2Tuple_PublicKeyCOption_SocketAddressZZ), "LDKC2Tuple_PublicKeyCOption_SocketAddressZZ");
47038                 *ret_conv_43_conv = ret_var.data[r];
47039                 ret_arr_ptr[r] = tag_ptr(ret_conv_43_conv, true);
47040         }
47041         
47042         FREE(ret_var.data);
47043         return ret_arr;
47044 }
47045
47046 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) {
47047         LDKPeerManager this_arg_conv;
47048         this_arg_conv.inner = untag_ptr(this_arg);
47049         this_arg_conv.is_owned = ptr_is_owned(this_arg);
47050         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
47051         this_arg_conv.is_owned = false;
47052         LDKPublicKey their_node_id_ref;
47053         CHECK(their_node_id->arr_len == 33);
47054         memcpy(their_node_id_ref.compressed_form, their_node_id->elems, 33); FREE(their_node_id);
47055         void* descriptor_ptr = untag_ptr(descriptor);
47056         CHECK_ACCESS(descriptor_ptr);
47057         LDKSocketDescriptor descriptor_conv = *(LDKSocketDescriptor*)(descriptor_ptr);
47058         if (descriptor_conv.free == LDKSocketDescriptor_JCalls_free) {
47059                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
47060                 LDKSocketDescriptor_JCalls_cloned(&descriptor_conv);
47061         }
47062         void* remote_network_address_ptr = untag_ptr(remote_network_address);
47063         CHECK_ACCESS(remote_network_address_ptr);
47064         LDKCOption_SocketAddressZ remote_network_address_conv = *(LDKCOption_SocketAddressZ*)(remote_network_address_ptr);
47065         LDKCResult_CVec_u8ZPeerHandleErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_u8ZPeerHandleErrorZ), "LDKCResult_CVec_u8ZPeerHandleErrorZ");
47066         *ret_conv = PeerManager_new_outbound_connection(&this_arg_conv, their_node_id_ref, descriptor_conv, remote_network_address_conv);
47067         return tag_ptr(ret_conv, true);
47068 }
47069
47070 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) {
47071         LDKPeerManager this_arg_conv;
47072         this_arg_conv.inner = untag_ptr(this_arg);
47073         this_arg_conv.is_owned = ptr_is_owned(this_arg);
47074         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
47075         this_arg_conv.is_owned = false;
47076         void* descriptor_ptr = untag_ptr(descriptor);
47077         CHECK_ACCESS(descriptor_ptr);
47078         LDKSocketDescriptor descriptor_conv = *(LDKSocketDescriptor*)(descriptor_ptr);
47079         if (descriptor_conv.free == LDKSocketDescriptor_JCalls_free) {
47080                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
47081                 LDKSocketDescriptor_JCalls_cloned(&descriptor_conv);
47082         }
47083         void* remote_network_address_ptr = untag_ptr(remote_network_address);
47084         CHECK_ACCESS(remote_network_address_ptr);
47085         LDKCOption_SocketAddressZ remote_network_address_conv = *(LDKCOption_SocketAddressZ*)(remote_network_address_ptr);
47086         LDKCResult_NonePeerHandleErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NonePeerHandleErrorZ), "LDKCResult_NonePeerHandleErrorZ");
47087         *ret_conv = PeerManager_new_inbound_connection(&this_arg_conv, descriptor_conv, remote_network_address_conv);
47088         return tag_ptr(ret_conv, true);
47089 }
47090
47091 uint64_t  __attribute__((export_name("TS_PeerManager_write_buffer_space_avail"))) TS_PeerManager_write_buffer_space_avail(uint64_t this_arg, uint64_t descriptor) {
47092         LDKPeerManager this_arg_conv;
47093         this_arg_conv.inner = untag_ptr(this_arg);
47094         this_arg_conv.is_owned = ptr_is_owned(this_arg);
47095         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
47096         this_arg_conv.is_owned = false;
47097         void* descriptor_ptr = untag_ptr(descriptor);
47098         if (ptr_is_owned(descriptor)) { CHECK_ACCESS(descriptor_ptr); }
47099         LDKSocketDescriptor* descriptor_conv = (LDKSocketDescriptor*)descriptor_ptr;
47100         LDKCResult_NonePeerHandleErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NonePeerHandleErrorZ), "LDKCResult_NonePeerHandleErrorZ");
47101         *ret_conv = PeerManager_write_buffer_space_avail(&this_arg_conv, descriptor_conv);
47102         return tag_ptr(ret_conv, true);
47103 }
47104
47105 uint64_t  __attribute__((export_name("TS_PeerManager_read_event"))) TS_PeerManager_read_event(uint64_t this_arg, uint64_t peer_descriptor, int8_tArray data) {
47106         LDKPeerManager this_arg_conv;
47107         this_arg_conv.inner = untag_ptr(this_arg);
47108         this_arg_conv.is_owned = ptr_is_owned(this_arg);
47109         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
47110         this_arg_conv.is_owned = false;
47111         void* peer_descriptor_ptr = untag_ptr(peer_descriptor);
47112         if (ptr_is_owned(peer_descriptor)) { CHECK_ACCESS(peer_descriptor_ptr); }
47113         LDKSocketDescriptor* peer_descriptor_conv = (LDKSocketDescriptor*)peer_descriptor_ptr;
47114         LDKu8slice data_ref;
47115         data_ref.datalen = data->arr_len;
47116         data_ref.data = data->elems;
47117         LDKCResult_boolPeerHandleErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_boolPeerHandleErrorZ), "LDKCResult_boolPeerHandleErrorZ");
47118         *ret_conv = PeerManager_read_event(&this_arg_conv, peer_descriptor_conv, data_ref);
47119         FREE(data);
47120         return tag_ptr(ret_conv, true);
47121 }
47122
47123 void  __attribute__((export_name("TS_PeerManager_process_events"))) TS_PeerManager_process_events(uint64_t this_arg) {
47124         LDKPeerManager this_arg_conv;
47125         this_arg_conv.inner = untag_ptr(this_arg);
47126         this_arg_conv.is_owned = ptr_is_owned(this_arg);
47127         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
47128         this_arg_conv.is_owned = false;
47129         PeerManager_process_events(&this_arg_conv);
47130 }
47131
47132 void  __attribute__((export_name("TS_PeerManager_socket_disconnected"))) TS_PeerManager_socket_disconnected(uint64_t this_arg, uint64_t descriptor) {
47133         LDKPeerManager this_arg_conv;
47134         this_arg_conv.inner = untag_ptr(this_arg);
47135         this_arg_conv.is_owned = ptr_is_owned(this_arg);
47136         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
47137         this_arg_conv.is_owned = false;
47138         void* descriptor_ptr = untag_ptr(descriptor);
47139         if (ptr_is_owned(descriptor)) { CHECK_ACCESS(descriptor_ptr); }
47140         LDKSocketDescriptor* descriptor_conv = (LDKSocketDescriptor*)descriptor_ptr;
47141         PeerManager_socket_disconnected(&this_arg_conv, descriptor_conv);
47142 }
47143
47144 void  __attribute__((export_name("TS_PeerManager_disconnect_by_node_id"))) TS_PeerManager_disconnect_by_node_id(uint64_t this_arg, int8_tArray node_id) {
47145         LDKPeerManager this_arg_conv;
47146         this_arg_conv.inner = untag_ptr(this_arg);
47147         this_arg_conv.is_owned = ptr_is_owned(this_arg);
47148         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
47149         this_arg_conv.is_owned = false;
47150         LDKPublicKey node_id_ref;
47151         CHECK(node_id->arr_len == 33);
47152         memcpy(node_id_ref.compressed_form, node_id->elems, 33); FREE(node_id);
47153         PeerManager_disconnect_by_node_id(&this_arg_conv, node_id_ref);
47154 }
47155
47156 void  __attribute__((export_name("TS_PeerManager_disconnect_all_peers"))) TS_PeerManager_disconnect_all_peers(uint64_t this_arg) {
47157         LDKPeerManager this_arg_conv;
47158         this_arg_conv.inner = untag_ptr(this_arg);
47159         this_arg_conv.is_owned = ptr_is_owned(this_arg);
47160         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
47161         this_arg_conv.is_owned = false;
47162         PeerManager_disconnect_all_peers(&this_arg_conv);
47163 }
47164
47165 void  __attribute__((export_name("TS_PeerManager_timer_tick_occurred"))) TS_PeerManager_timer_tick_occurred(uint64_t this_arg) {
47166         LDKPeerManager this_arg_conv;
47167         this_arg_conv.inner = untag_ptr(this_arg);
47168         this_arg_conv.is_owned = ptr_is_owned(this_arg);
47169         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
47170         this_arg_conv.is_owned = false;
47171         PeerManager_timer_tick_occurred(&this_arg_conv);
47172 }
47173
47174 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) {
47175         LDKPeerManager this_arg_conv;
47176         this_arg_conv.inner = untag_ptr(this_arg);
47177         this_arg_conv.is_owned = ptr_is_owned(this_arg);
47178         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
47179         this_arg_conv.is_owned = false;
47180         LDKThreeBytes rgb_ref;
47181         CHECK(rgb->arr_len == 3);
47182         memcpy(rgb_ref.data, rgb->elems, 3); FREE(rgb);
47183         LDKThirtyTwoBytes alias_ref;
47184         CHECK(alias->arr_len == 32);
47185         memcpy(alias_ref.data, alias->elems, 32); FREE(alias);
47186         LDKCVec_SocketAddressZ addresses_constr;
47187         addresses_constr.datalen = addresses->arr_len;
47188         if (addresses_constr.datalen > 0)
47189                 addresses_constr.data = MALLOC(addresses_constr.datalen * sizeof(LDKSocketAddress), "LDKCVec_SocketAddressZ Elements");
47190         else
47191                 addresses_constr.data = NULL;
47192         uint64_t* addresses_vals = addresses->elems;
47193         for (size_t p = 0; p < addresses_constr.datalen; p++) {
47194                 uint64_t addresses_conv_15 = addresses_vals[p];
47195                 void* addresses_conv_15_ptr = untag_ptr(addresses_conv_15);
47196                 CHECK_ACCESS(addresses_conv_15_ptr);
47197                 LDKSocketAddress addresses_conv_15_conv = *(LDKSocketAddress*)(addresses_conv_15_ptr);
47198                 addresses_constr.data[p] = addresses_conv_15_conv;
47199         }
47200         FREE(addresses);
47201         PeerManager_broadcast_node_announcement(&this_arg_conv, rgb_ref, alias_ref, addresses_constr);
47202 }
47203
47204 int64_t  __attribute__((export_name("TS_htlc_success_tx_weight"))) TS_htlc_success_tx_weight(uint64_t channel_type_features) {
47205         LDKChannelTypeFeatures channel_type_features_conv;
47206         channel_type_features_conv.inner = untag_ptr(channel_type_features);
47207         channel_type_features_conv.is_owned = ptr_is_owned(channel_type_features);
47208         CHECK_INNER_FIELD_ACCESS_OR_NULL(channel_type_features_conv);
47209         channel_type_features_conv.is_owned = false;
47210         int64_t ret_conv = htlc_success_tx_weight(&channel_type_features_conv);
47211         return ret_conv;
47212 }
47213
47214 int64_t  __attribute__((export_name("TS_htlc_timeout_tx_weight"))) TS_htlc_timeout_tx_weight(uint64_t channel_type_features) {
47215         LDKChannelTypeFeatures channel_type_features_conv;
47216         channel_type_features_conv.inner = untag_ptr(channel_type_features);
47217         channel_type_features_conv.is_owned = ptr_is_owned(channel_type_features);
47218         CHECK_INNER_FIELD_ACCESS_OR_NULL(channel_type_features_conv);
47219         channel_type_features_conv.is_owned = false;
47220         int64_t ret_conv = htlc_timeout_tx_weight(&channel_type_features_conv);
47221         return ret_conv;
47222 }
47223
47224 uint32_t  __attribute__((export_name("TS_HTLCClaim_clone"))) TS_HTLCClaim_clone(uint64_t orig) {
47225         LDKHTLCClaim* orig_conv = (LDKHTLCClaim*)untag_ptr(orig);
47226         uint32_t ret_conv = LDKHTLCClaim_to_js(HTLCClaim_clone(orig_conv));
47227         return ret_conv;
47228 }
47229
47230 uint32_t  __attribute__((export_name("TS_HTLCClaim_offered_timeout"))) TS_HTLCClaim_offered_timeout() {
47231         uint32_t ret_conv = LDKHTLCClaim_to_js(HTLCClaim_offered_timeout());
47232         return ret_conv;
47233 }
47234
47235 uint32_t  __attribute__((export_name("TS_HTLCClaim_offered_preimage"))) TS_HTLCClaim_offered_preimage() {
47236         uint32_t ret_conv = LDKHTLCClaim_to_js(HTLCClaim_offered_preimage());
47237         return ret_conv;
47238 }
47239
47240 uint32_t  __attribute__((export_name("TS_HTLCClaim_accepted_timeout"))) TS_HTLCClaim_accepted_timeout() {
47241         uint32_t ret_conv = LDKHTLCClaim_to_js(HTLCClaim_accepted_timeout());
47242         return ret_conv;
47243 }
47244
47245 uint32_t  __attribute__((export_name("TS_HTLCClaim_accepted_preimage"))) TS_HTLCClaim_accepted_preimage() {
47246         uint32_t ret_conv = LDKHTLCClaim_to_js(HTLCClaim_accepted_preimage());
47247         return ret_conv;
47248 }
47249
47250 uint32_t  __attribute__((export_name("TS_HTLCClaim_revocation"))) TS_HTLCClaim_revocation() {
47251         uint32_t ret_conv = LDKHTLCClaim_to_js(HTLCClaim_revocation());
47252         return ret_conv;
47253 }
47254
47255 jboolean  __attribute__((export_name("TS_HTLCClaim_eq"))) TS_HTLCClaim_eq(uint64_t a, uint64_t b) {
47256         LDKHTLCClaim* a_conv = (LDKHTLCClaim*)untag_ptr(a);
47257         LDKHTLCClaim* b_conv = (LDKHTLCClaim*)untag_ptr(b);
47258         jboolean ret_conv = HTLCClaim_eq(a_conv, b_conv);
47259         return ret_conv;
47260 }
47261
47262 uint64_t  __attribute__((export_name("TS_HTLCClaim_from_witness"))) TS_HTLCClaim_from_witness(int8_tArray witness) {
47263         LDKWitness witness_ref;
47264         witness_ref.datalen = witness->arr_len;
47265         witness_ref.data = MALLOC(witness_ref.datalen, "LDKWitness Bytes");
47266         memcpy(witness_ref.data, witness->elems, witness_ref.datalen); FREE(witness);
47267         witness_ref.data_is_owned = true;
47268         LDKCOption_HTLCClaimZ *ret_copy = MALLOC(sizeof(LDKCOption_HTLCClaimZ), "LDKCOption_HTLCClaimZ");
47269         *ret_copy = HTLCClaim_from_witness(witness_ref);
47270         uint64_t ret_ref = tag_ptr(ret_copy, true);
47271         return ret_ref;
47272 }
47273
47274 int8_tArray  __attribute__((export_name("TS_build_commitment_secret"))) TS_build_commitment_secret(int8_tArray commitment_seed, int64_t idx) {
47275         uint8_t commitment_seed_arr[32];
47276         CHECK(commitment_seed->arr_len == 32);
47277         memcpy(commitment_seed_arr, commitment_seed->elems, 32); FREE(commitment_seed);
47278         uint8_t (*commitment_seed_ref)[32] = &commitment_seed_arr;
47279         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
47280         memcpy(ret_arr->elems, build_commitment_secret(commitment_seed_ref, idx).data, 32);
47281         return ret_arr;
47282 }
47283
47284 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) {
47285         LDKCVec_u8Z to_holder_script_ref;
47286         to_holder_script_ref.datalen = to_holder_script->arr_len;
47287         to_holder_script_ref.data = MALLOC(to_holder_script_ref.datalen, "LDKCVec_u8Z Bytes");
47288         memcpy(to_holder_script_ref.data, to_holder_script->elems, to_holder_script_ref.datalen); FREE(to_holder_script);
47289         LDKCVec_u8Z to_counterparty_script_ref;
47290         to_counterparty_script_ref.datalen = to_counterparty_script->arr_len;
47291         to_counterparty_script_ref.data = MALLOC(to_counterparty_script_ref.datalen, "LDKCVec_u8Z Bytes");
47292         memcpy(to_counterparty_script_ref.data, to_counterparty_script->elems, to_counterparty_script_ref.datalen); FREE(to_counterparty_script);
47293         LDKOutPoint funding_outpoint_conv;
47294         funding_outpoint_conv.inner = untag_ptr(funding_outpoint);
47295         funding_outpoint_conv.is_owned = ptr_is_owned(funding_outpoint);
47296         CHECK_INNER_FIELD_ACCESS_OR_NULL(funding_outpoint_conv);
47297         funding_outpoint_conv = OutPoint_clone(&funding_outpoint_conv);
47298         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);
47299         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
47300         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
47301         Transaction_free(ret_var);
47302         return ret_arr;
47303 }
47304
47305 void  __attribute__((export_name("TS_CounterpartyCommitmentSecrets_free"))) TS_CounterpartyCommitmentSecrets_free(uint64_t this_obj) {
47306         LDKCounterpartyCommitmentSecrets this_obj_conv;
47307         this_obj_conv.inner = untag_ptr(this_obj);
47308         this_obj_conv.is_owned = ptr_is_owned(this_obj);
47309         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
47310         CounterpartyCommitmentSecrets_free(this_obj_conv);
47311 }
47312
47313 static inline uint64_t CounterpartyCommitmentSecrets_clone_ptr(LDKCounterpartyCommitmentSecrets *NONNULL_PTR arg) {
47314         LDKCounterpartyCommitmentSecrets ret_var = CounterpartyCommitmentSecrets_clone(arg);
47315         uint64_t ret_ref = 0;
47316         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
47317         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
47318         return ret_ref;
47319 }
47320 int64_t  __attribute__((export_name("TS_CounterpartyCommitmentSecrets_clone_ptr"))) TS_CounterpartyCommitmentSecrets_clone_ptr(uint64_t arg) {
47321         LDKCounterpartyCommitmentSecrets arg_conv;
47322         arg_conv.inner = untag_ptr(arg);
47323         arg_conv.is_owned = ptr_is_owned(arg);
47324         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
47325         arg_conv.is_owned = false;
47326         int64_t ret_conv = CounterpartyCommitmentSecrets_clone_ptr(&arg_conv);
47327         return ret_conv;
47328 }
47329
47330 uint64_t  __attribute__((export_name("TS_CounterpartyCommitmentSecrets_clone"))) TS_CounterpartyCommitmentSecrets_clone(uint64_t orig) {
47331         LDKCounterpartyCommitmentSecrets orig_conv;
47332         orig_conv.inner = untag_ptr(orig);
47333         orig_conv.is_owned = ptr_is_owned(orig);
47334         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
47335         orig_conv.is_owned = false;
47336         LDKCounterpartyCommitmentSecrets ret_var = CounterpartyCommitmentSecrets_clone(&orig_conv);
47337         uint64_t ret_ref = 0;
47338         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
47339         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
47340         return ret_ref;
47341 }
47342
47343 uint64_t  __attribute__((export_name("TS_CounterpartyCommitmentSecrets_new"))) TS_CounterpartyCommitmentSecrets_new() {
47344         LDKCounterpartyCommitmentSecrets ret_var = CounterpartyCommitmentSecrets_new();
47345         uint64_t ret_ref = 0;
47346         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
47347         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
47348         return ret_ref;
47349 }
47350
47351 int64_t  __attribute__((export_name("TS_CounterpartyCommitmentSecrets_get_min_seen_secret"))) TS_CounterpartyCommitmentSecrets_get_min_seen_secret(uint64_t this_arg) {
47352         LDKCounterpartyCommitmentSecrets this_arg_conv;
47353         this_arg_conv.inner = untag_ptr(this_arg);
47354         this_arg_conv.is_owned = ptr_is_owned(this_arg);
47355         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
47356         this_arg_conv.is_owned = false;
47357         int64_t ret_conv = CounterpartyCommitmentSecrets_get_min_seen_secret(&this_arg_conv);
47358         return ret_conv;
47359 }
47360
47361 uint64_t  __attribute__((export_name("TS_CounterpartyCommitmentSecrets_provide_secret"))) TS_CounterpartyCommitmentSecrets_provide_secret(uint64_t this_arg, int64_t idx, int8_tArray secret) {
47362         LDKCounterpartyCommitmentSecrets this_arg_conv;
47363         this_arg_conv.inner = untag_ptr(this_arg);
47364         this_arg_conv.is_owned = ptr_is_owned(this_arg);
47365         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
47366         this_arg_conv.is_owned = false;
47367         LDKThirtyTwoBytes secret_ref;
47368         CHECK(secret->arr_len == 32);
47369         memcpy(secret_ref.data, secret->elems, 32); FREE(secret);
47370         LDKCResult_NoneNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneNoneZ), "LDKCResult_NoneNoneZ");
47371         *ret_conv = CounterpartyCommitmentSecrets_provide_secret(&this_arg_conv, idx, secret_ref);
47372         return tag_ptr(ret_conv, true);
47373 }
47374
47375 int8_tArray  __attribute__((export_name("TS_CounterpartyCommitmentSecrets_get_secret"))) TS_CounterpartyCommitmentSecrets_get_secret(uint64_t this_arg, int64_t idx) {
47376         LDKCounterpartyCommitmentSecrets this_arg_conv;
47377         this_arg_conv.inner = untag_ptr(this_arg);
47378         this_arg_conv.is_owned = ptr_is_owned(this_arg);
47379         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
47380         this_arg_conv.is_owned = false;
47381         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
47382         memcpy(ret_arr->elems, CounterpartyCommitmentSecrets_get_secret(&this_arg_conv, idx).data, 32);
47383         return ret_arr;
47384 }
47385
47386 int8_tArray  __attribute__((export_name("TS_CounterpartyCommitmentSecrets_write"))) TS_CounterpartyCommitmentSecrets_write(uint64_t obj) {
47387         LDKCounterpartyCommitmentSecrets obj_conv;
47388         obj_conv.inner = untag_ptr(obj);
47389         obj_conv.is_owned = ptr_is_owned(obj);
47390         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
47391         obj_conv.is_owned = false;
47392         LDKCVec_u8Z ret_var = CounterpartyCommitmentSecrets_write(&obj_conv);
47393         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
47394         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
47395         CVec_u8Z_free(ret_var);
47396         return ret_arr;
47397 }
47398
47399 uint64_t  __attribute__((export_name("TS_CounterpartyCommitmentSecrets_read"))) TS_CounterpartyCommitmentSecrets_read(int8_tArray ser) {
47400         LDKu8slice ser_ref;
47401         ser_ref.datalen = ser->arr_len;
47402         ser_ref.data = ser->elems;
47403         LDKCResult_CounterpartyCommitmentSecretsDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CounterpartyCommitmentSecretsDecodeErrorZ), "LDKCResult_CounterpartyCommitmentSecretsDecodeErrorZ");
47404         *ret_conv = CounterpartyCommitmentSecrets_read(ser_ref);
47405         FREE(ser);
47406         return tag_ptr(ret_conv, true);
47407 }
47408
47409 int8_tArray  __attribute__((export_name("TS_derive_private_key"))) TS_derive_private_key(int8_tArray per_commitment_point, int8_tArray base_secret) {
47410         LDKPublicKey per_commitment_point_ref;
47411         CHECK(per_commitment_point->arr_len == 33);
47412         memcpy(per_commitment_point_ref.compressed_form, per_commitment_point->elems, 33); FREE(per_commitment_point);
47413         uint8_t base_secret_arr[32];
47414         CHECK(base_secret->arr_len == 32);
47415         memcpy(base_secret_arr, base_secret->elems, 32); FREE(base_secret);
47416         uint8_t (*base_secret_ref)[32] = &base_secret_arr;
47417         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
47418         memcpy(ret_arr->elems, derive_private_key(per_commitment_point_ref, base_secret_ref).bytes, 32);
47419         return ret_arr;
47420 }
47421
47422 int8_tArray  __attribute__((export_name("TS_derive_public_key"))) TS_derive_public_key(int8_tArray per_commitment_point, int8_tArray base_point) {
47423         LDKPublicKey per_commitment_point_ref;
47424         CHECK(per_commitment_point->arr_len == 33);
47425         memcpy(per_commitment_point_ref.compressed_form, per_commitment_point->elems, 33); FREE(per_commitment_point);
47426         LDKPublicKey base_point_ref;
47427         CHECK(base_point->arr_len == 33);
47428         memcpy(base_point_ref.compressed_form, base_point->elems, 33); FREE(base_point);
47429         int8_tArray ret_arr = init_int8_tArray(33, __LINE__);
47430         memcpy(ret_arr->elems, derive_public_key(per_commitment_point_ref, base_point_ref).compressed_form, 33);
47431         return ret_arr;
47432 }
47433
47434 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) {
47435         uint8_t per_commitment_secret_arr[32];
47436         CHECK(per_commitment_secret->arr_len == 32);
47437         memcpy(per_commitment_secret_arr, per_commitment_secret->elems, 32); FREE(per_commitment_secret);
47438         uint8_t (*per_commitment_secret_ref)[32] = &per_commitment_secret_arr;
47439         uint8_t countersignatory_revocation_base_secret_arr[32];
47440         CHECK(countersignatory_revocation_base_secret->arr_len == 32);
47441         memcpy(countersignatory_revocation_base_secret_arr, countersignatory_revocation_base_secret->elems, 32); FREE(countersignatory_revocation_base_secret);
47442         uint8_t (*countersignatory_revocation_base_secret_ref)[32] = &countersignatory_revocation_base_secret_arr;
47443         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
47444         memcpy(ret_arr->elems, derive_private_revocation_key(per_commitment_secret_ref, countersignatory_revocation_base_secret_ref).bytes, 32);
47445         return ret_arr;
47446 }
47447
47448 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) {
47449         LDKPublicKey per_commitment_point_ref;
47450         CHECK(per_commitment_point->arr_len == 33);
47451         memcpy(per_commitment_point_ref.compressed_form, per_commitment_point->elems, 33); FREE(per_commitment_point);
47452         LDKPublicKey countersignatory_revocation_base_point_ref;
47453         CHECK(countersignatory_revocation_base_point->arr_len == 33);
47454         memcpy(countersignatory_revocation_base_point_ref.compressed_form, countersignatory_revocation_base_point->elems, 33); FREE(countersignatory_revocation_base_point);
47455         int8_tArray ret_arr = init_int8_tArray(33, __LINE__);
47456         memcpy(ret_arr->elems, derive_public_revocation_key(per_commitment_point_ref, countersignatory_revocation_base_point_ref).compressed_form, 33);
47457         return ret_arr;
47458 }
47459
47460 void  __attribute__((export_name("TS_TxCreationKeys_free"))) TS_TxCreationKeys_free(uint64_t this_obj) {
47461         LDKTxCreationKeys this_obj_conv;
47462         this_obj_conv.inner = untag_ptr(this_obj);
47463         this_obj_conv.is_owned = ptr_is_owned(this_obj);
47464         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
47465         TxCreationKeys_free(this_obj_conv);
47466 }
47467
47468 int8_tArray  __attribute__((export_name("TS_TxCreationKeys_get_per_commitment_point"))) TS_TxCreationKeys_get_per_commitment_point(uint64_t this_ptr) {
47469         LDKTxCreationKeys this_ptr_conv;
47470         this_ptr_conv.inner = untag_ptr(this_ptr);
47471         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
47472         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
47473         this_ptr_conv.is_owned = false;
47474         int8_tArray ret_arr = init_int8_tArray(33, __LINE__);
47475         memcpy(ret_arr->elems, TxCreationKeys_get_per_commitment_point(&this_ptr_conv).compressed_form, 33);
47476         return ret_arr;
47477 }
47478
47479 void  __attribute__((export_name("TS_TxCreationKeys_set_per_commitment_point"))) TS_TxCreationKeys_set_per_commitment_point(uint64_t this_ptr, int8_tArray val) {
47480         LDKTxCreationKeys this_ptr_conv;
47481         this_ptr_conv.inner = untag_ptr(this_ptr);
47482         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
47483         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
47484         this_ptr_conv.is_owned = false;
47485         LDKPublicKey val_ref;
47486         CHECK(val->arr_len == 33);
47487         memcpy(val_ref.compressed_form, val->elems, 33); FREE(val);
47488         TxCreationKeys_set_per_commitment_point(&this_ptr_conv, val_ref);
47489 }
47490
47491 int8_tArray  __attribute__((export_name("TS_TxCreationKeys_get_revocation_key"))) TS_TxCreationKeys_get_revocation_key(uint64_t this_ptr) {
47492         LDKTxCreationKeys this_ptr_conv;
47493         this_ptr_conv.inner = untag_ptr(this_ptr);
47494         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
47495         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
47496         this_ptr_conv.is_owned = false;
47497         int8_tArray ret_arr = init_int8_tArray(33, __LINE__);
47498         memcpy(ret_arr->elems, TxCreationKeys_get_revocation_key(&this_ptr_conv).compressed_form, 33);
47499         return ret_arr;
47500 }
47501
47502 void  __attribute__((export_name("TS_TxCreationKeys_set_revocation_key"))) TS_TxCreationKeys_set_revocation_key(uint64_t this_ptr, int8_tArray val) {
47503         LDKTxCreationKeys this_ptr_conv;
47504         this_ptr_conv.inner = untag_ptr(this_ptr);
47505         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
47506         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
47507         this_ptr_conv.is_owned = false;
47508         LDKPublicKey val_ref;
47509         CHECK(val->arr_len == 33);
47510         memcpy(val_ref.compressed_form, val->elems, 33); FREE(val);
47511         TxCreationKeys_set_revocation_key(&this_ptr_conv, val_ref);
47512 }
47513
47514 int8_tArray  __attribute__((export_name("TS_TxCreationKeys_get_broadcaster_htlc_key"))) TS_TxCreationKeys_get_broadcaster_htlc_key(uint64_t this_ptr) {
47515         LDKTxCreationKeys this_ptr_conv;
47516         this_ptr_conv.inner = untag_ptr(this_ptr);
47517         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
47518         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
47519         this_ptr_conv.is_owned = false;
47520         int8_tArray ret_arr = init_int8_tArray(33, __LINE__);
47521         memcpy(ret_arr->elems, TxCreationKeys_get_broadcaster_htlc_key(&this_ptr_conv).compressed_form, 33);
47522         return ret_arr;
47523 }
47524
47525 void  __attribute__((export_name("TS_TxCreationKeys_set_broadcaster_htlc_key"))) TS_TxCreationKeys_set_broadcaster_htlc_key(uint64_t this_ptr, int8_tArray val) {
47526         LDKTxCreationKeys this_ptr_conv;
47527         this_ptr_conv.inner = untag_ptr(this_ptr);
47528         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
47529         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
47530         this_ptr_conv.is_owned = false;
47531         LDKPublicKey val_ref;
47532         CHECK(val->arr_len == 33);
47533         memcpy(val_ref.compressed_form, val->elems, 33); FREE(val);
47534         TxCreationKeys_set_broadcaster_htlc_key(&this_ptr_conv, val_ref);
47535 }
47536
47537 int8_tArray  __attribute__((export_name("TS_TxCreationKeys_get_countersignatory_htlc_key"))) TS_TxCreationKeys_get_countersignatory_htlc_key(uint64_t this_ptr) {
47538         LDKTxCreationKeys this_ptr_conv;
47539         this_ptr_conv.inner = untag_ptr(this_ptr);
47540         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
47541         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
47542         this_ptr_conv.is_owned = false;
47543         int8_tArray ret_arr = init_int8_tArray(33, __LINE__);
47544         memcpy(ret_arr->elems, TxCreationKeys_get_countersignatory_htlc_key(&this_ptr_conv).compressed_form, 33);
47545         return ret_arr;
47546 }
47547
47548 void  __attribute__((export_name("TS_TxCreationKeys_set_countersignatory_htlc_key"))) TS_TxCreationKeys_set_countersignatory_htlc_key(uint64_t this_ptr, int8_tArray val) {
47549         LDKTxCreationKeys this_ptr_conv;
47550         this_ptr_conv.inner = untag_ptr(this_ptr);
47551         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
47552         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
47553         this_ptr_conv.is_owned = false;
47554         LDKPublicKey val_ref;
47555         CHECK(val->arr_len == 33);
47556         memcpy(val_ref.compressed_form, val->elems, 33); FREE(val);
47557         TxCreationKeys_set_countersignatory_htlc_key(&this_ptr_conv, val_ref);
47558 }
47559
47560 int8_tArray  __attribute__((export_name("TS_TxCreationKeys_get_broadcaster_delayed_payment_key"))) TS_TxCreationKeys_get_broadcaster_delayed_payment_key(uint64_t this_ptr) {
47561         LDKTxCreationKeys this_ptr_conv;
47562         this_ptr_conv.inner = untag_ptr(this_ptr);
47563         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
47564         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
47565         this_ptr_conv.is_owned = false;
47566         int8_tArray ret_arr = init_int8_tArray(33, __LINE__);
47567         memcpy(ret_arr->elems, TxCreationKeys_get_broadcaster_delayed_payment_key(&this_ptr_conv).compressed_form, 33);
47568         return ret_arr;
47569 }
47570
47571 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) {
47572         LDKTxCreationKeys this_ptr_conv;
47573         this_ptr_conv.inner = untag_ptr(this_ptr);
47574         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
47575         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
47576         this_ptr_conv.is_owned = false;
47577         LDKPublicKey val_ref;
47578         CHECK(val->arr_len == 33);
47579         memcpy(val_ref.compressed_form, val->elems, 33); FREE(val);
47580         TxCreationKeys_set_broadcaster_delayed_payment_key(&this_ptr_conv, val_ref);
47581 }
47582
47583 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) {
47584         LDKPublicKey per_commitment_point_arg_ref;
47585         CHECK(per_commitment_point_arg->arr_len == 33);
47586         memcpy(per_commitment_point_arg_ref.compressed_form, per_commitment_point_arg->elems, 33); FREE(per_commitment_point_arg);
47587         LDKPublicKey revocation_key_arg_ref;
47588         CHECK(revocation_key_arg->arr_len == 33);
47589         memcpy(revocation_key_arg_ref.compressed_form, revocation_key_arg->elems, 33); FREE(revocation_key_arg);
47590         LDKPublicKey broadcaster_htlc_key_arg_ref;
47591         CHECK(broadcaster_htlc_key_arg->arr_len == 33);
47592         memcpy(broadcaster_htlc_key_arg_ref.compressed_form, broadcaster_htlc_key_arg->elems, 33); FREE(broadcaster_htlc_key_arg);
47593         LDKPublicKey countersignatory_htlc_key_arg_ref;
47594         CHECK(countersignatory_htlc_key_arg->arr_len == 33);
47595         memcpy(countersignatory_htlc_key_arg_ref.compressed_form, countersignatory_htlc_key_arg->elems, 33); FREE(countersignatory_htlc_key_arg);
47596         LDKPublicKey broadcaster_delayed_payment_key_arg_ref;
47597         CHECK(broadcaster_delayed_payment_key_arg->arr_len == 33);
47598         memcpy(broadcaster_delayed_payment_key_arg_ref.compressed_form, broadcaster_delayed_payment_key_arg->elems, 33); FREE(broadcaster_delayed_payment_key_arg);
47599         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);
47600         uint64_t ret_ref = 0;
47601         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
47602         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
47603         return ret_ref;
47604 }
47605
47606 jboolean  __attribute__((export_name("TS_TxCreationKeys_eq"))) TS_TxCreationKeys_eq(uint64_t a, uint64_t b) {
47607         LDKTxCreationKeys a_conv;
47608         a_conv.inner = untag_ptr(a);
47609         a_conv.is_owned = ptr_is_owned(a);
47610         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
47611         a_conv.is_owned = false;
47612         LDKTxCreationKeys b_conv;
47613         b_conv.inner = untag_ptr(b);
47614         b_conv.is_owned = ptr_is_owned(b);
47615         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
47616         b_conv.is_owned = false;
47617         jboolean ret_conv = TxCreationKeys_eq(&a_conv, &b_conv);
47618         return ret_conv;
47619 }
47620
47621 static inline uint64_t TxCreationKeys_clone_ptr(LDKTxCreationKeys *NONNULL_PTR arg) {
47622         LDKTxCreationKeys ret_var = TxCreationKeys_clone(arg);
47623         uint64_t ret_ref = 0;
47624         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
47625         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
47626         return ret_ref;
47627 }
47628 int64_t  __attribute__((export_name("TS_TxCreationKeys_clone_ptr"))) TS_TxCreationKeys_clone_ptr(uint64_t arg) {
47629         LDKTxCreationKeys arg_conv;
47630         arg_conv.inner = untag_ptr(arg);
47631         arg_conv.is_owned = ptr_is_owned(arg);
47632         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
47633         arg_conv.is_owned = false;
47634         int64_t ret_conv = TxCreationKeys_clone_ptr(&arg_conv);
47635         return ret_conv;
47636 }
47637
47638 uint64_t  __attribute__((export_name("TS_TxCreationKeys_clone"))) TS_TxCreationKeys_clone(uint64_t orig) {
47639         LDKTxCreationKeys orig_conv;
47640         orig_conv.inner = untag_ptr(orig);
47641         orig_conv.is_owned = ptr_is_owned(orig);
47642         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
47643         orig_conv.is_owned = false;
47644         LDKTxCreationKeys ret_var = TxCreationKeys_clone(&orig_conv);
47645         uint64_t ret_ref = 0;
47646         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
47647         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
47648         return ret_ref;
47649 }
47650
47651 int8_tArray  __attribute__((export_name("TS_TxCreationKeys_write"))) TS_TxCreationKeys_write(uint64_t obj) {
47652         LDKTxCreationKeys obj_conv;
47653         obj_conv.inner = untag_ptr(obj);
47654         obj_conv.is_owned = ptr_is_owned(obj);
47655         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
47656         obj_conv.is_owned = false;
47657         LDKCVec_u8Z ret_var = TxCreationKeys_write(&obj_conv);
47658         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
47659         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
47660         CVec_u8Z_free(ret_var);
47661         return ret_arr;
47662 }
47663
47664 uint64_t  __attribute__((export_name("TS_TxCreationKeys_read"))) TS_TxCreationKeys_read(int8_tArray ser) {
47665         LDKu8slice ser_ref;
47666         ser_ref.datalen = ser->arr_len;
47667         ser_ref.data = ser->elems;
47668         LDKCResult_TxCreationKeysDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TxCreationKeysDecodeErrorZ), "LDKCResult_TxCreationKeysDecodeErrorZ");
47669         *ret_conv = TxCreationKeys_read(ser_ref);
47670         FREE(ser);
47671         return tag_ptr(ret_conv, true);
47672 }
47673
47674 void  __attribute__((export_name("TS_ChannelPublicKeys_free"))) TS_ChannelPublicKeys_free(uint64_t this_obj) {
47675         LDKChannelPublicKeys this_obj_conv;
47676         this_obj_conv.inner = untag_ptr(this_obj);
47677         this_obj_conv.is_owned = ptr_is_owned(this_obj);
47678         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
47679         ChannelPublicKeys_free(this_obj_conv);
47680 }
47681
47682 int8_tArray  __attribute__((export_name("TS_ChannelPublicKeys_get_funding_pubkey"))) TS_ChannelPublicKeys_get_funding_pubkey(uint64_t this_ptr) {
47683         LDKChannelPublicKeys this_ptr_conv;
47684         this_ptr_conv.inner = untag_ptr(this_ptr);
47685         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
47686         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
47687         this_ptr_conv.is_owned = false;
47688         int8_tArray ret_arr = init_int8_tArray(33, __LINE__);
47689         memcpy(ret_arr->elems, ChannelPublicKeys_get_funding_pubkey(&this_ptr_conv).compressed_form, 33);
47690         return ret_arr;
47691 }
47692
47693 void  __attribute__((export_name("TS_ChannelPublicKeys_set_funding_pubkey"))) TS_ChannelPublicKeys_set_funding_pubkey(uint64_t this_ptr, int8_tArray val) {
47694         LDKChannelPublicKeys this_ptr_conv;
47695         this_ptr_conv.inner = untag_ptr(this_ptr);
47696         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
47697         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
47698         this_ptr_conv.is_owned = false;
47699         LDKPublicKey val_ref;
47700         CHECK(val->arr_len == 33);
47701         memcpy(val_ref.compressed_form, val->elems, 33); FREE(val);
47702         ChannelPublicKeys_set_funding_pubkey(&this_ptr_conv, val_ref);
47703 }
47704
47705 int8_tArray  __attribute__((export_name("TS_ChannelPublicKeys_get_revocation_basepoint"))) TS_ChannelPublicKeys_get_revocation_basepoint(uint64_t this_ptr) {
47706         LDKChannelPublicKeys this_ptr_conv;
47707         this_ptr_conv.inner = untag_ptr(this_ptr);
47708         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
47709         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
47710         this_ptr_conv.is_owned = false;
47711         int8_tArray ret_arr = init_int8_tArray(33, __LINE__);
47712         memcpy(ret_arr->elems, ChannelPublicKeys_get_revocation_basepoint(&this_ptr_conv).compressed_form, 33);
47713         return ret_arr;
47714 }
47715
47716 void  __attribute__((export_name("TS_ChannelPublicKeys_set_revocation_basepoint"))) TS_ChannelPublicKeys_set_revocation_basepoint(uint64_t this_ptr, int8_tArray val) {
47717         LDKChannelPublicKeys this_ptr_conv;
47718         this_ptr_conv.inner = untag_ptr(this_ptr);
47719         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
47720         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
47721         this_ptr_conv.is_owned = false;
47722         LDKPublicKey val_ref;
47723         CHECK(val->arr_len == 33);
47724         memcpy(val_ref.compressed_form, val->elems, 33); FREE(val);
47725         ChannelPublicKeys_set_revocation_basepoint(&this_ptr_conv, val_ref);
47726 }
47727
47728 int8_tArray  __attribute__((export_name("TS_ChannelPublicKeys_get_payment_point"))) TS_ChannelPublicKeys_get_payment_point(uint64_t this_ptr) {
47729         LDKChannelPublicKeys this_ptr_conv;
47730         this_ptr_conv.inner = untag_ptr(this_ptr);
47731         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
47732         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
47733         this_ptr_conv.is_owned = false;
47734         int8_tArray ret_arr = init_int8_tArray(33, __LINE__);
47735         memcpy(ret_arr->elems, ChannelPublicKeys_get_payment_point(&this_ptr_conv).compressed_form, 33);
47736         return ret_arr;
47737 }
47738
47739 void  __attribute__((export_name("TS_ChannelPublicKeys_set_payment_point"))) TS_ChannelPublicKeys_set_payment_point(uint64_t this_ptr, int8_tArray val) {
47740         LDKChannelPublicKeys this_ptr_conv;
47741         this_ptr_conv.inner = untag_ptr(this_ptr);
47742         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
47743         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
47744         this_ptr_conv.is_owned = false;
47745         LDKPublicKey val_ref;
47746         CHECK(val->arr_len == 33);
47747         memcpy(val_ref.compressed_form, val->elems, 33); FREE(val);
47748         ChannelPublicKeys_set_payment_point(&this_ptr_conv, val_ref);
47749 }
47750
47751 int8_tArray  __attribute__((export_name("TS_ChannelPublicKeys_get_delayed_payment_basepoint"))) TS_ChannelPublicKeys_get_delayed_payment_basepoint(uint64_t this_ptr) {
47752         LDKChannelPublicKeys this_ptr_conv;
47753         this_ptr_conv.inner = untag_ptr(this_ptr);
47754         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
47755         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
47756         this_ptr_conv.is_owned = false;
47757         int8_tArray ret_arr = init_int8_tArray(33, __LINE__);
47758         memcpy(ret_arr->elems, ChannelPublicKeys_get_delayed_payment_basepoint(&this_ptr_conv).compressed_form, 33);
47759         return ret_arr;
47760 }
47761
47762 void  __attribute__((export_name("TS_ChannelPublicKeys_set_delayed_payment_basepoint"))) TS_ChannelPublicKeys_set_delayed_payment_basepoint(uint64_t this_ptr, int8_tArray val) {
47763         LDKChannelPublicKeys this_ptr_conv;
47764         this_ptr_conv.inner = untag_ptr(this_ptr);
47765         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
47766         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
47767         this_ptr_conv.is_owned = false;
47768         LDKPublicKey val_ref;
47769         CHECK(val->arr_len == 33);
47770         memcpy(val_ref.compressed_form, val->elems, 33); FREE(val);
47771         ChannelPublicKeys_set_delayed_payment_basepoint(&this_ptr_conv, val_ref);
47772 }
47773
47774 int8_tArray  __attribute__((export_name("TS_ChannelPublicKeys_get_htlc_basepoint"))) TS_ChannelPublicKeys_get_htlc_basepoint(uint64_t this_ptr) {
47775         LDKChannelPublicKeys this_ptr_conv;
47776         this_ptr_conv.inner = untag_ptr(this_ptr);
47777         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
47778         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
47779         this_ptr_conv.is_owned = false;
47780         int8_tArray ret_arr = init_int8_tArray(33, __LINE__);
47781         memcpy(ret_arr->elems, ChannelPublicKeys_get_htlc_basepoint(&this_ptr_conv).compressed_form, 33);
47782         return ret_arr;
47783 }
47784
47785 void  __attribute__((export_name("TS_ChannelPublicKeys_set_htlc_basepoint"))) TS_ChannelPublicKeys_set_htlc_basepoint(uint64_t this_ptr, int8_tArray val) {
47786         LDKChannelPublicKeys this_ptr_conv;
47787         this_ptr_conv.inner = untag_ptr(this_ptr);
47788         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
47789         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
47790         this_ptr_conv.is_owned = false;
47791         LDKPublicKey val_ref;
47792         CHECK(val->arr_len == 33);
47793         memcpy(val_ref.compressed_form, val->elems, 33); FREE(val);
47794         ChannelPublicKeys_set_htlc_basepoint(&this_ptr_conv, val_ref);
47795 }
47796
47797 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) {
47798         LDKPublicKey funding_pubkey_arg_ref;
47799         CHECK(funding_pubkey_arg->arr_len == 33);
47800         memcpy(funding_pubkey_arg_ref.compressed_form, funding_pubkey_arg->elems, 33); FREE(funding_pubkey_arg);
47801         LDKPublicKey revocation_basepoint_arg_ref;
47802         CHECK(revocation_basepoint_arg->arr_len == 33);
47803         memcpy(revocation_basepoint_arg_ref.compressed_form, revocation_basepoint_arg->elems, 33); FREE(revocation_basepoint_arg);
47804         LDKPublicKey payment_point_arg_ref;
47805         CHECK(payment_point_arg->arr_len == 33);
47806         memcpy(payment_point_arg_ref.compressed_form, payment_point_arg->elems, 33); FREE(payment_point_arg);
47807         LDKPublicKey delayed_payment_basepoint_arg_ref;
47808         CHECK(delayed_payment_basepoint_arg->arr_len == 33);
47809         memcpy(delayed_payment_basepoint_arg_ref.compressed_form, delayed_payment_basepoint_arg->elems, 33); FREE(delayed_payment_basepoint_arg);
47810         LDKPublicKey htlc_basepoint_arg_ref;
47811         CHECK(htlc_basepoint_arg->arr_len == 33);
47812         memcpy(htlc_basepoint_arg_ref.compressed_form, htlc_basepoint_arg->elems, 33); FREE(htlc_basepoint_arg);
47813         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);
47814         uint64_t ret_ref = 0;
47815         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
47816         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
47817         return ret_ref;
47818 }
47819
47820 static inline uint64_t ChannelPublicKeys_clone_ptr(LDKChannelPublicKeys *NONNULL_PTR arg) {
47821         LDKChannelPublicKeys ret_var = ChannelPublicKeys_clone(arg);
47822         uint64_t ret_ref = 0;
47823         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
47824         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
47825         return ret_ref;
47826 }
47827 int64_t  __attribute__((export_name("TS_ChannelPublicKeys_clone_ptr"))) TS_ChannelPublicKeys_clone_ptr(uint64_t arg) {
47828         LDKChannelPublicKeys arg_conv;
47829         arg_conv.inner = untag_ptr(arg);
47830         arg_conv.is_owned = ptr_is_owned(arg);
47831         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
47832         arg_conv.is_owned = false;
47833         int64_t ret_conv = ChannelPublicKeys_clone_ptr(&arg_conv);
47834         return ret_conv;
47835 }
47836
47837 uint64_t  __attribute__((export_name("TS_ChannelPublicKeys_clone"))) TS_ChannelPublicKeys_clone(uint64_t orig) {
47838         LDKChannelPublicKeys orig_conv;
47839         orig_conv.inner = untag_ptr(orig);
47840         orig_conv.is_owned = ptr_is_owned(orig);
47841         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
47842         orig_conv.is_owned = false;
47843         LDKChannelPublicKeys ret_var = ChannelPublicKeys_clone(&orig_conv);
47844         uint64_t ret_ref = 0;
47845         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
47846         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
47847         return ret_ref;
47848 }
47849
47850 int64_t  __attribute__((export_name("TS_ChannelPublicKeys_hash"))) TS_ChannelPublicKeys_hash(uint64_t o) {
47851         LDKChannelPublicKeys o_conv;
47852         o_conv.inner = untag_ptr(o);
47853         o_conv.is_owned = ptr_is_owned(o);
47854         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
47855         o_conv.is_owned = false;
47856         int64_t ret_conv = ChannelPublicKeys_hash(&o_conv);
47857         return ret_conv;
47858 }
47859
47860 jboolean  __attribute__((export_name("TS_ChannelPublicKeys_eq"))) TS_ChannelPublicKeys_eq(uint64_t a, uint64_t b) {
47861         LDKChannelPublicKeys a_conv;
47862         a_conv.inner = untag_ptr(a);
47863         a_conv.is_owned = ptr_is_owned(a);
47864         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
47865         a_conv.is_owned = false;
47866         LDKChannelPublicKeys b_conv;
47867         b_conv.inner = untag_ptr(b);
47868         b_conv.is_owned = ptr_is_owned(b);
47869         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
47870         b_conv.is_owned = false;
47871         jboolean ret_conv = ChannelPublicKeys_eq(&a_conv, &b_conv);
47872         return ret_conv;
47873 }
47874
47875 int8_tArray  __attribute__((export_name("TS_ChannelPublicKeys_write"))) TS_ChannelPublicKeys_write(uint64_t obj) {
47876         LDKChannelPublicKeys obj_conv;
47877         obj_conv.inner = untag_ptr(obj);
47878         obj_conv.is_owned = ptr_is_owned(obj);
47879         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
47880         obj_conv.is_owned = false;
47881         LDKCVec_u8Z ret_var = ChannelPublicKeys_write(&obj_conv);
47882         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
47883         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
47884         CVec_u8Z_free(ret_var);
47885         return ret_arr;
47886 }
47887
47888 uint64_t  __attribute__((export_name("TS_ChannelPublicKeys_read"))) TS_ChannelPublicKeys_read(int8_tArray ser) {
47889         LDKu8slice ser_ref;
47890         ser_ref.datalen = ser->arr_len;
47891         ser_ref.data = ser->elems;
47892         LDKCResult_ChannelPublicKeysDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelPublicKeysDecodeErrorZ), "LDKCResult_ChannelPublicKeysDecodeErrorZ");
47893         *ret_conv = ChannelPublicKeys_read(ser_ref);
47894         FREE(ser);
47895         return tag_ptr(ret_conv, true);
47896 }
47897
47898 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) {
47899         LDKPublicKey per_commitment_point_ref;
47900         CHECK(per_commitment_point->arr_len == 33);
47901         memcpy(per_commitment_point_ref.compressed_form, per_commitment_point->elems, 33); FREE(per_commitment_point);
47902         LDKPublicKey broadcaster_delayed_payment_base_ref;
47903         CHECK(broadcaster_delayed_payment_base->arr_len == 33);
47904         memcpy(broadcaster_delayed_payment_base_ref.compressed_form, broadcaster_delayed_payment_base->elems, 33); FREE(broadcaster_delayed_payment_base);
47905         LDKPublicKey broadcaster_htlc_base_ref;
47906         CHECK(broadcaster_htlc_base->arr_len == 33);
47907         memcpy(broadcaster_htlc_base_ref.compressed_form, broadcaster_htlc_base->elems, 33); FREE(broadcaster_htlc_base);
47908         LDKPublicKey countersignatory_revocation_base_ref;
47909         CHECK(countersignatory_revocation_base->arr_len == 33);
47910         memcpy(countersignatory_revocation_base_ref.compressed_form, countersignatory_revocation_base->elems, 33); FREE(countersignatory_revocation_base);
47911         LDKPublicKey countersignatory_htlc_base_ref;
47912         CHECK(countersignatory_htlc_base->arr_len == 33);
47913         memcpy(countersignatory_htlc_base_ref.compressed_form, countersignatory_htlc_base->elems, 33); FREE(countersignatory_htlc_base);
47914         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);
47915         uint64_t ret_ref = 0;
47916         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
47917         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
47918         return ret_ref;
47919 }
47920
47921 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) {
47922         LDKPublicKey per_commitment_point_ref;
47923         CHECK(per_commitment_point->arr_len == 33);
47924         memcpy(per_commitment_point_ref.compressed_form, per_commitment_point->elems, 33); FREE(per_commitment_point);
47925         LDKChannelPublicKeys broadcaster_keys_conv;
47926         broadcaster_keys_conv.inner = untag_ptr(broadcaster_keys);
47927         broadcaster_keys_conv.is_owned = ptr_is_owned(broadcaster_keys);
47928         CHECK_INNER_FIELD_ACCESS_OR_NULL(broadcaster_keys_conv);
47929         broadcaster_keys_conv.is_owned = false;
47930         LDKChannelPublicKeys countersignatory_keys_conv;
47931         countersignatory_keys_conv.inner = untag_ptr(countersignatory_keys);
47932         countersignatory_keys_conv.is_owned = ptr_is_owned(countersignatory_keys);
47933         CHECK_INNER_FIELD_ACCESS_OR_NULL(countersignatory_keys_conv);
47934         countersignatory_keys_conv.is_owned = false;
47935         LDKTxCreationKeys ret_var = TxCreationKeys_from_channel_static_keys(per_commitment_point_ref, &broadcaster_keys_conv, &countersignatory_keys_conv);
47936         uint64_t ret_ref = 0;
47937         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
47938         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
47939         return ret_ref;
47940 }
47941
47942 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) {
47943         LDKPublicKey revocation_key_ref;
47944         CHECK(revocation_key->arr_len == 33);
47945         memcpy(revocation_key_ref.compressed_form, revocation_key->elems, 33); FREE(revocation_key);
47946         LDKPublicKey broadcaster_delayed_payment_key_ref;
47947         CHECK(broadcaster_delayed_payment_key->arr_len == 33);
47948         memcpy(broadcaster_delayed_payment_key_ref.compressed_form, broadcaster_delayed_payment_key->elems, 33); FREE(broadcaster_delayed_payment_key);
47949         LDKCVec_u8Z ret_var = get_revokeable_redeemscript(revocation_key_ref, contest_delay, broadcaster_delayed_payment_key_ref);
47950         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
47951         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
47952         CVec_u8Z_free(ret_var);
47953         return ret_arr;
47954 }
47955
47956 int8_tArray  __attribute__((export_name("TS_get_counterparty_payment_script"))) TS_get_counterparty_payment_script(uint64_t channel_type_features, int8_tArray payment_key) {
47957         LDKChannelTypeFeatures channel_type_features_conv;
47958         channel_type_features_conv.inner = untag_ptr(channel_type_features);
47959         channel_type_features_conv.is_owned = ptr_is_owned(channel_type_features);
47960         CHECK_INNER_FIELD_ACCESS_OR_NULL(channel_type_features_conv);
47961         channel_type_features_conv.is_owned = false;
47962         LDKPublicKey payment_key_ref;
47963         CHECK(payment_key->arr_len == 33);
47964         memcpy(payment_key_ref.compressed_form, payment_key->elems, 33); FREE(payment_key);
47965         LDKCVec_u8Z ret_var = get_counterparty_payment_script(&channel_type_features_conv, payment_key_ref);
47966         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
47967         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
47968         CVec_u8Z_free(ret_var);
47969         return ret_arr;
47970 }
47971
47972 void  __attribute__((export_name("TS_HTLCOutputInCommitment_free"))) TS_HTLCOutputInCommitment_free(uint64_t this_obj) {
47973         LDKHTLCOutputInCommitment this_obj_conv;
47974         this_obj_conv.inner = untag_ptr(this_obj);
47975         this_obj_conv.is_owned = ptr_is_owned(this_obj);
47976         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
47977         HTLCOutputInCommitment_free(this_obj_conv);
47978 }
47979
47980 jboolean  __attribute__((export_name("TS_HTLCOutputInCommitment_get_offered"))) TS_HTLCOutputInCommitment_get_offered(uint64_t this_ptr) {
47981         LDKHTLCOutputInCommitment this_ptr_conv;
47982         this_ptr_conv.inner = untag_ptr(this_ptr);
47983         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
47984         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
47985         this_ptr_conv.is_owned = false;
47986         jboolean ret_conv = HTLCOutputInCommitment_get_offered(&this_ptr_conv);
47987         return ret_conv;
47988 }
47989
47990 void  __attribute__((export_name("TS_HTLCOutputInCommitment_set_offered"))) TS_HTLCOutputInCommitment_set_offered(uint64_t this_ptr, jboolean val) {
47991         LDKHTLCOutputInCommitment this_ptr_conv;
47992         this_ptr_conv.inner = untag_ptr(this_ptr);
47993         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
47994         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
47995         this_ptr_conv.is_owned = false;
47996         HTLCOutputInCommitment_set_offered(&this_ptr_conv, val);
47997 }
47998
47999 int64_t  __attribute__((export_name("TS_HTLCOutputInCommitment_get_amount_msat"))) TS_HTLCOutputInCommitment_get_amount_msat(uint64_t this_ptr) {
48000         LDKHTLCOutputInCommitment this_ptr_conv;
48001         this_ptr_conv.inner = untag_ptr(this_ptr);
48002         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
48003         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
48004         this_ptr_conv.is_owned = false;
48005         int64_t ret_conv = HTLCOutputInCommitment_get_amount_msat(&this_ptr_conv);
48006         return ret_conv;
48007 }
48008
48009 void  __attribute__((export_name("TS_HTLCOutputInCommitment_set_amount_msat"))) TS_HTLCOutputInCommitment_set_amount_msat(uint64_t this_ptr, int64_t val) {
48010         LDKHTLCOutputInCommitment this_ptr_conv;
48011         this_ptr_conv.inner = untag_ptr(this_ptr);
48012         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
48013         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
48014         this_ptr_conv.is_owned = false;
48015         HTLCOutputInCommitment_set_amount_msat(&this_ptr_conv, val);
48016 }
48017
48018 int32_t  __attribute__((export_name("TS_HTLCOutputInCommitment_get_cltv_expiry"))) TS_HTLCOutputInCommitment_get_cltv_expiry(uint64_t this_ptr) {
48019         LDKHTLCOutputInCommitment this_ptr_conv;
48020         this_ptr_conv.inner = untag_ptr(this_ptr);
48021         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
48022         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
48023         this_ptr_conv.is_owned = false;
48024         int32_t ret_conv = HTLCOutputInCommitment_get_cltv_expiry(&this_ptr_conv);
48025         return ret_conv;
48026 }
48027
48028 void  __attribute__((export_name("TS_HTLCOutputInCommitment_set_cltv_expiry"))) TS_HTLCOutputInCommitment_set_cltv_expiry(uint64_t this_ptr, int32_t val) {
48029         LDKHTLCOutputInCommitment this_ptr_conv;
48030         this_ptr_conv.inner = untag_ptr(this_ptr);
48031         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
48032         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
48033         this_ptr_conv.is_owned = false;
48034         HTLCOutputInCommitment_set_cltv_expiry(&this_ptr_conv, val);
48035 }
48036
48037 int8_tArray  __attribute__((export_name("TS_HTLCOutputInCommitment_get_payment_hash"))) TS_HTLCOutputInCommitment_get_payment_hash(uint64_t this_ptr) {
48038         LDKHTLCOutputInCommitment this_ptr_conv;
48039         this_ptr_conv.inner = untag_ptr(this_ptr);
48040         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
48041         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
48042         this_ptr_conv.is_owned = false;
48043         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
48044         memcpy(ret_arr->elems, *HTLCOutputInCommitment_get_payment_hash(&this_ptr_conv), 32);
48045         return ret_arr;
48046 }
48047
48048 void  __attribute__((export_name("TS_HTLCOutputInCommitment_set_payment_hash"))) TS_HTLCOutputInCommitment_set_payment_hash(uint64_t this_ptr, int8_tArray val) {
48049         LDKHTLCOutputInCommitment this_ptr_conv;
48050         this_ptr_conv.inner = untag_ptr(this_ptr);
48051         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
48052         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
48053         this_ptr_conv.is_owned = false;
48054         LDKThirtyTwoBytes val_ref;
48055         CHECK(val->arr_len == 32);
48056         memcpy(val_ref.data, val->elems, 32); FREE(val);
48057         HTLCOutputInCommitment_set_payment_hash(&this_ptr_conv, val_ref);
48058 }
48059
48060 uint64_t  __attribute__((export_name("TS_HTLCOutputInCommitment_get_transaction_output_index"))) TS_HTLCOutputInCommitment_get_transaction_output_index(uint64_t this_ptr) {
48061         LDKHTLCOutputInCommitment this_ptr_conv;
48062         this_ptr_conv.inner = untag_ptr(this_ptr);
48063         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
48064         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
48065         this_ptr_conv.is_owned = false;
48066         LDKCOption_u32Z *ret_copy = MALLOC(sizeof(LDKCOption_u32Z), "LDKCOption_u32Z");
48067         *ret_copy = HTLCOutputInCommitment_get_transaction_output_index(&this_ptr_conv);
48068         uint64_t ret_ref = tag_ptr(ret_copy, true);
48069         return ret_ref;
48070 }
48071
48072 void  __attribute__((export_name("TS_HTLCOutputInCommitment_set_transaction_output_index"))) TS_HTLCOutputInCommitment_set_transaction_output_index(uint64_t this_ptr, uint64_t val) {
48073         LDKHTLCOutputInCommitment this_ptr_conv;
48074         this_ptr_conv.inner = untag_ptr(this_ptr);
48075         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
48076         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
48077         this_ptr_conv.is_owned = false;
48078         void* val_ptr = untag_ptr(val);
48079         CHECK_ACCESS(val_ptr);
48080         LDKCOption_u32Z val_conv = *(LDKCOption_u32Z*)(val_ptr);
48081         val_conv = COption_u32Z_clone((LDKCOption_u32Z*)untag_ptr(val));
48082         HTLCOutputInCommitment_set_transaction_output_index(&this_ptr_conv, val_conv);
48083 }
48084
48085 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) {
48086         LDKThirtyTwoBytes payment_hash_arg_ref;
48087         CHECK(payment_hash_arg->arr_len == 32);
48088         memcpy(payment_hash_arg_ref.data, payment_hash_arg->elems, 32); FREE(payment_hash_arg);
48089         void* transaction_output_index_arg_ptr = untag_ptr(transaction_output_index_arg);
48090         CHECK_ACCESS(transaction_output_index_arg_ptr);
48091         LDKCOption_u32Z transaction_output_index_arg_conv = *(LDKCOption_u32Z*)(transaction_output_index_arg_ptr);
48092         transaction_output_index_arg_conv = COption_u32Z_clone((LDKCOption_u32Z*)untag_ptr(transaction_output_index_arg));
48093         LDKHTLCOutputInCommitment ret_var = HTLCOutputInCommitment_new(offered_arg, amount_msat_arg, cltv_expiry_arg, payment_hash_arg_ref, transaction_output_index_arg_conv);
48094         uint64_t ret_ref = 0;
48095         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
48096         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
48097         return ret_ref;
48098 }
48099
48100 static inline uint64_t HTLCOutputInCommitment_clone_ptr(LDKHTLCOutputInCommitment *NONNULL_PTR arg) {
48101         LDKHTLCOutputInCommitment ret_var = HTLCOutputInCommitment_clone(arg);
48102         uint64_t ret_ref = 0;
48103         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
48104         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
48105         return ret_ref;
48106 }
48107 int64_t  __attribute__((export_name("TS_HTLCOutputInCommitment_clone_ptr"))) TS_HTLCOutputInCommitment_clone_ptr(uint64_t arg) {
48108         LDKHTLCOutputInCommitment arg_conv;
48109         arg_conv.inner = untag_ptr(arg);
48110         arg_conv.is_owned = ptr_is_owned(arg);
48111         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
48112         arg_conv.is_owned = false;
48113         int64_t ret_conv = HTLCOutputInCommitment_clone_ptr(&arg_conv);
48114         return ret_conv;
48115 }
48116
48117 uint64_t  __attribute__((export_name("TS_HTLCOutputInCommitment_clone"))) TS_HTLCOutputInCommitment_clone(uint64_t orig) {
48118         LDKHTLCOutputInCommitment orig_conv;
48119         orig_conv.inner = untag_ptr(orig);
48120         orig_conv.is_owned = ptr_is_owned(orig);
48121         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
48122         orig_conv.is_owned = false;
48123         LDKHTLCOutputInCommitment ret_var = HTLCOutputInCommitment_clone(&orig_conv);
48124         uint64_t ret_ref = 0;
48125         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
48126         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
48127         return ret_ref;
48128 }
48129
48130 jboolean  __attribute__((export_name("TS_HTLCOutputInCommitment_eq"))) TS_HTLCOutputInCommitment_eq(uint64_t a, uint64_t b) {
48131         LDKHTLCOutputInCommitment a_conv;
48132         a_conv.inner = untag_ptr(a);
48133         a_conv.is_owned = ptr_is_owned(a);
48134         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
48135         a_conv.is_owned = false;
48136         LDKHTLCOutputInCommitment b_conv;
48137         b_conv.inner = untag_ptr(b);
48138         b_conv.is_owned = ptr_is_owned(b);
48139         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
48140         b_conv.is_owned = false;
48141         jboolean ret_conv = HTLCOutputInCommitment_eq(&a_conv, &b_conv);
48142         return ret_conv;
48143 }
48144
48145 int8_tArray  __attribute__((export_name("TS_HTLCOutputInCommitment_write"))) TS_HTLCOutputInCommitment_write(uint64_t obj) {
48146         LDKHTLCOutputInCommitment obj_conv;
48147         obj_conv.inner = untag_ptr(obj);
48148         obj_conv.is_owned = ptr_is_owned(obj);
48149         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
48150         obj_conv.is_owned = false;
48151         LDKCVec_u8Z ret_var = HTLCOutputInCommitment_write(&obj_conv);
48152         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
48153         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
48154         CVec_u8Z_free(ret_var);
48155         return ret_arr;
48156 }
48157
48158 uint64_t  __attribute__((export_name("TS_HTLCOutputInCommitment_read"))) TS_HTLCOutputInCommitment_read(int8_tArray ser) {
48159         LDKu8slice ser_ref;
48160         ser_ref.datalen = ser->arr_len;
48161         ser_ref.data = ser->elems;
48162         LDKCResult_HTLCOutputInCommitmentDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_HTLCOutputInCommitmentDecodeErrorZ), "LDKCResult_HTLCOutputInCommitmentDecodeErrorZ");
48163         *ret_conv = HTLCOutputInCommitment_read(ser_ref);
48164         FREE(ser);
48165         return tag_ptr(ret_conv, true);
48166 }
48167
48168 int8_tArray  __attribute__((export_name("TS_get_htlc_redeemscript"))) TS_get_htlc_redeemscript(uint64_t htlc, uint64_t channel_type_features, uint64_t keys) {
48169         LDKHTLCOutputInCommitment htlc_conv;
48170         htlc_conv.inner = untag_ptr(htlc);
48171         htlc_conv.is_owned = ptr_is_owned(htlc);
48172         CHECK_INNER_FIELD_ACCESS_OR_NULL(htlc_conv);
48173         htlc_conv.is_owned = false;
48174         LDKChannelTypeFeatures channel_type_features_conv;
48175         channel_type_features_conv.inner = untag_ptr(channel_type_features);
48176         channel_type_features_conv.is_owned = ptr_is_owned(channel_type_features);
48177         CHECK_INNER_FIELD_ACCESS_OR_NULL(channel_type_features_conv);
48178         channel_type_features_conv.is_owned = false;
48179         LDKTxCreationKeys keys_conv;
48180         keys_conv.inner = untag_ptr(keys);
48181         keys_conv.is_owned = ptr_is_owned(keys);
48182         CHECK_INNER_FIELD_ACCESS_OR_NULL(keys_conv);
48183         keys_conv.is_owned = false;
48184         LDKCVec_u8Z ret_var = get_htlc_redeemscript(&htlc_conv, &channel_type_features_conv, &keys_conv);
48185         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
48186         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
48187         CVec_u8Z_free(ret_var);
48188         return ret_arr;
48189 }
48190
48191 int8_tArray  __attribute__((export_name("TS_make_funding_redeemscript"))) TS_make_funding_redeemscript(int8_tArray broadcaster, int8_tArray countersignatory) {
48192         LDKPublicKey broadcaster_ref;
48193         CHECK(broadcaster->arr_len == 33);
48194         memcpy(broadcaster_ref.compressed_form, broadcaster->elems, 33); FREE(broadcaster);
48195         LDKPublicKey countersignatory_ref;
48196         CHECK(countersignatory->arr_len == 33);
48197         memcpy(countersignatory_ref.compressed_form, countersignatory->elems, 33); FREE(countersignatory);
48198         LDKCVec_u8Z ret_var = make_funding_redeemscript(broadcaster_ref, countersignatory_ref);
48199         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
48200         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
48201         CVec_u8Z_free(ret_var);
48202         return ret_arr;
48203 }
48204
48205 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) {
48206         uint8_t commitment_txid_arr[32];
48207         CHECK(commitment_txid->arr_len == 32);
48208         memcpy(commitment_txid_arr, commitment_txid->elems, 32); FREE(commitment_txid);
48209         uint8_t (*commitment_txid_ref)[32] = &commitment_txid_arr;
48210         LDKHTLCOutputInCommitment htlc_conv;
48211         htlc_conv.inner = untag_ptr(htlc);
48212         htlc_conv.is_owned = ptr_is_owned(htlc);
48213         CHECK_INNER_FIELD_ACCESS_OR_NULL(htlc_conv);
48214         htlc_conv.is_owned = false;
48215         LDKChannelTypeFeatures channel_type_features_conv;
48216         channel_type_features_conv.inner = untag_ptr(channel_type_features);
48217         channel_type_features_conv.is_owned = ptr_is_owned(channel_type_features);
48218         CHECK_INNER_FIELD_ACCESS_OR_NULL(channel_type_features_conv);
48219         channel_type_features_conv.is_owned = false;
48220         LDKPublicKey broadcaster_delayed_payment_key_ref;
48221         CHECK(broadcaster_delayed_payment_key->arr_len == 33);
48222         memcpy(broadcaster_delayed_payment_key_ref.compressed_form, broadcaster_delayed_payment_key->elems, 33); FREE(broadcaster_delayed_payment_key);
48223         LDKPublicKey revocation_key_ref;
48224         CHECK(revocation_key->arr_len == 33);
48225         memcpy(revocation_key_ref.compressed_form, revocation_key->elems, 33); FREE(revocation_key);
48226         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);
48227         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
48228         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
48229         Transaction_free(ret_var);
48230         return ret_arr;
48231 }
48232
48233 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) {
48234         LDKECDSASignature local_sig_ref;
48235         CHECK(local_sig->arr_len == 64);
48236         memcpy(local_sig_ref.compact_form, local_sig->elems, 64); FREE(local_sig);
48237         LDKECDSASignature remote_sig_ref;
48238         CHECK(remote_sig->arr_len == 64);
48239         memcpy(remote_sig_ref.compact_form, remote_sig->elems, 64); FREE(remote_sig);
48240         void* preimage_ptr = untag_ptr(preimage);
48241         CHECK_ACCESS(preimage_ptr);
48242         LDKCOption_ThirtyTwoBytesZ preimage_conv = *(LDKCOption_ThirtyTwoBytesZ*)(preimage_ptr);
48243         preimage_conv = COption_ThirtyTwoBytesZ_clone((LDKCOption_ThirtyTwoBytesZ*)untag_ptr(preimage));
48244         LDKu8slice redeem_script_ref;
48245         redeem_script_ref.datalen = redeem_script->arr_len;
48246         redeem_script_ref.data = redeem_script->elems;
48247         LDKChannelTypeFeatures channel_type_features_conv;
48248         channel_type_features_conv.inner = untag_ptr(channel_type_features);
48249         channel_type_features_conv.is_owned = ptr_is_owned(channel_type_features);
48250         CHECK_INNER_FIELD_ACCESS_OR_NULL(channel_type_features_conv);
48251         channel_type_features_conv.is_owned = false;
48252         LDKWitness ret_var = build_htlc_input_witness(local_sig_ref, remote_sig_ref, preimage_conv, redeem_script_ref, &channel_type_features_conv);
48253         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
48254         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
48255         Witness_free(ret_var);
48256         FREE(redeem_script);
48257         return ret_arr;
48258 }
48259
48260 int8_tArray  __attribute__((export_name("TS_get_to_countersignatory_with_anchors_redeemscript"))) TS_get_to_countersignatory_with_anchors_redeemscript(int8_tArray payment_point) {
48261         LDKPublicKey payment_point_ref;
48262         CHECK(payment_point->arr_len == 33);
48263         memcpy(payment_point_ref.compressed_form, payment_point->elems, 33); FREE(payment_point);
48264         LDKCVec_u8Z ret_var = get_to_countersignatory_with_anchors_redeemscript(payment_point_ref);
48265         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
48266         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
48267         CVec_u8Z_free(ret_var);
48268         return ret_arr;
48269 }
48270
48271 int8_tArray  __attribute__((export_name("TS_get_anchor_redeemscript"))) TS_get_anchor_redeemscript(int8_tArray funding_pubkey) {
48272         LDKPublicKey funding_pubkey_ref;
48273         CHECK(funding_pubkey->arr_len == 33);
48274         memcpy(funding_pubkey_ref.compressed_form, funding_pubkey->elems, 33); FREE(funding_pubkey);
48275         LDKCVec_u8Z ret_var = get_anchor_redeemscript(funding_pubkey_ref);
48276         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
48277         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
48278         CVec_u8Z_free(ret_var);
48279         return ret_arr;
48280 }
48281
48282 int8_tArray  __attribute__((export_name("TS_build_anchor_input_witness"))) TS_build_anchor_input_witness(int8_tArray funding_key, int8_tArray funding_sig) {
48283         LDKPublicKey funding_key_ref;
48284         CHECK(funding_key->arr_len == 33);
48285         memcpy(funding_key_ref.compressed_form, funding_key->elems, 33); FREE(funding_key);
48286         LDKECDSASignature funding_sig_ref;
48287         CHECK(funding_sig->arr_len == 64);
48288         memcpy(funding_sig_ref.compact_form, funding_sig->elems, 64); FREE(funding_sig);
48289         LDKWitness ret_var = build_anchor_input_witness(funding_key_ref, funding_sig_ref);
48290         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
48291         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
48292         Witness_free(ret_var);
48293         return ret_arr;
48294 }
48295
48296 void  __attribute__((export_name("TS_ChannelTransactionParameters_free"))) TS_ChannelTransactionParameters_free(uint64_t this_obj) {
48297         LDKChannelTransactionParameters this_obj_conv;
48298         this_obj_conv.inner = untag_ptr(this_obj);
48299         this_obj_conv.is_owned = ptr_is_owned(this_obj);
48300         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
48301         ChannelTransactionParameters_free(this_obj_conv);
48302 }
48303
48304 uint64_t  __attribute__((export_name("TS_ChannelTransactionParameters_get_holder_pubkeys"))) TS_ChannelTransactionParameters_get_holder_pubkeys(uint64_t this_ptr) {
48305         LDKChannelTransactionParameters this_ptr_conv;
48306         this_ptr_conv.inner = untag_ptr(this_ptr);
48307         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
48308         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
48309         this_ptr_conv.is_owned = false;
48310         LDKChannelPublicKeys ret_var = ChannelTransactionParameters_get_holder_pubkeys(&this_ptr_conv);
48311         uint64_t ret_ref = 0;
48312         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
48313         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
48314         return ret_ref;
48315 }
48316
48317 void  __attribute__((export_name("TS_ChannelTransactionParameters_set_holder_pubkeys"))) TS_ChannelTransactionParameters_set_holder_pubkeys(uint64_t this_ptr, uint64_t val) {
48318         LDKChannelTransactionParameters this_ptr_conv;
48319         this_ptr_conv.inner = untag_ptr(this_ptr);
48320         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
48321         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
48322         this_ptr_conv.is_owned = false;
48323         LDKChannelPublicKeys val_conv;
48324         val_conv.inner = untag_ptr(val);
48325         val_conv.is_owned = ptr_is_owned(val);
48326         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
48327         val_conv = ChannelPublicKeys_clone(&val_conv);
48328         ChannelTransactionParameters_set_holder_pubkeys(&this_ptr_conv, val_conv);
48329 }
48330
48331 int16_t  __attribute__((export_name("TS_ChannelTransactionParameters_get_holder_selected_contest_delay"))) TS_ChannelTransactionParameters_get_holder_selected_contest_delay(uint64_t this_ptr) {
48332         LDKChannelTransactionParameters this_ptr_conv;
48333         this_ptr_conv.inner = untag_ptr(this_ptr);
48334         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
48335         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
48336         this_ptr_conv.is_owned = false;
48337         int16_t ret_conv = ChannelTransactionParameters_get_holder_selected_contest_delay(&this_ptr_conv);
48338         return ret_conv;
48339 }
48340
48341 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) {
48342         LDKChannelTransactionParameters this_ptr_conv;
48343         this_ptr_conv.inner = untag_ptr(this_ptr);
48344         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
48345         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
48346         this_ptr_conv.is_owned = false;
48347         ChannelTransactionParameters_set_holder_selected_contest_delay(&this_ptr_conv, val);
48348 }
48349
48350 jboolean  __attribute__((export_name("TS_ChannelTransactionParameters_get_is_outbound_from_holder"))) TS_ChannelTransactionParameters_get_is_outbound_from_holder(uint64_t this_ptr) {
48351         LDKChannelTransactionParameters this_ptr_conv;
48352         this_ptr_conv.inner = untag_ptr(this_ptr);
48353         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
48354         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
48355         this_ptr_conv.is_owned = false;
48356         jboolean ret_conv = ChannelTransactionParameters_get_is_outbound_from_holder(&this_ptr_conv);
48357         return ret_conv;
48358 }
48359
48360 void  __attribute__((export_name("TS_ChannelTransactionParameters_set_is_outbound_from_holder"))) TS_ChannelTransactionParameters_set_is_outbound_from_holder(uint64_t this_ptr, jboolean val) {
48361         LDKChannelTransactionParameters this_ptr_conv;
48362         this_ptr_conv.inner = untag_ptr(this_ptr);
48363         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
48364         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
48365         this_ptr_conv.is_owned = false;
48366         ChannelTransactionParameters_set_is_outbound_from_holder(&this_ptr_conv, val);
48367 }
48368
48369 uint64_t  __attribute__((export_name("TS_ChannelTransactionParameters_get_counterparty_parameters"))) TS_ChannelTransactionParameters_get_counterparty_parameters(uint64_t this_ptr) {
48370         LDKChannelTransactionParameters this_ptr_conv;
48371         this_ptr_conv.inner = untag_ptr(this_ptr);
48372         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
48373         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
48374         this_ptr_conv.is_owned = false;
48375         LDKCounterpartyChannelTransactionParameters ret_var = ChannelTransactionParameters_get_counterparty_parameters(&this_ptr_conv);
48376         uint64_t ret_ref = 0;
48377         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
48378         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
48379         return ret_ref;
48380 }
48381
48382 void  __attribute__((export_name("TS_ChannelTransactionParameters_set_counterparty_parameters"))) TS_ChannelTransactionParameters_set_counterparty_parameters(uint64_t this_ptr, uint64_t val) {
48383         LDKChannelTransactionParameters this_ptr_conv;
48384         this_ptr_conv.inner = untag_ptr(this_ptr);
48385         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
48386         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
48387         this_ptr_conv.is_owned = false;
48388         LDKCounterpartyChannelTransactionParameters val_conv;
48389         val_conv.inner = untag_ptr(val);
48390         val_conv.is_owned = ptr_is_owned(val);
48391         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
48392         val_conv = CounterpartyChannelTransactionParameters_clone(&val_conv);
48393         ChannelTransactionParameters_set_counterparty_parameters(&this_ptr_conv, val_conv);
48394 }
48395
48396 uint64_t  __attribute__((export_name("TS_ChannelTransactionParameters_get_funding_outpoint"))) TS_ChannelTransactionParameters_get_funding_outpoint(uint64_t this_ptr) {
48397         LDKChannelTransactionParameters this_ptr_conv;
48398         this_ptr_conv.inner = untag_ptr(this_ptr);
48399         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
48400         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
48401         this_ptr_conv.is_owned = false;
48402         LDKOutPoint ret_var = ChannelTransactionParameters_get_funding_outpoint(&this_ptr_conv);
48403         uint64_t ret_ref = 0;
48404         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
48405         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
48406         return ret_ref;
48407 }
48408
48409 void  __attribute__((export_name("TS_ChannelTransactionParameters_set_funding_outpoint"))) TS_ChannelTransactionParameters_set_funding_outpoint(uint64_t this_ptr, uint64_t val) {
48410         LDKChannelTransactionParameters this_ptr_conv;
48411         this_ptr_conv.inner = untag_ptr(this_ptr);
48412         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
48413         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
48414         this_ptr_conv.is_owned = false;
48415         LDKOutPoint val_conv;
48416         val_conv.inner = untag_ptr(val);
48417         val_conv.is_owned = ptr_is_owned(val);
48418         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
48419         val_conv = OutPoint_clone(&val_conv);
48420         ChannelTransactionParameters_set_funding_outpoint(&this_ptr_conv, val_conv);
48421 }
48422
48423 uint64_t  __attribute__((export_name("TS_ChannelTransactionParameters_get_channel_type_features"))) TS_ChannelTransactionParameters_get_channel_type_features(uint64_t this_ptr) {
48424         LDKChannelTransactionParameters this_ptr_conv;
48425         this_ptr_conv.inner = untag_ptr(this_ptr);
48426         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
48427         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
48428         this_ptr_conv.is_owned = false;
48429         LDKChannelTypeFeatures ret_var = ChannelTransactionParameters_get_channel_type_features(&this_ptr_conv);
48430         uint64_t ret_ref = 0;
48431         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
48432         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
48433         return ret_ref;
48434 }
48435
48436 void  __attribute__((export_name("TS_ChannelTransactionParameters_set_channel_type_features"))) TS_ChannelTransactionParameters_set_channel_type_features(uint64_t this_ptr, uint64_t val) {
48437         LDKChannelTransactionParameters this_ptr_conv;
48438         this_ptr_conv.inner = untag_ptr(this_ptr);
48439         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
48440         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
48441         this_ptr_conv.is_owned = false;
48442         LDKChannelTypeFeatures val_conv;
48443         val_conv.inner = untag_ptr(val);
48444         val_conv.is_owned = ptr_is_owned(val);
48445         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
48446         val_conv = ChannelTypeFeatures_clone(&val_conv);
48447         ChannelTransactionParameters_set_channel_type_features(&this_ptr_conv, val_conv);
48448 }
48449
48450 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) {
48451         LDKChannelPublicKeys holder_pubkeys_arg_conv;
48452         holder_pubkeys_arg_conv.inner = untag_ptr(holder_pubkeys_arg);
48453         holder_pubkeys_arg_conv.is_owned = ptr_is_owned(holder_pubkeys_arg);
48454         CHECK_INNER_FIELD_ACCESS_OR_NULL(holder_pubkeys_arg_conv);
48455         holder_pubkeys_arg_conv = ChannelPublicKeys_clone(&holder_pubkeys_arg_conv);
48456         LDKCounterpartyChannelTransactionParameters counterparty_parameters_arg_conv;
48457         counterparty_parameters_arg_conv.inner = untag_ptr(counterparty_parameters_arg);
48458         counterparty_parameters_arg_conv.is_owned = ptr_is_owned(counterparty_parameters_arg);
48459         CHECK_INNER_FIELD_ACCESS_OR_NULL(counterparty_parameters_arg_conv);
48460         counterparty_parameters_arg_conv = CounterpartyChannelTransactionParameters_clone(&counterparty_parameters_arg_conv);
48461         LDKOutPoint funding_outpoint_arg_conv;
48462         funding_outpoint_arg_conv.inner = untag_ptr(funding_outpoint_arg);
48463         funding_outpoint_arg_conv.is_owned = ptr_is_owned(funding_outpoint_arg);
48464         CHECK_INNER_FIELD_ACCESS_OR_NULL(funding_outpoint_arg_conv);
48465         funding_outpoint_arg_conv = OutPoint_clone(&funding_outpoint_arg_conv);
48466         LDKChannelTypeFeatures channel_type_features_arg_conv;
48467         channel_type_features_arg_conv.inner = untag_ptr(channel_type_features_arg);
48468         channel_type_features_arg_conv.is_owned = ptr_is_owned(channel_type_features_arg);
48469         CHECK_INNER_FIELD_ACCESS_OR_NULL(channel_type_features_arg_conv);
48470         channel_type_features_arg_conv = ChannelTypeFeatures_clone(&channel_type_features_arg_conv);
48471         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);
48472         uint64_t ret_ref = 0;
48473         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
48474         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
48475         return ret_ref;
48476 }
48477
48478 static inline uint64_t ChannelTransactionParameters_clone_ptr(LDKChannelTransactionParameters *NONNULL_PTR arg) {
48479         LDKChannelTransactionParameters ret_var = ChannelTransactionParameters_clone(arg);
48480         uint64_t ret_ref = 0;
48481         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
48482         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
48483         return ret_ref;
48484 }
48485 int64_t  __attribute__((export_name("TS_ChannelTransactionParameters_clone_ptr"))) TS_ChannelTransactionParameters_clone_ptr(uint64_t arg) {
48486         LDKChannelTransactionParameters arg_conv;
48487         arg_conv.inner = untag_ptr(arg);
48488         arg_conv.is_owned = ptr_is_owned(arg);
48489         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
48490         arg_conv.is_owned = false;
48491         int64_t ret_conv = ChannelTransactionParameters_clone_ptr(&arg_conv);
48492         return ret_conv;
48493 }
48494
48495 uint64_t  __attribute__((export_name("TS_ChannelTransactionParameters_clone"))) TS_ChannelTransactionParameters_clone(uint64_t orig) {
48496         LDKChannelTransactionParameters orig_conv;
48497         orig_conv.inner = untag_ptr(orig);
48498         orig_conv.is_owned = ptr_is_owned(orig);
48499         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
48500         orig_conv.is_owned = false;
48501         LDKChannelTransactionParameters ret_var = ChannelTransactionParameters_clone(&orig_conv);
48502         uint64_t ret_ref = 0;
48503         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
48504         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
48505         return ret_ref;
48506 }
48507
48508 int64_t  __attribute__((export_name("TS_ChannelTransactionParameters_hash"))) TS_ChannelTransactionParameters_hash(uint64_t o) {
48509         LDKChannelTransactionParameters o_conv;
48510         o_conv.inner = untag_ptr(o);
48511         o_conv.is_owned = ptr_is_owned(o);
48512         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
48513         o_conv.is_owned = false;
48514         int64_t ret_conv = ChannelTransactionParameters_hash(&o_conv);
48515         return ret_conv;
48516 }
48517
48518 jboolean  __attribute__((export_name("TS_ChannelTransactionParameters_eq"))) TS_ChannelTransactionParameters_eq(uint64_t a, uint64_t b) {
48519         LDKChannelTransactionParameters a_conv;
48520         a_conv.inner = untag_ptr(a);
48521         a_conv.is_owned = ptr_is_owned(a);
48522         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
48523         a_conv.is_owned = false;
48524         LDKChannelTransactionParameters b_conv;
48525         b_conv.inner = untag_ptr(b);
48526         b_conv.is_owned = ptr_is_owned(b);
48527         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
48528         b_conv.is_owned = false;
48529         jboolean ret_conv = ChannelTransactionParameters_eq(&a_conv, &b_conv);
48530         return ret_conv;
48531 }
48532
48533 void  __attribute__((export_name("TS_CounterpartyChannelTransactionParameters_free"))) TS_CounterpartyChannelTransactionParameters_free(uint64_t this_obj) {
48534         LDKCounterpartyChannelTransactionParameters this_obj_conv;
48535         this_obj_conv.inner = untag_ptr(this_obj);
48536         this_obj_conv.is_owned = ptr_is_owned(this_obj);
48537         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
48538         CounterpartyChannelTransactionParameters_free(this_obj_conv);
48539 }
48540
48541 uint64_t  __attribute__((export_name("TS_CounterpartyChannelTransactionParameters_get_pubkeys"))) TS_CounterpartyChannelTransactionParameters_get_pubkeys(uint64_t this_ptr) {
48542         LDKCounterpartyChannelTransactionParameters this_ptr_conv;
48543         this_ptr_conv.inner = untag_ptr(this_ptr);
48544         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
48545         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
48546         this_ptr_conv.is_owned = false;
48547         LDKChannelPublicKeys ret_var = CounterpartyChannelTransactionParameters_get_pubkeys(&this_ptr_conv);
48548         uint64_t ret_ref = 0;
48549         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
48550         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
48551         return ret_ref;
48552 }
48553
48554 void  __attribute__((export_name("TS_CounterpartyChannelTransactionParameters_set_pubkeys"))) TS_CounterpartyChannelTransactionParameters_set_pubkeys(uint64_t this_ptr, uint64_t val) {
48555         LDKCounterpartyChannelTransactionParameters this_ptr_conv;
48556         this_ptr_conv.inner = untag_ptr(this_ptr);
48557         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
48558         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
48559         this_ptr_conv.is_owned = false;
48560         LDKChannelPublicKeys val_conv;
48561         val_conv.inner = untag_ptr(val);
48562         val_conv.is_owned = ptr_is_owned(val);
48563         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
48564         val_conv = ChannelPublicKeys_clone(&val_conv);
48565         CounterpartyChannelTransactionParameters_set_pubkeys(&this_ptr_conv, val_conv);
48566 }
48567
48568 int16_t  __attribute__((export_name("TS_CounterpartyChannelTransactionParameters_get_selected_contest_delay"))) TS_CounterpartyChannelTransactionParameters_get_selected_contest_delay(uint64_t this_ptr) {
48569         LDKCounterpartyChannelTransactionParameters this_ptr_conv;
48570         this_ptr_conv.inner = untag_ptr(this_ptr);
48571         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
48572         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
48573         this_ptr_conv.is_owned = false;
48574         int16_t ret_conv = CounterpartyChannelTransactionParameters_get_selected_contest_delay(&this_ptr_conv);
48575         return ret_conv;
48576 }
48577
48578 void  __attribute__((export_name("TS_CounterpartyChannelTransactionParameters_set_selected_contest_delay"))) TS_CounterpartyChannelTransactionParameters_set_selected_contest_delay(uint64_t this_ptr, int16_t val) {
48579         LDKCounterpartyChannelTransactionParameters this_ptr_conv;
48580         this_ptr_conv.inner = untag_ptr(this_ptr);
48581         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
48582         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
48583         this_ptr_conv.is_owned = false;
48584         CounterpartyChannelTransactionParameters_set_selected_contest_delay(&this_ptr_conv, val);
48585 }
48586
48587 uint64_t  __attribute__((export_name("TS_CounterpartyChannelTransactionParameters_new"))) TS_CounterpartyChannelTransactionParameters_new(uint64_t pubkeys_arg, int16_t selected_contest_delay_arg) {
48588         LDKChannelPublicKeys pubkeys_arg_conv;
48589         pubkeys_arg_conv.inner = untag_ptr(pubkeys_arg);
48590         pubkeys_arg_conv.is_owned = ptr_is_owned(pubkeys_arg);
48591         CHECK_INNER_FIELD_ACCESS_OR_NULL(pubkeys_arg_conv);
48592         pubkeys_arg_conv = ChannelPublicKeys_clone(&pubkeys_arg_conv);
48593         LDKCounterpartyChannelTransactionParameters ret_var = CounterpartyChannelTransactionParameters_new(pubkeys_arg_conv, selected_contest_delay_arg);
48594         uint64_t ret_ref = 0;
48595         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
48596         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
48597         return ret_ref;
48598 }
48599
48600 static inline uint64_t CounterpartyChannelTransactionParameters_clone_ptr(LDKCounterpartyChannelTransactionParameters *NONNULL_PTR arg) {
48601         LDKCounterpartyChannelTransactionParameters ret_var = CounterpartyChannelTransactionParameters_clone(arg);
48602         uint64_t ret_ref = 0;
48603         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
48604         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
48605         return ret_ref;
48606 }
48607 int64_t  __attribute__((export_name("TS_CounterpartyChannelTransactionParameters_clone_ptr"))) TS_CounterpartyChannelTransactionParameters_clone_ptr(uint64_t arg) {
48608         LDKCounterpartyChannelTransactionParameters arg_conv;
48609         arg_conv.inner = untag_ptr(arg);
48610         arg_conv.is_owned = ptr_is_owned(arg);
48611         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
48612         arg_conv.is_owned = false;
48613         int64_t ret_conv = CounterpartyChannelTransactionParameters_clone_ptr(&arg_conv);
48614         return ret_conv;
48615 }
48616
48617 uint64_t  __attribute__((export_name("TS_CounterpartyChannelTransactionParameters_clone"))) TS_CounterpartyChannelTransactionParameters_clone(uint64_t orig) {
48618         LDKCounterpartyChannelTransactionParameters orig_conv;
48619         orig_conv.inner = untag_ptr(orig);
48620         orig_conv.is_owned = ptr_is_owned(orig);
48621         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
48622         orig_conv.is_owned = false;
48623         LDKCounterpartyChannelTransactionParameters ret_var = CounterpartyChannelTransactionParameters_clone(&orig_conv);
48624         uint64_t ret_ref = 0;
48625         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
48626         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
48627         return ret_ref;
48628 }
48629
48630 int64_t  __attribute__((export_name("TS_CounterpartyChannelTransactionParameters_hash"))) TS_CounterpartyChannelTransactionParameters_hash(uint64_t o) {
48631         LDKCounterpartyChannelTransactionParameters o_conv;
48632         o_conv.inner = untag_ptr(o);
48633         o_conv.is_owned = ptr_is_owned(o);
48634         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
48635         o_conv.is_owned = false;
48636         int64_t ret_conv = CounterpartyChannelTransactionParameters_hash(&o_conv);
48637         return ret_conv;
48638 }
48639
48640 jboolean  __attribute__((export_name("TS_CounterpartyChannelTransactionParameters_eq"))) TS_CounterpartyChannelTransactionParameters_eq(uint64_t a, uint64_t b) {
48641         LDKCounterpartyChannelTransactionParameters a_conv;
48642         a_conv.inner = untag_ptr(a);
48643         a_conv.is_owned = ptr_is_owned(a);
48644         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
48645         a_conv.is_owned = false;
48646         LDKCounterpartyChannelTransactionParameters b_conv;
48647         b_conv.inner = untag_ptr(b);
48648         b_conv.is_owned = ptr_is_owned(b);
48649         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
48650         b_conv.is_owned = false;
48651         jboolean ret_conv = CounterpartyChannelTransactionParameters_eq(&a_conv, &b_conv);
48652         return ret_conv;
48653 }
48654
48655 jboolean  __attribute__((export_name("TS_ChannelTransactionParameters_is_populated"))) TS_ChannelTransactionParameters_is_populated(uint64_t this_arg) {
48656         LDKChannelTransactionParameters this_arg_conv;
48657         this_arg_conv.inner = untag_ptr(this_arg);
48658         this_arg_conv.is_owned = ptr_is_owned(this_arg);
48659         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
48660         this_arg_conv.is_owned = false;
48661         jboolean ret_conv = ChannelTransactionParameters_is_populated(&this_arg_conv);
48662         return ret_conv;
48663 }
48664
48665 uint64_t  __attribute__((export_name("TS_ChannelTransactionParameters_as_holder_broadcastable"))) TS_ChannelTransactionParameters_as_holder_broadcastable(uint64_t this_arg) {
48666         LDKChannelTransactionParameters this_arg_conv;
48667         this_arg_conv.inner = untag_ptr(this_arg);
48668         this_arg_conv.is_owned = ptr_is_owned(this_arg);
48669         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
48670         this_arg_conv.is_owned = false;
48671         LDKDirectedChannelTransactionParameters ret_var = ChannelTransactionParameters_as_holder_broadcastable(&this_arg_conv);
48672         uint64_t ret_ref = 0;
48673         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
48674         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
48675         return ret_ref;
48676 }
48677
48678 uint64_t  __attribute__((export_name("TS_ChannelTransactionParameters_as_counterparty_broadcastable"))) TS_ChannelTransactionParameters_as_counterparty_broadcastable(uint64_t this_arg) {
48679         LDKChannelTransactionParameters this_arg_conv;
48680         this_arg_conv.inner = untag_ptr(this_arg);
48681         this_arg_conv.is_owned = ptr_is_owned(this_arg);
48682         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
48683         this_arg_conv.is_owned = false;
48684         LDKDirectedChannelTransactionParameters ret_var = ChannelTransactionParameters_as_counterparty_broadcastable(&this_arg_conv);
48685         uint64_t ret_ref = 0;
48686         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
48687         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
48688         return ret_ref;
48689 }
48690
48691 int8_tArray  __attribute__((export_name("TS_CounterpartyChannelTransactionParameters_write"))) TS_CounterpartyChannelTransactionParameters_write(uint64_t obj) {
48692         LDKCounterpartyChannelTransactionParameters obj_conv;
48693         obj_conv.inner = untag_ptr(obj);
48694         obj_conv.is_owned = ptr_is_owned(obj);
48695         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
48696         obj_conv.is_owned = false;
48697         LDKCVec_u8Z ret_var = CounterpartyChannelTransactionParameters_write(&obj_conv);
48698         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
48699         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
48700         CVec_u8Z_free(ret_var);
48701         return ret_arr;
48702 }
48703
48704 uint64_t  __attribute__((export_name("TS_CounterpartyChannelTransactionParameters_read"))) TS_CounterpartyChannelTransactionParameters_read(int8_tArray ser) {
48705         LDKu8slice ser_ref;
48706         ser_ref.datalen = ser->arr_len;
48707         ser_ref.data = ser->elems;
48708         LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ), "LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ");
48709         *ret_conv = CounterpartyChannelTransactionParameters_read(ser_ref);
48710         FREE(ser);
48711         return tag_ptr(ret_conv, true);
48712 }
48713
48714 int8_tArray  __attribute__((export_name("TS_ChannelTransactionParameters_write"))) TS_ChannelTransactionParameters_write(uint64_t obj) {
48715         LDKChannelTransactionParameters obj_conv;
48716         obj_conv.inner = untag_ptr(obj);
48717         obj_conv.is_owned = ptr_is_owned(obj);
48718         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
48719         obj_conv.is_owned = false;
48720         LDKCVec_u8Z ret_var = ChannelTransactionParameters_write(&obj_conv);
48721         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
48722         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
48723         CVec_u8Z_free(ret_var);
48724         return ret_arr;
48725 }
48726
48727 uint64_t  __attribute__((export_name("TS_ChannelTransactionParameters_read"))) TS_ChannelTransactionParameters_read(int8_tArray ser) {
48728         LDKu8slice ser_ref;
48729         ser_ref.datalen = ser->arr_len;
48730         ser_ref.data = ser->elems;
48731         LDKCResult_ChannelTransactionParametersDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelTransactionParametersDecodeErrorZ), "LDKCResult_ChannelTransactionParametersDecodeErrorZ");
48732         *ret_conv = ChannelTransactionParameters_read(ser_ref);
48733         FREE(ser);
48734         return tag_ptr(ret_conv, true);
48735 }
48736
48737 void  __attribute__((export_name("TS_DirectedChannelTransactionParameters_free"))) TS_DirectedChannelTransactionParameters_free(uint64_t this_obj) {
48738         LDKDirectedChannelTransactionParameters this_obj_conv;
48739         this_obj_conv.inner = untag_ptr(this_obj);
48740         this_obj_conv.is_owned = ptr_is_owned(this_obj);
48741         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
48742         DirectedChannelTransactionParameters_free(this_obj_conv);
48743 }
48744
48745 uint64_t  __attribute__((export_name("TS_DirectedChannelTransactionParameters_broadcaster_pubkeys"))) TS_DirectedChannelTransactionParameters_broadcaster_pubkeys(uint64_t this_arg) {
48746         LDKDirectedChannelTransactionParameters this_arg_conv;
48747         this_arg_conv.inner = untag_ptr(this_arg);
48748         this_arg_conv.is_owned = ptr_is_owned(this_arg);
48749         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
48750         this_arg_conv.is_owned = false;
48751         LDKChannelPublicKeys ret_var = DirectedChannelTransactionParameters_broadcaster_pubkeys(&this_arg_conv);
48752         uint64_t ret_ref = 0;
48753         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
48754         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
48755         return ret_ref;
48756 }
48757
48758 uint64_t  __attribute__((export_name("TS_DirectedChannelTransactionParameters_countersignatory_pubkeys"))) TS_DirectedChannelTransactionParameters_countersignatory_pubkeys(uint64_t this_arg) {
48759         LDKDirectedChannelTransactionParameters this_arg_conv;
48760         this_arg_conv.inner = untag_ptr(this_arg);
48761         this_arg_conv.is_owned = ptr_is_owned(this_arg);
48762         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
48763         this_arg_conv.is_owned = false;
48764         LDKChannelPublicKeys ret_var = DirectedChannelTransactionParameters_countersignatory_pubkeys(&this_arg_conv);
48765         uint64_t ret_ref = 0;
48766         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
48767         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
48768         return ret_ref;
48769 }
48770
48771 int16_t  __attribute__((export_name("TS_DirectedChannelTransactionParameters_contest_delay"))) TS_DirectedChannelTransactionParameters_contest_delay(uint64_t this_arg) {
48772         LDKDirectedChannelTransactionParameters this_arg_conv;
48773         this_arg_conv.inner = untag_ptr(this_arg);
48774         this_arg_conv.is_owned = ptr_is_owned(this_arg);
48775         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
48776         this_arg_conv.is_owned = false;
48777         int16_t ret_conv = DirectedChannelTransactionParameters_contest_delay(&this_arg_conv);
48778         return ret_conv;
48779 }
48780
48781 jboolean  __attribute__((export_name("TS_DirectedChannelTransactionParameters_is_outbound"))) TS_DirectedChannelTransactionParameters_is_outbound(uint64_t this_arg) {
48782         LDKDirectedChannelTransactionParameters this_arg_conv;
48783         this_arg_conv.inner = untag_ptr(this_arg);
48784         this_arg_conv.is_owned = ptr_is_owned(this_arg);
48785         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
48786         this_arg_conv.is_owned = false;
48787         jboolean ret_conv = DirectedChannelTransactionParameters_is_outbound(&this_arg_conv);
48788         return ret_conv;
48789 }
48790
48791 uint64_t  __attribute__((export_name("TS_DirectedChannelTransactionParameters_funding_outpoint"))) TS_DirectedChannelTransactionParameters_funding_outpoint(uint64_t this_arg) {
48792         LDKDirectedChannelTransactionParameters this_arg_conv;
48793         this_arg_conv.inner = untag_ptr(this_arg);
48794         this_arg_conv.is_owned = ptr_is_owned(this_arg);
48795         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
48796         this_arg_conv.is_owned = false;
48797         LDKOutPoint ret_var = DirectedChannelTransactionParameters_funding_outpoint(&this_arg_conv);
48798         uint64_t ret_ref = 0;
48799         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
48800         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
48801         return ret_ref;
48802 }
48803
48804 uint64_t  __attribute__((export_name("TS_DirectedChannelTransactionParameters_channel_type_features"))) TS_DirectedChannelTransactionParameters_channel_type_features(uint64_t this_arg) {
48805         LDKDirectedChannelTransactionParameters this_arg_conv;
48806         this_arg_conv.inner = untag_ptr(this_arg);
48807         this_arg_conv.is_owned = ptr_is_owned(this_arg);
48808         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
48809         this_arg_conv.is_owned = false;
48810         LDKChannelTypeFeatures ret_var = DirectedChannelTransactionParameters_channel_type_features(&this_arg_conv);
48811         uint64_t ret_ref = 0;
48812         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
48813         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
48814         return ret_ref;
48815 }
48816
48817 void  __attribute__((export_name("TS_HolderCommitmentTransaction_free"))) TS_HolderCommitmentTransaction_free(uint64_t this_obj) {
48818         LDKHolderCommitmentTransaction this_obj_conv;
48819         this_obj_conv.inner = untag_ptr(this_obj);
48820         this_obj_conv.is_owned = ptr_is_owned(this_obj);
48821         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
48822         HolderCommitmentTransaction_free(this_obj_conv);
48823 }
48824
48825 int8_tArray  __attribute__((export_name("TS_HolderCommitmentTransaction_get_counterparty_sig"))) TS_HolderCommitmentTransaction_get_counterparty_sig(uint64_t this_ptr) {
48826         LDKHolderCommitmentTransaction this_ptr_conv;
48827         this_ptr_conv.inner = untag_ptr(this_ptr);
48828         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
48829         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
48830         this_ptr_conv.is_owned = false;
48831         int8_tArray ret_arr = init_int8_tArray(64, __LINE__);
48832         memcpy(ret_arr->elems, HolderCommitmentTransaction_get_counterparty_sig(&this_ptr_conv).compact_form, 64);
48833         return ret_arr;
48834 }
48835
48836 void  __attribute__((export_name("TS_HolderCommitmentTransaction_set_counterparty_sig"))) TS_HolderCommitmentTransaction_set_counterparty_sig(uint64_t this_ptr, int8_tArray val) {
48837         LDKHolderCommitmentTransaction this_ptr_conv;
48838         this_ptr_conv.inner = untag_ptr(this_ptr);
48839         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
48840         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
48841         this_ptr_conv.is_owned = false;
48842         LDKECDSASignature val_ref;
48843         CHECK(val->arr_len == 64);
48844         memcpy(val_ref.compact_form, val->elems, 64); FREE(val);
48845         HolderCommitmentTransaction_set_counterparty_sig(&this_ptr_conv, val_ref);
48846 }
48847
48848 ptrArray  __attribute__((export_name("TS_HolderCommitmentTransaction_get_counterparty_htlc_sigs"))) TS_HolderCommitmentTransaction_get_counterparty_htlc_sigs(uint64_t this_ptr) {
48849         LDKHolderCommitmentTransaction this_ptr_conv;
48850         this_ptr_conv.inner = untag_ptr(this_ptr);
48851         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
48852         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
48853         this_ptr_conv.is_owned = false;
48854         LDKCVec_ECDSASignatureZ ret_var = HolderCommitmentTransaction_get_counterparty_htlc_sigs(&this_ptr_conv);
48855         ptrArray ret_arr = NULL;
48856         ret_arr = init_ptrArray(ret_var.datalen, __LINE__);
48857         int8_tArray *ret_arr_ptr = (int8_tArray*)(((uint8_t*)ret_arr) + 8);
48858         for (size_t m = 0; m < ret_var.datalen; m++) {
48859                 int8_tArray ret_conv_12_arr = init_int8_tArray(64, __LINE__);
48860                 memcpy(ret_conv_12_arr->elems, ret_var.data[m].compact_form, 64);
48861                 ret_arr_ptr[m] = ret_conv_12_arr;
48862         }
48863         
48864         FREE(ret_var.data);
48865         return ret_arr;
48866 }
48867
48868 void  __attribute__((export_name("TS_HolderCommitmentTransaction_set_counterparty_htlc_sigs"))) TS_HolderCommitmentTransaction_set_counterparty_htlc_sigs(uint64_t this_ptr, ptrArray val) {
48869         LDKHolderCommitmentTransaction this_ptr_conv;
48870         this_ptr_conv.inner = untag_ptr(this_ptr);
48871         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
48872         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
48873         this_ptr_conv.is_owned = false;
48874         LDKCVec_ECDSASignatureZ val_constr;
48875         val_constr.datalen = val->arr_len;
48876         if (val_constr.datalen > 0)
48877                 val_constr.data = MALLOC(val_constr.datalen * sizeof(LDKECDSASignature), "LDKCVec_ECDSASignatureZ Elements");
48878         else
48879                 val_constr.data = NULL;
48880         int8_tArray* val_vals = (void*) val->elems;
48881         for (size_t m = 0; m < val_constr.datalen; m++) {
48882                 int8_tArray val_conv_12 = val_vals[m];
48883                 LDKECDSASignature val_conv_12_ref;
48884                 CHECK(val_conv_12->arr_len == 64);
48885                 memcpy(val_conv_12_ref.compact_form, val_conv_12->elems, 64); FREE(val_conv_12);
48886                 val_constr.data[m] = val_conv_12_ref;
48887         }
48888         FREE(val);
48889         HolderCommitmentTransaction_set_counterparty_htlc_sigs(&this_ptr_conv, val_constr);
48890 }
48891
48892 static inline uint64_t HolderCommitmentTransaction_clone_ptr(LDKHolderCommitmentTransaction *NONNULL_PTR arg) {
48893         LDKHolderCommitmentTransaction ret_var = HolderCommitmentTransaction_clone(arg);
48894         uint64_t ret_ref = 0;
48895         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
48896         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
48897         return ret_ref;
48898 }
48899 int64_t  __attribute__((export_name("TS_HolderCommitmentTransaction_clone_ptr"))) TS_HolderCommitmentTransaction_clone_ptr(uint64_t arg) {
48900         LDKHolderCommitmentTransaction arg_conv;
48901         arg_conv.inner = untag_ptr(arg);
48902         arg_conv.is_owned = ptr_is_owned(arg);
48903         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
48904         arg_conv.is_owned = false;
48905         int64_t ret_conv = HolderCommitmentTransaction_clone_ptr(&arg_conv);
48906         return ret_conv;
48907 }
48908
48909 uint64_t  __attribute__((export_name("TS_HolderCommitmentTransaction_clone"))) TS_HolderCommitmentTransaction_clone(uint64_t orig) {
48910         LDKHolderCommitmentTransaction orig_conv;
48911         orig_conv.inner = untag_ptr(orig);
48912         orig_conv.is_owned = ptr_is_owned(orig);
48913         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
48914         orig_conv.is_owned = false;
48915         LDKHolderCommitmentTransaction ret_var = HolderCommitmentTransaction_clone(&orig_conv);
48916         uint64_t ret_ref = 0;
48917         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
48918         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
48919         return ret_ref;
48920 }
48921
48922 int8_tArray  __attribute__((export_name("TS_HolderCommitmentTransaction_write"))) TS_HolderCommitmentTransaction_write(uint64_t obj) {
48923         LDKHolderCommitmentTransaction obj_conv;
48924         obj_conv.inner = untag_ptr(obj);
48925         obj_conv.is_owned = ptr_is_owned(obj);
48926         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
48927         obj_conv.is_owned = false;
48928         LDKCVec_u8Z ret_var = HolderCommitmentTransaction_write(&obj_conv);
48929         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
48930         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
48931         CVec_u8Z_free(ret_var);
48932         return ret_arr;
48933 }
48934
48935 uint64_t  __attribute__((export_name("TS_HolderCommitmentTransaction_read"))) TS_HolderCommitmentTransaction_read(int8_tArray ser) {
48936         LDKu8slice ser_ref;
48937         ser_ref.datalen = ser->arr_len;
48938         ser_ref.data = ser->elems;
48939         LDKCResult_HolderCommitmentTransactionDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_HolderCommitmentTransactionDecodeErrorZ), "LDKCResult_HolderCommitmentTransactionDecodeErrorZ");
48940         *ret_conv = HolderCommitmentTransaction_read(ser_ref);
48941         FREE(ser);
48942         return tag_ptr(ret_conv, true);
48943 }
48944
48945 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) {
48946         LDKCommitmentTransaction commitment_tx_conv;
48947         commitment_tx_conv.inner = untag_ptr(commitment_tx);
48948         commitment_tx_conv.is_owned = ptr_is_owned(commitment_tx);
48949         CHECK_INNER_FIELD_ACCESS_OR_NULL(commitment_tx_conv);
48950         commitment_tx_conv = CommitmentTransaction_clone(&commitment_tx_conv);
48951         LDKECDSASignature counterparty_sig_ref;
48952         CHECK(counterparty_sig->arr_len == 64);
48953         memcpy(counterparty_sig_ref.compact_form, counterparty_sig->elems, 64); FREE(counterparty_sig);
48954         LDKCVec_ECDSASignatureZ counterparty_htlc_sigs_constr;
48955         counterparty_htlc_sigs_constr.datalen = counterparty_htlc_sigs->arr_len;
48956         if (counterparty_htlc_sigs_constr.datalen > 0)
48957                 counterparty_htlc_sigs_constr.data = MALLOC(counterparty_htlc_sigs_constr.datalen * sizeof(LDKECDSASignature), "LDKCVec_ECDSASignatureZ Elements");
48958         else
48959                 counterparty_htlc_sigs_constr.data = NULL;
48960         int8_tArray* counterparty_htlc_sigs_vals = (void*) counterparty_htlc_sigs->elems;
48961         for (size_t m = 0; m < counterparty_htlc_sigs_constr.datalen; m++) {
48962                 int8_tArray counterparty_htlc_sigs_conv_12 = counterparty_htlc_sigs_vals[m];
48963                 LDKECDSASignature counterparty_htlc_sigs_conv_12_ref;
48964                 CHECK(counterparty_htlc_sigs_conv_12->arr_len == 64);
48965                 memcpy(counterparty_htlc_sigs_conv_12_ref.compact_form, counterparty_htlc_sigs_conv_12->elems, 64); FREE(counterparty_htlc_sigs_conv_12);
48966                 counterparty_htlc_sigs_constr.data[m] = counterparty_htlc_sigs_conv_12_ref;
48967         }
48968         FREE(counterparty_htlc_sigs);
48969         LDKPublicKey holder_funding_key_ref;
48970         CHECK(holder_funding_key->arr_len == 33);
48971         memcpy(holder_funding_key_ref.compressed_form, holder_funding_key->elems, 33); FREE(holder_funding_key);
48972         LDKPublicKey counterparty_funding_key_ref;
48973         CHECK(counterparty_funding_key->arr_len == 33);
48974         memcpy(counterparty_funding_key_ref.compressed_form, counterparty_funding_key->elems, 33); FREE(counterparty_funding_key);
48975         LDKHolderCommitmentTransaction ret_var = HolderCommitmentTransaction_new(commitment_tx_conv, counterparty_sig_ref, counterparty_htlc_sigs_constr, holder_funding_key_ref, counterparty_funding_key_ref);
48976         uint64_t ret_ref = 0;
48977         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
48978         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
48979         return ret_ref;
48980 }
48981
48982 void  __attribute__((export_name("TS_BuiltCommitmentTransaction_free"))) TS_BuiltCommitmentTransaction_free(uint64_t this_obj) {
48983         LDKBuiltCommitmentTransaction this_obj_conv;
48984         this_obj_conv.inner = untag_ptr(this_obj);
48985         this_obj_conv.is_owned = ptr_is_owned(this_obj);
48986         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
48987         BuiltCommitmentTransaction_free(this_obj_conv);
48988 }
48989
48990 int8_tArray  __attribute__((export_name("TS_BuiltCommitmentTransaction_get_transaction"))) TS_BuiltCommitmentTransaction_get_transaction(uint64_t this_ptr) {
48991         LDKBuiltCommitmentTransaction this_ptr_conv;
48992         this_ptr_conv.inner = untag_ptr(this_ptr);
48993         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
48994         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
48995         this_ptr_conv.is_owned = false;
48996         LDKTransaction ret_var = BuiltCommitmentTransaction_get_transaction(&this_ptr_conv);
48997         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
48998         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
48999         Transaction_free(ret_var);
49000         return ret_arr;
49001 }
49002
49003 void  __attribute__((export_name("TS_BuiltCommitmentTransaction_set_transaction"))) TS_BuiltCommitmentTransaction_set_transaction(uint64_t this_ptr, int8_tArray val) {
49004         LDKBuiltCommitmentTransaction this_ptr_conv;
49005         this_ptr_conv.inner = untag_ptr(this_ptr);
49006         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
49007         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
49008         this_ptr_conv.is_owned = false;
49009         LDKTransaction val_ref;
49010         val_ref.datalen = val->arr_len;
49011         val_ref.data = MALLOC(val_ref.datalen, "LDKTransaction Bytes");
49012         memcpy(val_ref.data, val->elems, val_ref.datalen); FREE(val);
49013         val_ref.data_is_owned = true;
49014         BuiltCommitmentTransaction_set_transaction(&this_ptr_conv, val_ref);
49015 }
49016
49017 int8_tArray  __attribute__((export_name("TS_BuiltCommitmentTransaction_get_txid"))) TS_BuiltCommitmentTransaction_get_txid(uint64_t this_ptr) {
49018         LDKBuiltCommitmentTransaction this_ptr_conv;
49019         this_ptr_conv.inner = untag_ptr(this_ptr);
49020         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
49021         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
49022         this_ptr_conv.is_owned = false;
49023         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
49024         memcpy(ret_arr->elems, *BuiltCommitmentTransaction_get_txid(&this_ptr_conv), 32);
49025         return ret_arr;
49026 }
49027
49028 void  __attribute__((export_name("TS_BuiltCommitmentTransaction_set_txid"))) TS_BuiltCommitmentTransaction_set_txid(uint64_t this_ptr, int8_tArray val) {
49029         LDKBuiltCommitmentTransaction this_ptr_conv;
49030         this_ptr_conv.inner = untag_ptr(this_ptr);
49031         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
49032         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
49033         this_ptr_conv.is_owned = false;
49034         LDKThirtyTwoBytes val_ref;
49035         CHECK(val->arr_len == 32);
49036         memcpy(val_ref.data, val->elems, 32); FREE(val);
49037         BuiltCommitmentTransaction_set_txid(&this_ptr_conv, val_ref);
49038 }
49039
49040 uint64_t  __attribute__((export_name("TS_BuiltCommitmentTransaction_new"))) TS_BuiltCommitmentTransaction_new(int8_tArray transaction_arg, int8_tArray txid_arg) {
49041         LDKTransaction transaction_arg_ref;
49042         transaction_arg_ref.datalen = transaction_arg->arr_len;
49043         transaction_arg_ref.data = MALLOC(transaction_arg_ref.datalen, "LDKTransaction Bytes");
49044         memcpy(transaction_arg_ref.data, transaction_arg->elems, transaction_arg_ref.datalen); FREE(transaction_arg);
49045         transaction_arg_ref.data_is_owned = true;
49046         LDKThirtyTwoBytes txid_arg_ref;
49047         CHECK(txid_arg->arr_len == 32);
49048         memcpy(txid_arg_ref.data, txid_arg->elems, 32); FREE(txid_arg);
49049         LDKBuiltCommitmentTransaction ret_var = BuiltCommitmentTransaction_new(transaction_arg_ref, txid_arg_ref);
49050         uint64_t ret_ref = 0;
49051         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
49052         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
49053         return ret_ref;
49054 }
49055
49056 static inline uint64_t BuiltCommitmentTransaction_clone_ptr(LDKBuiltCommitmentTransaction *NONNULL_PTR arg) {
49057         LDKBuiltCommitmentTransaction ret_var = BuiltCommitmentTransaction_clone(arg);
49058         uint64_t ret_ref = 0;
49059         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
49060         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
49061         return ret_ref;
49062 }
49063 int64_t  __attribute__((export_name("TS_BuiltCommitmentTransaction_clone_ptr"))) TS_BuiltCommitmentTransaction_clone_ptr(uint64_t arg) {
49064         LDKBuiltCommitmentTransaction arg_conv;
49065         arg_conv.inner = untag_ptr(arg);
49066         arg_conv.is_owned = ptr_is_owned(arg);
49067         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
49068         arg_conv.is_owned = false;
49069         int64_t ret_conv = BuiltCommitmentTransaction_clone_ptr(&arg_conv);
49070         return ret_conv;
49071 }
49072
49073 uint64_t  __attribute__((export_name("TS_BuiltCommitmentTransaction_clone"))) TS_BuiltCommitmentTransaction_clone(uint64_t orig) {
49074         LDKBuiltCommitmentTransaction orig_conv;
49075         orig_conv.inner = untag_ptr(orig);
49076         orig_conv.is_owned = ptr_is_owned(orig);
49077         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
49078         orig_conv.is_owned = false;
49079         LDKBuiltCommitmentTransaction ret_var = BuiltCommitmentTransaction_clone(&orig_conv);
49080         uint64_t ret_ref = 0;
49081         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
49082         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
49083         return ret_ref;
49084 }
49085
49086 int8_tArray  __attribute__((export_name("TS_BuiltCommitmentTransaction_write"))) TS_BuiltCommitmentTransaction_write(uint64_t obj) {
49087         LDKBuiltCommitmentTransaction obj_conv;
49088         obj_conv.inner = untag_ptr(obj);
49089         obj_conv.is_owned = ptr_is_owned(obj);
49090         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
49091         obj_conv.is_owned = false;
49092         LDKCVec_u8Z ret_var = BuiltCommitmentTransaction_write(&obj_conv);
49093         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
49094         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
49095         CVec_u8Z_free(ret_var);
49096         return ret_arr;
49097 }
49098
49099 uint64_t  __attribute__((export_name("TS_BuiltCommitmentTransaction_read"))) TS_BuiltCommitmentTransaction_read(int8_tArray ser) {
49100         LDKu8slice ser_ref;
49101         ser_ref.datalen = ser->arr_len;
49102         ser_ref.data = ser->elems;
49103         LDKCResult_BuiltCommitmentTransactionDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_BuiltCommitmentTransactionDecodeErrorZ), "LDKCResult_BuiltCommitmentTransactionDecodeErrorZ");
49104         *ret_conv = BuiltCommitmentTransaction_read(ser_ref);
49105         FREE(ser);
49106         return tag_ptr(ret_conv, true);
49107 }
49108
49109 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) {
49110         LDKBuiltCommitmentTransaction this_arg_conv;
49111         this_arg_conv.inner = untag_ptr(this_arg);
49112         this_arg_conv.is_owned = ptr_is_owned(this_arg);
49113         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
49114         this_arg_conv.is_owned = false;
49115         LDKu8slice funding_redeemscript_ref;
49116         funding_redeemscript_ref.datalen = funding_redeemscript->arr_len;
49117         funding_redeemscript_ref.data = funding_redeemscript->elems;
49118         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
49119         memcpy(ret_arr->elems, BuiltCommitmentTransaction_get_sighash_all(&this_arg_conv, funding_redeemscript_ref, channel_value_satoshis).data, 32);
49120         FREE(funding_redeemscript);
49121         return ret_arr;
49122 }
49123
49124 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) {
49125         LDKBuiltCommitmentTransaction this_arg_conv;
49126         this_arg_conv.inner = untag_ptr(this_arg);
49127         this_arg_conv.is_owned = ptr_is_owned(this_arg);
49128         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
49129         this_arg_conv.is_owned = false;
49130         uint8_t funding_key_arr[32];
49131         CHECK(funding_key->arr_len == 32);
49132         memcpy(funding_key_arr, funding_key->elems, 32); FREE(funding_key);
49133         uint8_t (*funding_key_ref)[32] = &funding_key_arr;
49134         LDKu8slice funding_redeemscript_ref;
49135         funding_redeemscript_ref.datalen = funding_redeemscript->arr_len;
49136         funding_redeemscript_ref.data = funding_redeemscript->elems;
49137         int8_tArray ret_arr = init_int8_tArray(64, __LINE__);
49138         memcpy(ret_arr->elems, BuiltCommitmentTransaction_sign_counterparty_commitment(&this_arg_conv, funding_key_ref, funding_redeemscript_ref, channel_value_satoshis).compact_form, 64);
49139         FREE(funding_redeemscript);
49140         return ret_arr;
49141 }
49142
49143 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) {
49144         LDKBuiltCommitmentTransaction this_arg_conv;
49145         this_arg_conv.inner = untag_ptr(this_arg);
49146         this_arg_conv.is_owned = ptr_is_owned(this_arg);
49147         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
49148         this_arg_conv.is_owned = false;
49149         uint8_t funding_key_arr[32];
49150         CHECK(funding_key->arr_len == 32);
49151         memcpy(funding_key_arr, funding_key->elems, 32); FREE(funding_key);
49152         uint8_t (*funding_key_ref)[32] = &funding_key_arr;
49153         LDKu8slice funding_redeemscript_ref;
49154         funding_redeemscript_ref.datalen = funding_redeemscript->arr_len;
49155         funding_redeemscript_ref.data = funding_redeemscript->elems;
49156         void* entropy_source_ptr = untag_ptr(entropy_source);
49157         if (ptr_is_owned(entropy_source)) { CHECK_ACCESS(entropy_source_ptr); }
49158         LDKEntropySource* entropy_source_conv = (LDKEntropySource*)entropy_source_ptr;
49159         int8_tArray ret_arr = init_int8_tArray(64, __LINE__);
49160         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);
49161         FREE(funding_redeemscript);
49162         return ret_arr;
49163 }
49164
49165 void  __attribute__((export_name("TS_ClosingTransaction_free"))) TS_ClosingTransaction_free(uint64_t this_obj) {
49166         LDKClosingTransaction this_obj_conv;
49167         this_obj_conv.inner = untag_ptr(this_obj);
49168         this_obj_conv.is_owned = ptr_is_owned(this_obj);
49169         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
49170         ClosingTransaction_free(this_obj_conv);
49171 }
49172
49173 static inline uint64_t ClosingTransaction_clone_ptr(LDKClosingTransaction *NONNULL_PTR arg) {
49174         LDKClosingTransaction ret_var = ClosingTransaction_clone(arg);
49175         uint64_t ret_ref = 0;
49176         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
49177         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
49178         return ret_ref;
49179 }
49180 int64_t  __attribute__((export_name("TS_ClosingTransaction_clone_ptr"))) TS_ClosingTransaction_clone_ptr(uint64_t arg) {
49181         LDKClosingTransaction arg_conv;
49182         arg_conv.inner = untag_ptr(arg);
49183         arg_conv.is_owned = ptr_is_owned(arg);
49184         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
49185         arg_conv.is_owned = false;
49186         int64_t ret_conv = ClosingTransaction_clone_ptr(&arg_conv);
49187         return ret_conv;
49188 }
49189
49190 uint64_t  __attribute__((export_name("TS_ClosingTransaction_clone"))) TS_ClosingTransaction_clone(uint64_t orig) {
49191         LDKClosingTransaction orig_conv;
49192         orig_conv.inner = untag_ptr(orig);
49193         orig_conv.is_owned = ptr_is_owned(orig);
49194         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
49195         orig_conv.is_owned = false;
49196         LDKClosingTransaction ret_var = ClosingTransaction_clone(&orig_conv);
49197         uint64_t ret_ref = 0;
49198         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
49199         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
49200         return ret_ref;
49201 }
49202
49203 int64_t  __attribute__((export_name("TS_ClosingTransaction_hash"))) TS_ClosingTransaction_hash(uint64_t o) {
49204         LDKClosingTransaction o_conv;
49205         o_conv.inner = untag_ptr(o);
49206         o_conv.is_owned = ptr_is_owned(o);
49207         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
49208         o_conv.is_owned = false;
49209         int64_t ret_conv = ClosingTransaction_hash(&o_conv);
49210         return ret_conv;
49211 }
49212
49213 jboolean  __attribute__((export_name("TS_ClosingTransaction_eq"))) TS_ClosingTransaction_eq(uint64_t a, uint64_t b) {
49214         LDKClosingTransaction a_conv;
49215         a_conv.inner = untag_ptr(a);
49216         a_conv.is_owned = ptr_is_owned(a);
49217         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
49218         a_conv.is_owned = false;
49219         LDKClosingTransaction b_conv;
49220         b_conv.inner = untag_ptr(b);
49221         b_conv.is_owned = ptr_is_owned(b);
49222         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
49223         b_conv.is_owned = false;
49224         jboolean ret_conv = ClosingTransaction_eq(&a_conv, &b_conv);
49225         return ret_conv;
49226 }
49227
49228 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) {
49229         LDKCVec_u8Z to_holder_script_ref;
49230         to_holder_script_ref.datalen = to_holder_script->arr_len;
49231         to_holder_script_ref.data = MALLOC(to_holder_script_ref.datalen, "LDKCVec_u8Z Bytes");
49232         memcpy(to_holder_script_ref.data, to_holder_script->elems, to_holder_script_ref.datalen); FREE(to_holder_script);
49233         LDKCVec_u8Z to_counterparty_script_ref;
49234         to_counterparty_script_ref.datalen = to_counterparty_script->arr_len;
49235         to_counterparty_script_ref.data = MALLOC(to_counterparty_script_ref.datalen, "LDKCVec_u8Z Bytes");
49236         memcpy(to_counterparty_script_ref.data, to_counterparty_script->elems, to_counterparty_script_ref.datalen); FREE(to_counterparty_script);
49237         LDKOutPoint funding_outpoint_conv;
49238         funding_outpoint_conv.inner = untag_ptr(funding_outpoint);
49239         funding_outpoint_conv.is_owned = ptr_is_owned(funding_outpoint);
49240         CHECK_INNER_FIELD_ACCESS_OR_NULL(funding_outpoint_conv);
49241         funding_outpoint_conv = OutPoint_clone(&funding_outpoint_conv);
49242         LDKClosingTransaction ret_var = ClosingTransaction_new(to_holder_value_sat, to_counterparty_value_sat, to_holder_script_ref, to_counterparty_script_ref, funding_outpoint_conv);
49243         uint64_t ret_ref = 0;
49244         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
49245         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
49246         return ret_ref;
49247 }
49248
49249 uint64_t  __attribute__((export_name("TS_ClosingTransaction_trust"))) TS_ClosingTransaction_trust(uint64_t this_arg) {
49250         LDKClosingTransaction this_arg_conv;
49251         this_arg_conv.inner = untag_ptr(this_arg);
49252         this_arg_conv.is_owned = ptr_is_owned(this_arg);
49253         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
49254         this_arg_conv.is_owned = false;
49255         LDKTrustedClosingTransaction ret_var = ClosingTransaction_trust(&this_arg_conv);
49256         uint64_t ret_ref = 0;
49257         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
49258         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
49259         return ret_ref;
49260 }
49261
49262 uint64_t  __attribute__((export_name("TS_ClosingTransaction_verify"))) TS_ClosingTransaction_verify(uint64_t this_arg, uint64_t funding_outpoint) {
49263         LDKClosingTransaction this_arg_conv;
49264         this_arg_conv.inner = untag_ptr(this_arg);
49265         this_arg_conv.is_owned = ptr_is_owned(this_arg);
49266         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
49267         this_arg_conv.is_owned = false;
49268         LDKOutPoint funding_outpoint_conv;
49269         funding_outpoint_conv.inner = untag_ptr(funding_outpoint);
49270         funding_outpoint_conv.is_owned = ptr_is_owned(funding_outpoint);
49271         CHECK_INNER_FIELD_ACCESS_OR_NULL(funding_outpoint_conv);
49272         funding_outpoint_conv = OutPoint_clone(&funding_outpoint_conv);
49273         LDKCResult_TrustedClosingTransactionNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_TrustedClosingTransactionNoneZ), "LDKCResult_TrustedClosingTransactionNoneZ");
49274         *ret_conv = ClosingTransaction_verify(&this_arg_conv, funding_outpoint_conv);
49275         return tag_ptr(ret_conv, true);
49276 }
49277
49278 int64_t  __attribute__((export_name("TS_ClosingTransaction_to_holder_value_sat"))) TS_ClosingTransaction_to_holder_value_sat(uint64_t this_arg) {
49279         LDKClosingTransaction this_arg_conv;
49280         this_arg_conv.inner = untag_ptr(this_arg);
49281         this_arg_conv.is_owned = ptr_is_owned(this_arg);
49282         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
49283         this_arg_conv.is_owned = false;
49284         int64_t ret_conv = ClosingTransaction_to_holder_value_sat(&this_arg_conv);
49285         return ret_conv;
49286 }
49287
49288 int64_t  __attribute__((export_name("TS_ClosingTransaction_to_counterparty_value_sat"))) TS_ClosingTransaction_to_counterparty_value_sat(uint64_t this_arg) {
49289         LDKClosingTransaction this_arg_conv;
49290         this_arg_conv.inner = untag_ptr(this_arg);
49291         this_arg_conv.is_owned = ptr_is_owned(this_arg);
49292         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
49293         this_arg_conv.is_owned = false;
49294         int64_t ret_conv = ClosingTransaction_to_counterparty_value_sat(&this_arg_conv);
49295         return ret_conv;
49296 }
49297
49298 int8_tArray  __attribute__((export_name("TS_ClosingTransaction_to_holder_script"))) TS_ClosingTransaction_to_holder_script(uint64_t this_arg) {
49299         LDKClosingTransaction this_arg_conv;
49300         this_arg_conv.inner = untag_ptr(this_arg);
49301         this_arg_conv.is_owned = ptr_is_owned(this_arg);
49302         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
49303         this_arg_conv.is_owned = false;
49304         LDKu8slice ret_var = ClosingTransaction_to_holder_script(&this_arg_conv);
49305         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
49306         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
49307         return ret_arr;
49308 }
49309
49310 int8_tArray  __attribute__((export_name("TS_ClosingTransaction_to_counterparty_script"))) TS_ClosingTransaction_to_counterparty_script(uint64_t this_arg) {
49311         LDKClosingTransaction this_arg_conv;
49312         this_arg_conv.inner = untag_ptr(this_arg);
49313         this_arg_conv.is_owned = ptr_is_owned(this_arg);
49314         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
49315         this_arg_conv.is_owned = false;
49316         LDKu8slice ret_var = ClosingTransaction_to_counterparty_script(&this_arg_conv);
49317         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
49318         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
49319         return ret_arr;
49320 }
49321
49322 void  __attribute__((export_name("TS_TrustedClosingTransaction_free"))) TS_TrustedClosingTransaction_free(uint64_t this_obj) {
49323         LDKTrustedClosingTransaction this_obj_conv;
49324         this_obj_conv.inner = untag_ptr(this_obj);
49325         this_obj_conv.is_owned = ptr_is_owned(this_obj);
49326         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
49327         TrustedClosingTransaction_free(this_obj_conv);
49328 }
49329
49330 int8_tArray  __attribute__((export_name("TS_TrustedClosingTransaction_built_transaction"))) TS_TrustedClosingTransaction_built_transaction(uint64_t this_arg) {
49331         LDKTrustedClosingTransaction this_arg_conv;
49332         this_arg_conv.inner = untag_ptr(this_arg);
49333         this_arg_conv.is_owned = ptr_is_owned(this_arg);
49334         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
49335         this_arg_conv.is_owned = false;
49336         LDKTransaction ret_var = TrustedClosingTransaction_built_transaction(&this_arg_conv);
49337         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
49338         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
49339         Transaction_free(ret_var);
49340         return ret_arr;
49341 }
49342
49343 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) {
49344         LDKTrustedClosingTransaction this_arg_conv;
49345         this_arg_conv.inner = untag_ptr(this_arg);
49346         this_arg_conv.is_owned = ptr_is_owned(this_arg);
49347         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
49348         this_arg_conv.is_owned = false;
49349         LDKu8slice funding_redeemscript_ref;
49350         funding_redeemscript_ref.datalen = funding_redeemscript->arr_len;
49351         funding_redeemscript_ref.data = funding_redeemscript->elems;
49352         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
49353         memcpy(ret_arr->elems, TrustedClosingTransaction_get_sighash_all(&this_arg_conv, funding_redeemscript_ref, channel_value_satoshis).data, 32);
49354         FREE(funding_redeemscript);
49355         return ret_arr;
49356 }
49357
49358 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) {
49359         LDKTrustedClosingTransaction this_arg_conv;
49360         this_arg_conv.inner = untag_ptr(this_arg);
49361         this_arg_conv.is_owned = ptr_is_owned(this_arg);
49362         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
49363         this_arg_conv.is_owned = false;
49364         uint8_t funding_key_arr[32];
49365         CHECK(funding_key->arr_len == 32);
49366         memcpy(funding_key_arr, funding_key->elems, 32); FREE(funding_key);
49367         uint8_t (*funding_key_ref)[32] = &funding_key_arr;
49368         LDKu8slice funding_redeemscript_ref;
49369         funding_redeemscript_ref.datalen = funding_redeemscript->arr_len;
49370         funding_redeemscript_ref.data = funding_redeemscript->elems;
49371         int8_tArray ret_arr = init_int8_tArray(64, __LINE__);
49372         memcpy(ret_arr->elems, TrustedClosingTransaction_sign(&this_arg_conv, funding_key_ref, funding_redeemscript_ref, channel_value_satoshis).compact_form, 64);
49373         FREE(funding_redeemscript);
49374         return ret_arr;
49375 }
49376
49377 void  __attribute__((export_name("TS_CommitmentTransaction_free"))) TS_CommitmentTransaction_free(uint64_t this_obj) {
49378         LDKCommitmentTransaction this_obj_conv;
49379         this_obj_conv.inner = untag_ptr(this_obj);
49380         this_obj_conv.is_owned = ptr_is_owned(this_obj);
49381         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
49382         CommitmentTransaction_free(this_obj_conv);
49383 }
49384
49385 static inline uint64_t CommitmentTransaction_clone_ptr(LDKCommitmentTransaction *NONNULL_PTR arg) {
49386         LDKCommitmentTransaction ret_var = CommitmentTransaction_clone(arg);
49387         uint64_t ret_ref = 0;
49388         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
49389         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
49390         return ret_ref;
49391 }
49392 int64_t  __attribute__((export_name("TS_CommitmentTransaction_clone_ptr"))) TS_CommitmentTransaction_clone_ptr(uint64_t arg) {
49393         LDKCommitmentTransaction arg_conv;
49394         arg_conv.inner = untag_ptr(arg);
49395         arg_conv.is_owned = ptr_is_owned(arg);
49396         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
49397         arg_conv.is_owned = false;
49398         int64_t ret_conv = CommitmentTransaction_clone_ptr(&arg_conv);
49399         return ret_conv;
49400 }
49401
49402 uint64_t  __attribute__((export_name("TS_CommitmentTransaction_clone"))) TS_CommitmentTransaction_clone(uint64_t orig) {
49403         LDKCommitmentTransaction orig_conv;
49404         orig_conv.inner = untag_ptr(orig);
49405         orig_conv.is_owned = ptr_is_owned(orig);
49406         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
49407         orig_conv.is_owned = false;
49408         LDKCommitmentTransaction ret_var = CommitmentTransaction_clone(&orig_conv);
49409         uint64_t ret_ref = 0;
49410         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
49411         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
49412         return ret_ref;
49413 }
49414
49415 int8_tArray  __attribute__((export_name("TS_CommitmentTransaction_write"))) TS_CommitmentTransaction_write(uint64_t obj) {
49416         LDKCommitmentTransaction obj_conv;
49417         obj_conv.inner = untag_ptr(obj);
49418         obj_conv.is_owned = ptr_is_owned(obj);
49419         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
49420         obj_conv.is_owned = false;
49421         LDKCVec_u8Z ret_var = CommitmentTransaction_write(&obj_conv);
49422         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
49423         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
49424         CVec_u8Z_free(ret_var);
49425         return ret_arr;
49426 }
49427
49428 uint64_t  __attribute__((export_name("TS_CommitmentTransaction_read"))) TS_CommitmentTransaction_read(int8_tArray ser) {
49429         LDKu8slice ser_ref;
49430         ser_ref.datalen = ser->arr_len;
49431         ser_ref.data = ser->elems;
49432         LDKCResult_CommitmentTransactionDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CommitmentTransactionDecodeErrorZ), "LDKCResult_CommitmentTransactionDecodeErrorZ");
49433         *ret_conv = CommitmentTransaction_read(ser_ref);
49434         FREE(ser);
49435         return tag_ptr(ret_conv, true);
49436 }
49437
49438 int64_t  __attribute__((export_name("TS_CommitmentTransaction_commitment_number"))) TS_CommitmentTransaction_commitment_number(uint64_t this_arg) {
49439         LDKCommitmentTransaction this_arg_conv;
49440         this_arg_conv.inner = untag_ptr(this_arg);
49441         this_arg_conv.is_owned = ptr_is_owned(this_arg);
49442         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
49443         this_arg_conv.is_owned = false;
49444         int64_t ret_conv = CommitmentTransaction_commitment_number(&this_arg_conv);
49445         return ret_conv;
49446 }
49447
49448 int8_tArray  __attribute__((export_name("TS_CommitmentTransaction_per_commitment_point"))) TS_CommitmentTransaction_per_commitment_point(uint64_t this_arg) {
49449         LDKCommitmentTransaction this_arg_conv;
49450         this_arg_conv.inner = untag_ptr(this_arg);
49451         this_arg_conv.is_owned = ptr_is_owned(this_arg);
49452         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
49453         this_arg_conv.is_owned = false;
49454         int8_tArray ret_arr = init_int8_tArray(33, __LINE__);
49455         memcpy(ret_arr->elems, CommitmentTransaction_per_commitment_point(&this_arg_conv).compressed_form, 33);
49456         return ret_arr;
49457 }
49458
49459 int64_t  __attribute__((export_name("TS_CommitmentTransaction_to_broadcaster_value_sat"))) TS_CommitmentTransaction_to_broadcaster_value_sat(uint64_t this_arg) {
49460         LDKCommitmentTransaction this_arg_conv;
49461         this_arg_conv.inner = untag_ptr(this_arg);
49462         this_arg_conv.is_owned = ptr_is_owned(this_arg);
49463         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
49464         this_arg_conv.is_owned = false;
49465         int64_t ret_conv = CommitmentTransaction_to_broadcaster_value_sat(&this_arg_conv);
49466         return ret_conv;
49467 }
49468
49469 int64_t  __attribute__((export_name("TS_CommitmentTransaction_to_countersignatory_value_sat"))) TS_CommitmentTransaction_to_countersignatory_value_sat(uint64_t this_arg) {
49470         LDKCommitmentTransaction this_arg_conv;
49471         this_arg_conv.inner = untag_ptr(this_arg);
49472         this_arg_conv.is_owned = ptr_is_owned(this_arg);
49473         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
49474         this_arg_conv.is_owned = false;
49475         int64_t ret_conv = CommitmentTransaction_to_countersignatory_value_sat(&this_arg_conv);
49476         return ret_conv;
49477 }
49478
49479 int32_t  __attribute__((export_name("TS_CommitmentTransaction_feerate_per_kw"))) TS_CommitmentTransaction_feerate_per_kw(uint64_t this_arg) {
49480         LDKCommitmentTransaction this_arg_conv;
49481         this_arg_conv.inner = untag_ptr(this_arg);
49482         this_arg_conv.is_owned = ptr_is_owned(this_arg);
49483         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
49484         this_arg_conv.is_owned = false;
49485         int32_t ret_conv = CommitmentTransaction_feerate_per_kw(&this_arg_conv);
49486         return ret_conv;
49487 }
49488
49489 uint64_t  __attribute__((export_name("TS_CommitmentTransaction_trust"))) TS_CommitmentTransaction_trust(uint64_t this_arg) {
49490         LDKCommitmentTransaction this_arg_conv;
49491         this_arg_conv.inner = untag_ptr(this_arg);
49492         this_arg_conv.is_owned = ptr_is_owned(this_arg);
49493         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
49494         this_arg_conv.is_owned = false;
49495         LDKTrustedCommitmentTransaction ret_var = CommitmentTransaction_trust(&this_arg_conv);
49496         uint64_t ret_ref = 0;
49497         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
49498         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
49499         return ret_ref;
49500 }
49501
49502 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) {
49503         LDKCommitmentTransaction this_arg_conv;
49504         this_arg_conv.inner = untag_ptr(this_arg);
49505         this_arg_conv.is_owned = ptr_is_owned(this_arg);
49506         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
49507         this_arg_conv.is_owned = false;
49508         LDKDirectedChannelTransactionParameters channel_parameters_conv;
49509         channel_parameters_conv.inner = untag_ptr(channel_parameters);
49510         channel_parameters_conv.is_owned = ptr_is_owned(channel_parameters);
49511         CHECK_INNER_FIELD_ACCESS_OR_NULL(channel_parameters_conv);
49512         channel_parameters_conv.is_owned = false;
49513         LDKChannelPublicKeys broadcaster_keys_conv;
49514         broadcaster_keys_conv.inner = untag_ptr(broadcaster_keys);
49515         broadcaster_keys_conv.is_owned = ptr_is_owned(broadcaster_keys);
49516         CHECK_INNER_FIELD_ACCESS_OR_NULL(broadcaster_keys_conv);
49517         broadcaster_keys_conv.is_owned = false;
49518         LDKChannelPublicKeys countersignatory_keys_conv;
49519         countersignatory_keys_conv.inner = untag_ptr(countersignatory_keys);
49520         countersignatory_keys_conv.is_owned = ptr_is_owned(countersignatory_keys);
49521         CHECK_INNER_FIELD_ACCESS_OR_NULL(countersignatory_keys_conv);
49522         countersignatory_keys_conv.is_owned = false;
49523         LDKCResult_TrustedCommitmentTransactionNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_TrustedCommitmentTransactionNoneZ), "LDKCResult_TrustedCommitmentTransactionNoneZ");
49524         *ret_conv = CommitmentTransaction_verify(&this_arg_conv, &channel_parameters_conv, &broadcaster_keys_conv, &countersignatory_keys_conv);
49525         return tag_ptr(ret_conv, true);
49526 }
49527
49528 void  __attribute__((export_name("TS_TrustedCommitmentTransaction_free"))) TS_TrustedCommitmentTransaction_free(uint64_t this_obj) {
49529         LDKTrustedCommitmentTransaction this_obj_conv;
49530         this_obj_conv.inner = untag_ptr(this_obj);
49531         this_obj_conv.is_owned = ptr_is_owned(this_obj);
49532         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
49533         TrustedCommitmentTransaction_free(this_obj_conv);
49534 }
49535
49536 int8_tArray  __attribute__((export_name("TS_TrustedCommitmentTransaction_txid"))) TS_TrustedCommitmentTransaction_txid(uint64_t this_arg) {
49537         LDKTrustedCommitmentTransaction this_arg_conv;
49538         this_arg_conv.inner = untag_ptr(this_arg);
49539         this_arg_conv.is_owned = ptr_is_owned(this_arg);
49540         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
49541         this_arg_conv.is_owned = false;
49542         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
49543         memcpy(ret_arr->elems, TrustedCommitmentTransaction_txid(&this_arg_conv).data, 32);
49544         return ret_arr;
49545 }
49546
49547 uint64_t  __attribute__((export_name("TS_TrustedCommitmentTransaction_built_transaction"))) TS_TrustedCommitmentTransaction_built_transaction(uint64_t this_arg) {
49548         LDKTrustedCommitmentTransaction this_arg_conv;
49549         this_arg_conv.inner = untag_ptr(this_arg);
49550         this_arg_conv.is_owned = ptr_is_owned(this_arg);
49551         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
49552         this_arg_conv.is_owned = false;
49553         LDKBuiltCommitmentTransaction ret_var = TrustedCommitmentTransaction_built_transaction(&this_arg_conv);
49554         uint64_t ret_ref = 0;
49555         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
49556         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
49557         return ret_ref;
49558 }
49559
49560 uint64_t  __attribute__((export_name("TS_TrustedCommitmentTransaction_keys"))) TS_TrustedCommitmentTransaction_keys(uint64_t this_arg) {
49561         LDKTrustedCommitmentTransaction this_arg_conv;
49562         this_arg_conv.inner = untag_ptr(this_arg);
49563         this_arg_conv.is_owned = ptr_is_owned(this_arg);
49564         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
49565         this_arg_conv.is_owned = false;
49566         LDKTxCreationKeys ret_var = TrustedCommitmentTransaction_keys(&this_arg_conv);
49567         uint64_t ret_ref = 0;
49568         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
49569         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
49570         return ret_ref;
49571 }
49572
49573 uint64_t  __attribute__((export_name("TS_TrustedCommitmentTransaction_channel_type_features"))) TS_TrustedCommitmentTransaction_channel_type_features(uint64_t this_arg) {
49574         LDKTrustedCommitmentTransaction this_arg_conv;
49575         this_arg_conv.inner = untag_ptr(this_arg);
49576         this_arg_conv.is_owned = ptr_is_owned(this_arg);
49577         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
49578         this_arg_conv.is_owned = false;
49579         LDKChannelTypeFeatures ret_var = TrustedCommitmentTransaction_channel_type_features(&this_arg_conv);
49580         uint64_t ret_ref = 0;
49581         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
49582         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
49583         return ret_ref;
49584 }
49585
49586 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) {
49587         LDKTrustedCommitmentTransaction this_arg_conv;
49588         this_arg_conv.inner = untag_ptr(this_arg);
49589         this_arg_conv.is_owned = ptr_is_owned(this_arg);
49590         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
49591         this_arg_conv.is_owned = false;
49592         uint8_t htlc_base_key_arr[32];
49593         CHECK(htlc_base_key->arr_len == 32);
49594         memcpy(htlc_base_key_arr, htlc_base_key->elems, 32); FREE(htlc_base_key);
49595         uint8_t (*htlc_base_key_ref)[32] = &htlc_base_key_arr;
49596         LDKDirectedChannelTransactionParameters channel_parameters_conv;
49597         channel_parameters_conv.inner = untag_ptr(channel_parameters);
49598         channel_parameters_conv.is_owned = ptr_is_owned(channel_parameters);
49599         CHECK_INNER_FIELD_ACCESS_OR_NULL(channel_parameters_conv);
49600         channel_parameters_conv.is_owned = false;
49601         void* entropy_source_ptr = untag_ptr(entropy_source);
49602         if (ptr_is_owned(entropy_source)) { CHECK_ACCESS(entropy_source_ptr); }
49603         LDKEntropySource* entropy_source_conv = (LDKEntropySource*)entropy_source_ptr;
49604         LDKCResult_CVec_ECDSASignatureZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_ECDSASignatureZNoneZ), "LDKCResult_CVec_ECDSASignatureZNoneZ");
49605         *ret_conv = TrustedCommitmentTransaction_get_htlc_sigs(&this_arg_conv, htlc_base_key_ref, &channel_parameters_conv, entropy_source_conv);
49606         return tag_ptr(ret_conv, true);
49607 }
49608
49609 uint64_t  __attribute__((export_name("TS_TrustedCommitmentTransaction_revokeable_output_index"))) TS_TrustedCommitmentTransaction_revokeable_output_index(uint64_t this_arg) {
49610         LDKTrustedCommitmentTransaction this_arg_conv;
49611         this_arg_conv.inner = untag_ptr(this_arg);
49612         this_arg_conv.is_owned = ptr_is_owned(this_arg);
49613         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
49614         this_arg_conv.is_owned = false;
49615         LDKCOption_usizeZ *ret_copy = MALLOC(sizeof(LDKCOption_usizeZ), "LDKCOption_usizeZ");
49616         *ret_copy = TrustedCommitmentTransaction_revokeable_output_index(&this_arg_conv);
49617         uint64_t ret_ref = tag_ptr(ret_copy, true);
49618         return ret_ref;
49619 }
49620
49621 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) {
49622         LDKTrustedCommitmentTransaction this_arg_conv;
49623         this_arg_conv.inner = untag_ptr(this_arg);
49624         this_arg_conv.is_owned = ptr_is_owned(this_arg);
49625         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
49626         this_arg_conv.is_owned = false;
49627         LDKCVec_u8Z destination_script_ref;
49628         destination_script_ref.datalen = destination_script->arr_len;
49629         destination_script_ref.data = MALLOC(destination_script_ref.datalen, "LDKCVec_u8Z Bytes");
49630         memcpy(destination_script_ref.data, destination_script->elems, destination_script_ref.datalen); FREE(destination_script);
49631         LDKCResult_TransactionNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_TransactionNoneZ), "LDKCResult_TransactionNoneZ");
49632         *ret_conv = TrustedCommitmentTransaction_build_to_local_justice_tx(&this_arg_conv, feerate_per_kw, destination_script_ref);
49633         return tag_ptr(ret_conv, true);
49634 }
49635
49636 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) {
49637         LDKPublicKey broadcaster_payment_basepoint_ref;
49638         CHECK(broadcaster_payment_basepoint->arr_len == 33);
49639         memcpy(broadcaster_payment_basepoint_ref.compressed_form, broadcaster_payment_basepoint->elems, 33); FREE(broadcaster_payment_basepoint);
49640         LDKPublicKey countersignatory_payment_basepoint_ref;
49641         CHECK(countersignatory_payment_basepoint->arr_len == 33);
49642         memcpy(countersignatory_payment_basepoint_ref.compressed_form, countersignatory_payment_basepoint->elems, 33); FREE(countersignatory_payment_basepoint);
49643         int64_t ret_conv = get_commitment_transaction_number_obscure_factor(broadcaster_payment_basepoint_ref, countersignatory_payment_basepoint_ref, outbound_from_broadcaster);
49644         return ret_conv;
49645 }
49646
49647 jboolean  __attribute__((export_name("TS_InitFeatures_eq"))) TS_InitFeatures_eq(uint64_t a, uint64_t b) {
49648         LDKInitFeatures a_conv;
49649         a_conv.inner = untag_ptr(a);
49650         a_conv.is_owned = ptr_is_owned(a);
49651         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
49652         a_conv.is_owned = false;
49653         LDKInitFeatures b_conv;
49654         b_conv.inner = untag_ptr(b);
49655         b_conv.is_owned = ptr_is_owned(b);
49656         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
49657         b_conv.is_owned = false;
49658         jboolean ret_conv = InitFeatures_eq(&a_conv, &b_conv);
49659         return ret_conv;
49660 }
49661
49662 jboolean  __attribute__((export_name("TS_NodeFeatures_eq"))) TS_NodeFeatures_eq(uint64_t a, uint64_t b) {
49663         LDKNodeFeatures a_conv;
49664         a_conv.inner = untag_ptr(a);
49665         a_conv.is_owned = ptr_is_owned(a);
49666         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
49667         a_conv.is_owned = false;
49668         LDKNodeFeatures b_conv;
49669         b_conv.inner = untag_ptr(b);
49670         b_conv.is_owned = ptr_is_owned(b);
49671         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
49672         b_conv.is_owned = false;
49673         jboolean ret_conv = NodeFeatures_eq(&a_conv, &b_conv);
49674         return ret_conv;
49675 }
49676
49677 jboolean  __attribute__((export_name("TS_ChannelFeatures_eq"))) TS_ChannelFeatures_eq(uint64_t a, uint64_t b) {
49678         LDKChannelFeatures a_conv;
49679         a_conv.inner = untag_ptr(a);
49680         a_conv.is_owned = ptr_is_owned(a);
49681         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
49682         a_conv.is_owned = false;
49683         LDKChannelFeatures b_conv;
49684         b_conv.inner = untag_ptr(b);
49685         b_conv.is_owned = ptr_is_owned(b);
49686         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
49687         b_conv.is_owned = false;
49688         jboolean ret_conv = ChannelFeatures_eq(&a_conv, &b_conv);
49689         return ret_conv;
49690 }
49691
49692 jboolean  __attribute__((export_name("TS_Bolt11InvoiceFeatures_eq"))) TS_Bolt11InvoiceFeatures_eq(uint64_t a, uint64_t b) {
49693         LDKBolt11InvoiceFeatures a_conv;
49694         a_conv.inner = untag_ptr(a);
49695         a_conv.is_owned = ptr_is_owned(a);
49696         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
49697         a_conv.is_owned = false;
49698         LDKBolt11InvoiceFeatures b_conv;
49699         b_conv.inner = untag_ptr(b);
49700         b_conv.is_owned = ptr_is_owned(b);
49701         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
49702         b_conv.is_owned = false;
49703         jboolean ret_conv = Bolt11InvoiceFeatures_eq(&a_conv, &b_conv);
49704         return ret_conv;
49705 }
49706
49707 jboolean  __attribute__((export_name("TS_OfferFeatures_eq"))) TS_OfferFeatures_eq(uint64_t a, uint64_t b) {
49708         LDKOfferFeatures a_conv;
49709         a_conv.inner = untag_ptr(a);
49710         a_conv.is_owned = ptr_is_owned(a);
49711         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
49712         a_conv.is_owned = false;
49713         LDKOfferFeatures b_conv;
49714         b_conv.inner = untag_ptr(b);
49715         b_conv.is_owned = ptr_is_owned(b);
49716         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
49717         b_conv.is_owned = false;
49718         jboolean ret_conv = OfferFeatures_eq(&a_conv, &b_conv);
49719         return ret_conv;
49720 }
49721
49722 jboolean  __attribute__((export_name("TS_InvoiceRequestFeatures_eq"))) TS_InvoiceRequestFeatures_eq(uint64_t a, uint64_t b) {
49723         LDKInvoiceRequestFeatures a_conv;
49724         a_conv.inner = untag_ptr(a);
49725         a_conv.is_owned = ptr_is_owned(a);
49726         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
49727         a_conv.is_owned = false;
49728         LDKInvoiceRequestFeatures b_conv;
49729         b_conv.inner = untag_ptr(b);
49730         b_conv.is_owned = ptr_is_owned(b);
49731         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
49732         b_conv.is_owned = false;
49733         jboolean ret_conv = InvoiceRequestFeatures_eq(&a_conv, &b_conv);
49734         return ret_conv;
49735 }
49736
49737 jboolean  __attribute__((export_name("TS_Bolt12InvoiceFeatures_eq"))) TS_Bolt12InvoiceFeatures_eq(uint64_t a, uint64_t b) {
49738         LDKBolt12InvoiceFeatures a_conv;
49739         a_conv.inner = untag_ptr(a);
49740         a_conv.is_owned = ptr_is_owned(a);
49741         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
49742         a_conv.is_owned = false;
49743         LDKBolt12InvoiceFeatures b_conv;
49744         b_conv.inner = untag_ptr(b);
49745         b_conv.is_owned = ptr_is_owned(b);
49746         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
49747         b_conv.is_owned = false;
49748         jboolean ret_conv = Bolt12InvoiceFeatures_eq(&a_conv, &b_conv);
49749         return ret_conv;
49750 }
49751
49752 jboolean  __attribute__((export_name("TS_BlindedHopFeatures_eq"))) TS_BlindedHopFeatures_eq(uint64_t a, uint64_t b) {
49753         LDKBlindedHopFeatures a_conv;
49754         a_conv.inner = untag_ptr(a);
49755         a_conv.is_owned = ptr_is_owned(a);
49756         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
49757         a_conv.is_owned = false;
49758         LDKBlindedHopFeatures b_conv;
49759         b_conv.inner = untag_ptr(b);
49760         b_conv.is_owned = ptr_is_owned(b);
49761         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
49762         b_conv.is_owned = false;
49763         jboolean ret_conv = BlindedHopFeatures_eq(&a_conv, &b_conv);
49764         return ret_conv;
49765 }
49766
49767 jboolean  __attribute__((export_name("TS_ChannelTypeFeatures_eq"))) TS_ChannelTypeFeatures_eq(uint64_t a, uint64_t b) {
49768         LDKChannelTypeFeatures a_conv;
49769         a_conv.inner = untag_ptr(a);
49770         a_conv.is_owned = ptr_is_owned(a);
49771         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
49772         a_conv.is_owned = false;
49773         LDKChannelTypeFeatures b_conv;
49774         b_conv.inner = untag_ptr(b);
49775         b_conv.is_owned = ptr_is_owned(b);
49776         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
49777         b_conv.is_owned = false;
49778         jboolean ret_conv = ChannelTypeFeatures_eq(&a_conv, &b_conv);
49779         return ret_conv;
49780 }
49781
49782 static inline uint64_t InitFeatures_clone_ptr(LDKInitFeatures *NONNULL_PTR arg) {
49783         LDKInitFeatures ret_var = InitFeatures_clone(arg);
49784         uint64_t ret_ref = 0;
49785         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
49786         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
49787         return ret_ref;
49788 }
49789 int64_t  __attribute__((export_name("TS_InitFeatures_clone_ptr"))) TS_InitFeatures_clone_ptr(uint64_t arg) {
49790         LDKInitFeatures arg_conv;
49791         arg_conv.inner = untag_ptr(arg);
49792         arg_conv.is_owned = ptr_is_owned(arg);
49793         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
49794         arg_conv.is_owned = false;
49795         int64_t ret_conv = InitFeatures_clone_ptr(&arg_conv);
49796         return ret_conv;
49797 }
49798
49799 uint64_t  __attribute__((export_name("TS_InitFeatures_clone"))) TS_InitFeatures_clone(uint64_t orig) {
49800         LDKInitFeatures orig_conv;
49801         orig_conv.inner = untag_ptr(orig);
49802         orig_conv.is_owned = ptr_is_owned(orig);
49803         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
49804         orig_conv.is_owned = false;
49805         LDKInitFeatures ret_var = InitFeatures_clone(&orig_conv);
49806         uint64_t ret_ref = 0;
49807         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
49808         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
49809         return ret_ref;
49810 }
49811
49812 static inline uint64_t NodeFeatures_clone_ptr(LDKNodeFeatures *NONNULL_PTR arg) {
49813         LDKNodeFeatures ret_var = NodeFeatures_clone(arg);
49814         uint64_t ret_ref = 0;
49815         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
49816         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
49817         return ret_ref;
49818 }
49819 int64_t  __attribute__((export_name("TS_NodeFeatures_clone_ptr"))) TS_NodeFeatures_clone_ptr(uint64_t arg) {
49820         LDKNodeFeatures arg_conv;
49821         arg_conv.inner = untag_ptr(arg);
49822         arg_conv.is_owned = ptr_is_owned(arg);
49823         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
49824         arg_conv.is_owned = false;
49825         int64_t ret_conv = NodeFeatures_clone_ptr(&arg_conv);
49826         return ret_conv;
49827 }
49828
49829 uint64_t  __attribute__((export_name("TS_NodeFeatures_clone"))) TS_NodeFeatures_clone(uint64_t orig) {
49830         LDKNodeFeatures orig_conv;
49831         orig_conv.inner = untag_ptr(orig);
49832         orig_conv.is_owned = ptr_is_owned(orig);
49833         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
49834         orig_conv.is_owned = false;
49835         LDKNodeFeatures ret_var = NodeFeatures_clone(&orig_conv);
49836         uint64_t ret_ref = 0;
49837         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
49838         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
49839         return ret_ref;
49840 }
49841
49842 static inline uint64_t ChannelFeatures_clone_ptr(LDKChannelFeatures *NONNULL_PTR arg) {
49843         LDKChannelFeatures ret_var = ChannelFeatures_clone(arg);
49844         uint64_t ret_ref = 0;
49845         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
49846         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
49847         return ret_ref;
49848 }
49849 int64_t  __attribute__((export_name("TS_ChannelFeatures_clone_ptr"))) TS_ChannelFeatures_clone_ptr(uint64_t arg) {
49850         LDKChannelFeatures arg_conv;
49851         arg_conv.inner = untag_ptr(arg);
49852         arg_conv.is_owned = ptr_is_owned(arg);
49853         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
49854         arg_conv.is_owned = false;
49855         int64_t ret_conv = ChannelFeatures_clone_ptr(&arg_conv);
49856         return ret_conv;
49857 }
49858
49859 uint64_t  __attribute__((export_name("TS_ChannelFeatures_clone"))) TS_ChannelFeatures_clone(uint64_t orig) {
49860         LDKChannelFeatures orig_conv;
49861         orig_conv.inner = untag_ptr(orig);
49862         orig_conv.is_owned = ptr_is_owned(orig);
49863         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
49864         orig_conv.is_owned = false;
49865         LDKChannelFeatures ret_var = ChannelFeatures_clone(&orig_conv);
49866         uint64_t ret_ref = 0;
49867         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
49868         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
49869         return ret_ref;
49870 }
49871
49872 static inline uint64_t Bolt11InvoiceFeatures_clone_ptr(LDKBolt11InvoiceFeatures *NONNULL_PTR arg) {
49873         LDKBolt11InvoiceFeatures ret_var = Bolt11InvoiceFeatures_clone(arg);
49874         uint64_t ret_ref = 0;
49875         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
49876         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
49877         return ret_ref;
49878 }
49879 int64_t  __attribute__((export_name("TS_Bolt11InvoiceFeatures_clone_ptr"))) TS_Bolt11InvoiceFeatures_clone_ptr(uint64_t arg) {
49880         LDKBolt11InvoiceFeatures arg_conv;
49881         arg_conv.inner = untag_ptr(arg);
49882         arg_conv.is_owned = ptr_is_owned(arg);
49883         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
49884         arg_conv.is_owned = false;
49885         int64_t ret_conv = Bolt11InvoiceFeatures_clone_ptr(&arg_conv);
49886         return ret_conv;
49887 }
49888
49889 uint64_t  __attribute__((export_name("TS_Bolt11InvoiceFeatures_clone"))) TS_Bolt11InvoiceFeatures_clone(uint64_t orig) {
49890         LDKBolt11InvoiceFeatures orig_conv;
49891         orig_conv.inner = untag_ptr(orig);
49892         orig_conv.is_owned = ptr_is_owned(orig);
49893         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
49894         orig_conv.is_owned = false;
49895         LDKBolt11InvoiceFeatures ret_var = Bolt11InvoiceFeatures_clone(&orig_conv);
49896         uint64_t ret_ref = 0;
49897         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
49898         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
49899         return ret_ref;
49900 }
49901
49902 static inline uint64_t OfferFeatures_clone_ptr(LDKOfferFeatures *NONNULL_PTR arg) {
49903         LDKOfferFeatures ret_var = OfferFeatures_clone(arg);
49904         uint64_t ret_ref = 0;
49905         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
49906         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
49907         return ret_ref;
49908 }
49909 int64_t  __attribute__((export_name("TS_OfferFeatures_clone_ptr"))) TS_OfferFeatures_clone_ptr(uint64_t arg) {
49910         LDKOfferFeatures arg_conv;
49911         arg_conv.inner = untag_ptr(arg);
49912         arg_conv.is_owned = ptr_is_owned(arg);
49913         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
49914         arg_conv.is_owned = false;
49915         int64_t ret_conv = OfferFeatures_clone_ptr(&arg_conv);
49916         return ret_conv;
49917 }
49918
49919 uint64_t  __attribute__((export_name("TS_OfferFeatures_clone"))) TS_OfferFeatures_clone(uint64_t orig) {
49920         LDKOfferFeatures orig_conv;
49921         orig_conv.inner = untag_ptr(orig);
49922         orig_conv.is_owned = ptr_is_owned(orig);
49923         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
49924         orig_conv.is_owned = false;
49925         LDKOfferFeatures ret_var = OfferFeatures_clone(&orig_conv);
49926         uint64_t ret_ref = 0;
49927         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
49928         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
49929         return ret_ref;
49930 }
49931
49932 static inline uint64_t InvoiceRequestFeatures_clone_ptr(LDKInvoiceRequestFeatures *NONNULL_PTR arg) {
49933         LDKInvoiceRequestFeatures ret_var = InvoiceRequestFeatures_clone(arg);
49934         uint64_t ret_ref = 0;
49935         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
49936         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
49937         return ret_ref;
49938 }
49939 int64_t  __attribute__((export_name("TS_InvoiceRequestFeatures_clone_ptr"))) TS_InvoiceRequestFeatures_clone_ptr(uint64_t arg) {
49940         LDKInvoiceRequestFeatures arg_conv;
49941         arg_conv.inner = untag_ptr(arg);
49942         arg_conv.is_owned = ptr_is_owned(arg);
49943         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
49944         arg_conv.is_owned = false;
49945         int64_t ret_conv = InvoiceRequestFeatures_clone_ptr(&arg_conv);
49946         return ret_conv;
49947 }
49948
49949 uint64_t  __attribute__((export_name("TS_InvoiceRequestFeatures_clone"))) TS_InvoiceRequestFeatures_clone(uint64_t orig) {
49950         LDKInvoiceRequestFeatures orig_conv;
49951         orig_conv.inner = untag_ptr(orig);
49952         orig_conv.is_owned = ptr_is_owned(orig);
49953         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
49954         orig_conv.is_owned = false;
49955         LDKInvoiceRequestFeatures ret_var = InvoiceRequestFeatures_clone(&orig_conv);
49956         uint64_t ret_ref = 0;
49957         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
49958         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
49959         return ret_ref;
49960 }
49961
49962 static inline uint64_t Bolt12InvoiceFeatures_clone_ptr(LDKBolt12InvoiceFeatures *NONNULL_PTR arg) {
49963         LDKBolt12InvoiceFeatures ret_var = Bolt12InvoiceFeatures_clone(arg);
49964         uint64_t ret_ref = 0;
49965         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
49966         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
49967         return ret_ref;
49968 }
49969 int64_t  __attribute__((export_name("TS_Bolt12InvoiceFeatures_clone_ptr"))) TS_Bolt12InvoiceFeatures_clone_ptr(uint64_t arg) {
49970         LDKBolt12InvoiceFeatures arg_conv;
49971         arg_conv.inner = untag_ptr(arg);
49972         arg_conv.is_owned = ptr_is_owned(arg);
49973         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
49974         arg_conv.is_owned = false;
49975         int64_t ret_conv = Bolt12InvoiceFeatures_clone_ptr(&arg_conv);
49976         return ret_conv;
49977 }
49978
49979 uint64_t  __attribute__((export_name("TS_Bolt12InvoiceFeatures_clone"))) TS_Bolt12InvoiceFeatures_clone(uint64_t orig) {
49980         LDKBolt12InvoiceFeatures orig_conv;
49981         orig_conv.inner = untag_ptr(orig);
49982         orig_conv.is_owned = ptr_is_owned(orig);
49983         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
49984         orig_conv.is_owned = false;
49985         LDKBolt12InvoiceFeatures ret_var = Bolt12InvoiceFeatures_clone(&orig_conv);
49986         uint64_t ret_ref = 0;
49987         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
49988         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
49989         return ret_ref;
49990 }
49991
49992 static inline uint64_t BlindedHopFeatures_clone_ptr(LDKBlindedHopFeatures *NONNULL_PTR arg) {
49993         LDKBlindedHopFeatures ret_var = BlindedHopFeatures_clone(arg);
49994         uint64_t ret_ref = 0;
49995         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
49996         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
49997         return ret_ref;
49998 }
49999 int64_t  __attribute__((export_name("TS_BlindedHopFeatures_clone_ptr"))) TS_BlindedHopFeatures_clone_ptr(uint64_t arg) {
50000         LDKBlindedHopFeatures arg_conv;
50001         arg_conv.inner = untag_ptr(arg);
50002         arg_conv.is_owned = ptr_is_owned(arg);
50003         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
50004         arg_conv.is_owned = false;
50005         int64_t ret_conv = BlindedHopFeatures_clone_ptr(&arg_conv);
50006         return ret_conv;
50007 }
50008
50009 uint64_t  __attribute__((export_name("TS_BlindedHopFeatures_clone"))) TS_BlindedHopFeatures_clone(uint64_t orig) {
50010         LDKBlindedHopFeatures orig_conv;
50011         orig_conv.inner = untag_ptr(orig);
50012         orig_conv.is_owned = ptr_is_owned(orig);
50013         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
50014         orig_conv.is_owned = false;
50015         LDKBlindedHopFeatures ret_var = BlindedHopFeatures_clone(&orig_conv);
50016         uint64_t ret_ref = 0;
50017         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
50018         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
50019         return ret_ref;
50020 }
50021
50022 static inline uint64_t ChannelTypeFeatures_clone_ptr(LDKChannelTypeFeatures *NONNULL_PTR arg) {
50023         LDKChannelTypeFeatures ret_var = ChannelTypeFeatures_clone(arg);
50024         uint64_t ret_ref = 0;
50025         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
50026         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
50027         return ret_ref;
50028 }
50029 int64_t  __attribute__((export_name("TS_ChannelTypeFeatures_clone_ptr"))) TS_ChannelTypeFeatures_clone_ptr(uint64_t arg) {
50030         LDKChannelTypeFeatures arg_conv;
50031         arg_conv.inner = untag_ptr(arg);
50032         arg_conv.is_owned = ptr_is_owned(arg);
50033         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
50034         arg_conv.is_owned = false;
50035         int64_t ret_conv = ChannelTypeFeatures_clone_ptr(&arg_conv);
50036         return ret_conv;
50037 }
50038
50039 uint64_t  __attribute__((export_name("TS_ChannelTypeFeatures_clone"))) TS_ChannelTypeFeatures_clone(uint64_t orig) {
50040         LDKChannelTypeFeatures orig_conv;
50041         orig_conv.inner = untag_ptr(orig);
50042         orig_conv.is_owned = ptr_is_owned(orig);
50043         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
50044         orig_conv.is_owned = false;
50045         LDKChannelTypeFeatures ret_var = ChannelTypeFeatures_clone(&orig_conv);
50046         uint64_t ret_ref = 0;
50047         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
50048         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
50049         return ret_ref;
50050 }
50051
50052 void  __attribute__((export_name("TS_InitFeatures_free"))) TS_InitFeatures_free(uint64_t this_obj) {
50053         LDKInitFeatures this_obj_conv;
50054         this_obj_conv.inner = untag_ptr(this_obj);
50055         this_obj_conv.is_owned = ptr_is_owned(this_obj);
50056         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
50057         InitFeatures_free(this_obj_conv);
50058 }
50059
50060 void  __attribute__((export_name("TS_NodeFeatures_free"))) TS_NodeFeatures_free(uint64_t this_obj) {
50061         LDKNodeFeatures this_obj_conv;
50062         this_obj_conv.inner = untag_ptr(this_obj);
50063         this_obj_conv.is_owned = ptr_is_owned(this_obj);
50064         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
50065         NodeFeatures_free(this_obj_conv);
50066 }
50067
50068 void  __attribute__((export_name("TS_ChannelFeatures_free"))) TS_ChannelFeatures_free(uint64_t this_obj) {
50069         LDKChannelFeatures this_obj_conv;
50070         this_obj_conv.inner = untag_ptr(this_obj);
50071         this_obj_conv.is_owned = ptr_is_owned(this_obj);
50072         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
50073         ChannelFeatures_free(this_obj_conv);
50074 }
50075
50076 void  __attribute__((export_name("TS_Bolt11InvoiceFeatures_free"))) TS_Bolt11InvoiceFeatures_free(uint64_t this_obj) {
50077         LDKBolt11InvoiceFeatures this_obj_conv;
50078         this_obj_conv.inner = untag_ptr(this_obj);
50079         this_obj_conv.is_owned = ptr_is_owned(this_obj);
50080         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
50081         Bolt11InvoiceFeatures_free(this_obj_conv);
50082 }
50083
50084 void  __attribute__((export_name("TS_OfferFeatures_free"))) TS_OfferFeatures_free(uint64_t this_obj) {
50085         LDKOfferFeatures this_obj_conv;
50086         this_obj_conv.inner = untag_ptr(this_obj);
50087         this_obj_conv.is_owned = ptr_is_owned(this_obj);
50088         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
50089         OfferFeatures_free(this_obj_conv);
50090 }
50091
50092 void  __attribute__((export_name("TS_InvoiceRequestFeatures_free"))) TS_InvoiceRequestFeatures_free(uint64_t this_obj) {
50093         LDKInvoiceRequestFeatures this_obj_conv;
50094         this_obj_conv.inner = untag_ptr(this_obj);
50095         this_obj_conv.is_owned = ptr_is_owned(this_obj);
50096         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
50097         InvoiceRequestFeatures_free(this_obj_conv);
50098 }
50099
50100 void  __attribute__((export_name("TS_Bolt12InvoiceFeatures_free"))) TS_Bolt12InvoiceFeatures_free(uint64_t this_obj) {
50101         LDKBolt12InvoiceFeatures this_obj_conv;
50102         this_obj_conv.inner = untag_ptr(this_obj);
50103         this_obj_conv.is_owned = ptr_is_owned(this_obj);
50104         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
50105         Bolt12InvoiceFeatures_free(this_obj_conv);
50106 }
50107
50108 void  __attribute__((export_name("TS_BlindedHopFeatures_free"))) TS_BlindedHopFeatures_free(uint64_t this_obj) {
50109         LDKBlindedHopFeatures this_obj_conv;
50110         this_obj_conv.inner = untag_ptr(this_obj);
50111         this_obj_conv.is_owned = ptr_is_owned(this_obj);
50112         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
50113         BlindedHopFeatures_free(this_obj_conv);
50114 }
50115
50116 void  __attribute__((export_name("TS_ChannelTypeFeatures_free"))) TS_ChannelTypeFeatures_free(uint64_t this_obj) {
50117         LDKChannelTypeFeatures this_obj_conv;
50118         this_obj_conv.inner = untag_ptr(this_obj);
50119         this_obj_conv.is_owned = ptr_is_owned(this_obj);
50120         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
50121         ChannelTypeFeatures_free(this_obj_conv);
50122 }
50123
50124 uint64_t  __attribute__((export_name("TS_InitFeatures_empty"))) TS_InitFeatures_empty() {
50125         LDKInitFeatures ret_var = InitFeatures_empty();
50126         uint64_t ret_ref = 0;
50127         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
50128         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
50129         return ret_ref;
50130 }
50131
50132 jboolean  __attribute__((export_name("TS_InitFeatures_requires_unknown_bits_from"))) TS_InitFeatures_requires_unknown_bits_from(uint64_t this_arg, uint64_t other) {
50133         LDKInitFeatures this_arg_conv;
50134         this_arg_conv.inner = untag_ptr(this_arg);
50135         this_arg_conv.is_owned = ptr_is_owned(this_arg);
50136         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
50137         this_arg_conv.is_owned = false;
50138         LDKInitFeatures other_conv;
50139         other_conv.inner = untag_ptr(other);
50140         other_conv.is_owned = ptr_is_owned(other);
50141         CHECK_INNER_FIELD_ACCESS_OR_NULL(other_conv);
50142         other_conv.is_owned = false;
50143         jboolean ret_conv = InitFeatures_requires_unknown_bits_from(&this_arg_conv, &other_conv);
50144         return ret_conv;
50145 }
50146
50147 jboolean  __attribute__((export_name("TS_InitFeatures_requires_unknown_bits"))) TS_InitFeatures_requires_unknown_bits(uint64_t this_arg) {
50148         LDKInitFeatures this_arg_conv;
50149         this_arg_conv.inner = untag_ptr(this_arg);
50150         this_arg_conv.is_owned = ptr_is_owned(this_arg);
50151         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
50152         this_arg_conv.is_owned = false;
50153         jboolean ret_conv = InitFeatures_requires_unknown_bits(&this_arg_conv);
50154         return ret_conv;
50155 }
50156
50157 uint64_t  __attribute__((export_name("TS_InitFeatures_set_required_feature_bit"))) TS_InitFeatures_set_required_feature_bit(uint64_t this_arg, uint32_t bit) {
50158         LDKInitFeatures this_arg_conv;
50159         this_arg_conv.inner = untag_ptr(this_arg);
50160         this_arg_conv.is_owned = ptr_is_owned(this_arg);
50161         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
50162         this_arg_conv.is_owned = false;
50163         LDKCResult_NoneNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneNoneZ), "LDKCResult_NoneNoneZ");
50164         *ret_conv = InitFeatures_set_required_feature_bit(&this_arg_conv, bit);
50165         return tag_ptr(ret_conv, true);
50166 }
50167
50168 uint64_t  __attribute__((export_name("TS_InitFeatures_set_optional_feature_bit"))) TS_InitFeatures_set_optional_feature_bit(uint64_t this_arg, uint32_t bit) {
50169         LDKInitFeatures this_arg_conv;
50170         this_arg_conv.inner = untag_ptr(this_arg);
50171         this_arg_conv.is_owned = ptr_is_owned(this_arg);
50172         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
50173         this_arg_conv.is_owned = false;
50174         LDKCResult_NoneNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneNoneZ), "LDKCResult_NoneNoneZ");
50175         *ret_conv = InitFeatures_set_optional_feature_bit(&this_arg_conv, bit);
50176         return tag_ptr(ret_conv, true);
50177 }
50178
50179 uint64_t  __attribute__((export_name("TS_InitFeatures_set_required_custom_bit"))) TS_InitFeatures_set_required_custom_bit(uint64_t this_arg, uint32_t bit) {
50180         LDKInitFeatures this_arg_conv;
50181         this_arg_conv.inner = untag_ptr(this_arg);
50182         this_arg_conv.is_owned = ptr_is_owned(this_arg);
50183         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
50184         this_arg_conv.is_owned = false;
50185         LDKCResult_NoneNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneNoneZ), "LDKCResult_NoneNoneZ");
50186         *ret_conv = InitFeatures_set_required_custom_bit(&this_arg_conv, bit);
50187         return tag_ptr(ret_conv, true);
50188 }
50189
50190 uint64_t  __attribute__((export_name("TS_InitFeatures_set_optional_custom_bit"))) TS_InitFeatures_set_optional_custom_bit(uint64_t this_arg, uint32_t bit) {
50191         LDKInitFeatures this_arg_conv;
50192         this_arg_conv.inner = untag_ptr(this_arg);
50193         this_arg_conv.is_owned = ptr_is_owned(this_arg);
50194         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
50195         this_arg_conv.is_owned = false;
50196         LDKCResult_NoneNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneNoneZ), "LDKCResult_NoneNoneZ");
50197         *ret_conv = InitFeatures_set_optional_custom_bit(&this_arg_conv, bit);
50198         return tag_ptr(ret_conv, true);
50199 }
50200
50201 uint64_t  __attribute__((export_name("TS_NodeFeatures_empty"))) TS_NodeFeatures_empty() {
50202         LDKNodeFeatures ret_var = NodeFeatures_empty();
50203         uint64_t ret_ref = 0;
50204         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
50205         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
50206         return ret_ref;
50207 }
50208
50209 jboolean  __attribute__((export_name("TS_NodeFeatures_requires_unknown_bits_from"))) TS_NodeFeatures_requires_unknown_bits_from(uint64_t this_arg, uint64_t other) {
50210         LDKNodeFeatures this_arg_conv;
50211         this_arg_conv.inner = untag_ptr(this_arg);
50212         this_arg_conv.is_owned = ptr_is_owned(this_arg);
50213         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
50214         this_arg_conv.is_owned = false;
50215         LDKNodeFeatures other_conv;
50216         other_conv.inner = untag_ptr(other);
50217         other_conv.is_owned = ptr_is_owned(other);
50218         CHECK_INNER_FIELD_ACCESS_OR_NULL(other_conv);
50219         other_conv.is_owned = false;
50220         jboolean ret_conv = NodeFeatures_requires_unknown_bits_from(&this_arg_conv, &other_conv);
50221         return ret_conv;
50222 }
50223
50224 jboolean  __attribute__((export_name("TS_NodeFeatures_requires_unknown_bits"))) TS_NodeFeatures_requires_unknown_bits(uint64_t this_arg) {
50225         LDKNodeFeatures this_arg_conv;
50226         this_arg_conv.inner = untag_ptr(this_arg);
50227         this_arg_conv.is_owned = ptr_is_owned(this_arg);
50228         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
50229         this_arg_conv.is_owned = false;
50230         jboolean ret_conv = NodeFeatures_requires_unknown_bits(&this_arg_conv);
50231         return ret_conv;
50232 }
50233
50234 uint64_t  __attribute__((export_name("TS_NodeFeatures_set_required_feature_bit"))) TS_NodeFeatures_set_required_feature_bit(uint64_t this_arg, uint32_t bit) {
50235         LDKNodeFeatures this_arg_conv;
50236         this_arg_conv.inner = untag_ptr(this_arg);
50237         this_arg_conv.is_owned = ptr_is_owned(this_arg);
50238         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
50239         this_arg_conv.is_owned = false;
50240         LDKCResult_NoneNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneNoneZ), "LDKCResult_NoneNoneZ");
50241         *ret_conv = NodeFeatures_set_required_feature_bit(&this_arg_conv, bit);
50242         return tag_ptr(ret_conv, true);
50243 }
50244
50245 uint64_t  __attribute__((export_name("TS_NodeFeatures_set_optional_feature_bit"))) TS_NodeFeatures_set_optional_feature_bit(uint64_t this_arg, uint32_t bit) {
50246         LDKNodeFeatures this_arg_conv;
50247         this_arg_conv.inner = untag_ptr(this_arg);
50248         this_arg_conv.is_owned = ptr_is_owned(this_arg);
50249         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
50250         this_arg_conv.is_owned = false;
50251         LDKCResult_NoneNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneNoneZ), "LDKCResult_NoneNoneZ");
50252         *ret_conv = NodeFeatures_set_optional_feature_bit(&this_arg_conv, bit);
50253         return tag_ptr(ret_conv, true);
50254 }
50255
50256 uint64_t  __attribute__((export_name("TS_NodeFeatures_set_required_custom_bit"))) TS_NodeFeatures_set_required_custom_bit(uint64_t this_arg, uint32_t bit) {
50257         LDKNodeFeatures this_arg_conv;
50258         this_arg_conv.inner = untag_ptr(this_arg);
50259         this_arg_conv.is_owned = ptr_is_owned(this_arg);
50260         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
50261         this_arg_conv.is_owned = false;
50262         LDKCResult_NoneNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneNoneZ), "LDKCResult_NoneNoneZ");
50263         *ret_conv = NodeFeatures_set_required_custom_bit(&this_arg_conv, bit);
50264         return tag_ptr(ret_conv, true);
50265 }
50266
50267 uint64_t  __attribute__((export_name("TS_NodeFeatures_set_optional_custom_bit"))) TS_NodeFeatures_set_optional_custom_bit(uint64_t this_arg, uint32_t bit) {
50268         LDKNodeFeatures this_arg_conv;
50269         this_arg_conv.inner = untag_ptr(this_arg);
50270         this_arg_conv.is_owned = ptr_is_owned(this_arg);
50271         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
50272         this_arg_conv.is_owned = false;
50273         LDKCResult_NoneNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneNoneZ), "LDKCResult_NoneNoneZ");
50274         *ret_conv = NodeFeatures_set_optional_custom_bit(&this_arg_conv, bit);
50275         return tag_ptr(ret_conv, true);
50276 }
50277
50278 uint64_t  __attribute__((export_name("TS_ChannelFeatures_empty"))) TS_ChannelFeatures_empty() {
50279         LDKChannelFeatures ret_var = ChannelFeatures_empty();
50280         uint64_t ret_ref = 0;
50281         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
50282         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
50283         return ret_ref;
50284 }
50285
50286 jboolean  __attribute__((export_name("TS_ChannelFeatures_requires_unknown_bits_from"))) TS_ChannelFeatures_requires_unknown_bits_from(uint64_t this_arg, uint64_t other) {
50287         LDKChannelFeatures this_arg_conv;
50288         this_arg_conv.inner = untag_ptr(this_arg);
50289         this_arg_conv.is_owned = ptr_is_owned(this_arg);
50290         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
50291         this_arg_conv.is_owned = false;
50292         LDKChannelFeatures other_conv;
50293         other_conv.inner = untag_ptr(other);
50294         other_conv.is_owned = ptr_is_owned(other);
50295         CHECK_INNER_FIELD_ACCESS_OR_NULL(other_conv);
50296         other_conv.is_owned = false;
50297         jboolean ret_conv = ChannelFeatures_requires_unknown_bits_from(&this_arg_conv, &other_conv);
50298         return ret_conv;
50299 }
50300
50301 jboolean  __attribute__((export_name("TS_ChannelFeatures_requires_unknown_bits"))) TS_ChannelFeatures_requires_unknown_bits(uint64_t this_arg) {
50302         LDKChannelFeatures this_arg_conv;
50303         this_arg_conv.inner = untag_ptr(this_arg);
50304         this_arg_conv.is_owned = ptr_is_owned(this_arg);
50305         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
50306         this_arg_conv.is_owned = false;
50307         jboolean ret_conv = ChannelFeatures_requires_unknown_bits(&this_arg_conv);
50308         return ret_conv;
50309 }
50310
50311 uint64_t  __attribute__((export_name("TS_ChannelFeatures_set_required_feature_bit"))) TS_ChannelFeatures_set_required_feature_bit(uint64_t this_arg, uint32_t bit) {
50312         LDKChannelFeatures this_arg_conv;
50313         this_arg_conv.inner = untag_ptr(this_arg);
50314         this_arg_conv.is_owned = ptr_is_owned(this_arg);
50315         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
50316         this_arg_conv.is_owned = false;
50317         LDKCResult_NoneNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneNoneZ), "LDKCResult_NoneNoneZ");
50318         *ret_conv = ChannelFeatures_set_required_feature_bit(&this_arg_conv, bit);
50319         return tag_ptr(ret_conv, true);
50320 }
50321
50322 uint64_t  __attribute__((export_name("TS_ChannelFeatures_set_optional_feature_bit"))) TS_ChannelFeatures_set_optional_feature_bit(uint64_t this_arg, uint32_t bit) {
50323         LDKChannelFeatures this_arg_conv;
50324         this_arg_conv.inner = untag_ptr(this_arg);
50325         this_arg_conv.is_owned = ptr_is_owned(this_arg);
50326         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
50327         this_arg_conv.is_owned = false;
50328         LDKCResult_NoneNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneNoneZ), "LDKCResult_NoneNoneZ");
50329         *ret_conv = ChannelFeatures_set_optional_feature_bit(&this_arg_conv, bit);
50330         return tag_ptr(ret_conv, true);
50331 }
50332
50333 uint64_t  __attribute__((export_name("TS_ChannelFeatures_set_required_custom_bit"))) TS_ChannelFeatures_set_required_custom_bit(uint64_t this_arg, uint32_t bit) {
50334         LDKChannelFeatures this_arg_conv;
50335         this_arg_conv.inner = untag_ptr(this_arg);
50336         this_arg_conv.is_owned = ptr_is_owned(this_arg);
50337         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
50338         this_arg_conv.is_owned = false;
50339         LDKCResult_NoneNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneNoneZ), "LDKCResult_NoneNoneZ");
50340         *ret_conv = ChannelFeatures_set_required_custom_bit(&this_arg_conv, bit);
50341         return tag_ptr(ret_conv, true);
50342 }
50343
50344 uint64_t  __attribute__((export_name("TS_ChannelFeatures_set_optional_custom_bit"))) TS_ChannelFeatures_set_optional_custom_bit(uint64_t this_arg, uint32_t bit) {
50345         LDKChannelFeatures this_arg_conv;
50346         this_arg_conv.inner = untag_ptr(this_arg);
50347         this_arg_conv.is_owned = ptr_is_owned(this_arg);
50348         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
50349         this_arg_conv.is_owned = false;
50350         LDKCResult_NoneNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneNoneZ), "LDKCResult_NoneNoneZ");
50351         *ret_conv = ChannelFeatures_set_optional_custom_bit(&this_arg_conv, bit);
50352         return tag_ptr(ret_conv, true);
50353 }
50354
50355 uint64_t  __attribute__((export_name("TS_Bolt11InvoiceFeatures_empty"))) TS_Bolt11InvoiceFeatures_empty() {
50356         LDKBolt11InvoiceFeatures ret_var = Bolt11InvoiceFeatures_empty();
50357         uint64_t ret_ref = 0;
50358         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
50359         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
50360         return ret_ref;
50361 }
50362
50363 jboolean  __attribute__((export_name("TS_Bolt11InvoiceFeatures_requires_unknown_bits_from"))) TS_Bolt11InvoiceFeatures_requires_unknown_bits_from(uint64_t this_arg, uint64_t other) {
50364         LDKBolt11InvoiceFeatures this_arg_conv;
50365         this_arg_conv.inner = untag_ptr(this_arg);
50366         this_arg_conv.is_owned = ptr_is_owned(this_arg);
50367         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
50368         this_arg_conv.is_owned = false;
50369         LDKBolt11InvoiceFeatures other_conv;
50370         other_conv.inner = untag_ptr(other);
50371         other_conv.is_owned = ptr_is_owned(other);
50372         CHECK_INNER_FIELD_ACCESS_OR_NULL(other_conv);
50373         other_conv.is_owned = false;
50374         jboolean ret_conv = Bolt11InvoiceFeatures_requires_unknown_bits_from(&this_arg_conv, &other_conv);
50375         return ret_conv;
50376 }
50377
50378 jboolean  __attribute__((export_name("TS_Bolt11InvoiceFeatures_requires_unknown_bits"))) TS_Bolt11InvoiceFeatures_requires_unknown_bits(uint64_t this_arg) {
50379         LDKBolt11InvoiceFeatures this_arg_conv;
50380         this_arg_conv.inner = untag_ptr(this_arg);
50381         this_arg_conv.is_owned = ptr_is_owned(this_arg);
50382         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
50383         this_arg_conv.is_owned = false;
50384         jboolean ret_conv = Bolt11InvoiceFeatures_requires_unknown_bits(&this_arg_conv);
50385         return ret_conv;
50386 }
50387
50388 uint64_t  __attribute__((export_name("TS_Bolt11InvoiceFeatures_set_required_feature_bit"))) TS_Bolt11InvoiceFeatures_set_required_feature_bit(uint64_t this_arg, uint32_t bit) {
50389         LDKBolt11InvoiceFeatures this_arg_conv;
50390         this_arg_conv.inner = untag_ptr(this_arg);
50391         this_arg_conv.is_owned = ptr_is_owned(this_arg);
50392         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
50393         this_arg_conv.is_owned = false;
50394         LDKCResult_NoneNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneNoneZ), "LDKCResult_NoneNoneZ");
50395         *ret_conv = Bolt11InvoiceFeatures_set_required_feature_bit(&this_arg_conv, bit);
50396         return tag_ptr(ret_conv, true);
50397 }
50398
50399 uint64_t  __attribute__((export_name("TS_Bolt11InvoiceFeatures_set_optional_feature_bit"))) TS_Bolt11InvoiceFeatures_set_optional_feature_bit(uint64_t this_arg, uint32_t bit) {
50400         LDKBolt11InvoiceFeatures this_arg_conv;
50401         this_arg_conv.inner = untag_ptr(this_arg);
50402         this_arg_conv.is_owned = ptr_is_owned(this_arg);
50403         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
50404         this_arg_conv.is_owned = false;
50405         LDKCResult_NoneNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneNoneZ), "LDKCResult_NoneNoneZ");
50406         *ret_conv = Bolt11InvoiceFeatures_set_optional_feature_bit(&this_arg_conv, bit);
50407         return tag_ptr(ret_conv, true);
50408 }
50409
50410 uint64_t  __attribute__((export_name("TS_Bolt11InvoiceFeatures_set_required_custom_bit"))) TS_Bolt11InvoiceFeatures_set_required_custom_bit(uint64_t this_arg, uint32_t bit) {
50411         LDKBolt11InvoiceFeatures this_arg_conv;
50412         this_arg_conv.inner = untag_ptr(this_arg);
50413         this_arg_conv.is_owned = ptr_is_owned(this_arg);
50414         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
50415         this_arg_conv.is_owned = false;
50416         LDKCResult_NoneNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneNoneZ), "LDKCResult_NoneNoneZ");
50417         *ret_conv = Bolt11InvoiceFeatures_set_required_custom_bit(&this_arg_conv, bit);
50418         return tag_ptr(ret_conv, true);
50419 }
50420
50421 uint64_t  __attribute__((export_name("TS_Bolt11InvoiceFeatures_set_optional_custom_bit"))) TS_Bolt11InvoiceFeatures_set_optional_custom_bit(uint64_t this_arg, uint32_t bit) {
50422         LDKBolt11InvoiceFeatures this_arg_conv;
50423         this_arg_conv.inner = untag_ptr(this_arg);
50424         this_arg_conv.is_owned = ptr_is_owned(this_arg);
50425         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
50426         this_arg_conv.is_owned = false;
50427         LDKCResult_NoneNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneNoneZ), "LDKCResult_NoneNoneZ");
50428         *ret_conv = Bolt11InvoiceFeatures_set_optional_custom_bit(&this_arg_conv, bit);
50429         return tag_ptr(ret_conv, true);
50430 }
50431
50432 uint64_t  __attribute__((export_name("TS_OfferFeatures_empty"))) TS_OfferFeatures_empty() {
50433         LDKOfferFeatures ret_var = OfferFeatures_empty();
50434         uint64_t ret_ref = 0;
50435         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
50436         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
50437         return ret_ref;
50438 }
50439
50440 jboolean  __attribute__((export_name("TS_OfferFeatures_requires_unknown_bits_from"))) TS_OfferFeatures_requires_unknown_bits_from(uint64_t this_arg, uint64_t other) {
50441         LDKOfferFeatures this_arg_conv;
50442         this_arg_conv.inner = untag_ptr(this_arg);
50443         this_arg_conv.is_owned = ptr_is_owned(this_arg);
50444         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
50445         this_arg_conv.is_owned = false;
50446         LDKOfferFeatures other_conv;
50447         other_conv.inner = untag_ptr(other);
50448         other_conv.is_owned = ptr_is_owned(other);
50449         CHECK_INNER_FIELD_ACCESS_OR_NULL(other_conv);
50450         other_conv.is_owned = false;
50451         jboolean ret_conv = OfferFeatures_requires_unknown_bits_from(&this_arg_conv, &other_conv);
50452         return ret_conv;
50453 }
50454
50455 jboolean  __attribute__((export_name("TS_OfferFeatures_requires_unknown_bits"))) TS_OfferFeatures_requires_unknown_bits(uint64_t this_arg) {
50456         LDKOfferFeatures this_arg_conv;
50457         this_arg_conv.inner = untag_ptr(this_arg);
50458         this_arg_conv.is_owned = ptr_is_owned(this_arg);
50459         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
50460         this_arg_conv.is_owned = false;
50461         jboolean ret_conv = OfferFeatures_requires_unknown_bits(&this_arg_conv);
50462         return ret_conv;
50463 }
50464
50465 uint64_t  __attribute__((export_name("TS_OfferFeatures_set_required_feature_bit"))) TS_OfferFeatures_set_required_feature_bit(uint64_t this_arg, uint32_t bit) {
50466         LDKOfferFeatures this_arg_conv;
50467         this_arg_conv.inner = untag_ptr(this_arg);
50468         this_arg_conv.is_owned = ptr_is_owned(this_arg);
50469         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
50470         this_arg_conv.is_owned = false;
50471         LDKCResult_NoneNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneNoneZ), "LDKCResult_NoneNoneZ");
50472         *ret_conv = OfferFeatures_set_required_feature_bit(&this_arg_conv, bit);
50473         return tag_ptr(ret_conv, true);
50474 }
50475
50476 uint64_t  __attribute__((export_name("TS_OfferFeatures_set_optional_feature_bit"))) TS_OfferFeatures_set_optional_feature_bit(uint64_t this_arg, uint32_t bit) {
50477         LDKOfferFeatures this_arg_conv;
50478         this_arg_conv.inner = untag_ptr(this_arg);
50479         this_arg_conv.is_owned = ptr_is_owned(this_arg);
50480         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
50481         this_arg_conv.is_owned = false;
50482         LDKCResult_NoneNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneNoneZ), "LDKCResult_NoneNoneZ");
50483         *ret_conv = OfferFeatures_set_optional_feature_bit(&this_arg_conv, bit);
50484         return tag_ptr(ret_conv, true);
50485 }
50486
50487 uint64_t  __attribute__((export_name("TS_OfferFeatures_set_required_custom_bit"))) TS_OfferFeatures_set_required_custom_bit(uint64_t this_arg, uint32_t bit) {
50488         LDKOfferFeatures this_arg_conv;
50489         this_arg_conv.inner = untag_ptr(this_arg);
50490         this_arg_conv.is_owned = ptr_is_owned(this_arg);
50491         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
50492         this_arg_conv.is_owned = false;
50493         LDKCResult_NoneNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneNoneZ), "LDKCResult_NoneNoneZ");
50494         *ret_conv = OfferFeatures_set_required_custom_bit(&this_arg_conv, bit);
50495         return tag_ptr(ret_conv, true);
50496 }
50497
50498 uint64_t  __attribute__((export_name("TS_OfferFeatures_set_optional_custom_bit"))) TS_OfferFeatures_set_optional_custom_bit(uint64_t this_arg, uint32_t bit) {
50499         LDKOfferFeatures this_arg_conv;
50500         this_arg_conv.inner = untag_ptr(this_arg);
50501         this_arg_conv.is_owned = ptr_is_owned(this_arg);
50502         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
50503         this_arg_conv.is_owned = false;
50504         LDKCResult_NoneNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneNoneZ), "LDKCResult_NoneNoneZ");
50505         *ret_conv = OfferFeatures_set_optional_custom_bit(&this_arg_conv, bit);
50506         return tag_ptr(ret_conv, true);
50507 }
50508
50509 uint64_t  __attribute__((export_name("TS_InvoiceRequestFeatures_empty"))) TS_InvoiceRequestFeatures_empty() {
50510         LDKInvoiceRequestFeatures ret_var = InvoiceRequestFeatures_empty();
50511         uint64_t ret_ref = 0;
50512         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
50513         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
50514         return ret_ref;
50515 }
50516
50517 jboolean  __attribute__((export_name("TS_InvoiceRequestFeatures_requires_unknown_bits_from"))) TS_InvoiceRequestFeatures_requires_unknown_bits_from(uint64_t this_arg, uint64_t other) {
50518         LDKInvoiceRequestFeatures this_arg_conv;
50519         this_arg_conv.inner = untag_ptr(this_arg);
50520         this_arg_conv.is_owned = ptr_is_owned(this_arg);
50521         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
50522         this_arg_conv.is_owned = false;
50523         LDKInvoiceRequestFeatures other_conv;
50524         other_conv.inner = untag_ptr(other);
50525         other_conv.is_owned = ptr_is_owned(other);
50526         CHECK_INNER_FIELD_ACCESS_OR_NULL(other_conv);
50527         other_conv.is_owned = false;
50528         jboolean ret_conv = InvoiceRequestFeatures_requires_unknown_bits_from(&this_arg_conv, &other_conv);
50529         return ret_conv;
50530 }
50531
50532 jboolean  __attribute__((export_name("TS_InvoiceRequestFeatures_requires_unknown_bits"))) TS_InvoiceRequestFeatures_requires_unknown_bits(uint64_t this_arg) {
50533         LDKInvoiceRequestFeatures this_arg_conv;
50534         this_arg_conv.inner = untag_ptr(this_arg);
50535         this_arg_conv.is_owned = ptr_is_owned(this_arg);
50536         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
50537         this_arg_conv.is_owned = false;
50538         jboolean ret_conv = InvoiceRequestFeatures_requires_unknown_bits(&this_arg_conv);
50539         return ret_conv;
50540 }
50541
50542 uint64_t  __attribute__((export_name("TS_InvoiceRequestFeatures_set_required_feature_bit"))) TS_InvoiceRequestFeatures_set_required_feature_bit(uint64_t this_arg, uint32_t bit) {
50543         LDKInvoiceRequestFeatures this_arg_conv;
50544         this_arg_conv.inner = untag_ptr(this_arg);
50545         this_arg_conv.is_owned = ptr_is_owned(this_arg);
50546         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
50547         this_arg_conv.is_owned = false;
50548         LDKCResult_NoneNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneNoneZ), "LDKCResult_NoneNoneZ");
50549         *ret_conv = InvoiceRequestFeatures_set_required_feature_bit(&this_arg_conv, bit);
50550         return tag_ptr(ret_conv, true);
50551 }
50552
50553 uint64_t  __attribute__((export_name("TS_InvoiceRequestFeatures_set_optional_feature_bit"))) TS_InvoiceRequestFeatures_set_optional_feature_bit(uint64_t this_arg, uint32_t bit) {
50554         LDKInvoiceRequestFeatures this_arg_conv;
50555         this_arg_conv.inner = untag_ptr(this_arg);
50556         this_arg_conv.is_owned = ptr_is_owned(this_arg);
50557         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
50558         this_arg_conv.is_owned = false;
50559         LDKCResult_NoneNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneNoneZ), "LDKCResult_NoneNoneZ");
50560         *ret_conv = InvoiceRequestFeatures_set_optional_feature_bit(&this_arg_conv, bit);
50561         return tag_ptr(ret_conv, true);
50562 }
50563
50564 uint64_t  __attribute__((export_name("TS_InvoiceRequestFeatures_set_required_custom_bit"))) TS_InvoiceRequestFeatures_set_required_custom_bit(uint64_t this_arg, uint32_t bit) {
50565         LDKInvoiceRequestFeatures this_arg_conv;
50566         this_arg_conv.inner = untag_ptr(this_arg);
50567         this_arg_conv.is_owned = ptr_is_owned(this_arg);
50568         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
50569         this_arg_conv.is_owned = false;
50570         LDKCResult_NoneNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneNoneZ), "LDKCResult_NoneNoneZ");
50571         *ret_conv = InvoiceRequestFeatures_set_required_custom_bit(&this_arg_conv, bit);
50572         return tag_ptr(ret_conv, true);
50573 }
50574
50575 uint64_t  __attribute__((export_name("TS_InvoiceRequestFeatures_set_optional_custom_bit"))) TS_InvoiceRequestFeatures_set_optional_custom_bit(uint64_t this_arg, uint32_t bit) {
50576         LDKInvoiceRequestFeatures this_arg_conv;
50577         this_arg_conv.inner = untag_ptr(this_arg);
50578         this_arg_conv.is_owned = ptr_is_owned(this_arg);
50579         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
50580         this_arg_conv.is_owned = false;
50581         LDKCResult_NoneNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneNoneZ), "LDKCResult_NoneNoneZ");
50582         *ret_conv = InvoiceRequestFeatures_set_optional_custom_bit(&this_arg_conv, bit);
50583         return tag_ptr(ret_conv, true);
50584 }
50585
50586 uint64_t  __attribute__((export_name("TS_Bolt12InvoiceFeatures_empty"))) TS_Bolt12InvoiceFeatures_empty() {
50587         LDKBolt12InvoiceFeatures ret_var = Bolt12InvoiceFeatures_empty();
50588         uint64_t ret_ref = 0;
50589         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
50590         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
50591         return ret_ref;
50592 }
50593
50594 jboolean  __attribute__((export_name("TS_Bolt12InvoiceFeatures_requires_unknown_bits_from"))) TS_Bolt12InvoiceFeatures_requires_unknown_bits_from(uint64_t this_arg, uint64_t other) {
50595         LDKBolt12InvoiceFeatures this_arg_conv;
50596         this_arg_conv.inner = untag_ptr(this_arg);
50597         this_arg_conv.is_owned = ptr_is_owned(this_arg);
50598         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
50599         this_arg_conv.is_owned = false;
50600         LDKBolt12InvoiceFeatures other_conv;
50601         other_conv.inner = untag_ptr(other);
50602         other_conv.is_owned = ptr_is_owned(other);
50603         CHECK_INNER_FIELD_ACCESS_OR_NULL(other_conv);
50604         other_conv.is_owned = false;
50605         jboolean ret_conv = Bolt12InvoiceFeatures_requires_unknown_bits_from(&this_arg_conv, &other_conv);
50606         return ret_conv;
50607 }
50608
50609 jboolean  __attribute__((export_name("TS_Bolt12InvoiceFeatures_requires_unknown_bits"))) TS_Bolt12InvoiceFeatures_requires_unknown_bits(uint64_t this_arg) {
50610         LDKBolt12InvoiceFeatures this_arg_conv;
50611         this_arg_conv.inner = untag_ptr(this_arg);
50612         this_arg_conv.is_owned = ptr_is_owned(this_arg);
50613         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
50614         this_arg_conv.is_owned = false;
50615         jboolean ret_conv = Bolt12InvoiceFeatures_requires_unknown_bits(&this_arg_conv);
50616         return ret_conv;
50617 }
50618
50619 uint64_t  __attribute__((export_name("TS_Bolt12InvoiceFeatures_set_required_feature_bit"))) TS_Bolt12InvoiceFeatures_set_required_feature_bit(uint64_t this_arg, uint32_t bit) {
50620         LDKBolt12InvoiceFeatures this_arg_conv;
50621         this_arg_conv.inner = untag_ptr(this_arg);
50622         this_arg_conv.is_owned = ptr_is_owned(this_arg);
50623         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
50624         this_arg_conv.is_owned = false;
50625         LDKCResult_NoneNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneNoneZ), "LDKCResult_NoneNoneZ");
50626         *ret_conv = Bolt12InvoiceFeatures_set_required_feature_bit(&this_arg_conv, bit);
50627         return tag_ptr(ret_conv, true);
50628 }
50629
50630 uint64_t  __attribute__((export_name("TS_Bolt12InvoiceFeatures_set_optional_feature_bit"))) TS_Bolt12InvoiceFeatures_set_optional_feature_bit(uint64_t this_arg, uint32_t bit) {
50631         LDKBolt12InvoiceFeatures this_arg_conv;
50632         this_arg_conv.inner = untag_ptr(this_arg);
50633         this_arg_conv.is_owned = ptr_is_owned(this_arg);
50634         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
50635         this_arg_conv.is_owned = false;
50636         LDKCResult_NoneNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneNoneZ), "LDKCResult_NoneNoneZ");
50637         *ret_conv = Bolt12InvoiceFeatures_set_optional_feature_bit(&this_arg_conv, bit);
50638         return tag_ptr(ret_conv, true);
50639 }
50640
50641 uint64_t  __attribute__((export_name("TS_Bolt12InvoiceFeatures_set_required_custom_bit"))) TS_Bolt12InvoiceFeatures_set_required_custom_bit(uint64_t this_arg, uint32_t bit) {
50642         LDKBolt12InvoiceFeatures this_arg_conv;
50643         this_arg_conv.inner = untag_ptr(this_arg);
50644         this_arg_conv.is_owned = ptr_is_owned(this_arg);
50645         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
50646         this_arg_conv.is_owned = false;
50647         LDKCResult_NoneNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneNoneZ), "LDKCResult_NoneNoneZ");
50648         *ret_conv = Bolt12InvoiceFeatures_set_required_custom_bit(&this_arg_conv, bit);
50649         return tag_ptr(ret_conv, true);
50650 }
50651
50652 uint64_t  __attribute__((export_name("TS_Bolt12InvoiceFeatures_set_optional_custom_bit"))) TS_Bolt12InvoiceFeatures_set_optional_custom_bit(uint64_t this_arg, uint32_t bit) {
50653         LDKBolt12InvoiceFeatures this_arg_conv;
50654         this_arg_conv.inner = untag_ptr(this_arg);
50655         this_arg_conv.is_owned = ptr_is_owned(this_arg);
50656         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
50657         this_arg_conv.is_owned = false;
50658         LDKCResult_NoneNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneNoneZ), "LDKCResult_NoneNoneZ");
50659         *ret_conv = Bolt12InvoiceFeatures_set_optional_custom_bit(&this_arg_conv, bit);
50660         return tag_ptr(ret_conv, true);
50661 }
50662
50663 uint64_t  __attribute__((export_name("TS_BlindedHopFeatures_empty"))) TS_BlindedHopFeatures_empty() {
50664         LDKBlindedHopFeatures ret_var = BlindedHopFeatures_empty();
50665         uint64_t ret_ref = 0;
50666         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
50667         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
50668         return ret_ref;
50669 }
50670
50671 jboolean  __attribute__((export_name("TS_BlindedHopFeatures_requires_unknown_bits_from"))) TS_BlindedHopFeatures_requires_unknown_bits_from(uint64_t this_arg, uint64_t other) {
50672         LDKBlindedHopFeatures this_arg_conv;
50673         this_arg_conv.inner = untag_ptr(this_arg);
50674         this_arg_conv.is_owned = ptr_is_owned(this_arg);
50675         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
50676         this_arg_conv.is_owned = false;
50677         LDKBlindedHopFeatures other_conv;
50678         other_conv.inner = untag_ptr(other);
50679         other_conv.is_owned = ptr_is_owned(other);
50680         CHECK_INNER_FIELD_ACCESS_OR_NULL(other_conv);
50681         other_conv.is_owned = false;
50682         jboolean ret_conv = BlindedHopFeatures_requires_unknown_bits_from(&this_arg_conv, &other_conv);
50683         return ret_conv;
50684 }
50685
50686 jboolean  __attribute__((export_name("TS_BlindedHopFeatures_requires_unknown_bits"))) TS_BlindedHopFeatures_requires_unknown_bits(uint64_t this_arg) {
50687         LDKBlindedHopFeatures this_arg_conv;
50688         this_arg_conv.inner = untag_ptr(this_arg);
50689         this_arg_conv.is_owned = ptr_is_owned(this_arg);
50690         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
50691         this_arg_conv.is_owned = false;
50692         jboolean ret_conv = BlindedHopFeatures_requires_unknown_bits(&this_arg_conv);
50693         return ret_conv;
50694 }
50695
50696 uint64_t  __attribute__((export_name("TS_BlindedHopFeatures_set_required_feature_bit"))) TS_BlindedHopFeatures_set_required_feature_bit(uint64_t this_arg, uint32_t bit) {
50697         LDKBlindedHopFeatures this_arg_conv;
50698         this_arg_conv.inner = untag_ptr(this_arg);
50699         this_arg_conv.is_owned = ptr_is_owned(this_arg);
50700         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
50701         this_arg_conv.is_owned = false;
50702         LDKCResult_NoneNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneNoneZ), "LDKCResult_NoneNoneZ");
50703         *ret_conv = BlindedHopFeatures_set_required_feature_bit(&this_arg_conv, bit);
50704         return tag_ptr(ret_conv, true);
50705 }
50706
50707 uint64_t  __attribute__((export_name("TS_BlindedHopFeatures_set_optional_feature_bit"))) TS_BlindedHopFeatures_set_optional_feature_bit(uint64_t this_arg, uint32_t bit) {
50708         LDKBlindedHopFeatures this_arg_conv;
50709         this_arg_conv.inner = untag_ptr(this_arg);
50710         this_arg_conv.is_owned = ptr_is_owned(this_arg);
50711         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
50712         this_arg_conv.is_owned = false;
50713         LDKCResult_NoneNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneNoneZ), "LDKCResult_NoneNoneZ");
50714         *ret_conv = BlindedHopFeatures_set_optional_feature_bit(&this_arg_conv, bit);
50715         return tag_ptr(ret_conv, true);
50716 }
50717
50718 uint64_t  __attribute__((export_name("TS_BlindedHopFeatures_set_required_custom_bit"))) TS_BlindedHopFeatures_set_required_custom_bit(uint64_t this_arg, uint32_t bit) {
50719         LDKBlindedHopFeatures this_arg_conv;
50720         this_arg_conv.inner = untag_ptr(this_arg);
50721         this_arg_conv.is_owned = ptr_is_owned(this_arg);
50722         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
50723         this_arg_conv.is_owned = false;
50724         LDKCResult_NoneNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneNoneZ), "LDKCResult_NoneNoneZ");
50725         *ret_conv = BlindedHopFeatures_set_required_custom_bit(&this_arg_conv, bit);
50726         return tag_ptr(ret_conv, true);
50727 }
50728
50729 uint64_t  __attribute__((export_name("TS_BlindedHopFeatures_set_optional_custom_bit"))) TS_BlindedHopFeatures_set_optional_custom_bit(uint64_t this_arg, uint32_t bit) {
50730         LDKBlindedHopFeatures this_arg_conv;
50731         this_arg_conv.inner = untag_ptr(this_arg);
50732         this_arg_conv.is_owned = ptr_is_owned(this_arg);
50733         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
50734         this_arg_conv.is_owned = false;
50735         LDKCResult_NoneNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneNoneZ), "LDKCResult_NoneNoneZ");
50736         *ret_conv = BlindedHopFeatures_set_optional_custom_bit(&this_arg_conv, bit);
50737         return tag_ptr(ret_conv, true);
50738 }
50739
50740 uint64_t  __attribute__((export_name("TS_ChannelTypeFeatures_empty"))) TS_ChannelTypeFeatures_empty() {
50741         LDKChannelTypeFeatures ret_var = ChannelTypeFeatures_empty();
50742         uint64_t ret_ref = 0;
50743         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
50744         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
50745         return ret_ref;
50746 }
50747
50748 jboolean  __attribute__((export_name("TS_ChannelTypeFeatures_requires_unknown_bits_from"))) TS_ChannelTypeFeatures_requires_unknown_bits_from(uint64_t this_arg, uint64_t other) {
50749         LDKChannelTypeFeatures this_arg_conv;
50750         this_arg_conv.inner = untag_ptr(this_arg);
50751         this_arg_conv.is_owned = ptr_is_owned(this_arg);
50752         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
50753         this_arg_conv.is_owned = false;
50754         LDKChannelTypeFeatures other_conv;
50755         other_conv.inner = untag_ptr(other);
50756         other_conv.is_owned = ptr_is_owned(other);
50757         CHECK_INNER_FIELD_ACCESS_OR_NULL(other_conv);
50758         other_conv.is_owned = false;
50759         jboolean ret_conv = ChannelTypeFeatures_requires_unknown_bits_from(&this_arg_conv, &other_conv);
50760         return ret_conv;
50761 }
50762
50763 jboolean  __attribute__((export_name("TS_ChannelTypeFeatures_requires_unknown_bits"))) TS_ChannelTypeFeatures_requires_unknown_bits(uint64_t this_arg) {
50764         LDKChannelTypeFeatures this_arg_conv;
50765         this_arg_conv.inner = untag_ptr(this_arg);
50766         this_arg_conv.is_owned = ptr_is_owned(this_arg);
50767         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
50768         this_arg_conv.is_owned = false;
50769         jboolean ret_conv = ChannelTypeFeatures_requires_unknown_bits(&this_arg_conv);
50770         return ret_conv;
50771 }
50772
50773 uint64_t  __attribute__((export_name("TS_ChannelTypeFeatures_set_required_feature_bit"))) TS_ChannelTypeFeatures_set_required_feature_bit(uint64_t this_arg, uint32_t bit) {
50774         LDKChannelTypeFeatures this_arg_conv;
50775         this_arg_conv.inner = untag_ptr(this_arg);
50776         this_arg_conv.is_owned = ptr_is_owned(this_arg);
50777         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
50778         this_arg_conv.is_owned = false;
50779         LDKCResult_NoneNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneNoneZ), "LDKCResult_NoneNoneZ");
50780         *ret_conv = ChannelTypeFeatures_set_required_feature_bit(&this_arg_conv, bit);
50781         return tag_ptr(ret_conv, true);
50782 }
50783
50784 uint64_t  __attribute__((export_name("TS_ChannelTypeFeatures_set_optional_feature_bit"))) TS_ChannelTypeFeatures_set_optional_feature_bit(uint64_t this_arg, uint32_t bit) {
50785         LDKChannelTypeFeatures this_arg_conv;
50786         this_arg_conv.inner = untag_ptr(this_arg);
50787         this_arg_conv.is_owned = ptr_is_owned(this_arg);
50788         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
50789         this_arg_conv.is_owned = false;
50790         LDKCResult_NoneNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneNoneZ), "LDKCResult_NoneNoneZ");
50791         *ret_conv = ChannelTypeFeatures_set_optional_feature_bit(&this_arg_conv, bit);
50792         return tag_ptr(ret_conv, true);
50793 }
50794
50795 uint64_t  __attribute__((export_name("TS_ChannelTypeFeatures_set_required_custom_bit"))) TS_ChannelTypeFeatures_set_required_custom_bit(uint64_t this_arg, uint32_t bit) {
50796         LDKChannelTypeFeatures this_arg_conv;
50797         this_arg_conv.inner = untag_ptr(this_arg);
50798         this_arg_conv.is_owned = ptr_is_owned(this_arg);
50799         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
50800         this_arg_conv.is_owned = false;
50801         LDKCResult_NoneNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneNoneZ), "LDKCResult_NoneNoneZ");
50802         *ret_conv = ChannelTypeFeatures_set_required_custom_bit(&this_arg_conv, bit);
50803         return tag_ptr(ret_conv, true);
50804 }
50805
50806 uint64_t  __attribute__((export_name("TS_ChannelTypeFeatures_set_optional_custom_bit"))) TS_ChannelTypeFeatures_set_optional_custom_bit(uint64_t this_arg, uint32_t bit) {
50807         LDKChannelTypeFeatures this_arg_conv;
50808         this_arg_conv.inner = untag_ptr(this_arg);
50809         this_arg_conv.is_owned = ptr_is_owned(this_arg);
50810         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
50811         this_arg_conv.is_owned = false;
50812         LDKCResult_NoneNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneNoneZ), "LDKCResult_NoneNoneZ");
50813         *ret_conv = ChannelTypeFeatures_set_optional_custom_bit(&this_arg_conv, bit);
50814         return tag_ptr(ret_conv, true);
50815 }
50816
50817 int8_tArray  __attribute__((export_name("TS_InitFeatures_write"))) TS_InitFeatures_write(uint64_t obj) {
50818         LDKInitFeatures obj_conv;
50819         obj_conv.inner = untag_ptr(obj);
50820         obj_conv.is_owned = ptr_is_owned(obj);
50821         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
50822         obj_conv.is_owned = false;
50823         LDKCVec_u8Z ret_var = InitFeatures_write(&obj_conv);
50824         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
50825         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
50826         CVec_u8Z_free(ret_var);
50827         return ret_arr;
50828 }
50829
50830 uint64_t  __attribute__((export_name("TS_InitFeatures_read"))) TS_InitFeatures_read(int8_tArray ser) {
50831         LDKu8slice ser_ref;
50832         ser_ref.datalen = ser->arr_len;
50833         ser_ref.data = ser->elems;
50834         LDKCResult_InitFeaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InitFeaturesDecodeErrorZ), "LDKCResult_InitFeaturesDecodeErrorZ");
50835         *ret_conv = InitFeatures_read(ser_ref);
50836         FREE(ser);
50837         return tag_ptr(ret_conv, true);
50838 }
50839
50840 int8_tArray  __attribute__((export_name("TS_ChannelFeatures_write"))) TS_ChannelFeatures_write(uint64_t obj) {
50841         LDKChannelFeatures obj_conv;
50842         obj_conv.inner = untag_ptr(obj);
50843         obj_conv.is_owned = ptr_is_owned(obj);
50844         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
50845         obj_conv.is_owned = false;
50846         LDKCVec_u8Z ret_var = ChannelFeatures_write(&obj_conv);
50847         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
50848         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
50849         CVec_u8Z_free(ret_var);
50850         return ret_arr;
50851 }
50852
50853 uint64_t  __attribute__((export_name("TS_ChannelFeatures_read"))) TS_ChannelFeatures_read(int8_tArray ser) {
50854         LDKu8slice ser_ref;
50855         ser_ref.datalen = ser->arr_len;
50856         ser_ref.data = ser->elems;
50857         LDKCResult_ChannelFeaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelFeaturesDecodeErrorZ), "LDKCResult_ChannelFeaturesDecodeErrorZ");
50858         *ret_conv = ChannelFeatures_read(ser_ref);
50859         FREE(ser);
50860         return tag_ptr(ret_conv, true);
50861 }
50862
50863 int8_tArray  __attribute__((export_name("TS_NodeFeatures_write"))) TS_NodeFeatures_write(uint64_t obj) {
50864         LDKNodeFeatures obj_conv;
50865         obj_conv.inner = untag_ptr(obj);
50866         obj_conv.is_owned = ptr_is_owned(obj);
50867         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
50868         obj_conv.is_owned = false;
50869         LDKCVec_u8Z ret_var = NodeFeatures_write(&obj_conv);
50870         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
50871         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
50872         CVec_u8Z_free(ret_var);
50873         return ret_arr;
50874 }
50875
50876 uint64_t  __attribute__((export_name("TS_NodeFeatures_read"))) TS_NodeFeatures_read(int8_tArray ser) {
50877         LDKu8slice ser_ref;
50878         ser_ref.datalen = ser->arr_len;
50879         ser_ref.data = ser->elems;
50880         LDKCResult_NodeFeaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NodeFeaturesDecodeErrorZ), "LDKCResult_NodeFeaturesDecodeErrorZ");
50881         *ret_conv = NodeFeatures_read(ser_ref);
50882         FREE(ser);
50883         return tag_ptr(ret_conv, true);
50884 }
50885
50886 int8_tArray  __attribute__((export_name("TS_Bolt11InvoiceFeatures_write"))) TS_Bolt11InvoiceFeatures_write(uint64_t obj) {
50887         LDKBolt11InvoiceFeatures obj_conv;
50888         obj_conv.inner = untag_ptr(obj);
50889         obj_conv.is_owned = ptr_is_owned(obj);
50890         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
50891         obj_conv.is_owned = false;
50892         LDKCVec_u8Z ret_var = Bolt11InvoiceFeatures_write(&obj_conv);
50893         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
50894         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
50895         CVec_u8Z_free(ret_var);
50896         return ret_arr;
50897 }
50898
50899 uint64_t  __attribute__((export_name("TS_Bolt11InvoiceFeatures_read"))) TS_Bolt11InvoiceFeatures_read(int8_tArray ser) {
50900         LDKu8slice ser_ref;
50901         ser_ref.datalen = ser->arr_len;
50902         ser_ref.data = ser->elems;
50903         LDKCResult_Bolt11InvoiceFeaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_Bolt11InvoiceFeaturesDecodeErrorZ), "LDKCResult_Bolt11InvoiceFeaturesDecodeErrorZ");
50904         *ret_conv = Bolt11InvoiceFeatures_read(ser_ref);
50905         FREE(ser);
50906         return tag_ptr(ret_conv, true);
50907 }
50908
50909 int8_tArray  __attribute__((export_name("TS_Bolt12InvoiceFeatures_write"))) TS_Bolt12InvoiceFeatures_write(uint64_t obj) {
50910         LDKBolt12InvoiceFeatures obj_conv;
50911         obj_conv.inner = untag_ptr(obj);
50912         obj_conv.is_owned = ptr_is_owned(obj);
50913         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
50914         obj_conv.is_owned = false;
50915         LDKCVec_u8Z ret_var = Bolt12InvoiceFeatures_write(&obj_conv);
50916         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
50917         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
50918         CVec_u8Z_free(ret_var);
50919         return ret_arr;
50920 }
50921
50922 uint64_t  __attribute__((export_name("TS_Bolt12InvoiceFeatures_read"))) TS_Bolt12InvoiceFeatures_read(int8_tArray ser) {
50923         LDKu8slice ser_ref;
50924         ser_ref.datalen = ser->arr_len;
50925         ser_ref.data = ser->elems;
50926         LDKCResult_Bolt12InvoiceFeaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_Bolt12InvoiceFeaturesDecodeErrorZ), "LDKCResult_Bolt12InvoiceFeaturesDecodeErrorZ");
50927         *ret_conv = Bolt12InvoiceFeatures_read(ser_ref);
50928         FREE(ser);
50929         return tag_ptr(ret_conv, true);
50930 }
50931
50932 int8_tArray  __attribute__((export_name("TS_BlindedHopFeatures_write"))) TS_BlindedHopFeatures_write(uint64_t obj) {
50933         LDKBlindedHopFeatures obj_conv;
50934         obj_conv.inner = untag_ptr(obj);
50935         obj_conv.is_owned = ptr_is_owned(obj);
50936         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
50937         obj_conv.is_owned = false;
50938         LDKCVec_u8Z ret_var = BlindedHopFeatures_write(&obj_conv);
50939         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
50940         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
50941         CVec_u8Z_free(ret_var);
50942         return ret_arr;
50943 }
50944
50945 uint64_t  __attribute__((export_name("TS_BlindedHopFeatures_read"))) TS_BlindedHopFeatures_read(int8_tArray ser) {
50946         LDKu8slice ser_ref;
50947         ser_ref.datalen = ser->arr_len;
50948         ser_ref.data = ser->elems;
50949         LDKCResult_BlindedHopFeaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_BlindedHopFeaturesDecodeErrorZ), "LDKCResult_BlindedHopFeaturesDecodeErrorZ");
50950         *ret_conv = BlindedHopFeatures_read(ser_ref);
50951         FREE(ser);
50952         return tag_ptr(ret_conv, true);
50953 }
50954
50955 int8_tArray  __attribute__((export_name("TS_ChannelTypeFeatures_write"))) TS_ChannelTypeFeatures_write(uint64_t obj) {
50956         LDKChannelTypeFeatures obj_conv;
50957         obj_conv.inner = untag_ptr(obj);
50958         obj_conv.is_owned = ptr_is_owned(obj);
50959         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
50960         obj_conv.is_owned = false;
50961         LDKCVec_u8Z ret_var = ChannelTypeFeatures_write(&obj_conv);
50962         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
50963         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
50964         CVec_u8Z_free(ret_var);
50965         return ret_arr;
50966 }
50967
50968 uint64_t  __attribute__((export_name("TS_ChannelTypeFeatures_read"))) TS_ChannelTypeFeatures_read(int8_tArray ser) {
50969         LDKu8slice ser_ref;
50970         ser_ref.datalen = ser->arr_len;
50971         ser_ref.data = ser->elems;
50972         LDKCResult_ChannelTypeFeaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelTypeFeaturesDecodeErrorZ), "LDKCResult_ChannelTypeFeaturesDecodeErrorZ");
50973         *ret_conv = ChannelTypeFeatures_read(ser_ref);
50974         FREE(ser);
50975         return tag_ptr(ret_conv, true);
50976 }
50977
50978 void  __attribute__((export_name("TS_InitFeatures_set_data_loss_protect_optional"))) TS_InitFeatures_set_data_loss_protect_optional(uint64_t this_arg) {
50979         LDKInitFeatures this_arg_conv;
50980         this_arg_conv.inner = untag_ptr(this_arg);
50981         this_arg_conv.is_owned = ptr_is_owned(this_arg);
50982         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
50983         this_arg_conv.is_owned = false;
50984         InitFeatures_set_data_loss_protect_optional(&this_arg_conv);
50985 }
50986
50987 void  __attribute__((export_name("TS_InitFeatures_set_data_loss_protect_required"))) TS_InitFeatures_set_data_loss_protect_required(uint64_t this_arg) {
50988         LDKInitFeatures this_arg_conv;
50989         this_arg_conv.inner = untag_ptr(this_arg);
50990         this_arg_conv.is_owned = ptr_is_owned(this_arg);
50991         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
50992         this_arg_conv.is_owned = false;
50993         InitFeatures_set_data_loss_protect_required(&this_arg_conv);
50994 }
50995
50996 jboolean  __attribute__((export_name("TS_InitFeatures_supports_data_loss_protect"))) TS_InitFeatures_supports_data_loss_protect(uint64_t this_arg) {
50997         LDKInitFeatures this_arg_conv;
50998         this_arg_conv.inner = untag_ptr(this_arg);
50999         this_arg_conv.is_owned = ptr_is_owned(this_arg);
51000         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
51001         this_arg_conv.is_owned = false;
51002         jboolean ret_conv = InitFeatures_supports_data_loss_protect(&this_arg_conv);
51003         return ret_conv;
51004 }
51005
51006 void  __attribute__((export_name("TS_NodeFeatures_set_data_loss_protect_optional"))) TS_NodeFeatures_set_data_loss_protect_optional(uint64_t this_arg) {
51007         LDKNodeFeatures this_arg_conv;
51008         this_arg_conv.inner = untag_ptr(this_arg);
51009         this_arg_conv.is_owned = ptr_is_owned(this_arg);
51010         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
51011         this_arg_conv.is_owned = false;
51012         NodeFeatures_set_data_loss_protect_optional(&this_arg_conv);
51013 }
51014
51015 void  __attribute__((export_name("TS_NodeFeatures_set_data_loss_protect_required"))) TS_NodeFeatures_set_data_loss_protect_required(uint64_t this_arg) {
51016         LDKNodeFeatures this_arg_conv;
51017         this_arg_conv.inner = untag_ptr(this_arg);
51018         this_arg_conv.is_owned = ptr_is_owned(this_arg);
51019         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
51020         this_arg_conv.is_owned = false;
51021         NodeFeatures_set_data_loss_protect_required(&this_arg_conv);
51022 }
51023
51024 jboolean  __attribute__((export_name("TS_NodeFeatures_supports_data_loss_protect"))) TS_NodeFeatures_supports_data_loss_protect(uint64_t this_arg) {
51025         LDKNodeFeatures this_arg_conv;
51026         this_arg_conv.inner = untag_ptr(this_arg);
51027         this_arg_conv.is_owned = ptr_is_owned(this_arg);
51028         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
51029         this_arg_conv.is_owned = false;
51030         jboolean ret_conv = NodeFeatures_supports_data_loss_protect(&this_arg_conv);
51031         return ret_conv;
51032 }
51033
51034 jboolean  __attribute__((export_name("TS_InitFeatures_requires_data_loss_protect"))) TS_InitFeatures_requires_data_loss_protect(uint64_t this_arg) {
51035         LDKInitFeatures this_arg_conv;
51036         this_arg_conv.inner = untag_ptr(this_arg);
51037         this_arg_conv.is_owned = ptr_is_owned(this_arg);
51038         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
51039         this_arg_conv.is_owned = false;
51040         jboolean ret_conv = InitFeatures_requires_data_loss_protect(&this_arg_conv);
51041         return ret_conv;
51042 }
51043
51044 jboolean  __attribute__((export_name("TS_NodeFeatures_requires_data_loss_protect"))) TS_NodeFeatures_requires_data_loss_protect(uint64_t this_arg) {
51045         LDKNodeFeatures this_arg_conv;
51046         this_arg_conv.inner = untag_ptr(this_arg);
51047         this_arg_conv.is_owned = ptr_is_owned(this_arg);
51048         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
51049         this_arg_conv.is_owned = false;
51050         jboolean ret_conv = NodeFeatures_requires_data_loss_protect(&this_arg_conv);
51051         return ret_conv;
51052 }
51053
51054 void  __attribute__((export_name("TS_InitFeatures_set_initial_routing_sync_optional"))) TS_InitFeatures_set_initial_routing_sync_optional(uint64_t this_arg) {
51055         LDKInitFeatures this_arg_conv;
51056         this_arg_conv.inner = untag_ptr(this_arg);
51057         this_arg_conv.is_owned = ptr_is_owned(this_arg);
51058         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
51059         this_arg_conv.is_owned = false;
51060         InitFeatures_set_initial_routing_sync_optional(&this_arg_conv);
51061 }
51062
51063 void  __attribute__((export_name("TS_InitFeatures_set_initial_routing_sync_required"))) TS_InitFeatures_set_initial_routing_sync_required(uint64_t this_arg) {
51064         LDKInitFeatures this_arg_conv;
51065         this_arg_conv.inner = untag_ptr(this_arg);
51066         this_arg_conv.is_owned = ptr_is_owned(this_arg);
51067         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
51068         this_arg_conv.is_owned = false;
51069         InitFeatures_set_initial_routing_sync_required(&this_arg_conv);
51070 }
51071
51072 jboolean  __attribute__((export_name("TS_InitFeatures_initial_routing_sync"))) TS_InitFeatures_initial_routing_sync(uint64_t this_arg) {
51073         LDKInitFeatures this_arg_conv;
51074         this_arg_conv.inner = untag_ptr(this_arg);
51075         this_arg_conv.is_owned = ptr_is_owned(this_arg);
51076         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
51077         this_arg_conv.is_owned = false;
51078         jboolean ret_conv = InitFeatures_initial_routing_sync(&this_arg_conv);
51079         return ret_conv;
51080 }
51081
51082 void  __attribute__((export_name("TS_InitFeatures_set_upfront_shutdown_script_optional"))) TS_InitFeatures_set_upfront_shutdown_script_optional(uint64_t this_arg) {
51083         LDKInitFeatures this_arg_conv;
51084         this_arg_conv.inner = untag_ptr(this_arg);
51085         this_arg_conv.is_owned = ptr_is_owned(this_arg);
51086         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
51087         this_arg_conv.is_owned = false;
51088         InitFeatures_set_upfront_shutdown_script_optional(&this_arg_conv);
51089 }
51090
51091 void  __attribute__((export_name("TS_InitFeatures_set_upfront_shutdown_script_required"))) TS_InitFeatures_set_upfront_shutdown_script_required(uint64_t this_arg) {
51092         LDKInitFeatures this_arg_conv;
51093         this_arg_conv.inner = untag_ptr(this_arg);
51094         this_arg_conv.is_owned = ptr_is_owned(this_arg);
51095         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
51096         this_arg_conv.is_owned = false;
51097         InitFeatures_set_upfront_shutdown_script_required(&this_arg_conv);
51098 }
51099
51100 jboolean  __attribute__((export_name("TS_InitFeatures_supports_upfront_shutdown_script"))) TS_InitFeatures_supports_upfront_shutdown_script(uint64_t this_arg) {
51101         LDKInitFeatures this_arg_conv;
51102         this_arg_conv.inner = untag_ptr(this_arg);
51103         this_arg_conv.is_owned = ptr_is_owned(this_arg);
51104         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
51105         this_arg_conv.is_owned = false;
51106         jboolean ret_conv = InitFeatures_supports_upfront_shutdown_script(&this_arg_conv);
51107         return ret_conv;
51108 }
51109
51110 void  __attribute__((export_name("TS_NodeFeatures_set_upfront_shutdown_script_optional"))) TS_NodeFeatures_set_upfront_shutdown_script_optional(uint64_t this_arg) {
51111         LDKNodeFeatures this_arg_conv;
51112         this_arg_conv.inner = untag_ptr(this_arg);
51113         this_arg_conv.is_owned = ptr_is_owned(this_arg);
51114         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
51115         this_arg_conv.is_owned = false;
51116         NodeFeatures_set_upfront_shutdown_script_optional(&this_arg_conv);
51117 }
51118
51119 void  __attribute__((export_name("TS_NodeFeatures_set_upfront_shutdown_script_required"))) TS_NodeFeatures_set_upfront_shutdown_script_required(uint64_t this_arg) {
51120         LDKNodeFeatures this_arg_conv;
51121         this_arg_conv.inner = untag_ptr(this_arg);
51122         this_arg_conv.is_owned = ptr_is_owned(this_arg);
51123         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
51124         this_arg_conv.is_owned = false;
51125         NodeFeatures_set_upfront_shutdown_script_required(&this_arg_conv);
51126 }
51127
51128 jboolean  __attribute__((export_name("TS_NodeFeatures_supports_upfront_shutdown_script"))) TS_NodeFeatures_supports_upfront_shutdown_script(uint64_t this_arg) {
51129         LDKNodeFeatures this_arg_conv;
51130         this_arg_conv.inner = untag_ptr(this_arg);
51131         this_arg_conv.is_owned = ptr_is_owned(this_arg);
51132         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
51133         this_arg_conv.is_owned = false;
51134         jboolean ret_conv = NodeFeatures_supports_upfront_shutdown_script(&this_arg_conv);
51135         return ret_conv;
51136 }
51137
51138 jboolean  __attribute__((export_name("TS_InitFeatures_requires_upfront_shutdown_script"))) TS_InitFeatures_requires_upfront_shutdown_script(uint64_t this_arg) {
51139         LDKInitFeatures this_arg_conv;
51140         this_arg_conv.inner = untag_ptr(this_arg);
51141         this_arg_conv.is_owned = ptr_is_owned(this_arg);
51142         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
51143         this_arg_conv.is_owned = false;
51144         jboolean ret_conv = InitFeatures_requires_upfront_shutdown_script(&this_arg_conv);
51145         return ret_conv;
51146 }
51147
51148 jboolean  __attribute__((export_name("TS_NodeFeatures_requires_upfront_shutdown_script"))) TS_NodeFeatures_requires_upfront_shutdown_script(uint64_t this_arg) {
51149         LDKNodeFeatures this_arg_conv;
51150         this_arg_conv.inner = untag_ptr(this_arg);
51151         this_arg_conv.is_owned = ptr_is_owned(this_arg);
51152         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
51153         this_arg_conv.is_owned = false;
51154         jboolean ret_conv = NodeFeatures_requires_upfront_shutdown_script(&this_arg_conv);
51155         return ret_conv;
51156 }
51157
51158 void  __attribute__((export_name("TS_InitFeatures_set_gossip_queries_optional"))) TS_InitFeatures_set_gossip_queries_optional(uint64_t this_arg) {
51159         LDKInitFeatures this_arg_conv;
51160         this_arg_conv.inner = untag_ptr(this_arg);
51161         this_arg_conv.is_owned = ptr_is_owned(this_arg);
51162         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
51163         this_arg_conv.is_owned = false;
51164         InitFeatures_set_gossip_queries_optional(&this_arg_conv);
51165 }
51166
51167 void  __attribute__((export_name("TS_InitFeatures_set_gossip_queries_required"))) TS_InitFeatures_set_gossip_queries_required(uint64_t this_arg) {
51168         LDKInitFeatures this_arg_conv;
51169         this_arg_conv.inner = untag_ptr(this_arg);
51170         this_arg_conv.is_owned = ptr_is_owned(this_arg);
51171         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
51172         this_arg_conv.is_owned = false;
51173         InitFeatures_set_gossip_queries_required(&this_arg_conv);
51174 }
51175
51176 jboolean  __attribute__((export_name("TS_InitFeatures_supports_gossip_queries"))) TS_InitFeatures_supports_gossip_queries(uint64_t this_arg) {
51177         LDKInitFeatures this_arg_conv;
51178         this_arg_conv.inner = untag_ptr(this_arg);
51179         this_arg_conv.is_owned = ptr_is_owned(this_arg);
51180         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
51181         this_arg_conv.is_owned = false;
51182         jboolean ret_conv = InitFeatures_supports_gossip_queries(&this_arg_conv);
51183         return ret_conv;
51184 }
51185
51186 void  __attribute__((export_name("TS_NodeFeatures_set_gossip_queries_optional"))) TS_NodeFeatures_set_gossip_queries_optional(uint64_t this_arg) {
51187         LDKNodeFeatures this_arg_conv;
51188         this_arg_conv.inner = untag_ptr(this_arg);
51189         this_arg_conv.is_owned = ptr_is_owned(this_arg);
51190         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
51191         this_arg_conv.is_owned = false;
51192         NodeFeatures_set_gossip_queries_optional(&this_arg_conv);
51193 }
51194
51195 void  __attribute__((export_name("TS_NodeFeatures_set_gossip_queries_required"))) TS_NodeFeatures_set_gossip_queries_required(uint64_t this_arg) {
51196         LDKNodeFeatures this_arg_conv;
51197         this_arg_conv.inner = untag_ptr(this_arg);
51198         this_arg_conv.is_owned = ptr_is_owned(this_arg);
51199         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
51200         this_arg_conv.is_owned = false;
51201         NodeFeatures_set_gossip_queries_required(&this_arg_conv);
51202 }
51203
51204 jboolean  __attribute__((export_name("TS_NodeFeatures_supports_gossip_queries"))) TS_NodeFeatures_supports_gossip_queries(uint64_t this_arg) {
51205         LDKNodeFeatures this_arg_conv;
51206         this_arg_conv.inner = untag_ptr(this_arg);
51207         this_arg_conv.is_owned = ptr_is_owned(this_arg);
51208         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
51209         this_arg_conv.is_owned = false;
51210         jboolean ret_conv = NodeFeatures_supports_gossip_queries(&this_arg_conv);
51211         return ret_conv;
51212 }
51213
51214 jboolean  __attribute__((export_name("TS_InitFeatures_requires_gossip_queries"))) TS_InitFeatures_requires_gossip_queries(uint64_t this_arg) {
51215         LDKInitFeatures this_arg_conv;
51216         this_arg_conv.inner = untag_ptr(this_arg);
51217         this_arg_conv.is_owned = ptr_is_owned(this_arg);
51218         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
51219         this_arg_conv.is_owned = false;
51220         jboolean ret_conv = InitFeatures_requires_gossip_queries(&this_arg_conv);
51221         return ret_conv;
51222 }
51223
51224 jboolean  __attribute__((export_name("TS_NodeFeatures_requires_gossip_queries"))) TS_NodeFeatures_requires_gossip_queries(uint64_t this_arg) {
51225         LDKNodeFeatures this_arg_conv;
51226         this_arg_conv.inner = untag_ptr(this_arg);
51227         this_arg_conv.is_owned = ptr_is_owned(this_arg);
51228         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
51229         this_arg_conv.is_owned = false;
51230         jboolean ret_conv = NodeFeatures_requires_gossip_queries(&this_arg_conv);
51231         return ret_conv;
51232 }
51233
51234 void  __attribute__((export_name("TS_InitFeatures_set_variable_length_onion_optional"))) TS_InitFeatures_set_variable_length_onion_optional(uint64_t this_arg) {
51235         LDKInitFeatures this_arg_conv;
51236         this_arg_conv.inner = untag_ptr(this_arg);
51237         this_arg_conv.is_owned = ptr_is_owned(this_arg);
51238         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
51239         this_arg_conv.is_owned = false;
51240         InitFeatures_set_variable_length_onion_optional(&this_arg_conv);
51241 }
51242
51243 void  __attribute__((export_name("TS_InitFeatures_set_variable_length_onion_required"))) TS_InitFeatures_set_variable_length_onion_required(uint64_t this_arg) {
51244         LDKInitFeatures this_arg_conv;
51245         this_arg_conv.inner = untag_ptr(this_arg);
51246         this_arg_conv.is_owned = ptr_is_owned(this_arg);
51247         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
51248         this_arg_conv.is_owned = false;
51249         InitFeatures_set_variable_length_onion_required(&this_arg_conv);
51250 }
51251
51252 jboolean  __attribute__((export_name("TS_InitFeatures_supports_variable_length_onion"))) TS_InitFeatures_supports_variable_length_onion(uint64_t this_arg) {
51253         LDKInitFeatures this_arg_conv;
51254         this_arg_conv.inner = untag_ptr(this_arg);
51255         this_arg_conv.is_owned = ptr_is_owned(this_arg);
51256         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
51257         this_arg_conv.is_owned = false;
51258         jboolean ret_conv = InitFeatures_supports_variable_length_onion(&this_arg_conv);
51259         return ret_conv;
51260 }
51261
51262 void  __attribute__((export_name("TS_NodeFeatures_set_variable_length_onion_optional"))) TS_NodeFeatures_set_variable_length_onion_optional(uint64_t this_arg) {
51263         LDKNodeFeatures this_arg_conv;
51264         this_arg_conv.inner = untag_ptr(this_arg);
51265         this_arg_conv.is_owned = ptr_is_owned(this_arg);
51266         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
51267         this_arg_conv.is_owned = false;
51268         NodeFeatures_set_variable_length_onion_optional(&this_arg_conv);
51269 }
51270
51271 void  __attribute__((export_name("TS_NodeFeatures_set_variable_length_onion_required"))) TS_NodeFeatures_set_variable_length_onion_required(uint64_t this_arg) {
51272         LDKNodeFeatures this_arg_conv;
51273         this_arg_conv.inner = untag_ptr(this_arg);
51274         this_arg_conv.is_owned = ptr_is_owned(this_arg);
51275         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
51276         this_arg_conv.is_owned = false;
51277         NodeFeatures_set_variable_length_onion_required(&this_arg_conv);
51278 }
51279
51280 jboolean  __attribute__((export_name("TS_NodeFeatures_supports_variable_length_onion"))) TS_NodeFeatures_supports_variable_length_onion(uint64_t this_arg) {
51281         LDKNodeFeatures this_arg_conv;
51282         this_arg_conv.inner = untag_ptr(this_arg);
51283         this_arg_conv.is_owned = ptr_is_owned(this_arg);
51284         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
51285         this_arg_conv.is_owned = false;
51286         jboolean ret_conv = NodeFeatures_supports_variable_length_onion(&this_arg_conv);
51287         return ret_conv;
51288 }
51289
51290 void  __attribute__((export_name("TS_Bolt11InvoiceFeatures_set_variable_length_onion_optional"))) TS_Bolt11InvoiceFeatures_set_variable_length_onion_optional(uint64_t this_arg) {
51291         LDKBolt11InvoiceFeatures this_arg_conv;
51292         this_arg_conv.inner = untag_ptr(this_arg);
51293         this_arg_conv.is_owned = ptr_is_owned(this_arg);
51294         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
51295         this_arg_conv.is_owned = false;
51296         Bolt11InvoiceFeatures_set_variable_length_onion_optional(&this_arg_conv);
51297 }
51298
51299 void  __attribute__((export_name("TS_Bolt11InvoiceFeatures_set_variable_length_onion_required"))) TS_Bolt11InvoiceFeatures_set_variable_length_onion_required(uint64_t this_arg) {
51300         LDKBolt11InvoiceFeatures this_arg_conv;
51301         this_arg_conv.inner = untag_ptr(this_arg);
51302         this_arg_conv.is_owned = ptr_is_owned(this_arg);
51303         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
51304         this_arg_conv.is_owned = false;
51305         Bolt11InvoiceFeatures_set_variable_length_onion_required(&this_arg_conv);
51306 }
51307
51308 jboolean  __attribute__((export_name("TS_Bolt11InvoiceFeatures_supports_variable_length_onion"))) TS_Bolt11InvoiceFeatures_supports_variable_length_onion(uint64_t this_arg) {
51309         LDKBolt11InvoiceFeatures this_arg_conv;
51310         this_arg_conv.inner = untag_ptr(this_arg);
51311         this_arg_conv.is_owned = ptr_is_owned(this_arg);
51312         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
51313         this_arg_conv.is_owned = false;
51314         jboolean ret_conv = Bolt11InvoiceFeatures_supports_variable_length_onion(&this_arg_conv);
51315         return ret_conv;
51316 }
51317
51318 jboolean  __attribute__((export_name("TS_InitFeatures_requires_variable_length_onion"))) TS_InitFeatures_requires_variable_length_onion(uint64_t this_arg) {
51319         LDKInitFeatures this_arg_conv;
51320         this_arg_conv.inner = untag_ptr(this_arg);
51321         this_arg_conv.is_owned = ptr_is_owned(this_arg);
51322         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
51323         this_arg_conv.is_owned = false;
51324         jboolean ret_conv = InitFeatures_requires_variable_length_onion(&this_arg_conv);
51325         return ret_conv;
51326 }
51327
51328 jboolean  __attribute__((export_name("TS_NodeFeatures_requires_variable_length_onion"))) TS_NodeFeatures_requires_variable_length_onion(uint64_t this_arg) {
51329         LDKNodeFeatures this_arg_conv;
51330         this_arg_conv.inner = untag_ptr(this_arg);
51331         this_arg_conv.is_owned = ptr_is_owned(this_arg);
51332         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
51333         this_arg_conv.is_owned = false;
51334         jboolean ret_conv = NodeFeatures_requires_variable_length_onion(&this_arg_conv);
51335         return ret_conv;
51336 }
51337
51338 jboolean  __attribute__((export_name("TS_Bolt11InvoiceFeatures_requires_variable_length_onion"))) TS_Bolt11InvoiceFeatures_requires_variable_length_onion(uint64_t this_arg) {
51339         LDKBolt11InvoiceFeatures this_arg_conv;
51340         this_arg_conv.inner = untag_ptr(this_arg);
51341         this_arg_conv.is_owned = ptr_is_owned(this_arg);
51342         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
51343         this_arg_conv.is_owned = false;
51344         jboolean ret_conv = Bolt11InvoiceFeatures_requires_variable_length_onion(&this_arg_conv);
51345         return ret_conv;
51346 }
51347
51348 void  __attribute__((export_name("TS_InitFeatures_set_static_remote_key_optional"))) TS_InitFeatures_set_static_remote_key_optional(uint64_t this_arg) {
51349         LDKInitFeatures this_arg_conv;
51350         this_arg_conv.inner = untag_ptr(this_arg);
51351         this_arg_conv.is_owned = ptr_is_owned(this_arg);
51352         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
51353         this_arg_conv.is_owned = false;
51354         InitFeatures_set_static_remote_key_optional(&this_arg_conv);
51355 }
51356
51357 void  __attribute__((export_name("TS_InitFeatures_set_static_remote_key_required"))) TS_InitFeatures_set_static_remote_key_required(uint64_t this_arg) {
51358         LDKInitFeatures this_arg_conv;
51359         this_arg_conv.inner = untag_ptr(this_arg);
51360         this_arg_conv.is_owned = ptr_is_owned(this_arg);
51361         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
51362         this_arg_conv.is_owned = false;
51363         InitFeatures_set_static_remote_key_required(&this_arg_conv);
51364 }
51365
51366 jboolean  __attribute__((export_name("TS_InitFeatures_supports_static_remote_key"))) TS_InitFeatures_supports_static_remote_key(uint64_t this_arg) {
51367         LDKInitFeatures this_arg_conv;
51368         this_arg_conv.inner = untag_ptr(this_arg);
51369         this_arg_conv.is_owned = ptr_is_owned(this_arg);
51370         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
51371         this_arg_conv.is_owned = false;
51372         jboolean ret_conv = InitFeatures_supports_static_remote_key(&this_arg_conv);
51373         return ret_conv;
51374 }
51375
51376 void  __attribute__((export_name("TS_NodeFeatures_set_static_remote_key_optional"))) TS_NodeFeatures_set_static_remote_key_optional(uint64_t this_arg) {
51377         LDKNodeFeatures this_arg_conv;
51378         this_arg_conv.inner = untag_ptr(this_arg);
51379         this_arg_conv.is_owned = ptr_is_owned(this_arg);
51380         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
51381         this_arg_conv.is_owned = false;
51382         NodeFeatures_set_static_remote_key_optional(&this_arg_conv);
51383 }
51384
51385 void  __attribute__((export_name("TS_NodeFeatures_set_static_remote_key_required"))) TS_NodeFeatures_set_static_remote_key_required(uint64_t this_arg) {
51386         LDKNodeFeatures this_arg_conv;
51387         this_arg_conv.inner = untag_ptr(this_arg);
51388         this_arg_conv.is_owned = ptr_is_owned(this_arg);
51389         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
51390         this_arg_conv.is_owned = false;
51391         NodeFeatures_set_static_remote_key_required(&this_arg_conv);
51392 }
51393
51394 jboolean  __attribute__((export_name("TS_NodeFeatures_supports_static_remote_key"))) TS_NodeFeatures_supports_static_remote_key(uint64_t this_arg) {
51395         LDKNodeFeatures this_arg_conv;
51396         this_arg_conv.inner = untag_ptr(this_arg);
51397         this_arg_conv.is_owned = ptr_is_owned(this_arg);
51398         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
51399         this_arg_conv.is_owned = false;
51400         jboolean ret_conv = NodeFeatures_supports_static_remote_key(&this_arg_conv);
51401         return ret_conv;
51402 }
51403
51404 void  __attribute__((export_name("TS_ChannelTypeFeatures_set_static_remote_key_optional"))) TS_ChannelTypeFeatures_set_static_remote_key_optional(uint64_t this_arg) {
51405         LDKChannelTypeFeatures this_arg_conv;
51406         this_arg_conv.inner = untag_ptr(this_arg);
51407         this_arg_conv.is_owned = ptr_is_owned(this_arg);
51408         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
51409         this_arg_conv.is_owned = false;
51410         ChannelTypeFeatures_set_static_remote_key_optional(&this_arg_conv);
51411 }
51412
51413 void  __attribute__((export_name("TS_ChannelTypeFeatures_set_static_remote_key_required"))) TS_ChannelTypeFeatures_set_static_remote_key_required(uint64_t this_arg) {
51414         LDKChannelTypeFeatures this_arg_conv;
51415         this_arg_conv.inner = untag_ptr(this_arg);
51416         this_arg_conv.is_owned = ptr_is_owned(this_arg);
51417         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
51418         this_arg_conv.is_owned = false;
51419         ChannelTypeFeatures_set_static_remote_key_required(&this_arg_conv);
51420 }
51421
51422 jboolean  __attribute__((export_name("TS_ChannelTypeFeatures_supports_static_remote_key"))) TS_ChannelTypeFeatures_supports_static_remote_key(uint64_t this_arg) {
51423         LDKChannelTypeFeatures this_arg_conv;
51424         this_arg_conv.inner = untag_ptr(this_arg);
51425         this_arg_conv.is_owned = ptr_is_owned(this_arg);
51426         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
51427         this_arg_conv.is_owned = false;
51428         jboolean ret_conv = ChannelTypeFeatures_supports_static_remote_key(&this_arg_conv);
51429         return ret_conv;
51430 }
51431
51432 jboolean  __attribute__((export_name("TS_InitFeatures_requires_static_remote_key"))) TS_InitFeatures_requires_static_remote_key(uint64_t this_arg) {
51433         LDKInitFeatures this_arg_conv;
51434         this_arg_conv.inner = untag_ptr(this_arg);
51435         this_arg_conv.is_owned = ptr_is_owned(this_arg);
51436         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
51437         this_arg_conv.is_owned = false;
51438         jboolean ret_conv = InitFeatures_requires_static_remote_key(&this_arg_conv);
51439         return ret_conv;
51440 }
51441
51442 jboolean  __attribute__((export_name("TS_NodeFeatures_requires_static_remote_key"))) TS_NodeFeatures_requires_static_remote_key(uint64_t this_arg) {
51443         LDKNodeFeatures this_arg_conv;
51444         this_arg_conv.inner = untag_ptr(this_arg);
51445         this_arg_conv.is_owned = ptr_is_owned(this_arg);
51446         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
51447         this_arg_conv.is_owned = false;
51448         jboolean ret_conv = NodeFeatures_requires_static_remote_key(&this_arg_conv);
51449         return ret_conv;
51450 }
51451
51452 jboolean  __attribute__((export_name("TS_ChannelTypeFeatures_requires_static_remote_key"))) TS_ChannelTypeFeatures_requires_static_remote_key(uint64_t this_arg) {
51453         LDKChannelTypeFeatures this_arg_conv;
51454         this_arg_conv.inner = untag_ptr(this_arg);
51455         this_arg_conv.is_owned = ptr_is_owned(this_arg);
51456         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
51457         this_arg_conv.is_owned = false;
51458         jboolean ret_conv = ChannelTypeFeatures_requires_static_remote_key(&this_arg_conv);
51459         return ret_conv;
51460 }
51461
51462 void  __attribute__((export_name("TS_InitFeatures_set_payment_secret_optional"))) TS_InitFeatures_set_payment_secret_optional(uint64_t this_arg) {
51463         LDKInitFeatures this_arg_conv;
51464         this_arg_conv.inner = untag_ptr(this_arg);
51465         this_arg_conv.is_owned = ptr_is_owned(this_arg);
51466         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
51467         this_arg_conv.is_owned = false;
51468         InitFeatures_set_payment_secret_optional(&this_arg_conv);
51469 }
51470
51471 void  __attribute__((export_name("TS_InitFeatures_set_payment_secret_required"))) TS_InitFeatures_set_payment_secret_required(uint64_t this_arg) {
51472         LDKInitFeatures this_arg_conv;
51473         this_arg_conv.inner = untag_ptr(this_arg);
51474         this_arg_conv.is_owned = ptr_is_owned(this_arg);
51475         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
51476         this_arg_conv.is_owned = false;
51477         InitFeatures_set_payment_secret_required(&this_arg_conv);
51478 }
51479
51480 jboolean  __attribute__((export_name("TS_InitFeatures_supports_payment_secret"))) TS_InitFeatures_supports_payment_secret(uint64_t this_arg) {
51481         LDKInitFeatures this_arg_conv;
51482         this_arg_conv.inner = untag_ptr(this_arg);
51483         this_arg_conv.is_owned = ptr_is_owned(this_arg);
51484         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
51485         this_arg_conv.is_owned = false;
51486         jboolean ret_conv = InitFeatures_supports_payment_secret(&this_arg_conv);
51487         return ret_conv;
51488 }
51489
51490 void  __attribute__((export_name("TS_NodeFeatures_set_payment_secret_optional"))) TS_NodeFeatures_set_payment_secret_optional(uint64_t this_arg) {
51491         LDKNodeFeatures this_arg_conv;
51492         this_arg_conv.inner = untag_ptr(this_arg);
51493         this_arg_conv.is_owned = ptr_is_owned(this_arg);
51494         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
51495         this_arg_conv.is_owned = false;
51496         NodeFeatures_set_payment_secret_optional(&this_arg_conv);
51497 }
51498
51499 void  __attribute__((export_name("TS_NodeFeatures_set_payment_secret_required"))) TS_NodeFeatures_set_payment_secret_required(uint64_t this_arg) {
51500         LDKNodeFeatures this_arg_conv;
51501         this_arg_conv.inner = untag_ptr(this_arg);
51502         this_arg_conv.is_owned = ptr_is_owned(this_arg);
51503         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
51504         this_arg_conv.is_owned = false;
51505         NodeFeatures_set_payment_secret_required(&this_arg_conv);
51506 }
51507
51508 jboolean  __attribute__((export_name("TS_NodeFeatures_supports_payment_secret"))) TS_NodeFeatures_supports_payment_secret(uint64_t this_arg) {
51509         LDKNodeFeatures this_arg_conv;
51510         this_arg_conv.inner = untag_ptr(this_arg);
51511         this_arg_conv.is_owned = ptr_is_owned(this_arg);
51512         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
51513         this_arg_conv.is_owned = false;
51514         jboolean ret_conv = NodeFeatures_supports_payment_secret(&this_arg_conv);
51515         return ret_conv;
51516 }
51517
51518 void  __attribute__((export_name("TS_Bolt11InvoiceFeatures_set_payment_secret_optional"))) TS_Bolt11InvoiceFeatures_set_payment_secret_optional(uint64_t this_arg) {
51519         LDKBolt11InvoiceFeatures this_arg_conv;
51520         this_arg_conv.inner = untag_ptr(this_arg);
51521         this_arg_conv.is_owned = ptr_is_owned(this_arg);
51522         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
51523         this_arg_conv.is_owned = false;
51524         Bolt11InvoiceFeatures_set_payment_secret_optional(&this_arg_conv);
51525 }
51526
51527 void  __attribute__((export_name("TS_Bolt11InvoiceFeatures_set_payment_secret_required"))) TS_Bolt11InvoiceFeatures_set_payment_secret_required(uint64_t this_arg) {
51528         LDKBolt11InvoiceFeatures this_arg_conv;
51529         this_arg_conv.inner = untag_ptr(this_arg);
51530         this_arg_conv.is_owned = ptr_is_owned(this_arg);
51531         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
51532         this_arg_conv.is_owned = false;
51533         Bolt11InvoiceFeatures_set_payment_secret_required(&this_arg_conv);
51534 }
51535
51536 jboolean  __attribute__((export_name("TS_Bolt11InvoiceFeatures_supports_payment_secret"))) TS_Bolt11InvoiceFeatures_supports_payment_secret(uint64_t this_arg) {
51537         LDKBolt11InvoiceFeatures this_arg_conv;
51538         this_arg_conv.inner = untag_ptr(this_arg);
51539         this_arg_conv.is_owned = ptr_is_owned(this_arg);
51540         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
51541         this_arg_conv.is_owned = false;
51542         jboolean ret_conv = Bolt11InvoiceFeatures_supports_payment_secret(&this_arg_conv);
51543         return ret_conv;
51544 }
51545
51546 jboolean  __attribute__((export_name("TS_InitFeatures_requires_payment_secret"))) TS_InitFeatures_requires_payment_secret(uint64_t this_arg) {
51547         LDKInitFeatures this_arg_conv;
51548         this_arg_conv.inner = untag_ptr(this_arg);
51549         this_arg_conv.is_owned = ptr_is_owned(this_arg);
51550         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
51551         this_arg_conv.is_owned = false;
51552         jboolean ret_conv = InitFeatures_requires_payment_secret(&this_arg_conv);
51553         return ret_conv;
51554 }
51555
51556 jboolean  __attribute__((export_name("TS_NodeFeatures_requires_payment_secret"))) TS_NodeFeatures_requires_payment_secret(uint64_t this_arg) {
51557         LDKNodeFeatures this_arg_conv;
51558         this_arg_conv.inner = untag_ptr(this_arg);
51559         this_arg_conv.is_owned = ptr_is_owned(this_arg);
51560         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
51561         this_arg_conv.is_owned = false;
51562         jboolean ret_conv = NodeFeatures_requires_payment_secret(&this_arg_conv);
51563         return ret_conv;
51564 }
51565
51566 jboolean  __attribute__((export_name("TS_Bolt11InvoiceFeatures_requires_payment_secret"))) TS_Bolt11InvoiceFeatures_requires_payment_secret(uint64_t this_arg) {
51567         LDKBolt11InvoiceFeatures this_arg_conv;
51568         this_arg_conv.inner = untag_ptr(this_arg);
51569         this_arg_conv.is_owned = ptr_is_owned(this_arg);
51570         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
51571         this_arg_conv.is_owned = false;
51572         jboolean ret_conv = Bolt11InvoiceFeatures_requires_payment_secret(&this_arg_conv);
51573         return ret_conv;
51574 }
51575
51576 void  __attribute__((export_name("TS_InitFeatures_set_basic_mpp_optional"))) TS_InitFeatures_set_basic_mpp_optional(uint64_t this_arg) {
51577         LDKInitFeatures this_arg_conv;
51578         this_arg_conv.inner = untag_ptr(this_arg);
51579         this_arg_conv.is_owned = ptr_is_owned(this_arg);
51580         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
51581         this_arg_conv.is_owned = false;
51582         InitFeatures_set_basic_mpp_optional(&this_arg_conv);
51583 }
51584
51585 void  __attribute__((export_name("TS_InitFeatures_set_basic_mpp_required"))) TS_InitFeatures_set_basic_mpp_required(uint64_t this_arg) {
51586         LDKInitFeatures this_arg_conv;
51587         this_arg_conv.inner = untag_ptr(this_arg);
51588         this_arg_conv.is_owned = ptr_is_owned(this_arg);
51589         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
51590         this_arg_conv.is_owned = false;
51591         InitFeatures_set_basic_mpp_required(&this_arg_conv);
51592 }
51593
51594 jboolean  __attribute__((export_name("TS_InitFeatures_supports_basic_mpp"))) TS_InitFeatures_supports_basic_mpp(uint64_t this_arg) {
51595         LDKInitFeatures this_arg_conv;
51596         this_arg_conv.inner = untag_ptr(this_arg);
51597         this_arg_conv.is_owned = ptr_is_owned(this_arg);
51598         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
51599         this_arg_conv.is_owned = false;
51600         jboolean ret_conv = InitFeatures_supports_basic_mpp(&this_arg_conv);
51601         return ret_conv;
51602 }
51603
51604 void  __attribute__((export_name("TS_NodeFeatures_set_basic_mpp_optional"))) TS_NodeFeatures_set_basic_mpp_optional(uint64_t this_arg) {
51605         LDKNodeFeatures this_arg_conv;
51606         this_arg_conv.inner = untag_ptr(this_arg);
51607         this_arg_conv.is_owned = ptr_is_owned(this_arg);
51608         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
51609         this_arg_conv.is_owned = false;
51610         NodeFeatures_set_basic_mpp_optional(&this_arg_conv);
51611 }
51612
51613 void  __attribute__((export_name("TS_NodeFeatures_set_basic_mpp_required"))) TS_NodeFeatures_set_basic_mpp_required(uint64_t this_arg) {
51614         LDKNodeFeatures this_arg_conv;
51615         this_arg_conv.inner = untag_ptr(this_arg);
51616         this_arg_conv.is_owned = ptr_is_owned(this_arg);
51617         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
51618         this_arg_conv.is_owned = false;
51619         NodeFeatures_set_basic_mpp_required(&this_arg_conv);
51620 }
51621
51622 jboolean  __attribute__((export_name("TS_NodeFeatures_supports_basic_mpp"))) TS_NodeFeatures_supports_basic_mpp(uint64_t this_arg) {
51623         LDKNodeFeatures this_arg_conv;
51624         this_arg_conv.inner = untag_ptr(this_arg);
51625         this_arg_conv.is_owned = ptr_is_owned(this_arg);
51626         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
51627         this_arg_conv.is_owned = false;
51628         jboolean ret_conv = NodeFeatures_supports_basic_mpp(&this_arg_conv);
51629         return ret_conv;
51630 }
51631
51632 void  __attribute__((export_name("TS_Bolt11InvoiceFeatures_set_basic_mpp_optional"))) TS_Bolt11InvoiceFeatures_set_basic_mpp_optional(uint64_t this_arg) {
51633         LDKBolt11InvoiceFeatures this_arg_conv;
51634         this_arg_conv.inner = untag_ptr(this_arg);
51635         this_arg_conv.is_owned = ptr_is_owned(this_arg);
51636         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
51637         this_arg_conv.is_owned = false;
51638         Bolt11InvoiceFeatures_set_basic_mpp_optional(&this_arg_conv);
51639 }
51640
51641 void  __attribute__((export_name("TS_Bolt11InvoiceFeatures_set_basic_mpp_required"))) TS_Bolt11InvoiceFeatures_set_basic_mpp_required(uint64_t this_arg) {
51642         LDKBolt11InvoiceFeatures this_arg_conv;
51643         this_arg_conv.inner = untag_ptr(this_arg);
51644         this_arg_conv.is_owned = ptr_is_owned(this_arg);
51645         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
51646         this_arg_conv.is_owned = false;
51647         Bolt11InvoiceFeatures_set_basic_mpp_required(&this_arg_conv);
51648 }
51649
51650 jboolean  __attribute__((export_name("TS_Bolt11InvoiceFeatures_supports_basic_mpp"))) TS_Bolt11InvoiceFeatures_supports_basic_mpp(uint64_t this_arg) {
51651         LDKBolt11InvoiceFeatures this_arg_conv;
51652         this_arg_conv.inner = untag_ptr(this_arg);
51653         this_arg_conv.is_owned = ptr_is_owned(this_arg);
51654         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
51655         this_arg_conv.is_owned = false;
51656         jboolean ret_conv = Bolt11InvoiceFeatures_supports_basic_mpp(&this_arg_conv);
51657         return ret_conv;
51658 }
51659
51660 void  __attribute__((export_name("TS_Bolt12InvoiceFeatures_set_basic_mpp_optional"))) TS_Bolt12InvoiceFeatures_set_basic_mpp_optional(uint64_t this_arg) {
51661         LDKBolt12InvoiceFeatures this_arg_conv;
51662         this_arg_conv.inner = untag_ptr(this_arg);
51663         this_arg_conv.is_owned = ptr_is_owned(this_arg);
51664         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
51665         this_arg_conv.is_owned = false;
51666         Bolt12InvoiceFeatures_set_basic_mpp_optional(&this_arg_conv);
51667 }
51668
51669 void  __attribute__((export_name("TS_Bolt12InvoiceFeatures_set_basic_mpp_required"))) TS_Bolt12InvoiceFeatures_set_basic_mpp_required(uint64_t this_arg) {
51670         LDKBolt12InvoiceFeatures this_arg_conv;
51671         this_arg_conv.inner = untag_ptr(this_arg);
51672         this_arg_conv.is_owned = ptr_is_owned(this_arg);
51673         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
51674         this_arg_conv.is_owned = false;
51675         Bolt12InvoiceFeatures_set_basic_mpp_required(&this_arg_conv);
51676 }
51677
51678 jboolean  __attribute__((export_name("TS_Bolt12InvoiceFeatures_supports_basic_mpp"))) TS_Bolt12InvoiceFeatures_supports_basic_mpp(uint64_t this_arg) {
51679         LDKBolt12InvoiceFeatures this_arg_conv;
51680         this_arg_conv.inner = untag_ptr(this_arg);
51681         this_arg_conv.is_owned = ptr_is_owned(this_arg);
51682         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
51683         this_arg_conv.is_owned = false;
51684         jboolean ret_conv = Bolt12InvoiceFeatures_supports_basic_mpp(&this_arg_conv);
51685         return ret_conv;
51686 }
51687
51688 jboolean  __attribute__((export_name("TS_InitFeatures_requires_basic_mpp"))) TS_InitFeatures_requires_basic_mpp(uint64_t this_arg) {
51689         LDKInitFeatures this_arg_conv;
51690         this_arg_conv.inner = untag_ptr(this_arg);
51691         this_arg_conv.is_owned = ptr_is_owned(this_arg);
51692         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
51693         this_arg_conv.is_owned = false;
51694         jboolean ret_conv = InitFeatures_requires_basic_mpp(&this_arg_conv);
51695         return ret_conv;
51696 }
51697
51698 jboolean  __attribute__((export_name("TS_NodeFeatures_requires_basic_mpp"))) TS_NodeFeatures_requires_basic_mpp(uint64_t this_arg) {
51699         LDKNodeFeatures this_arg_conv;
51700         this_arg_conv.inner = untag_ptr(this_arg);
51701         this_arg_conv.is_owned = ptr_is_owned(this_arg);
51702         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
51703         this_arg_conv.is_owned = false;
51704         jboolean ret_conv = NodeFeatures_requires_basic_mpp(&this_arg_conv);
51705         return ret_conv;
51706 }
51707
51708 jboolean  __attribute__((export_name("TS_Bolt11InvoiceFeatures_requires_basic_mpp"))) TS_Bolt11InvoiceFeatures_requires_basic_mpp(uint64_t this_arg) {
51709         LDKBolt11InvoiceFeatures this_arg_conv;
51710         this_arg_conv.inner = untag_ptr(this_arg);
51711         this_arg_conv.is_owned = ptr_is_owned(this_arg);
51712         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
51713         this_arg_conv.is_owned = false;
51714         jboolean ret_conv = Bolt11InvoiceFeatures_requires_basic_mpp(&this_arg_conv);
51715         return ret_conv;
51716 }
51717
51718 jboolean  __attribute__((export_name("TS_Bolt12InvoiceFeatures_requires_basic_mpp"))) TS_Bolt12InvoiceFeatures_requires_basic_mpp(uint64_t this_arg) {
51719         LDKBolt12InvoiceFeatures this_arg_conv;
51720         this_arg_conv.inner = untag_ptr(this_arg);
51721         this_arg_conv.is_owned = ptr_is_owned(this_arg);
51722         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
51723         this_arg_conv.is_owned = false;
51724         jboolean ret_conv = Bolt12InvoiceFeatures_requires_basic_mpp(&this_arg_conv);
51725         return ret_conv;
51726 }
51727
51728 void  __attribute__((export_name("TS_InitFeatures_set_wumbo_optional"))) TS_InitFeatures_set_wumbo_optional(uint64_t this_arg) {
51729         LDKInitFeatures this_arg_conv;
51730         this_arg_conv.inner = untag_ptr(this_arg);
51731         this_arg_conv.is_owned = ptr_is_owned(this_arg);
51732         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
51733         this_arg_conv.is_owned = false;
51734         InitFeatures_set_wumbo_optional(&this_arg_conv);
51735 }
51736
51737 void  __attribute__((export_name("TS_InitFeatures_set_wumbo_required"))) TS_InitFeatures_set_wumbo_required(uint64_t this_arg) {
51738         LDKInitFeatures this_arg_conv;
51739         this_arg_conv.inner = untag_ptr(this_arg);
51740         this_arg_conv.is_owned = ptr_is_owned(this_arg);
51741         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
51742         this_arg_conv.is_owned = false;
51743         InitFeatures_set_wumbo_required(&this_arg_conv);
51744 }
51745
51746 jboolean  __attribute__((export_name("TS_InitFeatures_supports_wumbo"))) TS_InitFeatures_supports_wumbo(uint64_t this_arg) {
51747         LDKInitFeatures this_arg_conv;
51748         this_arg_conv.inner = untag_ptr(this_arg);
51749         this_arg_conv.is_owned = ptr_is_owned(this_arg);
51750         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
51751         this_arg_conv.is_owned = false;
51752         jboolean ret_conv = InitFeatures_supports_wumbo(&this_arg_conv);
51753         return ret_conv;
51754 }
51755
51756 void  __attribute__((export_name("TS_NodeFeatures_set_wumbo_optional"))) TS_NodeFeatures_set_wumbo_optional(uint64_t this_arg) {
51757         LDKNodeFeatures this_arg_conv;
51758         this_arg_conv.inner = untag_ptr(this_arg);
51759         this_arg_conv.is_owned = ptr_is_owned(this_arg);
51760         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
51761         this_arg_conv.is_owned = false;
51762         NodeFeatures_set_wumbo_optional(&this_arg_conv);
51763 }
51764
51765 void  __attribute__((export_name("TS_NodeFeatures_set_wumbo_required"))) TS_NodeFeatures_set_wumbo_required(uint64_t this_arg) {
51766         LDKNodeFeatures this_arg_conv;
51767         this_arg_conv.inner = untag_ptr(this_arg);
51768         this_arg_conv.is_owned = ptr_is_owned(this_arg);
51769         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
51770         this_arg_conv.is_owned = false;
51771         NodeFeatures_set_wumbo_required(&this_arg_conv);
51772 }
51773
51774 jboolean  __attribute__((export_name("TS_NodeFeatures_supports_wumbo"))) TS_NodeFeatures_supports_wumbo(uint64_t this_arg) {
51775         LDKNodeFeatures this_arg_conv;
51776         this_arg_conv.inner = untag_ptr(this_arg);
51777         this_arg_conv.is_owned = ptr_is_owned(this_arg);
51778         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
51779         this_arg_conv.is_owned = false;
51780         jboolean ret_conv = NodeFeatures_supports_wumbo(&this_arg_conv);
51781         return ret_conv;
51782 }
51783
51784 jboolean  __attribute__((export_name("TS_InitFeatures_requires_wumbo"))) TS_InitFeatures_requires_wumbo(uint64_t this_arg) {
51785         LDKInitFeatures this_arg_conv;
51786         this_arg_conv.inner = untag_ptr(this_arg);
51787         this_arg_conv.is_owned = ptr_is_owned(this_arg);
51788         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
51789         this_arg_conv.is_owned = false;
51790         jboolean ret_conv = InitFeatures_requires_wumbo(&this_arg_conv);
51791         return ret_conv;
51792 }
51793
51794 jboolean  __attribute__((export_name("TS_NodeFeatures_requires_wumbo"))) TS_NodeFeatures_requires_wumbo(uint64_t this_arg) {
51795         LDKNodeFeatures this_arg_conv;
51796         this_arg_conv.inner = untag_ptr(this_arg);
51797         this_arg_conv.is_owned = ptr_is_owned(this_arg);
51798         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
51799         this_arg_conv.is_owned = false;
51800         jboolean ret_conv = NodeFeatures_requires_wumbo(&this_arg_conv);
51801         return ret_conv;
51802 }
51803
51804 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) {
51805         LDKInitFeatures this_arg_conv;
51806         this_arg_conv.inner = untag_ptr(this_arg);
51807         this_arg_conv.is_owned = ptr_is_owned(this_arg);
51808         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
51809         this_arg_conv.is_owned = false;
51810         InitFeatures_set_anchors_nonzero_fee_htlc_tx_optional(&this_arg_conv);
51811 }
51812
51813 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) {
51814         LDKInitFeatures this_arg_conv;
51815         this_arg_conv.inner = untag_ptr(this_arg);
51816         this_arg_conv.is_owned = ptr_is_owned(this_arg);
51817         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
51818         this_arg_conv.is_owned = false;
51819         InitFeatures_set_anchors_nonzero_fee_htlc_tx_required(&this_arg_conv);
51820 }
51821
51822 jboolean  __attribute__((export_name("TS_InitFeatures_supports_anchors_nonzero_fee_htlc_tx"))) TS_InitFeatures_supports_anchors_nonzero_fee_htlc_tx(uint64_t this_arg) {
51823         LDKInitFeatures this_arg_conv;
51824         this_arg_conv.inner = untag_ptr(this_arg);
51825         this_arg_conv.is_owned = ptr_is_owned(this_arg);
51826         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
51827         this_arg_conv.is_owned = false;
51828         jboolean ret_conv = InitFeatures_supports_anchors_nonzero_fee_htlc_tx(&this_arg_conv);
51829         return ret_conv;
51830 }
51831
51832 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) {
51833         LDKNodeFeatures this_arg_conv;
51834         this_arg_conv.inner = untag_ptr(this_arg);
51835         this_arg_conv.is_owned = ptr_is_owned(this_arg);
51836         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
51837         this_arg_conv.is_owned = false;
51838         NodeFeatures_set_anchors_nonzero_fee_htlc_tx_optional(&this_arg_conv);
51839 }
51840
51841 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) {
51842         LDKNodeFeatures this_arg_conv;
51843         this_arg_conv.inner = untag_ptr(this_arg);
51844         this_arg_conv.is_owned = ptr_is_owned(this_arg);
51845         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
51846         this_arg_conv.is_owned = false;
51847         NodeFeatures_set_anchors_nonzero_fee_htlc_tx_required(&this_arg_conv);
51848 }
51849
51850 jboolean  __attribute__((export_name("TS_NodeFeatures_supports_anchors_nonzero_fee_htlc_tx"))) TS_NodeFeatures_supports_anchors_nonzero_fee_htlc_tx(uint64_t this_arg) {
51851         LDKNodeFeatures this_arg_conv;
51852         this_arg_conv.inner = untag_ptr(this_arg);
51853         this_arg_conv.is_owned = ptr_is_owned(this_arg);
51854         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
51855         this_arg_conv.is_owned = false;
51856         jboolean ret_conv = NodeFeatures_supports_anchors_nonzero_fee_htlc_tx(&this_arg_conv);
51857         return ret_conv;
51858 }
51859
51860 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) {
51861         LDKChannelTypeFeatures this_arg_conv;
51862         this_arg_conv.inner = untag_ptr(this_arg);
51863         this_arg_conv.is_owned = ptr_is_owned(this_arg);
51864         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
51865         this_arg_conv.is_owned = false;
51866         ChannelTypeFeatures_set_anchors_nonzero_fee_htlc_tx_optional(&this_arg_conv);
51867 }
51868
51869 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) {
51870         LDKChannelTypeFeatures this_arg_conv;
51871         this_arg_conv.inner = untag_ptr(this_arg);
51872         this_arg_conv.is_owned = ptr_is_owned(this_arg);
51873         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
51874         this_arg_conv.is_owned = false;
51875         ChannelTypeFeatures_set_anchors_nonzero_fee_htlc_tx_required(&this_arg_conv);
51876 }
51877
51878 jboolean  __attribute__((export_name("TS_ChannelTypeFeatures_supports_anchors_nonzero_fee_htlc_tx"))) TS_ChannelTypeFeatures_supports_anchors_nonzero_fee_htlc_tx(uint64_t this_arg) {
51879         LDKChannelTypeFeatures this_arg_conv;
51880         this_arg_conv.inner = untag_ptr(this_arg);
51881         this_arg_conv.is_owned = ptr_is_owned(this_arg);
51882         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
51883         this_arg_conv.is_owned = false;
51884         jboolean ret_conv = ChannelTypeFeatures_supports_anchors_nonzero_fee_htlc_tx(&this_arg_conv);
51885         return ret_conv;
51886 }
51887
51888 jboolean  __attribute__((export_name("TS_InitFeatures_requires_anchors_nonzero_fee_htlc_tx"))) TS_InitFeatures_requires_anchors_nonzero_fee_htlc_tx(uint64_t this_arg) {
51889         LDKInitFeatures this_arg_conv;
51890         this_arg_conv.inner = untag_ptr(this_arg);
51891         this_arg_conv.is_owned = ptr_is_owned(this_arg);
51892         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
51893         this_arg_conv.is_owned = false;
51894         jboolean ret_conv = InitFeatures_requires_anchors_nonzero_fee_htlc_tx(&this_arg_conv);
51895         return ret_conv;
51896 }
51897
51898 jboolean  __attribute__((export_name("TS_NodeFeatures_requires_anchors_nonzero_fee_htlc_tx"))) TS_NodeFeatures_requires_anchors_nonzero_fee_htlc_tx(uint64_t this_arg) {
51899         LDKNodeFeatures this_arg_conv;
51900         this_arg_conv.inner = untag_ptr(this_arg);
51901         this_arg_conv.is_owned = ptr_is_owned(this_arg);
51902         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
51903         this_arg_conv.is_owned = false;
51904         jboolean ret_conv = NodeFeatures_requires_anchors_nonzero_fee_htlc_tx(&this_arg_conv);
51905         return ret_conv;
51906 }
51907
51908 jboolean  __attribute__((export_name("TS_ChannelTypeFeatures_requires_anchors_nonzero_fee_htlc_tx"))) TS_ChannelTypeFeatures_requires_anchors_nonzero_fee_htlc_tx(uint64_t this_arg) {
51909         LDKChannelTypeFeatures this_arg_conv;
51910         this_arg_conv.inner = untag_ptr(this_arg);
51911         this_arg_conv.is_owned = ptr_is_owned(this_arg);
51912         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
51913         this_arg_conv.is_owned = false;
51914         jboolean ret_conv = ChannelTypeFeatures_requires_anchors_nonzero_fee_htlc_tx(&this_arg_conv);
51915         return ret_conv;
51916 }
51917
51918 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) {
51919         LDKInitFeatures this_arg_conv;
51920         this_arg_conv.inner = untag_ptr(this_arg);
51921         this_arg_conv.is_owned = ptr_is_owned(this_arg);
51922         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
51923         this_arg_conv.is_owned = false;
51924         InitFeatures_set_anchors_zero_fee_htlc_tx_optional(&this_arg_conv);
51925 }
51926
51927 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) {
51928         LDKInitFeatures this_arg_conv;
51929         this_arg_conv.inner = untag_ptr(this_arg);
51930         this_arg_conv.is_owned = ptr_is_owned(this_arg);
51931         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
51932         this_arg_conv.is_owned = false;
51933         InitFeatures_set_anchors_zero_fee_htlc_tx_required(&this_arg_conv);
51934 }
51935
51936 jboolean  __attribute__((export_name("TS_InitFeatures_supports_anchors_zero_fee_htlc_tx"))) TS_InitFeatures_supports_anchors_zero_fee_htlc_tx(uint64_t this_arg) {
51937         LDKInitFeatures this_arg_conv;
51938         this_arg_conv.inner = untag_ptr(this_arg);
51939         this_arg_conv.is_owned = ptr_is_owned(this_arg);
51940         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
51941         this_arg_conv.is_owned = false;
51942         jboolean ret_conv = InitFeatures_supports_anchors_zero_fee_htlc_tx(&this_arg_conv);
51943         return ret_conv;
51944 }
51945
51946 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) {
51947         LDKNodeFeatures this_arg_conv;
51948         this_arg_conv.inner = untag_ptr(this_arg);
51949         this_arg_conv.is_owned = ptr_is_owned(this_arg);
51950         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
51951         this_arg_conv.is_owned = false;
51952         NodeFeatures_set_anchors_zero_fee_htlc_tx_optional(&this_arg_conv);
51953 }
51954
51955 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) {
51956         LDKNodeFeatures this_arg_conv;
51957         this_arg_conv.inner = untag_ptr(this_arg);
51958         this_arg_conv.is_owned = ptr_is_owned(this_arg);
51959         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
51960         this_arg_conv.is_owned = false;
51961         NodeFeatures_set_anchors_zero_fee_htlc_tx_required(&this_arg_conv);
51962 }
51963
51964 jboolean  __attribute__((export_name("TS_NodeFeatures_supports_anchors_zero_fee_htlc_tx"))) TS_NodeFeatures_supports_anchors_zero_fee_htlc_tx(uint64_t this_arg) {
51965         LDKNodeFeatures this_arg_conv;
51966         this_arg_conv.inner = untag_ptr(this_arg);
51967         this_arg_conv.is_owned = ptr_is_owned(this_arg);
51968         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
51969         this_arg_conv.is_owned = false;
51970         jboolean ret_conv = NodeFeatures_supports_anchors_zero_fee_htlc_tx(&this_arg_conv);
51971         return ret_conv;
51972 }
51973
51974 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) {
51975         LDKChannelTypeFeatures this_arg_conv;
51976         this_arg_conv.inner = untag_ptr(this_arg);
51977         this_arg_conv.is_owned = ptr_is_owned(this_arg);
51978         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
51979         this_arg_conv.is_owned = false;
51980         ChannelTypeFeatures_set_anchors_zero_fee_htlc_tx_optional(&this_arg_conv);
51981 }
51982
51983 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) {
51984         LDKChannelTypeFeatures this_arg_conv;
51985         this_arg_conv.inner = untag_ptr(this_arg);
51986         this_arg_conv.is_owned = ptr_is_owned(this_arg);
51987         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
51988         this_arg_conv.is_owned = false;
51989         ChannelTypeFeatures_set_anchors_zero_fee_htlc_tx_required(&this_arg_conv);
51990 }
51991
51992 jboolean  __attribute__((export_name("TS_ChannelTypeFeatures_supports_anchors_zero_fee_htlc_tx"))) TS_ChannelTypeFeatures_supports_anchors_zero_fee_htlc_tx(uint64_t this_arg) {
51993         LDKChannelTypeFeatures this_arg_conv;
51994         this_arg_conv.inner = untag_ptr(this_arg);
51995         this_arg_conv.is_owned = ptr_is_owned(this_arg);
51996         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
51997         this_arg_conv.is_owned = false;
51998         jboolean ret_conv = ChannelTypeFeatures_supports_anchors_zero_fee_htlc_tx(&this_arg_conv);
51999         return ret_conv;
52000 }
52001
52002 jboolean  __attribute__((export_name("TS_InitFeatures_requires_anchors_zero_fee_htlc_tx"))) TS_InitFeatures_requires_anchors_zero_fee_htlc_tx(uint64_t this_arg) {
52003         LDKInitFeatures this_arg_conv;
52004         this_arg_conv.inner = untag_ptr(this_arg);
52005         this_arg_conv.is_owned = ptr_is_owned(this_arg);
52006         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
52007         this_arg_conv.is_owned = false;
52008         jboolean ret_conv = InitFeatures_requires_anchors_zero_fee_htlc_tx(&this_arg_conv);
52009         return ret_conv;
52010 }
52011
52012 jboolean  __attribute__((export_name("TS_NodeFeatures_requires_anchors_zero_fee_htlc_tx"))) TS_NodeFeatures_requires_anchors_zero_fee_htlc_tx(uint64_t this_arg) {
52013         LDKNodeFeatures this_arg_conv;
52014         this_arg_conv.inner = untag_ptr(this_arg);
52015         this_arg_conv.is_owned = ptr_is_owned(this_arg);
52016         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
52017         this_arg_conv.is_owned = false;
52018         jboolean ret_conv = NodeFeatures_requires_anchors_zero_fee_htlc_tx(&this_arg_conv);
52019         return ret_conv;
52020 }
52021
52022 jboolean  __attribute__((export_name("TS_ChannelTypeFeatures_requires_anchors_zero_fee_htlc_tx"))) TS_ChannelTypeFeatures_requires_anchors_zero_fee_htlc_tx(uint64_t this_arg) {
52023         LDKChannelTypeFeatures this_arg_conv;
52024         this_arg_conv.inner = untag_ptr(this_arg);
52025         this_arg_conv.is_owned = ptr_is_owned(this_arg);
52026         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
52027         this_arg_conv.is_owned = false;
52028         jboolean ret_conv = ChannelTypeFeatures_requires_anchors_zero_fee_htlc_tx(&this_arg_conv);
52029         return ret_conv;
52030 }
52031
52032 void  __attribute__((export_name("TS_InitFeatures_set_shutdown_any_segwit_optional"))) TS_InitFeatures_set_shutdown_any_segwit_optional(uint64_t this_arg) {
52033         LDKInitFeatures this_arg_conv;
52034         this_arg_conv.inner = untag_ptr(this_arg);
52035         this_arg_conv.is_owned = ptr_is_owned(this_arg);
52036         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
52037         this_arg_conv.is_owned = false;
52038         InitFeatures_set_shutdown_any_segwit_optional(&this_arg_conv);
52039 }
52040
52041 void  __attribute__((export_name("TS_InitFeatures_set_shutdown_any_segwit_required"))) TS_InitFeatures_set_shutdown_any_segwit_required(uint64_t this_arg) {
52042         LDKInitFeatures this_arg_conv;
52043         this_arg_conv.inner = untag_ptr(this_arg);
52044         this_arg_conv.is_owned = ptr_is_owned(this_arg);
52045         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
52046         this_arg_conv.is_owned = false;
52047         InitFeatures_set_shutdown_any_segwit_required(&this_arg_conv);
52048 }
52049
52050 jboolean  __attribute__((export_name("TS_InitFeatures_supports_shutdown_anysegwit"))) TS_InitFeatures_supports_shutdown_anysegwit(uint64_t this_arg) {
52051         LDKInitFeatures this_arg_conv;
52052         this_arg_conv.inner = untag_ptr(this_arg);
52053         this_arg_conv.is_owned = ptr_is_owned(this_arg);
52054         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
52055         this_arg_conv.is_owned = false;
52056         jboolean ret_conv = InitFeatures_supports_shutdown_anysegwit(&this_arg_conv);
52057         return ret_conv;
52058 }
52059
52060 void  __attribute__((export_name("TS_NodeFeatures_set_shutdown_any_segwit_optional"))) TS_NodeFeatures_set_shutdown_any_segwit_optional(uint64_t this_arg) {
52061         LDKNodeFeatures this_arg_conv;
52062         this_arg_conv.inner = untag_ptr(this_arg);
52063         this_arg_conv.is_owned = ptr_is_owned(this_arg);
52064         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
52065         this_arg_conv.is_owned = false;
52066         NodeFeatures_set_shutdown_any_segwit_optional(&this_arg_conv);
52067 }
52068
52069 void  __attribute__((export_name("TS_NodeFeatures_set_shutdown_any_segwit_required"))) TS_NodeFeatures_set_shutdown_any_segwit_required(uint64_t this_arg) {
52070         LDKNodeFeatures this_arg_conv;
52071         this_arg_conv.inner = untag_ptr(this_arg);
52072         this_arg_conv.is_owned = ptr_is_owned(this_arg);
52073         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
52074         this_arg_conv.is_owned = false;
52075         NodeFeatures_set_shutdown_any_segwit_required(&this_arg_conv);
52076 }
52077
52078 jboolean  __attribute__((export_name("TS_NodeFeatures_supports_shutdown_anysegwit"))) TS_NodeFeatures_supports_shutdown_anysegwit(uint64_t this_arg) {
52079         LDKNodeFeatures this_arg_conv;
52080         this_arg_conv.inner = untag_ptr(this_arg);
52081         this_arg_conv.is_owned = ptr_is_owned(this_arg);
52082         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
52083         this_arg_conv.is_owned = false;
52084         jboolean ret_conv = NodeFeatures_supports_shutdown_anysegwit(&this_arg_conv);
52085         return ret_conv;
52086 }
52087
52088 jboolean  __attribute__((export_name("TS_InitFeatures_requires_shutdown_anysegwit"))) TS_InitFeatures_requires_shutdown_anysegwit(uint64_t this_arg) {
52089         LDKInitFeatures this_arg_conv;
52090         this_arg_conv.inner = untag_ptr(this_arg);
52091         this_arg_conv.is_owned = ptr_is_owned(this_arg);
52092         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
52093         this_arg_conv.is_owned = false;
52094         jboolean ret_conv = InitFeatures_requires_shutdown_anysegwit(&this_arg_conv);
52095         return ret_conv;
52096 }
52097
52098 jboolean  __attribute__((export_name("TS_NodeFeatures_requires_shutdown_anysegwit"))) TS_NodeFeatures_requires_shutdown_anysegwit(uint64_t this_arg) {
52099         LDKNodeFeatures this_arg_conv;
52100         this_arg_conv.inner = untag_ptr(this_arg);
52101         this_arg_conv.is_owned = ptr_is_owned(this_arg);
52102         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
52103         this_arg_conv.is_owned = false;
52104         jboolean ret_conv = NodeFeatures_requires_shutdown_anysegwit(&this_arg_conv);
52105         return ret_conv;
52106 }
52107
52108 void  __attribute__((export_name("TS_InitFeatures_set_taproot_optional"))) TS_InitFeatures_set_taproot_optional(uint64_t this_arg) {
52109         LDKInitFeatures this_arg_conv;
52110         this_arg_conv.inner = untag_ptr(this_arg);
52111         this_arg_conv.is_owned = ptr_is_owned(this_arg);
52112         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
52113         this_arg_conv.is_owned = false;
52114         InitFeatures_set_taproot_optional(&this_arg_conv);
52115 }
52116
52117 void  __attribute__((export_name("TS_InitFeatures_set_taproot_required"))) TS_InitFeatures_set_taproot_required(uint64_t this_arg) {
52118         LDKInitFeatures this_arg_conv;
52119         this_arg_conv.inner = untag_ptr(this_arg);
52120         this_arg_conv.is_owned = ptr_is_owned(this_arg);
52121         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
52122         this_arg_conv.is_owned = false;
52123         InitFeatures_set_taproot_required(&this_arg_conv);
52124 }
52125
52126 jboolean  __attribute__((export_name("TS_InitFeatures_supports_taproot"))) TS_InitFeatures_supports_taproot(uint64_t this_arg) {
52127         LDKInitFeatures this_arg_conv;
52128         this_arg_conv.inner = untag_ptr(this_arg);
52129         this_arg_conv.is_owned = ptr_is_owned(this_arg);
52130         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
52131         this_arg_conv.is_owned = false;
52132         jboolean ret_conv = InitFeatures_supports_taproot(&this_arg_conv);
52133         return ret_conv;
52134 }
52135
52136 void  __attribute__((export_name("TS_NodeFeatures_set_taproot_optional"))) TS_NodeFeatures_set_taproot_optional(uint64_t this_arg) {
52137         LDKNodeFeatures this_arg_conv;
52138         this_arg_conv.inner = untag_ptr(this_arg);
52139         this_arg_conv.is_owned = ptr_is_owned(this_arg);
52140         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
52141         this_arg_conv.is_owned = false;
52142         NodeFeatures_set_taproot_optional(&this_arg_conv);
52143 }
52144
52145 void  __attribute__((export_name("TS_NodeFeatures_set_taproot_required"))) TS_NodeFeatures_set_taproot_required(uint64_t this_arg) {
52146         LDKNodeFeatures this_arg_conv;
52147         this_arg_conv.inner = untag_ptr(this_arg);
52148         this_arg_conv.is_owned = ptr_is_owned(this_arg);
52149         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
52150         this_arg_conv.is_owned = false;
52151         NodeFeatures_set_taproot_required(&this_arg_conv);
52152 }
52153
52154 jboolean  __attribute__((export_name("TS_NodeFeatures_supports_taproot"))) TS_NodeFeatures_supports_taproot(uint64_t this_arg) {
52155         LDKNodeFeatures this_arg_conv;
52156         this_arg_conv.inner = untag_ptr(this_arg);
52157         this_arg_conv.is_owned = ptr_is_owned(this_arg);
52158         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
52159         this_arg_conv.is_owned = false;
52160         jboolean ret_conv = NodeFeatures_supports_taproot(&this_arg_conv);
52161         return ret_conv;
52162 }
52163
52164 void  __attribute__((export_name("TS_ChannelTypeFeatures_set_taproot_optional"))) TS_ChannelTypeFeatures_set_taproot_optional(uint64_t this_arg) {
52165         LDKChannelTypeFeatures this_arg_conv;
52166         this_arg_conv.inner = untag_ptr(this_arg);
52167         this_arg_conv.is_owned = ptr_is_owned(this_arg);
52168         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
52169         this_arg_conv.is_owned = false;
52170         ChannelTypeFeatures_set_taproot_optional(&this_arg_conv);
52171 }
52172
52173 void  __attribute__((export_name("TS_ChannelTypeFeatures_set_taproot_required"))) TS_ChannelTypeFeatures_set_taproot_required(uint64_t this_arg) {
52174         LDKChannelTypeFeatures this_arg_conv;
52175         this_arg_conv.inner = untag_ptr(this_arg);
52176         this_arg_conv.is_owned = ptr_is_owned(this_arg);
52177         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
52178         this_arg_conv.is_owned = false;
52179         ChannelTypeFeatures_set_taproot_required(&this_arg_conv);
52180 }
52181
52182 jboolean  __attribute__((export_name("TS_ChannelTypeFeatures_supports_taproot"))) TS_ChannelTypeFeatures_supports_taproot(uint64_t this_arg) {
52183         LDKChannelTypeFeatures this_arg_conv;
52184         this_arg_conv.inner = untag_ptr(this_arg);
52185         this_arg_conv.is_owned = ptr_is_owned(this_arg);
52186         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
52187         this_arg_conv.is_owned = false;
52188         jboolean ret_conv = ChannelTypeFeatures_supports_taproot(&this_arg_conv);
52189         return ret_conv;
52190 }
52191
52192 jboolean  __attribute__((export_name("TS_InitFeatures_requires_taproot"))) TS_InitFeatures_requires_taproot(uint64_t this_arg) {
52193         LDKInitFeatures this_arg_conv;
52194         this_arg_conv.inner = untag_ptr(this_arg);
52195         this_arg_conv.is_owned = ptr_is_owned(this_arg);
52196         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
52197         this_arg_conv.is_owned = false;
52198         jboolean ret_conv = InitFeatures_requires_taproot(&this_arg_conv);
52199         return ret_conv;
52200 }
52201
52202 jboolean  __attribute__((export_name("TS_NodeFeatures_requires_taproot"))) TS_NodeFeatures_requires_taproot(uint64_t this_arg) {
52203         LDKNodeFeatures this_arg_conv;
52204         this_arg_conv.inner = untag_ptr(this_arg);
52205         this_arg_conv.is_owned = ptr_is_owned(this_arg);
52206         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
52207         this_arg_conv.is_owned = false;
52208         jboolean ret_conv = NodeFeatures_requires_taproot(&this_arg_conv);
52209         return ret_conv;
52210 }
52211
52212 jboolean  __attribute__((export_name("TS_ChannelTypeFeatures_requires_taproot"))) TS_ChannelTypeFeatures_requires_taproot(uint64_t this_arg) {
52213         LDKChannelTypeFeatures this_arg_conv;
52214         this_arg_conv.inner = untag_ptr(this_arg);
52215         this_arg_conv.is_owned = ptr_is_owned(this_arg);
52216         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
52217         this_arg_conv.is_owned = false;
52218         jboolean ret_conv = ChannelTypeFeatures_requires_taproot(&this_arg_conv);
52219         return ret_conv;
52220 }
52221
52222 void  __attribute__((export_name("TS_InitFeatures_set_onion_messages_optional"))) TS_InitFeatures_set_onion_messages_optional(uint64_t this_arg) {
52223         LDKInitFeatures this_arg_conv;
52224         this_arg_conv.inner = untag_ptr(this_arg);
52225         this_arg_conv.is_owned = ptr_is_owned(this_arg);
52226         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
52227         this_arg_conv.is_owned = false;
52228         InitFeatures_set_onion_messages_optional(&this_arg_conv);
52229 }
52230
52231 void  __attribute__((export_name("TS_InitFeatures_set_onion_messages_required"))) TS_InitFeatures_set_onion_messages_required(uint64_t this_arg) {
52232         LDKInitFeatures this_arg_conv;
52233         this_arg_conv.inner = untag_ptr(this_arg);
52234         this_arg_conv.is_owned = ptr_is_owned(this_arg);
52235         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
52236         this_arg_conv.is_owned = false;
52237         InitFeatures_set_onion_messages_required(&this_arg_conv);
52238 }
52239
52240 jboolean  __attribute__((export_name("TS_InitFeatures_supports_onion_messages"))) TS_InitFeatures_supports_onion_messages(uint64_t this_arg) {
52241         LDKInitFeatures this_arg_conv;
52242         this_arg_conv.inner = untag_ptr(this_arg);
52243         this_arg_conv.is_owned = ptr_is_owned(this_arg);
52244         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
52245         this_arg_conv.is_owned = false;
52246         jboolean ret_conv = InitFeatures_supports_onion_messages(&this_arg_conv);
52247         return ret_conv;
52248 }
52249
52250 void  __attribute__((export_name("TS_NodeFeatures_set_onion_messages_optional"))) TS_NodeFeatures_set_onion_messages_optional(uint64_t this_arg) {
52251         LDKNodeFeatures this_arg_conv;
52252         this_arg_conv.inner = untag_ptr(this_arg);
52253         this_arg_conv.is_owned = ptr_is_owned(this_arg);
52254         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
52255         this_arg_conv.is_owned = false;
52256         NodeFeatures_set_onion_messages_optional(&this_arg_conv);
52257 }
52258
52259 void  __attribute__((export_name("TS_NodeFeatures_set_onion_messages_required"))) TS_NodeFeatures_set_onion_messages_required(uint64_t this_arg) {
52260         LDKNodeFeatures this_arg_conv;
52261         this_arg_conv.inner = untag_ptr(this_arg);
52262         this_arg_conv.is_owned = ptr_is_owned(this_arg);
52263         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
52264         this_arg_conv.is_owned = false;
52265         NodeFeatures_set_onion_messages_required(&this_arg_conv);
52266 }
52267
52268 jboolean  __attribute__((export_name("TS_NodeFeatures_supports_onion_messages"))) TS_NodeFeatures_supports_onion_messages(uint64_t this_arg) {
52269         LDKNodeFeatures this_arg_conv;
52270         this_arg_conv.inner = untag_ptr(this_arg);
52271         this_arg_conv.is_owned = ptr_is_owned(this_arg);
52272         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
52273         this_arg_conv.is_owned = false;
52274         jboolean ret_conv = NodeFeatures_supports_onion_messages(&this_arg_conv);
52275         return ret_conv;
52276 }
52277
52278 jboolean  __attribute__((export_name("TS_InitFeatures_requires_onion_messages"))) TS_InitFeatures_requires_onion_messages(uint64_t this_arg) {
52279         LDKInitFeatures this_arg_conv;
52280         this_arg_conv.inner = untag_ptr(this_arg);
52281         this_arg_conv.is_owned = ptr_is_owned(this_arg);
52282         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
52283         this_arg_conv.is_owned = false;
52284         jboolean ret_conv = InitFeatures_requires_onion_messages(&this_arg_conv);
52285         return ret_conv;
52286 }
52287
52288 jboolean  __attribute__((export_name("TS_NodeFeatures_requires_onion_messages"))) TS_NodeFeatures_requires_onion_messages(uint64_t this_arg) {
52289         LDKNodeFeatures this_arg_conv;
52290         this_arg_conv.inner = untag_ptr(this_arg);
52291         this_arg_conv.is_owned = ptr_is_owned(this_arg);
52292         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
52293         this_arg_conv.is_owned = false;
52294         jboolean ret_conv = NodeFeatures_requires_onion_messages(&this_arg_conv);
52295         return ret_conv;
52296 }
52297
52298 void  __attribute__((export_name("TS_InitFeatures_set_channel_type_optional"))) TS_InitFeatures_set_channel_type_optional(uint64_t this_arg) {
52299         LDKInitFeatures this_arg_conv;
52300         this_arg_conv.inner = untag_ptr(this_arg);
52301         this_arg_conv.is_owned = ptr_is_owned(this_arg);
52302         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
52303         this_arg_conv.is_owned = false;
52304         InitFeatures_set_channel_type_optional(&this_arg_conv);
52305 }
52306
52307 void  __attribute__((export_name("TS_InitFeatures_set_channel_type_required"))) TS_InitFeatures_set_channel_type_required(uint64_t this_arg) {
52308         LDKInitFeatures this_arg_conv;
52309         this_arg_conv.inner = untag_ptr(this_arg);
52310         this_arg_conv.is_owned = ptr_is_owned(this_arg);
52311         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
52312         this_arg_conv.is_owned = false;
52313         InitFeatures_set_channel_type_required(&this_arg_conv);
52314 }
52315
52316 jboolean  __attribute__((export_name("TS_InitFeatures_supports_channel_type"))) TS_InitFeatures_supports_channel_type(uint64_t this_arg) {
52317         LDKInitFeatures this_arg_conv;
52318         this_arg_conv.inner = untag_ptr(this_arg);
52319         this_arg_conv.is_owned = ptr_is_owned(this_arg);
52320         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
52321         this_arg_conv.is_owned = false;
52322         jboolean ret_conv = InitFeatures_supports_channel_type(&this_arg_conv);
52323         return ret_conv;
52324 }
52325
52326 void  __attribute__((export_name("TS_NodeFeatures_set_channel_type_optional"))) TS_NodeFeatures_set_channel_type_optional(uint64_t this_arg) {
52327         LDKNodeFeatures this_arg_conv;
52328         this_arg_conv.inner = untag_ptr(this_arg);
52329         this_arg_conv.is_owned = ptr_is_owned(this_arg);
52330         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
52331         this_arg_conv.is_owned = false;
52332         NodeFeatures_set_channel_type_optional(&this_arg_conv);
52333 }
52334
52335 void  __attribute__((export_name("TS_NodeFeatures_set_channel_type_required"))) TS_NodeFeatures_set_channel_type_required(uint64_t this_arg) {
52336         LDKNodeFeatures this_arg_conv;
52337         this_arg_conv.inner = untag_ptr(this_arg);
52338         this_arg_conv.is_owned = ptr_is_owned(this_arg);
52339         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
52340         this_arg_conv.is_owned = false;
52341         NodeFeatures_set_channel_type_required(&this_arg_conv);
52342 }
52343
52344 jboolean  __attribute__((export_name("TS_NodeFeatures_supports_channel_type"))) TS_NodeFeatures_supports_channel_type(uint64_t this_arg) {
52345         LDKNodeFeatures this_arg_conv;
52346         this_arg_conv.inner = untag_ptr(this_arg);
52347         this_arg_conv.is_owned = ptr_is_owned(this_arg);
52348         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
52349         this_arg_conv.is_owned = false;
52350         jboolean ret_conv = NodeFeatures_supports_channel_type(&this_arg_conv);
52351         return ret_conv;
52352 }
52353
52354 jboolean  __attribute__((export_name("TS_InitFeatures_requires_channel_type"))) TS_InitFeatures_requires_channel_type(uint64_t this_arg) {
52355         LDKInitFeatures this_arg_conv;
52356         this_arg_conv.inner = untag_ptr(this_arg);
52357         this_arg_conv.is_owned = ptr_is_owned(this_arg);
52358         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
52359         this_arg_conv.is_owned = false;
52360         jboolean ret_conv = InitFeatures_requires_channel_type(&this_arg_conv);
52361         return ret_conv;
52362 }
52363
52364 jboolean  __attribute__((export_name("TS_NodeFeatures_requires_channel_type"))) TS_NodeFeatures_requires_channel_type(uint64_t this_arg) {
52365         LDKNodeFeatures this_arg_conv;
52366         this_arg_conv.inner = untag_ptr(this_arg);
52367         this_arg_conv.is_owned = ptr_is_owned(this_arg);
52368         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
52369         this_arg_conv.is_owned = false;
52370         jboolean ret_conv = NodeFeatures_requires_channel_type(&this_arg_conv);
52371         return ret_conv;
52372 }
52373
52374 void  __attribute__((export_name("TS_InitFeatures_set_scid_privacy_optional"))) TS_InitFeatures_set_scid_privacy_optional(uint64_t this_arg) {
52375         LDKInitFeatures this_arg_conv;
52376         this_arg_conv.inner = untag_ptr(this_arg);
52377         this_arg_conv.is_owned = ptr_is_owned(this_arg);
52378         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
52379         this_arg_conv.is_owned = false;
52380         InitFeatures_set_scid_privacy_optional(&this_arg_conv);
52381 }
52382
52383 void  __attribute__((export_name("TS_InitFeatures_set_scid_privacy_required"))) TS_InitFeatures_set_scid_privacy_required(uint64_t this_arg) {
52384         LDKInitFeatures this_arg_conv;
52385         this_arg_conv.inner = untag_ptr(this_arg);
52386         this_arg_conv.is_owned = ptr_is_owned(this_arg);
52387         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
52388         this_arg_conv.is_owned = false;
52389         InitFeatures_set_scid_privacy_required(&this_arg_conv);
52390 }
52391
52392 jboolean  __attribute__((export_name("TS_InitFeatures_supports_scid_privacy"))) TS_InitFeatures_supports_scid_privacy(uint64_t this_arg) {
52393         LDKInitFeatures this_arg_conv;
52394         this_arg_conv.inner = untag_ptr(this_arg);
52395         this_arg_conv.is_owned = ptr_is_owned(this_arg);
52396         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
52397         this_arg_conv.is_owned = false;
52398         jboolean ret_conv = InitFeatures_supports_scid_privacy(&this_arg_conv);
52399         return ret_conv;
52400 }
52401
52402 void  __attribute__((export_name("TS_NodeFeatures_set_scid_privacy_optional"))) TS_NodeFeatures_set_scid_privacy_optional(uint64_t this_arg) {
52403         LDKNodeFeatures this_arg_conv;
52404         this_arg_conv.inner = untag_ptr(this_arg);
52405         this_arg_conv.is_owned = ptr_is_owned(this_arg);
52406         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
52407         this_arg_conv.is_owned = false;
52408         NodeFeatures_set_scid_privacy_optional(&this_arg_conv);
52409 }
52410
52411 void  __attribute__((export_name("TS_NodeFeatures_set_scid_privacy_required"))) TS_NodeFeatures_set_scid_privacy_required(uint64_t this_arg) {
52412         LDKNodeFeatures this_arg_conv;
52413         this_arg_conv.inner = untag_ptr(this_arg);
52414         this_arg_conv.is_owned = ptr_is_owned(this_arg);
52415         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
52416         this_arg_conv.is_owned = false;
52417         NodeFeatures_set_scid_privacy_required(&this_arg_conv);
52418 }
52419
52420 jboolean  __attribute__((export_name("TS_NodeFeatures_supports_scid_privacy"))) TS_NodeFeatures_supports_scid_privacy(uint64_t this_arg) {
52421         LDKNodeFeatures this_arg_conv;
52422         this_arg_conv.inner = untag_ptr(this_arg);
52423         this_arg_conv.is_owned = ptr_is_owned(this_arg);
52424         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
52425         this_arg_conv.is_owned = false;
52426         jboolean ret_conv = NodeFeatures_supports_scid_privacy(&this_arg_conv);
52427         return ret_conv;
52428 }
52429
52430 void  __attribute__((export_name("TS_ChannelTypeFeatures_set_scid_privacy_optional"))) TS_ChannelTypeFeatures_set_scid_privacy_optional(uint64_t this_arg) {
52431         LDKChannelTypeFeatures this_arg_conv;
52432         this_arg_conv.inner = untag_ptr(this_arg);
52433         this_arg_conv.is_owned = ptr_is_owned(this_arg);
52434         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
52435         this_arg_conv.is_owned = false;
52436         ChannelTypeFeatures_set_scid_privacy_optional(&this_arg_conv);
52437 }
52438
52439 void  __attribute__((export_name("TS_ChannelTypeFeatures_set_scid_privacy_required"))) TS_ChannelTypeFeatures_set_scid_privacy_required(uint64_t this_arg) {
52440         LDKChannelTypeFeatures this_arg_conv;
52441         this_arg_conv.inner = untag_ptr(this_arg);
52442         this_arg_conv.is_owned = ptr_is_owned(this_arg);
52443         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
52444         this_arg_conv.is_owned = false;
52445         ChannelTypeFeatures_set_scid_privacy_required(&this_arg_conv);
52446 }
52447
52448 jboolean  __attribute__((export_name("TS_ChannelTypeFeatures_supports_scid_privacy"))) TS_ChannelTypeFeatures_supports_scid_privacy(uint64_t this_arg) {
52449         LDKChannelTypeFeatures this_arg_conv;
52450         this_arg_conv.inner = untag_ptr(this_arg);
52451         this_arg_conv.is_owned = ptr_is_owned(this_arg);
52452         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
52453         this_arg_conv.is_owned = false;
52454         jboolean ret_conv = ChannelTypeFeatures_supports_scid_privacy(&this_arg_conv);
52455         return ret_conv;
52456 }
52457
52458 jboolean  __attribute__((export_name("TS_InitFeatures_requires_scid_privacy"))) TS_InitFeatures_requires_scid_privacy(uint64_t this_arg) {
52459         LDKInitFeatures this_arg_conv;
52460         this_arg_conv.inner = untag_ptr(this_arg);
52461         this_arg_conv.is_owned = ptr_is_owned(this_arg);
52462         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
52463         this_arg_conv.is_owned = false;
52464         jboolean ret_conv = InitFeatures_requires_scid_privacy(&this_arg_conv);
52465         return ret_conv;
52466 }
52467
52468 jboolean  __attribute__((export_name("TS_NodeFeatures_requires_scid_privacy"))) TS_NodeFeatures_requires_scid_privacy(uint64_t this_arg) {
52469         LDKNodeFeatures this_arg_conv;
52470         this_arg_conv.inner = untag_ptr(this_arg);
52471         this_arg_conv.is_owned = ptr_is_owned(this_arg);
52472         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
52473         this_arg_conv.is_owned = false;
52474         jboolean ret_conv = NodeFeatures_requires_scid_privacy(&this_arg_conv);
52475         return ret_conv;
52476 }
52477
52478 jboolean  __attribute__((export_name("TS_ChannelTypeFeatures_requires_scid_privacy"))) TS_ChannelTypeFeatures_requires_scid_privacy(uint64_t this_arg) {
52479         LDKChannelTypeFeatures this_arg_conv;
52480         this_arg_conv.inner = untag_ptr(this_arg);
52481         this_arg_conv.is_owned = ptr_is_owned(this_arg);
52482         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
52483         this_arg_conv.is_owned = false;
52484         jboolean ret_conv = ChannelTypeFeatures_requires_scid_privacy(&this_arg_conv);
52485         return ret_conv;
52486 }
52487
52488 void  __attribute__((export_name("TS_Bolt11InvoiceFeatures_set_payment_metadata_optional"))) TS_Bolt11InvoiceFeatures_set_payment_metadata_optional(uint64_t this_arg) {
52489         LDKBolt11InvoiceFeatures this_arg_conv;
52490         this_arg_conv.inner = untag_ptr(this_arg);
52491         this_arg_conv.is_owned = ptr_is_owned(this_arg);
52492         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
52493         this_arg_conv.is_owned = false;
52494         Bolt11InvoiceFeatures_set_payment_metadata_optional(&this_arg_conv);
52495 }
52496
52497 void  __attribute__((export_name("TS_Bolt11InvoiceFeatures_set_payment_metadata_required"))) TS_Bolt11InvoiceFeatures_set_payment_metadata_required(uint64_t this_arg) {
52498         LDKBolt11InvoiceFeatures this_arg_conv;
52499         this_arg_conv.inner = untag_ptr(this_arg);
52500         this_arg_conv.is_owned = ptr_is_owned(this_arg);
52501         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
52502         this_arg_conv.is_owned = false;
52503         Bolt11InvoiceFeatures_set_payment_metadata_required(&this_arg_conv);
52504 }
52505
52506 jboolean  __attribute__((export_name("TS_Bolt11InvoiceFeatures_supports_payment_metadata"))) TS_Bolt11InvoiceFeatures_supports_payment_metadata(uint64_t this_arg) {
52507         LDKBolt11InvoiceFeatures this_arg_conv;
52508         this_arg_conv.inner = untag_ptr(this_arg);
52509         this_arg_conv.is_owned = ptr_is_owned(this_arg);
52510         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
52511         this_arg_conv.is_owned = false;
52512         jboolean ret_conv = Bolt11InvoiceFeatures_supports_payment_metadata(&this_arg_conv);
52513         return ret_conv;
52514 }
52515
52516 jboolean  __attribute__((export_name("TS_Bolt11InvoiceFeatures_requires_payment_metadata"))) TS_Bolt11InvoiceFeatures_requires_payment_metadata(uint64_t this_arg) {
52517         LDKBolt11InvoiceFeatures this_arg_conv;
52518         this_arg_conv.inner = untag_ptr(this_arg);
52519         this_arg_conv.is_owned = ptr_is_owned(this_arg);
52520         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
52521         this_arg_conv.is_owned = false;
52522         jboolean ret_conv = Bolt11InvoiceFeatures_requires_payment_metadata(&this_arg_conv);
52523         return ret_conv;
52524 }
52525
52526 void  __attribute__((export_name("TS_InitFeatures_set_zero_conf_optional"))) TS_InitFeatures_set_zero_conf_optional(uint64_t this_arg) {
52527         LDKInitFeatures this_arg_conv;
52528         this_arg_conv.inner = untag_ptr(this_arg);
52529         this_arg_conv.is_owned = ptr_is_owned(this_arg);
52530         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
52531         this_arg_conv.is_owned = false;
52532         InitFeatures_set_zero_conf_optional(&this_arg_conv);
52533 }
52534
52535 void  __attribute__((export_name("TS_InitFeatures_set_zero_conf_required"))) TS_InitFeatures_set_zero_conf_required(uint64_t this_arg) {
52536         LDKInitFeatures this_arg_conv;
52537         this_arg_conv.inner = untag_ptr(this_arg);
52538         this_arg_conv.is_owned = ptr_is_owned(this_arg);
52539         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
52540         this_arg_conv.is_owned = false;
52541         InitFeatures_set_zero_conf_required(&this_arg_conv);
52542 }
52543
52544 jboolean  __attribute__((export_name("TS_InitFeatures_supports_zero_conf"))) TS_InitFeatures_supports_zero_conf(uint64_t this_arg) {
52545         LDKInitFeatures this_arg_conv;
52546         this_arg_conv.inner = untag_ptr(this_arg);
52547         this_arg_conv.is_owned = ptr_is_owned(this_arg);
52548         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
52549         this_arg_conv.is_owned = false;
52550         jboolean ret_conv = InitFeatures_supports_zero_conf(&this_arg_conv);
52551         return ret_conv;
52552 }
52553
52554 void  __attribute__((export_name("TS_NodeFeatures_set_zero_conf_optional"))) TS_NodeFeatures_set_zero_conf_optional(uint64_t this_arg) {
52555         LDKNodeFeatures this_arg_conv;
52556         this_arg_conv.inner = untag_ptr(this_arg);
52557         this_arg_conv.is_owned = ptr_is_owned(this_arg);
52558         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
52559         this_arg_conv.is_owned = false;
52560         NodeFeatures_set_zero_conf_optional(&this_arg_conv);
52561 }
52562
52563 void  __attribute__((export_name("TS_NodeFeatures_set_zero_conf_required"))) TS_NodeFeatures_set_zero_conf_required(uint64_t this_arg) {
52564         LDKNodeFeatures this_arg_conv;
52565         this_arg_conv.inner = untag_ptr(this_arg);
52566         this_arg_conv.is_owned = ptr_is_owned(this_arg);
52567         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
52568         this_arg_conv.is_owned = false;
52569         NodeFeatures_set_zero_conf_required(&this_arg_conv);
52570 }
52571
52572 jboolean  __attribute__((export_name("TS_NodeFeatures_supports_zero_conf"))) TS_NodeFeatures_supports_zero_conf(uint64_t this_arg) {
52573         LDKNodeFeatures this_arg_conv;
52574         this_arg_conv.inner = untag_ptr(this_arg);
52575         this_arg_conv.is_owned = ptr_is_owned(this_arg);
52576         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
52577         this_arg_conv.is_owned = false;
52578         jboolean ret_conv = NodeFeatures_supports_zero_conf(&this_arg_conv);
52579         return ret_conv;
52580 }
52581
52582 void  __attribute__((export_name("TS_ChannelTypeFeatures_set_zero_conf_optional"))) TS_ChannelTypeFeatures_set_zero_conf_optional(uint64_t this_arg) {
52583         LDKChannelTypeFeatures this_arg_conv;
52584         this_arg_conv.inner = untag_ptr(this_arg);
52585         this_arg_conv.is_owned = ptr_is_owned(this_arg);
52586         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
52587         this_arg_conv.is_owned = false;
52588         ChannelTypeFeatures_set_zero_conf_optional(&this_arg_conv);
52589 }
52590
52591 void  __attribute__((export_name("TS_ChannelTypeFeatures_set_zero_conf_required"))) TS_ChannelTypeFeatures_set_zero_conf_required(uint64_t this_arg) {
52592         LDKChannelTypeFeatures this_arg_conv;
52593         this_arg_conv.inner = untag_ptr(this_arg);
52594         this_arg_conv.is_owned = ptr_is_owned(this_arg);
52595         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
52596         this_arg_conv.is_owned = false;
52597         ChannelTypeFeatures_set_zero_conf_required(&this_arg_conv);
52598 }
52599
52600 jboolean  __attribute__((export_name("TS_ChannelTypeFeatures_supports_zero_conf"))) TS_ChannelTypeFeatures_supports_zero_conf(uint64_t this_arg) {
52601         LDKChannelTypeFeatures this_arg_conv;
52602         this_arg_conv.inner = untag_ptr(this_arg);
52603         this_arg_conv.is_owned = ptr_is_owned(this_arg);
52604         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
52605         this_arg_conv.is_owned = false;
52606         jboolean ret_conv = ChannelTypeFeatures_supports_zero_conf(&this_arg_conv);
52607         return ret_conv;
52608 }
52609
52610 jboolean  __attribute__((export_name("TS_InitFeatures_requires_zero_conf"))) TS_InitFeatures_requires_zero_conf(uint64_t this_arg) {
52611         LDKInitFeatures this_arg_conv;
52612         this_arg_conv.inner = untag_ptr(this_arg);
52613         this_arg_conv.is_owned = ptr_is_owned(this_arg);
52614         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
52615         this_arg_conv.is_owned = false;
52616         jboolean ret_conv = InitFeatures_requires_zero_conf(&this_arg_conv);
52617         return ret_conv;
52618 }
52619
52620 jboolean  __attribute__((export_name("TS_NodeFeatures_requires_zero_conf"))) TS_NodeFeatures_requires_zero_conf(uint64_t this_arg) {
52621         LDKNodeFeatures this_arg_conv;
52622         this_arg_conv.inner = untag_ptr(this_arg);
52623         this_arg_conv.is_owned = ptr_is_owned(this_arg);
52624         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
52625         this_arg_conv.is_owned = false;
52626         jboolean ret_conv = NodeFeatures_requires_zero_conf(&this_arg_conv);
52627         return ret_conv;
52628 }
52629
52630 jboolean  __attribute__((export_name("TS_ChannelTypeFeatures_requires_zero_conf"))) TS_ChannelTypeFeatures_requires_zero_conf(uint64_t this_arg) {
52631         LDKChannelTypeFeatures this_arg_conv;
52632         this_arg_conv.inner = untag_ptr(this_arg);
52633         this_arg_conv.is_owned = ptr_is_owned(this_arg);
52634         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
52635         this_arg_conv.is_owned = false;
52636         jboolean ret_conv = ChannelTypeFeatures_requires_zero_conf(&this_arg_conv);
52637         return ret_conv;
52638 }
52639
52640 void  __attribute__((export_name("TS_NodeFeatures_set_keysend_optional"))) TS_NodeFeatures_set_keysend_optional(uint64_t this_arg) {
52641         LDKNodeFeatures this_arg_conv;
52642         this_arg_conv.inner = untag_ptr(this_arg);
52643         this_arg_conv.is_owned = ptr_is_owned(this_arg);
52644         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
52645         this_arg_conv.is_owned = false;
52646         NodeFeatures_set_keysend_optional(&this_arg_conv);
52647 }
52648
52649 void  __attribute__((export_name("TS_NodeFeatures_set_keysend_required"))) TS_NodeFeatures_set_keysend_required(uint64_t this_arg) {
52650         LDKNodeFeatures this_arg_conv;
52651         this_arg_conv.inner = untag_ptr(this_arg);
52652         this_arg_conv.is_owned = ptr_is_owned(this_arg);
52653         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
52654         this_arg_conv.is_owned = false;
52655         NodeFeatures_set_keysend_required(&this_arg_conv);
52656 }
52657
52658 jboolean  __attribute__((export_name("TS_NodeFeatures_supports_keysend"))) TS_NodeFeatures_supports_keysend(uint64_t this_arg) {
52659         LDKNodeFeatures this_arg_conv;
52660         this_arg_conv.inner = untag_ptr(this_arg);
52661         this_arg_conv.is_owned = ptr_is_owned(this_arg);
52662         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
52663         this_arg_conv.is_owned = false;
52664         jboolean ret_conv = NodeFeatures_supports_keysend(&this_arg_conv);
52665         return ret_conv;
52666 }
52667
52668 jboolean  __attribute__((export_name("TS_NodeFeatures_requires_keysend"))) TS_NodeFeatures_requires_keysend(uint64_t this_arg) {
52669         LDKNodeFeatures this_arg_conv;
52670         this_arg_conv.inner = untag_ptr(this_arg);
52671         this_arg_conv.is_owned = ptr_is_owned(this_arg);
52672         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
52673         this_arg_conv.is_owned = false;
52674         jboolean ret_conv = NodeFeatures_requires_keysend(&this_arg_conv);
52675         return ret_conv;
52676 }
52677
52678 void  __attribute__((export_name("TS_ShutdownScript_free"))) TS_ShutdownScript_free(uint64_t this_obj) {
52679         LDKShutdownScript this_obj_conv;
52680         this_obj_conv.inner = untag_ptr(this_obj);
52681         this_obj_conv.is_owned = ptr_is_owned(this_obj);
52682         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
52683         ShutdownScript_free(this_obj_conv);
52684 }
52685
52686 static inline uint64_t ShutdownScript_clone_ptr(LDKShutdownScript *NONNULL_PTR arg) {
52687         LDKShutdownScript ret_var = ShutdownScript_clone(arg);
52688         uint64_t ret_ref = 0;
52689         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
52690         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
52691         return ret_ref;
52692 }
52693 int64_t  __attribute__((export_name("TS_ShutdownScript_clone_ptr"))) TS_ShutdownScript_clone_ptr(uint64_t arg) {
52694         LDKShutdownScript arg_conv;
52695         arg_conv.inner = untag_ptr(arg);
52696         arg_conv.is_owned = ptr_is_owned(arg);
52697         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
52698         arg_conv.is_owned = false;
52699         int64_t ret_conv = ShutdownScript_clone_ptr(&arg_conv);
52700         return ret_conv;
52701 }
52702
52703 uint64_t  __attribute__((export_name("TS_ShutdownScript_clone"))) TS_ShutdownScript_clone(uint64_t orig) {
52704         LDKShutdownScript orig_conv;
52705         orig_conv.inner = untag_ptr(orig);
52706         orig_conv.is_owned = ptr_is_owned(orig);
52707         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
52708         orig_conv.is_owned = false;
52709         LDKShutdownScript ret_var = ShutdownScript_clone(&orig_conv);
52710         uint64_t ret_ref = 0;
52711         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
52712         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
52713         return ret_ref;
52714 }
52715
52716 jboolean  __attribute__((export_name("TS_ShutdownScript_eq"))) TS_ShutdownScript_eq(uint64_t a, uint64_t b) {
52717         LDKShutdownScript a_conv;
52718         a_conv.inner = untag_ptr(a);
52719         a_conv.is_owned = ptr_is_owned(a);
52720         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
52721         a_conv.is_owned = false;
52722         LDKShutdownScript b_conv;
52723         b_conv.inner = untag_ptr(b);
52724         b_conv.is_owned = ptr_is_owned(b);
52725         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
52726         b_conv.is_owned = false;
52727         jboolean ret_conv = ShutdownScript_eq(&a_conv, &b_conv);
52728         return ret_conv;
52729 }
52730
52731 void  __attribute__((export_name("TS_InvalidShutdownScript_free"))) TS_InvalidShutdownScript_free(uint64_t this_obj) {
52732         LDKInvalidShutdownScript this_obj_conv;
52733         this_obj_conv.inner = untag_ptr(this_obj);
52734         this_obj_conv.is_owned = ptr_is_owned(this_obj);
52735         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
52736         InvalidShutdownScript_free(this_obj_conv);
52737 }
52738
52739 int8_tArray  __attribute__((export_name("TS_InvalidShutdownScript_get_script"))) TS_InvalidShutdownScript_get_script(uint64_t this_ptr) {
52740         LDKInvalidShutdownScript this_ptr_conv;
52741         this_ptr_conv.inner = untag_ptr(this_ptr);
52742         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
52743         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
52744         this_ptr_conv.is_owned = false;
52745         LDKu8slice ret_var = InvalidShutdownScript_get_script(&this_ptr_conv);
52746         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
52747         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
52748         return ret_arr;
52749 }
52750
52751 void  __attribute__((export_name("TS_InvalidShutdownScript_set_script"))) TS_InvalidShutdownScript_set_script(uint64_t this_ptr, int8_tArray val) {
52752         LDKInvalidShutdownScript this_ptr_conv;
52753         this_ptr_conv.inner = untag_ptr(this_ptr);
52754         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
52755         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
52756         this_ptr_conv.is_owned = false;
52757         LDKCVec_u8Z val_ref;
52758         val_ref.datalen = val->arr_len;
52759         val_ref.data = MALLOC(val_ref.datalen, "LDKCVec_u8Z Bytes");
52760         memcpy(val_ref.data, val->elems, val_ref.datalen); FREE(val);
52761         InvalidShutdownScript_set_script(&this_ptr_conv, val_ref);
52762 }
52763
52764 uint64_t  __attribute__((export_name("TS_InvalidShutdownScript_new"))) TS_InvalidShutdownScript_new(int8_tArray script_arg) {
52765         LDKCVec_u8Z script_arg_ref;
52766         script_arg_ref.datalen = script_arg->arr_len;
52767         script_arg_ref.data = MALLOC(script_arg_ref.datalen, "LDKCVec_u8Z Bytes");
52768         memcpy(script_arg_ref.data, script_arg->elems, script_arg_ref.datalen); FREE(script_arg);
52769         LDKInvalidShutdownScript ret_var = InvalidShutdownScript_new(script_arg_ref);
52770         uint64_t ret_ref = 0;
52771         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
52772         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
52773         return ret_ref;
52774 }
52775
52776 static inline uint64_t InvalidShutdownScript_clone_ptr(LDKInvalidShutdownScript *NONNULL_PTR arg) {
52777         LDKInvalidShutdownScript ret_var = InvalidShutdownScript_clone(arg);
52778         uint64_t ret_ref = 0;
52779         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
52780         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
52781         return ret_ref;
52782 }
52783 int64_t  __attribute__((export_name("TS_InvalidShutdownScript_clone_ptr"))) TS_InvalidShutdownScript_clone_ptr(uint64_t arg) {
52784         LDKInvalidShutdownScript arg_conv;
52785         arg_conv.inner = untag_ptr(arg);
52786         arg_conv.is_owned = ptr_is_owned(arg);
52787         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
52788         arg_conv.is_owned = false;
52789         int64_t ret_conv = InvalidShutdownScript_clone_ptr(&arg_conv);
52790         return ret_conv;
52791 }
52792
52793 uint64_t  __attribute__((export_name("TS_InvalidShutdownScript_clone"))) TS_InvalidShutdownScript_clone(uint64_t orig) {
52794         LDKInvalidShutdownScript orig_conv;
52795         orig_conv.inner = untag_ptr(orig);
52796         orig_conv.is_owned = ptr_is_owned(orig);
52797         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
52798         orig_conv.is_owned = false;
52799         LDKInvalidShutdownScript ret_var = InvalidShutdownScript_clone(&orig_conv);
52800         uint64_t ret_ref = 0;
52801         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
52802         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
52803         return ret_ref;
52804 }
52805
52806 int8_tArray  __attribute__((export_name("TS_ShutdownScript_write"))) TS_ShutdownScript_write(uint64_t obj) {
52807         LDKShutdownScript obj_conv;
52808         obj_conv.inner = untag_ptr(obj);
52809         obj_conv.is_owned = ptr_is_owned(obj);
52810         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
52811         obj_conv.is_owned = false;
52812         LDKCVec_u8Z ret_var = ShutdownScript_write(&obj_conv);
52813         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
52814         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
52815         CVec_u8Z_free(ret_var);
52816         return ret_arr;
52817 }
52818
52819 uint64_t  __attribute__((export_name("TS_ShutdownScript_read"))) TS_ShutdownScript_read(int8_tArray ser) {
52820         LDKu8slice ser_ref;
52821         ser_ref.datalen = ser->arr_len;
52822         ser_ref.data = ser->elems;
52823         LDKCResult_ShutdownScriptDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ShutdownScriptDecodeErrorZ), "LDKCResult_ShutdownScriptDecodeErrorZ");
52824         *ret_conv = ShutdownScript_read(ser_ref);
52825         FREE(ser);
52826         return tag_ptr(ret_conv, true);
52827 }
52828
52829 uint64_t  __attribute__((export_name("TS_ShutdownScript_new_p2wpkh"))) TS_ShutdownScript_new_p2wpkh(int8_tArray pubkey_hash) {
52830         uint8_t pubkey_hash_arr[20];
52831         CHECK(pubkey_hash->arr_len == 20);
52832         memcpy(pubkey_hash_arr, pubkey_hash->elems, 20); FREE(pubkey_hash);
52833         uint8_t (*pubkey_hash_ref)[20] = &pubkey_hash_arr;
52834         LDKShutdownScript ret_var = ShutdownScript_new_p2wpkh(pubkey_hash_ref);
52835         uint64_t ret_ref = 0;
52836         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
52837         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
52838         return ret_ref;
52839 }
52840
52841 uint64_t  __attribute__((export_name("TS_ShutdownScript_new_p2wsh"))) TS_ShutdownScript_new_p2wsh(int8_tArray script_hash) {
52842         uint8_t script_hash_arr[32];
52843         CHECK(script_hash->arr_len == 32);
52844         memcpy(script_hash_arr, script_hash->elems, 32); FREE(script_hash);
52845         uint8_t (*script_hash_ref)[32] = &script_hash_arr;
52846         LDKShutdownScript ret_var = ShutdownScript_new_p2wsh(script_hash_ref);
52847         uint64_t ret_ref = 0;
52848         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
52849         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
52850         return ret_ref;
52851 }
52852
52853 uint64_t  __attribute__((export_name("TS_ShutdownScript_new_witness_program"))) TS_ShutdownScript_new_witness_program(int8_t version, int8_tArray program) {
52854         
52855         LDKu8slice program_ref;
52856         program_ref.datalen = program->arr_len;
52857         program_ref.data = program->elems;
52858         LDKCResult_ShutdownScriptInvalidShutdownScriptZ* ret_conv = MALLOC(sizeof(LDKCResult_ShutdownScriptInvalidShutdownScriptZ), "LDKCResult_ShutdownScriptInvalidShutdownScriptZ");
52859         *ret_conv = ShutdownScript_new_witness_program((LDKWitnessVersion){ ._0 = version }, program_ref);
52860         FREE(program);
52861         return tag_ptr(ret_conv, true);
52862 }
52863
52864 int8_tArray  __attribute__((export_name("TS_ShutdownScript_into_inner"))) TS_ShutdownScript_into_inner(uint64_t this_arg) {
52865         LDKShutdownScript this_arg_conv;
52866         this_arg_conv.inner = untag_ptr(this_arg);
52867         this_arg_conv.is_owned = ptr_is_owned(this_arg);
52868         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
52869         this_arg_conv = ShutdownScript_clone(&this_arg_conv);
52870         LDKCVec_u8Z ret_var = ShutdownScript_into_inner(this_arg_conv);
52871         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
52872         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
52873         CVec_u8Z_free(ret_var);
52874         return ret_arr;
52875 }
52876
52877 int8_tArray  __attribute__((export_name("TS_ShutdownScript_as_legacy_pubkey"))) TS_ShutdownScript_as_legacy_pubkey(uint64_t this_arg) {
52878         LDKShutdownScript this_arg_conv;
52879         this_arg_conv.inner = untag_ptr(this_arg);
52880         this_arg_conv.is_owned = ptr_is_owned(this_arg);
52881         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
52882         this_arg_conv.is_owned = false;
52883         int8_tArray ret_arr = init_int8_tArray(33, __LINE__);
52884         memcpy(ret_arr->elems, ShutdownScript_as_legacy_pubkey(&this_arg_conv).compressed_form, 33);
52885         return ret_arr;
52886 }
52887
52888 jboolean  __attribute__((export_name("TS_ShutdownScript_is_compatible"))) TS_ShutdownScript_is_compatible(uint64_t this_arg, uint64_t features) {
52889         LDKShutdownScript this_arg_conv;
52890         this_arg_conv.inner = untag_ptr(this_arg);
52891         this_arg_conv.is_owned = ptr_is_owned(this_arg);
52892         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
52893         this_arg_conv.is_owned = false;
52894         LDKInitFeatures features_conv;
52895         features_conv.inner = untag_ptr(features);
52896         features_conv.is_owned = ptr_is_owned(features);
52897         CHECK_INNER_FIELD_ACCESS_OR_NULL(features_conv);
52898         features_conv.is_owned = false;
52899         jboolean ret_conv = ShutdownScript_is_compatible(&this_arg_conv, &features_conv);
52900         return ret_conv;
52901 }
52902
52903 void  __attribute__((export_name("TS_Retry_free"))) TS_Retry_free(uint64_t this_ptr) {
52904         if (!ptr_is_owned(this_ptr)) return;
52905         void* this_ptr_ptr = untag_ptr(this_ptr);
52906         CHECK_ACCESS(this_ptr_ptr);
52907         LDKRetry this_ptr_conv = *(LDKRetry*)(this_ptr_ptr);
52908         FREE(untag_ptr(this_ptr));
52909         Retry_free(this_ptr_conv);
52910 }
52911
52912 static inline uint64_t Retry_clone_ptr(LDKRetry *NONNULL_PTR arg) {
52913         LDKRetry *ret_copy = MALLOC(sizeof(LDKRetry), "LDKRetry");
52914         *ret_copy = Retry_clone(arg);
52915         uint64_t ret_ref = tag_ptr(ret_copy, true);
52916         return ret_ref;
52917 }
52918 int64_t  __attribute__((export_name("TS_Retry_clone_ptr"))) TS_Retry_clone_ptr(uint64_t arg) {
52919         LDKRetry* arg_conv = (LDKRetry*)untag_ptr(arg);
52920         int64_t ret_conv = Retry_clone_ptr(arg_conv);
52921         return ret_conv;
52922 }
52923
52924 uint64_t  __attribute__((export_name("TS_Retry_clone"))) TS_Retry_clone(uint64_t orig) {
52925         LDKRetry* orig_conv = (LDKRetry*)untag_ptr(orig);
52926         LDKRetry *ret_copy = MALLOC(sizeof(LDKRetry), "LDKRetry");
52927         *ret_copy = Retry_clone(orig_conv);
52928         uint64_t ret_ref = tag_ptr(ret_copy, true);
52929         return ret_ref;
52930 }
52931
52932 uint64_t  __attribute__((export_name("TS_Retry_attempts"))) TS_Retry_attempts(int32_t a) {
52933         LDKRetry *ret_copy = MALLOC(sizeof(LDKRetry), "LDKRetry");
52934         *ret_copy = Retry_attempts(a);
52935         uint64_t ret_ref = tag_ptr(ret_copy, true);
52936         return ret_ref;
52937 }
52938
52939 jboolean  __attribute__((export_name("TS_Retry_eq"))) TS_Retry_eq(uint64_t a, uint64_t b) {
52940         LDKRetry* a_conv = (LDKRetry*)untag_ptr(a);
52941         LDKRetry* b_conv = (LDKRetry*)untag_ptr(b);
52942         jboolean ret_conv = Retry_eq(a_conv, b_conv);
52943         return ret_conv;
52944 }
52945
52946 int64_t  __attribute__((export_name("TS_Retry_hash"))) TS_Retry_hash(uint64_t o) {
52947         LDKRetry* o_conv = (LDKRetry*)untag_ptr(o);
52948         int64_t ret_conv = Retry_hash(o_conv);
52949         return ret_conv;
52950 }
52951
52952 int8_tArray  __attribute__((export_name("TS_Retry_write"))) TS_Retry_write(uint64_t obj) {
52953         LDKRetry* obj_conv = (LDKRetry*)untag_ptr(obj);
52954         LDKCVec_u8Z ret_var = Retry_write(obj_conv);
52955         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
52956         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
52957         CVec_u8Z_free(ret_var);
52958         return ret_arr;
52959 }
52960
52961 uint64_t  __attribute__((export_name("TS_Retry_read"))) TS_Retry_read(int8_tArray ser) {
52962         LDKu8slice ser_ref;
52963         ser_ref.datalen = ser->arr_len;
52964         ser_ref.data = ser->elems;
52965         LDKCResult_RetryDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RetryDecodeErrorZ), "LDKCResult_RetryDecodeErrorZ");
52966         *ret_conv = Retry_read(ser_ref);
52967         FREE(ser);
52968         return tag_ptr(ret_conv, true);
52969 }
52970
52971 uint32_t  __attribute__((export_name("TS_RetryableSendFailure_clone"))) TS_RetryableSendFailure_clone(uint64_t orig) {
52972         LDKRetryableSendFailure* orig_conv = (LDKRetryableSendFailure*)untag_ptr(orig);
52973         uint32_t ret_conv = LDKRetryableSendFailure_to_js(RetryableSendFailure_clone(orig_conv));
52974         return ret_conv;
52975 }
52976
52977 uint32_t  __attribute__((export_name("TS_RetryableSendFailure_payment_expired"))) TS_RetryableSendFailure_payment_expired() {
52978         uint32_t ret_conv = LDKRetryableSendFailure_to_js(RetryableSendFailure_payment_expired());
52979         return ret_conv;
52980 }
52981
52982 uint32_t  __attribute__((export_name("TS_RetryableSendFailure_route_not_found"))) TS_RetryableSendFailure_route_not_found() {
52983         uint32_t ret_conv = LDKRetryableSendFailure_to_js(RetryableSendFailure_route_not_found());
52984         return ret_conv;
52985 }
52986
52987 uint32_t  __attribute__((export_name("TS_RetryableSendFailure_duplicate_payment"))) TS_RetryableSendFailure_duplicate_payment() {
52988         uint32_t ret_conv = LDKRetryableSendFailure_to_js(RetryableSendFailure_duplicate_payment());
52989         return ret_conv;
52990 }
52991
52992 jboolean  __attribute__((export_name("TS_RetryableSendFailure_eq"))) TS_RetryableSendFailure_eq(uint64_t a, uint64_t b) {
52993         LDKRetryableSendFailure* a_conv = (LDKRetryableSendFailure*)untag_ptr(a);
52994         LDKRetryableSendFailure* b_conv = (LDKRetryableSendFailure*)untag_ptr(b);
52995         jboolean ret_conv = RetryableSendFailure_eq(a_conv, b_conv);
52996         return ret_conv;
52997 }
52998
52999 void  __attribute__((export_name("TS_PaymentSendFailure_free"))) TS_PaymentSendFailure_free(uint64_t this_ptr) {
53000         if (!ptr_is_owned(this_ptr)) return;
53001         void* this_ptr_ptr = untag_ptr(this_ptr);
53002         CHECK_ACCESS(this_ptr_ptr);
53003         LDKPaymentSendFailure this_ptr_conv = *(LDKPaymentSendFailure*)(this_ptr_ptr);
53004         FREE(untag_ptr(this_ptr));
53005         PaymentSendFailure_free(this_ptr_conv);
53006 }
53007
53008 static inline uint64_t PaymentSendFailure_clone_ptr(LDKPaymentSendFailure *NONNULL_PTR arg) {
53009         LDKPaymentSendFailure *ret_copy = MALLOC(sizeof(LDKPaymentSendFailure), "LDKPaymentSendFailure");
53010         *ret_copy = PaymentSendFailure_clone(arg);
53011         uint64_t ret_ref = tag_ptr(ret_copy, true);
53012         return ret_ref;
53013 }
53014 int64_t  __attribute__((export_name("TS_PaymentSendFailure_clone_ptr"))) TS_PaymentSendFailure_clone_ptr(uint64_t arg) {
53015         LDKPaymentSendFailure* arg_conv = (LDKPaymentSendFailure*)untag_ptr(arg);
53016         int64_t ret_conv = PaymentSendFailure_clone_ptr(arg_conv);
53017         return ret_conv;
53018 }
53019
53020 uint64_t  __attribute__((export_name("TS_PaymentSendFailure_clone"))) TS_PaymentSendFailure_clone(uint64_t orig) {
53021         LDKPaymentSendFailure* orig_conv = (LDKPaymentSendFailure*)untag_ptr(orig);
53022         LDKPaymentSendFailure *ret_copy = MALLOC(sizeof(LDKPaymentSendFailure), "LDKPaymentSendFailure");
53023         *ret_copy = PaymentSendFailure_clone(orig_conv);
53024         uint64_t ret_ref = tag_ptr(ret_copy, true);
53025         return ret_ref;
53026 }
53027
53028 uint64_t  __attribute__((export_name("TS_PaymentSendFailure_parameter_error"))) TS_PaymentSendFailure_parameter_error(uint64_t a) {
53029         void* a_ptr = untag_ptr(a);
53030         CHECK_ACCESS(a_ptr);
53031         LDKAPIError a_conv = *(LDKAPIError*)(a_ptr);
53032         a_conv = APIError_clone((LDKAPIError*)untag_ptr(a));
53033         LDKPaymentSendFailure *ret_copy = MALLOC(sizeof(LDKPaymentSendFailure), "LDKPaymentSendFailure");
53034         *ret_copy = PaymentSendFailure_parameter_error(a_conv);
53035         uint64_t ret_ref = tag_ptr(ret_copy, true);
53036         return ret_ref;
53037 }
53038
53039 uint64_t  __attribute__((export_name("TS_PaymentSendFailure_path_parameter_error"))) TS_PaymentSendFailure_path_parameter_error(uint64_tArray a) {
53040         LDKCVec_CResult_NoneAPIErrorZZ a_constr;
53041         a_constr.datalen = a->arr_len;
53042         if (a_constr.datalen > 0)
53043                 a_constr.data = MALLOC(a_constr.datalen * sizeof(LDKCResult_NoneAPIErrorZ), "LDKCVec_CResult_NoneAPIErrorZZ Elements");
53044         else
53045                 a_constr.data = NULL;
53046         uint64_t* a_vals = a->elems;
53047         for (size_t w = 0; w < a_constr.datalen; w++) {
53048                 uint64_t a_conv_22 = a_vals[w];
53049                 void* a_conv_22_ptr = untag_ptr(a_conv_22);
53050                 CHECK_ACCESS(a_conv_22_ptr);
53051                 LDKCResult_NoneAPIErrorZ a_conv_22_conv = *(LDKCResult_NoneAPIErrorZ*)(a_conv_22_ptr);
53052                 a_conv_22_conv = CResult_NoneAPIErrorZ_clone((LDKCResult_NoneAPIErrorZ*)untag_ptr(a_conv_22));
53053                 a_constr.data[w] = a_conv_22_conv;
53054         }
53055         FREE(a);
53056         LDKPaymentSendFailure *ret_copy = MALLOC(sizeof(LDKPaymentSendFailure), "LDKPaymentSendFailure");
53057         *ret_copy = PaymentSendFailure_path_parameter_error(a_constr);
53058         uint64_t ret_ref = tag_ptr(ret_copy, true);
53059         return ret_ref;
53060 }
53061
53062 uint64_t  __attribute__((export_name("TS_PaymentSendFailure_all_failed_resend_safe"))) TS_PaymentSendFailure_all_failed_resend_safe(uint64_tArray a) {
53063         LDKCVec_APIErrorZ a_constr;
53064         a_constr.datalen = a->arr_len;
53065         if (a_constr.datalen > 0)
53066                 a_constr.data = MALLOC(a_constr.datalen * sizeof(LDKAPIError), "LDKCVec_APIErrorZ Elements");
53067         else
53068                 a_constr.data = NULL;
53069         uint64_t* a_vals = a->elems;
53070         for (size_t k = 0; k < a_constr.datalen; k++) {
53071                 uint64_t a_conv_10 = a_vals[k];
53072                 void* a_conv_10_ptr = untag_ptr(a_conv_10);
53073                 CHECK_ACCESS(a_conv_10_ptr);
53074                 LDKAPIError a_conv_10_conv = *(LDKAPIError*)(a_conv_10_ptr);
53075                 a_conv_10_conv = APIError_clone((LDKAPIError*)untag_ptr(a_conv_10));
53076                 a_constr.data[k] = a_conv_10_conv;
53077         }
53078         FREE(a);
53079         LDKPaymentSendFailure *ret_copy = MALLOC(sizeof(LDKPaymentSendFailure), "LDKPaymentSendFailure");
53080         *ret_copy = PaymentSendFailure_all_failed_resend_safe(a_constr);
53081         uint64_t ret_ref = tag_ptr(ret_copy, true);
53082         return ret_ref;
53083 }
53084
53085 uint64_t  __attribute__((export_name("TS_PaymentSendFailure_duplicate_payment"))) TS_PaymentSendFailure_duplicate_payment() {
53086         LDKPaymentSendFailure *ret_copy = MALLOC(sizeof(LDKPaymentSendFailure), "LDKPaymentSendFailure");
53087         *ret_copy = PaymentSendFailure_duplicate_payment();
53088         uint64_t ret_ref = tag_ptr(ret_copy, true);
53089         return ret_ref;
53090 }
53091
53092 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) {
53093         LDKCVec_CResult_NoneAPIErrorZZ results_constr;
53094         results_constr.datalen = results->arr_len;
53095         if (results_constr.datalen > 0)
53096                 results_constr.data = MALLOC(results_constr.datalen * sizeof(LDKCResult_NoneAPIErrorZ), "LDKCVec_CResult_NoneAPIErrorZZ Elements");
53097         else
53098                 results_constr.data = NULL;
53099         uint64_t* results_vals = results->elems;
53100         for (size_t w = 0; w < results_constr.datalen; w++) {
53101                 uint64_t results_conv_22 = results_vals[w];
53102                 void* results_conv_22_ptr = untag_ptr(results_conv_22);
53103                 CHECK_ACCESS(results_conv_22_ptr);
53104                 LDKCResult_NoneAPIErrorZ results_conv_22_conv = *(LDKCResult_NoneAPIErrorZ*)(results_conv_22_ptr);
53105                 results_constr.data[w] = results_conv_22_conv;
53106         }
53107         FREE(results);
53108         LDKRouteParameters failed_paths_retry_conv;
53109         failed_paths_retry_conv.inner = untag_ptr(failed_paths_retry);
53110         failed_paths_retry_conv.is_owned = ptr_is_owned(failed_paths_retry);
53111         CHECK_INNER_FIELD_ACCESS_OR_NULL(failed_paths_retry_conv);
53112         failed_paths_retry_conv = RouteParameters_clone(&failed_paths_retry_conv);
53113         LDKThirtyTwoBytes payment_id_ref;
53114         CHECK(payment_id->arr_len == 32);
53115         memcpy(payment_id_ref.data, payment_id->elems, 32); FREE(payment_id);
53116         LDKPaymentSendFailure *ret_copy = MALLOC(sizeof(LDKPaymentSendFailure), "LDKPaymentSendFailure");
53117         *ret_copy = PaymentSendFailure_partial_failure(results_constr, failed_paths_retry_conv, payment_id_ref);
53118         uint64_t ret_ref = tag_ptr(ret_copy, true);
53119         return ret_ref;
53120 }
53121
53122 jboolean  __attribute__((export_name("TS_PaymentSendFailure_eq"))) TS_PaymentSendFailure_eq(uint64_t a, uint64_t b) {
53123         LDKPaymentSendFailure* a_conv = (LDKPaymentSendFailure*)untag_ptr(a);
53124         LDKPaymentSendFailure* b_conv = (LDKPaymentSendFailure*)untag_ptr(b);
53125         jboolean ret_conv = PaymentSendFailure_eq(a_conv, b_conv);
53126         return ret_conv;
53127 }
53128
53129 void  __attribute__((export_name("TS_ProbeSendFailure_free"))) TS_ProbeSendFailure_free(uint64_t this_ptr) {
53130         if (!ptr_is_owned(this_ptr)) return;
53131         void* this_ptr_ptr = untag_ptr(this_ptr);
53132         CHECK_ACCESS(this_ptr_ptr);
53133         LDKProbeSendFailure this_ptr_conv = *(LDKProbeSendFailure*)(this_ptr_ptr);
53134         FREE(untag_ptr(this_ptr));
53135         ProbeSendFailure_free(this_ptr_conv);
53136 }
53137
53138 static inline uint64_t ProbeSendFailure_clone_ptr(LDKProbeSendFailure *NONNULL_PTR arg) {
53139         LDKProbeSendFailure *ret_copy = MALLOC(sizeof(LDKProbeSendFailure), "LDKProbeSendFailure");
53140         *ret_copy = ProbeSendFailure_clone(arg);
53141         uint64_t ret_ref = tag_ptr(ret_copy, true);
53142         return ret_ref;
53143 }
53144 int64_t  __attribute__((export_name("TS_ProbeSendFailure_clone_ptr"))) TS_ProbeSendFailure_clone_ptr(uint64_t arg) {
53145         LDKProbeSendFailure* arg_conv = (LDKProbeSendFailure*)untag_ptr(arg);
53146         int64_t ret_conv = ProbeSendFailure_clone_ptr(arg_conv);
53147         return ret_conv;
53148 }
53149
53150 uint64_t  __attribute__((export_name("TS_ProbeSendFailure_clone"))) TS_ProbeSendFailure_clone(uint64_t orig) {
53151         LDKProbeSendFailure* orig_conv = (LDKProbeSendFailure*)untag_ptr(orig);
53152         LDKProbeSendFailure *ret_copy = MALLOC(sizeof(LDKProbeSendFailure), "LDKProbeSendFailure");
53153         *ret_copy = ProbeSendFailure_clone(orig_conv);
53154         uint64_t ret_ref = tag_ptr(ret_copy, true);
53155         return ret_ref;
53156 }
53157
53158 uint64_t  __attribute__((export_name("TS_ProbeSendFailure_route_not_found"))) TS_ProbeSendFailure_route_not_found() {
53159         LDKProbeSendFailure *ret_copy = MALLOC(sizeof(LDKProbeSendFailure), "LDKProbeSendFailure");
53160         *ret_copy = ProbeSendFailure_route_not_found();
53161         uint64_t ret_ref = tag_ptr(ret_copy, true);
53162         return ret_ref;
53163 }
53164
53165 uint64_t  __attribute__((export_name("TS_ProbeSendFailure_sending_failed"))) TS_ProbeSendFailure_sending_failed(uint64_t a) {
53166         void* a_ptr = untag_ptr(a);
53167         CHECK_ACCESS(a_ptr);
53168         LDKPaymentSendFailure a_conv = *(LDKPaymentSendFailure*)(a_ptr);
53169         a_conv = PaymentSendFailure_clone((LDKPaymentSendFailure*)untag_ptr(a));
53170         LDKProbeSendFailure *ret_copy = MALLOC(sizeof(LDKProbeSendFailure), "LDKProbeSendFailure");
53171         *ret_copy = ProbeSendFailure_sending_failed(a_conv);
53172         uint64_t ret_ref = tag_ptr(ret_copy, true);
53173         return ret_ref;
53174 }
53175
53176 jboolean  __attribute__((export_name("TS_ProbeSendFailure_eq"))) TS_ProbeSendFailure_eq(uint64_t a, uint64_t b) {
53177         LDKProbeSendFailure* a_conv = (LDKProbeSendFailure*)untag_ptr(a);
53178         LDKProbeSendFailure* b_conv = (LDKProbeSendFailure*)untag_ptr(b);
53179         jboolean ret_conv = ProbeSendFailure_eq(a_conv, b_conv);
53180         return ret_conv;
53181 }
53182
53183 void  __attribute__((export_name("TS_RecipientOnionFields_free"))) TS_RecipientOnionFields_free(uint64_t this_obj) {
53184         LDKRecipientOnionFields this_obj_conv;
53185         this_obj_conv.inner = untag_ptr(this_obj);
53186         this_obj_conv.is_owned = ptr_is_owned(this_obj);
53187         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
53188         RecipientOnionFields_free(this_obj_conv);
53189 }
53190
53191 uint64_t  __attribute__((export_name("TS_RecipientOnionFields_get_payment_secret"))) TS_RecipientOnionFields_get_payment_secret(uint64_t this_ptr) {
53192         LDKRecipientOnionFields this_ptr_conv;
53193         this_ptr_conv.inner = untag_ptr(this_ptr);
53194         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
53195         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
53196         this_ptr_conv.is_owned = false;
53197         LDKCOption_ThirtyTwoBytesZ *ret_copy = MALLOC(sizeof(LDKCOption_ThirtyTwoBytesZ), "LDKCOption_ThirtyTwoBytesZ");
53198         *ret_copy = RecipientOnionFields_get_payment_secret(&this_ptr_conv);
53199         uint64_t ret_ref = tag_ptr(ret_copy, true);
53200         return ret_ref;
53201 }
53202
53203 void  __attribute__((export_name("TS_RecipientOnionFields_set_payment_secret"))) TS_RecipientOnionFields_set_payment_secret(uint64_t this_ptr, uint64_t val) {
53204         LDKRecipientOnionFields this_ptr_conv;
53205         this_ptr_conv.inner = untag_ptr(this_ptr);
53206         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
53207         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
53208         this_ptr_conv.is_owned = false;
53209         void* val_ptr = untag_ptr(val);
53210         CHECK_ACCESS(val_ptr);
53211         LDKCOption_ThirtyTwoBytesZ val_conv = *(LDKCOption_ThirtyTwoBytesZ*)(val_ptr);
53212         val_conv = COption_ThirtyTwoBytesZ_clone((LDKCOption_ThirtyTwoBytesZ*)untag_ptr(val));
53213         RecipientOnionFields_set_payment_secret(&this_ptr_conv, val_conv);
53214 }
53215
53216 uint64_t  __attribute__((export_name("TS_RecipientOnionFields_get_payment_metadata"))) TS_RecipientOnionFields_get_payment_metadata(uint64_t this_ptr) {
53217         LDKRecipientOnionFields this_ptr_conv;
53218         this_ptr_conv.inner = untag_ptr(this_ptr);
53219         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
53220         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
53221         this_ptr_conv.is_owned = false;
53222         LDKCOption_CVec_u8ZZ *ret_copy = MALLOC(sizeof(LDKCOption_CVec_u8ZZ), "LDKCOption_CVec_u8ZZ");
53223         *ret_copy = RecipientOnionFields_get_payment_metadata(&this_ptr_conv);
53224         uint64_t ret_ref = tag_ptr(ret_copy, true);
53225         return ret_ref;
53226 }
53227
53228 void  __attribute__((export_name("TS_RecipientOnionFields_set_payment_metadata"))) TS_RecipientOnionFields_set_payment_metadata(uint64_t this_ptr, uint64_t val) {
53229         LDKRecipientOnionFields this_ptr_conv;
53230         this_ptr_conv.inner = untag_ptr(this_ptr);
53231         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
53232         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
53233         this_ptr_conv.is_owned = false;
53234         void* val_ptr = untag_ptr(val);
53235         CHECK_ACCESS(val_ptr);
53236         LDKCOption_CVec_u8ZZ val_conv = *(LDKCOption_CVec_u8ZZ*)(val_ptr);
53237         val_conv = COption_CVec_u8ZZ_clone((LDKCOption_CVec_u8ZZ*)untag_ptr(val));
53238         RecipientOnionFields_set_payment_metadata(&this_ptr_conv, val_conv);
53239 }
53240
53241 static inline uint64_t RecipientOnionFields_clone_ptr(LDKRecipientOnionFields *NONNULL_PTR arg) {
53242         LDKRecipientOnionFields ret_var = RecipientOnionFields_clone(arg);
53243         uint64_t ret_ref = 0;
53244         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
53245         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
53246         return ret_ref;
53247 }
53248 int64_t  __attribute__((export_name("TS_RecipientOnionFields_clone_ptr"))) TS_RecipientOnionFields_clone_ptr(uint64_t arg) {
53249         LDKRecipientOnionFields arg_conv;
53250         arg_conv.inner = untag_ptr(arg);
53251         arg_conv.is_owned = ptr_is_owned(arg);
53252         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
53253         arg_conv.is_owned = false;
53254         int64_t ret_conv = RecipientOnionFields_clone_ptr(&arg_conv);
53255         return ret_conv;
53256 }
53257
53258 uint64_t  __attribute__((export_name("TS_RecipientOnionFields_clone"))) TS_RecipientOnionFields_clone(uint64_t orig) {
53259         LDKRecipientOnionFields orig_conv;
53260         orig_conv.inner = untag_ptr(orig);
53261         orig_conv.is_owned = ptr_is_owned(orig);
53262         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
53263         orig_conv.is_owned = false;
53264         LDKRecipientOnionFields ret_var = RecipientOnionFields_clone(&orig_conv);
53265         uint64_t ret_ref = 0;
53266         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
53267         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
53268         return ret_ref;
53269 }
53270
53271 jboolean  __attribute__((export_name("TS_RecipientOnionFields_eq"))) TS_RecipientOnionFields_eq(uint64_t a, uint64_t b) {
53272         LDKRecipientOnionFields a_conv;
53273         a_conv.inner = untag_ptr(a);
53274         a_conv.is_owned = ptr_is_owned(a);
53275         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
53276         a_conv.is_owned = false;
53277         LDKRecipientOnionFields b_conv;
53278         b_conv.inner = untag_ptr(b);
53279         b_conv.is_owned = ptr_is_owned(b);
53280         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
53281         b_conv.is_owned = false;
53282         jboolean ret_conv = RecipientOnionFields_eq(&a_conv, &b_conv);
53283         return ret_conv;
53284 }
53285
53286 int8_tArray  __attribute__((export_name("TS_RecipientOnionFields_write"))) TS_RecipientOnionFields_write(uint64_t obj) {
53287         LDKRecipientOnionFields obj_conv;
53288         obj_conv.inner = untag_ptr(obj);
53289         obj_conv.is_owned = ptr_is_owned(obj);
53290         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
53291         obj_conv.is_owned = false;
53292         LDKCVec_u8Z ret_var = RecipientOnionFields_write(&obj_conv);
53293         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
53294         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
53295         CVec_u8Z_free(ret_var);
53296         return ret_arr;
53297 }
53298
53299 uint64_t  __attribute__((export_name("TS_RecipientOnionFields_read"))) TS_RecipientOnionFields_read(int8_tArray ser) {
53300         LDKu8slice ser_ref;
53301         ser_ref.datalen = ser->arr_len;
53302         ser_ref.data = ser->elems;
53303         LDKCResult_RecipientOnionFieldsDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RecipientOnionFieldsDecodeErrorZ), "LDKCResult_RecipientOnionFieldsDecodeErrorZ");
53304         *ret_conv = RecipientOnionFields_read(ser_ref);
53305         FREE(ser);
53306         return tag_ptr(ret_conv, true);
53307 }
53308
53309 uint64_t  __attribute__((export_name("TS_RecipientOnionFields_secret_only"))) TS_RecipientOnionFields_secret_only(int8_tArray payment_secret) {
53310         LDKThirtyTwoBytes payment_secret_ref;
53311         CHECK(payment_secret->arr_len == 32);
53312         memcpy(payment_secret_ref.data, payment_secret->elems, 32); FREE(payment_secret);
53313         LDKRecipientOnionFields ret_var = RecipientOnionFields_secret_only(payment_secret_ref);
53314         uint64_t ret_ref = 0;
53315         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
53316         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
53317         return ret_ref;
53318 }
53319
53320 uint64_t  __attribute__((export_name("TS_RecipientOnionFields_spontaneous_empty"))) TS_RecipientOnionFields_spontaneous_empty() {
53321         LDKRecipientOnionFields ret_var = RecipientOnionFields_spontaneous_empty();
53322         uint64_t ret_ref = 0;
53323         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
53324         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
53325         return ret_ref;
53326 }
53327
53328 uint64_t  __attribute__((export_name("TS_RecipientOnionFields_with_custom_tlvs"))) TS_RecipientOnionFields_with_custom_tlvs(uint64_t this_arg, uint64_tArray custom_tlvs) {
53329         LDKRecipientOnionFields this_arg_conv;
53330         this_arg_conv.inner = untag_ptr(this_arg);
53331         this_arg_conv.is_owned = ptr_is_owned(this_arg);
53332         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
53333         this_arg_conv = RecipientOnionFields_clone(&this_arg_conv);
53334         LDKCVec_C2Tuple_u64CVec_u8ZZZ custom_tlvs_constr;
53335         custom_tlvs_constr.datalen = custom_tlvs->arr_len;
53336         if (custom_tlvs_constr.datalen > 0)
53337                 custom_tlvs_constr.data = MALLOC(custom_tlvs_constr.datalen * sizeof(LDKC2Tuple_u64CVec_u8ZZ), "LDKCVec_C2Tuple_u64CVec_u8ZZZ Elements");
53338         else
53339                 custom_tlvs_constr.data = NULL;
53340         uint64_t* custom_tlvs_vals = custom_tlvs->elems;
53341         for (size_t x = 0; x < custom_tlvs_constr.datalen; x++) {
53342                 uint64_t custom_tlvs_conv_23 = custom_tlvs_vals[x];
53343                 void* custom_tlvs_conv_23_ptr = untag_ptr(custom_tlvs_conv_23);
53344                 CHECK_ACCESS(custom_tlvs_conv_23_ptr);
53345                 LDKC2Tuple_u64CVec_u8ZZ custom_tlvs_conv_23_conv = *(LDKC2Tuple_u64CVec_u8ZZ*)(custom_tlvs_conv_23_ptr);
53346                 custom_tlvs_conv_23_conv = C2Tuple_u64CVec_u8ZZ_clone((LDKC2Tuple_u64CVec_u8ZZ*)untag_ptr(custom_tlvs_conv_23));
53347                 custom_tlvs_constr.data[x] = custom_tlvs_conv_23_conv;
53348         }
53349         FREE(custom_tlvs);
53350         LDKCResult_RecipientOnionFieldsNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_RecipientOnionFieldsNoneZ), "LDKCResult_RecipientOnionFieldsNoneZ");
53351         *ret_conv = RecipientOnionFields_with_custom_tlvs(this_arg_conv, custom_tlvs_constr);
53352         return tag_ptr(ret_conv, true);
53353 }
53354
53355 uint64_tArray  __attribute__((export_name("TS_RecipientOnionFields_custom_tlvs"))) TS_RecipientOnionFields_custom_tlvs(uint64_t this_arg) {
53356         LDKRecipientOnionFields this_arg_conv;
53357         this_arg_conv.inner = untag_ptr(this_arg);
53358         this_arg_conv.is_owned = ptr_is_owned(this_arg);
53359         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
53360         this_arg_conv.is_owned = false;
53361         LDKCVec_C2Tuple_u64CVec_u8ZZZ ret_var = RecipientOnionFields_custom_tlvs(&this_arg_conv);
53362         uint64_tArray ret_arr = NULL;
53363         ret_arr = init_uint64_tArray(ret_var.datalen, __LINE__);
53364         uint64_t *ret_arr_ptr = (uint64_t*)(((uint8_t*)ret_arr) + 8);
53365         for (size_t x = 0; x < ret_var.datalen; x++) {
53366                 LDKC2Tuple_u64CVec_u8ZZ* ret_conv_23_conv = MALLOC(sizeof(LDKC2Tuple_u64CVec_u8ZZ), "LDKC2Tuple_u64CVec_u8ZZ");
53367                 *ret_conv_23_conv = ret_var.data[x];
53368                 ret_arr_ptr[x] = tag_ptr(ret_conv_23_conv, true);
53369         }
53370         
53371         FREE(ret_var.data);
53372         return ret_arr;
53373 }
53374
53375 void  __attribute__((export_name("TS_CustomMessageReader_free"))) TS_CustomMessageReader_free(uint64_t this_ptr) {
53376         if (!ptr_is_owned(this_ptr)) return;
53377         void* this_ptr_ptr = untag_ptr(this_ptr);
53378         CHECK_ACCESS(this_ptr_ptr);
53379         LDKCustomMessageReader this_ptr_conv = *(LDKCustomMessageReader*)(this_ptr_ptr);
53380         FREE(untag_ptr(this_ptr));
53381         CustomMessageReader_free(this_ptr_conv);
53382 }
53383
53384 static inline uint64_t Type_clone_ptr(LDKType *NONNULL_PTR arg) {
53385         LDKType* ret_ret = MALLOC(sizeof(LDKType), "LDKType");
53386         *ret_ret = Type_clone(arg);
53387         return tag_ptr(ret_ret, true);
53388 }
53389 int64_t  __attribute__((export_name("TS_Type_clone_ptr"))) TS_Type_clone_ptr(uint64_t arg) {
53390         void* arg_ptr = untag_ptr(arg);
53391         if (ptr_is_owned(arg)) { CHECK_ACCESS(arg_ptr); }
53392         LDKType* arg_conv = (LDKType*)arg_ptr;
53393         int64_t ret_conv = Type_clone_ptr(arg_conv);
53394         return ret_conv;
53395 }
53396
53397 uint64_t  __attribute__((export_name("TS_Type_clone"))) TS_Type_clone(uint64_t orig) {
53398         void* orig_ptr = untag_ptr(orig);
53399         if (ptr_is_owned(orig)) { CHECK_ACCESS(orig_ptr); }
53400         LDKType* orig_conv = (LDKType*)orig_ptr;
53401         LDKType* ret_ret = MALLOC(sizeof(LDKType), "LDKType");
53402         *ret_ret = Type_clone(orig_conv);
53403         return tag_ptr(ret_ret, true);
53404 }
53405
53406 void  __attribute__((export_name("TS_Type_free"))) TS_Type_free(uint64_t this_ptr) {
53407         if (!ptr_is_owned(this_ptr)) return;
53408         void* this_ptr_ptr = untag_ptr(this_ptr);
53409         CHECK_ACCESS(this_ptr_ptr);
53410         LDKType this_ptr_conv = *(LDKType*)(this_ptr_ptr);
53411         FREE(untag_ptr(this_ptr));
53412         Type_free(this_ptr_conv);
53413 }
53414
53415 void  __attribute__((export_name("TS_Offer_free"))) TS_Offer_free(uint64_t this_obj) {
53416         LDKOffer this_obj_conv;
53417         this_obj_conv.inner = untag_ptr(this_obj);
53418         this_obj_conv.is_owned = ptr_is_owned(this_obj);
53419         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
53420         Offer_free(this_obj_conv);
53421 }
53422
53423 static inline uint64_t Offer_clone_ptr(LDKOffer *NONNULL_PTR arg) {
53424         LDKOffer ret_var = Offer_clone(arg);
53425         uint64_t ret_ref = 0;
53426         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
53427         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
53428         return ret_ref;
53429 }
53430 int64_t  __attribute__((export_name("TS_Offer_clone_ptr"))) TS_Offer_clone_ptr(uint64_t arg) {
53431         LDKOffer arg_conv;
53432         arg_conv.inner = untag_ptr(arg);
53433         arg_conv.is_owned = ptr_is_owned(arg);
53434         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
53435         arg_conv.is_owned = false;
53436         int64_t ret_conv = Offer_clone_ptr(&arg_conv);
53437         return ret_conv;
53438 }
53439
53440 uint64_t  __attribute__((export_name("TS_Offer_clone"))) TS_Offer_clone(uint64_t orig) {
53441         LDKOffer orig_conv;
53442         orig_conv.inner = untag_ptr(orig);
53443         orig_conv.is_owned = ptr_is_owned(orig);
53444         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
53445         orig_conv.is_owned = false;
53446         LDKOffer ret_var = Offer_clone(&orig_conv);
53447         uint64_t ret_ref = 0;
53448         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
53449         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
53450         return ret_ref;
53451 }
53452
53453 ptrArray  __attribute__((export_name("TS_Offer_chains"))) TS_Offer_chains(uint64_t this_arg) {
53454         LDKOffer this_arg_conv;
53455         this_arg_conv.inner = untag_ptr(this_arg);
53456         this_arg_conv.is_owned = ptr_is_owned(this_arg);
53457         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
53458         this_arg_conv.is_owned = false;
53459         LDKCVec_ThirtyTwoBytesZ ret_var = Offer_chains(&this_arg_conv);
53460         ptrArray ret_arr = NULL;
53461         ret_arr = init_ptrArray(ret_var.datalen, __LINE__);
53462         int8_tArray *ret_arr_ptr = (int8_tArray*)(((uint8_t*)ret_arr) + 8);
53463         for (size_t m = 0; m < ret_var.datalen; m++) {
53464                 int8_tArray ret_conv_12_arr = init_int8_tArray(32, __LINE__);
53465                 memcpy(ret_conv_12_arr->elems, ret_var.data[m].data, 32);
53466                 ret_arr_ptr[m] = ret_conv_12_arr;
53467         }
53468         
53469         FREE(ret_var.data);
53470         return ret_arr;
53471 }
53472
53473 uint64_t  __attribute__((export_name("TS_Offer_metadata"))) TS_Offer_metadata(uint64_t this_arg) {
53474         LDKOffer this_arg_conv;
53475         this_arg_conv.inner = untag_ptr(this_arg);
53476         this_arg_conv.is_owned = ptr_is_owned(this_arg);
53477         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
53478         this_arg_conv.is_owned = false;
53479         LDKCOption_CVec_u8ZZ *ret_copy = MALLOC(sizeof(LDKCOption_CVec_u8ZZ), "LDKCOption_CVec_u8ZZ");
53480         *ret_copy = Offer_metadata(&this_arg_conv);
53481         uint64_t ret_ref = tag_ptr(ret_copy, true);
53482         return ret_ref;
53483 }
53484
53485 uint64_t  __attribute__((export_name("TS_Offer_amount"))) TS_Offer_amount(uint64_t this_arg) {
53486         LDKOffer this_arg_conv;
53487         this_arg_conv.inner = untag_ptr(this_arg);
53488         this_arg_conv.is_owned = ptr_is_owned(this_arg);
53489         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
53490         this_arg_conv.is_owned = false;
53491         LDKAmount ret_var = Offer_amount(&this_arg_conv);
53492         uint64_t ret_ref = 0;
53493         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
53494         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
53495         return ret_ref;
53496 }
53497
53498 uint64_t  __attribute__((export_name("TS_Offer_description"))) TS_Offer_description(uint64_t this_arg) {
53499         LDKOffer this_arg_conv;
53500         this_arg_conv.inner = untag_ptr(this_arg);
53501         this_arg_conv.is_owned = ptr_is_owned(this_arg);
53502         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
53503         this_arg_conv.is_owned = false;
53504         LDKPrintableString ret_var = Offer_description(&this_arg_conv);
53505         uint64_t ret_ref = 0;
53506         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
53507         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
53508         return ret_ref;
53509 }
53510
53511 uint64_t  __attribute__((export_name("TS_Offer_offer_features"))) TS_Offer_offer_features(uint64_t this_arg) {
53512         LDKOffer this_arg_conv;
53513         this_arg_conv.inner = untag_ptr(this_arg);
53514         this_arg_conv.is_owned = ptr_is_owned(this_arg);
53515         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
53516         this_arg_conv.is_owned = false;
53517         LDKOfferFeatures ret_var = Offer_offer_features(&this_arg_conv);
53518         uint64_t ret_ref = 0;
53519         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
53520         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
53521         return ret_ref;
53522 }
53523
53524 uint64_t  __attribute__((export_name("TS_Offer_absolute_expiry"))) TS_Offer_absolute_expiry(uint64_t this_arg) {
53525         LDKOffer this_arg_conv;
53526         this_arg_conv.inner = untag_ptr(this_arg);
53527         this_arg_conv.is_owned = ptr_is_owned(this_arg);
53528         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
53529         this_arg_conv.is_owned = false;
53530         LDKCOption_u64Z *ret_copy = MALLOC(sizeof(LDKCOption_u64Z), "LDKCOption_u64Z");
53531         *ret_copy = Offer_absolute_expiry(&this_arg_conv);
53532         uint64_t ret_ref = tag_ptr(ret_copy, true);
53533         return ret_ref;
53534 }
53535
53536 uint64_t  __attribute__((export_name("TS_Offer_issuer"))) TS_Offer_issuer(uint64_t this_arg) {
53537         LDKOffer this_arg_conv;
53538         this_arg_conv.inner = untag_ptr(this_arg);
53539         this_arg_conv.is_owned = ptr_is_owned(this_arg);
53540         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
53541         this_arg_conv.is_owned = false;
53542         LDKPrintableString ret_var = Offer_issuer(&this_arg_conv);
53543         uint64_t ret_ref = 0;
53544         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
53545         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
53546         return ret_ref;
53547 }
53548
53549 uint64_tArray  __attribute__((export_name("TS_Offer_paths"))) TS_Offer_paths(uint64_t this_arg) {
53550         LDKOffer this_arg_conv;
53551         this_arg_conv.inner = untag_ptr(this_arg);
53552         this_arg_conv.is_owned = ptr_is_owned(this_arg);
53553         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
53554         this_arg_conv.is_owned = false;
53555         LDKCVec_BlindedPathZ ret_var = Offer_paths(&this_arg_conv);
53556         uint64_tArray ret_arr = NULL;
53557         ret_arr = init_uint64_tArray(ret_var.datalen, __LINE__);
53558         uint64_t *ret_arr_ptr = (uint64_t*)(((uint8_t*)ret_arr) + 8);
53559         for (size_t n = 0; n < ret_var.datalen; n++) {
53560                 LDKBlindedPath ret_conv_13_var = ret_var.data[n];
53561                 uint64_t ret_conv_13_ref = 0;
53562                 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_conv_13_var);
53563                 ret_conv_13_ref = tag_ptr(ret_conv_13_var.inner, ret_conv_13_var.is_owned);
53564                 ret_arr_ptr[n] = ret_conv_13_ref;
53565         }
53566         
53567         FREE(ret_var.data);
53568         return ret_arr;
53569 }
53570
53571 uint64_t  __attribute__((export_name("TS_Offer_supported_quantity"))) TS_Offer_supported_quantity(uint64_t this_arg) {
53572         LDKOffer this_arg_conv;
53573         this_arg_conv.inner = untag_ptr(this_arg);
53574         this_arg_conv.is_owned = ptr_is_owned(this_arg);
53575         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
53576         this_arg_conv.is_owned = false;
53577         LDKQuantity ret_var = Offer_supported_quantity(&this_arg_conv);
53578         uint64_t ret_ref = 0;
53579         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
53580         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
53581         return ret_ref;
53582 }
53583
53584 int8_tArray  __attribute__((export_name("TS_Offer_signing_pubkey"))) TS_Offer_signing_pubkey(uint64_t this_arg) {
53585         LDKOffer this_arg_conv;
53586         this_arg_conv.inner = untag_ptr(this_arg);
53587         this_arg_conv.is_owned = ptr_is_owned(this_arg);
53588         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
53589         this_arg_conv.is_owned = false;
53590         int8_tArray ret_arr = init_int8_tArray(33, __LINE__);
53591         memcpy(ret_arr->elems, Offer_signing_pubkey(&this_arg_conv).compressed_form, 33);
53592         return ret_arr;
53593 }
53594
53595 jboolean  __attribute__((export_name("TS_Offer_supports_chain"))) TS_Offer_supports_chain(uint64_t this_arg, int8_tArray chain) {
53596         LDKOffer this_arg_conv;
53597         this_arg_conv.inner = untag_ptr(this_arg);
53598         this_arg_conv.is_owned = ptr_is_owned(this_arg);
53599         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
53600         this_arg_conv.is_owned = false;
53601         LDKThirtyTwoBytes chain_ref;
53602         CHECK(chain->arr_len == 32);
53603         memcpy(chain_ref.data, chain->elems, 32); FREE(chain);
53604         jboolean ret_conv = Offer_supports_chain(&this_arg_conv, chain_ref);
53605         return ret_conv;
53606 }
53607
53608 jboolean  __attribute__((export_name("TS_Offer_is_valid_quantity"))) TS_Offer_is_valid_quantity(uint64_t this_arg, int64_t quantity) {
53609         LDKOffer this_arg_conv;
53610         this_arg_conv.inner = untag_ptr(this_arg);
53611         this_arg_conv.is_owned = ptr_is_owned(this_arg);
53612         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
53613         this_arg_conv.is_owned = false;
53614         jboolean ret_conv = Offer_is_valid_quantity(&this_arg_conv, quantity);
53615         return ret_conv;
53616 }
53617
53618 jboolean  __attribute__((export_name("TS_Offer_expects_quantity"))) TS_Offer_expects_quantity(uint64_t this_arg) {
53619         LDKOffer this_arg_conv;
53620         this_arg_conv.inner = untag_ptr(this_arg);
53621         this_arg_conv.is_owned = ptr_is_owned(this_arg);
53622         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
53623         this_arg_conv.is_owned = false;
53624         jboolean ret_conv = Offer_expects_quantity(&this_arg_conv);
53625         return ret_conv;
53626 }
53627
53628 int8_tArray  __attribute__((export_name("TS_Offer_write"))) TS_Offer_write(uint64_t obj) {
53629         LDKOffer obj_conv;
53630         obj_conv.inner = untag_ptr(obj);
53631         obj_conv.is_owned = ptr_is_owned(obj);
53632         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
53633         obj_conv.is_owned = false;
53634         LDKCVec_u8Z ret_var = Offer_write(&obj_conv);
53635         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
53636         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
53637         CVec_u8Z_free(ret_var);
53638         return ret_arr;
53639 }
53640
53641 void  __attribute__((export_name("TS_Amount_free"))) TS_Amount_free(uint64_t this_obj) {
53642         LDKAmount this_obj_conv;
53643         this_obj_conv.inner = untag_ptr(this_obj);
53644         this_obj_conv.is_owned = ptr_is_owned(this_obj);
53645         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
53646         Amount_free(this_obj_conv);
53647 }
53648
53649 static inline uint64_t Amount_clone_ptr(LDKAmount *NONNULL_PTR arg) {
53650         LDKAmount ret_var = Amount_clone(arg);
53651         uint64_t ret_ref = 0;
53652         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
53653         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
53654         return ret_ref;
53655 }
53656 int64_t  __attribute__((export_name("TS_Amount_clone_ptr"))) TS_Amount_clone_ptr(uint64_t arg) {
53657         LDKAmount arg_conv;
53658         arg_conv.inner = untag_ptr(arg);
53659         arg_conv.is_owned = ptr_is_owned(arg);
53660         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
53661         arg_conv.is_owned = false;
53662         int64_t ret_conv = Amount_clone_ptr(&arg_conv);
53663         return ret_conv;
53664 }
53665
53666 uint64_t  __attribute__((export_name("TS_Amount_clone"))) TS_Amount_clone(uint64_t orig) {
53667         LDKAmount orig_conv;
53668         orig_conv.inner = untag_ptr(orig);
53669         orig_conv.is_owned = ptr_is_owned(orig);
53670         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
53671         orig_conv.is_owned = false;
53672         LDKAmount ret_var = Amount_clone(&orig_conv);
53673         uint64_t ret_ref = 0;
53674         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
53675         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
53676         return ret_ref;
53677 }
53678
53679 void  __attribute__((export_name("TS_Quantity_free"))) TS_Quantity_free(uint64_t this_obj) {
53680         LDKQuantity this_obj_conv;
53681         this_obj_conv.inner = untag_ptr(this_obj);
53682         this_obj_conv.is_owned = ptr_is_owned(this_obj);
53683         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
53684         Quantity_free(this_obj_conv);
53685 }
53686
53687 static inline uint64_t Quantity_clone_ptr(LDKQuantity *NONNULL_PTR arg) {
53688         LDKQuantity ret_var = Quantity_clone(arg);
53689         uint64_t ret_ref = 0;
53690         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
53691         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
53692         return ret_ref;
53693 }
53694 int64_t  __attribute__((export_name("TS_Quantity_clone_ptr"))) TS_Quantity_clone_ptr(uint64_t arg) {
53695         LDKQuantity arg_conv;
53696         arg_conv.inner = untag_ptr(arg);
53697         arg_conv.is_owned = ptr_is_owned(arg);
53698         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
53699         arg_conv.is_owned = false;
53700         int64_t ret_conv = Quantity_clone_ptr(&arg_conv);
53701         return ret_conv;
53702 }
53703
53704 uint64_t  __attribute__((export_name("TS_Quantity_clone"))) TS_Quantity_clone(uint64_t orig) {
53705         LDKQuantity orig_conv;
53706         orig_conv.inner = untag_ptr(orig);
53707         orig_conv.is_owned = ptr_is_owned(orig);
53708         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
53709         orig_conv.is_owned = false;
53710         LDKQuantity ret_var = Quantity_clone(&orig_conv);
53711         uint64_t ret_ref = 0;
53712         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
53713         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
53714         return ret_ref;
53715 }
53716
53717 uint64_t  __attribute__((export_name("TS_Offer_from_str"))) TS_Offer_from_str(jstring s) {
53718         LDKStr s_conv = str_ref_to_owned_c(s);
53719         LDKCResult_OfferBolt12ParseErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_OfferBolt12ParseErrorZ), "LDKCResult_OfferBolt12ParseErrorZ");
53720         *ret_conv = Offer_from_str(s_conv);
53721         return tag_ptr(ret_conv, true);
53722 }
53723
53724 void  __attribute__((export_name("TS_UnsignedBolt12Invoice_free"))) TS_UnsignedBolt12Invoice_free(uint64_t this_obj) {
53725         LDKUnsignedBolt12Invoice this_obj_conv;
53726         this_obj_conv.inner = untag_ptr(this_obj);
53727         this_obj_conv.is_owned = ptr_is_owned(this_obj);
53728         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
53729         UnsignedBolt12Invoice_free(this_obj_conv);
53730 }
53731
53732 uint64_t  __attribute__((export_name("TS_UnsignedBolt12Invoice_tagged_hash"))) TS_UnsignedBolt12Invoice_tagged_hash(uint64_t this_arg) {
53733         LDKUnsignedBolt12Invoice this_arg_conv;
53734         this_arg_conv.inner = untag_ptr(this_arg);
53735         this_arg_conv.is_owned = ptr_is_owned(this_arg);
53736         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
53737         this_arg_conv.is_owned = false;
53738         LDKTaggedHash ret_var = UnsignedBolt12Invoice_tagged_hash(&this_arg_conv);
53739         uint64_t ret_ref = 0;
53740         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
53741         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
53742         return ret_ref;
53743 }
53744
53745 void  __attribute__((export_name("TS_Bolt12Invoice_free"))) TS_Bolt12Invoice_free(uint64_t this_obj) {
53746         LDKBolt12Invoice this_obj_conv;
53747         this_obj_conv.inner = untag_ptr(this_obj);
53748         this_obj_conv.is_owned = ptr_is_owned(this_obj);
53749         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
53750         Bolt12Invoice_free(this_obj_conv);
53751 }
53752
53753 static inline uint64_t Bolt12Invoice_clone_ptr(LDKBolt12Invoice *NONNULL_PTR arg) {
53754         LDKBolt12Invoice ret_var = Bolt12Invoice_clone(arg);
53755         uint64_t ret_ref = 0;
53756         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
53757         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
53758         return ret_ref;
53759 }
53760 int64_t  __attribute__((export_name("TS_Bolt12Invoice_clone_ptr"))) TS_Bolt12Invoice_clone_ptr(uint64_t arg) {
53761         LDKBolt12Invoice arg_conv;
53762         arg_conv.inner = untag_ptr(arg);
53763         arg_conv.is_owned = ptr_is_owned(arg);
53764         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
53765         arg_conv.is_owned = false;
53766         int64_t ret_conv = Bolt12Invoice_clone_ptr(&arg_conv);
53767         return ret_conv;
53768 }
53769
53770 uint64_t  __attribute__((export_name("TS_Bolt12Invoice_clone"))) TS_Bolt12Invoice_clone(uint64_t orig) {
53771         LDKBolt12Invoice orig_conv;
53772         orig_conv.inner = untag_ptr(orig);
53773         orig_conv.is_owned = ptr_is_owned(orig);
53774         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
53775         orig_conv.is_owned = false;
53776         LDKBolt12Invoice ret_var = Bolt12Invoice_clone(&orig_conv);
53777         uint64_t ret_ref = 0;
53778         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
53779         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
53780         return ret_ref;
53781 }
53782
53783 uint64_t  __attribute__((export_name("TS_UnsignedBolt12Invoice_offer_chains"))) TS_UnsignedBolt12Invoice_offer_chains(uint64_t this_arg) {
53784         LDKUnsignedBolt12Invoice this_arg_conv;
53785         this_arg_conv.inner = untag_ptr(this_arg);
53786         this_arg_conv.is_owned = ptr_is_owned(this_arg);
53787         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
53788         this_arg_conv.is_owned = false;
53789         LDKCOption_CVec_ThirtyTwoBytesZZ *ret_copy = MALLOC(sizeof(LDKCOption_CVec_ThirtyTwoBytesZZ), "LDKCOption_CVec_ThirtyTwoBytesZZ");
53790         *ret_copy = UnsignedBolt12Invoice_offer_chains(&this_arg_conv);
53791         uint64_t ret_ref = tag_ptr(ret_copy, true);
53792         return ret_ref;
53793 }
53794
53795 int8_tArray  __attribute__((export_name("TS_UnsignedBolt12Invoice_chain"))) TS_UnsignedBolt12Invoice_chain(uint64_t this_arg) {
53796         LDKUnsignedBolt12Invoice this_arg_conv;
53797         this_arg_conv.inner = untag_ptr(this_arg);
53798         this_arg_conv.is_owned = ptr_is_owned(this_arg);
53799         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
53800         this_arg_conv.is_owned = false;
53801         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
53802         memcpy(ret_arr->elems, UnsignedBolt12Invoice_chain(&this_arg_conv).data, 32);
53803         return ret_arr;
53804 }
53805
53806 uint64_t  __attribute__((export_name("TS_UnsignedBolt12Invoice_metadata"))) TS_UnsignedBolt12Invoice_metadata(uint64_t this_arg) {
53807         LDKUnsignedBolt12Invoice this_arg_conv;
53808         this_arg_conv.inner = untag_ptr(this_arg);
53809         this_arg_conv.is_owned = ptr_is_owned(this_arg);
53810         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
53811         this_arg_conv.is_owned = false;
53812         LDKCOption_CVec_u8ZZ *ret_copy = MALLOC(sizeof(LDKCOption_CVec_u8ZZ), "LDKCOption_CVec_u8ZZ");
53813         *ret_copy = UnsignedBolt12Invoice_metadata(&this_arg_conv);
53814         uint64_t ret_ref = tag_ptr(ret_copy, true);
53815         return ret_ref;
53816 }
53817
53818 uint64_t  __attribute__((export_name("TS_UnsignedBolt12Invoice_amount"))) TS_UnsignedBolt12Invoice_amount(uint64_t this_arg) {
53819         LDKUnsignedBolt12Invoice this_arg_conv;
53820         this_arg_conv.inner = untag_ptr(this_arg);
53821         this_arg_conv.is_owned = ptr_is_owned(this_arg);
53822         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
53823         this_arg_conv.is_owned = false;
53824         LDKAmount ret_var = UnsignedBolt12Invoice_amount(&this_arg_conv);
53825         uint64_t ret_ref = 0;
53826         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
53827         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
53828         return ret_ref;
53829 }
53830
53831 uint64_t  __attribute__((export_name("TS_UnsignedBolt12Invoice_offer_features"))) TS_UnsignedBolt12Invoice_offer_features(uint64_t this_arg) {
53832         LDKUnsignedBolt12Invoice this_arg_conv;
53833         this_arg_conv.inner = untag_ptr(this_arg);
53834         this_arg_conv.is_owned = ptr_is_owned(this_arg);
53835         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
53836         this_arg_conv.is_owned = false;
53837         LDKOfferFeatures ret_var = UnsignedBolt12Invoice_offer_features(&this_arg_conv);
53838         uint64_t ret_ref = 0;
53839         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
53840         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
53841         return ret_ref;
53842 }
53843
53844 uint64_t  __attribute__((export_name("TS_UnsignedBolt12Invoice_description"))) TS_UnsignedBolt12Invoice_description(uint64_t this_arg) {
53845         LDKUnsignedBolt12Invoice this_arg_conv;
53846         this_arg_conv.inner = untag_ptr(this_arg);
53847         this_arg_conv.is_owned = ptr_is_owned(this_arg);
53848         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
53849         this_arg_conv.is_owned = false;
53850         LDKPrintableString ret_var = UnsignedBolt12Invoice_description(&this_arg_conv);
53851         uint64_t ret_ref = 0;
53852         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
53853         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
53854         return ret_ref;
53855 }
53856
53857 uint64_t  __attribute__((export_name("TS_UnsignedBolt12Invoice_absolute_expiry"))) TS_UnsignedBolt12Invoice_absolute_expiry(uint64_t this_arg) {
53858         LDKUnsignedBolt12Invoice this_arg_conv;
53859         this_arg_conv.inner = untag_ptr(this_arg);
53860         this_arg_conv.is_owned = ptr_is_owned(this_arg);
53861         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
53862         this_arg_conv.is_owned = false;
53863         LDKCOption_u64Z *ret_copy = MALLOC(sizeof(LDKCOption_u64Z), "LDKCOption_u64Z");
53864         *ret_copy = UnsignedBolt12Invoice_absolute_expiry(&this_arg_conv);
53865         uint64_t ret_ref = tag_ptr(ret_copy, true);
53866         return ret_ref;
53867 }
53868
53869 uint64_t  __attribute__((export_name("TS_UnsignedBolt12Invoice_issuer"))) TS_UnsignedBolt12Invoice_issuer(uint64_t this_arg) {
53870         LDKUnsignedBolt12Invoice this_arg_conv;
53871         this_arg_conv.inner = untag_ptr(this_arg);
53872         this_arg_conv.is_owned = ptr_is_owned(this_arg);
53873         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
53874         this_arg_conv.is_owned = false;
53875         LDKPrintableString ret_var = UnsignedBolt12Invoice_issuer(&this_arg_conv);
53876         uint64_t ret_ref = 0;
53877         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
53878         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
53879         return ret_ref;
53880 }
53881
53882 uint64_tArray  __attribute__((export_name("TS_UnsignedBolt12Invoice_message_paths"))) TS_UnsignedBolt12Invoice_message_paths(uint64_t this_arg) {
53883         LDKUnsignedBolt12Invoice this_arg_conv;
53884         this_arg_conv.inner = untag_ptr(this_arg);
53885         this_arg_conv.is_owned = ptr_is_owned(this_arg);
53886         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
53887         this_arg_conv.is_owned = false;
53888         LDKCVec_BlindedPathZ ret_var = UnsignedBolt12Invoice_message_paths(&this_arg_conv);
53889         uint64_tArray ret_arr = NULL;
53890         ret_arr = init_uint64_tArray(ret_var.datalen, __LINE__);
53891         uint64_t *ret_arr_ptr = (uint64_t*)(((uint8_t*)ret_arr) + 8);
53892         for (size_t n = 0; n < ret_var.datalen; n++) {
53893                 LDKBlindedPath ret_conv_13_var = ret_var.data[n];
53894                 uint64_t ret_conv_13_ref = 0;
53895                 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_conv_13_var);
53896                 ret_conv_13_ref = tag_ptr(ret_conv_13_var.inner, ret_conv_13_var.is_owned);
53897                 ret_arr_ptr[n] = ret_conv_13_ref;
53898         }
53899         
53900         FREE(ret_var.data);
53901         return ret_arr;
53902 }
53903
53904 uint64_t  __attribute__((export_name("TS_UnsignedBolt12Invoice_supported_quantity"))) TS_UnsignedBolt12Invoice_supported_quantity(uint64_t this_arg) {
53905         LDKUnsignedBolt12Invoice this_arg_conv;
53906         this_arg_conv.inner = untag_ptr(this_arg);
53907         this_arg_conv.is_owned = ptr_is_owned(this_arg);
53908         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
53909         this_arg_conv.is_owned = false;
53910         LDKQuantity ret_var = UnsignedBolt12Invoice_supported_quantity(&this_arg_conv);
53911         uint64_t ret_ref = 0;
53912         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
53913         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
53914         return ret_ref;
53915 }
53916
53917 int8_tArray  __attribute__((export_name("TS_UnsignedBolt12Invoice_payer_metadata"))) TS_UnsignedBolt12Invoice_payer_metadata(uint64_t this_arg) {
53918         LDKUnsignedBolt12Invoice this_arg_conv;
53919         this_arg_conv.inner = untag_ptr(this_arg);
53920         this_arg_conv.is_owned = ptr_is_owned(this_arg);
53921         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
53922         this_arg_conv.is_owned = false;
53923         LDKu8slice ret_var = UnsignedBolt12Invoice_payer_metadata(&this_arg_conv);
53924         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
53925         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
53926         return ret_arr;
53927 }
53928
53929 uint64_t  __attribute__((export_name("TS_UnsignedBolt12Invoice_invoice_request_features"))) TS_UnsignedBolt12Invoice_invoice_request_features(uint64_t this_arg) {
53930         LDKUnsignedBolt12Invoice this_arg_conv;
53931         this_arg_conv.inner = untag_ptr(this_arg);
53932         this_arg_conv.is_owned = ptr_is_owned(this_arg);
53933         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
53934         this_arg_conv.is_owned = false;
53935         LDKInvoiceRequestFeatures ret_var = UnsignedBolt12Invoice_invoice_request_features(&this_arg_conv);
53936         uint64_t ret_ref = 0;
53937         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
53938         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
53939         return ret_ref;
53940 }
53941
53942 uint64_t  __attribute__((export_name("TS_UnsignedBolt12Invoice_quantity"))) TS_UnsignedBolt12Invoice_quantity(uint64_t this_arg) {
53943         LDKUnsignedBolt12Invoice this_arg_conv;
53944         this_arg_conv.inner = untag_ptr(this_arg);
53945         this_arg_conv.is_owned = ptr_is_owned(this_arg);
53946         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
53947         this_arg_conv.is_owned = false;
53948         LDKCOption_u64Z *ret_copy = MALLOC(sizeof(LDKCOption_u64Z), "LDKCOption_u64Z");
53949         *ret_copy = UnsignedBolt12Invoice_quantity(&this_arg_conv);
53950         uint64_t ret_ref = tag_ptr(ret_copy, true);
53951         return ret_ref;
53952 }
53953
53954 int8_tArray  __attribute__((export_name("TS_UnsignedBolt12Invoice_payer_id"))) TS_UnsignedBolt12Invoice_payer_id(uint64_t this_arg) {
53955         LDKUnsignedBolt12Invoice this_arg_conv;
53956         this_arg_conv.inner = untag_ptr(this_arg);
53957         this_arg_conv.is_owned = ptr_is_owned(this_arg);
53958         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
53959         this_arg_conv.is_owned = false;
53960         int8_tArray ret_arr = init_int8_tArray(33, __LINE__);
53961         memcpy(ret_arr->elems, UnsignedBolt12Invoice_payer_id(&this_arg_conv).compressed_form, 33);
53962         return ret_arr;
53963 }
53964
53965 uint64_t  __attribute__((export_name("TS_UnsignedBolt12Invoice_payer_note"))) TS_UnsignedBolt12Invoice_payer_note(uint64_t this_arg) {
53966         LDKUnsignedBolt12Invoice this_arg_conv;
53967         this_arg_conv.inner = untag_ptr(this_arg);
53968         this_arg_conv.is_owned = ptr_is_owned(this_arg);
53969         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
53970         this_arg_conv.is_owned = false;
53971         LDKPrintableString ret_var = UnsignedBolt12Invoice_payer_note(&this_arg_conv);
53972         uint64_t ret_ref = 0;
53973         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
53974         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
53975         return ret_ref;
53976 }
53977
53978 int64_t  __attribute__((export_name("TS_UnsignedBolt12Invoice_created_at"))) TS_UnsignedBolt12Invoice_created_at(uint64_t this_arg) {
53979         LDKUnsignedBolt12Invoice this_arg_conv;
53980         this_arg_conv.inner = untag_ptr(this_arg);
53981         this_arg_conv.is_owned = ptr_is_owned(this_arg);
53982         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
53983         this_arg_conv.is_owned = false;
53984         int64_t ret_conv = UnsignedBolt12Invoice_created_at(&this_arg_conv);
53985         return ret_conv;
53986 }
53987
53988 int64_t  __attribute__((export_name("TS_UnsignedBolt12Invoice_relative_expiry"))) TS_UnsignedBolt12Invoice_relative_expiry(uint64_t this_arg) {
53989         LDKUnsignedBolt12Invoice this_arg_conv;
53990         this_arg_conv.inner = untag_ptr(this_arg);
53991         this_arg_conv.is_owned = ptr_is_owned(this_arg);
53992         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
53993         this_arg_conv.is_owned = false;
53994         int64_t ret_conv = UnsignedBolt12Invoice_relative_expiry(&this_arg_conv);
53995         return ret_conv;
53996 }
53997
53998 int8_tArray  __attribute__((export_name("TS_UnsignedBolt12Invoice_payment_hash"))) TS_UnsignedBolt12Invoice_payment_hash(uint64_t this_arg) {
53999         LDKUnsignedBolt12Invoice this_arg_conv;
54000         this_arg_conv.inner = untag_ptr(this_arg);
54001         this_arg_conv.is_owned = ptr_is_owned(this_arg);
54002         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
54003         this_arg_conv.is_owned = false;
54004         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
54005         memcpy(ret_arr->elems, UnsignedBolt12Invoice_payment_hash(&this_arg_conv).data, 32);
54006         return ret_arr;
54007 }
54008
54009 int64_t  __attribute__((export_name("TS_UnsignedBolt12Invoice_amount_msats"))) TS_UnsignedBolt12Invoice_amount_msats(uint64_t this_arg) {
54010         LDKUnsignedBolt12Invoice this_arg_conv;
54011         this_arg_conv.inner = untag_ptr(this_arg);
54012         this_arg_conv.is_owned = ptr_is_owned(this_arg);
54013         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
54014         this_arg_conv.is_owned = false;
54015         int64_t ret_conv = UnsignedBolt12Invoice_amount_msats(&this_arg_conv);
54016         return ret_conv;
54017 }
54018
54019 uint64_t  __attribute__((export_name("TS_UnsignedBolt12Invoice_invoice_features"))) TS_UnsignedBolt12Invoice_invoice_features(uint64_t this_arg) {
54020         LDKUnsignedBolt12Invoice this_arg_conv;
54021         this_arg_conv.inner = untag_ptr(this_arg);
54022         this_arg_conv.is_owned = ptr_is_owned(this_arg);
54023         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
54024         this_arg_conv.is_owned = false;
54025         LDKBolt12InvoiceFeatures ret_var = UnsignedBolt12Invoice_invoice_features(&this_arg_conv);
54026         uint64_t ret_ref = 0;
54027         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
54028         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
54029         return ret_ref;
54030 }
54031
54032 int8_tArray  __attribute__((export_name("TS_UnsignedBolt12Invoice_signing_pubkey"))) TS_UnsignedBolt12Invoice_signing_pubkey(uint64_t this_arg) {
54033         LDKUnsignedBolt12Invoice this_arg_conv;
54034         this_arg_conv.inner = untag_ptr(this_arg);
54035         this_arg_conv.is_owned = ptr_is_owned(this_arg);
54036         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
54037         this_arg_conv.is_owned = false;
54038         int8_tArray ret_arr = init_int8_tArray(33, __LINE__);
54039         memcpy(ret_arr->elems, UnsignedBolt12Invoice_signing_pubkey(&this_arg_conv).compressed_form, 33);
54040         return ret_arr;
54041 }
54042
54043 uint64_t  __attribute__((export_name("TS_Bolt12Invoice_offer_chains"))) TS_Bolt12Invoice_offer_chains(uint64_t this_arg) {
54044         LDKBolt12Invoice this_arg_conv;
54045         this_arg_conv.inner = untag_ptr(this_arg);
54046         this_arg_conv.is_owned = ptr_is_owned(this_arg);
54047         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
54048         this_arg_conv.is_owned = false;
54049         LDKCOption_CVec_ThirtyTwoBytesZZ *ret_copy = MALLOC(sizeof(LDKCOption_CVec_ThirtyTwoBytesZZ), "LDKCOption_CVec_ThirtyTwoBytesZZ");
54050         *ret_copy = Bolt12Invoice_offer_chains(&this_arg_conv);
54051         uint64_t ret_ref = tag_ptr(ret_copy, true);
54052         return ret_ref;
54053 }
54054
54055 int8_tArray  __attribute__((export_name("TS_Bolt12Invoice_chain"))) TS_Bolt12Invoice_chain(uint64_t this_arg) {
54056         LDKBolt12Invoice this_arg_conv;
54057         this_arg_conv.inner = untag_ptr(this_arg);
54058         this_arg_conv.is_owned = ptr_is_owned(this_arg);
54059         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
54060         this_arg_conv.is_owned = false;
54061         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
54062         memcpy(ret_arr->elems, Bolt12Invoice_chain(&this_arg_conv).data, 32);
54063         return ret_arr;
54064 }
54065
54066 uint64_t  __attribute__((export_name("TS_Bolt12Invoice_metadata"))) TS_Bolt12Invoice_metadata(uint64_t this_arg) {
54067         LDKBolt12Invoice this_arg_conv;
54068         this_arg_conv.inner = untag_ptr(this_arg);
54069         this_arg_conv.is_owned = ptr_is_owned(this_arg);
54070         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
54071         this_arg_conv.is_owned = false;
54072         LDKCOption_CVec_u8ZZ *ret_copy = MALLOC(sizeof(LDKCOption_CVec_u8ZZ), "LDKCOption_CVec_u8ZZ");
54073         *ret_copy = Bolt12Invoice_metadata(&this_arg_conv);
54074         uint64_t ret_ref = tag_ptr(ret_copy, true);
54075         return ret_ref;
54076 }
54077
54078 uint64_t  __attribute__((export_name("TS_Bolt12Invoice_amount"))) TS_Bolt12Invoice_amount(uint64_t this_arg) {
54079         LDKBolt12Invoice this_arg_conv;
54080         this_arg_conv.inner = untag_ptr(this_arg);
54081         this_arg_conv.is_owned = ptr_is_owned(this_arg);
54082         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
54083         this_arg_conv.is_owned = false;
54084         LDKAmount ret_var = Bolt12Invoice_amount(&this_arg_conv);
54085         uint64_t ret_ref = 0;
54086         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
54087         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
54088         return ret_ref;
54089 }
54090
54091 uint64_t  __attribute__((export_name("TS_Bolt12Invoice_offer_features"))) TS_Bolt12Invoice_offer_features(uint64_t this_arg) {
54092         LDKBolt12Invoice this_arg_conv;
54093         this_arg_conv.inner = untag_ptr(this_arg);
54094         this_arg_conv.is_owned = ptr_is_owned(this_arg);
54095         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
54096         this_arg_conv.is_owned = false;
54097         LDKOfferFeatures ret_var = Bolt12Invoice_offer_features(&this_arg_conv);
54098         uint64_t ret_ref = 0;
54099         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
54100         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
54101         return ret_ref;
54102 }
54103
54104 uint64_t  __attribute__((export_name("TS_Bolt12Invoice_description"))) TS_Bolt12Invoice_description(uint64_t this_arg) {
54105         LDKBolt12Invoice this_arg_conv;
54106         this_arg_conv.inner = untag_ptr(this_arg);
54107         this_arg_conv.is_owned = ptr_is_owned(this_arg);
54108         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
54109         this_arg_conv.is_owned = false;
54110         LDKPrintableString ret_var = Bolt12Invoice_description(&this_arg_conv);
54111         uint64_t ret_ref = 0;
54112         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
54113         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
54114         return ret_ref;
54115 }
54116
54117 uint64_t  __attribute__((export_name("TS_Bolt12Invoice_absolute_expiry"))) TS_Bolt12Invoice_absolute_expiry(uint64_t this_arg) {
54118         LDKBolt12Invoice this_arg_conv;
54119         this_arg_conv.inner = untag_ptr(this_arg);
54120         this_arg_conv.is_owned = ptr_is_owned(this_arg);
54121         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
54122         this_arg_conv.is_owned = false;
54123         LDKCOption_u64Z *ret_copy = MALLOC(sizeof(LDKCOption_u64Z), "LDKCOption_u64Z");
54124         *ret_copy = Bolt12Invoice_absolute_expiry(&this_arg_conv);
54125         uint64_t ret_ref = tag_ptr(ret_copy, true);
54126         return ret_ref;
54127 }
54128
54129 uint64_t  __attribute__((export_name("TS_Bolt12Invoice_issuer"))) TS_Bolt12Invoice_issuer(uint64_t this_arg) {
54130         LDKBolt12Invoice this_arg_conv;
54131         this_arg_conv.inner = untag_ptr(this_arg);
54132         this_arg_conv.is_owned = ptr_is_owned(this_arg);
54133         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
54134         this_arg_conv.is_owned = false;
54135         LDKPrintableString ret_var = Bolt12Invoice_issuer(&this_arg_conv);
54136         uint64_t ret_ref = 0;
54137         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
54138         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
54139         return ret_ref;
54140 }
54141
54142 uint64_tArray  __attribute__((export_name("TS_Bolt12Invoice_message_paths"))) TS_Bolt12Invoice_message_paths(uint64_t this_arg) {
54143         LDKBolt12Invoice this_arg_conv;
54144         this_arg_conv.inner = untag_ptr(this_arg);
54145         this_arg_conv.is_owned = ptr_is_owned(this_arg);
54146         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
54147         this_arg_conv.is_owned = false;
54148         LDKCVec_BlindedPathZ ret_var = Bolt12Invoice_message_paths(&this_arg_conv);
54149         uint64_tArray ret_arr = NULL;
54150         ret_arr = init_uint64_tArray(ret_var.datalen, __LINE__);
54151         uint64_t *ret_arr_ptr = (uint64_t*)(((uint8_t*)ret_arr) + 8);
54152         for (size_t n = 0; n < ret_var.datalen; n++) {
54153                 LDKBlindedPath ret_conv_13_var = ret_var.data[n];
54154                 uint64_t ret_conv_13_ref = 0;
54155                 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_conv_13_var);
54156                 ret_conv_13_ref = tag_ptr(ret_conv_13_var.inner, ret_conv_13_var.is_owned);
54157                 ret_arr_ptr[n] = ret_conv_13_ref;
54158         }
54159         
54160         FREE(ret_var.data);
54161         return ret_arr;
54162 }
54163
54164 uint64_t  __attribute__((export_name("TS_Bolt12Invoice_supported_quantity"))) TS_Bolt12Invoice_supported_quantity(uint64_t this_arg) {
54165         LDKBolt12Invoice this_arg_conv;
54166         this_arg_conv.inner = untag_ptr(this_arg);
54167         this_arg_conv.is_owned = ptr_is_owned(this_arg);
54168         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
54169         this_arg_conv.is_owned = false;
54170         LDKQuantity ret_var = Bolt12Invoice_supported_quantity(&this_arg_conv);
54171         uint64_t ret_ref = 0;
54172         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
54173         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
54174         return ret_ref;
54175 }
54176
54177 int8_tArray  __attribute__((export_name("TS_Bolt12Invoice_payer_metadata"))) TS_Bolt12Invoice_payer_metadata(uint64_t this_arg) {
54178         LDKBolt12Invoice this_arg_conv;
54179         this_arg_conv.inner = untag_ptr(this_arg);
54180         this_arg_conv.is_owned = ptr_is_owned(this_arg);
54181         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
54182         this_arg_conv.is_owned = false;
54183         LDKu8slice ret_var = Bolt12Invoice_payer_metadata(&this_arg_conv);
54184         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
54185         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
54186         return ret_arr;
54187 }
54188
54189 uint64_t  __attribute__((export_name("TS_Bolt12Invoice_invoice_request_features"))) TS_Bolt12Invoice_invoice_request_features(uint64_t this_arg) {
54190         LDKBolt12Invoice this_arg_conv;
54191         this_arg_conv.inner = untag_ptr(this_arg);
54192         this_arg_conv.is_owned = ptr_is_owned(this_arg);
54193         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
54194         this_arg_conv.is_owned = false;
54195         LDKInvoiceRequestFeatures ret_var = Bolt12Invoice_invoice_request_features(&this_arg_conv);
54196         uint64_t ret_ref = 0;
54197         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
54198         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
54199         return ret_ref;
54200 }
54201
54202 uint64_t  __attribute__((export_name("TS_Bolt12Invoice_quantity"))) TS_Bolt12Invoice_quantity(uint64_t this_arg) {
54203         LDKBolt12Invoice this_arg_conv;
54204         this_arg_conv.inner = untag_ptr(this_arg);
54205         this_arg_conv.is_owned = ptr_is_owned(this_arg);
54206         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
54207         this_arg_conv.is_owned = false;
54208         LDKCOption_u64Z *ret_copy = MALLOC(sizeof(LDKCOption_u64Z), "LDKCOption_u64Z");
54209         *ret_copy = Bolt12Invoice_quantity(&this_arg_conv);
54210         uint64_t ret_ref = tag_ptr(ret_copy, true);
54211         return ret_ref;
54212 }
54213
54214 int8_tArray  __attribute__((export_name("TS_Bolt12Invoice_payer_id"))) TS_Bolt12Invoice_payer_id(uint64_t this_arg) {
54215         LDKBolt12Invoice this_arg_conv;
54216         this_arg_conv.inner = untag_ptr(this_arg);
54217         this_arg_conv.is_owned = ptr_is_owned(this_arg);
54218         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
54219         this_arg_conv.is_owned = false;
54220         int8_tArray ret_arr = init_int8_tArray(33, __LINE__);
54221         memcpy(ret_arr->elems, Bolt12Invoice_payer_id(&this_arg_conv).compressed_form, 33);
54222         return ret_arr;
54223 }
54224
54225 uint64_t  __attribute__((export_name("TS_Bolt12Invoice_payer_note"))) TS_Bolt12Invoice_payer_note(uint64_t this_arg) {
54226         LDKBolt12Invoice this_arg_conv;
54227         this_arg_conv.inner = untag_ptr(this_arg);
54228         this_arg_conv.is_owned = ptr_is_owned(this_arg);
54229         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
54230         this_arg_conv.is_owned = false;
54231         LDKPrintableString ret_var = Bolt12Invoice_payer_note(&this_arg_conv);
54232         uint64_t ret_ref = 0;
54233         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
54234         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
54235         return ret_ref;
54236 }
54237
54238 int64_t  __attribute__((export_name("TS_Bolt12Invoice_created_at"))) TS_Bolt12Invoice_created_at(uint64_t this_arg) {
54239         LDKBolt12Invoice this_arg_conv;
54240         this_arg_conv.inner = untag_ptr(this_arg);
54241         this_arg_conv.is_owned = ptr_is_owned(this_arg);
54242         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
54243         this_arg_conv.is_owned = false;
54244         int64_t ret_conv = Bolt12Invoice_created_at(&this_arg_conv);
54245         return ret_conv;
54246 }
54247
54248 int64_t  __attribute__((export_name("TS_Bolt12Invoice_relative_expiry"))) TS_Bolt12Invoice_relative_expiry(uint64_t this_arg) {
54249         LDKBolt12Invoice this_arg_conv;
54250         this_arg_conv.inner = untag_ptr(this_arg);
54251         this_arg_conv.is_owned = ptr_is_owned(this_arg);
54252         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
54253         this_arg_conv.is_owned = false;
54254         int64_t ret_conv = Bolt12Invoice_relative_expiry(&this_arg_conv);
54255         return ret_conv;
54256 }
54257
54258 int8_tArray  __attribute__((export_name("TS_Bolt12Invoice_payment_hash"))) TS_Bolt12Invoice_payment_hash(uint64_t this_arg) {
54259         LDKBolt12Invoice this_arg_conv;
54260         this_arg_conv.inner = untag_ptr(this_arg);
54261         this_arg_conv.is_owned = ptr_is_owned(this_arg);
54262         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
54263         this_arg_conv.is_owned = false;
54264         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
54265         memcpy(ret_arr->elems, Bolt12Invoice_payment_hash(&this_arg_conv).data, 32);
54266         return ret_arr;
54267 }
54268
54269 int64_t  __attribute__((export_name("TS_Bolt12Invoice_amount_msats"))) TS_Bolt12Invoice_amount_msats(uint64_t this_arg) {
54270         LDKBolt12Invoice this_arg_conv;
54271         this_arg_conv.inner = untag_ptr(this_arg);
54272         this_arg_conv.is_owned = ptr_is_owned(this_arg);
54273         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
54274         this_arg_conv.is_owned = false;
54275         int64_t ret_conv = Bolt12Invoice_amount_msats(&this_arg_conv);
54276         return ret_conv;
54277 }
54278
54279 uint64_t  __attribute__((export_name("TS_Bolt12Invoice_invoice_features"))) TS_Bolt12Invoice_invoice_features(uint64_t this_arg) {
54280         LDKBolt12Invoice this_arg_conv;
54281         this_arg_conv.inner = untag_ptr(this_arg);
54282         this_arg_conv.is_owned = ptr_is_owned(this_arg);
54283         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
54284         this_arg_conv.is_owned = false;
54285         LDKBolt12InvoiceFeatures ret_var = Bolt12Invoice_invoice_features(&this_arg_conv);
54286         uint64_t ret_ref = 0;
54287         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
54288         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
54289         return ret_ref;
54290 }
54291
54292 int8_tArray  __attribute__((export_name("TS_Bolt12Invoice_signing_pubkey"))) TS_Bolt12Invoice_signing_pubkey(uint64_t this_arg) {
54293         LDKBolt12Invoice this_arg_conv;
54294         this_arg_conv.inner = untag_ptr(this_arg);
54295         this_arg_conv.is_owned = ptr_is_owned(this_arg);
54296         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
54297         this_arg_conv.is_owned = false;
54298         int8_tArray ret_arr = init_int8_tArray(33, __LINE__);
54299         memcpy(ret_arr->elems, Bolt12Invoice_signing_pubkey(&this_arg_conv).compressed_form, 33);
54300         return ret_arr;
54301 }
54302
54303 int8_tArray  __attribute__((export_name("TS_Bolt12Invoice_signature"))) TS_Bolt12Invoice_signature(uint64_t this_arg) {
54304         LDKBolt12Invoice this_arg_conv;
54305         this_arg_conv.inner = untag_ptr(this_arg);
54306         this_arg_conv.is_owned = ptr_is_owned(this_arg);
54307         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
54308         this_arg_conv.is_owned = false;
54309         int8_tArray ret_arr = init_int8_tArray(64, __LINE__);
54310         memcpy(ret_arr->elems, Bolt12Invoice_signature(&this_arg_conv).compact_form, 64);
54311         return ret_arr;
54312 }
54313
54314 int8_tArray  __attribute__((export_name("TS_Bolt12Invoice_signable_hash"))) TS_Bolt12Invoice_signable_hash(uint64_t this_arg) {
54315         LDKBolt12Invoice this_arg_conv;
54316         this_arg_conv.inner = untag_ptr(this_arg);
54317         this_arg_conv.is_owned = ptr_is_owned(this_arg);
54318         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
54319         this_arg_conv.is_owned = false;
54320         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
54321         memcpy(ret_arr->elems, Bolt12Invoice_signable_hash(&this_arg_conv).data, 32);
54322         return ret_arr;
54323 }
54324
54325 uint64_t  __attribute__((export_name("TS_Bolt12Invoice_verify"))) TS_Bolt12Invoice_verify(uint64_t this_arg, uint64_t key) {
54326         LDKBolt12Invoice this_arg_conv;
54327         this_arg_conv.inner = untag_ptr(this_arg);
54328         this_arg_conv.is_owned = ptr_is_owned(this_arg);
54329         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
54330         this_arg_conv.is_owned = false;
54331         LDKExpandedKey key_conv;
54332         key_conv.inner = untag_ptr(key);
54333         key_conv.is_owned = ptr_is_owned(key);
54334         CHECK_INNER_FIELD_ACCESS_OR_NULL(key_conv);
54335         key_conv.is_owned = false;
54336         LDKCResult_ThirtyTwoBytesNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_ThirtyTwoBytesNoneZ), "LDKCResult_ThirtyTwoBytesNoneZ");
54337         *ret_conv = Bolt12Invoice_verify(&this_arg_conv, &key_conv);
54338         return tag_ptr(ret_conv, true);
54339 }
54340
54341 int8_tArray  __attribute__((export_name("TS_UnsignedBolt12Invoice_write"))) TS_UnsignedBolt12Invoice_write(uint64_t obj) {
54342         LDKUnsignedBolt12Invoice obj_conv;
54343         obj_conv.inner = untag_ptr(obj);
54344         obj_conv.is_owned = ptr_is_owned(obj);
54345         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
54346         obj_conv.is_owned = false;
54347         LDKCVec_u8Z ret_var = UnsignedBolt12Invoice_write(&obj_conv);
54348         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
54349         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
54350         CVec_u8Z_free(ret_var);
54351         return ret_arr;
54352 }
54353
54354 int8_tArray  __attribute__((export_name("TS_Bolt12Invoice_write"))) TS_Bolt12Invoice_write(uint64_t obj) {
54355         LDKBolt12Invoice obj_conv;
54356         obj_conv.inner = untag_ptr(obj);
54357         obj_conv.is_owned = ptr_is_owned(obj);
54358         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
54359         obj_conv.is_owned = false;
54360         LDKCVec_u8Z ret_var = Bolt12Invoice_write(&obj_conv);
54361         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
54362         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
54363         CVec_u8Z_free(ret_var);
54364         return ret_arr;
54365 }
54366
54367 void  __attribute__((export_name("TS_BlindedPayInfo_free"))) TS_BlindedPayInfo_free(uint64_t this_obj) {
54368         LDKBlindedPayInfo this_obj_conv;
54369         this_obj_conv.inner = untag_ptr(this_obj);
54370         this_obj_conv.is_owned = ptr_is_owned(this_obj);
54371         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
54372         BlindedPayInfo_free(this_obj_conv);
54373 }
54374
54375 int32_t  __attribute__((export_name("TS_BlindedPayInfo_get_fee_base_msat"))) TS_BlindedPayInfo_get_fee_base_msat(uint64_t this_ptr) {
54376         LDKBlindedPayInfo this_ptr_conv;
54377         this_ptr_conv.inner = untag_ptr(this_ptr);
54378         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
54379         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
54380         this_ptr_conv.is_owned = false;
54381         int32_t ret_conv = BlindedPayInfo_get_fee_base_msat(&this_ptr_conv);
54382         return ret_conv;
54383 }
54384
54385 void  __attribute__((export_name("TS_BlindedPayInfo_set_fee_base_msat"))) TS_BlindedPayInfo_set_fee_base_msat(uint64_t this_ptr, int32_t val) {
54386         LDKBlindedPayInfo this_ptr_conv;
54387         this_ptr_conv.inner = untag_ptr(this_ptr);
54388         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
54389         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
54390         this_ptr_conv.is_owned = false;
54391         BlindedPayInfo_set_fee_base_msat(&this_ptr_conv, val);
54392 }
54393
54394 int32_t  __attribute__((export_name("TS_BlindedPayInfo_get_fee_proportional_millionths"))) TS_BlindedPayInfo_get_fee_proportional_millionths(uint64_t this_ptr) {
54395         LDKBlindedPayInfo this_ptr_conv;
54396         this_ptr_conv.inner = untag_ptr(this_ptr);
54397         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
54398         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
54399         this_ptr_conv.is_owned = false;
54400         int32_t ret_conv = BlindedPayInfo_get_fee_proportional_millionths(&this_ptr_conv);
54401         return ret_conv;
54402 }
54403
54404 void  __attribute__((export_name("TS_BlindedPayInfo_set_fee_proportional_millionths"))) TS_BlindedPayInfo_set_fee_proportional_millionths(uint64_t this_ptr, int32_t val) {
54405         LDKBlindedPayInfo this_ptr_conv;
54406         this_ptr_conv.inner = untag_ptr(this_ptr);
54407         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
54408         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
54409         this_ptr_conv.is_owned = false;
54410         BlindedPayInfo_set_fee_proportional_millionths(&this_ptr_conv, val);
54411 }
54412
54413 int16_t  __attribute__((export_name("TS_BlindedPayInfo_get_cltv_expiry_delta"))) TS_BlindedPayInfo_get_cltv_expiry_delta(uint64_t this_ptr) {
54414         LDKBlindedPayInfo this_ptr_conv;
54415         this_ptr_conv.inner = untag_ptr(this_ptr);
54416         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
54417         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
54418         this_ptr_conv.is_owned = false;
54419         int16_t ret_conv = BlindedPayInfo_get_cltv_expiry_delta(&this_ptr_conv);
54420         return ret_conv;
54421 }
54422
54423 void  __attribute__((export_name("TS_BlindedPayInfo_set_cltv_expiry_delta"))) TS_BlindedPayInfo_set_cltv_expiry_delta(uint64_t this_ptr, int16_t val) {
54424         LDKBlindedPayInfo this_ptr_conv;
54425         this_ptr_conv.inner = untag_ptr(this_ptr);
54426         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
54427         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
54428         this_ptr_conv.is_owned = false;
54429         BlindedPayInfo_set_cltv_expiry_delta(&this_ptr_conv, val);
54430 }
54431
54432 int64_t  __attribute__((export_name("TS_BlindedPayInfo_get_htlc_minimum_msat"))) TS_BlindedPayInfo_get_htlc_minimum_msat(uint64_t this_ptr) {
54433         LDKBlindedPayInfo this_ptr_conv;
54434         this_ptr_conv.inner = untag_ptr(this_ptr);
54435         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
54436         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
54437         this_ptr_conv.is_owned = false;
54438         int64_t ret_conv = BlindedPayInfo_get_htlc_minimum_msat(&this_ptr_conv);
54439         return ret_conv;
54440 }
54441
54442 void  __attribute__((export_name("TS_BlindedPayInfo_set_htlc_minimum_msat"))) TS_BlindedPayInfo_set_htlc_minimum_msat(uint64_t this_ptr, int64_t val) {
54443         LDKBlindedPayInfo this_ptr_conv;
54444         this_ptr_conv.inner = untag_ptr(this_ptr);
54445         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
54446         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
54447         this_ptr_conv.is_owned = false;
54448         BlindedPayInfo_set_htlc_minimum_msat(&this_ptr_conv, val);
54449 }
54450
54451 int64_t  __attribute__((export_name("TS_BlindedPayInfo_get_htlc_maximum_msat"))) TS_BlindedPayInfo_get_htlc_maximum_msat(uint64_t this_ptr) {
54452         LDKBlindedPayInfo this_ptr_conv;
54453         this_ptr_conv.inner = untag_ptr(this_ptr);
54454         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
54455         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
54456         this_ptr_conv.is_owned = false;
54457         int64_t ret_conv = BlindedPayInfo_get_htlc_maximum_msat(&this_ptr_conv);
54458         return ret_conv;
54459 }
54460
54461 void  __attribute__((export_name("TS_BlindedPayInfo_set_htlc_maximum_msat"))) TS_BlindedPayInfo_set_htlc_maximum_msat(uint64_t this_ptr, int64_t val) {
54462         LDKBlindedPayInfo this_ptr_conv;
54463         this_ptr_conv.inner = untag_ptr(this_ptr);
54464         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
54465         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
54466         this_ptr_conv.is_owned = false;
54467         BlindedPayInfo_set_htlc_maximum_msat(&this_ptr_conv, val);
54468 }
54469
54470 uint64_t  __attribute__((export_name("TS_BlindedPayInfo_get_features"))) TS_BlindedPayInfo_get_features(uint64_t this_ptr) {
54471         LDKBlindedPayInfo this_ptr_conv;
54472         this_ptr_conv.inner = untag_ptr(this_ptr);
54473         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
54474         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
54475         this_ptr_conv.is_owned = false;
54476         LDKBlindedHopFeatures ret_var = BlindedPayInfo_get_features(&this_ptr_conv);
54477         uint64_t ret_ref = 0;
54478         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
54479         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
54480         return ret_ref;
54481 }
54482
54483 void  __attribute__((export_name("TS_BlindedPayInfo_set_features"))) TS_BlindedPayInfo_set_features(uint64_t this_ptr, uint64_t val) {
54484         LDKBlindedPayInfo this_ptr_conv;
54485         this_ptr_conv.inner = untag_ptr(this_ptr);
54486         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
54487         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
54488         this_ptr_conv.is_owned = false;
54489         LDKBlindedHopFeatures val_conv;
54490         val_conv.inner = untag_ptr(val);
54491         val_conv.is_owned = ptr_is_owned(val);
54492         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
54493         val_conv = BlindedHopFeatures_clone(&val_conv);
54494         BlindedPayInfo_set_features(&this_ptr_conv, val_conv);
54495 }
54496
54497 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) {
54498         LDKBlindedHopFeatures features_arg_conv;
54499         features_arg_conv.inner = untag_ptr(features_arg);
54500         features_arg_conv.is_owned = ptr_is_owned(features_arg);
54501         CHECK_INNER_FIELD_ACCESS_OR_NULL(features_arg_conv);
54502         features_arg_conv = BlindedHopFeatures_clone(&features_arg_conv);
54503         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);
54504         uint64_t ret_ref = 0;
54505         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
54506         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
54507         return ret_ref;
54508 }
54509
54510 static inline uint64_t BlindedPayInfo_clone_ptr(LDKBlindedPayInfo *NONNULL_PTR arg) {
54511         LDKBlindedPayInfo ret_var = BlindedPayInfo_clone(arg);
54512         uint64_t ret_ref = 0;
54513         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
54514         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
54515         return ret_ref;
54516 }
54517 int64_t  __attribute__((export_name("TS_BlindedPayInfo_clone_ptr"))) TS_BlindedPayInfo_clone_ptr(uint64_t arg) {
54518         LDKBlindedPayInfo arg_conv;
54519         arg_conv.inner = untag_ptr(arg);
54520         arg_conv.is_owned = ptr_is_owned(arg);
54521         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
54522         arg_conv.is_owned = false;
54523         int64_t ret_conv = BlindedPayInfo_clone_ptr(&arg_conv);
54524         return ret_conv;
54525 }
54526
54527 uint64_t  __attribute__((export_name("TS_BlindedPayInfo_clone"))) TS_BlindedPayInfo_clone(uint64_t orig) {
54528         LDKBlindedPayInfo orig_conv;
54529         orig_conv.inner = untag_ptr(orig);
54530         orig_conv.is_owned = ptr_is_owned(orig);
54531         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
54532         orig_conv.is_owned = false;
54533         LDKBlindedPayInfo ret_var = BlindedPayInfo_clone(&orig_conv);
54534         uint64_t ret_ref = 0;
54535         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
54536         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
54537         return ret_ref;
54538 }
54539
54540 int64_t  __attribute__((export_name("TS_BlindedPayInfo_hash"))) TS_BlindedPayInfo_hash(uint64_t o) {
54541         LDKBlindedPayInfo o_conv;
54542         o_conv.inner = untag_ptr(o);
54543         o_conv.is_owned = ptr_is_owned(o);
54544         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
54545         o_conv.is_owned = false;
54546         int64_t ret_conv = BlindedPayInfo_hash(&o_conv);
54547         return ret_conv;
54548 }
54549
54550 jboolean  __attribute__((export_name("TS_BlindedPayInfo_eq"))) TS_BlindedPayInfo_eq(uint64_t a, uint64_t b) {
54551         LDKBlindedPayInfo a_conv;
54552         a_conv.inner = untag_ptr(a);
54553         a_conv.is_owned = ptr_is_owned(a);
54554         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
54555         a_conv.is_owned = false;
54556         LDKBlindedPayInfo b_conv;
54557         b_conv.inner = untag_ptr(b);
54558         b_conv.is_owned = ptr_is_owned(b);
54559         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
54560         b_conv.is_owned = false;
54561         jboolean ret_conv = BlindedPayInfo_eq(&a_conv, &b_conv);
54562         return ret_conv;
54563 }
54564
54565 int8_tArray  __attribute__((export_name("TS_BlindedPayInfo_write"))) TS_BlindedPayInfo_write(uint64_t obj) {
54566         LDKBlindedPayInfo obj_conv;
54567         obj_conv.inner = untag_ptr(obj);
54568         obj_conv.is_owned = ptr_is_owned(obj);
54569         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
54570         obj_conv.is_owned = false;
54571         LDKCVec_u8Z ret_var = BlindedPayInfo_write(&obj_conv);
54572         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
54573         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
54574         CVec_u8Z_free(ret_var);
54575         return ret_arr;
54576 }
54577
54578 uint64_t  __attribute__((export_name("TS_BlindedPayInfo_read"))) TS_BlindedPayInfo_read(int8_tArray ser) {
54579         LDKu8slice ser_ref;
54580         ser_ref.datalen = ser->arr_len;
54581         ser_ref.data = ser->elems;
54582         LDKCResult_BlindedPayInfoDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_BlindedPayInfoDecodeErrorZ), "LDKCResult_BlindedPayInfoDecodeErrorZ");
54583         *ret_conv = BlindedPayInfo_read(ser_ref);
54584         FREE(ser);
54585         return tag_ptr(ret_conv, true);
54586 }
54587
54588 void  __attribute__((export_name("TS_InvoiceError_free"))) TS_InvoiceError_free(uint64_t this_obj) {
54589         LDKInvoiceError this_obj_conv;
54590         this_obj_conv.inner = untag_ptr(this_obj);
54591         this_obj_conv.is_owned = ptr_is_owned(this_obj);
54592         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
54593         InvoiceError_free(this_obj_conv);
54594 }
54595
54596 uint64_t  __attribute__((export_name("TS_InvoiceError_get_erroneous_field"))) TS_InvoiceError_get_erroneous_field(uint64_t this_ptr) {
54597         LDKInvoiceError this_ptr_conv;
54598         this_ptr_conv.inner = untag_ptr(this_ptr);
54599         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
54600         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
54601         this_ptr_conv.is_owned = false;
54602         LDKErroneousField ret_var = InvoiceError_get_erroneous_field(&this_ptr_conv);
54603         uint64_t ret_ref = 0;
54604         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
54605         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
54606         return ret_ref;
54607 }
54608
54609 void  __attribute__((export_name("TS_InvoiceError_set_erroneous_field"))) TS_InvoiceError_set_erroneous_field(uint64_t this_ptr, uint64_t val) {
54610         LDKInvoiceError this_ptr_conv;
54611         this_ptr_conv.inner = untag_ptr(this_ptr);
54612         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
54613         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
54614         this_ptr_conv.is_owned = false;
54615         LDKErroneousField val_conv;
54616         val_conv.inner = untag_ptr(val);
54617         val_conv.is_owned = ptr_is_owned(val);
54618         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
54619         val_conv = ErroneousField_clone(&val_conv);
54620         InvoiceError_set_erroneous_field(&this_ptr_conv, val_conv);
54621 }
54622
54623 uint64_t  __attribute__((export_name("TS_InvoiceError_get_message"))) TS_InvoiceError_get_message(uint64_t this_ptr) {
54624         LDKInvoiceError this_ptr_conv;
54625         this_ptr_conv.inner = untag_ptr(this_ptr);
54626         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
54627         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
54628         this_ptr_conv.is_owned = false;
54629         LDKUntrustedString ret_var = InvoiceError_get_message(&this_ptr_conv);
54630         uint64_t ret_ref = 0;
54631         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
54632         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
54633         return ret_ref;
54634 }
54635
54636 void  __attribute__((export_name("TS_InvoiceError_set_message"))) TS_InvoiceError_set_message(uint64_t this_ptr, uint64_t val) {
54637         LDKInvoiceError this_ptr_conv;
54638         this_ptr_conv.inner = untag_ptr(this_ptr);
54639         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
54640         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
54641         this_ptr_conv.is_owned = false;
54642         LDKUntrustedString val_conv;
54643         val_conv.inner = untag_ptr(val);
54644         val_conv.is_owned = ptr_is_owned(val);
54645         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
54646         val_conv = UntrustedString_clone(&val_conv);
54647         InvoiceError_set_message(&this_ptr_conv, val_conv);
54648 }
54649
54650 uint64_t  __attribute__((export_name("TS_InvoiceError_new"))) TS_InvoiceError_new(uint64_t erroneous_field_arg, uint64_t message_arg) {
54651         LDKErroneousField erroneous_field_arg_conv;
54652         erroneous_field_arg_conv.inner = untag_ptr(erroneous_field_arg);
54653         erroneous_field_arg_conv.is_owned = ptr_is_owned(erroneous_field_arg);
54654         CHECK_INNER_FIELD_ACCESS_OR_NULL(erroneous_field_arg_conv);
54655         erroneous_field_arg_conv = ErroneousField_clone(&erroneous_field_arg_conv);
54656         LDKUntrustedString message_arg_conv;
54657         message_arg_conv.inner = untag_ptr(message_arg);
54658         message_arg_conv.is_owned = ptr_is_owned(message_arg);
54659         CHECK_INNER_FIELD_ACCESS_OR_NULL(message_arg_conv);
54660         message_arg_conv = UntrustedString_clone(&message_arg_conv);
54661         LDKInvoiceError ret_var = InvoiceError_new(erroneous_field_arg_conv, message_arg_conv);
54662         uint64_t ret_ref = 0;
54663         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
54664         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
54665         return ret_ref;
54666 }
54667
54668 static inline uint64_t InvoiceError_clone_ptr(LDKInvoiceError *NONNULL_PTR arg) {
54669         LDKInvoiceError ret_var = InvoiceError_clone(arg);
54670         uint64_t ret_ref = 0;
54671         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
54672         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
54673         return ret_ref;
54674 }
54675 int64_t  __attribute__((export_name("TS_InvoiceError_clone_ptr"))) TS_InvoiceError_clone_ptr(uint64_t arg) {
54676         LDKInvoiceError arg_conv;
54677         arg_conv.inner = untag_ptr(arg);
54678         arg_conv.is_owned = ptr_is_owned(arg);
54679         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
54680         arg_conv.is_owned = false;
54681         int64_t ret_conv = InvoiceError_clone_ptr(&arg_conv);
54682         return ret_conv;
54683 }
54684
54685 uint64_t  __attribute__((export_name("TS_InvoiceError_clone"))) TS_InvoiceError_clone(uint64_t orig) {
54686         LDKInvoiceError orig_conv;
54687         orig_conv.inner = untag_ptr(orig);
54688         orig_conv.is_owned = ptr_is_owned(orig);
54689         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
54690         orig_conv.is_owned = false;
54691         LDKInvoiceError ret_var = InvoiceError_clone(&orig_conv);
54692         uint64_t ret_ref = 0;
54693         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
54694         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
54695         return ret_ref;
54696 }
54697
54698 void  __attribute__((export_name("TS_ErroneousField_free"))) TS_ErroneousField_free(uint64_t this_obj) {
54699         LDKErroneousField this_obj_conv;
54700         this_obj_conv.inner = untag_ptr(this_obj);
54701         this_obj_conv.is_owned = ptr_is_owned(this_obj);
54702         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
54703         ErroneousField_free(this_obj_conv);
54704 }
54705
54706 int64_t  __attribute__((export_name("TS_ErroneousField_get_tlv_fieldnum"))) TS_ErroneousField_get_tlv_fieldnum(uint64_t this_ptr) {
54707         LDKErroneousField this_ptr_conv;
54708         this_ptr_conv.inner = untag_ptr(this_ptr);
54709         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
54710         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
54711         this_ptr_conv.is_owned = false;
54712         int64_t ret_conv = ErroneousField_get_tlv_fieldnum(&this_ptr_conv);
54713         return ret_conv;
54714 }
54715
54716 void  __attribute__((export_name("TS_ErroneousField_set_tlv_fieldnum"))) TS_ErroneousField_set_tlv_fieldnum(uint64_t this_ptr, int64_t val) {
54717         LDKErroneousField this_ptr_conv;
54718         this_ptr_conv.inner = untag_ptr(this_ptr);
54719         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
54720         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
54721         this_ptr_conv.is_owned = false;
54722         ErroneousField_set_tlv_fieldnum(&this_ptr_conv, val);
54723 }
54724
54725 uint64_t  __attribute__((export_name("TS_ErroneousField_get_suggested_value"))) TS_ErroneousField_get_suggested_value(uint64_t this_ptr) {
54726         LDKErroneousField this_ptr_conv;
54727         this_ptr_conv.inner = untag_ptr(this_ptr);
54728         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
54729         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
54730         this_ptr_conv.is_owned = false;
54731         LDKCOption_CVec_u8ZZ *ret_copy = MALLOC(sizeof(LDKCOption_CVec_u8ZZ), "LDKCOption_CVec_u8ZZ");
54732         *ret_copy = ErroneousField_get_suggested_value(&this_ptr_conv);
54733         uint64_t ret_ref = tag_ptr(ret_copy, true);
54734         return ret_ref;
54735 }
54736
54737 void  __attribute__((export_name("TS_ErroneousField_set_suggested_value"))) TS_ErroneousField_set_suggested_value(uint64_t this_ptr, uint64_t val) {
54738         LDKErroneousField this_ptr_conv;
54739         this_ptr_conv.inner = untag_ptr(this_ptr);
54740         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
54741         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
54742         this_ptr_conv.is_owned = false;
54743         void* val_ptr = untag_ptr(val);
54744         CHECK_ACCESS(val_ptr);
54745         LDKCOption_CVec_u8ZZ val_conv = *(LDKCOption_CVec_u8ZZ*)(val_ptr);
54746         val_conv = COption_CVec_u8ZZ_clone((LDKCOption_CVec_u8ZZ*)untag_ptr(val));
54747         ErroneousField_set_suggested_value(&this_ptr_conv, val_conv);
54748 }
54749
54750 uint64_t  __attribute__((export_name("TS_ErroneousField_new"))) TS_ErroneousField_new(int64_t tlv_fieldnum_arg, uint64_t suggested_value_arg) {
54751         void* suggested_value_arg_ptr = untag_ptr(suggested_value_arg);
54752         CHECK_ACCESS(suggested_value_arg_ptr);
54753         LDKCOption_CVec_u8ZZ suggested_value_arg_conv = *(LDKCOption_CVec_u8ZZ*)(suggested_value_arg_ptr);
54754         suggested_value_arg_conv = COption_CVec_u8ZZ_clone((LDKCOption_CVec_u8ZZ*)untag_ptr(suggested_value_arg));
54755         LDKErroneousField ret_var = ErroneousField_new(tlv_fieldnum_arg, suggested_value_arg_conv);
54756         uint64_t ret_ref = 0;
54757         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
54758         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
54759         return ret_ref;
54760 }
54761
54762 static inline uint64_t ErroneousField_clone_ptr(LDKErroneousField *NONNULL_PTR arg) {
54763         LDKErroneousField ret_var = ErroneousField_clone(arg);
54764         uint64_t ret_ref = 0;
54765         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
54766         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
54767         return ret_ref;
54768 }
54769 int64_t  __attribute__((export_name("TS_ErroneousField_clone_ptr"))) TS_ErroneousField_clone_ptr(uint64_t arg) {
54770         LDKErroneousField arg_conv;
54771         arg_conv.inner = untag_ptr(arg);
54772         arg_conv.is_owned = ptr_is_owned(arg);
54773         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
54774         arg_conv.is_owned = false;
54775         int64_t ret_conv = ErroneousField_clone_ptr(&arg_conv);
54776         return ret_conv;
54777 }
54778
54779 uint64_t  __attribute__((export_name("TS_ErroneousField_clone"))) TS_ErroneousField_clone(uint64_t orig) {
54780         LDKErroneousField orig_conv;
54781         orig_conv.inner = untag_ptr(orig);
54782         orig_conv.is_owned = ptr_is_owned(orig);
54783         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
54784         orig_conv.is_owned = false;
54785         LDKErroneousField ret_var = ErroneousField_clone(&orig_conv);
54786         uint64_t ret_ref = 0;
54787         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
54788         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
54789         return ret_ref;
54790 }
54791
54792 uint64_t  __attribute__((export_name("TS_InvoiceError_from_string"))) TS_InvoiceError_from_string(jstring s) {
54793         LDKStr s_conv = str_ref_to_owned_c(s);
54794         LDKInvoiceError ret_var = InvoiceError_from_string(s_conv);
54795         uint64_t ret_ref = 0;
54796         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
54797         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
54798         return ret_ref;
54799 }
54800
54801 int8_tArray  __attribute__((export_name("TS_InvoiceError_write"))) TS_InvoiceError_write(uint64_t obj) {
54802         LDKInvoiceError obj_conv;
54803         obj_conv.inner = untag_ptr(obj);
54804         obj_conv.is_owned = ptr_is_owned(obj);
54805         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
54806         obj_conv.is_owned = false;
54807         LDKCVec_u8Z ret_var = InvoiceError_write(&obj_conv);
54808         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
54809         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
54810         CVec_u8Z_free(ret_var);
54811         return ret_arr;
54812 }
54813
54814 uint64_t  __attribute__((export_name("TS_InvoiceError_read"))) TS_InvoiceError_read(int8_tArray ser) {
54815         LDKu8slice ser_ref;
54816         ser_ref.datalen = ser->arr_len;
54817         ser_ref.data = ser->elems;
54818         LDKCResult_InvoiceErrorDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InvoiceErrorDecodeErrorZ), "LDKCResult_InvoiceErrorDecodeErrorZ");
54819         *ret_conv = InvoiceError_read(ser_ref);
54820         FREE(ser);
54821         return tag_ptr(ret_conv, true);
54822 }
54823
54824 void  __attribute__((export_name("TS_UnsignedInvoiceRequest_free"))) TS_UnsignedInvoiceRequest_free(uint64_t this_obj) {
54825         LDKUnsignedInvoiceRequest this_obj_conv;
54826         this_obj_conv.inner = untag_ptr(this_obj);
54827         this_obj_conv.is_owned = ptr_is_owned(this_obj);
54828         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
54829         UnsignedInvoiceRequest_free(this_obj_conv);
54830 }
54831
54832 uint64_t  __attribute__((export_name("TS_UnsignedInvoiceRequest_tagged_hash"))) TS_UnsignedInvoiceRequest_tagged_hash(uint64_t this_arg) {
54833         LDKUnsignedInvoiceRequest this_arg_conv;
54834         this_arg_conv.inner = untag_ptr(this_arg);
54835         this_arg_conv.is_owned = ptr_is_owned(this_arg);
54836         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
54837         this_arg_conv.is_owned = false;
54838         LDKTaggedHash ret_var = UnsignedInvoiceRequest_tagged_hash(&this_arg_conv);
54839         uint64_t ret_ref = 0;
54840         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
54841         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
54842         return ret_ref;
54843 }
54844
54845 void  __attribute__((export_name("TS_InvoiceRequest_free"))) TS_InvoiceRequest_free(uint64_t this_obj) {
54846         LDKInvoiceRequest this_obj_conv;
54847         this_obj_conv.inner = untag_ptr(this_obj);
54848         this_obj_conv.is_owned = ptr_is_owned(this_obj);
54849         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
54850         InvoiceRequest_free(this_obj_conv);
54851 }
54852
54853 static inline uint64_t InvoiceRequest_clone_ptr(LDKInvoiceRequest *NONNULL_PTR arg) {
54854         LDKInvoiceRequest ret_var = InvoiceRequest_clone(arg);
54855         uint64_t ret_ref = 0;
54856         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
54857         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
54858         return ret_ref;
54859 }
54860 int64_t  __attribute__((export_name("TS_InvoiceRequest_clone_ptr"))) TS_InvoiceRequest_clone_ptr(uint64_t arg) {
54861         LDKInvoiceRequest arg_conv;
54862         arg_conv.inner = untag_ptr(arg);
54863         arg_conv.is_owned = ptr_is_owned(arg);
54864         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
54865         arg_conv.is_owned = false;
54866         int64_t ret_conv = InvoiceRequest_clone_ptr(&arg_conv);
54867         return ret_conv;
54868 }
54869
54870 uint64_t  __attribute__((export_name("TS_InvoiceRequest_clone"))) TS_InvoiceRequest_clone(uint64_t orig) {
54871         LDKInvoiceRequest orig_conv;
54872         orig_conv.inner = untag_ptr(orig);
54873         orig_conv.is_owned = ptr_is_owned(orig);
54874         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
54875         orig_conv.is_owned = false;
54876         LDKInvoiceRequest ret_var = InvoiceRequest_clone(&orig_conv);
54877         uint64_t ret_ref = 0;
54878         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
54879         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
54880         return ret_ref;
54881 }
54882
54883 void  __attribute__((export_name("TS_VerifiedInvoiceRequest_free"))) TS_VerifiedInvoiceRequest_free(uint64_t this_obj) {
54884         LDKVerifiedInvoiceRequest this_obj_conv;
54885         this_obj_conv.inner = untag_ptr(this_obj);
54886         this_obj_conv.is_owned = ptr_is_owned(this_obj);
54887         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
54888         VerifiedInvoiceRequest_free(this_obj_conv);
54889 }
54890
54891 uint64_t  __attribute__((export_name("TS_VerifiedInvoiceRequest_get_keys"))) TS_VerifiedInvoiceRequest_get_keys(uint64_t this_ptr) {
54892         LDKVerifiedInvoiceRequest this_ptr_conv;
54893         this_ptr_conv.inner = untag_ptr(this_ptr);
54894         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
54895         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
54896         this_ptr_conv.is_owned = false;
54897         LDKCOption_SecretKeyZ *ret_copy = MALLOC(sizeof(LDKCOption_SecretKeyZ), "LDKCOption_SecretKeyZ");
54898         *ret_copy = VerifiedInvoiceRequest_get_keys(&this_ptr_conv);
54899         uint64_t ret_ref = tag_ptr(ret_copy, true);
54900         return ret_ref;
54901 }
54902
54903 void  __attribute__((export_name("TS_VerifiedInvoiceRequest_set_keys"))) TS_VerifiedInvoiceRequest_set_keys(uint64_t this_ptr, uint64_t val) {
54904         LDKVerifiedInvoiceRequest this_ptr_conv;
54905         this_ptr_conv.inner = untag_ptr(this_ptr);
54906         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
54907         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
54908         this_ptr_conv.is_owned = false;
54909         void* val_ptr = untag_ptr(val);
54910         CHECK_ACCESS(val_ptr);
54911         LDKCOption_SecretKeyZ val_conv = *(LDKCOption_SecretKeyZ*)(val_ptr);
54912         val_conv = COption_SecretKeyZ_clone((LDKCOption_SecretKeyZ*)untag_ptr(val));
54913         VerifiedInvoiceRequest_set_keys(&this_ptr_conv, val_conv);
54914 }
54915
54916 static inline uint64_t VerifiedInvoiceRequest_clone_ptr(LDKVerifiedInvoiceRequest *NONNULL_PTR arg) {
54917         LDKVerifiedInvoiceRequest ret_var = VerifiedInvoiceRequest_clone(arg);
54918         uint64_t ret_ref = 0;
54919         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
54920         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
54921         return ret_ref;
54922 }
54923 int64_t  __attribute__((export_name("TS_VerifiedInvoiceRequest_clone_ptr"))) TS_VerifiedInvoiceRequest_clone_ptr(uint64_t arg) {
54924         LDKVerifiedInvoiceRequest arg_conv;
54925         arg_conv.inner = untag_ptr(arg);
54926         arg_conv.is_owned = ptr_is_owned(arg);
54927         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
54928         arg_conv.is_owned = false;
54929         int64_t ret_conv = VerifiedInvoiceRequest_clone_ptr(&arg_conv);
54930         return ret_conv;
54931 }
54932
54933 uint64_t  __attribute__((export_name("TS_VerifiedInvoiceRequest_clone"))) TS_VerifiedInvoiceRequest_clone(uint64_t orig) {
54934         LDKVerifiedInvoiceRequest orig_conv;
54935         orig_conv.inner = untag_ptr(orig);
54936         orig_conv.is_owned = ptr_is_owned(orig);
54937         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
54938         orig_conv.is_owned = false;
54939         LDKVerifiedInvoiceRequest ret_var = VerifiedInvoiceRequest_clone(&orig_conv);
54940         uint64_t ret_ref = 0;
54941         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
54942         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
54943         return ret_ref;
54944 }
54945
54946 ptrArray  __attribute__((export_name("TS_UnsignedInvoiceRequest_chains"))) TS_UnsignedInvoiceRequest_chains(uint64_t this_arg) {
54947         LDKUnsignedInvoiceRequest this_arg_conv;
54948         this_arg_conv.inner = untag_ptr(this_arg);
54949         this_arg_conv.is_owned = ptr_is_owned(this_arg);
54950         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
54951         this_arg_conv.is_owned = false;
54952         LDKCVec_ThirtyTwoBytesZ ret_var = UnsignedInvoiceRequest_chains(&this_arg_conv);
54953         ptrArray ret_arr = NULL;
54954         ret_arr = init_ptrArray(ret_var.datalen, __LINE__);
54955         int8_tArray *ret_arr_ptr = (int8_tArray*)(((uint8_t*)ret_arr) + 8);
54956         for (size_t m = 0; m < ret_var.datalen; m++) {
54957                 int8_tArray ret_conv_12_arr = init_int8_tArray(32, __LINE__);
54958                 memcpy(ret_conv_12_arr->elems, ret_var.data[m].data, 32);
54959                 ret_arr_ptr[m] = ret_conv_12_arr;
54960         }
54961         
54962         FREE(ret_var.data);
54963         return ret_arr;
54964 }
54965
54966 uint64_t  __attribute__((export_name("TS_UnsignedInvoiceRequest_metadata"))) TS_UnsignedInvoiceRequest_metadata(uint64_t this_arg) {
54967         LDKUnsignedInvoiceRequest this_arg_conv;
54968         this_arg_conv.inner = untag_ptr(this_arg);
54969         this_arg_conv.is_owned = ptr_is_owned(this_arg);
54970         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
54971         this_arg_conv.is_owned = false;
54972         LDKCOption_CVec_u8ZZ *ret_copy = MALLOC(sizeof(LDKCOption_CVec_u8ZZ), "LDKCOption_CVec_u8ZZ");
54973         *ret_copy = UnsignedInvoiceRequest_metadata(&this_arg_conv);
54974         uint64_t ret_ref = tag_ptr(ret_copy, true);
54975         return ret_ref;
54976 }
54977
54978 uint64_t  __attribute__((export_name("TS_UnsignedInvoiceRequest_amount"))) TS_UnsignedInvoiceRequest_amount(uint64_t this_arg) {
54979         LDKUnsignedInvoiceRequest this_arg_conv;
54980         this_arg_conv.inner = untag_ptr(this_arg);
54981         this_arg_conv.is_owned = ptr_is_owned(this_arg);
54982         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
54983         this_arg_conv.is_owned = false;
54984         LDKAmount ret_var = UnsignedInvoiceRequest_amount(&this_arg_conv);
54985         uint64_t ret_ref = 0;
54986         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
54987         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
54988         return ret_ref;
54989 }
54990
54991 uint64_t  __attribute__((export_name("TS_UnsignedInvoiceRequest_description"))) TS_UnsignedInvoiceRequest_description(uint64_t this_arg) {
54992         LDKUnsignedInvoiceRequest this_arg_conv;
54993         this_arg_conv.inner = untag_ptr(this_arg);
54994         this_arg_conv.is_owned = ptr_is_owned(this_arg);
54995         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
54996         this_arg_conv.is_owned = false;
54997         LDKPrintableString ret_var = UnsignedInvoiceRequest_description(&this_arg_conv);
54998         uint64_t ret_ref = 0;
54999         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
55000         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
55001         return ret_ref;
55002 }
55003
55004 uint64_t  __attribute__((export_name("TS_UnsignedInvoiceRequest_offer_features"))) TS_UnsignedInvoiceRequest_offer_features(uint64_t this_arg) {
55005         LDKUnsignedInvoiceRequest this_arg_conv;
55006         this_arg_conv.inner = untag_ptr(this_arg);
55007         this_arg_conv.is_owned = ptr_is_owned(this_arg);
55008         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
55009         this_arg_conv.is_owned = false;
55010         LDKOfferFeatures ret_var = UnsignedInvoiceRequest_offer_features(&this_arg_conv);
55011         uint64_t ret_ref = 0;
55012         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
55013         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
55014         return ret_ref;
55015 }
55016
55017 uint64_t  __attribute__((export_name("TS_UnsignedInvoiceRequest_absolute_expiry"))) TS_UnsignedInvoiceRequest_absolute_expiry(uint64_t this_arg) {
55018         LDKUnsignedInvoiceRequest this_arg_conv;
55019         this_arg_conv.inner = untag_ptr(this_arg);
55020         this_arg_conv.is_owned = ptr_is_owned(this_arg);
55021         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
55022         this_arg_conv.is_owned = false;
55023         LDKCOption_u64Z *ret_copy = MALLOC(sizeof(LDKCOption_u64Z), "LDKCOption_u64Z");
55024         *ret_copy = UnsignedInvoiceRequest_absolute_expiry(&this_arg_conv);
55025         uint64_t ret_ref = tag_ptr(ret_copy, true);
55026         return ret_ref;
55027 }
55028
55029 uint64_t  __attribute__((export_name("TS_UnsignedInvoiceRequest_issuer"))) TS_UnsignedInvoiceRequest_issuer(uint64_t this_arg) {
55030         LDKUnsignedInvoiceRequest this_arg_conv;
55031         this_arg_conv.inner = untag_ptr(this_arg);
55032         this_arg_conv.is_owned = ptr_is_owned(this_arg);
55033         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
55034         this_arg_conv.is_owned = false;
55035         LDKPrintableString ret_var = UnsignedInvoiceRequest_issuer(&this_arg_conv);
55036         uint64_t ret_ref = 0;
55037         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
55038         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
55039         return ret_ref;
55040 }
55041
55042 uint64_tArray  __attribute__((export_name("TS_UnsignedInvoiceRequest_paths"))) TS_UnsignedInvoiceRequest_paths(uint64_t this_arg) {
55043         LDKUnsignedInvoiceRequest this_arg_conv;
55044         this_arg_conv.inner = untag_ptr(this_arg);
55045         this_arg_conv.is_owned = ptr_is_owned(this_arg);
55046         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
55047         this_arg_conv.is_owned = false;
55048         LDKCVec_BlindedPathZ ret_var = UnsignedInvoiceRequest_paths(&this_arg_conv);
55049         uint64_tArray ret_arr = NULL;
55050         ret_arr = init_uint64_tArray(ret_var.datalen, __LINE__);
55051         uint64_t *ret_arr_ptr = (uint64_t*)(((uint8_t*)ret_arr) + 8);
55052         for (size_t n = 0; n < ret_var.datalen; n++) {
55053                 LDKBlindedPath ret_conv_13_var = ret_var.data[n];
55054                 uint64_t ret_conv_13_ref = 0;
55055                 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_conv_13_var);
55056                 ret_conv_13_ref = tag_ptr(ret_conv_13_var.inner, ret_conv_13_var.is_owned);
55057                 ret_arr_ptr[n] = ret_conv_13_ref;
55058         }
55059         
55060         FREE(ret_var.data);
55061         return ret_arr;
55062 }
55063
55064 uint64_t  __attribute__((export_name("TS_UnsignedInvoiceRequest_supported_quantity"))) TS_UnsignedInvoiceRequest_supported_quantity(uint64_t this_arg) {
55065         LDKUnsignedInvoiceRequest this_arg_conv;
55066         this_arg_conv.inner = untag_ptr(this_arg);
55067         this_arg_conv.is_owned = ptr_is_owned(this_arg);
55068         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
55069         this_arg_conv.is_owned = false;
55070         LDKQuantity ret_var = UnsignedInvoiceRequest_supported_quantity(&this_arg_conv);
55071         uint64_t ret_ref = 0;
55072         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
55073         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
55074         return ret_ref;
55075 }
55076
55077 int8_tArray  __attribute__((export_name("TS_UnsignedInvoiceRequest_signing_pubkey"))) TS_UnsignedInvoiceRequest_signing_pubkey(uint64_t this_arg) {
55078         LDKUnsignedInvoiceRequest this_arg_conv;
55079         this_arg_conv.inner = untag_ptr(this_arg);
55080         this_arg_conv.is_owned = ptr_is_owned(this_arg);
55081         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
55082         this_arg_conv.is_owned = false;
55083         int8_tArray ret_arr = init_int8_tArray(33, __LINE__);
55084         memcpy(ret_arr->elems, UnsignedInvoiceRequest_signing_pubkey(&this_arg_conv).compressed_form, 33);
55085         return ret_arr;
55086 }
55087
55088 int8_tArray  __attribute__((export_name("TS_UnsignedInvoiceRequest_payer_metadata"))) TS_UnsignedInvoiceRequest_payer_metadata(uint64_t this_arg) {
55089         LDKUnsignedInvoiceRequest this_arg_conv;
55090         this_arg_conv.inner = untag_ptr(this_arg);
55091         this_arg_conv.is_owned = ptr_is_owned(this_arg);
55092         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
55093         this_arg_conv.is_owned = false;
55094         LDKu8slice ret_var = UnsignedInvoiceRequest_payer_metadata(&this_arg_conv);
55095         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
55096         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
55097         return ret_arr;
55098 }
55099
55100 int8_tArray  __attribute__((export_name("TS_UnsignedInvoiceRequest_chain"))) TS_UnsignedInvoiceRequest_chain(uint64_t this_arg) {
55101         LDKUnsignedInvoiceRequest this_arg_conv;
55102         this_arg_conv.inner = untag_ptr(this_arg);
55103         this_arg_conv.is_owned = ptr_is_owned(this_arg);
55104         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
55105         this_arg_conv.is_owned = false;
55106         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
55107         memcpy(ret_arr->elems, UnsignedInvoiceRequest_chain(&this_arg_conv).data, 32);
55108         return ret_arr;
55109 }
55110
55111 uint64_t  __attribute__((export_name("TS_UnsignedInvoiceRequest_amount_msats"))) TS_UnsignedInvoiceRequest_amount_msats(uint64_t this_arg) {
55112         LDKUnsignedInvoiceRequest this_arg_conv;
55113         this_arg_conv.inner = untag_ptr(this_arg);
55114         this_arg_conv.is_owned = ptr_is_owned(this_arg);
55115         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
55116         this_arg_conv.is_owned = false;
55117         LDKCOption_u64Z *ret_copy = MALLOC(sizeof(LDKCOption_u64Z), "LDKCOption_u64Z");
55118         *ret_copy = UnsignedInvoiceRequest_amount_msats(&this_arg_conv);
55119         uint64_t ret_ref = tag_ptr(ret_copy, true);
55120         return ret_ref;
55121 }
55122
55123 uint64_t  __attribute__((export_name("TS_UnsignedInvoiceRequest_invoice_request_features"))) TS_UnsignedInvoiceRequest_invoice_request_features(uint64_t this_arg) {
55124         LDKUnsignedInvoiceRequest this_arg_conv;
55125         this_arg_conv.inner = untag_ptr(this_arg);
55126         this_arg_conv.is_owned = ptr_is_owned(this_arg);
55127         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
55128         this_arg_conv.is_owned = false;
55129         LDKInvoiceRequestFeatures ret_var = UnsignedInvoiceRequest_invoice_request_features(&this_arg_conv);
55130         uint64_t ret_ref = 0;
55131         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
55132         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
55133         return ret_ref;
55134 }
55135
55136 uint64_t  __attribute__((export_name("TS_UnsignedInvoiceRequest_quantity"))) TS_UnsignedInvoiceRequest_quantity(uint64_t this_arg) {
55137         LDKUnsignedInvoiceRequest this_arg_conv;
55138         this_arg_conv.inner = untag_ptr(this_arg);
55139         this_arg_conv.is_owned = ptr_is_owned(this_arg);
55140         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
55141         this_arg_conv.is_owned = false;
55142         LDKCOption_u64Z *ret_copy = MALLOC(sizeof(LDKCOption_u64Z), "LDKCOption_u64Z");
55143         *ret_copy = UnsignedInvoiceRequest_quantity(&this_arg_conv);
55144         uint64_t ret_ref = tag_ptr(ret_copy, true);
55145         return ret_ref;
55146 }
55147
55148 int8_tArray  __attribute__((export_name("TS_UnsignedInvoiceRequest_payer_id"))) TS_UnsignedInvoiceRequest_payer_id(uint64_t this_arg) {
55149         LDKUnsignedInvoiceRequest this_arg_conv;
55150         this_arg_conv.inner = untag_ptr(this_arg);
55151         this_arg_conv.is_owned = ptr_is_owned(this_arg);
55152         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
55153         this_arg_conv.is_owned = false;
55154         int8_tArray ret_arr = init_int8_tArray(33, __LINE__);
55155         memcpy(ret_arr->elems, UnsignedInvoiceRequest_payer_id(&this_arg_conv).compressed_form, 33);
55156         return ret_arr;
55157 }
55158
55159 uint64_t  __attribute__((export_name("TS_UnsignedInvoiceRequest_payer_note"))) TS_UnsignedInvoiceRequest_payer_note(uint64_t this_arg) {
55160         LDKUnsignedInvoiceRequest this_arg_conv;
55161         this_arg_conv.inner = untag_ptr(this_arg);
55162         this_arg_conv.is_owned = ptr_is_owned(this_arg);
55163         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
55164         this_arg_conv.is_owned = false;
55165         LDKPrintableString ret_var = UnsignedInvoiceRequest_payer_note(&this_arg_conv);
55166         uint64_t ret_ref = 0;
55167         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
55168         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
55169         return ret_ref;
55170 }
55171
55172 ptrArray  __attribute__((export_name("TS_InvoiceRequest_chains"))) TS_InvoiceRequest_chains(uint64_t this_arg) {
55173         LDKInvoiceRequest this_arg_conv;
55174         this_arg_conv.inner = untag_ptr(this_arg);
55175         this_arg_conv.is_owned = ptr_is_owned(this_arg);
55176         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
55177         this_arg_conv.is_owned = false;
55178         LDKCVec_ThirtyTwoBytesZ ret_var = InvoiceRequest_chains(&this_arg_conv);
55179         ptrArray ret_arr = NULL;
55180         ret_arr = init_ptrArray(ret_var.datalen, __LINE__);
55181         int8_tArray *ret_arr_ptr = (int8_tArray*)(((uint8_t*)ret_arr) + 8);
55182         for (size_t m = 0; m < ret_var.datalen; m++) {
55183                 int8_tArray ret_conv_12_arr = init_int8_tArray(32, __LINE__);
55184                 memcpy(ret_conv_12_arr->elems, ret_var.data[m].data, 32);
55185                 ret_arr_ptr[m] = ret_conv_12_arr;
55186         }
55187         
55188         FREE(ret_var.data);
55189         return ret_arr;
55190 }
55191
55192 uint64_t  __attribute__((export_name("TS_InvoiceRequest_metadata"))) TS_InvoiceRequest_metadata(uint64_t this_arg) {
55193         LDKInvoiceRequest this_arg_conv;
55194         this_arg_conv.inner = untag_ptr(this_arg);
55195         this_arg_conv.is_owned = ptr_is_owned(this_arg);
55196         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
55197         this_arg_conv.is_owned = false;
55198         LDKCOption_CVec_u8ZZ *ret_copy = MALLOC(sizeof(LDKCOption_CVec_u8ZZ), "LDKCOption_CVec_u8ZZ");
55199         *ret_copy = InvoiceRequest_metadata(&this_arg_conv);
55200         uint64_t ret_ref = tag_ptr(ret_copy, true);
55201         return ret_ref;
55202 }
55203
55204 uint64_t  __attribute__((export_name("TS_InvoiceRequest_amount"))) TS_InvoiceRequest_amount(uint64_t this_arg) {
55205         LDKInvoiceRequest this_arg_conv;
55206         this_arg_conv.inner = untag_ptr(this_arg);
55207         this_arg_conv.is_owned = ptr_is_owned(this_arg);
55208         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
55209         this_arg_conv.is_owned = false;
55210         LDKAmount ret_var = InvoiceRequest_amount(&this_arg_conv);
55211         uint64_t ret_ref = 0;
55212         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
55213         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
55214         return ret_ref;
55215 }
55216
55217 uint64_t  __attribute__((export_name("TS_InvoiceRequest_description"))) TS_InvoiceRequest_description(uint64_t this_arg) {
55218         LDKInvoiceRequest this_arg_conv;
55219         this_arg_conv.inner = untag_ptr(this_arg);
55220         this_arg_conv.is_owned = ptr_is_owned(this_arg);
55221         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
55222         this_arg_conv.is_owned = false;
55223         LDKPrintableString ret_var = InvoiceRequest_description(&this_arg_conv);
55224         uint64_t ret_ref = 0;
55225         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
55226         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
55227         return ret_ref;
55228 }
55229
55230 uint64_t  __attribute__((export_name("TS_InvoiceRequest_offer_features"))) TS_InvoiceRequest_offer_features(uint64_t this_arg) {
55231         LDKInvoiceRequest this_arg_conv;
55232         this_arg_conv.inner = untag_ptr(this_arg);
55233         this_arg_conv.is_owned = ptr_is_owned(this_arg);
55234         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
55235         this_arg_conv.is_owned = false;
55236         LDKOfferFeatures ret_var = InvoiceRequest_offer_features(&this_arg_conv);
55237         uint64_t ret_ref = 0;
55238         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
55239         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
55240         return ret_ref;
55241 }
55242
55243 uint64_t  __attribute__((export_name("TS_InvoiceRequest_absolute_expiry"))) TS_InvoiceRequest_absolute_expiry(uint64_t this_arg) {
55244         LDKInvoiceRequest this_arg_conv;
55245         this_arg_conv.inner = untag_ptr(this_arg);
55246         this_arg_conv.is_owned = ptr_is_owned(this_arg);
55247         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
55248         this_arg_conv.is_owned = false;
55249         LDKCOption_u64Z *ret_copy = MALLOC(sizeof(LDKCOption_u64Z), "LDKCOption_u64Z");
55250         *ret_copy = InvoiceRequest_absolute_expiry(&this_arg_conv);
55251         uint64_t ret_ref = tag_ptr(ret_copy, true);
55252         return ret_ref;
55253 }
55254
55255 uint64_t  __attribute__((export_name("TS_InvoiceRequest_issuer"))) TS_InvoiceRequest_issuer(uint64_t this_arg) {
55256         LDKInvoiceRequest this_arg_conv;
55257         this_arg_conv.inner = untag_ptr(this_arg);
55258         this_arg_conv.is_owned = ptr_is_owned(this_arg);
55259         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
55260         this_arg_conv.is_owned = false;
55261         LDKPrintableString ret_var = InvoiceRequest_issuer(&this_arg_conv);
55262         uint64_t ret_ref = 0;
55263         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
55264         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
55265         return ret_ref;
55266 }
55267
55268 uint64_tArray  __attribute__((export_name("TS_InvoiceRequest_paths"))) TS_InvoiceRequest_paths(uint64_t this_arg) {
55269         LDKInvoiceRequest this_arg_conv;
55270         this_arg_conv.inner = untag_ptr(this_arg);
55271         this_arg_conv.is_owned = ptr_is_owned(this_arg);
55272         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
55273         this_arg_conv.is_owned = false;
55274         LDKCVec_BlindedPathZ ret_var = InvoiceRequest_paths(&this_arg_conv);
55275         uint64_tArray ret_arr = NULL;
55276         ret_arr = init_uint64_tArray(ret_var.datalen, __LINE__);
55277         uint64_t *ret_arr_ptr = (uint64_t*)(((uint8_t*)ret_arr) + 8);
55278         for (size_t n = 0; n < ret_var.datalen; n++) {
55279                 LDKBlindedPath ret_conv_13_var = ret_var.data[n];
55280                 uint64_t ret_conv_13_ref = 0;
55281                 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_conv_13_var);
55282                 ret_conv_13_ref = tag_ptr(ret_conv_13_var.inner, ret_conv_13_var.is_owned);
55283                 ret_arr_ptr[n] = ret_conv_13_ref;
55284         }
55285         
55286         FREE(ret_var.data);
55287         return ret_arr;
55288 }
55289
55290 uint64_t  __attribute__((export_name("TS_InvoiceRequest_supported_quantity"))) TS_InvoiceRequest_supported_quantity(uint64_t this_arg) {
55291         LDKInvoiceRequest this_arg_conv;
55292         this_arg_conv.inner = untag_ptr(this_arg);
55293         this_arg_conv.is_owned = ptr_is_owned(this_arg);
55294         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
55295         this_arg_conv.is_owned = false;
55296         LDKQuantity ret_var = InvoiceRequest_supported_quantity(&this_arg_conv);
55297         uint64_t ret_ref = 0;
55298         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
55299         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
55300         return ret_ref;
55301 }
55302
55303 int8_tArray  __attribute__((export_name("TS_InvoiceRequest_signing_pubkey"))) TS_InvoiceRequest_signing_pubkey(uint64_t this_arg) {
55304         LDKInvoiceRequest this_arg_conv;
55305         this_arg_conv.inner = untag_ptr(this_arg);
55306         this_arg_conv.is_owned = ptr_is_owned(this_arg);
55307         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
55308         this_arg_conv.is_owned = false;
55309         int8_tArray ret_arr = init_int8_tArray(33, __LINE__);
55310         memcpy(ret_arr->elems, InvoiceRequest_signing_pubkey(&this_arg_conv).compressed_form, 33);
55311         return ret_arr;
55312 }
55313
55314 int8_tArray  __attribute__((export_name("TS_InvoiceRequest_payer_metadata"))) TS_InvoiceRequest_payer_metadata(uint64_t this_arg) {
55315         LDKInvoiceRequest this_arg_conv;
55316         this_arg_conv.inner = untag_ptr(this_arg);
55317         this_arg_conv.is_owned = ptr_is_owned(this_arg);
55318         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
55319         this_arg_conv.is_owned = false;
55320         LDKu8slice ret_var = InvoiceRequest_payer_metadata(&this_arg_conv);
55321         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
55322         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
55323         return ret_arr;
55324 }
55325
55326 int8_tArray  __attribute__((export_name("TS_InvoiceRequest_chain"))) TS_InvoiceRequest_chain(uint64_t this_arg) {
55327         LDKInvoiceRequest this_arg_conv;
55328         this_arg_conv.inner = untag_ptr(this_arg);
55329         this_arg_conv.is_owned = ptr_is_owned(this_arg);
55330         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
55331         this_arg_conv.is_owned = false;
55332         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
55333         memcpy(ret_arr->elems, InvoiceRequest_chain(&this_arg_conv).data, 32);
55334         return ret_arr;
55335 }
55336
55337 uint64_t  __attribute__((export_name("TS_InvoiceRequest_amount_msats"))) TS_InvoiceRequest_amount_msats(uint64_t this_arg) {
55338         LDKInvoiceRequest this_arg_conv;
55339         this_arg_conv.inner = untag_ptr(this_arg);
55340         this_arg_conv.is_owned = ptr_is_owned(this_arg);
55341         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
55342         this_arg_conv.is_owned = false;
55343         LDKCOption_u64Z *ret_copy = MALLOC(sizeof(LDKCOption_u64Z), "LDKCOption_u64Z");
55344         *ret_copy = InvoiceRequest_amount_msats(&this_arg_conv);
55345         uint64_t ret_ref = tag_ptr(ret_copy, true);
55346         return ret_ref;
55347 }
55348
55349 uint64_t  __attribute__((export_name("TS_InvoiceRequest_invoice_request_features"))) TS_InvoiceRequest_invoice_request_features(uint64_t this_arg) {
55350         LDKInvoiceRequest this_arg_conv;
55351         this_arg_conv.inner = untag_ptr(this_arg);
55352         this_arg_conv.is_owned = ptr_is_owned(this_arg);
55353         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
55354         this_arg_conv.is_owned = false;
55355         LDKInvoiceRequestFeatures ret_var = InvoiceRequest_invoice_request_features(&this_arg_conv);
55356         uint64_t ret_ref = 0;
55357         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
55358         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
55359         return ret_ref;
55360 }
55361
55362 uint64_t  __attribute__((export_name("TS_InvoiceRequest_quantity"))) TS_InvoiceRequest_quantity(uint64_t this_arg) {
55363         LDKInvoiceRequest this_arg_conv;
55364         this_arg_conv.inner = untag_ptr(this_arg);
55365         this_arg_conv.is_owned = ptr_is_owned(this_arg);
55366         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
55367         this_arg_conv.is_owned = false;
55368         LDKCOption_u64Z *ret_copy = MALLOC(sizeof(LDKCOption_u64Z), "LDKCOption_u64Z");
55369         *ret_copy = InvoiceRequest_quantity(&this_arg_conv);
55370         uint64_t ret_ref = tag_ptr(ret_copy, true);
55371         return ret_ref;
55372 }
55373
55374 int8_tArray  __attribute__((export_name("TS_InvoiceRequest_payer_id"))) TS_InvoiceRequest_payer_id(uint64_t this_arg) {
55375         LDKInvoiceRequest this_arg_conv;
55376         this_arg_conv.inner = untag_ptr(this_arg);
55377         this_arg_conv.is_owned = ptr_is_owned(this_arg);
55378         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
55379         this_arg_conv.is_owned = false;
55380         int8_tArray ret_arr = init_int8_tArray(33, __LINE__);
55381         memcpy(ret_arr->elems, InvoiceRequest_payer_id(&this_arg_conv).compressed_form, 33);
55382         return ret_arr;
55383 }
55384
55385 uint64_t  __attribute__((export_name("TS_InvoiceRequest_payer_note"))) TS_InvoiceRequest_payer_note(uint64_t this_arg) {
55386         LDKInvoiceRequest this_arg_conv;
55387         this_arg_conv.inner = untag_ptr(this_arg);
55388         this_arg_conv.is_owned = ptr_is_owned(this_arg);
55389         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
55390         this_arg_conv.is_owned = false;
55391         LDKPrintableString ret_var = InvoiceRequest_payer_note(&this_arg_conv);
55392         uint64_t ret_ref = 0;
55393         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
55394         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
55395         return ret_ref;
55396 }
55397
55398 int8_tArray  __attribute__((export_name("TS_InvoiceRequest_signature"))) TS_InvoiceRequest_signature(uint64_t this_arg) {
55399         LDKInvoiceRequest this_arg_conv;
55400         this_arg_conv.inner = untag_ptr(this_arg);
55401         this_arg_conv.is_owned = ptr_is_owned(this_arg);
55402         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
55403         this_arg_conv.is_owned = false;
55404         int8_tArray ret_arr = init_int8_tArray(64, __LINE__);
55405         memcpy(ret_arr->elems, InvoiceRequest_signature(&this_arg_conv).compact_form, 64);
55406         return ret_arr;
55407 }
55408
55409 uint64_t  __attribute__((export_name("TS_InvoiceRequest_verify"))) TS_InvoiceRequest_verify(uint64_t this_arg, uint64_t key) {
55410         LDKInvoiceRequest this_arg_conv;
55411         this_arg_conv.inner = untag_ptr(this_arg);
55412         this_arg_conv.is_owned = ptr_is_owned(this_arg);
55413         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
55414         this_arg_conv = InvoiceRequest_clone(&this_arg_conv);
55415         LDKExpandedKey key_conv;
55416         key_conv.inner = untag_ptr(key);
55417         key_conv.is_owned = ptr_is_owned(key);
55418         CHECK_INNER_FIELD_ACCESS_OR_NULL(key_conv);
55419         key_conv.is_owned = false;
55420         LDKCResult_VerifiedInvoiceRequestNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_VerifiedInvoiceRequestNoneZ), "LDKCResult_VerifiedInvoiceRequestNoneZ");
55421         *ret_conv = InvoiceRequest_verify(this_arg_conv, &key_conv);
55422         return tag_ptr(ret_conv, true);
55423 }
55424
55425 ptrArray  __attribute__((export_name("TS_VerifiedInvoiceRequest_chains"))) TS_VerifiedInvoiceRequest_chains(uint64_t this_arg) {
55426         LDKVerifiedInvoiceRequest this_arg_conv;
55427         this_arg_conv.inner = untag_ptr(this_arg);
55428         this_arg_conv.is_owned = ptr_is_owned(this_arg);
55429         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
55430         this_arg_conv.is_owned = false;
55431         LDKCVec_ThirtyTwoBytesZ ret_var = VerifiedInvoiceRequest_chains(&this_arg_conv);
55432         ptrArray ret_arr = NULL;
55433         ret_arr = init_ptrArray(ret_var.datalen, __LINE__);
55434         int8_tArray *ret_arr_ptr = (int8_tArray*)(((uint8_t*)ret_arr) + 8);
55435         for (size_t m = 0; m < ret_var.datalen; m++) {
55436                 int8_tArray ret_conv_12_arr = init_int8_tArray(32, __LINE__);
55437                 memcpy(ret_conv_12_arr->elems, ret_var.data[m].data, 32);
55438                 ret_arr_ptr[m] = ret_conv_12_arr;
55439         }
55440         
55441         FREE(ret_var.data);
55442         return ret_arr;
55443 }
55444
55445 uint64_t  __attribute__((export_name("TS_VerifiedInvoiceRequest_metadata"))) TS_VerifiedInvoiceRequest_metadata(uint64_t this_arg) {
55446         LDKVerifiedInvoiceRequest this_arg_conv;
55447         this_arg_conv.inner = untag_ptr(this_arg);
55448         this_arg_conv.is_owned = ptr_is_owned(this_arg);
55449         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
55450         this_arg_conv.is_owned = false;
55451         LDKCOption_CVec_u8ZZ *ret_copy = MALLOC(sizeof(LDKCOption_CVec_u8ZZ), "LDKCOption_CVec_u8ZZ");
55452         *ret_copy = VerifiedInvoiceRequest_metadata(&this_arg_conv);
55453         uint64_t ret_ref = tag_ptr(ret_copy, true);
55454         return ret_ref;
55455 }
55456
55457 uint64_t  __attribute__((export_name("TS_VerifiedInvoiceRequest_amount"))) TS_VerifiedInvoiceRequest_amount(uint64_t this_arg) {
55458         LDKVerifiedInvoiceRequest this_arg_conv;
55459         this_arg_conv.inner = untag_ptr(this_arg);
55460         this_arg_conv.is_owned = ptr_is_owned(this_arg);
55461         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
55462         this_arg_conv.is_owned = false;
55463         LDKAmount ret_var = VerifiedInvoiceRequest_amount(&this_arg_conv);
55464         uint64_t ret_ref = 0;
55465         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
55466         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
55467         return ret_ref;
55468 }
55469
55470 uint64_t  __attribute__((export_name("TS_VerifiedInvoiceRequest_description"))) TS_VerifiedInvoiceRequest_description(uint64_t this_arg) {
55471         LDKVerifiedInvoiceRequest this_arg_conv;
55472         this_arg_conv.inner = untag_ptr(this_arg);
55473         this_arg_conv.is_owned = ptr_is_owned(this_arg);
55474         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
55475         this_arg_conv.is_owned = false;
55476         LDKPrintableString ret_var = VerifiedInvoiceRequest_description(&this_arg_conv);
55477         uint64_t ret_ref = 0;
55478         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
55479         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
55480         return ret_ref;
55481 }
55482
55483 uint64_t  __attribute__((export_name("TS_VerifiedInvoiceRequest_offer_features"))) TS_VerifiedInvoiceRequest_offer_features(uint64_t this_arg) {
55484         LDKVerifiedInvoiceRequest this_arg_conv;
55485         this_arg_conv.inner = untag_ptr(this_arg);
55486         this_arg_conv.is_owned = ptr_is_owned(this_arg);
55487         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
55488         this_arg_conv.is_owned = false;
55489         LDKOfferFeatures ret_var = VerifiedInvoiceRequest_offer_features(&this_arg_conv);
55490         uint64_t ret_ref = 0;
55491         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
55492         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
55493         return ret_ref;
55494 }
55495
55496 uint64_t  __attribute__((export_name("TS_VerifiedInvoiceRequest_absolute_expiry"))) TS_VerifiedInvoiceRequest_absolute_expiry(uint64_t this_arg) {
55497         LDKVerifiedInvoiceRequest this_arg_conv;
55498         this_arg_conv.inner = untag_ptr(this_arg);
55499         this_arg_conv.is_owned = ptr_is_owned(this_arg);
55500         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
55501         this_arg_conv.is_owned = false;
55502         LDKCOption_u64Z *ret_copy = MALLOC(sizeof(LDKCOption_u64Z), "LDKCOption_u64Z");
55503         *ret_copy = VerifiedInvoiceRequest_absolute_expiry(&this_arg_conv);
55504         uint64_t ret_ref = tag_ptr(ret_copy, true);
55505         return ret_ref;
55506 }
55507
55508 uint64_t  __attribute__((export_name("TS_VerifiedInvoiceRequest_issuer"))) TS_VerifiedInvoiceRequest_issuer(uint64_t this_arg) {
55509         LDKVerifiedInvoiceRequest this_arg_conv;
55510         this_arg_conv.inner = untag_ptr(this_arg);
55511         this_arg_conv.is_owned = ptr_is_owned(this_arg);
55512         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
55513         this_arg_conv.is_owned = false;
55514         LDKPrintableString ret_var = VerifiedInvoiceRequest_issuer(&this_arg_conv);
55515         uint64_t ret_ref = 0;
55516         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
55517         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
55518         return ret_ref;
55519 }
55520
55521 uint64_tArray  __attribute__((export_name("TS_VerifiedInvoiceRequest_paths"))) TS_VerifiedInvoiceRequest_paths(uint64_t this_arg) {
55522         LDKVerifiedInvoiceRequest this_arg_conv;
55523         this_arg_conv.inner = untag_ptr(this_arg);
55524         this_arg_conv.is_owned = ptr_is_owned(this_arg);
55525         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
55526         this_arg_conv.is_owned = false;
55527         LDKCVec_BlindedPathZ ret_var = VerifiedInvoiceRequest_paths(&this_arg_conv);
55528         uint64_tArray ret_arr = NULL;
55529         ret_arr = init_uint64_tArray(ret_var.datalen, __LINE__);
55530         uint64_t *ret_arr_ptr = (uint64_t*)(((uint8_t*)ret_arr) + 8);
55531         for (size_t n = 0; n < ret_var.datalen; n++) {
55532                 LDKBlindedPath ret_conv_13_var = ret_var.data[n];
55533                 uint64_t ret_conv_13_ref = 0;
55534                 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_conv_13_var);
55535                 ret_conv_13_ref = tag_ptr(ret_conv_13_var.inner, ret_conv_13_var.is_owned);
55536                 ret_arr_ptr[n] = ret_conv_13_ref;
55537         }
55538         
55539         FREE(ret_var.data);
55540         return ret_arr;
55541 }
55542
55543 uint64_t  __attribute__((export_name("TS_VerifiedInvoiceRequest_supported_quantity"))) TS_VerifiedInvoiceRequest_supported_quantity(uint64_t this_arg) {
55544         LDKVerifiedInvoiceRequest this_arg_conv;
55545         this_arg_conv.inner = untag_ptr(this_arg);
55546         this_arg_conv.is_owned = ptr_is_owned(this_arg);
55547         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
55548         this_arg_conv.is_owned = false;
55549         LDKQuantity ret_var = VerifiedInvoiceRequest_supported_quantity(&this_arg_conv);
55550         uint64_t ret_ref = 0;
55551         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
55552         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
55553         return ret_ref;
55554 }
55555
55556 int8_tArray  __attribute__((export_name("TS_VerifiedInvoiceRequest_signing_pubkey"))) TS_VerifiedInvoiceRequest_signing_pubkey(uint64_t this_arg) {
55557         LDKVerifiedInvoiceRequest this_arg_conv;
55558         this_arg_conv.inner = untag_ptr(this_arg);
55559         this_arg_conv.is_owned = ptr_is_owned(this_arg);
55560         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
55561         this_arg_conv.is_owned = false;
55562         int8_tArray ret_arr = init_int8_tArray(33, __LINE__);
55563         memcpy(ret_arr->elems, VerifiedInvoiceRequest_signing_pubkey(&this_arg_conv).compressed_form, 33);
55564         return ret_arr;
55565 }
55566
55567 int8_tArray  __attribute__((export_name("TS_VerifiedInvoiceRequest_payer_metadata"))) TS_VerifiedInvoiceRequest_payer_metadata(uint64_t this_arg) {
55568         LDKVerifiedInvoiceRequest this_arg_conv;
55569         this_arg_conv.inner = untag_ptr(this_arg);
55570         this_arg_conv.is_owned = ptr_is_owned(this_arg);
55571         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
55572         this_arg_conv.is_owned = false;
55573         LDKu8slice ret_var = VerifiedInvoiceRequest_payer_metadata(&this_arg_conv);
55574         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
55575         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
55576         return ret_arr;
55577 }
55578
55579 int8_tArray  __attribute__((export_name("TS_VerifiedInvoiceRequest_chain"))) TS_VerifiedInvoiceRequest_chain(uint64_t this_arg) {
55580         LDKVerifiedInvoiceRequest this_arg_conv;
55581         this_arg_conv.inner = untag_ptr(this_arg);
55582         this_arg_conv.is_owned = ptr_is_owned(this_arg);
55583         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
55584         this_arg_conv.is_owned = false;
55585         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
55586         memcpy(ret_arr->elems, VerifiedInvoiceRequest_chain(&this_arg_conv).data, 32);
55587         return ret_arr;
55588 }
55589
55590 uint64_t  __attribute__((export_name("TS_VerifiedInvoiceRequest_amount_msats"))) TS_VerifiedInvoiceRequest_amount_msats(uint64_t this_arg) {
55591         LDKVerifiedInvoiceRequest this_arg_conv;
55592         this_arg_conv.inner = untag_ptr(this_arg);
55593         this_arg_conv.is_owned = ptr_is_owned(this_arg);
55594         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
55595         this_arg_conv.is_owned = false;
55596         LDKCOption_u64Z *ret_copy = MALLOC(sizeof(LDKCOption_u64Z), "LDKCOption_u64Z");
55597         *ret_copy = VerifiedInvoiceRequest_amount_msats(&this_arg_conv);
55598         uint64_t ret_ref = tag_ptr(ret_copy, true);
55599         return ret_ref;
55600 }
55601
55602 uint64_t  __attribute__((export_name("TS_VerifiedInvoiceRequest_invoice_request_features"))) TS_VerifiedInvoiceRequest_invoice_request_features(uint64_t this_arg) {
55603         LDKVerifiedInvoiceRequest this_arg_conv;
55604         this_arg_conv.inner = untag_ptr(this_arg);
55605         this_arg_conv.is_owned = ptr_is_owned(this_arg);
55606         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
55607         this_arg_conv.is_owned = false;
55608         LDKInvoiceRequestFeatures ret_var = VerifiedInvoiceRequest_invoice_request_features(&this_arg_conv);
55609         uint64_t ret_ref = 0;
55610         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
55611         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
55612         return ret_ref;
55613 }
55614
55615 uint64_t  __attribute__((export_name("TS_VerifiedInvoiceRequest_quantity"))) TS_VerifiedInvoiceRequest_quantity(uint64_t this_arg) {
55616         LDKVerifiedInvoiceRequest this_arg_conv;
55617         this_arg_conv.inner = untag_ptr(this_arg);
55618         this_arg_conv.is_owned = ptr_is_owned(this_arg);
55619         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
55620         this_arg_conv.is_owned = false;
55621         LDKCOption_u64Z *ret_copy = MALLOC(sizeof(LDKCOption_u64Z), "LDKCOption_u64Z");
55622         *ret_copy = VerifiedInvoiceRequest_quantity(&this_arg_conv);
55623         uint64_t ret_ref = tag_ptr(ret_copy, true);
55624         return ret_ref;
55625 }
55626
55627 int8_tArray  __attribute__((export_name("TS_VerifiedInvoiceRequest_payer_id"))) TS_VerifiedInvoiceRequest_payer_id(uint64_t this_arg) {
55628         LDKVerifiedInvoiceRequest this_arg_conv;
55629         this_arg_conv.inner = untag_ptr(this_arg);
55630         this_arg_conv.is_owned = ptr_is_owned(this_arg);
55631         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
55632         this_arg_conv.is_owned = false;
55633         int8_tArray ret_arr = init_int8_tArray(33, __LINE__);
55634         memcpy(ret_arr->elems, VerifiedInvoiceRequest_payer_id(&this_arg_conv).compressed_form, 33);
55635         return ret_arr;
55636 }
55637
55638 uint64_t  __attribute__((export_name("TS_VerifiedInvoiceRequest_payer_note"))) TS_VerifiedInvoiceRequest_payer_note(uint64_t this_arg) {
55639         LDKVerifiedInvoiceRequest this_arg_conv;
55640         this_arg_conv.inner = untag_ptr(this_arg);
55641         this_arg_conv.is_owned = ptr_is_owned(this_arg);
55642         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
55643         this_arg_conv.is_owned = false;
55644         LDKPrintableString ret_var = VerifiedInvoiceRequest_payer_note(&this_arg_conv);
55645         uint64_t ret_ref = 0;
55646         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
55647         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
55648         return ret_ref;
55649 }
55650
55651 int8_tArray  __attribute__((export_name("TS_UnsignedInvoiceRequest_write"))) TS_UnsignedInvoiceRequest_write(uint64_t obj) {
55652         LDKUnsignedInvoiceRequest obj_conv;
55653         obj_conv.inner = untag_ptr(obj);
55654         obj_conv.is_owned = ptr_is_owned(obj);
55655         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
55656         obj_conv.is_owned = false;
55657         LDKCVec_u8Z ret_var = UnsignedInvoiceRequest_write(&obj_conv);
55658         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
55659         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
55660         CVec_u8Z_free(ret_var);
55661         return ret_arr;
55662 }
55663
55664 int8_tArray  __attribute__((export_name("TS_InvoiceRequest_write"))) TS_InvoiceRequest_write(uint64_t obj) {
55665         LDKInvoiceRequest obj_conv;
55666         obj_conv.inner = untag_ptr(obj);
55667         obj_conv.is_owned = ptr_is_owned(obj);
55668         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
55669         obj_conv.is_owned = false;
55670         LDKCVec_u8Z ret_var = InvoiceRequest_write(&obj_conv);
55671         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
55672         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
55673         CVec_u8Z_free(ret_var);
55674         return ret_arr;
55675 }
55676
55677 void  __attribute__((export_name("TS_TaggedHash_free"))) TS_TaggedHash_free(uint64_t this_obj) {
55678         LDKTaggedHash this_obj_conv;
55679         this_obj_conv.inner = untag_ptr(this_obj);
55680         this_obj_conv.is_owned = ptr_is_owned(this_obj);
55681         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
55682         TaggedHash_free(this_obj_conv);
55683 }
55684
55685 void  __attribute__((export_name("TS_Bolt12ParseError_free"))) TS_Bolt12ParseError_free(uint64_t this_obj) {
55686         LDKBolt12ParseError this_obj_conv;
55687         this_obj_conv.inner = untag_ptr(this_obj);
55688         this_obj_conv.is_owned = ptr_is_owned(this_obj);
55689         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
55690         Bolt12ParseError_free(this_obj_conv);
55691 }
55692
55693 static inline uint64_t Bolt12ParseError_clone_ptr(LDKBolt12ParseError *NONNULL_PTR arg) {
55694         LDKBolt12ParseError ret_var = Bolt12ParseError_clone(arg);
55695         uint64_t ret_ref = 0;
55696         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
55697         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
55698         return ret_ref;
55699 }
55700 int64_t  __attribute__((export_name("TS_Bolt12ParseError_clone_ptr"))) TS_Bolt12ParseError_clone_ptr(uint64_t arg) {
55701         LDKBolt12ParseError arg_conv;
55702         arg_conv.inner = untag_ptr(arg);
55703         arg_conv.is_owned = ptr_is_owned(arg);
55704         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
55705         arg_conv.is_owned = false;
55706         int64_t ret_conv = Bolt12ParseError_clone_ptr(&arg_conv);
55707         return ret_conv;
55708 }
55709
55710 uint64_t  __attribute__((export_name("TS_Bolt12ParseError_clone"))) TS_Bolt12ParseError_clone(uint64_t orig) {
55711         LDKBolt12ParseError orig_conv;
55712         orig_conv.inner = untag_ptr(orig);
55713         orig_conv.is_owned = ptr_is_owned(orig);
55714         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
55715         orig_conv.is_owned = false;
55716         LDKBolt12ParseError ret_var = Bolt12ParseError_clone(&orig_conv);
55717         uint64_t ret_ref = 0;
55718         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
55719         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
55720         return ret_ref;
55721 }
55722
55723 uint32_t  __attribute__((export_name("TS_Bolt12SemanticError_clone"))) TS_Bolt12SemanticError_clone(uint64_t orig) {
55724         LDKBolt12SemanticError* orig_conv = (LDKBolt12SemanticError*)untag_ptr(orig);
55725         uint32_t ret_conv = LDKBolt12SemanticError_to_js(Bolt12SemanticError_clone(orig_conv));
55726         return ret_conv;
55727 }
55728
55729 uint32_t  __attribute__((export_name("TS_Bolt12SemanticError_already_expired"))) TS_Bolt12SemanticError_already_expired() {
55730         uint32_t ret_conv = LDKBolt12SemanticError_to_js(Bolt12SemanticError_already_expired());
55731         return ret_conv;
55732 }
55733
55734 uint32_t  __attribute__((export_name("TS_Bolt12SemanticError_unsupported_chain"))) TS_Bolt12SemanticError_unsupported_chain() {
55735         uint32_t ret_conv = LDKBolt12SemanticError_to_js(Bolt12SemanticError_unsupported_chain());
55736         return ret_conv;
55737 }
55738
55739 uint32_t  __attribute__((export_name("TS_Bolt12SemanticError_unexpected_chain"))) TS_Bolt12SemanticError_unexpected_chain() {
55740         uint32_t ret_conv = LDKBolt12SemanticError_to_js(Bolt12SemanticError_unexpected_chain());
55741         return ret_conv;
55742 }
55743
55744 uint32_t  __attribute__((export_name("TS_Bolt12SemanticError_missing_amount"))) TS_Bolt12SemanticError_missing_amount() {
55745         uint32_t ret_conv = LDKBolt12SemanticError_to_js(Bolt12SemanticError_missing_amount());
55746         return ret_conv;
55747 }
55748
55749 uint32_t  __attribute__((export_name("TS_Bolt12SemanticError_invalid_amount"))) TS_Bolt12SemanticError_invalid_amount() {
55750         uint32_t ret_conv = LDKBolt12SemanticError_to_js(Bolt12SemanticError_invalid_amount());
55751         return ret_conv;
55752 }
55753
55754 uint32_t  __attribute__((export_name("TS_Bolt12SemanticError_insufficient_amount"))) TS_Bolt12SemanticError_insufficient_amount() {
55755         uint32_t ret_conv = LDKBolt12SemanticError_to_js(Bolt12SemanticError_insufficient_amount());
55756         return ret_conv;
55757 }
55758
55759 uint32_t  __attribute__((export_name("TS_Bolt12SemanticError_unexpected_amount"))) TS_Bolt12SemanticError_unexpected_amount() {
55760         uint32_t ret_conv = LDKBolt12SemanticError_to_js(Bolt12SemanticError_unexpected_amount());
55761         return ret_conv;
55762 }
55763
55764 uint32_t  __attribute__((export_name("TS_Bolt12SemanticError_unsupported_currency"))) TS_Bolt12SemanticError_unsupported_currency() {
55765         uint32_t ret_conv = LDKBolt12SemanticError_to_js(Bolt12SemanticError_unsupported_currency());
55766         return ret_conv;
55767 }
55768
55769 uint32_t  __attribute__((export_name("TS_Bolt12SemanticError_unknown_required_features"))) TS_Bolt12SemanticError_unknown_required_features() {
55770         uint32_t ret_conv = LDKBolt12SemanticError_to_js(Bolt12SemanticError_unknown_required_features());
55771         return ret_conv;
55772 }
55773
55774 uint32_t  __attribute__((export_name("TS_Bolt12SemanticError_unexpected_features"))) TS_Bolt12SemanticError_unexpected_features() {
55775         uint32_t ret_conv = LDKBolt12SemanticError_to_js(Bolt12SemanticError_unexpected_features());
55776         return ret_conv;
55777 }
55778
55779 uint32_t  __attribute__((export_name("TS_Bolt12SemanticError_missing_description"))) TS_Bolt12SemanticError_missing_description() {
55780         uint32_t ret_conv = LDKBolt12SemanticError_to_js(Bolt12SemanticError_missing_description());
55781         return ret_conv;
55782 }
55783
55784 uint32_t  __attribute__((export_name("TS_Bolt12SemanticError_missing_signing_pubkey"))) TS_Bolt12SemanticError_missing_signing_pubkey() {
55785         uint32_t ret_conv = LDKBolt12SemanticError_to_js(Bolt12SemanticError_missing_signing_pubkey());
55786         return ret_conv;
55787 }
55788
55789 uint32_t  __attribute__((export_name("TS_Bolt12SemanticError_invalid_signing_pubkey"))) TS_Bolt12SemanticError_invalid_signing_pubkey() {
55790         uint32_t ret_conv = LDKBolt12SemanticError_to_js(Bolt12SemanticError_invalid_signing_pubkey());
55791         return ret_conv;
55792 }
55793
55794 uint32_t  __attribute__((export_name("TS_Bolt12SemanticError_unexpected_signing_pubkey"))) TS_Bolt12SemanticError_unexpected_signing_pubkey() {
55795         uint32_t ret_conv = LDKBolt12SemanticError_to_js(Bolt12SemanticError_unexpected_signing_pubkey());
55796         return ret_conv;
55797 }
55798
55799 uint32_t  __attribute__((export_name("TS_Bolt12SemanticError_missing_quantity"))) TS_Bolt12SemanticError_missing_quantity() {
55800         uint32_t ret_conv = LDKBolt12SemanticError_to_js(Bolt12SemanticError_missing_quantity());
55801         return ret_conv;
55802 }
55803
55804 uint32_t  __attribute__((export_name("TS_Bolt12SemanticError_invalid_quantity"))) TS_Bolt12SemanticError_invalid_quantity() {
55805         uint32_t ret_conv = LDKBolt12SemanticError_to_js(Bolt12SemanticError_invalid_quantity());
55806         return ret_conv;
55807 }
55808
55809 uint32_t  __attribute__((export_name("TS_Bolt12SemanticError_unexpected_quantity"))) TS_Bolt12SemanticError_unexpected_quantity() {
55810         uint32_t ret_conv = LDKBolt12SemanticError_to_js(Bolt12SemanticError_unexpected_quantity());
55811         return ret_conv;
55812 }
55813
55814 uint32_t  __attribute__((export_name("TS_Bolt12SemanticError_invalid_metadata"))) TS_Bolt12SemanticError_invalid_metadata() {
55815         uint32_t ret_conv = LDKBolt12SemanticError_to_js(Bolt12SemanticError_invalid_metadata());
55816         return ret_conv;
55817 }
55818
55819 uint32_t  __attribute__((export_name("TS_Bolt12SemanticError_unexpected_metadata"))) TS_Bolt12SemanticError_unexpected_metadata() {
55820         uint32_t ret_conv = LDKBolt12SemanticError_to_js(Bolt12SemanticError_unexpected_metadata());
55821         return ret_conv;
55822 }
55823
55824 uint32_t  __attribute__((export_name("TS_Bolt12SemanticError_missing_payer_metadata"))) TS_Bolt12SemanticError_missing_payer_metadata() {
55825         uint32_t ret_conv = LDKBolt12SemanticError_to_js(Bolt12SemanticError_missing_payer_metadata());
55826         return ret_conv;
55827 }
55828
55829 uint32_t  __attribute__((export_name("TS_Bolt12SemanticError_missing_payer_id"))) TS_Bolt12SemanticError_missing_payer_id() {
55830         uint32_t ret_conv = LDKBolt12SemanticError_to_js(Bolt12SemanticError_missing_payer_id());
55831         return ret_conv;
55832 }
55833
55834 uint32_t  __attribute__((export_name("TS_Bolt12SemanticError_duplicate_payment_id"))) TS_Bolt12SemanticError_duplicate_payment_id() {
55835         uint32_t ret_conv = LDKBolt12SemanticError_to_js(Bolt12SemanticError_duplicate_payment_id());
55836         return ret_conv;
55837 }
55838
55839 uint32_t  __attribute__((export_name("TS_Bolt12SemanticError_missing_paths"))) TS_Bolt12SemanticError_missing_paths() {
55840         uint32_t ret_conv = LDKBolt12SemanticError_to_js(Bolt12SemanticError_missing_paths());
55841         return ret_conv;
55842 }
55843
55844 uint32_t  __attribute__((export_name("TS_Bolt12SemanticError_invalid_pay_info"))) TS_Bolt12SemanticError_invalid_pay_info() {
55845         uint32_t ret_conv = LDKBolt12SemanticError_to_js(Bolt12SemanticError_invalid_pay_info());
55846         return ret_conv;
55847 }
55848
55849 uint32_t  __attribute__((export_name("TS_Bolt12SemanticError_missing_creation_time"))) TS_Bolt12SemanticError_missing_creation_time() {
55850         uint32_t ret_conv = LDKBolt12SemanticError_to_js(Bolt12SemanticError_missing_creation_time());
55851         return ret_conv;
55852 }
55853
55854 uint32_t  __attribute__((export_name("TS_Bolt12SemanticError_missing_payment_hash"))) TS_Bolt12SemanticError_missing_payment_hash() {
55855         uint32_t ret_conv = LDKBolt12SemanticError_to_js(Bolt12SemanticError_missing_payment_hash());
55856         return ret_conv;
55857 }
55858
55859 uint32_t  __attribute__((export_name("TS_Bolt12SemanticError_missing_signature"))) TS_Bolt12SemanticError_missing_signature() {
55860         uint32_t ret_conv = LDKBolt12SemanticError_to_js(Bolt12SemanticError_missing_signature());
55861         return ret_conv;
55862 }
55863
55864 void  __attribute__((export_name("TS_Refund_free"))) TS_Refund_free(uint64_t this_obj) {
55865         LDKRefund this_obj_conv;
55866         this_obj_conv.inner = untag_ptr(this_obj);
55867         this_obj_conv.is_owned = ptr_is_owned(this_obj);
55868         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
55869         Refund_free(this_obj_conv);
55870 }
55871
55872 static inline uint64_t Refund_clone_ptr(LDKRefund *NONNULL_PTR arg) {
55873         LDKRefund ret_var = Refund_clone(arg);
55874         uint64_t ret_ref = 0;
55875         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
55876         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
55877         return ret_ref;
55878 }
55879 int64_t  __attribute__((export_name("TS_Refund_clone_ptr"))) TS_Refund_clone_ptr(uint64_t arg) {
55880         LDKRefund arg_conv;
55881         arg_conv.inner = untag_ptr(arg);
55882         arg_conv.is_owned = ptr_is_owned(arg);
55883         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
55884         arg_conv.is_owned = false;
55885         int64_t ret_conv = Refund_clone_ptr(&arg_conv);
55886         return ret_conv;
55887 }
55888
55889 uint64_t  __attribute__((export_name("TS_Refund_clone"))) TS_Refund_clone(uint64_t orig) {
55890         LDKRefund orig_conv;
55891         orig_conv.inner = untag_ptr(orig);
55892         orig_conv.is_owned = ptr_is_owned(orig);
55893         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
55894         orig_conv.is_owned = false;
55895         LDKRefund ret_var = Refund_clone(&orig_conv);
55896         uint64_t ret_ref = 0;
55897         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
55898         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
55899         return ret_ref;
55900 }
55901
55902 uint64_t  __attribute__((export_name("TS_Refund_description"))) TS_Refund_description(uint64_t this_arg) {
55903         LDKRefund this_arg_conv;
55904         this_arg_conv.inner = untag_ptr(this_arg);
55905         this_arg_conv.is_owned = ptr_is_owned(this_arg);
55906         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
55907         this_arg_conv.is_owned = false;
55908         LDKPrintableString ret_var = Refund_description(&this_arg_conv);
55909         uint64_t ret_ref = 0;
55910         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
55911         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
55912         return ret_ref;
55913 }
55914
55915 uint64_t  __attribute__((export_name("TS_Refund_absolute_expiry"))) TS_Refund_absolute_expiry(uint64_t this_arg) {
55916         LDKRefund this_arg_conv;
55917         this_arg_conv.inner = untag_ptr(this_arg);
55918         this_arg_conv.is_owned = ptr_is_owned(this_arg);
55919         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
55920         this_arg_conv.is_owned = false;
55921         LDKCOption_u64Z *ret_copy = MALLOC(sizeof(LDKCOption_u64Z), "LDKCOption_u64Z");
55922         *ret_copy = Refund_absolute_expiry(&this_arg_conv);
55923         uint64_t ret_ref = tag_ptr(ret_copy, true);
55924         return ret_ref;
55925 }
55926
55927 uint64_t  __attribute__((export_name("TS_Refund_issuer"))) TS_Refund_issuer(uint64_t this_arg) {
55928         LDKRefund this_arg_conv;
55929         this_arg_conv.inner = untag_ptr(this_arg);
55930         this_arg_conv.is_owned = ptr_is_owned(this_arg);
55931         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
55932         this_arg_conv.is_owned = false;
55933         LDKPrintableString ret_var = Refund_issuer(&this_arg_conv);
55934         uint64_t ret_ref = 0;
55935         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
55936         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
55937         return ret_ref;
55938 }
55939
55940 uint64_tArray  __attribute__((export_name("TS_Refund_paths"))) TS_Refund_paths(uint64_t this_arg) {
55941         LDKRefund this_arg_conv;
55942         this_arg_conv.inner = untag_ptr(this_arg);
55943         this_arg_conv.is_owned = ptr_is_owned(this_arg);
55944         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
55945         this_arg_conv.is_owned = false;
55946         LDKCVec_BlindedPathZ ret_var = Refund_paths(&this_arg_conv);
55947         uint64_tArray ret_arr = NULL;
55948         ret_arr = init_uint64_tArray(ret_var.datalen, __LINE__);
55949         uint64_t *ret_arr_ptr = (uint64_t*)(((uint8_t*)ret_arr) + 8);
55950         for (size_t n = 0; n < ret_var.datalen; n++) {
55951                 LDKBlindedPath ret_conv_13_var = ret_var.data[n];
55952                 uint64_t ret_conv_13_ref = 0;
55953                 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_conv_13_var);
55954                 ret_conv_13_ref = tag_ptr(ret_conv_13_var.inner, ret_conv_13_var.is_owned);
55955                 ret_arr_ptr[n] = ret_conv_13_ref;
55956         }
55957         
55958         FREE(ret_var.data);
55959         return ret_arr;
55960 }
55961
55962 int8_tArray  __attribute__((export_name("TS_Refund_payer_metadata"))) TS_Refund_payer_metadata(uint64_t this_arg) {
55963         LDKRefund this_arg_conv;
55964         this_arg_conv.inner = untag_ptr(this_arg);
55965         this_arg_conv.is_owned = ptr_is_owned(this_arg);
55966         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
55967         this_arg_conv.is_owned = false;
55968         LDKu8slice ret_var = Refund_payer_metadata(&this_arg_conv);
55969         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
55970         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
55971         return ret_arr;
55972 }
55973
55974 int8_tArray  __attribute__((export_name("TS_Refund_chain"))) TS_Refund_chain(uint64_t this_arg) {
55975         LDKRefund this_arg_conv;
55976         this_arg_conv.inner = untag_ptr(this_arg);
55977         this_arg_conv.is_owned = ptr_is_owned(this_arg);
55978         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
55979         this_arg_conv.is_owned = false;
55980         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
55981         memcpy(ret_arr->elems, Refund_chain(&this_arg_conv).data, 32);
55982         return ret_arr;
55983 }
55984
55985 int64_t  __attribute__((export_name("TS_Refund_amount_msats"))) TS_Refund_amount_msats(uint64_t this_arg) {
55986         LDKRefund this_arg_conv;
55987         this_arg_conv.inner = untag_ptr(this_arg);
55988         this_arg_conv.is_owned = ptr_is_owned(this_arg);
55989         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
55990         this_arg_conv.is_owned = false;
55991         int64_t ret_conv = Refund_amount_msats(&this_arg_conv);
55992         return ret_conv;
55993 }
55994
55995 uint64_t  __attribute__((export_name("TS_Refund_features"))) TS_Refund_features(uint64_t this_arg) {
55996         LDKRefund this_arg_conv;
55997         this_arg_conv.inner = untag_ptr(this_arg);
55998         this_arg_conv.is_owned = ptr_is_owned(this_arg);
55999         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
56000         this_arg_conv.is_owned = false;
56001         LDKInvoiceRequestFeatures ret_var = Refund_features(&this_arg_conv);
56002         uint64_t ret_ref = 0;
56003         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
56004         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
56005         return ret_ref;
56006 }
56007
56008 uint64_t  __attribute__((export_name("TS_Refund_quantity"))) TS_Refund_quantity(uint64_t this_arg) {
56009         LDKRefund this_arg_conv;
56010         this_arg_conv.inner = untag_ptr(this_arg);
56011         this_arg_conv.is_owned = ptr_is_owned(this_arg);
56012         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
56013         this_arg_conv.is_owned = false;
56014         LDKCOption_u64Z *ret_copy = MALLOC(sizeof(LDKCOption_u64Z), "LDKCOption_u64Z");
56015         *ret_copy = Refund_quantity(&this_arg_conv);
56016         uint64_t ret_ref = tag_ptr(ret_copy, true);
56017         return ret_ref;
56018 }
56019
56020 int8_tArray  __attribute__((export_name("TS_Refund_payer_id"))) TS_Refund_payer_id(uint64_t this_arg) {
56021         LDKRefund this_arg_conv;
56022         this_arg_conv.inner = untag_ptr(this_arg);
56023         this_arg_conv.is_owned = ptr_is_owned(this_arg);
56024         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
56025         this_arg_conv.is_owned = false;
56026         int8_tArray ret_arr = init_int8_tArray(33, __LINE__);
56027         memcpy(ret_arr->elems, Refund_payer_id(&this_arg_conv).compressed_form, 33);
56028         return ret_arr;
56029 }
56030
56031 uint64_t  __attribute__((export_name("TS_Refund_payer_note"))) TS_Refund_payer_note(uint64_t this_arg) {
56032         LDKRefund this_arg_conv;
56033         this_arg_conv.inner = untag_ptr(this_arg);
56034         this_arg_conv.is_owned = ptr_is_owned(this_arg);
56035         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
56036         this_arg_conv.is_owned = false;
56037         LDKPrintableString ret_var = Refund_payer_note(&this_arg_conv);
56038         uint64_t ret_ref = 0;
56039         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
56040         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
56041         return ret_ref;
56042 }
56043
56044 int8_tArray  __attribute__((export_name("TS_Refund_write"))) TS_Refund_write(uint64_t obj) {
56045         LDKRefund obj_conv;
56046         obj_conv.inner = untag_ptr(obj);
56047         obj_conv.is_owned = ptr_is_owned(obj);
56048         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
56049         obj_conv.is_owned = false;
56050         LDKCVec_u8Z ret_var = Refund_write(&obj_conv);
56051         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
56052         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
56053         CVec_u8Z_free(ret_var);
56054         return ret_arr;
56055 }
56056
56057 uint64_t  __attribute__((export_name("TS_Refund_from_str"))) TS_Refund_from_str(jstring s) {
56058         LDKStr s_conv = str_ref_to_owned_c(s);
56059         LDKCResult_RefundBolt12ParseErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RefundBolt12ParseErrorZ), "LDKCResult_RefundBolt12ParseErrorZ");
56060         *ret_conv = Refund_from_str(s_conv);
56061         return tag_ptr(ret_conv, true);
56062 }
56063
56064 uint32_t  __attribute__((export_name("TS_UtxoLookupError_clone"))) TS_UtxoLookupError_clone(uint64_t orig) {
56065         LDKUtxoLookupError* orig_conv = (LDKUtxoLookupError*)untag_ptr(orig);
56066         uint32_t ret_conv = LDKUtxoLookupError_to_js(UtxoLookupError_clone(orig_conv));
56067         return ret_conv;
56068 }
56069
56070 uint32_t  __attribute__((export_name("TS_UtxoLookupError_unknown_chain"))) TS_UtxoLookupError_unknown_chain() {
56071         uint32_t ret_conv = LDKUtxoLookupError_to_js(UtxoLookupError_unknown_chain());
56072         return ret_conv;
56073 }
56074
56075 uint32_t  __attribute__((export_name("TS_UtxoLookupError_unknown_tx"))) TS_UtxoLookupError_unknown_tx() {
56076         uint32_t ret_conv = LDKUtxoLookupError_to_js(UtxoLookupError_unknown_tx());
56077         return ret_conv;
56078 }
56079
56080 void  __attribute__((export_name("TS_UtxoResult_free"))) TS_UtxoResult_free(uint64_t this_ptr) {
56081         if (!ptr_is_owned(this_ptr)) return;
56082         void* this_ptr_ptr = untag_ptr(this_ptr);
56083         CHECK_ACCESS(this_ptr_ptr);
56084         LDKUtxoResult this_ptr_conv = *(LDKUtxoResult*)(this_ptr_ptr);
56085         FREE(untag_ptr(this_ptr));
56086         UtxoResult_free(this_ptr_conv);
56087 }
56088
56089 static inline uint64_t UtxoResult_clone_ptr(LDKUtxoResult *NONNULL_PTR arg) {
56090         LDKUtxoResult *ret_copy = MALLOC(sizeof(LDKUtxoResult), "LDKUtxoResult");
56091         *ret_copy = UtxoResult_clone(arg);
56092         uint64_t ret_ref = tag_ptr(ret_copy, true);
56093         return ret_ref;
56094 }
56095 int64_t  __attribute__((export_name("TS_UtxoResult_clone_ptr"))) TS_UtxoResult_clone_ptr(uint64_t arg) {
56096         LDKUtxoResult* arg_conv = (LDKUtxoResult*)untag_ptr(arg);
56097         int64_t ret_conv = UtxoResult_clone_ptr(arg_conv);
56098         return ret_conv;
56099 }
56100
56101 uint64_t  __attribute__((export_name("TS_UtxoResult_clone"))) TS_UtxoResult_clone(uint64_t orig) {
56102         LDKUtxoResult* orig_conv = (LDKUtxoResult*)untag_ptr(orig);
56103         LDKUtxoResult *ret_copy = MALLOC(sizeof(LDKUtxoResult), "LDKUtxoResult");
56104         *ret_copy = UtxoResult_clone(orig_conv);
56105         uint64_t ret_ref = tag_ptr(ret_copy, true);
56106         return ret_ref;
56107 }
56108
56109 uint64_t  __attribute__((export_name("TS_UtxoResult_sync"))) TS_UtxoResult_sync(uint64_t a) {
56110         void* a_ptr = untag_ptr(a);
56111         CHECK_ACCESS(a_ptr);
56112         LDKCResult_TxOutUtxoLookupErrorZ a_conv = *(LDKCResult_TxOutUtxoLookupErrorZ*)(a_ptr);
56113         a_conv = CResult_TxOutUtxoLookupErrorZ_clone((LDKCResult_TxOutUtxoLookupErrorZ*)untag_ptr(a));
56114         LDKUtxoResult *ret_copy = MALLOC(sizeof(LDKUtxoResult), "LDKUtxoResult");
56115         *ret_copy = UtxoResult_sync(a_conv);
56116         uint64_t ret_ref = tag_ptr(ret_copy, true);
56117         return ret_ref;
56118 }
56119
56120 uint64_t  __attribute__((export_name("TS_UtxoResult_async"))) TS_UtxoResult_async(uint64_t a) {
56121         LDKUtxoFuture a_conv;
56122         a_conv.inner = untag_ptr(a);
56123         a_conv.is_owned = ptr_is_owned(a);
56124         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
56125         a_conv = UtxoFuture_clone(&a_conv);
56126         LDKUtxoResult *ret_copy = MALLOC(sizeof(LDKUtxoResult), "LDKUtxoResult");
56127         *ret_copy = UtxoResult_async(a_conv);
56128         uint64_t ret_ref = tag_ptr(ret_copy, true);
56129         return ret_ref;
56130 }
56131
56132 void  __attribute__((export_name("TS_UtxoLookup_free"))) TS_UtxoLookup_free(uint64_t this_ptr) {
56133         if (!ptr_is_owned(this_ptr)) return;
56134         void* this_ptr_ptr = untag_ptr(this_ptr);
56135         CHECK_ACCESS(this_ptr_ptr);
56136         LDKUtxoLookup this_ptr_conv = *(LDKUtxoLookup*)(this_ptr_ptr);
56137         FREE(untag_ptr(this_ptr));
56138         UtxoLookup_free(this_ptr_conv);
56139 }
56140
56141 void  __attribute__((export_name("TS_UtxoFuture_free"))) TS_UtxoFuture_free(uint64_t this_obj) {
56142         LDKUtxoFuture this_obj_conv;
56143         this_obj_conv.inner = untag_ptr(this_obj);
56144         this_obj_conv.is_owned = ptr_is_owned(this_obj);
56145         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
56146         UtxoFuture_free(this_obj_conv);
56147 }
56148
56149 static inline uint64_t UtxoFuture_clone_ptr(LDKUtxoFuture *NONNULL_PTR arg) {
56150         LDKUtxoFuture ret_var = UtxoFuture_clone(arg);
56151         uint64_t ret_ref = 0;
56152         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
56153         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
56154         return ret_ref;
56155 }
56156 int64_t  __attribute__((export_name("TS_UtxoFuture_clone_ptr"))) TS_UtxoFuture_clone_ptr(uint64_t arg) {
56157         LDKUtxoFuture arg_conv;
56158         arg_conv.inner = untag_ptr(arg);
56159         arg_conv.is_owned = ptr_is_owned(arg);
56160         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
56161         arg_conv.is_owned = false;
56162         int64_t ret_conv = UtxoFuture_clone_ptr(&arg_conv);
56163         return ret_conv;
56164 }
56165
56166 uint64_t  __attribute__((export_name("TS_UtxoFuture_clone"))) TS_UtxoFuture_clone(uint64_t orig) {
56167         LDKUtxoFuture orig_conv;
56168         orig_conv.inner = untag_ptr(orig);
56169         orig_conv.is_owned = ptr_is_owned(orig);
56170         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
56171         orig_conv.is_owned = false;
56172         LDKUtxoFuture ret_var = UtxoFuture_clone(&orig_conv);
56173         uint64_t ret_ref = 0;
56174         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
56175         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
56176         return ret_ref;
56177 }
56178
56179 uint64_t  __attribute__((export_name("TS_UtxoFuture_new"))) TS_UtxoFuture_new() {
56180         LDKUtxoFuture ret_var = UtxoFuture_new();
56181         uint64_t ret_ref = 0;
56182         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
56183         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
56184         return ret_ref;
56185 }
56186
56187 void  __attribute__((export_name("TS_UtxoFuture_resolve_without_forwarding"))) TS_UtxoFuture_resolve_without_forwarding(uint64_t this_arg, uint64_t graph, uint64_t result) {
56188         LDKUtxoFuture this_arg_conv;
56189         this_arg_conv.inner = untag_ptr(this_arg);
56190         this_arg_conv.is_owned = ptr_is_owned(this_arg);
56191         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
56192         this_arg_conv.is_owned = false;
56193         LDKNetworkGraph graph_conv;
56194         graph_conv.inner = untag_ptr(graph);
56195         graph_conv.is_owned = ptr_is_owned(graph);
56196         CHECK_INNER_FIELD_ACCESS_OR_NULL(graph_conv);
56197         graph_conv.is_owned = false;
56198         void* result_ptr = untag_ptr(result);
56199         CHECK_ACCESS(result_ptr);
56200         LDKCResult_TxOutUtxoLookupErrorZ result_conv = *(LDKCResult_TxOutUtxoLookupErrorZ*)(result_ptr);
56201         UtxoFuture_resolve_without_forwarding(&this_arg_conv, &graph_conv, result_conv);
56202 }
56203
56204 void  __attribute__((export_name("TS_UtxoFuture_resolve"))) TS_UtxoFuture_resolve(uint64_t this_arg, uint64_t graph, uint64_t gossip, uint64_t result) {
56205         LDKUtxoFuture this_arg_conv;
56206         this_arg_conv.inner = untag_ptr(this_arg);
56207         this_arg_conv.is_owned = ptr_is_owned(this_arg);
56208         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
56209         this_arg_conv.is_owned = false;
56210         LDKNetworkGraph graph_conv;
56211         graph_conv.inner = untag_ptr(graph);
56212         graph_conv.is_owned = ptr_is_owned(graph);
56213         CHECK_INNER_FIELD_ACCESS_OR_NULL(graph_conv);
56214         graph_conv.is_owned = false;
56215         LDKP2PGossipSync gossip_conv;
56216         gossip_conv.inner = untag_ptr(gossip);
56217         gossip_conv.is_owned = ptr_is_owned(gossip);
56218         CHECK_INNER_FIELD_ACCESS_OR_NULL(gossip_conv);
56219         gossip_conv.is_owned = false;
56220         void* result_ptr = untag_ptr(result);
56221         CHECK_ACCESS(result_ptr);
56222         LDKCResult_TxOutUtxoLookupErrorZ result_conv = *(LDKCResult_TxOutUtxoLookupErrorZ*)(result_ptr);
56223         UtxoFuture_resolve(&this_arg_conv, &graph_conv, &gossip_conv, result_conv);
56224 }
56225
56226 void  __attribute__((export_name("TS_NodeId_free"))) TS_NodeId_free(uint64_t this_obj) {
56227         LDKNodeId this_obj_conv;
56228         this_obj_conv.inner = untag_ptr(this_obj);
56229         this_obj_conv.is_owned = ptr_is_owned(this_obj);
56230         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
56231         NodeId_free(this_obj_conv);
56232 }
56233
56234 static inline uint64_t NodeId_clone_ptr(LDKNodeId *NONNULL_PTR arg) {
56235         LDKNodeId ret_var = NodeId_clone(arg);
56236         uint64_t ret_ref = 0;
56237         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
56238         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
56239         return ret_ref;
56240 }
56241 int64_t  __attribute__((export_name("TS_NodeId_clone_ptr"))) TS_NodeId_clone_ptr(uint64_t arg) {
56242         LDKNodeId arg_conv;
56243         arg_conv.inner = untag_ptr(arg);
56244         arg_conv.is_owned = ptr_is_owned(arg);
56245         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
56246         arg_conv.is_owned = false;
56247         int64_t ret_conv = NodeId_clone_ptr(&arg_conv);
56248         return ret_conv;
56249 }
56250
56251 uint64_t  __attribute__((export_name("TS_NodeId_clone"))) TS_NodeId_clone(uint64_t orig) {
56252         LDKNodeId orig_conv;
56253         orig_conv.inner = untag_ptr(orig);
56254         orig_conv.is_owned = ptr_is_owned(orig);
56255         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
56256         orig_conv.is_owned = false;
56257         LDKNodeId ret_var = NodeId_clone(&orig_conv);
56258         uint64_t ret_ref = 0;
56259         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
56260         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
56261         return ret_ref;
56262 }
56263
56264 uint64_t  __attribute__((export_name("TS_NodeId_from_pubkey"))) TS_NodeId_from_pubkey(int8_tArray pubkey) {
56265         LDKPublicKey pubkey_ref;
56266         CHECK(pubkey->arr_len == 33);
56267         memcpy(pubkey_ref.compressed_form, pubkey->elems, 33); FREE(pubkey);
56268         LDKNodeId ret_var = NodeId_from_pubkey(pubkey_ref);
56269         uint64_t ret_ref = 0;
56270         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
56271         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
56272         return ret_ref;
56273 }
56274
56275 int8_tArray  __attribute__((export_name("TS_NodeId_as_slice"))) TS_NodeId_as_slice(uint64_t this_arg) {
56276         LDKNodeId this_arg_conv;
56277         this_arg_conv.inner = untag_ptr(this_arg);
56278         this_arg_conv.is_owned = ptr_is_owned(this_arg);
56279         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
56280         this_arg_conv.is_owned = false;
56281         LDKu8slice ret_var = NodeId_as_slice(&this_arg_conv);
56282         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
56283         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
56284         return ret_arr;
56285 }
56286
56287 uint64_t  __attribute__((export_name("TS_NodeId_as_pubkey"))) TS_NodeId_as_pubkey(uint64_t this_arg) {
56288         LDKNodeId this_arg_conv;
56289         this_arg_conv.inner = untag_ptr(this_arg);
56290         this_arg_conv.is_owned = ptr_is_owned(this_arg);
56291         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
56292         this_arg_conv.is_owned = false;
56293         LDKCResult_PublicKeySecp256k1ErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PublicKeySecp256k1ErrorZ), "LDKCResult_PublicKeySecp256k1ErrorZ");
56294         *ret_conv = NodeId_as_pubkey(&this_arg_conv);
56295         return tag_ptr(ret_conv, true);
56296 }
56297
56298 int64_t  __attribute__((export_name("TS_NodeId_hash"))) TS_NodeId_hash(uint64_t o) {
56299         LDKNodeId o_conv;
56300         o_conv.inner = untag_ptr(o);
56301         o_conv.is_owned = ptr_is_owned(o);
56302         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
56303         o_conv.is_owned = false;
56304         int64_t ret_conv = NodeId_hash(&o_conv);
56305         return ret_conv;
56306 }
56307
56308 int8_tArray  __attribute__((export_name("TS_NodeId_write"))) TS_NodeId_write(uint64_t obj) {
56309         LDKNodeId obj_conv;
56310         obj_conv.inner = untag_ptr(obj);
56311         obj_conv.is_owned = ptr_is_owned(obj);
56312         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
56313         obj_conv.is_owned = false;
56314         LDKCVec_u8Z ret_var = NodeId_write(&obj_conv);
56315         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
56316         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
56317         CVec_u8Z_free(ret_var);
56318         return ret_arr;
56319 }
56320
56321 uint64_t  __attribute__((export_name("TS_NodeId_read"))) TS_NodeId_read(int8_tArray ser) {
56322         LDKu8slice ser_ref;
56323         ser_ref.datalen = ser->arr_len;
56324         ser_ref.data = ser->elems;
56325         LDKCResult_NodeIdDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NodeIdDecodeErrorZ), "LDKCResult_NodeIdDecodeErrorZ");
56326         *ret_conv = NodeId_read(ser_ref);
56327         FREE(ser);
56328         return tag_ptr(ret_conv, true);
56329 }
56330
56331 void  __attribute__((export_name("TS_NetworkGraph_free"))) TS_NetworkGraph_free(uint64_t this_obj) {
56332         LDKNetworkGraph this_obj_conv;
56333         this_obj_conv.inner = untag_ptr(this_obj);
56334         this_obj_conv.is_owned = ptr_is_owned(this_obj);
56335         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
56336         NetworkGraph_free(this_obj_conv);
56337 }
56338
56339 void  __attribute__((export_name("TS_ReadOnlyNetworkGraph_free"))) TS_ReadOnlyNetworkGraph_free(uint64_t this_obj) {
56340         LDKReadOnlyNetworkGraph this_obj_conv;
56341         this_obj_conv.inner = untag_ptr(this_obj);
56342         this_obj_conv.is_owned = ptr_is_owned(this_obj);
56343         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
56344         ReadOnlyNetworkGraph_free(this_obj_conv);
56345 }
56346
56347 void  __attribute__((export_name("TS_NetworkUpdate_free"))) TS_NetworkUpdate_free(uint64_t this_ptr) {
56348         if (!ptr_is_owned(this_ptr)) return;
56349         void* this_ptr_ptr = untag_ptr(this_ptr);
56350         CHECK_ACCESS(this_ptr_ptr);
56351         LDKNetworkUpdate this_ptr_conv = *(LDKNetworkUpdate*)(this_ptr_ptr);
56352         FREE(untag_ptr(this_ptr));
56353         NetworkUpdate_free(this_ptr_conv);
56354 }
56355
56356 static inline uint64_t NetworkUpdate_clone_ptr(LDKNetworkUpdate *NONNULL_PTR arg) {
56357         LDKNetworkUpdate *ret_copy = MALLOC(sizeof(LDKNetworkUpdate), "LDKNetworkUpdate");
56358         *ret_copy = NetworkUpdate_clone(arg);
56359         uint64_t ret_ref = tag_ptr(ret_copy, true);
56360         return ret_ref;
56361 }
56362 int64_t  __attribute__((export_name("TS_NetworkUpdate_clone_ptr"))) TS_NetworkUpdate_clone_ptr(uint64_t arg) {
56363         LDKNetworkUpdate* arg_conv = (LDKNetworkUpdate*)untag_ptr(arg);
56364         int64_t ret_conv = NetworkUpdate_clone_ptr(arg_conv);
56365         return ret_conv;
56366 }
56367
56368 uint64_t  __attribute__((export_name("TS_NetworkUpdate_clone"))) TS_NetworkUpdate_clone(uint64_t orig) {
56369         LDKNetworkUpdate* orig_conv = (LDKNetworkUpdate*)untag_ptr(orig);
56370         LDKNetworkUpdate *ret_copy = MALLOC(sizeof(LDKNetworkUpdate), "LDKNetworkUpdate");
56371         *ret_copy = NetworkUpdate_clone(orig_conv);
56372         uint64_t ret_ref = tag_ptr(ret_copy, true);
56373         return ret_ref;
56374 }
56375
56376 uint64_t  __attribute__((export_name("TS_NetworkUpdate_channel_update_message"))) TS_NetworkUpdate_channel_update_message(uint64_t msg) {
56377         LDKChannelUpdate msg_conv;
56378         msg_conv.inner = untag_ptr(msg);
56379         msg_conv.is_owned = ptr_is_owned(msg);
56380         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
56381         msg_conv = ChannelUpdate_clone(&msg_conv);
56382         LDKNetworkUpdate *ret_copy = MALLOC(sizeof(LDKNetworkUpdate), "LDKNetworkUpdate");
56383         *ret_copy = NetworkUpdate_channel_update_message(msg_conv);
56384         uint64_t ret_ref = tag_ptr(ret_copy, true);
56385         return ret_ref;
56386 }
56387
56388 uint64_t  __attribute__((export_name("TS_NetworkUpdate_channel_failure"))) TS_NetworkUpdate_channel_failure(int64_t short_channel_id, jboolean is_permanent) {
56389         LDKNetworkUpdate *ret_copy = MALLOC(sizeof(LDKNetworkUpdate), "LDKNetworkUpdate");
56390         *ret_copy = NetworkUpdate_channel_failure(short_channel_id, is_permanent);
56391         uint64_t ret_ref = tag_ptr(ret_copy, true);
56392         return ret_ref;
56393 }
56394
56395 uint64_t  __attribute__((export_name("TS_NetworkUpdate_node_failure"))) TS_NetworkUpdate_node_failure(int8_tArray node_id, jboolean is_permanent) {
56396         LDKPublicKey node_id_ref;
56397         CHECK(node_id->arr_len == 33);
56398         memcpy(node_id_ref.compressed_form, node_id->elems, 33); FREE(node_id);
56399         LDKNetworkUpdate *ret_copy = MALLOC(sizeof(LDKNetworkUpdate), "LDKNetworkUpdate");
56400         *ret_copy = NetworkUpdate_node_failure(node_id_ref, is_permanent);
56401         uint64_t ret_ref = tag_ptr(ret_copy, true);
56402         return ret_ref;
56403 }
56404
56405 jboolean  __attribute__((export_name("TS_NetworkUpdate_eq"))) TS_NetworkUpdate_eq(uint64_t a, uint64_t b) {
56406         LDKNetworkUpdate* a_conv = (LDKNetworkUpdate*)untag_ptr(a);
56407         LDKNetworkUpdate* b_conv = (LDKNetworkUpdate*)untag_ptr(b);
56408         jboolean ret_conv = NetworkUpdate_eq(a_conv, b_conv);
56409         return ret_conv;
56410 }
56411
56412 int8_tArray  __attribute__((export_name("TS_NetworkUpdate_write"))) TS_NetworkUpdate_write(uint64_t obj) {
56413         LDKNetworkUpdate* obj_conv = (LDKNetworkUpdate*)untag_ptr(obj);
56414         LDKCVec_u8Z ret_var = NetworkUpdate_write(obj_conv);
56415         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
56416         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
56417         CVec_u8Z_free(ret_var);
56418         return ret_arr;
56419 }
56420
56421 uint64_t  __attribute__((export_name("TS_NetworkUpdate_read"))) TS_NetworkUpdate_read(int8_tArray ser) {
56422         LDKu8slice ser_ref;
56423         ser_ref.datalen = ser->arr_len;
56424         ser_ref.data = ser->elems;
56425         LDKCResult_COption_NetworkUpdateZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_COption_NetworkUpdateZDecodeErrorZ), "LDKCResult_COption_NetworkUpdateZDecodeErrorZ");
56426         *ret_conv = NetworkUpdate_read(ser_ref);
56427         FREE(ser);
56428         return tag_ptr(ret_conv, true);
56429 }
56430
56431 void  __attribute__((export_name("TS_P2PGossipSync_free"))) TS_P2PGossipSync_free(uint64_t this_obj) {
56432         LDKP2PGossipSync this_obj_conv;
56433         this_obj_conv.inner = untag_ptr(this_obj);
56434         this_obj_conv.is_owned = ptr_is_owned(this_obj);
56435         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
56436         P2PGossipSync_free(this_obj_conv);
56437 }
56438
56439 uint64_t  __attribute__((export_name("TS_P2PGossipSync_new"))) TS_P2PGossipSync_new(uint64_t network_graph, uint64_t utxo_lookup, uint64_t logger) {
56440         LDKNetworkGraph network_graph_conv;
56441         network_graph_conv.inner = untag_ptr(network_graph);
56442         network_graph_conv.is_owned = ptr_is_owned(network_graph);
56443         CHECK_INNER_FIELD_ACCESS_OR_NULL(network_graph_conv);
56444         network_graph_conv.is_owned = false;
56445         void* utxo_lookup_ptr = untag_ptr(utxo_lookup);
56446         CHECK_ACCESS(utxo_lookup_ptr);
56447         LDKCOption_UtxoLookupZ utxo_lookup_conv = *(LDKCOption_UtxoLookupZ*)(utxo_lookup_ptr);
56448         // WARNING: we may need a move here but no clone is available for LDKCOption_UtxoLookupZ
56449         if (utxo_lookup_conv.tag == LDKCOption_UtxoLookupZ_Some) {
56450                 // Manually implement clone for Java trait instances
56451                 if (utxo_lookup_conv.some.free == LDKUtxoLookup_JCalls_free) {
56452                         // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
56453                         LDKUtxoLookup_JCalls_cloned(&utxo_lookup_conv.some);
56454                 }
56455         }
56456         void* logger_ptr = untag_ptr(logger);
56457         CHECK_ACCESS(logger_ptr);
56458         LDKLogger logger_conv = *(LDKLogger*)(logger_ptr);
56459         if (logger_conv.free == LDKLogger_JCalls_free) {
56460                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
56461                 LDKLogger_JCalls_cloned(&logger_conv);
56462         }
56463         LDKP2PGossipSync ret_var = P2PGossipSync_new(&network_graph_conv, utxo_lookup_conv, logger_conv);
56464         uint64_t ret_ref = 0;
56465         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
56466         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
56467         return ret_ref;
56468 }
56469
56470 void  __attribute__((export_name("TS_P2PGossipSync_add_utxo_lookup"))) TS_P2PGossipSync_add_utxo_lookup(uint64_t this_arg, uint64_t utxo_lookup) {
56471         LDKP2PGossipSync this_arg_conv;
56472         this_arg_conv.inner = untag_ptr(this_arg);
56473         this_arg_conv.is_owned = ptr_is_owned(this_arg);
56474         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
56475         this_arg_conv.is_owned = false;
56476         void* utxo_lookup_ptr = untag_ptr(utxo_lookup);
56477         CHECK_ACCESS(utxo_lookup_ptr);
56478         LDKCOption_UtxoLookupZ utxo_lookup_conv = *(LDKCOption_UtxoLookupZ*)(utxo_lookup_ptr);
56479         // WARNING: we may need a move here but no clone is available for LDKCOption_UtxoLookupZ
56480         if (utxo_lookup_conv.tag == LDKCOption_UtxoLookupZ_Some) {
56481                 // Manually implement clone for Java trait instances
56482                 if (utxo_lookup_conv.some.free == LDKUtxoLookup_JCalls_free) {
56483                         // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
56484                         LDKUtxoLookup_JCalls_cloned(&utxo_lookup_conv.some);
56485                 }
56486         }
56487         P2PGossipSync_add_utxo_lookup(&this_arg_conv, utxo_lookup_conv);
56488 }
56489
56490 void  __attribute__((export_name("TS_NetworkGraph_handle_network_update"))) TS_NetworkGraph_handle_network_update(uint64_t this_arg, uint64_t network_update) {
56491         LDKNetworkGraph this_arg_conv;
56492         this_arg_conv.inner = untag_ptr(this_arg);
56493         this_arg_conv.is_owned = ptr_is_owned(this_arg);
56494         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
56495         this_arg_conv.is_owned = false;
56496         LDKNetworkUpdate* network_update_conv = (LDKNetworkUpdate*)untag_ptr(network_update);
56497         NetworkGraph_handle_network_update(&this_arg_conv, network_update_conv);
56498 }
56499
56500 int8_tArray  __attribute__((export_name("TS_NetworkGraph_get_chain_hash"))) TS_NetworkGraph_get_chain_hash(uint64_t this_arg) {
56501         LDKNetworkGraph this_arg_conv;
56502         this_arg_conv.inner = untag_ptr(this_arg);
56503         this_arg_conv.is_owned = ptr_is_owned(this_arg);
56504         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
56505         this_arg_conv.is_owned = false;
56506         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
56507         memcpy(ret_arr->elems, NetworkGraph_get_chain_hash(&this_arg_conv).data, 32);
56508         return ret_arr;
56509 }
56510
56511 uint64_t  __attribute__((export_name("TS_verify_node_announcement"))) TS_verify_node_announcement(uint64_t msg) {
56512         LDKNodeAnnouncement msg_conv;
56513         msg_conv.inner = untag_ptr(msg);
56514         msg_conv.is_owned = ptr_is_owned(msg);
56515         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
56516         msg_conv.is_owned = false;
56517         LDKCResult_NoneLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneLightningErrorZ), "LDKCResult_NoneLightningErrorZ");
56518         *ret_conv = verify_node_announcement(&msg_conv);
56519         return tag_ptr(ret_conv, true);
56520 }
56521
56522 uint64_t  __attribute__((export_name("TS_verify_channel_announcement"))) TS_verify_channel_announcement(uint64_t msg) {
56523         LDKChannelAnnouncement msg_conv;
56524         msg_conv.inner = untag_ptr(msg);
56525         msg_conv.is_owned = ptr_is_owned(msg);
56526         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
56527         msg_conv.is_owned = false;
56528         LDKCResult_NoneLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneLightningErrorZ), "LDKCResult_NoneLightningErrorZ");
56529         *ret_conv = verify_channel_announcement(&msg_conv);
56530         return tag_ptr(ret_conv, true);
56531 }
56532
56533 uint64_t  __attribute__((export_name("TS_P2PGossipSync_as_RoutingMessageHandler"))) TS_P2PGossipSync_as_RoutingMessageHandler(uint64_t this_arg) {
56534         LDKP2PGossipSync this_arg_conv;
56535         this_arg_conv.inner = untag_ptr(this_arg);
56536         this_arg_conv.is_owned = ptr_is_owned(this_arg);
56537         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
56538         this_arg_conv.is_owned = false;
56539         LDKRoutingMessageHandler* ret_ret = MALLOC(sizeof(LDKRoutingMessageHandler), "LDKRoutingMessageHandler");
56540         *ret_ret = P2PGossipSync_as_RoutingMessageHandler(&this_arg_conv);
56541         return tag_ptr(ret_ret, true);
56542 }
56543
56544 uint64_t  __attribute__((export_name("TS_P2PGossipSync_as_MessageSendEventsProvider"))) TS_P2PGossipSync_as_MessageSendEventsProvider(uint64_t this_arg) {
56545         LDKP2PGossipSync this_arg_conv;
56546         this_arg_conv.inner = untag_ptr(this_arg);
56547         this_arg_conv.is_owned = ptr_is_owned(this_arg);
56548         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
56549         this_arg_conv.is_owned = false;
56550         LDKMessageSendEventsProvider* ret_ret = MALLOC(sizeof(LDKMessageSendEventsProvider), "LDKMessageSendEventsProvider");
56551         *ret_ret = P2PGossipSync_as_MessageSendEventsProvider(&this_arg_conv);
56552         return tag_ptr(ret_ret, true);
56553 }
56554
56555 void  __attribute__((export_name("TS_ChannelUpdateInfo_free"))) TS_ChannelUpdateInfo_free(uint64_t this_obj) {
56556         LDKChannelUpdateInfo this_obj_conv;
56557         this_obj_conv.inner = untag_ptr(this_obj);
56558         this_obj_conv.is_owned = ptr_is_owned(this_obj);
56559         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
56560         ChannelUpdateInfo_free(this_obj_conv);
56561 }
56562
56563 int32_t  __attribute__((export_name("TS_ChannelUpdateInfo_get_last_update"))) TS_ChannelUpdateInfo_get_last_update(uint64_t this_ptr) {
56564         LDKChannelUpdateInfo this_ptr_conv;
56565         this_ptr_conv.inner = untag_ptr(this_ptr);
56566         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
56567         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
56568         this_ptr_conv.is_owned = false;
56569         int32_t ret_conv = ChannelUpdateInfo_get_last_update(&this_ptr_conv);
56570         return ret_conv;
56571 }
56572
56573 void  __attribute__((export_name("TS_ChannelUpdateInfo_set_last_update"))) TS_ChannelUpdateInfo_set_last_update(uint64_t this_ptr, int32_t val) {
56574         LDKChannelUpdateInfo this_ptr_conv;
56575         this_ptr_conv.inner = untag_ptr(this_ptr);
56576         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
56577         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
56578         this_ptr_conv.is_owned = false;
56579         ChannelUpdateInfo_set_last_update(&this_ptr_conv, val);
56580 }
56581
56582 jboolean  __attribute__((export_name("TS_ChannelUpdateInfo_get_enabled"))) TS_ChannelUpdateInfo_get_enabled(uint64_t this_ptr) {
56583         LDKChannelUpdateInfo this_ptr_conv;
56584         this_ptr_conv.inner = untag_ptr(this_ptr);
56585         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
56586         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
56587         this_ptr_conv.is_owned = false;
56588         jboolean ret_conv = ChannelUpdateInfo_get_enabled(&this_ptr_conv);
56589         return ret_conv;
56590 }
56591
56592 void  __attribute__((export_name("TS_ChannelUpdateInfo_set_enabled"))) TS_ChannelUpdateInfo_set_enabled(uint64_t this_ptr, jboolean val) {
56593         LDKChannelUpdateInfo this_ptr_conv;
56594         this_ptr_conv.inner = untag_ptr(this_ptr);
56595         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
56596         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
56597         this_ptr_conv.is_owned = false;
56598         ChannelUpdateInfo_set_enabled(&this_ptr_conv, val);
56599 }
56600
56601 int16_t  __attribute__((export_name("TS_ChannelUpdateInfo_get_cltv_expiry_delta"))) TS_ChannelUpdateInfo_get_cltv_expiry_delta(uint64_t this_ptr) {
56602         LDKChannelUpdateInfo this_ptr_conv;
56603         this_ptr_conv.inner = untag_ptr(this_ptr);
56604         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
56605         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
56606         this_ptr_conv.is_owned = false;
56607         int16_t ret_conv = ChannelUpdateInfo_get_cltv_expiry_delta(&this_ptr_conv);
56608         return ret_conv;
56609 }
56610
56611 void  __attribute__((export_name("TS_ChannelUpdateInfo_set_cltv_expiry_delta"))) TS_ChannelUpdateInfo_set_cltv_expiry_delta(uint64_t this_ptr, int16_t val) {
56612         LDKChannelUpdateInfo this_ptr_conv;
56613         this_ptr_conv.inner = untag_ptr(this_ptr);
56614         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
56615         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
56616         this_ptr_conv.is_owned = false;
56617         ChannelUpdateInfo_set_cltv_expiry_delta(&this_ptr_conv, val);
56618 }
56619
56620 int64_t  __attribute__((export_name("TS_ChannelUpdateInfo_get_htlc_minimum_msat"))) TS_ChannelUpdateInfo_get_htlc_minimum_msat(uint64_t this_ptr) {
56621         LDKChannelUpdateInfo this_ptr_conv;
56622         this_ptr_conv.inner = untag_ptr(this_ptr);
56623         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
56624         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
56625         this_ptr_conv.is_owned = false;
56626         int64_t ret_conv = ChannelUpdateInfo_get_htlc_minimum_msat(&this_ptr_conv);
56627         return ret_conv;
56628 }
56629
56630 void  __attribute__((export_name("TS_ChannelUpdateInfo_set_htlc_minimum_msat"))) TS_ChannelUpdateInfo_set_htlc_minimum_msat(uint64_t this_ptr, int64_t val) {
56631         LDKChannelUpdateInfo this_ptr_conv;
56632         this_ptr_conv.inner = untag_ptr(this_ptr);
56633         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
56634         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
56635         this_ptr_conv.is_owned = false;
56636         ChannelUpdateInfo_set_htlc_minimum_msat(&this_ptr_conv, val);
56637 }
56638
56639 int64_t  __attribute__((export_name("TS_ChannelUpdateInfo_get_htlc_maximum_msat"))) TS_ChannelUpdateInfo_get_htlc_maximum_msat(uint64_t this_ptr) {
56640         LDKChannelUpdateInfo this_ptr_conv;
56641         this_ptr_conv.inner = untag_ptr(this_ptr);
56642         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
56643         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
56644         this_ptr_conv.is_owned = false;
56645         int64_t ret_conv = ChannelUpdateInfo_get_htlc_maximum_msat(&this_ptr_conv);
56646         return ret_conv;
56647 }
56648
56649 void  __attribute__((export_name("TS_ChannelUpdateInfo_set_htlc_maximum_msat"))) TS_ChannelUpdateInfo_set_htlc_maximum_msat(uint64_t this_ptr, int64_t val) {
56650         LDKChannelUpdateInfo this_ptr_conv;
56651         this_ptr_conv.inner = untag_ptr(this_ptr);
56652         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
56653         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
56654         this_ptr_conv.is_owned = false;
56655         ChannelUpdateInfo_set_htlc_maximum_msat(&this_ptr_conv, val);
56656 }
56657
56658 uint64_t  __attribute__((export_name("TS_ChannelUpdateInfo_get_fees"))) TS_ChannelUpdateInfo_get_fees(uint64_t this_ptr) {
56659         LDKChannelUpdateInfo this_ptr_conv;
56660         this_ptr_conv.inner = untag_ptr(this_ptr);
56661         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
56662         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
56663         this_ptr_conv.is_owned = false;
56664         LDKRoutingFees ret_var = ChannelUpdateInfo_get_fees(&this_ptr_conv);
56665         uint64_t ret_ref = 0;
56666         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
56667         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
56668         return ret_ref;
56669 }
56670
56671 void  __attribute__((export_name("TS_ChannelUpdateInfo_set_fees"))) TS_ChannelUpdateInfo_set_fees(uint64_t this_ptr, uint64_t val) {
56672         LDKChannelUpdateInfo this_ptr_conv;
56673         this_ptr_conv.inner = untag_ptr(this_ptr);
56674         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
56675         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
56676         this_ptr_conv.is_owned = false;
56677         LDKRoutingFees val_conv;
56678         val_conv.inner = untag_ptr(val);
56679         val_conv.is_owned = ptr_is_owned(val);
56680         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
56681         val_conv = RoutingFees_clone(&val_conv);
56682         ChannelUpdateInfo_set_fees(&this_ptr_conv, val_conv);
56683 }
56684
56685 uint64_t  __attribute__((export_name("TS_ChannelUpdateInfo_get_last_update_message"))) TS_ChannelUpdateInfo_get_last_update_message(uint64_t this_ptr) {
56686         LDKChannelUpdateInfo this_ptr_conv;
56687         this_ptr_conv.inner = untag_ptr(this_ptr);
56688         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
56689         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
56690         this_ptr_conv.is_owned = false;
56691         LDKChannelUpdate ret_var = ChannelUpdateInfo_get_last_update_message(&this_ptr_conv);
56692         uint64_t ret_ref = 0;
56693         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
56694         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
56695         return ret_ref;
56696 }
56697
56698 void  __attribute__((export_name("TS_ChannelUpdateInfo_set_last_update_message"))) TS_ChannelUpdateInfo_set_last_update_message(uint64_t this_ptr, uint64_t val) {
56699         LDKChannelUpdateInfo this_ptr_conv;
56700         this_ptr_conv.inner = untag_ptr(this_ptr);
56701         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
56702         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
56703         this_ptr_conv.is_owned = false;
56704         LDKChannelUpdate val_conv;
56705         val_conv.inner = untag_ptr(val);
56706         val_conv.is_owned = ptr_is_owned(val);
56707         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
56708         val_conv = ChannelUpdate_clone(&val_conv);
56709         ChannelUpdateInfo_set_last_update_message(&this_ptr_conv, val_conv);
56710 }
56711
56712 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) {
56713         LDKRoutingFees fees_arg_conv;
56714         fees_arg_conv.inner = untag_ptr(fees_arg);
56715         fees_arg_conv.is_owned = ptr_is_owned(fees_arg);
56716         CHECK_INNER_FIELD_ACCESS_OR_NULL(fees_arg_conv);
56717         fees_arg_conv = RoutingFees_clone(&fees_arg_conv);
56718         LDKChannelUpdate last_update_message_arg_conv;
56719         last_update_message_arg_conv.inner = untag_ptr(last_update_message_arg);
56720         last_update_message_arg_conv.is_owned = ptr_is_owned(last_update_message_arg);
56721         CHECK_INNER_FIELD_ACCESS_OR_NULL(last_update_message_arg_conv);
56722         last_update_message_arg_conv = ChannelUpdate_clone(&last_update_message_arg_conv);
56723         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);
56724         uint64_t ret_ref = 0;
56725         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
56726         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
56727         return ret_ref;
56728 }
56729
56730 static inline uint64_t ChannelUpdateInfo_clone_ptr(LDKChannelUpdateInfo *NONNULL_PTR arg) {
56731         LDKChannelUpdateInfo ret_var = ChannelUpdateInfo_clone(arg);
56732         uint64_t ret_ref = 0;
56733         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
56734         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
56735         return ret_ref;
56736 }
56737 int64_t  __attribute__((export_name("TS_ChannelUpdateInfo_clone_ptr"))) TS_ChannelUpdateInfo_clone_ptr(uint64_t arg) {
56738         LDKChannelUpdateInfo arg_conv;
56739         arg_conv.inner = untag_ptr(arg);
56740         arg_conv.is_owned = ptr_is_owned(arg);
56741         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
56742         arg_conv.is_owned = false;
56743         int64_t ret_conv = ChannelUpdateInfo_clone_ptr(&arg_conv);
56744         return ret_conv;
56745 }
56746
56747 uint64_t  __attribute__((export_name("TS_ChannelUpdateInfo_clone"))) TS_ChannelUpdateInfo_clone(uint64_t orig) {
56748         LDKChannelUpdateInfo orig_conv;
56749         orig_conv.inner = untag_ptr(orig);
56750         orig_conv.is_owned = ptr_is_owned(orig);
56751         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
56752         orig_conv.is_owned = false;
56753         LDKChannelUpdateInfo ret_var = ChannelUpdateInfo_clone(&orig_conv);
56754         uint64_t ret_ref = 0;
56755         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
56756         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
56757         return ret_ref;
56758 }
56759
56760 jboolean  __attribute__((export_name("TS_ChannelUpdateInfo_eq"))) TS_ChannelUpdateInfo_eq(uint64_t a, uint64_t b) {
56761         LDKChannelUpdateInfo a_conv;
56762         a_conv.inner = untag_ptr(a);
56763         a_conv.is_owned = ptr_is_owned(a);
56764         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
56765         a_conv.is_owned = false;
56766         LDKChannelUpdateInfo b_conv;
56767         b_conv.inner = untag_ptr(b);
56768         b_conv.is_owned = ptr_is_owned(b);
56769         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
56770         b_conv.is_owned = false;
56771         jboolean ret_conv = ChannelUpdateInfo_eq(&a_conv, &b_conv);
56772         return ret_conv;
56773 }
56774
56775 int8_tArray  __attribute__((export_name("TS_ChannelUpdateInfo_write"))) TS_ChannelUpdateInfo_write(uint64_t obj) {
56776         LDKChannelUpdateInfo obj_conv;
56777         obj_conv.inner = untag_ptr(obj);
56778         obj_conv.is_owned = ptr_is_owned(obj);
56779         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
56780         obj_conv.is_owned = false;
56781         LDKCVec_u8Z ret_var = ChannelUpdateInfo_write(&obj_conv);
56782         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
56783         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
56784         CVec_u8Z_free(ret_var);
56785         return ret_arr;
56786 }
56787
56788 uint64_t  __attribute__((export_name("TS_ChannelUpdateInfo_read"))) TS_ChannelUpdateInfo_read(int8_tArray ser) {
56789         LDKu8slice ser_ref;
56790         ser_ref.datalen = ser->arr_len;
56791         ser_ref.data = ser->elems;
56792         LDKCResult_ChannelUpdateInfoDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelUpdateInfoDecodeErrorZ), "LDKCResult_ChannelUpdateInfoDecodeErrorZ");
56793         *ret_conv = ChannelUpdateInfo_read(ser_ref);
56794         FREE(ser);
56795         return tag_ptr(ret_conv, true);
56796 }
56797
56798 void  __attribute__((export_name("TS_ChannelInfo_free"))) TS_ChannelInfo_free(uint64_t this_obj) {
56799         LDKChannelInfo this_obj_conv;
56800         this_obj_conv.inner = untag_ptr(this_obj);
56801         this_obj_conv.is_owned = ptr_is_owned(this_obj);
56802         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
56803         ChannelInfo_free(this_obj_conv);
56804 }
56805
56806 uint64_t  __attribute__((export_name("TS_ChannelInfo_get_features"))) TS_ChannelInfo_get_features(uint64_t this_ptr) {
56807         LDKChannelInfo this_ptr_conv;
56808         this_ptr_conv.inner = untag_ptr(this_ptr);
56809         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
56810         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
56811         this_ptr_conv.is_owned = false;
56812         LDKChannelFeatures ret_var = ChannelInfo_get_features(&this_ptr_conv);
56813         uint64_t ret_ref = 0;
56814         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
56815         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
56816         return ret_ref;
56817 }
56818
56819 void  __attribute__((export_name("TS_ChannelInfo_set_features"))) TS_ChannelInfo_set_features(uint64_t this_ptr, uint64_t val) {
56820         LDKChannelInfo this_ptr_conv;
56821         this_ptr_conv.inner = untag_ptr(this_ptr);
56822         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
56823         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
56824         this_ptr_conv.is_owned = false;
56825         LDKChannelFeatures val_conv;
56826         val_conv.inner = untag_ptr(val);
56827         val_conv.is_owned = ptr_is_owned(val);
56828         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
56829         val_conv = ChannelFeatures_clone(&val_conv);
56830         ChannelInfo_set_features(&this_ptr_conv, val_conv);
56831 }
56832
56833 uint64_t  __attribute__((export_name("TS_ChannelInfo_get_node_one"))) TS_ChannelInfo_get_node_one(uint64_t this_ptr) {
56834         LDKChannelInfo this_ptr_conv;
56835         this_ptr_conv.inner = untag_ptr(this_ptr);
56836         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
56837         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
56838         this_ptr_conv.is_owned = false;
56839         LDKNodeId ret_var = ChannelInfo_get_node_one(&this_ptr_conv);
56840         uint64_t ret_ref = 0;
56841         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
56842         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
56843         return ret_ref;
56844 }
56845
56846 void  __attribute__((export_name("TS_ChannelInfo_set_node_one"))) TS_ChannelInfo_set_node_one(uint64_t this_ptr, uint64_t val) {
56847         LDKChannelInfo this_ptr_conv;
56848         this_ptr_conv.inner = untag_ptr(this_ptr);
56849         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
56850         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
56851         this_ptr_conv.is_owned = false;
56852         LDKNodeId val_conv;
56853         val_conv.inner = untag_ptr(val);
56854         val_conv.is_owned = ptr_is_owned(val);
56855         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
56856         val_conv = NodeId_clone(&val_conv);
56857         ChannelInfo_set_node_one(&this_ptr_conv, val_conv);
56858 }
56859
56860 uint64_t  __attribute__((export_name("TS_ChannelInfo_get_one_to_two"))) TS_ChannelInfo_get_one_to_two(uint64_t this_ptr) {
56861         LDKChannelInfo this_ptr_conv;
56862         this_ptr_conv.inner = untag_ptr(this_ptr);
56863         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
56864         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
56865         this_ptr_conv.is_owned = false;
56866         LDKChannelUpdateInfo ret_var = ChannelInfo_get_one_to_two(&this_ptr_conv);
56867         uint64_t ret_ref = 0;
56868         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
56869         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
56870         return ret_ref;
56871 }
56872
56873 void  __attribute__((export_name("TS_ChannelInfo_set_one_to_two"))) TS_ChannelInfo_set_one_to_two(uint64_t this_ptr, uint64_t val) {
56874         LDKChannelInfo this_ptr_conv;
56875         this_ptr_conv.inner = untag_ptr(this_ptr);
56876         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
56877         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
56878         this_ptr_conv.is_owned = false;
56879         LDKChannelUpdateInfo val_conv;
56880         val_conv.inner = untag_ptr(val);
56881         val_conv.is_owned = ptr_is_owned(val);
56882         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
56883         val_conv = ChannelUpdateInfo_clone(&val_conv);
56884         ChannelInfo_set_one_to_two(&this_ptr_conv, val_conv);
56885 }
56886
56887 uint64_t  __attribute__((export_name("TS_ChannelInfo_get_node_two"))) TS_ChannelInfo_get_node_two(uint64_t this_ptr) {
56888         LDKChannelInfo this_ptr_conv;
56889         this_ptr_conv.inner = untag_ptr(this_ptr);
56890         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
56891         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
56892         this_ptr_conv.is_owned = false;
56893         LDKNodeId ret_var = ChannelInfo_get_node_two(&this_ptr_conv);
56894         uint64_t ret_ref = 0;
56895         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
56896         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
56897         return ret_ref;
56898 }
56899
56900 void  __attribute__((export_name("TS_ChannelInfo_set_node_two"))) TS_ChannelInfo_set_node_two(uint64_t this_ptr, uint64_t val) {
56901         LDKChannelInfo this_ptr_conv;
56902         this_ptr_conv.inner = untag_ptr(this_ptr);
56903         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
56904         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
56905         this_ptr_conv.is_owned = false;
56906         LDKNodeId val_conv;
56907         val_conv.inner = untag_ptr(val);
56908         val_conv.is_owned = ptr_is_owned(val);
56909         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
56910         val_conv = NodeId_clone(&val_conv);
56911         ChannelInfo_set_node_two(&this_ptr_conv, val_conv);
56912 }
56913
56914 uint64_t  __attribute__((export_name("TS_ChannelInfo_get_two_to_one"))) TS_ChannelInfo_get_two_to_one(uint64_t this_ptr) {
56915         LDKChannelInfo this_ptr_conv;
56916         this_ptr_conv.inner = untag_ptr(this_ptr);
56917         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
56918         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
56919         this_ptr_conv.is_owned = false;
56920         LDKChannelUpdateInfo ret_var = ChannelInfo_get_two_to_one(&this_ptr_conv);
56921         uint64_t ret_ref = 0;
56922         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
56923         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
56924         return ret_ref;
56925 }
56926
56927 void  __attribute__((export_name("TS_ChannelInfo_set_two_to_one"))) TS_ChannelInfo_set_two_to_one(uint64_t this_ptr, uint64_t val) {
56928         LDKChannelInfo this_ptr_conv;
56929         this_ptr_conv.inner = untag_ptr(this_ptr);
56930         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
56931         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
56932         this_ptr_conv.is_owned = false;
56933         LDKChannelUpdateInfo val_conv;
56934         val_conv.inner = untag_ptr(val);
56935         val_conv.is_owned = ptr_is_owned(val);
56936         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
56937         val_conv = ChannelUpdateInfo_clone(&val_conv);
56938         ChannelInfo_set_two_to_one(&this_ptr_conv, val_conv);
56939 }
56940
56941 uint64_t  __attribute__((export_name("TS_ChannelInfo_get_capacity_sats"))) TS_ChannelInfo_get_capacity_sats(uint64_t this_ptr) {
56942         LDKChannelInfo this_ptr_conv;
56943         this_ptr_conv.inner = untag_ptr(this_ptr);
56944         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
56945         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
56946         this_ptr_conv.is_owned = false;
56947         LDKCOption_u64Z *ret_copy = MALLOC(sizeof(LDKCOption_u64Z), "LDKCOption_u64Z");
56948         *ret_copy = ChannelInfo_get_capacity_sats(&this_ptr_conv);
56949         uint64_t ret_ref = tag_ptr(ret_copy, true);
56950         return ret_ref;
56951 }
56952
56953 void  __attribute__((export_name("TS_ChannelInfo_set_capacity_sats"))) TS_ChannelInfo_set_capacity_sats(uint64_t this_ptr, uint64_t val) {
56954         LDKChannelInfo this_ptr_conv;
56955         this_ptr_conv.inner = untag_ptr(this_ptr);
56956         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
56957         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
56958         this_ptr_conv.is_owned = false;
56959         void* val_ptr = untag_ptr(val);
56960         CHECK_ACCESS(val_ptr);
56961         LDKCOption_u64Z val_conv = *(LDKCOption_u64Z*)(val_ptr);
56962         val_conv = COption_u64Z_clone((LDKCOption_u64Z*)untag_ptr(val));
56963         ChannelInfo_set_capacity_sats(&this_ptr_conv, val_conv);
56964 }
56965
56966 uint64_t  __attribute__((export_name("TS_ChannelInfo_get_announcement_message"))) TS_ChannelInfo_get_announcement_message(uint64_t this_ptr) {
56967         LDKChannelInfo this_ptr_conv;
56968         this_ptr_conv.inner = untag_ptr(this_ptr);
56969         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
56970         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
56971         this_ptr_conv.is_owned = false;
56972         LDKChannelAnnouncement ret_var = ChannelInfo_get_announcement_message(&this_ptr_conv);
56973         uint64_t ret_ref = 0;
56974         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
56975         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
56976         return ret_ref;
56977 }
56978
56979 void  __attribute__((export_name("TS_ChannelInfo_set_announcement_message"))) TS_ChannelInfo_set_announcement_message(uint64_t this_ptr, uint64_t val) {
56980         LDKChannelInfo this_ptr_conv;
56981         this_ptr_conv.inner = untag_ptr(this_ptr);
56982         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
56983         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
56984         this_ptr_conv.is_owned = false;
56985         LDKChannelAnnouncement val_conv;
56986         val_conv.inner = untag_ptr(val);
56987         val_conv.is_owned = ptr_is_owned(val);
56988         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
56989         val_conv = ChannelAnnouncement_clone(&val_conv);
56990         ChannelInfo_set_announcement_message(&this_ptr_conv, val_conv);
56991 }
56992
56993 static inline uint64_t ChannelInfo_clone_ptr(LDKChannelInfo *NONNULL_PTR arg) {
56994         LDKChannelInfo ret_var = ChannelInfo_clone(arg);
56995         uint64_t ret_ref = 0;
56996         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
56997         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
56998         return ret_ref;
56999 }
57000 int64_t  __attribute__((export_name("TS_ChannelInfo_clone_ptr"))) TS_ChannelInfo_clone_ptr(uint64_t arg) {
57001         LDKChannelInfo arg_conv;
57002         arg_conv.inner = untag_ptr(arg);
57003         arg_conv.is_owned = ptr_is_owned(arg);
57004         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
57005         arg_conv.is_owned = false;
57006         int64_t ret_conv = ChannelInfo_clone_ptr(&arg_conv);
57007         return ret_conv;
57008 }
57009
57010 uint64_t  __attribute__((export_name("TS_ChannelInfo_clone"))) TS_ChannelInfo_clone(uint64_t orig) {
57011         LDKChannelInfo orig_conv;
57012         orig_conv.inner = untag_ptr(orig);
57013         orig_conv.is_owned = ptr_is_owned(orig);
57014         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
57015         orig_conv.is_owned = false;
57016         LDKChannelInfo ret_var = ChannelInfo_clone(&orig_conv);
57017         uint64_t ret_ref = 0;
57018         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
57019         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
57020         return ret_ref;
57021 }
57022
57023 jboolean  __attribute__((export_name("TS_ChannelInfo_eq"))) TS_ChannelInfo_eq(uint64_t a, uint64_t b) {
57024         LDKChannelInfo a_conv;
57025         a_conv.inner = untag_ptr(a);
57026         a_conv.is_owned = ptr_is_owned(a);
57027         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
57028         a_conv.is_owned = false;
57029         LDKChannelInfo b_conv;
57030         b_conv.inner = untag_ptr(b);
57031         b_conv.is_owned = ptr_is_owned(b);
57032         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
57033         b_conv.is_owned = false;
57034         jboolean ret_conv = ChannelInfo_eq(&a_conv, &b_conv);
57035         return ret_conv;
57036 }
57037
57038 uint64_t  __attribute__((export_name("TS_ChannelInfo_get_directional_info"))) TS_ChannelInfo_get_directional_info(uint64_t this_arg, int8_t channel_flags) {
57039         LDKChannelInfo this_arg_conv;
57040         this_arg_conv.inner = untag_ptr(this_arg);
57041         this_arg_conv.is_owned = ptr_is_owned(this_arg);
57042         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
57043         this_arg_conv.is_owned = false;
57044         LDKChannelUpdateInfo ret_var = ChannelInfo_get_directional_info(&this_arg_conv, channel_flags);
57045         uint64_t ret_ref = 0;
57046         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
57047         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
57048         return ret_ref;
57049 }
57050
57051 int8_tArray  __attribute__((export_name("TS_ChannelInfo_write"))) TS_ChannelInfo_write(uint64_t obj) {
57052         LDKChannelInfo obj_conv;
57053         obj_conv.inner = untag_ptr(obj);
57054         obj_conv.is_owned = ptr_is_owned(obj);
57055         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
57056         obj_conv.is_owned = false;
57057         LDKCVec_u8Z ret_var = ChannelInfo_write(&obj_conv);
57058         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
57059         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
57060         CVec_u8Z_free(ret_var);
57061         return ret_arr;
57062 }
57063
57064 uint64_t  __attribute__((export_name("TS_ChannelInfo_read"))) TS_ChannelInfo_read(int8_tArray ser) {
57065         LDKu8slice ser_ref;
57066         ser_ref.datalen = ser->arr_len;
57067         ser_ref.data = ser->elems;
57068         LDKCResult_ChannelInfoDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelInfoDecodeErrorZ), "LDKCResult_ChannelInfoDecodeErrorZ");
57069         *ret_conv = ChannelInfo_read(ser_ref);
57070         FREE(ser);
57071         return tag_ptr(ret_conv, true);
57072 }
57073
57074 void  __attribute__((export_name("TS_DirectedChannelInfo_free"))) TS_DirectedChannelInfo_free(uint64_t this_obj) {
57075         LDKDirectedChannelInfo this_obj_conv;
57076         this_obj_conv.inner = untag_ptr(this_obj);
57077         this_obj_conv.is_owned = ptr_is_owned(this_obj);
57078         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
57079         DirectedChannelInfo_free(this_obj_conv);
57080 }
57081
57082 static inline uint64_t DirectedChannelInfo_clone_ptr(LDKDirectedChannelInfo *NONNULL_PTR arg) {
57083         LDKDirectedChannelInfo ret_var = DirectedChannelInfo_clone(arg);
57084         uint64_t ret_ref = 0;
57085         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
57086         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
57087         return ret_ref;
57088 }
57089 int64_t  __attribute__((export_name("TS_DirectedChannelInfo_clone_ptr"))) TS_DirectedChannelInfo_clone_ptr(uint64_t arg) {
57090         LDKDirectedChannelInfo arg_conv;
57091         arg_conv.inner = untag_ptr(arg);
57092         arg_conv.is_owned = ptr_is_owned(arg);
57093         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
57094         arg_conv.is_owned = false;
57095         int64_t ret_conv = DirectedChannelInfo_clone_ptr(&arg_conv);
57096         return ret_conv;
57097 }
57098
57099 uint64_t  __attribute__((export_name("TS_DirectedChannelInfo_clone"))) TS_DirectedChannelInfo_clone(uint64_t orig) {
57100         LDKDirectedChannelInfo orig_conv;
57101         orig_conv.inner = untag_ptr(orig);
57102         orig_conv.is_owned = ptr_is_owned(orig);
57103         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
57104         orig_conv.is_owned = false;
57105         LDKDirectedChannelInfo ret_var = DirectedChannelInfo_clone(&orig_conv);
57106         uint64_t ret_ref = 0;
57107         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
57108         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
57109         return ret_ref;
57110 }
57111
57112 uint64_t  __attribute__((export_name("TS_DirectedChannelInfo_channel"))) TS_DirectedChannelInfo_channel(uint64_t this_arg) {
57113         LDKDirectedChannelInfo this_arg_conv;
57114         this_arg_conv.inner = untag_ptr(this_arg);
57115         this_arg_conv.is_owned = ptr_is_owned(this_arg);
57116         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
57117         this_arg_conv.is_owned = false;
57118         LDKChannelInfo ret_var = DirectedChannelInfo_channel(&this_arg_conv);
57119         uint64_t ret_ref = 0;
57120         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
57121         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
57122         return ret_ref;
57123 }
57124
57125 int64_t  __attribute__((export_name("TS_DirectedChannelInfo_htlc_maximum_msat"))) TS_DirectedChannelInfo_htlc_maximum_msat(uint64_t this_arg) {
57126         LDKDirectedChannelInfo this_arg_conv;
57127         this_arg_conv.inner = untag_ptr(this_arg);
57128         this_arg_conv.is_owned = ptr_is_owned(this_arg);
57129         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
57130         this_arg_conv.is_owned = false;
57131         int64_t ret_conv = DirectedChannelInfo_htlc_maximum_msat(&this_arg_conv);
57132         return ret_conv;
57133 }
57134
57135 uint64_t  __attribute__((export_name("TS_DirectedChannelInfo_effective_capacity"))) TS_DirectedChannelInfo_effective_capacity(uint64_t this_arg) {
57136         LDKDirectedChannelInfo this_arg_conv;
57137         this_arg_conv.inner = untag_ptr(this_arg);
57138         this_arg_conv.is_owned = ptr_is_owned(this_arg);
57139         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
57140         this_arg_conv.is_owned = false;
57141         LDKEffectiveCapacity *ret_copy = MALLOC(sizeof(LDKEffectiveCapacity), "LDKEffectiveCapacity");
57142         *ret_copy = DirectedChannelInfo_effective_capacity(&this_arg_conv);
57143         uint64_t ret_ref = tag_ptr(ret_copy, true);
57144         return ret_ref;
57145 }
57146
57147 void  __attribute__((export_name("TS_EffectiveCapacity_free"))) TS_EffectiveCapacity_free(uint64_t this_ptr) {
57148         if (!ptr_is_owned(this_ptr)) return;
57149         void* this_ptr_ptr = untag_ptr(this_ptr);
57150         CHECK_ACCESS(this_ptr_ptr);
57151         LDKEffectiveCapacity this_ptr_conv = *(LDKEffectiveCapacity*)(this_ptr_ptr);
57152         FREE(untag_ptr(this_ptr));
57153         EffectiveCapacity_free(this_ptr_conv);
57154 }
57155
57156 static inline uint64_t EffectiveCapacity_clone_ptr(LDKEffectiveCapacity *NONNULL_PTR arg) {
57157         LDKEffectiveCapacity *ret_copy = MALLOC(sizeof(LDKEffectiveCapacity), "LDKEffectiveCapacity");
57158         *ret_copy = EffectiveCapacity_clone(arg);
57159         uint64_t ret_ref = tag_ptr(ret_copy, true);
57160         return ret_ref;
57161 }
57162 int64_t  __attribute__((export_name("TS_EffectiveCapacity_clone_ptr"))) TS_EffectiveCapacity_clone_ptr(uint64_t arg) {
57163         LDKEffectiveCapacity* arg_conv = (LDKEffectiveCapacity*)untag_ptr(arg);
57164         int64_t ret_conv = EffectiveCapacity_clone_ptr(arg_conv);
57165         return ret_conv;
57166 }
57167
57168 uint64_t  __attribute__((export_name("TS_EffectiveCapacity_clone"))) TS_EffectiveCapacity_clone(uint64_t orig) {
57169         LDKEffectiveCapacity* orig_conv = (LDKEffectiveCapacity*)untag_ptr(orig);
57170         LDKEffectiveCapacity *ret_copy = MALLOC(sizeof(LDKEffectiveCapacity), "LDKEffectiveCapacity");
57171         *ret_copy = EffectiveCapacity_clone(orig_conv);
57172         uint64_t ret_ref = tag_ptr(ret_copy, true);
57173         return ret_ref;
57174 }
57175
57176 uint64_t  __attribute__((export_name("TS_EffectiveCapacity_exact_liquidity"))) TS_EffectiveCapacity_exact_liquidity(int64_t liquidity_msat) {
57177         LDKEffectiveCapacity *ret_copy = MALLOC(sizeof(LDKEffectiveCapacity), "LDKEffectiveCapacity");
57178         *ret_copy = EffectiveCapacity_exact_liquidity(liquidity_msat);
57179         uint64_t ret_ref = tag_ptr(ret_copy, true);
57180         return ret_ref;
57181 }
57182
57183 uint64_t  __attribute__((export_name("TS_EffectiveCapacity_advertised_max_htlc"))) TS_EffectiveCapacity_advertised_max_htlc(int64_t amount_msat) {
57184         LDKEffectiveCapacity *ret_copy = MALLOC(sizeof(LDKEffectiveCapacity), "LDKEffectiveCapacity");
57185         *ret_copy = EffectiveCapacity_advertised_max_htlc(amount_msat);
57186         uint64_t ret_ref = tag_ptr(ret_copy, true);
57187         return ret_ref;
57188 }
57189
57190 uint64_t  __attribute__((export_name("TS_EffectiveCapacity_total"))) TS_EffectiveCapacity_total(int64_t capacity_msat, int64_t htlc_maximum_msat) {
57191         LDKEffectiveCapacity *ret_copy = MALLOC(sizeof(LDKEffectiveCapacity), "LDKEffectiveCapacity");
57192         *ret_copy = EffectiveCapacity_total(capacity_msat, htlc_maximum_msat);
57193         uint64_t ret_ref = tag_ptr(ret_copy, true);
57194         return ret_ref;
57195 }
57196
57197 uint64_t  __attribute__((export_name("TS_EffectiveCapacity_infinite"))) TS_EffectiveCapacity_infinite() {
57198         LDKEffectiveCapacity *ret_copy = MALLOC(sizeof(LDKEffectiveCapacity), "LDKEffectiveCapacity");
57199         *ret_copy = EffectiveCapacity_infinite();
57200         uint64_t ret_ref = tag_ptr(ret_copy, true);
57201         return ret_ref;
57202 }
57203
57204 uint64_t  __attribute__((export_name("TS_EffectiveCapacity_hint_max_htlc"))) TS_EffectiveCapacity_hint_max_htlc(int64_t amount_msat) {
57205         LDKEffectiveCapacity *ret_copy = MALLOC(sizeof(LDKEffectiveCapacity), "LDKEffectiveCapacity");
57206         *ret_copy = EffectiveCapacity_hint_max_htlc(amount_msat);
57207         uint64_t ret_ref = tag_ptr(ret_copy, true);
57208         return ret_ref;
57209 }
57210
57211 uint64_t  __attribute__((export_name("TS_EffectiveCapacity_unknown"))) TS_EffectiveCapacity_unknown() {
57212         LDKEffectiveCapacity *ret_copy = MALLOC(sizeof(LDKEffectiveCapacity), "LDKEffectiveCapacity");
57213         *ret_copy = EffectiveCapacity_unknown();
57214         uint64_t ret_ref = tag_ptr(ret_copy, true);
57215         return ret_ref;
57216 }
57217
57218 int64_t  __attribute__((export_name("TS_EffectiveCapacity_as_msat"))) TS_EffectiveCapacity_as_msat(uint64_t this_arg) {
57219         LDKEffectiveCapacity* this_arg_conv = (LDKEffectiveCapacity*)untag_ptr(this_arg);
57220         int64_t ret_conv = EffectiveCapacity_as_msat(this_arg_conv);
57221         return ret_conv;
57222 }
57223
57224 void  __attribute__((export_name("TS_RoutingFees_free"))) TS_RoutingFees_free(uint64_t this_obj) {
57225         LDKRoutingFees this_obj_conv;
57226         this_obj_conv.inner = untag_ptr(this_obj);
57227         this_obj_conv.is_owned = ptr_is_owned(this_obj);
57228         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
57229         RoutingFees_free(this_obj_conv);
57230 }
57231
57232 int32_t  __attribute__((export_name("TS_RoutingFees_get_base_msat"))) TS_RoutingFees_get_base_msat(uint64_t this_ptr) {
57233         LDKRoutingFees this_ptr_conv;
57234         this_ptr_conv.inner = untag_ptr(this_ptr);
57235         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
57236         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
57237         this_ptr_conv.is_owned = false;
57238         int32_t ret_conv = RoutingFees_get_base_msat(&this_ptr_conv);
57239         return ret_conv;
57240 }
57241
57242 void  __attribute__((export_name("TS_RoutingFees_set_base_msat"))) TS_RoutingFees_set_base_msat(uint64_t this_ptr, int32_t val) {
57243         LDKRoutingFees this_ptr_conv;
57244         this_ptr_conv.inner = untag_ptr(this_ptr);
57245         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
57246         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
57247         this_ptr_conv.is_owned = false;
57248         RoutingFees_set_base_msat(&this_ptr_conv, val);
57249 }
57250
57251 int32_t  __attribute__((export_name("TS_RoutingFees_get_proportional_millionths"))) TS_RoutingFees_get_proportional_millionths(uint64_t this_ptr) {
57252         LDKRoutingFees this_ptr_conv;
57253         this_ptr_conv.inner = untag_ptr(this_ptr);
57254         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
57255         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
57256         this_ptr_conv.is_owned = false;
57257         int32_t ret_conv = RoutingFees_get_proportional_millionths(&this_ptr_conv);
57258         return ret_conv;
57259 }
57260
57261 void  __attribute__((export_name("TS_RoutingFees_set_proportional_millionths"))) TS_RoutingFees_set_proportional_millionths(uint64_t this_ptr, int32_t val) {
57262         LDKRoutingFees this_ptr_conv;
57263         this_ptr_conv.inner = untag_ptr(this_ptr);
57264         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
57265         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
57266         this_ptr_conv.is_owned = false;
57267         RoutingFees_set_proportional_millionths(&this_ptr_conv, val);
57268 }
57269
57270 uint64_t  __attribute__((export_name("TS_RoutingFees_new"))) TS_RoutingFees_new(int32_t base_msat_arg, int32_t proportional_millionths_arg) {
57271         LDKRoutingFees ret_var = RoutingFees_new(base_msat_arg, proportional_millionths_arg);
57272         uint64_t ret_ref = 0;
57273         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
57274         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
57275         return ret_ref;
57276 }
57277
57278 jboolean  __attribute__((export_name("TS_RoutingFees_eq"))) TS_RoutingFees_eq(uint64_t a, uint64_t b) {
57279         LDKRoutingFees a_conv;
57280         a_conv.inner = untag_ptr(a);
57281         a_conv.is_owned = ptr_is_owned(a);
57282         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
57283         a_conv.is_owned = false;
57284         LDKRoutingFees b_conv;
57285         b_conv.inner = untag_ptr(b);
57286         b_conv.is_owned = ptr_is_owned(b);
57287         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
57288         b_conv.is_owned = false;
57289         jboolean ret_conv = RoutingFees_eq(&a_conv, &b_conv);
57290         return ret_conv;
57291 }
57292
57293 static inline uint64_t RoutingFees_clone_ptr(LDKRoutingFees *NONNULL_PTR arg) {
57294         LDKRoutingFees ret_var = RoutingFees_clone(arg);
57295         uint64_t ret_ref = 0;
57296         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
57297         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
57298         return ret_ref;
57299 }
57300 int64_t  __attribute__((export_name("TS_RoutingFees_clone_ptr"))) TS_RoutingFees_clone_ptr(uint64_t arg) {
57301         LDKRoutingFees arg_conv;
57302         arg_conv.inner = untag_ptr(arg);
57303         arg_conv.is_owned = ptr_is_owned(arg);
57304         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
57305         arg_conv.is_owned = false;
57306         int64_t ret_conv = RoutingFees_clone_ptr(&arg_conv);
57307         return ret_conv;
57308 }
57309
57310 uint64_t  __attribute__((export_name("TS_RoutingFees_clone"))) TS_RoutingFees_clone(uint64_t orig) {
57311         LDKRoutingFees orig_conv;
57312         orig_conv.inner = untag_ptr(orig);
57313         orig_conv.is_owned = ptr_is_owned(orig);
57314         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
57315         orig_conv.is_owned = false;
57316         LDKRoutingFees ret_var = RoutingFees_clone(&orig_conv);
57317         uint64_t ret_ref = 0;
57318         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
57319         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
57320         return ret_ref;
57321 }
57322
57323 int64_t  __attribute__((export_name("TS_RoutingFees_hash"))) TS_RoutingFees_hash(uint64_t o) {
57324         LDKRoutingFees o_conv;
57325         o_conv.inner = untag_ptr(o);
57326         o_conv.is_owned = ptr_is_owned(o);
57327         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
57328         o_conv.is_owned = false;
57329         int64_t ret_conv = RoutingFees_hash(&o_conv);
57330         return ret_conv;
57331 }
57332
57333 int8_tArray  __attribute__((export_name("TS_RoutingFees_write"))) TS_RoutingFees_write(uint64_t obj) {
57334         LDKRoutingFees obj_conv;
57335         obj_conv.inner = untag_ptr(obj);
57336         obj_conv.is_owned = ptr_is_owned(obj);
57337         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
57338         obj_conv.is_owned = false;
57339         LDKCVec_u8Z ret_var = RoutingFees_write(&obj_conv);
57340         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
57341         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
57342         CVec_u8Z_free(ret_var);
57343         return ret_arr;
57344 }
57345
57346 uint64_t  __attribute__((export_name("TS_RoutingFees_read"))) TS_RoutingFees_read(int8_tArray ser) {
57347         LDKu8slice ser_ref;
57348         ser_ref.datalen = ser->arr_len;
57349         ser_ref.data = ser->elems;
57350         LDKCResult_RoutingFeesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RoutingFeesDecodeErrorZ), "LDKCResult_RoutingFeesDecodeErrorZ");
57351         *ret_conv = RoutingFees_read(ser_ref);
57352         FREE(ser);
57353         return tag_ptr(ret_conv, true);
57354 }
57355
57356 void  __attribute__((export_name("TS_NodeAnnouncementInfo_free"))) TS_NodeAnnouncementInfo_free(uint64_t this_obj) {
57357         LDKNodeAnnouncementInfo this_obj_conv;
57358         this_obj_conv.inner = untag_ptr(this_obj);
57359         this_obj_conv.is_owned = ptr_is_owned(this_obj);
57360         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
57361         NodeAnnouncementInfo_free(this_obj_conv);
57362 }
57363
57364 uint64_t  __attribute__((export_name("TS_NodeAnnouncementInfo_get_features"))) TS_NodeAnnouncementInfo_get_features(uint64_t this_ptr) {
57365         LDKNodeAnnouncementInfo this_ptr_conv;
57366         this_ptr_conv.inner = untag_ptr(this_ptr);
57367         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
57368         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
57369         this_ptr_conv.is_owned = false;
57370         LDKNodeFeatures ret_var = NodeAnnouncementInfo_get_features(&this_ptr_conv);
57371         uint64_t ret_ref = 0;
57372         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
57373         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
57374         return ret_ref;
57375 }
57376
57377 void  __attribute__((export_name("TS_NodeAnnouncementInfo_set_features"))) TS_NodeAnnouncementInfo_set_features(uint64_t this_ptr, uint64_t val) {
57378         LDKNodeAnnouncementInfo this_ptr_conv;
57379         this_ptr_conv.inner = untag_ptr(this_ptr);
57380         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
57381         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
57382         this_ptr_conv.is_owned = false;
57383         LDKNodeFeatures val_conv;
57384         val_conv.inner = untag_ptr(val);
57385         val_conv.is_owned = ptr_is_owned(val);
57386         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
57387         val_conv = NodeFeatures_clone(&val_conv);
57388         NodeAnnouncementInfo_set_features(&this_ptr_conv, val_conv);
57389 }
57390
57391 int32_t  __attribute__((export_name("TS_NodeAnnouncementInfo_get_last_update"))) TS_NodeAnnouncementInfo_get_last_update(uint64_t this_ptr) {
57392         LDKNodeAnnouncementInfo this_ptr_conv;
57393         this_ptr_conv.inner = untag_ptr(this_ptr);
57394         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
57395         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
57396         this_ptr_conv.is_owned = false;
57397         int32_t ret_conv = NodeAnnouncementInfo_get_last_update(&this_ptr_conv);
57398         return ret_conv;
57399 }
57400
57401 void  __attribute__((export_name("TS_NodeAnnouncementInfo_set_last_update"))) TS_NodeAnnouncementInfo_set_last_update(uint64_t this_ptr, int32_t val) {
57402         LDKNodeAnnouncementInfo this_ptr_conv;
57403         this_ptr_conv.inner = untag_ptr(this_ptr);
57404         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
57405         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
57406         this_ptr_conv.is_owned = false;
57407         NodeAnnouncementInfo_set_last_update(&this_ptr_conv, val);
57408 }
57409
57410 int8_tArray  __attribute__((export_name("TS_NodeAnnouncementInfo_get_rgb"))) TS_NodeAnnouncementInfo_get_rgb(uint64_t this_ptr) {
57411         LDKNodeAnnouncementInfo this_ptr_conv;
57412         this_ptr_conv.inner = untag_ptr(this_ptr);
57413         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
57414         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
57415         this_ptr_conv.is_owned = false;
57416         int8_tArray ret_arr = init_int8_tArray(3, __LINE__);
57417         memcpy(ret_arr->elems, *NodeAnnouncementInfo_get_rgb(&this_ptr_conv), 3);
57418         return ret_arr;
57419 }
57420
57421 void  __attribute__((export_name("TS_NodeAnnouncementInfo_set_rgb"))) TS_NodeAnnouncementInfo_set_rgb(uint64_t this_ptr, int8_tArray val) {
57422         LDKNodeAnnouncementInfo this_ptr_conv;
57423         this_ptr_conv.inner = untag_ptr(this_ptr);
57424         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
57425         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
57426         this_ptr_conv.is_owned = false;
57427         LDKThreeBytes val_ref;
57428         CHECK(val->arr_len == 3);
57429         memcpy(val_ref.data, val->elems, 3); FREE(val);
57430         NodeAnnouncementInfo_set_rgb(&this_ptr_conv, val_ref);
57431 }
57432
57433 uint64_t  __attribute__((export_name("TS_NodeAnnouncementInfo_get_alias"))) TS_NodeAnnouncementInfo_get_alias(uint64_t this_ptr) {
57434         LDKNodeAnnouncementInfo this_ptr_conv;
57435         this_ptr_conv.inner = untag_ptr(this_ptr);
57436         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
57437         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
57438         this_ptr_conv.is_owned = false;
57439         LDKNodeAlias ret_var = NodeAnnouncementInfo_get_alias(&this_ptr_conv);
57440         uint64_t ret_ref = 0;
57441         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
57442         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
57443         return ret_ref;
57444 }
57445
57446 void  __attribute__((export_name("TS_NodeAnnouncementInfo_set_alias"))) TS_NodeAnnouncementInfo_set_alias(uint64_t this_ptr, uint64_t val) {
57447         LDKNodeAnnouncementInfo this_ptr_conv;
57448         this_ptr_conv.inner = untag_ptr(this_ptr);
57449         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
57450         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
57451         this_ptr_conv.is_owned = false;
57452         LDKNodeAlias val_conv;
57453         val_conv.inner = untag_ptr(val);
57454         val_conv.is_owned = ptr_is_owned(val);
57455         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
57456         val_conv = NodeAlias_clone(&val_conv);
57457         NodeAnnouncementInfo_set_alias(&this_ptr_conv, val_conv);
57458 }
57459
57460 uint64_t  __attribute__((export_name("TS_NodeAnnouncementInfo_get_announcement_message"))) TS_NodeAnnouncementInfo_get_announcement_message(uint64_t this_ptr) {
57461         LDKNodeAnnouncementInfo this_ptr_conv;
57462         this_ptr_conv.inner = untag_ptr(this_ptr);
57463         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
57464         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
57465         this_ptr_conv.is_owned = false;
57466         LDKNodeAnnouncement ret_var = NodeAnnouncementInfo_get_announcement_message(&this_ptr_conv);
57467         uint64_t ret_ref = 0;
57468         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
57469         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
57470         return ret_ref;
57471 }
57472
57473 void  __attribute__((export_name("TS_NodeAnnouncementInfo_set_announcement_message"))) TS_NodeAnnouncementInfo_set_announcement_message(uint64_t this_ptr, uint64_t val) {
57474         LDKNodeAnnouncementInfo this_ptr_conv;
57475         this_ptr_conv.inner = untag_ptr(this_ptr);
57476         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
57477         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
57478         this_ptr_conv.is_owned = false;
57479         LDKNodeAnnouncement val_conv;
57480         val_conv.inner = untag_ptr(val);
57481         val_conv.is_owned = ptr_is_owned(val);
57482         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
57483         val_conv = NodeAnnouncement_clone(&val_conv);
57484         NodeAnnouncementInfo_set_announcement_message(&this_ptr_conv, val_conv);
57485 }
57486
57487 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) {
57488         LDKNodeFeatures features_arg_conv;
57489         features_arg_conv.inner = untag_ptr(features_arg);
57490         features_arg_conv.is_owned = ptr_is_owned(features_arg);
57491         CHECK_INNER_FIELD_ACCESS_OR_NULL(features_arg_conv);
57492         features_arg_conv = NodeFeatures_clone(&features_arg_conv);
57493         LDKThreeBytes rgb_arg_ref;
57494         CHECK(rgb_arg->arr_len == 3);
57495         memcpy(rgb_arg_ref.data, rgb_arg->elems, 3); FREE(rgb_arg);
57496         LDKNodeAlias alias_arg_conv;
57497         alias_arg_conv.inner = untag_ptr(alias_arg);
57498         alias_arg_conv.is_owned = ptr_is_owned(alias_arg);
57499         CHECK_INNER_FIELD_ACCESS_OR_NULL(alias_arg_conv);
57500         alias_arg_conv = NodeAlias_clone(&alias_arg_conv);
57501         LDKNodeAnnouncement announcement_message_arg_conv;
57502         announcement_message_arg_conv.inner = untag_ptr(announcement_message_arg);
57503         announcement_message_arg_conv.is_owned = ptr_is_owned(announcement_message_arg);
57504         CHECK_INNER_FIELD_ACCESS_OR_NULL(announcement_message_arg_conv);
57505         announcement_message_arg_conv = NodeAnnouncement_clone(&announcement_message_arg_conv);
57506         LDKNodeAnnouncementInfo ret_var = NodeAnnouncementInfo_new(features_arg_conv, last_update_arg, rgb_arg_ref, alias_arg_conv, announcement_message_arg_conv);
57507         uint64_t ret_ref = 0;
57508         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
57509         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
57510         return ret_ref;
57511 }
57512
57513 static inline uint64_t NodeAnnouncementInfo_clone_ptr(LDKNodeAnnouncementInfo *NONNULL_PTR arg) {
57514         LDKNodeAnnouncementInfo ret_var = NodeAnnouncementInfo_clone(arg);
57515         uint64_t ret_ref = 0;
57516         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
57517         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
57518         return ret_ref;
57519 }
57520 int64_t  __attribute__((export_name("TS_NodeAnnouncementInfo_clone_ptr"))) TS_NodeAnnouncementInfo_clone_ptr(uint64_t arg) {
57521         LDKNodeAnnouncementInfo arg_conv;
57522         arg_conv.inner = untag_ptr(arg);
57523         arg_conv.is_owned = ptr_is_owned(arg);
57524         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
57525         arg_conv.is_owned = false;
57526         int64_t ret_conv = NodeAnnouncementInfo_clone_ptr(&arg_conv);
57527         return ret_conv;
57528 }
57529
57530 uint64_t  __attribute__((export_name("TS_NodeAnnouncementInfo_clone"))) TS_NodeAnnouncementInfo_clone(uint64_t orig) {
57531         LDKNodeAnnouncementInfo orig_conv;
57532         orig_conv.inner = untag_ptr(orig);
57533         orig_conv.is_owned = ptr_is_owned(orig);
57534         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
57535         orig_conv.is_owned = false;
57536         LDKNodeAnnouncementInfo ret_var = NodeAnnouncementInfo_clone(&orig_conv);
57537         uint64_t ret_ref = 0;
57538         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
57539         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
57540         return ret_ref;
57541 }
57542
57543 jboolean  __attribute__((export_name("TS_NodeAnnouncementInfo_eq"))) TS_NodeAnnouncementInfo_eq(uint64_t a, uint64_t b) {
57544         LDKNodeAnnouncementInfo a_conv;
57545         a_conv.inner = untag_ptr(a);
57546         a_conv.is_owned = ptr_is_owned(a);
57547         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
57548         a_conv.is_owned = false;
57549         LDKNodeAnnouncementInfo b_conv;
57550         b_conv.inner = untag_ptr(b);
57551         b_conv.is_owned = ptr_is_owned(b);
57552         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
57553         b_conv.is_owned = false;
57554         jboolean ret_conv = NodeAnnouncementInfo_eq(&a_conv, &b_conv);
57555         return ret_conv;
57556 }
57557
57558 uint64_tArray  __attribute__((export_name("TS_NodeAnnouncementInfo_addresses"))) TS_NodeAnnouncementInfo_addresses(uint64_t this_arg) {
57559         LDKNodeAnnouncementInfo this_arg_conv;
57560         this_arg_conv.inner = untag_ptr(this_arg);
57561         this_arg_conv.is_owned = ptr_is_owned(this_arg);
57562         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
57563         this_arg_conv.is_owned = false;
57564         LDKCVec_SocketAddressZ ret_var = NodeAnnouncementInfo_addresses(&this_arg_conv);
57565         uint64_tArray ret_arr = NULL;
57566         ret_arr = init_uint64_tArray(ret_var.datalen, __LINE__);
57567         uint64_t *ret_arr_ptr = (uint64_t*)(((uint8_t*)ret_arr) + 8);
57568         for (size_t p = 0; p < ret_var.datalen; p++) {
57569                 LDKSocketAddress *ret_conv_15_copy = MALLOC(sizeof(LDKSocketAddress), "LDKSocketAddress");
57570                 *ret_conv_15_copy = ret_var.data[p];
57571                 uint64_t ret_conv_15_ref = tag_ptr(ret_conv_15_copy, true);
57572                 ret_arr_ptr[p] = ret_conv_15_ref;
57573         }
57574         
57575         FREE(ret_var.data);
57576         return ret_arr;
57577 }
57578
57579 int8_tArray  __attribute__((export_name("TS_NodeAnnouncementInfo_write"))) TS_NodeAnnouncementInfo_write(uint64_t obj) {
57580         LDKNodeAnnouncementInfo obj_conv;
57581         obj_conv.inner = untag_ptr(obj);
57582         obj_conv.is_owned = ptr_is_owned(obj);
57583         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
57584         obj_conv.is_owned = false;
57585         LDKCVec_u8Z ret_var = NodeAnnouncementInfo_write(&obj_conv);
57586         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
57587         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
57588         CVec_u8Z_free(ret_var);
57589         return ret_arr;
57590 }
57591
57592 uint64_t  __attribute__((export_name("TS_NodeAnnouncementInfo_read"))) TS_NodeAnnouncementInfo_read(int8_tArray ser) {
57593         LDKu8slice ser_ref;
57594         ser_ref.datalen = ser->arr_len;
57595         ser_ref.data = ser->elems;
57596         LDKCResult_NodeAnnouncementInfoDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NodeAnnouncementInfoDecodeErrorZ), "LDKCResult_NodeAnnouncementInfoDecodeErrorZ");
57597         *ret_conv = NodeAnnouncementInfo_read(ser_ref);
57598         FREE(ser);
57599         return tag_ptr(ret_conv, true);
57600 }
57601
57602 void  __attribute__((export_name("TS_NodeAlias_free"))) TS_NodeAlias_free(uint64_t this_obj) {
57603         LDKNodeAlias this_obj_conv;
57604         this_obj_conv.inner = untag_ptr(this_obj);
57605         this_obj_conv.is_owned = ptr_is_owned(this_obj);
57606         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
57607         NodeAlias_free(this_obj_conv);
57608 }
57609
57610 int8_tArray  __attribute__((export_name("TS_NodeAlias_get_a"))) TS_NodeAlias_get_a(uint64_t this_ptr) {
57611         LDKNodeAlias this_ptr_conv;
57612         this_ptr_conv.inner = untag_ptr(this_ptr);
57613         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
57614         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
57615         this_ptr_conv.is_owned = false;
57616         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
57617         memcpy(ret_arr->elems, *NodeAlias_get_a(&this_ptr_conv), 32);
57618         return ret_arr;
57619 }
57620
57621 void  __attribute__((export_name("TS_NodeAlias_set_a"))) TS_NodeAlias_set_a(uint64_t this_ptr, int8_tArray val) {
57622         LDKNodeAlias this_ptr_conv;
57623         this_ptr_conv.inner = untag_ptr(this_ptr);
57624         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
57625         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
57626         this_ptr_conv.is_owned = false;
57627         LDKThirtyTwoBytes val_ref;
57628         CHECK(val->arr_len == 32);
57629         memcpy(val_ref.data, val->elems, 32); FREE(val);
57630         NodeAlias_set_a(&this_ptr_conv, val_ref);
57631 }
57632
57633 uint64_t  __attribute__((export_name("TS_NodeAlias_new"))) TS_NodeAlias_new(int8_tArray a_arg) {
57634         LDKThirtyTwoBytes a_arg_ref;
57635         CHECK(a_arg->arr_len == 32);
57636         memcpy(a_arg_ref.data, a_arg->elems, 32); FREE(a_arg);
57637         LDKNodeAlias ret_var = NodeAlias_new(a_arg_ref);
57638         uint64_t ret_ref = 0;
57639         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
57640         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
57641         return ret_ref;
57642 }
57643
57644 static inline uint64_t NodeAlias_clone_ptr(LDKNodeAlias *NONNULL_PTR arg) {
57645         LDKNodeAlias ret_var = NodeAlias_clone(arg);
57646         uint64_t ret_ref = 0;
57647         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
57648         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
57649         return ret_ref;
57650 }
57651 int64_t  __attribute__((export_name("TS_NodeAlias_clone_ptr"))) TS_NodeAlias_clone_ptr(uint64_t arg) {
57652         LDKNodeAlias arg_conv;
57653         arg_conv.inner = untag_ptr(arg);
57654         arg_conv.is_owned = ptr_is_owned(arg);
57655         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
57656         arg_conv.is_owned = false;
57657         int64_t ret_conv = NodeAlias_clone_ptr(&arg_conv);
57658         return ret_conv;
57659 }
57660
57661 uint64_t  __attribute__((export_name("TS_NodeAlias_clone"))) TS_NodeAlias_clone(uint64_t orig) {
57662         LDKNodeAlias orig_conv;
57663         orig_conv.inner = untag_ptr(orig);
57664         orig_conv.is_owned = ptr_is_owned(orig);
57665         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
57666         orig_conv.is_owned = false;
57667         LDKNodeAlias ret_var = NodeAlias_clone(&orig_conv);
57668         uint64_t ret_ref = 0;
57669         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
57670         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
57671         return ret_ref;
57672 }
57673
57674 jboolean  __attribute__((export_name("TS_NodeAlias_eq"))) TS_NodeAlias_eq(uint64_t a, uint64_t b) {
57675         LDKNodeAlias a_conv;
57676         a_conv.inner = untag_ptr(a);
57677         a_conv.is_owned = ptr_is_owned(a);
57678         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
57679         a_conv.is_owned = false;
57680         LDKNodeAlias b_conv;
57681         b_conv.inner = untag_ptr(b);
57682         b_conv.is_owned = ptr_is_owned(b);
57683         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
57684         b_conv.is_owned = false;
57685         jboolean ret_conv = NodeAlias_eq(&a_conv, &b_conv);
57686         return ret_conv;
57687 }
57688
57689 int8_tArray  __attribute__((export_name("TS_NodeAlias_write"))) TS_NodeAlias_write(uint64_t obj) {
57690         LDKNodeAlias obj_conv;
57691         obj_conv.inner = untag_ptr(obj);
57692         obj_conv.is_owned = ptr_is_owned(obj);
57693         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
57694         obj_conv.is_owned = false;
57695         LDKCVec_u8Z ret_var = NodeAlias_write(&obj_conv);
57696         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
57697         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
57698         CVec_u8Z_free(ret_var);
57699         return ret_arr;
57700 }
57701
57702 uint64_t  __attribute__((export_name("TS_NodeAlias_read"))) TS_NodeAlias_read(int8_tArray ser) {
57703         LDKu8slice ser_ref;
57704         ser_ref.datalen = ser->arr_len;
57705         ser_ref.data = ser->elems;
57706         LDKCResult_NodeAliasDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NodeAliasDecodeErrorZ), "LDKCResult_NodeAliasDecodeErrorZ");
57707         *ret_conv = NodeAlias_read(ser_ref);
57708         FREE(ser);
57709         return tag_ptr(ret_conv, true);
57710 }
57711
57712 void  __attribute__((export_name("TS_NodeInfo_free"))) TS_NodeInfo_free(uint64_t this_obj) {
57713         LDKNodeInfo this_obj_conv;
57714         this_obj_conv.inner = untag_ptr(this_obj);
57715         this_obj_conv.is_owned = ptr_is_owned(this_obj);
57716         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
57717         NodeInfo_free(this_obj_conv);
57718 }
57719
57720 int64_tArray  __attribute__((export_name("TS_NodeInfo_get_channels"))) TS_NodeInfo_get_channels(uint64_t this_ptr) {
57721         LDKNodeInfo this_ptr_conv;
57722         this_ptr_conv.inner = untag_ptr(this_ptr);
57723         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
57724         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
57725         this_ptr_conv.is_owned = false;
57726         LDKCVec_u64Z ret_var = NodeInfo_get_channels(&this_ptr_conv);
57727         int64_tArray ret_arr = NULL;
57728         ret_arr = init_int64_tArray(ret_var.datalen, __LINE__);
57729         int64_t *ret_arr_ptr = (int64_t*)(((uint8_t*)ret_arr) + 8);
57730         for (size_t i = 0; i < ret_var.datalen; i++) {
57731                 int64_t ret_conv_8_conv = ret_var.data[i];
57732                 ret_arr_ptr[i] = ret_conv_8_conv;
57733         }
57734         
57735         FREE(ret_var.data);
57736         return ret_arr;
57737 }
57738
57739 void  __attribute__((export_name("TS_NodeInfo_set_channels"))) TS_NodeInfo_set_channels(uint64_t this_ptr, int64_tArray val) {
57740         LDKNodeInfo this_ptr_conv;
57741         this_ptr_conv.inner = untag_ptr(this_ptr);
57742         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
57743         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
57744         this_ptr_conv.is_owned = false;
57745         LDKCVec_u64Z val_constr;
57746         val_constr.datalen = val->arr_len;
57747         if (val_constr.datalen > 0)
57748                 val_constr.data = MALLOC(val_constr.datalen * sizeof(int64_t), "LDKCVec_u64Z Elements");
57749         else
57750                 val_constr.data = NULL;
57751         int64_t* val_vals = val->elems;
57752         for (size_t i = 0; i < val_constr.datalen; i++) {
57753                 int64_t val_conv_8 = val_vals[i];
57754                 val_constr.data[i] = val_conv_8;
57755         }
57756         FREE(val);
57757         NodeInfo_set_channels(&this_ptr_conv, val_constr);
57758 }
57759
57760 uint64_t  __attribute__((export_name("TS_NodeInfo_get_announcement_info"))) TS_NodeInfo_get_announcement_info(uint64_t this_ptr) {
57761         LDKNodeInfo this_ptr_conv;
57762         this_ptr_conv.inner = untag_ptr(this_ptr);
57763         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
57764         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
57765         this_ptr_conv.is_owned = false;
57766         LDKNodeAnnouncementInfo ret_var = NodeInfo_get_announcement_info(&this_ptr_conv);
57767         uint64_t ret_ref = 0;
57768         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
57769         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
57770         return ret_ref;
57771 }
57772
57773 void  __attribute__((export_name("TS_NodeInfo_set_announcement_info"))) TS_NodeInfo_set_announcement_info(uint64_t this_ptr, uint64_t val) {
57774         LDKNodeInfo this_ptr_conv;
57775         this_ptr_conv.inner = untag_ptr(this_ptr);
57776         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
57777         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
57778         this_ptr_conv.is_owned = false;
57779         LDKNodeAnnouncementInfo val_conv;
57780         val_conv.inner = untag_ptr(val);
57781         val_conv.is_owned = ptr_is_owned(val);
57782         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
57783         val_conv = NodeAnnouncementInfo_clone(&val_conv);
57784         NodeInfo_set_announcement_info(&this_ptr_conv, val_conv);
57785 }
57786
57787 uint64_t  __attribute__((export_name("TS_NodeInfo_new"))) TS_NodeInfo_new(int64_tArray channels_arg, uint64_t announcement_info_arg) {
57788         LDKCVec_u64Z channels_arg_constr;
57789         channels_arg_constr.datalen = channels_arg->arr_len;
57790         if (channels_arg_constr.datalen > 0)
57791                 channels_arg_constr.data = MALLOC(channels_arg_constr.datalen * sizeof(int64_t), "LDKCVec_u64Z Elements");
57792         else
57793                 channels_arg_constr.data = NULL;
57794         int64_t* channels_arg_vals = channels_arg->elems;
57795         for (size_t i = 0; i < channels_arg_constr.datalen; i++) {
57796                 int64_t channels_arg_conv_8 = channels_arg_vals[i];
57797                 channels_arg_constr.data[i] = channels_arg_conv_8;
57798         }
57799         FREE(channels_arg);
57800         LDKNodeAnnouncementInfo announcement_info_arg_conv;
57801         announcement_info_arg_conv.inner = untag_ptr(announcement_info_arg);
57802         announcement_info_arg_conv.is_owned = ptr_is_owned(announcement_info_arg);
57803         CHECK_INNER_FIELD_ACCESS_OR_NULL(announcement_info_arg_conv);
57804         announcement_info_arg_conv = NodeAnnouncementInfo_clone(&announcement_info_arg_conv);
57805         LDKNodeInfo ret_var = NodeInfo_new(channels_arg_constr, announcement_info_arg_conv);
57806         uint64_t ret_ref = 0;
57807         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
57808         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
57809         return ret_ref;
57810 }
57811
57812 static inline uint64_t NodeInfo_clone_ptr(LDKNodeInfo *NONNULL_PTR arg) {
57813         LDKNodeInfo ret_var = NodeInfo_clone(arg);
57814         uint64_t ret_ref = 0;
57815         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
57816         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
57817         return ret_ref;
57818 }
57819 int64_t  __attribute__((export_name("TS_NodeInfo_clone_ptr"))) TS_NodeInfo_clone_ptr(uint64_t arg) {
57820         LDKNodeInfo arg_conv;
57821         arg_conv.inner = untag_ptr(arg);
57822         arg_conv.is_owned = ptr_is_owned(arg);
57823         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
57824         arg_conv.is_owned = false;
57825         int64_t ret_conv = NodeInfo_clone_ptr(&arg_conv);
57826         return ret_conv;
57827 }
57828
57829 uint64_t  __attribute__((export_name("TS_NodeInfo_clone"))) TS_NodeInfo_clone(uint64_t orig) {
57830         LDKNodeInfo orig_conv;
57831         orig_conv.inner = untag_ptr(orig);
57832         orig_conv.is_owned = ptr_is_owned(orig);
57833         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
57834         orig_conv.is_owned = false;
57835         LDKNodeInfo ret_var = NodeInfo_clone(&orig_conv);
57836         uint64_t ret_ref = 0;
57837         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
57838         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
57839         return ret_ref;
57840 }
57841
57842 jboolean  __attribute__((export_name("TS_NodeInfo_eq"))) TS_NodeInfo_eq(uint64_t a, uint64_t b) {
57843         LDKNodeInfo a_conv;
57844         a_conv.inner = untag_ptr(a);
57845         a_conv.is_owned = ptr_is_owned(a);
57846         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
57847         a_conv.is_owned = false;
57848         LDKNodeInfo b_conv;
57849         b_conv.inner = untag_ptr(b);
57850         b_conv.is_owned = ptr_is_owned(b);
57851         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
57852         b_conv.is_owned = false;
57853         jboolean ret_conv = NodeInfo_eq(&a_conv, &b_conv);
57854         return ret_conv;
57855 }
57856
57857 int8_tArray  __attribute__((export_name("TS_NodeInfo_write"))) TS_NodeInfo_write(uint64_t obj) {
57858         LDKNodeInfo obj_conv;
57859         obj_conv.inner = untag_ptr(obj);
57860         obj_conv.is_owned = ptr_is_owned(obj);
57861         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
57862         obj_conv.is_owned = false;
57863         LDKCVec_u8Z ret_var = NodeInfo_write(&obj_conv);
57864         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
57865         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
57866         CVec_u8Z_free(ret_var);
57867         return ret_arr;
57868 }
57869
57870 uint64_t  __attribute__((export_name("TS_NodeInfo_read"))) TS_NodeInfo_read(int8_tArray ser) {
57871         LDKu8slice ser_ref;
57872         ser_ref.datalen = ser->arr_len;
57873         ser_ref.data = ser->elems;
57874         LDKCResult_NodeInfoDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NodeInfoDecodeErrorZ), "LDKCResult_NodeInfoDecodeErrorZ");
57875         *ret_conv = NodeInfo_read(ser_ref);
57876         FREE(ser);
57877         return tag_ptr(ret_conv, true);
57878 }
57879
57880 int8_tArray  __attribute__((export_name("TS_NetworkGraph_write"))) TS_NetworkGraph_write(uint64_t obj) {
57881         LDKNetworkGraph obj_conv;
57882         obj_conv.inner = untag_ptr(obj);
57883         obj_conv.is_owned = ptr_is_owned(obj);
57884         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
57885         obj_conv.is_owned = false;
57886         LDKCVec_u8Z ret_var = NetworkGraph_write(&obj_conv);
57887         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
57888         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
57889         CVec_u8Z_free(ret_var);
57890         return ret_arr;
57891 }
57892
57893 uint64_t  __attribute__((export_name("TS_NetworkGraph_read"))) TS_NetworkGraph_read(int8_tArray ser, uint64_t arg) {
57894         LDKu8slice ser_ref;
57895         ser_ref.datalen = ser->arr_len;
57896         ser_ref.data = ser->elems;
57897         void* arg_ptr = untag_ptr(arg);
57898         CHECK_ACCESS(arg_ptr);
57899         LDKLogger arg_conv = *(LDKLogger*)(arg_ptr);
57900         if (arg_conv.free == LDKLogger_JCalls_free) {
57901                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
57902                 LDKLogger_JCalls_cloned(&arg_conv);
57903         }
57904         LDKCResult_NetworkGraphDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NetworkGraphDecodeErrorZ), "LDKCResult_NetworkGraphDecodeErrorZ");
57905         *ret_conv = NetworkGraph_read(ser_ref, arg_conv);
57906         FREE(ser);
57907         return tag_ptr(ret_conv, true);
57908 }
57909
57910 uint64_t  __attribute__((export_name("TS_NetworkGraph_new"))) TS_NetworkGraph_new(uint32_t network, uint64_t logger) {
57911         LDKNetwork network_conv = LDKNetwork_from_js(network);
57912         void* logger_ptr = untag_ptr(logger);
57913         CHECK_ACCESS(logger_ptr);
57914         LDKLogger logger_conv = *(LDKLogger*)(logger_ptr);
57915         if (logger_conv.free == LDKLogger_JCalls_free) {
57916                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
57917                 LDKLogger_JCalls_cloned(&logger_conv);
57918         }
57919         LDKNetworkGraph ret_var = NetworkGraph_new(network_conv, logger_conv);
57920         uint64_t ret_ref = 0;
57921         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
57922         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
57923         return ret_ref;
57924 }
57925
57926 uint64_t  __attribute__((export_name("TS_NetworkGraph_read_only"))) TS_NetworkGraph_read_only(uint64_t this_arg) {
57927         LDKNetworkGraph this_arg_conv;
57928         this_arg_conv.inner = untag_ptr(this_arg);
57929         this_arg_conv.is_owned = ptr_is_owned(this_arg);
57930         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
57931         this_arg_conv.is_owned = false;
57932         LDKReadOnlyNetworkGraph ret_var = NetworkGraph_read_only(&this_arg_conv);
57933         uint64_t ret_ref = 0;
57934         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
57935         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
57936         return ret_ref;
57937 }
57938
57939 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) {
57940         LDKNetworkGraph this_arg_conv;
57941         this_arg_conv.inner = untag_ptr(this_arg);
57942         this_arg_conv.is_owned = ptr_is_owned(this_arg);
57943         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
57944         this_arg_conv.is_owned = false;
57945         LDKCOption_u32Z *ret_copy = MALLOC(sizeof(LDKCOption_u32Z), "LDKCOption_u32Z");
57946         *ret_copy = NetworkGraph_get_last_rapid_gossip_sync_timestamp(&this_arg_conv);
57947         uint64_t ret_ref = tag_ptr(ret_copy, true);
57948         return ret_ref;
57949 }
57950
57951 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) {
57952         LDKNetworkGraph this_arg_conv;
57953         this_arg_conv.inner = untag_ptr(this_arg);
57954         this_arg_conv.is_owned = ptr_is_owned(this_arg);
57955         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
57956         this_arg_conv.is_owned = false;
57957         NetworkGraph_set_last_rapid_gossip_sync_timestamp(&this_arg_conv, last_rapid_gossip_sync_timestamp);
57958 }
57959
57960 uint64_t  __attribute__((export_name("TS_NetworkGraph_update_node_from_announcement"))) TS_NetworkGraph_update_node_from_announcement(uint64_t this_arg, uint64_t msg) {
57961         LDKNetworkGraph this_arg_conv;
57962         this_arg_conv.inner = untag_ptr(this_arg);
57963         this_arg_conv.is_owned = ptr_is_owned(this_arg);
57964         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
57965         this_arg_conv.is_owned = false;
57966         LDKNodeAnnouncement msg_conv;
57967         msg_conv.inner = untag_ptr(msg);
57968         msg_conv.is_owned = ptr_is_owned(msg);
57969         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
57970         msg_conv.is_owned = false;
57971         LDKCResult_NoneLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneLightningErrorZ), "LDKCResult_NoneLightningErrorZ");
57972         *ret_conv = NetworkGraph_update_node_from_announcement(&this_arg_conv, &msg_conv);
57973         return tag_ptr(ret_conv, true);
57974 }
57975
57976 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) {
57977         LDKNetworkGraph this_arg_conv;
57978         this_arg_conv.inner = untag_ptr(this_arg);
57979         this_arg_conv.is_owned = ptr_is_owned(this_arg);
57980         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
57981         this_arg_conv.is_owned = false;
57982         LDKUnsignedNodeAnnouncement msg_conv;
57983         msg_conv.inner = untag_ptr(msg);
57984         msg_conv.is_owned = ptr_is_owned(msg);
57985         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
57986         msg_conv.is_owned = false;
57987         LDKCResult_NoneLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneLightningErrorZ), "LDKCResult_NoneLightningErrorZ");
57988         *ret_conv = NetworkGraph_update_node_from_unsigned_announcement(&this_arg_conv, &msg_conv);
57989         return tag_ptr(ret_conv, true);
57990 }
57991
57992 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) {
57993         LDKNetworkGraph this_arg_conv;
57994         this_arg_conv.inner = untag_ptr(this_arg);
57995         this_arg_conv.is_owned = ptr_is_owned(this_arg);
57996         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
57997         this_arg_conv.is_owned = false;
57998         LDKChannelAnnouncement msg_conv;
57999         msg_conv.inner = untag_ptr(msg);
58000         msg_conv.is_owned = ptr_is_owned(msg);
58001         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
58002         msg_conv.is_owned = false;
58003         void* utxo_lookup_ptr = untag_ptr(utxo_lookup);
58004         CHECK_ACCESS(utxo_lookup_ptr);
58005         LDKCOption_UtxoLookupZ utxo_lookup_conv = *(LDKCOption_UtxoLookupZ*)(utxo_lookup_ptr);
58006         // WARNING: we may need a move here but no clone is available for LDKCOption_UtxoLookupZ
58007         if (utxo_lookup_conv.tag == LDKCOption_UtxoLookupZ_Some) {
58008                 // Manually implement clone for Java trait instances
58009                 if (utxo_lookup_conv.some.free == LDKUtxoLookup_JCalls_free) {
58010                         // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
58011                         LDKUtxoLookup_JCalls_cloned(&utxo_lookup_conv.some);
58012                 }
58013         }
58014         LDKCResult_NoneLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneLightningErrorZ), "LDKCResult_NoneLightningErrorZ");
58015         *ret_conv = NetworkGraph_update_channel_from_announcement(&this_arg_conv, &msg_conv, utxo_lookup_conv);
58016         return tag_ptr(ret_conv, true);
58017 }
58018
58019 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) {
58020         LDKNetworkGraph this_arg_conv;
58021         this_arg_conv.inner = untag_ptr(this_arg);
58022         this_arg_conv.is_owned = ptr_is_owned(this_arg);
58023         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
58024         this_arg_conv.is_owned = false;
58025         LDKChannelAnnouncement msg_conv;
58026         msg_conv.inner = untag_ptr(msg);
58027         msg_conv.is_owned = ptr_is_owned(msg);
58028         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
58029         msg_conv.is_owned = false;
58030         LDKCResult_NoneLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneLightningErrorZ), "LDKCResult_NoneLightningErrorZ");
58031         *ret_conv = NetworkGraph_update_channel_from_announcement_no_lookup(&this_arg_conv, &msg_conv);
58032         return tag_ptr(ret_conv, true);
58033 }
58034
58035 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) {
58036         LDKNetworkGraph this_arg_conv;
58037         this_arg_conv.inner = untag_ptr(this_arg);
58038         this_arg_conv.is_owned = ptr_is_owned(this_arg);
58039         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
58040         this_arg_conv.is_owned = false;
58041         LDKUnsignedChannelAnnouncement msg_conv;
58042         msg_conv.inner = untag_ptr(msg);
58043         msg_conv.is_owned = ptr_is_owned(msg);
58044         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
58045         msg_conv.is_owned = false;
58046         void* utxo_lookup_ptr = untag_ptr(utxo_lookup);
58047         CHECK_ACCESS(utxo_lookup_ptr);
58048         LDKCOption_UtxoLookupZ utxo_lookup_conv = *(LDKCOption_UtxoLookupZ*)(utxo_lookup_ptr);
58049         // WARNING: we may need a move here but no clone is available for LDKCOption_UtxoLookupZ
58050         if (utxo_lookup_conv.tag == LDKCOption_UtxoLookupZ_Some) {
58051                 // Manually implement clone for Java trait instances
58052                 if (utxo_lookup_conv.some.free == LDKUtxoLookup_JCalls_free) {
58053                         // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
58054                         LDKUtxoLookup_JCalls_cloned(&utxo_lookup_conv.some);
58055                 }
58056         }
58057         LDKCResult_NoneLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneLightningErrorZ), "LDKCResult_NoneLightningErrorZ");
58058         *ret_conv = NetworkGraph_update_channel_from_unsigned_announcement(&this_arg_conv, &msg_conv, utxo_lookup_conv);
58059         return tag_ptr(ret_conv, true);
58060 }
58061
58062 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) {
58063         LDKNetworkGraph this_arg_conv;
58064         this_arg_conv.inner = untag_ptr(this_arg);
58065         this_arg_conv.is_owned = ptr_is_owned(this_arg);
58066         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
58067         this_arg_conv.is_owned = false;
58068         LDKChannelFeatures features_conv;
58069         features_conv.inner = untag_ptr(features);
58070         features_conv.is_owned = ptr_is_owned(features);
58071         CHECK_INNER_FIELD_ACCESS_OR_NULL(features_conv);
58072         features_conv = ChannelFeatures_clone(&features_conv);
58073         LDKPublicKey node_id_1_ref;
58074         CHECK(node_id_1->arr_len == 33);
58075         memcpy(node_id_1_ref.compressed_form, node_id_1->elems, 33); FREE(node_id_1);
58076         LDKPublicKey node_id_2_ref;
58077         CHECK(node_id_2->arr_len == 33);
58078         memcpy(node_id_2_ref.compressed_form, node_id_2->elems, 33); FREE(node_id_2);
58079         LDKCResult_NoneLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneLightningErrorZ), "LDKCResult_NoneLightningErrorZ");
58080         *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);
58081         return tag_ptr(ret_conv, true);
58082 }
58083
58084 void  __attribute__((export_name("TS_NetworkGraph_channel_failed_permanent"))) TS_NetworkGraph_channel_failed_permanent(uint64_t this_arg, int64_t short_channel_id) {
58085         LDKNetworkGraph this_arg_conv;
58086         this_arg_conv.inner = untag_ptr(this_arg);
58087         this_arg_conv.is_owned = ptr_is_owned(this_arg);
58088         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
58089         this_arg_conv.is_owned = false;
58090         NetworkGraph_channel_failed_permanent(&this_arg_conv, short_channel_id);
58091 }
58092
58093 void  __attribute__((export_name("TS_NetworkGraph_node_failed_permanent"))) TS_NetworkGraph_node_failed_permanent(uint64_t this_arg, int8_tArray node_id) {
58094         LDKNetworkGraph this_arg_conv;
58095         this_arg_conv.inner = untag_ptr(this_arg);
58096         this_arg_conv.is_owned = ptr_is_owned(this_arg);
58097         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
58098         this_arg_conv.is_owned = false;
58099         LDKPublicKey node_id_ref;
58100         CHECK(node_id->arr_len == 33);
58101         memcpy(node_id_ref.compressed_form, node_id->elems, 33); FREE(node_id);
58102         NetworkGraph_node_failed_permanent(&this_arg_conv, node_id_ref);
58103 }
58104
58105 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) {
58106         LDKNetworkGraph this_arg_conv;
58107         this_arg_conv.inner = untag_ptr(this_arg);
58108         this_arg_conv.is_owned = ptr_is_owned(this_arg);
58109         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
58110         this_arg_conv.is_owned = false;
58111         NetworkGraph_remove_stale_channels_and_tracking_with_time(&this_arg_conv, current_time_unix);
58112 }
58113
58114 uint64_t  __attribute__((export_name("TS_NetworkGraph_update_channel"))) TS_NetworkGraph_update_channel(uint64_t this_arg, uint64_t msg) {
58115         LDKNetworkGraph this_arg_conv;
58116         this_arg_conv.inner = untag_ptr(this_arg);
58117         this_arg_conv.is_owned = ptr_is_owned(this_arg);
58118         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
58119         this_arg_conv.is_owned = false;
58120         LDKChannelUpdate msg_conv;
58121         msg_conv.inner = untag_ptr(msg);
58122         msg_conv.is_owned = ptr_is_owned(msg);
58123         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
58124         msg_conv.is_owned = false;
58125         LDKCResult_NoneLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneLightningErrorZ), "LDKCResult_NoneLightningErrorZ");
58126         *ret_conv = NetworkGraph_update_channel(&this_arg_conv, &msg_conv);
58127         return tag_ptr(ret_conv, true);
58128 }
58129
58130 uint64_t  __attribute__((export_name("TS_NetworkGraph_update_channel_unsigned"))) TS_NetworkGraph_update_channel_unsigned(uint64_t this_arg, uint64_t msg) {
58131         LDKNetworkGraph this_arg_conv;
58132         this_arg_conv.inner = untag_ptr(this_arg);
58133         this_arg_conv.is_owned = ptr_is_owned(this_arg);
58134         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
58135         this_arg_conv.is_owned = false;
58136         LDKUnsignedChannelUpdate msg_conv;
58137         msg_conv.inner = untag_ptr(msg);
58138         msg_conv.is_owned = ptr_is_owned(msg);
58139         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
58140         msg_conv.is_owned = false;
58141         LDKCResult_NoneLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneLightningErrorZ), "LDKCResult_NoneLightningErrorZ");
58142         *ret_conv = NetworkGraph_update_channel_unsigned(&this_arg_conv, &msg_conv);
58143         return tag_ptr(ret_conv, true);
58144 }
58145
58146 uint64_t  __attribute__((export_name("TS_NetworkGraph_verify_channel_update"))) TS_NetworkGraph_verify_channel_update(uint64_t this_arg, uint64_t msg) {
58147         LDKNetworkGraph this_arg_conv;
58148         this_arg_conv.inner = untag_ptr(this_arg);
58149         this_arg_conv.is_owned = ptr_is_owned(this_arg);
58150         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
58151         this_arg_conv.is_owned = false;
58152         LDKChannelUpdate msg_conv;
58153         msg_conv.inner = untag_ptr(msg);
58154         msg_conv.is_owned = ptr_is_owned(msg);
58155         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
58156         msg_conv.is_owned = false;
58157         LDKCResult_NoneLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneLightningErrorZ), "LDKCResult_NoneLightningErrorZ");
58158         *ret_conv = NetworkGraph_verify_channel_update(&this_arg_conv, &msg_conv);
58159         return tag_ptr(ret_conv, true);
58160 }
58161
58162 uint64_t  __attribute__((export_name("TS_ReadOnlyNetworkGraph_channel"))) TS_ReadOnlyNetworkGraph_channel(uint64_t this_arg, int64_t short_channel_id) {
58163         LDKReadOnlyNetworkGraph this_arg_conv;
58164         this_arg_conv.inner = untag_ptr(this_arg);
58165         this_arg_conv.is_owned = ptr_is_owned(this_arg);
58166         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
58167         this_arg_conv.is_owned = false;
58168         LDKChannelInfo ret_var = ReadOnlyNetworkGraph_channel(&this_arg_conv, short_channel_id);
58169         uint64_t ret_ref = 0;
58170         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
58171         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
58172         return ret_ref;
58173 }
58174
58175 int64_tArray  __attribute__((export_name("TS_ReadOnlyNetworkGraph_list_channels"))) TS_ReadOnlyNetworkGraph_list_channels(uint64_t this_arg) {
58176         LDKReadOnlyNetworkGraph this_arg_conv;
58177         this_arg_conv.inner = untag_ptr(this_arg);
58178         this_arg_conv.is_owned = ptr_is_owned(this_arg);
58179         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
58180         this_arg_conv.is_owned = false;
58181         LDKCVec_u64Z ret_var = ReadOnlyNetworkGraph_list_channels(&this_arg_conv);
58182         int64_tArray ret_arr = NULL;
58183         ret_arr = init_int64_tArray(ret_var.datalen, __LINE__);
58184         int64_t *ret_arr_ptr = (int64_t*)(((uint8_t*)ret_arr) + 8);
58185         for (size_t i = 0; i < ret_var.datalen; i++) {
58186                 int64_t ret_conv_8_conv = ret_var.data[i];
58187                 ret_arr_ptr[i] = ret_conv_8_conv;
58188         }
58189         
58190         FREE(ret_var.data);
58191         return ret_arr;
58192 }
58193
58194 uint64_t  __attribute__((export_name("TS_ReadOnlyNetworkGraph_node"))) TS_ReadOnlyNetworkGraph_node(uint64_t this_arg, uint64_t node_id) {
58195         LDKReadOnlyNetworkGraph this_arg_conv;
58196         this_arg_conv.inner = untag_ptr(this_arg);
58197         this_arg_conv.is_owned = ptr_is_owned(this_arg);
58198         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
58199         this_arg_conv.is_owned = false;
58200         LDKNodeId node_id_conv;
58201         node_id_conv.inner = untag_ptr(node_id);
58202         node_id_conv.is_owned = ptr_is_owned(node_id);
58203         CHECK_INNER_FIELD_ACCESS_OR_NULL(node_id_conv);
58204         node_id_conv.is_owned = false;
58205         LDKNodeInfo ret_var = ReadOnlyNetworkGraph_node(&this_arg_conv, &node_id_conv);
58206         uint64_t ret_ref = 0;
58207         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
58208         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
58209         return ret_ref;
58210 }
58211
58212 uint64_tArray  __attribute__((export_name("TS_ReadOnlyNetworkGraph_list_nodes"))) TS_ReadOnlyNetworkGraph_list_nodes(uint64_t this_arg) {
58213         LDKReadOnlyNetworkGraph this_arg_conv;
58214         this_arg_conv.inner = untag_ptr(this_arg);
58215         this_arg_conv.is_owned = ptr_is_owned(this_arg);
58216         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
58217         this_arg_conv.is_owned = false;
58218         LDKCVec_NodeIdZ ret_var = ReadOnlyNetworkGraph_list_nodes(&this_arg_conv);
58219         uint64_tArray ret_arr = NULL;
58220         ret_arr = init_uint64_tArray(ret_var.datalen, __LINE__);
58221         uint64_t *ret_arr_ptr = (uint64_t*)(((uint8_t*)ret_arr) + 8);
58222         for (size_t i = 0; i < ret_var.datalen; i++) {
58223                 LDKNodeId ret_conv_8_var = ret_var.data[i];
58224                 uint64_t ret_conv_8_ref = 0;
58225                 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_conv_8_var);
58226                 ret_conv_8_ref = tag_ptr(ret_conv_8_var.inner, ret_conv_8_var.is_owned);
58227                 ret_arr_ptr[i] = ret_conv_8_ref;
58228         }
58229         
58230         FREE(ret_var.data);
58231         return ret_arr;
58232 }
58233
58234 uint64_t  __attribute__((export_name("TS_ReadOnlyNetworkGraph_get_addresses"))) TS_ReadOnlyNetworkGraph_get_addresses(uint64_t this_arg, int8_tArray pubkey) {
58235         LDKReadOnlyNetworkGraph this_arg_conv;
58236         this_arg_conv.inner = untag_ptr(this_arg);
58237         this_arg_conv.is_owned = ptr_is_owned(this_arg);
58238         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
58239         this_arg_conv.is_owned = false;
58240         LDKPublicKey pubkey_ref;
58241         CHECK(pubkey->arr_len == 33);
58242         memcpy(pubkey_ref.compressed_form, pubkey->elems, 33); FREE(pubkey);
58243         LDKCOption_CVec_SocketAddressZZ *ret_copy = MALLOC(sizeof(LDKCOption_CVec_SocketAddressZZ), "LDKCOption_CVec_SocketAddressZZ");
58244         *ret_copy = ReadOnlyNetworkGraph_get_addresses(&this_arg_conv, pubkey_ref);
58245         uint64_t ret_ref = tag_ptr(ret_copy, true);
58246         return ret_ref;
58247 }
58248
58249 void  __attribute__((export_name("TS_DefaultRouter_free"))) TS_DefaultRouter_free(uint64_t this_obj) {
58250         LDKDefaultRouter this_obj_conv;
58251         this_obj_conv.inner = untag_ptr(this_obj);
58252         this_obj_conv.is_owned = ptr_is_owned(this_obj);
58253         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
58254         DefaultRouter_free(this_obj_conv);
58255 }
58256
58257 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) {
58258         LDKNetworkGraph network_graph_conv;
58259         network_graph_conv.inner = untag_ptr(network_graph);
58260         network_graph_conv.is_owned = ptr_is_owned(network_graph);
58261         CHECK_INNER_FIELD_ACCESS_OR_NULL(network_graph_conv);
58262         network_graph_conv.is_owned = false;
58263         void* logger_ptr = untag_ptr(logger);
58264         CHECK_ACCESS(logger_ptr);
58265         LDKLogger logger_conv = *(LDKLogger*)(logger_ptr);
58266         if (logger_conv.free == LDKLogger_JCalls_free) {
58267                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
58268                 LDKLogger_JCalls_cloned(&logger_conv);
58269         }
58270         LDKThirtyTwoBytes random_seed_bytes_ref;
58271         CHECK(random_seed_bytes->arr_len == 32);
58272         memcpy(random_seed_bytes_ref.data, random_seed_bytes->elems, 32); FREE(random_seed_bytes);
58273         void* scorer_ptr = untag_ptr(scorer);
58274         CHECK_ACCESS(scorer_ptr);
58275         LDKLockableScore scorer_conv = *(LDKLockableScore*)(scorer_ptr);
58276         if (scorer_conv.free == LDKLockableScore_JCalls_free) {
58277                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
58278                 LDKLockableScore_JCalls_cloned(&scorer_conv);
58279         }
58280         LDKProbabilisticScoringFeeParameters score_params_conv;
58281         score_params_conv.inner = untag_ptr(score_params);
58282         score_params_conv.is_owned = ptr_is_owned(score_params);
58283         CHECK_INNER_FIELD_ACCESS_OR_NULL(score_params_conv);
58284         score_params_conv = ProbabilisticScoringFeeParameters_clone(&score_params_conv);
58285         LDKDefaultRouter ret_var = DefaultRouter_new(&network_graph_conv, logger_conv, random_seed_bytes_ref, scorer_conv, score_params_conv);
58286         uint64_t ret_ref = 0;
58287         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
58288         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
58289         return ret_ref;
58290 }
58291
58292 uint64_t  __attribute__((export_name("TS_DefaultRouter_as_Router"))) TS_DefaultRouter_as_Router(uint64_t this_arg) {
58293         LDKDefaultRouter this_arg_conv;
58294         this_arg_conv.inner = untag_ptr(this_arg);
58295         this_arg_conv.is_owned = ptr_is_owned(this_arg);
58296         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
58297         this_arg_conv.is_owned = false;
58298         LDKRouter* ret_ret = MALLOC(sizeof(LDKRouter), "LDKRouter");
58299         *ret_ret = DefaultRouter_as_Router(&this_arg_conv);
58300         return tag_ptr(ret_ret, true);
58301 }
58302
58303 void  __attribute__((export_name("TS_Router_free"))) TS_Router_free(uint64_t this_ptr) {
58304         if (!ptr_is_owned(this_ptr)) return;
58305         void* this_ptr_ptr = untag_ptr(this_ptr);
58306         CHECK_ACCESS(this_ptr_ptr);
58307         LDKRouter this_ptr_conv = *(LDKRouter*)(this_ptr_ptr);
58308         FREE(untag_ptr(this_ptr));
58309         Router_free(this_ptr_conv);
58310 }
58311
58312 void  __attribute__((export_name("TS_ScorerAccountingForInFlightHtlcs_free"))) TS_ScorerAccountingForInFlightHtlcs_free(uint64_t this_obj) {
58313         LDKScorerAccountingForInFlightHtlcs this_obj_conv;
58314         this_obj_conv.inner = untag_ptr(this_obj);
58315         this_obj_conv.is_owned = ptr_is_owned(this_obj);
58316         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
58317         ScorerAccountingForInFlightHtlcs_free(this_obj_conv);
58318 }
58319
58320 uint64_t  __attribute__((export_name("TS_ScorerAccountingForInFlightHtlcs_new"))) TS_ScorerAccountingForInFlightHtlcs_new(uint64_t scorer, uint64_t inflight_htlcs) {
58321         void* scorer_ptr = untag_ptr(scorer);
58322         CHECK_ACCESS(scorer_ptr);
58323         LDKScoreLookUp scorer_conv = *(LDKScoreLookUp*)(scorer_ptr);
58324         if (scorer_conv.free == LDKScoreLookUp_JCalls_free) {
58325                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
58326                 LDKScoreLookUp_JCalls_cloned(&scorer_conv);
58327         }
58328         LDKInFlightHtlcs inflight_htlcs_conv;
58329         inflight_htlcs_conv.inner = untag_ptr(inflight_htlcs);
58330         inflight_htlcs_conv.is_owned = ptr_is_owned(inflight_htlcs);
58331         CHECK_INNER_FIELD_ACCESS_OR_NULL(inflight_htlcs_conv);
58332         inflight_htlcs_conv.is_owned = false;
58333         LDKScorerAccountingForInFlightHtlcs ret_var = ScorerAccountingForInFlightHtlcs_new(scorer_conv, &inflight_htlcs_conv);
58334         uint64_t ret_ref = 0;
58335         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
58336         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
58337         return ret_ref;
58338 }
58339
58340 uint64_t  __attribute__((export_name("TS_ScorerAccountingForInFlightHtlcs_as_ScoreLookUp"))) TS_ScorerAccountingForInFlightHtlcs_as_ScoreLookUp(uint64_t this_arg) {
58341         LDKScorerAccountingForInFlightHtlcs this_arg_conv;
58342         this_arg_conv.inner = untag_ptr(this_arg);
58343         this_arg_conv.is_owned = ptr_is_owned(this_arg);
58344         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
58345         this_arg_conv.is_owned = false;
58346         LDKScoreLookUp* ret_ret = MALLOC(sizeof(LDKScoreLookUp), "LDKScoreLookUp");
58347         *ret_ret = ScorerAccountingForInFlightHtlcs_as_ScoreLookUp(&this_arg_conv);
58348         return tag_ptr(ret_ret, true);
58349 }
58350
58351 void  __attribute__((export_name("TS_InFlightHtlcs_free"))) TS_InFlightHtlcs_free(uint64_t this_obj) {
58352         LDKInFlightHtlcs this_obj_conv;
58353         this_obj_conv.inner = untag_ptr(this_obj);
58354         this_obj_conv.is_owned = ptr_is_owned(this_obj);
58355         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
58356         InFlightHtlcs_free(this_obj_conv);
58357 }
58358
58359 static inline uint64_t InFlightHtlcs_clone_ptr(LDKInFlightHtlcs *NONNULL_PTR arg) {
58360         LDKInFlightHtlcs ret_var = InFlightHtlcs_clone(arg);
58361         uint64_t ret_ref = 0;
58362         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
58363         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
58364         return ret_ref;
58365 }
58366 int64_t  __attribute__((export_name("TS_InFlightHtlcs_clone_ptr"))) TS_InFlightHtlcs_clone_ptr(uint64_t arg) {
58367         LDKInFlightHtlcs arg_conv;
58368         arg_conv.inner = untag_ptr(arg);
58369         arg_conv.is_owned = ptr_is_owned(arg);
58370         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
58371         arg_conv.is_owned = false;
58372         int64_t ret_conv = InFlightHtlcs_clone_ptr(&arg_conv);
58373         return ret_conv;
58374 }
58375
58376 uint64_t  __attribute__((export_name("TS_InFlightHtlcs_clone"))) TS_InFlightHtlcs_clone(uint64_t orig) {
58377         LDKInFlightHtlcs orig_conv;
58378         orig_conv.inner = untag_ptr(orig);
58379         orig_conv.is_owned = ptr_is_owned(orig);
58380         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
58381         orig_conv.is_owned = false;
58382         LDKInFlightHtlcs ret_var = InFlightHtlcs_clone(&orig_conv);
58383         uint64_t ret_ref = 0;
58384         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
58385         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
58386         return ret_ref;
58387 }
58388
58389 uint64_t  __attribute__((export_name("TS_InFlightHtlcs_new"))) TS_InFlightHtlcs_new() {
58390         LDKInFlightHtlcs ret_var = InFlightHtlcs_new();
58391         uint64_t ret_ref = 0;
58392         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
58393         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
58394         return ret_ref;
58395 }
58396
58397 void  __attribute__((export_name("TS_InFlightHtlcs_process_path"))) TS_InFlightHtlcs_process_path(uint64_t this_arg, uint64_t path, int8_tArray payer_node_id) {
58398         LDKInFlightHtlcs this_arg_conv;
58399         this_arg_conv.inner = untag_ptr(this_arg);
58400         this_arg_conv.is_owned = ptr_is_owned(this_arg);
58401         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
58402         this_arg_conv.is_owned = false;
58403         LDKPath path_conv;
58404         path_conv.inner = untag_ptr(path);
58405         path_conv.is_owned = ptr_is_owned(path);
58406         CHECK_INNER_FIELD_ACCESS_OR_NULL(path_conv);
58407         path_conv.is_owned = false;
58408         LDKPublicKey payer_node_id_ref;
58409         CHECK(payer_node_id->arr_len == 33);
58410         memcpy(payer_node_id_ref.compressed_form, payer_node_id->elems, 33); FREE(payer_node_id);
58411         InFlightHtlcs_process_path(&this_arg_conv, &path_conv, payer_node_id_ref);
58412 }
58413
58414 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) {
58415         LDKInFlightHtlcs this_arg_conv;
58416         this_arg_conv.inner = untag_ptr(this_arg);
58417         this_arg_conv.is_owned = ptr_is_owned(this_arg);
58418         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
58419         this_arg_conv.is_owned = false;
58420         LDKNodeId source_conv;
58421         source_conv.inner = untag_ptr(source);
58422         source_conv.is_owned = ptr_is_owned(source);
58423         CHECK_INNER_FIELD_ACCESS_OR_NULL(source_conv);
58424         source_conv.is_owned = false;
58425         LDKNodeId target_conv;
58426         target_conv.inner = untag_ptr(target);
58427         target_conv.is_owned = ptr_is_owned(target);
58428         CHECK_INNER_FIELD_ACCESS_OR_NULL(target_conv);
58429         target_conv.is_owned = false;
58430         InFlightHtlcs_add_inflight_htlc(&this_arg_conv, &source_conv, &target_conv, channel_scid, used_msat);
58431 }
58432
58433 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) {
58434         LDKInFlightHtlcs this_arg_conv;
58435         this_arg_conv.inner = untag_ptr(this_arg);
58436         this_arg_conv.is_owned = ptr_is_owned(this_arg);
58437         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
58438         this_arg_conv.is_owned = false;
58439         LDKNodeId source_conv;
58440         source_conv.inner = untag_ptr(source);
58441         source_conv.is_owned = ptr_is_owned(source);
58442         CHECK_INNER_FIELD_ACCESS_OR_NULL(source_conv);
58443         source_conv.is_owned = false;
58444         LDKNodeId target_conv;
58445         target_conv.inner = untag_ptr(target);
58446         target_conv.is_owned = ptr_is_owned(target);
58447         CHECK_INNER_FIELD_ACCESS_OR_NULL(target_conv);
58448         target_conv.is_owned = false;
58449         LDKCOption_u64Z *ret_copy = MALLOC(sizeof(LDKCOption_u64Z), "LDKCOption_u64Z");
58450         *ret_copy = InFlightHtlcs_used_liquidity_msat(&this_arg_conv, &source_conv, &target_conv, channel_scid);
58451         uint64_t ret_ref = tag_ptr(ret_copy, true);
58452         return ret_ref;
58453 }
58454
58455 int8_tArray  __attribute__((export_name("TS_InFlightHtlcs_write"))) TS_InFlightHtlcs_write(uint64_t obj) {
58456         LDKInFlightHtlcs obj_conv;
58457         obj_conv.inner = untag_ptr(obj);
58458         obj_conv.is_owned = ptr_is_owned(obj);
58459         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
58460         obj_conv.is_owned = false;
58461         LDKCVec_u8Z ret_var = InFlightHtlcs_write(&obj_conv);
58462         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
58463         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
58464         CVec_u8Z_free(ret_var);
58465         return ret_arr;
58466 }
58467
58468 uint64_t  __attribute__((export_name("TS_InFlightHtlcs_read"))) TS_InFlightHtlcs_read(int8_tArray ser) {
58469         LDKu8slice ser_ref;
58470         ser_ref.datalen = ser->arr_len;
58471         ser_ref.data = ser->elems;
58472         LDKCResult_InFlightHtlcsDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InFlightHtlcsDecodeErrorZ), "LDKCResult_InFlightHtlcsDecodeErrorZ");
58473         *ret_conv = InFlightHtlcs_read(ser_ref);
58474         FREE(ser);
58475         return tag_ptr(ret_conv, true);
58476 }
58477
58478 void  __attribute__((export_name("TS_RouteHop_free"))) TS_RouteHop_free(uint64_t this_obj) {
58479         LDKRouteHop this_obj_conv;
58480         this_obj_conv.inner = untag_ptr(this_obj);
58481         this_obj_conv.is_owned = ptr_is_owned(this_obj);
58482         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
58483         RouteHop_free(this_obj_conv);
58484 }
58485
58486 int8_tArray  __attribute__((export_name("TS_RouteHop_get_pubkey"))) TS_RouteHop_get_pubkey(uint64_t this_ptr) {
58487         LDKRouteHop this_ptr_conv;
58488         this_ptr_conv.inner = untag_ptr(this_ptr);
58489         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
58490         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
58491         this_ptr_conv.is_owned = false;
58492         int8_tArray ret_arr = init_int8_tArray(33, __LINE__);
58493         memcpy(ret_arr->elems, RouteHop_get_pubkey(&this_ptr_conv).compressed_form, 33);
58494         return ret_arr;
58495 }
58496
58497 void  __attribute__((export_name("TS_RouteHop_set_pubkey"))) TS_RouteHop_set_pubkey(uint64_t this_ptr, int8_tArray val) {
58498         LDKRouteHop this_ptr_conv;
58499         this_ptr_conv.inner = untag_ptr(this_ptr);
58500         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
58501         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
58502         this_ptr_conv.is_owned = false;
58503         LDKPublicKey val_ref;
58504         CHECK(val->arr_len == 33);
58505         memcpy(val_ref.compressed_form, val->elems, 33); FREE(val);
58506         RouteHop_set_pubkey(&this_ptr_conv, val_ref);
58507 }
58508
58509 uint64_t  __attribute__((export_name("TS_RouteHop_get_node_features"))) TS_RouteHop_get_node_features(uint64_t this_ptr) {
58510         LDKRouteHop this_ptr_conv;
58511         this_ptr_conv.inner = untag_ptr(this_ptr);
58512         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
58513         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
58514         this_ptr_conv.is_owned = false;
58515         LDKNodeFeatures ret_var = RouteHop_get_node_features(&this_ptr_conv);
58516         uint64_t ret_ref = 0;
58517         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
58518         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
58519         return ret_ref;
58520 }
58521
58522 void  __attribute__((export_name("TS_RouteHop_set_node_features"))) TS_RouteHop_set_node_features(uint64_t this_ptr, uint64_t val) {
58523         LDKRouteHop this_ptr_conv;
58524         this_ptr_conv.inner = untag_ptr(this_ptr);
58525         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
58526         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
58527         this_ptr_conv.is_owned = false;
58528         LDKNodeFeatures val_conv;
58529         val_conv.inner = untag_ptr(val);
58530         val_conv.is_owned = ptr_is_owned(val);
58531         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
58532         val_conv = NodeFeatures_clone(&val_conv);
58533         RouteHop_set_node_features(&this_ptr_conv, val_conv);
58534 }
58535
58536 int64_t  __attribute__((export_name("TS_RouteHop_get_short_channel_id"))) TS_RouteHop_get_short_channel_id(uint64_t this_ptr) {
58537         LDKRouteHop this_ptr_conv;
58538         this_ptr_conv.inner = untag_ptr(this_ptr);
58539         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
58540         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
58541         this_ptr_conv.is_owned = false;
58542         int64_t ret_conv = RouteHop_get_short_channel_id(&this_ptr_conv);
58543         return ret_conv;
58544 }
58545
58546 void  __attribute__((export_name("TS_RouteHop_set_short_channel_id"))) TS_RouteHop_set_short_channel_id(uint64_t this_ptr, int64_t val) {
58547         LDKRouteHop this_ptr_conv;
58548         this_ptr_conv.inner = untag_ptr(this_ptr);
58549         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
58550         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
58551         this_ptr_conv.is_owned = false;
58552         RouteHop_set_short_channel_id(&this_ptr_conv, val);
58553 }
58554
58555 uint64_t  __attribute__((export_name("TS_RouteHop_get_channel_features"))) TS_RouteHop_get_channel_features(uint64_t this_ptr) {
58556         LDKRouteHop this_ptr_conv;
58557         this_ptr_conv.inner = untag_ptr(this_ptr);
58558         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
58559         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
58560         this_ptr_conv.is_owned = false;
58561         LDKChannelFeatures ret_var = RouteHop_get_channel_features(&this_ptr_conv);
58562         uint64_t ret_ref = 0;
58563         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
58564         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
58565         return ret_ref;
58566 }
58567
58568 void  __attribute__((export_name("TS_RouteHop_set_channel_features"))) TS_RouteHop_set_channel_features(uint64_t this_ptr, uint64_t val) {
58569         LDKRouteHop this_ptr_conv;
58570         this_ptr_conv.inner = untag_ptr(this_ptr);
58571         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
58572         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
58573         this_ptr_conv.is_owned = false;
58574         LDKChannelFeatures val_conv;
58575         val_conv.inner = untag_ptr(val);
58576         val_conv.is_owned = ptr_is_owned(val);
58577         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
58578         val_conv = ChannelFeatures_clone(&val_conv);
58579         RouteHop_set_channel_features(&this_ptr_conv, val_conv);
58580 }
58581
58582 int64_t  __attribute__((export_name("TS_RouteHop_get_fee_msat"))) TS_RouteHop_get_fee_msat(uint64_t this_ptr) {
58583         LDKRouteHop this_ptr_conv;
58584         this_ptr_conv.inner = untag_ptr(this_ptr);
58585         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
58586         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
58587         this_ptr_conv.is_owned = false;
58588         int64_t ret_conv = RouteHop_get_fee_msat(&this_ptr_conv);
58589         return ret_conv;
58590 }
58591
58592 void  __attribute__((export_name("TS_RouteHop_set_fee_msat"))) TS_RouteHop_set_fee_msat(uint64_t this_ptr, int64_t val) {
58593         LDKRouteHop this_ptr_conv;
58594         this_ptr_conv.inner = untag_ptr(this_ptr);
58595         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
58596         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
58597         this_ptr_conv.is_owned = false;
58598         RouteHop_set_fee_msat(&this_ptr_conv, val);
58599 }
58600
58601 int32_t  __attribute__((export_name("TS_RouteHop_get_cltv_expiry_delta"))) TS_RouteHop_get_cltv_expiry_delta(uint64_t this_ptr) {
58602         LDKRouteHop this_ptr_conv;
58603         this_ptr_conv.inner = untag_ptr(this_ptr);
58604         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
58605         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
58606         this_ptr_conv.is_owned = false;
58607         int32_t ret_conv = RouteHop_get_cltv_expiry_delta(&this_ptr_conv);
58608         return ret_conv;
58609 }
58610
58611 void  __attribute__((export_name("TS_RouteHop_set_cltv_expiry_delta"))) TS_RouteHop_set_cltv_expiry_delta(uint64_t this_ptr, int32_t val) {
58612         LDKRouteHop this_ptr_conv;
58613         this_ptr_conv.inner = untag_ptr(this_ptr);
58614         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
58615         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
58616         this_ptr_conv.is_owned = false;
58617         RouteHop_set_cltv_expiry_delta(&this_ptr_conv, val);
58618 }
58619
58620 jboolean  __attribute__((export_name("TS_RouteHop_get_maybe_announced_channel"))) TS_RouteHop_get_maybe_announced_channel(uint64_t this_ptr) {
58621         LDKRouteHop this_ptr_conv;
58622         this_ptr_conv.inner = untag_ptr(this_ptr);
58623         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
58624         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
58625         this_ptr_conv.is_owned = false;
58626         jboolean ret_conv = RouteHop_get_maybe_announced_channel(&this_ptr_conv);
58627         return ret_conv;
58628 }
58629
58630 void  __attribute__((export_name("TS_RouteHop_set_maybe_announced_channel"))) TS_RouteHop_set_maybe_announced_channel(uint64_t this_ptr, jboolean val) {
58631         LDKRouteHop this_ptr_conv;
58632         this_ptr_conv.inner = untag_ptr(this_ptr);
58633         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
58634         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
58635         this_ptr_conv.is_owned = false;
58636         RouteHop_set_maybe_announced_channel(&this_ptr_conv, val);
58637 }
58638
58639 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) {
58640         LDKPublicKey pubkey_arg_ref;
58641         CHECK(pubkey_arg->arr_len == 33);
58642         memcpy(pubkey_arg_ref.compressed_form, pubkey_arg->elems, 33); FREE(pubkey_arg);
58643         LDKNodeFeatures node_features_arg_conv;
58644         node_features_arg_conv.inner = untag_ptr(node_features_arg);
58645         node_features_arg_conv.is_owned = ptr_is_owned(node_features_arg);
58646         CHECK_INNER_FIELD_ACCESS_OR_NULL(node_features_arg_conv);
58647         node_features_arg_conv = NodeFeatures_clone(&node_features_arg_conv);
58648         LDKChannelFeatures channel_features_arg_conv;
58649         channel_features_arg_conv.inner = untag_ptr(channel_features_arg);
58650         channel_features_arg_conv.is_owned = ptr_is_owned(channel_features_arg);
58651         CHECK_INNER_FIELD_ACCESS_OR_NULL(channel_features_arg_conv);
58652         channel_features_arg_conv = ChannelFeatures_clone(&channel_features_arg_conv);
58653         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);
58654         uint64_t ret_ref = 0;
58655         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
58656         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
58657         return ret_ref;
58658 }
58659
58660 static inline uint64_t RouteHop_clone_ptr(LDKRouteHop *NONNULL_PTR arg) {
58661         LDKRouteHop ret_var = RouteHop_clone(arg);
58662         uint64_t ret_ref = 0;
58663         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
58664         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
58665         return ret_ref;
58666 }
58667 int64_t  __attribute__((export_name("TS_RouteHop_clone_ptr"))) TS_RouteHop_clone_ptr(uint64_t arg) {
58668         LDKRouteHop arg_conv;
58669         arg_conv.inner = untag_ptr(arg);
58670         arg_conv.is_owned = ptr_is_owned(arg);
58671         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
58672         arg_conv.is_owned = false;
58673         int64_t ret_conv = RouteHop_clone_ptr(&arg_conv);
58674         return ret_conv;
58675 }
58676
58677 uint64_t  __attribute__((export_name("TS_RouteHop_clone"))) TS_RouteHop_clone(uint64_t orig) {
58678         LDKRouteHop orig_conv;
58679         orig_conv.inner = untag_ptr(orig);
58680         orig_conv.is_owned = ptr_is_owned(orig);
58681         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
58682         orig_conv.is_owned = false;
58683         LDKRouteHop ret_var = RouteHop_clone(&orig_conv);
58684         uint64_t ret_ref = 0;
58685         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
58686         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
58687         return ret_ref;
58688 }
58689
58690 int64_t  __attribute__((export_name("TS_RouteHop_hash"))) TS_RouteHop_hash(uint64_t o) {
58691         LDKRouteHop o_conv;
58692         o_conv.inner = untag_ptr(o);
58693         o_conv.is_owned = ptr_is_owned(o);
58694         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
58695         o_conv.is_owned = false;
58696         int64_t ret_conv = RouteHop_hash(&o_conv);
58697         return ret_conv;
58698 }
58699
58700 jboolean  __attribute__((export_name("TS_RouteHop_eq"))) TS_RouteHop_eq(uint64_t a, uint64_t b) {
58701         LDKRouteHop a_conv;
58702         a_conv.inner = untag_ptr(a);
58703         a_conv.is_owned = ptr_is_owned(a);
58704         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
58705         a_conv.is_owned = false;
58706         LDKRouteHop b_conv;
58707         b_conv.inner = untag_ptr(b);
58708         b_conv.is_owned = ptr_is_owned(b);
58709         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
58710         b_conv.is_owned = false;
58711         jboolean ret_conv = RouteHop_eq(&a_conv, &b_conv);
58712         return ret_conv;
58713 }
58714
58715 int8_tArray  __attribute__((export_name("TS_RouteHop_write"))) TS_RouteHop_write(uint64_t obj) {
58716         LDKRouteHop obj_conv;
58717         obj_conv.inner = untag_ptr(obj);
58718         obj_conv.is_owned = ptr_is_owned(obj);
58719         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
58720         obj_conv.is_owned = false;
58721         LDKCVec_u8Z ret_var = RouteHop_write(&obj_conv);
58722         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
58723         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
58724         CVec_u8Z_free(ret_var);
58725         return ret_arr;
58726 }
58727
58728 uint64_t  __attribute__((export_name("TS_RouteHop_read"))) TS_RouteHop_read(int8_tArray ser) {
58729         LDKu8slice ser_ref;
58730         ser_ref.datalen = ser->arr_len;
58731         ser_ref.data = ser->elems;
58732         LDKCResult_RouteHopDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteHopDecodeErrorZ), "LDKCResult_RouteHopDecodeErrorZ");
58733         *ret_conv = RouteHop_read(ser_ref);
58734         FREE(ser);
58735         return tag_ptr(ret_conv, true);
58736 }
58737
58738 void  __attribute__((export_name("TS_BlindedTail_free"))) TS_BlindedTail_free(uint64_t this_obj) {
58739         LDKBlindedTail this_obj_conv;
58740         this_obj_conv.inner = untag_ptr(this_obj);
58741         this_obj_conv.is_owned = ptr_is_owned(this_obj);
58742         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
58743         BlindedTail_free(this_obj_conv);
58744 }
58745
58746 uint64_tArray  __attribute__((export_name("TS_BlindedTail_get_hops"))) TS_BlindedTail_get_hops(uint64_t this_ptr) {
58747         LDKBlindedTail this_ptr_conv;
58748         this_ptr_conv.inner = untag_ptr(this_ptr);
58749         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
58750         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
58751         this_ptr_conv.is_owned = false;
58752         LDKCVec_BlindedHopZ ret_var = BlindedTail_get_hops(&this_ptr_conv);
58753         uint64_tArray ret_arr = NULL;
58754         ret_arr = init_uint64_tArray(ret_var.datalen, __LINE__);
58755         uint64_t *ret_arr_ptr = (uint64_t*)(((uint8_t*)ret_arr) + 8);
58756         for (size_t m = 0; m < ret_var.datalen; m++) {
58757                 LDKBlindedHop ret_conv_12_var = ret_var.data[m];
58758                 uint64_t ret_conv_12_ref = 0;
58759                 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_conv_12_var);
58760                 ret_conv_12_ref = tag_ptr(ret_conv_12_var.inner, ret_conv_12_var.is_owned);
58761                 ret_arr_ptr[m] = ret_conv_12_ref;
58762         }
58763         
58764         FREE(ret_var.data);
58765         return ret_arr;
58766 }
58767
58768 void  __attribute__((export_name("TS_BlindedTail_set_hops"))) TS_BlindedTail_set_hops(uint64_t this_ptr, uint64_tArray val) {
58769         LDKBlindedTail this_ptr_conv;
58770         this_ptr_conv.inner = untag_ptr(this_ptr);
58771         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
58772         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
58773         this_ptr_conv.is_owned = false;
58774         LDKCVec_BlindedHopZ val_constr;
58775         val_constr.datalen = val->arr_len;
58776         if (val_constr.datalen > 0)
58777                 val_constr.data = MALLOC(val_constr.datalen * sizeof(LDKBlindedHop), "LDKCVec_BlindedHopZ Elements");
58778         else
58779                 val_constr.data = NULL;
58780         uint64_t* val_vals = val->elems;
58781         for (size_t m = 0; m < val_constr.datalen; m++) {
58782                 uint64_t val_conv_12 = val_vals[m];
58783                 LDKBlindedHop val_conv_12_conv;
58784                 val_conv_12_conv.inner = untag_ptr(val_conv_12);
58785                 val_conv_12_conv.is_owned = ptr_is_owned(val_conv_12);
58786                 CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv_12_conv);
58787                 val_conv_12_conv = BlindedHop_clone(&val_conv_12_conv);
58788                 val_constr.data[m] = val_conv_12_conv;
58789         }
58790         FREE(val);
58791         BlindedTail_set_hops(&this_ptr_conv, val_constr);
58792 }
58793
58794 int8_tArray  __attribute__((export_name("TS_BlindedTail_get_blinding_point"))) TS_BlindedTail_get_blinding_point(uint64_t this_ptr) {
58795         LDKBlindedTail this_ptr_conv;
58796         this_ptr_conv.inner = untag_ptr(this_ptr);
58797         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
58798         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
58799         this_ptr_conv.is_owned = false;
58800         int8_tArray ret_arr = init_int8_tArray(33, __LINE__);
58801         memcpy(ret_arr->elems, BlindedTail_get_blinding_point(&this_ptr_conv).compressed_form, 33);
58802         return ret_arr;
58803 }
58804
58805 void  __attribute__((export_name("TS_BlindedTail_set_blinding_point"))) TS_BlindedTail_set_blinding_point(uint64_t this_ptr, int8_tArray val) {
58806         LDKBlindedTail this_ptr_conv;
58807         this_ptr_conv.inner = untag_ptr(this_ptr);
58808         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
58809         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
58810         this_ptr_conv.is_owned = false;
58811         LDKPublicKey val_ref;
58812         CHECK(val->arr_len == 33);
58813         memcpy(val_ref.compressed_form, val->elems, 33); FREE(val);
58814         BlindedTail_set_blinding_point(&this_ptr_conv, val_ref);
58815 }
58816
58817 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) {
58818         LDKBlindedTail this_ptr_conv;
58819         this_ptr_conv.inner = untag_ptr(this_ptr);
58820         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
58821         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
58822         this_ptr_conv.is_owned = false;
58823         int32_t ret_conv = BlindedTail_get_excess_final_cltv_expiry_delta(&this_ptr_conv);
58824         return ret_conv;
58825 }
58826
58827 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) {
58828         LDKBlindedTail this_ptr_conv;
58829         this_ptr_conv.inner = untag_ptr(this_ptr);
58830         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
58831         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
58832         this_ptr_conv.is_owned = false;
58833         BlindedTail_set_excess_final_cltv_expiry_delta(&this_ptr_conv, val);
58834 }
58835
58836 int64_t  __attribute__((export_name("TS_BlindedTail_get_final_value_msat"))) TS_BlindedTail_get_final_value_msat(uint64_t this_ptr) {
58837         LDKBlindedTail this_ptr_conv;
58838         this_ptr_conv.inner = untag_ptr(this_ptr);
58839         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
58840         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
58841         this_ptr_conv.is_owned = false;
58842         int64_t ret_conv = BlindedTail_get_final_value_msat(&this_ptr_conv);
58843         return ret_conv;
58844 }
58845
58846 void  __attribute__((export_name("TS_BlindedTail_set_final_value_msat"))) TS_BlindedTail_set_final_value_msat(uint64_t this_ptr, int64_t val) {
58847         LDKBlindedTail this_ptr_conv;
58848         this_ptr_conv.inner = untag_ptr(this_ptr);
58849         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
58850         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
58851         this_ptr_conv.is_owned = false;
58852         BlindedTail_set_final_value_msat(&this_ptr_conv, val);
58853 }
58854
58855 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) {
58856         LDKCVec_BlindedHopZ hops_arg_constr;
58857         hops_arg_constr.datalen = hops_arg->arr_len;
58858         if (hops_arg_constr.datalen > 0)
58859                 hops_arg_constr.data = MALLOC(hops_arg_constr.datalen * sizeof(LDKBlindedHop), "LDKCVec_BlindedHopZ Elements");
58860         else
58861                 hops_arg_constr.data = NULL;
58862         uint64_t* hops_arg_vals = hops_arg->elems;
58863         for (size_t m = 0; m < hops_arg_constr.datalen; m++) {
58864                 uint64_t hops_arg_conv_12 = hops_arg_vals[m];
58865                 LDKBlindedHop hops_arg_conv_12_conv;
58866                 hops_arg_conv_12_conv.inner = untag_ptr(hops_arg_conv_12);
58867                 hops_arg_conv_12_conv.is_owned = ptr_is_owned(hops_arg_conv_12);
58868                 CHECK_INNER_FIELD_ACCESS_OR_NULL(hops_arg_conv_12_conv);
58869                 hops_arg_conv_12_conv = BlindedHop_clone(&hops_arg_conv_12_conv);
58870                 hops_arg_constr.data[m] = hops_arg_conv_12_conv;
58871         }
58872         FREE(hops_arg);
58873         LDKPublicKey blinding_point_arg_ref;
58874         CHECK(blinding_point_arg->arr_len == 33);
58875         memcpy(blinding_point_arg_ref.compressed_form, blinding_point_arg->elems, 33); FREE(blinding_point_arg);
58876         LDKBlindedTail ret_var = BlindedTail_new(hops_arg_constr, blinding_point_arg_ref, excess_final_cltv_expiry_delta_arg, final_value_msat_arg);
58877         uint64_t ret_ref = 0;
58878         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
58879         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
58880         return ret_ref;
58881 }
58882
58883 static inline uint64_t BlindedTail_clone_ptr(LDKBlindedTail *NONNULL_PTR arg) {
58884         LDKBlindedTail ret_var = BlindedTail_clone(arg);
58885         uint64_t ret_ref = 0;
58886         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
58887         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
58888         return ret_ref;
58889 }
58890 int64_t  __attribute__((export_name("TS_BlindedTail_clone_ptr"))) TS_BlindedTail_clone_ptr(uint64_t arg) {
58891         LDKBlindedTail arg_conv;
58892         arg_conv.inner = untag_ptr(arg);
58893         arg_conv.is_owned = ptr_is_owned(arg);
58894         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
58895         arg_conv.is_owned = false;
58896         int64_t ret_conv = BlindedTail_clone_ptr(&arg_conv);
58897         return ret_conv;
58898 }
58899
58900 uint64_t  __attribute__((export_name("TS_BlindedTail_clone"))) TS_BlindedTail_clone(uint64_t orig) {
58901         LDKBlindedTail orig_conv;
58902         orig_conv.inner = untag_ptr(orig);
58903         orig_conv.is_owned = ptr_is_owned(orig);
58904         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
58905         orig_conv.is_owned = false;
58906         LDKBlindedTail ret_var = BlindedTail_clone(&orig_conv);
58907         uint64_t ret_ref = 0;
58908         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
58909         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
58910         return ret_ref;
58911 }
58912
58913 int64_t  __attribute__((export_name("TS_BlindedTail_hash"))) TS_BlindedTail_hash(uint64_t o) {
58914         LDKBlindedTail o_conv;
58915         o_conv.inner = untag_ptr(o);
58916         o_conv.is_owned = ptr_is_owned(o);
58917         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
58918         o_conv.is_owned = false;
58919         int64_t ret_conv = BlindedTail_hash(&o_conv);
58920         return ret_conv;
58921 }
58922
58923 jboolean  __attribute__((export_name("TS_BlindedTail_eq"))) TS_BlindedTail_eq(uint64_t a, uint64_t b) {
58924         LDKBlindedTail a_conv;
58925         a_conv.inner = untag_ptr(a);
58926         a_conv.is_owned = ptr_is_owned(a);
58927         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
58928         a_conv.is_owned = false;
58929         LDKBlindedTail b_conv;
58930         b_conv.inner = untag_ptr(b);
58931         b_conv.is_owned = ptr_is_owned(b);
58932         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
58933         b_conv.is_owned = false;
58934         jboolean ret_conv = BlindedTail_eq(&a_conv, &b_conv);
58935         return ret_conv;
58936 }
58937
58938 int8_tArray  __attribute__((export_name("TS_BlindedTail_write"))) TS_BlindedTail_write(uint64_t obj) {
58939         LDKBlindedTail obj_conv;
58940         obj_conv.inner = untag_ptr(obj);
58941         obj_conv.is_owned = ptr_is_owned(obj);
58942         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
58943         obj_conv.is_owned = false;
58944         LDKCVec_u8Z ret_var = BlindedTail_write(&obj_conv);
58945         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
58946         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
58947         CVec_u8Z_free(ret_var);
58948         return ret_arr;
58949 }
58950
58951 uint64_t  __attribute__((export_name("TS_BlindedTail_read"))) TS_BlindedTail_read(int8_tArray ser) {
58952         LDKu8slice ser_ref;
58953         ser_ref.datalen = ser->arr_len;
58954         ser_ref.data = ser->elems;
58955         LDKCResult_BlindedTailDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_BlindedTailDecodeErrorZ), "LDKCResult_BlindedTailDecodeErrorZ");
58956         *ret_conv = BlindedTail_read(ser_ref);
58957         FREE(ser);
58958         return tag_ptr(ret_conv, true);
58959 }
58960
58961 void  __attribute__((export_name("TS_Path_free"))) TS_Path_free(uint64_t this_obj) {
58962         LDKPath this_obj_conv;
58963         this_obj_conv.inner = untag_ptr(this_obj);
58964         this_obj_conv.is_owned = ptr_is_owned(this_obj);
58965         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
58966         Path_free(this_obj_conv);
58967 }
58968
58969 uint64_tArray  __attribute__((export_name("TS_Path_get_hops"))) TS_Path_get_hops(uint64_t this_ptr) {
58970         LDKPath this_ptr_conv;
58971         this_ptr_conv.inner = untag_ptr(this_ptr);
58972         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
58973         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
58974         this_ptr_conv.is_owned = false;
58975         LDKCVec_RouteHopZ ret_var = Path_get_hops(&this_ptr_conv);
58976         uint64_tArray ret_arr = NULL;
58977         ret_arr = init_uint64_tArray(ret_var.datalen, __LINE__);
58978         uint64_t *ret_arr_ptr = (uint64_t*)(((uint8_t*)ret_arr) + 8);
58979         for (size_t k = 0; k < ret_var.datalen; k++) {
58980                 LDKRouteHop ret_conv_10_var = ret_var.data[k];
58981                 uint64_t ret_conv_10_ref = 0;
58982                 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_conv_10_var);
58983                 ret_conv_10_ref = tag_ptr(ret_conv_10_var.inner, ret_conv_10_var.is_owned);
58984                 ret_arr_ptr[k] = ret_conv_10_ref;
58985         }
58986         
58987         FREE(ret_var.data);
58988         return ret_arr;
58989 }
58990
58991 void  __attribute__((export_name("TS_Path_set_hops"))) TS_Path_set_hops(uint64_t this_ptr, uint64_tArray val) {
58992         LDKPath this_ptr_conv;
58993         this_ptr_conv.inner = untag_ptr(this_ptr);
58994         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
58995         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
58996         this_ptr_conv.is_owned = false;
58997         LDKCVec_RouteHopZ val_constr;
58998         val_constr.datalen = val->arr_len;
58999         if (val_constr.datalen > 0)
59000                 val_constr.data = MALLOC(val_constr.datalen * sizeof(LDKRouteHop), "LDKCVec_RouteHopZ Elements");
59001         else
59002                 val_constr.data = NULL;
59003         uint64_t* val_vals = val->elems;
59004         for (size_t k = 0; k < val_constr.datalen; k++) {
59005                 uint64_t val_conv_10 = val_vals[k];
59006                 LDKRouteHop val_conv_10_conv;
59007                 val_conv_10_conv.inner = untag_ptr(val_conv_10);
59008                 val_conv_10_conv.is_owned = ptr_is_owned(val_conv_10);
59009                 CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv_10_conv);
59010                 val_conv_10_conv = RouteHop_clone(&val_conv_10_conv);
59011                 val_constr.data[k] = val_conv_10_conv;
59012         }
59013         FREE(val);
59014         Path_set_hops(&this_ptr_conv, val_constr);
59015 }
59016
59017 uint64_t  __attribute__((export_name("TS_Path_get_blinded_tail"))) TS_Path_get_blinded_tail(uint64_t this_ptr) {
59018         LDKPath this_ptr_conv;
59019         this_ptr_conv.inner = untag_ptr(this_ptr);
59020         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
59021         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
59022         this_ptr_conv.is_owned = false;
59023         LDKBlindedTail ret_var = Path_get_blinded_tail(&this_ptr_conv);
59024         uint64_t ret_ref = 0;
59025         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
59026         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
59027         return ret_ref;
59028 }
59029
59030 void  __attribute__((export_name("TS_Path_set_blinded_tail"))) TS_Path_set_blinded_tail(uint64_t this_ptr, uint64_t val) {
59031         LDKPath this_ptr_conv;
59032         this_ptr_conv.inner = untag_ptr(this_ptr);
59033         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
59034         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
59035         this_ptr_conv.is_owned = false;
59036         LDKBlindedTail val_conv;
59037         val_conv.inner = untag_ptr(val);
59038         val_conv.is_owned = ptr_is_owned(val);
59039         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
59040         val_conv = BlindedTail_clone(&val_conv);
59041         Path_set_blinded_tail(&this_ptr_conv, val_conv);
59042 }
59043
59044 uint64_t  __attribute__((export_name("TS_Path_new"))) TS_Path_new(uint64_tArray hops_arg, uint64_t blinded_tail_arg) {
59045         LDKCVec_RouteHopZ hops_arg_constr;
59046         hops_arg_constr.datalen = hops_arg->arr_len;
59047         if (hops_arg_constr.datalen > 0)
59048                 hops_arg_constr.data = MALLOC(hops_arg_constr.datalen * sizeof(LDKRouteHop), "LDKCVec_RouteHopZ Elements");
59049         else
59050                 hops_arg_constr.data = NULL;
59051         uint64_t* hops_arg_vals = hops_arg->elems;
59052         for (size_t k = 0; k < hops_arg_constr.datalen; k++) {
59053                 uint64_t hops_arg_conv_10 = hops_arg_vals[k];
59054                 LDKRouteHop hops_arg_conv_10_conv;
59055                 hops_arg_conv_10_conv.inner = untag_ptr(hops_arg_conv_10);
59056                 hops_arg_conv_10_conv.is_owned = ptr_is_owned(hops_arg_conv_10);
59057                 CHECK_INNER_FIELD_ACCESS_OR_NULL(hops_arg_conv_10_conv);
59058                 hops_arg_conv_10_conv = RouteHop_clone(&hops_arg_conv_10_conv);
59059                 hops_arg_constr.data[k] = hops_arg_conv_10_conv;
59060         }
59061         FREE(hops_arg);
59062         LDKBlindedTail blinded_tail_arg_conv;
59063         blinded_tail_arg_conv.inner = untag_ptr(blinded_tail_arg);
59064         blinded_tail_arg_conv.is_owned = ptr_is_owned(blinded_tail_arg);
59065         CHECK_INNER_FIELD_ACCESS_OR_NULL(blinded_tail_arg_conv);
59066         blinded_tail_arg_conv = BlindedTail_clone(&blinded_tail_arg_conv);
59067         LDKPath ret_var = Path_new(hops_arg_constr, blinded_tail_arg_conv);
59068         uint64_t ret_ref = 0;
59069         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
59070         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
59071         return ret_ref;
59072 }
59073
59074 static inline uint64_t Path_clone_ptr(LDKPath *NONNULL_PTR arg) {
59075         LDKPath ret_var = Path_clone(arg);
59076         uint64_t ret_ref = 0;
59077         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
59078         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
59079         return ret_ref;
59080 }
59081 int64_t  __attribute__((export_name("TS_Path_clone_ptr"))) TS_Path_clone_ptr(uint64_t arg) {
59082         LDKPath arg_conv;
59083         arg_conv.inner = untag_ptr(arg);
59084         arg_conv.is_owned = ptr_is_owned(arg);
59085         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
59086         arg_conv.is_owned = false;
59087         int64_t ret_conv = Path_clone_ptr(&arg_conv);
59088         return ret_conv;
59089 }
59090
59091 uint64_t  __attribute__((export_name("TS_Path_clone"))) TS_Path_clone(uint64_t orig) {
59092         LDKPath orig_conv;
59093         orig_conv.inner = untag_ptr(orig);
59094         orig_conv.is_owned = ptr_is_owned(orig);
59095         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
59096         orig_conv.is_owned = false;
59097         LDKPath ret_var = Path_clone(&orig_conv);
59098         uint64_t ret_ref = 0;
59099         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
59100         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
59101         return ret_ref;
59102 }
59103
59104 int64_t  __attribute__((export_name("TS_Path_hash"))) TS_Path_hash(uint64_t o) {
59105         LDKPath o_conv;
59106         o_conv.inner = untag_ptr(o);
59107         o_conv.is_owned = ptr_is_owned(o);
59108         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
59109         o_conv.is_owned = false;
59110         int64_t ret_conv = Path_hash(&o_conv);
59111         return ret_conv;
59112 }
59113
59114 jboolean  __attribute__((export_name("TS_Path_eq"))) TS_Path_eq(uint64_t a, uint64_t b) {
59115         LDKPath a_conv;
59116         a_conv.inner = untag_ptr(a);
59117         a_conv.is_owned = ptr_is_owned(a);
59118         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
59119         a_conv.is_owned = false;
59120         LDKPath b_conv;
59121         b_conv.inner = untag_ptr(b);
59122         b_conv.is_owned = ptr_is_owned(b);
59123         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
59124         b_conv.is_owned = false;
59125         jboolean ret_conv = Path_eq(&a_conv, &b_conv);
59126         return ret_conv;
59127 }
59128
59129 int64_t  __attribute__((export_name("TS_Path_fee_msat"))) TS_Path_fee_msat(uint64_t this_arg) {
59130         LDKPath this_arg_conv;
59131         this_arg_conv.inner = untag_ptr(this_arg);
59132         this_arg_conv.is_owned = ptr_is_owned(this_arg);
59133         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
59134         this_arg_conv.is_owned = false;
59135         int64_t ret_conv = Path_fee_msat(&this_arg_conv);
59136         return ret_conv;
59137 }
59138
59139 int64_t  __attribute__((export_name("TS_Path_final_value_msat"))) TS_Path_final_value_msat(uint64_t this_arg) {
59140         LDKPath this_arg_conv;
59141         this_arg_conv.inner = untag_ptr(this_arg);
59142         this_arg_conv.is_owned = ptr_is_owned(this_arg);
59143         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
59144         this_arg_conv.is_owned = false;
59145         int64_t ret_conv = Path_final_value_msat(&this_arg_conv);
59146         return ret_conv;
59147 }
59148
59149 uint64_t  __attribute__((export_name("TS_Path_final_cltv_expiry_delta"))) TS_Path_final_cltv_expiry_delta(uint64_t this_arg) {
59150         LDKPath this_arg_conv;
59151         this_arg_conv.inner = untag_ptr(this_arg);
59152         this_arg_conv.is_owned = ptr_is_owned(this_arg);
59153         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
59154         this_arg_conv.is_owned = false;
59155         LDKCOption_u32Z *ret_copy = MALLOC(sizeof(LDKCOption_u32Z), "LDKCOption_u32Z");
59156         *ret_copy = Path_final_cltv_expiry_delta(&this_arg_conv);
59157         uint64_t ret_ref = tag_ptr(ret_copy, true);
59158         return ret_ref;
59159 }
59160
59161 void  __attribute__((export_name("TS_Route_free"))) TS_Route_free(uint64_t this_obj) {
59162         LDKRoute this_obj_conv;
59163         this_obj_conv.inner = untag_ptr(this_obj);
59164         this_obj_conv.is_owned = ptr_is_owned(this_obj);
59165         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
59166         Route_free(this_obj_conv);
59167 }
59168
59169 uint64_tArray  __attribute__((export_name("TS_Route_get_paths"))) TS_Route_get_paths(uint64_t this_ptr) {
59170         LDKRoute this_ptr_conv;
59171         this_ptr_conv.inner = untag_ptr(this_ptr);
59172         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
59173         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
59174         this_ptr_conv.is_owned = false;
59175         LDKCVec_PathZ ret_var = Route_get_paths(&this_ptr_conv);
59176         uint64_tArray ret_arr = NULL;
59177         ret_arr = init_uint64_tArray(ret_var.datalen, __LINE__);
59178         uint64_t *ret_arr_ptr = (uint64_t*)(((uint8_t*)ret_arr) + 8);
59179         for (size_t g = 0; g < ret_var.datalen; g++) {
59180                 LDKPath ret_conv_6_var = ret_var.data[g];
59181                 uint64_t ret_conv_6_ref = 0;
59182                 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_conv_6_var);
59183                 ret_conv_6_ref = tag_ptr(ret_conv_6_var.inner, ret_conv_6_var.is_owned);
59184                 ret_arr_ptr[g] = ret_conv_6_ref;
59185         }
59186         
59187         FREE(ret_var.data);
59188         return ret_arr;
59189 }
59190
59191 void  __attribute__((export_name("TS_Route_set_paths"))) TS_Route_set_paths(uint64_t this_ptr, uint64_tArray val) {
59192         LDKRoute this_ptr_conv;
59193         this_ptr_conv.inner = untag_ptr(this_ptr);
59194         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
59195         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
59196         this_ptr_conv.is_owned = false;
59197         LDKCVec_PathZ val_constr;
59198         val_constr.datalen = val->arr_len;
59199         if (val_constr.datalen > 0)
59200                 val_constr.data = MALLOC(val_constr.datalen * sizeof(LDKPath), "LDKCVec_PathZ Elements");
59201         else
59202                 val_constr.data = NULL;
59203         uint64_t* val_vals = val->elems;
59204         for (size_t g = 0; g < val_constr.datalen; g++) {
59205                 uint64_t val_conv_6 = val_vals[g];
59206                 LDKPath val_conv_6_conv;
59207                 val_conv_6_conv.inner = untag_ptr(val_conv_6);
59208                 val_conv_6_conv.is_owned = ptr_is_owned(val_conv_6);
59209                 CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv_6_conv);
59210                 val_conv_6_conv = Path_clone(&val_conv_6_conv);
59211                 val_constr.data[g] = val_conv_6_conv;
59212         }
59213         FREE(val);
59214         Route_set_paths(&this_ptr_conv, val_constr);
59215 }
59216
59217 uint64_t  __attribute__((export_name("TS_Route_get_route_params"))) TS_Route_get_route_params(uint64_t this_ptr) {
59218         LDKRoute this_ptr_conv;
59219         this_ptr_conv.inner = untag_ptr(this_ptr);
59220         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
59221         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
59222         this_ptr_conv.is_owned = false;
59223         LDKRouteParameters ret_var = Route_get_route_params(&this_ptr_conv);
59224         uint64_t ret_ref = 0;
59225         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
59226         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
59227         return ret_ref;
59228 }
59229
59230 void  __attribute__((export_name("TS_Route_set_route_params"))) TS_Route_set_route_params(uint64_t this_ptr, uint64_t val) {
59231         LDKRoute this_ptr_conv;
59232         this_ptr_conv.inner = untag_ptr(this_ptr);
59233         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
59234         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
59235         this_ptr_conv.is_owned = false;
59236         LDKRouteParameters val_conv;
59237         val_conv.inner = untag_ptr(val);
59238         val_conv.is_owned = ptr_is_owned(val);
59239         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
59240         val_conv = RouteParameters_clone(&val_conv);
59241         Route_set_route_params(&this_ptr_conv, val_conv);
59242 }
59243
59244 uint64_t  __attribute__((export_name("TS_Route_new"))) TS_Route_new(uint64_tArray paths_arg, uint64_t route_params_arg) {
59245         LDKCVec_PathZ paths_arg_constr;
59246         paths_arg_constr.datalen = paths_arg->arr_len;
59247         if (paths_arg_constr.datalen > 0)
59248                 paths_arg_constr.data = MALLOC(paths_arg_constr.datalen * sizeof(LDKPath), "LDKCVec_PathZ Elements");
59249         else
59250                 paths_arg_constr.data = NULL;
59251         uint64_t* paths_arg_vals = paths_arg->elems;
59252         for (size_t g = 0; g < paths_arg_constr.datalen; g++) {
59253                 uint64_t paths_arg_conv_6 = paths_arg_vals[g];
59254                 LDKPath paths_arg_conv_6_conv;
59255                 paths_arg_conv_6_conv.inner = untag_ptr(paths_arg_conv_6);
59256                 paths_arg_conv_6_conv.is_owned = ptr_is_owned(paths_arg_conv_6);
59257                 CHECK_INNER_FIELD_ACCESS_OR_NULL(paths_arg_conv_6_conv);
59258                 paths_arg_conv_6_conv = Path_clone(&paths_arg_conv_6_conv);
59259                 paths_arg_constr.data[g] = paths_arg_conv_6_conv;
59260         }
59261         FREE(paths_arg);
59262         LDKRouteParameters route_params_arg_conv;
59263         route_params_arg_conv.inner = untag_ptr(route_params_arg);
59264         route_params_arg_conv.is_owned = ptr_is_owned(route_params_arg);
59265         CHECK_INNER_FIELD_ACCESS_OR_NULL(route_params_arg_conv);
59266         route_params_arg_conv = RouteParameters_clone(&route_params_arg_conv);
59267         LDKRoute ret_var = Route_new(paths_arg_constr, route_params_arg_conv);
59268         uint64_t ret_ref = 0;
59269         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
59270         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
59271         return ret_ref;
59272 }
59273
59274 static inline uint64_t Route_clone_ptr(LDKRoute *NONNULL_PTR arg) {
59275         LDKRoute ret_var = Route_clone(arg);
59276         uint64_t ret_ref = 0;
59277         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
59278         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
59279         return ret_ref;
59280 }
59281 int64_t  __attribute__((export_name("TS_Route_clone_ptr"))) TS_Route_clone_ptr(uint64_t arg) {
59282         LDKRoute arg_conv;
59283         arg_conv.inner = untag_ptr(arg);
59284         arg_conv.is_owned = ptr_is_owned(arg);
59285         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
59286         arg_conv.is_owned = false;
59287         int64_t ret_conv = Route_clone_ptr(&arg_conv);
59288         return ret_conv;
59289 }
59290
59291 uint64_t  __attribute__((export_name("TS_Route_clone"))) TS_Route_clone(uint64_t orig) {
59292         LDKRoute orig_conv;
59293         orig_conv.inner = untag_ptr(orig);
59294         orig_conv.is_owned = ptr_is_owned(orig);
59295         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
59296         orig_conv.is_owned = false;
59297         LDKRoute ret_var = Route_clone(&orig_conv);
59298         uint64_t ret_ref = 0;
59299         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
59300         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
59301         return ret_ref;
59302 }
59303
59304 int64_t  __attribute__((export_name("TS_Route_hash"))) TS_Route_hash(uint64_t o) {
59305         LDKRoute o_conv;
59306         o_conv.inner = untag_ptr(o);
59307         o_conv.is_owned = ptr_is_owned(o);
59308         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
59309         o_conv.is_owned = false;
59310         int64_t ret_conv = Route_hash(&o_conv);
59311         return ret_conv;
59312 }
59313
59314 jboolean  __attribute__((export_name("TS_Route_eq"))) TS_Route_eq(uint64_t a, uint64_t b) {
59315         LDKRoute a_conv;
59316         a_conv.inner = untag_ptr(a);
59317         a_conv.is_owned = ptr_is_owned(a);
59318         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
59319         a_conv.is_owned = false;
59320         LDKRoute b_conv;
59321         b_conv.inner = untag_ptr(b);
59322         b_conv.is_owned = ptr_is_owned(b);
59323         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
59324         b_conv.is_owned = false;
59325         jboolean ret_conv = Route_eq(&a_conv, &b_conv);
59326         return ret_conv;
59327 }
59328
59329 int64_t  __attribute__((export_name("TS_Route_get_total_fees"))) TS_Route_get_total_fees(uint64_t this_arg) {
59330         LDKRoute this_arg_conv;
59331         this_arg_conv.inner = untag_ptr(this_arg);
59332         this_arg_conv.is_owned = ptr_is_owned(this_arg);
59333         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
59334         this_arg_conv.is_owned = false;
59335         int64_t ret_conv = Route_get_total_fees(&this_arg_conv);
59336         return ret_conv;
59337 }
59338
59339 int64_t  __attribute__((export_name("TS_Route_get_total_amount"))) TS_Route_get_total_amount(uint64_t this_arg) {
59340         LDKRoute this_arg_conv;
59341         this_arg_conv.inner = untag_ptr(this_arg);
59342         this_arg_conv.is_owned = ptr_is_owned(this_arg);
59343         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
59344         this_arg_conv.is_owned = false;
59345         int64_t ret_conv = Route_get_total_amount(&this_arg_conv);
59346         return ret_conv;
59347 }
59348
59349 int8_tArray  __attribute__((export_name("TS_Route_write"))) TS_Route_write(uint64_t obj) {
59350         LDKRoute obj_conv;
59351         obj_conv.inner = untag_ptr(obj);
59352         obj_conv.is_owned = ptr_is_owned(obj);
59353         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
59354         obj_conv.is_owned = false;
59355         LDKCVec_u8Z ret_var = Route_write(&obj_conv);
59356         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
59357         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
59358         CVec_u8Z_free(ret_var);
59359         return ret_arr;
59360 }
59361
59362 uint64_t  __attribute__((export_name("TS_Route_read"))) TS_Route_read(int8_tArray ser) {
59363         LDKu8slice ser_ref;
59364         ser_ref.datalen = ser->arr_len;
59365         ser_ref.data = ser->elems;
59366         LDKCResult_RouteDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteDecodeErrorZ), "LDKCResult_RouteDecodeErrorZ");
59367         *ret_conv = Route_read(ser_ref);
59368         FREE(ser);
59369         return tag_ptr(ret_conv, true);
59370 }
59371
59372 void  __attribute__((export_name("TS_RouteParameters_free"))) TS_RouteParameters_free(uint64_t this_obj) {
59373         LDKRouteParameters this_obj_conv;
59374         this_obj_conv.inner = untag_ptr(this_obj);
59375         this_obj_conv.is_owned = ptr_is_owned(this_obj);
59376         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
59377         RouteParameters_free(this_obj_conv);
59378 }
59379
59380 uint64_t  __attribute__((export_name("TS_RouteParameters_get_payment_params"))) TS_RouteParameters_get_payment_params(uint64_t this_ptr) {
59381         LDKRouteParameters this_ptr_conv;
59382         this_ptr_conv.inner = untag_ptr(this_ptr);
59383         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
59384         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
59385         this_ptr_conv.is_owned = false;
59386         LDKPaymentParameters ret_var = RouteParameters_get_payment_params(&this_ptr_conv);
59387         uint64_t ret_ref = 0;
59388         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
59389         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
59390         return ret_ref;
59391 }
59392
59393 void  __attribute__((export_name("TS_RouteParameters_set_payment_params"))) TS_RouteParameters_set_payment_params(uint64_t this_ptr, uint64_t val) {
59394         LDKRouteParameters this_ptr_conv;
59395         this_ptr_conv.inner = untag_ptr(this_ptr);
59396         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
59397         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
59398         this_ptr_conv.is_owned = false;
59399         LDKPaymentParameters val_conv;
59400         val_conv.inner = untag_ptr(val);
59401         val_conv.is_owned = ptr_is_owned(val);
59402         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
59403         val_conv = PaymentParameters_clone(&val_conv);
59404         RouteParameters_set_payment_params(&this_ptr_conv, val_conv);
59405 }
59406
59407 int64_t  __attribute__((export_name("TS_RouteParameters_get_final_value_msat"))) TS_RouteParameters_get_final_value_msat(uint64_t this_ptr) {
59408         LDKRouteParameters this_ptr_conv;
59409         this_ptr_conv.inner = untag_ptr(this_ptr);
59410         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
59411         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
59412         this_ptr_conv.is_owned = false;
59413         int64_t ret_conv = RouteParameters_get_final_value_msat(&this_ptr_conv);
59414         return ret_conv;
59415 }
59416
59417 void  __attribute__((export_name("TS_RouteParameters_set_final_value_msat"))) TS_RouteParameters_set_final_value_msat(uint64_t this_ptr, int64_t val) {
59418         LDKRouteParameters this_ptr_conv;
59419         this_ptr_conv.inner = untag_ptr(this_ptr);
59420         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
59421         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
59422         this_ptr_conv.is_owned = false;
59423         RouteParameters_set_final_value_msat(&this_ptr_conv, val);
59424 }
59425
59426 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) {
59427         LDKRouteParameters this_ptr_conv;
59428         this_ptr_conv.inner = untag_ptr(this_ptr);
59429         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
59430         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
59431         this_ptr_conv.is_owned = false;
59432         LDKCOption_u64Z *ret_copy = MALLOC(sizeof(LDKCOption_u64Z), "LDKCOption_u64Z");
59433         *ret_copy = RouteParameters_get_max_total_routing_fee_msat(&this_ptr_conv);
59434         uint64_t ret_ref = tag_ptr(ret_copy, true);
59435         return ret_ref;
59436 }
59437
59438 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) {
59439         LDKRouteParameters this_ptr_conv;
59440         this_ptr_conv.inner = untag_ptr(this_ptr);
59441         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
59442         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
59443         this_ptr_conv.is_owned = false;
59444         void* val_ptr = untag_ptr(val);
59445         CHECK_ACCESS(val_ptr);
59446         LDKCOption_u64Z val_conv = *(LDKCOption_u64Z*)(val_ptr);
59447         val_conv = COption_u64Z_clone((LDKCOption_u64Z*)untag_ptr(val));
59448         RouteParameters_set_max_total_routing_fee_msat(&this_ptr_conv, val_conv);
59449 }
59450
59451 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) {
59452         LDKPaymentParameters payment_params_arg_conv;
59453         payment_params_arg_conv.inner = untag_ptr(payment_params_arg);
59454         payment_params_arg_conv.is_owned = ptr_is_owned(payment_params_arg);
59455         CHECK_INNER_FIELD_ACCESS_OR_NULL(payment_params_arg_conv);
59456         payment_params_arg_conv = PaymentParameters_clone(&payment_params_arg_conv);
59457         void* max_total_routing_fee_msat_arg_ptr = untag_ptr(max_total_routing_fee_msat_arg);
59458         CHECK_ACCESS(max_total_routing_fee_msat_arg_ptr);
59459         LDKCOption_u64Z max_total_routing_fee_msat_arg_conv = *(LDKCOption_u64Z*)(max_total_routing_fee_msat_arg_ptr);
59460         max_total_routing_fee_msat_arg_conv = COption_u64Z_clone((LDKCOption_u64Z*)untag_ptr(max_total_routing_fee_msat_arg));
59461         LDKRouteParameters ret_var = RouteParameters_new(payment_params_arg_conv, final_value_msat_arg, max_total_routing_fee_msat_arg_conv);
59462         uint64_t ret_ref = 0;
59463         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
59464         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
59465         return ret_ref;
59466 }
59467
59468 static inline uint64_t RouteParameters_clone_ptr(LDKRouteParameters *NONNULL_PTR arg) {
59469         LDKRouteParameters ret_var = RouteParameters_clone(arg);
59470         uint64_t ret_ref = 0;
59471         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
59472         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
59473         return ret_ref;
59474 }
59475 int64_t  __attribute__((export_name("TS_RouteParameters_clone_ptr"))) TS_RouteParameters_clone_ptr(uint64_t arg) {
59476         LDKRouteParameters arg_conv;
59477         arg_conv.inner = untag_ptr(arg);
59478         arg_conv.is_owned = ptr_is_owned(arg);
59479         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
59480         arg_conv.is_owned = false;
59481         int64_t ret_conv = RouteParameters_clone_ptr(&arg_conv);
59482         return ret_conv;
59483 }
59484
59485 uint64_t  __attribute__((export_name("TS_RouteParameters_clone"))) TS_RouteParameters_clone(uint64_t orig) {
59486         LDKRouteParameters orig_conv;
59487         orig_conv.inner = untag_ptr(orig);
59488         orig_conv.is_owned = ptr_is_owned(orig);
59489         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
59490         orig_conv.is_owned = false;
59491         LDKRouteParameters ret_var = RouteParameters_clone(&orig_conv);
59492         uint64_t ret_ref = 0;
59493         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
59494         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
59495         return ret_ref;
59496 }
59497
59498 int64_t  __attribute__((export_name("TS_RouteParameters_hash"))) TS_RouteParameters_hash(uint64_t o) {
59499         LDKRouteParameters o_conv;
59500         o_conv.inner = untag_ptr(o);
59501         o_conv.is_owned = ptr_is_owned(o);
59502         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
59503         o_conv.is_owned = false;
59504         int64_t ret_conv = RouteParameters_hash(&o_conv);
59505         return ret_conv;
59506 }
59507
59508 jboolean  __attribute__((export_name("TS_RouteParameters_eq"))) TS_RouteParameters_eq(uint64_t a, uint64_t b) {
59509         LDKRouteParameters a_conv;
59510         a_conv.inner = untag_ptr(a);
59511         a_conv.is_owned = ptr_is_owned(a);
59512         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
59513         a_conv.is_owned = false;
59514         LDKRouteParameters b_conv;
59515         b_conv.inner = untag_ptr(b);
59516         b_conv.is_owned = ptr_is_owned(b);
59517         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
59518         b_conv.is_owned = false;
59519         jboolean ret_conv = RouteParameters_eq(&a_conv, &b_conv);
59520         return ret_conv;
59521 }
59522
59523 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) {
59524         LDKPaymentParameters payment_params_conv;
59525         payment_params_conv.inner = untag_ptr(payment_params);
59526         payment_params_conv.is_owned = ptr_is_owned(payment_params);
59527         CHECK_INNER_FIELD_ACCESS_OR_NULL(payment_params_conv);
59528         payment_params_conv = PaymentParameters_clone(&payment_params_conv);
59529         LDKRouteParameters ret_var = RouteParameters_from_payment_params_and_value(payment_params_conv, final_value_msat);
59530         uint64_t ret_ref = 0;
59531         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
59532         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
59533         return ret_ref;
59534 }
59535
59536 int8_tArray  __attribute__((export_name("TS_RouteParameters_write"))) TS_RouteParameters_write(uint64_t obj) {
59537         LDKRouteParameters obj_conv;
59538         obj_conv.inner = untag_ptr(obj);
59539         obj_conv.is_owned = ptr_is_owned(obj);
59540         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
59541         obj_conv.is_owned = false;
59542         LDKCVec_u8Z ret_var = RouteParameters_write(&obj_conv);
59543         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
59544         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
59545         CVec_u8Z_free(ret_var);
59546         return ret_arr;
59547 }
59548
59549 uint64_t  __attribute__((export_name("TS_RouteParameters_read"))) TS_RouteParameters_read(int8_tArray ser) {
59550         LDKu8slice ser_ref;
59551         ser_ref.datalen = ser->arr_len;
59552         ser_ref.data = ser->elems;
59553         LDKCResult_RouteParametersDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteParametersDecodeErrorZ), "LDKCResult_RouteParametersDecodeErrorZ");
59554         *ret_conv = RouteParameters_read(ser_ref);
59555         FREE(ser);
59556         return tag_ptr(ret_conv, true);
59557 }
59558
59559 void  __attribute__((export_name("TS_PaymentParameters_free"))) TS_PaymentParameters_free(uint64_t this_obj) {
59560         LDKPaymentParameters this_obj_conv;
59561         this_obj_conv.inner = untag_ptr(this_obj);
59562         this_obj_conv.is_owned = ptr_is_owned(this_obj);
59563         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
59564         PaymentParameters_free(this_obj_conv);
59565 }
59566
59567 uint64_t  __attribute__((export_name("TS_PaymentParameters_get_payee"))) TS_PaymentParameters_get_payee(uint64_t this_ptr) {
59568         LDKPaymentParameters this_ptr_conv;
59569         this_ptr_conv.inner = untag_ptr(this_ptr);
59570         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
59571         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
59572         this_ptr_conv.is_owned = false;
59573         LDKPayee *ret_copy = MALLOC(sizeof(LDKPayee), "LDKPayee");
59574         *ret_copy = PaymentParameters_get_payee(&this_ptr_conv);
59575         uint64_t ret_ref = tag_ptr(ret_copy, true);
59576         return ret_ref;
59577 }
59578
59579 void  __attribute__((export_name("TS_PaymentParameters_set_payee"))) TS_PaymentParameters_set_payee(uint64_t this_ptr, uint64_t val) {
59580         LDKPaymentParameters this_ptr_conv;
59581         this_ptr_conv.inner = untag_ptr(this_ptr);
59582         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
59583         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
59584         this_ptr_conv.is_owned = false;
59585         void* val_ptr = untag_ptr(val);
59586         CHECK_ACCESS(val_ptr);
59587         LDKPayee val_conv = *(LDKPayee*)(val_ptr);
59588         val_conv = Payee_clone((LDKPayee*)untag_ptr(val));
59589         PaymentParameters_set_payee(&this_ptr_conv, val_conv);
59590 }
59591
59592 uint64_t  __attribute__((export_name("TS_PaymentParameters_get_expiry_time"))) TS_PaymentParameters_get_expiry_time(uint64_t this_ptr) {
59593         LDKPaymentParameters this_ptr_conv;
59594         this_ptr_conv.inner = untag_ptr(this_ptr);
59595         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
59596         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
59597         this_ptr_conv.is_owned = false;
59598         LDKCOption_u64Z *ret_copy = MALLOC(sizeof(LDKCOption_u64Z), "LDKCOption_u64Z");
59599         *ret_copy = PaymentParameters_get_expiry_time(&this_ptr_conv);
59600         uint64_t ret_ref = tag_ptr(ret_copy, true);
59601         return ret_ref;
59602 }
59603
59604 void  __attribute__((export_name("TS_PaymentParameters_set_expiry_time"))) TS_PaymentParameters_set_expiry_time(uint64_t this_ptr, uint64_t val) {
59605         LDKPaymentParameters this_ptr_conv;
59606         this_ptr_conv.inner = untag_ptr(this_ptr);
59607         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
59608         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
59609         this_ptr_conv.is_owned = false;
59610         void* val_ptr = untag_ptr(val);
59611         CHECK_ACCESS(val_ptr);
59612         LDKCOption_u64Z val_conv = *(LDKCOption_u64Z*)(val_ptr);
59613         val_conv = COption_u64Z_clone((LDKCOption_u64Z*)untag_ptr(val));
59614         PaymentParameters_set_expiry_time(&this_ptr_conv, val_conv);
59615 }
59616
59617 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) {
59618         LDKPaymentParameters this_ptr_conv;
59619         this_ptr_conv.inner = untag_ptr(this_ptr);
59620         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
59621         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
59622         this_ptr_conv.is_owned = false;
59623         int32_t ret_conv = PaymentParameters_get_max_total_cltv_expiry_delta(&this_ptr_conv);
59624         return ret_conv;
59625 }
59626
59627 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) {
59628         LDKPaymentParameters this_ptr_conv;
59629         this_ptr_conv.inner = untag_ptr(this_ptr);
59630         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
59631         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
59632         this_ptr_conv.is_owned = false;
59633         PaymentParameters_set_max_total_cltv_expiry_delta(&this_ptr_conv, val);
59634 }
59635
59636 int8_t  __attribute__((export_name("TS_PaymentParameters_get_max_path_count"))) TS_PaymentParameters_get_max_path_count(uint64_t this_ptr) {
59637         LDKPaymentParameters this_ptr_conv;
59638         this_ptr_conv.inner = untag_ptr(this_ptr);
59639         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
59640         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
59641         this_ptr_conv.is_owned = false;
59642         int8_t ret_conv = PaymentParameters_get_max_path_count(&this_ptr_conv);
59643         return ret_conv;
59644 }
59645
59646 void  __attribute__((export_name("TS_PaymentParameters_set_max_path_count"))) TS_PaymentParameters_set_max_path_count(uint64_t this_ptr, int8_t val) {
59647         LDKPaymentParameters this_ptr_conv;
59648         this_ptr_conv.inner = untag_ptr(this_ptr);
59649         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
59650         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
59651         this_ptr_conv.is_owned = false;
59652         PaymentParameters_set_max_path_count(&this_ptr_conv, val);
59653 }
59654
59655 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) {
59656         LDKPaymentParameters this_ptr_conv;
59657         this_ptr_conv.inner = untag_ptr(this_ptr);
59658         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
59659         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
59660         this_ptr_conv.is_owned = false;
59661         int8_t ret_conv = PaymentParameters_get_max_channel_saturation_power_of_half(&this_ptr_conv);
59662         return ret_conv;
59663 }
59664
59665 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) {
59666         LDKPaymentParameters this_ptr_conv;
59667         this_ptr_conv.inner = untag_ptr(this_ptr);
59668         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
59669         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
59670         this_ptr_conv.is_owned = false;
59671         PaymentParameters_set_max_channel_saturation_power_of_half(&this_ptr_conv, val);
59672 }
59673
59674 int64_tArray  __attribute__((export_name("TS_PaymentParameters_get_previously_failed_channels"))) TS_PaymentParameters_get_previously_failed_channels(uint64_t this_ptr) {
59675         LDKPaymentParameters this_ptr_conv;
59676         this_ptr_conv.inner = untag_ptr(this_ptr);
59677         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
59678         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
59679         this_ptr_conv.is_owned = false;
59680         LDKCVec_u64Z ret_var = PaymentParameters_get_previously_failed_channels(&this_ptr_conv);
59681         int64_tArray ret_arr = NULL;
59682         ret_arr = init_int64_tArray(ret_var.datalen, __LINE__);
59683         int64_t *ret_arr_ptr = (int64_t*)(((uint8_t*)ret_arr) + 8);
59684         for (size_t i = 0; i < ret_var.datalen; i++) {
59685                 int64_t ret_conv_8_conv = ret_var.data[i];
59686                 ret_arr_ptr[i] = ret_conv_8_conv;
59687         }
59688         
59689         FREE(ret_var.data);
59690         return ret_arr;
59691 }
59692
59693 void  __attribute__((export_name("TS_PaymentParameters_set_previously_failed_channels"))) TS_PaymentParameters_set_previously_failed_channels(uint64_t this_ptr, int64_tArray val) {
59694         LDKPaymentParameters this_ptr_conv;
59695         this_ptr_conv.inner = untag_ptr(this_ptr);
59696         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
59697         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
59698         this_ptr_conv.is_owned = false;
59699         LDKCVec_u64Z val_constr;
59700         val_constr.datalen = val->arr_len;
59701         if (val_constr.datalen > 0)
59702                 val_constr.data = MALLOC(val_constr.datalen * sizeof(int64_t), "LDKCVec_u64Z Elements");
59703         else
59704                 val_constr.data = NULL;
59705         int64_t* val_vals = val->elems;
59706         for (size_t i = 0; i < val_constr.datalen; i++) {
59707                 int64_t val_conv_8 = val_vals[i];
59708                 val_constr.data[i] = val_conv_8;
59709         }
59710         FREE(val);
59711         PaymentParameters_set_previously_failed_channels(&this_ptr_conv, val_constr);
59712 }
59713
59714 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) {
59715         void* payee_arg_ptr = untag_ptr(payee_arg);
59716         CHECK_ACCESS(payee_arg_ptr);
59717         LDKPayee payee_arg_conv = *(LDKPayee*)(payee_arg_ptr);
59718         payee_arg_conv = Payee_clone((LDKPayee*)untag_ptr(payee_arg));
59719         void* expiry_time_arg_ptr = untag_ptr(expiry_time_arg);
59720         CHECK_ACCESS(expiry_time_arg_ptr);
59721         LDKCOption_u64Z expiry_time_arg_conv = *(LDKCOption_u64Z*)(expiry_time_arg_ptr);
59722         expiry_time_arg_conv = COption_u64Z_clone((LDKCOption_u64Z*)untag_ptr(expiry_time_arg));
59723         LDKCVec_u64Z previously_failed_channels_arg_constr;
59724         previously_failed_channels_arg_constr.datalen = previously_failed_channels_arg->arr_len;
59725         if (previously_failed_channels_arg_constr.datalen > 0)
59726                 previously_failed_channels_arg_constr.data = MALLOC(previously_failed_channels_arg_constr.datalen * sizeof(int64_t), "LDKCVec_u64Z Elements");
59727         else
59728                 previously_failed_channels_arg_constr.data = NULL;
59729         int64_t* previously_failed_channels_arg_vals = previously_failed_channels_arg->elems;
59730         for (size_t i = 0; i < previously_failed_channels_arg_constr.datalen; i++) {
59731                 int64_t previously_failed_channels_arg_conv_8 = previously_failed_channels_arg_vals[i];
59732                 previously_failed_channels_arg_constr.data[i] = previously_failed_channels_arg_conv_8;
59733         }
59734         FREE(previously_failed_channels_arg);
59735         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);
59736         uint64_t ret_ref = 0;
59737         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
59738         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
59739         return ret_ref;
59740 }
59741
59742 static inline uint64_t PaymentParameters_clone_ptr(LDKPaymentParameters *NONNULL_PTR arg) {
59743         LDKPaymentParameters ret_var = PaymentParameters_clone(arg);
59744         uint64_t ret_ref = 0;
59745         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
59746         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
59747         return ret_ref;
59748 }
59749 int64_t  __attribute__((export_name("TS_PaymentParameters_clone_ptr"))) TS_PaymentParameters_clone_ptr(uint64_t arg) {
59750         LDKPaymentParameters arg_conv;
59751         arg_conv.inner = untag_ptr(arg);
59752         arg_conv.is_owned = ptr_is_owned(arg);
59753         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
59754         arg_conv.is_owned = false;
59755         int64_t ret_conv = PaymentParameters_clone_ptr(&arg_conv);
59756         return ret_conv;
59757 }
59758
59759 uint64_t  __attribute__((export_name("TS_PaymentParameters_clone"))) TS_PaymentParameters_clone(uint64_t orig) {
59760         LDKPaymentParameters orig_conv;
59761         orig_conv.inner = untag_ptr(orig);
59762         orig_conv.is_owned = ptr_is_owned(orig);
59763         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
59764         orig_conv.is_owned = false;
59765         LDKPaymentParameters ret_var = PaymentParameters_clone(&orig_conv);
59766         uint64_t ret_ref = 0;
59767         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
59768         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
59769         return ret_ref;
59770 }
59771
59772 int64_t  __attribute__((export_name("TS_PaymentParameters_hash"))) TS_PaymentParameters_hash(uint64_t o) {
59773         LDKPaymentParameters o_conv;
59774         o_conv.inner = untag_ptr(o);
59775         o_conv.is_owned = ptr_is_owned(o);
59776         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
59777         o_conv.is_owned = false;
59778         int64_t ret_conv = PaymentParameters_hash(&o_conv);
59779         return ret_conv;
59780 }
59781
59782 jboolean  __attribute__((export_name("TS_PaymentParameters_eq"))) TS_PaymentParameters_eq(uint64_t a, uint64_t b) {
59783         LDKPaymentParameters a_conv;
59784         a_conv.inner = untag_ptr(a);
59785         a_conv.is_owned = ptr_is_owned(a);
59786         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
59787         a_conv.is_owned = false;
59788         LDKPaymentParameters b_conv;
59789         b_conv.inner = untag_ptr(b);
59790         b_conv.is_owned = ptr_is_owned(b);
59791         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
59792         b_conv.is_owned = false;
59793         jboolean ret_conv = PaymentParameters_eq(&a_conv, &b_conv);
59794         return ret_conv;
59795 }
59796
59797 int8_tArray  __attribute__((export_name("TS_PaymentParameters_write"))) TS_PaymentParameters_write(uint64_t obj) {
59798         LDKPaymentParameters obj_conv;
59799         obj_conv.inner = untag_ptr(obj);
59800         obj_conv.is_owned = ptr_is_owned(obj);
59801         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
59802         obj_conv.is_owned = false;
59803         LDKCVec_u8Z ret_var = PaymentParameters_write(&obj_conv);
59804         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
59805         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
59806         CVec_u8Z_free(ret_var);
59807         return ret_arr;
59808 }
59809
59810 uint64_t  __attribute__((export_name("TS_PaymentParameters_read"))) TS_PaymentParameters_read(int8_tArray ser, int32_t arg) {
59811         LDKu8slice ser_ref;
59812         ser_ref.datalen = ser->arr_len;
59813         ser_ref.data = ser->elems;
59814         LDKCResult_PaymentParametersDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PaymentParametersDecodeErrorZ), "LDKCResult_PaymentParametersDecodeErrorZ");
59815         *ret_conv = PaymentParameters_read(ser_ref, arg);
59816         FREE(ser);
59817         return tag_ptr(ret_conv, true);
59818 }
59819
59820 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) {
59821         LDKPublicKey payee_pubkey_ref;
59822         CHECK(payee_pubkey->arr_len == 33);
59823         memcpy(payee_pubkey_ref.compressed_form, payee_pubkey->elems, 33); FREE(payee_pubkey);
59824         LDKPaymentParameters ret_var = PaymentParameters_from_node_id(payee_pubkey_ref, final_cltv_expiry_delta);
59825         uint64_t ret_ref = 0;
59826         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
59827         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
59828         return ret_ref;
59829 }
59830
59831 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) {
59832         LDKPublicKey payee_pubkey_ref;
59833         CHECK(payee_pubkey->arr_len == 33);
59834         memcpy(payee_pubkey_ref.compressed_form, payee_pubkey->elems, 33); FREE(payee_pubkey);
59835         LDKPaymentParameters ret_var = PaymentParameters_for_keysend(payee_pubkey_ref, final_cltv_expiry_delta, allow_mpp);
59836         uint64_t ret_ref = 0;
59837         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
59838         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
59839         return ret_ref;
59840 }
59841
59842 uint64_t  __attribute__((export_name("TS_PaymentParameters_from_bolt12_invoice"))) TS_PaymentParameters_from_bolt12_invoice(uint64_t invoice) {
59843         LDKBolt12Invoice invoice_conv;
59844         invoice_conv.inner = untag_ptr(invoice);
59845         invoice_conv.is_owned = ptr_is_owned(invoice);
59846         CHECK_INNER_FIELD_ACCESS_OR_NULL(invoice_conv);
59847         invoice_conv.is_owned = false;
59848         LDKPaymentParameters ret_var = PaymentParameters_from_bolt12_invoice(&invoice_conv);
59849         uint64_t ret_ref = 0;
59850         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
59851         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
59852         return ret_ref;
59853 }
59854
59855 uint64_t  __attribute__((export_name("TS_PaymentParameters_blinded"))) TS_PaymentParameters_blinded(uint64_tArray blinded_route_hints) {
59856         LDKCVec_C2Tuple_BlindedPayInfoBlindedPathZZ blinded_route_hints_constr;
59857         blinded_route_hints_constr.datalen = blinded_route_hints->arr_len;
59858         if (blinded_route_hints_constr.datalen > 0)
59859                 blinded_route_hints_constr.data = MALLOC(blinded_route_hints_constr.datalen * sizeof(LDKC2Tuple_BlindedPayInfoBlindedPathZ), "LDKCVec_C2Tuple_BlindedPayInfoBlindedPathZZ Elements");
59860         else
59861                 blinded_route_hints_constr.data = NULL;
59862         uint64_t* blinded_route_hints_vals = blinded_route_hints->elems;
59863         for (size_t l = 0; l < blinded_route_hints_constr.datalen; l++) {
59864                 uint64_t blinded_route_hints_conv_37 = blinded_route_hints_vals[l];
59865                 void* blinded_route_hints_conv_37_ptr = untag_ptr(blinded_route_hints_conv_37);
59866                 CHECK_ACCESS(blinded_route_hints_conv_37_ptr);
59867                 LDKC2Tuple_BlindedPayInfoBlindedPathZ blinded_route_hints_conv_37_conv = *(LDKC2Tuple_BlindedPayInfoBlindedPathZ*)(blinded_route_hints_conv_37_ptr);
59868                 blinded_route_hints_conv_37_conv = C2Tuple_BlindedPayInfoBlindedPathZ_clone((LDKC2Tuple_BlindedPayInfoBlindedPathZ*)untag_ptr(blinded_route_hints_conv_37));
59869                 blinded_route_hints_constr.data[l] = blinded_route_hints_conv_37_conv;
59870         }
59871         FREE(blinded_route_hints);
59872         LDKPaymentParameters ret_var = PaymentParameters_blinded(blinded_route_hints_constr);
59873         uint64_t ret_ref = 0;
59874         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
59875         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
59876         return ret_ref;
59877 }
59878
59879 void  __attribute__((export_name("TS_Payee_free"))) TS_Payee_free(uint64_t this_ptr) {
59880         if (!ptr_is_owned(this_ptr)) return;
59881         void* this_ptr_ptr = untag_ptr(this_ptr);
59882         CHECK_ACCESS(this_ptr_ptr);
59883         LDKPayee this_ptr_conv = *(LDKPayee*)(this_ptr_ptr);
59884         FREE(untag_ptr(this_ptr));
59885         Payee_free(this_ptr_conv);
59886 }
59887
59888 static inline uint64_t Payee_clone_ptr(LDKPayee *NONNULL_PTR arg) {
59889         LDKPayee *ret_copy = MALLOC(sizeof(LDKPayee), "LDKPayee");
59890         *ret_copy = Payee_clone(arg);
59891         uint64_t ret_ref = tag_ptr(ret_copy, true);
59892         return ret_ref;
59893 }
59894 int64_t  __attribute__((export_name("TS_Payee_clone_ptr"))) TS_Payee_clone_ptr(uint64_t arg) {
59895         LDKPayee* arg_conv = (LDKPayee*)untag_ptr(arg);
59896         int64_t ret_conv = Payee_clone_ptr(arg_conv);
59897         return ret_conv;
59898 }
59899
59900 uint64_t  __attribute__((export_name("TS_Payee_clone"))) TS_Payee_clone(uint64_t orig) {
59901         LDKPayee* orig_conv = (LDKPayee*)untag_ptr(orig);
59902         LDKPayee *ret_copy = MALLOC(sizeof(LDKPayee), "LDKPayee");
59903         *ret_copy = Payee_clone(orig_conv);
59904         uint64_t ret_ref = tag_ptr(ret_copy, true);
59905         return ret_ref;
59906 }
59907
59908 uint64_t  __attribute__((export_name("TS_Payee_blinded"))) TS_Payee_blinded(uint64_tArray route_hints, uint64_t features) {
59909         LDKCVec_C2Tuple_BlindedPayInfoBlindedPathZZ route_hints_constr;
59910         route_hints_constr.datalen = route_hints->arr_len;
59911         if (route_hints_constr.datalen > 0)
59912                 route_hints_constr.data = MALLOC(route_hints_constr.datalen * sizeof(LDKC2Tuple_BlindedPayInfoBlindedPathZ), "LDKCVec_C2Tuple_BlindedPayInfoBlindedPathZZ Elements");
59913         else
59914                 route_hints_constr.data = NULL;
59915         uint64_t* route_hints_vals = route_hints->elems;
59916         for (size_t l = 0; l < route_hints_constr.datalen; l++) {
59917                 uint64_t route_hints_conv_37 = route_hints_vals[l];
59918                 void* route_hints_conv_37_ptr = untag_ptr(route_hints_conv_37);
59919                 CHECK_ACCESS(route_hints_conv_37_ptr);
59920                 LDKC2Tuple_BlindedPayInfoBlindedPathZ route_hints_conv_37_conv = *(LDKC2Tuple_BlindedPayInfoBlindedPathZ*)(route_hints_conv_37_ptr);
59921                 route_hints_conv_37_conv = C2Tuple_BlindedPayInfoBlindedPathZ_clone((LDKC2Tuple_BlindedPayInfoBlindedPathZ*)untag_ptr(route_hints_conv_37));
59922                 route_hints_constr.data[l] = route_hints_conv_37_conv;
59923         }
59924         FREE(route_hints);
59925         LDKBolt12InvoiceFeatures features_conv;
59926         features_conv.inner = untag_ptr(features);
59927         features_conv.is_owned = ptr_is_owned(features);
59928         CHECK_INNER_FIELD_ACCESS_OR_NULL(features_conv);
59929         features_conv = Bolt12InvoiceFeatures_clone(&features_conv);
59930         LDKPayee *ret_copy = MALLOC(sizeof(LDKPayee), "LDKPayee");
59931         *ret_copy = Payee_blinded(route_hints_constr, features_conv);
59932         uint64_t ret_ref = tag_ptr(ret_copy, true);
59933         return ret_ref;
59934 }
59935
59936 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) {
59937         LDKPublicKey node_id_ref;
59938         CHECK(node_id->arr_len == 33);
59939         memcpy(node_id_ref.compressed_form, node_id->elems, 33); FREE(node_id);
59940         LDKCVec_RouteHintZ route_hints_constr;
59941         route_hints_constr.datalen = route_hints->arr_len;
59942         if (route_hints_constr.datalen > 0)
59943                 route_hints_constr.data = MALLOC(route_hints_constr.datalen * sizeof(LDKRouteHint), "LDKCVec_RouteHintZ Elements");
59944         else
59945                 route_hints_constr.data = NULL;
59946         uint64_t* route_hints_vals = route_hints->elems;
59947         for (size_t l = 0; l < route_hints_constr.datalen; l++) {
59948                 uint64_t route_hints_conv_11 = route_hints_vals[l];
59949                 LDKRouteHint route_hints_conv_11_conv;
59950                 route_hints_conv_11_conv.inner = untag_ptr(route_hints_conv_11);
59951                 route_hints_conv_11_conv.is_owned = ptr_is_owned(route_hints_conv_11);
59952                 CHECK_INNER_FIELD_ACCESS_OR_NULL(route_hints_conv_11_conv);
59953                 route_hints_conv_11_conv = RouteHint_clone(&route_hints_conv_11_conv);
59954                 route_hints_constr.data[l] = route_hints_conv_11_conv;
59955         }
59956         FREE(route_hints);
59957         LDKBolt11InvoiceFeatures features_conv;
59958         features_conv.inner = untag_ptr(features);
59959         features_conv.is_owned = ptr_is_owned(features);
59960         CHECK_INNER_FIELD_ACCESS_OR_NULL(features_conv);
59961         features_conv = Bolt11InvoiceFeatures_clone(&features_conv);
59962         LDKPayee *ret_copy = MALLOC(sizeof(LDKPayee), "LDKPayee");
59963         *ret_copy = Payee_clear(node_id_ref, route_hints_constr, features_conv, final_cltv_expiry_delta);
59964         uint64_t ret_ref = tag_ptr(ret_copy, true);
59965         return ret_ref;
59966 }
59967
59968 int64_t  __attribute__((export_name("TS_Payee_hash"))) TS_Payee_hash(uint64_t o) {
59969         LDKPayee* o_conv = (LDKPayee*)untag_ptr(o);
59970         int64_t ret_conv = Payee_hash(o_conv);
59971         return ret_conv;
59972 }
59973
59974 jboolean  __attribute__((export_name("TS_Payee_eq"))) TS_Payee_eq(uint64_t a, uint64_t b) {
59975         LDKPayee* a_conv = (LDKPayee*)untag_ptr(a);
59976         LDKPayee* b_conv = (LDKPayee*)untag_ptr(b);
59977         jboolean ret_conv = Payee_eq(a_conv, b_conv);
59978         return ret_conv;
59979 }
59980
59981 void  __attribute__((export_name("TS_RouteHint_free"))) TS_RouteHint_free(uint64_t this_obj) {
59982         LDKRouteHint this_obj_conv;
59983         this_obj_conv.inner = untag_ptr(this_obj);
59984         this_obj_conv.is_owned = ptr_is_owned(this_obj);
59985         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
59986         RouteHint_free(this_obj_conv);
59987 }
59988
59989 uint64_tArray  __attribute__((export_name("TS_RouteHint_get_a"))) TS_RouteHint_get_a(uint64_t this_ptr) {
59990         LDKRouteHint this_ptr_conv;
59991         this_ptr_conv.inner = untag_ptr(this_ptr);
59992         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
59993         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
59994         this_ptr_conv.is_owned = false;
59995         LDKCVec_RouteHintHopZ ret_var = RouteHint_get_a(&this_ptr_conv);
59996         uint64_tArray ret_arr = NULL;
59997         ret_arr = init_uint64_tArray(ret_var.datalen, __LINE__);
59998         uint64_t *ret_arr_ptr = (uint64_t*)(((uint8_t*)ret_arr) + 8);
59999         for (size_t o = 0; o < ret_var.datalen; o++) {
60000                 LDKRouteHintHop ret_conv_14_var = ret_var.data[o];
60001                 uint64_t ret_conv_14_ref = 0;
60002                 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_conv_14_var);
60003                 ret_conv_14_ref = tag_ptr(ret_conv_14_var.inner, ret_conv_14_var.is_owned);
60004                 ret_arr_ptr[o] = ret_conv_14_ref;
60005         }
60006         
60007         FREE(ret_var.data);
60008         return ret_arr;
60009 }
60010
60011 void  __attribute__((export_name("TS_RouteHint_set_a"))) TS_RouteHint_set_a(uint64_t this_ptr, uint64_tArray val) {
60012         LDKRouteHint this_ptr_conv;
60013         this_ptr_conv.inner = untag_ptr(this_ptr);
60014         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
60015         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
60016         this_ptr_conv.is_owned = false;
60017         LDKCVec_RouteHintHopZ val_constr;
60018         val_constr.datalen = val->arr_len;
60019         if (val_constr.datalen > 0)
60020                 val_constr.data = MALLOC(val_constr.datalen * sizeof(LDKRouteHintHop), "LDKCVec_RouteHintHopZ Elements");
60021         else
60022                 val_constr.data = NULL;
60023         uint64_t* val_vals = val->elems;
60024         for (size_t o = 0; o < val_constr.datalen; o++) {
60025                 uint64_t val_conv_14 = val_vals[o];
60026                 LDKRouteHintHop val_conv_14_conv;
60027                 val_conv_14_conv.inner = untag_ptr(val_conv_14);
60028                 val_conv_14_conv.is_owned = ptr_is_owned(val_conv_14);
60029                 CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv_14_conv);
60030                 val_conv_14_conv = RouteHintHop_clone(&val_conv_14_conv);
60031                 val_constr.data[o] = val_conv_14_conv;
60032         }
60033         FREE(val);
60034         RouteHint_set_a(&this_ptr_conv, val_constr);
60035 }
60036
60037 uint64_t  __attribute__((export_name("TS_RouteHint_new"))) TS_RouteHint_new(uint64_tArray a_arg) {
60038         LDKCVec_RouteHintHopZ a_arg_constr;
60039         a_arg_constr.datalen = a_arg->arr_len;
60040         if (a_arg_constr.datalen > 0)
60041                 a_arg_constr.data = MALLOC(a_arg_constr.datalen * sizeof(LDKRouteHintHop), "LDKCVec_RouteHintHopZ Elements");
60042         else
60043                 a_arg_constr.data = NULL;
60044         uint64_t* a_arg_vals = a_arg->elems;
60045         for (size_t o = 0; o < a_arg_constr.datalen; o++) {
60046                 uint64_t a_arg_conv_14 = a_arg_vals[o];
60047                 LDKRouteHintHop a_arg_conv_14_conv;
60048                 a_arg_conv_14_conv.inner = untag_ptr(a_arg_conv_14);
60049                 a_arg_conv_14_conv.is_owned = ptr_is_owned(a_arg_conv_14);
60050                 CHECK_INNER_FIELD_ACCESS_OR_NULL(a_arg_conv_14_conv);
60051                 a_arg_conv_14_conv = RouteHintHop_clone(&a_arg_conv_14_conv);
60052                 a_arg_constr.data[o] = a_arg_conv_14_conv;
60053         }
60054         FREE(a_arg);
60055         LDKRouteHint ret_var = RouteHint_new(a_arg_constr);
60056         uint64_t ret_ref = 0;
60057         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
60058         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
60059         return ret_ref;
60060 }
60061
60062 static inline uint64_t RouteHint_clone_ptr(LDKRouteHint *NONNULL_PTR arg) {
60063         LDKRouteHint ret_var = RouteHint_clone(arg);
60064         uint64_t ret_ref = 0;
60065         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
60066         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
60067         return ret_ref;
60068 }
60069 int64_t  __attribute__((export_name("TS_RouteHint_clone_ptr"))) TS_RouteHint_clone_ptr(uint64_t arg) {
60070         LDKRouteHint arg_conv;
60071         arg_conv.inner = untag_ptr(arg);
60072         arg_conv.is_owned = ptr_is_owned(arg);
60073         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
60074         arg_conv.is_owned = false;
60075         int64_t ret_conv = RouteHint_clone_ptr(&arg_conv);
60076         return ret_conv;
60077 }
60078
60079 uint64_t  __attribute__((export_name("TS_RouteHint_clone"))) TS_RouteHint_clone(uint64_t orig) {
60080         LDKRouteHint orig_conv;
60081         orig_conv.inner = untag_ptr(orig);
60082         orig_conv.is_owned = ptr_is_owned(orig);
60083         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
60084         orig_conv.is_owned = false;
60085         LDKRouteHint ret_var = RouteHint_clone(&orig_conv);
60086         uint64_t ret_ref = 0;
60087         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
60088         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
60089         return ret_ref;
60090 }
60091
60092 int64_t  __attribute__((export_name("TS_RouteHint_hash"))) TS_RouteHint_hash(uint64_t o) {
60093         LDKRouteHint o_conv;
60094         o_conv.inner = untag_ptr(o);
60095         o_conv.is_owned = ptr_is_owned(o);
60096         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
60097         o_conv.is_owned = false;
60098         int64_t ret_conv = RouteHint_hash(&o_conv);
60099         return ret_conv;
60100 }
60101
60102 jboolean  __attribute__((export_name("TS_RouteHint_eq"))) TS_RouteHint_eq(uint64_t a, uint64_t b) {
60103         LDKRouteHint a_conv;
60104         a_conv.inner = untag_ptr(a);
60105         a_conv.is_owned = ptr_is_owned(a);
60106         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
60107         a_conv.is_owned = false;
60108         LDKRouteHint b_conv;
60109         b_conv.inner = untag_ptr(b);
60110         b_conv.is_owned = ptr_is_owned(b);
60111         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
60112         b_conv.is_owned = false;
60113         jboolean ret_conv = RouteHint_eq(&a_conv, &b_conv);
60114         return ret_conv;
60115 }
60116
60117 int8_tArray  __attribute__((export_name("TS_RouteHint_write"))) TS_RouteHint_write(uint64_t obj) {
60118         LDKRouteHint obj_conv;
60119         obj_conv.inner = untag_ptr(obj);
60120         obj_conv.is_owned = ptr_is_owned(obj);
60121         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
60122         obj_conv.is_owned = false;
60123         LDKCVec_u8Z ret_var = RouteHint_write(&obj_conv);
60124         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
60125         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
60126         CVec_u8Z_free(ret_var);
60127         return ret_arr;
60128 }
60129
60130 uint64_t  __attribute__((export_name("TS_RouteHint_read"))) TS_RouteHint_read(int8_tArray ser) {
60131         LDKu8slice ser_ref;
60132         ser_ref.datalen = ser->arr_len;
60133         ser_ref.data = ser->elems;
60134         LDKCResult_RouteHintDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteHintDecodeErrorZ), "LDKCResult_RouteHintDecodeErrorZ");
60135         *ret_conv = RouteHint_read(ser_ref);
60136         FREE(ser);
60137         return tag_ptr(ret_conv, true);
60138 }
60139
60140 void  __attribute__((export_name("TS_RouteHintHop_free"))) TS_RouteHintHop_free(uint64_t this_obj) {
60141         LDKRouteHintHop this_obj_conv;
60142         this_obj_conv.inner = untag_ptr(this_obj);
60143         this_obj_conv.is_owned = ptr_is_owned(this_obj);
60144         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
60145         RouteHintHop_free(this_obj_conv);
60146 }
60147
60148 int8_tArray  __attribute__((export_name("TS_RouteHintHop_get_src_node_id"))) TS_RouteHintHop_get_src_node_id(uint64_t this_ptr) {
60149         LDKRouteHintHop this_ptr_conv;
60150         this_ptr_conv.inner = untag_ptr(this_ptr);
60151         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
60152         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
60153         this_ptr_conv.is_owned = false;
60154         int8_tArray ret_arr = init_int8_tArray(33, __LINE__);
60155         memcpy(ret_arr->elems, RouteHintHop_get_src_node_id(&this_ptr_conv).compressed_form, 33);
60156         return ret_arr;
60157 }
60158
60159 void  __attribute__((export_name("TS_RouteHintHop_set_src_node_id"))) TS_RouteHintHop_set_src_node_id(uint64_t this_ptr, int8_tArray val) {
60160         LDKRouteHintHop this_ptr_conv;
60161         this_ptr_conv.inner = untag_ptr(this_ptr);
60162         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
60163         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
60164         this_ptr_conv.is_owned = false;
60165         LDKPublicKey val_ref;
60166         CHECK(val->arr_len == 33);
60167         memcpy(val_ref.compressed_form, val->elems, 33); FREE(val);
60168         RouteHintHop_set_src_node_id(&this_ptr_conv, val_ref);
60169 }
60170
60171 int64_t  __attribute__((export_name("TS_RouteHintHop_get_short_channel_id"))) TS_RouteHintHop_get_short_channel_id(uint64_t this_ptr) {
60172         LDKRouteHintHop this_ptr_conv;
60173         this_ptr_conv.inner = untag_ptr(this_ptr);
60174         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
60175         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
60176         this_ptr_conv.is_owned = false;
60177         int64_t ret_conv = RouteHintHop_get_short_channel_id(&this_ptr_conv);
60178         return ret_conv;
60179 }
60180
60181 void  __attribute__((export_name("TS_RouteHintHop_set_short_channel_id"))) TS_RouteHintHop_set_short_channel_id(uint64_t this_ptr, int64_t val) {
60182         LDKRouteHintHop this_ptr_conv;
60183         this_ptr_conv.inner = untag_ptr(this_ptr);
60184         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
60185         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
60186         this_ptr_conv.is_owned = false;
60187         RouteHintHop_set_short_channel_id(&this_ptr_conv, val);
60188 }
60189
60190 uint64_t  __attribute__((export_name("TS_RouteHintHop_get_fees"))) TS_RouteHintHop_get_fees(uint64_t this_ptr) {
60191         LDKRouteHintHop this_ptr_conv;
60192         this_ptr_conv.inner = untag_ptr(this_ptr);
60193         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
60194         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
60195         this_ptr_conv.is_owned = false;
60196         LDKRoutingFees ret_var = RouteHintHop_get_fees(&this_ptr_conv);
60197         uint64_t ret_ref = 0;
60198         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
60199         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
60200         return ret_ref;
60201 }
60202
60203 void  __attribute__((export_name("TS_RouteHintHop_set_fees"))) TS_RouteHintHop_set_fees(uint64_t this_ptr, uint64_t val) {
60204         LDKRouteHintHop this_ptr_conv;
60205         this_ptr_conv.inner = untag_ptr(this_ptr);
60206         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
60207         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
60208         this_ptr_conv.is_owned = false;
60209         LDKRoutingFees val_conv;
60210         val_conv.inner = untag_ptr(val);
60211         val_conv.is_owned = ptr_is_owned(val);
60212         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
60213         val_conv = RoutingFees_clone(&val_conv);
60214         RouteHintHop_set_fees(&this_ptr_conv, val_conv);
60215 }
60216
60217 int16_t  __attribute__((export_name("TS_RouteHintHop_get_cltv_expiry_delta"))) TS_RouteHintHop_get_cltv_expiry_delta(uint64_t this_ptr) {
60218         LDKRouteHintHop this_ptr_conv;
60219         this_ptr_conv.inner = untag_ptr(this_ptr);
60220         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
60221         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
60222         this_ptr_conv.is_owned = false;
60223         int16_t ret_conv = RouteHintHop_get_cltv_expiry_delta(&this_ptr_conv);
60224         return ret_conv;
60225 }
60226
60227 void  __attribute__((export_name("TS_RouteHintHop_set_cltv_expiry_delta"))) TS_RouteHintHop_set_cltv_expiry_delta(uint64_t this_ptr, int16_t val) {
60228         LDKRouteHintHop this_ptr_conv;
60229         this_ptr_conv.inner = untag_ptr(this_ptr);
60230         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
60231         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
60232         this_ptr_conv.is_owned = false;
60233         RouteHintHop_set_cltv_expiry_delta(&this_ptr_conv, val);
60234 }
60235
60236 uint64_t  __attribute__((export_name("TS_RouteHintHop_get_htlc_minimum_msat"))) TS_RouteHintHop_get_htlc_minimum_msat(uint64_t this_ptr) {
60237         LDKRouteHintHop this_ptr_conv;
60238         this_ptr_conv.inner = untag_ptr(this_ptr);
60239         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
60240         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
60241         this_ptr_conv.is_owned = false;
60242         LDKCOption_u64Z *ret_copy = MALLOC(sizeof(LDKCOption_u64Z), "LDKCOption_u64Z");
60243         *ret_copy = RouteHintHop_get_htlc_minimum_msat(&this_ptr_conv);
60244         uint64_t ret_ref = tag_ptr(ret_copy, true);
60245         return ret_ref;
60246 }
60247
60248 void  __attribute__((export_name("TS_RouteHintHop_set_htlc_minimum_msat"))) TS_RouteHintHop_set_htlc_minimum_msat(uint64_t this_ptr, uint64_t val) {
60249         LDKRouteHintHop this_ptr_conv;
60250         this_ptr_conv.inner = untag_ptr(this_ptr);
60251         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
60252         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
60253         this_ptr_conv.is_owned = false;
60254         void* val_ptr = untag_ptr(val);
60255         CHECK_ACCESS(val_ptr);
60256         LDKCOption_u64Z val_conv = *(LDKCOption_u64Z*)(val_ptr);
60257         val_conv = COption_u64Z_clone((LDKCOption_u64Z*)untag_ptr(val));
60258         RouteHintHop_set_htlc_minimum_msat(&this_ptr_conv, val_conv);
60259 }
60260
60261 uint64_t  __attribute__((export_name("TS_RouteHintHop_get_htlc_maximum_msat"))) TS_RouteHintHop_get_htlc_maximum_msat(uint64_t this_ptr) {
60262         LDKRouteHintHop this_ptr_conv;
60263         this_ptr_conv.inner = untag_ptr(this_ptr);
60264         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
60265         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
60266         this_ptr_conv.is_owned = false;
60267         LDKCOption_u64Z *ret_copy = MALLOC(sizeof(LDKCOption_u64Z), "LDKCOption_u64Z");
60268         *ret_copy = RouteHintHop_get_htlc_maximum_msat(&this_ptr_conv);
60269         uint64_t ret_ref = tag_ptr(ret_copy, true);
60270         return ret_ref;
60271 }
60272
60273 void  __attribute__((export_name("TS_RouteHintHop_set_htlc_maximum_msat"))) TS_RouteHintHop_set_htlc_maximum_msat(uint64_t this_ptr, uint64_t val) {
60274         LDKRouteHintHop this_ptr_conv;
60275         this_ptr_conv.inner = untag_ptr(this_ptr);
60276         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
60277         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
60278         this_ptr_conv.is_owned = false;
60279         void* val_ptr = untag_ptr(val);
60280         CHECK_ACCESS(val_ptr);
60281         LDKCOption_u64Z val_conv = *(LDKCOption_u64Z*)(val_ptr);
60282         val_conv = COption_u64Z_clone((LDKCOption_u64Z*)untag_ptr(val));
60283         RouteHintHop_set_htlc_maximum_msat(&this_ptr_conv, val_conv);
60284 }
60285
60286 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) {
60287         LDKPublicKey src_node_id_arg_ref;
60288         CHECK(src_node_id_arg->arr_len == 33);
60289         memcpy(src_node_id_arg_ref.compressed_form, src_node_id_arg->elems, 33); FREE(src_node_id_arg);
60290         LDKRoutingFees fees_arg_conv;
60291         fees_arg_conv.inner = untag_ptr(fees_arg);
60292         fees_arg_conv.is_owned = ptr_is_owned(fees_arg);
60293         CHECK_INNER_FIELD_ACCESS_OR_NULL(fees_arg_conv);
60294         fees_arg_conv = RoutingFees_clone(&fees_arg_conv);
60295         void* htlc_minimum_msat_arg_ptr = untag_ptr(htlc_minimum_msat_arg);
60296         CHECK_ACCESS(htlc_minimum_msat_arg_ptr);
60297         LDKCOption_u64Z htlc_minimum_msat_arg_conv = *(LDKCOption_u64Z*)(htlc_minimum_msat_arg_ptr);
60298         htlc_minimum_msat_arg_conv = COption_u64Z_clone((LDKCOption_u64Z*)untag_ptr(htlc_minimum_msat_arg));
60299         void* htlc_maximum_msat_arg_ptr = untag_ptr(htlc_maximum_msat_arg);
60300         CHECK_ACCESS(htlc_maximum_msat_arg_ptr);
60301         LDKCOption_u64Z htlc_maximum_msat_arg_conv = *(LDKCOption_u64Z*)(htlc_maximum_msat_arg_ptr);
60302         htlc_maximum_msat_arg_conv = COption_u64Z_clone((LDKCOption_u64Z*)untag_ptr(htlc_maximum_msat_arg));
60303         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);
60304         uint64_t ret_ref = 0;
60305         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
60306         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
60307         return ret_ref;
60308 }
60309
60310 static inline uint64_t RouteHintHop_clone_ptr(LDKRouteHintHop *NONNULL_PTR arg) {
60311         LDKRouteHintHop ret_var = RouteHintHop_clone(arg);
60312         uint64_t ret_ref = 0;
60313         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
60314         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
60315         return ret_ref;
60316 }
60317 int64_t  __attribute__((export_name("TS_RouteHintHop_clone_ptr"))) TS_RouteHintHop_clone_ptr(uint64_t arg) {
60318         LDKRouteHintHop arg_conv;
60319         arg_conv.inner = untag_ptr(arg);
60320         arg_conv.is_owned = ptr_is_owned(arg);
60321         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
60322         arg_conv.is_owned = false;
60323         int64_t ret_conv = RouteHintHop_clone_ptr(&arg_conv);
60324         return ret_conv;
60325 }
60326
60327 uint64_t  __attribute__((export_name("TS_RouteHintHop_clone"))) TS_RouteHintHop_clone(uint64_t orig) {
60328         LDKRouteHintHop orig_conv;
60329         orig_conv.inner = untag_ptr(orig);
60330         orig_conv.is_owned = ptr_is_owned(orig);
60331         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
60332         orig_conv.is_owned = false;
60333         LDKRouteHintHop ret_var = RouteHintHop_clone(&orig_conv);
60334         uint64_t ret_ref = 0;
60335         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
60336         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
60337         return ret_ref;
60338 }
60339
60340 int64_t  __attribute__((export_name("TS_RouteHintHop_hash"))) TS_RouteHintHop_hash(uint64_t o) {
60341         LDKRouteHintHop o_conv;
60342         o_conv.inner = untag_ptr(o);
60343         o_conv.is_owned = ptr_is_owned(o);
60344         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
60345         o_conv.is_owned = false;
60346         int64_t ret_conv = RouteHintHop_hash(&o_conv);
60347         return ret_conv;
60348 }
60349
60350 jboolean  __attribute__((export_name("TS_RouteHintHop_eq"))) TS_RouteHintHop_eq(uint64_t a, uint64_t b) {
60351         LDKRouteHintHop a_conv;
60352         a_conv.inner = untag_ptr(a);
60353         a_conv.is_owned = ptr_is_owned(a);
60354         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
60355         a_conv.is_owned = false;
60356         LDKRouteHintHop b_conv;
60357         b_conv.inner = untag_ptr(b);
60358         b_conv.is_owned = ptr_is_owned(b);
60359         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
60360         b_conv.is_owned = false;
60361         jboolean ret_conv = RouteHintHop_eq(&a_conv, &b_conv);
60362         return ret_conv;
60363 }
60364
60365 int8_tArray  __attribute__((export_name("TS_RouteHintHop_write"))) TS_RouteHintHop_write(uint64_t obj) {
60366         LDKRouteHintHop obj_conv;
60367         obj_conv.inner = untag_ptr(obj);
60368         obj_conv.is_owned = ptr_is_owned(obj);
60369         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
60370         obj_conv.is_owned = false;
60371         LDKCVec_u8Z ret_var = RouteHintHop_write(&obj_conv);
60372         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
60373         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
60374         CVec_u8Z_free(ret_var);
60375         return ret_arr;
60376 }
60377
60378 uint64_t  __attribute__((export_name("TS_RouteHintHop_read"))) TS_RouteHintHop_read(int8_tArray ser) {
60379         LDKu8slice ser_ref;
60380         ser_ref.datalen = ser->arr_len;
60381         ser_ref.data = ser->elems;
60382         LDKCResult_RouteHintHopDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteHintHopDecodeErrorZ), "LDKCResult_RouteHintHopDecodeErrorZ");
60383         *ret_conv = RouteHintHop_read(ser_ref);
60384         FREE(ser);
60385         return tag_ptr(ret_conv, true);
60386 }
60387
60388 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) {
60389         LDKPublicKey our_node_pubkey_ref;
60390         CHECK(our_node_pubkey->arr_len == 33);
60391         memcpy(our_node_pubkey_ref.compressed_form, our_node_pubkey->elems, 33); FREE(our_node_pubkey);
60392         LDKRouteParameters route_params_conv;
60393         route_params_conv.inner = untag_ptr(route_params);
60394         route_params_conv.is_owned = ptr_is_owned(route_params);
60395         CHECK_INNER_FIELD_ACCESS_OR_NULL(route_params_conv);
60396         route_params_conv.is_owned = false;
60397         LDKNetworkGraph network_graph_conv;
60398         network_graph_conv.inner = untag_ptr(network_graph);
60399         network_graph_conv.is_owned = ptr_is_owned(network_graph);
60400         CHECK_INNER_FIELD_ACCESS_OR_NULL(network_graph_conv);
60401         network_graph_conv.is_owned = false;
60402         LDKCVec_ChannelDetailsZ first_hops_constr;
60403         LDKCVec_ChannelDetailsZ *first_hops_ptr = NULL;
60404         if (first_hops != 0) {
60405                 first_hops_constr.datalen = first_hops->arr_len;
60406                 if (first_hops_constr.datalen > 0)
60407                         first_hops_constr.data = MALLOC(first_hops_constr.datalen * sizeof(LDKChannelDetails), "LDKCVec_ChannelDetailsZ Elements");
60408                 else
60409                         first_hops_constr.data = NULL;
60410                 uint64_t* first_hops_vals = first_hops->elems;
60411                 for (size_t q = 0; q < first_hops_constr.datalen; q++) {
60412                         uint64_t first_hops_conv_16 = first_hops_vals[q];
60413                         LDKChannelDetails first_hops_conv_16_conv;
60414                         first_hops_conv_16_conv.inner = untag_ptr(first_hops_conv_16);
60415                         first_hops_conv_16_conv.is_owned = ptr_is_owned(first_hops_conv_16);
60416                         CHECK_INNER_FIELD_ACCESS_OR_NULL(first_hops_conv_16_conv);
60417                         first_hops_conv_16_conv.is_owned = false;
60418                         first_hops_constr.data[q] = first_hops_conv_16_conv;
60419                 }
60420                 FREE(first_hops);
60421                 first_hops_ptr = &first_hops_constr;
60422         }
60423         void* logger_ptr = untag_ptr(logger);
60424         CHECK_ACCESS(logger_ptr);
60425         LDKLogger logger_conv = *(LDKLogger*)(logger_ptr);
60426         if (logger_conv.free == LDKLogger_JCalls_free) {
60427                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
60428                 LDKLogger_JCalls_cloned(&logger_conv);
60429         }
60430         void* scorer_ptr = untag_ptr(scorer);
60431         if (ptr_is_owned(scorer)) { CHECK_ACCESS(scorer_ptr); }
60432         LDKScoreLookUp* scorer_conv = (LDKScoreLookUp*)scorer_ptr;
60433         LDKProbabilisticScoringFeeParameters score_params_conv;
60434         score_params_conv.inner = untag_ptr(score_params);
60435         score_params_conv.is_owned = ptr_is_owned(score_params);
60436         CHECK_INNER_FIELD_ACCESS_OR_NULL(score_params_conv);
60437         score_params_conv.is_owned = false;
60438         uint8_t random_seed_bytes_arr[32];
60439         CHECK(random_seed_bytes->arr_len == 32);
60440         memcpy(random_seed_bytes_arr, random_seed_bytes->elems, 32); FREE(random_seed_bytes);
60441         uint8_t (*random_seed_bytes_ref)[32] = &random_seed_bytes_arr;
60442         LDKCResult_RouteLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteLightningErrorZ), "LDKCResult_RouteLightningErrorZ");
60443         *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);
60444         if (first_hops_ptr != NULL) { FREE(first_hops_constr.data); }
60445         return tag_ptr(ret_conv, true);
60446 }
60447
60448 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) {
60449         LDKPublicKey our_node_pubkey_ref;
60450         CHECK(our_node_pubkey->arr_len == 33);
60451         memcpy(our_node_pubkey_ref.compressed_form, our_node_pubkey->elems, 33); FREE(our_node_pubkey);
60452         LDKCVec_PublicKeyZ hops_constr;
60453         hops_constr.datalen = hops->arr_len;
60454         if (hops_constr.datalen > 0)
60455                 hops_constr.data = MALLOC(hops_constr.datalen * sizeof(LDKPublicKey), "LDKCVec_PublicKeyZ Elements");
60456         else
60457                 hops_constr.data = NULL;
60458         int8_tArray* hops_vals = (void*) hops->elems;
60459         for (size_t m = 0; m < hops_constr.datalen; m++) {
60460                 int8_tArray hops_conv_12 = hops_vals[m];
60461                 LDKPublicKey hops_conv_12_ref;
60462                 CHECK(hops_conv_12->arr_len == 33);
60463                 memcpy(hops_conv_12_ref.compressed_form, hops_conv_12->elems, 33); FREE(hops_conv_12);
60464                 hops_constr.data[m] = hops_conv_12_ref;
60465         }
60466         FREE(hops);
60467         LDKRouteParameters route_params_conv;
60468         route_params_conv.inner = untag_ptr(route_params);
60469         route_params_conv.is_owned = ptr_is_owned(route_params);
60470         CHECK_INNER_FIELD_ACCESS_OR_NULL(route_params_conv);
60471         route_params_conv.is_owned = false;
60472         LDKNetworkGraph network_graph_conv;
60473         network_graph_conv.inner = untag_ptr(network_graph);
60474         network_graph_conv.is_owned = ptr_is_owned(network_graph);
60475         CHECK_INNER_FIELD_ACCESS_OR_NULL(network_graph_conv);
60476         network_graph_conv.is_owned = false;
60477         void* logger_ptr = untag_ptr(logger);
60478         CHECK_ACCESS(logger_ptr);
60479         LDKLogger logger_conv = *(LDKLogger*)(logger_ptr);
60480         if (logger_conv.free == LDKLogger_JCalls_free) {
60481                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
60482                 LDKLogger_JCalls_cloned(&logger_conv);
60483         }
60484         uint8_t random_seed_bytes_arr[32];
60485         CHECK(random_seed_bytes->arr_len == 32);
60486         memcpy(random_seed_bytes_arr, random_seed_bytes->elems, 32); FREE(random_seed_bytes);
60487         uint8_t (*random_seed_bytes_ref)[32] = &random_seed_bytes_arr;
60488         LDKCResult_RouteLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteLightningErrorZ), "LDKCResult_RouteLightningErrorZ");
60489         *ret_conv = build_route_from_hops(our_node_pubkey_ref, hops_constr, &route_params_conv, &network_graph_conv, logger_conv, random_seed_bytes_ref);
60490         return tag_ptr(ret_conv, true);
60491 }
60492
60493 void  __attribute__((export_name("TS_ScoreLookUp_free"))) TS_ScoreLookUp_free(uint64_t this_ptr) {
60494         if (!ptr_is_owned(this_ptr)) return;
60495         void* this_ptr_ptr = untag_ptr(this_ptr);
60496         CHECK_ACCESS(this_ptr_ptr);
60497         LDKScoreLookUp this_ptr_conv = *(LDKScoreLookUp*)(this_ptr_ptr);
60498         FREE(untag_ptr(this_ptr));
60499         ScoreLookUp_free(this_ptr_conv);
60500 }
60501
60502 void  __attribute__((export_name("TS_ScoreUpdate_free"))) TS_ScoreUpdate_free(uint64_t this_ptr) {
60503         if (!ptr_is_owned(this_ptr)) return;
60504         void* this_ptr_ptr = untag_ptr(this_ptr);
60505         CHECK_ACCESS(this_ptr_ptr);
60506         LDKScoreUpdate this_ptr_conv = *(LDKScoreUpdate*)(this_ptr_ptr);
60507         FREE(untag_ptr(this_ptr));
60508         ScoreUpdate_free(this_ptr_conv);
60509 }
60510
60511 void  __attribute__((export_name("TS_Score_free"))) TS_Score_free(uint64_t this_ptr) {
60512         if (!ptr_is_owned(this_ptr)) return;
60513         void* this_ptr_ptr = untag_ptr(this_ptr);
60514         CHECK_ACCESS(this_ptr_ptr);
60515         LDKScore this_ptr_conv = *(LDKScore*)(this_ptr_ptr);
60516         FREE(untag_ptr(this_ptr));
60517         Score_free(this_ptr_conv);
60518 }
60519
60520 void  __attribute__((export_name("TS_LockableScore_free"))) TS_LockableScore_free(uint64_t this_ptr) {
60521         if (!ptr_is_owned(this_ptr)) return;
60522         void* this_ptr_ptr = untag_ptr(this_ptr);
60523         CHECK_ACCESS(this_ptr_ptr);
60524         LDKLockableScore this_ptr_conv = *(LDKLockableScore*)(this_ptr_ptr);
60525         FREE(untag_ptr(this_ptr));
60526         LockableScore_free(this_ptr_conv);
60527 }
60528
60529 void  __attribute__((export_name("TS_WriteableScore_free"))) TS_WriteableScore_free(uint64_t this_ptr) {
60530         if (!ptr_is_owned(this_ptr)) return;
60531         void* this_ptr_ptr = untag_ptr(this_ptr);
60532         CHECK_ACCESS(this_ptr_ptr);
60533         LDKWriteableScore this_ptr_conv = *(LDKWriteableScore*)(this_ptr_ptr);
60534         FREE(untag_ptr(this_ptr));
60535         WriteableScore_free(this_ptr_conv);
60536 }
60537
60538 void  __attribute__((export_name("TS_MultiThreadedLockableScore_free"))) TS_MultiThreadedLockableScore_free(uint64_t this_obj) {
60539         LDKMultiThreadedLockableScore this_obj_conv;
60540         this_obj_conv.inner = untag_ptr(this_obj);
60541         this_obj_conv.is_owned = ptr_is_owned(this_obj);
60542         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
60543         MultiThreadedLockableScore_free(this_obj_conv);
60544 }
60545
60546 uint64_t  __attribute__((export_name("TS_MultiThreadedLockableScore_as_LockableScore"))) TS_MultiThreadedLockableScore_as_LockableScore(uint64_t this_arg) {
60547         LDKMultiThreadedLockableScore this_arg_conv;
60548         this_arg_conv.inner = untag_ptr(this_arg);
60549         this_arg_conv.is_owned = ptr_is_owned(this_arg);
60550         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
60551         this_arg_conv.is_owned = false;
60552         LDKLockableScore* ret_ret = MALLOC(sizeof(LDKLockableScore), "LDKLockableScore");
60553         *ret_ret = MultiThreadedLockableScore_as_LockableScore(&this_arg_conv);
60554         return tag_ptr(ret_ret, true);
60555 }
60556
60557 int8_tArray  __attribute__((export_name("TS_MultiThreadedLockableScore_write"))) TS_MultiThreadedLockableScore_write(uint64_t obj) {
60558         LDKMultiThreadedLockableScore obj_conv;
60559         obj_conv.inner = untag_ptr(obj);
60560         obj_conv.is_owned = ptr_is_owned(obj);
60561         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
60562         obj_conv.is_owned = false;
60563         LDKCVec_u8Z ret_var = MultiThreadedLockableScore_write(&obj_conv);
60564         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
60565         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
60566         CVec_u8Z_free(ret_var);
60567         return ret_arr;
60568 }
60569
60570 uint64_t  __attribute__((export_name("TS_MultiThreadedLockableScore_as_WriteableScore"))) TS_MultiThreadedLockableScore_as_WriteableScore(uint64_t this_arg) {
60571         LDKMultiThreadedLockableScore this_arg_conv;
60572         this_arg_conv.inner = untag_ptr(this_arg);
60573         this_arg_conv.is_owned = ptr_is_owned(this_arg);
60574         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
60575         this_arg_conv.is_owned = false;
60576         LDKWriteableScore* ret_ret = MALLOC(sizeof(LDKWriteableScore), "LDKWriteableScore");
60577         *ret_ret = MultiThreadedLockableScore_as_WriteableScore(&this_arg_conv);
60578         return tag_ptr(ret_ret, true);
60579 }
60580
60581 uint64_t  __attribute__((export_name("TS_MultiThreadedLockableScore_new"))) TS_MultiThreadedLockableScore_new(uint64_t score) {
60582         void* score_ptr = untag_ptr(score);
60583         CHECK_ACCESS(score_ptr);
60584         LDKScore score_conv = *(LDKScore*)(score_ptr);
60585         if (score_conv.free == LDKScore_JCalls_free) {
60586                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
60587                 LDKScore_JCalls_cloned(&score_conv);
60588         }
60589         LDKMultiThreadedLockableScore ret_var = MultiThreadedLockableScore_new(score_conv);
60590         uint64_t ret_ref = 0;
60591         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
60592         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
60593         return ret_ref;
60594 }
60595
60596 void  __attribute__((export_name("TS_MultiThreadedScoreLockRead_free"))) TS_MultiThreadedScoreLockRead_free(uint64_t this_obj) {
60597         LDKMultiThreadedScoreLockRead this_obj_conv;
60598         this_obj_conv.inner = untag_ptr(this_obj);
60599         this_obj_conv.is_owned = ptr_is_owned(this_obj);
60600         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
60601         MultiThreadedScoreLockRead_free(this_obj_conv);
60602 }
60603
60604 void  __attribute__((export_name("TS_MultiThreadedScoreLockWrite_free"))) TS_MultiThreadedScoreLockWrite_free(uint64_t this_obj) {
60605         LDKMultiThreadedScoreLockWrite this_obj_conv;
60606         this_obj_conv.inner = untag_ptr(this_obj);
60607         this_obj_conv.is_owned = ptr_is_owned(this_obj);
60608         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
60609         MultiThreadedScoreLockWrite_free(this_obj_conv);
60610 }
60611
60612 uint64_t  __attribute__((export_name("TS_MultiThreadedScoreLockRead_as_ScoreLookUp"))) TS_MultiThreadedScoreLockRead_as_ScoreLookUp(uint64_t this_arg) {
60613         LDKMultiThreadedScoreLockRead this_arg_conv;
60614         this_arg_conv.inner = untag_ptr(this_arg);
60615         this_arg_conv.is_owned = ptr_is_owned(this_arg);
60616         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
60617         this_arg_conv.is_owned = false;
60618         LDKScoreLookUp* ret_ret = MALLOC(sizeof(LDKScoreLookUp), "LDKScoreLookUp");
60619         *ret_ret = MultiThreadedScoreLockRead_as_ScoreLookUp(&this_arg_conv);
60620         return tag_ptr(ret_ret, true);
60621 }
60622
60623 int8_tArray  __attribute__((export_name("TS_MultiThreadedScoreLockWrite_write"))) TS_MultiThreadedScoreLockWrite_write(uint64_t obj) {
60624         LDKMultiThreadedScoreLockWrite obj_conv;
60625         obj_conv.inner = untag_ptr(obj);
60626         obj_conv.is_owned = ptr_is_owned(obj);
60627         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
60628         obj_conv.is_owned = false;
60629         LDKCVec_u8Z ret_var = MultiThreadedScoreLockWrite_write(&obj_conv);
60630         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
60631         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
60632         CVec_u8Z_free(ret_var);
60633         return ret_arr;
60634 }
60635
60636 uint64_t  __attribute__((export_name("TS_MultiThreadedScoreLockWrite_as_ScoreUpdate"))) TS_MultiThreadedScoreLockWrite_as_ScoreUpdate(uint64_t this_arg) {
60637         LDKMultiThreadedScoreLockWrite this_arg_conv;
60638         this_arg_conv.inner = untag_ptr(this_arg);
60639         this_arg_conv.is_owned = ptr_is_owned(this_arg);
60640         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
60641         this_arg_conv.is_owned = false;
60642         LDKScoreUpdate* ret_ret = MALLOC(sizeof(LDKScoreUpdate), "LDKScoreUpdate");
60643         *ret_ret = MultiThreadedScoreLockWrite_as_ScoreUpdate(&this_arg_conv);
60644         return tag_ptr(ret_ret, true);
60645 }
60646
60647 void  __attribute__((export_name("TS_ChannelUsage_free"))) TS_ChannelUsage_free(uint64_t this_obj) {
60648         LDKChannelUsage this_obj_conv;
60649         this_obj_conv.inner = untag_ptr(this_obj);
60650         this_obj_conv.is_owned = ptr_is_owned(this_obj);
60651         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
60652         ChannelUsage_free(this_obj_conv);
60653 }
60654
60655 int64_t  __attribute__((export_name("TS_ChannelUsage_get_amount_msat"))) TS_ChannelUsage_get_amount_msat(uint64_t this_ptr) {
60656         LDKChannelUsage this_ptr_conv;
60657         this_ptr_conv.inner = untag_ptr(this_ptr);
60658         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
60659         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
60660         this_ptr_conv.is_owned = false;
60661         int64_t ret_conv = ChannelUsage_get_amount_msat(&this_ptr_conv);
60662         return ret_conv;
60663 }
60664
60665 void  __attribute__((export_name("TS_ChannelUsage_set_amount_msat"))) TS_ChannelUsage_set_amount_msat(uint64_t this_ptr, int64_t val) {
60666         LDKChannelUsage this_ptr_conv;
60667         this_ptr_conv.inner = untag_ptr(this_ptr);
60668         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
60669         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
60670         this_ptr_conv.is_owned = false;
60671         ChannelUsage_set_amount_msat(&this_ptr_conv, val);
60672 }
60673
60674 int64_t  __attribute__((export_name("TS_ChannelUsage_get_inflight_htlc_msat"))) TS_ChannelUsage_get_inflight_htlc_msat(uint64_t this_ptr) {
60675         LDKChannelUsage this_ptr_conv;
60676         this_ptr_conv.inner = untag_ptr(this_ptr);
60677         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
60678         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
60679         this_ptr_conv.is_owned = false;
60680         int64_t ret_conv = ChannelUsage_get_inflight_htlc_msat(&this_ptr_conv);
60681         return ret_conv;
60682 }
60683
60684 void  __attribute__((export_name("TS_ChannelUsage_set_inflight_htlc_msat"))) TS_ChannelUsage_set_inflight_htlc_msat(uint64_t this_ptr, int64_t val) {
60685         LDKChannelUsage this_ptr_conv;
60686         this_ptr_conv.inner = untag_ptr(this_ptr);
60687         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
60688         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
60689         this_ptr_conv.is_owned = false;
60690         ChannelUsage_set_inflight_htlc_msat(&this_ptr_conv, val);
60691 }
60692
60693 uint64_t  __attribute__((export_name("TS_ChannelUsage_get_effective_capacity"))) TS_ChannelUsage_get_effective_capacity(uint64_t this_ptr) {
60694         LDKChannelUsage this_ptr_conv;
60695         this_ptr_conv.inner = untag_ptr(this_ptr);
60696         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
60697         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
60698         this_ptr_conv.is_owned = false;
60699         LDKEffectiveCapacity *ret_copy = MALLOC(sizeof(LDKEffectiveCapacity), "LDKEffectiveCapacity");
60700         *ret_copy = ChannelUsage_get_effective_capacity(&this_ptr_conv);
60701         uint64_t ret_ref = tag_ptr(ret_copy, true);
60702         return ret_ref;
60703 }
60704
60705 void  __attribute__((export_name("TS_ChannelUsage_set_effective_capacity"))) TS_ChannelUsage_set_effective_capacity(uint64_t this_ptr, uint64_t val) {
60706         LDKChannelUsage this_ptr_conv;
60707         this_ptr_conv.inner = untag_ptr(this_ptr);
60708         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
60709         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
60710         this_ptr_conv.is_owned = false;
60711         void* val_ptr = untag_ptr(val);
60712         CHECK_ACCESS(val_ptr);
60713         LDKEffectiveCapacity val_conv = *(LDKEffectiveCapacity*)(val_ptr);
60714         val_conv = EffectiveCapacity_clone((LDKEffectiveCapacity*)untag_ptr(val));
60715         ChannelUsage_set_effective_capacity(&this_ptr_conv, val_conv);
60716 }
60717
60718 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) {
60719         void* effective_capacity_arg_ptr = untag_ptr(effective_capacity_arg);
60720         CHECK_ACCESS(effective_capacity_arg_ptr);
60721         LDKEffectiveCapacity effective_capacity_arg_conv = *(LDKEffectiveCapacity*)(effective_capacity_arg_ptr);
60722         effective_capacity_arg_conv = EffectiveCapacity_clone((LDKEffectiveCapacity*)untag_ptr(effective_capacity_arg));
60723         LDKChannelUsage ret_var = ChannelUsage_new(amount_msat_arg, inflight_htlc_msat_arg, effective_capacity_arg_conv);
60724         uint64_t ret_ref = 0;
60725         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
60726         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
60727         return ret_ref;
60728 }
60729
60730 static inline uint64_t ChannelUsage_clone_ptr(LDKChannelUsage *NONNULL_PTR arg) {
60731         LDKChannelUsage ret_var = ChannelUsage_clone(arg);
60732         uint64_t ret_ref = 0;
60733         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
60734         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
60735         return ret_ref;
60736 }
60737 int64_t  __attribute__((export_name("TS_ChannelUsage_clone_ptr"))) TS_ChannelUsage_clone_ptr(uint64_t arg) {
60738         LDKChannelUsage arg_conv;
60739         arg_conv.inner = untag_ptr(arg);
60740         arg_conv.is_owned = ptr_is_owned(arg);
60741         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
60742         arg_conv.is_owned = false;
60743         int64_t ret_conv = ChannelUsage_clone_ptr(&arg_conv);
60744         return ret_conv;
60745 }
60746
60747 uint64_t  __attribute__((export_name("TS_ChannelUsage_clone"))) TS_ChannelUsage_clone(uint64_t orig) {
60748         LDKChannelUsage orig_conv;
60749         orig_conv.inner = untag_ptr(orig);
60750         orig_conv.is_owned = ptr_is_owned(orig);
60751         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
60752         orig_conv.is_owned = false;
60753         LDKChannelUsage ret_var = ChannelUsage_clone(&orig_conv);
60754         uint64_t ret_ref = 0;
60755         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
60756         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
60757         return ret_ref;
60758 }
60759
60760 void  __attribute__((export_name("TS_FixedPenaltyScorer_free"))) TS_FixedPenaltyScorer_free(uint64_t this_obj) {
60761         LDKFixedPenaltyScorer this_obj_conv;
60762         this_obj_conv.inner = untag_ptr(this_obj);
60763         this_obj_conv.is_owned = ptr_is_owned(this_obj);
60764         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
60765         FixedPenaltyScorer_free(this_obj_conv);
60766 }
60767
60768 static inline uint64_t FixedPenaltyScorer_clone_ptr(LDKFixedPenaltyScorer *NONNULL_PTR arg) {
60769         LDKFixedPenaltyScorer ret_var = FixedPenaltyScorer_clone(arg);
60770         uint64_t ret_ref = 0;
60771         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
60772         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
60773         return ret_ref;
60774 }
60775 int64_t  __attribute__((export_name("TS_FixedPenaltyScorer_clone_ptr"))) TS_FixedPenaltyScorer_clone_ptr(uint64_t arg) {
60776         LDKFixedPenaltyScorer arg_conv;
60777         arg_conv.inner = untag_ptr(arg);
60778         arg_conv.is_owned = ptr_is_owned(arg);
60779         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
60780         arg_conv.is_owned = false;
60781         int64_t ret_conv = FixedPenaltyScorer_clone_ptr(&arg_conv);
60782         return ret_conv;
60783 }
60784
60785 uint64_t  __attribute__((export_name("TS_FixedPenaltyScorer_clone"))) TS_FixedPenaltyScorer_clone(uint64_t orig) {
60786         LDKFixedPenaltyScorer orig_conv;
60787         orig_conv.inner = untag_ptr(orig);
60788         orig_conv.is_owned = ptr_is_owned(orig);
60789         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
60790         orig_conv.is_owned = false;
60791         LDKFixedPenaltyScorer ret_var = FixedPenaltyScorer_clone(&orig_conv);
60792         uint64_t ret_ref = 0;
60793         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
60794         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
60795         return ret_ref;
60796 }
60797
60798 uint64_t  __attribute__((export_name("TS_FixedPenaltyScorer_with_penalty"))) TS_FixedPenaltyScorer_with_penalty(int64_t penalty_msat) {
60799         LDKFixedPenaltyScorer ret_var = FixedPenaltyScorer_with_penalty(penalty_msat);
60800         uint64_t ret_ref = 0;
60801         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
60802         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
60803         return ret_ref;
60804 }
60805
60806 uint64_t  __attribute__((export_name("TS_FixedPenaltyScorer_as_ScoreLookUp"))) TS_FixedPenaltyScorer_as_ScoreLookUp(uint64_t this_arg) {
60807         LDKFixedPenaltyScorer this_arg_conv;
60808         this_arg_conv.inner = untag_ptr(this_arg);
60809         this_arg_conv.is_owned = ptr_is_owned(this_arg);
60810         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
60811         this_arg_conv.is_owned = false;
60812         LDKScoreLookUp* ret_ret = MALLOC(sizeof(LDKScoreLookUp), "LDKScoreLookUp");
60813         *ret_ret = FixedPenaltyScorer_as_ScoreLookUp(&this_arg_conv);
60814         return tag_ptr(ret_ret, true);
60815 }
60816
60817 uint64_t  __attribute__((export_name("TS_FixedPenaltyScorer_as_ScoreUpdate"))) TS_FixedPenaltyScorer_as_ScoreUpdate(uint64_t this_arg) {
60818         LDKFixedPenaltyScorer this_arg_conv;
60819         this_arg_conv.inner = untag_ptr(this_arg);
60820         this_arg_conv.is_owned = ptr_is_owned(this_arg);
60821         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
60822         this_arg_conv.is_owned = false;
60823         LDKScoreUpdate* ret_ret = MALLOC(sizeof(LDKScoreUpdate), "LDKScoreUpdate");
60824         *ret_ret = FixedPenaltyScorer_as_ScoreUpdate(&this_arg_conv);
60825         return tag_ptr(ret_ret, true);
60826 }
60827
60828 int8_tArray  __attribute__((export_name("TS_FixedPenaltyScorer_write"))) TS_FixedPenaltyScorer_write(uint64_t obj) {
60829         LDKFixedPenaltyScorer obj_conv;
60830         obj_conv.inner = untag_ptr(obj);
60831         obj_conv.is_owned = ptr_is_owned(obj);
60832         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
60833         obj_conv.is_owned = false;
60834         LDKCVec_u8Z ret_var = FixedPenaltyScorer_write(&obj_conv);
60835         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
60836         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
60837         CVec_u8Z_free(ret_var);
60838         return ret_arr;
60839 }
60840
60841 uint64_t  __attribute__((export_name("TS_FixedPenaltyScorer_read"))) TS_FixedPenaltyScorer_read(int8_tArray ser, int64_t arg) {
60842         LDKu8slice ser_ref;
60843         ser_ref.datalen = ser->arr_len;
60844         ser_ref.data = ser->elems;
60845         LDKCResult_FixedPenaltyScorerDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_FixedPenaltyScorerDecodeErrorZ), "LDKCResult_FixedPenaltyScorerDecodeErrorZ");
60846         *ret_conv = FixedPenaltyScorer_read(ser_ref, arg);
60847         FREE(ser);
60848         return tag_ptr(ret_conv, true);
60849 }
60850
60851 void  __attribute__((export_name("TS_ProbabilisticScorer_free"))) TS_ProbabilisticScorer_free(uint64_t this_obj) {
60852         LDKProbabilisticScorer this_obj_conv;
60853         this_obj_conv.inner = untag_ptr(this_obj);
60854         this_obj_conv.is_owned = ptr_is_owned(this_obj);
60855         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
60856         ProbabilisticScorer_free(this_obj_conv);
60857 }
60858
60859 void  __attribute__((export_name("TS_ProbabilisticScoringFeeParameters_free"))) TS_ProbabilisticScoringFeeParameters_free(uint64_t this_obj) {
60860         LDKProbabilisticScoringFeeParameters this_obj_conv;
60861         this_obj_conv.inner = untag_ptr(this_obj);
60862         this_obj_conv.is_owned = ptr_is_owned(this_obj);
60863         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
60864         ProbabilisticScoringFeeParameters_free(this_obj_conv);
60865 }
60866
60867 int64_t  __attribute__((export_name("TS_ProbabilisticScoringFeeParameters_get_base_penalty_msat"))) TS_ProbabilisticScoringFeeParameters_get_base_penalty_msat(uint64_t this_ptr) {
60868         LDKProbabilisticScoringFeeParameters this_ptr_conv;
60869         this_ptr_conv.inner = untag_ptr(this_ptr);
60870         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
60871         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
60872         this_ptr_conv.is_owned = false;
60873         int64_t ret_conv = ProbabilisticScoringFeeParameters_get_base_penalty_msat(&this_ptr_conv);
60874         return ret_conv;
60875 }
60876
60877 void  __attribute__((export_name("TS_ProbabilisticScoringFeeParameters_set_base_penalty_msat"))) TS_ProbabilisticScoringFeeParameters_set_base_penalty_msat(uint64_t this_ptr, int64_t val) {
60878         LDKProbabilisticScoringFeeParameters this_ptr_conv;
60879         this_ptr_conv.inner = untag_ptr(this_ptr);
60880         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
60881         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
60882         this_ptr_conv.is_owned = false;
60883         ProbabilisticScoringFeeParameters_set_base_penalty_msat(&this_ptr_conv, val);
60884 }
60885
60886 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) {
60887         LDKProbabilisticScoringFeeParameters this_ptr_conv;
60888         this_ptr_conv.inner = untag_ptr(this_ptr);
60889         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
60890         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
60891         this_ptr_conv.is_owned = false;
60892         int64_t ret_conv = ProbabilisticScoringFeeParameters_get_base_penalty_amount_multiplier_msat(&this_ptr_conv);
60893         return ret_conv;
60894 }
60895
60896 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) {
60897         LDKProbabilisticScoringFeeParameters this_ptr_conv;
60898         this_ptr_conv.inner = untag_ptr(this_ptr);
60899         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
60900         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
60901         this_ptr_conv.is_owned = false;
60902         ProbabilisticScoringFeeParameters_set_base_penalty_amount_multiplier_msat(&this_ptr_conv, val);
60903 }
60904
60905 int64_t  __attribute__((export_name("TS_ProbabilisticScoringFeeParameters_get_liquidity_penalty_multiplier_msat"))) TS_ProbabilisticScoringFeeParameters_get_liquidity_penalty_multiplier_msat(uint64_t this_ptr) {
60906         LDKProbabilisticScoringFeeParameters this_ptr_conv;
60907         this_ptr_conv.inner = untag_ptr(this_ptr);
60908         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
60909         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
60910         this_ptr_conv.is_owned = false;
60911         int64_t ret_conv = ProbabilisticScoringFeeParameters_get_liquidity_penalty_multiplier_msat(&this_ptr_conv);
60912         return ret_conv;
60913 }
60914
60915 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) {
60916         LDKProbabilisticScoringFeeParameters this_ptr_conv;
60917         this_ptr_conv.inner = untag_ptr(this_ptr);
60918         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
60919         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
60920         this_ptr_conv.is_owned = false;
60921         ProbabilisticScoringFeeParameters_set_liquidity_penalty_multiplier_msat(&this_ptr_conv, val);
60922 }
60923
60924 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) {
60925         LDKProbabilisticScoringFeeParameters this_ptr_conv;
60926         this_ptr_conv.inner = untag_ptr(this_ptr);
60927         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
60928         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
60929         this_ptr_conv.is_owned = false;
60930         int64_t ret_conv = ProbabilisticScoringFeeParameters_get_liquidity_penalty_amount_multiplier_msat(&this_ptr_conv);
60931         return ret_conv;
60932 }
60933
60934 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) {
60935         LDKProbabilisticScoringFeeParameters this_ptr_conv;
60936         this_ptr_conv.inner = untag_ptr(this_ptr);
60937         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
60938         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
60939         this_ptr_conv.is_owned = false;
60940         ProbabilisticScoringFeeParameters_set_liquidity_penalty_amount_multiplier_msat(&this_ptr_conv, val);
60941 }
60942
60943 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) {
60944         LDKProbabilisticScoringFeeParameters this_ptr_conv;
60945         this_ptr_conv.inner = untag_ptr(this_ptr);
60946         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
60947         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
60948         this_ptr_conv.is_owned = false;
60949         int64_t ret_conv = ProbabilisticScoringFeeParameters_get_historical_liquidity_penalty_multiplier_msat(&this_ptr_conv);
60950         return ret_conv;
60951 }
60952
60953 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) {
60954         LDKProbabilisticScoringFeeParameters this_ptr_conv;
60955         this_ptr_conv.inner = untag_ptr(this_ptr);
60956         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
60957         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
60958         this_ptr_conv.is_owned = false;
60959         ProbabilisticScoringFeeParameters_set_historical_liquidity_penalty_multiplier_msat(&this_ptr_conv, val);
60960 }
60961
60962 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) {
60963         LDKProbabilisticScoringFeeParameters this_ptr_conv;
60964         this_ptr_conv.inner = untag_ptr(this_ptr);
60965         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
60966         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
60967         this_ptr_conv.is_owned = false;
60968         int64_t ret_conv = ProbabilisticScoringFeeParameters_get_historical_liquidity_penalty_amount_multiplier_msat(&this_ptr_conv);
60969         return ret_conv;
60970 }
60971
60972 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) {
60973         LDKProbabilisticScoringFeeParameters this_ptr_conv;
60974         this_ptr_conv.inner = untag_ptr(this_ptr);
60975         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
60976         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
60977         this_ptr_conv.is_owned = false;
60978         ProbabilisticScoringFeeParameters_set_historical_liquidity_penalty_amount_multiplier_msat(&this_ptr_conv, val);
60979 }
60980
60981 int64_t  __attribute__((export_name("TS_ProbabilisticScoringFeeParameters_get_anti_probing_penalty_msat"))) TS_ProbabilisticScoringFeeParameters_get_anti_probing_penalty_msat(uint64_t this_ptr) {
60982         LDKProbabilisticScoringFeeParameters this_ptr_conv;
60983         this_ptr_conv.inner = untag_ptr(this_ptr);
60984         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
60985         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
60986         this_ptr_conv.is_owned = false;
60987         int64_t ret_conv = ProbabilisticScoringFeeParameters_get_anti_probing_penalty_msat(&this_ptr_conv);
60988         return ret_conv;
60989 }
60990
60991 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) {
60992         LDKProbabilisticScoringFeeParameters this_ptr_conv;
60993         this_ptr_conv.inner = untag_ptr(this_ptr);
60994         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
60995         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
60996         this_ptr_conv.is_owned = false;
60997         ProbabilisticScoringFeeParameters_set_anti_probing_penalty_msat(&this_ptr_conv, val);
60998 }
60999
61000 int64_t  __attribute__((export_name("TS_ProbabilisticScoringFeeParameters_get_considered_impossible_penalty_msat"))) TS_ProbabilisticScoringFeeParameters_get_considered_impossible_penalty_msat(uint64_t this_ptr) {
61001         LDKProbabilisticScoringFeeParameters this_ptr_conv;
61002         this_ptr_conv.inner = untag_ptr(this_ptr);
61003         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
61004         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
61005         this_ptr_conv.is_owned = false;
61006         int64_t ret_conv = ProbabilisticScoringFeeParameters_get_considered_impossible_penalty_msat(&this_ptr_conv);
61007         return ret_conv;
61008 }
61009
61010 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) {
61011         LDKProbabilisticScoringFeeParameters this_ptr_conv;
61012         this_ptr_conv.inner = untag_ptr(this_ptr);
61013         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
61014         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
61015         this_ptr_conv.is_owned = false;
61016         ProbabilisticScoringFeeParameters_set_considered_impossible_penalty_msat(&this_ptr_conv, val);
61017 }
61018
61019 jboolean  __attribute__((export_name("TS_ProbabilisticScoringFeeParameters_get_linear_success_probability"))) TS_ProbabilisticScoringFeeParameters_get_linear_success_probability(uint64_t this_ptr) {
61020         LDKProbabilisticScoringFeeParameters this_ptr_conv;
61021         this_ptr_conv.inner = untag_ptr(this_ptr);
61022         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
61023         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
61024         this_ptr_conv.is_owned = false;
61025         jboolean ret_conv = ProbabilisticScoringFeeParameters_get_linear_success_probability(&this_ptr_conv);
61026         return ret_conv;
61027 }
61028
61029 void  __attribute__((export_name("TS_ProbabilisticScoringFeeParameters_set_linear_success_probability"))) TS_ProbabilisticScoringFeeParameters_set_linear_success_probability(uint64_t this_ptr, jboolean val) {
61030         LDKProbabilisticScoringFeeParameters this_ptr_conv;
61031         this_ptr_conv.inner = untag_ptr(this_ptr);
61032         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
61033         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
61034         this_ptr_conv.is_owned = false;
61035         ProbabilisticScoringFeeParameters_set_linear_success_probability(&this_ptr_conv, val);
61036 }
61037
61038 static inline uint64_t ProbabilisticScoringFeeParameters_clone_ptr(LDKProbabilisticScoringFeeParameters *NONNULL_PTR arg) {
61039         LDKProbabilisticScoringFeeParameters ret_var = ProbabilisticScoringFeeParameters_clone(arg);
61040         uint64_t ret_ref = 0;
61041         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
61042         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
61043         return ret_ref;
61044 }
61045 int64_t  __attribute__((export_name("TS_ProbabilisticScoringFeeParameters_clone_ptr"))) TS_ProbabilisticScoringFeeParameters_clone_ptr(uint64_t arg) {
61046         LDKProbabilisticScoringFeeParameters arg_conv;
61047         arg_conv.inner = untag_ptr(arg);
61048         arg_conv.is_owned = ptr_is_owned(arg);
61049         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
61050         arg_conv.is_owned = false;
61051         int64_t ret_conv = ProbabilisticScoringFeeParameters_clone_ptr(&arg_conv);
61052         return ret_conv;
61053 }
61054
61055 uint64_t  __attribute__((export_name("TS_ProbabilisticScoringFeeParameters_clone"))) TS_ProbabilisticScoringFeeParameters_clone(uint64_t orig) {
61056         LDKProbabilisticScoringFeeParameters orig_conv;
61057         orig_conv.inner = untag_ptr(orig);
61058         orig_conv.is_owned = ptr_is_owned(orig);
61059         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
61060         orig_conv.is_owned = false;
61061         LDKProbabilisticScoringFeeParameters ret_var = ProbabilisticScoringFeeParameters_clone(&orig_conv);
61062         uint64_t ret_ref = 0;
61063         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
61064         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
61065         return ret_ref;
61066 }
61067
61068 uint64_t  __attribute__((export_name("TS_ProbabilisticScoringFeeParameters_default"))) TS_ProbabilisticScoringFeeParameters_default() {
61069         LDKProbabilisticScoringFeeParameters ret_var = ProbabilisticScoringFeeParameters_default();
61070         uint64_t ret_ref = 0;
61071         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
61072         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
61073         return ret_ref;
61074 }
61075
61076 void  __attribute__((export_name("TS_ProbabilisticScoringFeeParameters_add_banned"))) TS_ProbabilisticScoringFeeParameters_add_banned(uint64_t this_arg, uint64_t node_id) {
61077         LDKProbabilisticScoringFeeParameters this_arg_conv;
61078         this_arg_conv.inner = untag_ptr(this_arg);
61079         this_arg_conv.is_owned = ptr_is_owned(this_arg);
61080         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
61081         this_arg_conv.is_owned = false;
61082         LDKNodeId node_id_conv;
61083         node_id_conv.inner = untag_ptr(node_id);
61084         node_id_conv.is_owned = ptr_is_owned(node_id);
61085         CHECK_INNER_FIELD_ACCESS_OR_NULL(node_id_conv);
61086         node_id_conv.is_owned = false;
61087         ProbabilisticScoringFeeParameters_add_banned(&this_arg_conv, &node_id_conv);
61088 }
61089
61090 void  __attribute__((export_name("TS_ProbabilisticScoringFeeParameters_add_banned_from_list"))) TS_ProbabilisticScoringFeeParameters_add_banned_from_list(uint64_t this_arg, uint64_tArray node_ids) {
61091         LDKProbabilisticScoringFeeParameters this_arg_conv;
61092         this_arg_conv.inner = untag_ptr(this_arg);
61093         this_arg_conv.is_owned = ptr_is_owned(this_arg);
61094         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
61095         this_arg_conv.is_owned = false;
61096         LDKCVec_NodeIdZ node_ids_constr;
61097         node_ids_constr.datalen = node_ids->arr_len;
61098         if (node_ids_constr.datalen > 0)
61099                 node_ids_constr.data = MALLOC(node_ids_constr.datalen * sizeof(LDKNodeId), "LDKCVec_NodeIdZ Elements");
61100         else
61101                 node_ids_constr.data = NULL;
61102         uint64_t* node_ids_vals = node_ids->elems;
61103         for (size_t i = 0; i < node_ids_constr.datalen; i++) {
61104                 uint64_t node_ids_conv_8 = node_ids_vals[i];
61105                 LDKNodeId node_ids_conv_8_conv;
61106                 node_ids_conv_8_conv.inner = untag_ptr(node_ids_conv_8);
61107                 node_ids_conv_8_conv.is_owned = ptr_is_owned(node_ids_conv_8);
61108                 CHECK_INNER_FIELD_ACCESS_OR_NULL(node_ids_conv_8_conv);
61109                 node_ids_conv_8_conv = NodeId_clone(&node_ids_conv_8_conv);
61110                 node_ids_constr.data[i] = node_ids_conv_8_conv;
61111         }
61112         FREE(node_ids);
61113         ProbabilisticScoringFeeParameters_add_banned_from_list(&this_arg_conv, node_ids_constr);
61114 }
61115
61116 void  __attribute__((export_name("TS_ProbabilisticScoringFeeParameters_remove_banned"))) TS_ProbabilisticScoringFeeParameters_remove_banned(uint64_t this_arg, uint64_t node_id) {
61117         LDKProbabilisticScoringFeeParameters this_arg_conv;
61118         this_arg_conv.inner = untag_ptr(this_arg);
61119         this_arg_conv.is_owned = ptr_is_owned(this_arg);
61120         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
61121         this_arg_conv.is_owned = false;
61122         LDKNodeId node_id_conv;
61123         node_id_conv.inner = untag_ptr(node_id);
61124         node_id_conv.is_owned = ptr_is_owned(node_id);
61125         CHECK_INNER_FIELD_ACCESS_OR_NULL(node_id_conv);
61126         node_id_conv.is_owned = false;
61127         ProbabilisticScoringFeeParameters_remove_banned(&this_arg_conv, &node_id_conv);
61128 }
61129
61130 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) {
61131         LDKProbabilisticScoringFeeParameters this_arg_conv;
61132         this_arg_conv.inner = untag_ptr(this_arg);
61133         this_arg_conv.is_owned = ptr_is_owned(this_arg);
61134         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
61135         this_arg_conv.is_owned = false;
61136         LDKNodeId node_id_conv;
61137         node_id_conv.inner = untag_ptr(node_id);
61138         node_id_conv.is_owned = ptr_is_owned(node_id);
61139         CHECK_INNER_FIELD_ACCESS_OR_NULL(node_id_conv);
61140         node_id_conv.is_owned = false;
61141         ProbabilisticScoringFeeParameters_set_manual_penalty(&this_arg_conv, &node_id_conv, penalty);
61142 }
61143
61144 void  __attribute__((export_name("TS_ProbabilisticScoringFeeParameters_remove_manual_penalty"))) TS_ProbabilisticScoringFeeParameters_remove_manual_penalty(uint64_t this_arg, uint64_t node_id) {
61145         LDKProbabilisticScoringFeeParameters this_arg_conv;
61146         this_arg_conv.inner = untag_ptr(this_arg);
61147         this_arg_conv.is_owned = ptr_is_owned(this_arg);
61148         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
61149         this_arg_conv.is_owned = false;
61150         LDKNodeId node_id_conv;
61151         node_id_conv.inner = untag_ptr(node_id);
61152         node_id_conv.is_owned = ptr_is_owned(node_id);
61153         CHECK_INNER_FIELD_ACCESS_OR_NULL(node_id_conv);
61154         node_id_conv.is_owned = false;
61155         ProbabilisticScoringFeeParameters_remove_manual_penalty(&this_arg_conv, &node_id_conv);
61156 }
61157
61158 void  __attribute__((export_name("TS_ProbabilisticScoringFeeParameters_clear_manual_penalties"))) TS_ProbabilisticScoringFeeParameters_clear_manual_penalties(uint64_t this_arg) {
61159         LDKProbabilisticScoringFeeParameters this_arg_conv;
61160         this_arg_conv.inner = untag_ptr(this_arg);
61161         this_arg_conv.is_owned = ptr_is_owned(this_arg);
61162         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
61163         this_arg_conv.is_owned = false;
61164         ProbabilisticScoringFeeParameters_clear_manual_penalties(&this_arg_conv);
61165 }
61166
61167 void  __attribute__((export_name("TS_ProbabilisticScoringDecayParameters_free"))) TS_ProbabilisticScoringDecayParameters_free(uint64_t this_obj) {
61168         LDKProbabilisticScoringDecayParameters this_obj_conv;
61169         this_obj_conv.inner = untag_ptr(this_obj);
61170         this_obj_conv.is_owned = ptr_is_owned(this_obj);
61171         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
61172         ProbabilisticScoringDecayParameters_free(this_obj_conv);
61173 }
61174
61175 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) {
61176         LDKProbabilisticScoringDecayParameters this_ptr_conv;
61177         this_ptr_conv.inner = untag_ptr(this_ptr);
61178         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
61179         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
61180         this_ptr_conv.is_owned = false;
61181         int64_t ret_conv = ProbabilisticScoringDecayParameters_get_historical_no_updates_half_life(&this_ptr_conv);
61182         return ret_conv;
61183 }
61184
61185 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) {
61186         LDKProbabilisticScoringDecayParameters this_ptr_conv;
61187         this_ptr_conv.inner = untag_ptr(this_ptr);
61188         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
61189         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
61190         this_ptr_conv.is_owned = false;
61191         ProbabilisticScoringDecayParameters_set_historical_no_updates_half_life(&this_ptr_conv, val);
61192 }
61193
61194 int64_t  __attribute__((export_name("TS_ProbabilisticScoringDecayParameters_get_liquidity_offset_half_life"))) TS_ProbabilisticScoringDecayParameters_get_liquidity_offset_half_life(uint64_t this_ptr) {
61195         LDKProbabilisticScoringDecayParameters this_ptr_conv;
61196         this_ptr_conv.inner = untag_ptr(this_ptr);
61197         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
61198         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
61199         this_ptr_conv.is_owned = false;
61200         int64_t ret_conv = ProbabilisticScoringDecayParameters_get_liquidity_offset_half_life(&this_ptr_conv);
61201         return ret_conv;
61202 }
61203
61204 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) {
61205         LDKProbabilisticScoringDecayParameters this_ptr_conv;
61206         this_ptr_conv.inner = untag_ptr(this_ptr);
61207         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
61208         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
61209         this_ptr_conv.is_owned = false;
61210         ProbabilisticScoringDecayParameters_set_liquidity_offset_half_life(&this_ptr_conv, val);
61211 }
61212
61213 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) {
61214         LDKProbabilisticScoringDecayParameters ret_var = ProbabilisticScoringDecayParameters_new(historical_no_updates_half_life_arg, liquidity_offset_half_life_arg);
61215         uint64_t ret_ref = 0;
61216         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
61217         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
61218         return ret_ref;
61219 }
61220
61221 static inline uint64_t ProbabilisticScoringDecayParameters_clone_ptr(LDKProbabilisticScoringDecayParameters *NONNULL_PTR arg) {
61222         LDKProbabilisticScoringDecayParameters ret_var = ProbabilisticScoringDecayParameters_clone(arg);
61223         uint64_t ret_ref = 0;
61224         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
61225         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
61226         return ret_ref;
61227 }
61228 int64_t  __attribute__((export_name("TS_ProbabilisticScoringDecayParameters_clone_ptr"))) TS_ProbabilisticScoringDecayParameters_clone_ptr(uint64_t arg) {
61229         LDKProbabilisticScoringDecayParameters arg_conv;
61230         arg_conv.inner = untag_ptr(arg);
61231         arg_conv.is_owned = ptr_is_owned(arg);
61232         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
61233         arg_conv.is_owned = false;
61234         int64_t ret_conv = ProbabilisticScoringDecayParameters_clone_ptr(&arg_conv);
61235         return ret_conv;
61236 }
61237
61238 uint64_t  __attribute__((export_name("TS_ProbabilisticScoringDecayParameters_clone"))) TS_ProbabilisticScoringDecayParameters_clone(uint64_t orig) {
61239         LDKProbabilisticScoringDecayParameters orig_conv;
61240         orig_conv.inner = untag_ptr(orig);
61241         orig_conv.is_owned = ptr_is_owned(orig);
61242         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
61243         orig_conv.is_owned = false;
61244         LDKProbabilisticScoringDecayParameters ret_var = ProbabilisticScoringDecayParameters_clone(&orig_conv);
61245         uint64_t ret_ref = 0;
61246         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
61247         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
61248         return ret_ref;
61249 }
61250
61251 uint64_t  __attribute__((export_name("TS_ProbabilisticScoringDecayParameters_default"))) TS_ProbabilisticScoringDecayParameters_default() {
61252         LDKProbabilisticScoringDecayParameters ret_var = ProbabilisticScoringDecayParameters_default();
61253         uint64_t ret_ref = 0;
61254         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
61255         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
61256         return ret_ref;
61257 }
61258
61259 uint64_t  __attribute__((export_name("TS_ProbabilisticScorer_new"))) TS_ProbabilisticScorer_new(uint64_t decay_params, uint64_t network_graph, uint64_t logger) {
61260         LDKProbabilisticScoringDecayParameters decay_params_conv;
61261         decay_params_conv.inner = untag_ptr(decay_params);
61262         decay_params_conv.is_owned = ptr_is_owned(decay_params);
61263         CHECK_INNER_FIELD_ACCESS_OR_NULL(decay_params_conv);
61264         decay_params_conv = ProbabilisticScoringDecayParameters_clone(&decay_params_conv);
61265         LDKNetworkGraph network_graph_conv;
61266         network_graph_conv.inner = untag_ptr(network_graph);
61267         network_graph_conv.is_owned = ptr_is_owned(network_graph);
61268         CHECK_INNER_FIELD_ACCESS_OR_NULL(network_graph_conv);
61269         network_graph_conv.is_owned = false;
61270         void* logger_ptr = untag_ptr(logger);
61271         CHECK_ACCESS(logger_ptr);
61272         LDKLogger logger_conv = *(LDKLogger*)(logger_ptr);
61273         if (logger_conv.free == LDKLogger_JCalls_free) {
61274                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
61275                 LDKLogger_JCalls_cloned(&logger_conv);
61276         }
61277         LDKProbabilisticScorer ret_var = ProbabilisticScorer_new(decay_params_conv, &network_graph_conv, logger_conv);
61278         uint64_t ret_ref = 0;
61279         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
61280         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
61281         return ret_ref;
61282 }
61283
61284 void  __attribute__((export_name("TS_ProbabilisticScorer_debug_log_liquidity_stats"))) TS_ProbabilisticScorer_debug_log_liquidity_stats(uint64_t this_arg) {
61285         LDKProbabilisticScorer this_arg_conv;
61286         this_arg_conv.inner = untag_ptr(this_arg);
61287         this_arg_conv.is_owned = ptr_is_owned(this_arg);
61288         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
61289         this_arg_conv.is_owned = false;
61290         ProbabilisticScorer_debug_log_liquidity_stats(&this_arg_conv);
61291 }
61292
61293 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) {
61294         LDKProbabilisticScorer this_arg_conv;
61295         this_arg_conv.inner = untag_ptr(this_arg);
61296         this_arg_conv.is_owned = ptr_is_owned(this_arg);
61297         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
61298         this_arg_conv.is_owned = false;
61299         LDKNodeId target_conv;
61300         target_conv.inner = untag_ptr(target);
61301         target_conv.is_owned = ptr_is_owned(target);
61302         CHECK_INNER_FIELD_ACCESS_OR_NULL(target_conv);
61303         target_conv.is_owned = false;
61304         LDKCOption_C2Tuple_u64u64ZZ *ret_copy = MALLOC(sizeof(LDKCOption_C2Tuple_u64u64ZZ), "LDKCOption_C2Tuple_u64u64ZZ");
61305         *ret_copy = ProbabilisticScorer_estimated_channel_liquidity_range(&this_arg_conv, scid, &target_conv);
61306         uint64_t ret_ref = tag_ptr(ret_copy, true);
61307         return ret_ref;
61308 }
61309
61310 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) {
61311         LDKProbabilisticScorer this_arg_conv;
61312         this_arg_conv.inner = untag_ptr(this_arg);
61313         this_arg_conv.is_owned = ptr_is_owned(this_arg);
61314         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
61315         this_arg_conv.is_owned = false;
61316         LDKNodeId target_conv;
61317         target_conv.inner = untag_ptr(target);
61318         target_conv.is_owned = ptr_is_owned(target);
61319         CHECK_INNER_FIELD_ACCESS_OR_NULL(target_conv);
61320         target_conv.is_owned = false;
61321         LDKCOption_C2Tuple_ThirtyTwoU16sThirtyTwoU16sZZ *ret_copy = MALLOC(sizeof(LDKCOption_C2Tuple_ThirtyTwoU16sThirtyTwoU16sZZ), "LDKCOption_C2Tuple_ThirtyTwoU16sThirtyTwoU16sZZ");
61322         *ret_copy = ProbabilisticScorer_historical_estimated_channel_liquidity_probabilities(&this_arg_conv, scid, &target_conv);
61323         uint64_t ret_ref = tag_ptr(ret_copy, true);
61324         return ret_ref;
61325 }
61326
61327 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) {
61328         LDKProbabilisticScorer this_arg_conv;
61329         this_arg_conv.inner = untag_ptr(this_arg);
61330         this_arg_conv.is_owned = ptr_is_owned(this_arg);
61331         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
61332         this_arg_conv.is_owned = false;
61333         LDKNodeId target_conv;
61334         target_conv.inner = untag_ptr(target);
61335         target_conv.is_owned = ptr_is_owned(target);
61336         CHECK_INNER_FIELD_ACCESS_OR_NULL(target_conv);
61337         target_conv.is_owned = false;
61338         LDKProbabilisticScoringFeeParameters params_conv;
61339         params_conv.inner = untag_ptr(params);
61340         params_conv.is_owned = ptr_is_owned(params);
61341         CHECK_INNER_FIELD_ACCESS_OR_NULL(params_conv);
61342         params_conv.is_owned = false;
61343         LDKCOption_f64Z *ret_copy = MALLOC(sizeof(LDKCOption_f64Z), "LDKCOption_f64Z");
61344         *ret_copy = ProbabilisticScorer_historical_estimated_payment_success_probability(&this_arg_conv, scid, &target_conv, amount_msat, &params_conv);
61345         uint64_t ret_ref = tag_ptr(ret_copy, true);
61346         return ret_ref;
61347 }
61348
61349 uint64_t  __attribute__((export_name("TS_ProbabilisticScorer_as_ScoreLookUp"))) TS_ProbabilisticScorer_as_ScoreLookUp(uint64_t this_arg) {
61350         LDKProbabilisticScorer this_arg_conv;
61351         this_arg_conv.inner = untag_ptr(this_arg);
61352         this_arg_conv.is_owned = ptr_is_owned(this_arg);
61353         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
61354         this_arg_conv.is_owned = false;
61355         LDKScoreLookUp* ret_ret = MALLOC(sizeof(LDKScoreLookUp), "LDKScoreLookUp");
61356         *ret_ret = ProbabilisticScorer_as_ScoreLookUp(&this_arg_conv);
61357         return tag_ptr(ret_ret, true);
61358 }
61359
61360 uint64_t  __attribute__((export_name("TS_ProbabilisticScorer_as_ScoreUpdate"))) TS_ProbabilisticScorer_as_ScoreUpdate(uint64_t this_arg) {
61361         LDKProbabilisticScorer this_arg_conv;
61362         this_arg_conv.inner = untag_ptr(this_arg);
61363         this_arg_conv.is_owned = ptr_is_owned(this_arg);
61364         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
61365         this_arg_conv.is_owned = false;
61366         LDKScoreUpdate* ret_ret = MALLOC(sizeof(LDKScoreUpdate), "LDKScoreUpdate");
61367         *ret_ret = ProbabilisticScorer_as_ScoreUpdate(&this_arg_conv);
61368         return tag_ptr(ret_ret, true);
61369 }
61370
61371 uint64_t  __attribute__((export_name("TS_ProbabilisticScorer_as_Score"))) TS_ProbabilisticScorer_as_Score(uint64_t this_arg) {
61372         LDKProbabilisticScorer this_arg_conv;
61373         this_arg_conv.inner = untag_ptr(this_arg);
61374         this_arg_conv.is_owned = ptr_is_owned(this_arg);
61375         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
61376         this_arg_conv.is_owned = false;
61377         LDKScore* ret_ret = MALLOC(sizeof(LDKScore), "LDKScore");
61378         *ret_ret = ProbabilisticScorer_as_Score(&this_arg_conv);
61379         return tag_ptr(ret_ret, true);
61380 }
61381
61382 int8_tArray  __attribute__((export_name("TS_ProbabilisticScorer_write"))) TS_ProbabilisticScorer_write(uint64_t obj) {
61383         LDKProbabilisticScorer obj_conv;
61384         obj_conv.inner = untag_ptr(obj);
61385         obj_conv.is_owned = ptr_is_owned(obj);
61386         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
61387         obj_conv.is_owned = false;
61388         LDKCVec_u8Z ret_var = ProbabilisticScorer_write(&obj_conv);
61389         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
61390         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
61391         CVec_u8Z_free(ret_var);
61392         return ret_arr;
61393 }
61394
61395 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) {
61396         LDKu8slice ser_ref;
61397         ser_ref.datalen = ser->arr_len;
61398         ser_ref.data = ser->elems;
61399         LDKProbabilisticScoringDecayParameters arg_a_conv;
61400         arg_a_conv.inner = untag_ptr(arg_a);
61401         arg_a_conv.is_owned = ptr_is_owned(arg_a);
61402         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_a_conv);
61403         arg_a_conv = ProbabilisticScoringDecayParameters_clone(&arg_a_conv);
61404         LDKNetworkGraph arg_b_conv;
61405         arg_b_conv.inner = untag_ptr(arg_b);
61406         arg_b_conv.is_owned = ptr_is_owned(arg_b);
61407         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_b_conv);
61408         arg_b_conv.is_owned = false;
61409         void* arg_c_ptr = untag_ptr(arg_c);
61410         CHECK_ACCESS(arg_c_ptr);
61411         LDKLogger arg_c_conv = *(LDKLogger*)(arg_c_ptr);
61412         if (arg_c_conv.free == LDKLogger_JCalls_free) {
61413                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
61414                 LDKLogger_JCalls_cloned(&arg_c_conv);
61415         }
61416         LDKCResult_ProbabilisticScorerDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ProbabilisticScorerDecodeErrorZ), "LDKCResult_ProbabilisticScorerDecodeErrorZ");
61417         *ret_conv = ProbabilisticScorer_read(ser_ref, arg_a_conv, &arg_b_conv, arg_c_conv);
61418         FREE(ser);
61419         return tag_ptr(ret_conv, true);
61420 }
61421
61422 void  __attribute__((export_name("TS_DelayedPaymentOutputDescriptor_free"))) TS_DelayedPaymentOutputDescriptor_free(uint64_t this_obj) {
61423         LDKDelayedPaymentOutputDescriptor this_obj_conv;
61424         this_obj_conv.inner = untag_ptr(this_obj);
61425         this_obj_conv.is_owned = ptr_is_owned(this_obj);
61426         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
61427         DelayedPaymentOutputDescriptor_free(this_obj_conv);
61428 }
61429
61430 uint64_t  __attribute__((export_name("TS_DelayedPaymentOutputDescriptor_get_outpoint"))) TS_DelayedPaymentOutputDescriptor_get_outpoint(uint64_t this_ptr) {
61431         LDKDelayedPaymentOutputDescriptor this_ptr_conv;
61432         this_ptr_conv.inner = untag_ptr(this_ptr);
61433         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
61434         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
61435         this_ptr_conv.is_owned = false;
61436         LDKOutPoint ret_var = DelayedPaymentOutputDescriptor_get_outpoint(&this_ptr_conv);
61437         uint64_t ret_ref = 0;
61438         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
61439         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
61440         return ret_ref;
61441 }
61442
61443 void  __attribute__((export_name("TS_DelayedPaymentOutputDescriptor_set_outpoint"))) TS_DelayedPaymentOutputDescriptor_set_outpoint(uint64_t this_ptr, uint64_t val) {
61444         LDKDelayedPaymentOutputDescriptor this_ptr_conv;
61445         this_ptr_conv.inner = untag_ptr(this_ptr);
61446         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
61447         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
61448         this_ptr_conv.is_owned = false;
61449         LDKOutPoint val_conv;
61450         val_conv.inner = untag_ptr(val);
61451         val_conv.is_owned = ptr_is_owned(val);
61452         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
61453         val_conv = OutPoint_clone(&val_conv);
61454         DelayedPaymentOutputDescriptor_set_outpoint(&this_ptr_conv, val_conv);
61455 }
61456
61457 int8_tArray  __attribute__((export_name("TS_DelayedPaymentOutputDescriptor_get_per_commitment_point"))) TS_DelayedPaymentOutputDescriptor_get_per_commitment_point(uint64_t this_ptr) {
61458         LDKDelayedPaymentOutputDescriptor this_ptr_conv;
61459         this_ptr_conv.inner = untag_ptr(this_ptr);
61460         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
61461         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
61462         this_ptr_conv.is_owned = false;
61463         int8_tArray ret_arr = init_int8_tArray(33, __LINE__);
61464         memcpy(ret_arr->elems, DelayedPaymentOutputDescriptor_get_per_commitment_point(&this_ptr_conv).compressed_form, 33);
61465         return ret_arr;
61466 }
61467
61468 void  __attribute__((export_name("TS_DelayedPaymentOutputDescriptor_set_per_commitment_point"))) TS_DelayedPaymentOutputDescriptor_set_per_commitment_point(uint64_t this_ptr, int8_tArray val) {
61469         LDKDelayedPaymentOutputDescriptor this_ptr_conv;
61470         this_ptr_conv.inner = untag_ptr(this_ptr);
61471         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
61472         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
61473         this_ptr_conv.is_owned = false;
61474         LDKPublicKey val_ref;
61475         CHECK(val->arr_len == 33);
61476         memcpy(val_ref.compressed_form, val->elems, 33); FREE(val);
61477         DelayedPaymentOutputDescriptor_set_per_commitment_point(&this_ptr_conv, val_ref);
61478 }
61479
61480 int16_t  __attribute__((export_name("TS_DelayedPaymentOutputDescriptor_get_to_self_delay"))) TS_DelayedPaymentOutputDescriptor_get_to_self_delay(uint64_t this_ptr) {
61481         LDKDelayedPaymentOutputDescriptor this_ptr_conv;
61482         this_ptr_conv.inner = untag_ptr(this_ptr);
61483         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
61484         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
61485         this_ptr_conv.is_owned = false;
61486         int16_t ret_conv = DelayedPaymentOutputDescriptor_get_to_self_delay(&this_ptr_conv);
61487         return ret_conv;
61488 }
61489
61490 void  __attribute__((export_name("TS_DelayedPaymentOutputDescriptor_set_to_self_delay"))) TS_DelayedPaymentOutputDescriptor_set_to_self_delay(uint64_t this_ptr, int16_t val) {
61491         LDKDelayedPaymentOutputDescriptor this_ptr_conv;
61492         this_ptr_conv.inner = untag_ptr(this_ptr);
61493         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
61494         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
61495         this_ptr_conv.is_owned = false;
61496         DelayedPaymentOutputDescriptor_set_to_self_delay(&this_ptr_conv, val);
61497 }
61498
61499 uint64_t  __attribute__((export_name("TS_DelayedPaymentOutputDescriptor_get_output"))) TS_DelayedPaymentOutputDescriptor_get_output(uint64_t this_ptr) {
61500         LDKDelayedPaymentOutputDescriptor this_ptr_conv;
61501         this_ptr_conv.inner = untag_ptr(this_ptr);
61502         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
61503         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
61504         this_ptr_conv.is_owned = false;
61505         LDKTxOut* ret_ref = MALLOC(sizeof(LDKTxOut), "LDKTxOut");
61506         *ret_ref = DelayedPaymentOutputDescriptor_get_output(&this_ptr_conv);
61507         return tag_ptr(ret_ref, true);
61508 }
61509
61510 void  __attribute__((export_name("TS_DelayedPaymentOutputDescriptor_set_output"))) TS_DelayedPaymentOutputDescriptor_set_output(uint64_t this_ptr, uint64_t val) {
61511         LDKDelayedPaymentOutputDescriptor this_ptr_conv;
61512         this_ptr_conv.inner = untag_ptr(this_ptr);
61513         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
61514         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
61515         this_ptr_conv.is_owned = false;
61516         void* val_ptr = untag_ptr(val);
61517         CHECK_ACCESS(val_ptr);
61518         LDKTxOut val_conv = *(LDKTxOut*)(val_ptr);
61519         val_conv = TxOut_clone((LDKTxOut*)untag_ptr(val));
61520         DelayedPaymentOutputDescriptor_set_output(&this_ptr_conv, val_conv);
61521 }
61522
61523 int8_tArray  __attribute__((export_name("TS_DelayedPaymentOutputDescriptor_get_revocation_pubkey"))) TS_DelayedPaymentOutputDescriptor_get_revocation_pubkey(uint64_t this_ptr) {
61524         LDKDelayedPaymentOutputDescriptor this_ptr_conv;
61525         this_ptr_conv.inner = untag_ptr(this_ptr);
61526         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
61527         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
61528         this_ptr_conv.is_owned = false;
61529         int8_tArray ret_arr = init_int8_tArray(33, __LINE__);
61530         memcpy(ret_arr->elems, DelayedPaymentOutputDescriptor_get_revocation_pubkey(&this_ptr_conv).compressed_form, 33);
61531         return ret_arr;
61532 }
61533
61534 void  __attribute__((export_name("TS_DelayedPaymentOutputDescriptor_set_revocation_pubkey"))) TS_DelayedPaymentOutputDescriptor_set_revocation_pubkey(uint64_t this_ptr, int8_tArray val) {
61535         LDKDelayedPaymentOutputDescriptor this_ptr_conv;
61536         this_ptr_conv.inner = untag_ptr(this_ptr);
61537         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
61538         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
61539         this_ptr_conv.is_owned = false;
61540         LDKPublicKey val_ref;
61541         CHECK(val->arr_len == 33);
61542         memcpy(val_ref.compressed_form, val->elems, 33); FREE(val);
61543         DelayedPaymentOutputDescriptor_set_revocation_pubkey(&this_ptr_conv, val_ref);
61544 }
61545
61546 int8_tArray  __attribute__((export_name("TS_DelayedPaymentOutputDescriptor_get_channel_keys_id"))) TS_DelayedPaymentOutputDescriptor_get_channel_keys_id(uint64_t this_ptr) {
61547         LDKDelayedPaymentOutputDescriptor this_ptr_conv;
61548         this_ptr_conv.inner = untag_ptr(this_ptr);
61549         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
61550         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
61551         this_ptr_conv.is_owned = false;
61552         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
61553         memcpy(ret_arr->elems, *DelayedPaymentOutputDescriptor_get_channel_keys_id(&this_ptr_conv), 32);
61554         return ret_arr;
61555 }
61556
61557 void  __attribute__((export_name("TS_DelayedPaymentOutputDescriptor_set_channel_keys_id"))) TS_DelayedPaymentOutputDescriptor_set_channel_keys_id(uint64_t this_ptr, int8_tArray val) {
61558         LDKDelayedPaymentOutputDescriptor this_ptr_conv;
61559         this_ptr_conv.inner = untag_ptr(this_ptr);
61560         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
61561         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
61562         this_ptr_conv.is_owned = false;
61563         LDKThirtyTwoBytes val_ref;
61564         CHECK(val->arr_len == 32);
61565         memcpy(val_ref.data, val->elems, 32); FREE(val);
61566         DelayedPaymentOutputDescriptor_set_channel_keys_id(&this_ptr_conv, val_ref);
61567 }
61568
61569 int64_t  __attribute__((export_name("TS_DelayedPaymentOutputDescriptor_get_channel_value_satoshis"))) TS_DelayedPaymentOutputDescriptor_get_channel_value_satoshis(uint64_t this_ptr) {
61570         LDKDelayedPaymentOutputDescriptor this_ptr_conv;
61571         this_ptr_conv.inner = untag_ptr(this_ptr);
61572         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
61573         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
61574         this_ptr_conv.is_owned = false;
61575         int64_t ret_conv = DelayedPaymentOutputDescriptor_get_channel_value_satoshis(&this_ptr_conv);
61576         return ret_conv;
61577 }
61578
61579 void  __attribute__((export_name("TS_DelayedPaymentOutputDescriptor_set_channel_value_satoshis"))) TS_DelayedPaymentOutputDescriptor_set_channel_value_satoshis(uint64_t this_ptr, int64_t val) {
61580         LDKDelayedPaymentOutputDescriptor this_ptr_conv;
61581         this_ptr_conv.inner = untag_ptr(this_ptr);
61582         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
61583         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
61584         this_ptr_conv.is_owned = false;
61585         DelayedPaymentOutputDescriptor_set_channel_value_satoshis(&this_ptr_conv, val);
61586 }
61587
61588 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) {
61589         LDKOutPoint outpoint_arg_conv;
61590         outpoint_arg_conv.inner = untag_ptr(outpoint_arg);
61591         outpoint_arg_conv.is_owned = ptr_is_owned(outpoint_arg);
61592         CHECK_INNER_FIELD_ACCESS_OR_NULL(outpoint_arg_conv);
61593         outpoint_arg_conv = OutPoint_clone(&outpoint_arg_conv);
61594         LDKPublicKey per_commitment_point_arg_ref;
61595         CHECK(per_commitment_point_arg->arr_len == 33);
61596         memcpy(per_commitment_point_arg_ref.compressed_form, per_commitment_point_arg->elems, 33); FREE(per_commitment_point_arg);
61597         void* output_arg_ptr = untag_ptr(output_arg);
61598         CHECK_ACCESS(output_arg_ptr);
61599         LDKTxOut output_arg_conv = *(LDKTxOut*)(output_arg_ptr);
61600         output_arg_conv = TxOut_clone((LDKTxOut*)untag_ptr(output_arg));
61601         LDKPublicKey revocation_pubkey_arg_ref;
61602         CHECK(revocation_pubkey_arg->arr_len == 33);
61603         memcpy(revocation_pubkey_arg_ref.compressed_form, revocation_pubkey_arg->elems, 33); FREE(revocation_pubkey_arg);
61604         LDKThirtyTwoBytes channel_keys_id_arg_ref;
61605         CHECK(channel_keys_id_arg->arr_len == 32);
61606         memcpy(channel_keys_id_arg_ref.data, channel_keys_id_arg->elems, 32); FREE(channel_keys_id_arg);
61607         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);
61608         uint64_t ret_ref = 0;
61609         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
61610         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
61611         return ret_ref;
61612 }
61613
61614 static inline uint64_t DelayedPaymentOutputDescriptor_clone_ptr(LDKDelayedPaymentOutputDescriptor *NONNULL_PTR arg) {
61615         LDKDelayedPaymentOutputDescriptor ret_var = DelayedPaymentOutputDescriptor_clone(arg);
61616         uint64_t ret_ref = 0;
61617         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
61618         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
61619         return ret_ref;
61620 }
61621 int64_t  __attribute__((export_name("TS_DelayedPaymentOutputDescriptor_clone_ptr"))) TS_DelayedPaymentOutputDescriptor_clone_ptr(uint64_t arg) {
61622         LDKDelayedPaymentOutputDescriptor arg_conv;
61623         arg_conv.inner = untag_ptr(arg);
61624         arg_conv.is_owned = ptr_is_owned(arg);
61625         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
61626         arg_conv.is_owned = false;
61627         int64_t ret_conv = DelayedPaymentOutputDescriptor_clone_ptr(&arg_conv);
61628         return ret_conv;
61629 }
61630
61631 uint64_t  __attribute__((export_name("TS_DelayedPaymentOutputDescriptor_clone"))) TS_DelayedPaymentOutputDescriptor_clone(uint64_t orig) {
61632         LDKDelayedPaymentOutputDescriptor orig_conv;
61633         orig_conv.inner = untag_ptr(orig);
61634         orig_conv.is_owned = ptr_is_owned(orig);
61635         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
61636         orig_conv.is_owned = false;
61637         LDKDelayedPaymentOutputDescriptor ret_var = DelayedPaymentOutputDescriptor_clone(&orig_conv);
61638         uint64_t ret_ref = 0;
61639         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
61640         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
61641         return ret_ref;
61642 }
61643
61644 int64_t  __attribute__((export_name("TS_DelayedPaymentOutputDescriptor_hash"))) TS_DelayedPaymentOutputDescriptor_hash(uint64_t o) {
61645         LDKDelayedPaymentOutputDescriptor o_conv;
61646         o_conv.inner = untag_ptr(o);
61647         o_conv.is_owned = ptr_is_owned(o);
61648         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
61649         o_conv.is_owned = false;
61650         int64_t ret_conv = DelayedPaymentOutputDescriptor_hash(&o_conv);
61651         return ret_conv;
61652 }
61653
61654 jboolean  __attribute__((export_name("TS_DelayedPaymentOutputDescriptor_eq"))) TS_DelayedPaymentOutputDescriptor_eq(uint64_t a, uint64_t b) {
61655         LDKDelayedPaymentOutputDescriptor a_conv;
61656         a_conv.inner = untag_ptr(a);
61657         a_conv.is_owned = ptr_is_owned(a);
61658         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
61659         a_conv.is_owned = false;
61660         LDKDelayedPaymentOutputDescriptor b_conv;
61661         b_conv.inner = untag_ptr(b);
61662         b_conv.is_owned = ptr_is_owned(b);
61663         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
61664         b_conv.is_owned = false;
61665         jboolean ret_conv = DelayedPaymentOutputDescriptor_eq(&a_conv, &b_conv);
61666         return ret_conv;
61667 }
61668
61669 int8_tArray  __attribute__((export_name("TS_DelayedPaymentOutputDescriptor_write"))) TS_DelayedPaymentOutputDescriptor_write(uint64_t obj) {
61670         LDKDelayedPaymentOutputDescriptor obj_conv;
61671         obj_conv.inner = untag_ptr(obj);
61672         obj_conv.is_owned = ptr_is_owned(obj);
61673         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
61674         obj_conv.is_owned = false;
61675         LDKCVec_u8Z ret_var = DelayedPaymentOutputDescriptor_write(&obj_conv);
61676         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
61677         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
61678         CVec_u8Z_free(ret_var);
61679         return ret_arr;
61680 }
61681
61682 uint64_t  __attribute__((export_name("TS_DelayedPaymentOutputDescriptor_read"))) TS_DelayedPaymentOutputDescriptor_read(int8_tArray ser) {
61683         LDKu8slice ser_ref;
61684         ser_ref.datalen = ser->arr_len;
61685         ser_ref.data = ser->elems;
61686         LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ), "LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ");
61687         *ret_conv = DelayedPaymentOutputDescriptor_read(ser_ref);
61688         FREE(ser);
61689         return tag_ptr(ret_conv, true);
61690 }
61691
61692 void  __attribute__((export_name("TS_StaticPaymentOutputDescriptor_free"))) TS_StaticPaymentOutputDescriptor_free(uint64_t this_obj) {
61693         LDKStaticPaymentOutputDescriptor this_obj_conv;
61694         this_obj_conv.inner = untag_ptr(this_obj);
61695         this_obj_conv.is_owned = ptr_is_owned(this_obj);
61696         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
61697         StaticPaymentOutputDescriptor_free(this_obj_conv);
61698 }
61699
61700 uint64_t  __attribute__((export_name("TS_StaticPaymentOutputDescriptor_get_outpoint"))) TS_StaticPaymentOutputDescriptor_get_outpoint(uint64_t this_ptr) {
61701         LDKStaticPaymentOutputDescriptor this_ptr_conv;
61702         this_ptr_conv.inner = untag_ptr(this_ptr);
61703         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
61704         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
61705         this_ptr_conv.is_owned = false;
61706         LDKOutPoint ret_var = StaticPaymentOutputDescriptor_get_outpoint(&this_ptr_conv);
61707         uint64_t ret_ref = 0;
61708         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
61709         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
61710         return ret_ref;
61711 }
61712
61713 void  __attribute__((export_name("TS_StaticPaymentOutputDescriptor_set_outpoint"))) TS_StaticPaymentOutputDescriptor_set_outpoint(uint64_t this_ptr, uint64_t val) {
61714         LDKStaticPaymentOutputDescriptor this_ptr_conv;
61715         this_ptr_conv.inner = untag_ptr(this_ptr);
61716         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
61717         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
61718         this_ptr_conv.is_owned = false;
61719         LDKOutPoint val_conv;
61720         val_conv.inner = untag_ptr(val);
61721         val_conv.is_owned = ptr_is_owned(val);
61722         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
61723         val_conv = OutPoint_clone(&val_conv);
61724         StaticPaymentOutputDescriptor_set_outpoint(&this_ptr_conv, val_conv);
61725 }
61726
61727 uint64_t  __attribute__((export_name("TS_StaticPaymentOutputDescriptor_get_output"))) TS_StaticPaymentOutputDescriptor_get_output(uint64_t this_ptr) {
61728         LDKStaticPaymentOutputDescriptor this_ptr_conv;
61729         this_ptr_conv.inner = untag_ptr(this_ptr);
61730         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
61731         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
61732         this_ptr_conv.is_owned = false;
61733         LDKTxOut* ret_ref = MALLOC(sizeof(LDKTxOut), "LDKTxOut");
61734         *ret_ref = StaticPaymentOutputDescriptor_get_output(&this_ptr_conv);
61735         return tag_ptr(ret_ref, true);
61736 }
61737
61738 void  __attribute__((export_name("TS_StaticPaymentOutputDescriptor_set_output"))) TS_StaticPaymentOutputDescriptor_set_output(uint64_t this_ptr, uint64_t val) {
61739         LDKStaticPaymentOutputDescriptor this_ptr_conv;
61740         this_ptr_conv.inner = untag_ptr(this_ptr);
61741         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
61742         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
61743         this_ptr_conv.is_owned = false;
61744         void* val_ptr = untag_ptr(val);
61745         CHECK_ACCESS(val_ptr);
61746         LDKTxOut val_conv = *(LDKTxOut*)(val_ptr);
61747         val_conv = TxOut_clone((LDKTxOut*)untag_ptr(val));
61748         StaticPaymentOutputDescriptor_set_output(&this_ptr_conv, val_conv);
61749 }
61750
61751 int8_tArray  __attribute__((export_name("TS_StaticPaymentOutputDescriptor_get_channel_keys_id"))) TS_StaticPaymentOutputDescriptor_get_channel_keys_id(uint64_t this_ptr) {
61752         LDKStaticPaymentOutputDescriptor this_ptr_conv;
61753         this_ptr_conv.inner = untag_ptr(this_ptr);
61754         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
61755         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
61756         this_ptr_conv.is_owned = false;
61757         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
61758         memcpy(ret_arr->elems, *StaticPaymentOutputDescriptor_get_channel_keys_id(&this_ptr_conv), 32);
61759         return ret_arr;
61760 }
61761
61762 void  __attribute__((export_name("TS_StaticPaymentOutputDescriptor_set_channel_keys_id"))) TS_StaticPaymentOutputDescriptor_set_channel_keys_id(uint64_t this_ptr, int8_tArray val) {
61763         LDKStaticPaymentOutputDescriptor this_ptr_conv;
61764         this_ptr_conv.inner = untag_ptr(this_ptr);
61765         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
61766         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
61767         this_ptr_conv.is_owned = false;
61768         LDKThirtyTwoBytes val_ref;
61769         CHECK(val->arr_len == 32);
61770         memcpy(val_ref.data, val->elems, 32); FREE(val);
61771         StaticPaymentOutputDescriptor_set_channel_keys_id(&this_ptr_conv, val_ref);
61772 }
61773
61774 int64_t  __attribute__((export_name("TS_StaticPaymentOutputDescriptor_get_channel_value_satoshis"))) TS_StaticPaymentOutputDescriptor_get_channel_value_satoshis(uint64_t this_ptr) {
61775         LDKStaticPaymentOutputDescriptor this_ptr_conv;
61776         this_ptr_conv.inner = untag_ptr(this_ptr);
61777         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
61778         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
61779         this_ptr_conv.is_owned = false;
61780         int64_t ret_conv = StaticPaymentOutputDescriptor_get_channel_value_satoshis(&this_ptr_conv);
61781         return ret_conv;
61782 }
61783
61784 void  __attribute__((export_name("TS_StaticPaymentOutputDescriptor_set_channel_value_satoshis"))) TS_StaticPaymentOutputDescriptor_set_channel_value_satoshis(uint64_t this_ptr, int64_t val) {
61785         LDKStaticPaymentOutputDescriptor this_ptr_conv;
61786         this_ptr_conv.inner = untag_ptr(this_ptr);
61787         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
61788         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
61789         this_ptr_conv.is_owned = false;
61790         StaticPaymentOutputDescriptor_set_channel_value_satoshis(&this_ptr_conv, val);
61791 }
61792
61793 uint64_t  __attribute__((export_name("TS_StaticPaymentOutputDescriptor_get_channel_transaction_parameters"))) TS_StaticPaymentOutputDescriptor_get_channel_transaction_parameters(uint64_t this_ptr) {
61794         LDKStaticPaymentOutputDescriptor this_ptr_conv;
61795         this_ptr_conv.inner = untag_ptr(this_ptr);
61796         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
61797         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
61798         this_ptr_conv.is_owned = false;
61799         LDKChannelTransactionParameters ret_var = StaticPaymentOutputDescriptor_get_channel_transaction_parameters(&this_ptr_conv);
61800         uint64_t ret_ref = 0;
61801         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
61802         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
61803         return ret_ref;
61804 }
61805
61806 void  __attribute__((export_name("TS_StaticPaymentOutputDescriptor_set_channel_transaction_parameters"))) TS_StaticPaymentOutputDescriptor_set_channel_transaction_parameters(uint64_t this_ptr, uint64_t val) {
61807         LDKStaticPaymentOutputDescriptor this_ptr_conv;
61808         this_ptr_conv.inner = untag_ptr(this_ptr);
61809         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
61810         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
61811         this_ptr_conv.is_owned = false;
61812         LDKChannelTransactionParameters val_conv;
61813         val_conv.inner = untag_ptr(val);
61814         val_conv.is_owned = ptr_is_owned(val);
61815         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
61816         val_conv = ChannelTransactionParameters_clone(&val_conv);
61817         StaticPaymentOutputDescriptor_set_channel_transaction_parameters(&this_ptr_conv, val_conv);
61818 }
61819
61820 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) {
61821         LDKOutPoint outpoint_arg_conv;
61822         outpoint_arg_conv.inner = untag_ptr(outpoint_arg);
61823         outpoint_arg_conv.is_owned = ptr_is_owned(outpoint_arg);
61824         CHECK_INNER_FIELD_ACCESS_OR_NULL(outpoint_arg_conv);
61825         outpoint_arg_conv = OutPoint_clone(&outpoint_arg_conv);
61826         void* output_arg_ptr = untag_ptr(output_arg);
61827         CHECK_ACCESS(output_arg_ptr);
61828         LDKTxOut output_arg_conv = *(LDKTxOut*)(output_arg_ptr);
61829         output_arg_conv = TxOut_clone((LDKTxOut*)untag_ptr(output_arg));
61830         LDKThirtyTwoBytes channel_keys_id_arg_ref;
61831         CHECK(channel_keys_id_arg->arr_len == 32);
61832         memcpy(channel_keys_id_arg_ref.data, channel_keys_id_arg->elems, 32); FREE(channel_keys_id_arg);
61833         LDKChannelTransactionParameters channel_transaction_parameters_arg_conv;
61834         channel_transaction_parameters_arg_conv.inner = untag_ptr(channel_transaction_parameters_arg);
61835         channel_transaction_parameters_arg_conv.is_owned = ptr_is_owned(channel_transaction_parameters_arg);
61836         CHECK_INNER_FIELD_ACCESS_OR_NULL(channel_transaction_parameters_arg_conv);
61837         channel_transaction_parameters_arg_conv = ChannelTransactionParameters_clone(&channel_transaction_parameters_arg_conv);
61838         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);
61839         uint64_t ret_ref = 0;
61840         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
61841         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
61842         return ret_ref;
61843 }
61844
61845 static inline uint64_t StaticPaymentOutputDescriptor_clone_ptr(LDKStaticPaymentOutputDescriptor *NONNULL_PTR arg) {
61846         LDKStaticPaymentOutputDescriptor ret_var = StaticPaymentOutputDescriptor_clone(arg);
61847         uint64_t ret_ref = 0;
61848         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
61849         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
61850         return ret_ref;
61851 }
61852 int64_t  __attribute__((export_name("TS_StaticPaymentOutputDescriptor_clone_ptr"))) TS_StaticPaymentOutputDescriptor_clone_ptr(uint64_t arg) {
61853         LDKStaticPaymentOutputDescriptor arg_conv;
61854         arg_conv.inner = untag_ptr(arg);
61855         arg_conv.is_owned = ptr_is_owned(arg);
61856         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
61857         arg_conv.is_owned = false;
61858         int64_t ret_conv = StaticPaymentOutputDescriptor_clone_ptr(&arg_conv);
61859         return ret_conv;
61860 }
61861
61862 uint64_t  __attribute__((export_name("TS_StaticPaymentOutputDescriptor_clone"))) TS_StaticPaymentOutputDescriptor_clone(uint64_t orig) {
61863         LDKStaticPaymentOutputDescriptor orig_conv;
61864         orig_conv.inner = untag_ptr(orig);
61865         orig_conv.is_owned = ptr_is_owned(orig);
61866         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
61867         orig_conv.is_owned = false;
61868         LDKStaticPaymentOutputDescriptor ret_var = StaticPaymentOutputDescriptor_clone(&orig_conv);
61869         uint64_t ret_ref = 0;
61870         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
61871         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
61872         return ret_ref;
61873 }
61874
61875 int64_t  __attribute__((export_name("TS_StaticPaymentOutputDescriptor_hash"))) TS_StaticPaymentOutputDescriptor_hash(uint64_t o) {
61876         LDKStaticPaymentOutputDescriptor o_conv;
61877         o_conv.inner = untag_ptr(o);
61878         o_conv.is_owned = ptr_is_owned(o);
61879         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
61880         o_conv.is_owned = false;
61881         int64_t ret_conv = StaticPaymentOutputDescriptor_hash(&o_conv);
61882         return ret_conv;
61883 }
61884
61885 jboolean  __attribute__((export_name("TS_StaticPaymentOutputDescriptor_eq"))) TS_StaticPaymentOutputDescriptor_eq(uint64_t a, uint64_t b) {
61886         LDKStaticPaymentOutputDescriptor a_conv;
61887         a_conv.inner = untag_ptr(a);
61888         a_conv.is_owned = ptr_is_owned(a);
61889         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
61890         a_conv.is_owned = false;
61891         LDKStaticPaymentOutputDescriptor b_conv;
61892         b_conv.inner = untag_ptr(b);
61893         b_conv.is_owned = ptr_is_owned(b);
61894         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
61895         b_conv.is_owned = false;
61896         jboolean ret_conv = StaticPaymentOutputDescriptor_eq(&a_conv, &b_conv);
61897         return ret_conv;
61898 }
61899
61900 uint64_t  __attribute__((export_name("TS_StaticPaymentOutputDescriptor_witness_script"))) TS_StaticPaymentOutputDescriptor_witness_script(uint64_t this_arg) {
61901         LDKStaticPaymentOutputDescriptor this_arg_conv;
61902         this_arg_conv.inner = untag_ptr(this_arg);
61903         this_arg_conv.is_owned = ptr_is_owned(this_arg);
61904         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
61905         this_arg_conv.is_owned = false;
61906         LDKCOption_CVec_u8ZZ *ret_copy = MALLOC(sizeof(LDKCOption_CVec_u8ZZ), "LDKCOption_CVec_u8ZZ");
61907         *ret_copy = StaticPaymentOutputDescriptor_witness_script(&this_arg_conv);
61908         uint64_t ret_ref = tag_ptr(ret_copy, true);
61909         return ret_ref;
61910 }
61911
61912 uint32_t  __attribute__((export_name("TS_StaticPaymentOutputDescriptor_max_witness_length"))) TS_StaticPaymentOutputDescriptor_max_witness_length(uint64_t this_arg) {
61913         LDKStaticPaymentOutputDescriptor this_arg_conv;
61914         this_arg_conv.inner = untag_ptr(this_arg);
61915         this_arg_conv.is_owned = ptr_is_owned(this_arg);
61916         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
61917         this_arg_conv.is_owned = false;
61918         uint32_t ret_conv = StaticPaymentOutputDescriptor_max_witness_length(&this_arg_conv);
61919         return ret_conv;
61920 }
61921
61922 int8_tArray  __attribute__((export_name("TS_StaticPaymentOutputDescriptor_write"))) TS_StaticPaymentOutputDescriptor_write(uint64_t obj) {
61923         LDKStaticPaymentOutputDescriptor obj_conv;
61924         obj_conv.inner = untag_ptr(obj);
61925         obj_conv.is_owned = ptr_is_owned(obj);
61926         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
61927         obj_conv.is_owned = false;
61928         LDKCVec_u8Z ret_var = StaticPaymentOutputDescriptor_write(&obj_conv);
61929         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
61930         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
61931         CVec_u8Z_free(ret_var);
61932         return ret_arr;
61933 }
61934
61935 uint64_t  __attribute__((export_name("TS_StaticPaymentOutputDescriptor_read"))) TS_StaticPaymentOutputDescriptor_read(int8_tArray ser) {
61936         LDKu8slice ser_ref;
61937         ser_ref.datalen = ser->arr_len;
61938         ser_ref.data = ser->elems;
61939         LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ), "LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ");
61940         *ret_conv = StaticPaymentOutputDescriptor_read(ser_ref);
61941         FREE(ser);
61942         return tag_ptr(ret_conv, true);
61943 }
61944
61945 void  __attribute__((export_name("TS_SpendableOutputDescriptor_free"))) TS_SpendableOutputDescriptor_free(uint64_t this_ptr) {
61946         if (!ptr_is_owned(this_ptr)) return;
61947         void* this_ptr_ptr = untag_ptr(this_ptr);
61948         CHECK_ACCESS(this_ptr_ptr);
61949         LDKSpendableOutputDescriptor this_ptr_conv = *(LDKSpendableOutputDescriptor*)(this_ptr_ptr);
61950         FREE(untag_ptr(this_ptr));
61951         SpendableOutputDescriptor_free(this_ptr_conv);
61952 }
61953
61954 static inline uint64_t SpendableOutputDescriptor_clone_ptr(LDKSpendableOutputDescriptor *NONNULL_PTR arg) {
61955         LDKSpendableOutputDescriptor *ret_copy = MALLOC(sizeof(LDKSpendableOutputDescriptor), "LDKSpendableOutputDescriptor");
61956         *ret_copy = SpendableOutputDescriptor_clone(arg);
61957         uint64_t ret_ref = tag_ptr(ret_copy, true);
61958         return ret_ref;
61959 }
61960 int64_t  __attribute__((export_name("TS_SpendableOutputDescriptor_clone_ptr"))) TS_SpendableOutputDescriptor_clone_ptr(uint64_t arg) {
61961         LDKSpendableOutputDescriptor* arg_conv = (LDKSpendableOutputDescriptor*)untag_ptr(arg);
61962         int64_t ret_conv = SpendableOutputDescriptor_clone_ptr(arg_conv);
61963         return ret_conv;
61964 }
61965
61966 uint64_t  __attribute__((export_name("TS_SpendableOutputDescriptor_clone"))) TS_SpendableOutputDescriptor_clone(uint64_t orig) {
61967         LDKSpendableOutputDescriptor* orig_conv = (LDKSpendableOutputDescriptor*)untag_ptr(orig);
61968         LDKSpendableOutputDescriptor *ret_copy = MALLOC(sizeof(LDKSpendableOutputDescriptor), "LDKSpendableOutputDescriptor");
61969         *ret_copy = SpendableOutputDescriptor_clone(orig_conv);
61970         uint64_t ret_ref = tag_ptr(ret_copy, true);
61971         return ret_ref;
61972 }
61973
61974 uint64_t  __attribute__((export_name("TS_SpendableOutputDescriptor_static_output"))) TS_SpendableOutputDescriptor_static_output(uint64_t outpoint, uint64_t output) {
61975         LDKOutPoint outpoint_conv;
61976         outpoint_conv.inner = untag_ptr(outpoint);
61977         outpoint_conv.is_owned = ptr_is_owned(outpoint);
61978         CHECK_INNER_FIELD_ACCESS_OR_NULL(outpoint_conv);
61979         outpoint_conv = OutPoint_clone(&outpoint_conv);
61980         void* output_ptr = untag_ptr(output);
61981         CHECK_ACCESS(output_ptr);
61982         LDKTxOut output_conv = *(LDKTxOut*)(output_ptr);
61983         output_conv = TxOut_clone((LDKTxOut*)untag_ptr(output));
61984         LDKSpendableOutputDescriptor *ret_copy = MALLOC(sizeof(LDKSpendableOutputDescriptor), "LDKSpendableOutputDescriptor");
61985         *ret_copy = SpendableOutputDescriptor_static_output(outpoint_conv, output_conv);
61986         uint64_t ret_ref = tag_ptr(ret_copy, true);
61987         return ret_ref;
61988 }
61989
61990 uint64_t  __attribute__((export_name("TS_SpendableOutputDescriptor_delayed_payment_output"))) TS_SpendableOutputDescriptor_delayed_payment_output(uint64_t a) {
61991         LDKDelayedPaymentOutputDescriptor a_conv;
61992         a_conv.inner = untag_ptr(a);
61993         a_conv.is_owned = ptr_is_owned(a);
61994         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
61995         a_conv = DelayedPaymentOutputDescriptor_clone(&a_conv);
61996         LDKSpendableOutputDescriptor *ret_copy = MALLOC(sizeof(LDKSpendableOutputDescriptor), "LDKSpendableOutputDescriptor");
61997         *ret_copy = SpendableOutputDescriptor_delayed_payment_output(a_conv);
61998         uint64_t ret_ref = tag_ptr(ret_copy, true);
61999         return ret_ref;
62000 }
62001
62002 uint64_t  __attribute__((export_name("TS_SpendableOutputDescriptor_static_payment_output"))) TS_SpendableOutputDescriptor_static_payment_output(uint64_t a) {
62003         LDKStaticPaymentOutputDescriptor a_conv;
62004         a_conv.inner = untag_ptr(a);
62005         a_conv.is_owned = ptr_is_owned(a);
62006         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
62007         a_conv = StaticPaymentOutputDescriptor_clone(&a_conv);
62008         LDKSpendableOutputDescriptor *ret_copy = MALLOC(sizeof(LDKSpendableOutputDescriptor), "LDKSpendableOutputDescriptor");
62009         *ret_copy = SpendableOutputDescriptor_static_payment_output(a_conv);
62010         uint64_t ret_ref = tag_ptr(ret_copy, true);
62011         return ret_ref;
62012 }
62013
62014 int64_t  __attribute__((export_name("TS_SpendableOutputDescriptor_hash"))) TS_SpendableOutputDescriptor_hash(uint64_t o) {
62015         LDKSpendableOutputDescriptor* o_conv = (LDKSpendableOutputDescriptor*)untag_ptr(o);
62016         int64_t ret_conv = SpendableOutputDescriptor_hash(o_conv);
62017         return ret_conv;
62018 }
62019
62020 jboolean  __attribute__((export_name("TS_SpendableOutputDescriptor_eq"))) TS_SpendableOutputDescriptor_eq(uint64_t a, uint64_t b) {
62021         LDKSpendableOutputDescriptor* a_conv = (LDKSpendableOutputDescriptor*)untag_ptr(a);
62022         LDKSpendableOutputDescriptor* b_conv = (LDKSpendableOutputDescriptor*)untag_ptr(b);
62023         jboolean ret_conv = SpendableOutputDescriptor_eq(a_conv, b_conv);
62024         return ret_conv;
62025 }
62026
62027 int8_tArray  __attribute__((export_name("TS_SpendableOutputDescriptor_write"))) TS_SpendableOutputDescriptor_write(uint64_t obj) {
62028         LDKSpendableOutputDescriptor* obj_conv = (LDKSpendableOutputDescriptor*)untag_ptr(obj);
62029         LDKCVec_u8Z ret_var = SpendableOutputDescriptor_write(obj_conv);
62030         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
62031         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
62032         CVec_u8Z_free(ret_var);
62033         return ret_arr;
62034 }
62035
62036 uint64_t  __attribute__((export_name("TS_SpendableOutputDescriptor_read"))) TS_SpendableOutputDescriptor_read(int8_tArray ser) {
62037         LDKu8slice ser_ref;
62038         ser_ref.datalen = ser->arr_len;
62039         ser_ref.data = ser->elems;
62040         LDKCResult_SpendableOutputDescriptorDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_SpendableOutputDescriptorDecodeErrorZ), "LDKCResult_SpendableOutputDescriptorDecodeErrorZ");
62041         *ret_conv = SpendableOutputDescriptor_read(ser_ref);
62042         FREE(ser);
62043         return tag_ptr(ret_conv, true);
62044 }
62045
62046 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) {
62047         LDKCVec_SpendableOutputDescriptorZ descriptors_constr;
62048         descriptors_constr.datalen = descriptors->arr_len;
62049         if (descriptors_constr.datalen > 0)
62050                 descriptors_constr.data = MALLOC(descriptors_constr.datalen * sizeof(LDKSpendableOutputDescriptor), "LDKCVec_SpendableOutputDescriptorZ Elements");
62051         else
62052                 descriptors_constr.data = NULL;
62053         uint64_t* descriptors_vals = descriptors->elems;
62054         for (size_t b = 0; b < descriptors_constr.datalen; b++) {
62055                 uint64_t descriptors_conv_27 = descriptors_vals[b];
62056                 void* descriptors_conv_27_ptr = untag_ptr(descriptors_conv_27);
62057                 CHECK_ACCESS(descriptors_conv_27_ptr);
62058                 LDKSpendableOutputDescriptor descriptors_conv_27_conv = *(LDKSpendableOutputDescriptor*)(descriptors_conv_27_ptr);
62059                 descriptors_conv_27_conv = SpendableOutputDescriptor_clone((LDKSpendableOutputDescriptor*)untag_ptr(descriptors_conv_27));
62060                 descriptors_constr.data[b] = descriptors_conv_27_conv;
62061         }
62062         FREE(descriptors);
62063         LDKCVec_TxOutZ outputs_constr;
62064         outputs_constr.datalen = outputs->arr_len;
62065         if (outputs_constr.datalen > 0)
62066                 outputs_constr.data = MALLOC(outputs_constr.datalen * sizeof(LDKTxOut), "LDKCVec_TxOutZ Elements");
62067         else
62068                 outputs_constr.data = NULL;
62069         uint64_t* outputs_vals = outputs->elems;
62070         for (size_t h = 0; h < outputs_constr.datalen; h++) {
62071                 uint64_t outputs_conv_7 = outputs_vals[h];
62072                 void* outputs_conv_7_ptr = untag_ptr(outputs_conv_7);
62073                 CHECK_ACCESS(outputs_conv_7_ptr);
62074                 LDKTxOut outputs_conv_7_conv = *(LDKTxOut*)(outputs_conv_7_ptr);
62075                 outputs_conv_7_conv = TxOut_clone((LDKTxOut*)untag_ptr(outputs_conv_7));
62076                 outputs_constr.data[h] = outputs_conv_7_conv;
62077         }
62078         FREE(outputs);
62079         LDKCVec_u8Z change_destination_script_ref;
62080         change_destination_script_ref.datalen = change_destination_script->arr_len;
62081         change_destination_script_ref.data = MALLOC(change_destination_script_ref.datalen, "LDKCVec_u8Z Bytes");
62082         memcpy(change_destination_script_ref.data, change_destination_script->elems, change_destination_script_ref.datalen); FREE(change_destination_script);
62083         void* locktime_ptr = untag_ptr(locktime);
62084         CHECK_ACCESS(locktime_ptr);
62085         LDKCOption_u32Z locktime_conv = *(LDKCOption_u32Z*)(locktime_ptr);
62086         locktime_conv = COption_u32Z_clone((LDKCOption_u32Z*)untag_ptr(locktime));
62087         LDKCResult_C2Tuple_CVec_u8ZusizeZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_CVec_u8ZusizeZNoneZ), "LDKCResult_C2Tuple_CVec_u8ZusizeZNoneZ");
62088         *ret_conv = SpendableOutputDescriptor_create_spendable_outputs_psbt(descriptors_constr, outputs_constr, change_destination_script_ref, feerate_sat_per_1000_weight, locktime_conv);
62089         return tag_ptr(ret_conv, true);
62090 }
62091
62092 void  __attribute__((export_name("TS_ChannelDerivationParameters_free"))) TS_ChannelDerivationParameters_free(uint64_t this_obj) {
62093         LDKChannelDerivationParameters this_obj_conv;
62094         this_obj_conv.inner = untag_ptr(this_obj);
62095         this_obj_conv.is_owned = ptr_is_owned(this_obj);
62096         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
62097         ChannelDerivationParameters_free(this_obj_conv);
62098 }
62099
62100 int64_t  __attribute__((export_name("TS_ChannelDerivationParameters_get_value_satoshis"))) TS_ChannelDerivationParameters_get_value_satoshis(uint64_t this_ptr) {
62101         LDKChannelDerivationParameters this_ptr_conv;
62102         this_ptr_conv.inner = untag_ptr(this_ptr);
62103         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
62104         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
62105         this_ptr_conv.is_owned = false;
62106         int64_t ret_conv = ChannelDerivationParameters_get_value_satoshis(&this_ptr_conv);
62107         return ret_conv;
62108 }
62109
62110 void  __attribute__((export_name("TS_ChannelDerivationParameters_set_value_satoshis"))) TS_ChannelDerivationParameters_set_value_satoshis(uint64_t this_ptr, int64_t val) {
62111         LDKChannelDerivationParameters this_ptr_conv;
62112         this_ptr_conv.inner = untag_ptr(this_ptr);
62113         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
62114         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
62115         this_ptr_conv.is_owned = false;
62116         ChannelDerivationParameters_set_value_satoshis(&this_ptr_conv, val);
62117 }
62118
62119 int8_tArray  __attribute__((export_name("TS_ChannelDerivationParameters_get_keys_id"))) TS_ChannelDerivationParameters_get_keys_id(uint64_t this_ptr) {
62120         LDKChannelDerivationParameters this_ptr_conv;
62121         this_ptr_conv.inner = untag_ptr(this_ptr);
62122         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
62123         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
62124         this_ptr_conv.is_owned = false;
62125         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
62126         memcpy(ret_arr->elems, *ChannelDerivationParameters_get_keys_id(&this_ptr_conv), 32);
62127         return ret_arr;
62128 }
62129
62130 void  __attribute__((export_name("TS_ChannelDerivationParameters_set_keys_id"))) TS_ChannelDerivationParameters_set_keys_id(uint64_t this_ptr, int8_tArray val) {
62131         LDKChannelDerivationParameters this_ptr_conv;
62132         this_ptr_conv.inner = untag_ptr(this_ptr);
62133         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
62134         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
62135         this_ptr_conv.is_owned = false;
62136         LDKThirtyTwoBytes val_ref;
62137         CHECK(val->arr_len == 32);
62138         memcpy(val_ref.data, val->elems, 32); FREE(val);
62139         ChannelDerivationParameters_set_keys_id(&this_ptr_conv, val_ref);
62140 }
62141
62142 uint64_t  __attribute__((export_name("TS_ChannelDerivationParameters_get_transaction_parameters"))) TS_ChannelDerivationParameters_get_transaction_parameters(uint64_t this_ptr) {
62143         LDKChannelDerivationParameters this_ptr_conv;
62144         this_ptr_conv.inner = untag_ptr(this_ptr);
62145         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
62146         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
62147         this_ptr_conv.is_owned = false;
62148         LDKChannelTransactionParameters ret_var = ChannelDerivationParameters_get_transaction_parameters(&this_ptr_conv);
62149         uint64_t ret_ref = 0;
62150         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
62151         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
62152         return ret_ref;
62153 }
62154
62155 void  __attribute__((export_name("TS_ChannelDerivationParameters_set_transaction_parameters"))) TS_ChannelDerivationParameters_set_transaction_parameters(uint64_t this_ptr, uint64_t val) {
62156         LDKChannelDerivationParameters this_ptr_conv;
62157         this_ptr_conv.inner = untag_ptr(this_ptr);
62158         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
62159         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
62160         this_ptr_conv.is_owned = false;
62161         LDKChannelTransactionParameters val_conv;
62162         val_conv.inner = untag_ptr(val);
62163         val_conv.is_owned = ptr_is_owned(val);
62164         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
62165         val_conv = ChannelTransactionParameters_clone(&val_conv);
62166         ChannelDerivationParameters_set_transaction_parameters(&this_ptr_conv, val_conv);
62167 }
62168
62169 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) {
62170         LDKThirtyTwoBytes keys_id_arg_ref;
62171         CHECK(keys_id_arg->arr_len == 32);
62172         memcpy(keys_id_arg_ref.data, keys_id_arg->elems, 32); FREE(keys_id_arg);
62173         LDKChannelTransactionParameters transaction_parameters_arg_conv;
62174         transaction_parameters_arg_conv.inner = untag_ptr(transaction_parameters_arg);
62175         transaction_parameters_arg_conv.is_owned = ptr_is_owned(transaction_parameters_arg);
62176         CHECK_INNER_FIELD_ACCESS_OR_NULL(transaction_parameters_arg_conv);
62177         transaction_parameters_arg_conv = ChannelTransactionParameters_clone(&transaction_parameters_arg_conv);
62178         LDKChannelDerivationParameters ret_var = ChannelDerivationParameters_new(value_satoshis_arg, keys_id_arg_ref, transaction_parameters_arg_conv);
62179         uint64_t ret_ref = 0;
62180         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
62181         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
62182         return ret_ref;
62183 }
62184
62185 static inline uint64_t ChannelDerivationParameters_clone_ptr(LDKChannelDerivationParameters *NONNULL_PTR arg) {
62186         LDKChannelDerivationParameters ret_var = ChannelDerivationParameters_clone(arg);
62187         uint64_t ret_ref = 0;
62188         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
62189         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
62190         return ret_ref;
62191 }
62192 int64_t  __attribute__((export_name("TS_ChannelDerivationParameters_clone_ptr"))) TS_ChannelDerivationParameters_clone_ptr(uint64_t arg) {
62193         LDKChannelDerivationParameters arg_conv;
62194         arg_conv.inner = untag_ptr(arg);
62195         arg_conv.is_owned = ptr_is_owned(arg);
62196         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
62197         arg_conv.is_owned = false;
62198         int64_t ret_conv = ChannelDerivationParameters_clone_ptr(&arg_conv);
62199         return ret_conv;
62200 }
62201
62202 uint64_t  __attribute__((export_name("TS_ChannelDerivationParameters_clone"))) TS_ChannelDerivationParameters_clone(uint64_t orig) {
62203         LDKChannelDerivationParameters orig_conv;
62204         orig_conv.inner = untag_ptr(orig);
62205         orig_conv.is_owned = ptr_is_owned(orig);
62206         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
62207         orig_conv.is_owned = false;
62208         LDKChannelDerivationParameters ret_var = ChannelDerivationParameters_clone(&orig_conv);
62209         uint64_t ret_ref = 0;
62210         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
62211         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
62212         return ret_ref;
62213 }
62214
62215 jboolean  __attribute__((export_name("TS_ChannelDerivationParameters_eq"))) TS_ChannelDerivationParameters_eq(uint64_t a, uint64_t b) {
62216         LDKChannelDerivationParameters a_conv;
62217         a_conv.inner = untag_ptr(a);
62218         a_conv.is_owned = ptr_is_owned(a);
62219         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
62220         a_conv.is_owned = false;
62221         LDKChannelDerivationParameters b_conv;
62222         b_conv.inner = untag_ptr(b);
62223         b_conv.is_owned = ptr_is_owned(b);
62224         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
62225         b_conv.is_owned = false;
62226         jboolean ret_conv = ChannelDerivationParameters_eq(&a_conv, &b_conv);
62227         return ret_conv;
62228 }
62229
62230 int8_tArray  __attribute__((export_name("TS_ChannelDerivationParameters_write"))) TS_ChannelDerivationParameters_write(uint64_t obj) {
62231         LDKChannelDerivationParameters obj_conv;
62232         obj_conv.inner = untag_ptr(obj);
62233         obj_conv.is_owned = ptr_is_owned(obj);
62234         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
62235         obj_conv.is_owned = false;
62236         LDKCVec_u8Z ret_var = ChannelDerivationParameters_write(&obj_conv);
62237         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
62238         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
62239         CVec_u8Z_free(ret_var);
62240         return ret_arr;
62241 }
62242
62243 uint64_t  __attribute__((export_name("TS_ChannelDerivationParameters_read"))) TS_ChannelDerivationParameters_read(int8_tArray ser) {
62244         LDKu8slice ser_ref;
62245         ser_ref.datalen = ser->arr_len;
62246         ser_ref.data = ser->elems;
62247         LDKCResult_ChannelDerivationParametersDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelDerivationParametersDecodeErrorZ), "LDKCResult_ChannelDerivationParametersDecodeErrorZ");
62248         *ret_conv = ChannelDerivationParameters_read(ser_ref);
62249         FREE(ser);
62250         return tag_ptr(ret_conv, true);
62251 }
62252
62253 void  __attribute__((export_name("TS_HTLCDescriptor_free"))) TS_HTLCDescriptor_free(uint64_t this_obj) {
62254         LDKHTLCDescriptor this_obj_conv;
62255         this_obj_conv.inner = untag_ptr(this_obj);
62256         this_obj_conv.is_owned = ptr_is_owned(this_obj);
62257         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
62258         HTLCDescriptor_free(this_obj_conv);
62259 }
62260
62261 uint64_t  __attribute__((export_name("TS_HTLCDescriptor_get_channel_derivation_parameters"))) TS_HTLCDescriptor_get_channel_derivation_parameters(uint64_t this_ptr) {
62262         LDKHTLCDescriptor this_ptr_conv;
62263         this_ptr_conv.inner = untag_ptr(this_ptr);
62264         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
62265         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
62266         this_ptr_conv.is_owned = false;
62267         LDKChannelDerivationParameters ret_var = HTLCDescriptor_get_channel_derivation_parameters(&this_ptr_conv);
62268         uint64_t ret_ref = 0;
62269         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
62270         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
62271         return ret_ref;
62272 }
62273
62274 void  __attribute__((export_name("TS_HTLCDescriptor_set_channel_derivation_parameters"))) TS_HTLCDescriptor_set_channel_derivation_parameters(uint64_t this_ptr, uint64_t val) {
62275         LDKHTLCDescriptor this_ptr_conv;
62276         this_ptr_conv.inner = untag_ptr(this_ptr);
62277         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
62278         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
62279         this_ptr_conv.is_owned = false;
62280         LDKChannelDerivationParameters val_conv;
62281         val_conv.inner = untag_ptr(val);
62282         val_conv.is_owned = ptr_is_owned(val);
62283         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
62284         val_conv = ChannelDerivationParameters_clone(&val_conv);
62285         HTLCDescriptor_set_channel_derivation_parameters(&this_ptr_conv, val_conv);
62286 }
62287
62288 int64_t  __attribute__((export_name("TS_HTLCDescriptor_get_per_commitment_number"))) TS_HTLCDescriptor_get_per_commitment_number(uint64_t this_ptr) {
62289         LDKHTLCDescriptor this_ptr_conv;
62290         this_ptr_conv.inner = untag_ptr(this_ptr);
62291         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
62292         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
62293         this_ptr_conv.is_owned = false;
62294         int64_t ret_conv = HTLCDescriptor_get_per_commitment_number(&this_ptr_conv);
62295         return ret_conv;
62296 }
62297
62298 void  __attribute__((export_name("TS_HTLCDescriptor_set_per_commitment_number"))) TS_HTLCDescriptor_set_per_commitment_number(uint64_t this_ptr, int64_t val) {
62299         LDKHTLCDescriptor this_ptr_conv;
62300         this_ptr_conv.inner = untag_ptr(this_ptr);
62301         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
62302         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
62303         this_ptr_conv.is_owned = false;
62304         HTLCDescriptor_set_per_commitment_number(&this_ptr_conv, val);
62305 }
62306
62307 int8_tArray  __attribute__((export_name("TS_HTLCDescriptor_get_per_commitment_point"))) TS_HTLCDescriptor_get_per_commitment_point(uint64_t this_ptr) {
62308         LDKHTLCDescriptor this_ptr_conv;
62309         this_ptr_conv.inner = untag_ptr(this_ptr);
62310         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
62311         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
62312         this_ptr_conv.is_owned = false;
62313         int8_tArray ret_arr = init_int8_tArray(33, __LINE__);
62314         memcpy(ret_arr->elems, HTLCDescriptor_get_per_commitment_point(&this_ptr_conv).compressed_form, 33);
62315         return ret_arr;
62316 }
62317
62318 void  __attribute__((export_name("TS_HTLCDescriptor_set_per_commitment_point"))) TS_HTLCDescriptor_set_per_commitment_point(uint64_t this_ptr, int8_tArray val) {
62319         LDKHTLCDescriptor this_ptr_conv;
62320         this_ptr_conv.inner = untag_ptr(this_ptr);
62321         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
62322         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
62323         this_ptr_conv.is_owned = false;
62324         LDKPublicKey val_ref;
62325         CHECK(val->arr_len == 33);
62326         memcpy(val_ref.compressed_form, val->elems, 33); FREE(val);
62327         HTLCDescriptor_set_per_commitment_point(&this_ptr_conv, val_ref);
62328 }
62329
62330 int32_t  __attribute__((export_name("TS_HTLCDescriptor_get_feerate_per_kw"))) TS_HTLCDescriptor_get_feerate_per_kw(uint64_t this_ptr) {
62331         LDKHTLCDescriptor this_ptr_conv;
62332         this_ptr_conv.inner = untag_ptr(this_ptr);
62333         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
62334         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
62335         this_ptr_conv.is_owned = false;
62336         int32_t ret_conv = HTLCDescriptor_get_feerate_per_kw(&this_ptr_conv);
62337         return ret_conv;
62338 }
62339
62340 void  __attribute__((export_name("TS_HTLCDescriptor_set_feerate_per_kw"))) TS_HTLCDescriptor_set_feerate_per_kw(uint64_t this_ptr, int32_t val) {
62341         LDKHTLCDescriptor this_ptr_conv;
62342         this_ptr_conv.inner = untag_ptr(this_ptr);
62343         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
62344         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
62345         this_ptr_conv.is_owned = false;
62346         HTLCDescriptor_set_feerate_per_kw(&this_ptr_conv, val);
62347 }
62348
62349 uint64_t  __attribute__((export_name("TS_HTLCDescriptor_get_htlc"))) TS_HTLCDescriptor_get_htlc(uint64_t this_ptr) {
62350         LDKHTLCDescriptor this_ptr_conv;
62351         this_ptr_conv.inner = untag_ptr(this_ptr);
62352         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
62353         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
62354         this_ptr_conv.is_owned = false;
62355         LDKHTLCOutputInCommitment ret_var = HTLCDescriptor_get_htlc(&this_ptr_conv);
62356         uint64_t ret_ref = 0;
62357         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
62358         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
62359         return ret_ref;
62360 }
62361
62362 void  __attribute__((export_name("TS_HTLCDescriptor_set_htlc"))) TS_HTLCDescriptor_set_htlc(uint64_t this_ptr, uint64_t val) {
62363         LDKHTLCDescriptor this_ptr_conv;
62364         this_ptr_conv.inner = untag_ptr(this_ptr);
62365         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
62366         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
62367         this_ptr_conv.is_owned = false;
62368         LDKHTLCOutputInCommitment val_conv;
62369         val_conv.inner = untag_ptr(val);
62370         val_conv.is_owned = ptr_is_owned(val);
62371         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
62372         val_conv = HTLCOutputInCommitment_clone(&val_conv);
62373         HTLCDescriptor_set_htlc(&this_ptr_conv, val_conv);
62374 }
62375
62376 uint64_t  __attribute__((export_name("TS_HTLCDescriptor_get_preimage"))) TS_HTLCDescriptor_get_preimage(uint64_t this_ptr) {
62377         LDKHTLCDescriptor this_ptr_conv;
62378         this_ptr_conv.inner = untag_ptr(this_ptr);
62379         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
62380         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
62381         this_ptr_conv.is_owned = false;
62382         LDKCOption_ThirtyTwoBytesZ *ret_copy = MALLOC(sizeof(LDKCOption_ThirtyTwoBytesZ), "LDKCOption_ThirtyTwoBytesZ");
62383         *ret_copy = HTLCDescriptor_get_preimage(&this_ptr_conv);
62384         uint64_t ret_ref = tag_ptr(ret_copy, true);
62385         return ret_ref;
62386 }
62387
62388 void  __attribute__((export_name("TS_HTLCDescriptor_set_preimage"))) TS_HTLCDescriptor_set_preimage(uint64_t this_ptr, uint64_t val) {
62389         LDKHTLCDescriptor this_ptr_conv;
62390         this_ptr_conv.inner = untag_ptr(this_ptr);
62391         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
62392         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
62393         this_ptr_conv.is_owned = false;
62394         void* val_ptr = untag_ptr(val);
62395         CHECK_ACCESS(val_ptr);
62396         LDKCOption_ThirtyTwoBytesZ val_conv = *(LDKCOption_ThirtyTwoBytesZ*)(val_ptr);
62397         val_conv = COption_ThirtyTwoBytesZ_clone((LDKCOption_ThirtyTwoBytesZ*)untag_ptr(val));
62398         HTLCDescriptor_set_preimage(&this_ptr_conv, val_conv);
62399 }
62400
62401 int8_tArray  __attribute__((export_name("TS_HTLCDescriptor_get_counterparty_sig"))) TS_HTLCDescriptor_get_counterparty_sig(uint64_t this_ptr) {
62402         LDKHTLCDescriptor this_ptr_conv;
62403         this_ptr_conv.inner = untag_ptr(this_ptr);
62404         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
62405         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
62406         this_ptr_conv.is_owned = false;
62407         int8_tArray ret_arr = init_int8_tArray(64, __LINE__);
62408         memcpy(ret_arr->elems, HTLCDescriptor_get_counterparty_sig(&this_ptr_conv).compact_form, 64);
62409         return ret_arr;
62410 }
62411
62412 void  __attribute__((export_name("TS_HTLCDescriptor_set_counterparty_sig"))) TS_HTLCDescriptor_set_counterparty_sig(uint64_t this_ptr, int8_tArray val) {
62413         LDKHTLCDescriptor this_ptr_conv;
62414         this_ptr_conv.inner = untag_ptr(this_ptr);
62415         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
62416         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
62417         this_ptr_conv.is_owned = false;
62418         LDKECDSASignature val_ref;
62419         CHECK(val->arr_len == 64);
62420         memcpy(val_ref.compact_form, val->elems, 64); FREE(val);
62421         HTLCDescriptor_set_counterparty_sig(&this_ptr_conv, val_ref);
62422 }
62423
62424 static inline uint64_t HTLCDescriptor_clone_ptr(LDKHTLCDescriptor *NONNULL_PTR arg) {
62425         LDKHTLCDescriptor ret_var = HTLCDescriptor_clone(arg);
62426         uint64_t ret_ref = 0;
62427         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
62428         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
62429         return ret_ref;
62430 }
62431 int64_t  __attribute__((export_name("TS_HTLCDescriptor_clone_ptr"))) TS_HTLCDescriptor_clone_ptr(uint64_t arg) {
62432         LDKHTLCDescriptor arg_conv;
62433         arg_conv.inner = untag_ptr(arg);
62434         arg_conv.is_owned = ptr_is_owned(arg);
62435         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
62436         arg_conv.is_owned = false;
62437         int64_t ret_conv = HTLCDescriptor_clone_ptr(&arg_conv);
62438         return ret_conv;
62439 }
62440
62441 uint64_t  __attribute__((export_name("TS_HTLCDescriptor_clone"))) TS_HTLCDescriptor_clone(uint64_t orig) {
62442         LDKHTLCDescriptor orig_conv;
62443         orig_conv.inner = untag_ptr(orig);
62444         orig_conv.is_owned = ptr_is_owned(orig);
62445         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
62446         orig_conv.is_owned = false;
62447         LDKHTLCDescriptor ret_var = HTLCDescriptor_clone(&orig_conv);
62448         uint64_t ret_ref = 0;
62449         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
62450         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
62451         return ret_ref;
62452 }
62453
62454 jboolean  __attribute__((export_name("TS_HTLCDescriptor_eq"))) TS_HTLCDescriptor_eq(uint64_t a, uint64_t b) {
62455         LDKHTLCDescriptor a_conv;
62456         a_conv.inner = untag_ptr(a);
62457         a_conv.is_owned = ptr_is_owned(a);
62458         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
62459         a_conv.is_owned = false;
62460         LDKHTLCDescriptor b_conv;
62461         b_conv.inner = untag_ptr(b);
62462         b_conv.is_owned = ptr_is_owned(b);
62463         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
62464         b_conv.is_owned = false;
62465         jboolean ret_conv = HTLCDescriptor_eq(&a_conv, &b_conv);
62466         return ret_conv;
62467 }
62468
62469 int8_tArray  __attribute__((export_name("TS_HTLCDescriptor_write"))) TS_HTLCDescriptor_write(uint64_t obj) {
62470         LDKHTLCDescriptor obj_conv;
62471         obj_conv.inner = untag_ptr(obj);
62472         obj_conv.is_owned = ptr_is_owned(obj);
62473         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
62474         obj_conv.is_owned = false;
62475         LDKCVec_u8Z ret_var = HTLCDescriptor_write(&obj_conv);
62476         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
62477         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
62478         CVec_u8Z_free(ret_var);
62479         return ret_arr;
62480 }
62481
62482 uint64_t  __attribute__((export_name("TS_HTLCDescriptor_read"))) TS_HTLCDescriptor_read(int8_tArray ser) {
62483         LDKu8slice ser_ref;
62484         ser_ref.datalen = ser->arr_len;
62485         ser_ref.data = ser->elems;
62486         LDKCResult_HTLCDescriptorDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_HTLCDescriptorDecodeErrorZ), "LDKCResult_HTLCDescriptorDecodeErrorZ");
62487         *ret_conv = HTLCDescriptor_read(ser_ref);
62488         FREE(ser);
62489         return tag_ptr(ret_conv, true);
62490 }
62491
62492 uint64_t  __attribute__((export_name("TS_HTLCDescriptor_outpoint"))) TS_HTLCDescriptor_outpoint(uint64_t this_arg) {
62493         LDKHTLCDescriptor this_arg_conv;
62494         this_arg_conv.inner = untag_ptr(this_arg);
62495         this_arg_conv.is_owned = ptr_is_owned(this_arg);
62496         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
62497         this_arg_conv.is_owned = false;
62498         LDKOutPoint ret_var = HTLCDescriptor_outpoint(&this_arg_conv);
62499         uint64_t ret_ref = 0;
62500         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
62501         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
62502         return ret_ref;
62503 }
62504
62505 uint64_t  __attribute__((export_name("TS_HTLCDescriptor_previous_utxo"))) TS_HTLCDescriptor_previous_utxo(uint64_t this_arg) {
62506         LDKHTLCDescriptor this_arg_conv;
62507         this_arg_conv.inner = untag_ptr(this_arg);
62508         this_arg_conv.is_owned = ptr_is_owned(this_arg);
62509         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
62510         this_arg_conv.is_owned = false;
62511         LDKTxOut* ret_ref = MALLOC(sizeof(LDKTxOut), "LDKTxOut");
62512         *ret_ref = HTLCDescriptor_previous_utxo(&this_arg_conv);
62513         return tag_ptr(ret_ref, true);
62514 }
62515
62516 uint64_t  __attribute__((export_name("TS_HTLCDescriptor_unsigned_tx_input"))) TS_HTLCDescriptor_unsigned_tx_input(uint64_t this_arg) {
62517         LDKHTLCDescriptor this_arg_conv;
62518         this_arg_conv.inner = untag_ptr(this_arg);
62519         this_arg_conv.is_owned = ptr_is_owned(this_arg);
62520         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
62521         this_arg_conv.is_owned = false;
62522         LDKTxIn* ret_ref = MALLOC(sizeof(LDKTxIn), "LDKTxIn");
62523         *ret_ref = HTLCDescriptor_unsigned_tx_input(&this_arg_conv);
62524         return tag_ptr(ret_ref, true);
62525 }
62526
62527 uint64_t  __attribute__((export_name("TS_HTLCDescriptor_tx_output"))) TS_HTLCDescriptor_tx_output(uint64_t this_arg) {
62528         LDKHTLCDescriptor this_arg_conv;
62529         this_arg_conv.inner = untag_ptr(this_arg);
62530         this_arg_conv.is_owned = ptr_is_owned(this_arg);
62531         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
62532         this_arg_conv.is_owned = false;
62533         LDKTxOut* ret_ref = MALLOC(sizeof(LDKTxOut), "LDKTxOut");
62534         *ret_ref = HTLCDescriptor_tx_output(&this_arg_conv);
62535         return tag_ptr(ret_ref, true);
62536 }
62537
62538 int8_tArray  __attribute__((export_name("TS_HTLCDescriptor_witness_script"))) TS_HTLCDescriptor_witness_script(uint64_t this_arg) {
62539         LDKHTLCDescriptor this_arg_conv;
62540         this_arg_conv.inner = untag_ptr(this_arg);
62541         this_arg_conv.is_owned = ptr_is_owned(this_arg);
62542         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
62543         this_arg_conv.is_owned = false;
62544         LDKCVec_u8Z ret_var = HTLCDescriptor_witness_script(&this_arg_conv);
62545         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
62546         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
62547         CVec_u8Z_free(ret_var);
62548         return ret_arr;
62549 }
62550
62551 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) {
62552         LDKHTLCDescriptor this_arg_conv;
62553         this_arg_conv.inner = untag_ptr(this_arg);
62554         this_arg_conv.is_owned = ptr_is_owned(this_arg);
62555         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
62556         this_arg_conv.is_owned = false;
62557         LDKECDSASignature signature_ref;
62558         CHECK(signature->arr_len == 64);
62559         memcpy(signature_ref.compact_form, signature->elems, 64); FREE(signature);
62560         LDKu8slice witness_script_ref;
62561         witness_script_ref.datalen = witness_script->arr_len;
62562         witness_script_ref.data = witness_script->elems;
62563         LDKWitness ret_var = HTLCDescriptor_tx_input_witness(&this_arg_conv, signature_ref, witness_script_ref);
62564         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
62565         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
62566         Witness_free(ret_var);
62567         FREE(witness_script);
62568         return ret_arr;
62569 }
62570
62571 uint64_t  __attribute__((export_name("TS_HTLCDescriptor_derive_channel_signer"))) TS_HTLCDescriptor_derive_channel_signer(uint64_t this_arg, uint64_t signer_provider) {
62572         LDKHTLCDescriptor this_arg_conv;
62573         this_arg_conv.inner = untag_ptr(this_arg);
62574         this_arg_conv.is_owned = ptr_is_owned(this_arg);
62575         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
62576         this_arg_conv.is_owned = false;
62577         void* signer_provider_ptr = untag_ptr(signer_provider);
62578         if (ptr_is_owned(signer_provider)) { CHECK_ACCESS(signer_provider_ptr); }
62579         LDKSignerProvider* signer_provider_conv = (LDKSignerProvider*)signer_provider_ptr;
62580         LDKWriteableEcdsaChannelSigner* ret_ret = MALLOC(sizeof(LDKWriteableEcdsaChannelSigner), "LDKWriteableEcdsaChannelSigner");
62581         *ret_ret = HTLCDescriptor_derive_channel_signer(&this_arg_conv, signer_provider_conv);
62582         return tag_ptr(ret_ret, true);
62583 }
62584
62585 void  __attribute__((export_name("TS_ChannelSigner_free"))) TS_ChannelSigner_free(uint64_t this_ptr) {
62586         if (!ptr_is_owned(this_ptr)) return;
62587         void* this_ptr_ptr = untag_ptr(this_ptr);
62588         CHECK_ACCESS(this_ptr_ptr);
62589         LDKChannelSigner this_ptr_conv = *(LDKChannelSigner*)(this_ptr_ptr);
62590         FREE(untag_ptr(this_ptr));
62591         ChannelSigner_free(this_ptr_conv);
62592 }
62593
62594 void  __attribute__((export_name("TS_EcdsaChannelSigner_free"))) TS_EcdsaChannelSigner_free(uint64_t this_ptr) {
62595         if (!ptr_is_owned(this_ptr)) return;
62596         void* this_ptr_ptr = untag_ptr(this_ptr);
62597         CHECK_ACCESS(this_ptr_ptr);
62598         LDKEcdsaChannelSigner this_ptr_conv = *(LDKEcdsaChannelSigner*)(this_ptr_ptr);
62599         FREE(untag_ptr(this_ptr));
62600         EcdsaChannelSigner_free(this_ptr_conv);
62601 }
62602
62603 static inline uint64_t WriteableEcdsaChannelSigner_clone_ptr(LDKWriteableEcdsaChannelSigner *NONNULL_PTR arg) {
62604         LDKWriteableEcdsaChannelSigner* ret_ret = MALLOC(sizeof(LDKWriteableEcdsaChannelSigner), "LDKWriteableEcdsaChannelSigner");
62605         *ret_ret = WriteableEcdsaChannelSigner_clone(arg);
62606         return tag_ptr(ret_ret, true);
62607 }
62608 int64_t  __attribute__((export_name("TS_WriteableEcdsaChannelSigner_clone_ptr"))) TS_WriteableEcdsaChannelSigner_clone_ptr(uint64_t arg) {
62609         void* arg_ptr = untag_ptr(arg);
62610         if (ptr_is_owned(arg)) { CHECK_ACCESS(arg_ptr); }
62611         LDKWriteableEcdsaChannelSigner* arg_conv = (LDKWriteableEcdsaChannelSigner*)arg_ptr;
62612         int64_t ret_conv = WriteableEcdsaChannelSigner_clone_ptr(arg_conv);
62613         return ret_conv;
62614 }
62615
62616 uint64_t  __attribute__((export_name("TS_WriteableEcdsaChannelSigner_clone"))) TS_WriteableEcdsaChannelSigner_clone(uint64_t orig) {
62617         void* orig_ptr = untag_ptr(orig);
62618         if (ptr_is_owned(orig)) { CHECK_ACCESS(orig_ptr); }
62619         LDKWriteableEcdsaChannelSigner* orig_conv = (LDKWriteableEcdsaChannelSigner*)orig_ptr;
62620         LDKWriteableEcdsaChannelSigner* ret_ret = MALLOC(sizeof(LDKWriteableEcdsaChannelSigner), "LDKWriteableEcdsaChannelSigner");
62621         *ret_ret = WriteableEcdsaChannelSigner_clone(orig_conv);
62622         return tag_ptr(ret_ret, true);
62623 }
62624
62625 void  __attribute__((export_name("TS_WriteableEcdsaChannelSigner_free"))) TS_WriteableEcdsaChannelSigner_free(uint64_t this_ptr) {
62626         if (!ptr_is_owned(this_ptr)) return;
62627         void* this_ptr_ptr = untag_ptr(this_ptr);
62628         CHECK_ACCESS(this_ptr_ptr);
62629         LDKWriteableEcdsaChannelSigner this_ptr_conv = *(LDKWriteableEcdsaChannelSigner*)(this_ptr_ptr);
62630         FREE(untag_ptr(this_ptr));
62631         WriteableEcdsaChannelSigner_free(this_ptr_conv);
62632 }
62633
62634 uint32_t  __attribute__((export_name("TS_Recipient_clone"))) TS_Recipient_clone(uint64_t orig) {
62635         LDKRecipient* orig_conv = (LDKRecipient*)untag_ptr(orig);
62636         uint32_t ret_conv = LDKRecipient_to_js(Recipient_clone(orig_conv));
62637         return ret_conv;
62638 }
62639
62640 uint32_t  __attribute__((export_name("TS_Recipient_node"))) TS_Recipient_node() {
62641         uint32_t ret_conv = LDKRecipient_to_js(Recipient_node());
62642         return ret_conv;
62643 }
62644
62645 uint32_t  __attribute__((export_name("TS_Recipient_phantom_node"))) TS_Recipient_phantom_node() {
62646         uint32_t ret_conv = LDKRecipient_to_js(Recipient_phantom_node());
62647         return ret_conv;
62648 }
62649
62650 void  __attribute__((export_name("TS_EntropySource_free"))) TS_EntropySource_free(uint64_t this_ptr) {
62651         if (!ptr_is_owned(this_ptr)) return;
62652         void* this_ptr_ptr = untag_ptr(this_ptr);
62653         CHECK_ACCESS(this_ptr_ptr);
62654         LDKEntropySource this_ptr_conv = *(LDKEntropySource*)(this_ptr_ptr);
62655         FREE(untag_ptr(this_ptr));
62656         EntropySource_free(this_ptr_conv);
62657 }
62658
62659 void  __attribute__((export_name("TS_NodeSigner_free"))) TS_NodeSigner_free(uint64_t this_ptr) {
62660         if (!ptr_is_owned(this_ptr)) return;
62661         void* this_ptr_ptr = untag_ptr(this_ptr);
62662         CHECK_ACCESS(this_ptr_ptr);
62663         LDKNodeSigner this_ptr_conv = *(LDKNodeSigner*)(this_ptr_ptr);
62664         FREE(untag_ptr(this_ptr));
62665         NodeSigner_free(this_ptr_conv);
62666 }
62667
62668 void  __attribute__((export_name("TS_SignerProvider_free"))) TS_SignerProvider_free(uint64_t this_ptr) {
62669         if (!ptr_is_owned(this_ptr)) return;
62670         void* this_ptr_ptr = untag_ptr(this_ptr);
62671         CHECK_ACCESS(this_ptr_ptr);
62672         LDKSignerProvider this_ptr_conv = *(LDKSignerProvider*)(this_ptr_ptr);
62673         FREE(untag_ptr(this_ptr));
62674         SignerProvider_free(this_ptr_conv);
62675 }
62676
62677 void  __attribute__((export_name("TS_InMemorySigner_free"))) TS_InMemorySigner_free(uint64_t this_obj) {
62678         LDKInMemorySigner this_obj_conv;
62679         this_obj_conv.inner = untag_ptr(this_obj);
62680         this_obj_conv.is_owned = ptr_is_owned(this_obj);
62681         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
62682         InMemorySigner_free(this_obj_conv);
62683 }
62684
62685 int8_tArray  __attribute__((export_name("TS_InMemorySigner_get_funding_key"))) TS_InMemorySigner_get_funding_key(uint64_t this_ptr) {
62686         LDKInMemorySigner this_ptr_conv;
62687         this_ptr_conv.inner = untag_ptr(this_ptr);
62688         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
62689         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
62690         this_ptr_conv.is_owned = false;
62691         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
62692         memcpy(ret_arr->elems, *InMemorySigner_get_funding_key(&this_ptr_conv), 32);
62693         return ret_arr;
62694 }
62695
62696 void  __attribute__((export_name("TS_InMemorySigner_set_funding_key"))) TS_InMemorySigner_set_funding_key(uint64_t this_ptr, int8_tArray val) {
62697         LDKInMemorySigner this_ptr_conv;
62698         this_ptr_conv.inner = untag_ptr(this_ptr);
62699         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
62700         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
62701         this_ptr_conv.is_owned = false;
62702         LDKSecretKey val_ref;
62703         CHECK(val->arr_len == 32);
62704         memcpy(val_ref.bytes, val->elems, 32); FREE(val);
62705         InMemorySigner_set_funding_key(&this_ptr_conv, val_ref);
62706 }
62707
62708 int8_tArray  __attribute__((export_name("TS_InMemorySigner_get_revocation_base_key"))) TS_InMemorySigner_get_revocation_base_key(uint64_t this_ptr) {
62709         LDKInMemorySigner this_ptr_conv;
62710         this_ptr_conv.inner = untag_ptr(this_ptr);
62711         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
62712         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
62713         this_ptr_conv.is_owned = false;
62714         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
62715         memcpy(ret_arr->elems, *InMemorySigner_get_revocation_base_key(&this_ptr_conv), 32);
62716         return ret_arr;
62717 }
62718
62719 void  __attribute__((export_name("TS_InMemorySigner_set_revocation_base_key"))) TS_InMemorySigner_set_revocation_base_key(uint64_t this_ptr, int8_tArray val) {
62720         LDKInMemorySigner this_ptr_conv;
62721         this_ptr_conv.inner = untag_ptr(this_ptr);
62722         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
62723         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
62724         this_ptr_conv.is_owned = false;
62725         LDKSecretKey val_ref;
62726         CHECK(val->arr_len == 32);
62727         memcpy(val_ref.bytes, val->elems, 32); FREE(val);
62728         InMemorySigner_set_revocation_base_key(&this_ptr_conv, val_ref);
62729 }
62730
62731 int8_tArray  __attribute__((export_name("TS_InMemorySigner_get_payment_key"))) TS_InMemorySigner_get_payment_key(uint64_t this_ptr) {
62732         LDKInMemorySigner this_ptr_conv;
62733         this_ptr_conv.inner = untag_ptr(this_ptr);
62734         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
62735         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
62736         this_ptr_conv.is_owned = false;
62737         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
62738         memcpy(ret_arr->elems, *InMemorySigner_get_payment_key(&this_ptr_conv), 32);
62739         return ret_arr;
62740 }
62741
62742 void  __attribute__((export_name("TS_InMemorySigner_set_payment_key"))) TS_InMemorySigner_set_payment_key(uint64_t this_ptr, int8_tArray val) {
62743         LDKInMemorySigner this_ptr_conv;
62744         this_ptr_conv.inner = untag_ptr(this_ptr);
62745         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
62746         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
62747         this_ptr_conv.is_owned = false;
62748         LDKSecretKey val_ref;
62749         CHECK(val->arr_len == 32);
62750         memcpy(val_ref.bytes, val->elems, 32); FREE(val);
62751         InMemorySigner_set_payment_key(&this_ptr_conv, val_ref);
62752 }
62753
62754 int8_tArray  __attribute__((export_name("TS_InMemorySigner_get_delayed_payment_base_key"))) TS_InMemorySigner_get_delayed_payment_base_key(uint64_t this_ptr) {
62755         LDKInMemorySigner this_ptr_conv;
62756         this_ptr_conv.inner = untag_ptr(this_ptr);
62757         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
62758         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
62759         this_ptr_conv.is_owned = false;
62760         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
62761         memcpy(ret_arr->elems, *InMemorySigner_get_delayed_payment_base_key(&this_ptr_conv), 32);
62762         return ret_arr;
62763 }
62764
62765 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) {
62766         LDKInMemorySigner this_ptr_conv;
62767         this_ptr_conv.inner = untag_ptr(this_ptr);
62768         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
62769         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
62770         this_ptr_conv.is_owned = false;
62771         LDKSecretKey val_ref;
62772         CHECK(val->arr_len == 32);
62773         memcpy(val_ref.bytes, val->elems, 32); FREE(val);
62774         InMemorySigner_set_delayed_payment_base_key(&this_ptr_conv, val_ref);
62775 }
62776
62777 int8_tArray  __attribute__((export_name("TS_InMemorySigner_get_htlc_base_key"))) TS_InMemorySigner_get_htlc_base_key(uint64_t this_ptr) {
62778         LDKInMemorySigner this_ptr_conv;
62779         this_ptr_conv.inner = untag_ptr(this_ptr);
62780         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
62781         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
62782         this_ptr_conv.is_owned = false;
62783         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
62784         memcpy(ret_arr->elems, *InMemorySigner_get_htlc_base_key(&this_ptr_conv), 32);
62785         return ret_arr;
62786 }
62787
62788 void  __attribute__((export_name("TS_InMemorySigner_set_htlc_base_key"))) TS_InMemorySigner_set_htlc_base_key(uint64_t this_ptr, int8_tArray val) {
62789         LDKInMemorySigner this_ptr_conv;
62790         this_ptr_conv.inner = untag_ptr(this_ptr);
62791         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
62792         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
62793         this_ptr_conv.is_owned = false;
62794         LDKSecretKey val_ref;
62795         CHECK(val->arr_len == 32);
62796         memcpy(val_ref.bytes, val->elems, 32); FREE(val);
62797         InMemorySigner_set_htlc_base_key(&this_ptr_conv, val_ref);
62798 }
62799
62800 int8_tArray  __attribute__((export_name("TS_InMemorySigner_get_commitment_seed"))) TS_InMemorySigner_get_commitment_seed(uint64_t this_ptr) {
62801         LDKInMemorySigner this_ptr_conv;
62802         this_ptr_conv.inner = untag_ptr(this_ptr);
62803         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
62804         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
62805         this_ptr_conv.is_owned = false;
62806         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
62807         memcpy(ret_arr->elems, *InMemorySigner_get_commitment_seed(&this_ptr_conv), 32);
62808         return ret_arr;
62809 }
62810
62811 void  __attribute__((export_name("TS_InMemorySigner_set_commitment_seed"))) TS_InMemorySigner_set_commitment_seed(uint64_t this_ptr, int8_tArray val) {
62812         LDKInMemorySigner this_ptr_conv;
62813         this_ptr_conv.inner = untag_ptr(this_ptr);
62814         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
62815         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
62816         this_ptr_conv.is_owned = false;
62817         LDKThirtyTwoBytes val_ref;
62818         CHECK(val->arr_len == 32);
62819         memcpy(val_ref.data, val->elems, 32); FREE(val);
62820         InMemorySigner_set_commitment_seed(&this_ptr_conv, val_ref);
62821 }
62822
62823 static inline uint64_t InMemorySigner_clone_ptr(LDKInMemorySigner *NONNULL_PTR arg) {
62824         LDKInMemorySigner ret_var = InMemorySigner_clone(arg);
62825         uint64_t ret_ref = 0;
62826         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
62827         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
62828         return ret_ref;
62829 }
62830 int64_t  __attribute__((export_name("TS_InMemorySigner_clone_ptr"))) TS_InMemorySigner_clone_ptr(uint64_t arg) {
62831         LDKInMemorySigner arg_conv;
62832         arg_conv.inner = untag_ptr(arg);
62833         arg_conv.is_owned = ptr_is_owned(arg);
62834         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
62835         arg_conv.is_owned = false;
62836         int64_t ret_conv = InMemorySigner_clone_ptr(&arg_conv);
62837         return ret_conv;
62838 }
62839
62840 uint64_t  __attribute__((export_name("TS_InMemorySigner_clone"))) TS_InMemorySigner_clone(uint64_t orig) {
62841         LDKInMemorySigner orig_conv;
62842         orig_conv.inner = untag_ptr(orig);
62843         orig_conv.is_owned = ptr_is_owned(orig);
62844         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
62845         orig_conv.is_owned = false;
62846         LDKInMemorySigner ret_var = InMemorySigner_clone(&orig_conv);
62847         uint64_t ret_ref = 0;
62848         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
62849         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
62850         return ret_ref;
62851 }
62852
62853 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) {
62854         LDKSecretKey funding_key_ref;
62855         CHECK(funding_key->arr_len == 32);
62856         memcpy(funding_key_ref.bytes, funding_key->elems, 32); FREE(funding_key);
62857         LDKSecretKey revocation_base_key_ref;
62858         CHECK(revocation_base_key->arr_len == 32);
62859         memcpy(revocation_base_key_ref.bytes, revocation_base_key->elems, 32); FREE(revocation_base_key);
62860         LDKSecretKey payment_key_ref;
62861         CHECK(payment_key->arr_len == 32);
62862         memcpy(payment_key_ref.bytes, payment_key->elems, 32); FREE(payment_key);
62863         LDKSecretKey delayed_payment_base_key_ref;
62864         CHECK(delayed_payment_base_key->arr_len == 32);
62865         memcpy(delayed_payment_base_key_ref.bytes, delayed_payment_base_key->elems, 32); FREE(delayed_payment_base_key);
62866         LDKSecretKey htlc_base_key_ref;
62867         CHECK(htlc_base_key->arr_len == 32);
62868         memcpy(htlc_base_key_ref.bytes, htlc_base_key->elems, 32); FREE(htlc_base_key);
62869         LDKThirtyTwoBytes commitment_seed_ref;
62870         CHECK(commitment_seed->arr_len == 32);
62871         memcpy(commitment_seed_ref.data, commitment_seed->elems, 32); FREE(commitment_seed);
62872         LDKThirtyTwoBytes channel_keys_id_ref;
62873         CHECK(channel_keys_id->arr_len == 32);
62874         memcpy(channel_keys_id_ref.data, channel_keys_id->elems, 32); FREE(channel_keys_id);
62875         LDKThirtyTwoBytes rand_bytes_unique_start_ref;
62876         CHECK(rand_bytes_unique_start->arr_len == 32);
62877         memcpy(rand_bytes_unique_start_ref.data, rand_bytes_unique_start->elems, 32); FREE(rand_bytes_unique_start);
62878         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);
62879         uint64_t ret_ref = 0;
62880         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
62881         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
62882         return ret_ref;
62883 }
62884
62885 uint64_t  __attribute__((export_name("TS_InMemorySigner_counterparty_pubkeys"))) TS_InMemorySigner_counterparty_pubkeys(uint64_t this_arg) {
62886         LDKInMemorySigner this_arg_conv;
62887         this_arg_conv.inner = untag_ptr(this_arg);
62888         this_arg_conv.is_owned = ptr_is_owned(this_arg);
62889         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
62890         this_arg_conv.is_owned = false;
62891         LDKChannelPublicKeys ret_var = InMemorySigner_counterparty_pubkeys(&this_arg_conv);
62892         uint64_t ret_ref = 0;
62893         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
62894         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
62895         return ret_ref;
62896 }
62897
62898 uint64_t  __attribute__((export_name("TS_InMemorySigner_counterparty_selected_contest_delay"))) TS_InMemorySigner_counterparty_selected_contest_delay(uint64_t this_arg) {
62899         LDKInMemorySigner this_arg_conv;
62900         this_arg_conv.inner = untag_ptr(this_arg);
62901         this_arg_conv.is_owned = ptr_is_owned(this_arg);
62902         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
62903         this_arg_conv.is_owned = false;
62904         LDKCOption_u16Z *ret_copy = MALLOC(sizeof(LDKCOption_u16Z), "LDKCOption_u16Z");
62905         *ret_copy = InMemorySigner_counterparty_selected_contest_delay(&this_arg_conv);
62906         uint64_t ret_ref = tag_ptr(ret_copy, true);
62907         return ret_ref;
62908 }
62909
62910 uint64_t  __attribute__((export_name("TS_InMemorySigner_holder_selected_contest_delay"))) TS_InMemorySigner_holder_selected_contest_delay(uint64_t this_arg) {
62911         LDKInMemorySigner this_arg_conv;
62912         this_arg_conv.inner = untag_ptr(this_arg);
62913         this_arg_conv.is_owned = ptr_is_owned(this_arg);
62914         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
62915         this_arg_conv.is_owned = false;
62916         LDKCOption_u16Z *ret_copy = MALLOC(sizeof(LDKCOption_u16Z), "LDKCOption_u16Z");
62917         *ret_copy = InMemorySigner_holder_selected_contest_delay(&this_arg_conv);
62918         uint64_t ret_ref = tag_ptr(ret_copy, true);
62919         return ret_ref;
62920 }
62921
62922 uint64_t  __attribute__((export_name("TS_InMemorySigner_is_outbound"))) TS_InMemorySigner_is_outbound(uint64_t this_arg) {
62923         LDKInMemorySigner this_arg_conv;
62924         this_arg_conv.inner = untag_ptr(this_arg);
62925         this_arg_conv.is_owned = ptr_is_owned(this_arg);
62926         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
62927         this_arg_conv.is_owned = false;
62928         LDKCOption_boolZ *ret_copy = MALLOC(sizeof(LDKCOption_boolZ), "LDKCOption_boolZ");
62929         *ret_copy = InMemorySigner_is_outbound(&this_arg_conv);
62930         uint64_t ret_ref = tag_ptr(ret_copy, true);
62931         return ret_ref;
62932 }
62933
62934 uint64_t  __attribute__((export_name("TS_InMemorySigner_funding_outpoint"))) TS_InMemorySigner_funding_outpoint(uint64_t this_arg) {
62935         LDKInMemorySigner this_arg_conv;
62936         this_arg_conv.inner = untag_ptr(this_arg);
62937         this_arg_conv.is_owned = ptr_is_owned(this_arg);
62938         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
62939         this_arg_conv.is_owned = false;
62940         LDKOutPoint ret_var = InMemorySigner_funding_outpoint(&this_arg_conv);
62941         uint64_t ret_ref = 0;
62942         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
62943         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
62944         return ret_ref;
62945 }
62946
62947 uint64_t  __attribute__((export_name("TS_InMemorySigner_get_channel_parameters"))) TS_InMemorySigner_get_channel_parameters(uint64_t this_arg) {
62948         LDKInMemorySigner this_arg_conv;
62949         this_arg_conv.inner = untag_ptr(this_arg);
62950         this_arg_conv.is_owned = ptr_is_owned(this_arg);
62951         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
62952         this_arg_conv.is_owned = false;
62953         LDKChannelTransactionParameters ret_var = InMemorySigner_get_channel_parameters(&this_arg_conv);
62954         uint64_t ret_ref = 0;
62955         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
62956         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
62957         return ret_ref;
62958 }
62959
62960 uint64_t  __attribute__((export_name("TS_InMemorySigner_channel_type_features"))) TS_InMemorySigner_channel_type_features(uint64_t this_arg) {
62961         LDKInMemorySigner this_arg_conv;
62962         this_arg_conv.inner = untag_ptr(this_arg);
62963         this_arg_conv.is_owned = ptr_is_owned(this_arg);
62964         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
62965         this_arg_conv.is_owned = false;
62966         LDKChannelTypeFeatures ret_var = InMemorySigner_channel_type_features(&this_arg_conv);
62967         uint64_t ret_ref = 0;
62968         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
62969         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
62970         return ret_ref;
62971 }
62972
62973 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) {
62974         LDKInMemorySigner this_arg_conv;
62975         this_arg_conv.inner = untag_ptr(this_arg);
62976         this_arg_conv.is_owned = ptr_is_owned(this_arg);
62977         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
62978         this_arg_conv.is_owned = false;
62979         LDKTransaction spend_tx_ref;
62980         spend_tx_ref.datalen = spend_tx->arr_len;
62981         spend_tx_ref.data = MALLOC(spend_tx_ref.datalen, "LDKTransaction Bytes");
62982         memcpy(spend_tx_ref.data, spend_tx->elems, spend_tx_ref.datalen); FREE(spend_tx);
62983         spend_tx_ref.data_is_owned = true;
62984         LDKStaticPaymentOutputDescriptor descriptor_conv;
62985         descriptor_conv.inner = untag_ptr(descriptor);
62986         descriptor_conv.is_owned = ptr_is_owned(descriptor);
62987         CHECK_INNER_FIELD_ACCESS_OR_NULL(descriptor_conv);
62988         descriptor_conv.is_owned = false;
62989         LDKCResult_CVec_CVec_u8ZZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_CVec_u8ZZNoneZ), "LDKCResult_CVec_CVec_u8ZZNoneZ");
62990         *ret_conv = InMemorySigner_sign_counterparty_payment_input(&this_arg_conv, spend_tx_ref, input_idx, &descriptor_conv);
62991         return tag_ptr(ret_conv, true);
62992 }
62993
62994 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) {
62995         LDKInMemorySigner this_arg_conv;
62996         this_arg_conv.inner = untag_ptr(this_arg);
62997         this_arg_conv.is_owned = ptr_is_owned(this_arg);
62998         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
62999         this_arg_conv.is_owned = false;
63000         LDKTransaction spend_tx_ref;
63001         spend_tx_ref.datalen = spend_tx->arr_len;
63002         spend_tx_ref.data = MALLOC(spend_tx_ref.datalen, "LDKTransaction Bytes");
63003         memcpy(spend_tx_ref.data, spend_tx->elems, spend_tx_ref.datalen); FREE(spend_tx);
63004         spend_tx_ref.data_is_owned = true;
63005         LDKDelayedPaymentOutputDescriptor descriptor_conv;
63006         descriptor_conv.inner = untag_ptr(descriptor);
63007         descriptor_conv.is_owned = ptr_is_owned(descriptor);
63008         CHECK_INNER_FIELD_ACCESS_OR_NULL(descriptor_conv);
63009         descriptor_conv.is_owned = false;
63010         LDKCResult_CVec_CVec_u8ZZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_CVec_u8ZZNoneZ), "LDKCResult_CVec_CVec_u8ZZNoneZ");
63011         *ret_conv = InMemorySigner_sign_dynamic_p2wsh_input(&this_arg_conv, spend_tx_ref, input_idx, &descriptor_conv);
63012         return tag_ptr(ret_conv, true);
63013 }
63014
63015 uint64_t  __attribute__((export_name("TS_InMemorySigner_as_EntropySource"))) TS_InMemorySigner_as_EntropySource(uint64_t this_arg) {
63016         LDKInMemorySigner this_arg_conv;
63017         this_arg_conv.inner = untag_ptr(this_arg);
63018         this_arg_conv.is_owned = ptr_is_owned(this_arg);
63019         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
63020         this_arg_conv.is_owned = false;
63021         LDKEntropySource* ret_ret = MALLOC(sizeof(LDKEntropySource), "LDKEntropySource");
63022         *ret_ret = InMemorySigner_as_EntropySource(&this_arg_conv);
63023         return tag_ptr(ret_ret, true);
63024 }
63025
63026 uint64_t  __attribute__((export_name("TS_InMemorySigner_as_ChannelSigner"))) TS_InMemorySigner_as_ChannelSigner(uint64_t this_arg) {
63027         LDKInMemorySigner this_arg_conv;
63028         this_arg_conv.inner = untag_ptr(this_arg);
63029         this_arg_conv.is_owned = ptr_is_owned(this_arg);
63030         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
63031         this_arg_conv.is_owned = false;
63032         LDKChannelSigner* ret_ret = MALLOC(sizeof(LDKChannelSigner), "LDKChannelSigner");
63033         *ret_ret = InMemorySigner_as_ChannelSigner(&this_arg_conv);
63034         return tag_ptr(ret_ret, true);
63035 }
63036
63037 uint64_t  __attribute__((export_name("TS_InMemorySigner_as_EcdsaChannelSigner"))) TS_InMemorySigner_as_EcdsaChannelSigner(uint64_t this_arg) {
63038         LDKInMemorySigner this_arg_conv;
63039         this_arg_conv.inner = untag_ptr(this_arg);
63040         this_arg_conv.is_owned = ptr_is_owned(this_arg);
63041         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
63042         this_arg_conv.is_owned = false;
63043         LDKEcdsaChannelSigner* ret_ret = MALLOC(sizeof(LDKEcdsaChannelSigner), "LDKEcdsaChannelSigner");
63044         *ret_ret = InMemorySigner_as_EcdsaChannelSigner(&this_arg_conv);
63045         return tag_ptr(ret_ret, true);
63046 }
63047
63048 uint64_t  __attribute__((export_name("TS_InMemorySigner_as_WriteableEcdsaChannelSigner"))) TS_InMemorySigner_as_WriteableEcdsaChannelSigner(uint64_t this_arg) {
63049         LDKInMemorySigner this_arg_conv;
63050         this_arg_conv.inner = untag_ptr(this_arg);
63051         this_arg_conv.is_owned = ptr_is_owned(this_arg);
63052         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
63053         this_arg_conv.is_owned = false;
63054         LDKWriteableEcdsaChannelSigner* ret_ret = MALLOC(sizeof(LDKWriteableEcdsaChannelSigner), "LDKWriteableEcdsaChannelSigner");
63055         *ret_ret = InMemorySigner_as_WriteableEcdsaChannelSigner(&this_arg_conv);
63056         return tag_ptr(ret_ret, true);
63057 }
63058
63059 int8_tArray  __attribute__((export_name("TS_InMemorySigner_write"))) TS_InMemorySigner_write(uint64_t obj) {
63060         LDKInMemorySigner obj_conv;
63061         obj_conv.inner = untag_ptr(obj);
63062         obj_conv.is_owned = ptr_is_owned(obj);
63063         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
63064         obj_conv.is_owned = false;
63065         LDKCVec_u8Z ret_var = InMemorySigner_write(&obj_conv);
63066         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
63067         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
63068         CVec_u8Z_free(ret_var);
63069         return ret_arr;
63070 }
63071
63072 uint64_t  __attribute__((export_name("TS_InMemorySigner_read"))) TS_InMemorySigner_read(int8_tArray ser, uint64_t arg) {
63073         LDKu8slice ser_ref;
63074         ser_ref.datalen = ser->arr_len;
63075         ser_ref.data = ser->elems;
63076         void* arg_ptr = untag_ptr(arg);
63077         CHECK_ACCESS(arg_ptr);
63078         LDKEntropySource arg_conv = *(LDKEntropySource*)(arg_ptr);
63079         if (arg_conv.free == LDKEntropySource_JCalls_free) {
63080                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
63081                 LDKEntropySource_JCalls_cloned(&arg_conv);
63082         }
63083         LDKCResult_InMemorySignerDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InMemorySignerDecodeErrorZ), "LDKCResult_InMemorySignerDecodeErrorZ");
63084         *ret_conv = InMemorySigner_read(ser_ref, arg_conv);
63085         FREE(ser);
63086         return tag_ptr(ret_conv, true);
63087 }
63088
63089 void  __attribute__((export_name("TS_KeysManager_free"))) TS_KeysManager_free(uint64_t this_obj) {
63090         LDKKeysManager this_obj_conv;
63091         this_obj_conv.inner = untag_ptr(this_obj);
63092         this_obj_conv.is_owned = ptr_is_owned(this_obj);
63093         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
63094         KeysManager_free(this_obj_conv);
63095 }
63096
63097 uint64_t  __attribute__((export_name("TS_KeysManager_new"))) TS_KeysManager_new(int8_tArray seed, int64_t starting_time_secs, int32_t starting_time_nanos) {
63098         uint8_t seed_arr[32];
63099         CHECK(seed->arr_len == 32);
63100         memcpy(seed_arr, seed->elems, 32); FREE(seed);
63101         uint8_t (*seed_ref)[32] = &seed_arr;
63102         LDKKeysManager ret_var = KeysManager_new(seed_ref, starting_time_secs, starting_time_nanos);
63103         uint64_t ret_ref = 0;
63104         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
63105         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
63106         return ret_ref;
63107 }
63108
63109 int8_tArray  __attribute__((export_name("TS_KeysManager_get_node_secret_key"))) TS_KeysManager_get_node_secret_key(uint64_t this_arg) {
63110         LDKKeysManager this_arg_conv;
63111         this_arg_conv.inner = untag_ptr(this_arg);
63112         this_arg_conv.is_owned = ptr_is_owned(this_arg);
63113         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
63114         this_arg_conv.is_owned = false;
63115         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
63116         memcpy(ret_arr->elems, KeysManager_get_node_secret_key(&this_arg_conv).bytes, 32);
63117         return ret_arr;
63118 }
63119
63120 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) {
63121         LDKKeysManager this_arg_conv;
63122         this_arg_conv.inner = untag_ptr(this_arg);
63123         this_arg_conv.is_owned = ptr_is_owned(this_arg);
63124         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
63125         this_arg_conv.is_owned = false;
63126         uint8_t params_arr[32];
63127         CHECK(params->arr_len == 32);
63128         memcpy(params_arr, params->elems, 32); FREE(params);
63129         uint8_t (*params_ref)[32] = &params_arr;
63130         LDKInMemorySigner ret_var = KeysManager_derive_channel_keys(&this_arg_conv, channel_value_satoshis, params_ref);
63131         uint64_t ret_ref = 0;
63132         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
63133         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
63134         return ret_ref;
63135 }
63136
63137 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) {
63138         LDKKeysManager this_arg_conv;
63139         this_arg_conv.inner = untag_ptr(this_arg);
63140         this_arg_conv.is_owned = ptr_is_owned(this_arg);
63141         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
63142         this_arg_conv.is_owned = false;
63143         LDKCVec_SpendableOutputDescriptorZ descriptors_constr;
63144         descriptors_constr.datalen = descriptors->arr_len;
63145         if (descriptors_constr.datalen > 0)
63146                 descriptors_constr.data = MALLOC(descriptors_constr.datalen * sizeof(LDKSpendableOutputDescriptor), "LDKCVec_SpendableOutputDescriptorZ Elements");
63147         else
63148                 descriptors_constr.data = NULL;
63149         uint64_t* descriptors_vals = descriptors->elems;
63150         for (size_t b = 0; b < descriptors_constr.datalen; b++) {
63151                 uint64_t descriptors_conv_27 = descriptors_vals[b];
63152                 void* descriptors_conv_27_ptr = untag_ptr(descriptors_conv_27);
63153                 CHECK_ACCESS(descriptors_conv_27_ptr);
63154                 LDKSpendableOutputDescriptor descriptors_conv_27_conv = *(LDKSpendableOutputDescriptor*)(descriptors_conv_27_ptr);
63155                 descriptors_conv_27_conv = SpendableOutputDescriptor_clone((LDKSpendableOutputDescriptor*)untag_ptr(descriptors_conv_27));
63156                 descriptors_constr.data[b] = descriptors_conv_27_conv;
63157         }
63158         FREE(descriptors);
63159         LDKCVec_u8Z psbt_ref;
63160         psbt_ref.datalen = psbt->arr_len;
63161         psbt_ref.data = MALLOC(psbt_ref.datalen, "LDKCVec_u8Z Bytes");
63162         memcpy(psbt_ref.data, psbt->elems, psbt_ref.datalen); FREE(psbt);
63163         LDKCResult_CVec_u8ZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_u8ZNoneZ), "LDKCResult_CVec_u8ZNoneZ");
63164         *ret_conv = KeysManager_sign_spendable_outputs_psbt(&this_arg_conv, descriptors_constr, psbt_ref);
63165         return tag_ptr(ret_conv, true);
63166 }
63167
63168 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) {
63169         LDKKeysManager this_arg_conv;
63170         this_arg_conv.inner = untag_ptr(this_arg);
63171         this_arg_conv.is_owned = ptr_is_owned(this_arg);
63172         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
63173         this_arg_conv.is_owned = false;
63174         LDKCVec_SpendableOutputDescriptorZ descriptors_constr;
63175         descriptors_constr.datalen = descriptors->arr_len;
63176         if (descriptors_constr.datalen > 0)
63177                 descriptors_constr.data = MALLOC(descriptors_constr.datalen * sizeof(LDKSpendableOutputDescriptor), "LDKCVec_SpendableOutputDescriptorZ Elements");
63178         else
63179                 descriptors_constr.data = NULL;
63180         uint64_t* descriptors_vals = descriptors->elems;
63181         for (size_t b = 0; b < descriptors_constr.datalen; b++) {
63182                 uint64_t descriptors_conv_27 = descriptors_vals[b];
63183                 void* descriptors_conv_27_ptr = untag_ptr(descriptors_conv_27);
63184                 CHECK_ACCESS(descriptors_conv_27_ptr);
63185                 LDKSpendableOutputDescriptor descriptors_conv_27_conv = *(LDKSpendableOutputDescriptor*)(descriptors_conv_27_ptr);
63186                 descriptors_conv_27_conv = SpendableOutputDescriptor_clone((LDKSpendableOutputDescriptor*)untag_ptr(descriptors_conv_27));
63187                 descriptors_constr.data[b] = descriptors_conv_27_conv;
63188         }
63189         FREE(descriptors);
63190         LDKCVec_TxOutZ outputs_constr;
63191         outputs_constr.datalen = outputs->arr_len;
63192         if (outputs_constr.datalen > 0)
63193                 outputs_constr.data = MALLOC(outputs_constr.datalen * sizeof(LDKTxOut), "LDKCVec_TxOutZ Elements");
63194         else
63195                 outputs_constr.data = NULL;
63196         uint64_t* outputs_vals = outputs->elems;
63197         for (size_t h = 0; h < outputs_constr.datalen; h++) {
63198                 uint64_t outputs_conv_7 = outputs_vals[h];
63199                 void* outputs_conv_7_ptr = untag_ptr(outputs_conv_7);
63200                 CHECK_ACCESS(outputs_conv_7_ptr);
63201                 LDKTxOut outputs_conv_7_conv = *(LDKTxOut*)(outputs_conv_7_ptr);
63202                 outputs_conv_7_conv = TxOut_clone((LDKTxOut*)untag_ptr(outputs_conv_7));
63203                 outputs_constr.data[h] = outputs_conv_7_conv;
63204         }
63205         FREE(outputs);
63206         LDKCVec_u8Z change_destination_script_ref;
63207         change_destination_script_ref.datalen = change_destination_script->arr_len;
63208         change_destination_script_ref.data = MALLOC(change_destination_script_ref.datalen, "LDKCVec_u8Z Bytes");
63209         memcpy(change_destination_script_ref.data, change_destination_script->elems, change_destination_script_ref.datalen); FREE(change_destination_script);
63210         void* locktime_ptr = untag_ptr(locktime);
63211         CHECK_ACCESS(locktime_ptr);
63212         LDKCOption_u32Z locktime_conv = *(LDKCOption_u32Z*)(locktime_ptr);
63213         locktime_conv = COption_u32Z_clone((LDKCOption_u32Z*)untag_ptr(locktime));
63214         LDKCResult_TransactionNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_TransactionNoneZ), "LDKCResult_TransactionNoneZ");
63215         *ret_conv = KeysManager_spend_spendable_outputs(&this_arg_conv, descriptors_constr, outputs_constr, change_destination_script_ref, feerate_sat_per_1000_weight, locktime_conv);
63216         return tag_ptr(ret_conv, true);
63217 }
63218
63219 uint64_t  __attribute__((export_name("TS_KeysManager_as_EntropySource"))) TS_KeysManager_as_EntropySource(uint64_t this_arg) {
63220         LDKKeysManager this_arg_conv;
63221         this_arg_conv.inner = untag_ptr(this_arg);
63222         this_arg_conv.is_owned = ptr_is_owned(this_arg);
63223         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
63224         this_arg_conv.is_owned = false;
63225         LDKEntropySource* ret_ret = MALLOC(sizeof(LDKEntropySource), "LDKEntropySource");
63226         *ret_ret = KeysManager_as_EntropySource(&this_arg_conv);
63227         return tag_ptr(ret_ret, true);
63228 }
63229
63230 uint64_t  __attribute__((export_name("TS_KeysManager_as_NodeSigner"))) TS_KeysManager_as_NodeSigner(uint64_t this_arg) {
63231         LDKKeysManager this_arg_conv;
63232         this_arg_conv.inner = untag_ptr(this_arg);
63233         this_arg_conv.is_owned = ptr_is_owned(this_arg);
63234         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
63235         this_arg_conv.is_owned = false;
63236         LDKNodeSigner* ret_ret = MALLOC(sizeof(LDKNodeSigner), "LDKNodeSigner");
63237         *ret_ret = KeysManager_as_NodeSigner(&this_arg_conv);
63238         return tag_ptr(ret_ret, true);
63239 }
63240
63241 uint64_t  __attribute__((export_name("TS_KeysManager_as_SignerProvider"))) TS_KeysManager_as_SignerProvider(uint64_t this_arg) {
63242         LDKKeysManager this_arg_conv;
63243         this_arg_conv.inner = untag_ptr(this_arg);
63244         this_arg_conv.is_owned = ptr_is_owned(this_arg);
63245         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
63246         this_arg_conv.is_owned = false;
63247         LDKSignerProvider* ret_ret = MALLOC(sizeof(LDKSignerProvider), "LDKSignerProvider");
63248         *ret_ret = KeysManager_as_SignerProvider(&this_arg_conv);
63249         return tag_ptr(ret_ret, true);
63250 }
63251
63252 void  __attribute__((export_name("TS_PhantomKeysManager_free"))) TS_PhantomKeysManager_free(uint64_t this_obj) {
63253         LDKPhantomKeysManager this_obj_conv;
63254         this_obj_conv.inner = untag_ptr(this_obj);
63255         this_obj_conv.is_owned = ptr_is_owned(this_obj);
63256         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
63257         PhantomKeysManager_free(this_obj_conv);
63258 }
63259
63260 uint64_t  __attribute__((export_name("TS_PhantomKeysManager_as_EntropySource"))) TS_PhantomKeysManager_as_EntropySource(uint64_t this_arg) {
63261         LDKPhantomKeysManager this_arg_conv;
63262         this_arg_conv.inner = untag_ptr(this_arg);
63263         this_arg_conv.is_owned = ptr_is_owned(this_arg);
63264         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
63265         this_arg_conv.is_owned = false;
63266         LDKEntropySource* ret_ret = MALLOC(sizeof(LDKEntropySource), "LDKEntropySource");
63267         *ret_ret = PhantomKeysManager_as_EntropySource(&this_arg_conv);
63268         return tag_ptr(ret_ret, true);
63269 }
63270
63271 uint64_t  __attribute__((export_name("TS_PhantomKeysManager_as_NodeSigner"))) TS_PhantomKeysManager_as_NodeSigner(uint64_t this_arg) {
63272         LDKPhantomKeysManager this_arg_conv;
63273         this_arg_conv.inner = untag_ptr(this_arg);
63274         this_arg_conv.is_owned = ptr_is_owned(this_arg);
63275         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
63276         this_arg_conv.is_owned = false;
63277         LDKNodeSigner* ret_ret = MALLOC(sizeof(LDKNodeSigner), "LDKNodeSigner");
63278         *ret_ret = PhantomKeysManager_as_NodeSigner(&this_arg_conv);
63279         return tag_ptr(ret_ret, true);
63280 }
63281
63282 uint64_t  __attribute__((export_name("TS_PhantomKeysManager_as_SignerProvider"))) TS_PhantomKeysManager_as_SignerProvider(uint64_t this_arg) {
63283         LDKPhantomKeysManager this_arg_conv;
63284         this_arg_conv.inner = untag_ptr(this_arg);
63285         this_arg_conv.is_owned = ptr_is_owned(this_arg);
63286         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
63287         this_arg_conv.is_owned = false;
63288         LDKSignerProvider* ret_ret = MALLOC(sizeof(LDKSignerProvider), "LDKSignerProvider");
63289         *ret_ret = PhantomKeysManager_as_SignerProvider(&this_arg_conv);
63290         return tag_ptr(ret_ret, true);
63291 }
63292
63293 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) {
63294         uint8_t seed_arr[32];
63295         CHECK(seed->arr_len == 32);
63296         memcpy(seed_arr, seed->elems, 32); FREE(seed);
63297         uint8_t (*seed_ref)[32] = &seed_arr;
63298         uint8_t cross_node_seed_arr[32];
63299         CHECK(cross_node_seed->arr_len == 32);
63300         memcpy(cross_node_seed_arr, cross_node_seed->elems, 32); FREE(cross_node_seed);
63301         uint8_t (*cross_node_seed_ref)[32] = &cross_node_seed_arr;
63302         LDKPhantomKeysManager ret_var = PhantomKeysManager_new(seed_ref, starting_time_secs, starting_time_nanos, cross_node_seed_ref);
63303         uint64_t ret_ref = 0;
63304         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
63305         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
63306         return ret_ref;
63307 }
63308
63309 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) {
63310         LDKPhantomKeysManager this_arg_conv;
63311         this_arg_conv.inner = untag_ptr(this_arg);
63312         this_arg_conv.is_owned = ptr_is_owned(this_arg);
63313         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
63314         this_arg_conv.is_owned = false;
63315         LDKCVec_SpendableOutputDescriptorZ descriptors_constr;
63316         descriptors_constr.datalen = descriptors->arr_len;
63317         if (descriptors_constr.datalen > 0)
63318                 descriptors_constr.data = MALLOC(descriptors_constr.datalen * sizeof(LDKSpendableOutputDescriptor), "LDKCVec_SpendableOutputDescriptorZ Elements");
63319         else
63320                 descriptors_constr.data = NULL;
63321         uint64_t* descriptors_vals = descriptors->elems;
63322         for (size_t b = 0; b < descriptors_constr.datalen; b++) {
63323                 uint64_t descriptors_conv_27 = descriptors_vals[b];
63324                 void* descriptors_conv_27_ptr = untag_ptr(descriptors_conv_27);
63325                 CHECK_ACCESS(descriptors_conv_27_ptr);
63326                 LDKSpendableOutputDescriptor descriptors_conv_27_conv = *(LDKSpendableOutputDescriptor*)(descriptors_conv_27_ptr);
63327                 descriptors_conv_27_conv = SpendableOutputDescriptor_clone((LDKSpendableOutputDescriptor*)untag_ptr(descriptors_conv_27));
63328                 descriptors_constr.data[b] = descriptors_conv_27_conv;
63329         }
63330         FREE(descriptors);
63331         LDKCVec_TxOutZ outputs_constr;
63332         outputs_constr.datalen = outputs->arr_len;
63333         if (outputs_constr.datalen > 0)
63334                 outputs_constr.data = MALLOC(outputs_constr.datalen * sizeof(LDKTxOut), "LDKCVec_TxOutZ Elements");
63335         else
63336                 outputs_constr.data = NULL;
63337         uint64_t* outputs_vals = outputs->elems;
63338         for (size_t h = 0; h < outputs_constr.datalen; h++) {
63339                 uint64_t outputs_conv_7 = outputs_vals[h];
63340                 void* outputs_conv_7_ptr = untag_ptr(outputs_conv_7);
63341                 CHECK_ACCESS(outputs_conv_7_ptr);
63342                 LDKTxOut outputs_conv_7_conv = *(LDKTxOut*)(outputs_conv_7_ptr);
63343                 outputs_conv_7_conv = TxOut_clone((LDKTxOut*)untag_ptr(outputs_conv_7));
63344                 outputs_constr.data[h] = outputs_conv_7_conv;
63345         }
63346         FREE(outputs);
63347         LDKCVec_u8Z change_destination_script_ref;
63348         change_destination_script_ref.datalen = change_destination_script->arr_len;
63349         change_destination_script_ref.data = MALLOC(change_destination_script_ref.datalen, "LDKCVec_u8Z Bytes");
63350         memcpy(change_destination_script_ref.data, change_destination_script->elems, change_destination_script_ref.datalen); FREE(change_destination_script);
63351         void* locktime_ptr = untag_ptr(locktime);
63352         CHECK_ACCESS(locktime_ptr);
63353         LDKCOption_u32Z locktime_conv = *(LDKCOption_u32Z*)(locktime_ptr);
63354         locktime_conv = COption_u32Z_clone((LDKCOption_u32Z*)untag_ptr(locktime));
63355         LDKCResult_TransactionNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_TransactionNoneZ), "LDKCResult_TransactionNoneZ");
63356         *ret_conv = PhantomKeysManager_spend_spendable_outputs(&this_arg_conv, descriptors_constr, outputs_constr, change_destination_script_ref, feerate_sat_per_1000_weight, locktime_conv);
63357         return tag_ptr(ret_conv, true);
63358 }
63359
63360 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) {
63361         LDKPhantomKeysManager this_arg_conv;
63362         this_arg_conv.inner = untag_ptr(this_arg);
63363         this_arg_conv.is_owned = ptr_is_owned(this_arg);
63364         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
63365         this_arg_conv.is_owned = false;
63366         uint8_t params_arr[32];
63367         CHECK(params->arr_len == 32);
63368         memcpy(params_arr, params->elems, 32); FREE(params);
63369         uint8_t (*params_ref)[32] = &params_arr;
63370         LDKInMemorySigner ret_var = PhantomKeysManager_derive_channel_keys(&this_arg_conv, channel_value_satoshis, params_ref);
63371         uint64_t ret_ref = 0;
63372         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
63373         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
63374         return ret_ref;
63375 }
63376
63377 int8_tArray  __attribute__((export_name("TS_PhantomKeysManager_get_node_secret_key"))) TS_PhantomKeysManager_get_node_secret_key(uint64_t this_arg) {
63378         LDKPhantomKeysManager this_arg_conv;
63379         this_arg_conv.inner = untag_ptr(this_arg);
63380         this_arg_conv.is_owned = ptr_is_owned(this_arg);
63381         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
63382         this_arg_conv.is_owned = false;
63383         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
63384         memcpy(ret_arr->elems, PhantomKeysManager_get_node_secret_key(&this_arg_conv).bytes, 32);
63385         return ret_arr;
63386 }
63387
63388 int8_tArray  __attribute__((export_name("TS_PhantomKeysManager_get_phantom_node_secret_key"))) TS_PhantomKeysManager_get_phantom_node_secret_key(uint64_t this_arg) {
63389         LDKPhantomKeysManager this_arg_conv;
63390         this_arg_conv.inner = untag_ptr(this_arg);
63391         this_arg_conv.is_owned = ptr_is_owned(this_arg);
63392         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
63393         this_arg_conv.is_owned = false;
63394         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
63395         memcpy(ret_arr->elems, PhantomKeysManager_get_phantom_node_secret_key(&this_arg_conv).bytes, 32);
63396         return ret_arr;
63397 }
63398
63399 void  __attribute__((export_name("TS_OnionMessenger_free"))) TS_OnionMessenger_free(uint64_t this_obj) {
63400         LDKOnionMessenger this_obj_conv;
63401         this_obj_conv.inner = untag_ptr(this_obj);
63402         this_obj_conv.is_owned = ptr_is_owned(this_obj);
63403         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
63404         OnionMessenger_free(this_obj_conv);
63405 }
63406
63407 void  __attribute__((export_name("TS_MessageRouter_free"))) TS_MessageRouter_free(uint64_t this_ptr) {
63408         if (!ptr_is_owned(this_ptr)) return;
63409         void* this_ptr_ptr = untag_ptr(this_ptr);
63410         CHECK_ACCESS(this_ptr_ptr);
63411         LDKMessageRouter this_ptr_conv = *(LDKMessageRouter*)(this_ptr_ptr);
63412         FREE(untag_ptr(this_ptr));
63413         MessageRouter_free(this_ptr_conv);
63414 }
63415
63416 void  __attribute__((export_name("TS_DefaultMessageRouter_free"))) TS_DefaultMessageRouter_free(uint64_t this_obj) {
63417         LDKDefaultMessageRouter this_obj_conv;
63418         this_obj_conv.inner = untag_ptr(this_obj);
63419         this_obj_conv.is_owned = ptr_is_owned(this_obj);
63420         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
63421         DefaultMessageRouter_free(this_obj_conv);
63422 }
63423
63424 uint64_t  __attribute__((export_name("TS_DefaultMessageRouter_new"))) TS_DefaultMessageRouter_new() {
63425         LDKDefaultMessageRouter ret_var = DefaultMessageRouter_new();
63426         uint64_t ret_ref = 0;
63427         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
63428         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
63429         return ret_ref;
63430 }
63431
63432 uint64_t  __attribute__((export_name("TS_DefaultMessageRouter_as_MessageRouter"))) TS_DefaultMessageRouter_as_MessageRouter(uint64_t this_arg) {
63433         LDKDefaultMessageRouter this_arg_conv;
63434         this_arg_conv.inner = untag_ptr(this_arg);
63435         this_arg_conv.is_owned = ptr_is_owned(this_arg);
63436         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
63437         this_arg_conv.is_owned = false;
63438         LDKMessageRouter* ret_ret = MALLOC(sizeof(LDKMessageRouter), "LDKMessageRouter");
63439         *ret_ret = DefaultMessageRouter_as_MessageRouter(&this_arg_conv);
63440         return tag_ptr(ret_ret, true);
63441 }
63442
63443 void  __attribute__((export_name("TS_OnionMessagePath_free"))) TS_OnionMessagePath_free(uint64_t this_obj) {
63444         LDKOnionMessagePath this_obj_conv;
63445         this_obj_conv.inner = untag_ptr(this_obj);
63446         this_obj_conv.is_owned = ptr_is_owned(this_obj);
63447         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
63448         OnionMessagePath_free(this_obj_conv);
63449 }
63450
63451 ptrArray  __attribute__((export_name("TS_OnionMessagePath_get_intermediate_nodes"))) TS_OnionMessagePath_get_intermediate_nodes(uint64_t this_ptr) {
63452         LDKOnionMessagePath this_ptr_conv;
63453         this_ptr_conv.inner = untag_ptr(this_ptr);
63454         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
63455         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
63456         this_ptr_conv.is_owned = false;
63457         LDKCVec_PublicKeyZ ret_var = OnionMessagePath_get_intermediate_nodes(&this_ptr_conv);
63458         ptrArray ret_arr = NULL;
63459         ret_arr = init_ptrArray(ret_var.datalen, __LINE__);
63460         int8_tArray *ret_arr_ptr = (int8_tArray*)(((uint8_t*)ret_arr) + 8);
63461         for (size_t m = 0; m < ret_var.datalen; m++) {
63462                 int8_tArray ret_conv_12_arr = init_int8_tArray(33, __LINE__);
63463                 memcpy(ret_conv_12_arr->elems, ret_var.data[m].compressed_form, 33);
63464                 ret_arr_ptr[m] = ret_conv_12_arr;
63465         }
63466         
63467         FREE(ret_var.data);
63468         return ret_arr;
63469 }
63470
63471 void  __attribute__((export_name("TS_OnionMessagePath_set_intermediate_nodes"))) TS_OnionMessagePath_set_intermediate_nodes(uint64_t this_ptr, ptrArray val) {
63472         LDKOnionMessagePath this_ptr_conv;
63473         this_ptr_conv.inner = untag_ptr(this_ptr);
63474         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
63475         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
63476         this_ptr_conv.is_owned = false;
63477         LDKCVec_PublicKeyZ val_constr;
63478         val_constr.datalen = val->arr_len;
63479         if (val_constr.datalen > 0)
63480                 val_constr.data = MALLOC(val_constr.datalen * sizeof(LDKPublicKey), "LDKCVec_PublicKeyZ Elements");
63481         else
63482                 val_constr.data = NULL;
63483         int8_tArray* val_vals = (void*) val->elems;
63484         for (size_t m = 0; m < val_constr.datalen; m++) {
63485                 int8_tArray val_conv_12 = val_vals[m];
63486                 LDKPublicKey val_conv_12_ref;
63487                 CHECK(val_conv_12->arr_len == 33);
63488                 memcpy(val_conv_12_ref.compressed_form, val_conv_12->elems, 33); FREE(val_conv_12);
63489                 val_constr.data[m] = val_conv_12_ref;
63490         }
63491         FREE(val);
63492         OnionMessagePath_set_intermediate_nodes(&this_ptr_conv, val_constr);
63493 }
63494
63495 uint64_t  __attribute__((export_name("TS_OnionMessagePath_get_destination"))) TS_OnionMessagePath_get_destination(uint64_t this_ptr) {
63496         LDKOnionMessagePath this_ptr_conv;
63497         this_ptr_conv.inner = untag_ptr(this_ptr);
63498         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
63499         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
63500         this_ptr_conv.is_owned = false;
63501         LDKDestination *ret_copy = MALLOC(sizeof(LDKDestination), "LDKDestination");
63502         *ret_copy = OnionMessagePath_get_destination(&this_ptr_conv);
63503         uint64_t ret_ref = tag_ptr(ret_copy, true);
63504         return ret_ref;
63505 }
63506
63507 void  __attribute__((export_name("TS_OnionMessagePath_set_destination"))) TS_OnionMessagePath_set_destination(uint64_t this_ptr, uint64_t val) {
63508         LDKOnionMessagePath this_ptr_conv;
63509         this_ptr_conv.inner = untag_ptr(this_ptr);
63510         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
63511         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
63512         this_ptr_conv.is_owned = false;
63513         void* val_ptr = untag_ptr(val);
63514         CHECK_ACCESS(val_ptr);
63515         LDKDestination val_conv = *(LDKDestination*)(val_ptr);
63516         val_conv = Destination_clone((LDKDestination*)untag_ptr(val));
63517         OnionMessagePath_set_destination(&this_ptr_conv, val_conv);
63518 }
63519
63520 uint64_t  __attribute__((export_name("TS_OnionMessagePath_new"))) TS_OnionMessagePath_new(ptrArray intermediate_nodes_arg, uint64_t destination_arg) {
63521         LDKCVec_PublicKeyZ intermediate_nodes_arg_constr;
63522         intermediate_nodes_arg_constr.datalen = intermediate_nodes_arg->arr_len;
63523         if (intermediate_nodes_arg_constr.datalen > 0)
63524                 intermediate_nodes_arg_constr.data = MALLOC(intermediate_nodes_arg_constr.datalen * sizeof(LDKPublicKey), "LDKCVec_PublicKeyZ Elements");
63525         else
63526                 intermediate_nodes_arg_constr.data = NULL;
63527         int8_tArray* intermediate_nodes_arg_vals = (void*) intermediate_nodes_arg->elems;
63528         for (size_t m = 0; m < intermediate_nodes_arg_constr.datalen; m++) {
63529                 int8_tArray intermediate_nodes_arg_conv_12 = intermediate_nodes_arg_vals[m];
63530                 LDKPublicKey intermediate_nodes_arg_conv_12_ref;
63531                 CHECK(intermediate_nodes_arg_conv_12->arr_len == 33);
63532                 memcpy(intermediate_nodes_arg_conv_12_ref.compressed_form, intermediate_nodes_arg_conv_12->elems, 33); FREE(intermediate_nodes_arg_conv_12);
63533                 intermediate_nodes_arg_constr.data[m] = intermediate_nodes_arg_conv_12_ref;
63534         }
63535         FREE(intermediate_nodes_arg);
63536         void* destination_arg_ptr = untag_ptr(destination_arg);
63537         CHECK_ACCESS(destination_arg_ptr);
63538         LDKDestination destination_arg_conv = *(LDKDestination*)(destination_arg_ptr);
63539         destination_arg_conv = Destination_clone((LDKDestination*)untag_ptr(destination_arg));
63540         LDKOnionMessagePath ret_var = OnionMessagePath_new(intermediate_nodes_arg_constr, destination_arg_conv);
63541         uint64_t ret_ref = 0;
63542         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
63543         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
63544         return ret_ref;
63545 }
63546
63547 static inline uint64_t OnionMessagePath_clone_ptr(LDKOnionMessagePath *NONNULL_PTR arg) {
63548         LDKOnionMessagePath ret_var = OnionMessagePath_clone(arg);
63549         uint64_t ret_ref = 0;
63550         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
63551         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
63552         return ret_ref;
63553 }
63554 int64_t  __attribute__((export_name("TS_OnionMessagePath_clone_ptr"))) TS_OnionMessagePath_clone_ptr(uint64_t arg) {
63555         LDKOnionMessagePath arg_conv;
63556         arg_conv.inner = untag_ptr(arg);
63557         arg_conv.is_owned = ptr_is_owned(arg);
63558         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
63559         arg_conv.is_owned = false;
63560         int64_t ret_conv = OnionMessagePath_clone_ptr(&arg_conv);
63561         return ret_conv;
63562 }
63563
63564 uint64_t  __attribute__((export_name("TS_OnionMessagePath_clone"))) TS_OnionMessagePath_clone(uint64_t orig) {
63565         LDKOnionMessagePath orig_conv;
63566         orig_conv.inner = untag_ptr(orig);
63567         orig_conv.is_owned = ptr_is_owned(orig);
63568         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
63569         orig_conv.is_owned = false;
63570         LDKOnionMessagePath ret_var = OnionMessagePath_clone(&orig_conv);
63571         uint64_t ret_ref = 0;
63572         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
63573         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
63574         return ret_ref;
63575 }
63576
63577 void  __attribute__((export_name("TS_Destination_free"))) TS_Destination_free(uint64_t this_ptr) {
63578         if (!ptr_is_owned(this_ptr)) return;
63579         void* this_ptr_ptr = untag_ptr(this_ptr);
63580         CHECK_ACCESS(this_ptr_ptr);
63581         LDKDestination this_ptr_conv = *(LDKDestination*)(this_ptr_ptr);
63582         FREE(untag_ptr(this_ptr));
63583         Destination_free(this_ptr_conv);
63584 }
63585
63586 static inline uint64_t Destination_clone_ptr(LDKDestination *NONNULL_PTR arg) {
63587         LDKDestination *ret_copy = MALLOC(sizeof(LDKDestination), "LDKDestination");
63588         *ret_copy = Destination_clone(arg);
63589         uint64_t ret_ref = tag_ptr(ret_copy, true);
63590         return ret_ref;
63591 }
63592 int64_t  __attribute__((export_name("TS_Destination_clone_ptr"))) TS_Destination_clone_ptr(uint64_t arg) {
63593         LDKDestination* arg_conv = (LDKDestination*)untag_ptr(arg);
63594         int64_t ret_conv = Destination_clone_ptr(arg_conv);
63595         return ret_conv;
63596 }
63597
63598 uint64_t  __attribute__((export_name("TS_Destination_clone"))) TS_Destination_clone(uint64_t orig) {
63599         LDKDestination* orig_conv = (LDKDestination*)untag_ptr(orig);
63600         LDKDestination *ret_copy = MALLOC(sizeof(LDKDestination), "LDKDestination");
63601         *ret_copy = Destination_clone(orig_conv);
63602         uint64_t ret_ref = tag_ptr(ret_copy, true);
63603         return ret_ref;
63604 }
63605
63606 uint64_t  __attribute__((export_name("TS_Destination_node"))) TS_Destination_node(int8_tArray a) {
63607         LDKPublicKey a_ref;
63608         CHECK(a->arr_len == 33);
63609         memcpy(a_ref.compressed_form, a->elems, 33); FREE(a);
63610         LDKDestination *ret_copy = MALLOC(sizeof(LDKDestination), "LDKDestination");
63611         *ret_copy = Destination_node(a_ref);
63612         uint64_t ret_ref = tag_ptr(ret_copy, true);
63613         return ret_ref;
63614 }
63615
63616 uint64_t  __attribute__((export_name("TS_Destination_blinded_path"))) TS_Destination_blinded_path(uint64_t a) {
63617         LDKBlindedPath a_conv;
63618         a_conv.inner = untag_ptr(a);
63619         a_conv.is_owned = ptr_is_owned(a);
63620         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
63621         a_conv = BlindedPath_clone(&a_conv);
63622         LDKDestination *ret_copy = MALLOC(sizeof(LDKDestination), "LDKDestination");
63623         *ret_copy = Destination_blinded_path(a_conv);
63624         uint64_t ret_ref = tag_ptr(ret_copy, true);
63625         return ret_ref;
63626 }
63627
63628 void  __attribute__((export_name("TS_SendError_free"))) TS_SendError_free(uint64_t this_ptr) {
63629         if (!ptr_is_owned(this_ptr)) return;
63630         void* this_ptr_ptr = untag_ptr(this_ptr);
63631         CHECK_ACCESS(this_ptr_ptr);
63632         LDKSendError this_ptr_conv = *(LDKSendError*)(this_ptr_ptr);
63633         FREE(untag_ptr(this_ptr));
63634         SendError_free(this_ptr_conv);
63635 }
63636
63637 static inline uint64_t SendError_clone_ptr(LDKSendError *NONNULL_PTR arg) {
63638         LDKSendError *ret_copy = MALLOC(sizeof(LDKSendError), "LDKSendError");
63639         *ret_copy = SendError_clone(arg);
63640         uint64_t ret_ref = tag_ptr(ret_copy, true);
63641         return ret_ref;
63642 }
63643 int64_t  __attribute__((export_name("TS_SendError_clone_ptr"))) TS_SendError_clone_ptr(uint64_t arg) {
63644         LDKSendError* arg_conv = (LDKSendError*)untag_ptr(arg);
63645         int64_t ret_conv = SendError_clone_ptr(arg_conv);
63646         return ret_conv;
63647 }
63648
63649 uint64_t  __attribute__((export_name("TS_SendError_clone"))) TS_SendError_clone(uint64_t orig) {
63650         LDKSendError* orig_conv = (LDKSendError*)untag_ptr(orig);
63651         LDKSendError *ret_copy = MALLOC(sizeof(LDKSendError), "LDKSendError");
63652         *ret_copy = SendError_clone(orig_conv);
63653         uint64_t ret_ref = tag_ptr(ret_copy, true);
63654         return ret_ref;
63655 }
63656
63657 uint64_t  __attribute__((export_name("TS_SendError_secp256k1"))) TS_SendError_secp256k1(uint32_t a) {
63658         LDKSecp256k1Error a_conv = LDKSecp256k1Error_from_js(a);
63659         LDKSendError *ret_copy = MALLOC(sizeof(LDKSendError), "LDKSendError");
63660         *ret_copy = SendError_secp256k1(a_conv);
63661         uint64_t ret_ref = tag_ptr(ret_copy, true);
63662         return ret_ref;
63663 }
63664
63665 uint64_t  __attribute__((export_name("TS_SendError_too_big_packet"))) TS_SendError_too_big_packet() {
63666         LDKSendError *ret_copy = MALLOC(sizeof(LDKSendError), "LDKSendError");
63667         *ret_copy = SendError_too_big_packet();
63668         uint64_t ret_ref = tag_ptr(ret_copy, true);
63669         return ret_ref;
63670 }
63671
63672 uint64_t  __attribute__((export_name("TS_SendError_too_few_blinded_hops"))) TS_SendError_too_few_blinded_hops() {
63673         LDKSendError *ret_copy = MALLOC(sizeof(LDKSendError), "LDKSendError");
63674         *ret_copy = SendError_too_few_blinded_hops();
63675         uint64_t ret_ref = tag_ptr(ret_copy, true);
63676         return ret_ref;
63677 }
63678
63679 uint64_t  __attribute__((export_name("TS_SendError_invalid_first_hop"))) TS_SendError_invalid_first_hop() {
63680         LDKSendError *ret_copy = MALLOC(sizeof(LDKSendError), "LDKSendError");
63681         *ret_copy = SendError_invalid_first_hop();
63682         uint64_t ret_ref = tag_ptr(ret_copy, true);
63683         return ret_ref;
63684 }
63685
63686 uint64_t  __attribute__((export_name("TS_SendError_invalid_message"))) TS_SendError_invalid_message() {
63687         LDKSendError *ret_copy = MALLOC(sizeof(LDKSendError), "LDKSendError");
63688         *ret_copy = SendError_invalid_message();
63689         uint64_t ret_ref = tag_ptr(ret_copy, true);
63690         return ret_ref;
63691 }
63692
63693 uint64_t  __attribute__((export_name("TS_SendError_buffer_full"))) TS_SendError_buffer_full() {
63694         LDKSendError *ret_copy = MALLOC(sizeof(LDKSendError), "LDKSendError");
63695         *ret_copy = SendError_buffer_full();
63696         uint64_t ret_ref = tag_ptr(ret_copy, true);
63697         return ret_ref;
63698 }
63699
63700 uint64_t  __attribute__((export_name("TS_SendError_get_node_id_failed"))) TS_SendError_get_node_id_failed() {
63701         LDKSendError *ret_copy = MALLOC(sizeof(LDKSendError), "LDKSendError");
63702         *ret_copy = SendError_get_node_id_failed();
63703         uint64_t ret_ref = tag_ptr(ret_copy, true);
63704         return ret_ref;
63705 }
63706
63707 uint64_t  __attribute__((export_name("TS_SendError_blinded_path_advance_failed"))) TS_SendError_blinded_path_advance_failed() {
63708         LDKSendError *ret_copy = MALLOC(sizeof(LDKSendError), "LDKSendError");
63709         *ret_copy = SendError_blinded_path_advance_failed();
63710         uint64_t ret_ref = tag_ptr(ret_copy, true);
63711         return ret_ref;
63712 }
63713
63714 jboolean  __attribute__((export_name("TS_SendError_eq"))) TS_SendError_eq(uint64_t a, uint64_t b) {
63715         LDKSendError* a_conv = (LDKSendError*)untag_ptr(a);
63716         LDKSendError* b_conv = (LDKSendError*)untag_ptr(b);
63717         jboolean ret_conv = SendError_eq(a_conv, b_conv);
63718         return ret_conv;
63719 }
63720
63721 void  __attribute__((export_name("TS_CustomOnionMessageHandler_free"))) TS_CustomOnionMessageHandler_free(uint64_t this_ptr) {
63722         if (!ptr_is_owned(this_ptr)) return;
63723         void* this_ptr_ptr = untag_ptr(this_ptr);
63724         CHECK_ACCESS(this_ptr_ptr);
63725         LDKCustomOnionMessageHandler this_ptr_conv = *(LDKCustomOnionMessageHandler*)(this_ptr_ptr);
63726         FREE(untag_ptr(this_ptr));
63727         CustomOnionMessageHandler_free(this_ptr_conv);
63728 }
63729
63730 void  __attribute__((export_name("TS_PeeledOnion_free"))) TS_PeeledOnion_free(uint64_t this_ptr) {
63731         if (!ptr_is_owned(this_ptr)) return;
63732         void* this_ptr_ptr = untag_ptr(this_ptr);
63733         CHECK_ACCESS(this_ptr_ptr);
63734         LDKPeeledOnion this_ptr_conv = *(LDKPeeledOnion*)(this_ptr_ptr);
63735         FREE(untag_ptr(this_ptr));
63736         PeeledOnion_free(this_ptr_conv);
63737 }
63738
63739 static inline uint64_t PeeledOnion_clone_ptr(LDKPeeledOnion *NONNULL_PTR arg) {
63740         LDKPeeledOnion *ret_copy = MALLOC(sizeof(LDKPeeledOnion), "LDKPeeledOnion");
63741         *ret_copy = PeeledOnion_clone(arg);
63742         uint64_t ret_ref = tag_ptr(ret_copy, true);
63743         return ret_ref;
63744 }
63745 int64_t  __attribute__((export_name("TS_PeeledOnion_clone_ptr"))) TS_PeeledOnion_clone_ptr(uint64_t arg) {
63746         LDKPeeledOnion* arg_conv = (LDKPeeledOnion*)untag_ptr(arg);
63747         int64_t ret_conv = PeeledOnion_clone_ptr(arg_conv);
63748         return ret_conv;
63749 }
63750
63751 uint64_t  __attribute__((export_name("TS_PeeledOnion_clone"))) TS_PeeledOnion_clone(uint64_t orig) {
63752         LDKPeeledOnion* orig_conv = (LDKPeeledOnion*)untag_ptr(orig);
63753         LDKPeeledOnion *ret_copy = MALLOC(sizeof(LDKPeeledOnion), "LDKPeeledOnion");
63754         *ret_copy = PeeledOnion_clone(orig_conv);
63755         uint64_t ret_ref = tag_ptr(ret_copy, true);
63756         return ret_ref;
63757 }
63758
63759 uint64_t  __attribute__((export_name("TS_PeeledOnion_forward"))) TS_PeeledOnion_forward(int8_tArray a, uint64_t b) {
63760         LDKPublicKey a_ref;
63761         CHECK(a->arr_len == 33);
63762         memcpy(a_ref.compressed_form, a->elems, 33); FREE(a);
63763         LDKOnionMessage b_conv;
63764         b_conv.inner = untag_ptr(b);
63765         b_conv.is_owned = ptr_is_owned(b);
63766         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
63767         b_conv = OnionMessage_clone(&b_conv);
63768         LDKPeeledOnion *ret_copy = MALLOC(sizeof(LDKPeeledOnion), "LDKPeeledOnion");
63769         *ret_copy = PeeledOnion_forward(a_ref, b_conv);
63770         uint64_t ret_ref = tag_ptr(ret_copy, true);
63771         return ret_ref;
63772 }
63773
63774 uint64_t  __attribute__((export_name("TS_PeeledOnion_receive"))) TS_PeeledOnion_receive(uint64_t a, int8_tArray b, uint64_t c) {
63775         void* a_ptr = untag_ptr(a);
63776         CHECK_ACCESS(a_ptr);
63777         LDKParsedOnionMessageContents a_conv = *(LDKParsedOnionMessageContents*)(a_ptr);
63778         a_conv = ParsedOnionMessageContents_clone((LDKParsedOnionMessageContents*)untag_ptr(a));
63779         LDKThirtyTwoBytes b_ref;
63780         CHECK(b->arr_len == 32);
63781         memcpy(b_ref.data, b->elems, 32); FREE(b);
63782         LDKBlindedPath c_conv;
63783         c_conv.inner = untag_ptr(c);
63784         c_conv.is_owned = ptr_is_owned(c);
63785         CHECK_INNER_FIELD_ACCESS_OR_NULL(c_conv);
63786         c_conv = BlindedPath_clone(&c_conv);
63787         LDKPeeledOnion *ret_copy = MALLOC(sizeof(LDKPeeledOnion), "LDKPeeledOnion");
63788         *ret_copy = PeeledOnion_receive(a_conv, b_ref, c_conv);
63789         uint64_t ret_ref = tag_ptr(ret_copy, true);
63790         return ret_ref;
63791 }
63792
63793 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) {
63794         void* entropy_source_ptr = untag_ptr(entropy_source);
63795         if (ptr_is_owned(entropy_source)) { CHECK_ACCESS(entropy_source_ptr); }
63796         LDKEntropySource* entropy_source_conv = (LDKEntropySource*)entropy_source_ptr;
63797         void* node_signer_ptr = untag_ptr(node_signer);
63798         if (ptr_is_owned(node_signer)) { CHECK_ACCESS(node_signer_ptr); }
63799         LDKNodeSigner* node_signer_conv = (LDKNodeSigner*)node_signer_ptr;
63800         LDKOnionMessagePath path_conv;
63801         path_conv.inner = untag_ptr(path);
63802         path_conv.is_owned = ptr_is_owned(path);
63803         CHECK_INNER_FIELD_ACCESS_OR_NULL(path_conv);
63804         path_conv = OnionMessagePath_clone(&path_conv);
63805         void* contents_ptr = untag_ptr(contents);
63806         CHECK_ACCESS(contents_ptr);
63807         LDKOnionMessageContents contents_conv = *(LDKOnionMessageContents*)(contents_ptr);
63808         if (contents_conv.free == LDKOnionMessageContents_JCalls_free) {
63809                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
63810                 LDKOnionMessageContents_JCalls_cloned(&contents_conv);
63811         }
63812         LDKBlindedPath reply_path_conv;
63813         reply_path_conv.inner = untag_ptr(reply_path);
63814         reply_path_conv.is_owned = ptr_is_owned(reply_path);
63815         CHECK_INNER_FIELD_ACCESS_OR_NULL(reply_path_conv);
63816         reply_path_conv = BlindedPath_clone(&reply_path_conv);
63817         LDKCResult_C2Tuple_PublicKeyOnionMessageZSendErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_PublicKeyOnionMessageZSendErrorZ), "LDKCResult_C2Tuple_PublicKeyOnionMessageZSendErrorZ");
63818         *ret_conv = create_onion_message(entropy_source_conv, node_signer_conv, path_conv, contents_conv, reply_path_conv);
63819         return tag_ptr(ret_conv, true);
63820 }
63821
63822 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) {
63823         LDKOnionMessage msg_conv;
63824         msg_conv.inner = untag_ptr(msg);
63825         msg_conv.is_owned = ptr_is_owned(msg);
63826         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
63827         msg_conv.is_owned = false;
63828         void* node_signer_ptr = untag_ptr(node_signer);
63829         CHECK_ACCESS(node_signer_ptr);
63830         LDKNodeSigner node_signer_conv = *(LDKNodeSigner*)(node_signer_ptr);
63831         if (node_signer_conv.free == LDKNodeSigner_JCalls_free) {
63832                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
63833                 LDKNodeSigner_JCalls_cloned(&node_signer_conv);
63834         }
63835         void* logger_ptr = untag_ptr(logger);
63836         CHECK_ACCESS(logger_ptr);
63837         LDKLogger logger_conv = *(LDKLogger*)(logger_ptr);
63838         if (logger_conv.free == LDKLogger_JCalls_free) {
63839                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
63840                 LDKLogger_JCalls_cloned(&logger_conv);
63841         }
63842         void* custom_handler_ptr = untag_ptr(custom_handler);
63843         CHECK_ACCESS(custom_handler_ptr);
63844         LDKCustomOnionMessageHandler custom_handler_conv = *(LDKCustomOnionMessageHandler*)(custom_handler_ptr);
63845         if (custom_handler_conv.free == LDKCustomOnionMessageHandler_JCalls_free) {
63846                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
63847                 LDKCustomOnionMessageHandler_JCalls_cloned(&custom_handler_conv);
63848         }
63849         LDKCResult_PeeledOnionNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_PeeledOnionNoneZ), "LDKCResult_PeeledOnionNoneZ");
63850         *ret_conv = peel_onion_message(&msg_conv, node_signer_conv, logger_conv, custom_handler_conv);
63851         return tag_ptr(ret_conv, true);
63852 }
63853
63854 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) {
63855         void* entropy_source_ptr = untag_ptr(entropy_source);
63856         CHECK_ACCESS(entropy_source_ptr);
63857         LDKEntropySource entropy_source_conv = *(LDKEntropySource*)(entropy_source_ptr);
63858         if (entropy_source_conv.free == LDKEntropySource_JCalls_free) {
63859                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
63860                 LDKEntropySource_JCalls_cloned(&entropy_source_conv);
63861         }
63862         void* node_signer_ptr = untag_ptr(node_signer);
63863         CHECK_ACCESS(node_signer_ptr);
63864         LDKNodeSigner node_signer_conv = *(LDKNodeSigner*)(node_signer_ptr);
63865         if (node_signer_conv.free == LDKNodeSigner_JCalls_free) {
63866                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
63867                 LDKNodeSigner_JCalls_cloned(&node_signer_conv);
63868         }
63869         void* logger_ptr = untag_ptr(logger);
63870         CHECK_ACCESS(logger_ptr);
63871         LDKLogger logger_conv = *(LDKLogger*)(logger_ptr);
63872         if (logger_conv.free == LDKLogger_JCalls_free) {
63873                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
63874                 LDKLogger_JCalls_cloned(&logger_conv);
63875         }
63876         void* message_router_ptr = untag_ptr(message_router);
63877         CHECK_ACCESS(message_router_ptr);
63878         LDKMessageRouter message_router_conv = *(LDKMessageRouter*)(message_router_ptr);
63879         if (message_router_conv.free == LDKMessageRouter_JCalls_free) {
63880                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
63881                 LDKMessageRouter_JCalls_cloned(&message_router_conv);
63882         }
63883         void* offers_handler_ptr = untag_ptr(offers_handler);
63884         CHECK_ACCESS(offers_handler_ptr);
63885         LDKOffersMessageHandler offers_handler_conv = *(LDKOffersMessageHandler*)(offers_handler_ptr);
63886         if (offers_handler_conv.free == LDKOffersMessageHandler_JCalls_free) {
63887                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
63888                 LDKOffersMessageHandler_JCalls_cloned(&offers_handler_conv);
63889         }
63890         void* custom_handler_ptr = untag_ptr(custom_handler);
63891         CHECK_ACCESS(custom_handler_ptr);
63892         LDKCustomOnionMessageHandler custom_handler_conv = *(LDKCustomOnionMessageHandler*)(custom_handler_ptr);
63893         if (custom_handler_conv.free == LDKCustomOnionMessageHandler_JCalls_free) {
63894                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
63895                 LDKCustomOnionMessageHandler_JCalls_cloned(&custom_handler_conv);
63896         }
63897         LDKOnionMessenger ret_var = OnionMessenger_new(entropy_source_conv, node_signer_conv, logger_conv, message_router_conv, offers_handler_conv, custom_handler_conv);
63898         uint64_t ret_ref = 0;
63899         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
63900         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
63901         return ret_ref;
63902 }
63903
63904 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) {
63905         LDKOnionMessenger this_arg_conv;
63906         this_arg_conv.inner = untag_ptr(this_arg);
63907         this_arg_conv.is_owned = ptr_is_owned(this_arg);
63908         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
63909         this_arg_conv.is_owned = false;
63910         LDKOnionMessagePath path_conv;
63911         path_conv.inner = untag_ptr(path);
63912         path_conv.is_owned = ptr_is_owned(path);
63913         CHECK_INNER_FIELD_ACCESS_OR_NULL(path_conv);
63914         path_conv = OnionMessagePath_clone(&path_conv);
63915         void* contents_ptr = untag_ptr(contents);
63916         CHECK_ACCESS(contents_ptr);
63917         LDKOnionMessageContents contents_conv = *(LDKOnionMessageContents*)(contents_ptr);
63918         if (contents_conv.free == LDKOnionMessageContents_JCalls_free) {
63919                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
63920                 LDKOnionMessageContents_JCalls_cloned(&contents_conv);
63921         }
63922         LDKBlindedPath reply_path_conv;
63923         reply_path_conv.inner = untag_ptr(reply_path);
63924         reply_path_conv.is_owned = ptr_is_owned(reply_path);
63925         CHECK_INNER_FIELD_ACCESS_OR_NULL(reply_path_conv);
63926         reply_path_conv = BlindedPath_clone(&reply_path_conv);
63927         LDKCResult_NoneSendErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneSendErrorZ), "LDKCResult_NoneSendErrorZ");
63928         *ret_conv = OnionMessenger_send_onion_message(&this_arg_conv, path_conv, contents_conv, reply_path_conv);
63929         return tag_ptr(ret_conv, true);
63930 }
63931
63932 uint64_t  __attribute__((export_name("TS_OnionMessenger_as_OnionMessageHandler"))) TS_OnionMessenger_as_OnionMessageHandler(uint64_t this_arg) {
63933         LDKOnionMessenger this_arg_conv;
63934         this_arg_conv.inner = untag_ptr(this_arg);
63935         this_arg_conv.is_owned = ptr_is_owned(this_arg);
63936         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
63937         this_arg_conv.is_owned = false;
63938         LDKOnionMessageHandler* ret_ret = MALLOC(sizeof(LDKOnionMessageHandler), "LDKOnionMessageHandler");
63939         *ret_ret = OnionMessenger_as_OnionMessageHandler(&this_arg_conv);
63940         return tag_ptr(ret_ret, true);
63941 }
63942
63943 void  __attribute__((export_name("TS_OffersMessageHandler_free"))) TS_OffersMessageHandler_free(uint64_t this_ptr) {
63944         if (!ptr_is_owned(this_ptr)) return;
63945         void* this_ptr_ptr = untag_ptr(this_ptr);
63946         CHECK_ACCESS(this_ptr_ptr);
63947         LDKOffersMessageHandler this_ptr_conv = *(LDKOffersMessageHandler*)(this_ptr_ptr);
63948         FREE(untag_ptr(this_ptr));
63949         OffersMessageHandler_free(this_ptr_conv);
63950 }
63951
63952 void  __attribute__((export_name("TS_OffersMessage_free"))) TS_OffersMessage_free(uint64_t this_ptr) {
63953         if (!ptr_is_owned(this_ptr)) return;
63954         void* this_ptr_ptr = untag_ptr(this_ptr);
63955         CHECK_ACCESS(this_ptr_ptr);
63956         LDKOffersMessage this_ptr_conv = *(LDKOffersMessage*)(this_ptr_ptr);
63957         FREE(untag_ptr(this_ptr));
63958         OffersMessage_free(this_ptr_conv);
63959 }
63960
63961 static inline uint64_t OffersMessage_clone_ptr(LDKOffersMessage *NONNULL_PTR arg) {
63962         LDKOffersMessage *ret_copy = MALLOC(sizeof(LDKOffersMessage), "LDKOffersMessage");
63963         *ret_copy = OffersMessage_clone(arg);
63964         uint64_t ret_ref = tag_ptr(ret_copy, true);
63965         return ret_ref;
63966 }
63967 int64_t  __attribute__((export_name("TS_OffersMessage_clone_ptr"))) TS_OffersMessage_clone_ptr(uint64_t arg) {
63968         LDKOffersMessage* arg_conv = (LDKOffersMessage*)untag_ptr(arg);
63969         int64_t ret_conv = OffersMessage_clone_ptr(arg_conv);
63970         return ret_conv;
63971 }
63972
63973 uint64_t  __attribute__((export_name("TS_OffersMessage_clone"))) TS_OffersMessage_clone(uint64_t orig) {
63974         LDKOffersMessage* orig_conv = (LDKOffersMessage*)untag_ptr(orig);
63975         LDKOffersMessage *ret_copy = MALLOC(sizeof(LDKOffersMessage), "LDKOffersMessage");
63976         *ret_copy = OffersMessage_clone(orig_conv);
63977         uint64_t ret_ref = tag_ptr(ret_copy, true);
63978         return ret_ref;
63979 }
63980
63981 uint64_t  __attribute__((export_name("TS_OffersMessage_invoice_request"))) TS_OffersMessage_invoice_request(uint64_t a) {
63982         LDKInvoiceRequest a_conv;
63983         a_conv.inner = untag_ptr(a);
63984         a_conv.is_owned = ptr_is_owned(a);
63985         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
63986         a_conv = InvoiceRequest_clone(&a_conv);
63987         LDKOffersMessage *ret_copy = MALLOC(sizeof(LDKOffersMessage), "LDKOffersMessage");
63988         *ret_copy = OffersMessage_invoice_request(a_conv);
63989         uint64_t ret_ref = tag_ptr(ret_copy, true);
63990         return ret_ref;
63991 }
63992
63993 uint64_t  __attribute__((export_name("TS_OffersMessage_invoice"))) TS_OffersMessage_invoice(uint64_t a) {
63994         LDKBolt12Invoice a_conv;
63995         a_conv.inner = untag_ptr(a);
63996         a_conv.is_owned = ptr_is_owned(a);
63997         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
63998         a_conv = Bolt12Invoice_clone(&a_conv);
63999         LDKOffersMessage *ret_copy = MALLOC(sizeof(LDKOffersMessage), "LDKOffersMessage");
64000         *ret_copy = OffersMessage_invoice(a_conv);
64001         uint64_t ret_ref = tag_ptr(ret_copy, true);
64002         return ret_ref;
64003 }
64004
64005 uint64_t  __attribute__((export_name("TS_OffersMessage_invoice_error"))) TS_OffersMessage_invoice_error(uint64_t a) {
64006         LDKInvoiceError a_conv;
64007         a_conv.inner = untag_ptr(a);
64008         a_conv.is_owned = ptr_is_owned(a);
64009         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
64010         a_conv = InvoiceError_clone(&a_conv);
64011         LDKOffersMessage *ret_copy = MALLOC(sizeof(LDKOffersMessage), "LDKOffersMessage");
64012         *ret_copy = OffersMessage_invoice_error(a_conv);
64013         uint64_t ret_ref = tag_ptr(ret_copy, true);
64014         return ret_ref;
64015 }
64016
64017 jboolean  __attribute__((export_name("TS_OffersMessage_is_known_type"))) TS_OffersMessage_is_known_type(int64_t tlv_type) {
64018         jboolean ret_conv = OffersMessage_is_known_type(tlv_type);
64019         return ret_conv;
64020 }
64021
64022 int8_tArray  __attribute__((export_name("TS_OffersMessage_write"))) TS_OffersMessage_write(uint64_t obj) {
64023         LDKOffersMessage* obj_conv = (LDKOffersMessage*)untag_ptr(obj);
64024         LDKCVec_u8Z ret_var = OffersMessage_write(obj_conv);
64025         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
64026         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
64027         CVec_u8Z_free(ret_var);
64028         return ret_arr;
64029 }
64030
64031 uint64_t  __attribute__((export_name("TS_OffersMessage_read"))) TS_OffersMessage_read(int8_tArray ser, int64_t arg_a, uint64_t arg_b) {
64032         LDKu8slice ser_ref;
64033         ser_ref.datalen = ser->arr_len;
64034         ser_ref.data = ser->elems;
64035         void* arg_b_ptr = untag_ptr(arg_b);
64036         if (ptr_is_owned(arg_b)) { CHECK_ACCESS(arg_b_ptr); }
64037         LDKLogger* arg_b_conv = (LDKLogger*)arg_b_ptr;
64038         LDKCResult_OffersMessageDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_OffersMessageDecodeErrorZ), "LDKCResult_OffersMessageDecodeErrorZ");
64039         *ret_conv = OffersMessage_read(ser_ref, arg_a, arg_b_conv);
64040         FREE(ser);
64041         return tag_ptr(ret_conv, true);
64042 }
64043
64044 void  __attribute__((export_name("TS_Packet_free"))) TS_Packet_free(uint64_t this_obj) {
64045         LDKPacket this_obj_conv;
64046         this_obj_conv.inner = untag_ptr(this_obj);
64047         this_obj_conv.is_owned = ptr_is_owned(this_obj);
64048         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
64049         Packet_free(this_obj_conv);
64050 }
64051
64052 int8_t  __attribute__((export_name("TS_Packet_get_version"))) TS_Packet_get_version(uint64_t this_ptr) {
64053         LDKPacket this_ptr_conv;
64054         this_ptr_conv.inner = untag_ptr(this_ptr);
64055         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
64056         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
64057         this_ptr_conv.is_owned = false;
64058         int8_t ret_conv = Packet_get_version(&this_ptr_conv);
64059         return ret_conv;
64060 }
64061
64062 void  __attribute__((export_name("TS_Packet_set_version"))) TS_Packet_set_version(uint64_t this_ptr, int8_t val) {
64063         LDKPacket this_ptr_conv;
64064         this_ptr_conv.inner = untag_ptr(this_ptr);
64065         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
64066         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
64067         this_ptr_conv.is_owned = false;
64068         Packet_set_version(&this_ptr_conv, val);
64069 }
64070
64071 int8_tArray  __attribute__((export_name("TS_Packet_get_public_key"))) TS_Packet_get_public_key(uint64_t this_ptr) {
64072         LDKPacket this_ptr_conv;
64073         this_ptr_conv.inner = untag_ptr(this_ptr);
64074         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
64075         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
64076         this_ptr_conv.is_owned = false;
64077         int8_tArray ret_arr = init_int8_tArray(33, __LINE__);
64078         memcpy(ret_arr->elems, Packet_get_public_key(&this_ptr_conv).compressed_form, 33);
64079         return ret_arr;
64080 }
64081
64082 void  __attribute__((export_name("TS_Packet_set_public_key"))) TS_Packet_set_public_key(uint64_t this_ptr, int8_tArray val) {
64083         LDKPacket this_ptr_conv;
64084         this_ptr_conv.inner = untag_ptr(this_ptr);
64085         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
64086         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
64087         this_ptr_conv.is_owned = false;
64088         LDKPublicKey val_ref;
64089         CHECK(val->arr_len == 33);
64090         memcpy(val_ref.compressed_form, val->elems, 33); FREE(val);
64091         Packet_set_public_key(&this_ptr_conv, val_ref);
64092 }
64093
64094 int8_tArray  __attribute__((export_name("TS_Packet_get_hop_data"))) TS_Packet_get_hop_data(uint64_t this_ptr) {
64095         LDKPacket this_ptr_conv;
64096         this_ptr_conv.inner = untag_ptr(this_ptr);
64097         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
64098         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
64099         this_ptr_conv.is_owned = false;
64100         LDKCVec_u8Z ret_var = Packet_get_hop_data(&this_ptr_conv);
64101         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
64102         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
64103         CVec_u8Z_free(ret_var);
64104         return ret_arr;
64105 }
64106
64107 void  __attribute__((export_name("TS_Packet_set_hop_data"))) TS_Packet_set_hop_data(uint64_t this_ptr, int8_tArray val) {
64108         LDKPacket this_ptr_conv;
64109         this_ptr_conv.inner = untag_ptr(this_ptr);
64110         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
64111         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
64112         this_ptr_conv.is_owned = false;
64113         LDKCVec_u8Z val_ref;
64114         val_ref.datalen = val->arr_len;
64115         val_ref.data = MALLOC(val_ref.datalen, "LDKCVec_u8Z Bytes");
64116         memcpy(val_ref.data, val->elems, val_ref.datalen); FREE(val);
64117         Packet_set_hop_data(&this_ptr_conv, val_ref);
64118 }
64119
64120 int8_tArray  __attribute__((export_name("TS_Packet_get_hmac"))) TS_Packet_get_hmac(uint64_t this_ptr) {
64121         LDKPacket this_ptr_conv;
64122         this_ptr_conv.inner = untag_ptr(this_ptr);
64123         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
64124         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
64125         this_ptr_conv.is_owned = false;
64126         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
64127         memcpy(ret_arr->elems, *Packet_get_hmac(&this_ptr_conv), 32);
64128         return ret_arr;
64129 }
64130
64131 void  __attribute__((export_name("TS_Packet_set_hmac"))) TS_Packet_set_hmac(uint64_t this_ptr, int8_tArray val) {
64132         LDKPacket this_ptr_conv;
64133         this_ptr_conv.inner = untag_ptr(this_ptr);
64134         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
64135         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
64136         this_ptr_conv.is_owned = false;
64137         LDKThirtyTwoBytes val_ref;
64138         CHECK(val->arr_len == 32);
64139         memcpy(val_ref.data, val->elems, 32); FREE(val);
64140         Packet_set_hmac(&this_ptr_conv, val_ref);
64141 }
64142
64143 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) {
64144         LDKPublicKey public_key_arg_ref;
64145         CHECK(public_key_arg->arr_len == 33);
64146         memcpy(public_key_arg_ref.compressed_form, public_key_arg->elems, 33); FREE(public_key_arg);
64147         LDKCVec_u8Z hop_data_arg_ref;
64148         hop_data_arg_ref.datalen = hop_data_arg->arr_len;
64149         hop_data_arg_ref.data = MALLOC(hop_data_arg_ref.datalen, "LDKCVec_u8Z Bytes");
64150         memcpy(hop_data_arg_ref.data, hop_data_arg->elems, hop_data_arg_ref.datalen); FREE(hop_data_arg);
64151         LDKThirtyTwoBytes hmac_arg_ref;
64152         CHECK(hmac_arg->arr_len == 32);
64153         memcpy(hmac_arg_ref.data, hmac_arg->elems, 32); FREE(hmac_arg);
64154         LDKPacket ret_var = Packet_new(version_arg, public_key_arg_ref, hop_data_arg_ref, hmac_arg_ref);
64155         uint64_t ret_ref = 0;
64156         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
64157         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
64158         return ret_ref;
64159 }
64160
64161 static inline uint64_t Packet_clone_ptr(LDKPacket *NONNULL_PTR arg) {
64162         LDKPacket ret_var = Packet_clone(arg);
64163         uint64_t ret_ref = 0;
64164         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
64165         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
64166         return ret_ref;
64167 }
64168 int64_t  __attribute__((export_name("TS_Packet_clone_ptr"))) TS_Packet_clone_ptr(uint64_t arg) {
64169         LDKPacket arg_conv;
64170         arg_conv.inner = untag_ptr(arg);
64171         arg_conv.is_owned = ptr_is_owned(arg);
64172         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
64173         arg_conv.is_owned = false;
64174         int64_t ret_conv = Packet_clone_ptr(&arg_conv);
64175         return ret_conv;
64176 }
64177
64178 uint64_t  __attribute__((export_name("TS_Packet_clone"))) TS_Packet_clone(uint64_t orig) {
64179         LDKPacket orig_conv;
64180         orig_conv.inner = untag_ptr(orig);
64181         orig_conv.is_owned = ptr_is_owned(orig);
64182         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
64183         orig_conv.is_owned = false;
64184         LDKPacket ret_var = Packet_clone(&orig_conv);
64185         uint64_t ret_ref = 0;
64186         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
64187         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
64188         return ret_ref;
64189 }
64190
64191 jboolean  __attribute__((export_name("TS_Packet_eq"))) TS_Packet_eq(uint64_t a, uint64_t b) {
64192         LDKPacket a_conv;
64193         a_conv.inner = untag_ptr(a);
64194         a_conv.is_owned = ptr_is_owned(a);
64195         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
64196         a_conv.is_owned = false;
64197         LDKPacket b_conv;
64198         b_conv.inner = untag_ptr(b);
64199         b_conv.is_owned = ptr_is_owned(b);
64200         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
64201         b_conv.is_owned = false;
64202         jboolean ret_conv = Packet_eq(&a_conv, &b_conv);
64203         return ret_conv;
64204 }
64205
64206 int8_tArray  __attribute__((export_name("TS_Packet_write"))) TS_Packet_write(uint64_t obj) {
64207         LDKPacket obj_conv;
64208         obj_conv.inner = untag_ptr(obj);
64209         obj_conv.is_owned = ptr_is_owned(obj);
64210         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
64211         obj_conv.is_owned = false;
64212         LDKCVec_u8Z ret_var = Packet_write(&obj_conv);
64213         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
64214         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
64215         CVec_u8Z_free(ret_var);
64216         return ret_arr;
64217 }
64218
64219 void  __attribute__((export_name("TS_ParsedOnionMessageContents_free"))) TS_ParsedOnionMessageContents_free(uint64_t this_ptr) {
64220         if (!ptr_is_owned(this_ptr)) return;
64221         void* this_ptr_ptr = untag_ptr(this_ptr);
64222         CHECK_ACCESS(this_ptr_ptr);
64223         LDKParsedOnionMessageContents this_ptr_conv = *(LDKParsedOnionMessageContents*)(this_ptr_ptr);
64224         FREE(untag_ptr(this_ptr));
64225         ParsedOnionMessageContents_free(this_ptr_conv);
64226 }
64227
64228 static inline uint64_t ParsedOnionMessageContents_clone_ptr(LDKParsedOnionMessageContents *NONNULL_PTR arg) {
64229         LDKParsedOnionMessageContents *ret_copy = MALLOC(sizeof(LDKParsedOnionMessageContents), "LDKParsedOnionMessageContents");
64230         *ret_copy = ParsedOnionMessageContents_clone(arg);
64231         uint64_t ret_ref = tag_ptr(ret_copy, true);
64232         return ret_ref;
64233 }
64234 int64_t  __attribute__((export_name("TS_ParsedOnionMessageContents_clone_ptr"))) TS_ParsedOnionMessageContents_clone_ptr(uint64_t arg) {
64235         LDKParsedOnionMessageContents* arg_conv = (LDKParsedOnionMessageContents*)untag_ptr(arg);
64236         int64_t ret_conv = ParsedOnionMessageContents_clone_ptr(arg_conv);
64237         return ret_conv;
64238 }
64239
64240 uint64_t  __attribute__((export_name("TS_ParsedOnionMessageContents_clone"))) TS_ParsedOnionMessageContents_clone(uint64_t orig) {
64241         LDKParsedOnionMessageContents* orig_conv = (LDKParsedOnionMessageContents*)untag_ptr(orig);
64242         LDKParsedOnionMessageContents *ret_copy = MALLOC(sizeof(LDKParsedOnionMessageContents), "LDKParsedOnionMessageContents");
64243         *ret_copy = ParsedOnionMessageContents_clone(orig_conv);
64244         uint64_t ret_ref = tag_ptr(ret_copy, true);
64245         return ret_ref;
64246 }
64247
64248 uint64_t  __attribute__((export_name("TS_ParsedOnionMessageContents_offers"))) TS_ParsedOnionMessageContents_offers(uint64_t a) {
64249         void* a_ptr = untag_ptr(a);
64250         CHECK_ACCESS(a_ptr);
64251         LDKOffersMessage a_conv = *(LDKOffersMessage*)(a_ptr);
64252         a_conv = OffersMessage_clone((LDKOffersMessage*)untag_ptr(a));
64253         LDKParsedOnionMessageContents *ret_copy = MALLOC(sizeof(LDKParsedOnionMessageContents), "LDKParsedOnionMessageContents");
64254         *ret_copy = ParsedOnionMessageContents_offers(a_conv);
64255         uint64_t ret_ref = tag_ptr(ret_copy, true);
64256         return ret_ref;
64257 }
64258
64259 uint64_t  __attribute__((export_name("TS_ParsedOnionMessageContents_custom"))) TS_ParsedOnionMessageContents_custom(uint64_t a) {
64260         void* a_ptr = untag_ptr(a);
64261         CHECK_ACCESS(a_ptr);
64262         LDKOnionMessageContents a_conv = *(LDKOnionMessageContents*)(a_ptr);
64263         if (a_conv.free == LDKOnionMessageContents_JCalls_free) {
64264                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
64265                 LDKOnionMessageContents_JCalls_cloned(&a_conv);
64266         }
64267         LDKParsedOnionMessageContents *ret_copy = MALLOC(sizeof(LDKParsedOnionMessageContents), "LDKParsedOnionMessageContents");
64268         *ret_copy = ParsedOnionMessageContents_custom(a_conv);
64269         uint64_t ret_ref = tag_ptr(ret_copy, true);
64270         return ret_ref;
64271 }
64272
64273 uint64_t  __attribute__((export_name("TS_ParsedOnionMessageContents_as_OnionMessageContents"))) TS_ParsedOnionMessageContents_as_OnionMessageContents(uint64_t this_arg) {
64274         LDKParsedOnionMessageContents* this_arg_conv = (LDKParsedOnionMessageContents*)untag_ptr(this_arg);
64275         LDKOnionMessageContents* ret_ret = MALLOC(sizeof(LDKOnionMessageContents), "LDKOnionMessageContents");
64276         *ret_ret = ParsedOnionMessageContents_as_OnionMessageContents(this_arg_conv);
64277         return tag_ptr(ret_ret, true);
64278 }
64279
64280 int8_tArray  __attribute__((export_name("TS_ParsedOnionMessageContents_write"))) TS_ParsedOnionMessageContents_write(uint64_t obj) {
64281         LDKParsedOnionMessageContents* obj_conv = (LDKParsedOnionMessageContents*)untag_ptr(obj);
64282         LDKCVec_u8Z ret_var = ParsedOnionMessageContents_write(obj_conv);
64283         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
64284         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
64285         CVec_u8Z_free(ret_var);
64286         return ret_arr;
64287 }
64288
64289 static inline uint64_t OnionMessageContents_clone_ptr(LDKOnionMessageContents *NONNULL_PTR arg) {
64290         LDKOnionMessageContents* ret_ret = MALLOC(sizeof(LDKOnionMessageContents), "LDKOnionMessageContents");
64291         *ret_ret = OnionMessageContents_clone(arg);
64292         return tag_ptr(ret_ret, true);
64293 }
64294 int64_t  __attribute__((export_name("TS_OnionMessageContents_clone_ptr"))) TS_OnionMessageContents_clone_ptr(uint64_t arg) {
64295         void* arg_ptr = untag_ptr(arg);
64296         if (ptr_is_owned(arg)) { CHECK_ACCESS(arg_ptr); }
64297         LDKOnionMessageContents* arg_conv = (LDKOnionMessageContents*)arg_ptr;
64298         int64_t ret_conv = OnionMessageContents_clone_ptr(arg_conv);
64299         return ret_conv;
64300 }
64301
64302 uint64_t  __attribute__((export_name("TS_OnionMessageContents_clone"))) TS_OnionMessageContents_clone(uint64_t orig) {
64303         void* orig_ptr = untag_ptr(orig);
64304         if (ptr_is_owned(orig)) { CHECK_ACCESS(orig_ptr); }
64305         LDKOnionMessageContents* orig_conv = (LDKOnionMessageContents*)orig_ptr;
64306         LDKOnionMessageContents* ret_ret = MALLOC(sizeof(LDKOnionMessageContents), "LDKOnionMessageContents");
64307         *ret_ret = OnionMessageContents_clone(orig_conv);
64308         return tag_ptr(ret_ret, true);
64309 }
64310
64311 void  __attribute__((export_name("TS_OnionMessageContents_free"))) TS_OnionMessageContents_free(uint64_t this_ptr) {
64312         if (!ptr_is_owned(this_ptr)) return;
64313         void* this_ptr_ptr = untag_ptr(this_ptr);
64314         CHECK_ACCESS(this_ptr_ptr);
64315         LDKOnionMessageContents this_ptr_conv = *(LDKOnionMessageContents*)(this_ptr_ptr);
64316         FREE(untag_ptr(this_ptr));
64317         OnionMessageContents_free(this_ptr_conv);
64318 }
64319
64320 void  __attribute__((export_name("TS_BlindedPath_free"))) TS_BlindedPath_free(uint64_t this_obj) {
64321         LDKBlindedPath this_obj_conv;
64322         this_obj_conv.inner = untag_ptr(this_obj);
64323         this_obj_conv.is_owned = ptr_is_owned(this_obj);
64324         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
64325         BlindedPath_free(this_obj_conv);
64326 }
64327
64328 int8_tArray  __attribute__((export_name("TS_BlindedPath_get_introduction_node_id"))) TS_BlindedPath_get_introduction_node_id(uint64_t this_ptr) {
64329         LDKBlindedPath this_ptr_conv;
64330         this_ptr_conv.inner = untag_ptr(this_ptr);
64331         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
64332         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
64333         this_ptr_conv.is_owned = false;
64334         int8_tArray ret_arr = init_int8_tArray(33, __LINE__);
64335         memcpy(ret_arr->elems, BlindedPath_get_introduction_node_id(&this_ptr_conv).compressed_form, 33);
64336         return ret_arr;
64337 }
64338
64339 void  __attribute__((export_name("TS_BlindedPath_set_introduction_node_id"))) TS_BlindedPath_set_introduction_node_id(uint64_t this_ptr, int8_tArray val) {
64340         LDKBlindedPath this_ptr_conv;
64341         this_ptr_conv.inner = untag_ptr(this_ptr);
64342         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
64343         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
64344         this_ptr_conv.is_owned = false;
64345         LDKPublicKey val_ref;
64346         CHECK(val->arr_len == 33);
64347         memcpy(val_ref.compressed_form, val->elems, 33); FREE(val);
64348         BlindedPath_set_introduction_node_id(&this_ptr_conv, val_ref);
64349 }
64350
64351 int8_tArray  __attribute__((export_name("TS_BlindedPath_get_blinding_point"))) TS_BlindedPath_get_blinding_point(uint64_t this_ptr) {
64352         LDKBlindedPath this_ptr_conv;
64353         this_ptr_conv.inner = untag_ptr(this_ptr);
64354         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
64355         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
64356         this_ptr_conv.is_owned = false;
64357         int8_tArray ret_arr = init_int8_tArray(33, __LINE__);
64358         memcpy(ret_arr->elems, BlindedPath_get_blinding_point(&this_ptr_conv).compressed_form, 33);
64359         return ret_arr;
64360 }
64361
64362 void  __attribute__((export_name("TS_BlindedPath_set_blinding_point"))) TS_BlindedPath_set_blinding_point(uint64_t this_ptr, int8_tArray val) {
64363         LDKBlindedPath this_ptr_conv;
64364         this_ptr_conv.inner = untag_ptr(this_ptr);
64365         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
64366         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
64367         this_ptr_conv.is_owned = false;
64368         LDKPublicKey val_ref;
64369         CHECK(val->arr_len == 33);
64370         memcpy(val_ref.compressed_form, val->elems, 33); FREE(val);
64371         BlindedPath_set_blinding_point(&this_ptr_conv, val_ref);
64372 }
64373
64374 uint64_tArray  __attribute__((export_name("TS_BlindedPath_get_blinded_hops"))) TS_BlindedPath_get_blinded_hops(uint64_t this_ptr) {
64375         LDKBlindedPath this_ptr_conv;
64376         this_ptr_conv.inner = untag_ptr(this_ptr);
64377         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
64378         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
64379         this_ptr_conv.is_owned = false;
64380         LDKCVec_BlindedHopZ ret_var = BlindedPath_get_blinded_hops(&this_ptr_conv);
64381         uint64_tArray ret_arr = NULL;
64382         ret_arr = init_uint64_tArray(ret_var.datalen, __LINE__);
64383         uint64_t *ret_arr_ptr = (uint64_t*)(((uint8_t*)ret_arr) + 8);
64384         for (size_t m = 0; m < ret_var.datalen; m++) {
64385                 LDKBlindedHop ret_conv_12_var = ret_var.data[m];
64386                 uint64_t ret_conv_12_ref = 0;
64387                 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_conv_12_var);
64388                 ret_conv_12_ref = tag_ptr(ret_conv_12_var.inner, ret_conv_12_var.is_owned);
64389                 ret_arr_ptr[m] = ret_conv_12_ref;
64390         }
64391         
64392         FREE(ret_var.data);
64393         return ret_arr;
64394 }
64395
64396 void  __attribute__((export_name("TS_BlindedPath_set_blinded_hops"))) TS_BlindedPath_set_blinded_hops(uint64_t this_ptr, uint64_tArray val) {
64397         LDKBlindedPath this_ptr_conv;
64398         this_ptr_conv.inner = untag_ptr(this_ptr);
64399         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
64400         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
64401         this_ptr_conv.is_owned = false;
64402         LDKCVec_BlindedHopZ val_constr;
64403         val_constr.datalen = val->arr_len;
64404         if (val_constr.datalen > 0)
64405                 val_constr.data = MALLOC(val_constr.datalen * sizeof(LDKBlindedHop), "LDKCVec_BlindedHopZ Elements");
64406         else
64407                 val_constr.data = NULL;
64408         uint64_t* val_vals = val->elems;
64409         for (size_t m = 0; m < val_constr.datalen; m++) {
64410                 uint64_t val_conv_12 = val_vals[m];
64411                 LDKBlindedHop val_conv_12_conv;
64412                 val_conv_12_conv.inner = untag_ptr(val_conv_12);
64413                 val_conv_12_conv.is_owned = ptr_is_owned(val_conv_12);
64414                 CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv_12_conv);
64415                 val_conv_12_conv = BlindedHop_clone(&val_conv_12_conv);
64416                 val_constr.data[m] = val_conv_12_conv;
64417         }
64418         FREE(val);
64419         BlindedPath_set_blinded_hops(&this_ptr_conv, val_constr);
64420 }
64421
64422 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) {
64423         LDKPublicKey introduction_node_id_arg_ref;
64424         CHECK(introduction_node_id_arg->arr_len == 33);
64425         memcpy(introduction_node_id_arg_ref.compressed_form, introduction_node_id_arg->elems, 33); FREE(introduction_node_id_arg);
64426         LDKPublicKey blinding_point_arg_ref;
64427         CHECK(blinding_point_arg->arr_len == 33);
64428         memcpy(blinding_point_arg_ref.compressed_form, blinding_point_arg->elems, 33); FREE(blinding_point_arg);
64429         LDKCVec_BlindedHopZ blinded_hops_arg_constr;
64430         blinded_hops_arg_constr.datalen = blinded_hops_arg->arr_len;
64431         if (blinded_hops_arg_constr.datalen > 0)
64432                 blinded_hops_arg_constr.data = MALLOC(blinded_hops_arg_constr.datalen * sizeof(LDKBlindedHop), "LDKCVec_BlindedHopZ Elements");
64433         else
64434                 blinded_hops_arg_constr.data = NULL;
64435         uint64_t* blinded_hops_arg_vals = blinded_hops_arg->elems;
64436         for (size_t m = 0; m < blinded_hops_arg_constr.datalen; m++) {
64437                 uint64_t blinded_hops_arg_conv_12 = blinded_hops_arg_vals[m];
64438                 LDKBlindedHop blinded_hops_arg_conv_12_conv;
64439                 blinded_hops_arg_conv_12_conv.inner = untag_ptr(blinded_hops_arg_conv_12);
64440                 blinded_hops_arg_conv_12_conv.is_owned = ptr_is_owned(blinded_hops_arg_conv_12);
64441                 CHECK_INNER_FIELD_ACCESS_OR_NULL(blinded_hops_arg_conv_12_conv);
64442                 blinded_hops_arg_conv_12_conv = BlindedHop_clone(&blinded_hops_arg_conv_12_conv);
64443                 blinded_hops_arg_constr.data[m] = blinded_hops_arg_conv_12_conv;
64444         }
64445         FREE(blinded_hops_arg);
64446         LDKBlindedPath ret_var = BlindedPath_new(introduction_node_id_arg_ref, blinding_point_arg_ref, blinded_hops_arg_constr);
64447         uint64_t ret_ref = 0;
64448         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
64449         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
64450         return ret_ref;
64451 }
64452
64453 static inline uint64_t BlindedPath_clone_ptr(LDKBlindedPath *NONNULL_PTR arg) {
64454         LDKBlindedPath ret_var = BlindedPath_clone(arg);
64455         uint64_t ret_ref = 0;
64456         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
64457         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
64458         return ret_ref;
64459 }
64460 int64_t  __attribute__((export_name("TS_BlindedPath_clone_ptr"))) TS_BlindedPath_clone_ptr(uint64_t arg) {
64461         LDKBlindedPath arg_conv;
64462         arg_conv.inner = untag_ptr(arg);
64463         arg_conv.is_owned = ptr_is_owned(arg);
64464         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
64465         arg_conv.is_owned = false;
64466         int64_t ret_conv = BlindedPath_clone_ptr(&arg_conv);
64467         return ret_conv;
64468 }
64469
64470 uint64_t  __attribute__((export_name("TS_BlindedPath_clone"))) TS_BlindedPath_clone(uint64_t orig) {
64471         LDKBlindedPath orig_conv;
64472         orig_conv.inner = untag_ptr(orig);
64473         orig_conv.is_owned = ptr_is_owned(orig);
64474         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
64475         orig_conv.is_owned = false;
64476         LDKBlindedPath ret_var = BlindedPath_clone(&orig_conv);
64477         uint64_t ret_ref = 0;
64478         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
64479         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
64480         return ret_ref;
64481 }
64482
64483 int64_t  __attribute__((export_name("TS_BlindedPath_hash"))) TS_BlindedPath_hash(uint64_t o) {
64484         LDKBlindedPath o_conv;
64485         o_conv.inner = untag_ptr(o);
64486         o_conv.is_owned = ptr_is_owned(o);
64487         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
64488         o_conv.is_owned = false;
64489         int64_t ret_conv = BlindedPath_hash(&o_conv);
64490         return ret_conv;
64491 }
64492
64493 jboolean  __attribute__((export_name("TS_BlindedPath_eq"))) TS_BlindedPath_eq(uint64_t a, uint64_t b) {
64494         LDKBlindedPath a_conv;
64495         a_conv.inner = untag_ptr(a);
64496         a_conv.is_owned = ptr_is_owned(a);
64497         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
64498         a_conv.is_owned = false;
64499         LDKBlindedPath b_conv;
64500         b_conv.inner = untag_ptr(b);
64501         b_conv.is_owned = ptr_is_owned(b);
64502         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
64503         b_conv.is_owned = false;
64504         jboolean ret_conv = BlindedPath_eq(&a_conv, &b_conv);
64505         return ret_conv;
64506 }
64507
64508 void  __attribute__((export_name("TS_BlindedHop_free"))) TS_BlindedHop_free(uint64_t this_obj) {
64509         LDKBlindedHop this_obj_conv;
64510         this_obj_conv.inner = untag_ptr(this_obj);
64511         this_obj_conv.is_owned = ptr_is_owned(this_obj);
64512         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
64513         BlindedHop_free(this_obj_conv);
64514 }
64515
64516 int8_tArray  __attribute__((export_name("TS_BlindedHop_get_blinded_node_id"))) TS_BlindedHop_get_blinded_node_id(uint64_t this_ptr) {
64517         LDKBlindedHop this_ptr_conv;
64518         this_ptr_conv.inner = untag_ptr(this_ptr);
64519         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
64520         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
64521         this_ptr_conv.is_owned = false;
64522         int8_tArray ret_arr = init_int8_tArray(33, __LINE__);
64523         memcpy(ret_arr->elems, BlindedHop_get_blinded_node_id(&this_ptr_conv).compressed_form, 33);
64524         return ret_arr;
64525 }
64526
64527 void  __attribute__((export_name("TS_BlindedHop_set_blinded_node_id"))) TS_BlindedHop_set_blinded_node_id(uint64_t this_ptr, int8_tArray val) {
64528         LDKBlindedHop this_ptr_conv;
64529         this_ptr_conv.inner = untag_ptr(this_ptr);
64530         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
64531         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
64532         this_ptr_conv.is_owned = false;
64533         LDKPublicKey val_ref;
64534         CHECK(val->arr_len == 33);
64535         memcpy(val_ref.compressed_form, val->elems, 33); FREE(val);
64536         BlindedHop_set_blinded_node_id(&this_ptr_conv, val_ref);
64537 }
64538
64539 int8_tArray  __attribute__((export_name("TS_BlindedHop_get_encrypted_payload"))) TS_BlindedHop_get_encrypted_payload(uint64_t this_ptr) {
64540         LDKBlindedHop this_ptr_conv;
64541         this_ptr_conv.inner = untag_ptr(this_ptr);
64542         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
64543         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
64544         this_ptr_conv.is_owned = false;
64545         LDKCVec_u8Z ret_var = BlindedHop_get_encrypted_payload(&this_ptr_conv);
64546         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
64547         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
64548         CVec_u8Z_free(ret_var);
64549         return ret_arr;
64550 }
64551
64552 void  __attribute__((export_name("TS_BlindedHop_set_encrypted_payload"))) TS_BlindedHop_set_encrypted_payload(uint64_t this_ptr, int8_tArray val) {
64553         LDKBlindedHop this_ptr_conv;
64554         this_ptr_conv.inner = untag_ptr(this_ptr);
64555         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
64556         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
64557         this_ptr_conv.is_owned = false;
64558         LDKCVec_u8Z val_ref;
64559         val_ref.datalen = val->arr_len;
64560         val_ref.data = MALLOC(val_ref.datalen, "LDKCVec_u8Z Bytes");
64561         memcpy(val_ref.data, val->elems, val_ref.datalen); FREE(val);
64562         BlindedHop_set_encrypted_payload(&this_ptr_conv, val_ref);
64563 }
64564
64565 uint64_t  __attribute__((export_name("TS_BlindedHop_new"))) TS_BlindedHop_new(int8_tArray blinded_node_id_arg, int8_tArray encrypted_payload_arg) {
64566         LDKPublicKey blinded_node_id_arg_ref;
64567         CHECK(blinded_node_id_arg->arr_len == 33);
64568         memcpy(blinded_node_id_arg_ref.compressed_form, blinded_node_id_arg->elems, 33); FREE(blinded_node_id_arg);
64569         LDKCVec_u8Z encrypted_payload_arg_ref;
64570         encrypted_payload_arg_ref.datalen = encrypted_payload_arg->arr_len;
64571         encrypted_payload_arg_ref.data = MALLOC(encrypted_payload_arg_ref.datalen, "LDKCVec_u8Z Bytes");
64572         memcpy(encrypted_payload_arg_ref.data, encrypted_payload_arg->elems, encrypted_payload_arg_ref.datalen); FREE(encrypted_payload_arg);
64573         LDKBlindedHop ret_var = BlindedHop_new(blinded_node_id_arg_ref, encrypted_payload_arg_ref);
64574         uint64_t ret_ref = 0;
64575         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
64576         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
64577         return ret_ref;
64578 }
64579
64580 static inline uint64_t BlindedHop_clone_ptr(LDKBlindedHop *NONNULL_PTR arg) {
64581         LDKBlindedHop ret_var = BlindedHop_clone(arg);
64582         uint64_t ret_ref = 0;
64583         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
64584         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
64585         return ret_ref;
64586 }
64587 int64_t  __attribute__((export_name("TS_BlindedHop_clone_ptr"))) TS_BlindedHop_clone_ptr(uint64_t arg) {
64588         LDKBlindedHop arg_conv;
64589         arg_conv.inner = untag_ptr(arg);
64590         arg_conv.is_owned = ptr_is_owned(arg);
64591         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
64592         arg_conv.is_owned = false;
64593         int64_t ret_conv = BlindedHop_clone_ptr(&arg_conv);
64594         return ret_conv;
64595 }
64596
64597 uint64_t  __attribute__((export_name("TS_BlindedHop_clone"))) TS_BlindedHop_clone(uint64_t orig) {
64598         LDKBlindedHop orig_conv;
64599         orig_conv.inner = untag_ptr(orig);
64600         orig_conv.is_owned = ptr_is_owned(orig);
64601         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
64602         orig_conv.is_owned = false;
64603         LDKBlindedHop ret_var = BlindedHop_clone(&orig_conv);
64604         uint64_t ret_ref = 0;
64605         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
64606         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
64607         return ret_ref;
64608 }
64609
64610 int64_t  __attribute__((export_name("TS_BlindedHop_hash"))) TS_BlindedHop_hash(uint64_t o) {
64611         LDKBlindedHop o_conv;
64612         o_conv.inner = untag_ptr(o);
64613         o_conv.is_owned = ptr_is_owned(o);
64614         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
64615         o_conv.is_owned = false;
64616         int64_t ret_conv = BlindedHop_hash(&o_conv);
64617         return ret_conv;
64618 }
64619
64620 jboolean  __attribute__((export_name("TS_BlindedHop_eq"))) TS_BlindedHop_eq(uint64_t a, uint64_t b) {
64621         LDKBlindedHop a_conv;
64622         a_conv.inner = untag_ptr(a);
64623         a_conv.is_owned = ptr_is_owned(a);
64624         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
64625         a_conv.is_owned = false;
64626         LDKBlindedHop b_conv;
64627         b_conv.inner = untag_ptr(b);
64628         b_conv.is_owned = ptr_is_owned(b);
64629         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
64630         b_conv.is_owned = false;
64631         jboolean ret_conv = BlindedHop_eq(&a_conv, &b_conv);
64632         return ret_conv;
64633 }
64634
64635 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) {
64636         LDKPublicKey recipient_node_id_ref;
64637         CHECK(recipient_node_id->arr_len == 33);
64638         memcpy(recipient_node_id_ref.compressed_form, recipient_node_id->elems, 33); FREE(recipient_node_id);
64639         void* entropy_source_ptr = untag_ptr(entropy_source);
64640         if (ptr_is_owned(entropy_source)) { CHECK_ACCESS(entropy_source_ptr); }
64641         LDKEntropySource* entropy_source_conv = (LDKEntropySource*)entropy_source_ptr;
64642         LDKCResult_BlindedPathNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_BlindedPathNoneZ), "LDKCResult_BlindedPathNoneZ");
64643         *ret_conv = BlindedPath_one_hop_for_message(recipient_node_id_ref, entropy_source_conv);
64644         return tag_ptr(ret_conv, true);
64645 }
64646
64647 uint64_t  __attribute__((export_name("TS_BlindedPath_new_for_message"))) TS_BlindedPath_new_for_message(ptrArray node_pks, uint64_t entropy_source) {
64648         LDKCVec_PublicKeyZ node_pks_constr;
64649         node_pks_constr.datalen = node_pks->arr_len;
64650         if (node_pks_constr.datalen > 0)
64651                 node_pks_constr.data = MALLOC(node_pks_constr.datalen * sizeof(LDKPublicKey), "LDKCVec_PublicKeyZ Elements");
64652         else
64653                 node_pks_constr.data = NULL;
64654         int8_tArray* node_pks_vals = (void*) node_pks->elems;
64655         for (size_t m = 0; m < node_pks_constr.datalen; m++) {
64656                 int8_tArray node_pks_conv_12 = node_pks_vals[m];
64657                 LDKPublicKey node_pks_conv_12_ref;
64658                 CHECK(node_pks_conv_12->arr_len == 33);
64659                 memcpy(node_pks_conv_12_ref.compressed_form, node_pks_conv_12->elems, 33); FREE(node_pks_conv_12);
64660                 node_pks_constr.data[m] = node_pks_conv_12_ref;
64661         }
64662         FREE(node_pks);
64663         void* entropy_source_ptr = untag_ptr(entropy_source);
64664         if (ptr_is_owned(entropy_source)) { CHECK_ACCESS(entropy_source_ptr); }
64665         LDKEntropySource* entropy_source_conv = (LDKEntropySource*)entropy_source_ptr;
64666         LDKCResult_BlindedPathNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_BlindedPathNoneZ), "LDKCResult_BlindedPathNoneZ");
64667         *ret_conv = BlindedPath_new_for_message(node_pks_constr, entropy_source_conv);
64668         return tag_ptr(ret_conv, true);
64669 }
64670
64671 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) {
64672         LDKPublicKey payee_node_id_ref;
64673         CHECK(payee_node_id->arr_len == 33);
64674         memcpy(payee_node_id_ref.compressed_form, payee_node_id->elems, 33); FREE(payee_node_id);
64675         LDKReceiveTlvs payee_tlvs_conv;
64676         payee_tlvs_conv.inner = untag_ptr(payee_tlvs);
64677         payee_tlvs_conv.is_owned = ptr_is_owned(payee_tlvs);
64678         CHECK_INNER_FIELD_ACCESS_OR_NULL(payee_tlvs_conv);
64679         payee_tlvs_conv = ReceiveTlvs_clone(&payee_tlvs_conv);
64680         void* entropy_source_ptr = untag_ptr(entropy_source);
64681         if (ptr_is_owned(entropy_source)) { CHECK_ACCESS(entropy_source_ptr); }
64682         LDKEntropySource* entropy_source_conv = (LDKEntropySource*)entropy_source_ptr;
64683         LDKCResult_C2Tuple_BlindedPayInfoBlindedPathZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_BlindedPayInfoBlindedPathZNoneZ), "LDKCResult_C2Tuple_BlindedPayInfoBlindedPathZNoneZ");
64684         *ret_conv = BlindedPath_one_hop_for_payment(payee_node_id_ref, payee_tlvs_conv, entropy_source_conv);
64685         return tag_ptr(ret_conv, true);
64686 }
64687
64688 int8_tArray  __attribute__((export_name("TS_BlindedPath_write"))) TS_BlindedPath_write(uint64_t obj) {
64689         LDKBlindedPath obj_conv;
64690         obj_conv.inner = untag_ptr(obj);
64691         obj_conv.is_owned = ptr_is_owned(obj);
64692         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
64693         obj_conv.is_owned = false;
64694         LDKCVec_u8Z ret_var = BlindedPath_write(&obj_conv);
64695         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
64696         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
64697         CVec_u8Z_free(ret_var);
64698         return ret_arr;
64699 }
64700
64701 uint64_t  __attribute__((export_name("TS_BlindedPath_read"))) TS_BlindedPath_read(int8_tArray ser) {
64702         LDKu8slice ser_ref;
64703         ser_ref.datalen = ser->arr_len;
64704         ser_ref.data = ser->elems;
64705         LDKCResult_BlindedPathDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_BlindedPathDecodeErrorZ), "LDKCResult_BlindedPathDecodeErrorZ");
64706         *ret_conv = BlindedPath_read(ser_ref);
64707         FREE(ser);
64708         return tag_ptr(ret_conv, true);
64709 }
64710
64711 int8_tArray  __attribute__((export_name("TS_BlindedHop_write"))) TS_BlindedHop_write(uint64_t obj) {
64712         LDKBlindedHop obj_conv;
64713         obj_conv.inner = untag_ptr(obj);
64714         obj_conv.is_owned = ptr_is_owned(obj);
64715         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
64716         obj_conv.is_owned = false;
64717         LDKCVec_u8Z ret_var = BlindedHop_write(&obj_conv);
64718         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
64719         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
64720         CVec_u8Z_free(ret_var);
64721         return ret_arr;
64722 }
64723
64724 uint64_t  __attribute__((export_name("TS_BlindedHop_read"))) TS_BlindedHop_read(int8_tArray ser) {
64725         LDKu8slice ser_ref;
64726         ser_ref.datalen = ser->arr_len;
64727         ser_ref.data = ser->elems;
64728         LDKCResult_BlindedHopDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_BlindedHopDecodeErrorZ), "LDKCResult_BlindedHopDecodeErrorZ");
64729         *ret_conv = BlindedHop_read(ser_ref);
64730         FREE(ser);
64731         return tag_ptr(ret_conv, true);
64732 }
64733
64734 void  __attribute__((export_name("TS_ForwardNode_free"))) TS_ForwardNode_free(uint64_t this_obj) {
64735         LDKForwardNode this_obj_conv;
64736         this_obj_conv.inner = untag_ptr(this_obj);
64737         this_obj_conv.is_owned = ptr_is_owned(this_obj);
64738         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
64739         ForwardNode_free(this_obj_conv);
64740 }
64741
64742 uint64_t  __attribute__((export_name("TS_ForwardNode_get_tlvs"))) TS_ForwardNode_get_tlvs(uint64_t this_ptr) {
64743         LDKForwardNode this_ptr_conv;
64744         this_ptr_conv.inner = untag_ptr(this_ptr);
64745         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
64746         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
64747         this_ptr_conv.is_owned = false;
64748         LDKForwardTlvs ret_var = ForwardNode_get_tlvs(&this_ptr_conv);
64749         uint64_t ret_ref = 0;
64750         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
64751         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
64752         return ret_ref;
64753 }
64754
64755 void  __attribute__((export_name("TS_ForwardNode_set_tlvs"))) TS_ForwardNode_set_tlvs(uint64_t this_ptr, uint64_t val) {
64756         LDKForwardNode this_ptr_conv;
64757         this_ptr_conv.inner = untag_ptr(this_ptr);
64758         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
64759         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
64760         this_ptr_conv.is_owned = false;
64761         LDKForwardTlvs val_conv;
64762         val_conv.inner = untag_ptr(val);
64763         val_conv.is_owned = ptr_is_owned(val);
64764         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
64765         val_conv = ForwardTlvs_clone(&val_conv);
64766         ForwardNode_set_tlvs(&this_ptr_conv, val_conv);
64767 }
64768
64769 int8_tArray  __attribute__((export_name("TS_ForwardNode_get_node_id"))) TS_ForwardNode_get_node_id(uint64_t this_ptr) {
64770         LDKForwardNode this_ptr_conv;
64771         this_ptr_conv.inner = untag_ptr(this_ptr);
64772         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
64773         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
64774         this_ptr_conv.is_owned = false;
64775         int8_tArray ret_arr = init_int8_tArray(33, __LINE__);
64776         memcpy(ret_arr->elems, ForwardNode_get_node_id(&this_ptr_conv).compressed_form, 33);
64777         return ret_arr;
64778 }
64779
64780 void  __attribute__((export_name("TS_ForwardNode_set_node_id"))) TS_ForwardNode_set_node_id(uint64_t this_ptr, int8_tArray val) {
64781         LDKForwardNode this_ptr_conv;
64782         this_ptr_conv.inner = untag_ptr(this_ptr);
64783         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
64784         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
64785         this_ptr_conv.is_owned = false;
64786         LDKPublicKey val_ref;
64787         CHECK(val->arr_len == 33);
64788         memcpy(val_ref.compressed_form, val->elems, 33); FREE(val);
64789         ForwardNode_set_node_id(&this_ptr_conv, val_ref);
64790 }
64791
64792 int64_t  __attribute__((export_name("TS_ForwardNode_get_htlc_maximum_msat"))) TS_ForwardNode_get_htlc_maximum_msat(uint64_t this_ptr) {
64793         LDKForwardNode this_ptr_conv;
64794         this_ptr_conv.inner = untag_ptr(this_ptr);
64795         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
64796         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
64797         this_ptr_conv.is_owned = false;
64798         int64_t ret_conv = ForwardNode_get_htlc_maximum_msat(&this_ptr_conv);
64799         return ret_conv;
64800 }
64801
64802 void  __attribute__((export_name("TS_ForwardNode_set_htlc_maximum_msat"))) TS_ForwardNode_set_htlc_maximum_msat(uint64_t this_ptr, int64_t val) {
64803         LDKForwardNode this_ptr_conv;
64804         this_ptr_conv.inner = untag_ptr(this_ptr);
64805         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
64806         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
64807         this_ptr_conv.is_owned = false;
64808         ForwardNode_set_htlc_maximum_msat(&this_ptr_conv, val);
64809 }
64810
64811 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) {
64812         LDKForwardTlvs tlvs_arg_conv;
64813         tlvs_arg_conv.inner = untag_ptr(tlvs_arg);
64814         tlvs_arg_conv.is_owned = ptr_is_owned(tlvs_arg);
64815         CHECK_INNER_FIELD_ACCESS_OR_NULL(tlvs_arg_conv);
64816         tlvs_arg_conv = ForwardTlvs_clone(&tlvs_arg_conv);
64817         LDKPublicKey node_id_arg_ref;
64818         CHECK(node_id_arg->arr_len == 33);
64819         memcpy(node_id_arg_ref.compressed_form, node_id_arg->elems, 33); FREE(node_id_arg);
64820         LDKForwardNode ret_var = ForwardNode_new(tlvs_arg_conv, node_id_arg_ref, htlc_maximum_msat_arg);
64821         uint64_t ret_ref = 0;
64822         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
64823         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
64824         return ret_ref;
64825 }
64826
64827 static inline uint64_t ForwardNode_clone_ptr(LDKForwardNode *NONNULL_PTR arg) {
64828         LDKForwardNode ret_var = ForwardNode_clone(arg);
64829         uint64_t ret_ref = 0;
64830         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
64831         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
64832         return ret_ref;
64833 }
64834 int64_t  __attribute__((export_name("TS_ForwardNode_clone_ptr"))) TS_ForwardNode_clone_ptr(uint64_t arg) {
64835         LDKForwardNode arg_conv;
64836         arg_conv.inner = untag_ptr(arg);
64837         arg_conv.is_owned = ptr_is_owned(arg);
64838         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
64839         arg_conv.is_owned = false;
64840         int64_t ret_conv = ForwardNode_clone_ptr(&arg_conv);
64841         return ret_conv;
64842 }
64843
64844 uint64_t  __attribute__((export_name("TS_ForwardNode_clone"))) TS_ForwardNode_clone(uint64_t orig) {
64845         LDKForwardNode orig_conv;
64846         orig_conv.inner = untag_ptr(orig);
64847         orig_conv.is_owned = ptr_is_owned(orig);
64848         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
64849         orig_conv.is_owned = false;
64850         LDKForwardNode ret_var = ForwardNode_clone(&orig_conv);
64851         uint64_t ret_ref = 0;
64852         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
64853         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
64854         return ret_ref;
64855 }
64856
64857 void  __attribute__((export_name("TS_ForwardTlvs_free"))) TS_ForwardTlvs_free(uint64_t this_obj) {
64858         LDKForwardTlvs this_obj_conv;
64859         this_obj_conv.inner = untag_ptr(this_obj);
64860         this_obj_conv.is_owned = ptr_is_owned(this_obj);
64861         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
64862         ForwardTlvs_free(this_obj_conv);
64863 }
64864
64865 int64_t  __attribute__((export_name("TS_ForwardTlvs_get_short_channel_id"))) TS_ForwardTlvs_get_short_channel_id(uint64_t this_ptr) {
64866         LDKForwardTlvs this_ptr_conv;
64867         this_ptr_conv.inner = untag_ptr(this_ptr);
64868         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
64869         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
64870         this_ptr_conv.is_owned = false;
64871         int64_t ret_conv = ForwardTlvs_get_short_channel_id(&this_ptr_conv);
64872         return ret_conv;
64873 }
64874
64875 void  __attribute__((export_name("TS_ForwardTlvs_set_short_channel_id"))) TS_ForwardTlvs_set_short_channel_id(uint64_t this_ptr, int64_t val) {
64876         LDKForwardTlvs this_ptr_conv;
64877         this_ptr_conv.inner = untag_ptr(this_ptr);
64878         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
64879         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
64880         this_ptr_conv.is_owned = false;
64881         ForwardTlvs_set_short_channel_id(&this_ptr_conv, val);
64882 }
64883
64884 uint64_t  __attribute__((export_name("TS_ForwardTlvs_get_payment_relay"))) TS_ForwardTlvs_get_payment_relay(uint64_t this_ptr) {
64885         LDKForwardTlvs this_ptr_conv;
64886         this_ptr_conv.inner = untag_ptr(this_ptr);
64887         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
64888         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
64889         this_ptr_conv.is_owned = false;
64890         LDKPaymentRelay ret_var = ForwardTlvs_get_payment_relay(&this_ptr_conv);
64891         uint64_t ret_ref = 0;
64892         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
64893         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
64894         return ret_ref;
64895 }
64896
64897 void  __attribute__((export_name("TS_ForwardTlvs_set_payment_relay"))) TS_ForwardTlvs_set_payment_relay(uint64_t this_ptr, uint64_t val) {
64898         LDKForwardTlvs this_ptr_conv;
64899         this_ptr_conv.inner = untag_ptr(this_ptr);
64900         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
64901         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
64902         this_ptr_conv.is_owned = false;
64903         LDKPaymentRelay val_conv;
64904         val_conv.inner = untag_ptr(val);
64905         val_conv.is_owned = ptr_is_owned(val);
64906         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
64907         val_conv = PaymentRelay_clone(&val_conv);
64908         ForwardTlvs_set_payment_relay(&this_ptr_conv, val_conv);
64909 }
64910
64911 uint64_t  __attribute__((export_name("TS_ForwardTlvs_get_payment_constraints"))) TS_ForwardTlvs_get_payment_constraints(uint64_t this_ptr) {
64912         LDKForwardTlvs this_ptr_conv;
64913         this_ptr_conv.inner = untag_ptr(this_ptr);
64914         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
64915         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
64916         this_ptr_conv.is_owned = false;
64917         LDKPaymentConstraints ret_var = ForwardTlvs_get_payment_constraints(&this_ptr_conv);
64918         uint64_t ret_ref = 0;
64919         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
64920         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
64921         return ret_ref;
64922 }
64923
64924 void  __attribute__((export_name("TS_ForwardTlvs_set_payment_constraints"))) TS_ForwardTlvs_set_payment_constraints(uint64_t this_ptr, uint64_t val) {
64925         LDKForwardTlvs this_ptr_conv;
64926         this_ptr_conv.inner = untag_ptr(this_ptr);
64927         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
64928         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
64929         this_ptr_conv.is_owned = false;
64930         LDKPaymentConstraints val_conv;
64931         val_conv.inner = untag_ptr(val);
64932         val_conv.is_owned = ptr_is_owned(val);
64933         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
64934         val_conv = PaymentConstraints_clone(&val_conv);
64935         ForwardTlvs_set_payment_constraints(&this_ptr_conv, val_conv);
64936 }
64937
64938 uint64_t  __attribute__((export_name("TS_ForwardTlvs_get_features"))) TS_ForwardTlvs_get_features(uint64_t this_ptr) {
64939         LDKForwardTlvs this_ptr_conv;
64940         this_ptr_conv.inner = untag_ptr(this_ptr);
64941         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
64942         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
64943         this_ptr_conv.is_owned = false;
64944         LDKBlindedHopFeatures ret_var = ForwardTlvs_get_features(&this_ptr_conv);
64945         uint64_t ret_ref = 0;
64946         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
64947         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
64948         return ret_ref;
64949 }
64950
64951 void  __attribute__((export_name("TS_ForwardTlvs_set_features"))) TS_ForwardTlvs_set_features(uint64_t this_ptr, uint64_t val) {
64952         LDKForwardTlvs this_ptr_conv;
64953         this_ptr_conv.inner = untag_ptr(this_ptr);
64954         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
64955         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
64956         this_ptr_conv.is_owned = false;
64957         LDKBlindedHopFeatures val_conv;
64958         val_conv.inner = untag_ptr(val);
64959         val_conv.is_owned = ptr_is_owned(val);
64960         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
64961         val_conv = BlindedHopFeatures_clone(&val_conv);
64962         ForwardTlvs_set_features(&this_ptr_conv, val_conv);
64963 }
64964
64965 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) {
64966         LDKPaymentRelay payment_relay_arg_conv;
64967         payment_relay_arg_conv.inner = untag_ptr(payment_relay_arg);
64968         payment_relay_arg_conv.is_owned = ptr_is_owned(payment_relay_arg);
64969         CHECK_INNER_FIELD_ACCESS_OR_NULL(payment_relay_arg_conv);
64970         payment_relay_arg_conv = PaymentRelay_clone(&payment_relay_arg_conv);
64971         LDKPaymentConstraints payment_constraints_arg_conv;
64972         payment_constraints_arg_conv.inner = untag_ptr(payment_constraints_arg);
64973         payment_constraints_arg_conv.is_owned = ptr_is_owned(payment_constraints_arg);
64974         CHECK_INNER_FIELD_ACCESS_OR_NULL(payment_constraints_arg_conv);
64975         payment_constraints_arg_conv = PaymentConstraints_clone(&payment_constraints_arg_conv);
64976         LDKBlindedHopFeatures features_arg_conv;
64977         features_arg_conv.inner = untag_ptr(features_arg);
64978         features_arg_conv.is_owned = ptr_is_owned(features_arg);
64979         CHECK_INNER_FIELD_ACCESS_OR_NULL(features_arg_conv);
64980         features_arg_conv = BlindedHopFeatures_clone(&features_arg_conv);
64981         LDKForwardTlvs ret_var = ForwardTlvs_new(short_channel_id_arg, payment_relay_arg_conv, payment_constraints_arg_conv, features_arg_conv);
64982         uint64_t ret_ref = 0;
64983         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
64984         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
64985         return ret_ref;
64986 }
64987
64988 static inline uint64_t ForwardTlvs_clone_ptr(LDKForwardTlvs *NONNULL_PTR arg) {
64989         LDKForwardTlvs ret_var = ForwardTlvs_clone(arg);
64990         uint64_t ret_ref = 0;
64991         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
64992         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
64993         return ret_ref;
64994 }
64995 int64_t  __attribute__((export_name("TS_ForwardTlvs_clone_ptr"))) TS_ForwardTlvs_clone_ptr(uint64_t arg) {
64996         LDKForwardTlvs arg_conv;
64997         arg_conv.inner = untag_ptr(arg);
64998         arg_conv.is_owned = ptr_is_owned(arg);
64999         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
65000         arg_conv.is_owned = false;
65001         int64_t ret_conv = ForwardTlvs_clone_ptr(&arg_conv);
65002         return ret_conv;
65003 }
65004
65005 uint64_t  __attribute__((export_name("TS_ForwardTlvs_clone"))) TS_ForwardTlvs_clone(uint64_t orig) {
65006         LDKForwardTlvs orig_conv;
65007         orig_conv.inner = untag_ptr(orig);
65008         orig_conv.is_owned = ptr_is_owned(orig);
65009         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
65010         orig_conv.is_owned = false;
65011         LDKForwardTlvs ret_var = ForwardTlvs_clone(&orig_conv);
65012         uint64_t ret_ref = 0;
65013         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
65014         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
65015         return ret_ref;
65016 }
65017
65018 void  __attribute__((export_name("TS_ReceiveTlvs_free"))) TS_ReceiveTlvs_free(uint64_t this_obj) {
65019         LDKReceiveTlvs this_obj_conv;
65020         this_obj_conv.inner = untag_ptr(this_obj);
65021         this_obj_conv.is_owned = ptr_is_owned(this_obj);
65022         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
65023         ReceiveTlvs_free(this_obj_conv);
65024 }
65025
65026 int8_tArray  __attribute__((export_name("TS_ReceiveTlvs_get_payment_secret"))) TS_ReceiveTlvs_get_payment_secret(uint64_t this_ptr) {
65027         LDKReceiveTlvs this_ptr_conv;
65028         this_ptr_conv.inner = untag_ptr(this_ptr);
65029         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
65030         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
65031         this_ptr_conv.is_owned = false;
65032         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
65033         memcpy(ret_arr->elems, *ReceiveTlvs_get_payment_secret(&this_ptr_conv), 32);
65034         return ret_arr;
65035 }
65036
65037 void  __attribute__((export_name("TS_ReceiveTlvs_set_payment_secret"))) TS_ReceiveTlvs_set_payment_secret(uint64_t this_ptr, int8_tArray val) {
65038         LDKReceiveTlvs this_ptr_conv;
65039         this_ptr_conv.inner = untag_ptr(this_ptr);
65040         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
65041         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
65042         this_ptr_conv.is_owned = false;
65043         LDKThirtyTwoBytes val_ref;
65044         CHECK(val->arr_len == 32);
65045         memcpy(val_ref.data, val->elems, 32); FREE(val);
65046         ReceiveTlvs_set_payment_secret(&this_ptr_conv, val_ref);
65047 }
65048
65049 uint64_t  __attribute__((export_name("TS_ReceiveTlvs_get_payment_constraints"))) TS_ReceiveTlvs_get_payment_constraints(uint64_t this_ptr) {
65050         LDKReceiveTlvs this_ptr_conv;
65051         this_ptr_conv.inner = untag_ptr(this_ptr);
65052         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
65053         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
65054         this_ptr_conv.is_owned = false;
65055         LDKPaymentConstraints ret_var = ReceiveTlvs_get_payment_constraints(&this_ptr_conv);
65056         uint64_t ret_ref = 0;
65057         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
65058         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
65059         return ret_ref;
65060 }
65061
65062 void  __attribute__((export_name("TS_ReceiveTlvs_set_payment_constraints"))) TS_ReceiveTlvs_set_payment_constraints(uint64_t this_ptr, uint64_t val) {
65063         LDKReceiveTlvs this_ptr_conv;
65064         this_ptr_conv.inner = untag_ptr(this_ptr);
65065         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
65066         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
65067         this_ptr_conv.is_owned = false;
65068         LDKPaymentConstraints val_conv;
65069         val_conv.inner = untag_ptr(val);
65070         val_conv.is_owned = ptr_is_owned(val);
65071         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
65072         val_conv = PaymentConstraints_clone(&val_conv);
65073         ReceiveTlvs_set_payment_constraints(&this_ptr_conv, val_conv);
65074 }
65075
65076 uint64_t  __attribute__((export_name("TS_ReceiveTlvs_new"))) TS_ReceiveTlvs_new(int8_tArray payment_secret_arg, uint64_t payment_constraints_arg) {
65077         LDKThirtyTwoBytes payment_secret_arg_ref;
65078         CHECK(payment_secret_arg->arr_len == 32);
65079         memcpy(payment_secret_arg_ref.data, payment_secret_arg->elems, 32); FREE(payment_secret_arg);
65080         LDKPaymentConstraints payment_constraints_arg_conv;
65081         payment_constraints_arg_conv.inner = untag_ptr(payment_constraints_arg);
65082         payment_constraints_arg_conv.is_owned = ptr_is_owned(payment_constraints_arg);
65083         CHECK_INNER_FIELD_ACCESS_OR_NULL(payment_constraints_arg_conv);
65084         payment_constraints_arg_conv = PaymentConstraints_clone(&payment_constraints_arg_conv);
65085         LDKReceiveTlvs ret_var = ReceiveTlvs_new(payment_secret_arg_ref, payment_constraints_arg_conv);
65086         uint64_t ret_ref = 0;
65087         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
65088         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
65089         return ret_ref;
65090 }
65091
65092 static inline uint64_t ReceiveTlvs_clone_ptr(LDKReceiveTlvs *NONNULL_PTR arg) {
65093         LDKReceiveTlvs ret_var = ReceiveTlvs_clone(arg);
65094         uint64_t ret_ref = 0;
65095         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
65096         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
65097         return ret_ref;
65098 }
65099 int64_t  __attribute__((export_name("TS_ReceiveTlvs_clone_ptr"))) TS_ReceiveTlvs_clone_ptr(uint64_t arg) {
65100         LDKReceiveTlvs arg_conv;
65101         arg_conv.inner = untag_ptr(arg);
65102         arg_conv.is_owned = ptr_is_owned(arg);
65103         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
65104         arg_conv.is_owned = false;
65105         int64_t ret_conv = ReceiveTlvs_clone_ptr(&arg_conv);
65106         return ret_conv;
65107 }
65108
65109 uint64_t  __attribute__((export_name("TS_ReceiveTlvs_clone"))) TS_ReceiveTlvs_clone(uint64_t orig) {
65110         LDKReceiveTlvs orig_conv;
65111         orig_conv.inner = untag_ptr(orig);
65112         orig_conv.is_owned = ptr_is_owned(orig);
65113         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
65114         orig_conv.is_owned = false;
65115         LDKReceiveTlvs ret_var = ReceiveTlvs_clone(&orig_conv);
65116         uint64_t ret_ref = 0;
65117         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
65118         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
65119         return ret_ref;
65120 }
65121
65122 void  __attribute__((export_name("TS_PaymentRelay_free"))) TS_PaymentRelay_free(uint64_t this_obj) {
65123         LDKPaymentRelay this_obj_conv;
65124         this_obj_conv.inner = untag_ptr(this_obj);
65125         this_obj_conv.is_owned = ptr_is_owned(this_obj);
65126         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
65127         PaymentRelay_free(this_obj_conv);
65128 }
65129
65130 int16_t  __attribute__((export_name("TS_PaymentRelay_get_cltv_expiry_delta"))) TS_PaymentRelay_get_cltv_expiry_delta(uint64_t this_ptr) {
65131         LDKPaymentRelay this_ptr_conv;
65132         this_ptr_conv.inner = untag_ptr(this_ptr);
65133         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
65134         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
65135         this_ptr_conv.is_owned = false;
65136         int16_t ret_conv = PaymentRelay_get_cltv_expiry_delta(&this_ptr_conv);
65137         return ret_conv;
65138 }
65139
65140 void  __attribute__((export_name("TS_PaymentRelay_set_cltv_expiry_delta"))) TS_PaymentRelay_set_cltv_expiry_delta(uint64_t this_ptr, int16_t val) {
65141         LDKPaymentRelay this_ptr_conv;
65142         this_ptr_conv.inner = untag_ptr(this_ptr);
65143         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
65144         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
65145         this_ptr_conv.is_owned = false;
65146         PaymentRelay_set_cltv_expiry_delta(&this_ptr_conv, val);
65147 }
65148
65149 int32_t  __attribute__((export_name("TS_PaymentRelay_get_fee_proportional_millionths"))) TS_PaymentRelay_get_fee_proportional_millionths(uint64_t this_ptr) {
65150         LDKPaymentRelay this_ptr_conv;
65151         this_ptr_conv.inner = untag_ptr(this_ptr);
65152         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
65153         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
65154         this_ptr_conv.is_owned = false;
65155         int32_t ret_conv = PaymentRelay_get_fee_proportional_millionths(&this_ptr_conv);
65156         return ret_conv;
65157 }
65158
65159 void  __attribute__((export_name("TS_PaymentRelay_set_fee_proportional_millionths"))) TS_PaymentRelay_set_fee_proportional_millionths(uint64_t this_ptr, int32_t val) {
65160         LDKPaymentRelay this_ptr_conv;
65161         this_ptr_conv.inner = untag_ptr(this_ptr);
65162         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
65163         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
65164         this_ptr_conv.is_owned = false;
65165         PaymentRelay_set_fee_proportional_millionths(&this_ptr_conv, val);
65166 }
65167
65168 int32_t  __attribute__((export_name("TS_PaymentRelay_get_fee_base_msat"))) TS_PaymentRelay_get_fee_base_msat(uint64_t this_ptr) {
65169         LDKPaymentRelay this_ptr_conv;
65170         this_ptr_conv.inner = untag_ptr(this_ptr);
65171         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
65172         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
65173         this_ptr_conv.is_owned = false;
65174         int32_t ret_conv = PaymentRelay_get_fee_base_msat(&this_ptr_conv);
65175         return ret_conv;
65176 }
65177
65178 void  __attribute__((export_name("TS_PaymentRelay_set_fee_base_msat"))) TS_PaymentRelay_set_fee_base_msat(uint64_t this_ptr, int32_t val) {
65179         LDKPaymentRelay this_ptr_conv;
65180         this_ptr_conv.inner = untag_ptr(this_ptr);
65181         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
65182         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
65183         this_ptr_conv.is_owned = false;
65184         PaymentRelay_set_fee_base_msat(&this_ptr_conv, val);
65185 }
65186
65187 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) {
65188         LDKPaymentRelay ret_var = PaymentRelay_new(cltv_expiry_delta_arg, fee_proportional_millionths_arg, fee_base_msat_arg);
65189         uint64_t ret_ref = 0;
65190         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
65191         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
65192         return ret_ref;
65193 }
65194
65195 static inline uint64_t PaymentRelay_clone_ptr(LDKPaymentRelay *NONNULL_PTR arg) {
65196         LDKPaymentRelay ret_var = PaymentRelay_clone(arg);
65197         uint64_t ret_ref = 0;
65198         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
65199         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
65200         return ret_ref;
65201 }
65202 int64_t  __attribute__((export_name("TS_PaymentRelay_clone_ptr"))) TS_PaymentRelay_clone_ptr(uint64_t arg) {
65203         LDKPaymentRelay arg_conv;
65204         arg_conv.inner = untag_ptr(arg);
65205         arg_conv.is_owned = ptr_is_owned(arg);
65206         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
65207         arg_conv.is_owned = false;
65208         int64_t ret_conv = PaymentRelay_clone_ptr(&arg_conv);
65209         return ret_conv;
65210 }
65211
65212 uint64_t  __attribute__((export_name("TS_PaymentRelay_clone"))) TS_PaymentRelay_clone(uint64_t orig) {
65213         LDKPaymentRelay orig_conv;
65214         orig_conv.inner = untag_ptr(orig);
65215         orig_conv.is_owned = ptr_is_owned(orig);
65216         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
65217         orig_conv.is_owned = false;
65218         LDKPaymentRelay ret_var = PaymentRelay_clone(&orig_conv);
65219         uint64_t ret_ref = 0;
65220         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
65221         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
65222         return ret_ref;
65223 }
65224
65225 void  __attribute__((export_name("TS_PaymentConstraints_free"))) TS_PaymentConstraints_free(uint64_t this_obj) {
65226         LDKPaymentConstraints this_obj_conv;
65227         this_obj_conv.inner = untag_ptr(this_obj);
65228         this_obj_conv.is_owned = ptr_is_owned(this_obj);
65229         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
65230         PaymentConstraints_free(this_obj_conv);
65231 }
65232
65233 int32_t  __attribute__((export_name("TS_PaymentConstraints_get_max_cltv_expiry"))) TS_PaymentConstraints_get_max_cltv_expiry(uint64_t this_ptr) {
65234         LDKPaymentConstraints this_ptr_conv;
65235         this_ptr_conv.inner = untag_ptr(this_ptr);
65236         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
65237         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
65238         this_ptr_conv.is_owned = false;
65239         int32_t ret_conv = PaymentConstraints_get_max_cltv_expiry(&this_ptr_conv);
65240         return ret_conv;
65241 }
65242
65243 void  __attribute__((export_name("TS_PaymentConstraints_set_max_cltv_expiry"))) TS_PaymentConstraints_set_max_cltv_expiry(uint64_t this_ptr, int32_t val) {
65244         LDKPaymentConstraints this_ptr_conv;
65245         this_ptr_conv.inner = untag_ptr(this_ptr);
65246         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
65247         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
65248         this_ptr_conv.is_owned = false;
65249         PaymentConstraints_set_max_cltv_expiry(&this_ptr_conv, val);
65250 }
65251
65252 int64_t  __attribute__((export_name("TS_PaymentConstraints_get_htlc_minimum_msat"))) TS_PaymentConstraints_get_htlc_minimum_msat(uint64_t this_ptr) {
65253         LDKPaymentConstraints this_ptr_conv;
65254         this_ptr_conv.inner = untag_ptr(this_ptr);
65255         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
65256         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
65257         this_ptr_conv.is_owned = false;
65258         int64_t ret_conv = PaymentConstraints_get_htlc_minimum_msat(&this_ptr_conv);
65259         return ret_conv;
65260 }
65261
65262 void  __attribute__((export_name("TS_PaymentConstraints_set_htlc_minimum_msat"))) TS_PaymentConstraints_set_htlc_minimum_msat(uint64_t this_ptr, int64_t val) {
65263         LDKPaymentConstraints this_ptr_conv;
65264         this_ptr_conv.inner = untag_ptr(this_ptr);
65265         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
65266         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
65267         this_ptr_conv.is_owned = false;
65268         PaymentConstraints_set_htlc_minimum_msat(&this_ptr_conv, val);
65269 }
65270
65271 uint64_t  __attribute__((export_name("TS_PaymentConstraints_new"))) TS_PaymentConstraints_new(int32_t max_cltv_expiry_arg, int64_t htlc_minimum_msat_arg) {
65272         LDKPaymentConstraints ret_var = PaymentConstraints_new(max_cltv_expiry_arg, htlc_minimum_msat_arg);
65273         uint64_t ret_ref = 0;
65274         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
65275         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
65276         return ret_ref;
65277 }
65278
65279 static inline uint64_t PaymentConstraints_clone_ptr(LDKPaymentConstraints *NONNULL_PTR arg) {
65280         LDKPaymentConstraints ret_var = PaymentConstraints_clone(arg);
65281         uint64_t ret_ref = 0;
65282         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
65283         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
65284         return ret_ref;
65285 }
65286 int64_t  __attribute__((export_name("TS_PaymentConstraints_clone_ptr"))) TS_PaymentConstraints_clone_ptr(uint64_t arg) {
65287         LDKPaymentConstraints arg_conv;
65288         arg_conv.inner = untag_ptr(arg);
65289         arg_conv.is_owned = ptr_is_owned(arg);
65290         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
65291         arg_conv.is_owned = false;
65292         int64_t ret_conv = PaymentConstraints_clone_ptr(&arg_conv);
65293         return ret_conv;
65294 }
65295
65296 uint64_t  __attribute__((export_name("TS_PaymentConstraints_clone"))) TS_PaymentConstraints_clone(uint64_t orig) {
65297         LDKPaymentConstraints orig_conv;
65298         orig_conv.inner = untag_ptr(orig);
65299         orig_conv.is_owned = ptr_is_owned(orig);
65300         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
65301         orig_conv.is_owned = false;
65302         LDKPaymentConstraints ret_var = PaymentConstraints_clone(&orig_conv);
65303         uint64_t ret_ref = 0;
65304         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
65305         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
65306         return ret_ref;
65307 }
65308
65309 int8_tArray  __attribute__((export_name("TS_ForwardTlvs_write"))) TS_ForwardTlvs_write(uint64_t obj) {
65310         LDKForwardTlvs obj_conv;
65311         obj_conv.inner = untag_ptr(obj);
65312         obj_conv.is_owned = ptr_is_owned(obj);
65313         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
65314         obj_conv.is_owned = false;
65315         LDKCVec_u8Z ret_var = ForwardTlvs_write(&obj_conv);
65316         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
65317         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
65318         CVec_u8Z_free(ret_var);
65319         return ret_arr;
65320 }
65321
65322 int8_tArray  __attribute__((export_name("TS_ReceiveTlvs_write"))) TS_ReceiveTlvs_write(uint64_t obj) {
65323         LDKReceiveTlvs obj_conv;
65324         obj_conv.inner = untag_ptr(obj);
65325         obj_conv.is_owned = ptr_is_owned(obj);
65326         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
65327         obj_conv.is_owned = false;
65328         LDKCVec_u8Z ret_var = ReceiveTlvs_write(&obj_conv);
65329         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
65330         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
65331         CVec_u8Z_free(ret_var);
65332         return ret_arr;
65333 }
65334
65335 uint64_t  __attribute__((export_name("TS_ReceiveTlvs_read"))) TS_ReceiveTlvs_read(int8_tArray ser) {
65336         LDKu8slice ser_ref;
65337         ser_ref.datalen = ser->arr_len;
65338         ser_ref.data = ser->elems;
65339         LDKCResult_ReceiveTlvsDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ReceiveTlvsDecodeErrorZ), "LDKCResult_ReceiveTlvsDecodeErrorZ");
65340         *ret_conv = ReceiveTlvs_read(ser_ref);
65341         FREE(ser);
65342         return tag_ptr(ret_conv, true);
65343 }
65344
65345 int8_tArray  __attribute__((export_name("TS_PaymentRelay_write"))) TS_PaymentRelay_write(uint64_t obj) {
65346         LDKPaymentRelay obj_conv;
65347         obj_conv.inner = untag_ptr(obj);
65348         obj_conv.is_owned = ptr_is_owned(obj);
65349         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
65350         obj_conv.is_owned = false;
65351         LDKCVec_u8Z ret_var = PaymentRelay_write(&obj_conv);
65352         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
65353         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
65354         CVec_u8Z_free(ret_var);
65355         return ret_arr;
65356 }
65357
65358 uint64_t  __attribute__((export_name("TS_PaymentRelay_read"))) TS_PaymentRelay_read(int8_tArray ser) {
65359         LDKu8slice ser_ref;
65360         ser_ref.datalen = ser->arr_len;
65361         ser_ref.data = ser->elems;
65362         LDKCResult_PaymentRelayDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PaymentRelayDecodeErrorZ), "LDKCResult_PaymentRelayDecodeErrorZ");
65363         *ret_conv = PaymentRelay_read(ser_ref);
65364         FREE(ser);
65365         return tag_ptr(ret_conv, true);
65366 }
65367
65368 int8_tArray  __attribute__((export_name("TS_PaymentConstraints_write"))) TS_PaymentConstraints_write(uint64_t obj) {
65369         LDKPaymentConstraints obj_conv;
65370         obj_conv.inner = untag_ptr(obj);
65371         obj_conv.is_owned = ptr_is_owned(obj);
65372         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
65373         obj_conv.is_owned = false;
65374         LDKCVec_u8Z ret_var = PaymentConstraints_write(&obj_conv);
65375         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
65376         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
65377         CVec_u8Z_free(ret_var);
65378         return ret_arr;
65379 }
65380
65381 uint64_t  __attribute__((export_name("TS_PaymentConstraints_read"))) TS_PaymentConstraints_read(int8_tArray ser) {
65382         LDKu8slice ser_ref;
65383         ser_ref.datalen = ser->arr_len;
65384         ser_ref.data = ser->elems;
65385         LDKCResult_PaymentConstraintsDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PaymentConstraintsDecodeErrorZ), "LDKCResult_PaymentConstraintsDecodeErrorZ");
65386         *ret_conv = PaymentConstraints_read(ser_ref);
65387         FREE(ser);
65388         return tag_ptr(ret_conv, true);
65389 }
65390
65391 void  __attribute__((export_name("TS_PaymentPurpose_free"))) TS_PaymentPurpose_free(uint64_t this_ptr) {
65392         if (!ptr_is_owned(this_ptr)) return;
65393         void* this_ptr_ptr = untag_ptr(this_ptr);
65394         CHECK_ACCESS(this_ptr_ptr);
65395         LDKPaymentPurpose this_ptr_conv = *(LDKPaymentPurpose*)(this_ptr_ptr);
65396         FREE(untag_ptr(this_ptr));
65397         PaymentPurpose_free(this_ptr_conv);
65398 }
65399
65400 static inline uint64_t PaymentPurpose_clone_ptr(LDKPaymentPurpose *NONNULL_PTR arg) {
65401         LDKPaymentPurpose *ret_copy = MALLOC(sizeof(LDKPaymentPurpose), "LDKPaymentPurpose");
65402         *ret_copy = PaymentPurpose_clone(arg);
65403         uint64_t ret_ref = tag_ptr(ret_copy, true);
65404         return ret_ref;
65405 }
65406 int64_t  __attribute__((export_name("TS_PaymentPurpose_clone_ptr"))) TS_PaymentPurpose_clone_ptr(uint64_t arg) {
65407         LDKPaymentPurpose* arg_conv = (LDKPaymentPurpose*)untag_ptr(arg);
65408         int64_t ret_conv = PaymentPurpose_clone_ptr(arg_conv);
65409         return ret_conv;
65410 }
65411
65412 uint64_t  __attribute__((export_name("TS_PaymentPurpose_clone"))) TS_PaymentPurpose_clone(uint64_t orig) {
65413         LDKPaymentPurpose* orig_conv = (LDKPaymentPurpose*)untag_ptr(orig);
65414         LDKPaymentPurpose *ret_copy = MALLOC(sizeof(LDKPaymentPurpose), "LDKPaymentPurpose");
65415         *ret_copy = PaymentPurpose_clone(orig_conv);
65416         uint64_t ret_ref = tag_ptr(ret_copy, true);
65417         return ret_ref;
65418 }
65419
65420 uint64_t  __attribute__((export_name("TS_PaymentPurpose_invoice_payment"))) TS_PaymentPurpose_invoice_payment(uint64_t payment_preimage, int8_tArray payment_secret) {
65421         void* payment_preimage_ptr = untag_ptr(payment_preimage);
65422         CHECK_ACCESS(payment_preimage_ptr);
65423         LDKCOption_ThirtyTwoBytesZ payment_preimage_conv = *(LDKCOption_ThirtyTwoBytesZ*)(payment_preimage_ptr);
65424         payment_preimage_conv = COption_ThirtyTwoBytesZ_clone((LDKCOption_ThirtyTwoBytesZ*)untag_ptr(payment_preimage));
65425         LDKThirtyTwoBytes payment_secret_ref;
65426         CHECK(payment_secret->arr_len == 32);
65427         memcpy(payment_secret_ref.data, payment_secret->elems, 32); FREE(payment_secret);
65428         LDKPaymentPurpose *ret_copy = MALLOC(sizeof(LDKPaymentPurpose), "LDKPaymentPurpose");
65429         *ret_copy = PaymentPurpose_invoice_payment(payment_preimage_conv, payment_secret_ref);
65430         uint64_t ret_ref = tag_ptr(ret_copy, true);
65431         return ret_ref;
65432 }
65433
65434 uint64_t  __attribute__((export_name("TS_PaymentPurpose_spontaneous_payment"))) TS_PaymentPurpose_spontaneous_payment(int8_tArray a) {
65435         LDKThirtyTwoBytes a_ref;
65436         CHECK(a->arr_len == 32);
65437         memcpy(a_ref.data, a->elems, 32); FREE(a);
65438         LDKPaymentPurpose *ret_copy = MALLOC(sizeof(LDKPaymentPurpose), "LDKPaymentPurpose");
65439         *ret_copy = PaymentPurpose_spontaneous_payment(a_ref);
65440         uint64_t ret_ref = tag_ptr(ret_copy, true);
65441         return ret_ref;
65442 }
65443
65444 jboolean  __attribute__((export_name("TS_PaymentPurpose_eq"))) TS_PaymentPurpose_eq(uint64_t a, uint64_t b) {
65445         LDKPaymentPurpose* a_conv = (LDKPaymentPurpose*)untag_ptr(a);
65446         LDKPaymentPurpose* b_conv = (LDKPaymentPurpose*)untag_ptr(b);
65447         jboolean ret_conv = PaymentPurpose_eq(a_conv, b_conv);
65448         return ret_conv;
65449 }
65450
65451 int8_tArray  __attribute__((export_name("TS_PaymentPurpose_write"))) TS_PaymentPurpose_write(uint64_t obj) {
65452         LDKPaymentPurpose* obj_conv = (LDKPaymentPurpose*)untag_ptr(obj);
65453         LDKCVec_u8Z ret_var = PaymentPurpose_write(obj_conv);
65454         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
65455         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
65456         CVec_u8Z_free(ret_var);
65457         return ret_arr;
65458 }
65459
65460 uint64_t  __attribute__((export_name("TS_PaymentPurpose_read"))) TS_PaymentPurpose_read(int8_tArray ser) {
65461         LDKu8slice ser_ref;
65462         ser_ref.datalen = ser->arr_len;
65463         ser_ref.data = ser->elems;
65464         LDKCResult_PaymentPurposeDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PaymentPurposeDecodeErrorZ), "LDKCResult_PaymentPurposeDecodeErrorZ");
65465         *ret_conv = PaymentPurpose_read(ser_ref);
65466         FREE(ser);
65467         return tag_ptr(ret_conv, true);
65468 }
65469
65470 void  __attribute__((export_name("TS_ClaimedHTLC_free"))) TS_ClaimedHTLC_free(uint64_t this_obj) {
65471         LDKClaimedHTLC this_obj_conv;
65472         this_obj_conv.inner = untag_ptr(this_obj);
65473         this_obj_conv.is_owned = ptr_is_owned(this_obj);
65474         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
65475         ClaimedHTLC_free(this_obj_conv);
65476 }
65477
65478 int8_tArray  __attribute__((export_name("TS_ClaimedHTLC_get_channel_id"))) TS_ClaimedHTLC_get_channel_id(uint64_t this_ptr) {
65479         LDKClaimedHTLC this_ptr_conv;
65480         this_ptr_conv.inner = untag_ptr(this_ptr);
65481         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
65482         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
65483         this_ptr_conv.is_owned = false;
65484         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
65485         memcpy(ret_arr->elems, *ClaimedHTLC_get_channel_id(&this_ptr_conv), 32);
65486         return ret_arr;
65487 }
65488
65489 void  __attribute__((export_name("TS_ClaimedHTLC_set_channel_id"))) TS_ClaimedHTLC_set_channel_id(uint64_t this_ptr, int8_tArray val) {
65490         LDKClaimedHTLC this_ptr_conv;
65491         this_ptr_conv.inner = untag_ptr(this_ptr);
65492         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
65493         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
65494         this_ptr_conv.is_owned = false;
65495         LDKThirtyTwoBytes val_ref;
65496         CHECK(val->arr_len == 32);
65497         memcpy(val_ref.data, val->elems, 32); FREE(val);
65498         ClaimedHTLC_set_channel_id(&this_ptr_conv, val_ref);
65499 }
65500
65501 int8_tArray  __attribute__((export_name("TS_ClaimedHTLC_get_user_channel_id"))) TS_ClaimedHTLC_get_user_channel_id(uint64_t this_ptr) {
65502         LDKClaimedHTLC this_ptr_conv;
65503         this_ptr_conv.inner = untag_ptr(this_ptr);
65504         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
65505         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
65506         this_ptr_conv.is_owned = false;
65507         int8_tArray ret_arr = init_int8_tArray(16, __LINE__);
65508         memcpy(ret_arr->elems, ClaimedHTLC_get_user_channel_id(&this_ptr_conv).le_bytes, 16);
65509         return ret_arr;
65510 }
65511
65512 void  __attribute__((export_name("TS_ClaimedHTLC_set_user_channel_id"))) TS_ClaimedHTLC_set_user_channel_id(uint64_t this_ptr, int8_tArray val) {
65513         LDKClaimedHTLC this_ptr_conv;
65514         this_ptr_conv.inner = untag_ptr(this_ptr);
65515         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
65516         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
65517         this_ptr_conv.is_owned = false;
65518         LDKU128 val_ref;
65519         CHECK(val->arr_len == 16);
65520         memcpy(val_ref.le_bytes, val->elems, 16); FREE(val);
65521         ClaimedHTLC_set_user_channel_id(&this_ptr_conv, val_ref);
65522 }
65523
65524 int32_t  __attribute__((export_name("TS_ClaimedHTLC_get_cltv_expiry"))) TS_ClaimedHTLC_get_cltv_expiry(uint64_t this_ptr) {
65525         LDKClaimedHTLC this_ptr_conv;
65526         this_ptr_conv.inner = untag_ptr(this_ptr);
65527         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
65528         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
65529         this_ptr_conv.is_owned = false;
65530         int32_t ret_conv = ClaimedHTLC_get_cltv_expiry(&this_ptr_conv);
65531         return ret_conv;
65532 }
65533
65534 void  __attribute__((export_name("TS_ClaimedHTLC_set_cltv_expiry"))) TS_ClaimedHTLC_set_cltv_expiry(uint64_t this_ptr, int32_t val) {
65535         LDKClaimedHTLC this_ptr_conv;
65536         this_ptr_conv.inner = untag_ptr(this_ptr);
65537         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
65538         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
65539         this_ptr_conv.is_owned = false;
65540         ClaimedHTLC_set_cltv_expiry(&this_ptr_conv, val);
65541 }
65542
65543 int64_t  __attribute__((export_name("TS_ClaimedHTLC_get_value_msat"))) TS_ClaimedHTLC_get_value_msat(uint64_t this_ptr) {
65544         LDKClaimedHTLC this_ptr_conv;
65545         this_ptr_conv.inner = untag_ptr(this_ptr);
65546         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
65547         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
65548         this_ptr_conv.is_owned = false;
65549         int64_t ret_conv = ClaimedHTLC_get_value_msat(&this_ptr_conv);
65550         return ret_conv;
65551 }
65552
65553 void  __attribute__((export_name("TS_ClaimedHTLC_set_value_msat"))) TS_ClaimedHTLC_set_value_msat(uint64_t this_ptr, int64_t val) {
65554         LDKClaimedHTLC this_ptr_conv;
65555         this_ptr_conv.inner = untag_ptr(this_ptr);
65556         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
65557         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
65558         this_ptr_conv.is_owned = false;
65559         ClaimedHTLC_set_value_msat(&this_ptr_conv, val);
65560 }
65561
65562 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) {
65563         LDKThirtyTwoBytes channel_id_arg_ref;
65564         CHECK(channel_id_arg->arr_len == 32);
65565         memcpy(channel_id_arg_ref.data, channel_id_arg->elems, 32); FREE(channel_id_arg);
65566         LDKU128 user_channel_id_arg_ref;
65567         CHECK(user_channel_id_arg->arr_len == 16);
65568         memcpy(user_channel_id_arg_ref.le_bytes, user_channel_id_arg->elems, 16); FREE(user_channel_id_arg);
65569         LDKClaimedHTLC ret_var = ClaimedHTLC_new(channel_id_arg_ref, user_channel_id_arg_ref, cltv_expiry_arg, value_msat_arg);
65570         uint64_t ret_ref = 0;
65571         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
65572         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
65573         return ret_ref;
65574 }
65575
65576 static inline uint64_t ClaimedHTLC_clone_ptr(LDKClaimedHTLC *NONNULL_PTR arg) {
65577         LDKClaimedHTLC ret_var = ClaimedHTLC_clone(arg);
65578         uint64_t ret_ref = 0;
65579         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
65580         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
65581         return ret_ref;
65582 }
65583 int64_t  __attribute__((export_name("TS_ClaimedHTLC_clone_ptr"))) TS_ClaimedHTLC_clone_ptr(uint64_t arg) {
65584         LDKClaimedHTLC arg_conv;
65585         arg_conv.inner = untag_ptr(arg);
65586         arg_conv.is_owned = ptr_is_owned(arg);
65587         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
65588         arg_conv.is_owned = false;
65589         int64_t ret_conv = ClaimedHTLC_clone_ptr(&arg_conv);
65590         return ret_conv;
65591 }
65592
65593 uint64_t  __attribute__((export_name("TS_ClaimedHTLC_clone"))) TS_ClaimedHTLC_clone(uint64_t orig) {
65594         LDKClaimedHTLC orig_conv;
65595         orig_conv.inner = untag_ptr(orig);
65596         orig_conv.is_owned = ptr_is_owned(orig);
65597         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
65598         orig_conv.is_owned = false;
65599         LDKClaimedHTLC ret_var = ClaimedHTLC_clone(&orig_conv);
65600         uint64_t ret_ref = 0;
65601         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
65602         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
65603         return ret_ref;
65604 }
65605
65606 jboolean  __attribute__((export_name("TS_ClaimedHTLC_eq"))) TS_ClaimedHTLC_eq(uint64_t a, uint64_t b) {
65607         LDKClaimedHTLC a_conv;
65608         a_conv.inner = untag_ptr(a);
65609         a_conv.is_owned = ptr_is_owned(a);
65610         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
65611         a_conv.is_owned = false;
65612         LDKClaimedHTLC b_conv;
65613         b_conv.inner = untag_ptr(b);
65614         b_conv.is_owned = ptr_is_owned(b);
65615         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
65616         b_conv.is_owned = false;
65617         jboolean ret_conv = ClaimedHTLC_eq(&a_conv, &b_conv);
65618         return ret_conv;
65619 }
65620
65621 int8_tArray  __attribute__((export_name("TS_ClaimedHTLC_write"))) TS_ClaimedHTLC_write(uint64_t obj) {
65622         LDKClaimedHTLC obj_conv;
65623         obj_conv.inner = untag_ptr(obj);
65624         obj_conv.is_owned = ptr_is_owned(obj);
65625         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
65626         obj_conv.is_owned = false;
65627         LDKCVec_u8Z ret_var = ClaimedHTLC_write(&obj_conv);
65628         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
65629         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
65630         CVec_u8Z_free(ret_var);
65631         return ret_arr;
65632 }
65633
65634 uint64_t  __attribute__((export_name("TS_ClaimedHTLC_read"))) TS_ClaimedHTLC_read(int8_tArray ser) {
65635         LDKu8slice ser_ref;
65636         ser_ref.datalen = ser->arr_len;
65637         ser_ref.data = ser->elems;
65638         LDKCResult_ClaimedHTLCDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ClaimedHTLCDecodeErrorZ), "LDKCResult_ClaimedHTLCDecodeErrorZ");
65639         *ret_conv = ClaimedHTLC_read(ser_ref);
65640         FREE(ser);
65641         return tag_ptr(ret_conv, true);
65642 }
65643
65644 void  __attribute__((export_name("TS_PathFailure_free"))) TS_PathFailure_free(uint64_t this_ptr) {
65645         if (!ptr_is_owned(this_ptr)) return;
65646         void* this_ptr_ptr = untag_ptr(this_ptr);
65647         CHECK_ACCESS(this_ptr_ptr);
65648         LDKPathFailure this_ptr_conv = *(LDKPathFailure*)(this_ptr_ptr);
65649         FREE(untag_ptr(this_ptr));
65650         PathFailure_free(this_ptr_conv);
65651 }
65652
65653 static inline uint64_t PathFailure_clone_ptr(LDKPathFailure *NONNULL_PTR arg) {
65654         LDKPathFailure *ret_copy = MALLOC(sizeof(LDKPathFailure), "LDKPathFailure");
65655         *ret_copy = PathFailure_clone(arg);
65656         uint64_t ret_ref = tag_ptr(ret_copy, true);
65657         return ret_ref;
65658 }
65659 int64_t  __attribute__((export_name("TS_PathFailure_clone_ptr"))) TS_PathFailure_clone_ptr(uint64_t arg) {
65660         LDKPathFailure* arg_conv = (LDKPathFailure*)untag_ptr(arg);
65661         int64_t ret_conv = PathFailure_clone_ptr(arg_conv);
65662         return ret_conv;
65663 }
65664
65665 uint64_t  __attribute__((export_name("TS_PathFailure_clone"))) TS_PathFailure_clone(uint64_t orig) {
65666         LDKPathFailure* orig_conv = (LDKPathFailure*)untag_ptr(orig);
65667         LDKPathFailure *ret_copy = MALLOC(sizeof(LDKPathFailure), "LDKPathFailure");
65668         *ret_copy = PathFailure_clone(orig_conv);
65669         uint64_t ret_ref = tag_ptr(ret_copy, true);
65670         return ret_ref;
65671 }
65672
65673 uint64_t  __attribute__((export_name("TS_PathFailure_initial_send"))) TS_PathFailure_initial_send(uint64_t err) {
65674         void* err_ptr = untag_ptr(err);
65675         CHECK_ACCESS(err_ptr);
65676         LDKAPIError err_conv = *(LDKAPIError*)(err_ptr);
65677         err_conv = APIError_clone((LDKAPIError*)untag_ptr(err));
65678         LDKPathFailure *ret_copy = MALLOC(sizeof(LDKPathFailure), "LDKPathFailure");
65679         *ret_copy = PathFailure_initial_send(err_conv);
65680         uint64_t ret_ref = tag_ptr(ret_copy, true);
65681         return ret_ref;
65682 }
65683
65684 uint64_t  __attribute__((export_name("TS_PathFailure_on_path"))) TS_PathFailure_on_path(uint64_t network_update) {
65685         void* network_update_ptr = untag_ptr(network_update);
65686         CHECK_ACCESS(network_update_ptr);
65687         LDKCOption_NetworkUpdateZ network_update_conv = *(LDKCOption_NetworkUpdateZ*)(network_update_ptr);
65688         network_update_conv = COption_NetworkUpdateZ_clone((LDKCOption_NetworkUpdateZ*)untag_ptr(network_update));
65689         LDKPathFailure *ret_copy = MALLOC(sizeof(LDKPathFailure), "LDKPathFailure");
65690         *ret_copy = PathFailure_on_path(network_update_conv);
65691         uint64_t ret_ref = tag_ptr(ret_copy, true);
65692         return ret_ref;
65693 }
65694
65695 jboolean  __attribute__((export_name("TS_PathFailure_eq"))) TS_PathFailure_eq(uint64_t a, uint64_t b) {
65696         LDKPathFailure* a_conv = (LDKPathFailure*)untag_ptr(a);
65697         LDKPathFailure* b_conv = (LDKPathFailure*)untag_ptr(b);
65698         jboolean ret_conv = PathFailure_eq(a_conv, b_conv);
65699         return ret_conv;
65700 }
65701
65702 int8_tArray  __attribute__((export_name("TS_PathFailure_write"))) TS_PathFailure_write(uint64_t obj) {
65703         LDKPathFailure* obj_conv = (LDKPathFailure*)untag_ptr(obj);
65704         LDKCVec_u8Z ret_var = PathFailure_write(obj_conv);
65705         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
65706         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
65707         CVec_u8Z_free(ret_var);
65708         return ret_arr;
65709 }
65710
65711 uint64_t  __attribute__((export_name("TS_PathFailure_read"))) TS_PathFailure_read(int8_tArray ser) {
65712         LDKu8slice ser_ref;
65713         ser_ref.datalen = ser->arr_len;
65714         ser_ref.data = ser->elems;
65715         LDKCResult_COption_PathFailureZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_COption_PathFailureZDecodeErrorZ), "LDKCResult_COption_PathFailureZDecodeErrorZ");
65716         *ret_conv = PathFailure_read(ser_ref);
65717         FREE(ser);
65718         return tag_ptr(ret_conv, true);
65719 }
65720
65721 void  __attribute__((export_name("TS_ClosureReason_free"))) TS_ClosureReason_free(uint64_t this_ptr) {
65722         if (!ptr_is_owned(this_ptr)) return;
65723         void* this_ptr_ptr = untag_ptr(this_ptr);
65724         CHECK_ACCESS(this_ptr_ptr);
65725         LDKClosureReason this_ptr_conv = *(LDKClosureReason*)(this_ptr_ptr);
65726         FREE(untag_ptr(this_ptr));
65727         ClosureReason_free(this_ptr_conv);
65728 }
65729
65730 static inline uint64_t ClosureReason_clone_ptr(LDKClosureReason *NONNULL_PTR arg) {
65731         LDKClosureReason *ret_copy = MALLOC(sizeof(LDKClosureReason), "LDKClosureReason");
65732         *ret_copy = ClosureReason_clone(arg);
65733         uint64_t ret_ref = tag_ptr(ret_copy, true);
65734         return ret_ref;
65735 }
65736 int64_t  __attribute__((export_name("TS_ClosureReason_clone_ptr"))) TS_ClosureReason_clone_ptr(uint64_t arg) {
65737         LDKClosureReason* arg_conv = (LDKClosureReason*)untag_ptr(arg);
65738         int64_t ret_conv = ClosureReason_clone_ptr(arg_conv);
65739         return ret_conv;
65740 }
65741
65742 uint64_t  __attribute__((export_name("TS_ClosureReason_clone"))) TS_ClosureReason_clone(uint64_t orig) {
65743         LDKClosureReason* orig_conv = (LDKClosureReason*)untag_ptr(orig);
65744         LDKClosureReason *ret_copy = MALLOC(sizeof(LDKClosureReason), "LDKClosureReason");
65745         *ret_copy = ClosureReason_clone(orig_conv);
65746         uint64_t ret_ref = tag_ptr(ret_copy, true);
65747         return ret_ref;
65748 }
65749
65750 uint64_t  __attribute__((export_name("TS_ClosureReason_counterparty_force_closed"))) TS_ClosureReason_counterparty_force_closed(uint64_t peer_msg) {
65751         LDKUntrustedString peer_msg_conv;
65752         peer_msg_conv.inner = untag_ptr(peer_msg);
65753         peer_msg_conv.is_owned = ptr_is_owned(peer_msg);
65754         CHECK_INNER_FIELD_ACCESS_OR_NULL(peer_msg_conv);
65755         peer_msg_conv = UntrustedString_clone(&peer_msg_conv);
65756         LDKClosureReason *ret_copy = MALLOC(sizeof(LDKClosureReason), "LDKClosureReason");
65757         *ret_copy = ClosureReason_counterparty_force_closed(peer_msg_conv);
65758         uint64_t ret_ref = tag_ptr(ret_copy, true);
65759         return ret_ref;
65760 }
65761
65762 uint64_t  __attribute__((export_name("TS_ClosureReason_holder_force_closed"))) TS_ClosureReason_holder_force_closed() {
65763         LDKClosureReason *ret_copy = MALLOC(sizeof(LDKClosureReason), "LDKClosureReason");
65764         *ret_copy = ClosureReason_holder_force_closed();
65765         uint64_t ret_ref = tag_ptr(ret_copy, true);
65766         return ret_ref;
65767 }
65768
65769 uint64_t  __attribute__((export_name("TS_ClosureReason_cooperative_closure"))) TS_ClosureReason_cooperative_closure() {
65770         LDKClosureReason *ret_copy = MALLOC(sizeof(LDKClosureReason), "LDKClosureReason");
65771         *ret_copy = ClosureReason_cooperative_closure();
65772         uint64_t ret_ref = tag_ptr(ret_copy, true);
65773         return ret_ref;
65774 }
65775
65776 uint64_t  __attribute__((export_name("TS_ClosureReason_commitment_tx_confirmed"))) TS_ClosureReason_commitment_tx_confirmed() {
65777         LDKClosureReason *ret_copy = MALLOC(sizeof(LDKClosureReason), "LDKClosureReason");
65778         *ret_copy = ClosureReason_commitment_tx_confirmed();
65779         uint64_t ret_ref = tag_ptr(ret_copy, true);
65780         return ret_ref;
65781 }
65782
65783 uint64_t  __attribute__((export_name("TS_ClosureReason_funding_timed_out"))) TS_ClosureReason_funding_timed_out() {
65784         LDKClosureReason *ret_copy = MALLOC(sizeof(LDKClosureReason), "LDKClosureReason");
65785         *ret_copy = ClosureReason_funding_timed_out();
65786         uint64_t ret_ref = tag_ptr(ret_copy, true);
65787         return ret_ref;
65788 }
65789
65790 uint64_t  __attribute__((export_name("TS_ClosureReason_processing_error"))) TS_ClosureReason_processing_error(jstring err) {
65791         LDKStr err_conv = str_ref_to_owned_c(err);
65792         LDKClosureReason *ret_copy = MALLOC(sizeof(LDKClosureReason), "LDKClosureReason");
65793         *ret_copy = ClosureReason_processing_error(err_conv);
65794         uint64_t ret_ref = tag_ptr(ret_copy, true);
65795         return ret_ref;
65796 }
65797
65798 uint64_t  __attribute__((export_name("TS_ClosureReason_disconnected_peer"))) TS_ClosureReason_disconnected_peer() {
65799         LDKClosureReason *ret_copy = MALLOC(sizeof(LDKClosureReason), "LDKClosureReason");
65800         *ret_copy = ClosureReason_disconnected_peer();
65801         uint64_t ret_ref = tag_ptr(ret_copy, true);
65802         return ret_ref;
65803 }
65804
65805 uint64_t  __attribute__((export_name("TS_ClosureReason_outdated_channel_manager"))) TS_ClosureReason_outdated_channel_manager() {
65806         LDKClosureReason *ret_copy = MALLOC(sizeof(LDKClosureReason), "LDKClosureReason");
65807         *ret_copy = ClosureReason_outdated_channel_manager();
65808         uint64_t ret_ref = tag_ptr(ret_copy, true);
65809         return ret_ref;
65810 }
65811
65812 uint64_t  __attribute__((export_name("TS_ClosureReason_counterparty_coop_closed_unfunded_channel"))) TS_ClosureReason_counterparty_coop_closed_unfunded_channel() {
65813         LDKClosureReason *ret_copy = MALLOC(sizeof(LDKClosureReason), "LDKClosureReason");
65814         *ret_copy = ClosureReason_counterparty_coop_closed_unfunded_channel();
65815         uint64_t ret_ref = tag_ptr(ret_copy, true);
65816         return ret_ref;
65817 }
65818
65819 uint64_t  __attribute__((export_name("TS_ClosureReason_funding_batch_closure"))) TS_ClosureReason_funding_batch_closure() {
65820         LDKClosureReason *ret_copy = MALLOC(sizeof(LDKClosureReason), "LDKClosureReason");
65821         *ret_copy = ClosureReason_funding_batch_closure();
65822         uint64_t ret_ref = tag_ptr(ret_copy, true);
65823         return ret_ref;
65824 }
65825
65826 jboolean  __attribute__((export_name("TS_ClosureReason_eq"))) TS_ClosureReason_eq(uint64_t a, uint64_t b) {
65827         LDKClosureReason* a_conv = (LDKClosureReason*)untag_ptr(a);
65828         LDKClosureReason* b_conv = (LDKClosureReason*)untag_ptr(b);
65829         jboolean ret_conv = ClosureReason_eq(a_conv, b_conv);
65830         return ret_conv;
65831 }
65832
65833 int8_tArray  __attribute__((export_name("TS_ClosureReason_write"))) TS_ClosureReason_write(uint64_t obj) {
65834         LDKClosureReason* obj_conv = (LDKClosureReason*)untag_ptr(obj);
65835         LDKCVec_u8Z ret_var = ClosureReason_write(obj_conv);
65836         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
65837         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
65838         CVec_u8Z_free(ret_var);
65839         return ret_arr;
65840 }
65841
65842 uint64_t  __attribute__((export_name("TS_ClosureReason_read"))) TS_ClosureReason_read(int8_tArray ser) {
65843         LDKu8slice ser_ref;
65844         ser_ref.datalen = ser->arr_len;
65845         ser_ref.data = ser->elems;
65846         LDKCResult_COption_ClosureReasonZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_COption_ClosureReasonZDecodeErrorZ), "LDKCResult_COption_ClosureReasonZDecodeErrorZ");
65847         *ret_conv = ClosureReason_read(ser_ref);
65848         FREE(ser);
65849         return tag_ptr(ret_conv, true);
65850 }
65851
65852 void  __attribute__((export_name("TS_HTLCDestination_free"))) TS_HTLCDestination_free(uint64_t this_ptr) {
65853         if (!ptr_is_owned(this_ptr)) return;
65854         void* this_ptr_ptr = untag_ptr(this_ptr);
65855         CHECK_ACCESS(this_ptr_ptr);
65856         LDKHTLCDestination this_ptr_conv = *(LDKHTLCDestination*)(this_ptr_ptr);
65857         FREE(untag_ptr(this_ptr));
65858         HTLCDestination_free(this_ptr_conv);
65859 }
65860
65861 static inline uint64_t HTLCDestination_clone_ptr(LDKHTLCDestination *NONNULL_PTR arg) {
65862         LDKHTLCDestination *ret_copy = MALLOC(sizeof(LDKHTLCDestination), "LDKHTLCDestination");
65863         *ret_copy = HTLCDestination_clone(arg);
65864         uint64_t ret_ref = tag_ptr(ret_copy, true);
65865         return ret_ref;
65866 }
65867 int64_t  __attribute__((export_name("TS_HTLCDestination_clone_ptr"))) TS_HTLCDestination_clone_ptr(uint64_t arg) {
65868         LDKHTLCDestination* arg_conv = (LDKHTLCDestination*)untag_ptr(arg);
65869         int64_t ret_conv = HTLCDestination_clone_ptr(arg_conv);
65870         return ret_conv;
65871 }
65872
65873 uint64_t  __attribute__((export_name("TS_HTLCDestination_clone"))) TS_HTLCDestination_clone(uint64_t orig) {
65874         LDKHTLCDestination* orig_conv = (LDKHTLCDestination*)untag_ptr(orig);
65875         LDKHTLCDestination *ret_copy = MALLOC(sizeof(LDKHTLCDestination), "LDKHTLCDestination");
65876         *ret_copy = HTLCDestination_clone(orig_conv);
65877         uint64_t ret_ref = tag_ptr(ret_copy, true);
65878         return ret_ref;
65879 }
65880
65881 uint64_t  __attribute__((export_name("TS_HTLCDestination_next_hop_channel"))) TS_HTLCDestination_next_hop_channel(int8_tArray node_id, int8_tArray channel_id) {
65882         LDKPublicKey node_id_ref;
65883         CHECK(node_id->arr_len == 33);
65884         memcpy(node_id_ref.compressed_form, node_id->elems, 33); FREE(node_id);
65885         LDKThirtyTwoBytes channel_id_ref;
65886         CHECK(channel_id->arr_len == 32);
65887         memcpy(channel_id_ref.data, channel_id->elems, 32); FREE(channel_id);
65888         LDKHTLCDestination *ret_copy = MALLOC(sizeof(LDKHTLCDestination), "LDKHTLCDestination");
65889         *ret_copy = HTLCDestination_next_hop_channel(node_id_ref, channel_id_ref);
65890         uint64_t ret_ref = tag_ptr(ret_copy, true);
65891         return ret_ref;
65892 }
65893
65894 uint64_t  __attribute__((export_name("TS_HTLCDestination_unknown_next_hop"))) TS_HTLCDestination_unknown_next_hop(int64_t requested_forward_scid) {
65895         LDKHTLCDestination *ret_copy = MALLOC(sizeof(LDKHTLCDestination), "LDKHTLCDestination");
65896         *ret_copy = HTLCDestination_unknown_next_hop(requested_forward_scid);
65897         uint64_t ret_ref = tag_ptr(ret_copy, true);
65898         return ret_ref;
65899 }
65900
65901 uint64_t  __attribute__((export_name("TS_HTLCDestination_invalid_forward"))) TS_HTLCDestination_invalid_forward(int64_t requested_forward_scid) {
65902         LDKHTLCDestination *ret_copy = MALLOC(sizeof(LDKHTLCDestination), "LDKHTLCDestination");
65903         *ret_copy = HTLCDestination_invalid_forward(requested_forward_scid);
65904         uint64_t ret_ref = tag_ptr(ret_copy, true);
65905         return ret_ref;
65906 }
65907
65908 uint64_t  __attribute__((export_name("TS_HTLCDestination_failed_payment"))) TS_HTLCDestination_failed_payment(int8_tArray payment_hash) {
65909         LDKThirtyTwoBytes payment_hash_ref;
65910         CHECK(payment_hash->arr_len == 32);
65911         memcpy(payment_hash_ref.data, payment_hash->elems, 32); FREE(payment_hash);
65912         LDKHTLCDestination *ret_copy = MALLOC(sizeof(LDKHTLCDestination), "LDKHTLCDestination");
65913         *ret_copy = HTLCDestination_failed_payment(payment_hash_ref);
65914         uint64_t ret_ref = tag_ptr(ret_copy, true);
65915         return ret_ref;
65916 }
65917
65918 jboolean  __attribute__((export_name("TS_HTLCDestination_eq"))) TS_HTLCDestination_eq(uint64_t a, uint64_t b) {
65919         LDKHTLCDestination* a_conv = (LDKHTLCDestination*)untag_ptr(a);
65920         LDKHTLCDestination* b_conv = (LDKHTLCDestination*)untag_ptr(b);
65921         jboolean ret_conv = HTLCDestination_eq(a_conv, b_conv);
65922         return ret_conv;
65923 }
65924
65925 int8_tArray  __attribute__((export_name("TS_HTLCDestination_write"))) TS_HTLCDestination_write(uint64_t obj) {
65926         LDKHTLCDestination* obj_conv = (LDKHTLCDestination*)untag_ptr(obj);
65927         LDKCVec_u8Z ret_var = HTLCDestination_write(obj_conv);
65928         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
65929         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
65930         CVec_u8Z_free(ret_var);
65931         return ret_arr;
65932 }
65933
65934 uint64_t  __attribute__((export_name("TS_HTLCDestination_read"))) TS_HTLCDestination_read(int8_tArray ser) {
65935         LDKu8slice ser_ref;
65936         ser_ref.datalen = ser->arr_len;
65937         ser_ref.data = ser->elems;
65938         LDKCResult_COption_HTLCDestinationZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_COption_HTLCDestinationZDecodeErrorZ), "LDKCResult_COption_HTLCDestinationZDecodeErrorZ");
65939         *ret_conv = HTLCDestination_read(ser_ref);
65940         FREE(ser);
65941         return tag_ptr(ret_conv, true);
65942 }
65943
65944 uint32_t  __attribute__((export_name("TS_PaymentFailureReason_clone"))) TS_PaymentFailureReason_clone(uint64_t orig) {
65945         LDKPaymentFailureReason* orig_conv = (LDKPaymentFailureReason*)untag_ptr(orig);
65946         uint32_t ret_conv = LDKPaymentFailureReason_to_js(PaymentFailureReason_clone(orig_conv));
65947         return ret_conv;
65948 }
65949
65950 uint32_t  __attribute__((export_name("TS_PaymentFailureReason_recipient_rejected"))) TS_PaymentFailureReason_recipient_rejected() {
65951         uint32_t ret_conv = LDKPaymentFailureReason_to_js(PaymentFailureReason_recipient_rejected());
65952         return ret_conv;
65953 }
65954
65955 uint32_t  __attribute__((export_name("TS_PaymentFailureReason_user_abandoned"))) TS_PaymentFailureReason_user_abandoned() {
65956         uint32_t ret_conv = LDKPaymentFailureReason_to_js(PaymentFailureReason_user_abandoned());
65957         return ret_conv;
65958 }
65959
65960 uint32_t  __attribute__((export_name("TS_PaymentFailureReason_retries_exhausted"))) TS_PaymentFailureReason_retries_exhausted() {
65961         uint32_t ret_conv = LDKPaymentFailureReason_to_js(PaymentFailureReason_retries_exhausted());
65962         return ret_conv;
65963 }
65964
65965 uint32_t  __attribute__((export_name("TS_PaymentFailureReason_payment_expired"))) TS_PaymentFailureReason_payment_expired() {
65966         uint32_t ret_conv = LDKPaymentFailureReason_to_js(PaymentFailureReason_payment_expired());
65967         return ret_conv;
65968 }
65969
65970 uint32_t  __attribute__((export_name("TS_PaymentFailureReason_route_not_found"))) TS_PaymentFailureReason_route_not_found() {
65971         uint32_t ret_conv = LDKPaymentFailureReason_to_js(PaymentFailureReason_route_not_found());
65972         return ret_conv;
65973 }
65974
65975 uint32_t  __attribute__((export_name("TS_PaymentFailureReason_unexpected_error"))) TS_PaymentFailureReason_unexpected_error() {
65976         uint32_t ret_conv = LDKPaymentFailureReason_to_js(PaymentFailureReason_unexpected_error());
65977         return ret_conv;
65978 }
65979
65980 jboolean  __attribute__((export_name("TS_PaymentFailureReason_eq"))) TS_PaymentFailureReason_eq(uint64_t a, uint64_t b) {
65981         LDKPaymentFailureReason* a_conv = (LDKPaymentFailureReason*)untag_ptr(a);
65982         LDKPaymentFailureReason* b_conv = (LDKPaymentFailureReason*)untag_ptr(b);
65983         jboolean ret_conv = PaymentFailureReason_eq(a_conv, b_conv);
65984         return ret_conv;
65985 }
65986
65987 int8_tArray  __attribute__((export_name("TS_PaymentFailureReason_write"))) TS_PaymentFailureReason_write(uint64_t obj) {
65988         LDKPaymentFailureReason* obj_conv = (LDKPaymentFailureReason*)untag_ptr(obj);
65989         LDKCVec_u8Z ret_var = PaymentFailureReason_write(obj_conv);
65990         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
65991         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
65992         CVec_u8Z_free(ret_var);
65993         return ret_arr;
65994 }
65995
65996 uint64_t  __attribute__((export_name("TS_PaymentFailureReason_read"))) TS_PaymentFailureReason_read(int8_tArray ser) {
65997         LDKu8slice ser_ref;
65998         ser_ref.datalen = ser->arr_len;
65999         ser_ref.data = ser->elems;
66000         LDKCResult_PaymentFailureReasonDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PaymentFailureReasonDecodeErrorZ), "LDKCResult_PaymentFailureReasonDecodeErrorZ");
66001         *ret_conv = PaymentFailureReason_read(ser_ref);
66002         FREE(ser);
66003         return tag_ptr(ret_conv, true);
66004 }
66005
66006 void  __attribute__((export_name("TS_Event_free"))) TS_Event_free(uint64_t this_ptr) {
66007         if (!ptr_is_owned(this_ptr)) return;
66008         void* this_ptr_ptr = untag_ptr(this_ptr);
66009         CHECK_ACCESS(this_ptr_ptr);
66010         LDKEvent this_ptr_conv = *(LDKEvent*)(this_ptr_ptr);
66011         FREE(untag_ptr(this_ptr));
66012         Event_free(this_ptr_conv);
66013 }
66014
66015 static inline uint64_t Event_clone_ptr(LDKEvent *NONNULL_PTR arg) {
66016         LDKEvent *ret_copy = MALLOC(sizeof(LDKEvent), "LDKEvent");
66017         *ret_copy = Event_clone(arg);
66018         uint64_t ret_ref = tag_ptr(ret_copy, true);
66019         return ret_ref;
66020 }
66021 int64_t  __attribute__((export_name("TS_Event_clone_ptr"))) TS_Event_clone_ptr(uint64_t arg) {
66022         LDKEvent* arg_conv = (LDKEvent*)untag_ptr(arg);
66023         int64_t ret_conv = Event_clone_ptr(arg_conv);
66024         return ret_conv;
66025 }
66026
66027 uint64_t  __attribute__((export_name("TS_Event_clone"))) TS_Event_clone(uint64_t orig) {
66028         LDKEvent* orig_conv = (LDKEvent*)untag_ptr(orig);
66029         LDKEvent *ret_copy = MALLOC(sizeof(LDKEvent), "LDKEvent");
66030         *ret_copy = Event_clone(orig_conv);
66031         uint64_t ret_ref = tag_ptr(ret_copy, true);
66032         return ret_ref;
66033 }
66034
66035 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) {
66036         LDKThirtyTwoBytes temporary_channel_id_ref;
66037         CHECK(temporary_channel_id->arr_len == 32);
66038         memcpy(temporary_channel_id_ref.data, temporary_channel_id->elems, 32); FREE(temporary_channel_id);
66039         LDKPublicKey counterparty_node_id_ref;
66040         CHECK(counterparty_node_id->arr_len == 33);
66041         memcpy(counterparty_node_id_ref.compressed_form, counterparty_node_id->elems, 33); FREE(counterparty_node_id);
66042         LDKCVec_u8Z output_script_ref;
66043         output_script_ref.datalen = output_script->arr_len;
66044         output_script_ref.data = MALLOC(output_script_ref.datalen, "LDKCVec_u8Z Bytes");
66045         memcpy(output_script_ref.data, output_script->elems, output_script_ref.datalen); FREE(output_script);
66046         LDKU128 user_channel_id_ref;
66047         CHECK(user_channel_id->arr_len == 16);
66048         memcpy(user_channel_id_ref.le_bytes, user_channel_id->elems, 16); FREE(user_channel_id);
66049         LDKEvent *ret_copy = MALLOC(sizeof(LDKEvent), "LDKEvent");
66050         *ret_copy = Event_funding_generation_ready(temporary_channel_id_ref, counterparty_node_id_ref, channel_value_satoshis, output_script_ref, user_channel_id_ref);
66051         uint64_t ret_ref = tag_ptr(ret_copy, true);
66052         return ret_ref;
66053 }
66054
66055 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) {
66056         LDKPublicKey receiver_node_id_ref;
66057         CHECK(receiver_node_id->arr_len == 33);
66058         memcpy(receiver_node_id_ref.compressed_form, receiver_node_id->elems, 33); FREE(receiver_node_id);
66059         LDKThirtyTwoBytes payment_hash_ref;
66060         CHECK(payment_hash->arr_len == 32);
66061         memcpy(payment_hash_ref.data, payment_hash->elems, 32); FREE(payment_hash);
66062         LDKRecipientOnionFields onion_fields_conv;
66063         onion_fields_conv.inner = untag_ptr(onion_fields);
66064         onion_fields_conv.is_owned = ptr_is_owned(onion_fields);
66065         CHECK_INNER_FIELD_ACCESS_OR_NULL(onion_fields_conv);
66066         onion_fields_conv = RecipientOnionFields_clone(&onion_fields_conv);
66067         void* purpose_ptr = untag_ptr(purpose);
66068         CHECK_ACCESS(purpose_ptr);
66069         LDKPaymentPurpose purpose_conv = *(LDKPaymentPurpose*)(purpose_ptr);
66070         purpose_conv = PaymentPurpose_clone((LDKPaymentPurpose*)untag_ptr(purpose));
66071         void* via_channel_id_ptr = untag_ptr(via_channel_id);
66072         CHECK_ACCESS(via_channel_id_ptr);
66073         LDKCOption_ThirtyTwoBytesZ via_channel_id_conv = *(LDKCOption_ThirtyTwoBytesZ*)(via_channel_id_ptr);
66074         via_channel_id_conv = COption_ThirtyTwoBytesZ_clone((LDKCOption_ThirtyTwoBytesZ*)untag_ptr(via_channel_id));
66075         void* via_user_channel_id_ptr = untag_ptr(via_user_channel_id);
66076         CHECK_ACCESS(via_user_channel_id_ptr);
66077         LDKCOption_U128Z via_user_channel_id_conv = *(LDKCOption_U128Z*)(via_user_channel_id_ptr);
66078         via_user_channel_id_conv = COption_U128Z_clone((LDKCOption_U128Z*)untag_ptr(via_user_channel_id));
66079         void* claim_deadline_ptr = untag_ptr(claim_deadline);
66080         CHECK_ACCESS(claim_deadline_ptr);
66081         LDKCOption_u32Z claim_deadline_conv = *(LDKCOption_u32Z*)(claim_deadline_ptr);
66082         claim_deadline_conv = COption_u32Z_clone((LDKCOption_u32Z*)untag_ptr(claim_deadline));
66083         LDKEvent *ret_copy = MALLOC(sizeof(LDKEvent), "LDKEvent");
66084         *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);
66085         uint64_t ret_ref = tag_ptr(ret_copy, true);
66086         return ret_ref;
66087 }
66088
66089 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) {
66090         LDKPublicKey receiver_node_id_ref;
66091         CHECK(receiver_node_id->arr_len == 33);
66092         memcpy(receiver_node_id_ref.compressed_form, receiver_node_id->elems, 33); FREE(receiver_node_id);
66093         LDKThirtyTwoBytes payment_hash_ref;
66094         CHECK(payment_hash->arr_len == 32);
66095         memcpy(payment_hash_ref.data, payment_hash->elems, 32); FREE(payment_hash);
66096         void* purpose_ptr = untag_ptr(purpose);
66097         CHECK_ACCESS(purpose_ptr);
66098         LDKPaymentPurpose purpose_conv = *(LDKPaymentPurpose*)(purpose_ptr);
66099         purpose_conv = PaymentPurpose_clone((LDKPaymentPurpose*)untag_ptr(purpose));
66100         LDKCVec_ClaimedHTLCZ htlcs_constr;
66101         htlcs_constr.datalen = htlcs->arr_len;
66102         if (htlcs_constr.datalen > 0)
66103                 htlcs_constr.data = MALLOC(htlcs_constr.datalen * sizeof(LDKClaimedHTLC), "LDKCVec_ClaimedHTLCZ Elements");
66104         else
66105                 htlcs_constr.data = NULL;
66106         uint64_t* htlcs_vals = htlcs->elems;
66107         for (size_t n = 0; n < htlcs_constr.datalen; n++) {
66108                 uint64_t htlcs_conv_13 = htlcs_vals[n];
66109                 LDKClaimedHTLC htlcs_conv_13_conv;
66110                 htlcs_conv_13_conv.inner = untag_ptr(htlcs_conv_13);
66111                 htlcs_conv_13_conv.is_owned = ptr_is_owned(htlcs_conv_13);
66112                 CHECK_INNER_FIELD_ACCESS_OR_NULL(htlcs_conv_13_conv);
66113                 htlcs_conv_13_conv = ClaimedHTLC_clone(&htlcs_conv_13_conv);
66114                 htlcs_constr.data[n] = htlcs_conv_13_conv;
66115         }
66116         FREE(htlcs);
66117         void* sender_intended_total_msat_ptr = untag_ptr(sender_intended_total_msat);
66118         CHECK_ACCESS(sender_intended_total_msat_ptr);
66119         LDKCOption_u64Z sender_intended_total_msat_conv = *(LDKCOption_u64Z*)(sender_intended_total_msat_ptr);
66120         sender_intended_total_msat_conv = COption_u64Z_clone((LDKCOption_u64Z*)untag_ptr(sender_intended_total_msat));
66121         LDKEvent *ret_copy = MALLOC(sizeof(LDKEvent), "LDKEvent");
66122         *ret_copy = Event_payment_claimed(receiver_node_id_ref, payment_hash_ref, amount_msat, purpose_conv, htlcs_constr, sender_intended_total_msat_conv);
66123         uint64_t ret_ref = tag_ptr(ret_copy, true);
66124         return ret_ref;
66125 }
66126
66127 uint64_t  __attribute__((export_name("TS_Event_invoice_request_failed"))) TS_Event_invoice_request_failed(int8_tArray payment_id) {
66128         LDKThirtyTwoBytes payment_id_ref;
66129         CHECK(payment_id->arr_len == 32);
66130         memcpy(payment_id_ref.data, payment_id->elems, 32); FREE(payment_id);
66131         LDKEvent *ret_copy = MALLOC(sizeof(LDKEvent), "LDKEvent");
66132         *ret_copy = Event_invoice_request_failed(payment_id_ref);
66133         uint64_t ret_ref = tag_ptr(ret_copy, true);
66134         return ret_ref;
66135 }
66136
66137 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) {
66138         void* payment_id_ptr = untag_ptr(payment_id);
66139         CHECK_ACCESS(payment_id_ptr);
66140         LDKCOption_ThirtyTwoBytesZ payment_id_conv = *(LDKCOption_ThirtyTwoBytesZ*)(payment_id_ptr);
66141         payment_id_conv = COption_ThirtyTwoBytesZ_clone((LDKCOption_ThirtyTwoBytesZ*)untag_ptr(payment_id));
66142         LDKThirtyTwoBytes payment_preimage_ref;
66143         CHECK(payment_preimage->arr_len == 32);
66144         memcpy(payment_preimage_ref.data, payment_preimage->elems, 32); FREE(payment_preimage);
66145         LDKThirtyTwoBytes payment_hash_ref;
66146         CHECK(payment_hash->arr_len == 32);
66147         memcpy(payment_hash_ref.data, payment_hash->elems, 32); FREE(payment_hash);
66148         void* fee_paid_msat_ptr = untag_ptr(fee_paid_msat);
66149         CHECK_ACCESS(fee_paid_msat_ptr);
66150         LDKCOption_u64Z fee_paid_msat_conv = *(LDKCOption_u64Z*)(fee_paid_msat_ptr);
66151         fee_paid_msat_conv = COption_u64Z_clone((LDKCOption_u64Z*)untag_ptr(fee_paid_msat));
66152         LDKEvent *ret_copy = MALLOC(sizeof(LDKEvent), "LDKEvent");
66153         *ret_copy = Event_payment_sent(payment_id_conv, payment_preimage_ref, payment_hash_ref, fee_paid_msat_conv);
66154         uint64_t ret_ref = tag_ptr(ret_copy, true);
66155         return ret_ref;
66156 }
66157
66158 uint64_t  __attribute__((export_name("TS_Event_payment_failed"))) TS_Event_payment_failed(int8_tArray payment_id, int8_tArray payment_hash, uint64_t reason) {
66159         LDKThirtyTwoBytes payment_id_ref;
66160         CHECK(payment_id->arr_len == 32);
66161         memcpy(payment_id_ref.data, payment_id->elems, 32); FREE(payment_id);
66162         LDKThirtyTwoBytes payment_hash_ref;
66163         CHECK(payment_hash->arr_len == 32);
66164         memcpy(payment_hash_ref.data, payment_hash->elems, 32); FREE(payment_hash);
66165         void* reason_ptr = untag_ptr(reason);
66166         CHECK_ACCESS(reason_ptr);
66167         LDKCOption_PaymentFailureReasonZ reason_conv = *(LDKCOption_PaymentFailureReasonZ*)(reason_ptr);
66168         reason_conv = COption_PaymentFailureReasonZ_clone((LDKCOption_PaymentFailureReasonZ*)untag_ptr(reason));
66169         LDKEvent *ret_copy = MALLOC(sizeof(LDKEvent), "LDKEvent");
66170         *ret_copy = Event_payment_failed(payment_id_ref, payment_hash_ref, reason_conv);
66171         uint64_t ret_ref = tag_ptr(ret_copy, true);
66172         return ret_ref;
66173 }
66174
66175 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) {
66176         LDKThirtyTwoBytes payment_id_ref;
66177         CHECK(payment_id->arr_len == 32);
66178         memcpy(payment_id_ref.data, payment_id->elems, 32); FREE(payment_id);
66179         void* payment_hash_ptr = untag_ptr(payment_hash);
66180         CHECK_ACCESS(payment_hash_ptr);
66181         LDKCOption_ThirtyTwoBytesZ payment_hash_conv = *(LDKCOption_ThirtyTwoBytesZ*)(payment_hash_ptr);
66182         payment_hash_conv = COption_ThirtyTwoBytesZ_clone((LDKCOption_ThirtyTwoBytesZ*)untag_ptr(payment_hash));
66183         LDKPath path_conv;
66184         path_conv.inner = untag_ptr(path);
66185         path_conv.is_owned = ptr_is_owned(path);
66186         CHECK_INNER_FIELD_ACCESS_OR_NULL(path_conv);
66187         path_conv = Path_clone(&path_conv);
66188         LDKEvent *ret_copy = MALLOC(sizeof(LDKEvent), "LDKEvent");
66189         *ret_copy = Event_payment_path_successful(payment_id_ref, payment_hash_conv, path_conv);
66190         uint64_t ret_ref = tag_ptr(ret_copy, true);
66191         return ret_ref;
66192 }
66193
66194 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) {
66195         void* payment_id_ptr = untag_ptr(payment_id);
66196         CHECK_ACCESS(payment_id_ptr);
66197         LDKCOption_ThirtyTwoBytesZ payment_id_conv = *(LDKCOption_ThirtyTwoBytesZ*)(payment_id_ptr);
66198         payment_id_conv = COption_ThirtyTwoBytesZ_clone((LDKCOption_ThirtyTwoBytesZ*)untag_ptr(payment_id));
66199         LDKThirtyTwoBytes payment_hash_ref;
66200         CHECK(payment_hash->arr_len == 32);
66201         memcpy(payment_hash_ref.data, payment_hash->elems, 32); FREE(payment_hash);
66202         void* failure_ptr = untag_ptr(failure);
66203         CHECK_ACCESS(failure_ptr);
66204         LDKPathFailure failure_conv = *(LDKPathFailure*)(failure_ptr);
66205         failure_conv = PathFailure_clone((LDKPathFailure*)untag_ptr(failure));
66206         LDKPath path_conv;
66207         path_conv.inner = untag_ptr(path);
66208         path_conv.is_owned = ptr_is_owned(path);
66209         CHECK_INNER_FIELD_ACCESS_OR_NULL(path_conv);
66210         path_conv = Path_clone(&path_conv);
66211         void* short_channel_id_ptr = untag_ptr(short_channel_id);
66212         CHECK_ACCESS(short_channel_id_ptr);
66213         LDKCOption_u64Z short_channel_id_conv = *(LDKCOption_u64Z*)(short_channel_id_ptr);
66214         short_channel_id_conv = COption_u64Z_clone((LDKCOption_u64Z*)untag_ptr(short_channel_id));
66215         LDKEvent *ret_copy = MALLOC(sizeof(LDKEvent), "LDKEvent");
66216         *ret_copy = Event_payment_path_failed(payment_id_conv, payment_hash_ref, payment_failed_permanently, failure_conv, path_conv, short_channel_id_conv);
66217         uint64_t ret_ref = tag_ptr(ret_copy, true);
66218         return ret_ref;
66219 }
66220
66221 uint64_t  __attribute__((export_name("TS_Event_probe_successful"))) TS_Event_probe_successful(int8_tArray payment_id, int8_tArray payment_hash, uint64_t path) {
66222         LDKThirtyTwoBytes payment_id_ref;
66223         CHECK(payment_id->arr_len == 32);
66224         memcpy(payment_id_ref.data, payment_id->elems, 32); FREE(payment_id);
66225         LDKThirtyTwoBytes payment_hash_ref;
66226         CHECK(payment_hash->arr_len == 32);
66227         memcpy(payment_hash_ref.data, payment_hash->elems, 32); FREE(payment_hash);
66228         LDKPath path_conv;
66229         path_conv.inner = untag_ptr(path);
66230         path_conv.is_owned = ptr_is_owned(path);
66231         CHECK_INNER_FIELD_ACCESS_OR_NULL(path_conv);
66232         path_conv = Path_clone(&path_conv);
66233         LDKEvent *ret_copy = MALLOC(sizeof(LDKEvent), "LDKEvent");
66234         *ret_copy = Event_probe_successful(payment_id_ref, payment_hash_ref, path_conv);
66235         uint64_t ret_ref = tag_ptr(ret_copy, true);
66236         return ret_ref;
66237 }
66238
66239 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) {
66240         LDKThirtyTwoBytes payment_id_ref;
66241         CHECK(payment_id->arr_len == 32);
66242         memcpy(payment_id_ref.data, payment_id->elems, 32); FREE(payment_id);
66243         LDKThirtyTwoBytes payment_hash_ref;
66244         CHECK(payment_hash->arr_len == 32);
66245         memcpy(payment_hash_ref.data, payment_hash->elems, 32); FREE(payment_hash);
66246         LDKPath path_conv;
66247         path_conv.inner = untag_ptr(path);
66248         path_conv.is_owned = ptr_is_owned(path);
66249         CHECK_INNER_FIELD_ACCESS_OR_NULL(path_conv);
66250         path_conv = Path_clone(&path_conv);
66251         void* short_channel_id_ptr = untag_ptr(short_channel_id);
66252         CHECK_ACCESS(short_channel_id_ptr);
66253         LDKCOption_u64Z short_channel_id_conv = *(LDKCOption_u64Z*)(short_channel_id_ptr);
66254         short_channel_id_conv = COption_u64Z_clone((LDKCOption_u64Z*)untag_ptr(short_channel_id));
66255         LDKEvent *ret_copy = MALLOC(sizeof(LDKEvent), "LDKEvent");
66256         *ret_copy = Event_probe_failed(payment_id_ref, payment_hash_ref, path_conv, short_channel_id_conv);
66257         uint64_t ret_ref = tag_ptr(ret_copy, true);
66258         return ret_ref;
66259 }
66260
66261 uint64_t  __attribute__((export_name("TS_Event_pending_htlcs_forwardable"))) TS_Event_pending_htlcs_forwardable(int64_t time_forwardable) {
66262         LDKEvent *ret_copy = MALLOC(sizeof(LDKEvent), "LDKEvent");
66263         *ret_copy = Event_pending_htlcs_forwardable(time_forwardable);
66264         uint64_t ret_ref = tag_ptr(ret_copy, true);
66265         return ret_ref;
66266 }
66267
66268 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) {
66269         LDKThirtyTwoBytes intercept_id_ref;
66270         CHECK(intercept_id->arr_len == 32);
66271         memcpy(intercept_id_ref.data, intercept_id->elems, 32); FREE(intercept_id);
66272         LDKThirtyTwoBytes payment_hash_ref;
66273         CHECK(payment_hash->arr_len == 32);
66274         memcpy(payment_hash_ref.data, payment_hash->elems, 32); FREE(payment_hash);
66275         LDKEvent *ret_copy = MALLOC(sizeof(LDKEvent), "LDKEvent");
66276         *ret_copy = Event_htlcintercepted(intercept_id_ref, requested_next_hop_scid, payment_hash_ref, inbound_amount_msat, expected_outbound_amount_msat);
66277         uint64_t ret_ref = tag_ptr(ret_copy, true);
66278         return ret_ref;
66279 }
66280
66281 uint64_t  __attribute__((export_name("TS_Event_spendable_outputs"))) TS_Event_spendable_outputs(uint64_tArray outputs, uint64_t channel_id) {
66282         LDKCVec_SpendableOutputDescriptorZ outputs_constr;
66283         outputs_constr.datalen = outputs->arr_len;
66284         if (outputs_constr.datalen > 0)
66285                 outputs_constr.data = MALLOC(outputs_constr.datalen * sizeof(LDKSpendableOutputDescriptor), "LDKCVec_SpendableOutputDescriptorZ Elements");
66286         else
66287                 outputs_constr.data = NULL;
66288         uint64_t* outputs_vals = outputs->elems;
66289         for (size_t b = 0; b < outputs_constr.datalen; b++) {
66290                 uint64_t outputs_conv_27 = outputs_vals[b];
66291                 void* outputs_conv_27_ptr = untag_ptr(outputs_conv_27);
66292                 CHECK_ACCESS(outputs_conv_27_ptr);
66293                 LDKSpendableOutputDescriptor outputs_conv_27_conv = *(LDKSpendableOutputDescriptor*)(outputs_conv_27_ptr);
66294                 outputs_conv_27_conv = SpendableOutputDescriptor_clone((LDKSpendableOutputDescriptor*)untag_ptr(outputs_conv_27));
66295                 outputs_constr.data[b] = outputs_conv_27_conv;
66296         }
66297         FREE(outputs);
66298         void* channel_id_ptr = untag_ptr(channel_id);
66299         CHECK_ACCESS(channel_id_ptr);
66300         LDKCOption_ThirtyTwoBytesZ channel_id_conv = *(LDKCOption_ThirtyTwoBytesZ*)(channel_id_ptr);
66301         channel_id_conv = COption_ThirtyTwoBytesZ_clone((LDKCOption_ThirtyTwoBytesZ*)untag_ptr(channel_id));
66302         LDKEvent *ret_copy = MALLOC(sizeof(LDKEvent), "LDKEvent");
66303         *ret_copy = Event_spendable_outputs(outputs_constr, channel_id_conv);
66304         uint64_t ret_ref = tag_ptr(ret_copy, true);
66305         return ret_ref;
66306 }
66307
66308 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) {
66309         void* prev_channel_id_ptr = untag_ptr(prev_channel_id);
66310         CHECK_ACCESS(prev_channel_id_ptr);
66311         LDKCOption_ThirtyTwoBytesZ prev_channel_id_conv = *(LDKCOption_ThirtyTwoBytesZ*)(prev_channel_id_ptr);
66312         prev_channel_id_conv = COption_ThirtyTwoBytesZ_clone((LDKCOption_ThirtyTwoBytesZ*)untag_ptr(prev_channel_id));
66313         void* next_channel_id_ptr = untag_ptr(next_channel_id);
66314         CHECK_ACCESS(next_channel_id_ptr);
66315         LDKCOption_ThirtyTwoBytesZ next_channel_id_conv = *(LDKCOption_ThirtyTwoBytesZ*)(next_channel_id_ptr);
66316         next_channel_id_conv = COption_ThirtyTwoBytesZ_clone((LDKCOption_ThirtyTwoBytesZ*)untag_ptr(next_channel_id));
66317         void* fee_earned_msat_ptr = untag_ptr(fee_earned_msat);
66318         CHECK_ACCESS(fee_earned_msat_ptr);
66319         LDKCOption_u64Z fee_earned_msat_conv = *(LDKCOption_u64Z*)(fee_earned_msat_ptr);
66320         fee_earned_msat_conv = COption_u64Z_clone((LDKCOption_u64Z*)untag_ptr(fee_earned_msat));
66321         void* outbound_amount_forwarded_msat_ptr = untag_ptr(outbound_amount_forwarded_msat);
66322         CHECK_ACCESS(outbound_amount_forwarded_msat_ptr);
66323         LDKCOption_u64Z outbound_amount_forwarded_msat_conv = *(LDKCOption_u64Z*)(outbound_amount_forwarded_msat_ptr);
66324         outbound_amount_forwarded_msat_conv = COption_u64Z_clone((LDKCOption_u64Z*)untag_ptr(outbound_amount_forwarded_msat));
66325         LDKEvent *ret_copy = MALLOC(sizeof(LDKEvent), "LDKEvent");
66326         *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);
66327         uint64_t ret_ref = tag_ptr(ret_copy, true);
66328         return ret_ref;
66329 }
66330
66331 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) {
66332         LDKThirtyTwoBytes channel_id_ref;
66333         CHECK(channel_id->arr_len == 32);
66334         memcpy(channel_id_ref.data, channel_id->elems, 32); FREE(channel_id);
66335         LDKU128 user_channel_id_ref;
66336         CHECK(user_channel_id->arr_len == 16);
66337         memcpy(user_channel_id_ref.le_bytes, user_channel_id->elems, 16); FREE(user_channel_id);
66338         void* former_temporary_channel_id_ptr = untag_ptr(former_temporary_channel_id);
66339         CHECK_ACCESS(former_temporary_channel_id_ptr);
66340         LDKCOption_ThirtyTwoBytesZ former_temporary_channel_id_conv = *(LDKCOption_ThirtyTwoBytesZ*)(former_temporary_channel_id_ptr);
66341         former_temporary_channel_id_conv = COption_ThirtyTwoBytesZ_clone((LDKCOption_ThirtyTwoBytesZ*)untag_ptr(former_temporary_channel_id));
66342         LDKPublicKey counterparty_node_id_ref;
66343         CHECK(counterparty_node_id->arr_len == 33);
66344         memcpy(counterparty_node_id_ref.compressed_form, counterparty_node_id->elems, 33); FREE(counterparty_node_id);
66345         LDKOutPoint funding_txo_conv;
66346         funding_txo_conv.inner = untag_ptr(funding_txo);
66347         funding_txo_conv.is_owned = ptr_is_owned(funding_txo);
66348         CHECK_INNER_FIELD_ACCESS_OR_NULL(funding_txo_conv);
66349         funding_txo_conv = OutPoint_clone(&funding_txo_conv);
66350         LDKEvent *ret_copy = MALLOC(sizeof(LDKEvent), "LDKEvent");
66351         *ret_copy = Event_channel_pending(channel_id_ref, user_channel_id_ref, former_temporary_channel_id_conv, counterparty_node_id_ref, funding_txo_conv);
66352         uint64_t ret_ref = tag_ptr(ret_copy, true);
66353         return ret_ref;
66354 }
66355
66356 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) {
66357         LDKThirtyTwoBytes channel_id_ref;
66358         CHECK(channel_id->arr_len == 32);
66359         memcpy(channel_id_ref.data, channel_id->elems, 32); FREE(channel_id);
66360         LDKU128 user_channel_id_ref;
66361         CHECK(user_channel_id->arr_len == 16);
66362         memcpy(user_channel_id_ref.le_bytes, user_channel_id->elems, 16); FREE(user_channel_id);
66363         LDKPublicKey counterparty_node_id_ref;
66364         CHECK(counterparty_node_id->arr_len == 33);
66365         memcpy(counterparty_node_id_ref.compressed_form, counterparty_node_id->elems, 33); FREE(counterparty_node_id);
66366         LDKChannelTypeFeatures channel_type_conv;
66367         channel_type_conv.inner = untag_ptr(channel_type);
66368         channel_type_conv.is_owned = ptr_is_owned(channel_type);
66369         CHECK_INNER_FIELD_ACCESS_OR_NULL(channel_type_conv);
66370         channel_type_conv = ChannelTypeFeatures_clone(&channel_type_conv);
66371         LDKEvent *ret_copy = MALLOC(sizeof(LDKEvent), "LDKEvent");
66372         *ret_copy = Event_channel_ready(channel_id_ref, user_channel_id_ref, counterparty_node_id_ref, channel_type_conv);
66373         uint64_t ret_ref = tag_ptr(ret_copy, true);
66374         return ret_ref;
66375 }
66376
66377 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) {
66378         LDKThirtyTwoBytes channel_id_ref;
66379         CHECK(channel_id->arr_len == 32);
66380         memcpy(channel_id_ref.data, channel_id->elems, 32); FREE(channel_id);
66381         LDKU128 user_channel_id_ref;
66382         CHECK(user_channel_id->arr_len == 16);
66383         memcpy(user_channel_id_ref.le_bytes, user_channel_id->elems, 16); FREE(user_channel_id);
66384         void* reason_ptr = untag_ptr(reason);
66385         CHECK_ACCESS(reason_ptr);
66386         LDKClosureReason reason_conv = *(LDKClosureReason*)(reason_ptr);
66387         reason_conv = ClosureReason_clone((LDKClosureReason*)untag_ptr(reason));
66388         LDKPublicKey counterparty_node_id_ref;
66389         CHECK(counterparty_node_id->arr_len == 33);
66390         memcpy(counterparty_node_id_ref.compressed_form, counterparty_node_id->elems, 33); FREE(counterparty_node_id);
66391         void* channel_capacity_sats_ptr = untag_ptr(channel_capacity_sats);
66392         CHECK_ACCESS(channel_capacity_sats_ptr);
66393         LDKCOption_u64Z channel_capacity_sats_conv = *(LDKCOption_u64Z*)(channel_capacity_sats_ptr);
66394         channel_capacity_sats_conv = COption_u64Z_clone((LDKCOption_u64Z*)untag_ptr(channel_capacity_sats));
66395         LDKEvent *ret_copy = MALLOC(sizeof(LDKEvent), "LDKEvent");
66396         *ret_copy = Event_channel_closed(channel_id_ref, user_channel_id_ref, reason_conv, counterparty_node_id_ref, channel_capacity_sats_conv);
66397         uint64_t ret_ref = tag_ptr(ret_copy, true);
66398         return ret_ref;
66399 }
66400
66401 uint64_t  __attribute__((export_name("TS_Event_discard_funding"))) TS_Event_discard_funding(int8_tArray channel_id, int8_tArray transaction) {
66402         LDKThirtyTwoBytes channel_id_ref;
66403         CHECK(channel_id->arr_len == 32);
66404         memcpy(channel_id_ref.data, channel_id->elems, 32); FREE(channel_id);
66405         LDKTransaction transaction_ref;
66406         transaction_ref.datalen = transaction->arr_len;
66407         transaction_ref.data = MALLOC(transaction_ref.datalen, "LDKTransaction Bytes");
66408         memcpy(transaction_ref.data, transaction->elems, transaction_ref.datalen); FREE(transaction);
66409         transaction_ref.data_is_owned = true;
66410         LDKEvent *ret_copy = MALLOC(sizeof(LDKEvent), "LDKEvent");
66411         *ret_copy = Event_discard_funding(channel_id_ref, transaction_ref);
66412         uint64_t ret_ref = tag_ptr(ret_copy, true);
66413         return ret_ref;
66414 }
66415
66416 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) {
66417         LDKThirtyTwoBytes temporary_channel_id_ref;
66418         CHECK(temporary_channel_id->arr_len == 32);
66419         memcpy(temporary_channel_id_ref.data, temporary_channel_id->elems, 32); FREE(temporary_channel_id);
66420         LDKPublicKey counterparty_node_id_ref;
66421         CHECK(counterparty_node_id->arr_len == 33);
66422         memcpy(counterparty_node_id_ref.compressed_form, counterparty_node_id->elems, 33); FREE(counterparty_node_id);
66423         LDKChannelTypeFeatures channel_type_conv;
66424         channel_type_conv.inner = untag_ptr(channel_type);
66425         channel_type_conv.is_owned = ptr_is_owned(channel_type);
66426         CHECK_INNER_FIELD_ACCESS_OR_NULL(channel_type_conv);
66427         channel_type_conv = ChannelTypeFeatures_clone(&channel_type_conv);
66428         LDKEvent *ret_copy = MALLOC(sizeof(LDKEvent), "LDKEvent");
66429         *ret_copy = Event_open_channel_request(temporary_channel_id_ref, counterparty_node_id_ref, funding_satoshis, push_msat, channel_type_conv);
66430         uint64_t ret_ref = tag_ptr(ret_copy, true);
66431         return ret_ref;
66432 }
66433
66434 uint64_t  __attribute__((export_name("TS_Event_htlchandling_failed"))) TS_Event_htlchandling_failed(int8_tArray prev_channel_id, uint64_t failed_next_destination) {
66435         LDKThirtyTwoBytes prev_channel_id_ref;
66436         CHECK(prev_channel_id->arr_len == 32);
66437         memcpy(prev_channel_id_ref.data, prev_channel_id->elems, 32); FREE(prev_channel_id);
66438         void* failed_next_destination_ptr = untag_ptr(failed_next_destination);
66439         CHECK_ACCESS(failed_next_destination_ptr);
66440         LDKHTLCDestination failed_next_destination_conv = *(LDKHTLCDestination*)(failed_next_destination_ptr);
66441         failed_next_destination_conv = HTLCDestination_clone((LDKHTLCDestination*)untag_ptr(failed_next_destination));
66442         LDKEvent *ret_copy = MALLOC(sizeof(LDKEvent), "LDKEvent");
66443         *ret_copy = Event_htlchandling_failed(prev_channel_id_ref, failed_next_destination_conv);
66444         uint64_t ret_ref = tag_ptr(ret_copy, true);
66445         return ret_ref;
66446 }
66447
66448 uint64_t  __attribute__((export_name("TS_Event_bump_transaction"))) TS_Event_bump_transaction(uint64_t a) {
66449         void* a_ptr = untag_ptr(a);
66450         CHECK_ACCESS(a_ptr);
66451         LDKBumpTransactionEvent a_conv = *(LDKBumpTransactionEvent*)(a_ptr);
66452         a_conv = BumpTransactionEvent_clone((LDKBumpTransactionEvent*)untag_ptr(a));
66453         LDKEvent *ret_copy = MALLOC(sizeof(LDKEvent), "LDKEvent");
66454         *ret_copy = Event_bump_transaction(a_conv);
66455         uint64_t ret_ref = tag_ptr(ret_copy, true);
66456         return ret_ref;
66457 }
66458
66459 jboolean  __attribute__((export_name("TS_Event_eq"))) TS_Event_eq(uint64_t a, uint64_t b) {
66460         LDKEvent* a_conv = (LDKEvent*)untag_ptr(a);
66461         LDKEvent* b_conv = (LDKEvent*)untag_ptr(b);
66462         jboolean ret_conv = Event_eq(a_conv, b_conv);
66463         return ret_conv;
66464 }
66465
66466 int8_tArray  __attribute__((export_name("TS_Event_write"))) TS_Event_write(uint64_t obj) {
66467         LDKEvent* obj_conv = (LDKEvent*)untag_ptr(obj);
66468         LDKCVec_u8Z ret_var = Event_write(obj_conv);
66469         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
66470         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
66471         CVec_u8Z_free(ret_var);
66472         return ret_arr;
66473 }
66474
66475 uint64_t  __attribute__((export_name("TS_Event_read"))) TS_Event_read(int8_tArray ser) {
66476         LDKu8slice ser_ref;
66477         ser_ref.datalen = ser->arr_len;
66478         ser_ref.data = ser->elems;
66479         LDKCResult_COption_EventZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_COption_EventZDecodeErrorZ), "LDKCResult_COption_EventZDecodeErrorZ");
66480         *ret_conv = Event_read(ser_ref);
66481         FREE(ser);
66482         return tag_ptr(ret_conv, true);
66483 }
66484
66485 void  __attribute__((export_name("TS_MessageSendEvent_free"))) TS_MessageSendEvent_free(uint64_t this_ptr) {
66486         if (!ptr_is_owned(this_ptr)) return;
66487         void* this_ptr_ptr = untag_ptr(this_ptr);
66488         CHECK_ACCESS(this_ptr_ptr);
66489         LDKMessageSendEvent this_ptr_conv = *(LDKMessageSendEvent*)(this_ptr_ptr);
66490         FREE(untag_ptr(this_ptr));
66491         MessageSendEvent_free(this_ptr_conv);
66492 }
66493
66494 static inline uint64_t MessageSendEvent_clone_ptr(LDKMessageSendEvent *NONNULL_PTR arg) {
66495         LDKMessageSendEvent *ret_copy = MALLOC(sizeof(LDKMessageSendEvent), "LDKMessageSendEvent");
66496         *ret_copy = MessageSendEvent_clone(arg);
66497         uint64_t ret_ref = tag_ptr(ret_copy, true);
66498         return ret_ref;
66499 }
66500 int64_t  __attribute__((export_name("TS_MessageSendEvent_clone_ptr"))) TS_MessageSendEvent_clone_ptr(uint64_t arg) {
66501         LDKMessageSendEvent* arg_conv = (LDKMessageSendEvent*)untag_ptr(arg);
66502         int64_t ret_conv = MessageSendEvent_clone_ptr(arg_conv);
66503         return ret_conv;
66504 }
66505
66506 uint64_t  __attribute__((export_name("TS_MessageSendEvent_clone"))) TS_MessageSendEvent_clone(uint64_t orig) {
66507         LDKMessageSendEvent* orig_conv = (LDKMessageSendEvent*)untag_ptr(orig);
66508         LDKMessageSendEvent *ret_copy = MALLOC(sizeof(LDKMessageSendEvent), "LDKMessageSendEvent");
66509         *ret_copy = MessageSendEvent_clone(orig_conv);
66510         uint64_t ret_ref = tag_ptr(ret_copy, true);
66511         return ret_ref;
66512 }
66513
66514 uint64_t  __attribute__((export_name("TS_MessageSendEvent_send_accept_channel"))) TS_MessageSendEvent_send_accept_channel(int8_tArray node_id, uint64_t msg) {
66515         LDKPublicKey node_id_ref;
66516         CHECK(node_id->arr_len == 33);
66517         memcpy(node_id_ref.compressed_form, node_id->elems, 33); FREE(node_id);
66518         LDKAcceptChannel msg_conv;
66519         msg_conv.inner = untag_ptr(msg);
66520         msg_conv.is_owned = ptr_is_owned(msg);
66521         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
66522         msg_conv = AcceptChannel_clone(&msg_conv);
66523         LDKMessageSendEvent *ret_copy = MALLOC(sizeof(LDKMessageSendEvent), "LDKMessageSendEvent");
66524         *ret_copy = MessageSendEvent_send_accept_channel(node_id_ref, msg_conv);
66525         uint64_t ret_ref = tag_ptr(ret_copy, true);
66526         return ret_ref;
66527 }
66528
66529 uint64_t  __attribute__((export_name("TS_MessageSendEvent_send_accept_channel_v2"))) TS_MessageSendEvent_send_accept_channel_v2(int8_tArray node_id, uint64_t msg) {
66530         LDKPublicKey node_id_ref;
66531         CHECK(node_id->arr_len == 33);
66532         memcpy(node_id_ref.compressed_form, node_id->elems, 33); FREE(node_id);
66533         LDKAcceptChannelV2 msg_conv;
66534         msg_conv.inner = untag_ptr(msg);
66535         msg_conv.is_owned = ptr_is_owned(msg);
66536         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
66537         msg_conv = AcceptChannelV2_clone(&msg_conv);
66538         LDKMessageSendEvent *ret_copy = MALLOC(sizeof(LDKMessageSendEvent), "LDKMessageSendEvent");
66539         *ret_copy = MessageSendEvent_send_accept_channel_v2(node_id_ref, msg_conv);
66540         uint64_t ret_ref = tag_ptr(ret_copy, true);
66541         return ret_ref;
66542 }
66543
66544 uint64_t  __attribute__((export_name("TS_MessageSendEvent_send_open_channel"))) TS_MessageSendEvent_send_open_channel(int8_tArray node_id, uint64_t msg) {
66545         LDKPublicKey node_id_ref;
66546         CHECK(node_id->arr_len == 33);
66547         memcpy(node_id_ref.compressed_form, node_id->elems, 33); FREE(node_id);
66548         LDKOpenChannel msg_conv;
66549         msg_conv.inner = untag_ptr(msg);
66550         msg_conv.is_owned = ptr_is_owned(msg);
66551         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
66552         msg_conv = OpenChannel_clone(&msg_conv);
66553         LDKMessageSendEvent *ret_copy = MALLOC(sizeof(LDKMessageSendEvent), "LDKMessageSendEvent");
66554         *ret_copy = MessageSendEvent_send_open_channel(node_id_ref, msg_conv);
66555         uint64_t ret_ref = tag_ptr(ret_copy, true);
66556         return ret_ref;
66557 }
66558
66559 uint64_t  __attribute__((export_name("TS_MessageSendEvent_send_open_channel_v2"))) TS_MessageSendEvent_send_open_channel_v2(int8_tArray node_id, uint64_t msg) {
66560         LDKPublicKey node_id_ref;
66561         CHECK(node_id->arr_len == 33);
66562         memcpy(node_id_ref.compressed_form, node_id->elems, 33); FREE(node_id);
66563         LDKOpenChannelV2 msg_conv;
66564         msg_conv.inner = untag_ptr(msg);
66565         msg_conv.is_owned = ptr_is_owned(msg);
66566         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
66567         msg_conv = OpenChannelV2_clone(&msg_conv);
66568         LDKMessageSendEvent *ret_copy = MALLOC(sizeof(LDKMessageSendEvent), "LDKMessageSendEvent");
66569         *ret_copy = MessageSendEvent_send_open_channel_v2(node_id_ref, msg_conv);
66570         uint64_t ret_ref = tag_ptr(ret_copy, true);
66571         return ret_ref;
66572 }
66573
66574 uint64_t  __attribute__((export_name("TS_MessageSendEvent_send_funding_created"))) TS_MessageSendEvent_send_funding_created(int8_tArray node_id, uint64_t msg) {
66575         LDKPublicKey node_id_ref;
66576         CHECK(node_id->arr_len == 33);
66577         memcpy(node_id_ref.compressed_form, node_id->elems, 33); FREE(node_id);
66578         LDKFundingCreated msg_conv;
66579         msg_conv.inner = untag_ptr(msg);
66580         msg_conv.is_owned = ptr_is_owned(msg);
66581         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
66582         msg_conv = FundingCreated_clone(&msg_conv);
66583         LDKMessageSendEvent *ret_copy = MALLOC(sizeof(LDKMessageSendEvent), "LDKMessageSendEvent");
66584         *ret_copy = MessageSendEvent_send_funding_created(node_id_ref, msg_conv);
66585         uint64_t ret_ref = tag_ptr(ret_copy, true);
66586         return ret_ref;
66587 }
66588
66589 uint64_t  __attribute__((export_name("TS_MessageSendEvent_send_funding_signed"))) TS_MessageSendEvent_send_funding_signed(int8_tArray node_id, uint64_t msg) {
66590         LDKPublicKey node_id_ref;
66591         CHECK(node_id->arr_len == 33);
66592         memcpy(node_id_ref.compressed_form, node_id->elems, 33); FREE(node_id);
66593         LDKFundingSigned msg_conv;
66594         msg_conv.inner = untag_ptr(msg);
66595         msg_conv.is_owned = ptr_is_owned(msg);
66596         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
66597         msg_conv = FundingSigned_clone(&msg_conv);
66598         LDKMessageSendEvent *ret_copy = MALLOC(sizeof(LDKMessageSendEvent), "LDKMessageSendEvent");
66599         *ret_copy = MessageSendEvent_send_funding_signed(node_id_ref, msg_conv);
66600         uint64_t ret_ref = tag_ptr(ret_copy, true);
66601         return ret_ref;
66602 }
66603
66604 uint64_t  __attribute__((export_name("TS_MessageSendEvent_send_tx_add_input"))) TS_MessageSendEvent_send_tx_add_input(int8_tArray node_id, uint64_t msg) {
66605         LDKPublicKey node_id_ref;
66606         CHECK(node_id->arr_len == 33);
66607         memcpy(node_id_ref.compressed_form, node_id->elems, 33); FREE(node_id);
66608         LDKTxAddInput msg_conv;
66609         msg_conv.inner = untag_ptr(msg);
66610         msg_conv.is_owned = ptr_is_owned(msg);
66611         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
66612         msg_conv = TxAddInput_clone(&msg_conv);
66613         LDKMessageSendEvent *ret_copy = MALLOC(sizeof(LDKMessageSendEvent), "LDKMessageSendEvent");
66614         *ret_copy = MessageSendEvent_send_tx_add_input(node_id_ref, msg_conv);
66615         uint64_t ret_ref = tag_ptr(ret_copy, true);
66616         return ret_ref;
66617 }
66618
66619 uint64_t  __attribute__((export_name("TS_MessageSendEvent_send_tx_add_output"))) TS_MessageSendEvent_send_tx_add_output(int8_tArray node_id, uint64_t msg) {
66620         LDKPublicKey node_id_ref;
66621         CHECK(node_id->arr_len == 33);
66622         memcpy(node_id_ref.compressed_form, node_id->elems, 33); FREE(node_id);
66623         LDKTxAddOutput msg_conv;
66624         msg_conv.inner = untag_ptr(msg);
66625         msg_conv.is_owned = ptr_is_owned(msg);
66626         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
66627         msg_conv = TxAddOutput_clone(&msg_conv);
66628         LDKMessageSendEvent *ret_copy = MALLOC(sizeof(LDKMessageSendEvent), "LDKMessageSendEvent");
66629         *ret_copy = MessageSendEvent_send_tx_add_output(node_id_ref, msg_conv);
66630         uint64_t ret_ref = tag_ptr(ret_copy, true);
66631         return ret_ref;
66632 }
66633
66634 uint64_t  __attribute__((export_name("TS_MessageSendEvent_send_tx_remove_input"))) TS_MessageSendEvent_send_tx_remove_input(int8_tArray node_id, uint64_t msg) {
66635         LDKPublicKey node_id_ref;
66636         CHECK(node_id->arr_len == 33);
66637         memcpy(node_id_ref.compressed_form, node_id->elems, 33); FREE(node_id);
66638         LDKTxRemoveInput msg_conv;
66639         msg_conv.inner = untag_ptr(msg);
66640         msg_conv.is_owned = ptr_is_owned(msg);
66641         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
66642         msg_conv = TxRemoveInput_clone(&msg_conv);
66643         LDKMessageSendEvent *ret_copy = MALLOC(sizeof(LDKMessageSendEvent), "LDKMessageSendEvent");
66644         *ret_copy = MessageSendEvent_send_tx_remove_input(node_id_ref, msg_conv);
66645         uint64_t ret_ref = tag_ptr(ret_copy, true);
66646         return ret_ref;
66647 }
66648
66649 uint64_t  __attribute__((export_name("TS_MessageSendEvent_send_tx_remove_output"))) TS_MessageSendEvent_send_tx_remove_output(int8_tArray node_id, uint64_t msg) {
66650         LDKPublicKey node_id_ref;
66651         CHECK(node_id->arr_len == 33);
66652         memcpy(node_id_ref.compressed_form, node_id->elems, 33); FREE(node_id);
66653         LDKTxRemoveOutput msg_conv;
66654         msg_conv.inner = untag_ptr(msg);
66655         msg_conv.is_owned = ptr_is_owned(msg);
66656         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
66657         msg_conv = TxRemoveOutput_clone(&msg_conv);
66658         LDKMessageSendEvent *ret_copy = MALLOC(sizeof(LDKMessageSendEvent), "LDKMessageSendEvent");
66659         *ret_copy = MessageSendEvent_send_tx_remove_output(node_id_ref, msg_conv);
66660         uint64_t ret_ref = tag_ptr(ret_copy, true);
66661         return ret_ref;
66662 }
66663
66664 uint64_t  __attribute__((export_name("TS_MessageSendEvent_send_tx_complete"))) TS_MessageSendEvent_send_tx_complete(int8_tArray node_id, uint64_t msg) {
66665         LDKPublicKey node_id_ref;
66666         CHECK(node_id->arr_len == 33);
66667         memcpy(node_id_ref.compressed_form, node_id->elems, 33); FREE(node_id);
66668         LDKTxComplete msg_conv;
66669         msg_conv.inner = untag_ptr(msg);
66670         msg_conv.is_owned = ptr_is_owned(msg);
66671         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
66672         msg_conv = TxComplete_clone(&msg_conv);
66673         LDKMessageSendEvent *ret_copy = MALLOC(sizeof(LDKMessageSendEvent), "LDKMessageSendEvent");
66674         *ret_copy = MessageSendEvent_send_tx_complete(node_id_ref, msg_conv);
66675         uint64_t ret_ref = tag_ptr(ret_copy, true);
66676         return ret_ref;
66677 }
66678
66679 uint64_t  __attribute__((export_name("TS_MessageSendEvent_send_tx_signatures"))) TS_MessageSendEvent_send_tx_signatures(int8_tArray node_id, uint64_t msg) {
66680         LDKPublicKey node_id_ref;
66681         CHECK(node_id->arr_len == 33);
66682         memcpy(node_id_ref.compressed_form, node_id->elems, 33); FREE(node_id);
66683         LDKTxSignatures msg_conv;
66684         msg_conv.inner = untag_ptr(msg);
66685         msg_conv.is_owned = ptr_is_owned(msg);
66686         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
66687         msg_conv = TxSignatures_clone(&msg_conv);
66688         LDKMessageSendEvent *ret_copy = MALLOC(sizeof(LDKMessageSendEvent), "LDKMessageSendEvent");
66689         *ret_copy = MessageSendEvent_send_tx_signatures(node_id_ref, msg_conv);
66690         uint64_t ret_ref = tag_ptr(ret_copy, true);
66691         return ret_ref;
66692 }
66693
66694 uint64_t  __attribute__((export_name("TS_MessageSendEvent_send_tx_init_rbf"))) TS_MessageSendEvent_send_tx_init_rbf(int8_tArray node_id, uint64_t msg) {
66695         LDKPublicKey node_id_ref;
66696         CHECK(node_id->arr_len == 33);
66697         memcpy(node_id_ref.compressed_form, node_id->elems, 33); FREE(node_id);
66698         LDKTxInitRbf msg_conv;
66699         msg_conv.inner = untag_ptr(msg);
66700         msg_conv.is_owned = ptr_is_owned(msg);
66701         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
66702         msg_conv = TxInitRbf_clone(&msg_conv);
66703         LDKMessageSendEvent *ret_copy = MALLOC(sizeof(LDKMessageSendEvent), "LDKMessageSendEvent");
66704         *ret_copy = MessageSendEvent_send_tx_init_rbf(node_id_ref, msg_conv);
66705         uint64_t ret_ref = tag_ptr(ret_copy, true);
66706         return ret_ref;
66707 }
66708
66709 uint64_t  __attribute__((export_name("TS_MessageSendEvent_send_tx_ack_rbf"))) TS_MessageSendEvent_send_tx_ack_rbf(int8_tArray node_id, uint64_t msg) {
66710         LDKPublicKey node_id_ref;
66711         CHECK(node_id->arr_len == 33);
66712         memcpy(node_id_ref.compressed_form, node_id->elems, 33); FREE(node_id);
66713         LDKTxAckRbf msg_conv;
66714         msg_conv.inner = untag_ptr(msg);
66715         msg_conv.is_owned = ptr_is_owned(msg);
66716         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
66717         msg_conv = TxAckRbf_clone(&msg_conv);
66718         LDKMessageSendEvent *ret_copy = MALLOC(sizeof(LDKMessageSendEvent), "LDKMessageSendEvent");
66719         *ret_copy = MessageSendEvent_send_tx_ack_rbf(node_id_ref, msg_conv);
66720         uint64_t ret_ref = tag_ptr(ret_copy, true);
66721         return ret_ref;
66722 }
66723
66724 uint64_t  __attribute__((export_name("TS_MessageSendEvent_send_tx_abort"))) TS_MessageSendEvent_send_tx_abort(int8_tArray node_id, uint64_t msg) {
66725         LDKPublicKey node_id_ref;
66726         CHECK(node_id->arr_len == 33);
66727         memcpy(node_id_ref.compressed_form, node_id->elems, 33); FREE(node_id);
66728         LDKTxAbort msg_conv;
66729         msg_conv.inner = untag_ptr(msg);
66730         msg_conv.is_owned = ptr_is_owned(msg);
66731         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
66732         msg_conv = TxAbort_clone(&msg_conv);
66733         LDKMessageSendEvent *ret_copy = MALLOC(sizeof(LDKMessageSendEvent), "LDKMessageSendEvent");
66734         *ret_copy = MessageSendEvent_send_tx_abort(node_id_ref, msg_conv);
66735         uint64_t ret_ref = tag_ptr(ret_copy, true);
66736         return ret_ref;
66737 }
66738
66739 uint64_t  __attribute__((export_name("TS_MessageSendEvent_send_channel_ready"))) TS_MessageSendEvent_send_channel_ready(int8_tArray node_id, uint64_t msg) {
66740         LDKPublicKey node_id_ref;
66741         CHECK(node_id->arr_len == 33);
66742         memcpy(node_id_ref.compressed_form, node_id->elems, 33); FREE(node_id);
66743         LDKChannelReady msg_conv;
66744         msg_conv.inner = untag_ptr(msg);
66745         msg_conv.is_owned = ptr_is_owned(msg);
66746         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
66747         msg_conv = ChannelReady_clone(&msg_conv);
66748         LDKMessageSendEvent *ret_copy = MALLOC(sizeof(LDKMessageSendEvent), "LDKMessageSendEvent");
66749         *ret_copy = MessageSendEvent_send_channel_ready(node_id_ref, msg_conv);
66750         uint64_t ret_ref = tag_ptr(ret_copy, true);
66751         return ret_ref;
66752 }
66753
66754 uint64_t  __attribute__((export_name("TS_MessageSendEvent_send_announcement_signatures"))) TS_MessageSendEvent_send_announcement_signatures(int8_tArray node_id, uint64_t msg) {
66755         LDKPublicKey node_id_ref;
66756         CHECK(node_id->arr_len == 33);
66757         memcpy(node_id_ref.compressed_form, node_id->elems, 33); FREE(node_id);
66758         LDKAnnouncementSignatures msg_conv;
66759         msg_conv.inner = untag_ptr(msg);
66760         msg_conv.is_owned = ptr_is_owned(msg);
66761         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
66762         msg_conv = AnnouncementSignatures_clone(&msg_conv);
66763         LDKMessageSendEvent *ret_copy = MALLOC(sizeof(LDKMessageSendEvent), "LDKMessageSendEvent");
66764         *ret_copy = MessageSendEvent_send_announcement_signatures(node_id_ref, msg_conv);
66765         uint64_t ret_ref = tag_ptr(ret_copy, true);
66766         return ret_ref;
66767 }
66768
66769 uint64_t  __attribute__((export_name("TS_MessageSendEvent_update_htlcs"))) TS_MessageSendEvent_update_htlcs(int8_tArray node_id, uint64_t updates) {
66770         LDKPublicKey node_id_ref;
66771         CHECK(node_id->arr_len == 33);
66772         memcpy(node_id_ref.compressed_form, node_id->elems, 33); FREE(node_id);
66773         LDKCommitmentUpdate updates_conv;
66774         updates_conv.inner = untag_ptr(updates);
66775         updates_conv.is_owned = ptr_is_owned(updates);
66776         CHECK_INNER_FIELD_ACCESS_OR_NULL(updates_conv);
66777         updates_conv = CommitmentUpdate_clone(&updates_conv);
66778         LDKMessageSendEvent *ret_copy = MALLOC(sizeof(LDKMessageSendEvent), "LDKMessageSendEvent");
66779         *ret_copy = MessageSendEvent_update_htlcs(node_id_ref, updates_conv);
66780         uint64_t ret_ref = tag_ptr(ret_copy, true);
66781         return ret_ref;
66782 }
66783
66784 uint64_t  __attribute__((export_name("TS_MessageSendEvent_send_revoke_and_ack"))) TS_MessageSendEvent_send_revoke_and_ack(int8_tArray node_id, uint64_t msg) {
66785         LDKPublicKey node_id_ref;
66786         CHECK(node_id->arr_len == 33);
66787         memcpy(node_id_ref.compressed_form, node_id->elems, 33); FREE(node_id);
66788         LDKRevokeAndACK msg_conv;
66789         msg_conv.inner = untag_ptr(msg);
66790         msg_conv.is_owned = ptr_is_owned(msg);
66791         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
66792         msg_conv = RevokeAndACK_clone(&msg_conv);
66793         LDKMessageSendEvent *ret_copy = MALLOC(sizeof(LDKMessageSendEvent), "LDKMessageSendEvent");
66794         *ret_copy = MessageSendEvent_send_revoke_and_ack(node_id_ref, msg_conv);
66795         uint64_t ret_ref = tag_ptr(ret_copy, true);
66796         return ret_ref;
66797 }
66798
66799 uint64_t  __attribute__((export_name("TS_MessageSendEvent_send_closing_signed"))) TS_MessageSendEvent_send_closing_signed(int8_tArray node_id, uint64_t msg) {
66800         LDKPublicKey node_id_ref;
66801         CHECK(node_id->arr_len == 33);
66802         memcpy(node_id_ref.compressed_form, node_id->elems, 33); FREE(node_id);
66803         LDKClosingSigned msg_conv;
66804         msg_conv.inner = untag_ptr(msg);
66805         msg_conv.is_owned = ptr_is_owned(msg);
66806         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
66807         msg_conv = ClosingSigned_clone(&msg_conv);
66808         LDKMessageSendEvent *ret_copy = MALLOC(sizeof(LDKMessageSendEvent), "LDKMessageSendEvent");
66809         *ret_copy = MessageSendEvent_send_closing_signed(node_id_ref, msg_conv);
66810         uint64_t ret_ref = tag_ptr(ret_copy, true);
66811         return ret_ref;
66812 }
66813
66814 uint64_t  __attribute__((export_name("TS_MessageSendEvent_send_shutdown"))) TS_MessageSendEvent_send_shutdown(int8_tArray node_id, uint64_t msg) {
66815         LDKPublicKey node_id_ref;
66816         CHECK(node_id->arr_len == 33);
66817         memcpy(node_id_ref.compressed_form, node_id->elems, 33); FREE(node_id);
66818         LDKShutdown msg_conv;
66819         msg_conv.inner = untag_ptr(msg);
66820         msg_conv.is_owned = ptr_is_owned(msg);
66821         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
66822         msg_conv = Shutdown_clone(&msg_conv);
66823         LDKMessageSendEvent *ret_copy = MALLOC(sizeof(LDKMessageSendEvent), "LDKMessageSendEvent");
66824         *ret_copy = MessageSendEvent_send_shutdown(node_id_ref, msg_conv);
66825         uint64_t ret_ref = tag_ptr(ret_copy, true);
66826         return ret_ref;
66827 }
66828
66829 uint64_t  __attribute__((export_name("TS_MessageSendEvent_send_channel_reestablish"))) TS_MessageSendEvent_send_channel_reestablish(int8_tArray node_id, uint64_t msg) {
66830         LDKPublicKey node_id_ref;
66831         CHECK(node_id->arr_len == 33);
66832         memcpy(node_id_ref.compressed_form, node_id->elems, 33); FREE(node_id);
66833         LDKChannelReestablish msg_conv;
66834         msg_conv.inner = untag_ptr(msg);
66835         msg_conv.is_owned = ptr_is_owned(msg);
66836         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
66837         msg_conv = ChannelReestablish_clone(&msg_conv);
66838         LDKMessageSendEvent *ret_copy = MALLOC(sizeof(LDKMessageSendEvent), "LDKMessageSendEvent");
66839         *ret_copy = MessageSendEvent_send_channel_reestablish(node_id_ref, msg_conv);
66840         uint64_t ret_ref = tag_ptr(ret_copy, true);
66841         return ret_ref;
66842 }
66843
66844 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) {
66845         LDKPublicKey node_id_ref;
66846         CHECK(node_id->arr_len == 33);
66847         memcpy(node_id_ref.compressed_form, node_id->elems, 33); FREE(node_id);
66848         LDKChannelAnnouncement msg_conv;
66849         msg_conv.inner = untag_ptr(msg);
66850         msg_conv.is_owned = ptr_is_owned(msg);
66851         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
66852         msg_conv = ChannelAnnouncement_clone(&msg_conv);
66853         LDKChannelUpdate update_msg_conv;
66854         update_msg_conv.inner = untag_ptr(update_msg);
66855         update_msg_conv.is_owned = ptr_is_owned(update_msg);
66856         CHECK_INNER_FIELD_ACCESS_OR_NULL(update_msg_conv);
66857         update_msg_conv = ChannelUpdate_clone(&update_msg_conv);
66858         LDKMessageSendEvent *ret_copy = MALLOC(sizeof(LDKMessageSendEvent), "LDKMessageSendEvent");
66859         *ret_copy = MessageSendEvent_send_channel_announcement(node_id_ref, msg_conv, update_msg_conv);
66860         uint64_t ret_ref = tag_ptr(ret_copy, true);
66861         return ret_ref;
66862 }
66863
66864 uint64_t  __attribute__((export_name("TS_MessageSendEvent_broadcast_channel_announcement"))) TS_MessageSendEvent_broadcast_channel_announcement(uint64_t msg, uint64_t update_msg) {
66865         LDKChannelAnnouncement msg_conv;
66866         msg_conv.inner = untag_ptr(msg);
66867         msg_conv.is_owned = ptr_is_owned(msg);
66868         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
66869         msg_conv = ChannelAnnouncement_clone(&msg_conv);
66870         LDKChannelUpdate update_msg_conv;
66871         update_msg_conv.inner = untag_ptr(update_msg);
66872         update_msg_conv.is_owned = ptr_is_owned(update_msg);
66873         CHECK_INNER_FIELD_ACCESS_OR_NULL(update_msg_conv);
66874         update_msg_conv = ChannelUpdate_clone(&update_msg_conv);
66875         LDKMessageSendEvent *ret_copy = MALLOC(sizeof(LDKMessageSendEvent), "LDKMessageSendEvent");
66876         *ret_copy = MessageSendEvent_broadcast_channel_announcement(msg_conv, update_msg_conv);
66877         uint64_t ret_ref = tag_ptr(ret_copy, true);
66878         return ret_ref;
66879 }
66880
66881 uint64_t  __attribute__((export_name("TS_MessageSendEvent_broadcast_channel_update"))) TS_MessageSendEvent_broadcast_channel_update(uint64_t msg) {
66882         LDKChannelUpdate msg_conv;
66883         msg_conv.inner = untag_ptr(msg);
66884         msg_conv.is_owned = ptr_is_owned(msg);
66885         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
66886         msg_conv = ChannelUpdate_clone(&msg_conv);
66887         LDKMessageSendEvent *ret_copy = MALLOC(sizeof(LDKMessageSendEvent), "LDKMessageSendEvent");
66888         *ret_copy = MessageSendEvent_broadcast_channel_update(msg_conv);
66889         uint64_t ret_ref = tag_ptr(ret_copy, true);
66890         return ret_ref;
66891 }
66892
66893 uint64_t  __attribute__((export_name("TS_MessageSendEvent_broadcast_node_announcement"))) TS_MessageSendEvent_broadcast_node_announcement(uint64_t msg) {
66894         LDKNodeAnnouncement msg_conv;
66895         msg_conv.inner = untag_ptr(msg);
66896         msg_conv.is_owned = ptr_is_owned(msg);
66897         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
66898         msg_conv = NodeAnnouncement_clone(&msg_conv);
66899         LDKMessageSendEvent *ret_copy = MALLOC(sizeof(LDKMessageSendEvent), "LDKMessageSendEvent");
66900         *ret_copy = MessageSendEvent_broadcast_node_announcement(msg_conv);
66901         uint64_t ret_ref = tag_ptr(ret_copy, true);
66902         return ret_ref;
66903 }
66904
66905 uint64_t  __attribute__((export_name("TS_MessageSendEvent_send_channel_update"))) TS_MessageSendEvent_send_channel_update(int8_tArray node_id, uint64_t msg) {
66906         LDKPublicKey node_id_ref;
66907         CHECK(node_id->arr_len == 33);
66908         memcpy(node_id_ref.compressed_form, node_id->elems, 33); FREE(node_id);
66909         LDKChannelUpdate msg_conv;
66910         msg_conv.inner = untag_ptr(msg);
66911         msg_conv.is_owned = ptr_is_owned(msg);
66912         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
66913         msg_conv = ChannelUpdate_clone(&msg_conv);
66914         LDKMessageSendEvent *ret_copy = MALLOC(sizeof(LDKMessageSendEvent), "LDKMessageSendEvent");
66915         *ret_copy = MessageSendEvent_send_channel_update(node_id_ref, msg_conv);
66916         uint64_t ret_ref = tag_ptr(ret_copy, true);
66917         return ret_ref;
66918 }
66919
66920 uint64_t  __attribute__((export_name("TS_MessageSendEvent_handle_error"))) TS_MessageSendEvent_handle_error(int8_tArray node_id, uint64_t action) {
66921         LDKPublicKey node_id_ref;
66922         CHECK(node_id->arr_len == 33);
66923         memcpy(node_id_ref.compressed_form, node_id->elems, 33); FREE(node_id);
66924         void* action_ptr = untag_ptr(action);
66925         CHECK_ACCESS(action_ptr);
66926         LDKErrorAction action_conv = *(LDKErrorAction*)(action_ptr);
66927         action_conv = ErrorAction_clone((LDKErrorAction*)untag_ptr(action));
66928         LDKMessageSendEvent *ret_copy = MALLOC(sizeof(LDKMessageSendEvent), "LDKMessageSendEvent");
66929         *ret_copy = MessageSendEvent_handle_error(node_id_ref, action_conv);
66930         uint64_t ret_ref = tag_ptr(ret_copy, true);
66931         return ret_ref;
66932 }
66933
66934 uint64_t  __attribute__((export_name("TS_MessageSendEvent_send_channel_range_query"))) TS_MessageSendEvent_send_channel_range_query(int8_tArray node_id, uint64_t msg) {
66935         LDKPublicKey node_id_ref;
66936         CHECK(node_id->arr_len == 33);
66937         memcpy(node_id_ref.compressed_form, node_id->elems, 33); FREE(node_id);
66938         LDKQueryChannelRange msg_conv;
66939         msg_conv.inner = untag_ptr(msg);
66940         msg_conv.is_owned = ptr_is_owned(msg);
66941         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
66942         msg_conv = QueryChannelRange_clone(&msg_conv);
66943         LDKMessageSendEvent *ret_copy = MALLOC(sizeof(LDKMessageSendEvent), "LDKMessageSendEvent");
66944         *ret_copy = MessageSendEvent_send_channel_range_query(node_id_ref, msg_conv);
66945         uint64_t ret_ref = tag_ptr(ret_copy, true);
66946         return ret_ref;
66947 }
66948
66949 uint64_t  __attribute__((export_name("TS_MessageSendEvent_send_short_ids_query"))) TS_MessageSendEvent_send_short_ids_query(int8_tArray node_id, uint64_t msg) {
66950         LDKPublicKey node_id_ref;
66951         CHECK(node_id->arr_len == 33);
66952         memcpy(node_id_ref.compressed_form, node_id->elems, 33); FREE(node_id);
66953         LDKQueryShortChannelIds msg_conv;
66954         msg_conv.inner = untag_ptr(msg);
66955         msg_conv.is_owned = ptr_is_owned(msg);
66956         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
66957         msg_conv = QueryShortChannelIds_clone(&msg_conv);
66958         LDKMessageSendEvent *ret_copy = MALLOC(sizeof(LDKMessageSendEvent), "LDKMessageSendEvent");
66959         *ret_copy = MessageSendEvent_send_short_ids_query(node_id_ref, msg_conv);
66960         uint64_t ret_ref = tag_ptr(ret_copy, true);
66961         return ret_ref;
66962 }
66963
66964 uint64_t  __attribute__((export_name("TS_MessageSendEvent_send_reply_channel_range"))) TS_MessageSendEvent_send_reply_channel_range(int8_tArray node_id, uint64_t msg) {
66965         LDKPublicKey node_id_ref;
66966         CHECK(node_id->arr_len == 33);
66967         memcpy(node_id_ref.compressed_form, node_id->elems, 33); FREE(node_id);
66968         LDKReplyChannelRange msg_conv;
66969         msg_conv.inner = untag_ptr(msg);
66970         msg_conv.is_owned = ptr_is_owned(msg);
66971         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
66972         msg_conv = ReplyChannelRange_clone(&msg_conv);
66973         LDKMessageSendEvent *ret_copy = MALLOC(sizeof(LDKMessageSendEvent), "LDKMessageSendEvent");
66974         *ret_copy = MessageSendEvent_send_reply_channel_range(node_id_ref, msg_conv);
66975         uint64_t ret_ref = tag_ptr(ret_copy, true);
66976         return ret_ref;
66977 }
66978
66979 uint64_t  __attribute__((export_name("TS_MessageSendEvent_send_gossip_timestamp_filter"))) TS_MessageSendEvent_send_gossip_timestamp_filter(int8_tArray node_id, uint64_t msg) {
66980         LDKPublicKey node_id_ref;
66981         CHECK(node_id->arr_len == 33);
66982         memcpy(node_id_ref.compressed_form, node_id->elems, 33); FREE(node_id);
66983         LDKGossipTimestampFilter msg_conv;
66984         msg_conv.inner = untag_ptr(msg);
66985         msg_conv.is_owned = ptr_is_owned(msg);
66986         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
66987         msg_conv = GossipTimestampFilter_clone(&msg_conv);
66988         LDKMessageSendEvent *ret_copy = MALLOC(sizeof(LDKMessageSendEvent), "LDKMessageSendEvent");
66989         *ret_copy = MessageSendEvent_send_gossip_timestamp_filter(node_id_ref, msg_conv);
66990         uint64_t ret_ref = tag_ptr(ret_copy, true);
66991         return ret_ref;
66992 }
66993
66994 void  __attribute__((export_name("TS_MessageSendEventsProvider_free"))) TS_MessageSendEventsProvider_free(uint64_t this_ptr) {
66995         if (!ptr_is_owned(this_ptr)) return;
66996         void* this_ptr_ptr = untag_ptr(this_ptr);
66997         CHECK_ACCESS(this_ptr_ptr);
66998         LDKMessageSendEventsProvider this_ptr_conv = *(LDKMessageSendEventsProvider*)(this_ptr_ptr);
66999         FREE(untag_ptr(this_ptr));
67000         MessageSendEventsProvider_free(this_ptr_conv);
67001 }
67002
67003 void  __attribute__((export_name("TS_EventsProvider_free"))) TS_EventsProvider_free(uint64_t this_ptr) {
67004         if (!ptr_is_owned(this_ptr)) return;
67005         void* this_ptr_ptr = untag_ptr(this_ptr);
67006         CHECK_ACCESS(this_ptr_ptr);
67007         LDKEventsProvider this_ptr_conv = *(LDKEventsProvider*)(this_ptr_ptr);
67008         FREE(untag_ptr(this_ptr));
67009         EventsProvider_free(this_ptr_conv);
67010 }
67011
67012 void  __attribute__((export_name("TS_EventHandler_free"))) TS_EventHandler_free(uint64_t this_ptr) {
67013         if (!ptr_is_owned(this_ptr)) return;
67014         void* this_ptr_ptr = untag_ptr(this_ptr);
67015         CHECK_ACCESS(this_ptr_ptr);
67016         LDKEventHandler this_ptr_conv = *(LDKEventHandler*)(this_ptr_ptr);
67017         FREE(untag_ptr(this_ptr));
67018         EventHandler_free(this_ptr_conv);
67019 }
67020
67021 void  __attribute__((export_name("TS_AnchorDescriptor_free"))) TS_AnchorDescriptor_free(uint64_t this_obj) {
67022         LDKAnchorDescriptor this_obj_conv;
67023         this_obj_conv.inner = untag_ptr(this_obj);
67024         this_obj_conv.is_owned = ptr_is_owned(this_obj);
67025         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
67026         AnchorDescriptor_free(this_obj_conv);
67027 }
67028
67029 uint64_t  __attribute__((export_name("TS_AnchorDescriptor_get_channel_derivation_parameters"))) TS_AnchorDescriptor_get_channel_derivation_parameters(uint64_t this_ptr) {
67030         LDKAnchorDescriptor this_ptr_conv;
67031         this_ptr_conv.inner = untag_ptr(this_ptr);
67032         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
67033         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
67034         this_ptr_conv.is_owned = false;
67035         LDKChannelDerivationParameters ret_var = AnchorDescriptor_get_channel_derivation_parameters(&this_ptr_conv);
67036         uint64_t ret_ref = 0;
67037         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
67038         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
67039         return ret_ref;
67040 }
67041
67042 void  __attribute__((export_name("TS_AnchorDescriptor_set_channel_derivation_parameters"))) TS_AnchorDescriptor_set_channel_derivation_parameters(uint64_t this_ptr, uint64_t val) {
67043         LDKAnchorDescriptor this_ptr_conv;
67044         this_ptr_conv.inner = untag_ptr(this_ptr);
67045         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
67046         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
67047         this_ptr_conv.is_owned = false;
67048         LDKChannelDerivationParameters val_conv;
67049         val_conv.inner = untag_ptr(val);
67050         val_conv.is_owned = ptr_is_owned(val);
67051         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
67052         val_conv = ChannelDerivationParameters_clone(&val_conv);
67053         AnchorDescriptor_set_channel_derivation_parameters(&this_ptr_conv, val_conv);
67054 }
67055
67056 uint64_t  __attribute__((export_name("TS_AnchorDescriptor_get_outpoint"))) TS_AnchorDescriptor_get_outpoint(uint64_t this_ptr) {
67057         LDKAnchorDescriptor this_ptr_conv;
67058         this_ptr_conv.inner = untag_ptr(this_ptr);
67059         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
67060         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
67061         this_ptr_conv.is_owned = false;
67062         LDKOutPoint ret_var = AnchorDescriptor_get_outpoint(&this_ptr_conv);
67063         uint64_t ret_ref = 0;
67064         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
67065         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
67066         return ret_ref;
67067 }
67068
67069 void  __attribute__((export_name("TS_AnchorDescriptor_set_outpoint"))) TS_AnchorDescriptor_set_outpoint(uint64_t this_ptr, uint64_t val) {
67070         LDKAnchorDescriptor this_ptr_conv;
67071         this_ptr_conv.inner = untag_ptr(this_ptr);
67072         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
67073         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
67074         this_ptr_conv.is_owned = false;
67075         LDKOutPoint val_conv;
67076         val_conv.inner = untag_ptr(val);
67077         val_conv.is_owned = ptr_is_owned(val);
67078         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
67079         val_conv = OutPoint_clone(&val_conv);
67080         AnchorDescriptor_set_outpoint(&this_ptr_conv, val_conv);
67081 }
67082
67083 uint64_t  __attribute__((export_name("TS_AnchorDescriptor_new"))) TS_AnchorDescriptor_new(uint64_t channel_derivation_parameters_arg, uint64_t outpoint_arg) {
67084         LDKChannelDerivationParameters channel_derivation_parameters_arg_conv;
67085         channel_derivation_parameters_arg_conv.inner = untag_ptr(channel_derivation_parameters_arg);
67086         channel_derivation_parameters_arg_conv.is_owned = ptr_is_owned(channel_derivation_parameters_arg);
67087         CHECK_INNER_FIELD_ACCESS_OR_NULL(channel_derivation_parameters_arg_conv);
67088         channel_derivation_parameters_arg_conv = ChannelDerivationParameters_clone(&channel_derivation_parameters_arg_conv);
67089         LDKOutPoint outpoint_arg_conv;
67090         outpoint_arg_conv.inner = untag_ptr(outpoint_arg);
67091         outpoint_arg_conv.is_owned = ptr_is_owned(outpoint_arg);
67092         CHECK_INNER_FIELD_ACCESS_OR_NULL(outpoint_arg_conv);
67093         outpoint_arg_conv = OutPoint_clone(&outpoint_arg_conv);
67094         LDKAnchorDescriptor ret_var = AnchorDescriptor_new(channel_derivation_parameters_arg_conv, outpoint_arg_conv);
67095         uint64_t ret_ref = 0;
67096         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
67097         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
67098         return ret_ref;
67099 }
67100
67101 static inline uint64_t AnchorDescriptor_clone_ptr(LDKAnchorDescriptor *NONNULL_PTR arg) {
67102         LDKAnchorDescriptor ret_var = AnchorDescriptor_clone(arg);
67103         uint64_t ret_ref = 0;
67104         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
67105         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
67106         return ret_ref;
67107 }
67108 int64_t  __attribute__((export_name("TS_AnchorDescriptor_clone_ptr"))) TS_AnchorDescriptor_clone_ptr(uint64_t arg) {
67109         LDKAnchorDescriptor arg_conv;
67110         arg_conv.inner = untag_ptr(arg);
67111         arg_conv.is_owned = ptr_is_owned(arg);
67112         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
67113         arg_conv.is_owned = false;
67114         int64_t ret_conv = AnchorDescriptor_clone_ptr(&arg_conv);
67115         return ret_conv;
67116 }
67117
67118 uint64_t  __attribute__((export_name("TS_AnchorDescriptor_clone"))) TS_AnchorDescriptor_clone(uint64_t orig) {
67119         LDKAnchorDescriptor orig_conv;
67120         orig_conv.inner = untag_ptr(orig);
67121         orig_conv.is_owned = ptr_is_owned(orig);
67122         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
67123         orig_conv.is_owned = false;
67124         LDKAnchorDescriptor ret_var = AnchorDescriptor_clone(&orig_conv);
67125         uint64_t ret_ref = 0;
67126         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
67127         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
67128         return ret_ref;
67129 }
67130
67131 jboolean  __attribute__((export_name("TS_AnchorDescriptor_eq"))) TS_AnchorDescriptor_eq(uint64_t a, uint64_t b) {
67132         LDKAnchorDescriptor a_conv;
67133         a_conv.inner = untag_ptr(a);
67134         a_conv.is_owned = ptr_is_owned(a);
67135         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
67136         a_conv.is_owned = false;
67137         LDKAnchorDescriptor b_conv;
67138         b_conv.inner = untag_ptr(b);
67139         b_conv.is_owned = ptr_is_owned(b);
67140         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
67141         b_conv.is_owned = false;
67142         jboolean ret_conv = AnchorDescriptor_eq(&a_conv, &b_conv);
67143         return ret_conv;
67144 }
67145
67146 uint64_t  __attribute__((export_name("TS_AnchorDescriptor_previous_utxo"))) TS_AnchorDescriptor_previous_utxo(uint64_t this_arg) {
67147         LDKAnchorDescriptor this_arg_conv;
67148         this_arg_conv.inner = untag_ptr(this_arg);
67149         this_arg_conv.is_owned = ptr_is_owned(this_arg);
67150         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
67151         this_arg_conv.is_owned = false;
67152         LDKTxOut* ret_ref = MALLOC(sizeof(LDKTxOut), "LDKTxOut");
67153         *ret_ref = AnchorDescriptor_previous_utxo(&this_arg_conv);
67154         return tag_ptr(ret_ref, true);
67155 }
67156
67157 uint64_t  __attribute__((export_name("TS_AnchorDescriptor_unsigned_tx_input"))) TS_AnchorDescriptor_unsigned_tx_input(uint64_t this_arg) {
67158         LDKAnchorDescriptor this_arg_conv;
67159         this_arg_conv.inner = untag_ptr(this_arg);
67160         this_arg_conv.is_owned = ptr_is_owned(this_arg);
67161         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
67162         this_arg_conv.is_owned = false;
67163         LDKTxIn* ret_ref = MALLOC(sizeof(LDKTxIn), "LDKTxIn");
67164         *ret_ref = AnchorDescriptor_unsigned_tx_input(&this_arg_conv);
67165         return tag_ptr(ret_ref, true);
67166 }
67167
67168 int8_tArray  __attribute__((export_name("TS_AnchorDescriptor_witness_script"))) TS_AnchorDescriptor_witness_script(uint64_t this_arg) {
67169         LDKAnchorDescriptor this_arg_conv;
67170         this_arg_conv.inner = untag_ptr(this_arg);
67171         this_arg_conv.is_owned = ptr_is_owned(this_arg);
67172         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
67173         this_arg_conv.is_owned = false;
67174         LDKCVec_u8Z ret_var = AnchorDescriptor_witness_script(&this_arg_conv);
67175         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
67176         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
67177         CVec_u8Z_free(ret_var);
67178         return ret_arr;
67179 }
67180
67181 int8_tArray  __attribute__((export_name("TS_AnchorDescriptor_tx_input_witness"))) TS_AnchorDescriptor_tx_input_witness(uint64_t this_arg, int8_tArray signature) {
67182         LDKAnchorDescriptor this_arg_conv;
67183         this_arg_conv.inner = untag_ptr(this_arg);
67184         this_arg_conv.is_owned = ptr_is_owned(this_arg);
67185         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
67186         this_arg_conv.is_owned = false;
67187         LDKECDSASignature signature_ref;
67188         CHECK(signature->arr_len == 64);
67189         memcpy(signature_ref.compact_form, signature->elems, 64); FREE(signature);
67190         LDKWitness ret_var = AnchorDescriptor_tx_input_witness(&this_arg_conv, signature_ref);
67191         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
67192         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
67193         Witness_free(ret_var);
67194         return ret_arr;
67195 }
67196
67197 uint64_t  __attribute__((export_name("TS_AnchorDescriptor_derive_channel_signer"))) TS_AnchorDescriptor_derive_channel_signer(uint64_t this_arg, uint64_t signer_provider) {
67198         LDKAnchorDescriptor this_arg_conv;
67199         this_arg_conv.inner = untag_ptr(this_arg);
67200         this_arg_conv.is_owned = ptr_is_owned(this_arg);
67201         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
67202         this_arg_conv.is_owned = false;
67203         void* signer_provider_ptr = untag_ptr(signer_provider);
67204         if (ptr_is_owned(signer_provider)) { CHECK_ACCESS(signer_provider_ptr); }
67205         LDKSignerProvider* signer_provider_conv = (LDKSignerProvider*)signer_provider_ptr;
67206         LDKWriteableEcdsaChannelSigner* ret_ret = MALLOC(sizeof(LDKWriteableEcdsaChannelSigner), "LDKWriteableEcdsaChannelSigner");
67207         *ret_ret = AnchorDescriptor_derive_channel_signer(&this_arg_conv, signer_provider_conv);
67208         return tag_ptr(ret_ret, true);
67209 }
67210
67211 void  __attribute__((export_name("TS_BumpTransactionEvent_free"))) TS_BumpTransactionEvent_free(uint64_t this_ptr) {
67212         if (!ptr_is_owned(this_ptr)) return;
67213         void* this_ptr_ptr = untag_ptr(this_ptr);
67214         CHECK_ACCESS(this_ptr_ptr);
67215         LDKBumpTransactionEvent this_ptr_conv = *(LDKBumpTransactionEvent*)(this_ptr_ptr);
67216         FREE(untag_ptr(this_ptr));
67217         BumpTransactionEvent_free(this_ptr_conv);
67218 }
67219
67220 static inline uint64_t BumpTransactionEvent_clone_ptr(LDKBumpTransactionEvent *NONNULL_PTR arg) {
67221         LDKBumpTransactionEvent *ret_copy = MALLOC(sizeof(LDKBumpTransactionEvent), "LDKBumpTransactionEvent");
67222         *ret_copy = BumpTransactionEvent_clone(arg);
67223         uint64_t ret_ref = tag_ptr(ret_copy, true);
67224         return ret_ref;
67225 }
67226 int64_t  __attribute__((export_name("TS_BumpTransactionEvent_clone_ptr"))) TS_BumpTransactionEvent_clone_ptr(uint64_t arg) {
67227         LDKBumpTransactionEvent* arg_conv = (LDKBumpTransactionEvent*)untag_ptr(arg);
67228         int64_t ret_conv = BumpTransactionEvent_clone_ptr(arg_conv);
67229         return ret_conv;
67230 }
67231
67232 uint64_t  __attribute__((export_name("TS_BumpTransactionEvent_clone"))) TS_BumpTransactionEvent_clone(uint64_t orig) {
67233         LDKBumpTransactionEvent* orig_conv = (LDKBumpTransactionEvent*)untag_ptr(orig);
67234         LDKBumpTransactionEvent *ret_copy = MALLOC(sizeof(LDKBumpTransactionEvent), "LDKBumpTransactionEvent");
67235         *ret_copy = BumpTransactionEvent_clone(orig_conv);
67236         uint64_t ret_ref = tag_ptr(ret_copy, true);
67237         return ret_ref;
67238 }
67239
67240 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) {
67241         LDKThirtyTwoBytes claim_id_ref;
67242         CHECK(claim_id->arr_len == 32);
67243         memcpy(claim_id_ref.data, claim_id->elems, 32); FREE(claim_id);
67244         LDKTransaction commitment_tx_ref;
67245         commitment_tx_ref.datalen = commitment_tx->arr_len;
67246         commitment_tx_ref.data = MALLOC(commitment_tx_ref.datalen, "LDKTransaction Bytes");
67247         memcpy(commitment_tx_ref.data, commitment_tx->elems, commitment_tx_ref.datalen); FREE(commitment_tx);
67248         commitment_tx_ref.data_is_owned = true;
67249         LDKAnchorDescriptor anchor_descriptor_conv;
67250         anchor_descriptor_conv.inner = untag_ptr(anchor_descriptor);
67251         anchor_descriptor_conv.is_owned = ptr_is_owned(anchor_descriptor);
67252         CHECK_INNER_FIELD_ACCESS_OR_NULL(anchor_descriptor_conv);
67253         anchor_descriptor_conv = AnchorDescriptor_clone(&anchor_descriptor_conv);
67254         LDKCVec_HTLCOutputInCommitmentZ pending_htlcs_constr;
67255         pending_htlcs_constr.datalen = pending_htlcs->arr_len;
67256         if (pending_htlcs_constr.datalen > 0)
67257                 pending_htlcs_constr.data = MALLOC(pending_htlcs_constr.datalen * sizeof(LDKHTLCOutputInCommitment), "LDKCVec_HTLCOutputInCommitmentZ Elements");
67258         else
67259                 pending_htlcs_constr.data = NULL;
67260         uint64_t* pending_htlcs_vals = pending_htlcs->elems;
67261         for (size_t y = 0; y < pending_htlcs_constr.datalen; y++) {
67262                 uint64_t pending_htlcs_conv_24 = pending_htlcs_vals[y];
67263                 LDKHTLCOutputInCommitment pending_htlcs_conv_24_conv;
67264                 pending_htlcs_conv_24_conv.inner = untag_ptr(pending_htlcs_conv_24);
67265                 pending_htlcs_conv_24_conv.is_owned = ptr_is_owned(pending_htlcs_conv_24);
67266                 CHECK_INNER_FIELD_ACCESS_OR_NULL(pending_htlcs_conv_24_conv);
67267                 pending_htlcs_conv_24_conv = HTLCOutputInCommitment_clone(&pending_htlcs_conv_24_conv);
67268                 pending_htlcs_constr.data[y] = pending_htlcs_conv_24_conv;
67269         }
67270         FREE(pending_htlcs);
67271         LDKBumpTransactionEvent *ret_copy = MALLOC(sizeof(LDKBumpTransactionEvent), "LDKBumpTransactionEvent");
67272         *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);
67273         uint64_t ret_ref = tag_ptr(ret_copy, true);
67274         return ret_ref;
67275 }
67276
67277 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) {
67278         LDKThirtyTwoBytes claim_id_ref;
67279         CHECK(claim_id->arr_len == 32);
67280         memcpy(claim_id_ref.data, claim_id->elems, 32); FREE(claim_id);
67281         LDKCVec_HTLCDescriptorZ htlc_descriptors_constr;
67282         htlc_descriptors_constr.datalen = htlc_descriptors->arr_len;
67283         if (htlc_descriptors_constr.datalen > 0)
67284                 htlc_descriptors_constr.data = MALLOC(htlc_descriptors_constr.datalen * sizeof(LDKHTLCDescriptor), "LDKCVec_HTLCDescriptorZ Elements");
67285         else
67286                 htlc_descriptors_constr.data = NULL;
67287         uint64_t* htlc_descriptors_vals = htlc_descriptors->elems;
67288         for (size_t q = 0; q < htlc_descriptors_constr.datalen; q++) {
67289                 uint64_t htlc_descriptors_conv_16 = htlc_descriptors_vals[q];
67290                 LDKHTLCDescriptor htlc_descriptors_conv_16_conv;
67291                 htlc_descriptors_conv_16_conv.inner = untag_ptr(htlc_descriptors_conv_16);
67292                 htlc_descriptors_conv_16_conv.is_owned = ptr_is_owned(htlc_descriptors_conv_16);
67293                 CHECK_INNER_FIELD_ACCESS_OR_NULL(htlc_descriptors_conv_16_conv);
67294                 htlc_descriptors_conv_16_conv = HTLCDescriptor_clone(&htlc_descriptors_conv_16_conv);
67295                 htlc_descriptors_constr.data[q] = htlc_descriptors_conv_16_conv;
67296         }
67297         FREE(htlc_descriptors);
67298         LDKBumpTransactionEvent *ret_copy = MALLOC(sizeof(LDKBumpTransactionEvent), "LDKBumpTransactionEvent");
67299         *ret_copy = BumpTransactionEvent_htlcresolution(claim_id_ref, target_feerate_sat_per_1000_weight, htlc_descriptors_constr, tx_lock_time);
67300         uint64_t ret_ref = tag_ptr(ret_copy, true);
67301         return ret_ref;
67302 }
67303
67304 jboolean  __attribute__((export_name("TS_BumpTransactionEvent_eq"))) TS_BumpTransactionEvent_eq(uint64_t a, uint64_t b) {
67305         LDKBumpTransactionEvent* a_conv = (LDKBumpTransactionEvent*)untag_ptr(a);
67306         LDKBumpTransactionEvent* b_conv = (LDKBumpTransactionEvent*)untag_ptr(b);
67307         jboolean ret_conv = BumpTransactionEvent_eq(a_conv, b_conv);
67308         return ret_conv;
67309 }
67310
67311 void  __attribute__((export_name("TS_Input_free"))) TS_Input_free(uint64_t this_obj) {
67312         LDKInput this_obj_conv;
67313         this_obj_conv.inner = untag_ptr(this_obj);
67314         this_obj_conv.is_owned = ptr_is_owned(this_obj);
67315         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
67316         Input_free(this_obj_conv);
67317 }
67318
67319 uint64_t  __attribute__((export_name("TS_Input_get_outpoint"))) TS_Input_get_outpoint(uint64_t this_ptr) {
67320         LDKInput this_ptr_conv;
67321         this_ptr_conv.inner = untag_ptr(this_ptr);
67322         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
67323         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
67324         this_ptr_conv.is_owned = false;
67325         LDKOutPoint ret_var = Input_get_outpoint(&this_ptr_conv);
67326         uint64_t ret_ref = 0;
67327         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
67328         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
67329         return ret_ref;
67330 }
67331
67332 void  __attribute__((export_name("TS_Input_set_outpoint"))) TS_Input_set_outpoint(uint64_t this_ptr, uint64_t val) {
67333         LDKInput this_ptr_conv;
67334         this_ptr_conv.inner = untag_ptr(this_ptr);
67335         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
67336         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
67337         this_ptr_conv.is_owned = false;
67338         LDKOutPoint val_conv;
67339         val_conv.inner = untag_ptr(val);
67340         val_conv.is_owned = ptr_is_owned(val);
67341         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
67342         val_conv = OutPoint_clone(&val_conv);
67343         Input_set_outpoint(&this_ptr_conv, val_conv);
67344 }
67345
67346 uint64_t  __attribute__((export_name("TS_Input_get_previous_utxo"))) TS_Input_get_previous_utxo(uint64_t this_ptr) {
67347         LDKInput this_ptr_conv;
67348         this_ptr_conv.inner = untag_ptr(this_ptr);
67349         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
67350         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
67351         this_ptr_conv.is_owned = false;
67352         LDKTxOut* ret_ref = MALLOC(sizeof(LDKTxOut), "LDKTxOut");
67353         *ret_ref = Input_get_previous_utxo(&this_ptr_conv);
67354         return tag_ptr(ret_ref, true);
67355 }
67356
67357 void  __attribute__((export_name("TS_Input_set_previous_utxo"))) TS_Input_set_previous_utxo(uint64_t this_ptr, uint64_t val) {
67358         LDKInput this_ptr_conv;
67359         this_ptr_conv.inner = untag_ptr(this_ptr);
67360         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
67361         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
67362         this_ptr_conv.is_owned = false;
67363         void* val_ptr = untag_ptr(val);
67364         CHECK_ACCESS(val_ptr);
67365         LDKTxOut val_conv = *(LDKTxOut*)(val_ptr);
67366         val_conv = TxOut_clone((LDKTxOut*)untag_ptr(val));
67367         Input_set_previous_utxo(&this_ptr_conv, val_conv);
67368 }
67369
67370 int64_t  __attribute__((export_name("TS_Input_get_satisfaction_weight"))) TS_Input_get_satisfaction_weight(uint64_t this_ptr) {
67371         LDKInput this_ptr_conv;
67372         this_ptr_conv.inner = untag_ptr(this_ptr);
67373         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
67374         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
67375         this_ptr_conv.is_owned = false;
67376         int64_t ret_conv = Input_get_satisfaction_weight(&this_ptr_conv);
67377         return ret_conv;
67378 }
67379
67380 void  __attribute__((export_name("TS_Input_set_satisfaction_weight"))) TS_Input_set_satisfaction_weight(uint64_t this_ptr, int64_t val) {
67381         LDKInput this_ptr_conv;
67382         this_ptr_conv.inner = untag_ptr(this_ptr);
67383         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
67384         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
67385         this_ptr_conv.is_owned = false;
67386         Input_set_satisfaction_weight(&this_ptr_conv, val);
67387 }
67388
67389 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) {
67390         LDKOutPoint outpoint_arg_conv;
67391         outpoint_arg_conv.inner = untag_ptr(outpoint_arg);
67392         outpoint_arg_conv.is_owned = ptr_is_owned(outpoint_arg);
67393         CHECK_INNER_FIELD_ACCESS_OR_NULL(outpoint_arg_conv);
67394         outpoint_arg_conv = OutPoint_clone(&outpoint_arg_conv);
67395         void* previous_utxo_arg_ptr = untag_ptr(previous_utxo_arg);
67396         CHECK_ACCESS(previous_utxo_arg_ptr);
67397         LDKTxOut previous_utxo_arg_conv = *(LDKTxOut*)(previous_utxo_arg_ptr);
67398         previous_utxo_arg_conv = TxOut_clone((LDKTxOut*)untag_ptr(previous_utxo_arg));
67399         LDKInput ret_var = Input_new(outpoint_arg_conv, previous_utxo_arg_conv, satisfaction_weight_arg);
67400         uint64_t ret_ref = 0;
67401         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
67402         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
67403         return ret_ref;
67404 }
67405
67406 static inline uint64_t Input_clone_ptr(LDKInput *NONNULL_PTR arg) {
67407         LDKInput ret_var = Input_clone(arg);
67408         uint64_t ret_ref = 0;
67409         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
67410         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
67411         return ret_ref;
67412 }
67413 int64_t  __attribute__((export_name("TS_Input_clone_ptr"))) TS_Input_clone_ptr(uint64_t arg) {
67414         LDKInput arg_conv;
67415         arg_conv.inner = untag_ptr(arg);
67416         arg_conv.is_owned = ptr_is_owned(arg);
67417         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
67418         arg_conv.is_owned = false;
67419         int64_t ret_conv = Input_clone_ptr(&arg_conv);
67420         return ret_conv;
67421 }
67422
67423 uint64_t  __attribute__((export_name("TS_Input_clone"))) TS_Input_clone(uint64_t orig) {
67424         LDKInput orig_conv;
67425         orig_conv.inner = untag_ptr(orig);
67426         orig_conv.is_owned = ptr_is_owned(orig);
67427         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
67428         orig_conv.is_owned = false;
67429         LDKInput ret_var = Input_clone(&orig_conv);
67430         uint64_t ret_ref = 0;
67431         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
67432         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
67433         return ret_ref;
67434 }
67435
67436 int64_t  __attribute__((export_name("TS_Input_hash"))) TS_Input_hash(uint64_t o) {
67437         LDKInput o_conv;
67438         o_conv.inner = untag_ptr(o);
67439         o_conv.is_owned = ptr_is_owned(o);
67440         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
67441         o_conv.is_owned = false;
67442         int64_t ret_conv = Input_hash(&o_conv);
67443         return ret_conv;
67444 }
67445
67446 jboolean  __attribute__((export_name("TS_Input_eq"))) TS_Input_eq(uint64_t a, uint64_t b) {
67447         LDKInput a_conv;
67448         a_conv.inner = untag_ptr(a);
67449         a_conv.is_owned = ptr_is_owned(a);
67450         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
67451         a_conv.is_owned = false;
67452         LDKInput b_conv;
67453         b_conv.inner = untag_ptr(b);
67454         b_conv.is_owned = ptr_is_owned(b);
67455         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
67456         b_conv.is_owned = false;
67457         jboolean ret_conv = Input_eq(&a_conv, &b_conv);
67458         return ret_conv;
67459 }
67460
67461 void  __attribute__((export_name("TS_Utxo_free"))) TS_Utxo_free(uint64_t this_obj) {
67462         LDKUtxo this_obj_conv;
67463         this_obj_conv.inner = untag_ptr(this_obj);
67464         this_obj_conv.is_owned = ptr_is_owned(this_obj);
67465         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
67466         Utxo_free(this_obj_conv);
67467 }
67468
67469 uint64_t  __attribute__((export_name("TS_Utxo_get_outpoint"))) TS_Utxo_get_outpoint(uint64_t this_ptr) {
67470         LDKUtxo this_ptr_conv;
67471         this_ptr_conv.inner = untag_ptr(this_ptr);
67472         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
67473         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
67474         this_ptr_conv.is_owned = false;
67475         LDKOutPoint ret_var = Utxo_get_outpoint(&this_ptr_conv);
67476         uint64_t ret_ref = 0;
67477         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
67478         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
67479         return ret_ref;
67480 }
67481
67482 void  __attribute__((export_name("TS_Utxo_set_outpoint"))) TS_Utxo_set_outpoint(uint64_t this_ptr, uint64_t val) {
67483         LDKUtxo this_ptr_conv;
67484         this_ptr_conv.inner = untag_ptr(this_ptr);
67485         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
67486         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
67487         this_ptr_conv.is_owned = false;
67488         LDKOutPoint val_conv;
67489         val_conv.inner = untag_ptr(val);
67490         val_conv.is_owned = ptr_is_owned(val);
67491         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
67492         val_conv = OutPoint_clone(&val_conv);
67493         Utxo_set_outpoint(&this_ptr_conv, val_conv);
67494 }
67495
67496 uint64_t  __attribute__((export_name("TS_Utxo_get_output"))) TS_Utxo_get_output(uint64_t this_ptr) {
67497         LDKUtxo this_ptr_conv;
67498         this_ptr_conv.inner = untag_ptr(this_ptr);
67499         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
67500         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
67501         this_ptr_conv.is_owned = false;
67502         LDKTxOut* ret_ref = MALLOC(sizeof(LDKTxOut), "LDKTxOut");
67503         *ret_ref = Utxo_get_output(&this_ptr_conv);
67504         return tag_ptr(ret_ref, true);
67505 }
67506
67507 void  __attribute__((export_name("TS_Utxo_set_output"))) TS_Utxo_set_output(uint64_t this_ptr, uint64_t val) {
67508         LDKUtxo this_ptr_conv;
67509         this_ptr_conv.inner = untag_ptr(this_ptr);
67510         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
67511         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
67512         this_ptr_conv.is_owned = false;
67513         void* val_ptr = untag_ptr(val);
67514         CHECK_ACCESS(val_ptr);
67515         LDKTxOut val_conv = *(LDKTxOut*)(val_ptr);
67516         val_conv = TxOut_clone((LDKTxOut*)untag_ptr(val));
67517         Utxo_set_output(&this_ptr_conv, val_conv);
67518 }
67519
67520 int64_t  __attribute__((export_name("TS_Utxo_get_satisfaction_weight"))) TS_Utxo_get_satisfaction_weight(uint64_t this_ptr) {
67521         LDKUtxo this_ptr_conv;
67522         this_ptr_conv.inner = untag_ptr(this_ptr);
67523         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
67524         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
67525         this_ptr_conv.is_owned = false;
67526         int64_t ret_conv = Utxo_get_satisfaction_weight(&this_ptr_conv);
67527         return ret_conv;
67528 }
67529
67530 void  __attribute__((export_name("TS_Utxo_set_satisfaction_weight"))) TS_Utxo_set_satisfaction_weight(uint64_t this_ptr, int64_t val) {
67531         LDKUtxo this_ptr_conv;
67532         this_ptr_conv.inner = untag_ptr(this_ptr);
67533         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
67534         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
67535         this_ptr_conv.is_owned = false;
67536         Utxo_set_satisfaction_weight(&this_ptr_conv, val);
67537 }
67538
67539 uint64_t  __attribute__((export_name("TS_Utxo_new"))) TS_Utxo_new(uint64_t outpoint_arg, uint64_t output_arg, int64_t satisfaction_weight_arg) {
67540         LDKOutPoint outpoint_arg_conv;
67541         outpoint_arg_conv.inner = untag_ptr(outpoint_arg);
67542         outpoint_arg_conv.is_owned = ptr_is_owned(outpoint_arg);
67543         CHECK_INNER_FIELD_ACCESS_OR_NULL(outpoint_arg_conv);
67544         outpoint_arg_conv = OutPoint_clone(&outpoint_arg_conv);
67545         void* output_arg_ptr = untag_ptr(output_arg);
67546         CHECK_ACCESS(output_arg_ptr);
67547         LDKTxOut output_arg_conv = *(LDKTxOut*)(output_arg_ptr);
67548         output_arg_conv = TxOut_clone((LDKTxOut*)untag_ptr(output_arg));
67549         LDKUtxo ret_var = Utxo_new(outpoint_arg_conv, output_arg_conv, satisfaction_weight_arg);
67550         uint64_t ret_ref = 0;
67551         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
67552         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
67553         return ret_ref;
67554 }
67555
67556 static inline uint64_t Utxo_clone_ptr(LDKUtxo *NONNULL_PTR arg) {
67557         LDKUtxo ret_var = Utxo_clone(arg);
67558         uint64_t ret_ref = 0;
67559         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
67560         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
67561         return ret_ref;
67562 }
67563 int64_t  __attribute__((export_name("TS_Utxo_clone_ptr"))) TS_Utxo_clone_ptr(uint64_t arg) {
67564         LDKUtxo arg_conv;
67565         arg_conv.inner = untag_ptr(arg);
67566         arg_conv.is_owned = ptr_is_owned(arg);
67567         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
67568         arg_conv.is_owned = false;
67569         int64_t ret_conv = Utxo_clone_ptr(&arg_conv);
67570         return ret_conv;
67571 }
67572
67573 uint64_t  __attribute__((export_name("TS_Utxo_clone"))) TS_Utxo_clone(uint64_t orig) {
67574         LDKUtxo orig_conv;
67575         orig_conv.inner = untag_ptr(orig);
67576         orig_conv.is_owned = ptr_is_owned(orig);
67577         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
67578         orig_conv.is_owned = false;
67579         LDKUtxo ret_var = Utxo_clone(&orig_conv);
67580         uint64_t ret_ref = 0;
67581         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
67582         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
67583         return ret_ref;
67584 }
67585
67586 int64_t  __attribute__((export_name("TS_Utxo_hash"))) TS_Utxo_hash(uint64_t o) {
67587         LDKUtxo o_conv;
67588         o_conv.inner = untag_ptr(o);
67589         o_conv.is_owned = ptr_is_owned(o);
67590         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
67591         o_conv.is_owned = false;
67592         int64_t ret_conv = Utxo_hash(&o_conv);
67593         return ret_conv;
67594 }
67595
67596 jboolean  __attribute__((export_name("TS_Utxo_eq"))) TS_Utxo_eq(uint64_t a, uint64_t b) {
67597         LDKUtxo a_conv;
67598         a_conv.inner = untag_ptr(a);
67599         a_conv.is_owned = ptr_is_owned(a);
67600         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
67601         a_conv.is_owned = false;
67602         LDKUtxo b_conv;
67603         b_conv.inner = untag_ptr(b);
67604         b_conv.is_owned = ptr_is_owned(b);
67605         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
67606         b_conv.is_owned = false;
67607         jboolean ret_conv = Utxo_eq(&a_conv, &b_conv);
67608         return ret_conv;
67609 }
67610
67611 uint64_t  __attribute__((export_name("TS_Utxo_new_p2pkh"))) TS_Utxo_new_p2pkh(uint64_t outpoint, int64_t value, int8_tArray pubkey_hash) {
67612         LDKOutPoint outpoint_conv;
67613         outpoint_conv.inner = untag_ptr(outpoint);
67614         outpoint_conv.is_owned = ptr_is_owned(outpoint);
67615         CHECK_INNER_FIELD_ACCESS_OR_NULL(outpoint_conv);
67616         outpoint_conv = OutPoint_clone(&outpoint_conv);
67617         uint8_t pubkey_hash_arr[20];
67618         CHECK(pubkey_hash->arr_len == 20);
67619         memcpy(pubkey_hash_arr, pubkey_hash->elems, 20); FREE(pubkey_hash);
67620         uint8_t (*pubkey_hash_ref)[20] = &pubkey_hash_arr;
67621         LDKUtxo ret_var = Utxo_new_p2pkh(outpoint_conv, value, pubkey_hash_ref);
67622         uint64_t ret_ref = 0;
67623         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
67624         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
67625         return ret_ref;
67626 }
67627
67628 void  __attribute__((export_name("TS_CoinSelection_free"))) TS_CoinSelection_free(uint64_t this_obj) {
67629         LDKCoinSelection this_obj_conv;
67630         this_obj_conv.inner = untag_ptr(this_obj);
67631         this_obj_conv.is_owned = ptr_is_owned(this_obj);
67632         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
67633         CoinSelection_free(this_obj_conv);
67634 }
67635
67636 uint64_tArray  __attribute__((export_name("TS_CoinSelection_get_confirmed_utxos"))) TS_CoinSelection_get_confirmed_utxos(uint64_t this_ptr) {
67637         LDKCoinSelection this_ptr_conv;
67638         this_ptr_conv.inner = untag_ptr(this_ptr);
67639         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
67640         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
67641         this_ptr_conv.is_owned = false;
67642         LDKCVec_UtxoZ ret_var = CoinSelection_get_confirmed_utxos(&this_ptr_conv);
67643         uint64_tArray ret_arr = NULL;
67644         ret_arr = init_uint64_tArray(ret_var.datalen, __LINE__);
67645         uint64_t *ret_arr_ptr = (uint64_t*)(((uint8_t*)ret_arr) + 8);
67646         for (size_t g = 0; g < ret_var.datalen; g++) {
67647                 LDKUtxo ret_conv_6_var = ret_var.data[g];
67648                 uint64_t ret_conv_6_ref = 0;
67649                 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_conv_6_var);
67650                 ret_conv_6_ref = tag_ptr(ret_conv_6_var.inner, ret_conv_6_var.is_owned);
67651                 ret_arr_ptr[g] = ret_conv_6_ref;
67652         }
67653         
67654         FREE(ret_var.data);
67655         return ret_arr;
67656 }
67657
67658 void  __attribute__((export_name("TS_CoinSelection_set_confirmed_utxos"))) TS_CoinSelection_set_confirmed_utxos(uint64_t this_ptr, uint64_tArray val) {
67659         LDKCoinSelection this_ptr_conv;
67660         this_ptr_conv.inner = untag_ptr(this_ptr);
67661         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
67662         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
67663         this_ptr_conv.is_owned = false;
67664         LDKCVec_UtxoZ val_constr;
67665         val_constr.datalen = val->arr_len;
67666         if (val_constr.datalen > 0)
67667                 val_constr.data = MALLOC(val_constr.datalen * sizeof(LDKUtxo), "LDKCVec_UtxoZ Elements");
67668         else
67669                 val_constr.data = NULL;
67670         uint64_t* val_vals = val->elems;
67671         for (size_t g = 0; g < val_constr.datalen; g++) {
67672                 uint64_t val_conv_6 = val_vals[g];
67673                 LDKUtxo val_conv_6_conv;
67674                 val_conv_6_conv.inner = untag_ptr(val_conv_6);
67675                 val_conv_6_conv.is_owned = ptr_is_owned(val_conv_6);
67676                 CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv_6_conv);
67677                 val_conv_6_conv = Utxo_clone(&val_conv_6_conv);
67678                 val_constr.data[g] = val_conv_6_conv;
67679         }
67680         FREE(val);
67681         CoinSelection_set_confirmed_utxos(&this_ptr_conv, val_constr);
67682 }
67683
67684 uint64_t  __attribute__((export_name("TS_CoinSelection_get_change_output"))) TS_CoinSelection_get_change_output(uint64_t this_ptr) {
67685         LDKCoinSelection this_ptr_conv;
67686         this_ptr_conv.inner = untag_ptr(this_ptr);
67687         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
67688         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
67689         this_ptr_conv.is_owned = false;
67690         LDKCOption_TxOutZ *ret_copy = MALLOC(sizeof(LDKCOption_TxOutZ), "LDKCOption_TxOutZ");
67691         *ret_copy = CoinSelection_get_change_output(&this_ptr_conv);
67692         uint64_t ret_ref = tag_ptr(ret_copy, true);
67693         return ret_ref;
67694 }
67695
67696 void  __attribute__((export_name("TS_CoinSelection_set_change_output"))) TS_CoinSelection_set_change_output(uint64_t this_ptr, uint64_t val) {
67697         LDKCoinSelection this_ptr_conv;
67698         this_ptr_conv.inner = untag_ptr(this_ptr);
67699         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
67700         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
67701         this_ptr_conv.is_owned = false;
67702         void* val_ptr = untag_ptr(val);
67703         CHECK_ACCESS(val_ptr);
67704         LDKCOption_TxOutZ val_conv = *(LDKCOption_TxOutZ*)(val_ptr);
67705         val_conv = COption_TxOutZ_clone((LDKCOption_TxOutZ*)untag_ptr(val));
67706         CoinSelection_set_change_output(&this_ptr_conv, val_conv);
67707 }
67708
67709 uint64_t  __attribute__((export_name("TS_CoinSelection_new"))) TS_CoinSelection_new(uint64_tArray confirmed_utxos_arg, uint64_t change_output_arg) {
67710         LDKCVec_UtxoZ confirmed_utxos_arg_constr;
67711         confirmed_utxos_arg_constr.datalen = confirmed_utxos_arg->arr_len;
67712         if (confirmed_utxos_arg_constr.datalen > 0)
67713                 confirmed_utxos_arg_constr.data = MALLOC(confirmed_utxos_arg_constr.datalen * sizeof(LDKUtxo), "LDKCVec_UtxoZ Elements");
67714         else
67715                 confirmed_utxos_arg_constr.data = NULL;
67716         uint64_t* confirmed_utxos_arg_vals = confirmed_utxos_arg->elems;
67717         for (size_t g = 0; g < confirmed_utxos_arg_constr.datalen; g++) {
67718                 uint64_t confirmed_utxos_arg_conv_6 = confirmed_utxos_arg_vals[g];
67719                 LDKUtxo confirmed_utxos_arg_conv_6_conv;
67720                 confirmed_utxos_arg_conv_6_conv.inner = untag_ptr(confirmed_utxos_arg_conv_6);
67721                 confirmed_utxos_arg_conv_6_conv.is_owned = ptr_is_owned(confirmed_utxos_arg_conv_6);
67722                 CHECK_INNER_FIELD_ACCESS_OR_NULL(confirmed_utxos_arg_conv_6_conv);
67723                 confirmed_utxos_arg_conv_6_conv = Utxo_clone(&confirmed_utxos_arg_conv_6_conv);
67724                 confirmed_utxos_arg_constr.data[g] = confirmed_utxos_arg_conv_6_conv;
67725         }
67726         FREE(confirmed_utxos_arg);
67727         void* change_output_arg_ptr = untag_ptr(change_output_arg);
67728         CHECK_ACCESS(change_output_arg_ptr);
67729         LDKCOption_TxOutZ change_output_arg_conv = *(LDKCOption_TxOutZ*)(change_output_arg_ptr);
67730         change_output_arg_conv = COption_TxOutZ_clone((LDKCOption_TxOutZ*)untag_ptr(change_output_arg));
67731         LDKCoinSelection ret_var = CoinSelection_new(confirmed_utxos_arg_constr, change_output_arg_conv);
67732         uint64_t ret_ref = 0;
67733         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
67734         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
67735         return ret_ref;
67736 }
67737
67738 static inline uint64_t CoinSelection_clone_ptr(LDKCoinSelection *NONNULL_PTR arg) {
67739         LDKCoinSelection ret_var = CoinSelection_clone(arg);
67740         uint64_t ret_ref = 0;
67741         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
67742         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
67743         return ret_ref;
67744 }
67745 int64_t  __attribute__((export_name("TS_CoinSelection_clone_ptr"))) TS_CoinSelection_clone_ptr(uint64_t arg) {
67746         LDKCoinSelection arg_conv;
67747         arg_conv.inner = untag_ptr(arg);
67748         arg_conv.is_owned = ptr_is_owned(arg);
67749         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
67750         arg_conv.is_owned = false;
67751         int64_t ret_conv = CoinSelection_clone_ptr(&arg_conv);
67752         return ret_conv;
67753 }
67754
67755 uint64_t  __attribute__((export_name("TS_CoinSelection_clone"))) TS_CoinSelection_clone(uint64_t orig) {
67756         LDKCoinSelection orig_conv;
67757         orig_conv.inner = untag_ptr(orig);
67758         orig_conv.is_owned = ptr_is_owned(orig);
67759         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
67760         orig_conv.is_owned = false;
67761         LDKCoinSelection ret_var = CoinSelection_clone(&orig_conv);
67762         uint64_t ret_ref = 0;
67763         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
67764         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
67765         return ret_ref;
67766 }
67767
67768 void  __attribute__((export_name("TS_CoinSelectionSource_free"))) TS_CoinSelectionSource_free(uint64_t this_ptr) {
67769         if (!ptr_is_owned(this_ptr)) return;
67770         void* this_ptr_ptr = untag_ptr(this_ptr);
67771         CHECK_ACCESS(this_ptr_ptr);
67772         LDKCoinSelectionSource this_ptr_conv = *(LDKCoinSelectionSource*)(this_ptr_ptr);
67773         FREE(untag_ptr(this_ptr));
67774         CoinSelectionSource_free(this_ptr_conv);
67775 }
67776
67777 void  __attribute__((export_name("TS_WalletSource_free"))) TS_WalletSource_free(uint64_t this_ptr) {
67778         if (!ptr_is_owned(this_ptr)) return;
67779         void* this_ptr_ptr = untag_ptr(this_ptr);
67780         CHECK_ACCESS(this_ptr_ptr);
67781         LDKWalletSource this_ptr_conv = *(LDKWalletSource*)(this_ptr_ptr);
67782         FREE(untag_ptr(this_ptr));
67783         WalletSource_free(this_ptr_conv);
67784 }
67785
67786 void  __attribute__((export_name("TS_Wallet_free"))) TS_Wallet_free(uint64_t this_obj) {
67787         LDKWallet this_obj_conv;
67788         this_obj_conv.inner = untag_ptr(this_obj);
67789         this_obj_conv.is_owned = ptr_is_owned(this_obj);
67790         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
67791         Wallet_free(this_obj_conv);
67792 }
67793
67794 uint64_t  __attribute__((export_name("TS_Wallet_new"))) TS_Wallet_new(uint64_t source, uint64_t logger) {
67795         void* source_ptr = untag_ptr(source);
67796         CHECK_ACCESS(source_ptr);
67797         LDKWalletSource source_conv = *(LDKWalletSource*)(source_ptr);
67798         if (source_conv.free == LDKWalletSource_JCalls_free) {
67799                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
67800                 LDKWalletSource_JCalls_cloned(&source_conv);
67801         }
67802         void* logger_ptr = untag_ptr(logger);
67803         CHECK_ACCESS(logger_ptr);
67804         LDKLogger logger_conv = *(LDKLogger*)(logger_ptr);
67805         if (logger_conv.free == LDKLogger_JCalls_free) {
67806                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
67807                 LDKLogger_JCalls_cloned(&logger_conv);
67808         }
67809         LDKWallet ret_var = Wallet_new(source_conv, logger_conv);
67810         uint64_t ret_ref = 0;
67811         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
67812         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
67813         return ret_ref;
67814 }
67815
67816 uint64_t  __attribute__((export_name("TS_Wallet_as_CoinSelectionSource"))) TS_Wallet_as_CoinSelectionSource(uint64_t this_arg) {
67817         LDKWallet this_arg_conv;
67818         this_arg_conv.inner = untag_ptr(this_arg);
67819         this_arg_conv.is_owned = ptr_is_owned(this_arg);
67820         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
67821         this_arg_conv.is_owned = false;
67822         LDKCoinSelectionSource* ret_ret = MALLOC(sizeof(LDKCoinSelectionSource), "LDKCoinSelectionSource");
67823         *ret_ret = Wallet_as_CoinSelectionSource(&this_arg_conv);
67824         return tag_ptr(ret_ret, true);
67825 }
67826
67827 void  __attribute__((export_name("TS_BumpTransactionEventHandler_free"))) TS_BumpTransactionEventHandler_free(uint64_t this_obj) {
67828         LDKBumpTransactionEventHandler this_obj_conv;
67829         this_obj_conv.inner = untag_ptr(this_obj);
67830         this_obj_conv.is_owned = ptr_is_owned(this_obj);
67831         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
67832         BumpTransactionEventHandler_free(this_obj_conv);
67833 }
67834
67835 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) {
67836         void* broadcaster_ptr = untag_ptr(broadcaster);
67837         CHECK_ACCESS(broadcaster_ptr);
67838         LDKBroadcasterInterface broadcaster_conv = *(LDKBroadcasterInterface*)(broadcaster_ptr);
67839         if (broadcaster_conv.free == LDKBroadcasterInterface_JCalls_free) {
67840                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
67841                 LDKBroadcasterInterface_JCalls_cloned(&broadcaster_conv);
67842         }
67843         void* utxo_source_ptr = untag_ptr(utxo_source);
67844         CHECK_ACCESS(utxo_source_ptr);
67845         LDKCoinSelectionSource utxo_source_conv = *(LDKCoinSelectionSource*)(utxo_source_ptr);
67846         if (utxo_source_conv.free == LDKCoinSelectionSource_JCalls_free) {
67847                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
67848                 LDKCoinSelectionSource_JCalls_cloned(&utxo_source_conv);
67849         }
67850         void* signer_provider_ptr = untag_ptr(signer_provider);
67851         CHECK_ACCESS(signer_provider_ptr);
67852         LDKSignerProvider signer_provider_conv = *(LDKSignerProvider*)(signer_provider_ptr);
67853         if (signer_provider_conv.free == LDKSignerProvider_JCalls_free) {
67854                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
67855                 LDKSignerProvider_JCalls_cloned(&signer_provider_conv);
67856         }
67857         void* logger_ptr = untag_ptr(logger);
67858         CHECK_ACCESS(logger_ptr);
67859         LDKLogger logger_conv = *(LDKLogger*)(logger_ptr);
67860         if (logger_conv.free == LDKLogger_JCalls_free) {
67861                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
67862                 LDKLogger_JCalls_cloned(&logger_conv);
67863         }
67864         LDKBumpTransactionEventHandler ret_var = BumpTransactionEventHandler_new(broadcaster_conv, utxo_source_conv, signer_provider_conv, logger_conv);
67865         uint64_t ret_ref = 0;
67866         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
67867         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
67868         return ret_ref;
67869 }
67870
67871 void  __attribute__((export_name("TS_BumpTransactionEventHandler_handle_event"))) TS_BumpTransactionEventHandler_handle_event(uint64_t this_arg, uint64_t event) {
67872         LDKBumpTransactionEventHandler this_arg_conv;
67873         this_arg_conv.inner = untag_ptr(this_arg);
67874         this_arg_conv.is_owned = ptr_is_owned(this_arg);
67875         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
67876         this_arg_conv.is_owned = false;
67877         LDKBumpTransactionEvent* event_conv = (LDKBumpTransactionEvent*)untag_ptr(event);
67878         BumpTransactionEventHandler_handle_event(&this_arg_conv, event_conv);
67879 }
67880
67881 void  __attribute__((export_name("TS_GossipSync_free"))) TS_GossipSync_free(uint64_t this_ptr) {
67882         if (!ptr_is_owned(this_ptr)) return;
67883         void* this_ptr_ptr = untag_ptr(this_ptr);
67884         CHECK_ACCESS(this_ptr_ptr);
67885         LDKGossipSync this_ptr_conv = *(LDKGossipSync*)(this_ptr_ptr);
67886         FREE(untag_ptr(this_ptr));
67887         GossipSync_free(this_ptr_conv);
67888 }
67889
67890 uint64_t  __attribute__((export_name("TS_GossipSync_p2_p"))) TS_GossipSync_p2_p(uint64_t a) {
67891         LDKP2PGossipSync a_conv;
67892         a_conv.inner = untag_ptr(a);
67893         a_conv.is_owned = ptr_is_owned(a);
67894         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
67895         a_conv.is_owned = false;
67896         LDKGossipSync *ret_copy = MALLOC(sizeof(LDKGossipSync), "LDKGossipSync");
67897         *ret_copy = GossipSync_p2_p(&a_conv);
67898         uint64_t ret_ref = tag_ptr(ret_copy, true);
67899         return ret_ref;
67900 }
67901
67902 uint64_t  __attribute__((export_name("TS_GossipSync_rapid"))) TS_GossipSync_rapid(uint64_t a) {
67903         LDKRapidGossipSync a_conv;
67904         a_conv.inner = untag_ptr(a);
67905         a_conv.is_owned = ptr_is_owned(a);
67906         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
67907         a_conv.is_owned = false;
67908         LDKGossipSync *ret_copy = MALLOC(sizeof(LDKGossipSync), "LDKGossipSync");
67909         *ret_copy = GossipSync_rapid(&a_conv);
67910         uint64_t ret_ref = tag_ptr(ret_copy, true);
67911         return ret_ref;
67912 }
67913
67914 uint64_t  __attribute__((export_name("TS_GossipSync_none"))) TS_GossipSync_none() {
67915         LDKGossipSync *ret_copy = MALLOC(sizeof(LDKGossipSync), "LDKGossipSync");
67916         *ret_copy = GossipSync_none();
67917         uint64_t ret_ref = tag_ptr(ret_copy, true);
67918         return ret_ref;
67919 }
67920
67921 void  __attribute__((export_name("TS_RapidGossipSync_free"))) TS_RapidGossipSync_free(uint64_t this_obj) {
67922         LDKRapidGossipSync this_obj_conv;
67923         this_obj_conv.inner = untag_ptr(this_obj);
67924         this_obj_conv.is_owned = ptr_is_owned(this_obj);
67925         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
67926         RapidGossipSync_free(this_obj_conv);
67927 }
67928
67929 uint64_t  __attribute__((export_name("TS_RapidGossipSync_new"))) TS_RapidGossipSync_new(uint64_t network_graph, uint64_t logger) {
67930         LDKNetworkGraph network_graph_conv;
67931         network_graph_conv.inner = untag_ptr(network_graph);
67932         network_graph_conv.is_owned = ptr_is_owned(network_graph);
67933         CHECK_INNER_FIELD_ACCESS_OR_NULL(network_graph_conv);
67934         network_graph_conv.is_owned = false;
67935         void* logger_ptr = untag_ptr(logger);
67936         CHECK_ACCESS(logger_ptr);
67937         LDKLogger logger_conv = *(LDKLogger*)(logger_ptr);
67938         if (logger_conv.free == LDKLogger_JCalls_free) {
67939                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
67940                 LDKLogger_JCalls_cloned(&logger_conv);
67941         }
67942         LDKRapidGossipSync ret_var = RapidGossipSync_new(&network_graph_conv, logger_conv);
67943         uint64_t ret_ref = 0;
67944         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
67945         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
67946         return ret_ref;
67947 }
67948
67949 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) {
67950         LDKRapidGossipSync this_arg_conv;
67951         this_arg_conv.inner = untag_ptr(this_arg);
67952         this_arg_conv.is_owned = ptr_is_owned(this_arg);
67953         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
67954         this_arg_conv.is_owned = false;
67955         LDKu8slice update_data_ref;
67956         update_data_ref.datalen = update_data->arr_len;
67957         update_data_ref.data = update_data->elems;
67958         void* current_time_unix_ptr = untag_ptr(current_time_unix);
67959         CHECK_ACCESS(current_time_unix_ptr);
67960         LDKCOption_u64Z current_time_unix_conv = *(LDKCOption_u64Z*)(current_time_unix_ptr);
67961         current_time_unix_conv = COption_u64Z_clone((LDKCOption_u64Z*)untag_ptr(current_time_unix));
67962         LDKCResult_u32GraphSyncErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_u32GraphSyncErrorZ), "LDKCResult_u32GraphSyncErrorZ");
67963         *ret_conv = RapidGossipSync_update_network_graph_no_std(&this_arg_conv, update_data_ref, current_time_unix_conv);
67964         FREE(update_data);
67965         return tag_ptr(ret_conv, true);
67966 }
67967
67968 jboolean  __attribute__((export_name("TS_RapidGossipSync_is_initial_sync_complete"))) TS_RapidGossipSync_is_initial_sync_complete(uint64_t this_arg) {
67969         LDKRapidGossipSync this_arg_conv;
67970         this_arg_conv.inner = untag_ptr(this_arg);
67971         this_arg_conv.is_owned = ptr_is_owned(this_arg);
67972         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
67973         this_arg_conv.is_owned = false;
67974         jboolean ret_conv = RapidGossipSync_is_initial_sync_complete(&this_arg_conv);
67975         return ret_conv;
67976 }
67977
67978 void  __attribute__((export_name("TS_GraphSyncError_free"))) TS_GraphSyncError_free(uint64_t this_ptr) {
67979         if (!ptr_is_owned(this_ptr)) return;
67980         void* this_ptr_ptr = untag_ptr(this_ptr);
67981         CHECK_ACCESS(this_ptr_ptr);
67982         LDKGraphSyncError this_ptr_conv = *(LDKGraphSyncError*)(this_ptr_ptr);
67983         FREE(untag_ptr(this_ptr));
67984         GraphSyncError_free(this_ptr_conv);
67985 }
67986
67987 static inline uint64_t GraphSyncError_clone_ptr(LDKGraphSyncError *NONNULL_PTR arg) {
67988         LDKGraphSyncError *ret_copy = MALLOC(sizeof(LDKGraphSyncError), "LDKGraphSyncError");
67989         *ret_copy = GraphSyncError_clone(arg);
67990         uint64_t ret_ref = tag_ptr(ret_copy, true);
67991         return ret_ref;
67992 }
67993 int64_t  __attribute__((export_name("TS_GraphSyncError_clone_ptr"))) TS_GraphSyncError_clone_ptr(uint64_t arg) {
67994         LDKGraphSyncError* arg_conv = (LDKGraphSyncError*)untag_ptr(arg);
67995         int64_t ret_conv = GraphSyncError_clone_ptr(arg_conv);
67996         return ret_conv;
67997 }
67998
67999 uint64_t  __attribute__((export_name("TS_GraphSyncError_clone"))) TS_GraphSyncError_clone(uint64_t orig) {
68000         LDKGraphSyncError* orig_conv = (LDKGraphSyncError*)untag_ptr(orig);
68001         LDKGraphSyncError *ret_copy = MALLOC(sizeof(LDKGraphSyncError), "LDKGraphSyncError");
68002         *ret_copy = GraphSyncError_clone(orig_conv);
68003         uint64_t ret_ref = tag_ptr(ret_copy, true);
68004         return ret_ref;
68005 }
68006
68007 uint64_t  __attribute__((export_name("TS_GraphSyncError_decode_error"))) TS_GraphSyncError_decode_error(uint64_t a) {
68008         void* a_ptr = untag_ptr(a);
68009         CHECK_ACCESS(a_ptr);
68010         LDKDecodeError a_conv = *(LDKDecodeError*)(a_ptr);
68011         a_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(a));
68012         LDKGraphSyncError *ret_copy = MALLOC(sizeof(LDKGraphSyncError), "LDKGraphSyncError");
68013         *ret_copy = GraphSyncError_decode_error(a_conv);
68014         uint64_t ret_ref = tag_ptr(ret_copy, true);
68015         return ret_ref;
68016 }
68017
68018 uint64_t  __attribute__((export_name("TS_GraphSyncError_lightning_error"))) TS_GraphSyncError_lightning_error(uint64_t a) {
68019         LDKLightningError a_conv;
68020         a_conv.inner = untag_ptr(a);
68021         a_conv.is_owned = ptr_is_owned(a);
68022         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
68023         a_conv = LightningError_clone(&a_conv);
68024         LDKGraphSyncError *ret_copy = MALLOC(sizeof(LDKGraphSyncError), "LDKGraphSyncError");
68025         *ret_copy = GraphSyncError_lightning_error(a_conv);
68026         uint64_t ret_ref = tag_ptr(ret_copy, true);
68027         return ret_ref;
68028 }
68029
68030 void  __attribute__((export_name("TS_Bolt11ParseError_free"))) TS_Bolt11ParseError_free(uint64_t this_ptr) {
68031         if (!ptr_is_owned(this_ptr)) return;
68032         void* this_ptr_ptr = untag_ptr(this_ptr);
68033         CHECK_ACCESS(this_ptr_ptr);
68034         LDKBolt11ParseError this_ptr_conv = *(LDKBolt11ParseError*)(this_ptr_ptr);
68035         FREE(untag_ptr(this_ptr));
68036         Bolt11ParseError_free(this_ptr_conv);
68037 }
68038
68039 static inline uint64_t Bolt11ParseError_clone_ptr(LDKBolt11ParseError *NONNULL_PTR arg) {
68040         LDKBolt11ParseError *ret_copy = MALLOC(sizeof(LDKBolt11ParseError), "LDKBolt11ParseError");
68041         *ret_copy = Bolt11ParseError_clone(arg);
68042         uint64_t ret_ref = tag_ptr(ret_copy, true);
68043         return ret_ref;
68044 }
68045 int64_t  __attribute__((export_name("TS_Bolt11ParseError_clone_ptr"))) TS_Bolt11ParseError_clone_ptr(uint64_t arg) {
68046         LDKBolt11ParseError* arg_conv = (LDKBolt11ParseError*)untag_ptr(arg);
68047         int64_t ret_conv = Bolt11ParseError_clone_ptr(arg_conv);
68048         return ret_conv;
68049 }
68050
68051 uint64_t  __attribute__((export_name("TS_Bolt11ParseError_clone"))) TS_Bolt11ParseError_clone(uint64_t orig) {
68052         LDKBolt11ParseError* orig_conv = (LDKBolt11ParseError*)untag_ptr(orig);
68053         LDKBolt11ParseError *ret_copy = MALLOC(sizeof(LDKBolt11ParseError), "LDKBolt11ParseError");
68054         *ret_copy = Bolt11ParseError_clone(orig_conv);
68055         uint64_t ret_ref = tag_ptr(ret_copy, true);
68056         return ret_ref;
68057 }
68058
68059 uint64_t  __attribute__((export_name("TS_Bolt11ParseError_bech32_error"))) TS_Bolt11ParseError_bech32_error(uint64_t a) {
68060         void* a_ptr = untag_ptr(a);
68061         CHECK_ACCESS(a_ptr);
68062         LDKBech32Error a_conv = *(LDKBech32Error*)(a_ptr);
68063         a_conv = Bech32Error_clone((LDKBech32Error*)untag_ptr(a));
68064         LDKBolt11ParseError *ret_copy = MALLOC(sizeof(LDKBolt11ParseError), "LDKBolt11ParseError");
68065         *ret_copy = Bolt11ParseError_bech32_error(a_conv);
68066         uint64_t ret_ref = tag_ptr(ret_copy, true);
68067         return ret_ref;
68068 }
68069
68070 uint64_t  __attribute__((export_name("TS_Bolt11ParseError_parse_amount_error"))) TS_Bolt11ParseError_parse_amount_error(int32_t a) {
68071         
68072         LDKBolt11ParseError *ret_copy = MALLOC(sizeof(LDKBolt11ParseError), "LDKBolt11ParseError");
68073         *ret_copy = Bolt11ParseError_parse_amount_error((LDKError){ ._dummy = 0 });
68074         uint64_t ret_ref = tag_ptr(ret_copy, true);
68075         return ret_ref;
68076 }
68077
68078 uint64_t  __attribute__((export_name("TS_Bolt11ParseError_malformed_signature"))) TS_Bolt11ParseError_malformed_signature(uint32_t a) {
68079         LDKSecp256k1Error a_conv = LDKSecp256k1Error_from_js(a);
68080         LDKBolt11ParseError *ret_copy = MALLOC(sizeof(LDKBolt11ParseError), "LDKBolt11ParseError");
68081         *ret_copy = Bolt11ParseError_malformed_signature(a_conv);
68082         uint64_t ret_ref = tag_ptr(ret_copy, true);
68083         return ret_ref;
68084 }
68085
68086 uint64_t  __attribute__((export_name("TS_Bolt11ParseError_bad_prefix"))) TS_Bolt11ParseError_bad_prefix() {
68087         LDKBolt11ParseError *ret_copy = MALLOC(sizeof(LDKBolt11ParseError), "LDKBolt11ParseError");
68088         *ret_copy = Bolt11ParseError_bad_prefix();
68089         uint64_t ret_ref = tag_ptr(ret_copy, true);
68090         return ret_ref;
68091 }
68092
68093 uint64_t  __attribute__((export_name("TS_Bolt11ParseError_unknown_currency"))) TS_Bolt11ParseError_unknown_currency() {
68094         LDKBolt11ParseError *ret_copy = MALLOC(sizeof(LDKBolt11ParseError), "LDKBolt11ParseError");
68095         *ret_copy = Bolt11ParseError_unknown_currency();
68096         uint64_t ret_ref = tag_ptr(ret_copy, true);
68097         return ret_ref;
68098 }
68099
68100 uint64_t  __attribute__((export_name("TS_Bolt11ParseError_unknown_si_prefix"))) TS_Bolt11ParseError_unknown_si_prefix() {
68101         LDKBolt11ParseError *ret_copy = MALLOC(sizeof(LDKBolt11ParseError), "LDKBolt11ParseError");
68102         *ret_copy = Bolt11ParseError_unknown_si_prefix();
68103         uint64_t ret_ref = tag_ptr(ret_copy, true);
68104         return ret_ref;
68105 }
68106
68107 uint64_t  __attribute__((export_name("TS_Bolt11ParseError_malformed_hrp"))) TS_Bolt11ParseError_malformed_hrp() {
68108         LDKBolt11ParseError *ret_copy = MALLOC(sizeof(LDKBolt11ParseError), "LDKBolt11ParseError");
68109         *ret_copy = Bolt11ParseError_malformed_hrp();
68110         uint64_t ret_ref = tag_ptr(ret_copy, true);
68111         return ret_ref;
68112 }
68113
68114 uint64_t  __attribute__((export_name("TS_Bolt11ParseError_too_short_data_part"))) TS_Bolt11ParseError_too_short_data_part() {
68115         LDKBolt11ParseError *ret_copy = MALLOC(sizeof(LDKBolt11ParseError), "LDKBolt11ParseError");
68116         *ret_copy = Bolt11ParseError_too_short_data_part();
68117         uint64_t ret_ref = tag_ptr(ret_copy, true);
68118         return ret_ref;
68119 }
68120
68121 uint64_t  __attribute__((export_name("TS_Bolt11ParseError_unexpected_end_of_tagged_fields"))) TS_Bolt11ParseError_unexpected_end_of_tagged_fields() {
68122         LDKBolt11ParseError *ret_copy = MALLOC(sizeof(LDKBolt11ParseError), "LDKBolt11ParseError");
68123         *ret_copy = Bolt11ParseError_unexpected_end_of_tagged_fields();
68124         uint64_t ret_ref = tag_ptr(ret_copy, true);
68125         return ret_ref;
68126 }
68127
68128 uint64_t  __attribute__((export_name("TS_Bolt11ParseError_description_decode_error"))) TS_Bolt11ParseError_description_decode_error(int32_t a) {
68129         
68130         LDKBolt11ParseError *ret_copy = MALLOC(sizeof(LDKBolt11ParseError), "LDKBolt11ParseError");
68131         *ret_copy = Bolt11ParseError_description_decode_error((LDKError){ ._dummy = 0 });
68132         uint64_t ret_ref = tag_ptr(ret_copy, true);
68133         return ret_ref;
68134 }
68135
68136 uint64_t  __attribute__((export_name("TS_Bolt11ParseError_padding_error"))) TS_Bolt11ParseError_padding_error() {
68137         LDKBolt11ParseError *ret_copy = MALLOC(sizeof(LDKBolt11ParseError), "LDKBolt11ParseError");
68138         *ret_copy = Bolt11ParseError_padding_error();
68139         uint64_t ret_ref = tag_ptr(ret_copy, true);
68140         return ret_ref;
68141 }
68142
68143 uint64_t  __attribute__((export_name("TS_Bolt11ParseError_integer_overflow_error"))) TS_Bolt11ParseError_integer_overflow_error() {
68144         LDKBolt11ParseError *ret_copy = MALLOC(sizeof(LDKBolt11ParseError), "LDKBolt11ParseError");
68145         *ret_copy = Bolt11ParseError_integer_overflow_error();
68146         uint64_t ret_ref = tag_ptr(ret_copy, true);
68147         return ret_ref;
68148 }
68149
68150 uint64_t  __attribute__((export_name("TS_Bolt11ParseError_invalid_seg_wit_program_length"))) TS_Bolt11ParseError_invalid_seg_wit_program_length() {
68151         LDKBolt11ParseError *ret_copy = MALLOC(sizeof(LDKBolt11ParseError), "LDKBolt11ParseError");
68152         *ret_copy = Bolt11ParseError_invalid_seg_wit_program_length();
68153         uint64_t ret_ref = tag_ptr(ret_copy, true);
68154         return ret_ref;
68155 }
68156
68157 uint64_t  __attribute__((export_name("TS_Bolt11ParseError_invalid_pub_key_hash_length"))) TS_Bolt11ParseError_invalid_pub_key_hash_length() {
68158         LDKBolt11ParseError *ret_copy = MALLOC(sizeof(LDKBolt11ParseError), "LDKBolt11ParseError");
68159         *ret_copy = Bolt11ParseError_invalid_pub_key_hash_length();
68160         uint64_t ret_ref = tag_ptr(ret_copy, true);
68161         return ret_ref;
68162 }
68163
68164 uint64_t  __attribute__((export_name("TS_Bolt11ParseError_invalid_script_hash_length"))) TS_Bolt11ParseError_invalid_script_hash_length() {
68165         LDKBolt11ParseError *ret_copy = MALLOC(sizeof(LDKBolt11ParseError), "LDKBolt11ParseError");
68166         *ret_copy = Bolt11ParseError_invalid_script_hash_length();
68167         uint64_t ret_ref = tag_ptr(ret_copy, true);
68168         return ret_ref;
68169 }
68170
68171 uint64_t  __attribute__((export_name("TS_Bolt11ParseError_invalid_recovery_id"))) TS_Bolt11ParseError_invalid_recovery_id() {
68172         LDKBolt11ParseError *ret_copy = MALLOC(sizeof(LDKBolt11ParseError), "LDKBolt11ParseError");
68173         *ret_copy = Bolt11ParseError_invalid_recovery_id();
68174         uint64_t ret_ref = tag_ptr(ret_copy, true);
68175         return ret_ref;
68176 }
68177
68178 uint64_t  __attribute__((export_name("TS_Bolt11ParseError_invalid_slice_length"))) TS_Bolt11ParseError_invalid_slice_length(jstring a) {
68179         LDKStr a_conv = str_ref_to_owned_c(a);
68180         LDKBolt11ParseError *ret_copy = MALLOC(sizeof(LDKBolt11ParseError), "LDKBolt11ParseError");
68181         *ret_copy = Bolt11ParseError_invalid_slice_length(a_conv);
68182         uint64_t ret_ref = tag_ptr(ret_copy, true);
68183         return ret_ref;
68184 }
68185
68186 uint64_t  __attribute__((export_name("TS_Bolt11ParseError_skip"))) TS_Bolt11ParseError_skip() {
68187         LDKBolt11ParseError *ret_copy = MALLOC(sizeof(LDKBolt11ParseError), "LDKBolt11ParseError");
68188         *ret_copy = Bolt11ParseError_skip();
68189         uint64_t ret_ref = tag_ptr(ret_copy, true);
68190         return ret_ref;
68191 }
68192
68193 jboolean  __attribute__((export_name("TS_Bolt11ParseError_eq"))) TS_Bolt11ParseError_eq(uint64_t a, uint64_t b) {
68194         LDKBolt11ParseError* a_conv = (LDKBolt11ParseError*)untag_ptr(a);
68195         LDKBolt11ParseError* b_conv = (LDKBolt11ParseError*)untag_ptr(b);
68196         jboolean ret_conv = Bolt11ParseError_eq(a_conv, b_conv);
68197         return ret_conv;
68198 }
68199
68200 void  __attribute__((export_name("TS_ParseOrSemanticError_free"))) TS_ParseOrSemanticError_free(uint64_t this_ptr) {
68201         if (!ptr_is_owned(this_ptr)) return;
68202         void* this_ptr_ptr = untag_ptr(this_ptr);
68203         CHECK_ACCESS(this_ptr_ptr);
68204         LDKParseOrSemanticError this_ptr_conv = *(LDKParseOrSemanticError*)(this_ptr_ptr);
68205         FREE(untag_ptr(this_ptr));
68206         ParseOrSemanticError_free(this_ptr_conv);
68207 }
68208
68209 static inline uint64_t ParseOrSemanticError_clone_ptr(LDKParseOrSemanticError *NONNULL_PTR arg) {
68210         LDKParseOrSemanticError *ret_copy = MALLOC(sizeof(LDKParseOrSemanticError), "LDKParseOrSemanticError");
68211         *ret_copy = ParseOrSemanticError_clone(arg);
68212         uint64_t ret_ref = tag_ptr(ret_copy, true);
68213         return ret_ref;
68214 }
68215 int64_t  __attribute__((export_name("TS_ParseOrSemanticError_clone_ptr"))) TS_ParseOrSemanticError_clone_ptr(uint64_t arg) {
68216         LDKParseOrSemanticError* arg_conv = (LDKParseOrSemanticError*)untag_ptr(arg);
68217         int64_t ret_conv = ParseOrSemanticError_clone_ptr(arg_conv);
68218         return ret_conv;
68219 }
68220
68221 uint64_t  __attribute__((export_name("TS_ParseOrSemanticError_clone"))) TS_ParseOrSemanticError_clone(uint64_t orig) {
68222         LDKParseOrSemanticError* orig_conv = (LDKParseOrSemanticError*)untag_ptr(orig);
68223         LDKParseOrSemanticError *ret_copy = MALLOC(sizeof(LDKParseOrSemanticError), "LDKParseOrSemanticError");
68224         *ret_copy = ParseOrSemanticError_clone(orig_conv);
68225         uint64_t ret_ref = tag_ptr(ret_copy, true);
68226         return ret_ref;
68227 }
68228
68229 uint64_t  __attribute__((export_name("TS_ParseOrSemanticError_parse_error"))) TS_ParseOrSemanticError_parse_error(uint64_t a) {
68230         void* a_ptr = untag_ptr(a);
68231         CHECK_ACCESS(a_ptr);
68232         LDKBolt11ParseError a_conv = *(LDKBolt11ParseError*)(a_ptr);
68233         a_conv = Bolt11ParseError_clone((LDKBolt11ParseError*)untag_ptr(a));
68234         LDKParseOrSemanticError *ret_copy = MALLOC(sizeof(LDKParseOrSemanticError), "LDKParseOrSemanticError");
68235         *ret_copy = ParseOrSemanticError_parse_error(a_conv);
68236         uint64_t ret_ref = tag_ptr(ret_copy, true);
68237         return ret_ref;
68238 }
68239
68240 uint64_t  __attribute__((export_name("TS_ParseOrSemanticError_semantic_error"))) TS_ParseOrSemanticError_semantic_error(uint32_t a) {
68241         LDKBolt11SemanticError a_conv = LDKBolt11SemanticError_from_js(a);
68242         LDKParseOrSemanticError *ret_copy = MALLOC(sizeof(LDKParseOrSemanticError), "LDKParseOrSemanticError");
68243         *ret_copy = ParseOrSemanticError_semantic_error(a_conv);
68244         uint64_t ret_ref = tag_ptr(ret_copy, true);
68245         return ret_ref;
68246 }
68247
68248 jboolean  __attribute__((export_name("TS_ParseOrSemanticError_eq"))) TS_ParseOrSemanticError_eq(uint64_t a, uint64_t b) {
68249         LDKParseOrSemanticError* a_conv = (LDKParseOrSemanticError*)untag_ptr(a);
68250         LDKParseOrSemanticError* b_conv = (LDKParseOrSemanticError*)untag_ptr(b);
68251         jboolean ret_conv = ParseOrSemanticError_eq(a_conv, b_conv);
68252         return ret_conv;
68253 }
68254
68255 void  __attribute__((export_name("TS_Bolt11Invoice_free"))) TS_Bolt11Invoice_free(uint64_t this_obj) {
68256         LDKBolt11Invoice this_obj_conv;
68257         this_obj_conv.inner = untag_ptr(this_obj);
68258         this_obj_conv.is_owned = ptr_is_owned(this_obj);
68259         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
68260         Bolt11Invoice_free(this_obj_conv);
68261 }
68262
68263 jboolean  __attribute__((export_name("TS_Bolt11Invoice_eq"))) TS_Bolt11Invoice_eq(uint64_t a, uint64_t b) {
68264         LDKBolt11Invoice a_conv;
68265         a_conv.inner = untag_ptr(a);
68266         a_conv.is_owned = ptr_is_owned(a);
68267         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
68268         a_conv.is_owned = false;
68269         LDKBolt11Invoice b_conv;
68270         b_conv.inner = untag_ptr(b);
68271         b_conv.is_owned = ptr_is_owned(b);
68272         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
68273         b_conv.is_owned = false;
68274         jboolean ret_conv = Bolt11Invoice_eq(&a_conv, &b_conv);
68275         return ret_conv;
68276 }
68277
68278 static inline uint64_t Bolt11Invoice_clone_ptr(LDKBolt11Invoice *NONNULL_PTR arg) {
68279         LDKBolt11Invoice ret_var = Bolt11Invoice_clone(arg);
68280         uint64_t ret_ref = 0;
68281         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
68282         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
68283         return ret_ref;
68284 }
68285 int64_t  __attribute__((export_name("TS_Bolt11Invoice_clone_ptr"))) TS_Bolt11Invoice_clone_ptr(uint64_t arg) {
68286         LDKBolt11Invoice arg_conv;
68287         arg_conv.inner = untag_ptr(arg);
68288         arg_conv.is_owned = ptr_is_owned(arg);
68289         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
68290         arg_conv.is_owned = false;
68291         int64_t ret_conv = Bolt11Invoice_clone_ptr(&arg_conv);
68292         return ret_conv;
68293 }
68294
68295 uint64_t  __attribute__((export_name("TS_Bolt11Invoice_clone"))) TS_Bolt11Invoice_clone(uint64_t orig) {
68296         LDKBolt11Invoice orig_conv;
68297         orig_conv.inner = untag_ptr(orig);
68298         orig_conv.is_owned = ptr_is_owned(orig);
68299         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
68300         orig_conv.is_owned = false;
68301         LDKBolt11Invoice ret_var = Bolt11Invoice_clone(&orig_conv);
68302         uint64_t ret_ref = 0;
68303         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
68304         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
68305         return ret_ref;
68306 }
68307
68308 int64_t  __attribute__((export_name("TS_Bolt11Invoice_hash"))) TS_Bolt11Invoice_hash(uint64_t o) {
68309         LDKBolt11Invoice o_conv;
68310         o_conv.inner = untag_ptr(o);
68311         o_conv.is_owned = ptr_is_owned(o);
68312         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
68313         o_conv.is_owned = false;
68314         int64_t ret_conv = Bolt11Invoice_hash(&o_conv);
68315         return ret_conv;
68316 }
68317
68318 void  __attribute__((export_name("TS_SignedRawBolt11Invoice_free"))) TS_SignedRawBolt11Invoice_free(uint64_t this_obj) {
68319         LDKSignedRawBolt11Invoice this_obj_conv;
68320         this_obj_conv.inner = untag_ptr(this_obj);
68321         this_obj_conv.is_owned = ptr_is_owned(this_obj);
68322         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
68323         SignedRawBolt11Invoice_free(this_obj_conv);
68324 }
68325
68326 jboolean  __attribute__((export_name("TS_SignedRawBolt11Invoice_eq"))) TS_SignedRawBolt11Invoice_eq(uint64_t a, uint64_t b) {
68327         LDKSignedRawBolt11Invoice a_conv;
68328         a_conv.inner = untag_ptr(a);
68329         a_conv.is_owned = ptr_is_owned(a);
68330         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
68331         a_conv.is_owned = false;
68332         LDKSignedRawBolt11Invoice b_conv;
68333         b_conv.inner = untag_ptr(b);
68334         b_conv.is_owned = ptr_is_owned(b);
68335         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
68336         b_conv.is_owned = false;
68337         jboolean ret_conv = SignedRawBolt11Invoice_eq(&a_conv, &b_conv);
68338         return ret_conv;
68339 }
68340
68341 static inline uint64_t SignedRawBolt11Invoice_clone_ptr(LDKSignedRawBolt11Invoice *NONNULL_PTR arg) {
68342         LDKSignedRawBolt11Invoice ret_var = SignedRawBolt11Invoice_clone(arg);
68343         uint64_t ret_ref = 0;
68344         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
68345         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
68346         return ret_ref;
68347 }
68348 int64_t  __attribute__((export_name("TS_SignedRawBolt11Invoice_clone_ptr"))) TS_SignedRawBolt11Invoice_clone_ptr(uint64_t arg) {
68349         LDKSignedRawBolt11Invoice arg_conv;
68350         arg_conv.inner = untag_ptr(arg);
68351         arg_conv.is_owned = ptr_is_owned(arg);
68352         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
68353         arg_conv.is_owned = false;
68354         int64_t ret_conv = SignedRawBolt11Invoice_clone_ptr(&arg_conv);
68355         return ret_conv;
68356 }
68357
68358 uint64_t  __attribute__((export_name("TS_SignedRawBolt11Invoice_clone"))) TS_SignedRawBolt11Invoice_clone(uint64_t orig) {
68359         LDKSignedRawBolt11Invoice orig_conv;
68360         orig_conv.inner = untag_ptr(orig);
68361         orig_conv.is_owned = ptr_is_owned(orig);
68362         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
68363         orig_conv.is_owned = false;
68364         LDKSignedRawBolt11Invoice ret_var = SignedRawBolt11Invoice_clone(&orig_conv);
68365         uint64_t ret_ref = 0;
68366         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
68367         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
68368         return ret_ref;
68369 }
68370
68371 int64_t  __attribute__((export_name("TS_SignedRawBolt11Invoice_hash"))) TS_SignedRawBolt11Invoice_hash(uint64_t o) {
68372         LDKSignedRawBolt11Invoice o_conv;
68373         o_conv.inner = untag_ptr(o);
68374         o_conv.is_owned = ptr_is_owned(o);
68375         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
68376         o_conv.is_owned = false;
68377         int64_t ret_conv = SignedRawBolt11Invoice_hash(&o_conv);
68378         return ret_conv;
68379 }
68380
68381 void  __attribute__((export_name("TS_RawBolt11Invoice_free"))) TS_RawBolt11Invoice_free(uint64_t this_obj) {
68382         LDKRawBolt11Invoice this_obj_conv;
68383         this_obj_conv.inner = untag_ptr(this_obj);
68384         this_obj_conv.is_owned = ptr_is_owned(this_obj);
68385         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
68386         RawBolt11Invoice_free(this_obj_conv);
68387 }
68388
68389 uint64_t  __attribute__((export_name("TS_RawBolt11Invoice_get_data"))) TS_RawBolt11Invoice_get_data(uint64_t this_ptr) {
68390         LDKRawBolt11Invoice this_ptr_conv;
68391         this_ptr_conv.inner = untag_ptr(this_ptr);
68392         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
68393         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
68394         this_ptr_conv.is_owned = false;
68395         LDKRawDataPart ret_var = RawBolt11Invoice_get_data(&this_ptr_conv);
68396         uint64_t ret_ref = 0;
68397         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
68398         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
68399         return ret_ref;
68400 }
68401
68402 void  __attribute__((export_name("TS_RawBolt11Invoice_set_data"))) TS_RawBolt11Invoice_set_data(uint64_t this_ptr, uint64_t val) {
68403         LDKRawBolt11Invoice this_ptr_conv;
68404         this_ptr_conv.inner = untag_ptr(this_ptr);
68405         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
68406         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
68407         this_ptr_conv.is_owned = false;
68408         LDKRawDataPart val_conv;
68409         val_conv.inner = untag_ptr(val);
68410         val_conv.is_owned = ptr_is_owned(val);
68411         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
68412         val_conv = RawDataPart_clone(&val_conv);
68413         RawBolt11Invoice_set_data(&this_ptr_conv, val_conv);
68414 }
68415
68416 jboolean  __attribute__((export_name("TS_RawBolt11Invoice_eq"))) TS_RawBolt11Invoice_eq(uint64_t a, uint64_t b) {
68417         LDKRawBolt11Invoice a_conv;
68418         a_conv.inner = untag_ptr(a);
68419         a_conv.is_owned = ptr_is_owned(a);
68420         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
68421         a_conv.is_owned = false;
68422         LDKRawBolt11Invoice b_conv;
68423         b_conv.inner = untag_ptr(b);
68424         b_conv.is_owned = ptr_is_owned(b);
68425         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
68426         b_conv.is_owned = false;
68427         jboolean ret_conv = RawBolt11Invoice_eq(&a_conv, &b_conv);
68428         return ret_conv;
68429 }
68430
68431 static inline uint64_t RawBolt11Invoice_clone_ptr(LDKRawBolt11Invoice *NONNULL_PTR arg) {
68432         LDKRawBolt11Invoice ret_var = RawBolt11Invoice_clone(arg);
68433         uint64_t ret_ref = 0;
68434         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
68435         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
68436         return ret_ref;
68437 }
68438 int64_t  __attribute__((export_name("TS_RawBolt11Invoice_clone_ptr"))) TS_RawBolt11Invoice_clone_ptr(uint64_t arg) {
68439         LDKRawBolt11Invoice arg_conv;
68440         arg_conv.inner = untag_ptr(arg);
68441         arg_conv.is_owned = ptr_is_owned(arg);
68442         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
68443         arg_conv.is_owned = false;
68444         int64_t ret_conv = RawBolt11Invoice_clone_ptr(&arg_conv);
68445         return ret_conv;
68446 }
68447
68448 uint64_t  __attribute__((export_name("TS_RawBolt11Invoice_clone"))) TS_RawBolt11Invoice_clone(uint64_t orig) {
68449         LDKRawBolt11Invoice orig_conv;
68450         orig_conv.inner = untag_ptr(orig);
68451         orig_conv.is_owned = ptr_is_owned(orig);
68452         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
68453         orig_conv.is_owned = false;
68454         LDKRawBolt11Invoice ret_var = RawBolt11Invoice_clone(&orig_conv);
68455         uint64_t ret_ref = 0;
68456         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
68457         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
68458         return ret_ref;
68459 }
68460
68461 int64_t  __attribute__((export_name("TS_RawBolt11Invoice_hash"))) TS_RawBolt11Invoice_hash(uint64_t o) {
68462         LDKRawBolt11Invoice o_conv;
68463         o_conv.inner = untag_ptr(o);
68464         o_conv.is_owned = ptr_is_owned(o);
68465         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
68466         o_conv.is_owned = false;
68467         int64_t ret_conv = RawBolt11Invoice_hash(&o_conv);
68468         return ret_conv;
68469 }
68470
68471 void  __attribute__((export_name("TS_RawDataPart_free"))) TS_RawDataPart_free(uint64_t this_obj) {
68472         LDKRawDataPart this_obj_conv;
68473         this_obj_conv.inner = untag_ptr(this_obj);
68474         this_obj_conv.is_owned = ptr_is_owned(this_obj);
68475         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
68476         RawDataPart_free(this_obj_conv);
68477 }
68478
68479 uint64_t  __attribute__((export_name("TS_RawDataPart_get_timestamp"))) TS_RawDataPart_get_timestamp(uint64_t this_ptr) {
68480         LDKRawDataPart this_ptr_conv;
68481         this_ptr_conv.inner = untag_ptr(this_ptr);
68482         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
68483         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
68484         this_ptr_conv.is_owned = false;
68485         LDKPositiveTimestamp ret_var = RawDataPart_get_timestamp(&this_ptr_conv);
68486         uint64_t ret_ref = 0;
68487         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
68488         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
68489         return ret_ref;
68490 }
68491
68492 void  __attribute__((export_name("TS_RawDataPart_set_timestamp"))) TS_RawDataPart_set_timestamp(uint64_t this_ptr, uint64_t val) {
68493         LDKRawDataPart this_ptr_conv;
68494         this_ptr_conv.inner = untag_ptr(this_ptr);
68495         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
68496         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
68497         this_ptr_conv.is_owned = false;
68498         LDKPositiveTimestamp val_conv;
68499         val_conv.inner = untag_ptr(val);
68500         val_conv.is_owned = ptr_is_owned(val);
68501         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
68502         val_conv = PositiveTimestamp_clone(&val_conv);
68503         RawDataPart_set_timestamp(&this_ptr_conv, val_conv);
68504 }
68505
68506 jboolean  __attribute__((export_name("TS_RawDataPart_eq"))) TS_RawDataPart_eq(uint64_t a, uint64_t b) {
68507         LDKRawDataPart a_conv;
68508         a_conv.inner = untag_ptr(a);
68509         a_conv.is_owned = ptr_is_owned(a);
68510         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
68511         a_conv.is_owned = false;
68512         LDKRawDataPart b_conv;
68513         b_conv.inner = untag_ptr(b);
68514         b_conv.is_owned = ptr_is_owned(b);
68515         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
68516         b_conv.is_owned = false;
68517         jboolean ret_conv = RawDataPart_eq(&a_conv, &b_conv);
68518         return ret_conv;
68519 }
68520
68521 static inline uint64_t RawDataPart_clone_ptr(LDKRawDataPart *NONNULL_PTR arg) {
68522         LDKRawDataPart ret_var = RawDataPart_clone(arg);
68523         uint64_t ret_ref = 0;
68524         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
68525         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
68526         return ret_ref;
68527 }
68528 int64_t  __attribute__((export_name("TS_RawDataPart_clone_ptr"))) TS_RawDataPart_clone_ptr(uint64_t arg) {
68529         LDKRawDataPart arg_conv;
68530         arg_conv.inner = untag_ptr(arg);
68531         arg_conv.is_owned = ptr_is_owned(arg);
68532         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
68533         arg_conv.is_owned = false;
68534         int64_t ret_conv = RawDataPart_clone_ptr(&arg_conv);
68535         return ret_conv;
68536 }
68537
68538 uint64_t  __attribute__((export_name("TS_RawDataPart_clone"))) TS_RawDataPart_clone(uint64_t orig) {
68539         LDKRawDataPart orig_conv;
68540         orig_conv.inner = untag_ptr(orig);
68541         orig_conv.is_owned = ptr_is_owned(orig);
68542         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
68543         orig_conv.is_owned = false;
68544         LDKRawDataPart ret_var = RawDataPart_clone(&orig_conv);
68545         uint64_t ret_ref = 0;
68546         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
68547         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
68548         return ret_ref;
68549 }
68550
68551 int64_t  __attribute__((export_name("TS_RawDataPart_hash"))) TS_RawDataPart_hash(uint64_t o) {
68552         LDKRawDataPart o_conv;
68553         o_conv.inner = untag_ptr(o);
68554         o_conv.is_owned = ptr_is_owned(o);
68555         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
68556         o_conv.is_owned = false;
68557         int64_t ret_conv = RawDataPart_hash(&o_conv);
68558         return ret_conv;
68559 }
68560
68561 void  __attribute__((export_name("TS_PositiveTimestamp_free"))) TS_PositiveTimestamp_free(uint64_t this_obj) {
68562         LDKPositiveTimestamp this_obj_conv;
68563         this_obj_conv.inner = untag_ptr(this_obj);
68564         this_obj_conv.is_owned = ptr_is_owned(this_obj);
68565         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
68566         PositiveTimestamp_free(this_obj_conv);
68567 }
68568
68569 jboolean  __attribute__((export_name("TS_PositiveTimestamp_eq"))) TS_PositiveTimestamp_eq(uint64_t a, uint64_t b) {
68570         LDKPositiveTimestamp a_conv;
68571         a_conv.inner = untag_ptr(a);
68572         a_conv.is_owned = ptr_is_owned(a);
68573         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
68574         a_conv.is_owned = false;
68575         LDKPositiveTimestamp b_conv;
68576         b_conv.inner = untag_ptr(b);
68577         b_conv.is_owned = ptr_is_owned(b);
68578         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
68579         b_conv.is_owned = false;
68580         jboolean ret_conv = PositiveTimestamp_eq(&a_conv, &b_conv);
68581         return ret_conv;
68582 }
68583
68584 static inline uint64_t PositiveTimestamp_clone_ptr(LDKPositiveTimestamp *NONNULL_PTR arg) {
68585         LDKPositiveTimestamp ret_var = PositiveTimestamp_clone(arg);
68586         uint64_t ret_ref = 0;
68587         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
68588         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
68589         return ret_ref;
68590 }
68591 int64_t  __attribute__((export_name("TS_PositiveTimestamp_clone_ptr"))) TS_PositiveTimestamp_clone_ptr(uint64_t arg) {
68592         LDKPositiveTimestamp arg_conv;
68593         arg_conv.inner = untag_ptr(arg);
68594         arg_conv.is_owned = ptr_is_owned(arg);
68595         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
68596         arg_conv.is_owned = false;
68597         int64_t ret_conv = PositiveTimestamp_clone_ptr(&arg_conv);
68598         return ret_conv;
68599 }
68600
68601 uint64_t  __attribute__((export_name("TS_PositiveTimestamp_clone"))) TS_PositiveTimestamp_clone(uint64_t orig) {
68602         LDKPositiveTimestamp orig_conv;
68603         orig_conv.inner = untag_ptr(orig);
68604         orig_conv.is_owned = ptr_is_owned(orig);
68605         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
68606         orig_conv.is_owned = false;
68607         LDKPositiveTimestamp ret_var = PositiveTimestamp_clone(&orig_conv);
68608         uint64_t ret_ref = 0;
68609         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
68610         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
68611         return ret_ref;
68612 }
68613
68614 int64_t  __attribute__((export_name("TS_PositiveTimestamp_hash"))) TS_PositiveTimestamp_hash(uint64_t o) {
68615         LDKPositiveTimestamp o_conv;
68616         o_conv.inner = untag_ptr(o);
68617         o_conv.is_owned = ptr_is_owned(o);
68618         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
68619         o_conv.is_owned = false;
68620         int64_t ret_conv = PositiveTimestamp_hash(&o_conv);
68621         return ret_conv;
68622 }
68623
68624 uint32_t  __attribute__((export_name("TS_SiPrefix_clone"))) TS_SiPrefix_clone(uint64_t orig) {
68625         LDKSiPrefix* orig_conv = (LDKSiPrefix*)untag_ptr(orig);
68626         uint32_t ret_conv = LDKSiPrefix_to_js(SiPrefix_clone(orig_conv));
68627         return ret_conv;
68628 }
68629
68630 uint32_t  __attribute__((export_name("TS_SiPrefix_milli"))) TS_SiPrefix_milli() {
68631         uint32_t ret_conv = LDKSiPrefix_to_js(SiPrefix_milli());
68632         return ret_conv;
68633 }
68634
68635 uint32_t  __attribute__((export_name("TS_SiPrefix_micro"))) TS_SiPrefix_micro() {
68636         uint32_t ret_conv = LDKSiPrefix_to_js(SiPrefix_micro());
68637         return ret_conv;
68638 }
68639
68640 uint32_t  __attribute__((export_name("TS_SiPrefix_nano"))) TS_SiPrefix_nano() {
68641         uint32_t ret_conv = LDKSiPrefix_to_js(SiPrefix_nano());
68642         return ret_conv;
68643 }
68644
68645 uint32_t  __attribute__((export_name("TS_SiPrefix_pico"))) TS_SiPrefix_pico() {
68646         uint32_t ret_conv = LDKSiPrefix_to_js(SiPrefix_pico());
68647         return ret_conv;
68648 }
68649
68650 jboolean  __attribute__((export_name("TS_SiPrefix_eq"))) TS_SiPrefix_eq(uint64_t a, uint64_t b) {
68651         LDKSiPrefix* a_conv = (LDKSiPrefix*)untag_ptr(a);
68652         LDKSiPrefix* b_conv = (LDKSiPrefix*)untag_ptr(b);
68653         jboolean ret_conv = SiPrefix_eq(a_conv, b_conv);
68654         return ret_conv;
68655 }
68656
68657 int64_t  __attribute__((export_name("TS_SiPrefix_hash"))) TS_SiPrefix_hash(uint64_t o) {
68658         LDKSiPrefix* o_conv = (LDKSiPrefix*)untag_ptr(o);
68659         int64_t ret_conv = SiPrefix_hash(o_conv);
68660         return ret_conv;
68661 }
68662
68663 int64_t  __attribute__((export_name("TS_SiPrefix_multiplier"))) TS_SiPrefix_multiplier(uint64_t this_arg) {
68664         LDKSiPrefix* this_arg_conv = (LDKSiPrefix*)untag_ptr(this_arg);
68665         int64_t ret_conv = SiPrefix_multiplier(this_arg_conv);
68666         return ret_conv;
68667 }
68668
68669 uint32_t  __attribute__((export_name("TS_Currency_clone"))) TS_Currency_clone(uint64_t orig) {
68670         LDKCurrency* orig_conv = (LDKCurrency*)untag_ptr(orig);
68671         uint32_t ret_conv = LDKCurrency_to_js(Currency_clone(orig_conv));
68672         return ret_conv;
68673 }
68674
68675 uint32_t  __attribute__((export_name("TS_Currency_bitcoin"))) TS_Currency_bitcoin() {
68676         uint32_t ret_conv = LDKCurrency_to_js(Currency_bitcoin());
68677         return ret_conv;
68678 }
68679
68680 uint32_t  __attribute__((export_name("TS_Currency_bitcoin_testnet"))) TS_Currency_bitcoin_testnet() {
68681         uint32_t ret_conv = LDKCurrency_to_js(Currency_bitcoin_testnet());
68682         return ret_conv;
68683 }
68684
68685 uint32_t  __attribute__((export_name("TS_Currency_regtest"))) TS_Currency_regtest() {
68686         uint32_t ret_conv = LDKCurrency_to_js(Currency_regtest());
68687         return ret_conv;
68688 }
68689
68690 uint32_t  __attribute__((export_name("TS_Currency_simnet"))) TS_Currency_simnet() {
68691         uint32_t ret_conv = LDKCurrency_to_js(Currency_simnet());
68692         return ret_conv;
68693 }
68694
68695 uint32_t  __attribute__((export_name("TS_Currency_signet"))) TS_Currency_signet() {
68696         uint32_t ret_conv = LDKCurrency_to_js(Currency_signet());
68697         return ret_conv;
68698 }
68699
68700 int64_t  __attribute__((export_name("TS_Currency_hash"))) TS_Currency_hash(uint64_t o) {
68701         LDKCurrency* o_conv = (LDKCurrency*)untag_ptr(o);
68702         int64_t ret_conv = Currency_hash(o_conv);
68703         return ret_conv;
68704 }
68705
68706 jboolean  __attribute__((export_name("TS_Currency_eq"))) TS_Currency_eq(uint64_t a, uint64_t b) {
68707         LDKCurrency* a_conv = (LDKCurrency*)untag_ptr(a);
68708         LDKCurrency* b_conv = (LDKCurrency*)untag_ptr(b);
68709         jboolean ret_conv = Currency_eq(a_conv, b_conv);
68710         return ret_conv;
68711 }
68712
68713 void  __attribute__((export_name("TS_Sha256_free"))) TS_Sha256_free(uint64_t this_obj) {
68714         LDKSha256 this_obj_conv;
68715         this_obj_conv.inner = untag_ptr(this_obj);
68716         this_obj_conv.is_owned = ptr_is_owned(this_obj);
68717         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
68718         Sha256_free(this_obj_conv);
68719 }
68720
68721 static inline uint64_t Sha256_clone_ptr(LDKSha256 *NONNULL_PTR arg) {
68722         LDKSha256 ret_var = Sha256_clone(arg);
68723         uint64_t ret_ref = 0;
68724         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
68725         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
68726         return ret_ref;
68727 }
68728 int64_t  __attribute__((export_name("TS_Sha256_clone_ptr"))) TS_Sha256_clone_ptr(uint64_t arg) {
68729         LDKSha256 arg_conv;
68730         arg_conv.inner = untag_ptr(arg);
68731         arg_conv.is_owned = ptr_is_owned(arg);
68732         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
68733         arg_conv.is_owned = false;
68734         int64_t ret_conv = Sha256_clone_ptr(&arg_conv);
68735         return ret_conv;
68736 }
68737
68738 uint64_t  __attribute__((export_name("TS_Sha256_clone"))) TS_Sha256_clone(uint64_t orig) {
68739         LDKSha256 orig_conv;
68740         orig_conv.inner = untag_ptr(orig);
68741         orig_conv.is_owned = ptr_is_owned(orig);
68742         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
68743         orig_conv.is_owned = false;
68744         LDKSha256 ret_var = Sha256_clone(&orig_conv);
68745         uint64_t ret_ref = 0;
68746         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
68747         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
68748         return ret_ref;
68749 }
68750
68751 int64_t  __attribute__((export_name("TS_Sha256_hash"))) TS_Sha256_hash(uint64_t o) {
68752         LDKSha256 o_conv;
68753         o_conv.inner = untag_ptr(o);
68754         o_conv.is_owned = ptr_is_owned(o);
68755         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
68756         o_conv.is_owned = false;
68757         int64_t ret_conv = Sha256_hash(&o_conv);
68758         return ret_conv;
68759 }
68760
68761 jboolean  __attribute__((export_name("TS_Sha256_eq"))) TS_Sha256_eq(uint64_t a, uint64_t b) {
68762         LDKSha256 a_conv;
68763         a_conv.inner = untag_ptr(a);
68764         a_conv.is_owned = ptr_is_owned(a);
68765         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
68766         a_conv.is_owned = false;
68767         LDKSha256 b_conv;
68768         b_conv.inner = untag_ptr(b);
68769         b_conv.is_owned = ptr_is_owned(b);
68770         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
68771         b_conv.is_owned = false;
68772         jboolean ret_conv = Sha256_eq(&a_conv, &b_conv);
68773         return ret_conv;
68774 }
68775
68776 uint64_t  __attribute__((export_name("TS_Sha256_from_bytes"))) TS_Sha256_from_bytes(int8_tArray bytes) {
68777         uint8_t bytes_arr[32];
68778         CHECK(bytes->arr_len == 32);
68779         memcpy(bytes_arr, bytes->elems, 32); FREE(bytes);
68780         uint8_t (*bytes_ref)[32] = &bytes_arr;
68781         LDKSha256 ret_var = Sha256_from_bytes(bytes_ref);
68782         uint64_t ret_ref = 0;
68783         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
68784         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
68785         return ret_ref;
68786 }
68787
68788 void  __attribute__((export_name("TS_Description_free"))) TS_Description_free(uint64_t this_obj) {
68789         LDKDescription this_obj_conv;
68790         this_obj_conv.inner = untag_ptr(this_obj);
68791         this_obj_conv.is_owned = ptr_is_owned(this_obj);
68792         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
68793         Description_free(this_obj_conv);
68794 }
68795
68796 static inline uint64_t Description_clone_ptr(LDKDescription *NONNULL_PTR arg) {
68797         LDKDescription ret_var = Description_clone(arg);
68798         uint64_t ret_ref = 0;
68799         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
68800         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
68801         return ret_ref;
68802 }
68803 int64_t  __attribute__((export_name("TS_Description_clone_ptr"))) TS_Description_clone_ptr(uint64_t arg) {
68804         LDKDescription arg_conv;
68805         arg_conv.inner = untag_ptr(arg);
68806         arg_conv.is_owned = ptr_is_owned(arg);
68807         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
68808         arg_conv.is_owned = false;
68809         int64_t ret_conv = Description_clone_ptr(&arg_conv);
68810         return ret_conv;
68811 }
68812
68813 uint64_t  __attribute__((export_name("TS_Description_clone"))) TS_Description_clone(uint64_t orig) {
68814         LDKDescription orig_conv;
68815         orig_conv.inner = untag_ptr(orig);
68816         orig_conv.is_owned = ptr_is_owned(orig);
68817         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
68818         orig_conv.is_owned = false;
68819         LDKDescription ret_var = Description_clone(&orig_conv);
68820         uint64_t ret_ref = 0;
68821         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
68822         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
68823         return ret_ref;
68824 }
68825
68826 int64_t  __attribute__((export_name("TS_Description_hash"))) TS_Description_hash(uint64_t o) {
68827         LDKDescription o_conv;
68828         o_conv.inner = untag_ptr(o);
68829         o_conv.is_owned = ptr_is_owned(o);
68830         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
68831         o_conv.is_owned = false;
68832         int64_t ret_conv = Description_hash(&o_conv);
68833         return ret_conv;
68834 }
68835
68836 jboolean  __attribute__((export_name("TS_Description_eq"))) TS_Description_eq(uint64_t a, uint64_t b) {
68837         LDKDescription a_conv;
68838         a_conv.inner = untag_ptr(a);
68839         a_conv.is_owned = ptr_is_owned(a);
68840         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
68841         a_conv.is_owned = false;
68842         LDKDescription b_conv;
68843         b_conv.inner = untag_ptr(b);
68844         b_conv.is_owned = ptr_is_owned(b);
68845         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
68846         b_conv.is_owned = false;
68847         jboolean ret_conv = Description_eq(&a_conv, &b_conv);
68848         return ret_conv;
68849 }
68850
68851 void  __attribute__((export_name("TS_PayeePubKey_free"))) TS_PayeePubKey_free(uint64_t this_obj) {
68852         LDKPayeePubKey this_obj_conv;
68853         this_obj_conv.inner = untag_ptr(this_obj);
68854         this_obj_conv.is_owned = ptr_is_owned(this_obj);
68855         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
68856         PayeePubKey_free(this_obj_conv);
68857 }
68858
68859 int8_tArray  __attribute__((export_name("TS_PayeePubKey_get_a"))) TS_PayeePubKey_get_a(uint64_t this_ptr) {
68860         LDKPayeePubKey this_ptr_conv;
68861         this_ptr_conv.inner = untag_ptr(this_ptr);
68862         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
68863         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
68864         this_ptr_conv.is_owned = false;
68865         int8_tArray ret_arr = init_int8_tArray(33, __LINE__);
68866         memcpy(ret_arr->elems, PayeePubKey_get_a(&this_ptr_conv).compressed_form, 33);
68867         return ret_arr;
68868 }
68869
68870 void  __attribute__((export_name("TS_PayeePubKey_set_a"))) TS_PayeePubKey_set_a(uint64_t this_ptr, int8_tArray val) {
68871         LDKPayeePubKey this_ptr_conv;
68872         this_ptr_conv.inner = untag_ptr(this_ptr);
68873         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
68874         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
68875         this_ptr_conv.is_owned = false;
68876         LDKPublicKey val_ref;
68877         CHECK(val->arr_len == 33);
68878         memcpy(val_ref.compressed_form, val->elems, 33); FREE(val);
68879         PayeePubKey_set_a(&this_ptr_conv, val_ref);
68880 }
68881
68882 uint64_t  __attribute__((export_name("TS_PayeePubKey_new"))) TS_PayeePubKey_new(int8_tArray a_arg) {
68883         LDKPublicKey a_arg_ref;
68884         CHECK(a_arg->arr_len == 33);
68885         memcpy(a_arg_ref.compressed_form, a_arg->elems, 33); FREE(a_arg);
68886         LDKPayeePubKey ret_var = PayeePubKey_new(a_arg_ref);
68887         uint64_t ret_ref = 0;
68888         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
68889         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
68890         return ret_ref;
68891 }
68892
68893 static inline uint64_t PayeePubKey_clone_ptr(LDKPayeePubKey *NONNULL_PTR arg) {
68894         LDKPayeePubKey ret_var = PayeePubKey_clone(arg);
68895         uint64_t ret_ref = 0;
68896         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
68897         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
68898         return ret_ref;
68899 }
68900 int64_t  __attribute__((export_name("TS_PayeePubKey_clone_ptr"))) TS_PayeePubKey_clone_ptr(uint64_t arg) {
68901         LDKPayeePubKey arg_conv;
68902         arg_conv.inner = untag_ptr(arg);
68903         arg_conv.is_owned = ptr_is_owned(arg);
68904         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
68905         arg_conv.is_owned = false;
68906         int64_t ret_conv = PayeePubKey_clone_ptr(&arg_conv);
68907         return ret_conv;
68908 }
68909
68910 uint64_t  __attribute__((export_name("TS_PayeePubKey_clone"))) TS_PayeePubKey_clone(uint64_t orig) {
68911         LDKPayeePubKey orig_conv;
68912         orig_conv.inner = untag_ptr(orig);
68913         orig_conv.is_owned = ptr_is_owned(orig);
68914         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
68915         orig_conv.is_owned = false;
68916         LDKPayeePubKey ret_var = PayeePubKey_clone(&orig_conv);
68917         uint64_t ret_ref = 0;
68918         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
68919         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
68920         return ret_ref;
68921 }
68922
68923 int64_t  __attribute__((export_name("TS_PayeePubKey_hash"))) TS_PayeePubKey_hash(uint64_t o) {
68924         LDKPayeePubKey o_conv;
68925         o_conv.inner = untag_ptr(o);
68926         o_conv.is_owned = ptr_is_owned(o);
68927         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
68928         o_conv.is_owned = false;
68929         int64_t ret_conv = PayeePubKey_hash(&o_conv);
68930         return ret_conv;
68931 }
68932
68933 jboolean  __attribute__((export_name("TS_PayeePubKey_eq"))) TS_PayeePubKey_eq(uint64_t a, uint64_t b) {
68934         LDKPayeePubKey a_conv;
68935         a_conv.inner = untag_ptr(a);
68936         a_conv.is_owned = ptr_is_owned(a);
68937         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
68938         a_conv.is_owned = false;
68939         LDKPayeePubKey b_conv;
68940         b_conv.inner = untag_ptr(b);
68941         b_conv.is_owned = ptr_is_owned(b);
68942         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
68943         b_conv.is_owned = false;
68944         jboolean ret_conv = PayeePubKey_eq(&a_conv, &b_conv);
68945         return ret_conv;
68946 }
68947
68948 void  __attribute__((export_name("TS_ExpiryTime_free"))) TS_ExpiryTime_free(uint64_t this_obj) {
68949         LDKExpiryTime this_obj_conv;
68950         this_obj_conv.inner = untag_ptr(this_obj);
68951         this_obj_conv.is_owned = ptr_is_owned(this_obj);
68952         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
68953         ExpiryTime_free(this_obj_conv);
68954 }
68955
68956 static inline uint64_t ExpiryTime_clone_ptr(LDKExpiryTime *NONNULL_PTR arg) {
68957         LDKExpiryTime ret_var = ExpiryTime_clone(arg);
68958         uint64_t ret_ref = 0;
68959         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
68960         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
68961         return ret_ref;
68962 }
68963 int64_t  __attribute__((export_name("TS_ExpiryTime_clone_ptr"))) TS_ExpiryTime_clone_ptr(uint64_t arg) {
68964         LDKExpiryTime arg_conv;
68965         arg_conv.inner = untag_ptr(arg);
68966         arg_conv.is_owned = ptr_is_owned(arg);
68967         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
68968         arg_conv.is_owned = false;
68969         int64_t ret_conv = ExpiryTime_clone_ptr(&arg_conv);
68970         return ret_conv;
68971 }
68972
68973 uint64_t  __attribute__((export_name("TS_ExpiryTime_clone"))) TS_ExpiryTime_clone(uint64_t orig) {
68974         LDKExpiryTime orig_conv;
68975         orig_conv.inner = untag_ptr(orig);
68976         orig_conv.is_owned = ptr_is_owned(orig);
68977         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
68978         orig_conv.is_owned = false;
68979         LDKExpiryTime ret_var = ExpiryTime_clone(&orig_conv);
68980         uint64_t ret_ref = 0;
68981         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
68982         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
68983         return ret_ref;
68984 }
68985
68986 int64_t  __attribute__((export_name("TS_ExpiryTime_hash"))) TS_ExpiryTime_hash(uint64_t o) {
68987         LDKExpiryTime o_conv;
68988         o_conv.inner = untag_ptr(o);
68989         o_conv.is_owned = ptr_is_owned(o);
68990         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
68991         o_conv.is_owned = false;
68992         int64_t ret_conv = ExpiryTime_hash(&o_conv);
68993         return ret_conv;
68994 }
68995
68996 jboolean  __attribute__((export_name("TS_ExpiryTime_eq"))) TS_ExpiryTime_eq(uint64_t a, uint64_t b) {
68997         LDKExpiryTime a_conv;
68998         a_conv.inner = untag_ptr(a);
68999         a_conv.is_owned = ptr_is_owned(a);
69000         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
69001         a_conv.is_owned = false;
69002         LDKExpiryTime b_conv;
69003         b_conv.inner = untag_ptr(b);
69004         b_conv.is_owned = ptr_is_owned(b);
69005         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
69006         b_conv.is_owned = false;
69007         jboolean ret_conv = ExpiryTime_eq(&a_conv, &b_conv);
69008         return ret_conv;
69009 }
69010
69011 void  __attribute__((export_name("TS_MinFinalCltvExpiryDelta_free"))) TS_MinFinalCltvExpiryDelta_free(uint64_t this_obj) {
69012         LDKMinFinalCltvExpiryDelta this_obj_conv;
69013         this_obj_conv.inner = untag_ptr(this_obj);
69014         this_obj_conv.is_owned = ptr_is_owned(this_obj);
69015         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
69016         MinFinalCltvExpiryDelta_free(this_obj_conv);
69017 }
69018
69019 int64_t  __attribute__((export_name("TS_MinFinalCltvExpiryDelta_get_a"))) TS_MinFinalCltvExpiryDelta_get_a(uint64_t this_ptr) {
69020         LDKMinFinalCltvExpiryDelta this_ptr_conv;
69021         this_ptr_conv.inner = untag_ptr(this_ptr);
69022         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
69023         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
69024         this_ptr_conv.is_owned = false;
69025         int64_t ret_conv = MinFinalCltvExpiryDelta_get_a(&this_ptr_conv);
69026         return ret_conv;
69027 }
69028
69029 void  __attribute__((export_name("TS_MinFinalCltvExpiryDelta_set_a"))) TS_MinFinalCltvExpiryDelta_set_a(uint64_t this_ptr, int64_t val) {
69030         LDKMinFinalCltvExpiryDelta this_ptr_conv;
69031         this_ptr_conv.inner = untag_ptr(this_ptr);
69032         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
69033         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
69034         this_ptr_conv.is_owned = false;
69035         MinFinalCltvExpiryDelta_set_a(&this_ptr_conv, val);
69036 }
69037
69038 uint64_t  __attribute__((export_name("TS_MinFinalCltvExpiryDelta_new"))) TS_MinFinalCltvExpiryDelta_new(int64_t a_arg) {
69039         LDKMinFinalCltvExpiryDelta ret_var = MinFinalCltvExpiryDelta_new(a_arg);
69040         uint64_t ret_ref = 0;
69041         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
69042         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
69043         return ret_ref;
69044 }
69045
69046 static inline uint64_t MinFinalCltvExpiryDelta_clone_ptr(LDKMinFinalCltvExpiryDelta *NONNULL_PTR arg) {
69047         LDKMinFinalCltvExpiryDelta ret_var = MinFinalCltvExpiryDelta_clone(arg);
69048         uint64_t ret_ref = 0;
69049         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
69050         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
69051         return ret_ref;
69052 }
69053 int64_t  __attribute__((export_name("TS_MinFinalCltvExpiryDelta_clone_ptr"))) TS_MinFinalCltvExpiryDelta_clone_ptr(uint64_t arg) {
69054         LDKMinFinalCltvExpiryDelta arg_conv;
69055         arg_conv.inner = untag_ptr(arg);
69056         arg_conv.is_owned = ptr_is_owned(arg);
69057         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
69058         arg_conv.is_owned = false;
69059         int64_t ret_conv = MinFinalCltvExpiryDelta_clone_ptr(&arg_conv);
69060         return ret_conv;
69061 }
69062
69063 uint64_t  __attribute__((export_name("TS_MinFinalCltvExpiryDelta_clone"))) TS_MinFinalCltvExpiryDelta_clone(uint64_t orig) {
69064         LDKMinFinalCltvExpiryDelta orig_conv;
69065         orig_conv.inner = untag_ptr(orig);
69066         orig_conv.is_owned = ptr_is_owned(orig);
69067         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
69068         orig_conv.is_owned = false;
69069         LDKMinFinalCltvExpiryDelta ret_var = MinFinalCltvExpiryDelta_clone(&orig_conv);
69070         uint64_t ret_ref = 0;
69071         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
69072         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
69073         return ret_ref;
69074 }
69075
69076 int64_t  __attribute__((export_name("TS_MinFinalCltvExpiryDelta_hash"))) TS_MinFinalCltvExpiryDelta_hash(uint64_t o) {
69077         LDKMinFinalCltvExpiryDelta o_conv;
69078         o_conv.inner = untag_ptr(o);
69079         o_conv.is_owned = ptr_is_owned(o);
69080         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
69081         o_conv.is_owned = false;
69082         int64_t ret_conv = MinFinalCltvExpiryDelta_hash(&o_conv);
69083         return ret_conv;
69084 }
69085
69086 jboolean  __attribute__((export_name("TS_MinFinalCltvExpiryDelta_eq"))) TS_MinFinalCltvExpiryDelta_eq(uint64_t a, uint64_t b) {
69087         LDKMinFinalCltvExpiryDelta a_conv;
69088         a_conv.inner = untag_ptr(a);
69089         a_conv.is_owned = ptr_is_owned(a);
69090         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
69091         a_conv.is_owned = false;
69092         LDKMinFinalCltvExpiryDelta b_conv;
69093         b_conv.inner = untag_ptr(b);
69094         b_conv.is_owned = ptr_is_owned(b);
69095         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
69096         b_conv.is_owned = false;
69097         jboolean ret_conv = MinFinalCltvExpiryDelta_eq(&a_conv, &b_conv);
69098         return ret_conv;
69099 }
69100
69101 void  __attribute__((export_name("TS_Fallback_free"))) TS_Fallback_free(uint64_t this_ptr) {
69102         if (!ptr_is_owned(this_ptr)) return;
69103         void* this_ptr_ptr = untag_ptr(this_ptr);
69104         CHECK_ACCESS(this_ptr_ptr);
69105         LDKFallback this_ptr_conv = *(LDKFallback*)(this_ptr_ptr);
69106         FREE(untag_ptr(this_ptr));
69107         Fallback_free(this_ptr_conv);
69108 }
69109
69110 static inline uint64_t Fallback_clone_ptr(LDKFallback *NONNULL_PTR arg) {
69111         LDKFallback *ret_copy = MALLOC(sizeof(LDKFallback), "LDKFallback");
69112         *ret_copy = Fallback_clone(arg);
69113         uint64_t ret_ref = tag_ptr(ret_copy, true);
69114         return ret_ref;
69115 }
69116 int64_t  __attribute__((export_name("TS_Fallback_clone_ptr"))) TS_Fallback_clone_ptr(uint64_t arg) {
69117         LDKFallback* arg_conv = (LDKFallback*)untag_ptr(arg);
69118         int64_t ret_conv = Fallback_clone_ptr(arg_conv);
69119         return ret_conv;
69120 }
69121
69122 uint64_t  __attribute__((export_name("TS_Fallback_clone"))) TS_Fallback_clone(uint64_t orig) {
69123         LDKFallback* orig_conv = (LDKFallback*)untag_ptr(orig);
69124         LDKFallback *ret_copy = MALLOC(sizeof(LDKFallback), "LDKFallback");
69125         *ret_copy = Fallback_clone(orig_conv);
69126         uint64_t ret_ref = tag_ptr(ret_copy, true);
69127         return ret_ref;
69128 }
69129
69130 uint64_t  __attribute__((export_name("TS_Fallback_seg_wit_program"))) TS_Fallback_seg_wit_program(int8_t version, int8_tArray program) {
69131         
69132         LDKCVec_u8Z program_ref;
69133         program_ref.datalen = program->arr_len;
69134         program_ref.data = MALLOC(program_ref.datalen, "LDKCVec_u8Z Bytes");
69135         memcpy(program_ref.data, program->elems, program_ref.datalen); FREE(program);
69136         LDKFallback *ret_copy = MALLOC(sizeof(LDKFallback), "LDKFallback");
69137         *ret_copy = Fallback_seg_wit_program((LDKWitnessVersion){ ._0 = version }, program_ref);
69138         uint64_t ret_ref = tag_ptr(ret_copy, true);
69139         return ret_ref;
69140 }
69141
69142 uint64_t  __attribute__((export_name("TS_Fallback_pub_key_hash"))) TS_Fallback_pub_key_hash(int8_tArray a) {
69143         LDKTwentyBytes a_ref;
69144         CHECK(a->arr_len == 20);
69145         memcpy(a_ref.data, a->elems, 20); FREE(a);
69146         LDKFallback *ret_copy = MALLOC(sizeof(LDKFallback), "LDKFallback");
69147         *ret_copy = Fallback_pub_key_hash(a_ref);
69148         uint64_t ret_ref = tag_ptr(ret_copy, true);
69149         return ret_ref;
69150 }
69151
69152 uint64_t  __attribute__((export_name("TS_Fallback_script_hash"))) TS_Fallback_script_hash(int8_tArray a) {
69153         LDKTwentyBytes a_ref;
69154         CHECK(a->arr_len == 20);
69155         memcpy(a_ref.data, a->elems, 20); FREE(a);
69156         LDKFallback *ret_copy = MALLOC(sizeof(LDKFallback), "LDKFallback");
69157         *ret_copy = Fallback_script_hash(a_ref);
69158         uint64_t ret_ref = tag_ptr(ret_copy, true);
69159         return ret_ref;
69160 }
69161
69162 int64_t  __attribute__((export_name("TS_Fallback_hash"))) TS_Fallback_hash(uint64_t o) {
69163         LDKFallback* o_conv = (LDKFallback*)untag_ptr(o);
69164         int64_t ret_conv = Fallback_hash(o_conv);
69165         return ret_conv;
69166 }
69167
69168 jboolean  __attribute__((export_name("TS_Fallback_eq"))) TS_Fallback_eq(uint64_t a, uint64_t b) {
69169         LDKFallback* a_conv = (LDKFallback*)untag_ptr(a);
69170         LDKFallback* b_conv = (LDKFallback*)untag_ptr(b);
69171         jboolean ret_conv = Fallback_eq(a_conv, b_conv);
69172         return ret_conv;
69173 }
69174
69175 void  __attribute__((export_name("TS_Bolt11InvoiceSignature_free"))) TS_Bolt11InvoiceSignature_free(uint64_t this_obj) {
69176         LDKBolt11InvoiceSignature this_obj_conv;
69177         this_obj_conv.inner = untag_ptr(this_obj);
69178         this_obj_conv.is_owned = ptr_is_owned(this_obj);
69179         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
69180         Bolt11InvoiceSignature_free(this_obj_conv);
69181 }
69182
69183 static inline uint64_t Bolt11InvoiceSignature_clone_ptr(LDKBolt11InvoiceSignature *NONNULL_PTR arg) {
69184         LDKBolt11InvoiceSignature ret_var = Bolt11InvoiceSignature_clone(arg);
69185         uint64_t ret_ref = 0;
69186         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
69187         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
69188         return ret_ref;
69189 }
69190 int64_t  __attribute__((export_name("TS_Bolt11InvoiceSignature_clone_ptr"))) TS_Bolt11InvoiceSignature_clone_ptr(uint64_t arg) {
69191         LDKBolt11InvoiceSignature arg_conv;
69192         arg_conv.inner = untag_ptr(arg);
69193         arg_conv.is_owned = ptr_is_owned(arg);
69194         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
69195         arg_conv.is_owned = false;
69196         int64_t ret_conv = Bolt11InvoiceSignature_clone_ptr(&arg_conv);
69197         return ret_conv;
69198 }
69199
69200 uint64_t  __attribute__((export_name("TS_Bolt11InvoiceSignature_clone"))) TS_Bolt11InvoiceSignature_clone(uint64_t orig) {
69201         LDKBolt11InvoiceSignature orig_conv;
69202         orig_conv.inner = untag_ptr(orig);
69203         orig_conv.is_owned = ptr_is_owned(orig);
69204         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
69205         orig_conv.is_owned = false;
69206         LDKBolt11InvoiceSignature ret_var = Bolt11InvoiceSignature_clone(&orig_conv);
69207         uint64_t ret_ref = 0;
69208         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
69209         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
69210         return ret_ref;
69211 }
69212
69213 int64_t  __attribute__((export_name("TS_Bolt11InvoiceSignature_hash"))) TS_Bolt11InvoiceSignature_hash(uint64_t o) {
69214         LDKBolt11InvoiceSignature o_conv;
69215         o_conv.inner = untag_ptr(o);
69216         o_conv.is_owned = ptr_is_owned(o);
69217         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
69218         o_conv.is_owned = false;
69219         int64_t ret_conv = Bolt11InvoiceSignature_hash(&o_conv);
69220         return ret_conv;
69221 }
69222
69223 jboolean  __attribute__((export_name("TS_Bolt11InvoiceSignature_eq"))) TS_Bolt11InvoiceSignature_eq(uint64_t a, uint64_t b) {
69224         LDKBolt11InvoiceSignature a_conv;
69225         a_conv.inner = untag_ptr(a);
69226         a_conv.is_owned = ptr_is_owned(a);
69227         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
69228         a_conv.is_owned = false;
69229         LDKBolt11InvoiceSignature b_conv;
69230         b_conv.inner = untag_ptr(b);
69231         b_conv.is_owned = ptr_is_owned(b);
69232         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
69233         b_conv.is_owned = false;
69234         jboolean ret_conv = Bolt11InvoiceSignature_eq(&a_conv, &b_conv);
69235         return ret_conv;
69236 }
69237
69238 void  __attribute__((export_name("TS_PrivateRoute_free"))) TS_PrivateRoute_free(uint64_t this_obj) {
69239         LDKPrivateRoute this_obj_conv;
69240         this_obj_conv.inner = untag_ptr(this_obj);
69241         this_obj_conv.is_owned = ptr_is_owned(this_obj);
69242         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
69243         PrivateRoute_free(this_obj_conv);
69244 }
69245
69246 static inline uint64_t PrivateRoute_clone_ptr(LDKPrivateRoute *NONNULL_PTR arg) {
69247         LDKPrivateRoute ret_var = PrivateRoute_clone(arg);
69248         uint64_t ret_ref = 0;
69249         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
69250         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
69251         return ret_ref;
69252 }
69253 int64_t  __attribute__((export_name("TS_PrivateRoute_clone_ptr"))) TS_PrivateRoute_clone_ptr(uint64_t arg) {
69254         LDKPrivateRoute arg_conv;
69255         arg_conv.inner = untag_ptr(arg);
69256         arg_conv.is_owned = ptr_is_owned(arg);
69257         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
69258         arg_conv.is_owned = false;
69259         int64_t ret_conv = PrivateRoute_clone_ptr(&arg_conv);
69260         return ret_conv;
69261 }
69262
69263 uint64_t  __attribute__((export_name("TS_PrivateRoute_clone"))) TS_PrivateRoute_clone(uint64_t orig) {
69264         LDKPrivateRoute orig_conv;
69265         orig_conv.inner = untag_ptr(orig);
69266         orig_conv.is_owned = ptr_is_owned(orig);
69267         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
69268         orig_conv.is_owned = false;
69269         LDKPrivateRoute ret_var = PrivateRoute_clone(&orig_conv);
69270         uint64_t ret_ref = 0;
69271         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
69272         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
69273         return ret_ref;
69274 }
69275
69276 int64_t  __attribute__((export_name("TS_PrivateRoute_hash"))) TS_PrivateRoute_hash(uint64_t o) {
69277         LDKPrivateRoute o_conv;
69278         o_conv.inner = untag_ptr(o);
69279         o_conv.is_owned = ptr_is_owned(o);
69280         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
69281         o_conv.is_owned = false;
69282         int64_t ret_conv = PrivateRoute_hash(&o_conv);
69283         return ret_conv;
69284 }
69285
69286 jboolean  __attribute__((export_name("TS_PrivateRoute_eq"))) TS_PrivateRoute_eq(uint64_t a, uint64_t b) {
69287         LDKPrivateRoute a_conv;
69288         a_conv.inner = untag_ptr(a);
69289         a_conv.is_owned = ptr_is_owned(a);
69290         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
69291         a_conv.is_owned = false;
69292         LDKPrivateRoute b_conv;
69293         b_conv.inner = untag_ptr(b);
69294         b_conv.is_owned = ptr_is_owned(b);
69295         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
69296         b_conv.is_owned = false;
69297         jboolean ret_conv = PrivateRoute_eq(&a_conv, &b_conv);
69298         return ret_conv;
69299 }
69300
69301 uint64_t  __attribute__((export_name("TS_SignedRawBolt11Invoice_into_parts"))) TS_SignedRawBolt11Invoice_into_parts(uint64_t this_arg) {
69302         LDKSignedRawBolt11Invoice this_arg_conv;
69303         this_arg_conv.inner = untag_ptr(this_arg);
69304         this_arg_conv.is_owned = ptr_is_owned(this_arg);
69305         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
69306         this_arg_conv = SignedRawBolt11Invoice_clone(&this_arg_conv);
69307         LDKC3Tuple_RawBolt11Invoice_u832Bolt11InvoiceSignatureZ* ret_conv = MALLOC(sizeof(LDKC3Tuple_RawBolt11Invoice_u832Bolt11InvoiceSignatureZ), "LDKC3Tuple_RawBolt11Invoice_u832Bolt11InvoiceSignatureZ");
69308         *ret_conv = SignedRawBolt11Invoice_into_parts(this_arg_conv);
69309         return tag_ptr(ret_conv, true);
69310 }
69311
69312 uint64_t  __attribute__((export_name("TS_SignedRawBolt11Invoice_raw_invoice"))) TS_SignedRawBolt11Invoice_raw_invoice(uint64_t this_arg) {
69313         LDKSignedRawBolt11Invoice this_arg_conv;
69314         this_arg_conv.inner = untag_ptr(this_arg);
69315         this_arg_conv.is_owned = ptr_is_owned(this_arg);
69316         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
69317         this_arg_conv.is_owned = false;
69318         LDKRawBolt11Invoice ret_var = SignedRawBolt11Invoice_raw_invoice(&this_arg_conv);
69319         uint64_t ret_ref = 0;
69320         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
69321         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
69322         return ret_ref;
69323 }
69324
69325 int8_tArray  __attribute__((export_name("TS_SignedRawBolt11Invoice_signable_hash"))) TS_SignedRawBolt11Invoice_signable_hash(uint64_t this_arg) {
69326         LDKSignedRawBolt11Invoice this_arg_conv;
69327         this_arg_conv.inner = untag_ptr(this_arg);
69328         this_arg_conv.is_owned = ptr_is_owned(this_arg);
69329         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
69330         this_arg_conv.is_owned = false;
69331         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
69332         memcpy(ret_arr->elems, *SignedRawBolt11Invoice_signable_hash(&this_arg_conv), 32);
69333         return ret_arr;
69334 }
69335
69336 uint64_t  __attribute__((export_name("TS_SignedRawBolt11Invoice_signature"))) TS_SignedRawBolt11Invoice_signature(uint64_t this_arg) {
69337         LDKSignedRawBolt11Invoice this_arg_conv;
69338         this_arg_conv.inner = untag_ptr(this_arg);
69339         this_arg_conv.is_owned = ptr_is_owned(this_arg);
69340         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
69341         this_arg_conv.is_owned = false;
69342         LDKBolt11InvoiceSignature ret_var = SignedRawBolt11Invoice_signature(&this_arg_conv);
69343         uint64_t ret_ref = 0;
69344         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
69345         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
69346         return ret_ref;
69347 }
69348
69349 uint64_t  __attribute__((export_name("TS_SignedRawBolt11Invoice_recover_payee_pub_key"))) TS_SignedRawBolt11Invoice_recover_payee_pub_key(uint64_t this_arg) {
69350         LDKSignedRawBolt11Invoice this_arg_conv;
69351         this_arg_conv.inner = untag_ptr(this_arg);
69352         this_arg_conv.is_owned = ptr_is_owned(this_arg);
69353         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
69354         this_arg_conv.is_owned = false;
69355         LDKCResult_PayeePubKeySecp256k1ErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PayeePubKeySecp256k1ErrorZ), "LDKCResult_PayeePubKeySecp256k1ErrorZ");
69356         *ret_conv = SignedRawBolt11Invoice_recover_payee_pub_key(&this_arg_conv);
69357         return tag_ptr(ret_conv, true);
69358 }
69359
69360 jboolean  __attribute__((export_name("TS_SignedRawBolt11Invoice_check_signature"))) TS_SignedRawBolt11Invoice_check_signature(uint64_t this_arg) {
69361         LDKSignedRawBolt11Invoice this_arg_conv;
69362         this_arg_conv.inner = untag_ptr(this_arg);
69363         this_arg_conv.is_owned = ptr_is_owned(this_arg);
69364         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
69365         this_arg_conv.is_owned = false;
69366         jboolean ret_conv = SignedRawBolt11Invoice_check_signature(&this_arg_conv);
69367         return ret_conv;
69368 }
69369
69370 int8_tArray  __attribute__((export_name("TS_RawBolt11Invoice_signable_hash"))) TS_RawBolt11Invoice_signable_hash(uint64_t this_arg) {
69371         LDKRawBolt11Invoice this_arg_conv;
69372         this_arg_conv.inner = untag_ptr(this_arg);
69373         this_arg_conv.is_owned = ptr_is_owned(this_arg);
69374         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
69375         this_arg_conv.is_owned = false;
69376         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
69377         memcpy(ret_arr->elems, RawBolt11Invoice_signable_hash(&this_arg_conv).data, 32);
69378         return ret_arr;
69379 }
69380
69381 uint64_t  __attribute__((export_name("TS_RawBolt11Invoice_payment_hash"))) TS_RawBolt11Invoice_payment_hash(uint64_t this_arg) {
69382         LDKRawBolt11Invoice this_arg_conv;
69383         this_arg_conv.inner = untag_ptr(this_arg);
69384         this_arg_conv.is_owned = ptr_is_owned(this_arg);
69385         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
69386         this_arg_conv.is_owned = false;
69387         LDKSha256 ret_var = RawBolt11Invoice_payment_hash(&this_arg_conv);
69388         uint64_t ret_ref = 0;
69389         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
69390         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
69391         return ret_ref;
69392 }
69393
69394 uint64_t  __attribute__((export_name("TS_RawBolt11Invoice_description"))) TS_RawBolt11Invoice_description(uint64_t this_arg) {
69395         LDKRawBolt11Invoice this_arg_conv;
69396         this_arg_conv.inner = untag_ptr(this_arg);
69397         this_arg_conv.is_owned = ptr_is_owned(this_arg);
69398         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
69399         this_arg_conv.is_owned = false;
69400         LDKDescription ret_var = RawBolt11Invoice_description(&this_arg_conv);
69401         uint64_t ret_ref = 0;
69402         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
69403         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
69404         return ret_ref;
69405 }
69406
69407 uint64_t  __attribute__((export_name("TS_RawBolt11Invoice_payee_pub_key"))) TS_RawBolt11Invoice_payee_pub_key(uint64_t this_arg) {
69408         LDKRawBolt11Invoice this_arg_conv;
69409         this_arg_conv.inner = untag_ptr(this_arg);
69410         this_arg_conv.is_owned = ptr_is_owned(this_arg);
69411         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
69412         this_arg_conv.is_owned = false;
69413         LDKPayeePubKey ret_var = RawBolt11Invoice_payee_pub_key(&this_arg_conv);
69414         uint64_t ret_ref = 0;
69415         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
69416         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
69417         return ret_ref;
69418 }
69419
69420 uint64_t  __attribute__((export_name("TS_RawBolt11Invoice_description_hash"))) TS_RawBolt11Invoice_description_hash(uint64_t this_arg) {
69421         LDKRawBolt11Invoice this_arg_conv;
69422         this_arg_conv.inner = untag_ptr(this_arg);
69423         this_arg_conv.is_owned = ptr_is_owned(this_arg);
69424         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
69425         this_arg_conv.is_owned = false;
69426         LDKSha256 ret_var = RawBolt11Invoice_description_hash(&this_arg_conv);
69427         uint64_t ret_ref = 0;
69428         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
69429         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
69430         return ret_ref;
69431 }
69432
69433 uint64_t  __attribute__((export_name("TS_RawBolt11Invoice_expiry_time"))) TS_RawBolt11Invoice_expiry_time(uint64_t this_arg) {
69434         LDKRawBolt11Invoice this_arg_conv;
69435         this_arg_conv.inner = untag_ptr(this_arg);
69436         this_arg_conv.is_owned = ptr_is_owned(this_arg);
69437         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
69438         this_arg_conv.is_owned = false;
69439         LDKExpiryTime ret_var = RawBolt11Invoice_expiry_time(&this_arg_conv);
69440         uint64_t ret_ref = 0;
69441         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
69442         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
69443         return ret_ref;
69444 }
69445
69446 uint64_t  __attribute__((export_name("TS_RawBolt11Invoice_min_final_cltv_expiry_delta"))) TS_RawBolt11Invoice_min_final_cltv_expiry_delta(uint64_t this_arg) {
69447         LDKRawBolt11Invoice this_arg_conv;
69448         this_arg_conv.inner = untag_ptr(this_arg);
69449         this_arg_conv.is_owned = ptr_is_owned(this_arg);
69450         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
69451         this_arg_conv.is_owned = false;
69452         LDKMinFinalCltvExpiryDelta ret_var = RawBolt11Invoice_min_final_cltv_expiry_delta(&this_arg_conv);
69453         uint64_t ret_ref = 0;
69454         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
69455         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
69456         return ret_ref;
69457 }
69458
69459 uint64_t  __attribute__((export_name("TS_RawBolt11Invoice_payment_secret"))) TS_RawBolt11Invoice_payment_secret(uint64_t this_arg) {
69460         LDKRawBolt11Invoice this_arg_conv;
69461         this_arg_conv.inner = untag_ptr(this_arg);
69462         this_arg_conv.is_owned = ptr_is_owned(this_arg);
69463         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
69464         this_arg_conv.is_owned = false;
69465         LDKCOption_ThirtyTwoBytesZ *ret_copy = MALLOC(sizeof(LDKCOption_ThirtyTwoBytesZ), "LDKCOption_ThirtyTwoBytesZ");
69466         *ret_copy = RawBolt11Invoice_payment_secret(&this_arg_conv);
69467         uint64_t ret_ref = tag_ptr(ret_copy, true);
69468         return ret_ref;
69469 }
69470
69471 uint64_t  __attribute__((export_name("TS_RawBolt11Invoice_payment_metadata"))) TS_RawBolt11Invoice_payment_metadata(uint64_t this_arg) {
69472         LDKRawBolt11Invoice this_arg_conv;
69473         this_arg_conv.inner = untag_ptr(this_arg);
69474         this_arg_conv.is_owned = ptr_is_owned(this_arg);
69475         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
69476         this_arg_conv.is_owned = false;
69477         LDKCOption_CVec_u8ZZ *ret_copy = MALLOC(sizeof(LDKCOption_CVec_u8ZZ), "LDKCOption_CVec_u8ZZ");
69478         *ret_copy = RawBolt11Invoice_payment_metadata(&this_arg_conv);
69479         uint64_t ret_ref = tag_ptr(ret_copy, true);
69480         return ret_ref;
69481 }
69482
69483 uint64_t  __attribute__((export_name("TS_RawBolt11Invoice_features"))) TS_RawBolt11Invoice_features(uint64_t this_arg) {
69484         LDKRawBolt11Invoice this_arg_conv;
69485         this_arg_conv.inner = untag_ptr(this_arg);
69486         this_arg_conv.is_owned = ptr_is_owned(this_arg);
69487         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
69488         this_arg_conv.is_owned = false;
69489         LDKBolt11InvoiceFeatures ret_var = RawBolt11Invoice_features(&this_arg_conv);
69490         uint64_t ret_ref = 0;
69491         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
69492         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
69493         return ret_ref;
69494 }
69495
69496 uint64_tArray  __attribute__((export_name("TS_RawBolt11Invoice_private_routes"))) TS_RawBolt11Invoice_private_routes(uint64_t this_arg) {
69497         LDKRawBolt11Invoice this_arg_conv;
69498         this_arg_conv.inner = untag_ptr(this_arg);
69499         this_arg_conv.is_owned = ptr_is_owned(this_arg);
69500         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
69501         this_arg_conv.is_owned = false;
69502         LDKCVec_PrivateRouteZ ret_var = RawBolt11Invoice_private_routes(&this_arg_conv);
69503         uint64_tArray ret_arr = NULL;
69504         ret_arr = init_uint64_tArray(ret_var.datalen, __LINE__);
69505         uint64_t *ret_arr_ptr = (uint64_t*)(((uint8_t*)ret_arr) + 8);
69506         for (size_t o = 0; o < ret_var.datalen; o++) {
69507                 LDKPrivateRoute ret_conv_14_var = ret_var.data[o];
69508                 uint64_t ret_conv_14_ref = 0;
69509                 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_conv_14_var);
69510                 ret_conv_14_ref = tag_ptr(ret_conv_14_var.inner, ret_conv_14_var.is_owned);
69511                 ret_arr_ptr[o] = ret_conv_14_ref;
69512         }
69513         
69514         FREE(ret_var.data);
69515         return ret_arr;
69516 }
69517
69518 uint64_t  __attribute__((export_name("TS_RawBolt11Invoice_amount_pico_btc"))) TS_RawBolt11Invoice_amount_pico_btc(uint64_t this_arg) {
69519         LDKRawBolt11Invoice this_arg_conv;
69520         this_arg_conv.inner = untag_ptr(this_arg);
69521         this_arg_conv.is_owned = ptr_is_owned(this_arg);
69522         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
69523         this_arg_conv.is_owned = false;
69524         LDKCOption_u64Z *ret_copy = MALLOC(sizeof(LDKCOption_u64Z), "LDKCOption_u64Z");
69525         *ret_copy = RawBolt11Invoice_amount_pico_btc(&this_arg_conv);
69526         uint64_t ret_ref = tag_ptr(ret_copy, true);
69527         return ret_ref;
69528 }
69529
69530 uint32_t  __attribute__((export_name("TS_RawBolt11Invoice_currency"))) TS_RawBolt11Invoice_currency(uint64_t this_arg) {
69531         LDKRawBolt11Invoice this_arg_conv;
69532         this_arg_conv.inner = untag_ptr(this_arg);
69533         this_arg_conv.is_owned = ptr_is_owned(this_arg);
69534         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
69535         this_arg_conv.is_owned = false;
69536         uint32_t ret_conv = LDKCurrency_to_js(RawBolt11Invoice_currency(&this_arg_conv));
69537         return ret_conv;
69538 }
69539
69540 uint64_t  __attribute__((export_name("TS_PositiveTimestamp_from_unix_timestamp"))) TS_PositiveTimestamp_from_unix_timestamp(int64_t unix_seconds) {
69541         LDKCResult_PositiveTimestampCreationErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PositiveTimestampCreationErrorZ), "LDKCResult_PositiveTimestampCreationErrorZ");
69542         *ret_conv = PositiveTimestamp_from_unix_timestamp(unix_seconds);
69543         return tag_ptr(ret_conv, true);
69544 }
69545
69546 uint64_t  __attribute__((export_name("TS_PositiveTimestamp_from_duration_since_epoch"))) TS_PositiveTimestamp_from_duration_since_epoch(int64_t duration) {
69547         LDKCResult_PositiveTimestampCreationErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PositiveTimestampCreationErrorZ), "LDKCResult_PositiveTimestampCreationErrorZ");
69548         *ret_conv = PositiveTimestamp_from_duration_since_epoch(duration);
69549         return tag_ptr(ret_conv, true);
69550 }
69551
69552 int64_t  __attribute__((export_name("TS_PositiveTimestamp_as_unix_timestamp"))) TS_PositiveTimestamp_as_unix_timestamp(uint64_t this_arg) {
69553         LDKPositiveTimestamp this_arg_conv;
69554         this_arg_conv.inner = untag_ptr(this_arg);
69555         this_arg_conv.is_owned = ptr_is_owned(this_arg);
69556         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
69557         this_arg_conv.is_owned = false;
69558         int64_t ret_conv = PositiveTimestamp_as_unix_timestamp(&this_arg_conv);
69559         return ret_conv;
69560 }
69561
69562 int64_t  __attribute__((export_name("TS_PositiveTimestamp_as_duration_since_epoch"))) TS_PositiveTimestamp_as_duration_since_epoch(uint64_t this_arg) {
69563         LDKPositiveTimestamp this_arg_conv;
69564         this_arg_conv.inner = untag_ptr(this_arg);
69565         this_arg_conv.is_owned = ptr_is_owned(this_arg);
69566         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
69567         this_arg_conv.is_owned = false;
69568         int64_t ret_conv = PositiveTimestamp_as_duration_since_epoch(&this_arg_conv);
69569         return ret_conv;
69570 }
69571
69572 int8_tArray  __attribute__((export_name("TS_Bolt11Invoice_signable_hash"))) TS_Bolt11Invoice_signable_hash(uint64_t this_arg) {
69573         LDKBolt11Invoice this_arg_conv;
69574         this_arg_conv.inner = untag_ptr(this_arg);
69575         this_arg_conv.is_owned = ptr_is_owned(this_arg);
69576         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
69577         this_arg_conv.is_owned = false;
69578         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
69579         memcpy(ret_arr->elems, Bolt11Invoice_signable_hash(&this_arg_conv).data, 32);
69580         return ret_arr;
69581 }
69582
69583 uint64_t  __attribute__((export_name("TS_Bolt11Invoice_into_signed_raw"))) TS_Bolt11Invoice_into_signed_raw(uint64_t this_arg) {
69584         LDKBolt11Invoice this_arg_conv;
69585         this_arg_conv.inner = untag_ptr(this_arg);
69586         this_arg_conv.is_owned = ptr_is_owned(this_arg);
69587         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
69588         this_arg_conv = Bolt11Invoice_clone(&this_arg_conv);
69589         LDKSignedRawBolt11Invoice ret_var = Bolt11Invoice_into_signed_raw(this_arg_conv);
69590         uint64_t ret_ref = 0;
69591         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
69592         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
69593         return ret_ref;
69594 }
69595
69596 uint64_t  __attribute__((export_name("TS_Bolt11Invoice_check_signature"))) TS_Bolt11Invoice_check_signature(uint64_t this_arg) {
69597         LDKBolt11Invoice this_arg_conv;
69598         this_arg_conv.inner = untag_ptr(this_arg);
69599         this_arg_conv.is_owned = ptr_is_owned(this_arg);
69600         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
69601         this_arg_conv.is_owned = false;
69602         LDKCResult_NoneBolt11SemanticErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneBolt11SemanticErrorZ), "LDKCResult_NoneBolt11SemanticErrorZ");
69603         *ret_conv = Bolt11Invoice_check_signature(&this_arg_conv);
69604         return tag_ptr(ret_conv, true);
69605 }
69606
69607 uint64_t  __attribute__((export_name("TS_Bolt11Invoice_from_signed"))) TS_Bolt11Invoice_from_signed(uint64_t signed_invoice) {
69608         LDKSignedRawBolt11Invoice signed_invoice_conv;
69609         signed_invoice_conv.inner = untag_ptr(signed_invoice);
69610         signed_invoice_conv.is_owned = ptr_is_owned(signed_invoice);
69611         CHECK_INNER_FIELD_ACCESS_OR_NULL(signed_invoice_conv);
69612         signed_invoice_conv = SignedRawBolt11Invoice_clone(&signed_invoice_conv);
69613         LDKCResult_Bolt11InvoiceBolt11SemanticErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_Bolt11InvoiceBolt11SemanticErrorZ), "LDKCResult_Bolt11InvoiceBolt11SemanticErrorZ");
69614         *ret_conv = Bolt11Invoice_from_signed(signed_invoice_conv);
69615         return tag_ptr(ret_conv, true);
69616 }
69617
69618 int64_t  __attribute__((export_name("TS_Bolt11Invoice_duration_since_epoch"))) TS_Bolt11Invoice_duration_since_epoch(uint64_t this_arg) {
69619         LDKBolt11Invoice this_arg_conv;
69620         this_arg_conv.inner = untag_ptr(this_arg);
69621         this_arg_conv.is_owned = ptr_is_owned(this_arg);
69622         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
69623         this_arg_conv.is_owned = false;
69624         int64_t ret_conv = Bolt11Invoice_duration_since_epoch(&this_arg_conv);
69625         return ret_conv;
69626 }
69627
69628 int8_tArray  __attribute__((export_name("TS_Bolt11Invoice_payment_hash"))) TS_Bolt11Invoice_payment_hash(uint64_t this_arg) {
69629         LDKBolt11Invoice this_arg_conv;
69630         this_arg_conv.inner = untag_ptr(this_arg);
69631         this_arg_conv.is_owned = ptr_is_owned(this_arg);
69632         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
69633         this_arg_conv.is_owned = false;
69634         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
69635         memcpy(ret_arr->elems, *Bolt11Invoice_payment_hash(&this_arg_conv), 32);
69636         return ret_arr;
69637 }
69638
69639 int8_tArray  __attribute__((export_name("TS_Bolt11Invoice_payee_pub_key"))) TS_Bolt11Invoice_payee_pub_key(uint64_t this_arg) {
69640         LDKBolt11Invoice this_arg_conv;
69641         this_arg_conv.inner = untag_ptr(this_arg);
69642         this_arg_conv.is_owned = ptr_is_owned(this_arg);
69643         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
69644         this_arg_conv.is_owned = false;
69645         int8_tArray ret_arr = init_int8_tArray(33, __LINE__);
69646         memcpy(ret_arr->elems, Bolt11Invoice_payee_pub_key(&this_arg_conv).compressed_form, 33);
69647         return ret_arr;
69648 }
69649
69650 int8_tArray  __attribute__((export_name("TS_Bolt11Invoice_payment_secret"))) TS_Bolt11Invoice_payment_secret(uint64_t this_arg) {
69651         LDKBolt11Invoice this_arg_conv;
69652         this_arg_conv.inner = untag_ptr(this_arg);
69653         this_arg_conv.is_owned = ptr_is_owned(this_arg);
69654         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
69655         this_arg_conv.is_owned = false;
69656         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
69657         memcpy(ret_arr->elems, *Bolt11Invoice_payment_secret(&this_arg_conv), 32);
69658         return ret_arr;
69659 }
69660
69661 uint64_t  __attribute__((export_name("TS_Bolt11Invoice_payment_metadata"))) TS_Bolt11Invoice_payment_metadata(uint64_t this_arg) {
69662         LDKBolt11Invoice this_arg_conv;
69663         this_arg_conv.inner = untag_ptr(this_arg);
69664         this_arg_conv.is_owned = ptr_is_owned(this_arg);
69665         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
69666         this_arg_conv.is_owned = false;
69667         LDKCOption_CVec_u8ZZ *ret_copy = MALLOC(sizeof(LDKCOption_CVec_u8ZZ), "LDKCOption_CVec_u8ZZ");
69668         *ret_copy = Bolt11Invoice_payment_metadata(&this_arg_conv);
69669         uint64_t ret_ref = tag_ptr(ret_copy, true);
69670         return ret_ref;
69671 }
69672
69673 uint64_t  __attribute__((export_name("TS_Bolt11Invoice_features"))) TS_Bolt11Invoice_features(uint64_t this_arg) {
69674         LDKBolt11Invoice this_arg_conv;
69675         this_arg_conv.inner = untag_ptr(this_arg);
69676         this_arg_conv.is_owned = ptr_is_owned(this_arg);
69677         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
69678         this_arg_conv.is_owned = false;
69679         LDKBolt11InvoiceFeatures ret_var = Bolt11Invoice_features(&this_arg_conv);
69680         uint64_t ret_ref = 0;
69681         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
69682         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
69683         return ret_ref;
69684 }
69685
69686 int8_tArray  __attribute__((export_name("TS_Bolt11Invoice_recover_payee_pub_key"))) TS_Bolt11Invoice_recover_payee_pub_key(uint64_t this_arg) {
69687         LDKBolt11Invoice this_arg_conv;
69688         this_arg_conv.inner = untag_ptr(this_arg);
69689         this_arg_conv.is_owned = ptr_is_owned(this_arg);
69690         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
69691         this_arg_conv.is_owned = false;
69692         int8_tArray ret_arr = init_int8_tArray(33, __LINE__);
69693         memcpy(ret_arr->elems, Bolt11Invoice_recover_payee_pub_key(&this_arg_conv).compressed_form, 33);
69694         return ret_arr;
69695 }
69696
69697 uint64_t  __attribute__((export_name("TS_Bolt11Invoice_expires_at"))) TS_Bolt11Invoice_expires_at(uint64_t this_arg) {
69698         LDKBolt11Invoice this_arg_conv;
69699         this_arg_conv.inner = untag_ptr(this_arg);
69700         this_arg_conv.is_owned = ptr_is_owned(this_arg);
69701         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
69702         this_arg_conv.is_owned = false;
69703         LDKCOption_u64Z *ret_copy = MALLOC(sizeof(LDKCOption_u64Z), "LDKCOption_u64Z");
69704         *ret_copy = Bolt11Invoice_expires_at(&this_arg_conv);
69705         uint64_t ret_ref = tag_ptr(ret_copy, true);
69706         return ret_ref;
69707 }
69708
69709 int64_t  __attribute__((export_name("TS_Bolt11Invoice_expiry_time"))) TS_Bolt11Invoice_expiry_time(uint64_t this_arg) {
69710         LDKBolt11Invoice this_arg_conv;
69711         this_arg_conv.inner = untag_ptr(this_arg);
69712         this_arg_conv.is_owned = ptr_is_owned(this_arg);
69713         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
69714         this_arg_conv.is_owned = false;
69715         int64_t ret_conv = Bolt11Invoice_expiry_time(&this_arg_conv);
69716         return ret_conv;
69717 }
69718
69719 int64_t  __attribute__((export_name("TS_Bolt11Invoice_expiration_remaining_from_epoch"))) TS_Bolt11Invoice_expiration_remaining_from_epoch(uint64_t this_arg, int64_t time) {
69720         LDKBolt11Invoice this_arg_conv;
69721         this_arg_conv.inner = untag_ptr(this_arg);
69722         this_arg_conv.is_owned = ptr_is_owned(this_arg);
69723         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
69724         this_arg_conv.is_owned = false;
69725         int64_t ret_conv = Bolt11Invoice_expiration_remaining_from_epoch(&this_arg_conv, time);
69726         return ret_conv;
69727 }
69728
69729 jboolean  __attribute__((export_name("TS_Bolt11Invoice_would_expire"))) TS_Bolt11Invoice_would_expire(uint64_t this_arg, int64_t at_time) {
69730         LDKBolt11Invoice this_arg_conv;
69731         this_arg_conv.inner = untag_ptr(this_arg);
69732         this_arg_conv.is_owned = ptr_is_owned(this_arg);
69733         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
69734         this_arg_conv.is_owned = false;
69735         jboolean ret_conv = Bolt11Invoice_would_expire(&this_arg_conv, at_time);
69736         return ret_conv;
69737 }
69738
69739 int64_t  __attribute__((export_name("TS_Bolt11Invoice_min_final_cltv_expiry_delta"))) TS_Bolt11Invoice_min_final_cltv_expiry_delta(uint64_t this_arg) {
69740         LDKBolt11Invoice this_arg_conv;
69741         this_arg_conv.inner = untag_ptr(this_arg);
69742         this_arg_conv.is_owned = ptr_is_owned(this_arg);
69743         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
69744         this_arg_conv.is_owned = false;
69745         int64_t ret_conv = Bolt11Invoice_min_final_cltv_expiry_delta(&this_arg_conv);
69746         return ret_conv;
69747 }
69748
69749 ptrArray  __attribute__((export_name("TS_Bolt11Invoice_fallback_addresses"))) TS_Bolt11Invoice_fallback_addresses(uint64_t this_arg) {
69750         LDKBolt11Invoice this_arg_conv;
69751         this_arg_conv.inner = untag_ptr(this_arg);
69752         this_arg_conv.is_owned = ptr_is_owned(this_arg);
69753         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
69754         this_arg_conv.is_owned = false;
69755         LDKCVec_StrZ ret_var = Bolt11Invoice_fallback_addresses(&this_arg_conv);
69756         ptrArray ret_arr = NULL;
69757         ret_arr = init_ptrArray(ret_var.datalen, __LINE__);
69758         jstring *ret_arr_ptr = (jstring*)(((uint8_t*)ret_arr) + 8);
69759         for (size_t i = 0; i < ret_var.datalen; i++) {
69760                 LDKStr ret_conv_8_str = ret_var.data[i];
69761                 jstring ret_conv_8_conv = str_ref_to_ts(ret_conv_8_str.chars, ret_conv_8_str.len);
69762                 Str_free(ret_conv_8_str);
69763                 ret_arr_ptr[i] = ret_conv_8_conv;
69764         }
69765         
69766         FREE(ret_var.data);
69767         return ret_arr;
69768 }
69769
69770 uint64_tArray  __attribute__((export_name("TS_Bolt11Invoice_private_routes"))) TS_Bolt11Invoice_private_routes(uint64_t this_arg) {
69771         LDKBolt11Invoice this_arg_conv;
69772         this_arg_conv.inner = untag_ptr(this_arg);
69773         this_arg_conv.is_owned = ptr_is_owned(this_arg);
69774         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
69775         this_arg_conv.is_owned = false;
69776         LDKCVec_PrivateRouteZ ret_var = Bolt11Invoice_private_routes(&this_arg_conv);
69777         uint64_tArray ret_arr = NULL;
69778         ret_arr = init_uint64_tArray(ret_var.datalen, __LINE__);
69779         uint64_t *ret_arr_ptr = (uint64_t*)(((uint8_t*)ret_arr) + 8);
69780         for (size_t o = 0; o < ret_var.datalen; o++) {
69781                 LDKPrivateRoute ret_conv_14_var = ret_var.data[o];
69782                 uint64_t ret_conv_14_ref = 0;
69783                 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_conv_14_var);
69784                 ret_conv_14_ref = tag_ptr(ret_conv_14_var.inner, ret_conv_14_var.is_owned);
69785                 ret_arr_ptr[o] = ret_conv_14_ref;
69786         }
69787         
69788         FREE(ret_var.data);
69789         return ret_arr;
69790 }
69791
69792 uint64_tArray  __attribute__((export_name("TS_Bolt11Invoice_route_hints"))) TS_Bolt11Invoice_route_hints(uint64_t this_arg) {
69793         LDKBolt11Invoice this_arg_conv;
69794         this_arg_conv.inner = untag_ptr(this_arg);
69795         this_arg_conv.is_owned = ptr_is_owned(this_arg);
69796         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
69797         this_arg_conv.is_owned = false;
69798         LDKCVec_RouteHintZ ret_var = Bolt11Invoice_route_hints(&this_arg_conv);
69799         uint64_tArray ret_arr = NULL;
69800         ret_arr = init_uint64_tArray(ret_var.datalen, __LINE__);
69801         uint64_t *ret_arr_ptr = (uint64_t*)(((uint8_t*)ret_arr) + 8);
69802         for (size_t l = 0; l < ret_var.datalen; l++) {
69803                 LDKRouteHint ret_conv_11_var = ret_var.data[l];
69804                 uint64_t ret_conv_11_ref = 0;
69805                 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_conv_11_var);
69806                 ret_conv_11_ref = tag_ptr(ret_conv_11_var.inner, ret_conv_11_var.is_owned);
69807                 ret_arr_ptr[l] = ret_conv_11_ref;
69808         }
69809         
69810         FREE(ret_var.data);
69811         return ret_arr;
69812 }
69813
69814 uint32_t  __attribute__((export_name("TS_Bolt11Invoice_currency"))) TS_Bolt11Invoice_currency(uint64_t this_arg) {
69815         LDKBolt11Invoice this_arg_conv;
69816         this_arg_conv.inner = untag_ptr(this_arg);
69817         this_arg_conv.is_owned = ptr_is_owned(this_arg);
69818         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
69819         this_arg_conv.is_owned = false;
69820         uint32_t ret_conv = LDKCurrency_to_js(Bolt11Invoice_currency(&this_arg_conv));
69821         return ret_conv;
69822 }
69823
69824 uint64_t  __attribute__((export_name("TS_Bolt11Invoice_amount_milli_satoshis"))) TS_Bolt11Invoice_amount_milli_satoshis(uint64_t this_arg) {
69825         LDKBolt11Invoice this_arg_conv;
69826         this_arg_conv.inner = untag_ptr(this_arg);
69827         this_arg_conv.is_owned = ptr_is_owned(this_arg);
69828         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
69829         this_arg_conv.is_owned = false;
69830         LDKCOption_u64Z *ret_copy = MALLOC(sizeof(LDKCOption_u64Z), "LDKCOption_u64Z");
69831         *ret_copy = Bolt11Invoice_amount_milli_satoshis(&this_arg_conv);
69832         uint64_t ret_ref = tag_ptr(ret_copy, true);
69833         return ret_ref;
69834 }
69835
69836 uint64_t  __attribute__((export_name("TS_Description_new"))) TS_Description_new(jstring description) {
69837         LDKStr description_conv = str_ref_to_owned_c(description);
69838         LDKCResult_DescriptionCreationErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_DescriptionCreationErrorZ), "LDKCResult_DescriptionCreationErrorZ");
69839         *ret_conv = Description_new(description_conv);
69840         return tag_ptr(ret_conv, true);
69841 }
69842
69843 jstring  __attribute__((export_name("TS_Description_into_inner"))) TS_Description_into_inner(uint64_t this_arg) {
69844         LDKDescription this_arg_conv;
69845         this_arg_conv.inner = untag_ptr(this_arg);
69846         this_arg_conv.is_owned = ptr_is_owned(this_arg);
69847         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
69848         this_arg_conv = Description_clone(&this_arg_conv);
69849         LDKStr ret_str = Description_into_inner(this_arg_conv);
69850         jstring ret_conv = str_ref_to_ts(ret_str.chars, ret_str.len);
69851         Str_free(ret_str);
69852         return ret_conv;
69853 }
69854
69855 uint64_t  __attribute__((export_name("TS_ExpiryTime_from_seconds"))) TS_ExpiryTime_from_seconds(int64_t seconds) {
69856         LDKExpiryTime ret_var = ExpiryTime_from_seconds(seconds);
69857         uint64_t ret_ref = 0;
69858         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
69859         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
69860         return ret_ref;
69861 }
69862
69863 uint64_t  __attribute__((export_name("TS_ExpiryTime_from_duration"))) TS_ExpiryTime_from_duration(int64_t duration) {
69864         LDKExpiryTime ret_var = ExpiryTime_from_duration(duration);
69865         uint64_t ret_ref = 0;
69866         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
69867         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
69868         return ret_ref;
69869 }
69870
69871 int64_t  __attribute__((export_name("TS_ExpiryTime_as_seconds"))) TS_ExpiryTime_as_seconds(uint64_t this_arg) {
69872         LDKExpiryTime this_arg_conv;
69873         this_arg_conv.inner = untag_ptr(this_arg);
69874         this_arg_conv.is_owned = ptr_is_owned(this_arg);
69875         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
69876         this_arg_conv.is_owned = false;
69877         int64_t ret_conv = ExpiryTime_as_seconds(&this_arg_conv);
69878         return ret_conv;
69879 }
69880
69881 int64_t  __attribute__((export_name("TS_ExpiryTime_as_duration"))) TS_ExpiryTime_as_duration(uint64_t this_arg) {
69882         LDKExpiryTime this_arg_conv;
69883         this_arg_conv.inner = untag_ptr(this_arg);
69884         this_arg_conv.is_owned = ptr_is_owned(this_arg);
69885         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
69886         this_arg_conv.is_owned = false;
69887         int64_t ret_conv = ExpiryTime_as_duration(&this_arg_conv);
69888         return ret_conv;
69889 }
69890
69891 uint64_t  __attribute__((export_name("TS_PrivateRoute_new"))) TS_PrivateRoute_new(uint64_t hops) {
69892         LDKRouteHint hops_conv;
69893         hops_conv.inner = untag_ptr(hops);
69894         hops_conv.is_owned = ptr_is_owned(hops);
69895         CHECK_INNER_FIELD_ACCESS_OR_NULL(hops_conv);
69896         hops_conv = RouteHint_clone(&hops_conv);
69897         LDKCResult_PrivateRouteCreationErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PrivateRouteCreationErrorZ), "LDKCResult_PrivateRouteCreationErrorZ");
69898         *ret_conv = PrivateRoute_new(hops_conv);
69899         return tag_ptr(ret_conv, true);
69900 }
69901
69902 uint64_t  __attribute__((export_name("TS_PrivateRoute_into_inner"))) TS_PrivateRoute_into_inner(uint64_t this_arg) {
69903         LDKPrivateRoute this_arg_conv;
69904         this_arg_conv.inner = untag_ptr(this_arg);
69905         this_arg_conv.is_owned = ptr_is_owned(this_arg);
69906         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
69907         this_arg_conv = PrivateRoute_clone(&this_arg_conv);
69908         LDKRouteHint ret_var = PrivateRoute_into_inner(this_arg_conv);
69909         uint64_t ret_ref = 0;
69910         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
69911         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
69912         return ret_ref;
69913 }
69914
69915 uint32_t  __attribute__((export_name("TS_CreationError_clone"))) TS_CreationError_clone(uint64_t orig) {
69916         LDKCreationError* orig_conv = (LDKCreationError*)untag_ptr(orig);
69917         uint32_t ret_conv = LDKCreationError_to_js(CreationError_clone(orig_conv));
69918         return ret_conv;
69919 }
69920
69921 uint32_t  __attribute__((export_name("TS_CreationError_description_too_long"))) TS_CreationError_description_too_long() {
69922         uint32_t ret_conv = LDKCreationError_to_js(CreationError_description_too_long());
69923         return ret_conv;
69924 }
69925
69926 uint32_t  __attribute__((export_name("TS_CreationError_route_too_long"))) TS_CreationError_route_too_long() {
69927         uint32_t ret_conv = LDKCreationError_to_js(CreationError_route_too_long());
69928         return ret_conv;
69929 }
69930
69931 uint32_t  __attribute__((export_name("TS_CreationError_timestamp_out_of_bounds"))) TS_CreationError_timestamp_out_of_bounds() {
69932         uint32_t ret_conv = LDKCreationError_to_js(CreationError_timestamp_out_of_bounds());
69933         return ret_conv;
69934 }
69935
69936 uint32_t  __attribute__((export_name("TS_CreationError_invalid_amount"))) TS_CreationError_invalid_amount() {
69937         uint32_t ret_conv = LDKCreationError_to_js(CreationError_invalid_amount());
69938         return ret_conv;
69939 }
69940
69941 uint32_t  __attribute__((export_name("TS_CreationError_missing_route_hints"))) TS_CreationError_missing_route_hints() {
69942         uint32_t ret_conv = LDKCreationError_to_js(CreationError_missing_route_hints());
69943         return ret_conv;
69944 }
69945
69946 uint32_t  __attribute__((export_name("TS_CreationError_min_final_cltv_expiry_delta_too_short"))) TS_CreationError_min_final_cltv_expiry_delta_too_short() {
69947         uint32_t ret_conv = LDKCreationError_to_js(CreationError_min_final_cltv_expiry_delta_too_short());
69948         return ret_conv;
69949 }
69950
69951 jboolean  __attribute__((export_name("TS_CreationError_eq"))) TS_CreationError_eq(uint64_t a, uint64_t b) {
69952         LDKCreationError* a_conv = (LDKCreationError*)untag_ptr(a);
69953         LDKCreationError* b_conv = (LDKCreationError*)untag_ptr(b);
69954         jboolean ret_conv = CreationError_eq(a_conv, b_conv);
69955         return ret_conv;
69956 }
69957
69958 jstring  __attribute__((export_name("TS_CreationError_to_str"))) TS_CreationError_to_str(uint64_t o) {
69959         LDKCreationError* o_conv = (LDKCreationError*)untag_ptr(o);
69960         LDKStr ret_str = CreationError_to_str(o_conv);
69961         jstring ret_conv = str_ref_to_ts(ret_str.chars, ret_str.len);
69962         Str_free(ret_str);
69963         return ret_conv;
69964 }
69965
69966 uint32_t  __attribute__((export_name("TS_Bolt11SemanticError_clone"))) TS_Bolt11SemanticError_clone(uint64_t orig) {
69967         LDKBolt11SemanticError* orig_conv = (LDKBolt11SemanticError*)untag_ptr(orig);
69968         uint32_t ret_conv = LDKBolt11SemanticError_to_js(Bolt11SemanticError_clone(orig_conv));
69969         return ret_conv;
69970 }
69971
69972 uint32_t  __attribute__((export_name("TS_Bolt11SemanticError_no_payment_hash"))) TS_Bolt11SemanticError_no_payment_hash() {
69973         uint32_t ret_conv = LDKBolt11SemanticError_to_js(Bolt11SemanticError_no_payment_hash());
69974         return ret_conv;
69975 }
69976
69977 uint32_t  __attribute__((export_name("TS_Bolt11SemanticError_multiple_payment_hashes"))) TS_Bolt11SemanticError_multiple_payment_hashes() {
69978         uint32_t ret_conv = LDKBolt11SemanticError_to_js(Bolt11SemanticError_multiple_payment_hashes());
69979         return ret_conv;
69980 }
69981
69982 uint32_t  __attribute__((export_name("TS_Bolt11SemanticError_no_description"))) TS_Bolt11SemanticError_no_description() {
69983         uint32_t ret_conv = LDKBolt11SemanticError_to_js(Bolt11SemanticError_no_description());
69984         return ret_conv;
69985 }
69986
69987 uint32_t  __attribute__((export_name("TS_Bolt11SemanticError_multiple_descriptions"))) TS_Bolt11SemanticError_multiple_descriptions() {
69988         uint32_t ret_conv = LDKBolt11SemanticError_to_js(Bolt11SemanticError_multiple_descriptions());
69989         return ret_conv;
69990 }
69991
69992 uint32_t  __attribute__((export_name("TS_Bolt11SemanticError_no_payment_secret"))) TS_Bolt11SemanticError_no_payment_secret() {
69993         uint32_t ret_conv = LDKBolt11SemanticError_to_js(Bolt11SemanticError_no_payment_secret());
69994         return ret_conv;
69995 }
69996
69997 uint32_t  __attribute__((export_name("TS_Bolt11SemanticError_multiple_payment_secrets"))) TS_Bolt11SemanticError_multiple_payment_secrets() {
69998         uint32_t ret_conv = LDKBolt11SemanticError_to_js(Bolt11SemanticError_multiple_payment_secrets());
69999         return ret_conv;
70000 }
70001
70002 uint32_t  __attribute__((export_name("TS_Bolt11SemanticError_invalid_features"))) TS_Bolt11SemanticError_invalid_features() {
70003         uint32_t ret_conv = LDKBolt11SemanticError_to_js(Bolt11SemanticError_invalid_features());
70004         return ret_conv;
70005 }
70006
70007 uint32_t  __attribute__((export_name("TS_Bolt11SemanticError_invalid_recovery_id"))) TS_Bolt11SemanticError_invalid_recovery_id() {
70008         uint32_t ret_conv = LDKBolt11SemanticError_to_js(Bolt11SemanticError_invalid_recovery_id());
70009         return ret_conv;
70010 }
70011
70012 uint32_t  __attribute__((export_name("TS_Bolt11SemanticError_invalid_signature"))) TS_Bolt11SemanticError_invalid_signature() {
70013         uint32_t ret_conv = LDKBolt11SemanticError_to_js(Bolt11SemanticError_invalid_signature());
70014         return ret_conv;
70015 }
70016
70017 uint32_t  __attribute__((export_name("TS_Bolt11SemanticError_imprecise_amount"))) TS_Bolt11SemanticError_imprecise_amount() {
70018         uint32_t ret_conv = LDKBolt11SemanticError_to_js(Bolt11SemanticError_imprecise_amount());
70019         return ret_conv;
70020 }
70021
70022 jboolean  __attribute__((export_name("TS_Bolt11SemanticError_eq"))) TS_Bolt11SemanticError_eq(uint64_t a, uint64_t b) {
70023         LDKBolt11SemanticError* a_conv = (LDKBolt11SemanticError*)untag_ptr(a);
70024         LDKBolt11SemanticError* b_conv = (LDKBolt11SemanticError*)untag_ptr(b);
70025         jboolean ret_conv = Bolt11SemanticError_eq(a_conv, b_conv);
70026         return ret_conv;
70027 }
70028
70029 jstring  __attribute__((export_name("TS_Bolt11SemanticError_to_str"))) TS_Bolt11SemanticError_to_str(uint64_t o) {
70030         LDKBolt11SemanticError* o_conv = (LDKBolt11SemanticError*)untag_ptr(o);
70031         LDKStr ret_str = Bolt11SemanticError_to_str(o_conv);
70032         jstring ret_conv = str_ref_to_ts(ret_str.chars, ret_str.len);
70033         Str_free(ret_str);
70034         return ret_conv;
70035 }
70036
70037 void  __attribute__((export_name("TS_SignOrCreationError_free"))) TS_SignOrCreationError_free(uint64_t this_ptr) {
70038         if (!ptr_is_owned(this_ptr)) return;
70039         void* this_ptr_ptr = untag_ptr(this_ptr);
70040         CHECK_ACCESS(this_ptr_ptr);
70041         LDKSignOrCreationError this_ptr_conv = *(LDKSignOrCreationError*)(this_ptr_ptr);
70042         FREE(untag_ptr(this_ptr));
70043         SignOrCreationError_free(this_ptr_conv);
70044 }
70045
70046 static inline uint64_t SignOrCreationError_clone_ptr(LDKSignOrCreationError *NONNULL_PTR arg) {
70047         LDKSignOrCreationError *ret_copy = MALLOC(sizeof(LDKSignOrCreationError), "LDKSignOrCreationError");
70048         *ret_copy = SignOrCreationError_clone(arg);
70049         uint64_t ret_ref = tag_ptr(ret_copy, true);
70050         return ret_ref;
70051 }
70052 int64_t  __attribute__((export_name("TS_SignOrCreationError_clone_ptr"))) TS_SignOrCreationError_clone_ptr(uint64_t arg) {
70053         LDKSignOrCreationError* arg_conv = (LDKSignOrCreationError*)untag_ptr(arg);
70054         int64_t ret_conv = SignOrCreationError_clone_ptr(arg_conv);
70055         return ret_conv;
70056 }
70057
70058 uint64_t  __attribute__((export_name("TS_SignOrCreationError_clone"))) TS_SignOrCreationError_clone(uint64_t orig) {
70059         LDKSignOrCreationError* orig_conv = (LDKSignOrCreationError*)untag_ptr(orig);
70060         LDKSignOrCreationError *ret_copy = MALLOC(sizeof(LDKSignOrCreationError), "LDKSignOrCreationError");
70061         *ret_copy = SignOrCreationError_clone(orig_conv);
70062         uint64_t ret_ref = tag_ptr(ret_copy, true);
70063         return ret_ref;
70064 }
70065
70066 uint64_t  __attribute__((export_name("TS_SignOrCreationError_sign_error"))) TS_SignOrCreationError_sign_error() {
70067         LDKSignOrCreationError *ret_copy = MALLOC(sizeof(LDKSignOrCreationError), "LDKSignOrCreationError");
70068         *ret_copy = SignOrCreationError_sign_error();
70069         uint64_t ret_ref = tag_ptr(ret_copy, true);
70070         return ret_ref;
70071 }
70072
70073 uint64_t  __attribute__((export_name("TS_SignOrCreationError_creation_error"))) TS_SignOrCreationError_creation_error(uint32_t a) {
70074         LDKCreationError a_conv = LDKCreationError_from_js(a);
70075         LDKSignOrCreationError *ret_copy = MALLOC(sizeof(LDKSignOrCreationError), "LDKSignOrCreationError");
70076         *ret_copy = SignOrCreationError_creation_error(a_conv);
70077         uint64_t ret_ref = tag_ptr(ret_copy, true);
70078         return ret_ref;
70079 }
70080
70081 jboolean  __attribute__((export_name("TS_SignOrCreationError_eq"))) TS_SignOrCreationError_eq(uint64_t a, uint64_t b) {
70082         LDKSignOrCreationError* a_conv = (LDKSignOrCreationError*)untag_ptr(a);
70083         LDKSignOrCreationError* b_conv = (LDKSignOrCreationError*)untag_ptr(b);
70084         jboolean ret_conv = SignOrCreationError_eq(a_conv, b_conv);
70085         return ret_conv;
70086 }
70087
70088 jstring  __attribute__((export_name("TS_SignOrCreationError_to_str"))) TS_SignOrCreationError_to_str(uint64_t o) {
70089         LDKSignOrCreationError* o_conv = (LDKSignOrCreationError*)untag_ptr(o);
70090         LDKStr ret_str = SignOrCreationError_to_str(o_conv);
70091         jstring ret_conv = str_ref_to_ts(ret_str.chars, ret_str.len);
70092         Str_free(ret_str);
70093         return ret_conv;
70094 }
70095
70096 uint64_t  __attribute__((export_name("TS_pay_invoice"))) TS_pay_invoice(uint64_t invoice, uint64_t retry_strategy, uint64_t channelmanager) {
70097         LDKBolt11Invoice invoice_conv;
70098         invoice_conv.inner = untag_ptr(invoice);
70099         invoice_conv.is_owned = ptr_is_owned(invoice);
70100         CHECK_INNER_FIELD_ACCESS_OR_NULL(invoice_conv);
70101         invoice_conv.is_owned = false;
70102         void* retry_strategy_ptr = untag_ptr(retry_strategy);
70103         CHECK_ACCESS(retry_strategy_ptr);
70104         LDKRetry retry_strategy_conv = *(LDKRetry*)(retry_strategy_ptr);
70105         retry_strategy_conv = Retry_clone((LDKRetry*)untag_ptr(retry_strategy));
70106         LDKChannelManager channelmanager_conv;
70107         channelmanager_conv.inner = untag_ptr(channelmanager);
70108         channelmanager_conv.is_owned = ptr_is_owned(channelmanager);
70109         CHECK_INNER_FIELD_ACCESS_OR_NULL(channelmanager_conv);
70110         channelmanager_conv.is_owned = false;
70111         LDKCResult_ThirtyTwoBytesPaymentErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ThirtyTwoBytesPaymentErrorZ), "LDKCResult_ThirtyTwoBytesPaymentErrorZ");
70112         *ret_conv = pay_invoice(&invoice_conv, retry_strategy_conv, &channelmanager_conv);
70113         return tag_ptr(ret_conv, true);
70114 }
70115
70116 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) {
70117         LDKBolt11Invoice invoice_conv;
70118         invoice_conv.inner = untag_ptr(invoice);
70119         invoice_conv.is_owned = ptr_is_owned(invoice);
70120         CHECK_INNER_FIELD_ACCESS_OR_NULL(invoice_conv);
70121         invoice_conv.is_owned = false;
70122         LDKThirtyTwoBytes payment_id_ref;
70123         CHECK(payment_id->arr_len == 32);
70124         memcpy(payment_id_ref.data, payment_id->elems, 32); FREE(payment_id);
70125         void* retry_strategy_ptr = untag_ptr(retry_strategy);
70126         CHECK_ACCESS(retry_strategy_ptr);
70127         LDKRetry retry_strategy_conv = *(LDKRetry*)(retry_strategy_ptr);
70128         retry_strategy_conv = Retry_clone((LDKRetry*)untag_ptr(retry_strategy));
70129         LDKChannelManager channelmanager_conv;
70130         channelmanager_conv.inner = untag_ptr(channelmanager);
70131         channelmanager_conv.is_owned = ptr_is_owned(channelmanager);
70132         CHECK_INNER_FIELD_ACCESS_OR_NULL(channelmanager_conv);
70133         channelmanager_conv.is_owned = false;
70134         LDKCResult_NonePaymentErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NonePaymentErrorZ), "LDKCResult_NonePaymentErrorZ");
70135         *ret_conv = pay_invoice_with_id(&invoice_conv, payment_id_ref, retry_strategy_conv, &channelmanager_conv);
70136         return tag_ptr(ret_conv, true);
70137 }
70138
70139 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) {
70140         LDKBolt11Invoice invoice_conv;
70141         invoice_conv.inner = untag_ptr(invoice);
70142         invoice_conv.is_owned = ptr_is_owned(invoice);
70143         CHECK_INNER_FIELD_ACCESS_OR_NULL(invoice_conv);
70144         invoice_conv.is_owned = false;
70145         void* retry_strategy_ptr = untag_ptr(retry_strategy);
70146         CHECK_ACCESS(retry_strategy_ptr);
70147         LDKRetry retry_strategy_conv = *(LDKRetry*)(retry_strategy_ptr);
70148         retry_strategy_conv = Retry_clone((LDKRetry*)untag_ptr(retry_strategy));
70149         LDKChannelManager channelmanager_conv;
70150         channelmanager_conv.inner = untag_ptr(channelmanager);
70151         channelmanager_conv.is_owned = ptr_is_owned(channelmanager);
70152         CHECK_INNER_FIELD_ACCESS_OR_NULL(channelmanager_conv);
70153         channelmanager_conv.is_owned = false;
70154         LDKCResult_ThirtyTwoBytesPaymentErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ThirtyTwoBytesPaymentErrorZ), "LDKCResult_ThirtyTwoBytesPaymentErrorZ");
70155         *ret_conv = pay_zero_value_invoice(&invoice_conv, amount_msats, retry_strategy_conv, &channelmanager_conv);
70156         return tag_ptr(ret_conv, true);
70157 }
70158
70159 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) {
70160         LDKBolt11Invoice invoice_conv;
70161         invoice_conv.inner = untag_ptr(invoice);
70162         invoice_conv.is_owned = ptr_is_owned(invoice);
70163         CHECK_INNER_FIELD_ACCESS_OR_NULL(invoice_conv);
70164         invoice_conv.is_owned = false;
70165         LDKThirtyTwoBytes payment_id_ref;
70166         CHECK(payment_id->arr_len == 32);
70167         memcpy(payment_id_ref.data, payment_id->elems, 32); FREE(payment_id);
70168         void* retry_strategy_ptr = untag_ptr(retry_strategy);
70169         CHECK_ACCESS(retry_strategy_ptr);
70170         LDKRetry retry_strategy_conv = *(LDKRetry*)(retry_strategy_ptr);
70171         retry_strategy_conv = Retry_clone((LDKRetry*)untag_ptr(retry_strategy));
70172         LDKChannelManager channelmanager_conv;
70173         channelmanager_conv.inner = untag_ptr(channelmanager);
70174         channelmanager_conv.is_owned = ptr_is_owned(channelmanager);
70175         CHECK_INNER_FIELD_ACCESS_OR_NULL(channelmanager_conv);
70176         channelmanager_conv.is_owned = false;
70177         LDKCResult_NonePaymentErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NonePaymentErrorZ), "LDKCResult_NonePaymentErrorZ");
70178         *ret_conv = pay_zero_value_invoice_with_id(&invoice_conv, amount_msats, payment_id_ref, retry_strategy_conv, &channelmanager_conv);
70179         return tag_ptr(ret_conv, true);
70180 }
70181
70182 uint64_t  __attribute__((export_name("TS_preflight_probe_invoice"))) TS_preflight_probe_invoice(uint64_t invoice, uint64_t channelmanager, uint64_t liquidity_limit_multiplier) {
70183         LDKBolt11Invoice invoice_conv;
70184         invoice_conv.inner = untag_ptr(invoice);
70185         invoice_conv.is_owned = ptr_is_owned(invoice);
70186         CHECK_INNER_FIELD_ACCESS_OR_NULL(invoice_conv);
70187         invoice_conv.is_owned = false;
70188         LDKChannelManager channelmanager_conv;
70189         channelmanager_conv.inner = untag_ptr(channelmanager);
70190         channelmanager_conv.is_owned = ptr_is_owned(channelmanager);
70191         CHECK_INNER_FIELD_ACCESS_OR_NULL(channelmanager_conv);
70192         channelmanager_conv.is_owned = false;
70193         void* liquidity_limit_multiplier_ptr = untag_ptr(liquidity_limit_multiplier);
70194         CHECK_ACCESS(liquidity_limit_multiplier_ptr);
70195         LDKCOption_u64Z liquidity_limit_multiplier_conv = *(LDKCOption_u64Z*)(liquidity_limit_multiplier_ptr);
70196         liquidity_limit_multiplier_conv = COption_u64Z_clone((LDKCOption_u64Z*)untag_ptr(liquidity_limit_multiplier));
70197         LDKCResult_CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZProbingErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZProbingErrorZ), "LDKCResult_CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZProbingErrorZ");
70198         *ret_conv = preflight_probe_invoice(&invoice_conv, &channelmanager_conv, liquidity_limit_multiplier_conv);
70199         return tag_ptr(ret_conv, true);
70200 }
70201
70202 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) {
70203         LDKBolt11Invoice invoice_conv;
70204         invoice_conv.inner = untag_ptr(invoice);
70205         invoice_conv.is_owned = ptr_is_owned(invoice);
70206         CHECK_INNER_FIELD_ACCESS_OR_NULL(invoice_conv);
70207         invoice_conv.is_owned = false;
70208         LDKChannelManager channelmanager_conv;
70209         channelmanager_conv.inner = untag_ptr(channelmanager);
70210         channelmanager_conv.is_owned = ptr_is_owned(channelmanager);
70211         CHECK_INNER_FIELD_ACCESS_OR_NULL(channelmanager_conv);
70212         channelmanager_conv.is_owned = false;
70213         void* liquidity_limit_multiplier_ptr = untag_ptr(liquidity_limit_multiplier);
70214         CHECK_ACCESS(liquidity_limit_multiplier_ptr);
70215         LDKCOption_u64Z liquidity_limit_multiplier_conv = *(LDKCOption_u64Z*)(liquidity_limit_multiplier_ptr);
70216         liquidity_limit_multiplier_conv = COption_u64Z_clone((LDKCOption_u64Z*)untag_ptr(liquidity_limit_multiplier));
70217         LDKCResult_CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZProbingErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZProbingErrorZ), "LDKCResult_CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZProbingErrorZ");
70218         *ret_conv = preflight_probe_zero_value_invoice(&invoice_conv, amount_msat, &channelmanager_conv, liquidity_limit_multiplier_conv);
70219         return tag_ptr(ret_conv, true);
70220 }
70221
70222 void  __attribute__((export_name("TS_PaymentError_free"))) TS_PaymentError_free(uint64_t this_ptr) {
70223         if (!ptr_is_owned(this_ptr)) return;
70224         void* this_ptr_ptr = untag_ptr(this_ptr);
70225         CHECK_ACCESS(this_ptr_ptr);
70226         LDKPaymentError this_ptr_conv = *(LDKPaymentError*)(this_ptr_ptr);
70227         FREE(untag_ptr(this_ptr));
70228         PaymentError_free(this_ptr_conv);
70229 }
70230
70231 static inline uint64_t PaymentError_clone_ptr(LDKPaymentError *NONNULL_PTR arg) {
70232         LDKPaymentError *ret_copy = MALLOC(sizeof(LDKPaymentError), "LDKPaymentError");
70233         *ret_copy = PaymentError_clone(arg);
70234         uint64_t ret_ref = tag_ptr(ret_copy, true);
70235         return ret_ref;
70236 }
70237 int64_t  __attribute__((export_name("TS_PaymentError_clone_ptr"))) TS_PaymentError_clone_ptr(uint64_t arg) {
70238         LDKPaymentError* arg_conv = (LDKPaymentError*)untag_ptr(arg);
70239         int64_t ret_conv = PaymentError_clone_ptr(arg_conv);
70240         return ret_conv;
70241 }
70242
70243 uint64_t  __attribute__((export_name("TS_PaymentError_clone"))) TS_PaymentError_clone(uint64_t orig) {
70244         LDKPaymentError* orig_conv = (LDKPaymentError*)untag_ptr(orig);
70245         LDKPaymentError *ret_copy = MALLOC(sizeof(LDKPaymentError), "LDKPaymentError");
70246         *ret_copy = PaymentError_clone(orig_conv);
70247         uint64_t ret_ref = tag_ptr(ret_copy, true);
70248         return ret_ref;
70249 }
70250
70251 uint64_t  __attribute__((export_name("TS_PaymentError_invoice"))) TS_PaymentError_invoice(jstring a) {
70252         LDKStr a_conv = str_ref_to_owned_c(a);
70253         LDKPaymentError *ret_copy = MALLOC(sizeof(LDKPaymentError), "LDKPaymentError");
70254         *ret_copy = PaymentError_invoice(a_conv);
70255         uint64_t ret_ref = tag_ptr(ret_copy, true);
70256         return ret_ref;
70257 }
70258
70259 uint64_t  __attribute__((export_name("TS_PaymentError_sending"))) TS_PaymentError_sending(uint32_t a) {
70260         LDKRetryableSendFailure a_conv = LDKRetryableSendFailure_from_js(a);
70261         LDKPaymentError *ret_copy = MALLOC(sizeof(LDKPaymentError), "LDKPaymentError");
70262         *ret_copy = PaymentError_sending(a_conv);
70263         uint64_t ret_ref = tag_ptr(ret_copy, true);
70264         return ret_ref;
70265 }
70266
70267 jboolean  __attribute__((export_name("TS_PaymentError_eq"))) TS_PaymentError_eq(uint64_t a, uint64_t b) {
70268         LDKPaymentError* a_conv = (LDKPaymentError*)untag_ptr(a);
70269         LDKPaymentError* b_conv = (LDKPaymentError*)untag_ptr(b);
70270         jboolean ret_conv = PaymentError_eq(a_conv, b_conv);
70271         return ret_conv;
70272 }
70273
70274 void  __attribute__((export_name("TS_ProbingError_free"))) TS_ProbingError_free(uint64_t this_ptr) {
70275         if (!ptr_is_owned(this_ptr)) return;
70276         void* this_ptr_ptr = untag_ptr(this_ptr);
70277         CHECK_ACCESS(this_ptr_ptr);
70278         LDKProbingError this_ptr_conv = *(LDKProbingError*)(this_ptr_ptr);
70279         FREE(untag_ptr(this_ptr));
70280         ProbingError_free(this_ptr_conv);
70281 }
70282
70283 static inline uint64_t ProbingError_clone_ptr(LDKProbingError *NONNULL_PTR arg) {
70284         LDKProbingError *ret_copy = MALLOC(sizeof(LDKProbingError), "LDKProbingError");
70285         *ret_copy = ProbingError_clone(arg);
70286         uint64_t ret_ref = tag_ptr(ret_copy, true);
70287         return ret_ref;
70288 }
70289 int64_t  __attribute__((export_name("TS_ProbingError_clone_ptr"))) TS_ProbingError_clone_ptr(uint64_t arg) {
70290         LDKProbingError* arg_conv = (LDKProbingError*)untag_ptr(arg);
70291         int64_t ret_conv = ProbingError_clone_ptr(arg_conv);
70292         return ret_conv;
70293 }
70294
70295 uint64_t  __attribute__((export_name("TS_ProbingError_clone"))) TS_ProbingError_clone(uint64_t orig) {
70296         LDKProbingError* orig_conv = (LDKProbingError*)untag_ptr(orig);
70297         LDKProbingError *ret_copy = MALLOC(sizeof(LDKProbingError), "LDKProbingError");
70298         *ret_copy = ProbingError_clone(orig_conv);
70299         uint64_t ret_ref = tag_ptr(ret_copy, true);
70300         return ret_ref;
70301 }
70302
70303 uint64_t  __attribute__((export_name("TS_ProbingError_invoice"))) TS_ProbingError_invoice(jstring a) {
70304         LDKStr a_conv = str_ref_to_owned_c(a);
70305         LDKProbingError *ret_copy = MALLOC(sizeof(LDKProbingError), "LDKProbingError");
70306         *ret_copy = ProbingError_invoice(a_conv);
70307         uint64_t ret_ref = tag_ptr(ret_copy, true);
70308         return ret_ref;
70309 }
70310
70311 uint64_t  __attribute__((export_name("TS_ProbingError_sending"))) TS_ProbingError_sending(uint64_t a) {
70312         void* a_ptr = untag_ptr(a);
70313         CHECK_ACCESS(a_ptr);
70314         LDKProbeSendFailure a_conv = *(LDKProbeSendFailure*)(a_ptr);
70315         a_conv = ProbeSendFailure_clone((LDKProbeSendFailure*)untag_ptr(a));
70316         LDKProbingError *ret_copy = MALLOC(sizeof(LDKProbingError), "LDKProbingError");
70317         *ret_copy = ProbingError_sending(a_conv);
70318         uint64_t ret_ref = tag_ptr(ret_copy, true);
70319         return ret_ref;
70320 }
70321
70322 jboolean  __attribute__((export_name("TS_ProbingError_eq"))) TS_ProbingError_eq(uint64_t a, uint64_t b) {
70323         LDKProbingError* a_conv = (LDKProbingError*)untag_ptr(a);
70324         LDKProbingError* b_conv = (LDKProbingError*)untag_ptr(b);
70325         jboolean ret_conv = ProbingError_eq(a_conv, b_conv);
70326         return ret_conv;
70327 }
70328
70329 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) {
70330         void* amt_msat_ptr = untag_ptr(amt_msat);
70331         CHECK_ACCESS(amt_msat_ptr);
70332         LDKCOption_u64Z amt_msat_conv = *(LDKCOption_u64Z*)(amt_msat_ptr);
70333         amt_msat_conv = COption_u64Z_clone((LDKCOption_u64Z*)untag_ptr(amt_msat));
70334         void* payment_hash_ptr = untag_ptr(payment_hash);
70335         CHECK_ACCESS(payment_hash_ptr);
70336         LDKCOption_ThirtyTwoBytesZ payment_hash_conv = *(LDKCOption_ThirtyTwoBytesZ*)(payment_hash_ptr);
70337         payment_hash_conv = COption_ThirtyTwoBytesZ_clone((LDKCOption_ThirtyTwoBytesZ*)untag_ptr(payment_hash));
70338         LDKStr description_conv = str_ref_to_owned_c(description);
70339         LDKCVec_PhantomRouteHintsZ phantom_route_hints_constr;
70340         phantom_route_hints_constr.datalen = phantom_route_hints->arr_len;
70341         if (phantom_route_hints_constr.datalen > 0)
70342                 phantom_route_hints_constr.data = MALLOC(phantom_route_hints_constr.datalen * sizeof(LDKPhantomRouteHints), "LDKCVec_PhantomRouteHintsZ Elements");
70343         else
70344                 phantom_route_hints_constr.data = NULL;
70345         uint64_t* phantom_route_hints_vals = phantom_route_hints->elems;
70346         for (size_t t = 0; t < phantom_route_hints_constr.datalen; t++) {
70347                 uint64_t phantom_route_hints_conv_19 = phantom_route_hints_vals[t];
70348                 LDKPhantomRouteHints phantom_route_hints_conv_19_conv;
70349                 phantom_route_hints_conv_19_conv.inner = untag_ptr(phantom_route_hints_conv_19);
70350                 phantom_route_hints_conv_19_conv.is_owned = ptr_is_owned(phantom_route_hints_conv_19);
70351                 CHECK_INNER_FIELD_ACCESS_OR_NULL(phantom_route_hints_conv_19_conv);
70352                 phantom_route_hints_conv_19_conv = PhantomRouteHints_clone(&phantom_route_hints_conv_19_conv);
70353                 phantom_route_hints_constr.data[t] = phantom_route_hints_conv_19_conv;
70354         }
70355         FREE(phantom_route_hints);
70356         void* entropy_source_ptr = untag_ptr(entropy_source);
70357         CHECK_ACCESS(entropy_source_ptr);
70358         LDKEntropySource entropy_source_conv = *(LDKEntropySource*)(entropy_source_ptr);
70359         if (entropy_source_conv.free == LDKEntropySource_JCalls_free) {
70360                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
70361                 LDKEntropySource_JCalls_cloned(&entropy_source_conv);
70362         }
70363         void* node_signer_ptr = untag_ptr(node_signer);
70364         CHECK_ACCESS(node_signer_ptr);
70365         LDKNodeSigner node_signer_conv = *(LDKNodeSigner*)(node_signer_ptr);
70366         if (node_signer_conv.free == LDKNodeSigner_JCalls_free) {
70367                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
70368                 LDKNodeSigner_JCalls_cloned(&node_signer_conv);
70369         }
70370         void* logger_ptr = untag_ptr(logger);
70371         CHECK_ACCESS(logger_ptr);
70372         LDKLogger logger_conv = *(LDKLogger*)(logger_ptr);
70373         if (logger_conv.free == LDKLogger_JCalls_free) {
70374                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
70375                 LDKLogger_JCalls_cloned(&logger_conv);
70376         }
70377         LDKCurrency network_conv = LDKCurrency_from_js(network);
70378         void* min_final_cltv_expiry_delta_ptr = untag_ptr(min_final_cltv_expiry_delta);
70379         CHECK_ACCESS(min_final_cltv_expiry_delta_ptr);
70380         LDKCOption_u16Z min_final_cltv_expiry_delta_conv = *(LDKCOption_u16Z*)(min_final_cltv_expiry_delta_ptr);
70381         min_final_cltv_expiry_delta_conv = COption_u16Z_clone((LDKCOption_u16Z*)untag_ptr(min_final_cltv_expiry_delta));
70382         LDKCResult_Bolt11InvoiceSignOrCreationErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_Bolt11InvoiceSignOrCreationErrorZ), "LDKCResult_Bolt11InvoiceSignOrCreationErrorZ");
70383         *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);
70384         return tag_ptr(ret_conv, true);
70385 }
70386
70387 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) {
70388         void* amt_msat_ptr = untag_ptr(amt_msat);
70389         CHECK_ACCESS(amt_msat_ptr);
70390         LDKCOption_u64Z amt_msat_conv = *(LDKCOption_u64Z*)(amt_msat_ptr);
70391         amt_msat_conv = COption_u64Z_clone((LDKCOption_u64Z*)untag_ptr(amt_msat));
70392         void* payment_hash_ptr = untag_ptr(payment_hash);
70393         CHECK_ACCESS(payment_hash_ptr);
70394         LDKCOption_ThirtyTwoBytesZ payment_hash_conv = *(LDKCOption_ThirtyTwoBytesZ*)(payment_hash_ptr);
70395         payment_hash_conv = COption_ThirtyTwoBytesZ_clone((LDKCOption_ThirtyTwoBytesZ*)untag_ptr(payment_hash));
70396         LDKSha256 description_hash_conv;
70397         description_hash_conv.inner = untag_ptr(description_hash);
70398         description_hash_conv.is_owned = ptr_is_owned(description_hash);
70399         CHECK_INNER_FIELD_ACCESS_OR_NULL(description_hash_conv);
70400         description_hash_conv = Sha256_clone(&description_hash_conv);
70401         LDKCVec_PhantomRouteHintsZ phantom_route_hints_constr;
70402         phantom_route_hints_constr.datalen = phantom_route_hints->arr_len;
70403         if (phantom_route_hints_constr.datalen > 0)
70404                 phantom_route_hints_constr.data = MALLOC(phantom_route_hints_constr.datalen * sizeof(LDKPhantomRouteHints), "LDKCVec_PhantomRouteHintsZ Elements");
70405         else
70406                 phantom_route_hints_constr.data = NULL;
70407         uint64_t* phantom_route_hints_vals = phantom_route_hints->elems;
70408         for (size_t t = 0; t < phantom_route_hints_constr.datalen; t++) {
70409                 uint64_t phantom_route_hints_conv_19 = phantom_route_hints_vals[t];
70410                 LDKPhantomRouteHints phantom_route_hints_conv_19_conv;
70411                 phantom_route_hints_conv_19_conv.inner = untag_ptr(phantom_route_hints_conv_19);
70412                 phantom_route_hints_conv_19_conv.is_owned = ptr_is_owned(phantom_route_hints_conv_19);
70413                 CHECK_INNER_FIELD_ACCESS_OR_NULL(phantom_route_hints_conv_19_conv);
70414                 phantom_route_hints_conv_19_conv = PhantomRouteHints_clone(&phantom_route_hints_conv_19_conv);
70415                 phantom_route_hints_constr.data[t] = phantom_route_hints_conv_19_conv;
70416         }
70417         FREE(phantom_route_hints);
70418         void* entropy_source_ptr = untag_ptr(entropy_source);
70419         CHECK_ACCESS(entropy_source_ptr);
70420         LDKEntropySource entropy_source_conv = *(LDKEntropySource*)(entropy_source_ptr);
70421         if (entropy_source_conv.free == LDKEntropySource_JCalls_free) {
70422                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
70423                 LDKEntropySource_JCalls_cloned(&entropy_source_conv);
70424         }
70425         void* node_signer_ptr = untag_ptr(node_signer);
70426         CHECK_ACCESS(node_signer_ptr);
70427         LDKNodeSigner node_signer_conv = *(LDKNodeSigner*)(node_signer_ptr);
70428         if (node_signer_conv.free == LDKNodeSigner_JCalls_free) {
70429                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
70430                 LDKNodeSigner_JCalls_cloned(&node_signer_conv);
70431         }
70432         void* logger_ptr = untag_ptr(logger);
70433         CHECK_ACCESS(logger_ptr);
70434         LDKLogger logger_conv = *(LDKLogger*)(logger_ptr);
70435         if (logger_conv.free == LDKLogger_JCalls_free) {
70436                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
70437                 LDKLogger_JCalls_cloned(&logger_conv);
70438         }
70439         LDKCurrency network_conv = LDKCurrency_from_js(network);
70440         void* min_final_cltv_expiry_delta_ptr = untag_ptr(min_final_cltv_expiry_delta);
70441         CHECK_ACCESS(min_final_cltv_expiry_delta_ptr);
70442         LDKCOption_u16Z min_final_cltv_expiry_delta_conv = *(LDKCOption_u16Z*)(min_final_cltv_expiry_delta_ptr);
70443         min_final_cltv_expiry_delta_conv = COption_u16Z_clone((LDKCOption_u16Z*)untag_ptr(min_final_cltv_expiry_delta));
70444         LDKCResult_Bolt11InvoiceSignOrCreationErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_Bolt11InvoiceSignOrCreationErrorZ), "LDKCResult_Bolt11InvoiceSignOrCreationErrorZ");
70445         *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);
70446         return tag_ptr(ret_conv, true);
70447 }
70448
70449 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) {
70450         LDKChannelManager channelmanager_conv;
70451         channelmanager_conv.inner = untag_ptr(channelmanager);
70452         channelmanager_conv.is_owned = ptr_is_owned(channelmanager);
70453         CHECK_INNER_FIELD_ACCESS_OR_NULL(channelmanager_conv);
70454         channelmanager_conv.is_owned = false;
70455         void* node_signer_ptr = untag_ptr(node_signer);
70456         CHECK_ACCESS(node_signer_ptr);
70457         LDKNodeSigner node_signer_conv = *(LDKNodeSigner*)(node_signer_ptr);
70458         if (node_signer_conv.free == LDKNodeSigner_JCalls_free) {
70459                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
70460                 LDKNodeSigner_JCalls_cloned(&node_signer_conv);
70461         }
70462         void* logger_ptr = untag_ptr(logger);
70463         CHECK_ACCESS(logger_ptr);
70464         LDKLogger logger_conv = *(LDKLogger*)(logger_ptr);
70465         if (logger_conv.free == LDKLogger_JCalls_free) {
70466                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
70467                 LDKLogger_JCalls_cloned(&logger_conv);
70468         }
70469         LDKCurrency network_conv = LDKCurrency_from_js(network);
70470         void* amt_msat_ptr = untag_ptr(amt_msat);
70471         CHECK_ACCESS(amt_msat_ptr);
70472         LDKCOption_u64Z amt_msat_conv = *(LDKCOption_u64Z*)(amt_msat_ptr);
70473         amt_msat_conv = COption_u64Z_clone((LDKCOption_u64Z*)untag_ptr(amt_msat));
70474         LDKSha256 description_hash_conv;
70475         description_hash_conv.inner = untag_ptr(description_hash);
70476         description_hash_conv.is_owned = ptr_is_owned(description_hash);
70477         CHECK_INNER_FIELD_ACCESS_OR_NULL(description_hash_conv);
70478         description_hash_conv = Sha256_clone(&description_hash_conv);
70479         void* min_final_cltv_expiry_delta_ptr = untag_ptr(min_final_cltv_expiry_delta);
70480         CHECK_ACCESS(min_final_cltv_expiry_delta_ptr);
70481         LDKCOption_u16Z min_final_cltv_expiry_delta_conv = *(LDKCOption_u16Z*)(min_final_cltv_expiry_delta_ptr);
70482         min_final_cltv_expiry_delta_conv = COption_u16Z_clone((LDKCOption_u16Z*)untag_ptr(min_final_cltv_expiry_delta));
70483         LDKCResult_Bolt11InvoiceSignOrCreationErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_Bolt11InvoiceSignOrCreationErrorZ), "LDKCResult_Bolt11InvoiceSignOrCreationErrorZ");
70484         *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);
70485         return tag_ptr(ret_conv, true);
70486 }
70487
70488 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) {
70489         LDKChannelManager channelmanager_conv;
70490         channelmanager_conv.inner = untag_ptr(channelmanager);
70491         channelmanager_conv.is_owned = ptr_is_owned(channelmanager);
70492         CHECK_INNER_FIELD_ACCESS_OR_NULL(channelmanager_conv);
70493         channelmanager_conv.is_owned = false;
70494         void* node_signer_ptr = untag_ptr(node_signer);
70495         CHECK_ACCESS(node_signer_ptr);
70496         LDKNodeSigner node_signer_conv = *(LDKNodeSigner*)(node_signer_ptr);
70497         if (node_signer_conv.free == LDKNodeSigner_JCalls_free) {
70498                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
70499                 LDKNodeSigner_JCalls_cloned(&node_signer_conv);
70500         }
70501         void* logger_ptr = untag_ptr(logger);
70502         CHECK_ACCESS(logger_ptr);
70503         LDKLogger logger_conv = *(LDKLogger*)(logger_ptr);
70504         if (logger_conv.free == LDKLogger_JCalls_free) {
70505                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
70506                 LDKLogger_JCalls_cloned(&logger_conv);
70507         }
70508         LDKCurrency network_conv = LDKCurrency_from_js(network);
70509         void* amt_msat_ptr = untag_ptr(amt_msat);
70510         CHECK_ACCESS(amt_msat_ptr);
70511         LDKCOption_u64Z amt_msat_conv = *(LDKCOption_u64Z*)(amt_msat_ptr);
70512         amt_msat_conv = COption_u64Z_clone((LDKCOption_u64Z*)untag_ptr(amt_msat));
70513         LDKStr description_conv = str_ref_to_owned_c(description);
70514         void* min_final_cltv_expiry_delta_ptr = untag_ptr(min_final_cltv_expiry_delta);
70515         CHECK_ACCESS(min_final_cltv_expiry_delta_ptr);
70516         LDKCOption_u16Z min_final_cltv_expiry_delta_conv = *(LDKCOption_u16Z*)(min_final_cltv_expiry_delta_ptr);
70517         min_final_cltv_expiry_delta_conv = COption_u16Z_clone((LDKCOption_u16Z*)untag_ptr(min_final_cltv_expiry_delta));
70518         LDKCResult_Bolt11InvoiceSignOrCreationErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_Bolt11InvoiceSignOrCreationErrorZ), "LDKCResult_Bolt11InvoiceSignOrCreationErrorZ");
70519         *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);
70520         return tag_ptr(ret_conv, true);
70521 }
70522
70523 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) {
70524         LDKChannelManager channelmanager_conv;
70525         channelmanager_conv.inner = untag_ptr(channelmanager);
70526         channelmanager_conv.is_owned = ptr_is_owned(channelmanager);
70527         CHECK_INNER_FIELD_ACCESS_OR_NULL(channelmanager_conv);
70528         channelmanager_conv.is_owned = false;
70529         void* node_signer_ptr = untag_ptr(node_signer);
70530         CHECK_ACCESS(node_signer_ptr);
70531         LDKNodeSigner node_signer_conv = *(LDKNodeSigner*)(node_signer_ptr);
70532         if (node_signer_conv.free == LDKNodeSigner_JCalls_free) {
70533                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
70534                 LDKNodeSigner_JCalls_cloned(&node_signer_conv);
70535         }
70536         void* logger_ptr = untag_ptr(logger);
70537         CHECK_ACCESS(logger_ptr);
70538         LDKLogger logger_conv = *(LDKLogger*)(logger_ptr);
70539         if (logger_conv.free == LDKLogger_JCalls_free) {
70540                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
70541                 LDKLogger_JCalls_cloned(&logger_conv);
70542         }
70543         LDKCurrency network_conv = LDKCurrency_from_js(network);
70544         void* amt_msat_ptr = untag_ptr(amt_msat);
70545         CHECK_ACCESS(amt_msat_ptr);
70546         LDKCOption_u64Z amt_msat_conv = *(LDKCOption_u64Z*)(amt_msat_ptr);
70547         amt_msat_conv = COption_u64Z_clone((LDKCOption_u64Z*)untag_ptr(amt_msat));
70548         LDKStr description_conv = str_ref_to_owned_c(description);
70549         LDKThirtyTwoBytes payment_hash_ref;
70550         CHECK(payment_hash->arr_len == 32);
70551         memcpy(payment_hash_ref.data, payment_hash->elems, 32); FREE(payment_hash);
70552         void* min_final_cltv_expiry_delta_ptr = untag_ptr(min_final_cltv_expiry_delta);
70553         CHECK_ACCESS(min_final_cltv_expiry_delta_ptr);
70554         LDKCOption_u16Z min_final_cltv_expiry_delta_conv = *(LDKCOption_u16Z*)(min_final_cltv_expiry_delta_ptr);
70555         min_final_cltv_expiry_delta_conv = COption_u16Z_clone((LDKCOption_u16Z*)untag_ptr(min_final_cltv_expiry_delta));
70556         LDKCResult_Bolt11InvoiceSignOrCreationErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_Bolt11InvoiceSignOrCreationErrorZ), "LDKCResult_Bolt11InvoiceSignOrCreationErrorZ");
70557         *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);
70558         return tag_ptr(ret_conv, true);
70559 }
70560
70561 uint64_t  __attribute__((export_name("TS_SiPrefix_from_str"))) TS_SiPrefix_from_str(jstring s) {
70562         LDKStr s_conv = str_ref_to_owned_c(s);
70563         LDKCResult_SiPrefixBolt11ParseErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_SiPrefixBolt11ParseErrorZ), "LDKCResult_SiPrefixBolt11ParseErrorZ");
70564         *ret_conv = SiPrefix_from_str(s_conv);
70565         return tag_ptr(ret_conv, true);
70566 }
70567
70568 uint64_t  __attribute__((export_name("TS_Bolt11Invoice_from_str"))) TS_Bolt11Invoice_from_str(jstring s) {
70569         LDKStr s_conv = str_ref_to_owned_c(s);
70570         LDKCResult_Bolt11InvoiceParseOrSemanticErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_Bolt11InvoiceParseOrSemanticErrorZ), "LDKCResult_Bolt11InvoiceParseOrSemanticErrorZ");
70571         *ret_conv = Bolt11Invoice_from_str(s_conv);
70572         return tag_ptr(ret_conv, true);
70573 }
70574
70575 uint64_t  __attribute__((export_name("TS_SignedRawBolt11Invoice_from_str"))) TS_SignedRawBolt11Invoice_from_str(jstring s) {
70576         LDKStr s_conv = str_ref_to_owned_c(s);
70577         LDKCResult_SignedRawBolt11InvoiceBolt11ParseErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_SignedRawBolt11InvoiceBolt11ParseErrorZ), "LDKCResult_SignedRawBolt11InvoiceBolt11ParseErrorZ");
70578         *ret_conv = SignedRawBolt11Invoice_from_str(s_conv);
70579         return tag_ptr(ret_conv, true);
70580 }
70581
70582 jstring  __attribute__((export_name("TS_Bolt11ParseError_to_str"))) TS_Bolt11ParseError_to_str(uint64_t o) {
70583         LDKBolt11ParseError* o_conv = (LDKBolt11ParseError*)untag_ptr(o);
70584         LDKStr ret_str = Bolt11ParseError_to_str(o_conv);
70585         jstring ret_conv = str_ref_to_ts(ret_str.chars, ret_str.len);
70586         Str_free(ret_str);
70587         return ret_conv;
70588 }
70589
70590 jstring  __attribute__((export_name("TS_ParseOrSemanticError_to_str"))) TS_ParseOrSemanticError_to_str(uint64_t o) {
70591         LDKParseOrSemanticError* o_conv = (LDKParseOrSemanticError*)untag_ptr(o);
70592         LDKStr ret_str = ParseOrSemanticError_to_str(o_conv);
70593         jstring ret_conv = str_ref_to_ts(ret_str.chars, ret_str.len);
70594         Str_free(ret_str);
70595         return ret_conv;
70596 }
70597
70598 jstring  __attribute__((export_name("TS_Bolt11Invoice_to_str"))) TS_Bolt11Invoice_to_str(uint64_t o) {
70599         LDKBolt11Invoice o_conv;
70600         o_conv.inner = untag_ptr(o);
70601         o_conv.is_owned = ptr_is_owned(o);
70602         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
70603         o_conv.is_owned = false;
70604         LDKStr ret_str = Bolt11Invoice_to_str(&o_conv);
70605         jstring ret_conv = str_ref_to_ts(ret_str.chars, ret_str.len);
70606         Str_free(ret_str);
70607         return ret_conv;
70608 }
70609
70610 jstring  __attribute__((export_name("TS_SignedRawBolt11Invoice_to_str"))) TS_SignedRawBolt11Invoice_to_str(uint64_t o) {
70611         LDKSignedRawBolt11Invoice o_conv;
70612         o_conv.inner = untag_ptr(o);
70613         o_conv.is_owned = ptr_is_owned(o);
70614         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
70615         o_conv.is_owned = false;
70616         LDKStr ret_str = SignedRawBolt11Invoice_to_str(&o_conv);
70617         jstring ret_conv = str_ref_to_ts(ret_str.chars, ret_str.len);
70618         Str_free(ret_str);
70619         return ret_conv;
70620 }
70621
70622 jstring  __attribute__((export_name("TS_Currency_to_str"))) TS_Currency_to_str(uint64_t o) {
70623         LDKCurrency* o_conv = (LDKCurrency*)untag_ptr(o);
70624         LDKStr ret_str = Currency_to_str(o_conv);
70625         jstring ret_conv = str_ref_to_ts(ret_str.chars, ret_str.len);
70626         Str_free(ret_str);
70627         return ret_conv;
70628 }
70629
70630 jstring  __attribute__((export_name("TS_SiPrefix_to_str"))) TS_SiPrefix_to_str(uint64_t o) {
70631         LDKSiPrefix* o_conv = (LDKSiPrefix*)untag_ptr(o);
70632         LDKStr ret_str = SiPrefix_to_str(o_conv);
70633         jstring ret_conv = str_ref_to_ts(ret_str.chars, ret_str.len);
70634         Str_free(ret_str);
70635         return ret_conv;
70636 }
70637